@tensor_1/react 2.39.0 → 2.40.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 +18 -0
- package/dist/chart-analytic-model.d.ts +5 -1
- package/dist/chart-analytic-model.js +23 -16
- package/dist/chart-analytic.cjs +23 -16
- package/dist/chart-analytic.d.cts +5 -1
- package/dist/components/Comments.d.ts +4 -1
- package/dist/components/Comments.js +3 -2
- package/dist/components/Markdown.d.ts +9 -2
- package/dist/components/Markdown.js +16 -2
- package/dist/components/RichTextEditor.d.ts +17 -0
- package/dist/components/RichTextEditor.js +179 -11
- package/dist/components/ToggleRow.d.ts +8 -1
- package/dist/components/ToggleRow.js +17 -3
- package/dist/icons/Icon.d.ts +12 -12
- package/dist/index.cjs +490 -475
- package/dist/index.d.cts +12 -2
- package/dist/markdown-model-Cuwi6pIk.d.cts +110 -0
- package/dist/markdown-model.d.ts +38 -1
- package/dist/markdown-model.js +67 -0
- package/dist/markdown.cjs +90 -4
- package/dist/markdown.d.cts +11 -75
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.js +16 -2
- package/dist/rich-text/mention.d.ts +14 -0
- package/dist/rich-text/mention.js +57 -0
- package/dist/rich-text/pipeline.js +4 -1
- package/dist/rich-text.cjs +1795 -1483
- package/dist/rich-text.d.cts +27 -1
- package/dist/rich-text.d.ts +3 -0
- package/dist/rich-text.js +6 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4141,19 +4141,33 @@ function RelatedLinks({ title, items, className, ...props }) {
|
|
|
4141
4141
|
}
|
|
4142
4142
|
|
|
4143
4143
|
// src/components/ToggleRow.tsx
|
|
4144
|
+
var import_react29 = require("react");
|
|
4144
4145
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4145
4146
|
function ToggleRow({ label, description, checked, onCheckedChange, disabled, accessibleLabel, className, ...props }) {
|
|
4147
|
+
const id = (0, import_react29.useId)();
|
|
4148
|
+
const switchId = `${id}-switch`;
|
|
4149
|
+
const descriptionId = `${id}-description`;
|
|
4146
4150
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: cx("uix-toggle-row", className), ...props, children: [
|
|
4147
4151
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "uix-toggle-row__copy", children: [
|
|
4148
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "uix-toggle-row__label", children: label }),
|
|
4149
|
-
description != null && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "uix-toggle-row__description", children: description })
|
|
4152
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "uix-toggle-row__label", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("label", { htmlFor: switchId, children: label }) }),
|
|
4153
|
+
description != null && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "uix-toggle-row__description", id: descriptionId, children: description })
|
|
4150
4154
|
] }),
|
|
4151
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4155
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4156
|
+
Switch,
|
|
4157
|
+
{
|
|
4158
|
+
id: switchId,
|
|
4159
|
+
checked,
|
|
4160
|
+
disabled,
|
|
4161
|
+
...accessibleLabel ? { "aria-label": accessibleLabel } : {},
|
|
4162
|
+
...description != null ? { "aria-describedby": descriptionId } : {},
|
|
4163
|
+
onChange: (event) => onCheckedChange(event.currentTarget.checked)
|
|
4164
|
+
}
|
|
4165
|
+
)
|
|
4152
4166
|
] });
|
|
4153
4167
|
}
|
|
4154
4168
|
|
|
4155
4169
|
// src/components/CollapsibleSection.tsx
|
|
4156
|
-
var
|
|
4170
|
+
var import_react31 = require("react");
|
|
4157
4171
|
|
|
4158
4172
|
// src/components/CollapsibleParts.tsx
|
|
4159
4173
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
@@ -4171,9 +4185,9 @@ function CollapsibleSummary({ title, summary, headingLevel, titleId, summaryRef
|
|
|
4171
4185
|
}
|
|
4172
4186
|
|
|
4173
4187
|
// src/components/CollapsibleSectionState.tsx
|
|
4174
|
-
var
|
|
4188
|
+
var import_react30 = require("react");
|
|
4175
4189
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4176
|
-
var useIsomorphicLayoutEffect5 = typeof document !== "undefined" ?
|
|
4190
|
+
var useIsomorphicLayoutEffect5 = typeof document !== "undefined" ? import_react30.useLayoutEffect : import_react30.useEffect;
|
|
4177
4191
|
var STORAGE_PREFIX = "uix:collapsible:";
|
|
4178
4192
|
var storageOf = (kind) => kind === "local" ? window.localStorage : window.sessionStorage;
|
|
4179
4193
|
var readStored = (kind, key) => {
|
|
@@ -4206,15 +4220,15 @@ function CollapsibleSectionState({
|
|
|
4206
4220
|
onToggle,
|
|
4207
4221
|
...props
|
|
4208
4222
|
}) {
|
|
4209
|
-
const ref = (0,
|
|
4210
|
-
const summaryRef = (0,
|
|
4211
|
-
const titleId = (0,
|
|
4223
|
+
const ref = (0, import_react30.useRef)(null);
|
|
4224
|
+
const summaryRef = (0, import_react30.useRef)(null);
|
|
4225
|
+
const titleId = (0, import_react30.useId)();
|
|
4212
4226
|
const initial = open ?? defaultOpen ?? false;
|
|
4213
|
-
const [isOpen2, setIsOpen] = (0,
|
|
4214
|
-
const [hasOpened, setHasOpened] = (0,
|
|
4215
|
-
const lastOpen = (0,
|
|
4216
|
-
const lastRequest = (0,
|
|
4217
|
-
(0,
|
|
4227
|
+
const [isOpen2, setIsOpen] = (0, import_react30.useState)(initial);
|
|
4228
|
+
const [hasOpened, setHasOpened] = (0, import_react30.useState)(initial);
|
|
4229
|
+
const lastOpen = (0, import_react30.useRef)(open);
|
|
4230
|
+
const lastRequest = (0, import_react30.useRef)(openRequest ? void 0 : openRequest);
|
|
4231
|
+
(0, import_react30.useEffect)(() => {
|
|
4218
4232
|
if (!persistKey) return;
|
|
4219
4233
|
const stored = readStored(persistStorage, persistKey);
|
|
4220
4234
|
if (stored !== void 0) {
|
|
@@ -4222,14 +4236,14 @@ function CollapsibleSectionState({
|
|
|
4222
4236
|
if (stored) setHasOpened(true);
|
|
4223
4237
|
}
|
|
4224
4238
|
}, [persistKey, persistStorage]);
|
|
4225
|
-
(0,
|
|
4239
|
+
(0, import_react30.useEffect)(() => {
|
|
4226
4240
|
if (open === lastOpen.current) return;
|
|
4227
4241
|
lastOpen.current = open;
|
|
4228
4242
|
if (open === void 0) return;
|
|
4229
4243
|
setIsOpen(open);
|
|
4230
4244
|
if (open) setHasOpened(true);
|
|
4231
4245
|
}, [open]);
|
|
4232
|
-
(0,
|
|
4246
|
+
(0, import_react30.useEffect)(() => {
|
|
4233
4247
|
if (openRequest === void 0 || openRequest === lastRequest.current) return;
|
|
4234
4248
|
lastRequest.current = openRequest;
|
|
4235
4249
|
setIsOpen(true);
|
|
@@ -4240,7 +4254,7 @@ function CollapsibleSectionState({
|
|
|
4240
4254
|
summaryRef.current?.focus({ preventScroll: true });
|
|
4241
4255
|
});
|
|
4242
4256
|
}, [openRequest, persistKey, persistStorage]);
|
|
4243
|
-
const renderedOpen = (0,
|
|
4257
|
+
const renderedOpen = (0, import_react30.useRef)(isOpen2);
|
|
4244
4258
|
useIsomorphicLayoutEffect5(() => {
|
|
4245
4259
|
renderedOpen.current = isOpen2;
|
|
4246
4260
|
}, [isOpen2]);
|
|
@@ -4265,7 +4279,7 @@ function CollapsibleSectionState({
|
|
|
4265
4279
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4266
4280
|
function CollapsibleSection(props) {
|
|
4267
4281
|
const { title, summary, children, className, lazy, persistKey, persistStorage, openRequest, open, defaultOpen, compact, headingLevel, ...rest } = props;
|
|
4268
|
-
const titleId = (0,
|
|
4282
|
+
const titleId = (0, import_react31.useId)();
|
|
4269
4283
|
if (lazy || persistKey !== void 0 || openRequest !== void 0) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CollapsibleSectionState, { ...props });
|
|
4270
4284
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("details", { className: collapsibleClass(compact, className), ...rest, open: open ?? defaultOpen, children: [
|
|
4271
4285
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CollapsibleSummary, { title, summary, headingLevel, titleId }),
|
|
@@ -4274,7 +4288,7 @@ function CollapsibleSection(props) {
|
|
|
4274
4288
|
}
|
|
4275
4289
|
|
|
4276
4290
|
// src/components/ListRoving.tsx
|
|
4277
|
-
var
|
|
4291
|
+
var import_react32 = require("react");
|
|
4278
4292
|
|
|
4279
4293
|
// src/roving.ts
|
|
4280
4294
|
function syncRovingStop(all, stop, next) {
|
|
@@ -4294,18 +4308,18 @@ function rovingStep(all, from, key) {
|
|
|
4294
4308
|
// src/components/ListRoving.tsx
|
|
4295
4309
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4296
4310
|
function RovingList({ children, className, onKeyDown, onFocus, ...props }) {
|
|
4297
|
-
const ref = (0,
|
|
4298
|
-
const stop = (0,
|
|
4311
|
+
const ref = (0, import_react32.useRef)(null);
|
|
4312
|
+
const stop = (0, import_react32.useRef)({ node: null, index: 0 });
|
|
4299
4313
|
const items = () => Array.from(ref.current?.querySelectorAll(".uix-list__item") ?? []).filter((element) => element.closest(".uix-list") === ref.current);
|
|
4300
4314
|
const sync = (next) => {
|
|
4301
4315
|
const all = items();
|
|
4302
4316
|
for (const element of all) if (!element.hasAttribute("role")) element.setAttribute("role", "listitem");
|
|
4303
4317
|
stop.current = syncRovingStop(all, stop.current, next);
|
|
4304
4318
|
};
|
|
4305
|
-
(0,
|
|
4319
|
+
(0, import_react32.useEffect)(() => {
|
|
4306
4320
|
sync();
|
|
4307
4321
|
});
|
|
4308
|
-
(0,
|
|
4322
|
+
(0, import_react32.useEffect)(() => {
|
|
4309
4323
|
const list = ref.current;
|
|
4310
4324
|
if (!list || typeof MutationObserver === "undefined") return;
|
|
4311
4325
|
const observer = new MutationObserver(() => sync());
|
|
@@ -4357,11 +4371,11 @@ function ListItem({ title, meta, trail, leading, children, className, ...props }
|
|
|
4357
4371
|
}
|
|
4358
4372
|
|
|
4359
4373
|
// src/components/DescriptionList.tsx
|
|
4360
|
-
var
|
|
4374
|
+
var import_react33 = require("react");
|
|
4361
4375
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
4362
4376
|
function DescriptionList({ items, children, className, ...props }) {
|
|
4363
4377
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("dl", { className: cx("uix-dl", className), ...props, children: [
|
|
4364
|
-
items?.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
4378
|
+
items?.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_react33.Fragment, { children: [
|
|
4365
4379
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("dt", { ...item.termProps, children: item.term }),
|
|
4366
4380
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("dd", { ...item.descriptionProps, children: item.description })
|
|
4367
4381
|
] }, item.id ?? i)),
|
|
@@ -4376,9 +4390,9 @@ function DescriptionItem({ term, children, termProps, descriptionProps }) {
|
|
|
4376
4390
|
}
|
|
4377
4391
|
|
|
4378
4392
|
// src/components/Tabs.tsx
|
|
4379
|
-
var
|
|
4393
|
+
var import_react34 = require("react");
|
|
4380
4394
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4381
|
-
var TabsCtx = (0,
|
|
4395
|
+
var TabsCtx = (0, import_react34.createContext)({});
|
|
4382
4396
|
var Chevron2 = ({ d }) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d }) });
|
|
4383
4397
|
var inlineOffset = (el, rtl) => rtl ? -el.scrollLeft : el.scrollLeft;
|
|
4384
4398
|
function Tabs({
|
|
@@ -4392,15 +4406,15 @@ function Tabs({
|
|
|
4392
4406
|
onKeyDown: onKeyDownProp,
|
|
4393
4407
|
...listProps
|
|
4394
4408
|
}) {
|
|
4395
|
-
const baseId = (0,
|
|
4396
|
-
const listRef = (0,
|
|
4397
|
-
const contextValue = (0,
|
|
4409
|
+
const baseId = (0, import_react34.useId)();
|
|
4410
|
+
const listRef = (0, import_react34.useRef)(null);
|
|
4411
|
+
const contextValue = (0, import_react34.useMemo)(() => ({ value, onChange, baseId }), [value, onChange, baseId]);
|
|
4398
4412
|
const scroll = overflow === "scroll";
|
|
4399
|
-
const [hidden, setHidden] = (0,
|
|
4400
|
-
const kids =
|
|
4401
|
-
const panels = kids.filter((k) => (0,
|
|
4402
|
-
const tabs = kids.filter((k) => !((0,
|
|
4403
|
-
(0,
|
|
4413
|
+
const [hidden, setHidden] = (0, import_react34.useState)({ start: false, end: false });
|
|
4414
|
+
const kids = import_react34.Children.toArray(children);
|
|
4415
|
+
const panels = kids.filter((k) => (0, import_react34.isValidElement)(k) && k.type === TabPanel);
|
|
4416
|
+
const tabs = kids.filter((k) => !((0, import_react34.isValidElement)(k) && k.type === TabPanel));
|
|
4417
|
+
(0, import_react34.useEffect)(() => {
|
|
4404
4418
|
const list2 = listRef.current;
|
|
4405
4419
|
if (!list2) return;
|
|
4406
4420
|
const all = Array.from(list2.querySelectorAll('[role="tab"]'));
|
|
@@ -4408,7 +4422,7 @@ function Tabs({
|
|
|
4408
4422
|
const active = enabled.find((t) => t.getAttribute("aria-selected") === "true") ?? enabled[0];
|
|
4409
4423
|
for (const t of all) t.tabIndex = t === active ? 0 : -1;
|
|
4410
4424
|
});
|
|
4411
|
-
(0,
|
|
4425
|
+
(0, import_react34.useEffect)(() => {
|
|
4412
4426
|
const list2 = listRef.current;
|
|
4413
4427
|
if (!scroll || !list2) return;
|
|
4414
4428
|
const measure = () => {
|
|
@@ -4429,7 +4443,7 @@ function Tabs({
|
|
|
4429
4443
|
observer.disconnect();
|
|
4430
4444
|
};
|
|
4431
4445
|
});
|
|
4432
|
-
(0,
|
|
4446
|
+
(0, import_react34.useEffect)(() => {
|
|
4433
4447
|
const list2 = listRef.current;
|
|
4434
4448
|
const tab = list2?.querySelector('[role="tab"][aria-selected="true"]');
|
|
4435
4449
|
if (!scroll || !list2 || !tab) return;
|
|
@@ -4522,7 +4536,7 @@ function Tabs({
|
|
|
4522
4536
|
] });
|
|
4523
4537
|
}
|
|
4524
4538
|
function Tab({ value, children, disabled, className, onClick, ...props }) {
|
|
4525
|
-
const ctx = (0,
|
|
4539
|
+
const ctx = (0, import_react34.useContext)(TabsCtx);
|
|
4526
4540
|
const selected = ctx.value === value;
|
|
4527
4541
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4528
4542
|
"button",
|
|
@@ -4544,7 +4558,7 @@ function Tab({ value, children, disabled, className, onClick, ...props }) {
|
|
|
4544
4558
|
);
|
|
4545
4559
|
}
|
|
4546
4560
|
function TabPanel({ value, children, keepMounted, ...props }) {
|
|
4547
|
-
const ctx = (0,
|
|
4561
|
+
const ctx = (0, import_react34.useContext)(TabsCtx);
|
|
4548
4562
|
const selected = ctx.value === value;
|
|
4549
4563
|
if (!selected && !keepMounted) return null;
|
|
4550
4564
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
@@ -4562,7 +4576,7 @@ function TabPanel({ value, children, keepMounted, ...props }) {
|
|
|
4562
4576
|
}
|
|
4563
4577
|
|
|
4564
4578
|
// src/components/AppShell.tsx
|
|
4565
|
-
var
|
|
4579
|
+
var import_react35 = require("react");
|
|
4566
4580
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
4567
4581
|
function AppShell({
|
|
4568
4582
|
nav,
|
|
@@ -4583,7 +4597,7 @@ function AppShell({
|
|
|
4583
4597
|
const skipToContentLabel = skipToContentLabelProp ?? uixLabels.appShell?.skipToContent ?? "Skip to content";
|
|
4584
4598
|
const exitFocusLabel = exitFocusLabelProp ?? uixLabels.appShell?.exitFocus ?? "Esc \xB7 Exit focus";
|
|
4585
4599
|
const navState = nav ?? (collapsed ? "rail" : "full");
|
|
4586
|
-
(0,
|
|
4600
|
+
(0, import_react35.useEffect)(() => {
|
|
4587
4601
|
if (!focus || !onExitFocus) return;
|
|
4588
4602
|
const onKey = (e) => {
|
|
4589
4603
|
if (e.key === "Escape") onExitFocus();
|
|
@@ -4611,7 +4625,7 @@ function AppShell({
|
|
|
4611
4625
|
}
|
|
4612
4626
|
|
|
4613
4627
|
// src/components/Sidebar.tsx
|
|
4614
|
-
var
|
|
4628
|
+
var import_react36 = require("react");
|
|
4615
4629
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
4616
4630
|
var ChevronIcon = () => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("svg", { className: "uix-navgroup__chevron", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("path", { d: "M2 4l4 4 4-4" }) });
|
|
4617
4631
|
function Sidebar({ collapsed, nav, onToggle, brand, toggleIcon, children, expandLabel: expandLabelProp, collapseLabel: collapseLabelProp, className, ...props }) {
|
|
@@ -4677,12 +4691,12 @@ function NavItem({ icon, badge, active, as: Tag = "a", description, children, cl
|
|
|
4677
4691
|
);
|
|
4678
4692
|
}
|
|
4679
4693
|
function NavGroup({ icon, label, children, defaultExpanded = true, expanded: controlledExpanded, onExpandedChange }) {
|
|
4680
|
-
const [internalExpanded, setInternalExpanded] = (0,
|
|
4694
|
+
const [internalExpanded, setInternalExpanded] = (0, import_react36.useState)(defaultExpanded);
|
|
4681
4695
|
const expanded = controlledExpanded ?? internalExpanded;
|
|
4682
|
-
const panelId = (0,
|
|
4683
|
-
const triggerRef = (0,
|
|
4684
|
-
const panelRef = (0,
|
|
4685
|
-
(0,
|
|
4696
|
+
const panelId = (0, import_react36.useId)();
|
|
4697
|
+
const triggerRef = (0, import_react36.useRef)(null);
|
|
4698
|
+
const panelRef = (0, import_react36.useRef)(null);
|
|
4699
|
+
(0, import_react36.useEffect)(() => {
|
|
4686
4700
|
panelRef.current?.toggleAttribute("inert", !expanded);
|
|
4687
4701
|
if (!expanded && panelRef.current?.contains(document.activeElement)) triggerRef.current?.focus();
|
|
4688
4702
|
}, [expanded]);
|
|
@@ -4761,7 +4775,7 @@ function StarButton({
|
|
|
4761
4775
|
}
|
|
4762
4776
|
|
|
4763
4777
|
// src/components/CopyButton.tsx
|
|
4764
|
-
var
|
|
4778
|
+
var import_react37 = require("react");
|
|
4765
4779
|
|
|
4766
4780
|
// src/copy-model.ts
|
|
4767
4781
|
async function copyText(value, clipboard = globalThis.navigator?.clipboard) {
|
|
@@ -4783,11 +4797,11 @@ var CopyGlyph = () => /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("svg", { vi
|
|
|
4783
4797
|
] });
|
|
4784
4798
|
var CheckGlyph = () => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("path", { d: "M20 6 9 17l-5-5" }) });
|
|
4785
4799
|
function CopyButton({ value, label, copiedLabel, failedLabel, className }) {
|
|
4786
|
-
const [outcome, setOutcome] = (0,
|
|
4800
|
+
const [outcome, setOutcome] = (0, import_react37.useState)("idle");
|
|
4787
4801
|
const copied = outcome === "copied";
|
|
4788
|
-
const timer = (0,
|
|
4789
|
-
const mounted = (0,
|
|
4790
|
-
(0,
|
|
4802
|
+
const timer = (0, import_react37.useRef)(void 0);
|
|
4803
|
+
const mounted = (0, import_react37.useRef)(true);
|
|
4804
|
+
(0, import_react37.useEffect)(() => {
|
|
4791
4805
|
mounted.current = true;
|
|
4792
4806
|
return () => {
|
|
4793
4807
|
mounted.current = false;
|
|
@@ -4822,7 +4836,7 @@ function CopyButton({ value, label, copiedLabel, failedLabel, className }) {
|
|
|
4822
4836
|
}
|
|
4823
4837
|
|
|
4824
4838
|
// src/components/NavFavourites.tsx
|
|
4825
|
-
var
|
|
4839
|
+
var import_react38 = require("react");
|
|
4826
4840
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
4827
4841
|
var ChevronDownIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4828
4842
|
"svg",
|
|
@@ -4885,14 +4899,14 @@ function NavFavourites({
|
|
|
4885
4899
|
emptyReason,
|
|
4886
4900
|
className
|
|
4887
4901
|
}) {
|
|
4888
|
-
const regionId = (0,
|
|
4889
|
-
const headerRef = (0,
|
|
4890
|
-
const regionRef = (0,
|
|
4891
|
-
const [announcement, setAnnouncement] = (0,
|
|
4892
|
-
const focusAfterRef = (0,
|
|
4893
|
-
const triggerRefs = (0,
|
|
4894
|
-
const order = (0,
|
|
4895
|
-
(0,
|
|
4902
|
+
const regionId = (0, import_react38.useId)();
|
|
4903
|
+
const headerRef = (0, import_react38.useRef)(null);
|
|
4904
|
+
const regionRef = (0, import_react38.useRef)(null);
|
|
4905
|
+
const [announcement, setAnnouncement] = (0, import_react38.useState)("");
|
|
4906
|
+
const focusAfterRef = (0, import_react38.useRef)(null);
|
|
4907
|
+
const triggerRefs = (0, import_react38.useRef)(/* @__PURE__ */ new Map());
|
|
4908
|
+
const order = (0, import_react38.useMemo)(() => items.map((item) => item.id), [items]);
|
|
4909
|
+
(0, import_react38.useEffect)(() => {
|
|
4896
4910
|
const id = focusAfterRef.current;
|
|
4897
4911
|
if (!id) return;
|
|
4898
4912
|
focusAfterRef.current = null;
|
|
@@ -4909,7 +4923,7 @@ function NavFavourites({
|
|
|
4909
4923
|
}
|
|
4910
4924
|
onToggleCollapsed?.();
|
|
4911
4925
|
};
|
|
4912
|
-
const move = (0,
|
|
4926
|
+
const move = (0, import_react38.useCallback)((id, dir) => {
|
|
4913
4927
|
const idx = order.indexOf(id);
|
|
4914
4928
|
const next = idx + dir;
|
|
4915
4929
|
if (idx < 0 || next < 0 || next >= order.length) return;
|
|
@@ -4922,13 +4936,13 @@ function NavFavourites({
|
|
|
4922
4936
|
if (moved) setAnnouncement(`${moved.label} moved to position ${next + 1} of ${order.length}`);
|
|
4923
4937
|
onReorder(reordered);
|
|
4924
4938
|
}, [onReorder, order]);
|
|
4925
|
-
const remove = (0,
|
|
4939
|
+
const remove = (0, import_react38.useCallback)((id) => {
|
|
4926
4940
|
const idx = order.indexOf(id);
|
|
4927
4941
|
const neighbour = order[idx + 1] ?? order[idx - 1] ?? null;
|
|
4928
4942
|
focusAfterRef.current = neighbour;
|
|
4929
4943
|
onRemove(id);
|
|
4930
4944
|
}, [onRemove, order]);
|
|
4931
|
-
const registerTrigger = (0,
|
|
4945
|
+
const registerTrigger = (0, import_react38.useCallback)((id, element) => {
|
|
4932
4946
|
if (element) triggerRefs.current.set(id, element);
|
|
4933
4947
|
else triggerRefs.current.delete(id);
|
|
4934
4948
|
}, []);
|
|
@@ -4980,7 +4994,7 @@ function NavFavourites({
|
|
|
4980
4994
|
)
|
|
4981
4995
|
] });
|
|
4982
4996
|
}
|
|
4983
|
-
var FavouriteRow = (0,
|
|
4997
|
+
var FavouriteRow = (0, import_react38.memo)(function FavouriteRow2({
|
|
4984
4998
|
item,
|
|
4985
4999
|
isFirst,
|
|
4986
5000
|
isLast,
|
|
@@ -4989,17 +5003,17 @@ var FavouriteRow = (0, import_react37.memo)(function FavouriteRow2({
|
|
|
4989
5003
|
onRemove,
|
|
4990
5004
|
registerTrigger
|
|
4991
5005
|
}) {
|
|
4992
|
-
const [open, setOpen] = (0,
|
|
4993
|
-
const menuId = (0,
|
|
4994
|
-
const triggerRef = (0,
|
|
4995
|
-
const itemRefs = (0,
|
|
5006
|
+
const [open, setOpen] = (0, import_react38.useState)(false);
|
|
5007
|
+
const menuId = (0, import_react38.useId)();
|
|
5008
|
+
const triggerRef = (0, import_react38.useRef)(null);
|
|
5009
|
+
const itemRefs = (0, import_react38.useRef)([]);
|
|
4996
5010
|
const optionsTemplate = labels.options ?? "{label} favourite options";
|
|
4997
5011
|
const actions = [
|
|
4998
5012
|
...isFirst ? [] : [{ label: labels.moveUp, onSelect: () => onMove(item.id, -1) }],
|
|
4999
5013
|
...isLast ? [] : [{ label: labels.moveDown, onSelect: () => onMove(item.id, 1) }],
|
|
5000
5014
|
{ label: labels.remove.replace("{label}", item.label), onSelect: () => onRemove(item.id) }
|
|
5001
5015
|
];
|
|
5002
|
-
(0,
|
|
5016
|
+
(0, import_react38.useEffect)(() => {
|
|
5003
5017
|
if (open) itemRefs.current[0]?.focus();
|
|
5004
5018
|
}, [open]);
|
|
5005
5019
|
const closeAndReturnFocus = () => {
|
|
@@ -5109,7 +5123,7 @@ var FavouriteRow = (0, import_react37.memo)(function FavouriteRow2({
|
|
|
5109
5123
|
});
|
|
5110
5124
|
|
|
5111
5125
|
// src/components/FileUpload.tsx
|
|
5112
|
-
var
|
|
5126
|
+
var import_react39 = require("react");
|
|
5113
5127
|
|
|
5114
5128
|
// src/file-model.ts
|
|
5115
5129
|
var UNITS = ["B", "KB", "MB", "GB", "TB"];
|
|
@@ -5235,11 +5249,11 @@ function FileUpload({
|
|
|
5235
5249
|
}) {
|
|
5236
5250
|
const labels = { ...DEFAULT_FILE_UPLOAD_LABELS, ...useUixLabels().fileUpload, ...labelOverrides };
|
|
5237
5251
|
const sizeText = (bytes) => formatSize ? formatSize(bytes, locale) : formatFileSize(bytes, locale, { base: sizeBase });
|
|
5238
|
-
const id = (0,
|
|
5239
|
-
const inputRef = (0,
|
|
5240
|
-
const [over, setOver] = (0,
|
|
5241
|
-
const [messages, setMessages] = (0,
|
|
5242
|
-
const [announce, setAnnounce] = (0,
|
|
5252
|
+
const id = (0, import_react39.useId)();
|
|
5253
|
+
const inputRef = (0, import_react39.useRef)(null);
|
|
5254
|
+
const [over, setOver] = (0, import_react39.useState)(false);
|
|
5255
|
+
const [messages, setMessages] = (0, import_react39.useState)([]);
|
|
5256
|
+
const [announce, setAnnounce] = (0, import_react39.useState)("");
|
|
5243
5257
|
const take = (list) => {
|
|
5244
5258
|
if (!list || disabled) return;
|
|
5245
5259
|
const files = Array.from(list);
|
|
@@ -5409,7 +5423,7 @@ function AttachmentList({ label, className, children, ...props }) {
|
|
|
5409
5423
|
}
|
|
5410
5424
|
|
|
5411
5425
|
// src/components/Alert.tsx
|
|
5412
|
-
var
|
|
5426
|
+
var import_react40 = require("react");
|
|
5413
5427
|
|
|
5414
5428
|
// src/components/AlertDismiss.tsx
|
|
5415
5429
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
@@ -5420,7 +5434,7 @@ function AlertDismissButton({ label, onDismiss }) {
|
|
|
5420
5434
|
|
|
5421
5435
|
// src/components/Alert.tsx
|
|
5422
5436
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
5423
|
-
var Alert = (0,
|
|
5437
|
+
var Alert = (0, import_react40.forwardRef)(function Alert2({ tone, title, icon, children, actions, onDismiss, dismissLabel, className, ...props }, ref) {
|
|
5424
5438
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
5425
5439
|
"div",
|
|
5426
5440
|
{
|
|
@@ -5467,7 +5481,7 @@ function LiveIndicator({ state = "live", children, className, ...props }) {
|
|
|
5467
5481
|
}
|
|
5468
5482
|
|
|
5469
5483
|
// src/components/Toast.tsx
|
|
5470
|
-
var
|
|
5484
|
+
var import_react41 = require("react");
|
|
5471
5485
|
|
|
5472
5486
|
// src/toast-store.ts
|
|
5473
5487
|
var DEFAULT_DURATION = {
|
|
@@ -5577,14 +5591,14 @@ var toast = createToastApi(createToastStore());
|
|
|
5577
5591
|
|
|
5578
5592
|
// src/components/Toast.tsx
|
|
5579
5593
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
5580
|
-
var ToasterContext = (0,
|
|
5594
|
+
var ToasterContext = (0, import_react41.createContext)(null);
|
|
5581
5595
|
function Toast({ title, message, tone, icon, action, onClose, leaving, dismissLabel: dismissLabelProp, className, ...props }) {
|
|
5582
5596
|
const uixLabels = useUixLabels();
|
|
5583
5597
|
const dismissLabel = dismissLabelProp ?? uixLabels.toast?.dismiss ?? "Dismiss";
|
|
5584
5598
|
const assertive = tone === "danger";
|
|
5585
|
-
const toaster = (0,
|
|
5586
|
-
const bodyRef = (0,
|
|
5587
|
-
(0,
|
|
5599
|
+
const toaster = (0, import_react41.useContext)(ToasterContext);
|
|
5600
|
+
const bodyRef = (0, import_react41.useRef)(null);
|
|
5601
|
+
(0, import_react41.useEffect)(() => {
|
|
5588
5602
|
if (assertive || !toaster) return;
|
|
5589
5603
|
const text = bodyRef.current?.textContent?.trim();
|
|
5590
5604
|
if (text) toaster.announce(text);
|
|
@@ -5679,8 +5693,8 @@ function StoreToast({ record, store }) {
|
|
|
5679
5693
|
);
|
|
5680
5694
|
}
|
|
5681
5695
|
function useToastTimers(store, visible, paused) {
|
|
5682
|
-
const timers = (0,
|
|
5683
|
-
(0,
|
|
5696
|
+
const timers = (0, import_react41.useRef)(/* @__PURE__ */ new Map());
|
|
5697
|
+
(0, import_react41.useEffect)(() => {
|
|
5684
5698
|
const now = Date.now();
|
|
5685
5699
|
const map = timers.current;
|
|
5686
5700
|
const live = new Map(visible.filter((r) => !r.leaving && r.duration != null).map((r) => [r.id, r]));
|
|
@@ -5710,7 +5724,7 @@ function useToastTimers(store, visible, paused) {
|
|
|
5710
5724
|
}
|
|
5711
5725
|
}
|
|
5712
5726
|
});
|
|
5713
|
-
(0,
|
|
5727
|
+
(0, import_react41.useEffect)(() => () => {
|
|
5714
5728
|
for (const timer of timers.current.values()) if (timer.handle != null) clearTimeout(timer.handle);
|
|
5715
5729
|
timers.current.clear();
|
|
5716
5730
|
}, []);
|
|
@@ -5718,23 +5732,23 @@ function useToastTimers(store, visible, paused) {
|
|
|
5718
5732
|
function Toaster({ children, regionLabel: regionLabelProp, store = toast.store, limit = 3, position = "bottom-end", className, onMouseEnter, onMouseLeave, onFocus, onBlur, onKeyDown, ...props }) {
|
|
5719
5733
|
const uixLabels = useUixLabels();
|
|
5720
5734
|
const regionLabel = regionLabelProp ?? uixLabels.toaster?.region ?? "Notifications";
|
|
5721
|
-
const [announced, setAnnounced] = (0,
|
|
5722
|
-
const clearTimer = (0,
|
|
5723
|
-
const announce = (0,
|
|
5735
|
+
const [announced, setAnnounced] = (0, import_react41.useState)("");
|
|
5736
|
+
const clearTimer = (0, import_react41.useRef)(null);
|
|
5737
|
+
const announce = (0, import_react41.useCallback)((text) => {
|
|
5724
5738
|
setAnnounced((cur) => cur ? `${cur} ${text}` : text);
|
|
5725
5739
|
if (clearTimer.current != null) clearTimeout(clearTimer.current);
|
|
5726
5740
|
clearTimer.current = window.setTimeout(() => setAnnounced(""), 3e3);
|
|
5727
5741
|
}, []);
|
|
5728
|
-
(0,
|
|
5742
|
+
(0, import_react41.useEffect)(() => () => {
|
|
5729
5743
|
if (clearTimer.current != null) clearTimeout(clearTimer.current);
|
|
5730
5744
|
}, []);
|
|
5731
|
-
const ctx = (0,
|
|
5732
|
-
const records = (0,
|
|
5733
|
-
const visible = (0,
|
|
5734
|
-
const [hovered, setHovered] = (0,
|
|
5735
|
-
const [focused, setFocused] = (0,
|
|
5736
|
-
const [hidden, setHidden] = (0,
|
|
5737
|
-
(0,
|
|
5745
|
+
const ctx = (0, import_react41.useMemo)(() => ({ announce }), [announce]);
|
|
5746
|
+
const records = (0, import_react41.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
|
|
5747
|
+
const visible = (0, import_react41.useMemo)(() => records.slice(-Math.max(1, limit)), [records, limit]);
|
|
5748
|
+
const [hovered, setHovered] = (0, import_react41.useState)(false);
|
|
5749
|
+
const [focused, setFocused] = (0, import_react41.useState)(false);
|
|
5750
|
+
const [hidden, setHidden] = (0, import_react41.useState)(false);
|
|
5751
|
+
(0, import_react41.useEffect)(() => {
|
|
5738
5752
|
const sync = () => setHidden(document.visibilityState === "hidden");
|
|
5739
5753
|
sync();
|
|
5740
5754
|
document.addEventListener("visibilitychange", sync);
|
|
@@ -5785,9 +5799,9 @@ function Toaster({ children, regionLabel: regionLabelProp, store = toast.store,
|
|
|
5785
5799
|
}
|
|
5786
5800
|
|
|
5787
5801
|
// src/components/Table.tsx
|
|
5788
|
-
var
|
|
5802
|
+
var import_react42 = require("react");
|
|
5789
5803
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
5790
|
-
var TableWrap = (0,
|
|
5804
|
+
var TableWrap = (0, import_react42.forwardRef)(function TableWrap2({ announcement, children, className, ...props }, ref) {
|
|
5791
5805
|
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { ref, className: cx("uix-table-wrap", className), ...props, children: [
|
|
5792
5806
|
announcement != null && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { role: "status", className: "uix-visually-hidden", children: announcement }),
|
|
5793
5807
|
children
|
|
@@ -5894,7 +5908,7 @@ function Highlighted({ text, query }) {
|
|
|
5894
5908
|
}
|
|
5895
5909
|
|
|
5896
5910
|
// src/components/Pagination.tsx
|
|
5897
|
-
var
|
|
5911
|
+
var import_react43 = require("react");
|
|
5898
5912
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
5899
5913
|
function getPageNumbers(page, total) {
|
|
5900
5914
|
if (total <= 7) return Array.from({ length: total }, (_, i) => i + 1);
|
|
@@ -5936,7 +5950,7 @@ function Pagination({
|
|
|
5936
5950
|
const labels = { ...DEFAULT_PAGINATION_LABELS, ...labelOverrides };
|
|
5937
5951
|
const render = ({ key, content, label, current, disabled, href, onClick }) => {
|
|
5938
5952
|
if (href != null && !disabled) {
|
|
5939
|
-
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
5953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react43.Fragment, { children: renderUixLink(renderLink, {
|
|
5940
5954
|
href,
|
|
5941
5955
|
className: "uix-pagination__btn",
|
|
5942
5956
|
"aria-label": label,
|
|
@@ -6023,11 +6037,11 @@ function Meter({ value = 0, tone, label, toneLabels, className, ...props }) {
|
|
|
6023
6037
|
}
|
|
6024
6038
|
|
|
6025
6039
|
// src/components/Stat.tsx
|
|
6026
|
-
var
|
|
6040
|
+
var import_react44 = require("react");
|
|
6027
6041
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
6028
6042
|
var Chevron3 = () => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "uix-stat__chevron", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d: "m6 9 6 6 6-6" }) }) });
|
|
6029
|
-
var Stat = (0,
|
|
6030
|
-
const id = (0,
|
|
6043
|
+
var Stat = (0, import_react44.forwardRef)(function Stat2({ label, value, icon, meta, trend, tone = "neutral", size = "hero", onActivate, activateLabel, expanded, trendLabels, haspopup = "dialog", href, current, renderLink, className, onClick, onKeyDown, pending = false, ...props }, ref) {
|
|
6044
|
+
const id = (0, import_react44.useId)();
|
|
6031
6045
|
const interactive = onActivate != null;
|
|
6032
6046
|
const linked = !interactive && href != null;
|
|
6033
6047
|
const classes = cx(
|
|
@@ -6290,7 +6304,7 @@ function predictionBand(fit, xs, level = 0.8) {
|
|
|
6290
6304
|
}
|
|
6291
6305
|
|
|
6292
6306
|
// src/components/Chip.tsx
|
|
6293
|
-
var
|
|
6307
|
+
var import_react45 = require("react");
|
|
6294
6308
|
|
|
6295
6309
|
// src/components/ChipRemove.tsx
|
|
6296
6310
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
@@ -6302,7 +6316,7 @@ function ChipRemoveButton({ label, text, disabled, onRemove }) {
|
|
|
6302
6316
|
|
|
6303
6317
|
// src/components/Chip.tsx
|
|
6304
6318
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
6305
|
-
var Chip = (0,
|
|
6319
|
+
var Chip = (0, import_react45.forwardRef)(function Chip2({
|
|
6306
6320
|
children,
|
|
6307
6321
|
icon,
|
|
6308
6322
|
count: count2,
|
|
@@ -6392,7 +6406,7 @@ function ChipGroup({ label, children, className, ...props }) {
|
|
|
6392
6406
|
}
|
|
6393
6407
|
|
|
6394
6408
|
// src/components/Kbd.tsx
|
|
6395
|
-
var
|
|
6409
|
+
var import_react46 = require("react");
|
|
6396
6410
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
6397
6411
|
function Kbd({ className, children, ...props }) {
|
|
6398
6412
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("kbd", { className: cx("uix-kbd", className), ...props, children });
|
|
@@ -6417,8 +6431,8 @@ var detectPlatform = () => {
|
|
|
6417
6431
|
return /mac|iphone|ipad|ipod/i.test(nav.userAgentData?.platform ?? navigator.platform ?? "") ? "mac" : "other";
|
|
6418
6432
|
};
|
|
6419
6433
|
function KbdCombo({ keys, platform, keyLabels, className, ...props }) {
|
|
6420
|
-
const [detected, setDetected] = (0,
|
|
6421
|
-
(0,
|
|
6434
|
+
const [detected, setDetected] = (0, import_react46.useState)("other");
|
|
6435
|
+
(0, import_react46.useEffect)(() => {
|
|
6422
6436
|
if (!platform) setDetected(detectPlatform());
|
|
6423
6437
|
}, [platform]);
|
|
6424
6438
|
const active = platform ?? detected;
|
|
@@ -6433,7 +6447,7 @@ function KbdCombo({ keys, platform, keyLabels, className, ...props }) {
|
|
|
6433
6447
|
}
|
|
6434
6448
|
|
|
6435
6449
|
// src/components/Steps.tsx
|
|
6436
|
-
var
|
|
6450
|
+
var import_react47 = require("react");
|
|
6437
6451
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
6438
6452
|
var DEFAULT_STEP_STATE_LABELS = {
|
|
6439
6453
|
complete: "Completed",
|
|
@@ -6446,9 +6460,9 @@ var CSS_STATE = { complete: "done", current: "active", upcoming: void 0, waiting
|
|
|
6446
6460
|
var Check = () => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("svg", { viewBox: "0 0 16 16", width: "12", height: "12", fill: "none", stroke: "currentColor", strokeWidth: 2.25, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("path", { d: "M3.5 8.5l3 3 6-7" }) });
|
|
6447
6461
|
function Steps({ orientation = "horizontal", progress = true, headingLevel, label, stateLabels, className, children, ...props }) {
|
|
6448
6462
|
const labels = { ...DEFAULT_STEP_STATE_LABELS, ...stateLabels };
|
|
6449
|
-
const steps =
|
|
6463
|
+
const steps = import_react47.Children.toArray(children).filter(import_react47.isValidElement);
|
|
6450
6464
|
const direction = progress ? orientation : "vertical";
|
|
6451
|
-
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("ol", { "aria-label": label, className: cx("uix-steps", "uix-steps--list", `uix-steps--${direction}`, !progress && "uix-steps--sections", className), ...props, children: steps.map((step, index) => (0,
|
|
6465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("ol", { "aria-label": label, className: cx("uix-steps", "uix-steps--list", `uix-steps--${direction}`, !progress && "uix-steps--sections", className), ...props, children: steps.map((step, index) => (0, import_react47.cloneElement)(step, { index, last: index === steps.length - 1, stateLabels: labels, progress, headingLevel })) });
|
|
6452
6466
|
}
|
|
6453
6467
|
function Step({
|
|
6454
6468
|
title,
|
|
@@ -6467,7 +6481,7 @@ function Step({
|
|
|
6467
6481
|
className,
|
|
6468
6482
|
...props
|
|
6469
6483
|
}) {
|
|
6470
|
-
const titleId = (0,
|
|
6484
|
+
const titleId = (0, import_react47.useId)();
|
|
6471
6485
|
const glyph = marker ?? (!progress ? index + 1 : state === "complete" ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Check, {}) : state === "error" ? "!" : index + 1);
|
|
6472
6486
|
const Title = headingLevel ? `h${headingLevel}` : "span";
|
|
6473
6487
|
const name = /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
|
|
@@ -6500,14 +6514,14 @@ function Step({
|
|
|
6500
6514
|
}
|
|
6501
6515
|
|
|
6502
6516
|
// src/components/Tooltip.tsx
|
|
6503
|
-
var
|
|
6517
|
+
var import_react48 = require("react");
|
|
6504
6518
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
6505
6519
|
function Tooltip({ label, content, placement = "top", className, children, ...props }) {
|
|
6506
|
-
const triggerRef = (0,
|
|
6507
|
-
const bubbleRef = (0,
|
|
6508
|
-
const closeTimer = (0,
|
|
6509
|
-
const [open, setOpen] = (0,
|
|
6510
|
-
const id = (0,
|
|
6520
|
+
const triggerRef = (0, import_react48.useRef)(null);
|
|
6521
|
+
const bubbleRef = (0, import_react48.useRef)(null);
|
|
6522
|
+
const closeTimer = (0, import_react48.useRef)(null);
|
|
6523
|
+
const [open, setOpen] = (0, import_react48.useState)(false);
|
|
6524
|
+
const id = (0, import_react48.useId)();
|
|
6511
6525
|
useAnchoredPosition(triggerRef, bubbleRef, { open, placement, offset: 6 });
|
|
6512
6526
|
const cancelClose = () => {
|
|
6513
6527
|
if (closeTimer.current != null) {
|
|
@@ -6541,7 +6555,7 @@ function Tooltip({ label, content, placement = "top", className, children, ...pr
|
|
|
6541
6555
|
cancelClose();
|
|
6542
6556
|
closeTimer.current = window.setTimeout(hide, 100);
|
|
6543
6557
|
};
|
|
6544
|
-
(0,
|
|
6558
|
+
(0, import_react48.useEffect)(() => {
|
|
6545
6559
|
if (!open) return;
|
|
6546
6560
|
const onKey = (e) => {
|
|
6547
6561
|
if (e.key === "Escape") hide();
|
|
@@ -6549,7 +6563,7 @@ function Tooltip({ label, content, placement = "top", className, children, ...pr
|
|
|
6549
6563
|
document.addEventListener("keydown", onKey);
|
|
6550
6564
|
return () => document.removeEventListener("keydown", onKey);
|
|
6551
6565
|
}, [open]);
|
|
6552
|
-
(0,
|
|
6566
|
+
(0, import_react48.useEffect)(() => () => {
|
|
6553
6567
|
if (closeTimer.current != null) clearTimeout(closeTimer.current);
|
|
6554
6568
|
const b = bubbleRef.current;
|
|
6555
6569
|
if (b && b.matches(":popover-open")) {
|
|
@@ -6560,8 +6574,8 @@ function Tooltip({ label, content, placement = "top", className, children, ...pr
|
|
|
6560
6574
|
}
|
|
6561
6575
|
}, []);
|
|
6562
6576
|
const bubbleAttr = { popover: "manual" };
|
|
6563
|
-
const single = (0,
|
|
6564
|
-
const child = single ? (0,
|
|
6577
|
+
const single = (0, import_react48.isValidElement)(children);
|
|
6578
|
+
const child = single ? (0, import_react48.cloneElement)(children, {
|
|
6565
6579
|
"aria-describedby": [children.props["aria-describedby"], id].filter(Boolean).join(" ")
|
|
6566
6580
|
}) : children;
|
|
6567
6581
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
@@ -6663,7 +6677,7 @@ function LoadingState({ rows = 3, density = "comfortable", label, className, ...
|
|
|
6663
6677
|
}
|
|
6664
6678
|
|
|
6665
6679
|
// src/components/RelativeTime.tsx
|
|
6666
|
-
var
|
|
6680
|
+
var import_react49 = require("react");
|
|
6667
6681
|
|
|
6668
6682
|
// src/relative-time-model.ts
|
|
6669
6683
|
function parseDateValue(value) {
|
|
@@ -6726,12 +6740,12 @@ function RelativeTime({
|
|
|
6726
6740
|
}) {
|
|
6727
6741
|
const interval = refreshInterval === false ? 0 : Math.max(0, refreshInterval);
|
|
6728
6742
|
const fixedNow = now == null ? void 0 : new Date(now).getTime();
|
|
6729
|
-
const subscribe = (0,
|
|
6743
|
+
const subscribe = (0, import_react49.useCallback)((listener) => fixedNow == null ? subscribeRelativeClock(interval, listener) : () => {
|
|
6730
6744
|
}, [fixedNow, interval]);
|
|
6731
|
-
const getSnapshot = (0,
|
|
6732
|
-
const getServerSnapshot = (0,
|
|
6733
|
-
const clock = (0,
|
|
6734
|
-
const date = (0,
|
|
6745
|
+
const getSnapshot = (0, import_react49.useCallback)(() => fixedNow ?? readRelativeClock(interval), [fixedNow, interval]);
|
|
6746
|
+
const getServerSnapshot = (0, import_react49.useCallback)(() => fixedNow ?? Date.now(), [fixedNow]);
|
|
6747
|
+
const clock = (0, import_react49.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
|
|
6748
|
+
const date = (0, import_react49.useMemo)(() => parseDateValue(value), [value]);
|
|
6735
6749
|
if (!date) return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("time", { "data-invalid": "true", suppressHydrationWarning: true, ...props, children: invalidLabel });
|
|
6736
6750
|
const current = new Date(clock);
|
|
6737
6751
|
const content = formatter ? formatter({ date, now: current, locale, timeZone }) : (() => {
|
|
@@ -6838,14 +6852,15 @@ function Comment({
|
|
|
6838
6852
|
}) {
|
|
6839
6853
|
const system = variant === "system";
|
|
6840
6854
|
const byline = author ?? (system ? systemLabel : void 0);
|
|
6855
|
+
const bare = avatar === false;
|
|
6841
6856
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
6842
6857
|
"div",
|
|
6843
6858
|
{
|
|
6844
|
-
className: cx("uix-comment", system && "uix-comment--system", className),
|
|
6859
|
+
className: cx("uix-comment", system && "uix-comment--system", bare && "uix-comment--bare", className),
|
|
6845
6860
|
"data-variant": system ? "system" : void 0,
|
|
6846
6861
|
...props,
|
|
6847
6862
|
children: [
|
|
6848
|
-
avatar ?? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { "aria-hidden": "true" }),
|
|
6863
|
+
bare ? null : avatar ?? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { "aria-hidden": "true" }),
|
|
6849
6864
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "uix-comment__body", children: [
|
|
6850
6865
|
(byline != null || meta != null) && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "uix-comment__meta", children: [
|
|
6851
6866
|
byline != null && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "uix-comment__author", children: byline }),
|
|
@@ -6882,13 +6897,13 @@ function SaveStatus({ state, labels, onRetry, className, ...props }) {
|
|
|
6882
6897
|
}
|
|
6883
6898
|
|
|
6884
6899
|
// src/components/Composer.tsx
|
|
6885
|
-
var
|
|
6900
|
+
var import_react50 = require("react");
|
|
6886
6901
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
6887
6902
|
function Composer({ children, className, label = "Add a comment", ...props }) {
|
|
6888
|
-
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: cx("uix-composer", className), ...props, children:
|
|
6889
|
-
if (!(0,
|
|
6903
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: cx("uix-composer", className), ...props, children: import_react50.Children.map(children, (child) => {
|
|
6904
|
+
if (!(0, import_react50.isValidElement)(child) || child.type !== "textarea") return child;
|
|
6890
6905
|
const p = child.props;
|
|
6891
|
-
return p["aria-label"] || p["aria-labelledby"] || p.id ? child : (0,
|
|
6906
|
+
return p["aria-label"] || p["aria-labelledby"] || p.id ? child : (0, import_react50.cloneElement)(child, { "aria-label": label });
|
|
6892
6907
|
}) });
|
|
6893
6908
|
}
|
|
6894
6909
|
function ComposerBar({ children, className, ...props }) {
|
|
@@ -6896,14 +6911,14 @@ function ComposerBar({ children, className, ...props }) {
|
|
|
6896
6911
|
}
|
|
6897
6912
|
|
|
6898
6913
|
// src/components/Segmented.tsx
|
|
6899
|
-
var
|
|
6914
|
+
var import_react51 = require("react");
|
|
6900
6915
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
6901
|
-
var SegmentedCtx = (0,
|
|
6916
|
+
var SegmentedCtx = (0, import_react51.createContext)({});
|
|
6902
6917
|
var OPTION = ".uix-segmented__option";
|
|
6903
6918
|
function Segmented({ value, onChange, selection = "toggle", children, className, onKeyDown, ...props }) {
|
|
6904
|
-
const ref = (0,
|
|
6905
|
-
const contextValue = (0,
|
|
6906
|
-
(0,
|
|
6919
|
+
const ref = (0, import_react51.useRef)(null);
|
|
6920
|
+
const contextValue = (0, import_react51.useMemo)(() => ({ value, onChange, selection }), [value, onChange, selection]);
|
|
6921
|
+
(0, import_react51.useEffect)(() => {
|
|
6907
6922
|
const group = ref.current;
|
|
6908
6923
|
if (!group) return;
|
|
6909
6924
|
const all = Array.from(group.querySelectorAll(OPTION));
|
|
@@ -6960,7 +6975,7 @@ function SegmentedOption({
|
|
|
6960
6975
|
onClick,
|
|
6961
6976
|
...props
|
|
6962
6977
|
}) {
|
|
6963
|
-
const ctx = (0,
|
|
6978
|
+
const ctx = (0, import_react51.useContext)(SegmentedCtx);
|
|
6964
6979
|
const selected = ctx.value === value;
|
|
6965
6980
|
const radio = ctx.selection === "radio";
|
|
6966
6981
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
@@ -6983,7 +6998,7 @@ function SegmentedOption({
|
|
|
6983
6998
|
}
|
|
6984
6999
|
|
|
6985
7000
|
// src/components/TableControls.tsx
|
|
6986
|
-
var
|
|
7001
|
+
var import_react52 = require("react");
|
|
6987
7002
|
|
|
6988
7003
|
// src/components/EditorIcons.tsx
|
|
6989
7004
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
@@ -7059,11 +7074,11 @@ var isPopoverOpen2 = (el) => {
|
|
|
7059
7074
|
}
|
|
7060
7075
|
};
|
|
7061
7076
|
function ColumnRowMenu({ label, actions, triggerRef }) {
|
|
7062
|
-
const [open, setOpen] = (0,
|
|
7063
|
-
const menuId = (0,
|
|
7064
|
-
const button = (0,
|
|
7065
|
-
const items = (0,
|
|
7066
|
-
const wasOpenAtPress = (0,
|
|
7077
|
+
const [open, setOpen] = (0, import_react52.useState)(false);
|
|
7078
|
+
const menuId = (0, import_react52.useId)();
|
|
7079
|
+
const button = (0, import_react52.useRef)(null);
|
|
7080
|
+
const items = (0, import_react52.useRef)([]);
|
|
7081
|
+
const wasOpenAtPress = (0, import_react52.useRef)(false);
|
|
7067
7082
|
const enabled = () => items.current.filter((el) => !!el && !el.disabled);
|
|
7068
7083
|
const close = (returnFocus) => {
|
|
7069
7084
|
const el = document.getElementById(menuId);
|
|
@@ -7071,7 +7086,7 @@ function ColumnRowMenu({ label, actions, triggerRef }) {
|
|
|
7071
7086
|
setOpen(false);
|
|
7072
7087
|
if (returnFocus) button.current?.focus();
|
|
7073
7088
|
};
|
|
7074
|
-
(0,
|
|
7089
|
+
(0, import_react52.useEffect)(() => {
|
|
7075
7090
|
if (!open) return;
|
|
7076
7091
|
const el = document.getElementById(menuId);
|
|
7077
7092
|
if (el && typeof el.showPopover === "function" && !isPopoverOpen2(el)) {
|
|
@@ -7174,25 +7189,25 @@ function ViewMenu({
|
|
|
7174
7189
|
footer,
|
|
7175
7190
|
className
|
|
7176
7191
|
}) {
|
|
7177
|
-
const baseId = (0,
|
|
7192
|
+
const baseId = (0, import_react52.useId)();
|
|
7178
7193
|
const densityLabelId = `${baseId}-density`;
|
|
7179
7194
|
const zebraLabelId = `${baseId}-zebra`;
|
|
7180
7195
|
const freezeLabelId = `${baseId}-freeze`;
|
|
7181
7196
|
const columnsLabelId = `${baseId}-columns`;
|
|
7182
7197
|
const labels = { ...VIEW_MENU_COLUMN_LABELS, ...columnLabels };
|
|
7183
7198
|
const list = columns ?? [];
|
|
7184
|
-
const [draft, setDraft] = (0,
|
|
7185
|
-
const [announcement, setAnnouncement] = (0,
|
|
7186
|
-
const dragStart = (0,
|
|
7187
|
-
const listRef = (0,
|
|
7188
|
-
const triggers = (0,
|
|
7189
|
-
const refocus = (0,
|
|
7199
|
+
const [draft, setDraft] = (0, import_react52.useState)(null);
|
|
7200
|
+
const [announcement, setAnnouncement] = (0, import_react52.useState)("");
|
|
7201
|
+
const dragStart = (0, import_react52.useRef)(null);
|
|
7202
|
+
const listRef = (0, import_react52.useRef)(null);
|
|
7203
|
+
const triggers = (0, import_react52.useRef)(/* @__PURE__ */ new Map());
|
|
7204
|
+
const refocus = (0, import_react52.useRef)(null);
|
|
7190
7205
|
const orderKey = JSON.stringify(list.map((column) => column.id));
|
|
7191
|
-
(0,
|
|
7206
|
+
(0, import_react52.useEffect)(() => setDraft(null), [orderKey]);
|
|
7192
7207
|
const order = draft ?? list.map((column) => column.id);
|
|
7193
7208
|
const byId = new Map(list.map((column) => [column.id, column]));
|
|
7194
7209
|
const ordered = order.map((id) => byId.get(id)).filter((column) => !!column);
|
|
7195
|
-
(0,
|
|
7210
|
+
(0, import_react52.useEffect)(() => {
|
|
7196
7211
|
const target = refocus.current;
|
|
7197
7212
|
refocus.current = null;
|
|
7198
7213
|
if (!target) return;
|
|
@@ -7314,7 +7329,7 @@ function ViewMenu({
|
|
|
7314
7329
|
] });
|
|
7315
7330
|
}
|
|
7316
7331
|
function FilterPopover({ label, type = "text", value, onValueChange, options, applyLabel, clearLabel, onApply, onClear, placeholder }) {
|
|
7317
|
-
const controlId = (0,
|
|
7332
|
+
const controlId = (0, import_react52.useId)();
|
|
7318
7333
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uix-filter-popover", children: [
|
|
7319
7334
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uix-field", children: [
|
|
7320
7335
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("label", { className: "uix-field__label", htmlFor: controlId, children: label }),
|
|
@@ -7337,11 +7352,11 @@ function dropIndex(rows, dragged, clientY) {
|
|
|
7337
7352
|
return index;
|
|
7338
7353
|
}
|
|
7339
7354
|
function useRowDrag(rowSelector, handlers) {
|
|
7340
|
-
const [dragging, setDragging] = (0,
|
|
7341
|
-
const drag = (0,
|
|
7342
|
-
const latest = (0,
|
|
7355
|
+
const [dragging, setDragging] = (0, import_react52.useState)(null);
|
|
7356
|
+
const drag = (0, import_react52.useRef)(null);
|
|
7357
|
+
const latest = (0, import_react52.useRef)(handlers);
|
|
7343
7358
|
latest.current = handlers;
|
|
7344
|
-
(0,
|
|
7359
|
+
(0, import_react52.useEffect)(() => {
|
|
7345
7360
|
if (!dragging) return;
|
|
7346
7361
|
const move = (event) => {
|
|
7347
7362
|
const current = drag.current;
|
|
@@ -7381,13 +7396,13 @@ function placeId(ids, id, index) {
|
|
|
7381
7396
|
return next;
|
|
7382
7397
|
}
|
|
7383
7398
|
function SavedViewMenu({ items, sections, onSelect, onPinChange, pinLabel, unpinLabel, onReorder, reorderLabel, emptyLabel, actions, footer }) {
|
|
7384
|
-
const baseId = (0,
|
|
7399
|
+
const baseId = (0, import_react52.useId)();
|
|
7385
7400
|
const groups = sections ?? [{ id: void 0, items: items ?? [] }];
|
|
7386
|
-
const [draft, setDraft] = (0,
|
|
7387
|
-
const dragStart = (0,
|
|
7388
|
-
const dragGroup = (0,
|
|
7401
|
+
const [draft, setDraft] = (0, import_react52.useState)(null);
|
|
7402
|
+
const dragStart = (0, import_react52.useRef)(null);
|
|
7403
|
+
const dragGroup = (0, import_react52.useRef)(void 0);
|
|
7389
7404
|
const orderKey = JSON.stringify(groups.map((group) => [group.id, group.items.map((item) => item.id)]));
|
|
7390
|
-
(0,
|
|
7405
|
+
(0, import_react52.useEffect)(() => setDraft(null), [orderKey]);
|
|
7391
7406
|
const orderOf = (group) => draft && draft.group === group.id ? draft.ids : group.items.map((item) => item.id);
|
|
7392
7407
|
const move = (group, id, delta) => {
|
|
7393
7408
|
const current = orderOf(group);
|
|
@@ -7464,7 +7479,7 @@ function SavedViewMenu({ items, sections, onSelect, onPinChange, pinLabel, unpin
|
|
|
7464
7479
|
}
|
|
7465
7480
|
|
|
7466
7481
|
// src/components/FilterEditor.tsx
|
|
7467
|
-
var
|
|
7482
|
+
var import_react53 = require("react");
|
|
7468
7483
|
|
|
7469
7484
|
// src/filter-model.ts
|
|
7470
7485
|
var DEFAULT_FILTER_SUMMARY_LABELS = {
|
|
@@ -7608,7 +7623,7 @@ function FilterEditor({ field, value: valueProp, onValueChange, onApply, onClear
|
|
|
7608
7623
|
...labelOverrides,
|
|
7609
7624
|
operators: { ...DEFAULT_FILTER_EDITOR_LABELS.operators, ...provided?.operators, ...labelOverrides?.operators }
|
|
7610
7625
|
};
|
|
7611
|
-
const id = (0,
|
|
7626
|
+
const id = (0, import_react53.useId)();
|
|
7612
7627
|
const value = valueProp?.kind === field.kind ? valueProp : emptyFilterValue(field.kind);
|
|
7613
7628
|
let body = null;
|
|
7614
7629
|
switch (value.kind) {
|
|
@@ -7674,9 +7689,9 @@ function FilterEditor({ field, value: valueProp, onValueChange, onApply, onClear
|
|
|
7674
7689
|
] });
|
|
7675
7690
|
}
|
|
7676
7691
|
function EnumBody({ field, value, onChange, labels, threshold }) {
|
|
7677
|
-
const [query, setQuery] = (0,
|
|
7692
|
+
const [query, setQuery] = (0, import_react53.useState)("");
|
|
7678
7693
|
const options = field.options ?? [];
|
|
7679
|
-
const shown = (0,
|
|
7694
|
+
const shown = (0, import_react53.useMemo)(() => {
|
|
7680
7695
|
const q = foldForSearch(query.trim()).text;
|
|
7681
7696
|
return q ? options.filter((o) => foldForSearch(o.label).text.includes(q)) : options;
|
|
7682
7697
|
}, [options, query]);
|
|
@@ -7696,11 +7711,11 @@ function EnumBody({ field, value, onChange, labels, threshold }) {
|
|
|
7696
7711
|
] });
|
|
7697
7712
|
}
|
|
7698
7713
|
function ReferenceBody({ field, value, onChange, labels, delay }) {
|
|
7699
|
-
const [query, setQuery] = (0,
|
|
7700
|
-
const [state, setState] = (0,
|
|
7701
|
-
const [attempt, setAttempt] = (0,
|
|
7702
|
-
const latest = (0,
|
|
7703
|
-
(0,
|
|
7714
|
+
const [query, setQuery] = (0, import_react53.useState)("");
|
|
7715
|
+
const [state, setState] = (0, import_react53.useState)({ status: "idle", results: [] });
|
|
7716
|
+
const [attempt, setAttempt] = (0, import_react53.useState)(0);
|
|
7717
|
+
const latest = (0, import_react53.useRef)(0);
|
|
7718
|
+
(0, import_react53.useEffect)(() => {
|
|
7704
7719
|
if (!field.onSearch) return;
|
|
7705
7720
|
const run = ++latest.current;
|
|
7706
7721
|
const timer = window.setTimeout(() => {
|
|
@@ -7753,10 +7768,10 @@ function TimelineItem({ node, meta, children, className, ...props }) {
|
|
|
7753
7768
|
}
|
|
7754
7769
|
|
|
7755
7770
|
// src/components/Pipeline.tsx
|
|
7756
|
-
var
|
|
7771
|
+
var import_react54 = require("react");
|
|
7757
7772
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
7758
7773
|
function Pipeline({ detailed = false, children, className, tabIndex, ...props }) {
|
|
7759
|
-
const stages = detailed ?
|
|
7774
|
+
const stages = detailed ? import_react54.Children.map(children, (child) => (0, import_react54.isValidElement)(child) && child.type === PipelineStage ? (0, import_react54.cloneElement)(child, { detailed: child.props.detailed ?? true }) : child) : children;
|
|
7760
7775
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
7761
7776
|
"ol",
|
|
7762
7777
|
{
|
|
@@ -7872,10 +7887,10 @@ function Note({ tone, icon, children, className, ...props }) {
|
|
|
7872
7887
|
}
|
|
7873
7888
|
|
|
7874
7889
|
// src/components/Menu.tsx
|
|
7875
|
-
var
|
|
7890
|
+
var import_react55 = require("react");
|
|
7876
7891
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
7877
|
-
var MenuContext = (0,
|
|
7878
|
-
var MenuRadioContext = (0,
|
|
7892
|
+
var MenuContext = (0, import_react55.createContext)(null);
|
|
7893
|
+
var MenuRadioContext = (0, import_react55.createContext)(null);
|
|
7879
7894
|
var ITEM = '[role^="menuitem"]:not([aria-disabled="true"])';
|
|
7880
7895
|
var itemAttributes = (rest) => {
|
|
7881
7896
|
const out = {};
|
|
@@ -7883,14 +7898,14 @@ var itemAttributes = (rest) => {
|
|
|
7883
7898
|
return out;
|
|
7884
7899
|
};
|
|
7885
7900
|
function Menu({ trigger, children, open: controlledOpen, defaultOpen = false, onOpenChange, label, placement = "bottom-start", className }) {
|
|
7886
|
-
const id = (0,
|
|
7901
|
+
const id = (0, import_react55.useId)();
|
|
7887
7902
|
const menuId = `${id}-menu`;
|
|
7888
7903
|
const triggerId = `${id}-trigger`;
|
|
7889
|
-
const triggerRef = (0,
|
|
7890
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
7904
|
+
const triggerRef = (0, import_react55.useRef)(null);
|
|
7905
|
+
const [internalOpen, setInternalOpen] = (0, import_react55.useState)(defaultOpen);
|
|
7891
7906
|
const open = controlledOpen ?? internalOpen;
|
|
7892
|
-
const focusOnOpen = (0,
|
|
7893
|
-
const typeahead2 = (0,
|
|
7907
|
+
const focusOnOpen = (0, import_react55.useRef)("first");
|
|
7908
|
+
const typeahead2 = (0, import_react55.useRef)({ text: "", at: 0 });
|
|
7894
7909
|
const setOpen = (next) => {
|
|
7895
7910
|
if (controlledOpen === void 0) setInternalOpen(next);
|
|
7896
7911
|
onOpenChange?.(next);
|
|
@@ -7901,7 +7916,7 @@ function Menu({ trigger, children, open: controlledOpen, defaultOpen = false, on
|
|
|
7901
7916
|
setOpen(false);
|
|
7902
7917
|
if (refocus) triggerRef.current?.focus();
|
|
7903
7918
|
};
|
|
7904
|
-
(0,
|
|
7919
|
+
(0, import_react55.useEffect)(() => {
|
|
7905
7920
|
const el = menu();
|
|
7906
7921
|
if (!el) return;
|
|
7907
7922
|
const shown = () => {
|
|
@@ -7961,8 +7976,8 @@ function Menu({ trigger, children, open: controlledOpen, defaultOpen = false, on
|
|
|
7961
7976
|
order.find((item) => (item.textContent ?? "").trim().toLowerCase().startsWith(typeahead2.current.text))?.focus();
|
|
7962
7977
|
}
|
|
7963
7978
|
};
|
|
7964
|
-
const triggerProps = (0,
|
|
7965
|
-
const triggerElement = (0,
|
|
7979
|
+
const triggerProps = (0, import_react55.isValidElement)(trigger) ? trigger.props : {};
|
|
7980
|
+
const triggerElement = (0, import_react55.isValidElement)(trigger) ? (0, import_react55.cloneElement)(trigger, {
|
|
7966
7981
|
ref: (node) => {
|
|
7967
7982
|
triggerRef.current = node;
|
|
7968
7983
|
},
|
|
@@ -8016,7 +8031,7 @@ function Menu({ trigger, children, open: controlledOpen, defaultOpen = false, on
|
|
|
8016
8031
|
] });
|
|
8017
8032
|
}
|
|
8018
8033
|
function MenuItem({ children, onSelect, href, renderLink, icon, shortcut, tone = "default", disabled, className, ...rest }) {
|
|
8019
|
-
const menu = (0,
|
|
8034
|
+
const menu = (0, import_react55.useContext)(MenuContext);
|
|
8020
8035
|
const classes = cx("uix-menu__item", tone === "danger" && "uix-menu__item--danger", className);
|
|
8021
8036
|
const attributes = itemAttributes(rest);
|
|
8022
8037
|
const body = /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_jsx_runtime79.Fragment, { children: [
|
|
@@ -8057,7 +8072,7 @@ function CheckableItem({
|
|
|
8057
8072
|
className,
|
|
8058
8073
|
...rest
|
|
8059
8074
|
}) {
|
|
8060
|
-
const menu = (0,
|
|
8075
|
+
const menu = (0, import_react55.useContext)(MenuContext);
|
|
8061
8076
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
|
|
8062
8077
|
"button",
|
|
8063
8078
|
{
|
|
@@ -8091,14 +8106,14 @@ function CheckableItem({
|
|
|
8091
8106
|
);
|
|
8092
8107
|
}
|
|
8093
8108
|
function MenuRadioGroup({ value, onValueChange, label, "aria-label": ariaLabel, children }) {
|
|
8094
|
-
const id = (0,
|
|
8109
|
+
const id = (0, import_react55.useId)();
|
|
8095
8110
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(MenuRadioContext.Provider, { value: { value, onValueChange }, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { role: "group", "aria-labelledby": label != null ? id : void 0, "aria-label": label != null ? void 0 : ariaLabel, children: [
|
|
8096
8111
|
label != null && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { id, className: "uix-menu__label", children: label }),
|
|
8097
8112
|
children
|
|
8098
8113
|
] }) });
|
|
8099
8114
|
}
|
|
8100
8115
|
function MenuItemRadio({ value, checked, onSelect, closeOnSelect = true, ...rest }) {
|
|
8101
|
-
const group = (0,
|
|
8116
|
+
const group = (0, import_react55.useContext)(MenuRadioContext);
|
|
8102
8117
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
8103
8118
|
CheckableItem,
|
|
8104
8119
|
{
|
|
@@ -8126,7 +8141,7 @@ function MenuItemCheckbox({ checked, onCheckedChange, closeOnSelect = false, ...
|
|
|
8126
8141
|
);
|
|
8127
8142
|
}
|
|
8128
8143
|
function MenuGroup({ label, children }) {
|
|
8129
|
-
const id = (0,
|
|
8144
|
+
const id = (0, import_react55.useId)();
|
|
8130
8145
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { role: "group", "aria-labelledby": id, children: [
|
|
8131
8146
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { id, className: "uix-menu__label", children: label }),
|
|
8132
8147
|
children
|
|
@@ -8137,33 +8152,33 @@ function MenuSeparator() {
|
|
|
8137
8152
|
}
|
|
8138
8153
|
|
|
8139
8154
|
// src/components/CommandPalette.tsx
|
|
8140
|
-
var
|
|
8155
|
+
var import_react56 = require("react");
|
|
8141
8156
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
8142
|
-
var CmdkContext = (0,
|
|
8157
|
+
var CmdkContext = (0, import_react56.createContext)(null);
|
|
8143
8158
|
function CommandPalette({ inputProps, children, inputLabel: inputLabelProp, resultsLabel, className, ...props }) {
|
|
8144
8159
|
const uixLabels = useUixLabels();
|
|
8145
8160
|
const inputLabel = inputLabelProp ?? uixLabels.commandPalette?.input ?? "Command palette";
|
|
8146
8161
|
const resultsOne = uixLabels.commandPalette?.resultsOne ?? "{count} result";
|
|
8147
8162
|
const resultsMany = uixLabels.commandPalette?.resultsMany ?? "{count} results";
|
|
8148
8163
|
const resultsText = (count3) => resultsLabel?.(count3) ?? fillLabel(count3 === 1 ? resultsOne : resultsMany, { count: count3 });
|
|
8149
|
-
const resultsTextRef = (0,
|
|
8164
|
+
const resultsTextRef = (0, import_react56.useRef)(resultsText);
|
|
8150
8165
|
resultsTextRef.current = resultsText;
|
|
8151
|
-
const listId = (0,
|
|
8152
|
-
const [activeId, setActiveId] = (0,
|
|
8153
|
-
const [count2, setCount] = (0,
|
|
8154
|
-
const [announced, setAnnounced] = (0,
|
|
8155
|
-
const setActive = (0,
|
|
8166
|
+
const listId = (0, import_react56.useId)();
|
|
8167
|
+
const [activeId, setActiveId] = (0, import_react56.useState)(null);
|
|
8168
|
+
const [count2, setCount] = (0, import_react56.useState)(0);
|
|
8169
|
+
const [announced, setAnnounced] = (0, import_react56.useState)("");
|
|
8170
|
+
const setActive = (0, import_react56.useCallback)((id, active) => {
|
|
8156
8171
|
setActiveId((cur) => active ? id : cur === id ? null : cur);
|
|
8157
8172
|
}, []);
|
|
8158
|
-
const registerItem = (0,
|
|
8173
|
+
const registerItem = (0, import_react56.useCallback)(() => {
|
|
8159
8174
|
setCount((c) => c + 1);
|
|
8160
8175
|
return () => setCount((c) => c - 1);
|
|
8161
8176
|
}, []);
|
|
8162
|
-
(0,
|
|
8177
|
+
(0, import_react56.useEffect)(() => {
|
|
8163
8178
|
const t = window.setTimeout(() => setAnnounced(resultsTextRef.current(count2)), 150);
|
|
8164
8179
|
return () => clearTimeout(t);
|
|
8165
8180
|
}, [count2]);
|
|
8166
|
-
const ctx = (0,
|
|
8181
|
+
const ctx = (0, import_react56.useMemo)(() => ({ listId, setActive, registerItem }), [listId, setActive, registerItem]);
|
|
8167
8182
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(CmdkContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: cx("uix-cmdk", className), ...props, children: [
|
|
8168
8183
|
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
8169
8184
|
"input",
|
|
@@ -8183,18 +8198,18 @@ function CommandPalette({ inputProps, children, inputLabel: inputLabelProp, resu
|
|
|
8183
8198
|
] }) });
|
|
8184
8199
|
}
|
|
8185
8200
|
function CommandGroup({ label, children }) {
|
|
8186
|
-
const labelId = (0,
|
|
8201
|
+
const labelId = (0, import_react56.useId)();
|
|
8187
8202
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { role: "group", "aria-labelledby": label != null ? labelId : void 0, children: [
|
|
8188
8203
|
label != null && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "uix-cmdk__group", id: labelId, children: label }),
|
|
8189
8204
|
children
|
|
8190
8205
|
] });
|
|
8191
8206
|
}
|
|
8192
8207
|
function CommandItem({ icon, shortcut, active, children, className, id, ...props }) {
|
|
8193
|
-
const ctx = (0,
|
|
8194
|
-
const autoId = (0,
|
|
8208
|
+
const ctx = (0, import_react56.useContext)(CmdkContext);
|
|
8209
|
+
const autoId = (0, import_react56.useId)();
|
|
8195
8210
|
const itemId = id ?? autoId;
|
|
8196
|
-
(0,
|
|
8197
|
-
(0,
|
|
8211
|
+
(0, import_react56.useEffect)(() => ctx?.registerItem(), [ctx]);
|
|
8212
|
+
(0, import_react56.useEffect)(() => {
|
|
8198
8213
|
if (!ctx || !active) return;
|
|
8199
8214
|
ctx.setActive(itemId, true);
|
|
8200
8215
|
return () => ctx.setActive(itemId, false);
|
|
@@ -8218,16 +8233,16 @@ function CommandItem({ icon, shortcut, active, children, className, id, ...props
|
|
|
8218
8233
|
}
|
|
8219
8234
|
|
|
8220
8235
|
// src/components/Inbox.tsx
|
|
8221
|
-
var
|
|
8236
|
+
var import_react57 = require("react");
|
|
8222
8237
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
8223
8238
|
function Inbox({ view, children, className, ...props }) {
|
|
8224
8239
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: cx("uix-inbox", className), "data-view": view, ...props, children });
|
|
8225
8240
|
}
|
|
8226
|
-
var InboxListCtx = (0,
|
|
8241
|
+
var InboxListCtx = (0, import_react57.createContext)({});
|
|
8227
8242
|
function InboxList({ children, listLabel = "Inbox", className, ...props }) {
|
|
8228
|
-
const listRef = (0,
|
|
8229
|
-
const [activeId, setActiveId] = (0,
|
|
8230
|
-
const ctx = (0,
|
|
8243
|
+
const listRef = (0, import_react57.useRef)(null);
|
|
8244
|
+
const [activeId, setActiveId] = (0, import_react57.useState)(void 0);
|
|
8245
|
+
const ctx = (0, import_react57.useMemo)(() => ({ activeId }), [activeId]);
|
|
8231
8246
|
const onKeyDown = (e) => {
|
|
8232
8247
|
const opts = Array.from(listRef.current?.querySelectorAll('[role="option"]') ?? []);
|
|
8233
8248
|
if (opts.length === 0) return;
|
|
@@ -8288,9 +8303,9 @@ function InboxItem({
|
|
|
8288
8303
|
id,
|
|
8289
8304
|
...props
|
|
8290
8305
|
}) {
|
|
8291
|
-
const autoId = (0,
|
|
8306
|
+
const autoId = (0, import_react57.useId)();
|
|
8292
8307
|
const itemId = id ?? autoId;
|
|
8293
|
-
const { activeId } = (0,
|
|
8308
|
+
const { activeId } = (0, import_react57.useContext)(InboxListCtx);
|
|
8294
8309
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
8295
8310
|
"div",
|
|
8296
8311
|
{
|
|
@@ -8315,7 +8330,7 @@ function InboxDetail({ children, className, ...props }) {
|
|
|
8315
8330
|
}
|
|
8316
8331
|
|
|
8317
8332
|
// src/components/Kanban.tsx
|
|
8318
|
-
var
|
|
8333
|
+
var import_react58 = require("react");
|
|
8319
8334
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
8320
8335
|
function Kanban({ announcement, children, className, ...props }) {
|
|
8321
8336
|
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: cx("uix-kanban", className), ...props, children: [
|
|
@@ -8324,7 +8339,7 @@ function Kanban({ announcement, children, className, ...props }) {
|
|
|
8324
8339
|
] });
|
|
8325
8340
|
}
|
|
8326
8341
|
function KanbanColumn({ title, count: count2, children, className, ...props }) {
|
|
8327
|
-
const headId = (0,
|
|
8342
|
+
const headId = (0, import_react58.useId)();
|
|
8328
8343
|
const hasHead = title != null || count2 != null;
|
|
8329
8344
|
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: cx("uix-kanban__col", className), ...props, children: [
|
|
8330
8345
|
hasHead && /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "uix-kanban__head", id: headId, children: [
|
|
@@ -8368,7 +8383,7 @@ function KanbanCard({ title, meta, children, className, onMove, onKeyDown, ...pr
|
|
|
8368
8383
|
}
|
|
8369
8384
|
|
|
8370
8385
|
// src/components/Tree.tsx
|
|
8371
|
-
var
|
|
8386
|
+
var import_react59 = require("react");
|
|
8372
8387
|
|
|
8373
8388
|
// src/tree-model.ts
|
|
8374
8389
|
function flattenTree(nodes, expanded, level = 1) {
|
|
@@ -8522,22 +8537,22 @@ function Tree({
|
|
|
8522
8537
|
className,
|
|
8523
8538
|
...props
|
|
8524
8539
|
}) {
|
|
8525
|
-
const [internalExpanded, setInternalExpanded] = (0,
|
|
8540
|
+
const [internalExpanded, setInternalExpanded] = (0, import_react59.useState)(defaultExpanded ?? /* @__PURE__ */ new Set());
|
|
8526
8541
|
const expanded = controlledExpanded ?? internalExpanded;
|
|
8527
|
-
const rootRef = (0,
|
|
8528
|
-
const [focusedId, setFocusedId] = (0,
|
|
8542
|
+
const rootRef = (0, import_react59.useRef)(null);
|
|
8543
|
+
const [focusedId, setFocusedId] = (0, import_react59.useState)(void 0);
|
|
8529
8544
|
const selectable = selected !== void 0 || onSelectProp != null;
|
|
8530
8545
|
const rowToggles = toggleOnRowClick ?? !selectable;
|
|
8531
8546
|
const labels = { ...DEFAULT_TREE_LABELS, ...useUixLabels().tree, ...labelOverrides };
|
|
8532
|
-
const treeId = (0,
|
|
8533
|
-
const [loaded, setLoaded] = (0,
|
|
8534
|
-
const [failed, setFailed] = (0,
|
|
8535
|
-
const [loading, setLoading] = (0,
|
|
8536
|
-
const inFlight = (0,
|
|
8537
|
-
const loadRef = (0,
|
|
8547
|
+
const treeId = (0, import_react59.useId)();
|
|
8548
|
+
const [loaded, setLoaded] = (0, import_react59.useState)(() => /* @__PURE__ */ new Map());
|
|
8549
|
+
const [failed, setFailed] = (0, import_react59.useState)(() => /* @__PURE__ */ new Set());
|
|
8550
|
+
const [loading, setLoading] = (0, import_react59.useState)(() => /* @__PURE__ */ new Set());
|
|
8551
|
+
const inFlight = (0, import_react59.useRef)(/* @__PURE__ */ new Set());
|
|
8552
|
+
const loadRef = (0, import_react59.useRef)(loadChildren);
|
|
8538
8553
|
loadRef.current = loadChildren;
|
|
8539
|
-
const refocus = (0,
|
|
8540
|
-
const nodes = (0,
|
|
8554
|
+
const refocus = (0, import_react59.useRef)(null);
|
|
8555
|
+
const nodes = (0, import_react59.useMemo)(() => {
|
|
8541
8556
|
const row = (parent, kind) => ({
|
|
8542
8557
|
id: parent.id + (kind === "error" ? FAILED : LOADING),
|
|
8543
8558
|
typeaheadLabel: "",
|
|
@@ -8560,7 +8575,7 @@ function Tree({
|
|
|
8560
8575
|
return !!n.hasChildren || !!n.children?.some(lazy);
|
|
8561
8576
|
}) ? decorate(nodesProp) : nodesProp;
|
|
8562
8577
|
}, [nodesProp, loaded, failed, loadChildren, labels.error, labels.retry, labels.loading]);
|
|
8563
|
-
const load = (0,
|
|
8578
|
+
const load = (0, import_react59.useCallback)((node) => {
|
|
8564
8579
|
const run = loadRef.current;
|
|
8565
8580
|
if (!run || inFlight.current.has(node.id)) return;
|
|
8566
8581
|
inFlight.current.add(node.id);
|
|
@@ -8587,7 +8602,7 @@ function Tree({
|
|
|
8587
8602
|
() => settle2(() => setFailed((prev) => new Set(prev).add(node.id)), node.id + FAILED)
|
|
8588
8603
|
);
|
|
8589
8604
|
}, []);
|
|
8590
|
-
(0,
|
|
8605
|
+
(0, import_react59.useEffect)(() => {
|
|
8591
8606
|
if (!loadChildren) return;
|
|
8592
8607
|
const visit = (list) => {
|
|
8593
8608
|
for (const node of list) {
|
|
@@ -8598,7 +8613,7 @@ function Tree({
|
|
|
8598
8613
|
};
|
|
8599
8614
|
visit(nodesProp);
|
|
8600
8615
|
}, [nodesProp, expanded, loaded, failed, loadChildren, load]);
|
|
8601
|
-
(0,
|
|
8616
|
+
(0, import_react59.useEffect)(() => {
|
|
8602
8617
|
const id = refocus.current;
|
|
8603
8618
|
if (id == null) return;
|
|
8604
8619
|
refocus.current = null;
|
|
@@ -8631,7 +8646,7 @@ function Tree({
|
|
|
8631
8646
|
load(parent);
|
|
8632
8647
|
};
|
|
8633
8648
|
const onSelect = selectable || loadChildren ? handleSelect : void 0;
|
|
8634
|
-
const handleToggle = (0,
|
|
8649
|
+
const handleToggle = (0, import_react59.useCallback)((id) => {
|
|
8635
8650
|
if (!controlledExpanded) {
|
|
8636
8651
|
setInternalExpanded((prev) => {
|
|
8637
8652
|
const next = new Set(prev);
|
|
@@ -8642,7 +8657,7 @@ function Tree({
|
|
|
8642
8657
|
}
|
|
8643
8658
|
onToggle?.(id);
|
|
8644
8659
|
}, [controlledExpanded, onToggle]);
|
|
8645
|
-
const flat = (0,
|
|
8660
|
+
const flat = (0, import_react59.useMemo)(() => flattenTree(nodes, expanded), [nodes, expanded]);
|
|
8646
8661
|
const useVirtual = virtualize ?? shouldVirtualize(flat.length);
|
|
8647
8662
|
const tabbableId = focusedId ?? selected ?? nodes[0]?.id;
|
|
8648
8663
|
if (useVirtual) {
|
|
@@ -8761,14 +8776,14 @@ function VirtualTreeView({
|
|
|
8761
8776
|
className,
|
|
8762
8777
|
...props
|
|
8763
8778
|
}) {
|
|
8764
|
-
const scrollRef = (0,
|
|
8765
|
-
const [scrollTop, setScrollTop] = (0,
|
|
8766
|
-
const pendingFocus = (0,
|
|
8767
|
-
const hadFocus = (0,
|
|
8779
|
+
const scrollRef = (0, import_react59.useRef)(null);
|
|
8780
|
+
const [scrollTop, setScrollTop] = (0, import_react59.useState)(0);
|
|
8781
|
+
const pendingFocus = (0, import_react59.useRef)(false);
|
|
8782
|
+
const hadFocus = (0, import_react59.useRef)(false);
|
|
8768
8783
|
const win = virtualWindow(scrollTop, maxHeight, rowHeight, flat.length);
|
|
8769
8784
|
const rows = flat.slice(win.start, win.end);
|
|
8770
8785
|
const windowHasTabbable = tabbableId != null && rows.some((f) => f.node.id === tabbableId);
|
|
8771
|
-
(0,
|
|
8786
|
+
(0, import_react59.useEffect)(() => {
|
|
8772
8787
|
if (!pendingFocus.current || focusedId == null) return;
|
|
8773
8788
|
const el = scrollRef.current?.querySelector(`[role="treeitem"][data-id="${CSS.escape(focusedId)}"]`);
|
|
8774
8789
|
if (el) {
|
|
@@ -8776,7 +8791,7 @@ function VirtualTreeView({
|
|
|
8776
8791
|
pendingFocus.current = false;
|
|
8777
8792
|
}
|
|
8778
8793
|
}, [focusedId, win.start, win.end]);
|
|
8779
|
-
(0,
|
|
8794
|
+
(0, import_react59.useEffect)(() => {
|
|
8780
8795
|
if (!hadFocus.current || pendingFocus.current) return;
|
|
8781
8796
|
const active = document.activeElement;
|
|
8782
8797
|
if (active === document.body || active == null) scrollRef.current?.focus({ preventScroll: true });
|
|
@@ -9457,7 +9472,7 @@ function RuleBuilder({
|
|
|
9457
9472
|
}
|
|
9458
9473
|
|
|
9459
9474
|
// src/components/BuilderCanvas.tsx
|
|
9460
|
-
var
|
|
9475
|
+
var import_react60 = require("react");
|
|
9461
9476
|
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
9462
9477
|
var DEFAULT_BUILDER_CANVAS_LABELS = {
|
|
9463
9478
|
region: "Builder canvas",
|
|
@@ -9497,13 +9512,13 @@ function BuilderCanvas({
|
|
|
9497
9512
|
labels: labelOverrides
|
|
9498
9513
|
}) {
|
|
9499
9514
|
const labels = { ...DEFAULT_BUILDER_CANVAS_LABELS, ...labelOverrides };
|
|
9500
|
-
const [internalSelectedId, setInternalSelectedId] = (0,
|
|
9501
|
-
const [draggedId, setDraggedId] = (0,
|
|
9502
|
-
const propertyHeadingRef = (0,
|
|
9503
|
-
const shouldFocusProperties = (0,
|
|
9515
|
+
const [internalSelectedId, setInternalSelectedId] = (0, import_react60.useState)();
|
|
9516
|
+
const [draggedId, setDraggedId] = (0, import_react60.useState)();
|
|
9517
|
+
const propertyHeadingRef = (0, import_react60.useRef)(null);
|
|
9518
|
+
const shouldFocusProperties = (0, import_react60.useRef)(false);
|
|
9504
9519
|
const selectedId = controlledSelectedId ?? internalSelectedId;
|
|
9505
9520
|
const selected = items.find((item) => item.id === selectedId);
|
|
9506
|
-
(0,
|
|
9521
|
+
(0, import_react60.useEffect)(() => {
|
|
9507
9522
|
if (shouldFocusProperties.current && selected) {
|
|
9508
9523
|
propertyHeadingRef.current?.focus();
|
|
9509
9524
|
shouldFocusProperties.current = false;
|
|
@@ -9591,7 +9606,7 @@ function BuilderCanvas({
|
|
|
9591
9606
|
}
|
|
9592
9607
|
|
|
9593
9608
|
// src/components/SchedulingCalendar.tsx
|
|
9594
|
-
var
|
|
9609
|
+
var import_react64 = require("react");
|
|
9595
9610
|
|
|
9596
9611
|
// src/calendar-model.ts
|
|
9597
9612
|
function fromDateKey(value) {
|
|
@@ -10019,14 +10034,14 @@ function proposeMove(span, delta, timeZone) {
|
|
|
10019
10034
|
}
|
|
10020
10035
|
|
|
10021
10036
|
// src/components/SchedulingAgenda.tsx
|
|
10022
|
-
var
|
|
10037
|
+
var import_react62 = require("react");
|
|
10023
10038
|
|
|
10024
10039
|
// src/hooks/usePrinting.ts
|
|
10025
|
-
var
|
|
10040
|
+
var import_react61 = require("react");
|
|
10026
10041
|
var import_react_dom = require("react-dom");
|
|
10027
10042
|
function usePrinting(enabled = true) {
|
|
10028
|
-
const [printing, setPrinting] = (0,
|
|
10029
|
-
(0,
|
|
10043
|
+
const [printing, setPrinting] = (0, import_react61.useState)(false);
|
|
10044
|
+
(0, import_react61.useEffect)(() => {
|
|
10030
10045
|
if (!enabled || typeof window === "undefined") return void 0;
|
|
10031
10046
|
const set = (next) => {
|
|
10032
10047
|
(0, import_react_dom.flushSync)(() => setPrinting(next));
|
|
@@ -10101,11 +10116,11 @@ function AgendaBody({
|
|
|
10101
10116
|
if ((group.continuesCount ?? 0) > 0) flatRows.push({ kind: "continues", key: `c-${groupKey}`, group });
|
|
10102
10117
|
});
|
|
10103
10118
|
}
|
|
10104
|
-
const [narrow, setNarrow] = (0,
|
|
10119
|
+
const [narrow, setNarrow] = (0, import_react62.useState)(false);
|
|
10105
10120
|
const printing = usePrinting(flat);
|
|
10106
10121
|
const virtual = useVirtualRows(flatRows, { rowHeight: narrow ? AGENDA_NARROW_ROW : AGENDA_VIRTUAL_ROW, threshold: 0, estimatedViewportHeight: AGENDA_VIRTUAL_VIEWPORT, enabled: !printing });
|
|
10107
10122
|
const scroller = virtual.containerRef;
|
|
10108
|
-
(0,
|
|
10123
|
+
(0, import_react62.useLayoutEffect)(() => {
|
|
10109
10124
|
const box = scroller.current;
|
|
10110
10125
|
if (!box) return;
|
|
10111
10126
|
const measure = () => setNarrow(box.clientWidth > 0 && box.clientWidth <= AGENDA_NARROW_WIDTH);
|
|
@@ -10114,8 +10129,8 @@ function AgendaBody({
|
|
|
10114
10129
|
observer.observe(box);
|
|
10115
10130
|
return () => observer.disconnect();
|
|
10116
10131
|
}, [scroller]);
|
|
10117
|
-
const grouped = (0,
|
|
10118
|
-
(0,
|
|
10132
|
+
const grouped = (0, import_react62.useRef)(null);
|
|
10133
|
+
(0, import_react62.useLayoutEffect)(() => {
|
|
10119
10134
|
const box = grouped.current;
|
|
10120
10135
|
if (!box) return;
|
|
10121
10136
|
const observer = new ResizeObserver((entries) => {
|
|
@@ -10127,7 +10142,7 @@ function AgendaBody({
|
|
|
10127
10142
|
box.querySelectorAll(":scope > section > .uix-scheduling-calendar__agenda-head").forEach((head) => observer.observe(head));
|
|
10128
10143
|
return () => observer.disconnect();
|
|
10129
10144
|
}, [groups]);
|
|
10130
|
-
const stop = (0,
|
|
10145
|
+
const stop = (0, import_react62.useRef)({ node: null, index: 0 });
|
|
10131
10146
|
const container = () => flat ? scroller.current : grouped.current;
|
|
10132
10147
|
const controls = () => Array.from(container()?.querySelectorAll("button") ?? []);
|
|
10133
10148
|
const focusStop = (target) => {
|
|
@@ -10152,7 +10167,7 @@ function AgendaBody({
|
|
|
10152
10167
|
const scrollToRow = (box, index) => {
|
|
10153
10168
|
box.scrollTop = Math.max(0, index * rowHeight - (box.clientHeight - rowHeight) / 2);
|
|
10154
10169
|
};
|
|
10155
|
-
const landing = (0,
|
|
10170
|
+
const landing = (0, import_react62.useRef)(null);
|
|
10156
10171
|
const land = () => {
|
|
10157
10172
|
const wanted = landing.current;
|
|
10158
10173
|
if (!wanted) return;
|
|
@@ -10173,7 +10188,7 @@ function AgendaBody({
|
|
|
10173
10188
|
scrollToRow(box, index);
|
|
10174
10189
|
}
|
|
10175
10190
|
};
|
|
10176
|
-
(0,
|
|
10191
|
+
(0, import_react62.useEffect)(() => {
|
|
10177
10192
|
const all = controls();
|
|
10178
10193
|
stop.current = syncRovingStop(all, stop.current);
|
|
10179
10194
|
const box = flat ? scroller.current : null;
|
|
@@ -10229,7 +10244,7 @@ function AgendaBody({
|
|
|
10229
10244
|
overlay.scopeLabel && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "uix-scheduling-calendar__window-scope", children: overlay.scopeLabel })
|
|
10230
10245
|
] }) });
|
|
10231
10246
|
const heading = (group, withNotes) => /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "uix-scheduling-calendar__agenda-head", children: [
|
|
10232
|
-
(0,
|
|
10247
|
+
(0, import_react62.createElement)(`h${headingLevel}`, { className: "uix-scheduling-calendar__agenda-heading" }, group.heading ?? dateText(group.date, "day")),
|
|
10233
10248
|
withNotes && group.annotations && group.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("ul", { className: "uix-scheduling-calendar__agenda-notes", children: uniqueKeys(group.annotations.map((overlay) => overlay.id)).map((key, at) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("li", { children: note(group.annotations[at]) }, key)) })
|
|
10234
10249
|
] });
|
|
10235
10250
|
const timeText = (entry, date) => {
|
|
@@ -10299,7 +10314,7 @@ function AgendaBody({
|
|
|
10299
10314
|
}
|
|
10300
10315
|
|
|
10301
10316
|
// src/components/SchedulingTimeGrid.tsx
|
|
10302
|
-
var
|
|
10317
|
+
var import_react63 = require("react");
|
|
10303
10318
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
10304
10319
|
var HOUR_MS2 = 36e5;
|
|
10305
10320
|
var MINUTES_PER_HOUR = 60;
|
|
@@ -10313,7 +10328,7 @@ function uniqueById(items) {
|
|
|
10313
10328
|
const seen = /* @__PURE__ */ new Set();
|
|
10314
10329
|
return items.filter((item) => seen.has(item.id) ? false : (seen.add(item.id), true));
|
|
10315
10330
|
}
|
|
10316
|
-
var GridItem = (0,
|
|
10331
|
+
var GridItem = (0, import_react63.memo)(function GridItem2({ entry, segment, column, alone, name, status, movable, hintId, timeZone, continuesFrom, markers, renderEntry, renderMarker: renderMarker2, handlers }) {
|
|
10317
10332
|
const lines = linesFor(segment);
|
|
10318
10333
|
const continuation = segment.part === "continuation";
|
|
10319
10334
|
const style = vars({
|
|
@@ -10398,20 +10413,20 @@ function SchedulingTimeGrid({
|
|
|
10398
10413
|
emptyNote,
|
|
10399
10414
|
nothingToShow
|
|
10400
10415
|
}) {
|
|
10401
|
-
const rootRef = (0,
|
|
10402
|
-
const hintId = (0,
|
|
10403
|
-
const [widthCap, setWidthCap] = (0,
|
|
10404
|
-
const [ghost, setGhost] = (0,
|
|
10405
|
-
const [announcement, setAnnouncement] = (0,
|
|
10406
|
-
const [activeDay, setActiveDay] = (0,
|
|
10407
|
-
const enteredFrom = (0,
|
|
10416
|
+
const rootRef = (0, import_react63.useRef)(null);
|
|
10417
|
+
const hintId = (0, import_react63.useId)();
|
|
10418
|
+
const [widthCap, setWidthCap] = (0, import_react63.useState)(Infinity);
|
|
10419
|
+
const [ghost, setGhost] = (0, import_react63.useState)(null);
|
|
10420
|
+
const [announcement, setAnnouncement] = (0, import_react63.useState)("");
|
|
10421
|
+
const [activeDay, setActiveDay] = (0, import_react63.useState)(days[0]);
|
|
10422
|
+
const enteredFrom = (0, import_react63.useRef)(null);
|
|
10408
10423
|
const tabStop = days.includes(activeDay) ? activeDay : days[0];
|
|
10409
10424
|
const moving = canMove && onProposeMove !== void 0;
|
|
10410
10425
|
const step = Number.isFinite(givenStep) && givenStep > 0 ? givenStep : DEFAULT_STEP;
|
|
10411
|
-
const laneOptions = (0,
|
|
10412
|
-
const entries = (0,
|
|
10413
|
-
const overlays = (0,
|
|
10414
|
-
(0,
|
|
10426
|
+
const laneOptions = (0, import_react63.useMemo)(() => ({ crossMidnightMinutes: topLaneCrossMidnightMinutes }), [topLaneCrossMidnightMinutes]);
|
|
10427
|
+
const entries = (0, import_react63.useMemo)(() => uniqueById(givenEntries), [givenEntries]);
|
|
10428
|
+
const overlays = (0, import_react63.useMemo)(() => uniqueById(givenOverlays), [givenOverlays]);
|
|
10429
|
+
(0, import_react63.useEffect)(() => {
|
|
10415
10430
|
const root = rootRef.current;
|
|
10416
10431
|
if (!root || typeof ResizeObserver === "undefined") return void 0;
|
|
10417
10432
|
const column = root.querySelector("[data-tg-column]");
|
|
@@ -10436,17 +10451,17 @@ function SchedulingTimeGrid({
|
|
|
10436
10451
|
};
|
|
10437
10452
|
}, [days]);
|
|
10438
10453
|
const lanes = Math.max(1, Math.min(maxLanes, widthCap));
|
|
10439
|
-
const entryById = (0,
|
|
10440
|
-
const overlayById = (0,
|
|
10441
|
-
const columns = (0,
|
|
10442
|
-
const slots = (0,
|
|
10443
|
-
const top = (0,
|
|
10444
|
-
const drawable = (0,
|
|
10445
|
-
const strip = (0,
|
|
10446
|
-
const shades = (0,
|
|
10454
|
+
const entryById = (0, import_react63.useMemo)(() => new Map(entries.map((entry) => [entry.id, entry])), [entries]);
|
|
10455
|
+
const overlayById = (0, import_react63.useMemo)(() => new Map(overlays.map((overlay) => [overlay.id, overlay])), [overlays]);
|
|
10456
|
+
const columns = (0, import_react63.useMemo)(() => days.map((date) => layoutTimeGridDay(entries, date, timeZone, { ...laneOptions, maxLanes: lanes })), [days, entries, timeZone, laneOptions, lanes]);
|
|
10457
|
+
const slots = (0, import_react63.useMemo)(() => days.map((date) => zonedHourSlots(date, timeZone)), [days, timeZone]);
|
|
10458
|
+
const top = (0, import_react63.useMemo)(() => layoutDaySpans(entries.filter((entry) => placesInTopLane(entry, timeZone, laneOptions)), days, { timeZone, laneCap: Math.max(0, topLaneCap) }), [entries, days, timeZone, laneOptions, topLaneCap]);
|
|
10459
|
+
const drawable = (0, import_react63.useMemo)(() => overlays.filter((overlay) => new Date(overlay.end).getTime() >= new Date(overlay.start).getTime()), [overlays]);
|
|
10460
|
+
const strip = (0, import_react63.useMemo)(() => layoutDaySpans(drawable, days, { timeZone, laneCap: Math.max(0, windowLaneCap) }), [drawable, days, timeZone, windowLaneCap]);
|
|
10461
|
+
const shades = (0, import_react63.useMemo)(() => layoutDaySpans(drawable.filter((overlay) => overlay.global), days, { timeZone }).placed, [drawable, days, timeZone]);
|
|
10447
10462
|
const lanesIn = (placed) => placed.reduce((max, span) => Math.max(max, span.lane + 1), 0);
|
|
10448
10463
|
const maxHours = Math.max(...columns.map((column) => column.dayHours));
|
|
10449
|
-
const gutterIndex = (0,
|
|
10464
|
+
const gutterIndex = (0, import_react63.useMemo)(() => {
|
|
10450
10465
|
const signatures = slots.map(slotSignature);
|
|
10451
10466
|
const count2 = /* @__PURE__ */ new Map();
|
|
10452
10467
|
for (const signature of signatures) count2.set(signature, (count2.get(signature) ?? 0) + 1);
|
|
@@ -10471,15 +10486,15 @@ function SchedulingTimeGrid({
|
|
|
10471
10486
|
slot.instant.getTime()
|
|
10472
10487
|
));
|
|
10473
10488
|
const movable = (entry) => moving && entry.movable !== false;
|
|
10474
|
-
const live = (0,
|
|
10489
|
+
const live = (0, import_react63.useRef)({ ghost, entryById, timeZone, step, onProposeMove, onSelectEntry, labels, formatInstant, days, columns, movable });
|
|
10475
10490
|
live.current = { ghost, entryById, timeZone, step, onProposeMove, onSelectEntry, labels, formatInstant, days, columns, movable };
|
|
10476
|
-
const dragRef = (0,
|
|
10477
|
-
const suppressClick = (0,
|
|
10478
|
-
const refocus = (0,
|
|
10479
|
-
(0,
|
|
10491
|
+
const dragRef = (0, import_react63.useRef)(null);
|
|
10492
|
+
const suppressClick = (0, import_react63.useRef)(false);
|
|
10493
|
+
const refocus = (0, import_react63.useRef)(null);
|
|
10494
|
+
(0, import_react63.useEffect)(() => {
|
|
10480
10495
|
if (ghost && !entryById.has(ghost.id)) setGhost(null);
|
|
10481
10496
|
}, [ghost, entryById]);
|
|
10482
|
-
(0,
|
|
10497
|
+
(0, import_react63.useEffect)(() => {
|
|
10483
10498
|
const id = refocus.current;
|
|
10484
10499
|
const root = rootRef.current;
|
|
10485
10500
|
if (!id || !root) return;
|
|
@@ -10496,7 +10511,7 @@ function SchedulingTimeGrid({
|
|
|
10496
10511
|
}
|
|
10497
10512
|
}
|
|
10498
10513
|
});
|
|
10499
|
-
const send = (0,
|
|
10514
|
+
const send = (0, import_react63.useCallback)((id, delta) => {
|
|
10500
10515
|
const state = live.current;
|
|
10501
10516
|
const entry = state.entryById.get(id);
|
|
10502
10517
|
if (!entry || !state.onProposeMove || !state.movable(entry) || delta.days === 0 && delta.minutes === 0) {
|
|
@@ -10511,7 +10526,7 @@ function SchedulingTimeGrid({
|
|
|
10511
10526
|
result.then(clear, clear);
|
|
10512
10527
|
} else setGhost(null);
|
|
10513
10528
|
}, []);
|
|
10514
|
-
const handlers = (0,
|
|
10529
|
+
const handlers = (0, import_react63.useMemo)(() => ({
|
|
10515
10530
|
click: (entry) => {
|
|
10516
10531
|
live.current.onSelectEntry?.(entry);
|
|
10517
10532
|
},
|
|
@@ -10634,7 +10649,7 @@ function SchedulingTimeGrid({
|
|
|
10634
10649
|
};
|
|
10635
10650
|
}
|
|
10636
10651
|
}), [send]);
|
|
10637
|
-
(0,
|
|
10652
|
+
(0, import_react63.useEffect)(() => () => {
|
|
10638
10653
|
dragRef.current?.stop();
|
|
10639
10654
|
dragRef.current = null;
|
|
10640
10655
|
}, []);
|
|
@@ -11047,27 +11062,27 @@ function SchedulingCalendar({
|
|
|
11047
11062
|
};
|
|
11048
11063
|
const stateLabel = labels.states;
|
|
11049
11064
|
const viewLabel = { month: labels.viewMonth, week: labels.viewWeek, day: labels.viewDay, agenda: labels.viewAgenda };
|
|
11050
|
-
const [internalView, setInternalView] = (0,
|
|
11065
|
+
const [internalView, setInternalView] = (0, import_react64.useState)("month");
|
|
11051
11066
|
const view = controlledView ?? internalView;
|
|
11052
|
-
const [activeDate, setActiveDate] = (0,
|
|
11053
|
-
const [expandedDates, setExpandedDates] = (0,
|
|
11067
|
+
const [activeDate, setActiveDate] = (0, import_react64.useState)(anchorDate);
|
|
11068
|
+
const [expandedDates, setExpandedDates] = (0, import_react64.useState)(() => /* @__PURE__ */ new Set());
|
|
11054
11069
|
const dateText = (date, part) => formatDate?.(date, part) ?? cachedDateTimeFormat(locale, INTL_PARTS[part]).format(utcDate(date));
|
|
11055
11070
|
const formatInstant = (instant) => formatInstantProp?.(instant) ?? `${dateText(zonedDateKey(instant, timeZone), "day")} ${zonedTimeOfDay(instant, timeZone)}`;
|
|
11056
|
-
const gridRef = (0,
|
|
11071
|
+
const gridRef = (0, import_react64.useRef)(null);
|
|
11057
11072
|
const picksGiven = dayEntries !== void 0;
|
|
11058
11073
|
const controlled = picksGiven || dayInfo !== void 0;
|
|
11059
11074
|
const countsOnly = monthDensity === "counts" && view === "month";
|
|
11060
11075
|
const fixed = controlled || maxEntriesPerDay !== void 0 && onShowMore !== void 0 || countsOnly;
|
|
11061
11076
|
const windowCap = Math.max(0, windowLaneCap ?? (fixed ? DEFAULT_LANE_CAP2 : Infinity));
|
|
11062
11077
|
const spanCap = Math.max(0, spanLaneCap ?? (fixed ? DEFAULT_LANE_CAP2 : Infinity));
|
|
11063
|
-
const visibleEntries = (0,
|
|
11064
|
-
const monthDays = (0,
|
|
11078
|
+
const visibleEntries = (0, import_react64.useMemo)(() => entries.filter((entry) => filter?.(entry) ?? true), [entries, filter]);
|
|
11079
|
+
const monthDays = (0, import_react64.useMemo)(() => buildMonthGrid(startOfMonth(anchorDate), weekStartsOn), [anchorDate, weekStartsOn]);
|
|
11065
11080
|
const weekday = (utcDate(anchorDate).getUTCDay() - weekStartsOn + 7) % 7;
|
|
11066
11081
|
const weekStart = addCalendarDays(anchorDate, -weekday);
|
|
11067
|
-
const weekDays = (0,
|
|
11068
|
-
const days = (0,
|
|
11082
|
+
const weekDays = (0, import_react64.useMemo)(() => Array.from({ length: 7 }, (_, index) => addCalendarDays(weekStart, index)), [weekStart]);
|
|
11083
|
+
const days = (0, import_react64.useMemo)(() => view === "month" ? monthDays.map((day) => day.date) : view === "day" ? [anchorDate] : weekDays, [view, monthDays, weekDays, anchorDate]);
|
|
11069
11084
|
const timeGridView = view === "day" || view === "week" && timeGrid;
|
|
11070
|
-
const { singles, multiDay, coverage } = (0,
|
|
11085
|
+
const { singles, multiDay, coverage } = (0, import_react64.useMemo)(() => {
|
|
11071
11086
|
const byDay = /* @__PURE__ */ new Map();
|
|
11072
11087
|
const spans = [];
|
|
11073
11088
|
const every = [];
|
|
@@ -11082,9 +11097,9 @@ function SchedulingCalendar({
|
|
|
11082
11097
|
}
|
|
11083
11098
|
return { singles: byDay, multiDay: spans, coverage: every };
|
|
11084
11099
|
}, [visibleEntries, timeZone]);
|
|
11085
|
-
const entryById = (0,
|
|
11086
|
-
const overlayById = (0,
|
|
11087
|
-
const layout = (0,
|
|
11100
|
+
const entryById = (0, import_react64.useMemo)(() => new Map([...multiDay].reverse().map(({ entry }) => [entry.id, entry])), [multiDay]);
|
|
11101
|
+
const overlayById = (0, import_react64.useMemo)(() => new Map([...overlays].reverse().map((overlay) => [overlay.id, overlay])), [overlays]);
|
|
11102
|
+
const layout = (0, import_react64.useMemo)(() => {
|
|
11088
11103
|
if (spanLayout) return spanLayout;
|
|
11089
11104
|
if (view === "agenda" || timeGridView) return { placed: [], hiddenByRow: {}, firstHiddenDayByRow: {} };
|
|
11090
11105
|
const inputs = [];
|
|
@@ -11102,7 +11117,7 @@ function SchedulingCalendar({
|
|
|
11102
11117
|
}
|
|
11103
11118
|
return layoutMonthSpans(inputs, days, { timeZone, laneCap: { window: windowCap, item: spanCap } });
|
|
11104
11119
|
}, [spanLayout, view, timeGridView, overlays, multiDay, days, timeZone, windowCap, spanCap, countsOnly]);
|
|
11105
|
-
const placedByRow = (0,
|
|
11120
|
+
const placedByRow = (0, import_react64.useMemo)(() => {
|
|
11106
11121
|
const rows = /* @__PURE__ */ new Map();
|
|
11107
11122
|
for (const placed of layout.placed) {
|
|
11108
11123
|
const row = rows.get(placed.weekRow);
|
|
@@ -11113,7 +11128,7 @@ function SchedulingCalendar({
|
|
|
11113
11128
|
}, [layout]);
|
|
11114
11129
|
const lanesUsed = (row, group) => (placedByRow.get(row) ?? []).reduce((max, placed) => placed.group === group ? Math.max(max, placed.lane + 1) : max, 0);
|
|
11115
11130
|
const lanesUsedAnywhere = (group) => layout.placed.reduce((max, placed) => placed.group === group ? Math.max(max, placed.lane + 1) : max, 0);
|
|
11116
|
-
(0,
|
|
11131
|
+
(0, import_react64.useEffect)(() => {
|
|
11117
11132
|
if (view !== "agenda" && !days.includes(activeDate)) setActiveDate(days[0]);
|
|
11118
11133
|
}, [activeDate, days, view]);
|
|
11119
11134
|
const setView = (next) => {
|
|
@@ -11129,7 +11144,7 @@ function SchedulingCalendar({
|
|
|
11129
11144
|
setActiveDate(date);
|
|
11130
11145
|
requestAnimationFrame(() => gridRef.current?.querySelector(`[data-calendar-date="${date}"]`)?.focus());
|
|
11131
11146
|
};
|
|
11132
|
-
const enteredFrom = (0,
|
|
11147
|
+
const enteredFrom = (0, import_react64.useRef)(null);
|
|
11133
11148
|
const cellOf = (date) => gridRef.current?.querySelector(`[data-calendar-date="${date}"]`)?.closest(".uix-scheduling-calendar__day") ?? null;
|
|
11134
11149
|
const dayRing = (date) => {
|
|
11135
11150
|
const cell = cellOf(date);
|
|
@@ -11199,10 +11214,10 @@ function SchedulingCalendar({
|
|
|
11199
11214
|
const date = dayOfItem(item);
|
|
11200
11215
|
if (date && dayRing(date).includes(item)) setActiveDate(date);
|
|
11201
11216
|
};
|
|
11202
|
-
const flatAgendaRef = (0,
|
|
11203
|
-
const flatAgendaStop = (0,
|
|
11217
|
+
const flatAgendaRef = (0, import_react64.useRef)(null);
|
|
11218
|
+
const flatAgendaStop = (0, import_react64.useRef)({ node: null, index: 0 });
|
|
11204
11219
|
const flatAgendaRows = () => Array.from(flatAgendaRef.current?.querySelectorAll(":scope > ol > li > button") ?? []);
|
|
11205
|
-
(0,
|
|
11220
|
+
(0, import_react64.useEffect)(() => {
|
|
11206
11221
|
flatAgendaStop.current = syncRovingStop(flatAgendaRows(), flatAgendaStop.current);
|
|
11207
11222
|
});
|
|
11208
11223
|
const onFlatAgendaFocus = (event) => {
|
|
@@ -11444,7 +11459,7 @@ function SchedulingCalendar({
|
|
|
11444
11459
|
}
|
|
11445
11460
|
|
|
11446
11461
|
// src/components/SchedulingTimeline.tsx
|
|
11447
|
-
var
|
|
11462
|
+
var import_react65 = require("react");
|
|
11448
11463
|
|
|
11449
11464
|
// src/scheduling-timeline-model.ts
|
|
11450
11465
|
var HOUR = 36e5;
|
|
@@ -11672,7 +11687,7 @@ var DEFAULT_UNITS = { row: 36, pad: 16, head: 40 };
|
|
|
11672
11687
|
var ESTIMATED_VIEWPORT = 720;
|
|
11673
11688
|
var OVERSCAN_ROWS = 4;
|
|
11674
11689
|
var BAR_MIN_FALLBACK = 1.5 * 16;
|
|
11675
|
-
var useIsomorphicLayoutEffect6 = typeof document !== "undefined" ?
|
|
11690
|
+
var useIsomorphicLayoutEffect6 = typeof document !== "undefined" ? import_react65.useLayoutEffect : import_react65.useEffect;
|
|
11676
11691
|
var sameExtent = (a, b) => a.subRows === b.subRows && a.lanes === b.lanes && a.heads === b.heads;
|
|
11677
11692
|
var IN_LANE = { scope: "lane", labelTops: ["0%"] };
|
|
11678
11693
|
var vars2 = (values) => values;
|
|
@@ -11738,29 +11753,29 @@ function SchedulingTimeline({
|
|
|
11738
11753
|
overlays: { ...DEFAULT_SCHEDULING_TIMELINE_LABELS.overlays, ...uixLabels.schedulingTimeline?.overlays, ...labelOverrides?.overlays },
|
|
11739
11754
|
statuses: { ...DEFAULT_SCHEDULING_TIMELINE_LABELS.statuses, ...uixLabels.schedulingTimeline?.statuses, ...labelOverrides?.statuses }
|
|
11740
11755
|
};
|
|
11741
|
-
const id = (0,
|
|
11756
|
+
const id = (0, import_react65.useId)();
|
|
11742
11757
|
const hintId = `${id}-hint`;
|
|
11743
11758
|
const step = stepProp !== void 0 && Number.isFinite(stepProp) && stepProp > 0 ? stepProp : defaultTimelineStep(scale);
|
|
11744
|
-
const rootRef = (0,
|
|
11745
|
-
const [scroller, setScroller] = (0,
|
|
11746
|
-
const [layerTrack, setLayerTrack] = (0,
|
|
11747
|
-
const probeRef = (0,
|
|
11748
|
-
const bodyRef = (0,
|
|
11749
|
-
const barMinRef = (0,
|
|
11750
|
-
const [barShare, setBarShare] = (0,
|
|
11751
|
-
const barShareRef = (0,
|
|
11752
|
-
const anchorRef = (0,
|
|
11753
|
-
const [anchorKey, setAnchorKey] = (0,
|
|
11754
|
-
const [focusRowKey, setFocusRowKey] = (0,
|
|
11755
|
-
const [activeId, setActiveId] = (0,
|
|
11756
|
-
const [focusRequest, setFocusRequest] = (0,
|
|
11757
|
-
const [stepDrag, setStepDrag] = (0,
|
|
11758
|
-
const [ghost, setGhost] = (0,
|
|
11759
|
-
const [announcement, setAnnouncement] = (0,
|
|
11760
|
-
const [selfCollapsed, setSelfCollapsed] = (0,
|
|
11761
|
-
const [units, setUnits] = (0,
|
|
11762
|
-
const [view, setView] = (0,
|
|
11763
|
-
const measureViewRef = (0,
|
|
11759
|
+
const rootRef = (0, import_react65.useRef)(null);
|
|
11760
|
+
const [scroller, setScroller] = (0, import_react65.useState)(null);
|
|
11761
|
+
const [layerTrack, setLayerTrack] = (0, import_react65.useState)(null);
|
|
11762
|
+
const probeRef = (0, import_react65.useRef)(null);
|
|
11763
|
+
const bodyRef = (0, import_react65.useRef)(null);
|
|
11764
|
+
const barMinRef = (0, import_react65.useRef)(null);
|
|
11765
|
+
const [barShare, setBarShare] = (0, import_react65.useState)(0);
|
|
11766
|
+
const barShareRef = (0, import_react65.useRef)(0);
|
|
11767
|
+
const anchorRef = (0, import_react65.useRef)(null);
|
|
11768
|
+
const [anchorKey, setAnchorKey] = (0, import_react65.useState)(null);
|
|
11769
|
+
const [focusRowKey, setFocusRowKey] = (0, import_react65.useState)(null);
|
|
11770
|
+
const [activeId, setActiveId] = (0, import_react65.useState)();
|
|
11771
|
+
const [focusRequest, setFocusRequest] = (0, import_react65.useState)(null);
|
|
11772
|
+
const [stepDrag, setStepDrag] = (0, import_react65.useState)(null);
|
|
11773
|
+
const [ghost, setGhost] = (0, import_react65.useState)(null);
|
|
11774
|
+
const [announcement, setAnnouncement] = (0, import_react65.useState)("");
|
|
11775
|
+
const [selfCollapsed, setSelfCollapsed] = (0, import_react65.useState)({});
|
|
11776
|
+
const [units, setUnits] = (0, import_react65.useState)(DEFAULT_UNITS);
|
|
11777
|
+
const [view, setView] = (0, import_react65.useState)({ top: 0, height: ESTIMATED_VIEWPORT });
|
|
11778
|
+
const measureViewRef = (0, import_react65.useRef)(null);
|
|
11764
11779
|
const proposing = onProposeMove !== void 0;
|
|
11765
11780
|
const stepping = !proposing && onMoveItem !== void 0;
|
|
11766
11781
|
const resizing = onResizeItem !== void 0;
|
|
@@ -11775,8 +11790,8 @@ function SchedulingTimeline({
|
|
|
11775
11790
|
return offset ? `${text} ${offset}` : text;
|
|
11776
11791
|
};
|
|
11777
11792
|
const fmtTick = (at) => formatTick?.(new Date(at), scale) ?? cachedDateTimeFormat(locale, { timeZone, ...TICK_FORMAT[scale] }).format(new Date(at));
|
|
11778
|
-
const ticks = (0,
|
|
11779
|
-
const minorTicks = (0,
|
|
11793
|
+
const ticks = (0, import_react65.useMemo)(() => timelineTicks(range, scale, timeZone, weekStartsOn), [range.start, range.end, scale, timeZone, weekStartsOn]);
|
|
11794
|
+
const minorTicks = (0, import_react65.useMemo)(
|
|
11780
11795
|
() => scale === "day" && subTicks && subTicks.length > 0 ? timelineSubTicks(range, subTicks, timeZone) : [],
|
|
11781
11796
|
[range.start, range.end, scale, timeZone, subTicks]
|
|
11782
11797
|
// eslint-disable-line react-hooks/exhaustive-deps
|
|
@@ -11805,7 +11820,7 @@ function SchedulingTimeline({
|
|
|
11805
11820
|
const minSpan = Math.max(0, (Date.parse(range.end) - Date.parse(range.start)) * barShare) || 0;
|
|
11806
11821
|
const isCollapsed = (group) => onToggleGroup ? !!group.collapsed : selfCollapsed[group.id] ?? !!group.collapsed;
|
|
11807
11822
|
const collapsedSignature = groups?.map((group) => isCollapsed(group) ? "1" : "0").join("") ?? "";
|
|
11808
|
-
const itemsByLane = (0,
|
|
11823
|
+
const itemsByLane = (0, import_react65.useMemo)(() => {
|
|
11809
11824
|
const byLane = /* @__PURE__ */ new Map();
|
|
11810
11825
|
for (const item of items) {
|
|
11811
11826
|
const list = byLane.get(item.laneId);
|
|
@@ -11814,7 +11829,7 @@ function SchedulingTimeline({
|
|
|
11814
11829
|
}
|
|
11815
11830
|
return byLane;
|
|
11816
11831
|
}, [items]);
|
|
11817
|
-
const rows = (0,
|
|
11832
|
+
const rows = (0, import_react65.useMemo)(() => {
|
|
11818
11833
|
const laneRow = (lane, laneIndex, groupIndex) => {
|
|
11819
11834
|
const placed = layoutLane(itemsByLane.get(lane.id) ?? EMPTY_ITEMS, range, { flagOverlaps, minSpan });
|
|
11820
11835
|
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) };
|
|
@@ -11846,8 +11861,8 @@ function SchedulingTimeline({
|
|
|
11846
11861
|
});
|
|
11847
11862
|
return list;
|
|
11848
11863
|
}, [lanes, groups, collapsedSignature, itemsByLane, range.start, range.end, flagOverlaps, minSpan]);
|
|
11849
|
-
const laneRows = (0,
|
|
11850
|
-
const { ordered, rowOfItem } = (0,
|
|
11864
|
+
const laneRows = (0, import_react65.useMemo)(() => rows.filter((row) => row.kind === "lane"), [rows]);
|
|
11865
|
+
const { ordered, rowOfItem } = (0, import_react65.useMemo)(() => {
|
|
11851
11866
|
const ids = [];
|
|
11852
11867
|
const rowOf = /* @__PURE__ */ new Map();
|
|
11853
11868
|
rows.forEach((row, rowIndex) => {
|
|
@@ -11859,13 +11874,13 @@ function SchedulingTimeline({
|
|
|
11859
11874
|
});
|
|
11860
11875
|
return { ordered: ids, rowOfItem: rowOf };
|
|
11861
11876
|
}, [rows]);
|
|
11862
|
-
const nothingToShow = (0,
|
|
11877
|
+
const nothingToShow = (0, import_react65.useMemo)(() => {
|
|
11863
11878
|
if (ordered.length > 0) return false;
|
|
11864
11879
|
const laneIds = new Set(lanes.map((lane) => lane.id));
|
|
11865
11880
|
return !items.some((item) => laneIds.has(item.laneId) && placeSpan(item, range) !== null);
|
|
11866
11881
|
}, [ordered, lanes, items, range.start, range.end]);
|
|
11867
11882
|
const focusId = activeId !== void 0 && rowOfItem.has(activeId) ? activeId : ordered[0];
|
|
11868
|
-
const strips = (0,
|
|
11883
|
+
const strips = (0, import_react65.useMemo)(() => {
|
|
11869
11884
|
const set = /* @__PURE__ */ new Set();
|
|
11870
11885
|
const shown = overlays.filter((overlay) => placeSpan(overlay, range) !== null).map(lanesOf);
|
|
11871
11886
|
if (shown.length === 0) return set;
|
|
@@ -11875,12 +11890,12 @@ function SchedulingTimeline({
|
|
|
11875
11890
|
});
|
|
11876
11891
|
return set;
|
|
11877
11892
|
}, [rows, overlays, range.start, range.end]);
|
|
11878
|
-
const extents = (0,
|
|
11893
|
+
const extents = (0, import_react65.useMemo)(() => timelineRowExtents(rows.map((row, index) => row.kind === "head" ? { kind: "head", subRows: strips.has(index) ? 1 : 0 } : { kind: "lane", subRows: row.subRows })), [rows, strips]);
|
|
11879
11894
|
const windowed = lanes.length + (groups?.length ?? 0) > virtualizeAbove;
|
|
11880
11895
|
const printing = usePrinting(windowed);
|
|
11881
11896
|
const virtual = windowed && !printing;
|
|
11882
11897
|
const fixed = windowed || groups !== void 0 || overlays.some((overlay) => overlay.laneIds !== void 0) || markers.some((marker) => marker.laneIds !== void 0);
|
|
11883
|
-
(0,
|
|
11898
|
+
(0, import_react65.useEffect)(() => {
|
|
11884
11899
|
if (!virtual || !scroller) return void 0;
|
|
11885
11900
|
let frame = 0;
|
|
11886
11901
|
const measure = () => {
|
|
@@ -11920,12 +11935,12 @@ function SchedulingTimeline({
|
|
|
11920
11935
|
};
|
|
11921
11936
|
}, [virtual, scroller]);
|
|
11922
11937
|
const px = (extent) => extent.subRows * units.row + extent.lanes * units.pad + extent.heads * units.head;
|
|
11923
|
-
const offsets = (0,
|
|
11938
|
+
const offsets = (0, import_react65.useMemo)(() => virtual ? extents.map(px) : [], [virtual, extents, units]);
|
|
11924
11939
|
const overscan = OVERSCAN_ROWS * units.row;
|
|
11925
11940
|
const pinned = focusId === void 0 ? -1 : rowOfItem.get(focusId) ?? -1;
|
|
11926
|
-
const focusedRow = (0,
|
|
11927
|
-
const anchorRow = (0,
|
|
11928
|
-
const { mounted, windowStart } = (0,
|
|
11941
|
+
const focusedRow = (0, import_react65.useMemo)(() => focusRowKey === null ? -1 : rows.findIndex((row) => row.key === focusRowKey), [rows, focusRowKey]);
|
|
11942
|
+
const anchorRow = (0, import_react65.useMemo)(() => anchorKey === null ? -1 : rows.findIndex((row) => row.key === anchorKey), [rows, anchorKey]);
|
|
11943
|
+
const { mounted, windowStart } = (0, import_react65.useMemo)(() => {
|
|
11929
11944
|
if (!virtual) return { mounted: rows.map((_, index) => index), windowStart: 0 };
|
|
11930
11945
|
const window_ = timelineWindow(offsets, view.top, view.top + view.height, { overscan });
|
|
11931
11946
|
const list = [];
|
|
@@ -11973,10 +11988,10 @@ function SchedulingTimeline({
|
|
|
11973
11988
|
setActiveId(itemId);
|
|
11974
11989
|
setFocusRequest({ id: itemId });
|
|
11975
11990
|
};
|
|
11976
|
-
(0,
|
|
11991
|
+
(0, import_react65.useEffect)(() => {
|
|
11977
11992
|
if (focusRequest) findBar(focusRequest.id)?.focus();
|
|
11978
11993
|
}, [focusRequest]);
|
|
11979
|
-
const itemById = (0,
|
|
11994
|
+
const itemById = (0, import_react65.useMemo)(() => {
|
|
11980
11995
|
const map = /* @__PURE__ */ new Map();
|
|
11981
11996
|
for (const row of laneRows) for (const p of row.placed) if (!map.has(p.item.id)) map.set(p.item.id, p.item);
|
|
11982
11997
|
return map;
|
|
@@ -11986,15 +12001,15 @@ function SchedulingTimeline({
|
|
|
11986
12001
|
const steps = Math.round(ms / step);
|
|
11987
12002
|
return { days: steps * stepDelta.days, minutes: steps * stepDelta.minutes };
|
|
11988
12003
|
};
|
|
11989
|
-
const live = (0,
|
|
12004
|
+
const live = (0, import_react65.useRef)({ itemById, timeZone, range, step, onProposeMove, canMove, deltaFor, labels, fmtInstant });
|
|
11990
12005
|
live.current = { itemById, timeZone, range, step, onProposeMove, canMove, deltaFor, labels, fmtInstant };
|
|
11991
|
-
const dragRef = (0,
|
|
11992
|
-
const suppressClick = (0,
|
|
11993
|
-
const refocus = (0,
|
|
11994
|
-
(0,
|
|
12006
|
+
const dragRef = (0, import_react65.useRef)(null);
|
|
12007
|
+
const suppressClick = (0, import_react65.useRef)(false);
|
|
12008
|
+
const refocus = (0, import_react65.useRef)(null);
|
|
12009
|
+
(0, import_react65.useEffect)(() => {
|
|
11995
12010
|
if (ghost && !itemById.has(ghost.id)) setGhost(null);
|
|
11996
12011
|
}, [ghost, itemById]);
|
|
11997
|
-
(0,
|
|
12012
|
+
(0, import_react65.useEffect)(() => {
|
|
11998
12013
|
const wanted = refocus.current;
|
|
11999
12014
|
if (!wanted || !rootRef.current) return;
|
|
12000
12015
|
const active = document.activeElement;
|
|
@@ -12005,11 +12020,11 @@ function SchedulingTimeline({
|
|
|
12005
12020
|
}
|
|
12006
12021
|
findBar(wanted)?.focus();
|
|
12007
12022
|
});
|
|
12008
|
-
(0,
|
|
12023
|
+
(0, import_react65.useEffect)(() => () => {
|
|
12009
12024
|
dragRef.current?.stop();
|
|
12010
12025
|
dragRef.current = null;
|
|
12011
12026
|
}, []);
|
|
12012
|
-
(0,
|
|
12027
|
+
(0, import_react65.useEffect)(() => {
|
|
12013
12028
|
if (proposing) return;
|
|
12014
12029
|
dragRef.current?.stop();
|
|
12015
12030
|
dragRef.current = null;
|
|
@@ -12490,7 +12505,7 @@ function SchedulingTimeline({
|
|
|
12490
12505
|
}
|
|
12491
12506
|
|
|
12492
12507
|
// src/components/DateRangePicker.tsx
|
|
12493
|
-
var
|
|
12508
|
+
var import_react67 = require("react");
|
|
12494
12509
|
|
|
12495
12510
|
// src/date-field-model.ts
|
|
12496
12511
|
var pad = (n, width = 2) => String(n).padStart(width, "0");
|
|
@@ -12564,7 +12579,7 @@ function timeZoneName(timeZone, date, locale) {
|
|
|
12564
12579
|
}
|
|
12565
12580
|
|
|
12566
12581
|
// src/components/DateFieldParts.tsx
|
|
12567
|
-
var
|
|
12582
|
+
var import_react66 = require("react");
|
|
12568
12583
|
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
12569
12584
|
var localDateKey = (now = /* @__PURE__ */ new Date()) => `${now.getFullYear().toString().padStart(4, "0")}-${(now.getMonth() + 1).toString().padStart(2, "0")}-${now.getDate().toString().padStart(2, "0")}`;
|
|
12570
12585
|
var utc = (date) => /* @__PURE__ */ new Date(`${date}T00:00:00Z`);
|
|
@@ -12582,15 +12597,15 @@ var isOpen = (el) => {
|
|
|
12582
12597
|
}
|
|
12583
12598
|
};
|
|
12584
12599
|
function useFieldPopover(popoverId, restoreFocus, onOpenChange) {
|
|
12585
|
-
const [open, setOpen] = (0,
|
|
12586
|
-
const pointerWasOpen = (0,
|
|
12587
|
-
const restoreRef = (0,
|
|
12600
|
+
const [open, setOpen] = (0, import_react66.useState)(false);
|
|
12601
|
+
const pointerWasOpen = (0, import_react66.useRef)(null);
|
|
12602
|
+
const restoreRef = (0, import_react66.useRef)(restoreFocus);
|
|
12588
12603
|
restoreRef.current = restoreFocus;
|
|
12589
|
-
const onOpenChangeRef = (0,
|
|
12604
|
+
const onOpenChangeRef = (0, import_react66.useRef)(onOpenChange);
|
|
12590
12605
|
onOpenChangeRef.current = onOpenChange;
|
|
12591
|
-
const skipRestore = (0,
|
|
12606
|
+
const skipRestore = (0, import_react66.useRef)(false);
|
|
12592
12607
|
const popoverEl = () => typeof document === "undefined" ? null : document.getElementById(popoverId);
|
|
12593
|
-
(0,
|
|
12608
|
+
(0, import_react66.useEffect)(() => {
|
|
12594
12609
|
const el = popoverEl();
|
|
12595
12610
|
if (!el) return;
|
|
12596
12611
|
const onToggle = (event) => {
|
|
@@ -12674,14 +12689,14 @@ function MonthCalendar({
|
|
|
12674
12689
|
autoFocus = false
|
|
12675
12690
|
}) {
|
|
12676
12691
|
const clamp3 = (date) => min && date < min ? min : max && date > max ? max : date;
|
|
12677
|
-
const [active, setActive] = (0,
|
|
12678
|
-
const gridRef = (0,
|
|
12679
|
-
const pendingFocus = (0,
|
|
12692
|
+
const [active, setActive] = (0, import_react66.useState)(() => clamp3(initialDate));
|
|
12693
|
+
const gridRef = (0, import_react66.useRef)(null);
|
|
12694
|
+
const pendingFocus = (0, import_react66.useRef)(autoFocus);
|
|
12680
12695
|
const month = startOfMonth(active);
|
|
12681
|
-
const days = (0,
|
|
12696
|
+
const days = (0, import_react66.useMemo)(() => buildMonthGrid(month, weekStartsOn).filter((day) => day.inMonth), [month, weekStartsOn]);
|
|
12682
12697
|
const blanks = (utc(month).getUTCDay() - weekStartsOn + 7) % 7;
|
|
12683
|
-
const weekdays = (0,
|
|
12684
|
-
(0,
|
|
12698
|
+
const weekdays = (0, import_react66.useMemo)(() => weekdayNames(locale, weekStartsOn), [locale, weekStartsOn]);
|
|
12699
|
+
(0, import_react66.useEffect)(() => {
|
|
12685
12700
|
if (!pendingFocus.current) return;
|
|
12686
12701
|
pendingFocus.current = false;
|
|
12687
12702
|
gridRef.current?.querySelector(`[data-date="${active}"]`)?.focus({ preventScroll: true });
|
|
@@ -12788,27 +12803,27 @@ function RangeCalendar({
|
|
|
12788
12803
|
weekStartsOn = 1,
|
|
12789
12804
|
autoFocus = false
|
|
12790
12805
|
}) {
|
|
12791
|
-
const id = (0,
|
|
12792
|
-
const weekdays = (0,
|
|
12793
|
-
const [internalMonth, setInternalMonth] = (0,
|
|
12806
|
+
const id = (0, import_react67.useId)();
|
|
12807
|
+
const weekdays = (0, import_react67.useMemo)(() => weekdayNames(locale, weekStartsOn), [locale, weekStartsOn]);
|
|
12808
|
+
const [internalMonth, setInternalMonth] = (0, import_react67.useState)(() => startOfMonth(controlledMonth ?? value.start ?? (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)));
|
|
12794
12809
|
const visibleMonth = startOfMonth(controlledMonth ?? internalMonth);
|
|
12795
|
-
const [activeDate, setActiveDate] = (0,
|
|
12796
|
-
const rootRef = (0,
|
|
12797
|
-
const pendingFocus = (0,
|
|
12810
|
+
const [activeDate, setActiveDate] = (0, import_react67.useState)(value.end ?? value.start ?? visibleMonth);
|
|
12811
|
+
const rootRef = (0, import_react67.useRef)(null);
|
|
12812
|
+
const pendingFocus = (0, import_react67.useRef)(autoFocus);
|
|
12798
12813
|
const count2 = Math.max(1, Math.min(3, months));
|
|
12799
|
-
const calendars = (0,
|
|
12814
|
+
const calendars = (0, import_react67.useMemo)(() => Array.from({ length: count2 }, (_, index) => {
|
|
12800
12815
|
const month = startOfMonth(addCalendarMonths(visibleMonth, index));
|
|
12801
12816
|
return { month, days: buildMonthGrid(month).filter((day) => day.inMonth) };
|
|
12802
12817
|
}), [visibleMonth, count2]);
|
|
12803
12818
|
const todayDate = today === void 0 ? localDateKey() : today;
|
|
12804
12819
|
const rangeInvalid = invalid || !!value.start && !!value.end && value.start > value.end;
|
|
12805
|
-
(0,
|
|
12820
|
+
(0, import_react67.useEffect)(() => {
|
|
12806
12821
|
const first = calendars[0]?.days[0]?.date;
|
|
12807
12822
|
const finalDays = calendars[calendars.length - 1]?.days;
|
|
12808
12823
|
const last = finalDays?.[finalDays.length - 1]?.date;
|
|
12809
12824
|
if (first && last && (activeDate < first || activeDate > last)) setActiveDate(first);
|
|
12810
12825
|
}, [activeDate, calendars]);
|
|
12811
|
-
(0,
|
|
12826
|
+
(0, import_react67.useEffect)(() => {
|
|
12812
12827
|
if (!pendingFocus.current) return;
|
|
12813
12828
|
rootRef.current?.querySelector(`[data-date="${activeDate}"]`)?.focus({ preventScroll: autoFocus });
|
|
12814
12829
|
pendingFocus.current = false;
|
|
@@ -12912,15 +12927,15 @@ function DateRangeField(props) {
|
|
|
12912
12927
|
"aria-describedby": ariaDescribedBy,
|
|
12913
12928
|
"aria-invalid": ariaInvalid
|
|
12914
12929
|
} = props;
|
|
12915
|
-
const uid = (0,
|
|
12930
|
+
const uid = (0, import_react67.useId)();
|
|
12916
12931
|
const id = idProp ?? `${uid}-trigger`;
|
|
12917
12932
|
const popoverId = `${uid}-months`;
|
|
12918
12933
|
const valueId = `${uid}-value`;
|
|
12919
|
-
const anchorRef = (0,
|
|
12920
|
-
const triggerRef = (0,
|
|
12934
|
+
const anchorRef = (0, import_react67.useRef)(null);
|
|
12935
|
+
const triggerRef = (0, import_react67.useRef)(null);
|
|
12921
12936
|
const { open, hide, triggerProps } = useFieldPopover(popoverId, () => triggerRef.current?.focus({ preventScroll: true }), onOpenChange);
|
|
12922
|
-
const [labelled, setLabelled] = (0,
|
|
12923
|
-
(0,
|
|
12937
|
+
const [labelled, setLabelled] = (0, import_react67.useState)(false);
|
|
12938
|
+
(0, import_react67.useEffect)(() => {
|
|
12924
12939
|
setLabelled((triggerRef.current?.labels?.length ?? 0) > 0);
|
|
12925
12940
|
}, [id]);
|
|
12926
12941
|
const format = (date) => formatDate?.(date) ?? formatDateKey(date, locale);
|
|
@@ -12991,7 +13006,7 @@ function DateRangeField(props) {
|
|
|
12991
13006
|
}
|
|
12992
13007
|
|
|
12993
13008
|
// src/components/DatePicker.tsx
|
|
12994
|
-
var
|
|
13009
|
+
var import_react68 = require("react");
|
|
12995
13010
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
12996
13011
|
var DEFAULT_DATE_PICKER_LABELS = {
|
|
12997
13012
|
open: "Choose date",
|
|
@@ -13003,7 +13018,7 @@ var DEFAULT_DATE_PICKER_LABELS = {
|
|
|
13003
13018
|
notADate: "That is not a date.",
|
|
13004
13019
|
unavailable: "That date is not available."
|
|
13005
13020
|
};
|
|
13006
|
-
var DatePicker = (0,
|
|
13021
|
+
var DatePicker = (0, import_react68.forwardRef)(function DatePicker2({
|
|
13007
13022
|
value,
|
|
13008
13023
|
onValueChange,
|
|
13009
13024
|
min,
|
|
@@ -13034,18 +13049,18 @@ var DatePicker = (0, import_react67.forwardRef)(function DatePicker2({
|
|
|
13034
13049
|
className,
|
|
13035
13050
|
style
|
|
13036
13051
|
}, forwardedRef) {
|
|
13037
|
-
const uid = (0,
|
|
13052
|
+
const uid = (0, import_react68.useId)();
|
|
13038
13053
|
const id = idProp ?? `${uid}-input`;
|
|
13039
13054
|
const popoverId = `${uid}-calendar`;
|
|
13040
13055
|
const errorId = `${uid}-error`;
|
|
13041
13056
|
const labels = { ...DEFAULT_DATE_PICKER_LABELS, ...useUixLabels().datePicker, ...labelOverrides };
|
|
13042
|
-
const anchorRef = (0,
|
|
13043
|
-
const inputRef = (0,
|
|
13044
|
-
(0,
|
|
13057
|
+
const anchorRef = (0, import_react68.useRef)(null);
|
|
13058
|
+
const inputRef = (0, import_react68.useRef)(null);
|
|
13059
|
+
(0, import_react68.useImperativeHandle)(forwardedRef, () => inputRef.current);
|
|
13045
13060
|
const format = (date) => formatDate?.(date) ?? formatDateKey(date, locale);
|
|
13046
|
-
const [text, setText] = (0,
|
|
13047
|
-
const [problem, setProblemState] = (0,
|
|
13048
|
-
const reported = (0,
|
|
13061
|
+
const [text, setText] = (0, import_react68.useState)(() => value ? format(value) : "");
|
|
13062
|
+
const [problem, setProblemState] = (0, import_react68.useState)(null);
|
|
13063
|
+
const reported = (0, import_react68.useRef)(null);
|
|
13049
13064
|
const setProblem = (next) => {
|
|
13050
13065
|
if (next !== reported.current) {
|
|
13051
13066
|
reported.current = next;
|
|
@@ -13053,7 +13068,7 @@ var DatePicker = (0, import_react67.forwardRef)(function DatePicker2({
|
|
|
13053
13068
|
}
|
|
13054
13069
|
setProblemState(next);
|
|
13055
13070
|
};
|
|
13056
|
-
(0,
|
|
13071
|
+
(0, import_react68.useEffect)(() => {
|
|
13057
13072
|
setText(value ? format(value) : "");
|
|
13058
13073
|
setProblem(null);
|
|
13059
13074
|
}, [value, locale]);
|
|
@@ -13203,7 +13218,7 @@ var DEFAULT_DATE_TIME_PICKER_LABELS = {
|
|
|
13203
13218
|
timeOf: "{label}, time",
|
|
13204
13219
|
timeZone: "Time zone: {zone}"
|
|
13205
13220
|
};
|
|
13206
|
-
var DateTimePicker = (0,
|
|
13221
|
+
var DateTimePicker = (0, import_react68.forwardRef)(function DateTimePicker2({
|
|
13207
13222
|
value,
|
|
13208
13223
|
onValueChange,
|
|
13209
13224
|
timeZone,
|
|
@@ -13227,19 +13242,19 @@ var DateTimePicker = (0, import_react67.forwardRef)(function DateTimePicker2({
|
|
|
13227
13242
|
style,
|
|
13228
13243
|
...dateProps
|
|
13229
13244
|
}, forwardedRef) {
|
|
13230
|
-
const uid = (0,
|
|
13245
|
+
const uid = (0, import_react68.useId)();
|
|
13231
13246
|
const id = idProp ?? `${uid}-date`;
|
|
13232
13247
|
const zoneId = `${uid}-zone`;
|
|
13233
13248
|
const labels = { ...DEFAULT_DATE_TIME_PICKER_LABELS, ...useUixLabels().dateTimePicker, ...labelOverrides };
|
|
13234
13249
|
const { date, time } = splitDateTime(value);
|
|
13235
|
-
const dateRef = (0,
|
|
13236
|
-
(0,
|
|
13237
|
-
const [pendingTime, setPendingTime] = (0,
|
|
13250
|
+
const dateRef = (0, import_react68.useRef)(null);
|
|
13251
|
+
(0, import_react68.useImperativeHandle)(forwardedRef, () => dateRef.current);
|
|
13252
|
+
const [pendingTime, setPendingTime] = (0, import_react68.useState)("");
|
|
13238
13253
|
const shownTime = date ? time : pendingTime;
|
|
13239
|
-
const [fieldLabel, setFieldLabel] = (0,
|
|
13240
|
-
const [viewerZone, setViewerZone] = (0,
|
|
13254
|
+
const [fieldLabel, setFieldLabel] = (0, import_react68.useState)("");
|
|
13255
|
+
const [viewerZone, setViewerZone] = (0, import_react68.useState)(null);
|
|
13241
13256
|
const grouped = !!ariaLabel || !!ariaLabelledBy;
|
|
13242
|
-
(0,
|
|
13257
|
+
(0, import_react68.useEffect)(() => {
|
|
13243
13258
|
if (!grouped) setFieldLabel(dateRef.current?.labels?.[0]?.textContent?.trim() ?? "");
|
|
13244
13259
|
if (!timeZone) {
|
|
13245
13260
|
try {
|
|
@@ -13318,7 +13333,7 @@ var DateTimePicker = (0, import_react67.forwardRef)(function DateTimePicker2({
|
|
|
13318
13333
|
});
|
|
13319
13334
|
|
|
13320
13335
|
// src/components/RelationshipGraph.tsx
|
|
13321
|
-
var
|
|
13336
|
+
var import_react70 = require("react");
|
|
13322
13337
|
|
|
13323
13338
|
// src/relationship-graph-model.ts
|
|
13324
13339
|
function boundRelationshipGraph(nodes, edges, maxNodes = 40) {
|
|
@@ -13799,7 +13814,7 @@ function layeredNeighbor(layout, currentId, key) {
|
|
|
13799
13814
|
}
|
|
13800
13815
|
|
|
13801
13816
|
// src/components/RelationshipGraphLayered.tsx
|
|
13802
|
-
var
|
|
13817
|
+
var import_react69 = require("react");
|
|
13803
13818
|
|
|
13804
13819
|
// src/components/RelationshipGraphList.tsx
|
|
13805
13820
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
@@ -13886,11 +13901,11 @@ function LayeredRelationshipGraph({
|
|
|
13886
13901
|
focusId,
|
|
13887
13902
|
onFocusChange
|
|
13888
13903
|
}) {
|
|
13889
|
-
const hintId = (0,
|
|
13890
|
-
const bounded = (0,
|
|
13891
|
-
const [localExpanded, setLocalExpanded] = (0,
|
|
13904
|
+
const hintId = (0, import_react69.useId)();
|
|
13905
|
+
const bounded = (0, import_react69.useMemo)(() => boundRelationshipGraph(nodes, edges, maxNodes), [nodes, edges, maxNodes]);
|
|
13906
|
+
const [localExpanded, setLocalExpanded] = (0, import_react69.useState)(EMPTY_IDS2);
|
|
13892
13907
|
const expanded = expandedClusterIds ?? localExpanded;
|
|
13893
|
-
const layout = (0,
|
|
13908
|
+
const layout = (0, import_react69.useMemo)(
|
|
13894
13909
|
() => layoutLayeredGraph(bounded.nodes, bounded.edges, {
|
|
13895
13910
|
...rootId !== void 0 ? { rootId } : {},
|
|
13896
13911
|
...clusterThreshold !== void 0 ? { clusterThreshold } : {},
|
|
@@ -13899,29 +13914,29 @@ function LayeredRelationshipGraph({
|
|
|
13899
13914
|
}),
|
|
13900
13915
|
[bounded, rootId, clusterThreshold, expanded, density]
|
|
13901
13916
|
);
|
|
13902
|
-
const itemById = (0,
|
|
13903
|
-
const viewportRef = (0,
|
|
13904
|
-
const itemRefs = (0,
|
|
13905
|
-
const [size, setSize] = (0,
|
|
13906
|
-
const [view, setView] = (0,
|
|
13907
|
-
const [animate, setAnimate] = (0,
|
|
13908
|
-
const [localFocus, setLocalFocus] = (0,
|
|
13909
|
-
const [hoverId, setHoverId] = (0,
|
|
13910
|
-
const viewRef = (0,
|
|
13917
|
+
const itemById = (0, import_react69.useMemo)(() => new Map(layout.items.map((item) => [item.id, item])), [layout]);
|
|
13918
|
+
const viewportRef = (0, import_react69.useRef)(null);
|
|
13919
|
+
const itemRefs = (0, import_react69.useRef)(/* @__PURE__ */ new Map());
|
|
13920
|
+
const [size, setSize] = (0, import_react69.useState)({ width: 0, height: 0 });
|
|
13921
|
+
const [view, setView] = (0, import_react69.useState)({ x: 0, y: 0, zoom: 1 });
|
|
13922
|
+
const [animate, setAnimate] = (0, import_react69.useState)(false);
|
|
13923
|
+
const [localFocus, setLocalFocus] = (0, import_react69.useState)(void 0);
|
|
13924
|
+
const [hoverId, setHoverId] = (0, import_react69.useState)(void 0);
|
|
13925
|
+
const viewRef = (0, import_react69.useRef)(view);
|
|
13911
13926
|
viewRef.current = view;
|
|
13912
|
-
const layoutRef = (0,
|
|
13927
|
+
const layoutRef = (0, import_react69.useRef)(layout);
|
|
13913
13928
|
layoutRef.current = layout;
|
|
13914
|
-
const pendingFocus = (0,
|
|
13915
|
-
const initialisedFor = (0,
|
|
13929
|
+
const pendingFocus = (0, import_react69.useRef)(void 0);
|
|
13930
|
+
const initialisedFor = (0, import_react69.useRef)(void 0);
|
|
13916
13931
|
const rootItemId = layout.rootId !== void 0 ? layout.itemOf[layout.rootId] : layout.items[0]?.id;
|
|
13917
13932
|
const requestedFocus = focusId !== void 0 ? layout.itemOf[focusId] ?? focusId : localFocus;
|
|
13918
13933
|
const focusedId = requestedFocus !== void 0 && itemById.has(requestedFocus) ? requestedFocus : rootItemId;
|
|
13919
13934
|
const selectedItemId = selectedId !== void 0 ? layout.itemOf[selectedId] : void 0;
|
|
13920
|
-
const activeIds = (0,
|
|
13935
|
+
const activeIds = (0, import_react69.useMemo)(
|
|
13921
13936
|
() => new Set([hoverId, selectedItemId].filter((id) => id !== void 0)),
|
|
13922
13937
|
[hoverId, selectedItemId]
|
|
13923
13938
|
);
|
|
13924
|
-
(0,
|
|
13939
|
+
(0, import_react69.useEffect)(() => {
|
|
13925
13940
|
const element = viewportRef.current;
|
|
13926
13941
|
if (!element) return;
|
|
13927
13942
|
const measure = () => setSize({ width: element.clientWidth, height: element.clientHeight });
|
|
@@ -13931,18 +13946,18 @@ function LayeredRelationshipGraph({
|
|
|
13931
13946
|
observer.observe(element);
|
|
13932
13947
|
return () => observer.disconnect();
|
|
13933
13948
|
}, []);
|
|
13934
|
-
(0,
|
|
13949
|
+
(0, import_react69.useEffect)(() => {
|
|
13935
13950
|
if (size.width === 0) return;
|
|
13936
13951
|
const key = `${layout.rootId ?? ""}`;
|
|
13937
13952
|
if (initialisedFor.current === key) return;
|
|
13938
13953
|
initialisedFor.current = key;
|
|
13939
13954
|
setView(initialView(layout, size));
|
|
13940
13955
|
}, [layout, size]);
|
|
13941
|
-
const moveView = (0,
|
|
13956
|
+
const moveView = (0, import_react69.useCallback)((next, smooth) => {
|
|
13942
13957
|
setAnimate(smooth);
|
|
13943
13958
|
setView(next);
|
|
13944
13959
|
}, []);
|
|
13945
|
-
const ensureVisible = (0,
|
|
13960
|
+
const ensureVisible = (0, import_react69.useCallback)((id, smooth) => {
|
|
13946
13961
|
const element = viewportRef.current;
|
|
13947
13962
|
const item = layoutRef.current.items.find((candidate) => candidate.id === id);
|
|
13948
13963
|
if (!element || !item) return;
|
|
@@ -13961,7 +13976,7 @@ function LayeredRelationshipGraph({
|
|
|
13961
13976
|
else if (bottom > heightPx - FOCUS_MARGIN) nextY -= bottom - (heightPx - FOCUS_MARGIN);
|
|
13962
13977
|
if (nextX !== x || nextY !== y) moveView({ x: nextX, y: nextY, zoom }, smooth);
|
|
13963
13978
|
}, [moveView]);
|
|
13964
|
-
const focusItem = (0,
|
|
13979
|
+
const focusItem = (0, import_react69.useCallback)((id) => {
|
|
13965
13980
|
setLocalFocus(id);
|
|
13966
13981
|
onFocusChange?.(id);
|
|
13967
13982
|
requestAnimationFrame(() => {
|
|
@@ -13969,7 +13984,7 @@ function LayeredRelationshipGraph({
|
|
|
13969
13984
|
ensureVisible(id, true);
|
|
13970
13985
|
});
|
|
13971
13986
|
}, [ensureVisible, onFocusChange]);
|
|
13972
|
-
(0,
|
|
13987
|
+
(0, import_react69.useEffect)(() => {
|
|
13973
13988
|
const wanted = pendingFocus.current;
|
|
13974
13989
|
if (wanted !== void 0 && itemById.has(wanted)) {
|
|
13975
13990
|
pendingFocus.current = void 0;
|
|
@@ -13979,8 +13994,8 @@ function LayeredRelationshipGraph({
|
|
|
13979
13994
|
const controlledTarget = focusId !== void 0 ? layout.itemOf[focusId] ?? focusId : void 0;
|
|
13980
13995
|
const controlledPresent = controlledTarget !== void 0 && itemById.has(controlledTarget);
|
|
13981
13996
|
const controlledKey = `${controlledTarget ?? ""}|${controlledPresent}`;
|
|
13982
|
-
const lastControlledKey = (0,
|
|
13983
|
-
(0,
|
|
13997
|
+
const lastControlledKey = (0, import_react69.useRef)(controlledKey);
|
|
13998
|
+
(0, import_react69.useEffect)(() => {
|
|
13984
13999
|
if (lastControlledKey.current === controlledKey) return;
|
|
13985
14000
|
lastControlledKey.current = controlledKey;
|
|
13986
14001
|
if (!controlledPresent || controlledTarget === void 0) return;
|
|
@@ -13989,7 +14004,7 @@ function LayeredRelationshipGraph({
|
|
|
13989
14004
|
ensureVisible(controlledTarget, true);
|
|
13990
14005
|
});
|
|
13991
14006
|
}, [controlledKey, controlledTarget, controlledPresent, ensureVisible]);
|
|
13992
|
-
(0,
|
|
14007
|
+
(0, import_react69.useEffect)(() => {
|
|
13993
14008
|
const element = viewportRef.current;
|
|
13994
14009
|
if (!element) return;
|
|
13995
14010
|
const onWheel = (event) => {
|
|
@@ -14007,8 +14022,8 @@ function LayeredRelationshipGraph({
|
|
|
14007
14022
|
element.addEventListener("wheel", onWheel, { passive: false });
|
|
14008
14023
|
return () => element.removeEventListener("wheel", onWheel);
|
|
14009
14024
|
}, []);
|
|
14010
|
-
const pointers = (0,
|
|
14011
|
-
const pinchDistance = (0,
|
|
14025
|
+
const pointers = (0, import_react69.useRef)(/* @__PURE__ */ new Map());
|
|
14026
|
+
const pinchDistance = (0, import_react69.useRef)(void 0);
|
|
14012
14027
|
const onPointerDown = (event) => {
|
|
14013
14028
|
if (event.target.closest("button")) return;
|
|
14014
14029
|
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
@@ -14309,7 +14324,7 @@ function radialViewBox(nodes) {
|
|
|
14309
14324
|
return `${round(minX)} ${round(minY)} ${width} ${height}`;
|
|
14310
14325
|
}
|
|
14311
14326
|
function RelationshipGraph(props) {
|
|
14312
|
-
const labels = (0,
|
|
14327
|
+
const labels = (0, import_react70.useMemo)(() => ({ ...DEFAULT_RELATIONSHIP_GRAPH_LABELS, ...props.labels }), [props.labels]);
|
|
14313
14328
|
const stateClass = cx("uix-relationship-graph uix-relationship-graph--state", props.className);
|
|
14314
14329
|
if (props.loading) return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: stateClass, role: "status", children: labels.loading });
|
|
14315
14330
|
if (props.error) {
|
|
@@ -14343,17 +14358,17 @@ function RadialRelationshipGraph({
|
|
|
14343
14358
|
labels,
|
|
14344
14359
|
showList = true
|
|
14345
14360
|
}) {
|
|
14346
|
-
const bounded = (0,
|
|
14347
|
-
const positioned = (0,
|
|
14348
|
-
const typeColor = (0,
|
|
14361
|
+
const bounded = (0, import_react70.useMemo)(() => boundRelationshipGraph(nodes, edges, maxNodes), [nodes, edges, maxNodes]);
|
|
14362
|
+
const positioned = (0, import_react70.useMemo)(() => layoutRelationshipGraph(bounded.nodes, bounded.edges, selectedId), [bounded, selectedId]);
|
|
14363
|
+
const typeColor = (0, import_react70.useMemo)(
|
|
14349
14364
|
() => new Map(legend.map((item, index) => [item.id, `var(--uix-chart-${index % 8 + 1})`])),
|
|
14350
14365
|
[legend]
|
|
14351
14366
|
);
|
|
14352
|
-
const positionedById = (0,
|
|
14353
|
-
const [zoom, setZoom] = (0,
|
|
14354
|
-
const [pan, setPan] = (0,
|
|
14355
|
-
const [focusedId, setFocusedId] = (0,
|
|
14356
|
-
const svgRef = (0,
|
|
14367
|
+
const positionedById = (0, import_react70.useMemo)(() => new Map(positioned.map((node) => [node.id, node])), [positioned]);
|
|
14368
|
+
const [zoom, setZoom] = (0, import_react70.useState)(1);
|
|
14369
|
+
const [pan, setPan] = (0, import_react70.useState)({ x: 0, y: 0 });
|
|
14370
|
+
const [focusedId, setFocusedId] = (0, import_react70.useState)(selectedId ?? positioned[0]?.id);
|
|
14371
|
+
const svgRef = (0, import_react70.useRef)(null);
|
|
14357
14372
|
const select = (id) => {
|
|
14358
14373
|
const node = bounded.nodes.find((item) => item.id === id);
|
|
14359
14374
|
if (node) onSelect?.(node);
|
|
@@ -14424,7 +14439,7 @@ function RadialRelationshipGraph({
|
|
|
14424
14439
|
}
|
|
14425
14440
|
|
|
14426
14441
|
// src/components/MatchReview.tsx
|
|
14427
|
-
var
|
|
14442
|
+
var import_react71 = require("react");
|
|
14428
14443
|
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
14429
14444
|
var DEFAULT_MATCH_REVIEW_LABELS = {
|
|
14430
14445
|
region: "Match review",
|
|
@@ -14487,11 +14502,11 @@ function MatchReview({
|
|
|
14487
14502
|
const plural = (n, one, many) => fillLabel(n === 1 ? one : many, { count: n });
|
|
14488
14503
|
const decisionLabel = { accepted: labels.decisionAccepted, dismissed: labels.decisionDismissed, split: labels.decisionSplit, other: labels.decisionOther };
|
|
14489
14504
|
const actionLabel = { accept: labels.accept, dismiss: labels.dismiss, split: labels.split, "pick-other": labels.pickOther };
|
|
14490
|
-
const [internalSelection, setInternalSelection] = (0,
|
|
14491
|
-
const [announcement, setAnnouncement] = (0,
|
|
14492
|
-
const [bulkPending, setBulkPending] = (0,
|
|
14505
|
+
const [internalSelection, setInternalSelection] = (0, import_react71.useState)(/* @__PURE__ */ new Set());
|
|
14506
|
+
const [announcement, setAnnouncement] = (0, import_react71.useState)("");
|
|
14507
|
+
const [bulkPending, setBulkPending] = (0, import_react71.useState)(false);
|
|
14493
14508
|
const selection = selectedIds ?? internalSelection;
|
|
14494
|
-
const pending = (0,
|
|
14509
|
+
const pending = (0, import_react71.useMemo)(() => candidates.filter((candidate) => candidate.status !== "resolved"), [candidates]);
|
|
14495
14510
|
const setSelection = (next) => {
|
|
14496
14511
|
if (selectedIds === void 0) setInternalSelection(next);
|
|
14497
14512
|
onSelectionChange?.(next);
|
|
@@ -14580,7 +14595,7 @@ function MatchReview({
|
|
|
14580
14595
|
}
|
|
14581
14596
|
|
|
14582
14597
|
// src/components/MetricInput.tsx
|
|
14583
|
-
var
|
|
14598
|
+
var import_react72 = require("react");
|
|
14584
14599
|
|
|
14585
14600
|
// src/metric-model.ts
|
|
14586
14601
|
function decimals(value) {
|
|
@@ -14624,11 +14639,11 @@ function MetricInput({
|
|
|
14624
14639
|
className,
|
|
14625
14640
|
id: providedId
|
|
14626
14641
|
}) {
|
|
14627
|
-
const generatedId = (0,
|
|
14642
|
+
const generatedId = (0, import_react72.useId)();
|
|
14628
14643
|
const id = providedId ?? generatedId;
|
|
14629
14644
|
const errorId = `${id}-error`;
|
|
14630
|
-
const [text, setText] = (0,
|
|
14631
|
-
(0,
|
|
14645
|
+
const [text, setText] = (0, import_react72.useState)(() => format(value));
|
|
14646
|
+
(0, import_react72.useEffect)(() => setText(format(value)), [value, format]);
|
|
14632
14647
|
const commit = (input) => {
|
|
14633
14648
|
const parsed = parse(input);
|
|
14634
14649
|
if (input.trim() === "" || parsed !== null) {
|
|
@@ -14737,7 +14752,7 @@ function LicensePositionBar({
|
|
|
14737
14752
|
}
|
|
14738
14753
|
|
|
14739
14754
|
// src/components/BrandProfiles.tsx
|
|
14740
|
-
var
|
|
14755
|
+
var import_react74 = require("react");
|
|
14741
14756
|
|
|
14742
14757
|
// src/color-model.ts
|
|
14743
14758
|
var clamp2 = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
@@ -14806,7 +14821,7 @@ function meetsContrast(background, foreground, minimum = 4.5) {
|
|
|
14806
14821
|
}
|
|
14807
14822
|
|
|
14808
14823
|
// src/components/ColorPicker.tsx
|
|
14809
|
-
var
|
|
14824
|
+
var import_react73 = require("react");
|
|
14810
14825
|
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
14811
14826
|
var DEFAULT_COLOR_PICKER_LABELS = {
|
|
14812
14827
|
trigger: "{label}: {color}",
|
|
@@ -14838,17 +14853,17 @@ function ColorPicker({
|
|
|
14838
14853
|
labels: labelOverrides
|
|
14839
14854
|
}) {
|
|
14840
14855
|
const labels = { ...DEFAULT_COLOR_PICKER_LABELS, ...labelOverrides };
|
|
14841
|
-
const id = (0,
|
|
14842
|
-
const triggerRef = (0,
|
|
14843
|
-
const dialogRef = (0,
|
|
14844
|
-
const [open, setOpen] = (0,
|
|
14856
|
+
const id = (0, import_react73.useId)();
|
|
14857
|
+
const triggerRef = (0, import_react73.useRef)(null);
|
|
14858
|
+
const dialogRef = (0, import_react73.useRef)(null);
|
|
14859
|
+
const [open, setOpen] = (0, import_react73.useState)(false);
|
|
14845
14860
|
const normalized = normalizeHex(value) ?? "#000000";
|
|
14846
|
-
const [hexText, setHexText] = (0,
|
|
14847
|
-
const hsv = (0,
|
|
14861
|
+
const [hexText, setHexText] = (0, import_react73.useState)(normalized);
|
|
14862
|
+
const hsv = (0, import_react73.useMemo)(() => rgbToHsv(hexToRgb(normalized)), [normalized]);
|
|
14848
14863
|
const ratio = contrastRatio(normalized, foreground) ?? 0;
|
|
14849
14864
|
const passes = ratio >= minimumContrast;
|
|
14850
|
-
(0,
|
|
14851
|
-
(0,
|
|
14865
|
+
(0, import_react73.useEffect)(() => setHexText(normalized), [normalized]);
|
|
14866
|
+
(0, import_react73.useEffect)(() => {
|
|
14852
14867
|
if (!open) return;
|
|
14853
14868
|
const dialog = dialogRef.current;
|
|
14854
14869
|
dialog?.querySelector("input,button")?.focus();
|
|
@@ -15068,7 +15083,7 @@ function BrandProfileEditor({
|
|
|
15068
15083
|
labels: labelOverrides
|
|
15069
15084
|
}) {
|
|
15070
15085
|
const labels = { ...DEFAULT_BRAND_PROFILE_EDITOR_LABELS, ...labelOverrides };
|
|
15071
|
-
const [announcement, setAnnouncement] = (0,
|
|
15086
|
+
const [announcement, setAnnouncement] = (0, import_react74.useState)("");
|
|
15072
15087
|
const update = (patch) => onChange({ ...value, ...patch });
|
|
15073
15088
|
const apply = () => {
|
|
15074
15089
|
if (applyTarget !== null) applyBrandProfile(value, applyTarget);
|
|
@@ -15140,7 +15155,7 @@ function BrandProfileEditor({
|
|
|
15140
15155
|
var BrandProfiles = BrandProfileEditor;
|
|
15141
15156
|
|
|
15142
15157
|
// src/components/DiffViewer.tsx
|
|
15143
|
-
var
|
|
15158
|
+
var import_react75 = require("react");
|
|
15144
15159
|
|
|
15145
15160
|
// src/diff-model.ts
|
|
15146
15161
|
function isJsonObject(value) {
|
|
@@ -15236,9 +15251,9 @@ function DiffViewer({
|
|
|
15236
15251
|
const labels = { ...DEFAULT_DIFF_VIEWER_LABELS, ...labelOverrides };
|
|
15237
15252
|
const resolutionLabel = { accept: labels.resolutionAccept, skip: labels.resolutionSkip, pending: labels.resolutionPending };
|
|
15238
15253
|
const buttonSize = controlSize === "md" ? void 0 : `uix-btn--${controlSize}`;
|
|
15239
|
-
const id = (0,
|
|
15240
|
-
const entries = (0,
|
|
15241
|
-
const [internalResolutions, setInternalResolutions] = (0,
|
|
15254
|
+
const id = (0, import_react75.useId)();
|
|
15255
|
+
const entries = (0, import_react75.useMemo)(() => providedEntries ?? buildThreeWayDiff(base, current, incoming), [providedEntries, base, current, incoming]);
|
|
15256
|
+
const [internalResolutions, setInternalResolutions] = (0, import_react75.useState)({});
|
|
15242
15257
|
const resolutions = controlledResolutions ?? internalResolutions;
|
|
15243
15258
|
const summary = summarizeDiff(entries, resolutions);
|
|
15244
15259
|
const resolve = (path, resolution) => {
|
|
@@ -15301,7 +15316,7 @@ function DiffViewer({
|
|
|
15301
15316
|
}
|
|
15302
15317
|
|
|
15303
15318
|
// src/components/TextDiff.tsx
|
|
15304
|
-
var
|
|
15319
|
+
var import_react76 = require("react");
|
|
15305
15320
|
|
|
15306
15321
|
// src/text-diff-model.ts
|
|
15307
15322
|
var WORD_TOKENS = /\s+|[\p{L}\p{M}\p{N}_]+|[^\s\p{L}\p{M}\p{N}_]/gu;
|
|
@@ -15580,7 +15595,7 @@ function Marked({ segments, side, labels, whole }) {
|
|
|
15580
15595
|
": "
|
|
15581
15596
|
] }),
|
|
15582
15597
|
segment.text
|
|
15583
|
-
] }, i) : /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
15598
|
+
] }, i) : /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(import_react76.Fragment, { children: segment.text }, i)) });
|
|
15584
15599
|
}
|
|
15585
15600
|
function Cell({ line, side, kind, labels }) {
|
|
15586
15601
|
if (!line) return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: "uix-text-diff__cell", "data-side": side, "data-empty": "", "aria-hidden": "true" });
|
|
@@ -15592,9 +15607,9 @@ function Cell({ line, side, kind, labels }) {
|
|
|
15592
15607
|
] });
|
|
15593
15608
|
}
|
|
15594
15609
|
function Rows({ rows, view, labels, focusFirst }) {
|
|
15595
|
-
const [open, setOpen] = (0,
|
|
15596
|
-
const first = (0,
|
|
15597
|
-
(0,
|
|
15610
|
+
const [open, setOpen] = (0, import_react76.useState)(() => /* @__PURE__ */ new Set());
|
|
15611
|
+
const first = (0, import_react76.useRef)(null);
|
|
15612
|
+
(0, import_react76.useEffect)(() => {
|
|
15598
15613
|
if (focusFirst) first.current?.focus();
|
|
15599
15614
|
}, [focusFirst]);
|
|
15600
15615
|
const firstProps = (index) => focusFirst && index === 0 ? { ref: first, tabIndex: -1 } : {};
|
|
@@ -15607,7 +15622,7 @@ function Rows({ rows, view, labels, focusFirst }) {
|
|
|
15607
15622
|
const after = row.kind === "delete" ? void 0 : row.after;
|
|
15608
15623
|
if (view === "unified") {
|
|
15609
15624
|
if (row.kind === "equal") return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: "uix-text-diff__row", "data-kind": "equal", ...firstProps(index), children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Cell, { line: after, side: "after", kind: "equal", labels }) }, index);
|
|
15610
|
-
return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(
|
|
15625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(import_react76.Fragment, { children: [
|
|
15611
15626
|
before && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: "uix-text-diff__row", "data-kind": "delete", children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Cell, { line: before, side: "before", kind: row.kind, labels }) }),
|
|
15612
15627
|
after && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: "uix-text-diff__row", "data-kind": "insert", children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Cell, { line: after, side: "after", kind: row.kind, labels }) })
|
|
15613
15628
|
] }, index);
|
|
@@ -15636,8 +15651,8 @@ function TextDiff({
|
|
|
15636
15651
|
}) {
|
|
15637
15652
|
const uixLabels = useUixLabels();
|
|
15638
15653
|
const labels = { ...DEFAULT_TEXT_DIFF_LABELS, ...uixLabels.textDiff, ...labelOverrides };
|
|
15639
|
-
const result = (0,
|
|
15640
|
-
const rows = (0,
|
|
15654
|
+
const result = (0, import_react76.useMemo)(() => diffText(before, after, { granularity, maxTokens, maxEdits }), [before, after, granularity, maxTokens, maxEdits]);
|
|
15655
|
+
const rows = (0, import_react76.useMemo)(() => granularity === "line" && result.status === "ok" ? textDiffRows(result, { context }) : [], [result, granularity, context]);
|
|
15641
15656
|
const heads = /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: "uix-text-diff__heads", "aria-hidden": view === "unified" || void 0, children: [
|
|
15642
15657
|
/* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("span", { className: "uix-text-diff__head", "data-side": "before", children: [
|
|
15643
15658
|
view === "unified" && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { "aria-hidden": "true", children: "\u2212 " }),
|
|
@@ -15655,7 +15670,7 @@ function TextDiff({
|
|
|
15655
15670
|
else {
|
|
15656
15671
|
const prose = (side2) => /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: "uix-text-diff__prose", "data-side": side2, children: result.ops.map((op, i) => {
|
|
15657
15672
|
const text = op.tokens.join("");
|
|
15658
|
-
if (op.type === "equal") return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
15673
|
+
if (op.type === "equal") return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(import_react76.Fragment, { children: text }, i);
|
|
15659
15674
|
if (op.type === "delete" && side2 === "after") return null;
|
|
15660
15675
|
if (op.type === "insert" && side2 === "before") return null;
|
|
15661
15676
|
return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Marked, { segments: [{ text, changed: true }], side: op.type === "delete" ? "before" : "after", labels }, i);
|