@deadragdoll/reactnu 0.1.17 → 0.1.24
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/index.cjs +1091 -677
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1109 -688
- package/dist/styles.css +68 -1
- 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/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4269,11 +4269,19 @@ function InfoAccent({
|
|
|
4269
4269
|
);
|
|
4270
4270
|
}
|
|
4271
4271
|
|
|
4272
|
-
// src/components/
|
|
4272
|
+
// src/components/IconGrid/NuIconGrid.tsx
|
|
4273
4273
|
import {
|
|
4274
|
-
|
|
4275
|
-
useId as useId5,
|
|
4274
|
+
useLayoutEffect as useLayoutEffect4,
|
|
4276
4275
|
useMemo as useMemo8,
|
|
4276
|
+
useRef as useRef9,
|
|
4277
|
+
useState as useState15
|
|
4278
|
+
} from "react";
|
|
4279
|
+
|
|
4280
|
+
// src/components/PopupMenu/PopupMenu.tsx
|
|
4281
|
+
import {
|
|
4282
|
+
useCallback as useCallback4,
|
|
4283
|
+
useEffect as useEffect7,
|
|
4284
|
+
useLayoutEffect as useLayoutEffect3,
|
|
4277
4285
|
useRef as useRef8,
|
|
4278
4286
|
useState as useState13
|
|
4279
4287
|
} from "react";
|
|
@@ -4302,8 +4310,639 @@ function getThemePortalStyle(anchor) {
|
|
|
4302
4310
|
return style;
|
|
4303
4311
|
}
|
|
4304
4312
|
|
|
4313
|
+
// src/components/PopupMenu/PopupMenu.tsx
|
|
4314
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
4315
|
+
function hasVisibleChildren2(item) {
|
|
4316
|
+
return Boolean(item.items?.some((child) => !child.hidden));
|
|
4317
|
+
}
|
|
4318
|
+
function clamp(value, min, max) {
|
|
4319
|
+
return Math.min(max, Math.max(min, value));
|
|
4320
|
+
}
|
|
4321
|
+
function resolveAnchorPosition(anchor) {
|
|
4322
|
+
if (!anchor) {
|
|
4323
|
+
return null;
|
|
4324
|
+
}
|
|
4325
|
+
if (anchor.type === "point") {
|
|
4326
|
+
return {
|
|
4327
|
+
left: anchor.x,
|
|
4328
|
+
top: anchor.y
|
|
4329
|
+
};
|
|
4330
|
+
}
|
|
4331
|
+
const rect = anchor.element.getBoundingClientRect();
|
|
4332
|
+
return {
|
|
4333
|
+
left: rect.left,
|
|
4334
|
+
top: rect.bottom - 1
|
|
4335
|
+
};
|
|
4336
|
+
}
|
|
4337
|
+
function resolvePortalRoot() {
|
|
4338
|
+
if (typeof document === "undefined") {
|
|
4339
|
+
return null;
|
|
4340
|
+
}
|
|
4341
|
+
return document.body;
|
|
4342
|
+
}
|
|
4343
|
+
function PopupMenu({
|
|
4344
|
+
anchor,
|
|
4345
|
+
className,
|
|
4346
|
+
defaultOpen = false,
|
|
4347
|
+
items,
|
|
4348
|
+
onItemSelect,
|
|
4349
|
+
onOpenChange,
|
|
4350
|
+
open,
|
|
4351
|
+
style: styleProp,
|
|
4352
|
+
uncheckedShape = "box",
|
|
4353
|
+
...props
|
|
4354
|
+
}) {
|
|
4355
|
+
const rootRef = useRef8(null);
|
|
4356
|
+
const [activePath, setActivePath] = useState13([]);
|
|
4357
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState13(defaultOpen);
|
|
4358
|
+
const isControlled = open !== void 0;
|
|
4359
|
+
const resolvedOpen = isControlled ? open : uncontrolledOpen;
|
|
4360
|
+
const portalRoot = resolvePortalRoot();
|
|
4361
|
+
const setResolvedOpen = useCallback4(
|
|
4362
|
+
(nextOpen) => {
|
|
4363
|
+
if (!nextOpen) {
|
|
4364
|
+
setActivePath([]);
|
|
4365
|
+
}
|
|
4366
|
+
if (!isControlled) {
|
|
4367
|
+
setUncontrolledOpen(nextOpen);
|
|
4368
|
+
}
|
|
4369
|
+
onOpenChange?.(nextOpen);
|
|
4370
|
+
},
|
|
4371
|
+
[isControlled, onOpenChange]
|
|
4372
|
+
);
|
|
4373
|
+
useEffect7(() => {
|
|
4374
|
+
if (!resolvedOpen) {
|
|
4375
|
+
return;
|
|
4376
|
+
}
|
|
4377
|
+
function handlePointerDown(event) {
|
|
4378
|
+
if (!rootRef.current?.contains(event.target)) {
|
|
4379
|
+
setResolvedOpen(false);
|
|
4380
|
+
}
|
|
4381
|
+
}
|
|
4382
|
+
function handleKeyDown(event) {
|
|
4383
|
+
if (event.key === "Escape") {
|
|
4384
|
+
setResolvedOpen(false);
|
|
4385
|
+
}
|
|
4386
|
+
}
|
|
4387
|
+
document.addEventListener("pointerdown", handlePointerDown);
|
|
4388
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
4389
|
+
return () => {
|
|
4390
|
+
document.removeEventListener("pointerdown", handlePointerDown);
|
|
4391
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
4392
|
+
};
|
|
4393
|
+
}, [resolvedOpen, setResolvedOpen]);
|
|
4394
|
+
useLayoutEffect3(() => {
|
|
4395
|
+
if (!resolvedOpen || !anchor || !rootRef.current) {
|
|
4396
|
+
return;
|
|
4397
|
+
}
|
|
4398
|
+
const rootNode = rootRef.current;
|
|
4399
|
+
function updatePosition() {
|
|
4400
|
+
const anchorPosition = resolveAnchorPosition(anchor);
|
|
4401
|
+
if (!anchorPosition) {
|
|
4402
|
+
return;
|
|
4403
|
+
}
|
|
4404
|
+
const viewportRect = getPortalViewportRect(portalRoot);
|
|
4405
|
+
const relativePosition = toPortalCoordinates(portalRoot, anchorPosition);
|
|
4406
|
+
const rect = rootNode.getBoundingClientRect();
|
|
4407
|
+
const maxLeft = Math.max(0, viewportRect.width - rect.width);
|
|
4408
|
+
const maxTop = Math.max(0, viewportRect.height - rect.height);
|
|
4409
|
+
rootNode.style.left = `${clamp(relativePosition.left, 0, maxLeft)}px`;
|
|
4410
|
+
rootNode.style.top = `${clamp(relativePosition.top, 0, maxTop)}px`;
|
|
4411
|
+
rootNode.style.visibility = "visible";
|
|
4412
|
+
}
|
|
4413
|
+
rootNode.style.left = "0px";
|
|
4414
|
+
rootNode.style.top = "0px";
|
|
4415
|
+
rootNode.style.visibility = "hidden";
|
|
4416
|
+
updatePosition();
|
|
4417
|
+
window.addEventListener("resize", updatePosition);
|
|
4418
|
+
window.addEventListener("scroll", updatePosition, true);
|
|
4419
|
+
return () => {
|
|
4420
|
+
window.removeEventListener("resize", updatePosition);
|
|
4421
|
+
window.removeEventListener("scroll", updatePosition, true);
|
|
4422
|
+
};
|
|
4423
|
+
}, [anchor, portalRoot, resolvedOpen]);
|
|
4424
|
+
function handleActivateItem(item, level) {
|
|
4425
|
+
if (item.disabled) {
|
|
4426
|
+
return;
|
|
4427
|
+
}
|
|
4428
|
+
if (hasVisibleChildren2(item)) {
|
|
4429
|
+
setActivePath(
|
|
4430
|
+
(currentPath) => currentPath[level] === item.id ? currentPath.slice(0, level) : [...currentPath.slice(0, level), item.id]
|
|
4431
|
+
);
|
|
4432
|
+
return;
|
|
4433
|
+
}
|
|
4434
|
+
item.onSelect?.();
|
|
4435
|
+
onItemSelect?.(item);
|
|
4436
|
+
setResolvedOpen(false);
|
|
4437
|
+
}
|
|
4438
|
+
function handleHoverItem(item, level) {
|
|
4439
|
+
if (item.disabled) {
|
|
4440
|
+
return;
|
|
4441
|
+
}
|
|
4442
|
+
setActivePath((currentPath) => [...currentPath.slice(0, level), item.id]);
|
|
4443
|
+
}
|
|
4444
|
+
if (!resolvedOpen || !anchor || !portalRoot || items.every((item) => item.hidden)) {
|
|
4445
|
+
return null;
|
|
4446
|
+
}
|
|
4447
|
+
return createPortal2(
|
|
4448
|
+
/* @__PURE__ */ jsx34(
|
|
4449
|
+
"div",
|
|
4450
|
+
{
|
|
4451
|
+
...props,
|
|
4452
|
+
className: ["nu-popup-menu", className].filter(Boolean).join(" "),
|
|
4453
|
+
onContextMenu: (event) => event.preventDefault(),
|
|
4454
|
+
ref: rootRef,
|
|
4455
|
+
style: {
|
|
4456
|
+
...getThemePortalStyle(
|
|
4457
|
+
anchor?.type === "element" ? anchor.element : null
|
|
4458
|
+
),
|
|
4459
|
+
...styleProp,
|
|
4460
|
+
left: 0,
|
|
4461
|
+
top: 0,
|
|
4462
|
+
visibility: "hidden"
|
|
4463
|
+
},
|
|
4464
|
+
children: /* @__PURE__ */ jsx34("div", { className: "nu-popup-menu__shell", children: /* @__PURE__ */ jsx34(
|
|
4465
|
+
MainMenuList,
|
|
4466
|
+
{
|
|
4467
|
+
activePath,
|
|
4468
|
+
items,
|
|
4469
|
+
level: 0,
|
|
4470
|
+
onActivateItem: handleActivateItem,
|
|
4471
|
+
onHoverItem: handleHoverItem,
|
|
4472
|
+
rootVariant: "popup",
|
|
4473
|
+
uncheckedShape
|
|
4474
|
+
}
|
|
4475
|
+
) })
|
|
4476
|
+
}
|
|
4477
|
+
),
|
|
4478
|
+
portalRoot
|
|
4479
|
+
);
|
|
4480
|
+
}
|
|
4481
|
+
|
|
4482
|
+
// src/components/PopupMenu/usePopupMenu.ts
|
|
4483
|
+
import { useState as useState14 } from "react";
|
|
4484
|
+
function usePopupMenu() {
|
|
4485
|
+
const [anchor, setAnchor] = useState14(null);
|
|
4486
|
+
const [open, setOpen] = useState14(false);
|
|
4487
|
+
function close() {
|
|
4488
|
+
setOpen(false);
|
|
4489
|
+
}
|
|
4490
|
+
function openAtPoint(x, y) {
|
|
4491
|
+
setAnchor({
|
|
4492
|
+
type: "point",
|
|
4493
|
+
x,
|
|
4494
|
+
y
|
|
4495
|
+
});
|
|
4496
|
+
setOpen(true);
|
|
4497
|
+
}
|
|
4498
|
+
function openAtElement(element) {
|
|
4499
|
+
setAnchor({
|
|
4500
|
+
element,
|
|
4501
|
+
type: "element"
|
|
4502
|
+
});
|
|
4503
|
+
setOpen(true);
|
|
4504
|
+
}
|
|
4505
|
+
function openFromClick(event) {
|
|
4506
|
+
openAtElement(event.currentTarget);
|
|
4507
|
+
}
|
|
4508
|
+
function openFromContextMenu(event) {
|
|
4509
|
+
event.preventDefault();
|
|
4510
|
+
openAtPoint(event.clientX, event.clientY);
|
|
4511
|
+
}
|
|
4512
|
+
return {
|
|
4513
|
+
anchor,
|
|
4514
|
+
close,
|
|
4515
|
+
open,
|
|
4516
|
+
openAtElement,
|
|
4517
|
+
openAtPoint,
|
|
4518
|
+
openFromClick,
|
|
4519
|
+
openFromContextMenu,
|
|
4520
|
+
setOpen
|
|
4521
|
+
};
|
|
4522
|
+
}
|
|
4523
|
+
|
|
4524
|
+
// src/components/IconGrid/iconContext.ts
|
|
4525
|
+
import { createContext as createContext4, useContext as useContext8 } from "react";
|
|
4526
|
+
var NuIconContext = createContext4(null);
|
|
4527
|
+
function useNuIconContext() {
|
|
4528
|
+
const context = useContext8(NuIconContext);
|
|
4529
|
+
if (!context) {
|
|
4530
|
+
throw new Error("useNuIconManager must be used within a NuIconProvider.");
|
|
4531
|
+
}
|
|
4532
|
+
return context;
|
|
4533
|
+
}
|
|
4534
|
+
function useNuIconManager() {
|
|
4535
|
+
return useNuIconContext();
|
|
4536
|
+
}
|
|
4537
|
+
function useNuIconGridContext() {
|
|
4538
|
+
return useNuIconContext();
|
|
4539
|
+
}
|
|
4540
|
+
|
|
4541
|
+
// src/components/IconGrid/NuIconGrid.tsx
|
|
4542
|
+
import { Fragment as Fragment5, jsx as jsx35, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4543
|
+
var DRAG_THRESHOLD = 3;
|
|
4544
|
+
function clamp2(value, minimum, maximum) {
|
|
4545
|
+
return Math.min(Math.max(value, minimum), maximum);
|
|
4546
|
+
}
|
|
4547
|
+
function resolveIconContextMenuItems(source, icon) {
|
|
4548
|
+
return typeof source === "function" ? source(icon) : source ?? [];
|
|
4549
|
+
}
|
|
4550
|
+
function resolveGridContextMenuItems(source, manager) {
|
|
4551
|
+
return typeof source === "function" ? source(manager) : source ?? [];
|
|
4552
|
+
}
|
|
4553
|
+
function NuIconGridItem({ gridElement, icon }) {
|
|
4554
|
+
const manager = useNuIconGridContext();
|
|
4555
|
+
const contextMenu = usePopupMenu();
|
|
4556
|
+
const dragStartRef = useRef9(void 0);
|
|
4557
|
+
const isDraggingRef = useRef9(false);
|
|
4558
|
+
const [isDragging, setIsDragging] = useState15(false);
|
|
4559
|
+
const suppressClickRef = useRef9(false);
|
|
4560
|
+
const latestPositionRef = useRef9(icon.position);
|
|
4561
|
+
const contextMenuItems = resolveIconContextMenuItems(
|
|
4562
|
+
icon.contextMenuItems,
|
|
4563
|
+
icon
|
|
4564
|
+
);
|
|
4565
|
+
function handlePointerDown(event) {
|
|
4566
|
+
if (event.button !== 0 || icon.disabled) {
|
|
4567
|
+
return;
|
|
4568
|
+
}
|
|
4569
|
+
manager.selectIcon(icon.id);
|
|
4570
|
+
latestPositionRef.current = icon.position;
|
|
4571
|
+
isDraggingRef.current = false;
|
|
4572
|
+
dragStartRef.current = {
|
|
4573
|
+
clientX: event.clientX,
|
|
4574
|
+
clientY: event.clientY,
|
|
4575
|
+
pointerId: event.pointerId,
|
|
4576
|
+
position: icon.position
|
|
4577
|
+
};
|
|
4578
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
4579
|
+
}
|
|
4580
|
+
function handlePointerMove(event) {
|
|
4581
|
+
const dragStart = dragStartRef.current;
|
|
4582
|
+
if (!dragStart || dragStart.pointerId !== event.pointerId || !gridElement) {
|
|
4583
|
+
return;
|
|
4584
|
+
}
|
|
4585
|
+
const deltaX = event.clientX - dragStart.clientX;
|
|
4586
|
+
const deltaY = event.clientY - dragStart.clientY;
|
|
4587
|
+
if (!isDraggingRef.current && Math.max(Math.abs(deltaX), Math.abs(deltaY)) < DRAG_THRESHOLD) {
|
|
4588
|
+
return;
|
|
4589
|
+
}
|
|
4590
|
+
isDraggingRef.current = true;
|
|
4591
|
+
setIsDragging(true);
|
|
4592
|
+
const gridRect = gridElement.getBoundingClientRect();
|
|
4593
|
+
const iconRect = event.currentTarget.getBoundingClientRect();
|
|
4594
|
+
const position = {
|
|
4595
|
+
x: Math.round(
|
|
4596
|
+
clamp2(
|
|
4597
|
+
dragStart.position.x + deltaX,
|
|
4598
|
+
0,
|
|
4599
|
+
Math.max(0, gridRect.width - iconRect.width)
|
|
4600
|
+
)
|
|
4601
|
+
),
|
|
4602
|
+
y: Math.round(
|
|
4603
|
+
clamp2(
|
|
4604
|
+
dragStart.position.y + deltaY,
|
|
4605
|
+
0,
|
|
4606
|
+
Math.max(0, gridRect.height - iconRect.height)
|
|
4607
|
+
)
|
|
4608
|
+
)
|
|
4609
|
+
};
|
|
4610
|
+
latestPositionRef.current = position;
|
|
4611
|
+
manager.moveIcon(icon.id, position);
|
|
4612
|
+
}
|
|
4613
|
+
function finishDragging(event) {
|
|
4614
|
+
const dragStart = dragStartRef.current;
|
|
4615
|
+
if (!dragStart || dragStart.pointerId !== event.pointerId) {
|
|
4616
|
+
return;
|
|
4617
|
+
}
|
|
4618
|
+
if (event.currentTarget.hasPointerCapture(event.pointerId)) {
|
|
4619
|
+
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
4620
|
+
}
|
|
4621
|
+
dragStartRef.current = void 0;
|
|
4622
|
+
if (!isDraggingRef.current) {
|
|
4623
|
+
return;
|
|
4624
|
+
}
|
|
4625
|
+
suppressClickRef.current = true;
|
|
4626
|
+
isDraggingRef.current = false;
|
|
4627
|
+
setIsDragging(false);
|
|
4628
|
+
icon.onPositionChange?.(latestPositionRef.current, {
|
|
4629
|
+
...icon,
|
|
4630
|
+
position: latestPositionRef.current
|
|
4631
|
+
});
|
|
4632
|
+
}
|
|
4633
|
+
function handleClick(event) {
|
|
4634
|
+
if (suppressClickRef.current) {
|
|
4635
|
+
suppressClickRef.current = false;
|
|
4636
|
+
event.preventDefault();
|
|
4637
|
+
return;
|
|
4638
|
+
}
|
|
4639
|
+
manager.selectIcon(icon.id);
|
|
4640
|
+
icon.onClick?.(event);
|
|
4641
|
+
}
|
|
4642
|
+
function handleContextMenu(event) {
|
|
4643
|
+
event.stopPropagation();
|
|
4644
|
+
manager.selectIcon(icon.id);
|
|
4645
|
+
icon.onContextMenu?.(event);
|
|
4646
|
+
if (event.defaultPrevented || contextMenuItems.length === 0) {
|
|
4647
|
+
return;
|
|
4648
|
+
}
|
|
4649
|
+
event.preventDefault();
|
|
4650
|
+
contextMenu.openAtPoint(event.clientX, event.clientY);
|
|
4651
|
+
}
|
|
4652
|
+
function handleKeyDown(event) {
|
|
4653
|
+
if (event.key !== "ContextMenu" && !(event.key === "F10" && event.shiftKey) || contextMenuItems.length === 0) {
|
|
4654
|
+
return;
|
|
4655
|
+
}
|
|
4656
|
+
event.preventDefault();
|
|
4657
|
+
manager.selectIcon(icon.id);
|
|
4658
|
+
contextMenu.openAtElement(event.currentTarget);
|
|
4659
|
+
}
|
|
4660
|
+
return /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
4661
|
+
/* @__PURE__ */ jsxs20(
|
|
4662
|
+
"button",
|
|
4663
|
+
{
|
|
4664
|
+
"aria-haspopup": contextMenuItems.length > 0 ? "menu" : void 0,
|
|
4665
|
+
className: "nu-icon-grid__icon",
|
|
4666
|
+
"data-dragging": isDragging || void 0,
|
|
4667
|
+
"data-selected": manager.selectedIconId === icon.id || void 0,
|
|
4668
|
+
disabled: icon.disabled,
|
|
4669
|
+
onClick: handleClick,
|
|
4670
|
+
onContextMenu: handleContextMenu,
|
|
4671
|
+
onDoubleClick: icon.onDoubleClick,
|
|
4672
|
+
onKeyDown: handleKeyDown,
|
|
4673
|
+
onPointerDown: handlePointerDown,
|
|
4674
|
+
onPointerMove: handlePointerMove,
|
|
4675
|
+
onPointerUp: finishDragging,
|
|
4676
|
+
onPointerCancel: finishDragging,
|
|
4677
|
+
style: { left: icon.position.x, top: icon.position.y },
|
|
4678
|
+
type: "button",
|
|
4679
|
+
children: [
|
|
4680
|
+
/* @__PURE__ */ jsx35("span", { "aria-hidden": "true", className: "nu-icon-grid__glyph", children: typeof icon.icon === "string" ? /* @__PURE__ */ jsx35("img", { alt: "", draggable: false, src: icon.icon }) : icon.icon }),
|
|
4681
|
+
/* @__PURE__ */ jsx35("span", { className: "nu-icon-grid__label", children: renderMnemonicText(icon.label) })
|
|
4682
|
+
]
|
|
4683
|
+
}
|
|
4684
|
+
),
|
|
4685
|
+
/* @__PURE__ */ jsx35(
|
|
4686
|
+
PopupMenu,
|
|
4687
|
+
{
|
|
4688
|
+
anchor: contextMenu.anchor,
|
|
4689
|
+
items: contextMenuItems,
|
|
4690
|
+
onOpenChange: contextMenu.setOpen,
|
|
4691
|
+
open: contextMenu.open
|
|
4692
|
+
}
|
|
4693
|
+
)
|
|
4694
|
+
] });
|
|
4695
|
+
}
|
|
4696
|
+
function NuIconGrid({
|
|
4697
|
+
className,
|
|
4698
|
+
contextMenuItems: contextMenuItemsSource,
|
|
4699
|
+
defaultArrangeMode,
|
|
4700
|
+
onContextMenu,
|
|
4701
|
+
onPointerDown,
|
|
4702
|
+
...props
|
|
4703
|
+
}) {
|
|
4704
|
+
const [gridElement, setGridElement] = useState15(null);
|
|
4705
|
+
const manager = useNuIconGridContext();
|
|
4706
|
+
const hasAppliedDefaultArrangementRef = useRef9(false);
|
|
4707
|
+
const arrangeIcons = manager.arrangeIcons;
|
|
4708
|
+
const setGridSize = manager.setGridSize;
|
|
4709
|
+
const contextMenu = usePopupMenu();
|
|
4710
|
+
const contextMenuItems = useMemo8(
|
|
4711
|
+
() => resolveGridContextMenuItems(contextMenuItemsSource, manager),
|
|
4712
|
+
[contextMenuItemsSource, manager]
|
|
4713
|
+
);
|
|
4714
|
+
useLayoutEffect4(() => {
|
|
4715
|
+
if (!gridElement) {
|
|
4716
|
+
return;
|
|
4717
|
+
}
|
|
4718
|
+
const activeGridElement = gridElement;
|
|
4719
|
+
function updateGridSize() {
|
|
4720
|
+
const size = {
|
|
4721
|
+
height: activeGridElement.clientHeight,
|
|
4722
|
+
width: activeGridElement.clientWidth
|
|
4723
|
+
};
|
|
4724
|
+
setGridSize(size);
|
|
4725
|
+
if (defaultArrangeMode && !hasAppliedDefaultArrangementRef.current && size.height > 0 && size.width > 0) {
|
|
4726
|
+
hasAppliedDefaultArrangementRef.current = true;
|
|
4727
|
+
arrangeIcons(defaultArrangeMode);
|
|
4728
|
+
}
|
|
4729
|
+
}
|
|
4730
|
+
updateGridSize();
|
|
4731
|
+
const resizeObserver = new ResizeObserver(updateGridSize);
|
|
4732
|
+
resizeObserver.observe(gridElement);
|
|
4733
|
+
return () => resizeObserver.disconnect();
|
|
4734
|
+
}, [arrangeIcons, defaultArrangeMode, gridElement, setGridSize]);
|
|
4735
|
+
function handleContextMenu(event) {
|
|
4736
|
+
onContextMenu?.(event);
|
|
4737
|
+
if (event.defaultPrevented || contextMenuItems.length === 0) {
|
|
4738
|
+
return;
|
|
4739
|
+
}
|
|
4740
|
+
event.preventDefault();
|
|
4741
|
+
manager.selectIcon(null);
|
|
4742
|
+
contextMenu.openAtPoint(event.clientX, event.clientY);
|
|
4743
|
+
}
|
|
4744
|
+
return /* @__PURE__ */ jsxs20(
|
|
4745
|
+
"div",
|
|
4746
|
+
{
|
|
4747
|
+
...props,
|
|
4748
|
+
"aria-label": props["aria-label"] ?? "Application icons",
|
|
4749
|
+
className: ["nu-icon-grid", className].filter(Boolean).join(" "),
|
|
4750
|
+
onContextMenu: handleContextMenu,
|
|
4751
|
+
onPointerDown: (event) => {
|
|
4752
|
+
onPointerDown?.(event);
|
|
4753
|
+
if (event.defaultPrevented) {
|
|
4754
|
+
return;
|
|
4755
|
+
}
|
|
4756
|
+
if (event.target === event.currentTarget) {
|
|
4757
|
+
manager.selectIcon(null);
|
|
4758
|
+
}
|
|
4759
|
+
},
|
|
4760
|
+
ref: setGridElement,
|
|
4761
|
+
role: "group",
|
|
4762
|
+
children: [
|
|
4763
|
+
manager.icons.map((icon) => /* @__PURE__ */ jsx35(NuIconGridItem, { gridElement, icon }, icon.id)),
|
|
4764
|
+
/* @__PURE__ */ jsx35(
|
|
4765
|
+
PopupMenu,
|
|
4766
|
+
{
|
|
4767
|
+
anchor: contextMenu.anchor,
|
|
4768
|
+
items: contextMenuItems,
|
|
4769
|
+
onOpenChange: contextMenu.setOpen,
|
|
4770
|
+
open: contextMenu.open
|
|
4771
|
+
}
|
|
4772
|
+
)
|
|
4773
|
+
]
|
|
4774
|
+
}
|
|
4775
|
+
);
|
|
4776
|
+
}
|
|
4777
|
+
|
|
4778
|
+
// src/components/IconGrid/NuIconProvider.tsx
|
|
4779
|
+
import {
|
|
4780
|
+
useCallback as useCallback5,
|
|
4781
|
+
useMemo as useMemo9,
|
|
4782
|
+
useRef as useRef10,
|
|
4783
|
+
useState as useState16
|
|
4784
|
+
} from "react";
|
|
4785
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
4786
|
+
var GRID_PADDING = 12;
|
|
4787
|
+
var ICON_CELL_HEIGHT = 104;
|
|
4788
|
+
var ICON_CELL_WIDTH = 104;
|
|
4789
|
+
function getDefaultPosition(index) {
|
|
4790
|
+
return {
|
|
4791
|
+
x: GRID_PADDING + Math.floor(index / 6) * ICON_CELL_WIDTH,
|
|
4792
|
+
y: GRID_PADDING + index % 6 * ICON_CELL_HEIGHT
|
|
4793
|
+
};
|
|
4794
|
+
}
|
|
4795
|
+
function getIconInfo(definition, index, id) {
|
|
4796
|
+
return {
|
|
4797
|
+
...definition,
|
|
4798
|
+
id,
|
|
4799
|
+
position: definition.position ?? getDefaultPosition(index)
|
|
4800
|
+
};
|
|
4801
|
+
}
|
|
4802
|
+
function getInitialIcons(definitions) {
|
|
4803
|
+
const ids = /* @__PURE__ */ new Set();
|
|
4804
|
+
return definitions.map((definition, index) => {
|
|
4805
|
+
const baseId = definition.id ?? `nu-icon-${index + 1}`;
|
|
4806
|
+
let id = baseId;
|
|
4807
|
+
let duplicateIndex = 2;
|
|
4808
|
+
while (ids.has(id)) {
|
|
4809
|
+
id = `${baseId}-${duplicateIndex}`;
|
|
4810
|
+
duplicateIndex += 1;
|
|
4811
|
+
}
|
|
4812
|
+
ids.add(id);
|
|
4813
|
+
return getIconInfo(definition, index, id);
|
|
4814
|
+
});
|
|
4815
|
+
}
|
|
4816
|
+
function getArrangedPositions(icons, mode, gridSize) {
|
|
4817
|
+
const orderedIcons = mode === "name" ? [...icons].sort(
|
|
4818
|
+
(left, right) => left.label.localeCompare(right.label, void 0, {
|
|
4819
|
+
numeric: true,
|
|
4820
|
+
sensitivity: "base"
|
|
4821
|
+
})
|
|
4822
|
+
) : icons;
|
|
4823
|
+
const cellsPerLine = Math.max(
|
|
4824
|
+
1,
|
|
4825
|
+
Math.floor(
|
|
4826
|
+
((mode === "rows" ? gridSize.width : gridSize.height) - GRID_PADDING * 2) / (mode === "rows" ? ICON_CELL_WIDTH : ICON_CELL_HEIGHT)
|
|
4827
|
+
)
|
|
4828
|
+
);
|
|
4829
|
+
return new Map(
|
|
4830
|
+
orderedIcons.map((icon, index) => {
|
|
4831
|
+
const lineIndex = index % cellsPerLine;
|
|
4832
|
+
const crossIndex = Math.floor(index / cellsPerLine);
|
|
4833
|
+
return [
|
|
4834
|
+
icon.id,
|
|
4835
|
+
mode === "rows" ? {
|
|
4836
|
+
x: GRID_PADDING + lineIndex * ICON_CELL_WIDTH,
|
|
4837
|
+
y: GRID_PADDING + crossIndex * ICON_CELL_HEIGHT
|
|
4838
|
+
} : {
|
|
4839
|
+
x: GRID_PADDING + crossIndex * ICON_CELL_WIDTH,
|
|
4840
|
+
y: GRID_PADDING + lineIndex * ICON_CELL_HEIGHT
|
|
4841
|
+
}
|
|
4842
|
+
];
|
|
4843
|
+
})
|
|
4844
|
+
);
|
|
4845
|
+
}
|
|
4846
|
+
function NuIconProvider({
|
|
4847
|
+
children,
|
|
4848
|
+
defaultIcons = []
|
|
4849
|
+
}) {
|
|
4850
|
+
const idRef = useRef10(defaultIcons.length);
|
|
4851
|
+
const gridSizeRef = useRef10({ height: 0, width: 0 });
|
|
4852
|
+
const [icons, setIcons] = useState16(
|
|
4853
|
+
() => getInitialIcons(defaultIcons)
|
|
4854
|
+
);
|
|
4855
|
+
const [selectedIconId, setSelectedIconId] = useState16(null);
|
|
4856
|
+
const addIcon = useCallback5((definition) => {
|
|
4857
|
+
const id = definition.id ?? `nu-icon-${++idRef.current}`;
|
|
4858
|
+
setIcons((currentIcons) => {
|
|
4859
|
+
if (currentIcons.some((icon) => icon.id === id)) {
|
|
4860
|
+
throw new Error(`An icon with id "${id}" already exists.`);
|
|
4861
|
+
}
|
|
4862
|
+
return [
|
|
4863
|
+
...currentIcons,
|
|
4864
|
+
getIconInfo(definition, currentIcons.length, id)
|
|
4865
|
+
];
|
|
4866
|
+
});
|
|
4867
|
+
return id;
|
|
4868
|
+
}, []);
|
|
4869
|
+
const moveIcon = useCallback5((id, position) => {
|
|
4870
|
+
setIcons(
|
|
4871
|
+
(currentIcons) => currentIcons.map(
|
|
4872
|
+
(icon) => icon.id === id ? { ...icon, position } : icon
|
|
4873
|
+
)
|
|
4874
|
+
);
|
|
4875
|
+
}, []);
|
|
4876
|
+
const removeIcon = useCallback5((id) => {
|
|
4877
|
+
setIcons((currentIcons) => currentIcons.filter((icon) => icon.id !== id));
|
|
4878
|
+
setSelectedIconId((currentId) => currentId === id ? null : currentId);
|
|
4879
|
+
}, []);
|
|
4880
|
+
const updateIcon = useCallback5(
|
|
4881
|
+
(id, patch) => {
|
|
4882
|
+
setIcons(
|
|
4883
|
+
(currentIcons) => currentIcons.map(
|
|
4884
|
+
(icon) => icon.id === id ? {
|
|
4885
|
+
...icon,
|
|
4886
|
+
...patch,
|
|
4887
|
+
position: patch.position ?? icon.position
|
|
4888
|
+
} : icon
|
|
4889
|
+
)
|
|
4890
|
+
);
|
|
4891
|
+
},
|
|
4892
|
+
[]
|
|
4893
|
+
);
|
|
4894
|
+
const arrangeIcons = useCallback5((mode = "columns") => {
|
|
4895
|
+
setIcons((currentIcons) => {
|
|
4896
|
+
const positions = getArrangedPositions(
|
|
4897
|
+
currentIcons,
|
|
4898
|
+
mode,
|
|
4899
|
+
gridSizeRef.current
|
|
4900
|
+
);
|
|
4901
|
+
return currentIcons.map((icon) => ({
|
|
4902
|
+
...icon,
|
|
4903
|
+
position: positions.get(icon.id) ?? icon.position
|
|
4904
|
+
}));
|
|
4905
|
+
});
|
|
4906
|
+
}, []);
|
|
4907
|
+
const setGridSize = useCallback5((size) => {
|
|
4908
|
+
gridSizeRef.current = size;
|
|
4909
|
+
}, []);
|
|
4910
|
+
const contextValue = useMemo9(
|
|
4911
|
+
() => ({
|
|
4912
|
+
addIcon,
|
|
4913
|
+
arrangeIcons,
|
|
4914
|
+
icons,
|
|
4915
|
+
moveIcon,
|
|
4916
|
+
removeIcon,
|
|
4917
|
+
selectedIconId,
|
|
4918
|
+
selectIcon: setSelectedIconId,
|
|
4919
|
+
setGridSize,
|
|
4920
|
+
updateIcon
|
|
4921
|
+
}),
|
|
4922
|
+
[
|
|
4923
|
+
addIcon,
|
|
4924
|
+
arrangeIcons,
|
|
4925
|
+
icons,
|
|
4926
|
+
moveIcon,
|
|
4927
|
+
removeIcon,
|
|
4928
|
+
selectedIconId,
|
|
4929
|
+
setGridSize,
|
|
4930
|
+
updateIcon
|
|
4931
|
+
]
|
|
4932
|
+
);
|
|
4933
|
+
return /* @__PURE__ */ jsx36(NuIconContext.Provider, { value: contextValue, children });
|
|
4934
|
+
}
|
|
4935
|
+
|
|
4305
4936
|
// src/components/ComboBox/ComboBox.tsx
|
|
4306
|
-
import {
|
|
4937
|
+
import {
|
|
4938
|
+
useEffect as useEffect8,
|
|
4939
|
+
useId as useId5,
|
|
4940
|
+
useMemo as useMemo10,
|
|
4941
|
+
useRef as useRef11,
|
|
4942
|
+
useState as useState17
|
|
4943
|
+
} from "react";
|
|
4944
|
+
import { createPortal as createPortal3 } from "react-dom";
|
|
4945
|
+
import { jsx as jsx37, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4307
4946
|
function flattenComboBoxOptions(data) {
|
|
4308
4947
|
const options = [];
|
|
4309
4948
|
data.forEach((group) => {
|
|
@@ -4344,31 +4983,31 @@ function ComboBox({
|
|
|
4344
4983
|
value,
|
|
4345
4984
|
...props
|
|
4346
4985
|
}) {
|
|
4347
|
-
const rootRef =
|
|
4348
|
-
const inputRef =
|
|
4349
|
-
const fieldRef =
|
|
4350
|
-
const popupRef =
|
|
4986
|
+
const rootRef = useRef11(null);
|
|
4987
|
+
const inputRef = useRef11(null);
|
|
4988
|
+
const fieldRef = useRef11(null);
|
|
4989
|
+
const popupRef = useRef11(null);
|
|
4351
4990
|
const generatedId = useId5();
|
|
4352
4991
|
const fieldId = `${generatedId}-combo-box`;
|
|
4353
4992
|
const labelId = `${fieldId}-label`;
|
|
4354
4993
|
const hintId = hint ? `${fieldId}-hint` : void 0;
|
|
4355
|
-
const [open, setOpen] =
|
|
4356
|
-
const options =
|
|
4994
|
+
const [open, setOpen] = useState17(false);
|
|
4995
|
+
const options = useMemo10(() => flattenComboBoxOptions(data), [data]);
|
|
4357
4996
|
const isValueControlled = value !== void 0;
|
|
4358
4997
|
const isInputControlled = inputValueProp !== void 0;
|
|
4359
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
4998
|
+
const [uncontrolledValue, setUncontrolledValue] = useState17(() => defaultValue);
|
|
4360
4999
|
const initialSelectedOption = findComboBoxOption(options, defaultValue);
|
|
4361
|
-
const [uncontrolledInputValue, setUncontrolledInputValue] =
|
|
5000
|
+
const [uncontrolledInputValue, setUncontrolledInputValue] = useState17(
|
|
4362
5001
|
() => defaultInputValue ?? initialSelectedOption?.item.name.text ?? ""
|
|
4363
5002
|
);
|
|
4364
5003
|
const resolvedValue = isValueControlled ? value : uncontrolledValue;
|
|
4365
|
-
const selectedOption =
|
|
5004
|
+
const selectedOption = useMemo10(
|
|
4366
5005
|
() => findComboBoxOption(options, resolvedValue),
|
|
4367
5006
|
[options, resolvedValue]
|
|
4368
5007
|
);
|
|
4369
5008
|
const resolvedInputValue = isInputControlled ? inputValueProp ?? "" : uncontrolledInputValue;
|
|
4370
5009
|
const normalizedFilter = resolvedInputValue.trim().toLowerCase();
|
|
4371
|
-
const filteredData =
|
|
5010
|
+
const filteredData = useMemo10(() => {
|
|
4372
5011
|
if (!normalizedFilter) {
|
|
4373
5012
|
return data;
|
|
4374
5013
|
}
|
|
@@ -4379,15 +5018,15 @@ function ComboBox({
|
|
|
4379
5018
|
)
|
|
4380
5019
|
})).filter((group) => group.items.length > 0);
|
|
4381
5020
|
}, [data, normalizedFilter]);
|
|
4382
|
-
const filteredOptions =
|
|
5021
|
+
const filteredOptions = useMemo10(
|
|
4383
5022
|
() => flattenComboBoxOptions(filteredData).filter(
|
|
4384
5023
|
(option) => !option.item.disabled
|
|
4385
5024
|
),
|
|
4386
5025
|
[filteredData]
|
|
4387
5026
|
);
|
|
4388
5027
|
const popupRoot = typeof document === "undefined" ? null : resolveComboBoxPortalRoot();
|
|
4389
|
-
const [themePortalStyle, setThemePortalStyle] =
|
|
4390
|
-
|
|
5028
|
+
const [themePortalStyle, setThemePortalStyle] = useState17(() => void 0);
|
|
5029
|
+
useEffect8(() => {
|
|
4391
5030
|
if (!open) {
|
|
4392
5031
|
return;
|
|
4393
5032
|
}
|
|
@@ -4463,7 +5102,7 @@ function ComboBox({
|
|
|
4463
5102
|
break;
|
|
4464
5103
|
}
|
|
4465
5104
|
}
|
|
4466
|
-
return /* @__PURE__ */
|
|
5105
|
+
return /* @__PURE__ */ jsxs21(
|
|
4467
5106
|
"div",
|
|
4468
5107
|
{
|
|
4469
5108
|
...props,
|
|
@@ -4471,7 +5110,7 @@ function ComboBox({
|
|
|
4471
5110
|
ref: rootRef,
|
|
4472
5111
|
style: mergeSlotStyle(style, slotStyles?.root),
|
|
4473
5112
|
children: [
|
|
4474
|
-
/* @__PURE__ */
|
|
5113
|
+
/* @__PURE__ */ jsx37(
|
|
4475
5114
|
"label",
|
|
4476
5115
|
{
|
|
4477
5116
|
className: cx("nu-combo-box__label", slotClassNames?.label),
|
|
@@ -4481,20 +5120,20 @@ function ComboBox({
|
|
|
4481
5120
|
children: renderMnemonicText(label)
|
|
4482
5121
|
}
|
|
4483
5122
|
),
|
|
4484
|
-
/* @__PURE__ */
|
|
5123
|
+
/* @__PURE__ */ jsxs21(
|
|
4485
5124
|
"span",
|
|
4486
5125
|
{
|
|
4487
5126
|
className: cx("nu-combo-box__slot", slotClassNames?.slot),
|
|
4488
5127
|
style: slotStyles?.slot,
|
|
4489
5128
|
children: [
|
|
4490
|
-
/* @__PURE__ */
|
|
5129
|
+
/* @__PURE__ */ jsxs21(
|
|
4491
5130
|
"span",
|
|
4492
5131
|
{
|
|
4493
5132
|
className: cx("nu-combo-box__field", slotClassNames?.field),
|
|
4494
5133
|
ref: fieldRef,
|
|
4495
5134
|
style: slotStyles?.field,
|
|
4496
5135
|
children: [
|
|
4497
|
-
/* @__PURE__ */
|
|
5136
|
+
/* @__PURE__ */ jsx37(
|
|
4498
5137
|
"span",
|
|
4499
5138
|
{
|
|
4500
5139
|
"aria-hidden": "true",
|
|
@@ -4503,7 +5142,7 @@ function ComboBox({
|
|
|
4503
5142
|
children: "["
|
|
4504
5143
|
}
|
|
4505
5144
|
),
|
|
4506
|
-
/* @__PURE__ */
|
|
5145
|
+
/* @__PURE__ */ jsx37(
|
|
4507
5146
|
"span",
|
|
4508
5147
|
{
|
|
4509
5148
|
className: cx(
|
|
@@ -4511,7 +5150,7 @@ function ComboBox({
|
|
|
4511
5150
|
slotClassNames?.inputShell
|
|
4512
5151
|
),
|
|
4513
5152
|
style: slotStyles?.inputShell,
|
|
4514
|
-
children: /* @__PURE__ */
|
|
5153
|
+
children: /* @__PURE__ */ jsx37(
|
|
4515
5154
|
"input",
|
|
4516
5155
|
{
|
|
4517
5156
|
"aria-autocomplete": "list",
|
|
@@ -4536,318 +5175,97 @@ function ComboBox({
|
|
|
4536
5175
|
value: resolvedInputValue
|
|
4537
5176
|
}
|
|
4538
5177
|
)
|
|
4539
|
-
}
|
|
4540
|
-
),
|
|
4541
|
-
/* @__PURE__ */
|
|
4542
|
-
"span",
|
|
4543
|
-
{
|
|
4544
|
-
"aria-hidden": "true",
|
|
4545
|
-
className: cx("nu-combo-box__bracket", slotClassNames?.bracket),
|
|
4546
|
-
style: slotStyles?.bracket,
|
|
4547
|
-
children: "]"
|
|
4548
|
-
}
|
|
4549
|
-
)
|
|
4550
|
-
]
|
|
4551
|
-
}
|
|
4552
|
-
),
|
|
4553
|
-
/* @__PURE__ */
|
|
4554
|
-
ControlOpener,
|
|
4555
|
-
{
|
|
4556
|
-
"aria-label": open ? "Collapse list" : "Expand list",
|
|
4557
|
-
as: "button",
|
|
4558
|
-
className: cx(
|
|
4559
|
-
"nu-control-opener",
|
|
4560
|
-
"nu-combo-box__toggle",
|
|
4561
|
-
slotClassNames?.toggle
|
|
4562
|
-
),
|
|
4563
|
-
disabled,
|
|
4564
|
-
onClick: handleToggle,
|
|
4565
|
-
style: slotStyles?.toggle
|
|
4566
|
-
}
|
|
4567
|
-
)
|
|
4568
|
-
]
|
|
4569
|
-
}
|
|
4570
|
-
),
|
|
4571
|
-
hint ? /* @__PURE__ */
|
|
4572
|
-
"span",
|
|
4573
|
-
{
|
|
4574
|
-
className: cx("nu-combo-box__hint", slotClassNames?.hint),
|
|
4575
|
-
id: hintId,
|
|
4576
|
-
style: slotStyles?.hint,
|
|
4577
|
-
children: hint
|
|
4578
|
-
}
|
|
4579
|
-
) : null,
|
|
4580
|
-
open && popupRoot ? createPortal2(
|
|
4581
|
-
/* @__PURE__ */ jsx34(
|
|
4582
|
-
"div",
|
|
4583
|
-
{
|
|
4584
|
-
className: cx("nu-combo-box__popup", slotClassNames?.popup),
|
|
4585
|
-
id: `${fieldId}-popup`,
|
|
4586
|
-
ref: popupRef,
|
|
4587
|
-
style: mergeSlotStyle(
|
|
4588
|
-
themePortalStyle,
|
|
4589
|
-
slotStyles?.popup
|
|
4590
|
-
),
|
|
4591
|
-
children: /* @__PURE__ */ jsx34(
|
|
4592
|
-
"div",
|
|
4593
|
-
{
|
|
4594
|
-
className: cx("nu-combo-box__listbox", slotClassNames?.listbox),
|
|
4595
|
-
style: slotStyles?.listbox,
|
|
4596
|
-
children: /* @__PURE__ */ jsx34(
|
|
4597
|
-
ListBox,
|
|
4598
|
-
{
|
|
4599
|
-
data: filteredData,
|
|
4600
|
-
emptyText: "No matches",
|
|
4601
|
-
onItemSelect: (item, group) => {
|
|
4602
|
-
const nextOption = filteredOptions.find(
|
|
4603
|
-
(option) => option.item === item && option.group === group
|
|
4604
|
-
);
|
|
4605
|
-
if (!nextOption) {
|
|
4606
|
-
return;
|
|
4607
|
-
}
|
|
4608
|
-
commitValue(nextOption.value, item, group);
|
|
4609
|
-
},
|
|
4610
|
-
selectedId: selectedOption?.value,
|
|
4611
|
-
style: slotStyles?.listbox
|
|
4612
|
-
}
|
|
4613
|
-
)
|
|
4614
|
-
}
|
|
4615
|
-
)
|
|
4616
|
-
}
|
|
4617
|
-
),
|
|
4618
|
-
popupRoot
|
|
4619
|
-
) : null
|
|
4620
|
-
]
|
|
4621
|
-
}
|
|
4622
|
-
);
|
|
4623
|
-
}
|
|
4624
|
-
|
|
4625
|
-
// src/components/CommandButton/CommandButton.tsx
|
|
4626
|
-
import {
|
|
4627
|
-
Fragment as Fragment5
|
|
4628
|
-
} from "react";
|
|
4629
|
-
|
|
4630
|
-
// src/components/PopupMenu/PopupMenu.tsx
|
|
4631
|
-
import {
|
|
4632
|
-
useCallback as useCallback4,
|
|
4633
|
-
useEffect as useEffect8,
|
|
4634
|
-
useLayoutEffect as useLayoutEffect3,
|
|
4635
|
-
useRef as useRef9,
|
|
4636
|
-
useState as useState14
|
|
4637
|
-
} from "react";
|
|
4638
|
-
import { createPortal as createPortal3 } from "react-dom";
|
|
4639
|
-
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
4640
|
-
function hasVisibleChildren2(item) {
|
|
4641
|
-
return Boolean(item.items?.some((child) => !child.hidden));
|
|
4642
|
-
}
|
|
4643
|
-
function clamp(value, min, max) {
|
|
4644
|
-
return Math.min(max, Math.max(min, value));
|
|
4645
|
-
}
|
|
4646
|
-
function resolveAnchorPosition(anchor) {
|
|
4647
|
-
if (!anchor) {
|
|
4648
|
-
return null;
|
|
4649
|
-
}
|
|
4650
|
-
if (anchor.type === "point") {
|
|
4651
|
-
return {
|
|
4652
|
-
left: anchor.x,
|
|
4653
|
-
top: anchor.y
|
|
4654
|
-
};
|
|
4655
|
-
}
|
|
4656
|
-
const rect = anchor.element.getBoundingClientRect();
|
|
4657
|
-
return {
|
|
4658
|
-
left: rect.left,
|
|
4659
|
-
top: rect.bottom - 1
|
|
4660
|
-
};
|
|
4661
|
-
}
|
|
4662
|
-
function resolvePortalRoot() {
|
|
4663
|
-
if (typeof document === "undefined") {
|
|
4664
|
-
return null;
|
|
4665
|
-
}
|
|
4666
|
-
return document.body;
|
|
4667
|
-
}
|
|
4668
|
-
function PopupMenu({
|
|
4669
|
-
anchor,
|
|
4670
|
-
className,
|
|
4671
|
-
defaultOpen = false,
|
|
4672
|
-
items,
|
|
4673
|
-
onItemSelect,
|
|
4674
|
-
onOpenChange,
|
|
4675
|
-
open,
|
|
4676
|
-
style: styleProp,
|
|
4677
|
-
uncheckedShape = "box",
|
|
4678
|
-
...props
|
|
4679
|
-
}) {
|
|
4680
|
-
const rootRef = useRef9(null);
|
|
4681
|
-
const [activePath, setActivePath] = useState14([]);
|
|
4682
|
-
const [uncontrolledOpen, setUncontrolledOpen] = useState14(defaultOpen);
|
|
4683
|
-
const isControlled = open !== void 0;
|
|
4684
|
-
const resolvedOpen = isControlled ? open : uncontrolledOpen;
|
|
4685
|
-
const portalRoot = resolvePortalRoot();
|
|
4686
|
-
const setResolvedOpen = useCallback4(
|
|
4687
|
-
(nextOpen) => {
|
|
4688
|
-
if (!nextOpen) {
|
|
4689
|
-
setActivePath([]);
|
|
4690
|
-
}
|
|
4691
|
-
if (!isControlled) {
|
|
4692
|
-
setUncontrolledOpen(nextOpen);
|
|
4693
|
-
}
|
|
4694
|
-
onOpenChange?.(nextOpen);
|
|
4695
|
-
},
|
|
4696
|
-
[isControlled, onOpenChange]
|
|
4697
|
-
);
|
|
4698
|
-
useEffect8(() => {
|
|
4699
|
-
if (!resolvedOpen) {
|
|
4700
|
-
return;
|
|
4701
|
-
}
|
|
4702
|
-
function handlePointerDown(event) {
|
|
4703
|
-
if (!rootRef.current?.contains(event.target)) {
|
|
4704
|
-
setResolvedOpen(false);
|
|
4705
|
-
}
|
|
4706
|
-
}
|
|
4707
|
-
function handleKeyDown(event) {
|
|
4708
|
-
if (event.key === "Escape") {
|
|
4709
|
-
setResolvedOpen(false);
|
|
4710
|
-
}
|
|
4711
|
-
}
|
|
4712
|
-
document.addEventListener("pointerdown", handlePointerDown);
|
|
4713
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
4714
|
-
return () => {
|
|
4715
|
-
document.removeEventListener("pointerdown", handlePointerDown);
|
|
4716
|
-
document.removeEventListener("keydown", handleKeyDown);
|
|
4717
|
-
};
|
|
4718
|
-
}, [resolvedOpen, setResolvedOpen]);
|
|
4719
|
-
useLayoutEffect3(() => {
|
|
4720
|
-
if (!resolvedOpen || !anchor || !rootRef.current) {
|
|
4721
|
-
return;
|
|
4722
|
-
}
|
|
4723
|
-
const rootNode = rootRef.current;
|
|
4724
|
-
function updatePosition() {
|
|
4725
|
-
const anchorPosition = resolveAnchorPosition(anchor);
|
|
4726
|
-
if (!anchorPosition) {
|
|
4727
|
-
return;
|
|
4728
|
-
}
|
|
4729
|
-
const viewportRect = getPortalViewportRect(portalRoot);
|
|
4730
|
-
const relativePosition = toPortalCoordinates(portalRoot, anchorPosition);
|
|
4731
|
-
const rect = rootNode.getBoundingClientRect();
|
|
4732
|
-
const maxLeft = Math.max(0, viewportRect.width - rect.width);
|
|
4733
|
-
const maxTop = Math.max(0, viewportRect.height - rect.height);
|
|
4734
|
-
rootNode.style.left = `${clamp(relativePosition.left, 0, maxLeft)}px`;
|
|
4735
|
-
rootNode.style.top = `${clamp(relativePosition.top, 0, maxTop)}px`;
|
|
4736
|
-
rootNode.style.visibility = "visible";
|
|
4737
|
-
}
|
|
4738
|
-
rootNode.style.left = "0px";
|
|
4739
|
-
rootNode.style.top = "0px";
|
|
4740
|
-
rootNode.style.visibility = "hidden";
|
|
4741
|
-
updatePosition();
|
|
4742
|
-
window.addEventListener("resize", updatePosition);
|
|
4743
|
-
window.addEventListener("scroll", updatePosition, true);
|
|
4744
|
-
return () => {
|
|
4745
|
-
window.removeEventListener("resize", updatePosition);
|
|
4746
|
-
window.removeEventListener("scroll", updatePosition, true);
|
|
4747
|
-
};
|
|
4748
|
-
}, [anchor, portalRoot, resolvedOpen]);
|
|
4749
|
-
function handleActivateItem(item, level) {
|
|
4750
|
-
if (item.disabled) {
|
|
4751
|
-
return;
|
|
4752
|
-
}
|
|
4753
|
-
if (hasVisibleChildren2(item)) {
|
|
4754
|
-
setActivePath(
|
|
4755
|
-
(currentPath) => currentPath[level] === item.id ? currentPath.slice(0, level) : [...currentPath.slice(0, level), item.id]
|
|
4756
|
-
);
|
|
4757
|
-
return;
|
|
4758
|
-
}
|
|
4759
|
-
item.onSelect?.();
|
|
4760
|
-
onItemSelect?.(item);
|
|
4761
|
-
setResolvedOpen(false);
|
|
4762
|
-
}
|
|
4763
|
-
function handleHoverItem(item, level) {
|
|
4764
|
-
if (item.disabled) {
|
|
4765
|
-
return;
|
|
4766
|
-
}
|
|
4767
|
-
setActivePath((currentPath) => [...currentPath.slice(0, level), item.id]);
|
|
4768
|
-
}
|
|
4769
|
-
if (!resolvedOpen || !anchor || !portalRoot || items.every((item) => item.hidden)) {
|
|
4770
|
-
return null;
|
|
4771
|
-
}
|
|
4772
|
-
return createPortal3(
|
|
4773
|
-
/* @__PURE__ */ jsx35(
|
|
4774
|
-
"div",
|
|
4775
|
-
{
|
|
4776
|
-
...props,
|
|
4777
|
-
className: ["nu-popup-menu", className].filter(Boolean).join(" "),
|
|
4778
|
-
onContextMenu: (event) => event.preventDefault(),
|
|
4779
|
-
ref: rootRef,
|
|
4780
|
-
style: {
|
|
4781
|
-
...getThemePortalStyle(
|
|
4782
|
-
anchor?.type === "element" ? anchor.element : null
|
|
4783
|
-
),
|
|
4784
|
-
...styleProp,
|
|
4785
|
-
left: 0,
|
|
4786
|
-
top: 0,
|
|
4787
|
-
visibility: "hidden"
|
|
4788
|
-
},
|
|
4789
|
-
children: /* @__PURE__ */ jsx35("div", { className: "nu-popup-menu__shell", children: /* @__PURE__ */ jsx35(
|
|
4790
|
-
MainMenuList,
|
|
5178
|
+
}
|
|
5179
|
+
),
|
|
5180
|
+
/* @__PURE__ */ jsx37(
|
|
5181
|
+
"span",
|
|
5182
|
+
{
|
|
5183
|
+
"aria-hidden": "true",
|
|
5184
|
+
className: cx("nu-combo-box__bracket", slotClassNames?.bracket),
|
|
5185
|
+
style: slotStyles?.bracket,
|
|
5186
|
+
children: "]"
|
|
5187
|
+
}
|
|
5188
|
+
)
|
|
5189
|
+
]
|
|
5190
|
+
}
|
|
5191
|
+
),
|
|
5192
|
+
/* @__PURE__ */ jsx37(
|
|
5193
|
+
ControlOpener,
|
|
5194
|
+
{
|
|
5195
|
+
"aria-label": open ? "Collapse list" : "Expand list",
|
|
5196
|
+
as: "button",
|
|
5197
|
+
className: cx(
|
|
5198
|
+
"nu-control-opener",
|
|
5199
|
+
"nu-combo-box__toggle",
|
|
5200
|
+
slotClassNames?.toggle
|
|
5201
|
+
),
|
|
5202
|
+
disabled,
|
|
5203
|
+
onClick: handleToggle,
|
|
5204
|
+
style: slotStyles?.toggle
|
|
5205
|
+
}
|
|
5206
|
+
)
|
|
5207
|
+
]
|
|
5208
|
+
}
|
|
5209
|
+
),
|
|
5210
|
+
hint ? /* @__PURE__ */ jsx37(
|
|
5211
|
+
"span",
|
|
4791
5212
|
{
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
onHoverItem: handleHoverItem,
|
|
4797
|
-
rootVariant: "popup",
|
|
4798
|
-
uncheckedShape
|
|
5213
|
+
className: cx("nu-combo-box__hint", slotClassNames?.hint),
|
|
5214
|
+
id: hintId,
|
|
5215
|
+
style: slotStyles?.hint,
|
|
5216
|
+
children: hint
|
|
4799
5217
|
}
|
|
4800
|
-
)
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
5218
|
+
) : null,
|
|
5219
|
+
open && popupRoot ? createPortal3(
|
|
5220
|
+
/* @__PURE__ */ jsx37(
|
|
5221
|
+
"div",
|
|
5222
|
+
{
|
|
5223
|
+
className: cx("nu-combo-box__popup", slotClassNames?.popup),
|
|
5224
|
+
id: `${fieldId}-popup`,
|
|
5225
|
+
ref: popupRef,
|
|
5226
|
+
style: mergeSlotStyle(
|
|
5227
|
+
themePortalStyle,
|
|
5228
|
+
slotStyles?.popup
|
|
5229
|
+
),
|
|
5230
|
+
children: /* @__PURE__ */ jsx37(
|
|
5231
|
+
"div",
|
|
5232
|
+
{
|
|
5233
|
+
className: cx("nu-combo-box__listbox", slotClassNames?.listbox),
|
|
5234
|
+
style: slotStyles?.listbox,
|
|
5235
|
+
children: /* @__PURE__ */ jsx37(
|
|
5236
|
+
ListBox,
|
|
5237
|
+
{
|
|
5238
|
+
data: filteredData,
|
|
5239
|
+
emptyText: "No matches",
|
|
5240
|
+
onItemSelect: (item, group) => {
|
|
5241
|
+
const nextOption = filteredOptions.find(
|
|
5242
|
+
(option) => option.item === item && option.group === group
|
|
5243
|
+
);
|
|
5244
|
+
if (!nextOption) {
|
|
5245
|
+
return;
|
|
5246
|
+
}
|
|
5247
|
+
commitValue(nextOption.value, item, group);
|
|
5248
|
+
},
|
|
5249
|
+
selectedId: selectedOption?.value,
|
|
5250
|
+
style: slotStyles?.listbox
|
|
5251
|
+
}
|
|
5252
|
+
)
|
|
5253
|
+
}
|
|
5254
|
+
)
|
|
5255
|
+
}
|
|
5256
|
+
),
|
|
5257
|
+
popupRoot
|
|
5258
|
+
) : null
|
|
5259
|
+
]
|
|
5260
|
+
}
|
|
4804
5261
|
);
|
|
4805
5262
|
}
|
|
4806
5263
|
|
|
4807
|
-
// src/components/PopupMenu/usePopupMenu.ts
|
|
4808
|
-
import { useState as useState15 } from "react";
|
|
4809
|
-
function usePopupMenu() {
|
|
4810
|
-
const [anchor, setAnchor] = useState15(null);
|
|
4811
|
-
const [open, setOpen] = useState15(false);
|
|
4812
|
-
function close() {
|
|
4813
|
-
setOpen(false);
|
|
4814
|
-
}
|
|
4815
|
-
function openAtPoint(x, y) {
|
|
4816
|
-
setAnchor({
|
|
4817
|
-
type: "point",
|
|
4818
|
-
x,
|
|
4819
|
-
y
|
|
4820
|
-
});
|
|
4821
|
-
setOpen(true);
|
|
4822
|
-
}
|
|
4823
|
-
function openAtElement(element) {
|
|
4824
|
-
setAnchor({
|
|
4825
|
-
element,
|
|
4826
|
-
type: "element"
|
|
4827
|
-
});
|
|
4828
|
-
setOpen(true);
|
|
4829
|
-
}
|
|
4830
|
-
function openFromClick(event) {
|
|
4831
|
-
openAtElement(event.currentTarget);
|
|
4832
|
-
}
|
|
4833
|
-
function openFromContextMenu(event) {
|
|
4834
|
-
event.preventDefault();
|
|
4835
|
-
openAtPoint(event.clientX, event.clientY);
|
|
4836
|
-
}
|
|
4837
|
-
return {
|
|
4838
|
-
anchor,
|
|
4839
|
-
close,
|
|
4840
|
-
open,
|
|
4841
|
-
openAtElement,
|
|
4842
|
-
openAtPoint,
|
|
4843
|
-
openFromClick,
|
|
4844
|
-
openFromContextMenu,
|
|
4845
|
-
setOpen
|
|
4846
|
-
};
|
|
4847
|
-
}
|
|
4848
|
-
|
|
4849
5264
|
// src/components/CommandButton/CommandButton.tsx
|
|
4850
|
-
import {
|
|
5265
|
+
import {
|
|
5266
|
+
Fragment as Fragment6
|
|
5267
|
+
} from "react";
|
|
5268
|
+
import { jsx as jsx38, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4851
5269
|
var COMMAND_BUTTON_GLYPH_NAMES = /* @__PURE__ */ new Set([
|
|
4852
5270
|
"check-fill",
|
|
4853
5271
|
"check-mark",
|
|
@@ -4888,7 +5306,7 @@ function CommandButton({
|
|
|
4888
5306
|
const hasMenu = menuItems.length > 0;
|
|
4889
5307
|
const showCaret = dropdown || hasMenu;
|
|
4890
5308
|
const resolvedToggled = toggled ?? pressed;
|
|
4891
|
-
const resolvedIcon = typeof icon === "string" && isCommandButtonGlyphName(icon) ? /* @__PURE__ */
|
|
5309
|
+
const resolvedIcon = typeof icon === "string" && isCommandButtonGlyphName(icon) ? /* @__PURE__ */ jsx38(NuGlyph, { name: icon }) : icon ?? null;
|
|
4892
5310
|
function handleClick(event) {
|
|
4893
5311
|
onClick?.(event);
|
|
4894
5312
|
if (event.defaultPrevented || !hasMenu) {
|
|
@@ -4896,8 +5314,8 @@ function CommandButton({
|
|
|
4896
5314
|
}
|
|
4897
5315
|
popupMenu.openFromClick(event);
|
|
4898
5316
|
}
|
|
4899
|
-
return /* @__PURE__ */
|
|
4900
|
-
/* @__PURE__ */
|
|
5317
|
+
return /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
5318
|
+
/* @__PURE__ */ jsxs22(
|
|
4901
5319
|
"button",
|
|
4902
5320
|
{
|
|
4903
5321
|
...props,
|
|
@@ -4913,7 +5331,7 @@ function CommandButton({
|
|
|
4913
5331
|
type,
|
|
4914
5332
|
onClick: handleClick,
|
|
4915
5333
|
children: [
|
|
4916
|
-
resolvedIcon ? /* @__PURE__ */
|
|
5334
|
+
resolvedIcon ? /* @__PURE__ */ jsx38(
|
|
4917
5335
|
"span",
|
|
4918
5336
|
{
|
|
4919
5337
|
className: cx(
|
|
@@ -4925,7 +5343,7 @@ function CommandButton({
|
|
|
4925
5343
|
children: resolvedIcon
|
|
4926
5344
|
}
|
|
4927
5345
|
) : null,
|
|
4928
|
-
children ? /* @__PURE__ */
|
|
5346
|
+
children ? /* @__PURE__ */ jsx38(
|
|
4929
5347
|
"span",
|
|
4930
5348
|
{
|
|
4931
5349
|
className: cx(
|
|
@@ -4937,7 +5355,7 @@ function CommandButton({
|
|
|
4937
5355
|
children: renderMnemonicNode(children)
|
|
4938
5356
|
}
|
|
4939
5357
|
) : null,
|
|
4940
|
-
showCaret ? /* @__PURE__ */
|
|
5358
|
+
showCaret ? /* @__PURE__ */ jsx38(
|
|
4941
5359
|
"span",
|
|
4942
5360
|
{
|
|
4943
5361
|
className: cx(
|
|
@@ -4946,13 +5364,13 @@ function CommandButton({
|
|
|
4946
5364
|
slotClassNames?.caret
|
|
4947
5365
|
),
|
|
4948
5366
|
style: slotStyles?.caret,
|
|
4949
|
-
children: /* @__PURE__ */
|
|
5367
|
+
children: /* @__PURE__ */ jsx38(NuGlyph, { name: "dropdown-arrow" })
|
|
4950
5368
|
}
|
|
4951
5369
|
) : null
|
|
4952
5370
|
]
|
|
4953
5371
|
}
|
|
4954
5372
|
),
|
|
4955
|
-
hasMenu ? /* @__PURE__ */
|
|
5373
|
+
hasMenu ? /* @__PURE__ */ jsx38(
|
|
4956
5374
|
PopupMenu,
|
|
4957
5375
|
{
|
|
4958
5376
|
anchor: popupMenu.anchor,
|
|
@@ -4967,8 +5385,8 @@ function CommandButton({
|
|
|
4967
5385
|
}
|
|
4968
5386
|
|
|
4969
5387
|
// src/components/CrtGlitch/CrtGlitch.tsx
|
|
4970
|
-
import { useEffect as useEffect9, useId as useId6, useRef as
|
|
4971
|
-
import { jsx as
|
|
5388
|
+
import { useEffect as useEffect9, useId as useId6, useRef as useRef12 } from "react";
|
|
5389
|
+
import { jsx as jsx39, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4972
5390
|
var DEFAULT_INTERVAL_MS = 3e3;
|
|
4973
5391
|
var DEFAULT_DURATION_MS = 2500;
|
|
4974
5392
|
var DEFAULT_TOP_LEVEL_RATIO = 1 / 3;
|
|
@@ -4994,12 +5412,12 @@ function NuCrtGlitch({
|
|
|
4994
5412
|
topLevelRatio = DEFAULT_TOP_LEVEL_RATIO
|
|
4995
5413
|
}) {
|
|
4996
5414
|
const filterId = useId6().replace(/:/g, "");
|
|
4997
|
-
const turbulenceRef =
|
|
4998
|
-
const warpRef =
|
|
4999
|
-
const rOffsetRef =
|
|
5000
|
-
const bOffsetRef =
|
|
5001
|
-
const rafRef =
|
|
5002
|
-
const targetElRef =
|
|
5415
|
+
const turbulenceRef = useRef12(null);
|
|
5416
|
+
const warpRef = useRef12(null);
|
|
5417
|
+
const rOffsetRef = useRef12(null);
|
|
5418
|
+
const bOffsetRef = useRef12(null);
|
|
5419
|
+
const rafRef = useRef12(null);
|
|
5420
|
+
const targetElRef = useRef12(null);
|
|
5003
5421
|
useEffect9(() => {
|
|
5004
5422
|
if (!enabled) {
|
|
5005
5423
|
return;
|
|
@@ -5102,7 +5520,7 @@ function NuCrtGlitch({
|
|
|
5102
5520
|
}
|
|
5103
5521
|
};
|
|
5104
5522
|
}, [durationMs, enabled, filterId, intervalMs, targetSelector, topLevelRatio]);
|
|
5105
|
-
return /* @__PURE__ */
|
|
5523
|
+
return /* @__PURE__ */ jsx39("svg", { "aria-hidden": "true", height: "0", style: { position: "absolute" }, width: "0", children: /* @__PURE__ */ jsx39("defs", { children: /* @__PURE__ */ jsxs23(
|
|
5106
5524
|
"filter",
|
|
5107
5525
|
{
|
|
5108
5526
|
"color-interpolation-filters": "sRGB",
|
|
@@ -5112,7 +5530,7 @@ function NuCrtGlitch({
|
|
|
5112
5530
|
x: "-15%",
|
|
5113
5531
|
y: "-5%",
|
|
5114
5532
|
children: [
|
|
5115
|
-
/* @__PURE__ */
|
|
5533
|
+
/* @__PURE__ */ jsx39(
|
|
5116
5534
|
"feTurbulence",
|
|
5117
5535
|
{
|
|
5118
5536
|
baseFrequency: "0.001 0.045",
|
|
@@ -5123,7 +5541,7 @@ function NuCrtGlitch({
|
|
|
5123
5541
|
type: "turbulence"
|
|
5124
5542
|
}
|
|
5125
5543
|
),
|
|
5126
|
-
/* @__PURE__ */
|
|
5544
|
+
/* @__PURE__ */ jsx39(
|
|
5127
5545
|
"feDisplacementMap",
|
|
5128
5546
|
{
|
|
5129
5547
|
in: "SourceGraphic",
|
|
@@ -5135,8 +5553,8 @@ function NuCrtGlitch({
|
|
|
5135
5553
|
yChannelSelector: "A"
|
|
5136
5554
|
}
|
|
5137
5555
|
),
|
|
5138
|
-
/* @__PURE__ */
|
|
5139
|
-
/* @__PURE__ */
|
|
5556
|
+
/* @__PURE__ */ jsx39("feOffset", { dx: 0, dy: 0, in: "warped", ref: rOffsetRef, result: "rOff" }),
|
|
5557
|
+
/* @__PURE__ */ jsx39(
|
|
5140
5558
|
"feColorMatrix",
|
|
5141
5559
|
{
|
|
5142
5560
|
in: "rOff",
|
|
@@ -5145,7 +5563,7 @@ function NuCrtGlitch({
|
|
|
5145
5563
|
values: "1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0"
|
|
5146
5564
|
}
|
|
5147
5565
|
),
|
|
5148
|
-
/* @__PURE__ */
|
|
5566
|
+
/* @__PURE__ */ jsx39(
|
|
5149
5567
|
"feColorMatrix",
|
|
5150
5568
|
{
|
|
5151
5569
|
in: "warped",
|
|
@@ -5154,8 +5572,8 @@ function NuCrtGlitch({
|
|
|
5154
5572
|
values: "0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0"
|
|
5155
5573
|
}
|
|
5156
5574
|
),
|
|
5157
|
-
/* @__PURE__ */
|
|
5158
|
-
/* @__PURE__ */
|
|
5575
|
+
/* @__PURE__ */ jsx39("feOffset", { dx: 0, dy: 0, in: "warped", ref: bOffsetRef, result: "bOff" }),
|
|
5576
|
+
/* @__PURE__ */ jsx39(
|
|
5159
5577
|
"feColorMatrix",
|
|
5160
5578
|
{
|
|
5161
5579
|
in: "bOff",
|
|
@@ -5164,8 +5582,8 @@ function NuCrtGlitch({
|
|
|
5164
5582
|
values: "0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0"
|
|
5165
5583
|
}
|
|
5166
5584
|
),
|
|
5167
|
-
/* @__PURE__ */
|
|
5168
|
-
/* @__PURE__ */
|
|
5585
|
+
/* @__PURE__ */ jsx39("feBlend", { in: "rOnly", in2: "gOnly", mode: "screen", result: "rg" }),
|
|
5586
|
+
/* @__PURE__ */ jsx39("feBlend", { in: "rg", in2: "bOnly", mode: "screen" })
|
|
5169
5587
|
]
|
|
5170
5588
|
}
|
|
5171
5589
|
) }) });
|
|
@@ -5174,12 +5592,12 @@ function NuCrtGlitch({
|
|
|
5174
5592
|
// src/components/ListView/ListView.tsx
|
|
5175
5593
|
import {
|
|
5176
5594
|
forwardRef as forwardRef2,
|
|
5177
|
-
useCallback as
|
|
5595
|
+
useCallback as useCallback6,
|
|
5178
5596
|
useEffect as useEffect10,
|
|
5179
5597
|
useImperativeHandle as useImperativeHandle2,
|
|
5180
|
-
useMemo as
|
|
5181
|
-
useRef as
|
|
5182
|
-
useState as
|
|
5598
|
+
useMemo as useMemo11,
|
|
5599
|
+
useRef as useRef13,
|
|
5600
|
+
useState as useState18
|
|
5183
5601
|
} from "react";
|
|
5184
5602
|
|
|
5185
5603
|
// src/components/ListView/internals/helpers.ts
|
|
@@ -5217,14 +5635,14 @@ function renderListViewCellValue(row, column) {
|
|
|
5217
5635
|
import { memo as memo3 } from "react";
|
|
5218
5636
|
|
|
5219
5637
|
// src/components/ListView/internals/ListViewCheckControl.tsx
|
|
5220
|
-
import { jsx as
|
|
5638
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
5221
5639
|
function ListViewCheckControl({
|
|
5222
5640
|
isChecked,
|
|
5223
5641
|
onActivate,
|
|
5224
5642
|
onToggleCheck,
|
|
5225
5643
|
uncheckedShape
|
|
5226
5644
|
}) {
|
|
5227
|
-
return /* @__PURE__ */
|
|
5645
|
+
return /* @__PURE__ */ jsx40(
|
|
5228
5646
|
"button",
|
|
5229
5647
|
{
|
|
5230
5648
|
"aria-label": isChecked ? "Uncheck row" : "Check row",
|
|
@@ -5237,13 +5655,13 @@ function ListViewCheckControl({
|
|
|
5237
5655
|
onToggleCheck();
|
|
5238
5656
|
},
|
|
5239
5657
|
type: "button",
|
|
5240
|
-
children: /* @__PURE__ */
|
|
5658
|
+
children: /* @__PURE__ */ jsx40(
|
|
5241
5659
|
"span",
|
|
5242
5660
|
{
|
|
5243
5661
|
"aria-hidden": "true",
|
|
5244
5662
|
className: "nu-list-view__check-box",
|
|
5245
5663
|
"data-unchecked-shape": uncheckedShape,
|
|
5246
|
-
children: isChecked ? /* @__PURE__ */
|
|
5664
|
+
children: isChecked ? /* @__PURE__ */ jsx40(
|
|
5247
5665
|
NuGlyph,
|
|
5248
5666
|
{
|
|
5249
5667
|
className: "nu-list-view__check-indicator",
|
|
@@ -5257,7 +5675,7 @@ function ListViewCheckControl({
|
|
|
5257
5675
|
}
|
|
5258
5676
|
|
|
5259
5677
|
// src/components/ListView/internals/ListViewRow.tsx
|
|
5260
|
-
import { jsx as
|
|
5678
|
+
import { jsx as jsx41, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5261
5679
|
function ListViewRowInner({
|
|
5262
5680
|
columns,
|
|
5263
5681
|
isActive,
|
|
@@ -5288,7 +5706,7 @@ function ListViewRowInner({
|
|
|
5288
5706
|
function handleToggleCheck() {
|
|
5289
5707
|
onToggleCheck(rowId);
|
|
5290
5708
|
}
|
|
5291
|
-
return /* @__PURE__ */
|
|
5709
|
+
return /* @__PURE__ */ jsxs24(
|
|
5292
5710
|
"div",
|
|
5293
5711
|
{
|
|
5294
5712
|
"aria-disabled": row.disabled || void 0,
|
|
@@ -5309,7 +5727,7 @@ function ListViewRowInner({
|
|
|
5309
5727
|
"--nu-list-view-columns": templateColumns
|
|
5310
5728
|
},
|
|
5311
5729
|
children: [
|
|
5312
|
-
showCheckBox ? /* @__PURE__ */
|
|
5730
|
+
showCheckBox ? /* @__PURE__ */ jsx41("span", { className: "nu-list-view__check-cell", role: "gridcell", children: /* @__PURE__ */ jsx41(
|
|
5313
5731
|
ListViewCheckControl,
|
|
5314
5732
|
{
|
|
5315
5733
|
isChecked,
|
|
@@ -5318,7 +5736,7 @@ function ListViewRowInner({
|
|
|
5318
5736
|
uncheckedShape
|
|
5319
5737
|
}
|
|
5320
5738
|
) }) : null,
|
|
5321
|
-
columns.map((column) => /* @__PURE__ */
|
|
5739
|
+
columns.map((column) => /* @__PURE__ */ jsx41(
|
|
5322
5740
|
"span",
|
|
5323
5741
|
{
|
|
5324
5742
|
className: [
|
|
@@ -5338,7 +5756,7 @@ function ListViewRowInner({
|
|
|
5338
5756
|
var ListViewRow = memo3(ListViewRowInner);
|
|
5339
5757
|
|
|
5340
5758
|
// src/components/ListView/ListView.tsx
|
|
5341
|
-
import { jsx as
|
|
5759
|
+
import { jsx as jsx42, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5342
5760
|
function ListViewInner({
|
|
5343
5761
|
activeRowId: activeRowIdProp,
|
|
5344
5762
|
checkedIds,
|
|
@@ -5356,19 +5774,19 @@ function ListViewInner({
|
|
|
5356
5774
|
uncheckedShape = "box",
|
|
5357
5775
|
...props
|
|
5358
5776
|
}, ref) {
|
|
5359
|
-
const rootRef =
|
|
5360
|
-
const rowRefs =
|
|
5361
|
-
const selectableRows =
|
|
5777
|
+
const rootRef = useRef13(null);
|
|
5778
|
+
const rowRefs = useRef13({});
|
|
5779
|
+
const selectableRows = useMemo11(
|
|
5362
5780
|
() => data.filter((row) => !row.disabled),
|
|
5363
5781
|
[data]
|
|
5364
5782
|
);
|
|
5365
5783
|
const isActiveControlled = activeRowIdProp !== void 0;
|
|
5366
|
-
const [uncontrolledActiveRowId, setUncontrolledActiveRowId] =
|
|
5784
|
+
const [uncontrolledActiveRowId, setUncontrolledActiveRowId] = useState18(
|
|
5367
5785
|
() => defaultActiveRowId ?? getInitialActiveRowId(selectableRows, selectedId)
|
|
5368
5786
|
);
|
|
5369
5787
|
const activeRowId = activeRowIdProp !== void 0 ? activeRowIdProp : uncontrolledActiveRowId;
|
|
5370
5788
|
const resolvedActiveRowId = activeRowId && selectableRows.some((row) => row.id === activeRowId) ? activeRowId : getInitialActiveRowId(selectableRows, selectedId);
|
|
5371
|
-
const templateColumns =
|
|
5789
|
+
const templateColumns = useMemo11(() => {
|
|
5372
5790
|
const checkboxColumn = showCheckBox ? "var(--nu-glyph-cell-size)" : null;
|
|
5373
5791
|
const dataColumns = columns.map(
|
|
5374
5792
|
(column) => column.width ?? "minmax(0, 1fr)"
|
|
@@ -5383,13 +5801,13 @@ function ListViewInner({
|
|
|
5383
5801
|
block: "nearest"
|
|
5384
5802
|
});
|
|
5385
5803
|
}, [resolvedActiveRowId]);
|
|
5386
|
-
const registerRowRef =
|
|
5804
|
+
const registerRowRef = useCallback6(
|
|
5387
5805
|
(rowId, node) => {
|
|
5388
5806
|
rowRefs.current[rowId] = node;
|
|
5389
5807
|
},
|
|
5390
5808
|
[]
|
|
5391
5809
|
);
|
|
5392
|
-
const updateActiveRow =
|
|
5810
|
+
const updateActiveRow = useCallback6(
|
|
5393
5811
|
(row) => {
|
|
5394
5812
|
if (!isActiveControlled) {
|
|
5395
5813
|
setUncontrolledActiveRowId(row.id);
|
|
@@ -5398,7 +5816,7 @@ function ListViewInner({
|
|
|
5398
5816
|
},
|
|
5399
5817
|
[isActiveControlled, onActiveRowChange]
|
|
5400
5818
|
);
|
|
5401
|
-
const activateRowId =
|
|
5819
|
+
const activateRowId = useCallback6(
|
|
5402
5820
|
(rowId) => {
|
|
5403
5821
|
if (!rowId) {
|
|
5404
5822
|
return;
|
|
@@ -5437,7 +5855,7 @@ function ListViewInner({
|
|
|
5437
5855
|
function isRowChecked(row) {
|
|
5438
5856
|
return getListViewRowChecked(row, checkedIds);
|
|
5439
5857
|
}
|
|
5440
|
-
const toggleRowCheck =
|
|
5858
|
+
const toggleRowCheck = useCallback6(
|
|
5441
5859
|
(rowId) => {
|
|
5442
5860
|
if (!showCheckBox) {
|
|
5443
5861
|
return;
|
|
@@ -5506,7 +5924,7 @@ function ListViewInner({
|
|
|
5506
5924
|
break;
|
|
5507
5925
|
}
|
|
5508
5926
|
}
|
|
5509
|
-
return /* @__PURE__ */
|
|
5927
|
+
return /* @__PURE__ */ jsxs25(
|
|
5510
5928
|
"div",
|
|
5511
5929
|
{
|
|
5512
5930
|
...props,
|
|
@@ -5517,7 +5935,7 @@ function ListViewInner({
|
|
|
5517
5935
|
role: "grid",
|
|
5518
5936
|
tabIndex: 0,
|
|
5519
5937
|
children: [
|
|
5520
|
-
/* @__PURE__ */
|
|
5938
|
+
/* @__PURE__ */ jsxs25(
|
|
5521
5939
|
"div",
|
|
5522
5940
|
{
|
|
5523
5941
|
className: "nu-list-view__header",
|
|
@@ -5526,8 +5944,8 @@ function ListViewInner({
|
|
|
5526
5944
|
"--nu-list-view-columns": templateColumns
|
|
5527
5945
|
},
|
|
5528
5946
|
children: [
|
|
5529
|
-
showCheckBox ? /* @__PURE__ */
|
|
5530
|
-
columns.map((column) => /* @__PURE__ */
|
|
5947
|
+
showCheckBox ? /* @__PURE__ */ jsx42("span", { className: "nu-list-view__header-cell", role: "columnheader" }) : null,
|
|
5948
|
+
columns.map((column) => /* @__PURE__ */ jsx42(
|
|
5531
5949
|
"span",
|
|
5532
5950
|
{
|
|
5533
5951
|
className: [
|
|
@@ -5543,7 +5961,7 @@ function ListViewInner({
|
|
|
5543
5961
|
]
|
|
5544
5962
|
}
|
|
5545
5963
|
),
|
|
5546
|
-
/* @__PURE__ */
|
|
5964
|
+
/* @__PURE__ */ jsx42("div", { className: "nu-list-view__body", children: data.length > 0 ? data.map((row) => /* @__PURE__ */ jsx42(
|
|
5547
5965
|
ListViewRow,
|
|
5548
5966
|
{
|
|
5549
5967
|
columns,
|
|
@@ -5560,7 +5978,7 @@ function ListViewInner({
|
|
|
5560
5978
|
uncheckedShape
|
|
5561
5979
|
},
|
|
5562
5980
|
row.id
|
|
5563
|
-
)) : /* @__PURE__ */
|
|
5981
|
+
)) : /* @__PURE__ */ jsx42("div", { className: "nu-list-view__empty", children: emptyText }) })
|
|
5564
5982
|
]
|
|
5565
5983
|
}
|
|
5566
5984
|
);
|
|
@@ -5571,9 +5989,9 @@ var ListView = forwardRef2(ListViewInner);
|
|
|
5571
5989
|
import {
|
|
5572
5990
|
useEffect as useEffect11,
|
|
5573
5991
|
useId as useId7,
|
|
5574
|
-
useMemo as
|
|
5575
|
-
useRef as
|
|
5576
|
-
useState as
|
|
5992
|
+
useMemo as useMemo12,
|
|
5993
|
+
useRef as useRef14,
|
|
5994
|
+
useState as useState19
|
|
5577
5995
|
} from "react";
|
|
5578
5996
|
|
|
5579
5997
|
// src/components/MaskedField/textMask.ts
|
|
@@ -5738,7 +6156,7 @@ function getMaskedFieldState(mask, rawValue) {
|
|
|
5738
6156
|
}
|
|
5739
6157
|
|
|
5740
6158
|
// src/components/MaskedField/MaskedField.tsx
|
|
5741
|
-
import { jsx as
|
|
6159
|
+
import { jsx as jsx43, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5742
6160
|
function MaskedField({
|
|
5743
6161
|
"aria-invalid": ariaInvalid,
|
|
5744
6162
|
className,
|
|
@@ -5761,8 +6179,8 @@ function MaskedField({
|
|
|
5761
6179
|
const fieldId = id ?? generatedId;
|
|
5762
6180
|
const hintId = hint ? `${fieldId}-hint` : void 0;
|
|
5763
6181
|
const isControlled = value !== void 0;
|
|
5764
|
-
const hasMountedRef =
|
|
5765
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
6182
|
+
const hasMountedRef = useRef14(false);
|
|
6183
|
+
const [uncontrolledValue, setUncontrolledValue] = useState19(
|
|
5766
6184
|
() => defaultValue == null ? "" : getMaskedFieldState(mask, String(defaultValue)).formattedValue
|
|
5767
6185
|
);
|
|
5768
6186
|
const rawResolvedValue = isControlled ? value == null ? "" : String(value) : uncontrolledValue;
|
|
@@ -5771,7 +6189,7 @@ function MaskedField({
|
|
|
5771
6189
|
rawResolvedValue
|
|
5772
6190
|
);
|
|
5773
6191
|
const resolvedAriaInvalid = ariaInvalid ?? (isInvalid ? true : void 0);
|
|
5774
|
-
const maskInputMode =
|
|
6192
|
+
const maskInputMode = useMemo12(
|
|
5775
6193
|
() => props.inputMode === void 0 ? getTextMaskInputMode(mask) : void 0,
|
|
5776
6194
|
[mask, props.inputMode]
|
|
5777
6195
|
);
|
|
@@ -5810,7 +6228,7 @@ function MaskedField({
|
|
|
5810
6228
|
}
|
|
5811
6229
|
onChange?.(event);
|
|
5812
6230
|
}
|
|
5813
|
-
return /* @__PURE__ */
|
|
6231
|
+
return /* @__PURE__ */ jsxs26(
|
|
5814
6232
|
"label",
|
|
5815
6233
|
{
|
|
5816
6234
|
className: cx(
|
|
@@ -5822,7 +6240,7 @@ function MaskedField({
|
|
|
5822
6240
|
htmlFor: fieldId,
|
|
5823
6241
|
style: mergeSlotStyle(style, slotStyles?.root),
|
|
5824
6242
|
children: [
|
|
5825
|
-
/* @__PURE__ */
|
|
6243
|
+
/* @__PURE__ */ jsx43(
|
|
5826
6244
|
"span",
|
|
5827
6245
|
{
|
|
5828
6246
|
className: cx("nu-masked-field__label", slotClassNames?.label),
|
|
@@ -5830,13 +6248,13 @@ function MaskedField({
|
|
|
5830
6248
|
children: renderMnemonicText(label)
|
|
5831
6249
|
}
|
|
5832
6250
|
),
|
|
5833
|
-
/* @__PURE__ */
|
|
6251
|
+
/* @__PURE__ */ jsxs26(
|
|
5834
6252
|
"span",
|
|
5835
6253
|
{
|
|
5836
6254
|
className: cx("nu-masked-field__slot", slotClassNames?.slot),
|
|
5837
6255
|
style: slotStyles?.slot,
|
|
5838
6256
|
children: [
|
|
5839
|
-
/* @__PURE__ */
|
|
6257
|
+
/* @__PURE__ */ jsx43(
|
|
5840
6258
|
"span",
|
|
5841
6259
|
{
|
|
5842
6260
|
"aria-hidden": "true",
|
|
@@ -5845,7 +6263,7 @@ function MaskedField({
|
|
|
5845
6263
|
children: "["
|
|
5846
6264
|
}
|
|
5847
6265
|
),
|
|
5848
|
-
/* @__PURE__ */
|
|
6266
|
+
/* @__PURE__ */ jsx43(
|
|
5849
6267
|
"span",
|
|
5850
6268
|
{
|
|
5851
6269
|
className: cx(
|
|
@@ -5853,7 +6271,7 @@ function MaskedField({
|
|
|
5853
6271
|
slotClassNames?.inputShell
|
|
5854
6272
|
),
|
|
5855
6273
|
style: slotStyles?.inputShell,
|
|
5856
|
-
children: /* @__PURE__ */
|
|
6274
|
+
children: /* @__PURE__ */ jsx43(
|
|
5857
6275
|
"input",
|
|
5858
6276
|
{
|
|
5859
6277
|
...props,
|
|
@@ -5871,7 +6289,7 @@ function MaskedField({
|
|
|
5871
6289
|
)
|
|
5872
6290
|
}
|
|
5873
6291
|
),
|
|
5874
|
-
/* @__PURE__ */
|
|
6292
|
+
/* @__PURE__ */ jsx43(
|
|
5875
6293
|
"span",
|
|
5876
6294
|
{
|
|
5877
6295
|
"aria-hidden": "true",
|
|
@@ -5883,7 +6301,7 @@ function MaskedField({
|
|
|
5883
6301
|
]
|
|
5884
6302
|
}
|
|
5885
6303
|
),
|
|
5886
|
-
hint ? /* @__PURE__ */
|
|
6304
|
+
hint ? /* @__PURE__ */ jsx43(
|
|
5887
6305
|
"span",
|
|
5888
6306
|
{
|
|
5889
6307
|
className: cx("nu-masked-field__hint", slotClassNames?.hint),
|
|
@@ -5899,9 +6317,9 @@ function MaskedField({
|
|
|
5899
6317
|
|
|
5900
6318
|
// src/components/Memo/Memo.tsx
|
|
5901
6319
|
import {
|
|
5902
|
-
useState as
|
|
6320
|
+
useState as useState20
|
|
5903
6321
|
} from "react";
|
|
5904
|
-
import { jsx as
|
|
6322
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
5905
6323
|
function Memo({
|
|
5906
6324
|
background,
|
|
5907
6325
|
className,
|
|
@@ -5921,7 +6339,7 @@ function Memo({
|
|
|
5921
6339
|
const isControlled = value !== void 0;
|
|
5922
6340
|
const resolvedInitialValue = defaultValue == null ? content ?? "" : String(defaultValue);
|
|
5923
6341
|
const resolvedValue = value == null ? "" : Array.isArray(value) ? value.join("\n") : String(value);
|
|
5924
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
6342
|
+
const [uncontrolledValue, setUncontrolledValue] = useState20(
|
|
5925
6343
|
() => resolvedInitialValue
|
|
5926
6344
|
);
|
|
5927
6345
|
function handleChange(event) {
|
|
@@ -5931,7 +6349,7 @@ function Memo({
|
|
|
5931
6349
|
onValueChange?.(event.target.value);
|
|
5932
6350
|
onChange?.(event);
|
|
5933
6351
|
}
|
|
5934
|
-
return /* @__PURE__ */
|
|
6352
|
+
return /* @__PURE__ */ jsx44(
|
|
5935
6353
|
"div",
|
|
5936
6354
|
{
|
|
5937
6355
|
className: ["nu-memo", className].filter(Boolean).join(" "),
|
|
@@ -5944,7 +6362,7 @@ function Memo({
|
|
|
5944
6362
|
"--nu-memo-focus-text": focusTextColor,
|
|
5945
6363
|
"--nu-memo-text": textColor
|
|
5946
6364
|
},
|
|
5947
|
-
children: /* @__PURE__ */
|
|
6365
|
+
children: /* @__PURE__ */ jsx44("div", { className: "nu-memo__viewport", children: /* @__PURE__ */ jsx44(
|
|
5948
6366
|
"textarea",
|
|
5949
6367
|
{
|
|
5950
6368
|
...props,
|
|
@@ -5960,11 +6378,11 @@ function Memo({
|
|
|
5960
6378
|
// src/components/PageControl/PageControl.tsx
|
|
5961
6379
|
import {
|
|
5962
6380
|
useId as useId8,
|
|
5963
|
-
useMemo as
|
|
5964
|
-
useRef as
|
|
5965
|
-
useState as
|
|
6381
|
+
useMemo as useMemo13,
|
|
6382
|
+
useRef as useRef15,
|
|
6383
|
+
useState as useState21
|
|
5966
6384
|
} from "react";
|
|
5967
|
-
import { jsx as
|
|
6385
|
+
import { jsx as jsx45, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
5968
6386
|
function PageControl({
|
|
5969
6387
|
activePageId: activePageIdProp,
|
|
5970
6388
|
className,
|
|
@@ -5978,12 +6396,12 @@ function PageControl({
|
|
|
5978
6396
|
}) {
|
|
5979
6397
|
const generatedId = useId8();
|
|
5980
6398
|
const isControlled = activePageIdProp !== void 0;
|
|
5981
|
-
const tabRefs =
|
|
5982
|
-
const [uncontrolledActivePageId, setUncontrolledActivePageId] =
|
|
6399
|
+
const tabRefs = useRef15({});
|
|
6400
|
+
const [uncontrolledActivePageId, setUncontrolledActivePageId] = useState21(
|
|
5983
6401
|
() => defaultActivePageId ?? pages.find((page) => !page.disabled)?.id ?? pages[0]?.id
|
|
5984
6402
|
);
|
|
5985
6403
|
const activePageId = isControlled ? activePageIdProp : uncontrolledActivePageId;
|
|
5986
|
-
const resolvedActivePage =
|
|
6404
|
+
const resolvedActivePage = useMemo13(() => {
|
|
5987
6405
|
const byId = pages.find(
|
|
5988
6406
|
(page) => page.id === activePageId && !page.disabled
|
|
5989
6407
|
);
|
|
@@ -6049,7 +6467,7 @@ function PageControl({
|
|
|
6049
6467
|
break;
|
|
6050
6468
|
}
|
|
6051
6469
|
}
|
|
6052
|
-
return /* @__PURE__ */
|
|
6470
|
+
return /* @__PURE__ */ jsxs27(
|
|
6053
6471
|
"div",
|
|
6054
6472
|
{
|
|
6055
6473
|
...props,
|
|
@@ -6060,7 +6478,7 @@ function PageControl({
|
|
|
6060
6478
|
slotStyles?.root
|
|
6061
6479
|
),
|
|
6062
6480
|
children: [
|
|
6063
|
-
/* @__PURE__ */
|
|
6481
|
+
/* @__PURE__ */ jsx45(
|
|
6064
6482
|
"div",
|
|
6065
6483
|
{
|
|
6066
6484
|
className: cx("nu-page-control__tabs", slotClassNames?.tabs),
|
|
@@ -6071,7 +6489,7 @@ function PageControl({
|
|
|
6071
6489
|
const isActive = page.id === resolvedActivePage?.id;
|
|
6072
6490
|
const panelId = `${generatedId}-panel-${page.id}`;
|
|
6073
6491
|
const tabId = `${generatedId}-tab-${page.id}`;
|
|
6074
|
-
return /* @__PURE__ */
|
|
6492
|
+
return /* @__PURE__ */ jsx45(
|
|
6075
6493
|
"button",
|
|
6076
6494
|
{
|
|
6077
6495
|
"aria-controls": panelId,
|
|
@@ -6095,7 +6513,7 @@ function PageControl({
|
|
|
6095
6513
|
})
|
|
6096
6514
|
}
|
|
6097
6515
|
),
|
|
6098
|
-
/* @__PURE__ */
|
|
6516
|
+
/* @__PURE__ */ jsx45(
|
|
6099
6517
|
"div",
|
|
6100
6518
|
{
|
|
6101
6519
|
"aria-labelledby": resolvedActivePage ? `${generatedId}-tab-${resolvedActivePage.id}` : void 0,
|
|
@@ -6112,7 +6530,7 @@ function PageControl({
|
|
|
6112
6530
|
}
|
|
6113
6531
|
|
|
6114
6532
|
// src/components/Panel/Panel.tsx
|
|
6115
|
-
import { jsx as
|
|
6533
|
+
import { jsx as jsx46, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6116
6534
|
function Panel({
|
|
6117
6535
|
children,
|
|
6118
6536
|
className,
|
|
@@ -6123,14 +6541,14 @@ function Panel({
|
|
|
6123
6541
|
title,
|
|
6124
6542
|
...props
|
|
6125
6543
|
}) {
|
|
6126
|
-
return /* @__PURE__ */
|
|
6544
|
+
return /* @__PURE__ */ jsxs28(
|
|
6127
6545
|
"section",
|
|
6128
6546
|
{
|
|
6129
6547
|
...props,
|
|
6130
6548
|
className: cx("nu-panel", slotClassNames?.root, className),
|
|
6131
6549
|
style: mergeSlotStyle(props.style, slotStyles?.root),
|
|
6132
6550
|
children: [
|
|
6133
|
-
title ? /* @__PURE__ */
|
|
6551
|
+
title ? /* @__PURE__ */ jsx46(
|
|
6134
6552
|
"header",
|
|
6135
6553
|
{
|
|
6136
6554
|
className: cx("nu-panel__header", slotClassNames?.header),
|
|
@@ -6138,7 +6556,7 @@ function Panel({
|
|
|
6138
6556
|
children: renderMnemonicText(title)
|
|
6139
6557
|
}
|
|
6140
6558
|
) : null,
|
|
6141
|
-
/* @__PURE__ */
|
|
6559
|
+
/* @__PURE__ */ jsx46(
|
|
6142
6560
|
"div",
|
|
6143
6561
|
{
|
|
6144
6562
|
className: cx(
|
|
@@ -6150,7 +6568,7 @@ function Panel({
|
|
|
6150
6568
|
children
|
|
6151
6569
|
}
|
|
6152
6570
|
),
|
|
6153
|
-
footer ? /* @__PURE__ */
|
|
6571
|
+
footer ? /* @__PURE__ */ jsx46(
|
|
6154
6572
|
"footer",
|
|
6155
6573
|
{
|
|
6156
6574
|
className: cx("nu-panel__footer", slotClassNames?.footer),
|
|
@@ -6166,11 +6584,11 @@ function Panel({
|
|
|
6166
6584
|
// src/components/PropertyGrid/PropertyGrid.tsx
|
|
6167
6585
|
import {
|
|
6168
6586
|
useId as useId9,
|
|
6169
|
-
useMemo as
|
|
6170
|
-
useRef as
|
|
6171
|
-
useState as
|
|
6587
|
+
useMemo as useMemo14,
|
|
6588
|
+
useRef as useRef16,
|
|
6589
|
+
useState as useState22
|
|
6172
6590
|
} from "react";
|
|
6173
|
-
import { jsx as
|
|
6591
|
+
import { jsx as jsx47, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6174
6592
|
function collectGroupIds(entries) {
|
|
6175
6593
|
const groupIds = /* @__PURE__ */ new Set();
|
|
6176
6594
|
function visit(nextEntries) {
|
|
@@ -6278,24 +6696,24 @@ function PropertyGrid({
|
|
|
6278
6696
|
...props
|
|
6279
6697
|
}) {
|
|
6280
6698
|
const editorIdPrefix = useId9();
|
|
6281
|
-
const rowButtonRefs =
|
|
6282
|
-
const groupIds =
|
|
6699
|
+
const rowButtonRefs = useRef16({});
|
|
6700
|
+
const groupIds = useMemo14(() => collectGroupIds(entries), [entries]);
|
|
6283
6701
|
const isExpandedControlled = expandedIdsProp !== void 0;
|
|
6284
6702
|
const isActiveControlled = activeIdProp !== void 0;
|
|
6285
|
-
const [uncontrolledExpandedIds, setUncontrolledExpandedIds] =
|
|
6703
|
+
const [uncontrolledExpandedIds, setUncontrolledExpandedIds] = useState22(() => getInitialExpandedIds(entries, defaultExpandedIds));
|
|
6286
6704
|
const resolvedExpandedIds = expandedIdsProp ?? uncontrolledExpandedIds;
|
|
6287
|
-
const expandedIdSet =
|
|
6705
|
+
const expandedIdSet = useMemo14(
|
|
6288
6706
|
() => new Set(
|
|
6289
6707
|
resolvedExpandedIds.filter((expandedId) => groupIds.has(expandedId))
|
|
6290
6708
|
),
|
|
6291
6709
|
[groupIds, resolvedExpandedIds]
|
|
6292
6710
|
);
|
|
6293
|
-
const rows =
|
|
6711
|
+
const rows = useMemo14(
|
|
6294
6712
|
() => collectVisibleRows(entries, expandedIdSet),
|
|
6295
6713
|
[entries, expandedIdSet]
|
|
6296
6714
|
);
|
|
6297
|
-
const interactiveRows =
|
|
6298
|
-
const [uncontrolledActiveId, setUncontrolledActiveId] =
|
|
6715
|
+
const interactiveRows = useMemo14(() => collectInteractiveRows(rows), [rows]);
|
|
6716
|
+
const [uncontrolledActiveId, setUncontrolledActiveId] = useState22(() => getInitialActiveId2(interactiveRows, defaultActiveId));
|
|
6299
6717
|
const requestedActiveId = isActiveControlled ? activeIdProp : uncontrolledActiveId;
|
|
6300
6718
|
const resolvedActiveId = requestedActiveId && interactiveRows.some((row) => row.id === requestedActiveId) ? requestedActiveId : interactiveRows[0]?.id;
|
|
6301
6719
|
function updateExpandedIds(nextExpandedIds) {
|
|
@@ -6414,7 +6832,7 @@ function PropertyGrid({
|
|
|
6414
6832
|
const nextExpandedIds = expandedIdSet.has(entry.id) ? resolvedExpandedIds.filter((expandedId) => expandedId !== entry.id) : [...resolvedExpandedIds, entry.id];
|
|
6415
6833
|
updateExpandedIds(nextExpandedIds);
|
|
6416
6834
|
}
|
|
6417
|
-
return /* @__PURE__ */
|
|
6835
|
+
return /* @__PURE__ */ jsx47(
|
|
6418
6836
|
"div",
|
|
6419
6837
|
{
|
|
6420
6838
|
...props,
|
|
@@ -6425,13 +6843,13 @@ function PropertyGrid({
|
|
|
6425
6843
|
...style,
|
|
6426
6844
|
"--nu-property-grid-label-width": labelWidth
|
|
6427
6845
|
},
|
|
6428
|
-
children: /* @__PURE__ */
|
|
6846
|
+
children: /* @__PURE__ */ jsx47("div", { className: "nu-property-grid__body", children: rows.map((row) => {
|
|
6429
6847
|
if (row.type === "section") {
|
|
6430
|
-
return /* @__PURE__ */
|
|
6848
|
+
return /* @__PURE__ */ jsx47("div", { className: "nu-property-grid__section", children: renderMnemonicText(row.entry.title) }, row.entry.id);
|
|
6431
6849
|
}
|
|
6432
6850
|
if (row.type === "group") {
|
|
6433
6851
|
const isExpanded = expandedIdSet.has(row.entry.id);
|
|
6434
|
-
return /* @__PURE__ */
|
|
6852
|
+
return /* @__PURE__ */ jsxs29(
|
|
6435
6853
|
"div",
|
|
6436
6854
|
{
|
|
6437
6855
|
className: "nu-property-grid__row",
|
|
@@ -6440,7 +6858,7 @@ function PropertyGrid({
|
|
|
6440
6858
|
"data-expanded": isExpanded || void 0,
|
|
6441
6859
|
"data-group": true,
|
|
6442
6860
|
children: [
|
|
6443
|
-
/* @__PURE__ */
|
|
6861
|
+
/* @__PURE__ */ jsx47(
|
|
6444
6862
|
"button",
|
|
6445
6863
|
{
|
|
6446
6864
|
className: "nu-property-grid__label nu-property-grid__label-button",
|
|
@@ -6460,32 +6878,32 @@ function PropertyGrid({
|
|
|
6460
6878
|
"--nu-property-grid-depth": row.depth
|
|
6461
6879
|
},
|
|
6462
6880
|
type: "button",
|
|
6463
|
-
children: /* @__PURE__ */
|
|
6464
|
-
/* @__PURE__ */
|
|
6881
|
+
children: /* @__PURE__ */ jsxs29("span", { className: "nu-property-grid__lead", children: [
|
|
6882
|
+
/* @__PURE__ */ jsx47("span", { className: "nu-property-grid__expander", children: /* @__PURE__ */ jsx47(
|
|
6465
6883
|
NuGlyph,
|
|
6466
6884
|
{
|
|
6467
6885
|
name: isExpanded ? "tree-caret-down" : "tree-caret-right"
|
|
6468
6886
|
}
|
|
6469
6887
|
) }),
|
|
6470
|
-
/* @__PURE__ */
|
|
6888
|
+
/* @__PURE__ */ jsx47("span", { className: "nu-property-grid__label-text", children: renderMnemonicText(row.entry.label) })
|
|
6471
6889
|
] })
|
|
6472
6890
|
}
|
|
6473
6891
|
),
|
|
6474
|
-
/* @__PURE__ */
|
|
6892
|
+
/* @__PURE__ */ jsx47("div", { className: "nu-property-grid__editor", children: row.entry.summary ? /* @__PURE__ */ jsx47("div", { className: "nu-property-grid__control", children: row.entry.summary }) : null })
|
|
6475
6893
|
]
|
|
6476
6894
|
},
|
|
6477
6895
|
row.entry.id
|
|
6478
6896
|
);
|
|
6479
6897
|
}
|
|
6480
6898
|
const editorId = `${editorIdPrefix}-editor-${row.entry.id}`;
|
|
6481
|
-
return /* @__PURE__ */
|
|
6899
|
+
return /* @__PURE__ */ jsxs29(
|
|
6482
6900
|
"div",
|
|
6483
6901
|
{
|
|
6484
6902
|
className: "nu-property-grid__row",
|
|
6485
6903
|
"data-active": resolvedActiveId === row.entry.id || void 0,
|
|
6486
6904
|
"data-disabled": row.entry.disabled || void 0,
|
|
6487
6905
|
children: [
|
|
6488
|
-
/* @__PURE__ */
|
|
6906
|
+
/* @__PURE__ */ jsx47(
|
|
6489
6907
|
"button",
|
|
6490
6908
|
{
|
|
6491
6909
|
className: "nu-property-grid__label nu-property-grid__label-button",
|
|
@@ -6505,21 +6923,21 @@ function PropertyGrid({
|
|
|
6505
6923
|
"--nu-property-grid-depth": row.depth
|
|
6506
6924
|
},
|
|
6507
6925
|
type: "button",
|
|
6508
|
-
children: /* @__PURE__ */
|
|
6509
|
-
/* @__PURE__ */
|
|
6510
|
-
/* @__PURE__ */
|
|
6926
|
+
children: /* @__PURE__ */ jsxs29("span", { className: "nu-property-grid__lead", children: [
|
|
6927
|
+
/* @__PURE__ */ jsx47("span", { className: "nu-property-grid__expander-placeholder" }),
|
|
6928
|
+
/* @__PURE__ */ jsx47("span", { className: "nu-property-grid__label-text", children: renderMnemonicText(row.entry.label) })
|
|
6511
6929
|
] })
|
|
6512
6930
|
}
|
|
6513
6931
|
),
|
|
6514
|
-
/* @__PURE__ */
|
|
6932
|
+
/* @__PURE__ */ jsxs29(
|
|
6515
6933
|
"div",
|
|
6516
6934
|
{
|
|
6517
6935
|
className: "nu-property-grid__editor",
|
|
6518
6936
|
id: editorId,
|
|
6519
6937
|
onFocusCapture: () => updateActiveId(row.entry.id),
|
|
6520
6938
|
children: [
|
|
6521
|
-
/* @__PURE__ */
|
|
6522
|
-
row.entry.hint ? /* @__PURE__ */
|
|
6939
|
+
/* @__PURE__ */ jsx47("div", { className: "nu-property-grid__control", children: row.entry.content }),
|
|
6940
|
+
row.entry.hint ? /* @__PURE__ */ jsx47("div", { className: "nu-property-grid__hint", children: row.entry.hint }) : null
|
|
6523
6941
|
]
|
|
6524
6942
|
}
|
|
6525
6943
|
)
|
|
@@ -6533,8 +6951,8 @@ function PropertyGrid({
|
|
|
6533
6951
|
}
|
|
6534
6952
|
|
|
6535
6953
|
// src/components/ProgressBar/ProgressBar.tsx
|
|
6536
|
-
import { jsx as
|
|
6537
|
-
function
|
|
6954
|
+
import { jsx as jsx48, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
6955
|
+
function clamp3(value, min, max) {
|
|
6538
6956
|
return Math.min(max, Math.max(min, value));
|
|
6539
6957
|
}
|
|
6540
6958
|
function ProgressBar({
|
|
@@ -6554,10 +6972,10 @@ function ProgressBar({
|
|
|
6554
6972
|
...props
|
|
6555
6973
|
}) {
|
|
6556
6974
|
const safeMax = max <= min ? min + 1 : max;
|
|
6557
|
-
const clampedValue =
|
|
6975
|
+
const clampedValue = clamp3(value, min, safeMax);
|
|
6558
6976
|
const percent = Math.round((clampedValue - min) / (safeMax - min) * 100);
|
|
6559
6977
|
const renderedValue = valueRenderer ? valueRenderer(percent, clampedValue, min, safeMax) : `${percent}%`;
|
|
6560
|
-
return /* @__PURE__ */
|
|
6978
|
+
return /* @__PURE__ */ jsxs30(
|
|
6561
6979
|
"div",
|
|
6562
6980
|
{
|
|
6563
6981
|
...props,
|
|
@@ -6569,7 +6987,7 @@ function ProgressBar({
|
|
|
6569
6987
|
role: "progressbar",
|
|
6570
6988
|
style: mergeSlotStyle(style, slotStyles?.root),
|
|
6571
6989
|
children: [
|
|
6572
|
-
label ? /* @__PURE__ */
|
|
6990
|
+
label ? /* @__PURE__ */ jsx48(
|
|
6573
6991
|
"span",
|
|
6574
6992
|
{
|
|
6575
6993
|
className: cx("nu-progress-bar__label", slotClassNames?.label),
|
|
@@ -6577,7 +6995,7 @@ function ProgressBar({
|
|
|
6577
6995
|
children: renderMnemonicText(label)
|
|
6578
6996
|
}
|
|
6579
6997
|
) : null,
|
|
6580
|
-
/* @__PURE__ */
|
|
6998
|
+
/* @__PURE__ */ jsxs30(
|
|
6581
6999
|
"div",
|
|
6582
7000
|
{
|
|
6583
7001
|
className: cx("nu-progress-bar__track", slotClassNames?.track),
|
|
@@ -6588,7 +7006,7 @@ function ProgressBar({
|
|
|
6588
7006
|
slotStyles?.track
|
|
6589
7007
|
),
|
|
6590
7008
|
children: [
|
|
6591
|
-
/* @__PURE__ */
|
|
7009
|
+
/* @__PURE__ */ jsx48(
|
|
6592
7010
|
"div",
|
|
6593
7011
|
{
|
|
6594
7012
|
className: cx("nu-progress-bar__fill", slotClassNames?.fill),
|
|
@@ -6601,7 +7019,7 @@ function ProgressBar({
|
|
|
6601
7019
|
)
|
|
6602
7020
|
}
|
|
6603
7021
|
),
|
|
6604
|
-
showValue ? /* @__PURE__ */
|
|
7022
|
+
showValue ? /* @__PURE__ */ jsx48(
|
|
6605
7023
|
"span",
|
|
6606
7024
|
{
|
|
6607
7025
|
className: cx("nu-progress-bar__value", slotClassNames?.value),
|
|
@@ -6612,7 +7030,7 @@ function ProgressBar({
|
|
|
6612
7030
|
]
|
|
6613
7031
|
}
|
|
6614
7032
|
),
|
|
6615
|
-
hint ? /* @__PURE__ */
|
|
7033
|
+
hint ? /* @__PURE__ */ jsx48(
|
|
6616
7034
|
"span",
|
|
6617
7035
|
{
|
|
6618
7036
|
className: cx("nu-progress-bar__hint", slotClassNames?.hint),
|
|
@@ -6626,8 +7044,8 @@ function ProgressBar({
|
|
|
6626
7044
|
}
|
|
6627
7045
|
|
|
6628
7046
|
// src/components/RadioGroup/RadioButton.tsx
|
|
6629
|
-
import { useId as useId10, useState as
|
|
6630
|
-
import { jsx as
|
|
7047
|
+
import { useId as useId10, useState as useState23 } from "react";
|
|
7048
|
+
import { jsx as jsx49, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
6631
7049
|
function RadioButton({
|
|
6632
7050
|
checked,
|
|
6633
7051
|
className,
|
|
@@ -6643,7 +7061,7 @@ function RadioButton({
|
|
|
6643
7061
|
const inputId = id ?? generatedId;
|
|
6644
7062
|
const hintId = hint ? `${inputId}-hint` : void 0;
|
|
6645
7063
|
const isControlled = checked !== void 0;
|
|
6646
|
-
const [uncontrolledChecked, setUncontrolledChecked] =
|
|
7064
|
+
const [uncontrolledChecked, setUncontrolledChecked] = useState23(defaultChecked);
|
|
6647
7065
|
const resolvedChecked = isControlled ? checked : uncontrolledChecked;
|
|
6648
7066
|
function handleChange(event) {
|
|
6649
7067
|
if (!isControlled) {
|
|
@@ -6651,9 +7069,9 @@ function RadioButton({
|
|
|
6651
7069
|
}
|
|
6652
7070
|
onCheckedChange?.(event.target.checked, event);
|
|
6653
7071
|
}
|
|
6654
|
-
return /* @__PURE__ */
|
|
6655
|
-
/* @__PURE__ */
|
|
6656
|
-
/* @__PURE__ */
|
|
7072
|
+
return /* @__PURE__ */ jsxs31("label", { className: ["nu-radio-button", className].filter(Boolean).join(" "), children: [
|
|
7073
|
+
/* @__PURE__ */ jsxs31("span", { className: "nu-radio-button__main", children: [
|
|
7074
|
+
/* @__PURE__ */ jsx49(
|
|
6657
7075
|
"input",
|
|
6658
7076
|
{
|
|
6659
7077
|
...props,
|
|
@@ -6666,19 +7084,19 @@ function RadioButton({
|
|
|
6666
7084
|
type: "radio"
|
|
6667
7085
|
}
|
|
6668
7086
|
),
|
|
6669
|
-
/* @__PURE__ */
|
|
6670
|
-
/* @__PURE__ */
|
|
6671
|
-
resolvedChecked ? /* @__PURE__ */
|
|
7087
|
+
/* @__PURE__ */ jsx49("span", { "aria-hidden": "true", className: "nu-radio-button__control", children: /* @__PURE__ */ jsxs31("span", { className: "nu-radio-button__disc", children: [
|
|
7088
|
+
/* @__PURE__ */ jsx49(NuGlyph, { className: "nu-radio-button__ring", name: "radio-ring" }),
|
|
7089
|
+
resolvedChecked ? /* @__PURE__ */ jsx49(NuGlyph, { className: "nu-radio-button__fill", name: "radio-fill" }) : null
|
|
6672
7090
|
] }) }),
|
|
6673
|
-
/* @__PURE__ */
|
|
7091
|
+
/* @__PURE__ */ jsx49("span", { className: "nu-radio-button__label", children: renderMnemonicText(label) })
|
|
6674
7092
|
] }),
|
|
6675
|
-
hint ? /* @__PURE__ */
|
|
7093
|
+
hint ? /* @__PURE__ */ jsx49("span", { className: "nu-radio-button__hint", id: hintId, children: hint }) : null
|
|
6676
7094
|
] });
|
|
6677
7095
|
}
|
|
6678
7096
|
|
|
6679
7097
|
// src/components/RadioGroup/RadioGroup.tsx
|
|
6680
|
-
import { useId as useId11, useState as
|
|
6681
|
-
import { jsx as
|
|
7098
|
+
import { useId as useId11, useState as useState24 } from "react";
|
|
7099
|
+
import { jsx as jsx50, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
6682
7100
|
function RadioGroup({
|
|
6683
7101
|
className,
|
|
6684
7102
|
defaultValue,
|
|
@@ -6697,7 +7115,7 @@ function RadioGroup({
|
|
|
6697
7115
|
const groupName = name ?? generatedId;
|
|
6698
7116
|
const hintId = hint ? `${groupName}-hint` : void 0;
|
|
6699
7117
|
const isControlled = value !== void 0;
|
|
6700
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
7118
|
+
const [uncontrolledValue, setUncontrolledValue] = useState24(defaultValue ?? options[0]?.value);
|
|
6701
7119
|
const resolvedValue = isControlled ? value : uncontrolledValue;
|
|
6702
7120
|
function commitValue(nextValue) {
|
|
6703
7121
|
if (!isControlled) {
|
|
@@ -6705,7 +7123,7 @@ function RadioGroup({
|
|
|
6705
7123
|
}
|
|
6706
7124
|
onValueChange?.(nextValue);
|
|
6707
7125
|
}
|
|
6708
|
-
return /* @__PURE__ */
|
|
7126
|
+
return /* @__PURE__ */ jsxs32(
|
|
6709
7127
|
"fieldset",
|
|
6710
7128
|
{
|
|
6711
7129
|
...props,
|
|
@@ -6713,7 +7131,7 @@ function RadioGroup({
|
|
|
6713
7131
|
className: cx("nu-radio-group", slotClassNames?.root, className),
|
|
6714
7132
|
style: mergeSlotStyle(style, slotStyles?.root),
|
|
6715
7133
|
children: [
|
|
6716
|
-
label ? /* @__PURE__ */
|
|
7134
|
+
label ? /* @__PURE__ */ jsx50(
|
|
6717
7135
|
"legend",
|
|
6718
7136
|
{
|
|
6719
7137
|
className: cx("nu-radio-group__label", slotClassNames?.label),
|
|
@@ -6721,12 +7139,12 @@ function RadioGroup({
|
|
|
6721
7139
|
children: renderMnemonicText(label)
|
|
6722
7140
|
}
|
|
6723
7141
|
) : null,
|
|
6724
|
-
/* @__PURE__ */
|
|
7142
|
+
/* @__PURE__ */ jsx50(
|
|
6725
7143
|
"div",
|
|
6726
7144
|
{
|
|
6727
7145
|
className: cx("nu-radio-group__options", slotClassNames?.options),
|
|
6728
7146
|
style: slotStyles?.options,
|
|
6729
|
-
children: options.map((option) => /* @__PURE__ */
|
|
7147
|
+
children: options.map((option) => /* @__PURE__ */ jsx50(
|
|
6730
7148
|
RadioButton,
|
|
6731
7149
|
{
|
|
6732
7150
|
checked: resolvedValue === option.value,
|
|
@@ -6745,7 +7163,7 @@ function RadioGroup({
|
|
|
6745
7163
|
))
|
|
6746
7164
|
}
|
|
6747
7165
|
),
|
|
6748
|
-
hint ? /* @__PURE__ */
|
|
7166
|
+
hint ? /* @__PURE__ */ jsx50(
|
|
6749
7167
|
"span",
|
|
6750
7168
|
{
|
|
6751
7169
|
className: cx("nu-radio-group__hint", slotClassNames?.hint),
|
|
@@ -6760,14 +7178,14 @@ function RadioGroup({
|
|
|
6760
7178
|
}
|
|
6761
7179
|
|
|
6762
7180
|
// src/components/ReportCell/ReportCell.tsx
|
|
6763
|
-
import { jsx as
|
|
7181
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
6764
7182
|
function ReportCell({
|
|
6765
7183
|
align = "start",
|
|
6766
7184
|
className,
|
|
6767
7185
|
tone = "default",
|
|
6768
7186
|
...props
|
|
6769
7187
|
}) {
|
|
6770
|
-
return /* @__PURE__ */
|
|
7188
|
+
return /* @__PURE__ */ jsx51(
|
|
6771
7189
|
"span",
|
|
6772
7190
|
{
|
|
6773
7191
|
...props,
|
|
@@ -6785,12 +7203,12 @@ function ReportCell({
|
|
|
6785
7203
|
import {
|
|
6786
7204
|
useEffect as useEffect12,
|
|
6787
7205
|
useId as useId12,
|
|
6788
|
-
useMemo as
|
|
6789
|
-
useRef as
|
|
6790
|
-
useState as
|
|
7206
|
+
useMemo as useMemo15,
|
|
7207
|
+
useRef as useRef17,
|
|
7208
|
+
useState as useState25
|
|
6791
7209
|
} from "react";
|
|
6792
7210
|
import { createPortal as createPortal4 } from "react-dom";
|
|
6793
|
-
import { jsx as
|
|
7211
|
+
import { jsx as jsx52, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
6794
7212
|
function resolveSearchBoxPortalRoot() {
|
|
6795
7213
|
return document.body;
|
|
6796
7214
|
}
|
|
@@ -6818,24 +7236,24 @@ function SearchBox({
|
|
|
6818
7236
|
style,
|
|
6819
7237
|
...props
|
|
6820
7238
|
}) {
|
|
6821
|
-
const rootRef =
|
|
6822
|
-
const fieldRef =
|
|
6823
|
-
const inputRef =
|
|
6824
|
-
const popupRef =
|
|
6825
|
-
const requestIdRef =
|
|
7239
|
+
const rootRef = useRef17(null);
|
|
7240
|
+
const fieldRef = useRef17(null);
|
|
7241
|
+
const inputRef = useRef17(null);
|
|
7242
|
+
const popupRef = useRef17(null);
|
|
7243
|
+
const requestIdRef = useRef17(0);
|
|
6826
7244
|
const generatedId = useId12();
|
|
6827
7245
|
const fieldId = `${generatedId}-search-box`;
|
|
6828
7246
|
const labelId = `${fieldId}-label`;
|
|
6829
7247
|
const hintId = hint ? `${fieldId}-hint` : void 0;
|
|
6830
7248
|
const isQueryControlled = queryProp !== void 0;
|
|
6831
|
-
const [uncontrolledQuery, setUncontrolledQuery] =
|
|
6832
|
-
const [open, setOpen] =
|
|
6833
|
-
const [status, setStatus] =
|
|
6834
|
-
const [results, setResults] =
|
|
6835
|
-
const [selectedValue, setSelectedValue] =
|
|
7249
|
+
const [uncontrolledQuery, setUncontrolledQuery] = useState25(defaultQuery);
|
|
7250
|
+
const [open, setOpen] = useState25(false);
|
|
7251
|
+
const [status, setStatus] = useState25("idle");
|
|
7252
|
+
const [results, setResults] = useState25([]);
|
|
7253
|
+
const [selectedValue, setSelectedValue] = useState25(null);
|
|
6836
7254
|
const normalizedQuery = (isQueryControlled ? queryProp : uncontrolledQuery) ?? "";
|
|
6837
7255
|
const trimmedQuery = normalizedQuery.trim();
|
|
6838
|
-
const resultOptions =
|
|
7256
|
+
const resultOptions = useMemo15(() => {
|
|
6839
7257
|
return results.map((item, index) => ({
|
|
6840
7258
|
item,
|
|
6841
7259
|
listBoxItem: {
|
|
@@ -6849,7 +7267,7 @@ function SearchBox({
|
|
|
6849
7267
|
value: getItemId(item, index)
|
|
6850
7268
|
}));
|
|
6851
7269
|
}, [getItemDetails, getItemDisabled, getItemId, getItemText, results]);
|
|
6852
|
-
const listBoxData =
|
|
7270
|
+
const listBoxData = useMemo15(
|
|
6853
7271
|
() => [
|
|
6854
7272
|
{
|
|
6855
7273
|
category: null,
|
|
@@ -6859,7 +7277,7 @@ function SearchBox({
|
|
|
6859
7277
|
[resultOptions]
|
|
6860
7278
|
);
|
|
6861
7279
|
const popupRoot = typeof document === "undefined" ? null : resolveSearchBoxPortalRoot();
|
|
6862
|
-
const [themePortalStyle, setThemePortalStyle] =
|
|
7280
|
+
const [themePortalStyle, setThemePortalStyle] = useState25(() => void 0);
|
|
6863
7281
|
useEffect12(() => {
|
|
6864
7282
|
if (disabled) {
|
|
6865
7283
|
return;
|
|
@@ -6940,15 +7358,15 @@ function SearchBox({
|
|
|
6940
7358
|
}
|
|
6941
7359
|
function renderPopupContent() {
|
|
6942
7360
|
if (status === "loading") {
|
|
6943
|
-
return /* @__PURE__ */
|
|
7361
|
+
return /* @__PURE__ */ jsx52("div", { className: "nu-search-box__status", children: loadingText });
|
|
6944
7362
|
}
|
|
6945
7363
|
if (status === "error") {
|
|
6946
|
-
return /* @__PURE__ */
|
|
7364
|
+
return /* @__PURE__ */ jsx52("div", { className: "nu-search-box__status", children: errorText });
|
|
6947
7365
|
}
|
|
6948
7366
|
if (trimmedQuery.length < minQueryLength) {
|
|
6949
|
-
return /* @__PURE__ */
|
|
7367
|
+
return /* @__PURE__ */ jsx52("div", { className: "nu-search-box__status", children: idleText });
|
|
6950
7368
|
}
|
|
6951
|
-
return /* @__PURE__ */
|
|
7369
|
+
return /* @__PURE__ */ jsx52("div", { className: "nu-search-box__listbox", children: /* @__PURE__ */ jsx52(
|
|
6952
7370
|
ListBox,
|
|
6953
7371
|
{
|
|
6954
7372
|
data: listBoxData,
|
|
@@ -6985,7 +7403,7 @@ function SearchBox({
|
|
|
6985
7403
|
break;
|
|
6986
7404
|
}
|
|
6987
7405
|
}
|
|
6988
|
-
return /* @__PURE__ */
|
|
7406
|
+
return /* @__PURE__ */ jsxs33(
|
|
6989
7407
|
"div",
|
|
6990
7408
|
{
|
|
6991
7409
|
...props,
|
|
@@ -6993,10 +7411,10 @@ function SearchBox({
|
|
|
6993
7411
|
ref: rootRef,
|
|
6994
7412
|
style,
|
|
6995
7413
|
children: [
|
|
6996
|
-
/* @__PURE__ */
|
|
6997
|
-
/* @__PURE__ */
|
|
6998
|
-
/* @__PURE__ */
|
|
6999
|
-
/* @__PURE__ */
|
|
7414
|
+
/* @__PURE__ */ jsx52("label", { className: "nu-search-box__label", htmlFor: fieldId, id: labelId, children: renderMnemonicText(label) }),
|
|
7415
|
+
/* @__PURE__ */ jsxs33("span", { className: "nu-search-box__slot", ref: fieldRef, children: [
|
|
7416
|
+
/* @__PURE__ */ jsx52("span", { "aria-hidden": "true", className: "nu-search-box__bracket", children: "[" }),
|
|
7417
|
+
/* @__PURE__ */ jsx52("span", { className: "nu-search-box__input-shell", children: /* @__PURE__ */ jsx52(
|
|
7000
7418
|
"input",
|
|
7001
7419
|
{
|
|
7002
7420
|
"aria-autocomplete": "list",
|
|
@@ -7021,11 +7439,11 @@ function SearchBox({
|
|
|
7021
7439
|
value: normalizedQuery
|
|
7022
7440
|
}
|
|
7023
7441
|
) }),
|
|
7024
|
-
/* @__PURE__ */
|
|
7442
|
+
/* @__PURE__ */ jsx52("span", { "aria-hidden": "true", className: "nu-search-box__bracket", children: "]" })
|
|
7025
7443
|
] }),
|
|
7026
|
-
hint ? /* @__PURE__ */
|
|
7444
|
+
hint ? /* @__PURE__ */ jsx52("span", { className: "nu-search-box__hint", id: hintId, children: hint }) : null,
|
|
7027
7445
|
open && popupRoot ? createPortal4(
|
|
7028
|
-
/* @__PURE__ */
|
|
7446
|
+
/* @__PURE__ */ jsx52(
|
|
7029
7447
|
"div",
|
|
7030
7448
|
{
|
|
7031
7449
|
className: "nu-search-box__popup",
|
|
@@ -7045,10 +7463,10 @@ function SearchBox({
|
|
|
7045
7463
|
// src/components/SpinBox/SpinBox.tsx
|
|
7046
7464
|
import {
|
|
7047
7465
|
useId as useId13,
|
|
7048
|
-
useMemo as
|
|
7049
|
-
useState as
|
|
7466
|
+
useMemo as useMemo16,
|
|
7467
|
+
useState as useState26
|
|
7050
7468
|
} from "react";
|
|
7051
|
-
import { jsx as
|
|
7469
|
+
import { jsx as jsx53, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
7052
7470
|
function clampSpinValue(value, min, max) {
|
|
7053
7471
|
let nextValue = value;
|
|
7054
7472
|
if (min !== void 0) {
|
|
@@ -7098,9 +7516,9 @@ function SpinBox({
|
|
|
7098
7516
|
min,
|
|
7099
7517
|
max
|
|
7100
7518
|
);
|
|
7101
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
7519
|
+
const [uncontrolledValue, setUncontrolledValue] = useState26(initialNumericValue);
|
|
7102
7520
|
const numericValue = isControlled ? clampSpinValue(value ?? initialNumericValue, min, max) : uncontrolledValue;
|
|
7103
|
-
const [uncontrolledDraftValue, setUncontrolledDraftValue] =
|
|
7521
|
+
const [uncontrolledDraftValue, setUncontrolledDraftValue] = useState26(
|
|
7104
7522
|
() => formatSpinValue(initialNumericValue)
|
|
7105
7523
|
);
|
|
7106
7524
|
const draftValue = isControlled ? formatSpinValue(numericValue) : uncontrolledDraftValue;
|
|
@@ -7153,22 +7571,22 @@ function SpinBox({
|
|
|
7153
7571
|
}
|
|
7154
7572
|
onKeyDown?.(event);
|
|
7155
7573
|
}
|
|
7156
|
-
const decrementDisabled =
|
|
7574
|
+
const decrementDisabled = useMemo16(
|
|
7157
7575
|
() => disabled || min !== void 0 && numericValue <= min,
|
|
7158
7576
|
[disabled, min, numericValue]
|
|
7159
7577
|
);
|
|
7160
|
-
const incrementDisabled =
|
|
7578
|
+
const incrementDisabled = useMemo16(
|
|
7161
7579
|
() => disabled || max !== void 0 && numericValue >= max,
|
|
7162
7580
|
[disabled, max, numericValue]
|
|
7163
7581
|
);
|
|
7164
|
-
return /* @__PURE__ */
|
|
7582
|
+
return /* @__PURE__ */ jsxs34(
|
|
7165
7583
|
"label",
|
|
7166
7584
|
{
|
|
7167
7585
|
className: cx("nu-spin-box", slotClassNames?.root, className),
|
|
7168
7586
|
htmlFor: fieldId,
|
|
7169
7587
|
style: mergeSlotStyle(style, slotStyles?.root),
|
|
7170
7588
|
children: [
|
|
7171
|
-
/* @__PURE__ */
|
|
7589
|
+
/* @__PURE__ */ jsx53(
|
|
7172
7590
|
"span",
|
|
7173
7591
|
{
|
|
7174
7592
|
className: cx("nu-spin-box__label", slotClassNames?.label),
|
|
@@ -7176,13 +7594,13 @@ function SpinBox({
|
|
|
7176
7594
|
children: renderMnemonicText(label)
|
|
7177
7595
|
}
|
|
7178
7596
|
),
|
|
7179
|
-
/* @__PURE__ */
|
|
7597
|
+
/* @__PURE__ */ jsxs34(
|
|
7180
7598
|
"span",
|
|
7181
7599
|
{
|
|
7182
7600
|
className: cx("nu-spin-box__slot", slotClassNames?.slot),
|
|
7183
7601
|
style: slotStyles?.slot,
|
|
7184
7602
|
children: [
|
|
7185
|
-
/* @__PURE__ */
|
|
7603
|
+
/* @__PURE__ */ jsx53(
|
|
7186
7604
|
"span",
|
|
7187
7605
|
{
|
|
7188
7606
|
"aria-hidden": "true",
|
|
@@ -7191,12 +7609,12 @@ function SpinBox({
|
|
|
7191
7609
|
children: "["
|
|
7192
7610
|
}
|
|
7193
7611
|
),
|
|
7194
|
-
/* @__PURE__ */
|
|
7612
|
+
/* @__PURE__ */ jsx53(
|
|
7195
7613
|
"span",
|
|
7196
7614
|
{
|
|
7197
7615
|
className: cx("nu-spin-box__input-shell", slotClassNames?.inputShell),
|
|
7198
7616
|
style: slotStyles?.inputShell,
|
|
7199
|
-
children: /* @__PURE__ */
|
|
7617
|
+
children: /* @__PURE__ */ jsx53(
|
|
7200
7618
|
"input",
|
|
7201
7619
|
{
|
|
7202
7620
|
...props,
|
|
@@ -7215,7 +7633,7 @@ function SpinBox({
|
|
|
7215
7633
|
)
|
|
7216
7634
|
}
|
|
7217
7635
|
),
|
|
7218
|
-
/* @__PURE__ */
|
|
7636
|
+
/* @__PURE__ */ jsx53(
|
|
7219
7637
|
"span",
|
|
7220
7638
|
{
|
|
7221
7639
|
"aria-hidden": "true",
|
|
@@ -7224,13 +7642,13 @@ function SpinBox({
|
|
|
7224
7642
|
children: "]"
|
|
7225
7643
|
}
|
|
7226
7644
|
),
|
|
7227
|
-
/* @__PURE__ */
|
|
7645
|
+
/* @__PURE__ */ jsxs34(
|
|
7228
7646
|
"span",
|
|
7229
7647
|
{
|
|
7230
7648
|
className: cx("nu-spin-box__controls", slotClassNames?.controls),
|
|
7231
7649
|
style: slotStyles?.controls,
|
|
7232
7650
|
children: [
|
|
7233
|
-
/* @__PURE__ */
|
|
7651
|
+
/* @__PURE__ */ jsx53(
|
|
7234
7652
|
"button",
|
|
7235
7653
|
{
|
|
7236
7654
|
className: cx("nu-spin-box__button", slotClassNames?.button),
|
|
@@ -7241,7 +7659,7 @@ function SpinBox({
|
|
|
7241
7659
|
children: "-"
|
|
7242
7660
|
}
|
|
7243
7661
|
),
|
|
7244
|
-
/* @__PURE__ */
|
|
7662
|
+
/* @__PURE__ */ jsx53(
|
|
7245
7663
|
"button",
|
|
7246
7664
|
{
|
|
7247
7665
|
className: cx("nu-spin-box__button", slotClassNames?.button),
|
|
@@ -7258,7 +7676,7 @@ function SpinBox({
|
|
|
7258
7676
|
]
|
|
7259
7677
|
}
|
|
7260
7678
|
),
|
|
7261
|
-
hint ? /* @__PURE__ */
|
|
7679
|
+
hint ? /* @__PURE__ */ jsx53(
|
|
7262
7680
|
"span",
|
|
7263
7681
|
{
|
|
7264
7682
|
className: cx("nu-spin-box__hint", slotClassNames?.hint),
|
|
@@ -7276,11 +7694,11 @@ function SpinBox({
|
|
|
7276
7694
|
import {
|
|
7277
7695
|
useEffect as useEffect13,
|
|
7278
7696
|
useId as useId14,
|
|
7279
|
-
useRef as
|
|
7280
|
-
useState as
|
|
7697
|
+
useRef as useRef18,
|
|
7698
|
+
useState as useState27
|
|
7281
7699
|
} from "react";
|
|
7282
|
-
import { jsx as
|
|
7283
|
-
function
|
|
7700
|
+
import { jsx as jsx54, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
7701
|
+
function clamp4(value, min, max) {
|
|
7284
7702
|
return Math.min(max, Math.max(min, value));
|
|
7285
7703
|
}
|
|
7286
7704
|
function Splitter({
|
|
@@ -7310,13 +7728,13 @@ function Splitter({
|
|
|
7310
7728
|
const parsedValue = Number(rawValue);
|
|
7311
7729
|
return Number.isFinite(parsedValue) ? parsedValue : null;
|
|
7312
7730
|
};
|
|
7313
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
7314
|
-
|
|
7731
|
+
const [uncontrolledValue, setUncontrolledValue] = useState27(
|
|
7732
|
+
clamp4(getSavedValue() ?? defaultValue, min, max)
|
|
7315
7733
|
);
|
|
7316
|
-
const rootRef =
|
|
7317
|
-
const dragFrameRef =
|
|
7318
|
-
const dragValueRef =
|
|
7319
|
-
const activeValue =
|
|
7734
|
+
const rootRef = useRef18(null);
|
|
7735
|
+
const dragFrameRef = useRef18(null);
|
|
7736
|
+
const dragValueRef = useRef18(null);
|
|
7737
|
+
const activeValue = clamp4(
|
|
7320
7738
|
(isControlled ? value : uncontrolledValue) ?? defaultValue,
|
|
7321
7739
|
min,
|
|
7322
7740
|
max
|
|
@@ -7338,7 +7756,7 @@ function Splitter({
|
|
|
7338
7756
|
};
|
|
7339
7757
|
}, []);
|
|
7340
7758
|
function commitValue(nextValue) {
|
|
7341
|
-
const clampedValue =
|
|
7759
|
+
const clampedValue = clamp4(nextValue, min, max);
|
|
7342
7760
|
if (!isControlled) {
|
|
7343
7761
|
setUncontrolledValue(clampedValue);
|
|
7344
7762
|
}
|
|
@@ -7358,7 +7776,7 @@ function Splitter({
|
|
|
7358
7776
|
function computeValue(clientX, clientY) {
|
|
7359
7777
|
const bounds = rootElement.getBoundingClientRect();
|
|
7360
7778
|
const nextValue = orientation === "vertical" ? (clientX - bounds.left) / bounds.width : (clientY - bounds.top) / bounds.height;
|
|
7361
|
-
return
|
|
7779
|
+
return clamp4(nextValue, min, max);
|
|
7362
7780
|
}
|
|
7363
7781
|
function flushDragValue() {
|
|
7364
7782
|
dragFrameRef.current = null;
|
|
@@ -7434,7 +7852,7 @@ function Splitter({
|
|
|
7434
7852
|
commitValue(max);
|
|
7435
7853
|
}
|
|
7436
7854
|
}
|
|
7437
|
-
return /* @__PURE__ */
|
|
7855
|
+
return /* @__PURE__ */ jsxs35(
|
|
7438
7856
|
"div",
|
|
7439
7857
|
{
|
|
7440
7858
|
...props,
|
|
@@ -7446,8 +7864,8 @@ function Splitter({
|
|
|
7446
7864
|
"--nu-splitter-value": `${activeValue * 100}%`
|
|
7447
7865
|
},
|
|
7448
7866
|
children: [
|
|
7449
|
-
/* @__PURE__ */
|
|
7450
|
-
/* @__PURE__ */
|
|
7867
|
+
/* @__PURE__ */ jsx54("div", { className: "nu-splitter__pane", id: firstPaneId, children: first }),
|
|
7868
|
+
/* @__PURE__ */ jsx54(
|
|
7451
7869
|
"div",
|
|
7452
7870
|
{
|
|
7453
7871
|
"aria-controls": `${firstPaneId} ${secondPaneId}`,
|
|
@@ -7460,7 +7878,7 @@ function Splitter({
|
|
|
7460
7878
|
onPointerDown: handlePointerDown,
|
|
7461
7879
|
role: "separator",
|
|
7462
7880
|
tabIndex: 0,
|
|
7463
|
-
children: /* @__PURE__ */
|
|
7881
|
+
children: /* @__PURE__ */ jsx54(
|
|
7464
7882
|
"span",
|
|
7465
7883
|
{
|
|
7466
7884
|
"aria-hidden": "true",
|
|
@@ -7470,7 +7888,7 @@ function Splitter({
|
|
|
7470
7888
|
)
|
|
7471
7889
|
}
|
|
7472
7890
|
),
|
|
7473
|
-
/* @__PURE__ */
|
|
7891
|
+
/* @__PURE__ */ jsx54("div", { className: "nu-splitter__pane", id: secondPaneId, children: second })
|
|
7474
7892
|
]
|
|
7475
7893
|
}
|
|
7476
7894
|
);
|
|
@@ -7480,12 +7898,12 @@ function Splitter({
|
|
|
7480
7898
|
import {
|
|
7481
7899
|
useEffect as useEffect14,
|
|
7482
7900
|
useId as useId15,
|
|
7483
|
-
useMemo as
|
|
7484
|
-
useRef as
|
|
7485
|
-
useState as
|
|
7901
|
+
useMemo as useMemo17,
|
|
7902
|
+
useRef as useRef19,
|
|
7903
|
+
useState as useState28
|
|
7486
7904
|
} from "react";
|
|
7487
|
-
import { jsx as
|
|
7488
|
-
function
|
|
7905
|
+
import { jsx as jsx55, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
7906
|
+
function clamp5(value, min, max) {
|
|
7489
7907
|
return Math.min(max, Math.max(min, value));
|
|
7490
7908
|
}
|
|
7491
7909
|
function snapToStep(value, min, step) {
|
|
@@ -7524,17 +7942,17 @@ function TickBar({
|
|
|
7524
7942
|
const safeStep = step > 0 ? step : 1;
|
|
7525
7943
|
const safeMax = max <= min ? min + safeStep : max;
|
|
7526
7944
|
const isControlled = value !== void 0;
|
|
7527
|
-
const initialValue =
|
|
7945
|
+
const initialValue = clamp5(
|
|
7528
7946
|
snapToStep(defaultValue ?? min, min, safeStep),
|
|
7529
7947
|
min,
|
|
7530
7948
|
safeMax
|
|
7531
7949
|
);
|
|
7532
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
7533
|
-
const [dragging, setDragging] =
|
|
7534
|
-
const trackRef =
|
|
7535
|
-
const resolvedValue = isControlled ?
|
|
7950
|
+
const [uncontrolledValue, setUncontrolledValue] = useState28(initialValue);
|
|
7951
|
+
const [dragging, setDragging] = useState28(false);
|
|
7952
|
+
const trackRef = useRef19(null);
|
|
7953
|
+
const resolvedValue = isControlled ? clamp5(snapToStep(value ?? initialValue, min, safeStep), min, safeMax) : uncontrolledValue;
|
|
7536
7954
|
const ratio = safeMax === min ? 0 : (resolvedValue - min) / (safeMax - min);
|
|
7537
|
-
const derivedTickCount =
|
|
7955
|
+
const derivedTickCount = useMemo17(() => {
|
|
7538
7956
|
if (tickCount !== void 0) {
|
|
7539
7957
|
return Math.max(2, tickCount);
|
|
7540
7958
|
}
|
|
@@ -7555,7 +7973,7 @@ function TickBar({
|
|
|
7555
7973
|
return () => window.removeEventListener("pointerup", cancelDrag);
|
|
7556
7974
|
}, [dragging]);
|
|
7557
7975
|
function commitValue(nextValue) {
|
|
7558
|
-
const snappedValue =
|
|
7976
|
+
const snappedValue = clamp5(
|
|
7559
7977
|
snapToStep(nextValue, min, safeStep),
|
|
7560
7978
|
min,
|
|
7561
7979
|
safeMax
|
|
@@ -7571,7 +7989,7 @@ function TickBar({
|
|
|
7571
7989
|
return;
|
|
7572
7990
|
}
|
|
7573
7991
|
const rect = track.getBoundingClientRect();
|
|
7574
|
-
const nextRatio = orientation === "vertical" ?
|
|
7992
|
+
const nextRatio = orientation === "vertical" ? clamp5((rect.bottom - clientY) / rect.height, 0, 1) : clamp5((clientX - rect.left) / rect.width, 0, 1);
|
|
7575
7993
|
commitValue(min + nextRatio * (safeMax - min));
|
|
7576
7994
|
}
|
|
7577
7995
|
function nudge(direction, multiplier = 1) {
|
|
@@ -7620,7 +8038,7 @@ function TickBar({
|
|
|
7620
8038
|
}
|
|
7621
8039
|
onKeyDown?.(event);
|
|
7622
8040
|
}
|
|
7623
|
-
return /* @__PURE__ */
|
|
8041
|
+
return /* @__PURE__ */ jsxs36(
|
|
7624
8042
|
"div",
|
|
7625
8043
|
{
|
|
7626
8044
|
...props,
|
|
@@ -7633,7 +8051,7 @@ function TickBar({
|
|
|
7633
8051
|
slotStyles?.root
|
|
7634
8052
|
),
|
|
7635
8053
|
children: [
|
|
7636
|
-
label ? /* @__PURE__ */
|
|
8054
|
+
label ? /* @__PURE__ */ jsx55(
|
|
7637
8055
|
"span",
|
|
7638
8056
|
{
|
|
7639
8057
|
className: cx("nu-tick-bar__label", slotClassNames?.label),
|
|
@@ -7641,13 +8059,13 @@ function TickBar({
|
|
|
7641
8059
|
children: renderMnemonicText(label)
|
|
7642
8060
|
}
|
|
7643
8061
|
) : null,
|
|
7644
|
-
/* @__PURE__ */
|
|
8062
|
+
/* @__PURE__ */ jsxs36(
|
|
7645
8063
|
"div",
|
|
7646
8064
|
{
|
|
7647
8065
|
className: cx("nu-tick-bar__slot", slotClassNames?.slot),
|
|
7648
8066
|
style: slotStyles?.slot,
|
|
7649
8067
|
children: [
|
|
7650
|
-
/* @__PURE__ */
|
|
8068
|
+
/* @__PURE__ */ jsxs36(
|
|
7651
8069
|
"div",
|
|
7652
8070
|
{
|
|
7653
8071
|
"aria-describedby": hintId,
|
|
@@ -7689,19 +8107,19 @@ function TickBar({
|
|
|
7689
8107
|
style: slotStyles?.track,
|
|
7690
8108
|
tabIndex: disabled ? -1 : 0,
|
|
7691
8109
|
children: [
|
|
7692
|
-
/* @__PURE__ */
|
|
8110
|
+
/* @__PURE__ */ jsx55(
|
|
7693
8111
|
"div",
|
|
7694
8112
|
{
|
|
7695
8113
|
className: cx("nu-tick-bar__rail", slotClassNames?.rail),
|
|
7696
8114
|
style: slotStyles?.rail
|
|
7697
8115
|
}
|
|
7698
8116
|
),
|
|
7699
|
-
/* @__PURE__ */
|
|
8117
|
+
/* @__PURE__ */ jsx55(
|
|
7700
8118
|
"div",
|
|
7701
8119
|
{
|
|
7702
8120
|
className: cx("nu-tick-bar__ticks", slotClassNames?.ticks),
|
|
7703
8121
|
style: slotStyles?.ticks,
|
|
7704
|
-
children: Array.from({ length: derivedTickCount }, (_, index) => /* @__PURE__ */
|
|
8122
|
+
children: Array.from({ length: derivedTickCount }, (_, index) => /* @__PURE__ */ jsx55(
|
|
7705
8123
|
"span",
|
|
7706
8124
|
{
|
|
7707
8125
|
"aria-hidden": "true",
|
|
@@ -7712,7 +8130,7 @@ function TickBar({
|
|
|
7712
8130
|
))
|
|
7713
8131
|
}
|
|
7714
8132
|
),
|
|
7715
|
-
/* @__PURE__ */
|
|
8133
|
+
/* @__PURE__ */ jsx55(
|
|
7716
8134
|
"div",
|
|
7717
8135
|
{
|
|
7718
8136
|
"aria-hidden": "true",
|
|
@@ -7730,7 +8148,7 @@ function TickBar({
|
|
|
7730
8148
|
]
|
|
7731
8149
|
}
|
|
7732
8150
|
),
|
|
7733
|
-
showValue ? /* @__PURE__ */
|
|
8151
|
+
showValue ? /* @__PURE__ */ jsx55(
|
|
7734
8152
|
"span",
|
|
7735
8153
|
{
|
|
7736
8154
|
className: cx("nu-tick-bar__value", slotClassNames?.value),
|
|
@@ -7741,7 +8159,7 @@ function TickBar({
|
|
|
7741
8159
|
]
|
|
7742
8160
|
}
|
|
7743
8161
|
),
|
|
7744
|
-
hint ? /* @__PURE__ */
|
|
8162
|
+
hint ? /* @__PURE__ */ jsx55(
|
|
7745
8163
|
"span",
|
|
7746
8164
|
{
|
|
7747
8165
|
className: cx("nu-tick-bar__hint", slotClassNames?.hint),
|
|
@@ -7756,7 +8174,7 @@ function TickBar({
|
|
|
7756
8174
|
}
|
|
7757
8175
|
|
|
7758
8176
|
// src/components/ToolBar/ToolBar.tsx
|
|
7759
|
-
import { jsx as
|
|
8177
|
+
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
7760
8178
|
function ToolBar({
|
|
7761
8179
|
children,
|
|
7762
8180
|
className,
|
|
@@ -7766,7 +8184,7 @@ function ToolBar({
|
|
|
7766
8184
|
wrap = false,
|
|
7767
8185
|
...props
|
|
7768
8186
|
}) {
|
|
7769
|
-
return /* @__PURE__ */
|
|
8187
|
+
return /* @__PURE__ */ jsx56(
|
|
7770
8188
|
"div",
|
|
7771
8189
|
{
|
|
7772
8190
|
...props,
|
|
@@ -7785,7 +8203,7 @@ function ToolButton({
|
|
|
7785
8203
|
slotStyles,
|
|
7786
8204
|
...props
|
|
7787
8205
|
}) {
|
|
7788
|
-
return /* @__PURE__ */
|
|
8206
|
+
return /* @__PURE__ */ jsx56(
|
|
7789
8207
|
CommandButton,
|
|
7790
8208
|
{
|
|
7791
8209
|
...props,
|
|
@@ -7815,7 +8233,7 @@ function ToolDropButton({
|
|
|
7815
8233
|
uncheckedShape,
|
|
7816
8234
|
...props
|
|
7817
8235
|
}) {
|
|
7818
|
-
return /* @__PURE__ */
|
|
8236
|
+
return /* @__PURE__ */ jsx56(
|
|
7819
8237
|
CommandButton,
|
|
7820
8238
|
{
|
|
7821
8239
|
...props,
|
|
@@ -7841,7 +8259,7 @@ function ToolDropButton({
|
|
|
7841
8259
|
);
|
|
7842
8260
|
}
|
|
7843
8261
|
function ToolSeparator({ className, ...props }) {
|
|
7844
|
-
return /* @__PURE__ */
|
|
8262
|
+
return /* @__PURE__ */ jsx56(
|
|
7845
8263
|
"div",
|
|
7846
8264
|
{
|
|
7847
8265
|
...props,
|
|
@@ -7859,13 +8277,13 @@ function ToolSeparator({ className, ...props }) {
|
|
|
7859
8277
|
// src/components/TreeView/TreeView.tsx
|
|
7860
8278
|
import {
|
|
7861
8279
|
forwardRef as forwardRef3,
|
|
7862
|
-
useCallback as
|
|
8280
|
+
useCallback as useCallback7,
|
|
7863
8281
|
useEffect as useEffect15,
|
|
7864
8282
|
useId as useId16,
|
|
7865
8283
|
useImperativeHandle as useImperativeHandle3,
|
|
7866
|
-
useMemo as
|
|
7867
|
-
useRef as
|
|
7868
|
-
useState as
|
|
8284
|
+
useMemo as useMemo18,
|
|
8285
|
+
useRef as useRef20,
|
|
8286
|
+
useState as useState29
|
|
7869
8287
|
} from "react";
|
|
7870
8288
|
|
|
7871
8289
|
// src/components/_shared/treeData.ts
|
|
@@ -7963,7 +8381,7 @@ function collectVisibleTreeItems(items, expandedIds, depth = 0, guideMask = [],
|
|
|
7963
8381
|
|
|
7964
8382
|
// src/components/TreeView/internals/TreeViewItem.tsx
|
|
7965
8383
|
import { memo as memo4 } from "react";
|
|
7966
|
-
import { jsx as
|
|
8384
|
+
import { jsx as jsx57, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
7967
8385
|
function areTreeViewGuideArraysEqual(previousArray, nextArray) {
|
|
7968
8386
|
if (previousArray.length !== nextArray.length) {
|
|
7969
8387
|
return false;
|
|
@@ -8037,8 +8455,8 @@ function TreeViewItemInner({
|
|
|
8037
8455
|
handleActivate();
|
|
8038
8456
|
onToggleItemCheck?.(item, !isChecked);
|
|
8039
8457
|
}
|
|
8040
|
-
return /* @__PURE__ */
|
|
8041
|
-
/* @__PURE__ */
|
|
8458
|
+
return /* @__PURE__ */ jsxs37("div", { className: "nu-tree-view__row", role: "none", children: [
|
|
8459
|
+
/* @__PURE__ */ jsxs37(
|
|
8042
8460
|
"div",
|
|
8043
8461
|
{
|
|
8044
8462
|
"aria-checked": isCheckable ? isChecked : void 0,
|
|
@@ -8057,8 +8475,8 @@ function TreeViewItemInner({
|
|
|
8057
8475
|
ref: (node) => registerItemRef(itemId, node),
|
|
8058
8476
|
role: "treeitem",
|
|
8059
8477
|
children: [
|
|
8060
|
-
/* @__PURE__ */
|
|
8061
|
-
guideMask.map((hasGuide, guideIndex) => /* @__PURE__ */
|
|
8478
|
+
/* @__PURE__ */ jsxs37("span", { "aria-hidden": "true", className: "nu-tree-view__prefix", children: [
|
|
8479
|
+
guideMask.map((hasGuide, guideIndex) => /* @__PURE__ */ jsx57(
|
|
8062
8480
|
"span",
|
|
8063
8481
|
{
|
|
8064
8482
|
className: "nu-tree-view__guide",
|
|
@@ -8069,7 +8487,7 @@ function TreeViewItemInner({
|
|
|
8069
8487
|
},
|
|
8070
8488
|
`${itemId}-guide-${guideIndex}`
|
|
8071
8489
|
)),
|
|
8072
|
-
/* @__PURE__ */
|
|
8490
|
+
/* @__PURE__ */ jsxs37(
|
|
8073
8491
|
"span",
|
|
8074
8492
|
{
|
|
8075
8493
|
className: "nu-tree-view__lead",
|
|
@@ -8077,19 +8495,19 @@ function TreeViewItemInner({
|
|
|
8077
8495
|
"--nu-tree-view-origin-offset": originOffset
|
|
8078
8496
|
},
|
|
8079
8497
|
children: [
|
|
8080
|
-
depth > 0 ? /* @__PURE__ */
|
|
8498
|
+
depth > 0 ? /* @__PURE__ */ jsx57(
|
|
8081
8499
|
"span",
|
|
8082
8500
|
{
|
|
8083
8501
|
className: "nu-tree-view__branch",
|
|
8084
8502
|
"data-branch": hasNextSibling ? "tee" : "elbow"
|
|
8085
8503
|
}
|
|
8086
8504
|
) : null,
|
|
8087
|
-
hasChildren ? /* @__PURE__ */
|
|
8505
|
+
hasChildren ? /* @__PURE__ */ jsx57(
|
|
8088
8506
|
"span",
|
|
8089
8507
|
{
|
|
8090
8508
|
className: "nu-tree-view__expander",
|
|
8091
8509
|
"data-connector": depth > 0 ? "lead" : void 0,
|
|
8092
|
-
children: /* @__PURE__ */
|
|
8510
|
+
children: /* @__PURE__ */ jsx57(
|
|
8093
8511
|
"button",
|
|
8094
8512
|
{
|
|
8095
8513
|
"aria-label": isExpanded ? "Collapse item" : "Expand item",
|
|
@@ -8097,7 +8515,7 @@ function TreeViewItemInner({
|
|
|
8097
8515
|
onClick: handleToggleExpanded,
|
|
8098
8516
|
tabIndex: -1,
|
|
8099
8517
|
type: "button",
|
|
8100
|
-
children: /* @__PURE__ */
|
|
8518
|
+
children: /* @__PURE__ */ jsx57(
|
|
8101
8519
|
NuGlyph,
|
|
8102
8520
|
{
|
|
8103
8521
|
name: isExpanded ? "tree-caret-down" : "tree-caret-right"
|
|
@@ -8106,7 +8524,7 @@ function TreeViewItemInner({
|
|
|
8106
8524
|
}
|
|
8107
8525
|
)
|
|
8108
8526
|
}
|
|
8109
|
-
) : depth > 0 ? /* @__PURE__ */
|
|
8527
|
+
) : depth > 0 ? /* @__PURE__ */ jsx57(
|
|
8110
8528
|
"span",
|
|
8111
8529
|
{
|
|
8112
8530
|
className: "nu-tree-view__expander-placeholder",
|
|
@@ -8117,8 +8535,8 @@ function TreeViewItemInner({
|
|
|
8117
8535
|
}
|
|
8118
8536
|
)
|
|
8119
8537
|
] }),
|
|
8120
|
-
/* @__PURE__ */
|
|
8121
|
-
isCheckable ? /* @__PURE__ */
|
|
8538
|
+
/* @__PURE__ */ jsxs37("span", { className: "nu-tree-view__content", children: [
|
|
8539
|
+
isCheckable ? /* @__PURE__ */ jsx57("span", { className: "nu-tree-view__check-slot", children: /* @__PURE__ */ jsx57(
|
|
8122
8540
|
"button",
|
|
8123
8541
|
{
|
|
8124
8542
|
"aria-label": isChecked ? "Uncheck item" : "Check item",
|
|
@@ -8126,12 +8544,12 @@ function TreeViewItemInner({
|
|
|
8126
8544
|
onClick: handleToggleChecked,
|
|
8127
8545
|
tabIndex: -1,
|
|
8128
8546
|
type: "button",
|
|
8129
|
-
children: /* @__PURE__ */
|
|
8547
|
+
children: /* @__PURE__ */ jsx57(
|
|
8130
8548
|
"span",
|
|
8131
8549
|
{
|
|
8132
8550
|
className: "nu-tree-view__check-box",
|
|
8133
8551
|
"data-unchecked-shape": uncheckedShape,
|
|
8134
|
-
children: isChecked ? /* @__PURE__ */
|
|
8552
|
+
children: isChecked ? /* @__PURE__ */ jsx57(
|
|
8135
8553
|
NuGlyph,
|
|
8136
8554
|
{
|
|
8137
8555
|
className: "nu-tree-view__check-mark",
|
|
@@ -8142,14 +8560,14 @@ function TreeViewItemInner({
|
|
|
8142
8560
|
)
|
|
8143
8561
|
}
|
|
8144
8562
|
) }) : null,
|
|
8145
|
-
item.icon ? /* @__PURE__ */
|
|
8146
|
-
/* @__PURE__ */
|
|
8147
|
-
item.hint ? /* @__PURE__ */
|
|
8563
|
+
item.icon ? /* @__PURE__ */ jsx57("span", { className: "nu-tree-view__icon", children: item.icon }) : null,
|
|
8564
|
+
/* @__PURE__ */ jsx57("span", { className: "nu-tree-view__title", children: item.title }),
|
|
8565
|
+
item.hint ? /* @__PURE__ */ jsx57("span", { className: "nu-tree-view__hint", children: item.hint }) : null
|
|
8148
8566
|
] })
|
|
8149
8567
|
]
|
|
8150
8568
|
}
|
|
8151
8569
|
),
|
|
8152
|
-
hasChildren && isExpanded ? /* @__PURE__ */
|
|
8570
|
+
hasChildren && isExpanded ? /* @__PURE__ */ jsx57("div", { role: "group", children: (item.children ?? []).map((child, index) => /* @__PURE__ */ jsx57(
|
|
8153
8571
|
TreeViewItem,
|
|
8154
8572
|
{
|
|
8155
8573
|
depth: depth + 1,
|
|
@@ -8185,7 +8603,7 @@ function areTreeViewItemPropsEqual(previousProps, nextProps) {
|
|
|
8185
8603
|
var TreeViewItem = memo4(TreeViewItemInner, areTreeViewItemPropsEqual);
|
|
8186
8604
|
|
|
8187
8605
|
// src/components/TreeView/TreeView.tsx
|
|
8188
|
-
import { jsx as
|
|
8606
|
+
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
8189
8607
|
function TreeViewInner({
|
|
8190
8608
|
className,
|
|
8191
8609
|
data,
|
|
@@ -8200,34 +8618,34 @@ function TreeViewInner({
|
|
|
8200
8618
|
uncheckedShape = "box",
|
|
8201
8619
|
...props
|
|
8202
8620
|
}, ref) {
|
|
8203
|
-
const rootRef =
|
|
8621
|
+
const rootRef = useRef20(null);
|
|
8204
8622
|
const treeId = useId16();
|
|
8205
|
-
const itemRefs =
|
|
8623
|
+
const itemRefs = useRef20({});
|
|
8206
8624
|
const isExpandedControlled = expandedIds !== void 0;
|
|
8207
|
-
const [uncontrolledExpandedIds, setUncontrolledExpandedIds] =
|
|
8625
|
+
const [uncontrolledExpandedIds, setUncontrolledExpandedIds] = useState29(() => {
|
|
8208
8626
|
const expandedFromData = collectExpandedTreeIds(data);
|
|
8209
8627
|
if (!defaultExpandedIds?.length) {
|
|
8210
8628
|
return expandedFromData;
|
|
8211
8629
|
}
|
|
8212
8630
|
return Array.from(/* @__PURE__ */ new Set([...expandedFromData, ...defaultExpandedIds]));
|
|
8213
8631
|
});
|
|
8214
|
-
const [uncontrolledSelectedId, setUncontrolledSelectedId] =
|
|
8632
|
+
const [uncontrolledSelectedId, setUncontrolledSelectedId] = useState29(null);
|
|
8215
8633
|
const resolvedExpandedIds = isExpandedControlled ? expandedIds : uncontrolledExpandedIds;
|
|
8216
|
-
const expandedIdSet =
|
|
8634
|
+
const expandedIdSet = useMemo18(
|
|
8217
8635
|
() => new Set(resolvedExpandedIds),
|
|
8218
8636
|
[resolvedExpandedIds]
|
|
8219
8637
|
);
|
|
8220
|
-
const visibleItems =
|
|
8638
|
+
const visibleItems = useMemo18(
|
|
8221
8639
|
() => collectVisibleTreeItems(data, expandedIdSet),
|
|
8222
8640
|
[data, expandedIdSet]
|
|
8223
8641
|
);
|
|
8224
|
-
const selectableItems =
|
|
8642
|
+
const selectableItems = useMemo18(
|
|
8225
8643
|
() => visibleItems.filter(({ item }) => !item.disabled),
|
|
8226
8644
|
[visibleItems]
|
|
8227
8645
|
);
|
|
8228
8646
|
const derivedSelectedId = selectedId ?? uncontrolledSelectedId ?? findSelectedTreeItemId(data) ?? selectableItems[0]?.itemId ?? null;
|
|
8229
8647
|
const resolvedSelectedId = derivedSelectedId && selectableItems.some((entry) => entry.itemId === derivedSelectedId) ? derivedSelectedId : selectableItems[0]?.itemId ?? null;
|
|
8230
|
-
const [activeId, setActiveId] =
|
|
8648
|
+
const [activeId, setActiveId] = useState29(resolvedSelectedId);
|
|
8231
8649
|
const resolvedActiveId = activeId && selectableItems.some((entry) => entry.itemId === activeId) ? activeId : resolvedSelectedId;
|
|
8232
8650
|
useEffect15(() => {
|
|
8233
8651
|
if (!resolvedActiveId) {
|
|
@@ -8237,13 +8655,13 @@ function TreeViewInner({
|
|
|
8237
8655
|
block: "nearest"
|
|
8238
8656
|
});
|
|
8239
8657
|
}, [resolvedActiveId]);
|
|
8240
|
-
const registerItemRef =
|
|
8658
|
+
const registerItemRef = useCallback7(
|
|
8241
8659
|
(itemId, node) => {
|
|
8242
8660
|
itemRefs.current[itemId] = node;
|
|
8243
8661
|
},
|
|
8244
8662
|
[]
|
|
8245
8663
|
);
|
|
8246
|
-
const setExpandedState =
|
|
8664
|
+
const setExpandedState = useCallback7(
|
|
8247
8665
|
(item, nextExpanded) => {
|
|
8248
8666
|
const nextExpandedIds = nextExpanded ? Array.from(/* @__PURE__ */ new Set([...resolvedExpandedIds, item.id])) : resolvedExpandedIds.filter((expandedId) => expandedId !== item.id);
|
|
8249
8667
|
if (!isExpandedControlled) {
|
|
@@ -8253,7 +8671,7 @@ function TreeViewInner({
|
|
|
8253
8671
|
},
|
|
8254
8672
|
[isExpandedControlled, onExpandedIdsChange, resolvedExpandedIds]
|
|
8255
8673
|
);
|
|
8256
|
-
const activateEntry =
|
|
8674
|
+
const activateEntry = useCallback7(
|
|
8257
8675
|
(item, itemId) => {
|
|
8258
8676
|
if (item.disabled) {
|
|
8259
8677
|
return;
|
|
@@ -8266,7 +8684,7 @@ function TreeViewInner({
|
|
|
8266
8684
|
},
|
|
8267
8685
|
[onItemSelect, selectedId]
|
|
8268
8686
|
);
|
|
8269
|
-
const activateResolvedItem =
|
|
8687
|
+
const activateResolvedItem = useCallback7(
|
|
8270
8688
|
(itemId) => {
|
|
8271
8689
|
if (!itemId) {
|
|
8272
8690
|
return;
|
|
@@ -8436,7 +8854,7 @@ function TreeViewInner({
|
|
|
8436
8854
|
setExpandedState
|
|
8437
8855
|
]
|
|
8438
8856
|
);
|
|
8439
|
-
return /* @__PURE__ */
|
|
8857
|
+
return /* @__PURE__ */ jsx58(
|
|
8440
8858
|
"div",
|
|
8441
8859
|
{
|
|
8442
8860
|
...props,
|
|
@@ -8446,7 +8864,7 @@ function TreeViewInner({
|
|
|
8446
8864
|
ref: rootRef,
|
|
8447
8865
|
role: "tree",
|
|
8448
8866
|
tabIndex: 0,
|
|
8449
|
-
children: visibleItems.length > 0 ? data.map((item, index) => /* @__PURE__ */
|
|
8867
|
+
children: visibleItems.length > 0 ? data.map((item, index) => /* @__PURE__ */ jsx58(
|
|
8450
8868
|
TreeViewItem,
|
|
8451
8869
|
{
|
|
8452
8870
|
depth: 0,
|
|
@@ -8466,7 +8884,7 @@ function TreeViewInner({
|
|
|
8466
8884
|
uncheckedShape
|
|
8467
8885
|
},
|
|
8468
8886
|
item.id
|
|
8469
|
-
)) : /* @__PURE__ */
|
|
8887
|
+
)) : /* @__PURE__ */ jsx58("div", { className: "nu-tree-view__empty", children: emptyText })
|
|
8470
8888
|
}
|
|
8471
8889
|
);
|
|
8472
8890
|
}
|
|
@@ -8475,14 +8893,14 @@ var TreeView = forwardRef3(TreeViewInner);
|
|
|
8475
8893
|
// src/components/TreeListView/TreeListView.tsx
|
|
8476
8894
|
import {
|
|
8477
8895
|
forwardRef as forwardRef4,
|
|
8478
|
-
useCallback as
|
|
8896
|
+
useCallback as useCallback8,
|
|
8479
8897
|
useEffect as useEffect16,
|
|
8480
8898
|
useId as useId17,
|
|
8481
8899
|
useImperativeHandle as useImperativeHandle4,
|
|
8482
|
-
useLayoutEffect as
|
|
8483
|
-
useMemo as
|
|
8484
|
-
useRef as
|
|
8485
|
-
useState as
|
|
8900
|
+
useLayoutEffect as useLayoutEffect5,
|
|
8901
|
+
useMemo as useMemo19,
|
|
8902
|
+
useRef as useRef21,
|
|
8903
|
+
useState as useState30
|
|
8486
8904
|
} from "react";
|
|
8487
8905
|
|
|
8488
8906
|
// src/components/TreeListView/internals/helpers.ts
|
|
@@ -8573,11 +8991,11 @@ function renderTreeListCellValue(item, column) {
|
|
|
8573
8991
|
|
|
8574
8992
|
// src/components/TreeListView/internals/TreeListViewRow.tsx
|
|
8575
8993
|
import { memo as memo5 } from "react";
|
|
8576
|
-
import { Fragment as
|
|
8994
|
+
import { Fragment as Fragment7, jsx as jsx59, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
8577
8995
|
function renderTreeTitleContent(item) {
|
|
8578
|
-
return /* @__PURE__ */
|
|
8579
|
-
/* @__PURE__ */
|
|
8580
|
-
item.hint ? /* @__PURE__ */
|
|
8996
|
+
return /* @__PURE__ */ jsxs38(Fragment7, { children: [
|
|
8997
|
+
/* @__PURE__ */ jsx59("span", { className: "nu-tree-list-view__title", children: item.title }),
|
|
8998
|
+
item.hint ? /* @__PURE__ */ jsx59("span", { className: "nu-tree-list-view__hint", children: item.hint }) : null
|
|
8581
8999
|
] });
|
|
8582
9000
|
}
|
|
8583
9001
|
function renderReportCellContent(item, column, depth, rowIndex, getCellContent) {
|
|
@@ -8677,8 +9095,8 @@ function TreeListViewRowInner({
|
|
|
8677
9095
|
handleActivate();
|
|
8678
9096
|
onToggleItemCheck?.(item, !isChecked);
|
|
8679
9097
|
}
|
|
8680
|
-
return /* @__PURE__ */
|
|
8681
|
-
/* @__PURE__ */
|
|
9098
|
+
return /* @__PURE__ */ jsxs38(Fragment7, { children: [
|
|
9099
|
+
/* @__PURE__ */ jsx59(
|
|
8682
9100
|
"div",
|
|
8683
9101
|
{
|
|
8684
9102
|
"aria-disabled": item.disabled || void 0,
|
|
@@ -8701,7 +9119,7 @@ function TreeListViewRowInner({
|
|
|
8701
9119
|
"--nu-tree-list-view-columns": templateColumns
|
|
8702
9120
|
},
|
|
8703
9121
|
children: columns.map(
|
|
8704
|
-
(column, columnIndex) => column.id === treeColumnId ? /* @__PURE__ */
|
|
9122
|
+
(column, columnIndex) => column.id === treeColumnId ? /* @__PURE__ */ jsxs38(
|
|
8705
9123
|
"span",
|
|
8706
9124
|
{
|
|
8707
9125
|
className: [
|
|
@@ -8713,8 +9131,8 @@ function TreeListViewRowInner({
|
|
|
8713
9131
|
"data-column-id": column.id,
|
|
8714
9132
|
role: "gridcell",
|
|
8715
9133
|
children: [
|
|
8716
|
-
/* @__PURE__ */
|
|
8717
|
-
guideMask.map((hasGuide, guideIndex) => /* @__PURE__ */
|
|
9134
|
+
/* @__PURE__ */ jsxs38("span", { "aria-hidden": "true", className: "nu-tree-list-view__prefix", children: [
|
|
9135
|
+
guideMask.map((hasGuide, guideIndex) => /* @__PURE__ */ jsx59(
|
|
8718
9136
|
"span",
|
|
8719
9137
|
{
|
|
8720
9138
|
className: "nu-tree-list-view__guide",
|
|
@@ -8725,7 +9143,7 @@ function TreeListViewRowInner({
|
|
|
8725
9143
|
},
|
|
8726
9144
|
`${itemId}-guide-${guideIndex}`
|
|
8727
9145
|
)),
|
|
8728
|
-
/* @__PURE__ */
|
|
9146
|
+
/* @__PURE__ */ jsxs38(
|
|
8729
9147
|
"span",
|
|
8730
9148
|
{
|
|
8731
9149
|
className: "nu-tree-list-view__lead",
|
|
@@ -8733,19 +9151,19 @@ function TreeListViewRowInner({
|
|
|
8733
9151
|
"--nu-tree-list-view-origin-offset": originOffset
|
|
8734
9152
|
},
|
|
8735
9153
|
children: [
|
|
8736
|
-
depth > 0 ? /* @__PURE__ */
|
|
9154
|
+
depth > 0 ? /* @__PURE__ */ jsx59(
|
|
8737
9155
|
"span",
|
|
8738
9156
|
{
|
|
8739
9157
|
className: "nu-tree-list-view__branch",
|
|
8740
9158
|
"data-branch": hasNextSibling ? "tee" : "elbow"
|
|
8741
9159
|
}
|
|
8742
9160
|
) : null,
|
|
8743
|
-
hasChildren ? /* @__PURE__ */
|
|
9161
|
+
hasChildren ? /* @__PURE__ */ jsx59(
|
|
8744
9162
|
"span",
|
|
8745
9163
|
{
|
|
8746
9164
|
className: "nu-tree-list-view__expander",
|
|
8747
9165
|
"data-connector": depth > 0 ? "lead" : void 0,
|
|
8748
|
-
children: /* @__PURE__ */
|
|
9166
|
+
children: /* @__PURE__ */ jsx59(
|
|
8749
9167
|
"button",
|
|
8750
9168
|
{
|
|
8751
9169
|
"aria-label": isExpanded ? "Collapse item" : "Expand item",
|
|
@@ -8753,7 +9171,7 @@ function TreeListViewRowInner({
|
|
|
8753
9171
|
onClick: handleToggleExpanded,
|
|
8754
9172
|
tabIndex: -1,
|
|
8755
9173
|
type: "button",
|
|
8756
|
-
children: /* @__PURE__ */
|
|
9174
|
+
children: /* @__PURE__ */ jsx59(
|
|
8757
9175
|
NuGlyph,
|
|
8758
9176
|
{
|
|
8759
9177
|
name: isExpanded ? "tree-caret-down" : "tree-caret-right"
|
|
@@ -8762,7 +9180,7 @@ function TreeListViewRowInner({
|
|
|
8762
9180
|
}
|
|
8763
9181
|
)
|
|
8764
9182
|
}
|
|
8765
|
-
) : depth > 0 ? /* @__PURE__ */
|
|
9183
|
+
) : depth > 0 ? /* @__PURE__ */ jsx59(
|
|
8766
9184
|
"span",
|
|
8767
9185
|
{
|
|
8768
9186
|
className: "nu-tree-list-view__expander-placeholder",
|
|
@@ -8773,8 +9191,8 @@ function TreeListViewRowInner({
|
|
|
8773
9191
|
}
|
|
8774
9192
|
)
|
|
8775
9193
|
] }),
|
|
8776
|
-
/* @__PURE__ */
|
|
8777
|
-
isCheckable ? /* @__PURE__ */
|
|
9194
|
+
/* @__PURE__ */ jsxs38("span", { className: "nu-tree-list-view__tree-content", children: [
|
|
9195
|
+
isCheckable ? /* @__PURE__ */ jsx59("span", { className: "nu-tree-list-view__check-slot", children: /* @__PURE__ */ jsx59(
|
|
8778
9196
|
"button",
|
|
8779
9197
|
{
|
|
8780
9198
|
"aria-label": isChecked ? "Uncheck item" : "Check item",
|
|
@@ -8782,12 +9200,12 @@ function TreeListViewRowInner({
|
|
|
8782
9200
|
onClick: handleToggleChecked,
|
|
8783
9201
|
tabIndex: -1,
|
|
8784
9202
|
type: "button",
|
|
8785
|
-
children: /* @__PURE__ */
|
|
9203
|
+
children: /* @__PURE__ */ jsx59(
|
|
8786
9204
|
"span",
|
|
8787
9205
|
{
|
|
8788
9206
|
className: "nu-tree-list-view__check-box",
|
|
8789
9207
|
"data-unchecked-shape": uncheckedShape,
|
|
8790
|
-
children: isChecked ? /* @__PURE__ */
|
|
9208
|
+
children: isChecked ? /* @__PURE__ */ jsx59(
|
|
8791
9209
|
NuGlyph,
|
|
8792
9210
|
{
|
|
8793
9211
|
className: "nu-tree-list-view__check-mark",
|
|
@@ -8798,13 +9216,13 @@ function TreeListViewRowInner({
|
|
|
8798
9216
|
)
|
|
8799
9217
|
}
|
|
8800
9218
|
) }) : null,
|
|
8801
|
-
item.icon ? /* @__PURE__ */
|
|
9219
|
+
item.icon ? /* @__PURE__ */ jsx59("span", { className: "nu-tree-list-view__icon", children: item.icon }) : null,
|
|
8802
9220
|
renderTreeTitleContent(item)
|
|
8803
9221
|
] })
|
|
8804
9222
|
]
|
|
8805
9223
|
},
|
|
8806
9224
|
column.id
|
|
8807
|
-
) : /* @__PURE__ */
|
|
9225
|
+
) : /* @__PURE__ */ jsx59(
|
|
8808
9226
|
"span",
|
|
8809
9227
|
{
|
|
8810
9228
|
className: [
|
|
@@ -8827,7 +9245,7 @@ function TreeListViewRowInner({
|
|
|
8827
9245
|
)
|
|
8828
9246
|
}
|
|
8829
9247
|
),
|
|
8830
|
-
hasChildren && isExpanded ? /* @__PURE__ */
|
|
9248
|
+
hasChildren && isExpanded ? /* @__PURE__ */ jsx59("div", { role: "rowgroup", children: (item.children ?? []).map((child, index) => /* @__PURE__ */ jsx59(
|
|
8831
9249
|
TreeListViewRow,
|
|
8832
9250
|
{
|
|
8833
9251
|
activeItemId,
|
|
@@ -8871,7 +9289,7 @@ var TreeListViewRow = memo5(
|
|
|
8871
9289
|
);
|
|
8872
9290
|
|
|
8873
9291
|
// src/components/TreeListView/TreeListView.tsx
|
|
8874
|
-
import { jsx as
|
|
9292
|
+
import { jsx as jsx60, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
8875
9293
|
function TreeListViewInner({
|
|
8876
9294
|
activeItemId: activeItemIdProp,
|
|
8877
9295
|
checkedIds,
|
|
@@ -8893,42 +9311,42 @@ function TreeListViewInner({
|
|
|
8893
9311
|
uncheckedShape = "box",
|
|
8894
9312
|
...props
|
|
8895
9313
|
}, ref) {
|
|
8896
|
-
const rootRef =
|
|
9314
|
+
const rootRef = useRef21(null);
|
|
8897
9315
|
const treeId = useId17();
|
|
8898
|
-
const itemRefs =
|
|
8899
|
-
const resizeFrameRef =
|
|
8900
|
-
const resizeStateRef =
|
|
9316
|
+
const itemRefs = useRef21({});
|
|
9317
|
+
const resizeFrameRef = useRef21(null);
|
|
9318
|
+
const resizeStateRef = useRef21(null);
|
|
8901
9319
|
const isExpandedControlled = expandedIds !== void 0;
|
|
8902
|
-
const [uncontrolledExpandedIds, setUncontrolledExpandedIds] =
|
|
9320
|
+
const [uncontrolledExpandedIds, setUncontrolledExpandedIds] = useState30(() => {
|
|
8903
9321
|
const expandedFromData = collectExpandedTreeListIds(data);
|
|
8904
9322
|
if (!defaultExpandedIds?.length) {
|
|
8905
9323
|
return expandedFromData;
|
|
8906
9324
|
}
|
|
8907
9325
|
return Array.from(/* @__PURE__ */ new Set([...expandedFromData, ...defaultExpandedIds]));
|
|
8908
9326
|
});
|
|
8909
|
-
const [uncontrolledSelectedId, setUncontrolledSelectedId] =
|
|
8910
|
-
const [autoColumnWidths, setAutoColumnWidths] =
|
|
8911
|
-
const [userColumnWidths, setUserColumnWidths] =
|
|
9327
|
+
const [uncontrolledSelectedId, setUncontrolledSelectedId] = useState30(null);
|
|
9328
|
+
const [autoColumnWidths, setAutoColumnWidths] = useState30({});
|
|
9329
|
+
const [userColumnWidths, setUserColumnWidths] = useState30({});
|
|
8912
9330
|
const isActiveControlled = activeItemIdProp !== void 0;
|
|
8913
9331
|
const resolvedExpandedIds = isExpandedControlled ? expandedIds : uncontrolledExpandedIds;
|
|
8914
|
-
const expandedIdSet =
|
|
9332
|
+
const expandedIdSet = useMemo19(
|
|
8915
9333
|
() => new Set(resolvedExpandedIds),
|
|
8916
9334
|
[resolvedExpandedIds]
|
|
8917
9335
|
);
|
|
8918
|
-
const visibleItems =
|
|
9336
|
+
const visibleItems = useMemo19(
|
|
8919
9337
|
() => collectVisibleTreeListItems(data, expandedIdSet),
|
|
8920
9338
|
[data, expandedIdSet]
|
|
8921
9339
|
);
|
|
8922
|
-
const selectableItems =
|
|
9340
|
+
const selectableItems = useMemo19(
|
|
8923
9341
|
() => visibleItems.filter(({ item }) => !item.disabled),
|
|
8924
9342
|
[visibleItems]
|
|
8925
9343
|
);
|
|
8926
9344
|
const derivedSelectedId = selectedId ?? uncontrolledSelectedId ?? findSelectedTreeListItemId(data) ?? selectableItems[0]?.itemId ?? null;
|
|
8927
9345
|
const resolvedSelectedId = derivedSelectedId && selectableItems.some((entry) => entry.itemId === derivedSelectedId) ? derivedSelectedId : selectableItems[0]?.itemId ?? null;
|
|
8928
|
-
const [uncontrolledActiveItemId, setUncontrolledActiveItemId] =
|
|
9346
|
+
const [uncontrolledActiveItemId, setUncontrolledActiveItemId] = useState30(() => defaultActiveItemId ?? resolvedSelectedId);
|
|
8929
9347
|
const activeItemId = activeItemIdProp !== void 0 ? activeItemIdProp : uncontrolledActiveItemId;
|
|
8930
9348
|
const resolvedActiveItemId = activeItemId && selectableItems.some((entry) => entry.itemId === activeItemId) ? activeItemId : resolvedSelectedId;
|
|
8931
|
-
const minColumnWidthById =
|
|
9349
|
+
const minColumnWidthById = useMemo19(
|
|
8932
9350
|
() => Object.fromEntries(
|
|
8933
9351
|
columns.map(
|
|
8934
9352
|
(column) => [column.id, column.minWidth ?? 0]
|
|
@@ -8936,18 +9354,18 @@ function TreeListViewInner({
|
|
|
8936
9354
|
),
|
|
8937
9355
|
[columns]
|
|
8938
9356
|
);
|
|
8939
|
-
const templateColumns =
|
|
9357
|
+
const templateColumns = useMemo19(
|
|
8940
9358
|
() => getTreeListTemplateColumns(columns, {
|
|
8941
9359
|
autoColumnWidths,
|
|
8942
9360
|
userColumnWidths
|
|
8943
9361
|
}),
|
|
8944
9362
|
[autoColumnWidths, columns, userColumnWidths]
|
|
8945
9363
|
);
|
|
8946
|
-
const treeColumnId =
|
|
9364
|
+
const treeColumnId = useMemo19(
|
|
8947
9365
|
() => getTreeListTreeColumnId(columns),
|
|
8948
9366
|
[columns]
|
|
8949
9367
|
);
|
|
8950
|
-
const rowIndexMap =
|
|
9368
|
+
const rowIndexMap = useMemo19(
|
|
8951
9369
|
() => new Map(
|
|
8952
9370
|
visibleItems.map((entry, index) => [entry.itemId, index])
|
|
8953
9371
|
),
|
|
@@ -8961,21 +9379,21 @@ function TreeListViewInner({
|
|
|
8961
9379
|
block: "nearest"
|
|
8962
9380
|
});
|
|
8963
9381
|
}, [resolvedActiveItemId]);
|
|
8964
|
-
const registerItemRef =
|
|
9382
|
+
const registerItemRef = useCallback8(
|
|
8965
9383
|
(itemId, node) => {
|
|
8966
9384
|
itemRefs.current[itemId] = node;
|
|
8967
9385
|
},
|
|
8968
9386
|
[]
|
|
8969
9387
|
);
|
|
8970
|
-
const resolveCellContent =
|
|
9388
|
+
const resolveCellContent = useCallback8(
|
|
8971
9389
|
(...args) => getCellContent?.(...args),
|
|
8972
9390
|
[getCellContent]
|
|
8973
9391
|
);
|
|
8974
|
-
const handleItemDoubleClick =
|
|
9392
|
+
const handleItemDoubleClick = useCallback8(
|
|
8975
9393
|
(item) => onItemDoubleClick?.(item),
|
|
8976
9394
|
[onItemDoubleClick]
|
|
8977
9395
|
);
|
|
8978
|
-
|
|
9396
|
+
useLayoutEffect5(() => {
|
|
8979
9397
|
const rootNode = rootRef.current;
|
|
8980
9398
|
if (!rootNode) {
|
|
8981
9399
|
return;
|
|
@@ -9014,7 +9432,7 @@ function TreeListViewInner({
|
|
|
9014
9432
|
}
|
|
9015
9433
|
};
|
|
9016
9434
|
}, []);
|
|
9017
|
-
const setExpandedState =
|
|
9435
|
+
const setExpandedState = useCallback8(
|
|
9018
9436
|
(item, nextExpanded) => {
|
|
9019
9437
|
const nextExpandedIds = nextExpanded ? Array.from(/* @__PURE__ */ new Set([...resolvedExpandedIds, item.id])) : resolvedExpandedIds.filter((expandedId) => expandedId !== item.id);
|
|
9020
9438
|
if (!isExpandedControlled) {
|
|
@@ -9024,7 +9442,7 @@ function TreeListViewInner({
|
|
|
9024
9442
|
},
|
|
9025
9443
|
[isExpandedControlled, onExpandedIdsChange, resolvedExpandedIds]
|
|
9026
9444
|
);
|
|
9027
|
-
const updateActiveItem =
|
|
9445
|
+
const updateActiveItem = useCallback8(
|
|
9028
9446
|
(item) => {
|
|
9029
9447
|
if (!isActiveControlled) {
|
|
9030
9448
|
setUncontrolledActiveItemId(item.id);
|
|
@@ -9033,7 +9451,7 @@ function TreeListViewInner({
|
|
|
9033
9451
|
},
|
|
9034
9452
|
[isActiveControlled, onActiveItemChange]
|
|
9035
9453
|
);
|
|
9036
|
-
const activateEntry =
|
|
9454
|
+
const activateEntry = useCallback8(
|
|
9037
9455
|
(item, itemId) => {
|
|
9038
9456
|
if (item.disabled) {
|
|
9039
9457
|
return;
|
|
@@ -9046,7 +9464,7 @@ function TreeListViewInner({
|
|
|
9046
9464
|
},
|
|
9047
9465
|
[onItemSelect, selectedId, updateActiveItem]
|
|
9048
9466
|
);
|
|
9049
|
-
const activateResolvedItem =
|
|
9467
|
+
const activateResolvedItem = useCallback8(
|
|
9050
9468
|
(itemId) => {
|
|
9051
9469
|
if (!itemId) {
|
|
9052
9470
|
return;
|
|
@@ -9060,7 +9478,7 @@ function TreeListViewInner({
|
|
|
9060
9478
|
},
|
|
9061
9479
|
[activateEntry, selectableItems]
|
|
9062
9480
|
);
|
|
9063
|
-
const handleItemCheckChange =
|
|
9481
|
+
const handleItemCheckChange = useCallback8(
|
|
9064
9482
|
(item, checked) => {
|
|
9065
9483
|
onItemCheckChange?.(item, checked);
|
|
9066
9484
|
},
|
|
@@ -9130,7 +9548,7 @@ function TreeListViewInner({
|
|
|
9130
9548
|
function isItemChecked(item) {
|
|
9131
9549
|
return checkedIds ? checkedIds.includes(item.id) : item.checked === true;
|
|
9132
9550
|
}
|
|
9133
|
-
const toggleItemCheck =
|
|
9551
|
+
const toggleItemCheck = useCallback8(
|
|
9134
9552
|
(itemId) => {
|
|
9135
9553
|
const item = findTreeListItemById(data, itemId);
|
|
9136
9554
|
if (!item || item.disabled || item.checked === void 0 && checkedIds === void 0) {
|
|
@@ -9288,7 +9706,7 @@ function TreeListViewInner({
|
|
|
9288
9706
|
window.addEventListener("pointermove", handleColumnResizeMove);
|
|
9289
9707
|
window.addEventListener("pointerup", handleColumnResizeEnd);
|
|
9290
9708
|
}
|
|
9291
|
-
return /* @__PURE__ */
|
|
9709
|
+
return /* @__PURE__ */ jsxs39(
|
|
9292
9710
|
"div",
|
|
9293
9711
|
{
|
|
9294
9712
|
...props,
|
|
@@ -9300,7 +9718,7 @@ function TreeListViewInner({
|
|
|
9300
9718
|
role: "treegrid",
|
|
9301
9719
|
tabIndex: 0,
|
|
9302
9720
|
children: [
|
|
9303
|
-
/* @__PURE__ */
|
|
9721
|
+
/* @__PURE__ */ jsx60(
|
|
9304
9722
|
"div",
|
|
9305
9723
|
{
|
|
9306
9724
|
className: "nu-tree-list-view__header",
|
|
@@ -9308,7 +9726,7 @@ function TreeListViewInner({
|
|
|
9308
9726
|
style: {
|
|
9309
9727
|
"--nu-tree-list-view-columns": templateColumns
|
|
9310
9728
|
},
|
|
9311
|
-
children: columns.map((column, columnIndex) => /* @__PURE__ */
|
|
9729
|
+
children: columns.map((column, columnIndex) => /* @__PURE__ */ jsxs39(
|
|
9312
9730
|
"span",
|
|
9313
9731
|
{
|
|
9314
9732
|
className: [
|
|
@@ -9319,8 +9737,8 @@ function TreeListViewInner({
|
|
|
9319
9737
|
"data-column-id": column.id,
|
|
9320
9738
|
role: "columnheader",
|
|
9321
9739
|
children: [
|
|
9322
|
-
/* @__PURE__ */
|
|
9323
|
-
column.resizable !== false ? /* @__PURE__ */
|
|
9740
|
+
/* @__PURE__ */ jsx60("span", { className: "nu-tree-list-view__header-label", children: renderMnemonicText(column.title) }),
|
|
9741
|
+
column.resizable !== false ? /* @__PURE__ */ jsx60(
|
|
9324
9742
|
"button",
|
|
9325
9743
|
{
|
|
9326
9744
|
"aria-label": `Resize ${column.title} column`,
|
|
@@ -9336,7 +9754,7 @@ function TreeListViewInner({
|
|
|
9336
9754
|
))
|
|
9337
9755
|
}
|
|
9338
9756
|
),
|
|
9339
|
-
/* @__PURE__ */
|
|
9757
|
+
/* @__PURE__ */ jsx60("div", { className: "nu-tree-list-view__body", children: visibleItems.length > 0 ? data.map((item, index) => /* @__PURE__ */ jsx60(
|
|
9340
9758
|
TreeListViewRow,
|
|
9341
9759
|
{
|
|
9342
9760
|
activeItemId: resolvedActiveItemId,
|
|
@@ -9363,7 +9781,7 @@ function TreeListViewInner({
|
|
|
9363
9781
|
uncheckedShape
|
|
9364
9782
|
},
|
|
9365
9783
|
item.id
|
|
9366
|
-
)) : /* @__PURE__ */
|
|
9784
|
+
)) : /* @__PURE__ */ jsx60("div", { className: "nu-tree-list-view__empty", children: emptyText }) })
|
|
9367
9785
|
]
|
|
9368
9786
|
}
|
|
9369
9787
|
);
|
|
@@ -9372,10 +9790,10 @@ var TreeListView = forwardRef4(TreeListViewInner);
|
|
|
9372
9790
|
|
|
9373
9791
|
// src/theme/NuThemeProvider.tsx
|
|
9374
9792
|
import {
|
|
9375
|
-
useCallback as
|
|
9793
|
+
useCallback as useCallback9,
|
|
9376
9794
|
useId as useId18,
|
|
9377
|
-
useMemo as
|
|
9378
|
-
useState as
|
|
9795
|
+
useMemo as useMemo20,
|
|
9796
|
+
useState as useState31
|
|
9379
9797
|
} from "react";
|
|
9380
9798
|
|
|
9381
9799
|
// src/theme/themes.ts
|
|
@@ -9606,10 +10024,10 @@ function getNuDesktopPatternStyle(mode) {
|
|
|
9606
10024
|
}
|
|
9607
10025
|
|
|
9608
10026
|
// src/theme/themeContext.ts
|
|
9609
|
-
import { createContext as
|
|
9610
|
-
var NuThemeContext =
|
|
10027
|
+
import { createContext as createContext5, useContext as useContext9 } from "react";
|
|
10028
|
+
var NuThemeContext = createContext5(null);
|
|
9611
10029
|
function useNuTheme() {
|
|
9612
|
-
const context =
|
|
10030
|
+
const context = useContext9(NuThemeContext);
|
|
9613
10031
|
if (!context) {
|
|
9614
10032
|
throw new Error("useNuTheme must be used within a NuThemeProvider.");
|
|
9615
10033
|
}
|
|
@@ -9617,7 +10035,7 @@ function useNuTheme() {
|
|
|
9617
10035
|
}
|
|
9618
10036
|
|
|
9619
10037
|
// src/theme/NuThemeProvider.tsx
|
|
9620
|
-
import { jsx as
|
|
10038
|
+
import { jsx as jsx61, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
9621
10039
|
function NuThemeProvider({
|
|
9622
10040
|
children,
|
|
9623
10041
|
className,
|
|
@@ -9636,17 +10054,17 @@ function NuThemeProvider({
|
|
|
9636
10054
|
theme
|
|
9637
10055
|
}) {
|
|
9638
10056
|
const generatedId = useId18();
|
|
9639
|
-
const [internalTheme, setInternalTheme] =
|
|
9640
|
-
const [internalDesktopPatternMode, setInternalDesktopPatternMode] =
|
|
9641
|
-
const [internalFontFamily, setInternalFontFamily] =
|
|
9642
|
-
const [internalFontSize, setInternalFontSize] =
|
|
10057
|
+
const [internalTheme, setInternalTheme] = useState31(defaultTheme);
|
|
10058
|
+
const [internalDesktopPatternMode, setInternalDesktopPatternMode] = useState31(defaultDesktopPatternMode);
|
|
10059
|
+
const [internalFontFamily, setInternalFontFamily] = useState31(defaultFontFamily);
|
|
10060
|
+
const [internalFontSize, setInternalFontSize] = useState31(defaultFontSize);
|
|
9643
10061
|
const currentTheme = theme ?? internalTheme;
|
|
9644
10062
|
const resolvedDesktopPatternMode = desktopPatternMode ?? internalDesktopPatternMode;
|
|
9645
10063
|
const resolvedFontFamily = fontFamily ?? internalFontFamily;
|
|
9646
10064
|
const resolvedFontSize = fontSize ?? internalFontSize;
|
|
9647
10065
|
const resolvedTheme = resolveNuTheme(currentTheme);
|
|
9648
10066
|
const themeName = typeof currentTheme === "string" ? currentTheme : currentTheme.name;
|
|
9649
|
-
const handleThemeChange =
|
|
10067
|
+
const handleThemeChange = useCallback9(
|
|
9650
10068
|
(nextTheme) => {
|
|
9651
10069
|
if (theme === void 0) {
|
|
9652
10070
|
setInternalTheme(nextTheme);
|
|
@@ -9655,7 +10073,7 @@ function NuThemeProvider({
|
|
|
9655
10073
|
},
|
|
9656
10074
|
[theme, onThemeChange]
|
|
9657
10075
|
);
|
|
9658
|
-
const handleDesktopPatternModeChange =
|
|
10076
|
+
const handleDesktopPatternModeChange = useCallback9(
|
|
9659
10077
|
(nextDesktopPatternMode) => {
|
|
9660
10078
|
if (desktopPatternMode === void 0) {
|
|
9661
10079
|
setInternalDesktopPatternMode(nextDesktopPatternMode);
|
|
@@ -9664,7 +10082,7 @@ function NuThemeProvider({
|
|
|
9664
10082
|
},
|
|
9665
10083
|
[desktopPatternMode, onDesktopPatternModeChange]
|
|
9666
10084
|
);
|
|
9667
|
-
const handleFontFamilyChange =
|
|
10085
|
+
const handleFontFamilyChange = useCallback9(
|
|
9668
10086
|
(nextFontFamily) => {
|
|
9669
10087
|
if (fontFamily === void 0) {
|
|
9670
10088
|
setInternalFontFamily(nextFontFamily);
|
|
@@ -9673,7 +10091,7 @@ function NuThemeProvider({
|
|
|
9673
10091
|
},
|
|
9674
10092
|
[fontFamily, onFontFamilyChange]
|
|
9675
10093
|
);
|
|
9676
|
-
const handleFontSizeChange =
|
|
10094
|
+
const handleFontSizeChange = useCallback9(
|
|
9677
10095
|
(nextFontSize) => {
|
|
9678
10096
|
if (fontSize === void 0) {
|
|
9679
10097
|
setInternalFontSize(nextFontSize);
|
|
@@ -9682,7 +10100,7 @@ function NuThemeProvider({
|
|
|
9682
10100
|
},
|
|
9683
10101
|
[fontSize, onFontSizeChange]
|
|
9684
10102
|
);
|
|
9685
|
-
const contextValue =
|
|
10103
|
+
const contextValue = useMemo20(
|
|
9686
10104
|
() => ({
|
|
9687
10105
|
desktopPatternMode: resolvedDesktopPatternMode,
|
|
9688
10106
|
fontFamily: resolvedFontFamily,
|
|
@@ -9707,7 +10125,7 @@ function NuThemeProvider({
|
|
|
9707
10125
|
handleThemeChange
|
|
9708
10126
|
]
|
|
9709
10127
|
);
|
|
9710
|
-
return /* @__PURE__ */
|
|
10128
|
+
return /* @__PURE__ */ jsx61(NuThemeContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs40(
|
|
9711
10129
|
"div",
|
|
9712
10130
|
{
|
|
9713
10131
|
className: ["nu-theme-root", className].filter(Boolean).join(" "),
|
|
@@ -9721,7 +10139,7 @@ function NuThemeProvider({
|
|
|
9721
10139
|
fontSize: `${resolvedFontSize}px`
|
|
9722
10140
|
},
|
|
9723
10141
|
children: [
|
|
9724
|
-
crtGlitch ? /* @__PURE__ */
|
|
10142
|
+
crtGlitch ? /* @__PURE__ */ jsx61(NuCrtGlitch, { ...typeof crtGlitch === "object" ? crtGlitch : {} }) : null,
|
|
9725
10143
|
children
|
|
9726
10144
|
]
|
|
9727
10145
|
}
|
|
@@ -9749,6 +10167,8 @@ export {
|
|
|
9749
10167
|
NuCrtGlitch,
|
|
9750
10168
|
NuDesktop,
|
|
9751
10169
|
NuGlyph,
|
|
10170
|
+
NuIconGrid,
|
|
10171
|
+
NuIconProvider,
|
|
9752
10172
|
NuThemeContext,
|
|
9753
10173
|
NuThemeProvider,
|
|
9754
10174
|
NuView,
|
|
@@ -9791,6 +10211,7 @@ export {
|
|
|
9791
10211
|
resolveNuTheme,
|
|
9792
10212
|
useAppHostMenu,
|
|
9793
10213
|
useMainMenuState,
|
|
10214
|
+
useNuIconManager,
|
|
9794
10215
|
useNuTheme,
|
|
9795
10216
|
useNuWindowManager,
|
|
9796
10217
|
usePopupMenu,
|