altitude-design 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/dist/altitude.css +57 -15
- package/dist/altitude.iife.js +4 -4
- package/dist/altitude.no-fonts.css +57 -15
- package/dist/index.cjs +714 -426
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +714 -426
- package/dist/index.js.map +4 -4
- package/dist/types/collections.d.ts +6 -2
- package/dist/types/controls.d.ts +37 -8
- package/dist/types/index.d.ts +3 -1
- package/dist/types/overlays.d.ts +9 -2
- package/dist/types/suspense.d.ts +74 -0
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -435,9 +435,190 @@ function Kbd({ listen, className, children, ...rest }) {
|
|
|
435
435
|
}
|
|
436
436
|
|
|
437
437
|
// project/components/src/controls.tsx
|
|
438
|
+
import * as React3 from "react";
|
|
439
|
+
|
|
440
|
+
// project/components/src/suspense.tsx
|
|
438
441
|
import * as React2 from "react";
|
|
439
|
-
var
|
|
442
|
+
var isPromise = (v) => !!v && (typeof v === "object" || typeof v === "function") && typeof v.then === "function";
|
|
443
|
+
var hasPromise = (children) => Array.isArray(children) ? children.some(isPromise) : isPromise(children);
|
|
444
|
+
var settled = /* @__PURE__ */ new WeakMap();
|
|
445
|
+
var reactUse = React2.use;
|
|
446
|
+
function readPromised(v) {
|
|
447
|
+
if (!isPromise(v)) return v;
|
|
448
|
+
if (reactUse) return reactUse(v);
|
|
449
|
+
let r = settled.get(v);
|
|
450
|
+
if (!r) {
|
|
451
|
+
const rec = { s: "pending" };
|
|
452
|
+
settled.set(v, rec);
|
|
453
|
+
v.then((x) => {
|
|
454
|
+
rec.s = "done";
|
|
455
|
+
rec.v = x;
|
|
456
|
+
}, (e) => {
|
|
457
|
+
rec.s = "error";
|
|
458
|
+
rec.e = e;
|
|
459
|
+
});
|
|
460
|
+
r = rec;
|
|
461
|
+
}
|
|
462
|
+
if (r.s === "done") return r.v;
|
|
463
|
+
if (r.s === "error") throw r.e;
|
|
464
|
+
throw v;
|
|
465
|
+
}
|
|
466
|
+
function readChildren(children) {
|
|
467
|
+
return Array.isArray(children) ? children.map((c) => readPromised(c)) : readPromised(children);
|
|
468
|
+
}
|
|
469
|
+
function useArrival(waiting) {
|
|
470
|
+
const d = React2.useRef(null);
|
|
471
|
+
if (waiting && !d.current) {
|
|
472
|
+
let done;
|
|
473
|
+
d.current = { p: new Promise((r) => {
|
|
474
|
+
done = r;
|
|
475
|
+
}), done };
|
|
476
|
+
}
|
|
477
|
+
const cur = d.current;
|
|
478
|
+
useIsoLayoutEffect(() => {
|
|
479
|
+
if (!waiting && cur) {
|
|
480
|
+
cur.done();
|
|
481
|
+
if (d.current === cur) d.current = null;
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
return waiting && cur ? cur.p : null;
|
|
485
|
+
}
|
|
486
|
+
function Arrive({ when, children }) {
|
|
487
|
+
if (when) readPromised(when);
|
|
488
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, children);
|
|
489
|
+
}
|
|
490
|
+
function useHasWaited(waiting) {
|
|
491
|
+
const r = React2.useRef(false);
|
|
492
|
+
if (waiting) r.current = true;
|
|
493
|
+
return r.current;
|
|
494
|
+
}
|
|
495
|
+
var ScopeContext = React2.createContext(null);
|
|
496
|
+
function LoadingScope({ children }) {
|
|
497
|
+
const [members] = React2.useState(() => /* @__PURE__ */ new Set());
|
|
498
|
+
const [waiting, setWaiting] = React2.useState(false);
|
|
499
|
+
const report = React2.useCallback((id, w) => {
|
|
500
|
+
if (w) members.add(id);
|
|
501
|
+
else members.delete(id);
|
|
502
|
+
setWaiting(members.size > 0);
|
|
503
|
+
}, [members]);
|
|
504
|
+
const value = React2.useMemo(() => ({ report, waiting }), [report, waiting]);
|
|
505
|
+
return /* @__PURE__ */ React2.createElement(ScopeContext.Provider, { value }, children);
|
|
506
|
+
}
|
|
507
|
+
function useReportWaiting(waiting) {
|
|
508
|
+
const scope = React2.useContext(ScopeContext);
|
|
509
|
+
const [id] = React2.useState(() => ({}));
|
|
510
|
+
const report = scope?.report;
|
|
511
|
+
useIsoLayoutEffect(() => {
|
|
512
|
+
report?.(id, waiting);
|
|
513
|
+
}, [report, waiting]);
|
|
514
|
+
useIsoLayoutEffect(() => () => report?.(id, false), [report]);
|
|
515
|
+
}
|
|
516
|
+
var useScopeWaiting = () => !!React2.useContext(ScopeContext)?.waiting;
|
|
517
|
+
var Group = class {
|
|
518
|
+
constructor() {
|
|
519
|
+
this.waiting = /* @__PURE__ */ new Set();
|
|
520
|
+
this.held = /* @__PURE__ */ new Map();
|
|
521
|
+
}
|
|
522
|
+
wait(id) {
|
|
523
|
+
this.waiting.add(id);
|
|
524
|
+
}
|
|
525
|
+
/** Returns true when this was the last one: everything held is released together. */
|
|
526
|
+
land(id, release) {
|
|
527
|
+
this.waiting.delete(id);
|
|
528
|
+
this.held.set(id, release);
|
|
529
|
+
if (this.waiting.size) return false;
|
|
530
|
+
this.flush();
|
|
531
|
+
return true;
|
|
532
|
+
}
|
|
533
|
+
leave(id) {
|
|
534
|
+
this.waiting.delete(id);
|
|
535
|
+
this.held.delete(id);
|
|
536
|
+
if (!this.waiting.size && this.held.size) this.flush();
|
|
537
|
+
}
|
|
538
|
+
flush() {
|
|
539
|
+
const all = Array.from(this.held.values());
|
|
540
|
+
this.held.clear();
|
|
541
|
+
all.forEach((f) => f());
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
var GroupContext = React2.createContext(null);
|
|
545
|
+
function RevealGroup({ children }) {
|
|
546
|
+
const group = React2.useMemo(() => new Group(), []);
|
|
547
|
+
return /* @__PURE__ */ React2.createElement(GroupContext.Provider, { value: group }, children);
|
|
548
|
+
}
|
|
549
|
+
var GRACE = 300;
|
|
550
|
+
function Await({ imprint, shape = "block", inline, enabled = true, className, children }) {
|
|
551
|
+
const group = React2.useContext(GroupContext);
|
|
552
|
+
const box = React2.useRef({ id: {}, since: null });
|
|
553
|
+
React2.useEffect(() => () => group?.leave(box.current.id), [group]);
|
|
554
|
+
if (!enabled) return /* @__PURE__ */ React2.createElement(React2.Fragment, null, children);
|
|
555
|
+
return /* @__PURE__ */ React2.createElement(React2.Suspense, { fallback: /* @__PURE__ */ React2.createElement(Imprint, { box, group, inline }, imprint) }, /* @__PURE__ */ React2.createElement(Landed, { box, group, shape, inline, className, imprint }, children));
|
|
556
|
+
}
|
|
557
|
+
function Imprint({ box, group, inline, children }) {
|
|
558
|
+
useIsoLayoutEffect(() => {
|
|
559
|
+
if (box.current.since === null) box.current.since = performance.now();
|
|
560
|
+
group?.wait(box.current.id);
|
|
561
|
+
}, []);
|
|
562
|
+
return /* @__PURE__ */ React2.createElement("span", { className: "alt-await-wait", "data-inline": inline ? "" : void 0, "aria-busy": "true" }, children, /* @__PURE__ */ React2.createElement("span", { className: "alt-sr" }, "Loading"));
|
|
563
|
+
}
|
|
564
|
+
function Landed({ box, group, shape, inline, className, imprint, children }) {
|
|
565
|
+
const [phase, setPhase] = React2.useState(null);
|
|
566
|
+
const [delay, setDelay] = React2.useState(0);
|
|
567
|
+
const [graceLeft, setGraceLeft] = React2.useState(0);
|
|
568
|
+
const done = React2.useRef(void 0);
|
|
569
|
+
useIsoLayoutEffect(() => {
|
|
570
|
+
const since = box.current.since;
|
|
571
|
+
box.current.since = null;
|
|
572
|
+
if (since === null) return;
|
|
573
|
+
const release = () => {
|
|
574
|
+
clearTimeout(done.current);
|
|
575
|
+
if (performance.now() - since < GRACE) {
|
|
576
|
+
setPhase(null);
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
const d = riseDelay();
|
|
580
|
+
setDelay(d);
|
|
581
|
+
setPhase("reveal");
|
|
582
|
+
done.current = setTimeout(() => setPhase(null), d + 320);
|
|
583
|
+
};
|
|
584
|
+
if (group && !group.land(box.current.id, release)) {
|
|
585
|
+
setGraceLeft(Math.max(0, GRACE - (performance.now() - since)));
|
|
586
|
+
setPhase("held");
|
|
587
|
+
} else if (!group) release();
|
|
588
|
+
}, []);
|
|
589
|
+
React2.useEffect(() => () => clearTimeout(done.current), []);
|
|
440
590
|
return /* @__PURE__ */ React2.createElement(
|
|
591
|
+
"span",
|
|
592
|
+
{
|
|
593
|
+
className: cx("alt-await", className),
|
|
594
|
+
"data-phase": phase ?? void 0,
|
|
595
|
+
"data-inline": inline ? "" : void 0,
|
|
596
|
+
"data-shape": shape,
|
|
597
|
+
"aria-busy": phase === "held" || void 0,
|
|
598
|
+
style: phase ? { ["--alt-rise-delay"]: delay + "ms", ["--alt-grace-left"]: graceLeft + "ms" } : void 0
|
|
599
|
+
},
|
|
600
|
+
phase === "held" && /* @__PURE__ */ React2.createElement("span", { className: "alt-await-held", "data-early": graceLeft > 0 ? "" : void 0, "aria-hidden": "true" }, imprint),
|
|
601
|
+
phase === "reveal" && shape !== "none" && /* @__PURE__ */ React2.createElement("span", { className: "alt-skeleton alt-await-imprint", "data-shape": shape, "aria-hidden": "true" }),
|
|
602
|
+
/* @__PURE__ */ React2.createElement("span", { className: "alt-await-face" }, children)
|
|
603
|
+
);
|
|
604
|
+
}
|
|
605
|
+
var LINE_WIDTHS = ["100%", "94%", "82%", "97%", "64%"];
|
|
606
|
+
function TextImprint({ lines = 1, width, className }) {
|
|
607
|
+
return /* @__PURE__ */ React2.createElement("span", { className: cx("alt-await-lines", className), style: { ["--lines"]: lines, width } }, Array.from({ length: lines }, (_, i) => /* @__PURE__ */ React2.createElement(
|
|
608
|
+
"span",
|
|
609
|
+
{
|
|
610
|
+
key: i,
|
|
611
|
+
className: "alt-skeleton",
|
|
612
|
+
"data-shape": "text",
|
|
613
|
+
style: { width: lines === 1 ? "100%" : i === lines - 1 ? "60%" : LINE_WIDTHS[i % LINE_WIDTHS.length], ["--i"]: i }
|
|
614
|
+
}
|
|
615
|
+
)));
|
|
616
|
+
}
|
|
617
|
+
var hint = (s) => typeof s === "object" ? s : {};
|
|
618
|
+
|
|
619
|
+
// project/components/src/controls.tsx
|
|
620
|
+
var Button = React3.forwardRef(function Button2({ variant = "secondary", size = "md", square, loading, leading, trailing, className, children, disabled, type = "button", ...rest }, ref) {
|
|
621
|
+
return /* @__PURE__ */ React3.createElement(
|
|
441
622
|
"button",
|
|
442
623
|
{
|
|
443
624
|
ref,
|
|
@@ -452,14 +633,15 @@ var Button = React2.forwardRef(function Button2({ variant = "secondary", size =
|
|
|
452
633
|
...rest,
|
|
453
634
|
onClick: loading ? (e) => e.preventDefault() : rest.onClick
|
|
454
635
|
},
|
|
455
|
-
/* @__PURE__ */
|
|
456
|
-
loading && /* @__PURE__ */
|
|
636
|
+
/* @__PURE__ */ React3.createElement("span", { className: "alt-btn-label" }, leading, children, trailing),
|
|
637
|
+
loading && /* @__PURE__ */ React3.createElement("span", { className: "alt-btn-spinner" }, /* @__PURE__ */ React3.createElement(Spinner, { size: size === "sm" ? 14 : 16 }))
|
|
457
638
|
);
|
|
458
639
|
});
|
|
459
|
-
var Card =
|
|
640
|
+
var Card = React3.forwardRef(function Card2({ interactive, className, onKeyDown, settle, status, heldBy, relevance, style, skeleton, children, ...rest }, ref) {
|
|
460
641
|
const actionable = interactive && !!rest.onClick;
|
|
461
642
|
const { style: depthStyle, ...depth } = useDepth({ settle, status, heldBy, relevance });
|
|
462
|
-
|
|
643
|
+
const { lines = 3 } = hint(skeleton);
|
|
644
|
+
return /* @__PURE__ */ React3.createElement(
|
|
463
645
|
"div",
|
|
464
646
|
{
|
|
465
647
|
ref,
|
|
@@ -476,29 +658,51 @@ var Card = React2.forwardRef(function Card2({ interactive, className, onKeyDown,
|
|
|
476
658
|
...depth,
|
|
477
659
|
style: { ...depthStyle, ...style },
|
|
478
660
|
...rest
|
|
479
|
-
}
|
|
661
|
+
},
|
|
662
|
+
/* @__PURE__ */ React3.createElement(LoadingScope, null, /* @__PURE__ */ React3.createElement(Await, { shape: "none", enabled: skeleton !== false, imprint: /* @__PURE__ */ React3.createElement("span", { className: "alt-await-card" }, /* @__PURE__ */ React3.createElement(TextImprint, { className: "alt-card-title", width: "45%" }), /* @__PURE__ */ React3.createElement(TextImprint, { className: "alt-await-card-body", lines })) }, children))
|
|
480
663
|
);
|
|
481
664
|
});
|
|
482
|
-
var CardHeader = ({ className, ...p }) => /* @__PURE__ */
|
|
483
|
-
var
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
665
|
+
var CardHeader = ({ className, ...p }) => /* @__PURE__ */ React3.createElement("div", { className: cx("alt-card-header", className), ...p });
|
|
666
|
+
var Promised$ = ({ children }) => /* @__PURE__ */ React3.createElement(React3.Fragment, null, readChildren(children));
|
|
667
|
+
function usePendingText(children, skeleton, required) {
|
|
668
|
+
const scopeWaiting = useScopeWaiting();
|
|
669
|
+
const missing = skeleton !== false && children === void 0 && (required || scopeWaiting);
|
|
670
|
+
useReportWaiting(required && skeleton !== false && (children === void 0 || hasPromise(children)));
|
|
671
|
+
const arrival = useArrival(missing);
|
|
672
|
+
const waited = useHasWaited(missing || hasPromise(children));
|
|
673
|
+
return { arrival, waited };
|
|
674
|
+
}
|
|
675
|
+
function PendingText({ children, skeleton, lines, width, required }) {
|
|
676
|
+
const { arrival, waited } = usePendingText(children, skeleton, required);
|
|
677
|
+
if (!waited) return /* @__PURE__ */ React3.createElement(React3.Fragment, null, children);
|
|
678
|
+
const h = hint(skeleton);
|
|
679
|
+
return /* @__PURE__ */ React3.createElement(Await, { shape: "text", enabled: skeleton !== false, imprint: /* @__PURE__ */ React3.createElement(TextImprint, { lines: h.lines ?? lines, width: h.width ?? width }) }, /* @__PURE__ */ React3.createElement(Arrive, { when: arrival }, /* @__PURE__ */ React3.createElement(Promised$, null, children)));
|
|
680
|
+
}
|
|
681
|
+
var CardTitle = ({ className, children, skeleton, ...p }) => /* @__PURE__ */ React3.createElement("h3", { className: cx("alt-card-title", className), ...p }, /* @__PURE__ */ React3.createElement(PendingText, { skeleton, lines: 1, width: "55%", required: true }, children));
|
|
682
|
+
var CardDescription = ({ className, children, skeleton, ...p }) => /* @__PURE__ */ React3.createElement("p", { className: cx("alt-card-desc", className), ...p }, /* @__PURE__ */ React3.createElement(PendingText, { skeleton, lines: 2, required: false }, children));
|
|
683
|
+
var CardContent = ({ className, skeleton, children, ...p }) => {
|
|
684
|
+
const { lines = 3 } = hint(skeleton);
|
|
685
|
+
const scopeWaiting = useScopeWaiting();
|
|
686
|
+
const missing = skeleton !== false && children === void 0 && scopeWaiting;
|
|
687
|
+
const arrival = useArrival(missing);
|
|
688
|
+
return /* @__PURE__ */ React3.createElement("div", { className: cx("alt-card-content", className), ...p }, /* @__PURE__ */ React3.createElement(Await, { shape: "none", enabled: skeleton !== false, imprint: /* @__PURE__ */ React3.createElement(TextImprint, { lines }) }, /* @__PURE__ */ React3.createElement(Arrive, { when: arrival }, children)));
|
|
689
|
+
};
|
|
690
|
+
var CardFooter = ({ className, ...p }) => /* @__PURE__ */ React3.createElement("div", { className: cx("alt-card-footer", className), ...p });
|
|
691
|
+
var Input = React3.forwardRef(function Input2({ invalid, leading, trailing, size = "md", className, disabled, placeholder, ...rest }, ref) {
|
|
488
692
|
useApproach();
|
|
489
693
|
useKeyFocus();
|
|
490
|
-
return /* @__PURE__ */
|
|
694
|
+
return /* @__PURE__ */ React3.createElement("div", { className: cx("alt-input", className), "data-size": size, "data-approach": "56", "data-invalid": invalid ? "" : void 0, "data-disabled": disabled ? "" : void 0 }, leading && /* @__PURE__ */ React3.createElement("span", { className: "alt-input-adorn" }, leading), /* @__PURE__ */ React3.createElement("input", { ref, disabled, "aria-invalid": invalid || void 0, placeholder: placeholder ?? " ", ...rest }), trailing && /* @__PURE__ */ React3.createElement("span", { className: "alt-input-adorn" }, trailing));
|
|
491
695
|
});
|
|
492
|
-
var Textarea =
|
|
493
|
-
const [len, setLen] =
|
|
494
|
-
|
|
696
|
+
var Textarea = React3.forwardRef(function Textarea2({ invalid, className, disabled, placeholder, maxLength, showFill = true, onChange, value, defaultValue, ...rest }, ref) {
|
|
697
|
+
const [len, setLen] = React3.useState(() => String(value ?? defaultValue ?? "").length);
|
|
698
|
+
React3.useEffect(() => {
|
|
495
699
|
if (value !== void 0) setLen(String(value).length);
|
|
496
700
|
}, [value]);
|
|
497
701
|
const gauge = showFill && maxLength ? Math.min(1, len / maxLength) : null;
|
|
498
702
|
const level = gauge === null ? void 0 : len >= maxLength ? "full" : gauge >= 0.9 ? "near" : "ok";
|
|
499
703
|
useApproach();
|
|
500
704
|
useKeyFocus();
|
|
501
|
-
return /* @__PURE__ */
|
|
705
|
+
return /* @__PURE__ */ React3.createElement(
|
|
502
706
|
"div",
|
|
503
707
|
{
|
|
504
708
|
className: cx("alt-input", className),
|
|
@@ -509,8 +713,8 @@ var Textarea = React2.forwardRef(function Textarea2({ invalid, className, disabl
|
|
|
509
713
|
"data-fill": level,
|
|
510
714
|
style: gauge !== null ? { ["--alt-fill"]: gauge } : void 0
|
|
511
715
|
},
|
|
512
|
-
gauge !== null && /* @__PURE__ */
|
|
513
|
-
/* @__PURE__ */
|
|
716
|
+
gauge !== null && /* @__PURE__ */ React3.createElement("span", { className: "alt-input-gauge", "aria-hidden": "true" }),
|
|
717
|
+
/* @__PURE__ */ React3.createElement(
|
|
514
718
|
"textarea",
|
|
515
719
|
{
|
|
516
720
|
ref,
|
|
@@ -527,22 +731,22 @@ var Textarea = React2.forwardRef(function Textarea2({ invalid, className, disabl
|
|
|
527
731
|
}
|
|
528
732
|
}
|
|
529
733
|
),
|
|
530
|
-
gauge !== null && /* @__PURE__ */
|
|
734
|
+
gauge !== null && /* @__PURE__ */ React3.createElement("span", { className: "alt-input-count", "aria-live": "polite" }, len, " / ", maxLength)
|
|
531
735
|
);
|
|
532
736
|
});
|
|
533
|
-
function Field({ label, hint, error, required, className, children }) {
|
|
534
|
-
const id =
|
|
737
|
+
function Field({ label, hint: hint2, error, required, className, children }) {
|
|
738
|
+
const id = React3.useId();
|
|
535
739
|
const controlId = children.props.id || id + "-control";
|
|
536
|
-
const describedBy = [
|
|
537
|
-
return /* @__PURE__ */
|
|
740
|
+
const describedBy = [hint2 && id + "-hint", error && id + "-error"].filter(Boolean).join(" ") || void 0;
|
|
741
|
+
return /* @__PURE__ */ React3.createElement("div", { className: cx("alt-field", className) }, /* @__PURE__ */ React3.createElement("label", { className: "alt-field-label", htmlFor: controlId }, label, required && /* @__PURE__ */ React3.createElement("span", { className: "alt-field-req", "aria-hidden": "true" }, " *")), React3.cloneElement(children, { id: controlId, "aria-describedby": describedBy, invalid: !!error || children.props.invalid, required }), hint2 && !error && /* @__PURE__ */ React3.createElement("p", { className: "alt-field-hint", id: id + "-hint" }, hint2), error && /* @__PURE__ */ React3.createElement("p", { className: "alt-field-error", id: id + "-error", role: "alert" }, /* @__PURE__ */ React3.createElement(Icons.AlertCircle, { size: 14 }), error));
|
|
538
742
|
}
|
|
539
|
-
var Checkbox =
|
|
540
|
-
const inner =
|
|
541
|
-
|
|
542
|
-
|
|
743
|
+
var Checkbox = React3.forwardRef(function Checkbox2({ label, description, indeterminate, onCheckedChange, onChange, className, disabled, ...rest }, ref) {
|
|
744
|
+
const inner = React3.useRef(null);
|
|
745
|
+
React3.useImperativeHandle(ref, () => inner.current);
|
|
746
|
+
React3.useEffect(() => {
|
|
543
747
|
if (inner.current) inner.current.indeterminate = !!indeterminate;
|
|
544
748
|
}, [indeterminate]);
|
|
545
|
-
return /* @__PURE__ */
|
|
749
|
+
return /* @__PURE__ */ React3.createElement("label", { className: cx("alt-check", className), "data-disabled": disabled ? "" : void 0 }, /* @__PURE__ */ React3.createElement(
|
|
546
750
|
"input",
|
|
547
751
|
{
|
|
548
752
|
ref: inner,
|
|
@@ -554,20 +758,20 @@ var Checkbox = React2.forwardRef(function Checkbox2({ label, description, indete
|
|
|
554
758
|
onCheckedChange?.(e.target.checked);
|
|
555
759
|
}
|
|
556
760
|
}
|
|
557
|
-
), /* @__PURE__ */
|
|
761
|
+
), /* @__PURE__ */ React3.createElement("span", { className: "alt-check-track", "aria-hidden": "true" }, /* @__PURE__ */ React3.createElement("span", { className: "alt-check-fill" }), /* @__PURE__ */ React3.createElement("svg", { className: "alt-check-mark", viewBox: "0 0 16 16", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2.25", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ React3.createElement("path", { className: "alt-check-tick", d: "M3.5 8.5l3 3 6-6.5", pathLength: 16 }), /* @__PURE__ */ React3.createElement("path", { className: "alt-check-dash", d: "M4 8h8", pathLength: 16 }))), (label || description) && /* @__PURE__ */ React3.createElement("span", { className: "alt-check-text" }, label && /* @__PURE__ */ React3.createElement("span", { className: "alt-check-label" }, label), description && /* @__PURE__ */ React3.createElement("span", { className: "alt-check-desc" }, description)));
|
|
558
762
|
});
|
|
559
|
-
var RadioCtx =
|
|
763
|
+
var RadioCtx = React3.createContext(null);
|
|
560
764
|
function RadioGroup({ value, defaultValue = "", onValueChange, name, disabled, orientation = "vertical", className, children, ...rest }) {
|
|
561
|
-
const auto =
|
|
765
|
+
const auto = React3.useId();
|
|
562
766
|
const [v, set] = useControllable(value, defaultValue, onValueChange);
|
|
563
|
-
const root =
|
|
564
|
-
const slots =
|
|
565
|
-
const [bead, setBead] =
|
|
566
|
-
const register =
|
|
767
|
+
const root = React3.useRef(null);
|
|
768
|
+
const slots = React3.useRef(/* @__PURE__ */ new Map());
|
|
769
|
+
const [bead, setBead] = React3.useState(null);
|
|
770
|
+
const register = React3.useCallback((val, el) => {
|
|
567
771
|
if (el) slots.current.set(val, el);
|
|
568
772
|
else slots.current.delete(val);
|
|
569
773
|
}, []);
|
|
570
|
-
const measure =
|
|
774
|
+
const measure = React3.useCallback(() => {
|
|
571
775
|
const el = slots.current.get(v), r = root.current;
|
|
572
776
|
if (!el || !r) {
|
|
573
777
|
setBead(null);
|
|
@@ -580,13 +784,13 @@ function RadioGroup({ value, defaultValue = "", onValueChange, name, disabled, o
|
|
|
580
784
|
useIsoLayoutEffect(() => {
|
|
581
785
|
measure();
|
|
582
786
|
}, [measure]);
|
|
583
|
-
|
|
787
|
+
React3.useEffect(() => {
|
|
584
788
|
const ro = new ResizeObserver(() => measure());
|
|
585
789
|
if (root.current) ro.observe(root.current);
|
|
586
790
|
document.fonts?.ready.then(() => measure());
|
|
587
791
|
return () => ro.disconnect();
|
|
588
792
|
}, [measure]);
|
|
589
|
-
return /* @__PURE__ */
|
|
793
|
+
return /* @__PURE__ */ React3.createElement(RadioCtx.Provider, { value: { name: name || auto, value: v, set, disabled, register } }, /* @__PURE__ */ React3.createElement("div", { ref: root, role: "radiogroup", className: cx("alt-radio-group", className), "data-orientation": orientation, "data-disabled": disabled ? "" : void 0, ...rest }, children, bead && /* @__PURE__ */ React3.createElement(
|
|
590
794
|
"span",
|
|
591
795
|
{
|
|
592
796
|
className: "alt-radio-thumb",
|
|
@@ -597,9 +801,9 @@ function RadioGroup({ value, defaultValue = "", onValueChange, name, disabled, o
|
|
|
597
801
|
)));
|
|
598
802
|
}
|
|
599
803
|
function Radio({ value, label, description, disabled, className }) {
|
|
600
|
-
const g =
|
|
804
|
+
const g = React3.useContext(RadioCtx);
|
|
601
805
|
const off = disabled || g?.disabled;
|
|
602
|
-
return /* @__PURE__ */
|
|
806
|
+
return /* @__PURE__ */ React3.createElement("label", { className: cx("alt-check alt-radio", className), "data-disabled": off ? "" : void 0 }, /* @__PURE__ */ React3.createElement(
|
|
603
807
|
"input",
|
|
604
808
|
{
|
|
605
809
|
type: "radio",
|
|
@@ -609,11 +813,11 @@ function Radio({ value, label, description, disabled, className }) {
|
|
|
609
813
|
checked: g ? g.value === value : void 0,
|
|
610
814
|
onChange: () => g?.set(value)
|
|
611
815
|
}
|
|
612
|
-
), /* @__PURE__ */
|
|
816
|
+
), /* @__PURE__ */ React3.createElement("span", { className: "alt-check-track", "data-round": "", "aria-hidden": "true", ref: (el) => g?.register(value, el) }, /* @__PURE__ */ React3.createElement("span", { className: "alt-check-fill" })), (label || description) && /* @__PURE__ */ React3.createElement("span", { className: "alt-check-text" }, label && /* @__PURE__ */ React3.createElement("span", { className: "alt-check-label" }, label), description && /* @__PURE__ */ React3.createElement("span", { className: "alt-check-desc" }, description)));
|
|
613
817
|
}
|
|
614
818
|
function Switch({ checked, defaultChecked = false, onCheckedChange, label, className, disabled, ...rest }) {
|
|
615
819
|
const [on, set] = useControllable(checked, defaultChecked, onCheckedChange);
|
|
616
|
-
const control = /* @__PURE__ */
|
|
820
|
+
const control = /* @__PURE__ */ React3.createElement(
|
|
617
821
|
"button",
|
|
618
822
|
{
|
|
619
823
|
type: "button",
|
|
@@ -627,29 +831,29 @@ function Switch({ checked, defaultChecked = false, onCheckedChange, label, class
|
|
|
627
831
|
set(!on);
|
|
628
832
|
}
|
|
629
833
|
},
|
|
630
|
-
/* @__PURE__ */
|
|
631
|
-
/* @__PURE__ */
|
|
834
|
+
/* @__PURE__ */ React3.createElement("span", { className: "alt-switch-fill" }),
|
|
835
|
+
/* @__PURE__ */ React3.createElement("span", { className: "alt-switch-thumb" })
|
|
632
836
|
);
|
|
633
837
|
if (!label) return control;
|
|
634
|
-
return /* @__PURE__ */
|
|
838
|
+
return /* @__PURE__ */ React3.createElement("label", { className: cx("alt-switch-row", className), "data-disabled": disabled ? "" : void 0 }, control, /* @__PURE__ */ React3.createElement("span", null, label));
|
|
635
839
|
}
|
|
636
|
-
var TabsCtx =
|
|
840
|
+
var TabsCtx = React3.createContext(null);
|
|
637
841
|
function Tabs({ value, defaultValue = "", onValueChange, variant = "folder", className, children, ...rest }) {
|
|
638
842
|
const [v, set] = useControllable(value, defaultValue, onValueChange);
|
|
639
|
-
const id =
|
|
640
|
-
const nodes =
|
|
641
|
-
const register =
|
|
843
|
+
const id = React3.useId();
|
|
844
|
+
const nodes = React3.useRef(/* @__PURE__ */ new Map());
|
|
845
|
+
const register = React3.useCallback((val, el) => {
|
|
642
846
|
if (el) nodes.current.set(val, el);
|
|
643
847
|
else nodes.current.delete(val);
|
|
644
848
|
}, []);
|
|
645
|
-
return /* @__PURE__ */
|
|
849
|
+
return /* @__PURE__ */ React3.createElement(TabsCtx.Provider, { value: { value: v, set, id, variant, register, nodes } }, /* @__PURE__ */ React3.createElement("div", { className: cx("alt-tabs", className), "data-variant": variant, ...rest }, children));
|
|
646
850
|
}
|
|
647
851
|
function TabsList({ className, children, ...rest }) {
|
|
648
|
-
const t =
|
|
649
|
-
const listRef =
|
|
852
|
+
const t = React3.useContext(TabsCtx);
|
|
853
|
+
const listRef = React3.useRef(null);
|
|
650
854
|
const pill = t.variant === "segmented";
|
|
651
|
-
const [ind, setInd] =
|
|
652
|
-
const measure =
|
|
855
|
+
const [ind, setInd] = React3.useState({ x: 0, w: 0, ready: false });
|
|
856
|
+
const measure = React3.useCallback(() => {
|
|
653
857
|
if (!pill) return;
|
|
654
858
|
const el = t.nodes.current.get(t.value);
|
|
655
859
|
if (!el) return;
|
|
@@ -658,7 +862,7 @@ function TabsList({ className, children, ...rest }) {
|
|
|
658
862
|
useIsoLayoutEffect(() => {
|
|
659
863
|
measure();
|
|
660
864
|
}, [measure]);
|
|
661
|
-
|
|
865
|
+
React3.useEffect(() => {
|
|
662
866
|
if (!pill) return;
|
|
663
867
|
const ro = new ResizeObserver(measure);
|
|
664
868
|
if (listRef.current) ro.observe(listRef.current);
|
|
@@ -675,7 +879,7 @@ function TabsList({ className, children, ...rest }) {
|
|
|
675
879
|
t.nodes.current.get(next)?.focus();
|
|
676
880
|
}
|
|
677
881
|
};
|
|
678
|
-
return /* @__PURE__ */
|
|
882
|
+
return /* @__PURE__ */ React3.createElement("div", { ref: listRef, role: "tablist", className: cx("alt-tabs-list", className), onKeyDown, ...rest }, pill && /* @__PURE__ */ React3.createElement(
|
|
679
883
|
"span",
|
|
680
884
|
{
|
|
681
885
|
className: "alt-tabs-indicator",
|
|
@@ -686,9 +890,9 @@ function TabsList({ className, children, ...rest }) {
|
|
|
686
890
|
), children);
|
|
687
891
|
}
|
|
688
892
|
function TabsTrigger({ value, className, children, ...rest }) {
|
|
689
|
-
const t =
|
|
893
|
+
const t = React3.useContext(TabsCtx);
|
|
690
894
|
const on = t.value === value;
|
|
691
|
-
return /* @__PURE__ */
|
|
895
|
+
return /* @__PURE__ */ React3.createElement(
|
|
692
896
|
"button",
|
|
693
897
|
{
|
|
694
898
|
ref: (el) => t.register(value, el),
|
|
@@ -706,21 +910,21 @@ function TabsTrigger({ value, className, children, ...rest }) {
|
|
|
706
910
|
);
|
|
707
911
|
}
|
|
708
912
|
function TabsContent({ value, className, ...rest }) {
|
|
709
|
-
const t =
|
|
913
|
+
const t = React3.useContext(TabsCtx);
|
|
710
914
|
if (t.value !== value) return null;
|
|
711
|
-
return /* @__PURE__ */
|
|
915
|
+
return /* @__PURE__ */ React3.createElement("div", { role: "tabpanel", id: `${t.id}-p-${value}`, "aria-labelledby": `${t.id}-t-${value}`, tabIndex: 0, className: cx("alt-tabs-content", className), ...rest });
|
|
712
916
|
}
|
|
713
917
|
function Slider({ value, defaultValue = 50, onValueChange, min = 0, max = 100, step = 1, disabled, format = (v) => v, className, ...rest }) {
|
|
714
918
|
const [v, set] = useControllable(value, defaultValue, onValueChange);
|
|
715
|
-
const [drag, setDrag] =
|
|
716
|
-
const track =
|
|
919
|
+
const [drag, setDrag] = React3.useState(false);
|
|
920
|
+
const track = React3.useRef(null);
|
|
717
921
|
const clamp = (n) => Math.min(max, Math.max(min, Math.round((n - min) / step) * step + min));
|
|
718
922
|
const fromX = (x) => {
|
|
719
923
|
const r = track.current.getBoundingClientRect();
|
|
720
924
|
return clamp(min + (x - r.left) / r.width * (max - min));
|
|
721
925
|
};
|
|
722
926
|
const pct = (v - min) / (max - min) * 100;
|
|
723
|
-
return /* @__PURE__ */
|
|
927
|
+
return /* @__PURE__ */ React3.createElement(
|
|
724
928
|
"div",
|
|
725
929
|
{
|
|
726
930
|
className: cx("alt-slider", className),
|
|
@@ -740,8 +944,8 @@ function Slider({ value, defaultValue = 50, onValueChange, min = 0, max = 100, s
|
|
|
740
944
|
onPointerCancel: () => setDrag(false),
|
|
741
945
|
...rest
|
|
742
946
|
},
|
|
743
|
-
/* @__PURE__ */
|
|
744
|
-
/* @__PURE__ */
|
|
947
|
+
/* @__PURE__ */ React3.createElement("div", { className: "alt-slider-track", ref: track }, /* @__PURE__ */ React3.createElement("div", { className: "alt-slider-fill", style: { width: pct + "%" } })),
|
|
948
|
+
/* @__PURE__ */ React3.createElement(
|
|
745
949
|
"div",
|
|
746
950
|
{
|
|
747
951
|
className: "alt-slider-thumb",
|
|
@@ -762,13 +966,13 @@ function Slider({ value, defaultValue = 50, onValueChange, min = 0, max = 100, s
|
|
|
762
966
|
}
|
|
763
967
|
}
|
|
764
968
|
},
|
|
765
|
-
/* @__PURE__ */
|
|
969
|
+
/* @__PURE__ */ React3.createElement("span", { className: "alt-slider-bubble", "aria-hidden": "true" }, format(v))
|
|
766
970
|
)
|
|
767
971
|
);
|
|
768
972
|
}
|
|
769
973
|
function Progress({ value = null, max = 100, className, ...rest }) {
|
|
770
974
|
const ind = value === null || value === void 0;
|
|
771
|
-
return /* @__PURE__ */
|
|
975
|
+
return /* @__PURE__ */ React3.createElement(
|
|
772
976
|
"div",
|
|
773
977
|
{
|
|
774
978
|
role: "progressbar",
|
|
@@ -779,31 +983,72 @@ function Progress({ value = null, max = 100, className, ...rest }) {
|
|
|
779
983
|
"data-indeterminate": ind ? "" : void 0,
|
|
780
984
|
...rest
|
|
781
985
|
},
|
|
782
|
-
/* @__PURE__ */
|
|
986
|
+
/* @__PURE__ */ React3.createElement("div", { className: "alt-progress-fill", style: ind ? void 0 : { width: `${Math.max(0, Math.min(100, value / max * 100))}%` } })
|
|
987
|
+
);
|
|
988
|
+
}
|
|
989
|
+
function Badge({ children, skeleton, ...props }) {
|
|
990
|
+
const missing = skeleton !== false && children === void 0;
|
|
991
|
+
useReportWaiting(missing || skeleton !== false && hasPromise(children));
|
|
992
|
+
const arrival = useArrival(missing);
|
|
993
|
+
if (!useHasWaited(missing || hasPromise(children))) return /* @__PURE__ */ React3.createElement(BadgeFace, { ...props }, children);
|
|
994
|
+
const h = hint(skeleton);
|
|
995
|
+
return /* @__PURE__ */ React3.createElement(
|
|
996
|
+
Await,
|
|
997
|
+
{
|
|
998
|
+
inline: true,
|
|
999
|
+
shape: "block",
|
|
1000
|
+
enabled: skeleton !== false,
|
|
1001
|
+
imprint: /* @__PURE__ */ React3.createElement("span", { className: "alt-skeleton alt-badge-imprint", "data-variant": props.variant === "count" ? "count" : void 0, style: { width: h.width } })
|
|
1002
|
+
},
|
|
1003
|
+
/* @__PURE__ */ React3.createElement(Arrive, { when: arrival }, /* @__PURE__ */ React3.createElement(BadgeLanded, { ...props }, children))
|
|
783
1004
|
);
|
|
784
1005
|
}
|
|
785
|
-
function
|
|
1006
|
+
function BadgeLanded({ children, ...props }) {
|
|
1007
|
+
return /* @__PURE__ */ React3.createElement(BadgeFace, { ...props }, readChildren(children));
|
|
1008
|
+
}
|
|
1009
|
+
function BadgeFace({ tone = "neutral", variant = "plate", lamp, dot, className, children, ...rest }) {
|
|
786
1010
|
const v = variant === "soft" ? "tinted" : variant;
|
|
787
1011
|
const showLamp = v !== "count" && !!(lamp ?? (dot || tone === "positive" || tone === "caution" || tone === "critical"));
|
|
788
1012
|
const label = typeof children === "string" || typeof children === "number" ? String(children) : void 0;
|
|
789
|
-
const [stamp, setStamp] =
|
|
790
|
-
const [lit, setLit] =
|
|
791
|
-
const prev =
|
|
792
|
-
|
|
1013
|
+
const [stamp, setStamp] = React3.useState(void 0);
|
|
1014
|
+
const [lit, setLit] = React3.useState(0);
|
|
1015
|
+
const prev = React3.useRef({ tone, label });
|
|
1016
|
+
React3.useEffect(() => {
|
|
793
1017
|
const p = prev.current;
|
|
794
1018
|
if (p.label !== label) setStamp((x) => x === "a" ? "b" : "a");
|
|
795
1019
|
if (p.tone !== tone) setLit((n) => n + 1);
|
|
796
1020
|
prev.current = { tone, label };
|
|
797
1021
|
}, [tone, label]);
|
|
798
|
-
return /* @__PURE__ */
|
|
1022
|
+
return /* @__PURE__ */ React3.createElement("span", { className: cx("alt-badge", className), "data-tone": tone, "data-variant": v, "data-stamp": stamp, ...rest }, showLamp && /* @__PURE__ */ React3.createElement("span", { key: lit, className: "alt-badge-lamp", "aria-hidden": "true", "data-lit": lit ? "" : void 0, "data-pulse": lamp === "pulse" ? "" : void 0 }), children);
|
|
799
1023
|
}
|
|
800
1024
|
var TINTS = ["accent", "positive", "caution", "critical"];
|
|
801
|
-
function Avatar({
|
|
1025
|
+
function Avatar({ skeleton, ...props }) {
|
|
1026
|
+
const missing = skeleton !== false && props.name === void 0;
|
|
1027
|
+
const promised = isPromise(props.name) || isPromise(props.src);
|
|
1028
|
+
useReportWaiting(missing || skeleton !== false && isPromise(props.name));
|
|
1029
|
+
const arrival = useArrival(missing);
|
|
1030
|
+
if (!useHasWaited(missing || promised)) return /* @__PURE__ */ React3.createElement(AvatarFace, { ...props, name: props.name ?? "", src: props.src });
|
|
1031
|
+
const size = props.size ?? 36;
|
|
1032
|
+
return /* @__PURE__ */ React3.createElement(
|
|
1033
|
+
Await,
|
|
1034
|
+
{
|
|
1035
|
+
inline: true,
|
|
1036
|
+
shape: "circle",
|
|
1037
|
+
enabled: skeleton !== false,
|
|
1038
|
+
imprint: /* @__PURE__ */ React3.createElement("span", { className: "alt-skeleton alt-avatar-imprint", "data-shape": "circle", style: { width: size, height: size } })
|
|
1039
|
+
},
|
|
1040
|
+
/* @__PURE__ */ React3.createElement(Arrive, { when: arrival }, /* @__PURE__ */ React3.createElement(AvatarLanded, { ...props }))
|
|
1041
|
+
);
|
|
1042
|
+
}
|
|
1043
|
+
function AvatarLanded(props) {
|
|
1044
|
+
return /* @__PURE__ */ React3.createElement(AvatarFace, { ...props, name: readPromised(props.name) ?? "", src: readPromised(props.src) });
|
|
1045
|
+
}
|
|
1046
|
+
function AvatarFace({ name, src, size = 36, status, live, presence, lamp, className, style, onClick, ...rest }) {
|
|
802
1047
|
const initials = name.split(/\s+/).filter(Boolean).slice(0, 2).map((w) => w[0].toUpperCase()).join("");
|
|
803
1048
|
const tint = TINTS[[...name].reduce((a, c) => a + c.charCodeAt(0), 0) % TINTS.length];
|
|
804
1049
|
const label = [name, status, live && "live"].filter(Boolean).join(", ");
|
|
805
1050
|
const showLamp = (lamp ?? size >= 24) && (status === "active" || status === "idle");
|
|
806
|
-
return /* @__PURE__ */
|
|
1051
|
+
return /* @__PURE__ */ React3.createElement(
|
|
807
1052
|
"span",
|
|
808
1053
|
{
|
|
809
1054
|
className: cx("alt-avatar", className),
|
|
@@ -826,29 +1071,29 @@ function Avatar({ name, src, size = 36, status, live, presence, lamp, className,
|
|
|
826
1071
|
style: { ["--size"]: size + "px", ...style },
|
|
827
1072
|
...rest
|
|
828
1073
|
},
|
|
829
|
-
/* @__PURE__ */
|
|
830
|
-
/* @__PURE__ */
|
|
831
|
-
showLamp && /* @__PURE__ */
|
|
1074
|
+
/* @__PURE__ */ React3.createElement("span", { className: "alt-avatar-shadow", "aria-hidden": "true" }),
|
|
1075
|
+
/* @__PURE__ */ React3.createElement("span", { className: "alt-avatar-face" }, src ? /* @__PURE__ */ React3.createElement("img", { src, alt: "" }) : initials),
|
|
1076
|
+
showLamp && /* @__PURE__ */ React3.createElement("span", { className: "alt-avatar-lamp", "aria-hidden": "true" })
|
|
832
1077
|
);
|
|
833
1078
|
}
|
|
834
1079
|
function AvatarGroup({ className, children, max, style, ...rest }) {
|
|
835
|
-
const all =
|
|
1080
|
+
const all = React3.Children.toArray(children);
|
|
836
1081
|
const shown = max ? all.slice(0, max) : all;
|
|
837
1082
|
const extra = all.length - shown.length;
|
|
838
1083
|
const size = shown[0]?.props?.size || 36;
|
|
839
|
-
return /* @__PURE__ */
|
|
1084
|
+
return /* @__PURE__ */ React3.createElement("div", { className: cx("alt-avatar-group", className), style: { ["--size"]: size + "px", ...style }, ...rest }, shown, extra > 0 && /* @__PURE__ */ React3.createElement("span", { className: "alt-avatar", "data-tint": "more", role: "img", "aria-label": `${extra} more`, style: { ["--size"]: size + "px" } }, /* @__PURE__ */ React3.createElement("span", { className: "alt-avatar-shadow", "aria-hidden": "true" }), /* @__PURE__ */ React3.createElement("span", { className: "alt-avatar-face" }, "+", extra)));
|
|
840
1085
|
}
|
|
841
|
-
var
|
|
1086
|
+
var LINE_WIDTHS2 = ["100%", "94%", "82%", "97%", "64%"];
|
|
842
1087
|
function Skeleton({ loaded, shape = "block", lines = 3, width, height, radius, className, style, children, ...rest }) {
|
|
843
|
-
const [reveal, setReveal] =
|
|
844
|
-
const was =
|
|
845
|
-
|
|
1088
|
+
const [reveal, setReveal] = React3.useState(null);
|
|
1089
|
+
const was = React3.useRef(loaded);
|
|
1090
|
+
React3.useEffect(() => {
|
|
846
1091
|
if (loaded && !was.current) setReveal(riseDelay());
|
|
847
1092
|
if (!loaded) setReveal(null);
|
|
848
1093
|
was.current = loaded;
|
|
849
1094
|
}, [loaded]);
|
|
850
1095
|
if (loaded) {
|
|
851
|
-
return /* @__PURE__ */
|
|
1096
|
+
return /* @__PURE__ */ React3.createElement(
|
|
852
1097
|
"div",
|
|
853
1098
|
{
|
|
854
1099
|
className: cx("alt-reveal", className),
|
|
@@ -856,14 +1101,14 @@ function Skeleton({ loaded, shape = "block", lines = 3, width, height, radius, c
|
|
|
856
1101
|
style: { ...reveal ? { ["--alt-rise-delay"]: reveal + "ms" } : null, ...style },
|
|
857
1102
|
...rest
|
|
858
1103
|
},
|
|
859
|
-
/* @__PURE__ */
|
|
1104
|
+
/* @__PURE__ */ React3.createElement("div", { className: "alt-reveal-inner" }, children)
|
|
860
1105
|
);
|
|
861
1106
|
}
|
|
862
1107
|
if (shape === "text") {
|
|
863
|
-
return /* @__PURE__ */
|
|
1108
|
+
return /* @__PURE__ */ React3.createElement("div", { className: cx("alt-skeleton-lines", className), "aria-hidden": "true", style: { width, ...style }, ...rest }, Array.from({ length: lines }, (_, i) => /* @__PURE__ */ React3.createElement("div", { key: i, className: "alt-skeleton", "data-shape": "text", style: { width: i === lines - 1 && lines > 1 ? "60%" : LINE_WIDTHS2[i % LINE_WIDTHS2.length], height: height ?? 12, ["--i"]: i } })));
|
|
864
1109
|
}
|
|
865
1110
|
const d = shape === "circle" ? width ?? height ?? 40 : void 0;
|
|
866
|
-
return /* @__PURE__ */
|
|
1111
|
+
return /* @__PURE__ */ React3.createElement(
|
|
867
1112
|
"div",
|
|
868
1113
|
{
|
|
869
1114
|
className: cx("alt-skeleton", className),
|
|
@@ -877,13 +1122,13 @@ function Skeleton({ loaded, shape = "block", lines = 3, width, height, radius, c
|
|
|
877
1122
|
var toneIcon = { neutral: Icons.Info, accent: Icons.Info, positive: Icons.CircleCheck, caution: Icons.AlertTriangle, critical: Icons.AlertCircle };
|
|
878
1123
|
function Alert({ tone = "neutral", variant = "flat", title, action, icon: icon2, onDismiss, settle, className, style, children, ...rest }) {
|
|
879
1124
|
const I = toneIcon[tone];
|
|
880
|
-
const [closing, setClosing] =
|
|
1125
|
+
const [closing, setClosing] = React3.useState(false);
|
|
881
1126
|
const { style: depthStyle, ...depth } = useDepth({ settle });
|
|
882
1127
|
const dismiss = () => {
|
|
883
1128
|
setClosing(true);
|
|
884
1129
|
window.setTimeout(() => onDismiss?.(), 400);
|
|
885
1130
|
};
|
|
886
|
-
return /* @__PURE__ */
|
|
1131
|
+
return /* @__PURE__ */ React3.createElement(
|
|
887
1132
|
"div",
|
|
888
1133
|
{
|
|
889
1134
|
role: tone === "critical" ? "alert" : "status",
|
|
@@ -895,16 +1140,16 @@ function Alert({ tone = "neutral", variant = "flat", title, action, icon: icon2,
|
|
|
895
1140
|
style: { ...depthStyle, ...style },
|
|
896
1141
|
...rest
|
|
897
1142
|
},
|
|
898
|
-
/* @__PURE__ */
|
|
1143
|
+
/* @__PURE__ */ React3.createElement("div", { className: "alt-alert-inner" }, /* @__PURE__ */ React3.createElement("span", { className: "alt-alert-icon", "aria-hidden": "true" }, icon2 ?? /* @__PURE__ */ React3.createElement(I, { size: 18 })), /* @__PURE__ */ React3.createElement("div", { className: "alt-alert-body" }, title && /* @__PURE__ */ React3.createElement("p", { className: "alt-alert-title" }, title), children && /* @__PURE__ */ React3.createElement("div", { className: "alt-alert-text" }, children)), action && /* @__PURE__ */ React3.createElement("div", { className: "alt-alert-action" }, action), onDismiss && /* @__PURE__ */ React3.createElement("button", { type: "button", className: "alt-alert-close", "aria-label": "Dismiss", onClick: dismiss }, /* @__PURE__ */ React3.createElement(Icons.X, { size: 14 })))
|
|
899
1144
|
);
|
|
900
1145
|
}
|
|
901
1146
|
function AlertStack({ children, expanded, defaultExpanded = false, onExpandedChange, moreLabel = (n) => `+${n} more`, lessLabel = "Show less", className, ...rest }) {
|
|
902
|
-
const list =
|
|
1147
|
+
const list = React3.Children.toArray(children).filter(React3.isValidElement);
|
|
903
1148
|
const [open, setOpen] = useControllable(expanded, defaultExpanded, onExpandedChange);
|
|
904
1149
|
const topKey = list[0]?.key;
|
|
905
|
-
const prevTop =
|
|
906
|
-
const [risen, setRisen] =
|
|
907
|
-
|
|
1150
|
+
const prevTop = React3.useRef(topKey);
|
|
1151
|
+
const [risen, setRisen] = React3.useState(0);
|
|
1152
|
+
React3.useEffect(() => {
|
|
908
1153
|
if (prevTop.current !== topKey) {
|
|
909
1154
|
prevTop.current = topKey;
|
|
910
1155
|
if (topKey != null) setRisen((r) => r + 1);
|
|
@@ -912,20 +1157,20 @@ function AlertStack({ children, expanded, defaultExpanded = false, onExpandedCha
|
|
|
912
1157
|
}, [topKey]);
|
|
913
1158
|
const hidden = list.length - 1;
|
|
914
1159
|
const all = open || hidden < 1;
|
|
915
|
-
return /* @__PURE__ */
|
|
1160
|
+
return /* @__PURE__ */ React3.createElement("div", { className: cx("alt-alert-stack", className), "data-expanded": all ? "" : void 0, "data-sheets": all ? void 0 : Math.min(hidden, 2), ...rest }, all ? list.map((el, i) => /* @__PURE__ */ React3.createElement("div", { key: el.key, className: "alt-alert-stack-item", style: { ["--i"]: i } }, el)) : /* @__PURE__ */ React3.createElement(React3.Fragment, null, list.slice(1, 3).map((el, i) => /* @__PURE__ */ React3.createElement("span", { key: el.key, className: "alt-alert-sheet", "aria-hidden": "true", "data-tone": el.props.tone ?? "neutral", style: { ["--i"]: i + 1 } })), /* @__PURE__ */ React3.createElement("div", { key: String(topKey) + risen, className: "alt-alert-stack-top", "data-risen": risen ? "" : void 0 }, list[0])), hidden > 0 && /* @__PURE__ */ React3.createElement("button", { type: "button", className: "alt-alert-more", "aria-expanded": all, onClick: () => setOpen(!open) }, all ? lessLabel : moreLabel(hidden)));
|
|
916
1161
|
}
|
|
917
1162
|
function Accordion({ items, type = "single", defaultValue = [], className, ...rest }) {
|
|
918
|
-
const [open, setOpen] =
|
|
919
|
-
const id =
|
|
1163
|
+
const [open, setOpen] = React3.useState(defaultValue);
|
|
1164
|
+
const id = React3.useId();
|
|
920
1165
|
const toggle = (v) => setOpen((o) => o.includes(v) ? o.filter((x) => x !== v) : type === "single" ? [v] : [...o, v]);
|
|
921
|
-
return /* @__PURE__ */
|
|
1166
|
+
return /* @__PURE__ */ React3.createElement("div", { className: cx("alt-acc", className), ...rest }, items.map((it) => {
|
|
922
1167
|
const on = open.includes(it.value);
|
|
923
|
-
return /* @__PURE__ */
|
|
1168
|
+
return /* @__PURE__ */ React3.createElement("div", { key: it.value, className: "alt-acc-item", "data-state": on ? "open" : "closed" }, /* @__PURE__ */ React3.createElement("h3", { className: "alt-acc-heading" }, /* @__PURE__ */ React3.createElement("button", { type: "button", className: "alt-acc-trigger", "aria-expanded": on, "aria-controls": `${id}-${it.value}`, onClick: () => toggle(it.value) }, /* @__PURE__ */ React3.createElement("span", null, it.title), /* @__PURE__ */ React3.createElement(Icons.ChevronDown, { className: "alt-acc-chevron", size: 18 }))), /* @__PURE__ */ React3.createElement("div", { className: "alt-acc-panel", id: `${id}-${it.value}`, role: "region", ...on ? {} : inert }, /* @__PURE__ */ React3.createElement("div", null, /* @__PURE__ */ React3.createElement("div", { className: "alt-acc-content" }, it.content))));
|
|
924
1169
|
}));
|
|
925
1170
|
}
|
|
926
1171
|
function HoldButton({ onConfirm, duration = 1e3, variant = "danger", holdingLabel, doneLabel, repeatable = false, className, children, style, disabled, onClick, ...rest }) {
|
|
927
|
-
const [state, setState] =
|
|
928
|
-
const timer =
|
|
1172
|
+
const [state, setState] = React3.useState("idle");
|
|
1173
|
+
const timer = React3.useRef(void 0);
|
|
929
1174
|
const done = state === "done";
|
|
930
1175
|
const start = () => {
|
|
931
1176
|
if (disabled || state !== "idle") return;
|
|
@@ -942,9 +1187,9 @@ function HoldButton({ onConfirm, duration = 1e3, variant = "danger", holdingLabe
|
|
|
942
1187
|
window.clearTimeout(timer.current);
|
|
943
1188
|
setState("idle");
|
|
944
1189
|
};
|
|
945
|
-
|
|
1190
|
+
React3.useEffect(() => () => window.clearTimeout(timer.current), []);
|
|
946
1191
|
const label = done ? doneLabel ?? children : state === "holding" ? holdingLabel ?? children : children;
|
|
947
|
-
return /* @__PURE__ */
|
|
1192
|
+
return /* @__PURE__ */ React3.createElement(
|
|
948
1193
|
Button,
|
|
949
1194
|
{
|
|
950
1195
|
...rest,
|
|
@@ -979,16 +1224,16 @@ function HoldButton({ onConfirm, duration = 1e3, variant = "danger", holdingLabe
|
|
|
979
1224
|
},
|
|
980
1225
|
onContextMenu: (e) => e.preventDefault()
|
|
981
1226
|
},
|
|
982
|
-
/* @__PURE__ */
|
|
983
|
-
/* @__PURE__ */
|
|
984
|
-
/* @__PURE__ */
|
|
1227
|
+
/* @__PURE__ */ React3.createElement("span", { className: "alt-hold-fill", "aria-hidden": "true" }),
|
|
1228
|
+
/* @__PURE__ */ React3.createElement("span", { className: "alt-hold-text" }, label),
|
|
1229
|
+
/* @__PURE__ */ React3.createElement("span", { className: "alt-sr", "aria-live": "polite" }, state === "holding" ? "Keep holding to confirm" : done ? "Confirmed" : "")
|
|
985
1230
|
);
|
|
986
1231
|
}
|
|
987
1232
|
function ScrollArea({ header, maxHeight = 280, className, children, ...rest }) {
|
|
988
|
-
const body =
|
|
989
|
-
const inner =
|
|
990
|
-
const [edges, setEdges] =
|
|
991
|
-
const update =
|
|
1233
|
+
const body = React3.useRef(null);
|
|
1234
|
+
const inner = React3.useRef(null);
|
|
1235
|
+
const [edges, setEdges] = React3.useState({ top: false, bottom: false });
|
|
1236
|
+
const update = React3.useCallback(() => {
|
|
992
1237
|
const el = body.current;
|
|
993
1238
|
if (!el) return;
|
|
994
1239
|
const top = el.scrollTop > 1, bottom = el.scrollTop + el.clientHeight < el.scrollHeight - 1;
|
|
@@ -1001,15 +1246,15 @@ function ScrollArea({ header, maxHeight = 280, className, children, ...rest }) {
|
|
|
1001
1246
|
if (inner.current) ro.observe(inner.current);
|
|
1002
1247
|
return () => ro.disconnect();
|
|
1003
1248
|
}, [update]);
|
|
1004
|
-
return /* @__PURE__ */
|
|
1249
|
+
return /* @__PURE__ */ React3.createElement("div", { className: cx("alt-scroll", className), "data-top": edges.top ? "" : void 0, "data-bottom": edges.bottom ? "" : void 0, ...rest }, header && /* @__PURE__ */ React3.createElement("div", { className: "alt-scroll-header" }, header), /* @__PURE__ */ React3.createElement("div", { className: "alt-scroll-body", ref: body, onScroll: update, style: { maxHeight }, tabIndex: 0, "aria-label": rest["aria-label"] }, /* @__PURE__ */ React3.createElement("div", { ref: inner }, children)), /* @__PURE__ */ React3.createElement("span", { className: "alt-scroll-lip", "data-edge": "top", "aria-hidden": "true" }), /* @__PURE__ */ React3.createElement("span", { className: "alt-scroll-lip", "data-edge": "bottom", "aria-hidden": "true" }));
|
|
1005
1250
|
}
|
|
1006
1251
|
function DropZone({ onFiles, accept, multiple = true, state, className, children, ...rest }) {
|
|
1007
|
-
const [armed, setArmed] =
|
|
1008
|
-
const [over, setOver] =
|
|
1009
|
-
const [landed, setLanded] =
|
|
1010
|
-
const input =
|
|
1252
|
+
const [armed, setArmed] = React3.useState(false);
|
|
1253
|
+
const [over, setOver] = React3.useState(false);
|
|
1254
|
+
const [landed, setLanded] = React3.useState(0);
|
|
1255
|
+
const input = React3.useRef(null);
|
|
1011
1256
|
const { style: depthStyle, ...depth } = useDepth({ settle: landed || void 0 });
|
|
1012
|
-
|
|
1257
|
+
React3.useEffect(() => {
|
|
1013
1258
|
let n = 0;
|
|
1014
1259
|
const hasFiles = (e) => Array.from(e.dataTransfer?.types || []).includes("Files");
|
|
1015
1260
|
const enter = (e) => {
|
|
@@ -1047,7 +1292,7 @@ function DropZone({ onFiles, accept, multiple = true, state, className, children
|
|
|
1047
1292
|
setLanded((x) => x + 1);
|
|
1048
1293
|
};
|
|
1049
1294
|
const visual = state ?? (over ? "over" : armed ? "armed" : "idle");
|
|
1050
|
-
return /* @__PURE__ */
|
|
1295
|
+
return /* @__PURE__ */ React3.createElement(
|
|
1051
1296
|
"div",
|
|
1052
1297
|
{
|
|
1053
1298
|
className: cx("alt-drop", className),
|
|
@@ -1076,7 +1321,7 @@ function DropZone({ onFiles, accept, multiple = true, state, className, children
|
|
|
1076
1321
|
},
|
|
1077
1322
|
...rest
|
|
1078
1323
|
},
|
|
1079
|
-
/* @__PURE__ */
|
|
1324
|
+
/* @__PURE__ */ React3.createElement("input", { ref: input, type: "file", hidden: true, accept, multiple, onChange: (e) => take(Array.from(e.target.files || [])) }),
|
|
1080
1325
|
children
|
|
1081
1326
|
);
|
|
1082
1327
|
}
|
|
@@ -1087,12 +1332,12 @@ var move = (arr, from, to) => {
|
|
|
1087
1332
|
return a;
|
|
1088
1333
|
};
|
|
1089
1334
|
function SortableList({ items, getKey, onReorder, renderItem, getLabel = (i) => String(getKey(i)), gap = 8, className, ...rest }) {
|
|
1090
|
-
const nodes =
|
|
1091
|
-
const before =
|
|
1092
|
-
const start =
|
|
1093
|
-
const [drag, setDrag] =
|
|
1094
|
-
const [kb, setKb] =
|
|
1095
|
-
const [msg, setMsg] =
|
|
1335
|
+
const nodes = React3.useRef(/* @__PURE__ */ new Map());
|
|
1336
|
+
const before = React3.useRef(/* @__PURE__ */ new Map());
|
|
1337
|
+
const start = React3.useRef(null);
|
|
1338
|
+
const [drag, setDrag] = React3.useState(null);
|
|
1339
|
+
const [kb, setKb] = React3.useState(null);
|
|
1340
|
+
const [msg, setMsg] = React3.useState("");
|
|
1096
1341
|
const snapshot = () => {
|
|
1097
1342
|
before.current.clear();
|
|
1098
1343
|
nodes.current.forEach((el, k) => before.current.set(k, el.getBoundingClientRect().top));
|
|
@@ -1171,7 +1416,7 @@ function SortableList({ items, getKey, onReorder, renderItem, getLabel = (i) =>
|
|
|
1171
1416
|
const s = start.current;
|
|
1172
1417
|
const h = drag && s ? s.hs[drag.from] + gap : 0;
|
|
1173
1418
|
const slotTop = drag && s ? drag.to <= drag.from ? s.tops[drag.to] : s.tops[drag.to] + s.hs[drag.to] - s.hs[drag.from] : 0;
|
|
1174
|
-
return /* @__PURE__ */
|
|
1419
|
+
return /* @__PURE__ */ React3.createElement("div", { className: cx("alt-sort", className), style: { gap }, role: "list", "aria-label": rest["aria-label"], "data-dragging": drag ? "" : void 0 }, drag && s && /* @__PURE__ */ React3.createElement("div", { className: "alt-sort-slot", "aria-hidden": "true", style: { top: slotTop, height: s.hs[drag.from] } }), items.map((item, i) => {
|
|
1175
1420
|
const key = keys[i];
|
|
1176
1421
|
const held = drag?.key === key || kb === key;
|
|
1177
1422
|
let shift = 0;
|
|
@@ -1180,7 +1425,7 @@ function SortableList({ items, getKey, onReorder, renderItem, getLabel = (i) =>
|
|
|
1180
1425
|
if (drag.to < drag.from && i >= drag.to && i < drag.from) shift = h;
|
|
1181
1426
|
}
|
|
1182
1427
|
const transform = drag?.key === key ? `translateY(${drag.dy}px)` : shift ? `translateY(${shift}px)` : void 0;
|
|
1183
|
-
return /* @__PURE__ */
|
|
1428
|
+
return /* @__PURE__ */ React3.createElement(
|
|
1184
1429
|
"div",
|
|
1185
1430
|
{
|
|
1186
1431
|
key,
|
|
@@ -1202,14 +1447,14 @@ function SortableList({ items, getKey, onReorder, renderItem, getLabel = (i) =>
|
|
|
1202
1447
|
onPointerCancel: onPointerUp,
|
|
1203
1448
|
onKeyDown: (e) => onKeyDown(e, key, i)
|
|
1204
1449
|
},
|
|
1205
|
-
/* @__PURE__ */
|
|
1206
|
-
/* @__PURE__ */
|
|
1450
|
+
/* @__PURE__ */ React3.createElement("span", { className: "alt-sort-grip", "aria-hidden": "true" }, /* @__PURE__ */ React3.createElement("svg", { width: "12", height: "16", viewBox: "0 0 12 16", fill: "currentColor" }, /* @__PURE__ */ React3.createElement("circle", { cx: "3", cy: "3", r: "1.3" }), /* @__PURE__ */ React3.createElement("circle", { cx: "9", cy: "3", r: "1.3" }), /* @__PURE__ */ React3.createElement("circle", { cx: "3", cy: "8", r: "1.3" }), /* @__PURE__ */ React3.createElement("circle", { cx: "9", cy: "8", r: "1.3" }), /* @__PURE__ */ React3.createElement("circle", { cx: "3", cy: "13", r: "1.3" }), /* @__PURE__ */ React3.createElement("circle", { cx: "9", cy: "13", r: "1.3" }))),
|
|
1451
|
+
/* @__PURE__ */ React3.createElement("div", { className: "alt-sort-body" }, renderItem(item, { held }))
|
|
1207
1452
|
);
|
|
1208
|
-
}), /* @__PURE__ */
|
|
1453
|
+
}), /* @__PURE__ */ React3.createElement("span", { className: "alt-sr", "aria-live": "assertive" }, msg));
|
|
1209
1454
|
}
|
|
1210
1455
|
|
|
1211
1456
|
// project/components/src/pile.tsx
|
|
1212
|
-
import * as
|
|
1457
|
+
import * as React4 from "react";
|
|
1213
1458
|
function Pile({
|
|
1214
1459
|
count,
|
|
1215
1460
|
interactive,
|
|
@@ -1231,15 +1476,15 @@ function Pile({
|
|
|
1231
1476
|
const live = interactive || openable;
|
|
1232
1477
|
const [isOpen, setOpen] = useControllable(open, defaultOpen, onOpenChange);
|
|
1233
1478
|
const { mounted, state } = usePresence(openable && isOpen, 260);
|
|
1234
|
-
const root =
|
|
1235
|
-
const top =
|
|
1236
|
-
const id =
|
|
1479
|
+
const root = React4.useRef(null);
|
|
1480
|
+
const top = React4.useRef(null);
|
|
1481
|
+
const id = React4.useId();
|
|
1237
1482
|
const toggle = () => {
|
|
1238
1483
|
if (openable) setOpen(!isOpen);
|
|
1239
1484
|
};
|
|
1240
|
-
const close =
|
|
1485
|
+
const close = React4.useCallback(() => setOpen(false), [setOpen]);
|
|
1241
1486
|
useOutside(root, openable && isOpen, close);
|
|
1242
|
-
return /* @__PURE__ */
|
|
1487
|
+
return /* @__PURE__ */ React4.createElement(
|
|
1243
1488
|
"div",
|
|
1244
1489
|
{
|
|
1245
1490
|
ref: root,
|
|
@@ -1248,8 +1493,8 @@ function Pile({
|
|
|
1248
1493
|
"data-open": openable && isOpen ? "" : void 0,
|
|
1249
1494
|
...rest
|
|
1250
1495
|
},
|
|
1251
|
-
Array.from({ length: sheets }, (_, i) => /* @__PURE__ */
|
|
1252
|
-
/* @__PURE__ */
|
|
1496
|
+
Array.from({ length: sheets }, (_, i) => /* @__PURE__ */ React4.createElement("span", { key: i, className: "alt-pile-sheet", "aria-hidden": "true", style: { ["--i"]: i + 1 } })),
|
|
1497
|
+
/* @__PURE__ */ React4.createElement(
|
|
1253
1498
|
"div",
|
|
1254
1499
|
{
|
|
1255
1500
|
ref: top,
|
|
@@ -1268,8 +1513,8 @@ function Pile({
|
|
|
1268
1513
|
},
|
|
1269
1514
|
children
|
|
1270
1515
|
),
|
|
1271
|
-
n > 1 && /* @__PURE__ */
|
|
1272
|
-
openable && mounted && /* @__PURE__ */
|
|
1516
|
+
n > 1 && /* @__PURE__ */ React4.createElement("span", { className: "alt-pile-count", "aria-label": `${n} items` }, n),
|
|
1517
|
+
openable && mounted && /* @__PURE__ */ React4.createElement(
|
|
1273
1518
|
"div",
|
|
1274
1519
|
{
|
|
1275
1520
|
className: "alt-pile-list",
|
|
@@ -1283,23 +1528,23 @@ function Pile({
|
|
|
1283
1528
|
}
|
|
1284
1529
|
}
|
|
1285
1530
|
},
|
|
1286
|
-
/* @__PURE__ */
|
|
1531
|
+
/* @__PURE__ */ React4.createElement("ul", { className: "alt-pile-list-inner", style: { maxHeight } }, items.map((it, i) => /* @__PURE__ */ React4.createElement("li", { key: getKey ? getKey(it, i) : i }, /* @__PURE__ */ React4.createElement("button", { type: "button", className: "alt-pile-item", style: { ["--i"]: Math.min(i, 10) }, onClick: () => onSelect?.(it, i) }, renderItem(it, { index: i })))))
|
|
1287
1532
|
)
|
|
1288
1533
|
);
|
|
1289
1534
|
}
|
|
1290
1535
|
|
|
1291
1536
|
// project/components/src/overlays.tsx
|
|
1292
|
-
import * as
|
|
1537
|
+
import * as React5 from "react";
|
|
1293
1538
|
var EXIT_3 = 160;
|
|
1294
1539
|
var EXIT_4 = 190;
|
|
1295
1540
|
var EXIT_5 = 220;
|
|
1296
1541
|
var lastTipClose = 0;
|
|
1297
1542
|
var openCard = null;
|
|
1298
1543
|
function Tooltip({ content, side = "top", delay = 450, defaultOpen = false, children }) {
|
|
1299
|
-
const [open, setOpen] =
|
|
1300
|
-
const [warm, setWarm] =
|
|
1301
|
-
const timer =
|
|
1302
|
-
const id =
|
|
1544
|
+
const [open, setOpen] = React5.useState(defaultOpen);
|
|
1545
|
+
const [warm, setWarm] = React5.useState(false);
|
|
1546
|
+
const timer = React5.useRef(void 0);
|
|
1547
|
+
const id = React5.useId();
|
|
1303
1548
|
const { mounted, state } = usePresence(open, EXIT_3);
|
|
1304
1549
|
const show = () => {
|
|
1305
1550
|
const isWarm = Date.now() - lastTipClose < 400;
|
|
@@ -1314,8 +1559,8 @@ function Tooltip({ content, side = "top", delay = 450, defaultOpen = false, chil
|
|
|
1314
1559
|
return false;
|
|
1315
1560
|
});
|
|
1316
1561
|
};
|
|
1317
|
-
|
|
1318
|
-
return /* @__PURE__ */
|
|
1562
|
+
React5.useEffect(() => () => window.clearTimeout(timer.current), []);
|
|
1563
|
+
return /* @__PURE__ */ React5.createElement(
|
|
1319
1564
|
"span",
|
|
1320
1565
|
{
|
|
1321
1566
|
className: "alt-tip-anchor",
|
|
@@ -1331,27 +1576,27 @@ function Tooltip({ content, side = "top", delay = 450, defaultOpen = false, chil
|
|
|
1331
1576
|
if (e.key === "Escape") hide();
|
|
1332
1577
|
}
|
|
1333
1578
|
},
|
|
1334
|
-
|
|
1335
|
-
mounted && /* @__PURE__ */
|
|
1579
|
+
React5.cloneElement(children, { "aria-describedby": open ? id : void 0 }),
|
|
1580
|
+
mounted && /* @__PURE__ */ React5.createElement("span", { role: "tooltip", id, className: "alt-tip", "data-side": side, "data-state": state, "data-warm": warm ? "" : void 0 }, content)
|
|
1336
1581
|
);
|
|
1337
1582
|
}
|
|
1338
1583
|
function Popover({ trigger, children, open, defaultOpen = false, onOpenChange, side = "bottom", align = "start", className, ...rest }) {
|
|
1339
1584
|
const [isOpen, set] = useControllable(open, defaultOpen, onOpenChange);
|
|
1340
|
-
const ref =
|
|
1341
|
-
const panel =
|
|
1342
|
-
const id =
|
|
1585
|
+
const ref = React5.useRef(null);
|
|
1586
|
+
const panel = React5.useRef(null);
|
|
1587
|
+
const id = React5.useId();
|
|
1343
1588
|
const { mounted, state } = usePresence(isOpen, EXIT_3);
|
|
1344
|
-
const close =
|
|
1589
|
+
const close = React5.useCallback(() => set(false), [set]);
|
|
1345
1590
|
useOutside(ref, isOpen, close);
|
|
1346
|
-
|
|
1591
|
+
React5.useEffect(() => {
|
|
1347
1592
|
if (state !== "open" || !panel.current) return;
|
|
1348
1593
|
const f = panel.current.querySelector('input, textarea, select, button, [href], [tabindex]:not([tabindex="-1"])');
|
|
1349
1594
|
(f || panel.current).focus({ preventScroll: true });
|
|
1350
1595
|
}, [state]);
|
|
1351
|
-
return /* @__PURE__ */
|
|
1596
|
+
return /* @__PURE__ */ React5.createElement("span", { className: "alt-pop-anchor", ref }, React5.cloneElement(trigger, { "aria-expanded": isOpen, "aria-controls": id, "aria-haspopup": "dialog", onClick: (e) => {
|
|
1352
1597
|
trigger.props.onClick?.(e);
|
|
1353
1598
|
set(!isOpen);
|
|
1354
|
-
} }), mounted && /* @__PURE__ */
|
|
1599
|
+
} }), mounted && /* @__PURE__ */ React5.createElement(
|
|
1355
1600
|
"div",
|
|
1356
1601
|
{
|
|
1357
1602
|
ref: panel,
|
|
@@ -1375,15 +1620,15 @@ function Popover({ trigger, children, open, defaultOpen = false, onOpenChange, s
|
|
|
1375
1620
|
));
|
|
1376
1621
|
}
|
|
1377
1622
|
function DropdownMenu({ trigger, items, align = "start", side = "bottom", defaultOpen = false, className }) {
|
|
1378
|
-
const [open, setOpen] =
|
|
1379
|
-
const [active, setActive] =
|
|
1380
|
-
const [hl, setHl] =
|
|
1381
|
-
const anchor =
|
|
1382
|
-
const menu =
|
|
1383
|
-
const refs =
|
|
1384
|
-
const id =
|
|
1623
|
+
const [open, setOpen] = React5.useState(defaultOpen);
|
|
1624
|
+
const [active, setActive] = React5.useState(-1);
|
|
1625
|
+
const [hl, setHl] = React5.useState(null);
|
|
1626
|
+
const anchor = React5.useRef(null);
|
|
1627
|
+
const menu = React5.useRef(null);
|
|
1628
|
+
const refs = React5.useRef([]);
|
|
1629
|
+
const id = React5.useId();
|
|
1385
1630
|
const { mounted, state } = usePresence(open, EXIT_3);
|
|
1386
|
-
const close =
|
|
1631
|
+
const close = React5.useCallback(() => {
|
|
1387
1632
|
setOpen(false);
|
|
1388
1633
|
setActive(-1);
|
|
1389
1634
|
}, []);
|
|
@@ -1393,7 +1638,7 @@ function DropdownMenu({ trigger, items, align = "start", side = "bottom", defaul
|
|
|
1393
1638
|
const el = active >= 0 ? refs.current[active] : null;
|
|
1394
1639
|
setHl(el ? { y: el.offsetTop, h: el.offsetHeight } : null);
|
|
1395
1640
|
}, [active, mounted]);
|
|
1396
|
-
|
|
1641
|
+
React5.useEffect(() => {
|
|
1397
1642
|
if (state === "open") menu.current?.focus({ preventScroll: true });
|
|
1398
1643
|
}, [state]);
|
|
1399
1644
|
const choose = (i) => {
|
|
@@ -1427,7 +1672,7 @@ function DropdownMenu({ trigger, items, align = "start", side = "bottom", defaul
|
|
|
1427
1672
|
};
|
|
1428
1673
|
let n = 0;
|
|
1429
1674
|
const activeTone = active >= 0 ? items[active].tone : void 0;
|
|
1430
|
-
return /* @__PURE__ */
|
|
1675
|
+
return /* @__PURE__ */ React5.createElement("span", { className: "alt-pop-anchor", ref: anchor }, React5.cloneElement(trigger, {
|
|
1431
1676
|
"aria-haspopup": "menu",
|
|
1432
1677
|
"aria-expanded": open,
|
|
1433
1678
|
"aria-controls": id,
|
|
@@ -1442,7 +1687,7 @@ function DropdownMenu({ trigger, items, align = "start", side = "bottom", defaul
|
|
|
1442
1687
|
setActive(enabled[0]);
|
|
1443
1688
|
}
|
|
1444
1689
|
}
|
|
1445
|
-
}), mounted && /* @__PURE__ */
|
|
1690
|
+
}), mounted && /* @__PURE__ */ React5.createElement(
|
|
1446
1691
|
"div",
|
|
1447
1692
|
{
|
|
1448
1693
|
ref: menu,
|
|
@@ -1458,7 +1703,7 @@ function DropdownMenu({ trigger, items, align = "start", side = "bottom", defaul
|
|
|
1458
1703
|
onKeyDown,
|
|
1459
1704
|
onPointerLeave: () => setActive(-1)
|
|
1460
1705
|
},
|
|
1461
|
-
/* @__PURE__ */
|
|
1706
|
+
/* @__PURE__ */ React5.createElement(
|
|
1462
1707
|
"span",
|
|
1463
1708
|
{
|
|
1464
1709
|
className: "alt-menu-hl",
|
|
@@ -1468,10 +1713,10 @@ function DropdownMenu({ trigger, items, align = "start", side = "bottom", defaul
|
|
|
1468
1713
|
}
|
|
1469
1714
|
),
|
|
1470
1715
|
items.map((it, i) => {
|
|
1471
|
-
if (it.type === "separator") return /* @__PURE__ */
|
|
1472
|
-
if (it.type === "label") return /* @__PURE__ */
|
|
1716
|
+
if (it.type === "separator") return /* @__PURE__ */ React5.createElement("div", { key: i, className: "alt-menu-sep", role: "separator" });
|
|
1717
|
+
if (it.type === "label") return /* @__PURE__ */ React5.createElement("div", { key: i, className: "alt-menu-label", style: { ["--i"]: n++ } }, it.label);
|
|
1473
1718
|
const item = it;
|
|
1474
|
-
return /* @__PURE__ */
|
|
1719
|
+
return /* @__PURE__ */ React5.createElement(
|
|
1475
1720
|
"div",
|
|
1476
1721
|
{
|
|
1477
1722
|
key: i,
|
|
@@ -1488,9 +1733,9 @@ function DropdownMenu({ trigger, items, align = "start", side = "bottom", defaul
|
|
|
1488
1733
|
onPointerMove: () => !item.disabled && active !== i && setActive(i),
|
|
1489
1734
|
onClick: () => choose(i)
|
|
1490
1735
|
},
|
|
1491
|
-
item.icon && /* @__PURE__ */
|
|
1492
|
-
/* @__PURE__ */
|
|
1493
|
-
item.shortcut && /* @__PURE__ */
|
|
1736
|
+
item.icon && /* @__PURE__ */ React5.createElement("span", { className: "alt-menu-icon" }, item.icon),
|
|
1737
|
+
/* @__PURE__ */ React5.createElement("span", { className: "alt-menu-text" }, item.label),
|
|
1738
|
+
item.shortcut && /* @__PURE__ */ React5.createElement("span", { className: "alt-menu-shortcut" }, item.shortcut)
|
|
1494
1739
|
);
|
|
1495
1740
|
})
|
|
1496
1741
|
));
|
|
@@ -1498,10 +1743,10 @@ function DropdownMenu({ trigger, items, align = "start", side = "bottom", defaul
|
|
|
1498
1743
|
function HoverCard({ trigger, children, side = "bottom", align = "start", openDelay = 400, closeDelay = 250, open, defaultOpen = false, onOpenChange, className }) {
|
|
1499
1744
|
const [isOpen, set] = useControllable(open, defaultOpen, onOpenChange);
|
|
1500
1745
|
const { mounted, state } = usePresence(isOpen, EXIT_3);
|
|
1501
|
-
const timer =
|
|
1502
|
-
const closeMe =
|
|
1746
|
+
const timer = React5.useRef(void 0);
|
|
1747
|
+
const closeMe = React5.useRef(() => set(false));
|
|
1503
1748
|
closeMe.current = () => set(false);
|
|
1504
|
-
|
|
1749
|
+
React5.useEffect(() => {
|
|
1505
1750
|
if (!isOpen) return;
|
|
1506
1751
|
const mine = () => closeMe.current();
|
|
1507
1752
|
if (openCard && openCard !== mine) {
|
|
@@ -1525,8 +1770,8 @@ function HoverCard({ trigger, children, side = "bottom", align = "start", openDe
|
|
|
1525
1770
|
if (isOpen) lastTipClose = Date.now();
|
|
1526
1771
|
}, delay);
|
|
1527
1772
|
};
|
|
1528
|
-
|
|
1529
|
-
return /* @__PURE__ */
|
|
1773
|
+
React5.useEffect(() => () => window.clearTimeout(timer.current), []);
|
|
1774
|
+
return /* @__PURE__ */ React5.createElement(
|
|
1530
1775
|
"span",
|
|
1531
1776
|
{
|
|
1532
1777
|
className: "alt-pop-anchor alt-hovercard-anchor",
|
|
@@ -1550,7 +1795,7 @@ function HoverCard({ trigger, children, side = "bottom", align = "start", openDe
|
|
|
1550
1795
|
}
|
|
1551
1796
|
},
|
|
1552
1797
|
trigger,
|
|
1553
|
-
mounted && /* @__PURE__ */
|
|
1798
|
+
mounted && /* @__PURE__ */ React5.createElement(
|
|
1554
1799
|
"div",
|
|
1555
1800
|
{
|
|
1556
1801
|
className: cx("alt-pop alt-hovercard", className),
|
|
@@ -1565,6 +1810,7 @@ function HoverCard({ trigger, children, side = "bottom", align = "start", openDe
|
|
|
1565
1810
|
}
|
|
1566
1811
|
var summits = 0;
|
|
1567
1812
|
var summitTaken = () => summits > 0;
|
|
1813
|
+
var MODAL_FOCUS = "[data-autofocus], input, textarea, select";
|
|
1568
1814
|
function useModal({
|
|
1569
1815
|
open,
|
|
1570
1816
|
onDismiss,
|
|
@@ -1574,12 +1820,13 @@ function useModal({
|
|
|
1574
1820
|
dismissible = true,
|
|
1575
1821
|
summit = false,
|
|
1576
1822
|
autoFocus = true,
|
|
1577
|
-
focusSelector =
|
|
1823
|
+
focusSelector = MODAL_FOCUS,
|
|
1824
|
+
restoreFocus = autoFocus
|
|
1578
1825
|
}) {
|
|
1579
1826
|
const ctx = useAltitude();
|
|
1580
|
-
const restore =
|
|
1827
|
+
const restore = React5.useRef(null);
|
|
1581
1828
|
const presence = usePresence(open, exitMs);
|
|
1582
|
-
|
|
1829
|
+
React5.useEffect(() => {
|
|
1583
1830
|
if (!open) return;
|
|
1584
1831
|
restore.current = document.activeElement;
|
|
1585
1832
|
const pop = modal ? ctx?.pushLayer() : void 0;
|
|
@@ -1590,10 +1837,10 @@ function useModal({
|
|
|
1590
1837
|
pop?.();
|
|
1591
1838
|
if (modal) document.body.style.overflow = prev;
|
|
1592
1839
|
if (summit) summits--;
|
|
1593
|
-
if (
|
|
1840
|
+
if (restoreFocus) restore.current?.focus?.({ preventScroll: true });
|
|
1594
1841
|
};
|
|
1595
1842
|
}, [open]);
|
|
1596
|
-
|
|
1843
|
+
React5.useEffect(() => {
|
|
1597
1844
|
if (presence.state !== "open" || !autoFocus) return;
|
|
1598
1845
|
let raf = 0;
|
|
1599
1846
|
const tryFocus = () => {
|
|
@@ -1626,15 +1873,39 @@ function useModal({
|
|
|
1626
1873
|
};
|
|
1627
1874
|
return { ...presence, onKeyDown };
|
|
1628
1875
|
}
|
|
1629
|
-
function Dialog({
|
|
1876
|
+
function Dialog({
|
|
1877
|
+
open,
|
|
1878
|
+
defaultOpen = false,
|
|
1879
|
+
onOpenChange,
|
|
1880
|
+
trigger,
|
|
1881
|
+
title,
|
|
1882
|
+
description,
|
|
1883
|
+
children,
|
|
1884
|
+
footer,
|
|
1885
|
+
size = "md",
|
|
1886
|
+
dismissible = true,
|
|
1887
|
+
initialFocus = "first-field",
|
|
1888
|
+
focusSelector = MODAL_FOCUS,
|
|
1889
|
+
className
|
|
1890
|
+
}) {
|
|
1630
1891
|
const [isOpen, set] = useControllable(open, defaultOpen, onOpenChange);
|
|
1631
|
-
const panel =
|
|
1632
|
-
const id =
|
|
1633
|
-
const { mounted, state, onKeyDown } = useModal({
|
|
1634
|
-
|
|
1892
|
+
const panel = React5.useRef(null);
|
|
1893
|
+
const id = React5.useId();
|
|
1894
|
+
const { mounted, state, onKeyDown } = useModal({
|
|
1895
|
+
open: isOpen,
|
|
1896
|
+
onDismiss: () => set(false),
|
|
1897
|
+
exitMs: EXIT_5,
|
|
1898
|
+
panel,
|
|
1899
|
+
dismissible,
|
|
1900
|
+
summit: true,
|
|
1901
|
+
autoFocus: initialFocus !== false,
|
|
1902
|
+
focusSelector: initialFocus === "title" ? ".alt-dialog-title" : focusSelector,
|
|
1903
|
+
restoreFocus: true
|
|
1904
|
+
});
|
|
1905
|
+
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, trigger && React5.cloneElement(trigger, { "aria-haspopup": "dialog", onClick: (e) => {
|
|
1635
1906
|
trigger.props.onClick?.(e);
|
|
1636
1907
|
set(true);
|
|
1637
|
-
} }), mounted && /* @__PURE__ */
|
|
1908
|
+
} }), mounted && /* @__PURE__ */ React5.createElement(Layer, null, /* @__PURE__ */ React5.createElement("div", { className: "alt-dialog-root", "data-state": state, onKeyDown }, /* @__PURE__ */ React5.createElement("div", { className: "alt-scrim", onClick: () => dismissible && set(false) }), /* @__PURE__ */ React5.createElement(
|
|
1638
1909
|
"div",
|
|
1639
1910
|
{
|
|
1640
1911
|
ref: panel,
|
|
@@ -1646,10 +1917,10 @@ function Dialog({ open, defaultOpen = false, onOpenChange, trigger, title, descr
|
|
|
1646
1917
|
className: cx("alt-dialog", className),
|
|
1647
1918
|
"data-size": size
|
|
1648
1919
|
},
|
|
1649
|
-
/* @__PURE__ */
|
|
1650
|
-
children && /* @__PURE__ */
|
|
1651
|
-
footer && /* @__PURE__ */
|
|
1652
|
-
dismissible && /* @__PURE__ */
|
|
1920
|
+
/* @__PURE__ */ React5.createElement("div", { className: "alt-dialog-head" }, /* @__PURE__ */ React5.createElement("h2", { className: "alt-dialog-title", id: `${id}-t`, tabIndex: initialFocus === "title" ? -1 : void 0 }, title), description && /* @__PURE__ */ React5.createElement("p", { className: "alt-dialog-desc", id: `${id}-d` }, description)),
|
|
1921
|
+
children && /* @__PURE__ */ React5.createElement("div", { className: "alt-dialog-body" }, children),
|
|
1922
|
+
footer && /* @__PURE__ */ React5.createElement("div", { className: "alt-dialog-footer" }, footer),
|
|
1923
|
+
dismissible && /* @__PURE__ */ React5.createElement(Button, { variant: "ghost", size: "sm", square: true, "aria-label": "Close", className: "alt-dialog-close", onClick: () => set(false) }, /* @__PURE__ */ React5.createElement(Icons.X, null))
|
|
1653
1924
|
))));
|
|
1654
1925
|
}
|
|
1655
1926
|
var toasts = [];
|
|
@@ -1679,16 +1950,16 @@ var toastIcon = { neutral: Icons.Info, positive: Icons.CircleCheck, caution: Ico
|
|
|
1679
1950
|
var STACK = 3;
|
|
1680
1951
|
var GAP = 8;
|
|
1681
1952
|
function Toaster({ className }) {
|
|
1682
|
-
const [, force] =
|
|
1683
|
-
const [expanded, setExpanded] =
|
|
1684
|
-
const heights =
|
|
1685
|
-
|
|
1953
|
+
const [, force] = React5.useReducer((n) => n + 1, 0);
|
|
1954
|
+
const [expanded, setExpanded] = React5.useState(false);
|
|
1955
|
+
const heights = React5.useRef(/* @__PURE__ */ new Map());
|
|
1956
|
+
React5.useEffect(() => {
|
|
1686
1957
|
subs.add(force);
|
|
1687
1958
|
return () => {
|
|
1688
1959
|
subs.delete(force);
|
|
1689
1960
|
};
|
|
1690
1961
|
}, []);
|
|
1691
|
-
|
|
1962
|
+
React5.useEffect(() => {
|
|
1692
1963
|
if (expanded) return;
|
|
1693
1964
|
const timers = toasts.filter((t) => !t.leaving && t.duration > 0).map((t) => setTimeout(() => toast.dismiss(t.id), t.duration));
|
|
1694
1965
|
return () => timers.forEach(clearTimeout);
|
|
@@ -1697,7 +1968,7 @@ function Toaster({ className }) {
|
|
|
1697
1968
|
const frontH = live[0] ? heights.current.get(live[0].id) || 64 : 64;
|
|
1698
1969
|
let offset = 0;
|
|
1699
1970
|
const total = live.slice(0, 5).reduce((a, t) => a + (heights.current.get(t.id) || 64) + GAP, 0);
|
|
1700
|
-
return /* @__PURE__ */
|
|
1971
|
+
return /* @__PURE__ */ React5.createElement(Layer, null, /* @__PURE__ */ React5.createElement(
|
|
1701
1972
|
"section",
|
|
1702
1973
|
{
|
|
1703
1974
|
"aria-label": "Notifications",
|
|
@@ -1739,7 +2010,7 @@ function Toaster({ className }) {
|
|
|
1739
2010
|
}
|
|
1740
2011
|
if (!t.leaving && i >= 0) offset += h + GAP;
|
|
1741
2012
|
const I = toastIcon[t.tone || "neutral"];
|
|
1742
|
-
return /* @__PURE__ */
|
|
2013
|
+
return /* @__PURE__ */ React5.createElement(
|
|
1743
2014
|
"div",
|
|
1744
2015
|
{
|
|
1745
2016
|
key: t.id,
|
|
@@ -1757,28 +2028,28 @@ function Toaster({ className }) {
|
|
|
1757
2028
|
},
|
|
1758
2029
|
style: { transform: `translateY(${y}) scale(${s})`, opacity: o, boxShadow: sh, zIndex: 100 - Math.max(i, 0), height: behind ? frontH : void 0, pointerEvents: o ? void 0 : "none" }
|
|
1759
2030
|
},
|
|
1760
|
-
/* @__PURE__ */
|
|
1761
|
-
/* @__PURE__ */
|
|
1762
|
-
t.action && /* @__PURE__ */
|
|
2031
|
+
/* @__PURE__ */ React5.createElement("span", { className: "alt-toast-icon" }, /* @__PURE__ */ React5.createElement(I, { size: 18 })),
|
|
2032
|
+
/* @__PURE__ */ React5.createElement("div", { className: "alt-toast-body" }, /* @__PURE__ */ React5.createElement("p", { className: "alt-toast-title" }, t.title), t.description && /* @__PURE__ */ React5.createElement("p", { className: "alt-toast-desc" }, t.description)),
|
|
2033
|
+
t.action && /* @__PURE__ */ React5.createElement(Button, { size: "sm", variant: "secondary", className: "alt-toast-action", onClick: () => {
|
|
1763
2034
|
t.action.onClick();
|
|
1764
2035
|
toast.dismiss(t.id);
|
|
1765
2036
|
} }, t.action.label),
|
|
1766
|
-
/* @__PURE__ */
|
|
2037
|
+
/* @__PURE__ */ React5.createElement("button", { type: "button", className: "alt-toast-close", "aria-label": "Dismiss", onClick: () => toast.dismiss(t.id) }, /* @__PURE__ */ React5.createElement(Icons.X, { size: 14 }))
|
|
1767
2038
|
);
|
|
1768
2039
|
})
|
|
1769
2040
|
));
|
|
1770
2041
|
}
|
|
1771
2042
|
|
|
1772
2043
|
// project/components/src/nav.tsx
|
|
1773
|
-
import * as
|
|
2044
|
+
import * as React6 from "react";
|
|
1774
2045
|
function Drilldown({ root, className, ...rest }) {
|
|
1775
|
-
const [path, setPath] =
|
|
1776
|
-
const [dir, setDir] =
|
|
1777
|
-
const [out, setOut] =
|
|
1778
|
-
const view =
|
|
2046
|
+
const [path, setPath] = React6.useState([root]);
|
|
2047
|
+
const [dir, setDir] = React6.useState("down");
|
|
2048
|
+
const [out, setOut] = React6.useState(null);
|
|
2049
|
+
const view = React6.useRef(null);
|
|
1779
2050
|
const depth = path.length - 1;
|
|
1780
2051
|
const current = path[depth];
|
|
1781
|
-
|
|
2052
|
+
React6.useEffect(() => {
|
|
1782
2053
|
if (!out) return;
|
|
1783
2054
|
const t = setTimeout(() => setOut(null), 220);
|
|
1784
2055
|
return () => clearTimeout(t);
|
|
@@ -1794,18 +2065,18 @@ function Drilldown({ root, className, ...rest }) {
|
|
|
1794
2065
|
setOut(current);
|
|
1795
2066
|
setPath(path.slice(0, i + 1));
|
|
1796
2067
|
};
|
|
1797
|
-
|
|
2068
|
+
React6.useEffect(() => {
|
|
1798
2069
|
view.current?.focus({ preventScroll: true });
|
|
1799
2070
|
}, [current.id]);
|
|
1800
|
-
const render = (node) => node.children?.length ? /* @__PURE__ */
|
|
2071
|
+
const render = (node) => node.children?.length ? /* @__PURE__ */ React6.createElement("ul", { className: "alt-drill-list" }, node.children.map((c) => /* @__PURE__ */ React6.createElement("li", { key: c.id }, /* @__PURE__ */ React6.createElement("button", { type: "button", className: "alt-drill-row", onClick: () => go(c) }, /* @__PURE__ */ React6.createElement("span", { className: "alt-drill-row-text" }, /* @__PURE__ */ React6.createElement("span", { className: "alt-drill-row-title" }, c.title), c.description && /* @__PURE__ */ React6.createElement("span", { className: "alt-drill-row-desc" }, c.description)), c.children?.length ? /* @__PURE__ */ React6.createElement("span", { className: "alt-drill-count" }, c.children.length) : null, /* @__PURE__ */ React6.createElement(Icons.ChevronDown, { className: "alt-drill-chev", size: 16 }))))) : /* @__PURE__ */ React6.createElement("div", { className: "alt-drill-leaf" }, node.content);
|
|
1801
2072
|
const sheets = Math.min(depth, 3);
|
|
1802
|
-
return /* @__PURE__ */
|
|
2073
|
+
return /* @__PURE__ */ React6.createElement("div", { className: cx("alt-drill", className), "data-dir": dir, ...rest }, /* @__PURE__ */ React6.createElement("nav", { className: "alt-crumbs", "aria-label": "Location" }, /* @__PURE__ */ React6.createElement("ol", null, path.map((n, i) => /* @__PURE__ */ React6.createElement("li", { key: n.id, "data-d": Math.min(i, 3), style: { ["--d"]: i, zIndex: i + 1 }, "data-current": i === depth ? "" : void 0, "data-new": i === depth && dir === "down" && i > 0 ? "" : void 0 }, /* @__PURE__ */ React6.createElement("button", { type: "button", onClick: () => back(i), "aria-current": i === depth ? "location" : void 0 }, n.title))))), /* @__PURE__ */ React6.createElement("div", { className: "alt-pile alt-drill-pile", "data-sheets": sheets }, Array.from({ length: sheets }, (_, i) => /* @__PURE__ */ React6.createElement("span", { key: i, className: "alt-pile-sheet", "aria-hidden": "true", style: { ["--i"]: i + 1 } })), /* @__PURE__ */ React6.createElement("div", { className: "alt-pile-top alt-drill-stage" }, out && /* @__PURE__ */ React6.createElement("div", { key: "out-" + out.id, className: "alt-drill-view", "data-phase": "out", "aria-hidden": "true" }, render(out)), /* @__PURE__ */ React6.createElement("div", { key: current.id, ref: view, tabIndex: -1, className: "alt-drill-view", "data-phase": "in", "aria-label": typeof current.title === "string" ? current.title : void 0 }, render(current)))));
|
|
1803
2074
|
}
|
|
1804
2075
|
|
|
1805
2076
|
// project/components/src/sheet.tsx
|
|
1806
|
-
import * as
|
|
2077
|
+
import * as React7 from "react";
|
|
1807
2078
|
var EXIT_42 = 190;
|
|
1808
|
-
var SheetCtx =
|
|
2079
|
+
var SheetCtx = React7.createContext(null);
|
|
1809
2080
|
function Sheet({
|
|
1810
2081
|
open,
|
|
1811
2082
|
defaultOpen = false,
|
|
@@ -1821,28 +2092,28 @@ function Sheet({
|
|
|
1821
2092
|
...rest
|
|
1822
2093
|
}) {
|
|
1823
2094
|
const [isOpen, set] = useControllable(open, defaultOpen, onOpenChange);
|
|
1824
|
-
const panel =
|
|
1825
|
-
const scroller =
|
|
1826
|
-
const inner =
|
|
1827
|
-
const id =
|
|
1828
|
-
const [titled, setTitled] =
|
|
1829
|
-
const [described, setDescribed] =
|
|
1830
|
-
const [edges, setEdges] =
|
|
1831
|
-
const [drag, setDrag] =
|
|
1832
|
-
const pull =
|
|
1833
|
-
const [panelEl, setPanelEl] =
|
|
1834
|
-
const panelRef =
|
|
2095
|
+
const panel = React7.useRef(null);
|
|
2096
|
+
const scroller = React7.useRef(null);
|
|
2097
|
+
const inner = React7.useRef(null);
|
|
2098
|
+
const id = React7.useId();
|
|
2099
|
+
const [titled, setTitled] = React7.useState(false);
|
|
2100
|
+
const [described, setDescribed] = React7.useState(false);
|
|
2101
|
+
const [edges, setEdges] = React7.useState({ top: false, bottom: false });
|
|
2102
|
+
const [drag, setDrag] = React7.useState(null);
|
|
2103
|
+
const pull = React7.useRef(null);
|
|
2104
|
+
const [panelEl, setPanelEl] = React7.useState(null);
|
|
2105
|
+
const panelRef = React7.useCallback((el) => {
|
|
1835
2106
|
panel.current = el;
|
|
1836
2107
|
setPanelEl(el);
|
|
1837
2108
|
}, []);
|
|
1838
|
-
const underSummit =
|
|
1839
|
-
const close =
|
|
2109
|
+
const underSummit = React7.useMemo(() => isOpen && summitTaken(), [isOpen]);
|
|
2110
|
+
const close = React7.useCallback(() => set(false), [set]);
|
|
1840
2111
|
const { mounted, state, onKeyDown } = useModal({ open: isOpen, onDismiss: close, exitMs: EXIT_42, panel, modal, dismissible, autoFocus: !underSummit });
|
|
1841
2112
|
useApproach(side === "bottom" && dismissible);
|
|
1842
|
-
|
|
2113
|
+
React7.useEffect(() => {
|
|
1843
2114
|
if (isOpen) setDrag(null);
|
|
1844
2115
|
}, [isOpen]);
|
|
1845
|
-
const measure =
|
|
2116
|
+
const measure = React7.useCallback(() => {
|
|
1846
2117
|
const el = scroller.current;
|
|
1847
2118
|
if (!el) return;
|
|
1848
2119
|
const top = el.scrollTop > 1, bottom = el.scrollTop + el.clientHeight < el.scrollHeight - 1;
|
|
@@ -1878,17 +2149,17 @@ function Sheet({
|
|
|
1878
2149
|
close();
|
|
1879
2150
|
} else setDrag(null);
|
|
1880
2151
|
};
|
|
1881
|
-
const ctx =
|
|
2152
|
+
const ctx = React7.useMemo(() => ({ titleId: `${id}-t`, descId: `${id}-d`, setTitled, setDescribed }), [id]);
|
|
1882
2153
|
const dragging = !!drag && !drag.leaving && !!pull.current;
|
|
1883
2154
|
const dragStyle = drag ? drag.leaving ? { transform: `translateY(${drag.dy + 24}px)` } : { transform: `translateY(${drag.dy}px)`, transition: dragging ? "none" : void 0 } : void 0;
|
|
1884
|
-
return /* @__PURE__ */
|
|
2155
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, trigger && React7.cloneElement(trigger, {
|
|
1885
2156
|
"aria-haspopup": "dialog",
|
|
1886
2157
|
"aria-expanded": isOpen,
|
|
1887
2158
|
onClick: (e) => {
|
|
1888
2159
|
trigger.props.onClick?.(e);
|
|
1889
2160
|
set(modal ? true : !isOpen);
|
|
1890
2161
|
}
|
|
1891
|
-
}), mounted && /* @__PURE__ */
|
|
2162
|
+
}), mounted && /* @__PURE__ */ React7.createElement(Layer, null, /* @__PURE__ */ React7.createElement(SheetCtx.Provider, { value: ctx }, /* @__PURE__ */ React7.createElement("div", { className: "alt-sheet-root", "data-state": state, "data-exit": !isOpen ? "" : void 0, "data-modal": modal ? "" : void 0, onKeyDown }, modal && /* @__PURE__ */ React7.createElement("div", { className: "alt-scrim", onClick: () => dismissible && close() }), /* @__PURE__ */ React7.createElement(
|
|
1892
2163
|
"div",
|
|
1893
2164
|
{
|
|
1894
2165
|
ref: panelRef,
|
|
@@ -1906,7 +2177,7 @@ function Sheet({
|
|
|
1906
2177
|
style: { ...style, ...dragStyle },
|
|
1907
2178
|
...rest
|
|
1908
2179
|
},
|
|
1909
|
-
side === "bottom" && dismissible && /* @__PURE__ */
|
|
2180
|
+
side === "bottom" && dismissible && /* @__PURE__ */ React7.createElement(
|
|
1910
2181
|
"span",
|
|
1911
2182
|
{
|
|
1912
2183
|
className: "alt-sheet-pull",
|
|
@@ -1918,35 +2189,35 @@ function Sheet({
|
|
|
1918
2189
|
onPointerCancel: onPullUp
|
|
1919
2190
|
}
|
|
1920
2191
|
),
|
|
1921
|
-
/* @__PURE__ */
|
|
1922
|
-
dismissible && /* @__PURE__ */
|
|
2192
|
+
/* @__PURE__ */ React7.createElement("div", { className: "alt-sheet-scroll", ref: scroller, onScroll: measure }, /* @__PURE__ */ React7.createElement("div", { className: "alt-sheet-inner", ref: inner }, children)),
|
|
2193
|
+
dismissible && /* @__PURE__ */ React7.createElement(Button, { variant: "ghost", size: "sm", square: true, "aria-label": "Close", className: "alt-sheet-close", onClick: close }, /* @__PURE__ */ React7.createElement(Icons.X, null))
|
|
1923
2194
|
)))));
|
|
1924
2195
|
}
|
|
1925
2196
|
function SheetHeader({ className, ...p }) {
|
|
1926
|
-
return /* @__PURE__ */
|
|
2197
|
+
return /* @__PURE__ */ React7.createElement("div", { className: cx("alt-sheet-header", className), ...p });
|
|
1927
2198
|
}
|
|
1928
2199
|
function SheetTitle({ className, ...p }) {
|
|
1929
|
-
const c =
|
|
1930
|
-
|
|
2200
|
+
const c = React7.useContext(SheetCtx);
|
|
2201
|
+
React7.useEffect(() => {
|
|
1931
2202
|
c?.setTitled(true);
|
|
1932
2203
|
return () => c?.setTitled(false);
|
|
1933
2204
|
}, [c]);
|
|
1934
|
-
return /* @__PURE__ */
|
|
2205
|
+
return /* @__PURE__ */ React7.createElement("h2", { id: c?.titleId, className: cx("alt-sheet-title", className), ...p });
|
|
1935
2206
|
}
|
|
1936
2207
|
function SheetDescription({ className, ...p }) {
|
|
1937
|
-
const c =
|
|
1938
|
-
|
|
2208
|
+
const c = React7.useContext(SheetCtx);
|
|
2209
|
+
React7.useEffect(() => {
|
|
1939
2210
|
c?.setDescribed(true);
|
|
1940
2211
|
return () => c?.setDescribed(false);
|
|
1941
2212
|
}, [c]);
|
|
1942
|
-
return /* @__PURE__ */
|
|
2213
|
+
return /* @__PURE__ */ React7.createElement("p", { id: c?.descId, className: cx("alt-sheet-desc", className), ...p });
|
|
1943
2214
|
}
|
|
1944
2215
|
function SheetFooter({ className, ...p }) {
|
|
1945
|
-
return /* @__PURE__ */
|
|
2216
|
+
return /* @__PURE__ */ React7.createElement("div", { className: cx("alt-sheet-footer", className), ...p });
|
|
1946
2217
|
}
|
|
1947
2218
|
|
|
1948
2219
|
// project/components/src/command.tsx
|
|
1949
|
-
import * as
|
|
2220
|
+
import * as React8 from "react";
|
|
1950
2221
|
var EXIT_52 = 220;
|
|
1951
2222
|
function commandScore(text, query) {
|
|
1952
2223
|
const t = text.toLowerCase(), q = query.toLowerCase().trim();
|
|
@@ -1997,18 +2268,18 @@ function matchRanges(label, query) {
|
|
|
1997
2268
|
return out;
|
|
1998
2269
|
}
|
|
1999
2270
|
function Marked({ text, ranges }) {
|
|
2000
|
-
if (!ranges.length) return /* @__PURE__ */
|
|
2271
|
+
if (!ranges.length) return /* @__PURE__ */ React8.createElement(React8.Fragment, null, text);
|
|
2001
2272
|
const parts = [];
|
|
2002
2273
|
let i = 0;
|
|
2003
2274
|
ranges.forEach(([a, b], k) => {
|
|
2004
2275
|
if (a > i) parts.push(text.slice(i, a));
|
|
2005
|
-
parts.push(/* @__PURE__ */
|
|
2276
|
+
parts.push(/* @__PURE__ */ React8.createElement("mark", { key: k, className: "alt-cmd-match" }, text.slice(a, b)));
|
|
2006
2277
|
i = b;
|
|
2007
2278
|
});
|
|
2008
2279
|
if (i < text.length) parts.push(text.slice(i));
|
|
2009
|
-
return /* @__PURE__ */
|
|
2280
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, parts);
|
|
2010
2281
|
}
|
|
2011
|
-
var SearchIcon = () => /* @__PURE__ */
|
|
2282
|
+
var SearchIcon = () => /* @__PURE__ */ React8.createElement("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.75, strokeLinecap: "round", "aria-hidden": "true" }, /* @__PURE__ */ React8.createElement("circle", { cx: "11", cy: "11", r: "7" }), /* @__PURE__ */ React8.createElement("path", { d: "M20 20l-3.5-3.5" }));
|
|
2012
2283
|
var ms = (cs, name, fallback) => parseFloat(cs.getPropertyValue(name)) || fallback;
|
|
2013
2284
|
function CommandPalette({
|
|
2014
2285
|
items,
|
|
@@ -2029,30 +2300,30 @@ function CommandPalette({
|
|
|
2029
2300
|
...rest
|
|
2030
2301
|
}) {
|
|
2031
2302
|
const [isOpen, set] = useControllable(open, defaultOpen, onOpenChange);
|
|
2032
|
-
const [innerQuery, setInnerQuery] =
|
|
2303
|
+
const [innerQuery, setInnerQuery] = React8.useState(defaultQuery);
|
|
2033
2304
|
const query = queryProp ?? innerQuery;
|
|
2034
|
-
const [active, setActive] =
|
|
2035
|
-
const [onset, setOnset] =
|
|
2036
|
-
const [said, setSaid] =
|
|
2037
|
-
const panel =
|
|
2038
|
-
const viewport =
|
|
2039
|
-
const list =
|
|
2040
|
-
const sizer =
|
|
2041
|
-
const rowEls =
|
|
2042
|
-
const prevTops =
|
|
2043
|
-
const byKeyboard =
|
|
2044
|
-
const caretPlaced =
|
|
2045
|
-
const seed =
|
|
2305
|
+
const [active, setActive] = React8.useState(0);
|
|
2306
|
+
const [onset, setOnset] = React8.useState(true);
|
|
2307
|
+
const [said, setSaid] = React8.useState("");
|
|
2308
|
+
const panel = React8.useRef(null);
|
|
2309
|
+
const viewport = React8.useRef(null);
|
|
2310
|
+
const list = React8.useRef(null);
|
|
2311
|
+
const sizer = React8.useRef(null);
|
|
2312
|
+
const rowEls = React8.useRef(/* @__PURE__ */ new Map());
|
|
2313
|
+
const prevTops = React8.useRef(null);
|
|
2314
|
+
const byKeyboard = React8.useRef(false);
|
|
2315
|
+
const caretPlaced = React8.useRef(false);
|
|
2316
|
+
const seed = React8.useRef(defaultQuery);
|
|
2046
2317
|
seed.current = defaultQuery;
|
|
2047
|
-
const [panelEl, setPanelEl] =
|
|
2048
|
-
const panelRef =
|
|
2318
|
+
const [panelEl, setPanelEl] = React8.useState(null);
|
|
2319
|
+
const panelRef = React8.useCallback((el) => {
|
|
2049
2320
|
panel.current = el;
|
|
2050
2321
|
setPanelEl(el);
|
|
2051
2322
|
}, []);
|
|
2052
|
-
const id =
|
|
2053
|
-
const close =
|
|
2323
|
+
const id = React8.useId();
|
|
2324
|
+
const close = React8.useCallback(() => set(false), [set]);
|
|
2054
2325
|
const { mounted, state, onKeyDown } = useModal({ open: isOpen, onDismiss: close, exitMs: EXIT_52, panel, summit: true });
|
|
2055
|
-
|
|
2326
|
+
React8.useEffect(() => {
|
|
2056
2327
|
if (!shortcut) return;
|
|
2057
2328
|
const key = shortcut.toLowerCase();
|
|
2058
2329
|
const on = (e) => {
|
|
@@ -2068,7 +2339,7 @@ function CommandPalette({
|
|
|
2068
2339
|
window.addEventListener("keydown", on);
|
|
2069
2340
|
return () => window.removeEventListener("keydown", on);
|
|
2070
2341
|
}, [shortcut, isOpen, set]);
|
|
2071
|
-
|
|
2342
|
+
React8.useEffect(() => {
|
|
2072
2343
|
if (isOpen) {
|
|
2073
2344
|
setInnerQuery(seed.current);
|
|
2074
2345
|
setActive(0);
|
|
@@ -2076,7 +2347,7 @@ function CommandPalette({
|
|
|
2076
2347
|
caretPlaced.current = false;
|
|
2077
2348
|
}
|
|
2078
2349
|
}, [isOpen]);
|
|
2079
|
-
|
|
2350
|
+
React8.useEffect(() => {
|
|
2080
2351
|
setActive(0);
|
|
2081
2352
|
}, [query]);
|
|
2082
2353
|
const q = query.trim();
|
|
@@ -2142,14 +2413,14 @@ function CommandPalette({
|
|
|
2142
2413
|
ro.disconnect();
|
|
2143
2414
|
};
|
|
2144
2415
|
}, [panelEl]);
|
|
2145
|
-
const [hl, setHl] =
|
|
2416
|
+
const [hl, setHl] = React8.useState(null);
|
|
2146
2417
|
useIsoLayoutEffect(() => {
|
|
2147
2418
|
const el = activeRow ? rowEls.current.get(activeRow.key) : null;
|
|
2148
2419
|
setHl(el ? { y: el.offsetTop, h: el.offsetHeight } : null);
|
|
2149
2420
|
if (el && byKeyboard.current) el.scrollIntoView({ block: "nearest" });
|
|
2150
2421
|
byKeyboard.current = false;
|
|
2151
2422
|
}, [activeRow?.key, rowsKey, panelEl]);
|
|
2152
|
-
|
|
2423
|
+
React8.useEffect(() => {
|
|
2153
2424
|
if (!q) {
|
|
2154
2425
|
setSaid("");
|
|
2155
2426
|
return;
|
|
@@ -2179,7 +2450,7 @@ function CommandPalette({
|
|
|
2179
2450
|
const label = rest["aria-label"] ?? "Command palette";
|
|
2180
2451
|
const activeIndex = activeRow ? flat.indexOf(activeRow) : -1;
|
|
2181
2452
|
let n = 0;
|
|
2182
|
-
return /* @__PURE__ */
|
|
2453
|
+
return /* @__PURE__ */ React8.createElement(Layer, null, /* @__PURE__ */ React8.createElement("div", { className: "alt-cmd-root", "data-state": state, onKeyDown }, /* @__PURE__ */ React8.createElement("div", { className: "alt-scrim", onClick: close }), /* @__PURE__ */ React8.createElement("div", { ref: panelRef, role: "dialog", "aria-modal": "true", "aria-label": label, tabIndex: -1, className: cx("alt-cmd", className), "data-ephemeral": ephemeral ? "" : void 0 }, /* @__PURE__ */ React8.createElement("div", { className: "alt-cmd-head" }, /* @__PURE__ */ React8.createElement(
|
|
2183
2454
|
Input,
|
|
2184
2455
|
{
|
|
2185
2456
|
className: "alt-cmd-field",
|
|
@@ -2193,8 +2464,8 @@ function CommandPalette({
|
|
|
2193
2464
|
"aria-controls": `${id}-list`,
|
|
2194
2465
|
"aria-autocomplete": "list",
|
|
2195
2466
|
"aria-activedescendant": activeIndex >= 0 ? `${id}-o-${activeIndex}` : void 0,
|
|
2196
|
-
leading: /* @__PURE__ */
|
|
2197
|
-
trailing: /* @__PURE__ */
|
|
2467
|
+
leading: /* @__PURE__ */ React8.createElement(SearchIcon, null),
|
|
2468
|
+
trailing: /* @__PURE__ */ React8.createElement("span", { "aria-hidden": "true" }, /* @__PURE__ */ React8.createElement(Kbd, null, "esc")),
|
|
2198
2469
|
onChange: (e) => {
|
|
2199
2470
|
setInnerQuery(e.target.value);
|
|
2200
2471
|
setActive(0);
|
|
@@ -2209,7 +2480,7 @@ function CommandPalette({
|
|
|
2209
2480
|
},
|
|
2210
2481
|
onKeyDown: onInputKeyDown
|
|
2211
2482
|
}
|
|
2212
|
-
)), /* @__PURE__ */
|
|
2483
|
+
)), /* @__PURE__ */ React8.createElement("div", { className: "alt-cmd-viewport", ref: viewport }, /* @__PURE__ */ React8.createElement("div", { ref: sizer }, /* @__PURE__ */ React8.createElement("div", { className: "alt-cmd-list", ref: list, role: "listbox", id: `${id}-list`, "aria-label": "Results" }, /* @__PURE__ */ React8.createElement(
|
|
2213
2484
|
"span",
|
|
2214
2485
|
{
|
|
2215
2486
|
className: "alt-cmd-hl",
|
|
@@ -2220,10 +2491,10 @@ function CommandPalette({
|
|
|
2220
2491
|
), view.map((v) => {
|
|
2221
2492
|
const labelId = `${id}-g-${v.gi}`;
|
|
2222
2493
|
const groupPredicted = !!v.g.predicted || v.rows.every((r) => r.item.predicted);
|
|
2223
|
-
return /* @__PURE__ */
|
|
2494
|
+
return /* @__PURE__ */ React8.createElement("div", { key: v.gk, role: "group", "aria-labelledby": v.g.label ? labelId : void 0, className: "alt-cmd-group" }, v.g.label && /* @__PURE__ */ React8.createElement("div", { id: labelId, role: "presentation", className: "alt-cmd-label", "data-flip": "g:" + v.gk, "data-predicted": groupPredicted ? "" : void 0 }, v.g.label), v.rows.map(() => {
|
|
2224
2495
|
const i = n++, r = flat[i], item = r.item;
|
|
2225
2496
|
const on = r === activeRow;
|
|
2226
|
-
return /* @__PURE__ */
|
|
2497
|
+
return /* @__PURE__ */ React8.createElement(
|
|
2227
2498
|
"div",
|
|
2228
2499
|
{
|
|
2229
2500
|
key: r.key,
|
|
@@ -2244,16 +2515,16 @@ function CommandPalette({
|
|
|
2244
2515
|
},
|
|
2245
2516
|
onClick: () => choose(r)
|
|
2246
2517
|
},
|
|
2247
|
-
item.icon && /* @__PURE__ */
|
|
2248
|
-
/* @__PURE__ */
|
|
2249
|
-
item.shortcut && /* @__PURE__ */
|
|
2518
|
+
item.icon && /* @__PURE__ */ React8.createElement("span", { className: "alt-cmd-icon", "aria-hidden": "true" }, item.icon),
|
|
2519
|
+
/* @__PURE__ */ React8.createElement("span", { className: "alt-cmd-text" }, /* @__PURE__ */ React8.createElement("span", { className: "alt-cmd-title" }, /* @__PURE__ */ React8.createElement(Marked, { text: item.label, ranges: matchRanges(item.label, q) })), item.description && /* @__PURE__ */ React8.createElement("span", { className: "alt-cmd-desc" }, item.description)),
|
|
2520
|
+
item.shortcut && /* @__PURE__ */ React8.createElement("span", { className: "alt-cmd-keys" }, item.shortcut.map((k, j) => /* @__PURE__ */ React8.createElement(Kbd, { key: j }, k)))
|
|
2250
2521
|
);
|
|
2251
2522
|
}));
|
|
2252
|
-
})), q && !flat.length && /* @__PURE__ */
|
|
2523
|
+
})), q && !flat.length && /* @__PURE__ */ React8.createElement("div", { className: "alt-cmd-empty" }, typeof empty === "function" ? empty(q) : empty ?? /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement("b", null, "No results for \u201C", q, "\u201D"), "Try another word, or check the spelling.")))), hints && /* @__PURE__ */ React8.createElement("div", { className: "alt-cmd-foot", "aria-hidden": "true" }, /* @__PURE__ */ React8.createElement("span", null, /* @__PURE__ */ React8.createElement(Kbd, null, "\u2191"), /* @__PURE__ */ React8.createElement(Kbd, null, "\u2193"), "Move"), /* @__PURE__ */ React8.createElement("span", null, /* @__PURE__ */ React8.createElement(Kbd, null, "\u21B5"), "Choose"), /* @__PURE__ */ React8.createElement("span", null, /* @__PURE__ */ React8.createElement(Kbd, null, "esc"), "Close")), /* @__PURE__ */ React8.createElement("span", { className: "alt-sr", "aria-live": "polite" }, said))));
|
|
2253
2524
|
}
|
|
2254
2525
|
|
|
2255
2526
|
// project/components/src/select.tsx
|
|
2256
|
-
import * as
|
|
2527
|
+
import * as React9 from "react";
|
|
2257
2528
|
var EXIT_32 = 160;
|
|
2258
2529
|
function SelectItem(_) {
|
|
2259
2530
|
return null;
|
|
@@ -2262,17 +2533,17 @@ var textOf = (o) => o.textValue ?? (typeof o.label === "string" || typeof o.labe
|
|
|
2262
2533
|
function collect(items, children) {
|
|
2263
2534
|
if (items) return items;
|
|
2264
2535
|
const out = [];
|
|
2265
|
-
|
|
2266
|
-
if (!
|
|
2536
|
+
React9.Children.forEach(children, (c) => {
|
|
2537
|
+
if (!React9.isValidElement(c) || c.type !== SelectItem) return;
|
|
2267
2538
|
const p = c.props;
|
|
2268
2539
|
out.push({ value: p.value, label: p.children, textValue: p.textValue, description: p.description, icon: p.icon, disabled: p.disabled });
|
|
2269
2540
|
});
|
|
2270
2541
|
return out;
|
|
2271
2542
|
}
|
|
2272
|
-
var Tick = () => /* @__PURE__ */
|
|
2273
|
-
var Chevron = () => /* @__PURE__ */
|
|
2543
|
+
var Tick = () => /* @__PURE__ */ React9.createElement("svg", { className: "alt-select-tick", viewBox: "0 0 16 16", width: "15", height: "15", fill: "none", stroke: "currentColor", strokeWidth: "2.25", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true" }, /* @__PURE__ */ React9.createElement("path", { d: "M3.5 8.5l3 3 6-6.5", pathLength: 16 }));
|
|
2544
|
+
var Chevron = () => /* @__PURE__ */ React9.createElement(Icons.ChevronDown, { className: "alt-select-chevron", size: 16 });
|
|
2274
2545
|
function useSide(open, anchor, list) {
|
|
2275
|
-
const [side, setSide] =
|
|
2546
|
+
const [side, setSide] = React9.useState("bottom");
|
|
2276
2547
|
useIsoLayoutEffect(() => {
|
|
2277
2548
|
if (!open || !anchor.current || !list.current) return;
|
|
2278
2549
|
const a = anchor.current.getBoundingClientRect(), need = list.current.offsetHeight + 12;
|
|
@@ -2290,9 +2561,9 @@ function useSide(open, anchor, list) {
|
|
|
2290
2561
|
return side;
|
|
2291
2562
|
}
|
|
2292
2563
|
function useGlow(value) {
|
|
2293
|
-
const [glow, setGlow] =
|
|
2294
|
-
const first =
|
|
2295
|
-
|
|
2564
|
+
const [glow, setGlow] = React9.useState(void 0);
|
|
2565
|
+
const first = React9.useRef(true);
|
|
2566
|
+
React9.useEffect(() => {
|
|
2296
2567
|
if (first.current) {
|
|
2297
2568
|
first.current = false;
|
|
2298
2569
|
return;
|
|
@@ -2302,8 +2573,8 @@ function useGlow(value) {
|
|
|
2302
2573
|
return glow;
|
|
2303
2574
|
}
|
|
2304
2575
|
function useLabelId(controlId, fallback) {
|
|
2305
|
-
const [labelId, setLabelId] =
|
|
2306
|
-
|
|
2576
|
+
const [labelId, setLabelId] = React9.useState(void 0);
|
|
2577
|
+
React9.useEffect(() => {
|
|
2307
2578
|
const label = document.querySelector(`label[for="${CSS.escape(controlId)}"]`);
|
|
2308
2579
|
if (!label) {
|
|
2309
2580
|
setLabelId(void 0);
|
|
@@ -2315,8 +2586,8 @@ function useLabelId(controlId, fallback) {
|
|
|
2315
2586
|
return labelId;
|
|
2316
2587
|
}
|
|
2317
2588
|
function OptionList({ id, options, active, value, state, side, query, empty, listRef, labelledBy, label, focusable, onActive, onChoose, onKeyDown }) {
|
|
2318
|
-
const rows =
|
|
2319
|
-
const [hl, setHl] =
|
|
2589
|
+
const rows = React9.useRef([]);
|
|
2590
|
+
const [hl, setHl] = React9.useState(null);
|
|
2320
2591
|
useIsoLayoutEffect(() => {
|
|
2321
2592
|
const el = active >= 0 ? rows.current[active] : null;
|
|
2322
2593
|
setHl(el ? { y: el.offsetTop, h: el.offsetHeight } : null);
|
|
@@ -2331,9 +2602,9 @@ function OptionList({ id, options, active, value, state, side, query, empty, lis
|
|
|
2331
2602
|
if (!query || typeof o.label !== "string") return o.label;
|
|
2332
2603
|
const i = t.toLowerCase().indexOf(query.toLowerCase());
|
|
2333
2604
|
if (i < 0) return o.label;
|
|
2334
|
-
return /* @__PURE__ */
|
|
2605
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, t.slice(0, i), /* @__PURE__ */ React9.createElement("mark", { className: "alt-cmd-match" }, t.slice(i, i + query.length)), t.slice(i + query.length));
|
|
2335
2606
|
};
|
|
2336
|
-
return /* @__PURE__ */
|
|
2607
|
+
return /* @__PURE__ */ React9.createElement(
|
|
2337
2608
|
"div",
|
|
2338
2609
|
{
|
|
2339
2610
|
ref: listRef,
|
|
@@ -2349,8 +2620,8 @@ function OptionList({ id, options, active, value, state, side, query, empty, lis
|
|
|
2349
2620
|
onKeyDown,
|
|
2350
2621
|
onMouseDown: (e) => e.preventDefault()
|
|
2351
2622
|
},
|
|
2352
|
-
/* @__PURE__ */
|
|
2353
|
-
options.map((o, i) => /* @__PURE__ */
|
|
2623
|
+
/* @__PURE__ */ React9.createElement("span", { className: "alt-menu-hl", "aria-hidden": "true", style: hl ? { transform: `translateY(${hl.y}px)`, height: hl.h, opacity: 1 } : { opacity: 0 } }),
|
|
2624
|
+
options.map((o, i) => /* @__PURE__ */ React9.createElement(
|
|
2354
2625
|
"div",
|
|
2355
2626
|
{
|
|
2356
2627
|
key: o.value,
|
|
@@ -2369,11 +2640,11 @@ function OptionList({ id, options, active, value, state, side, query, empty, lis
|
|
|
2369
2640
|
},
|
|
2370
2641
|
onClick: () => onChoose(i)
|
|
2371
2642
|
},
|
|
2372
|
-
o.icon && /* @__PURE__ */
|
|
2373
|
-
/* @__PURE__ */
|
|
2374
|
-
o.value === value && /* @__PURE__ */
|
|
2643
|
+
o.icon && /* @__PURE__ */ React9.createElement("span", { className: "alt-menu-icon" }, o.icon),
|
|
2644
|
+
/* @__PURE__ */ React9.createElement("span", { className: "alt-menu-text" }, marks(o), o.description && /* @__PURE__ */ React9.createElement("span", { className: "alt-select-desc" }, o.description)),
|
|
2645
|
+
o.value === value && /* @__PURE__ */ React9.createElement(Tick, null)
|
|
2375
2646
|
)),
|
|
2376
|
-
!options.length && /* @__PURE__ */
|
|
2647
|
+
!options.length && /* @__PURE__ */ React9.createElement("div", { className: "alt-select-empty" }, empty)
|
|
2377
2648
|
);
|
|
2378
2649
|
}
|
|
2379
2650
|
function Select({
|
|
@@ -2395,16 +2666,16 @@ function Select({
|
|
|
2395
2666
|
}) {
|
|
2396
2667
|
const options = collect(items, children);
|
|
2397
2668
|
const [v, set] = useControllable(value, defaultValue, onValueChange);
|
|
2398
|
-
const [open, setOpen] =
|
|
2399
|
-
const [active, setActive] =
|
|
2400
|
-
const auto =
|
|
2669
|
+
const [open, setOpen] = React9.useState(defaultOpen);
|
|
2670
|
+
const [active, setActive] = React9.useState(() => defaultOpen ? options.findIndex((o) => o.value === (value ?? defaultValue)) : -1);
|
|
2671
|
+
const auto = React9.useId();
|
|
2401
2672
|
const triggerId = id ?? auto + "-trigger";
|
|
2402
2673
|
const listId = auto + "-list";
|
|
2403
|
-
const root =
|
|
2404
|
-
const field =
|
|
2405
|
-
const trigger =
|
|
2406
|
-
const list =
|
|
2407
|
-
const typed =
|
|
2674
|
+
const root = React9.useRef(null);
|
|
2675
|
+
const field = React9.useRef(null);
|
|
2676
|
+
const trigger = React9.useRef(null);
|
|
2677
|
+
const list = React9.useRef(null);
|
|
2678
|
+
const typed = React9.useRef({ text: "", at: 0 });
|
|
2408
2679
|
const { mounted, state } = usePresence(open, EXIT_32);
|
|
2409
2680
|
const side = useSide(mounted, field, list);
|
|
2410
2681
|
const glow = useGlow(v);
|
|
@@ -2413,12 +2684,12 @@ function Select({
|
|
|
2413
2684
|
useKeyFocus();
|
|
2414
2685
|
const chosen = options.find((o) => o.value === v);
|
|
2415
2686
|
const enabled = options.map((o, i) => o.disabled ? -1 : i).filter((i) => i >= 0);
|
|
2416
|
-
const close =
|
|
2687
|
+
const close = React9.useCallback((refocus = true) => {
|
|
2417
2688
|
setOpen(false);
|
|
2418
2689
|
if (refocus) trigger.current?.focus({ preventScroll: true });
|
|
2419
2690
|
}, []);
|
|
2420
2691
|
useOutside(root, open, () => close(false));
|
|
2421
|
-
|
|
2692
|
+
React9.useEffect(() => {
|
|
2422
2693
|
if (state === "open") list.current?.focus({ preventScroll: true });
|
|
2423
2694
|
}, [state]);
|
|
2424
2695
|
const openAt = (i) => {
|
|
@@ -2490,7 +2761,7 @@ function Select({
|
|
|
2490
2761
|
}
|
|
2491
2762
|
}
|
|
2492
2763
|
};
|
|
2493
|
-
return /* @__PURE__ */
|
|
2764
|
+
return /* @__PURE__ */ React9.createElement("div", { ref: root, className: cx("alt-select", className), "data-open": open ? "" : void 0 }, /* @__PURE__ */ React9.createElement(
|
|
2494
2765
|
"div",
|
|
2495
2766
|
{
|
|
2496
2767
|
ref: field,
|
|
@@ -2501,7 +2772,7 @@ function Select({
|
|
|
2501
2772
|
"data-invalid": invalid ? "" : void 0,
|
|
2502
2773
|
"data-disabled": disabled ? "" : void 0
|
|
2503
2774
|
},
|
|
2504
|
-
/* @__PURE__ */
|
|
2775
|
+
/* @__PURE__ */ React9.createElement(
|
|
2505
2776
|
"button",
|
|
2506
2777
|
{
|
|
2507
2778
|
ref: trigger,
|
|
@@ -2518,10 +2789,10 @@ function Select({
|
|
|
2518
2789
|
onClick: () => open ? close() : openAt(current()),
|
|
2519
2790
|
onKeyDown: onTriggerKey
|
|
2520
2791
|
},
|
|
2521
|
-
/* @__PURE__ */
|
|
2522
|
-
/* @__PURE__ */
|
|
2792
|
+
/* @__PURE__ */ React9.createElement("span", { className: "alt-select-value", "data-placeholder": chosen ? void 0 : "", "data-glow": glow }, chosen ? /* @__PURE__ */ React9.createElement(React9.Fragment, null, chosen.icon && /* @__PURE__ */ React9.createElement("span", { className: "alt-select-icon" }, chosen.icon), chosen.label) : placeholder),
|
|
2793
|
+
/* @__PURE__ */ React9.createElement(Chevron, null)
|
|
2523
2794
|
)
|
|
2524
|
-
), name && /* @__PURE__ */
|
|
2795
|
+
), name && /* @__PURE__ */ React9.createElement("input", { type: "hidden", name, value: v }), mounted && /* @__PURE__ */ React9.createElement(
|
|
2525
2796
|
OptionList,
|
|
2526
2797
|
{
|
|
2527
2798
|
id: listId,
|
|
@@ -2560,24 +2831,24 @@ function Combobox({
|
|
|
2560
2831
|
}) {
|
|
2561
2832
|
const [v, set] = useControllable(value, defaultValue, onValueChange);
|
|
2562
2833
|
const chosen = items.find((o) => o.value === v);
|
|
2563
|
-
const [text, setText] =
|
|
2564
|
-
const [typing, setTyping] =
|
|
2565
|
-
const [open, setOpen] =
|
|
2566
|
-
const [active, setActive] =
|
|
2567
|
-
const auto =
|
|
2834
|
+
const [text, setText] = React9.useState(chosen ? textOf(chosen) : "");
|
|
2835
|
+
const [typing, setTyping] = React9.useState(false);
|
|
2836
|
+
const [open, setOpen] = React9.useState(defaultOpen);
|
|
2837
|
+
const [active, setActive] = React9.useState(() => defaultOpen ? items.findIndex((o) => o.value === (value ?? defaultValue)) : -1);
|
|
2838
|
+
const auto = React9.useId();
|
|
2568
2839
|
const inputId = id ?? auto + "-input";
|
|
2569
2840
|
const listId = auto + "-list";
|
|
2570
|
-
const root =
|
|
2571
|
-
const field =
|
|
2572
|
-
const input =
|
|
2573
|
-
const list =
|
|
2841
|
+
const root = React9.useRef(null);
|
|
2842
|
+
const field = React9.useRef(null);
|
|
2843
|
+
const input = React9.useRef(null);
|
|
2844
|
+
const list = React9.useRef(null);
|
|
2574
2845
|
const { mounted, state } = usePresence(open, EXIT_32);
|
|
2575
2846
|
const side = useSide(mounted, field, list);
|
|
2576
2847
|
const glow = useGlow(v);
|
|
2577
2848
|
const labelId = useLabelId(inputId, auto + "-label");
|
|
2578
2849
|
useApproach();
|
|
2579
2850
|
useKeyFocus();
|
|
2580
|
-
|
|
2851
|
+
React9.useEffect(() => {
|
|
2581
2852
|
if (!typing) setText(chosen ? textOf(chosen) : "");
|
|
2582
2853
|
}, [v]);
|
|
2583
2854
|
const q = typing ? text.trim() : "";
|
|
@@ -2644,7 +2915,7 @@ function Combobox({
|
|
|
2644
2915
|
if (!root.current?.contains(e.relatedTarget)) commit();
|
|
2645
2916
|
};
|
|
2646
2917
|
const filled = !!chosen && !typing;
|
|
2647
|
-
return /* @__PURE__ */
|
|
2918
|
+
return /* @__PURE__ */ React9.createElement("div", { ref: root, className: cx("alt-select alt-combobox", className), "data-open": open ? "" : void 0 }, /* @__PURE__ */ React9.createElement(
|
|
2648
2919
|
"div",
|
|
2649
2920
|
{
|
|
2650
2921
|
ref: field,
|
|
@@ -2655,7 +2926,7 @@ function Combobox({
|
|
|
2655
2926
|
"data-invalid": invalid ? "" : void 0,
|
|
2656
2927
|
"data-disabled": disabled ? "" : void 0
|
|
2657
2928
|
},
|
|
2658
|
-
/* @__PURE__ */
|
|
2929
|
+
/* @__PURE__ */ React9.createElement(
|
|
2659
2930
|
"input",
|
|
2660
2931
|
{
|
|
2661
2932
|
ref: input,
|
|
@@ -2685,7 +2956,7 @@ function Combobox({
|
|
|
2685
2956
|
}
|
|
2686
2957
|
}
|
|
2687
2958
|
),
|
|
2688
|
-
/* @__PURE__ */
|
|
2959
|
+
/* @__PURE__ */ React9.createElement(
|
|
2689
2960
|
"button",
|
|
2690
2961
|
{
|
|
2691
2962
|
type: "button",
|
|
@@ -2706,9 +2977,9 @@ function Combobox({
|
|
|
2706
2977
|
input.current?.focus();
|
|
2707
2978
|
}
|
|
2708
2979
|
},
|
|
2709
|
-
/* @__PURE__ */
|
|
2980
|
+
/* @__PURE__ */ React9.createElement(Chevron, null)
|
|
2710
2981
|
)
|
|
2711
|
-
), name && /* @__PURE__ */
|
|
2982
|
+
), name && /* @__PURE__ */ React9.createElement("input", { type: "hidden", name, value: v }), mounted && /* @__PURE__ */ React9.createElement(
|
|
2712
2983
|
OptionList,
|
|
2713
2984
|
{
|
|
2714
2985
|
id: listId,
|
|
@@ -2730,30 +3001,30 @@ function Combobox({
|
|
|
2730
3001
|
}
|
|
2731
3002
|
|
|
2732
3003
|
// project/components/src/stepper.tsx
|
|
2733
|
-
import * as
|
|
2734
|
-
var Tick2 = () => /* @__PURE__ */
|
|
3004
|
+
import * as React10 from "react";
|
|
3005
|
+
var Tick2 = () => /* @__PURE__ */ React10.createElement("svg", { viewBox: "0 0 16 16", width: "13", height: "13", fill: "none", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true" }, /* @__PURE__ */ React10.createElement("path", { d: "M3.5 8.5l3 3 6-6.5", pathLength: 16 }));
|
|
2735
3006
|
var word = { done: "completed", current: "current", upcoming: "not started" };
|
|
2736
3007
|
function Stepper({ steps, current, onStepChange, orientation = "horizontal", className, ...rest }) {
|
|
2737
|
-
const [seen, setSeen] =
|
|
2738
|
-
const [motion, setMotion] =
|
|
2739
|
-
const [said, setSaid] =
|
|
3008
|
+
const [seen, setSeen] = React10.useState(current);
|
|
3009
|
+
const [motion, setMotion] = React10.useState(null);
|
|
3010
|
+
const [said, setSaid] = React10.useState("");
|
|
2740
3011
|
if (seen !== current) {
|
|
2741
3012
|
setSeen(current);
|
|
2742
3013
|
setMotion({ pressed: seen, risen: current, stamp: current > seen ? seen : -1, delay: (current > seen ? 150 : 60) + riseDelay(), key: (motion?.key ?? 0) + 1 });
|
|
2743
3014
|
}
|
|
2744
|
-
|
|
3015
|
+
React10.useEffect(() => {
|
|
2745
3016
|
if (!motion) return;
|
|
2746
3017
|
const t = steps[current];
|
|
2747
3018
|
setSaid(t ? `Step ${current + 1} of ${steps.length}: ${typeof t.title === "string" ? t.title : ""}` : "All steps complete");
|
|
2748
3019
|
const done = setTimeout(() => setMotion(null), 900);
|
|
2749
3020
|
return () => clearTimeout(done);
|
|
2750
3021
|
}, [motion?.key]);
|
|
2751
|
-
return /* @__PURE__ */
|
|
3022
|
+
return /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement("ol", { className: cx("alt-stepper", className), "data-orientation": orientation, "aria-label": rest["aria-label"] ?? "Progress", ...rest }, steps.map((s, i) => {
|
|
2752
3023
|
const state = i < current ? "done" : i === current ? "current" : "upcoming";
|
|
2753
3024
|
const back = state === "done" && !!onStepChange;
|
|
2754
3025
|
const rising = motion && motion.risen === i;
|
|
2755
3026
|
const stamped = motion && motion.stamp === i;
|
|
2756
|
-
return /* @__PURE__ */
|
|
3027
|
+
return /* @__PURE__ */ React10.createElement("li", { key: s.id ?? i, className: "alt-step-item", "data-state": state, "aria-current": state === "current" ? "step" : void 0 }, /* @__PURE__ */ React10.createElement(
|
|
2757
3028
|
"div",
|
|
2758
3029
|
{
|
|
2759
3030
|
className: "alt-step",
|
|
@@ -2772,14 +3043,14 @@ function Stepper({ steps, current, onStepChange, orientation = "horizontal", cla
|
|
|
2772
3043
|
} : {},
|
|
2773
3044
|
style: rising ? { ["--alt-rise-delay"]: motion.delay + "ms" } : void 0
|
|
2774
3045
|
},
|
|
2775
|
-
/* @__PURE__ */
|
|
2776
|
-
/* @__PURE__ */
|
|
2777
|
-
), i < steps.length - 1 && /* @__PURE__ */
|
|
2778
|
-
})), /* @__PURE__ */
|
|
3046
|
+
/* @__PURE__ */ React10.createElement("span", { className: "alt-step-mark", "data-stamp": stamped ? motion.key % 2 ? "a" : "b" : void 0 }, state === "done" ? /* @__PURE__ */ React10.createElement(Tick2, null) : i + 1),
|
|
3047
|
+
/* @__PURE__ */ React10.createElement("span", { className: "alt-step-text" }, /* @__PURE__ */ React10.createElement("span", { className: "alt-sr" }, "Step ", i + 1, " of ", steps.length, ", ", word[state], ": "), /* @__PURE__ */ React10.createElement("span", { className: "alt-step-title" }, s.title), s.description && /* @__PURE__ */ React10.createElement("span", { className: "alt-step-desc" }, s.description))
|
|
3048
|
+
), i < steps.length - 1 && /* @__PURE__ */ React10.createElement("span", { className: "alt-step-line", "aria-hidden": "true", "data-done": i < current ? "" : void 0 }));
|
|
3049
|
+
})), /* @__PURE__ */ React10.createElement("span", { className: "alt-sr", "aria-live": "polite" }, said));
|
|
2779
3050
|
}
|
|
2780
3051
|
|
|
2781
3052
|
// project/components/src/empty.tsx
|
|
2782
|
-
import * as
|
|
3053
|
+
import * as React11 from "react";
|
|
2783
3054
|
function EmptyState({
|
|
2784
3055
|
icon: icon2,
|
|
2785
3056
|
title,
|
|
@@ -2793,11 +3064,11 @@ function EmptyState({
|
|
|
2793
3064
|
children,
|
|
2794
3065
|
...rest
|
|
2795
3066
|
}) {
|
|
2796
|
-
const id =
|
|
3067
|
+
const id = React11.useId();
|
|
2797
3068
|
const H = `h${headingLevel}`;
|
|
2798
3069
|
const words = typeof announce === "string" ? announce : announce && typeof title === "string" ? title : "";
|
|
2799
|
-
const [said, setSaid] =
|
|
2800
|
-
|
|
3070
|
+
const [said, setSaid] = React11.useState("");
|
|
3071
|
+
React11.useEffect(() => {
|
|
2801
3072
|
if (!words) {
|
|
2802
3073
|
setSaid("");
|
|
2803
3074
|
return;
|
|
@@ -2805,7 +3076,7 @@ function EmptyState({
|
|
|
2805
3076
|
const t = setTimeout(() => setSaid(words), 100);
|
|
2806
3077
|
return () => clearTimeout(t);
|
|
2807
3078
|
}, [words]);
|
|
2808
|
-
return /* @__PURE__ */
|
|
3079
|
+
return /* @__PURE__ */ React11.createElement(
|
|
2809
3080
|
"section",
|
|
2810
3081
|
{
|
|
2811
3082
|
className: cx("alt-empty", className),
|
|
@@ -2814,17 +3085,17 @@ function EmptyState({
|
|
|
2814
3085
|
"aria-describedby": description ? `${id}-d` : void 0,
|
|
2815
3086
|
...rest
|
|
2816
3087
|
},
|
|
2817
|
-
icon2 && /* @__PURE__ */
|
|
2818
|
-
/* @__PURE__ */
|
|
2819
|
-
description && /* @__PURE__ */
|
|
3088
|
+
icon2 && /* @__PURE__ */ React11.createElement("span", { className: "alt-empty-icon", "aria-hidden": "true" }, icon2),
|
|
3089
|
+
/* @__PURE__ */ React11.createElement(H, { id: `${id}-t`, className: "alt-empty-title" }, title),
|
|
3090
|
+
description && /* @__PURE__ */ React11.createElement("p", { id: `${id}-d`, className: "alt-empty-desc" }, description),
|
|
2820
3091
|
children,
|
|
2821
|
-
(action || secondary) && /* @__PURE__ */
|
|
2822
|
-
announce && /* @__PURE__ */
|
|
3092
|
+
(action || secondary) && /* @__PURE__ */ React11.createElement("div", { className: "alt-empty-actions" }, action, secondary),
|
|
3093
|
+
announce && /* @__PURE__ */ React11.createElement("span", { className: "alt-sr", "aria-live": "polite" }, said)
|
|
2823
3094
|
);
|
|
2824
3095
|
}
|
|
2825
3096
|
|
|
2826
3097
|
// project/components/src/collections.tsx
|
|
2827
|
-
import * as
|
|
3098
|
+
import * as React12 from "react";
|
|
2828
3099
|
var dropSnapshots = /* @__PURE__ */ new WeakMap();
|
|
2829
3100
|
var ms2 = (cs, name, fallback) => parseFloat(cs.getPropertyValue(name)) || fallback;
|
|
2830
3101
|
function pagePlace(el) {
|
|
@@ -2846,7 +3117,7 @@ function placeIn(el, host) {
|
|
|
2846
3117
|
return { x: a.x - b.x, y: a.y - b.y };
|
|
2847
3118
|
}
|
|
2848
3119
|
function useCarry(host, selector, attr, durToken = "--dur-travel-3") {
|
|
2849
|
-
const prev =
|
|
3120
|
+
const prev = React12.useRef(null);
|
|
2850
3121
|
useIsoLayoutEffect(() => {
|
|
2851
3122
|
const root = host.current;
|
|
2852
3123
|
if (!root) return;
|
|
@@ -2875,12 +3146,12 @@ var moveItem = (arr, from, to) => {
|
|
|
2875
3146
|
a.splice(to, 0, x);
|
|
2876
3147
|
return a;
|
|
2877
3148
|
};
|
|
2878
|
-
var Table =
|
|
2879
|
-
const wrap =
|
|
2880
|
-
const table =
|
|
2881
|
-
|
|
2882
|
-
const [edges, setEdges] =
|
|
2883
|
-
const measure =
|
|
3149
|
+
var Table = React12.forwardRef(function Table2({ maxHeight, underlay, className, children, ...rest }, ref) {
|
|
3150
|
+
const wrap = React12.useRef(null);
|
|
3151
|
+
const table = React12.useRef(null);
|
|
3152
|
+
React12.useImperativeHandle(ref, () => table.current);
|
|
3153
|
+
const [edges, setEdges] = React12.useState({ top: false, bottom: false });
|
|
3154
|
+
const measure = React12.useCallback(() => {
|
|
2884
3155
|
const el = wrap.current;
|
|
2885
3156
|
if (!el) return;
|
|
2886
3157
|
const top = el.scrollTop > 1, bottom = el.scrollTop + el.clientHeight < el.scrollHeight - 1;
|
|
@@ -2901,7 +3172,7 @@ var Table = React11.forwardRef(function Table2({ maxHeight, underlay, className,
|
|
|
2901
3172
|
}, [measure]);
|
|
2902
3173
|
useCarry(table, "tbody > tr[data-row]", "data-row");
|
|
2903
3174
|
const scrolls = maxHeight !== void 0;
|
|
2904
|
-
return /* @__PURE__ */
|
|
3175
|
+
return /* @__PURE__ */ React12.createElement(
|
|
2905
3176
|
"div",
|
|
2906
3177
|
{
|
|
2907
3178
|
ref: wrap,
|
|
@@ -2913,27 +3184,27 @@ var Table = React11.forwardRef(function Table2({ maxHeight, underlay, className,
|
|
|
2913
3184
|
...scrolls ? { tabIndex: 0, role: "region", "aria-label": rest["aria-label"] } : {}
|
|
2914
3185
|
},
|
|
2915
3186
|
underlay,
|
|
2916
|
-
/* @__PURE__ */
|
|
3187
|
+
/* @__PURE__ */ React12.createElement("table", { ref: table, className: cx("alt-table", className), ...rest }, children)
|
|
2917
3188
|
);
|
|
2918
3189
|
});
|
|
2919
|
-
var TableHeader = ({ className, ...p }) => /* @__PURE__ */
|
|
2920
|
-
var TableBody =
|
|
2921
|
-
return /* @__PURE__ */
|
|
3190
|
+
var TableHeader = ({ className, ...p }) => /* @__PURE__ */ React12.createElement("thead", { className: cx("alt-table-head", className), ...p });
|
|
3191
|
+
var TableBody = React12.forwardRef(function TableBody2({ className, ...p }, ref) {
|
|
3192
|
+
return /* @__PURE__ */ React12.createElement("tbody", { ref, className: cx("alt-table-body", className), ...p });
|
|
2922
3193
|
});
|
|
2923
|
-
var TableFooter = ({ className, ...p }) => /* @__PURE__ */
|
|
2924
|
-
var TableCaption = ({ className, ...p }) => /* @__PURE__ */
|
|
2925
|
-
var TableRow =
|
|
2926
|
-
const [glow, setGlow] =
|
|
2927
|
-
const [delay, setDelay] =
|
|
2928
|
-
const first =
|
|
2929
|
-
|
|
3194
|
+
var TableFooter = ({ className, ...p }) => /* @__PURE__ */ React12.createElement("tfoot", { className: cx("alt-table-foot", className), ...p });
|
|
3195
|
+
var TableCaption = ({ className, ...p }) => /* @__PURE__ */ React12.createElement("caption", { className: cx("alt-table-caption", className), ...p });
|
|
3196
|
+
var TableRow = React12.forwardRef(function TableRow2({ rowId, selected, interactive, relevance, settle, held, className, style, ...rest }, ref) {
|
|
3197
|
+
const [glow, setGlow] = React12.useState(void 0);
|
|
3198
|
+
const [delay, setDelay] = React12.useState(0);
|
|
3199
|
+
const first = React12.useRef(true);
|
|
3200
|
+
React12.useEffect(() => {
|
|
2930
3201
|
const wasFirst = first.current;
|
|
2931
3202
|
first.current = false;
|
|
2932
3203
|
if (settle === void 0 || settle === null || settle === false || wasFirst && settle !== true) return;
|
|
2933
3204
|
setDelay(riseDelay());
|
|
2934
3205
|
setGlow((g) => g === "a" ? "b" : "a");
|
|
2935
3206
|
}, [settle]);
|
|
2936
|
-
return /* @__PURE__ */
|
|
3207
|
+
return /* @__PURE__ */ React12.createElement(
|
|
2937
3208
|
"tr",
|
|
2938
3209
|
{
|
|
2939
3210
|
ref,
|
|
@@ -2949,15 +3220,28 @@ var TableRow = React11.forwardRef(function TableRow2({ rowId, selected, interact
|
|
|
2949
3220
|
}
|
|
2950
3221
|
);
|
|
2951
3222
|
});
|
|
2952
|
-
var SortIcon = () => /* @__PURE__ */
|
|
3223
|
+
var SortIcon = () => /* @__PURE__ */ React12.createElement("svg", { className: "alt-table-sort-icon", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.75, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true" }, /* @__PURE__ */ React12.createElement("path", { d: "M6 15l6-6 6 6" }));
|
|
2953
3224
|
function TableHead({ align, sort, onSort, className, children, ...rest }) {
|
|
2954
|
-
return /* @__PURE__ */
|
|
3225
|
+
return /* @__PURE__ */ React12.createElement("th", { scope: "col", className: cx("alt-th", className), "data-align": align, "aria-sort": onSort ? sort ?? "none" : void 0, ...rest }, onSort ? /* @__PURE__ */ React12.createElement("button", { type: "button", className: "alt-table-sort", "data-sort": sort ?? "none", onClick: onSort }, children, /* @__PURE__ */ React12.createElement(SortIcon, null)) : children);
|
|
2955
3226
|
}
|
|
2956
3227
|
function TableCell({ align, className, ...rest }) {
|
|
2957
|
-
return /* @__PURE__ */
|
|
2958
|
-
}
|
|
2959
|
-
var GripIcon = () => /* @__PURE__ */
|
|
2960
|
-
function DataTable({
|
|
3228
|
+
return /* @__PURE__ */ React12.createElement("td", { className: cx("alt-td", className), "data-align": align, ...rest });
|
|
3229
|
+
}
|
|
3230
|
+
var GripIcon = () => /* @__PURE__ */ React12.createElement("svg", { width: "12", height: "16", viewBox: "0 0 12 16", fill: "currentColor", "aria-hidden": "true" }, /* @__PURE__ */ React12.createElement("circle", { cx: "3", cy: "3", r: "1.3" }), /* @__PURE__ */ React12.createElement("circle", { cx: "9", cy: "3", r: "1.3" }), /* @__PURE__ */ React12.createElement("circle", { cx: "3", cy: "8", r: "1.3" }), /* @__PURE__ */ React12.createElement("circle", { cx: "9", cy: "8", r: "1.3" }), /* @__PURE__ */ React12.createElement("circle", { cx: "3", cy: "13", r: "1.3" }), /* @__PURE__ */ React12.createElement("circle", { cx: "9", cy: "13", r: "1.3" }));
|
|
3231
|
+
function DataTable({ skeleton, ...props }) {
|
|
3232
|
+
const missing = skeleton !== false && props.rows === void 0;
|
|
3233
|
+
useReportWaiting(missing || skeleton !== false && isPromise(props.rows));
|
|
3234
|
+
const arrival = useArrival(missing);
|
|
3235
|
+
if (!useHasWaited(missing || isPromise(props.rows))) return /* @__PURE__ */ React12.createElement(DataTableFace, { ...props, rows: props.rows ?? [] });
|
|
3236
|
+
const { lines = 5 } = hint(skeleton);
|
|
3237
|
+
const { columns, selectable, toolbar, maxHeight, className } = props;
|
|
3238
|
+
return /* @__PURE__ */ React12.createElement(Await, { shape: "none", enabled: skeleton !== false, imprint: /* @__PURE__ */ React12.createElement("div", { className: cx("alt-data-table", className) }, (selectable || toolbar) && /* @__PURE__ */ React12.createElement("div", { className: "alt-table-tools" }, toolbar && /* @__PURE__ */ React12.createElement("div", { className: "alt-table-tools-end" }, toolbar)), /* @__PURE__ */ React12.createElement(Table, { maxHeight, "aria-label": props["aria-label"] }, /* @__PURE__ */ React12.createElement(TableHeader, null, /* @__PURE__ */ React12.createElement(TableRow, null, selectable && /* @__PURE__ */ React12.createElement(TableHead, { className: "alt-th-check" }, /* @__PURE__ */ React12.createElement("span", { className: "alt-skeleton alt-check-imprint" })), columns.map((c) => /* @__PURE__ */ React12.createElement(TableHead, { key: c.key, align: c.align, style: { width: c.width } }, c.header)))), /* @__PURE__ */ React12.createElement(TableBody, null, Array.from({ length: lines }, (_, i) => /* @__PURE__ */ React12.createElement(TableRow, { key: i }, selectable && /* @__PURE__ */ React12.createElement(TableCell, { className: "alt-td-check" }, /* @__PURE__ */ React12.createElement("span", { className: "alt-skeleton alt-check-imprint" })), columns.map((c, ci) => /* @__PURE__ */ React12.createElement(TableCell, { key: c.key, align: c.align }, /* @__PURE__ */ React12.createElement("span", { className: "alt-skeleton alt-cell-imprint", "data-shape": "text", style: { width: CELL_WIDTHS[(i + ci) % CELL_WIDTHS.length], ["--i"]: i } })))))))) }, /* @__PURE__ */ React12.createElement(Arrive, { when: arrival }, /* @__PURE__ */ React12.createElement(DataTableLanded, { ...props })));
|
|
3239
|
+
}
|
|
3240
|
+
var CELL_WIDTHS = ["72%", "54%", "86%", "63%", "78%"];
|
|
3241
|
+
function DataTableLanded(props) {
|
|
3242
|
+
return /* @__PURE__ */ React12.createElement(DataTableFace, { ...props, rows: readPromised(props.rows) ?? [] });
|
|
3243
|
+
}
|
|
3244
|
+
function DataTableFace({
|
|
2961
3245
|
columns,
|
|
2962
3246
|
rows,
|
|
2963
3247
|
getRowId,
|
|
@@ -2981,11 +3265,11 @@ function DataTable({
|
|
|
2981
3265
|
}) {
|
|
2982
3266
|
const [sel, setSel] = useControllable(selected, defaultSelected, onSelectedChange);
|
|
2983
3267
|
const [srt, setSrt] = useControllable(sort, defaultSort, onSortChange);
|
|
2984
|
-
const [said, setSaid] =
|
|
2985
|
-
const table =
|
|
2986
|
-
const body =
|
|
3268
|
+
const [said, setSaid] = React12.useState("");
|
|
3269
|
+
const table = React12.useRef(null);
|
|
3270
|
+
const body = React12.useRef(null);
|
|
2987
3271
|
const name = (r) => getRowLabel?.(r) ?? getRowId(r);
|
|
2988
|
-
const view =
|
|
3272
|
+
const view = React12.useMemo(() => {
|
|
2989
3273
|
const col = srt && columns.find((c) => c.key === srt.key);
|
|
2990
3274
|
if (!srt || !col?.sortValue) return rows;
|
|
2991
3275
|
const d = srt.direction === "descending" ? -1 : 1;
|
|
@@ -3002,9 +3286,9 @@ function DataTable({
|
|
|
3002
3286
|
setSaid(next ? `Sorted by ${typeof c.header === "string" ? c.header : c.key}, ${next.direction}.` : "Sort cleared.");
|
|
3003
3287
|
};
|
|
3004
3288
|
const toggle = (id, on) => setSel(on ? [...sel.filter((x) => x !== id), id] : sel.filter((x) => x !== id));
|
|
3005
|
-
const start =
|
|
3006
|
-
const [drag, setDrag] =
|
|
3007
|
-
const [held, setHeld] =
|
|
3289
|
+
const start = React12.useRef(null);
|
|
3290
|
+
const [drag, setDrag] = React12.useState(null);
|
|
3291
|
+
const [held, setHeld] = React12.useState(null);
|
|
3008
3292
|
const rowEls = () => Array.from(body.current?.querySelectorAll("tr[data-row]") ?? []);
|
|
3009
3293
|
const snapshot = (at) => {
|
|
3010
3294
|
if (!table.current) return;
|
|
@@ -3074,24 +3358,24 @@ function DataTable({
|
|
|
3074
3358
|
setSaid(`Move cancelled; ${name(view[index])} is back at position ${held.origin + 1}.`);
|
|
3075
3359
|
}
|
|
3076
3360
|
};
|
|
3077
|
-
|
|
3361
|
+
React12.useEffect(() => {
|
|
3078
3362
|
if (!movable) setHeld(null);
|
|
3079
3363
|
}, [movable]);
|
|
3080
3364
|
const s = start.current;
|
|
3081
3365
|
const h = drag && s ? s.hs[drag.from] : 0;
|
|
3082
3366
|
const slotTop = drag && s ? drag.to <= drag.from ? s.tops[drag.to] : s.tops[drag.to] + s.hs[drag.to] - s.hs[drag.from] : 0;
|
|
3083
3367
|
const span = columns.length + (selectable ? 1 : 0) + (movable ? 1 : 0);
|
|
3084
|
-
return /* @__PURE__ */
|
|
3368
|
+
return /* @__PURE__ */ React12.createElement("div", { className: cx("alt-data-table", className) }, (selectable || toolbar) && /* @__PURE__ */ React12.createElement("div", { className: "alt-table-tools" }, sel.length > 0 && /* @__PURE__ */ React12.createElement("div", { className: "alt-table-selection" }, /* @__PURE__ */ React12.createElement(Badge, { variant: "count", tone: "accent", "aria-hidden": "true" }, sel.length), /* @__PURE__ */ React12.createElement("span", null, "selected"), actions?.(sel), /* @__PURE__ */ React12.createElement(Button, { size: "sm", variant: "ghost", onClick: () => setSel([]) }, "Clear")), toolbar && /* @__PURE__ */ React12.createElement("div", { className: "alt-table-tools-end" }, toolbar)), /* @__PURE__ */ React12.createElement(
|
|
3085
3369
|
Table,
|
|
3086
3370
|
{
|
|
3087
3371
|
ref: table,
|
|
3088
3372
|
maxHeight,
|
|
3089
3373
|
"aria-label": rest["aria-label"],
|
|
3090
3374
|
"data-dragging": drag ? "" : void 0,
|
|
3091
|
-
underlay: drag && s ? /* @__PURE__ */
|
|
3375
|
+
underlay: drag && s ? /* @__PURE__ */ React12.createElement("span", { className: "alt-table-slot", "aria-hidden": "true", style: { top: slotTop + (table.current?.offsetTop ?? 0), height: h } }) : null
|
|
3092
3376
|
},
|
|
3093
|
-
/* @__PURE__ */
|
|
3094
|
-
/* @__PURE__ */
|
|
3377
|
+
/* @__PURE__ */ React12.createElement(TableHeader, null, /* @__PURE__ */ React12.createElement(TableRow, null, movable && /* @__PURE__ */ React12.createElement(TableHead, { className: "alt-th-grip" }, /* @__PURE__ */ React12.createElement("span", { className: "alt-sr" }, "Move")), selectable && /* @__PURE__ */ React12.createElement(TableHead, { className: "alt-th-check" }, /* @__PURE__ */ React12.createElement(Checkbox, { "aria-label": "Select all rows", checked: all, indeterminate: some, onCheckedChange: (on) => setSel(on ? Array.from(/* @__PURE__ */ new Set([...sel, ...ids])) : sel.filter((x) => !ids.includes(x))) })), columns.map((c) => /* @__PURE__ */ React12.createElement(TableHead, { key: c.key, align: c.align, style: { width: c.width }, sort: srt?.key === c.key ? srt.direction : "none", onSort: c.sortValue ? () => cycle(c) : void 0 }, c.header)))),
|
|
3378
|
+
/* @__PURE__ */ React12.createElement(TableBody, { ref: body }, !view.length && /* @__PURE__ */ React12.createElement("tr", null, /* @__PURE__ */ React12.createElement("td", { className: "alt-td alt-table-empty", colSpan: span }, empty)), view.map((r, i) => {
|
|
3095
3379
|
const id = ids[i];
|
|
3096
3380
|
let shift = 0;
|
|
3097
3381
|
if (drag && id !== drag.id && h) {
|
|
@@ -3099,7 +3383,7 @@ function DataTable({
|
|
|
3099
3383
|
if (drag.to < drag.from && i >= drag.to && i < drag.from) shift = h;
|
|
3100
3384
|
}
|
|
3101
3385
|
const following = drag?.id === id;
|
|
3102
|
-
return /* @__PURE__ */
|
|
3386
|
+
return /* @__PURE__ */ React12.createElement(
|
|
3103
3387
|
TableRow,
|
|
3104
3388
|
{
|
|
3105
3389
|
key: id,
|
|
@@ -3114,7 +3398,7 @@ function DataTable({
|
|
|
3114
3398
|
if (!e.target.closest("button, a, input, label, select, textarea")) onRowClick(r);
|
|
3115
3399
|
} : void 0
|
|
3116
3400
|
},
|
|
3117
|
-
movable && /* @__PURE__ */
|
|
3401
|
+
movable && /* @__PURE__ */ React12.createElement(TableCell, { className: "alt-td-grip" }, /* @__PURE__ */ React12.createElement(
|
|
3118
3402
|
"button",
|
|
3119
3403
|
{
|
|
3120
3404
|
type: "button",
|
|
@@ -3130,18 +3414,18 @@ function DataTable({
|
|
|
3130
3414
|
if (held?.id === id && !drag) setTimeout(() => setHeld((x) => x?.id === id && document.activeElement?.closest(`tr[data-row="${CSS.escape(id)}"]`) === null ? null : x), 0);
|
|
3131
3415
|
}
|
|
3132
3416
|
},
|
|
3133
|
-
/* @__PURE__ */
|
|
3417
|
+
/* @__PURE__ */ React12.createElement(GripIcon, null)
|
|
3134
3418
|
)),
|
|
3135
|
-
selectable && /* @__PURE__ */
|
|
3419
|
+
selectable && /* @__PURE__ */ React12.createElement(TableCell, { className: "alt-td-check" }, /* @__PURE__ */ React12.createElement(Checkbox, { "aria-label": `Select ${name(r)}`, checked: chosen.has(id), onCheckedChange: (on) => toggle(id, on) })),
|
|
3136
3420
|
columns.map((c, ci) => {
|
|
3137
3421
|
const content = c.cell ? c.cell(r) : String(r[c.key] ?? "");
|
|
3138
|
-
return /* @__PURE__ */
|
|
3422
|
+
return /* @__PURE__ */ React12.createElement(TableCell, { key: c.key, align: c.align }, onRowClick && ci === 0 ? /* @__PURE__ */ React12.createElement("button", { type: "button", className: "alt-table-rowbtn", onClick: () => onRowClick(r) }, content) : content);
|
|
3139
3423
|
})
|
|
3140
3424
|
);
|
|
3141
3425
|
}))
|
|
3142
|
-
), /* @__PURE__ */
|
|
3426
|
+
), /* @__PURE__ */ React12.createElement("span", { className: "alt-sr", "aria-live": "polite" }, selectable && sel.length ? `${sel.length} selected. ` : "", said));
|
|
3143
3427
|
}
|
|
3144
|
-
var BoardCtx =
|
|
3428
|
+
var BoardCtx = React12.createContext(null);
|
|
3145
3429
|
function readBoard(root) {
|
|
3146
3430
|
return Array.from(root.querySelectorAll("[data-board-col]")).map((col) => {
|
|
3147
3431
|
const list = col.querySelector(".alt-board-list");
|
|
@@ -3188,18 +3472,18 @@ function plan(cols, id, cx2, cy, h) {
|
|
|
3188
3472
|
}
|
|
3189
3473
|
return { to: { column: tc.id, index }, shifts, slotTop, gap: tc.gap };
|
|
3190
3474
|
}
|
|
3191
|
-
var Board =
|
|
3192
|
-
const root =
|
|
3193
|
-
|
|
3194
|
-
const hintId =
|
|
3195
|
-
const [carry, setCarry] =
|
|
3196
|
-
const [kb, setKb] =
|
|
3197
|
-
const [landing, setLanding] =
|
|
3198
|
-
const [said, setSaid] =
|
|
3199
|
-
const start =
|
|
3200
|
-
const dragged =
|
|
3475
|
+
var Board = React12.forwardRef(function Board2({ onMove, className, children, ...rest }, ref) {
|
|
3476
|
+
const root = React12.useRef(null);
|
|
3477
|
+
React12.useImperativeHandle(ref, () => root.current);
|
|
3478
|
+
const hintId = React12.useId();
|
|
3479
|
+
const [carry, setCarry] = React12.useState(null);
|
|
3480
|
+
const [kb, setKb] = React12.useState(null);
|
|
3481
|
+
const [landing, setLanding] = React12.useState(null);
|
|
3482
|
+
const [said, setSaid] = React12.useState("");
|
|
3483
|
+
const start = React12.useRef(null);
|
|
3484
|
+
const dragged = React12.useRef(false);
|
|
3201
3485
|
useCarry(root, "[data-board-card]", "data-board-card");
|
|
3202
|
-
|
|
3486
|
+
React12.useEffect(() => {
|
|
3203
3487
|
if (!landing) return;
|
|
3204
3488
|
const t = setTimeout(() => setLanding(null), 450);
|
|
3205
3489
|
return () => clearTimeout(t);
|
|
@@ -3328,17 +3612,17 @@ var Board = React11.forwardRef(function Board2({ onMove, className, children, ..
|
|
|
3328
3612
|
return d;
|
|
3329
3613
|
};
|
|
3330
3614
|
const ctx = { carry, kb, landing, hintId, onPointerDown, onPointerMove, onPointerUp, onKeyDown, onBlur, swallowClick };
|
|
3331
|
-
return /* @__PURE__ */
|
|
3615
|
+
return /* @__PURE__ */ React12.createElement(BoardCtx.Provider, { value: ctx }, /* @__PURE__ */ React12.createElement("div", { ref: root, role: "group", "aria-label": rest["aria-label"] ?? "Board", className: cx("alt-board", className), "data-carrying": carry || kb ? "" : void 0, ...rest }, children, /* @__PURE__ */ React12.createElement("span", { id: hintId, className: "alt-sr" }, "Press Space to pick up. While holding a card, use the arrow keys to move it, Space to drop it, Escape to cancel."), /* @__PURE__ */ React12.createElement("span", { className: "alt-sr", "aria-live": "assertive" }, said)));
|
|
3332
3616
|
});
|
|
3333
3617
|
function BoardColumn({ id, title, collapsed, defaultCollapsed = false, onCollapsedChange, collapsible, className, children, ...rest }) {
|
|
3334
|
-
const ctx =
|
|
3618
|
+
const ctx = React12.useContext(BoardCtx);
|
|
3335
3619
|
const [isCollapsed, setCollapsed] = useControllable(collapsed, defaultCollapsed, onCollapsedChange);
|
|
3336
|
-
const count =
|
|
3620
|
+
const count = React12.Children.toArray(children).filter(React12.isValidElement).length;
|
|
3337
3621
|
const label = typeof title === "string" ? title : id;
|
|
3338
3622
|
const carry = ctx?.carry;
|
|
3339
3623
|
const over = carry ? carry.to.column === id : ctx?.kb?.at.column === id;
|
|
3340
3624
|
const receiving = !!carry && carry.to.column === id && carry.from.column !== id && !isCollapsed;
|
|
3341
|
-
return /* @__PURE__ */
|
|
3625
|
+
return /* @__PURE__ */ React12.createElement(
|
|
3342
3626
|
"section",
|
|
3343
3627
|
{
|
|
3344
3628
|
className: cx("alt-board-col", className),
|
|
@@ -3349,7 +3633,7 @@ function BoardColumn({ id, title, collapsed, defaultCollapsed = false, onCollaps
|
|
|
3349
3633
|
"data-over": over ? "" : void 0,
|
|
3350
3634
|
...rest
|
|
3351
3635
|
},
|
|
3352
|
-
/* @__PURE__ */
|
|
3636
|
+
/* @__PURE__ */ React12.createElement("header", { className: "alt-board-head" }, /* @__PURE__ */ React12.createElement("h3", { className: "alt-board-title" }, title), /* @__PURE__ */ React12.createElement("span", { className: "alt-board-count", "aria-label": `${count} ${count === 1 ? "card" : "cards"}` }, count), collapsible && /* @__PURE__ */ React12.createElement(
|
|
3353
3637
|
Button,
|
|
3354
3638
|
{
|
|
3355
3639
|
variant: "ghost",
|
|
@@ -3361,20 +3645,20 @@ function BoardColumn({ id, title, collapsed, defaultCollapsed = false, onCollaps
|
|
|
3361
3645
|
"data-collapsed": isCollapsed ? "" : void 0,
|
|
3362
3646
|
onClick: () => setCollapsed(!isCollapsed)
|
|
3363
3647
|
},
|
|
3364
|
-
/* @__PURE__ */
|
|
3648
|
+
/* @__PURE__ */ React12.createElement(Icons.ChevronDown, null)
|
|
3365
3649
|
)),
|
|
3366
|
-
isCollapsed ? /* @__PURE__ */
|
|
3650
|
+
isCollapsed ? /* @__PURE__ */ React12.createElement(Pile, { count: Math.max(count, 1), className: "alt-board-pile" }, /* @__PURE__ */ React12.createElement("div", { className: "alt-board-pile-face" }, /* @__PURE__ */ React12.createElement("b", null, title), /* @__PURE__ */ React12.createElement("span", null, count ? `${count} ${count === 1 ? "card" : "cards"}` : "No cards"))) : /* @__PURE__ */ React12.createElement("div", { className: "alt-board-list", style: receiving ? { paddingBottom: carry.h + carry.gap } : void 0 }, carry && carry.to.column === id && /* @__PURE__ */ React12.createElement("span", { className: "alt-board-slot", "aria-hidden": "true", style: { top: carry.slotTop, height: carry.h } }), children, !count && !carry && /* @__PURE__ */ React12.createElement("div", { className: "alt-board-empty" }, "No cards"))
|
|
3367
3651
|
);
|
|
3368
3652
|
}
|
|
3369
|
-
var BoardCard =
|
|
3370
|
-
const ctx =
|
|
3653
|
+
var BoardCard = React12.forwardRef(function BoardCard2({ id, label, heldBy, settle, className, style, onClickCapture, children, ...rest }, ref) {
|
|
3654
|
+
const ctx = React12.useContext(BoardCtx);
|
|
3371
3655
|
const depth = useDepth({ heldBy, settle });
|
|
3372
3656
|
const carry = ctx?.carry;
|
|
3373
3657
|
const following = carry?.id === id;
|
|
3374
3658
|
const carried = following || ctx?.kb?.id === id;
|
|
3375
3659
|
const shift = carry?.shifts[id];
|
|
3376
3660
|
const transform = following ? `translate(${carry.dx}px, ${carry.dy}px)` : shift ? `translateY(${shift}px)` : void 0;
|
|
3377
|
-
return /* @__PURE__ */
|
|
3661
|
+
return /* @__PURE__ */ React12.createElement(
|
|
3378
3662
|
"div",
|
|
3379
3663
|
{
|
|
3380
3664
|
ref,
|
|
@@ -3415,6 +3699,7 @@ export {
|
|
|
3415
3699
|
AltitudeProvider,
|
|
3416
3700
|
Avatar,
|
|
3417
3701
|
AvatarGroup,
|
|
3702
|
+
Await,
|
|
3418
3703
|
Badge,
|
|
3419
3704
|
Board,
|
|
3420
3705
|
BoardCard,
|
|
@@ -3442,11 +3727,13 @@ export {
|
|
|
3442
3727
|
Input,
|
|
3443
3728
|
Kbd,
|
|
3444
3729
|
Layer,
|
|
3730
|
+
LoadingScope,
|
|
3445
3731
|
Pile,
|
|
3446
3732
|
Popover,
|
|
3447
3733
|
Progress,
|
|
3448
3734
|
Radio,
|
|
3449
3735
|
RadioGroup,
|
|
3736
|
+
RevealGroup,
|
|
3450
3737
|
ScrollArea,
|
|
3451
3738
|
Select,
|
|
3452
3739
|
SelectItem,
|
|
@@ -3481,6 +3768,7 @@ export {
|
|
|
3481
3768
|
commandScore,
|
|
3482
3769
|
contrast,
|
|
3483
3770
|
deriveAccent,
|
|
3771
|
+
readPromised,
|
|
3484
3772
|
riseDelay,
|
|
3485
3773
|
toast,
|
|
3486
3774
|
useAltitude,
|