prime-ui-kit 0.18.0 → 0.19.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/dist/chunks/{chunk-OAXJWF3L.js → chunk-RZNGLELR.js} +120 -114
- package/dist/chunks/{chunk-MB4CXSLL.js → chunk-WYCTXD63.js} +832 -619
- package/dist/chunks/{chunk-X3JT5CLR.js → chunk-ZTZ2ML2B.js} +1 -1
- package/dist/color-picker.js +2 -2
- package/dist/components/data-table/ColumnsMenu.d.ts +16 -20
- package/dist/components/data-table/DataTable.d.ts +14 -11
- package/dist/components/data-table/Head.d.ts +8 -1
- package/dist/components/data-table/Row.d.ts +7 -1
- package/dist/components/data-table/StateRows.d.ts +3 -1
- package/dist/components/field-list/FieldList.d.ts +8 -8
- package/dist/components/index.d.ts +1 -1
- package/dist/components/kanban/Kanban.d.ts +4 -0
- package/dist/components/list/List.d.ts +9 -4
- package/dist/index.css +1 -1
- package/dist/index.js +2 -2
- package/dist/internal/fieldCell.d.ts +6 -0
- package/dist/internal/leaveGuard.d.ts +6 -0
- package/dist/internal/overlay/DialogGuard.d.ts +3 -2
- package/dist/internal/overlay/DialogParts.d.ts +14 -5
- package/dist/layout/index.d.ts +1 -1
- package/dist/layout/page/Page.d.ts +1 -7
- package/dist/skill/anti-slop.md +23 -0
- package/dist/skill/api-contract.md +1 -1
- package/dist/skill/cheatsheet.md +7 -3
- package/dist/skill/checklist.md +4 -0
- package/dist/skill/composition.md +70 -12
- package/dist/skill/layouts.md +1 -1
- package/dist/skill/reference/components/confirm-dialog/COMPONENT.md +1 -1
- package/dist/skill/reference/components/data-table/COMPONENT.md +40 -40
- package/dist/skill/reference/components/data-table/examples/actions-column.tsx +154 -0
- package/dist/skill/reference/components/data-table/examples/columns-visibility.tsx +3 -12
- package/dist/skill/reference/components/data-table/examples/controlled.tsx +1 -1
- package/dist/skill/reference/components/data-table/examples/narrow.tsx +4 -11
- package/dist/skill/reference/components/data-table/examples/row-link.tsx +18 -22
- package/dist/skill/reference/components/data-table/examples/screen.tsx +12 -1
- package/dist/skill/reference/components/data-table/examples/toolbar.tsx +26 -32
- package/dist/skill/reference/components/dnd/COMPONENT.md +4 -3
- package/dist/skill/reference/components/dnd/examples/examples.module.css +4 -3
- package/dist/skill/reference/components/dnd/examples/handle.tsx +5 -5
- package/dist/skill/reference/components/dnd/examples/locked.tsx +1 -1
- package/dist/skill/reference/components/dnd/examples/table.tsx +6 -6
- package/dist/skill/reference/components/drawer/COMPONENT.md +26 -10
- package/dist/skill/reference/components/drawer/examples/header-actions.tsx +1 -1
- package/dist/skill/reference/components/drawer/examples/loading.tsx +58 -0
- package/dist/skill/reference/components/field-list/COMPONENT.md +29 -25
- package/dist/skill/reference/components/field-list/examples/base-row.tsx +2 -1
- package/dist/skill/reference/components/field-list/examples/locked.tsx +11 -11
- package/dist/skill/reference/components/field-list/examples/reorder.tsx +1 -1
- package/dist/skill/reference/components/field-list/examples/screen.module.css +1 -1
- package/dist/skill/reference/components/field-list/examples/screen.tsx +168 -162
- package/dist/skill/reference/components/field-list/examples/totals.tsx +9 -8
- package/dist/skill/reference/components/kanban/COMPONENT.md +6 -2
- package/dist/skill/reference/components/kanban/examples/states.tsx +7 -5
- package/dist/skill/reference/components/list/COMPONENT.md +21 -11
- package/dist/skill/reference/components/list/examples/reorder.tsx +42 -7
- package/dist/skill/reference/components/modal/COMPONENT.md +23 -10
- package/dist/skill/reference/components/segmented-control/COMPONENT.md +3 -2
- package/dist/skill/reference/components/sheet/COMPONENT.md +18 -7
- package/dist/skill/reference/layout/page/COMPONENT.md +5 -12
- package/dist/skill/reference/layout/page/examples/screen.module.css +1 -1
- package/dist/skill/reference/layout/page/examples/screen.tsx +93 -104
- package/dist/skill/reference/layout/page/examples/sections.tsx +2 -15
- package/dist/skill/responsive.md +7 -5
- package/dist/tokens/semantic.d.ts +1 -1
- package/dist/tokens/themes/dark.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/confirm-dialog/COMPONENT.md +1 -1
- package/src/components/data-table/COMPONENT.md +40 -40
- package/src/components/data-table/examples/actions-column.tsx +154 -0
- package/src/components/data-table/examples/columns-visibility.tsx +3 -12
- package/src/components/data-table/examples/controlled.tsx +1 -1
- package/src/components/data-table/examples/narrow.tsx +4 -11
- package/src/components/data-table/examples/row-link.tsx +18 -22
- package/src/components/data-table/examples/screen.tsx +12 -1
- package/src/components/data-table/examples/toolbar.tsx +26 -32
- package/src/components/dnd/COMPONENT.md +4 -3
- package/src/components/dnd/examples/examples.module.css +4 -3
- package/src/components/dnd/examples/handle.tsx +5 -5
- package/src/components/dnd/examples/locked.tsx +1 -1
- package/src/components/dnd/examples/table.tsx +6 -6
- package/src/components/drawer/COMPONENT.md +26 -10
- package/src/components/drawer/examples/header-actions.tsx +1 -1
- package/src/components/drawer/examples/loading.tsx +58 -0
- package/src/components/field-list/COMPONENT.md +29 -25
- package/src/components/field-list/examples/base-row.tsx +2 -1
- package/src/components/field-list/examples/locked.tsx +11 -11
- package/src/components/field-list/examples/reorder.tsx +1 -1
- package/src/components/field-list/examples/screen.module.css +1 -1
- package/src/components/field-list/examples/screen.tsx +168 -162
- package/src/components/field-list/examples/totals.tsx +9 -8
- package/src/components/kanban/COMPONENT.md +6 -2
- package/src/components/kanban/examples/states.tsx +7 -5
- package/src/components/list/COMPONENT.md +21 -11
- package/src/components/list/examples/reorder.tsx +42 -7
- package/src/components/modal/COMPONENT.md +23 -10
- package/src/components/segmented-control/COMPONENT.md +3 -2
- package/src/components/sheet/COMPONENT.md +18 -7
- package/src/layout/page/COMPONENT.md +5 -12
- package/src/layout/page/examples/screen.module.css +1 -1
- package/src/layout/page/examples/screen.tsx +93 -104
- package/src/layout/page/examples/sections.tsx +2 -15
- package/src/styles/theme-dark.css +1 -1
- package/src/styles/theme-light.css +1 -1
- package/dist/components/data-table/context.d.ts +0 -14
|
@@ -180,7 +180,7 @@ import {
|
|
|
180
180
|
useTextParts,
|
|
181
181
|
visuallyHiddenClass,
|
|
182
182
|
zonedParts
|
|
183
|
-
} from "./chunk-
|
|
183
|
+
} from "./chunk-RZNGLELR.js";
|
|
184
184
|
import {
|
|
185
185
|
COMPACT_QUERY,
|
|
186
186
|
ControlSizeProvider,
|
|
@@ -367,16 +367,23 @@ function useLeaveGuard({ busy, dirty }, ask) {
|
|
|
367
367
|
entry.dirty = dirty;
|
|
368
368
|
entry.released = false;
|
|
369
369
|
}, [entry, busy, dirty]);
|
|
370
|
+
useUnloadGuard(busy || dirty, () => entry.released);
|
|
371
|
+
}
|
|
372
|
+
function useUnloadGuard(hold, released) {
|
|
373
|
+
const releasedRef = React2.useRef(released);
|
|
374
|
+
React2.useLayoutEffect(() => {
|
|
375
|
+
releasedRef.current = released;
|
|
376
|
+
});
|
|
370
377
|
React2.useEffect(() => {
|
|
371
|
-
if (!
|
|
378
|
+
if (!hold) return;
|
|
372
379
|
const onBeforeUnload = (event) => {
|
|
373
|
-
if (
|
|
380
|
+
if (releasedRef.current?.()) return;
|
|
374
381
|
event.preventDefault();
|
|
375
382
|
event.returnValue = true;
|
|
376
383
|
};
|
|
377
384
|
window.addEventListener("beforeunload", onBeforeUnload);
|
|
378
385
|
return () => window.removeEventListener("beforeunload", onBeforeUnload);
|
|
379
|
-
}, [
|
|
386
|
+
}, [hold]);
|
|
380
387
|
}
|
|
381
388
|
|
|
382
389
|
// src/internal/SwitcherScroller.module.css
|
|
@@ -1439,11 +1446,12 @@ var DialogParts_default = {
|
|
|
1439
1446
|
shell: "DialogParts_shell",
|
|
1440
1447
|
"prime-dialog": "DialogParts_prime-dialog",
|
|
1441
1448
|
header: "DialogParts_header",
|
|
1442
|
-
icon: "DialogParts_icon",
|
|
1443
1449
|
actions: "DialogParts_actions",
|
|
1450
|
+
icon: "DialogParts_icon",
|
|
1444
1451
|
close: "DialogParts_close",
|
|
1445
1452
|
title: "DialogParts_title",
|
|
1446
1453
|
description: "DialogParts_description",
|
|
1454
|
+
descriptionSkeleton: "DialogParts_descriptionSkeleton",
|
|
1447
1455
|
body: "DialogParts_body",
|
|
1448
1456
|
section: "DialogParts_section",
|
|
1449
1457
|
sectionHeader: "DialogParts_sectionHeader",
|
|
@@ -1457,6 +1465,7 @@ var DialogParts_default = {
|
|
|
1457
1465
|
|
|
1458
1466
|
// src/internal/overlay/DialogParts.tsx
|
|
1459
1467
|
import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1468
|
+
import { createElement } from "react";
|
|
1460
1469
|
var DIALOG_LABELS = {
|
|
1461
1470
|
close: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C",
|
|
1462
1471
|
discardTitle: "\u041D\u0435 \u0441\u043E\u0445\u0440\u0430\u043D\u044F\u0442\u044C \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F?",
|
|
@@ -1725,25 +1734,55 @@ function DialogTitle({ className, ...rest }) {
|
|
|
1725
1734
|
return /* @__PURE__ */ jsx9("h2", { id: titleId, className: cx(textRole_default.titleM, DialogParts_default.title, className), ...rest });
|
|
1726
1735
|
}
|
|
1727
1736
|
DialogTitle.displayName = "Dialog.Title";
|
|
1728
|
-
function DialogDescription({
|
|
1737
|
+
function DialogDescription({
|
|
1738
|
+
loading = false,
|
|
1739
|
+
className,
|
|
1740
|
+
children,
|
|
1741
|
+
...rest
|
|
1742
|
+
}) {
|
|
1729
1743
|
const { descriptionId, registerDescription } = useDialogShell("Description");
|
|
1744
|
+
const swap = useSwapIn(loading ? "loading" : "data");
|
|
1730
1745
|
React9.useLayoutEffect(() => {
|
|
1731
1746
|
registerDescription(true);
|
|
1732
1747
|
return () => registerDescription(false);
|
|
1733
1748
|
}, [registerDescription]);
|
|
1734
|
-
return /* @__PURE__ */
|
|
1749
|
+
return /* @__PURE__ */ createElement(
|
|
1750
|
+
"p",
|
|
1751
|
+
{
|
|
1752
|
+
...rest,
|
|
1753
|
+
key: swap.key,
|
|
1754
|
+
id: descriptionId,
|
|
1755
|
+
"aria-busy": loading || void 0,
|
|
1756
|
+
className: cx(textRole_default.bodyS, DialogParts_default.description, swap.className, className)
|
|
1757
|
+
},
|
|
1758
|
+
loading ? /* @__PURE__ */ jsx9(Skeleton, { size: "xs", className: DialogParts_default.descriptionSkeleton }) : children
|
|
1759
|
+
);
|
|
1735
1760
|
}
|
|
1736
1761
|
DialogDescription.displayName = "Dialog.Description";
|
|
1762
|
+
function placeHeaderActions(header) {
|
|
1763
|
+
header.removeAttribute("data-actions-below");
|
|
1764
|
+
if (!header.querySelector(`:scope > .${DialogParts_default.actions}`)) return;
|
|
1765
|
+
if (header.scrollWidth > header.clientWidth + 1) header.setAttribute("data-actions-below", "");
|
|
1766
|
+
}
|
|
1737
1767
|
function DialogHeader({
|
|
1738
1768
|
showClose = true,
|
|
1739
1769
|
className,
|
|
1740
1770
|
children,
|
|
1771
|
+
ref,
|
|
1741
1772
|
...rest
|
|
1742
1773
|
}) {
|
|
1743
1774
|
const { onClose, closeLabel, busy, hasDescription } = useDialogShell("Header");
|
|
1775
|
+
const headerRef = React9.useRef(null);
|
|
1776
|
+
const mergedRef = useMergedRefs(headerRef, ref);
|
|
1777
|
+
const place = React9.useCallback(() => {
|
|
1778
|
+
if (headerRef.current) placeHeaderActions(headerRef.current);
|
|
1779
|
+
}, []);
|
|
1780
|
+
React9.useLayoutEffect(place);
|
|
1781
|
+
useResizeEffect(headerRef, place, { children: true });
|
|
1744
1782
|
return /* @__PURE__ */ jsxs6(
|
|
1745
1783
|
"header",
|
|
1746
1784
|
{
|
|
1785
|
+
ref: mergedRef,
|
|
1747
1786
|
className: cx(hairline_default.bottom, DialogParts_default.header, className),
|
|
1748
1787
|
"data-has-description": hasDescription ? "true" : void 0,
|
|
1749
1788
|
...rest,
|
|
@@ -1777,26 +1816,47 @@ function DialogBody({ className, ...rest }) {
|
|
|
1777
1816
|
return /* @__PURE__ */ jsx9(ScrollContainer, { className: cx(DialogParts_default.body, className), ...rest });
|
|
1778
1817
|
}
|
|
1779
1818
|
DialogBody.displayName = "Dialog.Body";
|
|
1819
|
+
function flowOf(parent) {
|
|
1820
|
+
const { display, rowGap } = getComputedStyle(parent);
|
|
1821
|
+
const gapped = /flex|grid/.test(display) && Number.parseFloat(rowGap) > 0;
|
|
1822
|
+
return gapped ? "gap" : "block";
|
|
1823
|
+
}
|
|
1780
1824
|
function DialogSection({
|
|
1781
1825
|
label,
|
|
1782
1826
|
description,
|
|
1783
1827
|
className,
|
|
1784
1828
|
children,
|
|
1829
|
+
ref,
|
|
1785
1830
|
...rest
|
|
1786
1831
|
}) {
|
|
1787
1832
|
useDialogShell("Section");
|
|
1788
1833
|
const headingId = React9.useId();
|
|
1834
|
+
const sectionRef = React9.useRef(null);
|
|
1835
|
+
const mergedRef = useMergedRefs(sectionRef, ref);
|
|
1836
|
+
React9.useLayoutEffect(() => {
|
|
1837
|
+
const section = sectionRef.current;
|
|
1838
|
+
if (section?.parentElement) section.dataset.flow = flowOf(section.parentElement);
|
|
1839
|
+
});
|
|
1789
1840
|
const { parts: actions, rest: content } = splitParts(children, DialogActions);
|
|
1790
|
-
return /* @__PURE__ */ jsxs6(
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1841
|
+
return /* @__PURE__ */ jsxs6(
|
|
1842
|
+
"section",
|
|
1843
|
+
{
|
|
1844
|
+
"aria-labelledby": headingId,
|
|
1845
|
+
...rest,
|
|
1846
|
+
ref: mergedRef,
|
|
1847
|
+
className: cx(DialogParts_default.section, className),
|
|
1848
|
+
children: [
|
|
1849
|
+
/* @__PURE__ */ jsxs6("div", { className: DialogParts_default.sectionHeader, children: [
|
|
1850
|
+
/* @__PURE__ */ jsxs6("div", { className: DialogParts_default.sectionHeading, children: [
|
|
1851
|
+
/* @__PURE__ */ jsx9("h3", { id: headingId, className: cx(textRole_default.titleS, DialogParts_default.sectionTitle), children: label }),
|
|
1852
|
+
description ? /* @__PURE__ */ jsx9("p", { className: cx(textRole_default.bodyS, DialogParts_default.sectionDescription), children: description }) : null
|
|
1853
|
+
] }),
|
|
1854
|
+
actions
|
|
1855
|
+
] }),
|
|
1856
|
+
content
|
|
1857
|
+
]
|
|
1858
|
+
}
|
|
1859
|
+
);
|
|
1800
1860
|
}
|
|
1801
1861
|
DialogSection.displayName = "Dialog.Section";
|
|
1802
1862
|
function DialogFooter({ layout, className, children, ...rest }) {
|
|
@@ -3002,11 +3062,14 @@ function syncThumbColor(thumb, active) {
|
|
|
3002
3062
|
else delete thumb.dataset.color;
|
|
3003
3063
|
}
|
|
3004
3064
|
function fitCollapse(viewport2, list) {
|
|
3005
|
-
|
|
3006
|
-
|
|
3065
|
+
const fits = (level2) => {
|
|
3066
|
+
list.dataset.collapse = level2;
|
|
3067
|
+
return list.scrollWidth <= viewport2.clientWidth + 0.5;
|
|
3068
|
+
};
|
|
3069
|
+
if (fits("full") || fits("compact")) return list.dataset.collapse;
|
|
3007
3070
|
const items = list.querySelectorAll('[role="radio"]');
|
|
3008
3071
|
const icons = list.querySelectorAll(`[role="radio"] > .${SegmentedControl_default.icon}`);
|
|
3009
|
-
const level =
|
|
3072
|
+
const level = items.length > 0 && icons.length === items.length ? "icon" : "compact";
|
|
3010
3073
|
list.dataset.collapse = level;
|
|
3011
3074
|
return level;
|
|
3012
3075
|
}
|
|
@@ -4118,7 +4181,7 @@ var Page_default = {
|
|
|
4118
4181
|
|
|
4119
4182
|
// src/layout/page/Page.tsx
|
|
4120
4183
|
import { Fragment as Fragment10, jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4121
|
-
import { createElement } from "react";
|
|
4184
|
+
import { createElement as createElement2 } from "react";
|
|
4122
4185
|
var PAGE_LABELS = {
|
|
4123
4186
|
menu: "\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u043C\u0435\u043D\u044E",
|
|
4124
4187
|
more: "\u0415\u0449\u0451 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F",
|
|
@@ -4499,7 +4562,7 @@ function PageDescription({ loading = false, className, children, ...rest }) {
|
|
|
4499
4562
|
store?.set({ description: loading ? null : children });
|
|
4500
4563
|
});
|
|
4501
4564
|
React15.useLayoutEffect(() => () => store?.set({ description: null }), [store]);
|
|
4502
|
-
return /* @__PURE__ */
|
|
4565
|
+
return /* @__PURE__ */ createElement2(
|
|
4503
4566
|
"p",
|
|
4504
4567
|
{
|
|
4505
4568
|
...rest,
|
|
@@ -4670,42 +4733,26 @@ function PageBody({ className, ...rest }) {
|
|
|
4670
4733
|
return /* @__PURE__ */ jsx18("div", { ...rest, className: cx(Page_default.body, className) });
|
|
4671
4734
|
}
|
|
4672
4735
|
PageBody.displayName = "Page.Body";
|
|
4673
|
-
function PageSection({
|
|
4674
|
-
label,
|
|
4675
|
-
description,
|
|
4676
|
-
layout = "stack",
|
|
4677
|
-
className,
|
|
4678
|
-
children,
|
|
4679
|
-
...rest
|
|
4680
|
-
}) {
|
|
4736
|
+
function PageSection({ label, description, className, children, ...rest }) {
|
|
4681
4737
|
const headingId = React15.useId();
|
|
4682
4738
|
const { parts: actions, rest: content } = splitParts(children, PageActions);
|
|
4683
|
-
return /* @__PURE__ */ jsxs12(
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
] }),
|
|
4701
|
-
actions
|
|
4702
|
-
]
|
|
4703
|
-
}
|
|
4704
|
-
),
|
|
4705
|
-
/* @__PURE__ */ jsx18("div", { className: Page_default.sectionContent, children: content })
|
|
4706
|
-
]
|
|
4707
|
-
}
|
|
4708
|
-
);
|
|
4739
|
+
return /* @__PURE__ */ jsxs12("section", { "aria-labelledby": headingId, ...rest, className: cx(Page_default.section, className), children: [
|
|
4740
|
+
/* @__PURE__ */ jsxs12(
|
|
4741
|
+
"div",
|
|
4742
|
+
{
|
|
4743
|
+
className: Page_default.sectionHeader,
|
|
4744
|
+
"data-has-actions": actions.length > 0 ? "true" : void 0,
|
|
4745
|
+
children: [
|
|
4746
|
+
/* @__PURE__ */ jsxs12("div", { className: Page_default.sectionHeading, children: [
|
|
4747
|
+
/* @__PURE__ */ jsx18("h2", { id: headingId, className: cx(textRole_default.titleM, Page_default.sectionTitle), children: label }),
|
|
4748
|
+
description ? /* @__PURE__ */ jsx18("p", { className: cx(textRole_default.bodyS, Page_default.sectionDescription), children: description }) : null
|
|
4749
|
+
] }),
|
|
4750
|
+
actions
|
|
4751
|
+
]
|
|
4752
|
+
}
|
|
4753
|
+
),
|
|
4754
|
+
/* @__PURE__ */ jsx18("div", { className: Page_default.sectionContent, children: content })
|
|
4755
|
+
] });
|
|
4709
4756
|
}
|
|
4710
4757
|
PageSection.displayName = "Page.Section";
|
|
4711
4758
|
var pairRole = (node) => {
|
|
@@ -17833,9 +17880,9 @@ function ListItemCount({ color = "gray", className, ...rest }) {
|
|
|
17833
17880
|
return /* @__PURE__ */ jsx49(Badge.Root, { ...rest, color, className: cx(List_default.count, className) });
|
|
17834
17881
|
}
|
|
17835
17882
|
ListItemCount.displayName = "List.ItemCount";
|
|
17836
|
-
function ListItemActions({ className, ...rest }) {
|
|
17883
|
+
function ListItemActions({ side = "end", className, ...rest }) {
|
|
17837
17884
|
const size = useControlSize(void 0);
|
|
17838
|
-
return /* @__PURE__ */ jsx49(ControlSizeProvider, { value: stepDown(size), children: /* @__PURE__ */ jsx49("div", { ...rest, className: cx(List_default.actions, className) }) });
|
|
17885
|
+
return /* @__PURE__ */ jsx49(ControlSizeProvider, { value: stepDown(size), children: /* @__PURE__ */ jsx49("div", { ...rest, className: cx(List_default.actions, className), "data-side": side }) });
|
|
17839
17886
|
}
|
|
17840
17887
|
ListItemActions.displayName = "List.ItemActions";
|
|
17841
17888
|
function spaced(nodes) {
|
|
@@ -17942,9 +17989,12 @@ function ListItem({
|
|
|
17942
17989
|
element = /* @__PURE__ */ jsx49(InteractiveElement, { ...shared, element: "button", type: type ?? "button", children: splitItemChildren3(content) });
|
|
17943
17990
|
}
|
|
17944
17991
|
if (actions.length > 0) {
|
|
17992
|
+
const leading = actions.filter((part) => part.props.side === "start");
|
|
17993
|
+
const trailing = actions.filter((part) => part.props.side !== "start");
|
|
17945
17994
|
element = /* @__PURE__ */ jsxs37("div", { className: List_default.frame, children: [
|
|
17995
|
+
leading,
|
|
17946
17996
|
element,
|
|
17947
|
-
|
|
17997
|
+
trailing
|
|
17948
17998
|
] });
|
|
17949
17999
|
}
|
|
17950
18000
|
const rowClass = cx(List_default.row, entered && enterMotion_default.enter);
|
|
@@ -17960,8 +18010,8 @@ function ListItem({
|
|
|
17960
18010
|
disabled,
|
|
17961
18011
|
className: cx(rowClass, List_default.sortableRow),
|
|
17962
18012
|
children: [
|
|
17963
|
-
|
|
17964
|
-
|
|
18013
|
+
element,
|
|
18014
|
+
/* @__PURE__ */ jsx49("span", { className: cx(fieldTierClass, List_default.grip), "data-size": "xs", children: /* @__PURE__ */ jsx49(Dnd.Handle, { "aria-label": label.trim(), disabled }) })
|
|
17965
18015
|
]
|
|
17966
18016
|
}
|
|
17967
18017
|
);
|
|
@@ -19108,6 +19158,7 @@ function DialogGuard({ busy = false, dirty = false }) {
|
|
|
19108
19158
|
busy,
|
|
19109
19159
|
dirty
|
|
19110
19160
|
});
|
|
19161
|
+
useUnloadGuard(busy || dirty);
|
|
19111
19162
|
return /* @__PURE__ */ jsx53(
|
|
19112
19163
|
ConfirmDialog.Root,
|
|
19113
19164
|
{
|
|
@@ -21113,7 +21164,8 @@ function TextareaRoot({
|
|
|
21113
21164
|
);
|
|
21114
21165
|
const hasCommit = onCommit !== void 0;
|
|
21115
21166
|
const commit = useFieldCommit(innerRef, onCommit);
|
|
21116
|
-
const
|
|
21167
|
+
const cellAction = useFieldCell()?.action;
|
|
21168
|
+
const hasEdge = hasCommit || React64.Children.count(children) > 0 || Boolean(cellAction);
|
|
21117
21169
|
const format5 = useTextFormatting({
|
|
21118
21170
|
textareaRef: innerRef,
|
|
21119
21171
|
enabled: formatting,
|
|
@@ -21221,7 +21273,8 @@ function TextareaRoot({
|
|
|
21221
21273
|
/* @__PURE__ */ jsx58("div", { className: Textarea_default.body, children: body }),
|
|
21222
21274
|
/* @__PURE__ */ jsxs44("div", { className: Textarea_default.edge, children: [
|
|
21223
21275
|
hasCommit ? /* @__PURE__ */ jsx58(FieldCommitStatus, { state: commit.state, labels }) : null,
|
|
21224
|
-
children
|
|
21276
|
+
children,
|
|
21277
|
+
cellAction
|
|
21225
21278
|
] })
|
|
21226
21279
|
] }) : body
|
|
21227
21280
|
}
|
|
@@ -22616,39 +22669,26 @@ var Composer = {
|
|
|
22616
22669
|
};
|
|
22617
22670
|
|
|
22618
22671
|
// src/components/data-table/DataTable.tsx
|
|
22619
|
-
import * as
|
|
22620
|
-
|
|
22621
|
-
// src/components/data-table/ColumnsMenu.tsx
|
|
22622
|
-
import * as React68 from "react";
|
|
22623
|
-
|
|
22624
|
-
// src/components/data-table/context.ts
|
|
22625
|
-
import * as React67 from "react";
|
|
22626
|
-
var DataTableColumnsContext = React67.createContext(
|
|
22627
|
-
null
|
|
22628
|
-
);
|
|
22672
|
+
import * as React74 from "react";
|
|
22629
22673
|
|
|
22630
22674
|
// src/components/data-table/ColumnsMenu.tsx
|
|
22631
22675
|
import { jsx as jsx60, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
22632
|
-
function
|
|
22633
|
-
const context = React68.useContext(DataTableColumnsContext);
|
|
22634
|
-
if (context === null) {
|
|
22635
|
-
throw new Error("DataTable.ColumnsMenu must be rendered inside the DataTable toolbar");
|
|
22636
|
-
}
|
|
22637
|
-
const { columns, hidden, setHidden, labels, size } = context;
|
|
22676
|
+
function ColumnsMenu({ columns, hidden, setHidden, labels, size }) {
|
|
22638
22677
|
const isShown = (column) => column.hideable === false || !hidden.has(column.id);
|
|
22639
22678
|
const shown = columns.filter(isShown).length;
|
|
22640
22679
|
const hiddenIds = columns.filter((column) => !isShown(column)).map((column) => column.id);
|
|
22641
22680
|
const tier = stepDown(size);
|
|
22681
|
+
const name = formatLabel(labels.columns, { shown, total: columns.length });
|
|
22642
22682
|
const setShown = (id, visible) => {
|
|
22643
22683
|
const next = [...hidden].filter((item) => item !== id);
|
|
22644
22684
|
setHidden(visible ? next : [...next, id]);
|
|
22645
22685
|
};
|
|
22646
22686
|
return /* @__PURE__ */ jsxs46(Dropdown.Root, { children: [
|
|
22647
|
-
/* @__PURE__ */
|
|
22648
|
-
/* @__PURE__ */ jsx60(Button.Icon, { children: /* @__PURE__ */ jsx60(Icon, { name: "view.columns" }) }),
|
|
22649
|
-
|
|
22650
|
-
] })
|
|
22651
|
-
/* @__PURE__ */ jsxs46(Dropdown.Content, { side, align, size: tier, children: [
|
|
22687
|
+
/* @__PURE__ */ jsxs46(Tooltip.Root, { children: [
|
|
22688
|
+
/* @__PURE__ */ jsx60(Tooltip.Trigger, { children: /* @__PURE__ */ jsx60(Dropdown.Trigger, { children: /* @__PURE__ */ jsx60(Button.Root, { variant: "ghost", tone: "neutral", size: tier, "aria-label": name, children: /* @__PURE__ */ jsx60(Button.Icon, { children: /* @__PURE__ */ jsx60(Icon, { name: "view.columns" }) }) }) }) }),
|
|
22689
|
+
/* @__PURE__ */ jsx60(Tooltip.Content, { children: name })
|
|
22690
|
+
] }),
|
|
22691
|
+
/* @__PURE__ */ jsxs46(Dropdown.Content, { side: "bottom", align: "end", size: tier, children: [
|
|
22652
22692
|
columns.map((column) => {
|
|
22653
22693
|
const visible = isShown(column);
|
|
22654
22694
|
return /* @__PURE__ */ jsx60(
|
|
@@ -22667,7 +22707,6 @@ function DataTableColumnsMenu({ side, align, ...rest }) {
|
|
|
22667
22707
|
] })
|
|
22668
22708
|
] });
|
|
22669
22709
|
}
|
|
22670
|
-
DataTableColumnsMenu.displayName = "DataTable.ColumnsMenu";
|
|
22671
22710
|
|
|
22672
22711
|
// src/components/data-table/DataTable.module.css
|
|
22673
22712
|
var DataTable_default = {
|
|
@@ -22697,6 +22736,8 @@ var DataTable_default = {
|
|
|
22697
22736
|
detailContent: "DataTable_detailContent",
|
|
22698
22737
|
detailRow: "DataTable_detailRow",
|
|
22699
22738
|
firstColumnSticky: "DataTable_firstColumnSticky",
|
|
22739
|
+
lastColumnSticky: "DataTable_lastColumnSticky",
|
|
22740
|
+
menuCellSticky: "DataTable_menuCellSticky",
|
|
22700
22741
|
stickyLead: "DataTable_stickyLead",
|
|
22701
22742
|
rowLink: "DataTable_rowLink",
|
|
22702
22743
|
cellLink: "DataTable_cellLink",
|
|
@@ -22704,6 +22745,8 @@ var DataTable_default = {
|
|
|
22704
22745
|
groupRow: "DataTable_groupRow",
|
|
22705
22746
|
groupContent: "DataTable_groupContent",
|
|
22706
22747
|
groupLabel: "DataTable_groupLabel",
|
|
22748
|
+
headMenu: "DataTable_headMenu",
|
|
22749
|
+
menuCell: "DataTable_menuCell",
|
|
22707
22750
|
cornerCellSticky: "DataTable_cornerCellSticky",
|
|
22708
22751
|
skeletonRow: "DataTable_skeletonRow",
|
|
22709
22752
|
skeleton: "DataTable_skeleton",
|
|
@@ -22858,10 +22901,10 @@ function Footer({ range, pagination, status }) {
|
|
|
22858
22901
|
}
|
|
22859
22902
|
|
|
22860
22903
|
// src/components/data-table/Head.tsx
|
|
22861
|
-
import * as
|
|
22904
|
+
import * as React69 from "react";
|
|
22862
22905
|
|
|
22863
22906
|
// src/components/data-table/Row.tsx
|
|
22864
|
-
import * as
|
|
22907
|
+
import * as React68 from "react";
|
|
22865
22908
|
|
|
22866
22909
|
// src/internal/rowLink.ts
|
|
22867
22910
|
var ROW_CONTROLS = [
|
|
@@ -22914,19 +22957,19 @@ var rowLink_default = {
|
|
|
22914
22957
|
};
|
|
22915
22958
|
|
|
22916
22959
|
// src/components/data-table/reorder.tsx
|
|
22917
|
-
import * as
|
|
22960
|
+
import * as React67 from "react";
|
|
22918
22961
|
import { jsx as jsx63, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
22919
22962
|
function useRowReorder(options) {
|
|
22920
22963
|
const { onReorder, expandEnabled, sorted, rows: rows2, orderedRows, offset, getRowKey, getRowGroup } = options;
|
|
22921
22964
|
const enabled = onReorder !== void 0 && !expandEnabled;
|
|
22922
|
-
const movedFrom =
|
|
22923
|
-
const keyOf2 =
|
|
22965
|
+
const movedFrom = React67.useRef(null);
|
|
22966
|
+
const keyOf2 = React67.useCallback(
|
|
22924
22967
|
(row, index) => getRowKey ? getRowKey(row, index) : index,
|
|
22925
22968
|
[getRowKey]
|
|
22926
22969
|
);
|
|
22927
|
-
const latest =
|
|
22970
|
+
const latest = React67.useRef({ onReorder, rows: rows2, orderedRows, offset, getRowGroup, keyOf: keyOf2 });
|
|
22928
22971
|
latest.current = { onReorder, rows: rows2, orderedRows, offset, getRowGroup, keyOf: keyOf2 };
|
|
22929
|
-
const reorderIn =
|
|
22972
|
+
const reorderIn = React67.useCallback((entries) => {
|
|
22930
22973
|
const keys = new Map(entries.map((entry) => [String(entry.item.key), entry.item.key]));
|
|
22931
22974
|
return (id, beforeId) => {
|
|
22932
22975
|
const current = latest.current;
|
|
@@ -22953,7 +22996,7 @@ function useRowReorder(options) {
|
|
|
22953
22996
|
return outcome;
|
|
22954
22997
|
};
|
|
22955
22998
|
}, []);
|
|
22956
|
-
const isOwnMove =
|
|
22999
|
+
const isOwnMove = React67.useCallback(
|
|
22957
23000
|
(previousRows, previous, next) => {
|
|
22958
23001
|
if (movedFrom.current !== previousRows || previous.length !== next.length) return false;
|
|
22959
23002
|
const set = new Set(previous);
|
|
@@ -22961,7 +23004,7 @@ function useRowReorder(options) {
|
|
|
22961
23004
|
},
|
|
22962
23005
|
[]
|
|
22963
23006
|
);
|
|
22964
|
-
const shared =
|
|
23007
|
+
const shared = React67.useMemo(
|
|
22965
23008
|
() => enabled ? {
|
|
22966
23009
|
locked: sorted,
|
|
22967
23010
|
handleLabel: options.handleLabel,
|
|
@@ -22982,7 +23025,7 @@ function ReorderBody({
|
|
|
22982
23025
|
header,
|
|
22983
23026
|
className
|
|
22984
23027
|
}) {
|
|
22985
|
-
const getLabel =
|
|
23028
|
+
const getLabel = React67.useCallback(
|
|
22986
23029
|
(entry) => getRowLabel?.(entry.item.row) ?? String(entry.item.key),
|
|
22987
23030
|
[getRowLabel]
|
|
22988
23031
|
);
|
|
@@ -23320,12 +23363,14 @@ function DataTableRowImpl({
|
|
|
23320
23363
|
) }) : null,
|
|
23321
23364
|
columns.map((column, columnIndex) => {
|
|
23322
23365
|
const isFirstColumn = columnIndex === 0;
|
|
23366
|
+
const isLastColumn = columnIndex === columns.length - 1;
|
|
23323
23367
|
return /* @__PURE__ */ jsx64(
|
|
23324
23368
|
"td",
|
|
23325
23369
|
{
|
|
23326
23370
|
className: cx(
|
|
23327
23371
|
DataTable_default.cell,
|
|
23328
23372
|
shared.stickyFirstColumn && isFirstColumn && DataTable_default.firstColumnSticky,
|
|
23373
|
+
shared.stickyLastColumn && isLastColumn && DataTable_default.lastColumnSticky,
|
|
23329
23374
|
enter
|
|
23330
23375
|
),
|
|
23331
23376
|
style: columnSizeStyle(column),
|
|
@@ -23355,7 +23400,31 @@ function DataTableRowImpl({
|
|
|
23355
23400
|
},
|
|
23356
23401
|
column.id
|
|
23357
23402
|
);
|
|
23358
|
-
})
|
|
23403
|
+
}),
|
|
23404
|
+
shared.menuCell ? /* @__PURE__ */ jsx64(
|
|
23405
|
+
"td",
|
|
23406
|
+
{
|
|
23407
|
+
className: cx(
|
|
23408
|
+
DataTable_default.cell,
|
|
23409
|
+
DataTable_default.menuCell,
|
|
23410
|
+
shared.stickyLastColumn && DataTable_default.menuCellSticky,
|
|
23411
|
+
enter
|
|
23412
|
+
),
|
|
23413
|
+
children: href === void 0 ? null : (
|
|
23414
|
+
// biome-ignore lint/a11y/useAnchorContent: a pointer-only duplicate of the key cell's named link, hidden from AT and Tab
|
|
23415
|
+
/* @__PURE__ */ jsx64(
|
|
23416
|
+
"a",
|
|
23417
|
+
{
|
|
23418
|
+
href,
|
|
23419
|
+
tabIndex: -1,
|
|
23420
|
+
"aria-hidden": "true",
|
|
23421
|
+
className: DataTable_default.cellLink,
|
|
23422
|
+
"data-row-link": ""
|
|
23423
|
+
}
|
|
23424
|
+
)
|
|
23425
|
+
)
|
|
23426
|
+
}
|
|
23427
|
+
) : null
|
|
23359
23428
|
]
|
|
23360
23429
|
}
|
|
23361
23430
|
),
|
|
@@ -23379,7 +23448,7 @@ function DataTableRowImpl({
|
|
|
23379
23448
|
) : null
|
|
23380
23449
|
] });
|
|
23381
23450
|
}
|
|
23382
|
-
var DataTableRow =
|
|
23451
|
+
var DataTableRow = React68.memo(DataTableRowImpl);
|
|
23383
23452
|
function GroupRow({ totalColumns, sticky, size, toggle, children }) {
|
|
23384
23453
|
return /* @__PURE__ */ jsx64("tr", { className: DataTable_default.groupRow, "data-collapsed": toggle?.collapsed ? "true" : void 0, children: /* @__PURE__ */ jsx64(
|
|
23385
23454
|
"th",
|
|
@@ -23412,7 +23481,8 @@ function MeasureBody({
|
|
|
23412
23481
|
columns,
|
|
23413
23482
|
selectable,
|
|
23414
23483
|
expandEnabled,
|
|
23415
|
-
reorderable
|
|
23484
|
+
reorderable,
|
|
23485
|
+
menuCell
|
|
23416
23486
|
}) {
|
|
23417
23487
|
return /* @__PURE__ */ jsx64("tbody", { className: DataTable_default.measureBody, "aria-hidden": "true", inert: true, children: rows2.map(({ row, key, depth }) => /* @__PURE__ */ jsxs50(
|
|
23418
23488
|
"tr",
|
|
@@ -23435,7 +23505,8 @@ function MeasureBody({
|
|
|
23435
23505
|
children: renderCell(row, column, false)
|
|
23436
23506
|
},
|
|
23437
23507
|
column.id
|
|
23438
|
-
))
|
|
23508
|
+
)),
|
|
23509
|
+
menuCell ? /* @__PURE__ */ jsx64("td", { className: cx(DataTable_default.cell, DataTable_default.menuCell) }) : null
|
|
23439
23510
|
]
|
|
23440
23511
|
},
|
|
23441
23512
|
String(key)
|
|
@@ -23443,7 +23514,7 @@ function MeasureBody({
|
|
|
23443
23514
|
}
|
|
23444
23515
|
|
|
23445
23516
|
// src/components/data-table/Head.tsx
|
|
23446
|
-
import { jsx as jsx65, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
23517
|
+
import { Fragment as Fragment33, jsx as jsx65, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
23447
23518
|
var ARIA_SORT = { asc: "ascending", desc: "descending" };
|
|
23448
23519
|
var SORT_ICON = { asc: "sort.ascending", desc: "sort.descending" };
|
|
23449
23520
|
function Head({
|
|
@@ -23452,14 +23523,17 @@ function Head({
|
|
|
23452
23523
|
sort,
|
|
23453
23524
|
onSort,
|
|
23454
23525
|
stickyFirstColumn,
|
|
23526
|
+
stickyLastColumn,
|
|
23455
23527
|
stickyHeader,
|
|
23456
23528
|
stickyCorner,
|
|
23457
23529
|
expandEnabled,
|
|
23458
23530
|
infoLabel,
|
|
23459
23531
|
reorderable = false,
|
|
23532
|
+
columnsMenu,
|
|
23533
|
+
menuCell,
|
|
23460
23534
|
selectAll
|
|
23461
23535
|
}) {
|
|
23462
|
-
const idPrefix =
|
|
23536
|
+
const idPrefix = React69.useId();
|
|
23463
23537
|
const lead = cx(
|
|
23464
23538
|
DataTable_default.headCell,
|
|
23465
23539
|
stickyHeader && stickySurfaceClass,
|
|
@@ -23483,9 +23557,11 @@ function Head({
|
|
|
23483
23557
|
columns.map((column, columnIndex) => {
|
|
23484
23558
|
const order = column.sortable && sort?.columnId === column.id ? sort.order : null;
|
|
23485
23559
|
const isFirstColumn = columnIndex === 0;
|
|
23560
|
+
const isLastColumn = columnIndex === columns.length - 1;
|
|
23486
23561
|
const described = column.description !== void 0 && !column.hideHeader;
|
|
23487
23562
|
const descriptionId = `${idPrefix}-${columnIndex}-description`;
|
|
23488
|
-
const
|
|
23563
|
+
const menuHere = columnsMenu != null && !menuCell && isLastColumn && column.hideHeader === true;
|
|
23564
|
+
const labelId = described && !column.sortable || menuHere ? `${idPrefix}-${columnIndex}-label` : void 0;
|
|
23489
23565
|
const info = described ? /* @__PURE__ */ jsx65(
|
|
23490
23566
|
Icon,
|
|
23491
23567
|
{
|
|
@@ -23502,7 +23578,9 @@ function Head({
|
|
|
23502
23578
|
DataTable_default.headCell,
|
|
23503
23579
|
stickyHeader && stickySurfaceClass,
|
|
23504
23580
|
stickyFirstColumn && isFirstColumn && DataTable_default.firstColumnSticky,
|
|
23505
|
-
stickyCorner && isFirstColumn && DataTable_default.cornerCellSticky
|
|
23581
|
+
stickyCorner && isFirstColumn && DataTable_default.cornerCellSticky,
|
|
23582
|
+
stickyLastColumn && isLastColumn && DataTable_default.lastColumnSticky,
|
|
23583
|
+
stickyHeader && stickyLastColumn && isLastColumn && DataTable_default.cornerCellSticky
|
|
23506
23584
|
),
|
|
23507
23585
|
style: columnSizeStyle(column),
|
|
23508
23586
|
"data-align": column.headerAlign ?? "start",
|
|
@@ -23527,7 +23605,10 @@ function Head({
|
|
|
23527
23605
|
strokeWidth: 2
|
|
23528
23606
|
}
|
|
23529
23607
|
)
|
|
23530
|
-
] }) }) : column.hideHeader ? /* @__PURE__ */
|
|
23608
|
+
] }) }) : column.hideHeader ? /* @__PURE__ */ jsxs51(Fragment33, { children: [
|
|
23609
|
+
/* @__PURE__ */ jsx65(VisuallyHidden, { id: labelId, children: column.header }),
|
|
23610
|
+
menuHere ? /* @__PURE__ */ jsx65("span", { className: DataTable_default.headMenu, children: columnsMenu }) : null
|
|
23611
|
+
] }) : /* @__PURE__ */ jsxs51("span", { className: DataTable_default.headTitle, children: [
|
|
23531
23612
|
/* @__PURE__ */ jsx65("span", { id: labelId, className: DataTable_default.headLabel, children: column.header }),
|
|
23532
23613
|
info ? /* @__PURE__ */ jsx65(WithDescription, { description: column.description, children: info }) : null
|
|
23533
23614
|
] }),
|
|
@@ -23536,7 +23617,20 @@ function Head({
|
|
|
23536
23617
|
},
|
|
23537
23618
|
column.id
|
|
23538
23619
|
);
|
|
23539
|
-
})
|
|
23620
|
+
}),
|
|
23621
|
+
menuCell && columnsMenu != null ? /* @__PURE__ */ jsx65(
|
|
23622
|
+
"td",
|
|
23623
|
+
{
|
|
23624
|
+
className: cx(
|
|
23625
|
+
DataTable_default.headCell,
|
|
23626
|
+
DataTable_default.menuCell,
|
|
23627
|
+
stickyHeader && stickySurfaceClass,
|
|
23628
|
+
stickyLastColumn && DataTable_default.menuCellSticky,
|
|
23629
|
+
stickyHeader && stickyLastColumn && DataTable_default.cornerCellSticky
|
|
23630
|
+
),
|
|
23631
|
+
children: /* @__PURE__ */ jsx65("span", { className: DataTable_default.headMenu, children: columnsMenu })
|
|
23632
|
+
}
|
|
23633
|
+
) : null
|
|
23540
23634
|
] }) });
|
|
23541
23635
|
}
|
|
23542
23636
|
function WithDescription({
|
|
@@ -23560,6 +23654,7 @@ function StateRows({
|
|
|
23560
23654
|
selectable,
|
|
23561
23655
|
expandEnabled,
|
|
23562
23656
|
reorderable = false,
|
|
23657
|
+
menuCell,
|
|
23563
23658
|
loadError,
|
|
23564
23659
|
empty,
|
|
23565
23660
|
emptyLabel,
|
|
@@ -23586,7 +23681,8 @@ function StateRows({
|
|
|
23586
23681
|
children: /* @__PURE__ */ jsx66(Skeleton, { className: DataTable_default.skeleton })
|
|
23587
23682
|
},
|
|
23588
23683
|
column.id
|
|
23589
|
-
))
|
|
23684
|
+
)),
|
|
23685
|
+
menuCell ? /* @__PURE__ */ jsx66("td", { className: cx(DataTable_default.cell, DataTable_default.menuCell) }) : null
|
|
23590
23686
|
] }, rowIndex)
|
|
23591
23687
|
));
|
|
23592
23688
|
}
|
|
@@ -23602,9 +23698,9 @@ function rowsChange(previous, next) {
|
|
|
23602
23698
|
}
|
|
23603
23699
|
|
|
23604
23700
|
// src/components/data-table/useColumnHover.ts
|
|
23605
|
-
import * as
|
|
23701
|
+
import * as React70 from "react";
|
|
23606
23702
|
function useColumnHover(enabled) {
|
|
23607
|
-
return
|
|
23703
|
+
return React70.useMemo(() => {
|
|
23608
23704
|
if (!enabled) return void 0;
|
|
23609
23705
|
let current = null;
|
|
23610
23706
|
let painted = [];
|
|
@@ -23630,7 +23726,7 @@ function useColumnHover(enabled) {
|
|
|
23630
23726
|
}
|
|
23631
23727
|
|
|
23632
23728
|
// src/components/data-table/useFrozenColumns.ts
|
|
23633
|
-
import * as
|
|
23729
|
+
import * as React71 from "react";
|
|
23634
23730
|
var RESIZE_SETTLE_MS = 120;
|
|
23635
23731
|
var colsOf = (table) => [
|
|
23636
23732
|
...table.querySelectorAll(":scope > colgroup > col")
|
|
@@ -23698,12 +23794,12 @@ function apply(table, frozen, { cols, measured, minimums }) {
|
|
|
23698
23794
|
frozen.widths = next;
|
|
23699
23795
|
}
|
|
23700
23796
|
function useFrozenColumns(tableRef, rootRef, columnsKey, rowsKey, ready) {
|
|
23701
|
-
const frozen =
|
|
23797
|
+
const frozen = React71.useRef({
|
|
23702
23798
|
widths: null,
|
|
23703
23799
|
columnsKey,
|
|
23704
23800
|
rowsKey: void 0
|
|
23705
23801
|
});
|
|
23706
|
-
|
|
23802
|
+
React71.useEffect(() => {
|
|
23707
23803
|
const root = rootRef.current;
|
|
23708
23804
|
if (!root || typeof ResizeObserver === "undefined") return;
|
|
23709
23805
|
let lastWidth = root.getBoundingClientRect().width;
|
|
@@ -23724,7 +23820,7 @@ function useFrozenColumns(tableRef, rootRef, columnsKey, rowsKey, ready) {
|
|
|
23724
23820
|
observer2.disconnect();
|
|
23725
23821
|
};
|
|
23726
23822
|
}, [rootRef, tableRef]);
|
|
23727
|
-
|
|
23823
|
+
React71.useLayoutEffect(() => {
|
|
23728
23824
|
const table = tableRef.current;
|
|
23729
23825
|
if (!table) return;
|
|
23730
23826
|
if (frozen.current.columnsKey !== columnsKey) {
|
|
@@ -23749,7 +23845,7 @@ function useFrozenColumns(tableRef, rootRef, columnsKey, rowsKey, ready) {
|
|
|
23749
23845
|
}
|
|
23750
23846
|
|
|
23751
23847
|
// src/components/data-table/useInfiniteRows.ts
|
|
23752
|
-
import * as
|
|
23848
|
+
import * as React72 from "react";
|
|
23753
23849
|
var INFINITE_ROOT_MARGIN = "0px 0px 120px 0px";
|
|
23754
23850
|
function useInfiniteRows({
|
|
23755
23851
|
enabled,
|
|
@@ -23761,9 +23857,9 @@ function useInfiniteRows({
|
|
|
23761
23857
|
onLoadMore,
|
|
23762
23858
|
scrollRef
|
|
23763
23859
|
}) {
|
|
23764
|
-
const [revealed, setRevealed] =
|
|
23765
|
-
const [pending, setPending] =
|
|
23766
|
-
const [failedAt, setFailedAt] =
|
|
23860
|
+
const [revealed, setRevealed] = React72.useState(pageSize);
|
|
23861
|
+
const [pending, setPending] = React72.useState(false);
|
|
23862
|
+
const [failedAt, setFailedAt] = React72.useState(null);
|
|
23767
23863
|
const visibleCount = Math.min(Math.max(revealed, pageSize), Math.max(pageSize, totalRows));
|
|
23768
23864
|
const hasInternalMore = enabled && visibleCount < totalRows;
|
|
23769
23865
|
const canRequestMore = enabled && Boolean(onLoadMore) && hasMore && !loadingMore && !pending && failedAt !== totalRows;
|
|
@@ -23800,7 +23896,7 @@ function useInfiniteRows({
|
|
|
23800
23896
|
}
|
|
23801
23897
|
|
|
23802
23898
|
// src/components/data-table/useRowSelection.ts
|
|
23803
|
-
import * as
|
|
23899
|
+
import * as React73 from "react";
|
|
23804
23900
|
var hitCell = (element) => {
|
|
23805
23901
|
const cell = element.closest("[data-select-index]");
|
|
23806
23902
|
if (!cell) return null;
|
|
@@ -23821,9 +23917,9 @@ function useRowSelection({
|
|
|
23821
23917
|
defaultValue: defaultSelected,
|
|
23822
23918
|
onChange: onSelectedChange
|
|
23823
23919
|
});
|
|
23824
|
-
const selectedSet =
|
|
23825
|
-
const [announcement, setAnnouncement] =
|
|
23826
|
-
const current =
|
|
23920
|
+
const selectedSet = React73.useMemo(() => new Set(selectedKeys), [selectedKeys]);
|
|
23921
|
+
const [announcement, setAnnouncement] = React73.useState("");
|
|
23922
|
+
const current = React73.useRef(selectedSet);
|
|
23827
23923
|
current.current = selectedSet;
|
|
23828
23924
|
const commit = (next) => {
|
|
23829
23925
|
current.current = next;
|
|
@@ -23845,7 +23941,7 @@ function useRowSelection({
|
|
|
23845
23941
|
hit: hitCell,
|
|
23846
23942
|
autoScroll: true
|
|
23847
23943
|
});
|
|
23848
|
-
const handlers =
|
|
23944
|
+
const handlers = React73.useMemo(
|
|
23849
23945
|
() => ({
|
|
23850
23946
|
onPointerDown(index, event) {
|
|
23851
23947
|
if (event.button !== 0 || event.pointerType === "touch") return;
|
|
@@ -23914,7 +24010,7 @@ var VIRTUAL_FROM2 = 100;
|
|
|
23914
24010
|
var ONE_GROUP2 = () => 0;
|
|
23915
24011
|
var domIdPart = (key) => String(key).replace(/[^A-Za-z0-9_-]/g, "_");
|
|
23916
24012
|
function useSameRows(flat) {
|
|
23917
|
-
const ref =
|
|
24013
|
+
const ref = React74.useRef(flat);
|
|
23918
24014
|
const previous = ref.current;
|
|
23919
24015
|
if (previous !== flat && (previous.rows.length !== flat.rows.length || previous.measure.length !== flat.measure.length || flat.rows.some((item, index) => {
|
|
23920
24016
|
const before = previous.rows[index];
|
|
@@ -23929,6 +24025,7 @@ function DataTable({
|
|
|
23929
24025
|
hiddenColumns,
|
|
23930
24026
|
defaultHiddenColumns = EMPTY_IDS2,
|
|
23931
24027
|
onHiddenColumnsChange,
|
|
24028
|
+
columnsMenu = false,
|
|
23932
24029
|
rows: rows2,
|
|
23933
24030
|
source = "client",
|
|
23934
24031
|
rowCount,
|
|
@@ -23937,6 +24034,7 @@ function DataTable({
|
|
|
23937
24034
|
showHeader = true,
|
|
23938
24035
|
stickyHeader = false,
|
|
23939
24036
|
stickyFirstColumn = false,
|
|
24037
|
+
stickyLastColumn = false,
|
|
23940
24038
|
getRowKey,
|
|
23941
24039
|
getRowHref,
|
|
23942
24040
|
onRowClick,
|
|
@@ -23994,9 +24092,9 @@ function DataTable({
|
|
|
23994
24092
|
const paged = paging === "pages";
|
|
23995
24093
|
const server = source === "server";
|
|
23996
24094
|
const safePageSize = Math.max(1, pageSize);
|
|
23997
|
-
const scrollRef =
|
|
23998
|
-
const tableRef =
|
|
23999
|
-
const rootRef =
|
|
24095
|
+
const scrollRef = React74.useRef(null);
|
|
24096
|
+
const tableRef = React74.useRef(null);
|
|
24097
|
+
const rootRef = React74.useRef(null);
|
|
24000
24098
|
const mergedRootRef = useMergedRefs(rootRef, ref);
|
|
24001
24099
|
const depth = useNestedSurfaceDepth();
|
|
24002
24100
|
const [hiddenIds, setHiddenIds] = useControllableState({
|
|
@@ -24004,8 +24102,8 @@ function DataTable({
|
|
|
24004
24102
|
defaultValue: defaultHiddenColumns,
|
|
24005
24103
|
onChange: onHiddenColumnsChange
|
|
24006
24104
|
});
|
|
24007
|
-
const hiddenSet =
|
|
24008
|
-
const columns =
|
|
24105
|
+
const hiddenSet = React74.useMemo(() => new Set(hiddenIds), [hiddenIds]);
|
|
24106
|
+
const columns = React74.useMemo(() => {
|
|
24009
24107
|
if (hiddenSet.size === 0) return allColumns;
|
|
24010
24108
|
return allColumns.filter((column) => column.hideable === false || !hiddenSet.has(column.id));
|
|
24011
24109
|
}, [allColumns, hiddenSet]);
|
|
@@ -24023,7 +24121,7 @@ function DataTable({
|
|
|
24023
24121
|
const sortColumn = sortState ? allColumns.find((column) => column.sortable && column.id === sortState.columnId) : void 0;
|
|
24024
24122
|
const sortOrder = sortColumn ? sortState?.order : void 0;
|
|
24025
24123
|
const localSort = server ? void 0 : sortColumn;
|
|
24026
|
-
const { sortedRows, groups } =
|
|
24124
|
+
const { sortedRows, groups } = React74.useMemo(() => {
|
|
24027
24125
|
const sorted = localSort && sortOrder ? sortRows(rows2, localSort, sortOrder) : rows2;
|
|
24028
24126
|
if (!getRowGroup) return { sortedRows: sorted, groups: null };
|
|
24029
24127
|
const grouped = groupRows(rows2, sorted, getRowGroup);
|
|
@@ -24066,7 +24164,7 @@ function DataTable({
|
|
|
24066
24164
|
handleLabel: labels.reorderRow,
|
|
24067
24165
|
lockedHint: labels.reorderSorted
|
|
24068
24166
|
});
|
|
24069
|
-
const [rowArrival, setRowArrival] =
|
|
24167
|
+
const [rowArrival, setRowArrival] = React74.useState(() => ({ rows: rows2, added: /* @__PURE__ */ new Set(), batch: 0 }));
|
|
24070
24168
|
if (rowArrival.rows !== rows2) {
|
|
24071
24169
|
let added = rowArrival.added;
|
|
24072
24170
|
let batch = rowArrival.batch;
|
|
@@ -24087,7 +24185,7 @@ function DataTable({
|
|
|
24087
24185
|
}
|
|
24088
24186
|
setRowArrival({ rows: rows2, added, batch });
|
|
24089
24187
|
}
|
|
24090
|
-
|
|
24188
|
+
React74.useEffect(() => {
|
|
24091
24189
|
if (rowArrival.batch > 0 && scrollRef.current) scrollRef.current.scrollTop = 0;
|
|
24092
24190
|
}, [rowArrival.batch]);
|
|
24093
24191
|
const expandEnabled = Boolean(getRowChildren || renderExpanded);
|
|
@@ -24096,12 +24194,12 @@ function DataTable({
|
|
|
24096
24194
|
defaultValue: defaultExpanded,
|
|
24097
24195
|
onChange: onExpandedChange
|
|
24098
24196
|
});
|
|
24099
|
-
const expandedSet =
|
|
24100
|
-
const [lastExpandedKey, setLastExpandedKey] =
|
|
24101
|
-
const expansion =
|
|
24197
|
+
const expandedSet = React74.useMemo(() => new Set(expandedKeys), [expandedKeys]);
|
|
24198
|
+
const [lastExpandedKey, setLastExpandedKey] = React74.useState(null);
|
|
24199
|
+
const expansion = React74.useRef({ expandedKeys, setExpandedKeys });
|
|
24102
24200
|
expansion.current = { expandedKeys, setExpandedKeys };
|
|
24103
|
-
const [closingKeys, setClosingKeys] =
|
|
24104
|
-
const toggleExpanded =
|
|
24201
|
+
const [closingKeys, setClosingKeys] = React74.useState(NO_KEYS);
|
|
24202
|
+
const toggleExpanded = React74.useCallback((key) => {
|
|
24105
24203
|
const { expandedKeys: keys, setExpandedKeys: setKeys } = expansion.current;
|
|
24106
24204
|
const isOpen = keys.includes(key);
|
|
24107
24205
|
setLastExpandedKey(isOpen ? null : key);
|
|
@@ -24130,11 +24228,11 @@ function DataTable({
|
|
|
24130
24228
|
defaultValue: defaultCollapsedGroups ?? EMPTY_GROUPS,
|
|
24131
24229
|
onChange: onCollapsedGroupsChange
|
|
24132
24230
|
});
|
|
24133
|
-
const collapsedSet =
|
|
24231
|
+
const collapsedSet = React74.useMemo(
|
|
24134
24232
|
() => foldGroups ? new Set(collapsedKeys) : NO_GROUPS,
|
|
24135
24233
|
[foldGroups, collapsedKeys]
|
|
24136
24234
|
);
|
|
24137
|
-
const [groupFold, setGroupFold] =
|
|
24235
|
+
const [groupFold, setGroupFold] = React74.useState(() => ({
|
|
24138
24236
|
collapsed: collapsedSet,
|
|
24139
24237
|
closing: NO_GROUPS,
|
|
24140
24238
|
opened: null
|
|
@@ -24150,7 +24248,7 @@ function DataTable({
|
|
|
24150
24248
|
}
|
|
24151
24249
|
setGroupFold({ collapsed: collapsedSet, closing: closing.size ? closing : NO_GROUPS, opened });
|
|
24152
24250
|
}
|
|
24153
|
-
|
|
24251
|
+
React74.useEffect(() => {
|
|
24154
24252
|
if (groupFold.closing.size === 0 && groupFold.opened === null) return;
|
|
24155
24253
|
const timer = window.setTimeout(
|
|
24156
24254
|
() => setGroupFold((state) => ({ ...state, closing: NO_GROUPS, opened: null })),
|
|
@@ -24158,13 +24256,13 @@ function DataTable({
|
|
|
24158
24256
|
);
|
|
24159
24257
|
return () => window.clearTimeout(timer);
|
|
24160
24258
|
}, [groupFold.closing, groupFold.opened]);
|
|
24161
|
-
const toggleGroup =
|
|
24259
|
+
const toggleGroup = React74.useCallback(
|
|
24162
24260
|
(key) => setCollapsedKeys(
|
|
24163
24261
|
(keys) => keys.includes(key) ? keys.filter((k) => k !== key) : [...keys, key]
|
|
24164
24262
|
),
|
|
24165
24263
|
[setCollapsedKeys]
|
|
24166
24264
|
);
|
|
24167
|
-
const flat =
|
|
24265
|
+
const flat = React74.useMemo(
|
|
24168
24266
|
() => flatten(sortedRows, {
|
|
24169
24267
|
start: pageOffset2,
|
|
24170
24268
|
end,
|
|
@@ -24209,7 +24307,7 @@ function DataTable({
|
|
|
24209
24307
|
selectable
|
|
24210
24308
|
]
|
|
24211
24309
|
);
|
|
24212
|
-
const visibleKeys =
|
|
24310
|
+
const visibleKeys = React74.useMemo(() => flat.rows.map((item) => item.key), [flat]);
|
|
24213
24311
|
const selection = useRowSelection({
|
|
24214
24312
|
selected,
|
|
24215
24313
|
defaultSelected,
|
|
@@ -24224,29 +24322,31 @@ function DataTable({
|
|
|
24224
24322
|
const showEmpty = !hasError && !loading && displayedCount === 0;
|
|
24225
24323
|
const bodyState = hasError ? "error" : showSkeleton ? "loading" : showEmpty ? "empty" : "rows";
|
|
24226
24324
|
const { key: bodyKey, className: swapClass } = useSwapIn(`${bodyState}-${rowArrival.batch}`);
|
|
24227
|
-
const
|
|
24325
|
+
const menuInHead = columnsMenu && showHeader;
|
|
24326
|
+
const menuCell = menuInHead && columns.at(-1)?.hideHeader !== true;
|
|
24327
|
+
const totalColumns = columns.length + (reorder.enabled ? 1 : 0) + (selectable ? 1 : 0) + (expandEnabled ? 1 : 0) + (menuCell ? 1 : 0);
|
|
24228
24328
|
const fillHeight = scrollHeight === "fill";
|
|
24229
24329
|
const maxHeight = fillHeight ? void 0 : scrollHeight ?? (infinite ? INFINITE_SCROLL_HEIGHT : void 0);
|
|
24230
24330
|
const columnHover = useColumnHover(highlightColumnOnHover);
|
|
24231
24331
|
const flatRows = flat.rows;
|
|
24232
24332
|
const virtualized = bodyState === "rows" && flatRows.length > VIRTUAL_FROM2 && (fillHeight || maxHeight !== void 0) && !groups && !reorder.enabled && !renderExpanded;
|
|
24233
24333
|
const headRows = showHeader ? 1 : 0;
|
|
24234
|
-
const [focusedKey, setFocusedKey] =
|
|
24235
|
-
const pinnedRows =
|
|
24334
|
+
const [focusedKey, setFocusedKey] = React74.useState(null);
|
|
24335
|
+
const pinnedRows = React74.useMemo(() => {
|
|
24236
24336
|
if (focusedKey === null) return void 0;
|
|
24237
24337
|
const index = flatRows.findIndex((item) => item.key === focusedKey);
|
|
24238
24338
|
return index >= 0 ? [index] : void 0;
|
|
24239
24339
|
}, [flatRows, focusedKey]);
|
|
24240
|
-
const getVirtualKey =
|
|
24340
|
+
const getVirtualKey = React74.useCallback(
|
|
24241
24341
|
(index) => flatRows[index]?.key ?? index,
|
|
24242
24342
|
[flatRows]
|
|
24243
24343
|
);
|
|
24244
|
-
const rowEstimate =
|
|
24344
|
+
const rowEstimate = React74.useMemo(
|
|
24245
24345
|
() => readCssLengthPx(`--prime-table-row-height-${size}`, 44),
|
|
24246
24346
|
[size]
|
|
24247
24347
|
);
|
|
24248
|
-
const estimateRow =
|
|
24249
|
-
const headOffset =
|
|
24348
|
+
const estimateRow = React74.useCallback(() => rowEstimate, [rowEstimate]);
|
|
24349
|
+
const headOffset = React74.useCallback(() => tableRef.current?.tHead?.offsetHeight ?? 0, []);
|
|
24250
24350
|
const virtual = useVirtualRows({
|
|
24251
24351
|
count: virtualized ? flatRows.length : 0,
|
|
24252
24352
|
scrollRef,
|
|
@@ -24269,7 +24369,7 @@ function DataTable({
|
|
|
24269
24369
|
const sameRows = useSameRows(flat);
|
|
24270
24370
|
const firstRendered = virtual.rows[0]?.index;
|
|
24271
24371
|
const lastRendered = virtual.rows.at(-1)?.index;
|
|
24272
|
-
const renderedRows =
|
|
24372
|
+
const renderedRows = React74.useMemo(
|
|
24273
24373
|
() => ({ rows: sameRows, first: firstRendered, last: lastRendered }),
|
|
24274
24374
|
[sameRows, firstRendered, lastRendered]
|
|
24275
24375
|
);
|
|
@@ -24280,24 +24380,24 @@ function DataTable({
|
|
|
24280
24380
|
renderedRows,
|
|
24281
24381
|
bodyState === "rows"
|
|
24282
24382
|
);
|
|
24283
|
-
const baseId =
|
|
24284
|
-
const rowDomId =
|
|
24383
|
+
const baseId = React74.useId();
|
|
24384
|
+
const rowDomId = React74.useCallback(
|
|
24285
24385
|
(key) => `${baseId}-row-${domIdPart(key)}`,
|
|
24286
24386
|
[baseId]
|
|
24287
24387
|
);
|
|
24288
|
-
const detailDomId =
|
|
24388
|
+
const detailDomId = React74.useCallback(
|
|
24289
24389
|
(key) => `${baseId}-detail-${domIdPart(key)}`,
|
|
24290
24390
|
[baseId]
|
|
24291
24391
|
);
|
|
24292
|
-
const domains =
|
|
24293
|
-
const rowClickRef =
|
|
24392
|
+
const domains = React74.useMemo(() => scaleDomains(rows2, columns), [rows2, columns]);
|
|
24393
|
+
const rowClickRef = React74.useRef(onRowClick);
|
|
24294
24394
|
rowClickRef.current = onRowClick;
|
|
24295
24395
|
const hasRowClick = onRowClick !== void 0;
|
|
24296
|
-
const openRow =
|
|
24396
|
+
const openRow = React74.useMemo(
|
|
24297
24397
|
() => hasRowClick ? (row, index, event) => rowClickRef.current?.(row, index, event) : null,
|
|
24298
24398
|
[hasRowClick]
|
|
24299
24399
|
);
|
|
24300
|
-
const shared =
|
|
24400
|
+
const shared = React74.useMemo(
|
|
24301
24401
|
() => ({
|
|
24302
24402
|
columns,
|
|
24303
24403
|
size,
|
|
@@ -24305,6 +24405,8 @@ function DataTable({
|
|
|
24305
24405
|
selectable,
|
|
24306
24406
|
expandEnabled,
|
|
24307
24407
|
stickyFirstColumn,
|
|
24408
|
+
stickyLastColumn,
|
|
24409
|
+
menuCell,
|
|
24308
24410
|
striped,
|
|
24309
24411
|
totalColumns,
|
|
24310
24412
|
openRow,
|
|
@@ -24325,6 +24427,8 @@ function DataTable({
|
|
|
24325
24427
|
selectable,
|
|
24326
24428
|
expandEnabled,
|
|
24327
24429
|
stickyFirstColumn,
|
|
24430
|
+
stickyLastColumn,
|
|
24431
|
+
menuCell,
|
|
24328
24432
|
striped,
|
|
24329
24433
|
totalColumns,
|
|
24330
24434
|
openRow,
|
|
@@ -24337,16 +24441,16 @@ function DataTable({
|
|
|
24337
24441
|
);
|
|
24338
24442
|
const showRange = bodyState === "rows" && (infinite || paged && totalPages > 1);
|
|
24339
24443
|
const showInfiniteStatus = !hasError && infinite && (infiniteRows.hasInternalMore || infiniteRows.loading || infiniteRows.canRequestMore);
|
|
24340
|
-
const
|
|
24341
|
-
|
|
24444
|
+
const columnsMenuTrigger = menuInHead ? /* @__PURE__ */ jsx67(
|
|
24445
|
+
ColumnsMenu,
|
|
24446
|
+
{
|
|
24342
24447
|
columns: allColumns,
|
|
24343
24448
|
hidden: hiddenSet,
|
|
24344
24449
|
setHidden: setHiddenIds,
|
|
24345
24450
|
labels,
|
|
24346
24451
|
size
|
|
24347
|
-
}
|
|
24348
|
-
|
|
24349
|
-
);
|
|
24452
|
+
}
|
|
24453
|
+
) : null;
|
|
24350
24454
|
const rowOpens = Boolean(getRowHref || onRowClick);
|
|
24351
24455
|
const renderRow = (item, index, inWindow = false) => {
|
|
24352
24456
|
const opens = rowOpens && (isRowClickable?.(item.row) ?? true);
|
|
@@ -24430,6 +24534,8 @@ function DataTable({
|
|
|
24430
24534
|
"column-dividers": columnDividers ? void 0 : "false",
|
|
24431
24535
|
"sticky-header": stickyHeader,
|
|
24432
24536
|
"sticky-first-column": stickyFirstColumn,
|
|
24537
|
+
"sticky-last-column": stickyLastColumn,
|
|
24538
|
+
"menu-cell": menuCell || void 0,
|
|
24433
24539
|
"table-width": columns.some((c) => c.grow) ? "grow" : fullWidth ? "fill" : "auto",
|
|
24434
24540
|
"highlight-row": highlightRowOnHover,
|
|
24435
24541
|
"highlight-column": highlightColumnOnHover,
|
|
@@ -24444,7 +24550,7 @@ function DataTable({
|
|
|
24444
24550
|
"scroll-height": fillHeight ? "fill" : void 0
|
|
24445
24551
|
}),
|
|
24446
24552
|
children: [
|
|
24447
|
-
toolbar != null ? /* @__PURE__ */ jsx67(
|
|
24553
|
+
toolbar != null ? /* @__PURE__ */ jsx67("div", { className: DataTable_default.toolbar, children: toolbar }) : null,
|
|
24448
24554
|
/* @__PURE__ */ jsx67("div", { className: cx(fieldTierClass, DataTable_default.frame), "data-size": compactTier(size), children: /* @__PURE__ */ jsxs53(
|
|
24449
24555
|
ScrollContainer,
|
|
24450
24556
|
{
|
|
@@ -24470,7 +24576,8 @@ function DataTable({
|
|
|
24470
24576
|
reorder.enabled ? /* @__PURE__ */ jsx67("col", {}) : null,
|
|
24471
24577
|
selectable ? /* @__PURE__ */ jsx67("col", {}) : null,
|
|
24472
24578
|
expandEnabled ? /* @__PURE__ */ jsx67("col", {}) : null,
|
|
24473
|
-
columns.map((column) => /* @__PURE__ */ jsx67("col", { "data-grow": column.grow ? "true" : void 0 }, column.id))
|
|
24579
|
+
columns.map((column) => /* @__PURE__ */ jsx67("col", { "data-grow": column.grow ? "true" : void 0 }, column.id)),
|
|
24580
|
+
menuCell ? /* @__PURE__ */ jsx67("col", {}) : null
|
|
24474
24581
|
] }),
|
|
24475
24582
|
showHeader ? /* @__PURE__ */ jsx67(
|
|
24476
24583
|
Head,
|
|
@@ -24480,11 +24587,14 @@ function DataTable({
|
|
|
24480
24587
|
sort: sortState,
|
|
24481
24588
|
onSort: handleSort,
|
|
24482
24589
|
stickyFirstColumn,
|
|
24590
|
+
stickyLastColumn,
|
|
24483
24591
|
stickyHeader,
|
|
24484
24592
|
stickyCorner: stickyHeader && stickyFirstColumn,
|
|
24485
24593
|
expandEnabled,
|
|
24486
24594
|
infoLabel: labels.columnInfo,
|
|
24487
24595
|
reorderable: reorder.enabled,
|
|
24596
|
+
columnsMenu: columnsMenuTrigger,
|
|
24597
|
+
menuCell,
|
|
24488
24598
|
selectAll: selectable ? {
|
|
24489
24599
|
checked: selection.allSelected,
|
|
24490
24600
|
indeterminate: selection.someSelected,
|
|
@@ -24494,7 +24604,7 @@ function DataTable({
|
|
|
24494
24604
|
} : void 0
|
|
24495
24605
|
}
|
|
24496
24606
|
) : null,
|
|
24497
|
-
reorder.enabled && bodyState === "rows" ? /* @__PURE__ */ jsx67(
|
|
24607
|
+
reorder.enabled && bodyState === "rows" ? /* @__PURE__ */ jsx67(React74.Fragment, { children: segments.map((segment) => /* @__PURE__ */ jsx67(
|
|
24498
24608
|
ReorderBody,
|
|
24499
24609
|
{
|
|
24500
24610
|
entries: segment.rows,
|
|
@@ -24507,7 +24617,7 @@ function DataTable({
|
|
|
24507
24617
|
className: swapClass
|
|
24508
24618
|
},
|
|
24509
24619
|
`group-${String(segment.key)}`
|
|
24510
|
-
)) }, bodyKey) : groups && bodyState === "rows" ? /* @__PURE__ */ jsx67(
|
|
24620
|
+
)) }, bodyKey) : groups && bodyState === "rows" ? /* @__PURE__ */ jsx67(React74.Fragment, { children: segments.map((segment) => /* @__PURE__ */ jsxs53("tbody", { className: swapClass, children: [
|
|
24511
24621
|
groupHeader(segment),
|
|
24512
24622
|
segment.rows.map(({ item, index }) => renderRow(item, index))
|
|
24513
24623
|
] }, `group-${String(segment.key)}`)) }, bodyKey) : /* @__PURE__ */ jsx67("tbody", { className: swapClass, ...trackFocus, children: bodyState === "rows" ? virtualized ? renderWindow() : flat.rows.map((item, index) => renderRow(item, index)) : /* @__PURE__ */ jsx67(
|
|
@@ -24520,6 +24630,7 @@ function DataTable({
|
|
|
24520
24630
|
selectable,
|
|
24521
24631
|
expandEnabled,
|
|
24522
24632
|
reorderable: reorder.enabled,
|
|
24633
|
+
menuCell,
|
|
24523
24634
|
loadError,
|
|
24524
24635
|
empty,
|
|
24525
24636
|
emptyLabel: labels.empty,
|
|
@@ -24536,7 +24647,8 @@ function DataTable({
|
|
|
24536
24647
|
columns,
|
|
24537
24648
|
selectable,
|
|
24538
24649
|
expandEnabled,
|
|
24539
|
-
reorderable: reorder.enabled
|
|
24650
|
+
reorderable: reorder.enabled,
|
|
24651
|
+
menuCell
|
|
24540
24652
|
}
|
|
24541
24653
|
) : null
|
|
24542
24654
|
]
|
|
@@ -24572,10 +24684,9 @@ function DataTable({
|
|
|
24572
24684
|
)
|
|
24573
24685
|
) }) });
|
|
24574
24686
|
}
|
|
24575
|
-
DataTable.ColumnsMenu = DataTableColumnsMenu;
|
|
24576
24687
|
|
|
24577
24688
|
// src/components/description-list/DescriptionList.tsx
|
|
24578
|
-
import * as
|
|
24689
|
+
import * as React75 from "react";
|
|
24579
24690
|
|
|
24580
24691
|
// src/components/description-list/DescriptionList.module.css
|
|
24581
24692
|
var DescriptionList_default = {
|
|
@@ -24588,12 +24699,12 @@ var DescriptionList_default = {
|
|
|
24588
24699
|
};
|
|
24589
24700
|
|
|
24590
24701
|
// src/components/description-list/DescriptionList.tsx
|
|
24591
|
-
import { Fragment as
|
|
24702
|
+
import { Fragment as Fragment35, jsx as jsx68, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
24592
24703
|
var DESCRIPTION_LIST_LABELS = {
|
|
24593
24704
|
empty: "\u2014",
|
|
24594
24705
|
emptyText: "\u041D\u0435 \u0443\u043A\u0430\u0437\u0430\u043D\u043E"
|
|
24595
24706
|
};
|
|
24596
|
-
var DescriptionListContext =
|
|
24707
|
+
var DescriptionListContext = React75.createContext({
|
|
24597
24708
|
size: "m",
|
|
24598
24709
|
labels: DESCRIPTION_LIST_LABELS
|
|
24599
24710
|
});
|
|
@@ -24621,17 +24732,17 @@ function DescriptionListRoot({
|
|
|
24621
24732
|
DescriptionListRoot.displayName = "DescriptionList.Root";
|
|
24622
24733
|
var isEmptyValue = (node) => node === null || node === void 0 || node === false || node === "";
|
|
24623
24734
|
function DescriptionListItem({ label, children, className, ...rest }) {
|
|
24624
|
-
const { labels } =
|
|
24625
|
-
const parts =
|
|
24735
|
+
const { labels } = React75.useContext(DescriptionListContext);
|
|
24736
|
+
const parts = React75.Children.toArray(children);
|
|
24626
24737
|
const action = parts.find(
|
|
24627
|
-
(child) =>
|
|
24738
|
+
(child) => React75.isValidElement(child) && child.type === DescriptionListItemAction
|
|
24628
24739
|
);
|
|
24629
24740
|
const value = parts.filter((child) => child !== action);
|
|
24630
24741
|
const empty = value.length === 0 || value.every(isEmptyValue);
|
|
24631
24742
|
return /* @__PURE__ */ jsxs54("div", { ...rest, className: cx(DescriptionList_default.item, className), children: [
|
|
24632
24743
|
/* @__PURE__ */ jsx68("dt", { className: DescriptionList_default.label, children: label }),
|
|
24633
24744
|
/* @__PURE__ */ jsxs54("dd", { className: DescriptionList_default.value, "data-empty": empty || void 0, children: [
|
|
24634
|
-
/* @__PURE__ */ jsx68("span", { className: DescriptionList_default.text, children: empty ? /* @__PURE__ */ jsxs54(
|
|
24745
|
+
/* @__PURE__ */ jsx68("span", { className: DescriptionList_default.text, children: empty ? /* @__PURE__ */ jsxs54(Fragment35, { children: [
|
|
24635
24746
|
/* @__PURE__ */ jsx68("span", { "aria-hidden": "true", children: labels.empty }),
|
|
24636
24747
|
/* @__PURE__ */ jsx68(VisuallyHidden, { children: labels.emptyText })
|
|
24637
24748
|
] }) : value }),
|
|
@@ -24641,7 +24752,7 @@ function DescriptionListItem({ label, children, className, ...rest }) {
|
|
|
24641
24752
|
}
|
|
24642
24753
|
DescriptionListItem.displayName = "DescriptionList.Item";
|
|
24643
24754
|
function DescriptionListItemAction({ label, children, ...rest }) {
|
|
24644
|
-
const { size } =
|
|
24755
|
+
const { size } = React75.useContext(DescriptionListContext);
|
|
24645
24756
|
return /* @__PURE__ */ jsx68(RowAction, { ...rest, label, size, children });
|
|
24646
24757
|
}
|
|
24647
24758
|
DescriptionListItemAction.displayName = "DescriptionList.ItemAction";
|
|
@@ -24652,7 +24763,7 @@ var DescriptionList = {
|
|
|
24652
24763
|
};
|
|
24653
24764
|
|
|
24654
24765
|
// src/components/digit-input/DigitInput.tsx
|
|
24655
|
-
import * as
|
|
24766
|
+
import * as React76 from "react";
|
|
24656
24767
|
|
|
24657
24768
|
// src/components/digit-input/DigitInput.module.css
|
|
24658
24769
|
var DigitInput_default = {
|
|
@@ -24707,8 +24818,8 @@ function DigitInput({
|
|
|
24707
24818
|
const size = tier.size;
|
|
24708
24819
|
const disabled = useInheritedDisabled(disabledProp);
|
|
24709
24820
|
const labels = useLabels(DIGIT_INPUT_LABELS, labelsProp);
|
|
24710
|
-
const [verification, setVerification] =
|
|
24711
|
-
const attemptRef =
|
|
24821
|
+
const [verification, setVerification] = React76.useState(null);
|
|
24822
|
+
const attemptRef = React76.useRef(0);
|
|
24712
24823
|
const verifying = verification?.state === "pending";
|
|
24713
24824
|
const shownError = error ?? (verification?.state === "refused" ? verification.reason : void 0);
|
|
24714
24825
|
const shownSuccess = success || verification?.state === "accepted";
|
|
@@ -24748,18 +24859,18 @@ function DigitInput({
|
|
|
24748
24859
|
if (next.length === length && !wasComplete) check(next);
|
|
24749
24860
|
};
|
|
24750
24861
|
const cells = Array.from({ length }, (_, index) => value[index] ?? "");
|
|
24751
|
-
const inputRefs =
|
|
24752
|
-
const pendingFocusRef =
|
|
24753
|
-
|
|
24862
|
+
const inputRefs = React76.useRef([]);
|
|
24863
|
+
const pendingFocusRef = React76.useRef(null);
|
|
24864
|
+
React76.useLayoutEffect(() => {
|
|
24754
24865
|
const index = pendingFocusRef.current;
|
|
24755
24866
|
if (index === null) return;
|
|
24756
24867
|
pendingFocusRef.current = null;
|
|
24757
24868
|
inputRefs.current[index]?.focus();
|
|
24758
24869
|
});
|
|
24759
|
-
const [focusIndex, setFocusIndex] =
|
|
24760
|
-
const ringRef =
|
|
24761
|
-
const ringShown =
|
|
24762
|
-
|
|
24870
|
+
const [focusIndex, setFocusIndex] = React76.useState(null);
|
|
24871
|
+
const ringRef = React76.useRef(null);
|
|
24872
|
+
const ringShown = React76.useRef(false);
|
|
24873
|
+
React76.useLayoutEffect(() => {
|
|
24763
24874
|
const ring = ringRef.current;
|
|
24764
24875
|
const cell = focusIndex === null ? null : inputRefs.current[focusIndex];
|
|
24765
24876
|
if (!ring) return;
|
|
@@ -24980,7 +25091,7 @@ var Drawer = {
|
|
|
24980
25091
|
};
|
|
24981
25092
|
|
|
24982
25093
|
// src/components/example-frame/ExampleFrame.tsx
|
|
24983
|
-
import * as
|
|
25094
|
+
import * as React77 from "react";
|
|
24984
25095
|
|
|
24985
25096
|
// src/theme/applyTheme.ts
|
|
24986
25097
|
var THEME_SWITCHING_ATTRIBUTE = "data-theme-switching";
|
|
@@ -25036,8 +25147,8 @@ var stretchOf = (child) => {
|
|
|
25036
25147
|
return holdsStretch(child) ? "full" : null;
|
|
25037
25148
|
};
|
|
25038
25149
|
function usePreviewFacts(stageRef, layout, active) {
|
|
25039
|
-
const gridWidth =
|
|
25040
|
-
const fitMatrix =
|
|
25150
|
+
const gridWidth = React77.useRef(0);
|
|
25151
|
+
const fitMatrix = React77.useCallback(
|
|
25041
25152
|
(stage, remeasure) => {
|
|
25042
25153
|
if (layout !== "matrix") {
|
|
25043
25154
|
stage.removeAttribute("data-matrix-wrap");
|
|
@@ -25061,7 +25172,7 @@ function usePreviewFacts(stageRef, layout, active) {
|
|
|
25061
25172
|
},
|
|
25062
25173
|
{ enabled: active && layout === "matrix" }
|
|
25063
25174
|
);
|
|
25064
|
-
|
|
25175
|
+
React77.useLayoutEffect(() => {
|
|
25065
25176
|
const stage = stageRef.current;
|
|
25066
25177
|
if (!active || !stage) return;
|
|
25067
25178
|
const read = () => {
|
|
@@ -25123,7 +25234,7 @@ function ExampleFrame({
|
|
|
25123
25234
|
...rest
|
|
25124
25235
|
}) {
|
|
25125
25236
|
const labels = useLabels(EXAMPLE_FRAME_LABELS, labelsProp);
|
|
25126
|
-
const [pane, setPane] =
|
|
25237
|
+
const [pane, setPane] = React77.useState("preview");
|
|
25127
25238
|
const [colorScheme, setColorScheme] = useControllableState({
|
|
25128
25239
|
value: colorSchemeProp,
|
|
25129
25240
|
defaultValue: defaultColorScheme,
|
|
@@ -25134,14 +25245,14 @@ function ExampleFrame({
|
|
|
25134
25245
|
defaultValue: defaultViewport,
|
|
25135
25246
|
onChange: onViewportChange
|
|
25136
25247
|
});
|
|
25137
|
-
const rootRef =
|
|
25248
|
+
const rootRef = React77.useRef(null);
|
|
25138
25249
|
const mergedRef = useMergedRefs(rootRef, ref);
|
|
25139
25250
|
const depth = useNestedSurfaceDepth();
|
|
25140
25251
|
const stageDepth = useStageDepth();
|
|
25141
|
-
const stageRef =
|
|
25252
|
+
const stageRef = React77.useRef(null);
|
|
25142
25253
|
usePreviewFacts(stageRef, previewLayout, pane === "preview");
|
|
25143
|
-
const previousScheme =
|
|
25144
|
-
|
|
25254
|
+
const previousScheme = React77.useRef(colorScheme);
|
|
25255
|
+
React77.useLayoutEffect(() => {
|
|
25145
25256
|
if (previousScheme.current === colorScheme) return;
|
|
25146
25257
|
previousScheme.current = colorScheme;
|
|
25147
25258
|
if (rootRef.current) suspendTransitions(rootRef.current);
|
|
@@ -25204,11 +25315,11 @@ function ExampleFrameToolbar({
|
|
|
25204
25315
|
onColorSchemeChange,
|
|
25205
25316
|
onCopy
|
|
25206
25317
|
}) {
|
|
25207
|
-
const [copyState, setCopyState] =
|
|
25208
|
-
const toolbarRef =
|
|
25318
|
+
const [copyState, setCopyState] = React77.useState("idle");
|
|
25319
|
+
const toolbarRef = React77.useRef(null);
|
|
25209
25320
|
const toolbarSize = useElementSize(toolbarRef);
|
|
25210
25321
|
const narrow = toolbarSize !== null && toolbarSize.width > 0 && toolbarSize.width < NARROW_STEPS * readCssLengthPx("--prime-space-20", TOKEN_DEFAULTS["--prime-space-20"]);
|
|
25211
|
-
|
|
25322
|
+
React77.useEffect(() => {
|
|
25212
25323
|
if (copyState === "idle") return;
|
|
25213
25324
|
const timer = window.setTimeout(() => setCopyState("idle"), COPY_FEEDBACK_MS);
|
|
25214
25325
|
return () => window.clearTimeout(timer);
|
|
@@ -25295,7 +25406,7 @@ function ExampleFrameToolbar({
|
|
|
25295
25406
|
ExampleFrameToolbar.displayName = "ExampleFrame.Toolbar";
|
|
25296
25407
|
|
|
25297
25408
|
// src/components/field-list/FieldList.tsx
|
|
25298
|
-
import * as
|
|
25409
|
+
import * as React78 from "react";
|
|
25299
25410
|
|
|
25300
25411
|
// src/components/field-list/FieldList.module.css
|
|
25301
25412
|
var FieldList_default = {
|
|
@@ -25307,7 +25418,8 @@ var FieldList_default = {
|
|
|
25307
25418
|
head: "FieldList_head",
|
|
25308
25419
|
cells: "FieldList_cells",
|
|
25309
25420
|
cell: "FieldList_cell",
|
|
25310
|
-
|
|
25421
|
+
heading: "FieldList_heading",
|
|
25422
|
+
grip: "FieldList_grip",
|
|
25311
25423
|
end: "FieldList_end",
|
|
25312
25424
|
totals: "FieldList_totals",
|
|
25313
25425
|
total: "FieldList_total",
|
|
@@ -25315,51 +25427,57 @@ var FieldList_default = {
|
|
|
25315
25427
|
totalsLabel: "FieldList_totalsLabel",
|
|
25316
25428
|
totalValue: "FieldList_totalValue",
|
|
25317
25429
|
add: "FieldList_add",
|
|
25318
|
-
addIndented: "FieldList_addIndented",
|
|
25319
25430
|
limit: "FieldList_limit",
|
|
25320
25431
|
totalName: "FieldList_totalName"
|
|
25321
25432
|
};
|
|
25322
25433
|
|
|
25323
25434
|
// src/components/field-list/FieldList.tsx
|
|
25324
|
-
import { Fragment as
|
|
25435
|
+
import { Fragment as Fragment37, jsx as jsx72, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
25325
25436
|
var FIELD_LIST_LABELS = {
|
|
25326
25437
|
remove: "\u0423\u0434\u0430\u043B\u0438\u0442\u044C {row}",
|
|
25327
25438
|
reorder: "\u041F\u0435\u0440\u0435\u043C\u0435\u0441\u0442\u0438\u0442\u044C {row}",
|
|
25328
25439
|
row: "\u0441\u0442\u0440\u043E\u043A\u0443 {index}",
|
|
25329
25440
|
namedRow: "\xAB{label}\xBB",
|
|
25330
|
-
|
|
25441
|
+
lockedReason: "\u0417\u0430\u043A\u0440\u0435\u043F\u043B\u0451\u043D\u043D\u0443\u044E \u0441\u0442\u0440\u043E\u043A\u0443 \u043D\u0435\u043B\u044C\u0437\u044F \u0443\u0434\u0430\u043B\u0438\u0442\u044C",
|
|
25331
25442
|
maxReached: "\u041D\u0435 \u0431\u043E\u043B\u044C\u0448\u0435 {max}",
|
|
25332
25443
|
totals: "\u0418\u0442\u043E\u0433\u043E"
|
|
25333
25444
|
};
|
|
25334
25445
|
var track = (name) => `var(${name})`;
|
|
25335
25446
|
var TRACKS = {
|
|
25336
25447
|
fill: "minmax(0, 1fr)",
|
|
25337
|
-
compact: track("--fl-compact"),
|
|
25338
25448
|
xs: track("--fl-xs"),
|
|
25339
25449
|
s: track("--fl-s"),
|
|
25340
25450
|
m: track("--fl-m")
|
|
25341
25451
|
};
|
|
25452
|
+
var compactTrack = (column) => `var(--fl-compact-${column}, max-content)`;
|
|
25342
25453
|
function cellsOf(node) {
|
|
25343
|
-
return
|
|
25344
|
-
(child) =>
|
|
25454
|
+
return React78.Children.toArray(node).flatMap(
|
|
25455
|
+
(child) => React78.isValidElement(child) && child.type === React78.Fragment ? cellsOf(child.props.children) : [child]
|
|
25345
25456
|
);
|
|
25346
25457
|
}
|
|
25347
25458
|
function totalsOf(node) {
|
|
25348
25459
|
const out = [];
|
|
25349
|
-
|
|
25350
|
-
if (
|
|
25460
|
+
React78.Children.forEach(node, (child) => {
|
|
25461
|
+
if (React78.isValidElement(child) && child.type === React78.Fragment)
|
|
25351
25462
|
out.push(...totalsOf(child.props.children));
|
|
25352
25463
|
else out.push(child);
|
|
25353
25464
|
});
|
|
25354
25465
|
return out;
|
|
25355
25466
|
}
|
|
25467
|
+
var TEXT_BOX = "input:not([type='checkbox'], [type='radio'], [type='hidden']), textarea";
|
|
25468
|
+
function endsText(cell) {
|
|
25469
|
+
const box = cell?.querySelector(TEXT_BOX);
|
|
25470
|
+
if (!box) return false;
|
|
25471
|
+
const { textAlign, direction } = getComputedStyle(box);
|
|
25472
|
+
return textAlign === "end" || textAlign === (direction === "rtl" ? "left" : "right");
|
|
25473
|
+
}
|
|
25356
25474
|
function takeNext(_current, next) {
|
|
25357
25475
|
return next;
|
|
25358
25476
|
}
|
|
25359
25477
|
var FOCUSABLE = "input, textarea, select, button, [tabindex]:not([tabindex='-1'])";
|
|
25360
|
-
var
|
|
25361
|
-
function
|
|
25362
|
-
return /* @__PURE__ */ jsx72("span", { className: cx(fieldTierClass, FieldList_default.
|
|
25478
|
+
var GRIP_TIER = "xs";
|
|
25479
|
+
function GripBox({ children }) {
|
|
25480
|
+
return /* @__PURE__ */ jsx72("span", { className: cx(fieldTierClass, FieldList_default.grip), "data-size": GRIP_TIER, children });
|
|
25363
25481
|
}
|
|
25364
25482
|
function FieldList({
|
|
25365
25483
|
value: valueProp,
|
|
@@ -25400,7 +25518,7 @@ function FieldList({
|
|
|
25400
25518
|
const changes = usePendingChanges(stored, takeNext);
|
|
25401
25519
|
const items = changes.shown;
|
|
25402
25520
|
const busy = changes.pending.length > 0;
|
|
25403
|
-
const latest =
|
|
25521
|
+
const latest = React78.useRef(items);
|
|
25404
25522
|
latest.current = items;
|
|
25405
25523
|
const setItems = (edit) => {
|
|
25406
25524
|
const next = edit(latest.current);
|
|
@@ -25419,17 +25537,26 @@ function FieldList({
|
|
|
25419
25537
|
"aria-describedby": ids.describedBy,
|
|
25420
25538
|
"aria-busy": busy || void 0
|
|
25421
25539
|
};
|
|
25422
|
-
const addRef =
|
|
25423
|
-
const rows2 =
|
|
25540
|
+
const addRef = React78.useRef(null);
|
|
25541
|
+
const rows2 = React78.useRef(/* @__PURE__ */ new Map());
|
|
25424
25542
|
const presence = useListPresence(items.map(getId));
|
|
25425
|
-
const focusNext =
|
|
25426
|
-
const
|
|
25543
|
+
const focusNext = React78.useRef(null);
|
|
25544
|
+
const grip = reorderable;
|
|
25545
|
+
const single = columns.length === 1;
|
|
25546
|
+
const [removeOutside, setRemoveOutside] = React78.useState(false);
|
|
25547
|
+
const removeInField = single && !removeOutside;
|
|
25427
25548
|
const template = [
|
|
25428
|
-
|
|
25429
|
-
|
|
25430
|
-
|
|
25549
|
+
...columns.map(
|
|
25550
|
+
(column, index) => column.width === "compact" ? compactTrack(index) : TRACKS[column.width ?? "fill"]
|
|
25551
|
+
),
|
|
25552
|
+
removeInField ? null : track("--fl-end"),
|
|
25553
|
+
grip ? "auto" : null
|
|
25431
25554
|
].filter(Boolean).join(" ");
|
|
25432
|
-
const
|
|
25555
|
+
const stackedTemplate = ["minmax(0, 1fr)", removeInField ? null : "auto", grip ? "auto" : null].filter(Boolean).join(" ");
|
|
25556
|
+
const trackStyle = {
|
|
25557
|
+
"--fl-columns": template,
|
|
25558
|
+
"--fl-stacked": stackedTemplate
|
|
25559
|
+
};
|
|
25433
25560
|
const hasHead = items.length > 0 && !single;
|
|
25434
25561
|
const head = usePartPresence({ present: hasHead, axis: "block" });
|
|
25435
25562
|
const totalCells = renderTotals && items.length > 0 ? totalsOf(renderTotals(items)) : null;
|
|
@@ -25438,9 +25565,42 @@ function FieldList({
|
|
|
25438
25565
|
`FieldList: renderTotals returns ${totalCells.length} cells for ${columns.length} columns`
|
|
25439
25566
|
);
|
|
25440
25567
|
const totals = usePartPresence({ present: totalCells !== null, axis: "block" });
|
|
25568
|
+
const bodyRef = React78.useRef(null);
|
|
25569
|
+
const [endColumns, setEndColumns] = React78.useState("");
|
|
25570
|
+
React78.useLayoutEffect(() => {
|
|
25571
|
+
if (!totalCells) return;
|
|
25572
|
+
const cells = bodyRef.current?.querySelector("[data-fl-cells]")?.children;
|
|
25573
|
+
setEndColumns(columns.map((_, column) => endsText(cells?.[column]) ? "1" : "0").join(""));
|
|
25574
|
+
});
|
|
25441
25575
|
const atMax = max !== void 0 && items.length >= max;
|
|
25442
25576
|
const atMin = items.length <= min;
|
|
25443
|
-
|
|
25577
|
+
const compactColumns = columns.flatMap(
|
|
25578
|
+
(column, index) => column.width === "compact" ? [index] : []
|
|
25579
|
+
);
|
|
25580
|
+
const measureCompact = () => {
|
|
25581
|
+
const body = bodyRef.current;
|
|
25582
|
+
if (!body) return;
|
|
25583
|
+
const rowsOfCells = body.querySelectorAll(`.${FieldList_default.cells}`);
|
|
25584
|
+
for (const column of compactColumns) {
|
|
25585
|
+
let width = 0;
|
|
25586
|
+
for (const cells of rowsOfCells) {
|
|
25587
|
+
const cell = cells.children[column];
|
|
25588
|
+
if (cell) width = Math.max(width, cell.getBoundingClientRect().width);
|
|
25589
|
+
}
|
|
25590
|
+
body.style.setProperty(`--fl-compact-${column}`, width > 0 ? `${width}px` : null);
|
|
25591
|
+
}
|
|
25592
|
+
};
|
|
25593
|
+
React78.useLayoutEffect(measureCompact);
|
|
25594
|
+
useResizeEffect(bodyRef, measureCompact, { enabled: compactColumns.length > 0 });
|
|
25595
|
+
React78.useLayoutEffect(() => {
|
|
25596
|
+
if (!removeInField) return;
|
|
25597
|
+
for (const row of rows2.current.values())
|
|
25598
|
+
if (!row.querySelector("[data-fl-cells] [data-fl-remove]")) {
|
|
25599
|
+
setRemoveOutside(true);
|
|
25600
|
+
return;
|
|
25601
|
+
}
|
|
25602
|
+
});
|
|
25603
|
+
React78.useLayoutEffect(() => {
|
|
25444
25604
|
const target = focusNext.current;
|
|
25445
25605
|
if (!target) return;
|
|
25446
25606
|
focusNext.current = null;
|
|
@@ -25487,37 +25647,66 @@ function FieldList({
|
|
|
25487
25647
|
throw new Error(
|
|
25488
25648
|
`FieldList: row "${id}" renders ${cells.length} cells for ${columns.length} columns`
|
|
25489
25649
|
);
|
|
25490
|
-
const
|
|
25491
|
-
|
|
25492
|
-
|
|
25650
|
+
const removeName = formatLabel(labels.remove, { row: name });
|
|
25651
|
+
const reason = locked && !disabled ? labels.lockedReason : null;
|
|
25652
|
+
const removeOff = disabled || atMin || locked;
|
|
25653
|
+
const removeButton = removeInField ? (
|
|
25654
|
+
// A segment at the field's end. A pinned row's stays a focusable `aria-disabled` segment, so
|
|
25655
|
+
// its reason tooltip has a trigger and the segment stays the box's last child.
|
|
25656
|
+
/* @__PURE__ */ jsx72(
|
|
25657
|
+
FieldActionButton,
|
|
25493
25658
|
{
|
|
25494
|
-
|
|
25495
|
-
|
|
25659
|
+
label: removeName,
|
|
25660
|
+
tooltip: reason === null,
|
|
25661
|
+
disabled: removeOff && !reason,
|
|
25662
|
+
"aria-disabled": reason ? true : void 0,
|
|
25663
|
+
onClick: reason ? void 0 : () => remove(id),
|
|
25664
|
+
"data-fl-remove": "",
|
|
25665
|
+
children: /* @__PURE__ */ jsx72(Icon, { name: "action.remove" })
|
|
25496
25666
|
}
|
|
25497
|
-
)
|
|
25667
|
+
)
|
|
25668
|
+
) : /* @__PURE__ */ jsx72(
|
|
25669
|
+
Button.Root,
|
|
25670
|
+
{
|
|
25671
|
+
variant: "ghost",
|
|
25672
|
+
tone: "neutral",
|
|
25673
|
+
"aria-label": removeName,
|
|
25674
|
+
disabled: removeOff,
|
|
25675
|
+
onClick: () => remove(id),
|
|
25676
|
+
"data-fl-remove": "",
|
|
25677
|
+
children: /* @__PURE__ */ jsx72(Button.Icon, { children: /* @__PURE__ */ jsx72(Icon, { name: "action.remove" }) })
|
|
25678
|
+
}
|
|
25679
|
+
);
|
|
25680
|
+
const removeControl = reason ? /* @__PURE__ */ jsxs57(Tooltip.Root, { children: [
|
|
25681
|
+
/* @__PURE__ */ jsx72(Tooltip.Trigger, { children: removeButton }),
|
|
25682
|
+
/* @__PURE__ */ jsx72(Tooltip.Content, { children: reason })
|
|
25683
|
+
] }) : removeButton;
|
|
25684
|
+
const content = /* @__PURE__ */ jsxs57(Fragment37, { children: [
|
|
25498
25685
|
/* @__PURE__ */ jsx72("div", { className: FieldList_default.cells, "data-fl-cells": "", children: cells.map((cell, column) => {
|
|
25499
25686
|
const heading = columns[column];
|
|
25687
|
+
const required = Boolean(heading?.required);
|
|
25500
25688
|
return /* @__PURE__ */ jsx72(
|
|
25501
25689
|
FieldCellContext,
|
|
25502
25690
|
{
|
|
25503
|
-
value:
|
|
25691
|
+
value: removeInField ? {
|
|
25692
|
+
label: heading?.label ?? "",
|
|
25693
|
+
hidden: "always",
|
|
25694
|
+
required,
|
|
25695
|
+
action: removeControl
|
|
25696
|
+
} : cellValue(heading?.label ?? "", single, required),
|
|
25504
25697
|
children: /* @__PURE__ */ jsx72("div", { className: FieldList_default.cell, "data-width": heading?.width ?? "fill", children: cell })
|
|
25505
25698
|
},
|
|
25506
25699
|
column
|
|
25507
25700
|
);
|
|
25508
25701
|
}) }),
|
|
25509
|
-
/* @__PURE__ */ jsx72("span", { className: FieldList_default.end, children:
|
|
25510
|
-
|
|
25702
|
+
removeInField ? null : /* @__PURE__ */ jsx72("span", { className: FieldList_default.end, children: removeControl }),
|
|
25703
|
+
grip ? /* @__PURE__ */ jsx72(GripBox, { children: /* @__PURE__ */ jsx72(
|
|
25704
|
+
Dnd.Handle,
|
|
25511
25705
|
{
|
|
25512
|
-
|
|
25513
|
-
|
|
25514
|
-
"aria-label": formatLabel(labels.remove, { row: name }),
|
|
25515
|
-
disabled: disabled || atMin,
|
|
25516
|
-
onClick: () => remove(id),
|
|
25517
|
-
"data-fl-remove": "",
|
|
25518
|
-
children: /* @__PURE__ */ jsx72(Button.Icon, { children: /* @__PURE__ */ jsx72(Icon, { name: "action.remove" }) })
|
|
25706
|
+
"aria-label": formatLabel(labels.reorder, { row: name }),
|
|
25707
|
+
disabled
|
|
25519
25708
|
}
|
|
25520
|
-
) })
|
|
25709
|
+
) }) : null
|
|
25521
25710
|
] });
|
|
25522
25711
|
const rowProps = {
|
|
25523
25712
|
// Registers the row (focus after an add or a remove); a removed row leaves in place and the
|
|
@@ -25532,9 +25721,10 @@ function FieldList({
|
|
|
25532
25721
|
},
|
|
25533
25722
|
// An added row rises in once: the class stays until the list changes again.
|
|
25534
25723
|
className: cx(fieldTierClass, FieldList_default.row, presence.entering.has(id) && enterMotion_default.enter),
|
|
25535
|
-
style:
|
|
25724
|
+
style: trackStyle,
|
|
25536
25725
|
"data-size": size,
|
|
25537
|
-
"data-locked": locked || void 0
|
|
25726
|
+
"data-locked": locked || void 0,
|
|
25727
|
+
"data-single": single || void 0
|
|
25538
25728
|
};
|
|
25539
25729
|
return reorderable ? /* @__PURE__ */ jsx72(Dnd.SortableItem, { id, locked, ...rowProps, children: content }, id) : /* @__PURE__ */ jsx72("li", { ...rowProps, children: content }, id);
|
|
25540
25730
|
};
|
|
@@ -25555,17 +25745,16 @@ function FieldList({
|
|
|
25555
25745
|
group: true,
|
|
25556
25746
|
className: cx(FieldList_default.root, className),
|
|
25557
25747
|
...toDataAttributes({ disabled: disabled || void 0 }),
|
|
25558
|
-
children: /* @__PURE__ */ jsxs57("div", { className: FieldList_default.body, children: [
|
|
25748
|
+
children: /* @__PURE__ */ jsxs57("div", { ref: bodyRef, className: FieldList_default.body, children: [
|
|
25559
25749
|
hasHead ? /* @__PURE__ */ jsxs57(
|
|
25560
25750
|
"div",
|
|
25561
25751
|
{
|
|
25562
25752
|
ref: head.ref,
|
|
25563
25753
|
className: cx(fieldTierClass, FieldList_default.row, FieldList_default.head, head.className),
|
|
25564
|
-
style:
|
|
25754
|
+
style: trackStyle,
|
|
25565
25755
|
"data-size": size,
|
|
25566
25756
|
"aria-hidden": "true",
|
|
25567
25757
|
children: [
|
|
25568
|
-
lead ? /* @__PURE__ */ jsx72(LeadBox, {}) : null,
|
|
25569
25758
|
/* @__PURE__ */ jsx72("div", { className: FieldList_default.cells, children: columns.map((column, index) => /* @__PURE__ */ jsx72(
|
|
25570
25759
|
Label.Root,
|
|
25571
25760
|
{
|
|
@@ -25573,11 +25762,14 @@ function FieldList({
|
|
|
25573
25762
|
required: column.required,
|
|
25574
25763
|
disabled,
|
|
25575
25764
|
secondary: true,
|
|
25765
|
+
className: FieldList_default.heading,
|
|
25766
|
+
"data-width": column.width ?? "fill",
|
|
25576
25767
|
children: column.label
|
|
25577
25768
|
},
|
|
25578
25769
|
index
|
|
25579
25770
|
)) }),
|
|
25580
|
-
/* @__PURE__ */ jsx72("span", {})
|
|
25771
|
+
/* @__PURE__ */ jsx72("span", {}),
|
|
25772
|
+
grip ? /* @__PURE__ */ jsx72(GripBox, {}) : null
|
|
25581
25773
|
]
|
|
25582
25774
|
}
|
|
25583
25775
|
) : null,
|
|
@@ -25620,10 +25812,9 @@ function FieldList({
|
|
|
25620
25812
|
hairline_default.top,
|
|
25621
25813
|
totals.className
|
|
25622
25814
|
),
|
|
25623
|
-
style:
|
|
25815
|
+
style: trackStyle,
|
|
25624
25816
|
"data-size": size,
|
|
25625
25817
|
children: [
|
|
25626
|
-
lead ? /* @__PURE__ */ jsx72(LeadBox, {}) : null,
|
|
25627
25818
|
/* @__PURE__ */ jsx72("div", { className: FieldList_default.cells, children: totalCells.map((total, column) => {
|
|
25628
25819
|
const heading = columns[column];
|
|
25629
25820
|
const shown = hasContent(total);
|
|
@@ -25633,7 +25824,8 @@ function FieldList({
|
|
|
25633
25824
|
className: cx(FieldList_default.cell, FieldList_default.total),
|
|
25634
25825
|
"data-width": heading?.width ?? "fill",
|
|
25635
25826
|
"data-empty": !shown && column > 0 || void 0,
|
|
25636
|
-
|
|
25827
|
+
"data-align": endColumns[column] === "1" ? "end" : void 0,
|
|
25828
|
+
children: shown ? /* @__PURE__ */ jsxs57(Fragment37, { children: [
|
|
25637
25829
|
/* @__PURE__ */ jsx72("span", { className: cx(visuallyHiddenClass, FieldList_default.totalName), children: heading?.label }),
|
|
25638
25830
|
/* @__PURE__ */ jsx72("span", { className: FieldList_default.totalValue, children: total })
|
|
25639
25831
|
] }) : column === 0 ? (
|
|
@@ -25644,35 +25836,29 @@ function FieldList({
|
|
|
25644
25836
|
column
|
|
25645
25837
|
);
|
|
25646
25838
|
}) }),
|
|
25647
|
-
/* @__PURE__ */ jsx72("span", { className: cx(FieldList_default.end, FieldList_default.totalsEnd) })
|
|
25839
|
+
removeInField ? null : /* @__PURE__ */ jsx72("span", { className: cx(FieldList_default.end, FieldList_default.totalsEnd) }),
|
|
25840
|
+
grip ? /* @__PURE__ */ jsx72(GripBox, {}) : null
|
|
25648
25841
|
]
|
|
25649
25842
|
}
|
|
25650
25843
|
)
|
|
25651
25844
|
) : null,
|
|
25652
|
-
createItem ? /* @__PURE__ */ jsxs57(
|
|
25653
|
-
|
|
25654
|
-
|
|
25655
|
-
|
|
25656
|
-
|
|
25657
|
-
|
|
25658
|
-
|
|
25659
|
-
|
|
25660
|
-
|
|
25661
|
-
|
|
25662
|
-
|
|
25663
|
-
|
|
25664
|
-
|
|
25665
|
-
|
|
25666
|
-
|
|
25667
|
-
|
|
25668
|
-
|
|
25669
|
-
]
|
|
25670
|
-
}
|
|
25671
|
-
),
|
|
25672
|
-
atMax && max !== void 0 ? /* @__PURE__ */ jsx72("span", { className: cx(textRole_default.caption, FieldList_default.limit), children: formatLabel(labels.maxReached, { max }) }) : null
|
|
25673
|
-
]
|
|
25674
|
-
}
|
|
25675
|
-
) : null
|
|
25845
|
+
createItem ? /* @__PURE__ */ jsxs57("div", { className: FieldList_default.add, children: [
|
|
25846
|
+
/* @__PURE__ */ jsxs57(
|
|
25847
|
+
Button.Root,
|
|
25848
|
+
{
|
|
25849
|
+
ref: addRef,
|
|
25850
|
+
variant: "soft",
|
|
25851
|
+
tone: "neutral",
|
|
25852
|
+
disabled: disabled || atMax,
|
|
25853
|
+
onClick: add,
|
|
25854
|
+
children: [
|
|
25855
|
+
/* @__PURE__ */ jsx72(Button.Icon, { children: /* @__PURE__ */ jsx72(Icon, { name: "action.add" }) }),
|
|
25856
|
+
addLabel
|
|
25857
|
+
]
|
|
25858
|
+
}
|
|
25859
|
+
),
|
|
25860
|
+
atMax && max !== void 0 ? /* @__PURE__ */ jsx72("span", { className: cx(textRole_default.caption, FieldList_default.limit), children: formatLabel(labels.maxReached, { max }) }) : null
|
|
25861
|
+
] }) : null
|
|
25676
25862
|
] })
|
|
25677
25863
|
}
|
|
25678
25864
|
) })
|
|
@@ -25691,7 +25877,7 @@ function cellValue(label, single, required) {
|
|
|
25691
25877
|
}
|
|
25692
25878
|
|
|
25693
25879
|
// src/components/fieldset/Fieldset.tsx
|
|
25694
|
-
import * as
|
|
25880
|
+
import * as React79 from "react";
|
|
25695
25881
|
|
|
25696
25882
|
// src/components/fieldset/Fieldset.module.css
|
|
25697
25883
|
var Fieldset_default = {
|
|
@@ -25714,7 +25900,7 @@ function Fieldset({
|
|
|
25714
25900
|
...rest
|
|
25715
25901
|
}) {
|
|
25716
25902
|
const disabled = useInheritedDisabled(disabledProp);
|
|
25717
|
-
const descriptionId =
|
|
25903
|
+
const descriptionId = React79.useId();
|
|
25718
25904
|
const hasDescription = hasContent(description);
|
|
25719
25905
|
const describedBy = [ariaDescribedBy, hasDescription ? descriptionId : void 0].filter(Boolean).join(" ") || void 0;
|
|
25720
25906
|
return /* @__PURE__ */ jsxs58(
|
|
@@ -25740,7 +25926,7 @@ Fieldset.displayName = "Fieldset";
|
|
|
25740
25926
|
// src/components/gantt/Gantt.tsx
|
|
25741
25927
|
import { addDays as addDays3, startOfDay as startOfDay7 } from "date-fns";
|
|
25742
25928
|
import { ru as ru3 } from "date-fns/locale";
|
|
25743
|
-
import * as
|
|
25929
|
+
import * as React82 from "react";
|
|
25744
25930
|
|
|
25745
25931
|
// src/components/gantt/Gantt.module.css
|
|
25746
25932
|
var Gantt_default = {
|
|
@@ -25791,10 +25977,10 @@ var Gantt_default = {
|
|
|
25791
25977
|
};
|
|
25792
25978
|
|
|
25793
25979
|
// src/components/gantt/GanttRow.tsx
|
|
25794
|
-
import * as
|
|
25980
|
+
import * as React81 from "react";
|
|
25795
25981
|
|
|
25796
25982
|
// src/components/gantt/GanttBar.tsx
|
|
25797
|
-
import * as
|
|
25983
|
+
import * as React80 from "react";
|
|
25798
25984
|
|
|
25799
25985
|
// src/components/gantt/ganttModel.ts
|
|
25800
25986
|
import {
|
|
@@ -26024,7 +26210,7 @@ function visibleSegment(rect, viewport2) {
|
|
|
26024
26210
|
}
|
|
26025
26211
|
|
|
26026
26212
|
// src/components/gantt/GanttBar.tsx
|
|
26027
|
-
import { Fragment as
|
|
26213
|
+
import { Fragment as Fragment38, jsx as jsx74, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
26028
26214
|
var EDIT_SHORTCUTS = [
|
|
26029
26215
|
"Shift+ArrowLeft",
|
|
26030
26216
|
"Shift+ArrowRight",
|
|
@@ -26061,17 +26247,17 @@ function GanttBarView({
|
|
|
26061
26247
|
onDragChange,
|
|
26062
26248
|
barRef
|
|
26063
26249
|
}) {
|
|
26064
|
-
const [tipOpen, setTipOpen] =
|
|
26065
|
-
|
|
26250
|
+
const [tipOpen, setTipOpen] = React80.useState(false);
|
|
26251
|
+
React80.useEffect(() => {
|
|
26066
26252
|
if (!tipOpen) return;
|
|
26067
26253
|
onTipChange(bar.id, () => setTipOpen(false));
|
|
26068
26254
|
return () => onTipChange(bar.id, null);
|
|
26069
26255
|
}, [tipOpen, bar.id, onTipChange]);
|
|
26070
|
-
const [drag, setDrag] =
|
|
26071
|
-
const [tipMounted, setTipMounted] =
|
|
26256
|
+
const [drag, setDrag] = React80.useState(null);
|
|
26257
|
+
const [tipMounted, setTipMounted] = React80.useState(false);
|
|
26072
26258
|
if (!tipMounted && (tipOpen || drag !== null)) setTipMounted(true);
|
|
26073
|
-
const gesture =
|
|
26074
|
-
const swallowClick =
|
|
26259
|
+
const gesture = React80.useRef(null);
|
|
26260
|
+
const swallowClick = React80.useRef(false);
|
|
26075
26261
|
const shown = drag ? applyEdit(dates, drag.edit, drag.steps, drag.unit) : dates;
|
|
26076
26262
|
const milestone = isMilestone(shown);
|
|
26077
26263
|
const baseSpan = isMilestone(dates) ? 0 : daysBetween2(dates.start, dates.end);
|
|
@@ -26172,8 +26358,8 @@ function GanttBarView({
|
|
|
26172
26358
|
setDrag(null);
|
|
26173
26359
|
if (current.steps !== 0) onCommit(applyEdit(dates, current.edit, current.steps, current.unit));
|
|
26174
26360
|
};
|
|
26175
|
-
const nodeRef =
|
|
26176
|
-
|
|
26361
|
+
const nodeRef = React80.useRef(null);
|
|
26362
|
+
React80.useEffect(() => {
|
|
26177
26363
|
const node = nodeRef.current;
|
|
26178
26364
|
if (!node) return;
|
|
26179
26365
|
const hold2 = (event) => {
|
|
@@ -26183,14 +26369,14 @@ function GanttBarView({
|
|
|
26183
26369
|
node.addEventListener("touchmove", hold2, { passive: false });
|
|
26184
26370
|
return () => node.removeEventListener("touchmove", hold2);
|
|
26185
26371
|
}, []);
|
|
26186
|
-
const setNode =
|
|
26372
|
+
const setNode = React80.useCallback(
|
|
26187
26373
|
(node) => {
|
|
26188
26374
|
nodeRef.current = node;
|
|
26189
26375
|
barRef(node);
|
|
26190
26376
|
},
|
|
26191
26377
|
[barRef]
|
|
26192
26378
|
);
|
|
26193
|
-
return /* @__PURE__ */ jsxs59(
|
|
26379
|
+
return /* @__PURE__ */ jsxs59(Fragment38, { children: [
|
|
26194
26380
|
guide !== null ? /* @__PURE__ */ jsx74(
|
|
26195
26381
|
"span",
|
|
26196
26382
|
{
|
|
@@ -26265,7 +26451,7 @@ function GanttBarView({
|
|
|
26265
26451
|
milestone ? /* @__PURE__ */ jsx74("span", { className: Gantt_default.diamond, "aria-hidden": "true" }) : null,
|
|
26266
26452
|
pending ? /* @__PURE__ */ jsx74(Spinner, { size: "xs", className: Gantt_default.spinner, "aria-hidden": "true" }) : null,
|
|
26267
26453
|
/* @__PURE__ */ jsx74("span", { className: Gantt_default.label, "data-gantt-label": "", "aria-hidden": "true", children: bar.label }),
|
|
26268
|
-
editable && !milestone ? /* @__PURE__ */ jsxs59(
|
|
26454
|
+
editable && !milestone ? /* @__PURE__ */ jsxs59(Fragment38, { children: [
|
|
26269
26455
|
/* @__PURE__ */ jsx74("span", { className: Gantt_default.handle, "data-handle": "start", "aria-hidden": "true" }),
|
|
26270
26456
|
/* @__PURE__ */ jsx74("span", { className: Gantt_default.handle, "data-handle": "end", "aria-hidden": "true" })
|
|
26271
26457
|
] }) : null
|
|
@@ -26288,7 +26474,7 @@ function GanttBarView({
|
|
|
26288
26474
|
}
|
|
26289
26475
|
|
|
26290
26476
|
// src/components/gantt/GanttRow.tsx
|
|
26291
|
-
import { Fragment as
|
|
26477
|
+
import { Fragment as Fragment39, jsx as jsx75, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
26292
26478
|
function GanttRowView({
|
|
26293
26479
|
ctx,
|
|
26294
26480
|
index,
|
|
@@ -26326,7 +26512,7 @@ function GanttRowView({
|
|
|
26326
26512
|
const start = new Date(rangeStart);
|
|
26327
26513
|
const windowed = windowFrom <= windowTo;
|
|
26328
26514
|
const on = (event) => (native) => ctx.track(event, index, native);
|
|
26329
|
-
const content = /* @__PURE__ */ jsxs60(
|
|
26515
|
+
const content = /* @__PURE__ */ jsxs60(Fragment39, { children: [
|
|
26330
26516
|
renderRowAvatar ? /* @__PURE__ */ jsx75("span", { className: Gantt_default.rowAvatar, children: renderRowAvatar(row) }) : null,
|
|
26331
26517
|
/* @__PURE__ */ jsx75("span", { className: Gantt_default.rowLabel, children: renderRow ? renderRow(row) : label })
|
|
26332
26518
|
] });
|
|
@@ -26485,10 +26671,10 @@ function GanttRowView({
|
|
|
26485
26671
|
}
|
|
26486
26672
|
);
|
|
26487
26673
|
}
|
|
26488
|
-
var GanttRow =
|
|
26674
|
+
var GanttRow = React81.memo(GanttRowView);
|
|
26489
26675
|
|
|
26490
26676
|
// src/components/gantt/Gantt.tsx
|
|
26491
|
-
import { Fragment as
|
|
26677
|
+
import { Fragment as Fragment40, jsx as jsx76, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
26492
26678
|
var GANTT_LABELS = {
|
|
26493
26679
|
rowsHeader: "\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435",
|
|
26494
26680
|
timeline: "\u0428\u043A\u0430\u043B\u0430 \u0432\u0440\u0435\u043C\u0435\u043D\u0438",
|
|
@@ -26561,17 +26747,17 @@ function Gantt({
|
|
|
26561
26747
|
const size = tier.size;
|
|
26562
26748
|
const labels = useLabels(GANTT_LABELS, labelsProp);
|
|
26563
26749
|
const depth = useNestedSurfaceDepth();
|
|
26564
|
-
const rootRef =
|
|
26750
|
+
const rootRef = React82.useRef(null);
|
|
26565
26751
|
const mergedRootRef = useMergedRefs(rootRef, ref);
|
|
26566
|
-
const scrollRef =
|
|
26567
|
-
const axisRef =
|
|
26568
|
-
const cornerRef =
|
|
26569
|
-
const headRef =
|
|
26570
|
-
const cellNodes =
|
|
26571
|
-
const hintId =
|
|
26572
|
-
const createHintId =
|
|
26752
|
+
const scrollRef = React82.useRef(null);
|
|
26753
|
+
const axisRef = React82.useRef(null);
|
|
26754
|
+
const cornerRef = React82.useRef(null);
|
|
26755
|
+
const headRef = React82.useRef(null);
|
|
26756
|
+
const cellNodes = React82.useRef(/* @__PURE__ */ new Map());
|
|
26757
|
+
const hintId = React82.useId();
|
|
26758
|
+
const createHintId = React82.useId();
|
|
26573
26759
|
const todayTime = todayProp?.getTime();
|
|
26574
|
-
const today =
|
|
26760
|
+
const today = React82.useMemo(
|
|
26575
26761
|
() => startOfDay7(todayTime === void 0 ? /* @__PURE__ */ new Date() : new Date(todayTime)),
|
|
26576
26762
|
[todayTime]
|
|
26577
26763
|
);
|
|
@@ -26580,7 +26766,7 @@ function Gantt({
|
|
|
26580
26766
|
defaultValue: defaultScale,
|
|
26581
26767
|
onChange: onScaleChange
|
|
26582
26768
|
});
|
|
26583
|
-
const model =
|
|
26769
|
+
const model = React82.useMemo(
|
|
26584
26770
|
() => rows2.map((row) => {
|
|
26585
26771
|
const bars = getRowBars(row);
|
|
26586
26772
|
const { lanes, count } = assignLanes(bars);
|
|
@@ -26588,7 +26774,7 @@ function Gantt({
|
|
|
26588
26774
|
}),
|
|
26589
26775
|
[rows2, getRowBars, getRowKey, getRowLabel]
|
|
26590
26776
|
);
|
|
26591
|
-
const barsKey =
|
|
26777
|
+
const barsKey = React82.useMemo(() => {
|
|
26592
26778
|
let min = Number.POSITIVE_INFINITY;
|
|
26593
26779
|
let max = Number.NEGATIVE_INFINITY;
|
|
26594
26780
|
for (const item of model) {
|
|
@@ -26601,7 +26787,7 @@ function Gantt({
|
|
|
26601
26787
|
}, [model]);
|
|
26602
26788
|
const rangeStartTime = rangeProp?.start.getTime();
|
|
26603
26789
|
const rangeEndTime = rangeProp?.end.getTime();
|
|
26604
|
-
const range =
|
|
26790
|
+
const range = React82.useMemo(() => {
|
|
26605
26791
|
const [min, max] = barsKey ? barsKey.split("-").map(Number) : [];
|
|
26606
26792
|
const extent = min === void 0 ? [] : [{ start: new Date(min), end: new Date(max) }];
|
|
26607
26793
|
return resolveRange(
|
|
@@ -26612,17 +26798,17 @@ function Gantt({
|
|
|
26612
26798
|
);
|
|
26613
26799
|
}, [barsKey, today, scale, rangeStartTime, rangeEndTime]);
|
|
26614
26800
|
const totalDays = daysBetween2(range.start, range.end);
|
|
26615
|
-
const tiers =
|
|
26801
|
+
const tiers = React82.useMemo(
|
|
26616
26802
|
() => headerTiers(scale, range, today, locale),
|
|
26617
26803
|
[scale, range, today, locale]
|
|
26618
26804
|
);
|
|
26619
26805
|
const todayX = daysBetween2(range.start, today);
|
|
26620
26806
|
const todayInRange = todayX >= 0 && todayX < totalDays;
|
|
26621
|
-
const [pending, setPending] =
|
|
26622
|
-
const [announcement, setAnnouncement] =
|
|
26807
|
+
const [pending, setPending] = React82.useState(/* @__PURE__ */ new Map());
|
|
26808
|
+
const [announcement, setAnnouncement] = React82.useState("");
|
|
26623
26809
|
const editableAtAll = !readOnly && !loading && onBarChange !== void 0;
|
|
26624
26810
|
const creatable = !readOnly && !loading && onBarCreate !== void 0;
|
|
26625
|
-
const nameFor =
|
|
26811
|
+
const nameFor = React82.useCallback(
|
|
26626
26812
|
(bar, dates) => {
|
|
26627
26813
|
const name = isMilestone(dates) ? formatLabel(labels.milestone, { label: bar.label, date: formatDay(dates.start, locale) }) : formatLabel(labels.bar, {
|
|
26628
26814
|
label: bar.label,
|
|
@@ -26651,9 +26837,9 @@ function Gantt({
|
|
|
26651
26837
|
};
|
|
26652
26838
|
const shownDates = (bar) => pending.get(bar.id) ?? bar;
|
|
26653
26839
|
const isEditable = (bar) => editableAtAll && !bar.readOnly && !pending.has(bar.id);
|
|
26654
|
-
const [ghosts, setGhosts] =
|
|
26655
|
-
const ghostSeq =
|
|
26656
|
-
const setGhost =
|
|
26840
|
+
const [ghosts, setGhosts] = React82.useState(/* @__PURE__ */ new Map());
|
|
26841
|
+
const ghostSeq = React82.useRef(0);
|
|
26842
|
+
const setGhost = React82.useCallback((rowKey2, ghost) => {
|
|
26657
26843
|
setGhosts((prev) => {
|
|
26658
26844
|
const next = new Map(prev);
|
|
26659
26845
|
if (ghost) next.set(rowKey2, ghost);
|
|
@@ -26690,14 +26876,14 @@ function Gantt({
|
|
|
26690
26876
|
}
|
|
26691
26877
|
);
|
|
26692
26878
|
};
|
|
26693
|
-
const geometryCache =
|
|
26879
|
+
const geometryCache = React82.useRef({
|
|
26694
26880
|
px: null,
|
|
26695
26881
|
dir: null
|
|
26696
26882
|
});
|
|
26697
|
-
|
|
26883
|
+
React82.useLayoutEffect(() => {
|
|
26698
26884
|
geometryCache.current = { px: null, dir: null };
|
|
26699
26885
|
});
|
|
26700
|
-
const dayPx =
|
|
26886
|
+
const dayPx = React82.useCallback(() => {
|
|
26701
26887
|
const cache2 = geometryCache.current;
|
|
26702
26888
|
if (cache2.px === null) {
|
|
26703
26889
|
const axis = axisRef.current;
|
|
@@ -26705,23 +26891,23 @@ function Gantt({
|
|
|
26705
26891
|
}
|
|
26706
26892
|
return cache2.px;
|
|
26707
26893
|
}, [totalDays]);
|
|
26708
|
-
const direction =
|
|
26894
|
+
const direction = React82.useCallback(() => {
|
|
26709
26895
|
const cache2 = geometryCache.current;
|
|
26710
26896
|
cache2.dir ??= rootRef.current && getComputedStyle(rootRef.current).direction === "rtl" ? -1 : 1;
|
|
26711
26897
|
return cache2.dir;
|
|
26712
26898
|
}, []);
|
|
26713
|
-
const labelWidth =
|
|
26899
|
+
const labelWidth = React82.useCallback(
|
|
26714
26900
|
() => cornerRef.current?.getBoundingClientRect().width ?? 0,
|
|
26715
26901
|
[]
|
|
26716
26902
|
);
|
|
26717
|
-
const scrollLeft =
|
|
26718
|
-
const dayPxRef =
|
|
26903
|
+
const scrollLeft = React82.useCallback(() => scrollRef.current?.scrollLeft ?? 0, []);
|
|
26904
|
+
const dayPxRef = React82.useRef(dayPx);
|
|
26719
26905
|
dayPxRef.current = dayPx;
|
|
26720
|
-
const directionRef =
|
|
26906
|
+
const directionRef = React82.useRef(direction);
|
|
26721
26907
|
directionRef.current = direction;
|
|
26722
|
-
const onAutoScrolled =
|
|
26908
|
+
const onAutoScrolled = React82.useRef(() => {
|
|
26723
26909
|
});
|
|
26724
|
-
const [edgeScroll] =
|
|
26910
|
+
const [edgeScroll] = React82.useState(
|
|
26725
26911
|
() => createEdgeAutoScroll({
|
|
26726
26912
|
scrollers: [],
|
|
26727
26913
|
axes: { x: true, y: false },
|
|
@@ -26729,8 +26915,8 @@ function Gantt({
|
|
|
26729
26915
|
onScrolled: () => onAutoScrolled.current()
|
|
26730
26916
|
})
|
|
26731
26917
|
);
|
|
26732
|
-
|
|
26733
|
-
const autoScroll =
|
|
26918
|
+
React82.useEffect(() => () => edgeScroll.stop(), [edgeScroll]);
|
|
26919
|
+
const autoScroll = React82.useMemo(
|
|
26734
26920
|
() => ({
|
|
26735
26921
|
follow: (clientX, onScrolled) => {
|
|
26736
26922
|
const viewport2 = scrollRef.current;
|
|
@@ -26743,9 +26929,9 @@ function Gantt({
|
|
|
26743
26929
|
}),
|
|
26744
26930
|
[edgeScroll]
|
|
26745
26931
|
);
|
|
26746
|
-
const [geometry, setGeometry] =
|
|
26747
|
-
const geometryTier =
|
|
26748
|
-
|
|
26932
|
+
const [geometry, setGeometry] = React82.useState(FALLBACK_GEOMETRY);
|
|
26933
|
+
const geometryTier = React82.useRef(null);
|
|
26934
|
+
React82.useLayoutEffect(() => {
|
|
26749
26935
|
const root = rootRef.current;
|
|
26750
26936
|
if (!root || geometryTier.current === size) return;
|
|
26751
26937
|
geometryTier.current = size;
|
|
@@ -26759,8 +26945,8 @@ function Gantt({
|
|
|
26759
26945
|
(prev) => prev.padY === next.padY && prev.barH === next.barH && prev.laneGap === next.laneGap && prev.border === next.border ? prev : next
|
|
26760
26946
|
);
|
|
26761
26947
|
});
|
|
26762
|
-
const [headHeight, setHeadHeight] =
|
|
26763
|
-
|
|
26948
|
+
const [headHeight, setHeadHeight] = React82.useState(0);
|
|
26949
|
+
React82.useLayoutEffect(() => {
|
|
26764
26950
|
const height = headRef.current?.getBoundingClientRect().height ?? 0;
|
|
26765
26951
|
setHeadHeight((prev) => prev === height ? prev : height);
|
|
26766
26952
|
});
|
|
@@ -26773,7 +26959,7 @@ function Gantt({
|
|
|
26773
26959
|
]);
|
|
26774
26960
|
return { lanes, count, ghostLane: lanes.get(ghost.id) ?? 0 };
|
|
26775
26961
|
};
|
|
26776
|
-
const scrollToDay =
|
|
26962
|
+
const scrollToDay = React82.useCallback(
|
|
26777
26963
|
(day, align, smooth2) => {
|
|
26778
26964
|
const viewport2 = scrollRef.current;
|
|
26779
26965
|
if (!viewport2) return;
|
|
@@ -26788,7 +26974,7 @@ function Gantt({
|
|
|
26788
26974
|
},
|
|
26789
26975
|
[dayPx, direction, labelWidth]
|
|
26790
26976
|
);
|
|
26791
|
-
const centerDate =
|
|
26977
|
+
const centerDate = React82.useRef(null);
|
|
26792
26978
|
const rememberCenter = () => {
|
|
26793
26979
|
const viewport2 = scrollRef.current;
|
|
26794
26980
|
const px3 = dayPx();
|
|
@@ -26796,8 +26982,8 @@ function Gantt({
|
|
|
26796
26982
|
const center = Math.abs(viewport2.scrollLeft) + (viewport2.clientWidth - labelWidth()) / 2;
|
|
26797
26983
|
centerDate.current = addDays3(range.start, Math.floor(center / px3));
|
|
26798
26984
|
};
|
|
26799
|
-
const shownView =
|
|
26800
|
-
|
|
26985
|
+
const shownView = React82.useRef(null);
|
|
26986
|
+
React82.useLayoutEffect(() => {
|
|
26801
26987
|
const previous = shownView.current;
|
|
26802
26988
|
shownView.current = { scale, start: range.start.getTime() };
|
|
26803
26989
|
if (!previous) {
|
|
@@ -26811,8 +26997,8 @@ function Gantt({
|
|
|
26811
26997
|
scrollRef.current.scrollLeft += grown * dayPx() * direction();
|
|
26812
26998
|
}
|
|
26813
26999
|
}, [scale, range, todayInRange, todayX, scrollToDay, dayPx, direction]);
|
|
26814
|
-
const [timeWindow, setTimeWindow] =
|
|
26815
|
-
const updateTimeWindow =
|
|
27000
|
+
const [timeWindow, setTimeWindow] = React82.useState(null);
|
|
27001
|
+
const updateTimeWindow = React82.useCallback(() => {
|
|
26816
27002
|
const viewport2 = scrollRef.current;
|
|
26817
27003
|
const px3 = dayPx();
|
|
26818
27004
|
if (!viewport2 || px3 <= 0 || viewport2.clientWidth === 0) {
|
|
@@ -26826,14 +27012,14 @@ function Gantt({
|
|
|
26826
27012
|
const to = Math.ceil((left + 2 * visible) / step2) * step2;
|
|
26827
27013
|
setTimeWindow((prev) => prev && prev[0] === from && prev[1] === to ? prev : [from, to]);
|
|
26828
27014
|
}, [dayPx, labelWidth]);
|
|
26829
|
-
const windowAxis =
|
|
26830
|
-
|
|
27015
|
+
const windowAxis = React82.useRef(null);
|
|
27016
|
+
React82.useLayoutEffect(() => {
|
|
26831
27017
|
const axis = `${scale}:${range.start.getTime()}:${range.end.getTime()}`;
|
|
26832
27018
|
if (windowAxis.current === axis) return;
|
|
26833
27019
|
windowAxis.current = axis;
|
|
26834
27020
|
updateTimeWindow();
|
|
26835
27021
|
});
|
|
26836
|
-
|
|
27022
|
+
React82.useEffect(() => {
|
|
26837
27023
|
const viewport2 = scrollRef.current;
|
|
26838
27024
|
if (!viewport2 || typeof ResizeObserver === "undefined") return;
|
|
26839
27025
|
const observer2 = new ResizeObserver(() => {
|
|
@@ -26844,7 +27030,7 @@ function Gantt({
|
|
|
26844
27030
|
return () => observer2.disconnect();
|
|
26845
27031
|
}, [updateTimeWindow]);
|
|
26846
27032
|
const inWindow = (x, span) => !timeWindow || x + Math.max(span, 1) >= timeWindow[0] && x <= timeWindow[1];
|
|
26847
|
-
const navItems =
|
|
27033
|
+
const navItems = React82.useMemo(() => {
|
|
26848
27034
|
const items = [];
|
|
26849
27035
|
model.forEach((item, rowIndex) => {
|
|
26850
27036
|
items.push({ id: rowNavId(item.key), row: rowIndex, center: -1e9, kind: "row" });
|
|
@@ -26864,14 +27050,14 @@ function Gantt({
|
|
|
26864
27050
|
});
|
|
26865
27051
|
return items;
|
|
26866
27052
|
}, [model, pending, range.start]);
|
|
26867
|
-
const navIndex =
|
|
27053
|
+
const navIndex = React82.useMemo(
|
|
26868
27054
|
() => new Map(navItems.map((item) => [item.id, item])),
|
|
26869
27055
|
[navItems]
|
|
26870
27056
|
);
|
|
26871
|
-
const [activeId, setActiveId] =
|
|
27057
|
+
const [activeId, setActiveId] = React82.useState(null);
|
|
26872
27058
|
const tabStop = activeId && navIndex.has(activeId) ? activeId : navItems.find((item) => item.kind === "bar")?.id ?? navItems[0]?.id ?? null;
|
|
26873
|
-
const [dragging, setDragging] =
|
|
26874
|
-
const onDragChange =
|
|
27059
|
+
const [dragging, setDragging] = React82.useState(/* @__PURE__ */ new Set());
|
|
27060
|
+
const onDragChange = React82.useCallback((id, isDragging) => {
|
|
26875
27061
|
setDragging((prev) => {
|
|
26876
27062
|
const next = new Set(prev);
|
|
26877
27063
|
if (isDragging) next.add(id);
|
|
@@ -26879,7 +27065,7 @@ function Gantt({
|
|
|
26879
27065
|
return next;
|
|
26880
27066
|
});
|
|
26881
27067
|
}, []);
|
|
26882
|
-
const keyIndex =
|
|
27068
|
+
const keyIndex = React82.useMemo(
|
|
26883
27069
|
() => new Map(model.map((item, index) => [item.key, index])),
|
|
26884
27070
|
[model]
|
|
26885
27071
|
);
|
|
@@ -26898,12 +27084,12 @@ function Gantt({
|
|
|
26898
27084
|
const index = keyIndex.get(key);
|
|
26899
27085
|
if (index !== void 0) pinnedRows.push(index);
|
|
26900
27086
|
}
|
|
26901
|
-
const rowHeightOf =
|
|
27087
|
+
const rowHeightOf = React82.useCallback(
|
|
26902
27088
|
(lanes) => 2 * geometry.padY + lanes * geometry.barH + (lanes - 1) * geometry.laneGap + geometry.border,
|
|
26903
27089
|
[geometry]
|
|
26904
27090
|
);
|
|
26905
|
-
const getKey =
|
|
26906
|
-
const ghostLanes =
|
|
27091
|
+
const getKey = React82.useCallback((index) => model[index]?.key ?? index, [model]);
|
|
27092
|
+
const ghostLanes = React82.useMemo(() => {
|
|
26907
27093
|
const result = /* @__PURE__ */ new Map();
|
|
26908
27094
|
for (const [key, ghost] of ghosts) {
|
|
26909
27095
|
const index = keyIndex.get(key);
|
|
@@ -26916,18 +27102,18 @@ function Gantt({
|
|
|
26916
27102
|
}
|
|
26917
27103
|
return result;
|
|
26918
27104
|
}, [ghosts, keyIndex, model]);
|
|
26919
|
-
const lanesAt =
|
|
27105
|
+
const lanesAt = React82.useCallback(
|
|
26920
27106
|
(index) => {
|
|
26921
27107
|
const item = model[index];
|
|
26922
27108
|
return item ? ghostLanes.get(item.key) ?? item.laneCount : 1;
|
|
26923
27109
|
},
|
|
26924
27110
|
[model, ghostLanes]
|
|
26925
27111
|
);
|
|
26926
|
-
const estimateSize =
|
|
27112
|
+
const estimateSize = React82.useCallback(
|
|
26927
27113
|
(index) => rowHeightOf(lanesAt(index)),
|
|
26928
27114
|
[rowHeightOf, lanesAt]
|
|
26929
27115
|
);
|
|
26930
|
-
const getGroup =
|
|
27116
|
+
const getGroup = React82.useCallback((index) => lanesAt(index), [lanesAt]);
|
|
26931
27117
|
const virtual = useVirtualRows({
|
|
26932
27118
|
count: model.length,
|
|
26933
27119
|
scrollRef,
|
|
@@ -26954,9 +27140,9 @@ function Gantt({
|
|
|
26954
27140
|
if (rect.top < top) viewport2.scrollTop -= top - rect.top + margin;
|
|
26955
27141
|
else if (rect.bottom > view.bottom) viewport2.scrollTop += rect.bottom - view.bottom + margin;
|
|
26956
27142
|
};
|
|
26957
|
-
const openTips =
|
|
26958
|
-
const revealing =
|
|
26959
|
-
const registerTip =
|
|
27143
|
+
const openTips = React82.useRef(/* @__PURE__ */ new Map());
|
|
27144
|
+
const revealing = React82.useRef(false);
|
|
27145
|
+
const registerTip = React82.useCallback((id, close) => {
|
|
26960
27146
|
if (close) openTips.current.set(id, close);
|
|
26961
27147
|
else openTips.current.delete(id);
|
|
26962
27148
|
}, []);
|
|
@@ -26976,7 +27162,7 @@ function Gantt({
|
|
|
26976
27162
|
close();
|
|
26977
27163
|
}
|
|
26978
27164
|
};
|
|
26979
|
-
const focusTarget =
|
|
27165
|
+
const focusTarget = React82.useRef(null);
|
|
26980
27166
|
const focusNow = (id) => {
|
|
26981
27167
|
const node = cellNodes.current.get(id);
|
|
26982
27168
|
if (!node) return false;
|
|
@@ -26991,7 +27177,7 @@ function Gantt({
|
|
|
26991
27177
|
setActiveId(id);
|
|
26992
27178
|
if (!focusNow(id)) focusTarget.current = id;
|
|
26993
27179
|
};
|
|
26994
|
-
|
|
27180
|
+
React82.useLayoutEffect(() => {
|
|
26995
27181
|
const id = focusTarget.current;
|
|
26996
27182
|
if (id && focusNow(id)) focusTarget.current = null;
|
|
26997
27183
|
});
|
|
@@ -27062,7 +27248,7 @@ function Gantt({
|
|
|
27062
27248
|
start: addDays3(range.start, cell.x),
|
|
27063
27249
|
end: addDays3(range.start, cell.x + cell.span)
|
|
27064
27250
|
});
|
|
27065
|
-
const [hoverCell, setHoverCell] =
|
|
27251
|
+
const [hoverCell, setHoverCell] = React82.useState(null);
|
|
27066
27252
|
const dayAt = (track2, clientX) => {
|
|
27067
27253
|
const px3 = dayPx();
|
|
27068
27254
|
if (px3 <= 0) return null;
|
|
@@ -27070,8 +27256,8 @@ function Gantt({
|
|
|
27070
27256
|
const offset = direction() === 1 ? clientX - rect.left : rect.right - clientX;
|
|
27071
27257
|
return Math.min(Math.max(offset / px3, 0), totalDays - 1e-3);
|
|
27072
27258
|
};
|
|
27073
|
-
const drawing =
|
|
27074
|
-
const pressStart =
|
|
27259
|
+
const drawing = React82.useRef(null);
|
|
27260
|
+
const pressStart = React82.useRef(null);
|
|
27075
27261
|
const longPress = useLongPress({
|
|
27076
27262
|
enabled: creatable,
|
|
27077
27263
|
onLongPress: () => {
|
|
@@ -27119,7 +27305,7 @@ function Gantt({
|
|
|
27119
27305
|
if (commitIt && ghost && ghost.id === current.id) create(current.item, ghost.dates);
|
|
27120
27306
|
else setGhost(current.item.key, null);
|
|
27121
27307
|
};
|
|
27122
|
-
|
|
27308
|
+
React82.useEffect(() => {
|
|
27123
27309
|
const viewport2 = scrollRef.current;
|
|
27124
27310
|
if (!viewport2) return;
|
|
27125
27311
|
const hold = (event) => {
|
|
@@ -27129,9 +27315,9 @@ function Gantt({
|
|
|
27129
27315
|
return () => viewport2.removeEventListener("touchmove", hold);
|
|
27130
27316
|
}, []);
|
|
27131
27317
|
const isDrawing = [...ghosts.values()].some((ghost) => ghost.status === "drawing");
|
|
27132
|
-
const stopDrawingRef =
|
|
27318
|
+
const stopDrawingRef = React82.useRef(stopDrawing);
|
|
27133
27319
|
stopDrawingRef.current = stopDrawing;
|
|
27134
|
-
|
|
27320
|
+
React82.useEffect(() => {
|
|
27135
27321
|
if (!isDrawing) return;
|
|
27136
27322
|
const onKey = (event) => {
|
|
27137
27323
|
if (event.key !== "Escape") return;
|
|
@@ -27221,7 +27407,7 @@ function Gantt({
|
|
|
27221
27407
|
if (cell) create(item, datesOf(cell));
|
|
27222
27408
|
}
|
|
27223
27409
|
} : {};
|
|
27224
|
-
const textCache =
|
|
27410
|
+
const textCache = React82.useRef({ tier: size, widths: /* @__PURE__ */ new Map(), pad: null });
|
|
27225
27411
|
const measureBars = () => {
|
|
27226
27412
|
if (textCache.current.tier !== size) {
|
|
27227
27413
|
textCache.current = { tier: size, widths: /* @__PURE__ */ new Map(), pad: null };
|
|
@@ -27245,7 +27431,7 @@ function Gantt({
|
|
|
27245
27431
|
}
|
|
27246
27432
|
return bars;
|
|
27247
27433
|
};
|
|
27248
|
-
|
|
27434
|
+
React82.useLayoutEffect(() => {
|
|
27249
27435
|
const px3 = dayPx();
|
|
27250
27436
|
const gap = readCssLengthPx("--prime-space-2", 8);
|
|
27251
27437
|
const milestoneSize = geometry.barH;
|
|
@@ -27281,7 +27467,7 @@ function Gantt({
|
|
|
27281
27467
|
}
|
|
27282
27468
|
shiftLabels(true);
|
|
27283
27469
|
});
|
|
27284
|
-
const shiftedAt =
|
|
27470
|
+
const shiftedAt = React82.useRef(null);
|
|
27285
27471
|
const shiftLabels = (force = false) => {
|
|
27286
27472
|
const viewport2 = scrollRef.current;
|
|
27287
27473
|
if (!viewport2) return;
|
|
@@ -27316,13 +27502,13 @@ function Gantt({
|
|
|
27316
27502
|
rememberCenter();
|
|
27317
27503
|
setScale(next);
|
|
27318
27504
|
};
|
|
27319
|
-
const toolbarLatest =
|
|
27505
|
+
const toolbarLatest = React82.useRef({ changeScale, today: () => {
|
|
27320
27506
|
} });
|
|
27321
27507
|
toolbarLatest.current = {
|
|
27322
27508
|
changeScale,
|
|
27323
27509
|
today: () => scrollToDay(todayX + 0.5, 1 / 3, true)
|
|
27324
27510
|
};
|
|
27325
|
-
const toolbarActions =
|
|
27511
|
+
const toolbarActions = React82.useMemo(
|
|
27326
27512
|
() => ({
|
|
27327
27513
|
today: () => toolbarLatest.current.today(),
|
|
27328
27514
|
scale: (next) => toolbarLatest.current.changeScale(next)
|
|
@@ -27336,7 +27522,7 @@ function Gantt({
|
|
|
27336
27522
|
const lineCells = tiers.bottom.filter(
|
|
27337
27523
|
(cell) => (scale === "month" || cell.boundary) && inWindow(cell.x, 0)
|
|
27338
27524
|
);
|
|
27339
|
-
const backdrop = /* @__PURE__ */ jsxs61(
|
|
27525
|
+
const backdrop = /* @__PURE__ */ jsxs61(Fragment40, { children: [
|
|
27340
27526
|
/* @__PURE__ */ jsx76("div", { className: Gantt_default.backdropWash, "aria-hidden": "true" }),
|
|
27341
27527
|
/* @__PURE__ */ jsxs61("div", { className: Gantt_default.backdropLines, "aria-hidden": "true", children: [
|
|
27342
27528
|
lineCells.map((cell) => /* @__PURE__ */ jsx76(
|
|
@@ -27357,7 +27543,7 @@ function Gantt({
|
|
|
27357
27543
|
) : null
|
|
27358
27544
|
] })
|
|
27359
27545
|
] });
|
|
27360
|
-
const timelineRect =
|
|
27546
|
+
const timelineRect = React82.useCallback(() => {
|
|
27361
27547
|
const viewport2 = scrollRef.current;
|
|
27362
27548
|
if (!viewport2) return null;
|
|
27363
27549
|
const view = viewport2.getBoundingClientRect();
|
|
@@ -27368,17 +27554,17 @@ function Gantt({
|
|
|
27368
27554
|
bottom: view.top + viewport2.clientHeight
|
|
27369
27555
|
};
|
|
27370
27556
|
}, [labelWidth]);
|
|
27371
|
-
const timelineRectRef =
|
|
27557
|
+
const timelineRectRef = React82.useRef(timelineRect);
|
|
27372
27558
|
timelineRectRef.current = timelineRect;
|
|
27373
|
-
const anchorToVisible =
|
|
27559
|
+
const anchorToVisible = React82.useCallback((_anchor, rect) => {
|
|
27374
27560
|
const viewport2 = timelineRectRef.current();
|
|
27375
27561
|
return viewport2 && visibleSegment(rect, viewport2) || rect;
|
|
27376
27562
|
}, []);
|
|
27377
|
-
const timelineBoundary =
|
|
27563
|
+
const timelineBoundary = React82.useCallback(
|
|
27378
27564
|
() => timelineRectRef.current(),
|
|
27379
27565
|
[]
|
|
27380
27566
|
);
|
|
27381
|
-
const latest =
|
|
27567
|
+
const latest = React82.useRef({
|
|
27382
27568
|
trackHandlers,
|
|
27383
27569
|
focusCell: setActiveId,
|
|
27384
27570
|
model,
|
|
@@ -27398,8 +27584,8 @@ function Gantt({
|
|
|
27398
27584
|
nameFor,
|
|
27399
27585
|
labels
|
|
27400
27586
|
};
|
|
27401
|
-
const cellRefs =
|
|
27402
|
-
const rowContext =
|
|
27587
|
+
const cellRefs = React82.useRef(/* @__PURE__ */ new Map());
|
|
27588
|
+
const rowContext = React82.useMemo(
|
|
27403
27589
|
() => ({
|
|
27404
27590
|
register: (id) => {
|
|
27405
27591
|
let ref2 = cellRefs.current.get(id);
|
|
@@ -27684,7 +27870,7 @@ function Gantt({
|
|
|
27684
27870
|
)
|
|
27685
27871
|
) });
|
|
27686
27872
|
}
|
|
27687
|
-
var GanttToolbar =
|
|
27873
|
+
var GanttToolbar = React82.memo(function GanttToolbar2({
|
|
27688
27874
|
toolbar,
|
|
27689
27875
|
labels,
|
|
27690
27876
|
scale,
|
|
@@ -27702,13 +27888,14 @@ var GanttToolbar = React84.memo(function GanttToolbar2({
|
|
|
27702
27888
|
});
|
|
27703
27889
|
|
|
27704
27890
|
// src/components/kanban/Kanban.tsx
|
|
27705
|
-
import * as
|
|
27891
|
+
import * as React83 from "react";
|
|
27706
27892
|
|
|
27707
27893
|
// src/components/kanban/Kanban.module.css
|
|
27708
27894
|
var Kanban_default = {
|
|
27709
27895
|
root: "Kanban_root",
|
|
27710
27896
|
scroller: "Kanban_scroller",
|
|
27711
27897
|
columns: "Kanban_columns",
|
|
27898
|
+
placeholders: "Kanban_placeholders",
|
|
27712
27899
|
column: "Kanban_column",
|
|
27713
27900
|
header: "Kanban_header",
|
|
27714
27901
|
actions: "Kanban_actions",
|
|
@@ -27730,11 +27917,12 @@ var Kanban_default = {
|
|
|
27730
27917
|
footer: "Kanban_footer",
|
|
27731
27918
|
count: "Kanban_count",
|
|
27732
27919
|
skeleton: "Kanban_skeleton",
|
|
27920
|
+
skeletonTitle: "Kanban_skeletonTitle",
|
|
27733
27921
|
skeletonBadge: "Kanban_skeletonBadge"
|
|
27734
27922
|
};
|
|
27735
27923
|
|
|
27736
27924
|
// src/components/kanban/Kanban.tsx
|
|
27737
|
-
import { Fragment as
|
|
27925
|
+
import { Fragment as Fragment41, jsx as jsx77, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
27738
27926
|
var KANBAN_LABELS = {
|
|
27739
27927
|
count: "\u041A\u0430\u0440\u0442\u043E\u0447\u0435\u043A: {count}",
|
|
27740
27928
|
countLimit: "\u041A\u0430\u0440\u0442\u043E\u0447\u0435\u043A: {count} \u0438\u0437 {limit}",
|
|
@@ -27747,8 +27935,8 @@ var KANBAN_LABELS = {
|
|
|
27747
27935
|
columnMoveFailed: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0435\u0440\u0435\u043C\u0435\u0441\u0442\u0438\u0442\u044C \u043A\u043E\u043B\u043E\u043D\u043A\u0443 \xAB{column}\xBB, \u043E\u043D\u0430 \u0432\u0435\u0440\u043D\u0443\u043B\u0430\u0441\u044C \u043D\u0430 \u043C\u0435\u0441\u0442\u043E"
|
|
27748
27936
|
};
|
|
27749
27937
|
var SKELETON_CARDS = [3, 2, 1];
|
|
27750
|
-
var BoardContext =
|
|
27751
|
-
var ItemIdContext =
|
|
27938
|
+
var BoardContext = React83.createContext(null);
|
|
27939
|
+
var ItemIdContext = React83.createContext(null);
|
|
27752
27940
|
var NARROW_REM = 40;
|
|
27753
27941
|
var rootFontSize = () => typeof document === "undefined" ? 16 : Number.parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;
|
|
27754
27942
|
function KanbanRoot(props) {
|
|
@@ -27799,6 +27987,7 @@ function KanbanBoard({
|
|
|
27799
27987
|
canDrop,
|
|
27800
27988
|
variant = "plain",
|
|
27801
27989
|
loading = false,
|
|
27990
|
+
loadingColumns = 3,
|
|
27802
27991
|
disabled = false,
|
|
27803
27992
|
labels: labelsProp,
|
|
27804
27993
|
className,
|
|
@@ -27806,11 +27995,11 @@ function KanbanBoard({
|
|
|
27806
27995
|
...rest
|
|
27807
27996
|
}) {
|
|
27808
27997
|
const labels = { ...KANBAN_LABELS, ...labelsProp };
|
|
27809
|
-
const kind = `kanban-${
|
|
27998
|
+
const kind = `kanban-${React83.useId()}`;
|
|
27810
27999
|
const announce = useDragAnnouncer();
|
|
27811
|
-
const [board, setBoard] =
|
|
28000
|
+
const [board, setBoard] = React83.useState(null);
|
|
27812
28001
|
const rootRef = useMergedRefs(setBoard, ref);
|
|
27813
|
-
const boardRef =
|
|
28002
|
+
const boardRef = React83.useMemo(() => ({ current: board }), [board]);
|
|
27814
28003
|
const boardSize = useElementSize(boardRef);
|
|
27815
28004
|
const narrow = boardSize !== null && boardSize.width < NARROW_REM * rootFontSize();
|
|
27816
28005
|
const { capture: glideCards } = useFlipList({
|
|
@@ -27832,7 +28021,7 @@ function KanbanBoard({
|
|
|
27832
28021
|
});
|
|
27833
28022
|
const columnChanges = usePendingChanges(storedOrder, placeColumn);
|
|
27834
28023
|
const order = columnChanges.shown;
|
|
27835
|
-
const ordered =
|
|
28024
|
+
const ordered = React83.useMemo(() => {
|
|
27836
28025
|
const known = new Map(columns.map((column) => [column.id, column]));
|
|
27837
28026
|
const placed2 = order.flatMap((id) => {
|
|
27838
28027
|
const column = known.get(id);
|
|
@@ -27840,7 +28029,7 @@ function KanbanBoard({
|
|
|
27840
28029
|
});
|
|
27841
28030
|
return [...placed2, ...columns.filter((column) => !order.includes(column.id))];
|
|
27842
28031
|
}, [columns, order]);
|
|
27843
|
-
const byId =
|
|
28032
|
+
const byId = React83.useMemo(
|
|
27844
28033
|
() => new Map(items.map((item) => [getId(item), item])),
|
|
27845
28034
|
[items, getId]
|
|
27846
28035
|
);
|
|
@@ -27899,11 +28088,14 @@ function KanbanBoard({
|
|
|
27899
28088
|
return outcome;
|
|
27900
28089
|
};
|
|
27901
28090
|
const locked = disabled || loading;
|
|
27902
|
-
const
|
|
28091
|
+
const placeholders = loading && columns.length === 0;
|
|
28092
|
+
const [placeholdersShown, setPlaceholdersShown] = React83.useState(placeholders);
|
|
28093
|
+
if (placeholders && !placeholdersShown) setPlaceholdersShown(true);
|
|
28094
|
+
const latest = React83.useRef({ byId, getItemHref, onItemOpen, getLabel });
|
|
27903
28095
|
latest.current = { byId, getItemHref, onItemOpen, getLabel };
|
|
27904
28096
|
const links = getItemHref !== void 0;
|
|
27905
28097
|
const opens = onItemOpen !== void 0;
|
|
27906
|
-
const context =
|
|
28098
|
+
const context = React83.useMemo(
|
|
27907
28099
|
() => ({
|
|
27908
28100
|
disabled: locked,
|
|
27909
28101
|
hrefOf: (id) => {
|
|
@@ -27942,13 +28134,28 @@ function KanbanBoard({
|
|
|
27942
28134
|
snap: narrow ? "mandatory" : false,
|
|
27943
28135
|
className: Kanban_default.scroller,
|
|
27944
28136
|
"data-full-width": "true",
|
|
27945
|
-
children:
|
|
28137
|
+
children: placeholders ? (
|
|
28138
|
+
// Before the columns arrive: placeholder columns in the column geometry.
|
|
28139
|
+
/* @__PURE__ */ jsx77("div", { className: Kanban_default.placeholders, "aria-hidden": "true", children: Array.from({ length: loadingColumns }, (_, columnIndex) => (
|
|
28140
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: identical placeholder columns
|
|
28141
|
+
/* @__PURE__ */ jsxs62("div", { className: Kanban_default.column, children: [
|
|
28142
|
+
/* @__PURE__ */ jsx77("div", { className: cx(Kanban_default.header, hairline_default.bottom), children: /* @__PURE__ */ jsx77(Skeleton, { shape: "block", className: Kanban_default.skeletonTitle }) }),
|
|
28143
|
+
/* @__PURE__ */ jsx77("div", { className: Kanban_default.body, children: /* @__PURE__ */ jsx77(
|
|
28144
|
+
SkeletonCards,
|
|
28145
|
+
{
|
|
28146
|
+
count: SKELETON_CARDS[columnIndex % SKELETON_CARDS.length] ?? 1,
|
|
28147
|
+
cardDepth
|
|
28148
|
+
}
|
|
28149
|
+
) })
|
|
28150
|
+
] }, columnIndex)
|
|
28151
|
+
)) })
|
|
28152
|
+
) : /* @__PURE__ */ jsx77(
|
|
27946
28153
|
Dnd.Sortable,
|
|
27947
28154
|
{
|
|
27948
28155
|
as: "ul",
|
|
27949
28156
|
axis: "x",
|
|
27950
28157
|
handle: true,
|
|
27951
|
-
className: Kanban_default.columns,
|
|
28158
|
+
className: cx(Kanban_default.columns, placeholdersShown && enterMotion_default.enterFade),
|
|
27952
28159
|
items: ordered,
|
|
27953
28160
|
getId: getColumnId,
|
|
27954
28161
|
getLabel: (column) => formatLabel(labels.column, { column: column.title }),
|
|
@@ -27986,6 +28193,28 @@ function KanbanBoard({
|
|
|
27986
28193
|
}
|
|
27987
28194
|
) });
|
|
27988
28195
|
}
|
|
28196
|
+
function SkeletonCards({
|
|
28197
|
+
count,
|
|
28198
|
+
cardDepth
|
|
28199
|
+
}) {
|
|
28200
|
+
return /* @__PURE__ */ jsx77("div", { className: Kanban_default.list, children: Array.from({ length: count }, (_, index) => /* @__PURE__ */ jsxs62(
|
|
28201
|
+
"div",
|
|
28202
|
+
{
|
|
28203
|
+
className: cx(Kanban_default.item, Kanban_default.skeleton),
|
|
28204
|
+
"data-depth": cardDepth,
|
|
28205
|
+
"data-surface": cardDepth !== void 0 || void 0,
|
|
28206
|
+
"aria-hidden": "true",
|
|
28207
|
+
children: [
|
|
28208
|
+
/* @__PURE__ */ jsx77(Skeleton, { lines: 2 }),
|
|
28209
|
+
/* @__PURE__ */ jsxs62("div", { className: Kanban_default.footer, children: [
|
|
28210
|
+
/* @__PURE__ */ jsx77(Skeleton, { shape: "block", className: Kanban_default.skeletonBadge }),
|
|
28211
|
+
/* @__PURE__ */ jsx77(Skeleton, { shape: "circle", size: "s" })
|
|
28212
|
+
] })
|
|
28213
|
+
]
|
|
28214
|
+
},
|
|
28215
|
+
index
|
|
28216
|
+
)) });
|
|
28217
|
+
}
|
|
27989
28218
|
function KanbanColumnView({
|
|
27990
28219
|
column,
|
|
27991
28220
|
titleAs: Title,
|
|
@@ -28005,9 +28234,9 @@ function KanbanColumnView({
|
|
|
28005
28234
|
disabled,
|
|
28006
28235
|
labels
|
|
28007
28236
|
}) {
|
|
28008
|
-
const headingId =
|
|
28009
|
-
const descriptionId =
|
|
28010
|
-
const metaId =
|
|
28237
|
+
const headingId = React83.useId();
|
|
28238
|
+
const descriptionId = React83.useId();
|
|
28239
|
+
const metaId = React83.useId();
|
|
28011
28240
|
const count = cards.length;
|
|
28012
28241
|
const full = column.limit !== void 0 && count >= column.limit;
|
|
28013
28242
|
const countText = column.limit === void 0 ? formatLabel(labels.count, { count }) : formatLabel(labels.countLimit, { count, limit: column.limit });
|
|
@@ -28032,7 +28261,7 @@ function KanbanColumnView({
|
|
|
28032
28261
|
"data-reorderable": reorderable || void 0,
|
|
28033
28262
|
children: [
|
|
28034
28263
|
/* @__PURE__ */ jsx77(Title, { id: headingId, className: cx(textRole_default.titleM, Kanban_default.title), children: column.title }),
|
|
28035
|
-
loading ? null : /* @__PURE__ */ jsxs62(
|
|
28264
|
+
loading ? null : /* @__PURE__ */ jsxs62(Fragment41, { children: [
|
|
28036
28265
|
/* @__PURE__ */ jsx77(Badge.Root, { color: full ? "orange" : column.color ?? "gray", "aria-hidden": "true", children: column.limit === void 0 ? count : `${count} / ${column.limit}` }),
|
|
28037
28266
|
/* @__PURE__ */ jsx77(VisuallyHidden, { children: countText })
|
|
28038
28267
|
] }),
|
|
@@ -28053,23 +28282,7 @@ function KanbanColumnView({
|
|
|
28053
28282
|
]
|
|
28054
28283
|
}
|
|
28055
28284
|
) }),
|
|
28056
|
-
/* @__PURE__ */ jsx77(ScrollContainer, { className: Kanban_default.body, children: /* @__PURE__ */ jsx77(Crossfade, { state: loading ? "loading" : "ready", className: Kanban_default.swap, children: loading ? /* @__PURE__ */ jsx77(
|
|
28057
|
-
"div",
|
|
28058
|
-
{
|
|
28059
|
-
className: cx(Kanban_default.item, Kanban_default.skeleton),
|
|
28060
|
-
"data-depth": cardDepth,
|
|
28061
|
-
"data-surface": cardDepth !== void 0 || void 0,
|
|
28062
|
-
"aria-hidden": "true",
|
|
28063
|
-
children: [
|
|
28064
|
-
/* @__PURE__ */ jsx77(Skeleton, { lines: 2 }),
|
|
28065
|
-
/* @__PURE__ */ jsxs62("div", { className: Kanban_default.footer, children: [
|
|
28066
|
-
/* @__PURE__ */ jsx77(Skeleton, { shape: "block", className: Kanban_default.skeletonBadge }),
|
|
28067
|
-
/* @__PURE__ */ jsx77(Skeleton, { shape: "circle", size: "s" })
|
|
28068
|
-
] })
|
|
28069
|
-
]
|
|
28070
|
-
},
|
|
28071
|
-
index
|
|
28072
|
-
)) }) : /* @__PURE__ */ jsx77("div", { className: Kanban_default.drop, children: /* @__PURE__ */ jsx77(
|
|
28285
|
+
/* @__PURE__ */ jsx77(ScrollContainer, { className: Kanban_default.body, children: /* @__PURE__ */ jsx77(Crossfade, { state: loading ? "loading" : "ready", className: Kanban_default.swap, children: loading ? /* @__PURE__ */ jsx77(SkeletonCards, { count: skeletons, cardDepth }) : /* @__PURE__ */ jsx77("div", { className: Kanban_default.drop, children: /* @__PURE__ */ jsx77(
|
|
28073
28286
|
Dnd.Sortable,
|
|
28074
28287
|
{
|
|
28075
28288
|
as: "ul",
|
|
@@ -28102,9 +28315,9 @@ function KanbanItem({
|
|
|
28102
28315
|
onKeyDown,
|
|
28103
28316
|
...rest
|
|
28104
28317
|
}) {
|
|
28105
|
-
const id =
|
|
28106
|
-
const board =
|
|
28107
|
-
const linkRef =
|
|
28318
|
+
const id = React83.useContext(ItemIdContext);
|
|
28319
|
+
const board = React83.useContext(BoardContext);
|
|
28320
|
+
const linkRef = React83.useRef(null);
|
|
28108
28321
|
if (id === null || board === null) {
|
|
28109
28322
|
throw new Error("Kanban.Item must be returned from Kanban.Root renderItem");
|
|
28110
28323
|
}
|
|
@@ -28227,7 +28440,7 @@ var Kanban = {
|
|
|
28227
28440
|
};
|
|
28228
28441
|
|
|
28229
28442
|
// src/components/login-form/LoginForm.tsx
|
|
28230
|
-
import * as
|
|
28443
|
+
import * as React84 from "react";
|
|
28231
28444
|
|
|
28232
28445
|
// src/components/login-form/LoginForm.module.css
|
|
28233
28446
|
var LoginForm_default = {
|
|
@@ -28267,7 +28480,7 @@ var FOOTER_ROLE = {
|
|
|
28267
28480
|
xl: "body-m"
|
|
28268
28481
|
};
|
|
28269
28482
|
var useLoginFormSize = () => useOptionalControlSize() ?? "m";
|
|
28270
|
-
var AlignContext =
|
|
28483
|
+
var AlignContext = React84.createContext("start");
|
|
28271
28484
|
function LoginFormRoot({
|
|
28272
28485
|
size: sizeProp,
|
|
28273
28486
|
align = "start",
|
|
@@ -28295,7 +28508,7 @@ function LoginFormHeader({ className, children, ...rest }) {
|
|
|
28295
28508
|
}
|
|
28296
28509
|
LoginFormHeader.displayName = "LoginForm.Header";
|
|
28297
28510
|
function LoginFormLogo({ className, children, ...rest }) {
|
|
28298
|
-
const align =
|
|
28511
|
+
const align = React84.useContext(AlignContext);
|
|
28299
28512
|
return /* @__PURE__ */ jsx78(
|
|
28300
28513
|
"div",
|
|
28301
28514
|
{
|
|
@@ -28468,7 +28681,7 @@ function NativeSelect({
|
|
|
28468
28681
|
NativeSelect.displayName = "NativeSelect";
|
|
28469
28682
|
|
|
28470
28683
|
// src/components/notification/Notification.tsx
|
|
28471
|
-
import * as
|
|
28684
|
+
import * as React85 from "react";
|
|
28472
28685
|
|
|
28473
28686
|
// src/components/notification/Notification.module.css
|
|
28474
28687
|
var Notification_default = {
|
|
@@ -28513,7 +28726,7 @@ var REGION_LABEL_KEY = {
|
|
|
28513
28726
|
"bottom-center": "regionBottomCenter",
|
|
28514
28727
|
"bottom-right": "regionBottomRight"
|
|
28515
28728
|
};
|
|
28516
|
-
var NotificationLabelsContext =
|
|
28729
|
+
var NotificationLabelsContext = React85.createContext(NOTIFICATION_LABELS);
|
|
28517
28730
|
var TONE_ICON = {
|
|
28518
28731
|
info: "status.info",
|
|
28519
28732
|
success: "status.success",
|
|
@@ -28536,7 +28749,7 @@ function CardView({
|
|
|
28536
28749
|
stackExpanded = false,
|
|
28537
28750
|
...rest
|
|
28538
28751
|
}) {
|
|
28539
|
-
const labels =
|
|
28752
|
+
const labels = React85.useContext(NotificationLabelsContext);
|
|
28540
28753
|
const tier = useHostTier(sizeProp);
|
|
28541
28754
|
const size = tier.size;
|
|
28542
28755
|
const liveRole = tone === "danger" || tone === "warning" ? "alert" : "status";
|
|
@@ -28596,13 +28809,13 @@ function CardView({
|
|
|
28596
28809
|
);
|
|
28597
28810
|
}
|
|
28598
28811
|
function CountdownLine({ duration, paused, onEnd }) {
|
|
28599
|
-
const lineRef =
|
|
28600
|
-
const clockRef =
|
|
28601
|
-
const latest =
|
|
28602
|
-
|
|
28812
|
+
const lineRef = React85.useRef(null);
|
|
28813
|
+
const clockRef = React85.useRef(null);
|
|
28814
|
+
const latest = React85.useRef({ paused, onEnd });
|
|
28815
|
+
React85.useLayoutEffect(() => {
|
|
28603
28816
|
latest.current = { paused, onEnd };
|
|
28604
28817
|
});
|
|
28605
|
-
|
|
28818
|
+
React85.useLayoutEffect(() => {
|
|
28606
28819
|
const line = lineRef.current;
|
|
28607
28820
|
if (!line || typeof line.animate !== "function") return;
|
|
28608
28821
|
const clock = line.animate([{ transform: "scaleX(1)" }, { transform: "scaleX(0)" }], {
|
|
@@ -28618,7 +28831,7 @@ function CountdownLine({ duration, paused, onEnd }) {
|
|
|
28618
28831
|
clock.cancel();
|
|
28619
28832
|
};
|
|
28620
28833
|
}, [duration]);
|
|
28621
|
-
|
|
28834
|
+
React85.useLayoutEffect(() => {
|
|
28622
28835
|
const clock = clockRef.current;
|
|
28623
28836
|
if (!clock) return;
|
|
28624
28837
|
if (paused) clock.pause();
|
|
@@ -28634,7 +28847,7 @@ function subscribeVisibility(listener) {
|
|
|
28634
28847
|
return () => document.removeEventListener("visibilitychange", listener);
|
|
28635
28848
|
}
|
|
28636
28849
|
function useDocumentHidden() {
|
|
28637
|
-
return
|
|
28850
|
+
return React85.useSyncExternalStore(
|
|
28638
28851
|
subscribeVisibility,
|
|
28639
28852
|
() => document.visibilityState === "hidden",
|
|
28640
28853
|
() => false
|
|
@@ -28667,7 +28880,7 @@ function ToastCard({ item, paused, onDismiss, stackDepth, stackExpanded }) {
|
|
|
28667
28880
|
}
|
|
28668
28881
|
|
|
28669
28882
|
// src/components/notification/NotificationStore.tsx
|
|
28670
|
-
import * as
|
|
28883
|
+
import * as React86 from "react";
|
|
28671
28884
|
import { jsx as jsx81, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
28672
28885
|
var DEFAULT_DURATION = 5e3;
|
|
28673
28886
|
var PEEK_VISIBLE = 3;
|
|
@@ -28716,18 +28929,18 @@ function NotificationStack({
|
|
|
28716
28929
|
onDismiss,
|
|
28717
28930
|
onExited
|
|
28718
28931
|
}) {
|
|
28719
|
-
const labels =
|
|
28720
|
-
const [expanded, setExpanded] =
|
|
28721
|
-
const [heights, setHeights] =
|
|
28722
|
-
const collapseTimerRef =
|
|
28723
|
-
const lastLayoutRef =
|
|
28724
|
-
const listRef =
|
|
28725
|
-
const hoveredRef =
|
|
28726
|
-
const focusedRef =
|
|
28727
|
-
const returnRef =
|
|
28932
|
+
const labels = React86.useContext(NotificationLabelsContext);
|
|
28933
|
+
const [expanded, setExpanded] = React86.useState(false);
|
|
28934
|
+
const [heights, setHeights] = React86.useState({});
|
|
28935
|
+
const collapseTimerRef = React86.useRef(null);
|
|
28936
|
+
const lastLayoutRef = React86.useRef(/* @__PURE__ */ new Map());
|
|
28937
|
+
const listRef = React86.useRef(null);
|
|
28938
|
+
const hoveredRef = React86.useRef(false);
|
|
28939
|
+
const focusedRef = React86.useRef(false);
|
|
28940
|
+
const returnRef = React86.useRef(null);
|
|
28728
28941
|
const top = isTop(position);
|
|
28729
|
-
const step2 =
|
|
28730
|
-
const syncExpanded =
|
|
28942
|
+
const step2 = React86.useMemo(space2Px, []);
|
|
28943
|
+
const syncExpanded = React86.useCallback(() => {
|
|
28731
28944
|
if (collapseTimerRef.current !== null) {
|
|
28732
28945
|
clearTimeout(collapseTimerRef.current);
|
|
28733
28946
|
collapseTimerRef.current = null;
|
|
@@ -28738,29 +28951,29 @@ function NotificationStack({
|
|
|
28738
28951
|
collapseTimerRef.current = window.setTimeout(() => setExpanded(false), COLLAPSE_DELAY_MS);
|
|
28739
28952
|
}
|
|
28740
28953
|
}, []);
|
|
28741
|
-
const handleHover =
|
|
28954
|
+
const handleHover = React86.useCallback(
|
|
28742
28955
|
(hovered) => {
|
|
28743
28956
|
hoveredRef.current = hovered;
|
|
28744
28957
|
syncExpanded();
|
|
28745
28958
|
},
|
|
28746
28959
|
[syncExpanded]
|
|
28747
28960
|
);
|
|
28748
|
-
|
|
28961
|
+
React86.useLayoutEffect(() => {
|
|
28749
28962
|
if (!focusedRef.current) return;
|
|
28750
28963
|
if (listRef.current?.contains(document.activeElement)) return;
|
|
28751
28964
|
focusedRef.current = false;
|
|
28752
28965
|
syncExpanded();
|
|
28753
28966
|
});
|
|
28754
|
-
|
|
28967
|
+
React86.useEffect(
|
|
28755
28968
|
() => () => {
|
|
28756
28969
|
if (collapseTimerRef.current !== null) clearTimeout(collapseTimerRef.current);
|
|
28757
28970
|
},
|
|
28758
28971
|
[]
|
|
28759
28972
|
);
|
|
28760
|
-
const reportHeight =
|
|
28973
|
+
const reportHeight = React86.useCallback((id, height) => {
|
|
28761
28974
|
setHeights((prev) => prev[id] === height ? prev : { ...prev, [id]: height });
|
|
28762
28975
|
}, []);
|
|
28763
|
-
|
|
28976
|
+
React86.useEffect(() => {
|
|
28764
28977
|
setHeights((prev) => {
|
|
28765
28978
|
const ids = new Set(items.map((n) => n.id));
|
|
28766
28979
|
const stale = Object.keys(prev).filter((id) => !ids.has(id));
|
|
@@ -28787,12 +29000,12 @@ function NotificationStack({
|
|
|
28787
29000
|
});
|
|
28788
29001
|
const frontHeight = active.length > 0 ? heights[active[0].id] ?? 0 : 0;
|
|
28789
29002
|
const stackHeight = active.length === 0 ? 0 : expanded ? flowHeight - step2 : frontHeight + Math.min(active.length - 1, PEEK_VISIBLE - 1) * step2;
|
|
28790
|
-
const nextFocus =
|
|
29003
|
+
const nextFocus = React86.useCallback((leaving) => {
|
|
28791
29004
|
const cards = Array.from(listRef.current?.children ?? []);
|
|
28792
29005
|
const open = cards.find((card) => card !== leaving && card.dataset.state === "open");
|
|
28793
29006
|
return open ?? returnRef.current;
|
|
28794
29007
|
}, []);
|
|
28795
|
-
|
|
29008
|
+
React86.useLayoutEffect(() => {
|
|
28796
29009
|
for (const [id, layout] of layouts) lastLayoutRef.current.set(id, layout);
|
|
28797
29010
|
const ids = new Set(items.map((n) => n.id));
|
|
28798
29011
|
for (const id of lastLayoutRef.current.keys()) {
|
|
@@ -28849,7 +29062,7 @@ function NotificationStack({
|
|
|
28849
29062
|
}
|
|
28850
29063
|
);
|
|
28851
29064
|
}
|
|
28852
|
-
var NotificationStackItem =
|
|
29065
|
+
var NotificationStackItem = React86.memo(function NotificationStackItem2({
|
|
28853
29066
|
item,
|
|
28854
29067
|
position,
|
|
28855
29068
|
index,
|
|
@@ -28864,19 +29077,19 @@ var NotificationStackItem = React88.memo(function NotificationStackItem2({
|
|
|
28864
29077
|
onHeight,
|
|
28865
29078
|
nextFocus
|
|
28866
29079
|
}) {
|
|
28867
|
-
const ref =
|
|
29080
|
+
const ref = React86.useRef(null);
|
|
28868
29081
|
const { id } = item;
|
|
28869
|
-
|
|
29082
|
+
React86.useLayoutEffect(() => {
|
|
28870
29083
|
const node = ref.current;
|
|
28871
29084
|
if (closing && node) handoffFocus(node, nextFocus(node));
|
|
28872
29085
|
}, [closing, nextFocus]);
|
|
28873
|
-
|
|
29086
|
+
React86.useLayoutEffect(() => {
|
|
28874
29087
|
const node = ref.current;
|
|
28875
29088
|
return () => {
|
|
28876
29089
|
if (node) handoffFocus(node, nextFocus(node));
|
|
28877
29090
|
};
|
|
28878
29091
|
}, [nextFocus]);
|
|
28879
|
-
|
|
29092
|
+
React86.useLayoutEffect(() => {
|
|
28880
29093
|
const el = ref.current;
|
|
28881
29094
|
if (!el) return;
|
|
28882
29095
|
onHeight(id, el.offsetHeight);
|
|
@@ -28887,10 +29100,10 @@ var NotificationStackItem = React88.memo(function NotificationStackItem2({
|
|
|
28887
29100
|
}, [id, onHeight]);
|
|
28888
29101
|
const state = closing ? "closed" : "open";
|
|
28889
29102
|
const { axis, sign } = swipeDirection(position);
|
|
28890
|
-
const dragRef =
|
|
29103
|
+
const dragRef = React86.useRef(
|
|
28891
29104
|
null
|
|
28892
29105
|
);
|
|
28893
|
-
const [swiping, setSwiping] =
|
|
29106
|
+
const [swiping, setSwiping] = React86.useState(false);
|
|
28894
29107
|
const swipeAmount = (client, origin) => {
|
|
28895
29108
|
const toward = (client - origin) * sign;
|
|
28896
29109
|
if (toward >= 0) return toward;
|
|
@@ -28992,7 +29205,7 @@ function NotificationToaster({
|
|
|
28992
29205
|
onDismiss,
|
|
28993
29206
|
onExited
|
|
28994
29207
|
}) {
|
|
28995
|
-
const grouped =
|
|
29208
|
+
const grouped = React86.useMemo(() => {
|
|
28996
29209
|
const map = /* @__PURE__ */ new Map();
|
|
28997
29210
|
for (const entry of entries) {
|
|
28998
29211
|
if (!map.has(entry.position)) map.set(entry.position, /* @__PURE__ */ new Map());
|
|
@@ -29041,25 +29254,25 @@ function NotificationProvider({
|
|
|
29041
29254
|
labels: labelsProp
|
|
29042
29255
|
}) {
|
|
29043
29256
|
const labels = useLabels(NOTIFICATION_LABELS, labelsProp);
|
|
29044
|
-
const [entries, setEntries] =
|
|
29045
|
-
const entriesRef =
|
|
29046
|
-
const update2 =
|
|
29257
|
+
const [entries, setEntries] = React86.useState([]);
|
|
29258
|
+
const entriesRef = React86.useRef(entries);
|
|
29259
|
+
const update2 = React86.useCallback(
|
|
29047
29260
|
(change) => {
|
|
29048
29261
|
entriesRef.current = change(entriesRef.current);
|
|
29049
29262
|
setEntries(entriesRef.current);
|
|
29050
29263
|
},
|
|
29051
29264
|
[]
|
|
29052
29265
|
);
|
|
29053
|
-
const announcedRef =
|
|
29054
|
-
const exitTimersRef =
|
|
29055
|
-
|
|
29266
|
+
const announcedRef = React86.useRef(/* @__PURE__ */ new Set());
|
|
29267
|
+
const exitTimersRef = React86.useRef(/* @__PURE__ */ new Map());
|
|
29268
|
+
React86.useEffect(() => {
|
|
29056
29269
|
const timers = exitTimersRef.current;
|
|
29057
29270
|
return () => {
|
|
29058
29271
|
for (const timer of timers.values()) clearTimeout(timer);
|
|
29059
29272
|
timers.clear();
|
|
29060
29273
|
};
|
|
29061
29274
|
}, []);
|
|
29062
|
-
const remove =
|
|
29275
|
+
const remove = React86.useCallback(
|
|
29063
29276
|
(ids) => {
|
|
29064
29277
|
const target = new Set(ids);
|
|
29065
29278
|
for (const id of ids) {
|
|
@@ -29072,7 +29285,7 @@ function NotificationProvider({
|
|
|
29072
29285
|
},
|
|
29073
29286
|
[update2]
|
|
29074
29287
|
);
|
|
29075
|
-
const startExit =
|
|
29288
|
+
const startExit = React86.useCallback(
|
|
29076
29289
|
(ids, reason) => {
|
|
29077
29290
|
const leaving = entriesRef.current.filter(
|
|
29078
29291
|
(n) => ids.includes(n.id) && !announcedRef.current.has(n.id)
|
|
@@ -29096,20 +29309,20 @@ function NotificationProvider({
|
|
|
29096
29309
|
},
|
|
29097
29310
|
[remove, update2]
|
|
29098
29311
|
);
|
|
29099
|
-
const dismiss =
|
|
29100
|
-
const leave =
|
|
29312
|
+
const dismiss = React86.useCallback((id) => startExit([id], "dismiss"), [startExit]);
|
|
29313
|
+
const leave = React86.useCallback(
|
|
29101
29314
|
(id, reason) => startExit([id], reason),
|
|
29102
29315
|
[startExit]
|
|
29103
29316
|
);
|
|
29104
|
-
const exited =
|
|
29105
|
-
const dismissAll =
|
|
29317
|
+
const exited = React86.useCallback((id) => remove([id]), [remove]);
|
|
29318
|
+
const dismissAll = React86.useCallback(
|
|
29106
29319
|
() => startExit(
|
|
29107
29320
|
entriesRef.current.filter((n) => !n.dismissing).map((n) => n.id),
|
|
29108
29321
|
"dismiss"
|
|
29109
29322
|
),
|
|
29110
29323
|
[startExit]
|
|
29111
29324
|
);
|
|
29112
|
-
const notify =
|
|
29325
|
+
const notify = React86.useCallback(
|
|
29113
29326
|
(options) => {
|
|
29114
29327
|
const id = newId();
|
|
29115
29328
|
const record = {
|
|
@@ -29135,8 +29348,8 @@ function NotificationProvider({
|
|
|
29135
29348
|
},
|
|
29136
29349
|
[position, max, update2, startExit]
|
|
29137
29350
|
);
|
|
29138
|
-
const publicItems =
|
|
29139
|
-
const value =
|
|
29351
|
+
const publicItems = React86.useMemo(() => entries.filter((n) => !n.dismissing), [entries]);
|
|
29352
|
+
const value = React86.useMemo(
|
|
29140
29353
|
() => ({ items: publicItems, notify, dismiss, dismissAll }),
|
|
29141
29354
|
[publicItems, notify, dismiss, dismissAll]
|
|
29142
29355
|
);
|
|
@@ -29150,7 +29363,7 @@ function useNotifications() {
|
|
|
29150
29363
|
}
|
|
29151
29364
|
|
|
29152
29365
|
// src/components/progress-circle/ProgressCircle.tsx
|
|
29153
|
-
import * as
|
|
29366
|
+
import * as React87 from "react";
|
|
29154
29367
|
|
|
29155
29368
|
// src/components/progress-circle/ProgressCircle.module.css
|
|
29156
29369
|
var ProgressCircle_default = {
|
|
@@ -29168,7 +29381,7 @@ var ProgressCircle_default = {
|
|
|
29168
29381
|
};
|
|
29169
29382
|
|
|
29170
29383
|
// src/components/progress-circle/ProgressCircle.tsx
|
|
29171
|
-
import { Fragment as
|
|
29384
|
+
import { Fragment as Fragment42, jsx as jsx82, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
29172
29385
|
var HAIRLINE_GAP = RING_DATA_STROKE * 0.75;
|
|
29173
29386
|
var LOADING_ROWS3 = 3;
|
|
29174
29387
|
function arcStyle(start, length) {
|
|
@@ -29190,7 +29403,7 @@ function SegmentArcs({
|
|
|
29190
29403
|
}) {
|
|
29191
29404
|
if (gap === "hairline" && arcs.length > 1) {
|
|
29192
29405
|
const inset = (RING_DATA_STROKE + HAIRLINE_GAP) / 2;
|
|
29193
|
-
return /* @__PURE__ */ jsx82(
|
|
29406
|
+
return /* @__PURE__ */ jsx82(Fragment42, { children: arcs.map((a, i) => {
|
|
29194
29407
|
const own = a.rest ? { className: void 0 } : fillProps(a.fill);
|
|
29195
29408
|
return /* @__PURE__ */ jsx82(
|
|
29196
29409
|
RingCircle,
|
|
@@ -29206,7 +29419,7 @@ function SegmentArcs({
|
|
|
29206
29419
|
const parts = arcs.filter((a) => !a.rest);
|
|
29207
29420
|
const first = parts[0];
|
|
29208
29421
|
const last = parts[parts.length - 1];
|
|
29209
|
-
return /* @__PURE__ */ jsxs66(
|
|
29422
|
+
return /* @__PURE__ */ jsxs66(Fragment42, { children: [
|
|
29210
29423
|
parts.map((a, i) => {
|
|
29211
29424
|
const own = fillProps(a.fill);
|
|
29212
29425
|
return /* @__PURE__ */ jsx82(
|
|
@@ -29219,7 +29432,7 @@ function SegmentArcs({
|
|
|
29219
29432
|
i
|
|
29220
29433
|
);
|
|
29221
29434
|
}),
|
|
29222
|
-
first && last && !closed ? /* @__PURE__ */ jsxs66(
|
|
29435
|
+
first && last && !closed ? /* @__PURE__ */ jsxs66(Fragment42, { children: [
|
|
29223
29436
|
/* @__PURE__ */ jsx82(Cap, { position: first.start, fill: first.fill }),
|
|
29224
29437
|
/* @__PURE__ */ jsx82(Cap, { position: last.start + last.length, fill: last.fill })
|
|
29225
29438
|
] }) : null
|
|
@@ -29247,7 +29460,7 @@ function ProgressCircle(props) {
|
|
|
29247
29460
|
labels,
|
|
29248
29461
|
...rest
|
|
29249
29462
|
} = props;
|
|
29250
|
-
const descriptionId =
|
|
29463
|
+
const descriptionId = React87.useId();
|
|
29251
29464
|
const { size, provide } = useHostTier(sizeProp);
|
|
29252
29465
|
const segmentLabels = useLabels(PROGRESS_SEGMENTS_LABELS, labels);
|
|
29253
29466
|
const isText2 = typeof children === "string" || typeof children === "number";
|
|
@@ -29324,7 +29537,7 @@ function ProgressCircle(props) {
|
|
|
29324
29537
|
}
|
|
29325
29538
|
);
|
|
29326
29539
|
}
|
|
29327
|
-
const body = /* @__PURE__ */ jsxs66(
|
|
29540
|
+
const body = /* @__PURE__ */ jsxs66(Fragment42, { children: [
|
|
29328
29541
|
/* @__PURE__ */ jsx82(RegionSwap, { state: loading ? "loading" : "data", fill: true, children: loading ? /* @__PURE__ */ jsx82(Skeleton, { shape: "block", className: ProgressCircle_default.ringSkeleton }) : ring }),
|
|
29329
29542
|
loading ? null : description,
|
|
29330
29543
|
showInner ? /* @__PURE__ */ jsx82(
|
|
@@ -29355,7 +29568,7 @@ function ProgressCircle(props) {
|
|
|
29355
29568
|
}
|
|
29356
29569
|
|
|
29357
29570
|
// src/components/radio/Radio.tsx
|
|
29358
|
-
import * as
|
|
29571
|
+
import * as React88 from "react";
|
|
29359
29572
|
|
|
29360
29573
|
// src/components/radio/Radio.module.css
|
|
29361
29574
|
var Radio_default = {
|
|
@@ -29366,7 +29579,7 @@ var Radio_default = {
|
|
|
29366
29579
|
};
|
|
29367
29580
|
|
|
29368
29581
|
// src/components/radio/Radio.tsx
|
|
29369
|
-
import { Fragment as
|
|
29582
|
+
import { Fragment as Fragment43, jsx as jsx83, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
29370
29583
|
var RADIO_GROUP_LABELS = { optional: "\u043D\u0435\u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E" };
|
|
29371
29584
|
var [RadioGroupProvider, useRadioGroupContext] = createComponentContext("Radio.Group");
|
|
29372
29585
|
function RadioGroup({
|
|
@@ -29399,7 +29612,7 @@ function RadioGroup({
|
|
|
29399
29612
|
const disabled = useInheritedDisabled(disabledProp);
|
|
29400
29613
|
const ids = useFieldFrame(id, { label, hint, error, invalid }, ariaDescribedBy);
|
|
29401
29614
|
const name = nameProp ?? ids.controlId;
|
|
29402
|
-
const reportChange =
|
|
29615
|
+
const reportChange = React88.useCallback(
|
|
29403
29616
|
(next) => {
|
|
29404
29617
|
if (next !== void 0) onValueChange?.(next);
|
|
29405
29618
|
},
|
|
@@ -29410,7 +29623,7 @@ function RadioGroup({
|
|
|
29410
29623
|
defaultValue,
|
|
29411
29624
|
onChange: reportChange
|
|
29412
29625
|
});
|
|
29413
|
-
const ctxValue =
|
|
29626
|
+
const ctxValue = React88.useMemo(
|
|
29414
29627
|
() => ({ name, value, setValue, size, disabled, invalid: ids.invalid, required }),
|
|
29415
29628
|
[name, value, setValue, size, disabled, ids.invalid, required]
|
|
29416
29629
|
);
|
|
@@ -29479,7 +29692,7 @@ function RadioRoot({
|
|
|
29479
29692
|
hint,
|
|
29480
29693
|
hintTone,
|
|
29481
29694
|
className: cx(Radio_default.root, className),
|
|
29482
|
-
control: /* @__PURE__ */ jsxs67(
|
|
29695
|
+
control: /* @__PURE__ */ jsxs67(Fragment43, { children: [
|
|
29483
29696
|
/* @__PURE__ */ jsx83(
|
|
29484
29697
|
"input",
|
|
29485
29698
|
{
|
|
@@ -29579,7 +29792,7 @@ var Sheet = {
|
|
|
29579
29792
|
};
|
|
29580
29793
|
|
|
29581
29794
|
// src/components/sparkline/Sparkline.tsx
|
|
29582
|
-
import * as
|
|
29795
|
+
import * as React89 from "react";
|
|
29583
29796
|
|
|
29584
29797
|
// src/components/sparkline/geometry.ts
|
|
29585
29798
|
var r = (n) => Math.round(n * 100) / 100;
|
|
@@ -29697,7 +29910,7 @@ var Sparkline_default = {
|
|
|
29697
29910
|
};
|
|
29698
29911
|
|
|
29699
29912
|
// src/components/sparkline/Sparkline.tsx
|
|
29700
|
-
import { Fragment as
|
|
29913
|
+
import { Fragment as Fragment44, jsx as jsx86, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
29701
29914
|
var SPARKLINE_LABELS = {
|
|
29702
29915
|
point: "{label}: {value}",
|
|
29703
29916
|
period: "{first} \u2013 {last}",
|
|
@@ -29747,19 +29960,19 @@ function Sparkline({
|
|
|
29747
29960
|
const bars = variant === "bars";
|
|
29748
29961
|
const compact = layout === "compact";
|
|
29749
29962
|
const restIndex = highlight !== void 0 && highlight >= 0 && highlight <= last ? Math.floor(highlight) : latestPresent(data);
|
|
29750
|
-
const [active, setActive] =
|
|
29963
|
+
const [active, setActive] = React89.useState(null);
|
|
29751
29964
|
const index = active === null ? restIndex : Math.min(active, last);
|
|
29752
29965
|
const atRest = active === null;
|
|
29753
29966
|
const point = data[index];
|
|
29754
|
-
const plotRef =
|
|
29755
|
-
const [pointer, setPointer] =
|
|
29756
|
-
const referenceId =
|
|
29967
|
+
const plotRef = React89.useRef(null);
|
|
29968
|
+
const [pointer, setPointer] = React89.useState(null);
|
|
29969
|
+
const referenceId = React89.useId();
|
|
29757
29970
|
const gradientId = `sparkline-${referenceId.replace(/[^\w-]/g, "")}`;
|
|
29758
|
-
const [series, setSeries] =
|
|
29971
|
+
const [series, setSeries] = React89.useState({ data, version: 0 });
|
|
29759
29972
|
if (series.data !== data) setSeries({ data, version: series.version + 1 });
|
|
29760
29973
|
const version = series.data === data ? series.version : series.version + 1;
|
|
29761
29974
|
const stateKey = loading ? "loading" : "data";
|
|
29762
|
-
const geometry =
|
|
29975
|
+
const geometry = React89.useMemo(() => {
|
|
29763
29976
|
const values = data.map((p) => p.value);
|
|
29764
29977
|
const scale = scaleOf(values, [min, max, reference, bars ? 0 : void 0]);
|
|
29765
29978
|
const count = Math.max(data.length, 1);
|
|
@@ -29780,7 +29993,7 @@ function Sparkline({
|
|
|
29780
29993
|
};
|
|
29781
29994
|
}, [data, bars, curve, min, max, reference]);
|
|
29782
29995
|
const { x, y } = geometry;
|
|
29783
|
-
const drawing =
|
|
29996
|
+
const drawing = React89.useMemo(() => {
|
|
29784
29997
|
const { paths } = geometry;
|
|
29785
29998
|
if (!paths) return null;
|
|
29786
29999
|
return /* @__PURE__ */ jsxs68("div", { className: Sparkline_default.drawing, "aria-hidden": "true", children: [
|
|
@@ -29792,7 +30005,7 @@ function Sparkline({
|
|
|
29792
30005
|
preserveAspectRatio: "none",
|
|
29793
30006
|
"aria-hidden": "true",
|
|
29794
30007
|
children: [
|
|
29795
|
-
variant === "area" && paths.area ? /* @__PURE__ */ jsxs68(
|
|
30008
|
+
variant === "area" && paths.area ? /* @__PURE__ */ jsxs68(Fragment44, { children: [
|
|
29796
30009
|
/* @__PURE__ */ jsx86("defs", { children: /* @__PURE__ */ jsxs68("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
29797
30010
|
/* @__PURE__ */ jsx86("stop", { offset: "0", className: Sparkline_default.fadeTop }),
|
|
29798
30011
|
/* @__PURE__ */ jsx86("stop", { offset: "1", className: Sparkline_default.fadeBottom })
|
|
@@ -29846,7 +30059,7 @@ function Sparkline({
|
|
|
29846
30059
|
"data-size": compact ? "xs" : void 0,
|
|
29847
30060
|
"aria-busy": loading || void 0,
|
|
29848
30061
|
children: [
|
|
29849
|
-
compact ? null : /* @__PURE__ */ jsxs68(
|
|
30062
|
+
compact ? null : /* @__PURE__ */ jsxs68(Fragment44, { children: [
|
|
29850
30063
|
/* @__PURE__ */ jsxs68("div", { className: Sparkline_default.head, children: [
|
|
29851
30064
|
/* @__PURE__ */ jsx86("span", { className: Sparkline_default.label, children: label }),
|
|
29852
30065
|
/* @__PURE__ */ jsx86(RegionSwap, { state: stateKey, className: Sparkline_default.date, children: loading ? /* @__PURE__ */ jsx86(Skeleton, { shape: "text", size: "s", className: Sparkline_default.dateSkeleton }) : headDate })
|
|
@@ -29974,7 +30187,7 @@ function Sparkline({
|
|
|
29974
30187
|
}
|
|
29975
30188
|
|
|
29976
30189
|
// src/components/stepper/Stepper.tsx
|
|
29977
|
-
import * as
|
|
30190
|
+
import * as React90 from "react";
|
|
29978
30191
|
|
|
29979
30192
|
// src/components/stepper/Stepper.module.css
|
|
29980
30193
|
var Stepper_default = {
|
|
@@ -29997,7 +30210,7 @@ var STEPPER_LABELS = {
|
|
|
29997
30210
|
};
|
|
29998
30211
|
var [StepperRootProvider, useStepperRootContext] = createComponentContext("Stepper");
|
|
29999
30212
|
var [StepperItemProvider, useStepperItemContext] = createComponentContext("Stepper.Item");
|
|
30000
|
-
var StepperIndexContext =
|
|
30213
|
+
var StepperIndexContext = React90.createContext(null);
|
|
30001
30214
|
function deriveStatus(index, current) {
|
|
30002
30215
|
if (index < current) return "completed";
|
|
30003
30216
|
if (index === current) return "current";
|
|
@@ -30022,14 +30235,14 @@ function StepperRoot({
|
|
|
30022
30235
|
});
|
|
30023
30236
|
const labels = useLabels(STEPPER_LABELS, labelsProp);
|
|
30024
30237
|
const tier = useHostTier(sizeProp);
|
|
30025
|
-
const contextValue =
|
|
30238
|
+
const contextValue = React90.useMemo(
|
|
30026
30239
|
() => ({ value, select: setValue, orientation, arrows, labels }),
|
|
30027
30240
|
[value, setValue, orientation, arrows, labels]
|
|
30028
30241
|
);
|
|
30029
30242
|
let nextIndex = 0;
|
|
30030
30243
|
const items = [];
|
|
30031
|
-
for (const child of
|
|
30032
|
-
if (!
|
|
30244
|
+
for (const child of React90.Children.toArray(children)) {
|
|
30245
|
+
if (!React90.isValidElement(child) || child.type !== StepperItem) {
|
|
30033
30246
|
items.push(child);
|
|
30034
30247
|
continue;
|
|
30035
30248
|
}
|
|
@@ -30062,12 +30275,12 @@ function StepperItem({
|
|
|
30062
30275
|
...rest
|
|
30063
30276
|
}) {
|
|
30064
30277
|
const { value, select, orientation, arrows, labels } = useStepperRootContext();
|
|
30065
|
-
const index =
|
|
30278
|
+
const index = React90.useContext(StepperIndexContext);
|
|
30066
30279
|
if (index === null) {
|
|
30067
30280
|
throw new Error("Stepper.Item must be a direct child of Stepper.Root");
|
|
30068
30281
|
}
|
|
30069
30282
|
const status = statusProp ?? deriveStatus(index, value);
|
|
30070
|
-
const itemContext =
|
|
30283
|
+
const itemContext = React90.useMemo(() => ({ index, status }), [index, status]);
|
|
30071
30284
|
const spokenStatus = status === "completed" ? labels.completed : status === "danger" ? labels.danger : null;
|
|
30072
30285
|
return /* @__PURE__ */ jsx87(StepperItemProvider, { value: itemContext, children: /* @__PURE__ */ jsxs69("li", { className: Stepper_default.item, children: [
|
|
30073
30286
|
/* @__PURE__ */ jsx87("span", { className: Stepper_default.separator, "aria-hidden": "true", children: /* @__PURE__ */ jsx87(Icon, { name: "nav.chevronRight", strokeWidth: 2 }) }),
|
|
@@ -30147,7 +30360,7 @@ var Switch_default = {
|
|
|
30147
30360
|
};
|
|
30148
30361
|
|
|
30149
30362
|
// src/components/switch/Switch.tsx
|
|
30150
|
-
import { Fragment as
|
|
30363
|
+
import { Fragment as Fragment45, jsx as jsx88, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
30151
30364
|
var SWITCH_LABELS = { optional: "\u043D\u0435\u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E" };
|
|
30152
30365
|
function SwitchRoot({
|
|
30153
30366
|
id,
|
|
@@ -30205,7 +30418,7 @@ function SwitchRoot({
|
|
|
30205
30418
|
hintTone,
|
|
30206
30419
|
error,
|
|
30207
30420
|
className: cx(Switch_default.root, className),
|
|
30208
|
-
control: /* @__PURE__ */ jsxs70(
|
|
30421
|
+
control: /* @__PURE__ */ jsxs70(Fragment45, { children: [
|
|
30209
30422
|
/* @__PURE__ */ jsx88(
|
|
30210
30423
|
"input",
|
|
30211
30424
|
{
|
|
@@ -30252,7 +30465,7 @@ var Switch = {
|
|
|
30252
30465
|
};
|
|
30253
30466
|
|
|
30254
30467
|
// src/components/tabs/Tabs.tsx
|
|
30255
|
-
import * as
|
|
30468
|
+
import * as React91 from "react";
|
|
30256
30469
|
|
|
30257
30470
|
// src/components/tabs/Tabs.module.css
|
|
30258
30471
|
var Tabs_default = {
|
|
@@ -30276,12 +30489,12 @@ var Tabs_default = {
|
|
|
30276
30489
|
};
|
|
30277
30490
|
|
|
30278
30491
|
// src/components/tabs/Tabs.tsx
|
|
30279
|
-
import { Fragment as
|
|
30492
|
+
import { Fragment as Fragment46, jsx as jsx89, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
30280
30493
|
var TABS_LABELS = {
|
|
30281
30494
|
remove: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u0432\u043A\u043B\u0430\u0434\u043A\u0443 \xAB{label}\xBB"
|
|
30282
30495
|
};
|
|
30283
30496
|
var [TabsProvider, useTabsContext] = createComponentContext("Tabs");
|
|
30284
|
-
var CollapseContext2 =
|
|
30497
|
+
var CollapseContext2 = React91.createContext("full");
|
|
30285
30498
|
var idPart = (value) => value.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
30286
30499
|
var tabId = (rootId, value) => `prime-ui-kit-tab-${rootId}-${idPart(value)}`;
|
|
30287
30500
|
var panelId = (rootId, value) => `prime-ui-kit-panel-${rootId}-${idPart(value)}`;
|
|
@@ -30302,11 +30515,11 @@ function TabsRoot({
|
|
|
30302
30515
|
style,
|
|
30303
30516
|
...rest
|
|
30304
30517
|
}) {
|
|
30305
|
-
const rootId =
|
|
30518
|
+
const rootId = React91.useId();
|
|
30306
30519
|
const tier = useHostTier(sizeProp);
|
|
30307
30520
|
const size = tier.size;
|
|
30308
|
-
const [panels, setPanels] =
|
|
30309
|
-
const registerPanel =
|
|
30521
|
+
const [panels, setPanels] = React91.useState(() => /* @__PURE__ */ new Set());
|
|
30522
|
+
const registerPanel = React91.useCallback((panel) => {
|
|
30310
30523
|
setPanels((prev) => new Set(prev).add(panel));
|
|
30311
30524
|
return () => setPanels((prev) => {
|
|
30312
30525
|
const next = new Set(prev);
|
|
@@ -30320,8 +30533,8 @@ function TabsRoot({
|
|
|
30320
30533
|
onChange: onValueChange
|
|
30321
30534
|
});
|
|
30322
30535
|
const resolvedLabels = useLabels(TABS_LABELS, labels);
|
|
30323
|
-
const userChangeRef =
|
|
30324
|
-
const select =
|
|
30536
|
+
const userChangeRef = React91.useRef(false);
|
|
30537
|
+
const select = React91.useCallback(
|
|
30325
30538
|
(next) => {
|
|
30326
30539
|
if (next === activeValue) return;
|
|
30327
30540
|
userChangeRef.current = true;
|
|
@@ -30329,7 +30542,7 @@ function TabsRoot({
|
|
|
30329
30542
|
},
|
|
30330
30543
|
[activeValue, setActiveValue]
|
|
30331
30544
|
);
|
|
30332
|
-
const context =
|
|
30545
|
+
const context = React91.useMemo(
|
|
30333
30546
|
() => ({
|
|
30334
30547
|
activeValue,
|
|
30335
30548
|
select,
|
|
@@ -30442,9 +30655,9 @@ function placeFolder(list, folder, activeValue, animate) {
|
|
|
30442
30655
|
return column;
|
|
30443
30656
|
}
|
|
30444
30657
|
function useListLayout(listRef, folderRef, userChangeRef, activeValue, horizontal) {
|
|
30445
|
-
const [collapse, setCollapse] =
|
|
30446
|
-
const [column, setColumn] =
|
|
30447
|
-
const layout =
|
|
30658
|
+
const [collapse, setCollapse] = React91.useState("full");
|
|
30659
|
+
const [column, setColumn] = React91.useState(!horizontal);
|
|
30660
|
+
const layout = React91.useCallback(
|
|
30448
30661
|
(animate) => {
|
|
30449
30662
|
const list = listRef.current;
|
|
30450
30663
|
const folder = folderRef.current;
|
|
@@ -30458,7 +30671,7 @@ function useListLayout(listRef, folderRef, userChangeRef, activeValue, horizonta
|
|
|
30458
30671
|
},
|
|
30459
30672
|
[listRef, folderRef, activeValue, horizontal]
|
|
30460
30673
|
);
|
|
30461
|
-
|
|
30674
|
+
React91.useLayoutEffect(() => {
|
|
30462
30675
|
const list = listRef.current;
|
|
30463
30676
|
if (!list) return;
|
|
30464
30677
|
const userChange = userChangeRef.current && !prefersReducedMotion();
|
|
@@ -30476,15 +30689,15 @@ function useListLayout(listRef, folderRef, userChangeRef, activeValue, horizonta
|
|
|
30476
30689
|
return () => mutations.disconnect();
|
|
30477
30690
|
}, [listRef, userChangeRef, activeValue, layout]);
|
|
30478
30691
|
useResizeEffect(listRef, () => layout(false), { children: true });
|
|
30479
|
-
|
|
30692
|
+
React91.useLayoutEffect(() => {
|
|
30480
30693
|
userChangeRef.current = false;
|
|
30481
30694
|
});
|
|
30482
30695
|
return { collapse, column };
|
|
30483
30696
|
}
|
|
30484
30697
|
function TabsList({ children, className, ref, ...rest }) {
|
|
30485
30698
|
const { orientation, activeValue, select, userChangeRef } = useTabsContext();
|
|
30486
|
-
const listRef =
|
|
30487
|
-
const folderRef =
|
|
30699
|
+
const listRef = React91.useRef(null);
|
|
30700
|
+
const folderRef = React91.useRef(null);
|
|
30488
30701
|
const mergedRef = useMergedRefs(listRef, ref);
|
|
30489
30702
|
const horizontal = orientation === "horizontal";
|
|
30490
30703
|
const { collapse, column } = useListLayout(
|
|
@@ -30541,14 +30754,14 @@ function TabsList({ children, className, ref, ...rest }) {
|
|
|
30541
30754
|
}
|
|
30542
30755
|
TabsList.displayName = "Tabs.List";
|
|
30543
30756
|
function hasChildOfType2(children, type) {
|
|
30544
|
-
return
|
|
30545
|
-
(child) =>
|
|
30757
|
+
return React91.Children.toArray(children).some(
|
|
30758
|
+
(child) => React91.isValidElement(child) && child.type === type
|
|
30546
30759
|
);
|
|
30547
30760
|
}
|
|
30548
30761
|
function labelOf2(children) {
|
|
30549
|
-
for (const child of
|
|
30762
|
+
for (const child of React91.Children.toArray(children)) {
|
|
30550
30763
|
if (typeof child === "string" || typeof child === "number") return child;
|
|
30551
|
-
if (
|
|
30764
|
+
if (React91.isValidElement(child) && child.type === TabsLabel) {
|
|
30552
30765
|
return child.props.children;
|
|
30553
30766
|
}
|
|
30554
30767
|
}
|
|
@@ -30567,10 +30780,10 @@ function TabsItem({
|
|
|
30567
30780
|
...rest
|
|
30568
30781
|
}) {
|
|
30569
30782
|
const { activeValue, select, size, rootId, labels, panels } = useTabsContext();
|
|
30570
|
-
const collapse =
|
|
30571
|
-
const [tooltipOpen, setTooltipOpen] =
|
|
30572
|
-
const [removing, setRemoving] =
|
|
30573
|
-
const tabRef =
|
|
30783
|
+
const collapse = React91.useContext(CollapseContext2);
|
|
30784
|
+
const [tooltipOpen, setTooltipOpen] = React91.useState(false);
|
|
30785
|
+
const [removing, setRemoving] = React91.useState(false);
|
|
30786
|
+
const tabRef = React91.useRef(null);
|
|
30574
30787
|
const mergedRef = useMergedRefs(tabRef, ref);
|
|
30575
30788
|
const isActive = activeValue === value;
|
|
30576
30789
|
const id = tabId(rootId, value);
|
|
@@ -30698,9 +30911,9 @@ function TabsIcon({ children, className, ...rest }) {
|
|
|
30698
30911
|
TabsIcon.displayName = "Tabs.Icon";
|
|
30699
30912
|
function TabsLabel({ children, className, ...rest }) {
|
|
30700
30913
|
const id = useTextPartId("label");
|
|
30701
|
-
const iconOnly =
|
|
30914
|
+
const iconOnly = React91.useContext(CollapseContext2) === "icon";
|
|
30702
30915
|
const text = typeof children === "string" || typeof children === "number" ? String(children) : "";
|
|
30703
|
-
return /* @__PURE__ */ jsxs71(
|
|
30916
|
+
return /* @__PURE__ */ jsxs71(Fragment46, { children: [
|
|
30704
30917
|
/* @__PURE__ */ jsx89(
|
|
30705
30918
|
"span",
|
|
30706
30919
|
{
|
|
@@ -30748,7 +30961,7 @@ function TabsPanel({ value, ...rest }) {
|
|
|
30748
30961
|
TabsPanel.displayName = "Tabs.Panel";
|
|
30749
30962
|
function TabsPanelContent({ value, children, className, ...rest }) {
|
|
30750
30963
|
const { rootId, registerPanel } = useTabsContext();
|
|
30751
|
-
|
|
30964
|
+
React91.useLayoutEffect(() => registerPanel(value), [registerPanel, value]);
|
|
30752
30965
|
return /* @__PURE__ */ jsx89(
|
|
30753
30966
|
"div",
|
|
30754
30967
|
{
|
|
@@ -30775,10 +30988,10 @@ var Tabs = {
|
|
|
30775
30988
|
};
|
|
30776
30989
|
|
|
30777
30990
|
// src/components/tag-select/TagSelect.tsx
|
|
30778
|
-
import * as
|
|
30991
|
+
import * as React95 from "react";
|
|
30779
30992
|
|
|
30780
30993
|
// src/components/tag-select/TagOptionMenu.tsx
|
|
30781
|
-
import * as
|
|
30994
|
+
import * as React92 from "react";
|
|
30782
30995
|
|
|
30783
30996
|
// src/components/tag-select/TagSelect.module.css
|
|
30784
30997
|
var TagSelect_default = {
|
|
@@ -30809,7 +31022,7 @@ var TagSelect_default = {
|
|
|
30809
31022
|
};
|
|
30810
31023
|
|
|
30811
31024
|
// src/components/tag-select/TagOptionMenu.tsx
|
|
30812
|
-
import { Fragment as
|
|
31025
|
+
import { Fragment as Fragment47, jsx as jsx90, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
30813
31026
|
var TAG_COLORS = [
|
|
30814
31027
|
"gray",
|
|
30815
31028
|
"red",
|
|
@@ -30835,8 +31048,8 @@ function TagOptionMenu({
|
|
|
30835
31048
|
pending,
|
|
30836
31049
|
saving
|
|
30837
31050
|
}) {
|
|
30838
|
-
const [draft, setDraft] =
|
|
30839
|
-
|
|
31051
|
+
const [draft, setDraft] = React92.useState(label);
|
|
31052
|
+
React92.useEffect(() => {
|
|
30840
31053
|
if (open) setDraft(label);
|
|
30841
31054
|
}, [open, label]);
|
|
30842
31055
|
const commitLabel = () => {
|
|
@@ -30893,7 +31106,7 @@ function TagOptionMenu({
|
|
|
30893
31106
|
]
|
|
30894
31107
|
}
|
|
30895
31108
|
) : null,
|
|
30896
|
-
onUpdate ? /* @__PURE__ */ jsxs72(
|
|
31109
|
+
onUpdate ? /* @__PURE__ */ jsxs72(Fragment47, { children: [
|
|
30897
31110
|
/* @__PURE__ */ jsx90(Divider, { className: menu_default.separator }),
|
|
30898
31111
|
/* @__PURE__ */ jsx90("div", { className: cx(textRole_default.caption, menu_default.groupLabel), children: labels.colors }),
|
|
30899
31112
|
/* @__PURE__ */ jsx90("div", { className: cx(fieldTierClass, menu_default.tier), "data-size": "s", children: TAG_COLORS.map((hue) => /* @__PURE__ */ jsxs72(
|
|
@@ -30916,7 +31129,7 @@ function TagOptionMenu({
|
|
|
30916
31129
|
}
|
|
30917
31130
|
|
|
30918
31131
|
// src/components/tag-select/useChipOverflow.ts
|
|
30919
|
-
import * as
|
|
31132
|
+
import * as React93 from "react";
|
|
30920
31133
|
function useChipOverflow({
|
|
30921
31134
|
rowRef,
|
|
30922
31135
|
measureRef,
|
|
@@ -30925,8 +31138,8 @@ function useChipOverflow({
|
|
|
30925
31138
|
inputCollapsed
|
|
30926
31139
|
}) {
|
|
30927
31140
|
const count = chips.length;
|
|
30928
|
-
const [visible, setVisible] =
|
|
30929
|
-
const recompute =
|
|
31141
|
+
const [visible, setVisible] = React93.useState(count);
|
|
31142
|
+
const recompute = React93.useCallback(() => {
|
|
30930
31143
|
const row = rowRef.current;
|
|
30931
31144
|
const measure3 = measureRef.current;
|
|
30932
31145
|
if (!row || !measure3) return;
|
|
@@ -30953,7 +31166,7 @@ function useChipOverflow({
|
|
|
30953
31166
|
}
|
|
30954
31167
|
setVisible((prev) => prev === next ? prev : next);
|
|
30955
31168
|
}, [rowRef, measureRef, inputRef, inputCollapsed, chips]);
|
|
30956
|
-
|
|
31169
|
+
React93.useLayoutEffect(() => {
|
|
30957
31170
|
recompute();
|
|
30958
31171
|
}, [recompute]);
|
|
30959
31172
|
useResizeEffect(rowRef, recompute);
|
|
@@ -30962,8 +31175,8 @@ function useChipOverflow({
|
|
|
30962
31175
|
}
|
|
30963
31176
|
|
|
30964
31177
|
// src/components/tag-select/VirtualOptions.tsx
|
|
30965
|
-
import * as
|
|
30966
|
-
import { Fragment as
|
|
31178
|
+
import * as React94 from "react";
|
|
31179
|
+
import { Fragment as Fragment49, jsx as jsx91, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
30967
31180
|
var ONE_GROUP3 = () => 0;
|
|
30968
31181
|
function VirtualOptions({
|
|
30969
31182
|
count,
|
|
@@ -30974,18 +31187,18 @@ function VirtualOptions({
|
|
|
30974
31187
|
renderOption,
|
|
30975
31188
|
ref
|
|
30976
31189
|
}) {
|
|
30977
|
-
const startRef =
|
|
30978
|
-
const offset =
|
|
31190
|
+
const startRef = React94.useRef(null);
|
|
31191
|
+
const offset = React94.useCallback(() => {
|
|
30979
31192
|
const scroller = scrollRef.current;
|
|
30980
31193
|
const start = startRef.current;
|
|
30981
31194
|
if (!scroller || !start) return 0;
|
|
30982
31195
|
return start.getBoundingClientRect().top - scroller.getBoundingClientRect().top + scroller.scrollTop;
|
|
30983
31196
|
}, [scrollRef]);
|
|
30984
|
-
const estimate =
|
|
31197
|
+
const estimate = React94.useMemo(
|
|
30985
31198
|
() => readCssLengthPx(`--prime-control-${size}-height`, 36),
|
|
30986
31199
|
[size]
|
|
30987
31200
|
);
|
|
30988
|
-
const estimateSize =
|
|
31201
|
+
const estimateSize = React94.useCallback(() => estimate, [estimate]);
|
|
30989
31202
|
const virtual = useVirtualRows({
|
|
30990
31203
|
count,
|
|
30991
31204
|
scrollRef,
|
|
@@ -30996,7 +31209,7 @@ function VirtualOptions({
|
|
|
30996
31209
|
pinned
|
|
30997
31210
|
});
|
|
30998
31211
|
const { startOf } = virtual;
|
|
30999
|
-
|
|
31212
|
+
React94.useImperativeHandle(
|
|
31000
31213
|
ref,
|
|
31001
31214
|
() => ({
|
|
31002
31215
|
reveal(index) {
|
|
@@ -31014,9 +31227,9 @@ function VirtualOptions({
|
|
|
31014
31227
|
);
|
|
31015
31228
|
const laid = rowGaps(virtual);
|
|
31016
31229
|
const spacer = (key, height) => height > 0 ? /* @__PURE__ */ jsx91("div", { className: TagSelect_default.spacer, style: { height }, "aria-hidden": "true" }, key) : null;
|
|
31017
|
-
return /* @__PURE__ */ jsxs73(
|
|
31230
|
+
return /* @__PURE__ */ jsxs73(Fragment49, { children: [
|
|
31018
31231
|
/* @__PURE__ */ jsx91("div", { ref: startRef, "aria-hidden": "true" }),
|
|
31019
|
-
laid.rows.map(({ index, gap }) => /* @__PURE__ */ jsxs73(
|
|
31232
|
+
laid.rows.map(({ index, gap }) => /* @__PURE__ */ jsxs73(React94.Fragment, { children: [
|
|
31020
31233
|
spacer("gap", gap),
|
|
31021
31234
|
renderOption(index, virtual.measure(index))
|
|
31022
31235
|
] }, getKey(index))),
|
|
@@ -31025,7 +31238,7 @@ function VirtualOptions({
|
|
|
31025
31238
|
}
|
|
31026
31239
|
|
|
31027
31240
|
// src/components/tag-select/TagSelect.tsx
|
|
31028
|
-
import { Fragment as
|
|
31241
|
+
import { Fragment as Fragment50, jsx as jsx92, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
31029
31242
|
var TAG_SELECT_LABELS = {
|
|
31030
31243
|
panelHint: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0432\u0430\u0440\u0438\u0430\u043D\u0442 \u0438\u043B\u0438 \u0441\u043E\u0437\u0434\u0430\u0439\u0442\u0435 \u043D\u043E\u0432\u044B\u0439",
|
|
31031
31244
|
create: "\u0421\u043E\u0437\u0434\u0430\u0442\u044C",
|
|
@@ -31109,7 +31322,7 @@ function TagSelect({
|
|
|
31109
31322
|
const { size } = tier;
|
|
31110
31323
|
const disabled = useInheritedDisabled(disabledProp);
|
|
31111
31324
|
const merged = useLabels(TAG_SELECT_LABELS, labelsProp);
|
|
31112
|
-
const labels =
|
|
31325
|
+
const labels = React95.useMemo(
|
|
31113
31326
|
() => ({
|
|
31114
31327
|
...merged,
|
|
31115
31328
|
colorNames: { ...TAG_SELECT_LABELS.colorNames, ...labelsProp?.colorNames }
|
|
@@ -31130,32 +31343,32 @@ function TagSelect({
|
|
|
31130
31343
|
onOpenChange,
|
|
31131
31344
|
disabled
|
|
31132
31345
|
});
|
|
31133
|
-
const [inputValue, setInputValue] =
|
|
31134
|
-
const [focusWithin, setFocusWithin] =
|
|
31135
|
-
const [announcement, setAnnouncement] =
|
|
31346
|
+
const [inputValue, setInputValue] = React95.useState("");
|
|
31347
|
+
const [focusWithin, setFocusWithin] = React95.useState(false);
|
|
31348
|
+
const [announcement, setAnnouncement] = React95.useState("");
|
|
31136
31349
|
const highlight = useCreateStore(void 0);
|
|
31137
31350
|
const registry = useListboxRegistry();
|
|
31138
|
-
const [menuValue, setMenuValue] =
|
|
31139
|
-
const [created, setCreated] =
|
|
31351
|
+
const [menuValue, setMenuValue] = React95.useState(null);
|
|
31352
|
+
const [created, setCreated] = React95.useState([]);
|
|
31140
31353
|
const { pending: deleting, track: trackDelete } = usePendingKeys();
|
|
31141
31354
|
const { pending: creating, track: trackCreate } = usePendingKeys();
|
|
31142
|
-
const pendingChipFocus =
|
|
31143
|
-
const triggerRef =
|
|
31144
|
-
const chipsRef =
|
|
31145
|
-
const measureRef =
|
|
31146
|
-
const inputRef =
|
|
31147
|
-
const knownOptions =
|
|
31355
|
+
const pendingChipFocus = React95.useRef(null);
|
|
31356
|
+
const triggerRef = React95.useRef(null);
|
|
31357
|
+
const chipsRef = React95.useRef(null);
|
|
31358
|
+
const measureRef = React95.useRef(null);
|
|
31359
|
+
const inputRef = React95.useRef(null);
|
|
31360
|
+
const knownOptions = React95.useMemo(() => {
|
|
31148
31361
|
const extra = created.filter((c) => !options.some((o) => o.value === c.value));
|
|
31149
31362
|
return extra.length ? [...options, ...extra] : options;
|
|
31150
31363
|
}, [options, created]);
|
|
31151
31364
|
const optionChanges = usePendingChanges(knownOptions, updateOption);
|
|
31152
31365
|
const allOptions = optionChanges.shown;
|
|
31153
|
-
const updating =
|
|
31366
|
+
const updating = React95.useMemo(
|
|
31154
31367
|
() => new Set(optionChanges.pending.map((change) => change.value)),
|
|
31155
31368
|
[optionChanges.pending]
|
|
31156
31369
|
);
|
|
31157
31370
|
const inputTrim = inputValue.trim();
|
|
31158
|
-
const listed =
|
|
31371
|
+
const listed = React95.useMemo(
|
|
31159
31372
|
() => listOptions(allOptions, inputValue, selected),
|
|
31160
31373
|
[allOptions, inputValue, selected]
|
|
31161
31374
|
);
|
|
@@ -31163,14 +31376,14 @@ function TagSelect({
|
|
|
31163
31376
|
const hasPanelContent = listed.length > 0 || showCreate;
|
|
31164
31377
|
const manageable = Boolean(onOptionUpdate || onOptionDelete);
|
|
31165
31378
|
const shown = open && hasPanelContent;
|
|
31166
|
-
const navigable =
|
|
31379
|
+
const navigable = React95.useMemo(
|
|
31167
31380
|
() => [
|
|
31168
31381
|
...showCreate ? [CREATE_VALUE] : [],
|
|
31169
31382
|
...listed.filter((o) => !o.disabled).map((o) => o.value)
|
|
31170
31383
|
],
|
|
31171
31384
|
[listed, showCreate]
|
|
31172
31385
|
);
|
|
31173
|
-
|
|
31386
|
+
React95.useLayoutEffect(() => {
|
|
31174
31387
|
const current = highlight.get();
|
|
31175
31388
|
if (!shown || navigable.length === 0) highlight.set(void 0);
|
|
31176
31389
|
else if (current === void 0 || !navigable.includes(current)) highlight.set(navigable[0]);
|
|
@@ -31185,17 +31398,17 @@ function TagSelect({
|
|
|
31185
31398
|
matchAnchorWidth: true
|
|
31186
31399
|
});
|
|
31187
31400
|
const listboxRef = floating.contentRef;
|
|
31188
|
-
const scrollerRef =
|
|
31189
|
-
const virtualRef =
|
|
31401
|
+
const scrollerRef = React95.useRef(null);
|
|
31402
|
+
const virtualRef = React95.useRef(null);
|
|
31190
31403
|
const virtualized = listed.length > VIRTUAL_FROM3;
|
|
31191
31404
|
const pinnedHighlight = useStoreSlice(highlight, (value) => virtualized ? value : void 0);
|
|
31192
|
-
const pinnedOptions =
|
|
31405
|
+
const pinnedOptions = React95.useMemo(() => {
|
|
31193
31406
|
if (!virtualized) return [];
|
|
31194
31407
|
return listed.flatMap(
|
|
31195
31408
|
(option, index) => option.value === pinnedHighlight || option.value === menuValue ? [index] : []
|
|
31196
31409
|
);
|
|
31197
31410
|
}, [virtualized, listed, pinnedHighlight, menuValue]);
|
|
31198
|
-
const getOptionKey =
|
|
31411
|
+
const getOptionKey = React95.useCallback((index) => listed[index]?.value ?? "", [listed]);
|
|
31199
31412
|
const revealOption = (value) => {
|
|
31200
31413
|
const index = virtualized ? listed.findIndex((option) => option.value === value) : -1;
|
|
31201
31414
|
if (index >= 0) virtualRef.current?.reveal(index);
|
|
@@ -31275,7 +31488,7 @@ function TagSelect({
|
|
|
31275
31488
|
}
|
|
31276
31489
|
setInputValue("");
|
|
31277
31490
|
};
|
|
31278
|
-
const chips =
|
|
31491
|
+
const chips = React95.useMemo(() => {
|
|
31279
31492
|
const byValue = new Map(allOptions.map((o) => [o.value, o]));
|
|
31280
31493
|
return selected.map((v) => {
|
|
31281
31494
|
const option = byValue.get(v);
|
|
@@ -31291,7 +31504,7 @@ function TagSelect({
|
|
|
31291
31504
|
// A chip on its way out (`data-leaving`) is a copy that only closes up.
|
|
31292
31505
|
chipsRef.current?.querySelectorAll("[data-chip-value]:not([data-leaving])") ?? []
|
|
31293
31506
|
);
|
|
31294
|
-
|
|
31507
|
+
React95.useLayoutEffect(() => {
|
|
31295
31508
|
const target = pendingChipFocus.current;
|
|
31296
31509
|
if (target === null) return;
|
|
31297
31510
|
pendingChipFocus.current = null;
|
|
@@ -31310,7 +31523,7 @@ function TagSelect({
|
|
|
31310
31523
|
});
|
|
31311
31524
|
const visibleChips = expanded ? chips : chips.slice(0, visibleCount);
|
|
31312
31525
|
const hiddenChips = expanded ? [] : chips.slice(visibleCount);
|
|
31313
|
-
|
|
31526
|
+
React95.useEffect(() => {
|
|
31314
31527
|
const row = chipsRef.current;
|
|
31315
31528
|
if (expanded && row) row.scrollTop = row.scrollHeight;
|
|
31316
31529
|
}, [expanded]);
|
|
@@ -31397,7 +31610,7 @@ function TagSelect({
|
|
|
31397
31610
|
const pickOption = () => {
|
|
31398
31611
|
if (!option.disabled) pick(option.value);
|
|
31399
31612
|
};
|
|
31400
|
-
const content = /* @__PURE__ */ jsxs74(
|
|
31613
|
+
const content = /* @__PURE__ */ jsxs74(Fragment50, { children: [
|
|
31401
31614
|
/* @__PURE__ */ jsx92(Checkbox.Indicator, { checked: isSelected, disabled: option.disabled, size: stepDown(size) }),
|
|
31402
31615
|
/* @__PURE__ */ jsx92(
|
|
31403
31616
|
Badge.Root,
|
|
@@ -31425,7 +31638,7 @@ function TagSelect({
|
|
|
31425
31638
|
ref: windowed?.measure,
|
|
31426
31639
|
posInSet: windowed ? windowed.index + 1 + (showCreate ? 1 : 0) : void 0,
|
|
31427
31640
|
setSize: windowed ? setSize : void 0,
|
|
31428
|
-
children: manageable ? /* @__PURE__ */ jsxs74(
|
|
31641
|
+
children: manageable ? /* @__PURE__ */ jsxs74(Fragment50, { children: [
|
|
31429
31642
|
/* @__PURE__ */ jsx92(
|
|
31430
31643
|
"button",
|
|
31431
31644
|
{
|
|
@@ -31688,7 +31901,7 @@ function OptionRow({
|
|
|
31688
31901
|
children
|
|
31689
31902
|
}) {
|
|
31690
31903
|
const highlighted = useStoreSlice(highlight, (current) => current === value);
|
|
31691
|
-
const nodeRef =
|
|
31904
|
+
const nodeRef = React95.useRef(null);
|
|
31692
31905
|
const setRefs = useMergedRefs(nodeRef, ref);
|
|
31693
31906
|
useListboxItem(
|
|
31694
31907
|
registry,
|
|
@@ -31741,7 +31954,7 @@ function OptionRow({
|
|
|
31741
31954
|
}
|
|
31742
31955
|
);
|
|
31743
31956
|
}
|
|
31744
|
-
var MeasureRow =
|
|
31957
|
+
var MeasureRow = React95.memo(function MeasureRow2({
|
|
31745
31958
|
chips,
|
|
31746
31959
|
disabled,
|
|
31747
31960
|
removeLabel,
|
|
@@ -31774,7 +31987,7 @@ function noop() {
|
|
|
31774
31987
|
}
|
|
31775
31988
|
|
|
31776
31989
|
// src/components/timeline/Timeline.tsx
|
|
31777
|
-
import * as
|
|
31990
|
+
import * as React96 from "react";
|
|
31778
31991
|
|
|
31779
31992
|
// src/components/timeline/Timeline.module.css
|
|
31780
31993
|
var Timeline_default = {
|
|
@@ -31798,7 +32011,7 @@ var Timeline_default = {
|
|
|
31798
32011
|
};
|
|
31799
32012
|
|
|
31800
32013
|
// src/components/timeline/Timeline.tsx
|
|
31801
|
-
import { Fragment as
|
|
32014
|
+
import { Fragment as Fragment51, jsx as jsx93, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
31802
32015
|
function TimelineRoot({ size: sizeProp, children, className, ...rest }) {
|
|
31803
32016
|
const tier = useHostTier(sizeProp);
|
|
31804
32017
|
return tier.provide(
|
|
@@ -31821,13 +32034,13 @@ var GROUP_LABEL_ROLE = {
|
|
|
31821
32034
|
l: textRole_default.titleM,
|
|
31822
32035
|
xl: textRole_default.titleM
|
|
31823
32036
|
};
|
|
31824
|
-
var EdgeContext =
|
|
31825
|
-
var isGap = (child) =>
|
|
32037
|
+
var EdgeContext = React96.createContext({ first: false, last: false });
|
|
32038
|
+
var isGap = (child) => React96.isValidElement(child) && child.type === TimelineGap;
|
|
31826
32039
|
function TimelineGroup({ label, children, className, ...rest }) {
|
|
31827
32040
|
const size = useControlSize(void 0);
|
|
31828
|
-
const labelId =
|
|
32041
|
+
const labelId = React96.useId();
|
|
31829
32042
|
const hasLabel = hasContent(label);
|
|
31830
|
-
const events =
|
|
32043
|
+
const events = React96.Children.toArray(children);
|
|
31831
32044
|
const items = events.map((child, index) => /* @__PURE__ */ jsx93(
|
|
31832
32045
|
EdgeContext.Provider,
|
|
31833
32046
|
{
|
|
@@ -31839,7 +32052,7 @@ function TimelineGroup({ label, children, className, ...rest }) {
|
|
|
31839
32052
|
},
|
|
31840
32053
|
children: child
|
|
31841
32054
|
},
|
|
31842
|
-
|
|
32055
|
+
React96.isValidElement(child) ? child.key : index
|
|
31843
32056
|
));
|
|
31844
32057
|
return /* @__PURE__ */ jsxs75("div", { className: Timeline_default.group, children: [
|
|
31845
32058
|
hasLabel ? /* @__PURE__ */ jsx93("div", { id: labelId, className: cx(GROUP_LABEL_ROLE[size], Timeline_default.groupLabel), children: label }) : null,
|
|
@@ -31877,7 +32090,7 @@ function TimelineItem({
|
|
|
31877
32090
|
download,
|
|
31878
32091
|
...rest
|
|
31879
32092
|
}) {
|
|
31880
|
-
const edge =
|
|
32093
|
+
const edge = React96.useContext(EdgeContext);
|
|
31881
32094
|
const interactive = Boolean(asChild || href || onClick);
|
|
31882
32095
|
const rowProps = {
|
|
31883
32096
|
...rest,
|
|
@@ -31898,7 +32111,7 @@ function TimelineItem({
|
|
|
31898
32111
|
const dot = /* @__PURE__ */ jsx93("span", { className: Timeline_default.dot, "aria-hidden": "true" });
|
|
31899
32112
|
const content = (parts) => {
|
|
31900
32113
|
const { parts: value, rest: text } = splitParts(parts, TimelineItemValue);
|
|
31901
|
-
return /* @__PURE__ */ jsxs75(
|
|
32114
|
+
return /* @__PURE__ */ jsxs75(Fragment51, { children: [
|
|
31902
32115
|
dot,
|
|
31903
32116
|
/* @__PURE__ */ jsx93("span", { className: Timeline_default.text, children: text }),
|
|
31904
32117
|
value
|
|
@@ -31907,7 +32120,7 @@ function TimelineItem({
|
|
|
31907
32120
|
let row;
|
|
31908
32121
|
if (asChild) {
|
|
31909
32122
|
const child = slotChild(children, "Timeline.Item");
|
|
31910
|
-
row = /* @__PURE__ */ jsx93(InteractiveElement, { ...rowProps, element: "slot", onClick, children:
|
|
32123
|
+
row = /* @__PURE__ */ jsx93(InteractiveElement, { ...rowProps, element: "slot", onClick, children: React96.cloneElement(child, void 0, content(child.props.children)) });
|
|
31911
32124
|
} else if (href) {
|
|
31912
32125
|
row = /* @__PURE__ */ jsx93(
|
|
31913
32126
|
InteractiveElement,
|
|
@@ -31934,9 +32147,9 @@ function TimelineItemTitle({ children, className, ...rest }) {
|
|
|
31934
32147
|
return /* @__PURE__ */ jsx93("span", { ...rest, className: cx(Timeline_default.title, className), children });
|
|
31935
32148
|
}
|
|
31936
32149
|
TimelineItemTitle.displayName = "Timeline.ItemTitle";
|
|
31937
|
-
var ValueContext =
|
|
32150
|
+
var ValueContext = React96.createContext(false);
|
|
31938
32151
|
function TimelineItemMeta({ children, className, ...rest }) {
|
|
31939
|
-
const inValue =
|
|
32152
|
+
const inValue = React96.useContext(ValueContext);
|
|
31940
32153
|
return /* @__PURE__ */ jsx93("span", { ...rest, className: cx(inValue ? Timeline_default.valueMeta : Timeline_default.meta, className), children });
|
|
31941
32154
|
}
|
|
31942
32155
|
TimelineItemMeta.displayName = "Timeline.ItemMeta";
|
|
@@ -31962,11 +32175,11 @@ function TimelineDescription({ className, ...rest }) {
|
|
|
31962
32175
|
}
|
|
31963
32176
|
TimelineDescription.displayName = "Timeline.Description";
|
|
31964
32177
|
function TimelineGap({ tone = "neutral", children, className, ...rest }) {
|
|
31965
|
-
const parts =
|
|
32178
|
+
const parts = React96.Children.toArray(children);
|
|
31966
32179
|
const isDescription = (child) => isPart(child, TimelineDescription);
|
|
31967
32180
|
const caption = parts.filter((child) => !isDescription(child));
|
|
31968
32181
|
const description = parts.filter(isDescription);
|
|
31969
|
-
const edge =
|
|
32182
|
+
const edge = React96.useContext(EdgeContext);
|
|
31970
32183
|
return /* @__PURE__ */ jsx93("li", { className: cx(Timeline_default.item, Timeline_default.gapItem), ...toDataAttributes(edgeAttributes(edge)), children: /* @__PURE__ */ jsxs75("div", { ...rest, className: cx(Timeline_default.gapRow, className), ...toDataAttributes({ tone }), children: [
|
|
31971
32184
|
/* @__PURE__ */ jsx93("span", { className: Timeline_default.gapDot, "aria-hidden": "true" }),
|
|
31972
32185
|
/* @__PURE__ */ jsx93("span", { className: Timeline_default.gapCaption, children: caption }),
|
|
@@ -31986,7 +32199,7 @@ var Timeline = {
|
|
|
31986
32199
|
};
|
|
31987
32200
|
|
|
31988
32201
|
// src/components/video-note/VideoNote.tsx
|
|
31989
|
-
import * as
|
|
32202
|
+
import * as React97 from "react";
|
|
31990
32203
|
|
|
31991
32204
|
// src/components/video-note/VideoNote.module.css
|
|
31992
32205
|
var VideoNote_default = {
|
|
@@ -32020,10 +32233,10 @@ function VideoNoteInner(props) {
|
|
|
32020
32233
|
const { overlay } = useMessagePart();
|
|
32021
32234
|
const around = useSurfaceDepth();
|
|
32022
32235
|
const blockDepth = useInMessage() ? void 0 : nextSurfaceDepth(around);
|
|
32023
|
-
const videoRef =
|
|
32024
|
-
const ringRef =
|
|
32025
|
-
const descriptionId =
|
|
32026
|
-
const [frame, setFrame] =
|
|
32236
|
+
const videoRef = React97.useRef(null);
|
|
32237
|
+
const ringRef = React97.useRef(null);
|
|
32238
|
+
const descriptionId = React97.useId();
|
|
32239
|
+
const [frame, setFrame] = React97.useState("loading");
|
|
32027
32240
|
const placeholder = usePresence(frame === "loading", { exitDuration: "base" });
|
|
32028
32241
|
const player = useMediaPlayer(videoRef, mediaProps, labels, { progressRef: ringRef });
|
|
32029
32242
|
const { state, duration, transcript, disabled, covered, inactive } = player;
|
|
@@ -32140,7 +32353,7 @@ defineMessagePart(VideoNote, {
|
|
|
32140
32353
|
});
|
|
32141
32354
|
|
|
32142
32355
|
// src/components/voice-player/VoicePlayer.tsx
|
|
32143
|
-
import * as
|
|
32356
|
+
import * as React98 from "react";
|
|
32144
32357
|
|
|
32145
32358
|
// src/components/voice-player/VoicePlayer.module.css
|
|
32146
32359
|
var VoicePlayer_default = {
|
|
@@ -32265,9 +32478,9 @@ function VoicePlayer(props) {
|
|
|
32265
32478
|
defaultValue: defaultRate,
|
|
32266
32479
|
onChange: onRateChange
|
|
32267
32480
|
});
|
|
32268
|
-
const audioRef =
|
|
32269
|
-
const waveRef =
|
|
32270
|
-
const playedRef =
|
|
32481
|
+
const audioRef = React98.useRef(null);
|
|
32482
|
+
const waveRef = React98.useRef(null);
|
|
32483
|
+
const playedRef = React98.useRef(null);
|
|
32271
32484
|
const player = useMediaPlayer(audioRef, mediaProps, labels, {
|
|
32272
32485
|
rate,
|
|
32273
32486
|
progressRef: playedRef,
|
|
@@ -32279,7 +32492,7 @@ function VoicePlayer(props) {
|
|
|
32279
32492
|
const total = Math.max(0, player.duration ?? 0);
|
|
32280
32493
|
const playing = state === "playing";
|
|
32281
32494
|
const showElapsed = playing || seeking || position > 0;
|
|
32282
|
-
const bars =
|
|
32495
|
+
const bars = React98.useMemo(() => resample(waveform, barCount), [waveform, barCount]);
|
|
32283
32496
|
const fractionAt = (clientX) => {
|
|
32284
32497
|
const wave = waveRef.current;
|
|
32285
32498
|
if (!wave) return 0;
|
|
@@ -32408,10 +32621,10 @@ defineMessagePart(VoicePlayer, {
|
|
|
32408
32621
|
});
|
|
32409
32622
|
|
|
32410
32623
|
// src/hooks/useTokenValue.ts
|
|
32411
|
-
import * as
|
|
32624
|
+
import * as React99 from "react";
|
|
32412
32625
|
function useTokenValue(token, fallbackPx = 0) {
|
|
32413
|
-
const [value, setValue] =
|
|
32414
|
-
|
|
32626
|
+
const [value, setValue] = React99.useState(() => readCssLengthPx(token, fallbackPx));
|
|
32627
|
+
React99.useLayoutEffect(() => {
|
|
32415
32628
|
const update2 = () => setValue(readCssLengthPx(token, fallbackPx));
|
|
32416
32629
|
update2();
|
|
32417
32630
|
const observer2 = new MutationObserver(update2);
|
|
@@ -32430,7 +32643,7 @@ function useTokenValue(token, fallbackPx = 0) {
|
|
|
32430
32643
|
}
|
|
32431
32644
|
|
|
32432
32645
|
// src/hooks/useUploadQueue.ts
|
|
32433
|
-
import * as
|
|
32646
|
+
import * as React100 from "react";
|
|
32434
32647
|
var DEFAULT_CONCURRENCY = 3;
|
|
32435
32648
|
var sequence = 0;
|
|
32436
32649
|
function reasonOf3(error) {
|
|
@@ -32449,16 +32662,16 @@ function withPreview(item, previews) {
|
|
|
32449
32662
|
return preview === void 0 ? item : { ...item, preview };
|
|
32450
32663
|
}
|
|
32451
32664
|
function useUploadQueue(options) {
|
|
32452
|
-
const [entries, setItems] =
|
|
32453
|
-
const optionsRef =
|
|
32454
|
-
|
|
32665
|
+
const [entries, setItems] = React100.useState([]);
|
|
32666
|
+
const optionsRef = React100.useRef(options);
|
|
32667
|
+
React100.useLayoutEffect(() => {
|
|
32455
32668
|
optionsRef.current = options;
|
|
32456
32669
|
});
|
|
32457
|
-
const running =
|
|
32458
|
-
const previews =
|
|
32459
|
-
const [shown, setShown] =
|
|
32460
|
-
const prefix =
|
|
32461
|
-
|
|
32670
|
+
const running = React100.useRef(/* @__PURE__ */ new Map());
|
|
32671
|
+
const previews = React100.useRef(/* @__PURE__ */ new Map());
|
|
32672
|
+
const [shown, setShown] = React100.useState(() => /* @__PURE__ */ new Map());
|
|
32673
|
+
const prefix = React100.useId();
|
|
32674
|
+
React100.useLayoutEffect(() => {
|
|
32462
32675
|
const map = previews.current;
|
|
32463
32676
|
const ids = new Set(entries.map((item) => item.id));
|
|
32464
32677
|
let changed = false;
|
|
@@ -32477,10 +32690,10 @@ function useUploadQueue(options) {
|
|
|
32477
32690
|
}
|
|
32478
32691
|
if (changed) setShown(new Map(map));
|
|
32479
32692
|
}, [entries]);
|
|
32480
|
-
const update2 =
|
|
32693
|
+
const update2 = React100.useCallback((id, patch) => {
|
|
32481
32694
|
setItems((current) => current.map((item) => item.id === id ? { ...item, ...patch } : item));
|
|
32482
32695
|
}, []);
|
|
32483
|
-
const start =
|
|
32696
|
+
const start = React100.useCallback(
|
|
32484
32697
|
(item) => {
|
|
32485
32698
|
const controller = new AbortController();
|
|
32486
32699
|
running.current.set(item.id, controller);
|
|
@@ -32510,7 +32723,7 @@ function useUploadQueue(options) {
|
|
|
32510
32723
|
},
|
|
32511
32724
|
[update2]
|
|
32512
32725
|
);
|
|
32513
|
-
|
|
32726
|
+
React100.useEffect(() => {
|
|
32514
32727
|
const limit = Math.max(1, optionsRef.current.concurrency ?? DEFAULT_CONCURRENCY);
|
|
32515
32728
|
let free = limit - running.current.size;
|
|
32516
32729
|
if (free <= 0) return;
|
|
@@ -32524,7 +32737,7 @@ function useUploadQueue(options) {
|
|
|
32524
32737
|
free -= 1;
|
|
32525
32738
|
}
|
|
32526
32739
|
});
|
|
32527
|
-
|
|
32740
|
+
React100.useEffect(() => {
|
|
32528
32741
|
const uploads = running.current;
|
|
32529
32742
|
const urls = previews.current;
|
|
32530
32743
|
return () => {
|
|
@@ -32534,7 +32747,7 @@ function useUploadQueue(options) {
|
|
|
32534
32747
|
urls.clear();
|
|
32535
32748
|
};
|
|
32536
32749
|
}, []);
|
|
32537
|
-
const add =
|
|
32750
|
+
const add = React100.useCallback(
|
|
32538
32751
|
(files) => {
|
|
32539
32752
|
const added = files.map((file) => {
|
|
32540
32753
|
const id = `${prefix}upload-${++sequence}`;
|
|
@@ -32550,24 +32763,24 @@ function useUploadQueue(options) {
|
|
|
32550
32763
|
},
|
|
32551
32764
|
[prefix]
|
|
32552
32765
|
);
|
|
32553
|
-
const retry =
|
|
32766
|
+
const retry = React100.useCallback((id) => {
|
|
32554
32767
|
setItems(
|
|
32555
32768
|
(current) => current.map(
|
|
32556
32769
|
(item) => item.id === id && item.status === "failed" ? { ...item, status: "queued", progress: 0, error: void 0 } : item
|
|
32557
32770
|
)
|
|
32558
32771
|
);
|
|
32559
32772
|
}, []);
|
|
32560
|
-
const remove =
|
|
32773
|
+
const remove = React100.useCallback((id) => {
|
|
32561
32774
|
running.current.get(id)?.abort();
|
|
32562
32775
|
running.current.delete(id);
|
|
32563
32776
|
setItems((current) => current.filter((entry) => entry.id !== id));
|
|
32564
32777
|
}, []);
|
|
32565
|
-
const clear =
|
|
32778
|
+
const clear = React100.useCallback(() => {
|
|
32566
32779
|
for (const controller of running.current.values()) controller.abort();
|
|
32567
32780
|
running.current.clear();
|
|
32568
32781
|
setItems([]);
|
|
32569
32782
|
}, []);
|
|
32570
|
-
const move =
|
|
32783
|
+
const move = React100.useCallback((id, beforeId) => {
|
|
32571
32784
|
setItems((current) => {
|
|
32572
32785
|
const item = current.find((entry) => entry.id === id);
|
|
32573
32786
|
if (!item || id === beforeId) return current;
|
|
@@ -32577,11 +32790,11 @@ function useUploadQueue(options) {
|
|
|
32577
32790
|
return next.every((entry, index) => entry === current[index]) ? current : next;
|
|
32578
32791
|
});
|
|
32579
32792
|
}, []);
|
|
32580
|
-
const items =
|
|
32793
|
+
const items = React100.useMemo(
|
|
32581
32794
|
() => entries.map((item) => withPreview(item, shown)),
|
|
32582
32795
|
[entries, shown]
|
|
32583
32796
|
);
|
|
32584
|
-
return
|
|
32797
|
+
return React100.useMemo(
|
|
32585
32798
|
() => ({ items, add, retry, remove, clear, move }),
|
|
32586
32799
|
[items, add, retry, remove, clear, move]
|
|
32587
32800
|
);
|