@tensor_1/react 2.66.0 → 2.67.1
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/THIRD_PARTY_NOTICES.md +2 -2
- package/component-inventory.json +1076 -0
- package/dist/{ChartCore-CY5a4teJ.d.cts → ChartCore-BX0frnUz.d.cts} +1 -8
- package/dist/ChartMetric-bCAW4yvf.d.cts +16 -0
- package/dist/{GlanceCharts-Cb39RqDC.d.cts → GlanceCharts-PVaEwyp2.d.cts} +1 -1
- package/dist/chart-analytic.cjs +41 -38
- package/dist/chart-analytic.d.cts +3 -2
- package/dist/chart-analytic.d.ts +2 -1
- package/dist/chart-preset.cjs +37 -34
- package/dist/chart-preset.d.cts +5 -4
- package/dist/chart-preset.d.ts +2 -1
- package/dist/chart.cjs +37 -34
- package/dist/chart.d.cts +5 -4
- package/dist/chart.d.ts +2 -1
- package/dist/components/Avatar.d.ts +6 -3
- package/dist/components/Avatar.js +9 -3
- package/dist/components/Chart.d.ts +2 -1
- package/dist/components/ChartCore.d.ts +3 -8
- package/dist/components/ChartCore.js +1 -7
- package/dist/components/ChartMetric.d.ts +16 -0
- package/dist/components/ChartMetric.js +12 -0
- package/dist/components/ChartPanels.d.ts +1 -0
- package/dist/components/FocusOnMount.d.ts +15 -15
- package/dist/components/GlanceCharts.d.ts +1 -0
- package/dist/components/Menu.js +1 -0
- package/dist/components/MotionList.d.ts +16 -16
- package/dist/components/RuleBuilder.d.ts +8 -1
- package/dist/components/RuleBuilder.js +34 -12
- package/dist/glyphs-BAAgp2Xv.d.cts +256 -0
- package/dist/icons/Icon.d.ts +23 -24
- package/dist/icons/Icon.js +13 -8
- package/dist/icons/glyphs.js +3 -3
- package/dist/icons/intrinsic-components.d.ts +273 -0
- package/dist/icons/intrinsic-components.js +540 -0
- package/dist/icons/types.d.ts +9 -2
- package/dist/icons-intrinsic.cjs +1383 -0
- package/dist/icons-intrinsic.d.cts +275 -0
- package/dist/icons-intrinsic.d.ts +4 -0
- package/dist/icons-intrinsic.js +5 -0
- package/dist/icons.cjs +16 -11
- package/dist/icons.d.cts +6 -257
- package/dist/index.cjs +356 -304
- package/dist/index.d.cts +17 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/rule-builder-model.d.ts +4 -2
- package/dist/rule-builder-model.js +7 -1
- package/dist/{types-B7OIndwg.d.cts → types-cpbqVqOW.d.cts} +9 -2
- package/package.json +7 -2
package/dist/index.cjs
CHANGED
|
@@ -48,6 +48,7 @@ __export(src_exports, {
|
|
|
48
48
|
CellSub: () => CellSub,
|
|
49
49
|
ChangeHighlight: () => ChangeHighlight,
|
|
50
50
|
ChartCard: () => ChartCard,
|
|
51
|
+
ChartMetric: () => ChartMetric,
|
|
51
52
|
Checkbox: () => Checkbox,
|
|
52
53
|
CheckboxGroup: () => CheckboxGroup,
|
|
53
54
|
Chip: () => Chip,
|
|
@@ -1539,37 +1540,42 @@ function useUixLabels() {
|
|
|
1539
1540
|
// src/icons/Icon.tsx
|
|
1540
1541
|
var import_react7 = require("react");
|
|
1541
1542
|
var SIZES = /* @__PURE__ */ new Set(["sm", "md", "lg"]);
|
|
1542
|
-
function renderIcon(node,
|
|
1543
|
+
function renderIcon(node, props, ref, name, defaults = {}) {
|
|
1544
|
+
const { size = defaults.size ?? "md", sizeMode = defaults.sizeMode ?? "explicit", tone = "current", label, strokeWidth = 2, animate, className, style, children, ...rest } = props;
|
|
1543
1545
|
const tokenSize = typeof size === "string" && SIZES.has(size);
|
|
1546
|
+
const intrinsic = sizeMode === "intrinsic" && !tokenSize;
|
|
1544
1547
|
const length = typeof size === "number" ? `${size}px` : tokenSize ? void 0 : size;
|
|
1548
|
+
const accessibleSvg = Boolean(label) || sizeMode === "intrinsic" && (Boolean(children) || Object.keys(rest).some((key) => key.startsWith("aria-") || key === "role" || key === "title"));
|
|
1549
|
+
const glyphChildren = node.map(([tag, attrs], i) => (0, import_react7.createElement)(tag, { key: i, ...attrs }));
|
|
1545
1550
|
return (0, import_react7.createElement)(
|
|
1546
1551
|
"svg",
|
|
1547
1552
|
{
|
|
1548
1553
|
ref,
|
|
1549
1554
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1550
1555
|
viewBox: "0 0 24 24",
|
|
1556
|
+
...intrinsic ? { width: size, height: size } : {},
|
|
1551
1557
|
fill: "none",
|
|
1552
|
-
stroke: "currentColor",
|
|
1558
|
+
stroke: sizeMode === "intrinsic" ? rest.color ?? "currentColor" : "currentColor",
|
|
1553
1559
|
strokeWidth,
|
|
1554
1560
|
strokeLinecap: "round",
|
|
1555
1561
|
strokeLinejoin: "round",
|
|
1556
1562
|
focusable: "false",
|
|
1557
|
-
className: cx("uix-icon", tokenSize && size !== "md" && `uix-icon--${size}`, tone !== "current" && `uix-icon--${tone}`, className),
|
|
1558
|
-
style: length ? { width: length, height: length, ...style } : style,
|
|
1563
|
+
className: cx(intrinsic ? "uix-icon-intrinsic" : "uix-icon", tokenSize && size !== "md" && `uix-icon--${size}`, tone !== "current" && `uix-icon--${tone}`, className),
|
|
1564
|
+
style: !intrinsic && length ? { width: length, height: length, ...style } : style,
|
|
1559
1565
|
role: label ? "img" : void 0,
|
|
1560
1566
|
"aria-label": label || void 0,
|
|
1561
|
-
"aria-hidden":
|
|
1567
|
+
"aria-hidden": accessibleSvg ? void 0 : true,
|
|
1562
1568
|
// the animated icons (2.60): icon.css keys each motion on the glyph's name
|
|
1563
1569
|
"data-icon": animate && name ? name : void 0,
|
|
1564
1570
|
"data-animate": animate ? "" : void 0,
|
|
1565
1571
|
...rest
|
|
1566
1572
|
},
|
|
1567
|
-
|
|
1573
|
+
sizeMode === "intrinsic" ? [...glyphChildren, ...Array.isArray(children) ? children : [children]] : glyphChildren
|
|
1568
1574
|
);
|
|
1569
1575
|
}
|
|
1570
|
-
function createIcon(displayName, node) {
|
|
1576
|
+
function createIcon(displayName, node, defaults) {
|
|
1571
1577
|
const name = displayName.replace(/Icon$/, "").replace(/([a-z0-9])([A-Z])|([a-zA-Z])(\d)/g, (_, a, b, c, d) => a ? `${a}-${b}` : `${c}-${d}`).toLowerCase();
|
|
1572
|
-
const Component = (0, import_react7.forwardRef)((props, ref) => renderIcon(node, props, ref, name));
|
|
1578
|
+
const Component = (0, import_react7.forwardRef)((props, ref) => renderIcon(node, props, ref, name, defaults));
|
|
1573
1579
|
Component.displayName = displayName;
|
|
1574
1580
|
return Component;
|
|
1575
1581
|
}
|
|
@@ -9376,17 +9382,22 @@ var DEFAULT_PRESENCE_LABELS = {
|
|
|
9376
9382
|
away: "away",
|
|
9377
9383
|
offline: "offline"
|
|
9378
9384
|
};
|
|
9379
|
-
|
|
9385
|
+
var positivePixels = (size) => typeof size === "number" && Number.isFinite(size) && size > 0 ? size : void 0;
|
|
9386
|
+
function Avatar({ size = "md", src, alt, children, status, presence, presenceLabels, onlineLabel, className, style, ...props }) {
|
|
9380
9387
|
const state = presence ?? (status ? "online" : void 0);
|
|
9381
9388
|
const word = state && (presenceLabels?.[state] ?? (state === "online" ? onlineLabel : void 0) ?? DEFAULT_PRESENCE_LABELS[state]);
|
|
9382
|
-
|
|
9389
|
+
const pixels = positivePixels(size);
|
|
9390
|
+
const resolvedStyle = pixels === void 0 ? style : { width: pixels, height: pixels, fontSize: Math.max(9, Math.round(pixels * 0.42)), ...style };
|
|
9391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className: cx("uix-avatar", typeof size === "string" && size !== "md" && `uix-avatar--${size}`, className), style: resolvedStyle, ...props, children: [
|
|
9383
9392
|
src ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("img", { src, alt: alt ?? "" }) : children,
|
|
9384
9393
|
state && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "uix-avatar__status", "data-presence": state === "online" ? void 0 : state, "aria-hidden": "true" }),
|
|
9385
9394
|
state && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "uix-visually-hidden", children: word })
|
|
9386
9395
|
] });
|
|
9387
9396
|
}
|
|
9388
|
-
function PresenceDot({ presence, label, className, ...props }) {
|
|
9397
|
+
function PresenceDot({ presence, label, size, className, style, ...props }) {
|
|
9389
9398
|
const decorative = label === null;
|
|
9399
|
+
const pixels = positivePixels(size);
|
|
9400
|
+
const resolvedStyle = pixels === void 0 ? style : { width: pixels, height: pixels, ...style };
|
|
9390
9401
|
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
9391
9402
|
"span",
|
|
9392
9403
|
{
|
|
@@ -9394,6 +9405,7 @@ function PresenceDot({ presence, label, className, ...props }) {
|
|
|
9394
9405
|
role: decorative ? void 0 : "img",
|
|
9395
9406
|
"aria-label": decorative ? void 0 : label ?? DEFAULT_PRESENCE_LABELS[presence],
|
|
9396
9407
|
"aria-hidden": decorative ? true : void 0,
|
|
9408
|
+
style: resolvedStyle,
|
|
9397
9409
|
...props
|
|
9398
9410
|
}
|
|
9399
9411
|
);
|
|
@@ -9454,6 +9466,7 @@ function Menu({ trigger, children, open: controlledOpen, defaultOpen = false, on
|
|
|
9454
9466
|
if (refocus) triggerRef.current?.focus();
|
|
9455
9467
|
};
|
|
9456
9468
|
(0, import_react64.useEffect)(() => {
|
|
9469
|
+
typeahead2.current = { text: "", at: 0 };
|
|
9457
9470
|
const el = menu();
|
|
9458
9471
|
if (!el) return;
|
|
9459
9472
|
const shown = () => {
|
|
@@ -19503,6 +19516,9 @@ function StatusRow({ indicator, name, meta, className, ...props }) {
|
|
|
19503
19516
|
] });
|
|
19504
19517
|
}
|
|
19505
19518
|
|
|
19519
|
+
// src/components/RuleBuilder.tsx
|
|
19520
|
+
var import_react106 = require("react");
|
|
19521
|
+
|
|
19506
19522
|
// src/rule-builder-model.ts
|
|
19507
19523
|
var fillLabel2 = (template, values) => template.replace(/\{(\w+)\}/g, (match, key) => Object.prototype.hasOwnProperty.call(values, key) ? String(values[key]) : match);
|
|
19508
19524
|
var DEFAULT_RULE_VALIDATION_MESSAGES = {
|
|
@@ -19520,6 +19536,9 @@ function isRuleGroup(node) {
|
|
|
19520
19536
|
function ruleDepth(group2) {
|
|
19521
19537
|
return 1 + Math.max(0, ...group2.conditions.filter(isRuleGroup).map(ruleDepth));
|
|
19522
19538
|
}
|
|
19539
|
+
function ruleConditionCount(node) {
|
|
19540
|
+
return isRuleGroup(node) ? node.conditions.reduce((sum, child) => sum + ruleConditionCount(child), 0) : 1;
|
|
19541
|
+
}
|
|
19523
19542
|
function findRuleNodeDepth(group2, id, depth = 1) {
|
|
19524
19543
|
if (group2.id === id) return depth;
|
|
19525
19544
|
for (const node of group2.conditions) {
|
|
@@ -19541,7 +19560,9 @@ function mapRuleGroup(group2, id, update) {
|
|
|
19541
19560
|
})
|
|
19542
19561
|
};
|
|
19543
19562
|
}
|
|
19544
|
-
function appendRuleNode(group2, parentId, node, maxDepth = 3) {
|
|
19563
|
+
function appendRuleNode(group2, parentId, node, maxDepth = 3, maxConditions = Number.POSITIVE_INFINITY) {
|
|
19564
|
+
const capacity = Number.isNaN(maxConditions) ? 0 : Math.max(0, Math.floor(maxConditions));
|
|
19565
|
+
if (capacity !== Number.POSITIVE_INFINITY && ruleConditionCount(group2) + ruleConditionCount(node) > capacity) return group2;
|
|
19545
19566
|
const parentDepth = findRuleNodeDepth(group2, parentId);
|
|
19546
19567
|
if (parentDepth === void 0) return group2;
|
|
19547
19568
|
const addedDepth = isRuleGroup(node) ? ruleDepth(node) : 0;
|
|
@@ -19681,14 +19702,28 @@ function defaultCondition(fields, operators) {
|
|
|
19681
19702
|
const operator = operators.find((item) => field?.operators?.includes(item.id)) ?? operators[0];
|
|
19682
19703
|
return { id: nextId("condition"), field: field?.id ?? "", operator: operator?.id ?? "", value: "" };
|
|
19683
19704
|
}
|
|
19684
|
-
function RuleGroupEditor({ group: group2, depth, root, fields, operators, maxDepth, disabled, onRootChange, labels, combinator, hideCombinator, allowGroups }) {
|
|
19705
|
+
function RuleGroupEditor({ group: group2, depth, root, fields, operators, maxDepth, maxConditions, disabled, onRootChange, labels, combinator, hideCombinator, allowGroups }) {
|
|
19706
|
+
const groupRef = (0, import_react106.useRef)(null);
|
|
19707
|
+
const addRef = (0, import_react106.useRef)(null);
|
|
19708
|
+
const focusAfterMutation = (0, import_react106.useRef)(null);
|
|
19709
|
+
(0, import_react106.useLayoutEffect)(() => {
|
|
19710
|
+
if (focusAfterMutation.current === "row") {
|
|
19711
|
+
const target = groupRef.current?.querySelector('[role="combobox"]') ?? groupRef.current?.querySelector("select, input");
|
|
19712
|
+
target?.focus();
|
|
19713
|
+
} else if (focusAfterMutation.current === "add") addRef.current?.focus();
|
|
19714
|
+
focusAfterMutation.current = null;
|
|
19715
|
+
}, [group2.conditions]);
|
|
19716
|
+
const canAdd = maxConditions === Number.POSITIVE_INFINITY || ruleConditionCount(root) < maxConditions;
|
|
19685
19717
|
const updateNode = (id, update) => onRootChange(mapRuleGroup(root, id, update));
|
|
19686
|
-
const
|
|
19687
|
-
|
|
19688
|
-
id
|
|
19689
|
-
|
|
19690
|
-
|
|
19691
|
-
|
|
19718
|
+
const append = (node) => {
|
|
19719
|
+
if (disabled || !canAdd) return;
|
|
19720
|
+
const next = appendRuleNode(root, group2.id, node, maxDepth, maxConditions);
|
|
19721
|
+
if (next === root) return;
|
|
19722
|
+
if (maxConditions === 1) focusAfterMutation.current = "row";
|
|
19723
|
+
onRootChange(next);
|
|
19724
|
+
};
|
|
19725
|
+
const addCondition = () => append(defaultCondition(fields, operators));
|
|
19726
|
+
const addGroup = () => append({ id: nextId("group"), combinator: combinator ?? "and", conditions: [defaultCondition(fields, operators)] });
|
|
19692
19727
|
const rowControls = (node, index, label) => disabled ? null : /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
19693
19728
|
RowControls,
|
|
19694
19729
|
{
|
|
@@ -19699,10 +19734,13 @@ function RuleGroupEditor({ group: group2, depth, root, fields, operators, maxDep
|
|
|
19699
19734
|
disabled: false,
|
|
19700
19735
|
onUp: () => onRootChange(moveRuleNode(root, node.id, -1)),
|
|
19701
19736
|
onDown: () => onRootChange(moveRuleNode(root, node.id, 1)),
|
|
19702
|
-
onRemove: () =>
|
|
19737
|
+
onRemove: () => {
|
|
19738
|
+
if (maxConditions === 1) focusAfterMutation.current = ruleConditionCount(root) === ruleConditionCount(node) ? "add" : "row";
|
|
19739
|
+
onRootChange(removeRuleNode(root, node.id));
|
|
19740
|
+
}
|
|
19703
19741
|
}
|
|
19704
19742
|
);
|
|
19705
|
-
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("fieldset", { className: "uix-rule-builder__group", "data-depth": depth, children: [
|
|
19743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("fieldset", { ref: groupRef, className: "uix-rule-builder__group", "data-depth": depth, children: [
|
|
19706
19744
|
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("legend", { className: "uix-rule-builder__group-heading", children: [
|
|
19707
19745
|
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { children: depth === 1 ? labels.when : labels.group }),
|
|
19708
19746
|
!hideCombinator && (combinator ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("span", { className: "uix-rule-builder__match", children: [
|
|
@@ -19724,7 +19762,7 @@ function RuleGroupEditor({ group: group2, depth, root, fields, operators, maxDep
|
|
|
19724
19762
|
] }))
|
|
19725
19763
|
] }),
|
|
19726
19764
|
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "uix-rule-builder__rows", children: group2.conditions.map((node, index) => isRuleGroup(node) ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "uix-rule-builder__nested", children: [
|
|
19727
|
-
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(RuleGroupEditor, { ...{ group: node, depth: depth + 1, root, fields, operators, maxDepth, disabled, onRootChange, labels, combinator, hideCombinator, allowGroups } }),
|
|
19765
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(RuleGroupEditor, { ...{ group: node, depth: depth + 1, root, fields, operators, maxDepth, maxConditions, disabled, onRootChange, labels, combinator, hideCombinator, allowGroups } }),
|
|
19728
19766
|
rowControls(node, index, labels.itemGroup)
|
|
19729
19767
|
] }, node.id) : /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
19730
19768
|
ConditionRow,
|
|
@@ -19739,8 +19777,8 @@ function RuleGroupEditor({ group: group2, depth, root, fields, operators, maxDep
|
|
|
19739
19777
|
},
|
|
19740
19778
|
node.id
|
|
19741
19779
|
)) }),
|
|
19742
|
-
!disabled && /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "uix-rule-builder__add", children: [
|
|
19743
|
-
/* @__PURE__ */ (0, import_jsx_runtime123.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 }),
|
|
19780
|
+
!disabled && canAdd && /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "uix-rule-builder__add", children: [
|
|
19781
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("button", { ref: addRef, type: "button", className: "uix-btn uix-btn--secondary uix-btn--sm", onClick: addCondition, disabled: fields.length === 0 || operators.length === 0, children: labels.addCondition }),
|
|
19744
19782
|
allowGroups && /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("button", { type: "button", className: "uix-btn uix-btn--ghost uix-btn--sm", onClick: addGroup, disabled: depth >= maxDepth, children: labels.addGroup })
|
|
19745
19783
|
] })
|
|
19746
19784
|
] });
|
|
@@ -19799,6 +19837,7 @@ function RuleBuilder({
|
|
|
19799
19837
|
maxDepth = 3,
|
|
19800
19838
|
readOnly = false,
|
|
19801
19839
|
conditionsOnly = false,
|
|
19840
|
+
maxConditions = Number.POSITIVE_INFINITY,
|
|
19802
19841
|
combinator,
|
|
19803
19842
|
hideCombinator = false,
|
|
19804
19843
|
allowGroups = true,
|
|
@@ -19857,6 +19896,7 @@ function RuleBuilder({
|
|
|
19857
19896
|
] });
|
|
19858
19897
|
}
|
|
19859
19898
|
const disabled = readOnly === true;
|
|
19899
|
+
const conditionLimit = Number.isNaN(maxConditions) ? 0 : Math.max(0, Math.floor(maxConditions));
|
|
19860
19900
|
const emitWhen = (when) => onChange({ ...value, when: combinator ? setRuleCombinator(when, combinator) : when });
|
|
19861
19901
|
const updateActions = (next) => onChange({ ...value, then: next });
|
|
19862
19902
|
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("section", { className: cx("uix-rule-builder", disabled && "uix-rule-builder--readonly", className), "aria-label": labels.region, children: [
|
|
@@ -19869,6 +19909,7 @@ function RuleBuilder({
|
|
|
19869
19909
|
fields,
|
|
19870
19910
|
operators,
|
|
19871
19911
|
maxDepth,
|
|
19912
|
+
maxConditions: conditionLimit,
|
|
19872
19913
|
disabled,
|
|
19873
19914
|
onRootChange: emitWhen,
|
|
19874
19915
|
labels,
|
|
@@ -19926,7 +19967,7 @@ function RuleBuilder({
|
|
|
19926
19967
|
}
|
|
19927
19968
|
|
|
19928
19969
|
// src/components/BuilderCanvas.tsx
|
|
19929
|
-
var
|
|
19970
|
+
var import_react107 = require("react");
|
|
19930
19971
|
var import_jsx_runtime124 = require("react/jsx-runtime");
|
|
19931
19972
|
var DEFAULT_BUILDER_CANVAS_LABELS = {
|
|
19932
19973
|
region: "Builder canvas",
|
|
@@ -19966,13 +20007,13 @@ function BuilderCanvas({
|
|
|
19966
20007
|
labels: labelOverrides
|
|
19967
20008
|
}) {
|
|
19968
20009
|
const labels = { ...DEFAULT_BUILDER_CANVAS_LABELS, ...labelOverrides };
|
|
19969
|
-
const [internalSelectedId, setInternalSelectedId] = (0,
|
|
19970
|
-
const [draggedId, setDraggedId] = (0,
|
|
19971
|
-
const propertyHeadingRef = (0,
|
|
19972
|
-
const shouldFocusProperties = (0,
|
|
20010
|
+
const [internalSelectedId, setInternalSelectedId] = (0, import_react107.useState)();
|
|
20011
|
+
const [draggedId, setDraggedId] = (0, import_react107.useState)();
|
|
20012
|
+
const propertyHeadingRef = (0, import_react107.useRef)(null);
|
|
20013
|
+
const shouldFocusProperties = (0, import_react107.useRef)(false);
|
|
19973
20014
|
const selectedId = controlledSelectedId ?? internalSelectedId;
|
|
19974
20015
|
const selected = items.find((item) => item.id === selectedId);
|
|
19975
|
-
(0,
|
|
20016
|
+
(0, import_react107.useEffect)(() => {
|
|
19976
20017
|
if (shouldFocusProperties.current && selected) {
|
|
19977
20018
|
propertyHeadingRef.current?.focus();
|
|
19978
20019
|
shouldFocusProperties.current = false;
|
|
@@ -20060,7 +20101,7 @@ function BuilderCanvas({
|
|
|
20060
20101
|
}
|
|
20061
20102
|
|
|
20062
20103
|
// src/components/SchedulingCalendar.tsx
|
|
20063
|
-
var
|
|
20104
|
+
var import_react112 = require("react");
|
|
20064
20105
|
|
|
20065
20106
|
// src/scheduling-calendar-model.ts
|
|
20066
20107
|
var DEFAULT_LANE_CAP = 2;
|
|
@@ -20230,14 +20271,14 @@ function proposeMove(span, delta, timeZone) {
|
|
|
20230
20271
|
}
|
|
20231
20272
|
|
|
20232
20273
|
// src/components/SchedulingAgenda.tsx
|
|
20233
|
-
var
|
|
20274
|
+
var import_react109 = require("react");
|
|
20234
20275
|
|
|
20235
20276
|
// src/hooks/usePrinting.ts
|
|
20236
|
-
var
|
|
20277
|
+
var import_react108 = require("react");
|
|
20237
20278
|
var import_react_dom5 = require("react-dom");
|
|
20238
20279
|
function usePrinting(enabled = true) {
|
|
20239
|
-
const [printing, setPrinting] = (0,
|
|
20240
|
-
(0,
|
|
20280
|
+
const [printing, setPrinting] = (0, import_react108.useState)(false);
|
|
20281
|
+
(0, import_react108.useEffect)(() => {
|
|
20241
20282
|
if (!enabled || typeof window === "undefined") return void 0;
|
|
20242
20283
|
const set = (next) => {
|
|
20243
20284
|
(0, import_react_dom5.flushSync)(() => setPrinting(next));
|
|
@@ -20312,11 +20353,11 @@ function AgendaBody({
|
|
|
20312
20353
|
if ((group2.continuesCount ?? 0) > 0) flatRows.push({ kind: "continues", key: `c-${groupKey}`, group: group2 });
|
|
20313
20354
|
});
|
|
20314
20355
|
}
|
|
20315
|
-
const [narrow, setNarrow] = (0,
|
|
20356
|
+
const [narrow, setNarrow] = (0, import_react109.useState)(false);
|
|
20316
20357
|
const printing = usePrinting(flat);
|
|
20317
20358
|
const virtual = useVirtualRows(flatRows, { rowHeight: narrow ? AGENDA_NARROW_ROW : AGENDA_VIRTUAL_ROW, threshold: 0, estimatedViewportHeight: AGENDA_VIRTUAL_VIEWPORT, enabled: !printing });
|
|
20318
20359
|
const scroller = virtual.containerRef;
|
|
20319
|
-
(0,
|
|
20360
|
+
(0, import_react109.useLayoutEffect)(() => {
|
|
20320
20361
|
const box = scroller.current;
|
|
20321
20362
|
if (!box) return;
|
|
20322
20363
|
const measure3 = () => setNarrow(box.clientWidth > 0 && box.clientWidth <= AGENDA_NARROW_WIDTH);
|
|
@@ -20325,8 +20366,8 @@ function AgendaBody({
|
|
|
20325
20366
|
observer.observe(box);
|
|
20326
20367
|
return () => observer.disconnect();
|
|
20327
20368
|
}, [scroller]);
|
|
20328
|
-
const grouped = (0,
|
|
20329
|
-
(0,
|
|
20369
|
+
const grouped = (0, import_react109.useRef)(null);
|
|
20370
|
+
(0, import_react109.useLayoutEffect)(() => {
|
|
20330
20371
|
const box = grouped.current;
|
|
20331
20372
|
if (!box) return;
|
|
20332
20373
|
const observer = new ResizeObserver((entries) => {
|
|
@@ -20338,7 +20379,7 @@ function AgendaBody({
|
|
|
20338
20379
|
box.querySelectorAll(":scope > section > .uix-scheduling-calendar__agenda-head").forEach((head) => observer.observe(head));
|
|
20339
20380
|
return () => observer.disconnect();
|
|
20340
20381
|
}, [groups]);
|
|
20341
|
-
const stop2 = (0,
|
|
20382
|
+
const stop2 = (0, import_react109.useRef)({ node: null, index: 0 });
|
|
20342
20383
|
const container = () => flat ? scroller.current : grouped.current;
|
|
20343
20384
|
const controls = () => Array.from(container()?.querySelectorAll("button") ?? []);
|
|
20344
20385
|
const focusStop = (target) => {
|
|
@@ -20363,7 +20404,7 @@ function AgendaBody({
|
|
|
20363
20404
|
const scrollToRow = (box, index) => {
|
|
20364
20405
|
box.scrollTop = Math.max(0, index * rowHeight - (box.clientHeight - rowHeight) / 2);
|
|
20365
20406
|
};
|
|
20366
|
-
const landing = (0,
|
|
20407
|
+
const landing = (0, import_react109.useRef)(null);
|
|
20367
20408
|
const land = () => {
|
|
20368
20409
|
const wanted = landing.current;
|
|
20369
20410
|
if (!wanted) return;
|
|
@@ -20384,7 +20425,7 @@ function AgendaBody({
|
|
|
20384
20425
|
scrollToRow(box, index);
|
|
20385
20426
|
}
|
|
20386
20427
|
};
|
|
20387
|
-
(0,
|
|
20428
|
+
(0, import_react109.useEffect)(() => {
|
|
20388
20429
|
const all = controls();
|
|
20389
20430
|
stop2.current = syncRovingStop(all, stop2.current);
|
|
20390
20431
|
const box = flat ? scroller.current : null;
|
|
@@ -20440,7 +20481,7 @@ function AgendaBody({
|
|
|
20440
20481
|
overlay.scopeLabel && /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("span", { className: "uix-scheduling-calendar__window-scope", children: overlay.scopeLabel })
|
|
20441
20482
|
] }) });
|
|
20442
20483
|
const heading = (group2, withNotes) => /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "uix-scheduling-calendar__agenda-head", children: [
|
|
20443
|
-
(0,
|
|
20484
|
+
(0, import_react109.createElement)(`h${headingLevel}`, { className: "uix-scheduling-calendar__agenda-heading" }, group2.heading ?? dateText(group2.date, "day")),
|
|
20444
20485
|
withNotes && group2.annotations && group2.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("ul", { className: "uix-scheduling-calendar__agenda-notes", children: uniqueKeys(group2.annotations.map((overlay) => overlay.id)).map((key, at2) => /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("li", { children: note(group2.annotations[at2]) }, key)) })
|
|
20445
20486
|
] });
|
|
20446
20487
|
const timeText = (entry, date) => {
|
|
@@ -20510,7 +20551,7 @@ function AgendaBody({
|
|
|
20510
20551
|
}
|
|
20511
20552
|
|
|
20512
20553
|
// src/components/SchedulingTimeGrid.tsx
|
|
20513
|
-
var
|
|
20554
|
+
var import_react110 = require("react");
|
|
20514
20555
|
var import_jsx_runtime126 = require("react/jsx-runtime");
|
|
20515
20556
|
var HOUR_MS2 = 36e5;
|
|
20516
20557
|
var MINUTES_PER_HOUR = 60;
|
|
@@ -20518,7 +20559,7 @@ var LINES_PER_HOUR = 3;
|
|
|
20518
20559
|
var DRAG_THRESHOLD2 = 4;
|
|
20519
20560
|
var DEFAULT_STEP = 15;
|
|
20520
20561
|
var DEFAULT_OPEN_HOUR = 8;
|
|
20521
|
-
var useIsomorphicLayoutEffect24 = typeof document !== "undefined" ?
|
|
20562
|
+
var useIsomorphicLayoutEffect24 = typeof document !== "undefined" ? import_react110.useLayoutEffect : import_react110.useEffect;
|
|
20522
20563
|
var hoursOf = (time) => {
|
|
20523
20564
|
const match = time === void 0 ? null : /^([01]\d|2[0-3]):([0-5]\d)$/.exec(time);
|
|
20524
20565
|
return match ? Number(match[1]) + Number(match[2]) / MINUTES_PER_HOUR : null;
|
|
@@ -20530,7 +20571,7 @@ function uniqueById(items) {
|
|
|
20530
20571
|
const seen2 = /* @__PURE__ */ new Set();
|
|
20531
20572
|
return items.filter((item) => seen2.has(item.id) ? false : (seen2.add(item.id), true));
|
|
20532
20573
|
}
|
|
20533
|
-
var GridItem = (0,
|
|
20574
|
+
var GridItem = (0, import_react110.memo)(function GridItem2({ entry, segment, column, alone, name, status, movable, hintId, timeZone, continuesFrom, markers, renderEntry, renderMarker: renderMarker2, handlers: handlers2 }) {
|
|
20534
20575
|
const lines = linesFor(segment);
|
|
20535
20576
|
const continuation = segment.part === "continuation";
|
|
20536
20577
|
const style = vars({
|
|
@@ -20616,20 +20657,20 @@ function SchedulingTimeGrid({
|
|
|
20616
20657
|
emptyNote,
|
|
20617
20658
|
nothingToShow
|
|
20618
20659
|
}) {
|
|
20619
|
-
const rootRef = (0,
|
|
20620
|
-
const hintId = (0,
|
|
20621
|
-
const [widthCap, setWidthCap] = (0,
|
|
20622
|
-
const [ghost, setGhost] = (0,
|
|
20623
|
-
const [announcement, setAnnouncement] = (0,
|
|
20624
|
-
const [activeDay, setActiveDay] = (0,
|
|
20625
|
-
const enteredFrom = (0,
|
|
20660
|
+
const rootRef = (0, import_react110.useRef)(null);
|
|
20661
|
+
const hintId = (0, import_react110.useId)();
|
|
20662
|
+
const [widthCap, setWidthCap] = (0, import_react110.useState)(Infinity);
|
|
20663
|
+
const [ghost, setGhost] = (0, import_react110.useState)(null);
|
|
20664
|
+
const [announcement, setAnnouncement] = (0, import_react110.useState)("");
|
|
20665
|
+
const [activeDay, setActiveDay] = (0, import_react110.useState)(days[0]);
|
|
20666
|
+
const enteredFrom = (0, import_react110.useRef)(null);
|
|
20626
20667
|
const tabStop = days.includes(activeDay) ? activeDay : days[0];
|
|
20627
20668
|
const moving = canMove && onProposeMove !== void 0;
|
|
20628
20669
|
const step = Number.isFinite(givenStep) && givenStep > 0 ? givenStep : DEFAULT_STEP;
|
|
20629
|
-
const laneOptions = (0,
|
|
20630
|
-
const entries = (0,
|
|
20631
|
-
const overlays = (0,
|
|
20632
|
-
(0,
|
|
20670
|
+
const laneOptions = (0, import_react110.useMemo)(() => ({ crossMidnightMinutes: topLaneCrossMidnightMinutes }), [topLaneCrossMidnightMinutes]);
|
|
20671
|
+
const entries = (0, import_react110.useMemo)(() => uniqueById(givenEntries), [givenEntries]);
|
|
20672
|
+
const overlays = (0, import_react110.useMemo)(() => uniqueById(givenOverlays), [givenOverlays]);
|
|
20673
|
+
(0, import_react110.useEffect)(() => {
|
|
20633
20674
|
const root = rootRef.current;
|
|
20634
20675
|
if (!root || typeof ResizeObserver === "undefined") return void 0;
|
|
20635
20676
|
const column = root.querySelector("[data-tg-column]");
|
|
@@ -20654,21 +20695,21 @@ function SchedulingTimeGrid({
|
|
|
20654
20695
|
};
|
|
20655
20696
|
}, [days]);
|
|
20656
20697
|
const lanes = Math.max(1, Math.min(maxLanes, widthCap));
|
|
20657
|
-
const entryById = (0,
|
|
20658
|
-
const overlayById = (0,
|
|
20659
|
-
const columns = (0,
|
|
20660
|
-
const hiddenByWidth = (0,
|
|
20698
|
+
const entryById = (0, import_react110.useMemo)(() => new Map(entries.map((entry) => [entry.id, entry])), [entries]);
|
|
20699
|
+
const overlayById = (0, import_react110.useMemo)(() => new Map(overlays.map((overlay) => [overlay.id, overlay])), [overlays]);
|
|
20700
|
+
const columns = (0, import_react110.useMemo)(() => days.map((date) => layoutTimeGridDay(entries, date, timeZone, { ...laneOptions, maxLanes: lanes })), [days, entries, timeZone, laneOptions, lanes]);
|
|
20701
|
+
const hiddenByWidth = (0, import_react110.useMemo)(() => {
|
|
20661
20702
|
if (lanes >= maxLanes) return days.map(() => 0);
|
|
20662
20703
|
return days.map((date, index) => Math.max(0, columns[index].hidden.length - layoutTimeGridDay(entries, date, timeZone, { ...laneOptions, maxLanes }).hidden.length));
|
|
20663
20704
|
}, [days, entries, timeZone, laneOptions, lanes, maxLanes, columns]);
|
|
20664
|
-
const slots = (0,
|
|
20665
|
-
const top = (0,
|
|
20666
|
-
const drawable = (0,
|
|
20667
|
-
const strip = (0,
|
|
20668
|
-
const shades = (0,
|
|
20705
|
+
const slots = (0, import_react110.useMemo)(() => days.map((date) => zonedHourSlots(date, timeZone)), [days, timeZone]);
|
|
20706
|
+
const top = (0, import_react110.useMemo)(() => layoutDaySpans(entries.filter((entry) => placesInTopLane(entry, timeZone, laneOptions)), days, { timeZone, laneCap: Math.max(0, topLaneCap) }), [entries, days, timeZone, laneOptions, topLaneCap]);
|
|
20707
|
+
const drawable = (0, import_react110.useMemo)(() => overlays.filter((overlay) => new Date(overlay.end).getTime() >= new Date(overlay.start).getTime()), [overlays]);
|
|
20708
|
+
const strip = (0, import_react110.useMemo)(() => layoutDaySpans(drawable, days, { timeZone, laneCap: Math.max(0, windowLaneCap) }), [drawable, days, timeZone, windowLaneCap]);
|
|
20709
|
+
const shades = (0, import_react110.useMemo)(() => layoutDaySpans(drawable.filter((overlay) => overlay.global), days, { timeZone }).placed, [drawable, days, timeZone]);
|
|
20669
20710
|
const lanesIn = (placed) => placed.reduce((max, span) => Math.max(max, span.lane + 1), 0);
|
|
20670
20711
|
const maxHours = Math.max(...columns.map((column) => column.dayHours));
|
|
20671
|
-
const gutterIndex = (0,
|
|
20712
|
+
const gutterIndex = (0, import_react110.useMemo)(() => {
|
|
20672
20713
|
const signatures = slots.map(slotSignature);
|
|
20673
20714
|
const count2 = /* @__PURE__ */ new Map();
|
|
20674
20715
|
for (const signature of signatures) count2.set(signature, (count2.get(signature) ?? 0) + 1);
|
|
@@ -20693,15 +20734,15 @@ function SchedulingTimeGrid({
|
|
|
20693
20734
|
slot.instant.getTime()
|
|
20694
20735
|
));
|
|
20695
20736
|
const movable = (entry) => moving && entry.movable !== false;
|
|
20696
|
-
const live = (0,
|
|
20737
|
+
const live = (0, import_react110.useRef)({ ghost, entryById, timeZone, step, onProposeMove, onSelectEntry, labels, formatInstant, days, columns, movable });
|
|
20697
20738
|
live.current = { ghost, entryById, timeZone, step, onProposeMove, onSelectEntry, labels, formatInstant, days, columns, movable };
|
|
20698
|
-
const dragRef = (0,
|
|
20699
|
-
const suppressClick = (0,
|
|
20700
|
-
const refocus = (0,
|
|
20701
|
-
(0,
|
|
20739
|
+
const dragRef = (0, import_react110.useRef)(null);
|
|
20740
|
+
const suppressClick = (0, import_react110.useRef)(false);
|
|
20741
|
+
const refocus = (0, import_react110.useRef)(null);
|
|
20742
|
+
(0, import_react110.useEffect)(() => {
|
|
20702
20743
|
if (ghost && !entryById.has(ghost.id)) setGhost(null);
|
|
20703
20744
|
}, [ghost, entryById]);
|
|
20704
|
-
(0,
|
|
20745
|
+
(0, import_react110.useEffect)(() => {
|
|
20705
20746
|
const id = refocus.current;
|
|
20706
20747
|
const root = rootRef.current;
|
|
20707
20748
|
if (!id || !root) return;
|
|
@@ -20718,7 +20759,7 @@ function SchedulingTimeGrid({
|
|
|
20718
20759
|
}
|
|
20719
20760
|
}
|
|
20720
20761
|
});
|
|
20721
|
-
const send = (0,
|
|
20762
|
+
const send = (0, import_react110.useCallback)((id, delta) => {
|
|
20722
20763
|
const state = live.current;
|
|
20723
20764
|
const entry = state.entryById.get(id);
|
|
20724
20765
|
if (!entry || !state.onProposeMove || !state.movable(entry) || delta.days === 0 && delta.minutes === 0) {
|
|
@@ -20733,7 +20774,7 @@ function SchedulingTimeGrid({
|
|
|
20733
20774
|
result.then(clear, clear);
|
|
20734
20775
|
} else setGhost(null);
|
|
20735
20776
|
}, []);
|
|
20736
|
-
const handlers2 = (0,
|
|
20777
|
+
const handlers2 = (0, import_react110.useMemo)(() => ({
|
|
20737
20778
|
click: (entry) => {
|
|
20738
20779
|
live.current.onSelectEntry?.(entry);
|
|
20739
20780
|
},
|
|
@@ -20856,7 +20897,7 @@ function SchedulingTimeGrid({
|
|
|
20856
20897
|
};
|
|
20857
20898
|
}
|
|
20858
20899
|
}), [send]);
|
|
20859
|
-
(0,
|
|
20900
|
+
(0, import_react110.useEffect)(() => () => {
|
|
20860
20901
|
dragRef.current?.stop();
|
|
20861
20902
|
dragRef.current = null;
|
|
20862
20903
|
}, []);
|
|
@@ -20935,7 +20976,7 @@ function SchedulingTimeGrid({
|
|
|
20935
20976
|
};
|
|
20936
20977
|
const nowAt = now2 === void 0 ? null : new Date(now2).getTime();
|
|
20937
20978
|
const nowColumn = nowAt === null || Number.isNaN(nowAt) ? -1 : days.indexOf(zonedDateKey(new Date(nowAt), timeZone));
|
|
20938
|
-
const openHour = (0,
|
|
20979
|
+
const openHour = (0, import_react110.useMemo)(() => {
|
|
20939
20980
|
const given = hoursOf(scrollToTime);
|
|
20940
20981
|
if (given !== null) return Math.floor(given);
|
|
20941
20982
|
let first = DEFAULT_OPEN_HOUR;
|
|
@@ -20943,7 +20984,7 @@ function SchedulingTimeGrid({
|
|
|
20943
20984
|
return Math.max(0, Math.floor(first));
|
|
20944
20985
|
}, [scrollToTime, columns]);
|
|
20945
20986
|
const scrollKey = `${view}|${days[0]}|${days.length}`;
|
|
20946
|
-
const opened = (0,
|
|
20987
|
+
const opened = (0, import_react110.useRef)({ key: "", top: null, byUser: false });
|
|
20947
20988
|
useIsomorphicLayoutEffect24(() => {
|
|
20948
20989
|
const root = rootRef.current;
|
|
20949
20990
|
if (!root) return;
|
|
@@ -20959,7 +21000,7 @@ function SchedulingTimeGrid({
|
|
|
20959
21000
|
root.scrollTop = Math.round(openHour * (height / hours));
|
|
20960
21001
|
state.top = root.scrollTop;
|
|
20961
21002
|
}, [scrollKey, openHour, columns]);
|
|
20962
|
-
(0,
|
|
21003
|
+
(0, import_react110.useEffect)(() => {
|
|
20963
21004
|
const root = rootRef.current;
|
|
20964
21005
|
if (!root) return void 0;
|
|
20965
21006
|
const byUser = () => {
|
|
@@ -21184,7 +21225,7 @@ function SchedulingTimeGrid({
|
|
|
21184
21225
|
}
|
|
21185
21226
|
|
|
21186
21227
|
// src/components/SchedulingResourceDay.tsx
|
|
21187
|
-
var
|
|
21228
|
+
var import_react111 = require("react");
|
|
21188
21229
|
|
|
21189
21230
|
// src/scheduling-resource-model.ts
|
|
21190
21231
|
var MINUTE = 6e4;
|
|
@@ -21272,7 +21313,7 @@ function itemName(resource, item, timeZone, labels) {
|
|
|
21272
21313
|
});
|
|
21273
21314
|
return name.replace(/,\s*$/, "").replace(/,\s*,/g, ",");
|
|
21274
21315
|
}
|
|
21275
|
-
var Column = (0,
|
|
21316
|
+
var Column = (0, import_react111.memo)(function Column2({ index, resource, items, slots, timeZone, labels, tabStop, selectedKey, skeleton, onSelect }) {
|
|
21276
21317
|
return /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", { className: "uix-scheduling-calendar__rs-column", role: "group", "aria-label": resource.label, "data-resource-id": resource.id, style: vars2({ "--uix-scheduling-calendar-rs-slots": slots.length }), children: [
|
|
21277
21318
|
skeleton && [0.2, 0.45, 0.7].map((at2) => /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("span", { className: "uix-skeleton uix-scheduling-calendar__rs-skeleton", "aria-hidden": "true", style: vars2({ "--uix-scheduling-calendar-rs-offset": Math.floor(slots.length * at2), "--uix-scheduling-calendar-rs-length": 3 }) }, at2)),
|
|
21278
21319
|
items.map((item) => {
|
|
@@ -21345,11 +21386,11 @@ function SchedulingResourceDay({
|
|
|
21345
21386
|
headingLevel,
|
|
21346
21387
|
emptyNote
|
|
21347
21388
|
}) {
|
|
21348
|
-
const rootRef = (0,
|
|
21349
|
-
const hintId = (0,
|
|
21350
|
-
const [narrow, setNarrow] = (0,
|
|
21351
|
-
const slots = (0,
|
|
21352
|
-
const byResource = (0,
|
|
21389
|
+
const rootRef = (0, import_react111.useRef)(null);
|
|
21390
|
+
const hintId = (0, import_react111.useId)();
|
|
21391
|
+
const [narrow, setNarrow] = (0, import_react111.useState)(false);
|
|
21392
|
+
const slots = (0, import_react111.useMemo)(() => resourceDaySlots(date, timeZone, { dayStart, dayEnd, slotMinutes }), [date, timeZone, dayStart, dayEnd, slotMinutes]);
|
|
21393
|
+
const byResource = (0, import_react111.useMemo)(() => {
|
|
21353
21394
|
const map = /* @__PURE__ */ new Map();
|
|
21354
21395
|
for (const span of spans) {
|
|
21355
21396
|
const list2 = map.get(span.resourceId);
|
|
@@ -21358,18 +21399,18 @@ function SchedulingResourceDay({
|
|
|
21358
21399
|
}
|
|
21359
21400
|
return map;
|
|
21360
21401
|
}, [spans]);
|
|
21361
|
-
const columns = (0,
|
|
21362
|
-
const interactive = (0,
|
|
21363
|
-
const [active, setActive] = (0,
|
|
21402
|
+
const columns = (0, import_react111.useMemo)(() => resources.map((resource) => layoutResourceColumn(byResource.get(resource.id) ?? [], slots)), [resources, byResource, slots]);
|
|
21403
|
+
const interactive = (0, import_react111.useMemo)(() => columns.flatMap((items, column) => items.filter((item) => item.kind !== "off").map((item) => stopKey(column, item))), [columns]);
|
|
21404
|
+
const [active, setActive] = (0, import_react111.useState)(null);
|
|
21364
21405
|
const tabStop = active && interactive.includes(active) ? active : interactive[0] ?? null;
|
|
21365
|
-
const selectedKey = (0,
|
|
21406
|
+
const selectedKey = (0, import_react111.useMemo)(() => {
|
|
21366
21407
|
if (!selected) return null;
|
|
21367
21408
|
const column = resources.findIndex((resource) => resource.id === selected.resourceId);
|
|
21368
21409
|
const at2 = new Date(selected.start).getTime();
|
|
21369
21410
|
const hit = columns[column]?.find((item) => item.kind !== "off" && item.start <= at2 && at2 < item.end);
|
|
21370
21411
|
return hit ? stopKey(column, hit) : null;
|
|
21371
21412
|
}, [selected, resources, columns]);
|
|
21372
|
-
(0,
|
|
21413
|
+
(0, import_react111.useEffect)(() => {
|
|
21373
21414
|
const root = rootRef.current;
|
|
21374
21415
|
if (layout !== "auto" || !root || typeof ResizeObserver === "undefined") return void 0;
|
|
21375
21416
|
let frame = 0;
|
|
@@ -21388,9 +21429,9 @@ function SchedulingResourceDay({
|
|
|
21388
21429
|
};
|
|
21389
21430
|
}, [layout, listBelow]);
|
|
21390
21431
|
const list = layout === "list" || layout === "auto" && narrow;
|
|
21391
|
-
const live = (0,
|
|
21432
|
+
const live = (0, import_react111.useRef)({ onSelectSlot });
|
|
21392
21433
|
live.current = { onSelectSlot };
|
|
21393
|
-
const onSelect = (0,
|
|
21434
|
+
const onSelect = (0, import_react111.useMemo)(() => (resource, item) => {
|
|
21394
21435
|
setActive(stopKey(resources.indexOf(resource), item));
|
|
21395
21436
|
if (item.kind === "off") return;
|
|
21396
21437
|
live.current.onSelectSlot?.({ resourceId: resource.id, start: iso(item.start), end: iso(item.end), kind: item.kind, span: item.span });
|
|
@@ -21687,28 +21728,28 @@ function SchedulingCalendar({
|
|
|
21687
21728
|
};
|
|
21688
21729
|
const stateLabel = labels.states;
|
|
21689
21730
|
const viewLabel = { month: labels.viewMonth, week: labels.viewWeek, day: labels.viewDay, agenda: labels.viewAgenda };
|
|
21690
|
-
const [internalView, setInternalView] = (0,
|
|
21731
|
+
const [internalView, setInternalView] = (0, import_react112.useState)("month");
|
|
21691
21732
|
const view = controlledView ?? internalView;
|
|
21692
21733
|
const resourceDay = view === "day" && resources !== void 0;
|
|
21693
|
-
const [activeDate, setActiveDate] = (0,
|
|
21694
|
-
const [expandedDates, setExpandedDates] = (0,
|
|
21734
|
+
const [activeDate, setActiveDate] = (0, import_react112.useState)(anchorDate);
|
|
21735
|
+
const [expandedDates, setExpandedDates] = (0, import_react112.useState)(() => /* @__PURE__ */ new Set());
|
|
21695
21736
|
const dateText = (date, part) => formatDate?.(date, part) ?? cachedDateTimeFormat(locale, INTL_PARTS[part]).format(utcDate(date));
|
|
21696
21737
|
const formatInstant = (instant2) => formatInstantProp?.(instant2) ?? `${dateText(zonedDateKey(instant2, timeZone), "day")} ${zonedTimeOfDay(instant2, timeZone)}`;
|
|
21697
|
-
const gridRef = (0,
|
|
21738
|
+
const gridRef = (0, import_react112.useRef)(null);
|
|
21698
21739
|
const picksGiven = dayEntries !== void 0;
|
|
21699
21740
|
const controlled = picksGiven || dayInfo !== void 0;
|
|
21700
21741
|
const countsOnly = monthDensity === "counts" && view === "month";
|
|
21701
21742
|
const fixed = controlled || maxEntriesPerDay !== void 0 && onShowMore !== void 0 || countsOnly;
|
|
21702
21743
|
const windowCap = Math.max(0, windowLaneCap ?? (fixed ? DEFAULT_LANE_CAP2 : Infinity));
|
|
21703
21744
|
const spanCap = Math.max(0, spanLaneCap ?? (fixed ? DEFAULT_LANE_CAP2 : Infinity));
|
|
21704
|
-
const visibleEntries = (0,
|
|
21705
|
-
const monthDays = (0,
|
|
21745
|
+
const visibleEntries = (0, import_react112.useMemo)(() => entries.filter((entry) => filter?.(entry) ?? true), [entries, filter]);
|
|
21746
|
+
const monthDays = (0, import_react112.useMemo)(() => buildMonthGrid(startOfMonth(anchorDate), weekStartsOn), [anchorDate, weekStartsOn]);
|
|
21706
21747
|
const weekday = (utcDate(anchorDate).getUTCDay() - weekStartsOn + 7) % 7;
|
|
21707
21748
|
const weekStart = addCalendarDays(anchorDate, -weekday);
|
|
21708
|
-
const weekDays = (0,
|
|
21709
|
-
const days = (0,
|
|
21749
|
+
const weekDays = (0, import_react112.useMemo)(() => Array.from({ length: 7 }, (_, index) => addCalendarDays(weekStart, index)), [weekStart]);
|
|
21750
|
+
const days = (0, import_react112.useMemo)(() => view === "month" ? monthDays.map((day) => day.date) : view === "day" ? [anchorDate] : weekDays, [view, monthDays, weekDays, anchorDate]);
|
|
21710
21751
|
const timeGridView = view === "day" || view === "week" && timeGrid;
|
|
21711
|
-
const { singles, multiDay, coverage } = (0,
|
|
21752
|
+
const { singles, multiDay, coverage } = (0, import_react112.useMemo)(() => {
|
|
21712
21753
|
const byDay = /* @__PURE__ */ new Map();
|
|
21713
21754
|
const spans = [];
|
|
21714
21755
|
const every = [];
|
|
@@ -21723,9 +21764,9 @@ function SchedulingCalendar({
|
|
|
21723
21764
|
}
|
|
21724
21765
|
return { singles: byDay, multiDay: spans, coverage: every };
|
|
21725
21766
|
}, [visibleEntries, timeZone]);
|
|
21726
|
-
const entryById = (0,
|
|
21727
|
-
const overlayById = (0,
|
|
21728
|
-
const layout = (0,
|
|
21767
|
+
const entryById = (0, import_react112.useMemo)(() => new Map([...multiDay].reverse().map(({ entry }) => [entry.id, entry])), [multiDay]);
|
|
21768
|
+
const overlayById = (0, import_react112.useMemo)(() => new Map([...overlays].reverse().map((overlay) => [overlay.id, overlay])), [overlays]);
|
|
21769
|
+
const layout = (0, import_react112.useMemo)(() => {
|
|
21729
21770
|
if (spanLayout) return spanLayout;
|
|
21730
21771
|
if (view === "agenda" || timeGridView) return { placed: [], hiddenByRow: {}, firstHiddenDayByRow: {} };
|
|
21731
21772
|
const inputs = [];
|
|
@@ -21743,7 +21784,7 @@ function SchedulingCalendar({
|
|
|
21743
21784
|
}
|
|
21744
21785
|
return layoutMonthSpans(inputs, days, { timeZone, laneCap: { window: windowCap, item: spanCap } });
|
|
21745
21786
|
}, [spanLayout, view, timeGridView, overlays, multiDay, days, timeZone, windowCap, spanCap, countsOnly]);
|
|
21746
|
-
const placedByRow = (0,
|
|
21787
|
+
const placedByRow = (0, import_react112.useMemo)(() => {
|
|
21747
21788
|
const rows = /* @__PURE__ */ new Map();
|
|
21748
21789
|
for (const placed of layout.placed) {
|
|
21749
21790
|
const row = rows.get(placed.weekRow);
|
|
@@ -21754,7 +21795,7 @@ function SchedulingCalendar({
|
|
|
21754
21795
|
}, [layout]);
|
|
21755
21796
|
const lanesUsed = (row, group2) => (placedByRow.get(row) ?? []).reduce((max, placed) => placed.group === group2 ? Math.max(max, placed.lane + 1) : max, 0);
|
|
21756
21797
|
const lanesUsedAnywhere = (group2) => layout.placed.reduce((max, placed) => placed.group === group2 ? Math.max(max, placed.lane + 1) : max, 0);
|
|
21757
|
-
(0,
|
|
21798
|
+
(0, import_react112.useEffect)(() => {
|
|
21758
21799
|
if (view !== "agenda" && !days.includes(activeDate)) setActiveDate(days[0]);
|
|
21759
21800
|
}, [activeDate, days, view]);
|
|
21760
21801
|
const setView = (next) => {
|
|
@@ -21770,7 +21811,7 @@ function SchedulingCalendar({
|
|
|
21770
21811
|
setActiveDate(date);
|
|
21771
21812
|
requestAnimationFrame(() => gridRef.current?.querySelector(`[data-calendar-date="${date}"]`)?.focus());
|
|
21772
21813
|
};
|
|
21773
|
-
const enteredFrom = (0,
|
|
21814
|
+
const enteredFrom = (0, import_react112.useRef)(null);
|
|
21774
21815
|
const cellOf = (date) => gridRef.current?.querySelector(`[data-calendar-date="${date}"]`)?.closest(".uix-scheduling-calendar__day") ?? null;
|
|
21775
21816
|
const dayRing = (date) => {
|
|
21776
21817
|
const cell = cellOf(date);
|
|
@@ -21840,10 +21881,10 @@ function SchedulingCalendar({
|
|
|
21840
21881
|
const date = dayOfItem(item);
|
|
21841
21882
|
if (date && dayRing(date).includes(item)) setActiveDate(date);
|
|
21842
21883
|
};
|
|
21843
|
-
const flatAgendaRef = (0,
|
|
21844
|
-
const flatAgendaStop = (0,
|
|
21884
|
+
const flatAgendaRef = (0, import_react112.useRef)(null);
|
|
21885
|
+
const flatAgendaStop = (0, import_react112.useRef)({ node: null, index: 0 });
|
|
21845
21886
|
const flatAgendaRows = () => Array.from(flatAgendaRef.current?.querySelectorAll(":scope > ol > li > button") ?? []);
|
|
21846
|
-
(0,
|
|
21887
|
+
(0, import_react112.useEffect)(() => {
|
|
21847
21888
|
flatAgendaStop.current = syncRovingStop(flatAgendaRows(), flatAgendaStop.current);
|
|
21848
21889
|
});
|
|
21849
21890
|
const onFlatAgendaFocus = (event) => {
|
|
@@ -22106,7 +22147,7 @@ function SchedulingCalendar({
|
|
|
22106
22147
|
}
|
|
22107
22148
|
|
|
22108
22149
|
// src/components/SchedulingTimeline.tsx
|
|
22109
|
-
var
|
|
22150
|
+
var import_react113 = require("react");
|
|
22110
22151
|
|
|
22111
22152
|
// src/scheduling-timeline-model.ts
|
|
22112
22153
|
var HOUR = 36e5;
|
|
@@ -22334,7 +22375,7 @@ var DEFAULT_UNITS = { row: 36, pad: 16, head: 40 };
|
|
|
22334
22375
|
var ESTIMATED_VIEWPORT = 720;
|
|
22335
22376
|
var OVERSCAN_ROWS = 4;
|
|
22336
22377
|
var BAR_MIN_FALLBACK = 1.5 * 16;
|
|
22337
|
-
var useIsomorphicLayoutEffect25 = typeof document !== "undefined" ?
|
|
22378
|
+
var useIsomorphicLayoutEffect25 = typeof document !== "undefined" ? import_react113.useLayoutEffect : import_react113.useEffect;
|
|
22338
22379
|
var sameExtent = (a, b) => a.subRows === b.subRows && a.lanes === b.lanes && a.heads === b.heads;
|
|
22339
22380
|
var IN_LANE = { scope: "lane", labelTops: ["0%"] };
|
|
22340
22381
|
var vars3 = (values) => values;
|
|
@@ -22400,29 +22441,29 @@ function SchedulingTimeline({
|
|
|
22400
22441
|
overlays: { ...DEFAULT_SCHEDULING_TIMELINE_LABELS.overlays, ...uixLabels.schedulingTimeline?.overlays, ...labelOverrides?.overlays },
|
|
22401
22442
|
statuses: { ...DEFAULT_SCHEDULING_TIMELINE_LABELS.statuses, ...uixLabels.schedulingTimeline?.statuses, ...labelOverrides?.statuses }
|
|
22402
22443
|
};
|
|
22403
|
-
const id = (0,
|
|
22444
|
+
const id = (0, import_react113.useId)();
|
|
22404
22445
|
const hintId = `${id}-hint`;
|
|
22405
22446
|
const step = stepProp !== void 0 && Number.isFinite(stepProp) && stepProp > 0 ? stepProp : defaultTimelineStep(scale);
|
|
22406
|
-
const rootRef = (0,
|
|
22407
|
-
const [scroller, setScroller] = (0,
|
|
22408
|
-
const [layerTrack, setLayerTrack] = (0,
|
|
22409
|
-
const probeRef = (0,
|
|
22410
|
-
const bodyRef = (0,
|
|
22411
|
-
const barMinRef = (0,
|
|
22412
|
-
const [barShare, setBarShare] = (0,
|
|
22413
|
-
const barShareRef = (0,
|
|
22414
|
-
const anchorRef = (0,
|
|
22415
|
-
const [anchorKey, setAnchorKey] = (0,
|
|
22416
|
-
const [focusRowKey, setFocusRowKey] = (0,
|
|
22417
|
-
const [activeId, setActiveId] = (0,
|
|
22418
|
-
const [focusRequest, setFocusRequest] = (0,
|
|
22419
|
-
const [stepDrag, setStepDrag] = (0,
|
|
22420
|
-
const [ghost, setGhost] = (0,
|
|
22421
|
-
const [announcement, setAnnouncement] = (0,
|
|
22422
|
-
const [selfCollapsed, setSelfCollapsed] = (0,
|
|
22423
|
-
const [units, setUnits] = (0,
|
|
22424
|
-
const [view, setView] = (0,
|
|
22425
|
-
const measureViewRef = (0,
|
|
22447
|
+
const rootRef = (0, import_react113.useRef)(null);
|
|
22448
|
+
const [scroller, setScroller] = (0, import_react113.useState)(null);
|
|
22449
|
+
const [layerTrack, setLayerTrack] = (0, import_react113.useState)(null);
|
|
22450
|
+
const probeRef = (0, import_react113.useRef)(null);
|
|
22451
|
+
const bodyRef = (0, import_react113.useRef)(null);
|
|
22452
|
+
const barMinRef = (0, import_react113.useRef)(null);
|
|
22453
|
+
const [barShare, setBarShare] = (0, import_react113.useState)(0);
|
|
22454
|
+
const barShareRef = (0, import_react113.useRef)(0);
|
|
22455
|
+
const anchorRef = (0, import_react113.useRef)(null);
|
|
22456
|
+
const [anchorKey, setAnchorKey] = (0, import_react113.useState)(null);
|
|
22457
|
+
const [focusRowKey, setFocusRowKey] = (0, import_react113.useState)(null);
|
|
22458
|
+
const [activeId, setActiveId] = (0, import_react113.useState)();
|
|
22459
|
+
const [focusRequest, setFocusRequest] = (0, import_react113.useState)(null);
|
|
22460
|
+
const [stepDrag, setStepDrag] = (0, import_react113.useState)(null);
|
|
22461
|
+
const [ghost, setGhost] = (0, import_react113.useState)(null);
|
|
22462
|
+
const [announcement, setAnnouncement] = (0, import_react113.useState)("");
|
|
22463
|
+
const [selfCollapsed, setSelfCollapsed] = (0, import_react113.useState)({});
|
|
22464
|
+
const [units, setUnits] = (0, import_react113.useState)(DEFAULT_UNITS);
|
|
22465
|
+
const [view, setView] = (0, import_react113.useState)({ top: 0, height: ESTIMATED_VIEWPORT });
|
|
22466
|
+
const measureViewRef = (0, import_react113.useRef)(null);
|
|
22426
22467
|
const proposing = onProposeMove !== void 0;
|
|
22427
22468
|
const stepping = !proposing && onMoveItem !== void 0;
|
|
22428
22469
|
const resizing = onResizeItem !== void 0;
|
|
@@ -22437,8 +22478,8 @@ function SchedulingTimeline({
|
|
|
22437
22478
|
return offset ? `${text} ${offset}` : text;
|
|
22438
22479
|
};
|
|
22439
22480
|
const fmtTick = (at2) => formatTick?.(new Date(at2), scale) ?? cachedDateTimeFormat(locale, { timeZone, ...TICK_FORMAT[scale] }).format(new Date(at2));
|
|
22440
|
-
const ticks = (0,
|
|
22441
|
-
const minorTicks = (0,
|
|
22481
|
+
const ticks = (0, import_react113.useMemo)(() => timelineTicks(range, scale, timeZone, weekStartsOn), [range.start, range.end, scale, timeZone, weekStartsOn]);
|
|
22482
|
+
const minorTicks = (0, import_react113.useMemo)(
|
|
22442
22483
|
() => scale === "day" && subTicks && subTicks.length > 0 ? timelineSubTicks(range, subTicks, timeZone) : [],
|
|
22443
22484
|
[range.start, range.end, scale, timeZone, subTicks]
|
|
22444
22485
|
// eslint-disable-line react-hooks/exhaustive-deps
|
|
@@ -22467,7 +22508,7 @@ function SchedulingTimeline({
|
|
|
22467
22508
|
const minSpan = Math.max(0, (Date.parse(range.end) - Date.parse(range.start)) * barShare) || 0;
|
|
22468
22509
|
const isCollapsed = (group2) => onToggleGroup ? !!group2.collapsed : selfCollapsed[group2.id] ?? !!group2.collapsed;
|
|
22469
22510
|
const collapsedSignature = groups?.map((group2) => isCollapsed(group2) ? "1" : "0").join("") ?? "";
|
|
22470
|
-
const itemsByLane = (0,
|
|
22511
|
+
const itemsByLane = (0, import_react113.useMemo)(() => {
|
|
22471
22512
|
const byLane = /* @__PURE__ */ new Map();
|
|
22472
22513
|
for (const item of items) {
|
|
22473
22514
|
const list = byLane.get(item.laneId);
|
|
@@ -22476,7 +22517,7 @@ function SchedulingTimeline({
|
|
|
22476
22517
|
}
|
|
22477
22518
|
return byLane;
|
|
22478
22519
|
}, [items]);
|
|
22479
|
-
const rows = (0,
|
|
22520
|
+
const rows = (0, import_react113.useMemo)(() => {
|
|
22480
22521
|
const laneRow = (lane, laneIndex, groupIndex) => {
|
|
22481
22522
|
const placed = layoutLane(itemsByLane.get(lane.id) ?? EMPTY_ITEMS, range, { flagOverlaps, minSpan });
|
|
22482
22523
|
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) };
|
|
@@ -22508,8 +22549,8 @@ function SchedulingTimeline({
|
|
|
22508
22549
|
});
|
|
22509
22550
|
return list;
|
|
22510
22551
|
}, [lanes, groups, collapsedSignature, itemsByLane, range.start, range.end, flagOverlaps, minSpan]);
|
|
22511
|
-
const laneRows = (0,
|
|
22512
|
-
const { ordered, rowOfItem } = (0,
|
|
22552
|
+
const laneRows = (0, import_react113.useMemo)(() => rows.filter((row) => row.kind === "lane"), [rows]);
|
|
22553
|
+
const { ordered, rowOfItem } = (0, import_react113.useMemo)(() => {
|
|
22513
22554
|
const ids = [];
|
|
22514
22555
|
const rowOf = /* @__PURE__ */ new Map();
|
|
22515
22556
|
rows.forEach((row, rowIndex) => {
|
|
@@ -22521,13 +22562,13 @@ function SchedulingTimeline({
|
|
|
22521
22562
|
});
|
|
22522
22563
|
return { ordered: ids, rowOfItem: rowOf };
|
|
22523
22564
|
}, [rows]);
|
|
22524
|
-
const nothingToShow = (0,
|
|
22565
|
+
const nothingToShow = (0, import_react113.useMemo)(() => {
|
|
22525
22566
|
if (ordered.length > 0) return false;
|
|
22526
22567
|
const laneIds = new Set(lanes.map((lane) => lane.id));
|
|
22527
22568
|
return !items.some((item) => laneIds.has(item.laneId) && placeSpan(item, range) !== null);
|
|
22528
22569
|
}, [ordered, lanes, items, range.start, range.end]);
|
|
22529
22570
|
const focusId = activeId !== void 0 && rowOfItem.has(activeId) ? activeId : ordered[0];
|
|
22530
|
-
const strips = (0,
|
|
22571
|
+
const strips = (0, import_react113.useMemo)(() => {
|
|
22531
22572
|
const set = /* @__PURE__ */ new Set();
|
|
22532
22573
|
const shown = overlays.filter((overlay) => placeSpan(overlay, range) !== null).map(lanesOf);
|
|
22533
22574
|
if (shown.length === 0) return set;
|
|
@@ -22537,12 +22578,12 @@ function SchedulingTimeline({
|
|
|
22537
22578
|
});
|
|
22538
22579
|
return set;
|
|
22539
22580
|
}, [rows, overlays, range.start, range.end]);
|
|
22540
|
-
const extents = (0,
|
|
22581
|
+
const extents = (0, import_react113.useMemo)(() => timelineRowExtents(rows.map((row, index) => row.kind === "head" ? { kind: "head", subRows: strips.has(index) ? 1 : 0 } : { kind: "lane", subRows: row.subRows })), [rows, strips]);
|
|
22541
22582
|
const windowed = lanes.length + (groups?.length ?? 0) > virtualizeAbove;
|
|
22542
22583
|
const printing = usePrinting(windowed);
|
|
22543
22584
|
const virtual = windowed && !printing;
|
|
22544
22585
|
const fixed = windowed || groups !== void 0 || overlays.some((overlay) => overlay.laneIds !== void 0) || markers.some((marker) => marker.laneIds !== void 0);
|
|
22545
|
-
(0,
|
|
22586
|
+
(0, import_react113.useEffect)(() => {
|
|
22546
22587
|
if (!virtual || !scroller) return void 0;
|
|
22547
22588
|
let frame = 0;
|
|
22548
22589
|
const measure3 = () => {
|
|
@@ -22582,12 +22623,12 @@ function SchedulingTimeline({
|
|
|
22582
22623
|
};
|
|
22583
22624
|
}, [virtual, scroller]);
|
|
22584
22625
|
const px = (extent) => extent.subRows * units.row + extent.lanes * units.pad + extent.heads * units.head;
|
|
22585
|
-
const offsets = (0,
|
|
22626
|
+
const offsets = (0, import_react113.useMemo)(() => virtual ? extents.map(px) : [], [virtual, extents, units]);
|
|
22586
22627
|
const overscan = OVERSCAN_ROWS * units.row;
|
|
22587
22628
|
const pinned = focusId === void 0 ? -1 : rowOfItem.get(focusId) ?? -1;
|
|
22588
|
-
const focusedRow = (0,
|
|
22589
|
-
const anchorRow = (0,
|
|
22590
|
-
const { mounted, windowStart } = (0,
|
|
22629
|
+
const focusedRow = (0, import_react113.useMemo)(() => focusRowKey === null ? -1 : rows.findIndex((row) => row.key === focusRowKey), [rows, focusRowKey]);
|
|
22630
|
+
const anchorRow = (0, import_react113.useMemo)(() => anchorKey === null ? -1 : rows.findIndex((row) => row.key === anchorKey), [rows, anchorKey]);
|
|
22631
|
+
const { mounted, windowStart } = (0, import_react113.useMemo)(() => {
|
|
22591
22632
|
if (!virtual) return { mounted: rows.map((_, index) => index), windowStart: 0 };
|
|
22592
22633
|
const window_ = timelineWindow(offsets, view.top, view.top + view.height, { overscan });
|
|
22593
22634
|
const list = [];
|
|
@@ -22635,10 +22676,10 @@ function SchedulingTimeline({
|
|
|
22635
22676
|
setActiveId(itemId);
|
|
22636
22677
|
setFocusRequest({ id: itemId });
|
|
22637
22678
|
};
|
|
22638
|
-
(0,
|
|
22679
|
+
(0, import_react113.useEffect)(() => {
|
|
22639
22680
|
if (focusRequest) findBar(focusRequest.id)?.focus();
|
|
22640
22681
|
}, [focusRequest]);
|
|
22641
|
-
const itemById = (0,
|
|
22682
|
+
const itemById = (0, import_react113.useMemo)(() => {
|
|
22642
22683
|
const map = /* @__PURE__ */ new Map();
|
|
22643
22684
|
for (const row of laneRows) for (const p of row.placed) if (!map.has(p.item.id)) map.set(p.item.id, p.item);
|
|
22644
22685
|
return map;
|
|
@@ -22648,15 +22689,15 @@ function SchedulingTimeline({
|
|
|
22648
22689
|
const steps = Math.round(ms / step);
|
|
22649
22690
|
return { days: steps * stepDelta.days, minutes: steps * stepDelta.minutes };
|
|
22650
22691
|
};
|
|
22651
|
-
const live = (0,
|
|
22692
|
+
const live = (0, import_react113.useRef)({ itemById, timeZone, range, step, onProposeMove, canMove, deltaFor, labels, fmtInstant });
|
|
22652
22693
|
live.current = { itemById, timeZone, range, step, onProposeMove, canMove, deltaFor, labels, fmtInstant };
|
|
22653
|
-
const dragRef = (0,
|
|
22654
|
-
const suppressClick = (0,
|
|
22655
|
-
const refocus = (0,
|
|
22656
|
-
(0,
|
|
22694
|
+
const dragRef = (0, import_react113.useRef)(null);
|
|
22695
|
+
const suppressClick = (0, import_react113.useRef)(false);
|
|
22696
|
+
const refocus = (0, import_react113.useRef)(null);
|
|
22697
|
+
(0, import_react113.useEffect)(() => {
|
|
22657
22698
|
if (ghost && !itemById.has(ghost.id)) setGhost(null);
|
|
22658
22699
|
}, [ghost, itemById]);
|
|
22659
|
-
(0,
|
|
22700
|
+
(0, import_react113.useEffect)(() => {
|
|
22660
22701
|
const wanted = refocus.current;
|
|
22661
22702
|
if (!wanted || !rootRef.current) return;
|
|
22662
22703
|
const active = document.activeElement;
|
|
@@ -22667,11 +22708,11 @@ function SchedulingTimeline({
|
|
|
22667
22708
|
}
|
|
22668
22709
|
findBar(wanted)?.focus();
|
|
22669
22710
|
});
|
|
22670
|
-
(0,
|
|
22711
|
+
(0, import_react113.useEffect)(() => () => {
|
|
22671
22712
|
dragRef.current?.stop();
|
|
22672
22713
|
dragRef.current = null;
|
|
22673
22714
|
}, []);
|
|
22674
|
-
(0,
|
|
22715
|
+
(0, import_react113.useEffect)(() => {
|
|
22675
22716
|
if (proposing) return;
|
|
22676
22717
|
dragRef.current?.stop();
|
|
22677
22718
|
dragRef.current = null;
|
|
@@ -23152,7 +23193,7 @@ function SchedulingTimeline({
|
|
|
23152
23193
|
}
|
|
23153
23194
|
|
|
23154
23195
|
// src/components/DateRangePicker.tsx
|
|
23155
|
-
var
|
|
23196
|
+
var import_react114 = require("react");
|
|
23156
23197
|
var import_jsx_runtime130 = require("react/jsx-runtime");
|
|
23157
23198
|
var DEFAULT_DATE_RANGE_PICKER_LABELS = {
|
|
23158
23199
|
previous: "Previous",
|
|
@@ -23193,29 +23234,29 @@ function RangeCalendar({
|
|
|
23193
23234
|
weekStartsOn = 1,
|
|
23194
23235
|
autoFocus = false
|
|
23195
23236
|
}) {
|
|
23196
|
-
const id = (0,
|
|
23237
|
+
const id = (0, import_react114.useId)();
|
|
23197
23238
|
const label = labelProp ?? labels.label;
|
|
23198
23239
|
const invalidMessage = invalidMessageProp ?? labels.invalidMessage;
|
|
23199
|
-
const weekdays = (0,
|
|
23200
|
-
const [internalMonth, setInternalMonth] = (0,
|
|
23240
|
+
const weekdays = (0, import_react114.useMemo)(() => weekdayNames(locale, weekStartsOn), [locale, weekStartsOn]);
|
|
23241
|
+
const [internalMonth, setInternalMonth] = (0, import_react114.useState)(() => startOfMonth(controlledMonth ?? value.start ?? (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)));
|
|
23201
23242
|
const visibleMonth = startOfMonth(controlledMonth ?? internalMonth);
|
|
23202
|
-
const [activeDate, setActiveDate] = (0,
|
|
23203
|
-
const rootRef = (0,
|
|
23204
|
-
const pendingFocus = (0,
|
|
23243
|
+
const [activeDate, setActiveDate] = (0, import_react114.useState)(value.end ?? value.start ?? visibleMonth);
|
|
23244
|
+
const rootRef = (0, import_react114.useRef)(null);
|
|
23245
|
+
const pendingFocus = (0, import_react114.useRef)(autoFocus);
|
|
23205
23246
|
const count2 = Math.max(1, Math.min(3, months));
|
|
23206
|
-
const calendars = (0,
|
|
23247
|
+
const calendars = (0, import_react114.useMemo)(() => Array.from({ length: count2 }, (_, index) => {
|
|
23207
23248
|
const month = startOfMonth(addCalendarMonths(visibleMonth, index));
|
|
23208
23249
|
return { month, days: buildMonthGrid(month).filter((day) => day.inMonth) };
|
|
23209
23250
|
}), [visibleMonth, count2]);
|
|
23210
23251
|
const todayDate = today === void 0 ? localDateKey() : today;
|
|
23211
23252
|
const rangeInvalid = invalid || !!value.start && !!value.end && value.start > value.end;
|
|
23212
|
-
(0,
|
|
23253
|
+
(0, import_react114.useEffect)(() => {
|
|
23213
23254
|
const first = calendars[0]?.days[0]?.date;
|
|
23214
23255
|
const finalDays = calendars[calendars.length - 1]?.days;
|
|
23215
23256
|
const last = finalDays?.[finalDays.length - 1]?.date;
|
|
23216
23257
|
if (first && last && (activeDate < first || activeDate > last)) setActiveDate(first);
|
|
23217
23258
|
}, [activeDate, calendars]);
|
|
23218
|
-
(0,
|
|
23259
|
+
(0, import_react114.useEffect)(() => {
|
|
23219
23260
|
if (!pendingFocus.current) return;
|
|
23220
23261
|
rootRef.current?.querySelector(`[data-date="${activeDate}"]`)?.focus({ preventScroll: autoFocus });
|
|
23221
23262
|
pendingFocus.current = false;
|
|
@@ -23320,16 +23361,16 @@ function DateRangeField(props) {
|
|
|
23320
23361
|
"aria-describedby": ariaDescribedBy,
|
|
23321
23362
|
"aria-invalid": ariaInvalid
|
|
23322
23363
|
} = props;
|
|
23323
|
-
const uid = (0,
|
|
23364
|
+
const uid = (0, import_react114.useId)();
|
|
23324
23365
|
const label = labelProp ?? words2.label;
|
|
23325
23366
|
const id = idProp ?? `${uid}-trigger`;
|
|
23326
23367
|
const popoverId = `${uid}-months`;
|
|
23327
23368
|
const valueId = `${uid}-value`;
|
|
23328
|
-
const anchorRef = (0,
|
|
23329
|
-
const triggerRef = (0,
|
|
23369
|
+
const anchorRef = (0, import_react114.useRef)(null);
|
|
23370
|
+
const triggerRef = (0, import_react114.useRef)(null);
|
|
23330
23371
|
const { open, hide, onFieldKeyDown, triggerProps } = useFieldPopover(popoverId, () => triggerRef.current?.focus({ preventScroll: true }), onOpenChange);
|
|
23331
|
-
const [labelled, setLabelled] = (0,
|
|
23332
|
-
(0,
|
|
23372
|
+
const [labelled, setLabelled] = (0, import_react114.useState)(false);
|
|
23373
|
+
(0, import_react114.useEffect)(() => {
|
|
23333
23374
|
setLabelled((triggerRef.current?.labels?.length ?? 0) > 0);
|
|
23334
23375
|
}, [id]);
|
|
23335
23376
|
const format = (date) => formatDate?.(date) ?? formatDateKey(date, locale);
|
|
@@ -23395,7 +23436,7 @@ function DateRangeField(props) {
|
|
|
23395
23436
|
}
|
|
23396
23437
|
|
|
23397
23438
|
// src/components/RelationshipGraph.tsx
|
|
23398
|
-
var
|
|
23439
|
+
var import_react117 = require("react");
|
|
23399
23440
|
|
|
23400
23441
|
// src/relationship-graph-model.ts
|
|
23401
23442
|
function boundRelationshipGraph(nodes, edges, maxNodes = 40) {
|
|
@@ -23993,10 +24034,10 @@ function layeredNeighbor(layout, currentId, key) {
|
|
|
23993
24034
|
}
|
|
23994
24035
|
|
|
23995
24036
|
// src/components/RelationshipGraphLayered.tsx
|
|
23996
|
-
var
|
|
24037
|
+
var import_react116 = require("react");
|
|
23997
24038
|
|
|
23998
24039
|
// src/components/RelationshipGraphList.tsx
|
|
23999
|
-
var
|
|
24040
|
+
var import_react115 = require("react");
|
|
24000
24041
|
var import_jsx_runtime131 = require("react/jsx-runtime");
|
|
24001
24042
|
var LISTED_NEIGHBOURS = 8;
|
|
24002
24043
|
function EquivalentRelationshipList({
|
|
@@ -24008,8 +24049,8 @@ function EquivalentRelationshipList({
|
|
|
24008
24049
|
onExpandNeighbors,
|
|
24009
24050
|
onOpenDetails
|
|
24010
24051
|
}) {
|
|
24011
|
-
const id = (0,
|
|
24012
|
-
const [open, setOpen] = (0,
|
|
24052
|
+
const id = (0, import_react115.useId)();
|
|
24053
|
+
const [open, setOpen] = (0, import_react115.useState)(() => /* @__PURE__ */ new Set());
|
|
24013
24054
|
const labelById = new Map(nodes.map((node) => [node.id, node.label]));
|
|
24014
24055
|
return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)("div", { className: "uix-relationship-graph__list", role: "region", "aria-label": labels.list, children: [
|
|
24015
24056
|
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)("h3", { children: labels.listHeading }),
|
|
@@ -24056,7 +24097,7 @@ function EquivalentRelationshipList({
|
|
|
24056
24097
|
// src/components/RelationshipGraphLayered.tsx
|
|
24057
24098
|
var import_jsx_runtime132 = require("react/jsx-runtime");
|
|
24058
24099
|
var EMPTY_IDS2 = /* @__PURE__ */ new Set();
|
|
24059
|
-
var useIsomorphicLayoutEffect26 = typeof document !== "undefined" ?
|
|
24100
|
+
var useIsomorphicLayoutEffect26 = typeof document !== "undefined" ? import_react116.useLayoutEffect : import_react116.useEffect;
|
|
24060
24101
|
var MIN_ZOOM2 = 0.4;
|
|
24061
24102
|
var MAX_ZOOM2 = 1.5;
|
|
24062
24103
|
var READABLE_ZOOM = 0.75;
|
|
@@ -24119,14 +24160,14 @@ function LayeredRelationshipGraph({
|
|
|
24119
24160
|
revealId,
|
|
24120
24161
|
markRoot
|
|
24121
24162
|
}) {
|
|
24122
|
-
const hintId = (0,
|
|
24123
|
-
const describeId = (0,
|
|
24124
|
-
const viewportHintId = (0,
|
|
24163
|
+
const hintId = (0, import_react116.useId)();
|
|
24164
|
+
const describeId = (0, import_react116.useId)();
|
|
24165
|
+
const viewportHintId = (0, import_react116.useId)();
|
|
24125
24166
|
const compact = controls === "compact";
|
|
24126
|
-
const bounded = (0,
|
|
24127
|
-
const [localExpanded, setLocalExpanded] = (0,
|
|
24167
|
+
const bounded = (0, import_react116.useMemo)(() => boundRelationshipGraph(nodes, edges, maxNodes), [nodes, edges, maxNodes]);
|
|
24168
|
+
const [localExpanded, setLocalExpanded] = (0, import_react116.useState)(EMPTY_IDS2);
|
|
24128
24169
|
const expanded = expandedClusterIds ?? localExpanded;
|
|
24129
|
-
const layout = (0,
|
|
24170
|
+
const layout = (0, import_react116.useMemo)(
|
|
24130
24171
|
() => layoutLayeredGraph(bounded.nodes, bounded.edges, {
|
|
24131
24172
|
...rootId !== void 0 ? { rootId } : {},
|
|
24132
24173
|
...clusterThreshold !== void 0 ? { clusterThreshold } : {},
|
|
@@ -24135,46 +24176,46 @@ function LayeredRelationshipGraph({
|
|
|
24135
24176
|
}),
|
|
24136
24177
|
[bounded, rootId, clusterThreshold, expanded, density]
|
|
24137
24178
|
);
|
|
24138
|
-
const itemById = (0,
|
|
24139
|
-
const startView = (0,
|
|
24179
|
+
const itemById = (0, import_react116.useMemo)(() => new Map(layout.items.map((item) => [item.id, item])), [layout]);
|
|
24180
|
+
const startView = (0, import_react116.useCallback)(
|
|
24140
24181
|
(forLayout, forSize) => initialViewMode === "fit" ? fitView(forLayout, forSize) : initialView(forLayout, forSize),
|
|
24141
24182
|
[initialViewMode]
|
|
24142
24183
|
);
|
|
24143
|
-
const viewportRef = (0,
|
|
24144
|
-
const itemRefs = (0,
|
|
24145
|
-
const fullscreenButtonRef = (0,
|
|
24146
|
-
const footerRef = (0,
|
|
24147
|
-
const edgesRef = (0,
|
|
24148
|
-
const [size, setSize] = (0,
|
|
24149
|
-
const [view, setView] = (0,
|
|
24150
|
-
const [animate, setAnimate] = (0,
|
|
24151
|
-
const [localFocus, setLocalFocus] = (0,
|
|
24152
|
-
const [hoverId, setHoverId] = (0,
|
|
24153
|
-
const [focusWithinId, setFocusWithinId] = (0,
|
|
24154
|
-
const [fullscreen, setFullscreen] = (0,
|
|
24155
|
-
const [wheelHint, setWheelHint] = (0,
|
|
24156
|
-
const viewRef = (0,
|
|
24184
|
+
const viewportRef = (0, import_react116.useRef)(null);
|
|
24185
|
+
const itemRefs = (0, import_react116.useRef)(/* @__PURE__ */ new Map());
|
|
24186
|
+
const fullscreenButtonRef = (0, import_react116.useRef)(null);
|
|
24187
|
+
const footerRef = (0, import_react116.useRef)(null);
|
|
24188
|
+
const edgesRef = (0, import_react116.useRef)(null);
|
|
24189
|
+
const [size, setSize] = (0, import_react116.useState)({ width: 0, height: 0 });
|
|
24190
|
+
const [view, setView] = (0, import_react116.useState)({ x: 0, y: 0, zoom: 1 });
|
|
24191
|
+
const [animate, setAnimate] = (0, import_react116.useState)(false);
|
|
24192
|
+
const [localFocus, setLocalFocus] = (0, import_react116.useState)(void 0);
|
|
24193
|
+
const [hoverId, setHoverId] = (0, import_react116.useState)(void 0);
|
|
24194
|
+
const [focusWithinId, setFocusWithinId] = (0, import_react116.useState)(void 0);
|
|
24195
|
+
const [fullscreen, setFullscreen] = (0, import_react116.useState)(false);
|
|
24196
|
+
const [wheelHint, setWheelHint] = (0, import_react116.useState)(false);
|
|
24197
|
+
const viewRef = (0, import_react116.useRef)(view);
|
|
24157
24198
|
viewRef.current = view;
|
|
24158
|
-
const layoutRef = (0,
|
|
24199
|
+
const layoutRef = (0, import_react116.useRef)(layout);
|
|
24159
24200
|
layoutRef.current = layout;
|
|
24160
|
-
const fullscreenRef = (0,
|
|
24201
|
+
const fullscreenRef = (0, import_react116.useRef)(fullscreen);
|
|
24161
24202
|
fullscreenRef.current = fullscreen;
|
|
24162
|
-
const compactRef = (0,
|
|
24203
|
+
const compactRef = (0, import_react116.useRef)(compact);
|
|
24163
24204
|
compactRef.current = compact;
|
|
24164
|
-
const pendingFocus = (0,
|
|
24165
|
-
const initialisedFor = (0,
|
|
24166
|
-
const refitOnResize = (0,
|
|
24167
|
-
const hintTimer = (0,
|
|
24205
|
+
const pendingFocus = (0, import_react116.useRef)(void 0);
|
|
24206
|
+
const initialisedFor = (0, import_react116.useRef)(void 0);
|
|
24207
|
+
const refitOnResize = (0, import_react116.useRef)(false);
|
|
24208
|
+
const hintTimer = (0, import_react116.useRef)(void 0);
|
|
24168
24209
|
const modifier = useKbdPlatform() === "mac" ? "\u2318" : "Ctrl";
|
|
24169
24210
|
const rootItemId = layout.rootId !== void 0 ? layout.itemOf[layout.rootId] : layout.items[0]?.id;
|
|
24170
24211
|
const requestedFocus = focusId !== void 0 ? layout.itemOf[focusId] ?? focusId : localFocus;
|
|
24171
24212
|
const focusedId = requestedFocus !== void 0 && itemById.has(requestedFocus) ? requestedFocus : rootItemId;
|
|
24172
24213
|
const selectedItemId = selectedId !== void 0 ? layout.itemOf[selectedId] : void 0;
|
|
24173
|
-
const activeIds = (0,
|
|
24214
|
+
const activeIds = (0, import_react116.useMemo)(
|
|
24174
24215
|
() => new Set([hoverId, selectedItemId].filter((id) => id !== void 0)),
|
|
24175
24216
|
[hoverId, selectedItemId]
|
|
24176
24217
|
);
|
|
24177
|
-
(0,
|
|
24218
|
+
(0, import_react116.useEffect)(() => {
|
|
24178
24219
|
const element = viewportRef.current;
|
|
24179
24220
|
if (!element) return;
|
|
24180
24221
|
const measure3 = () => setSize({ width: element.clientWidth, height: Math.max(0, element.clientHeight - footerGutter(element, footerRef.current)) });
|
|
@@ -24185,20 +24226,20 @@ function LayeredRelationshipGraph({
|
|
|
24185
24226
|
if (footerRef.current) observer.observe(footerRef.current);
|
|
24186
24227
|
return () => observer.disconnect();
|
|
24187
24228
|
}, [compact]);
|
|
24188
|
-
(0,
|
|
24229
|
+
(0, import_react116.useEffect)(() => {
|
|
24189
24230
|
if (size.width === 0) return;
|
|
24190
24231
|
const key = `${layout.rootId ?? ""}`;
|
|
24191
24232
|
if (initialisedFor.current === key) return;
|
|
24192
24233
|
initialisedFor.current = key;
|
|
24193
24234
|
setView(startView(layout, size));
|
|
24194
24235
|
}, [layout, size, startView]);
|
|
24195
|
-
(0,
|
|
24236
|
+
(0, import_react116.useEffect)(() => {
|
|
24196
24237
|
if (!refitOnResize.current || size.width === 0) return;
|
|
24197
24238
|
refitOnResize.current = false;
|
|
24198
24239
|
setAnimate(false);
|
|
24199
24240
|
setView(startView(layoutRef.current, size));
|
|
24200
24241
|
}, [size, startView]);
|
|
24201
|
-
(0,
|
|
24242
|
+
(0, import_react116.useEffect)(() => {
|
|
24202
24243
|
if (!fullscreen) return;
|
|
24203
24244
|
const root = document.documentElement;
|
|
24204
24245
|
const previous = root.style.overflow;
|
|
@@ -24207,12 +24248,12 @@ function LayeredRelationshipGraph({
|
|
|
24207
24248
|
root.style.overflow = previous;
|
|
24208
24249
|
};
|
|
24209
24250
|
}, [fullscreen]);
|
|
24210
|
-
(0,
|
|
24211
|
-
const moveView = (0,
|
|
24251
|
+
(0, import_react116.useEffect)(() => () => clearTimeout(hintTimer.current), []);
|
|
24252
|
+
const moveView = (0, import_react116.useCallback)((next, smooth) => {
|
|
24212
24253
|
setAnimate(smooth && !prefersReducedMotion());
|
|
24213
24254
|
setView(next);
|
|
24214
24255
|
}, []);
|
|
24215
|
-
const ensureVisible = (0,
|
|
24256
|
+
const ensureVisible = (0, import_react116.useCallback)((id, smooth) => {
|
|
24216
24257
|
const element = viewportRef.current;
|
|
24217
24258
|
const item = layoutRef.current.items.find((candidate) => candidate.id === id);
|
|
24218
24259
|
if (!element || !item) return;
|
|
@@ -24233,7 +24274,7 @@ function LayeredRelationshipGraph({
|
|
|
24233
24274
|
else if (bottom > heightPx - bottomMargin) nextY -= bottom - (heightPx - bottomMargin);
|
|
24234
24275
|
if (nextX !== x || nextY !== y) moveView({ x: nextX, y: nextY, zoom }, smooth);
|
|
24235
24276
|
}, [moveView]);
|
|
24236
|
-
const focusItem = (0,
|
|
24277
|
+
const focusItem = (0, import_react116.useCallback)((id) => {
|
|
24237
24278
|
setLocalFocus(id);
|
|
24238
24279
|
onFocusChange?.(id);
|
|
24239
24280
|
requestAnimationFrame(() => {
|
|
@@ -24241,7 +24282,7 @@ function LayeredRelationshipGraph({
|
|
|
24241
24282
|
ensureVisible(id, true);
|
|
24242
24283
|
});
|
|
24243
24284
|
}, [ensureVisible, onFocusChange]);
|
|
24244
|
-
(0,
|
|
24285
|
+
(0, import_react116.useEffect)(() => {
|
|
24245
24286
|
const wanted = pendingFocus.current;
|
|
24246
24287
|
if (wanted !== void 0 && itemById.has(wanted)) {
|
|
24247
24288
|
pendingFocus.current = void 0;
|
|
@@ -24251,8 +24292,8 @@ function LayeredRelationshipGraph({
|
|
|
24251
24292
|
const controlledTarget = focusId !== void 0 ? layout.itemOf[focusId] ?? focusId : void 0;
|
|
24252
24293
|
const controlledPresent = controlledTarget !== void 0 && itemById.has(controlledTarget);
|
|
24253
24294
|
const controlledKey = `${controlledTarget ?? ""}|${controlledPresent}`;
|
|
24254
|
-
const lastControlledKey = (0,
|
|
24255
|
-
(0,
|
|
24295
|
+
const lastControlledKey = (0, import_react116.useRef)(controlledKey);
|
|
24296
|
+
(0, import_react116.useEffect)(() => {
|
|
24256
24297
|
if (lastControlledKey.current === controlledKey) return;
|
|
24257
24298
|
lastControlledKey.current = controlledKey;
|
|
24258
24299
|
if (!controlledPresent || controlledTarget === void 0) return;
|
|
@@ -24263,17 +24304,17 @@ function LayeredRelationshipGraph({
|
|
|
24263
24304
|
}, [controlledKey, controlledTarget, controlledPresent, ensureVisible]);
|
|
24264
24305
|
const revealTarget = revealId !== void 0 ? layout.itemOf[revealId] ?? revealId : void 0;
|
|
24265
24306
|
const revealReady = revealTarget !== void 0 && itemById.has(revealTarget) && size.width > 0;
|
|
24266
|
-
const revealedKey = (0,
|
|
24267
|
-
(0,
|
|
24307
|
+
const revealedKey = (0, import_react116.useRef)(void 0);
|
|
24308
|
+
(0, import_react116.useEffect)(() => {
|
|
24268
24309
|
if (!revealReady || revealTarget === void 0 || initialisedFor.current === void 0) return;
|
|
24269
24310
|
if (revealedKey.current === revealTarget) return;
|
|
24270
24311
|
revealedKey.current = revealTarget;
|
|
24271
24312
|
requestAnimationFrame(() => ensureVisible(revealTarget, true));
|
|
24272
24313
|
}, [revealReady, revealTarget, ensureVisible]);
|
|
24273
|
-
(0,
|
|
24314
|
+
(0, import_react116.useEffect)(() => {
|
|
24274
24315
|
if (revealId === void 0) revealedKey.current = void 0;
|
|
24275
24316
|
}, [revealId]);
|
|
24276
|
-
(0,
|
|
24317
|
+
(0, import_react116.useEffect)(() => {
|
|
24277
24318
|
const element = viewportRef.current;
|
|
24278
24319
|
if (!element) return;
|
|
24279
24320
|
const onWheel = (event) => {
|
|
@@ -24298,8 +24339,8 @@ function LayeredRelationshipGraph({
|
|
|
24298
24339
|
element.addEventListener("wheel", onWheel, { passive: false });
|
|
24299
24340
|
return () => element.removeEventListener("wheel", onWheel);
|
|
24300
24341
|
}, []);
|
|
24301
|
-
const pointers = (0,
|
|
24302
|
-
const pinchDistance = (0,
|
|
24342
|
+
const pointers = (0, import_react116.useRef)(/* @__PURE__ */ new Map());
|
|
24343
|
+
const pinchDistance = (0, import_react116.useRef)(void 0);
|
|
24303
24344
|
const onPointerDown = (event) => {
|
|
24304
24345
|
if (event.target.closest("button")) return;
|
|
24305
24346
|
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
@@ -24407,8 +24448,8 @@ function LayeredRelationshipGraph({
|
|
|
24407
24448
|
if (nodeAriaLabel) return [nodeAriaLabel(node), item.inCycle ? labels.cycle : void 0, conflict].filter(Boolean).join(", ");
|
|
24408
24449
|
return [node.label, node.type, node.description, labels.relationships(item.degree), item.inCycle ? labels.cycle : void 0, conflict].filter(Boolean).join(", ");
|
|
24409
24450
|
};
|
|
24410
|
-
const nodeLabelById = (0,
|
|
24411
|
-
const relationsOf = (0,
|
|
24451
|
+
const nodeLabelById = (0, import_react116.useMemo)(() => new Map(bounded.nodes.map((node) => [node.id, node.label])), [bounded.nodes]);
|
|
24452
|
+
const relationsOf = (0, import_react116.useMemo)(() => {
|
|
24412
24453
|
const map = /* @__PURE__ */ new Map();
|
|
24413
24454
|
const add = (id, text) => {
|
|
24414
24455
|
const list = map.get(id);
|
|
@@ -24444,7 +24485,7 @@ function LayeredRelationshipGraph({
|
|
|
24444
24485
|
transform: `translate(${view.x}px, ${view.y}px) scale(${view.zoom})`
|
|
24445
24486
|
};
|
|
24446
24487
|
const zoomPercent = Math.round(view.zoom * 100);
|
|
24447
|
-
const labelPlacement = (0,
|
|
24488
|
+
const labelPlacement = (0, import_react116.useMemo)(() => {
|
|
24448
24489
|
const shown = layout.edges.filter(showLabel);
|
|
24449
24490
|
const count2 = /* @__PURE__ */ new Map();
|
|
24450
24491
|
for (const edge of shown) count2.set(edge.label ?? "", (count2.get(edge.label ?? "") ?? 0) + 1);
|
|
@@ -24462,9 +24503,9 @@ function LayeredRelationshipGraph({
|
|
|
24462
24503
|
const placed = separateEdgeLabels(boxes, { maxShift: 48 / zoomStep, obstacles: layout.items });
|
|
24463
24504
|
return new Map([...placed].map(([id, place]) => [id, { ...place, scale: scales.get(id) ?? 1 }]));
|
|
24464
24505
|
}, [layout, edgeLabels, activeIds, focusWithinId, labels, zoomStep]);
|
|
24465
|
-
const live = (0,
|
|
24506
|
+
const live = (0, import_react116.useRef)({ activate, onItemKeyDown, onFocusChange, toggleCluster, onSelect });
|
|
24466
24507
|
live.current = { activate, onItemKeyDown, onFocusChange, toggleCluster, onSelect };
|
|
24467
|
-
const edgeLayer = (0,
|
|
24508
|
+
const edgeLayer = (0, import_react116.useMemo)(() => {
|
|
24468
24509
|
const ordered = layout.edges.map((edge) => ({ edge, active: activeIds.has(edge.source) || activeIds.has(edge.target) || edge.edgeIds.some((id) => highlightedEdgeIds.has(id)) })).sort((a, b) => Number(a.active) - Number(b.active));
|
|
24469
24510
|
const dimmed = (edge) => dimmedNodeIds.has(edge.source) && dimmedNodeIds.has(edge.target) || void 0;
|
|
24470
24511
|
return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("svg", { ref: edgesRef, className: "uix-relationship-graph__edges", width: layout.width, height: layout.height, "aria-hidden": "true", focusable: "false", children: [
|
|
@@ -24536,7 +24577,7 @@ function LayeredRelationshipGraph({
|
|
|
24536
24577
|
rect.setAttribute("height", String(box.height + 2 * LABEL_CHIP_PAD_Y));
|
|
24537
24578
|
}
|
|
24538
24579
|
}, [edgeLayer]);
|
|
24539
|
-
const itemLayer = (0,
|
|
24580
|
+
const itemLayer = (0, import_react116.useMemo)(() => /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(import_jsx_runtime132.Fragment, { children: [
|
|
24540
24581
|
layout.columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(
|
|
24541
24582
|
"div",
|
|
24542
24583
|
{
|
|
@@ -24626,7 +24667,7 @@ function LayeredRelationshipGraph({
|
|
|
24626
24667
|
);
|
|
24627
24668
|
})
|
|
24628
24669
|
] }), [layout, labels, selectedItemId, focusedId, relationsOf, dimmedNodeIds, highlightedNodeIds, conflictedNodeIds, showRoot, rootItemId, describeId, hintId, bounded, renderNode, renderCluster, nodeAriaLabel]);
|
|
24629
|
-
const listLayer = (0,
|
|
24670
|
+
const listLayer = (0, import_react116.useMemo)(() => showList && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
24630
24671
|
EquivalentRelationshipList,
|
|
24631
24672
|
{
|
|
24632
24673
|
nodes: bounded.nodes,
|
|
@@ -24799,7 +24840,7 @@ function radialViewBox(nodes) {
|
|
|
24799
24840
|
return `${round(minX)} ${round(minY)} ${width} ${height}`;
|
|
24800
24841
|
}
|
|
24801
24842
|
function RelationshipGraph(props) {
|
|
24802
|
-
const labels = (0,
|
|
24843
|
+
const labels = (0, import_react117.useMemo)(() => {
|
|
24803
24844
|
const merged = { ...DEFAULT_RELATIONSHIP_GRAPH_LABELS, ...props.labels };
|
|
24804
24845
|
if (props.labels?.connectedTo && props.labels.connectedHeading === void 0) {
|
|
24805
24846
|
merged.connectedHeading = props.labels.connectedTo("").replace(/[\s:,]+$/u, "");
|
|
@@ -24840,17 +24881,17 @@ function RadialRelationshipGraph({
|
|
|
24840
24881
|
showList = true,
|
|
24841
24882
|
controls = "full"
|
|
24842
24883
|
}) {
|
|
24843
|
-
const bounded = (0,
|
|
24844
|
-
const positioned = (0,
|
|
24845
|
-
const typeColor = (0,
|
|
24884
|
+
const bounded = (0, import_react117.useMemo)(() => boundRelationshipGraph(nodes, edges, maxNodes), [nodes, edges, maxNodes]);
|
|
24885
|
+
const positioned = (0, import_react117.useMemo)(() => layoutRelationshipGraph(bounded.nodes, bounded.edges, selectedId), [bounded, selectedId]);
|
|
24886
|
+
const typeColor = (0, import_react117.useMemo)(
|
|
24846
24887
|
() => new Map(legend.map((item, index) => [item.id, `var(--uix-chart-${index % 8 + 1})`])),
|
|
24847
24888
|
[legend]
|
|
24848
24889
|
);
|
|
24849
|
-
const positionedById = (0,
|
|
24850
|
-
const [zoom, setZoom] = (0,
|
|
24851
|
-
const [pan, setPan] = (0,
|
|
24852
|
-
const [focusedId, setFocusedId] = (0,
|
|
24853
|
-
const svgRef = (0,
|
|
24890
|
+
const positionedById = (0, import_react117.useMemo)(() => new Map(positioned.map((node) => [node.id, node])), [positioned]);
|
|
24891
|
+
const [zoom, setZoom] = (0, import_react117.useState)(1);
|
|
24892
|
+
const [pan, setPan] = (0, import_react117.useState)({ x: 0, y: 0 });
|
|
24893
|
+
const [focusedId, setFocusedId] = (0, import_react117.useState)(selectedId ?? positioned[0]?.id);
|
|
24894
|
+
const svgRef = (0, import_react117.useRef)(null);
|
|
24854
24895
|
const select = (id) => {
|
|
24855
24896
|
const node = bounded.nodes.find((item) => item.id === id);
|
|
24856
24897
|
if (node) onSelect?.(node);
|
|
@@ -24924,7 +24965,7 @@ function RadialRelationshipGraph({
|
|
|
24924
24965
|
}
|
|
24925
24966
|
|
|
24926
24967
|
// src/components/AuditLog.tsx
|
|
24927
|
-
var
|
|
24968
|
+
var import_react118 = require("react");
|
|
24928
24969
|
var import_jsx_runtime134 = require("react/jsx-runtime");
|
|
24929
24970
|
var DEFAULT_AUDIT_LOG_LABELS = {
|
|
24930
24971
|
list: "Access history",
|
|
@@ -24973,10 +25014,10 @@ function AuditLog({
|
|
|
24973
25014
|
...props
|
|
24974
25015
|
}) {
|
|
24975
25016
|
const labels = { ...DEFAULT_AUDIT_LOG_LABELS, ...useUixLabels().auditLog, ...labelOverrides };
|
|
24976
|
-
const id = (0,
|
|
24977
|
-
const [announced, setAnnounced] = (0,
|
|
24978
|
-
const countBefore = (0,
|
|
24979
|
-
(0,
|
|
25017
|
+
const id = (0, import_react118.useId)();
|
|
25018
|
+
const [announced, setAnnounced] = (0, import_react118.useState)("");
|
|
25019
|
+
const countBefore = (0, import_react118.useRef)(null);
|
|
25020
|
+
(0, import_react118.useEffect)(() => {
|
|
24980
25021
|
const before = countBefore.current;
|
|
24981
25022
|
if (before == null || loadingMore) return;
|
|
24982
25023
|
if (loadMoreError) {
|
|
@@ -25069,8 +25110,8 @@ function knownTimeZone(zone) {
|
|
|
25069
25110
|
}
|
|
25070
25111
|
}
|
|
25071
25112
|
function AuditFilter({ id, field, value, formatDate, onApply }) {
|
|
25072
|
-
const anchor = (0,
|
|
25073
|
-
const [draft, setDraft] = (0,
|
|
25113
|
+
const anchor = (0, import_react118.useRef)(null);
|
|
25114
|
+
const [draft, setDraft] = (0, import_react118.useState)(value);
|
|
25074
25115
|
const set = !isFilterEmpty(value);
|
|
25075
25116
|
const popover = () => document.getElementById(`${id}-pop`);
|
|
25076
25117
|
const resolved = useResolvedFilterLabels(field, value);
|
|
@@ -25103,7 +25144,7 @@ function AuditFilter({ id, field, value, formatDate, onApply }) {
|
|
|
25103
25144
|
}
|
|
25104
25145
|
|
|
25105
25146
|
// src/components/MatchReview.tsx
|
|
25106
|
-
var
|
|
25147
|
+
var import_react119 = require("react");
|
|
25107
25148
|
var import_jsx_runtime135 = require("react/jsx-runtime");
|
|
25108
25149
|
var DEFAULT_MATCH_REVIEW_LABELS = {
|
|
25109
25150
|
region: "Match review",
|
|
@@ -25184,11 +25225,11 @@ function MatchReview({
|
|
|
25184
25225
|
const plural = (n, one, many) => fillLabel(n === 1 ? one : many, { count: n });
|
|
25185
25226
|
const decisionLabel = { accepted: labels.decisionAccepted, dismissed: labels.decisionDismissed, split: labels.decisionSplit, other: labels.decisionOther };
|
|
25186
25227
|
const actionLabel = { accept: labels.accept, dismiss: labels.dismiss, split: labels.split, "pick-other": labels.pickOther };
|
|
25187
|
-
const [internalSelection, setInternalSelection] = (0,
|
|
25188
|
-
const [announcement, setAnnouncement] = (0,
|
|
25189
|
-
const [bulkPending, setBulkPending] = (0,
|
|
25228
|
+
const [internalSelection, setInternalSelection] = (0, import_react119.useState)(/* @__PURE__ */ new Set());
|
|
25229
|
+
const [announcement, setAnnouncement] = (0, import_react119.useState)("");
|
|
25230
|
+
const [bulkPending, setBulkPending] = (0, import_react119.useState)(false);
|
|
25190
25231
|
const selection = selectedIds ?? internalSelection;
|
|
25191
|
-
const pending = (0,
|
|
25232
|
+
const pending = (0, import_react119.useMemo)(() => candidates.filter((candidate) => candidate.status !== "resolved"), [candidates]);
|
|
25192
25233
|
const setSelection = (next) => {
|
|
25193
25234
|
if (selectedIds === void 0) setInternalSelection(next);
|
|
25194
25235
|
onSelectionChange?.(next);
|
|
@@ -25300,10 +25341,10 @@ function MatchReview({
|
|
|
25300
25341
|
}
|
|
25301
25342
|
var sameValue = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null);
|
|
25302
25343
|
function AdoptCandidate({ candidate, incoming, fields, labels, heading, provenance, onAdopt, onDecision, decisionLabel }) {
|
|
25303
|
-
const id = (0,
|
|
25304
|
-
const [chosen, setChosen] = (0,
|
|
25305
|
-
const [pending, setPending] = (0,
|
|
25306
|
-
const [message, setMessage] = (0,
|
|
25344
|
+
const id = (0, import_react119.useId)();
|
|
25345
|
+
const [chosen, setChosen] = (0, import_react119.useState)(/* @__PURE__ */ new Set());
|
|
25346
|
+
const [pending, setPending] = (0, import_react119.useState)(false);
|
|
25347
|
+
const [message, setMessage] = (0, import_react119.useState)(null);
|
|
25307
25348
|
const resolved = candidate.status === "resolved";
|
|
25308
25349
|
const headingText = typeof heading === "string" ? heading : fillLabel(labels.candidate, { id: candidate.id });
|
|
25309
25350
|
const toggle = (fieldId, on) => {
|
|
@@ -25382,10 +25423,10 @@ function AdoptCandidate({ candidate, incoming, fields, labels, heading, provenan
|
|
|
25382
25423
|
}
|
|
25383
25424
|
|
|
25384
25425
|
// src/components/MatrixInput.tsx
|
|
25385
|
-
var
|
|
25426
|
+
var import_react121 = require("react");
|
|
25386
25427
|
|
|
25387
25428
|
// src/hooks/useMatrixGrid.ts
|
|
25388
|
-
var
|
|
25429
|
+
var import_react120 = require("react");
|
|
25389
25430
|
|
|
25390
25431
|
// src/matrix-model.ts
|
|
25391
25432
|
function matrixStep(from, size, key, options = {}) {
|
|
@@ -25415,22 +25456,22 @@ function matrixStep(from, size, key, options = {}) {
|
|
|
25415
25456
|
}
|
|
25416
25457
|
|
|
25417
25458
|
// src/hooks/useMatrixGrid.ts
|
|
25418
|
-
var useIsomorphicLayoutEffect27 = typeof document !== "undefined" ?
|
|
25459
|
+
var useIsomorphicLayoutEffect27 = typeof document !== "undefined" ? import_react120.useLayoutEffect : import_react120.useEffect;
|
|
25419
25460
|
var CELL = "[data-uix-matrix-cell]";
|
|
25420
25461
|
function useMatrixGrid(rows, columns) {
|
|
25421
|
-
const gridRef = (0,
|
|
25422
|
-
const stop2 = (0,
|
|
25423
|
-
const size = (0,
|
|
25462
|
+
const gridRef = (0, import_react120.useRef)(null);
|
|
25463
|
+
const stop2 = (0, import_react120.useRef)({ node: null, index: 0 });
|
|
25464
|
+
const size = (0, import_react120.useRef)({ rows, columns });
|
|
25424
25465
|
size.current = { rows, columns };
|
|
25425
25466
|
const cells = () => Array.from(gridRef.current?.querySelectorAll(CELL) ?? []);
|
|
25426
25467
|
useIsomorphicLayoutEffect27(() => {
|
|
25427
25468
|
stop2.current = syncRovingStop(cells(), stop2.current);
|
|
25428
25469
|
});
|
|
25429
|
-
const onGridFocus = (0,
|
|
25470
|
+
const onGridFocus = (0, import_react120.useCallback)((event) => {
|
|
25430
25471
|
const cell = event.target.closest(CELL);
|
|
25431
25472
|
if (cell) stop2.current = syncRovingStop(cells(), stop2.current, cell);
|
|
25432
25473
|
}, []);
|
|
25433
|
-
const onCellKeyDown = (0,
|
|
25474
|
+
const onCellKeyDown = (0, import_react120.useCallback)((event) => {
|
|
25434
25475
|
const cell = event.currentTarget;
|
|
25435
25476
|
if (cell.getAttribute("aria-expanded") === "true") return;
|
|
25436
25477
|
const { key, altKey, shiftKey } = event;
|
|
@@ -25511,7 +25552,7 @@ var matrixClass = (className, modifier) => cx("uix-matrix", modifier && `uix-mat
|
|
|
25511
25552
|
|
|
25512
25553
|
// src/components/MatrixInput.tsx
|
|
25513
25554
|
var import_jsx_runtime137 = require("react/jsx-runtime");
|
|
25514
|
-
var Cell = (0,
|
|
25555
|
+
var Cell = (0, import_react121.memo)(function Cell2({
|
|
25515
25556
|
rowId,
|
|
25516
25557
|
columnId,
|
|
25517
25558
|
rowIndex,
|
|
@@ -25579,25 +25620,25 @@ function MatrixInput({
|
|
|
25579
25620
|
className,
|
|
25580
25621
|
...props
|
|
25581
25622
|
}) {
|
|
25582
|
-
const uid = (0,
|
|
25623
|
+
const uid = (0, import_react121.useId)();
|
|
25583
25624
|
const { gridRef, onCellKeyDown, onGridFocus } = useMatrixGrid(rows.length, columns.length);
|
|
25584
|
-
const helpRef = (0,
|
|
25585
|
-
const latest = (0,
|
|
25625
|
+
const helpRef = (0, import_react121.useRef)(null);
|
|
25626
|
+
const latest = (0, import_react121.useRef)({ value, onChange });
|
|
25586
25627
|
latest.current = { value, onChange };
|
|
25587
|
-
const onPick = (0,
|
|
25628
|
+
const onPick = (0, import_react121.useCallback)((rowId, columnId, next) => {
|
|
25588
25629
|
const current = latest.current;
|
|
25589
25630
|
current.onChange(
|
|
25590
25631
|
{ ...current.value, [rowId]: { ...current.value[rowId], [columnId]: next } },
|
|
25591
25632
|
{ rowId, columnId, value: next }
|
|
25592
25633
|
);
|
|
25593
25634
|
}, []);
|
|
25594
|
-
const choices = (0,
|
|
25635
|
+
const choices = (0, import_react121.useMemo)(() => options.map(({ value: v, label, description, disabled: off }) => ({
|
|
25595
25636
|
value: v,
|
|
25596
25637
|
label,
|
|
25597
25638
|
...description ? { description } : {},
|
|
25598
25639
|
...off ? { disabled: true } : {}
|
|
25599
25640
|
})), [options]);
|
|
25600
|
-
const byValue = (0,
|
|
25641
|
+
const byValue = (0, import_react121.useMemo)(() => new Map(options.map((o) => [o.value, o])), [options]);
|
|
25601
25642
|
const showHelp = (cell) => {
|
|
25602
25643
|
if (helpRef.current) helpRef.current.textContent = cell?.getAttribute("data-help") ?? "";
|
|
25603
25644
|
};
|
|
@@ -25614,7 +25655,7 @@ function MatrixInput({
|
|
|
25614
25655
|
const onBlur = (event) => {
|
|
25615
25656
|
if (!event.currentTarget.contains(event.relatedTarget)) showHelp(null);
|
|
25616
25657
|
};
|
|
25617
|
-
(0,
|
|
25658
|
+
(0, import_react121.useEffect)(() => {
|
|
25618
25659
|
const focused = cellOf(document.activeElement);
|
|
25619
25660
|
if (focused && gridRef.current?.contains(focused)) showHelp(focused);
|
|
25620
25661
|
});
|
|
@@ -25666,7 +25707,7 @@ function MatrixInput({
|
|
|
25666
25707
|
}
|
|
25667
25708
|
|
|
25668
25709
|
// src/components/MatrixHeatmap.tsx
|
|
25669
|
-
var
|
|
25710
|
+
var import_react122 = require("react");
|
|
25670
25711
|
var import_jsx_runtime138 = require("react/jsx-runtime");
|
|
25671
25712
|
var cellKey = (rowId, columnId) => JSON.stringify([rowId, columnId]);
|
|
25672
25713
|
function MatrixHeatmap({
|
|
@@ -25684,7 +25725,7 @@ function MatrixHeatmap({
|
|
|
25684
25725
|
...props
|
|
25685
25726
|
}) {
|
|
25686
25727
|
const { gridRef, onCellKeyDown, onGridFocus } = useMatrixGrid(rows.length, columns.length);
|
|
25687
|
-
const byCell = (0,
|
|
25728
|
+
const byCell = (0, import_react122.useMemo)(() => new Map(cells.map((cell) => [cellKey(cell.rowId, cell.columnId), cell])), [cells]);
|
|
25688
25729
|
return /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("div", { ...props, className: matrixClass(className, "heatmap"), children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
25689
25730
|
MatrixFrame,
|
|
25690
25731
|
{
|
|
@@ -25728,7 +25769,7 @@ function MatrixHeatmap({
|
|
|
25728
25769
|
}
|
|
25729
25770
|
|
|
25730
25771
|
// src/components/MetricInput.tsx
|
|
25731
|
-
var
|
|
25772
|
+
var import_react123 = require("react");
|
|
25732
25773
|
|
|
25733
25774
|
// src/metric-model.ts
|
|
25734
25775
|
function decimals(value) {
|
|
@@ -25774,14 +25815,14 @@ function MetricInput({
|
|
|
25774
25815
|
className,
|
|
25775
25816
|
id: providedId
|
|
25776
25817
|
}) {
|
|
25777
|
-
const generatedId = (0,
|
|
25818
|
+
const generatedId = (0, import_react123.useId)();
|
|
25778
25819
|
const id = providedId ?? generatedId;
|
|
25779
25820
|
const errorId = `${id}-error`;
|
|
25780
25821
|
const hintId = `${id}-hint`;
|
|
25781
25822
|
const showError = Boolean(invalid && errorMessage);
|
|
25782
25823
|
const describedBy = [hint ? hintId : null, showError ? errorId : null].filter(Boolean).join(" ") || void 0;
|
|
25783
|
-
const [text, setText] = (0,
|
|
25784
|
-
(0,
|
|
25824
|
+
const [text, setText] = (0, import_react123.useState)(() => format(value));
|
|
25825
|
+
(0, import_react123.useEffect)(() => setText(format(value)), [value, format]);
|
|
25785
25826
|
const commit = (input) => {
|
|
25786
25827
|
const parsed = parse(input);
|
|
25787
25828
|
if (input.trim() === "" || parsed !== null) {
|
|
@@ -25893,7 +25934,7 @@ function LicensePositionBar({
|
|
|
25893
25934
|
}
|
|
25894
25935
|
|
|
25895
25936
|
// src/components/BrandProfiles.tsx
|
|
25896
|
-
var
|
|
25937
|
+
var import_react125 = require("react");
|
|
25897
25938
|
|
|
25898
25939
|
// src/color-model.ts
|
|
25899
25940
|
var clamp4 = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
@@ -25962,7 +26003,7 @@ function meetsContrast(background, foreground, minimum = 4.5) {
|
|
|
25962
26003
|
}
|
|
25963
26004
|
|
|
25964
26005
|
// src/components/ColorPicker.tsx
|
|
25965
|
-
var
|
|
26006
|
+
var import_react124 = require("react");
|
|
25966
26007
|
var import_jsx_runtime141 = require("react/jsx-runtime");
|
|
25967
26008
|
var DEFAULT_COLOR_PICKER_LABELS = {
|
|
25968
26009
|
trigger: "{label}: {color}",
|
|
@@ -25994,17 +26035,17 @@ function ColorPicker({
|
|
|
25994
26035
|
labels: labelOverrides
|
|
25995
26036
|
}) {
|
|
25996
26037
|
const labels = { ...DEFAULT_COLOR_PICKER_LABELS, ...labelOverrides };
|
|
25997
|
-
const id = (0,
|
|
25998
|
-
const triggerRef = (0,
|
|
25999
|
-
const dialogRef = (0,
|
|
26000
|
-
const [open, setOpen] = (0,
|
|
26038
|
+
const id = (0, import_react124.useId)();
|
|
26039
|
+
const triggerRef = (0, import_react124.useRef)(null);
|
|
26040
|
+
const dialogRef = (0, import_react124.useRef)(null);
|
|
26041
|
+
const [open, setOpen] = (0, import_react124.useState)(false);
|
|
26001
26042
|
const normalized = normalizeHex(value) ?? "#000000";
|
|
26002
|
-
const [hexText, setHexText] = (0,
|
|
26003
|
-
const hsv = (0,
|
|
26043
|
+
const [hexText, setHexText] = (0, import_react124.useState)(normalized);
|
|
26044
|
+
const hsv = (0, import_react124.useMemo)(() => rgbToHsv(hexToRgb(normalized)), [normalized]);
|
|
26004
26045
|
const ratio = contrastRatio(normalized, foreground) ?? 0;
|
|
26005
26046
|
const passes = ratio >= minimumContrast;
|
|
26006
|
-
(0,
|
|
26007
|
-
(0,
|
|
26047
|
+
(0, import_react124.useEffect)(() => setHexText(normalized), [normalized]);
|
|
26048
|
+
(0, import_react124.useEffect)(() => {
|
|
26008
26049
|
if (!open) return;
|
|
26009
26050
|
const dialog = dialogRef.current;
|
|
26010
26051
|
dialog?.querySelector("input,button")?.focus();
|
|
@@ -26224,7 +26265,7 @@ function BrandProfileEditor({
|
|
|
26224
26265
|
labels: labelOverrides
|
|
26225
26266
|
}) {
|
|
26226
26267
|
const labels = { ...DEFAULT_BRAND_PROFILE_EDITOR_LABELS, ...labelOverrides };
|
|
26227
|
-
const [announcement, setAnnouncement] = (0,
|
|
26268
|
+
const [announcement, setAnnouncement] = (0, import_react125.useState)("");
|
|
26228
26269
|
const update = (patch) => onChange({ ...value, ...patch });
|
|
26229
26270
|
const apply = () => {
|
|
26230
26271
|
if (applyTarget !== null) applyBrandProfile(value, applyTarget);
|
|
@@ -26296,7 +26337,7 @@ function BrandProfileEditor({
|
|
|
26296
26337
|
var BrandProfiles = BrandProfileEditor;
|
|
26297
26338
|
|
|
26298
26339
|
// src/components/DiffViewer.tsx
|
|
26299
|
-
var
|
|
26340
|
+
var import_react126 = require("react");
|
|
26300
26341
|
|
|
26301
26342
|
// src/diff-model.ts
|
|
26302
26343
|
function isJsonObject(value) {
|
|
@@ -26400,9 +26441,9 @@ function DiffViewer({
|
|
|
26400
26441
|
};
|
|
26401
26442
|
const resolutionLabel = { accept: labels.resolutionAccept, skip: labels.resolutionSkip, pending: labels.resolutionPending };
|
|
26402
26443
|
const buttonSize = controlSize === "md" ? void 0 : `uix-btn--${controlSize}`;
|
|
26403
|
-
const id = (0,
|
|
26404
|
-
const entries = (0,
|
|
26405
|
-
const [internalResolutions, setInternalResolutions] = (0,
|
|
26444
|
+
const id = (0, import_react126.useId)();
|
|
26445
|
+
const entries = (0, import_react126.useMemo)(() => providedEntries ?? buildThreeWayDiff(base, current, incoming), [providedEntries, base, current, incoming]);
|
|
26446
|
+
const [internalResolutions, setInternalResolutions] = (0, import_react126.useState)({});
|
|
26406
26447
|
const resolutions = controlledResolutions ?? internalResolutions;
|
|
26407
26448
|
const summary = summarizeDiff(entries, resolutions);
|
|
26408
26449
|
const resolve = (path, resolution) => {
|
|
@@ -26470,7 +26511,7 @@ function DiffViewer({
|
|
|
26470
26511
|
}
|
|
26471
26512
|
|
|
26472
26513
|
// src/components/TextDiff.tsx
|
|
26473
|
-
var
|
|
26514
|
+
var import_react127 = require("react");
|
|
26474
26515
|
|
|
26475
26516
|
// src/text-diff-model.ts
|
|
26476
26517
|
var WORD_TOKENS = /\s+|[\p{L}\p{M}\p{N}_]+|[^\s\p{L}\p{M}\p{N}_]/gu;
|
|
@@ -26749,7 +26790,7 @@ function Marked({ segments, side, labels, whole: whole2 }) {
|
|
|
26749
26790
|
": "
|
|
26750
26791
|
] }),
|
|
26751
26792
|
segment.text
|
|
26752
|
-
] }, i) : /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
|
|
26793
|
+
] }, i) : /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(import_react127.Fragment, { children: segment.text }, i)) });
|
|
26753
26794
|
}
|
|
26754
26795
|
function Cell3({ line, side, kind, labels }) {
|
|
26755
26796
|
if (!line) return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("div", { className: "uix-text-diff__cell", "data-side": side, "data-empty": "", "aria-hidden": "true" });
|
|
@@ -26761,9 +26802,9 @@ function Cell3({ line, side, kind, labels }) {
|
|
|
26761
26802
|
] });
|
|
26762
26803
|
}
|
|
26763
26804
|
function Rows({ rows, view, labels, focusFirst }) {
|
|
26764
|
-
const [open, setOpen] = (0,
|
|
26765
|
-
const first = (0,
|
|
26766
|
-
(0,
|
|
26805
|
+
const [open, setOpen] = (0, import_react127.useState)(() => /* @__PURE__ */ new Set());
|
|
26806
|
+
const first = (0, import_react127.useRef)(null);
|
|
26807
|
+
(0, import_react127.useEffect)(() => {
|
|
26767
26808
|
if (focusFirst) first.current?.focus();
|
|
26768
26809
|
}, [focusFirst]);
|
|
26769
26810
|
const firstProps = (index) => focusFirst && index === 0 ? { ref: first, tabIndex: -1 } : {};
|
|
@@ -26776,7 +26817,7 @@ function Rows({ rows, view, labels, focusFirst }) {
|
|
|
26776
26817
|
const after = row.kind === "delete" ? void 0 : row.after;
|
|
26777
26818
|
if (view === "unified") {
|
|
26778
26819
|
if (row.kind === "equal") return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("div", { className: "uix-text-diff__row", "data-kind": "equal", ...firstProps(index), children: /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(Cell3, { line: after, side: "after", kind: "equal", labels }) }, index);
|
|
26779
|
-
return /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)(
|
|
26820
|
+
return /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)(import_react127.Fragment, { children: [
|
|
26780
26821
|
before && /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("div", { className: "uix-text-diff__row", "data-kind": "delete", children: /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(Cell3, { line: before, side: "before", kind: row.kind, labels }) }),
|
|
26781
26822
|
after && /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("div", { className: "uix-text-diff__row", "data-kind": "insert", children: /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(Cell3, { line: after, side: "after", kind: row.kind, labels }) })
|
|
26782
26823
|
] }, index);
|
|
@@ -26805,8 +26846,8 @@ function TextDiff({
|
|
|
26805
26846
|
}) {
|
|
26806
26847
|
const uixLabels = useUixLabels();
|
|
26807
26848
|
const labels = { ...DEFAULT_TEXT_DIFF_LABELS, ...uixLabels.textDiff, ...labelOverrides };
|
|
26808
|
-
const result = (0,
|
|
26809
|
-
const rows = (0,
|
|
26849
|
+
const result = (0, import_react127.useMemo)(() => diffText(before, after, { granularity, maxTokens, maxEdits }), [before, after, granularity, maxTokens, maxEdits]);
|
|
26850
|
+
const rows = (0, import_react127.useMemo)(() => granularity === "line" && result.status === "ok" ? textDiffRows(result, { context }) : [], [result, granularity, context]);
|
|
26810
26851
|
const heads = /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)("div", { className: "uix-text-diff__heads", "aria-hidden": view === "unified" || void 0, children: [
|
|
26811
26852
|
/* @__PURE__ */ (0, import_jsx_runtime144.jsxs)("span", { className: "uix-text-diff__head", "data-side": "before", children: [
|
|
26812
26853
|
view === "unified" && /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("span", { "aria-hidden": "true", children: "\u2212 " }),
|
|
@@ -26824,7 +26865,7 @@ function TextDiff({
|
|
|
26824
26865
|
else {
|
|
26825
26866
|
const prose = (side2) => /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("div", { className: "uix-text-diff__prose", "data-side": side2, children: result.ops.map((op, i) => {
|
|
26826
26867
|
const text = op.tokens.join("");
|
|
26827
|
-
if (op.type === "equal") return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
|
|
26868
|
+
if (op.type === "equal") return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(import_react127.Fragment, { children: text }, i);
|
|
26828
26869
|
if (op.type === "delete" && side2 === "after") return null;
|
|
26829
26870
|
if (op.type === "insert" && side2 === "before") return null;
|
|
26830
26871
|
return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(Marked, { segments: [{ text, changed: true }], side: op.type === "delete" ? "before" : "after", labels }, i);
|
|
@@ -26844,6 +26885,16 @@ function TextDiff({
|
|
|
26844
26885
|
body
|
|
26845
26886
|
] });
|
|
26846
26887
|
}
|
|
26888
|
+
|
|
26889
|
+
// src/components/ChartMetric.tsx
|
|
26890
|
+
var import_jsx_runtime145 = require("react/jsx-runtime");
|
|
26891
|
+
function ChartMetric({ value, label, delta, deltaTone = "neutral", align, className, ...props }) {
|
|
26892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime145.jsxs)("div", { className: cx("uix-chart__metric", className), "data-align": align, ...props, children: [
|
|
26893
|
+
/* @__PURE__ */ (0, import_jsx_runtime145.jsx)("div", { className: "uix-chart__metric-value", children: value }),
|
|
26894
|
+
label != null && /* @__PURE__ */ (0, import_jsx_runtime145.jsx)("div", { className: "uix-chart__metric-label", children: label }),
|
|
26895
|
+
delta != null && /* @__PURE__ */ (0, import_jsx_runtime145.jsx)("div", { className: "uix-chart__delta", "data-tone": deltaTone, children: delta })
|
|
26896
|
+
] });
|
|
26897
|
+
}
|
|
26847
26898
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26848
26899
|
0 && (module.exports = {
|
|
26849
26900
|
AccountMenu,
|
|
@@ -26874,6 +26925,7 @@ function TextDiff({
|
|
|
26874
26925
|
CellSub,
|
|
26875
26926
|
ChangeHighlight,
|
|
26876
26927
|
ChartCard,
|
|
26928
|
+
ChartMetric,
|
|
26877
26929
|
Checkbox,
|
|
26878
26930
|
CheckboxGroup,
|
|
26879
26931
|
Chip,
|