@tensor_1/react 2.42.0 → 2.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/dist/components/OrgChart.d.ts +121 -0
- package/dist/components/OrgChart.js +683 -0
- package/dist/index.cjs +1569 -888
- package/dist/index.d.cts +120 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -0
- package/dist/labels-context.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -74,6 +74,7 @@ __export(src_exports, {
|
|
|
74
74
|
DEFAULT_INSIGHT_CARD_LABELS: () => DEFAULT_INSIGHT_CARD_LABELS,
|
|
75
75
|
DEFAULT_LIGHTBOX_LABELS: () => DEFAULT_LIGHTBOX_LABELS,
|
|
76
76
|
DEFAULT_MATCH_REVIEW_LABELS: () => DEFAULT_MATCH_REVIEW_LABELS,
|
|
77
|
+
DEFAULT_ORG_CHART_LABELS: () => DEFAULT_ORG_CHART_LABELS,
|
|
77
78
|
DEFAULT_PAGINATION_LABELS: () => DEFAULT_PAGINATION_LABELS,
|
|
78
79
|
DEFAULT_PRESENCE_LABELS: () => DEFAULT_PRESENCE_LABELS,
|
|
79
80
|
DEFAULT_RELATIONSHIP_GRAPH_LABELS: () => DEFAULT_RELATIONSHIP_GRAPH_LABELS,
|
|
@@ -158,6 +159,7 @@ __export(src_exports, {
|
|
|
158
159
|
NotFoundState: () => NotFoundState,
|
|
159
160
|
Note: () => Note,
|
|
160
161
|
NoticeQueue: () => NoticeQueue,
|
|
162
|
+
OrgChart: () => OrgChart,
|
|
161
163
|
PageHeader: () => PageHeader,
|
|
162
164
|
PageIntro: () => PageIntro,
|
|
163
165
|
Pagination: () => Pagination,
|
|
@@ -293,6 +295,8 @@ __export(src_exports, {
|
|
|
293
295
|
nextSortDir: () => nextSortDir,
|
|
294
296
|
normalQuantile: () => normalQuantile,
|
|
295
297
|
normalizeHex: () => normalizeHex,
|
|
298
|
+
orgChartInitials: () => orgChartInitials,
|
|
299
|
+
orgChartZoomStep: () => orgChartZoomStep,
|
|
296
300
|
packLanes: () => packLanes,
|
|
297
301
|
parseDateInput: () => parseDateInput,
|
|
298
302
|
parseDateValue: () => parseDateValue,
|
|
@@ -9561,8 +9565,681 @@ function VirtualTreeView({
|
|
|
9561
9565
|
);
|
|
9562
9566
|
}
|
|
9563
9567
|
|
|
9564
|
-
// src/components/
|
|
9568
|
+
// src/components/OrgChart.tsx
|
|
9569
|
+
var import_react63 = require("react");
|
|
9565
9570
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
9571
|
+
var DEFAULT_ORG_CHART_LABELS = {
|
|
9572
|
+
chart: "Org chart",
|
|
9573
|
+
loading: "Loading\u2026",
|
|
9574
|
+
error: "Could not load.",
|
|
9575
|
+
retry: "Retry",
|
|
9576
|
+
reportsOne: "{count} direct report",
|
|
9577
|
+
reportsMany: "{count} direct reports",
|
|
9578
|
+
expand: "Show reports",
|
|
9579
|
+
collapse: "Hide reports",
|
|
9580
|
+
toolbar: "Zoom",
|
|
9581
|
+
zoomIn: "Zoom in",
|
|
9582
|
+
zoomOut: "Zoom out",
|
|
9583
|
+
fit: "Fit",
|
|
9584
|
+
zoomLevel: "{percent}%",
|
|
9585
|
+
resetZoom: "{percent}, reset to 100%"
|
|
9586
|
+
};
|
|
9587
|
+
var ZOOM_STEPS = [0.25, 0.33, 0.5, 0.67, 0.8, 0.9, 1, 1.1, 1.25, 1.5];
|
|
9588
|
+
var MIN_ZOOM = ZOOM_STEPS[0];
|
|
9589
|
+
var MAX_ZOOM = ZOOM_STEPS[ZOOM_STEPS.length - 1];
|
|
9590
|
+
var clampZoom = (z) => Math.min(MAX_ZOOM, Math.max(MIN_ZOOM, z));
|
|
9591
|
+
var orgChartZoomStep = (zoom, dir) => {
|
|
9592
|
+
if (dir > 0) return ZOOM_STEPS.find((s) => s > zoom + 1e-3) ?? MAX_ZOOM;
|
|
9593
|
+
return [...ZOOM_STEPS].reverse().find((s) => s < zoom - 1e-3) ?? MIN_ZOOM;
|
|
9594
|
+
};
|
|
9595
|
+
var orgChartInitials = (name) => {
|
|
9596
|
+
const words = name.trim().split(/\s+/).filter(Boolean);
|
|
9597
|
+
if (words.length === 0) return "";
|
|
9598
|
+
const first = words[0];
|
|
9599
|
+
const last = words.length > 1 ? words[words.length - 1] : "";
|
|
9600
|
+
return (Array.from(first)[0] ?? "").concat(last ? Array.from(last)[0] ?? "" : "").toUpperCase();
|
|
9601
|
+
};
|
|
9602
|
+
var LOADING2 = "::uix-loading";
|
|
9603
|
+
var FAILED2 = "::uix-error";
|
|
9604
|
+
var syntheticOf2 = (id) => id.endsWith(LOADING2) ? { parent: id.slice(0, -LOADING2.length), kind: "loading" } : id.endsWith(FAILED2) ? { parent: id.slice(0, -FAILED2.length), kind: "error" } : null;
|
|
9605
|
+
var idRef = (chartId, nodeId, part) => {
|
|
9606
|
+
let hash = 5381;
|
|
9607
|
+
for (let i = 0; i < nodeId.length; i += 1) hash = (hash * 33 ^ nodeId.charCodeAt(i)) >>> 0;
|
|
9608
|
+
return `${chartId}-${nodeId.replace(/[^A-Za-z0-9_-]/g, "_").slice(0, 40)}-${hash.toString(36)}-${part}`;
|
|
9609
|
+
};
|
|
9610
|
+
var isExpandable = (node, known, lazy) => known ? known.length > 0 : lazy && (node.reportCount ?? 0) > 0;
|
|
9611
|
+
var ChevronIcon3 = () => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("svg", { viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("path", { d: "M2 4l4 4 4-4" }) });
|
|
9612
|
+
var PlusIcon = () => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("path", { d: "M8 3v10M3 8h10" }) });
|
|
9613
|
+
var MinusIcon = () => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("path", { d: "M3 8h10" }) });
|
|
9614
|
+
var FitIcon = () => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("path", { d: "M2 6V2h4M14 6V2h-4M2 10v4h4M14 10v4h-4" }) });
|
|
9615
|
+
var useIsoLayoutEffect = typeof window === "undefined" ? import_react63.useEffect : import_react63.useLayoutEffect;
|
|
9616
|
+
var Ring2 = () => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "uix-spinner uix-spinner--sm", "aria-hidden": "true" });
|
|
9617
|
+
function StatusItem({ parent, kind, level, ctx }) {
|
|
9618
|
+
const id = parent + (kind === "error" ? FAILED2 : LOADING2);
|
|
9619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
9620
|
+
"li",
|
|
9621
|
+
{
|
|
9622
|
+
role: "treeitem",
|
|
9623
|
+
"aria-level": level,
|
|
9624
|
+
"aria-setsize": 1,
|
|
9625
|
+
"aria-posinset": 1,
|
|
9626
|
+
"data-id": id,
|
|
9627
|
+
tabIndex: ctx.tabbableId === id ? 0 : -1,
|
|
9628
|
+
className: "uix-org-chart__item uix-org-chart__item--status",
|
|
9629
|
+
onFocus: (e) => {
|
|
9630
|
+
if (e.target === e.currentTarget) ctx.onFocusItem(id);
|
|
9631
|
+
},
|
|
9632
|
+
children: kind === "error" ? /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("span", { className: "uix-org-chart__status uix-org-chart__status--error", onClick: () => ctx.onActivate(id), children: [
|
|
9633
|
+
ctx.labels.error,
|
|
9634
|
+
" ",
|
|
9635
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "uix-org-chart__retry", children: ctx.labels.retry })
|
|
9636
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("span", { className: "uix-org-chart__status", children: [
|
|
9637
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Ring2, {}),
|
|
9638
|
+
ctx.labels.loading
|
|
9639
|
+
] })
|
|
9640
|
+
}
|
|
9641
|
+
);
|
|
9642
|
+
}
|
|
9643
|
+
function OrgChartItem({ node, level, size, pos, ctx }) {
|
|
9644
|
+
const known = node.children ?? ctx.loaded.get(node.id);
|
|
9645
|
+
const expandable = isExpandable(node, known, ctx.lazy);
|
|
9646
|
+
const open = expandable && ctx.expanded.has(node.id);
|
|
9647
|
+
const count2 = known ? known.length : node.reportCount ?? 0;
|
|
9648
|
+
const nameId = idRef(ctx.chartId, node.id, "name");
|
|
9649
|
+
const descId = idRef(ctx.chartId, node.id, "desc");
|
|
9650
|
+
const reportsText = count2 > 0 ? fillLabel(count2 === 1 ? ctx.labels.reportsOne : ctx.labels.reportsMany, { count: count2 }) : "";
|
|
9651
|
+
const waiting = open && !known;
|
|
9652
|
+
const status = waiting ? ctx.failed.has(node.id) ? "error" : "loading" : null;
|
|
9653
|
+
const children = open && known && known.length > 0 ? known : null;
|
|
9654
|
+
const stack = ctx.stackLeaves && children !== null && children.every((c) => !isExpandable(c, c.children ?? ctx.loaded.get(c.id), ctx.lazy));
|
|
9655
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
9656
|
+
"li",
|
|
9657
|
+
{
|
|
9658
|
+
role: "treeitem",
|
|
9659
|
+
"aria-level": level,
|
|
9660
|
+
"aria-setsize": size,
|
|
9661
|
+
"aria-posinset": pos,
|
|
9662
|
+
"aria-expanded": expandable ? open : void 0,
|
|
9663
|
+
"aria-selected": ctx.selectable ? ctx.selected === node.id : void 0,
|
|
9664
|
+
"aria-busy": ctx.loading.has(node.id) || void 0,
|
|
9665
|
+
"aria-labelledby": nameId,
|
|
9666
|
+
"aria-describedby": descId,
|
|
9667
|
+
"data-id": node.id,
|
|
9668
|
+
tabIndex: ctx.tabbableId === node.id ? 0 : -1,
|
|
9669
|
+
className: "uix-org-chart__item",
|
|
9670
|
+
onFocus: (e) => {
|
|
9671
|
+
if (e.target === e.currentTarget) ctx.onFocusItem(node.id);
|
|
9672
|
+
},
|
|
9673
|
+
children: [
|
|
9674
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "uix-org-chart__node", onClick: () => ctx.onActivate(node.id), children: [
|
|
9675
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Avatar, { size: "lg", src: node.photo, children: node.initials ?? orgChartInitials(node.name) }),
|
|
9676
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("span", { className: "uix-org-chart__body", children: [
|
|
9677
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "uix-org-chart__name", id: nameId, children: node.name }),
|
|
9678
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("span", { id: descId, className: "uix-org-chart__desc", children: [
|
|
9679
|
+
node.title ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "uix-org-chart__title", children: node.title }) : null,
|
|
9680
|
+
node.team || node.location ? /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("span", { className: "uix-org-chart__meta", children: [
|
|
9681
|
+
node.team ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { children: node.team }) : null,
|
|
9682
|
+
node.location ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { children: node.location }) : null
|
|
9683
|
+
] }) : null,
|
|
9684
|
+
node.badge ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "uix-org-chart__badge", children: node.badge }) : null,
|
|
9685
|
+
reportsText ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "uix-visually-hidden", children: reportsText }) : null
|
|
9686
|
+
] })
|
|
9687
|
+
] }),
|
|
9688
|
+
expandable ? (
|
|
9689
|
+
// A pointer target for showing the reports without opening the person. Keyboard users
|
|
9690
|
+
// toggle with Space or the arrow keys on the item, so it stays out of the tab order and
|
|
9691
|
+
// never takes focus (the item keeps it), and the item's aria-expanded carries its state.
|
|
9692
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
9693
|
+
"button",
|
|
9694
|
+
{
|
|
9695
|
+
type: "button",
|
|
9696
|
+
tabIndex: -1,
|
|
9697
|
+
"aria-hidden": "true",
|
|
9698
|
+
title: open ? ctx.labels.collapse : ctx.labels.expand,
|
|
9699
|
+
className: "uix-org-chart__toggle",
|
|
9700
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
9701
|
+
onClick: (e) => {
|
|
9702
|
+
e.stopPropagation();
|
|
9703
|
+
ctx.onToggle(node.id);
|
|
9704
|
+
},
|
|
9705
|
+
children: [
|
|
9706
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ChevronIcon3, {}),
|
|
9707
|
+
count2 > 0 ? count2 : null
|
|
9708
|
+
]
|
|
9709
|
+
}
|
|
9710
|
+
)
|
|
9711
|
+
) : null
|
|
9712
|
+
] }),
|
|
9713
|
+
status ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("ul", { role: "group", className: "uix-org-chart__group", children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(StatusItem, { parent: node.id, kind: status, level: level + 1, ctx }) }) : children ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("ul", { role: "group", className: "uix-org-chart__group", "data-stack": stack ? "" : void 0, children: children.map((child, i) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(OrgChartItem, { node: child, level: level + 1, size: children.length, pos: i + 1, ctx }, child.id)) }) : null
|
|
9714
|
+
]
|
|
9715
|
+
}
|
|
9716
|
+
);
|
|
9717
|
+
}
|
|
9718
|
+
function OrgChart({
|
|
9719
|
+
nodes,
|
|
9720
|
+
expanded: controlledExpanded,
|
|
9721
|
+
defaultExpanded,
|
|
9722
|
+
onToggle,
|
|
9723
|
+
selected,
|
|
9724
|
+
onSelect,
|
|
9725
|
+
loadChildren,
|
|
9726
|
+
revealId,
|
|
9727
|
+
onReveal,
|
|
9728
|
+
stackLeaves = true,
|
|
9729
|
+
defaultZoom = 1,
|
|
9730
|
+
labels: labelOverrides,
|
|
9731
|
+
className,
|
|
9732
|
+
"aria-label": ariaLabel,
|
|
9733
|
+
"aria-labelledby": ariaLabelledby,
|
|
9734
|
+
...props
|
|
9735
|
+
}) {
|
|
9736
|
+
const labels = { ...DEFAULT_ORG_CHART_LABELS, ...useUixLabels().orgChart, ...labelOverrides };
|
|
9737
|
+
const chartId = (0, import_react63.useId)().replace(/[^A-Za-z0-9_-]/g, "");
|
|
9738
|
+
const [internalExpanded, setInternalExpanded] = (0, import_react63.useState)(() => defaultExpanded ?? /* @__PURE__ */ new Set());
|
|
9739
|
+
const expanded = controlledExpanded ?? internalExpanded;
|
|
9740
|
+
const treeRef = (0, import_react63.useRef)(null);
|
|
9741
|
+
const viewportRef = (0, import_react63.useRef)(null);
|
|
9742
|
+
const [focusedId, setFocusedId] = (0, import_react63.useState)(void 0);
|
|
9743
|
+
const selectable = selected !== void 0 || onSelect != null;
|
|
9744
|
+
const lazy = Boolean(loadChildren);
|
|
9745
|
+
const userMoved = (0, import_react63.useRef)(false);
|
|
9746
|
+
const placed = (0, import_react63.useRef)(null);
|
|
9747
|
+
const scrollFrame = (left, top) => {
|
|
9748
|
+
const viewport = viewportRef.current;
|
|
9749
|
+
if (!viewport) return;
|
|
9750
|
+
viewport.scrollLeft = left;
|
|
9751
|
+
viewport.scrollTop = top;
|
|
9752
|
+
placed.current = { left: viewport.scrollLeft, top: viewport.scrollTop };
|
|
9753
|
+
};
|
|
9754
|
+
const [loaded, setLoaded] = (0, import_react63.useState)(() => /* @__PURE__ */ new Map());
|
|
9755
|
+
const [failed, setFailed] = (0, import_react63.useState)(() => /* @__PURE__ */ new Set());
|
|
9756
|
+
const [loading, setLoading] = (0, import_react63.useState)(() => /* @__PURE__ */ new Set());
|
|
9757
|
+
const [announcement, setAnnouncement] = (0, import_react63.useState)("");
|
|
9758
|
+
const inFlight = (0, import_react63.useRef)(/* @__PURE__ */ new Set());
|
|
9759
|
+
const loadRef = (0, import_react63.useRef)(loadChildren);
|
|
9760
|
+
loadRef.current = loadChildren;
|
|
9761
|
+
const errorWord = (0, import_react63.useRef)(labels.error);
|
|
9762
|
+
errorWord.current = labels.error;
|
|
9763
|
+
const refocus = (0, import_react63.useRef)(null);
|
|
9764
|
+
const load = (0, import_react63.useCallback)((node) => {
|
|
9765
|
+
const run = loadRef.current;
|
|
9766
|
+
if (!run || inFlight.current.has(node.id)) return;
|
|
9767
|
+
inFlight.current.add(node.id);
|
|
9768
|
+
setFailed((prev) => {
|
|
9769
|
+
if (!prev.has(node.id)) return prev;
|
|
9770
|
+
const next = new Set(prev);
|
|
9771
|
+
next.delete(node.id);
|
|
9772
|
+
return next;
|
|
9773
|
+
});
|
|
9774
|
+
setLoading((prev) => new Set(prev).add(node.id));
|
|
9775
|
+
setAnnouncement("");
|
|
9776
|
+
const settle2 = (apply, focusNext) => {
|
|
9777
|
+
inFlight.current.delete(node.id);
|
|
9778
|
+
const active = typeof document !== "undefined" ? document.activeElement : null;
|
|
9779
|
+
if (active?.dataset?.id === node.id + LOADING2 || active?.dataset?.id === node.id + FAILED2) refocus.current = focusNext;
|
|
9780
|
+
setLoading((prev) => {
|
|
9781
|
+
const next = new Set(prev);
|
|
9782
|
+
next.delete(node.id);
|
|
9783
|
+
return next;
|
|
9784
|
+
});
|
|
9785
|
+
apply();
|
|
9786
|
+
};
|
|
9787
|
+
run(node).then(
|
|
9788
|
+
// Focus that waited on the loading row moves on to the first report, the key's intent.
|
|
9789
|
+
(children) => settle2(() => setLoaded((prev) => new Map(prev).set(node.id, children)), children[0]?.id ?? node.id),
|
|
9790
|
+
() => settle2(() => {
|
|
9791
|
+
setFailed((prev) => new Set(prev).add(node.id));
|
|
9792
|
+
setAnnouncement(errorWord.current);
|
|
9793
|
+
}, node.id + FAILED2)
|
|
9794
|
+
);
|
|
9795
|
+
}, []);
|
|
9796
|
+
(0, import_react63.useEffect)(() => {
|
|
9797
|
+
if (!loadChildren) return;
|
|
9798
|
+
const visit = (list) => {
|
|
9799
|
+
for (const node of list) {
|
|
9800
|
+
if (!expanded.has(node.id)) continue;
|
|
9801
|
+
const known = node.children ?? loaded.get(node.id);
|
|
9802
|
+
if (known) visit(known);
|
|
9803
|
+
else if ((node.reportCount ?? 0) > 0 && !failed.has(node.id)) load(node);
|
|
9804
|
+
}
|
|
9805
|
+
};
|
|
9806
|
+
visit(nodes);
|
|
9807
|
+
}, [nodes, expanded, loaded, failed, loadChildren, load]);
|
|
9808
|
+
const itemEl = (0, import_react63.useCallback)((id) => treeRef.current?.querySelector(`[role="treeitem"][data-id="${CSS.escape(id)}"]`) ?? null, []);
|
|
9809
|
+
const cardOf = (el) => el?.querySelector(":scope > .uix-org-chart__node, :scope > .uix-org-chart__status") ?? el;
|
|
9810
|
+
(0, import_react63.useEffect)(() => {
|
|
9811
|
+
const id = refocus.current;
|
|
9812
|
+
if (id == null) return;
|
|
9813
|
+
refocus.current = null;
|
|
9814
|
+
setFocusedId(id);
|
|
9815
|
+
itemEl(id)?.focus();
|
|
9816
|
+
}, [loaded, failed, loading, itemEl]);
|
|
9817
|
+
const findPath = (0, import_react63.useCallback)((id, list = nodes, path = []) => {
|
|
9818
|
+
for (const node of list) {
|
|
9819
|
+
if (node.id === id) return [...path, node];
|
|
9820
|
+
const inside = findPath(id, node.children ?? loaded.get(node.id) ?? [], [...path, node]);
|
|
9821
|
+
if (inside) return inside;
|
|
9822
|
+
}
|
|
9823
|
+
return null;
|
|
9824
|
+
}, [nodes, loaded]);
|
|
9825
|
+
const anchor = (0, import_react63.useRef)(null);
|
|
9826
|
+
const viewportBox = () => viewportRef.current?.getBoundingClientRect();
|
|
9827
|
+
const holdInPlace = (id) => {
|
|
9828
|
+
const card = cardOf(itemEl(id));
|
|
9829
|
+
const frame = viewportBox();
|
|
9830
|
+
if (!card || !frame || !viewportRef.current || layoutOf(viewportRef.current) === "list") {
|
|
9831
|
+
anchor.current = null;
|
|
9832
|
+
return;
|
|
9833
|
+
}
|
|
9834
|
+
const box = card.getBoundingClientRect();
|
|
9835
|
+
anchor.current = { id, x: box.left - frame.left, y: box.top - frame.top };
|
|
9836
|
+
};
|
|
9837
|
+
useIsoLayoutEffect(() => {
|
|
9838
|
+
const a = anchor.current;
|
|
9839
|
+
const viewport = viewportRef.current;
|
|
9840
|
+
if (!a || !viewport) return;
|
|
9841
|
+
const card = cardOf(itemEl(a.id));
|
|
9842
|
+
const frame = viewport.getBoundingClientRect();
|
|
9843
|
+
if (card) {
|
|
9844
|
+
const box = card.getBoundingClientRect();
|
|
9845
|
+
scrollFrame(viewport.scrollLeft + box.left - frame.left - a.x, viewport.scrollTop + box.top - frame.top - a.y);
|
|
9846
|
+
}
|
|
9847
|
+
if (!card || !inFlight.current.has(a.id) && !itemEl(a.id + LOADING2)) anchor.current = null;
|
|
9848
|
+
});
|
|
9849
|
+
const toggle = (0, import_react63.useCallback)((id) => {
|
|
9850
|
+
const opening = !expanded.has(id);
|
|
9851
|
+
userMoved.current = true;
|
|
9852
|
+
holdInPlace(id);
|
|
9853
|
+
const el = itemEl(id);
|
|
9854
|
+
const active = typeof document !== "undefined" ? document.activeElement : null;
|
|
9855
|
+
if (!opening && el && active && active !== el && el.contains(active)) {
|
|
9856
|
+
el.focus();
|
|
9857
|
+
setFocusedId(id);
|
|
9858
|
+
}
|
|
9859
|
+
if (!controlledExpanded) {
|
|
9860
|
+
setInternalExpanded((prev) => {
|
|
9861
|
+
const next = new Set(prev);
|
|
9862
|
+
if (next.has(id)) next.delete(id);
|
|
9863
|
+
else next.add(id);
|
|
9864
|
+
return next;
|
|
9865
|
+
});
|
|
9866
|
+
}
|
|
9867
|
+
onToggle?.(id, opening);
|
|
9868
|
+
}, [expanded, controlledExpanded, onToggle, itemEl]);
|
|
9869
|
+
const retry = (0, import_react63.useCallback)((parentId) => {
|
|
9870
|
+
const path = findPath(parentId);
|
|
9871
|
+
const parent = path ? path[path.length - 1] : void 0;
|
|
9872
|
+
if (!parent) return;
|
|
9873
|
+
refocus.current = parent.id + LOADING2;
|
|
9874
|
+
setFailed((prev) => {
|
|
9875
|
+
const next = new Set(prev);
|
|
9876
|
+
next.delete(parent.id);
|
|
9877
|
+
return next;
|
|
9878
|
+
});
|
|
9879
|
+
load(parent);
|
|
9880
|
+
}, [findPath, load]);
|
|
9881
|
+
const select = (0, import_react63.useCallback)((id) => {
|
|
9882
|
+
const synthetic = syntheticOf2(id);
|
|
9883
|
+
if (!synthetic) {
|
|
9884
|
+
onSelect?.(id);
|
|
9885
|
+
return;
|
|
9886
|
+
}
|
|
9887
|
+
if (synthetic.kind === "error") retry(synthetic.parent);
|
|
9888
|
+
}, [onSelect, retry]);
|
|
9889
|
+
const rendered = (0, import_react63.useMemo)(() => {
|
|
9890
|
+
const ids = /* @__PURE__ */ new Set();
|
|
9891
|
+
const visit = (list) => {
|
|
9892
|
+
for (const node of list) {
|
|
9893
|
+
ids.add(node.id);
|
|
9894
|
+
if (!expanded.has(node.id)) continue;
|
|
9895
|
+
const known = node.children ?? loaded.get(node.id);
|
|
9896
|
+
if (known) visit(known);
|
|
9897
|
+
else if (lazy && (node.reportCount ?? 0) > 0) ids.add(node.id + (failed.has(node.id) ? FAILED2 : LOADING2));
|
|
9898
|
+
}
|
|
9899
|
+
};
|
|
9900
|
+
visit(nodes);
|
|
9901
|
+
return ids;
|
|
9902
|
+
}, [nodes, expanded, loaded, failed, lazy]);
|
|
9903
|
+
const tabbableId = (focusedId && rendered.has(focusedId) ? focusedId : void 0) ?? (selected && rendered.has(selected) ? selected : void 0) ?? nodes[0]?.id;
|
|
9904
|
+
useIsoLayoutEffect(() => {
|
|
9905
|
+
if (!focusedId || rendered.has(focusedId) || typeof document === "undefined") return;
|
|
9906
|
+
const active = document.activeElement;
|
|
9907
|
+
if (active && active !== document.body) return;
|
|
9908
|
+
const target = syntheticOf2(focusedId)?.parent ?? focusedId;
|
|
9909
|
+
const line = findPath(target) ?? [];
|
|
9910
|
+
const visible = [...line].reverse().find((n) => rendered.has(n.id));
|
|
9911
|
+
if (visible) {
|
|
9912
|
+
setFocusedId(visible.id);
|
|
9913
|
+
itemEl(visible.id)?.focus();
|
|
9914
|
+
}
|
|
9915
|
+
}, [rendered]);
|
|
9916
|
+
const activate = (0, import_react63.useCallback)((id) => {
|
|
9917
|
+
setFocusedId(id);
|
|
9918
|
+
itemEl(id)?.focus({ preventScroll: true });
|
|
9919
|
+
select(id);
|
|
9920
|
+
}, [itemEl, select]);
|
|
9921
|
+
const revealed = (0, import_react63.useRef)(null);
|
|
9922
|
+
(0, import_react63.useEffect)(() => {
|
|
9923
|
+
if (!revealId) {
|
|
9924
|
+
revealed.current = null;
|
|
9925
|
+
return;
|
|
9926
|
+
}
|
|
9927
|
+
if (revealed.current === revealId) return;
|
|
9928
|
+
const el = itemEl(revealId);
|
|
9929
|
+
if (!el) return;
|
|
9930
|
+
revealed.current = revealId;
|
|
9931
|
+
userMoved.current = true;
|
|
9932
|
+
cardOf(el)?.scrollIntoView?.({ block: "center", inline: "center" });
|
|
9933
|
+
el.focus({ preventScroll: true });
|
|
9934
|
+
setFocusedId(revealId);
|
|
9935
|
+
onReveal?.(revealId);
|
|
9936
|
+
});
|
|
9937
|
+
const [zoom, setZoom] = (0, import_react63.useState)(() => typeof defaultZoom === "number" ? clampZoom(defaultZoom) : 1);
|
|
9938
|
+
const zoomCentre = (0, import_react63.useRef)(null);
|
|
9939
|
+
const zoomTo = (next) => {
|
|
9940
|
+
const viewport = viewportRef.current;
|
|
9941
|
+
if (viewport) {
|
|
9942
|
+
zoomCentre.current = {
|
|
9943
|
+
x: (viewport.scrollLeft + viewport.clientWidth / 2) / zoom,
|
|
9944
|
+
y: (viewport.scrollTop + viewport.clientHeight / 2) / zoom,
|
|
9945
|
+
from: zoom
|
|
9946
|
+
};
|
|
9947
|
+
}
|
|
9948
|
+
setZoom(clampZoom(next));
|
|
9949
|
+
};
|
|
9950
|
+
useIsoLayoutEffect(() => {
|
|
9951
|
+
const c = zoomCentre.current;
|
|
9952
|
+
const viewport = viewportRef.current;
|
|
9953
|
+
if (!c || !viewport || c.from === zoom) return;
|
|
9954
|
+
zoomCentre.current = null;
|
|
9955
|
+
scrollFrame(c.x * zoom - viewport.clientWidth / 2, c.y * zoom - viewport.clientHeight / 2);
|
|
9956
|
+
}, [zoom]);
|
|
9957
|
+
const fitZoom = (0, import_react63.useCallback)((current) => {
|
|
9958
|
+
const viewport = viewportRef.current;
|
|
9959
|
+
const tree = treeRef.current;
|
|
9960
|
+
if (!viewport || !tree) return null;
|
|
9961
|
+
const cs = getComputedStyle(viewport);
|
|
9962
|
+
const room = viewport.clientWidth - (parseFloat(cs.paddingLeft) || 0) - (parseFloat(cs.paddingRight) || 0);
|
|
9963
|
+
const width = tree.getBoundingClientRect().width / current;
|
|
9964
|
+
if (!(room > 0) || !(width > 0)) return null;
|
|
9965
|
+
return clampZoom(Math.min(1, room / width));
|
|
9966
|
+
}, []);
|
|
9967
|
+
const settledWidth = (0, import_react63.useRef)(-1);
|
|
9968
|
+
useIsoLayoutEffect(() => {
|
|
9969
|
+
const viewport = viewportRef.current;
|
|
9970
|
+
const tree = treeRef.current;
|
|
9971
|
+
if (userMoved.current || !viewport || !tree || nodes.length === 0) return;
|
|
9972
|
+
const width = Math.round(tree.getBoundingClientRect().width);
|
|
9973
|
+
if (width === settledWidth.current) return;
|
|
9974
|
+
if (defaultZoom === "fit") {
|
|
9975
|
+
const next = fitZoom(zoom);
|
|
9976
|
+
if (next !== null && Math.abs(next - zoom) > 5e-3) {
|
|
9977
|
+
setZoom(next);
|
|
9978
|
+
return;
|
|
9979
|
+
}
|
|
9980
|
+
}
|
|
9981
|
+
settledWidth.current = width;
|
|
9982
|
+
if (viewport.scrollWidth > viewport.clientWidth) scrollFrame((viewport.scrollWidth - viewport.clientWidth) / 2, viewport.scrollTop);
|
|
9983
|
+
});
|
|
9984
|
+
const onScroll = () => {
|
|
9985
|
+
const viewport = viewportRef.current;
|
|
9986
|
+
const at = placed.current;
|
|
9987
|
+
if (!viewport) return;
|
|
9988
|
+
if (at && Math.abs(viewport.scrollLeft - at.left) <= 1 && Math.abs(viewport.scrollTop - at.top) <= 1) return;
|
|
9989
|
+
userMoved.current = true;
|
|
9990
|
+
};
|
|
9991
|
+
const pan = (0, import_react63.useRef)(null);
|
|
9992
|
+
const [panning, setPanning] = (0, import_react63.useState)(false);
|
|
9993
|
+
const onPointerDown = (e) => {
|
|
9994
|
+
if (e.button !== 0 || e.pointerType === "touch") return;
|
|
9995
|
+
if (e.target.closest(".uix-org-chart__node, .uix-org-chart__status")) return;
|
|
9996
|
+
const viewport = viewportRef.current;
|
|
9997
|
+
if (!viewport || layoutOf(viewport) === "list") return;
|
|
9998
|
+
const frame = viewport.getBoundingClientRect();
|
|
9999
|
+
const x = e.clientX - frame.left - viewport.clientLeft;
|
|
10000
|
+
const y = e.clientY - frame.top - viewport.clientTop;
|
|
10001
|
+
if (x > viewport.clientWidth || y > viewport.clientHeight) return;
|
|
10002
|
+
pan.current = { x: e.clientX, y: e.clientY, left: viewport.scrollLeft, top: viewport.scrollTop, id: e.pointerId };
|
|
10003
|
+
userMoved.current = true;
|
|
10004
|
+
viewport.setPointerCapture?.(e.pointerId);
|
|
10005
|
+
setPanning(true);
|
|
10006
|
+
};
|
|
10007
|
+
const onMouseDown = (e) => {
|
|
10008
|
+
if (pan.current) e.preventDefault();
|
|
10009
|
+
};
|
|
10010
|
+
const onPointerMove = (e) => {
|
|
10011
|
+
const p = pan.current;
|
|
10012
|
+
const viewport = viewportRef.current;
|
|
10013
|
+
if (!p || !viewport || e.pointerId !== p.id) return;
|
|
10014
|
+
scrollFrame(p.left - (e.clientX - p.x), p.top - (e.clientY - p.y));
|
|
10015
|
+
};
|
|
10016
|
+
const endPan = (e) => {
|
|
10017
|
+
if (!pan.current || e.pointerId !== pan.current.id) return;
|
|
10018
|
+
viewportRef.current?.releasePointerCapture?.(e.pointerId);
|
|
10019
|
+
pan.current = null;
|
|
10020
|
+
setPanning(false);
|
|
10021
|
+
};
|
|
10022
|
+
const focusItem = (el) => {
|
|
10023
|
+
if (el) {
|
|
10024
|
+
el.focus();
|
|
10025
|
+
setFocusedId(el.dataset.id);
|
|
10026
|
+
}
|
|
10027
|
+
};
|
|
10028
|
+
const onKeyDown = (e) => {
|
|
10029
|
+
const cur = e.target.closest('[role="treeitem"]');
|
|
10030
|
+
const tree = treeRef.current;
|
|
10031
|
+
if (!cur || !tree?.contains(cur) || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
10032
|
+
const items = Array.from(tree.querySelectorAll('[role="treeitem"]'));
|
|
10033
|
+
const idx = items.indexOf(cur);
|
|
10034
|
+
const id = cur.dataset.id;
|
|
10035
|
+
const state = cur.getAttribute("aria-expanded");
|
|
10036
|
+
const parent = cur.parentElement?.closest('[role="treeitem"]') ?? null;
|
|
10037
|
+
const firstChild = cur.querySelector(':scope > [role="group"] > [role="treeitem"]');
|
|
10038
|
+
const column = cur.parentElement;
|
|
10039
|
+
const stacked = column?.hasAttribute("data-stack") ?? false;
|
|
10040
|
+
const sameLevel = (dir) => {
|
|
10041
|
+
const level = cur.getAttribute("aria-level");
|
|
10042
|
+
const row = items.filter((el) => el.getAttribute("aria-level") === level);
|
|
10043
|
+
const edge = stacked && column ? dir > 0 ? column.lastElementChild : column.firstElementChild : cur;
|
|
10044
|
+
return row[row.indexOf(edge ?? cur) + dir];
|
|
10045
|
+
};
|
|
10046
|
+
const sibling = (dir) => dir > 0 ? cur.nextElementSibling : cur.previousElementSibling;
|
|
10047
|
+
const list = viewportRef.current ? layoutOf(viewportRef.current) === "list" : false;
|
|
10048
|
+
const synthetic = syntheticOf2(id);
|
|
10049
|
+
let handled = true;
|
|
10050
|
+
switch (e.key) {
|
|
10051
|
+
case "Home":
|
|
10052
|
+
focusItem(items[0]);
|
|
10053
|
+
break;
|
|
10054
|
+
case "End":
|
|
10055
|
+
focusItem(items[items.length - 1]);
|
|
10056
|
+
break;
|
|
10057
|
+
case "Enter":
|
|
10058
|
+
select(id);
|
|
10059
|
+
setFocusedId(id);
|
|
10060
|
+
break;
|
|
10061
|
+
case " ":
|
|
10062
|
+
if (synthetic) select(id);
|
|
10063
|
+
else if (state !== null) toggle(id);
|
|
10064
|
+
else select(id);
|
|
10065
|
+
setFocusedId(id);
|
|
10066
|
+
break;
|
|
10067
|
+
default:
|
|
10068
|
+
if (list) {
|
|
10069
|
+
switch (e.key) {
|
|
10070
|
+
case "ArrowDown":
|
|
10071
|
+
focusItem(items[Math.min(idx + 1, items.length - 1)]);
|
|
10072
|
+
break;
|
|
10073
|
+
case "ArrowUp":
|
|
10074
|
+
focusItem(items[Math.max(idx - 1, 0)]);
|
|
10075
|
+
break;
|
|
10076
|
+
case "ArrowRight":
|
|
10077
|
+
if (state === "false") toggle(id);
|
|
10078
|
+
else if (state === "true") focusItem(firstChild);
|
|
10079
|
+
break;
|
|
10080
|
+
case "ArrowLeft":
|
|
10081
|
+
if (state === "true") toggle(id);
|
|
10082
|
+
else focusItem(parent);
|
|
10083
|
+
break;
|
|
10084
|
+
default:
|
|
10085
|
+
handled = false;
|
|
10086
|
+
}
|
|
10087
|
+
} else {
|
|
10088
|
+
switch (e.key) {
|
|
10089
|
+
case "ArrowUp":
|
|
10090
|
+
focusItem(stacked ? sibling(-1) ?? parent : parent);
|
|
10091
|
+
break;
|
|
10092
|
+
case "ArrowDown":
|
|
10093
|
+
if (stacked && sibling(1) && state !== "true") focusItem(sibling(1));
|
|
10094
|
+
else if (state === "false") toggle(id);
|
|
10095
|
+
else if (state === "true") focusItem(firstChild);
|
|
10096
|
+
break;
|
|
10097
|
+
case "ArrowRight":
|
|
10098
|
+
focusItem(sameLevel(1));
|
|
10099
|
+
break;
|
|
10100
|
+
case "ArrowLeft":
|
|
10101
|
+
focusItem(sameLevel(-1));
|
|
10102
|
+
break;
|
|
10103
|
+
default:
|
|
10104
|
+
handled = false;
|
|
10105
|
+
}
|
|
10106
|
+
}
|
|
10107
|
+
if (!handled && e.key.length === 1 && e.key.trim() !== "") {
|
|
10108
|
+
const ch = e.key.toLocaleLowerCase();
|
|
10109
|
+
const nameOf = (el) => document.getElementById(el.getAttribute("aria-labelledby") ?? "")?.textContent?.trim().toLocaleLowerCase() ?? "";
|
|
10110
|
+
const people = items.filter((el) => !syntheticOf2(el.dataset.id ?? ""));
|
|
10111
|
+
const start = people.indexOf(cur);
|
|
10112
|
+
const next = [...people.slice(start + 1), ...people.slice(0, start + 1)].find((el) => nameOf(el).startsWith(ch));
|
|
10113
|
+
if (next) {
|
|
10114
|
+
focusItem(next);
|
|
10115
|
+
handled = true;
|
|
10116
|
+
}
|
|
10117
|
+
}
|
|
10118
|
+
}
|
|
10119
|
+
if (handled) e.preventDefault();
|
|
10120
|
+
};
|
|
10121
|
+
const ctx = {
|
|
10122
|
+
expanded,
|
|
10123
|
+
loaded,
|
|
10124
|
+
failed,
|
|
10125
|
+
loading,
|
|
10126
|
+
lazy,
|
|
10127
|
+
selectable,
|
|
10128
|
+
selected,
|
|
10129
|
+
tabbableId,
|
|
10130
|
+
stackLeaves,
|
|
10131
|
+
labels,
|
|
10132
|
+
chartId,
|
|
10133
|
+
onToggle: toggle,
|
|
10134
|
+
onActivate: activate,
|
|
10135
|
+
onFocusItem: setFocusedId
|
|
10136
|
+
};
|
|
10137
|
+
const percent = fillLabel(labels.zoomLevel, { percent: Math.round(zoom * 100) });
|
|
10138
|
+
const atMin = zoom <= MIN_ZOOM + 1e-3;
|
|
10139
|
+
const atMax = zoom >= MAX_ZOOM - 1e-3;
|
|
10140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: cx("uix-org-chart", className), ...props, children: [
|
|
10141
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "uix-org-chart__toolbar", role: "group", "aria-label": labels.toolbar, children: [
|
|
10142
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
10143
|
+
Button,
|
|
10144
|
+
{
|
|
10145
|
+
type: "button",
|
|
10146
|
+
variant: "ghost",
|
|
10147
|
+
size: "sm",
|
|
10148
|
+
icon: true,
|
|
10149
|
+
"aria-label": labels.zoomOut,
|
|
10150
|
+
title: labels.zoomOut,
|
|
10151
|
+
"aria-disabled": atMin || void 0,
|
|
10152
|
+
onClick: () => {
|
|
10153
|
+
if (!atMin) {
|
|
10154
|
+
userMoved.current = true;
|
|
10155
|
+
zoomTo(orgChartZoomStep(zoom, -1));
|
|
10156
|
+
}
|
|
10157
|
+
},
|
|
10158
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(MinusIcon, {})
|
|
10159
|
+
}
|
|
10160
|
+
),
|
|
10161
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
10162
|
+
Button,
|
|
10163
|
+
{
|
|
10164
|
+
type: "button",
|
|
10165
|
+
variant: "ghost",
|
|
10166
|
+
size: "sm",
|
|
10167
|
+
className: "uix-org-chart__level",
|
|
10168
|
+
"aria-label": fillLabel(labels.resetZoom, { percent }),
|
|
10169
|
+
onClick: () => {
|
|
10170
|
+
userMoved.current = true;
|
|
10171
|
+
zoomTo(1);
|
|
10172
|
+
},
|
|
10173
|
+
children: percent
|
|
10174
|
+
}
|
|
10175
|
+
),
|
|
10176
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
10177
|
+
Button,
|
|
10178
|
+
{
|
|
10179
|
+
type: "button",
|
|
10180
|
+
variant: "ghost",
|
|
10181
|
+
size: "sm",
|
|
10182
|
+
icon: true,
|
|
10183
|
+
"aria-label": labels.zoomIn,
|
|
10184
|
+
title: labels.zoomIn,
|
|
10185
|
+
"aria-disabled": atMax || void 0,
|
|
10186
|
+
onClick: () => {
|
|
10187
|
+
if (!atMax) {
|
|
10188
|
+
userMoved.current = true;
|
|
10189
|
+
zoomTo(orgChartZoomStep(zoom, 1));
|
|
10190
|
+
}
|
|
10191
|
+
},
|
|
10192
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(PlusIcon, {})
|
|
10193
|
+
}
|
|
10194
|
+
),
|
|
10195
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(Button, { type: "button", variant: "ghost", size: "sm", onClick: () => {
|
|
10196
|
+
userMoved.current = true;
|
|
10197
|
+
const next = fitZoom(zoom);
|
|
10198
|
+
if (next !== null) zoomTo(next);
|
|
10199
|
+
}, children: [
|
|
10200
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(FitIcon, {}),
|
|
10201
|
+
labels.fit
|
|
10202
|
+
] })
|
|
10203
|
+
] }),
|
|
10204
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
10205
|
+
"div",
|
|
10206
|
+
{
|
|
10207
|
+
ref: viewportRef,
|
|
10208
|
+
className: "uix-org-chart__viewport",
|
|
10209
|
+
"data-panning": panning ? "" : void 0,
|
|
10210
|
+
onPointerDown,
|
|
10211
|
+
onMouseDown,
|
|
10212
|
+
onPointerMove,
|
|
10213
|
+
onPointerUp: endPan,
|
|
10214
|
+
onPointerCancel: endPan,
|
|
10215
|
+
onWheel: () => {
|
|
10216
|
+
userMoved.current = true;
|
|
10217
|
+
},
|
|
10218
|
+
onScroll,
|
|
10219
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "uix-org-chart__canvas", style: { "--org-chart-zoom": zoom }, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
10220
|
+
"ul",
|
|
10221
|
+
{
|
|
10222
|
+
ref: treeRef,
|
|
10223
|
+
role: "tree",
|
|
10224
|
+
"aria-label": ariaLabel ?? (ariaLabelledby ? void 0 : labels.chart),
|
|
10225
|
+
"aria-labelledby": ariaLabelledby,
|
|
10226
|
+
className: "uix-org-chart__tree",
|
|
10227
|
+
onKeyDown,
|
|
10228
|
+
children: nodes.map((node, i) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(OrgChartItem, { node, level: 1, size: nodes.length, pos: i + 1, ctx }, node.id))
|
|
10229
|
+
}
|
|
10230
|
+
) })
|
|
10231
|
+
}
|
|
10232
|
+
),
|
|
10233
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "uix-visually-hidden", role: "status", children: announcement })
|
|
10234
|
+
] });
|
|
10235
|
+
}
|
|
10236
|
+
function layoutOf(viewport) {
|
|
10237
|
+
if (typeof getComputedStyle !== "function") return "chart";
|
|
10238
|
+
return getComputedStyle(viewport).getPropertyValue("--org-chart-layout").trim() === "list" ? "list" : "chart";
|
|
10239
|
+
}
|
|
10240
|
+
|
|
10241
|
+
// src/components/EditorialHome.tsx
|
|
10242
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
9566
10243
|
function PageIntro({
|
|
9567
10244
|
kicker,
|
|
9568
10245
|
title,
|
|
@@ -9575,43 +10252,43 @@ function PageIntro({
|
|
|
9575
10252
|
children,
|
|
9576
10253
|
...props
|
|
9577
10254
|
}) {
|
|
9578
|
-
return /* @__PURE__ */ (0,
|
|
9579
|
-
/* @__PURE__ */ (0,
|
|
9580
|
-
kicker != null && /* @__PURE__ */ (0,
|
|
9581
|
-
/* @__PURE__ */ (0,
|
|
9582
|
-
lede != null && /* @__PURE__ */ (0,
|
|
10255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("section", { className: cx("uix-page-intro", className), ...props, children: [
|
|
10256
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { children: [
|
|
10257
|
+
kicker != null && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "uix-page-kicker", children: kicker }),
|
|
10258
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("h1", { className: "uix-page-title", children: title }),
|
|
10259
|
+
lede != null && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "uix-page-lede", children: lede })
|
|
9583
10260
|
] }),
|
|
9584
|
-
search != null && /* @__PURE__ */ (0,
|
|
9585
|
-
searchLabel != null && /* @__PURE__ */ (0,
|
|
10261
|
+
search != null && /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { children: [
|
|
10262
|
+
searchLabel != null && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "uix-intro-search__label", children: searchLabel }),
|
|
9586
10263
|
search
|
|
9587
10264
|
] }),
|
|
9588
|
-
shortcuts != null && /* @__PURE__ */ (0,
|
|
10265
|
+
shortcuts != null && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "uix-shortcut-grid", "aria-label": shortcutsLabel, children: shortcuts }),
|
|
9589
10266
|
children
|
|
9590
10267
|
] });
|
|
9591
10268
|
}
|
|
9592
10269
|
function SectionHead({ title, titleId, help, helpLabel, action, className, ...props }) {
|
|
9593
|
-
const heading = /* @__PURE__ */ (0,
|
|
9594
|
-
return /* @__PURE__ */ (0,
|
|
9595
|
-
hasHelp(help) ? /* @__PURE__ */ (0,
|
|
10270
|
+
const heading = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("h2", { className: "uix-section-title", id: titleId, children: title });
|
|
10271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: cx("uix-section-head", className), ...props, children: [
|
|
10272
|
+
hasHelp(help) ? /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "uix-section-head__title-row", children: [
|
|
9596
10273
|
heading,
|
|
9597
|
-
/* @__PURE__ */ (0,
|
|
10274
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(InfoTip, { content: help, label: helpLabel ?? helpLabelFor(title) })
|
|
9598
10275
|
] }) : heading,
|
|
9599
10276
|
action
|
|
9600
10277
|
] });
|
|
9601
10278
|
}
|
|
9602
10279
|
function NoticeQueue({ icon, title, summary, meta, position, actions, className, ...props }) {
|
|
9603
|
-
return /* @__PURE__ */ (0,
|
|
10280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("section", { className: cx("uix-notice", className), ...props, children: [
|
|
9604
10281
|
icon,
|
|
9605
|
-
/* @__PURE__ */ (0,
|
|
9606
|
-
/* @__PURE__ */ (0,
|
|
9607
|
-
title != null && /* @__PURE__ */ (0,
|
|
10282
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "uix-notice__content", "aria-live": "polite", children: [
|
|
10283
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("p", { className: "uix-notice__copy", children: [
|
|
10284
|
+
title != null && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("strong", { children: title }),
|
|
9608
10285
|
title != null && summary != null && " ",
|
|
9609
10286
|
summary
|
|
9610
10287
|
] }),
|
|
9611
|
-
meta != null && /* @__PURE__ */ (0,
|
|
10288
|
+
meta != null && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "uix-notice__meta", children: meta })
|
|
9612
10289
|
] }),
|
|
9613
|
-
(position != null || actions != null) && /* @__PURE__ */ (0,
|
|
9614
|
-
position != null && /* @__PURE__ */ (0,
|
|
10290
|
+
(position != null || actions != null) && /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "uix-notice__actions", children: [
|
|
10291
|
+
position != null && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "uix-notice__position", children: position }),
|
|
9615
10292
|
actions
|
|
9616
10293
|
] })
|
|
9617
10294
|
] });
|
|
@@ -9629,8 +10306,8 @@ function FeaturedStage({
|
|
|
9629
10306
|
className,
|
|
9630
10307
|
...props
|
|
9631
10308
|
}) {
|
|
9632
|
-
return /* @__PURE__ */ (0,
|
|
9633
|
-
/* @__PURE__ */ (0,
|
|
10309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("article", { className: cx("uix-featured__stage", className), ...props, children: [
|
|
10310
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
9634
10311
|
"div",
|
|
9635
10312
|
{
|
|
9636
10313
|
className: "uix-featured__visual",
|
|
@@ -9640,32 +10317,32 @@ function FeaturedStage({
|
|
|
9640
10317
|
children: visual
|
|
9641
10318
|
}
|
|
9642
10319
|
),
|
|
9643
|
-
/* @__PURE__ */ (0,
|
|
9644
|
-
(eyebrow != null || ordinal != null) && /* @__PURE__ */ (0,
|
|
9645
|
-
ordinal != null && /* @__PURE__ */ (0,
|
|
10320
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "uix-featured__content", "aria-live": "polite", children: [
|
|
10321
|
+
(eyebrow != null || ordinal != null) && /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("p", { className: "uix-featured__eyebrow", children: [
|
|
10322
|
+
ordinal != null && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "uix-featured__now", children: ordinal }),
|
|
9646
10323
|
eyebrow
|
|
9647
10324
|
] }),
|
|
9648
|
-
/* @__PURE__ */ (0,
|
|
9649
|
-
description != null && /* @__PURE__ */ (0,
|
|
9650
|
-
meta != null && /* @__PURE__ */ (0,
|
|
10325
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("h2", { className: "uix-featured__title", id: titleId, children: title }),
|
|
10326
|
+
description != null && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "uix-featured__description", children: description }),
|
|
10327
|
+
meta != null && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "uix-featured__meta", children: meta }),
|
|
9651
10328
|
action
|
|
9652
10329
|
] })
|
|
9653
10330
|
] });
|
|
9654
10331
|
}
|
|
9655
10332
|
function FeaturedRundown({ eyebrow, title, titleId, meta, children, className, ...props }) {
|
|
9656
|
-
return /* @__PURE__ */ (0,
|
|
9657
|
-
/* @__PURE__ */ (0,
|
|
9658
|
-
/* @__PURE__ */ (0,
|
|
9659
|
-
eyebrow != null && /* @__PURE__ */ (0,
|
|
9660
|
-
/* @__PURE__ */ (0,
|
|
10333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("aside", { className: cx("uix-rundown", className), ...props, children: [
|
|
10334
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "uix-rundown__head", children: [
|
|
10335
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { children: [
|
|
10336
|
+
eyebrow != null && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "uix-rundown__eyebrow", children: eyebrow }),
|
|
10337
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("h2", { className: "uix-rundown__title", id: titleId, children: title })
|
|
9661
10338
|
] }),
|
|
9662
10339
|
meta
|
|
9663
10340
|
] }),
|
|
9664
|
-
/* @__PURE__ */ (0,
|
|
10341
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "uix-rundown__items", children })
|
|
9665
10342
|
] });
|
|
9666
10343
|
}
|
|
9667
10344
|
function FeaturedRundownItem({ number, topic, title, selected = false, className, ...props }) {
|
|
9668
|
-
return /* @__PURE__ */ (0,
|
|
10345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
|
|
9669
10346
|
"button",
|
|
9670
10347
|
{
|
|
9671
10348
|
type: "button",
|
|
@@ -9674,63 +10351,63 @@ function FeaturedRundownItem({ number, topic, title, selected = false, className
|
|
|
9674
10351
|
"data-selected": selected ? "true" : "false",
|
|
9675
10352
|
...props,
|
|
9676
10353
|
children: [
|
|
9677
|
-
number != null && /* @__PURE__ */ (0,
|
|
9678
|
-
/* @__PURE__ */ (0,
|
|
9679
|
-
topic != null && /* @__PURE__ */ (0,
|
|
9680
|
-
/* @__PURE__ */ (0,
|
|
10354
|
+
number != null && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "uix-rundown__number", children: number }),
|
|
10355
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("span", { children: [
|
|
10356
|
+
topic != null && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "uix-rundown__topic", children: topic }),
|
|
10357
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "uix-rundown__item-title", children: title })
|
|
9681
10358
|
] })
|
|
9682
10359
|
]
|
|
9683
10360
|
}
|
|
9684
10361
|
);
|
|
9685
10362
|
}
|
|
9686
10363
|
function NewsLead({ meta, title, summary, className, ...props }) {
|
|
9687
|
-
return /* @__PURE__ */ (0,
|
|
9688
|
-
meta != null && /* @__PURE__ */ (0,
|
|
9689
|
-
/* @__PURE__ */ (0,
|
|
9690
|
-
summary != null && /* @__PURE__ */ (0,
|
|
10364
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("article", { className: cx("uix-news-lead", className), ...props, children: [
|
|
10365
|
+
meta != null && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "uix-news-lead__meta", children: meta }),
|
|
10366
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("h3", { className: "uix-news-lead__title", children: title }),
|
|
10367
|
+
summary != null && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "uix-news-lead__summary", children: summary })
|
|
9691
10368
|
] });
|
|
9692
10369
|
}
|
|
9693
10370
|
function ContentList({ children, className, ...props }) {
|
|
9694
|
-
return /* @__PURE__ */ (0,
|
|
10371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("ul", { className: cx("uix-content-list", className), ...props, children });
|
|
9695
10372
|
}
|
|
9696
10373
|
function ContentListItem({ title, meta, trailing, className, ...props }) {
|
|
9697
|
-
return /* @__PURE__ */ (0,
|
|
9698
|
-
/* @__PURE__ */ (0,
|
|
9699
|
-
/* @__PURE__ */ (0,
|
|
9700
|
-
meta != null && /* @__PURE__ */ (0,
|
|
10374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("li", { className: cx("uix-content-list__item", className), ...props, children: [
|
|
10375
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { children: [
|
|
10376
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "uix-content-list__title", children: title }),
|
|
10377
|
+
meta != null && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "uix-content-list__meta", children: meta })
|
|
9701
10378
|
] }),
|
|
9702
10379
|
trailing
|
|
9703
10380
|
] });
|
|
9704
10381
|
}
|
|
9705
10382
|
function ResourceGrid({ children, className, ...props }) {
|
|
9706
|
-
return /* @__PURE__ */ (0,
|
|
10383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: cx("uix-resource-grid", className), ...props, children });
|
|
9707
10384
|
}
|
|
9708
10385
|
function StatLine({ items, children, className, ...props }) {
|
|
9709
|
-
return /* @__PURE__ */ (0,
|
|
9710
|
-
items?.map((item, i) => /* @__PURE__ */ (0,
|
|
9711
|
-
/* @__PURE__ */ (0,
|
|
9712
|
-
/* @__PURE__ */ (0,
|
|
10386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: cx("uix-stat-line", className), ...props, children: [
|
|
10387
|
+
items?.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "uix-stat-line__item", children: [
|
|
10388
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "uix-stat-line__value", children: item.value }),
|
|
10389
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "uix-stat-line__label", children: item.label })
|
|
9713
10390
|
] }, item.id ?? i)),
|
|
9714
10391
|
children
|
|
9715
10392
|
] });
|
|
9716
10393
|
}
|
|
9717
10394
|
function EventRow({ month, day, title, meta, className, ...props }) {
|
|
9718
|
-
return /* @__PURE__ */ (0,
|
|
9719
|
-
/* @__PURE__ */ (0,
|
|
9720
|
-
/* @__PURE__ */ (0,
|
|
9721
|
-
/* @__PURE__ */ (0,
|
|
10395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: cx("uix-event-row", className), ...props, children: [
|
|
10396
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "uix-event-date", children: [
|
|
10397
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "uix-event-date__month", children: month }),
|
|
10398
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "uix-event-date__day", children: day })
|
|
9722
10399
|
] }),
|
|
9723
|
-
/* @__PURE__ */ (0,
|
|
9724
|
-
/* @__PURE__ */ (0,
|
|
9725
|
-
meta != null && /* @__PURE__ */ (0,
|
|
10400
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { children: [
|
|
10401
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "uix-event-row__title", children: title }),
|
|
10402
|
+
meta != null && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "uix-event-row__meta", children: meta })
|
|
9726
10403
|
] })
|
|
9727
10404
|
] });
|
|
9728
10405
|
}
|
|
9729
10406
|
function StatusRow({ indicator, name, meta, className, ...props }) {
|
|
9730
|
-
return /* @__PURE__ */ (0,
|
|
10407
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: cx("uix-status-row", className), ...props, children: [
|
|
9731
10408
|
indicator,
|
|
9732
|
-
/* @__PURE__ */ (0,
|
|
9733
|
-
meta != null && /* @__PURE__ */ (0,
|
|
10409
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "uix-status-row__name", children: name }),
|
|
10410
|
+
meta != null && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "uix-list-meta", children: meta })
|
|
9734
10411
|
] });
|
|
9735
10412
|
}
|
|
9736
10413
|
|
|
@@ -9860,7 +10537,7 @@ function summarizeRule(value, labels = {}) {
|
|
|
9860
10537
|
}
|
|
9861
10538
|
|
|
9862
10539
|
// src/components/RuleBuilder.tsx
|
|
9863
|
-
var
|
|
10540
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
9864
10541
|
var DEFAULT_RULE_BUILDER_LABELS = {
|
|
9865
10542
|
region: "Rule builder",
|
|
9866
10543
|
summary: "Rule summary",
|
|
@@ -9920,7 +10597,7 @@ function RuleGroupEditor({ group, depth, root, fields, operators, maxDepth, disa
|
|
|
9920
10597
|
combinator: combinator ?? "and",
|
|
9921
10598
|
conditions: [defaultCondition(fields, operators)]
|
|
9922
10599
|
}, maxDepth));
|
|
9923
|
-
const rowControls = (node, index, label) => disabled ? null : /* @__PURE__ */ (0,
|
|
10600
|
+
const rowControls = (node, index, label) => disabled ? null : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
9924
10601
|
RowControls,
|
|
9925
10602
|
{
|
|
9926
10603
|
labels,
|
|
@@ -9933,25 +10610,25 @@ function RuleGroupEditor({ group, depth, root, fields, operators, maxDepth, disa
|
|
|
9933
10610
|
onRemove: () => onRootChange(removeRuleNode(root, node.id))
|
|
9934
10611
|
}
|
|
9935
10612
|
);
|
|
9936
|
-
return /* @__PURE__ */ (0,
|
|
9937
|
-
/* @__PURE__ */ (0,
|
|
9938
|
-
/* @__PURE__ */ (0,
|
|
9939
|
-
!hideCombinator && (combinator ? /* @__PURE__ */ (0,
|
|
10613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("fieldset", { className: "uix-rule-builder__group", "data-depth": depth, children: [
|
|
10614
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("legend", { className: "uix-rule-builder__group-heading", children: [
|
|
10615
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { children: depth === 1 ? labels.when : labels.group }),
|
|
10616
|
+
!hideCombinator && (combinator ? /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("span", { className: "uix-rule-builder__match", children: [
|
|
9940
10617
|
labels.match,
|
|
9941
10618
|
" ",
|
|
9942
10619
|
combinator === "or" ? labels.any : labels.all
|
|
9943
|
-
] }) : /* @__PURE__ */ (0,
|
|
10620
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("label", { children: [
|
|
9944
10621
|
labels.match,
|
|
9945
|
-
/* @__PURE__ */ (0,
|
|
9946
|
-
/* @__PURE__ */ (0,
|
|
9947
|
-
/* @__PURE__ */ (0,
|
|
10622
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("select", { className: "uix-select uix-select--sm", value: group.combinator, disabled, onChange: (event) => updateNode(group.id, (node) => ({ ...node, combinator: event.currentTarget.value })), children: [
|
|
10623
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("option", { value: "and", children: labels.all }),
|
|
10624
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("option", { value: "or", children: labels.any })
|
|
9948
10625
|
] })
|
|
9949
10626
|
] }))
|
|
9950
10627
|
] }),
|
|
9951
|
-
/* @__PURE__ */ (0,
|
|
9952
|
-
/* @__PURE__ */ (0,
|
|
10628
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "uix-rule-builder__rows", children: group.conditions.map((node, index) => isRuleGroup(node) ? /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "uix-rule-builder__nested", children: [
|
|
10629
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(RuleGroupEditor, { ...{ group: node, depth: depth + 1, root, fields, operators, maxDepth, disabled, onRootChange, labels, combinator, hideCombinator, allowGroups } }),
|
|
9953
10630
|
rowControls(node, index, labels.itemGroup)
|
|
9954
|
-
] }, node.id) : /* @__PURE__ */ (0,
|
|
10631
|
+
] }, node.id) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
9955
10632
|
ConditionRow,
|
|
9956
10633
|
{
|
|
9957
10634
|
labels,
|
|
@@ -9964,9 +10641,9 @@ function RuleGroupEditor({ group, depth, root, fields, operators, maxDepth, disa
|
|
|
9964
10641
|
},
|
|
9965
10642
|
node.id
|
|
9966
10643
|
)) }),
|
|
9967
|
-
!disabled && /* @__PURE__ */ (0,
|
|
9968
|
-
/* @__PURE__ */ (0,
|
|
9969
|
-
allowGroups && /* @__PURE__ */ (0,
|
|
10644
|
+
!disabled && /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "uix-rule-builder__add", children: [
|
|
10645
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("button", { type: "button", className: "uix-btn uix-btn--secondary uix-btn--sm", onClick: addCondition, disabled: fields.length === 0 || operators.length === 0, children: labels.addCondition }),
|
|
10646
|
+
allowGroups && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("button", { type: "button", className: "uix-btn uix-btn--ghost uix-btn--sm", onClick: addGroup, disabled: depth >= maxDepth, children: labels.addGroup })
|
|
9970
10647
|
] })
|
|
9971
10648
|
] });
|
|
9972
10649
|
}
|
|
@@ -9979,24 +10656,24 @@ function ConditionRow({ labels, condition, fields, operators, disabled, onChange
|
|
|
9979
10656
|
const nextOperator = operators.find((item) => nextField?.operators?.includes(item.id)) ?? availableOperators[0] ?? operators[0];
|
|
9980
10657
|
onChange({ ...condition, field: id, operator: nextOperator?.id ?? "" });
|
|
9981
10658
|
};
|
|
9982
|
-
return /* @__PURE__ */ (0,
|
|
9983
|
-
/* @__PURE__ */ (0,
|
|
9984
|
-
/* @__PURE__ */ (0,
|
|
9985
|
-
/* @__PURE__ */ (0,
|
|
10659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "uix-rule-builder__condition", children: [
|
|
10660
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("label", { children: [
|
|
10661
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "uix-visually-hidden", children: labels.field }),
|
|
10662
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("select", { className: "uix-select", value: condition.field, onChange: (event) => setField(event.currentTarget.value), disabled, children: fields.map((item) => /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("option", { value: item.id, children: item.label }, item.id)) })
|
|
9986
10663
|
] }),
|
|
9987
|
-
/* @__PURE__ */ (0,
|
|
9988
|
-
/* @__PURE__ */ (0,
|
|
9989
|
-
/* @__PURE__ */ (0,
|
|
10664
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("label", { children: [
|
|
10665
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "uix-visually-hidden", children: labels.operator }),
|
|
10666
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("select", { className: "uix-select", value: condition.operator, onChange: (event) => onChange({ ...condition, operator: event.currentTarget.value }), disabled, children: availableOperators.map((item) => /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("option", { value: item.id, children: item.label }, item.id)) })
|
|
9990
10667
|
] }),
|
|
9991
|
-
operator?.requiresValue !== false && /* @__PURE__ */ (0,
|
|
10668
|
+
operator?.requiresValue !== false && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "uix-rule-builder__value", children: field?.renderValueEditor?.({ condition, onChange: (value) => onChange({ ...condition, value }), disabled }) ?? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("input", { className: "uix-input", value: typeof condition.value === "string" || typeof condition.value === "number" ? condition.value : condition.value == null ? "" : JSON.stringify(condition.value), onChange: (event) => onChange({ ...condition, value: event.currentTarget.value }), disabled, "aria-label": fillLabel(labels.valueFor, { field: field?.label ?? labels.itemCondition }) }) }),
|
|
9992
10669
|
controls
|
|
9993
10670
|
] });
|
|
9994
10671
|
}
|
|
9995
10672
|
function RowControls({ labels, label, first, last, disabled, onUp, onDown, onRemove }) {
|
|
9996
|
-
return /* @__PURE__ */ (0,
|
|
9997
|
-
/* @__PURE__ */ (0,
|
|
9998
|
-
/* @__PURE__ */ (0,
|
|
9999
|
-
/* @__PURE__ */ (0,
|
|
10673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("span", { className: "uix-rule-builder__row-actions", children: [
|
|
10674
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("button", { type: "button", className: "uix-btn uix-btn--ghost uix-btn--sm", onClick: onUp, disabled: disabled || first, "aria-label": fillLabel(labels.moveUpNamed, { item: label }), children: labels.moveUp }),
|
|
10675
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("button", { type: "button", className: "uix-btn uix-btn--ghost uix-btn--sm", onClick: onDown, disabled: disabled || last, "aria-label": fillLabel(labels.moveDownNamed, { item: label }), children: labels.moveDown }),
|
|
10676
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("button", { type: "button", className: "uix-btn uix-btn--ghost uix-btn--sm", onClick: onRemove, disabled, "aria-label": fillLabel(labels.removeNamed, { item: label }), children: labels.remove })
|
|
10000
10677
|
] });
|
|
10001
10678
|
}
|
|
10002
10679
|
function RuleBuilder({
|
|
@@ -10060,16 +10737,16 @@ function RuleBuilder({
|
|
|
10060
10737
|
or: labels.or
|
|
10061
10738
|
}
|
|
10062
10739
|
});
|
|
10063
|
-
return /* @__PURE__ */ (0,
|
|
10064
|
-
/* @__PURE__ */ (0,
|
|
10065
|
-
issues.length > 0 && /* @__PURE__ */ (0,
|
|
10740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("section", { className: cx("uix-rule-builder uix-rule-builder--summary", className), "aria-label": labels.summary, children: [
|
|
10741
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("p", { children: sentence }),
|
|
10742
|
+
issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("p", { className: "uix-rule-builder__invalid", children: issuesText(labels.summaryIssuesOne, labels.summaryIssuesMany) })
|
|
10066
10743
|
] });
|
|
10067
10744
|
}
|
|
10068
10745
|
const disabled = readOnly === true;
|
|
10069
10746
|
const emitWhen = (when) => onChange({ ...value, when: combinator ? setRuleCombinator(when, combinator) : when });
|
|
10070
10747
|
const updateActions = (next) => onChange({ ...value, then: next });
|
|
10071
|
-
return /* @__PURE__ */ (0,
|
|
10072
|
-
/* @__PURE__ */ (0,
|
|
10748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("section", { className: cx("uix-rule-builder", disabled && "uix-rule-builder--readonly", className), "aria-label": labels.region, children: [
|
|
10749
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
10073
10750
|
RuleGroupEditor,
|
|
10074
10751
|
{
|
|
10075
10752
|
group: value.when,
|
|
@@ -10086,14 +10763,14 @@ function RuleBuilder({
|
|
|
10086
10763
|
allowGroups: allowGroups && maxDepth > 1
|
|
10087
10764
|
}
|
|
10088
10765
|
),
|
|
10089
|
-
!conditionsOnly && /* @__PURE__ */ (0,
|
|
10090
|
-
/* @__PURE__ */ (0,
|
|
10766
|
+
!conditionsOnly && /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("fieldset", { className: "uix-rule-builder__actions", children: [
|
|
10767
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("legend", { children: labels.then }),
|
|
10091
10768
|
value.then.map((action, index) => {
|
|
10092
10769
|
const definition = actions.find((item) => item.id === action.type);
|
|
10093
|
-
return /* @__PURE__ */ (0,
|
|
10094
|
-
/* @__PURE__ */ (0,
|
|
10770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "uix-rule-builder__action", children: [
|
|
10771
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("select", { className: "uix-select", value: action.type, disabled, onChange: (event) => updateActions(value.then.map((item) => item.id === action.id ? { ...item, type: event.currentTarget.value } : item)), "aria-label": labels.actionType, children: actions.map((item) => /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("option", { value: item.id, children: item.label }, item.id)) }),
|
|
10095
10772
|
definition?.renderParameters?.(action, (parameters) => updateActions(value.then.map((item) => item.id === action.id ? { ...item, parameters } : item)), disabled),
|
|
10096
|
-
!disabled && /* @__PURE__ */ (0,
|
|
10773
|
+
!disabled && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
10097
10774
|
RowControls,
|
|
10098
10775
|
{
|
|
10099
10776
|
labels,
|
|
@@ -10116,18 +10793,18 @@ function RuleBuilder({
|
|
|
10116
10793
|
)
|
|
10117
10794
|
] }, action.id);
|
|
10118
10795
|
}),
|
|
10119
|
-
!disabled && /* @__PURE__ */ (0,
|
|
10796
|
+
!disabled && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("button", { type: "button", className: "uix-btn uix-btn--secondary uix-btn--sm", disabled: actions.length === 0, onClick: () => updateActions([...value.then, { id: nextId("action"), type: actions[0]?.id ?? "", parameters: {} }]), children: labels.addAction })
|
|
10120
10797
|
] }),
|
|
10121
|
-
/* @__PURE__ */ (0,
|
|
10122
|
-
/* @__PURE__ */ (0,
|
|
10123
|
-
/* @__PURE__ */ (0,
|
|
10798
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "uix-rule-builder__validation", "aria-live": "polite", children: issues.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { children: labels.valid }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, { children: [
|
|
10799
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("strong", { children: issuesText(labels.issuesOne, labels.issuesMany) }),
|
|
10800
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("ul", { children: issues.map((issue, index) => /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("li", { children: issue.message }, `${issue.path}-${index}`)) })
|
|
10124
10801
|
] }) })
|
|
10125
10802
|
] });
|
|
10126
10803
|
}
|
|
10127
10804
|
|
|
10128
10805
|
// src/components/BuilderCanvas.tsx
|
|
10129
|
-
var
|
|
10130
|
-
var
|
|
10806
|
+
var import_react64 = require("react");
|
|
10807
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
10131
10808
|
var DEFAULT_BUILDER_CANVAS_LABELS = {
|
|
10132
10809
|
region: "Builder canvas",
|
|
10133
10810
|
palette: "Item palette",
|
|
@@ -10166,13 +10843,13 @@ function BuilderCanvas({
|
|
|
10166
10843
|
labels: labelOverrides
|
|
10167
10844
|
}) {
|
|
10168
10845
|
const labels = { ...DEFAULT_BUILDER_CANVAS_LABELS, ...labelOverrides };
|
|
10169
|
-
const [internalSelectedId, setInternalSelectedId] = (0,
|
|
10170
|
-
const [draggedId, setDraggedId] = (0,
|
|
10171
|
-
const propertyHeadingRef = (0,
|
|
10172
|
-
const shouldFocusProperties = (0,
|
|
10846
|
+
const [internalSelectedId, setInternalSelectedId] = (0, import_react64.useState)();
|
|
10847
|
+
const [draggedId, setDraggedId] = (0, import_react64.useState)();
|
|
10848
|
+
const propertyHeadingRef = (0, import_react64.useRef)(null);
|
|
10849
|
+
const shouldFocusProperties = (0, import_react64.useRef)(false);
|
|
10173
10850
|
const selectedId = controlledSelectedId ?? internalSelectedId;
|
|
10174
10851
|
const selected = items.find((item) => item.id === selectedId);
|
|
10175
|
-
(0,
|
|
10852
|
+
(0, import_react64.useEffect)(() => {
|
|
10176
10853
|
if (shouldFocusProperties.current && selected) {
|
|
10177
10854
|
propertyHeadingRef.current?.focus();
|
|
10178
10855
|
shouldFocusProperties.current = false;
|
|
@@ -10206,24 +10883,24 @@ function BuilderCanvas({
|
|
|
10206
10883
|
if (from >= 0 && to >= 0) onItemsChange(reorder(items, from, to));
|
|
10207
10884
|
setDraggedId(void 0);
|
|
10208
10885
|
};
|
|
10209
|
-
return /* @__PURE__ */ (0,
|
|
10210
|
-
/* @__PURE__ */ (0,
|
|
10211
|
-
/* @__PURE__ */ (0,
|
|
10212
|
-
palette.length === 0 ? /* @__PURE__ */ (0,
|
|
10213
|
-
/* @__PURE__ */ (0,
|
|
10214
|
-
item.description && /* @__PURE__ */ (0,
|
|
10215
|
-
/* @__PURE__ */ (0,
|
|
10886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("section", { className: cx("uix-builder-canvas", className), "aria-label": labels.region, children: [
|
|
10887
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("aside", { className: "uix-builder-canvas__palette", "aria-label": labels.palette, children: [
|
|
10888
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("h3", { children: labels.paletteHeading }),
|
|
10889
|
+
palette.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { children: labels.paletteEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("ul", { children: palette.map((item) => /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("button", { type: "button", onClick: () => add(item), children: [
|
|
10890
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("strong", { children: item.label }),
|
|
10891
|
+
item.description && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { children: item.description }),
|
|
10892
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { "aria-hidden": "true", children: labels.add })
|
|
10216
10893
|
] }) }, item.id)) })
|
|
10217
10894
|
] }),
|
|
10218
|
-
/* @__PURE__ */ (0,
|
|
10219
|
-
/* @__PURE__ */ (0,
|
|
10220
|
-
loading ? /* @__PURE__ */ (0,
|
|
10221
|
-
/* @__PURE__ */ (0,
|
|
10222
|
-
onRetry && /* @__PURE__ */ (0,
|
|
10223
|
-
] }) : items.length === 0 ? /* @__PURE__ */ (0,
|
|
10224
|
-
/* @__PURE__ */ (0,
|
|
10225
|
-
palette[0] && /* @__PURE__ */ (0,
|
|
10226
|
-
] }) : /* @__PURE__ */ (0,
|
|
10895
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "uix-builder-canvas__workspace", children: [
|
|
10896
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("h3", { children: labels.canvasHeading }),
|
|
10897
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "uix-builder-canvas__state", role: "status", children: labels.loading }) : error ? /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "uix-builder-canvas__state", role: "alert", children: [
|
|
10898
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { children: error }),
|
|
10899
|
+
onRetry && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("button", { type: "button", className: "uix-btn uix-btn--secondary", onClick: onRetry, children: labels.retry })
|
|
10900
|
+
] }) : items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "uix-builder-canvas__state", children: [
|
|
10901
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { children: emptyMessage }),
|
|
10902
|
+
palette[0] && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("button", { type: "button", className: "uix-btn uix-btn--primary", onClick: () => add(palette[0]), children: fillLabel(labels.addFirst, { label: palette[0].label }) })
|
|
10903
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("ol", { className: "uix-builder-canvas__items", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
10227
10904
|
"li",
|
|
10228
10905
|
{
|
|
10229
10906
|
draggable: true,
|
|
@@ -10233,34 +10910,34 @@ function BuilderCanvas({
|
|
|
10233
10910
|
onDrop: (event) => drop(event, item.id),
|
|
10234
10911
|
className: cx("uix-builder-canvas__item", selectedId === item.id && "uix-builder-canvas__item--selected"),
|
|
10235
10912
|
children: [
|
|
10236
|
-
/* @__PURE__ */ (0,
|
|
10237
|
-
/* @__PURE__ */ (0,
|
|
10238
|
-
item.description && /* @__PURE__ */ (0,
|
|
10913
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("button", { type: "button", className: "uix-builder-canvas__item-main", "aria-pressed": selectedId === item.id, onClick: () => select(item.id), children: renderItem?.(item, selectedId === item.id) ?? /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(import_jsx_runtime90.Fragment, { children: [
|
|
10914
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("strong", { children: item.label }),
|
|
10915
|
+
item.description && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { children: item.description })
|
|
10239
10916
|
] }) }),
|
|
10240
|
-
/* @__PURE__ */ (0,
|
|
10241
|
-
/* @__PURE__ */ (0,
|
|
10242
|
-
/* @__PURE__ */ (0,
|
|
10243
|
-
/* @__PURE__ */ (0,
|
|
10917
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("span", { className: "uix-builder-canvas__item-actions", children: [
|
|
10918
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("button", { type: "button", onClick: () => move(item.id, -1), disabled: index === 0, "aria-label": fillLabel(labels.moveUpNamed, { label: item.label }), children: labels.moveUp }),
|
|
10919
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("button", { type: "button", onClick: () => move(item.id, 1), disabled: index === items.length - 1, "aria-label": fillLabel(labels.moveDownNamed, { label: item.label }), children: labels.moveDown }),
|
|
10920
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("button", { type: "button", onClick: () => remove(item.id), "aria-label": fillLabel(labels.removeNamed, { label: item.label }), children: labels.remove })
|
|
10244
10921
|
] })
|
|
10245
10922
|
]
|
|
10246
10923
|
},
|
|
10247
10924
|
item.id
|
|
10248
10925
|
)) })
|
|
10249
10926
|
] }),
|
|
10250
|
-
/* @__PURE__ */ (0,
|
|
10251
|
-
/* @__PURE__ */ (0,
|
|
10252
|
-
!selected ? /* @__PURE__ */ (0,
|
|
10253
|
-
/* @__PURE__ */ (0,
|
|
10254
|
-
/* @__PURE__ */ (0,
|
|
10255
|
-
/* @__PURE__ */ (0,
|
|
10256
|
-
/* @__PURE__ */ (0,
|
|
10927
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("aside", { className: "uix-builder-canvas__properties", "aria-label": labels.properties, children: [
|
|
10928
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("h3", { ref: propertyHeadingRef, tabIndex: -1, children: labels.propertiesHeading }),
|
|
10929
|
+
!selected ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { children: labels.propertiesEmpty }) : renderProperties?.(selected, (updated) => onItemsChange(items.map((item) => item.id === updated.id ? updated : item))) ?? /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("dl", { children: [
|
|
10930
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("dt", { children: labels.type }),
|
|
10931
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("dd", { children: selected.type }),
|
|
10932
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("dt", { children: labels.label }),
|
|
10933
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("dd", { children: selected.label })
|
|
10257
10934
|
] })
|
|
10258
10935
|
] })
|
|
10259
10936
|
] });
|
|
10260
10937
|
}
|
|
10261
10938
|
|
|
10262
10939
|
// src/components/SchedulingCalendar.tsx
|
|
10263
|
-
var
|
|
10940
|
+
var import_react68 = require("react");
|
|
10264
10941
|
|
|
10265
10942
|
// src/calendar-model.ts
|
|
10266
10943
|
function fromDateKey(value) {
|
|
@@ -10688,14 +11365,14 @@ function proposeMove(span, delta, timeZone) {
|
|
|
10688
11365
|
}
|
|
10689
11366
|
|
|
10690
11367
|
// src/components/SchedulingAgenda.tsx
|
|
10691
|
-
var
|
|
11368
|
+
var import_react66 = require("react");
|
|
10692
11369
|
|
|
10693
11370
|
// src/hooks/usePrinting.ts
|
|
10694
|
-
var
|
|
11371
|
+
var import_react65 = require("react");
|
|
10695
11372
|
var import_react_dom2 = require("react-dom");
|
|
10696
11373
|
function usePrinting(enabled = true) {
|
|
10697
|
-
const [printing, setPrinting] = (0,
|
|
10698
|
-
(0,
|
|
11374
|
+
const [printing, setPrinting] = (0, import_react65.useState)(false);
|
|
11375
|
+
(0, import_react65.useEffect)(() => {
|
|
10699
11376
|
if (!enabled || typeof window === "undefined") return void 0;
|
|
10700
11377
|
const set = (next) => {
|
|
10701
11378
|
(0, import_react_dom2.flushSync)(() => setPrinting(next));
|
|
@@ -10718,7 +11395,7 @@ function usePrinting(enabled = true) {
|
|
|
10718
11395
|
}
|
|
10719
11396
|
|
|
10720
11397
|
// src/components/SchedulingAgenda.tsx
|
|
10721
|
-
var
|
|
11398
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
10722
11399
|
var AGENDA_VIRTUAL_ROW = 44;
|
|
10723
11400
|
var AGENDA_NARROW_WIDTH = 576;
|
|
10724
11401
|
var AGENDA_NARROW_ROW = 64;
|
|
@@ -10735,7 +11412,7 @@ function uniqueKeys(ids) {
|
|
|
10735
11412
|
function SchedulingAgenda(props) {
|
|
10736
11413
|
const rowCount = props.groups.reduce((sum, group) => sum + group.rows.length, 0);
|
|
10737
11414
|
const flat = rowCount > props.virtualizeAbove;
|
|
10738
|
-
return /* @__PURE__ */ (0,
|
|
11415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(AgendaBody, { ...props, flat }, flat ? "flat" : "grouped");
|
|
10739
11416
|
}
|
|
10740
11417
|
function AgendaBody({
|
|
10741
11418
|
groups,
|
|
@@ -10770,11 +11447,11 @@ function AgendaBody({
|
|
|
10770
11447
|
if ((group.continuesCount ?? 0) > 0) flatRows.push({ kind: "continues", key: `c-${groupKey}`, group });
|
|
10771
11448
|
});
|
|
10772
11449
|
}
|
|
10773
|
-
const [narrow, setNarrow] = (0,
|
|
11450
|
+
const [narrow, setNarrow] = (0, import_react66.useState)(false);
|
|
10774
11451
|
const printing = usePrinting(flat);
|
|
10775
11452
|
const virtual = useVirtualRows(flatRows, { rowHeight: narrow ? AGENDA_NARROW_ROW : AGENDA_VIRTUAL_ROW, threshold: 0, estimatedViewportHeight: AGENDA_VIRTUAL_VIEWPORT, enabled: !printing });
|
|
10776
11453
|
const scroller = virtual.containerRef;
|
|
10777
|
-
(0,
|
|
11454
|
+
(0, import_react66.useLayoutEffect)(() => {
|
|
10778
11455
|
const box = scroller.current;
|
|
10779
11456
|
if (!box) return;
|
|
10780
11457
|
const measure = () => setNarrow(box.clientWidth > 0 && box.clientWidth <= AGENDA_NARROW_WIDTH);
|
|
@@ -10783,8 +11460,8 @@ function AgendaBody({
|
|
|
10783
11460
|
observer.observe(box);
|
|
10784
11461
|
return () => observer.disconnect();
|
|
10785
11462
|
}, [scroller]);
|
|
10786
|
-
const grouped = (0,
|
|
10787
|
-
(0,
|
|
11463
|
+
const grouped = (0, import_react66.useRef)(null);
|
|
11464
|
+
(0, import_react66.useLayoutEffect)(() => {
|
|
10788
11465
|
const box = grouped.current;
|
|
10789
11466
|
if (!box) return;
|
|
10790
11467
|
const observer = new ResizeObserver((entries) => {
|
|
@@ -10796,7 +11473,7 @@ function AgendaBody({
|
|
|
10796
11473
|
box.querySelectorAll(":scope > section > .uix-scheduling-calendar__agenda-head").forEach((head) => observer.observe(head));
|
|
10797
11474
|
return () => observer.disconnect();
|
|
10798
11475
|
}, [groups]);
|
|
10799
|
-
const stop2 = (0,
|
|
11476
|
+
const stop2 = (0, import_react66.useRef)({ node: null, index: 0 });
|
|
10800
11477
|
const container = () => flat ? scroller.current : grouped.current;
|
|
10801
11478
|
const controls = () => Array.from(container()?.querySelectorAll("button") ?? []);
|
|
10802
11479
|
const focusStop = (target) => {
|
|
@@ -10821,7 +11498,7 @@ function AgendaBody({
|
|
|
10821
11498
|
const scrollToRow = (box, index) => {
|
|
10822
11499
|
box.scrollTop = Math.max(0, index * rowHeight - (box.clientHeight - rowHeight) / 2);
|
|
10823
11500
|
};
|
|
10824
|
-
const landing = (0,
|
|
11501
|
+
const landing = (0, import_react66.useRef)(null);
|
|
10825
11502
|
const land = () => {
|
|
10826
11503
|
const wanted = landing.current;
|
|
10827
11504
|
if (!wanted) return;
|
|
@@ -10842,7 +11519,7 @@ function AgendaBody({
|
|
|
10842
11519
|
scrollToRow(box, index);
|
|
10843
11520
|
}
|
|
10844
11521
|
};
|
|
10845
|
-
(0,
|
|
11522
|
+
(0, import_react66.useEffect)(() => {
|
|
10846
11523
|
const all = controls();
|
|
10847
11524
|
stop2.current = syncRovingStop(all, stop2.current);
|
|
10848
11525
|
const box = flat ? scroller.current : null;
|
|
@@ -10892,18 +11569,18 @@ function AgendaBody({
|
|
|
10892
11569
|
landing.current = { key: flatRows[target].key, index: target };
|
|
10893
11570
|
scrollToRow(box, target);
|
|
10894
11571
|
};
|
|
10895
|
-
const note = (overlay) => /* @__PURE__ */ (0,
|
|
10896
|
-
overlay.kindLabel && /* @__PURE__ */ (0,
|
|
10897
|
-
/* @__PURE__ */ (0,
|
|
10898
|
-
overlay.scopeLabel && /* @__PURE__ */ (0,
|
|
11572
|
+
const note = (overlay) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("button", { type: "button", className: "uix-scheduling-calendar__window", "data-overlay-id": overlay.id, "data-pattern": overlay.pattern ?? "solid", "data-global": overlay.global || void 0, onClick: () => onSelectOverlay?.(overlay), "aria-label": overlayName(overlay), children: /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("span", { className: "uix-scheduling-calendar__window-text", children: [
|
|
11573
|
+
overlay.kindLabel && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "uix-scheduling-calendar__window-kind", children: overlay.kindLabel }),
|
|
11574
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "uix-scheduling-calendar__window-name", children: overlay.label }),
|
|
11575
|
+
overlay.scopeLabel && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "uix-scheduling-calendar__window-scope", children: overlay.scopeLabel })
|
|
10899
11576
|
] }) });
|
|
10900
|
-
const heading = (group, withNotes) => /* @__PURE__ */ (0,
|
|
10901
|
-
(0,
|
|
10902
|
-
withNotes && group.annotations && group.annotations.length > 0 && /* @__PURE__ */ (0,
|
|
11577
|
+
const heading = (group, withNotes) => /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "uix-scheduling-calendar__agenda-head", children: [
|
|
11578
|
+
(0, import_react66.createElement)(`h${headingLevel}`, { className: "uix-scheduling-calendar__agenda-heading" }, group.heading ?? dateText(group.date, "day")),
|
|
11579
|
+
withNotes && group.annotations && group.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("ul", { className: "uix-scheduling-calendar__agenda-notes", children: uniqueKeys(group.annotations.map((overlay) => overlay.id)).map((key, at) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("li", { children: note(group.annotations[at]) }, key)) })
|
|
10903
11580
|
] });
|
|
10904
11581
|
const timeText = (entry, date) => {
|
|
10905
|
-
const part = (text) => /* @__PURE__ */ (0,
|
|
10906
|
-
const dash = /* @__PURE__ */ (0,
|
|
11582
|
+
const part = (text) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "uix-scheduling-calendar__agenda-time-part", children: text });
|
|
11583
|
+
const dash = /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { "aria-hidden": "true", children: " \u2013 " });
|
|
10907
11584
|
if (entry.allDay) {
|
|
10908
11585
|
let span;
|
|
10909
11586
|
try {
|
|
@@ -10913,7 +11590,7 @@ function AgendaBody({
|
|
|
10913
11590
|
}
|
|
10914
11591
|
const last = addCalendarDays(span.end, -1);
|
|
10915
11592
|
if (span.start === date && last === date) return labels.allDay;
|
|
10916
|
-
return span.start === last ? part(dateText(last, "day")) : /* @__PURE__ */ (0,
|
|
11593
|
+
return span.start === last ? part(dateText(last, "day")) : /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_jsx_runtime91.Fragment, { children: [
|
|
10917
11594
|
part(dateText(span.start, "day")),
|
|
10918
11595
|
dash,
|
|
10919
11596
|
part(dateText(last, "day"))
|
|
@@ -10923,11 +11600,11 @@ function AgendaBody({
|
|
|
10923
11600
|
const endTime = zonedTimeOfDay(entry.end, timeZone);
|
|
10924
11601
|
const endDay = zonedDateKey(entry.end, timeZone);
|
|
10925
11602
|
const underItsDay = zonedDateKey(entry.start, timeZone) === date && (endDay === date || endDay === addCalendarDays(date, 1) && endTime < startTime);
|
|
10926
|
-
return underItsDay ? /* @__PURE__ */ (0,
|
|
11603
|
+
return underItsDay ? /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_jsx_runtime91.Fragment, { children: [
|
|
10927
11604
|
startTime,
|
|
10928
11605
|
dash,
|
|
10929
11606
|
endTime
|
|
10930
|
-
] }) : /* @__PURE__ */ (0,
|
|
11607
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_jsx_runtime91.Fragment, { children: [
|
|
10931
11608
|
part(formatInstant(entry.start)),
|
|
10932
11609
|
dash,
|
|
10933
11610
|
part(formatInstant(entry.end))
|
|
@@ -10936,31 +11613,31 @@ function AgendaBody({
|
|
|
10936
11613
|
const row = (entry, date) => {
|
|
10937
11614
|
const markers = entryMarkers(entry);
|
|
10938
11615
|
const name = entry.accessibleName ?? (entry.meta ? `${entryName(entry)}, ${entry.meta}` : entryName(entry));
|
|
10939
|
-
return /* @__PURE__ */ (0,
|
|
10940
|
-
/* @__PURE__ */ (0,
|
|
10941
|
-
/* @__PURE__ */ (0,
|
|
10942
|
-
/* @__PURE__ */ (0,
|
|
10943
|
-
renderEntry?.(entry) ?? /* @__PURE__ */ (0,
|
|
10944
|
-
entry.meta && /* @__PURE__ */ (0,
|
|
11616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("button", { type: "button", className: "uix-scheduling-calendar__agenda-row", "data-item-id": entry.id, "data-highlight": entry.emphasis === "highlight" || void 0, "data-dim": entry.emphasis === "dim" || void 0, "data-band": entry.band ?? "none", "data-status": entryStatus(entry), "data-state": entry.state, onClick: () => onSelectEntry?.(entry), "aria-label": name, children: [
|
|
11617
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "uix-scheduling-calendar__swatch", "aria-hidden": "true", "data-band": entry.band ?? "none", "data-status": entryStatus(entry) }),
|
|
11618
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "uix-scheduling-calendar__agenda-time", children: timeText(entry, date) }),
|
|
11619
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("span", { className: "uix-scheduling-calendar__agenda-main", children: [
|
|
11620
|
+
renderEntry?.(entry) ?? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "uix-scheduling-calendar__title", children: entry.title }),
|
|
11621
|
+
entry.meta && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "uix-scheduling-calendar__agenda-meta", children: entry.meta })
|
|
10945
11622
|
] }),
|
|
10946
|
-
markers.length > 0 && /* @__PURE__ */ (0,
|
|
10947
|
-
/* @__PURE__ */ (0,
|
|
11623
|
+
markers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "uix-scheduling-calendar__markers", children: markers.map((marker) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { children: renderMarker2(marker, true) }, marker.id)) }),
|
|
11624
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "uix-scheduling-calendar__status", children: entryStatusText(entry) })
|
|
10948
11625
|
] });
|
|
10949
11626
|
};
|
|
10950
11627
|
const hidden = (group) => {
|
|
10951
11628
|
const text = fillLabel(labels.hiddenInDay, { count: group.hiddenCount ?? 0 });
|
|
10952
|
-
return onShowMore ? /* @__PURE__ */ (0,
|
|
11629
|
+
return onShowMore ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("button", { type: "button", className: "uix-scheduling-calendar__agenda-more", onClick: () => onShowMore(group.date, group.rows), children: text }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("p", { className: "uix-scheduling-calendar__agenda-more", children: text });
|
|
10953
11630
|
};
|
|
10954
|
-
const continues = (group) => /* @__PURE__ */ (0,
|
|
10955
|
-
if (groups.length === 0) return /* @__PURE__ */ (0,
|
|
11631
|
+
const continues = (group) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("p", { className: "uix-scheduling-calendar__agenda-continues", children: fillLabel(labels.continuesInDay, { count: group.continuesCount ?? 0 }) });
|
|
11632
|
+
if (groups.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "uix-scheduling-calendar__agenda", role: "region", "aria-label": labels.agenda, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("p", { children: labels.agendaEmpty }) });
|
|
10956
11633
|
if (flat) {
|
|
10957
|
-
return /* @__PURE__ */ (0,
|
|
11634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { ref: virtual.containerRef, className: "uix-scheduling-calendar__agenda uix-scheduling-calendar__agenda--virtual", "data-narrow": narrow || void 0, role: "region", "aria-label": labels.agenda, onKeyDown, onFocus, onBlur, onWheel: dropLanding, onPointerDown: dropLanding, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "uix-scheduling-calendar__agenda-window", style: { paddingTop: virtual.padTop, paddingBottom: virtual.padBottom }, children: virtual.rows.map((item, at) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "uix-scheduling-calendar__agenda-vrow", "data-kind": item.kind, "data-flat-index": virtual.startIndex + at, children: item.kind === "heading" ? heading(item.group, false) : item.kind === "note" ? note(item.overlay) : item.kind === "entry" ? row(item.entry, item.group.date) : item.kind === "hidden" ? hidden(item.group) : continues(item.group) }, item.key)) }) });
|
|
10958
11635
|
}
|
|
10959
|
-
return /* @__PURE__ */ (0,
|
|
11636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { ref: grouped, className: "uix-scheduling-calendar__agenda", role: "region", "aria-label": labels.agenda, onKeyDown, onFocus, children: groups.map((group, index) => {
|
|
10960
11637
|
const rowKeys = uniqueKeys(group.rows.map((entry) => entry.id));
|
|
10961
|
-
return /* @__PURE__ */ (0,
|
|
11638
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("section", { className: "uix-scheduling-calendar__agenda-group", "data-date": group.date, children: [
|
|
10962
11639
|
heading(group, true),
|
|
10963
|
-
group.rows.length > 0 && /* @__PURE__ */ (0,
|
|
11640
|
+
group.rows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("ol", { className: "uix-scheduling-calendar__agenda-rows", children: group.rows.map((entry, at) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("li", { children: row(entry, group.date) }, rowKeys[at])) }),
|
|
10964
11641
|
(group.hiddenCount ?? 0) > 0 && hidden(group),
|
|
10965
11642
|
(group.continuesCount ?? 0) > 0 && continues(group)
|
|
10966
11643
|
] }, groupKeys[index]);
|
|
@@ -10968,8 +11645,8 @@ function AgendaBody({
|
|
|
10968
11645
|
}
|
|
10969
11646
|
|
|
10970
11647
|
// src/components/SchedulingTimeGrid.tsx
|
|
10971
|
-
var
|
|
10972
|
-
var
|
|
11648
|
+
var import_react67 = require("react");
|
|
11649
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
10973
11650
|
var HOUR_MS2 = 36e5;
|
|
10974
11651
|
var MINUTES_PER_HOUR = 60;
|
|
10975
11652
|
var LINES_PER_HOUR = 3;
|
|
@@ -10982,7 +11659,7 @@ function uniqueById(items) {
|
|
|
10982
11659
|
const seen = /* @__PURE__ */ new Set();
|
|
10983
11660
|
return items.filter((item) => seen.has(item.id) ? false : (seen.add(item.id), true));
|
|
10984
11661
|
}
|
|
10985
|
-
var GridItem = (0,
|
|
11662
|
+
var GridItem = (0, import_react67.memo)(function GridItem2({ entry, segment, column, alone, name, status, movable, hintId, timeZone, continuesFrom, markers, renderEntry, renderMarker: renderMarker2, handlers }) {
|
|
10986
11663
|
const lines = linesFor(segment);
|
|
10987
11664
|
const continuation = segment.part === "continuation";
|
|
10988
11665
|
const style = vars({
|
|
@@ -10992,18 +11669,18 @@ var GridItem = (0, import_react66.memo)(function GridItem2({ entry, segment, col
|
|
|
10992
11669
|
"--uix-scheduling-calendar-lanes": segment.laneCount
|
|
10993
11670
|
});
|
|
10994
11671
|
const custom = renderEntry?.(entry, { availableLines: lines });
|
|
10995
|
-
const text = custom ?? /* @__PURE__ */ (0,
|
|
10996
|
-
!continuation && /* @__PURE__ */ (0,
|
|
10997
|
-
/* @__PURE__ */ (0,
|
|
11672
|
+
const text = custom ?? /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_jsx_runtime92.Fragment, { children: [
|
|
11673
|
+
!continuation && /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_jsx_runtime92.Fragment, { children: [
|
|
11674
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "uix-scheduling-calendar__time", children: zonedTimeOfDay(entry.start, timeZone) }),
|
|
10998
11675
|
" "
|
|
10999
11676
|
] }),
|
|
11000
|
-
/* @__PURE__ */ (0,
|
|
11677
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "uix-scheduling-calendar__title", children: entry.title })
|
|
11001
11678
|
] });
|
|
11002
11679
|
const noRoom = lines === 0 && (custom === void 0 || custom === null) ? "none" : void 0;
|
|
11003
|
-
const body = /* @__PURE__ */ (0,
|
|
11004
|
-
continuation && /* @__PURE__ */ (0,
|
|
11005
|
-
(!continuation || alone) && text != null && text !== false && /* @__PURE__ */ (0,
|
|
11006
|
-
markers.length > 0 && /* @__PURE__ */ (0,
|
|
11680
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_jsx_runtime92.Fragment, { children: [
|
|
11681
|
+
continuation && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "uix-scheduling-calendar__tg-from", "data-room": lines === 0 ? "none" : void 0, children: continuesFrom }),
|
|
11682
|
+
(!continuation || alone) && text != null && text !== false && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "uix-scheduling-calendar__entry-text", "data-room": noRoom, children: text }),
|
|
11683
|
+
markers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "uix-scheduling-calendar__markers", children: markers.map((marker) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { children: renderMarker2(marker) }, marker.id)) })
|
|
11007
11684
|
] });
|
|
11008
11685
|
const shared = {
|
|
11009
11686
|
className: "uix-scheduling-calendar__entry uix-scheduling-calendar__tg-item",
|
|
@@ -11019,8 +11696,8 @@ var GridItem = (0, import_react66.memo)(function GridItem2({ entry, segment, col
|
|
|
11019
11696
|
onClick: () => handlers.click(entry),
|
|
11020
11697
|
onPointerDown: movable ? (event) => handlers.pointerDown(event, entry, column, false) : void 0
|
|
11021
11698
|
};
|
|
11022
|
-
if (continuation && !alone) return /* @__PURE__ */ (0,
|
|
11023
|
-
return /* @__PURE__ */ (0,
|
|
11699
|
+
if (continuation && !alone) return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { ...shared, "data-continuation-of": entry.id, "aria-hidden": "true", children: body });
|
|
11700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
11024
11701
|
"button",
|
|
11025
11702
|
{
|
|
11026
11703
|
type: "button",
|
|
@@ -11067,20 +11744,20 @@ function SchedulingTimeGrid({
|
|
|
11067
11744
|
emptyNote,
|
|
11068
11745
|
nothingToShow
|
|
11069
11746
|
}) {
|
|
11070
|
-
const rootRef = (0,
|
|
11071
|
-
const hintId = (0,
|
|
11072
|
-
const [widthCap, setWidthCap] = (0,
|
|
11073
|
-
const [ghost, setGhost] = (0,
|
|
11074
|
-
const [announcement, setAnnouncement] = (0,
|
|
11075
|
-
const [activeDay, setActiveDay] = (0,
|
|
11076
|
-
const enteredFrom = (0,
|
|
11747
|
+
const rootRef = (0, import_react67.useRef)(null);
|
|
11748
|
+
const hintId = (0, import_react67.useId)();
|
|
11749
|
+
const [widthCap, setWidthCap] = (0, import_react67.useState)(Infinity);
|
|
11750
|
+
const [ghost, setGhost] = (0, import_react67.useState)(null);
|
|
11751
|
+
const [announcement, setAnnouncement] = (0, import_react67.useState)("");
|
|
11752
|
+
const [activeDay, setActiveDay] = (0, import_react67.useState)(days[0]);
|
|
11753
|
+
const enteredFrom = (0, import_react67.useRef)(null);
|
|
11077
11754
|
const tabStop = days.includes(activeDay) ? activeDay : days[0];
|
|
11078
11755
|
const moving = canMove && onProposeMove !== void 0;
|
|
11079
11756
|
const step = Number.isFinite(givenStep) && givenStep > 0 ? givenStep : DEFAULT_STEP;
|
|
11080
|
-
const laneOptions = (0,
|
|
11081
|
-
const entries = (0,
|
|
11082
|
-
const overlays = (0,
|
|
11083
|
-
(0,
|
|
11757
|
+
const laneOptions = (0, import_react67.useMemo)(() => ({ crossMidnightMinutes: topLaneCrossMidnightMinutes }), [topLaneCrossMidnightMinutes]);
|
|
11758
|
+
const entries = (0, import_react67.useMemo)(() => uniqueById(givenEntries), [givenEntries]);
|
|
11759
|
+
const overlays = (0, import_react67.useMemo)(() => uniqueById(givenOverlays), [givenOverlays]);
|
|
11760
|
+
(0, import_react67.useEffect)(() => {
|
|
11084
11761
|
const root = rootRef.current;
|
|
11085
11762
|
if (!root || typeof ResizeObserver === "undefined") return void 0;
|
|
11086
11763
|
const column = root.querySelector("[data-tg-column]");
|
|
@@ -11105,17 +11782,17 @@ function SchedulingTimeGrid({
|
|
|
11105
11782
|
};
|
|
11106
11783
|
}, [days]);
|
|
11107
11784
|
const lanes = Math.max(1, Math.min(maxLanes, widthCap));
|
|
11108
|
-
const entryById = (0,
|
|
11109
|
-
const overlayById = (0,
|
|
11110
|
-
const columns = (0,
|
|
11111
|
-
const slots = (0,
|
|
11112
|
-
const top = (0,
|
|
11113
|
-
const drawable = (0,
|
|
11114
|
-
const strip = (0,
|
|
11115
|
-
const shades = (0,
|
|
11785
|
+
const entryById = (0, import_react67.useMemo)(() => new Map(entries.map((entry) => [entry.id, entry])), [entries]);
|
|
11786
|
+
const overlayById = (0, import_react67.useMemo)(() => new Map(overlays.map((overlay) => [overlay.id, overlay])), [overlays]);
|
|
11787
|
+
const columns = (0, import_react67.useMemo)(() => days.map((date) => layoutTimeGridDay(entries, date, timeZone, { ...laneOptions, maxLanes: lanes })), [days, entries, timeZone, laneOptions, lanes]);
|
|
11788
|
+
const slots = (0, import_react67.useMemo)(() => days.map((date) => zonedHourSlots(date, timeZone)), [days, timeZone]);
|
|
11789
|
+
const top = (0, import_react67.useMemo)(() => layoutDaySpans(entries.filter((entry) => placesInTopLane(entry, timeZone, laneOptions)), days, { timeZone, laneCap: Math.max(0, topLaneCap) }), [entries, days, timeZone, laneOptions, topLaneCap]);
|
|
11790
|
+
const drawable = (0, import_react67.useMemo)(() => overlays.filter((overlay) => new Date(overlay.end).getTime() >= new Date(overlay.start).getTime()), [overlays]);
|
|
11791
|
+
const strip = (0, import_react67.useMemo)(() => layoutDaySpans(drawable, days, { timeZone, laneCap: Math.max(0, windowLaneCap) }), [drawable, days, timeZone, windowLaneCap]);
|
|
11792
|
+
const shades = (0, import_react67.useMemo)(() => layoutDaySpans(drawable.filter((overlay) => overlay.global), days, { timeZone }).placed, [drawable, days, timeZone]);
|
|
11116
11793
|
const lanesIn = (placed) => placed.reduce((max, span) => Math.max(max, span.lane + 1), 0);
|
|
11117
11794
|
const maxHours = Math.max(...columns.map((column) => column.dayHours));
|
|
11118
|
-
const gutterIndex = (0,
|
|
11795
|
+
const gutterIndex = (0, import_react67.useMemo)(() => {
|
|
11119
11796
|
const signatures = slots.map(slotSignature);
|
|
11120
11797
|
const count2 = /* @__PURE__ */ new Map();
|
|
11121
11798
|
for (const signature of signatures) count2.set(signature, (count2.get(signature) ?? 0) + 1);
|
|
@@ -11126,7 +11803,7 @@ function SchedulingTimeGrid({
|
|
|
11126
11803
|
return best;
|
|
11127
11804
|
}, [slots]);
|
|
11128
11805
|
const gutterSignature = slotSignature(slots[gutterIndex]);
|
|
11129
|
-
const hourLabels = (index, inline) => slots[index].map((slot) => /* @__PURE__ */ (0,
|
|
11806
|
+
const hourLabels = (index, inline) => slots[index].map((slot) => /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
11130
11807
|
"div",
|
|
11131
11808
|
{
|
|
11132
11809
|
className: inline ? "uix-scheduling-calendar__tg-hour uix-scheduling-calendar__tg-hour--inline" : "uix-scheduling-calendar__tg-hour",
|
|
@@ -11134,21 +11811,21 @@ function SchedulingTimeGrid({
|
|
|
11134
11811
|
style: vars({ "--uix-scheduling-calendar-offset": (slot.instant.getTime() - columns[index].dayStart) / HOUR_MS2 }),
|
|
11135
11812
|
children: [
|
|
11136
11813
|
slot.label,
|
|
11137
|
-
slot.offsetLabel && /* @__PURE__ */ (0,
|
|
11814
|
+
slot.offsetLabel && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "uix-scheduling-calendar__tg-offset", children: slot.offsetLabel })
|
|
11138
11815
|
]
|
|
11139
11816
|
},
|
|
11140
11817
|
slot.instant.getTime()
|
|
11141
11818
|
));
|
|
11142
11819
|
const movable = (entry) => moving && entry.movable !== false;
|
|
11143
|
-
const live = (0,
|
|
11820
|
+
const live = (0, import_react67.useRef)({ ghost, entryById, timeZone, step, onProposeMove, onSelectEntry, labels, formatInstant, days, columns, movable });
|
|
11144
11821
|
live.current = { ghost, entryById, timeZone, step, onProposeMove, onSelectEntry, labels, formatInstant, days, columns, movable };
|
|
11145
|
-
const dragRef = (0,
|
|
11146
|
-
const suppressClick = (0,
|
|
11147
|
-
const refocus = (0,
|
|
11148
|
-
(0,
|
|
11822
|
+
const dragRef = (0, import_react67.useRef)(null);
|
|
11823
|
+
const suppressClick = (0, import_react67.useRef)(false);
|
|
11824
|
+
const refocus = (0, import_react67.useRef)(null);
|
|
11825
|
+
(0, import_react67.useEffect)(() => {
|
|
11149
11826
|
if (ghost && !entryById.has(ghost.id)) setGhost(null);
|
|
11150
11827
|
}, [ghost, entryById]);
|
|
11151
|
-
(0,
|
|
11828
|
+
(0, import_react67.useEffect)(() => {
|
|
11152
11829
|
const id = refocus.current;
|
|
11153
11830
|
const root = rootRef.current;
|
|
11154
11831
|
if (!id || !root) return;
|
|
@@ -11165,7 +11842,7 @@ function SchedulingTimeGrid({
|
|
|
11165
11842
|
}
|
|
11166
11843
|
}
|
|
11167
11844
|
});
|
|
11168
|
-
const send = (0,
|
|
11845
|
+
const send = (0, import_react67.useCallback)((id, delta) => {
|
|
11169
11846
|
const state = live.current;
|
|
11170
11847
|
const entry = state.entryById.get(id);
|
|
11171
11848
|
if (!entry || !state.onProposeMove || !state.movable(entry) || delta.days === 0 && delta.minutes === 0) {
|
|
@@ -11180,7 +11857,7 @@ function SchedulingTimeGrid({
|
|
|
11180
11857
|
result.then(clear, clear);
|
|
11181
11858
|
} else setGhost(null);
|
|
11182
11859
|
}, []);
|
|
11183
|
-
const handlers = (0,
|
|
11860
|
+
const handlers = (0, import_react67.useMemo)(() => ({
|
|
11184
11861
|
click: (entry) => {
|
|
11185
11862
|
live.current.onSelectEntry?.(entry);
|
|
11186
11863
|
},
|
|
@@ -11303,7 +11980,7 @@ function SchedulingTimeGrid({
|
|
|
11303
11980
|
};
|
|
11304
11981
|
}
|
|
11305
11982
|
}), [send]);
|
|
11306
|
-
(0,
|
|
11983
|
+
(0, import_react67.useEffect)(() => () => {
|
|
11307
11984
|
dragRef.current?.stop();
|
|
11308
11985
|
dragRef.current = null;
|
|
11309
11986
|
}, []);
|
|
@@ -11395,7 +12072,7 @@ function SchedulingTimeGrid({
|
|
|
11395
12072
|
const ghostParts = ghost && ghostEntry && !ghostTop ? days.map((date) => layoutTimeGridDay([{ id: "ghost", start: ghost.proposal.start, end: ghost.proposal.end }], date, timeZone, { crossMidnightMinutes: Infinity }).segments) : null;
|
|
11396
12073
|
const ghostSpan = ghost && ghostEntry && ghostTop ? layoutDaySpans([{ id: "ghost", start: ghost.proposal.start, end: ghost.proposal.end }], days, { timeZone }).placed[0] : void 0;
|
|
11397
12074
|
const ghostLane = ghost ? top.placed.find((span) => span.id === ghost.id)?.lane ?? 0 : 0;
|
|
11398
|
-
return /* @__PURE__ */ (0,
|
|
12075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
11399
12076
|
"div",
|
|
11400
12077
|
{
|
|
11401
12078
|
ref: rootRef,
|
|
@@ -11414,8 +12091,8 @@ function SchedulingTimeGrid({
|
|
|
11414
12091
|
}
|
|
11415
12092
|
},
|
|
11416
12093
|
children: [
|
|
11417
|
-
/* @__PURE__ */ (0,
|
|
11418
|
-
/* @__PURE__ */ (0,
|
|
12094
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "uix-scheduling-calendar__tg-head", children: [
|
|
12095
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "uix-scheduling-calendar__tg-zone", children: fillLabel(labels.timeZone, { timeZone }) }),
|
|
11419
12096
|
days.map((date, index) => {
|
|
11420
12097
|
const info = dayInfo?.[date];
|
|
11421
12098
|
const hiddenIds = dayInfo ? [] : [...columns[index].hidden, ...topHiddenOn(date)];
|
|
@@ -11423,8 +12100,8 @@ function SchedulingTimeGrid({
|
|
|
11423
12100
|
const moreText = fillLabel(labels.moreSpans, { count: more });
|
|
11424
12101
|
const moreName = fillLabel(labels.moreEntriesLabel, { count: more, date: dateText(date, "day") });
|
|
11425
12102
|
const headName = !info ? dateText(date, "day") : info.label ? fillLabel(labels.dayName, { date: dateText(date, "day"), label: info.label }) : `${dateText(date, "day")}, ${fillLabel(labels.dayCount, { count: info.count })}`;
|
|
11426
|
-
return /* @__PURE__ */ (0,
|
|
11427
|
-
/* @__PURE__ */ (0,
|
|
12103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "uix-scheduling-calendar__tg-dayhead", role: "group", "aria-label": headName, "data-date": date, children: [
|
|
12104
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
11428
12105
|
"button",
|
|
11429
12106
|
{
|
|
11430
12107
|
type: "button",
|
|
@@ -11438,20 +12115,20 @@ function SchedulingTimeGrid({
|
|
|
11438
12115
|
children: dateText(date, "column")
|
|
11439
12116
|
}
|
|
11440
12117
|
),
|
|
11441
|
-
info && /* @__PURE__ */ (0,
|
|
11442
|
-
info?.markers && info.markers.length > 0 && /* @__PURE__ */ (0,
|
|
11443
|
-
more > 0 && (onShowMore ? /* @__PURE__ */ (0,
|
|
11444
|
-
/* @__PURE__ */ (0,
|
|
11445
|
-
/* @__PURE__ */ (0,
|
|
12118
|
+
info && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "uix-scheduling-calendar__count", "aria-hidden": "true", children: info.count }),
|
|
12119
|
+
info?.markers && info.markers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "uix-scheduling-calendar__markers", children: info.markers.map((marker) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { children: renderMarker2(marker, true) }, marker.id)) }),
|
|
12120
|
+
more > 0 && (onShowMore ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("button", { type: "button", tabIndex: -1, className: "uix-scheduling-calendar__more", "aria-label": moreName, onClick: () => onShowMore(date, hiddenIds.map((id) => entryById.get(id)).filter(Boolean)), children: moreText }) : /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("span", { className: "uix-scheduling-calendar__more", children: [
|
|
12121
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { "aria-hidden": "true", children: moreText }),
|
|
12122
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "uix-visually-hidden", children: moreName })
|
|
11446
12123
|
] }))
|
|
11447
12124
|
] }, date);
|
|
11448
12125
|
})
|
|
11449
12126
|
] }),
|
|
11450
|
-
(windowLanes > 0 || moreWindows > 0) && /* @__PURE__ */ (0,
|
|
12127
|
+
(windowLanes > 0 || moreWindows > 0) && /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "uix-scheduling-calendar__tg-strip", role: "group", "aria-label": labels.windows, style: vars({ "--uix-scheduling-calendar-lanes": Math.max(windowLanes, 1) }), children: [
|
|
11451
12128
|
strip.placed.map((placed) => {
|
|
11452
12129
|
const overlay = overlayById.get(placed.id);
|
|
11453
12130
|
if (!overlay) return null;
|
|
11454
|
-
return /* @__PURE__ */ (0,
|
|
12131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
11455
12132
|
"button",
|
|
11456
12133
|
{
|
|
11457
12134
|
type: "button",
|
|
@@ -11466,24 +12143,24 @@ function SchedulingTimeGrid({
|
|
|
11466
12143
|
style: { gridColumn: gridColumns(placed), ...vars({ "--uix-scheduling-calendar-lane": placed.lane }) },
|
|
11467
12144
|
onClick: () => onSelectOverlay?.(overlay),
|
|
11468
12145
|
"aria-label": overlayName(overlay),
|
|
11469
|
-
children: /* @__PURE__ */ (0,
|
|
11470
|
-
overlay.kindLabel && /* @__PURE__ */ (0,
|
|
11471
|
-
/* @__PURE__ */ (0,
|
|
11472
|
-
overlay.scopeLabel && /* @__PURE__ */ (0,
|
|
12146
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("span", { className: "uix-scheduling-calendar__window-text", children: [
|
|
12147
|
+
overlay.kindLabel && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "uix-scheduling-calendar__window-kind", children: overlay.kindLabel }),
|
|
12148
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "uix-scheduling-calendar__window-name", children: overlay.label }),
|
|
12149
|
+
overlay.scopeLabel && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "uix-scheduling-calendar__window-scope", children: overlay.scopeLabel })
|
|
11473
12150
|
] })
|
|
11474
12151
|
},
|
|
11475
12152
|
placed.id
|
|
11476
12153
|
);
|
|
11477
12154
|
}),
|
|
11478
|
-
moreWindows > 0 && (onShowMore ? /* @__PURE__ */ (0,
|
|
12155
|
+
moreWindows > 0 && (onShowMore ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("button", { type: "button", tabIndex: -1, className: "uix-scheduling-calendar__rowmore", "data-more-date": firstHiddenWindowDay, "aria-label": fillLabel(labels.moreWindowsLabel, { count: moreWindows, date: dateText(firstHiddenWindowDay, "day") }), onClick: () => onShowMore(firstHiddenWindowDay, []), children: fillLabel(labels.moreWindows, { count: moreWindows }) }) : /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "uix-scheduling-calendar__rowmore", children: fillLabel(labels.moreWindows, { count: moreWindows }) }))
|
|
11479
12156
|
] }),
|
|
11480
|
-
(topLanes > 0 || ghostSpan) && /* @__PURE__ */ (0,
|
|
12157
|
+
(topLanes > 0 || ghostSpan) && /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "uix-scheduling-calendar__tg-strip uix-scheduling-calendar__tg-top", role: "group", "aria-label": labels.topLane, style: vars({ "--uix-scheduling-calendar-lanes": Math.max(topLanes, 1) }), children: [
|
|
11481
12158
|
top.placed.map((placed) => {
|
|
11482
12159
|
const entry = entryById.get(placed.id);
|
|
11483
12160
|
if (!entry) return null;
|
|
11484
12161
|
const canDrag = movable(entry);
|
|
11485
12162
|
const markers = entryMarkers(entry);
|
|
11486
|
-
return /* @__PURE__ */ (0,
|
|
12163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
11487
12164
|
"button",
|
|
11488
12165
|
{
|
|
11489
12166
|
type: "button",
|
|
@@ -11506,23 +12183,23 @@ function SchedulingTimeGrid({
|
|
|
11506
12183
|
onBlur: canDrag ? () => handlers.blur(entry) : void 0,
|
|
11507
12184
|
onPointerDown: canDrag ? (event) => handlers.pointerDown(event, entry, placed.startCol, true) : void 0,
|
|
11508
12185
|
children: [
|
|
11509
|
-
/* @__PURE__ */ (0,
|
|
11510
|
-
!placed.continuesBefore && !entry.allDay && /* @__PURE__ */ (0,
|
|
11511
|
-
/* @__PURE__ */ (0,
|
|
12186
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "uix-scheduling-calendar__entry-text", children: renderEntry?.(entry, { availableLines: 1 }) ?? /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_jsx_runtime92.Fragment, { children: [
|
|
12187
|
+
!placed.continuesBefore && !entry.allDay && /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_jsx_runtime92.Fragment, { children: [
|
|
12188
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "uix-scheduling-calendar__time", children: zonedTimeOfDay(entry.start, timeZone) }),
|
|
11512
12189
|
" "
|
|
11513
12190
|
] }),
|
|
11514
|
-
/* @__PURE__ */ (0,
|
|
12191
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "uix-scheduling-calendar__title", children: entry.title })
|
|
11515
12192
|
] }) }),
|
|
11516
|
-
markers.length > 0 && /* @__PURE__ */ (0,
|
|
12193
|
+
markers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "uix-scheduling-calendar__markers", children: markers.map((marker) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { children: renderMarker2(marker) }, marker.id)) })
|
|
11517
12194
|
]
|
|
11518
12195
|
},
|
|
11519
12196
|
placed.id
|
|
11520
12197
|
);
|
|
11521
12198
|
}),
|
|
11522
|
-
ghostSpan && /* @__PURE__ */ (0,
|
|
12199
|
+
ghostSpan && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "uix-scheduling-calendar__tg-ghost", "aria-hidden": "true", "data-sent": ghost?.source === "sent" || void 0, style: { gridColumn: gridColumns(ghostSpan), ...vars({ "--uix-scheduling-calendar-lane": ghostLane }) } })
|
|
11523
12200
|
] }),
|
|
11524
|
-
/* @__PURE__ */ (0,
|
|
11525
|
-
/* @__PURE__ */ (0,
|
|
12201
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "uix-scheduling-calendar__tg-body", children: [
|
|
12202
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "uix-scheduling-calendar__tg-gutter", "aria-hidden": "true", children: hourLabels(gutterIndex, false) }),
|
|
11526
12203
|
shades.map((placed) => {
|
|
11527
12204
|
const overlay = overlayById.get(placed.id);
|
|
11528
12205
|
const first = columns[placed.startCol];
|
|
@@ -11532,14 +12209,14 @@ function SchedulingTimeGrid({
|
|
|
11532
12209
|
const width = 100 / (placed.endCol - placed.startCol + 1);
|
|
11533
12210
|
const percent = (value) => `${Math.round(value * 1e4) / 100}%`;
|
|
11534
12211
|
const clipPath = placed.startCol === placed.endCol ? `polygon(0 ${percent(from)}, 100% ${percent(from)}, 100% ${percent(to)}, 0 ${percent(to)})` : `polygon(0 ${percent(from)}, ${width}% ${percent(from)}, ${width}% 0, 100% 0, 100% ${percent(to)}, ${100 - width}% ${percent(to)}, ${100 - width}% 100%, 0 100%)`;
|
|
11535
|
-
return /* @__PURE__ */ (0,
|
|
12212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "uix-scheduling-calendar__tg-shade", "aria-hidden": "true", "data-pattern": overlay.pattern ?? "solid", style: { gridColumn: gridColumns(placed), clipPath } }, `shade-${placed.id}`);
|
|
11536
12213
|
}),
|
|
11537
|
-
columns.map((column, index) => /* @__PURE__ */ (0,
|
|
12214
|
+
columns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "uix-scheduling-calendar__tg-column", "data-tg-column": column.date, style: { gridColumn: `${index + 2}`, ...vars({ "--uix-scheduling-calendar-hours": column.dayHours }) }, children: [
|
|
11538
12215
|
slotSignature(slots[index]) !== gutterSignature && hourLabels(index, true),
|
|
11539
12216
|
column.segments.map((segment) => {
|
|
11540
12217
|
const entry = entryById.get(segment.id);
|
|
11541
12218
|
const alone = segment.part === "continuation" && index === 0;
|
|
11542
|
-
return /* @__PURE__ */ (0,
|
|
12219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
11543
12220
|
GridItem,
|
|
11544
12221
|
{
|
|
11545
12222
|
entry,
|
|
@@ -11560,7 +12237,7 @@ function SchedulingTimeGrid({
|
|
|
11560
12237
|
`${segment.id}-${segment.part}`
|
|
11561
12238
|
);
|
|
11562
12239
|
}),
|
|
11563
|
-
ghostParts?.[index].map((segment) => /* @__PURE__ */ (0,
|
|
12240
|
+
ghostParts?.[index].map((segment) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
11564
12241
|
"div",
|
|
11565
12242
|
{
|
|
11566
12243
|
className: "uix-scheduling-calendar__tg-ghost",
|
|
@@ -11570,20 +12247,20 @@ function SchedulingTimeGrid({
|
|
|
11570
12247
|
},
|
|
11571
12248
|
`ghost-${segment.part}`
|
|
11572
12249
|
)),
|
|
11573
|
-
index === nowColumn && nowAt !== null && /* @__PURE__ */ (0,
|
|
12250
|
+
index === nowColumn && nowAt !== null && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "uix-scheduling-calendar__tg-now", "aria-hidden": "true", style: vars({ "--uix-scheduling-calendar-offset": (nowAt - column.dayStart) / HOUR_MS2 }) })
|
|
11574
12251
|
] }, column.date))
|
|
11575
12252
|
] }),
|
|
11576
|
-
emptyNote != null && emptyNote !== false && nothingToShow && /* @__PURE__ */ (0,
|
|
11577
|
-
moving && /* @__PURE__ */ (0,
|
|
11578
|
-
/* @__PURE__ */ (0,
|
|
11579
|
-
/* @__PURE__ */ (0,
|
|
12253
|
+
emptyNote != null && emptyNote !== false && nothingToShow && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "uix-scheduling-calendar__empty", children: emptyNote }),
|
|
12254
|
+
moving && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("p", { id: hintId, className: "uix-visually-hidden", children: labels.moveHint }),
|
|
12255
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "uix-scheduling-calendar__tg-probe", "aria-hidden": "true", children: "00:00 abcdef" }),
|
|
12256
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "uix-visually-hidden", "aria-live": "polite", children: announcement })
|
|
11580
12257
|
]
|
|
11581
12258
|
}
|
|
11582
12259
|
);
|
|
11583
12260
|
}
|
|
11584
12261
|
|
|
11585
12262
|
// src/components/SchedulingCalendar.tsx
|
|
11586
|
-
var
|
|
12263
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
11587
12264
|
var DEFAULT_SCHEDULING_CALENDAR_LABELS = {
|
|
11588
12265
|
region: "Scheduling calendar in {timeZone}",
|
|
11589
12266
|
previous: "Previous",
|
|
@@ -11652,12 +12329,12 @@ function coveredDays(start, end, timeZone) {
|
|
|
11652
12329
|
}
|
|
11653
12330
|
function Marker({ marker, showLabel }) {
|
|
11654
12331
|
const emphasis = marker.emphasis ?? "neutral";
|
|
11655
|
-
return /* @__PURE__ */ (0,
|
|
11656
|
-
marker.icon != null && /* @__PURE__ */ (0,
|
|
11657
|
-
/* @__PURE__ */ (0,
|
|
12332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("span", { className: "uix-scheduling-calendar__marker", "data-emphasis": emphasis, "data-glyph": marker.icon == null ? emphasis : void 0, children: [
|
|
12333
|
+
marker.icon != null && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "uix-scheduling-calendar__marker-icon", "aria-hidden": "true", children: marker.icon }),
|
|
12334
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: showLabel ? "uix-scheduling-calendar__marker-label" : "uix-visually-hidden", children: marker.label })
|
|
11658
12335
|
] });
|
|
11659
12336
|
}
|
|
11660
|
-
var renderMarker = (marker, showLabel) => /* @__PURE__ */ (0,
|
|
12337
|
+
var renderMarker = (marker, showLabel) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Marker, { marker, showLabel });
|
|
11661
12338
|
function SchedulingCalendar({
|
|
11662
12339
|
entries,
|
|
11663
12340
|
anchorDate,
|
|
@@ -11716,27 +12393,27 @@ function SchedulingCalendar({
|
|
|
11716
12393
|
};
|
|
11717
12394
|
const stateLabel = labels.states;
|
|
11718
12395
|
const viewLabel = { month: labels.viewMonth, week: labels.viewWeek, day: labels.viewDay, agenda: labels.viewAgenda };
|
|
11719
|
-
const [internalView, setInternalView] = (0,
|
|
12396
|
+
const [internalView, setInternalView] = (0, import_react68.useState)("month");
|
|
11720
12397
|
const view = controlledView ?? internalView;
|
|
11721
|
-
const [activeDate, setActiveDate] = (0,
|
|
11722
|
-
const [expandedDates, setExpandedDates] = (0,
|
|
12398
|
+
const [activeDate, setActiveDate] = (0, import_react68.useState)(anchorDate);
|
|
12399
|
+
const [expandedDates, setExpandedDates] = (0, import_react68.useState)(() => /* @__PURE__ */ new Set());
|
|
11723
12400
|
const dateText = (date, part) => formatDate?.(date, part) ?? cachedDateTimeFormat(locale, INTL_PARTS[part]).format(utcDate(date));
|
|
11724
12401
|
const formatInstant = (instant) => formatInstantProp?.(instant) ?? `${dateText(zonedDateKey(instant, timeZone), "day")} ${zonedTimeOfDay(instant, timeZone)}`;
|
|
11725
|
-
const gridRef = (0,
|
|
12402
|
+
const gridRef = (0, import_react68.useRef)(null);
|
|
11726
12403
|
const picksGiven = dayEntries !== void 0;
|
|
11727
12404
|
const controlled = picksGiven || dayInfo !== void 0;
|
|
11728
12405
|
const countsOnly = monthDensity === "counts" && view === "month";
|
|
11729
12406
|
const fixed = controlled || maxEntriesPerDay !== void 0 && onShowMore !== void 0 || countsOnly;
|
|
11730
12407
|
const windowCap = Math.max(0, windowLaneCap ?? (fixed ? DEFAULT_LANE_CAP2 : Infinity));
|
|
11731
12408
|
const spanCap = Math.max(0, spanLaneCap ?? (fixed ? DEFAULT_LANE_CAP2 : Infinity));
|
|
11732
|
-
const visibleEntries = (0,
|
|
11733
|
-
const monthDays = (0,
|
|
12409
|
+
const visibleEntries = (0, import_react68.useMemo)(() => entries.filter((entry) => filter?.(entry) ?? true), [entries, filter]);
|
|
12410
|
+
const monthDays = (0, import_react68.useMemo)(() => buildMonthGrid(startOfMonth(anchorDate), weekStartsOn), [anchorDate, weekStartsOn]);
|
|
11734
12411
|
const weekday = (utcDate(anchorDate).getUTCDay() - weekStartsOn + 7) % 7;
|
|
11735
12412
|
const weekStart = addCalendarDays(anchorDate, -weekday);
|
|
11736
|
-
const weekDays = (0,
|
|
11737
|
-
const days = (0,
|
|
12413
|
+
const weekDays = (0, import_react68.useMemo)(() => Array.from({ length: 7 }, (_, index) => addCalendarDays(weekStart, index)), [weekStart]);
|
|
12414
|
+
const days = (0, import_react68.useMemo)(() => view === "month" ? monthDays.map((day) => day.date) : view === "day" ? [anchorDate] : weekDays, [view, monthDays, weekDays, anchorDate]);
|
|
11738
12415
|
const timeGridView = view === "day" || view === "week" && timeGrid;
|
|
11739
|
-
const { singles, multiDay, coverage } = (0,
|
|
12416
|
+
const { singles, multiDay, coverage } = (0, import_react68.useMemo)(() => {
|
|
11740
12417
|
const byDay = /* @__PURE__ */ new Map();
|
|
11741
12418
|
const spans = [];
|
|
11742
12419
|
const every = [];
|
|
@@ -11751,9 +12428,9 @@ function SchedulingCalendar({
|
|
|
11751
12428
|
}
|
|
11752
12429
|
return { singles: byDay, multiDay: spans, coverage: every };
|
|
11753
12430
|
}, [visibleEntries, timeZone]);
|
|
11754
|
-
const entryById = (0,
|
|
11755
|
-
const overlayById = (0,
|
|
11756
|
-
const layout = (0,
|
|
12431
|
+
const entryById = (0, import_react68.useMemo)(() => new Map([...multiDay].reverse().map(({ entry }) => [entry.id, entry])), [multiDay]);
|
|
12432
|
+
const overlayById = (0, import_react68.useMemo)(() => new Map([...overlays].reverse().map((overlay) => [overlay.id, overlay])), [overlays]);
|
|
12433
|
+
const layout = (0, import_react68.useMemo)(() => {
|
|
11757
12434
|
if (spanLayout) return spanLayout;
|
|
11758
12435
|
if (view === "agenda" || timeGridView) return { placed: [], hiddenByRow: {}, firstHiddenDayByRow: {} };
|
|
11759
12436
|
const inputs = [];
|
|
@@ -11771,7 +12448,7 @@ function SchedulingCalendar({
|
|
|
11771
12448
|
}
|
|
11772
12449
|
return layoutMonthSpans(inputs, days, { timeZone, laneCap: { window: windowCap, item: spanCap } });
|
|
11773
12450
|
}, [spanLayout, view, timeGridView, overlays, multiDay, days, timeZone, windowCap, spanCap, countsOnly]);
|
|
11774
|
-
const placedByRow = (0,
|
|
12451
|
+
const placedByRow = (0, import_react68.useMemo)(() => {
|
|
11775
12452
|
const rows = /* @__PURE__ */ new Map();
|
|
11776
12453
|
for (const placed of layout.placed) {
|
|
11777
12454
|
const row = rows.get(placed.weekRow);
|
|
@@ -11782,7 +12459,7 @@ function SchedulingCalendar({
|
|
|
11782
12459
|
}, [layout]);
|
|
11783
12460
|
const lanesUsed = (row, group) => (placedByRow.get(row) ?? []).reduce((max, placed) => placed.group === group ? Math.max(max, placed.lane + 1) : max, 0);
|
|
11784
12461
|
const lanesUsedAnywhere = (group) => layout.placed.reduce((max, placed) => placed.group === group ? Math.max(max, placed.lane + 1) : max, 0);
|
|
11785
|
-
(0,
|
|
12462
|
+
(0, import_react68.useEffect)(() => {
|
|
11786
12463
|
if (view !== "agenda" && !days.includes(activeDate)) setActiveDate(days[0]);
|
|
11787
12464
|
}, [activeDate, days, view]);
|
|
11788
12465
|
const setView = (next) => {
|
|
@@ -11798,7 +12475,7 @@ function SchedulingCalendar({
|
|
|
11798
12475
|
setActiveDate(date);
|
|
11799
12476
|
requestAnimationFrame(() => gridRef.current?.querySelector(`[data-calendar-date="${date}"]`)?.focus());
|
|
11800
12477
|
};
|
|
11801
|
-
const enteredFrom = (0,
|
|
12478
|
+
const enteredFrom = (0, import_react68.useRef)(null);
|
|
11802
12479
|
const cellOf = (date) => gridRef.current?.querySelector(`[data-calendar-date="${date}"]`)?.closest(".uix-scheduling-calendar__day") ?? null;
|
|
11803
12480
|
const dayRing = (date) => {
|
|
11804
12481
|
const cell = cellOf(date);
|
|
@@ -11868,10 +12545,10 @@ function SchedulingCalendar({
|
|
|
11868
12545
|
const date = dayOfItem(item);
|
|
11869
12546
|
if (date && dayRing(date).includes(item)) setActiveDate(date);
|
|
11870
12547
|
};
|
|
11871
|
-
const flatAgendaRef = (0,
|
|
11872
|
-
const flatAgendaStop = (0,
|
|
12548
|
+
const flatAgendaRef = (0, import_react68.useRef)(null);
|
|
12549
|
+
const flatAgendaStop = (0, import_react68.useRef)({ node: null, index: 0 });
|
|
11873
12550
|
const flatAgendaRows = () => Array.from(flatAgendaRef.current?.querySelectorAll(":scope > ol > li > button") ?? []);
|
|
11874
|
-
(0,
|
|
12551
|
+
(0, import_react68.useEffect)(() => {
|
|
11875
12552
|
flatAgendaStop.current = syncRovingStop(flatAgendaRows(), flatAgendaStop.current);
|
|
11876
12553
|
});
|
|
11877
12554
|
const onFlatAgendaFocus = (event) => {
|
|
@@ -11921,15 +12598,15 @@ function SchedulingCalendar({
|
|
|
11921
12598
|
});
|
|
11922
12599
|
const entryContent = (entry, withTime = true) => {
|
|
11923
12600
|
const markers = markersOf(entry);
|
|
11924
|
-
return /* @__PURE__ */ (0,
|
|
11925
|
-
/* @__PURE__ */ (0,
|
|
11926
|
-
withTime && /* @__PURE__ */ (0,
|
|
11927
|
-
/* @__PURE__ */ (0,
|
|
12601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
12602
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "uix-scheduling-calendar__entry-text", children: renderEntry?.(entry) ?? /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
12603
|
+
withTime && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
12604
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "uix-scheduling-calendar__time", children: zonedTimeOfDay(entry.start, timeZone) }),
|
|
11928
12605
|
" "
|
|
11929
12606
|
] }),
|
|
11930
|
-
/* @__PURE__ */ (0,
|
|
12607
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "uix-scheduling-calendar__title", children: entry.title })
|
|
11931
12608
|
] }) }),
|
|
11932
|
-
markers.length > 0 && /* @__PURE__ */ (0,
|
|
12609
|
+
markers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "uix-scheduling-calendar__markers", children: markers.map((marker) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Marker, { marker }, marker.id)) })
|
|
11933
12610
|
] });
|
|
11934
12611
|
};
|
|
11935
12612
|
const laneStyle = (placed, windowLanes) => ({
|
|
@@ -11948,25 +12625,25 @@ function SchedulingCalendar({
|
|
|
11948
12625
|
const onDay = picksGiven ? all : entriesOn(date);
|
|
11949
12626
|
const badge = renderDayBadge?.(date, onDay);
|
|
11950
12627
|
const hasBadge = badge != null && badge !== false;
|
|
11951
|
-
const dateButton = /* @__PURE__ */ (0,
|
|
12628
|
+
const dateButton = /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("button", { type: "button", className: "uix-scheduling-calendar__date", "data-calendar-date": date, tabIndex: activeDate === date ? 0 : -1, onFocus: () => setActiveDate(date), onKeyDown: (event) => onDayKeyDown(event, date), onClick: onSelectDate ? () => onSelectDate(date) : void 0, "aria-label": info?.label ? fillLabel(labels.dayName, { date: dateText(date, "day"), label: info.label }) : dateText(date, "day"), children: Number(date.slice(-2)) });
|
|
11952
12629
|
const moreText = fillLabel(labels.moreEntries, { count: hiddenCount });
|
|
11953
12630
|
const moreName = fillLabel(labels.moreEntriesLabel, { count: hiddenCount, date: dateText(date, "day") });
|
|
11954
|
-
return /* @__PURE__ */ (0,
|
|
11955
|
-
hasBadge || info ? /* @__PURE__ */ (0,
|
|
11956
|
-
hasBadge && /* @__PURE__ */ (0,
|
|
11957
|
-
info && /* @__PURE__ */ (0,
|
|
11958
|
-
/* @__PURE__ */ (0,
|
|
11959
|
-
/* @__PURE__ */ (0,
|
|
12631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "uix-scheduling-calendar__day", "data-outside": view === "month" && !monthDays[index].inMonth || void 0, children: [
|
|
12632
|
+
hasBadge || info ? /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "uix-scheduling-calendar__dayhead", children: [
|
|
12633
|
+
hasBadge && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "uix-scheduling-calendar__badge", children: badge }),
|
|
12634
|
+
info && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("span", { className: "uix-scheduling-calendar__count", "aria-hidden": info.label ? true : void 0, children: [
|
|
12635
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { "aria-hidden": "true", children: info.count }),
|
|
12636
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "uix-visually-hidden", children: info.label ?? fillLabel(labels.dayCount, { count: info.count }) })
|
|
11960
12637
|
] }),
|
|
11961
|
-
info?.markers && info.markers.length > 0 && /* @__PURE__ */ (0,
|
|
12638
|
+
info?.markers && info.markers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "uix-scheduling-calendar__markers", children: info.markers.map((marker) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Marker, { marker }, marker.id)) }),
|
|
11962
12639
|
dateButton
|
|
11963
12640
|
] }) : dateButton,
|
|
11964
|
-
/* @__PURE__ */ (0,
|
|
11965
|
-
shown.map((entry) => /* @__PURE__ */ (0,
|
|
11966
|
-
countsOnly ? null : controlled ? hiddenCount > 0 && (onShowMore ? /* @__PURE__ */ (0,
|
|
11967
|
-
/* @__PURE__ */ (0,
|
|
11968
|
-
/* @__PURE__ */ (0,
|
|
11969
|
-
] })) : overflowing && /* @__PURE__ */ (0,
|
|
12641
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "uix-scheduling-calendar__entries", children: [
|
|
12642
|
+
shown.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("button", { className: "uix-scheduling-calendar__entry", ...entryProps(entry), children: entryContent(entry) }, entry.id)),
|
|
12643
|
+
countsOnly ? null : controlled ? hiddenCount > 0 && (onShowMore ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("button", { type: "button", tabIndex: -1, className: "uix-scheduling-calendar__more", "aria-label": moreName, onClick: () => onShowMore(date, onDay), children: moreText }) : /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("span", { className: "uix-scheduling-calendar__more", children: [
|
|
12644
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { "aria-hidden": "true", children: moreText }),
|
|
12645
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "uix-visually-hidden", children: moreName })
|
|
12646
|
+
] })) : overflowing && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("button", { type: "button", tabIndex: -1, className: "uix-scheduling-calendar__more", "aria-expanded": onShowMore ? void 0 : !collapsed, "aria-label": collapsed ? moreName : void 0, onClick: () => toggleMore(date, onDay), children: collapsed ? moreText : labels.fewerEntries })
|
|
11970
12647
|
] })
|
|
11971
12648
|
] }, date);
|
|
11972
12649
|
};
|
|
@@ -11981,26 +12658,26 @@ function SchedulingCalendar({
|
|
|
11981
12658
|
const moreText = fillLabel(labels.moreSpans, { count: hidden });
|
|
11982
12659
|
const moreName = fillLabel(labels.moreSpansLabel, { count: hidden, date: dateText(firstHiddenDay, "day") });
|
|
11983
12660
|
const style = { ["--uix-scheduling-calendar-lanes"]: Math.max(windowLanes + spanLanes, hidden > 0 ? 1 : 0) };
|
|
11984
|
-
return /* @__PURE__ */ (0,
|
|
12661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "uix-scheduling-calendar__week", style, children: [
|
|
11985
12662
|
rowDays.map((date, column) => renderDay(date, row * 7 + column)),
|
|
11986
12663
|
(placedByRow.get(row) ?? []).map((placed) => {
|
|
11987
12664
|
const continues = { "data-continues-before": placed.continuesBefore || void 0, "data-continues-after": placed.continuesAfter || void 0 };
|
|
11988
12665
|
if (placed.group === "window") {
|
|
11989
12666
|
const overlay = overlayById.get(placed.id);
|
|
11990
12667
|
if (!overlay) return null;
|
|
11991
|
-
return /* @__PURE__ */ (0,
|
|
11992
|
-
overlay.kindLabel && /* @__PURE__ */ (0,
|
|
11993
|
-
/* @__PURE__ */ (0,
|
|
11994
|
-
overlay.scopeLabel && /* @__PURE__ */ (0,
|
|
12668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("button", { type: "button", tabIndex: -1, className: "uix-scheduling-calendar__window", "data-overlay-id": overlay.id, "data-pattern": overlay.pattern ?? "solid", "data-global": overlay.global || void 0, "data-kind": overlay.kind, ...continues, style: laneStyle(placed, windowLanes), onClick: () => onSelectOverlay?.(overlay), "aria-label": overlayName(overlay), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("span", { className: "uix-scheduling-calendar__window-text", children: [
|
|
12669
|
+
overlay.kindLabel && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "uix-scheduling-calendar__window-kind", children: overlay.kindLabel }),
|
|
12670
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "uix-scheduling-calendar__window-name", children: overlay.label }),
|
|
12671
|
+
overlay.scopeLabel && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "uix-scheduling-calendar__window-scope", children: overlay.scopeLabel })
|
|
11995
12672
|
] }) }, `window-${placed.id}`);
|
|
11996
12673
|
}
|
|
11997
12674
|
const entry = entryById.get(placed.id);
|
|
11998
12675
|
if (!entry || countsOnly) return null;
|
|
11999
|
-
return /* @__PURE__ */ (0,
|
|
12676
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("button", { className: "uix-scheduling-calendar__entry uix-scheduling-calendar__span", ...entryProps(entry), ...continues, style: laneStyle(placed, windowLanes), children: entryContent(entry, !placed.continuesBefore) }, `span-${placed.id}`);
|
|
12000
12677
|
}),
|
|
12001
|
-
hidden > 0 && (onShowMore ? /* @__PURE__ */ (0,
|
|
12002
|
-
/* @__PURE__ */ (0,
|
|
12003
|
-
/* @__PURE__ */ (0,
|
|
12678
|
+
hidden > 0 && (onShowMore ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("button", { type: "button", tabIndex: -1, className: "uix-scheduling-calendar__rowmore", "data-more-date": rowDays.includes(firstHiddenDay) ? firstHiddenDay : rowDays[0], "aria-label": moreName, onClick: () => onShowMore(firstHiddenDay, picksGiven ? dayEntries[firstHiddenDay] ?? EMPTY_ENTRIES : entriesOn(firstHiddenDay)), children: moreText }) : /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("span", { className: "uix-scheduling-calendar__rowmore", children: [
|
|
12679
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { "aria-hidden": "true", children: moreText }),
|
|
12680
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "uix-visually-hidden", children: moreName })
|
|
12004
12681
|
] }))
|
|
12005
12682
|
] }, rowDays[0]);
|
|
12006
12683
|
};
|
|
@@ -12011,20 +12688,20 @@ function SchedulingCalendar({
|
|
|
12011
12688
|
Object.keys(layout.hiddenByRow ?? {}).length > 0 ? 1 : 0
|
|
12012
12689
|
)
|
|
12013
12690
|
} : void 0;
|
|
12014
|
-
return /* @__PURE__ */ (0,
|
|
12015
|
-
showHeader && /* @__PURE__ */ (0,
|
|
12016
|
-
/* @__PURE__ */ (0,
|
|
12017
|
-
/* @__PURE__ */ (0,
|
|
12018
|
-
/* @__PURE__ */ (0,
|
|
12691
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("section", { className: cx("uix-scheduling-calendar", className), "aria-label": fillLabel(labels.region, { timeZone }), children: [
|
|
12692
|
+
showHeader && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "uix-scheduling-calendar__header", children: [
|
|
12693
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { children: [
|
|
12694
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("button", { type: "button", className: "uix-btn uix-btn--ghost uix-btn--sm", onClick: () => movePeriod(-1), disabled: !onAnchorDateChange, children: periodLabel("previous") }),
|
|
12695
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("button", { type: "button", className: "uix-btn uix-btn--ghost uix-btn--sm", onClick: () => movePeriod(1), disabled: !onAnchorDateChange, children: periodLabel("next") })
|
|
12019
12696
|
] }),
|
|
12020
|
-
/* @__PURE__ */ (0,
|
|
12021
|
-
/* @__PURE__ */ (0,
|
|
12697
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("strong", { children: view === "month" ? dateText(startOfMonth(anchorDate), "month") : view === "day" ? dateText(anchorDate, "day") : `${dateText(weekStart, "day")} \u2013 ${dateText(weekDays[weekDays.length - 1], "day")}` }),
|
|
12698
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "uix-segmented", role: "group", "aria-label": labels.viewGroup, children: (timeGrid || view === "day" ? ["month", "week", "day", "agenda"] : ["month", "week", "agenda"]).map((option) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("button", { type: "button", className: "uix-segmented__option", "aria-pressed": view === option, "data-selected": view === option || void 0, onClick: () => setView(option), children: viewLabel[option] }, option)) })
|
|
12022
12699
|
] }),
|
|
12023
|
-
notice != null && notice !== false && /* @__PURE__ */ (0,
|
|
12024
|
-
loading ? /* @__PURE__ */ (0,
|
|
12025
|
-
/* @__PURE__ */ (0,
|
|
12026
|
-
onRetry && /* @__PURE__ */ (0,
|
|
12027
|
-
] }) : view === "agenda" && agendaGroups ? /* @__PURE__ */ (0,
|
|
12700
|
+
notice != null && notice !== false && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "uix-scheduling-calendar__notice", children: notice }),
|
|
12701
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "uix-scheduling-calendar__state", role: "status", children: labels.loading }) : error ? /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "uix-scheduling-calendar__state", role: "alert", children: [
|
|
12702
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("p", { children: error }),
|
|
12703
|
+
onRetry && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("button", { type: "button", className: "uix-btn uix-btn--secondary", onClick: onRetry, children: labels.retry })
|
|
12704
|
+
] }) : view === "agenda" && agendaGroups ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
12028
12705
|
SchedulingAgenda,
|
|
12029
12706
|
{
|
|
12030
12707
|
groups: agendaGroups,
|
|
@@ -12045,22 +12722,22 @@ function SchedulingCalendar({
|
|
|
12045
12722
|
onSelectOverlay,
|
|
12046
12723
|
onShowMore
|
|
12047
12724
|
}
|
|
12048
|
-
) : view === "agenda" ? /* @__PURE__ */ (0,
|
|
12725
|
+
) : view === "agenda" ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { ref: flatAgendaRef, className: "uix-scheduling-calendar__agenda", role: "region", "aria-label": labels.agenda, onKeyDown: onFlatAgendaKeyDown, onFocus: onFlatAgendaFocus, children: visibleEntries.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("p", { children: labels.agendaEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("ol", { children: [...visibleEntries].sort((a, b) => a.start.localeCompare(b.start)).map((entry) => {
|
|
12049
12726
|
const markers = markersOf(entry);
|
|
12050
|
-
return /* @__PURE__ */ (0,
|
|
12051
|
-
/* @__PURE__ */ (0,
|
|
12052
|
-
/* @__PURE__ */ (0,
|
|
12053
|
-
/* @__PURE__ */ (0,
|
|
12727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("button", { type: "button", "data-item-id": entry.id, "data-highlight": entry.emphasis === "highlight" || void 0, "data-dim": entry.emphasis === "dim" || void 0, "data-band": entry.band ?? "none", "data-status": statusOf(entry), "data-state": entry.state, onClick: () => onSelectEntry?.(entry), children: [
|
|
12728
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("span", { children: [
|
|
12729
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("strong", { children: renderEntry?.(entry) ?? entry.title }),
|
|
12730
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("span", { children: [
|
|
12054
12731
|
formatInstant(entry.start),
|
|
12055
12732
|
" \u2013 ",
|
|
12056
12733
|
formatInstant(entry.end)
|
|
12057
12734
|
] }),
|
|
12058
|
-
entry.meta && /* @__PURE__ */ (0,
|
|
12735
|
+
entry.meta && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { children: entry.meta })
|
|
12059
12736
|
] }),
|
|
12060
|
-
markers.length > 0 && /* @__PURE__ */ (0,
|
|
12061
|
-
entry.state ? /* @__PURE__ */ (0,
|
|
12737
|
+
markers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "uix-scheduling-calendar__markers", children: markers.map((marker) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Marker, { marker }, marker.id)) }),
|
|
12738
|
+
entry.state ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(StatusPill, { tone: stateTone(entry.state), children: stateLabel[entry.state] }) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "uix-scheduling-calendar__status", children: stateText(entry) })
|
|
12062
12739
|
] }) }, entry.id);
|
|
12063
|
-
}) }) }) : timeGridView ? /* @__PURE__ */ (0,
|
|
12740
|
+
}) }) }) : timeGridView ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
12064
12741
|
SchedulingTimeGrid,
|
|
12065
12742
|
{
|
|
12066
12743
|
view: view === "day" ? "day" : "week",
|
|
@@ -12094,26 +12771,26 @@ function SchedulingCalendar({
|
|
|
12094
12771
|
emptyNote,
|
|
12095
12772
|
nothingToShow
|
|
12096
12773
|
}
|
|
12097
|
-
) : /* @__PURE__ */ (0,
|
|
12098
|
-
days.slice(0, 7).map((date) => /* @__PURE__ */ (0,
|
|
12774
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { ref: gridRef, className: cx("uix-scheduling-calendar__grid", view === "week" && "uix-scheduling-calendar__grid--week"), "data-fixed": fixed || void 0, "data-density": countsOnly ? "counts" : void 0, style: gridStyle, onKeyDown: onGridKeyDown, onFocus: onGridFocus, role: "group", "aria-label": fillLabel(labels.grid, { view: viewLabel[view] }), children: [
|
|
12775
|
+
days.slice(0, 7).map((date) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "uix-scheduling-calendar__weekday", "aria-hidden": "true", children: dateText(date, "weekday") }, `weekday-${date}`)),
|
|
12099
12776
|
Array.from({ length: days.length / 7 }, (_, row) => renderWeek(row)),
|
|
12100
|
-
emptyNote != null && emptyNote !== false && nothingToShow && /* @__PURE__ */ (0,
|
|
12777
|
+
emptyNote != null && emptyNote !== false && nothingToShow && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "uix-scheduling-calendar__empty", children: emptyNote })
|
|
12101
12778
|
] }),
|
|
12102
|
-
legend ? (legend.length > 0 || legendCaption != null && legendCaption !== false) && /* @__PURE__ */ (0,
|
|
12103
|
-
legend.length > 0 && /* @__PURE__ */ (0,
|
|
12104
|
-
/* @__PURE__ */ (0,
|
|
12779
|
+
legend ? (legend.length > 0 || legendCaption != null && legendCaption !== false) && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "uix-scheduling-calendar__legend", role: "group", "aria-label": labels.legend, children: [
|
|
12780
|
+
legend.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("ul", { className: "uix-scheduling-calendar__legend-list", children: legend.map((item) => /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("li", { "data-legend-id": item.id, children: [
|
|
12781
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "uix-scheduling-calendar__swatch", "aria-hidden": "true", "data-band": item.swatch.band, "data-status": item.swatch.status, "data-pattern": item.swatch.pattern, children: item.swatch.icon }),
|
|
12105
12782
|
item.label
|
|
12106
12783
|
] }, item.id)) }),
|
|
12107
|
-
legendCaption != null && legendCaption !== false && /* @__PURE__ */ (0,
|
|
12108
|
-
] }) : /* @__PURE__ */ (0,
|
|
12109
|
-
["scheduled", "conflicted", "in-progress", "blackout-violation"].map((state) => /* @__PURE__ */ (0,
|
|
12110
|
-
legendCaption != null && legendCaption !== false && /* @__PURE__ */ (0,
|
|
12784
|
+
legendCaption != null && legendCaption !== false && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("p", { className: "uix-scheduling-calendar__legend-caption", children: legendCaption })
|
|
12785
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "uix-scheduling-calendar__legend", role: "group", "aria-label": labels.legend, children: [
|
|
12786
|
+
["scheduled", "conflicted", "in-progress", "blackout-violation"].map((state) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { "data-state": state, children: stateLabel[state] }, state)),
|
|
12787
|
+
legendCaption != null && legendCaption !== false && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("p", { className: "uix-scheduling-calendar__legend-caption", children: legendCaption })
|
|
12111
12788
|
] })
|
|
12112
12789
|
] });
|
|
12113
12790
|
}
|
|
12114
12791
|
|
|
12115
12792
|
// src/components/SchedulingTimeline.tsx
|
|
12116
|
-
var
|
|
12793
|
+
var import_react69 = require("react");
|
|
12117
12794
|
|
|
12118
12795
|
// src/scheduling-timeline-model.ts
|
|
12119
12796
|
var HOUR = 36e5;
|
|
@@ -12299,7 +12976,7 @@ function timelineWindow(offsets, top, bottom, options = {}) {
|
|
|
12299
12976
|
}
|
|
12300
12977
|
|
|
12301
12978
|
// src/components/SchedulingTimeline.tsx
|
|
12302
|
-
var
|
|
12979
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
12303
12980
|
var DEFAULT_SCHEDULING_TIMELINE_LABELS = {
|
|
12304
12981
|
region: "Schedule timeline in {timeZone}",
|
|
12305
12982
|
lanes: "Lanes",
|
|
@@ -12341,7 +13018,7 @@ var DEFAULT_UNITS = { row: 36, pad: 16, head: 40 };
|
|
|
12341
13018
|
var ESTIMATED_VIEWPORT = 720;
|
|
12342
13019
|
var OVERSCAN_ROWS = 4;
|
|
12343
13020
|
var BAR_MIN_FALLBACK = 1.5 * 16;
|
|
12344
|
-
var useIsomorphicLayoutEffect8 = typeof document !== "undefined" ?
|
|
13021
|
+
var useIsomorphicLayoutEffect8 = typeof document !== "undefined" ? import_react69.useLayoutEffect : import_react69.useEffect;
|
|
12345
13022
|
var sameExtent = (a, b) => a.subRows === b.subRows && a.lanes === b.lanes && a.heads === b.heads;
|
|
12346
13023
|
var IN_LANE = { scope: "lane", labelTops: ["0%"] };
|
|
12347
13024
|
var vars2 = (values) => values;
|
|
@@ -12358,9 +13035,9 @@ function uniqueKeys2(ids) {
|
|
|
12358
13035
|
var lanesOf = (target) => target.laneIds !== void 0 ? new Set(target.laneIds) : target.laneId ? /* @__PURE__ */ new Set([target.laneId]) : null;
|
|
12359
13036
|
function ItemMarker({ marker, showLabel }) {
|
|
12360
13037
|
const emphasis = marker.emphasis ?? "neutral";
|
|
12361
|
-
return /* @__PURE__ */ (0,
|
|
12362
|
-
marker.icon != null && /* @__PURE__ */ (0,
|
|
12363
|
-
/* @__PURE__ */ (0,
|
|
13038
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("span", { className: "uix-scheduling-timeline__item-marker", "data-emphasis": emphasis, "data-glyph": marker.icon == null ? emphasis : void 0, children: [
|
|
13039
|
+
marker.icon != null && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__item-marker-icon", "aria-hidden": "true", children: marker.icon }),
|
|
13040
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: showLabel ? "uix-scheduling-timeline__item-marker-label" : "uix-visually-hidden", children: marker.label })
|
|
12364
13041
|
] });
|
|
12365
13042
|
}
|
|
12366
13043
|
function SchedulingTimeline({
|
|
@@ -12407,29 +13084,29 @@ function SchedulingTimeline({
|
|
|
12407
13084
|
overlays: { ...DEFAULT_SCHEDULING_TIMELINE_LABELS.overlays, ...uixLabels.schedulingTimeline?.overlays, ...labelOverrides?.overlays },
|
|
12408
13085
|
statuses: { ...DEFAULT_SCHEDULING_TIMELINE_LABELS.statuses, ...uixLabels.schedulingTimeline?.statuses, ...labelOverrides?.statuses }
|
|
12409
13086
|
};
|
|
12410
|
-
const id = (0,
|
|
13087
|
+
const id = (0, import_react69.useId)();
|
|
12411
13088
|
const hintId = `${id}-hint`;
|
|
12412
13089
|
const step = stepProp !== void 0 && Number.isFinite(stepProp) && stepProp > 0 ? stepProp : defaultTimelineStep(scale);
|
|
12413
|
-
const rootRef = (0,
|
|
12414
|
-
const [scroller, setScroller] = (0,
|
|
12415
|
-
const [layerTrack, setLayerTrack] = (0,
|
|
12416
|
-
const probeRef = (0,
|
|
12417
|
-
const bodyRef = (0,
|
|
12418
|
-
const barMinRef = (0,
|
|
12419
|
-
const [barShare, setBarShare] = (0,
|
|
12420
|
-
const barShareRef = (0,
|
|
12421
|
-
const anchorRef = (0,
|
|
12422
|
-
const [anchorKey, setAnchorKey] = (0,
|
|
12423
|
-
const [focusRowKey, setFocusRowKey] = (0,
|
|
12424
|
-
const [activeId, setActiveId] = (0,
|
|
12425
|
-
const [focusRequest, setFocusRequest] = (0,
|
|
12426
|
-
const [stepDrag, setStepDrag] = (0,
|
|
12427
|
-
const [ghost, setGhost] = (0,
|
|
12428
|
-
const [announcement, setAnnouncement] = (0,
|
|
12429
|
-
const [selfCollapsed, setSelfCollapsed] = (0,
|
|
12430
|
-
const [units, setUnits] = (0,
|
|
12431
|
-
const [view, setView] = (0,
|
|
12432
|
-
const measureViewRef = (0,
|
|
13090
|
+
const rootRef = (0, import_react69.useRef)(null);
|
|
13091
|
+
const [scroller, setScroller] = (0, import_react69.useState)(null);
|
|
13092
|
+
const [layerTrack, setLayerTrack] = (0, import_react69.useState)(null);
|
|
13093
|
+
const probeRef = (0, import_react69.useRef)(null);
|
|
13094
|
+
const bodyRef = (0, import_react69.useRef)(null);
|
|
13095
|
+
const barMinRef = (0, import_react69.useRef)(null);
|
|
13096
|
+
const [barShare, setBarShare] = (0, import_react69.useState)(0);
|
|
13097
|
+
const barShareRef = (0, import_react69.useRef)(0);
|
|
13098
|
+
const anchorRef = (0, import_react69.useRef)(null);
|
|
13099
|
+
const [anchorKey, setAnchorKey] = (0, import_react69.useState)(null);
|
|
13100
|
+
const [focusRowKey, setFocusRowKey] = (0, import_react69.useState)(null);
|
|
13101
|
+
const [activeId, setActiveId] = (0, import_react69.useState)();
|
|
13102
|
+
const [focusRequest, setFocusRequest] = (0, import_react69.useState)(null);
|
|
13103
|
+
const [stepDrag, setStepDrag] = (0, import_react69.useState)(null);
|
|
13104
|
+
const [ghost, setGhost] = (0, import_react69.useState)(null);
|
|
13105
|
+
const [announcement, setAnnouncement] = (0, import_react69.useState)("");
|
|
13106
|
+
const [selfCollapsed, setSelfCollapsed] = (0, import_react69.useState)({});
|
|
13107
|
+
const [units, setUnits] = (0, import_react69.useState)(DEFAULT_UNITS);
|
|
13108
|
+
const [view, setView] = (0, import_react69.useState)({ top: 0, height: ESTIMATED_VIEWPORT });
|
|
13109
|
+
const measureViewRef = (0, import_react69.useRef)(null);
|
|
12433
13110
|
const proposing = onProposeMove !== void 0;
|
|
12434
13111
|
const stepping = !proposing && onMoveItem !== void 0;
|
|
12435
13112
|
const resizing = onResizeItem !== void 0;
|
|
@@ -12444,8 +13121,8 @@ function SchedulingTimeline({
|
|
|
12444
13121
|
return offset ? `${text} ${offset}` : text;
|
|
12445
13122
|
};
|
|
12446
13123
|
const fmtTick = (at) => formatTick?.(new Date(at), scale) ?? cachedDateTimeFormat(locale, { timeZone, ...TICK_FORMAT[scale] }).format(new Date(at));
|
|
12447
|
-
const ticks = (0,
|
|
12448
|
-
const minorTicks = (0,
|
|
13124
|
+
const ticks = (0, import_react69.useMemo)(() => timelineTicks(range, scale, timeZone, weekStartsOn), [range.start, range.end, scale, timeZone, weekStartsOn]);
|
|
13125
|
+
const minorTicks = (0, import_react69.useMemo)(
|
|
12449
13126
|
() => scale === "day" && subTicks && subTicks.length > 0 ? timelineSubTicks(range, subTicks, timeZone) : [],
|
|
12450
13127
|
[range.start, range.end, scale, timeZone, subTicks]
|
|
12451
13128
|
// eslint-disable-line react-hooks/exhaustive-deps
|
|
@@ -12474,7 +13151,7 @@ function SchedulingTimeline({
|
|
|
12474
13151
|
const minSpan = Math.max(0, (Date.parse(range.end) - Date.parse(range.start)) * barShare) || 0;
|
|
12475
13152
|
const isCollapsed = (group) => onToggleGroup ? !!group.collapsed : selfCollapsed[group.id] ?? !!group.collapsed;
|
|
12476
13153
|
const collapsedSignature = groups?.map((group) => isCollapsed(group) ? "1" : "0").join("") ?? "";
|
|
12477
|
-
const itemsByLane = (0,
|
|
13154
|
+
const itemsByLane = (0, import_react69.useMemo)(() => {
|
|
12478
13155
|
const byLane = /* @__PURE__ */ new Map();
|
|
12479
13156
|
for (const item of items) {
|
|
12480
13157
|
const list = byLane.get(item.laneId);
|
|
@@ -12483,7 +13160,7 @@ function SchedulingTimeline({
|
|
|
12483
13160
|
}
|
|
12484
13161
|
return byLane;
|
|
12485
13162
|
}, [items]);
|
|
12486
|
-
const rows = (0,
|
|
13163
|
+
const rows = (0, import_react69.useMemo)(() => {
|
|
12487
13164
|
const laneRow = (lane, laneIndex, groupIndex) => {
|
|
12488
13165
|
const placed = layoutLane(itemsByLane.get(lane.id) ?? EMPTY_ITEMS, range, { flagOverlaps, minSpan });
|
|
12489
13166
|
return { kind: "lane", key: `lane-${laneIndex}`, lane, laneIndex, groupIndex, placed, keys: uniqueKeys2(placed.map((p) => p.item.id)), subRows: placed.reduce((max, p) => Math.max(max, p.row + 1), 1) };
|
|
@@ -12515,8 +13192,8 @@ function SchedulingTimeline({
|
|
|
12515
13192
|
});
|
|
12516
13193
|
return list;
|
|
12517
13194
|
}, [lanes, groups, collapsedSignature, itemsByLane, range.start, range.end, flagOverlaps, minSpan]);
|
|
12518
|
-
const laneRows = (0,
|
|
12519
|
-
const { ordered, rowOfItem } = (0,
|
|
13195
|
+
const laneRows = (0, import_react69.useMemo)(() => rows.filter((row) => row.kind === "lane"), [rows]);
|
|
13196
|
+
const { ordered, rowOfItem } = (0, import_react69.useMemo)(() => {
|
|
12520
13197
|
const ids = [];
|
|
12521
13198
|
const rowOf = /* @__PURE__ */ new Map();
|
|
12522
13199
|
rows.forEach((row, rowIndex) => {
|
|
@@ -12528,13 +13205,13 @@ function SchedulingTimeline({
|
|
|
12528
13205
|
});
|
|
12529
13206
|
return { ordered: ids, rowOfItem: rowOf };
|
|
12530
13207
|
}, [rows]);
|
|
12531
|
-
const nothingToShow = (0,
|
|
13208
|
+
const nothingToShow = (0, import_react69.useMemo)(() => {
|
|
12532
13209
|
if (ordered.length > 0) return false;
|
|
12533
13210
|
const laneIds = new Set(lanes.map((lane) => lane.id));
|
|
12534
13211
|
return !items.some((item) => laneIds.has(item.laneId) && placeSpan(item, range) !== null);
|
|
12535
13212
|
}, [ordered, lanes, items, range.start, range.end]);
|
|
12536
13213
|
const focusId = activeId !== void 0 && rowOfItem.has(activeId) ? activeId : ordered[0];
|
|
12537
|
-
const strips = (0,
|
|
13214
|
+
const strips = (0, import_react69.useMemo)(() => {
|
|
12538
13215
|
const set = /* @__PURE__ */ new Set();
|
|
12539
13216
|
const shown = overlays.filter((overlay) => placeSpan(overlay, range) !== null).map(lanesOf);
|
|
12540
13217
|
if (shown.length === 0) return set;
|
|
@@ -12544,12 +13221,12 @@ function SchedulingTimeline({
|
|
|
12544
13221
|
});
|
|
12545
13222
|
return set;
|
|
12546
13223
|
}, [rows, overlays, range.start, range.end]);
|
|
12547
|
-
const extents = (0,
|
|
13224
|
+
const extents = (0, import_react69.useMemo)(() => timelineRowExtents(rows.map((row, index) => row.kind === "head" ? { kind: "head", subRows: strips.has(index) ? 1 : 0 } : { kind: "lane", subRows: row.subRows })), [rows, strips]);
|
|
12548
13225
|
const windowed = lanes.length + (groups?.length ?? 0) > virtualizeAbove;
|
|
12549
13226
|
const printing = usePrinting(windowed);
|
|
12550
13227
|
const virtual = windowed && !printing;
|
|
12551
13228
|
const fixed = windowed || groups !== void 0 || overlays.some((overlay) => overlay.laneIds !== void 0) || markers.some((marker) => marker.laneIds !== void 0);
|
|
12552
|
-
(0,
|
|
13229
|
+
(0, import_react69.useEffect)(() => {
|
|
12553
13230
|
if (!virtual || !scroller) return void 0;
|
|
12554
13231
|
let frame = 0;
|
|
12555
13232
|
const measure = () => {
|
|
@@ -12589,12 +13266,12 @@ function SchedulingTimeline({
|
|
|
12589
13266
|
};
|
|
12590
13267
|
}, [virtual, scroller]);
|
|
12591
13268
|
const px = (extent) => extent.subRows * units.row + extent.lanes * units.pad + extent.heads * units.head;
|
|
12592
|
-
const offsets = (0,
|
|
13269
|
+
const offsets = (0, import_react69.useMemo)(() => virtual ? extents.map(px) : [], [virtual, extents, units]);
|
|
12593
13270
|
const overscan = OVERSCAN_ROWS * units.row;
|
|
12594
13271
|
const pinned = focusId === void 0 ? -1 : rowOfItem.get(focusId) ?? -1;
|
|
12595
|
-
const focusedRow = (0,
|
|
12596
|
-
const anchorRow = (0,
|
|
12597
|
-
const { mounted, windowStart } = (0,
|
|
13272
|
+
const focusedRow = (0, import_react69.useMemo)(() => focusRowKey === null ? -1 : rows.findIndex((row) => row.key === focusRowKey), [rows, focusRowKey]);
|
|
13273
|
+
const anchorRow = (0, import_react69.useMemo)(() => anchorKey === null ? -1 : rows.findIndex((row) => row.key === anchorKey), [rows, anchorKey]);
|
|
13274
|
+
const { mounted, windowStart } = (0, import_react69.useMemo)(() => {
|
|
12598
13275
|
if (!virtual) return { mounted: rows.map((_, index) => index), windowStart: 0 };
|
|
12599
13276
|
const window_ = timelineWindow(offsets, view.top, view.top + view.height, { overscan });
|
|
12600
13277
|
const list = [];
|
|
@@ -12642,10 +13319,10 @@ function SchedulingTimeline({
|
|
|
12642
13319
|
setActiveId(itemId);
|
|
12643
13320
|
setFocusRequest({ id: itemId });
|
|
12644
13321
|
};
|
|
12645
|
-
(0,
|
|
13322
|
+
(0, import_react69.useEffect)(() => {
|
|
12646
13323
|
if (focusRequest) findBar(focusRequest.id)?.focus();
|
|
12647
13324
|
}, [focusRequest]);
|
|
12648
|
-
const itemById = (0,
|
|
13325
|
+
const itemById = (0, import_react69.useMemo)(() => {
|
|
12649
13326
|
const map = /* @__PURE__ */ new Map();
|
|
12650
13327
|
for (const row of laneRows) for (const p of row.placed) if (!map.has(p.item.id)) map.set(p.item.id, p.item);
|
|
12651
13328
|
return map;
|
|
@@ -12655,15 +13332,15 @@ function SchedulingTimeline({
|
|
|
12655
13332
|
const steps = Math.round(ms / step);
|
|
12656
13333
|
return { days: steps * stepDelta.days, minutes: steps * stepDelta.minutes };
|
|
12657
13334
|
};
|
|
12658
|
-
const live = (0,
|
|
13335
|
+
const live = (0, import_react69.useRef)({ itemById, timeZone, range, step, onProposeMove, canMove, deltaFor, labels, fmtInstant });
|
|
12659
13336
|
live.current = { itemById, timeZone, range, step, onProposeMove, canMove, deltaFor, labels, fmtInstant };
|
|
12660
|
-
const dragRef = (0,
|
|
12661
|
-
const suppressClick = (0,
|
|
12662
|
-
const refocus = (0,
|
|
12663
|
-
(0,
|
|
13337
|
+
const dragRef = (0, import_react69.useRef)(null);
|
|
13338
|
+
const suppressClick = (0, import_react69.useRef)(false);
|
|
13339
|
+
const refocus = (0, import_react69.useRef)(null);
|
|
13340
|
+
(0, import_react69.useEffect)(() => {
|
|
12664
13341
|
if (ghost && !itemById.has(ghost.id)) setGhost(null);
|
|
12665
13342
|
}, [ghost, itemById]);
|
|
12666
|
-
(0,
|
|
13343
|
+
(0, import_react69.useEffect)(() => {
|
|
12667
13344
|
const wanted = refocus.current;
|
|
12668
13345
|
if (!wanted || !rootRef.current) return;
|
|
12669
13346
|
const active = document.activeElement;
|
|
@@ -12674,11 +13351,11 @@ function SchedulingTimeline({
|
|
|
12674
13351
|
}
|
|
12675
13352
|
findBar(wanted)?.focus();
|
|
12676
13353
|
});
|
|
12677
|
-
(0,
|
|
13354
|
+
(0, import_react69.useEffect)(() => () => {
|
|
12678
13355
|
dragRef.current?.stop();
|
|
12679
13356
|
dragRef.current = null;
|
|
12680
13357
|
}, []);
|
|
12681
|
-
(0,
|
|
13358
|
+
(0, import_react69.useEffect)(() => {
|
|
12682
13359
|
if (proposing) return;
|
|
12683
13360
|
dragRef.current?.stop();
|
|
12684
13361
|
dragRef.current = null;
|
|
@@ -12939,17 +13616,17 @@ function SchedulingTimeline({
|
|
|
12939
13616
|
"data-scope": scope.scope,
|
|
12940
13617
|
style: { left: `${pos.left}%`, width: `${pos.width}%`, ...vars2({ "--uix-timeline-clip": scope.clip }) }
|
|
12941
13618
|
};
|
|
12942
|
-
const text = scope.labelTops.map((top) => /* @__PURE__ */ (0,
|
|
12943
|
-
overlay.kindLabel && /* @__PURE__ */ (0,
|
|
12944
|
-
/* @__PURE__ */ (0,
|
|
12945
|
-
overlay.scopeLabel && /* @__PURE__ */ (0,
|
|
13619
|
+
const text = scope.labelTops.map((top) => /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("span", { className: "uix-scheduling-timeline__overlay-label", style: vars2({ "--uix-timeline-label-top": top }), children: [
|
|
13620
|
+
overlay.kindLabel && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__overlay-kind", children: overlay.kindLabel }),
|
|
13621
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__overlay-name", children: overlay.label }),
|
|
13622
|
+
overlay.scopeLabel && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__overlay-scope", children: overlay.scopeLabel })
|
|
12946
13623
|
] }, top));
|
|
12947
|
-
return onSelectOverlay ? /* @__PURE__ */ (0,
|
|
13624
|
+
return onSelectOverlay ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("button", { type: "button", ...shared, "aria-label": overlayName(overlay), onClick: () => onSelectOverlay(overlay), children: text }, key) : /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { ...shared, "aria-hidden": "true", children: text }, key);
|
|
12948
13625
|
};
|
|
12949
13626
|
const renderMarker2 = (marker, key, scope) => {
|
|
12950
13627
|
const pos = placeSpan({ start: marker.at, end: marker.at }, range);
|
|
12951
13628
|
if (!pos || !scope) return null;
|
|
12952
|
-
return /* @__PURE__ */ (0,
|
|
13629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__marker", "data-marker-id": marker.id, "data-scope": scope.scope, style: { left: `${pos.left}%`, ...vars2({ "--uix-timeline-clip": scope.clip }) }, title: marker.label, "aria-hidden": "true" }, key);
|
|
12953
13630
|
};
|
|
12954
13631
|
const overlayKeys = uniqueKeys2(overlays.map((overlay) => overlay.id));
|
|
12955
13632
|
const markerKeys = uniqueKeys2(markers.map((marker) => marker.id));
|
|
@@ -12974,7 +13651,7 @@ function SchedulingTimeline({
|
|
|
12974
13651
|
const movable = canMove(item);
|
|
12975
13652
|
const described = movable || canResize(item);
|
|
12976
13653
|
const itemMarkers = markersOf(item);
|
|
12977
|
-
return /* @__PURE__ */ (0,
|
|
13654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("li", { className: "uix-scheduling-timeline__slot", style: { left: `${shown.left}%`, width: `${shown.width}%`, ...vars2({ "--uix-timeline-row": p.row }) }, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
12978
13655
|
"button",
|
|
12979
13656
|
{
|
|
12980
13657
|
type: "button",
|
|
@@ -13012,9 +13689,9 @@ function SchedulingTimeline({
|
|
|
13012
13689
|
onSelectItem?.(item);
|
|
13013
13690
|
},
|
|
13014
13691
|
children: [
|
|
13015
|
-
/* @__PURE__ */ (0,
|
|
13016
|
-
item.meta && /* @__PURE__ */ (0,
|
|
13017
|
-
itemMarkers.length > 0 && /* @__PURE__ */ (0,
|
|
13692
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__item-title", children: renderItem?.(item) ?? item.title }),
|
|
13693
|
+
item.meta && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__item-meta", children: item.meta }),
|
|
13694
|
+
itemMarkers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__item-markers", children: itemMarkers.map((marker) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ItemMarker, { marker }, marker.id)) })
|
|
13018
13695
|
]
|
|
13019
13696
|
}
|
|
13020
13697
|
) }, row.keys[index]);
|
|
@@ -13022,41 +13699,41 @@ function SchedulingTimeline({
|
|
|
13022
13699
|
const renderRow = (row, rowIndex) => {
|
|
13023
13700
|
if (row.kind === "head") {
|
|
13024
13701
|
const { group, collapsed } = row;
|
|
13025
|
-
return /* @__PURE__ */ (0,
|
|
13026
|
-
/* @__PURE__ */ (0,
|
|
13027
|
-
/* @__PURE__ */ (0,
|
|
13028
|
-
/* @__PURE__ */ (0,
|
|
13029
|
-
/* @__PURE__ */ (0,
|
|
13702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: cx("uix-scheduling-timeline__row", "uix-scheduling-timeline__row--group", collapsed && "uix-scheduling-timeline__row--summary"), "data-row-key": row.key, "data-group-id": group.id, "data-collapsed": collapsed || void 0, "data-strip": strips.has(rowIndex) || void 0, children: [
|
|
13703
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "uix-scheduling-timeline__group-head", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "uix-scheduling-timeline__group-label", children: [
|
|
13704
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("button", { type: "button", className: "uix-scheduling-timeline__group-toggle", "aria-expanded": !collapsed, onClick: () => toggleGroup(group), children: [
|
|
13705
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__group-chevron", "aria-hidden": "true" }),
|
|
13706
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__group-name", id: `${id}-group-${row.groupIndex}`, children: group.label })
|
|
13030
13707
|
] }),
|
|
13031
|
-
group.meta != null && /* @__PURE__ */ (0,
|
|
13032
|
-
collapsed && group.summary && /* @__PURE__ */ (0,
|
|
13033
|
-
/* @__PURE__ */ (0,
|
|
13034
|
-
group.summary.markers && group.summary.markers.length > 0 && /* @__PURE__ */ (0,
|
|
13708
|
+
group.meta != null && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__group-meta", children: group.meta }),
|
|
13709
|
+
collapsed && group.summary && /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("span", { className: "uix-scheduling-timeline__group-summary", children: [
|
|
13710
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__group-count", children: fillLabel(labels.groupSummary, { count: group.summary.count }) }),
|
|
13711
|
+
group.summary.markers && group.summary.markers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__item-markers", children: group.summary.markers.map((marker) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ItemMarker, { marker, showLabel: true }, marker.id)) })
|
|
13035
13712
|
] })
|
|
13036
13713
|
] }) }),
|
|
13037
|
-
strips.has(rowIndex) && /* @__PURE__ */ (0,
|
|
13714
|
+
strips.has(rowIndex) && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "uix-scheduling-timeline__group-strip", "aria-hidden": "true" })
|
|
13038
13715
|
] }, row.key);
|
|
13039
13716
|
}
|
|
13040
13717
|
const { lane } = row;
|
|
13041
13718
|
const laneLabelId = `${id}-lane-${row.laneIndex}`;
|
|
13042
13719
|
const ghostPlaced = ghost ? row.placed.find((p) => p.item.id === ghost.id) : void 0;
|
|
13043
13720
|
const ghostPos = ghost && ghostPlaced && rowOfItem.get(ghost.id) === rowIndex ? placeSpan(ghost.proposal, range) : null;
|
|
13044
|
-
return /* @__PURE__ */ (0,
|
|
13045
|
-
/* @__PURE__ */ (0,
|
|
13046
|
-
/* @__PURE__ */ (0,
|
|
13047
|
-
lane.meta != null && /* @__PURE__ */ (0,
|
|
13721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "uix-scheduling-timeline__row", "data-row-key": row.key, "data-lane-id": lane.id, style: vars2({ "--uix-timeline-rows": row.subRows }), children: [
|
|
13722
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "uix-scheduling-timeline__lane-label", id: laneLabelId, children: [
|
|
13723
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__lane-name", children: lane.label }),
|
|
13724
|
+
lane.meta != null && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__lane-meta", children: lane.meta })
|
|
13048
13725
|
] }),
|
|
13049
|
-
/* @__PURE__ */ (0,
|
|
13726
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "uix-scheduling-timeline__track", style: trackStyle, children: [
|
|
13050
13727
|
overlays.map((overlay, index) => !inLayer(overlay) && lanesOf(overlay).has(lane.id) ? renderOverlay(overlay, overlayKeys[index], IN_LANE) : null),
|
|
13051
13728
|
markers.map((marker, index) => !inLayer(marker) && lanesOf(marker).has(lane.id) ? renderMarker2(marker, markerKeys[index], IN_LANE) : null),
|
|
13052
|
-
/* @__PURE__ */ (0,
|
|
13053
|
-
ghostPos && /* @__PURE__ */ (0,
|
|
13729
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("ul", { className: "uix-scheduling-timeline__items", "aria-labelledby": row.groupIndex === void 0 ? laneLabelId : `${id}-group-${row.groupIndex} ${laneLabelId}`, children: renderItems(row, rowIndex) }),
|
|
13730
|
+
ghostPos && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__ghost", "aria-hidden": "true", "data-sent": ghost?.source === "sent" || void 0, style: { left: `${ghostPos.left}%`, width: `${ghostPos.width}%`, ...vars2({ "--uix-timeline-row": ghostPlaced.row }) } })
|
|
13054
13731
|
] })
|
|
13055
13732
|
] }, row.key);
|
|
13056
13733
|
};
|
|
13057
13734
|
const body = [];
|
|
13058
13735
|
let cursor = 0;
|
|
13059
|
-
const spacer = (from, to) => /* @__PURE__ */ (0,
|
|
13736
|
+
const spacer = (from, to) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "uix-scheduling-timeline__spacer", "aria-hidden": "true", style: { height: extentCss(between(extents[from], extents[to])) } }, `spacer-${from}`);
|
|
13060
13737
|
for (const index of mounted) {
|
|
13061
13738
|
if (index > cursor) body.push(spacer(cursor, index));
|
|
13062
13739
|
body.push(renderRow(rows[index], index));
|
|
@@ -13064,7 +13741,7 @@ function SchedulingTimeline({
|
|
|
13064
13741
|
}
|
|
13065
13742
|
if (cursor < rows.length) body.push(spacer(cursor, rows.length));
|
|
13066
13743
|
const listed = onSelectOverlay ? EMPTY_OVERLAYS2 : overlays;
|
|
13067
|
-
return /* @__PURE__ */ (0,
|
|
13744
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
13068
13745
|
"section",
|
|
13069
13746
|
{
|
|
13070
13747
|
ref: rootRef,
|
|
@@ -13079,45 +13756,45 @@ function SchedulingTimeline({
|
|
|
13079
13756
|
}
|
|
13080
13757
|
},
|
|
13081
13758
|
children: [
|
|
13082
|
-
notice != null && notice !== false && /* @__PURE__ */ (0,
|
|
13083
|
-
loading ? /* @__PURE__ */ (0,
|
|
13084
|
-
/* @__PURE__ */ (0,
|
|
13085
|
-
onRetry && /* @__PURE__ */ (0,
|
|
13086
|
-
] }) : /* @__PURE__ */ (0,
|
|
13087
|
-
(listed.length > 0 || markers.length > 0) && /* @__PURE__ */ (0,
|
|
13088
|
-
/* @__PURE__ */ (0,
|
|
13089
|
-
/* @__PURE__ */ (0,
|
|
13090
|
-
listed.map((o, index) => /* @__PURE__ */ (0,
|
|
13759
|
+
notice != null && notice !== false && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "uix-scheduling-timeline__notice", children: notice }),
|
|
13760
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "uix-scheduling-timeline__state", role: "status", children: labels.loading }) : error ? /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "uix-scheduling-timeline__state", role: "alert", children: [
|
|
13761
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("p", { children: error }),
|
|
13762
|
+
onRetry && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("button", { type: "button", className: "uix-btn uix-btn--secondary", onClick: onRetry, children: labels.retry })
|
|
13763
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_jsx_runtime94.Fragment, { children: [
|
|
13764
|
+
(listed.length > 0 || markers.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "uix-visually-hidden", children: [
|
|
13765
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("p", { id: `${id}-windows`, children: labels.windows }),
|
|
13766
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("ul", { "aria-labelledby": `${id}-windows`, children: [
|
|
13767
|
+
listed.map((o, index) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("li", { children: o.accessibleName ?? /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_jsx_runtime94.Fragment, { children: [
|
|
13091
13768
|
o.kindLabel === void 0 && o.kind ? `${labels.overlays[o.kind]}: ${o.label}${o.scopeLabel ? `, ${o.scopeLabel}` : ""}` : overlayWords(o),
|
|
13092
13769
|
", ",
|
|
13093
13770
|
fmtInstant(o.start),
|
|
13094
13771
|
" \u2013 ",
|
|
13095
13772
|
fmtInstant(o.end)
|
|
13096
13773
|
] }) }, overlayKeys[index])),
|
|
13097
|
-
markers.map((m, index) => /* @__PURE__ */ (0,
|
|
13774
|
+
markers.map((m, index) => /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("li", { children: [
|
|
13098
13775
|
m.label,
|
|
13099
13776
|
", ",
|
|
13100
13777
|
fmtInstant(m.at)
|
|
13101
13778
|
] }, markerKeys[index]))
|
|
13102
13779
|
] })
|
|
13103
13780
|
] }),
|
|
13104
|
-
/* @__PURE__ */ (0,
|
|
13105
|
-
/* @__PURE__ */ (0,
|
|
13106
|
-
/* @__PURE__ */ (0,
|
|
13107
|
-
/* @__PURE__ */ (0,
|
|
13108
|
-
/* @__PURE__ */ (0,
|
|
13109
|
-
ticks.map((tick) => /* @__PURE__ */ (0,
|
|
13781
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { ref: setScroller, className: "uix-scheduling-timeline__scroller", "data-virtual": virtual || void 0, "data-scroll-y": maxHeight !== void 0 || void 0, style: maxHeight !== void 0 ? { maxHeight } : void 0, children: [
|
|
13782
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "uix-scheduling-timeline__grid", "data-sub-ticks": minorTicks.length > 0 || void 0, children: [
|
|
13783
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "uix-scheduling-timeline__row uix-scheduling-timeline__row--axis", "aria-hidden": "true", children: [
|
|
13784
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "uix-scheduling-timeline__lane-label", children: labels.lanes }),
|
|
13785
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "uix-scheduling-timeline__track uix-scheduling-timeline__axis", style: trackStyle, children: [
|
|
13786
|
+
ticks.map((tick) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__tick", "data-major": tick.major || void 0, style: { left: `${tick.offset}%` }, children: tick.offset < 100 && /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("span", { className: "uix-scheduling-timeline__tick-label", children: [
|
|
13110
13787
|
fmtTick(tick.at),
|
|
13111
|
-
tick.offsetLabel && /* @__PURE__ */ (0,
|
|
13788
|
+
tick.offsetLabel && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__tick-offset", children: tick.offsetLabel })
|
|
13112
13789
|
] }) }, tick.at)),
|
|
13113
|
-
minorTicks.map((tick) => /* @__PURE__ */ (0,
|
|
13790
|
+
minorTicks.map((tick) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__tick", "data-minor": "true", style: { left: `${tick.offset}%` }, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__tick-label", children: formatTick?.(new Date(tick.at), "hour") ?? tick.label }) }, `minor-${tick.at}`))
|
|
13114
13791
|
] })
|
|
13115
13792
|
] }),
|
|
13116
|
-
columnNoteList.length > 0 && /* @__PURE__ */ (0,
|
|
13117
|
-
/* @__PURE__ */ (0,
|
|
13118
|
-
/* @__PURE__ */ (0,
|
|
13793
|
+
columnNoteList.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "uix-scheduling-timeline__row uix-scheduling-timeline__row--notes", children: [
|
|
13794
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "uix-scheduling-timeline__lane-label" }),
|
|
13795
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "uix-scheduling-timeline__track", style: trackStyle, children: columnNoteList.map(({ date, node, pos }) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "uix-scheduling-timeline__column-note", "data-date": date, style: { left: `${pos.left}%`, width: `${pos.width}%` }, children: node }, date)) })
|
|
13119
13796
|
] }),
|
|
13120
|
-
/* @__PURE__ */ (0,
|
|
13797
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
13121
13798
|
"div",
|
|
13122
13799
|
{
|
|
13123
13800
|
ref: bodyRef,
|
|
@@ -13127,15 +13804,15 @@ function SchedulingTimeline({
|
|
|
13127
13804
|
if (!event.currentTarget.contains(event.relatedTarget)) setFocusRowKey(null);
|
|
13128
13805
|
},
|
|
13129
13806
|
children: [
|
|
13130
|
-
/* @__PURE__ */ (0,
|
|
13131
|
-
/* @__PURE__ */ (0,
|
|
13132
|
-
/* @__PURE__ */ (0,
|
|
13133
|
-
/* @__PURE__ */ (0,
|
|
13134
|
-
ticks.map((tick) => /* @__PURE__ */ (0,
|
|
13135
|
-
minorTicks.map((tick) => /* @__PURE__ */ (0,
|
|
13807
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "uix-scheduling-timeline__layer", children: [
|
|
13808
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "uix-scheduling-timeline__lane-label", "aria-hidden": "true" }),
|
|
13809
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { ref: setLayerTrack, className: "uix-scheduling-timeline__track", style: trackStyle, children: [
|
|
13810
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { ref: barMinRef, className: "uix-scheduling-timeline__bar-min", "aria-hidden": "true" }),
|
|
13811
|
+
ticks.map((tick) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__gridline", "data-major": tick.major || void 0, style: { left: `${tick.offset}%` }, "aria-hidden": "true" }, tick.at)),
|
|
13812
|
+
minorTicks.map((tick) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__gridline", "data-minor": "true", style: { left: `${tick.offset}%` }, "aria-hidden": "true" }, `minor-${tick.at}`)),
|
|
13136
13813
|
overlays.map((overlay, index) => inLayer(overlay) ? renderOverlay(overlay, overlayKeys[index], scopeOf(lanesOf(overlay))) : null),
|
|
13137
13814
|
markers.map((marker, index) => inLayer(marker) ? renderMarker2(marker, markerKeys[index], scopeOf(lanesOf(marker))) : null),
|
|
13138
|
-
nowPos && /* @__PURE__ */ (0,
|
|
13815
|
+
nowPos && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__now", style: { left: `${nowPos.left}%` }, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-scheduling-timeline__now-label", children: labels.now }) })
|
|
13139
13816
|
] })
|
|
13140
13817
|
] }),
|
|
13141
13818
|
body
|
|
@@ -13143,23 +13820,23 @@ function SchedulingTimeline({
|
|
|
13143
13820
|
}
|
|
13144
13821
|
)
|
|
13145
13822
|
] }),
|
|
13146
|
-
virtual && /* @__PURE__ */ (0,
|
|
13147
|
-
/* @__PURE__ */ (0,
|
|
13148
|
-
/* @__PURE__ */ (0,
|
|
13149
|
-
/* @__PURE__ */ (0,
|
|
13823
|
+
virtual && /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("span", { ref: probeRef, className: "uix-scheduling-timeline__probe", "aria-hidden": "true", children: [
|
|
13824
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", {}),
|
|
13825
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", {}),
|
|
13826
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", {})
|
|
13150
13827
|
] })
|
|
13151
13828
|
] }),
|
|
13152
|
-
nothingToShow && /* @__PURE__ */ (0,
|
|
13829
|
+
nothingToShow && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("p", { className: "uix-scheduling-timeline__empty", children: labels.empty })
|
|
13153
13830
|
] }),
|
|
13154
|
-
hint && /* @__PURE__ */ (0,
|
|
13155
|
-
/* @__PURE__ */ (0,
|
|
13831
|
+
hint && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { id: hintId, className: "uix-visually-hidden", children: hint }),
|
|
13832
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "uix-visually-hidden", role: "status", "aria-live": "polite", children: announcement })
|
|
13156
13833
|
]
|
|
13157
13834
|
}
|
|
13158
13835
|
);
|
|
13159
13836
|
}
|
|
13160
13837
|
|
|
13161
13838
|
// src/components/DateRangePicker.tsx
|
|
13162
|
-
var
|
|
13839
|
+
var import_react71 = require("react");
|
|
13163
13840
|
|
|
13164
13841
|
// src/date-field-model.ts
|
|
13165
13842
|
var pad = (n, width = 2) => String(n).padStart(width, "0");
|
|
@@ -13233,8 +13910,8 @@ function timeZoneName(timeZone, date, locale) {
|
|
|
13233
13910
|
}
|
|
13234
13911
|
|
|
13235
13912
|
// src/components/DateFieldParts.tsx
|
|
13236
|
-
var
|
|
13237
|
-
var
|
|
13913
|
+
var import_react70 = require("react");
|
|
13914
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
13238
13915
|
var localDateKey = (now = /* @__PURE__ */ new Date()) => `${now.getFullYear().toString().padStart(4, "0")}-${(now.getMonth() + 1).toString().padStart(2, "0")}-${now.getDate().toString().padStart(2, "0")}`;
|
|
13239
13916
|
var utc = (date) => /* @__PURE__ */ new Date(`${date}T00:00:00Z`);
|
|
13240
13917
|
var monthLabel = (date, locale) => new Intl.DateTimeFormat(locale, { month: "long", year: "numeric", timeZone: "UTC" }).format(utc(date));
|
|
@@ -13251,15 +13928,15 @@ var isOpen = (el) => {
|
|
|
13251
13928
|
}
|
|
13252
13929
|
};
|
|
13253
13930
|
function useFieldPopover(popoverId, restoreFocus, onOpenChange) {
|
|
13254
|
-
const [open, setOpen] = (0,
|
|
13255
|
-
const pointerWasOpen = (0,
|
|
13256
|
-
const restoreRef = (0,
|
|
13931
|
+
const [open, setOpen] = (0, import_react70.useState)(false);
|
|
13932
|
+
const pointerWasOpen = (0, import_react70.useRef)(null);
|
|
13933
|
+
const restoreRef = (0, import_react70.useRef)(restoreFocus);
|
|
13257
13934
|
restoreRef.current = restoreFocus;
|
|
13258
|
-
const onOpenChangeRef = (0,
|
|
13935
|
+
const onOpenChangeRef = (0, import_react70.useRef)(onOpenChange);
|
|
13259
13936
|
onOpenChangeRef.current = onOpenChange;
|
|
13260
|
-
const skipRestore = (0,
|
|
13937
|
+
const skipRestore = (0, import_react70.useRef)(false);
|
|
13261
13938
|
const popoverEl = () => typeof document === "undefined" ? null : document.getElementById(popoverId);
|
|
13262
|
-
(0,
|
|
13939
|
+
(0, import_react70.useEffect)(() => {
|
|
13263
13940
|
const el = popoverEl();
|
|
13264
13941
|
if (!el) return;
|
|
13265
13942
|
const onToggle = (event) => {
|
|
@@ -13343,14 +14020,14 @@ function MonthCalendar({
|
|
|
13343
14020
|
autoFocus = false
|
|
13344
14021
|
}) {
|
|
13345
14022
|
const clamp3 = (date) => min && date < min ? min : max && date > max ? max : date;
|
|
13346
|
-
const [active, setActive] = (0,
|
|
13347
|
-
const gridRef = (0,
|
|
13348
|
-
const pendingFocus = (0,
|
|
14023
|
+
const [active, setActive] = (0, import_react70.useState)(() => clamp3(initialDate));
|
|
14024
|
+
const gridRef = (0, import_react70.useRef)(null);
|
|
14025
|
+
const pendingFocus = (0, import_react70.useRef)(autoFocus);
|
|
13349
14026
|
const month = startOfMonth(active);
|
|
13350
|
-
const days = (0,
|
|
14027
|
+
const days = (0, import_react70.useMemo)(() => buildMonthGrid(month, weekStartsOn).filter((day) => day.inMonth), [month, weekStartsOn]);
|
|
13351
14028
|
const blanks = (utc(month).getUTCDay() - weekStartsOn + 7) % 7;
|
|
13352
|
-
const weekdays = (0,
|
|
13353
|
-
(0,
|
|
14029
|
+
const weekdays = (0, import_react70.useMemo)(() => weekdayNames(locale, weekStartsOn), [locale, weekStartsOn]);
|
|
14030
|
+
(0, import_react70.useEffect)(() => {
|
|
13354
14031
|
if (!pendingFocus.current) return;
|
|
13355
14032
|
pendingFocus.current = false;
|
|
13356
14033
|
gridRef.current?.querySelector(`[data-date="${active}"]`)?.focus({ preventScroll: true });
|
|
@@ -13378,22 +14055,22 @@ function MonthCalendar({
|
|
|
13378
14055
|
};
|
|
13379
14056
|
const atMin = !!min && month <= startOfMonth(min);
|
|
13380
14057
|
const atMax = !!max && month >= startOfMonth(max);
|
|
13381
|
-
return /* @__PURE__ */ (0,
|
|
13382
|
-
/* @__PURE__ */ (0,
|
|
13383
|
-
/* @__PURE__ */ (0,
|
|
14058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: "uix-date-picker__calendar", children: [
|
|
14059
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: "uix-date-picker__nav", children: [
|
|
14060
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("button", { type: "button", className: "uix-date-picker__nav-btn", "aria-label": labels.previousMonth, "aria-disabled": atMin || void 0, onClick: () => {
|
|
13384
14061
|
if (!atMin) showMonth(-1);
|
|
13385
|
-
}, children: /* @__PURE__ */ (0,
|
|
13386
|
-
/* @__PURE__ */ (0,
|
|
13387
|
-
/* @__PURE__ */ (0,
|
|
14062
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(ChevronLeftIcon, { size: "sm" }) }),
|
|
14063
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "uix-date-picker__month", "aria-live": "polite", children: monthLabel(month, locale) }),
|
|
14064
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("button", { type: "button", className: "uix-date-picker__nav-btn", "aria-label": labels.nextMonth, "aria-disabled": atMax || void 0, onClick: () => {
|
|
13388
14065
|
if (!atMax) showMonth(1);
|
|
13389
|
-
}, children: /* @__PURE__ */ (0,
|
|
14066
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(ChevronRightIcon, { size: "sm" }) })
|
|
13390
14067
|
] }),
|
|
13391
|
-
/* @__PURE__ */ (0,
|
|
13392
|
-
/* @__PURE__ */ (0,
|
|
13393
|
-
Array.from({ length: blanks }, (_, index) => /* @__PURE__ */ (0,
|
|
14068
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "uix-date-range-picker__weekdays", "aria-hidden": "true", children: weekdays.map((day, index) => /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { children: day }, index)) }),
|
|
14069
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { ref: gridRef, className: "uix-date-range-picker__grid uix-date-picker__grid", role: "group", "aria-label": monthLabel(month, locale), children: [
|
|
14070
|
+
Array.from({ length: blanks }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { "aria-hidden": "true" }, `blank-${index}`)),
|
|
13394
14071
|
days.map((day) => {
|
|
13395
14072
|
const off = unavailable(day.date);
|
|
13396
|
-
return /* @__PURE__ */ (0,
|
|
14073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
13397
14074
|
"button",
|
|
13398
14075
|
{
|
|
13399
14076
|
type: "button",
|
|
@@ -13419,7 +14096,7 @@ function MonthCalendar({
|
|
|
13419
14096
|
}
|
|
13420
14097
|
|
|
13421
14098
|
// src/components/DateRangePicker.tsx
|
|
13422
|
-
var
|
|
14099
|
+
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
13423
14100
|
var DEFAULT_DATE_RANGE_PICKER_LABELS = {
|
|
13424
14101
|
previous: "Previous",
|
|
13425
14102
|
previousMonth: "Show previous month",
|
|
@@ -13457,27 +14134,27 @@ function RangeCalendar({
|
|
|
13457
14134
|
weekStartsOn = 1,
|
|
13458
14135
|
autoFocus = false
|
|
13459
14136
|
}) {
|
|
13460
|
-
const id = (0,
|
|
13461
|
-
const weekdays = (0,
|
|
13462
|
-
const [internalMonth, setInternalMonth] = (0,
|
|
14137
|
+
const id = (0, import_react71.useId)();
|
|
14138
|
+
const weekdays = (0, import_react71.useMemo)(() => weekdayNames(locale, weekStartsOn), [locale, weekStartsOn]);
|
|
14139
|
+
const [internalMonth, setInternalMonth] = (0, import_react71.useState)(() => startOfMonth(controlledMonth ?? value.start ?? (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)));
|
|
13463
14140
|
const visibleMonth = startOfMonth(controlledMonth ?? internalMonth);
|
|
13464
|
-
const [activeDate, setActiveDate] = (0,
|
|
13465
|
-
const rootRef = (0,
|
|
13466
|
-
const pendingFocus = (0,
|
|
14141
|
+
const [activeDate, setActiveDate] = (0, import_react71.useState)(value.end ?? value.start ?? visibleMonth);
|
|
14142
|
+
const rootRef = (0, import_react71.useRef)(null);
|
|
14143
|
+
const pendingFocus = (0, import_react71.useRef)(autoFocus);
|
|
13467
14144
|
const count2 = Math.max(1, Math.min(3, months));
|
|
13468
|
-
const calendars = (0,
|
|
14145
|
+
const calendars = (0, import_react71.useMemo)(() => Array.from({ length: count2 }, (_, index) => {
|
|
13469
14146
|
const month = startOfMonth(addCalendarMonths(visibleMonth, index));
|
|
13470
14147
|
return { month, days: buildMonthGrid(month).filter((day) => day.inMonth) };
|
|
13471
14148
|
}), [visibleMonth, count2]);
|
|
13472
14149
|
const todayDate = today === void 0 ? localDateKey() : today;
|
|
13473
14150
|
const rangeInvalid = invalid || !!value.start && !!value.end && value.start > value.end;
|
|
13474
|
-
(0,
|
|
14151
|
+
(0, import_react71.useEffect)(() => {
|
|
13475
14152
|
const first = calendars[0]?.days[0]?.date;
|
|
13476
14153
|
const finalDays = calendars[calendars.length - 1]?.days;
|
|
13477
14154
|
const last = finalDays?.[finalDays.length - 1]?.date;
|
|
13478
14155
|
if (first && last && (activeDate < first || activeDate > last)) setActiveDate(first);
|
|
13479
14156
|
}, [activeDate, calendars]);
|
|
13480
|
-
(0,
|
|
14157
|
+
(0, import_react71.useEffect)(() => {
|
|
13481
14158
|
if (!pendingFocus.current) return;
|
|
13482
14159
|
rootRef.current?.querySelector(`[data-date="${activeDate}"]`)?.focus({ preventScroll: autoFocus });
|
|
13483
14160
|
pendingFocus.current = false;
|
|
@@ -13515,23 +14192,23 @@ function RangeCalendar({
|
|
|
13515
14192
|
}
|
|
13516
14193
|
};
|
|
13517
14194
|
const announcement = !value.start ? labels.noneSelected : !value.end ? labels.startSelected.replace("{start}", dateLabel(value.start, locale)) : labels.rangeSelected.replace("{start}", dateLabel(value.start, locale)).replace("{end}", dateLabel(value.end, locale));
|
|
13518
|
-
return /* @__PURE__ */ (0,
|
|
13519
|
-
/* @__PURE__ */ (0,
|
|
13520
|
-
/* @__PURE__ */ (0,
|
|
13521
|
-
/* @__PURE__ */ (0,
|
|
13522
|
-
/* @__PURE__ */ (0,
|
|
13523
|
-
/* @__PURE__ */ (0,
|
|
14195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("section", { className: cx("uix-date-range-picker", rangeInvalid && "uix-date-range-picker--invalid", className), "aria-labelledby": `${id}-label`, children: [
|
|
14196
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("div", { className: "uix-date-range-picker__header", children: [
|
|
14197
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("h3", { id: `${id}-label`, children: label }),
|
|
14198
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("div", { children: [
|
|
14199
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("button", { type: "button", className: "uix-btn uix-btn--ghost uix-btn--sm", onClick: () => setMonth(addCalendarMonths(visibleMonth, -1)), "aria-label": labels.previousMonth, children: labels.previous }),
|
|
14200
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("button", { type: "button", className: "uix-btn uix-btn--ghost uix-btn--sm", onClick: () => setMonth(addCalendarMonths(visibleMonth, 1)), "aria-label": labels.nextMonth, children: labels.next })
|
|
13524
14201
|
] })
|
|
13525
14202
|
] }),
|
|
13526
|
-
/* @__PURE__ */ (0,
|
|
13527
|
-
/* @__PURE__ */ (0,
|
|
13528
|
-
/* @__PURE__ */ (0,
|
|
13529
|
-
/* @__PURE__ */ (0,
|
|
13530
|
-
Array.from({ length: ((/* @__PURE__ */ new Date(`${month}T00:00:00Z`)).getUTCDay() - weekStartsOn + 7) % 7 }, (_, index) => /* @__PURE__ */ (0,
|
|
14203
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { ref: rootRef, className: "uix-date-range-picker__months", children: calendars.map(({ month, days }) => /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("div", { className: "uix-date-range-picker__month", children: [
|
|
14204
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("h4", { children: monthLabel2(month, locale) }),
|
|
14205
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "uix-date-range-picker__weekdays", "aria-hidden": "true", children: weekdays.map((day, index) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { children: day }, index)) }),
|
|
14206
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("div", { className: "uix-date-range-picker__grid", role: "group", "aria-label": monthLabel2(month, locale), children: [
|
|
14207
|
+
Array.from({ length: ((/* @__PURE__ */ new Date(`${month}T00:00:00Z`)).getUTCDay() - weekStartsOn + 7) % 7 }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { "aria-hidden": "true" }, `blank-${index}`)),
|
|
13531
14208
|
days.map((day) => {
|
|
13532
14209
|
const unavailable = disabled || isDateUnavailable(day.date, { min, max, isDisabled: isDateDisabled });
|
|
13533
14210
|
const edge = day.date === value.start ? "start" : day.date === value.end ? "end" : void 0;
|
|
13534
|
-
return /* @__PURE__ */ (0,
|
|
14211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
13535
14212
|
"button",
|
|
13536
14213
|
{
|
|
13537
14214
|
type: "button",
|
|
@@ -13553,15 +14230,15 @@ function RangeCalendar({
|
|
|
13553
14230
|
})
|
|
13554
14231
|
] })
|
|
13555
14232
|
] }, month)) }),
|
|
13556
|
-
/* @__PURE__ */ (0,
|
|
13557
|
-
rangeInvalid && /* @__PURE__ */ (0,
|
|
14233
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("p", { className: "uix-date-range-picker__selection", "aria-live": "polite", children: announcement }),
|
|
14234
|
+
rangeInvalid && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("p", { className: "uix-field__error", role: "alert", children: invalidMessage })
|
|
13558
14235
|
] });
|
|
13559
14236
|
}
|
|
13560
14237
|
function DateRangePicker({ labels: labelOverrides, ...props }) {
|
|
13561
14238
|
const uixLabels = useUixLabels();
|
|
13562
14239
|
const words = { ...DEFAULT_DATE_RANGE_PICKER_LABELS, ...uixLabels.dateRangePicker, ...labelOverrides };
|
|
13563
|
-
if (props.mode === "field") return /* @__PURE__ */ (0,
|
|
13564
|
-
return /* @__PURE__ */ (0,
|
|
14240
|
+
if (props.mode === "field") return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(DateRangeField, { ...props, words });
|
|
14241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(RangeCalendar, { ...props, words });
|
|
13565
14242
|
}
|
|
13566
14243
|
function DateRangeField(props) {
|
|
13567
14244
|
const {
|
|
@@ -13581,22 +14258,22 @@ function DateRangeField(props) {
|
|
|
13581
14258
|
"aria-describedby": ariaDescribedBy,
|
|
13582
14259
|
"aria-invalid": ariaInvalid
|
|
13583
14260
|
} = props;
|
|
13584
|
-
const uid = (0,
|
|
14261
|
+
const uid = (0, import_react71.useId)();
|
|
13585
14262
|
const id = idProp ?? `${uid}-trigger`;
|
|
13586
14263
|
const popoverId = `${uid}-months`;
|
|
13587
14264
|
const valueId = `${uid}-value`;
|
|
13588
|
-
const anchorRef = (0,
|
|
13589
|
-
const triggerRef = (0,
|
|
14265
|
+
const anchorRef = (0, import_react71.useRef)(null);
|
|
14266
|
+
const triggerRef = (0, import_react71.useRef)(null);
|
|
13590
14267
|
const { open, hide, triggerProps } = useFieldPopover(popoverId, () => triggerRef.current?.focus({ preventScroll: true }), onOpenChange);
|
|
13591
|
-
const [labelled, setLabelled] = (0,
|
|
13592
|
-
(0,
|
|
14268
|
+
const [labelled, setLabelled] = (0, import_react71.useState)(false);
|
|
14269
|
+
(0, import_react71.useEffect)(() => {
|
|
13593
14270
|
setLabelled((triggerRef.current?.labels?.length ?? 0) > 0);
|
|
13594
14271
|
}, [id]);
|
|
13595
14272
|
const format = (date) => formatDate?.(date) ?? formatDateKey(date, locale);
|
|
13596
14273
|
const text = !value.start ? null : !value.end ? words.fieldStart.replace("{start}", format(value.start)) : words.fieldRange.replace("{start}", format(value.start)).replace("{end}", format(value.end));
|
|
13597
14274
|
const rangeInvalid = invalid || !!value.start && !!value.end && value.start > value.end;
|
|
13598
14275
|
const describedBy = [ariaDescribedBy, labelled && text ? valueId : void 0].filter(Boolean).join(" ") || void 0;
|
|
13599
|
-
return /* @__PURE__ */ (0,
|
|
14276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
|
|
13600
14277
|
"div",
|
|
13601
14278
|
{
|
|
13602
14279
|
ref: anchorRef,
|
|
@@ -13608,7 +14285,7 @@ function DateRangeField(props) {
|
|
|
13608
14285
|
hide();
|
|
13609
14286
|
},
|
|
13610
14287
|
children: [
|
|
13611
|
-
/* @__PURE__ */ (0,
|
|
14288
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
|
|
13612
14289
|
"button",
|
|
13613
14290
|
{
|
|
13614
14291
|
ref: triggerRef,
|
|
@@ -13620,16 +14297,16 @@ function DateRangeField(props) {
|
|
|
13620
14297
|
"aria-invalid": rangeInvalid || ariaInvalid === true || ariaInvalid === "true" || void 0,
|
|
13621
14298
|
...triggerProps,
|
|
13622
14299
|
children: [
|
|
13623
|
-
/* @__PURE__ */ (0,
|
|
13624
|
-
/* @__PURE__ */ (0,
|
|
14300
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { className: "uix-date-range-field__icon", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(CalendarIcon, { size: "sm" }) }),
|
|
14301
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("span", { className: "uix-visually-hidden", children: [
|
|
13625
14302
|
label,
|
|
13626
14303
|
": "
|
|
13627
14304
|
] }),
|
|
13628
|
-
/* @__PURE__ */ (0,
|
|
14305
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { id: valueId, className: cx("uix-date-range-field__value", !text && "uix-date-range-field__value--empty"), children: text ?? words.placeholder })
|
|
13629
14306
|
]
|
|
13630
14307
|
}
|
|
13631
14308
|
),
|
|
13632
|
-
/* @__PURE__ */ (0,
|
|
14309
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
13633
14310
|
Popover,
|
|
13634
14311
|
{
|
|
13635
14312
|
id: popoverId,
|
|
@@ -13640,7 +14317,7 @@ function DateRangeField(props) {
|
|
|
13640
14317
|
"aria-label": label,
|
|
13641
14318
|
capHeight: true,
|
|
13642
14319
|
closeWhenAnchorHidden: true,
|
|
13643
|
-
children: open && /* @__PURE__ */ (0,
|
|
14320
|
+
children: open && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
13644
14321
|
RangeCalendar,
|
|
13645
14322
|
{
|
|
13646
14323
|
...props,
|
|
@@ -13660,8 +14337,8 @@ function DateRangeField(props) {
|
|
|
13660
14337
|
}
|
|
13661
14338
|
|
|
13662
14339
|
// src/components/DatePicker.tsx
|
|
13663
|
-
var
|
|
13664
|
-
var
|
|
14340
|
+
var import_react72 = require("react");
|
|
14341
|
+
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
13665
14342
|
var DEFAULT_DATE_PICKER_LABELS = {
|
|
13666
14343
|
open: "Choose date",
|
|
13667
14344
|
openSelected: "Change date, {date}",
|
|
@@ -13672,7 +14349,7 @@ var DEFAULT_DATE_PICKER_LABELS = {
|
|
|
13672
14349
|
notADate: "That is not a date.",
|
|
13673
14350
|
unavailable: "That date is not available."
|
|
13674
14351
|
};
|
|
13675
|
-
var DatePicker = (0,
|
|
14352
|
+
var DatePicker = (0, import_react72.forwardRef)(function DatePicker2({
|
|
13676
14353
|
value,
|
|
13677
14354
|
onValueChange,
|
|
13678
14355
|
min,
|
|
@@ -13703,18 +14380,18 @@ var DatePicker = (0, import_react71.forwardRef)(function DatePicker2({
|
|
|
13703
14380
|
className,
|
|
13704
14381
|
style
|
|
13705
14382
|
}, forwardedRef) {
|
|
13706
|
-
const uid = (0,
|
|
14383
|
+
const uid = (0, import_react72.useId)();
|
|
13707
14384
|
const id = idProp ?? `${uid}-input`;
|
|
13708
14385
|
const popoverId = `${uid}-calendar`;
|
|
13709
14386
|
const errorId = `${uid}-error`;
|
|
13710
14387
|
const labels = { ...DEFAULT_DATE_PICKER_LABELS, ...useUixLabels().datePicker, ...labelOverrides };
|
|
13711
|
-
const anchorRef = (0,
|
|
13712
|
-
const inputRef = (0,
|
|
13713
|
-
(0,
|
|
14388
|
+
const anchorRef = (0, import_react72.useRef)(null);
|
|
14389
|
+
const inputRef = (0, import_react72.useRef)(null);
|
|
14390
|
+
(0, import_react72.useImperativeHandle)(forwardedRef, () => inputRef.current);
|
|
13714
14391
|
const format = (date) => formatDate?.(date) ?? formatDateKey(date, locale);
|
|
13715
|
-
const [text, setText] = (0,
|
|
13716
|
-
const [problem, setProblemState] = (0,
|
|
13717
|
-
const reported = (0,
|
|
14392
|
+
const [text, setText] = (0, import_react72.useState)(() => value ? format(value) : "");
|
|
14393
|
+
const [problem, setProblemState] = (0, import_react72.useState)(null);
|
|
14394
|
+
const reported = (0, import_react72.useRef)(null);
|
|
13718
14395
|
const setProblem = (next) => {
|
|
13719
14396
|
if (next !== reported.current) {
|
|
13720
14397
|
reported.current = next;
|
|
@@ -13722,7 +14399,7 @@ var DatePicker = (0, import_react71.forwardRef)(function DatePicker2({
|
|
|
13722
14399
|
}
|
|
13723
14400
|
setProblemState(next);
|
|
13724
14401
|
};
|
|
13725
|
-
(0,
|
|
14402
|
+
(0, import_react72.useEffect)(() => {
|
|
13726
14403
|
setText(value ? format(value) : "");
|
|
13727
14404
|
setProblem(null);
|
|
13728
14405
|
}, [value, locale]);
|
|
@@ -13776,7 +14453,7 @@ var DatePicker = (0, import_react71.forwardRef)(function DatePicker2({
|
|
|
13776
14453
|
const expected = placeholder ?? (parseDate ? null : pattern);
|
|
13777
14454
|
const describedBy = [ariaDescribedBy, problem ? errorId : void 0].filter(Boolean).join(" ") || void 0;
|
|
13778
14455
|
const isInvalid = !!invalid || !!problem || ariaInvalid === true || ariaInvalid === "true";
|
|
13779
|
-
return /* @__PURE__ */ (0,
|
|
14456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
13780
14457
|
"div",
|
|
13781
14458
|
{
|
|
13782
14459
|
ref: anchorRef,
|
|
@@ -13789,8 +14466,8 @@ var DatePicker = (0, import_react71.forwardRef)(function DatePicker2({
|
|
|
13789
14466
|
hide();
|
|
13790
14467
|
},
|
|
13791
14468
|
children: [
|
|
13792
|
-
/* @__PURE__ */ (0,
|
|
13793
|
-
/* @__PURE__ */ (0,
|
|
14469
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "uix-date-picker__control", children: [
|
|
14470
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
13794
14471
|
"input",
|
|
13795
14472
|
{
|
|
13796
14473
|
ref: inputRef,
|
|
@@ -13819,7 +14496,7 @@ var DatePicker = (0, import_react71.forwardRef)(function DatePicker2({
|
|
|
13819
14496
|
onKeyDown: onInputKeyDown
|
|
13820
14497
|
}
|
|
13821
14498
|
),
|
|
13822
|
-
/* @__PURE__ */ (0,
|
|
14499
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
13823
14500
|
"button",
|
|
13824
14501
|
{
|
|
13825
14502
|
type: "button",
|
|
@@ -13827,13 +14504,13 @@ var DatePicker = (0, import_react71.forwardRef)(function DatePicker2({
|
|
|
13827
14504
|
disabled: locked,
|
|
13828
14505
|
"aria-label": value && isValidDateKey(value) ? fillLabel(labels.openSelected, { date: fullDateLabel(value, locale) }) : labels.open,
|
|
13829
14506
|
...triggerProps,
|
|
13830
|
-
children: /* @__PURE__ */ (0,
|
|
14507
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(CalendarIcon, { size: "sm" })
|
|
13831
14508
|
}
|
|
13832
14509
|
)
|
|
13833
14510
|
] }),
|
|
13834
|
-
name && /* @__PURE__ */ (0,
|
|
13835
|
-
problem && /* @__PURE__ */ (0,
|
|
13836
|
-
/* @__PURE__ */ (0,
|
|
14511
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("input", { type: "hidden", name, value: value ?? "", disabled }),
|
|
14512
|
+
problem && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { id: errorId, className: "uix-field__error uix-date-picker__error", role: "alert", children: problem !== "format" ? labels.unavailable : expected ? fillLabel(labels.invalidDate, { pattern: expected }) : labels.notADate }),
|
|
14513
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
13837
14514
|
Popover,
|
|
13838
14515
|
{
|
|
13839
14516
|
id: popoverId,
|
|
@@ -13843,7 +14520,7 @@ var DatePicker = (0, import_react71.forwardRef)(function DatePicker2({
|
|
|
13843
14520
|
role: "dialog",
|
|
13844
14521
|
"aria-label": labels.calendar,
|
|
13845
14522
|
closeWhenAnchorHidden: true,
|
|
13846
|
-
children: open && /* @__PURE__ */ (0,
|
|
14523
|
+
children: open && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
13847
14524
|
MonthCalendar,
|
|
13848
14525
|
{
|
|
13849
14526
|
value,
|
|
@@ -13872,7 +14549,7 @@ var DEFAULT_DATE_TIME_PICKER_LABELS = {
|
|
|
13872
14549
|
timeOf: "{label}, time",
|
|
13873
14550
|
timeZone: "Time zone: {zone}"
|
|
13874
14551
|
};
|
|
13875
|
-
var DateTimePicker = (0,
|
|
14552
|
+
var DateTimePicker = (0, import_react72.forwardRef)(function DateTimePicker2({
|
|
13876
14553
|
value,
|
|
13877
14554
|
onValueChange,
|
|
13878
14555
|
timeZone,
|
|
@@ -13896,19 +14573,19 @@ var DateTimePicker = (0, import_react71.forwardRef)(function DateTimePicker2({
|
|
|
13896
14573
|
style,
|
|
13897
14574
|
...dateProps
|
|
13898
14575
|
}, forwardedRef) {
|
|
13899
|
-
const uid = (0,
|
|
14576
|
+
const uid = (0, import_react72.useId)();
|
|
13900
14577
|
const id = idProp ?? `${uid}-date`;
|
|
13901
14578
|
const zoneId = `${uid}-zone`;
|
|
13902
14579
|
const labels = { ...DEFAULT_DATE_TIME_PICKER_LABELS, ...useUixLabels().dateTimePicker, ...labelOverrides };
|
|
13903
14580
|
const { date, time } = splitDateTime(value);
|
|
13904
|
-
const dateRef = (0,
|
|
13905
|
-
(0,
|
|
13906
|
-
const [pendingTime, setPendingTime] = (0,
|
|
14581
|
+
const dateRef = (0, import_react72.useRef)(null);
|
|
14582
|
+
(0, import_react72.useImperativeHandle)(forwardedRef, () => dateRef.current);
|
|
14583
|
+
const [pendingTime, setPendingTime] = (0, import_react72.useState)("");
|
|
13907
14584
|
const shownTime = date ? time : pendingTime;
|
|
13908
|
-
const [fieldLabel, setFieldLabel] = (0,
|
|
13909
|
-
const [viewerZone, setViewerZone] = (0,
|
|
14585
|
+
const [fieldLabel, setFieldLabel] = (0, import_react72.useState)("");
|
|
14586
|
+
const [viewerZone, setViewerZone] = (0, import_react72.useState)(null);
|
|
13910
14587
|
const grouped = !!ariaLabel || !!ariaLabelledBy;
|
|
13911
|
-
(0,
|
|
14588
|
+
(0, import_react72.useEffect)(() => {
|
|
13912
14589
|
if (!grouped) setFieldLabel(dateRef.current?.labels?.[0]?.textContent?.trim() ?? "");
|
|
13913
14590
|
if (!timeZone) {
|
|
13914
14591
|
try {
|
|
@@ -13921,7 +14598,7 @@ var DateTimePicker = (0, import_react71.forwardRef)(function DateTimePicker2({
|
|
|
13921
14598
|
const zoneText = timeZoneLabel === null ? null : timeZoneLabel ?? (zone ? timeZoneName(zone, date, locale) : null);
|
|
13922
14599
|
const timeName = grouped ? labels.time : fieldLabel ? fillLabel(labels.timeOf, { label: fieldLabel }) : labels.time;
|
|
13923
14600
|
const step = Math.max(1, Math.round(minuteStep)) * 60;
|
|
13924
|
-
return /* @__PURE__ */ (0,
|
|
14601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
13925
14602
|
"div",
|
|
13926
14603
|
{
|
|
13927
14604
|
className: cx("uix-date-time-picker", size === "sm" && "uix-date-time-picker--sm", className),
|
|
@@ -13930,7 +14607,7 @@ var DateTimePicker = (0, import_react71.forwardRef)(function DateTimePicker2({
|
|
|
13930
14607
|
"aria-label": ariaLabel,
|
|
13931
14608
|
"aria-labelledby": ariaLabelledBy,
|
|
13932
14609
|
children: [
|
|
13933
|
-
/* @__PURE__ */ (0,
|
|
14610
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
13934
14611
|
DatePicker,
|
|
13935
14612
|
{
|
|
13936
14613
|
...dateProps,
|
|
@@ -13957,7 +14634,7 @@ var DateTimePicker = (0, import_react71.forwardRef)(function DateTimePicker2({
|
|
|
13957
14634
|
}
|
|
13958
14635
|
}
|
|
13959
14636
|
),
|
|
13960
|
-
/* @__PURE__ */ (0,
|
|
14637
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
13961
14638
|
"input",
|
|
13962
14639
|
{
|
|
13963
14640
|
type: "time",
|
|
@@ -13976,18 +14653,18 @@ var DateTimePicker = (0, import_react71.forwardRef)(function DateTimePicker2({
|
|
|
13976
14653
|
}
|
|
13977
14654
|
}
|
|
13978
14655
|
),
|
|
13979
|
-
zoneText && /* @__PURE__ */ (0,
|
|
13980
|
-
/* @__PURE__ */ (0,
|
|
13981
|
-
/* @__PURE__ */ (0,
|
|
14656
|
+
zoneText && /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("span", { className: "uix-date-time-picker__zone", children: [
|
|
14657
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { "aria-hidden": "true", children: zoneText }),
|
|
14658
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { id: zoneId, className: "uix-visually-hidden", children: fillLabel(labels.timeZone, { zone: zoneText }) })
|
|
13982
14659
|
] }),
|
|
13983
|
-
name && /* @__PURE__ */ (0,
|
|
14660
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("input", { type: "hidden", name, value: value ?? "", disabled })
|
|
13984
14661
|
]
|
|
13985
14662
|
}
|
|
13986
14663
|
);
|
|
13987
14664
|
});
|
|
13988
14665
|
|
|
13989
14666
|
// src/components/RelationshipGraph.tsx
|
|
13990
|
-
var
|
|
14667
|
+
var import_react74 = require("react");
|
|
13991
14668
|
|
|
13992
14669
|
// src/relationship-graph-model.ts
|
|
13993
14670
|
function boundRelationshipGraph(nodes, edges, maxNodes = 40) {
|
|
@@ -14468,10 +15145,10 @@ function layeredNeighbor(layout, currentId, key) {
|
|
|
14468
15145
|
}
|
|
14469
15146
|
|
|
14470
15147
|
// src/components/RelationshipGraphLayered.tsx
|
|
14471
|
-
var
|
|
15148
|
+
var import_react73 = require("react");
|
|
14472
15149
|
|
|
14473
15150
|
// src/components/RelationshipGraphList.tsx
|
|
14474
|
-
var
|
|
15151
|
+
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
14475
15152
|
function EquivalentRelationshipList({
|
|
14476
15153
|
nodes,
|
|
14477
15154
|
edges,
|
|
@@ -14482,19 +15159,19 @@ function EquivalentRelationshipList({
|
|
|
14482
15159
|
onOpenDetails
|
|
14483
15160
|
}) {
|
|
14484
15161
|
const labelById = new Map(nodes.map((node) => [node.id, node.label]));
|
|
14485
|
-
return /* @__PURE__ */ (0,
|
|
14486
|
-
/* @__PURE__ */ (0,
|
|
14487
|
-
/* @__PURE__ */ (0,
|
|
15162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: "uix-relationship-graph__list", role: "region", "aria-label": labels.list, children: [
|
|
15163
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("h3", { children: labels.listHeading }),
|
|
15164
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("ul", { children: nodes.map((node) => {
|
|
14488
15165
|
const neighbors = relationshipNeighbors(node.id, edges).map((id) => labelById.get(id) ?? id);
|
|
14489
|
-
return /* @__PURE__ */ (0,
|
|
14490
|
-
/* @__PURE__ */ (0,
|
|
14491
|
-
/* @__PURE__ */ (0,
|
|
14492
|
-
node.type && /* @__PURE__ */ (0,
|
|
14493
|
-
/* @__PURE__ */ (0,
|
|
15166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("li", { "data-selected": selectedId === node.id || void 0, children: [
|
|
15167
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("button", { type: "button", onClick: () => onSelect(node.id), "aria-pressed": selectedId === node.id, children: [
|
|
15168
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("strong", { children: node.label }),
|
|
15169
|
+
node.type && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { children: node.type }),
|
|
15170
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { children: neighbors.length ? labels.connectedTo(neighbors.join(", ")) : labels.noConnections })
|
|
14494
15171
|
] }),
|
|
14495
|
-
/* @__PURE__ */ (0,
|
|
14496
|
-
onExpandNeighbors && /* @__PURE__ */ (0,
|
|
14497
|
-
onOpenDetails && /* @__PURE__ */ (0,
|
|
15172
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("span", { className: "uix-relationship-graph__list-actions", children: [
|
|
15173
|
+
onExpandNeighbors && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("button", { type: "button", onClick: () => onExpandNeighbors(node), children: labels.expandNeighbors }),
|
|
15174
|
+
onOpenDetails && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("button", { type: "button", onClick: () => onOpenDetails(node), children: labels.openDetails })
|
|
14498
15175
|
] })
|
|
14499
15176
|
] }, node.id);
|
|
14500
15177
|
}) })
|
|
@@ -14502,16 +15179,16 @@ function EquivalentRelationshipList({
|
|
|
14502
15179
|
}
|
|
14503
15180
|
|
|
14504
15181
|
// src/components/RelationshipGraphLayered.tsx
|
|
14505
|
-
var
|
|
15182
|
+
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
14506
15183
|
var EMPTY_IDS2 = /* @__PURE__ */ new Set();
|
|
14507
|
-
var
|
|
14508
|
-
var
|
|
15184
|
+
var MIN_ZOOM2 = 0.4;
|
|
15185
|
+
var MAX_ZOOM2 = 1.5;
|
|
14509
15186
|
var READABLE_ZOOM = 0.75;
|
|
14510
15187
|
var ZOOM_STEP = 1.2;
|
|
14511
15188
|
var PAN_STEP = 64;
|
|
14512
15189
|
var FOCUS_MARGIN = 24;
|
|
14513
15190
|
var NAV_KEYS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Home", "End"];
|
|
14514
|
-
var
|
|
15191
|
+
var clampZoom2 = (zoom) => Math.min(MAX_ZOOM2, Math.max(MIN_ZOOM2, zoom));
|
|
14515
15192
|
function initialView(layout, size) {
|
|
14516
15193
|
if (size.width === 0 || size.height === 0 || layout.width === 0) return { x: 0, y: 0, zoom: 1 };
|
|
14517
15194
|
const fit = Math.min(size.width / layout.width, size.height / layout.height);
|
|
@@ -14521,7 +15198,7 @@ function initialView(layout, size) {
|
|
|
14521
15198
|
}
|
|
14522
15199
|
function fitView(layout, size) {
|
|
14523
15200
|
if (size.width === 0 || layout.width === 0) return { x: 0, y: 0, zoom: 1 };
|
|
14524
|
-
const zoom =
|
|
15201
|
+
const zoom = clampZoom2(Math.min(size.width / layout.width, size.height / layout.height, 1));
|
|
14525
15202
|
return { x: (size.width - layout.width * zoom) / 2, y: Math.max(0, (size.height - layout.height * zoom) / 2), zoom };
|
|
14526
15203
|
}
|
|
14527
15204
|
var arrowPoints = "0,0 -8,-4.5 -8,4.5";
|
|
@@ -14555,11 +15232,11 @@ function LayeredRelationshipGraph({
|
|
|
14555
15232
|
focusId,
|
|
14556
15233
|
onFocusChange
|
|
14557
15234
|
}) {
|
|
14558
|
-
const hintId = (0,
|
|
14559
|
-
const bounded = (0,
|
|
14560
|
-
const [localExpanded, setLocalExpanded] = (0,
|
|
15235
|
+
const hintId = (0, import_react73.useId)();
|
|
15236
|
+
const bounded = (0, import_react73.useMemo)(() => boundRelationshipGraph(nodes, edges, maxNodes), [nodes, edges, maxNodes]);
|
|
15237
|
+
const [localExpanded, setLocalExpanded] = (0, import_react73.useState)(EMPTY_IDS2);
|
|
14561
15238
|
const expanded = expandedClusterIds ?? localExpanded;
|
|
14562
|
-
const layout = (0,
|
|
15239
|
+
const layout = (0, import_react73.useMemo)(
|
|
14563
15240
|
() => layoutLayeredGraph(bounded.nodes, bounded.edges, {
|
|
14564
15241
|
...rootId !== void 0 ? { rootId } : {},
|
|
14565
15242
|
...clusterThreshold !== void 0 ? { clusterThreshold } : {},
|
|
@@ -14568,29 +15245,29 @@ function LayeredRelationshipGraph({
|
|
|
14568
15245
|
}),
|
|
14569
15246
|
[bounded, rootId, clusterThreshold, expanded, density]
|
|
14570
15247
|
);
|
|
14571
|
-
const itemById = (0,
|
|
14572
|
-
const viewportRef = (0,
|
|
14573
|
-
const itemRefs = (0,
|
|
14574
|
-
const [size, setSize] = (0,
|
|
14575
|
-
const [view, setView] = (0,
|
|
14576
|
-
const [animate, setAnimate] = (0,
|
|
14577
|
-
const [localFocus, setLocalFocus] = (0,
|
|
14578
|
-
const [hoverId, setHoverId] = (0,
|
|
14579
|
-
const viewRef = (0,
|
|
15248
|
+
const itemById = (0, import_react73.useMemo)(() => new Map(layout.items.map((item) => [item.id, item])), [layout]);
|
|
15249
|
+
const viewportRef = (0, import_react73.useRef)(null);
|
|
15250
|
+
const itemRefs = (0, import_react73.useRef)(/* @__PURE__ */ new Map());
|
|
15251
|
+
const [size, setSize] = (0, import_react73.useState)({ width: 0, height: 0 });
|
|
15252
|
+
const [view, setView] = (0, import_react73.useState)({ x: 0, y: 0, zoom: 1 });
|
|
15253
|
+
const [animate, setAnimate] = (0, import_react73.useState)(false);
|
|
15254
|
+
const [localFocus, setLocalFocus] = (0, import_react73.useState)(void 0);
|
|
15255
|
+
const [hoverId, setHoverId] = (0, import_react73.useState)(void 0);
|
|
15256
|
+
const viewRef = (0, import_react73.useRef)(view);
|
|
14580
15257
|
viewRef.current = view;
|
|
14581
|
-
const layoutRef = (0,
|
|
15258
|
+
const layoutRef = (0, import_react73.useRef)(layout);
|
|
14582
15259
|
layoutRef.current = layout;
|
|
14583
|
-
const pendingFocus = (0,
|
|
14584
|
-
const initialisedFor = (0,
|
|
15260
|
+
const pendingFocus = (0, import_react73.useRef)(void 0);
|
|
15261
|
+
const initialisedFor = (0, import_react73.useRef)(void 0);
|
|
14585
15262
|
const rootItemId = layout.rootId !== void 0 ? layout.itemOf[layout.rootId] : layout.items[0]?.id;
|
|
14586
15263
|
const requestedFocus = focusId !== void 0 ? layout.itemOf[focusId] ?? focusId : localFocus;
|
|
14587
15264
|
const focusedId = requestedFocus !== void 0 && itemById.has(requestedFocus) ? requestedFocus : rootItemId;
|
|
14588
15265
|
const selectedItemId = selectedId !== void 0 ? layout.itemOf[selectedId] : void 0;
|
|
14589
|
-
const activeIds = (0,
|
|
15266
|
+
const activeIds = (0, import_react73.useMemo)(
|
|
14590
15267
|
() => new Set([hoverId, selectedItemId].filter((id) => id !== void 0)),
|
|
14591
15268
|
[hoverId, selectedItemId]
|
|
14592
15269
|
);
|
|
14593
|
-
(0,
|
|
15270
|
+
(0, import_react73.useEffect)(() => {
|
|
14594
15271
|
const element = viewportRef.current;
|
|
14595
15272
|
if (!element) return;
|
|
14596
15273
|
const measure = () => setSize({ width: element.clientWidth, height: element.clientHeight });
|
|
@@ -14600,18 +15277,18 @@ function LayeredRelationshipGraph({
|
|
|
14600
15277
|
observer.observe(element);
|
|
14601
15278
|
return () => observer.disconnect();
|
|
14602
15279
|
}, []);
|
|
14603
|
-
(0,
|
|
15280
|
+
(0, import_react73.useEffect)(() => {
|
|
14604
15281
|
if (size.width === 0) return;
|
|
14605
15282
|
const key = `${layout.rootId ?? ""}`;
|
|
14606
15283
|
if (initialisedFor.current === key) return;
|
|
14607
15284
|
initialisedFor.current = key;
|
|
14608
15285
|
setView(initialView(layout, size));
|
|
14609
15286
|
}, [layout, size]);
|
|
14610
|
-
const moveView = (0,
|
|
15287
|
+
const moveView = (0, import_react73.useCallback)((next, smooth) => {
|
|
14611
15288
|
setAnimate(smooth);
|
|
14612
15289
|
setView(next);
|
|
14613
15290
|
}, []);
|
|
14614
|
-
const ensureVisible = (0,
|
|
15291
|
+
const ensureVisible = (0, import_react73.useCallback)((id, smooth) => {
|
|
14615
15292
|
const element = viewportRef.current;
|
|
14616
15293
|
const item = layoutRef.current.items.find((candidate) => candidate.id === id);
|
|
14617
15294
|
if (!element || !item) return;
|
|
@@ -14630,7 +15307,7 @@ function LayeredRelationshipGraph({
|
|
|
14630
15307
|
else if (bottom > heightPx - FOCUS_MARGIN) nextY -= bottom - (heightPx - FOCUS_MARGIN);
|
|
14631
15308
|
if (nextX !== x || nextY !== y) moveView({ x: nextX, y: nextY, zoom }, smooth);
|
|
14632
15309
|
}, [moveView]);
|
|
14633
|
-
const focusItem = (0,
|
|
15310
|
+
const focusItem = (0, import_react73.useCallback)((id) => {
|
|
14634
15311
|
setLocalFocus(id);
|
|
14635
15312
|
onFocusChange?.(id);
|
|
14636
15313
|
requestAnimationFrame(() => {
|
|
@@ -14638,7 +15315,7 @@ function LayeredRelationshipGraph({
|
|
|
14638
15315
|
ensureVisible(id, true);
|
|
14639
15316
|
});
|
|
14640
15317
|
}, [ensureVisible, onFocusChange]);
|
|
14641
|
-
(0,
|
|
15318
|
+
(0, import_react73.useEffect)(() => {
|
|
14642
15319
|
const wanted = pendingFocus.current;
|
|
14643
15320
|
if (wanted !== void 0 && itemById.has(wanted)) {
|
|
14644
15321
|
pendingFocus.current = void 0;
|
|
@@ -14648,8 +15325,8 @@ function LayeredRelationshipGraph({
|
|
|
14648
15325
|
const controlledTarget = focusId !== void 0 ? layout.itemOf[focusId] ?? focusId : void 0;
|
|
14649
15326
|
const controlledPresent = controlledTarget !== void 0 && itemById.has(controlledTarget);
|
|
14650
15327
|
const controlledKey = `${controlledTarget ?? ""}|${controlledPresent}`;
|
|
14651
|
-
const lastControlledKey = (0,
|
|
14652
|
-
(0,
|
|
15328
|
+
const lastControlledKey = (0, import_react73.useRef)(controlledKey);
|
|
15329
|
+
(0, import_react73.useEffect)(() => {
|
|
14653
15330
|
if (lastControlledKey.current === controlledKey) return;
|
|
14654
15331
|
lastControlledKey.current = controlledKey;
|
|
14655
15332
|
if (!controlledPresent || controlledTarget === void 0) return;
|
|
@@ -14658,7 +15335,7 @@ function LayeredRelationshipGraph({
|
|
|
14658
15335
|
ensureVisible(controlledTarget, true);
|
|
14659
15336
|
});
|
|
14660
15337
|
}, [controlledKey, controlledTarget, controlledPresent, ensureVisible]);
|
|
14661
|
-
(0,
|
|
15338
|
+
(0, import_react73.useEffect)(() => {
|
|
14662
15339
|
const element = viewportRef.current;
|
|
14663
15340
|
if (!element) return;
|
|
14664
15341
|
const onWheel = (event) => {
|
|
@@ -14668,7 +15345,7 @@ function LayeredRelationshipGraph({
|
|
|
14668
15345
|
const px = event.clientX - rect.left;
|
|
14669
15346
|
const py = event.clientY - rect.top;
|
|
14670
15347
|
const current = viewRef.current;
|
|
14671
|
-
const zoom =
|
|
15348
|
+
const zoom = clampZoom2(current.zoom * Math.exp(-event.deltaY * 2e-3));
|
|
14672
15349
|
const ratio = zoom / current.zoom;
|
|
14673
15350
|
setAnimate(false);
|
|
14674
15351
|
setView({ zoom, x: px - (px - current.x) * ratio, y: py - (py - current.y) * ratio });
|
|
@@ -14676,8 +15353,8 @@ function LayeredRelationshipGraph({
|
|
|
14676
15353
|
element.addEventListener("wheel", onWheel, { passive: false });
|
|
14677
15354
|
return () => element.removeEventListener("wheel", onWheel);
|
|
14678
15355
|
}, []);
|
|
14679
|
-
const pointers = (0,
|
|
14680
|
-
const pinchDistance = (0,
|
|
15356
|
+
const pointers = (0, import_react73.useRef)(/* @__PURE__ */ new Map());
|
|
15357
|
+
const pinchDistance = (0, import_react73.useRef)(void 0);
|
|
14681
15358
|
const onPointerDown = (event) => {
|
|
14682
15359
|
if (event.target.closest("button")) return;
|
|
14683
15360
|
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
@@ -14699,7 +15376,7 @@ function LayeredRelationshipGraph({
|
|
|
14699
15376
|
const my = (a.y + b.y) / 2 - rect.top;
|
|
14700
15377
|
if (pinchDistance.current !== void 0 && pinchDistance.current > 0) {
|
|
14701
15378
|
const base = viewRef.current;
|
|
14702
|
-
const zoom =
|
|
15379
|
+
const zoom = clampZoom2(base.zoom * (distance / pinchDistance.current));
|
|
14703
15380
|
const ratio = zoom / base.zoom;
|
|
14704
15381
|
setView({ zoom, x: mx - (mx - base.x) * ratio, y: my - (my - base.y) * ratio });
|
|
14705
15382
|
}
|
|
@@ -14716,7 +15393,7 @@ function LayeredRelationshipGraph({
|
|
|
14716
15393
|
};
|
|
14717
15394
|
const zoomBy = (factor) => {
|
|
14718
15395
|
const current = viewRef.current;
|
|
14719
|
-
const zoom =
|
|
15396
|
+
const zoom = clampZoom2(current.zoom * factor);
|
|
14720
15397
|
const ratio = zoom / current.zoom;
|
|
14721
15398
|
const cx0 = size.width / 2;
|
|
14722
15399
|
const cy0 = size.height / 2;
|
|
@@ -14775,21 +15452,21 @@ function LayeredRelationshipGraph({
|
|
|
14775
15452
|
height: layout.height,
|
|
14776
15453
|
transform: `translate(${view.x}px, ${view.y}px) scale(${view.zoom})`
|
|
14777
15454
|
};
|
|
14778
|
-
return /* @__PURE__ */ (0,
|
|
14779
|
-
/* @__PURE__ */ (0,
|
|
14780
|
-
/* @__PURE__ */ (0,
|
|
14781
|
-
/* @__PURE__ */ (0,
|
|
14782
|
-
/* @__PURE__ */ (0,
|
|
14783
|
-
/* @__PURE__ */ (0,
|
|
14784
|
-
/* @__PURE__ */ (0,
|
|
14785
|
-
/* @__PURE__ */ (0,
|
|
14786
|
-
/* @__PURE__ */ (0,
|
|
14787
|
-
/* @__PURE__ */ (0,
|
|
14788
|
-
/* @__PURE__ */ (0,
|
|
15455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("section", { className: cx("uix-relationship-graph", "uix-relationship-graph--layered", density === "compact" && "uix-relationship-graph--compact", className), "aria-label": labels.graph, children: [
|
|
15456
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "uix-relationship-graph__toolbar", role: "group", "aria-label": labels.controls, children: [
|
|
15457
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("button", { type: "button", onClick: () => zoomBy(ZOOM_STEP), disabled: view.zoom >= MAX_ZOOM2, children: labels.zoomIn }),
|
|
15458
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("button", { type: "button", onClick: () => zoomBy(1 / ZOOM_STEP), disabled: view.zoom <= MIN_ZOOM2, children: labels.zoomOut }),
|
|
15459
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("button", { type: "button", onClick: () => moveView(fitView(layout, size), true), children: labels.fit }),
|
|
15460
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("button", { type: "button", onClick: () => moveView(initialView(layout, size), true), children: labels.reset }),
|
|
15461
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("button", { type: "button", onClick: () => panBy(PAN_STEP, 0), "aria-label": labels.panLeft, children: labels.left }),
|
|
15462
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("button", { type: "button", onClick: () => panBy(0, PAN_STEP), "aria-label": labels.panUp, children: labels.up }),
|
|
15463
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("button", { type: "button", onClick: () => panBy(0, -PAN_STEP), "aria-label": labels.panDown, children: labels.down }),
|
|
15464
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("button", { type: "button", onClick: () => panBy(-PAN_STEP, 0), "aria-label": labels.panRight, children: labels.right }),
|
|
15465
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { "aria-live": "polite", children: labels.zoomLevel(Math.round(view.zoom * 100)) })
|
|
14789
15466
|
] }),
|
|
14790
|
-
bounded.omittedNodeCount > 0 && /* @__PURE__ */ (0,
|
|
14791
|
-
/* @__PURE__ */ (0,
|
|
14792
|
-
/* @__PURE__ */ (0,
|
|
15467
|
+
bounded.omittedNodeCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("p", { className: "uix-relationship-graph__bounded", role: "status", children: labels.bounded(bounded.nodes.length, bounded.omittedNodeCount) }),
|
|
15468
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("p", { id: hintId, className: "uix-visually-hidden", children: labels.keyboardHint }),
|
|
15469
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
14793
15470
|
"div",
|
|
14794
15471
|
{
|
|
14795
15472
|
ref: viewportRef,
|
|
@@ -14799,11 +15476,11 @@ function LayeredRelationshipGraph({
|
|
|
14799
15476
|
onPointerMove,
|
|
14800
15477
|
onPointerUp: onPointerEnd,
|
|
14801
15478
|
onPointerCancel: onPointerEnd,
|
|
14802
|
-
children: /* @__PURE__ */ (0,
|
|
14803
|
-
/* @__PURE__ */ (0,
|
|
15479
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "uix-relationship-graph__stage", style: stageStyle, "data-animate": animate || void 0, onTransitionEnd: () => setAnimate(false), children: [
|
|
15480
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("svg", { className: "uix-relationship-graph__edges", width: layout.width, height: layout.height, "aria-hidden": "true", focusable: "false", children: layout.edges.map((edge) => {
|
|
14804
15481
|
const active = activeIds.has(edge.source) || activeIds.has(edge.target) || edge.edgeIds.some((id) => highlightedEdgeIds.has(id));
|
|
14805
15482
|
const angle = edge.arrowAngle * 180 / Math.PI;
|
|
14806
|
-
return /* @__PURE__ */ (0,
|
|
15483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(
|
|
14807
15484
|
"g",
|
|
14808
15485
|
{
|
|
14809
15486
|
className: "uix-relationship-graph__link",
|
|
@@ -14813,15 +15490,15 @@ function LayeredRelationshipGraph({
|
|
|
14813
15490
|
"data-conflicted": edge.edgeIds.some((id) => conflictedEdgeIds.has(id)) || void 0,
|
|
14814
15491
|
"data-dimmed": dimmedNodeIds.has(edge.source) && dimmedNodeIds.has(edge.target) || void 0,
|
|
14815
15492
|
children: [
|
|
14816
|
-
/* @__PURE__ */ (0,
|
|
14817
|
-
edge.arrow !== "none" && /* @__PURE__ */ (0,
|
|
14818
|
-
showLabel(edge) && /* @__PURE__ */ (0,
|
|
15493
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("path", { d: edge.path }),
|
|
15494
|
+
edge.arrow !== "none" && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("polygon", { points: arrowPoints, transform: `translate(${edge.arrowX} ${edge.arrowY}) rotate(${angle})` }),
|
|
15495
|
+
showLabel(edge) && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("text", { x: edge.labelX, y: edge.labelY, textAnchor: "middle", dominantBaseline: "middle", children: (edge.kind === "cycle" ? [...edge.labelLines, labels.cycle] : edge.labelLines).map((line, index, lines) => /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("tspan", { x: edge.labelX, dy: index === 0 ? `${-(lines.length - 1) * 0.55}em` : "1.1em", children: line }, index)) })
|
|
14819
15496
|
]
|
|
14820
15497
|
},
|
|
14821
15498
|
edge.id
|
|
14822
15499
|
);
|
|
14823
15500
|
}) }),
|
|
14824
|
-
layout.columns.map((column) => /* @__PURE__ */ (0,
|
|
15501
|
+
layout.columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
14825
15502
|
"div",
|
|
14826
15503
|
{
|
|
14827
15504
|
className: "uix-relationship-graph__column",
|
|
@@ -14831,17 +15508,17 @@ function LayeredRelationshipGraph({
|
|
|
14831
15508
|
},
|
|
14832
15509
|
column.depth
|
|
14833
15510
|
)),
|
|
14834
|
-
/* @__PURE__ */ (0,
|
|
15511
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { role: "group", "aria-roledescription": labels.roleDescription, "aria-label": labels.graphSummary(bounded.nodes.length, bounded.edges.length), "aria-describedby": hintId, children: layout.items.map((item) => {
|
|
14835
15512
|
const selected = item.id === selectedItemId;
|
|
14836
15513
|
const dimmed = item.node ? dimmedNodeIds.has(item.node.id) : item.cluster.members.every((member) => dimmedNodeIds.has(member.id));
|
|
14837
|
-
const body = item.cluster ? renderCluster?.(item.cluster) ?? /* @__PURE__ */ (0,
|
|
14838
|
-
/* @__PURE__ */ (0,
|
|
14839
|
-
/* @__PURE__ */ (0,
|
|
14840
|
-
] }) : renderNode?.(item.node, { selected, dimmed }) ?? /* @__PURE__ */ (0,
|
|
14841
|
-
/* @__PURE__ */ (0,
|
|
14842
|
-
(item.node.type || item.node.description) && /* @__PURE__ */ (0,
|
|
15514
|
+
const body = item.cluster ? renderCluster?.(item.cluster) ?? /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(import_jsx_runtime99.Fragment, { children: [
|
|
15515
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { className: "uix-relationship-graph__item-label", children: labels.cluster(item.cluster.members.length, item.cluster.type, item.cluster.edgeLabel) }),
|
|
15516
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { className: "uix-relationship-graph__item-meta", children: labels.expandCluster })
|
|
15517
|
+
] }) : renderNode?.(item.node, { selected, dimmed }) ?? /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(import_jsx_runtime99.Fragment, { children: [
|
|
15518
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { className: "uix-relationship-graph__item-label", children: item.node.label }),
|
|
15519
|
+
(item.node.type || item.node.description) && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { className: "uix-relationship-graph__item-meta", children: [item.node.type, item.node.description].filter(Boolean).join(" \xB7 ") })
|
|
14843
15520
|
] });
|
|
14844
|
-
return /* @__PURE__ */ (0,
|
|
15521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(
|
|
14845
15522
|
"button",
|
|
14846
15523
|
{
|
|
14847
15524
|
ref: (element) => {
|
|
@@ -14872,7 +15549,7 @@ function LayeredRelationshipGraph({
|
|
|
14872
15549
|
onPointerLeave: () => setHoverId((current) => current === item.id ? void 0 : current),
|
|
14873
15550
|
children: [
|
|
14874
15551
|
body,
|
|
14875
|
-
item.inCycle && /* @__PURE__ */ (0,
|
|
15552
|
+
item.inCycle && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { className: "uix-relationship-graph__item-flag", "aria-hidden": "true", children: labels.cycle })
|
|
14876
15553
|
]
|
|
14877
15554
|
},
|
|
14878
15555
|
item.id
|
|
@@ -14880,7 +15557,7 @@ function LayeredRelationshipGraph({
|
|
|
14880
15557
|
}) }),
|
|
14881
15558
|
layout.items.filter((item) => item.expandedGroup).map((item) => {
|
|
14882
15559
|
const group = item.expandedGroup;
|
|
14883
|
-
return /* @__PURE__ */ (0,
|
|
15560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
14884
15561
|
"button",
|
|
14885
15562
|
{
|
|
14886
15563
|
type: "button",
|
|
@@ -14896,8 +15573,8 @@ function LayeredRelationshipGraph({
|
|
|
14896
15573
|
] })
|
|
14897
15574
|
}
|
|
14898
15575
|
),
|
|
14899
|
-
legend.length > 0 && /* @__PURE__ */ (0,
|
|
14900
|
-
showList && /* @__PURE__ */ (0,
|
|
15576
|
+
legend.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("ul", { className: "uix-relationship-graph__legend", "aria-label": labels.legend, children: legend.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("li", { "data-type": entry.id, children: entry.label }, entry.id)) }),
|
|
15577
|
+
showList && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
14901
15578
|
EquivalentRelationshipList,
|
|
14902
15579
|
{
|
|
14903
15580
|
nodes: bounded.nodes,
|
|
@@ -14916,7 +15593,7 @@ function LayeredRelationshipGraph({
|
|
|
14916
15593
|
}
|
|
14917
15594
|
|
|
14918
15595
|
// src/components/RelationshipGraph.tsx
|
|
14919
|
-
var
|
|
15596
|
+
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
14920
15597
|
var DEFAULT_RELATIONSHIP_GRAPH_LABELS = {
|
|
14921
15598
|
graph: "Relationship graph",
|
|
14922
15599
|
controls: "Graph view controls",
|
|
@@ -14978,21 +15655,21 @@ function radialViewBox(nodes) {
|
|
|
14978
15655
|
return `${round(minX)} ${round(minY)} ${width} ${height}`;
|
|
14979
15656
|
}
|
|
14980
15657
|
function RelationshipGraph(props) {
|
|
14981
|
-
const labels = (0,
|
|
15658
|
+
const labels = (0, import_react74.useMemo)(() => ({ ...DEFAULT_RELATIONSHIP_GRAPH_LABELS, ...props.labels }), [props.labels]);
|
|
14982
15659
|
const stateClass = cx("uix-relationship-graph uix-relationship-graph--state", props.className);
|
|
14983
|
-
if (props.loading) return /* @__PURE__ */ (0,
|
|
15660
|
+
if (props.loading) return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: stateClass, role: "status", children: labels.loading });
|
|
14984
15661
|
if (props.error) {
|
|
14985
|
-
return /* @__PURE__ */ (0,
|
|
14986
|
-
/* @__PURE__ */ (0,
|
|
14987
|
-
props.onRetry && /* @__PURE__ */ (0,
|
|
15662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: stateClass, role: "alert", children: [
|
|
15663
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("p", { children: props.error }),
|
|
15664
|
+
props.onRetry && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("button", { type: "button", className: "uix-btn uix-btn--secondary", onClick: props.onRetry, children: labels.retry })
|
|
14988
15665
|
] });
|
|
14989
15666
|
}
|
|
14990
|
-
if (props.nodes.length === 0) return /* @__PURE__ */ (0,
|
|
14991
|
-
/* @__PURE__ */ (0,
|
|
14992
|
-
/* @__PURE__ */ (0,
|
|
15667
|
+
if (props.nodes.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: stateClass, children: [
|
|
15668
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("p", { children: labels.emptyTitle }),
|
|
15669
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("p", { children: labels.emptyHint })
|
|
14993
15670
|
] });
|
|
14994
|
-
if (props.layout === "layered") return /* @__PURE__ */ (0,
|
|
14995
|
-
return /* @__PURE__ */ (0,
|
|
15671
|
+
if (props.layout === "layered") return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(LayeredRelationshipGraph, { ...props, labels });
|
|
15672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(RadialRelationshipGraph, { ...props, labels });
|
|
14996
15673
|
}
|
|
14997
15674
|
function RadialRelationshipGraph({
|
|
14998
15675
|
nodes,
|
|
@@ -15012,17 +15689,17 @@ function RadialRelationshipGraph({
|
|
|
15012
15689
|
labels,
|
|
15013
15690
|
showList = true
|
|
15014
15691
|
}) {
|
|
15015
|
-
const bounded = (0,
|
|
15016
|
-
const positioned = (0,
|
|
15017
|
-
const typeColor = (0,
|
|
15692
|
+
const bounded = (0, import_react74.useMemo)(() => boundRelationshipGraph(nodes, edges, maxNodes), [nodes, edges, maxNodes]);
|
|
15693
|
+
const positioned = (0, import_react74.useMemo)(() => layoutRelationshipGraph(bounded.nodes, bounded.edges, selectedId), [bounded, selectedId]);
|
|
15694
|
+
const typeColor = (0, import_react74.useMemo)(
|
|
15018
15695
|
() => new Map(legend.map((item, index) => [item.id, `var(--uix-chart-${index % 8 + 1})`])),
|
|
15019
15696
|
[legend]
|
|
15020
15697
|
);
|
|
15021
|
-
const positionedById = (0,
|
|
15022
|
-
const [zoom, setZoom] = (0,
|
|
15023
|
-
const [pan, setPan] = (0,
|
|
15024
|
-
const [focusedId, setFocusedId] = (0,
|
|
15025
|
-
const svgRef = (0,
|
|
15698
|
+
const positionedById = (0, import_react74.useMemo)(() => new Map(positioned.map((node) => [node.id, node])), [positioned]);
|
|
15699
|
+
const [zoom, setZoom] = (0, import_react74.useState)(1);
|
|
15700
|
+
const [pan, setPan] = (0, import_react74.useState)({ x: 0, y: 0 });
|
|
15701
|
+
const [focusedId, setFocusedId] = (0, import_react74.useState)(selectedId ?? positioned[0]?.id);
|
|
15702
|
+
const svgRef = (0, import_react74.useRef)(null);
|
|
15026
15703
|
const select = (id) => {
|
|
15027
15704
|
const node = bounded.nodes.find((item) => item.id === id);
|
|
15028
15705
|
if (node) onSelect?.(node);
|
|
@@ -15045,25 +15722,25 @@ function RadialRelationshipGraph({
|
|
|
15045
15722
|
setZoom(1);
|
|
15046
15723
|
setPan({ x: 0, y: 0 });
|
|
15047
15724
|
};
|
|
15048
|
-
return /* @__PURE__ */ (0,
|
|
15049
|
-
/* @__PURE__ */ (0,
|
|
15050
|
-
/* @__PURE__ */ (0,
|
|
15051
|
-
/* @__PURE__ */ (0,
|
|
15052
|
-
/* @__PURE__ */ (0,
|
|
15053
|
-
/* @__PURE__ */ (0,
|
|
15054
|
-
/* @__PURE__ */ (0,
|
|
15055
|
-
/* @__PURE__ */ (0,
|
|
15056
|
-
/* @__PURE__ */ (0,
|
|
15057
|
-
/* @__PURE__ */ (0,
|
|
15725
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("section", { className: cx("uix-relationship-graph", `uix-relationship-graph--${density}`, className), "aria-label": labels.graph, children: [
|
|
15726
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "uix-relationship-graph__toolbar", "aria-label": labels.controls, children: [
|
|
15727
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("button", { type: "button", onClick: () => setPan((value) => ({ ...value, x: value.x - 24 })), "aria-label": labels.panLeft, children: labels.left }),
|
|
15728
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("button", { type: "button", onClick: () => setPan((value) => ({ ...value, y: value.y - 24 })), "aria-label": labels.panUp, children: labels.up }),
|
|
15729
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("button", { type: "button", onClick: () => setPan((value) => ({ ...value, y: value.y + 24 })), "aria-label": labels.panDown, children: labels.down }),
|
|
15730
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("button", { type: "button", onClick: () => setPan((value) => ({ ...value, x: value.x + 24 })), "aria-label": labels.panRight, children: labels.right }),
|
|
15731
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("button", { type: "button", onClick: () => setZoom((value) => Math.min(2, Number((value + 0.2).toFixed(1)))), "aria-label": labels.zoomIn, children: labels.zoomIn }),
|
|
15732
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("button", { type: "button", onClick: () => setZoom((value) => Math.max(0.5, Number((value - 0.2).toFixed(1)))), "aria-label": labels.zoomOut, children: labels.zoomOut }),
|
|
15733
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("button", { type: "button", onClick: reset, children: labels.reset }),
|
|
15734
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("span", { "aria-live": "polite", children: labels.zoomLevel(Math.round(zoom * 100)) })
|
|
15058
15735
|
] }),
|
|
15059
|
-
bounded.omittedNodeCount > 0 && /* @__PURE__ */ (0,
|
|
15060
|
-
/* @__PURE__ */ (0,
|
|
15736
|
+
bounded.omittedNodeCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("p", { className: "uix-relationship-graph__bounded", role: "status", children: labels.bounded(bounded.nodes.length, bounded.omittedNodeCount) }),
|
|
15737
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "uix-relationship-graph__visual", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("svg", { ref: svgRef, viewBox: radialViewBox(positioned), role: "group", "aria-label": labels.graphSummary(bounded.nodes.length, bounded.edges.length), children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("g", { transform: `translate(${pan.x} ${pan.y}) scale(${zoom})`, children: [
|
|
15061
15738
|
bounded.edges.map((edge) => {
|
|
15062
15739
|
const source = positionedById.get(edge.source);
|
|
15063
15740
|
const target = positionedById.get(edge.target);
|
|
15064
|
-
return /* @__PURE__ */ (0,
|
|
15741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("line", { x1: source.x * RADIAL_SCALE_X, y1: source.y * RADIAL_SCALE_Y, x2: target.x * RADIAL_SCALE_X, y2: target.y * RADIAL_SCALE_Y, className: "uix-relationship-graph__edge", "data-typed": edge.type != null && typeColor.has(edge.type) || void 0, style: edge.type != null && typeColor.has(edge.type) ? { "--uix-graph-type-color": typeColor.get(edge.type) } : void 0, "data-highlighted": highlightedEdgeIds.has(edge.id) || void 0, "data-conflicted": conflictedEdgeIds.has(edge.id) || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("title", { children: edge.label ?? edge.type ?? labels.relationship }) }, edge.id);
|
|
15065
15742
|
}),
|
|
15066
|
-
positioned.map((node) => /* @__PURE__ */ (0,
|
|
15743
|
+
positioned.map((node) => /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
|
|
15067
15744
|
"g",
|
|
15068
15745
|
{
|
|
15069
15746
|
transform: `translate(${node.x * RADIAL_SCALE_X} ${node.y * RADIAL_SCALE_Y})`,
|
|
@@ -15079,22 +15756,22 @@ function RadialRelationshipGraph({
|
|
|
15079
15756
|
onKeyDown: (event) => onNodeKeyDown(event, node.id),
|
|
15080
15757
|
onClick: () => select(node.id),
|
|
15081
15758
|
children: [
|
|
15082
|
-
/* @__PURE__ */ (0,
|
|
15083
|
-
/* @__PURE__ */ (0,
|
|
15084
|
-
/* @__PURE__ */ (0,
|
|
15759
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("title", { children: node.label }),
|
|
15760
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("rect", { x: -RADIAL_NODE_HALF_W, y: -RADIAL_NODE_HALF_H, width: RADIAL_NODE_HALF_W * 2, height: RADIAL_NODE_HALF_H * 2, rx: "8" }),
|
|
15761
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("text", { textAnchor: "middle", dominantBaseline: "middle", children: node.label.length > 16 ? `${node.label.slice(0, 15)}\u2026` : node.label })
|
|
15085
15762
|
]
|
|
15086
15763
|
},
|
|
15087
15764
|
node.id
|
|
15088
15765
|
))
|
|
15089
15766
|
] }) }) }),
|
|
15090
|
-
legend.length > 0 && /* @__PURE__ */ (0,
|
|
15091
|
-
showList && /* @__PURE__ */ (0,
|
|
15767
|
+
legend.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("ul", { className: "uix-relationship-graph__legend", "aria-label": labels.legend, children: legend.map((item) => /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("li", { "data-type": item.id, style: { "--uix-graph-type-color": typeColor.get(item.id) }, children: item.label }, item.id)) }),
|
|
15768
|
+
showList && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(EquivalentRelationshipList, { nodes: bounded.nodes, edges: bounded.edges, selectedId, labels, onSelect: select, onExpandNeighbors, onOpenDetails })
|
|
15092
15769
|
] });
|
|
15093
15770
|
}
|
|
15094
15771
|
|
|
15095
15772
|
// src/components/MatchReview.tsx
|
|
15096
|
-
var
|
|
15097
|
-
var
|
|
15773
|
+
var import_react75 = require("react");
|
|
15774
|
+
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
15098
15775
|
var DEFAULT_MATCH_REVIEW_LABELS = {
|
|
15099
15776
|
region: "Match review",
|
|
15100
15777
|
loading: "Loading match candidates\u2026",
|
|
@@ -15156,11 +15833,11 @@ function MatchReview({
|
|
|
15156
15833
|
const plural = (n, one, many) => fillLabel(n === 1 ? one : many, { count: n });
|
|
15157
15834
|
const decisionLabel = { accepted: labels.decisionAccepted, dismissed: labels.decisionDismissed, split: labels.decisionSplit, other: labels.decisionOther };
|
|
15158
15835
|
const actionLabel = { accept: labels.accept, dismiss: labels.dismiss, split: labels.split, "pick-other": labels.pickOther };
|
|
15159
|
-
const [internalSelection, setInternalSelection] = (0,
|
|
15160
|
-
const [announcement, setAnnouncement] = (0,
|
|
15161
|
-
const [bulkPending, setBulkPending] = (0,
|
|
15836
|
+
const [internalSelection, setInternalSelection] = (0, import_react75.useState)(/* @__PURE__ */ new Set());
|
|
15837
|
+
const [announcement, setAnnouncement] = (0, import_react75.useState)("");
|
|
15838
|
+
const [bulkPending, setBulkPending] = (0, import_react75.useState)(false);
|
|
15162
15839
|
const selection = selectedIds ?? internalSelection;
|
|
15163
|
-
const pending = (0,
|
|
15840
|
+
const pending = (0, import_react75.useMemo)(() => candidates.filter((candidate) => candidate.status !== "resolved"), [candidates]);
|
|
15164
15841
|
const setSelection = (next) => {
|
|
15165
15842
|
if (selectedIds === void 0) setInternalSelection(next);
|
|
15166
15843
|
onSelectionChange?.(next);
|
|
@@ -15189,48 +15866,48 @@ function MatchReview({
|
|
|
15189
15866
|
setBulkPending(false);
|
|
15190
15867
|
}
|
|
15191
15868
|
};
|
|
15192
|
-
if (loading) return /* @__PURE__ */ (0,
|
|
15193
|
-
if (error) return /* @__PURE__ */ (0,
|
|
15194
|
-
/* @__PURE__ */ (0,
|
|
15195
|
-
onRetry && /* @__PURE__ */ (0,
|
|
15869
|
+
if (loading) return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className: cx("uix-match-review uix-match-review--state", className), role: "status", children: labels.loading });
|
|
15870
|
+
if (error) return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: cx("uix-match-review uix-match-review--state", className), role: "alert", children: [
|
|
15871
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("p", { children: error }),
|
|
15872
|
+
onRetry && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("button", { type: "button", className: "uix-btn uix-btn--secondary", onClick: onRetry, children: labels.retry })
|
|
15196
15873
|
] });
|
|
15197
|
-
if (candidates.length === 0) return /* @__PURE__ */ (0,
|
|
15198
|
-
/* @__PURE__ */ (0,
|
|
15199
|
-
/* @__PURE__ */ (0,
|
|
15874
|
+
if (candidates.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: cx("uix-match-review uix-match-review--state", className), children: [
|
|
15875
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("p", { children: labels.empty }),
|
|
15876
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("p", { children: labels.emptyDetail })
|
|
15200
15877
|
] });
|
|
15201
|
-
return /* @__PURE__ */ (0,
|
|
15202
|
-
/* @__PURE__ */ (0,
|
|
15203
|
-
/* @__PURE__ */ (0,
|
|
15204
|
-
/* @__PURE__ */ (0,
|
|
15205
|
-
/* @__PURE__ */ (0,
|
|
15878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("section", { className: cx("uix-match-review", className), "aria-label": labels.region, children: [
|
|
15879
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: "uix-match-review__summary", children: [
|
|
15880
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { children: [
|
|
15881
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("strong", { children: incomingLabel }),
|
|
15882
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("span", { children: fillLabel(labels.pendingOf, { pending: pending.length, total: candidates.length }) })
|
|
15206
15883
|
] }),
|
|
15207
|
-
/* @__PURE__ */ (0,
|
|
15208
|
-
/* @__PURE__ */ (0,
|
|
15884
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className: "uix-match-review__incoming", children: fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("span", { children: [
|
|
15885
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("b", { children: field.label }),
|
|
15209
15886
|
field.render?.(incoming[field.id], incoming) ?? valueText(incoming[field.id])
|
|
15210
15887
|
] }, field.id)) })
|
|
15211
15888
|
] }),
|
|
15212
|
-
onBulkDecision && /* @__PURE__ */ (0,
|
|
15213
|
-
/* @__PURE__ */ (0,
|
|
15214
|
-
/* @__PURE__ */ (0,
|
|
15215
|
-
/* @__PURE__ */ (0,
|
|
15889
|
+
onBulkDecision && /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: "uix-match-review__bulk", "aria-label": labels.bulk, children: [
|
|
15890
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("span", { children: fillLabel(labels.selectedCount, { count: selection.size }) }),
|
|
15891
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("button", { type: "button", className: "uix-btn uix-btn--secondary uix-btn--sm", disabled: selection.size === 0 || bulkPending, onClick: () => void runBulk("accept"), children: bulkPending ? labels.applying : labels.acceptSelected }),
|
|
15892
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("button", { type: "button", className: "uix-btn uix-btn--ghost uix-btn--sm", disabled: selection.size === 0 || bulkPending, onClick: () => void runBulk("dismiss"), children: bulkPending ? labels.applying : labels.dismissSelected })
|
|
15216
15893
|
] }),
|
|
15217
|
-
/* @__PURE__ */ (0,
|
|
15218
|
-
/* @__PURE__ */ (0,
|
|
15219
|
-
/* @__PURE__ */ (0,
|
|
15220
|
-
/* @__PURE__ */ (0,
|
|
15221
|
-
/* @__PURE__ */ (0,
|
|
15222
|
-
fields.map((field) => /* @__PURE__ */ (0,
|
|
15223
|
-
/* @__PURE__ */ (0,
|
|
15224
|
-
/* @__PURE__ */ (0,
|
|
15894
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className: "uix-match-review__table-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("table", { className: "uix-table uix-match-review__table", children: [
|
|
15895
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("caption", { className: "uix-visually-hidden", children: labels.caption }),
|
|
15896
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("tr", { children: [
|
|
15897
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("th", { scope: "col", children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("span", { className: "uix-visually-hidden", children: labels.select }) }),
|
|
15898
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("th", { scope: "col", children: labels.confidence }),
|
|
15899
|
+
fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("th", { scope: "col", children: field.label }, field.id)),
|
|
15900
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("th", { scope: "col", children: labels.status }),
|
|
15901
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("th", { scope: "col", children: labels.actions })
|
|
15225
15902
|
] }) }),
|
|
15226
|
-
/* @__PURE__ */ (0,
|
|
15903
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("tbody", { children: candidates.map((candidate) => {
|
|
15227
15904
|
const resolved = candidate.status === "resolved";
|
|
15228
|
-
return /* @__PURE__ */ (0,
|
|
15229
|
-
/* @__PURE__ */ (0,
|
|
15230
|
-
/* @__PURE__ */ (0,
|
|
15231
|
-
fields.map((field) => /* @__PURE__ */ (0,
|
|
15232
|
-
/* @__PURE__ */ (0,
|
|
15233
|
-
/* @__PURE__ */ (0,
|
|
15905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("tr", { "data-status": candidate.status ?? "pending", children: [
|
|
15906
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("input", { type: "checkbox", checked: selection.has(candidate.id), onChange: () => toggle(candidate.id), "aria-label": fillLabel(labels.selectCandidate, { id: candidate.id }) }) }),
|
|
15907
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("span", { className: "uix-match-review__confidence", children: candidate.confidence == null ? labels.notScored : `${Math.round(candidate.confidence * 100)}%` }) }),
|
|
15908
|
+
fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("td", { children: field.render?.(candidate.record[field.id], candidate.record) ?? valueText(candidate.record[field.id]) }, field.id)),
|
|
15909
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(StatusPill, { tone: resolved ? "success" : "warning", children: resolved ? candidate.decision ? decisionLabel[candidate.decision] : labels.resolved : labels.pending }) }),
|
|
15910
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className: "uix-match-review__actions", children: ["accept", "dismiss", "split", "pick-other"].map((action) => /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
15234
15911
|
"button",
|
|
15235
15912
|
{
|
|
15236
15913
|
type: "button",
|
|
@@ -15244,12 +15921,12 @@ function MatchReview({
|
|
|
15244
15921
|
] }, candidate.id);
|
|
15245
15922
|
}) })
|
|
15246
15923
|
] }) }),
|
|
15247
|
-
/* @__PURE__ */ (0,
|
|
15924
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("p", { className: "uix-visually-hidden", "aria-live": "polite", children: announcement })
|
|
15248
15925
|
] });
|
|
15249
15926
|
}
|
|
15250
15927
|
|
|
15251
15928
|
// src/components/MetricInput.tsx
|
|
15252
|
-
var
|
|
15929
|
+
var import_react76 = require("react");
|
|
15253
15930
|
|
|
15254
15931
|
// src/metric-model.ts
|
|
15255
15932
|
function decimals(value) {
|
|
@@ -15274,7 +15951,7 @@ function parseMetricValue(value) {
|
|
|
15274
15951
|
}
|
|
15275
15952
|
|
|
15276
15953
|
// src/components/MetricInput.tsx
|
|
15277
|
-
var
|
|
15954
|
+
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
15278
15955
|
var defaultMetricFormat = (input) => input == null ? "" : String(input);
|
|
15279
15956
|
function MetricInput({
|
|
15280
15957
|
value,
|
|
@@ -15295,14 +15972,14 @@ function MetricInput({
|
|
|
15295
15972
|
className,
|
|
15296
15973
|
id: providedId
|
|
15297
15974
|
}) {
|
|
15298
|
-
const generatedId = (0,
|
|
15975
|
+
const generatedId = (0, import_react76.useId)();
|
|
15299
15976
|
const id = providedId ?? generatedId;
|
|
15300
15977
|
const errorId = `${id}-error`;
|
|
15301
15978
|
const hintId = `${id}-hint`;
|
|
15302
15979
|
const showError = Boolean(invalid && errorMessage);
|
|
15303
15980
|
const describedBy = [hint ? hintId : null, showError ? errorId : null].filter(Boolean).join(" ") || void 0;
|
|
15304
|
-
const [text, setText] = (0,
|
|
15305
|
-
(0,
|
|
15981
|
+
const [text, setText] = (0, import_react76.useState)(() => format(value));
|
|
15982
|
+
(0, import_react76.useEffect)(() => setText(format(value)), [value, format]);
|
|
15306
15983
|
const commit = (input) => {
|
|
15307
15984
|
const parsed = parse(input);
|
|
15308
15985
|
if (input.trim() === "" || parsed !== null) {
|
|
@@ -15328,10 +16005,10 @@ function MetricInput({
|
|
|
15328
16005
|
const parsed = parse(event.currentTarget.value);
|
|
15329
16006
|
setText(parsed === null && event.currentTarget.value.trim() !== "" ? format(value) : format(parsed));
|
|
15330
16007
|
};
|
|
15331
|
-
return /* @__PURE__ */ (0,
|
|
15332
|
-
/* @__PURE__ */ (0,
|
|
15333
|
-
/* @__PURE__ */ (0,
|
|
15334
|
-
/* @__PURE__ */ (0,
|
|
16008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: cx("uix-metric-input", invalid && "uix-metric-input--invalid", className), children: [
|
|
16009
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("label", { className: "uix-field__label", htmlFor: id, "data-required": required || void 0, children: label }),
|
|
16010
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "uix-metric-input__control", children: [
|
|
16011
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
15335
16012
|
Input,
|
|
15336
16013
|
{
|
|
15337
16014
|
id,
|
|
@@ -15352,23 +16029,23 @@ function MetricInput({
|
|
|
15352
16029
|
readOnly
|
|
15353
16030
|
}
|
|
15354
16031
|
),
|
|
15355
|
-
unit && /* @__PURE__ */ (0,
|
|
15356
|
-
/* @__PURE__ */ (0,
|
|
15357
|
-
/* @__PURE__ */ (0,
|
|
15358
|
-
/* @__PURE__ */ (0,
|
|
16032
|
+
unit && /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("span", { className: "uix-metric-input__unit", "aria-hidden": "true", children: unit }),
|
|
16033
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("span", { className: "uix-metric-input__steps", children: [
|
|
16034
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("button", { type: "button", className: "uix-metric-input__step", onClick: () => stepBy(1), disabled: disabled || readOnly, "aria-label": `Increase ${label}`, children: "+" }),
|
|
16035
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("button", { type: "button", className: "uix-metric-input__step", onClick: () => stepBy(-1), disabled: disabled || readOnly, "aria-label": `Decrease ${label}`, children: "\u2212" })
|
|
15359
16036
|
] })
|
|
15360
16037
|
] }),
|
|
15361
|
-
unit && /* @__PURE__ */ (0,
|
|
16038
|
+
unit && /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("span", { className: "uix-visually-hidden", children: [
|
|
15362
16039
|
"Unit: ",
|
|
15363
16040
|
unit
|
|
15364
16041
|
] }),
|
|
15365
|
-
hint && /* @__PURE__ */ (0,
|
|
15366
|
-
showError && /* @__PURE__ */ (0,
|
|
16042
|
+
hint && /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("span", { id: hintId, className: "uix-field__hint", children: hint }),
|
|
16043
|
+
showError && /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("span", { id: errorId, className: "uix-field__error", children: errorMessage })
|
|
15367
16044
|
] });
|
|
15368
16045
|
}
|
|
15369
16046
|
|
|
15370
16047
|
// src/components/LicensePositionBar.tsx
|
|
15371
|
-
var
|
|
16048
|
+
var import_jsx_runtime103 = require("react/jsx-runtime");
|
|
15372
16049
|
var defaultCapacityFormat = (value) => new Intl.NumberFormat().format(value);
|
|
15373
16050
|
function LicensePositionBar({
|
|
15374
16051
|
consumed,
|
|
@@ -15389,18 +16066,18 @@ function LicensePositionBar({
|
|
|
15389
16066
|
const percent = safeEntitled === 0 ? safeConsumed > 0 ? 100 : 0 : safeConsumed / safeEntitled * 100;
|
|
15390
16067
|
const format = (value) => `${formatValue(value)}${unit ? ` ${unit}` : ""}`;
|
|
15391
16068
|
const summary = `${consumedLabel}: ${format(safeConsumed)}. ${entitledLabel}: ${format(safeEntitled)}. ${over > 0 ? `${format(over)} ${overLabel}` : `${format(available)} ${availableLabel}`}.`;
|
|
15392
|
-
return /* @__PURE__ */ (0,
|
|
15393
|
-
/* @__PURE__ */ (0,
|
|
15394
|
-
/* @__PURE__ */ (0,
|
|
16069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: cx("uix-license-position", over > 0 && "uix-license-position--over", className), ...props, children: [
|
|
16070
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: "uix-license-position__header", children: [
|
|
16071
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("span", { className: "uix-license-position__value", children: [
|
|
15395
16072
|
format(safeConsumed),
|
|
15396
16073
|
" / ",
|
|
15397
16074
|
format(safeEntitled)
|
|
15398
16075
|
] }),
|
|
15399
|
-
/* @__PURE__ */ (0,
|
|
16076
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(StatusPill, { tone: over > 0 ? "danger" : percent >= 80 ? "warning" : "success", children: over > 0 ? `${format(over)} ${overLabel}` : `${format(available)} ${availableLabel}` })
|
|
15400
16077
|
] }),
|
|
15401
|
-
/* @__PURE__ */ (0,
|
|
15402
|
-
/* @__PURE__ */ (0,
|
|
15403
|
-
over > 0 && /* @__PURE__ */ (0,
|
|
16078
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: "uix-license-position__track", children: [
|
|
16079
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Meter, { value: Math.min(100, percent), tone: over > 0 ? "danger" : percent >= 80 ? "warning" : "success", "aria-label": summary, "aria-valuetext": summary }),
|
|
16080
|
+
over > 0 && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
15404
16081
|
"span",
|
|
15405
16082
|
{
|
|
15406
16083
|
className: "uix-license-position__overflow",
|
|
@@ -15409,12 +16086,12 @@ function LicensePositionBar({
|
|
|
15409
16086
|
}
|
|
15410
16087
|
)
|
|
15411
16088
|
] }),
|
|
15412
|
-
/* @__PURE__ */ (0,
|
|
16089
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { className: "uix-visually-hidden", children: summary })
|
|
15413
16090
|
] });
|
|
15414
16091
|
}
|
|
15415
16092
|
|
|
15416
16093
|
// src/components/BrandProfiles.tsx
|
|
15417
|
-
var
|
|
16094
|
+
var import_react78 = require("react");
|
|
15418
16095
|
|
|
15419
16096
|
// src/color-model.ts
|
|
15420
16097
|
var clamp2 = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
@@ -15483,8 +16160,8 @@ function meetsContrast(background, foreground, minimum = 4.5) {
|
|
|
15483
16160
|
}
|
|
15484
16161
|
|
|
15485
16162
|
// src/components/ColorPicker.tsx
|
|
15486
|
-
var
|
|
15487
|
-
var
|
|
16163
|
+
var import_react77 = require("react");
|
|
16164
|
+
var import_jsx_runtime104 = require("react/jsx-runtime");
|
|
15488
16165
|
var DEFAULT_COLOR_PICKER_LABELS = {
|
|
15489
16166
|
trigger: "{label}: {color}",
|
|
15490
16167
|
sample: "Aa",
|
|
@@ -15515,17 +16192,17 @@ function ColorPicker({
|
|
|
15515
16192
|
labels: labelOverrides
|
|
15516
16193
|
}) {
|
|
15517
16194
|
const labels = { ...DEFAULT_COLOR_PICKER_LABELS, ...labelOverrides };
|
|
15518
|
-
const id = (0,
|
|
15519
|
-
const triggerRef = (0,
|
|
15520
|
-
const dialogRef = (0,
|
|
15521
|
-
const [open, setOpen] = (0,
|
|
16195
|
+
const id = (0, import_react77.useId)();
|
|
16196
|
+
const triggerRef = (0, import_react77.useRef)(null);
|
|
16197
|
+
const dialogRef = (0, import_react77.useRef)(null);
|
|
16198
|
+
const [open, setOpen] = (0, import_react77.useState)(false);
|
|
15522
16199
|
const normalized = normalizeHex(value) ?? "#000000";
|
|
15523
|
-
const [hexText, setHexText] = (0,
|
|
15524
|
-
const hsv = (0,
|
|
16200
|
+
const [hexText, setHexText] = (0, import_react77.useState)(normalized);
|
|
16201
|
+
const hsv = (0, import_react77.useMemo)(() => rgbToHsv(hexToRgb(normalized)), [normalized]);
|
|
15525
16202
|
const ratio = contrastRatio(normalized, foreground) ?? 0;
|
|
15526
16203
|
const passes = ratio >= minimumContrast;
|
|
15527
|
-
(0,
|
|
15528
|
-
(0,
|
|
16204
|
+
(0, import_react77.useEffect)(() => setHexText(normalized), [normalized]);
|
|
16205
|
+
(0, import_react77.useEffect)(() => {
|
|
15529
16206
|
if (!open) return;
|
|
15530
16207
|
const dialog = dialogRef.current;
|
|
15531
16208
|
dialog?.querySelector("input,button")?.focus();
|
|
@@ -15568,8 +16245,8 @@ function ColorPicker({
|
|
|
15568
16245
|
if (next) onChange(next);
|
|
15569
16246
|
};
|
|
15570
16247
|
const sampleStyle = { backgroundColor: normalized };
|
|
15571
|
-
return /* @__PURE__ */ (0,
|
|
15572
|
-
/* @__PURE__ */ (0,
|
|
16248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: cx("uix-color-picker", className), children: [
|
|
16249
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(
|
|
15573
16250
|
"button",
|
|
15574
16251
|
{
|
|
15575
16252
|
ref: triggerRef,
|
|
@@ -15581,12 +16258,12 @@ function ColorPicker({
|
|
|
15581
16258
|
onClick: () => setOpen((current) => !current),
|
|
15582
16259
|
disabled,
|
|
15583
16260
|
children: [
|
|
15584
|
-
/* @__PURE__ */ (0,
|
|
15585
|
-
/* @__PURE__ */ (0,
|
|
16261
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)("span", { className: "uix-color-picker__swatch", style: sampleStyle, "aria-hidden": "true" }),
|
|
16262
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)("span", { children: normalized })
|
|
15586
16263
|
]
|
|
15587
16264
|
}
|
|
15588
16265
|
),
|
|
15589
|
-
open && /* @__PURE__ */ (0,
|
|
16266
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(
|
|
15590
16267
|
"div",
|
|
15591
16268
|
{
|
|
15592
16269
|
ref: dialogRef,
|
|
@@ -15597,55 +16274,55 @@ function ColorPicker({
|
|
|
15597
16274
|
className: "uix-color-picker__popover",
|
|
15598
16275
|
onKeyDown: onDialogKeyDown,
|
|
15599
16276
|
children: [
|
|
15600
|
-
/* @__PURE__ */ (0,
|
|
15601
|
-
/* @__PURE__ */ (0,
|
|
16277
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { className: "uix-color-picker__preview", style: sampleStyle, children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("span", { style: { color: foreground }, children: labels.sample }) }),
|
|
16278
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("label", { className: "uix-color-picker__range", children: [
|
|
15602
16279
|
labels.hue,
|
|
15603
16280
|
" ",
|
|
15604
|
-
/* @__PURE__ */ (0,
|
|
16281
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("span", { children: [
|
|
15605
16282
|
Math.round(hsv.h),
|
|
15606
16283
|
"\xB0"
|
|
15607
16284
|
] }),
|
|
15608
|
-
/* @__PURE__ */ (0,
|
|
16285
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)("input", { type: "range", min: "0", max: "359", value: Math.round(hsv.h), onChange: (event) => updateHsv({ h: Number(event.currentTarget.value) }) })
|
|
15609
16286
|
] }),
|
|
15610
|
-
/* @__PURE__ */ (0,
|
|
16287
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("label", { className: "uix-color-picker__range", children: [
|
|
15611
16288
|
labels.saturation,
|
|
15612
16289
|
" ",
|
|
15613
|
-
/* @__PURE__ */ (0,
|
|
16290
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("span", { children: [
|
|
15614
16291
|
Math.round(hsv.s * 100),
|
|
15615
16292
|
"%"
|
|
15616
16293
|
] }),
|
|
15617
|
-
/* @__PURE__ */ (0,
|
|
16294
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)("input", { type: "range", min: "0", max: "100", value: Math.round(hsv.s * 100), onChange: (event) => updateHsv({ s: Number(event.currentTarget.value) / 100 }) })
|
|
15618
16295
|
] }),
|
|
15619
|
-
/* @__PURE__ */ (0,
|
|
16296
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("label", { className: "uix-color-picker__range", children: [
|
|
15620
16297
|
labels.brightness,
|
|
15621
16298
|
" ",
|
|
15622
|
-
/* @__PURE__ */ (0,
|
|
16299
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("span", { children: [
|
|
15623
16300
|
Math.round(hsv.v * 100),
|
|
15624
16301
|
"%"
|
|
15625
16302
|
] }),
|
|
15626
|
-
/* @__PURE__ */ (0,
|
|
16303
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)("input", { type: "range", min: "0", max: "100", value: Math.round(hsv.v * 100), onChange: (event) => updateHsv({ v: Number(event.currentTarget.value) / 100 }) })
|
|
15627
16304
|
] }),
|
|
15628
|
-
/* @__PURE__ */ (0,
|
|
16305
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("label", { className: "uix-color-picker__hex", children: [
|
|
15629
16306
|
labels.hex,
|
|
15630
|
-
/* @__PURE__ */ (0,
|
|
15631
|
-
/* @__PURE__ */ (0,
|
|
16307
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("span", { className: "uix-color-picker__hex-row", children: [
|
|
16308
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)("input", { className: "uix-input", value: hexText, onChange: (event) => setHexText(event.currentTarget.value), onBlur: commitHex, onKeyDown: (event) => {
|
|
15632
16309
|
if (event.key === "Enter") commitHex();
|
|
15633
16310
|
}, "aria-invalid": !normalizeHex(hexText) }),
|
|
15634
|
-
/* @__PURE__ */ (0,
|
|
16311
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)("button", { type: "button", className: "uix-btn uix-btn--secondary uix-btn--sm", onClick: commitHex, disabled: !normalizeHex(hexText), children: labels.set })
|
|
15635
16312
|
] })
|
|
15636
16313
|
] }),
|
|
15637
|
-
(presets.length > 0 || recent.length > 0) && /* @__PURE__ */ (0,
|
|
15638
|
-
presets.length > 0 && /* @__PURE__ */ (0,
|
|
15639
|
-
/* @__PURE__ */ (0,
|
|
15640
|
-
/* @__PURE__ */ (0,
|
|
16314
|
+
(presets.length > 0 || recent.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: "uix-color-picker__palettes", children: [
|
|
16315
|
+
presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("fieldset", { children: [
|
|
16316
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)("legend", { children: labels.presets }),
|
|
16317
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { children: presets.map((color) => /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("button", { type: "button", className: "uix-color-picker__preset", style: { backgroundColor: normalizeHex(color) ?? color }, onClick: () => choose(color), "aria-label": fillLabel(labels.usePreset, { color }) }, color)) })
|
|
15641
16318
|
] }),
|
|
15642
|
-
recent.length > 0 && /* @__PURE__ */ (0,
|
|
15643
|
-
/* @__PURE__ */ (0,
|
|
15644
|
-
/* @__PURE__ */ (0,
|
|
16319
|
+
recent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("fieldset", { children: [
|
|
16320
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)("legend", { children: labels.recent }),
|
|
16321
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { children: recent.map((color) => /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("button", { type: "button", className: "uix-color-picker__preset", style: { backgroundColor: normalizeHex(color) ?? color }, onClick: () => choose(color), "aria-label": fillLabel(labels.useRecent, { color }) }, color)) })
|
|
15645
16322
|
] })
|
|
15646
16323
|
] }),
|
|
15647
|
-
/* @__PURE__ */ (0,
|
|
15648
|
-
/* @__PURE__ */ (0,
|
|
16324
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)("p", { className: cx("uix-color-picker__contrast", passes ? "uix-color-picker__contrast--pass" : "uix-color-picker__contrast--fail"), role: "status", "aria-live": "polite", children: fillLabel(passes ? labels.contrastPasses : labels.contrastFails, { ratio: ratio.toFixed(2), minimum: minimumContrast }) }),
|
|
16325
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)("button", { type: "button", className: "uix-btn uix-btn--primary uix-btn--sm", onClick: close, children: labels.done })
|
|
15649
16326
|
]
|
|
15650
16327
|
}
|
|
15651
16328
|
)
|
|
@@ -15653,7 +16330,7 @@ function ColorPicker({
|
|
|
15653
16330
|
}
|
|
15654
16331
|
|
|
15655
16332
|
// src/components/BrandProfiles.tsx
|
|
15656
|
-
var
|
|
16333
|
+
var import_jsx_runtime105 = require("react/jsx-runtime");
|
|
15657
16334
|
var PROFILE_PROPERTIES = {
|
|
15658
16335
|
brand: "--uix-brand",
|
|
15659
16336
|
brandForeground: "--uix-brand-fg",
|
|
@@ -15745,7 +16422,7 @@ function BrandProfileEditor({
|
|
|
15745
16422
|
labels: labelOverrides
|
|
15746
16423
|
}) {
|
|
15747
16424
|
const labels = { ...DEFAULT_BRAND_PROFILE_EDITOR_LABELS, ...labelOverrides };
|
|
15748
|
-
const [announcement, setAnnouncement] = (0,
|
|
16425
|
+
const [announcement, setAnnouncement] = (0, import_react78.useState)("");
|
|
15749
16426
|
const update = (patch) => onChange({ ...value, ...patch });
|
|
15750
16427
|
const apply = () => {
|
|
15751
16428
|
if (applyTarget !== null) applyBrandProfile(value, applyTarget);
|
|
@@ -15762,54 +16439,54 @@ function BrandProfileEditor({
|
|
|
15762
16439
|
...value.typography?.sans ? { "--uix-font-sans": value.typography.sans } : {},
|
|
15763
16440
|
...value.typography?.heading ? { "--uix-font-heading": value.typography.heading } : {}
|
|
15764
16441
|
};
|
|
15765
|
-
return /* @__PURE__ */ (0,
|
|
15766
|
-
/* @__PURE__ */ (0,
|
|
15767
|
-
profiles.length > 0 && /* @__PURE__ */ (0,
|
|
16442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("section", { className: cx("uix-brand-profiles", className), "aria-label": labels.region, children: [
|
|
16443
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: "uix-brand-profiles__form", children: [
|
|
16444
|
+
profiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("label", { className: "uix-field__label", children: [
|
|
15768
16445
|
labels.profile,
|
|
15769
|
-
/* @__PURE__ */ (0,
|
|
16446
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("select", { className: "uix-select", value: value.id, onChange: (event) => {
|
|
15770
16447
|
const selected = profiles.find((profile) => profile.id === event.currentTarget.value);
|
|
15771
16448
|
if (selected) onSelectProfile?.(selected);
|
|
15772
|
-
}, children: profiles.map((profile) => /* @__PURE__ */ (0,
|
|
16449
|
+
}, children: profiles.map((profile) => /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("option", { value: profile.id, children: profile.name }, profile.id)) })
|
|
15773
16450
|
] }),
|
|
15774
|
-
/* @__PURE__ */ (0,
|
|
16451
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("label", { className: "uix-field__label", children: [
|
|
15775
16452
|
labels.name,
|
|
15776
|
-
/* @__PURE__ */ (0,
|
|
16453
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("input", { className: "uix-input", value: value.name, onChange: (event) => update({ name: event.currentTarget.value }) })
|
|
15777
16454
|
] }),
|
|
15778
|
-
/* @__PURE__ */ (0,
|
|
15779
|
-
/* @__PURE__ */ (0,
|
|
16455
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: "uix-brand-profiles__colors", children: [
|
|
16456
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("label", { children: [
|
|
15780
16457
|
labels.brand,
|
|
15781
|
-
/* @__PURE__ */ (0,
|
|
16458
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)(ColorPicker, { label: labels.brandColor, value: value.brand, foreground: value.brandForeground, presets: colorPresets, onChange: (brand) => update({ brand }) })
|
|
15782
16459
|
] }),
|
|
15783
|
-
/* @__PURE__ */ (0,
|
|
16460
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("label", { children: [
|
|
15784
16461
|
labels.onBrand,
|
|
15785
|
-
/* @__PURE__ */ (0,
|
|
16462
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)(ColorPicker, { label: labels.onBrandColor, value: value.brandForeground, foreground: value.brand, presets: colorPresets, onChange: (brandForeground) => update({ brandForeground }) })
|
|
15786
16463
|
] })
|
|
15787
16464
|
] }),
|
|
15788
|
-
/* @__PURE__ */ (0,
|
|
16465
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("label", { className: "uix-field__label", children: [
|
|
15789
16466
|
labels.bodyFont,
|
|
15790
|
-
/* @__PURE__ */ (0,
|
|
16467
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("input", { className: "uix-input", value: value.typography?.sans ?? "", onChange: (event) => update({ typography: { ...value.typography, sans: event.currentTarget.value || void 0 } }) })
|
|
15791
16468
|
] }),
|
|
15792
|
-
/* @__PURE__ */ (0,
|
|
16469
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("label", { className: "uix-field__label", children: [
|
|
15793
16470
|
labels.headingFont,
|
|
15794
|
-
/* @__PURE__ */ (0,
|
|
16471
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("input", { className: "uix-input", value: value.typography?.heading ?? "", onChange: (event) => update({ typography: { ...value.typography, heading: event.currentTarget.value || void 0 } }) })
|
|
15795
16472
|
] }),
|
|
15796
|
-
/* @__PURE__ */ (0,
|
|
16473
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("label", { className: "uix-file-upload uix-brand-profiles__upload", children: [
|
|
15797
16474
|
labels.logoFile,
|
|
15798
|
-
/* @__PURE__ */ (0,
|
|
16475
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("input", { type: "file", accept: "image/*", onChange: onFile })
|
|
15799
16476
|
] }),
|
|
15800
|
-
/* @__PURE__ */ (0,
|
|
15801
|
-
/* @__PURE__ */ (0,
|
|
16477
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("button", { type: "button", className: "uix-btn uix-btn--primary", onClick: apply, children: labels.apply }),
|
|
16478
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("span", { className: "uix-visually-hidden", "aria-live": "polite", children: announcement })
|
|
15802
16479
|
] }),
|
|
15803
|
-
/* @__PURE__ */ (0,
|
|
15804
|
-
/* @__PURE__ */ (0,
|
|
15805
|
-
value.logo ? /* @__PURE__ */ (0,
|
|
15806
|
-
/* @__PURE__ */ (0,
|
|
16480
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: "uix-brand-profiles__preview", style: previewStyle, "aria-label": fillLabel(labels.preview, { name: value.name }), children: [
|
|
16481
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: "uix-brand-profiles__preview-header", children: [
|
|
16482
|
+
value.logo ? /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("img", { src: value.logo.src, alt: value.logo.alt }) : /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("span", { className: "uix-brand-profiles__logo-placeholder", children: labels.logoPlaceholder }),
|
|
16483
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("strong", { children: value.name || labels.previewTitleFallback })
|
|
15807
16484
|
] }),
|
|
15808
|
-
/* @__PURE__ */ (0,
|
|
15809
|
-
/* @__PURE__ */ (0,
|
|
15810
|
-
/* @__PURE__ */ (0,
|
|
15811
|
-
/* @__PURE__ */ (0,
|
|
15812
|
-
/* @__PURE__ */ (0,
|
|
16485
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: "uix-brand-profiles__preview-body", children: [
|
|
16486
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("h3", { children: labels.previewHeading }),
|
|
16487
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("p", { children: labels.previewBody }),
|
|
16488
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("button", { type: "button", className: "uix-btn uix-btn--primary", children: labels.previewPrimary }),
|
|
16489
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("a", { href: "#brand-profile-preview", children: labels.previewLink })
|
|
15813
16490
|
] })
|
|
15814
16491
|
] })
|
|
15815
16492
|
] });
|
|
@@ -15817,7 +16494,7 @@ function BrandProfileEditor({
|
|
|
15817
16494
|
var BrandProfiles = BrandProfileEditor;
|
|
15818
16495
|
|
|
15819
16496
|
// src/components/DiffViewer.tsx
|
|
15820
|
-
var
|
|
16497
|
+
var import_react79 = require("react");
|
|
15821
16498
|
|
|
15822
16499
|
// src/diff-model.ts
|
|
15823
16500
|
function isJsonObject(value) {
|
|
@@ -15868,7 +16545,7 @@ function summarizeDiff(entries, resolutions = {}) {
|
|
|
15868
16545
|
}
|
|
15869
16546
|
|
|
15870
16547
|
// src/components/DiffViewer.tsx
|
|
15871
|
-
var
|
|
16548
|
+
var import_jsx_runtime106 = require("react/jsx-runtime");
|
|
15872
16549
|
var DEFAULT_DIFF_VIEWER_LABELS = {
|
|
15873
16550
|
base: "Base",
|
|
15874
16551
|
current: "Current",
|
|
@@ -15913,33 +16590,33 @@ function DiffViewer({
|
|
|
15913
16590
|
const labels = { ...DEFAULT_DIFF_VIEWER_LABELS, ...labelOverrides };
|
|
15914
16591
|
const resolutionLabel = { accept: labels.resolutionAccept, skip: labels.resolutionSkip, pending: labels.resolutionPending };
|
|
15915
16592
|
const buttonSize = controlSize === "md" ? void 0 : `uix-btn--${controlSize}`;
|
|
15916
|
-
const id = (0,
|
|
15917
|
-
const entries = (0,
|
|
15918
|
-
const [internalResolutions, setInternalResolutions] = (0,
|
|
16593
|
+
const id = (0, import_react79.useId)();
|
|
16594
|
+
const entries = (0, import_react79.useMemo)(() => providedEntries ?? buildThreeWayDiff(base, current, incoming), [providedEntries, base, current, incoming]);
|
|
16595
|
+
const [internalResolutions, setInternalResolutions] = (0, import_react79.useState)({});
|
|
15919
16596
|
const resolutions = controlledResolutions ?? internalResolutions;
|
|
15920
16597
|
const summary = summarizeDiff(entries, resolutions);
|
|
15921
16598
|
const resolve = (path, resolution) => {
|
|
15922
16599
|
if (controlledResolutions === void 0) setInternalResolutions((currentState) => ({ ...currentState, [path]: resolution }));
|
|
15923
16600
|
onResolutionChange?.(path, resolution);
|
|
15924
16601
|
};
|
|
15925
|
-
if (entries.length === 0) return /* @__PURE__ */ (0,
|
|
15926
|
-
/* @__PURE__ */ (0,
|
|
15927
|
-
/* @__PURE__ */ (0,
|
|
16602
|
+
if (entries.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("section", { className: cx("uix-diff-viewer uix-diff-viewer--empty", className), "aria-label": labels.region, children: [
|
|
16603
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("h3", { children: labels.noDifferences }),
|
|
16604
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("p", { children: labels.noDifferencesDetail })
|
|
15928
16605
|
] });
|
|
15929
|
-
return /* @__PURE__ */ (0,
|
|
15930
|
-
/* @__PURE__ */ (0,
|
|
15931
|
-
GROUPS.map((kind) => /* @__PURE__ */ (0,
|
|
15932
|
-
/* @__PURE__ */ (0,
|
|
16606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("section", { className: cx("uix-diff-viewer", className), "aria-label": labels.region, "data-control-size": controlSize, children: [
|
|
16607
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("div", { className: "uix-diff-viewer__summary", role: "group", "aria-label": labels.summary, children: [
|
|
16608
|
+
GROUPS.map((kind) => /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("span", { children: [
|
|
16609
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("b", { children: summary[kind] }),
|
|
15933
16610
|
" ",
|
|
15934
16611
|
labels[kind].toLowerCase()
|
|
15935
16612
|
] }, kind)),
|
|
15936
|
-
/* @__PURE__ */ (0,
|
|
15937
|
-
/* @__PURE__ */ (0,
|
|
16613
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("span", { children: [
|
|
16614
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("b", { children: summary.resolved }),
|
|
15938
16615
|
" ",
|
|
15939
16616
|
labels.resolved
|
|
15940
16617
|
] }),
|
|
15941
|
-
/* @__PURE__ */ (0,
|
|
15942
|
-
/* @__PURE__ */ (0,
|
|
16618
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("span", { children: [
|
|
16619
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("b", { children: summary.pending }),
|
|
15943
16620
|
" ",
|
|
15944
16621
|
labels.pending
|
|
15945
16622
|
] })
|
|
@@ -15947,38 +16624,38 @@ function DiffViewer({
|
|
|
15947
16624
|
GROUPS.map((kind) => {
|
|
15948
16625
|
const grouped = entries.filter((entry) => entry.kind === kind);
|
|
15949
16626
|
if (!grouped.length) return null;
|
|
15950
|
-
return /* @__PURE__ */ (0,
|
|
15951
|
-
/* @__PURE__ */ (0,
|
|
16627
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("section", { className: "uix-diff-viewer__group", "aria-labelledby": `${id}-${kind}`, children: [
|
|
16628
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("h3", { id: `${id}-${kind}`, children: [
|
|
15952
16629
|
labels[kind],
|
|
15953
16630
|
" ",
|
|
15954
|
-
/* @__PURE__ */ (0,
|
|
16631
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("span", { children: grouped.length })
|
|
15955
16632
|
] }),
|
|
15956
16633
|
grouped.map((entry) => {
|
|
15957
16634
|
const resolution = resolutions[entry.path] ?? "pending";
|
|
15958
|
-
return /* @__PURE__ */ (0,
|
|
15959
|
-
/* @__PURE__ */ (0,
|
|
15960
|
-
/* @__PURE__ */ (0,
|
|
15961
|
-
/* @__PURE__ */ (0,
|
|
16635
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("details", { className: "uix-diff-viewer__entry", "data-kind": entry.kind, open: entry.kind === "conflicted", children: [
|
|
16636
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("summary", { children: [
|
|
16637
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("code", { children: entry.path }),
|
|
16638
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)(StatusPill, { tone: resolution === "pending" ? "warning" : "success", children: resolutionLabel[resolution] })
|
|
15962
16639
|
] }),
|
|
15963
|
-
/* @__PURE__ */ (0,
|
|
15964
|
-
/* @__PURE__ */ (0,
|
|
15965
|
-
/* @__PURE__ */ (0,
|
|
16640
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: "uix-diff-viewer__versions", children: ["base", "current", "incoming"].map((version) => /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("div", { role: "region", "aria-label": fillLabel(labels.valueFor, { version: labels[version], path: entry.path }), children: [
|
|
16641
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("strong", { children: labels[version] }),
|
|
16642
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("pre", { children: renderValue(entry[version], labels.notPresent) })
|
|
15966
16643
|
] }, version)) }),
|
|
15967
|
-
/* @__PURE__ */ (0,
|
|
15968
|
-
/* @__PURE__ */ (0,
|
|
15969
|
-
/* @__PURE__ */ (0,
|
|
15970
|
-
/* @__PURE__ */ (0,
|
|
16644
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("div", { className: "uix-diff-viewer__actions", role: "group", "aria-label": fillLabel(labels.resolve, { path: entry.path }), children: [
|
|
16645
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("button", { type: "button", className: cx("uix-btn uix-btn--primary", buttonSize), "aria-label": fillLabel(labels.acceptIncomingFor, { path: entry.path }), "aria-pressed": resolution === "accept", onClick: () => resolve(entry.path, "accept"), children: labels.acceptIncoming }),
|
|
16646
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("button", { type: "button", className: cx("uix-btn uix-btn--secondary", buttonSize), "aria-label": fillLabel(labels.keepCurrentFor, { path: entry.path }), "aria-pressed": resolution === "skip", onClick: () => resolve(entry.path, "skip"), children: labels.keepCurrent }),
|
|
16647
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("button", { type: "button", className: cx("uix-btn uix-btn--ghost", buttonSize), "aria-label": fillLabel(labels.markPendingFor, { path: entry.path }), "aria-pressed": resolution === "pending", onClick: () => resolve(entry.path, "pending"), children: labels.markPending })
|
|
15971
16648
|
] })
|
|
15972
16649
|
] }, entry.path);
|
|
15973
16650
|
})
|
|
15974
16651
|
] }, kind);
|
|
15975
16652
|
}),
|
|
15976
|
-
/* @__PURE__ */ (0,
|
|
16653
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("p", { className: "uix-visually-hidden", "aria-live": "polite", children: fillLabel(labels.progress, { resolved: summary.resolved, total: entries.length }) })
|
|
15977
16654
|
] });
|
|
15978
16655
|
}
|
|
15979
16656
|
|
|
15980
16657
|
// src/components/TextDiff.tsx
|
|
15981
|
-
var
|
|
16658
|
+
var import_react80 = require("react");
|
|
15982
16659
|
|
|
15983
16660
|
// src/text-diff-model.ts
|
|
15984
16661
|
var WORD_TOKENS = /\s+|[\p{L}\p{M}\p{N}_]+|[^\s\p{L}\p{M}\p{N}_]/gu;
|
|
@@ -16238,7 +16915,7 @@ function textDiffRows(result, { context } = {}) {
|
|
|
16238
16915
|
}
|
|
16239
16916
|
|
|
16240
16917
|
// src/components/TextDiff.tsx
|
|
16241
|
-
var
|
|
16918
|
+
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
16242
16919
|
var DEFAULT_TEXT_DIFF_LABELS = {
|
|
16243
16920
|
before: "Before",
|
|
16244
16921
|
after: "After",
|
|
@@ -16251,47 +16928,47 @@ var DEFAULT_TEXT_DIFF_LABELS = {
|
|
|
16251
16928
|
};
|
|
16252
16929
|
function Marked({ segments, side, labels, whole }) {
|
|
16253
16930
|
const Tag = side === "before" ? "del" : "ins";
|
|
16254
|
-
return /* @__PURE__ */ (0,
|
|
16255
|
-
/* @__PURE__ */ (0,
|
|
16931
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_jsx_runtime107.Fragment, { children: segments.map((segment, i) => segment.changed ? /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(Tag, { "data-whole": whole || void 0, children: [
|
|
16932
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("span", { className: "uix-visually-hidden", children: [
|
|
16256
16933
|
side === "before" ? labels.removed : labels.added,
|
|
16257
16934
|
": "
|
|
16258
16935
|
] }),
|
|
16259
16936
|
segment.text
|
|
16260
|
-
] }, i) : /* @__PURE__ */ (0,
|
|
16937
|
+
] }, i) : /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_react80.Fragment, { children: segment.text }, i)) });
|
|
16261
16938
|
}
|
|
16262
16939
|
function Cell({ line, side, kind, labels }) {
|
|
16263
|
-
if (!line) return /* @__PURE__ */ (0,
|
|
16940
|
+
if (!line) return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "uix-text-diff__cell", "data-side": side, "data-empty": "", "aria-hidden": "true" });
|
|
16264
16941
|
const changed = kind !== "equal";
|
|
16265
|
-
return /* @__PURE__ */ (0,
|
|
16266
|
-
/* @__PURE__ */ (0,
|
|
16267
|
-
/* @__PURE__ */ (0,
|
|
16268
|
-
/* @__PURE__ */ (0,
|
|
16942
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: "uix-text-diff__cell", "data-side": side, "data-kind": changed ? side === "before" ? "delete" : "insert" : "equal", children: [
|
|
16943
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { className: "uix-text-diff__num", "aria-hidden": "true", children: line.number }),
|
|
16944
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { className: "uix-text-diff__sign", "aria-hidden": "true", children: changed ? side === "before" ? "\u2212" : "+" : "" }),
|
|
16945
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { className: "uix-text-diff__text", children: line.segments.length === 1 && line.segments[0].text === "" ? "\u200B" : /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Marked, { segments: line.segments, side, labels, whole: line.segments.length === 1 }) })
|
|
16269
16946
|
] });
|
|
16270
16947
|
}
|
|
16271
16948
|
function Rows({ rows, view, labels, focusFirst }) {
|
|
16272
|
-
const [open, setOpen] = (0,
|
|
16273
|
-
const first = (0,
|
|
16274
|
-
(0,
|
|
16949
|
+
const [open, setOpen] = (0, import_react80.useState)(() => /* @__PURE__ */ new Set());
|
|
16950
|
+
const first = (0, import_react80.useRef)(null);
|
|
16951
|
+
(0, import_react80.useEffect)(() => {
|
|
16275
16952
|
if (focusFirst) first.current?.focus();
|
|
16276
16953
|
}, [focusFirst]);
|
|
16277
16954
|
const firstProps = (index) => focusFirst && index === 0 ? { ref: first, tabIndex: -1 } : {};
|
|
16278
|
-
return /* @__PURE__ */ (0,
|
|
16955
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_jsx_runtime107.Fragment, { children: rows.map((row, index) => {
|
|
16279
16956
|
if (row.kind === "fold") {
|
|
16280
|
-
if (open.has(index)) return /* @__PURE__ */ (0,
|
|
16281
|
-
return /* @__PURE__ */ (0,
|
|
16957
|
+
if (open.has(index)) return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Rows, { rows: row.rows, view, labels, focusFirst: true }, index);
|
|
16958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "uix-text-diff__row", "data-kind": "fold", children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("button", { type: "button", className: "uix-text-diff__fold", onClick: () => setOpen((s) => new Set(s).add(index)), children: fillLabel(labels.showUnchanged, { count: row.count }) }) }, index);
|
|
16282
16959
|
}
|
|
16283
16960
|
const before = row.kind === "insert" ? void 0 : row.before;
|
|
16284
16961
|
const after = row.kind === "delete" ? void 0 : row.after;
|
|
16285
16962
|
if (view === "unified") {
|
|
16286
|
-
if (row.kind === "equal") return /* @__PURE__ */ (0,
|
|
16287
|
-
return /* @__PURE__ */ (0,
|
|
16288
|
-
before && /* @__PURE__ */ (0,
|
|
16289
|
-
after && /* @__PURE__ */ (0,
|
|
16963
|
+
if (row.kind === "equal") return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "uix-text-diff__row", "data-kind": "equal", ...firstProps(index), children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Cell, { line: after, side: "after", kind: "equal", labels }) }, index);
|
|
16964
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(import_react80.Fragment, { children: [
|
|
16965
|
+
before && /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "uix-text-diff__row", "data-kind": "delete", children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Cell, { line: before, side: "before", kind: row.kind, labels }) }),
|
|
16966
|
+
after && /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "uix-text-diff__row", "data-kind": "insert", children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Cell, { line: after, side: "after", kind: row.kind, labels }) })
|
|
16290
16967
|
] }, index);
|
|
16291
16968
|
}
|
|
16292
|
-
return /* @__PURE__ */ (0,
|
|
16293
|
-
/* @__PURE__ */ (0,
|
|
16294
|
-
/* @__PURE__ */ (0,
|
|
16969
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: "uix-text-diff__row", "data-kind": row.kind, ...firstProps(index), children: [
|
|
16970
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Cell, { line: before, side: "before", kind: row.kind, labels }),
|
|
16971
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Cell, { line: after, side: "after", kind: row.kind, labels })
|
|
16295
16972
|
] }, index);
|
|
16296
16973
|
}) });
|
|
16297
16974
|
}
|
|
@@ -16313,41 +16990,41 @@ function TextDiff({
|
|
|
16313
16990
|
}) {
|
|
16314
16991
|
const uixLabels = useUixLabels();
|
|
16315
16992
|
const labels = { ...DEFAULT_TEXT_DIFF_LABELS, ...uixLabels.textDiff, ...labelOverrides };
|
|
16316
|
-
const result = (0,
|
|
16317
|
-
const rows = (0,
|
|
16318
|
-
const heads = /* @__PURE__ */ (0,
|
|
16319
|
-
/* @__PURE__ */ (0,
|
|
16320
|
-
view === "unified" && /* @__PURE__ */ (0,
|
|
16993
|
+
const result = (0, import_react80.useMemo)(() => diffText(before, after, { granularity, maxTokens, maxEdits }), [before, after, granularity, maxTokens, maxEdits]);
|
|
16994
|
+
const rows = (0, import_react80.useMemo)(() => granularity === "line" && result.status === "ok" ? textDiffRows(result, { context }) : [], [result, granularity, context]);
|
|
16995
|
+
const heads = /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: "uix-text-diff__heads", "aria-hidden": view === "unified" || void 0, children: [
|
|
16996
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("span", { className: "uix-text-diff__head", "data-side": "before", children: [
|
|
16997
|
+
view === "unified" && /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { "aria-hidden": "true", children: "\u2212 " }),
|
|
16321
16998
|
beforeLabel ?? labels.before
|
|
16322
16999
|
] }),
|
|
16323
|
-
/* @__PURE__ */ (0,
|
|
16324
|
-
view === "unified" && /* @__PURE__ */ (0,
|
|
17000
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("span", { className: "uix-text-diff__head", "data-side": "after", children: [
|
|
17001
|
+
view === "unified" && /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { "aria-hidden": "true", children: "+ " }),
|
|
16325
17002
|
afterLabel ?? labels.after
|
|
16326
17003
|
] })
|
|
16327
17004
|
] });
|
|
16328
17005
|
const unchanged = result.status === "ok" && result.added === 0 && result.removed === 0 && result.ops.every((op) => op.type === "equal");
|
|
16329
17006
|
let body;
|
|
16330
|
-
if (result.status === "too-large") body = /* @__PURE__ */ (0,
|
|
16331
|
-
else if (granularity === "line") body = /* @__PURE__ */ (0,
|
|
17007
|
+
if (result.status === "too-large") body = /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "uix-text-diff__note", children: labels.tooLarge });
|
|
17008
|
+
else if (granularity === "line") body = /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "uix-text-diff__body", children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Rows, { rows, view, labels }) });
|
|
16332
17009
|
else {
|
|
16333
|
-
const prose = (side2) => /* @__PURE__ */ (0,
|
|
17010
|
+
const prose = (side2) => /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "uix-text-diff__prose", "data-side": side2, children: result.ops.map((op, i) => {
|
|
16334
17011
|
const text = op.tokens.join("");
|
|
16335
|
-
if (op.type === "equal") return /* @__PURE__ */ (0,
|
|
17012
|
+
if (op.type === "equal") return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_react80.Fragment, { children: text }, i);
|
|
16336
17013
|
if (op.type === "delete" && side2 === "after") return null;
|
|
16337
17014
|
if (op.type === "insert" && side2 === "before") return null;
|
|
16338
|
-
return /* @__PURE__ */ (0,
|
|
17015
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Marked, { segments: [{ text, changed: true }], side: op.type === "delete" ? "before" : "after", labels }, i);
|
|
16339
17016
|
}) });
|
|
16340
|
-
const side = (which) => /* @__PURE__ */ (0,
|
|
16341
|
-
/* @__PURE__ */ (0,
|
|
17017
|
+
const side = (which) => /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: "uix-text-diff__side", children: [
|
|
17018
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "uix-text-diff__head", children: which === "before" ? beforeLabel ?? labels.before : afterLabel ?? labels.after }),
|
|
16342
17019
|
prose(which)
|
|
16343
17020
|
] });
|
|
16344
|
-
body = /* @__PURE__ */ (0,
|
|
17021
|
+
body = /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "uix-text-diff__body", children: view === "unified" ? prose("both") : /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: "uix-text-diff__row", "data-kind": "prose", children: [
|
|
16345
17022
|
side("before"),
|
|
16346
17023
|
side("after")
|
|
16347
17024
|
] }) });
|
|
16348
17025
|
}
|
|
16349
|
-
return /* @__PURE__ */ (0,
|
|
16350
|
-
!hideSummary && result.status === "ok" && /* @__PURE__ */ (0,
|
|
17026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { role: "group", "aria-label": label, className: cx("uix-text-diff", className), "data-view": view, "data-granularity": granularity, ...props, children: [
|
|
17027
|
+
!hideSummary && result.status === "ok" && /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "uix-text-diff__summary", children: unchanged ? labels.noChanges : fillLabel(labels.summary, { added: result.added, removed: result.removed }) }),
|
|
16351
17028
|
!(granularity === "word" && view === "split" && result.status === "ok") && heads,
|
|
16352
17029
|
body
|
|
16353
17030
|
] });
|
|
@@ -16408,6 +17085,7 @@ function TextDiff({
|
|
|
16408
17085
|
DEFAULT_INSIGHT_CARD_LABELS,
|
|
16409
17086
|
DEFAULT_LIGHTBOX_LABELS,
|
|
16410
17087
|
DEFAULT_MATCH_REVIEW_LABELS,
|
|
17088
|
+
DEFAULT_ORG_CHART_LABELS,
|
|
16411
17089
|
DEFAULT_PAGINATION_LABELS,
|
|
16412
17090
|
DEFAULT_PRESENCE_LABELS,
|
|
16413
17091
|
DEFAULT_RELATIONSHIP_GRAPH_LABELS,
|
|
@@ -16492,6 +17170,7 @@ function TextDiff({
|
|
|
16492
17170
|
NotFoundState,
|
|
16493
17171
|
Note,
|
|
16494
17172
|
NoticeQueue,
|
|
17173
|
+
OrgChart,
|
|
16495
17174
|
PageHeader,
|
|
16496
17175
|
PageIntro,
|
|
16497
17176
|
Pagination,
|
|
@@ -16627,6 +17306,8 @@ function TextDiff({
|
|
|
16627
17306
|
nextSortDir,
|
|
16628
17307
|
normalQuantile,
|
|
16629
17308
|
normalizeHex,
|
|
17309
|
+
orgChartInitials,
|
|
17310
|
+
orgChartZoomStep,
|
|
16630
17311
|
packLanes,
|
|
16631
17312
|
parseDateInput,
|
|
16632
17313
|
parseDateValue,
|