@deadragdoll/reactnu 0.1.74 → 0.1.76

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/index.js CHANGED
@@ -734,10 +734,10 @@ function toggleMenuCheckedInTree(items, id) {
734
734
  }
735
735
 
736
736
  // src/appHost/NuAppHostProvider.tsx
737
- import { useMemo as useMemo5, useState as useState7 } from "react";
737
+ import { useMemo as useMemo4, useState as useState7 } from "react";
738
738
 
739
739
  // src/windowing/internals/MdiWindowPickerDialog.tsx
740
- import { useMemo as useMemo4, useState as useState6 } from "react";
740
+ import { useMemo as useMemo3, useState as useState6 } from "react";
741
741
 
742
742
  // src/components/Button/Button.tsx
743
743
  import {
@@ -897,11 +897,11 @@ function Button({
897
897
  // src/components/ListBox/ListBox.tsx
898
898
  import {
899
899
  forwardRef,
900
- useCallback as useCallback2,
900
+ useCallback as useCallback3,
901
901
  useEffect as useEffect4,
902
902
  useId,
903
903
  useImperativeHandle,
904
- useMemo as useMemo3,
904
+ useMemo as useMemo2,
905
905
  useRef as useRef5,
906
906
  useState as useState5
907
907
  } from "react";
@@ -976,232 +976,179 @@ import { memo } from "react";
976
976
 
977
977
  // src/components/DragDrop/NuDragDropProvider.tsx
978
978
  import {
979
- createContext,
979
+ useCallback as useCallback2,
980
980
  useContext,
981
981
  useEffect as useEffect3,
982
- useMemo as useMemo2,
983
982
  useRef as useRef4
984
983
  } from "react";
985
-
986
- // src/components/_shared/themePortal.ts
987
- function getThemePortalStyle(anchor) {
988
- if (typeof window === "undefined") {
989
- return void 0;
990
- }
991
- const themeRoot = anchor?.closest(".nu-theme-root");
992
- if (!themeRoot) {
993
- return void 0;
994
- }
995
- const computed = window.getComputedStyle(themeRoot);
996
- const style = {
997
- color: computed.color,
998
- fontFamily: computed.fontFamily,
999
- fontSize: computed.fontSize
984
+ import {
985
+ DndProvider,
986
+ DndContext,
987
+ useDrag,
988
+ useDragDropManager,
989
+ useDragLayer,
990
+ useDrop
991
+ } from "react-dnd";
992
+ import { getEmptyImage, HTML5Backend } from "react-dnd-html5-backend";
993
+ import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
994
+ var NU_DRAG_ITEM_TYPE = "reactnu-shared-item";
995
+ function getDropContext(item, element, type, clientOffset) {
996
+ return {
997
+ clientX: clientOffset?.x ?? 0,
998
+ clientY: clientOffset?.y ?? 0,
999
+ source: {
1000
+ element: item.sourceElement ?? element,
1001
+ type: item.sourceType
1002
+ },
1003
+ target: { element, type }
1000
1004
  };
1001
- for (const propertyName of computed) {
1002
- if (propertyName.startsWith("--nu-")) {
1003
- style[propertyName] = computed.getPropertyValue(propertyName).trim();
1004
- }
1005
- }
1006
- return style;
1007
1005
  }
1008
-
1009
- // src/components/DragDrop/NuDragDropProvider.tsx
1010
- import { jsx as jsx10 } from "react/jsx-runtime";
1011
- var DRAG_THRESHOLD = 3;
1012
- function createDragPreview(sourceElement) {
1013
- const rect = sourceElement.getBoundingClientRect();
1014
- const preview = sourceElement.cloneNode(true);
1015
- preview.removeAttribute("id");
1016
- preview.setAttribute("aria-hidden", "true");
1017
- Object.assign(preview.style, {
1018
- height: `${rect.height}px`,
1019
- left: `${rect.left}px`,
1020
- margin: "0",
1021
- opacity: "0.85",
1022
- pointerEvents: "none",
1023
- position: "fixed",
1024
- top: `${rect.top}px`,
1025
- width: `${rect.width}px`,
1026
- zIndex: "2147483647"
1027
- });
1028
- const themeStyle = getThemePortalStyle(sourceElement);
1029
- Object.entries(themeStyle ?? {}).forEach(([property, value]) => {
1030
- if (value !== void 0) {
1031
- preview.style.setProperty(property, String(value));
1032
- }
1033
- });
1034
- document.body.append(preview);
1035
- return preview;
1036
- }
1037
- function createController() {
1038
- const targets = /* @__PURE__ */ new Map();
1039
- let activeDrag = null;
1040
- function findTarget(clientX, clientY) {
1041
- const elementAtPoint = document.elementFromPoint(clientX, clientY);
1042
- let candidate = elementAtPoint;
1043
- while (candidate) {
1044
- const target = targets.get(candidate);
1045
- if (target) {
1046
- return target;
1047
- }
1048
- candidate = candidate.parentElement;
1049
- }
1050
- return Array.from(targets.values()).reverse().find((target) => {
1051
- const rect = target.element.getBoundingClientRect();
1052
- return clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom;
1053
- });
1054
- }
1055
- function clearActiveDrag() {
1056
- activeDrag?.preview.remove();
1057
- activeDrag = null;
1006
+ function NuDragPreviewLayer() {
1007
+ const { isDragging, item, offset } = useDragLayer((monitor) => ({
1008
+ isDragging: monitor.isDragging(),
1009
+ item: monitor.getItem() ?? null,
1010
+ offset: monitor.getClientOffset()
1011
+ }));
1012
+ if (!isDragging || !item?.preview || !offset) {
1013
+ return null;
1058
1014
  }
1059
- return {
1060
- beginDrag(item, sourceElement, sourceType) {
1061
- clearActiveDrag();
1062
- activeDrag = {
1063
- item,
1064
- preview: createDragPreview(sourceElement),
1065
- sourceElement,
1066
- sourceType
1067
- };
1068
- },
1069
- cancelDrag: clearActiveDrag,
1070
- dropAt(clientX, clientY) {
1071
- const currentDrag = activeDrag;
1072
- if (!currentDrag) {
1073
- return false;
1074
- }
1075
- const target = findTarget(clientX, clientY);
1076
- clearActiveDrag();
1077
- if (!target || target.element === currentDrag.sourceElement) {
1078
- return false;
1079
- }
1080
- if (target.accepts?.(currentDrag.item) === false) {
1081
- return false;
1082
- }
1083
- return target.onDrop(currentDrag.item, {
1084
- clientX,
1085
- clientY,
1086
- source: {
1087
- element: currentDrag.sourceElement,
1088
- type: currentDrag.sourceType
1089
- },
1090
- target: { element: target.element, type: target.type }
1091
- }) !== false;
1092
- },
1093
- moveDrag(clientX, clientY) {
1094
- const currentDrag = activeDrag;
1095
- if (!currentDrag) {
1096
- return;
1097
- }
1098
- const rect = currentDrag.sourceElement.getBoundingClientRect();
1099
- currentDrag.preview.style.left = `${Math.round(clientX - rect.width / 2)}px`;
1100
- currentDrag.preview.style.top = `${Math.round(clientY - rect.height / 2)}px`;
1101
- },
1102
- registerTarget(element, options) {
1103
- targets.set(element, { ...options, element });
1104
- return () => targets.delete(element);
1015
+ return /* @__PURE__ */ jsx10(
1016
+ "div",
1017
+ {
1018
+ "aria-hidden": "true",
1019
+ style: {
1020
+ left: 0,
1021
+ pointerEvents: "none",
1022
+ position: "fixed",
1023
+ top: 0,
1024
+ transform: `translate(${Math.round(offset.x + 12)}px, ${Math.round(offset.y + 12)}px)`,
1025
+ zIndex: 2147483647
1026
+ },
1027
+ children: item.preview
1105
1028
  }
1106
- };
1029
+ );
1107
1030
  }
1108
- var fallbackController = createController();
1109
- var NuDragDropContext = createContext(null);
1110
1031
  function NuDragDropProvider({ children }) {
1111
- const controller = useMemo2(() => createController(), []);
1112
- return /* @__PURE__ */ jsx10(NuDragDropContext.Provider, { value: controller, children });
1032
+ const { dragDropManager } = useContext(DndContext);
1033
+ if (dragDropManager) {
1034
+ return children;
1035
+ }
1036
+ return /* @__PURE__ */ jsxs6(DndProvider, { backend: HTML5Backend, children: [
1037
+ children,
1038
+ /* @__PURE__ */ jsx10(NuDragPreviewLayer, {})
1039
+ ] });
1113
1040
  }
1114
1041
  function useNuDragDrop() {
1115
- return useContext(NuDragDropContext) ?? fallbackController;
1042
+ return useDragDropManager();
1116
1043
  }
1117
1044
  function useNuDropTarget(element, options) {
1118
- const controller = useNuDragDrop();
1045
+ const [{ canDrop, isOver, item }, drop] = useDrop(
1046
+ () => ({
1047
+ accept: NU_DRAG_ITEM_TYPE,
1048
+ canDrop: (dragItem) => options ? options.accepts?.(dragItem) !== false : false,
1049
+ collect: (monitor) => ({
1050
+ canDrop: monitor.canDrop(),
1051
+ isOver: monitor.isOver({ shallow: true }),
1052
+ item: monitor.isOver({ shallow: true }) ? monitor.getItem() ?? null : null
1053
+ }),
1054
+ drop: (dragItem, monitor) => {
1055
+ if (!options || monitor.didDrop()) {
1056
+ return void 0;
1057
+ }
1058
+ const result = options.onDrop(
1059
+ dragItem,
1060
+ getDropContext(
1061
+ dragItem,
1062
+ element ?? dragItem.sourceElement ?? document.body,
1063
+ options.type,
1064
+ monitor.getClientOffset()
1065
+ )
1066
+ );
1067
+ if (result === false) {
1068
+ return { accepted: false };
1069
+ }
1070
+ return {
1071
+ ...typeof result === "object" && result ? result : {},
1072
+ accepted: true
1073
+ };
1074
+ }
1075
+ }),
1076
+ [element, options]
1077
+ );
1119
1078
  useEffect3(() => {
1120
1079
  if (!element || !options) {
1080
+ drop(null);
1121
1081
  return void 0;
1122
1082
  }
1123
- return controller.registerTarget(element, options);
1124
- }, [controller, element, options]);
1083
+ drop(element);
1084
+ return () => {
1085
+ drop(null);
1086
+ };
1087
+ }, [drop, element, options]);
1088
+ const previousItemRef = useRef4(null);
1089
+ useEffect3(() => {
1090
+ const previousItem = previousItemRef.current;
1091
+ if (isOver && item && (!previousItem || previousItem !== item)) {
1092
+ options?.onDragEnter?.(item, canDrop);
1093
+ } else if (!isOver && previousItem) {
1094
+ options?.onDragLeave?.(previousItem);
1095
+ }
1096
+ previousItemRef.current = isOver ? item : null;
1097
+ }, [canDrop, isOver, item, options]);
1098
+ return { canDrop, isOver, item };
1125
1099
  }
1126
1100
  function useNuDragSource({
1127
1101
  disabled = false,
1128
1102
  getItem,
1129
1103
  onDropAccepted,
1104
+ renderPreview,
1130
1105
  sourceType
1131
1106
  }) {
1132
- const controller = useNuDragDrop();
1133
- const stateRef = useRef4({
1134
- dragging: false,
1135
- pointerId: -1,
1136
- sourceElement: null,
1137
- startX: 0,
1138
- startY: 0
1139
- });
1140
- const state = stateRef.current;
1141
- function stop(event, shouldDrop) {
1142
- if (state.pointerId !== event.pointerId) {
1143
- return;
1144
- }
1145
- if (event.currentTarget.hasPointerCapture(event.pointerId)) {
1146
- event.currentTarget.releasePointerCapture(event.pointerId);
1147
- }
1148
- state.pointerId = -1;
1149
- if (state.dragging && shouldDrop && controller.dropAt(event.clientX, event.clientY)) {
1150
- onDropAccepted?.();
1151
- } else if (state.dragging) {
1152
- controller.cancelDrag();
1153
- }
1154
- state.dragging = false;
1155
- state.sourceElement = null;
1156
- }
1157
- return {
1158
- onPointerCancel(event) {
1159
- stop(event, false);
1160
- },
1161
- onPointerDown(event) {
1162
- if (disabled || event.button !== 0) {
1163
- return;
1164
- }
1165
- if (event.target instanceof HTMLElement && event.target.closest("button, input, select, textarea, a")) {
1166
- return;
1167
- }
1168
- state.dragging = false;
1169
- state.pointerId = event.pointerId;
1170
- state.sourceElement = event.currentTarget;
1171
- state.startX = event.clientX;
1172
- state.startY = event.clientY;
1173
- event.currentTarget.setPointerCapture(event.pointerId);
1174
- },
1175
- onPointerMove(event) {
1176
- if (state.pointerId !== event.pointerId || !state.sourceElement) {
1177
- return;
1178
- }
1179
- if (!state.dragging) {
1180
- const distance = Math.max(
1181
- Math.abs(event.clientX - state.startX),
1182
- Math.abs(event.clientY - state.startY)
1183
- );
1184
- if (distance < DRAG_THRESHOLD) {
1185
- return;
1186
- }
1107
+ const sourceElementRef = useRef4(null);
1108
+ const [{ isDragging }, drag, preview] = useDrag(
1109
+ () => ({
1110
+ type: NU_DRAG_ITEM_TYPE,
1111
+ canDrag: () => !disabled && Boolean(getItem()),
1112
+ item: () => {
1187
1113
  const item = getItem();
1188
1114
  if (!item) {
1189
- if (event.currentTarget.hasPointerCapture(event.pointerId)) {
1190
- event.currentTarget.releasePointerCapture(event.pointerId);
1191
- }
1192
- state.pointerId = -1;
1193
- state.sourceElement = null;
1194
- return;
1115
+ throw new Error("getItem must return a drag item when dragging is enabled.");
1195
1116
  }
1196
- state.dragging = true;
1197
- controller.beginDrag(item, state.sourceElement, sourceType);
1117
+ return {
1118
+ ...item,
1119
+ preview: renderPreview?.(item),
1120
+ sourceElement: sourceElementRef.current,
1121
+ sourceType
1122
+ };
1123
+ },
1124
+ end: (_item, monitor) => {
1125
+ const result = monitor.getDropResult();
1126
+ if (monitor.didDrop() && result?.accepted !== false) {
1127
+ onDropAccepted?.(result ?? {});
1128
+ }
1129
+ },
1130
+ collect: (monitor) => ({ isDragging: monitor.isDragging() })
1131
+ }),
1132
+ [disabled, getItem, onDropAccepted, renderPreview, sourceType]
1133
+ );
1134
+ const dragRef = useCallback2(
1135
+ (element) => {
1136
+ if (disabled) {
1137
+ sourceElementRef.current = null;
1138
+ drag(null);
1139
+ return;
1198
1140
  }
1199
- controller.moveDrag(event.clientX, event.clientY);
1141
+ sourceElementRef.current = element;
1142
+ drag(element);
1200
1143
  },
1201
- onPointerUp(event) {
1202
- stop(event, true);
1144
+ [disabled, drag]
1145
+ );
1146
+ useEffect3(() => {
1147
+ if (renderPreview) {
1148
+ preview(getEmptyImage(), { captureDraggingState: true });
1203
1149
  }
1204
- };
1150
+ }, [preview, renderPreview]);
1151
+ return { dragRef, isDragging };
1205
1152
  }
1206
1153
 
1207
1154
  // src/components/ListBox/internals/ListBoxCheckControl.tsx
@@ -1238,7 +1185,7 @@ function ListBoxCheckControl({
1238
1185
  }
1239
1186
 
1240
1187
  // src/components/ListBox/internals/ListBoxItemView.tsx
1241
- import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
1188
+ import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
1242
1189
  function ListBoxItemViewInner({
1243
1190
  group,
1244
1191
  getDragItem,
@@ -1252,6 +1199,7 @@ function ListBoxItemViewInner({
1252
1199
  onDoubleClick,
1253
1200
  onDragOut,
1254
1201
  onToggleCheck,
1202
+ renderDragPreview,
1255
1203
  registerItemRef,
1256
1204
  rightCheckBox,
1257
1205
  uncheckedShape
@@ -1260,6 +1208,7 @@ function ListBoxItemViewInner({
1260
1208
  disabled: item.disabled || !getDragItem,
1261
1209
  getItem: () => getDragItem?.(item, group) ?? false,
1262
1210
  onDropAccepted: () => onDragOut?.(item, group),
1211
+ renderPreview: renderDragPreview ? () => renderDragPreview(item, group) : void 0,
1263
1212
  sourceType: "listbox-item"
1264
1213
  });
1265
1214
  function handleActivate() {
@@ -1289,7 +1238,7 @@ function ListBoxItemViewInner({
1289
1238
  uncheckedShape
1290
1239
  }
1291
1240
  ) : null;
1292
- return /* @__PURE__ */ jsxs6(
1241
+ return /* @__PURE__ */ jsxs7(
1293
1242
  "div",
1294
1243
  {
1295
1244
  "aria-disabled": item.disabled || void 0,
@@ -1307,14 +1256,13 @@ function ListBoxItemViewInner({
1307
1256
  onClick: handleActivate,
1308
1257
  onContextMenu: onPopupMenu ? handleContextMenu : void 0,
1309
1258
  onDoubleClick: handleDoubleClick,
1310
- onPointerCancel: dragSource.onPointerCancel,
1311
- onPointerDown: dragSource.onPointerDown,
1312
- onPointerMove: dragSource.onPointerMove,
1313
- onPointerUp: dragSource.onPointerUp,
1314
- ref: (node) => registerItemRef(itemId, node),
1259
+ ref: (node) => {
1260
+ registerItemRef(itemId, node);
1261
+ dragSource.dragRef(node);
1262
+ },
1315
1263
  role: "option",
1316
1264
  children: [
1317
- /* @__PURE__ */ jsxs6("span", { className: "nu-listbox__item-main", children: [
1265
+ /* @__PURE__ */ jsxs7("span", { className: "nu-listbox__item-main", children: [
1318
1266
  rightCheckBox ? null : checkControl,
1319
1267
  renderLabel(item.name, "nu-listbox__item-label")
1320
1268
  ] }),
@@ -1327,7 +1275,7 @@ function ListBoxItemViewInner({
1327
1275
  var ListBoxItemView = memo(ListBoxItemViewInner);
1328
1276
 
1329
1277
  // src/components/ListBox/internals/ListBoxGroupView.tsx
1330
- import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
1278
+ import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
1331
1279
  function ListBoxGroupView({
1332
1280
  group,
1333
1281
  groupIndex,
@@ -1337,6 +1285,7 @@ function ListBoxGroupView({
1337
1285
  onActivateItem,
1338
1286
  onDoubleClickItem,
1339
1287
  onItemDragOut,
1288
+ renderDragPreview,
1340
1289
  onPopupMenuItem,
1341
1290
  onToggleItemCheck,
1342
1291
  registerItemRef,
@@ -1345,7 +1294,7 @@ function ListBoxGroupView({
1345
1294
  selectedId,
1346
1295
  uncheckedShape
1347
1296
  }) {
1348
- return /* @__PURE__ */ jsxs7("div", { className: "nu-listbox__group", role: "group", children: [
1297
+ return /* @__PURE__ */ jsxs8("div", { className: "nu-listbox__group", role: "group", children: [
1349
1298
  group.category ? /* @__PURE__ */ jsx13(ListBoxCategoryView, { category: group.category }) : null,
1350
1299
  group.items.map((item, itemIndex) => {
1351
1300
  const itemId = buildListBoxItemId(
@@ -1371,6 +1320,7 @@ function ListBoxGroupView({
1371
1320
  onActivate: onActivateItem,
1372
1321
  onDoubleClick: onDoubleClickItem,
1373
1322
  onDragOut: onItemDragOut,
1323
+ renderDragPreview,
1374
1324
  onPopupMenu: onPopupMenuItem,
1375
1325
  onToggleCheck: onToggleItemCheck,
1376
1326
  registerItemRef,
@@ -1398,6 +1348,7 @@ function ListBoxInner({
1398
1348
  onItemDragOut,
1399
1349
  onItemSelect,
1400
1350
  onDrop,
1351
+ renderDragPreview,
1401
1352
  rightCheckBox = false,
1402
1353
  selectedId,
1403
1354
  uncheckedShape = "box",
@@ -1408,23 +1359,23 @@ function ListBoxInner({
1408
1359
  const [rootElement, setRootElement] = useState5(null);
1409
1360
  const listboxId = useId();
1410
1361
  const itemRefs = useRef5({});
1411
- const flattenedItems = useMemo3(
1362
+ const flattenedItems = useMemo2(
1412
1363
  () => flattenListBoxData(data, listboxId),
1413
1364
  [data, listboxId]
1414
1365
  );
1415
- const selectableItems = useMemo3(
1366
+ const selectableItems = useMemo2(
1416
1367
  () => flattenedItems.filter(({ item }) => !item.disabled),
1417
1368
  [flattenedItems]
1418
1369
  );
1419
1370
  const [activeId, setActiveId] = useState5(
1420
1371
  () => getInitialActiveId(selectableItems, selectedId)
1421
1372
  );
1422
- const dropTargetOptions = useMemo3(
1373
+ const dropTargetOptions = useMemo2(
1423
1374
  () => onDrop ? { accepts: acceptsDrop, onDrop, type: "listbox" } : void 0,
1424
1375
  [acceptsDrop, onDrop]
1425
1376
  );
1426
1377
  useNuDropTarget(rootElement, dropTargetOptions);
1427
- const setRootRef = useCallback2((node) => {
1378
+ const setRootRef = useCallback3((node) => {
1428
1379
  rootRef.current = node;
1429
1380
  setRootElement(node);
1430
1381
  }, []);
@@ -1437,20 +1388,20 @@ function ListBoxInner({
1437
1388
  block: "nearest"
1438
1389
  });
1439
1390
  }, [resolvedActiveId]);
1440
- const registerItemRef = useCallback2(
1391
+ const registerItemRef = useCallback3(
1441
1392
  (itemId, node) => {
1442
1393
  itemRefs.current[itemId] = node;
1443
1394
  },
1444
1395
  []
1445
1396
  );
1446
- const activateItem = useCallback2(
1397
+ const activateItem = useCallback3(
1447
1398
  (item, group, itemId) => {
1448
1399
  setActiveId(itemId);
1449
1400
  onItemSelect?.(item, group);
1450
1401
  },
1451
1402
  [onItemSelect]
1452
1403
  );
1453
- const activateResolvedItem = useCallback2(
1404
+ const activateResolvedItem = useCallback3(
1454
1405
  (itemId) => {
1455
1406
  if (!itemId) {
1456
1407
  return;
@@ -1464,7 +1415,7 @@ function ListBoxInner({
1464
1415
  },
1465
1416
  [activateItem, selectableItems]
1466
1417
  );
1467
- const handleItemPopupMenu = useCallback2(
1418
+ const handleItemPopupMenu = useCallback3(
1468
1419
  (event, item, group, itemId) => {
1469
1420
  if (item.disabled || !onPopupMenu) {
1470
1421
  return;
@@ -1504,7 +1455,7 @@ function ListBoxInner({
1504
1455
  function isItemChecked(item) {
1505
1456
  return getListBoxItemChecked(item, checkedIds);
1506
1457
  }
1507
- const toggleItemCheck = useCallback2(
1458
+ const toggleItemCheck = useCallback3(
1508
1459
  (itemId) => {
1509
1460
  const activeEntry = flattenedItems.find(
1510
1461
  (entry) => entry.itemId === itemId
@@ -1600,6 +1551,7 @@ function ListBoxInner({
1600
1551
  onItemDragOut,
1601
1552
  onPopupMenuItem: handleItemPopupMenu,
1602
1553
  onToggleItemCheck: toggleItemCheck,
1554
+ renderDragPreview,
1603
1555
  registerItemRef,
1604
1556
  resolvedActiveId,
1605
1557
  rightCheckBox,
@@ -1611,7 +1563,10 @@ function ListBoxInner({
1611
1563
  }
1612
1564
  );
1613
1565
  }
1614
- var ListBox = forwardRef(ListBoxInner);
1566
+ function ListBoxWithDragDrop(props, ref) {
1567
+ return /* @__PURE__ */ jsx14(NuDragDropProvider, { children: ListBoxInner(props, ref) });
1568
+ }
1569
+ var ListBox = forwardRef(ListBoxWithDragDrop);
1615
1570
 
1616
1571
  // src/components/Stack/Stack.tsx
1617
1572
  import { jsx as jsx15 } from "react/jsx-runtime";
@@ -1663,7 +1618,7 @@ function Stack({
1663
1618
  }
1664
1619
 
1665
1620
  // src/windowing/internals/MdiWindowPickerDialog.tsx
1666
- import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
1621
+ import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
1667
1622
  function isPickerEligibleWindow(windowEntry) {
1668
1623
  if (windowEntry.mode === "window") {
1669
1624
  return true;
@@ -1697,7 +1652,7 @@ function MdiWindowPickerDialog({
1697
1652
  onClose,
1698
1653
  windows
1699
1654
  }) {
1700
- const resolvedWindows = useMemo4(
1655
+ const resolvedWindows = useMemo3(
1701
1656
  () => windows.filter(
1702
1657
  (windowEntry) => isPickerEligibleWindow(windowEntry) && (!domain || windowEntry.domain === domain)
1703
1658
  ),
@@ -1716,7 +1671,7 @@ function MdiWindowPickerDialog({
1716
1671
  onActivateWindow(resolvedSelectedId);
1717
1672
  onClose();
1718
1673
  }
1719
- return /* @__PURE__ */ jsxs8(Stack, { gap: "md", children: [
1674
+ return /* @__PURE__ */ jsxs9(Stack, { gap: "md", children: [
1720
1675
  /* @__PURE__ */ jsx16(
1721
1676
  ListBox,
1722
1677
  {
@@ -1752,7 +1707,7 @@ function MdiWindowPickerDialog({
1752
1707
  }
1753
1708
  }
1754
1709
  ),
1755
- /* @__PURE__ */ jsxs8(Stack, { direction: "row", gap: "sm", children: [
1710
+ /* @__PURE__ */ jsxs9(Stack, { direction: "row", gap: "sm", children: [
1756
1711
  /* @__PURE__ */ jsx16(Button, { defaultFocused: true, onClick: handleActivate, children: "Activate" }),
1757
1712
  /* @__PURE__ */ jsx16(Button, { onClick: onClose, variant: "secondary", children: "Cancel" })
1758
1713
  ] })
@@ -1887,8 +1842,8 @@ function resolveMdiMainMenuItems(items, bridge) {
1887
1842
  }
1888
1843
 
1889
1844
  // src/appHost/appHostContext.ts
1890
- import { createContext as createContext2, useContext as useContext2 } from "react";
1891
- var AppHostMenuContext = createContext2(
1845
+ import { createContext, useContext as useContext2 } from "react";
1846
+ var AppHostMenuContext = createContext(
1892
1847
  null
1893
1848
  );
1894
1849
  function useAppHostMenu() {
@@ -1917,7 +1872,7 @@ function useAppHostMenu() {
1917
1872
  }
1918
1873
 
1919
1874
  // src/appHost/NuAppHostProvider.tsx
1920
- import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
1875
+ import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
1921
1876
  function NuAppHostProvider({
1922
1877
  children,
1923
1878
  renderMenu = true
@@ -1926,11 +1881,11 @@ function NuAppHostProvider({
1926
1881
  const [windowBridge, setWindowBridge] = useState7(
1927
1882
  null
1928
1883
  );
1929
- const resolvedMainMenu = useMemo5(
1884
+ const resolvedMainMenu = useMemo4(
1930
1885
  () => resolveMdiMainMenuItems(menuState.mainMenu, windowBridge),
1931
1886
  [menuState.mainMenu, windowBridge]
1932
1887
  );
1933
- const contextValue = useMemo5(
1888
+ const contextValue = useMemo4(
1934
1889
  () => ({
1935
1890
  ...menuState,
1936
1891
  setWindowBridge,
@@ -1938,7 +1893,7 @@ function NuAppHostProvider({
1938
1893
  }),
1939
1894
  [menuState, windowBridge]
1940
1895
  );
1941
- return /* @__PURE__ */ jsxs9(AppHostMenuContext.Provider, { value: contextValue, children: [
1896
+ return /* @__PURE__ */ jsxs10(AppHostMenuContext.Provider, { value: contextValue, children: [
1942
1897
  renderMenu && hasVisibleMainMenuItems(resolvedMainMenu) ? /* @__PURE__ */ jsx18(MainMenu, { items: resolvedMainMenu }) : null,
1943
1898
  children
1944
1899
  ] });
@@ -1947,10 +1902,10 @@ function NuAppHostProvider({
1947
1902
  // src/windowing/NuWindowProvider.tsx
1948
1903
  import {
1949
1904
  Fragment as Fragment3,
1950
- useCallback as useCallback3,
1905
+ useCallback as useCallback4,
1951
1906
  useContext as useContext7,
1952
1907
  useEffect as useEffect6,
1953
- useMemo as useMemo7,
1908
+ useMemo as useMemo6,
1954
1909
  useRef as useRef8,
1955
1910
  useState as useState10
1956
1911
  } from "react";
@@ -1960,7 +1915,7 @@ import {
1960
1915
  memo as memo2,
1961
1916
  useContext as useContext5,
1962
1917
  useLayoutEffect as useLayoutEffect2,
1963
- useMemo as useMemo6,
1918
+ useMemo as useMemo5,
1964
1919
  useRef as useRef6
1965
1920
  } from "react";
1966
1921
 
@@ -1992,7 +1947,7 @@ function StatusBarItem({
1992
1947
  }
1993
1948
 
1994
1949
  // src/components/Window/internals/WindowStatusBar.tsx
1995
- import { jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
1950
+ import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
1996
1951
  function WindowStatusBar({
1997
1952
  children,
1998
1953
  onResizeStart,
@@ -2003,7 +1958,7 @@ function WindowStatusBar({
2003
1958
  const hasCustomItems = resolvedChildren.some(
2004
1959
  (child) => typeof child !== "string" && typeof child !== "number"
2005
1960
  );
2006
- return /* @__PURE__ */ jsxs10(
1961
+ return /* @__PURE__ */ jsxs11(
2007
1962
  "footer",
2008
1963
  {
2009
1964
  className: ["nu-window__status-bar", statusBarClassName].filter(Boolean).join(" "),
@@ -2077,7 +2032,7 @@ function WindowTitleButton({
2077
2032
  }
2078
2033
 
2079
2034
  // src/components/Window/internals/WindowTitleBar.tsx
2080
- import { jsx as jsx22, jsxs as jsxs11 } from "react/jsx-runtime";
2035
+ import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
2081
2036
  function WindowTitleBar({
2082
2037
  draggable,
2083
2038
  icon,
@@ -2086,7 +2041,7 @@ function WindowTitleBar({
2086
2041
  title
2087
2042
  }) {
2088
2043
  const controlsWidth = titleButtons.length > 0 ? `calc(${titleButtons.length} * 0.95rem + ${Math.max(0, titleButtons.length - 1) * 0.35}rem + 0.7rem)` : "0.45rem";
2089
- return /* @__PURE__ */ jsxs11(
2044
+ return /* @__PURE__ */ jsxs12(
2090
2045
  "header",
2091
2046
  {
2092
2047
  className: "nu-window__title-bar",
@@ -2155,8 +2110,8 @@ function useWindowTitleButtons({
2155
2110
  }
2156
2111
 
2157
2112
  // src/windowing/windowContext.ts
2158
- import { createContext as createContext3, useContext as useContext3 } from "react";
2159
- var NuWindowContext = createContext3(null);
2113
+ import { createContext as createContext2, useContext as useContext3 } from "react";
2114
+ var NuWindowContext = createContext2(null);
2160
2115
  function useNuWindowManager() {
2161
2116
  const context = useContext3(NuWindowContext);
2162
2117
  if (!context) {
@@ -2168,8 +2123,8 @@ function useNuWindowManager() {
2168
2123
  }
2169
2124
 
2170
2125
  // src/components/Window/windowMenuContext.ts
2171
- import { createContext as createContext4, useContext as useContext4 } from "react";
2172
- var WindowMenuContext = createContext4(null);
2126
+ import { createContext as createContext3, useContext as useContext4 } from "react";
2127
+ var WindowMenuContext = createContext3(null);
2173
2128
  function useWindowMenu() {
2174
2129
  const context = useContext4(WindowMenuContext);
2175
2130
  if (!context) {
@@ -2179,7 +2134,7 @@ function useWindowMenu() {
2179
2134
  }
2180
2135
 
2181
2136
  // src/components/Window/Window.tsx
2182
- import { jsx as jsx23, jsxs as jsxs12 } from "react/jsx-runtime";
2137
+ import { jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
2183
2138
  function getWindowLayerBounds(node) {
2184
2139
  const parentNode = node.parentElement;
2185
2140
  if (!parentNode) {
@@ -2246,7 +2201,7 @@ function WindowInner({
2246
2201
  const isMaximizable = resolvedAspectRatio === void 0 && (maximizable ?? mode === "window");
2247
2202
  const isMinimizable = minimizable ?? mode === "window";
2248
2203
  const isResizable = resizable ?? mode === "window";
2249
- const mdiBridge = useMemo6(
2204
+ const mdiBridge = useMemo5(
2250
2205
  () => ({
2251
2206
  activateWindow: windowManager?.activateWindow ?? (() => void 0),
2252
2207
  openDialog: windowManager?.openDialog ?? (() => ""),
@@ -2254,7 +2209,7 @@ function WindowInner({
2254
2209
  }),
2255
2210
  [windowManager?.activateWindow, windowManager?.openDialog, windowManager?.windows]
2256
2211
  );
2257
- const resolvedMainMenu = useMemo6(
2212
+ const resolvedMainMenu = useMemo5(
2258
2213
  () => resolveMdiMainMenuItems(menuState.mainMenu, mdiBridge),
2259
2214
  [menuState.mainMenu, mdiBridge]
2260
2215
  );
@@ -2465,7 +2420,7 @@ function WindowInner({
2465
2420
  window.addEventListener("pointermove", handlePointerMove);
2466
2421
  window.addEventListener("pointerup", handlePointerUp);
2467
2422
  }
2468
- return /* @__PURE__ */ jsxs12(
2423
+ return /* @__PURE__ */ jsxs13(
2469
2424
  "section",
2470
2425
  {
2471
2426
  ...props,
@@ -2496,7 +2451,7 @@ function WindowInner({
2496
2451
  className: "nu-window__shadow nu-window__shadow--bottom"
2497
2452
  }
2498
2453
  ),
2499
- /* @__PURE__ */ jsxs12(WindowMenuContext.Provider, { value: menuState, children: [
2454
+ /* @__PURE__ */ jsxs13(WindowMenuContext.Provider, { value: menuState, children: [
2500
2455
  /* @__PURE__ */ jsx23(
2501
2456
  WindowTitleBar,
2502
2457
  {
@@ -2628,7 +2583,7 @@ function AppBarItem(props) {
2628
2583
  }
2629
2584
 
2630
2585
  // src/windowing/WindowBar.tsx
2631
- import { jsx as jsx25, jsxs as jsxs13 } from "react/jsx-runtime";
2586
+ import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
2632
2587
  function buildWindowBarGroups(items) {
2633
2588
  const groups = [];
2634
2589
  const groupsByDomain = /* @__PURE__ */ new Map();
@@ -2711,7 +2666,7 @@ function WindowBar({ items, onActivateWindow }) {
2711
2666
  }
2712
2667
  return /* @__PURE__ */ jsx25("div", { className: "nu-window-bar", role: "group", "aria-label": "Open windows", children: groups.map((group) => {
2713
2668
  const icon = getGroupIcon(group);
2714
- return /* @__PURE__ */ jsxs13(
2669
+ return /* @__PURE__ */ jsxs14(
2715
2670
  AppBarItem,
2716
2671
  {
2717
2672
  active: group.active,
@@ -2738,7 +2693,7 @@ import {
2738
2693
  useRef as useRef7,
2739
2694
  useState as useState8
2740
2695
  } from "react";
2741
- import { jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
2696
+ import { jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
2742
2697
  function TextField({
2743
2698
  className,
2744
2699
  debounceMs = 0,
@@ -2789,7 +2744,7 @@ function TextField({
2789
2744
  }
2790
2745
  onChange?.(event);
2791
2746
  }
2792
- return /* @__PURE__ */ jsxs14(
2747
+ return /* @__PURE__ */ jsxs15(
2793
2748
  "label",
2794
2749
  {
2795
2750
  className: cx("nu-text-field", slotClassNames?.root, className),
@@ -2804,7 +2759,7 @@ function TextField({
2804
2759
  children: renderMnemonicText(label)
2805
2760
  }
2806
2761
  ),
2807
- /* @__PURE__ */ jsxs14(
2762
+ /* @__PURE__ */ jsxs15(
2808
2763
  "span",
2809
2764
  {
2810
2765
  className: cx("nu-text-field__slot", slotClassNames?.slot),
@@ -2896,7 +2851,7 @@ function NuView({
2896
2851
  }
2897
2852
 
2898
2853
  // src/windowing/dialogHelpers.tsx
2899
- import { jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
2854
+ import { jsx as jsx28, jsxs as jsxs16 } from "react/jsx-runtime";
2900
2855
  function getPresetButtons(preset) {
2901
2856
  switch (preset) {
2902
2857
  case "ok-cancel":
@@ -2999,7 +2954,7 @@ function MessageBoxDialogContent({
2999
2954
  const bodyStyle = kind === "error" ? {
3000
2955
  background: "var(--nu-color-button-danger)"
3001
2956
  } : void 0;
3002
- return /* @__PURE__ */ jsx28(NuView, { padding: "cell", style: bodyStyle, children: /* @__PURE__ */ jsxs15(Stack, { gap: "md", children: [
2957
+ return /* @__PURE__ */ jsx28(NuView, { padding: "cell", style: bodyStyle, children: /* @__PURE__ */ jsxs16(Stack, { gap: "md", children: [
3003
2958
  /* @__PURE__ */ jsx28(
3004
2959
  "div",
3005
2960
  {
@@ -3009,7 +2964,7 @@ function MessageBoxDialogContent({
3009
2964
  children: message
3010
2965
  }
3011
2966
  ),
3012
- /* @__PURE__ */ jsxs15(Stack, { direction: "row", gap: "sm", justify: "center", children: [
2967
+ /* @__PURE__ */ jsxs16(Stack, { direction: "row", gap: "sm", justify: "center", children: [
3013
2968
  ok ? /* @__PURE__ */ jsx28(
3014
2969
  Button,
3015
2970
  {
@@ -3059,7 +3014,7 @@ function InputBoxDialogContent({
3059
3014
  placeholder
3060
3015
  }) {
3061
3016
  const [value, setValue] = useState9(defaultValue ?? "");
3062
- return /* @__PURE__ */ jsx28(NuView, { padding: "cell", children: /* @__PURE__ */ jsxs15(Stack, { gap: "md", children: [
3017
+ return /* @__PURE__ */ jsx28(NuView, { padding: "cell", children: /* @__PURE__ */ jsxs16(Stack, { gap: "md", children: [
3063
3018
  /* @__PURE__ */ jsx28(
3064
3019
  TextField,
3065
3020
  {
@@ -3071,7 +3026,7 @@ function InputBoxDialogContent({
3071
3026
  placeholder
3072
3027
  }
3073
3028
  ),
3074
- /* @__PURE__ */ jsxs15(Stack, { direction: "row", gap: "sm", justify: "center", children: [
3029
+ /* @__PURE__ */ jsxs16(Stack, { direction: "row", gap: "sm", justify: "center", children: [
3075
3030
  /* @__PURE__ */ jsx28(
3076
3031
  Button,
3077
3032
  {
@@ -3095,7 +3050,7 @@ function InputBoxDialogContent({
3095
3050
  }
3096
3051
 
3097
3052
  // src/windowing/NuWindowProvider.tsx
3098
- import { jsx as jsx29, jsxs as jsxs16 } from "react/jsx-runtime";
3053
+ import { jsx as jsx29, jsxs as jsxs17 } from "react/jsx-runtime";
3099
3054
  function getDefaultWindowStyle(mode, index) {
3100
3055
  const offset = index * 18;
3101
3056
  return {
@@ -3117,28 +3072,93 @@ function getNumericStyleValue(value) {
3117
3072
  }
3118
3073
  return void 0;
3119
3074
  }
3075
+ function getWindowStorageKey(windowStoreKey) {
3076
+ const normalizedKey = windowStoreKey?.trim();
3077
+ return normalizedKey ? `reactnu.window.${normalizedKey}` : null;
3078
+ }
3079
+ function readStoredWindowSnapshot(windowStoreKey) {
3080
+ const storageKey = getWindowStorageKey(windowStoreKey);
3081
+ if (!storageKey || typeof window === "undefined") {
3082
+ return void 0;
3083
+ }
3084
+ try {
3085
+ const rawValue = window.localStorage.getItem(storageKey);
3086
+ if (!rawValue) {
3087
+ return void 0;
3088
+ }
3089
+ const parsedValue = JSON.parse(rawValue);
3090
+ if (!parsedValue || typeof parsedValue !== "object") {
3091
+ return void 0;
3092
+ }
3093
+ const storedValue = parsedValue;
3094
+ const snapshot = {};
3095
+ for (const property of ["height", "width"]) {
3096
+ const value = storedValue[property];
3097
+ if (typeof value === "number" && Number.isFinite(value) && value > 0) {
3098
+ snapshot[property] = value;
3099
+ }
3100
+ }
3101
+ for (const property of ["left", "top"]) {
3102
+ const value = storedValue[property];
3103
+ if (typeof value === "number" && Number.isFinite(value) && value >= 0) {
3104
+ snapshot[property] = value;
3105
+ }
3106
+ }
3107
+ for (const property of ["maximized", "minimized"]) {
3108
+ const value = storedValue[property];
3109
+ if (typeof value === "boolean") {
3110
+ snapshot[property] = value;
3111
+ }
3112
+ }
3113
+ return Object.keys(snapshot).length > 0 ? snapshot : void 0;
3114
+ } catch {
3115
+ return void 0;
3116
+ }
3117
+ }
3118
+ function writeStoredWindowSnapshot(windowStoreKey, snapshot) {
3119
+ const storageKey = getWindowStorageKey(windowStoreKey);
3120
+ if (!storageKey || typeof window === "undefined") {
3121
+ return;
3122
+ }
3123
+ try {
3124
+ window.localStorage.setItem(storageKey, JSON.stringify(snapshot));
3125
+ } catch {
3126
+ }
3127
+ }
3120
3128
  function resolveSavedWindowStyle(definition, mode, ownerCenteredStyle, index) {
3121
- const snapshot = definition.onOpen?.();
3122
- const savedStyle = snapshot ? {
3123
- height: snapshot.height,
3124
- left: snapshot.left,
3125
- top: snapshot.top,
3126
- transform: snapshot.left !== void 0 || snapshot.top !== void 0 ? "none" : void 0,
3127
- width: snapshot.width
3128
- } : void 0;
3129
+ const snapshot = definition.onOpen?.() ?? readStoredWindowSnapshot(definition.windowStoreKey);
3130
+ const savedStyle = {};
3131
+ if (snapshot) {
3132
+ if (snapshot.height !== void 0) {
3133
+ savedStyle.height = snapshot.height;
3134
+ }
3135
+ if (snapshot.left !== void 0) {
3136
+ savedStyle.left = snapshot.left;
3137
+ }
3138
+ if (snapshot.top !== void 0) {
3139
+ savedStyle.top = snapshot.top;
3140
+ }
3141
+ if (snapshot.width !== void 0) {
3142
+ savedStyle.width = snapshot.width;
3143
+ }
3144
+ if (snapshot.left !== void 0 || snapshot.top !== void 0) {
3145
+ savedStyle.transform = "none";
3146
+ }
3147
+ }
3129
3148
  return {
3130
3149
  maximized: snapshot?.maximized === true,
3131
3150
  minimized: snapshot?.minimized === true,
3132
- restoreStyle: snapshot?.maximized === true && savedStyle ? {
3151
+ restoreStyle: snapshot?.maximized ? {
3133
3152
  ...getDefaultWindowStyle(mode, index),
3134
3153
  ...ownerCenteredStyle,
3154
+ ...definition.style,
3135
3155
  ...savedStyle
3136
3156
  } : void 0,
3137
3157
  style: {
3138
3158
  ...getDefaultWindowStyle(mode, index),
3139
3159
  ...ownerCenteredStyle,
3140
- ...savedStyle,
3141
- ...definition.style
3160
+ ...definition.style,
3161
+ ...savedStyle
3142
3162
  }
3143
3163
  };
3144
3164
  }
@@ -3246,11 +3266,11 @@ function NuWindowProvider({
3246
3266
  const [windows, setWindows] = useState10([]);
3247
3267
  const [windowBoundsById, setWindowBoundsById] = useState10({});
3248
3268
  const appHostMenuContext = useContext7(AppHostMenuContext);
3249
- const nextId = useCallback3(() => {
3269
+ const nextId = useCallback4(() => {
3250
3270
  idRef.current += 1;
3251
3271
  return `nu-window-${idRef.current}`;
3252
3272
  }, []);
3253
- const closeWindow = useCallback3((id) => {
3273
+ const closeWindow = useCallback4((id) => {
3254
3274
  setWindows((currentWindows) => {
3255
3275
  const closingWindow = currentWindows.find(
3256
3276
  (windowEntry) => windowEntry.id === id
@@ -3278,7 +3298,7 @@ function NuWindowProvider({
3278
3298
  return nextBounds;
3279
3299
  });
3280
3300
  }, []);
3281
- const updateWindowBounds = useCallback3(
3301
+ const updateWindowBounds = useCallback4(
3282
3302
  (id, bounds) => {
3283
3303
  setWindowBoundsById((currentBounds) => {
3284
3304
  const previousBounds = currentBounds[id];
@@ -3295,7 +3315,7 @@ function NuWindowProvider({
3295
3315
  },
3296
3316
  []
3297
3317
  );
3298
- const bringToFront = useCallback3((id) => {
3318
+ const bringToFront = useCallback4((id) => {
3299
3319
  setWindows((currentWindows) => {
3300
3320
  const activationChain = getActivationChain(currentWindows, id);
3301
3321
  if (activationChain.length === 0) {
@@ -3311,7 +3331,7 @@ function NuWindowProvider({
3311
3331
  ];
3312
3332
  });
3313
3333
  }, []);
3314
- const activateWindow = useCallback3((id) => {
3334
+ const activateWindow = useCallback4((id) => {
3315
3335
  setWindows((currentWindows) => {
3316
3336
  const activationChain = getActivationChain(currentWindows, id);
3317
3337
  if (activationChain.length === 0) {
@@ -3332,7 +3352,7 @@ function NuWindowProvider({
3332
3352
  ];
3333
3353
  });
3334
3354
  }, []);
3335
- const updateWindow = useCallback3(
3355
+ const updateWindow = useCallback4(
3336
3356
  (id, patch) => {
3337
3357
  setWindows(
3338
3358
  (currentWindows) => currentWindows.map((windowEntry) => {
@@ -3352,7 +3372,7 @@ function NuWindowProvider({
3352
3372
  },
3353
3373
  []
3354
3374
  );
3355
- const updateWindowPosition = useCallback3(
3375
+ const updateWindowPosition = useCallback4(
3356
3376
  (id, position) => {
3357
3377
  setWindows(
3358
3378
  (currentWindows) => currentWindows.map(
@@ -3370,7 +3390,7 @@ function NuWindowProvider({
3370
3390
  },
3371
3391
  []
3372
3392
  );
3373
- const updateWindowSize = useCallback3(
3393
+ const updateWindowSize = useCallback4(
3374
3394
  (id, width, height) => {
3375
3395
  setWindows(
3376
3396
  (currentWindows) => currentWindows.map(
@@ -3388,11 +3408,11 @@ function NuWindowProvider({
3388
3408
  },
3389
3409
  []
3390
3410
  );
3391
- const handleWindowSizeChange = useCallback3(
3411
+ const handleWindowSizeChange = useCallback4(
3392
3412
  (id, size) => updateWindowSize(id, size.width, size.height),
3393
3413
  [updateWindowSize]
3394
3414
  );
3395
- const toggleWindowMinimized = useCallback3((id) => {
3415
+ const toggleWindowMinimized = useCallback4((id) => {
3396
3416
  setWindows(
3397
3417
  (currentWindows) => currentWindows.map(
3398
3418
  (windowEntry) => windowEntry.id === id ? {
@@ -3402,7 +3422,7 @@ function NuWindowProvider({
3402
3422
  )
3403
3423
  );
3404
3424
  }, []);
3405
- const toggleWindowMaximized = useCallback3((id) => {
3425
+ const toggleWindowMaximized = useCallback4((id) => {
3406
3426
  setWindows(
3407
3427
  (currentWindows) => currentWindows.map((windowEntry) => {
3408
3428
  if (windowEntry.id !== id || !windowEntry.maximizable) {
@@ -3435,7 +3455,7 @@ function NuWindowProvider({
3435
3455
  })
3436
3456
  );
3437
3457
  }, []);
3438
- const openManagedWindow = useCallback3(
3458
+ const openManagedWindow = useCallback4(
3439
3459
  (definition, mode) => {
3440
3460
  const id = nextId();
3441
3461
  creationOrderRef.current += 1;
@@ -3456,7 +3476,7 @@ function NuWindowProvider({
3456
3476
  },
3457
3477
  [nextId]
3458
3478
  );
3459
- const closeAll = useCallback3(() => {
3479
+ const closeAll = useCallback4(() => {
3460
3480
  setWindows(
3461
3481
  (currentWindows) => currentWindows.filter((windowEntry) => {
3462
3482
  const canClose = windowEntry.onClose?.(
@@ -3466,15 +3486,15 @@ function NuWindowProvider({
3466
3486
  })
3467
3487
  );
3468
3488
  }, []);
3469
- const openDialog = useCallback3(
3489
+ const openDialog = useCallback4(
3470
3490
  (definition) => openManagedWindow(definition, "dialog"),
3471
3491
  [openManagedWindow]
3472
3492
  );
3473
- const openWindow = useCallback3(
3493
+ const openWindow = useCallback4(
3474
3494
  (definition) => openManagedWindow(definition, "window"),
3475
3495
  [openManagedWindow]
3476
3496
  );
3477
- const showMessageBox = useCallback3(
3497
+ const showMessageBox = useCallback4(
3478
3498
  (options) => new Promise((resolve) => {
3479
3499
  const buttons = getResolvedMessageBoxButtons(options);
3480
3500
  const labels = getResolvedMessageBoxLabels(options);
@@ -3520,7 +3540,7 @@ function NuWindowProvider({
3520
3540
  }),
3521
3541
  [openDialog]
3522
3542
  );
3523
- const showInputBox = useCallback3(
3543
+ const showInputBox = useCallback4(
3524
3544
  (options) => new Promise((resolve) => {
3525
3545
  let settled = false;
3526
3546
  function resolveOnce(value) {
@@ -3574,11 +3594,11 @@ function NuWindowProvider({
3574
3594
  const activeWindow = activeWindowId ? windows.find((windowEntry) => windowEntry.id === activeWindowId) : void 0;
3575
3595
  const activeActivationGroup = topmostAppModalIndex >= 0 ? void 0 : activeWindow?.activationGroup;
3576
3596
  const hasAppModal = topmostAppModalIndex >= 0;
3577
- const isWindowActive = useCallback3(
3597
+ const isWindowActive = useCallback4(
3578
3598
  (windowEntry) => windowEntry.id === activeWindowId || activeActivationGroup !== void 0 && windowEntry.activationGroup === activeActivationGroup,
3579
3599
  [activeActivationGroup, activeWindowId]
3580
3600
  );
3581
- const windowsInfo = useMemo7(
3601
+ const windowsInfo = useMemo6(
3582
3602
  () => [...windows].sort(
3583
3603
  (leftWindow, rightWindow) => leftWindow.creationOrder - rightWindow.creationOrder
3584
3604
  ).map((windowEntry) => ({
@@ -3609,7 +3629,7 @@ function NuWindowProvider({
3609
3629
  })),
3610
3630
  [isWindowActive, windows]
3611
3631
  );
3612
- const mdiBridge = useMemo7(
3632
+ const mdiBridge = useMemo6(
3613
3633
  () => ({
3614
3634
  activateWindow,
3615
3635
  openDialog,
@@ -3617,7 +3637,7 @@ function NuWindowProvider({
3617
3637
  }),
3618
3638
  [activateWindow, openDialog, windowsInfo]
3619
3639
  );
3620
- const contextValue = useMemo7(
3640
+ const contextValue = useMemo6(
3621
3641
  () => ({
3622
3642
  activateWindow,
3623
3643
  bringToFront,
@@ -3664,7 +3684,18 @@ function NuWindowProvider({
3664
3684
  useEffect6(() => {
3665
3685
  onAppModalChange?.(hasAppModal);
3666
3686
  }, [hasAppModal, onAppModalChange]);
3667
- return /* @__PURE__ */ jsx29(NuWindowContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs16("div", { className: ["nu-window-host", className].filter(Boolean).join(" "), children: [
3687
+ useEffect6(() => {
3688
+ for (const windowEntry of windows) {
3689
+ if (!windowEntry.windowStoreKey) {
3690
+ continue;
3691
+ }
3692
+ writeStoredWindowSnapshot(
3693
+ windowEntry.windowStoreKey,
3694
+ resolveManagedWindowSnapshot(windowEntry, windowBoundsById)
3695
+ );
3696
+ }
3697
+ }, [windowBoundsById, windows]);
3698
+ return /* @__PURE__ */ jsx29(NuWindowContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs17("div", { className: ["nu-window-host", className].filter(Boolean).join(" "), children: [
3668
3699
  children,
3669
3700
  /* @__PURE__ */ jsx29("div", { className: "nu-window-layer", children: renderWindows.map((windowEntry) => {
3670
3701
  const isActiveWindow = isWindowActive(windowEntry);
@@ -3695,7 +3726,7 @@ function NuWindowProvider({
3695
3726
  update: handleUpdate
3696
3727
  };
3697
3728
  const content = typeof windowEntry.content === "function" ? windowEntry.content(controls) : windowEntry.content;
3698
- return /* @__PURE__ */ jsxs16(Fragment3, { children: [
3729
+ return /* @__PURE__ */ jsxs17(Fragment3, { children: [
3699
3730
  isTopmostAppModal ? /* @__PURE__ */ jsx29(
3700
3731
  "div",
3701
3732
  {
@@ -3764,9 +3795,9 @@ function NuWindowProvider({
3764
3795
  }
3765
3796
 
3766
3797
  // src/components/Desktop/Desktop.tsx
3767
- import { jsx as jsx30, jsxs as jsxs17 } from "react/jsx-runtime";
3798
+ import { jsx as jsx30, jsxs as jsxs18 } from "react/jsx-runtime";
3768
3799
  function DesktopWindowRegion({ appBar, children }) {
3769
- return /* @__PURE__ */ jsxs17(Fragment4, { children: [
3800
+ return /* @__PURE__ */ jsxs18(Fragment4, { children: [
3770
3801
  /* @__PURE__ */ jsx30("div", { className: "nu-desktop__workspace", children }),
3771
3802
  appBar ? /* @__PURE__ */ jsx30("div", { className: "nu-desktop__app-bar", children: appBar }) : null
3772
3803
  ] });
@@ -3811,7 +3842,7 @@ function NuDesktopShell({
3811
3842
  appHostContext.mainMenu,
3812
3843
  appHostContext.windowBridge
3813
3844
  );
3814
- return /* @__PURE__ */ jsxs17(
3845
+ return /* @__PURE__ */ jsxs18(
3815
3846
  "div",
3816
3847
  {
3817
3848
  ...props,
@@ -3921,7 +3952,7 @@ function Dashboard({
3921
3952
 
3922
3953
  // src/components/CheckBox/CheckBox.tsx
3923
3954
  import { useId as useId3, useState as useState12 } from "react";
3924
- import { jsx as jsx32, jsxs as jsxs18 } from "react/jsx-runtime";
3955
+ import { jsx as jsx32, jsxs as jsxs19 } from "react/jsx-runtime";
3925
3956
  function CheckBox({
3926
3957
  checked,
3927
3958
  className,
@@ -3948,13 +3979,13 @@ function CheckBox({
3948
3979
  }
3949
3980
  onCheckedChange?.(event.target.checked, event);
3950
3981
  }
3951
- return /* @__PURE__ */ jsxs18(
3982
+ return /* @__PURE__ */ jsxs19(
3952
3983
  "label",
3953
3984
  {
3954
3985
  className: cx("nu-check-box", slotClassNames?.root, className),
3955
3986
  style: slotStyles?.root,
3956
3987
  children: [
3957
- /* @__PURE__ */ jsxs18(
3988
+ /* @__PURE__ */ jsxs19(
3958
3989
  "span",
3959
3990
  {
3960
3991
  className: cx("nu-check-box__main", slotClassNames?.main),
@@ -4027,7 +4058,7 @@ function CheckBox({
4027
4058
  import {
4028
4059
  useEffect as useEffect7,
4029
4060
  useId as useId4,
4030
- useMemo as useMemo8,
4061
+ useMemo as useMemo7,
4031
4062
  useRef as useRef9,
4032
4063
  useState as useState13
4033
4064
  } from "react";
@@ -4183,7 +4214,7 @@ function usePopupPosition({
4183
4214
  }
4184
4215
 
4185
4216
  // src/components/Dropdown/Dropdown.tsx
4186
- import { jsx as jsx34, jsxs as jsxs19 } from "react/jsx-runtime";
4217
+ import { jsx as jsx34, jsxs as jsxs20 } from "react/jsx-runtime";
4187
4218
  function flattenDropdownOptions(data) {
4188
4219
  const options = [];
4189
4220
  data.forEach((group) => {
@@ -4238,7 +4269,7 @@ function Dropdown({
4238
4269
  const popupRef = useRef9(null);
4239
4270
  const popupListRef = useRef9(null);
4240
4271
  const [open, setOpen] = useState13(false);
4241
- const options = useMemo8(() => flattenDropdownOptions(data), [data]);
4272
+ const options = useMemo7(() => flattenDropdownOptions(data), [data]);
4242
4273
  const generatedId = useId4();
4243
4274
  const fieldId = `${generatedId}-dropdown`;
4244
4275
  const labelId = `${fieldId}-label`;
@@ -4246,11 +4277,11 @@ function Dropdown({
4246
4277
  const isControlled = value !== void 0;
4247
4278
  const [uncontrolledValue, setUncontrolledValue] = useState13(() => getInitialValue(options, defaultValue));
4248
4279
  const resolvedValue = isControlled ? value : uncontrolledValue;
4249
- const selectedOption = useMemo8(
4280
+ const selectedOption = useMemo7(
4250
4281
  () => findSelectedOption(options, resolvedValue),
4251
4282
  [options, resolvedValue]
4252
4283
  );
4253
- const selectableOptions = useMemo8(
4284
+ const selectableOptions = useMemo7(
4254
4285
  () => options.filter((option) => !option.item.disabled),
4255
4286
  [options]
4256
4287
  );
@@ -4349,7 +4380,7 @@ function Dropdown({
4349
4380
  break;
4350
4381
  }
4351
4382
  }
4352
- return /* @__PURE__ */ jsxs19(
4383
+ return /* @__PURE__ */ jsxs20(
4353
4384
  "div",
4354
4385
  {
4355
4386
  ...props,
@@ -4384,13 +4415,13 @@ function Dropdown({
4384
4415
  },
4385
4416
  style: slotStyles?.trigger,
4386
4417
  type: "button",
4387
- children: /* @__PURE__ */ jsxs19(
4418
+ children: /* @__PURE__ */ jsxs20(
4388
4419
  "span",
4389
4420
  {
4390
4421
  className: cx("nu-dropdown__slot", slotClassNames?.slot),
4391
4422
  style: slotStyles?.slot,
4392
4423
  children: [
4393
- /* @__PURE__ */ jsxs19(
4424
+ /* @__PURE__ */ jsxs20(
4394
4425
  "span",
4395
4426
  {
4396
4427
  className: cx("nu-dropdown__field", slotClassNames?.field),
@@ -4527,7 +4558,7 @@ function Dropdown({
4527
4558
  }
4528
4559
 
4529
4560
  // src/components/Frame/Frame.tsx
4530
- import { jsx as jsx35, jsxs as jsxs20 } from "react/jsx-runtime";
4561
+ import { jsx as jsx35, jsxs as jsxs21 } from "react/jsx-runtime";
4531
4562
  function Frame({
4532
4563
  children,
4533
4564
  className,
@@ -4548,7 +4579,7 @@ function Frame({
4548
4579
  }) {
4549
4580
  const resolvedTitleContent = titleContent ?? (title ? renderMnemonicText(title) : null);
4550
4581
  const hasTitleShell = Boolean(titleStart || resolvedTitleContent || titleEnd);
4551
- return /* @__PURE__ */ jsxs20(
4582
+ return /* @__PURE__ */ jsxs21(
4552
4583
  "section",
4553
4584
  {
4554
4585
  ...props,
@@ -4565,7 +4596,7 @@ function Frame({
4565
4596
  ...slotStyles?.root
4566
4597
  },
4567
4598
  children: [
4568
- hasTitleShell ? /* @__PURE__ */ jsxs20(
4599
+ hasTitleShell ? /* @__PURE__ */ jsxs21(
4569
4600
  "span",
4570
4601
  {
4571
4602
  className: cx("nu-frame__title", slotClassNames?.title),
@@ -4669,20 +4700,45 @@ function InfoAccent({
4669
4700
  // src/components/IconGrid/NuIconGrid.tsx
4670
4701
  import {
4671
4702
  useLayoutEffect as useLayoutEffect5,
4672
- useMemo as useMemo9,
4703
+ useMemo as useMemo8,
4673
4704
  useRef as useRef11,
4674
4705
  useState as useState16
4675
4706
  } from "react";
4676
4707
 
4677
4708
  // src/components/PopupMenu/PopupMenu.tsx
4678
4709
  import {
4679
- useCallback as useCallback4,
4710
+ useCallback as useCallback5,
4680
4711
  useEffect as useEffect8,
4681
4712
  useLayoutEffect as useLayoutEffect4,
4682
4713
  useRef as useRef10,
4683
4714
  useState as useState14
4684
4715
  } from "react";
4685
4716
  import { createPortal as createPortal2 } from "react-dom";
4717
+
4718
+ // src/components/_shared/themePortal.ts
4719
+ function getThemePortalStyle(anchor) {
4720
+ if (typeof window === "undefined") {
4721
+ return void 0;
4722
+ }
4723
+ const themeRoot = anchor?.closest(".nu-theme-root");
4724
+ if (!themeRoot) {
4725
+ return void 0;
4726
+ }
4727
+ const computed = window.getComputedStyle(themeRoot);
4728
+ const style = {
4729
+ color: computed.color,
4730
+ fontFamily: computed.fontFamily,
4731
+ fontSize: computed.fontSize
4732
+ };
4733
+ for (const propertyName of computed) {
4734
+ if (propertyName.startsWith("--nu-")) {
4735
+ style[propertyName] = computed.getPropertyValue(propertyName).trim();
4736
+ }
4737
+ }
4738
+ return style;
4739
+ }
4740
+
4741
+ // src/components/PopupMenu/PopupMenu.tsx
4686
4742
  import { jsx as jsx37 } from "react/jsx-runtime";
4687
4743
  function hasVisibleChildren2(item) {
4688
4744
  return Boolean(
@@ -4732,7 +4788,7 @@ function PopupMenu({
4732
4788
  const isControlled = open !== void 0;
4733
4789
  const resolvedOpen = isControlled ? open : uncontrolledOpen;
4734
4790
  const portalRoot = resolvePortalRoot();
4735
- const setResolvedOpen = useCallback4(
4791
+ const setResolvedOpen = useCallback5(
4736
4792
  (nextOpen) => {
4737
4793
  if (!nextOpen) {
4738
4794
  setActivePath([]);
@@ -4897,8 +4953,8 @@ function usePopupMenu() {
4897
4953
  }
4898
4954
 
4899
4955
  // src/components/IconGrid/iconContext.ts
4900
- import { createContext as createContext5, useContext as useContext9 } from "react";
4901
- var NuIconContext = createContext5(null);
4956
+ import { createContext as createContext4, useContext as useContext9 } from "react";
4957
+ var NuIconContext = createContext4(null);
4902
4958
  function useNuIconContext() {
4903
4959
  const context = useContext9(NuIconContext);
4904
4960
  if (!context) {
@@ -4914,8 +4970,7 @@ function useNuIconGridContext() {
4914
4970
  }
4915
4971
 
4916
4972
  // src/components/IconGrid/NuIconGrid.tsx
4917
- import { Fragment as Fragment5, jsx as jsx38, jsxs as jsxs21 } from "react/jsx-runtime";
4918
- var DRAG_THRESHOLD2 = 3;
4973
+ import { Fragment as Fragment5, jsx as jsx38, jsxs as jsxs22 } from "react/jsx-runtime";
4919
4974
  var gridRegistrations = /* @__PURE__ */ new Map();
4920
4975
  function clamp2(value, minimum, maximum) {
4921
4976
  return Math.min(Math.max(value, minimum), maximum);
@@ -4926,23 +4981,6 @@ function resolveIconContextMenuItems(source, icon) {
4926
4981
  function resolveGridContextMenuItems(source, manager) {
4927
4982
  return typeof source === "function" ? source(manager) : source ?? [];
4928
4983
  }
4929
- function findGridRegistrationAtPoint(clientX, clientY) {
4930
- const target = document.elementFromPoint(clientX, clientY);
4931
- const gridElement = target?.closest(".nu-icon-grid");
4932
- if (gridElement) {
4933
- return gridRegistrations.get(gridElement);
4934
- }
4935
- if (target?.closest(".nu-window")) {
4936
- return void 0;
4937
- }
4938
- return Array.from(gridRegistrations.values()).reverse().find((registration) => {
4939
- if (!registration.dropTarget) {
4940
- return false;
4941
- }
4942
- const rect = registration.element.getBoundingClientRect();
4943
- return clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom;
4944
- });
4945
- }
4946
4984
  function getTransferredPosition(targetGrid, iconElement, clientX, clientY) {
4947
4985
  const targetRect = targetGrid.getBoundingClientRect();
4948
4986
  const iconRect = iconElement.getBoundingClientRect();
@@ -4964,149 +5002,31 @@ function getTransferredPosition(targetGrid, iconElement, clientX, clientY) {
4964
5002
  };
4965
5003
  }
4966
5004
  function NuIconGridItem({
4967
- gridElement,
4968
5005
  icon,
4969
- onDragOut,
4970
- onIconMoveOut
5006
+ onDragOut
4971
5007
  }) {
4972
5008
  const manager = useNuIconGridContext();
4973
- const dragDrop = useNuDragDrop();
4974
5009
  const contextMenu = usePopupMenu();
4975
- const dragStartRef = useRef11(void 0);
4976
- const isDraggingRef = useRef11(false);
4977
- const [isDragging, setIsDragging] = useState16(false);
4978
- const suppressClickRef = useRef11(false);
4979
- const latestPositionRef = useRef11(icon.position);
4980
5010
  const contextMenuItems = resolveIconContextMenuItems(
4981
5011
  icon.contextMenuItems,
4982
5012
  icon
4983
5013
  );
4984
- function handlePointerDown(event) {
4985
- if (event.button !== 0 || icon.disabled) {
4986
- return;
4987
- }
4988
- manager.selectIcon(icon.id);
4989
- latestPositionRef.current = icon.position;
4990
- isDraggingRef.current = false;
4991
- dragStartRef.current = {
4992
- clientX: event.clientX,
4993
- clientY: event.clientY,
4994
- pointerId: event.pointerId,
4995
- position: icon.position
4996
- };
4997
- event.currentTarget.setPointerCapture(event.pointerId);
4998
- }
4999
- function handlePointerMove(event) {
5000
- const dragStart = dragStartRef.current;
5001
- if (!dragStart || dragStart.pointerId !== event.pointerId || !gridElement) {
5002
- return;
5003
- }
5004
- const deltaX = event.clientX - dragStart.clientX;
5005
- const deltaY = event.clientY - dragStart.clientY;
5006
- if (!isDraggingRef.current && Math.max(Math.abs(deltaX), Math.abs(deltaY)) < DRAG_THRESHOLD2) {
5007
- return;
5008
- }
5009
- if (!isDraggingRef.current) {
5010
- isDraggingRef.current = true;
5011
- setIsDragging(true);
5012
- dragDrop.beginDrag(
5013
- { data: icon, id: icon.id, type: "icon" },
5014
- event.currentTarget,
5015
- "icon-grid"
5016
- );
5017
- }
5018
- dragDrop.moveDrag(event.clientX, event.clientY);
5019
- const gridRect = gridElement.getBoundingClientRect();
5020
- const iconRect = event.currentTarget.getBoundingClientRect();
5021
- const position = {
5022
- x: Math.round(
5023
- clamp2(
5024
- dragStart.position.x + deltaX,
5025
- 0,
5026
- Math.max(0, gridRect.width - iconRect.width)
5027
- )
5028
- ),
5029
- y: Math.round(
5030
- clamp2(
5031
- dragStart.position.y + deltaY,
5032
- 0,
5033
- Math.max(0, gridRect.height - iconRect.height)
5034
- )
5035
- )
5036
- };
5037
- latestPositionRef.current = position;
5038
- }
5039
- function finishDragging(event) {
5040
- const dragStart = dragStartRef.current;
5041
- if (!dragStart || dragStart.pointerId !== event.pointerId) {
5042
- return;
5043
- }
5044
- if (event.currentTarget.hasPointerCapture(event.pointerId)) {
5045
- event.currentTarget.releasePointerCapture(event.pointerId);
5046
- }
5047
- dragStartRef.current = void 0;
5048
- if (!isDraggingRef.current) {
5049
- return;
5050
- }
5051
- suppressClickRef.current = true;
5052
- isDraggingRef.current = false;
5053
- setIsDragging(false);
5054
- if (event.type === "pointercancel" || !gridElement) {
5055
- dragDrop.cancelDrag();
5056
- return;
5057
- }
5058
- if (dragDrop.dropAt(event.clientX, event.clientY)) {
5059
- manager.removeIcon(icon.id);
5060
- onDragOut?.({ data: icon, id: icon.id, type: "icon" });
5061
- return;
5062
- }
5063
- const targetRegistration = findGridRegistrationAtPoint(
5064
- event.clientX,
5065
- event.clientY
5066
- );
5067
- if (!targetRegistration) {
5068
- return;
5069
- }
5070
- if (targetRegistration.element === gridElement) {
5071
- manager.moveIcon(icon.id, latestPositionRef.current);
5072
- icon.onPositionChange?.(latestPositionRef.current, {
5073
- ...icon,
5074
- position: latestPositionRef.current
5075
- });
5076
- return;
5077
- }
5078
- if (!targetRegistration.manager.icons.some(
5079
- (targetIcon) => targetIcon.id === icon.id
5080
- )) {
5081
- const position = getTransferredPosition(
5082
- targetRegistration.element,
5083
- event.currentTarget,
5084
- event.clientX,
5085
- event.clientY
5086
- );
5087
- const transferredIcon = { ...icon, position };
5088
- const context = {
5089
- position,
5090
- source: manager,
5091
- sourceGrid: gridElement,
5092
- target: targetRegistration.manager,
5093
- targetGrid: targetRegistration.element
5094
- };
5095
- if (targetRegistration.accepts?.(transferredIcon) !== false && targetRegistration.onIconDrop?.(transferredIcon, context) !== false) {
5096
- targetRegistration.manager.addIcon(transferredIcon);
5097
- targetRegistration.manager.selectIcon(transferredIcon.id);
5098
- manager.removeIcon(icon.id);
5099
- onIconMoveOut?.(transferredIcon, context);
5014
+ const dragSource = useNuDragSource({
5015
+ disabled: icon.disabled,
5016
+ getItem: () => ({ data: icon, id: icon.id, type: "icon" }),
5017
+ onDropAccepted: (result) => {
5018
+ if (result.targetType === "icon-grid") {
5100
5019
  return;
5101
5020
  }
5102
- }
5103
- }
5021
+ const dragItem = { data: icon, id: icon.id, type: "icon" };
5022
+ const shouldMove = result.action !== "copy" && onDragOut?.(dragItem, result) !== false;
5023
+ if (shouldMove) {
5024
+ manager.removeIcon(icon.id);
5025
+ }
5026
+ },
5027
+ sourceType: "icon-grid"
5028
+ });
5104
5029
  function handleClick(event) {
5105
- if (suppressClickRef.current) {
5106
- suppressClickRef.current = false;
5107
- event.preventDefault();
5108
- return;
5109
- }
5110
5030
  manager.selectIcon(icon.id);
5111
5031
  icon.onClick?.(event);
5112
5032
  }
@@ -5128,23 +5048,20 @@ function NuIconGridItem({
5128
5048
  manager.selectIcon(icon.id);
5129
5049
  contextMenu.openAtElement(event.currentTarget);
5130
5050
  }
5131
- return /* @__PURE__ */ jsxs21(Fragment5, { children: [
5132
- /* @__PURE__ */ jsxs21(
5051
+ return /* @__PURE__ */ jsxs22(Fragment5, { children: [
5052
+ /* @__PURE__ */ jsxs22(
5133
5053
  "button",
5134
5054
  {
5135
5055
  "aria-haspopup": contextMenuItems.length > 0 ? "menu" : void 0,
5136
5056
  className: "nu-icon-grid__icon",
5137
- "data-dragging": isDragging || void 0,
5057
+ "data-dragging": dragSource.isDragging || void 0,
5138
5058
  "data-selected": manager.selectedIconId === icon.id || void 0,
5139
5059
  disabled: icon.disabled,
5140
5060
  onClick: handleClick,
5141
5061
  onContextMenu: handleContextMenu,
5142
5062
  onDoubleClick: icon.onDoubleClick,
5143
5063
  onKeyDown: handleKeyDown,
5144
- onPointerDown: handlePointerDown,
5145
- onPointerMove: handlePointerMove,
5146
- onPointerUp: finishDragging,
5147
- onPointerCancel: finishDragging,
5064
+ ref: dragSource.dragRef,
5148
5065
  style: { left: icon.position.x, top: icon.position.y },
5149
5066
  type: "button",
5150
5067
  children: [
@@ -5164,7 +5081,7 @@ function NuIconGridItem({
5164
5081
  )
5165
5082
  ] });
5166
5083
  }
5167
- function NuIconGrid({
5084
+ function NuIconGridContent({
5168
5085
  accepts,
5169
5086
  acceptsDrop,
5170
5087
  className,
@@ -5185,19 +5102,93 @@ function NuIconGrid({
5185
5102
  const arrangeIcons = manager.arrangeIcons;
5186
5103
  const setGridSize = manager.setGridSize;
5187
5104
  const contextMenu = usePopupMenu();
5188
- const contextMenuItems = useMemo9(
5105
+ const contextMenuItems = useMemo8(
5189
5106
  () => resolveGridContextMenuItems(contextMenuItemsSource, manager),
5190
5107
  [contextMenuItemsSource, manager]
5191
5108
  );
5192
- const sharedDropTargetOptions = useMemo9(
5193
- () => onDrop ? {
5194
- accepts: (item) => item.type !== "icon" && acceptsDrop?.(item) !== false,
5195
- onDrop,
5109
+ const sharedDropTargetOptions = useMemo8(() => {
5110
+ if (!gridElement) {
5111
+ return void 0;
5112
+ }
5113
+ return {
5114
+ accepts: (item) => {
5115
+ if (item.type === "icon") {
5116
+ return accepts?.(item.data) !== false;
5117
+ }
5118
+ return Boolean(onDrop) && acceptsDrop?.(item) !== false;
5119
+ },
5120
+ onDrop: (item, context) => {
5121
+ if (item.type !== "icon") {
5122
+ return onDrop?.(item, context) ?? false;
5123
+ }
5124
+ const sourceGridElement = context.source.element.closest(
5125
+ ".nu-icon-grid"
5126
+ );
5127
+ const sourceRegistration = sourceGridElement ? gridRegistrations.get(sourceGridElement) : void 0;
5128
+ if (!sourceRegistration) {
5129
+ return false;
5130
+ }
5131
+ const sourceIcon = item.data;
5132
+ const position = getTransferredPosition(
5133
+ gridElement,
5134
+ context.source.element,
5135
+ context.clientX,
5136
+ context.clientY
5137
+ );
5138
+ if (sourceRegistration.element === gridElement) {
5139
+ manager.moveIcon(sourceIcon.id, position);
5140
+ sourceIcon.onPositionChange?.(position, {
5141
+ ...sourceIcon,
5142
+ position
5143
+ });
5144
+ return { action: "move", targetType: "icon-grid" };
5145
+ }
5146
+ if (manager.icons.some((targetIcon) => targetIcon.id === sourceIcon.id)) {
5147
+ return false;
5148
+ }
5149
+ const transferredIcon = { ...sourceIcon, position };
5150
+ const dropContext = {
5151
+ position,
5152
+ source: sourceRegistration.manager,
5153
+ sourceGrid: sourceRegistration.element,
5154
+ target: manager,
5155
+ targetGrid: gridElement
5156
+ };
5157
+ if (onIconDrop?.(transferredIcon, dropContext) === false) {
5158
+ return false;
5159
+ }
5160
+ manager.addIcon(transferredIcon);
5161
+ manager.selectIcon(transferredIcon.id);
5162
+ sourceRegistration.manager.removeIcon(sourceIcon.id);
5163
+ sourceRegistration.onIconMoveOut?.(transferredIcon, dropContext);
5164
+ return { action: "move", targetType: "icon-grid" };
5165
+ },
5196
5166
  type: "icon-grid"
5197
- } : void 0,
5198
- [acceptsDrop, onDrop]
5199
- );
5167
+ };
5168
+ }, [accepts, acceptsDrop, gridElement, manager, onDrop, onIconDrop]);
5200
5169
  useNuDropTarget(gridElement, sharedDropTargetOptions);
5170
+ const backgroundDropTargetOptions = useMemo8(() => {
5171
+ if (!dropTarget || !gridElement || !sharedDropTargetOptions) {
5172
+ return void 0;
5173
+ }
5174
+ return {
5175
+ ...sharedDropTargetOptions,
5176
+ onDrop: (item, context) => {
5177
+ const rect = gridElement.getBoundingClientRect();
5178
+ if (context.clientX < rect.left || context.clientX > rect.right || context.clientY < rect.top || context.clientY > rect.bottom) {
5179
+ return false;
5180
+ }
5181
+ return sharedDropTargetOptions.onDrop(item, {
5182
+ ...context,
5183
+ target: { element: gridElement, type: "icon-grid" }
5184
+ });
5185
+ }
5186
+ };
5187
+ }, [dropTarget, gridElement, sharedDropTargetOptions]);
5188
+ useNuDropTarget(
5189
+ dropTarget && typeof document !== "undefined" ? document.body : null,
5190
+ backgroundDropTargetOptions
5191
+ );
5201
5192
  useLayoutEffect5(() => {
5202
5193
  if (!gridElement) {
5203
5194
  return;
@@ -5224,16 +5215,15 @@ function NuIconGrid({
5224
5215
  return;
5225
5216
  }
5226
5217
  gridRegistrations.set(gridElement, {
5227
- accepts,
5228
- dropTarget,
5229
5218
  element: gridElement,
5230
5219
  manager,
5231
- onIconDrop
5220
+ onIconDrop,
5221
+ onIconMoveOut
5232
5222
  });
5233
5223
  return () => {
5234
5224
  gridRegistrations.delete(gridElement);
5235
5225
  };
5236
- }, [accepts, dropTarget, gridElement, manager, onIconDrop]);
5226
+ }, [gridElement, manager, onIconDrop, onIconMoveOut]);
5237
5227
  function handleContextMenu(event) {
5238
5228
  onContextMenu?.(event);
5239
5229
  if (event.defaultPrevented || contextMenuItems.length === 0) {
@@ -5243,12 +5233,13 @@ function NuIconGrid({
5243
5233
  manager.selectIcon(null);
5244
5234
  contextMenu.openAtPoint(event.clientX, event.clientY, event.currentTarget);
5245
5235
  }
5246
- return /* @__PURE__ */ jsxs21(
5236
+ return /* @__PURE__ */ jsxs22(
5247
5237
  "div",
5248
5238
  {
5249
5239
  ...props,
5250
5240
  "aria-label": props["aria-label"] ?? "Application icons",
5251
5241
  className: ["nu-icon-grid", className].filter(Boolean).join(" "),
5242
+ "data-drop-target": dropTarget || void 0,
5252
5243
  onContextMenu: handleContextMenu,
5253
5244
  onPointerDown: (event) => {
5254
5245
  onPointerDown?.(event);
@@ -5265,10 +5256,8 @@ function NuIconGrid({
5265
5256
  manager.icons.map((icon) => /* @__PURE__ */ jsx38(
5266
5257
  NuIconGridItem,
5267
5258
  {
5268
- gridElement,
5269
5259
  icon,
5270
- onDragOut,
5271
- onIconMoveOut
5260
+ onDragOut
5272
5261
  },
5273
5262
  icon.id
5274
5263
  )),
@@ -5285,11 +5274,14 @@ function NuIconGrid({
5285
5274
  }
5286
5275
  );
5287
5276
  }
5277
+ function NuIconGrid(props) {
5278
+ return /* @__PURE__ */ jsx38(NuDragDropProvider, { children: /* @__PURE__ */ jsx38(NuIconGridContent, { ...props }) });
5279
+ }
5288
5280
 
5289
5281
  // src/components/IconGrid/NuIconProvider.tsx
5290
5282
  import {
5291
- useCallback as useCallback5,
5292
- useMemo as useMemo10,
5283
+ useCallback as useCallback6,
5284
+ useMemo as useMemo9,
5293
5285
  useRef as useRef12,
5294
5286
  useState as useState17
5295
5287
  } from "react";
@@ -5364,7 +5356,7 @@ function NuIconProvider({
5364
5356
  () => getInitialIcons(defaultIcons)
5365
5357
  );
5366
5358
  const [selectedIconId, setSelectedIconId] = useState17(null);
5367
- const addIcon = useCallback5((definition) => {
5359
+ const addIcon = useCallback6((definition) => {
5368
5360
  const id = definition.id ?? `nu-icon-${++idRef.current}`;
5369
5361
  setIcons((currentIcons) => {
5370
5362
  if (currentIcons.some((icon) => icon.id === id)) {
@@ -5377,18 +5369,18 @@ function NuIconProvider({
5377
5369
  });
5378
5370
  return id;
5379
5371
  }, []);
5380
- const moveIcon = useCallback5((id, position) => {
5372
+ const moveIcon = useCallback6((id, position) => {
5381
5373
  setIcons(
5382
5374
  (currentIcons) => currentIcons.map(
5383
5375
  (icon) => icon.id === id ? { ...icon, position } : icon
5384
5376
  )
5385
5377
  );
5386
5378
  }, []);
5387
- const removeIcon = useCallback5((id) => {
5379
+ const removeIcon = useCallback6((id) => {
5388
5380
  setIcons((currentIcons) => currentIcons.filter((icon) => icon.id !== id));
5389
5381
  setSelectedIconId((currentId) => currentId === id ? null : currentId);
5390
5382
  }, []);
5391
- const updateIcon = useCallback5(
5383
+ const updateIcon = useCallback6(
5392
5384
  (id, patch) => {
5393
5385
  setIcons(
5394
5386
  (currentIcons) => currentIcons.map(
@@ -5402,7 +5394,7 @@ function NuIconProvider({
5402
5394
  },
5403
5395
  []
5404
5396
  );
5405
- const arrangeIcons = useCallback5((mode = "columns") => {
5397
+ const arrangeIcons = useCallback6((mode = "columns") => {
5406
5398
  setIcons((currentIcons) => {
5407
5399
  const positions = getArrangedPositions(
5408
5400
  currentIcons,
@@ -5415,10 +5407,10 @@ function NuIconProvider({
5415
5407
  }));
5416
5408
  });
5417
5409
  }, []);
5418
- const setGridSize = useCallback5((size) => {
5410
+ const setGridSize = useCallback6((size) => {
5419
5411
  gridSizeRef.current = size;
5420
5412
  }, []);
5421
- const contextValue = useMemo10(
5413
+ const contextValue = useMemo9(
5422
5414
  () => ({
5423
5415
  addIcon,
5424
5416
  arrangeIcons,
@@ -5448,12 +5440,12 @@ function NuIconProvider({
5448
5440
  import {
5449
5441
  useEffect as useEffect9,
5450
5442
  useId as useId5,
5451
- useMemo as useMemo11,
5443
+ useMemo as useMemo10,
5452
5444
  useRef as useRef13,
5453
5445
  useState as useState18
5454
5446
  } from "react";
5455
5447
  import { createPortal as createPortal3 } from "react-dom";
5456
- import { jsx as jsx40, jsxs as jsxs22 } from "react/jsx-runtime";
5448
+ import { jsx as jsx40, jsxs as jsxs23 } from "react/jsx-runtime";
5457
5449
  function flattenComboBoxOptions(data) {
5458
5450
  const options = [];
5459
5451
  data.forEach((group) => {
@@ -5503,7 +5495,7 @@ function ComboBox({
5503
5495
  const labelId = `${fieldId}-label`;
5504
5496
  const hintId = hint ? `${fieldId}-hint` : void 0;
5505
5497
  const [open, setOpen] = useState18(false);
5506
- const options = useMemo11(() => flattenComboBoxOptions(data), [data]);
5498
+ const options = useMemo10(() => flattenComboBoxOptions(data), [data]);
5507
5499
  const isValueControlled = value !== void 0;
5508
5500
  const isInputControlled = inputValueProp !== void 0;
5509
5501
  const [uncontrolledValue, setUncontrolledValue] = useState18(() => defaultValue);
@@ -5512,13 +5504,13 @@ function ComboBox({
5512
5504
  () => defaultInputValue ?? initialSelectedOption?.item.name.text ?? ""
5513
5505
  );
5514
5506
  const resolvedValue = isValueControlled ? value : uncontrolledValue;
5515
- const selectedOption = useMemo11(
5507
+ const selectedOption = useMemo10(
5516
5508
  () => findComboBoxOption(options, resolvedValue),
5517
5509
  [options, resolvedValue]
5518
5510
  );
5519
5511
  const resolvedInputValue = isInputControlled ? inputValueProp ?? "" : uncontrolledInputValue;
5520
5512
  const normalizedFilter = resolvedInputValue.trim().toLowerCase();
5521
- const filteredData = useMemo11(() => {
5513
+ const filteredData = useMemo10(() => {
5522
5514
  if (!normalizedFilter) {
5523
5515
  return data;
5524
5516
  }
@@ -5529,7 +5521,7 @@ function ComboBox({
5529
5521
  )
5530
5522
  })).filter((group) => group.items.length > 0);
5531
5523
  }, [data, normalizedFilter]);
5532
- const filteredOptions = useMemo11(
5524
+ const filteredOptions = useMemo10(
5533
5525
  () => flattenComboBoxOptions(filteredData).filter(
5534
5526
  (option) => !option.item.disabled
5535
5527
  ),
@@ -5613,7 +5605,7 @@ function ComboBox({
5613
5605
  break;
5614
5606
  }
5615
5607
  }
5616
- return /* @__PURE__ */ jsxs22(
5608
+ return /* @__PURE__ */ jsxs23(
5617
5609
  "div",
5618
5610
  {
5619
5611
  ...props,
@@ -5631,13 +5623,13 @@ function ComboBox({
5631
5623
  children: renderMnemonicText(label)
5632
5624
  }
5633
5625
  ),
5634
- /* @__PURE__ */ jsxs22(
5626
+ /* @__PURE__ */ jsxs23(
5635
5627
  "span",
5636
5628
  {
5637
5629
  className: cx("nu-combo-box__slot", slotClassNames?.slot),
5638
5630
  style: slotStyles?.slot,
5639
5631
  children: [
5640
- /* @__PURE__ */ jsxs22(
5632
+ /* @__PURE__ */ jsxs23(
5641
5633
  "span",
5642
5634
  {
5643
5635
  className: cx("nu-combo-box__field", slotClassNames?.field),
@@ -5776,7 +5768,7 @@ function ComboBox({
5776
5768
  import {
5777
5769
  Fragment as Fragment6
5778
5770
  } from "react";
5779
- import { jsx as jsx41, jsxs as jsxs23 } from "react/jsx-runtime";
5771
+ import { jsx as jsx41, jsxs as jsxs24 } from "react/jsx-runtime";
5780
5772
  var COMMAND_BUTTON_GLYPH_NAMES = /* @__PURE__ */ new Set([
5781
5773
  "check-fill",
5782
5774
  "check-mark",
@@ -5825,8 +5817,8 @@ function CommandButton({
5825
5817
  }
5826
5818
  popupMenu.openFromClick(event);
5827
5819
  }
5828
- return /* @__PURE__ */ jsxs23(Fragment6, { children: [
5829
- /* @__PURE__ */ jsxs23(
5820
+ return /* @__PURE__ */ jsxs24(Fragment6, { children: [
5821
+ /* @__PURE__ */ jsxs24(
5830
5822
  "button",
5831
5823
  {
5832
5824
  ...props,
@@ -5897,7 +5889,7 @@ function CommandButton({
5897
5889
 
5898
5890
  // src/components/CrtGlitch/CrtGlitch.tsx
5899
5891
  import { useEffect as useEffect10, useId as useId6, useRef as useRef14 } from "react";
5900
- import { jsx as jsx42, jsxs as jsxs24 } from "react/jsx-runtime";
5892
+ import { jsx as jsx42, jsxs as jsxs25 } from "react/jsx-runtime";
5901
5893
  var DEFAULT_INTERVAL_MS = 3e3;
5902
5894
  var DEFAULT_DURATION_MS = 2500;
5903
5895
  var DEFAULT_TOP_LEVEL_RATIO = 1 / 3;
@@ -6031,7 +6023,7 @@ function NuCrtGlitch({
6031
6023
  }
6032
6024
  };
6033
6025
  }, [durationMs, enabled, filterId, intervalMs, targetSelector, topLevelRatio]);
6034
- return /* @__PURE__ */ jsx42("svg", { "aria-hidden": "true", height: "0", style: { position: "absolute" }, width: "0", children: /* @__PURE__ */ jsx42("defs", { children: /* @__PURE__ */ jsxs24(
6026
+ return /* @__PURE__ */ jsx42("svg", { "aria-hidden": "true", height: "0", style: { position: "absolute" }, width: "0", children: /* @__PURE__ */ jsx42("defs", { children: /* @__PURE__ */ jsxs25(
6035
6027
  "filter",
6036
6028
  {
6037
6029
  "color-interpolation-filters": "sRGB",
@@ -6103,10 +6095,10 @@ function NuCrtGlitch({
6103
6095
  // src/components/ListView/ListView.tsx
6104
6096
  import {
6105
6097
  forwardRef as forwardRef2,
6106
- useCallback as useCallback6,
6098
+ useCallback as useCallback7,
6107
6099
  useEffect as useEffect11,
6108
6100
  useImperativeHandle as useImperativeHandle2,
6109
- useMemo as useMemo12,
6101
+ useMemo as useMemo11,
6110
6102
  useRef as useRef15,
6111
6103
  useState as useState19
6112
6104
  } from "react";
@@ -6186,22 +6178,32 @@ function ListViewCheckControl({
6186
6178
  }
6187
6179
 
6188
6180
  // src/components/ListView/internals/ListViewRow.tsx
6189
- import { jsx as jsx44, jsxs as jsxs25 } from "react/jsx-runtime";
6181
+ import { jsx as jsx44, jsxs as jsxs26 } from "react/jsx-runtime";
6190
6182
  function ListViewRowInner({
6191
6183
  columns,
6192
6184
  isActive,
6193
6185
  isChecked,
6194
6186
  isSelected,
6187
+ getDragItem,
6195
6188
  onActivate,
6196
6189
  onDoubleClick,
6190
+ onDragOut,
6197
6191
  onToggleCheck,
6198
6192
  registerRowRef,
6193
+ renderDragPreview,
6199
6194
  row,
6200
6195
  showCheckBox,
6201
6196
  templateColumns,
6202
6197
  uncheckedShape
6203
6198
  }) {
6204
6199
  const rowId = row.id;
6200
+ const dragSource = useNuDragSource({
6201
+ disabled: row.disabled || !getDragItem,
6202
+ getItem: () => getDragItem?.(row) ?? false,
6203
+ onDropAccepted: () => onDragOut?.(row),
6204
+ renderPreview: renderDragPreview ? () => renderDragPreview(row) : void 0,
6205
+ sourceType: "list-view-row"
6206
+ });
6205
6207
  function handleActivate() {
6206
6208
  if (!row.disabled) {
6207
6209
  onActivate(rowId);
@@ -6217,7 +6219,7 @@ function ListViewRowInner({
6217
6219
  function handleToggleCheck() {
6218
6220
  onToggleCheck(rowId);
6219
6221
  }
6220
- return /* @__PURE__ */ jsxs25(
6222
+ return /* @__PURE__ */ jsxs26(
6221
6223
  "div",
6222
6224
  {
6223
6225
  "aria-disabled": row.disabled || void 0,
@@ -6232,7 +6234,10 @@ function ListViewRowInner({
6232
6234
  id: rowId,
6233
6235
  onClick: handleActivate,
6234
6236
  onDoubleClick: handleDoubleClick,
6235
- ref: (node) => registerRowRef(rowId, node),
6237
+ ref: (node) => {
6238
+ registerRowRef(rowId, node);
6239
+ dragSource.dragRef(node);
6240
+ },
6236
6241
  role: "row",
6237
6242
  style: {
6238
6243
  "--nu-list-view-columns": templateColumns
@@ -6267,8 +6272,9 @@ function ListViewRowInner({
6267
6272
  var ListViewRow = memo3(ListViewRowInner);
6268
6273
 
6269
6274
  // src/components/ListView/ListView.tsx
6270
- import { jsx as jsx45, jsxs as jsxs26 } from "react/jsx-runtime";
6275
+ import { jsx as jsx45, jsxs as jsxs27 } from "react/jsx-runtime";
6271
6276
  function ListViewInner({
6277
+ acceptsDrop,
6272
6278
  activeRowId: activeRowIdProp,
6273
6279
  checkedIds,
6274
6280
  className,
@@ -6276,18 +6282,23 @@ function ListViewInner({
6276
6282
  data,
6277
6283
  defaultActiveRowId,
6278
6284
  emptyText = "No rows",
6285
+ getDragItem,
6279
6286
  onActiveRowChange,
6280
6287
  onRowCheckChange,
6281
6288
  onRowDoubleClick,
6289
+ onRowDragOut,
6282
6290
  onRowSelect,
6291
+ onDrop,
6292
+ renderDragPreview,
6283
6293
  selectedId,
6284
6294
  showCheckBox = false,
6285
6295
  uncheckedShape = "box",
6286
6296
  ...props
6287
6297
  }, ref) {
6288
6298
  const rootRef = useRef15(null);
6299
+ const [rootElement, setRootElement] = useState19(null);
6289
6300
  const rowRefs = useRef15({});
6290
- const selectableRows = useMemo12(
6301
+ const selectableRows = useMemo11(
6291
6302
  () => data.filter((row) => !row.disabled),
6292
6303
  [data]
6293
6304
  );
@@ -6297,13 +6308,22 @@ function ListViewInner({
6297
6308
  );
6298
6309
  const activeRowId = activeRowIdProp !== void 0 ? activeRowIdProp : uncontrolledActiveRowId;
6299
6310
  const resolvedActiveRowId = activeRowId && selectableRows.some((row) => row.id === activeRowId) ? activeRowId : getInitialActiveRowId(selectableRows, selectedId);
6300
- const templateColumns = useMemo12(() => {
6311
+ const templateColumns = useMemo11(() => {
6301
6312
  const checkboxColumn = showCheckBox ? "var(--nu-glyph-cell-size)" : null;
6302
6313
  const dataColumns = columns.map(
6303
6314
  (column) => column.width ?? "minmax(0, 1fr)"
6304
6315
  );
6305
6316
  return [checkboxColumn, ...dataColumns].filter(Boolean).join(" ");
6306
6317
  }, [columns, showCheckBox]);
6318
+ const dropTargetOptions = useMemo11(
6319
+ () => onDrop ? { accepts: acceptsDrop, onDrop, type: "list-view" } : void 0,
6320
+ [acceptsDrop, onDrop]
6321
+ );
6322
+ useNuDropTarget(rootElement, dropTargetOptions);
6323
+ const setRootRef = useCallback7((node) => {
6324
+ rootRef.current = node;
6325
+ setRootElement(node);
6326
+ }, []);
6307
6327
  useEffect11(() => {
6308
6328
  if (!resolvedActiveRowId) {
6309
6329
  return;
@@ -6312,13 +6332,13 @@ function ListViewInner({
6312
6332
  block: "nearest"
6313
6333
  });
6314
6334
  }, [resolvedActiveRowId]);
6315
- const registerRowRef = useCallback6(
6335
+ const registerRowRef = useCallback7(
6316
6336
  (rowId, node) => {
6317
6337
  rowRefs.current[rowId] = node;
6318
6338
  },
6319
6339
  []
6320
6340
  );
6321
- const updateActiveRow = useCallback6(
6341
+ const updateActiveRow = useCallback7(
6322
6342
  (row) => {
6323
6343
  if (!isActiveControlled) {
6324
6344
  setUncontrolledActiveRowId(row.id);
@@ -6327,7 +6347,7 @@ function ListViewInner({
6327
6347
  },
6328
6348
  [isActiveControlled, onActiveRowChange]
6329
6349
  );
6330
- const activateRowId = useCallback6(
6350
+ const activateRowId = useCallback7(
6331
6351
  (rowId) => {
6332
6352
  if (!rowId) {
6333
6353
  return;
@@ -6366,7 +6386,7 @@ function ListViewInner({
6366
6386
  function isRowChecked(row) {
6367
6387
  return getListViewRowChecked(row, checkedIds);
6368
6388
  }
6369
- const toggleRowCheck = useCallback6(
6389
+ const toggleRowCheck = useCallback7(
6370
6390
  (rowId) => {
6371
6391
  if (!showCheckBox) {
6372
6392
  return;
@@ -6435,18 +6455,18 @@ function ListViewInner({
6435
6455
  break;
6436
6456
  }
6437
6457
  }
6438
- return /* @__PURE__ */ jsxs26(
6458
+ return /* @__PURE__ */ jsxs27(
6439
6459
  "div",
6440
6460
  {
6441
6461
  ...props,
6442
6462
  "aria-activedescendant": resolvedActiveRowId ?? void 0,
6443
6463
  className: ["nu-list-view", className].filter(Boolean).join(" "),
6444
6464
  onKeyDown: handleKeyDown,
6445
- ref: rootRef,
6465
+ ref: setRootRef,
6446
6466
  role: "grid",
6447
6467
  tabIndex: 0,
6448
6468
  children: [
6449
- /* @__PURE__ */ jsxs26(
6469
+ /* @__PURE__ */ jsxs27(
6450
6470
  "div",
6451
6471
  {
6452
6472
  className: "nu-list-view__header",
@@ -6476,13 +6496,16 @@ function ListViewInner({
6476
6496
  ListViewRow,
6477
6497
  {
6478
6498
  columns,
6499
+ getDragItem,
6479
6500
  isActive: row.id === resolvedActiveRowId,
6480
6501
  isChecked: isRowChecked(row),
6481
6502
  isSelected: row.id === selectedId,
6482
6503
  onActivate: activateRowId,
6483
6504
  onDoubleClick: onRowDoubleClick,
6505
+ onDragOut: onRowDragOut,
6484
6506
  onToggleCheck: toggleRowCheck,
6485
6507
  registerRowRef,
6508
+ renderDragPreview,
6486
6509
  row,
6487
6510
  showCheckBox,
6488
6511
  templateColumns,
@@ -6494,13 +6517,16 @@ function ListViewInner({
6494
6517
  }
6495
6518
  );
6496
6519
  }
6497
- var ListView = forwardRef2(ListViewInner);
6520
+ function ListViewWithDragDrop(props, ref) {
6521
+ return /* @__PURE__ */ jsx45(NuDragDropProvider, { children: ListViewInner(props, ref) });
6522
+ }
6523
+ var ListView = forwardRef2(ListViewWithDragDrop);
6498
6524
 
6499
6525
  // src/components/MaskedField/MaskedField.tsx
6500
6526
  import {
6501
6527
  useEffect as useEffect12,
6502
6528
  useId as useId7,
6503
- useMemo as useMemo13,
6529
+ useMemo as useMemo12,
6504
6530
  useRef as useRef16,
6505
6531
  useState as useState20
6506
6532
  } from "react";
@@ -6667,7 +6693,7 @@ function getMaskedFieldState(mask, rawValue) {
6667
6693
  }
6668
6694
 
6669
6695
  // src/components/MaskedField/MaskedField.tsx
6670
- import { jsx as jsx46, jsxs as jsxs27 } from "react/jsx-runtime";
6696
+ import { jsx as jsx46, jsxs as jsxs28 } from "react/jsx-runtime";
6671
6697
  function MaskedField({
6672
6698
  "aria-invalid": ariaInvalid,
6673
6699
  className,
@@ -6700,7 +6726,7 @@ function MaskedField({
6700
6726
  rawResolvedValue
6701
6727
  );
6702
6728
  const resolvedAriaInvalid = ariaInvalid ?? (isInvalid ? true : void 0);
6703
- const maskInputMode = useMemo13(
6729
+ const maskInputMode = useMemo12(
6704
6730
  () => props.inputMode === void 0 ? getTextMaskInputMode(mask) : void 0,
6705
6731
  [mask, props.inputMode]
6706
6732
  );
@@ -6739,7 +6765,7 @@ function MaskedField({
6739
6765
  }
6740
6766
  onChange?.(event);
6741
6767
  }
6742
- return /* @__PURE__ */ jsxs27(
6768
+ return /* @__PURE__ */ jsxs28(
6743
6769
  "label",
6744
6770
  {
6745
6771
  className: cx(
@@ -6759,7 +6785,7 @@ function MaskedField({
6759
6785
  children: renderMnemonicText(label)
6760
6786
  }
6761
6787
  ),
6762
- /* @__PURE__ */ jsxs27(
6788
+ /* @__PURE__ */ jsxs28(
6763
6789
  "span",
6764
6790
  {
6765
6791
  className: cx("nu-masked-field__slot", slotClassNames?.slot),
@@ -6889,11 +6915,11 @@ function Memo({
6889
6915
  // src/components/PageControl/PageControl.tsx
6890
6916
  import {
6891
6917
  useId as useId8,
6892
- useMemo as useMemo14,
6918
+ useMemo as useMemo13,
6893
6919
  useRef as useRef17,
6894
6920
  useState as useState22
6895
6921
  } from "react";
6896
- import { jsx as jsx48, jsxs as jsxs28 } from "react/jsx-runtime";
6922
+ import { jsx as jsx48, jsxs as jsxs29 } from "react/jsx-runtime";
6897
6923
  function PageControl({
6898
6924
  activePageId: activePageIdProp,
6899
6925
  className,
@@ -6912,7 +6938,7 @@ function PageControl({
6912
6938
  () => defaultActivePageId ?? pages.find((page) => !page.disabled)?.id ?? pages[0]?.id
6913
6939
  );
6914
6940
  const activePageId = isControlled ? activePageIdProp : uncontrolledActivePageId;
6915
- const resolvedActivePage = useMemo14(() => {
6941
+ const resolvedActivePage = useMemo13(() => {
6916
6942
  const byId = pages.find(
6917
6943
  (page) => page.id === activePageId && !page.disabled
6918
6944
  );
@@ -6978,7 +7004,7 @@ function PageControl({
6978
7004
  break;
6979
7005
  }
6980
7006
  }
6981
- return /* @__PURE__ */ jsxs28(
7007
+ return /* @__PURE__ */ jsxs29(
6982
7008
  "div",
6983
7009
  {
6984
7010
  ...props,
@@ -7041,7 +7067,7 @@ function PageControl({
7041
7067
  }
7042
7068
 
7043
7069
  // src/components/Panel/Panel.tsx
7044
- import { jsx as jsx49, jsxs as jsxs29 } from "react/jsx-runtime";
7070
+ import { jsx as jsx49, jsxs as jsxs30 } from "react/jsx-runtime";
7045
7071
  function Panel({
7046
7072
  children,
7047
7073
  className,
@@ -7052,7 +7078,7 @@ function Panel({
7052
7078
  title,
7053
7079
  ...props
7054
7080
  }) {
7055
- return /* @__PURE__ */ jsxs29(
7081
+ return /* @__PURE__ */ jsxs30(
7056
7082
  "section",
7057
7083
  {
7058
7084
  ...props,
@@ -7095,11 +7121,11 @@ function Panel({
7095
7121
  // src/components/PropertyGrid/PropertyGrid.tsx
7096
7122
  import {
7097
7123
  useId as useId9,
7098
- useMemo as useMemo15,
7124
+ useMemo as useMemo14,
7099
7125
  useRef as useRef18,
7100
7126
  useState as useState23
7101
7127
  } from "react";
7102
- import { jsx as jsx50, jsxs as jsxs30 } from "react/jsx-runtime";
7128
+ import { jsx as jsx50, jsxs as jsxs31 } from "react/jsx-runtime";
7103
7129
  function collectGroupIds(entries) {
7104
7130
  const groupIds = /* @__PURE__ */ new Set();
7105
7131
  function visit(nextEntries) {
@@ -7208,22 +7234,22 @@ function PropertyGrid({
7208
7234
  }) {
7209
7235
  const editorIdPrefix = useId9();
7210
7236
  const rowButtonRefs = useRef18({});
7211
- const groupIds = useMemo15(() => collectGroupIds(entries), [entries]);
7237
+ const groupIds = useMemo14(() => collectGroupIds(entries), [entries]);
7212
7238
  const isExpandedControlled = expandedIdsProp !== void 0;
7213
7239
  const isActiveControlled = activeIdProp !== void 0;
7214
7240
  const [uncontrolledExpandedIds, setUncontrolledExpandedIds] = useState23(() => getInitialExpandedIds(entries, defaultExpandedIds));
7215
7241
  const resolvedExpandedIds = expandedIdsProp ?? uncontrolledExpandedIds;
7216
- const expandedIdSet = useMemo15(
7242
+ const expandedIdSet = useMemo14(
7217
7243
  () => new Set(
7218
7244
  resolvedExpandedIds.filter((expandedId) => groupIds.has(expandedId))
7219
7245
  ),
7220
7246
  [groupIds, resolvedExpandedIds]
7221
7247
  );
7222
- const rows = useMemo15(
7248
+ const rows = useMemo14(
7223
7249
  () => collectVisibleRows(entries, expandedIdSet),
7224
7250
  [entries, expandedIdSet]
7225
7251
  );
7226
- const interactiveRows = useMemo15(() => collectInteractiveRows(rows), [rows]);
7252
+ const interactiveRows = useMemo14(() => collectInteractiveRows(rows), [rows]);
7227
7253
  const [uncontrolledActiveId, setUncontrolledActiveId] = useState23(() => getInitialActiveId2(interactiveRows, defaultActiveId));
7228
7254
  const requestedActiveId = isActiveControlled ? activeIdProp : uncontrolledActiveId;
7229
7255
  const resolvedActiveId = requestedActiveId && interactiveRows.some((row) => row.id === requestedActiveId) ? requestedActiveId : interactiveRows[0]?.id;
@@ -7360,7 +7386,7 @@ function PropertyGrid({
7360
7386
  }
7361
7387
  if (row.type === "group") {
7362
7388
  const isExpanded = expandedIdSet.has(row.entry.id);
7363
- return /* @__PURE__ */ jsxs30(
7389
+ return /* @__PURE__ */ jsxs31(
7364
7390
  "div",
7365
7391
  {
7366
7392
  className: "nu-property-grid__row",
@@ -7389,7 +7415,7 @@ function PropertyGrid({
7389
7415
  "--nu-property-grid-depth": row.depth
7390
7416
  },
7391
7417
  type: "button",
7392
- children: /* @__PURE__ */ jsxs30("span", { className: "nu-property-grid__lead", children: [
7418
+ children: /* @__PURE__ */ jsxs31("span", { className: "nu-property-grid__lead", children: [
7393
7419
  /* @__PURE__ */ jsx50("span", { className: "nu-property-grid__expander", children: /* @__PURE__ */ jsx50(
7394
7420
  NuGlyph,
7395
7421
  {
@@ -7407,7 +7433,7 @@ function PropertyGrid({
7407
7433
  );
7408
7434
  }
7409
7435
  const editorId = `${editorIdPrefix}-editor-${row.entry.id}`;
7410
- return /* @__PURE__ */ jsxs30(
7436
+ return /* @__PURE__ */ jsxs31(
7411
7437
  "div",
7412
7438
  {
7413
7439
  className: "nu-property-grid__row",
@@ -7434,13 +7460,13 @@ function PropertyGrid({
7434
7460
  "--nu-property-grid-depth": row.depth
7435
7461
  },
7436
7462
  type: "button",
7437
- children: /* @__PURE__ */ jsxs30("span", { className: "nu-property-grid__lead", children: [
7463
+ children: /* @__PURE__ */ jsxs31("span", { className: "nu-property-grid__lead", children: [
7438
7464
  /* @__PURE__ */ jsx50("span", { className: "nu-property-grid__expander-placeholder" }),
7439
7465
  /* @__PURE__ */ jsx50("span", { className: "nu-property-grid__label-text", children: renderMnemonicText(row.entry.label) })
7440
7466
  ] })
7441
7467
  }
7442
7468
  ),
7443
- /* @__PURE__ */ jsxs30(
7469
+ /* @__PURE__ */ jsxs31(
7444
7470
  "div",
7445
7471
  {
7446
7472
  className: "nu-property-grid__editor",
@@ -7462,7 +7488,7 @@ function PropertyGrid({
7462
7488
  }
7463
7489
 
7464
7490
  // src/components/ProgressBar/ProgressBar.tsx
7465
- import { jsx as jsx51, jsxs as jsxs31 } from "react/jsx-runtime";
7491
+ import { jsx as jsx51, jsxs as jsxs32 } from "react/jsx-runtime";
7466
7492
  function clamp3(value, min, max) {
7467
7493
  return Math.min(max, Math.max(min, value));
7468
7494
  }
@@ -7486,7 +7512,7 @@ function ProgressBar({
7486
7512
  const clampedValue = clamp3(value, min, safeMax);
7487
7513
  const percent = Math.round((clampedValue - min) / (safeMax - min) * 100);
7488
7514
  const renderedValue = valueRenderer ? valueRenderer(percent, clampedValue, min, safeMax) : `${percent}%`;
7489
- return /* @__PURE__ */ jsxs31(
7515
+ return /* @__PURE__ */ jsxs32(
7490
7516
  "div",
7491
7517
  {
7492
7518
  ...props,
@@ -7506,7 +7532,7 @@ function ProgressBar({
7506
7532
  children: renderMnemonicText(label)
7507
7533
  }
7508
7534
  ) : null,
7509
- /* @__PURE__ */ jsxs31(
7535
+ /* @__PURE__ */ jsxs32(
7510
7536
  "div",
7511
7537
  {
7512
7538
  className: cx("nu-progress-bar__track", slotClassNames?.track),
@@ -7556,7 +7582,7 @@ function ProgressBar({
7556
7582
 
7557
7583
  // src/components/RadioGroup/RadioButton.tsx
7558
7584
  import { useId as useId10, useState as useState24 } from "react";
7559
- import { jsx as jsx52, jsxs as jsxs32 } from "react/jsx-runtime";
7585
+ import { jsx as jsx52, jsxs as jsxs33 } from "react/jsx-runtime";
7560
7586
  function RadioButton({
7561
7587
  checked,
7562
7588
  className,
@@ -7580,8 +7606,8 @@ function RadioButton({
7580
7606
  }
7581
7607
  onCheckedChange?.(event.target.checked, event);
7582
7608
  }
7583
- return /* @__PURE__ */ jsxs32("label", { className: ["nu-radio-button", className].filter(Boolean).join(" "), children: [
7584
- /* @__PURE__ */ jsxs32("span", { className: "nu-radio-button__main", children: [
7609
+ return /* @__PURE__ */ jsxs33("label", { className: ["nu-radio-button", className].filter(Boolean).join(" "), children: [
7610
+ /* @__PURE__ */ jsxs33("span", { className: "nu-radio-button__main", children: [
7585
7611
  /* @__PURE__ */ jsx52(
7586
7612
  "input",
7587
7613
  {
@@ -7595,7 +7621,7 @@ function RadioButton({
7595
7621
  type: "radio"
7596
7622
  }
7597
7623
  ),
7598
- /* @__PURE__ */ jsx52("span", { "aria-hidden": "true", className: "nu-radio-button__control", children: /* @__PURE__ */ jsxs32("span", { className: "nu-radio-button__disc", children: [
7624
+ /* @__PURE__ */ jsx52("span", { "aria-hidden": "true", className: "nu-radio-button__control", children: /* @__PURE__ */ jsxs33("span", { className: "nu-radio-button__disc", children: [
7599
7625
  /* @__PURE__ */ jsx52(NuGlyph, { className: "nu-radio-button__ring", name: "radio-ring" }),
7600
7626
  resolvedChecked ? /* @__PURE__ */ jsx52(NuGlyph, { className: "nu-radio-button__fill", name: "radio-fill" }) : null
7601
7627
  ] }) }),
@@ -7607,7 +7633,7 @@ function RadioButton({
7607
7633
 
7608
7634
  // src/components/RadioGroup/RadioGroup.tsx
7609
7635
  import { useId as useId11, useState as useState25 } from "react";
7610
- import { jsx as jsx53, jsxs as jsxs33 } from "react/jsx-runtime";
7636
+ import { jsx as jsx53, jsxs as jsxs34 } from "react/jsx-runtime";
7611
7637
  function RadioGroup({
7612
7638
  className,
7613
7639
  defaultValue,
@@ -7634,7 +7660,7 @@ function RadioGroup({
7634
7660
  }
7635
7661
  onValueChange?.(nextValue);
7636
7662
  }
7637
- return /* @__PURE__ */ jsxs33(
7663
+ return /* @__PURE__ */ jsxs34(
7638
7664
  "fieldset",
7639
7665
  {
7640
7666
  ...props,
@@ -7714,12 +7740,12 @@ function ReportCell({
7714
7740
  import {
7715
7741
  useEffect as useEffect13,
7716
7742
  useId as useId12,
7717
- useMemo as useMemo16,
7743
+ useMemo as useMemo15,
7718
7744
  useRef as useRef19,
7719
7745
  useState as useState26
7720
7746
  } from "react";
7721
7747
  import { createPortal as createPortal4 } from "react-dom";
7722
- import { jsx as jsx55, jsxs as jsxs34 } from "react/jsx-runtime";
7748
+ import { jsx as jsx55, jsxs as jsxs35 } from "react/jsx-runtime";
7723
7749
  function resolveSearchBoxPortalRoot() {
7724
7750
  return document.body;
7725
7751
  }
@@ -7764,7 +7790,7 @@ function SearchBox({
7764
7790
  const [selectedValue, setSelectedValue] = useState26(null);
7765
7791
  const normalizedQuery = (isQueryControlled ? queryProp : uncontrolledQuery) ?? "";
7766
7792
  const trimmedQuery = normalizedQuery.trim();
7767
- const resultOptions = useMemo16(() => {
7793
+ const resultOptions = useMemo15(() => {
7768
7794
  return results.map((item, index) => ({
7769
7795
  item,
7770
7796
  listBoxItem: {
@@ -7778,7 +7804,7 @@ function SearchBox({
7778
7804
  value: getItemId(item, index)
7779
7805
  }));
7780
7806
  }, [getItemDetails, getItemDisabled, getItemId, getItemText, results]);
7781
- const listBoxData = useMemo16(
7807
+ const listBoxData = useMemo15(
7782
7808
  () => [
7783
7809
  {
7784
7810
  category: null,
@@ -7914,7 +7940,7 @@ function SearchBox({
7914
7940
  break;
7915
7941
  }
7916
7942
  }
7917
- return /* @__PURE__ */ jsxs34(
7943
+ return /* @__PURE__ */ jsxs35(
7918
7944
  "div",
7919
7945
  {
7920
7946
  ...props,
@@ -7923,7 +7949,7 @@ function SearchBox({
7923
7949
  style,
7924
7950
  children: [
7925
7951
  /* @__PURE__ */ jsx55("label", { className: "nu-search-box__label", htmlFor: fieldId, id: labelId, children: renderMnemonicText(label) }),
7926
- /* @__PURE__ */ jsxs34("span", { className: "nu-search-box__slot", ref: fieldRef, children: [
7952
+ /* @__PURE__ */ jsxs35("span", { className: "nu-search-box__slot", ref: fieldRef, children: [
7927
7953
  /* @__PURE__ */ jsx55("span", { "aria-hidden": "true", className: "nu-search-box__bracket", children: "[" }),
7928
7954
  /* @__PURE__ */ jsx55("span", { className: "nu-search-box__input-shell", children: /* @__PURE__ */ jsx55(
7929
7955
  "input",
@@ -7974,10 +8000,10 @@ function SearchBox({
7974
8000
  // src/components/SpinBox/SpinBox.tsx
7975
8001
  import {
7976
8002
  useId as useId13,
7977
- useMemo as useMemo17,
8003
+ useMemo as useMemo16,
7978
8004
  useState as useState27
7979
8005
  } from "react";
7980
- import { jsx as jsx56, jsxs as jsxs35 } from "react/jsx-runtime";
8006
+ import { jsx as jsx56, jsxs as jsxs36 } from "react/jsx-runtime";
7981
8007
  function clampSpinValue(value, min, max) {
7982
8008
  let nextValue = value;
7983
8009
  if (min !== void 0) {
@@ -8082,15 +8108,15 @@ function SpinBox({
8082
8108
  }
8083
8109
  onKeyDown?.(event);
8084
8110
  }
8085
- const decrementDisabled = useMemo17(
8111
+ const decrementDisabled = useMemo16(
8086
8112
  () => disabled || min !== void 0 && numericValue <= min,
8087
8113
  [disabled, min, numericValue]
8088
8114
  );
8089
- const incrementDisabled = useMemo17(
8115
+ const incrementDisabled = useMemo16(
8090
8116
  () => disabled || max !== void 0 && numericValue >= max,
8091
8117
  [disabled, max, numericValue]
8092
8118
  );
8093
- return /* @__PURE__ */ jsxs35(
8119
+ return /* @__PURE__ */ jsxs36(
8094
8120
  "label",
8095
8121
  {
8096
8122
  className: cx("nu-spin-box", slotClassNames?.root, className),
@@ -8105,7 +8131,7 @@ function SpinBox({
8105
8131
  children: renderMnemonicText(label)
8106
8132
  }
8107
8133
  ),
8108
- /* @__PURE__ */ jsxs35(
8134
+ /* @__PURE__ */ jsxs36(
8109
8135
  "span",
8110
8136
  {
8111
8137
  className: cx("nu-spin-box__slot", slotClassNames?.slot),
@@ -8153,7 +8179,7 @@ function SpinBox({
8153
8179
  children: "]"
8154
8180
  }
8155
8181
  ),
8156
- /* @__PURE__ */ jsxs35(
8182
+ /* @__PURE__ */ jsxs36(
8157
8183
  "span",
8158
8184
  {
8159
8185
  className: cx("nu-spin-box__controls", slotClassNames?.controls),
@@ -8208,7 +8234,7 @@ import {
8208
8234
  useRef as useRef20,
8209
8235
  useState as useState28
8210
8236
  } from "react";
8211
- import { jsx as jsx57, jsxs as jsxs36 } from "react/jsx-runtime";
8237
+ import { jsx as jsx57, jsxs as jsxs37 } from "react/jsx-runtime";
8212
8238
  function clamp4(value, min, max) {
8213
8239
  return Math.min(max, Math.max(min, value));
8214
8240
  }
@@ -8363,7 +8389,7 @@ function Splitter({
8363
8389
  commitValue(max);
8364
8390
  }
8365
8391
  }
8366
- return /* @__PURE__ */ jsxs36(
8392
+ return /* @__PURE__ */ jsxs37(
8367
8393
  "div",
8368
8394
  {
8369
8395
  ...props,
@@ -8409,11 +8435,11 @@ function Splitter({
8409
8435
  import {
8410
8436
  useEffect as useEffect15,
8411
8437
  useId as useId15,
8412
- useMemo as useMemo18,
8438
+ useMemo as useMemo17,
8413
8439
  useRef as useRef21,
8414
8440
  useState as useState29
8415
8441
  } from "react";
8416
- import { jsx as jsx58, jsxs as jsxs37 } from "react/jsx-runtime";
8442
+ import { jsx as jsx58, jsxs as jsxs38 } from "react/jsx-runtime";
8417
8443
  function clamp5(value, min, max) {
8418
8444
  return Math.min(max, Math.max(min, value));
8419
8445
  }
@@ -8463,7 +8489,7 @@ function TickBar({
8463
8489
  const trackRef = useRef21(null);
8464
8490
  const resolvedValue = isControlled ? clamp5(snapToStep(value ?? initialValue, min, safeStep), min, safeMax) : uncontrolledValue;
8465
8491
  const ratio = safeMax === min ? 0 : (resolvedValue - min) / (safeMax - min);
8466
- const derivedTickCount = useMemo18(() => {
8492
+ const derivedTickCount = useMemo17(() => {
8467
8493
  if (tickCount !== void 0) {
8468
8494
  return Math.max(2, tickCount);
8469
8495
  }
@@ -8549,7 +8575,7 @@ function TickBar({
8549
8575
  }
8550
8576
  onKeyDown?.(event);
8551
8577
  }
8552
- return /* @__PURE__ */ jsxs37(
8578
+ return /* @__PURE__ */ jsxs38(
8553
8579
  "div",
8554
8580
  {
8555
8581
  ...props,
@@ -8570,13 +8596,13 @@ function TickBar({
8570
8596
  children: renderMnemonicText(label)
8571
8597
  }
8572
8598
  ) : null,
8573
- /* @__PURE__ */ jsxs37(
8599
+ /* @__PURE__ */ jsxs38(
8574
8600
  "div",
8575
8601
  {
8576
8602
  className: cx("nu-tick-bar__slot", slotClassNames?.slot),
8577
8603
  style: slotStyles?.slot,
8578
8604
  children: [
8579
- /* @__PURE__ */ jsxs37(
8605
+ /* @__PURE__ */ jsxs38(
8580
8606
  "div",
8581
8607
  {
8582
8608
  "aria-describedby": hintId,
@@ -8685,7 +8711,7 @@ function TickBar({
8685
8711
  }
8686
8712
 
8687
8713
  // src/components/ToolBar/ToolBar.tsx
8688
- import { jsx as jsx59, jsxs as jsxs38 } from "react/jsx-runtime";
8714
+ import { jsx as jsx59, jsxs as jsxs39 } from "react/jsx-runtime";
8689
8715
  function ToolBar({
8690
8716
  children,
8691
8717
  className,
@@ -8697,7 +8723,7 @@ function ToolBar({
8697
8723
  wrap = false,
8698
8724
  ...props
8699
8725
  }) {
8700
- return /* @__PURE__ */ jsxs38(
8726
+ return /* @__PURE__ */ jsxs39(
8701
8727
  "div",
8702
8728
  {
8703
8729
  ...props,
@@ -8794,11 +8820,11 @@ function ToolSeparator({ className, ...props }) {
8794
8820
  // src/components/TreeView/TreeView.tsx
8795
8821
  import {
8796
8822
  forwardRef as forwardRef3,
8797
- useCallback as useCallback7,
8823
+ useCallback as useCallback8,
8798
8824
  useEffect as useEffect16,
8799
8825
  useId as useId16,
8800
8826
  useImperativeHandle as useImperativeHandle3,
8801
- useMemo as useMemo19,
8827
+ useMemo as useMemo18,
8802
8828
  useRef as useRef22,
8803
8829
  useState as useState30
8804
8830
  } from "react";
@@ -8898,7 +8924,7 @@ function collectVisibleTreeItems(items, expandedIds, depth = 0, guideMask = [],
8898
8924
 
8899
8925
  // src/components/TreeView/internals/TreeViewItem.tsx
8900
8926
  import { memo as memo4 } from "react";
8901
- import { jsx as jsx60, jsxs as jsxs39 } from "react/jsx-runtime";
8927
+ import { jsx as jsx60, jsxs as jsxs40 } from "react/jsx-runtime";
8902
8928
  function areTreeViewGuideArraysEqual(previousArray, nextArray) {
8903
8929
  if (previousArray.length !== nextArray.length) {
8904
8930
  return false;
@@ -8972,8 +8998,8 @@ function TreeViewItemInner({
8972
8998
  handleActivate();
8973
8999
  onToggleItemCheck?.(item, !isChecked);
8974
9000
  }
8975
- return /* @__PURE__ */ jsxs39("div", { className: "nu-tree-view__row", role: "none", children: [
8976
- /* @__PURE__ */ jsxs39(
9001
+ return /* @__PURE__ */ jsxs40("div", { className: "nu-tree-view__row", role: "none", children: [
9002
+ /* @__PURE__ */ jsxs40(
8977
9003
  "div",
8978
9004
  {
8979
9005
  "aria-checked": isCheckable ? isChecked : void 0,
@@ -8992,7 +9018,7 @@ function TreeViewItemInner({
8992
9018
  ref: (node) => registerItemRef(itemId, node),
8993
9019
  role: "treeitem",
8994
9020
  children: [
8995
- /* @__PURE__ */ jsxs39("span", { "aria-hidden": "true", className: "nu-tree-view__prefix", children: [
9021
+ /* @__PURE__ */ jsxs40("span", { "aria-hidden": "true", className: "nu-tree-view__prefix", children: [
8996
9022
  guideMask.map((hasGuide, guideIndex) => /* @__PURE__ */ jsx60(
8997
9023
  "span",
8998
9024
  {
@@ -9004,7 +9030,7 @@ function TreeViewItemInner({
9004
9030
  },
9005
9031
  `${itemId}-guide-${guideIndex}`
9006
9032
  )),
9007
- /* @__PURE__ */ jsxs39(
9033
+ /* @__PURE__ */ jsxs40(
9008
9034
  "span",
9009
9035
  {
9010
9036
  className: "nu-tree-view__lead",
@@ -9052,7 +9078,7 @@ function TreeViewItemInner({
9052
9078
  }
9053
9079
  )
9054
9080
  ] }),
9055
- /* @__PURE__ */ jsxs39("span", { className: "nu-tree-view__content", children: [
9081
+ /* @__PURE__ */ jsxs40("span", { className: "nu-tree-view__content", children: [
9056
9082
  isCheckable ? /* @__PURE__ */ jsx60("span", { className: "nu-tree-view__check-slot", children: /* @__PURE__ */ jsx60(
9057
9083
  "button",
9058
9084
  {
@@ -9148,15 +9174,15 @@ function TreeViewInner({
9148
9174
  });
9149
9175
  const [uncontrolledSelectedId, setUncontrolledSelectedId] = useState30(null);
9150
9176
  const resolvedExpandedIds = isExpandedControlled ? expandedIds : uncontrolledExpandedIds;
9151
- const expandedIdSet = useMemo19(
9177
+ const expandedIdSet = useMemo18(
9152
9178
  () => new Set(resolvedExpandedIds),
9153
9179
  [resolvedExpandedIds]
9154
9180
  );
9155
- const visibleItems = useMemo19(
9181
+ const visibleItems = useMemo18(
9156
9182
  () => collectVisibleTreeItems(data, expandedIdSet),
9157
9183
  [data, expandedIdSet]
9158
9184
  );
9159
- const selectableItems = useMemo19(
9185
+ const selectableItems = useMemo18(
9160
9186
  () => visibleItems.filter(({ item }) => !item.disabled),
9161
9187
  [visibleItems]
9162
9188
  );
@@ -9172,13 +9198,13 @@ function TreeViewInner({
9172
9198
  block: "nearest"
9173
9199
  });
9174
9200
  }, [resolvedActiveId]);
9175
- const registerItemRef = useCallback7(
9201
+ const registerItemRef = useCallback8(
9176
9202
  (itemId, node) => {
9177
9203
  itemRefs.current[itemId] = node;
9178
9204
  },
9179
9205
  []
9180
9206
  );
9181
- const setExpandedState = useCallback7(
9207
+ const setExpandedState = useCallback8(
9182
9208
  (item, nextExpanded) => {
9183
9209
  const nextExpandedIds = nextExpanded ? Array.from(/* @__PURE__ */ new Set([...resolvedExpandedIds, item.id])) : resolvedExpandedIds.filter((expandedId) => expandedId !== item.id);
9184
9210
  if (!isExpandedControlled) {
@@ -9188,7 +9214,7 @@ function TreeViewInner({
9188
9214
  },
9189
9215
  [isExpandedControlled, onExpandedIdsChange, resolvedExpandedIds]
9190
9216
  );
9191
- const activateEntry = useCallback7(
9217
+ const activateEntry = useCallback8(
9192
9218
  (item, itemId) => {
9193
9219
  if (item.disabled) {
9194
9220
  return;
@@ -9201,7 +9227,7 @@ function TreeViewInner({
9201
9227
  },
9202
9228
  [onItemSelect, selectedId]
9203
9229
  );
9204
- const activateResolvedItem = useCallback7(
9230
+ const activateResolvedItem = useCallback8(
9205
9231
  (itemId) => {
9206
9232
  if (!itemId) {
9207
9233
  return;
@@ -9410,12 +9436,12 @@ var TreeView = forwardRef3(TreeViewInner);
9410
9436
  // src/components/TreeListView/TreeListView.tsx
9411
9437
  import {
9412
9438
  forwardRef as forwardRef4,
9413
- useCallback as useCallback8,
9439
+ useCallback as useCallback9,
9414
9440
  useEffect as useEffect17,
9415
9441
  useId as useId17,
9416
9442
  useImperativeHandle as useImperativeHandle4,
9417
9443
  useLayoutEffect as useLayoutEffect6,
9418
- useMemo as useMemo20,
9444
+ useMemo as useMemo19,
9419
9445
  useRef as useRef23,
9420
9446
  useState as useState31
9421
9447
  } from "react";
@@ -9508,9 +9534,9 @@ function renderTreeListCellValue(item, column) {
9508
9534
 
9509
9535
  // src/components/TreeListView/internals/TreeListViewRow.tsx
9510
9536
  import { memo as memo5 } from "react";
9511
- import { Fragment as Fragment7, jsx as jsx62, jsxs as jsxs40 } from "react/jsx-runtime";
9537
+ import { Fragment as Fragment7, jsx as jsx62, jsxs as jsxs41 } from "react/jsx-runtime";
9512
9538
  function renderTreeTitleContent(item) {
9513
- return /* @__PURE__ */ jsxs40(Fragment7, { children: [
9539
+ return /* @__PURE__ */ jsxs41(Fragment7, { children: [
9514
9540
  /* @__PURE__ */ jsx62("span", { className: "nu-tree-list-view__title", children: item.title }),
9515
9541
  item.hint ? /* @__PURE__ */ jsx62("span", { className: "nu-tree-list-view__hint", children: item.hint }) : null
9516
9542
  ] });
@@ -9560,6 +9586,7 @@ function TreeListViewRowInner({
9560
9586
  onActivateItem,
9561
9587
  onDoubleClickItem,
9562
9588
  onItemDragOut,
9589
+ renderDragPreview,
9563
9590
  onPopupMenuItem,
9564
9591
  onToggleItemCheck,
9565
9592
  onToggleItemExpanded,
@@ -9591,6 +9618,7 @@ function TreeListViewRowInner({
9591
9618
  disabled: item.disabled || !getDragItem,
9592
9619
  getItem: () => getDragItem?.(item, dragContext) ?? false,
9593
9620
  onDropAccepted: () => onItemDragOut?.(item, dragContext),
9621
+ renderPreview: renderDragPreview ? () => renderDragPreview(item, dragContext) : void 0,
9594
9622
  sourceType: "tree-list-item"
9595
9623
  });
9596
9624
  function handleActivate() {
@@ -9638,7 +9666,7 @@ function TreeListViewRowInner({
9638
9666
  handleActivate();
9639
9667
  onToggleItemCheck?.(item, !isChecked);
9640
9668
  }
9641
- return /* @__PURE__ */ jsxs40(Fragment7, { children: [
9669
+ return /* @__PURE__ */ jsxs41(Fragment7, { children: [
9642
9670
  /* @__PURE__ */ jsx62(
9643
9671
  "div",
9644
9672
  {
@@ -9657,17 +9685,16 @@ function TreeListViewRowInner({
9657
9685
  onClick: handleActivate,
9658
9686
  onContextMenu: onPopupMenuItem ? handleContextMenu : void 0,
9659
9687
  onDoubleClick: handleDoubleClick,
9660
- onPointerCancel: dragSource.onPointerCancel,
9661
- onPointerDown: dragSource.onPointerDown,
9662
- onPointerMove: dragSource.onPointerMove,
9663
- onPointerUp: dragSource.onPointerUp,
9664
- ref: (node) => registerItemRef(itemId, node),
9688
+ ref: (node) => {
9689
+ registerItemRef(itemId, node);
9690
+ dragSource.dragRef(node);
9691
+ },
9665
9692
  role: "row",
9666
9693
  style: {
9667
9694
  "--nu-tree-list-view-columns": templateColumns
9668
9695
  },
9669
9696
  children: columns.map(
9670
- (column, columnIndex) => column.id === treeColumnId ? /* @__PURE__ */ jsxs40(
9697
+ (column, columnIndex) => column.id === treeColumnId ? /* @__PURE__ */ jsxs41(
9671
9698
  "span",
9672
9699
  {
9673
9700
  className: [
@@ -9679,7 +9706,7 @@ function TreeListViewRowInner({
9679
9706
  "data-column-id": column.id,
9680
9707
  role: "gridcell",
9681
9708
  children: [
9682
- /* @__PURE__ */ jsxs40("span", { "aria-hidden": "true", className: "nu-tree-list-view__prefix", children: [
9709
+ /* @__PURE__ */ jsxs41("span", { "aria-hidden": "true", className: "nu-tree-list-view__prefix", children: [
9683
9710
  guideMask.map((hasGuide, guideIndex) => /* @__PURE__ */ jsx62(
9684
9711
  "span",
9685
9712
  {
@@ -9691,7 +9718,7 @@ function TreeListViewRowInner({
9691
9718
  },
9692
9719
  `${itemId}-guide-${guideIndex}`
9693
9720
  )),
9694
- /* @__PURE__ */ jsxs40(
9721
+ /* @__PURE__ */ jsxs41(
9695
9722
  "span",
9696
9723
  {
9697
9724
  className: "nu-tree-list-view__lead",
@@ -9739,7 +9766,7 @@ function TreeListViewRowInner({
9739
9766
  }
9740
9767
  )
9741
9768
  ] }),
9742
- /* @__PURE__ */ jsxs40("span", { className: "nu-tree-list-view__tree-content", children: [
9769
+ /* @__PURE__ */ jsxs41("span", { className: "nu-tree-list-view__tree-content", children: [
9743
9770
  isCheckable ? /* @__PURE__ */ jsx62("span", { className: "nu-tree-list-view__check-slot", children: /* @__PURE__ */ jsx62(
9744
9771
  "button",
9745
9772
  {
@@ -9840,7 +9867,7 @@ var TreeListViewRow = memo5(
9840
9867
  );
9841
9868
 
9842
9869
  // src/components/TreeListView/TreeListView.tsx
9843
- import { jsx as jsx63, jsxs as jsxs41 } from "react/jsx-runtime";
9870
+ import { jsx as jsx63, jsxs as jsxs42 } from "react/jsx-runtime";
9844
9871
  function getColumnStorageKey(columnStoreKey) {
9845
9872
  const normalizedKey = columnStoreKey?.trim();
9846
9873
  return normalizedKey ? `reactnu.${normalizedKey}` : null;
@@ -9892,6 +9919,7 @@ function TreeListViewInner({
9892
9919
  onItemCheckChange,
9893
9920
  onItemDoubleClick,
9894
9921
  onItemDragOut,
9922
+ renderDragPreview,
9895
9923
  onItemSelect,
9896
9924
  onDrop,
9897
9925
  selectedId,
@@ -9920,15 +9948,15 @@ function TreeListViewInner({
9920
9948
  const [userColumnWidths, setUserColumnWidths] = useState31(() => readStoredColumnWidths(storageKey, columns));
9921
9949
  const isActiveControlled = activeItemIdProp !== void 0;
9922
9950
  const resolvedExpandedIds = isExpandedControlled ? expandedIds : uncontrolledExpandedIds;
9923
- const expandedIdSet = useMemo20(
9951
+ const expandedIdSet = useMemo19(
9924
9952
  () => new Set(resolvedExpandedIds),
9925
9953
  [resolvedExpandedIds]
9926
9954
  );
9927
- const visibleItems = useMemo20(
9955
+ const visibleItems = useMemo19(
9928
9956
  () => collectVisibleTreeListItems(data, expandedIdSet),
9929
9957
  [data, expandedIdSet]
9930
9958
  );
9931
- const selectableItems = useMemo20(
9959
+ const selectableItems = useMemo19(
9932
9960
  () => visibleItems.filter(({ item }) => !item.disabled),
9933
9961
  [visibleItems]
9934
9962
  );
@@ -9937,7 +9965,7 @@ function TreeListViewInner({
9937
9965
  const [uncontrolledActiveItemId, setUncontrolledActiveItemId] = useState31(() => defaultActiveItemId ?? resolvedSelectedId);
9938
9966
  const activeItemId = activeItemIdProp !== void 0 ? activeItemIdProp : uncontrolledActiveItemId;
9939
9967
  const resolvedActiveItemId = activeItemId && selectableItems.some((entry) => entry.itemId === activeItemId) ? activeItemId : resolvedSelectedId;
9940
- const minColumnWidthById = useMemo20(
9968
+ const minColumnWidthById = useMemo19(
9941
9969
  () => Object.fromEntries(
9942
9970
  columns.map(
9943
9971
  (column) => [column.id, column.minWidth ?? 0]
@@ -9945,29 +9973,29 @@ function TreeListViewInner({
9945
9973
  ),
9946
9974
  [columns]
9947
9975
  );
9948
- const templateColumns = useMemo20(
9976
+ const templateColumns = useMemo19(
9949
9977
  () => getTreeListTemplateColumns(columns, {
9950
9978
  autoColumnWidths,
9951
9979
  userColumnWidths
9952
9980
  }),
9953
9981
  [autoColumnWidths, columns, userColumnWidths]
9954
9982
  );
9955
- const treeColumnId = useMemo20(
9983
+ const treeColumnId = useMemo19(
9956
9984
  () => getTreeListTreeColumnId(columns),
9957
9985
  [columns]
9958
9986
  );
9959
- const rowIndexMap = useMemo20(
9987
+ const rowIndexMap = useMemo19(
9960
9988
  () => new Map(
9961
9989
  visibleItems.map((entry, index) => [entry.itemId, index])
9962
9990
  ),
9963
9991
  [visibleItems]
9964
9992
  );
9965
- const dropTargetOptions = useMemo20(
9993
+ const dropTargetOptions = useMemo19(
9966
9994
  () => onDrop ? { accepts: acceptsDrop, onDrop, type: "tree-list" } : void 0,
9967
9995
  [acceptsDrop, onDrop]
9968
9996
  );
9969
9997
  useNuDropTarget(rootElement, dropTargetOptions);
9970
- const setRootRef = useCallback8((node) => {
9998
+ const setRootRef = useCallback9((node) => {
9971
9999
  rootRef.current = node;
9972
10000
  setRootElement(node);
9973
10001
  }, []);
@@ -10000,17 +10028,17 @@ function TreeListViewInner({
10000
10028
  } catch {
10001
10029
  }
10002
10030
  }, [storageKey, userColumnWidths]);
10003
- const registerItemRef = useCallback8(
10031
+ const registerItemRef = useCallback9(
10004
10032
  (itemId, node) => {
10005
10033
  itemRefs.current[itemId] = node;
10006
10034
  },
10007
10035
  []
10008
10036
  );
10009
- const resolveCellContent = useCallback8(
10037
+ const resolveCellContent = useCallback9(
10010
10038
  (...args) => getCellContent?.(...args),
10011
10039
  [getCellContent]
10012
10040
  );
10013
- const handleItemDoubleClick = useCallback8(
10041
+ const handleItemDoubleClick = useCallback9(
10014
10042
  (item) => onItemDoubleClick?.(item),
10015
10043
  [onItemDoubleClick]
10016
10044
  );
@@ -10053,7 +10081,7 @@ function TreeListViewInner({
10053
10081
  }
10054
10082
  };
10055
10083
  }, []);
10056
- const setExpandedState = useCallback8(
10084
+ const setExpandedState = useCallback9(
10057
10085
  (item, nextExpanded) => {
10058
10086
  const nextExpandedIds = nextExpanded ? Array.from(/* @__PURE__ */ new Set([...resolvedExpandedIds, item.id])) : resolvedExpandedIds.filter((expandedId) => expandedId !== item.id);
10059
10087
  if (!isExpandedControlled) {
@@ -10063,7 +10091,7 @@ function TreeListViewInner({
10063
10091
  },
10064
10092
  [isExpandedControlled, onExpandedIdsChange, resolvedExpandedIds]
10065
10093
  );
10066
- const updateActiveItem = useCallback8(
10094
+ const updateActiveItem = useCallback9(
10067
10095
  (item) => {
10068
10096
  if (!isActiveControlled) {
10069
10097
  setUncontrolledActiveItemId(item.id);
@@ -10072,7 +10100,7 @@ function TreeListViewInner({
10072
10100
  },
10073
10101
  [isActiveControlled, onActiveItemChange]
10074
10102
  );
10075
- const activateEntry = useCallback8(
10103
+ const activateEntry = useCallback9(
10076
10104
  (item, itemId) => {
10077
10105
  if (item.disabled) {
10078
10106
  return;
@@ -10085,7 +10113,7 @@ function TreeListViewInner({
10085
10113
  },
10086
10114
  [onItemSelect, selectedId, updateActiveItem]
10087
10115
  );
10088
- const handleItemPopupMenu = useCallback8(
10116
+ const handleItemPopupMenu = useCallback9(
10089
10117
  (event, item, context) => {
10090
10118
  if (item.disabled || !onPopupMenu) {
10091
10119
  return;
@@ -10097,7 +10125,7 @@ function TreeListViewInner({
10097
10125
  },
10098
10126
  [activateEntry, onPopupMenu]
10099
10127
  );
10100
- const activateResolvedItem = useCallback8(
10128
+ const activateResolvedItem = useCallback9(
10101
10129
  (itemId) => {
10102
10130
  if (!itemId) {
10103
10131
  return;
@@ -10111,7 +10139,7 @@ function TreeListViewInner({
10111
10139
  },
10112
10140
  [activateEntry, selectableItems]
10113
10141
  );
10114
- const handleItemCheckChange = useCallback8(
10142
+ const handleItemCheckChange = useCallback9(
10115
10143
  (item, checked) => {
10116
10144
  onItemCheckChange?.(item, checked);
10117
10145
  },
@@ -10181,7 +10209,7 @@ function TreeListViewInner({
10181
10209
  function isItemChecked(item) {
10182
10210
  return checkedIds ? checkedIds.includes(item.id) : item.checked === true;
10183
10211
  }
10184
- const toggleItemCheck = useCallback8(
10212
+ const toggleItemCheck = useCallback9(
10185
10213
  (itemId) => {
10186
10214
  const item = findTreeListItemById(data, itemId);
10187
10215
  if (!item || item.disabled || item.checked === void 0 && checkedIds === void 0) {
@@ -10345,7 +10373,7 @@ function TreeListViewInner({
10345
10373
  window.addEventListener("pointermove", handleColumnResizeMove);
10346
10374
  window.addEventListener("pointerup", handleColumnResizeEnd);
10347
10375
  }
10348
- return /* @__PURE__ */ jsxs41(
10376
+ return /* @__PURE__ */ jsxs42(
10349
10377
  "div",
10350
10378
  {
10351
10379
  ...props,
@@ -10365,7 +10393,7 @@ function TreeListViewInner({
10365
10393
  style: {
10366
10394
  "--nu-tree-list-view-columns": templateColumns
10367
10395
  },
10368
- children: columns.map((column, columnIndex) => /* @__PURE__ */ jsxs41(
10396
+ children: columns.map((column, columnIndex) => /* @__PURE__ */ jsxs42(
10369
10397
  "span",
10370
10398
  {
10371
10399
  className: [
@@ -10410,6 +10438,7 @@ function TreeListViewInner({
10410
10438
  onActivateItem: activateEntry,
10411
10439
  onDoubleClickItem: onItemDoubleClick ? handleItemDoubleClick : void 0,
10412
10440
  onItemDragOut,
10441
+ renderDragPreview,
10413
10442
  onPopupMenuItem: handleItemPopupMenu,
10414
10443
  onToggleItemCheck: handleItemCheckChange,
10415
10444
  onToggleItemExpanded: setExpandedState,
@@ -10428,14 +10457,16 @@ function TreeListViewInner({
10428
10457
  }
10429
10458
  );
10430
10459
  }
10431
- var TreeListView = forwardRef4(TreeListViewInner);
10432
- var TreeTable = TreeListView;
10460
+ function TreeListViewWithDragDrop(props, ref) {
10461
+ return /* @__PURE__ */ jsx63(NuDragDropProvider, { children: TreeListViewInner(props, ref) });
10462
+ }
10463
+ var TreeListView = forwardRef4(TreeListViewWithDragDrop);
10433
10464
 
10434
10465
  // src/theme/NuThemeProvider.tsx
10435
10466
  import {
10436
- useCallback as useCallback9,
10467
+ useCallback as useCallback10,
10437
10468
  useId as useId18,
10438
- useMemo as useMemo21,
10469
+ useMemo as useMemo20,
10439
10470
  useState as useState32
10440
10471
  } from "react";
10441
10472
 
@@ -10718,8 +10749,8 @@ function getNuDesktopPatternStyle(mode) {
10718
10749
  }
10719
10750
 
10720
10751
  // src/theme/themeContext.ts
10721
- import { createContext as createContext6, useContext as useContext10 } from "react";
10722
- var NuThemeContext = createContext6(null);
10752
+ import { createContext as createContext5, useContext as useContext10 } from "react";
10753
+ var NuThemeContext = createContext5(null);
10723
10754
  function useNuTheme() {
10724
10755
  const context = useContext10(NuThemeContext);
10725
10756
  if (!context) {
@@ -10729,7 +10760,7 @@ function useNuTheme() {
10729
10760
  }
10730
10761
 
10731
10762
  // src/theme/NuThemeProvider.tsx
10732
- import { jsx as jsx64, jsxs as jsxs42 } from "react/jsx-runtime";
10763
+ import { jsx as jsx64, jsxs as jsxs43 } from "react/jsx-runtime";
10733
10764
  function NuThemeProvider({
10734
10765
  children,
10735
10766
  className,
@@ -10759,7 +10790,7 @@ function NuThemeProvider({
10759
10790
  const resolvedFontSize = fontSize ?? internalFontSize;
10760
10791
  const resolvedTheme = resolveNuTheme(currentTheme);
10761
10792
  const themeName = typeof currentTheme === "string" ? currentTheme : currentTheme.name;
10762
- const handleThemeChange = useCallback9(
10793
+ const handleThemeChange = useCallback10(
10763
10794
  (nextTheme) => {
10764
10795
  if (theme === void 0) {
10765
10796
  setInternalTheme(nextTheme);
@@ -10768,7 +10799,7 @@ function NuThemeProvider({
10768
10799
  },
10769
10800
  [theme, onThemeChange]
10770
10801
  );
10771
- const handleDesktopPatternModeChange = useCallback9(
10802
+ const handleDesktopPatternModeChange = useCallback10(
10772
10803
  (nextDesktopPatternMode) => {
10773
10804
  if (desktopPatternMode === void 0) {
10774
10805
  setInternalDesktopPatternMode(nextDesktopPatternMode);
@@ -10777,7 +10808,7 @@ function NuThemeProvider({
10777
10808
  },
10778
10809
  [desktopPatternMode, onDesktopPatternModeChange]
10779
10810
  );
10780
- const handleFontFamilyChange = useCallback9(
10811
+ const handleFontFamilyChange = useCallback10(
10781
10812
  (nextFontFamily) => {
10782
10813
  if (fontFamily === void 0) {
10783
10814
  setInternalFontFamily(nextFontFamily);
@@ -10786,7 +10817,7 @@ function NuThemeProvider({
10786
10817
  },
10787
10818
  [fontFamily, onFontFamilyChange]
10788
10819
  );
10789
- const handleFontSizeChange = useCallback9(
10820
+ const handleFontSizeChange = useCallback10(
10790
10821
  (nextFontSize) => {
10791
10822
  if (fontSize === void 0) {
10792
10823
  setInternalFontSize(nextFontSize);
@@ -10795,7 +10826,7 @@ function NuThemeProvider({
10795
10826
  },
10796
10827
  [fontSize, onFontSizeChange]
10797
10828
  );
10798
- const contextValue = useMemo21(
10829
+ const contextValue = useMemo20(
10799
10830
  () => ({
10800
10831
  desktopPatternMode: resolvedDesktopPatternMode,
10801
10832
  fontFamily: resolvedFontFamily,
@@ -10820,7 +10851,7 @@ function NuThemeProvider({
10820
10851
  handleThemeChange
10821
10852
  ]
10822
10853
  );
10823
- return /* @__PURE__ */ jsx64(NuThemeContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs42(
10854
+ return /* @__PURE__ */ jsx64(NuThemeContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs43(
10824
10855
  "div",
10825
10856
  {
10826
10857
  className: ["nu-theme-root", className].filter(Boolean).join(" "),
@@ -10893,7 +10924,6 @@ export {
10893
10924
  ToolDropButton,
10894
10925
  ToolSeparator,
10895
10926
  TreeListView,
10896
- TreeTable,
10897
10927
  TreeView,
10898
10928
  Window,
10899
10929
  WindowBar,