@apliteni/apliteni-ui 0.78.0 → 0.79.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/react/README.md +86 -0
- package/react/dist/index.css +178 -2
- package/react/dist/index.d.ts +64 -1
- package/react/dist/index.js +797 -326
- package/src/styles/tap-zone.css +33 -2
package/react/dist/index.js
CHANGED
|
@@ -1445,20 +1445,490 @@ function Denied({
|
|
|
1445
1445
|
] });
|
|
1446
1446
|
}
|
|
1447
1447
|
|
|
1448
|
-
// src/
|
|
1448
|
+
// src/DatePicker.tsx
|
|
1449
1449
|
import {
|
|
1450
|
-
Fragment as Fragment4,
|
|
1451
1450
|
useCallback as useCallback2,
|
|
1452
1451
|
useEffect as useEffect6,
|
|
1453
|
-
|
|
1452
|
+
useMemo as useMemo3,
|
|
1454
1453
|
useRef as useRef10,
|
|
1455
1454
|
useState as useState6
|
|
1456
1455
|
} from "react";
|
|
1457
|
-
import {
|
|
1458
|
-
import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1456
|
+
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1459
1457
|
var cx5 = (...a) => a.filter(Boolean).join(" ");
|
|
1458
|
+
var pad = (n) => String(n).padStart(2, "0");
|
|
1459
|
+
var DAY_MS = 864e5;
|
|
1460
|
+
var EN_DASH = "\u2013";
|
|
1461
|
+
var MONTH_RE = /^(\d{4})-(\d{2})$/;
|
|
1462
|
+
var DAY_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
1463
|
+
var PHONE_MAX = 560;
|
|
1464
|
+
function usePhone() {
|
|
1465
|
+
const [phone, setPhone] = useState6(false);
|
|
1466
|
+
useEffect6(() => {
|
|
1467
|
+
const query = typeof window === "undefined" ? null : window.matchMedia?.(`(max-width: ${PHONE_MAX}px)`);
|
|
1468
|
+
if (!query) return;
|
|
1469
|
+
const read = () => setPhone(query.matches);
|
|
1470
|
+
read();
|
|
1471
|
+
query.addEventListener("change", read);
|
|
1472
|
+
return () => query.removeEventListener("change", read);
|
|
1473
|
+
}, []);
|
|
1474
|
+
return phone;
|
|
1475
|
+
}
|
|
1476
|
+
function monthIndexOf(period) {
|
|
1477
|
+
const m = MONTH_RE.exec(period);
|
|
1478
|
+
if (!m) return null;
|
|
1479
|
+
const month = +m[2];
|
|
1480
|
+
return month >= 1 && month <= 12 ? +m[1] * 12 + month - 1 : null;
|
|
1481
|
+
}
|
|
1482
|
+
function dayIndexOf(period) {
|
|
1483
|
+
const m = DAY_RE.exec(period);
|
|
1484
|
+
if (!m) return null;
|
|
1485
|
+
const [y, mo, d] = [+m[1], +m[2], +m[3]];
|
|
1486
|
+
const at = Date.UTC(y, mo - 1, d);
|
|
1487
|
+
const back = new Date(at);
|
|
1488
|
+
if (back.getUTCFullYear() !== y || back.getUTCMonth() !== mo - 1 || back.getUTCDate() !== d) return null;
|
|
1489
|
+
return Math.round(at / DAY_MS);
|
|
1490
|
+
}
|
|
1491
|
+
function toIndex(period, grain, edge = "start") {
|
|
1492
|
+
if (!period) return null;
|
|
1493
|
+
if (grain === "month") {
|
|
1494
|
+
const month2 = monthIndexOf(period);
|
|
1495
|
+
if (month2 != null) return month2;
|
|
1496
|
+
const day2 = dayIndexOf(period);
|
|
1497
|
+
return day2 == null ? null : monthOf(day2);
|
|
1498
|
+
}
|
|
1499
|
+
const day = dayIndexOf(period);
|
|
1500
|
+
if (day != null) return day;
|
|
1501
|
+
const month = monthIndexOf(period);
|
|
1502
|
+
if (month == null) return null;
|
|
1503
|
+
return edge === "start" ? firstDayOf(month) : firstDayOf(month + 1) - 1;
|
|
1504
|
+
}
|
|
1505
|
+
function fromIndex(index, grain) {
|
|
1506
|
+
if (grain === "month") return `${pad4(Math.floor(index / 12))}-${pad(index % 12 + 1)}`;
|
|
1507
|
+
const at = new Date(index * DAY_MS);
|
|
1508
|
+
return `${pad4(at.getUTCFullYear())}-${pad(at.getUTCMonth() + 1)}-${pad(at.getUTCDate())}`;
|
|
1509
|
+
}
|
|
1510
|
+
var pad4 = (n) => String(n).padStart(4, "0");
|
|
1511
|
+
var monthOf = (dayIndex) => {
|
|
1512
|
+
const at = new Date(dayIndex * DAY_MS);
|
|
1513
|
+
return at.getUTCFullYear() * 12 + at.getUTCMonth();
|
|
1514
|
+
};
|
|
1515
|
+
var firstDayOf = (monthIndex) => Math.round(Date.UTC(Math.floor(monthIndex / 12), monthIndex % 12, 1) / DAY_MS);
|
|
1516
|
+
var daysInMonth = (monthIndex) => firstDayOf(monthIndex + 1) - firstDayOf(monthIndex);
|
|
1517
|
+
function stepMonths(dayIndex, by) {
|
|
1518
|
+
const at = new Date(dayIndex * DAY_MS);
|
|
1519
|
+
const target = monthOf(dayIndex) + by;
|
|
1520
|
+
const day = Math.min(at.getUTCDate(), daysInMonth(target));
|
|
1521
|
+
return firstDayOf(target) + day - 1;
|
|
1522
|
+
}
|
|
1523
|
+
function evenMonthLabels(format) {
|
|
1524
|
+
const raw = Array.from({ length: 12 }, (_, m) => format.format(new Date(Date.UTC(2e3, m, 1))));
|
|
1525
|
+
const bare = raw.map((n) => n.replace(/\.$/, ""));
|
|
1526
|
+
const chars = bare.map((n) => Array.from(n));
|
|
1527
|
+
const cut = chars.map((c) => c.slice(0, Math.min(...chars.map((o) => o.length))).join(""));
|
|
1528
|
+
const even = bare.every((n) => /^\p{L}+$/u.test(n)) && new Set(cut).size === 12;
|
|
1529
|
+
return even ? cut : raw;
|
|
1530
|
+
}
|
|
1531
|
+
var clamp = (index, lo, hi) => Math.min(hi ?? index, Math.max(lo ?? index, index));
|
|
1532
|
+
function DatePicker({
|
|
1533
|
+
mode = "month",
|
|
1534
|
+
value,
|
|
1535
|
+
defaultValue = null,
|
|
1536
|
+
onChange,
|
|
1537
|
+
range,
|
|
1538
|
+
defaultRange,
|
|
1539
|
+
onRangeChange,
|
|
1540
|
+
min,
|
|
1541
|
+
max,
|
|
1542
|
+
disabledPeriods,
|
|
1543
|
+
presets,
|
|
1544
|
+
placeholder,
|
|
1545
|
+
ariaLabel,
|
|
1546
|
+
id,
|
|
1547
|
+
disabled = false,
|
|
1548
|
+
align = "start",
|
|
1549
|
+
locale = "en-GB",
|
|
1550
|
+
weekStartsOn = 1,
|
|
1551
|
+
today,
|
|
1552
|
+
sheet,
|
|
1553
|
+
open: openProp,
|
|
1554
|
+
defaultOpen = false,
|
|
1555
|
+
onOpenChange
|
|
1556
|
+
}) {
|
|
1557
|
+
const grain = mode === "day" || mode === "day-range" ? "day" : "month";
|
|
1558
|
+
const picksRange = mode === "range" || mode === "day-range";
|
|
1559
|
+
const phone = usePhone();
|
|
1560
|
+
const asSheet = sheet ?? phone;
|
|
1561
|
+
const root = useRef10(null);
|
|
1562
|
+
const trigger = useRef10(null);
|
|
1563
|
+
const grid = useRef10(null);
|
|
1564
|
+
const [selfOpen, setSelfOpen] = useState6(defaultOpen);
|
|
1565
|
+
const open = openProp ?? selfOpen;
|
|
1566
|
+
const [selfValue, setSelfValue] = useState6(defaultValue);
|
|
1567
|
+
const picked = value !== void 0 ? value : selfValue;
|
|
1568
|
+
const [selfRange, setSelfRange] = useState6(defaultRange ?? { start: null, end: null });
|
|
1569
|
+
const span = range !== void 0 ? range : selfRange;
|
|
1570
|
+
const names = useMemo3(() => ({
|
|
1571
|
+
month: new Intl.DateTimeFormat(locale, { month: "long", timeZone: "UTC" }),
|
|
1572
|
+
monthShort: new Intl.DateTimeFormat(locale, { month: "short", timeZone: "UTC" }),
|
|
1573
|
+
monthYear: new Intl.DateTimeFormat(locale, { month: "long", year: "numeric", timeZone: "UTC" }),
|
|
1574
|
+
monthYearShort: new Intl.DateTimeFormat(locale, { month: "short", year: "numeric", timeZone: "UTC" }),
|
|
1575
|
+
day: new Intl.DateTimeFormat(locale, { day: "numeric", month: "long", year: "numeric", timeZone: "UTC" }),
|
|
1576
|
+
dayShort: new Intl.DateTimeFormat(locale, { day: "numeric", month: "short", year: "numeric", timeZone: "UTC" }),
|
|
1577
|
+
weekday: new Intl.DateTimeFormat(locale, { weekday: "long", timeZone: "UTC" }),
|
|
1578
|
+
weekdayShort: new Intl.DateTimeFormat(locale, { weekday: "short", timeZone: "UTC" })
|
|
1579
|
+
}), [locale]);
|
|
1580
|
+
const monthLabels = useMemo3(() => evenMonthLabels(names.monthShort), [names]);
|
|
1581
|
+
const at = useCallback2((index) => new Date(
|
|
1582
|
+
grain === "month" ? Date.UTC(Math.floor(index / 12), index % 12, 1) : index * DAY_MS
|
|
1583
|
+
), [grain]);
|
|
1584
|
+
const lo = toIndex(min, grain, "start");
|
|
1585
|
+
const hi = toIndex(max, grain, "end");
|
|
1586
|
+
const blocked = useMemo3(() => (disabledPeriods ?? []).flatMap((period) => {
|
|
1587
|
+
const from = toIndex(period, grain, "start");
|
|
1588
|
+
const to = toIndex(period, grain, "end");
|
|
1589
|
+
return from == null || to == null ? [] : [[from, to]];
|
|
1590
|
+
}), [disabledPeriods, grain]);
|
|
1591
|
+
const outOfBounds = (index) => lo != null && index < lo || hi != null && index > hi;
|
|
1592
|
+
const isBlocked = (index) => outOfBounds(index) || blocked.some(([from, to]) => index >= from && index <= to);
|
|
1593
|
+
const todayIndex = useMemo3(() => {
|
|
1594
|
+
const given = toIndex(today, "day");
|
|
1595
|
+
const now = given ?? Math.floor(Date.now() / DAY_MS);
|
|
1596
|
+
return grain === "month" ? monthOf(now) : now;
|
|
1597
|
+
}, [today, grain]);
|
|
1598
|
+
const anchor = toIndex(picked, grain) ?? toIndex(picksRange ? span.start ?? span.end : null, grain) ?? todayIndex;
|
|
1599
|
+
const [cursor, setCursor] = useState6(() => clamp(anchor, lo, hi));
|
|
1600
|
+
const land = useRef10(false);
|
|
1601
|
+
const setOpen = useCallback2((next) => {
|
|
1602
|
+
if (openProp === void 0) setSelfOpen(next);
|
|
1603
|
+
onOpenChange?.(next);
|
|
1604
|
+
}, [openProp, onOpenChange]);
|
|
1605
|
+
const close = useRef10(setOpen);
|
|
1606
|
+
useIsoLayoutEffect(() => {
|
|
1607
|
+
close.current = setOpen;
|
|
1608
|
+
});
|
|
1609
|
+
useEffect6(() => {
|
|
1610
|
+
if (open) setCursor(clamp(anchor, lo, hi));
|
|
1611
|
+
}, [open]);
|
|
1612
|
+
useEffect6(() => {
|
|
1613
|
+
if (!open || asSheet) return;
|
|
1614
|
+
const doc = root.current?.ownerDocument ?? document;
|
|
1615
|
+
const onClick = (e) => {
|
|
1616
|
+
if (!root.current?.contains(e.target)) close.current(false);
|
|
1617
|
+
};
|
|
1618
|
+
const onKey2 = (e) => {
|
|
1619
|
+
if (e.key !== "Escape") return;
|
|
1620
|
+
close.current(false);
|
|
1621
|
+
trigger.current?.focus();
|
|
1622
|
+
};
|
|
1623
|
+
doc.addEventListener("click", onClick);
|
|
1624
|
+
doc.addEventListener("keydown", onKey2);
|
|
1625
|
+
return () => {
|
|
1626
|
+
doc.removeEventListener("click", onClick);
|
|
1627
|
+
doc.removeEventListener("keydown", onKey2);
|
|
1628
|
+
};
|
|
1629
|
+
}, [open]);
|
|
1630
|
+
useIsoLayoutEffect(() => {
|
|
1631
|
+
if (!open || !land.current) return;
|
|
1632
|
+
land.current = false;
|
|
1633
|
+
grid.current?.querySelector('[data-dp-cell][tabindex="0"]')?.focus();
|
|
1634
|
+
});
|
|
1635
|
+
const columns = grain === "month" ? 3 : 7;
|
|
1636
|
+
const page = grain === "month" ? Math.floor(cursor / 12) : monthOf(cursor);
|
|
1637
|
+
const caption = grain === "month" ? String(page) : names.monthYear.format(at(firstDayOf(page)));
|
|
1638
|
+
const periodName = useCallback2((index) => grain === "month" ? names.monthYear.format(at(index)) : `${names.weekday.format(at(index))} ${names.day.format(at(index))}`, [grain, names, at]);
|
|
1639
|
+
const count = grain === "month" ? 12 : daysInMonth(page);
|
|
1640
|
+
const first = grain === "month" ? page * 12 : firstDayOf(page);
|
|
1641
|
+
const last = first + count - 1;
|
|
1642
|
+
const cells = useMemo3(() => Array.from({ length: count }, (_, i) => {
|
|
1643
|
+
const index = first + i;
|
|
1644
|
+
const period = fromIndex(index, grain);
|
|
1645
|
+
return {
|
|
1646
|
+
period,
|
|
1647
|
+
index,
|
|
1648
|
+
label: grain === "month" ? monthLabels[index % 12] : String(new Date(index * DAY_MS).getUTCDate()),
|
|
1649
|
+
name: periodName(index),
|
|
1650
|
+
disabled: isBlocked(index)
|
|
1651
|
+
};
|
|
1652
|
+
}), [grain, first, count, monthLabels, at, periodName, lo, hi, blocked]);
|
|
1653
|
+
const lead = grain === "day" ? (new Date(firstDayOf(page) * DAY_MS).getUTCDay() - weekStartsOn + 7) % 7 : 0;
|
|
1654
|
+
const rows = [];
|
|
1655
|
+
const slots = [...Array(lead).fill(null), ...cells];
|
|
1656
|
+
while (slots.length % columns !== 0) slots.push(null);
|
|
1657
|
+
for (let i = 0; i < slots.length; i += columns) rows.push(slots.slice(i, i + columns));
|
|
1658
|
+
const weekdays = grain === "day" ? Array.from({ length: 7 }, (_, i) => {
|
|
1659
|
+
const sample = at(3 + (weekStartsOn + i) % 7);
|
|
1660
|
+
return { short: names.weekdayShort.format(sample), long: names.weekday.format(sample) };
|
|
1661
|
+
}) : [];
|
|
1662
|
+
const startIndex = toIndex(span.start, grain);
|
|
1663
|
+
const endIndex = toIndex(span.end, grain);
|
|
1664
|
+
const edges = startIndex != null && endIndex != null ? [Math.min(startIndex, endIndex), Math.max(startIndex, endIndex)] : [startIndex ?? endIndex, startIndex ?? endIndex];
|
|
1665
|
+
const isEdge = (index) => index === edges[0] || index === edges[1];
|
|
1666
|
+
const inSpan = (index) => edges[0] != null && edges[1] != null && index > edges[0] && index < edges[1];
|
|
1667
|
+
const showsSpan = (cell) => inSpan(cell.index) && !cell.disabled;
|
|
1668
|
+
const isPicked = (index) => picksRange ? isEdge(index) : index === toIndex(picked, grain);
|
|
1669
|
+
function pick(cell) {
|
|
1670
|
+
if (cell.disabled) return;
|
|
1671
|
+
setCursor(cell.index);
|
|
1672
|
+
if (picksRange) {
|
|
1673
|
+
const half = startIndex != null && endIndex == null;
|
|
1674
|
+
const next = half ? cell.index < startIndex ? { start: cell.period, end: span.start } : { start: span.start, end: cell.period } : { start: cell.period, end: null };
|
|
1675
|
+
if (range === void 0) setSelfRange(next);
|
|
1676
|
+
onRangeChange?.(next);
|
|
1677
|
+
if (next.end == null) return;
|
|
1678
|
+
} else {
|
|
1679
|
+
if (value === void 0) setSelfValue(cell.period);
|
|
1680
|
+
onChange?.(cell.period);
|
|
1681
|
+
}
|
|
1682
|
+
dismiss();
|
|
1683
|
+
}
|
|
1684
|
+
function dismiss() {
|
|
1685
|
+
setOpen(false);
|
|
1686
|
+
if (!asSheet) trigger.current?.focus();
|
|
1687
|
+
}
|
|
1688
|
+
function allowed(preset) {
|
|
1689
|
+
const a = toIndex(preset.range.start, grain, "start");
|
|
1690
|
+
const b = toIndex(preset.range.end, grain, "end");
|
|
1691
|
+
if (a == null || b == null) return null;
|
|
1692
|
+
const [from, to] = a <= b ? [a, b] : [b, a];
|
|
1693
|
+
if (hi != null && from > hi || lo != null && to < lo) return null;
|
|
1694
|
+
const ends = [clamp(from, lo, hi), clamp(to, lo, hi)];
|
|
1695
|
+
if (ends.some(isBlocked)) return null;
|
|
1696
|
+
return { start: fromIndex(ends[0], grain), end: fromIndex(ends[1], grain) };
|
|
1697
|
+
}
|
|
1698
|
+
function applyPreset(next) {
|
|
1699
|
+
if (range === void 0) setSelfRange(next);
|
|
1700
|
+
onRangeChange?.(next);
|
|
1701
|
+
const start = toIndex(next.start, grain, "start");
|
|
1702
|
+
if (start != null) setCursor(start);
|
|
1703
|
+
dismiss();
|
|
1704
|
+
}
|
|
1705
|
+
function step(by) {
|
|
1706
|
+
setCursor((now) => clamp(now + by, lo, hi));
|
|
1707
|
+
}
|
|
1708
|
+
function stepPage(by) {
|
|
1709
|
+
setCursor((now) => clamp(grain === "month" ? now + 12 * by : stepMonths(now, by), lo, hi));
|
|
1710
|
+
}
|
|
1711
|
+
function onGridKeyDown(e) {
|
|
1712
|
+
const rowStart = cursor - (cursor - (first - lead)) % columns;
|
|
1713
|
+
const moves = {
|
|
1714
|
+
ArrowLeft: () => step(-1),
|
|
1715
|
+
ArrowRight: () => step(1),
|
|
1716
|
+
ArrowUp: () => step(-columns),
|
|
1717
|
+
ArrowDown: () => step(columns),
|
|
1718
|
+
Home: () => setCursor(clamp(Math.max(rowStart, first), lo, hi)),
|
|
1719
|
+
End: () => setCursor(clamp(Math.min(rowStart + columns - 1, last), lo, hi)),
|
|
1720
|
+
PageUp: () => stepPage(-1),
|
|
1721
|
+
PageDown: () => stepPage(1)
|
|
1722
|
+
};
|
|
1723
|
+
const move = moves[e.key];
|
|
1724
|
+
if (move) {
|
|
1725
|
+
e.preventDefault();
|
|
1726
|
+
land.current = true;
|
|
1727
|
+
move();
|
|
1728
|
+
return;
|
|
1729
|
+
}
|
|
1730
|
+
if (e.key === "Escape" && !asSheet) {
|
|
1731
|
+
e.preventDefault();
|
|
1732
|
+
e.stopPropagation();
|
|
1733
|
+
dismiss();
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
const shown = useMemo3(() => {
|
|
1737
|
+
if (picksRange) {
|
|
1738
|
+
const text2 = (period) => {
|
|
1739
|
+
const index2 = toIndex(period, grain);
|
|
1740
|
+
if (index2 == null) return null;
|
|
1741
|
+
return grain === "month" ? names.monthYearShort.format(at(index2)) : names.dayShort.format(at(index2));
|
|
1742
|
+
};
|
|
1743
|
+
const from = text2(span.start);
|
|
1744
|
+
const to = text2(span.end);
|
|
1745
|
+
if (from && to) return `${from} ${EN_DASH} ${to}`;
|
|
1746
|
+
if (from) return `From ${from}`;
|
|
1747
|
+
if (to) return `Until ${to}`;
|
|
1748
|
+
return null;
|
|
1749
|
+
}
|
|
1750
|
+
const index = toIndex(picked, grain);
|
|
1751
|
+
if (index == null) return null;
|
|
1752
|
+
return grain === "month" ? names.monthYear.format(at(index)) : names.day.format(at(index));
|
|
1753
|
+
}, [picksRange, grain, span.start, span.end, picked, names, at]);
|
|
1754
|
+
const empty = placeholder ?? (picksRange ? grain === "month" ? "Select a period" : "Select dates" : grain === "month" ? "Select a month" : "Select a date");
|
|
1755
|
+
const name = ariaLabel || empty;
|
|
1756
|
+
const pageName = (which) => grain === "month" ? String(which) : names.monthYear.format(at(firstDayOf(which)));
|
|
1757
|
+
const stepBack = `${grain === "month" ? "Previous year" : "Previous month"}, ${pageName(page - 1)}`;
|
|
1758
|
+
const stepOn = `${grain === "month" ? "Next year" : "Next month"}, ${pageName(page + 1)}`;
|
|
1759
|
+
function state(cell) {
|
|
1760
|
+
const parts = [cell.name];
|
|
1761
|
+
if (cell.index === todayIndex) parts.push(grain === "month" ? "this month" : "today");
|
|
1762
|
+
if (picksRange) {
|
|
1763
|
+
if (cell.index === edges[0] && cell.index === edges[1]) parts.push("selected");
|
|
1764
|
+
else if (cell.index === edges[0]) parts.push("range start");
|
|
1765
|
+
else if (cell.index === edges[1]) parts.push("range end");
|
|
1766
|
+
else if (inSpan(cell.index)) parts.push("in range");
|
|
1767
|
+
} else if (isPicked(cell.index)) {
|
|
1768
|
+
parts.push("selected");
|
|
1769
|
+
}
|
|
1770
|
+
return parts.join(", ");
|
|
1771
|
+
}
|
|
1772
|
+
const noneBefore = lo != null && first <= lo;
|
|
1773
|
+
const noneAfter = hi != null && last >= hi;
|
|
1774
|
+
const calendar = /* @__PURE__ */ jsxs15("div", { className: cx5("ui-datepicker__body", asSheet && "is-sheet"), children: [
|
|
1775
|
+
picksRange && presets?.length ? /* @__PURE__ */ jsx19("div", { className: "ui-datepicker__presets", role: "group", "aria-label": "Period shortcuts", children: presets.map((preset) => {
|
|
1776
|
+
const within = allowed(preset);
|
|
1777
|
+
return /* @__PURE__ */ jsx19(
|
|
1778
|
+
"button",
|
|
1779
|
+
{
|
|
1780
|
+
type: "button",
|
|
1781
|
+
className: "ui-btn ui-btn--ghost ui-btn--xs ui-datepicker__preset",
|
|
1782
|
+
disabled: within == null,
|
|
1783
|
+
onClick: () => within && applyPreset(within),
|
|
1784
|
+
children: preset.label
|
|
1785
|
+
},
|
|
1786
|
+
preset.label
|
|
1787
|
+
);
|
|
1788
|
+
}) }) : null,
|
|
1789
|
+
/* @__PURE__ */ jsxs15("div", { className: "ui-datepicker__calendar", children: [
|
|
1790
|
+
/* @__PURE__ */ jsxs15("div", { className: "ui-datepicker__head", children: [
|
|
1791
|
+
/* @__PURE__ */ jsx19(
|
|
1792
|
+
"button",
|
|
1793
|
+
{
|
|
1794
|
+
type: "button",
|
|
1795
|
+
className: "ui-btn ui-btn--ghost ui-btn--xs ui-btn--icon ui-datepicker__step",
|
|
1796
|
+
"aria-label": stepBack,
|
|
1797
|
+
disabled: noneBefore,
|
|
1798
|
+
onClick: () => stepPage(-1),
|
|
1799
|
+
children: /* @__PURE__ */ jsx19(Icon, { name: "chevronLeft" })
|
|
1800
|
+
}
|
|
1801
|
+
),
|
|
1802
|
+
/* @__PURE__ */ jsx19("span", { className: "ui-datepicker__caption", "aria-live": "polite", children: caption }),
|
|
1803
|
+
/* @__PURE__ */ jsx19(
|
|
1804
|
+
"button",
|
|
1805
|
+
{
|
|
1806
|
+
type: "button",
|
|
1807
|
+
className: "ui-btn ui-btn--ghost ui-btn--xs ui-btn--icon ui-datepicker__step",
|
|
1808
|
+
"aria-label": stepOn,
|
|
1809
|
+
disabled: noneAfter,
|
|
1810
|
+
onClick: () => stepPage(1),
|
|
1811
|
+
children: /* @__PURE__ */ jsx19(Icon, { name: "chevronRight" })
|
|
1812
|
+
}
|
|
1813
|
+
)
|
|
1814
|
+
] }),
|
|
1815
|
+
/* @__PURE__ */ jsxs15(
|
|
1816
|
+
"div",
|
|
1817
|
+
{
|
|
1818
|
+
className: cx5("ui-datepicker__grid", grain === "day" && "is-days"),
|
|
1819
|
+
role: "grid",
|
|
1820
|
+
"aria-label": caption,
|
|
1821
|
+
ref: grid,
|
|
1822
|
+
onKeyDown: onGridKeyDown,
|
|
1823
|
+
children: [
|
|
1824
|
+
weekdays.length > 0 && /* @__PURE__ */ jsx19("div", { className: "ui-datepicker__row", role: "row", children: weekdays.map((weekday) => /* @__PURE__ */ jsx19(
|
|
1825
|
+
"span",
|
|
1826
|
+
{
|
|
1827
|
+
className: "ui-datepicker__weekday",
|
|
1828
|
+
role: "columnheader",
|
|
1829
|
+
"aria-label": weekday.long,
|
|
1830
|
+
children: weekday.short
|
|
1831
|
+
},
|
|
1832
|
+
weekday.long
|
|
1833
|
+
)) }),
|
|
1834
|
+
rows.map((cellsInRow, r) => /* @__PURE__ */ jsx19("div", { className: "ui-datepicker__row", role: "row", children: cellsInRow.map((cell, c) => cell ? /* @__PURE__ */ jsx19(
|
|
1835
|
+
"span",
|
|
1836
|
+
{
|
|
1837
|
+
className: "ui-datepicker__cell",
|
|
1838
|
+
role: "gridcell",
|
|
1839
|
+
"aria-selected": isPicked(cell.index),
|
|
1840
|
+
children: /* @__PURE__ */ jsx19(
|
|
1841
|
+
"button",
|
|
1842
|
+
{
|
|
1843
|
+
type: "button",
|
|
1844
|
+
"data-dp-cell": "",
|
|
1845
|
+
"data-value": cell.period,
|
|
1846
|
+
className: cx5(
|
|
1847
|
+
"ui-datepicker__opt",
|
|
1848
|
+
"ui-focusable",
|
|
1849
|
+
isPicked(cell.index) && "is-selected",
|
|
1850
|
+
showsSpan(cell) && "is-inside",
|
|
1851
|
+
cell.index === todayIndex && "is-today",
|
|
1852
|
+
cell.disabled && "is-disabled"
|
|
1853
|
+
),
|
|
1854
|
+
tabIndex: cell.index === cursor ? 0 : -1,
|
|
1855
|
+
"aria-disabled": cell.disabled || void 0,
|
|
1856
|
+
"aria-label": state(cell),
|
|
1857
|
+
onClick: () => pick(cell),
|
|
1858
|
+
onFocus: () => setCursor(cell.index),
|
|
1859
|
+
children: /* @__PURE__ */ jsx19("span", { className: "ui-datepicker__num", children: cell.label })
|
|
1860
|
+
}
|
|
1861
|
+
)
|
|
1862
|
+
},
|
|
1863
|
+
cell.period
|
|
1864
|
+
) : /* @__PURE__ */ jsx19("span", { className: "ui-datepicker__cell is-empty", role: "gridcell" }, `e${r}-${c}`)) }, `r${r}`))
|
|
1865
|
+
]
|
|
1866
|
+
}
|
|
1867
|
+
)
|
|
1868
|
+
] })
|
|
1869
|
+
] });
|
|
1870
|
+
return (
|
|
1871
|
+
// `open` on the root whichever form the panel takes, so the trigger's
|
|
1872
|
+
// chevron flips for the sheet as it does for the popover. The panel rules
|
|
1873
|
+
// it also switches on have no panel to find while the sheet is up.
|
|
1874
|
+
/* @__PURE__ */ jsxs15("div", { className: cx5("ui-dropdown", "ui-datepicker", open && "open"), id, ref: root, children: [
|
|
1875
|
+
/* @__PURE__ */ jsxs15(
|
|
1876
|
+
"button",
|
|
1877
|
+
{
|
|
1878
|
+
type: "button",
|
|
1879
|
+
className: "ui-dropdown__trigger ui-datepicker__trigger",
|
|
1880
|
+
"aria-haspopup": "dialog",
|
|
1881
|
+
"aria-expanded": open,
|
|
1882
|
+
"aria-label": ariaLabel || (shown ? void 0 : name),
|
|
1883
|
+
disabled,
|
|
1884
|
+
ref: trigger,
|
|
1885
|
+
onClick: (e) => {
|
|
1886
|
+
e.stopPropagation();
|
|
1887
|
+
setOpen(!open);
|
|
1888
|
+
},
|
|
1889
|
+
children: [
|
|
1890
|
+
/* @__PURE__ */ jsx19("span", { className: "ui-dropdown__value", children: shown ?? empty }),
|
|
1891
|
+
/* @__PURE__ */ jsx19("span", { className: "ui-dropdown__chevron", "aria-hidden": "true" })
|
|
1892
|
+
]
|
|
1893
|
+
}
|
|
1894
|
+
),
|
|
1895
|
+
asSheet ? (
|
|
1896
|
+
// A sheet is the kit's drawer, not a wide popover: the scrim, the close
|
|
1897
|
+
// control, the focus trap, the inert page behind it and the restored
|
|
1898
|
+
// focus all come from <Drawer>, because changing the FORM of the panel
|
|
1899
|
+
// without taking the sheet's affordances left a phone reader with no
|
|
1900
|
+
// visible way out and a Tab that walked into the live page behind it.
|
|
1901
|
+
// why: guidelines/drawer.md
|
|
1902
|
+
/* @__PURE__ */ jsx19(Drawer, { open, side: "bottom", size: "md", title: name, onClose: () => setOpen(false), children: calendar })
|
|
1903
|
+
) : /* @__PURE__ */ jsx19(
|
|
1904
|
+
"div",
|
|
1905
|
+
{
|
|
1906
|
+
className: cx5("ui-dropdown__panel", "ui-datepicker__panel", align === "end" && "is-end"),
|
|
1907
|
+
role: "dialog",
|
|
1908
|
+
"aria-label": name,
|
|
1909
|
+
inert: !open,
|
|
1910
|
+
onClick: (e) => e.stopPropagation(),
|
|
1911
|
+
children: calendar
|
|
1912
|
+
}
|
|
1913
|
+
)
|
|
1914
|
+
] })
|
|
1915
|
+
);
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
// src/Dropdown.tsx
|
|
1919
|
+
import {
|
|
1920
|
+
Fragment as Fragment4,
|
|
1921
|
+
useCallback as useCallback3,
|
|
1922
|
+
useEffect as useEffect7,
|
|
1923
|
+
useId as useId8,
|
|
1924
|
+
useRef as useRef11,
|
|
1925
|
+
useState as useState7
|
|
1926
|
+
} from "react";
|
|
1927
|
+
import { icon as icon3, dropdownMatch, dropdownFiltering } from "@apliteni/apliteni-ui";
|
|
1928
|
+
import { Fragment as Fragment5, jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1929
|
+
var cx6 = (...a) => a.filter(Boolean).join(" ");
|
|
1460
1930
|
var isRow = (it) => Boolean(it) && it !== "---" && !it.separator;
|
|
1461
|
-
var Glyph2 = ({ name, className, hidden }) => /* @__PURE__ */
|
|
1931
|
+
var Glyph2 = ({ name, className, hidden }) => /* @__PURE__ */ jsx20(
|
|
1462
1932
|
"span",
|
|
1463
1933
|
{
|
|
1464
1934
|
className,
|
|
@@ -1471,7 +1941,7 @@ function RowBadge({ badge }) {
|
|
|
1471
1941
|
const given = typeof badge === "string" ? "" : badge.tone || "";
|
|
1472
1942
|
let tone = given || (/^live$/i.test(String(text2)) ? "live" : "neutral");
|
|
1473
1943
|
if (!given && tone === "neutral" && /^(?:off|unset|disabled|archive|archived)$/i.test(text2)) tone = "state";
|
|
1474
|
-
return /* @__PURE__ */
|
|
1944
|
+
return /* @__PURE__ */ jsx20("span", { className: `ui-dropdown__badge is-${tone}`, children: text2 });
|
|
1475
1945
|
}
|
|
1476
1946
|
var keyOf = (it) => it.value != null ? `v:${it.value}` : `l:${it.label}`;
|
|
1477
1947
|
var itemsIn = (panel) => Array.from(panel?.querySelectorAll("[data-dd-item]") ?? []).filter((el) => el.getAttribute("aria-disabled") !== "true" && !el.hidden);
|
|
@@ -1507,24 +1977,24 @@ function Dropdown({
|
|
|
1507
1977
|
onSelect,
|
|
1508
1978
|
row
|
|
1509
1979
|
}) {
|
|
1510
|
-
const [selfOpen, setSelfOpen] =
|
|
1980
|
+
const [selfOpen, setSelfOpen] = useState7(defaultOpen);
|
|
1511
1981
|
const open = openProp ?? selfOpen;
|
|
1512
|
-
const [pick, setPick] =
|
|
1513
|
-
const [query, setQuery] =
|
|
1514
|
-
const [activeKey, setActiveKey] =
|
|
1515
|
-
const root =
|
|
1516
|
-
const panel =
|
|
1517
|
-
const trigger =
|
|
1518
|
-
const field =
|
|
1519
|
-
const landOn =
|
|
1520
|
-
const at =
|
|
1982
|
+
const [pick, setPick] = useState7(null);
|
|
1983
|
+
const [query, setQuery] = useState7(() => search && search !== true ? search.query || "" : "");
|
|
1984
|
+
const [activeKey, setActiveKey] = useState7(null);
|
|
1985
|
+
const root = useRef11(null);
|
|
1986
|
+
const panel = useRef11(null);
|
|
1987
|
+
const trigger = useRef11(null);
|
|
1988
|
+
const field = useRef11(null);
|
|
1989
|
+
const landOn = useRef11(null);
|
|
1990
|
+
const at = useRef11("");
|
|
1521
1991
|
const auto = useId8().replace(/:/g, "");
|
|
1522
1992
|
const uid = id ?? auto;
|
|
1523
|
-
const setOpen =
|
|
1993
|
+
const setOpen = useCallback3((next) => {
|
|
1524
1994
|
if (openProp === void 0) setSelfOpen(next);
|
|
1525
1995
|
onOpenChange?.(next);
|
|
1526
1996
|
}, [openProp, onOpenChange]);
|
|
1527
|
-
const close =
|
|
1997
|
+
const close = useRef11(setOpen);
|
|
1528
1998
|
useIsoLayoutEffect(() => {
|
|
1529
1999
|
close.current = setOpen;
|
|
1530
2000
|
});
|
|
@@ -1538,7 +2008,7 @@ function Dropdown({
|
|
|
1538
2008
|
const given = rows.find((it) => it.selected);
|
|
1539
2009
|
const givenKey = given ? keyOf(given) : null;
|
|
1540
2010
|
const pickedKey = pick && pick.against === givenKey ? pick.key : null;
|
|
1541
|
-
|
|
2011
|
+
useEffect7(() => {
|
|
1542
2012
|
if (pick && pick.against !== givenKey) setPick(null);
|
|
1543
2013
|
}, [givenKey, pick]);
|
|
1544
2014
|
const picked = pickedKey != null ? rows.find((it) => keyOf(it) === pickedKey) : void 0;
|
|
@@ -1552,7 +2022,7 @@ function Dropdown({
|
|
|
1552
2022
|
const rowIds = /* @__PURE__ */ new Map();
|
|
1553
2023
|
rows.forEach((it, i) => rowIds.set(it, `${uid}-opt-${i}`));
|
|
1554
2024
|
const listId = `${uid}-list`;
|
|
1555
|
-
|
|
2025
|
+
useEffect7(() => {
|
|
1556
2026
|
if (!open) return;
|
|
1557
2027
|
const mine = () => close.current(false);
|
|
1558
2028
|
for (const other of [...openNow]) other();
|
|
@@ -1561,7 +2031,7 @@ function Dropdown({
|
|
|
1561
2031
|
openNow.delete(mine);
|
|
1562
2032
|
};
|
|
1563
2033
|
}, [open]);
|
|
1564
|
-
|
|
2034
|
+
useEffect7(() => {
|
|
1565
2035
|
if (!open) return;
|
|
1566
2036
|
const doc = root.current?.ownerDocument ?? document;
|
|
1567
2037
|
const onClick = (e) => {
|
|
@@ -1686,13 +2156,13 @@ function Dropdown({
|
|
|
1686
2156
|
};
|
|
1687
2157
|
function renderRow(entry, key) {
|
|
1688
2158
|
if (!isRow(entry)) {
|
|
1689
|
-
return /* @__PURE__ */
|
|
2159
|
+
return /* @__PURE__ */ jsx20("div", { className: "ui-dropdown__sep", role: "separator", hidden: filtering || void 0 }, key);
|
|
1690
2160
|
}
|
|
1691
2161
|
const disabled = !!entry.disabled;
|
|
1692
2162
|
const selected = selectedOf(entry);
|
|
1693
2163
|
const asLink = !!entry.href && !disabled && !asOption;
|
|
1694
2164
|
const props = {
|
|
1695
|
-
className:
|
|
2165
|
+
className: cx6(
|
|
1696
2166
|
"ui-dropdown__item",
|
|
1697
2167
|
selected && "is-selected",
|
|
1698
2168
|
disabled && "is-disabled",
|
|
@@ -1708,23 +2178,23 @@ function Dropdown({
|
|
|
1708
2178
|
...asLink ? { href: entry.href, ...entry.target ? { target: entry.target } : null } : null,
|
|
1709
2179
|
...sx ? { id: rowIds.get(entry), hidden: hiddenBy(entry) || void 0 } : null,
|
|
1710
2180
|
onClick: (e) => choose(entry, e),
|
|
1711
|
-
children: /* @__PURE__ */
|
|
1712
|
-
entry.icon && /* @__PURE__ */
|
|
1713
|
-
/* @__PURE__ */
|
|
1714
|
-
/* @__PURE__ */
|
|
1715
|
-
entry.description && /* @__PURE__ */
|
|
2181
|
+
children: /* @__PURE__ */ jsxs16(Fragment5, { children: [
|
|
2182
|
+
entry.icon && /* @__PURE__ */ jsx20(Glyph2, { name: entry.icon, className: "ui-dropdown__ic" }),
|
|
2183
|
+
/* @__PURE__ */ jsxs16("span", { className: "ui-dropdown__main", children: [
|
|
2184
|
+
/* @__PURE__ */ jsx20("span", { className: "ui-dropdown__label", children: entry.label }),
|
|
2185
|
+
entry.description && /* @__PURE__ */ jsx20("span", { className: "ui-dropdown__desc", children: entry.description })
|
|
1716
2186
|
] }),
|
|
1717
|
-
entry.badge ? /* @__PURE__ */
|
|
1718
|
-
asOption && /* @__PURE__ */
|
|
2187
|
+
entry.badge ? /* @__PURE__ */ jsx20(RowBadge, { badge: entry.badge }) : null,
|
|
2188
|
+
asOption && /* @__PURE__ */ jsx20(Glyph2, { name: "check", className: "ui-dropdown__tick", hidden: true })
|
|
1719
2189
|
] })
|
|
1720
2190
|
};
|
|
1721
|
-
if (row) return /* @__PURE__ */
|
|
2191
|
+
if (row) return /* @__PURE__ */ jsx20(Fragment4, { children: row(entry, props) }, key);
|
|
1722
2192
|
const Tag = asLink ? "a" : "div";
|
|
1723
|
-
return /* @__PURE__ */
|
|
2193
|
+
return /* @__PURE__ */ jsx20(Tag, { ...props }, key);
|
|
1724
2194
|
}
|
|
1725
2195
|
const body = sections?.length ? sections.map((section, si) => {
|
|
1726
2196
|
const gone = filtering && !(section.items || []).some((it) => isRow(it) && !hiddenBy(it));
|
|
1727
|
-
return /* @__PURE__ */
|
|
2197
|
+
return /* @__PURE__ */ jsxs16(
|
|
1728
2198
|
"div",
|
|
1729
2199
|
{
|
|
1730
2200
|
className: "ui-dropdown__section",
|
|
@@ -1732,7 +2202,7 @@ function Dropdown({
|
|
|
1732
2202
|
"aria-label": section.label || void 0,
|
|
1733
2203
|
hidden: gone || void 0,
|
|
1734
2204
|
children: [
|
|
1735
|
-
section.label && /* @__PURE__ */
|
|
2205
|
+
section.label && /* @__PURE__ */ jsx20("div", { className: "ui-dropdown__group", role: "presentation", children: section.label }),
|
|
1736
2206
|
(section.items || []).map((entry, i) => renderRow(entry, `s${si}-${i}`))
|
|
1737
2207
|
]
|
|
1738
2208
|
},
|
|
@@ -1740,16 +2210,16 @@ function Dropdown({
|
|
|
1740
2210
|
);
|
|
1741
2211
|
}) : (items || []).map((entry, i) => renderRow(entry, `i${i}`));
|
|
1742
2212
|
const cap = scroll && scroll !== true ? { maxHeight: typeof scroll === "number" ? `${scroll}px` : scroll } : void 0;
|
|
1743
|
-
const none = sx && filtering && !visible.length ? /* @__PURE__ */
|
|
1744
|
-
/* @__PURE__ */
|
|
1745
|
-
/* @__PURE__ */
|
|
2213
|
+
const none = sx && filtering && !visible.length ? /* @__PURE__ */ jsxs16(Fragment5, { children: [
|
|
2214
|
+
/* @__PURE__ */ jsx20("span", { className: "ui-dropdown__none-title", children: sx.empty.replace("{q}", () => query.trim()) }),
|
|
2215
|
+
/* @__PURE__ */ jsx20("span", { className: "ui-dropdown__none-hint", children: sx.hint })
|
|
1746
2216
|
] }) : null;
|
|
1747
|
-
return /* @__PURE__ */
|
|
1748
|
-
/* @__PURE__ */
|
|
2217
|
+
return /* @__PURE__ */ jsxs16("div", { className: cx6("ui-dropdown", open && "open"), id, ref: root, onKeyDown, children: [
|
|
2218
|
+
/* @__PURE__ */ jsxs16(
|
|
1749
2219
|
"button",
|
|
1750
2220
|
{
|
|
1751
2221
|
type: "button",
|
|
1752
|
-
className:
|
|
2222
|
+
className: cx6("ui-dropdown__trigger", triggerClass),
|
|
1753
2223
|
"data-dropdown-trigger": "",
|
|
1754
2224
|
"aria-haspopup": sx ? "dialog" : listRole,
|
|
1755
2225
|
"aria-expanded": open,
|
|
@@ -1760,18 +2230,18 @@ function Dropdown({
|
|
|
1760
2230
|
setOpen(!open);
|
|
1761
2231
|
},
|
|
1762
2232
|
children: [
|
|
1763
|
-
triggerContent != null ? triggerContent : /* @__PURE__ */
|
|
1764
|
-
label && /* @__PURE__ */
|
|
1765
|
-
/* @__PURE__ */
|
|
2233
|
+
triggerContent != null ? triggerContent : /* @__PURE__ */ jsxs16(Fragment5, { children: [
|
|
2234
|
+
label && /* @__PURE__ */ jsx20("span", { className: "ui-dropdown__pre", children: label }),
|
|
2235
|
+
/* @__PURE__ */ jsx20("span", { className: "ui-dropdown__value", children: shown != null ? shown : placeholder })
|
|
1766
2236
|
] }),
|
|
1767
|
-
chevron && /* @__PURE__ */
|
|
2237
|
+
chevron && /* @__PURE__ */ jsx20("span", { className: "ui-dropdown__chevron", "aria-hidden": "true" })
|
|
1768
2238
|
]
|
|
1769
2239
|
}
|
|
1770
2240
|
),
|
|
1771
|
-
/* @__PURE__ */
|
|
2241
|
+
/* @__PURE__ */ jsxs16(
|
|
1772
2242
|
"div",
|
|
1773
2243
|
{
|
|
1774
|
-
className:
|
|
2244
|
+
className: cx6(
|
|
1775
2245
|
"ui-dropdown__panel",
|
|
1776
2246
|
align === "end" && "is-end",
|
|
1777
2247
|
direction === "up" && "is-up",
|
|
@@ -1788,10 +2258,10 @@ function Dropdown({
|
|
|
1788
2258
|
onMouseMove,
|
|
1789
2259
|
children: [
|
|
1790
2260
|
header,
|
|
1791
|
-
sx ? /* @__PURE__ */
|
|
1792
|
-
/* @__PURE__ */
|
|
1793
|
-
/* @__PURE__ */
|
|
1794
|
-
/* @__PURE__ */
|
|
2261
|
+
sx ? /* @__PURE__ */ jsxs16(Fragment5, { children: [
|
|
2262
|
+
/* @__PURE__ */ jsxs16("div", { className: "ui-dropdown__search", children: [
|
|
2263
|
+
/* @__PURE__ */ jsx20(Glyph2, { name: "search", className: "ui-dropdown__search-ic", hidden: true }),
|
|
2264
|
+
/* @__PURE__ */ jsx20(
|
|
1795
2265
|
"input",
|
|
1796
2266
|
{
|
|
1797
2267
|
className: "ui-dropdown__search-input",
|
|
@@ -1815,8 +2285,8 @@ function Dropdown({
|
|
|
1815
2285
|
}
|
|
1816
2286
|
)
|
|
1817
2287
|
] }),
|
|
1818
|
-
/* @__PURE__ */
|
|
1819
|
-
/* @__PURE__ */
|
|
2288
|
+
/* @__PURE__ */ jsx20("div", { className: "ui-dropdown__list", role: "listbox", id: listId, "aria-label": name, style: cap, children: body }),
|
|
2289
|
+
/* @__PURE__ */ jsx20(
|
|
1820
2290
|
"div",
|
|
1821
2291
|
{
|
|
1822
2292
|
className: "ui-dropdown__none",
|
|
@@ -1841,7 +2311,7 @@ function strip(o) {
|
|
|
1841
2311
|
}
|
|
1842
2312
|
|
|
1843
2313
|
// src/BackLink.tsx
|
|
1844
|
-
import { jsx as
|
|
2314
|
+
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1845
2315
|
var BARE = "Back";
|
|
1846
2316
|
var SCRIPTED = /^javascript:/i;
|
|
1847
2317
|
var LEADING = /^[\u0000-\u0020]+/;
|
|
@@ -1860,7 +2330,7 @@ function BackLink({
|
|
|
1860
2330
|
const name = text(label).replace(SAID, "");
|
|
1861
2331
|
const bare = !name || name.toLowerCase() === BARE.toLowerCase();
|
|
1862
2332
|
const Tag = as ?? "a";
|
|
1863
|
-
return /* @__PURE__ */
|
|
2333
|
+
return /* @__PURE__ */ jsxs17(
|
|
1864
2334
|
Tag,
|
|
1865
2335
|
{
|
|
1866
2336
|
className: ["ui-back", className].filter(Boolean).join(" "),
|
|
@@ -1868,8 +2338,8 @@ function BackLink({
|
|
|
1868
2338
|
"aria-label": bare ? void 0 : `${BARE} to ${name}`,
|
|
1869
2339
|
...rest,
|
|
1870
2340
|
children: [
|
|
1871
|
-
/* @__PURE__ */
|
|
1872
|
-
/* @__PURE__ */
|
|
2341
|
+
/* @__PURE__ */ jsx21(Icon, { name: "chevronLeft" }),
|
|
2342
|
+
/* @__PURE__ */ jsx21("span", { className: "ui-back__label", children: bare ? BARE : name })
|
|
1873
2343
|
]
|
|
1874
2344
|
}
|
|
1875
2345
|
);
|
|
@@ -1877,41 +2347,41 @@ function BackLink({
|
|
|
1877
2347
|
|
|
1878
2348
|
// src/TableValues.tsx
|
|
1879
2349
|
import { formatNumericValue, formatDeltaValue } from "@apliteni/apliteni-ui";
|
|
1880
|
-
import { jsx as
|
|
2350
|
+
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1881
2351
|
function NumericValue(props) {
|
|
1882
2352
|
const value = formatNumericValue(props);
|
|
1883
|
-
return /* @__PURE__ */
|
|
2353
|
+
return /* @__PURE__ */ jsx22("span", { children: /* @__PURE__ */ jsxs18("span", { className: "ui-value", "aria-label": value.missing, children: [
|
|
1884
2354
|
value.text,
|
|
1885
|
-
value.unit && /* @__PURE__ */
|
|
2355
|
+
value.unit && /* @__PURE__ */ jsx22("span", { className: "ui-value__unit", children: value.unit })
|
|
1886
2356
|
] }) });
|
|
1887
2357
|
}
|
|
1888
2358
|
function DeltaValue(props) {
|
|
1889
2359
|
const value = formatDeltaValue(props);
|
|
1890
|
-
return /* @__PURE__ */
|
|
2360
|
+
return /* @__PURE__ */ jsx22("span", { children: /* @__PURE__ */ jsx22("span", { className: value.className, "aria-describedby": value.basisId || void 0, children: value.text }) });
|
|
1891
2361
|
}
|
|
1892
2362
|
function RowIdentity({ symbol, name, logo, href }) {
|
|
1893
2363
|
const Tag = href ? "a" : "span";
|
|
1894
|
-
return /* @__PURE__ */
|
|
1895
|
-
/* @__PURE__ */
|
|
1896
|
-
/* @__PURE__ */
|
|
1897
|
-
logo && /* @__PURE__ */
|
|
2364
|
+
return /* @__PURE__ */ jsxs18(Tag, { className: "ui-identity", href, children: [
|
|
2365
|
+
/* @__PURE__ */ jsxs18("span", { className: "ui-identity__logo", "aria-hidden": "true", children: [
|
|
2366
|
+
/* @__PURE__ */ jsx22("span", { children: symbol.slice(0, 1) }),
|
|
2367
|
+
logo && /* @__PURE__ */ jsx22("img", { src: logo, alt: "", onLoad: (e) => {
|
|
1898
2368
|
e.currentTarget.hidden = false;
|
|
1899
2369
|
}, onError: (e) => {
|
|
1900
2370
|
e.currentTarget.hidden = true;
|
|
1901
2371
|
} })
|
|
1902
2372
|
] }),
|
|
1903
|
-
/* @__PURE__ */
|
|
1904
|
-
/* @__PURE__ */
|
|
2373
|
+
/* @__PURE__ */ jsx22("span", { className: "ui-identity__symbol", children: symbol }),
|
|
2374
|
+
/* @__PURE__ */ jsx22("span", { className: "ui-identity__name", children: name })
|
|
1905
2375
|
] });
|
|
1906
2376
|
}
|
|
1907
2377
|
|
|
1908
2378
|
// src/Segmented.tsx
|
|
1909
2379
|
import { segmentedNextIndex } from "@apliteni/apliteni-ui";
|
|
1910
|
-
import { jsx as
|
|
2380
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
1911
2381
|
function Segmented({ options, value, onChange, label, appearance = "pill", disabled = false }) {
|
|
1912
2382
|
const enabled = options.filter((o) => !o.disabled);
|
|
1913
2383
|
const tabValue = enabled.some((o) => o.value === value) ? value : enabled[0]?.value;
|
|
1914
|
-
return /* @__PURE__ */
|
|
2384
|
+
return /* @__PURE__ */ jsx23("div", { className: `ui-seg${appearance === "underline" ? " ui-seg--underline" : ""}`, role: "toolbar", "aria-label": label, children: options.map((option) => /* @__PURE__ */ jsx23(
|
|
1915
2385
|
"button",
|
|
1916
2386
|
{
|
|
1917
2387
|
type: "button",
|
|
@@ -1937,13 +2407,13 @@ function Segmented({ options, value, onChange, label, appearance = "pill", disab
|
|
|
1937
2407
|
}
|
|
1938
2408
|
|
|
1939
2409
|
// src/FilterBar.tsx
|
|
1940
|
-
import { useRef as
|
|
2410
|
+
import { useRef as useRef12, useState as useState8 } from "react";
|
|
1941
2411
|
import { filterChipText, filterChipName, filterChipUnset } from "@apliteni/apliteni-ui";
|
|
1942
|
-
import { jsx as
|
|
2412
|
+
import { jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1943
2413
|
function FilterBar({ filters, label = "Filters", clearLabel = "Clear all filters", disabled = false, busy = false, onRemove, onClear, onChange }) {
|
|
1944
|
-
const bar =
|
|
1945
|
-
const focused =
|
|
1946
|
-
const [opened, setOpened] =
|
|
2414
|
+
const bar = useRef12(null);
|
|
2415
|
+
const focused = useRef12(null);
|
|
2416
|
+
const [opened, setOpened] = useState8({});
|
|
1947
2417
|
const blocked = disabled || busy;
|
|
1948
2418
|
useIsoLayoutEffect(() => {
|
|
1949
2419
|
const stale = Object.keys(opened).filter((id) => !filters.some((filter) => filter.id === id && filter.open === opened[id].against));
|
|
@@ -1956,7 +2426,7 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all filters
|
|
|
1956
2426
|
focused.current = null;
|
|
1957
2427
|
(target || bar.current)?.focus();
|
|
1958
2428
|
});
|
|
1959
|
-
return /* @__PURE__ */
|
|
2429
|
+
return /* @__PURE__ */ jsx24("div", { children: /* @__PURE__ */ jsxs19(
|
|
1960
2430
|
"fieldset",
|
|
1961
2431
|
{
|
|
1962
2432
|
ref: bar,
|
|
@@ -1969,8 +2439,8 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all filters
|
|
|
1969
2439
|
if (event.relatedTarget && !event.currentTarget.contains(event.relatedTarget)) focused.current = null;
|
|
1970
2440
|
},
|
|
1971
2441
|
children: [
|
|
1972
|
-
/* @__PURE__ */
|
|
1973
|
-
filters.map((filter, index) => /* @__PURE__ */
|
|
2442
|
+
/* @__PURE__ */ jsx24("legend", { className: "ui-filter-bar__legend", children: label }),
|
|
2443
|
+
filters.map((filter, index) => /* @__PURE__ */ jsxs19(
|
|
1974
2444
|
"fieldset",
|
|
1975
2445
|
{
|
|
1976
2446
|
className: "ui-filter-bar__chip",
|
|
@@ -1980,14 +2450,14 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all filters
|
|
|
1980
2450
|
focused.current = { id: filter.id, index };
|
|
1981
2451
|
},
|
|
1982
2452
|
children: [
|
|
1983
|
-
/* @__PURE__ */
|
|
1984
|
-
/* @__PURE__ */
|
|
2453
|
+
/* @__PURE__ */ jsx24("legend", { className: "ui-filter-bar__legend", children: filter.label }),
|
|
2454
|
+
/* @__PURE__ */ jsx24(
|
|
1985
2455
|
Dropdown,
|
|
1986
2456
|
{
|
|
1987
2457
|
items: filter.items,
|
|
1988
2458
|
variant: "select",
|
|
1989
2459
|
ariaLabel: filterChipName(filter),
|
|
1990
|
-
triggerContent: /* @__PURE__ */
|
|
2460
|
+
triggerContent: /* @__PURE__ */ jsx24("span", { className: filterChipUnset(filter) ? "ui-dropdown__value is-placeholder" : "ui-dropdown__value", children: filterChipText(filter) }),
|
|
1991
2461
|
open: !blocked && !filter.disabled && (opened[filter.id] && opened[filter.id].against === filter.open ? opened[filter.id].open : !!filter.open),
|
|
1992
2462
|
onOpenChange: (open) => setOpened((previous) => ({ ...previous, [filter.id]: { open, against: filter.open } })),
|
|
1993
2463
|
onSelect: (value) => {
|
|
@@ -1995,7 +2465,7 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all filters
|
|
|
1995
2465
|
}
|
|
1996
2466
|
}
|
|
1997
2467
|
),
|
|
1998
|
-
/* @__PURE__ */
|
|
2468
|
+
/* @__PURE__ */ jsx24(
|
|
1999
2469
|
"button",
|
|
2000
2470
|
{
|
|
2001
2471
|
type: "button",
|
|
@@ -2012,9 +2482,9 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all filters
|
|
|
2012
2482
|
},
|
|
2013
2483
|
filter.id
|
|
2014
2484
|
)),
|
|
2015
|
-
/* @__PURE__ */
|
|
2485
|
+
/* @__PURE__ */ jsx24("span", { "data-filter-clear": "", onFocus: () => {
|
|
2016
2486
|
focused.current = { id: null, index: 0 };
|
|
2017
|
-
}, children: /* @__PURE__ */
|
|
2487
|
+
}, children: /* @__PURE__ */ jsx24(Button, { size: "sm", variant: "ghost", disabled: !filters.length, onClick: () => {
|
|
2018
2488
|
if (!blocked) onClear();
|
|
2019
2489
|
}, children: clearLabel }) })
|
|
2020
2490
|
]
|
|
@@ -2023,37 +2493,37 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all filters
|
|
|
2023
2493
|
}
|
|
2024
2494
|
|
|
2025
2495
|
// src/KeyValueList.tsx
|
|
2026
|
-
import { jsx as
|
|
2496
|
+
import { jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2027
2497
|
function detail({ value, redacted }) {
|
|
2028
|
-
if (redacted) return /* @__PURE__ */
|
|
2029
|
-
/* @__PURE__ */
|
|
2498
|
+
if (redacted) return /* @__PURE__ */ jsxs20("span", { className: "ui-kv__hidden", children: [
|
|
2499
|
+
/* @__PURE__ */ jsx25(Icon, { name: "eyeOff" }),
|
|
2030
2500
|
"Hidden"
|
|
2031
2501
|
] });
|
|
2032
2502
|
if (value == null) return "\u2014";
|
|
2033
2503
|
return typeof value === "boolean" ? String(value) : value;
|
|
2034
2504
|
}
|
|
2035
2505
|
function KeyValueList({ rows, columns = 1, className, ...rest }) {
|
|
2036
|
-
return /* @__PURE__ */
|
|
2037
|
-
/* @__PURE__ */
|
|
2038
|
-
/* @__PURE__ */
|
|
2506
|
+
return /* @__PURE__ */ jsx25("dl", { ...rest, className: ["ui-kv", columns === 2 && "ui-kv--two-columns", className].filter(Boolean).join(" "), children: rows.map((row, index) => /* @__PURE__ */ jsxs20("div", { className: "ui-drawer__row", children: [
|
|
2507
|
+
/* @__PURE__ */ jsx25("dt", { children: row.label }),
|
|
2508
|
+
/* @__PURE__ */ jsx25("dd", { children: detail(row) })
|
|
2039
2509
|
] }, index)) });
|
|
2040
2510
|
}
|
|
2041
2511
|
function DrawerSection({ title, headingLevel = 3, className, children, ...rest }) {
|
|
2042
2512
|
const Heading = `h${headingLevel}`;
|
|
2043
|
-
return /* @__PURE__ */
|
|
2044
|
-
title != null && /* @__PURE__ */
|
|
2513
|
+
return /* @__PURE__ */ jsxs20("section", { ...rest, className: ["ui-drawer__section", className].filter(Boolean).join(" "), children: [
|
|
2514
|
+
title != null && /* @__PURE__ */ jsx25(Heading, { className: "ui-drawer__section-title", children: title }),
|
|
2045
2515
|
children
|
|
2046
2516
|
] });
|
|
2047
2517
|
}
|
|
2048
2518
|
|
|
2049
2519
|
// src/Snippet.tsx
|
|
2050
|
-
import { useEffect as
|
|
2051
|
-
import { Fragment as Fragment6, jsx as
|
|
2520
|
+
import { useEffect as useEffect8, useRef as useRef13, useState as useState9 } from "react";
|
|
2521
|
+
import { Fragment as Fragment6, jsx as jsx26, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2052
2522
|
function Snippet({ label = "shell", code = "", children, copy = true, reveal = false, copyLabel = "Copy code" }) {
|
|
2053
|
-
const [status, setStatus] =
|
|
2054
|
-
const request =
|
|
2055
|
-
const timer =
|
|
2056
|
-
|
|
2523
|
+
const [status, setStatus] = useState9("idle");
|
|
2524
|
+
const request = useRef13(0);
|
|
2525
|
+
const timer = useRef13(void 0);
|
|
2526
|
+
useEffect8(() => {
|
|
2057
2527
|
setStatus("idle");
|
|
2058
2528
|
return () => {
|
|
2059
2529
|
request.current++;
|
|
@@ -2073,11 +2543,11 @@ function Snippet({ label = "shell", code = "", children, copy = true, reveal = f
|
|
|
2073
2543
|
if (current === request.current) setStatus("failed");
|
|
2074
2544
|
}
|
|
2075
2545
|
}
|
|
2076
|
-
return /* @__PURE__ */
|
|
2077
|
-
/* @__PURE__ */
|
|
2078
|
-
/* @__PURE__ */
|
|
2079
|
-
copy && /* @__PURE__ */
|
|
2080
|
-
/* @__PURE__ */
|
|
2546
|
+
return /* @__PURE__ */ jsxs21("div", { className: reveal ? "ui-snippet ui-snippet--reveal" : "ui-snippet", children: [
|
|
2547
|
+
/* @__PURE__ */ jsxs21("div", { className: "ui-snippet__bar", children: [
|
|
2548
|
+
/* @__PURE__ */ jsx26("span", { children: label }),
|
|
2549
|
+
copy && /* @__PURE__ */ jsxs21(Fragment6, { children: [
|
|
2550
|
+
/* @__PURE__ */ jsx26(
|
|
2081
2551
|
"button",
|
|
2082
2552
|
{
|
|
2083
2553
|
type: "button",
|
|
@@ -2085,31 +2555,31 @@ function Snippet({ label = "shell", code = "", children, copy = true, reveal = f
|
|
|
2085
2555
|
"aria-label": copyLabel,
|
|
2086
2556
|
title: copyLabel,
|
|
2087
2557
|
onClick: handleCopy,
|
|
2088
|
-
children: /* @__PURE__ */
|
|
2558
|
+
children: /* @__PURE__ */ jsx26(Icon, { name: status === "idle" ? "copy" : "check" })
|
|
2089
2559
|
}
|
|
2090
2560
|
),
|
|
2091
|
-
/* @__PURE__ */
|
|
2561
|
+
/* @__PURE__ */ jsx26("span", { className: "ui-sr ui-snippet__status", role: "status", "aria-live": "polite", children: status === "copied" ? "Copied" : status === "failed" ? "Copy failed" : "" })
|
|
2092
2562
|
] })
|
|
2093
2563
|
] }),
|
|
2094
|
-
/* @__PURE__ */
|
|
2564
|
+
/* @__PURE__ */ jsx26("pre", { children: children ?? code })
|
|
2095
2565
|
] });
|
|
2096
2566
|
}
|
|
2097
2567
|
|
|
2098
2568
|
// src/Tabs.tsx
|
|
2099
|
-
import { useEffect as
|
|
2569
|
+
import { useEffect as useEffect9, useId as useId9, useRef as useRef14 } from "react";
|
|
2100
2570
|
import { playEntrance } from "@apliteni/apliteni-ui/motion";
|
|
2101
|
-
import { Fragment as Fragment7, jsx as
|
|
2571
|
+
import { Fragment as Fragment7, jsx as jsx27, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2102
2572
|
function Tabs({ items, value, onChange, label }) {
|
|
2103
2573
|
const id = useId9();
|
|
2104
|
-
const previous =
|
|
2105
|
-
const activePanel =
|
|
2106
|
-
const buttons =
|
|
2107
|
-
|
|
2574
|
+
const previous = useRef14(value);
|
|
2575
|
+
const activePanel = useRef14(null);
|
|
2576
|
+
const buttons = useRef14([]);
|
|
2577
|
+
useEffect9(() => {
|
|
2108
2578
|
if (previous.current !== value) playEntrance(activePanel.current);
|
|
2109
2579
|
previous.current = value;
|
|
2110
2580
|
}, [value]);
|
|
2111
|
-
return /* @__PURE__ */
|
|
2112
|
-
/* @__PURE__ */
|
|
2581
|
+
return /* @__PURE__ */ jsxs22("div", { className: "ui-tabs", children: [
|
|
2582
|
+
/* @__PURE__ */ jsx27("div", { className: "ui-tabs__list", role: "tablist", "aria-label": label, children: items.map((item, i) => /* @__PURE__ */ jsxs22(
|
|
2113
2583
|
"button",
|
|
2114
2584
|
{
|
|
2115
2585
|
type: "button",
|
|
@@ -2147,7 +2617,7 @@ function Tabs({ items, value, onChange, label }) {
|
|
|
2147
2617
|
},
|
|
2148
2618
|
children: [
|
|
2149
2619
|
item.label,
|
|
2150
|
-
item.count != null && /* @__PURE__ */
|
|
2620
|
+
item.count != null && /* @__PURE__ */ jsxs22(Fragment7, { children: [
|
|
2151
2621
|
" ",
|
|
2152
2622
|
item.count
|
|
2153
2623
|
] })
|
|
@@ -2155,7 +2625,7 @@ function Tabs({ items, value, onChange, label }) {
|
|
|
2155
2625
|
},
|
|
2156
2626
|
item.value
|
|
2157
2627
|
)) }),
|
|
2158
|
-
/* @__PURE__ */
|
|
2628
|
+
/* @__PURE__ */ jsx27("div", { className: "ui-tabs__panels", children: items.map((item, i) => /* @__PURE__ */ jsx27(
|
|
2159
2629
|
"div",
|
|
2160
2630
|
{
|
|
2161
2631
|
className: "ui-tabs__panel",
|
|
@@ -2173,14 +2643,14 @@ function Tabs({ items, value, onChange, label }) {
|
|
|
2173
2643
|
}
|
|
2174
2644
|
|
|
2175
2645
|
// src/Timeline.tsx
|
|
2176
|
-
import { useEffect as
|
|
2646
|
+
import { useEffect as useEffect10, useRef as useRef15 } from "react";
|
|
2177
2647
|
import { playEntrance as playEntrance2, prefersReducedMotion } from "@apliteni/apliteni-ui/motion";
|
|
2178
|
-
import { jsx as
|
|
2648
|
+
import { jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2179
2649
|
var kindIcons = { person: "user", rule: "bolt", reversal: "refresh" };
|
|
2180
2650
|
function Timeline({ events, className, ...rest }) {
|
|
2181
|
-
const previousIds =
|
|
2182
|
-
const rows =
|
|
2183
|
-
|
|
2651
|
+
const previousIds = useRef15(new Set(events.map((event) => event.id)));
|
|
2652
|
+
const rows = useRef15(/* @__PURE__ */ new Map());
|
|
2653
|
+
useEffect10(() => {
|
|
2184
2654
|
if (previousIds.current.size > 0 && !prefersReducedMotion()) {
|
|
2185
2655
|
for (const event of events) {
|
|
2186
2656
|
if (previousIds.current.has(event.id)) continue;
|
|
@@ -2192,7 +2662,7 @@ function Timeline({ events, className, ...rest }) {
|
|
|
2192
2662
|
}
|
|
2193
2663
|
previousIds.current = new Set(events.map((event) => event.id));
|
|
2194
2664
|
}, [events]);
|
|
2195
|
-
return /* @__PURE__ */
|
|
2665
|
+
return /* @__PURE__ */ jsx28("ol", { ...rest, role: "list", className: ["ui-timeline", events.some((event) => event.kind) && "ui-timeline--kinds", className].filter(Boolean).join(" "), children: events.map((event, index) => /* @__PURE__ */ jsxs23(
|
|
2196
2666
|
"li",
|
|
2197
2667
|
{
|
|
2198
2668
|
className: "ui-timeline__event",
|
|
@@ -2201,20 +2671,20 @@ function Timeline({ events, className, ...rest }) {
|
|
|
2201
2671
|
else rows.current.delete(event.id);
|
|
2202
2672
|
},
|
|
2203
2673
|
children: [
|
|
2204
|
-
/* @__PURE__ */
|
|
2674
|
+
/* @__PURE__ */ jsx28("span", { "aria-hidden": "true", className: [
|
|
2205
2675
|
"ui-timeline__marker",
|
|
2206
2676
|
event.kind && "ui-timeline__marker--kind",
|
|
2207
2677
|
event.kind === "reversal" && "ui-timeline__marker--reversal"
|
|
2208
|
-
].filter(Boolean).join(" "), children: event.kind && /* @__PURE__ */
|
|
2209
|
-
/* @__PURE__ */
|
|
2210
|
-
/* @__PURE__ */
|
|
2211
|
-
/* @__PURE__ */
|
|
2212
|
-
index === events.length - 1 && event.relativeTimestamp && /* @__PURE__ */
|
|
2678
|
+
].filter(Boolean).join(" "), children: event.kind && /* @__PURE__ */ jsx28(Icon, { name: kindIcons[event.kind] }) }),
|
|
2679
|
+
/* @__PURE__ */ jsxs23("div", { className: "ui-timeline__head", children: [
|
|
2680
|
+
/* @__PURE__ */ jsx28("span", { className: "ui-timeline__actor", children: event.actor }),
|
|
2681
|
+
/* @__PURE__ */ jsx28("time", { dateTime: event.dateTime, children: event.timestamp }),
|
|
2682
|
+
index === events.length - 1 && event.relativeTimestamp && /* @__PURE__ */ jsx28("span", { className: "ui-timeline__relative", children: event.relativeTimestamp })
|
|
2213
2683
|
] }),
|
|
2214
|
-
/* @__PURE__ */
|
|
2215
|
-
(event.meta != null || event.undo) && /* @__PURE__ */
|
|
2216
|
-
event.meta != null && /* @__PURE__ */
|
|
2217
|
-
event.undo && /* @__PURE__ */
|
|
2684
|
+
/* @__PURE__ */ jsx28("p", { className: "ui-timeline__description", children: event.description }),
|
|
2685
|
+
(event.meta != null || event.undo) && /* @__PURE__ */ jsxs23("div", { className: "ui-timeline__meta", children: [
|
|
2686
|
+
event.meta != null && /* @__PURE__ */ jsx28("span", { children: event.meta }),
|
|
2687
|
+
event.undo && /* @__PURE__ */ jsx28(Button, { variant: "ghost", size: "xs", className: "ui-btn ui-btn--ghost ui-btn--xs ui-timeline__undo", "aria-label": event.undo.label, onClick: event.undo.onUndo, children: "Undo" })
|
|
2218
2688
|
] })
|
|
2219
2689
|
]
|
|
2220
2690
|
},
|
|
@@ -2223,20 +2693,20 @@ function Timeline({ events, className, ...rest }) {
|
|
|
2223
2693
|
}
|
|
2224
2694
|
|
|
2225
2695
|
// src/Field.tsx
|
|
2226
|
-
import { forwardRef as forwardRef6, useEffect as
|
|
2696
|
+
import { forwardRef as forwardRef6, useEffect as useEffect11, useId as useId10, useRef as useRef16, useState as useState10 } from "react";
|
|
2227
2697
|
import { esc, icon as icon4 } from "@apliteni/apliteni-ui";
|
|
2228
|
-
import { jsx as
|
|
2698
|
+
import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2229
2699
|
function messages(id, hint, error) {
|
|
2230
2700
|
return [error && `${id}-error`, hint && `${id}-hint`].filter(Boolean).join(" ") || void 0;
|
|
2231
2701
|
}
|
|
2232
2702
|
function Frame({ id, label, hint, error, required, children }) {
|
|
2233
|
-
return /* @__PURE__ */
|
|
2234
|
-
/* @__PURE__ */
|
|
2703
|
+
return /* @__PURE__ */ jsxs24("div", { className: "ui-field", children: [
|
|
2704
|
+
/* @__PURE__ */ jsxs24("label", { className: "ui-field__label", htmlFor: id, children: [
|
|
2235
2705
|
label,
|
|
2236
|
-
required && /* @__PURE__ */
|
|
2706
|
+
required && /* @__PURE__ */ jsx29("span", { className: "ui-field__req", "aria-hidden": "true", children: "*" })
|
|
2237
2707
|
] }),
|
|
2238
2708
|
children,
|
|
2239
|
-
error && /* @__PURE__ */
|
|
2709
|
+
error && /* @__PURE__ */ jsx29(
|
|
2240
2710
|
"div",
|
|
2241
2711
|
{
|
|
2242
2712
|
id: `${id}-error`,
|
|
@@ -2245,7 +2715,7 @@ function Frame({ id, label, hint, error, required, children }) {
|
|
|
2245
2715
|
dangerouslySetInnerHTML: { __html: icon4("alert") + esc(error) }
|
|
2246
2716
|
}
|
|
2247
2717
|
),
|
|
2248
|
-
hint && /* @__PURE__ */
|
|
2718
|
+
hint && /* @__PURE__ */ jsx29("div", { id: `${id}-hint`, className: "ui-field__hint", children: hint })
|
|
2249
2719
|
] });
|
|
2250
2720
|
}
|
|
2251
2721
|
function wiring(id, hint, error) {
|
|
@@ -2254,13 +2724,13 @@ function wiring(id, hint, error) {
|
|
|
2254
2724
|
function Field({ id: suppliedId, label, hint, error, required, children }) {
|
|
2255
2725
|
const generatedId = useId10();
|
|
2256
2726
|
const id = suppliedId ?? generatedId;
|
|
2257
|
-
return /* @__PURE__ */
|
|
2727
|
+
return /* @__PURE__ */ jsx29(Frame, { ...{ id, label, hint, error, required }, children: children({ ...wiring(id, hint, error), required }) });
|
|
2258
2728
|
}
|
|
2259
2729
|
var TextField = forwardRef6(function TextField2({ label, hint, error, required, type = "text", unit, icon: glyph, className = "", ...props }, ref) {
|
|
2260
2730
|
const id = useId10();
|
|
2261
2731
|
const hasUnit = type === "number" && !!unit;
|
|
2262
2732
|
const describedBy = [messages(id, hint, error), hasUnit ? `${id}-unit` : ""].filter(Boolean).join(" ") || void 0;
|
|
2263
|
-
const control = /* @__PURE__ */
|
|
2733
|
+
const control = /* @__PURE__ */ jsx29(
|
|
2264
2734
|
"input",
|
|
2265
2735
|
{
|
|
2266
2736
|
ref,
|
|
@@ -2273,19 +2743,19 @@ var TextField = forwardRef6(function TextField2({ label, hint, error, required,
|
|
|
2273
2743
|
className: `ui-input${error ? " is-invalid" : ""} ${className}`
|
|
2274
2744
|
}
|
|
2275
2745
|
);
|
|
2276
|
-
const unitSpan = hasUnit ? /* @__PURE__ */
|
|
2277
|
-
return /* @__PURE__ */
|
|
2278
|
-
/* @__PURE__ */
|
|
2746
|
+
const unitSpan = hasUnit ? /* @__PURE__ */ jsx29("span", { id: `${id}-unit`, className: "ui-field-number__unit", children: unit }) : null;
|
|
2747
|
+
return /* @__PURE__ */ jsx29(Frame, { ...{ id, label, hint, error, required }, children: glyph ? /* @__PURE__ */ jsxs24("div", { className: `ui-input-group${hasUnit ? " ui-field-number" : ""}`, children: [
|
|
2748
|
+
/* @__PURE__ */ jsx29("span", { className: "ui-input-group__icon", dangerouslySetInnerHTML: { __html: icon4(glyph) } }),
|
|
2279
2749
|
control,
|
|
2280
2750
|
unitSpan
|
|
2281
|
-
] }) : hasUnit ? /* @__PURE__ */
|
|
2751
|
+
] }) : hasUnit ? /* @__PURE__ */ jsxs24("div", { className: "ui-field-number", children: [
|
|
2282
2752
|
control,
|
|
2283
2753
|
unitSpan
|
|
2284
2754
|
] }) : control });
|
|
2285
2755
|
});
|
|
2286
2756
|
function TextArea({ label, hint, error, required, className = "", ...props }) {
|
|
2287
2757
|
const id = useId10();
|
|
2288
|
-
return /* @__PURE__ */
|
|
2758
|
+
return /* @__PURE__ */ jsx29(Frame, { ...{ id, label, hint, error, required }, children: /* @__PURE__ */ jsx29(
|
|
2289
2759
|
"textarea",
|
|
2290
2760
|
{
|
|
2291
2761
|
rows: 4,
|
|
@@ -2298,7 +2768,7 @@ function TextArea({ label, hint, error, required, className = "", ...props }) {
|
|
|
2298
2768
|
}
|
|
2299
2769
|
function SelectField({ label, hint, error, required, className = "", children, ...props }) {
|
|
2300
2770
|
const id = useId10();
|
|
2301
|
-
return /* @__PURE__ */
|
|
2771
|
+
return /* @__PURE__ */ jsx29(Frame, { ...{ id, label, hint, error, required }, children: /* @__PURE__ */ jsx29(
|
|
2302
2772
|
"select",
|
|
2303
2773
|
{
|
|
2304
2774
|
...props,
|
|
@@ -2311,10 +2781,10 @@ function SelectField({ label, hint, error, required, className = "", children, .
|
|
|
2311
2781
|
}
|
|
2312
2782
|
function FileField({ label, hint, error, required, disabled, onFileChange, className = "", ...props }) {
|
|
2313
2783
|
const id = useId10();
|
|
2314
|
-
const input =
|
|
2315
|
-
const [file, setFile] =
|
|
2316
|
-
const [dragging, setDragging] =
|
|
2317
|
-
|
|
2784
|
+
const input = useRef16(null);
|
|
2785
|
+
const [file, setFile] = useState10(null);
|
|
2786
|
+
const [dragging, setDragging] = useState10(false);
|
|
2787
|
+
useEffect11(() => {
|
|
2318
2788
|
const form = input.current?.form;
|
|
2319
2789
|
const reset = () => {
|
|
2320
2790
|
setFile(null);
|
|
@@ -2327,7 +2797,7 @@ function FileField({ label, hint, error, required, disabled, onFileChange, class
|
|
|
2327
2797
|
setFile(next);
|
|
2328
2798
|
onFileChange?.(next);
|
|
2329
2799
|
};
|
|
2330
|
-
return /* @__PURE__ */
|
|
2800
|
+
return /* @__PURE__ */ jsx29(Frame, { ...{ id, label, hint, error, required }, children: /* @__PURE__ */ jsxs24(
|
|
2331
2801
|
"div",
|
|
2332
2802
|
{
|
|
2333
2803
|
className: `ui-file${dragging && !disabled ? " is-dragging" : ""}${file ? " has-file" : ""}${error ? " is-invalid" : ""}${disabled ? " is-disabled" : ""}`,
|
|
@@ -2348,12 +2818,12 @@ function FileField({ label, hint, error, required, disabled, onFileChange, class
|
|
|
2348
2818
|
update(transfer.files[0]);
|
|
2349
2819
|
},
|
|
2350
2820
|
children: [
|
|
2351
|
-
/* @__PURE__ */
|
|
2352
|
-
/* @__PURE__ */
|
|
2353
|
-
/* @__PURE__ */
|
|
2354
|
-
/* @__PURE__ */
|
|
2355
|
-
/* @__PURE__ */
|
|
2356
|
-
/* @__PURE__ */
|
|
2821
|
+
/* @__PURE__ */ jsx29("span", { className: "ui-file__glyph", children: /* @__PURE__ */ jsx29(Icon, { name: "upload" }) }),
|
|
2822
|
+
/* @__PURE__ */ jsx29("div", { "aria-live": "polite", children: file ? file.name : "Drop a file here" }),
|
|
2823
|
+
/* @__PURE__ */ jsx29("div", { children: "or choose one from your device" }),
|
|
2824
|
+
/* @__PURE__ */ jsxs24("span", { className: "ui-file__choose", children: [
|
|
2825
|
+
/* @__PURE__ */ jsx29("span", { className: "ui-btn ui-btn--secondary ui-btn--sm", "aria-hidden": "true", "aria-disabled": disabled || void 0, children: file ? "Replace file" : "Choose file" }),
|
|
2826
|
+
/* @__PURE__ */ jsx29(
|
|
2357
2827
|
"input",
|
|
2358
2828
|
{
|
|
2359
2829
|
...props,
|
|
@@ -2373,8 +2843,8 @@ function FileField({ label, hint, error, required, disabled, onFileChange, class
|
|
|
2373
2843
|
}
|
|
2374
2844
|
|
|
2375
2845
|
// src/FileDrop.tsx
|
|
2376
|
-
import { useRef as
|
|
2377
|
-
import { Fragment as Fragment8, jsx as
|
|
2846
|
+
import { useRef as useRef17, useState as useState11 } from "react";
|
|
2847
|
+
import { Fragment as Fragment8, jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2378
2848
|
var MARKS = {
|
|
2379
2849
|
uploading: "clock",
|
|
2380
2850
|
done: "circleCheck",
|
|
@@ -2390,7 +2860,7 @@ var splitName = (name) => {
|
|
|
2390
2860
|
return cut > 0 ? [name.slice(0, cut), name.slice(cut)] : [name, ""];
|
|
2391
2861
|
};
|
|
2392
2862
|
var carriesFiles = (event) => Array.from(event.dataTransfer.types).includes("Files");
|
|
2393
|
-
var
|
|
2863
|
+
var cx7 = (...a) => a.filter(Boolean).join(" ");
|
|
2394
2864
|
function FileDrop({
|
|
2395
2865
|
label = "Upload",
|
|
2396
2866
|
note,
|
|
@@ -2407,8 +2877,8 @@ function FileDrop({
|
|
|
2407
2877
|
children,
|
|
2408
2878
|
className
|
|
2409
2879
|
}) {
|
|
2410
|
-
const input =
|
|
2411
|
-
const [over, setOver] =
|
|
2880
|
+
const input = useRef17(null);
|
|
2881
|
+
const [over, setOver] = useState11(false);
|
|
2412
2882
|
const status = file?.status ?? "uploading";
|
|
2413
2883
|
const word = status === "error" ? file?.error ?? WORDS.error : file?.state ?? WORDS[status];
|
|
2414
2884
|
const [stem, ext] = splitName(file?.name ?? "");
|
|
@@ -2419,10 +2889,10 @@ function FileDrop({
|
|
|
2419
2889
|
const take = (chosen) => {
|
|
2420
2890
|
if (chosen && !disabled) onFile?.(chosen);
|
|
2421
2891
|
};
|
|
2422
|
-
return /* @__PURE__ */
|
|
2892
|
+
return /* @__PURE__ */ jsxs25(
|
|
2423
2893
|
"div",
|
|
2424
2894
|
{
|
|
2425
|
-
className:
|
|
2895
|
+
className: cx7("ui-drop", disabled && "is-disabled", className),
|
|
2426
2896
|
onDragOver: (event) => {
|
|
2427
2897
|
if (disabled || !carriesFiles(event)) return;
|
|
2428
2898
|
event.preventDefault();
|
|
@@ -2439,16 +2909,16 @@ function FileDrop({
|
|
|
2439
2909
|
},
|
|
2440
2910
|
children: [
|
|
2441
2911
|
children,
|
|
2442
|
-
/* @__PURE__ */
|
|
2443
|
-
file ? /* @__PURE__ */
|
|
2444
|
-
/* @__PURE__ */
|
|
2445
|
-
/* @__PURE__ */
|
|
2446
|
-
/* @__PURE__ */
|
|
2447
|
-
/* @__PURE__ */
|
|
2912
|
+
/* @__PURE__ */ jsxs25("div", { className: "ui-drop__row", children: [
|
|
2913
|
+
file ? /* @__PURE__ */ jsxs25("div", { className: cx7("ui-drop__file", status === "error" && "ui-drop__file--failed"), children: [
|
|
2914
|
+
/* @__PURE__ */ jsxs25("div", { className: "ui-drop__line", children: [
|
|
2915
|
+
/* @__PURE__ */ jsxs25("span", { className: "ui-drop__name", title: file.name, children: [
|
|
2916
|
+
/* @__PURE__ */ jsx30("span", { className: "ui-drop__stem", children: stem }),
|
|
2917
|
+
/* @__PURE__ */ jsx30("span", { className: "ui-drop__ext", children: ext })
|
|
2448
2918
|
] }),
|
|
2449
|
-
(onRemove || status === "error" && onRetry) && /* @__PURE__ */
|
|
2450
|
-
status === "error" && onRetry && /* @__PURE__ */
|
|
2451
|
-
onRemove && /* @__PURE__ */
|
|
2919
|
+
(onRemove || status === "error" && onRetry) && /* @__PURE__ */ jsxs25("span", { className: "ui-drop__actions", children: [
|
|
2920
|
+
status === "error" && onRetry && /* @__PURE__ */ jsx30(Button, { size: "sm", icon: "refresh", onClick: onRetry, disabled, children: retryLabel }),
|
|
2921
|
+
onRemove && /* @__PURE__ */ jsx30(
|
|
2452
2922
|
Button,
|
|
2453
2923
|
{
|
|
2454
2924
|
variant: "ghost",
|
|
@@ -2462,21 +2932,21 @@ function FileDrop({
|
|
|
2462
2932
|
)
|
|
2463
2933
|
] })
|
|
2464
2934
|
] }),
|
|
2465
|
-
(showSize || showWord) && /* @__PURE__ */
|
|
2935
|
+
(showSize || showWord) && /* @__PURE__ */ jsxs25(
|
|
2466
2936
|
"div",
|
|
2467
2937
|
{
|
|
2468
|
-
className:
|
|
2938
|
+
className: cx7("ui-drop__facts", status === "error" && "ui-drop__error"),
|
|
2469
2939
|
role: status === "error" ? "alert" : void 0,
|
|
2470
2940
|
children: [
|
|
2471
|
-
showSize && /* @__PURE__ */
|
|
2472
|
-
showWord && /* @__PURE__ */
|
|
2473
|
-
/* @__PURE__ */
|
|
2474
|
-
/* @__PURE__ */
|
|
2941
|
+
showSize && /* @__PURE__ */ jsx30("span", { className: "ui-drop__size", children: file.size }),
|
|
2942
|
+
showWord && /* @__PURE__ */ jsxs25("span", { className: "ui-drop__state", children: [
|
|
2943
|
+
/* @__PURE__ */ jsx30(Icon, { name: MARKS[status] }),
|
|
2944
|
+
/* @__PURE__ */ jsx30("span", { className: "ui-drop__word", title: word, children: word })
|
|
2475
2945
|
] })
|
|
2476
2946
|
]
|
|
2477
2947
|
}
|
|
2478
2948
|
),
|
|
2479
|
-
hasBar && /* @__PURE__ */
|
|
2949
|
+
hasBar && /* @__PURE__ */ jsx30(
|
|
2480
2950
|
"span",
|
|
2481
2951
|
{
|
|
2482
2952
|
className: "ui-drop__bar",
|
|
@@ -2485,11 +2955,11 @@ function FileDrop({
|
|
|
2485
2955
|
"aria-valuenow": file.progress,
|
|
2486
2956
|
"aria-valuemin": 0,
|
|
2487
2957
|
"aria-valuemax": 100,
|
|
2488
|
-
children: /* @__PURE__ */
|
|
2958
|
+
children: /* @__PURE__ */ jsx30("span", { style: { width: `${file.progress}%` } })
|
|
2489
2959
|
}
|
|
2490
2960
|
)
|
|
2491
|
-
] }) : /* @__PURE__ */
|
|
2492
|
-
/* @__PURE__ */
|
|
2961
|
+
] }) : /* @__PURE__ */ jsxs25(Fragment8, { children: [
|
|
2962
|
+
/* @__PURE__ */ jsx30(
|
|
2493
2963
|
Button,
|
|
2494
2964
|
{
|
|
2495
2965
|
size: "sm",
|
|
@@ -2499,9 +2969,9 @@ function FileDrop({
|
|
|
2499
2969
|
children: label
|
|
2500
2970
|
}
|
|
2501
2971
|
),
|
|
2502
|
-
note && /* @__PURE__ */
|
|
2972
|
+
note && /* @__PURE__ */ jsx30("p", { className: "ui-drop__note", children: note })
|
|
2503
2973
|
] }),
|
|
2504
|
-
/* @__PURE__ */
|
|
2974
|
+
/* @__PURE__ */ jsx30(
|
|
2505
2975
|
"input",
|
|
2506
2976
|
{
|
|
2507
2977
|
ref: input,
|
|
@@ -2517,7 +2987,7 @@ function FileDrop({
|
|
|
2517
2987
|
}
|
|
2518
2988
|
)
|
|
2519
2989
|
] }),
|
|
2520
|
-
showTarget && /* @__PURE__ */
|
|
2990
|
+
showTarget && /* @__PURE__ */ jsx30("div", { className: "ui-drop__target", "aria-hidden": "true", children: dropLabel })
|
|
2521
2991
|
]
|
|
2522
2992
|
}
|
|
2523
2993
|
);
|
|
@@ -2526,11 +2996,11 @@ function FileDrop({
|
|
|
2526
2996
|
// src/SearchField.tsx
|
|
2527
2997
|
import { forwardRef as forwardRef7 } from "react";
|
|
2528
2998
|
import { icon as icon5 } from "@apliteni/apliteni-ui";
|
|
2529
|
-
import { jsx as
|
|
2999
|
+
import { jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2530
3000
|
var SearchField = forwardRef7(function SearchField2({ ariaLabel, className, ...props }, ref) {
|
|
2531
|
-
return /* @__PURE__ */
|
|
2532
|
-
/* @__PURE__ */
|
|
2533
|
-
/* @__PURE__ */
|
|
3001
|
+
return /* @__PURE__ */ jsxs26("div", { className: "ui-input-group", children: [
|
|
3002
|
+
/* @__PURE__ */ jsx31("span", { className: "ui-input-group__icon", dangerouslySetInnerHTML: { __html: icon5("search") } }),
|
|
3003
|
+
/* @__PURE__ */ jsx31(
|
|
2534
3004
|
"input",
|
|
2535
3005
|
{
|
|
2536
3006
|
ref,
|
|
@@ -2544,9 +3014,9 @@ var SearchField = forwardRef7(function SearchField2({ ariaLabel, className, ...p
|
|
|
2544
3014
|
});
|
|
2545
3015
|
|
|
2546
3016
|
// src/Toast.tsx
|
|
2547
|
-
import { createContext as createContext2, useCallback as
|
|
3017
|
+
import { createContext as createContext2, useCallback as useCallback4, useContext as useContext2, useEffect as useEffect12, useLayoutEffect as useLayoutEffect4, useRef as useRef18, useState as useState12 } from "react";
|
|
2548
3018
|
import { createPortal as createPortal4 } from "react-dom";
|
|
2549
|
-
import { jsx as
|
|
3019
|
+
import { jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2550
3020
|
var Context = createContext2(null);
|
|
2551
3021
|
var glyphs = { success: "circleCheck", danger: "circleX", warn: "circleAlert", info: "info", neutral: "bolt" };
|
|
2552
3022
|
function useToast() {
|
|
@@ -2555,21 +3025,21 @@ function useToast() {
|
|
|
2555
3025
|
return push;
|
|
2556
3026
|
}
|
|
2557
3027
|
function Notice({ notice, remove }) {
|
|
2558
|
-
const root =
|
|
2559
|
-
const [leaving2, setLeaving] =
|
|
2560
|
-
const dismissed =
|
|
2561
|
-
const remaining =
|
|
2562
|
-
const [hovered, setHovered] =
|
|
2563
|
-
const [focused, setFocused] =
|
|
3028
|
+
const root = useRef18(null);
|
|
3029
|
+
const [leaving2, setLeaving] = useState12(false);
|
|
3030
|
+
const dismissed = useRef18(false);
|
|
3031
|
+
const remaining = useRef18(5e3);
|
|
3032
|
+
const [hovered, setHovered] = useState12(false);
|
|
3033
|
+
const [focused, setFocused] = useState12(false);
|
|
2564
3034
|
const paused = hovered || focused;
|
|
2565
3035
|
const tone = notice.tone ?? "success";
|
|
2566
|
-
const dismiss =
|
|
3036
|
+
const dismiss = useCallback4(() => {
|
|
2567
3037
|
if (dismissed.current) return;
|
|
2568
3038
|
dismissed.current = true;
|
|
2569
3039
|
if (typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches) remove();
|
|
2570
3040
|
else setLeaving(true);
|
|
2571
3041
|
}, [remove]);
|
|
2572
|
-
|
|
3042
|
+
useEffect12(() => {
|
|
2573
3043
|
if (leaving2) {
|
|
2574
3044
|
const element = root.current;
|
|
2575
3045
|
const finish = (event) => {
|
|
@@ -2583,7 +3053,7 @@ function Notice({ notice, remove }) {
|
|
|
2583
3053
|
};
|
|
2584
3054
|
}
|
|
2585
3055
|
}, [leaving2, remove]);
|
|
2586
|
-
|
|
3056
|
+
useEffect12(() => {
|
|
2587
3057
|
if (leaving2 || notice.action || paused) return;
|
|
2588
3058
|
const started = Date.now();
|
|
2589
3059
|
const timer = setTimeout(dismiss, remaining.current);
|
|
@@ -2592,7 +3062,7 @@ function Notice({ notice, remove }) {
|
|
|
2592
3062
|
remaining.current = Math.max(0, remaining.current - (Date.now() - started));
|
|
2593
3063
|
};
|
|
2594
3064
|
}, [dismiss, leaving2, notice.action, paused]);
|
|
2595
|
-
return /* @__PURE__ */
|
|
3065
|
+
return /* @__PURE__ */ jsxs27(
|
|
2596
3066
|
"div",
|
|
2597
3067
|
{
|
|
2598
3068
|
ref: root,
|
|
@@ -2606,12 +3076,12 @@ function Notice({ notice, remove }) {
|
|
|
2606
3076
|
if (!event.currentTarget.contains(event.relatedTarget)) setFocused(false);
|
|
2607
3077
|
},
|
|
2608
3078
|
children: [
|
|
2609
|
-
/* @__PURE__ */
|
|
2610
|
-
/* @__PURE__ */
|
|
2611
|
-
/* @__PURE__ */
|
|
2612
|
-
notice.text && /* @__PURE__ */
|
|
3079
|
+
/* @__PURE__ */ jsx32("span", { className: "ui-toast__icon", children: /* @__PURE__ */ jsx32(Icon, { name: glyphs[tone] }) }),
|
|
3080
|
+
/* @__PURE__ */ jsxs27("div", { className: "ui-toast__body", children: [
|
|
3081
|
+
/* @__PURE__ */ jsx32("div", { className: "ui-toast__title", children: notice.title }),
|
|
3082
|
+
notice.text && /* @__PURE__ */ jsx32("div", { className: "ui-toast__text", children: notice.text })
|
|
2613
3083
|
] }),
|
|
2614
|
-
notice.action && /* @__PURE__ */
|
|
3084
|
+
notice.action && /* @__PURE__ */ jsx32(
|
|
2615
3085
|
"button",
|
|
2616
3086
|
{
|
|
2617
3087
|
type: "button",
|
|
@@ -2626,8 +3096,8 @@ function Notice({ notice, remove }) {
|
|
|
2626
3096
|
children: notice.action.label
|
|
2627
3097
|
}
|
|
2628
3098
|
),
|
|
2629
|
-
/* @__PURE__ */
|
|
2630
|
-
!notice.action && /* @__PURE__ */
|
|
3099
|
+
/* @__PURE__ */ jsx32("button", { type: "button", className: "ui-toast__close", "aria-label": "Dismiss", disabled: leaving2, onClick: dismiss, children: /* @__PURE__ */ jsx32(Icon, { name: "x" }) }),
|
|
3100
|
+
!notice.action && /* @__PURE__ */ jsx32(
|
|
2631
3101
|
"span",
|
|
2632
3102
|
{
|
|
2633
3103
|
className: "ui-toast__timer is-running",
|
|
@@ -2660,41 +3130,41 @@ function usePublishedReach(stack2, count) {
|
|
|
2660
3130
|
}, [stack2, count]);
|
|
2661
3131
|
}
|
|
2662
3132
|
function Toast({ children }) {
|
|
2663
|
-
const [entries, setEntries] =
|
|
2664
|
-
const nextId =
|
|
2665
|
-
const stack2 =
|
|
2666
|
-
const push =
|
|
3133
|
+
const [entries, setEntries] = useState12([]);
|
|
3134
|
+
const nextId = useRef18(0);
|
|
3135
|
+
const stack2 = useRef18(null);
|
|
3136
|
+
const push = useCallback4((notice) => {
|
|
2667
3137
|
const id = nextId.current++;
|
|
2668
3138
|
const remove = () => setEntries((current) => current.filter((entry) => entry.id !== id));
|
|
2669
3139
|
setEntries((current) => [...current, { id, notice, remove }]);
|
|
2670
3140
|
}, []);
|
|
2671
3141
|
usePublishedReach(stack2, entries.length);
|
|
2672
|
-
return /* @__PURE__ */
|
|
3142
|
+
return /* @__PURE__ */ jsxs27(Context.Provider, { value: push, children: [
|
|
2673
3143
|
children,
|
|
2674
3144
|
typeof document !== "undefined" && createPortal4(
|
|
2675
|
-
/* @__PURE__ */
|
|
3145
|
+
/* @__PURE__ */ jsx32("div", { className: "ui-toast-stack rx-toast-stack", ref: stack2, children: entries.map((entry) => /* @__PURE__ */ jsx32(Notice, { notice: entry.notice, remove: entry.remove }, entry.id)) }),
|
|
2676
3146
|
document.body
|
|
2677
3147
|
)
|
|
2678
3148
|
] });
|
|
2679
3149
|
}
|
|
2680
3150
|
|
|
2681
3151
|
// src/AppShell.tsx
|
|
2682
|
-
import { useEffect as
|
|
3152
|
+
import { useEffect as useEffect14, useId as useId12, useState as useState14 } from "react";
|
|
2683
3153
|
import { applyTheme, paletteHotkey, prism, railCollapsed, themeIcon, themeName } from "@apliteni/apliteni-ui";
|
|
2684
3154
|
|
|
2685
3155
|
// src/SidebarNav.tsx
|
|
2686
|
-
import { forwardRef as forwardRef8, useEffect as
|
|
3156
|
+
import { forwardRef as forwardRef8, useEffect as useEffect13, useId as useId11, useState as useState13 } from "react";
|
|
2687
3157
|
import { ENTRANCE_FALLBACK_MS } from "@apliteni/apliteni-ui/motion";
|
|
2688
|
-
import { Fragment as Fragment9, jsx as
|
|
3158
|
+
import { Fragment as Fragment9, jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2689
3159
|
var badgeText = (badge) => typeof badge === "object" ? badge.text : badge;
|
|
2690
3160
|
function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
2691
3161
|
const uid = useId11();
|
|
2692
3162
|
const group = !sub && !!item.items?.length;
|
|
2693
3163
|
const childActive = group && item.items.some((child) => child.id === active);
|
|
2694
|
-
const [expanded, setExpanded] =
|
|
3164
|
+
const [expanded, setExpanded] = useState13();
|
|
2695
3165
|
const open = expanded ?? item.defaultOpen ?? childActive;
|
|
2696
|
-
const [entering, setEntering] =
|
|
2697
|
-
|
|
3166
|
+
const [entering, setEntering] = useState13(false);
|
|
3167
|
+
useEffect13(() => {
|
|
2698
3168
|
if (!entering) return;
|
|
2699
3169
|
const timer = setTimeout(() => setEntering(false), ENTRANCE_FALLBACK_MS);
|
|
2700
3170
|
return () => clearTimeout(timer);
|
|
@@ -2711,15 +3181,15 @@ function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
|
2711
3181
|
item.disabled && "is-disabled",
|
|
2712
3182
|
item.danger && "is-danger"
|
|
2713
3183
|
].filter(Boolean).join(" ");
|
|
2714
|
-
const children = /* @__PURE__ */
|
|
2715
|
-
(item.leading ?? item.icon) && /* @__PURE__ */
|
|
2716
|
-
/* @__PURE__ */
|
|
2717
|
-
count != null && count !== "" && /* @__PURE__ */
|
|
2718
|
-
group && /* @__PURE__ */
|
|
3184
|
+
const children = /* @__PURE__ */ jsxs28(Fragment9, { children: [
|
|
3185
|
+
(item.leading ?? item.icon) && /* @__PURE__ */ jsx33("span", { className: "ui-nav__ic", children: item.leading ?? /* @__PURE__ */ jsx33(Icon, { name: item.icon }) }),
|
|
3186
|
+
/* @__PURE__ */ jsx33("span", { className: "ui-nav__label", children: item.label }),
|
|
3187
|
+
count != null && count !== "" && /* @__PURE__ */ jsx33("span", { className: `ui-nav__badge is-${typeof item.badge === "object" ? item.badge.tone ?? "neutral" : "neutral"}`, children: count }),
|
|
3188
|
+
group && /* @__PURE__ */ jsx33("span", { className: "ui-nav__caret", "aria-hidden": "true" })
|
|
2719
3189
|
] });
|
|
2720
3190
|
const common = { className, "aria-label": name, title: collapsed ? name : void 0, children };
|
|
2721
|
-
if (group) return /* @__PURE__ */
|
|
2722
|
-
/* @__PURE__ */
|
|
3191
|
+
if (group) return /* @__PURE__ */ jsxs28("li", { className: `ui-nav__group${open ? " is-open" : ""}`, children: [
|
|
3192
|
+
/* @__PURE__ */ jsx33(
|
|
2723
3193
|
"button",
|
|
2724
3194
|
{
|
|
2725
3195
|
...common,
|
|
@@ -2733,22 +3203,22 @@ function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
|
2733
3203
|
}
|
|
2734
3204
|
}
|
|
2735
3205
|
),
|
|
2736
|
-
/* @__PURE__ */
|
|
3206
|
+
/* @__PURE__ */ jsx33("ul", { id: uid, className: `ui-nav__sub${entering ? " is-entering" : ""}`, hidden: !open, onAnimationEnd: () => setEntering(false), children: item.items.map((child) => /* @__PURE__ */ jsx33(Row, { item: child, active, activeIs, collapsed, renderLink, sub: true }, child.id)) })
|
|
2737
3207
|
] });
|
|
2738
|
-
if (item.disabled) return /* @__PURE__ */
|
|
3208
|
+
if (item.disabled) return /* @__PURE__ */ jsx33("li", { children: /* @__PURE__ */ jsx33("span", { ...common, role: "link", "aria-disabled": "true" }) });
|
|
2739
3209
|
const props = {
|
|
2740
3210
|
...common,
|
|
2741
3211
|
href: item.href ?? `#${item.id}`,
|
|
2742
3212
|
target: item.target,
|
|
2743
3213
|
"aria-current": isActive ? activeIs === "section" ? "true" : "page" : void 0
|
|
2744
3214
|
};
|
|
2745
|
-
return /* @__PURE__ */
|
|
3215
|
+
return /* @__PURE__ */ jsx33("li", { children: renderLink ? renderLink(item, props) : /* @__PURE__ */ jsx33("a", { ...props }) });
|
|
2746
3216
|
}
|
|
2747
3217
|
function Section({ section, ...props }) {
|
|
2748
3218
|
const uid = useId11();
|
|
2749
|
-
return /* @__PURE__ */
|
|
2750
|
-
section.label && /* @__PURE__ */
|
|
2751
|
-
/* @__PURE__ */
|
|
3219
|
+
return /* @__PURE__ */ jsxs28("div", { className: "ui-nav__section", children: [
|
|
3220
|
+
section.label && /* @__PURE__ */ jsx33("div", { className: "ui-nav__cap", id: uid, "aria-hidden": props.collapsed || void 0, children: section.label }),
|
|
3221
|
+
/* @__PURE__ */ jsx33("ul", { className: "ui-nav__list", "aria-labelledby": section.label ? uid : void 0, children: section.items.map((item) => /* @__PURE__ */ jsx33(Row, { item, ...props }, item.id)) })
|
|
2752
3222
|
] });
|
|
2753
3223
|
}
|
|
2754
3224
|
var SidebarNav = forwardRef8(function SidebarNav2({
|
|
@@ -2763,8 +3233,8 @@ var SidebarNav = forwardRef8(function SidebarNav2({
|
|
|
2763
3233
|
"aria-label": label = "Sidebar",
|
|
2764
3234
|
...rest
|
|
2765
3235
|
}, ref) {
|
|
2766
|
-
return /* @__PURE__ */
|
|
2767
|
-
(sections?.length ? sections : [{ items }]).map((section, index) => /* @__PURE__ */
|
|
3236
|
+
return /* @__PURE__ */ jsxs28("nav", { ...rest, ref, "aria-label": label, className: ["ui-nav", "ui-nav--side", collapsed && "is-collapsed", className].filter(Boolean).join(" "), children: [
|
|
3237
|
+
(sections?.length ? sections : [{ items }]).map((section, index) => /* @__PURE__ */ jsx33(
|
|
2768
3238
|
Section,
|
|
2769
3239
|
{
|
|
2770
3240
|
section,
|
|
@@ -2775,12 +3245,12 @@ var SidebarNav = forwardRef8(function SidebarNav2({
|
|
|
2775
3245
|
},
|
|
2776
3246
|
index
|
|
2777
3247
|
)),
|
|
2778
|
-
footer && /* @__PURE__ */
|
|
3248
|
+
footer && /* @__PURE__ */ jsx33("div", { className: "ui-nav__foot", children: footer })
|
|
2779
3249
|
] });
|
|
2780
3250
|
});
|
|
2781
3251
|
|
|
2782
3252
|
// src/AppShell.tsx
|
|
2783
|
-
import { Fragment as Fragment10, jsx as
|
|
3253
|
+
import { Fragment as Fragment10, jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
2784
3254
|
var path = (value) => value.split(/[?#]/)[0].replace(/\/+$/, "") || "/";
|
|
2785
3255
|
function AppShell({
|
|
2786
3256
|
sections,
|
|
@@ -2802,20 +3272,20 @@ function AppShell({
|
|
|
2802
3272
|
renderLink
|
|
2803
3273
|
}) {
|
|
2804
3274
|
const uid = useId12();
|
|
2805
|
-
const [collapsed, setCollapsed] =
|
|
2806
|
-
const [search, setSearch] =
|
|
2807
|
-
const [more, setMore] =
|
|
2808
|
-
const [theme, setTheme] =
|
|
3275
|
+
const [collapsed, setCollapsed] = useState14(defaultCollapsed);
|
|
3276
|
+
const [search, setSearch] = useState14(false);
|
|
3277
|
+
const [more, setMore] = useState14(false);
|
|
3278
|
+
const [theme, setTheme] = useState14("dark");
|
|
2809
3279
|
const current = path(pathname);
|
|
2810
3280
|
const active = sections.filter((section) => current === path(section.href) || path(section.href) !== "/" && current.startsWith(`${path(section.href)}/`)).sort((a, b) => path(b.href).length - path(a.href).length)[0];
|
|
2811
|
-
|
|
3281
|
+
useEffect14(() => {
|
|
2812
3282
|
setCollapsed(railCollapsed() ?? defaultCollapsed);
|
|
2813
3283
|
}, [defaultCollapsed]);
|
|
2814
|
-
|
|
3284
|
+
useEffect14(() => {
|
|
2815
3285
|
setMore(false);
|
|
2816
3286
|
setSearch(false);
|
|
2817
3287
|
}, [pathname]);
|
|
2818
|
-
|
|
3288
|
+
useEffect14(() => {
|
|
2819
3289
|
const root = document.documentElement;
|
|
2820
3290
|
const sync2 = () => setTheme(root.getAttribute("data-theme") === "light" ? "light" : "dark");
|
|
2821
3291
|
sync2();
|
|
@@ -2823,7 +3293,7 @@ function AppShell({
|
|
|
2823
3293
|
observer.observe(root, { attributes: true, attributeFilter: ["data-theme"] });
|
|
2824
3294
|
return () => observer.disconnect();
|
|
2825
3295
|
}, []);
|
|
2826
|
-
|
|
3296
|
+
useEffect14(() => {
|
|
2827
3297
|
const hotkey = (event) => {
|
|
2828
3298
|
if (!(event.metaKey || event.ctrlKey) || event.altKey || event.shiftKey || event.key.toLowerCase() !== "k") return;
|
|
2829
3299
|
const target = event.target;
|
|
@@ -2853,15 +3323,15 @@ function AppShell({
|
|
|
2853
3323
|
onClick: (event) => {
|
|
2854
3324
|
if (!event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey) setMore(false);
|
|
2855
3325
|
},
|
|
2856
|
-
children: /* @__PURE__ */
|
|
2857
|
-
/* @__PURE__ */
|
|
2858
|
-
/* @__PURE__ */
|
|
2859
|
-
section.count != null && /* @__PURE__ */
|
|
3326
|
+
children: /* @__PURE__ */ jsxs29(Fragment10, { children: [
|
|
3327
|
+
/* @__PURE__ */ jsx34("span", { className: "ui-nav__ic", children: /* @__PURE__ */ jsx34(Icon, { name: section.icon }) }),
|
|
3328
|
+
/* @__PURE__ */ jsx34("span", { className: "ui-nav__label", children: section.label }),
|
|
3329
|
+
section.count != null && /* @__PURE__ */ jsx34("span", { className: "ui-nav__badge is-neutral", children: section.count })
|
|
2860
3330
|
] })
|
|
2861
3331
|
};
|
|
2862
|
-
return /* @__PURE__ */
|
|
3332
|
+
return /* @__PURE__ */ jsx34("li", { children: renderLink ? renderLink(section, linkProps) : /* @__PURE__ */ jsx34("a", { ...linkProps }) }, section.href);
|
|
2863
3333
|
});
|
|
2864
|
-
const sidebar = (items, label) => /* @__PURE__ */
|
|
3334
|
+
const sidebar = (items, label) => /* @__PURE__ */ jsx34(
|
|
2865
3335
|
SidebarNav,
|
|
2866
3336
|
{
|
|
2867
3337
|
"aria-label": label,
|
|
@@ -2873,7 +3343,7 @@ function AppShell({
|
|
|
2873
3343
|
const linkProps = { ...props, onClick: (event) => {
|
|
2874
3344
|
if (!event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey) setMore(false);
|
|
2875
3345
|
} };
|
|
2876
|
-
return renderLink ? renderLink(section, linkProps) : /* @__PURE__ */
|
|
3346
|
+
return renderLink ? renderLink(section, linkProps) : /* @__PURE__ */ jsx34("a", { ...linkProps });
|
|
2877
3347
|
}
|
|
2878
3348
|
}
|
|
2879
3349
|
);
|
|
@@ -2881,33 +3351,33 @@ function AppShell({
|
|
|
2881
3351
|
const visible = sections.length > 4 ? sections.slice(0, 3) : sections;
|
|
2882
3352
|
const remaining = sections.slice(visible.length);
|
|
2883
3353
|
const initials = account.name.trim().split(/\s+/).map((part) => part[0]).slice(0, 2).join("");
|
|
2884
|
-
return /* @__PURE__ */
|
|
2885
|
-
/* @__PURE__ */
|
|
2886
|
-
/* @__PURE__ */
|
|
2887
|
-
brand ?? /* @__PURE__ */
|
|
2888
|
-
/* @__PURE__ */
|
|
3354
|
+
return /* @__PURE__ */ jsxs29("div", { className: `ui-app ui-app--topbar ui-react-app${collapsed ? " is-collapsed" : ""}`, children: [
|
|
3355
|
+
/* @__PURE__ */ jsxs29("div", { className: "ui-app__rail", children: [
|
|
3356
|
+
/* @__PURE__ */ jsx34("div", { className: "ui-app__head", children: /* @__PURE__ */ jsxs29("a", { className: "ui-app__brand", href: brandHref, "aria-label": word, children: [
|
|
3357
|
+
brand ?? /* @__PURE__ */ jsx34("i", { "aria-hidden": "true", className: "ui-react-app__mark", dangerouslySetInnerHTML: { __html: prism(uid, 24) } }),
|
|
3358
|
+
/* @__PURE__ */ jsx34("span", { children: word })
|
|
2889
3359
|
] }) }),
|
|
2890
3360
|
sidebar(sections, "Sections"),
|
|
2891
|
-
/* @__PURE__ */
|
|
2892
|
-
/* @__PURE__ */
|
|
2893
|
-
/* @__PURE__ */
|
|
2894
|
-
/* @__PURE__ */
|
|
2895
|
-
/* @__PURE__ */
|
|
3361
|
+
/* @__PURE__ */ jsx34("div", { className: "ui-app__foot", children: /* @__PURE__ */ jsx34("div", { className: "ui-app__fold-row", children: /* @__PURE__ */ jsxs29("button", { type: "button", className: "ui-nav__item ui-app__fold", "aria-expanded": !collapsed, "aria-label": foldLabel, onClick: fold, children: [
|
|
3362
|
+
/* @__PURE__ */ jsx34("span", { className: "ui-nav__ic", children: /* @__PURE__ */ jsxs29("svg", { className: "ui-icon", viewBox: "0 0 24 24", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
3363
|
+
/* @__PURE__ */ jsx34("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
|
|
3364
|
+
/* @__PURE__ */ jsx34("path", { className: "ui-app__fold-seam", d: "M9 3v18" }),
|
|
3365
|
+
/* @__PURE__ */ jsx34("path", { className: "ui-app__fold-arrow", d: "m16 15-3-3 3-3" })
|
|
2896
3366
|
] }) }),
|
|
2897
|
-
/* @__PURE__ */
|
|
3367
|
+
/* @__PURE__ */ jsx34("span", { className: "ui-nav__label", children: foldLabel })
|
|
2898
3368
|
] }) }) })
|
|
2899
3369
|
] }),
|
|
2900
|
-
/* @__PURE__ */
|
|
2901
|
-
/* @__PURE__ */
|
|
2902
|
-
/* @__PURE__ */
|
|
2903
|
-
/* @__PURE__ */
|
|
2904
|
-
/* @__PURE__ */
|
|
2905
|
-
/* @__PURE__ */
|
|
3370
|
+
/* @__PURE__ */ jsxs29("div", { className: "ui-app__well", children: [
|
|
3371
|
+
/* @__PURE__ */ jsxs29("header", { className: "ui-app__bar", children: [
|
|
3372
|
+
/* @__PURE__ */ jsxs29("button", { type: "button", className: "ui-app__search", "aria-haspopup": "dialog", onClick: () => setSearch(true), children: [
|
|
3373
|
+
/* @__PURE__ */ jsx34("span", { className: "ui-app__search-ic", children: /* @__PURE__ */ jsx34(Icon, { name: "search" }) }),
|
|
3374
|
+
/* @__PURE__ */ jsx34("span", { className: "ui-app__search-txt", children: "Search or run a command\u2026" }),
|
|
3375
|
+
/* @__PURE__ */ jsx34("kbd", { className: "ui-cmdk__key", children: paletteHotkey() })
|
|
2906
3376
|
] }),
|
|
2907
|
-
/* @__PURE__ */
|
|
3377
|
+
/* @__PURE__ */ jsx34("span", { className: "ui-app__bar-gap" }),
|
|
2908
3378
|
bandControl,
|
|
2909
|
-
/* @__PURE__ */
|
|
2910
|
-
/* @__PURE__ */
|
|
3379
|
+
/* @__PURE__ */ jsx34("button", { type: "button", className: "toggle", "aria-label": themeName(theme), title: themeName(theme), onClick: () => applyTheme(theme === "light" ? "dark" : "light"), children: /* @__PURE__ */ jsx34("span", { className: "ic", "aria-hidden": "true", dangerouslySetInnerHTML: { __html: themeIcon(theme) } }) }),
|
|
3380
|
+
/* @__PURE__ */ jsx34("div", { className: "ui-app__user ui-app__user--bar", children: /* @__PURE__ */ jsx34(
|
|
2911
3381
|
Dropdown,
|
|
2912
3382
|
{
|
|
2913
3383
|
variant: "menu",
|
|
@@ -2916,27 +3386,27 @@ function AppShell({
|
|
|
2916
3386
|
ariaLabel: `Signed in as ${account.name}, ${account.email}`,
|
|
2917
3387
|
triggerClass: "ui-app__user-trigger",
|
|
2918
3388
|
panelClass: "ui-app__user-panel",
|
|
2919
|
-
triggerContent: /* @__PURE__ */
|
|
2920
|
-
header: /* @__PURE__ */
|
|
2921
|
-
/* @__PURE__ */
|
|
2922
|
-
/* @__PURE__ */
|
|
3389
|
+
triggerContent: /* @__PURE__ */ jsx34("span", { className: "ui-app__av", "aria-hidden": "true", children: initials }),
|
|
3390
|
+
header: /* @__PURE__ */ jsxs29("div", { className: "ui-dropdown__head", children: [
|
|
3391
|
+
/* @__PURE__ */ jsx34("b", { children: account.name }),
|
|
3392
|
+
/* @__PURE__ */ jsx34("span", { children: account.email })
|
|
2923
3393
|
] }),
|
|
2924
3394
|
items: [{ label: "Sign out", icon: "logout", danger: true }],
|
|
2925
3395
|
onSelect: onSignOut
|
|
2926
3396
|
}
|
|
2927
3397
|
) })
|
|
2928
3398
|
] }),
|
|
2929
|
-
/* @__PURE__ */
|
|
2930
|
-
back && /* @__PURE__ */
|
|
2931
|
-
/* @__PURE__ */
|
|
2932
|
-
lede && /* @__PURE__ */
|
|
2933
|
-
actions && /* @__PURE__ */
|
|
2934
|
-
/* @__PURE__ */
|
|
3399
|
+
/* @__PURE__ */ jsxs29("main", { className: `ui-app__main${width === "wide" ? " ui-app__main--wide" : ""}`, children: [
|
|
3400
|
+
back && /* @__PURE__ */ jsx34(BackLink, { ...back }),
|
|
3401
|
+
/* @__PURE__ */ jsx34("h1", { children: title }),
|
|
3402
|
+
lede && /* @__PURE__ */ jsx34("p", { className: "ui-app__sub", children: lede }),
|
|
3403
|
+
actions && /* @__PURE__ */ jsx34("div", { className: "ui-react-app__actions", children: actions }),
|
|
3404
|
+
/* @__PURE__ */ jsx34("div", { className: "ui-app__body", children })
|
|
2935
3405
|
] })
|
|
2936
3406
|
] }),
|
|
2937
|
-
/* @__PURE__ */
|
|
3407
|
+
/* @__PURE__ */ jsx34("nav", { className: "ui-nav ui-react-app__bottom", "aria-label": "Sections on mobile", children: /* @__PURE__ */ jsxs29("ul", { className: "ui-nav__list", children: [
|
|
2938
3408
|
links(visible),
|
|
2939
|
-
remaining.length > 0 && /* @__PURE__ */
|
|
3409
|
+
remaining.length > 0 && /* @__PURE__ */ jsx34("li", { children: /* @__PURE__ */ jsxs29(
|
|
2940
3410
|
"button",
|
|
2941
3411
|
{
|
|
2942
3412
|
type: "button",
|
|
@@ -2945,20 +3415,20 @@ function AppShell({
|
|
|
2945
3415
|
"aria-expanded": more,
|
|
2946
3416
|
onClick: () => setMore(true),
|
|
2947
3417
|
children: [
|
|
2948
|
-
/* @__PURE__ */
|
|
2949
|
-
/* @__PURE__ */
|
|
3418
|
+
/* @__PURE__ */ jsx34("span", { className: "ui-nav__ic", children: /* @__PURE__ */ jsx34(Icon, { name: "moreHorizontal" }) }),
|
|
3419
|
+
/* @__PURE__ */ jsx34("span", { className: "ui-nav__label", children: "More" })
|
|
2950
3420
|
]
|
|
2951
3421
|
}
|
|
2952
3422
|
) })
|
|
2953
3423
|
] }) }),
|
|
2954
|
-
/* @__PURE__ */
|
|
2955
|
-
/* @__PURE__ */
|
|
3424
|
+
/* @__PURE__ */ jsx34(Drawer, { open: more, onClose: () => setMore(false), title: "More sections", side: "bottom", children: sidebar(remaining, "More sections") }),
|
|
3425
|
+
/* @__PURE__ */ jsx34(CommandPalette, { ...palette ?? { groups: [{ items: sections.map((section) => ({ id: section.href, ...section })) }] }, open: search, onClose: () => setSearch(false) })
|
|
2956
3426
|
] });
|
|
2957
3427
|
}
|
|
2958
3428
|
|
|
2959
3429
|
// src/EmptyState.tsx
|
|
2960
3430
|
import { icon as kitIcon2, illo } from "@apliteni/apliteni-ui";
|
|
2961
|
-
import { jsx as
|
|
3431
|
+
import { jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
2962
3432
|
var cases = {
|
|
2963
3433
|
"first-run": { title: "Nothing needs you yet", sub: "New items will appear here when they need your attention.", icon: "check" },
|
|
2964
3434
|
"no-matches": { title: "No results in this view", sub: "Try another search or clear your filters.", icon: "search" },
|
|
@@ -2970,18 +3440,18 @@ function EmptyState({ variant = "first-run", title, sub, icon: icon7, art, actio
|
|
|
2970
3440
|
const heading = title ?? preset.title;
|
|
2971
3441
|
const guidance = sub ?? preset.sub;
|
|
2972
3442
|
const glyph = icon7 ?? preset.icon;
|
|
2973
|
-
return /* @__PURE__ */
|
|
2974
|
-
art ? typeof art === "string" ? /* @__PURE__ */
|
|
2975
|
-
heading && /* @__PURE__ */
|
|
2976
|
-
guidance && /* @__PURE__ */
|
|
2977
|
-
actions && /* @__PURE__ */
|
|
3443
|
+
return /* @__PURE__ */ jsxs30("div", { className: "ui-empty", children: [
|
|
3444
|
+
art ? typeof art === "string" ? /* @__PURE__ */ jsx35("div", { className: "ui-empty__art", dangerouslySetInnerHTML: { __html: /<svg/.test(art) ? art : illo(art) } }) : /* @__PURE__ */ jsx35("div", { className: "ui-empty__art", "aria-hidden": "true", children: art }) : glyph ? /* @__PURE__ */ jsx35("div", { className: "ui-empty__icon", dangerouslySetInnerHTML: { __html: kitIcon2(glyph) } }) : null,
|
|
3445
|
+
heading && /* @__PURE__ */ jsx35("div", { className: "ui-empty__title", children: heading }),
|
|
3446
|
+
guidance && /* @__PURE__ */ jsx35("div", { className: "ui-empty__sub", children: guidance }),
|
|
3447
|
+
actions && /* @__PURE__ */ jsx35("div", { className: "ui-empty__actions", children: actions })
|
|
2978
3448
|
] });
|
|
2979
3449
|
}
|
|
2980
3450
|
|
|
2981
3451
|
// src/ThemeToggle.tsx
|
|
2982
3452
|
import { useSyncExternalStore } from "react";
|
|
2983
3453
|
import { icon as icon6 } from "@apliteni/apliteni-ui";
|
|
2984
|
-
import { jsx as
|
|
3454
|
+
import { jsx as jsx36, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
2985
3455
|
var STORAGE_KEY = "apliteni-strategy-theme";
|
|
2986
3456
|
var CHOICE_EVENT = "apliteni-theme-choice";
|
|
2987
3457
|
var THEME_INIT_SCRIPT = `(()=>{let t;try{t=localStorage.getItem('apliteni-strategy-theme')}catch{}document.documentElement.setAttribute('data-theme',t==='dark'||t==='light'?t:window.matchMedia?.('(prefers-color-scheme: light)').matches?'light':'dark')})()`;
|
|
@@ -3039,10 +3509,10 @@ function ThemeToggle({ labelled = false }) {
|
|
|
3039
3509
|
}
|
|
3040
3510
|
window.dispatchEvent(new Event(CHOICE_EVENT));
|
|
3041
3511
|
};
|
|
3042
|
-
const button = /* @__PURE__ */
|
|
3043
|
-
return labelled ? /* @__PURE__ */
|
|
3512
|
+
const button = /* @__PURE__ */ jsx36("button", { type: "button", className: "toggle", "aria-label": name, title: name, onClick: toggle, children: /* @__PURE__ */ jsx36("span", { className: "ic", "aria-hidden": "true", dangerouslySetInnerHTML: { __html: icon6(theme === "auto" ? "monitor" : theme === "light" ? "sun" : "moon") } }) });
|
|
3513
|
+
return labelled ? /* @__PURE__ */ jsxs31("span", { className: "ui-theme-toggle", children: [
|
|
3044
3514
|
button,
|
|
3045
|
-
/* @__PURE__ */
|
|
3515
|
+
/* @__PURE__ */ jsxs31("span", { children: [
|
|
3046
3516
|
label,
|
|
3047
3517
|
" theme"
|
|
3048
3518
|
] })
|
|
@@ -3050,11 +3520,11 @@ function ThemeToggle({ labelled = false }) {
|
|
|
3050
3520
|
}
|
|
3051
3521
|
|
|
3052
3522
|
// src/Success.tsx
|
|
3053
|
-
import { forwardRef as forwardRef9, useEffect as
|
|
3054
|
-
import { jsx as
|
|
3523
|
+
import { forwardRef as forwardRef9, useEffect as useEffect15, useRef as useRef19, useState as useState15 } from "react";
|
|
3524
|
+
import { jsx as jsx37, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3055
3525
|
var SuccessCheck = forwardRef9(function SuccessCheck2({ variant = "line", className, ...rest }, ref) {
|
|
3056
3526
|
const circled = variant === "circled";
|
|
3057
|
-
return /* @__PURE__ */
|
|
3527
|
+
return /* @__PURE__ */ jsxs32(
|
|
3058
3528
|
"svg",
|
|
3059
3529
|
{
|
|
3060
3530
|
...rest,
|
|
@@ -3066,18 +3536,18 @@ var SuccessCheck = forwardRef9(function SuccessCheck2({ variant = "line", classN
|
|
|
3066
3536
|
"aria-hidden": "true",
|
|
3067
3537
|
focusable: "false",
|
|
3068
3538
|
children: [
|
|
3069
|
-
circled && /* @__PURE__ */
|
|
3070
|
-
/* @__PURE__ */
|
|
3539
|
+
circled && /* @__PURE__ */ jsx37("path", { className: "ui-sx__circle", d: "M22 11.08V12a10 10 0 1 1-5.93-9.14" }),
|
|
3540
|
+
/* @__PURE__ */ jsx37("path", { className: "ui-sx__tick", d: circled ? "M22 4L12 14.01l-3-3" : "M20 6L9 17l-5-5" })
|
|
3071
3541
|
]
|
|
3072
3542
|
}
|
|
3073
3543
|
);
|
|
3074
3544
|
});
|
|
3075
3545
|
var SuccessPanel = forwardRef9(function SuccessPanel2({ title = "Done", sub, check = "line", className, ...rest }, ref) {
|
|
3076
3546
|
const circled = check === "circled";
|
|
3077
|
-
return /* @__PURE__ */
|
|
3078
|
-
/* @__PURE__ */
|
|
3079
|
-
/* @__PURE__ */
|
|
3080
|
-
sub && /* @__PURE__ */
|
|
3547
|
+
return /* @__PURE__ */ jsxs32("div", { ...rest, ref, className: ["ui-success", className].filter(Boolean).join(" "), children: [
|
|
3548
|
+
/* @__PURE__ */ jsx37("div", { className: ["ui-success__check", circled && "ui-success__check--circled"].filter(Boolean).join(" "), children: /* @__PURE__ */ jsx37(SuccessCheck, { variant: circled ? "circled" : "line" }) }),
|
|
3549
|
+
/* @__PURE__ */ jsx37("div", { className: "ui-success__title", children: title }),
|
|
3550
|
+
sub && /* @__PURE__ */ jsx37("div", { className: "ui-success__sub", children: sub })
|
|
3081
3551
|
] });
|
|
3082
3552
|
});
|
|
3083
3553
|
var pieces = [
|
|
@@ -3097,12 +3567,12 @@ var pieces = [
|
|
|
3097
3567
|
[80, 0.36, -20, "c", 1.05]
|
|
3098
3568
|
];
|
|
3099
3569
|
function Countdown({ seconds, label = "Redirecting", onDone }) {
|
|
3100
|
-
const [remaining, setRemaining] =
|
|
3101
|
-
const callback =
|
|
3102
|
-
|
|
3570
|
+
const [remaining, setRemaining] = useState15(seconds);
|
|
3571
|
+
const callback = useRef19(onDone);
|
|
3572
|
+
useEffect15(() => {
|
|
3103
3573
|
callback.current = onDone;
|
|
3104
3574
|
}, [onDone]);
|
|
3105
|
-
|
|
3575
|
+
useEffect15(() => {
|
|
3106
3576
|
let count = seconds;
|
|
3107
3577
|
const timer = setInterval(() => {
|
|
3108
3578
|
count -= 1;
|
|
@@ -3114,12 +3584,12 @@ function Countdown({ seconds, label = "Redirecting", onDone }) {
|
|
|
3114
3584
|
}, 1e3);
|
|
3115
3585
|
return () => clearInterval(timer);
|
|
3116
3586
|
}, [seconds]);
|
|
3117
|
-
return /* @__PURE__ */
|
|
3118
|
-
/* @__PURE__ */
|
|
3119
|
-
/* @__PURE__ */
|
|
3587
|
+
return /* @__PURE__ */ jsxs32("div", { className: "ui-sx__count", "data-sx-count": "", style: { "--sx-secs": `${seconds}s` }, children: [
|
|
3588
|
+
/* @__PURE__ */ jsx37("span", { className: "ui-sx__count-ring", "aria-hidden": "true" }),
|
|
3589
|
+
/* @__PURE__ */ jsxs32("span", { className: "ui-sx__count-text", children: [
|
|
3120
3590
|
label,
|
|
3121
3591
|
" in ",
|
|
3122
|
-
/* @__PURE__ */
|
|
3592
|
+
/* @__PURE__ */ jsx37("b", { "data-sx-num": "", children: remaining }),
|
|
3123
3593
|
"s"
|
|
3124
3594
|
] })
|
|
3125
3595
|
] });
|
|
@@ -3146,7 +3616,7 @@ var Success = forwardRef9(function Success2({
|
|
|
3146
3616
|
const seconds = countdown?.seconds;
|
|
3147
3617
|
const duration = seconds != null && Number.isFinite(seconds) && seconds >= 1 ? Math.floor(seconds) : 5;
|
|
3148
3618
|
const mark = check === "circled" ? "circled" : "line";
|
|
3149
|
-
return /* @__PURE__ */
|
|
3619
|
+
return /* @__PURE__ */ jsxs32(
|
|
3150
3620
|
"div",
|
|
3151
3621
|
{
|
|
3152
3622
|
role: "status",
|
|
@@ -3155,16 +3625,16 @@ var Success = forwardRef9(function Success2({
|
|
|
3155
3625
|
ref,
|
|
3156
3626
|
className: ["ui-sx", `ui-sx--${layout}`, `ui-sx--check-${mark}`, confetti && "ui-sx--confetti", className].filter(Boolean).join(" "),
|
|
3157
3627
|
children: [
|
|
3158
|
-
confetti && /* @__PURE__ */
|
|
3159
|
-
([x, d, r, t, s], index) => /* @__PURE__ */
|
|
3628
|
+
confetti && /* @__PURE__ */ jsx37("div", { className: "ui-sx__confetti", "aria-hidden": "true", children: pieces.map(
|
|
3629
|
+
([x, d, r, t, s], index) => /* @__PURE__ */ jsx37("i", { className: `ui-sx__piece ui-sx__piece--${t}`, style: { left: `${x}%`, "--sx-d": `${d}s`, "--sx-r": `${r}deg`, "--sx-s": s } }, index)
|
|
3160
3630
|
) }),
|
|
3161
|
-
/* @__PURE__ */
|
|
3162
|
-
/* @__PURE__ */
|
|
3163
|
-
/* @__PURE__ */
|
|
3164
|
-
/* @__PURE__ */
|
|
3165
|
-
body && /* @__PURE__ */
|
|
3166
|
-
hasActions && /* @__PURE__ */
|
|
3167
|
-
countdown && /* @__PURE__ */
|
|
3631
|
+
/* @__PURE__ */ jsxs32("div", { className: "ui-sx__inner", children: [
|
|
3632
|
+
/* @__PURE__ */ jsx37("div", { className: "ui-sx__visual", children: /* @__PURE__ */ jsx37(SuccessCheck, { variant: mark }) }),
|
|
3633
|
+
/* @__PURE__ */ jsxs32("div", { className: "ui-sx__content", children: [
|
|
3634
|
+
/* @__PURE__ */ jsx37(Heading, { className: "ui-sx__title", children: title }),
|
|
3635
|
+
body && /* @__PURE__ */ jsx37("p", { className: "ui-sx__body", children: body }),
|
|
3636
|
+
hasActions && /* @__PURE__ */ jsx37("div", { className: "ui-sx__actions", children: actions }),
|
|
3637
|
+
countdown && /* @__PURE__ */ jsx37(Countdown, { seconds: duration, label: countdown.label, onDone: onCountdownEnd }, duration)
|
|
3168
3638
|
] })
|
|
3169
3639
|
] })
|
|
3170
3640
|
]
|
|
@@ -3188,6 +3658,7 @@ export {
|
|
|
3188
3658
|
Confirm,
|
|
3189
3659
|
DEFAULT_PAGE_SIZE3 as DEFAULT_PAGE_SIZE,
|
|
3190
3660
|
DataTable,
|
|
3661
|
+
DatePicker,
|
|
3191
3662
|
DeltaValue,
|
|
3192
3663
|
Denied,
|
|
3193
3664
|
Drawer,
|