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