@deadragdoll/reactnu 0.1.18 → 0.1.30
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/dist/components/IconGrid/IconGrid.types.d.ts +35 -0
- package/dist/components/IconGrid/NuIconGrid.d.ts +7 -0
- package/dist/components/IconGrid/NuIconProvider.d.ts +6 -0
- package/dist/components/IconGrid/iconContext.d.ts +10 -0
- package/dist/components/IconGrid/index.d.ts +4 -0
- package/dist/components/PopupMenu/PopupMenu.d.ts +1 -0
- package/dist/components/PopupMenu/usePopupMenu.d.ts +1 -1
- package/dist/index.cjs +1127 -675
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1145 -686
- package/dist/styles.css +67 -5
- package/dist/theme/themes.d.ts +1 -0
- package/docs/API_REFERENCE.md +4 -0
- package/docs/COMPONENT_INDEX.md +1 -0
- package/docs/Desktop.md +13 -0
- package/docs/IconGrid.md +93 -0
- package/docs/NuThemeProvider.md +3 -1
- package/docs/PopupMenu.md +4 -1
- package/docs/TOKEN_CHECKLIST.md +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -41,6 +41,8 @@ __export(index_exports, {
|
|
|
41
41
|
NuCrtGlitch: () => NuCrtGlitch,
|
|
42
42
|
NuDesktop: () => NuDesktop,
|
|
43
43
|
NuGlyph: () => NuGlyph,
|
|
44
|
+
NuIconGrid: () => NuIconGrid,
|
|
45
|
+
NuIconProvider: () => NuIconProvider,
|
|
44
46
|
NuThemeContext: () => NuThemeContext,
|
|
45
47
|
NuThemeProvider: () => NuThemeProvider,
|
|
46
48
|
NuView: () => NuView,
|
|
@@ -83,6 +85,7 @@ __export(index_exports, {
|
|
|
83
85
|
resolveNuTheme: () => resolveNuTheme,
|
|
84
86
|
useAppHostMenu: () => useAppHostMenu,
|
|
85
87
|
useMainMenuState: () => useMainMenuState,
|
|
88
|
+
useNuIconManager: () => useNuIconManager,
|
|
86
89
|
useNuTheme: () => useNuTheme,
|
|
87
90
|
useNuWindowManager: () => useNuWindowManager,
|
|
88
91
|
usePopupMenu: () => usePopupMenu,
|
|
@@ -4318,7 +4321,10 @@ function InfoAccent({
|
|
|
4318
4321
|
);
|
|
4319
4322
|
}
|
|
4320
4323
|
|
|
4321
|
-
// src/components/
|
|
4324
|
+
// src/components/IconGrid/NuIconGrid.tsx
|
|
4325
|
+
var import_react25 = require("react");
|
|
4326
|
+
|
|
4327
|
+
// src/components/PopupMenu/PopupMenu.tsx
|
|
4322
4328
|
var import_react22 = require("react");
|
|
4323
4329
|
var import_react_dom2 = require("react-dom");
|
|
4324
4330
|
|
|
@@ -4345,8 +4351,629 @@ function getThemePortalStyle(anchor) {
|
|
|
4345
4351
|
return style;
|
|
4346
4352
|
}
|
|
4347
4353
|
|
|
4354
|
+
// src/components/PopupMenu/PopupMenu.tsx
|
|
4355
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4356
|
+
function hasVisibleChildren2(item) {
|
|
4357
|
+
return Boolean(item.items?.some((child) => !child.hidden));
|
|
4358
|
+
}
|
|
4359
|
+
function clamp(value, min, max) {
|
|
4360
|
+
return Math.min(max, Math.max(min, value));
|
|
4361
|
+
}
|
|
4362
|
+
function resolveAnchorPosition(anchor) {
|
|
4363
|
+
if (!anchor) {
|
|
4364
|
+
return null;
|
|
4365
|
+
}
|
|
4366
|
+
if (anchor.type === "point") {
|
|
4367
|
+
return {
|
|
4368
|
+
left: anchor.x,
|
|
4369
|
+
top: anchor.y
|
|
4370
|
+
};
|
|
4371
|
+
}
|
|
4372
|
+
const rect = anchor.element.getBoundingClientRect();
|
|
4373
|
+
return {
|
|
4374
|
+
left: rect.left,
|
|
4375
|
+
top: rect.bottom - 1
|
|
4376
|
+
};
|
|
4377
|
+
}
|
|
4378
|
+
function resolvePortalRoot() {
|
|
4379
|
+
if (typeof document === "undefined") {
|
|
4380
|
+
return null;
|
|
4381
|
+
}
|
|
4382
|
+
return document.body;
|
|
4383
|
+
}
|
|
4384
|
+
function PopupMenu({
|
|
4385
|
+
anchor,
|
|
4386
|
+
className,
|
|
4387
|
+
defaultOpen = false,
|
|
4388
|
+
items,
|
|
4389
|
+
onItemSelect,
|
|
4390
|
+
onOpenChange,
|
|
4391
|
+
open,
|
|
4392
|
+
style: styleProp,
|
|
4393
|
+
uncheckedShape = "box",
|
|
4394
|
+
...props
|
|
4395
|
+
}) {
|
|
4396
|
+
const rootRef = (0, import_react22.useRef)(null);
|
|
4397
|
+
const [activePath, setActivePath] = (0, import_react22.useState)([]);
|
|
4398
|
+
const [uncontrolledOpen, setUncontrolledOpen] = (0, import_react22.useState)(defaultOpen);
|
|
4399
|
+
const isControlled = open !== void 0;
|
|
4400
|
+
const resolvedOpen = isControlled ? open : uncontrolledOpen;
|
|
4401
|
+
const portalRoot = resolvePortalRoot();
|
|
4402
|
+
const setResolvedOpen = (0, import_react22.useCallback)(
|
|
4403
|
+
(nextOpen) => {
|
|
4404
|
+
if (!nextOpen) {
|
|
4405
|
+
setActivePath([]);
|
|
4406
|
+
}
|
|
4407
|
+
if (!isControlled) {
|
|
4408
|
+
setUncontrolledOpen(nextOpen);
|
|
4409
|
+
}
|
|
4410
|
+
onOpenChange?.(nextOpen);
|
|
4411
|
+
},
|
|
4412
|
+
[isControlled, onOpenChange]
|
|
4413
|
+
);
|
|
4414
|
+
(0, import_react22.useEffect)(() => {
|
|
4415
|
+
if (!resolvedOpen) {
|
|
4416
|
+
return;
|
|
4417
|
+
}
|
|
4418
|
+
function handlePointerDown(event) {
|
|
4419
|
+
if (!rootRef.current?.contains(event.target)) {
|
|
4420
|
+
setResolvedOpen(false);
|
|
4421
|
+
}
|
|
4422
|
+
}
|
|
4423
|
+
function handleKeyDown(event) {
|
|
4424
|
+
if (event.key === "Escape") {
|
|
4425
|
+
setResolvedOpen(false);
|
|
4426
|
+
}
|
|
4427
|
+
}
|
|
4428
|
+
document.addEventListener("pointerdown", handlePointerDown);
|
|
4429
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
4430
|
+
return () => {
|
|
4431
|
+
document.removeEventListener("pointerdown", handlePointerDown);
|
|
4432
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
4433
|
+
};
|
|
4434
|
+
}, [resolvedOpen, setResolvedOpen]);
|
|
4435
|
+
(0, import_react22.useLayoutEffect)(() => {
|
|
4436
|
+
if (!resolvedOpen || !anchor || !rootRef.current) {
|
|
4437
|
+
return;
|
|
4438
|
+
}
|
|
4439
|
+
const rootNode = rootRef.current;
|
|
4440
|
+
function updatePosition() {
|
|
4441
|
+
const anchorPosition = resolveAnchorPosition(anchor);
|
|
4442
|
+
if (!anchorPosition) {
|
|
4443
|
+
return;
|
|
4444
|
+
}
|
|
4445
|
+
const viewportRect = getPortalViewportRect(portalRoot);
|
|
4446
|
+
const relativePosition = toPortalCoordinates(portalRoot, anchorPosition);
|
|
4447
|
+
const rect = rootNode.getBoundingClientRect();
|
|
4448
|
+
const maxLeft = Math.max(0, viewportRect.width - rect.width);
|
|
4449
|
+
const maxTop = Math.max(0, viewportRect.height - rect.height);
|
|
4450
|
+
rootNode.style.left = `${clamp(relativePosition.left, 0, maxLeft)}px`;
|
|
4451
|
+
rootNode.style.top = `${clamp(relativePosition.top, 0, maxTop)}px`;
|
|
4452
|
+
rootNode.style.visibility = "visible";
|
|
4453
|
+
}
|
|
4454
|
+
rootNode.style.left = "0px";
|
|
4455
|
+
rootNode.style.top = "0px";
|
|
4456
|
+
rootNode.style.visibility = "hidden";
|
|
4457
|
+
updatePosition();
|
|
4458
|
+
window.addEventListener("resize", updatePosition);
|
|
4459
|
+
window.addEventListener("scroll", updatePosition, true);
|
|
4460
|
+
return () => {
|
|
4461
|
+
window.removeEventListener("resize", updatePosition);
|
|
4462
|
+
window.removeEventListener("scroll", updatePosition, true);
|
|
4463
|
+
};
|
|
4464
|
+
}, [anchor, portalRoot, resolvedOpen]);
|
|
4465
|
+
function handleActivateItem(item, level) {
|
|
4466
|
+
if (item.disabled) {
|
|
4467
|
+
return;
|
|
4468
|
+
}
|
|
4469
|
+
if (hasVisibleChildren2(item)) {
|
|
4470
|
+
setActivePath(
|
|
4471
|
+
(currentPath) => currentPath[level] === item.id ? currentPath.slice(0, level) : [...currentPath.slice(0, level), item.id]
|
|
4472
|
+
);
|
|
4473
|
+
return;
|
|
4474
|
+
}
|
|
4475
|
+
item.onSelect?.();
|
|
4476
|
+
onItemSelect?.(item);
|
|
4477
|
+
setResolvedOpen(false);
|
|
4478
|
+
}
|
|
4479
|
+
function handleHoverItem(item, level) {
|
|
4480
|
+
if (item.disabled) {
|
|
4481
|
+
return;
|
|
4482
|
+
}
|
|
4483
|
+
setActivePath((currentPath) => [...currentPath.slice(0, level), item.id]);
|
|
4484
|
+
}
|
|
4485
|
+
if (!resolvedOpen || !anchor || !portalRoot || items.every((item) => item.hidden)) {
|
|
4486
|
+
return null;
|
|
4487
|
+
}
|
|
4488
|
+
return (0, import_react_dom2.createPortal)(
|
|
4489
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4490
|
+
"div",
|
|
4491
|
+
{
|
|
4492
|
+
...props,
|
|
4493
|
+
className: ["nu-popup-menu", className].filter(Boolean).join(" "),
|
|
4494
|
+
onContextMenu: (event) => event.preventDefault(),
|
|
4495
|
+
ref: rootRef,
|
|
4496
|
+
style: {
|
|
4497
|
+
...getThemePortalStyle(
|
|
4498
|
+
anchor.type === "element" ? anchor.element : anchor.themeSource ?? null
|
|
4499
|
+
),
|
|
4500
|
+
...styleProp,
|
|
4501
|
+
left: 0,
|
|
4502
|
+
top: 0,
|
|
4503
|
+
visibility: "hidden"
|
|
4504
|
+
},
|
|
4505
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "nu-popup-menu__shell", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4506
|
+
MainMenuList,
|
|
4507
|
+
{
|
|
4508
|
+
activePath,
|
|
4509
|
+
items,
|
|
4510
|
+
level: 0,
|
|
4511
|
+
onActivateItem: handleActivateItem,
|
|
4512
|
+
onHoverItem: handleHoverItem,
|
|
4513
|
+
rootVariant: "popup",
|
|
4514
|
+
uncheckedShape
|
|
4515
|
+
}
|
|
4516
|
+
) })
|
|
4517
|
+
}
|
|
4518
|
+
),
|
|
4519
|
+
portalRoot
|
|
4520
|
+
);
|
|
4521
|
+
}
|
|
4522
|
+
|
|
4523
|
+
// src/components/PopupMenu/usePopupMenu.ts
|
|
4524
|
+
var import_react23 = require("react");
|
|
4525
|
+
function usePopupMenu() {
|
|
4526
|
+
const [anchor, setAnchor] = (0, import_react23.useState)(null);
|
|
4527
|
+
const [open, setOpen] = (0, import_react23.useState)(false);
|
|
4528
|
+
function close() {
|
|
4529
|
+
setOpen(false);
|
|
4530
|
+
}
|
|
4531
|
+
function openAtPoint(x, y, themeSource) {
|
|
4532
|
+
setAnchor({
|
|
4533
|
+
themeSource,
|
|
4534
|
+
type: "point",
|
|
4535
|
+
x,
|
|
4536
|
+
y
|
|
4537
|
+
});
|
|
4538
|
+
setOpen(true);
|
|
4539
|
+
}
|
|
4540
|
+
function openAtElement(element) {
|
|
4541
|
+
setAnchor({
|
|
4542
|
+
element,
|
|
4543
|
+
type: "element"
|
|
4544
|
+
});
|
|
4545
|
+
setOpen(true);
|
|
4546
|
+
}
|
|
4547
|
+
function openFromClick(event) {
|
|
4548
|
+
openAtElement(event.currentTarget);
|
|
4549
|
+
}
|
|
4550
|
+
function openFromContextMenu(event) {
|
|
4551
|
+
event.preventDefault();
|
|
4552
|
+
openAtPoint(event.clientX, event.clientY, event.currentTarget);
|
|
4553
|
+
}
|
|
4554
|
+
return {
|
|
4555
|
+
anchor,
|
|
4556
|
+
close,
|
|
4557
|
+
open,
|
|
4558
|
+
openAtElement,
|
|
4559
|
+
openAtPoint,
|
|
4560
|
+
openFromClick,
|
|
4561
|
+
openFromContextMenu,
|
|
4562
|
+
setOpen
|
|
4563
|
+
};
|
|
4564
|
+
}
|
|
4565
|
+
|
|
4566
|
+
// src/components/IconGrid/iconContext.ts
|
|
4567
|
+
var import_react24 = require("react");
|
|
4568
|
+
var NuIconContext = (0, import_react24.createContext)(null);
|
|
4569
|
+
function useNuIconContext() {
|
|
4570
|
+
const context = (0, import_react24.useContext)(NuIconContext);
|
|
4571
|
+
if (!context) {
|
|
4572
|
+
throw new Error("useNuIconManager must be used within a NuIconProvider.");
|
|
4573
|
+
}
|
|
4574
|
+
return context;
|
|
4575
|
+
}
|
|
4576
|
+
function useNuIconManager() {
|
|
4577
|
+
return useNuIconContext();
|
|
4578
|
+
}
|
|
4579
|
+
function useNuIconGridContext() {
|
|
4580
|
+
return useNuIconContext();
|
|
4581
|
+
}
|
|
4582
|
+
|
|
4583
|
+
// src/components/IconGrid/NuIconGrid.tsx
|
|
4584
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4585
|
+
var DRAG_THRESHOLD = 3;
|
|
4586
|
+
function clamp2(value, minimum, maximum) {
|
|
4587
|
+
return Math.min(Math.max(value, minimum), maximum);
|
|
4588
|
+
}
|
|
4589
|
+
function resolveIconContextMenuItems(source, icon) {
|
|
4590
|
+
return typeof source === "function" ? source(icon) : source ?? [];
|
|
4591
|
+
}
|
|
4592
|
+
function resolveGridContextMenuItems(source, manager) {
|
|
4593
|
+
return typeof source === "function" ? source(manager) : source ?? [];
|
|
4594
|
+
}
|
|
4595
|
+
function NuIconGridItem({ gridElement, icon }) {
|
|
4596
|
+
const manager = useNuIconGridContext();
|
|
4597
|
+
const contextMenu = usePopupMenu();
|
|
4598
|
+
const dragStartRef = (0, import_react25.useRef)(void 0);
|
|
4599
|
+
const isDraggingRef = (0, import_react25.useRef)(false);
|
|
4600
|
+
const [isDragging, setIsDragging] = (0, import_react25.useState)(false);
|
|
4601
|
+
const suppressClickRef = (0, import_react25.useRef)(false);
|
|
4602
|
+
const latestPositionRef = (0, import_react25.useRef)(icon.position);
|
|
4603
|
+
const contextMenuItems = resolveIconContextMenuItems(
|
|
4604
|
+
icon.contextMenuItems,
|
|
4605
|
+
icon
|
|
4606
|
+
);
|
|
4607
|
+
function handlePointerDown(event) {
|
|
4608
|
+
if (event.button !== 0 || icon.disabled) {
|
|
4609
|
+
return;
|
|
4610
|
+
}
|
|
4611
|
+
manager.selectIcon(icon.id);
|
|
4612
|
+
latestPositionRef.current = icon.position;
|
|
4613
|
+
isDraggingRef.current = false;
|
|
4614
|
+
dragStartRef.current = {
|
|
4615
|
+
clientX: event.clientX,
|
|
4616
|
+
clientY: event.clientY,
|
|
4617
|
+
pointerId: event.pointerId,
|
|
4618
|
+
position: icon.position
|
|
4619
|
+
};
|
|
4620
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
4621
|
+
}
|
|
4622
|
+
function handlePointerMove(event) {
|
|
4623
|
+
const dragStart = dragStartRef.current;
|
|
4624
|
+
if (!dragStart || dragStart.pointerId !== event.pointerId || !gridElement) {
|
|
4625
|
+
return;
|
|
4626
|
+
}
|
|
4627
|
+
const deltaX = event.clientX - dragStart.clientX;
|
|
4628
|
+
const deltaY = event.clientY - dragStart.clientY;
|
|
4629
|
+
if (!isDraggingRef.current && Math.max(Math.abs(deltaX), Math.abs(deltaY)) < DRAG_THRESHOLD) {
|
|
4630
|
+
return;
|
|
4631
|
+
}
|
|
4632
|
+
isDraggingRef.current = true;
|
|
4633
|
+
setIsDragging(true);
|
|
4634
|
+
const gridRect = gridElement.getBoundingClientRect();
|
|
4635
|
+
const iconRect = event.currentTarget.getBoundingClientRect();
|
|
4636
|
+
const position = {
|
|
4637
|
+
x: Math.round(
|
|
4638
|
+
clamp2(
|
|
4639
|
+
dragStart.position.x + deltaX,
|
|
4640
|
+
0,
|
|
4641
|
+
Math.max(0, gridRect.width - iconRect.width)
|
|
4642
|
+
)
|
|
4643
|
+
),
|
|
4644
|
+
y: Math.round(
|
|
4645
|
+
clamp2(
|
|
4646
|
+
dragStart.position.y + deltaY,
|
|
4647
|
+
0,
|
|
4648
|
+
Math.max(0, gridRect.height - iconRect.height)
|
|
4649
|
+
)
|
|
4650
|
+
)
|
|
4651
|
+
};
|
|
4652
|
+
latestPositionRef.current = position;
|
|
4653
|
+
manager.moveIcon(icon.id, position);
|
|
4654
|
+
}
|
|
4655
|
+
function finishDragging(event) {
|
|
4656
|
+
const dragStart = dragStartRef.current;
|
|
4657
|
+
if (!dragStart || dragStart.pointerId !== event.pointerId) {
|
|
4658
|
+
return;
|
|
4659
|
+
}
|
|
4660
|
+
if (event.currentTarget.hasPointerCapture(event.pointerId)) {
|
|
4661
|
+
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
4662
|
+
}
|
|
4663
|
+
dragStartRef.current = void 0;
|
|
4664
|
+
if (!isDraggingRef.current) {
|
|
4665
|
+
return;
|
|
4666
|
+
}
|
|
4667
|
+
suppressClickRef.current = true;
|
|
4668
|
+
isDraggingRef.current = false;
|
|
4669
|
+
setIsDragging(false);
|
|
4670
|
+
icon.onPositionChange?.(latestPositionRef.current, {
|
|
4671
|
+
...icon,
|
|
4672
|
+
position: latestPositionRef.current
|
|
4673
|
+
});
|
|
4674
|
+
}
|
|
4675
|
+
function handleClick(event) {
|
|
4676
|
+
if (suppressClickRef.current) {
|
|
4677
|
+
suppressClickRef.current = false;
|
|
4678
|
+
event.preventDefault();
|
|
4679
|
+
return;
|
|
4680
|
+
}
|
|
4681
|
+
manager.selectIcon(icon.id);
|
|
4682
|
+
icon.onClick?.(event);
|
|
4683
|
+
}
|
|
4684
|
+
function handleContextMenu(event) {
|
|
4685
|
+
event.stopPropagation();
|
|
4686
|
+
manager.selectIcon(icon.id);
|
|
4687
|
+
icon.onContextMenu?.(event);
|
|
4688
|
+
if (event.defaultPrevented || contextMenuItems.length === 0) {
|
|
4689
|
+
return;
|
|
4690
|
+
}
|
|
4691
|
+
event.preventDefault();
|
|
4692
|
+
contextMenu.openAtPoint(event.clientX, event.clientY, event.currentTarget);
|
|
4693
|
+
}
|
|
4694
|
+
function handleKeyDown(event) {
|
|
4695
|
+
if (event.key !== "ContextMenu" && !(event.key === "F10" && event.shiftKey) || contextMenuItems.length === 0) {
|
|
4696
|
+
return;
|
|
4697
|
+
}
|
|
4698
|
+
event.preventDefault();
|
|
4699
|
+
manager.selectIcon(icon.id);
|
|
4700
|
+
contextMenu.openAtElement(event.currentTarget);
|
|
4701
|
+
}
|
|
4702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
4703
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
4704
|
+
"button",
|
|
4705
|
+
{
|
|
4706
|
+
"aria-haspopup": contextMenuItems.length > 0 ? "menu" : void 0,
|
|
4707
|
+
className: "nu-icon-grid__icon",
|
|
4708
|
+
"data-dragging": isDragging || void 0,
|
|
4709
|
+
"data-selected": manager.selectedIconId === icon.id || void 0,
|
|
4710
|
+
disabled: icon.disabled,
|
|
4711
|
+
onClick: handleClick,
|
|
4712
|
+
onContextMenu: handleContextMenu,
|
|
4713
|
+
onDoubleClick: icon.onDoubleClick,
|
|
4714
|
+
onKeyDown: handleKeyDown,
|
|
4715
|
+
onPointerDown: handlePointerDown,
|
|
4716
|
+
onPointerMove: handlePointerMove,
|
|
4717
|
+
onPointerUp: finishDragging,
|
|
4718
|
+
onPointerCancel: finishDragging,
|
|
4719
|
+
style: { left: icon.position.x, top: icon.position.y },
|
|
4720
|
+
type: "button",
|
|
4721
|
+
children: [
|
|
4722
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { "aria-hidden": "true", className: "nu-icon-grid__glyph", children: typeof icon.icon === "string" ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("img", { alt: "", draggable: false, src: icon.icon }) : icon.icon }),
|
|
4723
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "nu-icon-grid__label", children: renderMnemonicText(icon.label) })
|
|
4724
|
+
]
|
|
4725
|
+
}
|
|
4726
|
+
),
|
|
4727
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4728
|
+
PopupMenu,
|
|
4729
|
+
{
|
|
4730
|
+
anchor: contextMenu.anchor,
|
|
4731
|
+
items: contextMenuItems,
|
|
4732
|
+
onOpenChange: contextMenu.setOpen,
|
|
4733
|
+
open: contextMenu.open
|
|
4734
|
+
}
|
|
4735
|
+
)
|
|
4736
|
+
] });
|
|
4737
|
+
}
|
|
4738
|
+
function NuIconGrid({
|
|
4739
|
+
className,
|
|
4740
|
+
contextMenuItems: contextMenuItemsSource,
|
|
4741
|
+
defaultArrangeMode,
|
|
4742
|
+
onContextMenu,
|
|
4743
|
+
onPointerDown,
|
|
4744
|
+
...props
|
|
4745
|
+
}) {
|
|
4746
|
+
const [gridElement, setGridElement] = (0, import_react25.useState)(null);
|
|
4747
|
+
const manager = useNuIconGridContext();
|
|
4748
|
+
const hasAppliedDefaultArrangementRef = (0, import_react25.useRef)(false);
|
|
4749
|
+
const arrangeIcons = manager.arrangeIcons;
|
|
4750
|
+
const setGridSize = manager.setGridSize;
|
|
4751
|
+
const contextMenu = usePopupMenu();
|
|
4752
|
+
const contextMenuItems = (0, import_react25.useMemo)(
|
|
4753
|
+
() => resolveGridContextMenuItems(contextMenuItemsSource, manager),
|
|
4754
|
+
[contextMenuItemsSource, manager]
|
|
4755
|
+
);
|
|
4756
|
+
(0, import_react25.useLayoutEffect)(() => {
|
|
4757
|
+
if (!gridElement) {
|
|
4758
|
+
return;
|
|
4759
|
+
}
|
|
4760
|
+
const activeGridElement = gridElement;
|
|
4761
|
+
function updateGridSize() {
|
|
4762
|
+
const size = {
|
|
4763
|
+
height: activeGridElement.clientHeight,
|
|
4764
|
+
width: activeGridElement.clientWidth
|
|
4765
|
+
};
|
|
4766
|
+
setGridSize(size);
|
|
4767
|
+
if (defaultArrangeMode && !hasAppliedDefaultArrangementRef.current && size.height > 0 && size.width > 0) {
|
|
4768
|
+
hasAppliedDefaultArrangementRef.current = true;
|
|
4769
|
+
arrangeIcons(defaultArrangeMode);
|
|
4770
|
+
}
|
|
4771
|
+
}
|
|
4772
|
+
updateGridSize();
|
|
4773
|
+
const resizeObserver = new ResizeObserver(updateGridSize);
|
|
4774
|
+
resizeObserver.observe(gridElement);
|
|
4775
|
+
return () => resizeObserver.disconnect();
|
|
4776
|
+
}, [arrangeIcons, defaultArrangeMode, gridElement, setGridSize]);
|
|
4777
|
+
function handleContextMenu(event) {
|
|
4778
|
+
onContextMenu?.(event);
|
|
4779
|
+
if (event.defaultPrevented || contextMenuItems.length === 0) {
|
|
4780
|
+
return;
|
|
4781
|
+
}
|
|
4782
|
+
event.preventDefault();
|
|
4783
|
+
manager.selectIcon(null);
|
|
4784
|
+
contextMenu.openAtPoint(event.clientX, event.clientY, event.currentTarget);
|
|
4785
|
+
}
|
|
4786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
4787
|
+
"div",
|
|
4788
|
+
{
|
|
4789
|
+
...props,
|
|
4790
|
+
"aria-label": props["aria-label"] ?? "Application icons",
|
|
4791
|
+
className: ["nu-icon-grid", className].filter(Boolean).join(" "),
|
|
4792
|
+
onContextMenu: handleContextMenu,
|
|
4793
|
+
onPointerDown: (event) => {
|
|
4794
|
+
onPointerDown?.(event);
|
|
4795
|
+
if (event.defaultPrevented) {
|
|
4796
|
+
return;
|
|
4797
|
+
}
|
|
4798
|
+
if (event.target === event.currentTarget) {
|
|
4799
|
+
manager.selectIcon(null);
|
|
4800
|
+
}
|
|
4801
|
+
},
|
|
4802
|
+
ref: setGridElement,
|
|
4803
|
+
role: "group",
|
|
4804
|
+
children: [
|
|
4805
|
+
manager.icons.map((icon) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(NuIconGridItem, { gridElement, icon }, icon.id)),
|
|
4806
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4807
|
+
PopupMenu,
|
|
4808
|
+
{
|
|
4809
|
+
anchor: contextMenu.anchor,
|
|
4810
|
+
items: contextMenuItems,
|
|
4811
|
+
onOpenChange: contextMenu.setOpen,
|
|
4812
|
+
open: contextMenu.open
|
|
4813
|
+
}
|
|
4814
|
+
)
|
|
4815
|
+
]
|
|
4816
|
+
}
|
|
4817
|
+
);
|
|
4818
|
+
}
|
|
4819
|
+
|
|
4820
|
+
// src/components/IconGrid/NuIconProvider.tsx
|
|
4821
|
+
var import_react26 = require("react");
|
|
4822
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
4823
|
+
var GRID_PADDING = 12;
|
|
4824
|
+
var ICON_CELL_HEIGHT = 104;
|
|
4825
|
+
var ICON_CELL_WIDTH = 104;
|
|
4826
|
+
function getDefaultPosition(index) {
|
|
4827
|
+
return {
|
|
4828
|
+
x: GRID_PADDING + Math.floor(index / 6) * ICON_CELL_WIDTH,
|
|
4829
|
+
y: GRID_PADDING + index % 6 * ICON_CELL_HEIGHT
|
|
4830
|
+
};
|
|
4831
|
+
}
|
|
4832
|
+
function getIconInfo(definition, index, id) {
|
|
4833
|
+
return {
|
|
4834
|
+
...definition,
|
|
4835
|
+
id,
|
|
4836
|
+
position: definition.position ?? getDefaultPosition(index)
|
|
4837
|
+
};
|
|
4838
|
+
}
|
|
4839
|
+
function getInitialIcons(definitions) {
|
|
4840
|
+
const ids = /* @__PURE__ */ new Set();
|
|
4841
|
+
return definitions.map((definition, index) => {
|
|
4842
|
+
const baseId = definition.id ?? `nu-icon-${index + 1}`;
|
|
4843
|
+
let id = baseId;
|
|
4844
|
+
let duplicateIndex = 2;
|
|
4845
|
+
while (ids.has(id)) {
|
|
4846
|
+
id = `${baseId}-${duplicateIndex}`;
|
|
4847
|
+
duplicateIndex += 1;
|
|
4848
|
+
}
|
|
4849
|
+
ids.add(id);
|
|
4850
|
+
return getIconInfo(definition, index, id);
|
|
4851
|
+
});
|
|
4852
|
+
}
|
|
4853
|
+
function getArrangedPositions(icons, mode, gridSize) {
|
|
4854
|
+
const orderedIcons = mode === "name" ? [...icons].sort(
|
|
4855
|
+
(left, right) => left.label.localeCompare(right.label, void 0, {
|
|
4856
|
+
numeric: true,
|
|
4857
|
+
sensitivity: "base"
|
|
4858
|
+
})
|
|
4859
|
+
) : icons;
|
|
4860
|
+
const cellsPerLine = Math.max(
|
|
4861
|
+
1,
|
|
4862
|
+
Math.floor(
|
|
4863
|
+
((mode === "rows" ? gridSize.width : gridSize.height) - GRID_PADDING * 2) / (mode === "rows" ? ICON_CELL_WIDTH : ICON_CELL_HEIGHT)
|
|
4864
|
+
)
|
|
4865
|
+
);
|
|
4866
|
+
return new Map(
|
|
4867
|
+
orderedIcons.map((icon, index) => {
|
|
4868
|
+
const lineIndex = index % cellsPerLine;
|
|
4869
|
+
const crossIndex = Math.floor(index / cellsPerLine);
|
|
4870
|
+
return [
|
|
4871
|
+
icon.id,
|
|
4872
|
+
mode === "rows" ? {
|
|
4873
|
+
x: GRID_PADDING + lineIndex * ICON_CELL_WIDTH,
|
|
4874
|
+
y: GRID_PADDING + crossIndex * ICON_CELL_HEIGHT
|
|
4875
|
+
} : {
|
|
4876
|
+
x: GRID_PADDING + crossIndex * ICON_CELL_WIDTH,
|
|
4877
|
+
y: GRID_PADDING + lineIndex * ICON_CELL_HEIGHT
|
|
4878
|
+
}
|
|
4879
|
+
];
|
|
4880
|
+
})
|
|
4881
|
+
);
|
|
4882
|
+
}
|
|
4883
|
+
function NuIconProvider({
|
|
4884
|
+
children,
|
|
4885
|
+
defaultIcons = []
|
|
4886
|
+
}) {
|
|
4887
|
+
const idRef = (0, import_react26.useRef)(defaultIcons.length);
|
|
4888
|
+
const gridSizeRef = (0, import_react26.useRef)({ height: 0, width: 0 });
|
|
4889
|
+
const [icons, setIcons] = (0, import_react26.useState)(
|
|
4890
|
+
() => getInitialIcons(defaultIcons)
|
|
4891
|
+
);
|
|
4892
|
+
const [selectedIconId, setSelectedIconId] = (0, import_react26.useState)(null);
|
|
4893
|
+
const addIcon = (0, import_react26.useCallback)((definition) => {
|
|
4894
|
+
const id = definition.id ?? `nu-icon-${++idRef.current}`;
|
|
4895
|
+
setIcons((currentIcons) => {
|
|
4896
|
+
if (currentIcons.some((icon) => icon.id === id)) {
|
|
4897
|
+
throw new Error(`An icon with id "${id}" already exists.`);
|
|
4898
|
+
}
|
|
4899
|
+
return [
|
|
4900
|
+
...currentIcons,
|
|
4901
|
+
getIconInfo(definition, currentIcons.length, id)
|
|
4902
|
+
];
|
|
4903
|
+
});
|
|
4904
|
+
return id;
|
|
4905
|
+
}, []);
|
|
4906
|
+
const moveIcon = (0, import_react26.useCallback)((id, position) => {
|
|
4907
|
+
setIcons(
|
|
4908
|
+
(currentIcons) => currentIcons.map(
|
|
4909
|
+
(icon) => icon.id === id ? { ...icon, position } : icon
|
|
4910
|
+
)
|
|
4911
|
+
);
|
|
4912
|
+
}, []);
|
|
4913
|
+
const removeIcon = (0, import_react26.useCallback)((id) => {
|
|
4914
|
+
setIcons((currentIcons) => currentIcons.filter((icon) => icon.id !== id));
|
|
4915
|
+
setSelectedIconId((currentId) => currentId === id ? null : currentId);
|
|
4916
|
+
}, []);
|
|
4917
|
+
const updateIcon = (0, import_react26.useCallback)(
|
|
4918
|
+
(id, patch) => {
|
|
4919
|
+
setIcons(
|
|
4920
|
+
(currentIcons) => currentIcons.map(
|
|
4921
|
+
(icon) => icon.id === id ? {
|
|
4922
|
+
...icon,
|
|
4923
|
+
...patch,
|
|
4924
|
+
position: patch.position ?? icon.position
|
|
4925
|
+
} : icon
|
|
4926
|
+
)
|
|
4927
|
+
);
|
|
4928
|
+
},
|
|
4929
|
+
[]
|
|
4930
|
+
);
|
|
4931
|
+
const arrangeIcons = (0, import_react26.useCallback)((mode = "columns") => {
|
|
4932
|
+
setIcons((currentIcons) => {
|
|
4933
|
+
const positions = getArrangedPositions(
|
|
4934
|
+
currentIcons,
|
|
4935
|
+
mode,
|
|
4936
|
+
gridSizeRef.current
|
|
4937
|
+
);
|
|
4938
|
+
return currentIcons.map((icon) => ({
|
|
4939
|
+
...icon,
|
|
4940
|
+
position: positions.get(icon.id) ?? icon.position
|
|
4941
|
+
}));
|
|
4942
|
+
});
|
|
4943
|
+
}, []);
|
|
4944
|
+
const setGridSize = (0, import_react26.useCallback)((size) => {
|
|
4945
|
+
gridSizeRef.current = size;
|
|
4946
|
+
}, []);
|
|
4947
|
+
const contextValue = (0, import_react26.useMemo)(
|
|
4948
|
+
() => ({
|
|
4949
|
+
addIcon,
|
|
4950
|
+
arrangeIcons,
|
|
4951
|
+
icons,
|
|
4952
|
+
moveIcon,
|
|
4953
|
+
removeIcon,
|
|
4954
|
+
selectedIconId,
|
|
4955
|
+
selectIcon: setSelectedIconId,
|
|
4956
|
+
setGridSize,
|
|
4957
|
+
updateIcon
|
|
4958
|
+
}),
|
|
4959
|
+
[
|
|
4960
|
+
addIcon,
|
|
4961
|
+
arrangeIcons,
|
|
4962
|
+
icons,
|
|
4963
|
+
moveIcon,
|
|
4964
|
+
removeIcon,
|
|
4965
|
+
selectedIconId,
|
|
4966
|
+
setGridSize,
|
|
4967
|
+
updateIcon
|
|
4968
|
+
]
|
|
4969
|
+
);
|
|
4970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(NuIconContext.Provider, { value: contextValue, children });
|
|
4971
|
+
}
|
|
4972
|
+
|
|
4348
4973
|
// src/components/ComboBox/ComboBox.tsx
|
|
4349
|
-
var
|
|
4974
|
+
var import_react27 = require("react");
|
|
4975
|
+
var import_react_dom3 = require("react-dom");
|
|
4976
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4350
4977
|
function flattenComboBoxOptions(data) {
|
|
4351
4978
|
const options = [];
|
|
4352
4979
|
data.forEach((group) => {
|
|
@@ -4387,31 +5014,31 @@ function ComboBox({
|
|
|
4387
5014
|
value,
|
|
4388
5015
|
...props
|
|
4389
5016
|
}) {
|
|
4390
|
-
const rootRef = (0,
|
|
4391
|
-
const inputRef = (0,
|
|
4392
|
-
const fieldRef = (0,
|
|
4393
|
-
const popupRef = (0,
|
|
4394
|
-
const generatedId = (0,
|
|
5017
|
+
const rootRef = (0, import_react27.useRef)(null);
|
|
5018
|
+
const inputRef = (0, import_react27.useRef)(null);
|
|
5019
|
+
const fieldRef = (0, import_react27.useRef)(null);
|
|
5020
|
+
const popupRef = (0, import_react27.useRef)(null);
|
|
5021
|
+
const generatedId = (0, import_react27.useId)();
|
|
4395
5022
|
const fieldId = `${generatedId}-combo-box`;
|
|
4396
5023
|
const labelId = `${fieldId}-label`;
|
|
4397
5024
|
const hintId = hint ? `${fieldId}-hint` : void 0;
|
|
4398
|
-
const [open, setOpen] = (0,
|
|
4399
|
-
const options = (0,
|
|
5025
|
+
const [open, setOpen] = (0, import_react27.useState)(false);
|
|
5026
|
+
const options = (0, import_react27.useMemo)(() => flattenComboBoxOptions(data), [data]);
|
|
4400
5027
|
const isValueControlled = value !== void 0;
|
|
4401
5028
|
const isInputControlled = inputValueProp !== void 0;
|
|
4402
|
-
const [uncontrolledValue, setUncontrolledValue] = (0,
|
|
5029
|
+
const [uncontrolledValue, setUncontrolledValue] = (0, import_react27.useState)(() => defaultValue);
|
|
4403
5030
|
const initialSelectedOption = findComboBoxOption(options, defaultValue);
|
|
4404
|
-
const [uncontrolledInputValue, setUncontrolledInputValue] = (0,
|
|
5031
|
+
const [uncontrolledInputValue, setUncontrolledInputValue] = (0, import_react27.useState)(
|
|
4405
5032
|
() => defaultInputValue ?? initialSelectedOption?.item.name.text ?? ""
|
|
4406
5033
|
);
|
|
4407
5034
|
const resolvedValue = isValueControlled ? value : uncontrolledValue;
|
|
4408
|
-
const selectedOption = (0,
|
|
5035
|
+
const selectedOption = (0, import_react27.useMemo)(
|
|
4409
5036
|
() => findComboBoxOption(options, resolvedValue),
|
|
4410
5037
|
[options, resolvedValue]
|
|
4411
5038
|
);
|
|
4412
5039
|
const resolvedInputValue = isInputControlled ? inputValueProp ?? "" : uncontrolledInputValue;
|
|
4413
5040
|
const normalizedFilter = resolvedInputValue.trim().toLowerCase();
|
|
4414
|
-
const filteredData = (0,
|
|
5041
|
+
const filteredData = (0, import_react27.useMemo)(() => {
|
|
4415
5042
|
if (!normalizedFilter) {
|
|
4416
5043
|
return data;
|
|
4417
5044
|
}
|
|
@@ -4422,15 +5049,15 @@ function ComboBox({
|
|
|
4422
5049
|
)
|
|
4423
5050
|
})).filter((group) => group.items.length > 0);
|
|
4424
5051
|
}, [data, normalizedFilter]);
|
|
4425
|
-
const filteredOptions = (0,
|
|
5052
|
+
const filteredOptions = (0, import_react27.useMemo)(
|
|
4426
5053
|
() => flattenComboBoxOptions(filteredData).filter(
|
|
4427
5054
|
(option) => !option.item.disabled
|
|
4428
5055
|
),
|
|
4429
5056
|
[filteredData]
|
|
4430
5057
|
);
|
|
4431
5058
|
const popupRoot = typeof document === "undefined" ? null : resolveComboBoxPortalRoot();
|
|
4432
|
-
const [themePortalStyle, setThemePortalStyle] = (0,
|
|
4433
|
-
(0,
|
|
5059
|
+
const [themePortalStyle, setThemePortalStyle] = (0, import_react27.useState)(() => void 0);
|
|
5060
|
+
(0, import_react27.useEffect)(() => {
|
|
4434
5061
|
if (!open) {
|
|
4435
5062
|
return;
|
|
4436
5063
|
}
|
|
@@ -4506,7 +5133,7 @@ function ComboBox({
|
|
|
4506
5133
|
break;
|
|
4507
5134
|
}
|
|
4508
5135
|
}
|
|
4509
|
-
return /* @__PURE__ */ (0,
|
|
5136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
4510
5137
|
"div",
|
|
4511
5138
|
{
|
|
4512
5139
|
...props,
|
|
@@ -4514,7 +5141,7 @@ function ComboBox({
|
|
|
4514
5141
|
ref: rootRef,
|
|
4515
5142
|
style: mergeSlotStyle(style, slotStyles?.root),
|
|
4516
5143
|
children: [
|
|
4517
|
-
/* @__PURE__ */ (0,
|
|
5144
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4518
5145
|
"label",
|
|
4519
5146
|
{
|
|
4520
5147
|
className: cx("nu-combo-box__label", slotClassNames?.label),
|
|
@@ -4524,20 +5151,20 @@ function ComboBox({
|
|
|
4524
5151
|
children: renderMnemonicText(label)
|
|
4525
5152
|
}
|
|
4526
5153
|
),
|
|
4527
|
-
/* @__PURE__ */ (0,
|
|
5154
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
4528
5155
|
"span",
|
|
4529
5156
|
{
|
|
4530
5157
|
className: cx("nu-combo-box__slot", slotClassNames?.slot),
|
|
4531
5158
|
style: slotStyles?.slot,
|
|
4532
5159
|
children: [
|
|
4533
|
-
/* @__PURE__ */ (0,
|
|
5160
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
4534
5161
|
"span",
|
|
4535
5162
|
{
|
|
4536
5163
|
className: cx("nu-combo-box__field", slotClassNames?.field),
|
|
4537
5164
|
ref: fieldRef,
|
|
4538
5165
|
style: slotStyles?.field,
|
|
4539
5166
|
children: [
|
|
4540
|
-
/* @__PURE__ */ (0,
|
|
5167
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4541
5168
|
"span",
|
|
4542
5169
|
{
|
|
4543
5170
|
"aria-hidden": "true",
|
|
@@ -4546,7 +5173,7 @@ function ComboBox({
|
|
|
4546
5173
|
children: "["
|
|
4547
5174
|
}
|
|
4548
5175
|
),
|
|
4549
|
-
/* @__PURE__ */ (0,
|
|
5176
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4550
5177
|
"span",
|
|
4551
5178
|
{
|
|
4552
5179
|
className: cx(
|
|
@@ -4554,7 +5181,7 @@ function ComboBox({
|
|
|
4554
5181
|
slotClassNames?.inputShell
|
|
4555
5182
|
),
|
|
4556
5183
|
style: slotStyles?.inputShell,
|
|
4557
|
-
children: /* @__PURE__ */ (0,
|
|
5184
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4558
5185
|
"input",
|
|
4559
5186
|
{
|
|
4560
5187
|
"aria-autocomplete": "list",
|
|
@@ -4581,7 +5208,7 @@ function ComboBox({
|
|
|
4581
5208
|
)
|
|
4582
5209
|
}
|
|
4583
5210
|
),
|
|
4584
|
-
/* @__PURE__ */ (0,
|
|
5211
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4585
5212
|
"span",
|
|
4586
5213
|
{
|
|
4587
5214
|
"aria-hidden": "true",
|
|
@@ -4593,296 +5220,81 @@ function ComboBox({
|
|
|
4593
5220
|
]
|
|
4594
5221
|
}
|
|
4595
5222
|
),
|
|
4596
|
-
/* @__PURE__ */ (0,
|
|
5223
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4597
5224
|
ControlOpener,
|
|
4598
5225
|
{
|
|
4599
5226
|
"aria-label": open ? "Collapse list" : "Expand list",
|
|
4600
5227
|
as: "button",
|
|
4601
5228
|
className: cx(
|
|
4602
|
-
"nu-control-opener",
|
|
4603
|
-
"nu-combo-box__toggle",
|
|
4604
|
-
slotClassNames?.toggle
|
|
4605
|
-
),
|
|
4606
|
-
disabled,
|
|
4607
|
-
onClick: handleToggle,
|
|
4608
|
-
style: slotStyles?.toggle
|
|
4609
|
-
}
|
|
4610
|
-
)
|
|
4611
|
-
]
|
|
4612
|
-
}
|
|
4613
|
-
),
|
|
4614
|
-
hint ? /* @__PURE__ */ (0,
|
|
4615
|
-
"span",
|
|
4616
|
-
{
|
|
4617
|
-
className: cx("nu-combo-box__hint", slotClassNames?.hint),
|
|
4618
|
-
id: hintId,
|
|
4619
|
-
style: slotStyles?.hint,
|
|
4620
|
-
children: hint
|
|
4621
|
-
}
|
|
4622
|
-
) : null,
|
|
4623
|
-
open && popupRoot ? (0, import_react_dom2.createPortal)(
|
|
4624
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4625
|
-
"div",
|
|
4626
|
-
{
|
|
4627
|
-
className: cx("nu-combo-box__popup", slotClassNames?.popup),
|
|
4628
|
-
id: `${fieldId}-popup`,
|
|
4629
|
-
ref: popupRef,
|
|
4630
|
-
style: mergeSlotStyle(
|
|
4631
|
-
themePortalStyle,
|
|
4632
|
-
slotStyles?.popup
|
|
4633
|
-
),
|
|
4634
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4635
|
-
"div",
|
|
4636
|
-
{
|
|
4637
|
-
className: cx("nu-combo-box__listbox", slotClassNames?.listbox),
|
|
4638
|
-
style: slotStyles?.listbox,
|
|
4639
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4640
|
-
ListBox,
|
|
4641
|
-
{
|
|
4642
|
-
data: filteredData,
|
|
4643
|
-
emptyText: "No matches",
|
|
4644
|
-
onItemSelect: (item, group) => {
|
|
4645
|
-
const nextOption = filteredOptions.find(
|
|
4646
|
-
(option) => option.item === item && option.group === group
|
|
4647
|
-
);
|
|
4648
|
-
if (!nextOption) {
|
|
4649
|
-
return;
|
|
4650
|
-
}
|
|
4651
|
-
commitValue(nextOption.value, item, group);
|
|
4652
|
-
},
|
|
4653
|
-
selectedId: selectedOption?.value,
|
|
4654
|
-
style: slotStyles?.listbox
|
|
4655
|
-
}
|
|
4656
|
-
)
|
|
4657
|
-
}
|
|
4658
|
-
)
|
|
4659
|
-
}
|
|
4660
|
-
),
|
|
4661
|
-
popupRoot
|
|
4662
|
-
) : null
|
|
4663
|
-
]
|
|
4664
|
-
}
|
|
4665
|
-
);
|
|
4666
|
-
}
|
|
4667
|
-
|
|
4668
|
-
// src/components/CommandButton/CommandButton.tsx
|
|
4669
|
-
var import_react25 = require("react");
|
|
4670
|
-
|
|
4671
|
-
// src/components/PopupMenu/PopupMenu.tsx
|
|
4672
|
-
var import_react23 = require("react");
|
|
4673
|
-
var import_react_dom3 = require("react-dom");
|
|
4674
|
-
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4675
|
-
function hasVisibleChildren2(item) {
|
|
4676
|
-
return Boolean(item.items?.some((child) => !child.hidden));
|
|
4677
|
-
}
|
|
4678
|
-
function clamp(value, min, max) {
|
|
4679
|
-
return Math.min(max, Math.max(min, value));
|
|
4680
|
-
}
|
|
4681
|
-
function resolveAnchorPosition(anchor) {
|
|
4682
|
-
if (!anchor) {
|
|
4683
|
-
return null;
|
|
4684
|
-
}
|
|
4685
|
-
if (anchor.type === "point") {
|
|
4686
|
-
return {
|
|
4687
|
-
left: anchor.x,
|
|
4688
|
-
top: anchor.y
|
|
4689
|
-
};
|
|
4690
|
-
}
|
|
4691
|
-
const rect = anchor.element.getBoundingClientRect();
|
|
4692
|
-
return {
|
|
4693
|
-
left: rect.left,
|
|
4694
|
-
top: rect.bottom - 1
|
|
4695
|
-
};
|
|
4696
|
-
}
|
|
4697
|
-
function resolvePortalRoot() {
|
|
4698
|
-
if (typeof document === "undefined") {
|
|
4699
|
-
return null;
|
|
4700
|
-
}
|
|
4701
|
-
return document.body;
|
|
4702
|
-
}
|
|
4703
|
-
function PopupMenu({
|
|
4704
|
-
anchor,
|
|
4705
|
-
className,
|
|
4706
|
-
defaultOpen = false,
|
|
4707
|
-
items,
|
|
4708
|
-
onItemSelect,
|
|
4709
|
-
onOpenChange,
|
|
4710
|
-
open,
|
|
4711
|
-
style: styleProp,
|
|
4712
|
-
uncheckedShape = "box",
|
|
4713
|
-
...props
|
|
4714
|
-
}) {
|
|
4715
|
-
const rootRef = (0, import_react23.useRef)(null);
|
|
4716
|
-
const [activePath, setActivePath] = (0, import_react23.useState)([]);
|
|
4717
|
-
const [uncontrolledOpen, setUncontrolledOpen] = (0, import_react23.useState)(defaultOpen);
|
|
4718
|
-
const isControlled = open !== void 0;
|
|
4719
|
-
const resolvedOpen = isControlled ? open : uncontrolledOpen;
|
|
4720
|
-
const portalRoot = resolvePortalRoot();
|
|
4721
|
-
const setResolvedOpen = (0, import_react23.useCallback)(
|
|
4722
|
-
(nextOpen) => {
|
|
4723
|
-
if (!nextOpen) {
|
|
4724
|
-
setActivePath([]);
|
|
4725
|
-
}
|
|
4726
|
-
if (!isControlled) {
|
|
4727
|
-
setUncontrolledOpen(nextOpen);
|
|
4728
|
-
}
|
|
4729
|
-
onOpenChange?.(nextOpen);
|
|
4730
|
-
},
|
|
4731
|
-
[isControlled, onOpenChange]
|
|
4732
|
-
);
|
|
4733
|
-
(0, import_react23.useEffect)(() => {
|
|
4734
|
-
if (!resolvedOpen) {
|
|
4735
|
-
return;
|
|
4736
|
-
}
|
|
4737
|
-
function handlePointerDown(event) {
|
|
4738
|
-
if (!rootRef.current?.contains(event.target)) {
|
|
4739
|
-
setResolvedOpen(false);
|
|
4740
|
-
}
|
|
4741
|
-
}
|
|
4742
|
-
function handleKeyDown(event) {
|
|
4743
|
-
if (event.key === "Escape") {
|
|
4744
|
-
setResolvedOpen(false);
|
|
4745
|
-
}
|
|
4746
|
-
}
|
|
4747
|
-
document.addEventListener("pointerdown", handlePointerDown);
|
|
4748
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
4749
|
-
return () => {
|
|
4750
|
-
document.removeEventListener("pointerdown", handlePointerDown);
|
|
4751
|
-
document.removeEventListener("keydown", handleKeyDown);
|
|
4752
|
-
};
|
|
4753
|
-
}, [resolvedOpen, setResolvedOpen]);
|
|
4754
|
-
(0, import_react23.useLayoutEffect)(() => {
|
|
4755
|
-
if (!resolvedOpen || !anchor || !rootRef.current) {
|
|
4756
|
-
return;
|
|
4757
|
-
}
|
|
4758
|
-
const rootNode = rootRef.current;
|
|
4759
|
-
function updatePosition() {
|
|
4760
|
-
const anchorPosition = resolveAnchorPosition(anchor);
|
|
4761
|
-
if (!anchorPosition) {
|
|
4762
|
-
return;
|
|
4763
|
-
}
|
|
4764
|
-
const viewportRect = getPortalViewportRect(portalRoot);
|
|
4765
|
-
const relativePosition = toPortalCoordinates(portalRoot, anchorPosition);
|
|
4766
|
-
const rect = rootNode.getBoundingClientRect();
|
|
4767
|
-
const maxLeft = Math.max(0, viewportRect.width - rect.width);
|
|
4768
|
-
const maxTop = Math.max(0, viewportRect.height - rect.height);
|
|
4769
|
-
rootNode.style.left = `${clamp(relativePosition.left, 0, maxLeft)}px`;
|
|
4770
|
-
rootNode.style.top = `${clamp(relativePosition.top, 0, maxTop)}px`;
|
|
4771
|
-
rootNode.style.visibility = "visible";
|
|
4772
|
-
}
|
|
4773
|
-
rootNode.style.left = "0px";
|
|
4774
|
-
rootNode.style.top = "0px";
|
|
4775
|
-
rootNode.style.visibility = "hidden";
|
|
4776
|
-
updatePosition();
|
|
4777
|
-
window.addEventListener("resize", updatePosition);
|
|
4778
|
-
window.addEventListener("scroll", updatePosition, true);
|
|
4779
|
-
return () => {
|
|
4780
|
-
window.removeEventListener("resize", updatePosition);
|
|
4781
|
-
window.removeEventListener("scroll", updatePosition, true);
|
|
4782
|
-
};
|
|
4783
|
-
}, [anchor, portalRoot, resolvedOpen]);
|
|
4784
|
-
function handleActivateItem(item, level) {
|
|
4785
|
-
if (item.disabled) {
|
|
4786
|
-
return;
|
|
4787
|
-
}
|
|
4788
|
-
if (hasVisibleChildren2(item)) {
|
|
4789
|
-
setActivePath(
|
|
4790
|
-
(currentPath) => currentPath[level] === item.id ? currentPath.slice(0, level) : [...currentPath.slice(0, level), item.id]
|
|
4791
|
-
);
|
|
4792
|
-
return;
|
|
4793
|
-
}
|
|
4794
|
-
item.onSelect?.();
|
|
4795
|
-
onItemSelect?.(item);
|
|
4796
|
-
setResolvedOpen(false);
|
|
4797
|
-
}
|
|
4798
|
-
function handleHoverItem(item, level) {
|
|
4799
|
-
if (item.disabled) {
|
|
4800
|
-
return;
|
|
4801
|
-
}
|
|
4802
|
-
setActivePath((currentPath) => [...currentPath.slice(0, level), item.id]);
|
|
4803
|
-
}
|
|
4804
|
-
if (!resolvedOpen || !anchor || !portalRoot || items.every((item) => item.hidden)) {
|
|
4805
|
-
return null;
|
|
4806
|
-
}
|
|
4807
|
-
return (0, import_react_dom3.createPortal)(
|
|
4808
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4809
|
-
"div",
|
|
4810
|
-
{
|
|
4811
|
-
...props,
|
|
4812
|
-
className: ["nu-popup-menu", className].filter(Boolean).join(" "),
|
|
4813
|
-
onContextMenu: (event) => event.preventDefault(),
|
|
4814
|
-
ref: rootRef,
|
|
4815
|
-
style: {
|
|
4816
|
-
...getThemePortalStyle(
|
|
4817
|
-
anchor?.type === "element" ? anchor.element : null
|
|
4818
|
-
),
|
|
4819
|
-
...styleProp,
|
|
4820
|
-
left: 0,
|
|
4821
|
-
top: 0,
|
|
4822
|
-
visibility: "hidden"
|
|
4823
|
-
},
|
|
4824
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "nu-popup-menu__shell", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4825
|
-
MainMenuList,
|
|
5229
|
+
"nu-control-opener",
|
|
5230
|
+
"nu-combo-box__toggle",
|
|
5231
|
+
slotClassNames?.toggle
|
|
5232
|
+
),
|
|
5233
|
+
disabled,
|
|
5234
|
+
onClick: handleToggle,
|
|
5235
|
+
style: slotStyles?.toggle
|
|
5236
|
+
}
|
|
5237
|
+
)
|
|
5238
|
+
]
|
|
5239
|
+
}
|
|
5240
|
+
),
|
|
5241
|
+
hint ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5242
|
+
"span",
|
|
4826
5243
|
{
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
onHoverItem: handleHoverItem,
|
|
4832
|
-
rootVariant: "popup",
|
|
4833
|
-
uncheckedShape
|
|
5244
|
+
className: cx("nu-combo-box__hint", slotClassNames?.hint),
|
|
5245
|
+
id: hintId,
|
|
5246
|
+
style: slotStyles?.hint,
|
|
5247
|
+
children: hint
|
|
4834
5248
|
}
|
|
4835
|
-
)
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
5249
|
+
) : null,
|
|
5250
|
+
open && popupRoot ? (0, import_react_dom3.createPortal)(
|
|
5251
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5252
|
+
"div",
|
|
5253
|
+
{
|
|
5254
|
+
className: cx("nu-combo-box__popup", slotClassNames?.popup),
|
|
5255
|
+
id: `${fieldId}-popup`,
|
|
5256
|
+
ref: popupRef,
|
|
5257
|
+
style: mergeSlotStyle(
|
|
5258
|
+
themePortalStyle,
|
|
5259
|
+
slotStyles?.popup
|
|
5260
|
+
),
|
|
5261
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5262
|
+
"div",
|
|
5263
|
+
{
|
|
5264
|
+
className: cx("nu-combo-box__listbox", slotClassNames?.listbox),
|
|
5265
|
+
style: slotStyles?.listbox,
|
|
5266
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5267
|
+
ListBox,
|
|
5268
|
+
{
|
|
5269
|
+
data: filteredData,
|
|
5270
|
+
emptyText: "No matches",
|
|
5271
|
+
onItemSelect: (item, group) => {
|
|
5272
|
+
const nextOption = filteredOptions.find(
|
|
5273
|
+
(option) => option.item === item && option.group === group
|
|
5274
|
+
);
|
|
5275
|
+
if (!nextOption) {
|
|
5276
|
+
return;
|
|
5277
|
+
}
|
|
5278
|
+
commitValue(nextOption.value, item, group);
|
|
5279
|
+
},
|
|
5280
|
+
selectedId: selectedOption?.value,
|
|
5281
|
+
style: slotStyles?.listbox
|
|
5282
|
+
}
|
|
5283
|
+
)
|
|
5284
|
+
}
|
|
5285
|
+
)
|
|
5286
|
+
}
|
|
5287
|
+
),
|
|
5288
|
+
popupRoot
|
|
5289
|
+
) : null
|
|
5290
|
+
]
|
|
5291
|
+
}
|
|
4839
5292
|
);
|
|
4840
5293
|
}
|
|
4841
5294
|
|
|
4842
|
-
// src/components/PopupMenu/usePopupMenu.ts
|
|
4843
|
-
var import_react24 = require("react");
|
|
4844
|
-
function usePopupMenu() {
|
|
4845
|
-
const [anchor, setAnchor] = (0, import_react24.useState)(null);
|
|
4846
|
-
const [open, setOpen] = (0, import_react24.useState)(false);
|
|
4847
|
-
function close() {
|
|
4848
|
-
setOpen(false);
|
|
4849
|
-
}
|
|
4850
|
-
function openAtPoint(x, y) {
|
|
4851
|
-
setAnchor({
|
|
4852
|
-
type: "point",
|
|
4853
|
-
x,
|
|
4854
|
-
y
|
|
4855
|
-
});
|
|
4856
|
-
setOpen(true);
|
|
4857
|
-
}
|
|
4858
|
-
function openAtElement(element) {
|
|
4859
|
-
setAnchor({
|
|
4860
|
-
element,
|
|
4861
|
-
type: "element"
|
|
4862
|
-
});
|
|
4863
|
-
setOpen(true);
|
|
4864
|
-
}
|
|
4865
|
-
function openFromClick(event) {
|
|
4866
|
-
openAtElement(event.currentTarget);
|
|
4867
|
-
}
|
|
4868
|
-
function openFromContextMenu(event) {
|
|
4869
|
-
event.preventDefault();
|
|
4870
|
-
openAtPoint(event.clientX, event.clientY);
|
|
4871
|
-
}
|
|
4872
|
-
return {
|
|
4873
|
-
anchor,
|
|
4874
|
-
close,
|
|
4875
|
-
open,
|
|
4876
|
-
openAtElement,
|
|
4877
|
-
openAtPoint,
|
|
4878
|
-
openFromClick,
|
|
4879
|
-
openFromContextMenu,
|
|
4880
|
-
setOpen
|
|
4881
|
-
};
|
|
4882
|
-
}
|
|
4883
|
-
|
|
4884
5295
|
// src/components/CommandButton/CommandButton.tsx
|
|
4885
|
-
var
|
|
5296
|
+
var import_react28 = require("react");
|
|
5297
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
4886
5298
|
var COMMAND_BUTTON_GLYPH_NAMES = /* @__PURE__ */ new Set([
|
|
4887
5299
|
"check-fill",
|
|
4888
5300
|
"check-mark",
|
|
@@ -4923,7 +5335,7 @@ function CommandButton({
|
|
|
4923
5335
|
const hasMenu = menuItems.length > 0;
|
|
4924
5336
|
const showCaret = dropdown || hasMenu;
|
|
4925
5337
|
const resolvedToggled = toggled ?? pressed;
|
|
4926
|
-
const resolvedIcon = typeof icon === "string" && isCommandButtonGlyphName(icon) ? /* @__PURE__ */ (0,
|
|
5338
|
+
const resolvedIcon = typeof icon === "string" && isCommandButtonGlyphName(icon) ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(NuGlyph, { name: icon }) : icon ?? null;
|
|
4927
5339
|
function handleClick(event) {
|
|
4928
5340
|
onClick?.(event);
|
|
4929
5341
|
if (event.defaultPrevented || !hasMenu) {
|
|
@@ -4931,8 +5343,8 @@ function CommandButton({
|
|
|
4931
5343
|
}
|
|
4932
5344
|
popupMenu.openFromClick(event);
|
|
4933
5345
|
}
|
|
4934
|
-
return /* @__PURE__ */ (0,
|
|
4935
|
-
/* @__PURE__ */ (0,
|
|
5346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react28.Fragment, { children: [
|
|
5347
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
4936
5348
|
"button",
|
|
4937
5349
|
{
|
|
4938
5350
|
...props,
|
|
@@ -4948,7 +5360,7 @@ function CommandButton({
|
|
|
4948
5360
|
type,
|
|
4949
5361
|
onClick: handleClick,
|
|
4950
5362
|
children: [
|
|
4951
|
-
resolvedIcon ? /* @__PURE__ */ (0,
|
|
5363
|
+
resolvedIcon ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4952
5364
|
"span",
|
|
4953
5365
|
{
|
|
4954
5366
|
className: cx(
|
|
@@ -4960,7 +5372,7 @@ function CommandButton({
|
|
|
4960
5372
|
children: resolvedIcon
|
|
4961
5373
|
}
|
|
4962
5374
|
) : null,
|
|
4963
|
-
children ? /* @__PURE__ */ (0,
|
|
5375
|
+
children ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4964
5376
|
"span",
|
|
4965
5377
|
{
|
|
4966
5378
|
className: cx(
|
|
@@ -4972,7 +5384,7 @@ function CommandButton({
|
|
|
4972
5384
|
children: renderMnemonicNode(children)
|
|
4973
5385
|
}
|
|
4974
5386
|
) : null,
|
|
4975
|
-
showCaret ? /* @__PURE__ */ (0,
|
|
5387
|
+
showCaret ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4976
5388
|
"span",
|
|
4977
5389
|
{
|
|
4978
5390
|
className: cx(
|
|
@@ -4981,13 +5393,13 @@ function CommandButton({
|
|
|
4981
5393
|
slotClassNames?.caret
|
|
4982
5394
|
),
|
|
4983
5395
|
style: slotStyles?.caret,
|
|
4984
|
-
children: /* @__PURE__ */ (0,
|
|
5396
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(NuGlyph, { name: "dropdown-arrow" })
|
|
4985
5397
|
}
|
|
4986
5398
|
) : null
|
|
4987
5399
|
]
|
|
4988
5400
|
}
|
|
4989
5401
|
),
|
|
4990
|
-
hasMenu ? /* @__PURE__ */ (0,
|
|
5402
|
+
hasMenu ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4991
5403
|
PopupMenu,
|
|
4992
5404
|
{
|
|
4993
5405
|
anchor: popupMenu.anchor,
|
|
@@ -5002,8 +5414,8 @@ function CommandButton({
|
|
|
5002
5414
|
}
|
|
5003
5415
|
|
|
5004
5416
|
// src/components/CrtGlitch/CrtGlitch.tsx
|
|
5005
|
-
var
|
|
5006
|
-
var
|
|
5417
|
+
var import_react29 = require("react");
|
|
5418
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
5007
5419
|
var DEFAULT_INTERVAL_MS = 3e3;
|
|
5008
5420
|
var DEFAULT_DURATION_MS = 2500;
|
|
5009
5421
|
var DEFAULT_TOP_LEVEL_RATIO = 1 / 3;
|
|
@@ -5028,14 +5440,14 @@ function NuCrtGlitch({
|
|
|
5028
5440
|
targetSelector = DEFAULT_TARGET_SELECTOR,
|
|
5029
5441
|
topLevelRatio = DEFAULT_TOP_LEVEL_RATIO
|
|
5030
5442
|
}) {
|
|
5031
|
-
const filterId = (0,
|
|
5032
|
-
const turbulenceRef = (0,
|
|
5033
|
-
const warpRef = (0,
|
|
5034
|
-
const rOffsetRef = (0,
|
|
5035
|
-
const bOffsetRef = (0,
|
|
5036
|
-
const rafRef = (0,
|
|
5037
|
-
const targetElRef = (0,
|
|
5038
|
-
(0,
|
|
5443
|
+
const filterId = (0, import_react29.useId)().replace(/:/g, "");
|
|
5444
|
+
const turbulenceRef = (0, import_react29.useRef)(null);
|
|
5445
|
+
const warpRef = (0, import_react29.useRef)(null);
|
|
5446
|
+
const rOffsetRef = (0, import_react29.useRef)(null);
|
|
5447
|
+
const bOffsetRef = (0, import_react29.useRef)(null);
|
|
5448
|
+
const rafRef = (0, import_react29.useRef)(null);
|
|
5449
|
+
const targetElRef = (0, import_react29.useRef)(null);
|
|
5450
|
+
(0, import_react29.useEffect)(() => {
|
|
5039
5451
|
if (!enabled) {
|
|
5040
5452
|
return;
|
|
5041
5453
|
}
|
|
@@ -5137,7 +5549,7 @@ function NuCrtGlitch({
|
|
|
5137
5549
|
}
|
|
5138
5550
|
};
|
|
5139
5551
|
}, [durationMs, enabled, filterId, intervalMs, targetSelector, topLevelRatio]);
|
|
5140
|
-
return /* @__PURE__ */ (0,
|
|
5552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("svg", { "aria-hidden": "true", height: "0", style: { position: "absolute" }, width: "0", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
5141
5553
|
"filter",
|
|
5142
5554
|
{
|
|
5143
5555
|
"color-interpolation-filters": "sRGB",
|
|
@@ -5147,7 +5559,7 @@ function NuCrtGlitch({
|
|
|
5147
5559
|
x: "-15%",
|
|
5148
5560
|
y: "-5%",
|
|
5149
5561
|
children: [
|
|
5150
|
-
/* @__PURE__ */ (0,
|
|
5562
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
5151
5563
|
"feTurbulence",
|
|
5152
5564
|
{
|
|
5153
5565
|
baseFrequency: "0.001 0.045",
|
|
@@ -5158,7 +5570,7 @@ function NuCrtGlitch({
|
|
|
5158
5570
|
type: "turbulence"
|
|
5159
5571
|
}
|
|
5160
5572
|
),
|
|
5161
|
-
/* @__PURE__ */ (0,
|
|
5573
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
5162
5574
|
"feDisplacementMap",
|
|
5163
5575
|
{
|
|
5164
5576
|
in: "SourceGraphic",
|
|
@@ -5170,8 +5582,8 @@ function NuCrtGlitch({
|
|
|
5170
5582
|
yChannelSelector: "A"
|
|
5171
5583
|
}
|
|
5172
5584
|
),
|
|
5173
|
-
/* @__PURE__ */ (0,
|
|
5174
|
-
/* @__PURE__ */ (0,
|
|
5585
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("feOffset", { dx: 0, dy: 0, in: "warped", ref: rOffsetRef, result: "rOff" }),
|
|
5586
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
5175
5587
|
"feColorMatrix",
|
|
5176
5588
|
{
|
|
5177
5589
|
in: "rOff",
|
|
@@ -5180,7 +5592,7 @@ function NuCrtGlitch({
|
|
|
5180
5592
|
values: "1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0"
|
|
5181
5593
|
}
|
|
5182
5594
|
),
|
|
5183
|
-
/* @__PURE__ */ (0,
|
|
5595
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
5184
5596
|
"feColorMatrix",
|
|
5185
5597
|
{
|
|
5186
5598
|
in: "warped",
|
|
@@ -5189,8 +5601,8 @@ function NuCrtGlitch({
|
|
|
5189
5601
|
values: "0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0"
|
|
5190
5602
|
}
|
|
5191
5603
|
),
|
|
5192
|
-
/* @__PURE__ */ (0,
|
|
5193
|
-
/* @__PURE__ */ (0,
|
|
5604
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("feOffset", { dx: 0, dy: 0, in: "warped", ref: bOffsetRef, result: "bOff" }),
|
|
5605
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
5194
5606
|
"feColorMatrix",
|
|
5195
5607
|
{
|
|
5196
5608
|
in: "bOff",
|
|
@@ -5199,15 +5611,15 @@ function NuCrtGlitch({
|
|
|
5199
5611
|
values: "0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0"
|
|
5200
5612
|
}
|
|
5201
5613
|
),
|
|
5202
|
-
/* @__PURE__ */ (0,
|
|
5203
|
-
/* @__PURE__ */ (0,
|
|
5614
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("feBlend", { in: "rOnly", in2: "gOnly", mode: "screen", result: "rg" }),
|
|
5615
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("feBlend", { in: "rg", in2: "bOnly", mode: "screen" })
|
|
5204
5616
|
]
|
|
5205
5617
|
}
|
|
5206
5618
|
) }) });
|
|
5207
5619
|
}
|
|
5208
5620
|
|
|
5209
5621
|
// src/components/ListView/ListView.tsx
|
|
5210
|
-
var
|
|
5622
|
+
var import_react31 = require("react");
|
|
5211
5623
|
|
|
5212
5624
|
// src/components/ListView/internals/helpers.ts
|
|
5213
5625
|
function getInitialActiveRowId(rows, selectedId) {
|
|
@@ -5241,17 +5653,17 @@ function renderListViewCellValue(row, column) {
|
|
|
5241
5653
|
}
|
|
5242
5654
|
|
|
5243
5655
|
// src/components/ListView/internals/ListViewRow.tsx
|
|
5244
|
-
var
|
|
5656
|
+
var import_react30 = require("react");
|
|
5245
5657
|
|
|
5246
5658
|
// src/components/ListView/internals/ListViewCheckControl.tsx
|
|
5247
|
-
var
|
|
5659
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
5248
5660
|
function ListViewCheckControl({
|
|
5249
5661
|
isChecked,
|
|
5250
5662
|
onActivate,
|
|
5251
5663
|
onToggleCheck,
|
|
5252
5664
|
uncheckedShape
|
|
5253
5665
|
}) {
|
|
5254
|
-
return /* @__PURE__ */ (0,
|
|
5666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5255
5667
|
"button",
|
|
5256
5668
|
{
|
|
5257
5669
|
"aria-label": isChecked ? "Uncheck row" : "Check row",
|
|
@@ -5264,13 +5676,13 @@ function ListViewCheckControl({
|
|
|
5264
5676
|
onToggleCheck();
|
|
5265
5677
|
},
|
|
5266
5678
|
type: "button",
|
|
5267
|
-
children: /* @__PURE__ */ (0,
|
|
5679
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5268
5680
|
"span",
|
|
5269
5681
|
{
|
|
5270
5682
|
"aria-hidden": "true",
|
|
5271
5683
|
className: "nu-list-view__check-box",
|
|
5272
5684
|
"data-unchecked-shape": uncheckedShape,
|
|
5273
|
-
children: isChecked ? /* @__PURE__ */ (0,
|
|
5685
|
+
children: isChecked ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5274
5686
|
NuGlyph,
|
|
5275
5687
|
{
|
|
5276
5688
|
className: "nu-list-view__check-indicator",
|
|
@@ -5284,7 +5696,7 @@ function ListViewCheckControl({
|
|
|
5284
5696
|
}
|
|
5285
5697
|
|
|
5286
5698
|
// src/components/ListView/internals/ListViewRow.tsx
|
|
5287
|
-
var
|
|
5699
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
5288
5700
|
function ListViewRowInner({
|
|
5289
5701
|
columns,
|
|
5290
5702
|
isActive,
|
|
@@ -5315,7 +5727,7 @@ function ListViewRowInner({
|
|
|
5315
5727
|
function handleToggleCheck() {
|
|
5316
5728
|
onToggleCheck(rowId);
|
|
5317
5729
|
}
|
|
5318
|
-
return /* @__PURE__ */ (0,
|
|
5730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
5319
5731
|
"div",
|
|
5320
5732
|
{
|
|
5321
5733
|
"aria-disabled": row.disabled || void 0,
|
|
@@ -5336,7 +5748,7 @@ function ListViewRowInner({
|
|
|
5336
5748
|
"--nu-list-view-columns": templateColumns
|
|
5337
5749
|
},
|
|
5338
5750
|
children: [
|
|
5339
|
-
showCheckBox ? /* @__PURE__ */ (0,
|
|
5751
|
+
showCheckBox ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "nu-list-view__check-cell", role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5340
5752
|
ListViewCheckControl,
|
|
5341
5753
|
{
|
|
5342
5754
|
isChecked,
|
|
@@ -5345,7 +5757,7 @@ function ListViewRowInner({
|
|
|
5345
5757
|
uncheckedShape
|
|
5346
5758
|
}
|
|
5347
5759
|
) }) : null,
|
|
5348
|
-
columns.map((column) => /* @__PURE__ */ (0,
|
|
5760
|
+
columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5349
5761
|
"span",
|
|
5350
5762
|
{
|
|
5351
5763
|
className: [
|
|
@@ -5362,10 +5774,10 @@ function ListViewRowInner({
|
|
|
5362
5774
|
}
|
|
5363
5775
|
);
|
|
5364
5776
|
}
|
|
5365
|
-
var ListViewRow = (0,
|
|
5777
|
+
var ListViewRow = (0, import_react30.memo)(ListViewRowInner);
|
|
5366
5778
|
|
|
5367
5779
|
// src/components/ListView/ListView.tsx
|
|
5368
|
-
var
|
|
5780
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
5369
5781
|
function ListViewInner({
|
|
5370
5782
|
activeRowId: activeRowIdProp,
|
|
5371
5783
|
checkedIds,
|
|
@@ -5383,26 +5795,26 @@ function ListViewInner({
|
|
|
5383
5795
|
uncheckedShape = "box",
|
|
5384
5796
|
...props
|
|
5385
5797
|
}, ref) {
|
|
5386
|
-
const rootRef = (0,
|
|
5387
|
-
const rowRefs = (0,
|
|
5388
|
-
const selectableRows = (0,
|
|
5798
|
+
const rootRef = (0, import_react31.useRef)(null);
|
|
5799
|
+
const rowRefs = (0, import_react31.useRef)({});
|
|
5800
|
+
const selectableRows = (0, import_react31.useMemo)(
|
|
5389
5801
|
() => data.filter((row) => !row.disabled),
|
|
5390
5802
|
[data]
|
|
5391
5803
|
);
|
|
5392
5804
|
const isActiveControlled = activeRowIdProp !== void 0;
|
|
5393
|
-
const [uncontrolledActiveRowId, setUncontrolledActiveRowId] = (0,
|
|
5805
|
+
const [uncontrolledActiveRowId, setUncontrolledActiveRowId] = (0, import_react31.useState)(
|
|
5394
5806
|
() => defaultActiveRowId ?? getInitialActiveRowId(selectableRows, selectedId)
|
|
5395
5807
|
);
|
|
5396
5808
|
const activeRowId = activeRowIdProp !== void 0 ? activeRowIdProp : uncontrolledActiveRowId;
|
|
5397
5809
|
const resolvedActiveRowId = activeRowId && selectableRows.some((row) => row.id === activeRowId) ? activeRowId : getInitialActiveRowId(selectableRows, selectedId);
|
|
5398
|
-
const templateColumns = (0,
|
|
5810
|
+
const templateColumns = (0, import_react31.useMemo)(() => {
|
|
5399
5811
|
const checkboxColumn = showCheckBox ? "var(--nu-glyph-cell-size)" : null;
|
|
5400
5812
|
const dataColumns = columns.map(
|
|
5401
5813
|
(column) => column.width ?? "minmax(0, 1fr)"
|
|
5402
5814
|
);
|
|
5403
5815
|
return [checkboxColumn, ...dataColumns].filter(Boolean).join(" ");
|
|
5404
5816
|
}, [columns, showCheckBox]);
|
|
5405
|
-
(0,
|
|
5817
|
+
(0, import_react31.useEffect)(() => {
|
|
5406
5818
|
if (!resolvedActiveRowId) {
|
|
5407
5819
|
return;
|
|
5408
5820
|
}
|
|
@@ -5410,13 +5822,13 @@ function ListViewInner({
|
|
|
5410
5822
|
block: "nearest"
|
|
5411
5823
|
});
|
|
5412
5824
|
}, [resolvedActiveRowId]);
|
|
5413
|
-
const registerRowRef = (0,
|
|
5825
|
+
const registerRowRef = (0, import_react31.useCallback)(
|
|
5414
5826
|
(rowId, node) => {
|
|
5415
5827
|
rowRefs.current[rowId] = node;
|
|
5416
5828
|
},
|
|
5417
5829
|
[]
|
|
5418
5830
|
);
|
|
5419
|
-
const updateActiveRow = (0,
|
|
5831
|
+
const updateActiveRow = (0, import_react31.useCallback)(
|
|
5420
5832
|
(row) => {
|
|
5421
5833
|
if (!isActiveControlled) {
|
|
5422
5834
|
setUncontrolledActiveRowId(row.id);
|
|
@@ -5425,7 +5837,7 @@ function ListViewInner({
|
|
|
5425
5837
|
},
|
|
5426
5838
|
[isActiveControlled, onActiveRowChange]
|
|
5427
5839
|
);
|
|
5428
|
-
const activateRowId = (0,
|
|
5840
|
+
const activateRowId = (0, import_react31.useCallback)(
|
|
5429
5841
|
(rowId) => {
|
|
5430
5842
|
if (!rowId) {
|
|
5431
5843
|
return;
|
|
@@ -5464,7 +5876,7 @@ function ListViewInner({
|
|
|
5464
5876
|
function isRowChecked(row) {
|
|
5465
5877
|
return getListViewRowChecked(row, checkedIds);
|
|
5466
5878
|
}
|
|
5467
|
-
const toggleRowCheck = (0,
|
|
5879
|
+
const toggleRowCheck = (0, import_react31.useCallback)(
|
|
5468
5880
|
(rowId) => {
|
|
5469
5881
|
if (!showCheckBox) {
|
|
5470
5882
|
return;
|
|
@@ -5477,7 +5889,7 @@ function ListViewInner({
|
|
|
5477
5889
|
},
|
|
5478
5890
|
[showCheckBox, data, checkedIds, onRowCheckChange]
|
|
5479
5891
|
);
|
|
5480
|
-
(0,
|
|
5892
|
+
(0, import_react31.useImperativeHandle)(
|
|
5481
5893
|
ref,
|
|
5482
5894
|
() => ({
|
|
5483
5895
|
activateRow(rowId) {
|
|
@@ -5533,7 +5945,7 @@ function ListViewInner({
|
|
|
5533
5945
|
break;
|
|
5534
5946
|
}
|
|
5535
5947
|
}
|
|
5536
|
-
return /* @__PURE__ */ (0,
|
|
5948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
5537
5949
|
"div",
|
|
5538
5950
|
{
|
|
5539
5951
|
...props,
|
|
@@ -5544,7 +5956,7 @@ function ListViewInner({
|
|
|
5544
5956
|
role: "grid",
|
|
5545
5957
|
tabIndex: 0,
|
|
5546
5958
|
children: [
|
|
5547
|
-
/* @__PURE__ */ (0,
|
|
5959
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
5548
5960
|
"div",
|
|
5549
5961
|
{
|
|
5550
5962
|
className: "nu-list-view__header",
|
|
@@ -5553,8 +5965,8 @@ function ListViewInner({
|
|
|
5553
5965
|
"--nu-list-view-columns": templateColumns
|
|
5554
5966
|
},
|
|
5555
5967
|
children: [
|
|
5556
|
-
showCheckBox ? /* @__PURE__ */ (0,
|
|
5557
|
-
columns.map((column) => /* @__PURE__ */ (0,
|
|
5968
|
+
showCheckBox ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "nu-list-view__header-cell", role: "columnheader" }) : null,
|
|
5969
|
+
columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5558
5970
|
"span",
|
|
5559
5971
|
{
|
|
5560
5972
|
className: [
|
|
@@ -5570,7 +5982,7 @@ function ListViewInner({
|
|
|
5570
5982
|
]
|
|
5571
5983
|
}
|
|
5572
5984
|
),
|
|
5573
|
-
/* @__PURE__ */ (0,
|
|
5985
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "nu-list-view__body", children: data.length > 0 ? data.map((row) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5574
5986
|
ListViewRow,
|
|
5575
5987
|
{
|
|
5576
5988
|
columns,
|
|
@@ -5587,15 +5999,15 @@ function ListViewInner({
|
|
|
5587
5999
|
uncheckedShape
|
|
5588
6000
|
},
|
|
5589
6001
|
row.id
|
|
5590
|
-
)) : /* @__PURE__ */ (0,
|
|
6002
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "nu-list-view__empty", children: emptyText }) })
|
|
5591
6003
|
]
|
|
5592
6004
|
}
|
|
5593
6005
|
);
|
|
5594
6006
|
}
|
|
5595
|
-
var ListView = (0,
|
|
6007
|
+
var ListView = (0, import_react31.forwardRef)(ListViewInner);
|
|
5596
6008
|
|
|
5597
6009
|
// src/components/MaskedField/MaskedField.tsx
|
|
5598
|
-
var
|
|
6010
|
+
var import_react32 = require("react");
|
|
5599
6011
|
|
|
5600
6012
|
// src/components/MaskedField/textMask.ts
|
|
5601
6013
|
var INFINITE_MASK_REPEAT = Number.POSITIVE_INFINITY;
|
|
@@ -5759,7 +6171,7 @@ function getMaskedFieldState(mask, rawValue) {
|
|
|
5759
6171
|
}
|
|
5760
6172
|
|
|
5761
6173
|
// src/components/MaskedField/MaskedField.tsx
|
|
5762
|
-
var
|
|
6174
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
5763
6175
|
function MaskedField({
|
|
5764
6176
|
"aria-invalid": ariaInvalid,
|
|
5765
6177
|
className,
|
|
@@ -5778,12 +6190,12 @@ function MaskedField({
|
|
|
5778
6190
|
style,
|
|
5779
6191
|
...props
|
|
5780
6192
|
}) {
|
|
5781
|
-
const generatedId = (0,
|
|
6193
|
+
const generatedId = (0, import_react32.useId)();
|
|
5782
6194
|
const fieldId = id ?? generatedId;
|
|
5783
6195
|
const hintId = hint ? `${fieldId}-hint` : void 0;
|
|
5784
6196
|
const isControlled = value !== void 0;
|
|
5785
|
-
const hasMountedRef = (0,
|
|
5786
|
-
const [uncontrolledValue, setUncontrolledValue] = (0,
|
|
6197
|
+
const hasMountedRef = (0, import_react32.useRef)(false);
|
|
6198
|
+
const [uncontrolledValue, setUncontrolledValue] = (0, import_react32.useState)(
|
|
5787
6199
|
() => defaultValue == null ? "" : getMaskedFieldState(mask, String(defaultValue)).formattedValue
|
|
5788
6200
|
);
|
|
5789
6201
|
const rawResolvedValue = isControlled ? value == null ? "" : String(value) : uncontrolledValue;
|
|
@@ -5792,11 +6204,11 @@ function MaskedField({
|
|
|
5792
6204
|
rawResolvedValue
|
|
5793
6205
|
);
|
|
5794
6206
|
const resolvedAriaInvalid = ariaInvalid ?? (isInvalid ? true : void 0);
|
|
5795
|
-
const maskInputMode = (0,
|
|
6207
|
+
const maskInputMode = (0, import_react32.useMemo)(
|
|
5796
6208
|
() => props.inputMode === void 0 ? getTextMaskInputMode(mask) : void 0,
|
|
5797
6209
|
[mask, props.inputMode]
|
|
5798
6210
|
);
|
|
5799
|
-
(0,
|
|
6211
|
+
(0, import_react32.useEffect)(() => {
|
|
5800
6212
|
if (!onDebouncedChange) {
|
|
5801
6213
|
return;
|
|
5802
6214
|
}
|
|
@@ -5831,7 +6243,7 @@ function MaskedField({
|
|
|
5831
6243
|
}
|
|
5832
6244
|
onChange?.(event);
|
|
5833
6245
|
}
|
|
5834
|
-
return /* @__PURE__ */ (0,
|
|
6246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
5835
6247
|
"label",
|
|
5836
6248
|
{
|
|
5837
6249
|
className: cx(
|
|
@@ -5843,7 +6255,7 @@ function MaskedField({
|
|
|
5843
6255
|
htmlFor: fieldId,
|
|
5844
6256
|
style: mergeSlotStyle(style, slotStyles?.root),
|
|
5845
6257
|
children: [
|
|
5846
|
-
/* @__PURE__ */ (0,
|
|
6258
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5847
6259
|
"span",
|
|
5848
6260
|
{
|
|
5849
6261
|
className: cx("nu-masked-field__label", slotClassNames?.label),
|
|
@@ -5851,13 +6263,13 @@ function MaskedField({
|
|
|
5851
6263
|
children: renderMnemonicText(label)
|
|
5852
6264
|
}
|
|
5853
6265
|
),
|
|
5854
|
-
/* @__PURE__ */ (0,
|
|
6266
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
5855
6267
|
"span",
|
|
5856
6268
|
{
|
|
5857
6269
|
className: cx("nu-masked-field__slot", slotClassNames?.slot),
|
|
5858
6270
|
style: slotStyles?.slot,
|
|
5859
6271
|
children: [
|
|
5860
|
-
/* @__PURE__ */ (0,
|
|
6272
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5861
6273
|
"span",
|
|
5862
6274
|
{
|
|
5863
6275
|
"aria-hidden": "true",
|
|
@@ -5866,7 +6278,7 @@ function MaskedField({
|
|
|
5866
6278
|
children: "["
|
|
5867
6279
|
}
|
|
5868
6280
|
),
|
|
5869
|
-
/* @__PURE__ */ (0,
|
|
6281
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5870
6282
|
"span",
|
|
5871
6283
|
{
|
|
5872
6284
|
className: cx(
|
|
@@ -5874,7 +6286,7 @@ function MaskedField({
|
|
|
5874
6286
|
slotClassNames?.inputShell
|
|
5875
6287
|
),
|
|
5876
6288
|
style: slotStyles?.inputShell,
|
|
5877
|
-
children: /* @__PURE__ */ (0,
|
|
6289
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5878
6290
|
"input",
|
|
5879
6291
|
{
|
|
5880
6292
|
...props,
|
|
@@ -5892,7 +6304,7 @@ function MaskedField({
|
|
|
5892
6304
|
)
|
|
5893
6305
|
}
|
|
5894
6306
|
),
|
|
5895
|
-
/* @__PURE__ */ (0,
|
|
6307
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5896
6308
|
"span",
|
|
5897
6309
|
{
|
|
5898
6310
|
"aria-hidden": "true",
|
|
@@ -5904,7 +6316,7 @@ function MaskedField({
|
|
|
5904
6316
|
]
|
|
5905
6317
|
}
|
|
5906
6318
|
),
|
|
5907
|
-
hint ? /* @__PURE__ */ (0,
|
|
6319
|
+
hint ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5908
6320
|
"span",
|
|
5909
6321
|
{
|
|
5910
6322
|
className: cx("nu-masked-field__hint", slotClassNames?.hint),
|
|
@@ -5919,8 +6331,8 @@ function MaskedField({
|
|
|
5919
6331
|
}
|
|
5920
6332
|
|
|
5921
6333
|
// src/components/Memo/Memo.tsx
|
|
5922
|
-
var
|
|
5923
|
-
var
|
|
6334
|
+
var import_react33 = require("react");
|
|
6335
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
5924
6336
|
function Memo({
|
|
5925
6337
|
background,
|
|
5926
6338
|
className,
|
|
@@ -5940,7 +6352,7 @@ function Memo({
|
|
|
5940
6352
|
const isControlled = value !== void 0;
|
|
5941
6353
|
const resolvedInitialValue = defaultValue == null ? content ?? "" : String(defaultValue);
|
|
5942
6354
|
const resolvedValue = value == null ? "" : Array.isArray(value) ? value.join("\n") : String(value);
|
|
5943
|
-
const [uncontrolledValue, setUncontrolledValue] = (0,
|
|
6355
|
+
const [uncontrolledValue, setUncontrolledValue] = (0, import_react33.useState)(
|
|
5944
6356
|
() => resolvedInitialValue
|
|
5945
6357
|
);
|
|
5946
6358
|
function handleChange(event) {
|
|
@@ -5950,7 +6362,7 @@ function Memo({
|
|
|
5950
6362
|
onValueChange?.(event.target.value);
|
|
5951
6363
|
onChange?.(event);
|
|
5952
6364
|
}
|
|
5953
|
-
return /* @__PURE__ */ (0,
|
|
6365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5954
6366
|
"div",
|
|
5955
6367
|
{
|
|
5956
6368
|
className: ["nu-memo", className].filter(Boolean).join(" "),
|
|
@@ -5963,7 +6375,7 @@ function Memo({
|
|
|
5963
6375
|
"--nu-memo-focus-text": focusTextColor,
|
|
5964
6376
|
"--nu-memo-text": textColor
|
|
5965
6377
|
},
|
|
5966
|
-
children: /* @__PURE__ */ (0,
|
|
6378
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "nu-memo__viewport", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5967
6379
|
"textarea",
|
|
5968
6380
|
{
|
|
5969
6381
|
...props,
|
|
@@ -5977,8 +6389,8 @@ function Memo({
|
|
|
5977
6389
|
}
|
|
5978
6390
|
|
|
5979
6391
|
// src/components/PageControl/PageControl.tsx
|
|
5980
|
-
var
|
|
5981
|
-
var
|
|
6392
|
+
var import_react34 = require("react");
|
|
6393
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
5982
6394
|
function PageControl({
|
|
5983
6395
|
activePageId: activePageIdProp,
|
|
5984
6396
|
className,
|
|
@@ -5990,14 +6402,14 @@ function PageControl({
|
|
|
5990
6402
|
slotStyles,
|
|
5991
6403
|
...props
|
|
5992
6404
|
}) {
|
|
5993
|
-
const generatedId = (0,
|
|
6405
|
+
const generatedId = (0, import_react34.useId)();
|
|
5994
6406
|
const isControlled = activePageIdProp !== void 0;
|
|
5995
|
-
const tabRefs = (0,
|
|
5996
|
-
const [uncontrolledActivePageId, setUncontrolledActivePageId] = (0,
|
|
6407
|
+
const tabRefs = (0, import_react34.useRef)({});
|
|
6408
|
+
const [uncontrolledActivePageId, setUncontrolledActivePageId] = (0, import_react34.useState)(
|
|
5997
6409
|
() => defaultActivePageId ?? pages.find((page) => !page.disabled)?.id ?? pages[0]?.id
|
|
5998
6410
|
);
|
|
5999
6411
|
const activePageId = isControlled ? activePageIdProp : uncontrolledActivePageId;
|
|
6000
|
-
const resolvedActivePage = (0,
|
|
6412
|
+
const resolvedActivePage = (0, import_react34.useMemo)(() => {
|
|
6001
6413
|
const byId = pages.find(
|
|
6002
6414
|
(page) => page.id === activePageId && !page.disabled
|
|
6003
6415
|
);
|
|
@@ -6063,7 +6475,7 @@ function PageControl({
|
|
|
6063
6475
|
break;
|
|
6064
6476
|
}
|
|
6065
6477
|
}
|
|
6066
|
-
return /* @__PURE__ */ (0,
|
|
6478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
6067
6479
|
"div",
|
|
6068
6480
|
{
|
|
6069
6481
|
...props,
|
|
@@ -6074,7 +6486,7 @@ function PageControl({
|
|
|
6074
6486
|
slotStyles?.root
|
|
6075
6487
|
),
|
|
6076
6488
|
children: [
|
|
6077
|
-
/* @__PURE__ */ (0,
|
|
6489
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
6078
6490
|
"div",
|
|
6079
6491
|
{
|
|
6080
6492
|
className: cx("nu-page-control__tabs", slotClassNames?.tabs),
|
|
@@ -6085,7 +6497,7 @@ function PageControl({
|
|
|
6085
6497
|
const isActive = page.id === resolvedActivePage?.id;
|
|
6086
6498
|
const panelId = `${generatedId}-panel-${page.id}`;
|
|
6087
6499
|
const tabId = `${generatedId}-tab-${page.id}`;
|
|
6088
|
-
return /* @__PURE__ */ (0,
|
|
6500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
6089
6501
|
"button",
|
|
6090
6502
|
{
|
|
6091
6503
|
"aria-controls": panelId,
|
|
@@ -6109,7 +6521,7 @@ function PageControl({
|
|
|
6109
6521
|
})
|
|
6110
6522
|
}
|
|
6111
6523
|
),
|
|
6112
|
-
/* @__PURE__ */ (0,
|
|
6524
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
6113
6525
|
"div",
|
|
6114
6526
|
{
|
|
6115
6527
|
"aria-labelledby": resolvedActivePage ? `${generatedId}-tab-${resolvedActivePage.id}` : void 0,
|
|
@@ -6126,7 +6538,7 @@ function PageControl({
|
|
|
6126
6538
|
}
|
|
6127
6539
|
|
|
6128
6540
|
// src/components/Panel/Panel.tsx
|
|
6129
|
-
var
|
|
6541
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
6130
6542
|
function Panel({
|
|
6131
6543
|
children,
|
|
6132
6544
|
className,
|
|
@@ -6137,14 +6549,14 @@ function Panel({
|
|
|
6137
6549
|
title,
|
|
6138
6550
|
...props
|
|
6139
6551
|
}) {
|
|
6140
|
-
return /* @__PURE__ */ (0,
|
|
6552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
6141
6553
|
"section",
|
|
6142
6554
|
{
|
|
6143
6555
|
...props,
|
|
6144
6556
|
className: cx("nu-panel", slotClassNames?.root, className),
|
|
6145
6557
|
style: mergeSlotStyle(props.style, slotStyles?.root),
|
|
6146
6558
|
children: [
|
|
6147
|
-
title ? /* @__PURE__ */ (0,
|
|
6559
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
6148
6560
|
"header",
|
|
6149
6561
|
{
|
|
6150
6562
|
className: cx("nu-panel__header", slotClassNames?.header),
|
|
@@ -6152,7 +6564,7 @@ function Panel({
|
|
|
6152
6564
|
children: renderMnemonicText(title)
|
|
6153
6565
|
}
|
|
6154
6566
|
) : null,
|
|
6155
|
-
/* @__PURE__ */ (0,
|
|
6567
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
6156
6568
|
"div",
|
|
6157
6569
|
{
|
|
6158
6570
|
className: cx(
|
|
@@ -6164,7 +6576,7 @@ function Panel({
|
|
|
6164
6576
|
children
|
|
6165
6577
|
}
|
|
6166
6578
|
),
|
|
6167
|
-
footer ? /* @__PURE__ */ (0,
|
|
6579
|
+
footer ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
6168
6580
|
"footer",
|
|
6169
6581
|
{
|
|
6170
6582
|
className: cx("nu-panel__footer", slotClassNames?.footer),
|
|
@@ -6178,8 +6590,8 @@ function Panel({
|
|
|
6178
6590
|
}
|
|
6179
6591
|
|
|
6180
6592
|
// src/components/PropertyGrid/PropertyGrid.tsx
|
|
6181
|
-
var
|
|
6182
|
-
var
|
|
6593
|
+
var import_react35 = require("react");
|
|
6594
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
6183
6595
|
function collectGroupIds(entries) {
|
|
6184
6596
|
const groupIds = /* @__PURE__ */ new Set();
|
|
6185
6597
|
function visit(nextEntries) {
|
|
@@ -6286,25 +6698,25 @@ function PropertyGrid({
|
|
|
6286
6698
|
style,
|
|
6287
6699
|
...props
|
|
6288
6700
|
}) {
|
|
6289
|
-
const editorIdPrefix = (0,
|
|
6290
|
-
const rowButtonRefs = (0,
|
|
6291
|
-
const groupIds = (0,
|
|
6701
|
+
const editorIdPrefix = (0, import_react35.useId)();
|
|
6702
|
+
const rowButtonRefs = (0, import_react35.useRef)({});
|
|
6703
|
+
const groupIds = (0, import_react35.useMemo)(() => collectGroupIds(entries), [entries]);
|
|
6292
6704
|
const isExpandedControlled = expandedIdsProp !== void 0;
|
|
6293
6705
|
const isActiveControlled = activeIdProp !== void 0;
|
|
6294
|
-
const [uncontrolledExpandedIds, setUncontrolledExpandedIds] = (0,
|
|
6706
|
+
const [uncontrolledExpandedIds, setUncontrolledExpandedIds] = (0, import_react35.useState)(() => getInitialExpandedIds(entries, defaultExpandedIds));
|
|
6295
6707
|
const resolvedExpandedIds = expandedIdsProp ?? uncontrolledExpandedIds;
|
|
6296
|
-
const expandedIdSet = (0,
|
|
6708
|
+
const expandedIdSet = (0, import_react35.useMemo)(
|
|
6297
6709
|
() => new Set(
|
|
6298
6710
|
resolvedExpandedIds.filter((expandedId) => groupIds.has(expandedId))
|
|
6299
6711
|
),
|
|
6300
6712
|
[groupIds, resolvedExpandedIds]
|
|
6301
6713
|
);
|
|
6302
|
-
const rows = (0,
|
|
6714
|
+
const rows = (0, import_react35.useMemo)(
|
|
6303
6715
|
() => collectVisibleRows(entries, expandedIdSet),
|
|
6304
6716
|
[entries, expandedIdSet]
|
|
6305
6717
|
);
|
|
6306
|
-
const interactiveRows = (0,
|
|
6307
|
-
const [uncontrolledActiveId, setUncontrolledActiveId] = (0,
|
|
6718
|
+
const interactiveRows = (0, import_react35.useMemo)(() => collectInteractiveRows(rows), [rows]);
|
|
6719
|
+
const [uncontrolledActiveId, setUncontrolledActiveId] = (0, import_react35.useState)(() => getInitialActiveId2(interactiveRows, defaultActiveId));
|
|
6308
6720
|
const requestedActiveId = isActiveControlled ? activeIdProp : uncontrolledActiveId;
|
|
6309
6721
|
const resolvedActiveId = requestedActiveId && interactiveRows.some((row) => row.id === requestedActiveId) ? requestedActiveId : interactiveRows[0]?.id;
|
|
6310
6722
|
function updateExpandedIds(nextExpandedIds) {
|
|
@@ -6423,7 +6835,7 @@ function PropertyGrid({
|
|
|
6423
6835
|
const nextExpandedIds = expandedIdSet.has(entry.id) ? resolvedExpandedIds.filter((expandedId) => expandedId !== entry.id) : [...resolvedExpandedIds, entry.id];
|
|
6424
6836
|
updateExpandedIds(nextExpandedIds);
|
|
6425
6837
|
}
|
|
6426
|
-
return /* @__PURE__ */ (0,
|
|
6838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
6427
6839
|
"div",
|
|
6428
6840
|
{
|
|
6429
6841
|
...props,
|
|
@@ -6434,13 +6846,13 @@ function PropertyGrid({
|
|
|
6434
6846
|
...style,
|
|
6435
6847
|
"--nu-property-grid-label-width": labelWidth
|
|
6436
6848
|
},
|
|
6437
|
-
children: /* @__PURE__ */ (0,
|
|
6849
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "nu-property-grid__body", children: rows.map((row) => {
|
|
6438
6850
|
if (row.type === "section") {
|
|
6439
|
-
return /* @__PURE__ */ (0,
|
|
6851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "nu-property-grid__section", children: renderMnemonicText(row.entry.title) }, row.entry.id);
|
|
6440
6852
|
}
|
|
6441
6853
|
if (row.type === "group") {
|
|
6442
6854
|
const isExpanded = expandedIdSet.has(row.entry.id);
|
|
6443
|
-
return /* @__PURE__ */ (0,
|
|
6855
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
6444
6856
|
"div",
|
|
6445
6857
|
{
|
|
6446
6858
|
className: "nu-property-grid__row",
|
|
@@ -6449,7 +6861,7 @@ function PropertyGrid({
|
|
|
6449
6861
|
"data-expanded": isExpanded || void 0,
|
|
6450
6862
|
"data-group": true,
|
|
6451
6863
|
children: [
|
|
6452
|
-
/* @__PURE__ */ (0,
|
|
6864
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
6453
6865
|
"button",
|
|
6454
6866
|
{
|
|
6455
6867
|
className: "nu-property-grid__label nu-property-grid__label-button",
|
|
@@ -6469,32 +6881,32 @@ function PropertyGrid({
|
|
|
6469
6881
|
"--nu-property-grid-depth": row.depth
|
|
6470
6882
|
},
|
|
6471
6883
|
type: "button",
|
|
6472
|
-
children: /* @__PURE__ */ (0,
|
|
6473
|
-
/* @__PURE__ */ (0,
|
|
6884
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "nu-property-grid__lead", children: [
|
|
6885
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "nu-property-grid__expander", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
6474
6886
|
NuGlyph,
|
|
6475
6887
|
{
|
|
6476
6888
|
name: isExpanded ? "tree-caret-down" : "tree-caret-right"
|
|
6477
6889
|
}
|
|
6478
6890
|
) }),
|
|
6479
|
-
/* @__PURE__ */ (0,
|
|
6891
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "nu-property-grid__label-text", children: renderMnemonicText(row.entry.label) })
|
|
6480
6892
|
] })
|
|
6481
6893
|
}
|
|
6482
6894
|
),
|
|
6483
|
-
/* @__PURE__ */ (0,
|
|
6895
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "nu-property-grid__editor", children: row.entry.summary ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "nu-property-grid__control", children: row.entry.summary }) : null })
|
|
6484
6896
|
]
|
|
6485
6897
|
},
|
|
6486
6898
|
row.entry.id
|
|
6487
6899
|
);
|
|
6488
6900
|
}
|
|
6489
6901
|
const editorId = `${editorIdPrefix}-editor-${row.entry.id}`;
|
|
6490
|
-
return /* @__PURE__ */ (0,
|
|
6902
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
6491
6903
|
"div",
|
|
6492
6904
|
{
|
|
6493
6905
|
className: "nu-property-grid__row",
|
|
6494
6906
|
"data-active": resolvedActiveId === row.entry.id || void 0,
|
|
6495
6907
|
"data-disabled": row.entry.disabled || void 0,
|
|
6496
6908
|
children: [
|
|
6497
|
-
/* @__PURE__ */ (0,
|
|
6909
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
6498
6910
|
"button",
|
|
6499
6911
|
{
|
|
6500
6912
|
className: "nu-property-grid__label nu-property-grid__label-button",
|
|
@@ -6514,21 +6926,21 @@ function PropertyGrid({
|
|
|
6514
6926
|
"--nu-property-grid-depth": row.depth
|
|
6515
6927
|
},
|
|
6516
6928
|
type: "button",
|
|
6517
|
-
children: /* @__PURE__ */ (0,
|
|
6518
|
-
/* @__PURE__ */ (0,
|
|
6519
|
-
/* @__PURE__ */ (0,
|
|
6929
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "nu-property-grid__lead", children: [
|
|
6930
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "nu-property-grid__expander-placeholder" }),
|
|
6931
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "nu-property-grid__label-text", children: renderMnemonicText(row.entry.label) })
|
|
6520
6932
|
] })
|
|
6521
6933
|
}
|
|
6522
6934
|
),
|
|
6523
|
-
/* @__PURE__ */ (0,
|
|
6935
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
6524
6936
|
"div",
|
|
6525
6937
|
{
|
|
6526
6938
|
className: "nu-property-grid__editor",
|
|
6527
6939
|
id: editorId,
|
|
6528
6940
|
onFocusCapture: () => updateActiveId(row.entry.id),
|
|
6529
6941
|
children: [
|
|
6530
|
-
/* @__PURE__ */ (0,
|
|
6531
|
-
row.entry.hint ? /* @__PURE__ */ (0,
|
|
6942
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "nu-property-grid__control", children: row.entry.content }),
|
|
6943
|
+
row.entry.hint ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "nu-property-grid__hint", children: row.entry.hint }) : null
|
|
6532
6944
|
]
|
|
6533
6945
|
}
|
|
6534
6946
|
)
|
|
@@ -6542,8 +6954,8 @@ function PropertyGrid({
|
|
|
6542
6954
|
}
|
|
6543
6955
|
|
|
6544
6956
|
// src/components/ProgressBar/ProgressBar.tsx
|
|
6545
|
-
var
|
|
6546
|
-
function
|
|
6957
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
6958
|
+
function clamp3(value, min, max) {
|
|
6547
6959
|
return Math.min(max, Math.max(min, value));
|
|
6548
6960
|
}
|
|
6549
6961
|
function ProgressBar({
|
|
@@ -6563,10 +6975,10 @@ function ProgressBar({
|
|
|
6563
6975
|
...props
|
|
6564
6976
|
}) {
|
|
6565
6977
|
const safeMax = max <= min ? min + 1 : max;
|
|
6566
|
-
const clampedValue =
|
|
6978
|
+
const clampedValue = clamp3(value, min, safeMax);
|
|
6567
6979
|
const percent = Math.round((clampedValue - min) / (safeMax - min) * 100);
|
|
6568
6980
|
const renderedValue = valueRenderer ? valueRenderer(percent, clampedValue, min, safeMax) : `${percent}%`;
|
|
6569
|
-
return /* @__PURE__ */ (0,
|
|
6981
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
6570
6982
|
"div",
|
|
6571
6983
|
{
|
|
6572
6984
|
...props,
|
|
@@ -6578,7 +6990,7 @@ function ProgressBar({
|
|
|
6578
6990
|
role: "progressbar",
|
|
6579
6991
|
style: mergeSlotStyle(style, slotStyles?.root),
|
|
6580
6992
|
children: [
|
|
6581
|
-
label ? /* @__PURE__ */ (0,
|
|
6993
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
6582
6994
|
"span",
|
|
6583
6995
|
{
|
|
6584
6996
|
className: cx("nu-progress-bar__label", slotClassNames?.label),
|
|
@@ -6586,7 +6998,7 @@ function ProgressBar({
|
|
|
6586
6998
|
children: renderMnemonicText(label)
|
|
6587
6999
|
}
|
|
6588
7000
|
) : null,
|
|
6589
|
-
/* @__PURE__ */ (0,
|
|
7001
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
6590
7002
|
"div",
|
|
6591
7003
|
{
|
|
6592
7004
|
className: cx("nu-progress-bar__track", slotClassNames?.track),
|
|
@@ -6597,7 +7009,7 @@ function ProgressBar({
|
|
|
6597
7009
|
slotStyles?.track
|
|
6598
7010
|
),
|
|
6599
7011
|
children: [
|
|
6600
|
-
/* @__PURE__ */ (0,
|
|
7012
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
6601
7013
|
"div",
|
|
6602
7014
|
{
|
|
6603
7015
|
className: cx("nu-progress-bar__fill", slotClassNames?.fill),
|
|
@@ -6610,7 +7022,7 @@ function ProgressBar({
|
|
|
6610
7022
|
)
|
|
6611
7023
|
}
|
|
6612
7024
|
),
|
|
6613
|
-
showValue ? /* @__PURE__ */ (0,
|
|
7025
|
+
showValue ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
6614
7026
|
"span",
|
|
6615
7027
|
{
|
|
6616
7028
|
className: cx("nu-progress-bar__value", slotClassNames?.value),
|
|
@@ -6621,7 +7033,7 @@ function ProgressBar({
|
|
|
6621
7033
|
]
|
|
6622
7034
|
}
|
|
6623
7035
|
),
|
|
6624
|
-
hint ? /* @__PURE__ */ (0,
|
|
7036
|
+
hint ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
6625
7037
|
"span",
|
|
6626
7038
|
{
|
|
6627
7039
|
className: cx("nu-progress-bar__hint", slotClassNames?.hint),
|
|
@@ -6635,8 +7047,8 @@ function ProgressBar({
|
|
|
6635
7047
|
}
|
|
6636
7048
|
|
|
6637
7049
|
// src/components/RadioGroup/RadioButton.tsx
|
|
6638
|
-
var
|
|
6639
|
-
var
|
|
7050
|
+
var import_react36 = require("react");
|
|
7051
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
6640
7052
|
function RadioButton({
|
|
6641
7053
|
checked,
|
|
6642
7054
|
className,
|
|
@@ -6648,11 +7060,11 @@ function RadioButton({
|
|
|
6648
7060
|
onCheckedChange,
|
|
6649
7061
|
...props
|
|
6650
7062
|
}) {
|
|
6651
|
-
const generatedId = (0,
|
|
7063
|
+
const generatedId = (0, import_react36.useId)();
|
|
6652
7064
|
const inputId = id ?? generatedId;
|
|
6653
7065
|
const hintId = hint ? `${inputId}-hint` : void 0;
|
|
6654
7066
|
const isControlled = checked !== void 0;
|
|
6655
|
-
const [uncontrolledChecked, setUncontrolledChecked] = (0,
|
|
7067
|
+
const [uncontrolledChecked, setUncontrolledChecked] = (0, import_react36.useState)(defaultChecked);
|
|
6656
7068
|
const resolvedChecked = isControlled ? checked : uncontrolledChecked;
|
|
6657
7069
|
function handleChange(event) {
|
|
6658
7070
|
if (!isControlled) {
|
|
@@ -6660,9 +7072,9 @@ function RadioButton({
|
|
|
6660
7072
|
}
|
|
6661
7073
|
onCheckedChange?.(event.target.checked, event);
|
|
6662
7074
|
}
|
|
6663
|
-
return /* @__PURE__ */ (0,
|
|
6664
|
-
/* @__PURE__ */ (0,
|
|
6665
|
-
/* @__PURE__ */ (0,
|
|
7075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: ["nu-radio-button", className].filter(Boolean).join(" "), children: [
|
|
7076
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("span", { className: "nu-radio-button__main", children: [
|
|
7077
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
6666
7078
|
"input",
|
|
6667
7079
|
{
|
|
6668
7080
|
...props,
|
|
@@ -6675,19 +7087,19 @@ function RadioButton({
|
|
|
6675
7087
|
type: "radio"
|
|
6676
7088
|
}
|
|
6677
7089
|
),
|
|
6678
|
-
/* @__PURE__ */ (0,
|
|
6679
|
-
/* @__PURE__ */ (0,
|
|
6680
|
-
resolvedChecked ? /* @__PURE__ */ (0,
|
|
7090
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { "aria-hidden": "true", className: "nu-radio-button__control", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("span", { className: "nu-radio-button__disc", children: [
|
|
7091
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(NuGlyph, { className: "nu-radio-button__ring", name: "radio-ring" }),
|
|
7092
|
+
resolvedChecked ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(NuGlyph, { className: "nu-radio-button__fill", name: "radio-fill" }) : null
|
|
6681
7093
|
] }) }),
|
|
6682
|
-
/* @__PURE__ */ (0,
|
|
7094
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "nu-radio-button__label", children: renderMnemonicText(label) })
|
|
6683
7095
|
] }),
|
|
6684
|
-
hint ? /* @__PURE__ */ (0,
|
|
7096
|
+
hint ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "nu-radio-button__hint", id: hintId, children: hint }) : null
|
|
6685
7097
|
] });
|
|
6686
7098
|
}
|
|
6687
7099
|
|
|
6688
7100
|
// src/components/RadioGroup/RadioGroup.tsx
|
|
6689
|
-
var
|
|
6690
|
-
var
|
|
7101
|
+
var import_react37 = require("react");
|
|
7102
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
6691
7103
|
function RadioGroup({
|
|
6692
7104
|
className,
|
|
6693
7105
|
defaultValue,
|
|
@@ -6702,11 +7114,11 @@ function RadioGroup({
|
|
|
6702
7114
|
value,
|
|
6703
7115
|
...props
|
|
6704
7116
|
}) {
|
|
6705
|
-
const generatedId = (0,
|
|
7117
|
+
const generatedId = (0, import_react37.useId)();
|
|
6706
7118
|
const groupName = name ?? generatedId;
|
|
6707
7119
|
const hintId = hint ? `${groupName}-hint` : void 0;
|
|
6708
7120
|
const isControlled = value !== void 0;
|
|
6709
|
-
const [uncontrolledValue, setUncontrolledValue] = (0,
|
|
7121
|
+
const [uncontrolledValue, setUncontrolledValue] = (0, import_react37.useState)(defaultValue ?? options[0]?.value);
|
|
6710
7122
|
const resolvedValue = isControlled ? value : uncontrolledValue;
|
|
6711
7123
|
function commitValue(nextValue) {
|
|
6712
7124
|
if (!isControlled) {
|
|
@@ -6714,7 +7126,7 @@ function RadioGroup({
|
|
|
6714
7126
|
}
|
|
6715
7127
|
onValueChange?.(nextValue);
|
|
6716
7128
|
}
|
|
6717
|
-
return /* @__PURE__ */ (0,
|
|
7129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
6718
7130
|
"fieldset",
|
|
6719
7131
|
{
|
|
6720
7132
|
...props,
|
|
@@ -6722,7 +7134,7 @@ function RadioGroup({
|
|
|
6722
7134
|
className: cx("nu-radio-group", slotClassNames?.root, className),
|
|
6723
7135
|
style: mergeSlotStyle(style, slotStyles?.root),
|
|
6724
7136
|
children: [
|
|
6725
|
-
label ? /* @__PURE__ */ (0,
|
|
7137
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
6726
7138
|
"legend",
|
|
6727
7139
|
{
|
|
6728
7140
|
className: cx("nu-radio-group__label", slotClassNames?.label),
|
|
@@ -6730,12 +7142,12 @@ function RadioGroup({
|
|
|
6730
7142
|
children: renderMnemonicText(label)
|
|
6731
7143
|
}
|
|
6732
7144
|
) : null,
|
|
6733
|
-
/* @__PURE__ */ (0,
|
|
7145
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
6734
7146
|
"div",
|
|
6735
7147
|
{
|
|
6736
7148
|
className: cx("nu-radio-group__options", slotClassNames?.options),
|
|
6737
7149
|
style: slotStyles?.options,
|
|
6738
|
-
children: options.map((option) => /* @__PURE__ */ (0,
|
|
7150
|
+
children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
6739
7151
|
RadioButton,
|
|
6740
7152
|
{
|
|
6741
7153
|
checked: resolvedValue === option.value,
|
|
@@ -6754,7 +7166,7 @@ function RadioGroup({
|
|
|
6754
7166
|
))
|
|
6755
7167
|
}
|
|
6756
7168
|
),
|
|
6757
|
-
hint ? /* @__PURE__ */ (0,
|
|
7169
|
+
hint ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
6758
7170
|
"span",
|
|
6759
7171
|
{
|
|
6760
7172
|
className: cx("nu-radio-group__hint", slotClassNames?.hint),
|
|
@@ -6769,14 +7181,14 @@ function RadioGroup({
|
|
|
6769
7181
|
}
|
|
6770
7182
|
|
|
6771
7183
|
// src/components/ReportCell/ReportCell.tsx
|
|
6772
|
-
var
|
|
7184
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
6773
7185
|
function ReportCell({
|
|
6774
7186
|
align = "start",
|
|
6775
7187
|
className,
|
|
6776
7188
|
tone = "default",
|
|
6777
7189
|
...props
|
|
6778
7190
|
}) {
|
|
6779
|
-
return /* @__PURE__ */ (0,
|
|
7191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
6780
7192
|
"span",
|
|
6781
7193
|
{
|
|
6782
7194
|
...props,
|
|
@@ -6791,9 +7203,9 @@ function ReportCell({
|
|
|
6791
7203
|
}
|
|
6792
7204
|
|
|
6793
7205
|
// src/components/SearchBox/SearchBox.tsx
|
|
6794
|
-
var
|
|
7206
|
+
var import_react38 = require("react");
|
|
6795
7207
|
var import_react_dom4 = require("react-dom");
|
|
6796
|
-
var
|
|
7208
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
6797
7209
|
function resolveSearchBoxPortalRoot() {
|
|
6798
7210
|
return document.body;
|
|
6799
7211
|
}
|
|
@@ -6821,24 +7233,24 @@ function SearchBox({
|
|
|
6821
7233
|
style,
|
|
6822
7234
|
...props
|
|
6823
7235
|
}) {
|
|
6824
|
-
const rootRef = (0,
|
|
6825
|
-
const fieldRef = (0,
|
|
6826
|
-
const inputRef = (0,
|
|
6827
|
-
const popupRef = (0,
|
|
6828
|
-
const requestIdRef = (0,
|
|
6829
|
-
const generatedId = (0,
|
|
7236
|
+
const rootRef = (0, import_react38.useRef)(null);
|
|
7237
|
+
const fieldRef = (0, import_react38.useRef)(null);
|
|
7238
|
+
const inputRef = (0, import_react38.useRef)(null);
|
|
7239
|
+
const popupRef = (0, import_react38.useRef)(null);
|
|
7240
|
+
const requestIdRef = (0, import_react38.useRef)(0);
|
|
7241
|
+
const generatedId = (0, import_react38.useId)();
|
|
6830
7242
|
const fieldId = `${generatedId}-search-box`;
|
|
6831
7243
|
const labelId = `${fieldId}-label`;
|
|
6832
7244
|
const hintId = hint ? `${fieldId}-hint` : void 0;
|
|
6833
7245
|
const isQueryControlled = queryProp !== void 0;
|
|
6834
|
-
const [uncontrolledQuery, setUncontrolledQuery] = (0,
|
|
6835
|
-
const [open, setOpen] = (0,
|
|
6836
|
-
const [status, setStatus] = (0,
|
|
6837
|
-
const [results, setResults] = (0,
|
|
6838
|
-
const [selectedValue, setSelectedValue] = (0,
|
|
7246
|
+
const [uncontrolledQuery, setUncontrolledQuery] = (0, import_react38.useState)(defaultQuery);
|
|
7247
|
+
const [open, setOpen] = (0, import_react38.useState)(false);
|
|
7248
|
+
const [status, setStatus] = (0, import_react38.useState)("idle");
|
|
7249
|
+
const [results, setResults] = (0, import_react38.useState)([]);
|
|
7250
|
+
const [selectedValue, setSelectedValue] = (0, import_react38.useState)(null);
|
|
6839
7251
|
const normalizedQuery = (isQueryControlled ? queryProp : uncontrolledQuery) ?? "";
|
|
6840
7252
|
const trimmedQuery = normalizedQuery.trim();
|
|
6841
|
-
const resultOptions = (0,
|
|
7253
|
+
const resultOptions = (0, import_react38.useMemo)(() => {
|
|
6842
7254
|
return results.map((item, index) => ({
|
|
6843
7255
|
item,
|
|
6844
7256
|
listBoxItem: {
|
|
@@ -6852,7 +7264,7 @@ function SearchBox({
|
|
|
6852
7264
|
value: getItemId(item, index)
|
|
6853
7265
|
}));
|
|
6854
7266
|
}, [getItemDetails, getItemDisabled, getItemId, getItemText, results]);
|
|
6855
|
-
const listBoxData = (0,
|
|
7267
|
+
const listBoxData = (0, import_react38.useMemo)(
|
|
6856
7268
|
() => [
|
|
6857
7269
|
{
|
|
6858
7270
|
category: null,
|
|
@@ -6862,8 +7274,8 @@ function SearchBox({
|
|
|
6862
7274
|
[resultOptions]
|
|
6863
7275
|
);
|
|
6864
7276
|
const popupRoot = typeof document === "undefined" ? null : resolveSearchBoxPortalRoot();
|
|
6865
|
-
const [themePortalStyle, setThemePortalStyle] = (0,
|
|
6866
|
-
(0,
|
|
7277
|
+
const [themePortalStyle, setThemePortalStyle] = (0, import_react38.useState)(() => void 0);
|
|
7278
|
+
(0, import_react38.useEffect)(() => {
|
|
6867
7279
|
if (disabled) {
|
|
6868
7280
|
return;
|
|
6869
7281
|
}
|
|
@@ -6895,7 +7307,7 @@ function SearchBox({
|
|
|
6895
7307
|
popupRef,
|
|
6896
7308
|
portalRoot: popupRoot
|
|
6897
7309
|
});
|
|
6898
|
-
(0,
|
|
7310
|
+
(0, import_react38.useEffect)(() => {
|
|
6899
7311
|
if (disabled || !open) {
|
|
6900
7312
|
return;
|
|
6901
7313
|
}
|
|
@@ -6943,15 +7355,15 @@ function SearchBox({
|
|
|
6943
7355
|
}
|
|
6944
7356
|
function renderPopupContent() {
|
|
6945
7357
|
if (status === "loading") {
|
|
6946
|
-
return /* @__PURE__ */ (0,
|
|
7358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "nu-search-box__status", children: loadingText });
|
|
6947
7359
|
}
|
|
6948
7360
|
if (status === "error") {
|
|
6949
|
-
return /* @__PURE__ */ (0,
|
|
7361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "nu-search-box__status", children: errorText });
|
|
6950
7362
|
}
|
|
6951
7363
|
if (trimmedQuery.length < minQueryLength) {
|
|
6952
|
-
return /* @__PURE__ */ (0,
|
|
7364
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "nu-search-box__status", children: idleText });
|
|
6953
7365
|
}
|
|
6954
|
-
return /* @__PURE__ */ (0,
|
|
7366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "nu-search-box__listbox", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
6955
7367
|
ListBox,
|
|
6956
7368
|
{
|
|
6957
7369
|
data: listBoxData,
|
|
@@ -6988,7 +7400,7 @@ function SearchBox({
|
|
|
6988
7400
|
break;
|
|
6989
7401
|
}
|
|
6990
7402
|
}
|
|
6991
|
-
return /* @__PURE__ */ (0,
|
|
7403
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
6992
7404
|
"div",
|
|
6993
7405
|
{
|
|
6994
7406
|
...props,
|
|
@@ -6996,10 +7408,10 @@ function SearchBox({
|
|
|
6996
7408
|
ref: rootRef,
|
|
6997
7409
|
style,
|
|
6998
7410
|
children: [
|
|
6999
|
-
/* @__PURE__ */ (0,
|
|
7000
|
-
/* @__PURE__ */ (0,
|
|
7001
|
-
/* @__PURE__ */ (0,
|
|
7002
|
-
/* @__PURE__ */ (0,
|
|
7411
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("label", { className: "nu-search-box__label", htmlFor: fieldId, id: labelId, children: renderMnemonicText(label) }),
|
|
7412
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "nu-search-box__slot", ref: fieldRef, children: [
|
|
7413
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { "aria-hidden": "true", className: "nu-search-box__bracket", children: "[" }),
|
|
7414
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "nu-search-box__input-shell", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
7003
7415
|
"input",
|
|
7004
7416
|
{
|
|
7005
7417
|
"aria-autocomplete": "list",
|
|
@@ -7024,11 +7436,11 @@ function SearchBox({
|
|
|
7024
7436
|
value: normalizedQuery
|
|
7025
7437
|
}
|
|
7026
7438
|
) }),
|
|
7027
|
-
/* @__PURE__ */ (0,
|
|
7439
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { "aria-hidden": "true", className: "nu-search-box__bracket", children: "]" })
|
|
7028
7440
|
] }),
|
|
7029
|
-
hint ? /* @__PURE__ */ (0,
|
|
7441
|
+
hint ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "nu-search-box__hint", id: hintId, children: hint }) : null,
|
|
7030
7442
|
open && popupRoot ? (0, import_react_dom4.createPortal)(
|
|
7031
|
-
/* @__PURE__ */ (0,
|
|
7443
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
7032
7444
|
"div",
|
|
7033
7445
|
{
|
|
7034
7446
|
className: "nu-search-box__popup",
|
|
@@ -7046,8 +7458,8 @@ function SearchBox({
|
|
|
7046
7458
|
}
|
|
7047
7459
|
|
|
7048
7460
|
// src/components/SpinBox/SpinBox.tsx
|
|
7049
|
-
var
|
|
7050
|
-
var
|
|
7461
|
+
var import_react39 = require("react");
|
|
7462
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
7051
7463
|
function clampSpinValue(value, min, max) {
|
|
7052
7464
|
let nextValue = value;
|
|
7053
7465
|
if (min !== void 0) {
|
|
@@ -7088,7 +7500,7 @@ function SpinBox({
|
|
|
7088
7500
|
value,
|
|
7089
7501
|
...props
|
|
7090
7502
|
}) {
|
|
7091
|
-
const generatedId = (0,
|
|
7503
|
+
const generatedId = (0, import_react39.useId)();
|
|
7092
7504
|
const fieldId = id ?? generatedId;
|
|
7093
7505
|
const hintId = hint ? `${fieldId}-hint` : void 0;
|
|
7094
7506
|
const isControlled = value !== void 0;
|
|
@@ -7097,9 +7509,9 @@ function SpinBox({
|
|
|
7097
7509
|
min,
|
|
7098
7510
|
max
|
|
7099
7511
|
);
|
|
7100
|
-
const [uncontrolledValue, setUncontrolledValue] = (0,
|
|
7512
|
+
const [uncontrolledValue, setUncontrolledValue] = (0, import_react39.useState)(initialNumericValue);
|
|
7101
7513
|
const numericValue = isControlled ? clampSpinValue(value ?? initialNumericValue, min, max) : uncontrolledValue;
|
|
7102
|
-
const [uncontrolledDraftValue, setUncontrolledDraftValue] = (0,
|
|
7514
|
+
const [uncontrolledDraftValue, setUncontrolledDraftValue] = (0, import_react39.useState)(
|
|
7103
7515
|
() => formatSpinValue(initialNumericValue)
|
|
7104
7516
|
);
|
|
7105
7517
|
const draftValue = isControlled ? formatSpinValue(numericValue) : uncontrolledDraftValue;
|
|
@@ -7152,22 +7564,22 @@ function SpinBox({
|
|
|
7152
7564
|
}
|
|
7153
7565
|
onKeyDown?.(event);
|
|
7154
7566
|
}
|
|
7155
|
-
const decrementDisabled = (0,
|
|
7567
|
+
const decrementDisabled = (0, import_react39.useMemo)(
|
|
7156
7568
|
() => disabled || min !== void 0 && numericValue <= min,
|
|
7157
7569
|
[disabled, min, numericValue]
|
|
7158
7570
|
);
|
|
7159
|
-
const incrementDisabled = (0,
|
|
7571
|
+
const incrementDisabled = (0, import_react39.useMemo)(
|
|
7160
7572
|
() => disabled || max !== void 0 && numericValue >= max,
|
|
7161
7573
|
[disabled, max, numericValue]
|
|
7162
7574
|
);
|
|
7163
|
-
return /* @__PURE__ */ (0,
|
|
7575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
7164
7576
|
"label",
|
|
7165
7577
|
{
|
|
7166
7578
|
className: cx("nu-spin-box", slotClassNames?.root, className),
|
|
7167
7579
|
htmlFor: fieldId,
|
|
7168
7580
|
style: mergeSlotStyle(style, slotStyles?.root),
|
|
7169
7581
|
children: [
|
|
7170
|
-
/* @__PURE__ */ (0,
|
|
7582
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
7171
7583
|
"span",
|
|
7172
7584
|
{
|
|
7173
7585
|
className: cx("nu-spin-box__label", slotClassNames?.label),
|
|
@@ -7175,13 +7587,13 @@ function SpinBox({
|
|
|
7175
7587
|
children: renderMnemonicText(label)
|
|
7176
7588
|
}
|
|
7177
7589
|
),
|
|
7178
|
-
/* @__PURE__ */ (0,
|
|
7590
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
7179
7591
|
"span",
|
|
7180
7592
|
{
|
|
7181
7593
|
className: cx("nu-spin-box__slot", slotClassNames?.slot),
|
|
7182
7594
|
style: slotStyles?.slot,
|
|
7183
7595
|
children: [
|
|
7184
|
-
/* @__PURE__ */ (0,
|
|
7596
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
7185
7597
|
"span",
|
|
7186
7598
|
{
|
|
7187
7599
|
"aria-hidden": "true",
|
|
@@ -7190,12 +7602,12 @@ function SpinBox({
|
|
|
7190
7602
|
children: "["
|
|
7191
7603
|
}
|
|
7192
7604
|
),
|
|
7193
|
-
/* @__PURE__ */ (0,
|
|
7605
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
7194
7606
|
"span",
|
|
7195
7607
|
{
|
|
7196
7608
|
className: cx("nu-spin-box__input-shell", slotClassNames?.inputShell),
|
|
7197
7609
|
style: slotStyles?.inputShell,
|
|
7198
|
-
children: /* @__PURE__ */ (0,
|
|
7610
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
7199
7611
|
"input",
|
|
7200
7612
|
{
|
|
7201
7613
|
...props,
|
|
@@ -7214,7 +7626,7 @@ function SpinBox({
|
|
|
7214
7626
|
)
|
|
7215
7627
|
}
|
|
7216
7628
|
),
|
|
7217
|
-
/* @__PURE__ */ (0,
|
|
7629
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
7218
7630
|
"span",
|
|
7219
7631
|
{
|
|
7220
7632
|
"aria-hidden": "true",
|
|
@@ -7223,13 +7635,13 @@ function SpinBox({
|
|
|
7223
7635
|
children: "]"
|
|
7224
7636
|
}
|
|
7225
7637
|
),
|
|
7226
|
-
/* @__PURE__ */ (0,
|
|
7638
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
7227
7639
|
"span",
|
|
7228
7640
|
{
|
|
7229
7641
|
className: cx("nu-spin-box__controls", slotClassNames?.controls),
|
|
7230
7642
|
style: slotStyles?.controls,
|
|
7231
7643
|
children: [
|
|
7232
|
-
/* @__PURE__ */ (0,
|
|
7644
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
7233
7645
|
"button",
|
|
7234
7646
|
{
|
|
7235
7647
|
className: cx("nu-spin-box__button", slotClassNames?.button),
|
|
@@ -7240,7 +7652,7 @@ function SpinBox({
|
|
|
7240
7652
|
children: "-"
|
|
7241
7653
|
}
|
|
7242
7654
|
),
|
|
7243
|
-
/* @__PURE__ */ (0,
|
|
7655
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
7244
7656
|
"button",
|
|
7245
7657
|
{
|
|
7246
7658
|
className: cx("nu-spin-box__button", slotClassNames?.button),
|
|
@@ -7257,7 +7669,7 @@ function SpinBox({
|
|
|
7257
7669
|
]
|
|
7258
7670
|
}
|
|
7259
7671
|
),
|
|
7260
|
-
hint ? /* @__PURE__ */ (0,
|
|
7672
|
+
hint ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
7261
7673
|
"span",
|
|
7262
7674
|
{
|
|
7263
7675
|
className: cx("nu-spin-box__hint", slotClassNames?.hint),
|
|
@@ -7272,9 +7684,9 @@ function SpinBox({
|
|
|
7272
7684
|
}
|
|
7273
7685
|
|
|
7274
7686
|
// src/components/Splitter/Splitter.tsx
|
|
7275
|
-
var
|
|
7276
|
-
var
|
|
7277
|
-
function
|
|
7687
|
+
var import_react40 = require("react");
|
|
7688
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
7689
|
+
function clamp4(value, min, max) {
|
|
7278
7690
|
return Math.min(max, Math.max(min, value));
|
|
7279
7691
|
}
|
|
7280
7692
|
function Splitter({
|
|
@@ -7304,26 +7716,26 @@ function Splitter({
|
|
|
7304
7716
|
const parsedValue = Number(rawValue);
|
|
7305
7717
|
return Number.isFinite(parsedValue) ? parsedValue : null;
|
|
7306
7718
|
};
|
|
7307
|
-
const [uncontrolledValue, setUncontrolledValue] = (0,
|
|
7308
|
-
|
|
7719
|
+
const [uncontrolledValue, setUncontrolledValue] = (0, import_react40.useState)(
|
|
7720
|
+
clamp4(getSavedValue() ?? defaultValue, min, max)
|
|
7309
7721
|
);
|
|
7310
|
-
const rootRef = (0,
|
|
7311
|
-
const dragFrameRef = (0,
|
|
7312
|
-
const dragValueRef = (0,
|
|
7313
|
-
const activeValue =
|
|
7722
|
+
const rootRef = (0, import_react40.useRef)(null);
|
|
7723
|
+
const dragFrameRef = (0, import_react40.useRef)(null);
|
|
7724
|
+
const dragValueRef = (0, import_react40.useRef)(null);
|
|
7725
|
+
const activeValue = clamp4(
|
|
7314
7726
|
(isControlled ? value : uncontrolledValue) ?? defaultValue,
|
|
7315
7727
|
min,
|
|
7316
7728
|
max
|
|
7317
7729
|
);
|
|
7318
|
-
const firstPaneId = (0,
|
|
7319
|
-
const secondPaneId = (0,
|
|
7320
|
-
(0,
|
|
7730
|
+
const firstPaneId = (0, import_react40.useId)();
|
|
7731
|
+
const secondPaneId = (0, import_react40.useId)();
|
|
7732
|
+
(0, import_react40.useEffect)(() => {
|
|
7321
7733
|
if (!storageKey || typeof window === "undefined") {
|
|
7322
7734
|
return;
|
|
7323
7735
|
}
|
|
7324
7736
|
window.localStorage.setItem(storageKey, String(activeValue));
|
|
7325
7737
|
}, [activeValue, storageKey]);
|
|
7326
|
-
(0,
|
|
7738
|
+
(0, import_react40.useEffect)(() => {
|
|
7327
7739
|
return () => {
|
|
7328
7740
|
if (dragFrameRef.current !== null) {
|
|
7329
7741
|
window.cancelAnimationFrame(dragFrameRef.current);
|
|
@@ -7332,7 +7744,7 @@ function Splitter({
|
|
|
7332
7744
|
};
|
|
7333
7745
|
}, []);
|
|
7334
7746
|
function commitValue(nextValue) {
|
|
7335
|
-
const clampedValue =
|
|
7747
|
+
const clampedValue = clamp4(nextValue, min, max);
|
|
7336
7748
|
if (!isControlled) {
|
|
7337
7749
|
setUncontrolledValue(clampedValue);
|
|
7338
7750
|
}
|
|
@@ -7352,7 +7764,7 @@ function Splitter({
|
|
|
7352
7764
|
function computeValue(clientX, clientY) {
|
|
7353
7765
|
const bounds = rootElement.getBoundingClientRect();
|
|
7354
7766
|
const nextValue = orientation === "vertical" ? (clientX - bounds.left) / bounds.width : (clientY - bounds.top) / bounds.height;
|
|
7355
|
-
return
|
|
7767
|
+
return clamp4(nextValue, min, max);
|
|
7356
7768
|
}
|
|
7357
7769
|
function flushDragValue() {
|
|
7358
7770
|
dragFrameRef.current = null;
|
|
@@ -7428,7 +7840,7 @@ function Splitter({
|
|
|
7428
7840
|
commitValue(max);
|
|
7429
7841
|
}
|
|
7430
7842
|
}
|
|
7431
|
-
return /* @__PURE__ */ (0,
|
|
7843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
7432
7844
|
"div",
|
|
7433
7845
|
{
|
|
7434
7846
|
...props,
|
|
@@ -7440,8 +7852,8 @@ function Splitter({
|
|
|
7440
7852
|
"--nu-splitter-value": `${activeValue * 100}%`
|
|
7441
7853
|
},
|
|
7442
7854
|
children: [
|
|
7443
|
-
/* @__PURE__ */ (0,
|
|
7444
|
-
/* @__PURE__ */ (0,
|
|
7855
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "nu-splitter__pane", id: firstPaneId, children: first }),
|
|
7856
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
7445
7857
|
"div",
|
|
7446
7858
|
{
|
|
7447
7859
|
"aria-controls": `${firstPaneId} ${secondPaneId}`,
|
|
@@ -7454,7 +7866,7 @@ function Splitter({
|
|
|
7454
7866
|
onPointerDown: handlePointerDown,
|
|
7455
7867
|
role: "separator",
|
|
7456
7868
|
tabIndex: 0,
|
|
7457
|
-
children: /* @__PURE__ */ (0,
|
|
7869
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
7458
7870
|
"span",
|
|
7459
7871
|
{
|
|
7460
7872
|
"aria-hidden": "true",
|
|
@@ -7464,16 +7876,16 @@ function Splitter({
|
|
|
7464
7876
|
)
|
|
7465
7877
|
}
|
|
7466
7878
|
),
|
|
7467
|
-
/* @__PURE__ */ (0,
|
|
7879
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "nu-splitter__pane", id: secondPaneId, children: second })
|
|
7468
7880
|
]
|
|
7469
7881
|
}
|
|
7470
7882
|
);
|
|
7471
7883
|
}
|
|
7472
7884
|
|
|
7473
7885
|
// src/components/TickBar/TickBar.tsx
|
|
7474
|
-
var
|
|
7475
|
-
var
|
|
7476
|
-
function
|
|
7886
|
+
var import_react41 = require("react");
|
|
7887
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
7888
|
+
function clamp5(value, min, max) {
|
|
7477
7889
|
return Math.min(max, Math.max(min, value));
|
|
7478
7890
|
}
|
|
7479
7891
|
function snapToStep(value, min, step) {
|
|
@@ -7506,23 +7918,23 @@ function TickBar({
|
|
|
7506
7918
|
valueRenderer,
|
|
7507
7919
|
...props
|
|
7508
7920
|
}) {
|
|
7509
|
-
const generatedId = (0,
|
|
7921
|
+
const generatedId = (0, import_react41.useId)();
|
|
7510
7922
|
const sliderId = id ?? generatedId;
|
|
7511
7923
|
const hintId = hint ? `${sliderId}-hint` : void 0;
|
|
7512
7924
|
const safeStep = step > 0 ? step : 1;
|
|
7513
7925
|
const safeMax = max <= min ? min + safeStep : max;
|
|
7514
7926
|
const isControlled = value !== void 0;
|
|
7515
|
-
const initialValue =
|
|
7927
|
+
const initialValue = clamp5(
|
|
7516
7928
|
snapToStep(defaultValue ?? min, min, safeStep),
|
|
7517
7929
|
min,
|
|
7518
7930
|
safeMax
|
|
7519
7931
|
);
|
|
7520
|
-
const [uncontrolledValue, setUncontrolledValue] = (0,
|
|
7521
|
-
const [dragging, setDragging] = (0,
|
|
7522
|
-
const trackRef = (0,
|
|
7523
|
-
const resolvedValue = isControlled ?
|
|
7932
|
+
const [uncontrolledValue, setUncontrolledValue] = (0, import_react41.useState)(initialValue);
|
|
7933
|
+
const [dragging, setDragging] = (0, import_react41.useState)(false);
|
|
7934
|
+
const trackRef = (0, import_react41.useRef)(null);
|
|
7935
|
+
const resolvedValue = isControlled ? clamp5(snapToStep(value ?? initialValue, min, safeStep), min, safeMax) : uncontrolledValue;
|
|
7524
7936
|
const ratio = safeMax === min ? 0 : (resolvedValue - min) / (safeMax - min);
|
|
7525
|
-
const derivedTickCount = (0,
|
|
7937
|
+
const derivedTickCount = (0, import_react41.useMemo)(() => {
|
|
7526
7938
|
if (tickCount !== void 0) {
|
|
7527
7939
|
return Math.max(2, tickCount);
|
|
7528
7940
|
}
|
|
@@ -7532,7 +7944,7 @@ function TickBar({
|
|
|
7532
7944
|
);
|
|
7533
7945
|
}, [min, safeMax, safeStep, tickCount]);
|
|
7534
7946
|
const renderedValue = valueRenderer ? valueRenderer(resolvedValue, min, safeMax) : String(resolvedValue);
|
|
7535
|
-
(0,
|
|
7947
|
+
(0, import_react41.useEffect)(() => {
|
|
7536
7948
|
if (!dragging) {
|
|
7537
7949
|
return;
|
|
7538
7950
|
}
|
|
@@ -7543,7 +7955,7 @@ function TickBar({
|
|
|
7543
7955
|
return () => window.removeEventListener("pointerup", cancelDrag);
|
|
7544
7956
|
}, [dragging]);
|
|
7545
7957
|
function commitValue(nextValue) {
|
|
7546
|
-
const snappedValue =
|
|
7958
|
+
const snappedValue = clamp5(
|
|
7547
7959
|
snapToStep(nextValue, min, safeStep),
|
|
7548
7960
|
min,
|
|
7549
7961
|
safeMax
|
|
@@ -7559,7 +7971,7 @@ function TickBar({
|
|
|
7559
7971
|
return;
|
|
7560
7972
|
}
|
|
7561
7973
|
const rect = track.getBoundingClientRect();
|
|
7562
|
-
const nextRatio = orientation === "vertical" ?
|
|
7974
|
+
const nextRatio = orientation === "vertical" ? clamp5((rect.bottom - clientY) / rect.height, 0, 1) : clamp5((clientX - rect.left) / rect.width, 0, 1);
|
|
7563
7975
|
commitValue(min + nextRatio * (safeMax - min));
|
|
7564
7976
|
}
|
|
7565
7977
|
function nudge(direction, multiplier = 1) {
|
|
@@ -7608,7 +8020,7 @@ function TickBar({
|
|
|
7608
8020
|
}
|
|
7609
8021
|
onKeyDown?.(event);
|
|
7610
8022
|
}
|
|
7611
|
-
return /* @__PURE__ */ (0,
|
|
8023
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
7612
8024
|
"div",
|
|
7613
8025
|
{
|
|
7614
8026
|
...props,
|
|
@@ -7621,7 +8033,7 @@ function TickBar({
|
|
|
7621
8033
|
slotStyles?.root
|
|
7622
8034
|
),
|
|
7623
8035
|
children: [
|
|
7624
|
-
label ? /* @__PURE__ */ (0,
|
|
8036
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
7625
8037
|
"span",
|
|
7626
8038
|
{
|
|
7627
8039
|
className: cx("nu-tick-bar__label", slotClassNames?.label),
|
|
@@ -7629,13 +8041,13 @@ function TickBar({
|
|
|
7629
8041
|
children: renderMnemonicText(label)
|
|
7630
8042
|
}
|
|
7631
8043
|
) : null,
|
|
7632
|
-
/* @__PURE__ */ (0,
|
|
8044
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
7633
8045
|
"div",
|
|
7634
8046
|
{
|
|
7635
8047
|
className: cx("nu-tick-bar__slot", slotClassNames?.slot),
|
|
7636
8048
|
style: slotStyles?.slot,
|
|
7637
8049
|
children: [
|
|
7638
|
-
/* @__PURE__ */ (0,
|
|
8050
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
7639
8051
|
"div",
|
|
7640
8052
|
{
|
|
7641
8053
|
"aria-describedby": hintId,
|
|
@@ -7677,19 +8089,19 @@ function TickBar({
|
|
|
7677
8089
|
style: slotStyles?.track,
|
|
7678
8090
|
tabIndex: disabled ? -1 : 0,
|
|
7679
8091
|
children: [
|
|
7680
|
-
/* @__PURE__ */ (0,
|
|
8092
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
7681
8093
|
"div",
|
|
7682
8094
|
{
|
|
7683
8095
|
className: cx("nu-tick-bar__rail", slotClassNames?.rail),
|
|
7684
8096
|
style: slotStyles?.rail
|
|
7685
8097
|
}
|
|
7686
8098
|
),
|
|
7687
|
-
/* @__PURE__ */ (0,
|
|
8099
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
7688
8100
|
"div",
|
|
7689
8101
|
{
|
|
7690
8102
|
className: cx("nu-tick-bar__ticks", slotClassNames?.ticks),
|
|
7691
8103
|
style: slotStyles?.ticks,
|
|
7692
|
-
children: Array.from({ length: derivedTickCount }, (_, index) => /* @__PURE__ */ (0,
|
|
8104
|
+
children: Array.from({ length: derivedTickCount }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
7693
8105
|
"span",
|
|
7694
8106
|
{
|
|
7695
8107
|
"aria-hidden": "true",
|
|
@@ -7700,7 +8112,7 @@ function TickBar({
|
|
|
7700
8112
|
))
|
|
7701
8113
|
}
|
|
7702
8114
|
),
|
|
7703
|
-
/* @__PURE__ */ (0,
|
|
8115
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
7704
8116
|
"div",
|
|
7705
8117
|
{
|
|
7706
8118
|
"aria-hidden": "true",
|
|
@@ -7718,7 +8130,7 @@ function TickBar({
|
|
|
7718
8130
|
]
|
|
7719
8131
|
}
|
|
7720
8132
|
),
|
|
7721
|
-
showValue ? /* @__PURE__ */ (0,
|
|
8133
|
+
showValue ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
7722
8134
|
"span",
|
|
7723
8135
|
{
|
|
7724
8136
|
className: cx("nu-tick-bar__value", slotClassNames?.value),
|
|
@@ -7729,7 +8141,7 @@ function TickBar({
|
|
|
7729
8141
|
]
|
|
7730
8142
|
}
|
|
7731
8143
|
),
|
|
7732
|
-
hint ? /* @__PURE__ */ (0,
|
|
8144
|
+
hint ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
7733
8145
|
"span",
|
|
7734
8146
|
{
|
|
7735
8147
|
className: cx("nu-tick-bar__hint", slotClassNames?.hint),
|
|
@@ -7744,7 +8156,7 @@ function TickBar({
|
|
|
7744
8156
|
}
|
|
7745
8157
|
|
|
7746
8158
|
// src/components/ToolBar/ToolBar.tsx
|
|
7747
|
-
var
|
|
8159
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
7748
8160
|
function ToolBar({
|
|
7749
8161
|
children,
|
|
7750
8162
|
className,
|
|
@@ -7754,7 +8166,7 @@ function ToolBar({
|
|
|
7754
8166
|
wrap = false,
|
|
7755
8167
|
...props
|
|
7756
8168
|
}) {
|
|
7757
|
-
return /* @__PURE__ */ (0,
|
|
8169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
7758
8170
|
"div",
|
|
7759
8171
|
{
|
|
7760
8172
|
...props,
|
|
@@ -7773,7 +8185,7 @@ function ToolButton({
|
|
|
7773
8185
|
slotStyles,
|
|
7774
8186
|
...props
|
|
7775
8187
|
}) {
|
|
7776
|
-
return /* @__PURE__ */ (0,
|
|
8188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
7777
8189
|
CommandButton,
|
|
7778
8190
|
{
|
|
7779
8191
|
...props,
|
|
@@ -7803,7 +8215,7 @@ function ToolDropButton({
|
|
|
7803
8215
|
uncheckedShape,
|
|
7804
8216
|
...props
|
|
7805
8217
|
}) {
|
|
7806
|
-
return /* @__PURE__ */ (0,
|
|
8218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
7807
8219
|
CommandButton,
|
|
7808
8220
|
{
|
|
7809
8221
|
...props,
|
|
@@ -7829,7 +8241,7 @@ function ToolDropButton({
|
|
|
7829
8241
|
);
|
|
7830
8242
|
}
|
|
7831
8243
|
function ToolSeparator({ className, ...props }) {
|
|
7832
|
-
return /* @__PURE__ */ (0,
|
|
8244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
7833
8245
|
"div",
|
|
7834
8246
|
{
|
|
7835
8247
|
...props,
|
|
@@ -7845,7 +8257,7 @@ function ToolSeparator({ className, ...props }) {
|
|
|
7845
8257
|
}
|
|
7846
8258
|
|
|
7847
8259
|
// src/components/TreeView/TreeView.tsx
|
|
7848
|
-
var
|
|
8260
|
+
var import_react43 = require("react");
|
|
7849
8261
|
|
|
7850
8262
|
// src/components/_shared/treeData.ts
|
|
7851
8263
|
function collectExpandedTreeDataIds(items) {
|
|
@@ -7941,8 +8353,8 @@ function collectVisibleTreeItems(items, expandedIds, depth = 0, guideMask = [],
|
|
|
7941
8353
|
}
|
|
7942
8354
|
|
|
7943
8355
|
// src/components/TreeView/internals/TreeViewItem.tsx
|
|
7944
|
-
var
|
|
7945
|
-
var
|
|
8356
|
+
var import_react42 = require("react");
|
|
8357
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
7946
8358
|
function areTreeViewGuideArraysEqual(previousArray, nextArray) {
|
|
7947
8359
|
if (previousArray.length !== nextArray.length) {
|
|
7948
8360
|
return false;
|
|
@@ -8016,8 +8428,8 @@ function TreeViewItemInner({
|
|
|
8016
8428
|
handleActivate();
|
|
8017
8429
|
onToggleItemCheck?.(item, !isChecked);
|
|
8018
8430
|
}
|
|
8019
|
-
return /* @__PURE__ */ (0,
|
|
8020
|
-
/* @__PURE__ */ (0,
|
|
8431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "nu-tree-view__row", role: "none", children: [
|
|
8432
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
8021
8433
|
"div",
|
|
8022
8434
|
{
|
|
8023
8435
|
"aria-checked": isCheckable ? isChecked : void 0,
|
|
@@ -8036,8 +8448,8 @@ function TreeViewItemInner({
|
|
|
8036
8448
|
ref: (node) => registerItemRef(itemId, node),
|
|
8037
8449
|
role: "treeitem",
|
|
8038
8450
|
children: [
|
|
8039
|
-
/* @__PURE__ */ (0,
|
|
8040
|
-
guideMask.map((hasGuide, guideIndex) => /* @__PURE__ */ (0,
|
|
8451
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { "aria-hidden": "true", className: "nu-tree-view__prefix", children: [
|
|
8452
|
+
guideMask.map((hasGuide, guideIndex) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
8041
8453
|
"span",
|
|
8042
8454
|
{
|
|
8043
8455
|
className: "nu-tree-view__guide",
|
|
@@ -8048,7 +8460,7 @@ function TreeViewItemInner({
|
|
|
8048
8460
|
},
|
|
8049
8461
|
`${itemId}-guide-${guideIndex}`
|
|
8050
8462
|
)),
|
|
8051
|
-
/* @__PURE__ */ (0,
|
|
8463
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
8052
8464
|
"span",
|
|
8053
8465
|
{
|
|
8054
8466
|
className: "nu-tree-view__lead",
|
|
@@ -8056,19 +8468,19 @@ function TreeViewItemInner({
|
|
|
8056
8468
|
"--nu-tree-view-origin-offset": originOffset
|
|
8057
8469
|
},
|
|
8058
8470
|
children: [
|
|
8059
|
-
depth > 0 ? /* @__PURE__ */ (0,
|
|
8471
|
+
depth > 0 ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
8060
8472
|
"span",
|
|
8061
8473
|
{
|
|
8062
8474
|
className: "nu-tree-view__branch",
|
|
8063
8475
|
"data-branch": hasNextSibling ? "tee" : "elbow"
|
|
8064
8476
|
}
|
|
8065
8477
|
) : null,
|
|
8066
|
-
hasChildren ? /* @__PURE__ */ (0,
|
|
8478
|
+
hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
8067
8479
|
"span",
|
|
8068
8480
|
{
|
|
8069
8481
|
className: "nu-tree-view__expander",
|
|
8070
8482
|
"data-connector": depth > 0 ? "lead" : void 0,
|
|
8071
|
-
children: /* @__PURE__ */ (0,
|
|
8483
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
8072
8484
|
"button",
|
|
8073
8485
|
{
|
|
8074
8486
|
"aria-label": isExpanded ? "Collapse item" : "Expand item",
|
|
@@ -8076,7 +8488,7 @@ function TreeViewItemInner({
|
|
|
8076
8488
|
onClick: handleToggleExpanded,
|
|
8077
8489
|
tabIndex: -1,
|
|
8078
8490
|
type: "button",
|
|
8079
|
-
children: /* @__PURE__ */ (0,
|
|
8491
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
8080
8492
|
NuGlyph,
|
|
8081
8493
|
{
|
|
8082
8494
|
name: isExpanded ? "tree-caret-down" : "tree-caret-right"
|
|
@@ -8085,7 +8497,7 @@ function TreeViewItemInner({
|
|
|
8085
8497
|
}
|
|
8086
8498
|
)
|
|
8087
8499
|
}
|
|
8088
|
-
) : depth > 0 ? /* @__PURE__ */ (0,
|
|
8500
|
+
) : depth > 0 ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
8089
8501
|
"span",
|
|
8090
8502
|
{
|
|
8091
8503
|
className: "nu-tree-view__expander-placeholder",
|
|
@@ -8096,8 +8508,8 @@ function TreeViewItemInner({
|
|
|
8096
8508
|
}
|
|
8097
8509
|
)
|
|
8098
8510
|
] }),
|
|
8099
|
-
/* @__PURE__ */ (0,
|
|
8100
|
-
isCheckable ? /* @__PURE__ */ (0,
|
|
8511
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "nu-tree-view__content", children: [
|
|
8512
|
+
isCheckable ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "nu-tree-view__check-slot", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
8101
8513
|
"button",
|
|
8102
8514
|
{
|
|
8103
8515
|
"aria-label": isChecked ? "Uncheck item" : "Check item",
|
|
@@ -8105,12 +8517,12 @@ function TreeViewItemInner({
|
|
|
8105
8517
|
onClick: handleToggleChecked,
|
|
8106
8518
|
tabIndex: -1,
|
|
8107
8519
|
type: "button",
|
|
8108
|
-
children: /* @__PURE__ */ (0,
|
|
8520
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
8109
8521
|
"span",
|
|
8110
8522
|
{
|
|
8111
8523
|
className: "nu-tree-view__check-box",
|
|
8112
8524
|
"data-unchecked-shape": uncheckedShape,
|
|
8113
|
-
children: isChecked ? /* @__PURE__ */ (0,
|
|
8525
|
+
children: isChecked ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
8114
8526
|
NuGlyph,
|
|
8115
8527
|
{
|
|
8116
8528
|
className: "nu-tree-view__check-mark",
|
|
@@ -8121,14 +8533,14 @@ function TreeViewItemInner({
|
|
|
8121
8533
|
)
|
|
8122
8534
|
}
|
|
8123
8535
|
) }) : null,
|
|
8124
|
-
item.icon ? /* @__PURE__ */ (0,
|
|
8125
|
-
/* @__PURE__ */ (0,
|
|
8126
|
-
item.hint ? /* @__PURE__ */ (0,
|
|
8536
|
+
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "nu-tree-view__icon", children: item.icon }) : null,
|
|
8537
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "nu-tree-view__title", children: item.title }),
|
|
8538
|
+
item.hint ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "nu-tree-view__hint", children: item.hint }) : null
|
|
8127
8539
|
] })
|
|
8128
8540
|
]
|
|
8129
8541
|
}
|
|
8130
8542
|
),
|
|
8131
|
-
hasChildren && isExpanded ? /* @__PURE__ */ (0,
|
|
8543
|
+
hasChildren && isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { role: "group", children: (item.children ?? []).map((child, index) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
8132
8544
|
TreeViewItem,
|
|
8133
8545
|
{
|
|
8134
8546
|
depth: depth + 1,
|
|
@@ -8161,10 +8573,10 @@ function areTreeViewItemPropsEqual(previousProps, nextProps) {
|
|
|
8161
8573
|
nextProps.guideOffsets
|
|
8162
8574
|
) && previousProps.hasNextSibling === nextProps.hasNextSibling && previousProps.item === nextProps.item && previousProps.onActivateItem === nextProps.onActivateItem && previousProps.onDoubleClickItem === nextProps.onDoubleClickItem && previousProps.onToggleItemCheck === nextProps.onToggleItemCheck && previousProps.onToggleItemExpanded === nextProps.onToggleItemExpanded && previousProps.originOffset === nextProps.originOffset && previousProps.registerItemRef === nextProps.registerItemRef && previousProps.treeId === nextProps.treeId && previousProps.uncheckedShape === nextProps.uncheckedShape;
|
|
8163
8575
|
}
|
|
8164
|
-
var TreeViewItem = (0,
|
|
8576
|
+
var TreeViewItem = (0, import_react42.memo)(TreeViewItemInner, areTreeViewItemPropsEqual);
|
|
8165
8577
|
|
|
8166
8578
|
// src/components/TreeView/TreeView.tsx
|
|
8167
|
-
var
|
|
8579
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
8168
8580
|
function TreeViewInner({
|
|
8169
8581
|
className,
|
|
8170
8582
|
data,
|
|
@@ -8179,36 +8591,36 @@ function TreeViewInner({
|
|
|
8179
8591
|
uncheckedShape = "box",
|
|
8180
8592
|
...props
|
|
8181
8593
|
}, ref) {
|
|
8182
|
-
const rootRef = (0,
|
|
8183
|
-
const treeId = (0,
|
|
8184
|
-
const itemRefs = (0,
|
|
8594
|
+
const rootRef = (0, import_react43.useRef)(null);
|
|
8595
|
+
const treeId = (0, import_react43.useId)();
|
|
8596
|
+
const itemRefs = (0, import_react43.useRef)({});
|
|
8185
8597
|
const isExpandedControlled = expandedIds !== void 0;
|
|
8186
|
-
const [uncontrolledExpandedIds, setUncontrolledExpandedIds] = (0,
|
|
8598
|
+
const [uncontrolledExpandedIds, setUncontrolledExpandedIds] = (0, import_react43.useState)(() => {
|
|
8187
8599
|
const expandedFromData = collectExpandedTreeIds(data);
|
|
8188
8600
|
if (!defaultExpandedIds?.length) {
|
|
8189
8601
|
return expandedFromData;
|
|
8190
8602
|
}
|
|
8191
8603
|
return Array.from(/* @__PURE__ */ new Set([...expandedFromData, ...defaultExpandedIds]));
|
|
8192
8604
|
});
|
|
8193
|
-
const [uncontrolledSelectedId, setUncontrolledSelectedId] = (0,
|
|
8605
|
+
const [uncontrolledSelectedId, setUncontrolledSelectedId] = (0, import_react43.useState)(null);
|
|
8194
8606
|
const resolvedExpandedIds = isExpandedControlled ? expandedIds : uncontrolledExpandedIds;
|
|
8195
|
-
const expandedIdSet = (0,
|
|
8607
|
+
const expandedIdSet = (0, import_react43.useMemo)(
|
|
8196
8608
|
() => new Set(resolvedExpandedIds),
|
|
8197
8609
|
[resolvedExpandedIds]
|
|
8198
8610
|
);
|
|
8199
|
-
const visibleItems = (0,
|
|
8611
|
+
const visibleItems = (0, import_react43.useMemo)(
|
|
8200
8612
|
() => collectVisibleTreeItems(data, expandedIdSet),
|
|
8201
8613
|
[data, expandedIdSet]
|
|
8202
8614
|
);
|
|
8203
|
-
const selectableItems = (0,
|
|
8615
|
+
const selectableItems = (0, import_react43.useMemo)(
|
|
8204
8616
|
() => visibleItems.filter(({ item }) => !item.disabled),
|
|
8205
8617
|
[visibleItems]
|
|
8206
8618
|
);
|
|
8207
8619
|
const derivedSelectedId = selectedId ?? uncontrolledSelectedId ?? findSelectedTreeItemId(data) ?? selectableItems[0]?.itemId ?? null;
|
|
8208
8620
|
const resolvedSelectedId = derivedSelectedId && selectableItems.some((entry) => entry.itemId === derivedSelectedId) ? derivedSelectedId : selectableItems[0]?.itemId ?? null;
|
|
8209
|
-
const [activeId, setActiveId] = (0,
|
|
8621
|
+
const [activeId, setActiveId] = (0, import_react43.useState)(resolvedSelectedId);
|
|
8210
8622
|
const resolvedActiveId = activeId && selectableItems.some((entry) => entry.itemId === activeId) ? activeId : resolvedSelectedId;
|
|
8211
|
-
(0,
|
|
8623
|
+
(0, import_react43.useEffect)(() => {
|
|
8212
8624
|
if (!resolvedActiveId) {
|
|
8213
8625
|
return;
|
|
8214
8626
|
}
|
|
@@ -8216,13 +8628,13 @@ function TreeViewInner({
|
|
|
8216
8628
|
block: "nearest"
|
|
8217
8629
|
});
|
|
8218
8630
|
}, [resolvedActiveId]);
|
|
8219
|
-
const registerItemRef = (0,
|
|
8631
|
+
const registerItemRef = (0, import_react43.useCallback)(
|
|
8220
8632
|
(itemId, node) => {
|
|
8221
8633
|
itemRefs.current[itemId] = node;
|
|
8222
8634
|
},
|
|
8223
8635
|
[]
|
|
8224
8636
|
);
|
|
8225
|
-
const setExpandedState = (0,
|
|
8637
|
+
const setExpandedState = (0, import_react43.useCallback)(
|
|
8226
8638
|
(item, nextExpanded) => {
|
|
8227
8639
|
const nextExpandedIds = nextExpanded ? Array.from(/* @__PURE__ */ new Set([...resolvedExpandedIds, item.id])) : resolvedExpandedIds.filter((expandedId) => expandedId !== item.id);
|
|
8228
8640
|
if (!isExpandedControlled) {
|
|
@@ -8232,7 +8644,7 @@ function TreeViewInner({
|
|
|
8232
8644
|
},
|
|
8233
8645
|
[isExpandedControlled, onExpandedIdsChange, resolvedExpandedIds]
|
|
8234
8646
|
);
|
|
8235
|
-
const activateEntry = (0,
|
|
8647
|
+
const activateEntry = (0, import_react43.useCallback)(
|
|
8236
8648
|
(item, itemId) => {
|
|
8237
8649
|
if (item.disabled) {
|
|
8238
8650
|
return;
|
|
@@ -8245,7 +8657,7 @@ function TreeViewInner({
|
|
|
8245
8657
|
},
|
|
8246
8658
|
[onItemSelect, selectedId]
|
|
8247
8659
|
);
|
|
8248
|
-
const activateResolvedItem = (0,
|
|
8660
|
+
const activateResolvedItem = (0, import_react43.useCallback)(
|
|
8249
8661
|
(itemId) => {
|
|
8250
8662
|
if (!itemId) {
|
|
8251
8663
|
return;
|
|
@@ -8371,7 +8783,7 @@ function TreeViewInner({
|
|
|
8371
8783
|
break;
|
|
8372
8784
|
}
|
|
8373
8785
|
}
|
|
8374
|
-
(0,
|
|
8786
|
+
(0, import_react43.useImperativeHandle)(
|
|
8375
8787
|
ref,
|
|
8376
8788
|
() => ({
|
|
8377
8789
|
activateItem(itemId) {
|
|
@@ -8415,7 +8827,7 @@ function TreeViewInner({
|
|
|
8415
8827
|
setExpandedState
|
|
8416
8828
|
]
|
|
8417
8829
|
);
|
|
8418
|
-
return /* @__PURE__ */ (0,
|
|
8830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
8419
8831
|
"div",
|
|
8420
8832
|
{
|
|
8421
8833
|
...props,
|
|
@@ -8425,7 +8837,7 @@ function TreeViewInner({
|
|
|
8425
8837
|
ref: rootRef,
|
|
8426
8838
|
role: "tree",
|
|
8427
8839
|
tabIndex: 0,
|
|
8428
|
-
children: visibleItems.length > 0 ? data.map((item, index) => /* @__PURE__ */ (0,
|
|
8840
|
+
children: visibleItems.length > 0 ? data.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
8429
8841
|
TreeViewItem,
|
|
8430
8842
|
{
|
|
8431
8843
|
depth: 0,
|
|
@@ -8445,14 +8857,14 @@ function TreeViewInner({
|
|
|
8445
8857
|
uncheckedShape
|
|
8446
8858
|
},
|
|
8447
8859
|
item.id
|
|
8448
|
-
)) : /* @__PURE__ */ (0,
|
|
8860
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "nu-tree-view__empty", children: emptyText })
|
|
8449
8861
|
}
|
|
8450
8862
|
);
|
|
8451
8863
|
}
|
|
8452
|
-
var TreeView = (0,
|
|
8864
|
+
var TreeView = (0, import_react43.forwardRef)(TreeViewInner);
|
|
8453
8865
|
|
|
8454
8866
|
// src/components/TreeListView/TreeListView.tsx
|
|
8455
|
-
var
|
|
8867
|
+
var import_react45 = require("react");
|
|
8456
8868
|
|
|
8457
8869
|
// src/components/TreeListView/internals/helpers.ts
|
|
8458
8870
|
function normalizeTreeListAlign(align, fallback) {
|
|
@@ -8541,12 +8953,12 @@ function renderTreeListCellValue(item, column) {
|
|
|
8541
8953
|
}
|
|
8542
8954
|
|
|
8543
8955
|
// src/components/TreeListView/internals/TreeListViewRow.tsx
|
|
8544
|
-
var
|
|
8545
|
-
var
|
|
8956
|
+
var import_react44 = require("react");
|
|
8957
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
8546
8958
|
function renderTreeTitleContent(item) {
|
|
8547
|
-
return /* @__PURE__ */ (0,
|
|
8548
|
-
/* @__PURE__ */ (0,
|
|
8549
|
-
item.hint ? /* @__PURE__ */ (0,
|
|
8959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
|
|
8960
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "nu-tree-list-view__title", children: item.title }),
|
|
8961
|
+
item.hint ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "nu-tree-list-view__hint", children: item.hint }) : null
|
|
8550
8962
|
] });
|
|
8551
8963
|
}
|
|
8552
8964
|
function renderReportCellContent(item, column, depth, rowIndex, getCellContent) {
|
|
@@ -8646,8 +9058,8 @@ function TreeListViewRowInner({
|
|
|
8646
9058
|
handleActivate();
|
|
8647
9059
|
onToggleItemCheck?.(item, !isChecked);
|
|
8648
9060
|
}
|
|
8649
|
-
return /* @__PURE__ */ (0,
|
|
8650
|
-
/* @__PURE__ */ (0,
|
|
9061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
|
|
9062
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8651
9063
|
"div",
|
|
8652
9064
|
{
|
|
8653
9065
|
"aria-disabled": item.disabled || void 0,
|
|
@@ -8670,7 +9082,7 @@ function TreeListViewRowInner({
|
|
|
8670
9082
|
"--nu-tree-list-view-columns": templateColumns
|
|
8671
9083
|
},
|
|
8672
9084
|
children: columns.map(
|
|
8673
|
-
(column, columnIndex) => column.id === treeColumnId ? /* @__PURE__ */ (0,
|
|
9085
|
+
(column, columnIndex) => column.id === treeColumnId ? /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
8674
9086
|
"span",
|
|
8675
9087
|
{
|
|
8676
9088
|
className: [
|
|
@@ -8682,8 +9094,8 @@ function TreeListViewRowInner({
|
|
|
8682
9094
|
"data-column-id": column.id,
|
|
8683
9095
|
role: "gridcell",
|
|
8684
9096
|
children: [
|
|
8685
|
-
/* @__PURE__ */ (0,
|
|
8686
|
-
guideMask.map((hasGuide, guideIndex) => /* @__PURE__ */ (0,
|
|
9097
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { "aria-hidden": "true", className: "nu-tree-list-view__prefix", children: [
|
|
9098
|
+
guideMask.map((hasGuide, guideIndex) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8687
9099
|
"span",
|
|
8688
9100
|
{
|
|
8689
9101
|
className: "nu-tree-list-view__guide",
|
|
@@ -8694,7 +9106,7 @@ function TreeListViewRowInner({
|
|
|
8694
9106
|
},
|
|
8695
9107
|
`${itemId}-guide-${guideIndex}`
|
|
8696
9108
|
)),
|
|
8697
|
-
/* @__PURE__ */ (0,
|
|
9109
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
8698
9110
|
"span",
|
|
8699
9111
|
{
|
|
8700
9112
|
className: "nu-tree-list-view__lead",
|
|
@@ -8702,19 +9114,19 @@ function TreeListViewRowInner({
|
|
|
8702
9114
|
"--nu-tree-list-view-origin-offset": originOffset
|
|
8703
9115
|
},
|
|
8704
9116
|
children: [
|
|
8705
|
-
depth > 0 ? /* @__PURE__ */ (0,
|
|
9117
|
+
depth > 0 ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8706
9118
|
"span",
|
|
8707
9119
|
{
|
|
8708
9120
|
className: "nu-tree-list-view__branch",
|
|
8709
9121
|
"data-branch": hasNextSibling ? "tee" : "elbow"
|
|
8710
9122
|
}
|
|
8711
9123
|
) : null,
|
|
8712
|
-
hasChildren ? /* @__PURE__ */ (0,
|
|
9124
|
+
hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8713
9125
|
"span",
|
|
8714
9126
|
{
|
|
8715
9127
|
className: "nu-tree-list-view__expander",
|
|
8716
9128
|
"data-connector": depth > 0 ? "lead" : void 0,
|
|
8717
|
-
children: /* @__PURE__ */ (0,
|
|
9129
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8718
9130
|
"button",
|
|
8719
9131
|
{
|
|
8720
9132
|
"aria-label": isExpanded ? "Collapse item" : "Expand item",
|
|
@@ -8722,7 +9134,7 @@ function TreeListViewRowInner({
|
|
|
8722
9134
|
onClick: handleToggleExpanded,
|
|
8723
9135
|
tabIndex: -1,
|
|
8724
9136
|
type: "button",
|
|
8725
|
-
children: /* @__PURE__ */ (0,
|
|
9137
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8726
9138
|
NuGlyph,
|
|
8727
9139
|
{
|
|
8728
9140
|
name: isExpanded ? "tree-caret-down" : "tree-caret-right"
|
|
@@ -8731,7 +9143,7 @@ function TreeListViewRowInner({
|
|
|
8731
9143
|
}
|
|
8732
9144
|
)
|
|
8733
9145
|
}
|
|
8734
|
-
) : depth > 0 ? /* @__PURE__ */ (0,
|
|
9146
|
+
) : depth > 0 ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8735
9147
|
"span",
|
|
8736
9148
|
{
|
|
8737
9149
|
className: "nu-tree-list-view__expander-placeholder",
|
|
@@ -8742,8 +9154,8 @@ function TreeListViewRowInner({
|
|
|
8742
9154
|
}
|
|
8743
9155
|
)
|
|
8744
9156
|
] }),
|
|
8745
|
-
/* @__PURE__ */ (0,
|
|
8746
|
-
isCheckable ? /* @__PURE__ */ (0,
|
|
9157
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { className: "nu-tree-list-view__tree-content", children: [
|
|
9158
|
+
isCheckable ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "nu-tree-list-view__check-slot", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8747
9159
|
"button",
|
|
8748
9160
|
{
|
|
8749
9161
|
"aria-label": isChecked ? "Uncheck item" : "Check item",
|
|
@@ -8751,12 +9163,12 @@ function TreeListViewRowInner({
|
|
|
8751
9163
|
onClick: handleToggleChecked,
|
|
8752
9164
|
tabIndex: -1,
|
|
8753
9165
|
type: "button",
|
|
8754
|
-
children: /* @__PURE__ */ (0,
|
|
9166
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8755
9167
|
"span",
|
|
8756
9168
|
{
|
|
8757
9169
|
className: "nu-tree-list-view__check-box",
|
|
8758
9170
|
"data-unchecked-shape": uncheckedShape,
|
|
8759
|
-
children: isChecked ? /* @__PURE__ */ (0,
|
|
9171
|
+
children: isChecked ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8760
9172
|
NuGlyph,
|
|
8761
9173
|
{
|
|
8762
9174
|
className: "nu-tree-list-view__check-mark",
|
|
@@ -8767,13 +9179,13 @@ function TreeListViewRowInner({
|
|
|
8767
9179
|
)
|
|
8768
9180
|
}
|
|
8769
9181
|
) }) : null,
|
|
8770
|
-
item.icon ? /* @__PURE__ */ (0,
|
|
9182
|
+
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "nu-tree-list-view__icon", children: item.icon }) : null,
|
|
8771
9183
|
renderTreeTitleContent(item)
|
|
8772
9184
|
] })
|
|
8773
9185
|
]
|
|
8774
9186
|
},
|
|
8775
9187
|
column.id
|
|
8776
|
-
) : /* @__PURE__ */ (0,
|
|
9188
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8777
9189
|
"span",
|
|
8778
9190
|
{
|
|
8779
9191
|
className: [
|
|
@@ -8796,7 +9208,7 @@ function TreeListViewRowInner({
|
|
|
8796
9208
|
)
|
|
8797
9209
|
}
|
|
8798
9210
|
),
|
|
8799
|
-
hasChildren && isExpanded ? /* @__PURE__ */ (0,
|
|
9211
|
+
hasChildren && isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { role: "rowgroup", children: (item.children ?? []).map((child, index) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8800
9212
|
TreeListViewRow,
|
|
8801
9213
|
{
|
|
8802
9214
|
activeItemId,
|
|
@@ -8834,13 +9246,13 @@ function areTreeListViewRowPropsEqual(previousProps, nextProps) {
|
|
|
8834
9246
|
nextProps.guideOffsets
|
|
8835
9247
|
) && previousProps.hasNextSibling === nextProps.hasNextSibling && previousProps.item === nextProps.item && previousProps.onActivateItem === nextProps.onActivateItem && previousProps.onDoubleClickItem === nextProps.onDoubleClickItem && previousProps.onToggleItemCheck === nextProps.onToggleItemCheck && previousProps.onToggleItemExpanded === nextProps.onToggleItemExpanded && previousProps.originOffset === nextProps.originOffset && previousProps.registerItemRef === nextProps.registerItemRef && previousProps.rowIndexMap === nextProps.rowIndexMap && previousProps.templateColumns === nextProps.templateColumns && previousProps.treeColumnId === nextProps.treeColumnId && previousProps.treeId === nextProps.treeId && previousProps.uncheckedShape === nextProps.uncheckedShape;
|
|
8836
9248
|
}
|
|
8837
|
-
var TreeListViewRow = (0,
|
|
9249
|
+
var TreeListViewRow = (0, import_react44.memo)(
|
|
8838
9250
|
TreeListViewRowInner,
|
|
8839
9251
|
areTreeListViewRowPropsEqual
|
|
8840
9252
|
);
|
|
8841
9253
|
|
|
8842
9254
|
// src/components/TreeListView/TreeListView.tsx
|
|
8843
|
-
var
|
|
9255
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
8844
9256
|
function TreeListViewInner({
|
|
8845
9257
|
activeItemId: activeItemIdProp,
|
|
8846
9258
|
checkedIds,
|
|
@@ -8862,42 +9274,42 @@ function TreeListViewInner({
|
|
|
8862
9274
|
uncheckedShape = "box",
|
|
8863
9275
|
...props
|
|
8864
9276
|
}, ref) {
|
|
8865
|
-
const rootRef = (0,
|
|
8866
|
-
const treeId = (0,
|
|
8867
|
-
const itemRefs = (0,
|
|
8868
|
-
const resizeFrameRef = (0,
|
|
8869
|
-
const resizeStateRef = (0,
|
|
9277
|
+
const rootRef = (0, import_react45.useRef)(null);
|
|
9278
|
+
const treeId = (0, import_react45.useId)();
|
|
9279
|
+
const itemRefs = (0, import_react45.useRef)({});
|
|
9280
|
+
const resizeFrameRef = (0, import_react45.useRef)(null);
|
|
9281
|
+
const resizeStateRef = (0, import_react45.useRef)(null);
|
|
8870
9282
|
const isExpandedControlled = expandedIds !== void 0;
|
|
8871
|
-
const [uncontrolledExpandedIds, setUncontrolledExpandedIds] = (0,
|
|
9283
|
+
const [uncontrolledExpandedIds, setUncontrolledExpandedIds] = (0, import_react45.useState)(() => {
|
|
8872
9284
|
const expandedFromData = collectExpandedTreeListIds(data);
|
|
8873
9285
|
if (!defaultExpandedIds?.length) {
|
|
8874
9286
|
return expandedFromData;
|
|
8875
9287
|
}
|
|
8876
9288
|
return Array.from(/* @__PURE__ */ new Set([...expandedFromData, ...defaultExpandedIds]));
|
|
8877
9289
|
});
|
|
8878
|
-
const [uncontrolledSelectedId, setUncontrolledSelectedId] = (0,
|
|
8879
|
-
const [autoColumnWidths, setAutoColumnWidths] = (0,
|
|
8880
|
-
const [userColumnWidths, setUserColumnWidths] = (0,
|
|
9290
|
+
const [uncontrolledSelectedId, setUncontrolledSelectedId] = (0, import_react45.useState)(null);
|
|
9291
|
+
const [autoColumnWidths, setAutoColumnWidths] = (0, import_react45.useState)({});
|
|
9292
|
+
const [userColumnWidths, setUserColumnWidths] = (0, import_react45.useState)({});
|
|
8881
9293
|
const isActiveControlled = activeItemIdProp !== void 0;
|
|
8882
9294
|
const resolvedExpandedIds = isExpandedControlled ? expandedIds : uncontrolledExpandedIds;
|
|
8883
|
-
const expandedIdSet = (0,
|
|
9295
|
+
const expandedIdSet = (0, import_react45.useMemo)(
|
|
8884
9296
|
() => new Set(resolvedExpandedIds),
|
|
8885
9297
|
[resolvedExpandedIds]
|
|
8886
9298
|
);
|
|
8887
|
-
const visibleItems = (0,
|
|
9299
|
+
const visibleItems = (0, import_react45.useMemo)(
|
|
8888
9300
|
() => collectVisibleTreeListItems(data, expandedIdSet),
|
|
8889
9301
|
[data, expandedIdSet]
|
|
8890
9302
|
);
|
|
8891
|
-
const selectableItems = (0,
|
|
9303
|
+
const selectableItems = (0, import_react45.useMemo)(
|
|
8892
9304
|
() => visibleItems.filter(({ item }) => !item.disabled),
|
|
8893
9305
|
[visibleItems]
|
|
8894
9306
|
);
|
|
8895
9307
|
const derivedSelectedId = selectedId ?? uncontrolledSelectedId ?? findSelectedTreeListItemId(data) ?? selectableItems[0]?.itemId ?? null;
|
|
8896
9308
|
const resolvedSelectedId = derivedSelectedId && selectableItems.some((entry) => entry.itemId === derivedSelectedId) ? derivedSelectedId : selectableItems[0]?.itemId ?? null;
|
|
8897
|
-
const [uncontrolledActiveItemId, setUncontrolledActiveItemId] = (0,
|
|
9309
|
+
const [uncontrolledActiveItemId, setUncontrolledActiveItemId] = (0, import_react45.useState)(() => defaultActiveItemId ?? resolvedSelectedId);
|
|
8898
9310
|
const activeItemId = activeItemIdProp !== void 0 ? activeItemIdProp : uncontrolledActiveItemId;
|
|
8899
9311
|
const resolvedActiveItemId = activeItemId && selectableItems.some((entry) => entry.itemId === activeItemId) ? activeItemId : resolvedSelectedId;
|
|
8900
|
-
const minColumnWidthById = (0,
|
|
9312
|
+
const minColumnWidthById = (0, import_react45.useMemo)(
|
|
8901
9313
|
() => Object.fromEntries(
|
|
8902
9314
|
columns.map(
|
|
8903
9315
|
(column) => [column.id, column.minWidth ?? 0]
|
|
@@ -8905,24 +9317,24 @@ function TreeListViewInner({
|
|
|
8905
9317
|
),
|
|
8906
9318
|
[columns]
|
|
8907
9319
|
);
|
|
8908
|
-
const templateColumns = (0,
|
|
9320
|
+
const templateColumns = (0, import_react45.useMemo)(
|
|
8909
9321
|
() => getTreeListTemplateColumns(columns, {
|
|
8910
9322
|
autoColumnWidths,
|
|
8911
9323
|
userColumnWidths
|
|
8912
9324
|
}),
|
|
8913
9325
|
[autoColumnWidths, columns, userColumnWidths]
|
|
8914
9326
|
);
|
|
8915
|
-
const treeColumnId = (0,
|
|
9327
|
+
const treeColumnId = (0, import_react45.useMemo)(
|
|
8916
9328
|
() => getTreeListTreeColumnId(columns),
|
|
8917
9329
|
[columns]
|
|
8918
9330
|
);
|
|
8919
|
-
const rowIndexMap = (0,
|
|
9331
|
+
const rowIndexMap = (0, import_react45.useMemo)(
|
|
8920
9332
|
() => new Map(
|
|
8921
9333
|
visibleItems.map((entry, index) => [entry.itemId, index])
|
|
8922
9334
|
),
|
|
8923
9335
|
[visibleItems]
|
|
8924
9336
|
);
|
|
8925
|
-
(0,
|
|
9337
|
+
(0, import_react45.useEffect)(() => {
|
|
8926
9338
|
if (!resolvedActiveItemId) {
|
|
8927
9339
|
return;
|
|
8928
9340
|
}
|
|
@@ -8930,21 +9342,21 @@ function TreeListViewInner({
|
|
|
8930
9342
|
block: "nearest"
|
|
8931
9343
|
});
|
|
8932
9344
|
}, [resolvedActiveItemId]);
|
|
8933
|
-
const registerItemRef = (0,
|
|
9345
|
+
const registerItemRef = (0, import_react45.useCallback)(
|
|
8934
9346
|
(itemId, node) => {
|
|
8935
9347
|
itemRefs.current[itemId] = node;
|
|
8936
9348
|
},
|
|
8937
9349
|
[]
|
|
8938
9350
|
);
|
|
8939
|
-
const resolveCellContent = (0,
|
|
9351
|
+
const resolveCellContent = (0, import_react45.useCallback)(
|
|
8940
9352
|
(...args) => getCellContent?.(...args),
|
|
8941
9353
|
[getCellContent]
|
|
8942
9354
|
);
|
|
8943
|
-
const handleItemDoubleClick = (0,
|
|
9355
|
+
const handleItemDoubleClick = (0, import_react45.useCallback)(
|
|
8944
9356
|
(item) => onItemDoubleClick?.(item),
|
|
8945
9357
|
[onItemDoubleClick]
|
|
8946
9358
|
);
|
|
8947
|
-
(0,
|
|
9359
|
+
(0, import_react45.useLayoutEffect)(() => {
|
|
8948
9360
|
const rootNode = rootRef.current;
|
|
8949
9361
|
if (!rootNode) {
|
|
8950
9362
|
return;
|
|
@@ -8976,14 +9388,14 @@ function TreeListViewInner({
|
|
|
8976
9388
|
return didChange ? nextWidths : currentWidths;
|
|
8977
9389
|
});
|
|
8978
9390
|
}, [columns, userColumnWidths, visibleItems]);
|
|
8979
|
-
(0,
|
|
9391
|
+
(0, import_react45.useEffect)(() => {
|
|
8980
9392
|
return () => {
|
|
8981
9393
|
if (resizeFrameRef.current !== null) {
|
|
8982
9394
|
window.cancelAnimationFrame(resizeFrameRef.current);
|
|
8983
9395
|
}
|
|
8984
9396
|
};
|
|
8985
9397
|
}, []);
|
|
8986
|
-
const setExpandedState = (0,
|
|
9398
|
+
const setExpandedState = (0, import_react45.useCallback)(
|
|
8987
9399
|
(item, nextExpanded) => {
|
|
8988
9400
|
const nextExpandedIds = nextExpanded ? Array.from(/* @__PURE__ */ new Set([...resolvedExpandedIds, item.id])) : resolvedExpandedIds.filter((expandedId) => expandedId !== item.id);
|
|
8989
9401
|
if (!isExpandedControlled) {
|
|
@@ -8993,7 +9405,7 @@ function TreeListViewInner({
|
|
|
8993
9405
|
},
|
|
8994
9406
|
[isExpandedControlled, onExpandedIdsChange, resolvedExpandedIds]
|
|
8995
9407
|
);
|
|
8996
|
-
const updateActiveItem = (0,
|
|
9408
|
+
const updateActiveItem = (0, import_react45.useCallback)(
|
|
8997
9409
|
(item) => {
|
|
8998
9410
|
if (!isActiveControlled) {
|
|
8999
9411
|
setUncontrolledActiveItemId(item.id);
|
|
@@ -9002,7 +9414,7 @@ function TreeListViewInner({
|
|
|
9002
9414
|
},
|
|
9003
9415
|
[isActiveControlled, onActiveItemChange]
|
|
9004
9416
|
);
|
|
9005
|
-
const activateEntry = (0,
|
|
9417
|
+
const activateEntry = (0, import_react45.useCallback)(
|
|
9006
9418
|
(item, itemId) => {
|
|
9007
9419
|
if (item.disabled) {
|
|
9008
9420
|
return;
|
|
@@ -9015,7 +9427,7 @@ function TreeListViewInner({
|
|
|
9015
9427
|
},
|
|
9016
9428
|
[onItemSelect, selectedId, updateActiveItem]
|
|
9017
9429
|
);
|
|
9018
|
-
const activateResolvedItem = (0,
|
|
9430
|
+
const activateResolvedItem = (0, import_react45.useCallback)(
|
|
9019
9431
|
(itemId) => {
|
|
9020
9432
|
if (!itemId) {
|
|
9021
9433
|
return;
|
|
@@ -9029,7 +9441,7 @@ function TreeListViewInner({
|
|
|
9029
9441
|
},
|
|
9030
9442
|
[activateEntry, selectableItems]
|
|
9031
9443
|
);
|
|
9032
|
-
const handleItemCheckChange = (0,
|
|
9444
|
+
const handleItemCheckChange = (0, import_react45.useCallback)(
|
|
9033
9445
|
(item, checked) => {
|
|
9034
9446
|
onItemCheckChange?.(item, checked);
|
|
9035
9447
|
},
|
|
@@ -9099,7 +9511,7 @@ function TreeListViewInner({
|
|
|
9099
9511
|
function isItemChecked(item) {
|
|
9100
9512
|
return checkedIds ? checkedIds.includes(item.id) : item.checked === true;
|
|
9101
9513
|
}
|
|
9102
|
-
const toggleItemCheck = (0,
|
|
9514
|
+
const toggleItemCheck = (0, import_react45.useCallback)(
|
|
9103
9515
|
(itemId) => {
|
|
9104
9516
|
const item = findTreeListItemById(data, itemId);
|
|
9105
9517
|
if (!item || item.disabled || item.checked === void 0 && checkedIds === void 0) {
|
|
@@ -9110,7 +9522,7 @@ function TreeListViewInner({
|
|
|
9110
9522
|
},
|
|
9111
9523
|
[checkedIds, data, onItemCheckChange]
|
|
9112
9524
|
);
|
|
9113
|
-
(0,
|
|
9525
|
+
(0, import_react45.useImperativeHandle)(
|
|
9114
9526
|
ref,
|
|
9115
9527
|
() => ({
|
|
9116
9528
|
activateItem(itemId) {
|
|
@@ -9257,7 +9669,7 @@ function TreeListViewInner({
|
|
|
9257
9669
|
window.addEventListener("pointermove", handleColumnResizeMove);
|
|
9258
9670
|
window.addEventListener("pointerup", handleColumnResizeEnd);
|
|
9259
9671
|
}
|
|
9260
|
-
return /* @__PURE__ */ (0,
|
|
9672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
9261
9673
|
"div",
|
|
9262
9674
|
{
|
|
9263
9675
|
...props,
|
|
@@ -9269,7 +9681,7 @@ function TreeListViewInner({
|
|
|
9269
9681
|
role: "treegrid",
|
|
9270
9682
|
tabIndex: 0,
|
|
9271
9683
|
children: [
|
|
9272
|
-
/* @__PURE__ */ (0,
|
|
9684
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
9273
9685
|
"div",
|
|
9274
9686
|
{
|
|
9275
9687
|
className: "nu-tree-list-view__header",
|
|
@@ -9277,7 +9689,7 @@ function TreeListViewInner({
|
|
|
9277
9689
|
style: {
|
|
9278
9690
|
"--nu-tree-list-view-columns": templateColumns
|
|
9279
9691
|
},
|
|
9280
|
-
children: columns.map((column, columnIndex) => /* @__PURE__ */ (0,
|
|
9692
|
+
children: columns.map((column, columnIndex) => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
9281
9693
|
"span",
|
|
9282
9694
|
{
|
|
9283
9695
|
className: [
|
|
@@ -9288,8 +9700,8 @@ function TreeListViewInner({
|
|
|
9288
9700
|
"data-column-id": column.id,
|
|
9289
9701
|
role: "columnheader",
|
|
9290
9702
|
children: [
|
|
9291
|
-
/* @__PURE__ */ (0,
|
|
9292
|
-
column.resizable !== false ? /* @__PURE__ */ (0,
|
|
9703
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "nu-tree-list-view__header-label", children: renderMnemonicText(column.title) }),
|
|
9704
|
+
column.resizable !== false ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
9293
9705
|
"button",
|
|
9294
9706
|
{
|
|
9295
9707
|
"aria-label": `Resize ${column.title} column`,
|
|
@@ -9305,7 +9717,7 @@ function TreeListViewInner({
|
|
|
9305
9717
|
))
|
|
9306
9718
|
}
|
|
9307
9719
|
),
|
|
9308
|
-
/* @__PURE__ */ (0,
|
|
9720
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "nu-tree-list-view__body", children: visibleItems.length > 0 ? data.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
9309
9721
|
TreeListViewRow,
|
|
9310
9722
|
{
|
|
9311
9723
|
activeItemId: resolvedActiveItemId,
|
|
@@ -9332,15 +9744,15 @@ function TreeListViewInner({
|
|
|
9332
9744
|
uncheckedShape
|
|
9333
9745
|
},
|
|
9334
9746
|
item.id
|
|
9335
|
-
)) : /* @__PURE__ */ (0,
|
|
9747
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "nu-tree-list-view__empty", children: emptyText }) })
|
|
9336
9748
|
]
|
|
9337
9749
|
}
|
|
9338
9750
|
);
|
|
9339
9751
|
}
|
|
9340
|
-
var TreeListView = (0,
|
|
9752
|
+
var TreeListView = (0, import_react45.forwardRef)(TreeListViewInner);
|
|
9341
9753
|
|
|
9342
9754
|
// src/theme/NuThemeProvider.tsx
|
|
9343
|
-
var
|
|
9755
|
+
var import_react47 = require("react");
|
|
9344
9756
|
|
|
9345
9757
|
// src/theme/themes.ts
|
|
9346
9758
|
var classicTheme = {
|
|
@@ -9487,11 +9899,48 @@ var midnightTheme = {
|
|
|
9487
9899
|
windowModalBackdrop: "rgb(7 12 20 / 0.48)"
|
|
9488
9900
|
}
|
|
9489
9901
|
};
|
|
9902
|
+
var grayscaleTheme = {
|
|
9903
|
+
name: "grayscale",
|
|
9904
|
+
label: "Grayscale Monitor",
|
|
9905
|
+
tokens: {
|
|
9906
|
+
desktopBackground: "#808080",
|
|
9907
|
+
desktopPattern: "rgb(0 0 0 / 0.3)",
|
|
9908
|
+
shellBackground: "#202020",
|
|
9909
|
+
appBackground: "#3f3f3f",
|
|
9910
|
+
appBackgroundAlt: "#2b2b2b",
|
|
9911
|
+
chromeBackground: "#727272",
|
|
9912
|
+
panelBackground: "#3f3f3f",
|
|
9913
|
+
panelInsetBackground: "#343434",
|
|
9914
|
+
titleBackground: "#262626",
|
|
9915
|
+
titleText: "#d0d0d0",
|
|
9916
|
+
textPrimary: "#c8c8c8",
|
|
9917
|
+
textMuted: "#969696",
|
|
9918
|
+
textInverse: "#d0d0d0",
|
|
9919
|
+
textAccent: "#e0e0e0",
|
|
9920
|
+
textHotkey: "#ffffff",
|
|
9921
|
+
buttonFace: "#5b5b5b",
|
|
9922
|
+
buttonFaceAlt: "#414141",
|
|
9923
|
+
buttonDanger: "#303030",
|
|
9924
|
+
buttonSuccess: "#6b6b6b",
|
|
9925
|
+
buttonText: "#d0d0d0",
|
|
9926
|
+
fieldBackground: "#0e0e0e",
|
|
9927
|
+
fieldText: "#d8d8d8",
|
|
9928
|
+
borderLight: "#c7c7c7",
|
|
9929
|
+
borderDark: "#000000",
|
|
9930
|
+
borderAccent: "#ffffff",
|
|
9931
|
+
shadowColor: "#000000",
|
|
9932
|
+
panelShadowColor: "rgb(0 0 0 / 0.5)",
|
|
9933
|
+
focusColor: "#ffffff",
|
|
9934
|
+
windowInactiveOverlay: "rgb(0 0 0 / 0.34)",
|
|
9935
|
+
windowModalBackdrop: "rgb(0 0 0 / 0.5)"
|
|
9936
|
+
}
|
|
9937
|
+
};
|
|
9490
9938
|
var nuThemes = {
|
|
9491
9939
|
classic: classicTheme,
|
|
9492
9940
|
amber: amberTheme,
|
|
9493
9941
|
phosphor: phosphorTheme,
|
|
9494
|
-
midnight: midnightTheme
|
|
9942
|
+
midnight: midnightTheme,
|
|
9943
|
+
grayscale: grayscaleTheme
|
|
9495
9944
|
};
|
|
9496
9945
|
function isNuThemeName(value) {
|
|
9497
9946
|
return value in nuThemes;
|
|
@@ -9570,10 +10019,10 @@ function getNuDesktopPatternStyle(mode) {
|
|
|
9570
10019
|
}
|
|
9571
10020
|
|
|
9572
10021
|
// src/theme/themeContext.ts
|
|
9573
|
-
var
|
|
9574
|
-
var NuThemeContext = (0,
|
|
10022
|
+
var import_react46 = require("react");
|
|
10023
|
+
var NuThemeContext = (0, import_react46.createContext)(null);
|
|
9575
10024
|
function useNuTheme() {
|
|
9576
|
-
const context = (0,
|
|
10025
|
+
const context = (0, import_react46.useContext)(NuThemeContext);
|
|
9577
10026
|
if (!context) {
|
|
9578
10027
|
throw new Error("useNuTheme must be used within a NuThemeProvider.");
|
|
9579
10028
|
}
|
|
@@ -9581,7 +10030,7 @@ function useNuTheme() {
|
|
|
9581
10030
|
}
|
|
9582
10031
|
|
|
9583
10032
|
// src/theme/NuThemeProvider.tsx
|
|
9584
|
-
var
|
|
10033
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
9585
10034
|
function NuThemeProvider({
|
|
9586
10035
|
children,
|
|
9587
10036
|
className,
|
|
@@ -9599,18 +10048,18 @@ function NuThemeProvider({
|
|
|
9599
10048
|
onThemeChange,
|
|
9600
10049
|
theme
|
|
9601
10050
|
}) {
|
|
9602
|
-
const generatedId = (0,
|
|
9603
|
-
const [internalTheme, setInternalTheme] = (0,
|
|
9604
|
-
const [internalDesktopPatternMode, setInternalDesktopPatternMode] = (0,
|
|
9605
|
-
const [internalFontFamily, setInternalFontFamily] = (0,
|
|
9606
|
-
const [internalFontSize, setInternalFontSize] = (0,
|
|
10051
|
+
const generatedId = (0, import_react47.useId)();
|
|
10052
|
+
const [internalTheme, setInternalTheme] = (0, import_react47.useState)(defaultTheme);
|
|
10053
|
+
const [internalDesktopPatternMode, setInternalDesktopPatternMode] = (0, import_react47.useState)(defaultDesktopPatternMode);
|
|
10054
|
+
const [internalFontFamily, setInternalFontFamily] = (0, import_react47.useState)(defaultFontFamily);
|
|
10055
|
+
const [internalFontSize, setInternalFontSize] = (0, import_react47.useState)(defaultFontSize);
|
|
9607
10056
|
const currentTheme = theme ?? internalTheme;
|
|
9608
10057
|
const resolvedDesktopPatternMode = desktopPatternMode ?? internalDesktopPatternMode;
|
|
9609
10058
|
const resolvedFontFamily = fontFamily ?? internalFontFamily;
|
|
9610
10059
|
const resolvedFontSize = fontSize ?? internalFontSize;
|
|
9611
10060
|
const resolvedTheme = resolveNuTheme(currentTheme);
|
|
9612
10061
|
const themeName = typeof currentTheme === "string" ? currentTheme : currentTheme.name;
|
|
9613
|
-
const handleThemeChange = (0,
|
|
10062
|
+
const handleThemeChange = (0, import_react47.useCallback)(
|
|
9614
10063
|
(nextTheme) => {
|
|
9615
10064
|
if (theme === void 0) {
|
|
9616
10065
|
setInternalTheme(nextTheme);
|
|
@@ -9619,7 +10068,7 @@ function NuThemeProvider({
|
|
|
9619
10068
|
},
|
|
9620
10069
|
[theme, onThemeChange]
|
|
9621
10070
|
);
|
|
9622
|
-
const handleDesktopPatternModeChange = (0,
|
|
10071
|
+
const handleDesktopPatternModeChange = (0, import_react47.useCallback)(
|
|
9623
10072
|
(nextDesktopPatternMode) => {
|
|
9624
10073
|
if (desktopPatternMode === void 0) {
|
|
9625
10074
|
setInternalDesktopPatternMode(nextDesktopPatternMode);
|
|
@@ -9628,7 +10077,7 @@ function NuThemeProvider({
|
|
|
9628
10077
|
},
|
|
9629
10078
|
[desktopPatternMode, onDesktopPatternModeChange]
|
|
9630
10079
|
);
|
|
9631
|
-
const handleFontFamilyChange = (0,
|
|
10080
|
+
const handleFontFamilyChange = (0, import_react47.useCallback)(
|
|
9632
10081
|
(nextFontFamily) => {
|
|
9633
10082
|
if (fontFamily === void 0) {
|
|
9634
10083
|
setInternalFontFamily(nextFontFamily);
|
|
@@ -9637,7 +10086,7 @@ function NuThemeProvider({
|
|
|
9637
10086
|
},
|
|
9638
10087
|
[fontFamily, onFontFamilyChange]
|
|
9639
10088
|
);
|
|
9640
|
-
const handleFontSizeChange = (0,
|
|
10089
|
+
const handleFontSizeChange = (0, import_react47.useCallback)(
|
|
9641
10090
|
(nextFontSize) => {
|
|
9642
10091
|
if (fontSize === void 0) {
|
|
9643
10092
|
setInternalFontSize(nextFontSize);
|
|
@@ -9646,7 +10095,7 @@ function NuThemeProvider({
|
|
|
9646
10095
|
},
|
|
9647
10096
|
[fontSize, onFontSizeChange]
|
|
9648
10097
|
);
|
|
9649
|
-
const contextValue = (0,
|
|
10098
|
+
const contextValue = (0, import_react47.useMemo)(
|
|
9650
10099
|
() => ({
|
|
9651
10100
|
desktopPatternMode: resolvedDesktopPatternMode,
|
|
9652
10101
|
fontFamily: resolvedFontFamily,
|
|
@@ -9671,7 +10120,7 @@ function NuThemeProvider({
|
|
|
9671
10120
|
handleThemeChange
|
|
9672
10121
|
]
|
|
9673
10122
|
);
|
|
9674
|
-
return /* @__PURE__ */ (0,
|
|
10123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(NuThemeContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
9675
10124
|
"div",
|
|
9676
10125
|
{
|
|
9677
10126
|
className: ["nu-theme-root", className].filter(Boolean).join(" "),
|
|
@@ -9685,7 +10134,7 @@ function NuThemeProvider({
|
|
|
9685
10134
|
fontSize: `${resolvedFontSize}px`
|
|
9686
10135
|
},
|
|
9687
10136
|
children: [
|
|
9688
|
-
crtGlitch ? /* @__PURE__ */ (0,
|
|
10137
|
+
crtGlitch ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(NuCrtGlitch, { ...typeof crtGlitch === "object" ? crtGlitch : {} }) : null,
|
|
9689
10138
|
children
|
|
9690
10139
|
]
|
|
9691
10140
|
}
|
|
@@ -9714,6 +10163,8 @@ function NuThemeProvider({
|
|
|
9714
10163
|
NuCrtGlitch,
|
|
9715
10164
|
NuDesktop,
|
|
9716
10165
|
NuGlyph,
|
|
10166
|
+
NuIconGrid,
|
|
10167
|
+
NuIconProvider,
|
|
9717
10168
|
NuThemeContext,
|
|
9718
10169
|
NuThemeProvider,
|
|
9719
10170
|
NuView,
|
|
@@ -9756,6 +10207,7 @@ function NuThemeProvider({
|
|
|
9756
10207
|
resolveNuTheme,
|
|
9757
10208
|
useAppHostMenu,
|
|
9758
10209
|
useMainMenuState,
|
|
10210
|
+
useNuIconManager,
|
|
9759
10211
|
useNuTheme,
|
|
9760
10212
|
useNuWindowManager,
|
|
9761
10213
|
usePopupMenu,
|