@tensor_1/react 2.36.0 → 2.37.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 +13 -0
- package/dist/components/SchedulingAgenda.js +3 -1
- package/dist/components/SchedulingTimeGrid.js +6 -4
- package/dist/components/SchedulingTimeline.js +5 -2
- package/dist/hooks/usePrinting.d.ts +15 -0
- package/dist/hooks/usePrinting.js +29 -0
- package/dist/index.cjs +264 -230
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9375,7 +9375,7 @@ function BuilderCanvas({
|
|
|
9375
9375
|
}
|
|
9376
9376
|
|
|
9377
9377
|
// src/components/SchedulingCalendar.tsx
|
|
9378
|
-
var
|
|
9378
|
+
var import_react63 = require("react");
|
|
9379
9379
|
|
|
9380
9380
|
// src/calendar-model.ts
|
|
9381
9381
|
function fromDateKey(value) {
|
|
@@ -9803,7 +9803,36 @@ function proposeMove(span, delta, timeZone) {
|
|
|
9803
9803
|
}
|
|
9804
9804
|
|
|
9805
9805
|
// src/components/SchedulingAgenda.tsx
|
|
9806
|
+
var import_react61 = require("react");
|
|
9807
|
+
|
|
9808
|
+
// src/hooks/usePrinting.ts
|
|
9806
9809
|
var import_react60 = require("react");
|
|
9810
|
+
var import_react_dom = require("react-dom");
|
|
9811
|
+
function usePrinting(enabled = true) {
|
|
9812
|
+
const [printing, setPrinting] = (0, import_react60.useState)(false);
|
|
9813
|
+
(0, import_react60.useEffect)(() => {
|
|
9814
|
+
if (!enabled || typeof window === "undefined") return void 0;
|
|
9815
|
+
const set = (next) => {
|
|
9816
|
+
(0, import_react_dom.flushSync)(() => setPrinting(next));
|
|
9817
|
+
};
|
|
9818
|
+
const before = () => set(true);
|
|
9819
|
+
const after = () => set(false);
|
|
9820
|
+
const query = typeof window.matchMedia === "function" ? window.matchMedia("print") : null;
|
|
9821
|
+
const changed = (event) => set(event.matches);
|
|
9822
|
+
window.addEventListener("beforeprint", before);
|
|
9823
|
+
window.addEventListener("afterprint", after);
|
|
9824
|
+
query?.addEventListener?.("change", changed);
|
|
9825
|
+
setPrinting(Boolean(query?.matches));
|
|
9826
|
+
return () => {
|
|
9827
|
+
window.removeEventListener("beforeprint", before);
|
|
9828
|
+
window.removeEventListener("afterprint", after);
|
|
9829
|
+
query?.removeEventListener?.("change", changed);
|
|
9830
|
+
};
|
|
9831
|
+
}, [enabled]);
|
|
9832
|
+
return enabled && printing;
|
|
9833
|
+
}
|
|
9834
|
+
|
|
9835
|
+
// src/components/SchedulingAgenda.tsx
|
|
9807
9836
|
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
9808
9837
|
var AGENDA_VIRTUAL_ROW = 44;
|
|
9809
9838
|
var AGENDA_NARROW_WIDTH = 576;
|
|
@@ -9856,10 +9885,11 @@ function AgendaBody({
|
|
|
9856
9885
|
if ((group.continuesCount ?? 0) > 0) flatRows.push({ kind: "continues", key: `c-${groupKey}`, group });
|
|
9857
9886
|
});
|
|
9858
9887
|
}
|
|
9859
|
-
const [narrow, setNarrow] = (0,
|
|
9860
|
-
const
|
|
9888
|
+
const [narrow, setNarrow] = (0, import_react61.useState)(false);
|
|
9889
|
+
const printing = usePrinting(flat);
|
|
9890
|
+
const virtual = useVirtualRows(flatRows, { rowHeight: narrow ? AGENDA_NARROW_ROW : AGENDA_VIRTUAL_ROW, threshold: 0, estimatedViewportHeight: AGENDA_VIRTUAL_VIEWPORT, enabled: !printing });
|
|
9861
9891
|
const scroller = virtual.containerRef;
|
|
9862
|
-
(0,
|
|
9892
|
+
(0, import_react61.useLayoutEffect)(() => {
|
|
9863
9893
|
const box = scroller.current;
|
|
9864
9894
|
if (!box) return;
|
|
9865
9895
|
const measure = () => setNarrow(box.clientWidth > 0 && box.clientWidth <= AGENDA_NARROW_WIDTH);
|
|
@@ -9868,8 +9898,8 @@ function AgendaBody({
|
|
|
9868
9898
|
observer.observe(box);
|
|
9869
9899
|
return () => observer.disconnect();
|
|
9870
9900
|
}, [scroller]);
|
|
9871
|
-
const grouped = (0,
|
|
9872
|
-
(0,
|
|
9901
|
+
const grouped = (0, import_react61.useRef)(null);
|
|
9902
|
+
(0, import_react61.useLayoutEffect)(() => {
|
|
9873
9903
|
const box = grouped.current;
|
|
9874
9904
|
if (!box) return;
|
|
9875
9905
|
const observer = new ResizeObserver((entries) => {
|
|
@@ -9881,7 +9911,7 @@ function AgendaBody({
|
|
|
9881
9911
|
box.querySelectorAll(":scope > section > .uix-scheduling-calendar__agenda-head").forEach((head) => observer.observe(head));
|
|
9882
9912
|
return () => observer.disconnect();
|
|
9883
9913
|
}, [groups]);
|
|
9884
|
-
const stop = (0,
|
|
9914
|
+
const stop = (0, import_react61.useRef)({ node: null, index: 0 });
|
|
9885
9915
|
const container = () => flat ? scroller.current : grouped.current;
|
|
9886
9916
|
const controls = () => Array.from(container()?.querySelectorAll("button") ?? []);
|
|
9887
9917
|
const focusStop = (target) => {
|
|
@@ -9906,7 +9936,7 @@ function AgendaBody({
|
|
|
9906
9936
|
const scrollToRow = (box, index) => {
|
|
9907
9937
|
box.scrollTop = Math.max(0, index * rowHeight - (box.clientHeight - rowHeight) / 2);
|
|
9908
9938
|
};
|
|
9909
|
-
const landing = (0,
|
|
9939
|
+
const landing = (0, import_react61.useRef)(null);
|
|
9910
9940
|
const land = () => {
|
|
9911
9941
|
const wanted = landing.current;
|
|
9912
9942
|
if (!wanted) return;
|
|
@@ -9927,7 +9957,7 @@ function AgendaBody({
|
|
|
9927
9957
|
scrollToRow(box, index);
|
|
9928
9958
|
}
|
|
9929
9959
|
};
|
|
9930
|
-
(0,
|
|
9960
|
+
(0, import_react61.useEffect)(() => {
|
|
9931
9961
|
const all = controls();
|
|
9932
9962
|
stop.current = syncRovingStop(all, stop.current);
|
|
9933
9963
|
const box = flat ? scroller.current : null;
|
|
@@ -9983,7 +10013,7 @@ function AgendaBody({
|
|
|
9983
10013
|
overlay.scopeLabel && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { className: "uix-scheduling-calendar__window-scope", children: overlay.scopeLabel })
|
|
9984
10014
|
] }) });
|
|
9985
10015
|
const heading = (group, withNotes) => /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "uix-scheduling-calendar__agenda-head", children: [
|
|
9986
|
-
(0,
|
|
10016
|
+
(0, import_react61.createElement)(`h${headingLevel}`, { className: "uix-scheduling-calendar__agenda-heading" }, group.heading ?? dateText(group.date, "day")),
|
|
9987
10017
|
withNotes && group.annotations && group.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("ul", { className: "uix-scheduling-calendar__agenda-notes", children: uniqueKeys(group.annotations.map((overlay) => overlay.id)).map((key, at) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("li", { children: note(group.annotations[at]) }, key)) })
|
|
9988
10018
|
] });
|
|
9989
10019
|
const timeText = (entry, date) => {
|
|
@@ -10053,7 +10083,7 @@ function AgendaBody({
|
|
|
10053
10083
|
}
|
|
10054
10084
|
|
|
10055
10085
|
// src/components/SchedulingTimeGrid.tsx
|
|
10056
|
-
var
|
|
10086
|
+
var import_react62 = require("react");
|
|
10057
10087
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
10058
10088
|
var HOUR_MS2 = 36e5;
|
|
10059
10089
|
var MINUTES_PER_HOUR = 60;
|
|
@@ -10067,7 +10097,7 @@ function uniqueById(items) {
|
|
|
10067
10097
|
const seen = /* @__PURE__ */ new Set();
|
|
10068
10098
|
return items.filter((item) => seen.has(item.id) ? false : (seen.add(item.id), true));
|
|
10069
10099
|
}
|
|
10070
|
-
var GridItem = (0,
|
|
10100
|
+
var GridItem = (0, import_react62.memo)(function GridItem2({ entry, segment, column, alone, name, status, movable, hintId, timeZone, continuesFrom, markers, renderEntry, renderMarker: renderMarker2, handlers }) {
|
|
10071
10101
|
const lines = linesFor(segment);
|
|
10072
10102
|
const continuation = segment.part === "continuation";
|
|
10073
10103
|
const style = vars({
|
|
@@ -10076,16 +10106,18 @@ var GridItem = (0, import_react61.memo)(function GridItem2({ entry, segment, col
|
|
|
10076
10106
|
"--uix-scheduling-calendar-lane": segment.lane,
|
|
10077
10107
|
"--uix-scheduling-calendar-lanes": segment.laneCount
|
|
10078
10108
|
});
|
|
10079
|
-
const
|
|
10109
|
+
const custom = renderEntry?.(entry, { availableLines: lines });
|
|
10110
|
+
const text = custom ?? /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
|
|
10080
10111
|
!continuation && /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
|
|
10081
10112
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "uix-scheduling-calendar__time", children: zonedTimeOfDay(entry.start, timeZone) }),
|
|
10082
10113
|
" "
|
|
10083
10114
|
] }),
|
|
10084
10115
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "uix-scheduling-calendar__title", children: entry.title })
|
|
10085
|
-
] })
|
|
10116
|
+
] });
|
|
10117
|
+
const noRoom = lines === 0 && (custom === void 0 || custom === null) ? "none" : void 0;
|
|
10086
10118
|
const body = /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
|
|
10087
|
-
continuation &&
|
|
10088
|
-
(!continuation || alone) && text != null && text !== false && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "uix-scheduling-calendar__entry-text", children: text }),
|
|
10119
|
+
continuation && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "uix-scheduling-calendar__tg-from", "data-room": lines === 0 ? "none" : void 0, children: continuesFrom }),
|
|
10120
|
+
(!continuation || alone) && text != null && text !== false && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "uix-scheduling-calendar__entry-text", "data-room": noRoom, children: text }),
|
|
10089
10121
|
markers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "uix-scheduling-calendar__markers", children: markers.map((marker) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { children: renderMarker2(marker) }, marker.id)) })
|
|
10090
10122
|
] });
|
|
10091
10123
|
const shared = {
|
|
@@ -10150,20 +10182,20 @@ function SchedulingTimeGrid({
|
|
|
10150
10182
|
emptyNote,
|
|
10151
10183
|
nothingToShow
|
|
10152
10184
|
}) {
|
|
10153
|
-
const rootRef = (0,
|
|
10154
|
-
const hintId = (0,
|
|
10155
|
-
const [widthCap, setWidthCap] = (0,
|
|
10156
|
-
const [ghost, setGhost] = (0,
|
|
10157
|
-
const [announcement, setAnnouncement] = (0,
|
|
10158
|
-
const [activeDay, setActiveDay] = (0,
|
|
10159
|
-
const enteredFrom = (0,
|
|
10185
|
+
const rootRef = (0, import_react62.useRef)(null);
|
|
10186
|
+
const hintId = (0, import_react62.useId)();
|
|
10187
|
+
const [widthCap, setWidthCap] = (0, import_react62.useState)(Infinity);
|
|
10188
|
+
const [ghost, setGhost] = (0, import_react62.useState)(null);
|
|
10189
|
+
const [announcement, setAnnouncement] = (0, import_react62.useState)("");
|
|
10190
|
+
const [activeDay, setActiveDay] = (0, import_react62.useState)(days[0]);
|
|
10191
|
+
const enteredFrom = (0, import_react62.useRef)(null);
|
|
10160
10192
|
const tabStop = days.includes(activeDay) ? activeDay : days[0];
|
|
10161
10193
|
const moving = canMove && onProposeMove !== void 0;
|
|
10162
10194
|
const step = Number.isFinite(givenStep) && givenStep > 0 ? givenStep : DEFAULT_STEP;
|
|
10163
|
-
const laneOptions = (0,
|
|
10164
|
-
const entries = (0,
|
|
10165
|
-
const overlays = (0,
|
|
10166
|
-
(0,
|
|
10195
|
+
const laneOptions = (0, import_react62.useMemo)(() => ({ crossMidnightMinutes: topLaneCrossMidnightMinutes }), [topLaneCrossMidnightMinutes]);
|
|
10196
|
+
const entries = (0, import_react62.useMemo)(() => uniqueById(givenEntries), [givenEntries]);
|
|
10197
|
+
const overlays = (0, import_react62.useMemo)(() => uniqueById(givenOverlays), [givenOverlays]);
|
|
10198
|
+
(0, import_react62.useEffect)(() => {
|
|
10167
10199
|
const root = rootRef.current;
|
|
10168
10200
|
if (!root || typeof ResizeObserver === "undefined") return void 0;
|
|
10169
10201
|
const column = root.querySelector("[data-tg-column]");
|
|
@@ -10188,17 +10220,17 @@ function SchedulingTimeGrid({
|
|
|
10188
10220
|
};
|
|
10189
10221
|
}, [days]);
|
|
10190
10222
|
const lanes = Math.max(1, Math.min(maxLanes, widthCap));
|
|
10191
|
-
const entryById = (0,
|
|
10192
|
-
const overlayById = (0,
|
|
10193
|
-
const columns = (0,
|
|
10194
|
-
const slots = (0,
|
|
10195
|
-
const top = (0,
|
|
10196
|
-
const drawable = (0,
|
|
10197
|
-
const strip = (0,
|
|
10198
|
-
const shades = (0,
|
|
10223
|
+
const entryById = (0, import_react62.useMemo)(() => new Map(entries.map((entry) => [entry.id, entry])), [entries]);
|
|
10224
|
+
const overlayById = (0, import_react62.useMemo)(() => new Map(overlays.map((overlay) => [overlay.id, overlay])), [overlays]);
|
|
10225
|
+
const columns = (0, import_react62.useMemo)(() => days.map((date) => layoutTimeGridDay(entries, date, timeZone, { ...laneOptions, maxLanes: lanes })), [days, entries, timeZone, laneOptions, lanes]);
|
|
10226
|
+
const slots = (0, import_react62.useMemo)(() => days.map((date) => zonedHourSlots(date, timeZone)), [days, timeZone]);
|
|
10227
|
+
const top = (0, import_react62.useMemo)(() => layoutDaySpans(entries.filter((entry) => placesInTopLane(entry, timeZone, laneOptions)), days, { timeZone, laneCap: Math.max(0, topLaneCap) }), [entries, days, timeZone, laneOptions, topLaneCap]);
|
|
10228
|
+
const drawable = (0, import_react62.useMemo)(() => overlays.filter((overlay) => new Date(overlay.end).getTime() >= new Date(overlay.start).getTime()), [overlays]);
|
|
10229
|
+
const strip = (0, import_react62.useMemo)(() => layoutDaySpans(drawable, days, { timeZone, laneCap: Math.max(0, windowLaneCap) }), [drawable, days, timeZone, windowLaneCap]);
|
|
10230
|
+
const shades = (0, import_react62.useMemo)(() => layoutDaySpans(drawable.filter((overlay) => overlay.global), days, { timeZone }).placed, [drawable, days, timeZone]);
|
|
10199
10231
|
const lanesIn = (placed) => placed.reduce((max, span) => Math.max(max, span.lane + 1), 0);
|
|
10200
10232
|
const maxHours = Math.max(...columns.map((column) => column.dayHours));
|
|
10201
|
-
const gutterIndex = (0,
|
|
10233
|
+
const gutterIndex = (0, import_react62.useMemo)(() => {
|
|
10202
10234
|
const signatures = slots.map(slotSignature);
|
|
10203
10235
|
const count2 = /* @__PURE__ */ new Map();
|
|
10204
10236
|
for (const signature of signatures) count2.set(signature, (count2.get(signature) ?? 0) + 1);
|
|
@@ -10223,15 +10255,15 @@ function SchedulingTimeGrid({
|
|
|
10223
10255
|
slot.instant.getTime()
|
|
10224
10256
|
));
|
|
10225
10257
|
const movable = (entry) => moving && entry.movable !== false;
|
|
10226
|
-
const live = (0,
|
|
10258
|
+
const live = (0, import_react62.useRef)({ ghost, entryById, timeZone, step, onProposeMove, onSelectEntry, labels, formatInstant, days, columns, movable });
|
|
10227
10259
|
live.current = { ghost, entryById, timeZone, step, onProposeMove, onSelectEntry, labels, formatInstant, days, columns, movable };
|
|
10228
|
-
const dragRef = (0,
|
|
10229
|
-
const suppressClick = (0,
|
|
10230
|
-
const refocus = (0,
|
|
10231
|
-
(0,
|
|
10260
|
+
const dragRef = (0, import_react62.useRef)(null);
|
|
10261
|
+
const suppressClick = (0, import_react62.useRef)(false);
|
|
10262
|
+
const refocus = (0, import_react62.useRef)(null);
|
|
10263
|
+
(0, import_react62.useEffect)(() => {
|
|
10232
10264
|
if (ghost && !entryById.has(ghost.id)) setGhost(null);
|
|
10233
10265
|
}, [ghost, entryById]);
|
|
10234
|
-
(0,
|
|
10266
|
+
(0, import_react62.useEffect)(() => {
|
|
10235
10267
|
const id = refocus.current;
|
|
10236
10268
|
const root = rootRef.current;
|
|
10237
10269
|
if (!id || !root) return;
|
|
@@ -10248,7 +10280,7 @@ function SchedulingTimeGrid({
|
|
|
10248
10280
|
}
|
|
10249
10281
|
}
|
|
10250
10282
|
});
|
|
10251
|
-
const send = (0,
|
|
10283
|
+
const send = (0, import_react62.useCallback)((id, delta) => {
|
|
10252
10284
|
const state = live.current;
|
|
10253
10285
|
const entry = state.entryById.get(id);
|
|
10254
10286
|
if (!entry || !state.onProposeMove || !state.movable(entry) || delta.days === 0 && delta.minutes === 0) {
|
|
@@ -10263,7 +10295,7 @@ function SchedulingTimeGrid({
|
|
|
10263
10295
|
result.then(clear, clear);
|
|
10264
10296
|
} else setGhost(null);
|
|
10265
10297
|
}, []);
|
|
10266
|
-
const handlers = (0,
|
|
10298
|
+
const handlers = (0, import_react62.useMemo)(() => ({
|
|
10267
10299
|
click: (entry) => {
|
|
10268
10300
|
live.current.onSelectEntry?.(entry);
|
|
10269
10301
|
},
|
|
@@ -10386,7 +10418,7 @@ function SchedulingTimeGrid({
|
|
|
10386
10418
|
};
|
|
10387
10419
|
}
|
|
10388
10420
|
}), [send]);
|
|
10389
|
-
(0,
|
|
10421
|
+
(0, import_react62.useEffect)(() => () => {
|
|
10390
10422
|
dragRef.current?.stop();
|
|
10391
10423
|
dragRef.current = null;
|
|
10392
10424
|
}, []);
|
|
@@ -10799,27 +10831,27 @@ function SchedulingCalendar({
|
|
|
10799
10831
|
};
|
|
10800
10832
|
const stateLabel = labels.states;
|
|
10801
10833
|
const viewLabel = { month: labels.viewMonth, week: labels.viewWeek, day: labels.viewDay, agenda: labels.viewAgenda };
|
|
10802
|
-
const [internalView, setInternalView] = (0,
|
|
10834
|
+
const [internalView, setInternalView] = (0, import_react63.useState)("month");
|
|
10803
10835
|
const view = controlledView ?? internalView;
|
|
10804
|
-
const [activeDate, setActiveDate] = (0,
|
|
10805
|
-
const [expandedDates, setExpandedDates] = (0,
|
|
10836
|
+
const [activeDate, setActiveDate] = (0, import_react63.useState)(anchorDate);
|
|
10837
|
+
const [expandedDates, setExpandedDates] = (0, import_react63.useState)(() => /* @__PURE__ */ new Set());
|
|
10806
10838
|
const dateText = (date, part) => formatDate?.(date, part) ?? cachedDateTimeFormat(locale, INTL_PARTS[part]).format(utcDate(date));
|
|
10807
10839
|
const formatInstant = (instant) => formatInstantProp?.(instant) ?? `${dateText(zonedDateKey(instant, timeZone), "day")} ${zonedTimeOfDay(instant, timeZone)}`;
|
|
10808
|
-
const gridRef = (0,
|
|
10840
|
+
const gridRef = (0, import_react63.useRef)(null);
|
|
10809
10841
|
const picksGiven = dayEntries !== void 0;
|
|
10810
10842
|
const controlled = picksGiven || dayInfo !== void 0;
|
|
10811
10843
|
const countsOnly = monthDensity === "counts" && view === "month";
|
|
10812
10844
|
const fixed = controlled || maxEntriesPerDay !== void 0 && onShowMore !== void 0 || countsOnly;
|
|
10813
10845
|
const windowCap = Math.max(0, windowLaneCap ?? (fixed ? DEFAULT_LANE_CAP2 : Infinity));
|
|
10814
10846
|
const spanCap = Math.max(0, spanLaneCap ?? (fixed ? DEFAULT_LANE_CAP2 : Infinity));
|
|
10815
|
-
const visibleEntries = (0,
|
|
10816
|
-
const monthDays = (0,
|
|
10847
|
+
const visibleEntries = (0, import_react63.useMemo)(() => entries.filter((entry) => filter?.(entry) ?? true), [entries, filter]);
|
|
10848
|
+
const monthDays = (0, import_react63.useMemo)(() => buildMonthGrid(startOfMonth(anchorDate), weekStartsOn), [anchorDate, weekStartsOn]);
|
|
10817
10849
|
const weekday = (utcDate(anchorDate).getUTCDay() - weekStartsOn + 7) % 7;
|
|
10818
10850
|
const weekStart = addCalendarDays(anchorDate, -weekday);
|
|
10819
|
-
const weekDays = (0,
|
|
10820
|
-
const days = (0,
|
|
10851
|
+
const weekDays = (0, import_react63.useMemo)(() => Array.from({ length: 7 }, (_, index) => addCalendarDays(weekStart, index)), [weekStart]);
|
|
10852
|
+
const days = (0, import_react63.useMemo)(() => view === "month" ? monthDays.map((day) => day.date) : view === "day" ? [anchorDate] : weekDays, [view, monthDays, weekDays, anchorDate]);
|
|
10821
10853
|
const timeGridView = view === "day" || view === "week" && timeGrid;
|
|
10822
|
-
const { singles, multiDay, coverage } = (0,
|
|
10854
|
+
const { singles, multiDay, coverage } = (0, import_react63.useMemo)(() => {
|
|
10823
10855
|
const byDay = /* @__PURE__ */ new Map();
|
|
10824
10856
|
const spans = [];
|
|
10825
10857
|
const every = [];
|
|
@@ -10834,9 +10866,9 @@ function SchedulingCalendar({
|
|
|
10834
10866
|
}
|
|
10835
10867
|
return { singles: byDay, multiDay: spans, coverage: every };
|
|
10836
10868
|
}, [visibleEntries, timeZone]);
|
|
10837
|
-
const entryById = (0,
|
|
10838
|
-
const overlayById = (0,
|
|
10839
|
-
const layout = (0,
|
|
10869
|
+
const entryById = (0, import_react63.useMemo)(() => new Map([...multiDay].reverse().map(({ entry }) => [entry.id, entry])), [multiDay]);
|
|
10870
|
+
const overlayById = (0, import_react63.useMemo)(() => new Map([...overlays].reverse().map((overlay) => [overlay.id, overlay])), [overlays]);
|
|
10871
|
+
const layout = (0, import_react63.useMemo)(() => {
|
|
10840
10872
|
if (spanLayout) return spanLayout;
|
|
10841
10873
|
if (view === "agenda" || timeGridView) return { placed: [], hiddenByRow: {}, firstHiddenDayByRow: {} };
|
|
10842
10874
|
const inputs = [];
|
|
@@ -10854,7 +10886,7 @@ function SchedulingCalendar({
|
|
|
10854
10886
|
}
|
|
10855
10887
|
return layoutMonthSpans(inputs, days, { timeZone, laneCap: { window: windowCap, item: spanCap } });
|
|
10856
10888
|
}, [spanLayout, view, timeGridView, overlays, multiDay, days, timeZone, windowCap, spanCap, countsOnly]);
|
|
10857
|
-
const placedByRow = (0,
|
|
10889
|
+
const placedByRow = (0, import_react63.useMemo)(() => {
|
|
10858
10890
|
const rows = /* @__PURE__ */ new Map();
|
|
10859
10891
|
for (const placed of layout.placed) {
|
|
10860
10892
|
const row = rows.get(placed.weekRow);
|
|
@@ -10865,7 +10897,7 @@ function SchedulingCalendar({
|
|
|
10865
10897
|
}, [layout]);
|
|
10866
10898
|
const lanesUsed = (row, group) => (placedByRow.get(row) ?? []).reduce((max, placed) => placed.group === group ? Math.max(max, placed.lane + 1) : max, 0);
|
|
10867
10899
|
const lanesUsedAnywhere = (group) => layout.placed.reduce((max, placed) => placed.group === group ? Math.max(max, placed.lane + 1) : max, 0);
|
|
10868
|
-
(0,
|
|
10900
|
+
(0, import_react63.useEffect)(() => {
|
|
10869
10901
|
if (view !== "agenda" && !days.includes(activeDate)) setActiveDate(days[0]);
|
|
10870
10902
|
}, [activeDate, days, view]);
|
|
10871
10903
|
const setView = (next) => {
|
|
@@ -10881,7 +10913,7 @@ function SchedulingCalendar({
|
|
|
10881
10913
|
setActiveDate(date);
|
|
10882
10914
|
requestAnimationFrame(() => gridRef.current?.querySelector(`[data-calendar-date="${date}"]`)?.focus());
|
|
10883
10915
|
};
|
|
10884
|
-
const enteredFrom = (0,
|
|
10916
|
+
const enteredFrom = (0, import_react63.useRef)(null);
|
|
10885
10917
|
const cellOf = (date) => gridRef.current?.querySelector(`[data-calendar-date="${date}"]`)?.closest(".uix-scheduling-calendar__day") ?? null;
|
|
10886
10918
|
const dayRing = (date) => {
|
|
10887
10919
|
const cell = cellOf(date);
|
|
@@ -10951,10 +10983,10 @@ function SchedulingCalendar({
|
|
|
10951
10983
|
const date = dayOfItem(item);
|
|
10952
10984
|
if (date && dayRing(date).includes(item)) setActiveDate(date);
|
|
10953
10985
|
};
|
|
10954
|
-
const flatAgendaRef = (0,
|
|
10955
|
-
const flatAgendaStop = (0,
|
|
10986
|
+
const flatAgendaRef = (0, import_react63.useRef)(null);
|
|
10987
|
+
const flatAgendaStop = (0, import_react63.useRef)({ node: null, index: 0 });
|
|
10956
10988
|
const flatAgendaRows = () => Array.from(flatAgendaRef.current?.querySelectorAll(":scope > ol > li > button") ?? []);
|
|
10957
|
-
(0,
|
|
10989
|
+
(0, import_react63.useEffect)(() => {
|
|
10958
10990
|
flatAgendaStop.current = syncRovingStop(flatAgendaRows(), flatAgendaStop.current);
|
|
10959
10991
|
});
|
|
10960
10992
|
const onFlatAgendaFocus = (event) => {
|
|
@@ -11196,7 +11228,7 @@ function SchedulingCalendar({
|
|
|
11196
11228
|
}
|
|
11197
11229
|
|
|
11198
11230
|
// src/components/SchedulingTimeline.tsx
|
|
11199
|
-
var
|
|
11231
|
+
var import_react64 = require("react");
|
|
11200
11232
|
|
|
11201
11233
|
// src/scheduling-timeline-model.ts
|
|
11202
11234
|
var HOUR = 36e5;
|
|
@@ -11424,7 +11456,7 @@ var DEFAULT_UNITS = { row: 36, pad: 16, head: 40 };
|
|
|
11424
11456
|
var ESTIMATED_VIEWPORT = 720;
|
|
11425
11457
|
var OVERSCAN_ROWS = 4;
|
|
11426
11458
|
var BAR_MIN_FALLBACK = 1.5 * 16;
|
|
11427
|
-
var useIsomorphicLayoutEffect6 = typeof document !== "undefined" ?
|
|
11459
|
+
var useIsomorphicLayoutEffect6 = typeof document !== "undefined" ? import_react64.useLayoutEffect : import_react64.useEffect;
|
|
11428
11460
|
var sameExtent = (a, b) => a.subRows === b.subRows && a.lanes === b.lanes && a.heads === b.heads;
|
|
11429
11461
|
var IN_LANE = { scope: "lane", labelTops: ["0%"] };
|
|
11430
11462
|
var vars2 = (values) => values;
|
|
@@ -11490,29 +11522,29 @@ function SchedulingTimeline({
|
|
|
11490
11522
|
overlays: { ...DEFAULT_SCHEDULING_TIMELINE_LABELS.overlays, ...uixLabels.schedulingTimeline?.overlays, ...labelOverrides?.overlays },
|
|
11491
11523
|
statuses: { ...DEFAULT_SCHEDULING_TIMELINE_LABELS.statuses, ...uixLabels.schedulingTimeline?.statuses, ...labelOverrides?.statuses }
|
|
11492
11524
|
};
|
|
11493
|
-
const id = (0,
|
|
11525
|
+
const id = (0, import_react64.useId)();
|
|
11494
11526
|
const hintId = `${id}-hint`;
|
|
11495
11527
|
const step = stepProp !== void 0 && Number.isFinite(stepProp) && stepProp > 0 ? stepProp : defaultTimelineStep(scale);
|
|
11496
|
-
const rootRef = (0,
|
|
11497
|
-
const [scroller, setScroller] = (0,
|
|
11498
|
-
const [layerTrack, setLayerTrack] = (0,
|
|
11499
|
-
const probeRef = (0,
|
|
11500
|
-
const bodyRef = (0,
|
|
11501
|
-
const barMinRef = (0,
|
|
11502
|
-
const [barShare, setBarShare] = (0,
|
|
11503
|
-
const barShareRef = (0,
|
|
11504
|
-
const anchorRef = (0,
|
|
11505
|
-
const [anchorKey, setAnchorKey] = (0,
|
|
11506
|
-
const [focusRowKey, setFocusRowKey] = (0,
|
|
11507
|
-
const [activeId, setActiveId] = (0,
|
|
11508
|
-
const [focusRequest, setFocusRequest] = (0,
|
|
11509
|
-
const [stepDrag, setStepDrag] = (0,
|
|
11510
|
-
const [ghost, setGhost] = (0,
|
|
11511
|
-
const [announcement, setAnnouncement] = (0,
|
|
11512
|
-
const [selfCollapsed, setSelfCollapsed] = (0,
|
|
11513
|
-
const [units, setUnits] = (0,
|
|
11514
|
-
const [view, setView] = (0,
|
|
11515
|
-
const measureViewRef = (0,
|
|
11528
|
+
const rootRef = (0, import_react64.useRef)(null);
|
|
11529
|
+
const [scroller, setScroller] = (0, import_react64.useState)(null);
|
|
11530
|
+
const [layerTrack, setLayerTrack] = (0, import_react64.useState)(null);
|
|
11531
|
+
const probeRef = (0, import_react64.useRef)(null);
|
|
11532
|
+
const bodyRef = (0, import_react64.useRef)(null);
|
|
11533
|
+
const barMinRef = (0, import_react64.useRef)(null);
|
|
11534
|
+
const [barShare, setBarShare] = (0, import_react64.useState)(0);
|
|
11535
|
+
const barShareRef = (0, import_react64.useRef)(0);
|
|
11536
|
+
const anchorRef = (0, import_react64.useRef)(null);
|
|
11537
|
+
const [anchorKey, setAnchorKey] = (0, import_react64.useState)(null);
|
|
11538
|
+
const [focusRowKey, setFocusRowKey] = (0, import_react64.useState)(null);
|
|
11539
|
+
const [activeId, setActiveId] = (0, import_react64.useState)();
|
|
11540
|
+
const [focusRequest, setFocusRequest] = (0, import_react64.useState)(null);
|
|
11541
|
+
const [stepDrag, setStepDrag] = (0, import_react64.useState)(null);
|
|
11542
|
+
const [ghost, setGhost] = (0, import_react64.useState)(null);
|
|
11543
|
+
const [announcement, setAnnouncement] = (0, import_react64.useState)("");
|
|
11544
|
+
const [selfCollapsed, setSelfCollapsed] = (0, import_react64.useState)({});
|
|
11545
|
+
const [units, setUnits] = (0, import_react64.useState)(DEFAULT_UNITS);
|
|
11546
|
+
const [view, setView] = (0, import_react64.useState)({ top: 0, height: ESTIMATED_VIEWPORT });
|
|
11547
|
+
const measureViewRef = (0, import_react64.useRef)(null);
|
|
11516
11548
|
const proposing = onProposeMove !== void 0;
|
|
11517
11549
|
const stepping = !proposing && onMoveItem !== void 0;
|
|
11518
11550
|
const resizing = onResizeItem !== void 0;
|
|
@@ -11527,8 +11559,8 @@ function SchedulingTimeline({
|
|
|
11527
11559
|
return offset ? `${text} ${offset}` : text;
|
|
11528
11560
|
};
|
|
11529
11561
|
const fmtTick = (at) => formatTick?.(new Date(at), scale) ?? cachedDateTimeFormat(locale, { timeZone, ...TICK_FORMAT[scale] }).format(new Date(at));
|
|
11530
|
-
const ticks = (0,
|
|
11531
|
-
const minorTicks = (0,
|
|
11562
|
+
const ticks = (0, import_react64.useMemo)(() => timelineTicks(range, scale, timeZone, weekStartsOn), [range.start, range.end, scale, timeZone, weekStartsOn]);
|
|
11563
|
+
const minorTicks = (0, import_react64.useMemo)(
|
|
11532
11564
|
() => scale === "day" && subTicks && subTicks.length > 0 ? timelineSubTicks(range, subTicks, timeZone) : [],
|
|
11533
11565
|
[range.start, range.end, scale, timeZone, subTicks]
|
|
11534
11566
|
// eslint-disable-line react-hooks/exhaustive-deps
|
|
@@ -11557,7 +11589,7 @@ function SchedulingTimeline({
|
|
|
11557
11589
|
const minSpan = Math.max(0, (Date.parse(range.end) - Date.parse(range.start)) * barShare) || 0;
|
|
11558
11590
|
const isCollapsed = (group) => onToggleGroup ? !!group.collapsed : selfCollapsed[group.id] ?? !!group.collapsed;
|
|
11559
11591
|
const collapsedSignature = groups?.map((group) => isCollapsed(group) ? "1" : "0").join("") ?? "";
|
|
11560
|
-
const itemsByLane = (0,
|
|
11592
|
+
const itemsByLane = (0, import_react64.useMemo)(() => {
|
|
11561
11593
|
const byLane = /* @__PURE__ */ new Map();
|
|
11562
11594
|
for (const item of items) {
|
|
11563
11595
|
const list = byLane.get(item.laneId);
|
|
@@ -11566,7 +11598,7 @@ function SchedulingTimeline({
|
|
|
11566
11598
|
}
|
|
11567
11599
|
return byLane;
|
|
11568
11600
|
}, [items]);
|
|
11569
|
-
const rows = (0,
|
|
11601
|
+
const rows = (0, import_react64.useMemo)(() => {
|
|
11570
11602
|
const laneRow = (lane, laneIndex, groupIndex) => {
|
|
11571
11603
|
const placed = layoutLane(itemsByLane.get(lane.id) ?? EMPTY_ITEMS, range, { flagOverlaps, minSpan });
|
|
11572
11604
|
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) };
|
|
@@ -11598,8 +11630,8 @@ function SchedulingTimeline({
|
|
|
11598
11630
|
});
|
|
11599
11631
|
return list;
|
|
11600
11632
|
}, [lanes, groups, collapsedSignature, itemsByLane, range.start, range.end, flagOverlaps, minSpan]);
|
|
11601
|
-
const laneRows = (0,
|
|
11602
|
-
const { ordered, rowOfItem } = (0,
|
|
11633
|
+
const laneRows = (0, import_react64.useMemo)(() => rows.filter((row) => row.kind === "lane"), [rows]);
|
|
11634
|
+
const { ordered, rowOfItem } = (0, import_react64.useMemo)(() => {
|
|
11603
11635
|
const ids = [];
|
|
11604
11636
|
const rowOf = /* @__PURE__ */ new Map();
|
|
11605
11637
|
rows.forEach((row, rowIndex) => {
|
|
@@ -11611,13 +11643,13 @@ function SchedulingTimeline({
|
|
|
11611
11643
|
});
|
|
11612
11644
|
return { ordered: ids, rowOfItem: rowOf };
|
|
11613
11645
|
}, [rows]);
|
|
11614
|
-
const nothingToShow = (0,
|
|
11646
|
+
const nothingToShow = (0, import_react64.useMemo)(() => {
|
|
11615
11647
|
if (ordered.length > 0) return false;
|
|
11616
11648
|
const laneIds = new Set(lanes.map((lane) => lane.id));
|
|
11617
11649
|
return !items.some((item) => laneIds.has(item.laneId) && placeSpan(item, range) !== null);
|
|
11618
11650
|
}, [ordered, lanes, items, range.start, range.end]);
|
|
11619
11651
|
const focusId = activeId !== void 0 && rowOfItem.has(activeId) ? activeId : ordered[0];
|
|
11620
|
-
const strips = (0,
|
|
11652
|
+
const strips = (0, import_react64.useMemo)(() => {
|
|
11621
11653
|
const set = /* @__PURE__ */ new Set();
|
|
11622
11654
|
const shown = overlays.filter((overlay) => placeSpan(overlay, range) !== null).map(lanesOf);
|
|
11623
11655
|
if (shown.length === 0) return set;
|
|
@@ -11627,10 +11659,12 @@ function SchedulingTimeline({
|
|
|
11627
11659
|
});
|
|
11628
11660
|
return set;
|
|
11629
11661
|
}, [rows, overlays, range.start, range.end]);
|
|
11630
|
-
const extents = (0,
|
|
11631
|
-
const
|
|
11632
|
-
const
|
|
11633
|
-
|
|
11662
|
+
const extents = (0, import_react64.useMemo)(() => timelineRowExtents(rows.map((row, index) => row.kind === "head" ? { kind: "head", subRows: strips.has(index) ? 1 : 0 } : { kind: "lane", subRows: row.subRows })), [rows, strips]);
|
|
11663
|
+
const windowed = lanes.length + (groups?.length ?? 0) > virtualizeAbove;
|
|
11664
|
+
const printing = usePrinting(windowed);
|
|
11665
|
+
const virtual = windowed && !printing;
|
|
11666
|
+
const fixed = windowed || groups !== void 0 || overlays.some((overlay) => overlay.laneIds !== void 0) || markers.some((marker) => marker.laneIds !== void 0);
|
|
11667
|
+
(0, import_react64.useEffect)(() => {
|
|
11634
11668
|
if (!virtual || !scroller) return void 0;
|
|
11635
11669
|
let frame = 0;
|
|
11636
11670
|
const measure = () => {
|
|
@@ -11670,12 +11704,12 @@ function SchedulingTimeline({
|
|
|
11670
11704
|
};
|
|
11671
11705
|
}, [virtual, scroller]);
|
|
11672
11706
|
const px = (extent) => extent.subRows * units.row + extent.lanes * units.pad + extent.heads * units.head;
|
|
11673
|
-
const offsets = (0,
|
|
11707
|
+
const offsets = (0, import_react64.useMemo)(() => virtual ? extents.map(px) : [], [virtual, extents, units]);
|
|
11674
11708
|
const overscan = OVERSCAN_ROWS * units.row;
|
|
11675
11709
|
const pinned = focusId === void 0 ? -1 : rowOfItem.get(focusId) ?? -1;
|
|
11676
|
-
const focusedRow = (0,
|
|
11677
|
-
const anchorRow = (0,
|
|
11678
|
-
const { mounted, windowStart } = (0,
|
|
11710
|
+
const focusedRow = (0, import_react64.useMemo)(() => focusRowKey === null ? -1 : rows.findIndex((row) => row.key === focusRowKey), [rows, focusRowKey]);
|
|
11711
|
+
const anchorRow = (0, import_react64.useMemo)(() => anchorKey === null ? -1 : rows.findIndex((row) => row.key === anchorKey), [rows, anchorKey]);
|
|
11712
|
+
const { mounted, windowStart } = (0, import_react64.useMemo)(() => {
|
|
11679
11713
|
if (!virtual) return { mounted: rows.map((_, index) => index), windowStart: 0 };
|
|
11680
11714
|
const window_ = timelineWindow(offsets, view.top, view.top + view.height, { overscan });
|
|
11681
11715
|
const list = [];
|
|
@@ -11723,10 +11757,10 @@ function SchedulingTimeline({
|
|
|
11723
11757
|
setActiveId(itemId);
|
|
11724
11758
|
setFocusRequest({ id: itemId });
|
|
11725
11759
|
};
|
|
11726
|
-
(0,
|
|
11760
|
+
(0, import_react64.useEffect)(() => {
|
|
11727
11761
|
if (focusRequest) findBar(focusRequest.id)?.focus();
|
|
11728
11762
|
}, [focusRequest]);
|
|
11729
|
-
const itemById = (0,
|
|
11763
|
+
const itemById = (0, import_react64.useMemo)(() => {
|
|
11730
11764
|
const map = /* @__PURE__ */ new Map();
|
|
11731
11765
|
for (const row of laneRows) for (const p of row.placed) if (!map.has(p.item.id)) map.set(p.item.id, p.item);
|
|
11732
11766
|
return map;
|
|
@@ -11736,15 +11770,15 @@ function SchedulingTimeline({
|
|
|
11736
11770
|
const steps = Math.round(ms / step);
|
|
11737
11771
|
return { days: steps * stepDelta.days, minutes: steps * stepDelta.minutes };
|
|
11738
11772
|
};
|
|
11739
|
-
const live = (0,
|
|
11773
|
+
const live = (0, import_react64.useRef)({ itemById, timeZone, range, step, onProposeMove, canMove, deltaFor, labels, fmtInstant });
|
|
11740
11774
|
live.current = { itemById, timeZone, range, step, onProposeMove, canMove, deltaFor, labels, fmtInstant };
|
|
11741
|
-
const dragRef = (0,
|
|
11742
|
-
const suppressClick = (0,
|
|
11743
|
-
const refocus = (0,
|
|
11744
|
-
(0,
|
|
11775
|
+
const dragRef = (0, import_react64.useRef)(null);
|
|
11776
|
+
const suppressClick = (0, import_react64.useRef)(false);
|
|
11777
|
+
const refocus = (0, import_react64.useRef)(null);
|
|
11778
|
+
(0, import_react64.useEffect)(() => {
|
|
11745
11779
|
if (ghost && !itemById.has(ghost.id)) setGhost(null);
|
|
11746
11780
|
}, [ghost, itemById]);
|
|
11747
|
-
(0,
|
|
11781
|
+
(0, import_react64.useEffect)(() => {
|
|
11748
11782
|
const wanted = refocus.current;
|
|
11749
11783
|
if (!wanted || !rootRef.current) return;
|
|
11750
11784
|
const active = document.activeElement;
|
|
@@ -11755,11 +11789,11 @@ function SchedulingTimeline({
|
|
|
11755
11789
|
}
|
|
11756
11790
|
findBar(wanted)?.focus();
|
|
11757
11791
|
});
|
|
11758
|
-
(0,
|
|
11792
|
+
(0, import_react64.useEffect)(() => () => {
|
|
11759
11793
|
dragRef.current?.stop();
|
|
11760
11794
|
dragRef.current = null;
|
|
11761
11795
|
}, []);
|
|
11762
|
-
(0,
|
|
11796
|
+
(0, import_react64.useEffect)(() => {
|
|
11763
11797
|
if (proposing) return;
|
|
11764
11798
|
dragRef.current?.stop();
|
|
11765
11799
|
dragRef.current = null;
|
|
@@ -12240,7 +12274,7 @@ function SchedulingTimeline({
|
|
|
12240
12274
|
}
|
|
12241
12275
|
|
|
12242
12276
|
// src/components/DateRangePicker.tsx
|
|
12243
|
-
var
|
|
12277
|
+
var import_react66 = require("react");
|
|
12244
12278
|
|
|
12245
12279
|
// src/date-field-model.ts
|
|
12246
12280
|
var pad = (n, width = 2) => String(n).padStart(width, "0");
|
|
@@ -12314,7 +12348,7 @@ function timeZoneName(timeZone, date, locale) {
|
|
|
12314
12348
|
}
|
|
12315
12349
|
|
|
12316
12350
|
// src/components/DateFieldParts.tsx
|
|
12317
|
-
var
|
|
12351
|
+
var import_react65 = require("react");
|
|
12318
12352
|
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
12319
12353
|
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")}`;
|
|
12320
12354
|
var utc = (date) => /* @__PURE__ */ new Date(`${date}T00:00:00Z`);
|
|
@@ -12332,15 +12366,15 @@ var isOpen = (el) => {
|
|
|
12332
12366
|
}
|
|
12333
12367
|
};
|
|
12334
12368
|
function useFieldPopover(popoverId, restoreFocus, onOpenChange) {
|
|
12335
|
-
const [open, setOpen] = (0,
|
|
12336
|
-
const pointerWasOpen = (0,
|
|
12337
|
-
const restoreRef = (0,
|
|
12369
|
+
const [open, setOpen] = (0, import_react65.useState)(false);
|
|
12370
|
+
const pointerWasOpen = (0, import_react65.useRef)(null);
|
|
12371
|
+
const restoreRef = (0, import_react65.useRef)(restoreFocus);
|
|
12338
12372
|
restoreRef.current = restoreFocus;
|
|
12339
|
-
const onOpenChangeRef = (0,
|
|
12373
|
+
const onOpenChangeRef = (0, import_react65.useRef)(onOpenChange);
|
|
12340
12374
|
onOpenChangeRef.current = onOpenChange;
|
|
12341
|
-
const skipRestore = (0,
|
|
12375
|
+
const skipRestore = (0, import_react65.useRef)(false);
|
|
12342
12376
|
const popoverEl = () => typeof document === "undefined" ? null : document.getElementById(popoverId);
|
|
12343
|
-
(0,
|
|
12377
|
+
(0, import_react65.useEffect)(() => {
|
|
12344
12378
|
const el = popoverEl();
|
|
12345
12379
|
if (!el) return;
|
|
12346
12380
|
const onToggle = (event) => {
|
|
@@ -12424,14 +12458,14 @@ function MonthCalendar({
|
|
|
12424
12458
|
autoFocus = false
|
|
12425
12459
|
}) {
|
|
12426
12460
|
const clamp3 = (date) => min && date < min ? min : max && date > max ? max : date;
|
|
12427
|
-
const [active, setActive] = (0,
|
|
12428
|
-
const gridRef = (0,
|
|
12429
|
-
const pendingFocus = (0,
|
|
12461
|
+
const [active, setActive] = (0, import_react65.useState)(() => clamp3(initialDate));
|
|
12462
|
+
const gridRef = (0, import_react65.useRef)(null);
|
|
12463
|
+
const pendingFocus = (0, import_react65.useRef)(autoFocus);
|
|
12430
12464
|
const month = startOfMonth(active);
|
|
12431
|
-
const days = (0,
|
|
12465
|
+
const days = (0, import_react65.useMemo)(() => buildMonthGrid(month, weekStartsOn).filter((day) => day.inMonth), [month, weekStartsOn]);
|
|
12432
12466
|
const blanks = (utc(month).getUTCDay() - weekStartsOn + 7) % 7;
|
|
12433
|
-
const weekdays = (0,
|
|
12434
|
-
(0,
|
|
12467
|
+
const weekdays = (0, import_react65.useMemo)(() => weekdayNames(locale, weekStartsOn), [locale, weekStartsOn]);
|
|
12468
|
+
(0, import_react65.useEffect)(() => {
|
|
12435
12469
|
if (!pendingFocus.current) return;
|
|
12436
12470
|
pendingFocus.current = false;
|
|
12437
12471
|
gridRef.current?.querySelector(`[data-date="${active}"]`)?.focus({ preventScroll: true });
|
|
@@ -12538,27 +12572,27 @@ function RangeCalendar({
|
|
|
12538
12572
|
weekStartsOn = 1,
|
|
12539
12573
|
autoFocus = false
|
|
12540
12574
|
}) {
|
|
12541
|
-
const id = (0,
|
|
12542
|
-
const weekdays = (0,
|
|
12543
|
-
const [internalMonth, setInternalMonth] = (0,
|
|
12575
|
+
const id = (0, import_react66.useId)();
|
|
12576
|
+
const weekdays = (0, import_react66.useMemo)(() => weekdayNames(locale, weekStartsOn), [locale, weekStartsOn]);
|
|
12577
|
+
const [internalMonth, setInternalMonth] = (0, import_react66.useState)(() => startOfMonth(controlledMonth ?? value.start ?? (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)));
|
|
12544
12578
|
const visibleMonth = startOfMonth(controlledMonth ?? internalMonth);
|
|
12545
|
-
const [activeDate, setActiveDate] = (0,
|
|
12546
|
-
const rootRef = (0,
|
|
12547
|
-
const pendingFocus = (0,
|
|
12579
|
+
const [activeDate, setActiveDate] = (0, import_react66.useState)(value.end ?? value.start ?? visibleMonth);
|
|
12580
|
+
const rootRef = (0, import_react66.useRef)(null);
|
|
12581
|
+
const pendingFocus = (0, import_react66.useRef)(autoFocus);
|
|
12548
12582
|
const count2 = Math.max(1, Math.min(3, months));
|
|
12549
|
-
const calendars = (0,
|
|
12583
|
+
const calendars = (0, import_react66.useMemo)(() => Array.from({ length: count2 }, (_, index) => {
|
|
12550
12584
|
const month = startOfMonth(addCalendarMonths(visibleMonth, index));
|
|
12551
12585
|
return { month, days: buildMonthGrid(month).filter((day) => day.inMonth) };
|
|
12552
12586
|
}), [visibleMonth, count2]);
|
|
12553
12587
|
const todayDate = today === void 0 ? localDateKey() : today;
|
|
12554
12588
|
const rangeInvalid = invalid || !!value.start && !!value.end && value.start > value.end;
|
|
12555
|
-
(0,
|
|
12589
|
+
(0, import_react66.useEffect)(() => {
|
|
12556
12590
|
const first = calendars[0]?.days[0]?.date;
|
|
12557
12591
|
const finalDays = calendars[calendars.length - 1]?.days;
|
|
12558
12592
|
const last = finalDays?.[finalDays.length - 1]?.date;
|
|
12559
12593
|
if (first && last && (activeDate < first || activeDate > last)) setActiveDate(first);
|
|
12560
12594
|
}, [activeDate, calendars]);
|
|
12561
|
-
(0,
|
|
12595
|
+
(0, import_react66.useEffect)(() => {
|
|
12562
12596
|
if (!pendingFocus.current) return;
|
|
12563
12597
|
rootRef.current?.querySelector(`[data-date="${activeDate}"]`)?.focus({ preventScroll: autoFocus });
|
|
12564
12598
|
pendingFocus.current = false;
|
|
@@ -12662,15 +12696,15 @@ function DateRangeField(props) {
|
|
|
12662
12696
|
"aria-describedby": ariaDescribedBy,
|
|
12663
12697
|
"aria-invalid": ariaInvalid
|
|
12664
12698
|
} = props;
|
|
12665
|
-
const uid = (0,
|
|
12699
|
+
const uid = (0, import_react66.useId)();
|
|
12666
12700
|
const id = idProp ?? `${uid}-trigger`;
|
|
12667
12701
|
const popoverId = `${uid}-months`;
|
|
12668
12702
|
const valueId = `${uid}-value`;
|
|
12669
|
-
const anchorRef = (0,
|
|
12670
|
-
const triggerRef = (0,
|
|
12703
|
+
const anchorRef = (0, import_react66.useRef)(null);
|
|
12704
|
+
const triggerRef = (0, import_react66.useRef)(null);
|
|
12671
12705
|
const { open, hide, triggerProps } = useFieldPopover(popoverId, () => triggerRef.current?.focus({ preventScroll: true }), onOpenChange);
|
|
12672
|
-
const [labelled, setLabelled] = (0,
|
|
12673
|
-
(0,
|
|
12706
|
+
const [labelled, setLabelled] = (0, import_react66.useState)(false);
|
|
12707
|
+
(0, import_react66.useEffect)(() => {
|
|
12674
12708
|
setLabelled((triggerRef.current?.labels?.length ?? 0) > 0);
|
|
12675
12709
|
}, [id]);
|
|
12676
12710
|
const format = (date) => formatDate?.(date) ?? formatDateKey(date, locale);
|
|
@@ -12741,7 +12775,7 @@ function DateRangeField(props) {
|
|
|
12741
12775
|
}
|
|
12742
12776
|
|
|
12743
12777
|
// src/components/DatePicker.tsx
|
|
12744
|
-
var
|
|
12778
|
+
var import_react67 = require("react");
|
|
12745
12779
|
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
12746
12780
|
var DEFAULT_DATE_PICKER_LABELS = {
|
|
12747
12781
|
open: "Choose date",
|
|
@@ -12753,7 +12787,7 @@ var DEFAULT_DATE_PICKER_LABELS = {
|
|
|
12753
12787
|
notADate: "That is not a date.",
|
|
12754
12788
|
unavailable: "That date is not available."
|
|
12755
12789
|
};
|
|
12756
|
-
var DatePicker = (0,
|
|
12790
|
+
var DatePicker = (0, import_react67.forwardRef)(function DatePicker2({
|
|
12757
12791
|
value,
|
|
12758
12792
|
onValueChange,
|
|
12759
12793
|
min,
|
|
@@ -12784,18 +12818,18 @@ var DatePicker = (0, import_react66.forwardRef)(function DatePicker2({
|
|
|
12784
12818
|
className,
|
|
12785
12819
|
style
|
|
12786
12820
|
}, forwardedRef) {
|
|
12787
|
-
const uid = (0,
|
|
12821
|
+
const uid = (0, import_react67.useId)();
|
|
12788
12822
|
const id = idProp ?? `${uid}-input`;
|
|
12789
12823
|
const popoverId = `${uid}-calendar`;
|
|
12790
12824
|
const errorId = `${uid}-error`;
|
|
12791
12825
|
const labels = { ...DEFAULT_DATE_PICKER_LABELS, ...useUixLabels().datePicker, ...labelOverrides };
|
|
12792
|
-
const anchorRef = (0,
|
|
12793
|
-
const inputRef = (0,
|
|
12794
|
-
(0,
|
|
12826
|
+
const anchorRef = (0, import_react67.useRef)(null);
|
|
12827
|
+
const inputRef = (0, import_react67.useRef)(null);
|
|
12828
|
+
(0, import_react67.useImperativeHandle)(forwardedRef, () => inputRef.current);
|
|
12795
12829
|
const format = (date) => formatDate?.(date) ?? formatDateKey(date, locale);
|
|
12796
|
-
const [text, setText] = (0,
|
|
12797
|
-
const [problem, setProblemState] = (0,
|
|
12798
|
-
const reported = (0,
|
|
12830
|
+
const [text, setText] = (0, import_react67.useState)(() => value ? format(value) : "");
|
|
12831
|
+
const [problem, setProblemState] = (0, import_react67.useState)(null);
|
|
12832
|
+
const reported = (0, import_react67.useRef)(null);
|
|
12799
12833
|
const setProblem = (next) => {
|
|
12800
12834
|
if (next !== reported.current) {
|
|
12801
12835
|
reported.current = next;
|
|
@@ -12803,7 +12837,7 @@ var DatePicker = (0, import_react66.forwardRef)(function DatePicker2({
|
|
|
12803
12837
|
}
|
|
12804
12838
|
setProblemState(next);
|
|
12805
12839
|
};
|
|
12806
|
-
(0,
|
|
12840
|
+
(0, import_react67.useEffect)(() => {
|
|
12807
12841
|
setText(value ? format(value) : "");
|
|
12808
12842
|
setProblem(null);
|
|
12809
12843
|
}, [value, locale]);
|
|
@@ -12953,7 +12987,7 @@ var DEFAULT_DATE_TIME_PICKER_LABELS = {
|
|
|
12953
12987
|
timeOf: "{label}, time",
|
|
12954
12988
|
timeZone: "Time zone: {zone}"
|
|
12955
12989
|
};
|
|
12956
|
-
var DateTimePicker = (0,
|
|
12990
|
+
var DateTimePicker = (0, import_react67.forwardRef)(function DateTimePicker2({
|
|
12957
12991
|
value,
|
|
12958
12992
|
onValueChange,
|
|
12959
12993
|
timeZone,
|
|
@@ -12977,19 +13011,19 @@ var DateTimePicker = (0, import_react66.forwardRef)(function DateTimePicker2({
|
|
|
12977
13011
|
style,
|
|
12978
13012
|
...dateProps
|
|
12979
13013
|
}, forwardedRef) {
|
|
12980
|
-
const uid = (0,
|
|
13014
|
+
const uid = (0, import_react67.useId)();
|
|
12981
13015
|
const id = idProp ?? `${uid}-date`;
|
|
12982
13016
|
const zoneId = `${uid}-zone`;
|
|
12983
13017
|
const labels = { ...DEFAULT_DATE_TIME_PICKER_LABELS, ...useUixLabels().dateTimePicker, ...labelOverrides };
|
|
12984
13018
|
const { date, time } = splitDateTime(value);
|
|
12985
|
-
const dateRef = (0,
|
|
12986
|
-
(0,
|
|
12987
|
-
const [pendingTime, setPendingTime] = (0,
|
|
13019
|
+
const dateRef = (0, import_react67.useRef)(null);
|
|
13020
|
+
(0, import_react67.useImperativeHandle)(forwardedRef, () => dateRef.current);
|
|
13021
|
+
const [pendingTime, setPendingTime] = (0, import_react67.useState)("");
|
|
12988
13022
|
const shownTime = date ? time : pendingTime;
|
|
12989
|
-
const [fieldLabel, setFieldLabel] = (0,
|
|
12990
|
-
const [viewerZone, setViewerZone] = (0,
|
|
13023
|
+
const [fieldLabel, setFieldLabel] = (0, import_react67.useState)("");
|
|
13024
|
+
const [viewerZone, setViewerZone] = (0, import_react67.useState)(null);
|
|
12991
13025
|
const grouped = !!ariaLabel || !!ariaLabelledBy;
|
|
12992
|
-
(0,
|
|
13026
|
+
(0, import_react67.useEffect)(() => {
|
|
12993
13027
|
if (!grouped) setFieldLabel(dateRef.current?.labels?.[0]?.textContent?.trim() ?? "");
|
|
12994
13028
|
if (!timeZone) {
|
|
12995
13029
|
try {
|
|
@@ -13068,7 +13102,7 @@ var DateTimePicker = (0, import_react66.forwardRef)(function DateTimePicker2({
|
|
|
13068
13102
|
});
|
|
13069
13103
|
|
|
13070
13104
|
// src/components/RelationshipGraph.tsx
|
|
13071
|
-
var
|
|
13105
|
+
var import_react69 = require("react");
|
|
13072
13106
|
|
|
13073
13107
|
// src/relationship-graph-model.ts
|
|
13074
13108
|
function boundRelationshipGraph(nodes, edges, maxNodes = 40) {
|
|
@@ -13549,7 +13583,7 @@ function layeredNeighbor(layout, currentId, key) {
|
|
|
13549
13583
|
}
|
|
13550
13584
|
|
|
13551
13585
|
// src/components/RelationshipGraphLayered.tsx
|
|
13552
|
-
var
|
|
13586
|
+
var import_react68 = require("react");
|
|
13553
13587
|
|
|
13554
13588
|
// src/components/RelationshipGraphList.tsx
|
|
13555
13589
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
@@ -13636,11 +13670,11 @@ function LayeredRelationshipGraph({
|
|
|
13636
13670
|
focusId,
|
|
13637
13671
|
onFocusChange
|
|
13638
13672
|
}) {
|
|
13639
|
-
const hintId = (0,
|
|
13640
|
-
const bounded = (0,
|
|
13641
|
-
const [localExpanded, setLocalExpanded] = (0,
|
|
13673
|
+
const hintId = (0, import_react68.useId)();
|
|
13674
|
+
const bounded = (0, import_react68.useMemo)(() => boundRelationshipGraph(nodes, edges, maxNodes), [nodes, edges, maxNodes]);
|
|
13675
|
+
const [localExpanded, setLocalExpanded] = (0, import_react68.useState)(EMPTY_IDS2);
|
|
13642
13676
|
const expanded = expandedClusterIds ?? localExpanded;
|
|
13643
|
-
const layout = (0,
|
|
13677
|
+
const layout = (0, import_react68.useMemo)(
|
|
13644
13678
|
() => layoutLayeredGraph(bounded.nodes, bounded.edges, {
|
|
13645
13679
|
...rootId !== void 0 ? { rootId } : {},
|
|
13646
13680
|
...clusterThreshold !== void 0 ? { clusterThreshold } : {},
|
|
@@ -13649,29 +13683,29 @@ function LayeredRelationshipGraph({
|
|
|
13649
13683
|
}),
|
|
13650
13684
|
[bounded, rootId, clusterThreshold, expanded, density]
|
|
13651
13685
|
);
|
|
13652
|
-
const itemById = (0,
|
|
13653
|
-
const viewportRef = (0,
|
|
13654
|
-
const itemRefs = (0,
|
|
13655
|
-
const [size, setSize] = (0,
|
|
13656
|
-
const [view, setView] = (0,
|
|
13657
|
-
const [animate, setAnimate] = (0,
|
|
13658
|
-
const [localFocus, setLocalFocus] = (0,
|
|
13659
|
-
const [hoverId, setHoverId] = (0,
|
|
13660
|
-
const viewRef = (0,
|
|
13686
|
+
const itemById = (0, import_react68.useMemo)(() => new Map(layout.items.map((item) => [item.id, item])), [layout]);
|
|
13687
|
+
const viewportRef = (0, import_react68.useRef)(null);
|
|
13688
|
+
const itemRefs = (0, import_react68.useRef)(/* @__PURE__ */ new Map());
|
|
13689
|
+
const [size, setSize] = (0, import_react68.useState)({ width: 0, height: 0 });
|
|
13690
|
+
const [view, setView] = (0, import_react68.useState)({ x: 0, y: 0, zoom: 1 });
|
|
13691
|
+
const [animate, setAnimate] = (0, import_react68.useState)(false);
|
|
13692
|
+
const [localFocus, setLocalFocus] = (0, import_react68.useState)(void 0);
|
|
13693
|
+
const [hoverId, setHoverId] = (0, import_react68.useState)(void 0);
|
|
13694
|
+
const viewRef = (0, import_react68.useRef)(view);
|
|
13661
13695
|
viewRef.current = view;
|
|
13662
|
-
const layoutRef = (0,
|
|
13696
|
+
const layoutRef = (0, import_react68.useRef)(layout);
|
|
13663
13697
|
layoutRef.current = layout;
|
|
13664
|
-
const pendingFocus = (0,
|
|
13665
|
-
const initialisedFor = (0,
|
|
13698
|
+
const pendingFocus = (0, import_react68.useRef)(void 0);
|
|
13699
|
+
const initialisedFor = (0, import_react68.useRef)(void 0);
|
|
13666
13700
|
const rootItemId = layout.rootId !== void 0 ? layout.itemOf[layout.rootId] : layout.items[0]?.id;
|
|
13667
13701
|
const requestedFocus = focusId !== void 0 ? layout.itemOf[focusId] ?? focusId : localFocus;
|
|
13668
13702
|
const focusedId = requestedFocus !== void 0 && itemById.has(requestedFocus) ? requestedFocus : rootItemId;
|
|
13669
13703
|
const selectedItemId = selectedId !== void 0 ? layout.itemOf[selectedId] : void 0;
|
|
13670
|
-
const activeIds = (0,
|
|
13704
|
+
const activeIds = (0, import_react68.useMemo)(
|
|
13671
13705
|
() => new Set([hoverId, selectedItemId].filter((id) => id !== void 0)),
|
|
13672
13706
|
[hoverId, selectedItemId]
|
|
13673
13707
|
);
|
|
13674
|
-
(0,
|
|
13708
|
+
(0, import_react68.useEffect)(() => {
|
|
13675
13709
|
const element = viewportRef.current;
|
|
13676
13710
|
if (!element) return;
|
|
13677
13711
|
const measure = () => setSize({ width: element.clientWidth, height: element.clientHeight });
|
|
@@ -13681,18 +13715,18 @@ function LayeredRelationshipGraph({
|
|
|
13681
13715
|
observer.observe(element);
|
|
13682
13716
|
return () => observer.disconnect();
|
|
13683
13717
|
}, []);
|
|
13684
|
-
(0,
|
|
13718
|
+
(0, import_react68.useEffect)(() => {
|
|
13685
13719
|
if (size.width === 0) return;
|
|
13686
13720
|
const key = `${layout.rootId ?? ""}`;
|
|
13687
13721
|
if (initialisedFor.current === key) return;
|
|
13688
13722
|
initialisedFor.current = key;
|
|
13689
13723
|
setView(initialView(layout, size));
|
|
13690
13724
|
}, [layout, size]);
|
|
13691
|
-
const moveView = (0,
|
|
13725
|
+
const moveView = (0, import_react68.useCallback)((next, smooth) => {
|
|
13692
13726
|
setAnimate(smooth);
|
|
13693
13727
|
setView(next);
|
|
13694
13728
|
}, []);
|
|
13695
|
-
const ensureVisible = (0,
|
|
13729
|
+
const ensureVisible = (0, import_react68.useCallback)((id, smooth) => {
|
|
13696
13730
|
const element = viewportRef.current;
|
|
13697
13731
|
const item = layoutRef.current.items.find((candidate) => candidate.id === id);
|
|
13698
13732
|
if (!element || !item) return;
|
|
@@ -13711,7 +13745,7 @@ function LayeredRelationshipGraph({
|
|
|
13711
13745
|
else if (bottom > heightPx - FOCUS_MARGIN) nextY -= bottom - (heightPx - FOCUS_MARGIN);
|
|
13712
13746
|
if (nextX !== x || nextY !== y) moveView({ x: nextX, y: nextY, zoom }, smooth);
|
|
13713
13747
|
}, [moveView]);
|
|
13714
|
-
const focusItem = (0,
|
|
13748
|
+
const focusItem = (0, import_react68.useCallback)((id) => {
|
|
13715
13749
|
setLocalFocus(id);
|
|
13716
13750
|
onFocusChange?.(id);
|
|
13717
13751
|
requestAnimationFrame(() => {
|
|
@@ -13719,7 +13753,7 @@ function LayeredRelationshipGraph({
|
|
|
13719
13753
|
ensureVisible(id, true);
|
|
13720
13754
|
});
|
|
13721
13755
|
}, [ensureVisible, onFocusChange]);
|
|
13722
|
-
(0,
|
|
13756
|
+
(0, import_react68.useEffect)(() => {
|
|
13723
13757
|
const wanted = pendingFocus.current;
|
|
13724
13758
|
if (wanted !== void 0 && itemById.has(wanted)) {
|
|
13725
13759
|
pendingFocus.current = void 0;
|
|
@@ -13729,8 +13763,8 @@ function LayeredRelationshipGraph({
|
|
|
13729
13763
|
const controlledTarget = focusId !== void 0 ? layout.itemOf[focusId] ?? focusId : void 0;
|
|
13730
13764
|
const controlledPresent = controlledTarget !== void 0 && itemById.has(controlledTarget);
|
|
13731
13765
|
const controlledKey = `${controlledTarget ?? ""}|${controlledPresent}`;
|
|
13732
|
-
const lastControlledKey = (0,
|
|
13733
|
-
(0,
|
|
13766
|
+
const lastControlledKey = (0, import_react68.useRef)(controlledKey);
|
|
13767
|
+
(0, import_react68.useEffect)(() => {
|
|
13734
13768
|
if (lastControlledKey.current === controlledKey) return;
|
|
13735
13769
|
lastControlledKey.current = controlledKey;
|
|
13736
13770
|
if (!controlledPresent || controlledTarget === void 0) return;
|
|
@@ -13739,7 +13773,7 @@ function LayeredRelationshipGraph({
|
|
|
13739
13773
|
ensureVisible(controlledTarget, true);
|
|
13740
13774
|
});
|
|
13741
13775
|
}, [controlledKey, controlledTarget, controlledPresent, ensureVisible]);
|
|
13742
|
-
(0,
|
|
13776
|
+
(0, import_react68.useEffect)(() => {
|
|
13743
13777
|
const element = viewportRef.current;
|
|
13744
13778
|
if (!element) return;
|
|
13745
13779
|
const onWheel = (event) => {
|
|
@@ -13757,8 +13791,8 @@ function LayeredRelationshipGraph({
|
|
|
13757
13791
|
element.addEventListener("wheel", onWheel, { passive: false });
|
|
13758
13792
|
return () => element.removeEventListener("wheel", onWheel);
|
|
13759
13793
|
}, []);
|
|
13760
|
-
const pointers = (0,
|
|
13761
|
-
const pinchDistance = (0,
|
|
13794
|
+
const pointers = (0, import_react68.useRef)(/* @__PURE__ */ new Map());
|
|
13795
|
+
const pinchDistance = (0, import_react68.useRef)(void 0);
|
|
13762
13796
|
const onPointerDown = (event) => {
|
|
13763
13797
|
if (event.target.closest("button")) return;
|
|
13764
13798
|
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
@@ -14059,7 +14093,7 @@ function radialViewBox(nodes) {
|
|
|
14059
14093
|
return `${round(minX)} ${round(minY)} ${width} ${height}`;
|
|
14060
14094
|
}
|
|
14061
14095
|
function RelationshipGraph(props) {
|
|
14062
|
-
const labels = (0,
|
|
14096
|
+
const labels = (0, import_react69.useMemo)(() => ({ ...DEFAULT_RELATIONSHIP_GRAPH_LABELS, ...props.labels }), [props.labels]);
|
|
14063
14097
|
const stateClass = cx("uix-relationship-graph uix-relationship-graph--state", props.className);
|
|
14064
14098
|
if (props.loading) return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: stateClass, role: "status", children: labels.loading });
|
|
14065
14099
|
if (props.error) {
|
|
@@ -14093,17 +14127,17 @@ function RadialRelationshipGraph({
|
|
|
14093
14127
|
labels,
|
|
14094
14128
|
showList = true
|
|
14095
14129
|
}) {
|
|
14096
|
-
const bounded = (0,
|
|
14097
|
-
const positioned = (0,
|
|
14098
|
-
const typeColor = (0,
|
|
14130
|
+
const bounded = (0, import_react69.useMemo)(() => boundRelationshipGraph(nodes, edges, maxNodes), [nodes, edges, maxNodes]);
|
|
14131
|
+
const positioned = (0, import_react69.useMemo)(() => layoutRelationshipGraph(bounded.nodes, bounded.edges, selectedId), [bounded, selectedId]);
|
|
14132
|
+
const typeColor = (0, import_react69.useMemo)(
|
|
14099
14133
|
() => new Map(legend.map((item, index) => [item.id, `var(--uix-chart-${index % 8 + 1})`])),
|
|
14100
14134
|
[legend]
|
|
14101
14135
|
);
|
|
14102
|
-
const positionedById = (0,
|
|
14103
|
-
const [zoom, setZoom] = (0,
|
|
14104
|
-
const [pan, setPan] = (0,
|
|
14105
|
-
const [focusedId, setFocusedId] = (0,
|
|
14106
|
-
const svgRef = (0,
|
|
14136
|
+
const positionedById = (0, import_react69.useMemo)(() => new Map(positioned.map((node) => [node.id, node])), [positioned]);
|
|
14137
|
+
const [zoom, setZoom] = (0, import_react69.useState)(1);
|
|
14138
|
+
const [pan, setPan] = (0, import_react69.useState)({ x: 0, y: 0 });
|
|
14139
|
+
const [focusedId, setFocusedId] = (0, import_react69.useState)(selectedId ?? positioned[0]?.id);
|
|
14140
|
+
const svgRef = (0, import_react69.useRef)(null);
|
|
14107
14141
|
const select = (id) => {
|
|
14108
14142
|
const node = bounded.nodes.find((item) => item.id === id);
|
|
14109
14143
|
if (node) onSelect?.(node);
|
|
@@ -14174,7 +14208,7 @@ function RadialRelationshipGraph({
|
|
|
14174
14208
|
}
|
|
14175
14209
|
|
|
14176
14210
|
// src/components/MatchReview.tsx
|
|
14177
|
-
var
|
|
14211
|
+
var import_react70 = require("react");
|
|
14178
14212
|
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
14179
14213
|
var DEFAULT_MATCH_REVIEW_LABELS = {
|
|
14180
14214
|
region: "Match review",
|
|
@@ -14237,11 +14271,11 @@ function MatchReview({
|
|
|
14237
14271
|
const plural = (n, one, many) => fillLabel(n === 1 ? one : many, { count: n });
|
|
14238
14272
|
const decisionLabel = { accepted: labels.decisionAccepted, dismissed: labels.decisionDismissed, split: labels.decisionSplit, other: labels.decisionOther };
|
|
14239
14273
|
const actionLabel = { accept: labels.accept, dismiss: labels.dismiss, split: labels.split, "pick-other": labels.pickOther };
|
|
14240
|
-
const [internalSelection, setInternalSelection] = (0,
|
|
14241
|
-
const [announcement, setAnnouncement] = (0,
|
|
14242
|
-
const [bulkPending, setBulkPending] = (0,
|
|
14274
|
+
const [internalSelection, setInternalSelection] = (0, import_react70.useState)(/* @__PURE__ */ new Set());
|
|
14275
|
+
const [announcement, setAnnouncement] = (0, import_react70.useState)("");
|
|
14276
|
+
const [bulkPending, setBulkPending] = (0, import_react70.useState)(false);
|
|
14243
14277
|
const selection = selectedIds ?? internalSelection;
|
|
14244
|
-
const pending = (0,
|
|
14278
|
+
const pending = (0, import_react70.useMemo)(() => candidates.filter((candidate) => candidate.status !== "resolved"), [candidates]);
|
|
14245
14279
|
const setSelection = (next) => {
|
|
14246
14280
|
if (selectedIds === void 0) setInternalSelection(next);
|
|
14247
14281
|
onSelectionChange?.(next);
|
|
@@ -14330,7 +14364,7 @@ function MatchReview({
|
|
|
14330
14364
|
}
|
|
14331
14365
|
|
|
14332
14366
|
// src/components/MetricInput.tsx
|
|
14333
|
-
var
|
|
14367
|
+
var import_react71 = require("react");
|
|
14334
14368
|
|
|
14335
14369
|
// src/metric-model.ts
|
|
14336
14370
|
function decimals(value) {
|
|
@@ -14374,11 +14408,11 @@ function MetricInput({
|
|
|
14374
14408
|
className,
|
|
14375
14409
|
id: providedId
|
|
14376
14410
|
}) {
|
|
14377
|
-
const generatedId = (0,
|
|
14411
|
+
const generatedId = (0, import_react71.useId)();
|
|
14378
14412
|
const id = providedId ?? generatedId;
|
|
14379
14413
|
const errorId = `${id}-error`;
|
|
14380
|
-
const [text, setText] = (0,
|
|
14381
|
-
(0,
|
|
14414
|
+
const [text, setText] = (0, import_react71.useState)(() => format(value));
|
|
14415
|
+
(0, import_react71.useEffect)(() => setText(format(value)), [value, format]);
|
|
14382
14416
|
const commit = (input) => {
|
|
14383
14417
|
const parsed = parse(input);
|
|
14384
14418
|
if (input.trim() === "" || parsed !== null) {
|
|
@@ -14487,7 +14521,7 @@ function LicensePositionBar({
|
|
|
14487
14521
|
}
|
|
14488
14522
|
|
|
14489
14523
|
// src/components/BrandProfiles.tsx
|
|
14490
|
-
var
|
|
14524
|
+
var import_react73 = require("react");
|
|
14491
14525
|
|
|
14492
14526
|
// src/color-model.ts
|
|
14493
14527
|
var clamp2 = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
@@ -14556,7 +14590,7 @@ function meetsContrast(background, foreground, minimum = 4.5) {
|
|
|
14556
14590
|
}
|
|
14557
14591
|
|
|
14558
14592
|
// src/components/ColorPicker.tsx
|
|
14559
|
-
var
|
|
14593
|
+
var import_react72 = require("react");
|
|
14560
14594
|
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
14561
14595
|
var DEFAULT_COLOR_PICKER_LABELS = {
|
|
14562
14596
|
trigger: "{label}: {color}",
|
|
@@ -14588,17 +14622,17 @@ function ColorPicker({
|
|
|
14588
14622
|
labels: labelOverrides
|
|
14589
14623
|
}) {
|
|
14590
14624
|
const labels = { ...DEFAULT_COLOR_PICKER_LABELS, ...labelOverrides };
|
|
14591
|
-
const id = (0,
|
|
14592
|
-
const triggerRef = (0,
|
|
14593
|
-
const dialogRef = (0,
|
|
14594
|
-
const [open, setOpen] = (0,
|
|
14625
|
+
const id = (0, import_react72.useId)();
|
|
14626
|
+
const triggerRef = (0, import_react72.useRef)(null);
|
|
14627
|
+
const dialogRef = (0, import_react72.useRef)(null);
|
|
14628
|
+
const [open, setOpen] = (0, import_react72.useState)(false);
|
|
14595
14629
|
const normalized = normalizeHex(value) ?? "#000000";
|
|
14596
|
-
const [hexText, setHexText] = (0,
|
|
14597
|
-
const hsv = (0,
|
|
14630
|
+
const [hexText, setHexText] = (0, import_react72.useState)(normalized);
|
|
14631
|
+
const hsv = (0, import_react72.useMemo)(() => rgbToHsv(hexToRgb(normalized)), [normalized]);
|
|
14598
14632
|
const ratio = contrastRatio(normalized, foreground) ?? 0;
|
|
14599
14633
|
const passes = ratio >= minimumContrast;
|
|
14600
|
-
(0,
|
|
14601
|
-
(0,
|
|
14634
|
+
(0, import_react72.useEffect)(() => setHexText(normalized), [normalized]);
|
|
14635
|
+
(0, import_react72.useEffect)(() => {
|
|
14602
14636
|
if (!open) return;
|
|
14603
14637
|
const dialog = dialogRef.current;
|
|
14604
14638
|
dialog?.querySelector("input,button")?.focus();
|
|
@@ -14818,7 +14852,7 @@ function BrandProfileEditor({
|
|
|
14818
14852
|
labels: labelOverrides
|
|
14819
14853
|
}) {
|
|
14820
14854
|
const labels = { ...DEFAULT_BRAND_PROFILE_EDITOR_LABELS, ...labelOverrides };
|
|
14821
|
-
const [announcement, setAnnouncement] = (0,
|
|
14855
|
+
const [announcement, setAnnouncement] = (0, import_react73.useState)("");
|
|
14822
14856
|
const update = (patch) => onChange({ ...value, ...patch });
|
|
14823
14857
|
const apply = () => {
|
|
14824
14858
|
if (applyTarget !== null) applyBrandProfile(value, applyTarget);
|
|
@@ -14890,7 +14924,7 @@ function BrandProfileEditor({
|
|
|
14890
14924
|
var BrandProfiles = BrandProfileEditor;
|
|
14891
14925
|
|
|
14892
14926
|
// src/components/DiffViewer.tsx
|
|
14893
|
-
var
|
|
14927
|
+
var import_react74 = require("react");
|
|
14894
14928
|
|
|
14895
14929
|
// src/diff-model.ts
|
|
14896
14930
|
function isJsonObject(value) {
|
|
@@ -14986,9 +15020,9 @@ function DiffViewer({
|
|
|
14986
15020
|
const labels = { ...DEFAULT_DIFF_VIEWER_LABELS, ...labelOverrides };
|
|
14987
15021
|
const resolutionLabel = { accept: labels.resolutionAccept, skip: labels.resolutionSkip, pending: labels.resolutionPending };
|
|
14988
15022
|
const buttonSize = controlSize === "md" ? void 0 : `uix-btn--${controlSize}`;
|
|
14989
|
-
const id = (0,
|
|
14990
|
-
const entries = (0,
|
|
14991
|
-
const [internalResolutions, setInternalResolutions] = (0,
|
|
15023
|
+
const id = (0, import_react74.useId)();
|
|
15024
|
+
const entries = (0, import_react74.useMemo)(() => providedEntries ?? buildThreeWayDiff(base, current, incoming), [providedEntries, base, current, incoming]);
|
|
15025
|
+
const [internalResolutions, setInternalResolutions] = (0, import_react74.useState)({});
|
|
14992
15026
|
const resolutions = controlledResolutions ?? internalResolutions;
|
|
14993
15027
|
const summary = summarizeDiff(entries, resolutions);
|
|
14994
15028
|
const resolve = (path, resolution) => {
|
|
@@ -15051,7 +15085,7 @@ function DiffViewer({
|
|
|
15051
15085
|
}
|
|
15052
15086
|
|
|
15053
15087
|
// src/components/TextDiff.tsx
|
|
15054
|
-
var
|
|
15088
|
+
var import_react75 = require("react");
|
|
15055
15089
|
|
|
15056
15090
|
// src/text-diff-model.ts
|
|
15057
15091
|
var WORD_TOKENS = /\s+|[\p{L}\p{M}\p{N}_]+|[^\s\p{L}\p{M}\p{N}_]/gu;
|
|
@@ -15330,7 +15364,7 @@ function Marked({ segments, side, labels, whole }) {
|
|
|
15330
15364
|
": "
|
|
15331
15365
|
] }),
|
|
15332
15366
|
segment.text
|
|
15333
|
-
] }, i) : /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
15367
|
+
] }, i) : /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_react75.Fragment, { children: segment.text }, i)) });
|
|
15334
15368
|
}
|
|
15335
15369
|
function Cell({ line, side, kind, labels }) {
|
|
15336
15370
|
if (!line) return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "uix-text-diff__cell", "data-side": side, "data-empty": "", "aria-hidden": "true" });
|
|
@@ -15342,9 +15376,9 @@ function Cell({ line, side, kind, labels }) {
|
|
|
15342
15376
|
] });
|
|
15343
15377
|
}
|
|
15344
15378
|
function Rows({ rows, view, labels, focusFirst }) {
|
|
15345
|
-
const [open, setOpen] = (0,
|
|
15346
|
-
const first = (0,
|
|
15347
|
-
(0,
|
|
15379
|
+
const [open, setOpen] = (0, import_react75.useState)(() => /* @__PURE__ */ new Set());
|
|
15380
|
+
const first = (0, import_react75.useRef)(null);
|
|
15381
|
+
(0, import_react75.useEffect)(() => {
|
|
15348
15382
|
if (focusFirst) first.current?.focus();
|
|
15349
15383
|
}, [focusFirst]);
|
|
15350
15384
|
const firstProps = (index) => focusFirst && index === 0 ? { ref: first, tabIndex: -1 } : {};
|
|
@@ -15357,7 +15391,7 @@ function Rows({ rows, view, labels, focusFirst }) {
|
|
|
15357
15391
|
const after = row.kind === "delete" ? void 0 : row.after;
|
|
15358
15392
|
if (view === "unified") {
|
|
15359
15393
|
if (row.kind === "equal") return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "uix-text-diff__row", "data-kind": "equal", ...firstProps(index), children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(Cell, { line: after, side: "after", kind: "equal", labels }) }, index);
|
|
15360
|
-
return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(
|
|
15394
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(import_react75.Fragment, { children: [
|
|
15361
15395
|
before && /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "uix-text-diff__row", "data-kind": "delete", children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(Cell, { line: before, side: "before", kind: row.kind, labels }) }),
|
|
15362
15396
|
after && /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "uix-text-diff__row", "data-kind": "insert", children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(Cell, { line: after, side: "after", kind: row.kind, labels }) })
|
|
15363
15397
|
] }, index);
|
|
@@ -15386,8 +15420,8 @@ function TextDiff({
|
|
|
15386
15420
|
}) {
|
|
15387
15421
|
const uixLabels = useUixLabels();
|
|
15388
15422
|
const labels = { ...DEFAULT_TEXT_DIFF_LABELS, ...uixLabels.textDiff, ...labelOverrides };
|
|
15389
|
-
const result = (0,
|
|
15390
|
-
const rows = (0,
|
|
15423
|
+
const result = (0, import_react75.useMemo)(() => diffText(before, after, { granularity, maxTokens, maxEdits }), [before, after, granularity, maxTokens, maxEdits]);
|
|
15424
|
+
const rows = (0, import_react75.useMemo)(() => granularity === "line" && result.status === "ok" ? textDiffRows(result, { context }) : [], [result, granularity, context]);
|
|
15391
15425
|
const heads = /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "uix-text-diff__heads", "aria-hidden": view === "unified" || void 0, children: [
|
|
15392
15426
|
/* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("span", { className: "uix-text-diff__head", "data-side": "before", children: [
|
|
15393
15427
|
view === "unified" && /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("span", { "aria-hidden": "true", children: "\u2212 " }),
|
|
@@ -15405,7 +15439,7 @@ function TextDiff({
|
|
|
15405
15439
|
else {
|
|
15406
15440
|
const prose = (side2) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "uix-text-diff__prose", "data-side": side2, children: result.ops.map((op, i) => {
|
|
15407
15441
|
const text = op.tokens.join("");
|
|
15408
|
-
if (op.type === "equal") return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
15442
|
+
if (op.type === "equal") return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_react75.Fragment, { children: text }, i);
|
|
15409
15443
|
if (op.type === "delete" && side2 === "after") return null;
|
|
15410
15444
|
if (op.type === "insert" && side2 === "before") return null;
|
|
15411
15445
|
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(Marked, { segments: [{ text, changed: true }], side: op.type === "delete" ? "before" : "after", labels }, i);
|