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