@tensor_1/react 2.45.0 → 2.46.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/README.md +19 -1
- package/dist/components/CommandPalette.d.ts +4 -0
- package/dist/components/CommandPalette.js +10 -2
- package/dist/components/Meter.js +1 -1
- package/dist/components/Modal.d.ts +6 -1
- package/dist/components/Modal.js +2 -0
- package/dist/components/Progress.js +1 -1
- package/dist/components/RelationshipGraphLayered.js +16 -14
- package/dist/hooks/useReducedMotion.d.ts +6 -0
- package/dist/hooks/useReducedMotion.js +20 -0
- package/dist/index.cjs +797 -764
- package/dist/index.d.cts +16 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -321,6 +321,7 @@ __export(src_exports, {
|
|
|
321
321
|
placeSpan: () => placeSpan,
|
|
322
322
|
placesInTopLane: () => placesInTopLane,
|
|
323
323
|
predictionBand: () => predictionBand,
|
|
324
|
+
prefersReducedMotion: () => prefersReducedMotion,
|
|
324
325
|
proposeMove: () => proposeMove,
|
|
325
326
|
quantiles: () => quantiles,
|
|
326
327
|
rankOverflow: () => rankOverflow,
|
|
@@ -367,6 +368,7 @@ __export(src_exports, {
|
|
|
367
368
|
treeNav: () => treeNav,
|
|
368
369
|
useAnchoredPosition: () => useAnchoredPosition,
|
|
369
370
|
useDialog: () => useDialog,
|
|
371
|
+
useReducedMotion: () => useReducedMotion,
|
|
370
372
|
useTable: () => useTable,
|
|
371
373
|
useUixLabels: () => useUixLabels,
|
|
372
374
|
useVirtualRows: () => useVirtualRows,
|
|
@@ -1138,8 +1140,25 @@ function useAnchoredPosition(anchor, floatingRef, { open, placement = "bottom-st
|
|
|
1138
1140
|
return reposition;
|
|
1139
1141
|
}
|
|
1140
1142
|
|
|
1143
|
+
// src/hooks/useReducedMotion.ts
|
|
1144
|
+
var import_react5 = require("react");
|
|
1145
|
+
var QUERY = "(prefers-reduced-motion: reduce)";
|
|
1146
|
+
function subscribe(onChange) {
|
|
1147
|
+
if (typeof matchMedia === "undefined") return () => {
|
|
1148
|
+
};
|
|
1149
|
+
const mql = matchMedia(QUERY);
|
|
1150
|
+
mql.addEventListener("change", onChange);
|
|
1151
|
+
return () => mql.removeEventListener("change", onChange);
|
|
1152
|
+
}
|
|
1153
|
+
function prefersReducedMotion() {
|
|
1154
|
+
return typeof matchMedia !== "undefined" && matchMedia(QUERY).matches;
|
|
1155
|
+
}
|
|
1156
|
+
function useReducedMotion() {
|
|
1157
|
+
return (0, import_react5.useSyncExternalStore)(subscribe, prefersReducedMotion, () => false);
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1141
1160
|
// src/components/Button.tsx
|
|
1142
|
-
var
|
|
1161
|
+
var import_react8 = require("react");
|
|
1143
1162
|
|
|
1144
1163
|
// src/link.tsx
|
|
1145
1164
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -1149,11 +1168,11 @@ function renderUixLink(renderLink, props) {
|
|
|
1149
1168
|
}
|
|
1150
1169
|
|
|
1151
1170
|
// src/components/ShortcutHint.tsx
|
|
1152
|
-
var
|
|
1171
|
+
var import_react7 = require("react");
|
|
1153
1172
|
var import_react_dom = require("react-dom");
|
|
1154
1173
|
|
|
1155
1174
|
// src/components/Kbd.tsx
|
|
1156
|
-
var
|
|
1175
|
+
var import_react6 = require("react");
|
|
1157
1176
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
1158
1177
|
function Kbd({ className, children, ...props }) {
|
|
1159
1178
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("kbd", { className: cx("uix-kbd", className), ...props, children });
|
|
@@ -1186,7 +1205,7 @@ var noSubscription = () => () => {
|
|
|
1186
1205
|
};
|
|
1187
1206
|
var serverPlatform = () => "other";
|
|
1188
1207
|
function useKbdPlatform(platform) {
|
|
1189
|
-
const detected = (0,
|
|
1208
|
+
const detected = (0, import_react6.useSyncExternalStore)(noSubscription, detectPlatform, serverPlatform);
|
|
1190
1209
|
return platform ?? detected;
|
|
1191
1210
|
}
|
|
1192
1211
|
var ARIA_KEYS = {
|
|
@@ -1215,7 +1234,7 @@ function KbdCombo({ keys, platform, keyLabels, className, ...props }) {
|
|
|
1215
1234
|
|
|
1216
1235
|
// src/components/ShortcutHint.tsx
|
|
1217
1236
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1218
|
-
var useIsomorphicLayoutEffect2 = typeof document !== "undefined" ?
|
|
1237
|
+
var useIsomorphicLayoutEffect2 = typeof document !== "undefined" ? import_react7.useLayoutEffect : import_react7.useEffect;
|
|
1219
1238
|
var isShown = (el) => {
|
|
1220
1239
|
try {
|
|
1221
1240
|
return !!el?.matches(":popover-open");
|
|
@@ -1232,11 +1251,11 @@ var focusVisible = (el) => {
|
|
|
1232
1251
|
};
|
|
1233
1252
|
var stop = (event) => event.stopPropagation();
|
|
1234
1253
|
function ShortcutHint({ keys, label, ownsAria }) {
|
|
1235
|
-
const markerRef = (0,
|
|
1236
|
-
const bubbleRef = (0,
|
|
1237
|
-
const anchorRef = (0,
|
|
1238
|
-
const [host, setHost] = (0,
|
|
1239
|
-
const [open, setOpen] = (0,
|
|
1254
|
+
const markerRef = (0, import_react7.useRef)(null);
|
|
1255
|
+
const bubbleRef = (0, import_react7.useRef)(null);
|
|
1256
|
+
const anchorRef = (0, import_react7.useRef)(null);
|
|
1257
|
+
const [host, setHost] = (0, import_react7.useState)(null);
|
|
1258
|
+
const [open, setOpen] = (0, import_react7.useState)(false);
|
|
1240
1259
|
const platform = useKbdPlatform();
|
|
1241
1260
|
const shortcuts = ariaKeyShortcuts(keys, platform);
|
|
1242
1261
|
useAnchoredPosition(anchorRef, bubbleRef, { open, placement: "top", offset: 6 });
|
|
@@ -1260,7 +1279,7 @@ function ShortcutHint({ keys, label, ownsAria }) {
|
|
|
1260
1279
|
}
|
|
1261
1280
|
setHost(button.closest("dialog") ?? button.ownerDocument.body);
|
|
1262
1281
|
}, []);
|
|
1263
|
-
(0,
|
|
1282
|
+
(0, import_react7.useEffect)(() => {
|
|
1264
1283
|
const button = anchorRef.current;
|
|
1265
1284
|
const bubble = bubbleRef.current;
|
|
1266
1285
|
if (!host || !button || !bubble) return void 0;
|
|
@@ -1367,7 +1386,7 @@ var buttonClasses = (variant, size, icon, wrap, className) => cx(
|
|
|
1367
1386
|
className
|
|
1368
1387
|
);
|
|
1369
1388
|
var warnedIconButton = false;
|
|
1370
|
-
var Button = (0,
|
|
1389
|
+
var Button = (0, import_react8.forwardRef)(
|
|
1371
1390
|
({ variant = "secondary", size = "md", icon = false, loading = false, wrap = false, shortcut, className, children, disabled, onClick, ...props }, ref) => {
|
|
1372
1391
|
if (!warnedIconButton && icon && children == null && !props["aria-label"] && !props["aria-labelledby"] && typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
|
|
1373
1392
|
warnedIconButton = true;
|
|
@@ -1411,12 +1430,12 @@ function ButtonGroup({ children, className }) {
|
|
|
1411
1430
|
}
|
|
1412
1431
|
|
|
1413
1432
|
// src/labels-context.tsx
|
|
1414
|
-
var
|
|
1433
|
+
var import_react9 = require("react");
|
|
1415
1434
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1416
|
-
var UixLabelsContext = (0,
|
|
1435
|
+
var UixLabelsContext = (0, import_react9.createContext)({});
|
|
1417
1436
|
function UixLabelsProvider({ labels, children }) {
|
|
1418
|
-
const parent = (0,
|
|
1419
|
-
const value = (0,
|
|
1437
|
+
const parent = (0, import_react9.useContext)(UixLabelsContext);
|
|
1438
|
+
const value = (0, import_react9.useMemo)(() => {
|
|
1420
1439
|
const merged = { ...parent };
|
|
1421
1440
|
for (const [key, entry] of Object.entries(labels)) {
|
|
1422
1441
|
const inherited = parent[key];
|
|
@@ -1427,13 +1446,13 @@ function UixLabelsProvider({ labels, children }) {
|
|
|
1427
1446
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(UixLabelsContext.Provider, { value, children });
|
|
1428
1447
|
}
|
|
1429
1448
|
function useUixLabels() {
|
|
1430
|
-
return (0,
|
|
1449
|
+
return (0, import_react9.useContext)(UixLabelsContext);
|
|
1431
1450
|
}
|
|
1432
1451
|
|
|
1433
1452
|
// src/components/Input.tsx
|
|
1434
|
-
var
|
|
1453
|
+
var import_react10 = require("react");
|
|
1435
1454
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1436
|
-
var Input = (0,
|
|
1455
|
+
var Input = (0, import_react10.forwardRef)(
|
|
1437
1456
|
({ size = "md", invalid, valid, warning, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1438
1457
|
"input",
|
|
1439
1458
|
{
|
|
@@ -1457,7 +1476,7 @@ function InputGroup({
|
|
|
1457
1476
|
"aria-invalid": invalid,
|
|
1458
1477
|
"aria-required": required
|
|
1459
1478
|
}) {
|
|
1460
|
-
const control = (0,
|
|
1479
|
+
const control = (0, import_react10.isValidElement)(children) && (id ?? describedBy ?? invalid ?? required) != null ? (0, import_react10.cloneElement)(children, {
|
|
1461
1480
|
id: children.props.id ?? id,
|
|
1462
1481
|
"aria-describedby": children.props["aria-describedby"] ?? describedBy,
|
|
1463
1482
|
"aria-invalid": children.props["aria-invalid"] ?? invalid,
|
|
@@ -1482,7 +1501,7 @@ function InputGroup({
|
|
|
1482
1501
|
}
|
|
1483
1502
|
|
|
1484
1503
|
// src/components/Combobox.tsx
|
|
1485
|
-
var
|
|
1504
|
+
var import_react11 = require("react");
|
|
1486
1505
|
|
|
1487
1506
|
// src/combobox-model.ts
|
|
1488
1507
|
function filterComboboxOptions(options, query) {
|
|
@@ -1508,18 +1527,18 @@ function Combobox({
|
|
|
1508
1527
|
className,
|
|
1509
1528
|
...props
|
|
1510
1529
|
}) {
|
|
1511
|
-
const generatedId = (0,
|
|
1530
|
+
const generatedId = (0, import_react11.useId)();
|
|
1512
1531
|
const listboxId = `${generatedId}-listbox`;
|
|
1513
|
-
const rootRef = (0,
|
|
1514
|
-
const [internalValue, setInternalValue] = (0,
|
|
1532
|
+
const rootRef = (0, import_react11.useRef)(null);
|
|
1533
|
+
const [internalValue, setInternalValue] = (0, import_react11.useState)(defaultValue ?? "");
|
|
1515
1534
|
const selectedValue = value ?? internalValue;
|
|
1516
1535
|
const selected = options.find((option) => option.value === selectedValue);
|
|
1517
|
-
const [query, setQuery] = (0,
|
|
1518
|
-
const [open, setOpen] = (0,
|
|
1519
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
1520
|
-
const filtered = (0,
|
|
1536
|
+
const [query, setQuery] = (0, import_react11.useState)(selected?.label ?? "");
|
|
1537
|
+
const [open, setOpen] = (0, import_react11.useState)(false);
|
|
1538
|
+
const [activeIndex, setActiveIndex] = (0, import_react11.useState)(0);
|
|
1539
|
+
const filtered = (0, import_react11.useMemo)(() => filterComboboxOptions(options, open ? query : ""), [open, options, query]);
|
|
1521
1540
|
const activeOption = filtered[activeIndex];
|
|
1522
|
-
(0,
|
|
1541
|
+
(0, import_react11.useEffect)(() => {
|
|
1523
1542
|
if (!open) setQuery(options.find((option) => option.value === selectedValue)?.label ?? "");
|
|
1524
1543
|
}, [open, options, selectedValue]);
|
|
1525
1544
|
const select = (option) => {
|
|
@@ -1609,7 +1628,7 @@ function Combobox({
|
|
|
1609
1628
|
}
|
|
1610
1629
|
|
|
1611
1630
|
// src/components/SearchSuggest.tsx
|
|
1612
|
-
var
|
|
1631
|
+
var import_react12 = require("react");
|
|
1613
1632
|
|
|
1614
1633
|
// src/search-suggest-model.ts
|
|
1615
1634
|
var COMBINING_MARK = /\p{M}/u;
|
|
@@ -1710,7 +1729,7 @@ function Emphasised({ text, query }) {
|
|
|
1710
1729
|
) });
|
|
1711
1730
|
}
|
|
1712
1731
|
var keepFocus = (event) => event.preventDefault();
|
|
1713
|
-
var useIsomorphicLayoutEffect3 = typeof document !== "undefined" ?
|
|
1732
|
+
var useIsomorphicLayoutEffect3 = typeof document !== "undefined" ? import_react12.useLayoutEffect : import_react12.useEffect;
|
|
1714
1733
|
function SearchSuggest({
|
|
1715
1734
|
value,
|
|
1716
1735
|
onValueChange,
|
|
@@ -1746,31 +1765,31 @@ function SearchSuggest({
|
|
|
1746
1765
|
}) {
|
|
1747
1766
|
const uixLabels = useUixLabels();
|
|
1748
1767
|
const clearLabel = clearLabelProp ?? uixLabels.searchSuggest?.clear ?? "Clear search";
|
|
1749
|
-
const id = (0,
|
|
1768
|
+
const id = (0, import_react12.useId)();
|
|
1750
1769
|
const listboxId = `${id}-listbox`;
|
|
1751
1770
|
const headingId = `${id}-heading`;
|
|
1752
|
-
const rootRef = (0,
|
|
1753
|
-
const fieldRef = (0,
|
|
1754
|
-
(0,
|
|
1755
|
-
const [openState, setOpenState] = (0,
|
|
1771
|
+
const rootRef = (0, import_react12.useRef)(null);
|
|
1772
|
+
const fieldRef = (0, import_react12.useRef)(null);
|
|
1773
|
+
(0, import_react12.useImperativeHandle)(inputRef, () => fieldRef.current, []);
|
|
1774
|
+
const [openState, setOpenState] = (0, import_react12.useState)(false);
|
|
1756
1775
|
const open = openProp ?? openState;
|
|
1757
1776
|
const setOpen = (next) => {
|
|
1758
1777
|
if (openProp === void 0) setOpenState(next);
|
|
1759
1778
|
if (next !== open) onOpenChange?.(next);
|
|
1760
1779
|
};
|
|
1761
|
-
const [focused, setFocused] = (0,
|
|
1762
|
-
const [activeState, setActive] = (0,
|
|
1780
|
+
const [focused, setFocused] = (0, import_react12.useState)(false);
|
|
1781
|
+
const [activeState, setActive] = (0, import_react12.useState)(-1);
|
|
1763
1782
|
const itemCount = options.length + (footer ? 1 : 0);
|
|
1764
1783
|
const active = activeState < itemCount ? activeState : -1;
|
|
1765
1784
|
const optionKey = options.map((option) => option.id).join("|");
|
|
1766
|
-
(0,
|
|
1785
|
+
(0, import_react12.useEffect)(() => setActive(-1), [optionKey]);
|
|
1767
1786
|
const hasText = value.trim().length > 0;
|
|
1768
1787
|
const showEmpty = hasText && !loading && !error && options.length === 0 && empty != null;
|
|
1769
1788
|
const showLoading = loading && options.length === 0;
|
|
1770
1789
|
const showIdle = idle != null && itemCount === 0 && !loading && error == null && !showEmpty;
|
|
1771
1790
|
const visible = open && (itemCount > 0 || showLoading || showEmpty || showIdle || error != null);
|
|
1772
1791
|
const optionId = (index) => `${id}-option-${index}`;
|
|
1773
|
-
(0,
|
|
1792
|
+
(0, import_react12.useEffect)(() => {
|
|
1774
1793
|
if (!visible || active < 0) return;
|
|
1775
1794
|
const node = document.getElementById(optionId(active));
|
|
1776
1795
|
node?.scrollIntoView?.({ block: "nearest" });
|
|
@@ -1853,8 +1872,8 @@ function SearchSuggest({
|
|
|
1853
1872
|
fieldRef.current?.focus();
|
|
1854
1873
|
};
|
|
1855
1874
|
const activeId = visible && active >= 0 ? optionId(active) : void 0;
|
|
1856
|
-
const fieldBoxRef = (0,
|
|
1857
|
-
const popupRef = (0,
|
|
1875
|
+
const fieldBoxRef = (0, import_react12.useRef)(null);
|
|
1876
|
+
const popupRef = (0, import_react12.useRef)(null);
|
|
1858
1877
|
const floating = strategy === "fixed";
|
|
1859
1878
|
useIsomorphicLayoutEffect3(() => {
|
|
1860
1879
|
const popup = popupRef.current;
|
|
@@ -2001,7 +2020,7 @@ function SearchSuggest({
|
|
|
2001
2020
|
}
|
|
2002
2021
|
|
|
2003
2022
|
// src/components/SearchBar.tsx
|
|
2004
|
-
var
|
|
2023
|
+
var import_react13 = require("react");
|
|
2005
2024
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2006
2025
|
var DEFAULT_SEARCH_BAR_LABELS = { clear: "Clear search", submit: "Search" };
|
|
2007
2026
|
var SearchIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", focusable: "false", children: [
|
|
@@ -2033,11 +2052,11 @@ function SearchBar({
|
|
|
2033
2052
|
}) {
|
|
2034
2053
|
const uixLabels = useUixLabels();
|
|
2035
2054
|
const labels = { ...DEFAULT_SEARCH_BAR_LABELS, ...uixLabels.searchBar, ...labelsProp };
|
|
2036
|
-
const id = (0,
|
|
2055
|
+
const id = (0, import_react13.useId)();
|
|
2037
2056
|
const fieldId = inputId ?? `${id}-field`;
|
|
2038
2057
|
const labelId = `${id}-label`;
|
|
2039
|
-
const field = (0,
|
|
2040
|
-
const [own, setOwn] = (0,
|
|
2058
|
+
const field = (0, import_react13.useRef)(null);
|
|
2059
|
+
const [own, setOwn] = (0, import_react13.useState)(defaultValue);
|
|
2041
2060
|
const value = valueProp ?? own;
|
|
2042
2061
|
const change = (next) => {
|
|
2043
2062
|
setOwn(next);
|
|
@@ -2059,7 +2078,7 @@ function SearchBar({
|
|
|
2059
2078
|
clear();
|
|
2060
2079
|
}
|
|
2061
2080
|
};
|
|
2062
|
-
const setField = (0,
|
|
2081
|
+
const setField = (0, import_react13.useCallback)((node) => {
|
|
2063
2082
|
field.current = node;
|
|
2064
2083
|
if (typeof inputRef === "function") inputRef(node);
|
|
2065
2084
|
else if (inputRef) inputRef.current = node;
|
|
@@ -2113,7 +2132,7 @@ function SearchBar({
|
|
|
2113
2132
|
}
|
|
2114
2133
|
|
|
2115
2134
|
// src/components/EntityPicker.tsx
|
|
2116
|
-
var
|
|
2135
|
+
var import_react14 = require("react");
|
|
2117
2136
|
|
|
2118
2137
|
// src/fill-label.ts
|
|
2119
2138
|
function fillLabel(template, values) {
|
|
@@ -2158,21 +2177,21 @@ function EntityPicker({
|
|
|
2158
2177
|
className
|
|
2159
2178
|
}) {
|
|
2160
2179
|
const labels = { ...DEFAULT_ENTITY_PICKER_LABELS, ...useUixLabels().entityPicker, ...labelOverrides };
|
|
2161
|
-
const [editing, setEditing] = (0,
|
|
2162
|
-
const [query, setQuery] = (0,
|
|
2163
|
-
const [results, setResults] = (0,
|
|
2164
|
-
const [hasMore, setHasMore] = (0,
|
|
2165
|
-
const [status, setStatus] = (0,
|
|
2166
|
-
const [attempt, setAttempt] = (0,
|
|
2167
|
-
const latest = (0,
|
|
2168
|
-
const inputRef = (0,
|
|
2169
|
-
const valueButtonRef = (0,
|
|
2170
|
-
const returnFocus = (0,
|
|
2171
|
-
(0,
|
|
2180
|
+
const [editing, setEditing] = (0, import_react14.useState)(value == null);
|
|
2181
|
+
const [query, setQuery] = (0, import_react14.useState)("");
|
|
2182
|
+
const [results, setResults] = (0, import_react14.useState)([]);
|
|
2183
|
+
const [hasMore, setHasMore] = (0, import_react14.useState)(false);
|
|
2184
|
+
const [status, setStatus] = (0, import_react14.useState)("idle");
|
|
2185
|
+
const [attempt, setAttempt] = (0, import_react14.useState)(0);
|
|
2186
|
+
const latest = (0, import_react14.useRef)(0);
|
|
2187
|
+
const inputRef = (0, import_react14.useRef)(null);
|
|
2188
|
+
const valueButtonRef = (0, import_react14.useRef)(null);
|
|
2189
|
+
const returnFocus = (0, import_react14.useRef)(false);
|
|
2190
|
+
(0, import_react14.useEffect)(() => {
|
|
2172
2191
|
if (value) setEditing(false);
|
|
2173
2192
|
else setEditing(true);
|
|
2174
2193
|
}, [value?.id]);
|
|
2175
|
-
(0,
|
|
2194
|
+
(0, import_react14.useEffect)(() => {
|
|
2176
2195
|
if (!editing || disabled) return;
|
|
2177
2196
|
const q = query.trim();
|
|
2178
2197
|
if (q.length < minQueryLength) {
|
|
@@ -2203,7 +2222,7 @@ function EntityPicker({
|
|
|
2203
2222
|
}, delay);
|
|
2204
2223
|
return () => window.clearTimeout(timer);
|
|
2205
2224
|
}, [editing, query, attempt, minQueryLength, delay, disabled]);
|
|
2206
|
-
(0,
|
|
2225
|
+
(0, import_react14.useEffect)(() => {
|
|
2207
2226
|
if (!returnFocus.current) return;
|
|
2208
2227
|
returnFocus.current = false;
|
|
2209
2228
|
(editing ? inputRef.current : valueButtonRef.current)?.focus();
|
|
@@ -2296,9 +2315,9 @@ function EntityPicker({
|
|
|
2296
2315
|
}
|
|
2297
2316
|
|
|
2298
2317
|
// src/components/Textarea.tsx
|
|
2299
|
-
var
|
|
2318
|
+
var import_react15 = require("react");
|
|
2300
2319
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2301
|
-
var Textarea = (0,
|
|
2320
|
+
var Textarea = (0, import_react15.forwardRef)(
|
|
2302
2321
|
({ invalid, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2303
2322
|
"textarea",
|
|
2304
2323
|
{
|
|
@@ -2312,15 +2331,15 @@ var Textarea = (0, import_react14.forwardRef)(
|
|
|
2312
2331
|
Textarea.displayName = "Textarea";
|
|
2313
2332
|
|
|
2314
2333
|
// src/components/InlineEdit.tsx
|
|
2315
|
-
var
|
|
2334
|
+
var import_react17 = require("react");
|
|
2316
2335
|
|
|
2317
2336
|
// src/icons/Icon.tsx
|
|
2318
|
-
var
|
|
2337
|
+
var import_react16 = require("react");
|
|
2319
2338
|
var SIZES = /* @__PURE__ */ new Set(["sm", "md", "lg"]);
|
|
2320
2339
|
function renderIcon(node, { size = "md", tone = "current", label, strokeWidth = 2, className, style, ...rest }, ref) {
|
|
2321
2340
|
const tokenSize = typeof size === "string" && SIZES.has(size);
|
|
2322
2341
|
const length = typeof size === "number" ? `${size}px` : tokenSize ? void 0 : size;
|
|
2323
|
-
return (0,
|
|
2342
|
+
return (0, import_react16.createElement)(
|
|
2324
2343
|
"svg",
|
|
2325
2344
|
{
|
|
2326
2345
|
ref,
|
|
@@ -2339,11 +2358,11 @@ function renderIcon(node, { size = "md", tone = "current", label, strokeWidth =
|
|
|
2339
2358
|
"aria-hidden": label ? void 0 : true,
|
|
2340
2359
|
...rest
|
|
2341
2360
|
},
|
|
2342
|
-
node.map(([tag, attrs], i) => (0,
|
|
2361
|
+
node.map(([tag, attrs], i) => (0, import_react16.createElement)(tag, { key: i, ...attrs }))
|
|
2343
2362
|
);
|
|
2344
2363
|
}
|
|
2345
2364
|
function createIcon(displayName, node) {
|
|
2346
|
-
const Component = (0,
|
|
2365
|
+
const Component = (0, import_react16.forwardRef)((props, ref) => renderIcon(node, props, ref));
|
|
2347
2366
|
Component.displayName = displayName;
|
|
2348
2367
|
return Component;
|
|
2349
2368
|
}
|
|
@@ -2413,24 +2432,24 @@ function InlineEdit({
|
|
|
2413
2432
|
className
|
|
2414
2433
|
}) {
|
|
2415
2434
|
const labels = { ...DEFAULT_INLINE_EDIT_LABELS, ...useUixLabels().inlineEdit, ...labelOverrides };
|
|
2416
|
-
const id = (0,
|
|
2435
|
+
const id = (0, import_react17.useId)();
|
|
2417
2436
|
const errorId = `${id}-error`;
|
|
2418
|
-
const [editing, setEditing] = (0,
|
|
2419
|
-
const [draft, setDraft] = (0,
|
|
2420
|
-
const [pending, setPending] = (0,
|
|
2421
|
-
const [error, setError] = (0,
|
|
2422
|
-
const [status, setStatus] = (0,
|
|
2423
|
-
const viewRef = (0,
|
|
2424
|
-
const editorRef = (0,
|
|
2425
|
-
const focusNext = (0,
|
|
2426
|
-
const mounted = (0,
|
|
2427
|
-
(0,
|
|
2437
|
+
const [editing, setEditing] = (0, import_react17.useState)(false);
|
|
2438
|
+
const [draft, setDraft] = (0, import_react17.useState)(value);
|
|
2439
|
+
const [pending, setPending] = (0, import_react17.useState)(false);
|
|
2440
|
+
const [error, setError] = (0, import_react17.useState)();
|
|
2441
|
+
const [status, setStatus] = (0, import_react17.useState)("");
|
|
2442
|
+
const viewRef = (0, import_react17.useRef)(null);
|
|
2443
|
+
const editorRef = (0, import_react17.useRef)(null);
|
|
2444
|
+
const focusNext = (0, import_react17.useRef)(null);
|
|
2445
|
+
const mounted = (0, import_react17.useRef)(true);
|
|
2446
|
+
(0, import_react17.useEffect)(() => {
|
|
2428
2447
|
mounted.current = true;
|
|
2429
2448
|
return () => {
|
|
2430
2449
|
mounted.current = false;
|
|
2431
2450
|
};
|
|
2432
2451
|
}, []);
|
|
2433
|
-
(0,
|
|
2452
|
+
(0, import_react17.useEffect)(() => {
|
|
2434
2453
|
const target = focusNext.current;
|
|
2435
2454
|
if (!target) return;
|
|
2436
2455
|
focusNext.current = null;
|
|
@@ -2554,10 +2573,10 @@ function InlineEdit({
|
|
|
2554
2573
|
}
|
|
2555
2574
|
|
|
2556
2575
|
// src/components/Select.tsx
|
|
2557
|
-
var
|
|
2576
|
+
var import_react21 = require("react");
|
|
2558
2577
|
|
|
2559
2578
|
// src/components/Drawer.tsx
|
|
2560
|
-
var
|
|
2579
|
+
var import_react20 = require("react");
|
|
2561
2580
|
|
|
2562
2581
|
// src/hooks/backdropDismiss.ts
|
|
2563
2582
|
function isBackdropClick(e) {
|
|
@@ -2574,12 +2593,12 @@ function backdropDismiss(onClose, onClick, enabled = true) {
|
|
|
2574
2593
|
}
|
|
2575
2594
|
|
|
2576
2595
|
// src/components/DiscardPrompt.tsx
|
|
2577
|
-
var
|
|
2596
|
+
var import_react19 = require("react");
|
|
2578
2597
|
|
|
2579
2598
|
// src/components/Popover.tsx
|
|
2580
|
-
var
|
|
2599
|
+
var import_react18 = require("react");
|
|
2581
2600
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2582
|
-
var useIsomorphicLayoutEffect4 = typeof document !== "undefined" ?
|
|
2601
|
+
var useIsomorphicLayoutEffect4 = typeof document !== "undefined" ? import_react18.useLayoutEffect : import_react18.useEffect;
|
|
2583
2602
|
var PLACING = "data-uix-placing";
|
|
2584
2603
|
var isPopoverOpen = (el) => {
|
|
2585
2604
|
try {
|
|
@@ -2610,10 +2629,10 @@ function Popover({
|
|
|
2610
2629
|
const popover = popoverProp ?? (hover ? "manual" : "auto");
|
|
2611
2630
|
const openDelay = typeof openOnHover === "object" ? openOnHover.openDelay ?? 300 : 300;
|
|
2612
2631
|
const closeDelay = typeof openOnHover === "object" ? openOnHover.closeDelay ?? 150 : 150;
|
|
2613
|
-
const ref = (0,
|
|
2614
|
-
const [open, setOpen] = (0,
|
|
2615
|
-
const openRef = (0,
|
|
2616
|
-
const onAnchorHiddenRef = (0,
|
|
2632
|
+
const ref = (0, import_react18.useRef)(null);
|
|
2633
|
+
const [open, setOpen] = (0, import_react18.useState)(false);
|
|
2634
|
+
const openRef = (0, import_react18.useRef)(false);
|
|
2635
|
+
const onAnchorHiddenRef = (0, import_react18.useRef)(onAnchorHidden);
|
|
2617
2636
|
onAnchorHiddenRef.current = onAnchorHidden;
|
|
2618
2637
|
const popoverAttr = { popover };
|
|
2619
2638
|
const reposition = useAnchoredPosition(anchor ?? null, ref, {
|
|
@@ -2630,7 +2649,7 @@ function Popover({
|
|
|
2630
2649
|
el.hidePopover();
|
|
2631
2650
|
} : void 0
|
|
2632
2651
|
});
|
|
2633
|
-
(0,
|
|
2652
|
+
(0, import_react18.useEffect)(() => {
|
|
2634
2653
|
const el = ref.current;
|
|
2635
2654
|
if (!el || !anchor) return;
|
|
2636
2655
|
const hold = (event) => {
|
|
@@ -2663,7 +2682,7 @@ function Popover({
|
|
|
2663
2682
|
el.removeAttribute(PLACING);
|
|
2664
2683
|
};
|
|
2665
2684
|
}, [anchor, reposition]);
|
|
2666
|
-
(0,
|
|
2685
|
+
(0, import_react18.useEffect)(() => {
|
|
2667
2686
|
const el = ref.current;
|
|
2668
2687
|
const anchorEl = resolveAnchor(anchor);
|
|
2669
2688
|
if (!hover || !el || !anchorEl) return;
|
|
@@ -2749,7 +2768,7 @@ function Popover({
|
|
|
2749
2768
|
|
|
2750
2769
|
// src/components/DiscardPrompt.tsx
|
|
2751
2770
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2752
|
-
var useIsomorphicLayoutEffect5 = typeof document !== "undefined" ?
|
|
2771
|
+
var useIsomorphicLayoutEffect5 = typeof document !== "undefined" ? import_react19.useLayoutEffect : import_react19.useEffect;
|
|
2753
2772
|
var anyAutoPopoverOpen = () => {
|
|
2754
2773
|
try {
|
|
2755
2774
|
return !!document.querySelector('[popover]:not([popover="manual"]):popover-open');
|
|
@@ -2763,9 +2782,9 @@ var DEFAULT_DISCARD_LABELS = {
|
|
|
2763
2782
|
keepEditing: "Keep editing",
|
|
2764
2783
|
discard: "Discard"
|
|
2765
2784
|
};
|
|
2766
|
-
var DialogCloseContext = (0,
|
|
2767
|
-
var DialogClose = (0,
|
|
2768
|
-
const dialog = (0,
|
|
2785
|
+
var DialogCloseContext = (0, import_react19.createContext)(null);
|
|
2786
|
+
var DialogClose = (0, import_react19.forwardRef)(({ onClick, type = "button", ...props }, ref) => {
|
|
2787
|
+
const dialog = (0, import_react19.useContext)(DialogCloseContext);
|
|
2769
2788
|
const pending = !!dialog?.pending;
|
|
2770
2789
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2771
2790
|
Button,
|
|
@@ -2790,18 +2809,18 @@ DialogClose.displayName = "DialogClose";
|
|
|
2790
2809
|
function useGuardedDialog({ open, onClose, dirty = false, pending = false, labels: labelsProp, closeRef }) {
|
|
2791
2810
|
const uixLabels = useUixLabels();
|
|
2792
2811
|
const labels = { ...DEFAULT_DISCARD_LABELS, ...uixLabels.discardPrompt, ...labelsProp };
|
|
2793
|
-
const panelId = `${(0,
|
|
2794
|
-
const [prompt, setPromptState] = (0,
|
|
2795
|
-
const latest = (0,
|
|
2812
|
+
const panelId = `${(0, import_react19.useId)()}-discard`;
|
|
2813
|
+
const [prompt, setPromptState] = (0, import_react19.useState)(null);
|
|
2814
|
+
const latest = (0, import_react19.useRef)({ open, onClose, dirty, pending, prompt });
|
|
2796
2815
|
useIsomorphicLayoutEffect5(() => {
|
|
2797
2816
|
latest.current = { ...latest.current, open, onClose, dirty, pending };
|
|
2798
2817
|
});
|
|
2799
|
-
const setPrompt = (0,
|
|
2818
|
+
const setPrompt = (0, import_react19.useCallback)((next) => {
|
|
2800
2819
|
latest.current.prompt = next;
|
|
2801
2820
|
setPromptState(next);
|
|
2802
2821
|
}, []);
|
|
2803
2822
|
const guarded = () => !!latest.current.onClose && (latest.current.dirty || latest.current.pending);
|
|
2804
|
-
const requestClose = (0,
|
|
2823
|
+
const requestClose = (0, import_react19.useCallback)((anchor, event) => {
|
|
2805
2824
|
const { open: isOpen2, onClose: close, dirty: isDirty, pending: isPending, prompt: asking } = latest.current;
|
|
2806
2825
|
if (!isOpen2 || !close || isPending || asking) return;
|
|
2807
2826
|
if (!isDirty) {
|
|
@@ -2811,9 +2830,9 @@ function useGuardedDialog({ open, onClose, dirty = false, pending = false, label
|
|
|
2811
2830
|
const active = document.activeElement;
|
|
2812
2831
|
setPrompt({ anchor: anchor ?? closeRef.current, returnTo: active instanceof HTMLElement ? active : null });
|
|
2813
2832
|
}, [closeRef, setPrompt]);
|
|
2814
|
-
const dialogRef = (0,
|
|
2815
|
-
const backOut = (0,
|
|
2816
|
-
const keepEditing = (0,
|
|
2833
|
+
const dialogRef = (0, import_react19.useRef)(null);
|
|
2834
|
+
const backOut = (0, import_react19.useRef)({ focus: null, forced: false });
|
|
2835
|
+
const keepEditing = (0, import_react19.useCallback)(() => {
|
|
2817
2836
|
const asked = latest.current.prompt;
|
|
2818
2837
|
setPrompt(null);
|
|
2819
2838
|
const target = asked?.returnTo;
|
|
@@ -2833,17 +2852,17 @@ function useGuardedDialog({ open, onClose, dirty = false, pending = false, label
|
|
|
2833
2852
|
return true;
|
|
2834
2853
|
});
|
|
2835
2854
|
dialogRef.current = ref.current;
|
|
2836
|
-
const discard = (0,
|
|
2855
|
+
const discard = (0, import_react19.useCallback)((event) => {
|
|
2837
2856
|
setPrompt(null);
|
|
2838
2857
|
latest.current.onClose?.(event);
|
|
2839
2858
|
}, [setPrompt]);
|
|
2840
|
-
(0,
|
|
2859
|
+
(0, import_react19.useEffect)(() => {
|
|
2841
2860
|
if (open && dirty && !pending) return;
|
|
2842
2861
|
if (!latest.current.prompt) return;
|
|
2843
2862
|
if (open && document.getElementById(panelId)?.contains(document.activeElement)) keepEditing();
|
|
2844
2863
|
else setPrompt(null);
|
|
2845
2864
|
}, [open, dirty, pending, panelId, keepEditing, setPrompt]);
|
|
2846
|
-
(0,
|
|
2865
|
+
(0, import_react19.useEffect)(() => {
|
|
2847
2866
|
const el = ref.current;
|
|
2848
2867
|
dialogRef.current = el;
|
|
2849
2868
|
if (!el || !open) return;
|
|
@@ -2920,9 +2939,9 @@ function useGuardedDialog({ open, onClose, dirty = false, pending = false, label
|
|
|
2920
2939
|
return { ref, requestClose, onKeyDown, prompt: element, provide };
|
|
2921
2940
|
}
|
|
2922
2941
|
function DiscardPrompt({ id, prompt, labels, onKeepEditing, onDismiss, onDiscard }) {
|
|
2923
|
-
const keepRef = (0,
|
|
2942
|
+
const keepRef = (0, import_react19.useRef)(null);
|
|
2924
2943
|
const open = prompt != null;
|
|
2925
|
-
(0,
|
|
2944
|
+
(0, import_react19.useEffect)(() => {
|
|
2926
2945
|
const panel = document.getElementById(id);
|
|
2927
2946
|
if (!panel) return;
|
|
2928
2947
|
const shown = () => {
|
|
@@ -3006,9 +3025,9 @@ function Drawer({
|
|
|
3006
3025
|
}) {
|
|
3007
3026
|
const uixLabels = useUixLabels();
|
|
3008
3027
|
const closeLabel = closeLabelProp ?? uixLabels.drawer?.close ?? "Close drawer";
|
|
3009
|
-
const closeRef = (0,
|
|
3028
|
+
const closeRef = (0, import_react20.useRef)(null);
|
|
3010
3029
|
const guard = useGuardedDialog({ open, onClose, dirty, pending, labels: discardLabels, closeRef });
|
|
3011
|
-
const titleId = (0,
|
|
3030
|
+
const titleId = (0, import_react20.useId)();
|
|
3012
3031
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3013
3032
|
"dialog",
|
|
3014
3033
|
{
|
|
@@ -3151,7 +3170,7 @@ function toggleValue(values, value) {
|
|
|
3151
3170
|
|
|
3152
3171
|
// src/components/Select.tsx
|
|
3153
3172
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3154
|
-
var useIsomorphicLayoutEffect6 = typeof document !== "undefined" ?
|
|
3173
|
+
var useIsomorphicLayoutEffect6 = typeof document !== "undefined" ? import_react21.useLayoutEffect : import_react21.useEffect;
|
|
3155
3174
|
var DEFAULT_LABELS = {
|
|
3156
3175
|
search: "Search options",
|
|
3157
3176
|
searchPlaceholder: "Search\u2026",
|
|
@@ -3170,7 +3189,7 @@ function textOf(node) {
|
|
|
3170
3189
|
if (node == null || typeof node === "boolean") return "";
|
|
3171
3190
|
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
3172
3191
|
if (Array.isArray(node)) return node.map(textOf).join("");
|
|
3173
|
-
if ((0,
|
|
3192
|
+
if ((0, import_react21.isValidElement)(node)) return textOf(node.props.children);
|
|
3174
3193
|
return "";
|
|
3175
3194
|
}
|
|
3176
3195
|
function parseOption(el) {
|
|
@@ -3186,9 +3205,9 @@ function parseOption(el) {
|
|
|
3186
3205
|
function parseChildren(children) {
|
|
3187
3206
|
const out = [];
|
|
3188
3207
|
const walk = (nodes, into) => {
|
|
3189
|
-
|
|
3190
|
-
if (!(0,
|
|
3191
|
-
if (child.type ===
|
|
3208
|
+
import_react21.Children.forEach(nodes, (child) => {
|
|
3209
|
+
if (!(0, import_react21.isValidElement)(child)) return;
|
|
3210
|
+
if (child.type === import_react21.Fragment) walk(child.props.children, into);
|
|
3192
3211
|
else if (child.type === "option") (into ?? out).push(parseOption(child));
|
|
3193
3212
|
else if (child.type === "optgroup" && !into) {
|
|
3194
3213
|
const p = child.props;
|
|
@@ -3268,7 +3287,7 @@ function labelText(trigger, own, ariaLabel, labelledBy) {
|
|
|
3268
3287
|
return labels ? Array.from(labels).map(read).join(" ").trim() : "";
|
|
3269
3288
|
}
|
|
3270
3289
|
var CheckIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M20 6 9 17l-5-5" }) });
|
|
3271
|
-
var Select = (0,
|
|
3290
|
+
var Select = (0, import_react21.forwardRef)(function Select2(props, forwardedRef) {
|
|
3272
3291
|
const {
|
|
3273
3292
|
size = "md",
|
|
3274
3293
|
className,
|
|
@@ -3307,18 +3326,18 @@ var Select = (0, import_react20.forwardRef)(function Select2(props, forwardedRef
|
|
|
3307
3326
|
} = props;
|
|
3308
3327
|
const uixLabels = useUixLabels();
|
|
3309
3328
|
const labels = { ...DEFAULT_LABELS, ...uixLabels.select, ...labelsProp };
|
|
3310
|
-
const uid = (0,
|
|
3329
|
+
const uid = (0, import_react21.useId)();
|
|
3311
3330
|
const listId = `${uid}-listbox`;
|
|
3312
3331
|
const optionId = (index) => `${uid}-option-${index}`;
|
|
3313
|
-
const triggerRef = (0,
|
|
3314
|
-
const proxyRef = (0,
|
|
3315
|
-
const popupRef = (0,
|
|
3316
|
-
const listRef = (0,
|
|
3317
|
-
const searchRef = (0,
|
|
3318
|
-
const staticItems = (0,
|
|
3319
|
-
const formModel = (0,
|
|
3332
|
+
const triggerRef = (0, import_react21.useRef)(null);
|
|
3333
|
+
const proxyRef = (0, import_react21.useRef)(null);
|
|
3334
|
+
const popupRef = (0, import_react21.useRef)(null);
|
|
3335
|
+
const listRef = (0, import_react21.useRef)(null);
|
|
3336
|
+
const searchRef = (0, import_react21.useRef)(null);
|
|
3337
|
+
const staticItems = (0, import_react21.useMemo)(() => options ? [...options] : parseChildren(children), [options, children]);
|
|
3338
|
+
const formModel = (0, import_react21.useMemo)(() => buildSelectModel(staticItems), [staticItems]);
|
|
3320
3339
|
const controlled = value !== void 0;
|
|
3321
|
-
const [internal, setInternal] = (0,
|
|
3340
|
+
const [internal, setInternal] = (0, import_react21.useState)(() => {
|
|
3322
3341
|
if (defaultValue !== void 0) return toValueList(defaultValue);
|
|
3323
3342
|
const marked = formModel.all.filter((e) => e.option.selected).map((e) => e.option.value);
|
|
3324
3343
|
if (multiple) return marked;
|
|
@@ -3329,25 +3348,25 @@ var Select = (0, import_react20.forwardRef)(function Select2(props, forwardedRef
|
|
|
3329
3348
|
});
|
|
3330
3349
|
const values = controlled ? toValueList(value) : internal;
|
|
3331
3350
|
const current = values[0] ?? "";
|
|
3332
|
-
const valuesRef = (0,
|
|
3351
|
+
const valuesRef = (0, import_react21.useRef)(values);
|
|
3333
3352
|
valuesRef.current = values;
|
|
3334
|
-
const controlledRef = (0,
|
|
3353
|
+
const controlledRef = (0, import_react21.useRef)(controlled);
|
|
3335
3354
|
controlledRef.current = controlled;
|
|
3336
|
-
const [initialDefault] = (0,
|
|
3337
|
-
const [open, setOpen] = (0,
|
|
3338
|
-
const [mode, setMode] = (0,
|
|
3339
|
-
const [active, setActive] = (0,
|
|
3340
|
-
const [query, setQuery] = (0,
|
|
3341
|
-
const [listLabel, setListLabel] = (0,
|
|
3342
|
-
const [formInvalid, setFormInvalid] = (0,
|
|
3343
|
-
const snapshot = (0,
|
|
3344
|
-
const typed = (0,
|
|
3345
|
-
const loadRef = (0,
|
|
3355
|
+
const [initialDefault] = (0, import_react21.useState)(() => multiple ? values : current);
|
|
3356
|
+
const [open, setOpen] = (0, import_react21.useState)(false);
|
|
3357
|
+
const [mode, setMode] = (0, import_react21.useState)("popover");
|
|
3358
|
+
const [active, setActive] = (0, import_react21.useState)(-1);
|
|
3359
|
+
const [query, setQuery] = (0, import_react21.useState)("");
|
|
3360
|
+
const [listLabel, setListLabel] = (0, import_react21.useState)("");
|
|
3361
|
+
const [formInvalid, setFormInvalid] = (0, import_react21.useState)(false);
|
|
3362
|
+
const snapshot = (0, import_react21.useRef)([]);
|
|
3363
|
+
const typed = (0, import_react21.useRef)({ text: "", timer: null });
|
|
3364
|
+
const loadRef = (0, import_react21.useRef)(loadOptions);
|
|
3346
3365
|
loadRef.current = loadOptions;
|
|
3347
3366
|
const hasLoader = !!loadOptions;
|
|
3348
|
-
const [asyncState, setAsyncState] = (0,
|
|
3349
|
-
const request = (0,
|
|
3350
|
-
const load = (0,
|
|
3367
|
+
const [asyncState, setAsyncState] = (0, import_react21.useState)({ status: "idle", items: [], seen: /* @__PURE__ */ new Map() });
|
|
3368
|
+
const request = (0, import_react21.useRef)(null);
|
|
3369
|
+
const load = (0, import_react21.useCallback)((q) => {
|
|
3351
3370
|
const loader = loadRef.current;
|
|
3352
3371
|
if (!loader) return;
|
|
3353
3372
|
request.current?.abort();
|
|
@@ -3366,23 +3385,23 @@ var Select = (0, import_react20.forwardRef)(function Select2(props, forwardedRef
|
|
|
3366
3385
|
setAsyncState((s) => ({ ...s, status: "error", items: [] }));
|
|
3367
3386
|
});
|
|
3368
3387
|
}, []);
|
|
3369
|
-
(0,
|
|
3388
|
+
(0, import_react21.useEffect)(() => {
|
|
3370
3389
|
if (!open || !hasLoader) return void 0;
|
|
3371
3390
|
request.current?.abort();
|
|
3372
3391
|
const timer = setTimeout(() => load(query), query ? 200 : 0);
|
|
3373
3392
|
return () => clearTimeout(timer);
|
|
3374
3393
|
}, [open, query, hasLoader, load]);
|
|
3375
|
-
(0,
|
|
3394
|
+
(0, import_react21.useEffect)(() => {
|
|
3376
3395
|
if (!open) request.current?.abort();
|
|
3377
3396
|
}, [open]);
|
|
3378
|
-
(0,
|
|
3397
|
+
(0, import_react21.useEffect)(() => () => request.current?.abort(), []);
|
|
3379
3398
|
const isSearchable = searchable === true || searchable === "auto" && countSelectOptions(staticItems) > 12;
|
|
3380
3399
|
const listItems = hasLoader ? asyncState.items : isSearchable ? filterSelectItems(staticItems, query) : staticItems;
|
|
3381
|
-
const listModel = (0,
|
|
3400
|
+
const listModel = (0, import_react21.useMemo)(() => buildSelectModel(listItems), [listItems]);
|
|
3382
3401
|
const entries = listModel.entries;
|
|
3383
3402
|
const activeEntry = active >= 0 ? entries[active] : void 0;
|
|
3384
3403
|
const known = (v) => formModel.all.find((e) => e.option.value === v)?.option ?? asyncState.seen.get(v);
|
|
3385
|
-
const proxyOptions = (0,
|
|
3404
|
+
const proxyOptions = (0, import_react21.useMemo)(() => {
|
|
3386
3405
|
const list = [];
|
|
3387
3406
|
const have = /* @__PURE__ */ new Set();
|
|
3388
3407
|
for (const e of formModel.all) {
|
|
@@ -3403,7 +3422,7 @@ var Select = (0, import_react20.forwardRef)(function Select2(props, forwardedRef
|
|
|
3403
3422
|
}
|
|
3404
3423
|
return list;
|
|
3405
3424
|
}, [formModel, asyncState.seen, values, multiple, placeholder]);
|
|
3406
|
-
const syncProxy = (0,
|
|
3425
|
+
const syncProxy = (0, import_react21.useCallback)(() => {
|
|
3407
3426
|
const proxy = proxyRef.current;
|
|
3408
3427
|
if (!proxy) return;
|
|
3409
3428
|
const now = readProxy(proxy);
|
|
@@ -3414,7 +3433,7 @@ var Select = (0, import_react20.forwardRef)(function Select2(props, forwardedRef
|
|
|
3414
3433
|
useIsomorphicLayoutEffect6(() => {
|
|
3415
3434
|
syncProxy();
|
|
3416
3435
|
});
|
|
3417
|
-
const fromOutside = (0,
|
|
3436
|
+
const fromOutside = (0, import_react21.useCallback)(() => {
|
|
3418
3437
|
const proxy = proxyRef.current;
|
|
3419
3438
|
if (!proxy || controlledRef.current) return;
|
|
3420
3439
|
const read = readProxy(proxy);
|
|
@@ -3422,7 +3441,7 @@ var Select = (0, import_react20.forwardRef)(function Select2(props, forwardedRef
|
|
|
3422
3441
|
valuesRef.current = next;
|
|
3423
3442
|
setInternal(next);
|
|
3424
3443
|
}, [multiple]);
|
|
3425
|
-
const setProxyRef = (0,
|
|
3444
|
+
const setProxyRef = (0, import_react21.useCallback)((el) => {
|
|
3426
3445
|
proxyRef.current = el;
|
|
3427
3446
|
if (el) {
|
|
3428
3447
|
watchWrites(el, ["value", "selectedIndex"], selectProto, fromOutside);
|
|
@@ -3435,7 +3454,7 @@ var Select = (0, import_react20.forwardRef)(function Select2(props, forwardedRef
|
|
|
3435
3454
|
const el = proxyRef.current;
|
|
3436
3455
|
if (el) for (const o of Array.from(el.options)) watchWrites(o, ["selected"], optionProto, fromOutside);
|
|
3437
3456
|
});
|
|
3438
|
-
(0,
|
|
3457
|
+
(0, import_react21.useEffect)(() => {
|
|
3439
3458
|
const proxy = proxyRef.current;
|
|
3440
3459
|
if (!proxy) return void 0;
|
|
3441
3460
|
const doc = proxy.ownerDocument;
|
|
@@ -3459,7 +3478,7 @@ var Select = (0, import_react20.forwardRef)(function Select2(props, forwardedRef
|
|
|
3459
3478
|
proxy.removeEventListener("focus", onProxyFocus);
|
|
3460
3479
|
};
|
|
3461
3480
|
}, [multiple, syncProxy]);
|
|
3462
|
-
const changed = (0,
|
|
3481
|
+
const changed = (0, import_react21.useRef)(void 0);
|
|
3463
3482
|
const commit = (next, option) => {
|
|
3464
3483
|
const proxy = proxyRef.current;
|
|
3465
3484
|
changed.current = option;
|
|
@@ -3537,7 +3556,7 @@ var Select = (0, import_react20.forwardRef)(function Select2(props, forwardedRef
|
|
|
3537
3556
|
}, TYPEAHEAD_MS);
|
|
3538
3557
|
return typeahead(list, state.text, from);
|
|
3539
3558
|
};
|
|
3540
|
-
(0,
|
|
3559
|
+
(0, import_react21.useEffect)(() => () => {
|
|
3541
3560
|
if (typed.current.timer) clearTimeout(typed.current.timer);
|
|
3542
3561
|
}, []);
|
|
3543
3562
|
const printable = (e) => e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey;
|
|
@@ -3689,7 +3708,7 @@ var Select = (0, import_react20.forwardRef)(function Select2(props, forwardedRef
|
|
|
3689
3708
|
}
|
|
3690
3709
|
}, [showing, isSearchable]);
|
|
3691
3710
|
useAnchoredPosition(triggerRef, popupRef, { open: showing, placement, offset: OFFSET, padding: EDGE });
|
|
3692
|
-
(0,
|
|
3711
|
+
(0, import_react21.useEffect)(() => {
|
|
3693
3712
|
if (open && mode === "sheet") (isSearchable ? searchRef.current : listRef.current)?.focus({ preventScroll: true });
|
|
3694
3713
|
}, [open, mode, isSearchable]);
|
|
3695
3714
|
useIsomorphicLayoutEffect6(() => {
|
|
@@ -3702,7 +3721,7 @@ var Select = (0, import_react20.forwardRef)(function Select2(props, forwardedRef
|
|
|
3702
3721
|
if (top < list.scrollTop) list.scrollTop = top;
|
|
3703
3722
|
else if (bottom > list.scrollTop + list.clientHeight) list.scrollTop = bottom - list.clientHeight;
|
|
3704
3723
|
}, [open, active, mode]);
|
|
3705
|
-
(0,
|
|
3724
|
+
(0, import_react21.useEffect)(() => {
|
|
3706
3725
|
if (!showing) return void 0;
|
|
3707
3726
|
const doc = triggerRef.current?.ownerDocument;
|
|
3708
3727
|
if (!doc) return void 0;
|
|
@@ -3810,7 +3829,7 @@ var Select = (0, import_react20.forwardRef)(function Select2(props, forwardedRef
|
|
|
3810
3829
|
children: listModel.sections.map((section, i) => section.label != null ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { role: "group", className: "uix-listbox__group", "aria-labelledby": `${uid}-group-${i}`, "aria-disabled": section.disabled || void 0, children: [
|
|
3811
3830
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { id: `${uid}-group-${i}`, role: "presentation", className: "uix-listbox__group-label", children: section.label }),
|
|
3812
3831
|
section.entries.map(renderEntry)
|
|
3813
|
-
] }, `g${i}`) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3832
|
+
] }, `g${i}`) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react21.Fragment, { children: section.entries.map(renderEntry) }, `s${i}`))
|
|
3814
3833
|
}
|
|
3815
3834
|
);
|
|
3816
3835
|
const stateRow = status === "loading" && empty ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "uix-select__state", role: "status", children: [
|
|
@@ -3939,14 +3958,14 @@ var Select = (0, import_react20.forwardRef)(function Select2(props, forwardedRef
|
|
|
3939
3958
|
Select.displayName = "Select";
|
|
3940
3959
|
|
|
3941
3960
|
// src/components/Checkbox.tsx
|
|
3942
|
-
var
|
|
3961
|
+
var import_react22 = require("react");
|
|
3943
3962
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3944
3963
|
var CheckIcon3 = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("polyline", { points: "1.5,6 4.5,9 10.5,3" }) });
|
|
3945
3964
|
var IndeterminateIcon = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: "2", y: "5", width: "8", height: "2", rx: "1", fill: "currentColor" }) });
|
|
3946
|
-
var Checkbox = (0,
|
|
3965
|
+
var Checkbox = (0, import_react22.forwardRef)(
|
|
3947
3966
|
({ label, indeterminate, className, ...props }, forwardedRef) => {
|
|
3948
|
-
const innerRef = (0,
|
|
3949
|
-
(0,
|
|
3967
|
+
const innerRef = (0, import_react22.useRef)(null);
|
|
3968
|
+
(0, import_react22.useEffect)(() => {
|
|
3950
3969
|
const el = innerRef.current;
|
|
3951
3970
|
if (el) el.indeterminate = !!indeterminate;
|
|
3952
3971
|
}, [indeterminate]);
|
|
@@ -3971,9 +3990,9 @@ var Checkbox = (0, import_react21.forwardRef)(
|
|
|
3971
3990
|
Checkbox.displayName = "Checkbox";
|
|
3972
3991
|
|
|
3973
3992
|
// src/components/Radio.tsx
|
|
3974
|
-
var
|
|
3993
|
+
var import_react23 = require("react");
|
|
3975
3994
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3976
|
-
var Radio = (0,
|
|
3995
|
+
var Radio = (0, import_react23.forwardRef)(
|
|
3977
3996
|
({ label, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: cx("uix-radio", className), children: [
|
|
3978
3997
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "radio", ref, ...props }),
|
|
3979
3998
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "uix-radio__dot" }),
|
|
@@ -3981,7 +4000,7 @@ var Radio = (0, import_react22.forwardRef)(
|
|
|
3981
4000
|
] })
|
|
3982
4001
|
);
|
|
3983
4002
|
Radio.displayName = "Radio";
|
|
3984
|
-
var RadioCard = (0,
|
|
4003
|
+
var RadioCard = (0, import_react23.forwardRef)(
|
|
3985
4004
|
({ title, description, media, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: cx("uix-radio-card", className), children: [
|
|
3986
4005
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "radio", ref, ...props }),
|
|
3987
4006
|
media != null && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "uix-radio-card__media", "aria-hidden": "true", children: media }),
|
|
@@ -4003,9 +4022,9 @@ function RadioGroup({ children, className, label, variant = "list" }) {
|
|
|
4003
4022
|
}
|
|
4004
4023
|
|
|
4005
4024
|
// src/components/Switch.tsx
|
|
4006
|
-
var
|
|
4025
|
+
var import_react24 = require("react");
|
|
4007
4026
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
4008
|
-
var Switch = (0,
|
|
4027
|
+
var Switch = (0, import_react24.forwardRef)(
|
|
4009
4028
|
({ label, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: cx("uix-switch", className), children: [
|
|
4010
4029
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("input", { type: "checkbox", role: "switch", ref, ...props }),
|
|
4011
4030
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "uix-switch__track" }),
|
|
@@ -4015,10 +4034,10 @@ var Switch = (0, import_react23.forwardRef)(
|
|
|
4015
4034
|
Switch.displayName = "Switch";
|
|
4016
4035
|
|
|
4017
4036
|
// src/components/Field.tsx
|
|
4018
|
-
var
|
|
4037
|
+
var import_react26 = require("react");
|
|
4019
4038
|
|
|
4020
4039
|
// src/components/InfoTip.tsx
|
|
4021
|
-
var
|
|
4040
|
+
var import_react25 = require("react");
|
|
4022
4041
|
|
|
4023
4042
|
// src/info-tip-model.ts
|
|
4024
4043
|
var helpParagraphs = (content) => typeof content === "string" ? content.replace(/\r\n?/g, "\n").split(/\n\s*\n/).map((p) => p.trim()).filter(Boolean) : [];
|
|
@@ -4049,15 +4068,15 @@ function InfoTipControl({
|
|
|
4049
4068
|
className,
|
|
4050
4069
|
...props
|
|
4051
4070
|
}) {
|
|
4052
|
-
const wrapRef = (0,
|
|
4053
|
-
const buttonRef = (0,
|
|
4054
|
-
const timer = (0,
|
|
4055
|
-
const openRef = (0,
|
|
4056
|
-
const pinned = (0,
|
|
4057
|
-
const pressing = (0,
|
|
4058
|
-
const refocusing = (0,
|
|
4059
|
-
const [open, setOpen] = (0,
|
|
4060
|
-
const panelId = `${(0,
|
|
4071
|
+
const wrapRef = (0, import_react25.useRef)(null);
|
|
4072
|
+
const buttonRef = (0, import_react25.useRef)(null);
|
|
4073
|
+
const timer = (0, import_react25.useRef)(null);
|
|
4074
|
+
const openRef = (0, import_react25.useRef)(false);
|
|
4075
|
+
const pinned = (0, import_react25.useRef)(false);
|
|
4076
|
+
const pressing = (0, import_react25.useRef)(false);
|
|
4077
|
+
const refocusing = (0, import_react25.useRef)(false);
|
|
4078
|
+
const [open, setOpen] = (0, import_react25.useState)(false);
|
|
4079
|
+
const panelId = `${(0, import_react25.useId)()}-panel`;
|
|
4061
4080
|
const panel = () => document.getElementById(panelId);
|
|
4062
4081
|
const clearTimer = () => {
|
|
4063
4082
|
if (timer.current != null) {
|
|
@@ -4116,7 +4135,7 @@ function InfoTipControl({
|
|
|
4116
4135
|
refocusing.current = false;
|
|
4117
4136
|
}
|
|
4118
4137
|
};
|
|
4119
|
-
(0,
|
|
4138
|
+
(0, import_react25.useEffect)(() => {
|
|
4120
4139
|
if (!open) return;
|
|
4121
4140
|
const onKey = (e) => {
|
|
4122
4141
|
if (e.key === "Escape") escape();
|
|
@@ -4131,7 +4150,7 @@ function InfoTipControl({
|
|
|
4131
4150
|
document.removeEventListener("pointerdown", onPointer, true);
|
|
4132
4151
|
};
|
|
4133
4152
|
}, [open]);
|
|
4134
|
-
(0,
|
|
4153
|
+
(0, import_react25.useEffect)(() => () => {
|
|
4135
4154
|
clearTimer();
|
|
4136
4155
|
const p = panel();
|
|
4137
4156
|
if (p && isShown2(p)) {
|
|
@@ -4207,11 +4226,11 @@ function InfoTipControl({
|
|
|
4207
4226
|
// src/components/Field.tsx
|
|
4208
4227
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4209
4228
|
function Field({ label, hint, error, warning, success, required, help, helpLabel, children, className, htmlFor }) {
|
|
4210
|
-
const uid = (0,
|
|
4229
|
+
const uid = (0, import_react26.useId)();
|
|
4211
4230
|
const msgId = `${uid}-msg`;
|
|
4212
4231
|
const describedBy = error || warning || success || hint ? msgId : void 0;
|
|
4213
|
-
const controlId = (0,
|
|
4214
|
-
const control = (0,
|
|
4232
|
+
const controlId = (0, import_react26.isValidElement)(children) ? children.props.id ?? `${uid}-ctl` : void 0;
|
|
4233
|
+
const control = (0, import_react26.isValidElement)(children) ? (0, import_react26.cloneElement)(children, {
|
|
4215
4234
|
id: controlId,
|
|
4216
4235
|
"aria-describedby": [children.props["aria-describedby"], describedBy].filter(Boolean).join(" ") || void 0,
|
|
4217
4236
|
"aria-invalid": error ? true : children.props["aria-invalid"],
|
|
@@ -4230,7 +4249,7 @@ function Field({ label, hint, error, warning, success, required, help, helpLabel
|
|
|
4230
4249
|
}
|
|
4231
4250
|
|
|
4232
4251
|
// src/components/Modal.tsx
|
|
4233
|
-
var
|
|
4252
|
+
var import_react27 = require("react");
|
|
4234
4253
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4235
4254
|
var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M4 4l8 8M12 4l-8 8" }) });
|
|
4236
4255
|
function Modal({
|
|
@@ -4245,14 +4264,15 @@ function Modal({
|
|
|
4245
4264
|
className,
|
|
4246
4265
|
closeLabel: closeLabelProp,
|
|
4247
4266
|
role = "dialog",
|
|
4267
|
+
instant = false,
|
|
4248
4268
|
onKeyDown,
|
|
4249
4269
|
...rest
|
|
4250
4270
|
}) {
|
|
4251
4271
|
const uixLabels = useUixLabels();
|
|
4252
4272
|
const closeLabel = closeLabelProp ?? uixLabels.modal?.close ?? "Close dialog";
|
|
4253
|
-
const closeRef = (0,
|
|
4273
|
+
const closeRef = (0, import_react27.useRef)(null);
|
|
4254
4274
|
const guard = useGuardedDialog({ open, onClose, dirty, pending, labels: discardLabels, closeRef });
|
|
4255
|
-
const titleId = (0,
|
|
4275
|
+
const titleId = (0, import_react27.useId)();
|
|
4256
4276
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
4257
4277
|
"dialog",
|
|
4258
4278
|
{
|
|
@@ -4260,6 +4280,7 @@ function Modal({
|
|
|
4260
4280
|
className: cx("uix-dialog", className),
|
|
4261
4281
|
role,
|
|
4262
4282
|
"aria-labelledby": title != null ? titleId : void 0,
|
|
4283
|
+
"data-uix-instant": instant ? "" : void 0,
|
|
4263
4284
|
...rest,
|
|
4264
4285
|
onKeyDown: (event) => {
|
|
4265
4286
|
onKeyDown?.(event);
|
|
@@ -4294,7 +4315,7 @@ function Modal({
|
|
|
4294
4315
|
}
|
|
4295
4316
|
|
|
4296
4317
|
// src/components/Dialogs.tsx
|
|
4297
|
-
var
|
|
4318
|
+
var import_react28 = require("react");
|
|
4298
4319
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4299
4320
|
function ConfirmDialog({
|
|
4300
4321
|
open,
|
|
@@ -4320,19 +4341,19 @@ function ConfirmDialog({
|
|
|
4320
4341
|
const uixLabels = useUixLabels();
|
|
4321
4342
|
const typeToConfirmLabel = typeToConfirmLabelProp ?? uixLabels.confirmDialog?.typeToConfirm ?? "Type {value} to confirm";
|
|
4322
4343
|
const compensationLabel = compensationLabelProp ?? uixLabels.confirmDialog?.compensation ?? "How to undo this";
|
|
4323
|
-
const id = (0,
|
|
4344
|
+
const id = (0, import_react28.useId)();
|
|
4324
4345
|
const bodyId = `${id}-body`;
|
|
4325
4346
|
const typedId = `${id}-typed`;
|
|
4326
|
-
const cancelRef = (0,
|
|
4327
|
-
const confirmRef = (0,
|
|
4328
|
-
const typedRef = (0,
|
|
4329
|
-
const [typed, setTyped] = (0,
|
|
4347
|
+
const cancelRef = (0, import_react28.useRef)(null);
|
|
4348
|
+
const confirmRef = (0, import_react28.useRef)(null);
|
|
4349
|
+
const typedRef = (0, import_react28.useRef)(null);
|
|
4350
|
+
const [typed, setTyped] = (0, import_react28.useState)("");
|
|
4330
4351
|
const typedMatches = typeToConfirm == null || typed === typeToConfirm;
|
|
4331
4352
|
const hasBody = description != null || children != null || compensation != null;
|
|
4332
|
-
(0,
|
|
4353
|
+
(0, import_react28.useEffect)(() => {
|
|
4333
4354
|
if (open) setTyped("");
|
|
4334
4355
|
}, [open, typeToConfirm]);
|
|
4335
|
-
(0,
|
|
4356
|
+
(0, import_react28.useEffect)(() => {
|
|
4336
4357
|
if (!open) return;
|
|
4337
4358
|
const focus = initialFocus ?? (destructive ? "cancel" : void 0);
|
|
4338
4359
|
const target = typeToConfirm != null ? typedRef.current : focus === "cancel" ? cancelRef.current : focus === "confirm" ? confirmRef.current : null;
|
|
@@ -4389,13 +4410,13 @@ function Popconfirm({
|
|
|
4389
4410
|
}) {
|
|
4390
4411
|
const uixLabels = useUixLabels();
|
|
4391
4412
|
const compensationLabel = compensationLabelProp ?? uixLabels.confirmDialog?.compensation ?? "How to undo this";
|
|
4392
|
-
const id = (0,
|
|
4413
|
+
const id = (0, import_react28.useId)();
|
|
4393
4414
|
const panelId = `${id}-popconfirm`;
|
|
4394
|
-
const cancelRef = (0,
|
|
4395
|
-
const onCancelRef = (0,
|
|
4415
|
+
const cancelRef = (0, import_react28.useRef)(null);
|
|
4416
|
+
const onCancelRef = (0, import_react28.useRef)(onCancel);
|
|
4396
4417
|
onCancelRef.current = onCancel;
|
|
4397
4418
|
const hasBody = description != null || compensation != null;
|
|
4398
|
-
(0,
|
|
4419
|
+
(0, import_react28.useEffect)(() => {
|
|
4399
4420
|
const panel = document.getElementById(panelId);
|
|
4400
4421
|
if (!panel) return;
|
|
4401
4422
|
const shown = () => {
|
|
@@ -4488,18 +4509,18 @@ function PromptDialog({
|
|
|
4488
4509
|
error: submitError,
|
|
4489
4510
|
role
|
|
4490
4511
|
}) {
|
|
4491
|
-
const inputId = (0,
|
|
4512
|
+
const inputId = (0, import_react28.useId)();
|
|
4492
4513
|
const errorId = `${inputId}-error`;
|
|
4493
4514
|
const descriptionId = `${inputId}-description`;
|
|
4494
|
-
const formRef = (0,
|
|
4495
|
-
const fieldRef = (0,
|
|
4496
|
-
const [value, setValue] = (0,
|
|
4497
|
-
const [issue, setIssue] = (0,
|
|
4515
|
+
const formRef = (0, import_react28.useRef)(null);
|
|
4516
|
+
const fieldRef = (0, import_react28.useRef)(null);
|
|
4517
|
+
const [value, setValue] = (0, import_react28.useState)(defaultValue);
|
|
4518
|
+
const [issue, setIssue] = (0, import_react28.useState)();
|
|
4498
4519
|
const error = issue ?? submitError;
|
|
4499
|
-
(0,
|
|
4520
|
+
(0, import_react28.useEffect)(() => {
|
|
4500
4521
|
if (open) fieldRef.current?.focus();
|
|
4501
4522
|
}, [open]);
|
|
4502
|
-
(0,
|
|
4523
|
+
(0, import_react28.useEffect)(() => {
|
|
4503
4524
|
if (open) {
|
|
4504
4525
|
setValue(defaultValue);
|
|
4505
4526
|
setIssue(void 0);
|
|
@@ -4556,7 +4577,7 @@ function PromptDialog({
|
|
|
4556
4577
|
}
|
|
4557
4578
|
|
|
4558
4579
|
// src/components/Peek.tsx
|
|
4559
|
-
var
|
|
4580
|
+
var import_react29 = require("react");
|
|
4560
4581
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4561
4582
|
var CloseIcon3 = () => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "M4 4l8 8M12 4l-8 8" }) });
|
|
4562
4583
|
var ChevronUp = () => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "M2 8l4-4 4 4" }) });
|
|
@@ -4568,7 +4589,7 @@ function Peek({ open, onClose, title, children, footer, onNavPrev, onNavNext, hi
|
|
|
4568
4589
|
const closeLabel = closeLabelProp ?? uixLabels.peek?.close ?? "Close preview";
|
|
4569
4590
|
const ref = useDialog(open, onClose);
|
|
4570
4591
|
const hasNav = onNavPrev != null || onNavNext != null;
|
|
4571
|
-
const titleId = (0,
|
|
4592
|
+
const titleId = (0, import_react29.useId)();
|
|
4572
4593
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("dialog", { ref, className: cx("uix-peek", className), "aria-labelledby": title ? titleId : void 0, ...rest, onClick: backdropDismiss(onClose, onClick), children: [
|
|
4573
4594
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "uix-peek__header", children: [
|
|
4574
4595
|
hasNav && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "uix-peek__nav", children: [
|
|
@@ -4585,7 +4606,7 @@ function Peek({ open, onClose, title, children, footer, onNavPrev, onNavNext, hi
|
|
|
4585
4606
|
}
|
|
4586
4607
|
|
|
4587
4608
|
// src/components/Lightbox.tsx
|
|
4588
|
-
var
|
|
4609
|
+
var import_react30 = require("react");
|
|
4589
4610
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4590
4611
|
var DEFAULT_LIGHTBOX_LABELS = {
|
|
4591
4612
|
region: "Media viewer",
|
|
@@ -4600,15 +4621,15 @@ var Chevron = ({ dir }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("svg",
|
|
|
4600
4621
|
function Lightbox({ items, index, onIndexChange, open, onClose, loop = false, labels: labelOverrides, className }) {
|
|
4601
4622
|
const labels = { ...DEFAULT_LIGHTBOX_LABELS, ...labelOverrides };
|
|
4602
4623
|
const ref = useDialog(open, onClose);
|
|
4603
|
-
const closeRef = (0,
|
|
4604
|
-
const returnTo = (0,
|
|
4605
|
-
const swipe = (0,
|
|
4606
|
-
const [zoomed, setZoomed] = (0,
|
|
4624
|
+
const closeRef = (0, import_react30.useRef)(null);
|
|
4625
|
+
const returnTo = (0, import_react30.useRef)(null);
|
|
4626
|
+
const swipe = (0, import_react30.useRef)(null);
|
|
4627
|
+
const [zoomed, setZoomed] = (0, import_react30.useState)(false);
|
|
4607
4628
|
const total = items.length;
|
|
4608
4629
|
const current = items[Math.min(Math.max(index, 0), Math.max(total - 1, 0))];
|
|
4609
4630
|
const hasPrev = loop ? total > 1 : index > 0;
|
|
4610
4631
|
const hasNext = loop ? total > 1 : index < total - 1;
|
|
4611
|
-
(0,
|
|
4632
|
+
(0, import_react30.useEffect)(() => {
|
|
4612
4633
|
if (open) {
|
|
4613
4634
|
returnTo.current = document.activeElement;
|
|
4614
4635
|
closeRef.current?.focus();
|
|
@@ -4617,7 +4638,7 @@ function Lightbox({ items, index, onIndexChange, open, onClose, loop = false, la
|
|
|
4617
4638
|
returnTo.current = null;
|
|
4618
4639
|
}
|
|
4619
4640
|
}, [open]);
|
|
4620
|
-
(0,
|
|
4641
|
+
(0, import_react30.useEffect)(() => {
|
|
4621
4642
|
setZoomed(false);
|
|
4622
4643
|
}, [index]);
|
|
4623
4644
|
const go = (to) => {
|
|
@@ -4716,7 +4737,7 @@ function CardLink({ title, subtitle, headerAction, footer, children, className,
|
|
|
4716
4737
|
}
|
|
4717
4738
|
|
|
4718
4739
|
// src/components/DashboardGrid.tsx
|
|
4719
|
-
var
|
|
4740
|
+
var import_react31 = require("react");
|
|
4720
4741
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4721
4742
|
var BREAKPOINTS = ["sm", "md", "lg", "xl"];
|
|
4722
4743
|
var count = (value, fallback) => {
|
|
@@ -4742,16 +4763,16 @@ function dashboardGridItemClassName(span = 1) {
|
|
|
4742
4763
|
if (span === 2) return "uix-dashboard-grid__item uix-dashboard-grid__item--span-2";
|
|
4743
4764
|
return "uix-dashboard-grid__item";
|
|
4744
4765
|
}
|
|
4745
|
-
var DashboardGridItem = (0,
|
|
4766
|
+
var DashboardGridItem = (0, import_react31.forwardRef)(function DashboardGridItem2({ span = 1, className, ...props }, ref) {
|
|
4746
4767
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { ref, className: cx(dashboardGridItemClassName(span), className), ...props });
|
|
4747
4768
|
});
|
|
4748
|
-
var DashboardGridRoot = (0,
|
|
4769
|
+
var DashboardGridRoot = (0, import_react31.forwardRef)(function DashboardGrid({ columns, gap = "md", className, ...props }, ref) {
|
|
4749
4770
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { ref, className: cx(dashboardGridClassName(columns, gap), className), ...props });
|
|
4750
4771
|
});
|
|
4751
4772
|
var DashboardGrid2 = Object.assign(DashboardGridRoot, { Item: DashboardGridItem });
|
|
4752
4773
|
|
|
4753
4774
|
// src/components/DashboardCanvas.tsx
|
|
4754
|
-
var
|
|
4775
|
+
var import_react32 = require("react");
|
|
4755
4776
|
|
|
4756
4777
|
// src/dashboard-canvas-model.ts
|
|
4757
4778
|
var DASHBOARD_CANVAS_COLUMNS = 12;
|
|
@@ -4891,16 +4912,16 @@ function DashboardCanvas({
|
|
|
4891
4912
|
...props
|
|
4892
4913
|
}) {
|
|
4893
4914
|
const labels = { ...DEFAULT_DASHBOARD_CANVAS_LABELS, ...labelOverrides };
|
|
4894
|
-
const instructionsId = (0,
|
|
4895
|
-
const gridRef = (0,
|
|
4896
|
-
const dragRef = (0,
|
|
4897
|
-
const [preview, setPreview] = (0,
|
|
4898
|
-
const [announcement, setAnnouncement] = (0,
|
|
4899
|
-
const layout = (0,
|
|
4900
|
-
const order = (0,
|
|
4901
|
-
const live = (0,
|
|
4915
|
+
const instructionsId = (0, import_react32.useId)();
|
|
4916
|
+
const gridRef = (0, import_react32.useRef)(null);
|
|
4917
|
+
const dragRef = (0, import_react32.useRef)(null);
|
|
4918
|
+
const [preview, setPreview] = (0, import_react32.useState)(null);
|
|
4919
|
+
const [announcement, setAnnouncement] = (0, import_react32.useState)("");
|
|
4920
|
+
const layout = (0, import_react32.useMemo)(() => normalizeCanvas(items), [items]);
|
|
4921
|
+
const order = (0, import_react32.useMemo)(() => new Map(canvasReadingOrder(layout).map((item, index) => [item.id, index])), [layout]);
|
|
4922
|
+
const live = (0, import_react32.useRef)({ layout, onLayoutChange, labels, itemLabel });
|
|
4902
4923
|
live.current = { layout, onLayoutChange, labels, itemLabel };
|
|
4903
|
-
(0,
|
|
4924
|
+
(0, import_react32.useEffect)(() => () => dragRef.current?.stop(), []);
|
|
4904
4925
|
const describe = (item, kind) => kind === "move" ? fillLabel(labels.moved, { label: itemLabel(item), col: item.col + 1, row: item.row + 1 }) : fillLabel(labels.resized, { label: itemLabel(item), w: item.w, h: item.h });
|
|
4905
4926
|
const commit = (id, placement, kind, source) => {
|
|
4906
4927
|
const state = live.current;
|
|
@@ -5066,12 +5087,12 @@ function DashboardCanvas({
|
|
|
5066
5087
|
}
|
|
5067
5088
|
|
|
5068
5089
|
// src/components/Breadcrumbs.tsx
|
|
5069
|
-
var
|
|
5090
|
+
var import_react33 = require("react");
|
|
5070
5091
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5071
5092
|
function Breadcrumbs({ items, label, separator = "/", className, ...props }) {
|
|
5072
5093
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("nav", { "aria-label": label, className, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("ol", { className: "uix-breadcrumbs", children: items.map((item, index) => {
|
|
5073
5094
|
const current = item.current ?? index === items.length - 1;
|
|
5074
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react33.Fragment, { children: [
|
|
5075
5096
|
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("li", { className: "uix-breadcrumbs__sep", "aria-hidden": "true", children: separator }),
|
|
5076
5097
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("li", { children: item.href && !current ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("a", { href: item.href, children: item.label }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { "aria-current": current ? "page" : void 0, children: item.label }) })
|
|
5077
5098
|
] }, item.id ?? `${item.href ?? "current"}-${index}`);
|
|
@@ -5105,7 +5126,7 @@ function DetailLayout({ side, children, className, ...props }) {
|
|
|
5105
5126
|
}
|
|
5106
5127
|
|
|
5107
5128
|
// src/components/DetailPage.tsx
|
|
5108
|
-
var
|
|
5129
|
+
var import_react34 = require("react");
|
|
5109
5130
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
5110
5131
|
var plainLink = ({ href, className, children, onClick, ...rest }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("a", { href, className, onClick, ...rest, children });
|
|
5111
5132
|
var isPlainLeftClick = (e) => e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey;
|
|
@@ -5132,7 +5153,7 @@ function DetailPage({
|
|
|
5132
5153
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("dt", { children: metric.label }),
|
|
5133
5154
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("dd", { children: metric.value })
|
|
5134
5155
|
] }, metric.id)) }),
|
|
5135
|
-
tabs && tabs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("nav", { className: "uix-tabs", "aria-label": tabsLabel, children: tabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5156
|
+
tabs && tabs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("nav", { className: "uix-tabs", "aria-label": tabsLabel, children: tabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react34.Fragment, { children: renderLink({
|
|
5136
5157
|
href: tab.href,
|
|
5137
5158
|
className: "uix-tab",
|
|
5138
5159
|
children: tab.label,
|
|
@@ -5162,10 +5183,10 @@ function RelatedLinks({ title, items, className, ...props }) {
|
|
|
5162
5183
|
}
|
|
5163
5184
|
|
|
5164
5185
|
// src/components/ToggleRow.tsx
|
|
5165
|
-
var
|
|
5186
|
+
var import_react35 = require("react");
|
|
5166
5187
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
5167
5188
|
function ToggleRow({ label, description, checked, onCheckedChange, disabled, accessibleLabel, className, ...props }) {
|
|
5168
|
-
const id = (0,
|
|
5189
|
+
const id = (0, import_react35.useId)();
|
|
5169
5190
|
const switchId = `${id}-switch`;
|
|
5170
5191
|
const descriptionId = `${id}-description`;
|
|
5171
5192
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: cx("uix-toggle-row", className), ...props, children: [
|
|
@@ -5188,7 +5209,7 @@ function ToggleRow({ label, description, checked, onCheckedChange, disabled, acc
|
|
|
5188
5209
|
}
|
|
5189
5210
|
|
|
5190
5211
|
// src/components/CollapsibleSection.tsx
|
|
5191
|
-
var
|
|
5212
|
+
var import_react37 = require("react");
|
|
5192
5213
|
|
|
5193
5214
|
// src/components/CollapsibleParts.tsx
|
|
5194
5215
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
@@ -5206,9 +5227,9 @@ function CollapsibleSummary({ title, summary, headingLevel, titleId, summaryRef
|
|
|
5206
5227
|
}
|
|
5207
5228
|
|
|
5208
5229
|
// src/components/CollapsibleSectionState.tsx
|
|
5209
|
-
var
|
|
5230
|
+
var import_react36 = require("react");
|
|
5210
5231
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
5211
|
-
var useIsomorphicLayoutEffect7 = typeof document !== "undefined" ?
|
|
5232
|
+
var useIsomorphicLayoutEffect7 = typeof document !== "undefined" ? import_react36.useLayoutEffect : import_react36.useEffect;
|
|
5212
5233
|
var STORAGE_PREFIX = "uix:collapsible:";
|
|
5213
5234
|
var storageOf = (kind) => kind === "local" ? window.localStorage : window.sessionStorage;
|
|
5214
5235
|
var readStored = (kind, key) => {
|
|
@@ -5241,15 +5262,15 @@ function CollapsibleSectionState({
|
|
|
5241
5262
|
onToggle,
|
|
5242
5263
|
...props
|
|
5243
5264
|
}) {
|
|
5244
|
-
const ref = (0,
|
|
5245
|
-
const summaryRef = (0,
|
|
5246
|
-
const titleId = (0,
|
|
5265
|
+
const ref = (0, import_react36.useRef)(null);
|
|
5266
|
+
const summaryRef = (0, import_react36.useRef)(null);
|
|
5267
|
+
const titleId = (0, import_react36.useId)();
|
|
5247
5268
|
const initial = open ?? defaultOpen ?? false;
|
|
5248
|
-
const [isOpen2, setIsOpen] = (0,
|
|
5249
|
-
const [hasOpened, setHasOpened] = (0,
|
|
5250
|
-
const lastOpen = (0,
|
|
5251
|
-
const lastRequest = (0,
|
|
5252
|
-
(0,
|
|
5269
|
+
const [isOpen2, setIsOpen] = (0, import_react36.useState)(initial);
|
|
5270
|
+
const [hasOpened, setHasOpened] = (0, import_react36.useState)(initial);
|
|
5271
|
+
const lastOpen = (0, import_react36.useRef)(open);
|
|
5272
|
+
const lastRequest = (0, import_react36.useRef)(openRequest ? void 0 : openRequest);
|
|
5273
|
+
(0, import_react36.useEffect)(() => {
|
|
5253
5274
|
if (!persistKey) return;
|
|
5254
5275
|
const stored = readStored(persistStorage, persistKey);
|
|
5255
5276
|
if (stored !== void 0) {
|
|
@@ -5257,14 +5278,14 @@ function CollapsibleSectionState({
|
|
|
5257
5278
|
if (stored) setHasOpened(true);
|
|
5258
5279
|
}
|
|
5259
5280
|
}, [persistKey, persistStorage]);
|
|
5260
|
-
(0,
|
|
5281
|
+
(0, import_react36.useEffect)(() => {
|
|
5261
5282
|
if (open === lastOpen.current) return;
|
|
5262
5283
|
lastOpen.current = open;
|
|
5263
5284
|
if (open === void 0) return;
|
|
5264
5285
|
setIsOpen(open);
|
|
5265
5286
|
if (open) setHasOpened(true);
|
|
5266
5287
|
}, [open]);
|
|
5267
|
-
(0,
|
|
5288
|
+
(0, import_react36.useEffect)(() => {
|
|
5268
5289
|
if (openRequest === void 0 || openRequest === lastRequest.current) return;
|
|
5269
5290
|
lastRequest.current = openRequest;
|
|
5270
5291
|
setIsOpen(true);
|
|
@@ -5275,7 +5296,7 @@ function CollapsibleSectionState({
|
|
|
5275
5296
|
summaryRef.current?.focus({ preventScroll: true });
|
|
5276
5297
|
});
|
|
5277
5298
|
}, [openRequest, persistKey, persistStorage]);
|
|
5278
|
-
const renderedOpen = (0,
|
|
5299
|
+
const renderedOpen = (0, import_react36.useRef)(isOpen2);
|
|
5279
5300
|
useIsomorphicLayoutEffect7(() => {
|
|
5280
5301
|
renderedOpen.current = isOpen2;
|
|
5281
5302
|
}, [isOpen2]);
|
|
@@ -5300,7 +5321,7 @@ function CollapsibleSectionState({
|
|
|
5300
5321
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
5301
5322
|
function CollapsibleSection(props) {
|
|
5302
5323
|
const { title, summary, children, className, lazy, persistKey, persistStorage, openRequest, open, defaultOpen, compact, headingLevel, ...rest } = props;
|
|
5303
|
-
const titleId = (0,
|
|
5324
|
+
const titleId = (0, import_react37.useId)();
|
|
5304
5325
|
if (lazy || persistKey !== void 0 || openRequest !== void 0) return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CollapsibleSectionState, { ...props });
|
|
5305
5326
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("details", { className: collapsibleClass(compact, className), ...rest, open: open ?? defaultOpen, children: [
|
|
5306
5327
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CollapsibleSummary, { title, summary, headingLevel, titleId }),
|
|
@@ -5309,7 +5330,7 @@ function CollapsibleSection(props) {
|
|
|
5309
5330
|
}
|
|
5310
5331
|
|
|
5311
5332
|
// src/components/ListRoving.tsx
|
|
5312
|
-
var
|
|
5333
|
+
var import_react38 = require("react");
|
|
5313
5334
|
|
|
5314
5335
|
// src/roving.ts
|
|
5315
5336
|
function syncRovingStop(all, stop2, next) {
|
|
@@ -5329,18 +5350,18 @@ function rovingStep(all, from, key) {
|
|
|
5329
5350
|
// src/components/ListRoving.tsx
|
|
5330
5351
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
5331
5352
|
function RovingList({ children, className, onKeyDown, onFocus, ...props }) {
|
|
5332
|
-
const ref = (0,
|
|
5333
|
-
const stop2 = (0,
|
|
5353
|
+
const ref = (0, import_react38.useRef)(null);
|
|
5354
|
+
const stop2 = (0, import_react38.useRef)({ node: null, index: 0 });
|
|
5334
5355
|
const items = () => Array.from(ref.current?.querySelectorAll(".uix-list__item") ?? []).filter((element) => element.closest(".uix-list") === ref.current);
|
|
5335
5356
|
const sync = (next) => {
|
|
5336
5357
|
const all = items();
|
|
5337
5358
|
for (const element of all) if (!element.hasAttribute("role")) element.setAttribute("role", "listitem");
|
|
5338
5359
|
stop2.current = syncRovingStop(all, stop2.current, next);
|
|
5339
5360
|
};
|
|
5340
|
-
(0,
|
|
5361
|
+
(0, import_react38.useEffect)(() => {
|
|
5341
5362
|
sync();
|
|
5342
5363
|
});
|
|
5343
|
-
(0,
|
|
5364
|
+
(0, import_react38.useEffect)(() => {
|
|
5344
5365
|
const list = ref.current;
|
|
5345
5366
|
if (!list || typeof MutationObserver === "undefined") return;
|
|
5346
5367
|
const observer = new MutationObserver(() => sync());
|
|
@@ -5392,11 +5413,11 @@ function ListItem({ title, meta, trail, leading, children, className, ...props }
|
|
|
5392
5413
|
}
|
|
5393
5414
|
|
|
5394
5415
|
// src/components/DescriptionList.tsx
|
|
5395
|
-
var
|
|
5416
|
+
var import_react39 = require("react");
|
|
5396
5417
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
5397
5418
|
function DescriptionList({ items, children, className, ...props }) {
|
|
5398
5419
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("dl", { className: cx("uix-dl", className), ...props, children: [
|
|
5399
|
-
items?.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
5420
|
+
items?.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react39.Fragment, { children: [
|
|
5400
5421
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("dt", { ...item.termProps, children: item.term }),
|
|
5401
5422
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("dd", { ...item.descriptionProps, children: item.description })
|
|
5402
5423
|
] }, item.id ?? i)),
|
|
@@ -5411,9 +5432,9 @@ function DescriptionItem({ term, children, termProps, descriptionProps }) {
|
|
|
5411
5432
|
}
|
|
5412
5433
|
|
|
5413
5434
|
// src/components/Tabs.tsx
|
|
5414
|
-
var
|
|
5435
|
+
var import_react40 = require("react");
|
|
5415
5436
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
5416
|
-
var TabsCtx = (0,
|
|
5437
|
+
var TabsCtx = (0, import_react40.createContext)({});
|
|
5417
5438
|
var Chevron2 = ({ d }) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("path", { d }) });
|
|
5418
5439
|
var inlineOffset = (el, rtl) => rtl ? -el.scrollLeft : el.scrollLeft;
|
|
5419
5440
|
function Tabs({
|
|
@@ -5427,15 +5448,15 @@ function Tabs({
|
|
|
5427
5448
|
onKeyDown: onKeyDownProp,
|
|
5428
5449
|
...listProps
|
|
5429
5450
|
}) {
|
|
5430
|
-
const baseId = (0,
|
|
5431
|
-
const listRef = (0,
|
|
5432
|
-
const contextValue = (0,
|
|
5451
|
+
const baseId = (0, import_react40.useId)();
|
|
5452
|
+
const listRef = (0, import_react40.useRef)(null);
|
|
5453
|
+
const contextValue = (0, import_react40.useMemo)(() => ({ value, onChange, baseId }), [value, onChange, baseId]);
|
|
5433
5454
|
const scroll = overflow === "scroll";
|
|
5434
|
-
const [hidden, setHidden] = (0,
|
|
5435
|
-
const kids =
|
|
5436
|
-
const panels = kids.filter((k) => (0,
|
|
5437
|
-
const tabs = kids.filter((k) => !((0,
|
|
5438
|
-
(0,
|
|
5455
|
+
const [hidden, setHidden] = (0, import_react40.useState)({ start: false, end: false });
|
|
5456
|
+
const kids = import_react40.Children.toArray(children);
|
|
5457
|
+
const panels = kids.filter((k) => (0, import_react40.isValidElement)(k) && k.type === TabPanel);
|
|
5458
|
+
const tabs = kids.filter((k) => !((0, import_react40.isValidElement)(k) && k.type === TabPanel));
|
|
5459
|
+
(0, import_react40.useEffect)(() => {
|
|
5439
5460
|
const list2 = listRef.current;
|
|
5440
5461
|
if (!list2) return;
|
|
5441
5462
|
const all = Array.from(list2.querySelectorAll('[role="tab"]'));
|
|
@@ -5443,7 +5464,7 @@ function Tabs({
|
|
|
5443
5464
|
const active = enabled.find((t) => t.getAttribute("aria-selected") === "true") ?? enabled[0];
|
|
5444
5465
|
for (const t of all) t.tabIndex = t === active ? 0 : -1;
|
|
5445
5466
|
});
|
|
5446
|
-
(0,
|
|
5467
|
+
(0, import_react40.useEffect)(() => {
|
|
5447
5468
|
const list2 = listRef.current;
|
|
5448
5469
|
if (!scroll || !list2) return;
|
|
5449
5470
|
const measure2 = () => {
|
|
@@ -5464,7 +5485,7 @@ function Tabs({
|
|
|
5464
5485
|
observer.disconnect();
|
|
5465
5486
|
};
|
|
5466
5487
|
});
|
|
5467
|
-
(0,
|
|
5488
|
+
(0, import_react40.useEffect)(() => {
|
|
5468
5489
|
const list2 = listRef.current;
|
|
5469
5490
|
const tab = list2?.querySelector('[role="tab"][aria-selected="true"]');
|
|
5470
5491
|
if (!scroll || !list2 || !tab) return;
|
|
@@ -5557,7 +5578,7 @@ function Tabs({
|
|
|
5557
5578
|
] });
|
|
5558
5579
|
}
|
|
5559
5580
|
function Tab({ value, children, disabled, className, onClick, ...props }) {
|
|
5560
|
-
const ctx = (0,
|
|
5581
|
+
const ctx = (0, import_react40.useContext)(TabsCtx);
|
|
5561
5582
|
const selected = ctx.value === value;
|
|
5562
5583
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5563
5584
|
"button",
|
|
@@ -5579,7 +5600,7 @@ function Tab({ value, children, disabled, className, onClick, ...props }) {
|
|
|
5579
5600
|
);
|
|
5580
5601
|
}
|
|
5581
5602
|
function TabPanel({ value, children, keepMounted, ...props }) {
|
|
5582
|
-
const ctx = (0,
|
|
5603
|
+
const ctx = (0, import_react40.useContext)(TabsCtx);
|
|
5583
5604
|
const selected = ctx.value === value;
|
|
5584
5605
|
if (!selected && !keepMounted) return null;
|
|
5585
5606
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
@@ -5597,7 +5618,7 @@ function TabPanel({ value, children, keepMounted, ...props }) {
|
|
|
5597
5618
|
}
|
|
5598
5619
|
|
|
5599
5620
|
// src/components/AppShell.tsx
|
|
5600
|
-
var
|
|
5621
|
+
var import_react41 = require("react");
|
|
5601
5622
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
5602
5623
|
function AppShell({
|
|
5603
5624
|
nav,
|
|
@@ -5618,7 +5639,7 @@ function AppShell({
|
|
|
5618
5639
|
const skipToContentLabel = skipToContentLabelProp ?? uixLabels.appShell?.skipToContent ?? "Skip to content";
|
|
5619
5640
|
const exitFocusLabel = exitFocusLabelProp ?? uixLabels.appShell?.exitFocus ?? "Esc \xB7 Exit focus";
|
|
5620
5641
|
const navState = nav ?? (collapsed ? "rail" : "full");
|
|
5621
|
-
(0,
|
|
5642
|
+
(0, import_react41.useEffect)(() => {
|
|
5622
5643
|
if (!focus || !onExitFocus) return;
|
|
5623
5644
|
const onKey = (e) => {
|
|
5624
5645
|
if (e.key === "Escape") onExitFocus();
|
|
@@ -5646,7 +5667,7 @@ function AppShell({
|
|
|
5646
5667
|
}
|
|
5647
5668
|
|
|
5648
5669
|
// src/components/Sidebar.tsx
|
|
5649
|
-
var
|
|
5670
|
+
var import_react42 = require("react");
|
|
5650
5671
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
5651
5672
|
var ChevronIcon = () => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("svg", { className: "uix-navgroup__chevron", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("path", { d: "M2 4l4 4 4-4" }) });
|
|
5652
5673
|
function Sidebar({ collapsed, nav, onToggle, brand, toggleIcon, children, expandLabel: expandLabelProp, collapseLabel: collapseLabelProp, className, ...props }) {
|
|
@@ -5712,12 +5733,12 @@ function NavItem({ icon, badge, active, as: Tag = "a", description, children, cl
|
|
|
5712
5733
|
);
|
|
5713
5734
|
}
|
|
5714
5735
|
function NavGroup({ icon, label, children, defaultExpanded = true, expanded: controlledExpanded, onExpandedChange }) {
|
|
5715
|
-
const [internalExpanded, setInternalExpanded] = (0,
|
|
5736
|
+
const [internalExpanded, setInternalExpanded] = (0, import_react42.useState)(defaultExpanded);
|
|
5716
5737
|
const expanded = controlledExpanded ?? internalExpanded;
|
|
5717
|
-
const panelId = (0,
|
|
5718
|
-
const triggerRef = (0,
|
|
5719
|
-
const panelRef = (0,
|
|
5720
|
-
(0,
|
|
5738
|
+
const panelId = (0, import_react42.useId)();
|
|
5739
|
+
const triggerRef = (0, import_react42.useRef)(null);
|
|
5740
|
+
const panelRef = (0, import_react42.useRef)(null);
|
|
5741
|
+
(0, import_react42.useEffect)(() => {
|
|
5721
5742
|
panelRef.current?.toggleAttribute("inert", !expanded);
|
|
5722
5743
|
if (!expanded && panelRef.current?.contains(document.activeElement)) triggerRef.current?.focus();
|
|
5723
5744
|
}, [expanded]);
|
|
@@ -5796,7 +5817,7 @@ function StarButton({
|
|
|
5796
5817
|
}
|
|
5797
5818
|
|
|
5798
5819
|
// src/components/CopyButton.tsx
|
|
5799
|
-
var
|
|
5820
|
+
var import_react43 = require("react");
|
|
5800
5821
|
|
|
5801
5822
|
// src/copy-model.ts
|
|
5802
5823
|
async function copyText(value, clipboard = globalThis.navigator?.clipboard) {
|
|
@@ -5818,11 +5839,11 @@ var CopyGlyph = () => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("svg", { vi
|
|
|
5818
5839
|
] });
|
|
5819
5840
|
var CheckGlyph = () => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("path", { d: "M20 6 9 17l-5-5" }) });
|
|
5820
5841
|
function CopyButton({ value, label, copiedLabel, failedLabel, className }) {
|
|
5821
|
-
const [outcome, setOutcome] = (0,
|
|
5842
|
+
const [outcome, setOutcome] = (0, import_react43.useState)("idle");
|
|
5822
5843
|
const copied = outcome === "copied";
|
|
5823
|
-
const timer = (0,
|
|
5824
|
-
const mounted = (0,
|
|
5825
|
-
(0,
|
|
5844
|
+
const timer = (0, import_react43.useRef)(void 0);
|
|
5845
|
+
const mounted = (0, import_react43.useRef)(true);
|
|
5846
|
+
(0, import_react43.useEffect)(() => {
|
|
5826
5847
|
mounted.current = true;
|
|
5827
5848
|
return () => {
|
|
5828
5849
|
mounted.current = false;
|
|
@@ -5857,7 +5878,7 @@ function CopyButton({ value, label, copiedLabel, failedLabel, className }) {
|
|
|
5857
5878
|
}
|
|
5858
5879
|
|
|
5859
5880
|
// src/components/NavFavourites.tsx
|
|
5860
|
-
var
|
|
5881
|
+
var import_react44 = require("react");
|
|
5861
5882
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
5862
5883
|
var ChevronDownIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5863
5884
|
"svg",
|
|
@@ -5920,14 +5941,14 @@ function NavFavourites({
|
|
|
5920
5941
|
emptyReason,
|
|
5921
5942
|
className
|
|
5922
5943
|
}) {
|
|
5923
|
-
const regionId = (0,
|
|
5924
|
-
const headerRef = (0,
|
|
5925
|
-
const regionRef = (0,
|
|
5926
|
-
const [announcement, setAnnouncement] = (0,
|
|
5927
|
-
const focusAfterRef = (0,
|
|
5928
|
-
const triggerRefs = (0,
|
|
5929
|
-
const order = (0,
|
|
5930
|
-
(0,
|
|
5944
|
+
const regionId = (0, import_react44.useId)();
|
|
5945
|
+
const headerRef = (0, import_react44.useRef)(null);
|
|
5946
|
+
const regionRef = (0, import_react44.useRef)(null);
|
|
5947
|
+
const [announcement, setAnnouncement] = (0, import_react44.useState)("");
|
|
5948
|
+
const focusAfterRef = (0, import_react44.useRef)(null);
|
|
5949
|
+
const triggerRefs = (0, import_react44.useRef)(/* @__PURE__ */ new Map());
|
|
5950
|
+
const order = (0, import_react44.useMemo)(() => items.map((item) => item.id), [items]);
|
|
5951
|
+
(0, import_react44.useEffect)(() => {
|
|
5931
5952
|
const id = focusAfterRef.current;
|
|
5932
5953
|
if (!id) return;
|
|
5933
5954
|
focusAfterRef.current = null;
|
|
@@ -5944,7 +5965,7 @@ function NavFavourites({
|
|
|
5944
5965
|
}
|
|
5945
5966
|
onToggleCollapsed?.();
|
|
5946
5967
|
};
|
|
5947
|
-
const move = (0,
|
|
5968
|
+
const move = (0, import_react44.useCallback)((id, dir) => {
|
|
5948
5969
|
const idx = order.indexOf(id);
|
|
5949
5970
|
const next = idx + dir;
|
|
5950
5971
|
if (idx < 0 || next < 0 || next >= order.length) return;
|
|
@@ -5957,13 +5978,13 @@ function NavFavourites({
|
|
|
5957
5978
|
if (moved) setAnnouncement(`${moved.label} moved to position ${next + 1} of ${order.length}`);
|
|
5958
5979
|
onReorder(reordered);
|
|
5959
5980
|
}, [onReorder, order]);
|
|
5960
|
-
const remove = (0,
|
|
5981
|
+
const remove = (0, import_react44.useCallback)((id) => {
|
|
5961
5982
|
const idx = order.indexOf(id);
|
|
5962
5983
|
const neighbour = order[idx + 1] ?? order[idx - 1] ?? null;
|
|
5963
5984
|
focusAfterRef.current = neighbour;
|
|
5964
5985
|
onRemove(id);
|
|
5965
5986
|
}, [onRemove, order]);
|
|
5966
|
-
const registerTrigger = (0,
|
|
5987
|
+
const registerTrigger = (0, import_react44.useCallback)((id, element) => {
|
|
5967
5988
|
if (element) triggerRefs.current.set(id, element);
|
|
5968
5989
|
else triggerRefs.current.delete(id);
|
|
5969
5990
|
}, []);
|
|
@@ -6015,7 +6036,7 @@ function NavFavourites({
|
|
|
6015
6036
|
)
|
|
6016
6037
|
] });
|
|
6017
6038
|
}
|
|
6018
|
-
var FavouriteRow = (0,
|
|
6039
|
+
var FavouriteRow = (0, import_react44.memo)(function FavouriteRow2({
|
|
6019
6040
|
item,
|
|
6020
6041
|
isFirst,
|
|
6021
6042
|
isLast,
|
|
@@ -6024,17 +6045,17 @@ var FavouriteRow = (0, import_react43.memo)(function FavouriteRow2({
|
|
|
6024
6045
|
onRemove,
|
|
6025
6046
|
registerTrigger
|
|
6026
6047
|
}) {
|
|
6027
|
-
const [open, setOpen] = (0,
|
|
6028
|
-
const menuId = (0,
|
|
6029
|
-
const triggerRef = (0,
|
|
6030
|
-
const itemRefs = (0,
|
|
6048
|
+
const [open, setOpen] = (0, import_react44.useState)(false);
|
|
6049
|
+
const menuId = (0, import_react44.useId)();
|
|
6050
|
+
const triggerRef = (0, import_react44.useRef)(null);
|
|
6051
|
+
const itemRefs = (0, import_react44.useRef)([]);
|
|
6031
6052
|
const optionsTemplate = labels.options ?? "{label} favourite options";
|
|
6032
6053
|
const actions = [
|
|
6033
6054
|
...isFirst ? [] : [{ label: labels.moveUp, onSelect: () => onMove(item.id, -1) }],
|
|
6034
6055
|
...isLast ? [] : [{ label: labels.moveDown, onSelect: () => onMove(item.id, 1) }],
|
|
6035
6056
|
{ label: labels.remove.replace("{label}", item.label), onSelect: () => onRemove(item.id) }
|
|
6036
6057
|
];
|
|
6037
|
-
(0,
|
|
6058
|
+
(0, import_react44.useEffect)(() => {
|
|
6038
6059
|
if (open) itemRefs.current[0]?.focus();
|
|
6039
6060
|
}, [open]);
|
|
6040
6061
|
const closeAndReturnFocus = () => {
|
|
@@ -6144,7 +6165,7 @@ var FavouriteRow = (0, import_react43.memo)(function FavouriteRow2({
|
|
|
6144
6165
|
});
|
|
6145
6166
|
|
|
6146
6167
|
// src/components/FileUpload.tsx
|
|
6147
|
-
var
|
|
6168
|
+
var import_react45 = require("react");
|
|
6148
6169
|
|
|
6149
6170
|
// src/file-model.ts
|
|
6150
6171
|
var UNITS = ["B", "KB", "MB", "GB", "TB"];
|
|
@@ -6209,7 +6230,7 @@ function Progress({ value = 0, max = 100, indeterminate, label, className, ...pr
|
|
|
6209
6230
|
"aria-label": label,
|
|
6210
6231
|
className: cx("uix-progress", indeterminate && "uix-progress--indeterminate", className),
|
|
6211
6232
|
...props,
|
|
6212
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "uix-progress__bar", style: indeterminate ? void 0 : {
|
|
6233
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "uix-progress__bar", style: indeterminate ? void 0 : { "--val": pct / 100 } })
|
|
6213
6234
|
}
|
|
6214
6235
|
);
|
|
6215
6236
|
}
|
|
@@ -6270,11 +6291,11 @@ function FileUpload({
|
|
|
6270
6291
|
}) {
|
|
6271
6292
|
const labels = { ...DEFAULT_FILE_UPLOAD_LABELS, ...useUixLabels().fileUpload, ...labelOverrides };
|
|
6272
6293
|
const sizeText = (bytes) => formatSize ? formatSize(bytes, locale) : formatFileSize(bytes, locale, { base: sizeBase });
|
|
6273
|
-
const id = (0,
|
|
6274
|
-
const inputRef = (0,
|
|
6275
|
-
const [over, setOver] = (0,
|
|
6276
|
-
const [messages, setMessages] = (0,
|
|
6277
|
-
const [announce, setAnnounce] = (0,
|
|
6294
|
+
const id = (0, import_react45.useId)();
|
|
6295
|
+
const inputRef = (0, import_react45.useRef)(null);
|
|
6296
|
+
const [over, setOver] = (0, import_react45.useState)(false);
|
|
6297
|
+
const [messages, setMessages] = (0, import_react45.useState)([]);
|
|
6298
|
+
const [announce, setAnnounce] = (0, import_react45.useState)("");
|
|
6278
6299
|
const take = (list) => {
|
|
6279
6300
|
if (!list || disabled) return;
|
|
6280
6301
|
const files = Array.from(list);
|
|
@@ -6444,7 +6465,7 @@ function AttachmentList({ label, className, children, ...props }) {
|
|
|
6444
6465
|
}
|
|
6445
6466
|
|
|
6446
6467
|
// src/components/Alert.tsx
|
|
6447
|
-
var
|
|
6468
|
+
var import_react46 = require("react");
|
|
6448
6469
|
|
|
6449
6470
|
// src/components/AlertDismiss.tsx
|
|
6450
6471
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
@@ -6455,7 +6476,7 @@ function AlertDismissButton({ label, onDismiss }) {
|
|
|
6455
6476
|
|
|
6456
6477
|
// src/components/Alert.tsx
|
|
6457
6478
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
6458
|
-
var Alert = (0,
|
|
6479
|
+
var Alert = (0, import_react46.forwardRef)(function Alert2({ tone, title, icon, children, actions, onDismiss, dismissLabel, className, ...props }, ref) {
|
|
6459
6480
|
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
6460
6481
|
"div",
|
|
6461
6482
|
{
|
|
@@ -6502,7 +6523,7 @@ function LiveIndicator({ state = "live", children, className, ...props }) {
|
|
|
6502
6523
|
}
|
|
6503
6524
|
|
|
6504
6525
|
// src/components/Toast.tsx
|
|
6505
|
-
var
|
|
6526
|
+
var import_react47 = require("react");
|
|
6506
6527
|
|
|
6507
6528
|
// src/toast-store.ts
|
|
6508
6529
|
var DEFAULT_DURATION = {
|
|
@@ -6612,14 +6633,14 @@ var toast = createToastApi(createToastStore());
|
|
|
6612
6633
|
|
|
6613
6634
|
// src/components/Toast.tsx
|
|
6614
6635
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
6615
|
-
var ToasterContext = (0,
|
|
6636
|
+
var ToasterContext = (0, import_react47.createContext)(null);
|
|
6616
6637
|
function Toast({ title, message, tone, icon, action, onClose, leaving, dismissLabel: dismissLabelProp, className, ...props }) {
|
|
6617
6638
|
const uixLabels = useUixLabels();
|
|
6618
6639
|
const dismissLabel = dismissLabelProp ?? uixLabels.toast?.dismiss ?? "Dismiss";
|
|
6619
6640
|
const assertive = tone === "danger";
|
|
6620
|
-
const toaster = (0,
|
|
6621
|
-
const bodyRef = (0,
|
|
6622
|
-
(0,
|
|
6641
|
+
const toaster = (0, import_react47.useContext)(ToasterContext);
|
|
6642
|
+
const bodyRef = (0, import_react47.useRef)(null);
|
|
6643
|
+
(0, import_react47.useEffect)(() => {
|
|
6623
6644
|
if (assertive || !toaster) return;
|
|
6624
6645
|
const text = bodyRef.current?.textContent?.trim();
|
|
6625
6646
|
if (text) toaster.announce(text);
|
|
@@ -6714,8 +6735,8 @@ function StoreToast({ record, store }) {
|
|
|
6714
6735
|
);
|
|
6715
6736
|
}
|
|
6716
6737
|
function useToastTimers(store, visible, paused) {
|
|
6717
|
-
const timers = (0,
|
|
6718
|
-
(0,
|
|
6738
|
+
const timers = (0, import_react47.useRef)(/* @__PURE__ */ new Map());
|
|
6739
|
+
(0, import_react47.useEffect)(() => {
|
|
6719
6740
|
const now = Date.now();
|
|
6720
6741
|
const map = timers.current;
|
|
6721
6742
|
const live = new Map(visible.filter((r) => !r.leaving && r.duration != null).map((r) => [r.id, r]));
|
|
@@ -6745,7 +6766,7 @@ function useToastTimers(store, visible, paused) {
|
|
|
6745
6766
|
}
|
|
6746
6767
|
}
|
|
6747
6768
|
});
|
|
6748
|
-
(0,
|
|
6769
|
+
(0, import_react47.useEffect)(() => () => {
|
|
6749
6770
|
for (const timer of timers.current.values()) if (timer.handle != null) clearTimeout(timer.handle);
|
|
6750
6771
|
timers.current.clear();
|
|
6751
6772
|
}, []);
|
|
@@ -6753,23 +6774,23 @@ function useToastTimers(store, visible, paused) {
|
|
|
6753
6774
|
function Toaster({ children, regionLabel: regionLabelProp, store = toast.store, limit = 3, position = "bottom-end", className, onMouseEnter, onMouseLeave, onFocus, onBlur, onKeyDown, ...props }) {
|
|
6754
6775
|
const uixLabels = useUixLabels();
|
|
6755
6776
|
const regionLabel = regionLabelProp ?? uixLabels.toaster?.region ?? "Notifications";
|
|
6756
|
-
const [announced, setAnnounced] = (0,
|
|
6757
|
-
const clearTimer = (0,
|
|
6758
|
-
const announce = (0,
|
|
6777
|
+
const [announced, setAnnounced] = (0, import_react47.useState)("");
|
|
6778
|
+
const clearTimer = (0, import_react47.useRef)(null);
|
|
6779
|
+
const announce = (0, import_react47.useCallback)((text) => {
|
|
6759
6780
|
setAnnounced((cur) => cur ? `${cur} ${text}` : text);
|
|
6760
6781
|
if (clearTimer.current != null) clearTimeout(clearTimer.current);
|
|
6761
6782
|
clearTimer.current = window.setTimeout(() => setAnnounced(""), 3e3);
|
|
6762
6783
|
}, []);
|
|
6763
|
-
(0,
|
|
6784
|
+
(0, import_react47.useEffect)(() => () => {
|
|
6764
6785
|
if (clearTimer.current != null) clearTimeout(clearTimer.current);
|
|
6765
6786
|
}, []);
|
|
6766
|
-
const ctx = (0,
|
|
6767
|
-
const records = (0,
|
|
6768
|
-
const visible = (0,
|
|
6769
|
-
const [hovered, setHovered] = (0,
|
|
6770
|
-
const [focused, setFocused] = (0,
|
|
6771
|
-
const [hidden, setHidden] = (0,
|
|
6772
|
-
(0,
|
|
6787
|
+
const ctx = (0, import_react47.useMemo)(() => ({ announce }), [announce]);
|
|
6788
|
+
const records = (0, import_react47.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
|
|
6789
|
+
const visible = (0, import_react47.useMemo)(() => records.slice(-Math.max(1, limit)), [records, limit]);
|
|
6790
|
+
const [hovered, setHovered] = (0, import_react47.useState)(false);
|
|
6791
|
+
const [focused, setFocused] = (0, import_react47.useState)(false);
|
|
6792
|
+
const [hidden, setHidden] = (0, import_react47.useState)(false);
|
|
6793
|
+
(0, import_react47.useEffect)(() => {
|
|
6773
6794
|
const sync = () => setHidden(document.visibilityState === "hidden");
|
|
6774
6795
|
sync();
|
|
6775
6796
|
document.addEventListener("visibilitychange", sync);
|
|
@@ -6820,9 +6841,9 @@ function Toaster({ children, regionLabel: regionLabelProp, store = toast.store,
|
|
|
6820
6841
|
}
|
|
6821
6842
|
|
|
6822
6843
|
// src/components/Table.tsx
|
|
6823
|
-
var
|
|
6844
|
+
var import_react48 = require("react");
|
|
6824
6845
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
6825
|
-
var TableWrap = (0,
|
|
6846
|
+
var TableWrap = (0, import_react48.forwardRef)(function TableWrap2({ announcement, children, className, ...props }, ref) {
|
|
6826
6847
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { ref, className: cx("uix-table-wrap", className), ...props, children: [
|
|
6827
6848
|
announcement != null && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { role: "status", className: "uix-visually-hidden", children: announcement }),
|
|
6828
6849
|
children
|
|
@@ -6931,7 +6952,7 @@ function Highlighted({ text, query }) {
|
|
|
6931
6952
|
}
|
|
6932
6953
|
|
|
6933
6954
|
// src/components/Pagination.tsx
|
|
6934
|
-
var
|
|
6955
|
+
var import_react49 = require("react");
|
|
6935
6956
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
6936
6957
|
function getPageNumbers(page, total) {
|
|
6937
6958
|
if (total <= 7) return Array.from({ length: total }, (_, i) => i + 1);
|
|
@@ -6973,7 +6994,7 @@ function Pagination({
|
|
|
6973
6994
|
const labels = { ...DEFAULT_PAGINATION_LABELS, ...labelOverrides };
|
|
6974
6995
|
const render = ({ key, content, label, current, disabled, href, onClick }) => {
|
|
6975
6996
|
if (href != null && !disabled) {
|
|
6976
|
-
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react49.Fragment, { children: renderUixLink(renderLink, {
|
|
6977
6998
|
href,
|
|
6978
6999
|
className: "uix-pagination__btn",
|
|
6979
7000
|
"aria-label": label,
|
|
@@ -7051,7 +7072,7 @@ function Meter({ value = 0, tone, label, toneLabels, className, ...props }) {
|
|
|
7051
7072
|
"div",
|
|
7052
7073
|
{
|
|
7053
7074
|
className: "uix-meter__fill",
|
|
7054
|
-
style: {
|
|
7075
|
+
style: { "--val": pct / 100 },
|
|
7055
7076
|
...tone && tone !== "success" ? { "data-tone": tone } : {}
|
|
7056
7077
|
}
|
|
7057
7078
|
)
|
|
@@ -7060,11 +7081,11 @@ function Meter({ value = 0, tone, label, toneLabels, className, ...props }) {
|
|
|
7060
7081
|
}
|
|
7061
7082
|
|
|
7062
7083
|
// src/components/Stat.tsx
|
|
7063
|
-
var
|
|
7084
|
+
var import_react50 = require("react");
|
|
7064
7085
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
7065
7086
|
var Chevron3 = () => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "uix-stat__chevron", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("path", { d: "m6 9 6 6 6-6" }) }) });
|
|
7066
|
-
var Stat = (0,
|
|
7067
|
-
const id = (0,
|
|
7087
|
+
var Stat = (0, import_react50.forwardRef)(function Stat2({ label, value, icon, meta, trend, tone = "neutral", size = "hero", onActivate, activateLabel, expanded, trendLabels, haspopup = "dialog", href, current, renderLink, className, onClick, onKeyDown, pending = false, ...props }, ref) {
|
|
7088
|
+
const id = (0, import_react50.useId)();
|
|
7068
7089
|
const interactive = onActivate != null;
|
|
7069
7090
|
const linked = !interactive && href != null;
|
|
7070
7091
|
const classes = cx(
|
|
@@ -7327,7 +7348,7 @@ function predictionBand(fit, xs, level = 0.8) {
|
|
|
7327
7348
|
}
|
|
7328
7349
|
|
|
7329
7350
|
// src/components/Chip.tsx
|
|
7330
|
-
var
|
|
7351
|
+
var import_react51 = require("react");
|
|
7331
7352
|
|
|
7332
7353
|
// src/components/ChipRemove.tsx
|
|
7333
7354
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
@@ -7339,7 +7360,7 @@ function ChipRemoveButton({ label, text, disabled, onRemove }) {
|
|
|
7339
7360
|
|
|
7340
7361
|
// src/components/Chip.tsx
|
|
7341
7362
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
7342
|
-
var Chip = (0,
|
|
7363
|
+
var Chip = (0, import_react51.forwardRef)(function Chip2({
|
|
7343
7364
|
children,
|
|
7344
7365
|
icon,
|
|
7345
7366
|
count: count2,
|
|
@@ -7429,7 +7450,7 @@ function ChipGroup({ label, children, className, ...props }) {
|
|
|
7429
7450
|
}
|
|
7430
7451
|
|
|
7431
7452
|
// src/components/Steps.tsx
|
|
7432
|
-
var
|
|
7453
|
+
var import_react52 = require("react");
|
|
7433
7454
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
7434
7455
|
var DEFAULT_STEP_STATE_LABELS = {
|
|
7435
7456
|
complete: "Completed",
|
|
@@ -7442,9 +7463,9 @@ var CSS_STATE = { complete: "done", current: "active", upcoming: void 0, waiting
|
|
|
7442
7463
|
var Check = () => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("svg", { viewBox: "0 0 16 16", width: "12", height: "12", fill: "none", stroke: "currentColor", strokeWidth: 2.25, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("path", { d: "M3.5 8.5l3 3 6-7" }) });
|
|
7443
7464
|
function Steps({ orientation = "horizontal", progress = true, headingLevel, label, stateLabels, className, children, ...props }) {
|
|
7444
7465
|
const labels = { ...DEFAULT_STEP_STATE_LABELS, ...stateLabels };
|
|
7445
|
-
const steps =
|
|
7466
|
+
const steps = import_react52.Children.toArray(children).filter(import_react52.isValidElement);
|
|
7446
7467
|
const direction = progress ? orientation : "vertical";
|
|
7447
|
-
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("ol", { "aria-label": label, className: cx("uix-steps", "uix-steps--list", `uix-steps--${direction}`, !progress && "uix-steps--sections", className), ...props, children: steps.map((step, index) => (0,
|
|
7468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("ol", { "aria-label": label, className: cx("uix-steps", "uix-steps--list", `uix-steps--${direction}`, !progress && "uix-steps--sections", className), ...props, children: steps.map((step, index) => (0, import_react52.cloneElement)(step, { index, last: index === steps.length - 1, stateLabels: labels, progress, headingLevel })) });
|
|
7448
7469
|
}
|
|
7449
7470
|
function Step({
|
|
7450
7471
|
title,
|
|
@@ -7463,7 +7484,7 @@ function Step({
|
|
|
7463
7484
|
className,
|
|
7464
7485
|
...props
|
|
7465
7486
|
}) {
|
|
7466
|
-
const titleId = (0,
|
|
7487
|
+
const titleId = (0, import_react52.useId)();
|
|
7467
7488
|
const glyph = marker ?? (!progress ? index + 1 : state === "complete" ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Check, {}) : state === "error" ? "!" : index + 1);
|
|
7468
7489
|
const Title = headingLevel ? `h${headingLevel}` : "span";
|
|
7469
7490
|
const name = /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
@@ -7496,16 +7517,16 @@ function Step({
|
|
|
7496
7517
|
}
|
|
7497
7518
|
|
|
7498
7519
|
// src/components/Tooltip.tsx
|
|
7499
|
-
var
|
|
7520
|
+
var import_react53 = require("react");
|
|
7500
7521
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
7501
7522
|
function Tooltip({ label, content, placement = "top", shortcut, className, children, ...props }) {
|
|
7502
|
-
const triggerRef = (0,
|
|
7503
|
-
const bubbleRef = (0,
|
|
7504
|
-
const closeTimer = (0,
|
|
7505
|
-
const [open, setOpen] = (0,
|
|
7506
|
-
const id = (0,
|
|
7523
|
+
const triggerRef = (0, import_react53.useRef)(null);
|
|
7524
|
+
const bubbleRef = (0, import_react53.useRef)(null);
|
|
7525
|
+
const closeTimer = (0, import_react53.useRef)(null);
|
|
7526
|
+
const [open, setOpen] = (0, import_react53.useState)(false);
|
|
7527
|
+
const id = (0, import_react53.useId)();
|
|
7507
7528
|
const platform = useKbdPlatform();
|
|
7508
|
-
const childShortcut = (0,
|
|
7529
|
+
const childShortcut = (0, import_react53.isValidElement)(children) ? children.props.shortcut : void 0;
|
|
7509
7530
|
const own = shortcut ?? (isKeyShortcut(childShortcut) ? childShortcut : void 0);
|
|
7510
7531
|
const keys = own && own.length > 0 ? own : null;
|
|
7511
7532
|
const keyshortcuts = keys ? ariaKeyShortcuts(keys, platform) : void 0;
|
|
@@ -7542,7 +7563,7 @@ function Tooltip({ label, content, placement = "top", shortcut, className, child
|
|
|
7542
7563
|
cancelClose();
|
|
7543
7564
|
closeTimer.current = window.setTimeout(hide, 100);
|
|
7544
7565
|
};
|
|
7545
|
-
(0,
|
|
7566
|
+
(0, import_react53.useEffect)(() => {
|
|
7546
7567
|
if (!open) return;
|
|
7547
7568
|
const onKey = (e) => {
|
|
7548
7569
|
if (e.key === "Escape") hide();
|
|
@@ -7550,7 +7571,7 @@ function Tooltip({ label, content, placement = "top", shortcut, className, child
|
|
|
7550
7571
|
document.addEventListener("keydown", onKey);
|
|
7551
7572
|
return () => document.removeEventListener("keydown", onKey);
|
|
7552
7573
|
}, [open]);
|
|
7553
|
-
(0,
|
|
7574
|
+
(0, import_react53.useEffect)(() => () => {
|
|
7554
7575
|
if (closeTimer.current != null) clearTimeout(closeTimer.current);
|
|
7555
7576
|
const b = bubbleRef.current;
|
|
7556
7577
|
if (b && b.matches(":popover-open")) {
|
|
@@ -7561,8 +7582,8 @@ function Tooltip({ label, content, placement = "top", shortcut, className, child
|
|
|
7561
7582
|
}
|
|
7562
7583
|
}, []);
|
|
7563
7584
|
const bubbleAttr = { popover: "manual" };
|
|
7564
|
-
const single = (0,
|
|
7565
|
-
const child = single ? (0,
|
|
7585
|
+
const single = (0, import_react53.isValidElement)(children);
|
|
7586
|
+
const child = single ? (0, import_react53.cloneElement)(children, {
|
|
7566
7587
|
"aria-describedby": [children.props["aria-describedby"], id].filter(Boolean).join(" "),
|
|
7567
7588
|
...keyshortcuts ? { "aria-keyshortcuts": keyshortcuts } : {}
|
|
7568
7589
|
}) : children;
|
|
@@ -7669,7 +7690,7 @@ function LoadingState({ rows = 3, density = "comfortable", label, className, ...
|
|
|
7669
7690
|
}
|
|
7670
7691
|
|
|
7671
7692
|
// src/components/RelativeTime.tsx
|
|
7672
|
-
var
|
|
7693
|
+
var import_react54 = require("react");
|
|
7673
7694
|
|
|
7674
7695
|
// src/relative-time-model.ts
|
|
7675
7696
|
function parseDateValue(value) {
|
|
@@ -7732,12 +7753,12 @@ function RelativeTime({
|
|
|
7732
7753
|
}) {
|
|
7733
7754
|
const interval = refreshInterval === false ? 0 : Math.max(0, refreshInterval);
|
|
7734
7755
|
const fixedNow = now == null ? void 0 : new Date(now).getTime();
|
|
7735
|
-
const
|
|
7756
|
+
const subscribe2 = (0, import_react54.useCallback)((listener) => fixedNow == null ? subscribeRelativeClock(interval, listener) : () => {
|
|
7736
7757
|
}, [fixedNow, interval]);
|
|
7737
|
-
const getSnapshot = (0,
|
|
7738
|
-
const getServerSnapshot = (0,
|
|
7739
|
-
const clock = (0,
|
|
7740
|
-
const date = (0,
|
|
7758
|
+
const getSnapshot = (0, import_react54.useCallback)(() => fixedNow ?? readRelativeClock(interval), [fixedNow, interval]);
|
|
7759
|
+
const getServerSnapshot = (0, import_react54.useCallback)(() => fixedNow ?? Date.now(), [fixedNow]);
|
|
7760
|
+
const clock = (0, import_react54.useSyncExternalStore)(subscribe2, getSnapshot, getServerSnapshot);
|
|
7761
|
+
const date = (0, import_react54.useMemo)(() => parseDateValue(value), [value]);
|
|
7741
7762
|
if (!date) return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("time", { "data-invalid": "true", suppressHydrationWarning: true, ...props, children: invalidLabel });
|
|
7742
7763
|
const current = new Date(clock);
|
|
7743
7764
|
const content = formatter ? formatter({ date, now: current, locale, timeZone }) : (() => {
|
|
@@ -7889,13 +7910,13 @@ function SaveStatus({ state, labels, onRetry, className, ...props }) {
|
|
|
7889
7910
|
}
|
|
7890
7911
|
|
|
7891
7912
|
// src/components/Composer.tsx
|
|
7892
|
-
var
|
|
7913
|
+
var import_react55 = require("react");
|
|
7893
7914
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
7894
7915
|
function Composer({ children, className, label = "Add a comment", ...props }) {
|
|
7895
|
-
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: cx("uix-composer", className), ...props, children:
|
|
7896
|
-
if (!(0,
|
|
7916
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: cx("uix-composer", className), ...props, children: import_react55.Children.map(children, (child) => {
|
|
7917
|
+
if (!(0, import_react55.isValidElement)(child) || child.type !== "textarea") return child;
|
|
7897
7918
|
const p = child.props;
|
|
7898
|
-
return p["aria-label"] || p["aria-labelledby"] || p.id ? child : (0,
|
|
7919
|
+
return p["aria-label"] || p["aria-labelledby"] || p.id ? child : (0, import_react55.cloneElement)(child, { "aria-label": label });
|
|
7899
7920
|
}) });
|
|
7900
7921
|
}
|
|
7901
7922
|
function ComposerBar({ children, className, ...props }) {
|
|
@@ -7903,14 +7924,14 @@ function ComposerBar({ children, className, ...props }) {
|
|
|
7903
7924
|
}
|
|
7904
7925
|
|
|
7905
7926
|
// src/components/Segmented.tsx
|
|
7906
|
-
var
|
|
7927
|
+
var import_react56 = require("react");
|
|
7907
7928
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
7908
|
-
var SegmentedCtx = (0,
|
|
7929
|
+
var SegmentedCtx = (0, import_react56.createContext)({});
|
|
7909
7930
|
var OPTION = ".uix-segmented__option";
|
|
7910
7931
|
function Segmented({ value, onChange, selection = "toggle", children, className, onKeyDown, ...props }) {
|
|
7911
|
-
const ref = (0,
|
|
7912
|
-
const contextValue = (0,
|
|
7913
|
-
(0,
|
|
7932
|
+
const ref = (0, import_react56.useRef)(null);
|
|
7933
|
+
const contextValue = (0, import_react56.useMemo)(() => ({ value, onChange, selection }), [value, onChange, selection]);
|
|
7934
|
+
(0, import_react56.useEffect)(() => {
|
|
7914
7935
|
const group = ref.current;
|
|
7915
7936
|
if (!group) return;
|
|
7916
7937
|
const all = Array.from(group.querySelectorAll(OPTION));
|
|
@@ -7967,7 +7988,7 @@ function SegmentedOption({
|
|
|
7967
7988
|
onClick,
|
|
7968
7989
|
...props
|
|
7969
7990
|
}) {
|
|
7970
|
-
const ctx = (0,
|
|
7991
|
+
const ctx = (0, import_react56.useContext)(SegmentedCtx);
|
|
7971
7992
|
const selected = ctx.value === value;
|
|
7972
7993
|
const radio = ctx.selection === "radio";
|
|
7973
7994
|
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
@@ -7990,7 +8011,7 @@ function SegmentedOption({
|
|
|
7990
8011
|
}
|
|
7991
8012
|
|
|
7992
8013
|
// src/components/TableControls.tsx
|
|
7993
|
-
var
|
|
8014
|
+
var import_react57 = require("react");
|
|
7994
8015
|
|
|
7995
8016
|
// src/components/EditorIcons.tsx
|
|
7996
8017
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
@@ -8066,11 +8087,11 @@ var isPopoverOpen2 = (el) => {
|
|
|
8066
8087
|
}
|
|
8067
8088
|
};
|
|
8068
8089
|
function ColumnRowMenu({ label, actions, triggerRef }) {
|
|
8069
|
-
const [open, setOpen] = (0,
|
|
8070
|
-
const menuId = (0,
|
|
8071
|
-
const button = (0,
|
|
8072
|
-
const items = (0,
|
|
8073
|
-
const wasOpenAtPress = (0,
|
|
8090
|
+
const [open, setOpen] = (0, import_react57.useState)(false);
|
|
8091
|
+
const menuId = (0, import_react57.useId)();
|
|
8092
|
+
const button = (0, import_react57.useRef)(null);
|
|
8093
|
+
const items = (0, import_react57.useRef)([]);
|
|
8094
|
+
const wasOpenAtPress = (0, import_react57.useRef)(false);
|
|
8074
8095
|
const enabled = () => items.current.filter((el) => !!el && !el.disabled);
|
|
8075
8096
|
const close = (returnFocus) => {
|
|
8076
8097
|
const el = document.getElementById(menuId);
|
|
@@ -8078,7 +8099,7 @@ function ColumnRowMenu({ label, actions, triggerRef }) {
|
|
|
8078
8099
|
setOpen(false);
|
|
8079
8100
|
if (returnFocus) button.current?.focus();
|
|
8080
8101
|
};
|
|
8081
|
-
(0,
|
|
8102
|
+
(0, import_react57.useEffect)(() => {
|
|
8082
8103
|
if (!open) return;
|
|
8083
8104
|
const el = document.getElementById(menuId);
|
|
8084
8105
|
if (el && typeof el.showPopover === "function" && !isPopoverOpen2(el)) {
|
|
@@ -8181,25 +8202,25 @@ function ViewMenu({
|
|
|
8181
8202
|
footer,
|
|
8182
8203
|
className
|
|
8183
8204
|
}) {
|
|
8184
|
-
const baseId = (0,
|
|
8205
|
+
const baseId = (0, import_react57.useId)();
|
|
8185
8206
|
const densityLabelId = `${baseId}-density`;
|
|
8186
8207
|
const zebraLabelId = `${baseId}-zebra`;
|
|
8187
8208
|
const freezeLabelId = `${baseId}-freeze`;
|
|
8188
8209
|
const columnsLabelId = `${baseId}-columns`;
|
|
8189
8210
|
const labels = { ...VIEW_MENU_COLUMN_LABELS, ...columnLabels };
|
|
8190
8211
|
const list = columns ?? [];
|
|
8191
|
-
const [draft, setDraft] = (0,
|
|
8192
|
-
const [announcement, setAnnouncement] = (0,
|
|
8193
|
-
const dragStart = (0,
|
|
8194
|
-
const listRef = (0,
|
|
8195
|
-
const triggers = (0,
|
|
8196
|
-
const refocus = (0,
|
|
8212
|
+
const [draft, setDraft] = (0, import_react57.useState)(null);
|
|
8213
|
+
const [announcement, setAnnouncement] = (0, import_react57.useState)("");
|
|
8214
|
+
const dragStart = (0, import_react57.useRef)(null);
|
|
8215
|
+
const listRef = (0, import_react57.useRef)(null);
|
|
8216
|
+
const triggers = (0, import_react57.useRef)(/* @__PURE__ */ new Map());
|
|
8217
|
+
const refocus = (0, import_react57.useRef)(null);
|
|
8197
8218
|
const orderKey = JSON.stringify(list.map((column) => column.id));
|
|
8198
|
-
(0,
|
|
8219
|
+
(0, import_react57.useEffect)(() => setDraft(null), [orderKey]);
|
|
8199
8220
|
const order = draft ?? list.map((column) => column.id);
|
|
8200
8221
|
const byId = new Map(list.map((column) => [column.id, column]));
|
|
8201
8222
|
const ordered = order.map((id) => byId.get(id)).filter((column) => !!column);
|
|
8202
|
-
(0,
|
|
8223
|
+
(0, import_react57.useEffect)(() => {
|
|
8203
8224
|
const target = refocus.current;
|
|
8204
8225
|
refocus.current = null;
|
|
8205
8226
|
if (!target) return;
|
|
@@ -8321,7 +8342,7 @@ function ViewMenu({
|
|
|
8321
8342
|
] });
|
|
8322
8343
|
}
|
|
8323
8344
|
function FilterPopover({ label, type = "text", value, onValueChange, options, applyLabel, clearLabel, onApply, onClear, placeholder }) {
|
|
8324
|
-
const controlId = (0,
|
|
8345
|
+
const controlId = (0, import_react57.useId)();
|
|
8325
8346
|
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "uix-filter-popover", children: [
|
|
8326
8347
|
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "uix-field", children: [
|
|
8327
8348
|
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("label", { className: "uix-field__label", htmlFor: controlId, children: label }),
|
|
@@ -8344,11 +8365,11 @@ function dropIndex(rows, dragged, clientY) {
|
|
|
8344
8365
|
return index;
|
|
8345
8366
|
}
|
|
8346
8367
|
function useRowDrag(rowSelector, handlers) {
|
|
8347
|
-
const [dragging, setDragging] = (0,
|
|
8348
|
-
const drag = (0,
|
|
8349
|
-
const latest = (0,
|
|
8368
|
+
const [dragging, setDragging] = (0, import_react57.useState)(null);
|
|
8369
|
+
const drag = (0, import_react57.useRef)(null);
|
|
8370
|
+
const latest = (0, import_react57.useRef)(handlers);
|
|
8350
8371
|
latest.current = handlers;
|
|
8351
|
-
(0,
|
|
8372
|
+
(0, import_react57.useEffect)(() => {
|
|
8352
8373
|
if (!dragging) return;
|
|
8353
8374
|
const move = (event) => {
|
|
8354
8375
|
const current = drag.current;
|
|
@@ -8388,13 +8409,13 @@ function placeId(ids, id, index) {
|
|
|
8388
8409
|
return next;
|
|
8389
8410
|
}
|
|
8390
8411
|
function SavedViewMenu({ items, sections, onSelect, onPinChange, pinLabel, unpinLabel, onReorder, reorderLabel, emptyLabel, actions, footer }) {
|
|
8391
|
-
const baseId = (0,
|
|
8412
|
+
const baseId = (0, import_react57.useId)();
|
|
8392
8413
|
const groups = sections ?? [{ id: void 0, items: items ?? [] }];
|
|
8393
|
-
const [draft, setDraft] = (0,
|
|
8394
|
-
const dragStart = (0,
|
|
8395
|
-
const dragGroup = (0,
|
|
8414
|
+
const [draft, setDraft] = (0, import_react57.useState)(null);
|
|
8415
|
+
const dragStart = (0, import_react57.useRef)(null);
|
|
8416
|
+
const dragGroup = (0, import_react57.useRef)(void 0);
|
|
8396
8417
|
const orderKey = JSON.stringify(groups.map((group) => [group.id, group.items.map((item) => item.id)]));
|
|
8397
|
-
(0,
|
|
8418
|
+
(0, import_react57.useEffect)(() => setDraft(null), [orderKey]);
|
|
8398
8419
|
const orderOf = (group) => draft && draft.group === group.id ? draft.ids : group.items.map((item) => item.id);
|
|
8399
8420
|
const move = (group, id, delta) => {
|
|
8400
8421
|
const current = orderOf(group);
|
|
@@ -8471,7 +8492,7 @@ function SavedViewMenu({ items, sections, onSelect, onPinChange, pinLabel, unpin
|
|
|
8471
8492
|
}
|
|
8472
8493
|
|
|
8473
8494
|
// src/components/FilterEditor.tsx
|
|
8474
|
-
var
|
|
8495
|
+
var import_react58 = require("react");
|
|
8475
8496
|
|
|
8476
8497
|
// src/filter-model.ts
|
|
8477
8498
|
var DEFAULT_FILTER_SUMMARY_LABELS = {
|
|
@@ -8615,7 +8636,7 @@ function FilterEditor({ field, value: valueProp, onValueChange, onApply, onClear
|
|
|
8615
8636
|
...labelOverrides,
|
|
8616
8637
|
operators: { ...DEFAULT_FILTER_EDITOR_LABELS.operators, ...provided?.operators, ...labelOverrides?.operators }
|
|
8617
8638
|
};
|
|
8618
|
-
const id = (0,
|
|
8639
|
+
const id = (0, import_react58.useId)();
|
|
8619
8640
|
const value = valueProp?.kind === field.kind ? valueProp : emptyFilterValue(field.kind);
|
|
8620
8641
|
let body = null;
|
|
8621
8642
|
switch (value.kind) {
|
|
@@ -8681,9 +8702,9 @@ function FilterEditor({ field, value: valueProp, onValueChange, onApply, onClear
|
|
|
8681
8702
|
] });
|
|
8682
8703
|
}
|
|
8683
8704
|
function EnumBody({ field, value, onChange, labels, threshold }) {
|
|
8684
|
-
const [query, setQuery] = (0,
|
|
8705
|
+
const [query, setQuery] = (0, import_react58.useState)("");
|
|
8685
8706
|
const options = field.options ?? [];
|
|
8686
|
-
const shown = (0,
|
|
8707
|
+
const shown = (0, import_react58.useMemo)(() => {
|
|
8687
8708
|
const q = foldForSearch(query.trim()).text;
|
|
8688
8709
|
return q ? options.filter((o) => foldForSearch(o.label).text.includes(q)) : options;
|
|
8689
8710
|
}, [options, query]);
|
|
@@ -8703,11 +8724,11 @@ function EnumBody({ field, value, onChange, labels, threshold }) {
|
|
|
8703
8724
|
] });
|
|
8704
8725
|
}
|
|
8705
8726
|
function ReferenceBody({ field, value, onChange, labels, delay }) {
|
|
8706
|
-
const [query, setQuery] = (0,
|
|
8707
|
-
const [state, setState] = (0,
|
|
8708
|
-
const [attempt, setAttempt] = (0,
|
|
8709
|
-
const latest = (0,
|
|
8710
|
-
(0,
|
|
8727
|
+
const [query, setQuery] = (0, import_react58.useState)("");
|
|
8728
|
+
const [state, setState] = (0, import_react58.useState)({ status: "idle", results: [] });
|
|
8729
|
+
const [attempt, setAttempt] = (0, import_react58.useState)(0);
|
|
8730
|
+
const latest = (0, import_react58.useRef)(0);
|
|
8731
|
+
(0, import_react58.useEffect)(() => {
|
|
8711
8732
|
if (!field.onSearch) return;
|
|
8712
8733
|
const run = ++latest.current;
|
|
8713
8734
|
const timer = window.setTimeout(() => {
|
|
@@ -8760,10 +8781,10 @@ function TimelineItem({ node, meta, children, className, ...props }) {
|
|
|
8760
8781
|
}
|
|
8761
8782
|
|
|
8762
8783
|
// src/components/Pipeline.tsx
|
|
8763
|
-
var
|
|
8784
|
+
var import_react59 = require("react");
|
|
8764
8785
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
8765
8786
|
function Pipeline({ detailed = false, children, className, tabIndex, ...props }) {
|
|
8766
|
-
const stages = detailed ?
|
|
8787
|
+
const stages = detailed ? import_react59.Children.map(children, (child) => (0, import_react59.isValidElement)(child) && child.type === PipelineStage ? (0, import_react59.cloneElement)(child, { detailed: child.props.detailed ?? true }) : child) : children;
|
|
8767
8788
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
8768
8789
|
"ol",
|
|
8769
8790
|
{
|
|
@@ -8879,7 +8900,7 @@ function Note({ tone, icon, children, className, ...props }) {
|
|
|
8879
8900
|
}
|
|
8880
8901
|
|
|
8881
8902
|
// src/components/Menu.tsx
|
|
8882
|
-
var
|
|
8903
|
+
var import_react60 = require("react");
|
|
8883
8904
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
8884
8905
|
function useRowShortcut(shortcut) {
|
|
8885
8906
|
const platform = useKbdPlatform();
|
|
@@ -8890,8 +8911,8 @@ function useRowShortcut(shortcut) {
|
|
|
8890
8911
|
aria: { "aria-keyshortcuts": ariaKeyShortcuts(shortcut, platform) }
|
|
8891
8912
|
};
|
|
8892
8913
|
}
|
|
8893
|
-
var MenuContext = (0,
|
|
8894
|
-
var MenuRadioContext = (0,
|
|
8914
|
+
var MenuContext = (0, import_react60.createContext)(null);
|
|
8915
|
+
var MenuRadioContext = (0, import_react60.createContext)(null);
|
|
8895
8916
|
var ITEM = '[role^="menuitem"]:not([aria-disabled="true"])';
|
|
8896
8917
|
var itemAttributes = (rest) => {
|
|
8897
8918
|
const out = {};
|
|
@@ -8899,14 +8920,14 @@ var itemAttributes = (rest) => {
|
|
|
8899
8920
|
return out;
|
|
8900
8921
|
};
|
|
8901
8922
|
function Menu({ trigger, children, open: controlledOpen, defaultOpen = false, onOpenChange, label, placement = "bottom-start", className }) {
|
|
8902
|
-
const id = (0,
|
|
8923
|
+
const id = (0, import_react60.useId)();
|
|
8903
8924
|
const menuId = `${id}-menu`;
|
|
8904
8925
|
const triggerId = `${id}-trigger`;
|
|
8905
|
-
const triggerRef = (0,
|
|
8906
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
8926
|
+
const triggerRef = (0, import_react60.useRef)(null);
|
|
8927
|
+
const [internalOpen, setInternalOpen] = (0, import_react60.useState)(defaultOpen);
|
|
8907
8928
|
const open = controlledOpen ?? internalOpen;
|
|
8908
|
-
const focusOnOpen = (0,
|
|
8909
|
-
const typeahead2 = (0,
|
|
8929
|
+
const focusOnOpen = (0, import_react60.useRef)("first");
|
|
8930
|
+
const typeahead2 = (0, import_react60.useRef)({ text: "", at: 0 });
|
|
8910
8931
|
const setOpen = (next) => {
|
|
8911
8932
|
if (controlledOpen === void 0) setInternalOpen(next);
|
|
8912
8933
|
onOpenChange?.(next);
|
|
@@ -8917,7 +8938,7 @@ function Menu({ trigger, children, open: controlledOpen, defaultOpen = false, on
|
|
|
8917
8938
|
setOpen(false);
|
|
8918
8939
|
if (refocus) triggerRef.current?.focus();
|
|
8919
8940
|
};
|
|
8920
|
-
(0,
|
|
8941
|
+
(0, import_react60.useEffect)(() => {
|
|
8921
8942
|
const el = menu();
|
|
8922
8943
|
if (!el) return;
|
|
8923
8944
|
const shown = () => {
|
|
@@ -8977,8 +8998,8 @@ function Menu({ trigger, children, open: controlledOpen, defaultOpen = false, on
|
|
|
8977
8998
|
order.find((item) => (item.textContent ?? "").trim().toLowerCase().startsWith(typeahead2.current.text))?.focus();
|
|
8978
8999
|
}
|
|
8979
9000
|
};
|
|
8980
|
-
const triggerProps = (0,
|
|
8981
|
-
const triggerElement = (0,
|
|
9001
|
+
const triggerProps = (0, import_react60.isValidElement)(trigger) ? trigger.props : {};
|
|
9002
|
+
const triggerElement = (0, import_react60.isValidElement)(trigger) ? (0, import_react60.cloneElement)(trigger, {
|
|
8982
9003
|
ref: (node) => {
|
|
8983
9004
|
triggerRef.current = node;
|
|
8984
9005
|
},
|
|
@@ -9032,7 +9053,7 @@ function Menu({ trigger, children, open: controlledOpen, defaultOpen = false, on
|
|
|
9032
9053
|
] });
|
|
9033
9054
|
}
|
|
9034
9055
|
function MenuItem({ children, onSelect, href, renderLink, icon, shortcut, tone = "default", disabled, className, ...rest }) {
|
|
9035
|
-
const menu = (0,
|
|
9056
|
+
const menu = (0, import_react60.useContext)(MenuContext);
|
|
9036
9057
|
const classes = cx("uix-menu__item", tone === "danger" && "uix-menu__item--danger", className);
|
|
9037
9058
|
const attributes = itemAttributes(rest);
|
|
9038
9059
|
const keys = useRowShortcut(shortcut);
|
|
@@ -9075,7 +9096,7 @@ function CheckableItem({
|
|
|
9075
9096
|
className,
|
|
9076
9097
|
...rest
|
|
9077
9098
|
}) {
|
|
9078
|
-
const menu = (0,
|
|
9099
|
+
const menu = (0, import_react60.useContext)(MenuContext);
|
|
9079
9100
|
const keys = useRowShortcut(shortcut);
|
|
9080
9101
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
9081
9102
|
"button",
|
|
@@ -9111,14 +9132,14 @@ function CheckableItem({
|
|
|
9111
9132
|
);
|
|
9112
9133
|
}
|
|
9113
9134
|
function MenuRadioGroup({ value, onValueChange, label, "aria-label": ariaLabel, children }) {
|
|
9114
|
-
const id = (0,
|
|
9135
|
+
const id = (0, import_react60.useId)();
|
|
9115
9136
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(MenuRadioContext.Provider, { value: { value, onValueChange }, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { role: "group", "aria-labelledby": label != null ? id : void 0, "aria-label": label != null ? void 0 : ariaLabel, children: [
|
|
9116
9137
|
label != null && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { id, className: "uix-menu__label", children: label }),
|
|
9117
9138
|
children
|
|
9118
9139
|
] }) });
|
|
9119
9140
|
}
|
|
9120
9141
|
function MenuItemRadio({ value, checked, onSelect, closeOnSelect = true, ...rest }) {
|
|
9121
|
-
const group = (0,
|
|
9142
|
+
const group = (0, import_react60.useContext)(MenuRadioContext);
|
|
9122
9143
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
9123
9144
|
CheckableItem,
|
|
9124
9145
|
{
|
|
@@ -9146,7 +9167,7 @@ function MenuItemCheckbox({ checked, onCheckedChange, closeOnSelect = false, ...
|
|
|
9146
9167
|
);
|
|
9147
9168
|
}
|
|
9148
9169
|
function MenuGroup({ label, children }) {
|
|
9149
|
-
const id = (0,
|
|
9170
|
+
const id = (0, import_react60.useId)();
|
|
9150
9171
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { role: "group", "aria-labelledby": id, children: [
|
|
9151
9172
|
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { id, className: "uix-menu__label", children: label }),
|
|
9152
9173
|
children
|
|
@@ -9157,34 +9178,42 @@ function MenuSeparator() {
|
|
|
9157
9178
|
}
|
|
9158
9179
|
|
|
9159
9180
|
// src/components/CommandPalette.tsx
|
|
9160
|
-
var
|
|
9181
|
+
var import_react61 = require("react");
|
|
9161
9182
|
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
9162
|
-
var CmdkContext = (0,
|
|
9183
|
+
var CmdkContext = (0, import_react61.createContext)(null);
|
|
9184
|
+
var useIsomorphicLayoutEffect8 = typeof document !== "undefined" ? import_react61.useLayoutEffect : import_react61.useEffect;
|
|
9163
9185
|
function CommandPalette({ inputProps, children, inputLabel: inputLabelProp, resultsLabel, className, ...props }) {
|
|
9164
9186
|
const uixLabels = useUixLabels();
|
|
9165
9187
|
const inputLabel = inputLabelProp ?? uixLabels.commandPalette?.input ?? "Command palette";
|
|
9166
9188
|
const resultsOne = uixLabels.commandPalette?.resultsOne ?? "{count} result";
|
|
9167
9189
|
const resultsMany = uixLabels.commandPalette?.resultsMany ?? "{count} results";
|
|
9168
9190
|
const resultsText = (count3) => resultsLabel?.(count3) ?? fillLabel(count3 === 1 ? resultsOne : resultsMany, { count: count3 });
|
|
9169
|
-
const resultsTextRef = (0,
|
|
9191
|
+
const resultsTextRef = (0, import_react61.useRef)(resultsText);
|
|
9170
9192
|
resultsTextRef.current = resultsText;
|
|
9171
|
-
const listId = (0,
|
|
9172
|
-
const
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
|
|
9193
|
+
const listId = (0, import_react61.useId)();
|
|
9194
|
+
const rootRef = (0, import_react61.useRef)(null);
|
|
9195
|
+
useIsomorphicLayoutEffect8(() => {
|
|
9196
|
+
const overlay = rootRef.current?.closest("dialog, [popover]");
|
|
9197
|
+
if (!overlay || overlay.hasAttribute("data-uix-instant")) return;
|
|
9198
|
+
overlay.setAttribute("data-uix-instant", "");
|
|
9199
|
+
return () => overlay.removeAttribute("data-uix-instant");
|
|
9200
|
+
}, []);
|
|
9201
|
+
const [activeId, setActiveId] = (0, import_react61.useState)(null);
|
|
9202
|
+
const [count2, setCount] = (0, import_react61.useState)(0);
|
|
9203
|
+
const [announced, setAnnounced] = (0, import_react61.useState)("");
|
|
9204
|
+
const setActive = (0, import_react61.useCallback)((id, active) => {
|
|
9176
9205
|
setActiveId((cur) => active ? id : cur === id ? null : cur);
|
|
9177
9206
|
}, []);
|
|
9178
|
-
const registerItem = (0,
|
|
9207
|
+
const registerItem = (0, import_react61.useCallback)(() => {
|
|
9179
9208
|
setCount((c) => c + 1);
|
|
9180
9209
|
return () => setCount((c) => c - 1);
|
|
9181
9210
|
}, []);
|
|
9182
|
-
(0,
|
|
9211
|
+
(0, import_react61.useEffect)(() => {
|
|
9183
9212
|
const t = window.setTimeout(() => setAnnounced(resultsTextRef.current(count2)), 150);
|
|
9184
9213
|
return () => clearTimeout(t);
|
|
9185
9214
|
}, [count2]);
|
|
9186
|
-
const ctx = (0,
|
|
9187
|
-
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(CmdkContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: cx("uix-cmdk", className), ...props, children: [
|
|
9215
|
+
const ctx = (0, import_react61.useMemo)(() => ({ listId, setActive, registerItem }), [listId, setActive, registerItem]);
|
|
9216
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(CmdkContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { ref: rootRef, className: cx("uix-cmdk", className), ...props, children: [
|
|
9188
9217
|
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
9189
9218
|
"input",
|
|
9190
9219
|
{
|
|
@@ -9203,18 +9232,18 @@ function CommandPalette({ inputProps, children, inputLabel: inputLabelProp, resu
|
|
|
9203
9232
|
] }) });
|
|
9204
9233
|
}
|
|
9205
9234
|
function CommandGroup({ label, children }) {
|
|
9206
|
-
const labelId = (0,
|
|
9235
|
+
const labelId = (0, import_react61.useId)();
|
|
9207
9236
|
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { role: "group", "aria-labelledby": label != null ? labelId : void 0, children: [
|
|
9208
9237
|
label != null && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "uix-cmdk__group", id: labelId, children: label }),
|
|
9209
9238
|
children
|
|
9210
9239
|
] });
|
|
9211
9240
|
}
|
|
9212
9241
|
function CommandItem({ icon, shortcut, active, children, className, id, ...props }) {
|
|
9213
|
-
const ctx = (0,
|
|
9214
|
-
const autoId = (0,
|
|
9242
|
+
const ctx = (0, import_react61.useContext)(CmdkContext);
|
|
9243
|
+
const autoId = (0, import_react61.useId)();
|
|
9215
9244
|
const itemId = id ?? autoId;
|
|
9216
|
-
(0,
|
|
9217
|
-
(0,
|
|
9245
|
+
(0, import_react61.useEffect)(() => ctx?.registerItem(), [ctx]);
|
|
9246
|
+
(0, import_react61.useEffect)(() => {
|
|
9218
9247
|
if (!ctx || !active) return;
|
|
9219
9248
|
ctx.setActive(itemId, true);
|
|
9220
9249
|
return () => ctx.setActive(itemId, false);
|
|
@@ -9238,16 +9267,16 @@ function CommandItem({ icon, shortcut, active, children, className, id, ...props
|
|
|
9238
9267
|
}
|
|
9239
9268
|
|
|
9240
9269
|
// src/components/Inbox.tsx
|
|
9241
|
-
var
|
|
9270
|
+
var import_react62 = require("react");
|
|
9242
9271
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
9243
9272
|
function Inbox({ view, children, className, ...props }) {
|
|
9244
9273
|
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: cx("uix-inbox", className), "data-view": view, ...props, children });
|
|
9245
9274
|
}
|
|
9246
|
-
var InboxListCtx = (0,
|
|
9275
|
+
var InboxListCtx = (0, import_react62.createContext)({});
|
|
9247
9276
|
function InboxList({ children, listLabel = "Inbox", className, ...props }) {
|
|
9248
|
-
const listRef = (0,
|
|
9249
|
-
const [activeId, setActiveId] = (0,
|
|
9250
|
-
const ctx = (0,
|
|
9277
|
+
const listRef = (0, import_react62.useRef)(null);
|
|
9278
|
+
const [activeId, setActiveId] = (0, import_react62.useState)(void 0);
|
|
9279
|
+
const ctx = (0, import_react62.useMemo)(() => ({ activeId }), [activeId]);
|
|
9251
9280
|
const onKeyDown = (e) => {
|
|
9252
9281
|
const opts = Array.from(listRef.current?.querySelectorAll('[role="option"]') ?? []);
|
|
9253
9282
|
if (opts.length === 0) return;
|
|
@@ -9308,9 +9337,9 @@ function InboxItem({
|
|
|
9308
9337
|
id,
|
|
9309
9338
|
...props
|
|
9310
9339
|
}) {
|
|
9311
|
-
const autoId = (0,
|
|
9340
|
+
const autoId = (0, import_react62.useId)();
|
|
9312
9341
|
const itemId = id ?? autoId;
|
|
9313
|
-
const { activeId } = (0,
|
|
9342
|
+
const { activeId } = (0, import_react62.useContext)(InboxListCtx);
|
|
9314
9343
|
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
|
|
9315
9344
|
"div",
|
|
9316
9345
|
{
|
|
@@ -9335,7 +9364,7 @@ function InboxDetail({ children, className, ...props }) {
|
|
|
9335
9364
|
}
|
|
9336
9365
|
|
|
9337
9366
|
// src/components/Kanban.tsx
|
|
9338
|
-
var
|
|
9367
|
+
var import_react63 = require("react");
|
|
9339
9368
|
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
9340
9369
|
function Kanban({ announcement, children, className, ...props }) {
|
|
9341
9370
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: cx("uix-kanban", className), ...props, children: [
|
|
@@ -9344,7 +9373,7 @@ function Kanban({ announcement, children, className, ...props }) {
|
|
|
9344
9373
|
] });
|
|
9345
9374
|
}
|
|
9346
9375
|
function KanbanColumn({ title, count: count2, children, className, ...props }) {
|
|
9347
|
-
const headId = (0,
|
|
9376
|
+
const headId = (0, import_react63.useId)();
|
|
9348
9377
|
const hasHead = title != null || count2 != null;
|
|
9349
9378
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: cx("uix-kanban__col", className), ...props, children: [
|
|
9350
9379
|
hasHead && /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "uix-kanban__head", id: headId, children: [
|
|
@@ -9388,7 +9417,7 @@ function KanbanCard({ title, meta, children, className, onMove, onKeyDown, ...pr
|
|
|
9388
9417
|
}
|
|
9389
9418
|
|
|
9390
9419
|
// src/components/Tree.tsx
|
|
9391
|
-
var
|
|
9420
|
+
var import_react64 = require("react");
|
|
9392
9421
|
|
|
9393
9422
|
// src/tree-model.ts
|
|
9394
9423
|
function flattenTree(nodes, expanded, level = 1) {
|
|
@@ -9542,22 +9571,22 @@ function Tree({
|
|
|
9542
9571
|
className,
|
|
9543
9572
|
...props
|
|
9544
9573
|
}) {
|
|
9545
|
-
const [internalExpanded, setInternalExpanded] = (0,
|
|
9574
|
+
const [internalExpanded, setInternalExpanded] = (0, import_react64.useState)(defaultExpanded ?? /* @__PURE__ */ new Set());
|
|
9546
9575
|
const expanded = controlledExpanded ?? internalExpanded;
|
|
9547
|
-
const rootRef = (0,
|
|
9548
|
-
const [focusedId, setFocusedId] = (0,
|
|
9576
|
+
const rootRef = (0, import_react64.useRef)(null);
|
|
9577
|
+
const [focusedId, setFocusedId] = (0, import_react64.useState)(void 0);
|
|
9549
9578
|
const selectable = selected !== void 0 || onSelectProp != null;
|
|
9550
9579
|
const rowToggles = toggleOnRowClick ?? !selectable;
|
|
9551
9580
|
const labels = { ...DEFAULT_TREE_LABELS, ...useUixLabels().tree, ...labelOverrides };
|
|
9552
|
-
const treeId = (0,
|
|
9553
|
-
const [loaded, setLoaded] = (0,
|
|
9554
|
-
const [failed, setFailed] = (0,
|
|
9555
|
-
const [loading, setLoading] = (0,
|
|
9556
|
-
const inFlight = (0,
|
|
9557
|
-
const loadRef = (0,
|
|
9581
|
+
const treeId = (0, import_react64.useId)();
|
|
9582
|
+
const [loaded, setLoaded] = (0, import_react64.useState)(() => /* @__PURE__ */ new Map());
|
|
9583
|
+
const [failed, setFailed] = (0, import_react64.useState)(() => /* @__PURE__ */ new Set());
|
|
9584
|
+
const [loading, setLoading] = (0, import_react64.useState)(() => /* @__PURE__ */ new Set());
|
|
9585
|
+
const inFlight = (0, import_react64.useRef)(/* @__PURE__ */ new Set());
|
|
9586
|
+
const loadRef = (0, import_react64.useRef)(loadChildren);
|
|
9558
9587
|
loadRef.current = loadChildren;
|
|
9559
|
-
const refocus = (0,
|
|
9560
|
-
const nodes = (0,
|
|
9588
|
+
const refocus = (0, import_react64.useRef)(null);
|
|
9589
|
+
const nodes = (0, import_react64.useMemo)(() => {
|
|
9561
9590
|
const row = (parent, kind) => ({
|
|
9562
9591
|
id: parent.id + (kind === "error" ? FAILED : LOADING),
|
|
9563
9592
|
typeaheadLabel: "",
|
|
@@ -9580,7 +9609,7 @@ function Tree({
|
|
|
9580
9609
|
return !!n.hasChildren || !!n.children?.some(lazy);
|
|
9581
9610
|
}) ? decorate(nodesProp) : nodesProp;
|
|
9582
9611
|
}, [nodesProp, loaded, failed, loadChildren, labels.error, labels.retry, labels.loading]);
|
|
9583
|
-
const load = (0,
|
|
9612
|
+
const load = (0, import_react64.useCallback)((node) => {
|
|
9584
9613
|
const run = loadRef.current;
|
|
9585
9614
|
if (!run || inFlight.current.has(node.id)) return;
|
|
9586
9615
|
inFlight.current.add(node.id);
|
|
@@ -9607,7 +9636,7 @@ function Tree({
|
|
|
9607
9636
|
() => settle3(() => setFailed((prev) => new Set(prev).add(node.id)), node.id + FAILED)
|
|
9608
9637
|
);
|
|
9609
9638
|
}, []);
|
|
9610
|
-
(0,
|
|
9639
|
+
(0, import_react64.useEffect)(() => {
|
|
9611
9640
|
if (!loadChildren) return;
|
|
9612
9641
|
const visit = (list) => {
|
|
9613
9642
|
for (const node of list) {
|
|
@@ -9618,7 +9647,7 @@ function Tree({
|
|
|
9618
9647
|
};
|
|
9619
9648
|
visit(nodesProp);
|
|
9620
9649
|
}, [nodesProp, expanded, loaded, failed, loadChildren, load]);
|
|
9621
|
-
(0,
|
|
9650
|
+
(0, import_react64.useEffect)(() => {
|
|
9622
9651
|
const id = refocus.current;
|
|
9623
9652
|
if (id == null) return;
|
|
9624
9653
|
refocus.current = null;
|
|
@@ -9651,7 +9680,7 @@ function Tree({
|
|
|
9651
9680
|
load(parent);
|
|
9652
9681
|
};
|
|
9653
9682
|
const onSelect = selectable || loadChildren ? handleSelect : void 0;
|
|
9654
|
-
const handleToggle = (0,
|
|
9683
|
+
const handleToggle = (0, import_react64.useCallback)((id) => {
|
|
9655
9684
|
if (!controlledExpanded) {
|
|
9656
9685
|
setInternalExpanded((prev) => {
|
|
9657
9686
|
const next = new Set(prev);
|
|
@@ -9662,7 +9691,7 @@ function Tree({
|
|
|
9662
9691
|
}
|
|
9663
9692
|
onToggle?.(id);
|
|
9664
9693
|
}, [controlledExpanded, onToggle]);
|
|
9665
|
-
const flat = (0,
|
|
9694
|
+
const flat = (0, import_react64.useMemo)(() => flattenTree(nodes, expanded), [nodes, expanded]);
|
|
9666
9695
|
const useVirtual = virtualize ?? shouldVirtualize(flat.length);
|
|
9667
9696
|
const tabbableId = focusedId ?? selected ?? nodes[0]?.id;
|
|
9668
9697
|
if (useVirtual) {
|
|
@@ -9781,14 +9810,14 @@ function VirtualTreeView({
|
|
|
9781
9810
|
className,
|
|
9782
9811
|
...props
|
|
9783
9812
|
}) {
|
|
9784
|
-
const scrollRef = (0,
|
|
9785
|
-
const [scrollTop, setScrollTop] = (0,
|
|
9786
|
-
const pendingFocus = (0,
|
|
9787
|
-
const hadFocus = (0,
|
|
9813
|
+
const scrollRef = (0, import_react64.useRef)(null);
|
|
9814
|
+
const [scrollTop, setScrollTop] = (0, import_react64.useState)(0);
|
|
9815
|
+
const pendingFocus = (0, import_react64.useRef)(false);
|
|
9816
|
+
const hadFocus = (0, import_react64.useRef)(false);
|
|
9788
9817
|
const win = virtualWindow(scrollTop, maxHeight, rowHeight, flat.length);
|
|
9789
9818
|
const rows = flat.slice(win.start, win.end);
|
|
9790
9819
|
const windowHasTabbable = tabbableId != null && rows.some((f) => f.node.id === tabbableId);
|
|
9791
|
-
(0,
|
|
9820
|
+
(0, import_react64.useEffect)(() => {
|
|
9792
9821
|
if (!pendingFocus.current || focusedId == null) return;
|
|
9793
9822
|
const el = scrollRef.current?.querySelector(`[role="treeitem"][data-id="${CSS.escape(focusedId)}"]`);
|
|
9794
9823
|
if (el) {
|
|
@@ -9796,7 +9825,7 @@ function VirtualTreeView({
|
|
|
9796
9825
|
pendingFocus.current = false;
|
|
9797
9826
|
}
|
|
9798
9827
|
}, [focusedId, win.start, win.end]);
|
|
9799
|
-
(0,
|
|
9828
|
+
(0, import_react64.useEffect)(() => {
|
|
9800
9829
|
if (!hadFocus.current || pendingFocus.current) return;
|
|
9801
9830
|
const active = document.activeElement;
|
|
9802
9831
|
if (active === document.body || active == null) scrollRef.current?.focus({ preventScroll: true });
|
|
@@ -9913,7 +9942,7 @@ function VirtualTreeView({
|
|
|
9913
9942
|
}
|
|
9914
9943
|
|
|
9915
9944
|
// src/components/OrgChart.tsx
|
|
9916
|
-
var
|
|
9945
|
+
var import_react65 = require("react");
|
|
9917
9946
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
9918
9947
|
var DEFAULT_ORG_CHART_LABELS = {
|
|
9919
9948
|
chart: "Org chart",
|
|
@@ -9962,7 +9991,7 @@ var ChevronIcon3 = () => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("svg", {
|
|
|
9962
9991
|
var PlusIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("path", { d: "M8 3v10M3 8h10" }) });
|
|
9963
9992
|
var MinusIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("path", { d: "M3 8h10" }) });
|
|
9964
9993
|
var FitIcon = () => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("path", { d: "M2 6V2h4M14 6V2h-4M2 10v4h4M14 10v4h-4" }) });
|
|
9965
|
-
var useIsoLayoutEffect = typeof window === "undefined" ?
|
|
9994
|
+
var useIsoLayoutEffect = typeof window === "undefined" ? import_react65.useEffect : import_react65.useLayoutEffect;
|
|
9966
9995
|
var Ring2 = () => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "uix-spinner uix-spinner--sm", "aria-hidden": "true" });
|
|
9967
9996
|
function StatusItem({ parent, kind, level, ctx }) {
|
|
9968
9997
|
const id = parent + (kind === "error" ? FAILED2 : LOADING2);
|
|
@@ -10084,16 +10113,16 @@ function OrgChart({
|
|
|
10084
10113
|
...props
|
|
10085
10114
|
}) {
|
|
10086
10115
|
const labels = { ...DEFAULT_ORG_CHART_LABELS, ...useUixLabels().orgChart, ...labelOverrides };
|
|
10087
|
-
const chartId = (0,
|
|
10088
|
-
const [internalExpanded, setInternalExpanded] = (0,
|
|
10116
|
+
const chartId = (0, import_react65.useId)().replace(/[^A-Za-z0-9_-]/g, "");
|
|
10117
|
+
const [internalExpanded, setInternalExpanded] = (0, import_react65.useState)(() => defaultExpanded ?? /* @__PURE__ */ new Set());
|
|
10089
10118
|
const expanded = controlledExpanded ?? internalExpanded;
|
|
10090
|
-
const treeRef = (0,
|
|
10091
|
-
const viewportRef = (0,
|
|
10092
|
-
const [focusedId, setFocusedId] = (0,
|
|
10119
|
+
const treeRef = (0, import_react65.useRef)(null);
|
|
10120
|
+
const viewportRef = (0, import_react65.useRef)(null);
|
|
10121
|
+
const [focusedId, setFocusedId] = (0, import_react65.useState)(void 0);
|
|
10093
10122
|
const selectable = selected !== void 0 || onSelect != null;
|
|
10094
10123
|
const lazy = Boolean(loadChildren);
|
|
10095
|
-
const userMoved = (0,
|
|
10096
|
-
const placed = (0,
|
|
10124
|
+
const userMoved = (0, import_react65.useRef)(false);
|
|
10125
|
+
const placed = (0, import_react65.useRef)(null);
|
|
10097
10126
|
const scrollFrame = (left, top) => {
|
|
10098
10127
|
const viewport = viewportRef.current;
|
|
10099
10128
|
if (!viewport) return;
|
|
@@ -10101,17 +10130,17 @@ function OrgChart({
|
|
|
10101
10130
|
viewport.scrollTop = top;
|
|
10102
10131
|
placed.current = { left: viewport.scrollLeft, top: viewport.scrollTop };
|
|
10103
10132
|
};
|
|
10104
|
-
const [loaded, setLoaded] = (0,
|
|
10105
|
-
const [failed, setFailed] = (0,
|
|
10106
|
-
const [loading, setLoading] = (0,
|
|
10107
|
-
const [announcement, setAnnouncement] = (0,
|
|
10108
|
-
const inFlight = (0,
|
|
10109
|
-
const loadRef = (0,
|
|
10133
|
+
const [loaded, setLoaded] = (0, import_react65.useState)(() => /* @__PURE__ */ new Map());
|
|
10134
|
+
const [failed, setFailed] = (0, import_react65.useState)(() => /* @__PURE__ */ new Set());
|
|
10135
|
+
const [loading, setLoading] = (0, import_react65.useState)(() => /* @__PURE__ */ new Set());
|
|
10136
|
+
const [announcement, setAnnouncement] = (0, import_react65.useState)("");
|
|
10137
|
+
const inFlight = (0, import_react65.useRef)(/* @__PURE__ */ new Set());
|
|
10138
|
+
const loadRef = (0, import_react65.useRef)(loadChildren);
|
|
10110
10139
|
loadRef.current = loadChildren;
|
|
10111
|
-
const errorWord = (0,
|
|
10140
|
+
const errorWord = (0, import_react65.useRef)(labels.error);
|
|
10112
10141
|
errorWord.current = labels.error;
|
|
10113
|
-
const refocus = (0,
|
|
10114
|
-
const load = (0,
|
|
10142
|
+
const refocus = (0, import_react65.useRef)(null);
|
|
10143
|
+
const load = (0, import_react65.useCallback)((node) => {
|
|
10115
10144
|
const run = loadRef.current;
|
|
10116
10145
|
if (!run || inFlight.current.has(node.id)) return;
|
|
10117
10146
|
inFlight.current.add(node.id);
|
|
@@ -10143,7 +10172,7 @@ function OrgChart({
|
|
|
10143
10172
|
}, node.id + FAILED2)
|
|
10144
10173
|
);
|
|
10145
10174
|
}, []);
|
|
10146
|
-
(0,
|
|
10175
|
+
(0, import_react65.useEffect)(() => {
|
|
10147
10176
|
if (!loadChildren) return;
|
|
10148
10177
|
const visit = (list) => {
|
|
10149
10178
|
for (const node of list) {
|
|
@@ -10155,16 +10184,16 @@ function OrgChart({
|
|
|
10155
10184
|
};
|
|
10156
10185
|
visit(nodes);
|
|
10157
10186
|
}, [nodes, expanded, loaded, failed, loadChildren, load]);
|
|
10158
|
-
const itemEl = (0,
|
|
10187
|
+
const itemEl = (0, import_react65.useCallback)((id) => treeRef.current?.querySelector(`[role="treeitem"][data-id="${CSS.escape(id)}"]`) ?? null, []);
|
|
10159
10188
|
const cardOf = (el) => el?.querySelector(":scope > .uix-org-chart__node, :scope > .uix-org-chart__status") ?? el;
|
|
10160
|
-
(0,
|
|
10189
|
+
(0, import_react65.useEffect)(() => {
|
|
10161
10190
|
const id = refocus.current;
|
|
10162
10191
|
if (id == null) return;
|
|
10163
10192
|
refocus.current = null;
|
|
10164
10193
|
setFocusedId(id);
|
|
10165
10194
|
itemEl(id)?.focus();
|
|
10166
10195
|
}, [loaded, failed, loading, itemEl]);
|
|
10167
|
-
const findPath = (0,
|
|
10196
|
+
const findPath = (0, import_react65.useCallback)((id, list = nodes, path = []) => {
|
|
10168
10197
|
for (const node of list) {
|
|
10169
10198
|
if (node.id === id) return [...path, node];
|
|
10170
10199
|
const inside = findPath(id, node.children ?? loaded.get(node.id) ?? [], [...path, node]);
|
|
@@ -10172,7 +10201,7 @@ function OrgChart({
|
|
|
10172
10201
|
}
|
|
10173
10202
|
return null;
|
|
10174
10203
|
}, [nodes, loaded]);
|
|
10175
|
-
const anchor = (0,
|
|
10204
|
+
const anchor = (0, import_react65.useRef)(null);
|
|
10176
10205
|
const viewportBox = () => viewportRef.current?.getBoundingClientRect();
|
|
10177
10206
|
const holdInPlace = (id) => {
|
|
10178
10207
|
const card = cardOf(itemEl(id));
|
|
@@ -10196,7 +10225,7 @@ function OrgChart({
|
|
|
10196
10225
|
}
|
|
10197
10226
|
if (!card || !inFlight.current.has(a.id) && !itemEl(a.id + LOADING2)) anchor.current = null;
|
|
10198
10227
|
});
|
|
10199
|
-
const toggle = (0,
|
|
10228
|
+
const toggle = (0, import_react65.useCallback)((id) => {
|
|
10200
10229
|
const opening = !expanded.has(id);
|
|
10201
10230
|
userMoved.current = true;
|
|
10202
10231
|
holdInPlace(id);
|
|
@@ -10216,7 +10245,7 @@ function OrgChart({
|
|
|
10216
10245
|
}
|
|
10217
10246
|
onToggle?.(id, opening);
|
|
10218
10247
|
}, [expanded, controlledExpanded, onToggle, itemEl]);
|
|
10219
|
-
const retry = (0,
|
|
10248
|
+
const retry = (0, import_react65.useCallback)((parentId) => {
|
|
10220
10249
|
const path = findPath(parentId);
|
|
10221
10250
|
const parent = path ? path[path.length - 1] : void 0;
|
|
10222
10251
|
if (!parent) return;
|
|
@@ -10228,7 +10257,7 @@ function OrgChart({
|
|
|
10228
10257
|
});
|
|
10229
10258
|
load(parent);
|
|
10230
10259
|
}, [findPath, load]);
|
|
10231
|
-
const select = (0,
|
|
10260
|
+
const select = (0, import_react65.useCallback)((id) => {
|
|
10232
10261
|
const synthetic = syntheticOf2(id);
|
|
10233
10262
|
if (!synthetic) {
|
|
10234
10263
|
onSelect?.(id);
|
|
@@ -10236,7 +10265,7 @@ function OrgChart({
|
|
|
10236
10265
|
}
|
|
10237
10266
|
if (synthetic.kind === "error") retry(synthetic.parent);
|
|
10238
10267
|
}, [onSelect, retry]);
|
|
10239
|
-
const rendered = (0,
|
|
10268
|
+
const rendered = (0, import_react65.useMemo)(() => {
|
|
10240
10269
|
const ids = /* @__PURE__ */ new Set();
|
|
10241
10270
|
const visit = (list) => {
|
|
10242
10271
|
for (const node of list) {
|
|
@@ -10263,13 +10292,13 @@ function OrgChart({
|
|
|
10263
10292
|
itemEl(visible.id)?.focus();
|
|
10264
10293
|
}
|
|
10265
10294
|
}, [rendered]);
|
|
10266
|
-
const activate = (0,
|
|
10295
|
+
const activate = (0, import_react65.useCallback)((id) => {
|
|
10267
10296
|
setFocusedId(id);
|
|
10268
10297
|
itemEl(id)?.focus({ preventScroll: true });
|
|
10269
10298
|
select(id);
|
|
10270
10299
|
}, [itemEl, select]);
|
|
10271
|
-
const revealed = (0,
|
|
10272
|
-
(0,
|
|
10300
|
+
const revealed = (0, import_react65.useRef)(null);
|
|
10301
|
+
(0, import_react65.useEffect)(() => {
|
|
10273
10302
|
if (!revealId) {
|
|
10274
10303
|
revealed.current = null;
|
|
10275
10304
|
return;
|
|
@@ -10284,8 +10313,8 @@ function OrgChart({
|
|
|
10284
10313
|
setFocusedId(revealId);
|
|
10285
10314
|
onReveal?.(revealId);
|
|
10286
10315
|
});
|
|
10287
|
-
const [zoom, setZoom] = (0,
|
|
10288
|
-
const zoomCentre = (0,
|
|
10316
|
+
const [zoom, setZoom] = (0, import_react65.useState)(() => typeof defaultZoom === "number" ? clampZoom(defaultZoom) : 1);
|
|
10317
|
+
const zoomCentre = (0, import_react65.useRef)(null);
|
|
10289
10318
|
const zoomTo = (next) => {
|
|
10290
10319
|
const viewport = viewportRef.current;
|
|
10291
10320
|
if (viewport) {
|
|
@@ -10304,7 +10333,7 @@ function OrgChart({
|
|
|
10304
10333
|
zoomCentre.current = null;
|
|
10305
10334
|
scrollFrame(c.x * zoom - viewport.clientWidth / 2, c.y * zoom - viewport.clientHeight / 2);
|
|
10306
10335
|
}, [zoom]);
|
|
10307
|
-
const fitZoom = (0,
|
|
10336
|
+
const fitZoom = (0, import_react65.useCallback)((current) => {
|
|
10308
10337
|
const viewport = viewportRef.current;
|
|
10309
10338
|
const tree = treeRef.current;
|
|
10310
10339
|
if (!viewport || !tree) return null;
|
|
@@ -10314,7 +10343,7 @@ function OrgChart({
|
|
|
10314
10343
|
if (!(room > 0) || !(width > 0)) return null;
|
|
10315
10344
|
return clampZoom(Math.min(1, room / width));
|
|
10316
10345
|
}, []);
|
|
10317
|
-
const settledWidth = (0,
|
|
10346
|
+
const settledWidth = (0, import_react65.useRef)(-1);
|
|
10318
10347
|
useIsoLayoutEffect(() => {
|
|
10319
10348
|
const viewport = viewportRef.current;
|
|
10320
10349
|
const tree = treeRef.current;
|
|
@@ -10338,8 +10367,8 @@ function OrgChart({
|
|
|
10338
10367
|
if (at && Math.abs(viewport.scrollLeft - at.left) <= 1 && Math.abs(viewport.scrollTop - at.top) <= 1) return;
|
|
10339
10368
|
userMoved.current = true;
|
|
10340
10369
|
};
|
|
10341
|
-
const pan = (0,
|
|
10342
|
-
const [panning, setPanning] = (0,
|
|
10370
|
+
const pan = (0, import_react65.useRef)(null);
|
|
10371
|
+
const [panning, setPanning] = (0, import_react65.useState)(false);
|
|
10343
10372
|
const onPointerDown = (e) => {
|
|
10344
10373
|
if (e.button !== 0 || e.pointerType === "touch") return;
|
|
10345
10374
|
if (e.target.closest(".uix-org-chart__node, .uix-org-chart__status")) return;
|
|
@@ -11153,7 +11182,7 @@ function RuleBuilder({
|
|
|
11153
11182
|
}
|
|
11154
11183
|
|
|
11155
11184
|
// src/components/BuilderCanvas.tsx
|
|
11156
|
-
var
|
|
11185
|
+
var import_react66 = require("react");
|
|
11157
11186
|
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
11158
11187
|
var DEFAULT_BUILDER_CANVAS_LABELS = {
|
|
11159
11188
|
region: "Builder canvas",
|
|
@@ -11193,13 +11222,13 @@ function BuilderCanvas({
|
|
|
11193
11222
|
labels: labelOverrides
|
|
11194
11223
|
}) {
|
|
11195
11224
|
const labels = { ...DEFAULT_BUILDER_CANVAS_LABELS, ...labelOverrides };
|
|
11196
|
-
const [internalSelectedId, setInternalSelectedId] = (0,
|
|
11197
|
-
const [draggedId, setDraggedId] = (0,
|
|
11198
|
-
const propertyHeadingRef = (0,
|
|
11199
|
-
const shouldFocusProperties = (0,
|
|
11225
|
+
const [internalSelectedId, setInternalSelectedId] = (0, import_react66.useState)();
|
|
11226
|
+
const [draggedId, setDraggedId] = (0, import_react66.useState)();
|
|
11227
|
+
const propertyHeadingRef = (0, import_react66.useRef)(null);
|
|
11228
|
+
const shouldFocusProperties = (0, import_react66.useRef)(false);
|
|
11200
11229
|
const selectedId = controlledSelectedId ?? internalSelectedId;
|
|
11201
11230
|
const selected = items.find((item) => item.id === selectedId);
|
|
11202
|
-
(0,
|
|
11231
|
+
(0, import_react66.useEffect)(() => {
|
|
11203
11232
|
if (shouldFocusProperties.current && selected) {
|
|
11204
11233
|
propertyHeadingRef.current?.focus();
|
|
11205
11234
|
shouldFocusProperties.current = false;
|
|
@@ -11287,7 +11316,7 @@ function BuilderCanvas({
|
|
|
11287
11316
|
}
|
|
11288
11317
|
|
|
11289
11318
|
// src/components/SchedulingCalendar.tsx
|
|
11290
|
-
var
|
|
11319
|
+
var import_react70 = require("react");
|
|
11291
11320
|
|
|
11292
11321
|
// src/calendar-model.ts
|
|
11293
11322
|
function fromDateKey(value) {
|
|
@@ -11715,14 +11744,14 @@ function proposeMove(span, delta, timeZone) {
|
|
|
11715
11744
|
}
|
|
11716
11745
|
|
|
11717
11746
|
// src/components/SchedulingAgenda.tsx
|
|
11718
|
-
var
|
|
11747
|
+
var import_react68 = require("react");
|
|
11719
11748
|
|
|
11720
11749
|
// src/hooks/usePrinting.ts
|
|
11721
|
-
var
|
|
11750
|
+
var import_react67 = require("react");
|
|
11722
11751
|
var import_react_dom2 = require("react-dom");
|
|
11723
11752
|
function usePrinting(enabled = true) {
|
|
11724
|
-
const [printing, setPrinting] = (0,
|
|
11725
|
-
(0,
|
|
11753
|
+
const [printing, setPrinting] = (0, import_react67.useState)(false);
|
|
11754
|
+
(0, import_react67.useEffect)(() => {
|
|
11726
11755
|
if (!enabled || typeof window === "undefined") return void 0;
|
|
11727
11756
|
const set = (next) => {
|
|
11728
11757
|
(0, import_react_dom2.flushSync)(() => setPrinting(next));
|
|
@@ -11797,11 +11826,11 @@ function AgendaBody({
|
|
|
11797
11826
|
if ((group.continuesCount ?? 0) > 0) flatRows.push({ kind: "continues", key: `c-${groupKey}`, group });
|
|
11798
11827
|
});
|
|
11799
11828
|
}
|
|
11800
|
-
const [narrow, setNarrow] = (0,
|
|
11829
|
+
const [narrow, setNarrow] = (0, import_react68.useState)(false);
|
|
11801
11830
|
const printing = usePrinting(flat);
|
|
11802
11831
|
const virtual = useVirtualRows(flatRows, { rowHeight: narrow ? AGENDA_NARROW_ROW : AGENDA_VIRTUAL_ROW, threshold: 0, estimatedViewportHeight: AGENDA_VIRTUAL_VIEWPORT, enabled: !printing });
|
|
11803
11832
|
const scroller = virtual.containerRef;
|
|
11804
|
-
(0,
|
|
11833
|
+
(0, import_react68.useLayoutEffect)(() => {
|
|
11805
11834
|
const box = scroller.current;
|
|
11806
11835
|
if (!box) return;
|
|
11807
11836
|
const measure2 = () => setNarrow(box.clientWidth > 0 && box.clientWidth <= AGENDA_NARROW_WIDTH);
|
|
@@ -11810,8 +11839,8 @@ function AgendaBody({
|
|
|
11810
11839
|
observer.observe(box);
|
|
11811
11840
|
return () => observer.disconnect();
|
|
11812
11841
|
}, [scroller]);
|
|
11813
|
-
const grouped = (0,
|
|
11814
|
-
(0,
|
|
11842
|
+
const grouped = (0, import_react68.useRef)(null);
|
|
11843
|
+
(0, import_react68.useLayoutEffect)(() => {
|
|
11815
11844
|
const box = grouped.current;
|
|
11816
11845
|
if (!box) return;
|
|
11817
11846
|
const observer = new ResizeObserver((entries) => {
|
|
@@ -11823,7 +11852,7 @@ function AgendaBody({
|
|
|
11823
11852
|
box.querySelectorAll(":scope > section > .uix-scheduling-calendar__agenda-head").forEach((head) => observer.observe(head));
|
|
11824
11853
|
return () => observer.disconnect();
|
|
11825
11854
|
}, [groups]);
|
|
11826
|
-
const stop2 = (0,
|
|
11855
|
+
const stop2 = (0, import_react68.useRef)({ node: null, index: 0 });
|
|
11827
11856
|
const container = () => flat ? scroller.current : grouped.current;
|
|
11828
11857
|
const controls = () => Array.from(container()?.querySelectorAll("button") ?? []);
|
|
11829
11858
|
const focusStop = (target) => {
|
|
@@ -11848,7 +11877,7 @@ function AgendaBody({
|
|
|
11848
11877
|
const scrollToRow = (box, index) => {
|
|
11849
11878
|
box.scrollTop = Math.max(0, index * rowHeight - (box.clientHeight - rowHeight) / 2);
|
|
11850
11879
|
};
|
|
11851
|
-
const landing = (0,
|
|
11880
|
+
const landing = (0, import_react68.useRef)(null);
|
|
11852
11881
|
const land = () => {
|
|
11853
11882
|
const wanted = landing.current;
|
|
11854
11883
|
if (!wanted) return;
|
|
@@ -11869,7 +11898,7 @@ function AgendaBody({
|
|
|
11869
11898
|
scrollToRow(box, index);
|
|
11870
11899
|
}
|
|
11871
11900
|
};
|
|
11872
|
-
(0,
|
|
11901
|
+
(0, import_react68.useEffect)(() => {
|
|
11873
11902
|
const all = controls();
|
|
11874
11903
|
stop2.current = syncRovingStop(all, stop2.current);
|
|
11875
11904
|
const box = flat ? scroller.current : null;
|
|
@@ -11925,7 +11954,7 @@ function AgendaBody({
|
|
|
11925
11954
|
overlay.scopeLabel && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "uix-scheduling-calendar__window-scope", children: overlay.scopeLabel })
|
|
11926
11955
|
] }) });
|
|
11927
11956
|
const heading = (group, withNotes) => /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "uix-scheduling-calendar__agenda-head", children: [
|
|
11928
|
-
(0,
|
|
11957
|
+
(0, import_react68.createElement)(`h${headingLevel}`, { className: "uix-scheduling-calendar__agenda-heading" }, group.heading ?? dateText(group.date, "day")),
|
|
11929
11958
|
withNotes && group.annotations && group.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("ul", { className: "uix-scheduling-calendar__agenda-notes", children: uniqueKeys(group.annotations.map((overlay) => overlay.id)).map((key, at) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("li", { children: note(group.annotations[at]) }, key)) })
|
|
11930
11959
|
] });
|
|
11931
11960
|
const timeText = (entry, date) => {
|
|
@@ -11995,7 +12024,7 @@ function AgendaBody({
|
|
|
11995
12024
|
}
|
|
11996
12025
|
|
|
11997
12026
|
// src/components/SchedulingTimeGrid.tsx
|
|
11998
|
-
var
|
|
12027
|
+
var import_react69 = require("react");
|
|
11999
12028
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
12000
12029
|
var HOUR_MS2 = 36e5;
|
|
12001
12030
|
var MINUTES_PER_HOUR = 60;
|
|
@@ -12009,7 +12038,7 @@ function uniqueById(items) {
|
|
|
12009
12038
|
const seen = /* @__PURE__ */ new Set();
|
|
12010
12039
|
return items.filter((item) => seen.has(item.id) ? false : (seen.add(item.id), true));
|
|
12011
12040
|
}
|
|
12012
|
-
var GridItem = (0,
|
|
12041
|
+
var GridItem = (0, import_react69.memo)(function GridItem2({ entry, segment, column, alone, name, status, movable, hintId, timeZone, continuesFrom, markers, renderEntry, renderMarker: renderMarker2, handlers }) {
|
|
12013
12042
|
const lines = linesFor(segment);
|
|
12014
12043
|
const continuation = segment.part === "continuation";
|
|
12015
12044
|
const style = vars({
|
|
@@ -12094,20 +12123,20 @@ function SchedulingTimeGrid({
|
|
|
12094
12123
|
emptyNote,
|
|
12095
12124
|
nothingToShow
|
|
12096
12125
|
}) {
|
|
12097
|
-
const rootRef = (0,
|
|
12098
|
-
const hintId = (0,
|
|
12099
|
-
const [widthCap, setWidthCap] = (0,
|
|
12100
|
-
const [ghost, setGhost] = (0,
|
|
12101
|
-
const [announcement, setAnnouncement] = (0,
|
|
12102
|
-
const [activeDay, setActiveDay] = (0,
|
|
12103
|
-
const enteredFrom = (0,
|
|
12126
|
+
const rootRef = (0, import_react69.useRef)(null);
|
|
12127
|
+
const hintId = (0, import_react69.useId)();
|
|
12128
|
+
const [widthCap, setWidthCap] = (0, import_react69.useState)(Infinity);
|
|
12129
|
+
const [ghost, setGhost] = (0, import_react69.useState)(null);
|
|
12130
|
+
const [announcement, setAnnouncement] = (0, import_react69.useState)("");
|
|
12131
|
+
const [activeDay, setActiveDay] = (0, import_react69.useState)(days[0]);
|
|
12132
|
+
const enteredFrom = (0, import_react69.useRef)(null);
|
|
12104
12133
|
const tabStop = days.includes(activeDay) ? activeDay : days[0];
|
|
12105
12134
|
const moving = canMove && onProposeMove !== void 0;
|
|
12106
12135
|
const step = Number.isFinite(givenStep) && givenStep > 0 ? givenStep : DEFAULT_STEP;
|
|
12107
|
-
const laneOptions = (0,
|
|
12108
|
-
const entries = (0,
|
|
12109
|
-
const overlays = (0,
|
|
12110
|
-
(0,
|
|
12136
|
+
const laneOptions = (0, import_react69.useMemo)(() => ({ crossMidnightMinutes: topLaneCrossMidnightMinutes }), [topLaneCrossMidnightMinutes]);
|
|
12137
|
+
const entries = (0, import_react69.useMemo)(() => uniqueById(givenEntries), [givenEntries]);
|
|
12138
|
+
const overlays = (0, import_react69.useMemo)(() => uniqueById(givenOverlays), [givenOverlays]);
|
|
12139
|
+
(0, import_react69.useEffect)(() => {
|
|
12111
12140
|
const root = rootRef.current;
|
|
12112
12141
|
if (!root || typeof ResizeObserver === "undefined") return void 0;
|
|
12113
12142
|
const column = root.querySelector("[data-tg-column]");
|
|
@@ -12132,17 +12161,17 @@ function SchedulingTimeGrid({
|
|
|
12132
12161
|
};
|
|
12133
12162
|
}, [days]);
|
|
12134
12163
|
const lanes = Math.max(1, Math.min(maxLanes, widthCap));
|
|
12135
|
-
const entryById = (0,
|
|
12136
|
-
const overlayById = (0,
|
|
12137
|
-
const columns = (0,
|
|
12138
|
-
const slots = (0,
|
|
12139
|
-
const top = (0,
|
|
12140
|
-
const drawable = (0,
|
|
12141
|
-
const strip = (0,
|
|
12142
|
-
const shades = (0,
|
|
12164
|
+
const entryById = (0, import_react69.useMemo)(() => new Map(entries.map((entry) => [entry.id, entry])), [entries]);
|
|
12165
|
+
const overlayById = (0, import_react69.useMemo)(() => new Map(overlays.map((overlay) => [overlay.id, overlay])), [overlays]);
|
|
12166
|
+
const columns = (0, import_react69.useMemo)(() => days.map((date) => layoutTimeGridDay(entries, date, timeZone, { ...laneOptions, maxLanes: lanes })), [days, entries, timeZone, laneOptions, lanes]);
|
|
12167
|
+
const slots = (0, import_react69.useMemo)(() => days.map((date) => zonedHourSlots(date, timeZone)), [days, timeZone]);
|
|
12168
|
+
const top = (0, import_react69.useMemo)(() => layoutDaySpans(entries.filter((entry) => placesInTopLane(entry, timeZone, laneOptions)), days, { timeZone, laneCap: Math.max(0, topLaneCap) }), [entries, days, timeZone, laneOptions, topLaneCap]);
|
|
12169
|
+
const drawable = (0, import_react69.useMemo)(() => overlays.filter((overlay) => new Date(overlay.end).getTime() >= new Date(overlay.start).getTime()), [overlays]);
|
|
12170
|
+
const strip = (0, import_react69.useMemo)(() => layoutDaySpans(drawable, days, { timeZone, laneCap: Math.max(0, windowLaneCap) }), [drawable, days, timeZone, windowLaneCap]);
|
|
12171
|
+
const shades = (0, import_react69.useMemo)(() => layoutDaySpans(drawable.filter((overlay) => overlay.global), days, { timeZone }).placed, [drawable, days, timeZone]);
|
|
12143
12172
|
const lanesIn = (placed) => placed.reduce((max, span) => Math.max(max, span.lane + 1), 0);
|
|
12144
12173
|
const maxHours = Math.max(...columns.map((column) => column.dayHours));
|
|
12145
|
-
const gutterIndex = (0,
|
|
12174
|
+
const gutterIndex = (0, import_react69.useMemo)(() => {
|
|
12146
12175
|
const signatures = slots.map(slotSignature);
|
|
12147
12176
|
const count2 = /* @__PURE__ */ new Map();
|
|
12148
12177
|
for (const signature of signatures) count2.set(signature, (count2.get(signature) ?? 0) + 1);
|
|
@@ -12167,15 +12196,15 @@ function SchedulingTimeGrid({
|
|
|
12167
12196
|
slot.instant.getTime()
|
|
12168
12197
|
));
|
|
12169
12198
|
const movable = (entry) => moving && entry.movable !== false;
|
|
12170
|
-
const live = (0,
|
|
12199
|
+
const live = (0, import_react69.useRef)({ ghost, entryById, timeZone, step, onProposeMove, onSelectEntry, labels, formatInstant, days, columns, movable });
|
|
12171
12200
|
live.current = { ghost, entryById, timeZone, step, onProposeMove, onSelectEntry, labels, formatInstant, days, columns, movable };
|
|
12172
|
-
const dragRef = (0,
|
|
12173
|
-
const suppressClick = (0,
|
|
12174
|
-
const refocus = (0,
|
|
12175
|
-
(0,
|
|
12201
|
+
const dragRef = (0, import_react69.useRef)(null);
|
|
12202
|
+
const suppressClick = (0, import_react69.useRef)(false);
|
|
12203
|
+
const refocus = (0, import_react69.useRef)(null);
|
|
12204
|
+
(0, import_react69.useEffect)(() => {
|
|
12176
12205
|
if (ghost && !entryById.has(ghost.id)) setGhost(null);
|
|
12177
12206
|
}, [ghost, entryById]);
|
|
12178
|
-
(0,
|
|
12207
|
+
(0, import_react69.useEffect)(() => {
|
|
12179
12208
|
const id = refocus.current;
|
|
12180
12209
|
const root = rootRef.current;
|
|
12181
12210
|
if (!id || !root) return;
|
|
@@ -12192,7 +12221,7 @@ function SchedulingTimeGrid({
|
|
|
12192
12221
|
}
|
|
12193
12222
|
}
|
|
12194
12223
|
});
|
|
12195
|
-
const send = (0,
|
|
12224
|
+
const send = (0, import_react69.useCallback)((id, delta) => {
|
|
12196
12225
|
const state = live.current;
|
|
12197
12226
|
const entry = state.entryById.get(id);
|
|
12198
12227
|
if (!entry || !state.onProposeMove || !state.movable(entry) || delta.days === 0 && delta.minutes === 0) {
|
|
@@ -12207,7 +12236,7 @@ function SchedulingTimeGrid({
|
|
|
12207
12236
|
result.then(clear, clear);
|
|
12208
12237
|
} else setGhost(null);
|
|
12209
12238
|
}, []);
|
|
12210
|
-
const handlers = (0,
|
|
12239
|
+
const handlers = (0, import_react69.useMemo)(() => ({
|
|
12211
12240
|
click: (entry) => {
|
|
12212
12241
|
live.current.onSelectEntry?.(entry);
|
|
12213
12242
|
},
|
|
@@ -12330,7 +12359,7 @@ function SchedulingTimeGrid({
|
|
|
12330
12359
|
};
|
|
12331
12360
|
}
|
|
12332
12361
|
}), [send]);
|
|
12333
|
-
(0,
|
|
12362
|
+
(0, import_react69.useEffect)(() => () => {
|
|
12334
12363
|
dragRef.current?.stop();
|
|
12335
12364
|
dragRef.current = null;
|
|
12336
12365
|
}, []);
|
|
@@ -12743,27 +12772,27 @@ function SchedulingCalendar({
|
|
|
12743
12772
|
};
|
|
12744
12773
|
const stateLabel = labels.states;
|
|
12745
12774
|
const viewLabel = { month: labels.viewMonth, week: labels.viewWeek, day: labels.viewDay, agenda: labels.viewAgenda };
|
|
12746
|
-
const [internalView, setInternalView] = (0,
|
|
12775
|
+
const [internalView, setInternalView] = (0, import_react70.useState)("month");
|
|
12747
12776
|
const view = controlledView ?? internalView;
|
|
12748
|
-
const [activeDate, setActiveDate] = (0,
|
|
12749
|
-
const [expandedDates, setExpandedDates] = (0,
|
|
12777
|
+
const [activeDate, setActiveDate] = (0, import_react70.useState)(anchorDate);
|
|
12778
|
+
const [expandedDates, setExpandedDates] = (0, import_react70.useState)(() => /* @__PURE__ */ new Set());
|
|
12750
12779
|
const dateText = (date, part) => formatDate?.(date, part) ?? cachedDateTimeFormat(locale, INTL_PARTS[part]).format(utcDate(date));
|
|
12751
12780
|
const formatInstant = (instant) => formatInstantProp?.(instant) ?? `${dateText(zonedDateKey(instant, timeZone), "day")} ${zonedTimeOfDay(instant, timeZone)}`;
|
|
12752
|
-
const gridRef = (0,
|
|
12781
|
+
const gridRef = (0, import_react70.useRef)(null);
|
|
12753
12782
|
const picksGiven = dayEntries !== void 0;
|
|
12754
12783
|
const controlled = picksGiven || dayInfo !== void 0;
|
|
12755
12784
|
const countsOnly = monthDensity === "counts" && view === "month";
|
|
12756
12785
|
const fixed = controlled || maxEntriesPerDay !== void 0 && onShowMore !== void 0 || countsOnly;
|
|
12757
12786
|
const windowCap = Math.max(0, windowLaneCap ?? (fixed ? DEFAULT_LANE_CAP2 : Infinity));
|
|
12758
12787
|
const spanCap = Math.max(0, spanLaneCap ?? (fixed ? DEFAULT_LANE_CAP2 : Infinity));
|
|
12759
|
-
const visibleEntries = (0,
|
|
12760
|
-
const monthDays = (0,
|
|
12788
|
+
const visibleEntries = (0, import_react70.useMemo)(() => entries.filter((entry) => filter?.(entry) ?? true), [entries, filter]);
|
|
12789
|
+
const monthDays = (0, import_react70.useMemo)(() => buildMonthGrid(startOfMonth(anchorDate), weekStartsOn), [anchorDate, weekStartsOn]);
|
|
12761
12790
|
const weekday = (utcDate(anchorDate).getUTCDay() - weekStartsOn + 7) % 7;
|
|
12762
12791
|
const weekStart = addCalendarDays(anchorDate, -weekday);
|
|
12763
|
-
const weekDays = (0,
|
|
12764
|
-
const days = (0,
|
|
12792
|
+
const weekDays = (0, import_react70.useMemo)(() => Array.from({ length: 7 }, (_, index) => addCalendarDays(weekStart, index)), [weekStart]);
|
|
12793
|
+
const days = (0, import_react70.useMemo)(() => view === "month" ? monthDays.map((day) => day.date) : view === "day" ? [anchorDate] : weekDays, [view, monthDays, weekDays, anchorDate]);
|
|
12765
12794
|
const timeGridView = view === "day" || view === "week" && timeGrid;
|
|
12766
|
-
const { singles, multiDay, coverage } = (0,
|
|
12795
|
+
const { singles, multiDay, coverage } = (0, import_react70.useMemo)(() => {
|
|
12767
12796
|
const byDay = /* @__PURE__ */ new Map();
|
|
12768
12797
|
const spans = [];
|
|
12769
12798
|
const every = [];
|
|
@@ -12778,9 +12807,9 @@ function SchedulingCalendar({
|
|
|
12778
12807
|
}
|
|
12779
12808
|
return { singles: byDay, multiDay: spans, coverage: every };
|
|
12780
12809
|
}, [visibleEntries, timeZone]);
|
|
12781
|
-
const entryById = (0,
|
|
12782
|
-
const overlayById = (0,
|
|
12783
|
-
const layout = (0,
|
|
12810
|
+
const entryById = (0, import_react70.useMemo)(() => new Map([...multiDay].reverse().map(({ entry }) => [entry.id, entry])), [multiDay]);
|
|
12811
|
+
const overlayById = (0, import_react70.useMemo)(() => new Map([...overlays].reverse().map((overlay) => [overlay.id, overlay])), [overlays]);
|
|
12812
|
+
const layout = (0, import_react70.useMemo)(() => {
|
|
12784
12813
|
if (spanLayout) return spanLayout;
|
|
12785
12814
|
if (view === "agenda" || timeGridView) return { placed: [], hiddenByRow: {}, firstHiddenDayByRow: {} };
|
|
12786
12815
|
const inputs = [];
|
|
@@ -12798,7 +12827,7 @@ function SchedulingCalendar({
|
|
|
12798
12827
|
}
|
|
12799
12828
|
return layoutMonthSpans(inputs, days, { timeZone, laneCap: { window: windowCap, item: spanCap } });
|
|
12800
12829
|
}, [spanLayout, view, timeGridView, overlays, multiDay, days, timeZone, windowCap, spanCap, countsOnly]);
|
|
12801
|
-
const placedByRow = (0,
|
|
12830
|
+
const placedByRow = (0, import_react70.useMemo)(() => {
|
|
12802
12831
|
const rows = /* @__PURE__ */ new Map();
|
|
12803
12832
|
for (const placed of layout.placed) {
|
|
12804
12833
|
const row = rows.get(placed.weekRow);
|
|
@@ -12809,7 +12838,7 @@ function SchedulingCalendar({
|
|
|
12809
12838
|
}, [layout]);
|
|
12810
12839
|
const lanesUsed = (row, group) => (placedByRow.get(row) ?? []).reduce((max, placed) => placed.group === group ? Math.max(max, placed.lane + 1) : max, 0);
|
|
12811
12840
|
const lanesUsedAnywhere = (group) => layout.placed.reduce((max, placed) => placed.group === group ? Math.max(max, placed.lane + 1) : max, 0);
|
|
12812
|
-
(0,
|
|
12841
|
+
(0, import_react70.useEffect)(() => {
|
|
12813
12842
|
if (view !== "agenda" && !days.includes(activeDate)) setActiveDate(days[0]);
|
|
12814
12843
|
}, [activeDate, days, view]);
|
|
12815
12844
|
const setView = (next) => {
|
|
@@ -12825,7 +12854,7 @@ function SchedulingCalendar({
|
|
|
12825
12854
|
setActiveDate(date);
|
|
12826
12855
|
requestAnimationFrame(() => gridRef.current?.querySelector(`[data-calendar-date="${date}"]`)?.focus());
|
|
12827
12856
|
};
|
|
12828
|
-
const enteredFrom = (0,
|
|
12857
|
+
const enteredFrom = (0, import_react70.useRef)(null);
|
|
12829
12858
|
const cellOf = (date) => gridRef.current?.querySelector(`[data-calendar-date="${date}"]`)?.closest(".uix-scheduling-calendar__day") ?? null;
|
|
12830
12859
|
const dayRing = (date) => {
|
|
12831
12860
|
const cell = cellOf(date);
|
|
@@ -12895,10 +12924,10 @@ function SchedulingCalendar({
|
|
|
12895
12924
|
const date = dayOfItem(item);
|
|
12896
12925
|
if (date && dayRing(date).includes(item)) setActiveDate(date);
|
|
12897
12926
|
};
|
|
12898
|
-
const flatAgendaRef = (0,
|
|
12899
|
-
const flatAgendaStop = (0,
|
|
12927
|
+
const flatAgendaRef = (0, import_react70.useRef)(null);
|
|
12928
|
+
const flatAgendaStop = (0, import_react70.useRef)({ node: null, index: 0 });
|
|
12900
12929
|
const flatAgendaRows = () => Array.from(flatAgendaRef.current?.querySelectorAll(":scope > ol > li > button") ?? []);
|
|
12901
|
-
(0,
|
|
12930
|
+
(0, import_react70.useEffect)(() => {
|
|
12902
12931
|
flatAgendaStop.current = syncRovingStop(flatAgendaRows(), flatAgendaStop.current);
|
|
12903
12932
|
});
|
|
12904
12933
|
const onFlatAgendaFocus = (event) => {
|
|
@@ -13140,7 +13169,7 @@ function SchedulingCalendar({
|
|
|
13140
13169
|
}
|
|
13141
13170
|
|
|
13142
13171
|
// src/components/SchedulingTimeline.tsx
|
|
13143
|
-
var
|
|
13172
|
+
var import_react71 = require("react");
|
|
13144
13173
|
|
|
13145
13174
|
// src/scheduling-timeline-model.ts
|
|
13146
13175
|
var HOUR = 36e5;
|
|
@@ -13368,7 +13397,7 @@ var DEFAULT_UNITS = { row: 36, pad: 16, head: 40 };
|
|
|
13368
13397
|
var ESTIMATED_VIEWPORT = 720;
|
|
13369
13398
|
var OVERSCAN_ROWS = 4;
|
|
13370
13399
|
var BAR_MIN_FALLBACK = 1.5 * 16;
|
|
13371
|
-
var
|
|
13400
|
+
var useIsomorphicLayoutEffect9 = typeof document !== "undefined" ? import_react71.useLayoutEffect : import_react71.useEffect;
|
|
13372
13401
|
var sameExtent = (a, b) => a.subRows === b.subRows && a.lanes === b.lanes && a.heads === b.heads;
|
|
13373
13402
|
var IN_LANE = { scope: "lane", labelTops: ["0%"] };
|
|
13374
13403
|
var vars2 = (values) => values;
|
|
@@ -13434,29 +13463,29 @@ function SchedulingTimeline({
|
|
|
13434
13463
|
overlays: { ...DEFAULT_SCHEDULING_TIMELINE_LABELS.overlays, ...uixLabels.schedulingTimeline?.overlays, ...labelOverrides?.overlays },
|
|
13435
13464
|
statuses: { ...DEFAULT_SCHEDULING_TIMELINE_LABELS.statuses, ...uixLabels.schedulingTimeline?.statuses, ...labelOverrides?.statuses }
|
|
13436
13465
|
};
|
|
13437
|
-
const id = (0,
|
|
13466
|
+
const id = (0, import_react71.useId)();
|
|
13438
13467
|
const hintId = `${id}-hint`;
|
|
13439
13468
|
const step = stepProp !== void 0 && Number.isFinite(stepProp) && stepProp > 0 ? stepProp : defaultTimelineStep(scale);
|
|
13440
|
-
const rootRef = (0,
|
|
13441
|
-
const [scroller, setScroller] = (0,
|
|
13442
|
-
const [layerTrack, setLayerTrack] = (0,
|
|
13443
|
-
const probeRef = (0,
|
|
13444
|
-
const bodyRef = (0,
|
|
13445
|
-
const barMinRef = (0,
|
|
13446
|
-
const [barShare, setBarShare] = (0,
|
|
13447
|
-
const barShareRef = (0,
|
|
13448
|
-
const anchorRef = (0,
|
|
13449
|
-
const [anchorKey, setAnchorKey] = (0,
|
|
13450
|
-
const [focusRowKey, setFocusRowKey] = (0,
|
|
13451
|
-
const [activeId, setActiveId] = (0,
|
|
13452
|
-
const [focusRequest, setFocusRequest] = (0,
|
|
13453
|
-
const [stepDrag, setStepDrag] = (0,
|
|
13454
|
-
const [ghost, setGhost] = (0,
|
|
13455
|
-
const [announcement, setAnnouncement] = (0,
|
|
13456
|
-
const [selfCollapsed, setSelfCollapsed] = (0,
|
|
13457
|
-
const [units, setUnits] = (0,
|
|
13458
|
-
const [view, setView] = (0,
|
|
13459
|
-
const measureViewRef = (0,
|
|
13469
|
+
const rootRef = (0, import_react71.useRef)(null);
|
|
13470
|
+
const [scroller, setScroller] = (0, import_react71.useState)(null);
|
|
13471
|
+
const [layerTrack, setLayerTrack] = (0, import_react71.useState)(null);
|
|
13472
|
+
const probeRef = (0, import_react71.useRef)(null);
|
|
13473
|
+
const bodyRef = (0, import_react71.useRef)(null);
|
|
13474
|
+
const barMinRef = (0, import_react71.useRef)(null);
|
|
13475
|
+
const [barShare, setBarShare] = (0, import_react71.useState)(0);
|
|
13476
|
+
const barShareRef = (0, import_react71.useRef)(0);
|
|
13477
|
+
const anchorRef = (0, import_react71.useRef)(null);
|
|
13478
|
+
const [anchorKey, setAnchorKey] = (0, import_react71.useState)(null);
|
|
13479
|
+
const [focusRowKey, setFocusRowKey] = (0, import_react71.useState)(null);
|
|
13480
|
+
const [activeId, setActiveId] = (0, import_react71.useState)();
|
|
13481
|
+
const [focusRequest, setFocusRequest] = (0, import_react71.useState)(null);
|
|
13482
|
+
const [stepDrag, setStepDrag] = (0, import_react71.useState)(null);
|
|
13483
|
+
const [ghost, setGhost] = (0, import_react71.useState)(null);
|
|
13484
|
+
const [announcement, setAnnouncement] = (0, import_react71.useState)("");
|
|
13485
|
+
const [selfCollapsed, setSelfCollapsed] = (0, import_react71.useState)({});
|
|
13486
|
+
const [units, setUnits] = (0, import_react71.useState)(DEFAULT_UNITS);
|
|
13487
|
+
const [view, setView] = (0, import_react71.useState)({ top: 0, height: ESTIMATED_VIEWPORT });
|
|
13488
|
+
const measureViewRef = (0, import_react71.useRef)(null);
|
|
13460
13489
|
const proposing = onProposeMove !== void 0;
|
|
13461
13490
|
const stepping = !proposing && onMoveItem !== void 0;
|
|
13462
13491
|
const resizing = onResizeItem !== void 0;
|
|
@@ -13471,14 +13500,14 @@ function SchedulingTimeline({
|
|
|
13471
13500
|
return offset ? `${text} ${offset}` : text;
|
|
13472
13501
|
};
|
|
13473
13502
|
const fmtTick = (at) => formatTick?.(new Date(at), scale) ?? cachedDateTimeFormat(locale, { timeZone, ...TICK_FORMAT[scale] }).format(new Date(at));
|
|
13474
|
-
const ticks = (0,
|
|
13475
|
-
const minorTicks = (0,
|
|
13503
|
+
const ticks = (0, import_react71.useMemo)(() => timelineTicks(range, scale, timeZone, weekStartsOn), [range.start, range.end, scale, timeZone, weekStartsOn]);
|
|
13504
|
+
const minorTicks = (0, import_react71.useMemo)(
|
|
13476
13505
|
() => scale === "day" && subTicks && subTicks.length > 0 ? timelineSubTicks(range, subTicks, timeZone) : [],
|
|
13477
13506
|
[range.start, range.end, scale, timeZone, subTicks]
|
|
13478
13507
|
// eslint-disable-line react-hooks/exhaustive-deps
|
|
13479
13508
|
);
|
|
13480
13509
|
const tickCount = ticks.length;
|
|
13481
|
-
|
|
13510
|
+
useIsomorphicLayoutEffect9(() => {
|
|
13482
13511
|
if (!layerTrack) return void 0;
|
|
13483
13512
|
const measure2 = () => {
|
|
13484
13513
|
const width = layerTrack.getBoundingClientRect().width;
|
|
@@ -13501,7 +13530,7 @@ function SchedulingTimeline({
|
|
|
13501
13530
|
const minSpan = Math.max(0, (Date.parse(range.end) - Date.parse(range.start)) * barShare) || 0;
|
|
13502
13531
|
const isCollapsed = (group) => onToggleGroup ? !!group.collapsed : selfCollapsed[group.id] ?? !!group.collapsed;
|
|
13503
13532
|
const collapsedSignature = groups?.map((group) => isCollapsed(group) ? "1" : "0").join("") ?? "";
|
|
13504
|
-
const itemsByLane = (0,
|
|
13533
|
+
const itemsByLane = (0, import_react71.useMemo)(() => {
|
|
13505
13534
|
const byLane = /* @__PURE__ */ new Map();
|
|
13506
13535
|
for (const item of items) {
|
|
13507
13536
|
const list = byLane.get(item.laneId);
|
|
@@ -13510,7 +13539,7 @@ function SchedulingTimeline({
|
|
|
13510
13539
|
}
|
|
13511
13540
|
return byLane;
|
|
13512
13541
|
}, [items]);
|
|
13513
|
-
const rows = (0,
|
|
13542
|
+
const rows = (0, import_react71.useMemo)(() => {
|
|
13514
13543
|
const laneRow = (lane, laneIndex, groupIndex) => {
|
|
13515
13544
|
const placed = layoutLane(itemsByLane.get(lane.id) ?? EMPTY_ITEMS, range, { flagOverlaps, minSpan });
|
|
13516
13545
|
return { kind: "lane", key: `lane-${laneIndex}`, lane, laneIndex, groupIndex, placed, keys: uniqueKeys2(placed.map((p) => p.item.id)), subRows: placed.reduce((max, p) => Math.max(max, p.row + 1), 1) };
|
|
@@ -13542,8 +13571,8 @@ function SchedulingTimeline({
|
|
|
13542
13571
|
});
|
|
13543
13572
|
return list;
|
|
13544
13573
|
}, [lanes, groups, collapsedSignature, itemsByLane, range.start, range.end, flagOverlaps, minSpan]);
|
|
13545
|
-
const laneRows = (0,
|
|
13546
|
-
const { ordered, rowOfItem } = (0,
|
|
13574
|
+
const laneRows = (0, import_react71.useMemo)(() => rows.filter((row) => row.kind === "lane"), [rows]);
|
|
13575
|
+
const { ordered, rowOfItem } = (0, import_react71.useMemo)(() => {
|
|
13547
13576
|
const ids = [];
|
|
13548
13577
|
const rowOf = /* @__PURE__ */ new Map();
|
|
13549
13578
|
rows.forEach((row, rowIndex) => {
|
|
@@ -13555,13 +13584,13 @@ function SchedulingTimeline({
|
|
|
13555
13584
|
});
|
|
13556
13585
|
return { ordered: ids, rowOfItem: rowOf };
|
|
13557
13586
|
}, [rows]);
|
|
13558
|
-
const nothingToShow = (0,
|
|
13587
|
+
const nothingToShow = (0, import_react71.useMemo)(() => {
|
|
13559
13588
|
if (ordered.length > 0) return false;
|
|
13560
13589
|
const laneIds = new Set(lanes.map((lane) => lane.id));
|
|
13561
13590
|
return !items.some((item) => laneIds.has(item.laneId) && placeSpan(item, range) !== null);
|
|
13562
13591
|
}, [ordered, lanes, items, range.start, range.end]);
|
|
13563
13592
|
const focusId = activeId !== void 0 && rowOfItem.has(activeId) ? activeId : ordered[0];
|
|
13564
|
-
const strips = (0,
|
|
13593
|
+
const strips = (0, import_react71.useMemo)(() => {
|
|
13565
13594
|
const set = /* @__PURE__ */ new Set();
|
|
13566
13595
|
const shown = overlays.filter((overlay) => placeSpan(overlay, range) !== null).map(lanesOf);
|
|
13567
13596
|
if (shown.length === 0) return set;
|
|
@@ -13571,12 +13600,12 @@ function SchedulingTimeline({
|
|
|
13571
13600
|
});
|
|
13572
13601
|
return set;
|
|
13573
13602
|
}, [rows, overlays, range.start, range.end]);
|
|
13574
|
-
const extents = (0,
|
|
13603
|
+
const extents = (0, import_react71.useMemo)(() => timelineRowExtents(rows.map((row, index) => row.kind === "head" ? { kind: "head", subRows: strips.has(index) ? 1 : 0 } : { kind: "lane", subRows: row.subRows })), [rows, strips]);
|
|
13575
13604
|
const windowed = lanes.length + (groups?.length ?? 0) > virtualizeAbove;
|
|
13576
13605
|
const printing = usePrinting(windowed);
|
|
13577
13606
|
const virtual = windowed && !printing;
|
|
13578
13607
|
const fixed = windowed || groups !== void 0 || overlays.some((overlay) => overlay.laneIds !== void 0) || markers.some((marker) => marker.laneIds !== void 0);
|
|
13579
|
-
(0,
|
|
13608
|
+
(0, import_react71.useEffect)(() => {
|
|
13580
13609
|
if (!virtual || !scroller) return void 0;
|
|
13581
13610
|
let frame = 0;
|
|
13582
13611
|
const measure2 = () => {
|
|
@@ -13616,12 +13645,12 @@ function SchedulingTimeline({
|
|
|
13616
13645
|
};
|
|
13617
13646
|
}, [virtual, scroller]);
|
|
13618
13647
|
const px = (extent) => extent.subRows * units.row + extent.lanes * units.pad + extent.heads * units.head;
|
|
13619
|
-
const offsets = (0,
|
|
13648
|
+
const offsets = (0, import_react71.useMemo)(() => virtual ? extents.map(px) : [], [virtual, extents, units]);
|
|
13620
13649
|
const overscan = OVERSCAN_ROWS * units.row;
|
|
13621
13650
|
const pinned = focusId === void 0 ? -1 : rowOfItem.get(focusId) ?? -1;
|
|
13622
|
-
const focusedRow = (0,
|
|
13623
|
-
const anchorRow = (0,
|
|
13624
|
-
const { mounted, windowStart } = (0,
|
|
13651
|
+
const focusedRow = (0, import_react71.useMemo)(() => focusRowKey === null ? -1 : rows.findIndex((row) => row.key === focusRowKey), [rows, focusRowKey]);
|
|
13652
|
+
const anchorRow = (0, import_react71.useMemo)(() => anchorKey === null ? -1 : rows.findIndex((row) => row.key === anchorKey), [rows, anchorKey]);
|
|
13653
|
+
const { mounted, windowStart } = (0, import_react71.useMemo)(() => {
|
|
13625
13654
|
if (!virtual) return { mounted: rows.map((_, index) => index), windowStart: 0 };
|
|
13626
13655
|
const window_ = timelineWindow(offsets, view.top, view.top + view.height, { overscan });
|
|
13627
13656
|
const list = [];
|
|
@@ -13632,7 +13661,7 @@ function SchedulingTimeline({
|
|
|
13632
13661
|
list.sort((a, b) => a - b);
|
|
13633
13662
|
return { mounted: list, windowStart: window_.start };
|
|
13634
13663
|
}, [virtual, rows, offsets, view, overscan, pinned, focusedRow, anchorRow]);
|
|
13635
|
-
|
|
13664
|
+
useIsomorphicLayoutEffect9(() => {
|
|
13636
13665
|
const anchor = anchorRef.current;
|
|
13637
13666
|
if (anchorKey === null || !anchor || anchor.key !== anchorKey) return;
|
|
13638
13667
|
anchorRef.current = null;
|
|
@@ -13669,10 +13698,10 @@ function SchedulingTimeline({
|
|
|
13669
13698
|
setActiveId(itemId);
|
|
13670
13699
|
setFocusRequest({ id: itemId });
|
|
13671
13700
|
};
|
|
13672
|
-
(0,
|
|
13701
|
+
(0, import_react71.useEffect)(() => {
|
|
13673
13702
|
if (focusRequest) findBar(focusRequest.id)?.focus();
|
|
13674
13703
|
}, [focusRequest]);
|
|
13675
|
-
const itemById = (0,
|
|
13704
|
+
const itemById = (0, import_react71.useMemo)(() => {
|
|
13676
13705
|
const map = /* @__PURE__ */ new Map();
|
|
13677
13706
|
for (const row of laneRows) for (const p of row.placed) if (!map.has(p.item.id)) map.set(p.item.id, p.item);
|
|
13678
13707
|
return map;
|
|
@@ -13682,15 +13711,15 @@ function SchedulingTimeline({
|
|
|
13682
13711
|
const steps = Math.round(ms / step);
|
|
13683
13712
|
return { days: steps * stepDelta.days, minutes: steps * stepDelta.minutes };
|
|
13684
13713
|
};
|
|
13685
|
-
const live = (0,
|
|
13714
|
+
const live = (0, import_react71.useRef)({ itemById, timeZone, range, step, onProposeMove, canMove, deltaFor, labels, fmtInstant });
|
|
13686
13715
|
live.current = { itemById, timeZone, range, step, onProposeMove, canMove, deltaFor, labels, fmtInstant };
|
|
13687
|
-
const dragRef = (0,
|
|
13688
|
-
const suppressClick = (0,
|
|
13689
|
-
const refocus = (0,
|
|
13690
|
-
(0,
|
|
13716
|
+
const dragRef = (0, import_react71.useRef)(null);
|
|
13717
|
+
const suppressClick = (0, import_react71.useRef)(false);
|
|
13718
|
+
const refocus = (0, import_react71.useRef)(null);
|
|
13719
|
+
(0, import_react71.useEffect)(() => {
|
|
13691
13720
|
if (ghost && !itemById.has(ghost.id)) setGhost(null);
|
|
13692
13721
|
}, [ghost, itemById]);
|
|
13693
|
-
(0,
|
|
13722
|
+
(0, import_react71.useEffect)(() => {
|
|
13694
13723
|
const wanted = refocus.current;
|
|
13695
13724
|
if (!wanted || !rootRef.current) return;
|
|
13696
13725
|
const active = document.activeElement;
|
|
@@ -13701,11 +13730,11 @@ function SchedulingTimeline({
|
|
|
13701
13730
|
}
|
|
13702
13731
|
findBar(wanted)?.focus();
|
|
13703
13732
|
});
|
|
13704
|
-
(0,
|
|
13733
|
+
(0, import_react71.useEffect)(() => () => {
|
|
13705
13734
|
dragRef.current?.stop();
|
|
13706
13735
|
dragRef.current = null;
|
|
13707
13736
|
}, []);
|
|
13708
|
-
(0,
|
|
13737
|
+
(0, import_react71.useEffect)(() => {
|
|
13709
13738
|
if (proposing) return;
|
|
13710
13739
|
dragRef.current?.stop();
|
|
13711
13740
|
dragRef.current = null;
|
|
@@ -14186,7 +14215,7 @@ function SchedulingTimeline({
|
|
|
14186
14215
|
}
|
|
14187
14216
|
|
|
14188
14217
|
// src/components/DateRangePicker.tsx
|
|
14189
|
-
var
|
|
14218
|
+
var import_react73 = require("react");
|
|
14190
14219
|
|
|
14191
14220
|
// src/date-field-model.ts
|
|
14192
14221
|
var pad = (n, width = 2) => String(n).padStart(width, "0");
|
|
@@ -14260,7 +14289,7 @@ function timeZoneName(timeZone, date, locale) {
|
|
|
14260
14289
|
}
|
|
14261
14290
|
|
|
14262
14291
|
// src/components/DateFieldParts.tsx
|
|
14263
|
-
var
|
|
14292
|
+
var import_react72 = require("react");
|
|
14264
14293
|
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
14265
14294
|
var localDateKey = (now = /* @__PURE__ */ new Date()) => `${now.getFullYear().toString().padStart(4, "0")}-${(now.getMonth() + 1).toString().padStart(2, "0")}-${now.getDate().toString().padStart(2, "0")}`;
|
|
14266
14295
|
var utc = (date) => /* @__PURE__ */ new Date(`${date}T00:00:00Z`);
|
|
@@ -14278,15 +14307,15 @@ var isOpen = (el) => {
|
|
|
14278
14307
|
}
|
|
14279
14308
|
};
|
|
14280
14309
|
function useFieldPopover(popoverId, restoreFocus, onOpenChange) {
|
|
14281
|
-
const [open, setOpen] = (0,
|
|
14282
|
-
const pointerWasOpen = (0,
|
|
14283
|
-
const restoreRef = (0,
|
|
14310
|
+
const [open, setOpen] = (0, import_react72.useState)(false);
|
|
14311
|
+
const pointerWasOpen = (0, import_react72.useRef)(null);
|
|
14312
|
+
const restoreRef = (0, import_react72.useRef)(restoreFocus);
|
|
14284
14313
|
restoreRef.current = restoreFocus;
|
|
14285
|
-
const onOpenChangeRef = (0,
|
|
14314
|
+
const onOpenChangeRef = (0, import_react72.useRef)(onOpenChange);
|
|
14286
14315
|
onOpenChangeRef.current = onOpenChange;
|
|
14287
|
-
const skipRestore = (0,
|
|
14316
|
+
const skipRestore = (0, import_react72.useRef)(false);
|
|
14288
14317
|
const popoverEl = () => typeof document === "undefined" ? null : document.getElementById(popoverId);
|
|
14289
|
-
(0,
|
|
14318
|
+
(0, import_react72.useEffect)(() => {
|
|
14290
14319
|
const el = popoverEl();
|
|
14291
14320
|
if (!el) return;
|
|
14292
14321
|
const onToggle = (event) => {
|
|
@@ -14370,14 +14399,14 @@ function MonthCalendar({
|
|
|
14370
14399
|
autoFocus = false
|
|
14371
14400
|
}) {
|
|
14372
14401
|
const clamp3 = (date) => min && date < min ? min : max && date > max ? max : date;
|
|
14373
|
-
const [active, setActive] = (0,
|
|
14374
|
-
const gridRef = (0,
|
|
14375
|
-
const pendingFocus = (0,
|
|
14402
|
+
const [active, setActive] = (0, import_react72.useState)(() => clamp3(initialDate));
|
|
14403
|
+
const gridRef = (0, import_react72.useRef)(null);
|
|
14404
|
+
const pendingFocus = (0, import_react72.useRef)(autoFocus);
|
|
14376
14405
|
const month = startOfMonth(active);
|
|
14377
|
-
const days = (0,
|
|
14406
|
+
const days = (0, import_react72.useMemo)(() => buildMonthGrid(month, weekStartsOn).filter((day) => day.inMonth), [month, weekStartsOn]);
|
|
14378
14407
|
const blanks = (utc(month).getUTCDay() - weekStartsOn + 7) % 7;
|
|
14379
|
-
const weekdays = (0,
|
|
14380
|
-
(0,
|
|
14408
|
+
const weekdays = (0, import_react72.useMemo)(() => weekdayNames(locale, weekStartsOn), [locale, weekStartsOn]);
|
|
14409
|
+
(0, import_react72.useEffect)(() => {
|
|
14381
14410
|
if (!pendingFocus.current) return;
|
|
14382
14411
|
pendingFocus.current = false;
|
|
14383
14412
|
gridRef.current?.querySelector(`[data-date="${active}"]`)?.focus({ preventScroll: true });
|
|
@@ -14484,27 +14513,27 @@ function RangeCalendar({
|
|
|
14484
14513
|
weekStartsOn = 1,
|
|
14485
14514
|
autoFocus = false
|
|
14486
14515
|
}) {
|
|
14487
|
-
const id = (0,
|
|
14488
|
-
const weekdays = (0,
|
|
14489
|
-
const [internalMonth, setInternalMonth] = (0,
|
|
14516
|
+
const id = (0, import_react73.useId)();
|
|
14517
|
+
const weekdays = (0, import_react73.useMemo)(() => weekdayNames(locale, weekStartsOn), [locale, weekStartsOn]);
|
|
14518
|
+
const [internalMonth, setInternalMonth] = (0, import_react73.useState)(() => startOfMonth(controlledMonth ?? value.start ?? (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)));
|
|
14490
14519
|
const visibleMonth = startOfMonth(controlledMonth ?? internalMonth);
|
|
14491
|
-
const [activeDate, setActiveDate] = (0,
|
|
14492
|
-
const rootRef = (0,
|
|
14493
|
-
const pendingFocus = (0,
|
|
14520
|
+
const [activeDate, setActiveDate] = (0, import_react73.useState)(value.end ?? value.start ?? visibleMonth);
|
|
14521
|
+
const rootRef = (0, import_react73.useRef)(null);
|
|
14522
|
+
const pendingFocus = (0, import_react73.useRef)(autoFocus);
|
|
14494
14523
|
const count2 = Math.max(1, Math.min(3, months));
|
|
14495
|
-
const calendars = (0,
|
|
14524
|
+
const calendars = (0, import_react73.useMemo)(() => Array.from({ length: count2 }, (_, index) => {
|
|
14496
14525
|
const month = startOfMonth(addCalendarMonths(visibleMonth, index));
|
|
14497
14526
|
return { month, days: buildMonthGrid(month).filter((day) => day.inMonth) };
|
|
14498
14527
|
}), [visibleMonth, count2]);
|
|
14499
14528
|
const todayDate = today === void 0 ? localDateKey() : today;
|
|
14500
14529
|
const rangeInvalid = invalid || !!value.start && !!value.end && value.start > value.end;
|
|
14501
|
-
(0,
|
|
14530
|
+
(0, import_react73.useEffect)(() => {
|
|
14502
14531
|
const first = calendars[0]?.days[0]?.date;
|
|
14503
14532
|
const finalDays = calendars[calendars.length - 1]?.days;
|
|
14504
14533
|
const last = finalDays?.[finalDays.length - 1]?.date;
|
|
14505
14534
|
if (first && last && (activeDate < first || activeDate > last)) setActiveDate(first);
|
|
14506
14535
|
}, [activeDate, calendars]);
|
|
14507
|
-
(0,
|
|
14536
|
+
(0, import_react73.useEffect)(() => {
|
|
14508
14537
|
if (!pendingFocus.current) return;
|
|
14509
14538
|
rootRef.current?.querySelector(`[data-date="${activeDate}"]`)?.focus({ preventScroll: autoFocus });
|
|
14510
14539
|
pendingFocus.current = false;
|
|
@@ -14608,15 +14637,15 @@ function DateRangeField(props) {
|
|
|
14608
14637
|
"aria-describedby": ariaDescribedBy,
|
|
14609
14638
|
"aria-invalid": ariaInvalid
|
|
14610
14639
|
} = props;
|
|
14611
|
-
const uid = (0,
|
|
14640
|
+
const uid = (0, import_react73.useId)();
|
|
14612
14641
|
const id = idProp ?? `${uid}-trigger`;
|
|
14613
14642
|
const popoverId = `${uid}-months`;
|
|
14614
14643
|
const valueId = `${uid}-value`;
|
|
14615
|
-
const anchorRef = (0,
|
|
14616
|
-
const triggerRef = (0,
|
|
14644
|
+
const anchorRef = (0, import_react73.useRef)(null);
|
|
14645
|
+
const triggerRef = (0, import_react73.useRef)(null);
|
|
14617
14646
|
const { open, hide, triggerProps } = useFieldPopover(popoverId, () => triggerRef.current?.focus({ preventScroll: true }), onOpenChange);
|
|
14618
|
-
const [labelled, setLabelled] = (0,
|
|
14619
|
-
(0,
|
|
14647
|
+
const [labelled, setLabelled] = (0, import_react73.useState)(false);
|
|
14648
|
+
(0, import_react73.useEffect)(() => {
|
|
14620
14649
|
setLabelled((triggerRef.current?.labels?.length ?? 0) > 0);
|
|
14621
14650
|
}, [id]);
|
|
14622
14651
|
const format = (date) => formatDate?.(date) ?? formatDateKey(date, locale);
|
|
@@ -14687,7 +14716,7 @@ function DateRangeField(props) {
|
|
|
14687
14716
|
}
|
|
14688
14717
|
|
|
14689
14718
|
// src/components/DatePicker.tsx
|
|
14690
|
-
var
|
|
14719
|
+
var import_react74 = require("react");
|
|
14691
14720
|
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
14692
14721
|
var DEFAULT_DATE_PICKER_LABELS = {
|
|
14693
14722
|
open: "Choose date",
|
|
@@ -14699,7 +14728,7 @@ var DEFAULT_DATE_PICKER_LABELS = {
|
|
|
14699
14728
|
notADate: "That is not a date.",
|
|
14700
14729
|
unavailable: "That date is not available."
|
|
14701
14730
|
};
|
|
14702
|
-
var DatePicker = (0,
|
|
14731
|
+
var DatePicker = (0, import_react74.forwardRef)(function DatePicker2({
|
|
14703
14732
|
value,
|
|
14704
14733
|
onValueChange,
|
|
14705
14734
|
min,
|
|
@@ -14730,18 +14759,18 @@ var DatePicker = (0, import_react73.forwardRef)(function DatePicker2({
|
|
|
14730
14759
|
className,
|
|
14731
14760
|
style
|
|
14732
14761
|
}, forwardedRef) {
|
|
14733
|
-
const uid = (0,
|
|
14762
|
+
const uid = (0, import_react74.useId)();
|
|
14734
14763
|
const id = idProp ?? `${uid}-input`;
|
|
14735
14764
|
const popoverId = `${uid}-calendar`;
|
|
14736
14765
|
const errorId = `${uid}-error`;
|
|
14737
14766
|
const labels = { ...DEFAULT_DATE_PICKER_LABELS, ...useUixLabels().datePicker, ...labelOverrides };
|
|
14738
|
-
const anchorRef = (0,
|
|
14739
|
-
const inputRef = (0,
|
|
14740
|
-
(0,
|
|
14767
|
+
const anchorRef = (0, import_react74.useRef)(null);
|
|
14768
|
+
const inputRef = (0, import_react74.useRef)(null);
|
|
14769
|
+
(0, import_react74.useImperativeHandle)(forwardedRef, () => inputRef.current);
|
|
14741
14770
|
const format = (date) => formatDate?.(date) ?? formatDateKey(date, locale);
|
|
14742
|
-
const [text, setText] = (0,
|
|
14743
|
-
const [problem, setProblemState] = (0,
|
|
14744
|
-
const reported = (0,
|
|
14771
|
+
const [text, setText] = (0, import_react74.useState)(() => value ? format(value) : "");
|
|
14772
|
+
const [problem, setProblemState] = (0, import_react74.useState)(null);
|
|
14773
|
+
const reported = (0, import_react74.useRef)(null);
|
|
14745
14774
|
const setProblem = (next) => {
|
|
14746
14775
|
if (next !== reported.current) {
|
|
14747
14776
|
reported.current = next;
|
|
@@ -14749,7 +14778,7 @@ var DatePicker = (0, import_react73.forwardRef)(function DatePicker2({
|
|
|
14749
14778
|
}
|
|
14750
14779
|
setProblemState(next);
|
|
14751
14780
|
};
|
|
14752
|
-
(0,
|
|
14781
|
+
(0, import_react74.useEffect)(() => {
|
|
14753
14782
|
setText(value ? format(value) : "");
|
|
14754
14783
|
setProblem(null);
|
|
14755
14784
|
}, [value, locale]);
|
|
@@ -14899,7 +14928,7 @@ var DEFAULT_DATE_TIME_PICKER_LABELS = {
|
|
|
14899
14928
|
timeOf: "{label}, time",
|
|
14900
14929
|
timeZone: "Time zone: {zone}"
|
|
14901
14930
|
};
|
|
14902
|
-
var DateTimePicker = (0,
|
|
14931
|
+
var DateTimePicker = (0, import_react74.forwardRef)(function DateTimePicker2({
|
|
14903
14932
|
value,
|
|
14904
14933
|
onValueChange,
|
|
14905
14934
|
timeZone,
|
|
@@ -14923,19 +14952,19 @@ var DateTimePicker = (0, import_react73.forwardRef)(function DateTimePicker2({
|
|
|
14923
14952
|
style,
|
|
14924
14953
|
...dateProps
|
|
14925
14954
|
}, forwardedRef) {
|
|
14926
|
-
const uid = (0,
|
|
14955
|
+
const uid = (0, import_react74.useId)();
|
|
14927
14956
|
const id = idProp ?? `${uid}-date`;
|
|
14928
14957
|
const zoneId = `${uid}-zone`;
|
|
14929
14958
|
const labels = { ...DEFAULT_DATE_TIME_PICKER_LABELS, ...useUixLabels().dateTimePicker, ...labelOverrides };
|
|
14930
14959
|
const { date, time } = splitDateTime(value);
|
|
14931
|
-
const dateRef = (0,
|
|
14932
|
-
(0,
|
|
14933
|
-
const [pendingTime, setPendingTime] = (0,
|
|
14960
|
+
const dateRef = (0, import_react74.useRef)(null);
|
|
14961
|
+
(0, import_react74.useImperativeHandle)(forwardedRef, () => dateRef.current);
|
|
14962
|
+
const [pendingTime, setPendingTime] = (0, import_react74.useState)("");
|
|
14934
14963
|
const shownTime = date ? time : pendingTime;
|
|
14935
|
-
const [fieldLabel, setFieldLabel] = (0,
|
|
14936
|
-
const [viewerZone, setViewerZone] = (0,
|
|
14964
|
+
const [fieldLabel, setFieldLabel] = (0, import_react74.useState)("");
|
|
14965
|
+
const [viewerZone, setViewerZone] = (0, import_react74.useState)(null);
|
|
14937
14966
|
const grouped = !!ariaLabel || !!ariaLabelledBy;
|
|
14938
|
-
(0,
|
|
14967
|
+
(0, import_react74.useEffect)(() => {
|
|
14939
14968
|
if (!grouped) setFieldLabel(dateRef.current?.labels?.[0]?.textContent?.trim() ?? "");
|
|
14940
14969
|
if (!timeZone) {
|
|
14941
14970
|
try {
|
|
@@ -15014,7 +15043,7 @@ var DateTimePicker = (0, import_react73.forwardRef)(function DateTimePicker2({
|
|
|
15014
15043
|
});
|
|
15015
15044
|
|
|
15016
15045
|
// src/components/RelationshipGraph.tsx
|
|
15017
|
-
var
|
|
15046
|
+
var import_react76 = require("react");
|
|
15018
15047
|
|
|
15019
15048
|
// src/relationship-graph-model.ts
|
|
15020
15049
|
function boundRelationshipGraph(nodes, edges, maxNodes = 40) {
|
|
@@ -15495,7 +15524,7 @@ function layeredNeighbor(layout, currentId, key) {
|
|
|
15495
15524
|
}
|
|
15496
15525
|
|
|
15497
15526
|
// src/components/RelationshipGraphLayered.tsx
|
|
15498
|
-
var
|
|
15527
|
+
var import_react75 = require("react");
|
|
15499
15528
|
|
|
15500
15529
|
// src/components/RelationshipGraphList.tsx
|
|
15501
15530
|
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
@@ -15585,13 +15614,13 @@ function LayeredRelationshipGraph({
|
|
|
15585
15614
|
controls = "full",
|
|
15586
15615
|
initialView: initialViewMode = "readable"
|
|
15587
15616
|
}) {
|
|
15588
|
-
const hintId = (0,
|
|
15589
|
-
const viewportHintId = (0,
|
|
15617
|
+
const hintId = (0, import_react75.useId)();
|
|
15618
|
+
const viewportHintId = (0, import_react75.useId)();
|
|
15590
15619
|
const compact = controls === "compact";
|
|
15591
|
-
const bounded = (0,
|
|
15592
|
-
const [localExpanded, setLocalExpanded] = (0,
|
|
15620
|
+
const bounded = (0, import_react75.useMemo)(() => boundRelationshipGraph(nodes, edges, maxNodes), [nodes, edges, maxNodes]);
|
|
15621
|
+
const [localExpanded, setLocalExpanded] = (0, import_react75.useState)(EMPTY_IDS2);
|
|
15593
15622
|
const expanded = expandedClusterIds ?? localExpanded;
|
|
15594
|
-
const layout = (0,
|
|
15623
|
+
const layout = (0, import_react75.useMemo)(
|
|
15595
15624
|
() => layoutLayeredGraph(bounded.nodes, bounded.edges, {
|
|
15596
15625
|
...rootId !== void 0 ? { rootId } : {},
|
|
15597
15626
|
...clusterThreshold !== void 0 ? { clusterThreshold } : {},
|
|
@@ -15600,43 +15629,43 @@ function LayeredRelationshipGraph({
|
|
|
15600
15629
|
}),
|
|
15601
15630
|
[bounded, rootId, clusterThreshold, expanded, density]
|
|
15602
15631
|
);
|
|
15603
|
-
const itemById = (0,
|
|
15604
|
-
const startView = (0,
|
|
15632
|
+
const itemById = (0, import_react75.useMemo)(() => new Map(layout.items.map((item) => [item.id, item])), [layout]);
|
|
15633
|
+
const startView = (0, import_react75.useCallback)(
|
|
15605
15634
|
(forLayout, forSize) => initialViewMode === "fit" ? fitView(forLayout, forSize) : initialView(forLayout, forSize),
|
|
15606
15635
|
[initialViewMode]
|
|
15607
15636
|
);
|
|
15608
|
-
const viewportRef = (0,
|
|
15609
|
-
const itemRefs = (0,
|
|
15610
|
-
const fullscreenButtonRef = (0,
|
|
15611
|
-
const [size, setSize] = (0,
|
|
15612
|
-
const [view, setView] = (0,
|
|
15613
|
-
const [animate, setAnimate] = (0,
|
|
15614
|
-
const [localFocus, setLocalFocus] = (0,
|
|
15615
|
-
const [hoverId, setHoverId] = (0,
|
|
15616
|
-
const [fullscreen, setFullscreen] = (0,
|
|
15617
|
-
const [wheelHint, setWheelHint] = (0,
|
|
15618
|
-
const viewRef = (0,
|
|
15637
|
+
const viewportRef = (0, import_react75.useRef)(null);
|
|
15638
|
+
const itemRefs = (0, import_react75.useRef)(/* @__PURE__ */ new Map());
|
|
15639
|
+
const fullscreenButtonRef = (0, import_react75.useRef)(null);
|
|
15640
|
+
const [size, setSize] = (0, import_react75.useState)({ width: 0, height: 0 });
|
|
15641
|
+
const [view, setView] = (0, import_react75.useState)({ x: 0, y: 0, zoom: 1 });
|
|
15642
|
+
const [animate, setAnimate] = (0, import_react75.useState)(false);
|
|
15643
|
+
const [localFocus, setLocalFocus] = (0, import_react75.useState)(void 0);
|
|
15644
|
+
const [hoverId, setHoverId] = (0, import_react75.useState)(void 0);
|
|
15645
|
+
const [fullscreen, setFullscreen] = (0, import_react75.useState)(false);
|
|
15646
|
+
const [wheelHint, setWheelHint] = (0, import_react75.useState)(false);
|
|
15647
|
+
const viewRef = (0, import_react75.useRef)(view);
|
|
15619
15648
|
viewRef.current = view;
|
|
15620
|
-
const layoutRef = (0,
|
|
15649
|
+
const layoutRef = (0, import_react75.useRef)(layout);
|
|
15621
15650
|
layoutRef.current = layout;
|
|
15622
|
-
const fullscreenRef = (0,
|
|
15651
|
+
const fullscreenRef = (0, import_react75.useRef)(fullscreen);
|
|
15623
15652
|
fullscreenRef.current = fullscreen;
|
|
15624
|
-
const compactRef = (0,
|
|
15653
|
+
const compactRef = (0, import_react75.useRef)(compact);
|
|
15625
15654
|
compactRef.current = compact;
|
|
15626
|
-
const pendingFocus = (0,
|
|
15627
|
-
const initialisedFor = (0,
|
|
15628
|
-
const refitOnResize = (0,
|
|
15629
|
-
const hintTimer = (0,
|
|
15655
|
+
const pendingFocus = (0, import_react75.useRef)(void 0);
|
|
15656
|
+
const initialisedFor = (0, import_react75.useRef)(void 0);
|
|
15657
|
+
const refitOnResize = (0, import_react75.useRef)(false);
|
|
15658
|
+
const hintTimer = (0, import_react75.useRef)(void 0);
|
|
15630
15659
|
const modifier = useKbdPlatform() === "mac" ? "\u2318" : "Ctrl";
|
|
15631
15660
|
const rootItemId = layout.rootId !== void 0 ? layout.itemOf[layout.rootId] : layout.items[0]?.id;
|
|
15632
15661
|
const requestedFocus = focusId !== void 0 ? layout.itemOf[focusId] ?? focusId : localFocus;
|
|
15633
15662
|
const focusedId = requestedFocus !== void 0 && itemById.has(requestedFocus) ? requestedFocus : rootItemId;
|
|
15634
15663
|
const selectedItemId = selectedId !== void 0 ? layout.itemOf[selectedId] : void 0;
|
|
15635
|
-
const activeIds = (0,
|
|
15664
|
+
const activeIds = (0, import_react75.useMemo)(
|
|
15636
15665
|
() => new Set([hoverId, selectedItemId].filter((id) => id !== void 0)),
|
|
15637
15666
|
[hoverId, selectedItemId]
|
|
15638
15667
|
);
|
|
15639
|
-
(0,
|
|
15668
|
+
(0, import_react75.useEffect)(() => {
|
|
15640
15669
|
const element = viewportRef.current;
|
|
15641
15670
|
if (!element) return;
|
|
15642
15671
|
const measure2 = () => setSize({ width: element.clientWidth, height: element.clientHeight });
|
|
@@ -15646,20 +15675,20 @@ function LayeredRelationshipGraph({
|
|
|
15646
15675
|
observer.observe(element);
|
|
15647
15676
|
return () => observer.disconnect();
|
|
15648
15677
|
}, []);
|
|
15649
|
-
(0,
|
|
15678
|
+
(0, import_react75.useEffect)(() => {
|
|
15650
15679
|
if (size.width === 0) return;
|
|
15651
15680
|
const key = `${layout.rootId ?? ""}`;
|
|
15652
15681
|
if (initialisedFor.current === key) return;
|
|
15653
15682
|
initialisedFor.current = key;
|
|
15654
15683
|
setView(startView(layout, size));
|
|
15655
15684
|
}, [layout, size, startView]);
|
|
15656
|
-
(0,
|
|
15685
|
+
(0, import_react75.useEffect)(() => {
|
|
15657
15686
|
if (!refitOnResize.current || size.width === 0) return;
|
|
15658
15687
|
refitOnResize.current = false;
|
|
15659
15688
|
setAnimate(false);
|
|
15660
15689
|
setView(startView(layoutRef.current, size));
|
|
15661
15690
|
}, [size, startView]);
|
|
15662
|
-
(0,
|
|
15691
|
+
(0, import_react75.useEffect)(() => {
|
|
15663
15692
|
if (!fullscreen) return;
|
|
15664
15693
|
const root = document.documentElement;
|
|
15665
15694
|
const previous = root.style.overflow;
|
|
@@ -15668,12 +15697,12 @@ function LayeredRelationshipGraph({
|
|
|
15668
15697
|
root.style.overflow = previous;
|
|
15669
15698
|
};
|
|
15670
15699
|
}, [fullscreen]);
|
|
15671
|
-
(0,
|
|
15672
|
-
const moveView = (0,
|
|
15700
|
+
(0, import_react75.useEffect)(() => () => clearTimeout(hintTimer.current), []);
|
|
15701
|
+
const moveView = (0, import_react75.useCallback)((next, smooth) => {
|
|
15673
15702
|
setAnimate(smooth);
|
|
15674
15703
|
setView(next);
|
|
15675
15704
|
}, []);
|
|
15676
|
-
const ensureVisible = (0,
|
|
15705
|
+
const ensureVisible = (0, import_react75.useCallback)((id, smooth) => {
|
|
15677
15706
|
const element = viewportRef.current;
|
|
15678
15707
|
const item = layoutRef.current.items.find((candidate) => candidate.id === id);
|
|
15679
15708
|
if (!element || !item) return;
|
|
@@ -15692,7 +15721,7 @@ function LayeredRelationshipGraph({
|
|
|
15692
15721
|
else if (bottom > heightPx - FOCUS_MARGIN) nextY -= bottom - (heightPx - FOCUS_MARGIN);
|
|
15693
15722
|
if (nextX !== x || nextY !== y) moveView({ x: nextX, y: nextY, zoom }, smooth);
|
|
15694
15723
|
}, [moveView]);
|
|
15695
|
-
const focusItem = (0,
|
|
15724
|
+
const focusItem = (0, import_react75.useCallback)((id) => {
|
|
15696
15725
|
setLocalFocus(id);
|
|
15697
15726
|
onFocusChange?.(id);
|
|
15698
15727
|
requestAnimationFrame(() => {
|
|
@@ -15700,7 +15729,7 @@ function LayeredRelationshipGraph({
|
|
|
15700
15729
|
ensureVisible(id, true);
|
|
15701
15730
|
});
|
|
15702
15731
|
}, [ensureVisible, onFocusChange]);
|
|
15703
|
-
(0,
|
|
15732
|
+
(0, import_react75.useEffect)(() => {
|
|
15704
15733
|
const wanted = pendingFocus.current;
|
|
15705
15734
|
if (wanted !== void 0 && itemById.has(wanted)) {
|
|
15706
15735
|
pendingFocus.current = void 0;
|
|
@@ -15710,8 +15739,8 @@ function LayeredRelationshipGraph({
|
|
|
15710
15739
|
const controlledTarget = focusId !== void 0 ? layout.itemOf[focusId] ?? focusId : void 0;
|
|
15711
15740
|
const controlledPresent = controlledTarget !== void 0 && itemById.has(controlledTarget);
|
|
15712
15741
|
const controlledKey = `${controlledTarget ?? ""}|${controlledPresent}`;
|
|
15713
|
-
const lastControlledKey = (0,
|
|
15714
|
-
(0,
|
|
15742
|
+
const lastControlledKey = (0, import_react75.useRef)(controlledKey);
|
|
15743
|
+
(0, import_react75.useEffect)(() => {
|
|
15715
15744
|
if (lastControlledKey.current === controlledKey) return;
|
|
15716
15745
|
lastControlledKey.current = controlledKey;
|
|
15717
15746
|
if (!controlledPresent || controlledTarget === void 0) return;
|
|
@@ -15720,7 +15749,7 @@ function LayeredRelationshipGraph({
|
|
|
15720
15749
|
ensureVisible(controlledTarget, true);
|
|
15721
15750
|
});
|
|
15722
15751
|
}, [controlledKey, controlledTarget, controlledPresent, ensureVisible]);
|
|
15723
|
-
(0,
|
|
15752
|
+
(0, import_react75.useEffect)(() => {
|
|
15724
15753
|
const element = viewportRef.current;
|
|
15725
15754
|
if (!element) return;
|
|
15726
15755
|
const onWheel = (event) => {
|
|
@@ -15745,8 +15774,8 @@ function LayeredRelationshipGraph({
|
|
|
15745
15774
|
element.addEventListener("wheel", onWheel, { passive: false });
|
|
15746
15775
|
return () => element.removeEventListener("wheel", onWheel);
|
|
15747
15776
|
}, []);
|
|
15748
|
-
const pointers = (0,
|
|
15749
|
-
const pinchDistance = (0,
|
|
15777
|
+
const pointers = (0, import_react75.useRef)(/* @__PURE__ */ new Map());
|
|
15778
|
+
const pinchDistance = (0, import_react75.useRef)(void 0);
|
|
15750
15779
|
const onPointerDown = (event) => {
|
|
15751
15780
|
if (event.target.closest("button")) return;
|
|
15752
15781
|
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
@@ -16008,21 +16037,23 @@ function LayeredRelationshipGraph({
|
|
|
16008
16037
|
})
|
|
16009
16038
|
] }),
|
|
16010
16039
|
compact && /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(import_jsx_runtime100.Fragment, { children: [
|
|
16011
|
-
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("p", { className: "uix-relationship-graph__hint", "aria-hidden": "true", children: labels.navigationHint(modifier) }),
|
|
16012
16040
|
wheelHint && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("p", { className: "uix-relationship-graph__toast", role: "status", children: labels.navigationHint(modifier) }),
|
|
16013
|
-
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "uix-relationship-
|
|
16014
|
-
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("
|
|
16015
|
-
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "uix-relationship-
|
|
16016
|
-
|
|
16017
|
-
|
|
16018
|
-
|
|
16019
|
-
|
|
16020
|
-
|
|
16021
|
-
|
|
16022
|
-
|
|
16023
|
-
|
|
16024
|
-
|
|
16025
|
-
|
|
16041
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "uix-relationship-graph__footer", children: [
|
|
16042
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("p", { className: "uix-relationship-graph__hint", "aria-hidden": "true", children: labels.navigationHint(modifier) }),
|
|
16043
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "uix-relationship-graph__controls", role: "group", "aria-label": labels.controls, children: [
|
|
16044
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("span", { className: "uix-relationship-graph__zoom-level", "aria-live": "polite", children: labels.zoomLevel(zoomPercent) }),
|
|
16045
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "uix-relationship-graph__control-cluster", children: [
|
|
16046
|
+
control(labels.zoomIn, /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(PlusIcon, { "aria-hidden": "true" }), () => zoomBy(ZOOM_STEP), { disabled: view.zoom >= MAX_ZOOM2, keys: ["+"] }),
|
|
16047
|
+
control(labels.zoomOut, /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(MinusIcon, { "aria-hidden": "true" }), () => zoomBy(1 / ZOOM_STEP), { disabled: view.zoom <= MIN_ZOOM2, keys: ["\u2212"] }),
|
|
16048
|
+
control(labels.fit, /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(ScanIcon, { "aria-hidden": "true" }), () => moveView(fitView(layout, size), true)),
|
|
16049
|
+
control(labels.reset, /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(RotateCcwIcon, { "aria-hidden": "true" }), resetView, { keys: ["0"] }),
|
|
16050
|
+
control(
|
|
16051
|
+
fullscreen ? labels.exitFullscreen : labels.fullscreen,
|
|
16052
|
+
fullscreen ? /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Minimize2Icon, { "aria-hidden": "true" }) : /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Maximize2Icon, { "aria-hidden": "true" }),
|
|
16053
|
+
toggleFullscreen,
|
|
16054
|
+
{ ref: fullscreenButtonRef, ...fullscreen ? { keys: ["Esc"] } : {} }
|
|
16055
|
+
)
|
|
16056
|
+
] })
|
|
16026
16057
|
] })
|
|
16027
16058
|
] })
|
|
16028
16059
|
] })
|
|
@@ -16117,7 +16148,7 @@ function radialViewBox(nodes) {
|
|
|
16117
16148
|
return `${round(minX)} ${round(minY)} ${width} ${height}`;
|
|
16118
16149
|
}
|
|
16119
16150
|
function RelationshipGraph(props) {
|
|
16120
|
-
const labels = (0,
|
|
16151
|
+
const labels = (0, import_react76.useMemo)(() => ({ ...DEFAULT_RELATIONSHIP_GRAPH_LABELS, ...props.labels }), [props.labels]);
|
|
16121
16152
|
const stateClass = cx("uix-relationship-graph uix-relationship-graph--state", props.className);
|
|
16122
16153
|
if (props.loading) return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className: stateClass, role: "status", children: labels.loading });
|
|
16123
16154
|
if (props.error) {
|
|
@@ -16151,17 +16182,17 @@ function RadialRelationshipGraph({
|
|
|
16151
16182
|
labels,
|
|
16152
16183
|
showList = true
|
|
16153
16184
|
}) {
|
|
16154
|
-
const bounded = (0,
|
|
16155
|
-
const positioned = (0,
|
|
16156
|
-
const typeColor = (0,
|
|
16185
|
+
const bounded = (0, import_react76.useMemo)(() => boundRelationshipGraph(nodes, edges, maxNodes), [nodes, edges, maxNodes]);
|
|
16186
|
+
const positioned = (0, import_react76.useMemo)(() => layoutRelationshipGraph(bounded.nodes, bounded.edges, selectedId), [bounded, selectedId]);
|
|
16187
|
+
const typeColor = (0, import_react76.useMemo)(
|
|
16157
16188
|
() => new Map(legend.map((item, index) => [item.id, `var(--uix-chart-${index % 8 + 1})`])),
|
|
16158
16189
|
[legend]
|
|
16159
16190
|
);
|
|
16160
|
-
const positionedById = (0,
|
|
16161
|
-
const [zoom, setZoom] = (0,
|
|
16162
|
-
const [pan, setPan] = (0,
|
|
16163
|
-
const [focusedId, setFocusedId] = (0,
|
|
16164
|
-
const svgRef = (0,
|
|
16191
|
+
const positionedById = (0, import_react76.useMemo)(() => new Map(positioned.map((node) => [node.id, node])), [positioned]);
|
|
16192
|
+
const [zoom, setZoom] = (0, import_react76.useState)(1);
|
|
16193
|
+
const [pan, setPan] = (0, import_react76.useState)({ x: 0, y: 0 });
|
|
16194
|
+
const [focusedId, setFocusedId] = (0, import_react76.useState)(selectedId ?? positioned[0]?.id);
|
|
16195
|
+
const svgRef = (0, import_react76.useRef)(null);
|
|
16165
16196
|
const select = (id) => {
|
|
16166
16197
|
const node = bounded.nodes.find((item) => item.id === id);
|
|
16167
16198
|
if (node) onSelect?.(node);
|
|
@@ -16232,7 +16263,7 @@ function RadialRelationshipGraph({
|
|
|
16232
16263
|
}
|
|
16233
16264
|
|
|
16234
16265
|
// src/components/MatchReview.tsx
|
|
16235
|
-
var
|
|
16266
|
+
var import_react77 = require("react");
|
|
16236
16267
|
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
16237
16268
|
var DEFAULT_MATCH_REVIEW_LABELS = {
|
|
16238
16269
|
region: "Match review",
|
|
@@ -16295,11 +16326,11 @@ function MatchReview({
|
|
|
16295
16326
|
const plural = (n, one, many) => fillLabel(n === 1 ? one : many, { count: n });
|
|
16296
16327
|
const decisionLabel = { accepted: labels.decisionAccepted, dismissed: labels.decisionDismissed, split: labels.decisionSplit, other: labels.decisionOther };
|
|
16297
16328
|
const actionLabel = { accept: labels.accept, dismiss: labels.dismiss, split: labels.split, "pick-other": labels.pickOther };
|
|
16298
|
-
const [internalSelection, setInternalSelection] = (0,
|
|
16299
|
-
const [announcement, setAnnouncement] = (0,
|
|
16300
|
-
const [bulkPending, setBulkPending] = (0,
|
|
16329
|
+
const [internalSelection, setInternalSelection] = (0, import_react77.useState)(/* @__PURE__ */ new Set());
|
|
16330
|
+
const [announcement, setAnnouncement] = (0, import_react77.useState)("");
|
|
16331
|
+
const [bulkPending, setBulkPending] = (0, import_react77.useState)(false);
|
|
16301
16332
|
const selection = selectedIds ?? internalSelection;
|
|
16302
|
-
const pending = (0,
|
|
16333
|
+
const pending = (0, import_react77.useMemo)(() => candidates.filter((candidate) => candidate.status !== "resolved"), [candidates]);
|
|
16303
16334
|
const setSelection = (next) => {
|
|
16304
16335
|
if (selectedIds === void 0) setInternalSelection(next);
|
|
16305
16336
|
onSelectionChange?.(next);
|
|
@@ -16388,7 +16419,7 @@ function MatchReview({
|
|
|
16388
16419
|
}
|
|
16389
16420
|
|
|
16390
16421
|
// src/components/MetricInput.tsx
|
|
16391
|
-
var
|
|
16422
|
+
var import_react78 = require("react");
|
|
16392
16423
|
|
|
16393
16424
|
// src/metric-model.ts
|
|
16394
16425
|
function decimals(value) {
|
|
@@ -16434,14 +16465,14 @@ function MetricInput({
|
|
|
16434
16465
|
className,
|
|
16435
16466
|
id: providedId
|
|
16436
16467
|
}) {
|
|
16437
|
-
const generatedId = (0,
|
|
16468
|
+
const generatedId = (0, import_react78.useId)();
|
|
16438
16469
|
const id = providedId ?? generatedId;
|
|
16439
16470
|
const errorId = `${id}-error`;
|
|
16440
16471
|
const hintId = `${id}-hint`;
|
|
16441
16472
|
const showError = Boolean(invalid && errorMessage);
|
|
16442
16473
|
const describedBy = [hint ? hintId : null, showError ? errorId : null].filter(Boolean).join(" ") || void 0;
|
|
16443
|
-
const [text, setText] = (0,
|
|
16444
|
-
(0,
|
|
16474
|
+
const [text, setText] = (0, import_react78.useState)(() => format(value));
|
|
16475
|
+
(0, import_react78.useEffect)(() => setText(format(value)), [value, format]);
|
|
16445
16476
|
const commit = (input) => {
|
|
16446
16477
|
const parsed = parse(input);
|
|
16447
16478
|
if (input.trim() === "" || parsed !== null) {
|
|
@@ -16553,7 +16584,7 @@ function LicensePositionBar({
|
|
|
16553
16584
|
}
|
|
16554
16585
|
|
|
16555
16586
|
// src/components/BrandProfiles.tsx
|
|
16556
|
-
var
|
|
16587
|
+
var import_react80 = require("react");
|
|
16557
16588
|
|
|
16558
16589
|
// src/color-model.ts
|
|
16559
16590
|
var clamp2 = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
@@ -16622,7 +16653,7 @@ function meetsContrast(background, foreground, minimum = 4.5) {
|
|
|
16622
16653
|
}
|
|
16623
16654
|
|
|
16624
16655
|
// src/components/ColorPicker.tsx
|
|
16625
|
-
var
|
|
16656
|
+
var import_react79 = require("react");
|
|
16626
16657
|
var import_jsx_runtime105 = require("react/jsx-runtime");
|
|
16627
16658
|
var DEFAULT_COLOR_PICKER_LABELS = {
|
|
16628
16659
|
trigger: "{label}: {color}",
|
|
@@ -16654,17 +16685,17 @@ function ColorPicker({
|
|
|
16654
16685
|
labels: labelOverrides
|
|
16655
16686
|
}) {
|
|
16656
16687
|
const labels = { ...DEFAULT_COLOR_PICKER_LABELS, ...labelOverrides };
|
|
16657
|
-
const id = (0,
|
|
16658
|
-
const triggerRef = (0,
|
|
16659
|
-
const dialogRef = (0,
|
|
16660
|
-
const [open, setOpen] = (0,
|
|
16688
|
+
const id = (0, import_react79.useId)();
|
|
16689
|
+
const triggerRef = (0, import_react79.useRef)(null);
|
|
16690
|
+
const dialogRef = (0, import_react79.useRef)(null);
|
|
16691
|
+
const [open, setOpen] = (0, import_react79.useState)(false);
|
|
16661
16692
|
const normalized = normalizeHex(value) ?? "#000000";
|
|
16662
|
-
const [hexText, setHexText] = (0,
|
|
16663
|
-
const hsv = (0,
|
|
16693
|
+
const [hexText, setHexText] = (0, import_react79.useState)(normalized);
|
|
16694
|
+
const hsv = (0, import_react79.useMemo)(() => rgbToHsv(hexToRgb(normalized)), [normalized]);
|
|
16664
16695
|
const ratio = contrastRatio(normalized, foreground) ?? 0;
|
|
16665
16696
|
const passes = ratio >= minimumContrast;
|
|
16666
|
-
(0,
|
|
16667
|
-
(0,
|
|
16697
|
+
(0, import_react79.useEffect)(() => setHexText(normalized), [normalized]);
|
|
16698
|
+
(0, import_react79.useEffect)(() => {
|
|
16668
16699
|
if (!open) return;
|
|
16669
16700
|
const dialog = dialogRef.current;
|
|
16670
16701
|
dialog?.querySelector("input,button")?.focus();
|
|
@@ -16884,7 +16915,7 @@ function BrandProfileEditor({
|
|
|
16884
16915
|
labels: labelOverrides
|
|
16885
16916
|
}) {
|
|
16886
16917
|
const labels = { ...DEFAULT_BRAND_PROFILE_EDITOR_LABELS, ...labelOverrides };
|
|
16887
|
-
const [announcement, setAnnouncement] = (0,
|
|
16918
|
+
const [announcement, setAnnouncement] = (0, import_react80.useState)("");
|
|
16888
16919
|
const update = (patch) => onChange({ ...value, ...patch });
|
|
16889
16920
|
const apply = () => {
|
|
16890
16921
|
if (applyTarget !== null) applyBrandProfile(value, applyTarget);
|
|
@@ -16956,7 +16987,7 @@ function BrandProfileEditor({
|
|
|
16956
16987
|
var BrandProfiles = BrandProfileEditor;
|
|
16957
16988
|
|
|
16958
16989
|
// src/components/DiffViewer.tsx
|
|
16959
|
-
var
|
|
16990
|
+
var import_react81 = require("react");
|
|
16960
16991
|
|
|
16961
16992
|
// src/diff-model.ts
|
|
16962
16993
|
function isJsonObject(value) {
|
|
@@ -17052,9 +17083,9 @@ function DiffViewer({
|
|
|
17052
17083
|
const labels = { ...DEFAULT_DIFF_VIEWER_LABELS, ...labelOverrides };
|
|
17053
17084
|
const resolutionLabel = { accept: labels.resolutionAccept, skip: labels.resolutionSkip, pending: labels.resolutionPending };
|
|
17054
17085
|
const buttonSize = controlSize === "md" ? void 0 : `uix-btn--${controlSize}`;
|
|
17055
|
-
const id = (0,
|
|
17056
|
-
const entries = (0,
|
|
17057
|
-
const [internalResolutions, setInternalResolutions] = (0,
|
|
17086
|
+
const id = (0, import_react81.useId)();
|
|
17087
|
+
const entries = (0, import_react81.useMemo)(() => providedEntries ?? buildThreeWayDiff(base, current, incoming), [providedEntries, base, current, incoming]);
|
|
17088
|
+
const [internalResolutions, setInternalResolutions] = (0, import_react81.useState)({});
|
|
17058
17089
|
const resolutions = controlledResolutions ?? internalResolutions;
|
|
17059
17090
|
const summary = summarizeDiff(entries, resolutions);
|
|
17060
17091
|
const resolve = (path, resolution) => {
|
|
@@ -17117,7 +17148,7 @@ function DiffViewer({
|
|
|
17117
17148
|
}
|
|
17118
17149
|
|
|
17119
17150
|
// src/components/TextDiff.tsx
|
|
17120
|
-
var
|
|
17151
|
+
var import_react82 = require("react");
|
|
17121
17152
|
|
|
17122
17153
|
// src/text-diff-model.ts
|
|
17123
17154
|
var WORD_TOKENS = /\s+|[\p{L}\p{M}\p{N}_]+|[^\s\p{L}\p{M}\p{N}_]/gu;
|
|
@@ -17396,7 +17427,7 @@ function Marked({ segments, side, labels, whole: whole2 }) {
|
|
|
17396
17427
|
": "
|
|
17397
17428
|
] }),
|
|
17398
17429
|
segment.text
|
|
17399
|
-
] }, i) : /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
17430
|
+
] }, i) : /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_react82.Fragment, { children: segment.text }, i)) });
|
|
17400
17431
|
}
|
|
17401
17432
|
function Cell({ line, side, kind, labels }) {
|
|
17402
17433
|
if (!line) return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("div", { className: "uix-text-diff__cell", "data-side": side, "data-empty": "", "aria-hidden": "true" });
|
|
@@ -17408,9 +17439,9 @@ function Cell({ line, side, kind, labels }) {
|
|
|
17408
17439
|
] });
|
|
17409
17440
|
}
|
|
17410
17441
|
function Rows({ rows, view, labels, focusFirst }) {
|
|
17411
|
-
const [open, setOpen] = (0,
|
|
17412
|
-
const first = (0,
|
|
17413
|
-
(0,
|
|
17442
|
+
const [open, setOpen] = (0, import_react82.useState)(() => /* @__PURE__ */ new Set());
|
|
17443
|
+
const first = (0, import_react82.useRef)(null);
|
|
17444
|
+
(0, import_react82.useEffect)(() => {
|
|
17414
17445
|
if (focusFirst) first.current?.focus();
|
|
17415
17446
|
}, [focusFirst]);
|
|
17416
17447
|
const firstProps = (index) => focusFirst && index === 0 ? { ref: first, tabIndex: -1 } : {};
|
|
@@ -17423,7 +17454,7 @@ function Rows({ rows, view, labels, focusFirst }) {
|
|
|
17423
17454
|
const after = row.kind === "delete" ? void 0 : row.after;
|
|
17424
17455
|
if (view === "unified") {
|
|
17425
17456
|
if (row.kind === "equal") return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("div", { className: "uix-text-diff__row", "data-kind": "equal", ...firstProps(index), children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(Cell, { line: after, side: "after", kind: "equal", labels }) }, index);
|
|
17426
|
-
return /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(
|
|
17457
|
+
return /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(import_react82.Fragment, { children: [
|
|
17427
17458
|
before && /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("div", { className: "uix-text-diff__row", "data-kind": "delete", children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(Cell, { line: before, side: "before", kind: row.kind, labels }) }),
|
|
17428
17459
|
after && /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("div", { className: "uix-text-diff__row", "data-kind": "insert", children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(Cell, { line: after, side: "after", kind: row.kind, labels }) })
|
|
17429
17460
|
] }, index);
|
|
@@ -17452,8 +17483,8 @@ function TextDiff({
|
|
|
17452
17483
|
}) {
|
|
17453
17484
|
const uixLabels = useUixLabels();
|
|
17454
17485
|
const labels = { ...DEFAULT_TEXT_DIFF_LABELS, ...uixLabels.textDiff, ...labelOverrides };
|
|
17455
|
-
const result = (0,
|
|
17456
|
-
const rows = (0,
|
|
17486
|
+
const result = (0, import_react82.useMemo)(() => diffText(before, after, { granularity, maxTokens, maxEdits }), [before, after, granularity, maxTokens, maxEdits]);
|
|
17487
|
+
const rows = (0, import_react82.useMemo)(() => granularity === "line" && result.status === "ok" ? textDiffRows(result, { context }) : [], [result, granularity, context]);
|
|
17457
17488
|
const heads = /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: "uix-text-diff__heads", "aria-hidden": view === "unified" || void 0, children: [
|
|
17458
17489
|
/* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("span", { className: "uix-text-diff__head", "data-side": "before", children: [
|
|
17459
17490
|
view === "unified" && /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("span", { "aria-hidden": "true", children: "\u2212 " }),
|
|
@@ -17471,7 +17502,7 @@ function TextDiff({
|
|
|
17471
17502
|
else {
|
|
17472
17503
|
const prose = (side2) => /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("div", { className: "uix-text-diff__prose", "data-side": side2, children: result.ops.map((op, i) => {
|
|
17473
17504
|
const text = op.tokens.join("");
|
|
17474
|
-
if (op.type === "equal") return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
17505
|
+
if (op.type === "equal") return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_react82.Fragment, { children: text }, i);
|
|
17475
17506
|
if (op.type === "delete" && side2 === "after") return null;
|
|
17476
17507
|
if (op.type === "insert" && side2 === "before") return null;
|
|
17477
17508
|
return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(Marked, { segments: [{ text, changed: true }], side: op.type === "delete" ? "before" : "after", labels }, i);
|
|
@@ -17794,6 +17825,7 @@ function TextDiff({
|
|
|
17794
17825
|
placeSpan,
|
|
17795
17826
|
placesInTopLane,
|
|
17796
17827
|
predictionBand,
|
|
17828
|
+
prefersReducedMotion,
|
|
17797
17829
|
proposeMove,
|
|
17798
17830
|
quantiles,
|
|
17799
17831
|
rankOverflow,
|
|
@@ -17840,6 +17872,7 @@ function TextDiff({
|
|
|
17840
17872
|
treeNav,
|
|
17841
17873
|
useAnchoredPosition,
|
|
17842
17874
|
useDialog,
|
|
17875
|
+
useReducedMotion,
|
|
17843
17876
|
useTable,
|
|
17844
17877
|
useUixLabels,
|
|
17845
17878
|
useVirtualRows,
|