@deadragdoll/reactnu 0.1.30 → 0.1.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/components/DragDrop/NuDragDropProvider.d.ts +46 -0
- package/dist/components/DragDrop/index.d.ts +1 -0
- package/dist/components/IconGrid/IconGrid.types.d.ts +9 -0
- package/dist/components/IconGrid/NuIconGrid.d.ts +18 -3
- package/dist/components/ListBox/ListBox.d.ts +13 -3
- package/dist/components/ListBox/internals/ListBoxGroupView.d.ts +6 -1
- package/dist/components/ListBox/internals/ListBoxItemView.d.ts +6 -1
- package/dist/components/TreeListView/TreeListView.d.ts +14 -4
- package/dist/components/TreeListView/internals/TreeListViewRow.d.ts +7 -2
- package/dist/index.cjs +1228 -756
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1033 -559
- package/dist/styles.css +87 -19
- package/dist/theme/NuThemeProvider.d.ts +3 -2
- package/dist/theme/themes.d.ts +2 -0
- package/docs/API_REFERENCE.md +9 -0
- package/docs/COMPONENT_INDEX.md +2 -0
- package/docs/GETTING_STARTED.md +2 -1
- package/docs/IconGrid.md +30 -3
- package/docs/ListBox.md +11 -0
- package/docs/NuDragDropProvider.md +43 -0
- package/docs/NuThemeProvider.md +3 -1
- package/docs/TreeListView.md +12 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/components/Desktop/Desktop.tsx
|
|
2
2
|
import {
|
|
3
3
|
Fragment as Fragment4,
|
|
4
|
-
useContext as
|
|
4
|
+
useContext as useContext8,
|
|
5
5
|
useState as useState10
|
|
6
6
|
} from "react";
|
|
7
7
|
|
|
@@ -662,10 +662,10 @@ function toggleMenuCheckedInTree(items, id) {
|
|
|
662
662
|
}
|
|
663
663
|
|
|
664
664
|
// src/appHost/NuAppHostProvider.tsx
|
|
665
|
-
import { useMemo as
|
|
665
|
+
import { useMemo as useMemo5, useState as useState6 } from "react";
|
|
666
666
|
|
|
667
667
|
// src/windowing/internals/MdiWindowPickerDialog.tsx
|
|
668
|
-
import { useMemo as
|
|
668
|
+
import { useMemo as useMemo4, useState as useState5 } from "react";
|
|
669
669
|
|
|
670
670
|
// src/components/Button/Button.tsx
|
|
671
671
|
import {
|
|
@@ -826,11 +826,11 @@ function Button({
|
|
|
826
826
|
import {
|
|
827
827
|
forwardRef,
|
|
828
828
|
useCallback as useCallback2,
|
|
829
|
-
useEffect as
|
|
829
|
+
useEffect as useEffect4,
|
|
830
830
|
useId,
|
|
831
831
|
useImperativeHandle,
|
|
832
|
-
useMemo as
|
|
833
|
-
useRef as
|
|
832
|
+
useMemo as useMemo3,
|
|
833
|
+
useRef as useRef4,
|
|
834
834
|
useState as useState4
|
|
835
835
|
} from "react";
|
|
836
836
|
|
|
@@ -902,15 +902,245 @@ function ListBoxCategoryView({ category }) {
|
|
|
902
902
|
// src/components/ListBox/internals/ListBoxItemView.tsx
|
|
903
903
|
import { memo } from "react";
|
|
904
904
|
|
|
905
|
-
// src/components/
|
|
905
|
+
// src/components/DragDrop/NuDragDropProvider.tsx
|
|
906
|
+
import {
|
|
907
|
+
createContext,
|
|
908
|
+
useContext,
|
|
909
|
+
useEffect as useEffect3,
|
|
910
|
+
useMemo as useMemo2,
|
|
911
|
+
useRef as useRef3
|
|
912
|
+
} from "react";
|
|
913
|
+
|
|
914
|
+
// src/components/_shared/themePortal.ts
|
|
915
|
+
function getThemePortalStyle(anchor) {
|
|
916
|
+
if (typeof window === "undefined") {
|
|
917
|
+
return void 0;
|
|
918
|
+
}
|
|
919
|
+
const themeRoot = anchor?.closest(".nu-theme-root");
|
|
920
|
+
if (!themeRoot) {
|
|
921
|
+
return void 0;
|
|
922
|
+
}
|
|
923
|
+
const computed = window.getComputedStyle(themeRoot);
|
|
924
|
+
const style = {
|
|
925
|
+
color: computed.color,
|
|
926
|
+
fontFamily: computed.fontFamily,
|
|
927
|
+
fontSize: computed.fontSize
|
|
928
|
+
};
|
|
929
|
+
for (const propertyName of computed) {
|
|
930
|
+
if (propertyName.startsWith("--nu-")) {
|
|
931
|
+
style[propertyName] = computed.getPropertyValue(propertyName).trim();
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
return style;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
// src/components/DragDrop/NuDragDropProvider.tsx
|
|
906
938
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
939
|
+
var DRAG_THRESHOLD = 3;
|
|
940
|
+
function createDragPreview(sourceElement) {
|
|
941
|
+
const rect = sourceElement.getBoundingClientRect();
|
|
942
|
+
const preview = sourceElement.cloneNode(true);
|
|
943
|
+
preview.removeAttribute("id");
|
|
944
|
+
preview.setAttribute("aria-hidden", "true");
|
|
945
|
+
Object.assign(preview.style, {
|
|
946
|
+
height: `${rect.height}px`,
|
|
947
|
+
left: `${rect.left}px`,
|
|
948
|
+
margin: "0",
|
|
949
|
+
opacity: "0.85",
|
|
950
|
+
pointerEvents: "none",
|
|
951
|
+
position: "fixed",
|
|
952
|
+
top: `${rect.top}px`,
|
|
953
|
+
width: `${rect.width}px`,
|
|
954
|
+
zIndex: "2147483647"
|
|
955
|
+
});
|
|
956
|
+
const themeStyle = getThemePortalStyle(sourceElement);
|
|
957
|
+
Object.entries(themeStyle ?? {}).forEach(([property, value]) => {
|
|
958
|
+
if (value !== void 0) {
|
|
959
|
+
preview.style.setProperty(property, String(value));
|
|
960
|
+
}
|
|
961
|
+
});
|
|
962
|
+
document.body.append(preview);
|
|
963
|
+
return preview;
|
|
964
|
+
}
|
|
965
|
+
function createController() {
|
|
966
|
+
const targets = /* @__PURE__ */ new Map();
|
|
967
|
+
let activeDrag = null;
|
|
968
|
+
function findTarget(clientX, clientY) {
|
|
969
|
+
const elementAtPoint = document.elementFromPoint(clientX, clientY);
|
|
970
|
+
let candidate = elementAtPoint;
|
|
971
|
+
while (candidate) {
|
|
972
|
+
const target = targets.get(candidate);
|
|
973
|
+
if (target) {
|
|
974
|
+
return target;
|
|
975
|
+
}
|
|
976
|
+
candidate = candidate.parentElement;
|
|
977
|
+
}
|
|
978
|
+
return Array.from(targets.values()).reverse().find((target) => {
|
|
979
|
+
const rect = target.element.getBoundingClientRect();
|
|
980
|
+
return clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom;
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
function clearActiveDrag() {
|
|
984
|
+
activeDrag?.preview.remove();
|
|
985
|
+
activeDrag = null;
|
|
986
|
+
}
|
|
987
|
+
return {
|
|
988
|
+
beginDrag(item, sourceElement, sourceType) {
|
|
989
|
+
clearActiveDrag();
|
|
990
|
+
activeDrag = {
|
|
991
|
+
item,
|
|
992
|
+
preview: createDragPreview(sourceElement),
|
|
993
|
+
sourceElement,
|
|
994
|
+
sourceType
|
|
995
|
+
};
|
|
996
|
+
},
|
|
997
|
+
cancelDrag: clearActiveDrag,
|
|
998
|
+
dropAt(clientX, clientY) {
|
|
999
|
+
const currentDrag = activeDrag;
|
|
1000
|
+
if (!currentDrag) {
|
|
1001
|
+
return false;
|
|
1002
|
+
}
|
|
1003
|
+
const target = findTarget(clientX, clientY);
|
|
1004
|
+
clearActiveDrag();
|
|
1005
|
+
if (!target || target.element === currentDrag.sourceElement) {
|
|
1006
|
+
return false;
|
|
1007
|
+
}
|
|
1008
|
+
if (target.accepts?.(currentDrag.item) === false) {
|
|
1009
|
+
return false;
|
|
1010
|
+
}
|
|
1011
|
+
return target.onDrop(currentDrag.item, {
|
|
1012
|
+
clientX,
|
|
1013
|
+
clientY,
|
|
1014
|
+
source: {
|
|
1015
|
+
element: currentDrag.sourceElement,
|
|
1016
|
+
type: currentDrag.sourceType
|
|
1017
|
+
},
|
|
1018
|
+
target: { element: target.element, type: target.type }
|
|
1019
|
+
}) !== false;
|
|
1020
|
+
},
|
|
1021
|
+
moveDrag(clientX, clientY) {
|
|
1022
|
+
const currentDrag = activeDrag;
|
|
1023
|
+
if (!currentDrag) {
|
|
1024
|
+
return;
|
|
1025
|
+
}
|
|
1026
|
+
const rect = currentDrag.sourceElement.getBoundingClientRect();
|
|
1027
|
+
currentDrag.preview.style.left = `${Math.round(clientX - rect.width / 2)}px`;
|
|
1028
|
+
currentDrag.preview.style.top = `${Math.round(clientY - rect.height / 2)}px`;
|
|
1029
|
+
},
|
|
1030
|
+
registerTarget(element, options) {
|
|
1031
|
+
targets.set(element, { ...options, element });
|
|
1032
|
+
return () => targets.delete(element);
|
|
1033
|
+
}
|
|
1034
|
+
};
|
|
1035
|
+
}
|
|
1036
|
+
var fallbackController = createController();
|
|
1037
|
+
var NuDragDropContext = createContext(null);
|
|
1038
|
+
function NuDragDropProvider({ children }) {
|
|
1039
|
+
const controller = useMemo2(() => createController(), []);
|
|
1040
|
+
return /* @__PURE__ */ jsx8(NuDragDropContext.Provider, { value: controller, children });
|
|
1041
|
+
}
|
|
1042
|
+
function useNuDragDrop() {
|
|
1043
|
+
return useContext(NuDragDropContext) ?? fallbackController;
|
|
1044
|
+
}
|
|
1045
|
+
function useNuDropTarget(element, options) {
|
|
1046
|
+
const controller = useNuDragDrop();
|
|
1047
|
+
useEffect3(() => {
|
|
1048
|
+
if (!element || !options) {
|
|
1049
|
+
return void 0;
|
|
1050
|
+
}
|
|
1051
|
+
return controller.registerTarget(element, options);
|
|
1052
|
+
}, [controller, element, options]);
|
|
1053
|
+
}
|
|
1054
|
+
function useNuDragSource({
|
|
1055
|
+
disabled = false,
|
|
1056
|
+
getItem,
|
|
1057
|
+
onDropAccepted,
|
|
1058
|
+
sourceType
|
|
1059
|
+
}) {
|
|
1060
|
+
const controller = useNuDragDrop();
|
|
1061
|
+
const stateRef = useRef3({
|
|
1062
|
+
dragging: false,
|
|
1063
|
+
pointerId: -1,
|
|
1064
|
+
sourceElement: null,
|
|
1065
|
+
startX: 0,
|
|
1066
|
+
startY: 0
|
|
1067
|
+
});
|
|
1068
|
+
const state = stateRef.current;
|
|
1069
|
+
function stop(event, shouldDrop) {
|
|
1070
|
+
if (state.pointerId !== event.pointerId) {
|
|
1071
|
+
return;
|
|
1072
|
+
}
|
|
1073
|
+
if (event.currentTarget.hasPointerCapture(event.pointerId)) {
|
|
1074
|
+
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
1075
|
+
}
|
|
1076
|
+
state.pointerId = -1;
|
|
1077
|
+
if (state.dragging && shouldDrop && controller.dropAt(event.clientX, event.clientY)) {
|
|
1078
|
+
onDropAccepted?.();
|
|
1079
|
+
} else if (state.dragging) {
|
|
1080
|
+
controller.cancelDrag();
|
|
1081
|
+
}
|
|
1082
|
+
state.dragging = false;
|
|
1083
|
+
state.sourceElement = null;
|
|
1084
|
+
}
|
|
1085
|
+
return {
|
|
1086
|
+
onPointerCancel(event) {
|
|
1087
|
+
stop(event, false);
|
|
1088
|
+
},
|
|
1089
|
+
onPointerDown(event) {
|
|
1090
|
+
if (disabled || event.button !== 0) {
|
|
1091
|
+
return;
|
|
1092
|
+
}
|
|
1093
|
+
if (event.target instanceof HTMLElement && event.target.closest("button, input, select, textarea, a")) {
|
|
1094
|
+
return;
|
|
1095
|
+
}
|
|
1096
|
+
state.dragging = false;
|
|
1097
|
+
state.pointerId = event.pointerId;
|
|
1098
|
+
state.sourceElement = event.currentTarget;
|
|
1099
|
+
state.startX = event.clientX;
|
|
1100
|
+
state.startY = event.clientY;
|
|
1101
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
1102
|
+
},
|
|
1103
|
+
onPointerMove(event) {
|
|
1104
|
+
if (state.pointerId !== event.pointerId || !state.sourceElement) {
|
|
1105
|
+
return;
|
|
1106
|
+
}
|
|
1107
|
+
if (!state.dragging) {
|
|
1108
|
+
const distance = Math.max(
|
|
1109
|
+
Math.abs(event.clientX - state.startX),
|
|
1110
|
+
Math.abs(event.clientY - state.startY)
|
|
1111
|
+
);
|
|
1112
|
+
if (distance < DRAG_THRESHOLD) {
|
|
1113
|
+
return;
|
|
1114
|
+
}
|
|
1115
|
+
const item = getItem();
|
|
1116
|
+
if (!item) {
|
|
1117
|
+
if (event.currentTarget.hasPointerCapture(event.pointerId)) {
|
|
1118
|
+
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
1119
|
+
}
|
|
1120
|
+
state.pointerId = -1;
|
|
1121
|
+
state.sourceElement = null;
|
|
1122
|
+
return;
|
|
1123
|
+
}
|
|
1124
|
+
state.dragging = true;
|
|
1125
|
+
controller.beginDrag(item, state.sourceElement, sourceType);
|
|
1126
|
+
}
|
|
1127
|
+
controller.moveDrag(event.clientX, event.clientY);
|
|
1128
|
+
},
|
|
1129
|
+
onPointerUp(event) {
|
|
1130
|
+
stop(event, true);
|
|
1131
|
+
}
|
|
1132
|
+
};
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
// src/components/ListBox/internals/ListBoxCheckControl.tsx
|
|
1136
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
907
1137
|
function ListBoxCheckControl({
|
|
908
1138
|
isChecked,
|
|
909
1139
|
onActivate,
|
|
910
1140
|
onToggleCheck,
|
|
911
1141
|
uncheckedShape
|
|
912
1142
|
}) {
|
|
913
|
-
return /* @__PURE__ */
|
|
1143
|
+
return /* @__PURE__ */ jsx9(
|
|
914
1144
|
"button",
|
|
915
1145
|
{
|
|
916
1146
|
"aria-label": isChecked ? "Uncheck item" : "Check item",
|
|
@@ -922,13 +1152,13 @@ function ListBoxCheckControl({
|
|
|
922
1152
|
onToggleCheck();
|
|
923
1153
|
},
|
|
924
1154
|
type: "button",
|
|
925
|
-
children: /* @__PURE__ */
|
|
1155
|
+
children: /* @__PURE__ */ jsx9(
|
|
926
1156
|
"span",
|
|
927
1157
|
{
|
|
928
1158
|
"aria-hidden": "true",
|
|
929
1159
|
className: "nu-listbox__check-box",
|
|
930
1160
|
"data-unchecked-shape": uncheckedShape,
|
|
931
|
-
children: isChecked ? /* @__PURE__ */
|
|
1161
|
+
children: isChecked ? /* @__PURE__ */ jsx9(NuGlyph, { className: "nu-listbox__check-indicator", name: "check-mark" }) : null
|
|
932
1162
|
}
|
|
933
1163
|
)
|
|
934
1164
|
}
|
|
@@ -936,21 +1166,30 @@ function ListBoxCheckControl({
|
|
|
936
1166
|
}
|
|
937
1167
|
|
|
938
1168
|
// src/components/ListBox/internals/ListBoxItemView.tsx
|
|
939
|
-
import { jsx as
|
|
1169
|
+
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
940
1170
|
function ListBoxItemViewInner({
|
|
941
1171
|
group,
|
|
1172
|
+
getDragItem,
|
|
942
1173
|
isActive,
|
|
943
1174
|
isChecked,
|
|
944
1175
|
isSelected,
|
|
945
1176
|
item,
|
|
946
1177
|
itemId,
|
|
947
1178
|
onActivate,
|
|
1179
|
+
onPopupMenu,
|
|
948
1180
|
onDoubleClick,
|
|
1181
|
+
onDragOut,
|
|
949
1182
|
onToggleCheck,
|
|
950
1183
|
registerItemRef,
|
|
951
1184
|
rightCheckBox,
|
|
952
1185
|
uncheckedShape
|
|
953
1186
|
}) {
|
|
1187
|
+
const dragSource = useNuDragSource({
|
|
1188
|
+
disabled: item.disabled || !getDragItem,
|
|
1189
|
+
getItem: () => getDragItem?.(item, group) ?? false,
|
|
1190
|
+
onDropAccepted: () => onDragOut?.(item, group),
|
|
1191
|
+
sourceType: "listbox-item"
|
|
1192
|
+
});
|
|
954
1193
|
function handleActivate() {
|
|
955
1194
|
if (!item.disabled) {
|
|
956
1195
|
onActivate(item, group, itemId);
|
|
@@ -963,10 +1202,13 @@ function ListBoxItemViewInner({
|
|
|
963
1202
|
onDoubleClick?.(item, group);
|
|
964
1203
|
}
|
|
965
1204
|
}
|
|
1205
|
+
function handleContextMenu(event) {
|
|
1206
|
+
onPopupMenu?.(event, item, group, itemId);
|
|
1207
|
+
}
|
|
966
1208
|
function handleToggleCheck() {
|
|
967
1209
|
onToggleCheck(itemId);
|
|
968
1210
|
}
|
|
969
|
-
const checkControl = item.checkable ? /* @__PURE__ */
|
|
1211
|
+
const checkControl = item.checkable ? /* @__PURE__ */ jsx10(
|
|
970
1212
|
ListBoxCheckControl,
|
|
971
1213
|
{
|
|
972
1214
|
isChecked,
|
|
@@ -991,7 +1233,12 @@ function ListBoxItemViewInner({
|
|
|
991
1233
|
].filter(Boolean).join(" "),
|
|
992
1234
|
id: itemId,
|
|
993
1235
|
onClick: handleActivate,
|
|
1236
|
+
onContextMenu: onPopupMenu ? handleContextMenu : void 0,
|
|
994
1237
|
onDoubleClick: handleDoubleClick,
|
|
1238
|
+
onPointerCancel: dragSource.onPointerCancel,
|
|
1239
|
+
onPointerDown: dragSource.onPointerDown,
|
|
1240
|
+
onPointerMove: dragSource.onPointerMove,
|
|
1241
|
+
onPointerUp: dragSource.onPointerUp,
|
|
995
1242
|
ref: (node) => registerItemRef(itemId, node),
|
|
996
1243
|
role: "option",
|
|
997
1244
|
children: [
|
|
@@ -999,7 +1246,7 @@ function ListBoxItemViewInner({
|
|
|
999
1246
|
rightCheckBox ? null : checkControl,
|
|
1000
1247
|
renderLabel(item.name, "nu-listbox__item-label")
|
|
1001
1248
|
] }),
|
|
1002
|
-
item.details ? /* @__PURE__ */
|
|
1249
|
+
item.details ? /* @__PURE__ */ jsx10("span", { className: "nu-listbox__item-details", children: item.details }) : null,
|
|
1003
1250
|
rightCheckBox ? checkControl : null
|
|
1004
1251
|
]
|
|
1005
1252
|
}
|
|
@@ -1008,14 +1255,17 @@ function ListBoxItemViewInner({
|
|
|
1008
1255
|
var ListBoxItemView = memo(ListBoxItemViewInner);
|
|
1009
1256
|
|
|
1010
1257
|
// src/components/ListBox/internals/ListBoxGroupView.tsx
|
|
1011
|
-
import { jsx as
|
|
1258
|
+
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1012
1259
|
function ListBoxGroupView({
|
|
1013
1260
|
group,
|
|
1014
1261
|
groupIndex,
|
|
1262
|
+
getDragItem,
|
|
1015
1263
|
isItemChecked,
|
|
1016
1264
|
listboxId,
|
|
1017
1265
|
onActivateItem,
|
|
1018
1266
|
onDoubleClickItem,
|
|
1267
|
+
onItemDragOut,
|
|
1268
|
+
onPopupMenuItem,
|
|
1019
1269
|
onToggleItemCheck,
|
|
1020
1270
|
registerItemRef,
|
|
1021
1271
|
resolvedActiveId,
|
|
@@ -1024,7 +1274,7 @@ function ListBoxGroupView({
|
|
|
1024
1274
|
uncheckedShape
|
|
1025
1275
|
}) {
|
|
1026
1276
|
return /* @__PURE__ */ jsxs7("div", { className: "nu-listbox__group", role: "group", children: [
|
|
1027
|
-
group.category ? /* @__PURE__ */
|
|
1277
|
+
group.category ? /* @__PURE__ */ jsx11(ListBoxCategoryView, { category: group.category }) : null,
|
|
1028
1278
|
group.items.map((item, itemIndex) => {
|
|
1029
1279
|
const itemId = buildListBoxItemId(
|
|
1030
1280
|
listboxId,
|
|
@@ -1036,10 +1286,11 @@ function ListBoxGroupView({
|
|
|
1036
1286
|
const isSelected = selectedId ? item.id === selectedId : item.selected;
|
|
1037
1287
|
const isActive = resolvedActiveId === itemId;
|
|
1038
1288
|
const isChecked = isItemChecked(item);
|
|
1039
|
-
return /* @__PURE__ */
|
|
1289
|
+
return /* @__PURE__ */ jsx11(
|
|
1040
1290
|
ListBoxItemView,
|
|
1041
1291
|
{
|
|
1042
1292
|
group,
|
|
1293
|
+
getDragItem,
|
|
1043
1294
|
isActive,
|
|
1044
1295
|
isChecked,
|
|
1045
1296
|
isSelected: Boolean(isSelected),
|
|
@@ -1047,6 +1298,8 @@ function ListBoxGroupView({
|
|
|
1047
1298
|
itemId,
|
|
1048
1299
|
onActivate: onActivateItem,
|
|
1049
1300
|
onDoubleClick: onDoubleClickItem,
|
|
1301
|
+
onDragOut: onItemDragOut,
|
|
1302
|
+
onPopupMenu: onPopupMenuItem,
|
|
1050
1303
|
onToggleCheck: onToggleItemCheck,
|
|
1051
1304
|
registerItemRef,
|
|
1052
1305
|
rightCheckBox,
|
|
@@ -1059,37 +1312,52 @@ function ListBoxGroupView({
|
|
|
1059
1312
|
}
|
|
1060
1313
|
|
|
1061
1314
|
// src/components/ListBox/ListBox.tsx
|
|
1062
|
-
import { jsx as
|
|
1315
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1063
1316
|
function ListBoxInner({
|
|
1317
|
+
acceptsDrop,
|
|
1064
1318
|
className,
|
|
1065
1319
|
data,
|
|
1066
1320
|
checkedIds,
|
|
1067
1321
|
emptyText = "No items",
|
|
1322
|
+
getDragItem,
|
|
1323
|
+
onPopupMenu,
|
|
1068
1324
|
onItemCheckChange,
|
|
1069
1325
|
onItemDoubleClick,
|
|
1326
|
+
onItemDragOut,
|
|
1070
1327
|
onItemSelect,
|
|
1328
|
+
onDrop,
|
|
1071
1329
|
rightCheckBox = false,
|
|
1072
1330
|
selectedId,
|
|
1073
1331
|
uncheckedShape = "box",
|
|
1074
1332
|
...props
|
|
1075
1333
|
}, ref) {
|
|
1076
1334
|
const hasItems = data.some((group) => group.items.length > 0);
|
|
1077
|
-
const rootRef =
|
|
1335
|
+
const rootRef = useRef4(null);
|
|
1336
|
+
const [rootElement, setRootElement] = useState4(null);
|
|
1078
1337
|
const listboxId = useId();
|
|
1079
|
-
const itemRefs =
|
|
1080
|
-
const flattenedItems =
|
|
1338
|
+
const itemRefs = useRef4({});
|
|
1339
|
+
const flattenedItems = useMemo3(
|
|
1081
1340
|
() => flattenListBoxData(data, listboxId),
|
|
1082
1341
|
[data, listboxId]
|
|
1083
1342
|
);
|
|
1084
|
-
const selectableItems =
|
|
1343
|
+
const selectableItems = useMemo3(
|
|
1085
1344
|
() => flattenedItems.filter(({ item }) => !item.disabled),
|
|
1086
1345
|
[flattenedItems]
|
|
1087
1346
|
);
|
|
1088
1347
|
const [activeId, setActiveId] = useState4(
|
|
1089
1348
|
() => getInitialActiveId(selectableItems, selectedId)
|
|
1090
1349
|
);
|
|
1350
|
+
const dropTargetOptions = useMemo3(
|
|
1351
|
+
() => onDrop ? { accepts: acceptsDrop, onDrop, type: "listbox" } : void 0,
|
|
1352
|
+
[acceptsDrop, onDrop]
|
|
1353
|
+
);
|
|
1354
|
+
useNuDropTarget(rootElement, dropTargetOptions);
|
|
1355
|
+
const setRootRef = useCallback2((node) => {
|
|
1356
|
+
rootRef.current = node;
|
|
1357
|
+
setRootElement(node);
|
|
1358
|
+
}, []);
|
|
1091
1359
|
const resolvedActiveId = activeId && selectableItems.some((entry) => entry.itemId === activeId) ? activeId : getInitialActiveId(selectableItems, selectedId);
|
|
1092
|
-
|
|
1360
|
+
useEffect4(() => {
|
|
1093
1361
|
if (!resolvedActiveId) {
|
|
1094
1362
|
return;
|
|
1095
1363
|
}
|
|
@@ -1124,6 +1392,18 @@ function ListBoxInner({
|
|
|
1124
1392
|
},
|
|
1125
1393
|
[activateItem, selectableItems]
|
|
1126
1394
|
);
|
|
1395
|
+
const handleItemPopupMenu = useCallback2(
|
|
1396
|
+
(event, item, group, itemId) => {
|
|
1397
|
+
if (item.disabled || !onPopupMenu) {
|
|
1398
|
+
return;
|
|
1399
|
+
}
|
|
1400
|
+
event.preventDefault();
|
|
1401
|
+
event.stopPropagation();
|
|
1402
|
+
activateItem(item, group, itemId);
|
|
1403
|
+
onPopupMenu(event, item, group);
|
|
1404
|
+
},
|
|
1405
|
+
[activateItem, onPopupMenu]
|
|
1406
|
+
);
|
|
1127
1407
|
function moveActive(direction) {
|
|
1128
1408
|
if (selectableItems.length === 0) {
|
|
1129
1409
|
return;
|
|
@@ -1224,7 +1504,7 @@ function ListBoxInner({
|
|
|
1224
1504
|
break;
|
|
1225
1505
|
}
|
|
1226
1506
|
}
|
|
1227
|
-
return /* @__PURE__ */
|
|
1507
|
+
return /* @__PURE__ */ jsx12(
|
|
1228
1508
|
"div",
|
|
1229
1509
|
{
|
|
1230
1510
|
...props,
|
|
@@ -1232,18 +1512,21 @@ function ListBoxInner({
|
|
|
1232
1512
|
className: ["nu-listbox", className].filter(Boolean).join(" "),
|
|
1233
1513
|
"data-right-checkbox": rightCheckBox || void 0,
|
|
1234
1514
|
onKeyDown: handleKeyDown,
|
|
1235
|
-
ref:
|
|
1515
|
+
ref: setRootRef,
|
|
1236
1516
|
role: "listbox",
|
|
1237
1517
|
tabIndex: 0,
|
|
1238
|
-
children: hasItems ? data.map((group, groupIndex) => /* @__PURE__ */
|
|
1518
|
+
children: hasItems ? data.map((group, groupIndex) => /* @__PURE__ */ jsx12(
|
|
1239
1519
|
ListBoxGroupView,
|
|
1240
1520
|
{
|
|
1241
1521
|
group,
|
|
1242
1522
|
groupIndex,
|
|
1243
1523
|
isItemChecked,
|
|
1524
|
+
getDragItem,
|
|
1244
1525
|
listboxId,
|
|
1245
1526
|
onActivateItem: activateItem,
|
|
1246
1527
|
onDoubleClickItem: onItemDoubleClick,
|
|
1528
|
+
onItemDragOut,
|
|
1529
|
+
onPopupMenuItem: handleItemPopupMenu,
|
|
1247
1530
|
onToggleItemCheck: toggleItemCheck,
|
|
1248
1531
|
registerItemRef,
|
|
1249
1532
|
resolvedActiveId,
|
|
@@ -1252,14 +1535,14 @@ function ListBoxInner({
|
|
|
1252
1535
|
uncheckedShape
|
|
1253
1536
|
},
|
|
1254
1537
|
`${group.category?.text ?? "group"}-${groupIndex}`
|
|
1255
|
-
)) : /* @__PURE__ */
|
|
1538
|
+
)) : /* @__PURE__ */ jsx12("div", { className: "nu-listbox__empty", children: emptyText })
|
|
1256
1539
|
}
|
|
1257
1540
|
);
|
|
1258
1541
|
}
|
|
1259
1542
|
var ListBox = forwardRef(ListBoxInner);
|
|
1260
1543
|
|
|
1261
1544
|
// src/components/Stack/Stack.tsx
|
|
1262
|
-
import { jsx as
|
|
1545
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1263
1546
|
function resolveFlexAlign(align) {
|
|
1264
1547
|
if (align === "start") {
|
|
1265
1548
|
return "flex-start";
|
|
@@ -1288,7 +1571,7 @@ function Stack({
|
|
|
1288
1571
|
style,
|
|
1289
1572
|
...props
|
|
1290
1573
|
}) {
|
|
1291
|
-
return /* @__PURE__ */
|
|
1574
|
+
return /* @__PURE__ */ jsx13(
|
|
1292
1575
|
"div",
|
|
1293
1576
|
{
|
|
1294
1577
|
...props,
|
|
@@ -1308,7 +1591,7 @@ function Stack({
|
|
|
1308
1591
|
}
|
|
1309
1592
|
|
|
1310
1593
|
// src/windowing/internals/MdiWindowPickerDialog.tsx
|
|
1311
|
-
import { jsx as
|
|
1594
|
+
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1312
1595
|
function isPickerEligibleWindow(windowEntry) {
|
|
1313
1596
|
if (windowEntry.mode === "window") {
|
|
1314
1597
|
return true;
|
|
@@ -1342,7 +1625,7 @@ function MdiWindowPickerDialog({
|
|
|
1342
1625
|
onClose,
|
|
1343
1626
|
windows
|
|
1344
1627
|
}) {
|
|
1345
|
-
const resolvedWindows =
|
|
1628
|
+
const resolvedWindows = useMemo4(
|
|
1346
1629
|
() => windows.filter(
|
|
1347
1630
|
(windowEntry) => isPickerEligibleWindow(windowEntry) && (!domain || windowEntry.domain === domain)
|
|
1348
1631
|
),
|
|
@@ -1362,7 +1645,7 @@ function MdiWindowPickerDialog({
|
|
|
1362
1645
|
onClose();
|
|
1363
1646
|
}
|
|
1364
1647
|
return /* @__PURE__ */ jsxs8(Stack, { gap: "md", children: [
|
|
1365
|
-
/* @__PURE__ */
|
|
1648
|
+
/* @__PURE__ */ jsx14(
|
|
1366
1649
|
ListBox,
|
|
1367
1650
|
{
|
|
1368
1651
|
data: [
|
|
@@ -1397,14 +1680,14 @@ function MdiWindowPickerDialog({
|
|
|
1397
1680
|
}
|
|
1398
1681
|
),
|
|
1399
1682
|
/* @__PURE__ */ jsxs8(Stack, { direction: "row", gap: "sm", children: [
|
|
1400
|
-
/* @__PURE__ */
|
|
1401
|
-
/* @__PURE__ */
|
|
1683
|
+
/* @__PURE__ */ jsx14(Button, { defaultFocused: true, onClick: handleActivate, children: "Activate" }),
|
|
1684
|
+
/* @__PURE__ */ jsx14(Button, { onClick: onClose, variant: "secondary", children: "Cancel" })
|
|
1402
1685
|
] })
|
|
1403
1686
|
] });
|
|
1404
1687
|
}
|
|
1405
1688
|
|
|
1406
1689
|
// src/windowing/mdiMenu.tsx
|
|
1407
|
-
import { jsx as
|
|
1690
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1408
1691
|
var MDI_HOST_ID = "mdi.host";
|
|
1409
1692
|
function createMdiDivider(id) {
|
|
1410
1693
|
return {
|
|
@@ -1443,7 +1726,7 @@ function openMdiWindowPicker(bridge) {
|
|
|
1443
1726
|
bridge.openDialog({
|
|
1444
1727
|
appModal: true,
|
|
1445
1728
|
border: "double",
|
|
1446
|
-
content: ({ close }) => /* @__PURE__ */
|
|
1729
|
+
content: ({ close }) => /* @__PURE__ */ jsx15(
|
|
1447
1730
|
MdiWindowPickerDialog,
|
|
1448
1731
|
{
|
|
1449
1732
|
activeWindowId,
|
|
@@ -1530,12 +1813,12 @@ function resolveMdiMainMenuItems(items, bridge) {
|
|
|
1530
1813
|
}
|
|
1531
1814
|
|
|
1532
1815
|
// src/appHost/appHostContext.ts
|
|
1533
|
-
import { createContext, useContext } from "react";
|
|
1534
|
-
var AppHostMenuContext =
|
|
1816
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
1817
|
+
var AppHostMenuContext = createContext2(
|
|
1535
1818
|
null
|
|
1536
1819
|
);
|
|
1537
1820
|
function useAppHostMenu() {
|
|
1538
|
-
const context =
|
|
1821
|
+
const context = useContext2(AppHostMenuContext);
|
|
1539
1822
|
if (!context) {
|
|
1540
1823
|
throw new Error("useAppHostMenu must be used within a NuAppHostProvider.");
|
|
1541
1824
|
}
|
|
@@ -1560,7 +1843,7 @@ function useAppHostMenu() {
|
|
|
1560
1843
|
}
|
|
1561
1844
|
|
|
1562
1845
|
// src/appHost/NuAppHostProvider.tsx
|
|
1563
|
-
import { jsx as
|
|
1846
|
+
import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1564
1847
|
function NuAppHostProvider({
|
|
1565
1848
|
children,
|
|
1566
1849
|
renderMenu = true
|
|
@@ -1569,11 +1852,11 @@ function NuAppHostProvider({
|
|
|
1569
1852
|
const [windowBridge, setWindowBridge] = useState6(
|
|
1570
1853
|
null
|
|
1571
1854
|
);
|
|
1572
|
-
const resolvedMainMenu =
|
|
1855
|
+
const resolvedMainMenu = useMemo5(
|
|
1573
1856
|
() => resolveMdiMainMenuItems(menuState.mainMenu, windowBridge),
|
|
1574
1857
|
[menuState.mainMenu, windowBridge]
|
|
1575
1858
|
);
|
|
1576
|
-
const contextValue =
|
|
1859
|
+
const contextValue = useMemo5(
|
|
1577
1860
|
() => ({
|
|
1578
1861
|
...menuState,
|
|
1579
1862
|
setWindowBridge,
|
|
@@ -1582,7 +1865,7 @@ function NuAppHostProvider({
|
|
|
1582
1865
|
[menuState, windowBridge]
|
|
1583
1866
|
);
|
|
1584
1867
|
return /* @__PURE__ */ jsxs9(AppHostMenuContext.Provider, { value: contextValue, children: [
|
|
1585
|
-
renderMenu && hasVisibleMainMenuItems(resolvedMainMenu) ? /* @__PURE__ */
|
|
1868
|
+
renderMenu && hasVisibleMainMenuItems(resolvedMainMenu) ? /* @__PURE__ */ jsx16(MainMenu, { items: resolvedMainMenu }) : null,
|
|
1586
1869
|
children
|
|
1587
1870
|
] });
|
|
1588
1871
|
}
|
|
@@ -1591,27 +1874,27 @@ function NuAppHostProvider({
|
|
|
1591
1874
|
import {
|
|
1592
1875
|
Fragment as Fragment3,
|
|
1593
1876
|
useCallback as useCallback3,
|
|
1594
|
-
useContext as
|
|
1595
|
-
useEffect as
|
|
1596
|
-
useMemo as
|
|
1597
|
-
useRef as
|
|
1877
|
+
useContext as useContext7,
|
|
1878
|
+
useEffect as useEffect6,
|
|
1879
|
+
useMemo as useMemo7,
|
|
1880
|
+
useRef as useRef7,
|
|
1598
1881
|
useState as useState9
|
|
1599
1882
|
} from "react";
|
|
1600
1883
|
|
|
1601
1884
|
// src/components/Window/Window.tsx
|
|
1602
1885
|
import {
|
|
1603
1886
|
memo as memo2,
|
|
1604
|
-
useContext as
|
|
1887
|
+
useContext as useContext5,
|
|
1605
1888
|
useLayoutEffect,
|
|
1606
|
-
useMemo as
|
|
1607
|
-
useRef as
|
|
1889
|
+
useMemo as useMemo6,
|
|
1890
|
+
useRef as useRef5
|
|
1608
1891
|
} from "react";
|
|
1609
1892
|
|
|
1610
1893
|
// src/components/Window/internals/WindowStatusBar.tsx
|
|
1611
1894
|
import { Children } from "react";
|
|
1612
1895
|
|
|
1613
1896
|
// src/components/Window/StatusBarItem.tsx
|
|
1614
|
-
import { jsx as
|
|
1897
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1615
1898
|
function StatusBarItem({
|
|
1616
1899
|
align = "start",
|
|
1617
1900
|
children,
|
|
@@ -1619,7 +1902,7 @@ function StatusBarItem({
|
|
|
1619
1902
|
grow = false,
|
|
1620
1903
|
...props
|
|
1621
1904
|
}) {
|
|
1622
|
-
return /* @__PURE__ */
|
|
1905
|
+
return /* @__PURE__ */ jsx17(
|
|
1623
1906
|
"span",
|
|
1624
1907
|
{
|
|
1625
1908
|
...props,
|
|
@@ -1635,7 +1918,7 @@ function StatusBarItem({
|
|
|
1635
1918
|
}
|
|
1636
1919
|
|
|
1637
1920
|
// src/components/Window/internals/WindowStatusBar.tsx
|
|
1638
|
-
import { jsx as
|
|
1921
|
+
import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1639
1922
|
function WindowStatusBar({
|
|
1640
1923
|
children,
|
|
1641
1924
|
onResizeStart,
|
|
@@ -1651,15 +1934,15 @@ function WindowStatusBar({
|
|
|
1651
1934
|
{
|
|
1652
1935
|
className: ["nu-window__status-bar", statusBarClassName].filter(Boolean).join(" "),
|
|
1653
1936
|
children: [
|
|
1654
|
-
/* @__PURE__ */
|
|
1655
|
-
resizable ? /* @__PURE__ */
|
|
1937
|
+
/* @__PURE__ */ jsx18("span", { className: "nu-window__status-bar-items", children: hasCustomItems ? resolvedChildren : resolvedChildren.map((child, index) => /* @__PURE__ */ jsx18(StatusBarItem, { grow: index === 0, children: child }, `status-item-${index}`)) }),
|
|
1938
|
+
resizable ? /* @__PURE__ */ jsx18(
|
|
1656
1939
|
"button",
|
|
1657
1940
|
{
|
|
1658
1941
|
"aria-label": "Resize window",
|
|
1659
1942
|
className: "nu-window__resize-handle",
|
|
1660
1943
|
onPointerDown: onResizeStart,
|
|
1661
1944
|
type: "button",
|
|
1662
|
-
children: /* @__PURE__ */
|
|
1945
|
+
children: /* @__PURE__ */ jsx18(NuGlyph, { name: "window-resize" })
|
|
1663
1946
|
}
|
|
1664
1947
|
) : null
|
|
1665
1948
|
]
|
|
@@ -1668,18 +1951,18 @@ function WindowStatusBar({
|
|
|
1668
1951
|
}
|
|
1669
1952
|
|
|
1670
1953
|
// src/components/Window/WindowTitleButton.tsx
|
|
1671
|
-
import { jsx as
|
|
1954
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1672
1955
|
function renderWindowTriangleGlyph(icon) {
|
|
1673
1956
|
const glyphNameByIcon = {
|
|
1674
1957
|
maximize: "window-maximize",
|
|
1675
1958
|
minimize: "window-minimize",
|
|
1676
1959
|
restore: "window-restore"
|
|
1677
1960
|
};
|
|
1678
|
-
return /* @__PURE__ */
|
|
1961
|
+
return /* @__PURE__ */ jsx19(NuGlyph, { className: "nu-window__title-glyph", name: glyphNameByIcon[icon] });
|
|
1679
1962
|
}
|
|
1680
1963
|
function renderTitleButtonIcon(icon) {
|
|
1681
1964
|
if (icon === "close") {
|
|
1682
|
-
return /* @__PURE__ */
|
|
1965
|
+
return /* @__PURE__ */ jsx19(NuGlyph, { className: "nu-window__title-glyph", name: "window-close" });
|
|
1683
1966
|
}
|
|
1684
1967
|
if (icon === "minimize" || icon === "maximize" || icon === "restore") {
|
|
1685
1968
|
return renderWindowTriangleGlyph(
|
|
@@ -1698,7 +1981,7 @@ function WindowTitleButton({
|
|
|
1698
1981
|
variant = icon === "close" ? "close" : "default",
|
|
1699
1982
|
...props
|
|
1700
1983
|
}) {
|
|
1701
|
-
return /* @__PURE__ */
|
|
1984
|
+
return /* @__PURE__ */ jsx19(
|
|
1702
1985
|
"button",
|
|
1703
1986
|
{
|
|
1704
1987
|
...props,
|
|
@@ -1720,7 +2003,7 @@ function WindowTitleButton({
|
|
|
1720
2003
|
}
|
|
1721
2004
|
|
|
1722
2005
|
// src/components/Window/internals/WindowTitleBar.tsx
|
|
1723
|
-
import { jsx as
|
|
2006
|
+
import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1724
2007
|
function WindowTitleBar({
|
|
1725
2008
|
draggable,
|
|
1726
2009
|
onDragStart,
|
|
@@ -1738,8 +2021,8 @@ function WindowTitleBar({
|
|
|
1738
2021
|
"--nu-window-title-controls-width": controlsWidth
|
|
1739
2022
|
},
|
|
1740
2023
|
children: [
|
|
1741
|
-
/* @__PURE__ */
|
|
1742
|
-
titleButtons.length > 0 ? /* @__PURE__ */
|
|
2024
|
+
/* @__PURE__ */ jsx20("span", { className: "nu-window__title", children: renderMnemonicText(title) }),
|
|
2025
|
+
titleButtons.length > 0 ? /* @__PURE__ */ jsx20("span", { className: "nu-window__title-controls", children: titleButtons.map((button, index) => /* @__PURE__ */ jsx20(
|
|
1743
2026
|
WindowTitleButton,
|
|
1744
2027
|
{
|
|
1745
2028
|
ariaLabel: button.ariaLabel,
|
|
@@ -1796,10 +2079,10 @@ function useWindowTitleButtons({
|
|
|
1796
2079
|
}
|
|
1797
2080
|
|
|
1798
2081
|
// src/windowing/windowContext.ts
|
|
1799
|
-
import { createContext as
|
|
1800
|
-
var NuWindowContext =
|
|
2082
|
+
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
2083
|
+
var NuWindowContext = createContext3(null);
|
|
1801
2084
|
function useNuWindowManager() {
|
|
1802
|
-
const context =
|
|
2085
|
+
const context = useContext3(NuWindowContext);
|
|
1803
2086
|
if (!context) {
|
|
1804
2087
|
throw new Error(
|
|
1805
2088
|
"useNuWindowManager must be used within a NuWindowProvider."
|
|
@@ -1809,10 +2092,10 @@ function useNuWindowManager() {
|
|
|
1809
2092
|
}
|
|
1810
2093
|
|
|
1811
2094
|
// src/components/Window/windowMenuContext.ts
|
|
1812
|
-
import { createContext as
|
|
1813
|
-
var WindowMenuContext =
|
|
2095
|
+
import { createContext as createContext4, useContext as useContext4 } from "react";
|
|
2096
|
+
var WindowMenuContext = createContext4(null);
|
|
1814
2097
|
function useWindowMenu() {
|
|
1815
|
-
const context =
|
|
2098
|
+
const context = useContext4(WindowMenuContext);
|
|
1816
2099
|
if (!context) {
|
|
1817
2100
|
throw new Error("useWindowMenu must be used within a Window menu scope.");
|
|
1818
2101
|
}
|
|
@@ -1820,7 +2103,7 @@ function useWindowMenu() {
|
|
|
1820
2103
|
}
|
|
1821
2104
|
|
|
1822
2105
|
// src/components/Window/Window.tsx
|
|
1823
|
-
import { jsx as
|
|
2106
|
+
import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1824
2107
|
function getWindowLayerBounds(node) {
|
|
1825
2108
|
const parentNode = node.parentElement;
|
|
1826
2109
|
if (!parentNode) {
|
|
@@ -1868,18 +2151,18 @@ function WindowInner({
|
|
|
1868
2151
|
title,
|
|
1869
2152
|
...props
|
|
1870
2153
|
}) {
|
|
1871
|
-
const windowRef =
|
|
1872
|
-
const dragFrameRef =
|
|
1873
|
-
const dragPositionRef =
|
|
1874
|
-
const resizeFrameRef =
|
|
1875
|
-
const resizeSizeRef =
|
|
2154
|
+
const windowRef = useRef5(null);
|
|
2155
|
+
const dragFrameRef = useRef5(null);
|
|
2156
|
+
const dragPositionRef = useRef5(null);
|
|
2157
|
+
const resizeFrameRef = useRef5(null);
|
|
2158
|
+
const resizeSizeRef = useRef5(null);
|
|
1876
2159
|
const menuState = useMainMenuState();
|
|
1877
|
-
const windowManager =
|
|
2160
|
+
const windowManager = useContext5(NuWindowContext);
|
|
1878
2161
|
const isDraggable = draggable ?? mode === "window";
|
|
1879
2162
|
const isMaximizable = maximizable ?? mode === "window";
|
|
1880
2163
|
const isMinimizable = minimizable ?? mode === "window";
|
|
1881
2164
|
const isResizable = resizable ?? mode === "window";
|
|
1882
|
-
const mdiBridge =
|
|
2165
|
+
const mdiBridge = useMemo6(
|
|
1883
2166
|
() => ({
|
|
1884
2167
|
activateWindow: windowManager?.activateWindow ?? (() => void 0),
|
|
1885
2168
|
openDialog: windowManager?.openDialog ?? (() => ""),
|
|
@@ -1887,7 +2170,7 @@ function WindowInner({
|
|
|
1887
2170
|
}),
|
|
1888
2171
|
[windowManager?.activateWindow, windowManager?.openDialog, windowManager?.windows]
|
|
1889
2172
|
);
|
|
1890
|
-
const resolvedMainMenu =
|
|
2173
|
+
const resolvedMainMenu = useMemo6(
|
|
1891
2174
|
() => resolveMdiMainMenuItems(menuState.mainMenu, mdiBridge),
|
|
1892
2175
|
[menuState.mainMenu, mdiBridge]
|
|
1893
2176
|
);
|
|
@@ -1933,8 +2216,6 @@ function WindowInner({
|
|
|
1933
2216
|
return;
|
|
1934
2217
|
}
|
|
1935
2218
|
onActivate?.();
|
|
1936
|
-
event.preventDefault();
|
|
1937
|
-
event.stopPropagation();
|
|
1938
2219
|
}
|
|
1939
2220
|
function handleTitlePointerDown(event) {
|
|
1940
2221
|
onActivate?.();
|
|
@@ -2117,14 +2398,14 @@ function WindowInner({
|
|
|
2117
2398
|
ref: windowRef,
|
|
2118
2399
|
style,
|
|
2119
2400
|
children: [
|
|
2120
|
-
/* @__PURE__ */
|
|
2401
|
+
/* @__PURE__ */ jsx21(
|
|
2121
2402
|
"span",
|
|
2122
2403
|
{
|
|
2123
2404
|
"aria-hidden": true,
|
|
2124
2405
|
className: "nu-window__shadow nu-window__shadow--right"
|
|
2125
2406
|
}
|
|
2126
2407
|
),
|
|
2127
|
-
/* @__PURE__ */
|
|
2408
|
+
/* @__PURE__ */ jsx21(
|
|
2128
2409
|
"span",
|
|
2129
2410
|
{
|
|
2130
2411
|
"aria-hidden": true,
|
|
@@ -2132,7 +2413,7 @@ function WindowInner({
|
|
|
2132
2413
|
}
|
|
2133
2414
|
),
|
|
2134
2415
|
/* @__PURE__ */ jsxs12(WindowMenuContext.Provider, { value: menuState, children: [
|
|
2135
|
-
/* @__PURE__ */
|
|
2416
|
+
/* @__PURE__ */ jsx21(
|
|
2136
2417
|
WindowTitleBar,
|
|
2137
2418
|
{
|
|
2138
2419
|
draggable: isDraggable,
|
|
@@ -2141,8 +2422,8 @@ function WindowInner({
|
|
|
2141
2422
|
titleButtons: resolvedTitleButtons
|
|
2142
2423
|
}
|
|
2143
2424
|
),
|
|
2144
|
-
hasVisibleMainMenuItems(resolvedMainMenu) ? /* @__PURE__ */
|
|
2145
|
-
/* @__PURE__ */
|
|
2425
|
+
hasVisibleMainMenuItems(resolvedMainMenu) ? /* @__PURE__ */ jsx21(MainMenu, { items: resolvedMainMenu }) : null,
|
|
2426
|
+
/* @__PURE__ */ jsx21(
|
|
2146
2427
|
"div",
|
|
2147
2428
|
{
|
|
2148
2429
|
className: [
|
|
@@ -2153,7 +2434,7 @@ function WindowInner({
|
|
|
2153
2434
|
children
|
|
2154
2435
|
}
|
|
2155
2436
|
),
|
|
2156
|
-
mode === "window" && (statusBar || isResizable) ? /* @__PURE__ */
|
|
2437
|
+
mode === "window" && (statusBar || isResizable) ? /* @__PURE__ */ jsx21(
|
|
2157
2438
|
WindowStatusBar,
|
|
2158
2439
|
{
|
|
2159
2440
|
onResizeStart: handleResizePointerDown,
|
|
@@ -2170,9 +2451,9 @@ function WindowInner({
|
|
|
2170
2451
|
var Window = memo2(WindowInner);
|
|
2171
2452
|
|
|
2172
2453
|
// src/windowing/AppBarHost.tsx
|
|
2173
|
-
import { jsx as
|
|
2454
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
2174
2455
|
function AppBarHost({ children, inline = false }) {
|
|
2175
|
-
return /* @__PURE__ */
|
|
2456
|
+
return /* @__PURE__ */ jsx22(
|
|
2176
2457
|
"aside",
|
|
2177
2458
|
{
|
|
2178
2459
|
className: [
|
|
@@ -2188,7 +2469,7 @@ function AppBarHost({ children, inline = false }) {
|
|
|
2188
2469
|
}
|
|
2189
2470
|
|
|
2190
2471
|
// src/windowing/WindowBar.tsx
|
|
2191
|
-
import { useContext as
|
|
2472
|
+
import { useContext as useContext6 } from "react";
|
|
2192
2473
|
|
|
2193
2474
|
// src/windowing/AppBarItem.tsx
|
|
2194
2475
|
import {
|
|
@@ -2262,7 +2543,7 @@ function AppBarItem(props) {
|
|
|
2262
2543
|
}
|
|
2263
2544
|
|
|
2264
2545
|
// src/windowing/WindowBar.tsx
|
|
2265
|
-
import { jsx as
|
|
2546
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
2266
2547
|
function buildWindowBarGroups(items) {
|
|
2267
2548
|
const groups = [];
|
|
2268
2549
|
const groupsByDomain = /* @__PURE__ */ new Map();
|
|
@@ -2296,7 +2577,7 @@ function buildWindowBarGroups(items) {
|
|
|
2296
2577
|
return groups;
|
|
2297
2578
|
}
|
|
2298
2579
|
function WindowBar({ items, onActivateWindow }) {
|
|
2299
|
-
const windowManager =
|
|
2580
|
+
const windowManager = useContext6(NuWindowContext);
|
|
2300
2581
|
const groups = buildWindowBarGroups(items);
|
|
2301
2582
|
function activateGroup(group) {
|
|
2302
2583
|
if (group.items.length <= 1) {
|
|
@@ -2314,7 +2595,7 @@ function WindowBar({ items, onActivateWindow }) {
|
|
|
2314
2595
|
const dialogDefinition = {
|
|
2315
2596
|
appModal: true,
|
|
2316
2597
|
border: "double",
|
|
2317
|
-
content: ({ close }) => /* @__PURE__ */
|
|
2598
|
+
content: ({ close }) => /* @__PURE__ */ jsx23(
|
|
2318
2599
|
MdiWindowPickerDialog,
|
|
2319
2600
|
{
|
|
2320
2601
|
activeWindowId: activeGroupWindowId,
|
|
@@ -2335,7 +2616,7 @@ function WindowBar({ items, onActivateWindow }) {
|
|
|
2335
2616
|
};
|
|
2336
2617
|
windowManager.openDialog(dialogDefinition);
|
|
2337
2618
|
}
|
|
2338
|
-
return /* @__PURE__ */
|
|
2619
|
+
return /* @__PURE__ */ jsx23("div", { className: "nu-window-bar", role: "group", "aria-label": "Open windows", children: groups.map((group) => /* @__PURE__ */ jsx23(
|
|
2339
2620
|
AppBarItem,
|
|
2340
2621
|
{
|
|
2341
2622
|
active: group.active,
|
|
@@ -2353,12 +2634,12 @@ import { useState as useState8 } from "react";
|
|
|
2353
2634
|
|
|
2354
2635
|
// src/components/TextField/TextField.tsx
|
|
2355
2636
|
import {
|
|
2356
|
-
useEffect as
|
|
2637
|
+
useEffect as useEffect5,
|
|
2357
2638
|
useId as useId2,
|
|
2358
|
-
useRef as
|
|
2639
|
+
useRef as useRef6,
|
|
2359
2640
|
useState as useState7
|
|
2360
2641
|
} from "react";
|
|
2361
|
-
import { jsx as
|
|
2642
|
+
import { jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2362
2643
|
function TextField({
|
|
2363
2644
|
className,
|
|
2364
2645
|
debounceMs = 0,
|
|
@@ -2379,12 +2660,12 @@ function TextField({
|
|
|
2379
2660
|
const fieldId = id ?? generatedId;
|
|
2380
2661
|
const hintId = hint ? `${fieldId}-hint` : void 0;
|
|
2381
2662
|
const isControlled = value !== void 0;
|
|
2382
|
-
const hasMountedRef =
|
|
2663
|
+
const hasMountedRef = useRef6(false);
|
|
2383
2664
|
const [uncontrolledValue, setUncontrolledValue] = useState7(
|
|
2384
2665
|
() => defaultValue == null ? "" : String(defaultValue)
|
|
2385
2666
|
);
|
|
2386
2667
|
const resolvedValue = isControlled ? value == null ? "" : String(value) : uncontrolledValue;
|
|
2387
|
-
|
|
2668
|
+
useEffect5(() => {
|
|
2388
2669
|
if (!onDebouncedChange) {
|
|
2389
2670
|
return;
|
|
2390
2671
|
}
|
|
@@ -2416,7 +2697,7 @@ function TextField({
|
|
|
2416
2697
|
htmlFor: fieldId,
|
|
2417
2698
|
style: slotStyles?.root,
|
|
2418
2699
|
children: [
|
|
2419
|
-
/* @__PURE__ */
|
|
2700
|
+
/* @__PURE__ */ jsx24(
|
|
2420
2701
|
"span",
|
|
2421
2702
|
{
|
|
2422
2703
|
className: cx("nu-text-field__label", slotClassNames?.label),
|
|
@@ -2430,7 +2711,7 @@ function TextField({
|
|
|
2430
2711
|
className: cx("nu-text-field__slot", slotClassNames?.slot),
|
|
2431
2712
|
style: slotStyles?.slot,
|
|
2432
2713
|
children: [
|
|
2433
|
-
/* @__PURE__ */
|
|
2714
|
+
/* @__PURE__ */ jsx24(
|
|
2434
2715
|
"span",
|
|
2435
2716
|
{
|
|
2436
2717
|
"aria-hidden": "true",
|
|
@@ -2439,7 +2720,7 @@ function TextField({
|
|
|
2439
2720
|
children: "["
|
|
2440
2721
|
}
|
|
2441
2722
|
),
|
|
2442
|
-
/* @__PURE__ */
|
|
2723
|
+
/* @__PURE__ */ jsx24(
|
|
2443
2724
|
"span",
|
|
2444
2725
|
{
|
|
2445
2726
|
className: cx(
|
|
@@ -2447,7 +2728,7 @@ function TextField({
|
|
|
2447
2728
|
slotClassNames?.inputShell
|
|
2448
2729
|
),
|
|
2449
2730
|
style: slotStyles?.inputShell,
|
|
2450
|
-
children: /* @__PURE__ */
|
|
2731
|
+
children: /* @__PURE__ */ jsx24(
|
|
2451
2732
|
"input",
|
|
2452
2733
|
{
|
|
2453
2734
|
...props,
|
|
@@ -2466,7 +2747,7 @@ function TextField({
|
|
|
2466
2747
|
)
|
|
2467
2748
|
}
|
|
2468
2749
|
),
|
|
2469
|
-
/* @__PURE__ */
|
|
2750
|
+
/* @__PURE__ */ jsx24(
|
|
2470
2751
|
"span",
|
|
2471
2752
|
{
|
|
2472
2753
|
"aria-hidden": "true",
|
|
@@ -2478,7 +2759,7 @@ function TextField({
|
|
|
2478
2759
|
]
|
|
2479
2760
|
}
|
|
2480
2761
|
),
|
|
2481
|
-
hint ? /* @__PURE__ */
|
|
2762
|
+
hint ? /* @__PURE__ */ jsx24(
|
|
2482
2763
|
"span",
|
|
2483
2764
|
{
|
|
2484
2765
|
className: cx("nu-text-field__hint", slotClassNames?.hint),
|
|
@@ -2493,7 +2774,7 @@ function TextField({
|
|
|
2493
2774
|
}
|
|
2494
2775
|
|
|
2495
2776
|
// src/components/View/NuView.tsx
|
|
2496
|
-
import { jsx as
|
|
2777
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
2497
2778
|
function NuView({
|
|
2498
2779
|
children,
|
|
2499
2780
|
className,
|
|
@@ -2502,7 +2783,7 @@ function NuView({
|
|
|
2502
2783
|
scroll = "auto",
|
|
2503
2784
|
...props
|
|
2504
2785
|
}) {
|
|
2505
|
-
return /* @__PURE__ */
|
|
2786
|
+
return /* @__PURE__ */ jsx25(
|
|
2506
2787
|
"div",
|
|
2507
2788
|
{
|
|
2508
2789
|
...props,
|
|
@@ -2516,7 +2797,7 @@ function NuView({
|
|
|
2516
2797
|
}
|
|
2517
2798
|
|
|
2518
2799
|
// src/windowing/dialogHelpers.tsx
|
|
2519
|
-
import { jsx as
|
|
2800
|
+
import { jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2520
2801
|
function getPresetButtons(preset) {
|
|
2521
2802
|
switch (preset) {
|
|
2522
2803
|
case "ok-cancel":
|
|
@@ -2619,8 +2900,8 @@ function MessageBoxDialogContent({
|
|
|
2619
2900
|
const bodyStyle = kind === "error" ? {
|
|
2620
2901
|
background: "var(--nu-color-button-danger)"
|
|
2621
2902
|
} : void 0;
|
|
2622
|
-
return /* @__PURE__ */
|
|
2623
|
-
/* @__PURE__ */
|
|
2903
|
+
return /* @__PURE__ */ jsx26(NuView, { padding: "cell", style: bodyStyle, children: /* @__PURE__ */ jsxs14(Stack, { gap: "md", children: [
|
|
2904
|
+
/* @__PURE__ */ jsx26(
|
|
2624
2905
|
"div",
|
|
2625
2906
|
{
|
|
2626
2907
|
style: tone ? {
|
|
@@ -2630,7 +2911,7 @@ function MessageBoxDialogContent({
|
|
|
2630
2911
|
}
|
|
2631
2912
|
),
|
|
2632
2913
|
/* @__PURE__ */ jsxs14(Stack, { direction: "row", gap: "sm", justify: "center", children: [
|
|
2633
|
-
ok ? /* @__PURE__ */
|
|
2914
|
+
ok ? /* @__PURE__ */ jsx26(
|
|
2634
2915
|
Button,
|
|
2635
2916
|
{
|
|
2636
2917
|
className: "nu-dialog-helper__button",
|
|
@@ -2639,7 +2920,7 @@ function MessageBoxDialogContent({
|
|
|
2639
2920
|
children: okLabel
|
|
2640
2921
|
}
|
|
2641
2922
|
) : null,
|
|
2642
|
-
yes ? /* @__PURE__ */
|
|
2923
|
+
yes ? /* @__PURE__ */ jsx26(
|
|
2643
2924
|
Button,
|
|
2644
2925
|
{
|
|
2645
2926
|
className: "nu-dialog-helper__button",
|
|
@@ -2648,7 +2929,7 @@ function MessageBoxDialogContent({
|
|
|
2648
2929
|
children: yesLabel
|
|
2649
2930
|
}
|
|
2650
2931
|
) : null,
|
|
2651
|
-
no ? /* @__PURE__ */
|
|
2932
|
+
no ? /* @__PURE__ */ jsx26(
|
|
2652
2933
|
Button,
|
|
2653
2934
|
{
|
|
2654
2935
|
className: "nu-dialog-helper__button",
|
|
@@ -2657,7 +2938,7 @@ function MessageBoxDialogContent({
|
|
|
2657
2938
|
children: noLabel
|
|
2658
2939
|
}
|
|
2659
2940
|
) : null,
|
|
2660
|
-
cancel ? /* @__PURE__ */
|
|
2941
|
+
cancel ? /* @__PURE__ */ jsx26(
|
|
2661
2942
|
Button,
|
|
2662
2943
|
{
|
|
2663
2944
|
className: "nu-dialog-helper__button",
|
|
@@ -2679,8 +2960,8 @@ function InputBoxDialogContent({
|
|
|
2679
2960
|
placeholder
|
|
2680
2961
|
}) {
|
|
2681
2962
|
const [value, setValue] = useState8(defaultValue ?? "");
|
|
2682
|
-
return /* @__PURE__ */
|
|
2683
|
-
/* @__PURE__ */
|
|
2963
|
+
return /* @__PURE__ */ jsx26(NuView, { padding: "cell", children: /* @__PURE__ */ jsxs14(Stack, { gap: "md", children: [
|
|
2964
|
+
/* @__PURE__ */ jsx26(
|
|
2684
2965
|
TextField,
|
|
2685
2966
|
{
|
|
2686
2967
|
autoFocus: true,
|
|
@@ -2692,7 +2973,7 @@ function InputBoxDialogContent({
|
|
|
2692
2973
|
}
|
|
2693
2974
|
),
|
|
2694
2975
|
/* @__PURE__ */ jsxs14(Stack, { direction: "row", gap: "sm", justify: "center", children: [
|
|
2695
|
-
/* @__PURE__ */
|
|
2976
|
+
/* @__PURE__ */ jsx26(
|
|
2696
2977
|
Button,
|
|
2697
2978
|
{
|
|
2698
2979
|
className: "nu-dialog-helper__button",
|
|
@@ -2701,7 +2982,7 @@ function InputBoxDialogContent({
|
|
|
2701
2982
|
children: okLabel
|
|
2702
2983
|
}
|
|
2703
2984
|
),
|
|
2704
|
-
/* @__PURE__ */
|
|
2985
|
+
/* @__PURE__ */ jsx26(
|
|
2705
2986
|
Button,
|
|
2706
2987
|
{
|
|
2707
2988
|
className: "nu-dialog-helper__button",
|
|
@@ -2715,7 +2996,7 @@ function InputBoxDialogContent({
|
|
|
2715
2996
|
}
|
|
2716
2997
|
|
|
2717
2998
|
// src/windowing/NuWindowProvider.tsx
|
|
2718
|
-
import { jsx as
|
|
2999
|
+
import { jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2719
3000
|
function getDefaultWindowStyle(mode, index) {
|
|
2720
3001
|
const offset = index * 18;
|
|
2721
3002
|
return {
|
|
@@ -2859,12 +3140,12 @@ function NuWindowProvider({
|
|
|
2859
3140
|
onAppModalChange,
|
|
2860
3141
|
renderAppBar = false
|
|
2861
3142
|
}) {
|
|
2862
|
-
const creationOrderRef =
|
|
2863
|
-
const idRef =
|
|
2864
|
-
const windowBoundsByIdRef =
|
|
3143
|
+
const creationOrderRef = useRef7(0);
|
|
3144
|
+
const idRef = useRef7(0);
|
|
3145
|
+
const windowBoundsByIdRef = useRef7({});
|
|
2865
3146
|
const [windows, setWindows] = useState9([]);
|
|
2866
3147
|
const [windowBoundsById, setWindowBoundsById] = useState9({});
|
|
2867
|
-
const appHostMenuContext =
|
|
3148
|
+
const appHostMenuContext = useContext7(AppHostMenuContext);
|
|
2868
3149
|
const nextId = useCallback3(() => {
|
|
2869
3150
|
idRef.current += 1;
|
|
2870
3151
|
return `nu-window-${idRef.current}`;
|
|
@@ -3109,7 +3390,7 @@ function NuWindowProvider({
|
|
|
3109
3390
|
openDialog({
|
|
3110
3391
|
appModal: options.appModal ?? true,
|
|
3111
3392
|
closeable: true,
|
|
3112
|
-
content: ({ close }) => /* @__PURE__ */
|
|
3393
|
+
content: ({ close }) => /* @__PURE__ */ jsx27(
|
|
3113
3394
|
MessageBoxDialogContent,
|
|
3114
3395
|
{
|
|
3115
3396
|
cancel: buttons.cancel,
|
|
@@ -3152,7 +3433,7 @@ function NuWindowProvider({
|
|
|
3152
3433
|
openDialog({
|
|
3153
3434
|
appModal: options.appModal ?? true,
|
|
3154
3435
|
closeable: true,
|
|
3155
|
-
content: ({ close }) => /* @__PURE__ */
|
|
3436
|
+
content: ({ close }) => /* @__PURE__ */ jsx27(
|
|
3156
3437
|
InputBoxDialogContent,
|
|
3157
3438
|
{
|
|
3158
3439
|
cancelLabel: options.cancelLabel ?? "&Cancel",
|
|
@@ -3191,7 +3472,7 @@ function NuWindowProvider({
|
|
|
3191
3472
|
const topmostAppModalId = topmostAppModalIndex >= 0 ? visibleWindows[topmostAppModalIndex]?.id : void 0;
|
|
3192
3473
|
const activeWindowId = topmostAppModalIndex >= 0 ? visibleWindows[topmostAppModalIndex]?.id : visibleWindows[visibleWindows.length - 1]?.id;
|
|
3193
3474
|
const hasAppModal = topmostAppModalIndex >= 0;
|
|
3194
|
-
const windowsInfo =
|
|
3475
|
+
const windowsInfo = useMemo7(
|
|
3195
3476
|
() => [...windows].sort(
|
|
3196
3477
|
(leftWindow, rightWindow) => leftWindow.creationOrder - rightWindow.creationOrder
|
|
3197
3478
|
).map((windowEntry) => ({
|
|
@@ -3217,7 +3498,7 @@ function NuWindowProvider({
|
|
|
3217
3498
|
})),
|
|
3218
3499
|
[activeWindowId, windows]
|
|
3219
3500
|
);
|
|
3220
|
-
const mdiBridge =
|
|
3501
|
+
const mdiBridge = useMemo7(
|
|
3221
3502
|
() => ({
|
|
3222
3503
|
activateWindow,
|
|
3223
3504
|
openDialog,
|
|
@@ -3225,7 +3506,7 @@ function NuWindowProvider({
|
|
|
3225
3506
|
}),
|
|
3226
3507
|
[activateWindow, openDialog, windowsInfo]
|
|
3227
3508
|
);
|
|
3228
|
-
const contextValue =
|
|
3509
|
+
const contextValue = useMemo7(
|
|
3229
3510
|
() => ({
|
|
3230
3511
|
activateWindow,
|
|
3231
3512
|
bringToFront,
|
|
@@ -3255,13 +3536,13 @@ function NuWindowProvider({
|
|
|
3255
3536
|
windowsInfo
|
|
3256
3537
|
]
|
|
3257
3538
|
);
|
|
3258
|
-
|
|
3539
|
+
useEffect6(() => {
|
|
3259
3540
|
if (!appHostMenuContext) {
|
|
3260
3541
|
return;
|
|
3261
3542
|
}
|
|
3262
3543
|
appHostMenuContext.setWindowBridge(mdiBridge);
|
|
3263
3544
|
}, [appHostMenuContext, mdiBridge]);
|
|
3264
|
-
|
|
3545
|
+
useEffect6(() => {
|
|
3265
3546
|
if (!appHostMenuContext) {
|
|
3266
3547
|
return;
|
|
3267
3548
|
}
|
|
@@ -3269,12 +3550,12 @@ function NuWindowProvider({
|
|
|
3269
3550
|
appHostMenuContext.setWindowBridge(null);
|
|
3270
3551
|
};
|
|
3271
3552
|
}, [appHostMenuContext]);
|
|
3272
|
-
|
|
3553
|
+
useEffect6(() => {
|
|
3273
3554
|
onAppModalChange?.(hasAppModal);
|
|
3274
3555
|
}, [hasAppModal, onAppModalChange]);
|
|
3275
|
-
return /* @__PURE__ */
|
|
3556
|
+
return /* @__PURE__ */ jsx27(NuWindowContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs15("div", { className: ["nu-window-host", className].filter(Boolean).join(" "), children: [
|
|
3276
3557
|
children,
|
|
3277
|
-
/* @__PURE__ */
|
|
3558
|
+
/* @__PURE__ */ jsx27("div", { className: "nu-window-layer", children: renderWindows.map((windowEntry) => {
|
|
3278
3559
|
const isActiveWindow = windowEntry.id === activeWindowId;
|
|
3279
3560
|
const stackIndex = stackIndexById.get(windowEntry.id);
|
|
3280
3561
|
const isTopmostAppModal = windowEntry.id === topmostAppModalId;
|
|
@@ -3304,20 +3585,20 @@ function NuWindowProvider({
|
|
|
3304
3585
|
};
|
|
3305
3586
|
const content = typeof windowEntry.content === "function" ? windowEntry.content(controls) : windowEntry.content;
|
|
3306
3587
|
return /* @__PURE__ */ jsxs15(Fragment3, { children: [
|
|
3307
|
-
isTopmostAppModal ? /* @__PURE__ */
|
|
3588
|
+
isTopmostAppModal ? /* @__PURE__ */ jsx27(
|
|
3308
3589
|
"div",
|
|
3309
3590
|
{
|
|
3310
3591
|
className: "nu-window-layer__modal-backdrop",
|
|
3311
3592
|
style: { zIndex: visibleWindows.length + 1 }
|
|
3312
3593
|
}
|
|
3313
|
-
) : ownerBackdropStyle ? /* @__PURE__ */
|
|
3594
|
+
) : ownerBackdropStyle ? /* @__PURE__ */ jsx27(
|
|
3314
3595
|
"div",
|
|
3315
3596
|
{
|
|
3316
3597
|
className: "nu-window-layer__modal-backdrop",
|
|
3317
3598
|
style: ownerBackdropStyle
|
|
3318
3599
|
}
|
|
3319
3600
|
) : null,
|
|
3320
|
-
/* @__PURE__ */
|
|
3601
|
+
/* @__PURE__ */ jsx27(
|
|
3321
3602
|
Window,
|
|
3322
3603
|
{
|
|
3323
3604
|
active: isActiveWindow,
|
|
@@ -3350,7 +3631,7 @@ function NuWindowProvider({
|
|
|
3350
3631
|
)
|
|
3351
3632
|
] }, windowEntry.id);
|
|
3352
3633
|
}) }),
|
|
3353
|
-
renderAppBar ? /* @__PURE__ */
|
|
3634
|
+
renderAppBar ? /* @__PURE__ */ jsx27(AppBarHost, { children: /* @__PURE__ */ jsx27(
|
|
3354
3635
|
WindowBar,
|
|
3355
3636
|
{
|
|
3356
3637
|
items: windowsInfo.map((windowEntry) => ({
|
|
@@ -3367,11 +3648,11 @@ function NuWindowProvider({
|
|
|
3367
3648
|
}
|
|
3368
3649
|
|
|
3369
3650
|
// src/components/Desktop/Desktop.tsx
|
|
3370
|
-
import { jsx as
|
|
3651
|
+
import { jsx as jsx28, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3371
3652
|
function DesktopWindowRegion({ appBar, children }) {
|
|
3372
3653
|
return /* @__PURE__ */ jsxs16(Fragment4, { children: [
|
|
3373
|
-
/* @__PURE__ */
|
|
3374
|
-
appBar ? /* @__PURE__ */
|
|
3654
|
+
/* @__PURE__ */ jsx28("div", { className: "nu-desktop__workspace", children }),
|
|
3655
|
+
appBar ? /* @__PURE__ */ jsx28("div", { className: "nu-desktop__app-bar", children: appBar }) : null
|
|
3375
3656
|
] });
|
|
3376
3657
|
}
|
|
3377
3658
|
function NuDesktop({
|
|
@@ -3382,11 +3663,11 @@ function NuDesktop({
|
|
|
3382
3663
|
...props
|
|
3383
3664
|
}) {
|
|
3384
3665
|
const [hasAppModal, setHasAppModal] = useState10(false);
|
|
3385
|
-
const appHostContext =
|
|
3666
|
+
const appHostContext = useContext8(AppHostMenuContext);
|
|
3386
3667
|
if (appHostContext) {
|
|
3387
3668
|
throw new Error("NuDesktop should not be nested inside another app host.");
|
|
3388
3669
|
}
|
|
3389
|
-
return /* @__PURE__ */
|
|
3670
|
+
return /* @__PURE__ */ jsx28(NuAppHostProvider, { renderMenu: false, children: /* @__PURE__ */ jsx28(
|
|
3390
3671
|
NuDesktopShell,
|
|
3391
3672
|
{
|
|
3392
3673
|
appBar: appBar ?? appBarContent,
|
|
@@ -3406,7 +3687,7 @@ function NuDesktopShell({
|
|
|
3406
3687
|
onAppModalChange,
|
|
3407
3688
|
props
|
|
3408
3689
|
}) {
|
|
3409
|
-
const appHostContext =
|
|
3690
|
+
const appHostContext = useContext8(AppHostMenuContext);
|
|
3410
3691
|
if (!appHostContext) {
|
|
3411
3692
|
throw new Error("NuDesktop must be used within a NuAppHostProvider.");
|
|
3412
3693
|
}
|
|
@@ -3421,14 +3702,14 @@ function NuDesktopShell({
|
|
|
3421
3702
|
className: ["nu-desktop", className].filter(Boolean).join(" "),
|
|
3422
3703
|
"data-modal-active": hasAppModal || void 0,
|
|
3423
3704
|
children: [
|
|
3424
|
-
hasVisibleMainMenuItems(resolvedMainMenu) ? /* @__PURE__ */
|
|
3425
|
-
/* @__PURE__ */
|
|
3705
|
+
hasVisibleMainMenuItems(resolvedMainMenu) ? /* @__PURE__ */ jsx28("div", { className: "nu-desktop__menu", children: /* @__PURE__ */ jsx28(MainMenu, { items: resolvedMainMenu }) }) : null,
|
|
3706
|
+
/* @__PURE__ */ jsx28(
|
|
3426
3707
|
NuWindowProvider,
|
|
3427
3708
|
{
|
|
3428
3709
|
className: "nu-desktop__window-region",
|
|
3429
3710
|
onAppModalChange,
|
|
3430
3711
|
renderAppBar: false,
|
|
3431
|
-
children: /* @__PURE__ */
|
|
3712
|
+
children: /* @__PURE__ */ jsx28(DesktopWindowRegion, { appBar, children })
|
|
3432
3713
|
}
|
|
3433
3714
|
)
|
|
3434
3715
|
]
|
|
@@ -3437,7 +3718,7 @@ function NuDesktopShell({
|
|
|
3437
3718
|
}
|
|
3438
3719
|
|
|
3439
3720
|
// src/components/Dashboard/Dashboard.tsx
|
|
3440
|
-
import { jsx as
|
|
3721
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
3441
3722
|
function resolveDashboardGap(gap) {
|
|
3442
3723
|
if (typeof gap === "number") {
|
|
3443
3724
|
return `${gap}px`;
|
|
@@ -3458,7 +3739,7 @@ function Dashboard({
|
|
|
3458
3739
|
const resolvedGap = resolveDashboardGap(gap);
|
|
3459
3740
|
if (layout === "lanes") {
|
|
3460
3741
|
const lanes = Array.from({ length: laneCount }, (_, index) => index + 1);
|
|
3461
|
-
return /* @__PURE__ */
|
|
3742
|
+
return /* @__PURE__ */ jsx29(
|
|
3462
3743
|
"div",
|
|
3463
3744
|
{
|
|
3464
3745
|
...props,
|
|
@@ -3470,7 +3751,7 @@ function Dashboard({
|
|
|
3470
3751
|
"--nu-dashboard-gap": resolvedGap,
|
|
3471
3752
|
"--nu-dashboard-lane-count": laneCount
|
|
3472
3753
|
},
|
|
3473
|
-
children: lanes.map((lane) => /* @__PURE__ */
|
|
3754
|
+
children: lanes.map((lane) => /* @__PURE__ */ jsx29("div", { className: "nu-dashboard__lane", children: items.filter((item) => (item.lane ?? 1) === lane).map((item) => /* @__PURE__ */ jsx29(
|
|
3474
3755
|
"div",
|
|
3475
3756
|
{
|
|
3476
3757
|
className: "nu-dashboard__cell",
|
|
@@ -3482,14 +3763,14 @@ function Dashboard({
|
|
|
3482
3763
|
minWidth: item.minWidth,
|
|
3483
3764
|
width: item.width
|
|
3484
3765
|
},
|
|
3485
|
-
children: /* @__PURE__ */
|
|
3766
|
+
children: /* @__PURE__ */ jsx29("div", { className: "nu-dashboard__content", children: item.content })
|
|
3486
3767
|
},
|
|
3487
3768
|
item.id
|
|
3488
3769
|
)) }, lane))
|
|
3489
3770
|
}
|
|
3490
3771
|
);
|
|
3491
3772
|
}
|
|
3492
|
-
return /* @__PURE__ */
|
|
3773
|
+
return /* @__PURE__ */ jsx29(
|
|
3493
3774
|
"div",
|
|
3494
3775
|
{
|
|
3495
3776
|
...props,
|
|
@@ -3500,7 +3781,7 @@ function Dashboard({
|
|
|
3500
3781
|
"--nu-dashboard-column-count": columnCount,
|
|
3501
3782
|
"--nu-dashboard-gap": resolvedGap
|
|
3502
3783
|
},
|
|
3503
|
-
children: items.map((item) => /* @__PURE__ */
|
|
3784
|
+
children: items.map((item) => /* @__PURE__ */ jsx29(
|
|
3504
3785
|
"div",
|
|
3505
3786
|
{
|
|
3506
3787
|
className: "nu-dashboard__cell",
|
|
@@ -3514,7 +3795,7 @@ function Dashboard({
|
|
|
3514
3795
|
minWidth: item.minWidth,
|
|
3515
3796
|
width: item.width
|
|
3516
3797
|
},
|
|
3517
|
-
children: /* @__PURE__ */
|
|
3798
|
+
children: /* @__PURE__ */ jsx29("div", { className: "nu-dashboard__content", children: item.content })
|
|
3518
3799
|
},
|
|
3519
3800
|
item.id
|
|
3520
3801
|
))
|
|
@@ -3524,7 +3805,7 @@ function Dashboard({
|
|
|
3524
3805
|
|
|
3525
3806
|
// src/components/CheckBox/CheckBox.tsx
|
|
3526
3807
|
import { useId as useId3, useState as useState11 } from "react";
|
|
3527
|
-
import { jsx as
|
|
3808
|
+
import { jsx as jsx30, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3528
3809
|
function CheckBox({
|
|
3529
3810
|
checked,
|
|
3530
3811
|
className,
|
|
@@ -3563,7 +3844,7 @@ function CheckBox({
|
|
|
3563
3844
|
className: cx("nu-check-box__main", slotClassNames?.main),
|
|
3564
3845
|
style: slotStyles?.main,
|
|
3565
3846
|
children: [
|
|
3566
|
-
/* @__PURE__ */
|
|
3847
|
+
/* @__PURE__ */ jsx30(
|
|
3567
3848
|
"input",
|
|
3568
3849
|
{
|
|
3569
3850
|
...props,
|
|
@@ -3577,19 +3858,19 @@ function CheckBox({
|
|
|
3577
3858
|
type: "checkbox"
|
|
3578
3859
|
}
|
|
3579
3860
|
),
|
|
3580
|
-
/* @__PURE__ */
|
|
3861
|
+
/* @__PURE__ */ jsx30(
|
|
3581
3862
|
"span",
|
|
3582
3863
|
{
|
|
3583
3864
|
"aria-hidden": "true",
|
|
3584
3865
|
className: cx("nu-check-box__control", slotClassNames?.control),
|
|
3585
3866
|
style: slotStyles?.control,
|
|
3586
|
-
children: /* @__PURE__ */
|
|
3867
|
+
children: /* @__PURE__ */ jsx30(
|
|
3587
3868
|
"span",
|
|
3588
3869
|
{
|
|
3589
3870
|
className: cx("nu-check-box__box", slotClassNames?.box),
|
|
3590
3871
|
"data-unchecked-shape": uncheckedShape,
|
|
3591
3872
|
style: slotStyles?.box,
|
|
3592
|
-
children: resolvedChecked ? /* @__PURE__ */
|
|
3873
|
+
children: resolvedChecked ? /* @__PURE__ */ jsx30(
|
|
3593
3874
|
NuGlyph,
|
|
3594
3875
|
{
|
|
3595
3876
|
className: cx("nu-check-box__mark", slotClassNames?.mark),
|
|
@@ -3601,7 +3882,7 @@ function CheckBox({
|
|
|
3601
3882
|
)
|
|
3602
3883
|
}
|
|
3603
3884
|
),
|
|
3604
|
-
/* @__PURE__ */
|
|
3885
|
+
/* @__PURE__ */ jsx30(
|
|
3605
3886
|
"span",
|
|
3606
3887
|
{
|
|
3607
3888
|
className: cx("nu-check-box__label", slotClassNames?.label),
|
|
@@ -3612,7 +3893,7 @@ function CheckBox({
|
|
|
3612
3893
|
]
|
|
3613
3894
|
}
|
|
3614
3895
|
),
|
|
3615
|
-
hint ? /* @__PURE__ */
|
|
3896
|
+
hint ? /* @__PURE__ */ jsx30(
|
|
3616
3897
|
"span",
|
|
3617
3898
|
{
|
|
3618
3899
|
className: cx("nu-check-box__hint", slotClassNames?.hint),
|
|
@@ -3628,29 +3909,29 @@ function CheckBox({
|
|
|
3628
3909
|
|
|
3629
3910
|
// src/components/Dropdown/Dropdown.tsx
|
|
3630
3911
|
import {
|
|
3631
|
-
useEffect as
|
|
3912
|
+
useEffect as useEffect7,
|
|
3632
3913
|
useId as useId4,
|
|
3633
|
-
useMemo as
|
|
3634
|
-
useRef as
|
|
3914
|
+
useMemo as useMemo8,
|
|
3915
|
+
useRef as useRef8,
|
|
3635
3916
|
useState as useState12
|
|
3636
3917
|
} from "react";
|
|
3637
3918
|
import { createPortal } from "react-dom";
|
|
3638
3919
|
|
|
3639
3920
|
// src/components/_shared/ControlOpener.tsx
|
|
3640
|
-
import { jsx as
|
|
3921
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
3641
3922
|
function ControlOpener(props) {
|
|
3642
3923
|
const { children, className, glyphClassName, glyphStyle, style } = props;
|
|
3643
3924
|
if (props.as === "button") {
|
|
3644
3925
|
const { as: _as2, type = "button", ...buttonProps } = props;
|
|
3645
3926
|
void _as2;
|
|
3646
|
-
return /* @__PURE__ */
|
|
3927
|
+
return /* @__PURE__ */ jsx31(
|
|
3647
3928
|
"button",
|
|
3648
3929
|
{
|
|
3649
3930
|
...buttonProps,
|
|
3650
3931
|
className: cx("nu-control-opener", className),
|
|
3651
3932
|
style,
|
|
3652
3933
|
type,
|
|
3653
|
-
children: children ?? /* @__PURE__ */
|
|
3934
|
+
children: children ?? /* @__PURE__ */ jsx31(
|
|
3654
3935
|
NuGlyph,
|
|
3655
3936
|
{
|
|
3656
3937
|
className: cx("nu-control-opener__glyph", glyphClassName),
|
|
@@ -3663,14 +3944,14 @@ function ControlOpener(props) {
|
|
|
3663
3944
|
}
|
|
3664
3945
|
const { ariaHidden = false, as: _as, ...spanProps } = props;
|
|
3665
3946
|
void _as;
|
|
3666
|
-
return /* @__PURE__ */
|
|
3947
|
+
return /* @__PURE__ */ jsx31(
|
|
3667
3948
|
"span",
|
|
3668
3949
|
{
|
|
3669
3950
|
...spanProps,
|
|
3670
3951
|
"aria-hidden": ariaHidden,
|
|
3671
3952
|
className: cx("nu-control-opener", className),
|
|
3672
3953
|
style,
|
|
3673
|
-
children: children ?? /* @__PURE__ */
|
|
3954
|
+
children: children ?? /* @__PURE__ */ jsx31(
|
|
3674
3955
|
NuGlyph,
|
|
3675
3956
|
{
|
|
3676
3957
|
className: cx("nu-control-opener__glyph", glyphClassName),
|
|
@@ -3786,7 +4067,7 @@ function usePopupPosition({
|
|
|
3786
4067
|
}
|
|
3787
4068
|
|
|
3788
4069
|
// src/components/Dropdown/Dropdown.tsx
|
|
3789
|
-
import { jsx as
|
|
4070
|
+
import { jsx as jsx32, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3790
4071
|
function flattenDropdownOptions(data) {
|
|
3791
4072
|
const options = [];
|
|
3792
4073
|
data.forEach((group) => {
|
|
@@ -3835,13 +4116,13 @@ function Dropdown({
|
|
|
3835
4116
|
style,
|
|
3836
4117
|
...props
|
|
3837
4118
|
}) {
|
|
3838
|
-
const rootRef =
|
|
3839
|
-
const triggerRef =
|
|
3840
|
-
const fieldRef =
|
|
3841
|
-
const popupRef =
|
|
3842
|
-
const popupListRef =
|
|
4119
|
+
const rootRef = useRef8(null);
|
|
4120
|
+
const triggerRef = useRef8(null);
|
|
4121
|
+
const fieldRef = useRef8(null);
|
|
4122
|
+
const popupRef = useRef8(null);
|
|
4123
|
+
const popupListRef = useRef8(null);
|
|
3843
4124
|
const [open, setOpen] = useState12(false);
|
|
3844
|
-
const options =
|
|
4125
|
+
const options = useMemo8(() => flattenDropdownOptions(data), [data]);
|
|
3845
4126
|
const generatedId = useId4();
|
|
3846
4127
|
const fieldId = `${generatedId}-dropdown`;
|
|
3847
4128
|
const labelId = `${fieldId}-label`;
|
|
@@ -3849,16 +4130,16 @@ function Dropdown({
|
|
|
3849
4130
|
const isControlled = value !== void 0;
|
|
3850
4131
|
const [uncontrolledValue, setUncontrolledValue] = useState12(() => getInitialValue(options, defaultValue));
|
|
3851
4132
|
const resolvedValue = isControlled ? value : uncontrolledValue;
|
|
3852
|
-
const selectedOption =
|
|
4133
|
+
const selectedOption = useMemo8(
|
|
3853
4134
|
() => findSelectedOption(options, resolvedValue),
|
|
3854
4135
|
[options, resolvedValue]
|
|
3855
4136
|
);
|
|
3856
|
-
const selectableOptions =
|
|
4137
|
+
const selectableOptions = useMemo8(
|
|
3857
4138
|
() => options.filter((option) => !option.item.disabled),
|
|
3858
4139
|
[options]
|
|
3859
4140
|
);
|
|
3860
4141
|
const displayText = selectedOption?.item.name.text ?? placeholder;
|
|
3861
|
-
|
|
4142
|
+
useEffect7(() => {
|
|
3862
4143
|
if (!open) {
|
|
3863
4144
|
return;
|
|
3864
4145
|
}
|
|
@@ -3886,7 +4167,7 @@ function Dropdown({
|
|
|
3886
4167
|
open,
|
|
3887
4168
|
popupRef
|
|
3888
4169
|
});
|
|
3889
|
-
|
|
4170
|
+
useEffect7(() => {
|
|
3890
4171
|
if (!open) {
|
|
3891
4172
|
return;
|
|
3892
4173
|
}
|
|
@@ -3960,7 +4241,7 @@ function Dropdown({
|
|
|
3960
4241
|
ref: rootRef,
|
|
3961
4242
|
style: mergeSlotStyle(style, slotStyles?.root),
|
|
3962
4243
|
children: [
|
|
3963
|
-
/* @__PURE__ */
|
|
4244
|
+
/* @__PURE__ */ jsx32(
|
|
3964
4245
|
"span",
|
|
3965
4246
|
{
|
|
3966
4247
|
className: cx("nu-dropdown__label", slotClassNames?.label),
|
|
@@ -3969,7 +4250,7 @@ function Dropdown({
|
|
|
3969
4250
|
children: renderMnemonicText(label)
|
|
3970
4251
|
}
|
|
3971
4252
|
),
|
|
3972
|
-
/* @__PURE__ */
|
|
4253
|
+
/* @__PURE__ */ jsx32(
|
|
3973
4254
|
"button",
|
|
3974
4255
|
{
|
|
3975
4256
|
"aria-describedby": hintId,
|
|
@@ -4000,7 +4281,7 @@ function Dropdown({
|
|
|
4000
4281
|
ref: fieldRef,
|
|
4001
4282
|
style: slotStyles?.field,
|
|
4002
4283
|
children: [
|
|
4003
|
-
/* @__PURE__ */
|
|
4284
|
+
/* @__PURE__ */ jsx32(
|
|
4004
4285
|
"span",
|
|
4005
4286
|
{
|
|
4006
4287
|
"aria-hidden": "true",
|
|
@@ -4009,7 +4290,7 @@ function Dropdown({
|
|
|
4009
4290
|
children: "["
|
|
4010
4291
|
}
|
|
4011
4292
|
),
|
|
4012
|
-
/* @__PURE__ */
|
|
4293
|
+
/* @__PURE__ */ jsx32(
|
|
4013
4294
|
"span",
|
|
4014
4295
|
{
|
|
4015
4296
|
className: cx(
|
|
@@ -4017,7 +4298,7 @@ function Dropdown({
|
|
|
4017
4298
|
slotClassNames?.valueShell
|
|
4018
4299
|
),
|
|
4019
4300
|
style: slotStyles?.valueShell,
|
|
4020
|
-
children: /* @__PURE__ */
|
|
4301
|
+
children: /* @__PURE__ */ jsx32(
|
|
4021
4302
|
"span",
|
|
4022
4303
|
{
|
|
4023
4304
|
className: cx("nu-dropdown__value", slotClassNames?.value),
|
|
@@ -4027,7 +4308,7 @@ function Dropdown({
|
|
|
4027
4308
|
)
|
|
4028
4309
|
}
|
|
4029
4310
|
),
|
|
4030
|
-
/* @__PURE__ */
|
|
4311
|
+
/* @__PURE__ */ jsx32(
|
|
4031
4312
|
"span",
|
|
4032
4313
|
{
|
|
4033
4314
|
"aria-hidden": "true",
|
|
@@ -4039,7 +4320,7 @@ function Dropdown({
|
|
|
4039
4320
|
]
|
|
4040
4321
|
}
|
|
4041
4322
|
),
|
|
4042
|
-
/* @__PURE__ */
|
|
4323
|
+
/* @__PURE__ */ jsx32(
|
|
4043
4324
|
ControlOpener,
|
|
4044
4325
|
{
|
|
4045
4326
|
ariaHidden: true,
|
|
@@ -4050,7 +4331,7 @@ function Dropdown({
|
|
|
4050
4331
|
slotClassNames?.arrowShell
|
|
4051
4332
|
),
|
|
4052
4333
|
style: slotStyles?.arrowShell,
|
|
4053
|
-
children: /* @__PURE__ */
|
|
4334
|
+
children: /* @__PURE__ */ jsx32(
|
|
4054
4335
|
NuGlyph,
|
|
4055
4336
|
{
|
|
4056
4337
|
className: cx(
|
|
@@ -4069,7 +4350,7 @@ function Dropdown({
|
|
|
4069
4350
|
)
|
|
4070
4351
|
}
|
|
4071
4352
|
),
|
|
4072
|
-
hint ? /* @__PURE__ */
|
|
4353
|
+
hint ? /* @__PURE__ */ jsx32(
|
|
4073
4354
|
"span",
|
|
4074
4355
|
{
|
|
4075
4356
|
className: cx("nu-dropdown__hint", slotClassNames?.hint),
|
|
@@ -4079,7 +4360,7 @@ function Dropdown({
|
|
|
4079
4360
|
}
|
|
4080
4361
|
) : null,
|
|
4081
4362
|
open && typeof document !== "undefined" ? createPortal(
|
|
4082
|
-
/* @__PURE__ */
|
|
4363
|
+
/* @__PURE__ */ jsx32(
|
|
4083
4364
|
"div",
|
|
4084
4365
|
{
|
|
4085
4366
|
className: cx("nu-dropdown__popup", slotClassNames?.popup),
|
|
@@ -4088,7 +4369,7 @@ function Dropdown({
|
|
|
4088
4369
|
{ left: 0, top: 0, visibility: "hidden", width: 0 },
|
|
4089
4370
|
slotStyles?.popup
|
|
4090
4371
|
),
|
|
4091
|
-
children: /* @__PURE__ */
|
|
4372
|
+
children: /* @__PURE__ */ jsx32(
|
|
4092
4373
|
"div",
|
|
4093
4374
|
{
|
|
4094
4375
|
className: cx(
|
|
@@ -4097,7 +4378,7 @@ function Dropdown({
|
|
|
4097
4378
|
),
|
|
4098
4379
|
ref: popupListRef,
|
|
4099
4380
|
style: slotStyles?.popupShell,
|
|
4100
|
-
children: /* @__PURE__ */
|
|
4381
|
+
children: /* @__PURE__ */ jsx32(
|
|
4101
4382
|
ListBox,
|
|
4102
4383
|
{
|
|
4103
4384
|
className: cx(
|
|
@@ -4130,7 +4411,7 @@ function Dropdown({
|
|
|
4130
4411
|
}
|
|
4131
4412
|
|
|
4132
4413
|
// src/components/Frame/Frame.tsx
|
|
4133
|
-
import { jsx as
|
|
4414
|
+
import { jsx as jsx33, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4134
4415
|
function Frame({
|
|
4135
4416
|
children,
|
|
4136
4417
|
className,
|
|
@@ -4174,7 +4455,7 @@ function Frame({
|
|
|
4174
4455
|
className: cx("nu-frame__title", slotClassNames?.title),
|
|
4175
4456
|
style: mergeSlotStyle(titleStyle, slotStyles?.title),
|
|
4176
4457
|
children: [
|
|
4177
|
-
titleStart ? /* @__PURE__ */
|
|
4458
|
+
titleStart ? /* @__PURE__ */ jsx33(
|
|
4178
4459
|
"span",
|
|
4179
4460
|
{
|
|
4180
4461
|
className: cx(
|
|
@@ -4185,7 +4466,7 @@ function Frame({
|
|
|
4185
4466
|
children: titleStart
|
|
4186
4467
|
}
|
|
4187
4468
|
) : null,
|
|
4188
|
-
resolvedTitleContent ? /* @__PURE__ */
|
|
4469
|
+
resolvedTitleContent ? /* @__PURE__ */ jsx33(
|
|
4189
4470
|
"span",
|
|
4190
4471
|
{
|
|
4191
4472
|
className: cx(
|
|
@@ -4196,7 +4477,7 @@ function Frame({
|
|
|
4196
4477
|
children: resolvedTitleContent
|
|
4197
4478
|
}
|
|
4198
4479
|
) : null,
|
|
4199
|
-
titleEnd ? /* @__PURE__ */
|
|
4480
|
+
titleEnd ? /* @__PURE__ */ jsx33(
|
|
4200
4481
|
"span",
|
|
4201
4482
|
{
|
|
4202
4483
|
className: cx("nu-frame__title-end", slotClassNames?.titleEnd),
|
|
@@ -4207,7 +4488,7 @@ function Frame({
|
|
|
4207
4488
|
]
|
|
4208
4489
|
}
|
|
4209
4490
|
) : null,
|
|
4210
|
-
/* @__PURE__ */
|
|
4491
|
+
/* @__PURE__ */ jsx33(
|
|
4211
4492
|
"div",
|
|
4212
4493
|
{
|
|
4213
4494
|
className: cx("nu-frame__body", slotClassNames?.body),
|
|
@@ -4221,7 +4502,7 @@ function Frame({
|
|
|
4221
4502
|
}
|
|
4222
4503
|
|
|
4223
4504
|
// src/components/Info/Info.tsx
|
|
4224
|
-
import { jsx as
|
|
4505
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
4225
4506
|
function Info({
|
|
4226
4507
|
accentColor,
|
|
4227
4508
|
children,
|
|
@@ -4230,7 +4511,7 @@ function Info({
|
|
|
4230
4511
|
style,
|
|
4231
4512
|
...props
|
|
4232
4513
|
}) {
|
|
4233
|
-
return /* @__PURE__ */
|
|
4514
|
+
return /* @__PURE__ */ jsx34(
|
|
4234
4515
|
"div",
|
|
4235
4516
|
{
|
|
4236
4517
|
...props,
|
|
@@ -4254,7 +4535,7 @@ function InfoAccent({
|
|
|
4254
4535
|
upper = false,
|
|
4255
4536
|
...props
|
|
4256
4537
|
}) {
|
|
4257
|
-
return /* @__PURE__ */
|
|
4538
|
+
return /* @__PURE__ */ jsx34(
|
|
4258
4539
|
"span",
|
|
4259
4540
|
{
|
|
4260
4541
|
...props,
|
|
@@ -4272,46 +4553,21 @@ function InfoAccent({
|
|
|
4272
4553
|
// src/components/IconGrid/NuIconGrid.tsx
|
|
4273
4554
|
import {
|
|
4274
4555
|
useLayoutEffect as useLayoutEffect4,
|
|
4275
|
-
useMemo as
|
|
4276
|
-
useRef as
|
|
4556
|
+
useMemo as useMemo9,
|
|
4557
|
+
useRef as useRef10,
|
|
4277
4558
|
useState as useState15
|
|
4278
4559
|
} from "react";
|
|
4279
4560
|
|
|
4280
4561
|
// src/components/PopupMenu/PopupMenu.tsx
|
|
4281
4562
|
import {
|
|
4282
4563
|
useCallback as useCallback4,
|
|
4283
|
-
useEffect as
|
|
4564
|
+
useEffect as useEffect8,
|
|
4284
4565
|
useLayoutEffect as useLayoutEffect3,
|
|
4285
|
-
useRef as
|
|
4566
|
+
useRef as useRef9,
|
|
4286
4567
|
useState as useState13
|
|
4287
4568
|
} from "react";
|
|
4288
4569
|
import { createPortal as createPortal2 } from "react-dom";
|
|
4289
|
-
|
|
4290
|
-
// src/components/_shared/themePortal.ts
|
|
4291
|
-
function getThemePortalStyle(anchor) {
|
|
4292
|
-
if (typeof window === "undefined") {
|
|
4293
|
-
return void 0;
|
|
4294
|
-
}
|
|
4295
|
-
const themeRoot = anchor?.closest(".nu-theme-root");
|
|
4296
|
-
if (!themeRoot) {
|
|
4297
|
-
return void 0;
|
|
4298
|
-
}
|
|
4299
|
-
const computed = window.getComputedStyle(themeRoot);
|
|
4300
|
-
const style = {
|
|
4301
|
-
color: computed.color,
|
|
4302
|
-
fontFamily: computed.fontFamily,
|
|
4303
|
-
fontSize: computed.fontSize
|
|
4304
|
-
};
|
|
4305
|
-
for (const propertyName of computed) {
|
|
4306
|
-
if (propertyName.startsWith("--nu-")) {
|
|
4307
|
-
style[propertyName] = computed.getPropertyValue(propertyName).trim();
|
|
4308
|
-
}
|
|
4309
|
-
}
|
|
4310
|
-
return style;
|
|
4311
|
-
}
|
|
4312
|
-
|
|
4313
|
-
// src/components/PopupMenu/PopupMenu.tsx
|
|
4314
|
-
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
4570
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
4315
4571
|
function hasVisibleChildren2(item) {
|
|
4316
4572
|
return Boolean(item.items?.some((child) => !child.hidden));
|
|
4317
4573
|
}
|
|
@@ -4352,7 +4608,7 @@ function PopupMenu({
|
|
|
4352
4608
|
uncheckedShape = "box",
|
|
4353
4609
|
...props
|
|
4354
4610
|
}) {
|
|
4355
|
-
const rootRef =
|
|
4611
|
+
const rootRef = useRef9(null);
|
|
4356
4612
|
const [activePath, setActivePath] = useState13([]);
|
|
4357
4613
|
const [uncontrolledOpen, setUncontrolledOpen] = useState13(defaultOpen);
|
|
4358
4614
|
const isControlled = open !== void 0;
|
|
@@ -4370,7 +4626,7 @@ function PopupMenu({
|
|
|
4370
4626
|
},
|
|
4371
4627
|
[isControlled, onOpenChange]
|
|
4372
4628
|
);
|
|
4373
|
-
|
|
4629
|
+
useEffect8(() => {
|
|
4374
4630
|
if (!resolvedOpen) {
|
|
4375
4631
|
return;
|
|
4376
4632
|
}
|
|
@@ -4445,7 +4701,7 @@ function PopupMenu({
|
|
|
4445
4701
|
return null;
|
|
4446
4702
|
}
|
|
4447
4703
|
return createPortal2(
|
|
4448
|
-
/* @__PURE__ */
|
|
4704
|
+
/* @__PURE__ */ jsx35(
|
|
4449
4705
|
"div",
|
|
4450
4706
|
{
|
|
4451
4707
|
...props,
|
|
@@ -4461,7 +4717,7 @@ function PopupMenu({
|
|
|
4461
4717
|
top: 0,
|
|
4462
4718
|
visibility: "hidden"
|
|
4463
4719
|
},
|
|
4464
|
-
children: /* @__PURE__ */
|
|
4720
|
+
children: /* @__PURE__ */ jsx35("div", { className: "nu-popup-menu__shell", children: /* @__PURE__ */ jsx35(
|
|
4465
4721
|
MainMenuList,
|
|
4466
4722
|
{
|
|
4467
4723
|
activePath,
|
|
@@ -4523,10 +4779,10 @@ function usePopupMenu() {
|
|
|
4523
4779
|
}
|
|
4524
4780
|
|
|
4525
4781
|
// src/components/IconGrid/iconContext.ts
|
|
4526
|
-
import { createContext as
|
|
4527
|
-
var NuIconContext =
|
|
4782
|
+
import { createContext as createContext5, useContext as useContext9 } from "react";
|
|
4783
|
+
var NuIconContext = createContext5(null);
|
|
4528
4784
|
function useNuIconContext() {
|
|
4529
|
-
const context =
|
|
4785
|
+
const context = useContext9(NuIconContext);
|
|
4530
4786
|
if (!context) {
|
|
4531
4787
|
throw new Error("useNuIconManager must be used within a NuIconProvider.");
|
|
4532
4788
|
}
|
|
@@ -4540,8 +4796,9 @@ function useNuIconGridContext() {
|
|
|
4540
4796
|
}
|
|
4541
4797
|
|
|
4542
4798
|
// src/components/IconGrid/NuIconGrid.tsx
|
|
4543
|
-
import { Fragment as Fragment5, jsx as
|
|
4544
|
-
var
|
|
4799
|
+
import { Fragment as Fragment5, jsx as jsx36, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4800
|
+
var DRAG_THRESHOLD2 = 3;
|
|
4801
|
+
var gridRegistrations = /* @__PURE__ */ new Map();
|
|
4545
4802
|
function clamp2(value, minimum, maximum) {
|
|
4546
4803
|
return Math.min(Math.max(value, minimum), maximum);
|
|
4547
4804
|
}
|
|
@@ -4551,14 +4808,57 @@ function resolveIconContextMenuItems(source, icon) {
|
|
|
4551
4808
|
function resolveGridContextMenuItems(source, manager) {
|
|
4552
4809
|
return typeof source === "function" ? source(manager) : source ?? [];
|
|
4553
4810
|
}
|
|
4554
|
-
function
|
|
4811
|
+
function findGridRegistrationAtPoint(clientX, clientY) {
|
|
4812
|
+
const target = document.elementFromPoint(clientX, clientY);
|
|
4813
|
+
const gridElement = target?.closest(".nu-icon-grid");
|
|
4814
|
+
if (gridElement) {
|
|
4815
|
+
return gridRegistrations.get(gridElement);
|
|
4816
|
+
}
|
|
4817
|
+
if (target?.closest(".nu-window")) {
|
|
4818
|
+
return void 0;
|
|
4819
|
+
}
|
|
4820
|
+
return Array.from(gridRegistrations.values()).reverse().find((registration) => {
|
|
4821
|
+
if (!registration.dropTarget) {
|
|
4822
|
+
return false;
|
|
4823
|
+
}
|
|
4824
|
+
const rect = registration.element.getBoundingClientRect();
|
|
4825
|
+
return clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom;
|
|
4826
|
+
});
|
|
4827
|
+
}
|
|
4828
|
+
function getTransferredPosition(targetGrid, iconElement, clientX, clientY) {
|
|
4829
|
+
const targetRect = targetGrid.getBoundingClientRect();
|
|
4830
|
+
const iconRect = iconElement.getBoundingClientRect();
|
|
4831
|
+
return {
|
|
4832
|
+
x: Math.round(
|
|
4833
|
+
clamp2(
|
|
4834
|
+
clientX - targetRect.left - iconRect.width / 2,
|
|
4835
|
+
0,
|
|
4836
|
+
Math.max(0, targetRect.width - iconRect.width)
|
|
4837
|
+
)
|
|
4838
|
+
),
|
|
4839
|
+
y: Math.round(
|
|
4840
|
+
clamp2(
|
|
4841
|
+
clientY - targetRect.top - iconRect.height / 2,
|
|
4842
|
+
0,
|
|
4843
|
+
Math.max(0, targetRect.height - iconRect.height)
|
|
4844
|
+
)
|
|
4845
|
+
)
|
|
4846
|
+
};
|
|
4847
|
+
}
|
|
4848
|
+
function NuIconGridItem({
|
|
4849
|
+
gridElement,
|
|
4850
|
+
icon,
|
|
4851
|
+
onDragOut,
|
|
4852
|
+
onIconMoveOut
|
|
4853
|
+
}) {
|
|
4555
4854
|
const manager = useNuIconGridContext();
|
|
4855
|
+
const dragDrop = useNuDragDrop();
|
|
4556
4856
|
const contextMenu = usePopupMenu();
|
|
4557
|
-
const dragStartRef =
|
|
4558
|
-
const isDraggingRef =
|
|
4857
|
+
const dragStartRef = useRef10(void 0);
|
|
4858
|
+
const isDraggingRef = useRef10(false);
|
|
4559
4859
|
const [isDragging, setIsDragging] = useState15(false);
|
|
4560
|
-
const suppressClickRef =
|
|
4561
|
-
const latestPositionRef =
|
|
4860
|
+
const suppressClickRef = useRef10(false);
|
|
4861
|
+
const latestPositionRef = useRef10(icon.position);
|
|
4562
4862
|
const contextMenuItems = resolveIconContextMenuItems(
|
|
4563
4863
|
icon.contextMenuItems,
|
|
4564
4864
|
icon
|
|
@@ -4585,11 +4885,19 @@ function NuIconGridItem({ gridElement, icon }) {
|
|
|
4585
4885
|
}
|
|
4586
4886
|
const deltaX = event.clientX - dragStart.clientX;
|
|
4587
4887
|
const deltaY = event.clientY - dragStart.clientY;
|
|
4588
|
-
if (!isDraggingRef.current && Math.max(Math.abs(deltaX), Math.abs(deltaY)) <
|
|
4888
|
+
if (!isDraggingRef.current && Math.max(Math.abs(deltaX), Math.abs(deltaY)) < DRAG_THRESHOLD2) {
|
|
4589
4889
|
return;
|
|
4590
4890
|
}
|
|
4591
|
-
isDraggingRef.current
|
|
4592
|
-
|
|
4891
|
+
if (!isDraggingRef.current) {
|
|
4892
|
+
isDraggingRef.current = true;
|
|
4893
|
+
setIsDragging(true);
|
|
4894
|
+
dragDrop.beginDrag(
|
|
4895
|
+
{ data: icon, id: icon.id, type: "icon" },
|
|
4896
|
+
event.currentTarget,
|
|
4897
|
+
"icon-grid"
|
|
4898
|
+
);
|
|
4899
|
+
}
|
|
4900
|
+
dragDrop.moveDrag(event.clientX, event.clientY);
|
|
4593
4901
|
const gridRect = gridElement.getBoundingClientRect();
|
|
4594
4902
|
const iconRect = event.currentTarget.getBoundingClientRect();
|
|
4595
4903
|
const position = {
|
|
@@ -4609,7 +4917,6 @@ function NuIconGridItem({ gridElement, icon }) {
|
|
|
4609
4917
|
)
|
|
4610
4918
|
};
|
|
4611
4919
|
latestPositionRef.current = position;
|
|
4612
|
-
manager.moveIcon(icon.id, position);
|
|
4613
4920
|
}
|
|
4614
4921
|
function finishDragging(event) {
|
|
4615
4922
|
const dragStart = dragStartRef.current;
|
|
@@ -4626,10 +4933,55 @@ function NuIconGridItem({ gridElement, icon }) {
|
|
|
4626
4933
|
suppressClickRef.current = true;
|
|
4627
4934
|
isDraggingRef.current = false;
|
|
4628
4935
|
setIsDragging(false);
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
}
|
|
4936
|
+
if (event.type === "pointercancel" || !gridElement) {
|
|
4937
|
+
dragDrop.cancelDrag();
|
|
4938
|
+
return;
|
|
4939
|
+
}
|
|
4940
|
+
if (dragDrop.dropAt(event.clientX, event.clientY)) {
|
|
4941
|
+
manager.removeIcon(icon.id);
|
|
4942
|
+
onDragOut?.({ data: icon, id: icon.id, type: "icon" });
|
|
4943
|
+
return;
|
|
4944
|
+
}
|
|
4945
|
+
const targetRegistration = findGridRegistrationAtPoint(
|
|
4946
|
+
event.clientX,
|
|
4947
|
+
event.clientY
|
|
4948
|
+
);
|
|
4949
|
+
if (!targetRegistration) {
|
|
4950
|
+
return;
|
|
4951
|
+
}
|
|
4952
|
+
if (targetRegistration.element === gridElement) {
|
|
4953
|
+
manager.moveIcon(icon.id, latestPositionRef.current);
|
|
4954
|
+
icon.onPositionChange?.(latestPositionRef.current, {
|
|
4955
|
+
...icon,
|
|
4956
|
+
position: latestPositionRef.current
|
|
4957
|
+
});
|
|
4958
|
+
return;
|
|
4959
|
+
}
|
|
4960
|
+
if (!targetRegistration.manager.icons.some(
|
|
4961
|
+
(targetIcon) => targetIcon.id === icon.id
|
|
4962
|
+
)) {
|
|
4963
|
+
const position = getTransferredPosition(
|
|
4964
|
+
targetRegistration.element,
|
|
4965
|
+
event.currentTarget,
|
|
4966
|
+
event.clientX,
|
|
4967
|
+
event.clientY
|
|
4968
|
+
);
|
|
4969
|
+
const transferredIcon = { ...icon, position };
|
|
4970
|
+
const context = {
|
|
4971
|
+
position,
|
|
4972
|
+
source: manager,
|
|
4973
|
+
sourceGrid: gridElement,
|
|
4974
|
+
target: targetRegistration.manager,
|
|
4975
|
+
targetGrid: targetRegistration.element
|
|
4976
|
+
};
|
|
4977
|
+
if (targetRegistration.accepts?.(transferredIcon) !== false && targetRegistration.onIconDrop?.(transferredIcon, context) !== false) {
|
|
4978
|
+
targetRegistration.manager.addIcon(transferredIcon);
|
|
4979
|
+
targetRegistration.manager.selectIcon(transferredIcon.id);
|
|
4980
|
+
manager.removeIcon(icon.id);
|
|
4981
|
+
onIconMoveOut?.(transferredIcon, context);
|
|
4982
|
+
return;
|
|
4983
|
+
}
|
|
4984
|
+
}
|
|
4633
4985
|
}
|
|
4634
4986
|
function handleClick(event) {
|
|
4635
4987
|
if (suppressClickRef.current) {
|
|
@@ -4678,12 +5030,12 @@ function NuIconGridItem({ gridElement, icon }) {
|
|
|
4678
5030
|
style: { left: icon.position.x, top: icon.position.y },
|
|
4679
5031
|
type: "button",
|
|
4680
5032
|
children: [
|
|
4681
|
-
/* @__PURE__ */
|
|
4682
|
-
/* @__PURE__ */
|
|
5033
|
+
/* @__PURE__ */ jsx36("span", { "aria-hidden": "true", className: "nu-icon-grid__glyph", children: typeof icon.icon === "string" ? /* @__PURE__ */ jsx36("img", { alt: "", draggable: false, src: icon.icon }) : icon.icon }),
|
|
5034
|
+
/* @__PURE__ */ jsx36("span", { className: "nu-icon-grid__label", children: renderMnemonicText(icon.label) })
|
|
4683
5035
|
]
|
|
4684
5036
|
}
|
|
4685
5037
|
),
|
|
4686
|
-
/* @__PURE__ */
|
|
5038
|
+
/* @__PURE__ */ jsx36(
|
|
4687
5039
|
PopupMenu,
|
|
4688
5040
|
{
|
|
4689
5041
|
anchor: contextMenu.anchor,
|
|
@@ -4695,23 +5047,39 @@ function NuIconGridItem({ gridElement, icon }) {
|
|
|
4695
5047
|
] });
|
|
4696
5048
|
}
|
|
4697
5049
|
function NuIconGrid({
|
|
5050
|
+
accepts,
|
|
5051
|
+
acceptsDrop,
|
|
4698
5052
|
className,
|
|
4699
5053
|
contextMenuItems: contextMenuItemsSource,
|
|
4700
5054
|
defaultArrangeMode,
|
|
5055
|
+
dropTarget = false,
|
|
5056
|
+
onDragOut,
|
|
5057
|
+
onIconDrop,
|
|
5058
|
+
onIconMoveOut,
|
|
5059
|
+
onDrop,
|
|
4701
5060
|
onContextMenu,
|
|
4702
5061
|
onPointerDown,
|
|
4703
5062
|
...props
|
|
4704
5063
|
}) {
|
|
4705
5064
|
const [gridElement, setGridElement] = useState15(null);
|
|
4706
5065
|
const manager = useNuIconGridContext();
|
|
4707
|
-
const hasAppliedDefaultArrangementRef =
|
|
5066
|
+
const hasAppliedDefaultArrangementRef = useRef10(false);
|
|
4708
5067
|
const arrangeIcons = manager.arrangeIcons;
|
|
4709
5068
|
const setGridSize = manager.setGridSize;
|
|
4710
5069
|
const contextMenu = usePopupMenu();
|
|
4711
|
-
const contextMenuItems =
|
|
5070
|
+
const contextMenuItems = useMemo9(
|
|
4712
5071
|
() => resolveGridContextMenuItems(contextMenuItemsSource, manager),
|
|
4713
5072
|
[contextMenuItemsSource, manager]
|
|
4714
5073
|
);
|
|
5074
|
+
const sharedDropTargetOptions = useMemo9(
|
|
5075
|
+
() => onDrop ? {
|
|
5076
|
+
accepts: (item) => item.type !== "icon" && acceptsDrop?.(item) !== false,
|
|
5077
|
+
onDrop,
|
|
5078
|
+
type: "icon-grid"
|
|
5079
|
+
} : void 0,
|
|
5080
|
+
[acceptsDrop, onDrop]
|
|
5081
|
+
);
|
|
5082
|
+
useNuDropTarget(gridElement, sharedDropTargetOptions);
|
|
4715
5083
|
useLayoutEffect4(() => {
|
|
4716
5084
|
if (!gridElement) {
|
|
4717
5085
|
return;
|
|
@@ -4733,6 +5101,21 @@ function NuIconGrid({
|
|
|
4733
5101
|
resizeObserver.observe(gridElement);
|
|
4734
5102
|
return () => resizeObserver.disconnect();
|
|
4735
5103
|
}, [arrangeIcons, defaultArrangeMode, gridElement, setGridSize]);
|
|
5104
|
+
useLayoutEffect4(() => {
|
|
5105
|
+
if (!gridElement) {
|
|
5106
|
+
return;
|
|
5107
|
+
}
|
|
5108
|
+
gridRegistrations.set(gridElement, {
|
|
5109
|
+
accepts,
|
|
5110
|
+
dropTarget,
|
|
5111
|
+
element: gridElement,
|
|
5112
|
+
manager,
|
|
5113
|
+
onIconDrop
|
|
5114
|
+
});
|
|
5115
|
+
return () => {
|
|
5116
|
+
gridRegistrations.delete(gridElement);
|
|
5117
|
+
};
|
|
5118
|
+
}, [accepts, dropTarget, gridElement, manager, onIconDrop]);
|
|
4736
5119
|
function handleContextMenu(event) {
|
|
4737
5120
|
onContextMenu?.(event);
|
|
4738
5121
|
if (event.defaultPrevented || contextMenuItems.length === 0) {
|
|
@@ -4761,8 +5144,17 @@ function NuIconGrid({
|
|
|
4761
5144
|
ref: setGridElement,
|
|
4762
5145
|
role: "group",
|
|
4763
5146
|
children: [
|
|
4764
|
-
manager.icons.map((icon) => /* @__PURE__ */
|
|
4765
|
-
|
|
5147
|
+
manager.icons.map((icon) => /* @__PURE__ */ jsx36(
|
|
5148
|
+
NuIconGridItem,
|
|
5149
|
+
{
|
|
5150
|
+
gridElement,
|
|
5151
|
+
icon,
|
|
5152
|
+
onDragOut,
|
|
5153
|
+
onIconMoveOut
|
|
5154
|
+
},
|
|
5155
|
+
icon.id
|
|
5156
|
+
)),
|
|
5157
|
+
/* @__PURE__ */ jsx36(
|
|
4766
5158
|
PopupMenu,
|
|
4767
5159
|
{
|
|
4768
5160
|
anchor: contextMenu.anchor,
|
|
@@ -4779,11 +5171,11 @@ function NuIconGrid({
|
|
|
4779
5171
|
// src/components/IconGrid/NuIconProvider.tsx
|
|
4780
5172
|
import {
|
|
4781
5173
|
useCallback as useCallback5,
|
|
4782
|
-
useMemo as
|
|
4783
|
-
useRef as
|
|
5174
|
+
useMemo as useMemo10,
|
|
5175
|
+
useRef as useRef11,
|
|
4784
5176
|
useState as useState16
|
|
4785
5177
|
} from "react";
|
|
4786
|
-
import { jsx as
|
|
5178
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
4787
5179
|
var GRID_PADDING = 12;
|
|
4788
5180
|
var ICON_CELL_HEIGHT = 104;
|
|
4789
5181
|
var ICON_CELL_WIDTH = 104;
|
|
@@ -4848,8 +5240,8 @@ function NuIconProvider({
|
|
|
4848
5240
|
children,
|
|
4849
5241
|
defaultIcons = []
|
|
4850
5242
|
}) {
|
|
4851
|
-
const idRef =
|
|
4852
|
-
const gridSizeRef =
|
|
5243
|
+
const idRef = useRef11(defaultIcons.length);
|
|
5244
|
+
const gridSizeRef = useRef11({ height: 0, width: 0 });
|
|
4853
5245
|
const [icons, setIcons] = useState16(
|
|
4854
5246
|
() => getInitialIcons(defaultIcons)
|
|
4855
5247
|
);
|
|
@@ -4908,7 +5300,7 @@ function NuIconProvider({
|
|
|
4908
5300
|
const setGridSize = useCallback5((size) => {
|
|
4909
5301
|
gridSizeRef.current = size;
|
|
4910
5302
|
}, []);
|
|
4911
|
-
const contextValue =
|
|
5303
|
+
const contextValue = useMemo10(
|
|
4912
5304
|
() => ({
|
|
4913
5305
|
addIcon,
|
|
4914
5306
|
arrangeIcons,
|
|
@@ -4931,19 +5323,19 @@ function NuIconProvider({
|
|
|
4931
5323
|
updateIcon
|
|
4932
5324
|
]
|
|
4933
5325
|
);
|
|
4934
|
-
return /* @__PURE__ */
|
|
5326
|
+
return /* @__PURE__ */ jsx37(NuIconContext.Provider, { value: contextValue, children });
|
|
4935
5327
|
}
|
|
4936
5328
|
|
|
4937
5329
|
// src/components/ComboBox/ComboBox.tsx
|
|
4938
5330
|
import {
|
|
4939
|
-
useEffect as
|
|
5331
|
+
useEffect as useEffect9,
|
|
4940
5332
|
useId as useId5,
|
|
4941
|
-
useMemo as
|
|
4942
|
-
useRef as
|
|
5333
|
+
useMemo as useMemo11,
|
|
5334
|
+
useRef as useRef12,
|
|
4943
5335
|
useState as useState17
|
|
4944
5336
|
} from "react";
|
|
4945
5337
|
import { createPortal as createPortal3 } from "react-dom";
|
|
4946
|
-
import { jsx as
|
|
5338
|
+
import { jsx as jsx38, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4947
5339
|
function flattenComboBoxOptions(data) {
|
|
4948
5340
|
const options = [];
|
|
4949
5341
|
data.forEach((group) => {
|
|
@@ -4984,16 +5376,16 @@ function ComboBox({
|
|
|
4984
5376
|
value,
|
|
4985
5377
|
...props
|
|
4986
5378
|
}) {
|
|
4987
|
-
const rootRef =
|
|
4988
|
-
const inputRef =
|
|
4989
|
-
const fieldRef =
|
|
4990
|
-
const popupRef =
|
|
5379
|
+
const rootRef = useRef12(null);
|
|
5380
|
+
const inputRef = useRef12(null);
|
|
5381
|
+
const fieldRef = useRef12(null);
|
|
5382
|
+
const popupRef = useRef12(null);
|
|
4991
5383
|
const generatedId = useId5();
|
|
4992
5384
|
const fieldId = `${generatedId}-combo-box`;
|
|
4993
5385
|
const labelId = `${fieldId}-label`;
|
|
4994
5386
|
const hintId = hint ? `${fieldId}-hint` : void 0;
|
|
4995
5387
|
const [open, setOpen] = useState17(false);
|
|
4996
|
-
const options =
|
|
5388
|
+
const options = useMemo11(() => flattenComboBoxOptions(data), [data]);
|
|
4997
5389
|
const isValueControlled = value !== void 0;
|
|
4998
5390
|
const isInputControlled = inputValueProp !== void 0;
|
|
4999
5391
|
const [uncontrolledValue, setUncontrolledValue] = useState17(() => defaultValue);
|
|
@@ -5002,13 +5394,13 @@ function ComboBox({
|
|
|
5002
5394
|
() => defaultInputValue ?? initialSelectedOption?.item.name.text ?? ""
|
|
5003
5395
|
);
|
|
5004
5396
|
const resolvedValue = isValueControlled ? value : uncontrolledValue;
|
|
5005
|
-
const selectedOption =
|
|
5397
|
+
const selectedOption = useMemo11(
|
|
5006
5398
|
() => findComboBoxOption(options, resolvedValue),
|
|
5007
5399
|
[options, resolvedValue]
|
|
5008
5400
|
);
|
|
5009
5401
|
const resolvedInputValue = isInputControlled ? inputValueProp ?? "" : uncontrolledInputValue;
|
|
5010
5402
|
const normalizedFilter = resolvedInputValue.trim().toLowerCase();
|
|
5011
|
-
const filteredData =
|
|
5403
|
+
const filteredData = useMemo11(() => {
|
|
5012
5404
|
if (!normalizedFilter) {
|
|
5013
5405
|
return data;
|
|
5014
5406
|
}
|
|
@@ -5019,7 +5411,7 @@ function ComboBox({
|
|
|
5019
5411
|
)
|
|
5020
5412
|
})).filter((group) => group.items.length > 0);
|
|
5021
5413
|
}, [data, normalizedFilter]);
|
|
5022
|
-
const filteredOptions =
|
|
5414
|
+
const filteredOptions = useMemo11(
|
|
5023
5415
|
() => flattenComboBoxOptions(filteredData).filter(
|
|
5024
5416
|
(option) => !option.item.disabled
|
|
5025
5417
|
),
|
|
@@ -5027,7 +5419,7 @@ function ComboBox({
|
|
|
5027
5419
|
);
|
|
5028
5420
|
const popupRoot = typeof document === "undefined" ? null : resolveComboBoxPortalRoot();
|
|
5029
5421
|
const [themePortalStyle, setThemePortalStyle] = useState17(() => void 0);
|
|
5030
|
-
|
|
5422
|
+
useEffect9(() => {
|
|
5031
5423
|
if (!open) {
|
|
5032
5424
|
return;
|
|
5033
5425
|
}
|
|
@@ -5111,7 +5503,7 @@ function ComboBox({
|
|
|
5111
5503
|
ref: rootRef,
|
|
5112
5504
|
style: mergeSlotStyle(style, slotStyles?.root),
|
|
5113
5505
|
children: [
|
|
5114
|
-
/* @__PURE__ */
|
|
5506
|
+
/* @__PURE__ */ jsx38(
|
|
5115
5507
|
"label",
|
|
5116
5508
|
{
|
|
5117
5509
|
className: cx("nu-combo-box__label", slotClassNames?.label),
|
|
@@ -5134,7 +5526,7 @@ function ComboBox({
|
|
|
5134
5526
|
ref: fieldRef,
|
|
5135
5527
|
style: slotStyles?.field,
|
|
5136
5528
|
children: [
|
|
5137
|
-
/* @__PURE__ */
|
|
5529
|
+
/* @__PURE__ */ jsx38(
|
|
5138
5530
|
"span",
|
|
5139
5531
|
{
|
|
5140
5532
|
"aria-hidden": "true",
|
|
@@ -5143,7 +5535,7 @@ function ComboBox({
|
|
|
5143
5535
|
children: "["
|
|
5144
5536
|
}
|
|
5145
5537
|
),
|
|
5146
|
-
/* @__PURE__ */
|
|
5538
|
+
/* @__PURE__ */ jsx38(
|
|
5147
5539
|
"span",
|
|
5148
5540
|
{
|
|
5149
5541
|
className: cx(
|
|
@@ -5151,7 +5543,7 @@ function ComboBox({
|
|
|
5151
5543
|
slotClassNames?.inputShell
|
|
5152
5544
|
),
|
|
5153
5545
|
style: slotStyles?.inputShell,
|
|
5154
|
-
children: /* @__PURE__ */
|
|
5546
|
+
children: /* @__PURE__ */ jsx38(
|
|
5155
5547
|
"input",
|
|
5156
5548
|
{
|
|
5157
5549
|
"aria-autocomplete": "list",
|
|
@@ -5178,7 +5570,7 @@ function ComboBox({
|
|
|
5178
5570
|
)
|
|
5179
5571
|
}
|
|
5180
5572
|
),
|
|
5181
|
-
/* @__PURE__ */
|
|
5573
|
+
/* @__PURE__ */ jsx38(
|
|
5182
5574
|
"span",
|
|
5183
5575
|
{
|
|
5184
5576
|
"aria-hidden": "true",
|
|
@@ -5190,7 +5582,7 @@ function ComboBox({
|
|
|
5190
5582
|
]
|
|
5191
5583
|
}
|
|
5192
5584
|
),
|
|
5193
|
-
/* @__PURE__ */
|
|
5585
|
+
/* @__PURE__ */ jsx38(
|
|
5194
5586
|
ControlOpener,
|
|
5195
5587
|
{
|
|
5196
5588
|
"aria-label": open ? "Collapse list" : "Expand list",
|
|
@@ -5208,7 +5600,7 @@ function ComboBox({
|
|
|
5208
5600
|
]
|
|
5209
5601
|
}
|
|
5210
5602
|
),
|
|
5211
|
-
hint ? /* @__PURE__ */
|
|
5603
|
+
hint ? /* @__PURE__ */ jsx38(
|
|
5212
5604
|
"span",
|
|
5213
5605
|
{
|
|
5214
5606
|
className: cx("nu-combo-box__hint", slotClassNames?.hint),
|
|
@@ -5218,7 +5610,7 @@ function ComboBox({
|
|
|
5218
5610
|
}
|
|
5219
5611
|
) : null,
|
|
5220
5612
|
open && popupRoot ? createPortal3(
|
|
5221
|
-
/* @__PURE__ */
|
|
5613
|
+
/* @__PURE__ */ jsx38(
|
|
5222
5614
|
"div",
|
|
5223
5615
|
{
|
|
5224
5616
|
className: cx("nu-combo-box__popup", slotClassNames?.popup),
|
|
@@ -5228,12 +5620,12 @@ function ComboBox({
|
|
|
5228
5620
|
themePortalStyle,
|
|
5229
5621
|
slotStyles?.popup
|
|
5230
5622
|
),
|
|
5231
|
-
children: /* @__PURE__ */
|
|
5623
|
+
children: /* @__PURE__ */ jsx38(
|
|
5232
5624
|
"div",
|
|
5233
5625
|
{
|
|
5234
5626
|
className: cx("nu-combo-box__listbox", slotClassNames?.listbox),
|
|
5235
5627
|
style: slotStyles?.listbox,
|
|
5236
|
-
children: /* @__PURE__ */
|
|
5628
|
+
children: /* @__PURE__ */ jsx38(
|
|
5237
5629
|
ListBox,
|
|
5238
5630
|
{
|
|
5239
5631
|
data: filteredData,
|
|
@@ -5266,7 +5658,7 @@ function ComboBox({
|
|
|
5266
5658
|
import {
|
|
5267
5659
|
Fragment as Fragment6
|
|
5268
5660
|
} from "react";
|
|
5269
|
-
import { jsx as
|
|
5661
|
+
import { jsx as jsx39, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5270
5662
|
var COMMAND_BUTTON_GLYPH_NAMES = /* @__PURE__ */ new Set([
|
|
5271
5663
|
"check-fill",
|
|
5272
5664
|
"check-mark",
|
|
@@ -5307,7 +5699,7 @@ function CommandButton({
|
|
|
5307
5699
|
const hasMenu = menuItems.length > 0;
|
|
5308
5700
|
const showCaret = dropdown || hasMenu;
|
|
5309
5701
|
const resolvedToggled = toggled ?? pressed;
|
|
5310
|
-
const resolvedIcon = typeof icon === "string" && isCommandButtonGlyphName(icon) ? /* @__PURE__ */
|
|
5702
|
+
const resolvedIcon = typeof icon === "string" && isCommandButtonGlyphName(icon) ? /* @__PURE__ */ jsx39(NuGlyph, { name: icon }) : icon ?? null;
|
|
5311
5703
|
function handleClick(event) {
|
|
5312
5704
|
onClick?.(event);
|
|
5313
5705
|
if (event.defaultPrevented || !hasMenu) {
|
|
@@ -5332,7 +5724,7 @@ function CommandButton({
|
|
|
5332
5724
|
type,
|
|
5333
5725
|
onClick: handleClick,
|
|
5334
5726
|
children: [
|
|
5335
|
-
resolvedIcon ? /* @__PURE__ */
|
|
5727
|
+
resolvedIcon ? /* @__PURE__ */ jsx39(
|
|
5336
5728
|
"span",
|
|
5337
5729
|
{
|
|
5338
5730
|
className: cx(
|
|
@@ -5344,7 +5736,7 @@ function CommandButton({
|
|
|
5344
5736
|
children: resolvedIcon
|
|
5345
5737
|
}
|
|
5346
5738
|
) : null,
|
|
5347
|
-
children ? /* @__PURE__ */
|
|
5739
|
+
children ? /* @__PURE__ */ jsx39(
|
|
5348
5740
|
"span",
|
|
5349
5741
|
{
|
|
5350
5742
|
className: cx(
|
|
@@ -5356,7 +5748,7 @@ function CommandButton({
|
|
|
5356
5748
|
children: renderMnemonicNode(children)
|
|
5357
5749
|
}
|
|
5358
5750
|
) : null,
|
|
5359
|
-
showCaret ? /* @__PURE__ */
|
|
5751
|
+
showCaret ? /* @__PURE__ */ jsx39(
|
|
5360
5752
|
"span",
|
|
5361
5753
|
{
|
|
5362
5754
|
className: cx(
|
|
@@ -5365,13 +5757,13 @@ function CommandButton({
|
|
|
5365
5757
|
slotClassNames?.caret
|
|
5366
5758
|
),
|
|
5367
5759
|
style: slotStyles?.caret,
|
|
5368
|
-
children: /* @__PURE__ */
|
|
5760
|
+
children: /* @__PURE__ */ jsx39(NuGlyph, { name: "dropdown-arrow" })
|
|
5369
5761
|
}
|
|
5370
5762
|
) : null
|
|
5371
5763
|
]
|
|
5372
5764
|
}
|
|
5373
5765
|
),
|
|
5374
|
-
hasMenu ? /* @__PURE__ */
|
|
5766
|
+
hasMenu ? /* @__PURE__ */ jsx39(
|
|
5375
5767
|
PopupMenu,
|
|
5376
5768
|
{
|
|
5377
5769
|
anchor: popupMenu.anchor,
|
|
@@ -5386,8 +5778,8 @@ function CommandButton({
|
|
|
5386
5778
|
}
|
|
5387
5779
|
|
|
5388
5780
|
// src/components/CrtGlitch/CrtGlitch.tsx
|
|
5389
|
-
import { useEffect as
|
|
5390
|
-
import { jsx as
|
|
5781
|
+
import { useEffect as useEffect10, useId as useId6, useRef as useRef13 } from "react";
|
|
5782
|
+
import { jsx as jsx40, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5391
5783
|
var DEFAULT_INTERVAL_MS = 3e3;
|
|
5392
5784
|
var DEFAULT_DURATION_MS = 2500;
|
|
5393
5785
|
var DEFAULT_TOP_LEVEL_RATIO = 1 / 3;
|
|
@@ -5413,13 +5805,13 @@ function NuCrtGlitch({
|
|
|
5413
5805
|
topLevelRatio = DEFAULT_TOP_LEVEL_RATIO
|
|
5414
5806
|
}) {
|
|
5415
5807
|
const filterId = useId6().replace(/:/g, "");
|
|
5416
|
-
const turbulenceRef =
|
|
5417
|
-
const warpRef =
|
|
5418
|
-
const rOffsetRef =
|
|
5419
|
-
const bOffsetRef =
|
|
5420
|
-
const rafRef =
|
|
5421
|
-
const targetElRef =
|
|
5422
|
-
|
|
5808
|
+
const turbulenceRef = useRef13(null);
|
|
5809
|
+
const warpRef = useRef13(null);
|
|
5810
|
+
const rOffsetRef = useRef13(null);
|
|
5811
|
+
const bOffsetRef = useRef13(null);
|
|
5812
|
+
const rafRef = useRef13(null);
|
|
5813
|
+
const targetElRef = useRef13(null);
|
|
5814
|
+
useEffect10(() => {
|
|
5423
5815
|
if (!enabled) {
|
|
5424
5816
|
return;
|
|
5425
5817
|
}
|
|
@@ -5521,7 +5913,7 @@ function NuCrtGlitch({
|
|
|
5521
5913
|
}
|
|
5522
5914
|
};
|
|
5523
5915
|
}, [durationMs, enabled, filterId, intervalMs, targetSelector, topLevelRatio]);
|
|
5524
|
-
return /* @__PURE__ */
|
|
5916
|
+
return /* @__PURE__ */ jsx40("svg", { "aria-hidden": "true", height: "0", style: { position: "absolute" }, width: "0", children: /* @__PURE__ */ jsx40("defs", { children: /* @__PURE__ */ jsxs23(
|
|
5525
5917
|
"filter",
|
|
5526
5918
|
{
|
|
5527
5919
|
"color-interpolation-filters": "sRGB",
|
|
@@ -5531,7 +5923,7 @@ function NuCrtGlitch({
|
|
|
5531
5923
|
x: "-15%",
|
|
5532
5924
|
y: "-5%",
|
|
5533
5925
|
children: [
|
|
5534
|
-
/* @__PURE__ */
|
|
5926
|
+
/* @__PURE__ */ jsx40(
|
|
5535
5927
|
"feTurbulence",
|
|
5536
5928
|
{
|
|
5537
5929
|
baseFrequency: "0.001 0.045",
|
|
@@ -5542,7 +5934,7 @@ function NuCrtGlitch({
|
|
|
5542
5934
|
type: "turbulence"
|
|
5543
5935
|
}
|
|
5544
5936
|
),
|
|
5545
|
-
/* @__PURE__ */
|
|
5937
|
+
/* @__PURE__ */ jsx40(
|
|
5546
5938
|
"feDisplacementMap",
|
|
5547
5939
|
{
|
|
5548
5940
|
in: "SourceGraphic",
|
|
@@ -5554,8 +5946,8 @@ function NuCrtGlitch({
|
|
|
5554
5946
|
yChannelSelector: "A"
|
|
5555
5947
|
}
|
|
5556
5948
|
),
|
|
5557
|
-
/* @__PURE__ */
|
|
5558
|
-
/* @__PURE__ */
|
|
5949
|
+
/* @__PURE__ */ jsx40("feOffset", { dx: 0, dy: 0, in: "warped", ref: rOffsetRef, result: "rOff" }),
|
|
5950
|
+
/* @__PURE__ */ jsx40(
|
|
5559
5951
|
"feColorMatrix",
|
|
5560
5952
|
{
|
|
5561
5953
|
in: "rOff",
|
|
@@ -5564,7 +5956,7 @@ function NuCrtGlitch({
|
|
|
5564
5956
|
values: "1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0"
|
|
5565
5957
|
}
|
|
5566
5958
|
),
|
|
5567
|
-
/* @__PURE__ */
|
|
5959
|
+
/* @__PURE__ */ jsx40(
|
|
5568
5960
|
"feColorMatrix",
|
|
5569
5961
|
{
|
|
5570
5962
|
in: "warped",
|
|
@@ -5573,8 +5965,8 @@ function NuCrtGlitch({
|
|
|
5573
5965
|
values: "0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0"
|
|
5574
5966
|
}
|
|
5575
5967
|
),
|
|
5576
|
-
/* @__PURE__ */
|
|
5577
|
-
/* @__PURE__ */
|
|
5968
|
+
/* @__PURE__ */ jsx40("feOffset", { dx: 0, dy: 0, in: "warped", ref: bOffsetRef, result: "bOff" }),
|
|
5969
|
+
/* @__PURE__ */ jsx40(
|
|
5578
5970
|
"feColorMatrix",
|
|
5579
5971
|
{
|
|
5580
5972
|
in: "bOff",
|
|
@@ -5583,8 +5975,8 @@ function NuCrtGlitch({
|
|
|
5583
5975
|
values: "0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0"
|
|
5584
5976
|
}
|
|
5585
5977
|
),
|
|
5586
|
-
/* @__PURE__ */
|
|
5587
|
-
/* @__PURE__ */
|
|
5978
|
+
/* @__PURE__ */ jsx40("feBlend", { in: "rOnly", in2: "gOnly", mode: "screen", result: "rg" }),
|
|
5979
|
+
/* @__PURE__ */ jsx40("feBlend", { in: "rg", in2: "bOnly", mode: "screen" })
|
|
5588
5980
|
]
|
|
5589
5981
|
}
|
|
5590
5982
|
) }) });
|
|
@@ -5594,10 +5986,10 @@ function NuCrtGlitch({
|
|
|
5594
5986
|
import {
|
|
5595
5987
|
forwardRef as forwardRef2,
|
|
5596
5988
|
useCallback as useCallback6,
|
|
5597
|
-
useEffect as
|
|
5989
|
+
useEffect as useEffect11,
|
|
5598
5990
|
useImperativeHandle as useImperativeHandle2,
|
|
5599
|
-
useMemo as
|
|
5600
|
-
useRef as
|
|
5991
|
+
useMemo as useMemo12,
|
|
5992
|
+
useRef as useRef14,
|
|
5601
5993
|
useState as useState18
|
|
5602
5994
|
} from "react";
|
|
5603
5995
|
|
|
@@ -5636,14 +6028,14 @@ function renderListViewCellValue(row, column) {
|
|
|
5636
6028
|
import { memo as memo3 } from "react";
|
|
5637
6029
|
|
|
5638
6030
|
// src/components/ListView/internals/ListViewCheckControl.tsx
|
|
5639
|
-
import { jsx as
|
|
6031
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
5640
6032
|
function ListViewCheckControl({
|
|
5641
6033
|
isChecked,
|
|
5642
6034
|
onActivate,
|
|
5643
6035
|
onToggleCheck,
|
|
5644
6036
|
uncheckedShape
|
|
5645
6037
|
}) {
|
|
5646
|
-
return /* @__PURE__ */
|
|
6038
|
+
return /* @__PURE__ */ jsx41(
|
|
5647
6039
|
"button",
|
|
5648
6040
|
{
|
|
5649
6041
|
"aria-label": isChecked ? "Uncheck row" : "Check row",
|
|
@@ -5656,13 +6048,13 @@ function ListViewCheckControl({
|
|
|
5656
6048
|
onToggleCheck();
|
|
5657
6049
|
},
|
|
5658
6050
|
type: "button",
|
|
5659
|
-
children: /* @__PURE__ */
|
|
6051
|
+
children: /* @__PURE__ */ jsx41(
|
|
5660
6052
|
"span",
|
|
5661
6053
|
{
|
|
5662
6054
|
"aria-hidden": "true",
|
|
5663
6055
|
className: "nu-list-view__check-box",
|
|
5664
6056
|
"data-unchecked-shape": uncheckedShape,
|
|
5665
|
-
children: isChecked ? /* @__PURE__ */
|
|
6057
|
+
children: isChecked ? /* @__PURE__ */ jsx41(
|
|
5666
6058
|
NuGlyph,
|
|
5667
6059
|
{
|
|
5668
6060
|
className: "nu-list-view__check-indicator",
|
|
@@ -5676,7 +6068,7 @@ function ListViewCheckControl({
|
|
|
5676
6068
|
}
|
|
5677
6069
|
|
|
5678
6070
|
// src/components/ListView/internals/ListViewRow.tsx
|
|
5679
|
-
import { jsx as
|
|
6071
|
+
import { jsx as jsx42, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5680
6072
|
function ListViewRowInner({
|
|
5681
6073
|
columns,
|
|
5682
6074
|
isActive,
|
|
@@ -5728,7 +6120,7 @@ function ListViewRowInner({
|
|
|
5728
6120
|
"--nu-list-view-columns": templateColumns
|
|
5729
6121
|
},
|
|
5730
6122
|
children: [
|
|
5731
|
-
showCheckBox ? /* @__PURE__ */
|
|
6123
|
+
showCheckBox ? /* @__PURE__ */ jsx42("span", { className: "nu-list-view__check-cell", role: "gridcell", children: /* @__PURE__ */ jsx42(
|
|
5732
6124
|
ListViewCheckControl,
|
|
5733
6125
|
{
|
|
5734
6126
|
isChecked,
|
|
@@ -5737,7 +6129,7 @@ function ListViewRowInner({
|
|
|
5737
6129
|
uncheckedShape
|
|
5738
6130
|
}
|
|
5739
6131
|
) }) : null,
|
|
5740
|
-
columns.map((column) => /* @__PURE__ */
|
|
6132
|
+
columns.map((column) => /* @__PURE__ */ jsx42(
|
|
5741
6133
|
"span",
|
|
5742
6134
|
{
|
|
5743
6135
|
className: [
|
|
@@ -5757,7 +6149,7 @@ function ListViewRowInner({
|
|
|
5757
6149
|
var ListViewRow = memo3(ListViewRowInner);
|
|
5758
6150
|
|
|
5759
6151
|
// src/components/ListView/ListView.tsx
|
|
5760
|
-
import { jsx as
|
|
6152
|
+
import { jsx as jsx43, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5761
6153
|
function ListViewInner({
|
|
5762
6154
|
activeRowId: activeRowIdProp,
|
|
5763
6155
|
checkedIds,
|
|
@@ -5775,9 +6167,9 @@ function ListViewInner({
|
|
|
5775
6167
|
uncheckedShape = "box",
|
|
5776
6168
|
...props
|
|
5777
6169
|
}, ref) {
|
|
5778
|
-
const rootRef =
|
|
5779
|
-
const rowRefs =
|
|
5780
|
-
const selectableRows =
|
|
6170
|
+
const rootRef = useRef14(null);
|
|
6171
|
+
const rowRefs = useRef14({});
|
|
6172
|
+
const selectableRows = useMemo12(
|
|
5781
6173
|
() => data.filter((row) => !row.disabled),
|
|
5782
6174
|
[data]
|
|
5783
6175
|
);
|
|
@@ -5787,14 +6179,14 @@ function ListViewInner({
|
|
|
5787
6179
|
);
|
|
5788
6180
|
const activeRowId = activeRowIdProp !== void 0 ? activeRowIdProp : uncontrolledActiveRowId;
|
|
5789
6181
|
const resolvedActiveRowId = activeRowId && selectableRows.some((row) => row.id === activeRowId) ? activeRowId : getInitialActiveRowId(selectableRows, selectedId);
|
|
5790
|
-
const templateColumns =
|
|
6182
|
+
const templateColumns = useMemo12(() => {
|
|
5791
6183
|
const checkboxColumn = showCheckBox ? "var(--nu-glyph-cell-size)" : null;
|
|
5792
6184
|
const dataColumns = columns.map(
|
|
5793
6185
|
(column) => column.width ?? "minmax(0, 1fr)"
|
|
5794
6186
|
);
|
|
5795
6187
|
return [checkboxColumn, ...dataColumns].filter(Boolean).join(" ");
|
|
5796
6188
|
}, [columns, showCheckBox]);
|
|
5797
|
-
|
|
6189
|
+
useEffect11(() => {
|
|
5798
6190
|
if (!resolvedActiveRowId) {
|
|
5799
6191
|
return;
|
|
5800
6192
|
}
|
|
@@ -5945,8 +6337,8 @@ function ListViewInner({
|
|
|
5945
6337
|
"--nu-list-view-columns": templateColumns
|
|
5946
6338
|
},
|
|
5947
6339
|
children: [
|
|
5948
|
-
showCheckBox ? /* @__PURE__ */
|
|
5949
|
-
columns.map((column) => /* @__PURE__ */
|
|
6340
|
+
showCheckBox ? /* @__PURE__ */ jsx43("span", { className: "nu-list-view__header-cell", role: "columnheader" }) : null,
|
|
6341
|
+
columns.map((column) => /* @__PURE__ */ jsx43(
|
|
5950
6342
|
"span",
|
|
5951
6343
|
{
|
|
5952
6344
|
className: [
|
|
@@ -5962,7 +6354,7 @@ function ListViewInner({
|
|
|
5962
6354
|
]
|
|
5963
6355
|
}
|
|
5964
6356
|
),
|
|
5965
|
-
/* @__PURE__ */
|
|
6357
|
+
/* @__PURE__ */ jsx43("div", { className: "nu-list-view__body", children: data.length > 0 ? data.map((row) => /* @__PURE__ */ jsx43(
|
|
5966
6358
|
ListViewRow,
|
|
5967
6359
|
{
|
|
5968
6360
|
columns,
|
|
@@ -5979,7 +6371,7 @@ function ListViewInner({
|
|
|
5979
6371
|
uncheckedShape
|
|
5980
6372
|
},
|
|
5981
6373
|
row.id
|
|
5982
|
-
)) : /* @__PURE__ */
|
|
6374
|
+
)) : /* @__PURE__ */ jsx43("div", { className: "nu-list-view__empty", children: emptyText }) })
|
|
5983
6375
|
]
|
|
5984
6376
|
}
|
|
5985
6377
|
);
|
|
@@ -5988,10 +6380,10 @@ var ListView = forwardRef2(ListViewInner);
|
|
|
5988
6380
|
|
|
5989
6381
|
// src/components/MaskedField/MaskedField.tsx
|
|
5990
6382
|
import {
|
|
5991
|
-
useEffect as
|
|
6383
|
+
useEffect as useEffect12,
|
|
5992
6384
|
useId as useId7,
|
|
5993
|
-
useMemo as
|
|
5994
|
-
useRef as
|
|
6385
|
+
useMemo as useMemo13,
|
|
6386
|
+
useRef as useRef15,
|
|
5995
6387
|
useState as useState19
|
|
5996
6388
|
} from "react";
|
|
5997
6389
|
|
|
@@ -6157,7 +6549,7 @@ function getMaskedFieldState(mask, rawValue) {
|
|
|
6157
6549
|
}
|
|
6158
6550
|
|
|
6159
6551
|
// src/components/MaskedField/MaskedField.tsx
|
|
6160
|
-
import { jsx as
|
|
6552
|
+
import { jsx as jsx44, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
6161
6553
|
function MaskedField({
|
|
6162
6554
|
"aria-invalid": ariaInvalid,
|
|
6163
6555
|
className,
|
|
@@ -6180,7 +6572,7 @@ function MaskedField({
|
|
|
6180
6572
|
const fieldId = id ?? generatedId;
|
|
6181
6573
|
const hintId = hint ? `${fieldId}-hint` : void 0;
|
|
6182
6574
|
const isControlled = value !== void 0;
|
|
6183
|
-
const hasMountedRef =
|
|
6575
|
+
const hasMountedRef = useRef15(false);
|
|
6184
6576
|
const [uncontrolledValue, setUncontrolledValue] = useState19(
|
|
6185
6577
|
() => defaultValue == null ? "" : getMaskedFieldState(mask, String(defaultValue)).formattedValue
|
|
6186
6578
|
);
|
|
@@ -6190,11 +6582,11 @@ function MaskedField({
|
|
|
6190
6582
|
rawResolvedValue
|
|
6191
6583
|
);
|
|
6192
6584
|
const resolvedAriaInvalid = ariaInvalid ?? (isInvalid ? true : void 0);
|
|
6193
|
-
const maskInputMode =
|
|
6585
|
+
const maskInputMode = useMemo13(
|
|
6194
6586
|
() => props.inputMode === void 0 ? getTextMaskInputMode(mask) : void 0,
|
|
6195
6587
|
[mask, props.inputMode]
|
|
6196
6588
|
);
|
|
6197
|
-
|
|
6589
|
+
useEffect12(() => {
|
|
6198
6590
|
if (!onDebouncedChange) {
|
|
6199
6591
|
return;
|
|
6200
6592
|
}
|
|
@@ -6241,7 +6633,7 @@ function MaskedField({
|
|
|
6241
6633
|
htmlFor: fieldId,
|
|
6242
6634
|
style: mergeSlotStyle(style, slotStyles?.root),
|
|
6243
6635
|
children: [
|
|
6244
|
-
/* @__PURE__ */
|
|
6636
|
+
/* @__PURE__ */ jsx44(
|
|
6245
6637
|
"span",
|
|
6246
6638
|
{
|
|
6247
6639
|
className: cx("nu-masked-field__label", slotClassNames?.label),
|
|
@@ -6255,7 +6647,7 @@ function MaskedField({
|
|
|
6255
6647
|
className: cx("nu-masked-field__slot", slotClassNames?.slot),
|
|
6256
6648
|
style: slotStyles?.slot,
|
|
6257
6649
|
children: [
|
|
6258
|
-
/* @__PURE__ */
|
|
6650
|
+
/* @__PURE__ */ jsx44(
|
|
6259
6651
|
"span",
|
|
6260
6652
|
{
|
|
6261
6653
|
"aria-hidden": "true",
|
|
@@ -6264,7 +6656,7 @@ function MaskedField({
|
|
|
6264
6656
|
children: "["
|
|
6265
6657
|
}
|
|
6266
6658
|
),
|
|
6267
|
-
/* @__PURE__ */
|
|
6659
|
+
/* @__PURE__ */ jsx44(
|
|
6268
6660
|
"span",
|
|
6269
6661
|
{
|
|
6270
6662
|
className: cx(
|
|
@@ -6272,7 +6664,7 @@ function MaskedField({
|
|
|
6272
6664
|
slotClassNames?.inputShell
|
|
6273
6665
|
),
|
|
6274
6666
|
style: slotStyles?.inputShell,
|
|
6275
|
-
children: /* @__PURE__ */
|
|
6667
|
+
children: /* @__PURE__ */ jsx44(
|
|
6276
6668
|
"input",
|
|
6277
6669
|
{
|
|
6278
6670
|
...props,
|
|
@@ -6290,7 +6682,7 @@ function MaskedField({
|
|
|
6290
6682
|
)
|
|
6291
6683
|
}
|
|
6292
6684
|
),
|
|
6293
|
-
/* @__PURE__ */
|
|
6685
|
+
/* @__PURE__ */ jsx44(
|
|
6294
6686
|
"span",
|
|
6295
6687
|
{
|
|
6296
6688
|
"aria-hidden": "true",
|
|
@@ -6302,7 +6694,7 @@ function MaskedField({
|
|
|
6302
6694
|
]
|
|
6303
6695
|
}
|
|
6304
6696
|
),
|
|
6305
|
-
hint ? /* @__PURE__ */
|
|
6697
|
+
hint ? /* @__PURE__ */ jsx44(
|
|
6306
6698
|
"span",
|
|
6307
6699
|
{
|
|
6308
6700
|
className: cx("nu-masked-field__hint", slotClassNames?.hint),
|
|
@@ -6320,7 +6712,7 @@ function MaskedField({
|
|
|
6320
6712
|
import {
|
|
6321
6713
|
useState as useState20
|
|
6322
6714
|
} from "react";
|
|
6323
|
-
import { jsx as
|
|
6715
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
6324
6716
|
function Memo({
|
|
6325
6717
|
background,
|
|
6326
6718
|
className,
|
|
@@ -6350,7 +6742,7 @@ function Memo({
|
|
|
6350
6742
|
onValueChange?.(event.target.value);
|
|
6351
6743
|
onChange?.(event);
|
|
6352
6744
|
}
|
|
6353
|
-
return /* @__PURE__ */
|
|
6745
|
+
return /* @__PURE__ */ jsx45(
|
|
6354
6746
|
"div",
|
|
6355
6747
|
{
|
|
6356
6748
|
className: ["nu-memo", className].filter(Boolean).join(" "),
|
|
@@ -6363,7 +6755,7 @@ function Memo({
|
|
|
6363
6755
|
"--nu-memo-focus-text": focusTextColor,
|
|
6364
6756
|
"--nu-memo-text": textColor
|
|
6365
6757
|
},
|
|
6366
|
-
children: /* @__PURE__ */
|
|
6758
|
+
children: /* @__PURE__ */ jsx45("div", { className: "nu-memo__viewport", children: /* @__PURE__ */ jsx45(
|
|
6367
6759
|
"textarea",
|
|
6368
6760
|
{
|
|
6369
6761
|
...props,
|
|
@@ -6379,11 +6771,11 @@ function Memo({
|
|
|
6379
6771
|
// src/components/PageControl/PageControl.tsx
|
|
6380
6772
|
import {
|
|
6381
6773
|
useId as useId8,
|
|
6382
|
-
useMemo as
|
|
6383
|
-
useRef as
|
|
6774
|
+
useMemo as useMemo14,
|
|
6775
|
+
useRef as useRef16,
|
|
6384
6776
|
useState as useState21
|
|
6385
6777
|
} from "react";
|
|
6386
|
-
import { jsx as
|
|
6778
|
+
import { jsx as jsx46, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6387
6779
|
function PageControl({
|
|
6388
6780
|
activePageId: activePageIdProp,
|
|
6389
6781
|
className,
|
|
@@ -6397,12 +6789,12 @@ function PageControl({
|
|
|
6397
6789
|
}) {
|
|
6398
6790
|
const generatedId = useId8();
|
|
6399
6791
|
const isControlled = activePageIdProp !== void 0;
|
|
6400
|
-
const tabRefs =
|
|
6792
|
+
const tabRefs = useRef16({});
|
|
6401
6793
|
const [uncontrolledActivePageId, setUncontrolledActivePageId] = useState21(
|
|
6402
6794
|
() => defaultActivePageId ?? pages.find((page) => !page.disabled)?.id ?? pages[0]?.id
|
|
6403
6795
|
);
|
|
6404
6796
|
const activePageId = isControlled ? activePageIdProp : uncontrolledActivePageId;
|
|
6405
|
-
const resolvedActivePage =
|
|
6797
|
+
const resolvedActivePage = useMemo14(() => {
|
|
6406
6798
|
const byId = pages.find(
|
|
6407
6799
|
(page) => page.id === activePageId && !page.disabled
|
|
6408
6800
|
);
|
|
@@ -6479,7 +6871,7 @@ function PageControl({
|
|
|
6479
6871
|
slotStyles?.root
|
|
6480
6872
|
),
|
|
6481
6873
|
children: [
|
|
6482
|
-
/* @__PURE__ */
|
|
6874
|
+
/* @__PURE__ */ jsx46(
|
|
6483
6875
|
"div",
|
|
6484
6876
|
{
|
|
6485
6877
|
className: cx("nu-page-control__tabs", slotClassNames?.tabs),
|
|
@@ -6490,7 +6882,7 @@ function PageControl({
|
|
|
6490
6882
|
const isActive = page.id === resolvedActivePage?.id;
|
|
6491
6883
|
const panelId = `${generatedId}-panel-${page.id}`;
|
|
6492
6884
|
const tabId = `${generatedId}-tab-${page.id}`;
|
|
6493
|
-
return /* @__PURE__ */
|
|
6885
|
+
return /* @__PURE__ */ jsx46(
|
|
6494
6886
|
"button",
|
|
6495
6887
|
{
|
|
6496
6888
|
"aria-controls": panelId,
|
|
@@ -6514,7 +6906,7 @@ function PageControl({
|
|
|
6514
6906
|
})
|
|
6515
6907
|
}
|
|
6516
6908
|
),
|
|
6517
|
-
/* @__PURE__ */
|
|
6909
|
+
/* @__PURE__ */ jsx46(
|
|
6518
6910
|
"div",
|
|
6519
6911
|
{
|
|
6520
6912
|
"aria-labelledby": resolvedActivePage ? `${generatedId}-tab-${resolvedActivePage.id}` : void 0,
|
|
@@ -6531,7 +6923,7 @@ function PageControl({
|
|
|
6531
6923
|
}
|
|
6532
6924
|
|
|
6533
6925
|
// src/components/Panel/Panel.tsx
|
|
6534
|
-
import { jsx as
|
|
6926
|
+
import { jsx as jsx47, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6535
6927
|
function Panel({
|
|
6536
6928
|
children,
|
|
6537
6929
|
className,
|
|
@@ -6549,7 +6941,7 @@ function Panel({
|
|
|
6549
6941
|
className: cx("nu-panel", slotClassNames?.root, className),
|
|
6550
6942
|
style: mergeSlotStyle(props.style, slotStyles?.root),
|
|
6551
6943
|
children: [
|
|
6552
|
-
title ? /* @__PURE__ */
|
|
6944
|
+
title ? /* @__PURE__ */ jsx47(
|
|
6553
6945
|
"header",
|
|
6554
6946
|
{
|
|
6555
6947
|
className: cx("nu-panel__header", slotClassNames?.header),
|
|
@@ -6557,7 +6949,7 @@ function Panel({
|
|
|
6557
6949
|
children: renderMnemonicText(title)
|
|
6558
6950
|
}
|
|
6559
6951
|
) : null,
|
|
6560
|
-
/* @__PURE__ */
|
|
6952
|
+
/* @__PURE__ */ jsx47(
|
|
6561
6953
|
"div",
|
|
6562
6954
|
{
|
|
6563
6955
|
className: cx(
|
|
@@ -6569,7 +6961,7 @@ function Panel({
|
|
|
6569
6961
|
children
|
|
6570
6962
|
}
|
|
6571
6963
|
),
|
|
6572
|
-
footer ? /* @__PURE__ */
|
|
6964
|
+
footer ? /* @__PURE__ */ jsx47(
|
|
6573
6965
|
"footer",
|
|
6574
6966
|
{
|
|
6575
6967
|
className: cx("nu-panel__footer", slotClassNames?.footer),
|
|
@@ -6585,11 +6977,11 @@ function Panel({
|
|
|
6585
6977
|
// src/components/PropertyGrid/PropertyGrid.tsx
|
|
6586
6978
|
import {
|
|
6587
6979
|
useId as useId9,
|
|
6588
|
-
useMemo as
|
|
6589
|
-
useRef as
|
|
6980
|
+
useMemo as useMemo15,
|
|
6981
|
+
useRef as useRef17,
|
|
6590
6982
|
useState as useState22
|
|
6591
6983
|
} from "react";
|
|
6592
|
-
import { jsx as
|
|
6984
|
+
import { jsx as jsx48, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6593
6985
|
function collectGroupIds(entries) {
|
|
6594
6986
|
const groupIds = /* @__PURE__ */ new Set();
|
|
6595
6987
|
function visit(nextEntries) {
|
|
@@ -6697,23 +7089,23 @@ function PropertyGrid({
|
|
|
6697
7089
|
...props
|
|
6698
7090
|
}) {
|
|
6699
7091
|
const editorIdPrefix = useId9();
|
|
6700
|
-
const rowButtonRefs =
|
|
6701
|
-
const groupIds =
|
|
7092
|
+
const rowButtonRefs = useRef17({});
|
|
7093
|
+
const groupIds = useMemo15(() => collectGroupIds(entries), [entries]);
|
|
6702
7094
|
const isExpandedControlled = expandedIdsProp !== void 0;
|
|
6703
7095
|
const isActiveControlled = activeIdProp !== void 0;
|
|
6704
7096
|
const [uncontrolledExpandedIds, setUncontrolledExpandedIds] = useState22(() => getInitialExpandedIds(entries, defaultExpandedIds));
|
|
6705
7097
|
const resolvedExpandedIds = expandedIdsProp ?? uncontrolledExpandedIds;
|
|
6706
|
-
const expandedIdSet =
|
|
7098
|
+
const expandedIdSet = useMemo15(
|
|
6707
7099
|
() => new Set(
|
|
6708
7100
|
resolvedExpandedIds.filter((expandedId) => groupIds.has(expandedId))
|
|
6709
7101
|
),
|
|
6710
7102
|
[groupIds, resolvedExpandedIds]
|
|
6711
7103
|
);
|
|
6712
|
-
const rows =
|
|
7104
|
+
const rows = useMemo15(
|
|
6713
7105
|
() => collectVisibleRows(entries, expandedIdSet),
|
|
6714
7106
|
[entries, expandedIdSet]
|
|
6715
7107
|
);
|
|
6716
|
-
const interactiveRows =
|
|
7108
|
+
const interactiveRows = useMemo15(() => collectInteractiveRows(rows), [rows]);
|
|
6717
7109
|
const [uncontrolledActiveId, setUncontrolledActiveId] = useState22(() => getInitialActiveId2(interactiveRows, defaultActiveId));
|
|
6718
7110
|
const requestedActiveId = isActiveControlled ? activeIdProp : uncontrolledActiveId;
|
|
6719
7111
|
const resolvedActiveId = requestedActiveId && interactiveRows.some((row) => row.id === requestedActiveId) ? requestedActiveId : interactiveRows[0]?.id;
|
|
@@ -6833,7 +7225,7 @@ function PropertyGrid({
|
|
|
6833
7225
|
const nextExpandedIds = expandedIdSet.has(entry.id) ? resolvedExpandedIds.filter((expandedId) => expandedId !== entry.id) : [...resolvedExpandedIds, entry.id];
|
|
6834
7226
|
updateExpandedIds(nextExpandedIds);
|
|
6835
7227
|
}
|
|
6836
|
-
return /* @__PURE__ */
|
|
7228
|
+
return /* @__PURE__ */ jsx48(
|
|
6837
7229
|
"div",
|
|
6838
7230
|
{
|
|
6839
7231
|
...props,
|
|
@@ -6844,9 +7236,9 @@ function PropertyGrid({
|
|
|
6844
7236
|
...style,
|
|
6845
7237
|
"--nu-property-grid-label-width": labelWidth
|
|
6846
7238
|
},
|
|
6847
|
-
children: /* @__PURE__ */
|
|
7239
|
+
children: /* @__PURE__ */ jsx48("div", { className: "nu-property-grid__body", children: rows.map((row) => {
|
|
6848
7240
|
if (row.type === "section") {
|
|
6849
|
-
return /* @__PURE__ */
|
|
7241
|
+
return /* @__PURE__ */ jsx48("div", { className: "nu-property-grid__section", children: renderMnemonicText(row.entry.title) }, row.entry.id);
|
|
6850
7242
|
}
|
|
6851
7243
|
if (row.type === "group") {
|
|
6852
7244
|
const isExpanded = expandedIdSet.has(row.entry.id);
|
|
@@ -6859,7 +7251,7 @@ function PropertyGrid({
|
|
|
6859
7251
|
"data-expanded": isExpanded || void 0,
|
|
6860
7252
|
"data-group": true,
|
|
6861
7253
|
children: [
|
|
6862
|
-
/* @__PURE__ */
|
|
7254
|
+
/* @__PURE__ */ jsx48(
|
|
6863
7255
|
"button",
|
|
6864
7256
|
{
|
|
6865
7257
|
className: "nu-property-grid__label nu-property-grid__label-button",
|
|
@@ -6880,17 +7272,17 @@ function PropertyGrid({
|
|
|
6880
7272
|
},
|
|
6881
7273
|
type: "button",
|
|
6882
7274
|
children: /* @__PURE__ */ jsxs29("span", { className: "nu-property-grid__lead", children: [
|
|
6883
|
-
/* @__PURE__ */
|
|
7275
|
+
/* @__PURE__ */ jsx48("span", { className: "nu-property-grid__expander", children: /* @__PURE__ */ jsx48(
|
|
6884
7276
|
NuGlyph,
|
|
6885
7277
|
{
|
|
6886
7278
|
name: isExpanded ? "tree-caret-down" : "tree-caret-right"
|
|
6887
7279
|
}
|
|
6888
7280
|
) }),
|
|
6889
|
-
/* @__PURE__ */
|
|
7281
|
+
/* @__PURE__ */ jsx48("span", { className: "nu-property-grid__label-text", children: renderMnemonicText(row.entry.label) })
|
|
6890
7282
|
] })
|
|
6891
7283
|
}
|
|
6892
7284
|
),
|
|
6893
|
-
/* @__PURE__ */
|
|
7285
|
+
/* @__PURE__ */ jsx48("div", { className: "nu-property-grid__editor", children: row.entry.summary ? /* @__PURE__ */ jsx48("div", { className: "nu-property-grid__control", children: row.entry.summary }) : null })
|
|
6894
7286
|
]
|
|
6895
7287
|
},
|
|
6896
7288
|
row.entry.id
|
|
@@ -6904,7 +7296,7 @@ function PropertyGrid({
|
|
|
6904
7296
|
"data-active": resolvedActiveId === row.entry.id || void 0,
|
|
6905
7297
|
"data-disabled": row.entry.disabled || void 0,
|
|
6906
7298
|
children: [
|
|
6907
|
-
/* @__PURE__ */
|
|
7299
|
+
/* @__PURE__ */ jsx48(
|
|
6908
7300
|
"button",
|
|
6909
7301
|
{
|
|
6910
7302
|
className: "nu-property-grid__label nu-property-grid__label-button",
|
|
@@ -6925,8 +7317,8 @@ function PropertyGrid({
|
|
|
6925
7317
|
},
|
|
6926
7318
|
type: "button",
|
|
6927
7319
|
children: /* @__PURE__ */ jsxs29("span", { className: "nu-property-grid__lead", children: [
|
|
6928
|
-
/* @__PURE__ */
|
|
6929
|
-
/* @__PURE__ */
|
|
7320
|
+
/* @__PURE__ */ jsx48("span", { className: "nu-property-grid__expander-placeholder" }),
|
|
7321
|
+
/* @__PURE__ */ jsx48("span", { className: "nu-property-grid__label-text", children: renderMnemonicText(row.entry.label) })
|
|
6930
7322
|
] })
|
|
6931
7323
|
}
|
|
6932
7324
|
),
|
|
@@ -6937,8 +7329,8 @@ function PropertyGrid({
|
|
|
6937
7329
|
id: editorId,
|
|
6938
7330
|
onFocusCapture: () => updateActiveId(row.entry.id),
|
|
6939
7331
|
children: [
|
|
6940
|
-
/* @__PURE__ */
|
|
6941
|
-
row.entry.hint ? /* @__PURE__ */
|
|
7332
|
+
/* @__PURE__ */ jsx48("div", { className: "nu-property-grid__control", children: row.entry.content }),
|
|
7333
|
+
row.entry.hint ? /* @__PURE__ */ jsx48("div", { className: "nu-property-grid__hint", children: row.entry.hint }) : null
|
|
6942
7334
|
]
|
|
6943
7335
|
}
|
|
6944
7336
|
)
|
|
@@ -6952,7 +7344,7 @@ function PropertyGrid({
|
|
|
6952
7344
|
}
|
|
6953
7345
|
|
|
6954
7346
|
// src/components/ProgressBar/ProgressBar.tsx
|
|
6955
|
-
import { jsx as
|
|
7347
|
+
import { jsx as jsx49, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
6956
7348
|
function clamp3(value, min, max) {
|
|
6957
7349
|
return Math.min(max, Math.max(min, value));
|
|
6958
7350
|
}
|
|
@@ -6988,7 +7380,7 @@ function ProgressBar({
|
|
|
6988
7380
|
role: "progressbar",
|
|
6989
7381
|
style: mergeSlotStyle(style, slotStyles?.root),
|
|
6990
7382
|
children: [
|
|
6991
|
-
label ? /* @__PURE__ */
|
|
7383
|
+
label ? /* @__PURE__ */ jsx49(
|
|
6992
7384
|
"span",
|
|
6993
7385
|
{
|
|
6994
7386
|
className: cx("nu-progress-bar__label", slotClassNames?.label),
|
|
@@ -7007,7 +7399,7 @@ function ProgressBar({
|
|
|
7007
7399
|
slotStyles?.track
|
|
7008
7400
|
),
|
|
7009
7401
|
children: [
|
|
7010
|
-
/* @__PURE__ */
|
|
7402
|
+
/* @__PURE__ */ jsx49(
|
|
7011
7403
|
"div",
|
|
7012
7404
|
{
|
|
7013
7405
|
className: cx("nu-progress-bar__fill", slotClassNames?.fill),
|
|
@@ -7020,7 +7412,7 @@ function ProgressBar({
|
|
|
7020
7412
|
)
|
|
7021
7413
|
}
|
|
7022
7414
|
),
|
|
7023
|
-
showValue ? /* @__PURE__ */
|
|
7415
|
+
showValue ? /* @__PURE__ */ jsx49(
|
|
7024
7416
|
"span",
|
|
7025
7417
|
{
|
|
7026
7418
|
className: cx("nu-progress-bar__value", slotClassNames?.value),
|
|
@@ -7031,7 +7423,7 @@ function ProgressBar({
|
|
|
7031
7423
|
]
|
|
7032
7424
|
}
|
|
7033
7425
|
),
|
|
7034
|
-
hint ? /* @__PURE__ */
|
|
7426
|
+
hint ? /* @__PURE__ */ jsx49(
|
|
7035
7427
|
"span",
|
|
7036
7428
|
{
|
|
7037
7429
|
className: cx("nu-progress-bar__hint", slotClassNames?.hint),
|
|
@@ -7046,7 +7438,7 @@ function ProgressBar({
|
|
|
7046
7438
|
|
|
7047
7439
|
// src/components/RadioGroup/RadioButton.tsx
|
|
7048
7440
|
import { useId as useId10, useState as useState23 } from "react";
|
|
7049
|
-
import { jsx as
|
|
7441
|
+
import { jsx as jsx50, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
7050
7442
|
function RadioButton({
|
|
7051
7443
|
checked,
|
|
7052
7444
|
className,
|
|
@@ -7072,7 +7464,7 @@ function RadioButton({
|
|
|
7072
7464
|
}
|
|
7073
7465
|
return /* @__PURE__ */ jsxs31("label", { className: ["nu-radio-button", className].filter(Boolean).join(" "), children: [
|
|
7074
7466
|
/* @__PURE__ */ jsxs31("span", { className: "nu-radio-button__main", children: [
|
|
7075
|
-
/* @__PURE__ */
|
|
7467
|
+
/* @__PURE__ */ jsx50(
|
|
7076
7468
|
"input",
|
|
7077
7469
|
{
|
|
7078
7470
|
...props,
|
|
@@ -7085,19 +7477,19 @@ function RadioButton({
|
|
|
7085
7477
|
type: "radio"
|
|
7086
7478
|
}
|
|
7087
7479
|
),
|
|
7088
|
-
/* @__PURE__ */
|
|
7089
|
-
/* @__PURE__ */
|
|
7090
|
-
resolvedChecked ? /* @__PURE__ */
|
|
7480
|
+
/* @__PURE__ */ jsx50("span", { "aria-hidden": "true", className: "nu-radio-button__control", children: /* @__PURE__ */ jsxs31("span", { className: "nu-radio-button__disc", children: [
|
|
7481
|
+
/* @__PURE__ */ jsx50(NuGlyph, { className: "nu-radio-button__ring", name: "radio-ring" }),
|
|
7482
|
+
resolvedChecked ? /* @__PURE__ */ jsx50(NuGlyph, { className: "nu-radio-button__fill", name: "radio-fill" }) : null
|
|
7091
7483
|
] }) }),
|
|
7092
|
-
/* @__PURE__ */
|
|
7484
|
+
/* @__PURE__ */ jsx50("span", { className: "nu-radio-button__label", children: renderMnemonicText(label) })
|
|
7093
7485
|
] }),
|
|
7094
|
-
hint ? /* @__PURE__ */
|
|
7486
|
+
hint ? /* @__PURE__ */ jsx50("span", { className: "nu-radio-button__hint", id: hintId, children: hint }) : null
|
|
7095
7487
|
] });
|
|
7096
7488
|
}
|
|
7097
7489
|
|
|
7098
7490
|
// src/components/RadioGroup/RadioGroup.tsx
|
|
7099
7491
|
import { useId as useId11, useState as useState24 } from "react";
|
|
7100
|
-
import { jsx as
|
|
7492
|
+
import { jsx as jsx51, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
7101
7493
|
function RadioGroup({
|
|
7102
7494
|
className,
|
|
7103
7495
|
defaultValue,
|
|
@@ -7132,7 +7524,7 @@ function RadioGroup({
|
|
|
7132
7524
|
className: cx("nu-radio-group", slotClassNames?.root, className),
|
|
7133
7525
|
style: mergeSlotStyle(style, slotStyles?.root),
|
|
7134
7526
|
children: [
|
|
7135
|
-
label ? /* @__PURE__ */
|
|
7527
|
+
label ? /* @__PURE__ */ jsx51(
|
|
7136
7528
|
"legend",
|
|
7137
7529
|
{
|
|
7138
7530
|
className: cx("nu-radio-group__label", slotClassNames?.label),
|
|
@@ -7140,12 +7532,12 @@ function RadioGroup({
|
|
|
7140
7532
|
children: renderMnemonicText(label)
|
|
7141
7533
|
}
|
|
7142
7534
|
) : null,
|
|
7143
|
-
/* @__PURE__ */
|
|
7535
|
+
/* @__PURE__ */ jsx51(
|
|
7144
7536
|
"div",
|
|
7145
7537
|
{
|
|
7146
7538
|
className: cx("nu-radio-group__options", slotClassNames?.options),
|
|
7147
7539
|
style: slotStyles?.options,
|
|
7148
|
-
children: options.map((option) => /* @__PURE__ */
|
|
7540
|
+
children: options.map((option) => /* @__PURE__ */ jsx51(
|
|
7149
7541
|
RadioButton,
|
|
7150
7542
|
{
|
|
7151
7543
|
checked: resolvedValue === option.value,
|
|
@@ -7164,7 +7556,7 @@ function RadioGroup({
|
|
|
7164
7556
|
))
|
|
7165
7557
|
}
|
|
7166
7558
|
),
|
|
7167
|
-
hint ? /* @__PURE__ */
|
|
7559
|
+
hint ? /* @__PURE__ */ jsx51(
|
|
7168
7560
|
"span",
|
|
7169
7561
|
{
|
|
7170
7562
|
className: cx("nu-radio-group__hint", slotClassNames?.hint),
|
|
@@ -7179,14 +7571,14 @@ function RadioGroup({
|
|
|
7179
7571
|
}
|
|
7180
7572
|
|
|
7181
7573
|
// src/components/ReportCell/ReportCell.tsx
|
|
7182
|
-
import { jsx as
|
|
7574
|
+
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
7183
7575
|
function ReportCell({
|
|
7184
7576
|
align = "start",
|
|
7185
7577
|
className,
|
|
7186
7578
|
tone = "default",
|
|
7187
7579
|
...props
|
|
7188
7580
|
}) {
|
|
7189
|
-
return /* @__PURE__ */
|
|
7581
|
+
return /* @__PURE__ */ jsx52(
|
|
7190
7582
|
"span",
|
|
7191
7583
|
{
|
|
7192
7584
|
...props,
|
|
@@ -7202,14 +7594,14 @@ function ReportCell({
|
|
|
7202
7594
|
|
|
7203
7595
|
// src/components/SearchBox/SearchBox.tsx
|
|
7204
7596
|
import {
|
|
7205
|
-
useEffect as
|
|
7597
|
+
useEffect as useEffect13,
|
|
7206
7598
|
useId as useId12,
|
|
7207
|
-
useMemo as
|
|
7208
|
-
useRef as
|
|
7599
|
+
useMemo as useMemo16,
|
|
7600
|
+
useRef as useRef18,
|
|
7209
7601
|
useState as useState25
|
|
7210
7602
|
} from "react";
|
|
7211
7603
|
import { createPortal as createPortal4 } from "react-dom";
|
|
7212
|
-
import { jsx as
|
|
7604
|
+
import { jsx as jsx53, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
7213
7605
|
function resolveSearchBoxPortalRoot() {
|
|
7214
7606
|
return document.body;
|
|
7215
7607
|
}
|
|
@@ -7237,11 +7629,11 @@ function SearchBox({
|
|
|
7237
7629
|
style,
|
|
7238
7630
|
...props
|
|
7239
7631
|
}) {
|
|
7240
|
-
const rootRef =
|
|
7241
|
-
const fieldRef =
|
|
7242
|
-
const inputRef =
|
|
7243
|
-
const popupRef =
|
|
7244
|
-
const requestIdRef =
|
|
7632
|
+
const rootRef = useRef18(null);
|
|
7633
|
+
const fieldRef = useRef18(null);
|
|
7634
|
+
const inputRef = useRef18(null);
|
|
7635
|
+
const popupRef = useRef18(null);
|
|
7636
|
+
const requestIdRef = useRef18(0);
|
|
7245
7637
|
const generatedId = useId12();
|
|
7246
7638
|
const fieldId = `${generatedId}-search-box`;
|
|
7247
7639
|
const labelId = `${fieldId}-label`;
|
|
@@ -7254,7 +7646,7 @@ function SearchBox({
|
|
|
7254
7646
|
const [selectedValue, setSelectedValue] = useState25(null);
|
|
7255
7647
|
const normalizedQuery = (isQueryControlled ? queryProp : uncontrolledQuery) ?? "";
|
|
7256
7648
|
const trimmedQuery = normalizedQuery.trim();
|
|
7257
|
-
const resultOptions =
|
|
7649
|
+
const resultOptions = useMemo16(() => {
|
|
7258
7650
|
return results.map((item, index) => ({
|
|
7259
7651
|
item,
|
|
7260
7652
|
listBoxItem: {
|
|
@@ -7268,7 +7660,7 @@ function SearchBox({
|
|
|
7268
7660
|
value: getItemId(item, index)
|
|
7269
7661
|
}));
|
|
7270
7662
|
}, [getItemDetails, getItemDisabled, getItemId, getItemText, results]);
|
|
7271
|
-
const listBoxData =
|
|
7663
|
+
const listBoxData = useMemo16(
|
|
7272
7664
|
() => [
|
|
7273
7665
|
{
|
|
7274
7666
|
category: null,
|
|
@@ -7279,7 +7671,7 @@ function SearchBox({
|
|
|
7279
7671
|
);
|
|
7280
7672
|
const popupRoot = typeof document === "undefined" ? null : resolveSearchBoxPortalRoot();
|
|
7281
7673
|
const [themePortalStyle, setThemePortalStyle] = useState25(() => void 0);
|
|
7282
|
-
|
|
7674
|
+
useEffect13(() => {
|
|
7283
7675
|
if (disabled) {
|
|
7284
7676
|
return;
|
|
7285
7677
|
}
|
|
@@ -7311,7 +7703,7 @@ function SearchBox({
|
|
|
7311
7703
|
popupRef,
|
|
7312
7704
|
portalRoot: popupRoot
|
|
7313
7705
|
});
|
|
7314
|
-
|
|
7706
|
+
useEffect13(() => {
|
|
7315
7707
|
if (disabled || !open) {
|
|
7316
7708
|
return;
|
|
7317
7709
|
}
|
|
@@ -7359,15 +7751,15 @@ function SearchBox({
|
|
|
7359
7751
|
}
|
|
7360
7752
|
function renderPopupContent() {
|
|
7361
7753
|
if (status === "loading") {
|
|
7362
|
-
return /* @__PURE__ */
|
|
7754
|
+
return /* @__PURE__ */ jsx53("div", { className: "nu-search-box__status", children: loadingText });
|
|
7363
7755
|
}
|
|
7364
7756
|
if (status === "error") {
|
|
7365
|
-
return /* @__PURE__ */
|
|
7757
|
+
return /* @__PURE__ */ jsx53("div", { className: "nu-search-box__status", children: errorText });
|
|
7366
7758
|
}
|
|
7367
7759
|
if (trimmedQuery.length < minQueryLength) {
|
|
7368
|
-
return /* @__PURE__ */
|
|
7760
|
+
return /* @__PURE__ */ jsx53("div", { className: "nu-search-box__status", children: idleText });
|
|
7369
7761
|
}
|
|
7370
|
-
return /* @__PURE__ */
|
|
7762
|
+
return /* @__PURE__ */ jsx53("div", { className: "nu-search-box__listbox", children: /* @__PURE__ */ jsx53(
|
|
7371
7763
|
ListBox,
|
|
7372
7764
|
{
|
|
7373
7765
|
data: listBoxData,
|
|
@@ -7412,10 +7804,10 @@ function SearchBox({
|
|
|
7412
7804
|
ref: rootRef,
|
|
7413
7805
|
style,
|
|
7414
7806
|
children: [
|
|
7415
|
-
/* @__PURE__ */
|
|
7807
|
+
/* @__PURE__ */ jsx53("label", { className: "nu-search-box__label", htmlFor: fieldId, id: labelId, children: renderMnemonicText(label) }),
|
|
7416
7808
|
/* @__PURE__ */ jsxs33("span", { className: "nu-search-box__slot", ref: fieldRef, children: [
|
|
7417
|
-
/* @__PURE__ */
|
|
7418
|
-
/* @__PURE__ */
|
|
7809
|
+
/* @__PURE__ */ jsx53("span", { "aria-hidden": "true", className: "nu-search-box__bracket", children: "[" }),
|
|
7810
|
+
/* @__PURE__ */ jsx53("span", { className: "nu-search-box__input-shell", children: /* @__PURE__ */ jsx53(
|
|
7419
7811
|
"input",
|
|
7420
7812
|
{
|
|
7421
7813
|
"aria-autocomplete": "list",
|
|
@@ -7440,11 +7832,11 @@ function SearchBox({
|
|
|
7440
7832
|
value: normalizedQuery
|
|
7441
7833
|
}
|
|
7442
7834
|
) }),
|
|
7443
|
-
/* @__PURE__ */
|
|
7835
|
+
/* @__PURE__ */ jsx53("span", { "aria-hidden": "true", className: "nu-search-box__bracket", children: "]" })
|
|
7444
7836
|
] }),
|
|
7445
|
-
hint ? /* @__PURE__ */
|
|
7837
|
+
hint ? /* @__PURE__ */ jsx53("span", { className: "nu-search-box__hint", id: hintId, children: hint }) : null,
|
|
7446
7838
|
open && popupRoot ? createPortal4(
|
|
7447
|
-
/* @__PURE__ */
|
|
7839
|
+
/* @__PURE__ */ jsx53(
|
|
7448
7840
|
"div",
|
|
7449
7841
|
{
|
|
7450
7842
|
className: "nu-search-box__popup",
|
|
@@ -7464,10 +7856,10 @@ function SearchBox({
|
|
|
7464
7856
|
// src/components/SpinBox/SpinBox.tsx
|
|
7465
7857
|
import {
|
|
7466
7858
|
useId as useId13,
|
|
7467
|
-
useMemo as
|
|
7859
|
+
useMemo as useMemo17,
|
|
7468
7860
|
useState as useState26
|
|
7469
7861
|
} from "react";
|
|
7470
|
-
import { jsx as
|
|
7862
|
+
import { jsx as jsx54, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
7471
7863
|
function clampSpinValue(value, min, max) {
|
|
7472
7864
|
let nextValue = value;
|
|
7473
7865
|
if (min !== void 0) {
|
|
@@ -7572,11 +7964,11 @@ function SpinBox({
|
|
|
7572
7964
|
}
|
|
7573
7965
|
onKeyDown?.(event);
|
|
7574
7966
|
}
|
|
7575
|
-
const decrementDisabled =
|
|
7967
|
+
const decrementDisabled = useMemo17(
|
|
7576
7968
|
() => disabled || min !== void 0 && numericValue <= min,
|
|
7577
7969
|
[disabled, min, numericValue]
|
|
7578
7970
|
);
|
|
7579
|
-
const incrementDisabled =
|
|
7971
|
+
const incrementDisabled = useMemo17(
|
|
7580
7972
|
() => disabled || max !== void 0 && numericValue >= max,
|
|
7581
7973
|
[disabled, max, numericValue]
|
|
7582
7974
|
);
|
|
@@ -7587,7 +7979,7 @@ function SpinBox({
|
|
|
7587
7979
|
htmlFor: fieldId,
|
|
7588
7980
|
style: mergeSlotStyle(style, slotStyles?.root),
|
|
7589
7981
|
children: [
|
|
7590
|
-
/* @__PURE__ */
|
|
7982
|
+
/* @__PURE__ */ jsx54(
|
|
7591
7983
|
"span",
|
|
7592
7984
|
{
|
|
7593
7985
|
className: cx("nu-spin-box__label", slotClassNames?.label),
|
|
@@ -7601,7 +7993,7 @@ function SpinBox({
|
|
|
7601
7993
|
className: cx("nu-spin-box__slot", slotClassNames?.slot),
|
|
7602
7994
|
style: slotStyles?.slot,
|
|
7603
7995
|
children: [
|
|
7604
|
-
/* @__PURE__ */
|
|
7996
|
+
/* @__PURE__ */ jsx54(
|
|
7605
7997
|
"span",
|
|
7606
7998
|
{
|
|
7607
7999
|
"aria-hidden": "true",
|
|
@@ -7610,12 +8002,12 @@ function SpinBox({
|
|
|
7610
8002
|
children: "["
|
|
7611
8003
|
}
|
|
7612
8004
|
),
|
|
7613
|
-
/* @__PURE__ */
|
|
8005
|
+
/* @__PURE__ */ jsx54(
|
|
7614
8006
|
"span",
|
|
7615
8007
|
{
|
|
7616
8008
|
className: cx("nu-spin-box__input-shell", slotClassNames?.inputShell),
|
|
7617
8009
|
style: slotStyles?.inputShell,
|
|
7618
|
-
children: /* @__PURE__ */
|
|
8010
|
+
children: /* @__PURE__ */ jsx54(
|
|
7619
8011
|
"input",
|
|
7620
8012
|
{
|
|
7621
8013
|
...props,
|
|
@@ -7634,7 +8026,7 @@ function SpinBox({
|
|
|
7634
8026
|
)
|
|
7635
8027
|
}
|
|
7636
8028
|
),
|
|
7637
|
-
/* @__PURE__ */
|
|
8029
|
+
/* @__PURE__ */ jsx54(
|
|
7638
8030
|
"span",
|
|
7639
8031
|
{
|
|
7640
8032
|
"aria-hidden": "true",
|
|
@@ -7649,7 +8041,7 @@ function SpinBox({
|
|
|
7649
8041
|
className: cx("nu-spin-box__controls", slotClassNames?.controls),
|
|
7650
8042
|
style: slotStyles?.controls,
|
|
7651
8043
|
children: [
|
|
7652
|
-
/* @__PURE__ */
|
|
8044
|
+
/* @__PURE__ */ jsx54(
|
|
7653
8045
|
"button",
|
|
7654
8046
|
{
|
|
7655
8047
|
className: cx("nu-spin-box__button", slotClassNames?.button),
|
|
@@ -7660,7 +8052,7 @@ function SpinBox({
|
|
|
7660
8052
|
children: "-"
|
|
7661
8053
|
}
|
|
7662
8054
|
),
|
|
7663
|
-
/* @__PURE__ */
|
|
8055
|
+
/* @__PURE__ */ jsx54(
|
|
7664
8056
|
"button",
|
|
7665
8057
|
{
|
|
7666
8058
|
className: cx("nu-spin-box__button", slotClassNames?.button),
|
|
@@ -7677,7 +8069,7 @@ function SpinBox({
|
|
|
7677
8069
|
]
|
|
7678
8070
|
}
|
|
7679
8071
|
),
|
|
7680
|
-
hint ? /* @__PURE__ */
|
|
8072
|
+
hint ? /* @__PURE__ */ jsx54(
|
|
7681
8073
|
"span",
|
|
7682
8074
|
{
|
|
7683
8075
|
className: cx("nu-spin-box__hint", slotClassNames?.hint),
|
|
@@ -7693,12 +8085,12 @@ function SpinBox({
|
|
|
7693
8085
|
|
|
7694
8086
|
// src/components/Splitter/Splitter.tsx
|
|
7695
8087
|
import {
|
|
7696
|
-
useEffect as
|
|
8088
|
+
useEffect as useEffect14,
|
|
7697
8089
|
useId as useId14,
|
|
7698
|
-
useRef as
|
|
8090
|
+
useRef as useRef19,
|
|
7699
8091
|
useState as useState27
|
|
7700
8092
|
} from "react";
|
|
7701
|
-
import { jsx as
|
|
8093
|
+
import { jsx as jsx55, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
7702
8094
|
function clamp4(value, min, max) {
|
|
7703
8095
|
return Math.min(max, Math.max(min, value));
|
|
7704
8096
|
}
|
|
@@ -7732,9 +8124,9 @@ function Splitter({
|
|
|
7732
8124
|
const [uncontrolledValue, setUncontrolledValue] = useState27(
|
|
7733
8125
|
clamp4(getSavedValue() ?? defaultValue, min, max)
|
|
7734
8126
|
);
|
|
7735
|
-
const rootRef =
|
|
7736
|
-
const dragFrameRef =
|
|
7737
|
-
const dragValueRef =
|
|
8127
|
+
const rootRef = useRef19(null);
|
|
8128
|
+
const dragFrameRef = useRef19(null);
|
|
8129
|
+
const dragValueRef = useRef19(null);
|
|
7738
8130
|
const activeValue = clamp4(
|
|
7739
8131
|
(isControlled ? value : uncontrolledValue) ?? defaultValue,
|
|
7740
8132
|
min,
|
|
@@ -7742,13 +8134,13 @@ function Splitter({
|
|
|
7742
8134
|
);
|
|
7743
8135
|
const firstPaneId = useId14();
|
|
7744
8136
|
const secondPaneId = useId14();
|
|
7745
|
-
|
|
8137
|
+
useEffect14(() => {
|
|
7746
8138
|
if (!storageKey || typeof window === "undefined") {
|
|
7747
8139
|
return;
|
|
7748
8140
|
}
|
|
7749
8141
|
window.localStorage.setItem(storageKey, String(activeValue));
|
|
7750
8142
|
}, [activeValue, storageKey]);
|
|
7751
|
-
|
|
8143
|
+
useEffect14(() => {
|
|
7752
8144
|
return () => {
|
|
7753
8145
|
if (dragFrameRef.current !== null) {
|
|
7754
8146
|
window.cancelAnimationFrame(dragFrameRef.current);
|
|
@@ -7865,8 +8257,8 @@ function Splitter({
|
|
|
7865
8257
|
"--nu-splitter-value": `${activeValue * 100}%`
|
|
7866
8258
|
},
|
|
7867
8259
|
children: [
|
|
7868
|
-
/* @__PURE__ */
|
|
7869
|
-
/* @__PURE__ */
|
|
8260
|
+
/* @__PURE__ */ jsx55("div", { className: "nu-splitter__pane", id: firstPaneId, children: first }),
|
|
8261
|
+
/* @__PURE__ */ jsx55(
|
|
7870
8262
|
"div",
|
|
7871
8263
|
{
|
|
7872
8264
|
"aria-controls": `${firstPaneId} ${secondPaneId}`,
|
|
@@ -7879,7 +8271,7 @@ function Splitter({
|
|
|
7879
8271
|
onPointerDown: handlePointerDown,
|
|
7880
8272
|
role: "separator",
|
|
7881
8273
|
tabIndex: 0,
|
|
7882
|
-
children: /* @__PURE__ */
|
|
8274
|
+
children: /* @__PURE__ */ jsx55(
|
|
7883
8275
|
"span",
|
|
7884
8276
|
{
|
|
7885
8277
|
"aria-hidden": "true",
|
|
@@ -7889,7 +8281,7 @@ function Splitter({
|
|
|
7889
8281
|
)
|
|
7890
8282
|
}
|
|
7891
8283
|
),
|
|
7892
|
-
/* @__PURE__ */
|
|
8284
|
+
/* @__PURE__ */ jsx55("div", { className: "nu-splitter__pane", id: secondPaneId, children: second })
|
|
7893
8285
|
]
|
|
7894
8286
|
}
|
|
7895
8287
|
);
|
|
@@ -7897,13 +8289,13 @@ function Splitter({
|
|
|
7897
8289
|
|
|
7898
8290
|
// src/components/TickBar/TickBar.tsx
|
|
7899
8291
|
import {
|
|
7900
|
-
useEffect as
|
|
8292
|
+
useEffect as useEffect15,
|
|
7901
8293
|
useId as useId15,
|
|
7902
|
-
useMemo as
|
|
7903
|
-
useRef as
|
|
8294
|
+
useMemo as useMemo18,
|
|
8295
|
+
useRef as useRef20,
|
|
7904
8296
|
useState as useState28
|
|
7905
8297
|
} from "react";
|
|
7906
|
-
import { jsx as
|
|
8298
|
+
import { jsx as jsx56, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
7907
8299
|
function clamp5(value, min, max) {
|
|
7908
8300
|
return Math.min(max, Math.max(min, value));
|
|
7909
8301
|
}
|
|
@@ -7950,10 +8342,10 @@ function TickBar({
|
|
|
7950
8342
|
);
|
|
7951
8343
|
const [uncontrolledValue, setUncontrolledValue] = useState28(initialValue);
|
|
7952
8344
|
const [dragging, setDragging] = useState28(false);
|
|
7953
|
-
const trackRef =
|
|
8345
|
+
const trackRef = useRef20(null);
|
|
7954
8346
|
const resolvedValue = isControlled ? clamp5(snapToStep(value ?? initialValue, min, safeStep), min, safeMax) : uncontrolledValue;
|
|
7955
8347
|
const ratio = safeMax === min ? 0 : (resolvedValue - min) / (safeMax - min);
|
|
7956
|
-
const derivedTickCount =
|
|
8348
|
+
const derivedTickCount = useMemo18(() => {
|
|
7957
8349
|
if (tickCount !== void 0) {
|
|
7958
8350
|
return Math.max(2, tickCount);
|
|
7959
8351
|
}
|
|
@@ -7963,7 +8355,7 @@ function TickBar({
|
|
|
7963
8355
|
);
|
|
7964
8356
|
}, [min, safeMax, safeStep, tickCount]);
|
|
7965
8357
|
const renderedValue = valueRenderer ? valueRenderer(resolvedValue, min, safeMax) : String(resolvedValue);
|
|
7966
|
-
|
|
8358
|
+
useEffect15(() => {
|
|
7967
8359
|
if (!dragging) {
|
|
7968
8360
|
return;
|
|
7969
8361
|
}
|
|
@@ -8052,7 +8444,7 @@ function TickBar({
|
|
|
8052
8444
|
slotStyles?.root
|
|
8053
8445
|
),
|
|
8054
8446
|
children: [
|
|
8055
|
-
label ? /* @__PURE__ */
|
|
8447
|
+
label ? /* @__PURE__ */ jsx56(
|
|
8056
8448
|
"span",
|
|
8057
8449
|
{
|
|
8058
8450
|
className: cx("nu-tick-bar__label", slotClassNames?.label),
|
|
@@ -8108,19 +8500,19 @@ function TickBar({
|
|
|
8108
8500
|
style: slotStyles?.track,
|
|
8109
8501
|
tabIndex: disabled ? -1 : 0,
|
|
8110
8502
|
children: [
|
|
8111
|
-
/* @__PURE__ */
|
|
8503
|
+
/* @__PURE__ */ jsx56(
|
|
8112
8504
|
"div",
|
|
8113
8505
|
{
|
|
8114
8506
|
className: cx("nu-tick-bar__rail", slotClassNames?.rail),
|
|
8115
8507
|
style: slotStyles?.rail
|
|
8116
8508
|
}
|
|
8117
8509
|
),
|
|
8118
|
-
/* @__PURE__ */
|
|
8510
|
+
/* @__PURE__ */ jsx56(
|
|
8119
8511
|
"div",
|
|
8120
8512
|
{
|
|
8121
8513
|
className: cx("nu-tick-bar__ticks", slotClassNames?.ticks),
|
|
8122
8514
|
style: slotStyles?.ticks,
|
|
8123
|
-
children: Array.from({ length: derivedTickCount }, (_, index) => /* @__PURE__ */
|
|
8515
|
+
children: Array.from({ length: derivedTickCount }, (_, index) => /* @__PURE__ */ jsx56(
|
|
8124
8516
|
"span",
|
|
8125
8517
|
{
|
|
8126
8518
|
"aria-hidden": "true",
|
|
@@ -8131,7 +8523,7 @@ function TickBar({
|
|
|
8131
8523
|
))
|
|
8132
8524
|
}
|
|
8133
8525
|
),
|
|
8134
|
-
/* @__PURE__ */
|
|
8526
|
+
/* @__PURE__ */ jsx56(
|
|
8135
8527
|
"div",
|
|
8136
8528
|
{
|
|
8137
8529
|
"aria-hidden": "true",
|
|
@@ -8149,7 +8541,7 @@ function TickBar({
|
|
|
8149
8541
|
]
|
|
8150
8542
|
}
|
|
8151
8543
|
),
|
|
8152
|
-
showValue ? /* @__PURE__ */
|
|
8544
|
+
showValue ? /* @__PURE__ */ jsx56(
|
|
8153
8545
|
"span",
|
|
8154
8546
|
{
|
|
8155
8547
|
className: cx("nu-tick-bar__value", slotClassNames?.value),
|
|
@@ -8160,7 +8552,7 @@ function TickBar({
|
|
|
8160
8552
|
]
|
|
8161
8553
|
}
|
|
8162
8554
|
),
|
|
8163
|
-
hint ? /* @__PURE__ */
|
|
8555
|
+
hint ? /* @__PURE__ */ jsx56(
|
|
8164
8556
|
"span",
|
|
8165
8557
|
{
|
|
8166
8558
|
className: cx("nu-tick-bar__hint", slotClassNames?.hint),
|
|
@@ -8175,7 +8567,7 @@ function TickBar({
|
|
|
8175
8567
|
}
|
|
8176
8568
|
|
|
8177
8569
|
// src/components/ToolBar/ToolBar.tsx
|
|
8178
|
-
import { jsx as
|
|
8570
|
+
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
8179
8571
|
function ToolBar({
|
|
8180
8572
|
children,
|
|
8181
8573
|
className,
|
|
@@ -8185,7 +8577,7 @@ function ToolBar({
|
|
|
8185
8577
|
wrap = false,
|
|
8186
8578
|
...props
|
|
8187
8579
|
}) {
|
|
8188
|
-
return /* @__PURE__ */
|
|
8580
|
+
return /* @__PURE__ */ jsx57(
|
|
8189
8581
|
"div",
|
|
8190
8582
|
{
|
|
8191
8583
|
...props,
|
|
@@ -8204,7 +8596,7 @@ function ToolButton({
|
|
|
8204
8596
|
slotStyles,
|
|
8205
8597
|
...props
|
|
8206
8598
|
}) {
|
|
8207
|
-
return /* @__PURE__ */
|
|
8599
|
+
return /* @__PURE__ */ jsx57(
|
|
8208
8600
|
CommandButton,
|
|
8209
8601
|
{
|
|
8210
8602
|
...props,
|
|
@@ -8234,7 +8626,7 @@ function ToolDropButton({
|
|
|
8234
8626
|
uncheckedShape,
|
|
8235
8627
|
...props
|
|
8236
8628
|
}) {
|
|
8237
|
-
return /* @__PURE__ */
|
|
8629
|
+
return /* @__PURE__ */ jsx57(
|
|
8238
8630
|
CommandButton,
|
|
8239
8631
|
{
|
|
8240
8632
|
...props,
|
|
@@ -8260,7 +8652,7 @@ function ToolDropButton({
|
|
|
8260
8652
|
);
|
|
8261
8653
|
}
|
|
8262
8654
|
function ToolSeparator({ className, ...props }) {
|
|
8263
|
-
return /* @__PURE__ */
|
|
8655
|
+
return /* @__PURE__ */ jsx57(
|
|
8264
8656
|
"div",
|
|
8265
8657
|
{
|
|
8266
8658
|
...props,
|
|
@@ -8279,11 +8671,11 @@ function ToolSeparator({ className, ...props }) {
|
|
|
8279
8671
|
import {
|
|
8280
8672
|
forwardRef as forwardRef3,
|
|
8281
8673
|
useCallback as useCallback7,
|
|
8282
|
-
useEffect as
|
|
8674
|
+
useEffect as useEffect16,
|
|
8283
8675
|
useId as useId16,
|
|
8284
8676
|
useImperativeHandle as useImperativeHandle3,
|
|
8285
|
-
useMemo as
|
|
8286
|
-
useRef as
|
|
8677
|
+
useMemo as useMemo19,
|
|
8678
|
+
useRef as useRef21,
|
|
8287
8679
|
useState as useState29
|
|
8288
8680
|
} from "react";
|
|
8289
8681
|
|
|
@@ -8382,7 +8774,7 @@ function collectVisibleTreeItems(items, expandedIds, depth = 0, guideMask = [],
|
|
|
8382
8774
|
|
|
8383
8775
|
// src/components/TreeView/internals/TreeViewItem.tsx
|
|
8384
8776
|
import { memo as memo4 } from "react";
|
|
8385
|
-
import { jsx as
|
|
8777
|
+
import { jsx as jsx58, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
8386
8778
|
function areTreeViewGuideArraysEqual(previousArray, nextArray) {
|
|
8387
8779
|
if (previousArray.length !== nextArray.length) {
|
|
8388
8780
|
return false;
|
|
@@ -8477,7 +8869,7 @@ function TreeViewItemInner({
|
|
|
8477
8869
|
role: "treeitem",
|
|
8478
8870
|
children: [
|
|
8479
8871
|
/* @__PURE__ */ jsxs37("span", { "aria-hidden": "true", className: "nu-tree-view__prefix", children: [
|
|
8480
|
-
guideMask.map((hasGuide, guideIndex) => /* @__PURE__ */
|
|
8872
|
+
guideMask.map((hasGuide, guideIndex) => /* @__PURE__ */ jsx58(
|
|
8481
8873
|
"span",
|
|
8482
8874
|
{
|
|
8483
8875
|
className: "nu-tree-view__guide",
|
|
@@ -8496,19 +8888,19 @@ function TreeViewItemInner({
|
|
|
8496
8888
|
"--nu-tree-view-origin-offset": originOffset
|
|
8497
8889
|
},
|
|
8498
8890
|
children: [
|
|
8499
|
-
depth > 0 ? /* @__PURE__ */
|
|
8891
|
+
depth > 0 ? /* @__PURE__ */ jsx58(
|
|
8500
8892
|
"span",
|
|
8501
8893
|
{
|
|
8502
8894
|
className: "nu-tree-view__branch",
|
|
8503
8895
|
"data-branch": hasNextSibling ? "tee" : "elbow"
|
|
8504
8896
|
}
|
|
8505
8897
|
) : null,
|
|
8506
|
-
hasChildren ? /* @__PURE__ */
|
|
8898
|
+
hasChildren ? /* @__PURE__ */ jsx58(
|
|
8507
8899
|
"span",
|
|
8508
8900
|
{
|
|
8509
8901
|
className: "nu-tree-view__expander",
|
|
8510
8902
|
"data-connector": depth > 0 ? "lead" : void 0,
|
|
8511
|
-
children: /* @__PURE__ */
|
|
8903
|
+
children: /* @__PURE__ */ jsx58(
|
|
8512
8904
|
"button",
|
|
8513
8905
|
{
|
|
8514
8906
|
"aria-label": isExpanded ? "Collapse item" : "Expand item",
|
|
@@ -8516,7 +8908,7 @@ function TreeViewItemInner({
|
|
|
8516
8908
|
onClick: handleToggleExpanded,
|
|
8517
8909
|
tabIndex: -1,
|
|
8518
8910
|
type: "button",
|
|
8519
|
-
children: /* @__PURE__ */
|
|
8911
|
+
children: /* @__PURE__ */ jsx58(
|
|
8520
8912
|
NuGlyph,
|
|
8521
8913
|
{
|
|
8522
8914
|
name: isExpanded ? "tree-caret-down" : "tree-caret-right"
|
|
@@ -8525,7 +8917,7 @@ function TreeViewItemInner({
|
|
|
8525
8917
|
}
|
|
8526
8918
|
)
|
|
8527
8919
|
}
|
|
8528
|
-
) : depth > 0 ? /* @__PURE__ */
|
|
8920
|
+
) : depth > 0 ? /* @__PURE__ */ jsx58(
|
|
8529
8921
|
"span",
|
|
8530
8922
|
{
|
|
8531
8923
|
className: "nu-tree-view__expander-placeholder",
|
|
@@ -8537,7 +8929,7 @@ function TreeViewItemInner({
|
|
|
8537
8929
|
)
|
|
8538
8930
|
] }),
|
|
8539
8931
|
/* @__PURE__ */ jsxs37("span", { className: "nu-tree-view__content", children: [
|
|
8540
|
-
isCheckable ? /* @__PURE__ */
|
|
8932
|
+
isCheckable ? /* @__PURE__ */ jsx58("span", { className: "nu-tree-view__check-slot", children: /* @__PURE__ */ jsx58(
|
|
8541
8933
|
"button",
|
|
8542
8934
|
{
|
|
8543
8935
|
"aria-label": isChecked ? "Uncheck item" : "Check item",
|
|
@@ -8545,12 +8937,12 @@ function TreeViewItemInner({
|
|
|
8545
8937
|
onClick: handleToggleChecked,
|
|
8546
8938
|
tabIndex: -1,
|
|
8547
8939
|
type: "button",
|
|
8548
|
-
children: /* @__PURE__ */
|
|
8940
|
+
children: /* @__PURE__ */ jsx58(
|
|
8549
8941
|
"span",
|
|
8550
8942
|
{
|
|
8551
8943
|
className: "nu-tree-view__check-box",
|
|
8552
8944
|
"data-unchecked-shape": uncheckedShape,
|
|
8553
|
-
children: isChecked ? /* @__PURE__ */
|
|
8945
|
+
children: isChecked ? /* @__PURE__ */ jsx58(
|
|
8554
8946
|
NuGlyph,
|
|
8555
8947
|
{
|
|
8556
8948
|
className: "nu-tree-view__check-mark",
|
|
@@ -8561,14 +8953,14 @@ function TreeViewItemInner({
|
|
|
8561
8953
|
)
|
|
8562
8954
|
}
|
|
8563
8955
|
) }) : null,
|
|
8564
|
-
item.icon ? /* @__PURE__ */
|
|
8565
|
-
/* @__PURE__ */
|
|
8566
|
-
item.hint ? /* @__PURE__ */
|
|
8956
|
+
item.icon ? /* @__PURE__ */ jsx58("span", { className: "nu-tree-view__icon", children: item.icon }) : null,
|
|
8957
|
+
/* @__PURE__ */ jsx58("span", { className: "nu-tree-view__title", children: item.title }),
|
|
8958
|
+
item.hint ? /* @__PURE__ */ jsx58("span", { className: "nu-tree-view__hint", children: item.hint }) : null
|
|
8567
8959
|
] })
|
|
8568
8960
|
]
|
|
8569
8961
|
}
|
|
8570
8962
|
),
|
|
8571
|
-
hasChildren && isExpanded ? /* @__PURE__ */
|
|
8963
|
+
hasChildren && isExpanded ? /* @__PURE__ */ jsx58("div", { role: "group", children: (item.children ?? []).map((child, index) => /* @__PURE__ */ jsx58(
|
|
8572
8964
|
TreeViewItem,
|
|
8573
8965
|
{
|
|
8574
8966
|
depth: depth + 1,
|
|
@@ -8604,7 +8996,7 @@ function areTreeViewItemPropsEqual(previousProps, nextProps) {
|
|
|
8604
8996
|
var TreeViewItem = memo4(TreeViewItemInner, areTreeViewItemPropsEqual);
|
|
8605
8997
|
|
|
8606
8998
|
// src/components/TreeView/TreeView.tsx
|
|
8607
|
-
import { jsx as
|
|
8999
|
+
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
8608
9000
|
function TreeViewInner({
|
|
8609
9001
|
className,
|
|
8610
9002
|
data,
|
|
@@ -8619,9 +9011,9 @@ function TreeViewInner({
|
|
|
8619
9011
|
uncheckedShape = "box",
|
|
8620
9012
|
...props
|
|
8621
9013
|
}, ref) {
|
|
8622
|
-
const rootRef =
|
|
9014
|
+
const rootRef = useRef21(null);
|
|
8623
9015
|
const treeId = useId16();
|
|
8624
|
-
const itemRefs =
|
|
9016
|
+
const itemRefs = useRef21({});
|
|
8625
9017
|
const isExpandedControlled = expandedIds !== void 0;
|
|
8626
9018
|
const [uncontrolledExpandedIds, setUncontrolledExpandedIds] = useState29(() => {
|
|
8627
9019
|
const expandedFromData = collectExpandedTreeIds(data);
|
|
@@ -8632,15 +9024,15 @@ function TreeViewInner({
|
|
|
8632
9024
|
});
|
|
8633
9025
|
const [uncontrolledSelectedId, setUncontrolledSelectedId] = useState29(null);
|
|
8634
9026
|
const resolvedExpandedIds = isExpandedControlled ? expandedIds : uncontrolledExpandedIds;
|
|
8635
|
-
const expandedIdSet =
|
|
9027
|
+
const expandedIdSet = useMemo19(
|
|
8636
9028
|
() => new Set(resolvedExpandedIds),
|
|
8637
9029
|
[resolvedExpandedIds]
|
|
8638
9030
|
);
|
|
8639
|
-
const visibleItems =
|
|
9031
|
+
const visibleItems = useMemo19(
|
|
8640
9032
|
() => collectVisibleTreeItems(data, expandedIdSet),
|
|
8641
9033
|
[data, expandedIdSet]
|
|
8642
9034
|
);
|
|
8643
|
-
const selectableItems =
|
|
9035
|
+
const selectableItems = useMemo19(
|
|
8644
9036
|
() => visibleItems.filter(({ item }) => !item.disabled),
|
|
8645
9037
|
[visibleItems]
|
|
8646
9038
|
);
|
|
@@ -8648,7 +9040,7 @@ function TreeViewInner({
|
|
|
8648
9040
|
const resolvedSelectedId = derivedSelectedId && selectableItems.some((entry) => entry.itemId === derivedSelectedId) ? derivedSelectedId : selectableItems[0]?.itemId ?? null;
|
|
8649
9041
|
const [activeId, setActiveId] = useState29(resolvedSelectedId);
|
|
8650
9042
|
const resolvedActiveId = activeId && selectableItems.some((entry) => entry.itemId === activeId) ? activeId : resolvedSelectedId;
|
|
8651
|
-
|
|
9043
|
+
useEffect16(() => {
|
|
8652
9044
|
if (!resolvedActiveId) {
|
|
8653
9045
|
return;
|
|
8654
9046
|
}
|
|
@@ -8855,7 +9247,7 @@ function TreeViewInner({
|
|
|
8855
9247
|
setExpandedState
|
|
8856
9248
|
]
|
|
8857
9249
|
);
|
|
8858
|
-
return /* @__PURE__ */
|
|
9250
|
+
return /* @__PURE__ */ jsx59(
|
|
8859
9251
|
"div",
|
|
8860
9252
|
{
|
|
8861
9253
|
...props,
|
|
@@ -8865,7 +9257,7 @@ function TreeViewInner({
|
|
|
8865
9257
|
ref: rootRef,
|
|
8866
9258
|
role: "tree",
|
|
8867
9259
|
tabIndex: 0,
|
|
8868
|
-
children: visibleItems.length > 0 ? data.map((item, index) => /* @__PURE__ */
|
|
9260
|
+
children: visibleItems.length > 0 ? data.map((item, index) => /* @__PURE__ */ jsx59(
|
|
8869
9261
|
TreeViewItem,
|
|
8870
9262
|
{
|
|
8871
9263
|
depth: 0,
|
|
@@ -8885,7 +9277,7 @@ function TreeViewInner({
|
|
|
8885
9277
|
uncheckedShape
|
|
8886
9278
|
},
|
|
8887
9279
|
item.id
|
|
8888
|
-
)) : /* @__PURE__ */
|
|
9280
|
+
)) : /* @__PURE__ */ jsx59("div", { className: "nu-tree-view__empty", children: emptyText })
|
|
8889
9281
|
}
|
|
8890
9282
|
);
|
|
8891
9283
|
}
|
|
@@ -8895,12 +9287,12 @@ var TreeView = forwardRef3(TreeViewInner);
|
|
|
8895
9287
|
import {
|
|
8896
9288
|
forwardRef as forwardRef4,
|
|
8897
9289
|
useCallback as useCallback8,
|
|
8898
|
-
useEffect as
|
|
9290
|
+
useEffect as useEffect17,
|
|
8899
9291
|
useId as useId17,
|
|
8900
9292
|
useImperativeHandle as useImperativeHandle4,
|
|
8901
9293
|
useLayoutEffect as useLayoutEffect5,
|
|
8902
|
-
useMemo as
|
|
8903
|
-
useRef as
|
|
9294
|
+
useMemo as useMemo20,
|
|
9295
|
+
useRef as useRef22,
|
|
8904
9296
|
useState as useState30
|
|
8905
9297
|
} from "react";
|
|
8906
9298
|
|
|
@@ -8992,11 +9384,11 @@ function renderTreeListCellValue(item, column) {
|
|
|
8992
9384
|
|
|
8993
9385
|
// src/components/TreeListView/internals/TreeListViewRow.tsx
|
|
8994
9386
|
import { memo as memo5 } from "react";
|
|
8995
|
-
import { Fragment as Fragment7, jsx as
|
|
9387
|
+
import { Fragment as Fragment7, jsx as jsx60, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
8996
9388
|
function renderTreeTitleContent(item) {
|
|
8997
9389
|
return /* @__PURE__ */ jsxs38(Fragment7, { children: [
|
|
8998
|
-
/* @__PURE__ */
|
|
8999
|
-
item.hint ? /* @__PURE__ */
|
|
9390
|
+
/* @__PURE__ */ jsx60("span", { className: "nu-tree-list-view__title", children: item.title }),
|
|
9391
|
+
item.hint ? /* @__PURE__ */ jsx60("span", { className: "nu-tree-list-view__hint", children: item.hint }) : null
|
|
9000
9392
|
] });
|
|
9001
9393
|
}
|
|
9002
9394
|
function renderReportCellContent(item, column, depth, rowIndex, getCellContent) {
|
|
@@ -9036,12 +9428,15 @@ function TreeListViewRowInner({
|
|
|
9036
9428
|
depth,
|
|
9037
9429
|
expandedIdSet,
|
|
9038
9430
|
getCellContent,
|
|
9431
|
+
getDragItem,
|
|
9039
9432
|
guideMask,
|
|
9040
9433
|
guideOffsets,
|
|
9041
9434
|
hasNextSibling,
|
|
9042
9435
|
item,
|
|
9043
9436
|
onActivateItem,
|
|
9044
9437
|
onDoubleClickItem,
|
|
9438
|
+
onItemDragOut,
|
|
9439
|
+
onPopupMenuItem,
|
|
9045
9440
|
onToggleItemCheck,
|
|
9046
9441
|
onToggleItemExpanded,
|
|
9047
9442
|
originOffset,
|
|
@@ -9062,6 +9457,18 @@ function TreeListViewRowInner({
|
|
|
9062
9457
|
const isSelected = itemId === selectedItemId;
|
|
9063
9458
|
const rowIndex = rowIndexMap.get(itemId) ?? 0;
|
|
9064
9459
|
const leadOffset = depth > 0 && hasChildren ? 1 : 0;
|
|
9460
|
+
const dragContext = {
|
|
9461
|
+
depth,
|
|
9462
|
+
isLeaf: !hasChildren,
|
|
9463
|
+
item,
|
|
9464
|
+
rowIndex
|
|
9465
|
+
};
|
|
9466
|
+
const dragSource = useNuDragSource({
|
|
9467
|
+
disabled: item.disabled || !getDragItem,
|
|
9468
|
+
getItem: () => getDragItem?.(item, dragContext) ?? false,
|
|
9469
|
+
onDropAccepted: () => onItemDragOut?.(item, dragContext),
|
|
9470
|
+
sourceType: "tree-list-item"
|
|
9471
|
+
});
|
|
9065
9472
|
function handleActivate() {
|
|
9066
9473
|
if (item.disabled) {
|
|
9067
9474
|
return;
|
|
@@ -9080,6 +9487,17 @@ function TreeListViewRowInner({
|
|
|
9080
9487
|
}
|
|
9081
9488
|
onDoubleClickItem?.(item);
|
|
9082
9489
|
}
|
|
9490
|
+
function handleContextMenu(event) {
|
|
9491
|
+
if (item.disabled) {
|
|
9492
|
+
return;
|
|
9493
|
+
}
|
|
9494
|
+
onPopupMenuItem?.(event, item, {
|
|
9495
|
+
depth,
|
|
9496
|
+
isLeaf: !hasChildren,
|
|
9497
|
+
item,
|
|
9498
|
+
rowIndex
|
|
9499
|
+
});
|
|
9500
|
+
}
|
|
9083
9501
|
function handleToggleExpanded(event) {
|
|
9084
9502
|
event.stopPropagation();
|
|
9085
9503
|
if (item.disabled || !hasChildren) {
|
|
@@ -9097,7 +9515,7 @@ function TreeListViewRowInner({
|
|
|
9097
9515
|
onToggleItemCheck?.(item, !isChecked);
|
|
9098
9516
|
}
|
|
9099
9517
|
return /* @__PURE__ */ jsxs38(Fragment7, { children: [
|
|
9100
|
-
/* @__PURE__ */
|
|
9518
|
+
/* @__PURE__ */ jsx60(
|
|
9101
9519
|
"div",
|
|
9102
9520
|
{
|
|
9103
9521
|
"aria-disabled": item.disabled || void 0,
|
|
@@ -9113,7 +9531,12 @@ function TreeListViewRowInner({
|
|
|
9113
9531
|
].filter(Boolean).join(" "),
|
|
9114
9532
|
id: `${treeId}-${itemId}`,
|
|
9115
9533
|
onClick: handleActivate,
|
|
9534
|
+
onContextMenu: onPopupMenuItem ? handleContextMenu : void 0,
|
|
9116
9535
|
onDoubleClick: handleDoubleClick,
|
|
9536
|
+
onPointerCancel: dragSource.onPointerCancel,
|
|
9537
|
+
onPointerDown: dragSource.onPointerDown,
|
|
9538
|
+
onPointerMove: dragSource.onPointerMove,
|
|
9539
|
+
onPointerUp: dragSource.onPointerUp,
|
|
9117
9540
|
ref: (node) => registerItemRef(itemId, node),
|
|
9118
9541
|
role: "row",
|
|
9119
9542
|
style: {
|
|
@@ -9133,7 +9556,7 @@ function TreeListViewRowInner({
|
|
|
9133
9556
|
role: "gridcell",
|
|
9134
9557
|
children: [
|
|
9135
9558
|
/* @__PURE__ */ jsxs38("span", { "aria-hidden": "true", className: "nu-tree-list-view__prefix", children: [
|
|
9136
|
-
guideMask.map((hasGuide, guideIndex) => /* @__PURE__ */
|
|
9559
|
+
guideMask.map((hasGuide, guideIndex) => /* @__PURE__ */ jsx60(
|
|
9137
9560
|
"span",
|
|
9138
9561
|
{
|
|
9139
9562
|
className: "nu-tree-list-view__guide",
|
|
@@ -9152,19 +9575,19 @@ function TreeListViewRowInner({
|
|
|
9152
9575
|
"--nu-tree-list-view-origin-offset": originOffset
|
|
9153
9576
|
},
|
|
9154
9577
|
children: [
|
|
9155
|
-
depth > 0 ? /* @__PURE__ */
|
|
9578
|
+
depth > 0 ? /* @__PURE__ */ jsx60(
|
|
9156
9579
|
"span",
|
|
9157
9580
|
{
|
|
9158
9581
|
className: "nu-tree-list-view__branch",
|
|
9159
9582
|
"data-branch": hasNextSibling ? "tee" : "elbow"
|
|
9160
9583
|
}
|
|
9161
9584
|
) : null,
|
|
9162
|
-
hasChildren ? /* @__PURE__ */
|
|
9585
|
+
hasChildren ? /* @__PURE__ */ jsx60(
|
|
9163
9586
|
"span",
|
|
9164
9587
|
{
|
|
9165
9588
|
className: "nu-tree-list-view__expander",
|
|
9166
9589
|
"data-connector": depth > 0 ? "lead" : void 0,
|
|
9167
|
-
children: /* @__PURE__ */
|
|
9590
|
+
children: /* @__PURE__ */ jsx60(
|
|
9168
9591
|
"button",
|
|
9169
9592
|
{
|
|
9170
9593
|
"aria-label": isExpanded ? "Collapse item" : "Expand item",
|
|
@@ -9172,7 +9595,7 @@ function TreeListViewRowInner({
|
|
|
9172
9595
|
onClick: handleToggleExpanded,
|
|
9173
9596
|
tabIndex: -1,
|
|
9174
9597
|
type: "button",
|
|
9175
|
-
children: /* @__PURE__ */
|
|
9598
|
+
children: /* @__PURE__ */ jsx60(
|
|
9176
9599
|
NuGlyph,
|
|
9177
9600
|
{
|
|
9178
9601
|
name: isExpanded ? "tree-caret-down" : "tree-caret-right"
|
|
@@ -9181,7 +9604,7 @@ function TreeListViewRowInner({
|
|
|
9181
9604
|
}
|
|
9182
9605
|
)
|
|
9183
9606
|
}
|
|
9184
|
-
) : depth > 0 ? /* @__PURE__ */
|
|
9607
|
+
) : depth > 0 ? /* @__PURE__ */ jsx60(
|
|
9185
9608
|
"span",
|
|
9186
9609
|
{
|
|
9187
9610
|
className: "nu-tree-list-view__expander-placeholder",
|
|
@@ -9193,7 +9616,7 @@ function TreeListViewRowInner({
|
|
|
9193
9616
|
)
|
|
9194
9617
|
] }),
|
|
9195
9618
|
/* @__PURE__ */ jsxs38("span", { className: "nu-tree-list-view__tree-content", children: [
|
|
9196
|
-
isCheckable ? /* @__PURE__ */
|
|
9619
|
+
isCheckable ? /* @__PURE__ */ jsx60("span", { className: "nu-tree-list-view__check-slot", children: /* @__PURE__ */ jsx60(
|
|
9197
9620
|
"button",
|
|
9198
9621
|
{
|
|
9199
9622
|
"aria-label": isChecked ? "Uncheck item" : "Check item",
|
|
@@ -9201,12 +9624,12 @@ function TreeListViewRowInner({
|
|
|
9201
9624
|
onClick: handleToggleChecked,
|
|
9202
9625
|
tabIndex: -1,
|
|
9203
9626
|
type: "button",
|
|
9204
|
-
children: /* @__PURE__ */
|
|
9627
|
+
children: /* @__PURE__ */ jsx60(
|
|
9205
9628
|
"span",
|
|
9206
9629
|
{
|
|
9207
9630
|
className: "nu-tree-list-view__check-box",
|
|
9208
9631
|
"data-unchecked-shape": uncheckedShape,
|
|
9209
|
-
children: isChecked ? /* @__PURE__ */
|
|
9632
|
+
children: isChecked ? /* @__PURE__ */ jsx60(
|
|
9210
9633
|
NuGlyph,
|
|
9211
9634
|
{
|
|
9212
9635
|
className: "nu-tree-list-view__check-mark",
|
|
@@ -9217,13 +9640,13 @@ function TreeListViewRowInner({
|
|
|
9217
9640
|
)
|
|
9218
9641
|
}
|
|
9219
9642
|
) }) : null,
|
|
9220
|
-
item.icon ? /* @__PURE__ */
|
|
9643
|
+
item.icon ? /* @__PURE__ */ jsx60("span", { className: "nu-tree-list-view__icon", children: item.icon }) : null,
|
|
9221
9644
|
renderTreeTitleContent(item)
|
|
9222
9645
|
] })
|
|
9223
9646
|
]
|
|
9224
9647
|
},
|
|
9225
9648
|
column.id
|
|
9226
|
-
) : /* @__PURE__ */
|
|
9649
|
+
) : /* @__PURE__ */ jsx60(
|
|
9227
9650
|
"span",
|
|
9228
9651
|
{
|
|
9229
9652
|
className: [
|
|
@@ -9246,7 +9669,7 @@ function TreeListViewRowInner({
|
|
|
9246
9669
|
)
|
|
9247
9670
|
}
|
|
9248
9671
|
),
|
|
9249
|
-
hasChildren && isExpanded ? /* @__PURE__ */
|
|
9672
|
+
hasChildren && isExpanded ? /* @__PURE__ */ jsx60("div", { role: "rowgroup", children: (item.children ?? []).map((child, index) => /* @__PURE__ */ jsx60(
|
|
9250
9673
|
TreeListViewRow,
|
|
9251
9674
|
{
|
|
9252
9675
|
activeItemId,
|
|
@@ -9255,12 +9678,15 @@ function TreeListViewRowInner({
|
|
|
9255
9678
|
depth: depth + 1,
|
|
9256
9679
|
expandedIdSet,
|
|
9257
9680
|
getCellContent,
|
|
9681
|
+
getDragItem,
|
|
9258
9682
|
guideMask: [...guideMask, hasNextSibling],
|
|
9259
9683
|
guideOffsets: [...guideOffsets, originOffset],
|
|
9260
9684
|
hasNextSibling: index < (item.children?.length ?? 0) - 1,
|
|
9261
9685
|
item: child,
|
|
9262
9686
|
onActivateItem,
|
|
9263
9687
|
onDoubleClickItem,
|
|
9688
|
+
onItemDragOut,
|
|
9689
|
+
onPopupMenuItem,
|
|
9264
9690
|
onToggleItemCheck,
|
|
9265
9691
|
onToggleItemExpanded,
|
|
9266
9692
|
originOffset: originOffset + leadOffset,
|
|
@@ -9282,7 +9708,7 @@ function areTreeListViewRowPropsEqual(previousProps, nextProps) {
|
|
|
9282
9708
|
return !didActivePathChange && !didSelectedPathChange && previousProps.checkedIds === nextProps.checkedIds && previousProps.columns === nextProps.columns && previousProps.depth === nextProps.depth && previousProps.expandedIdSet === nextProps.expandedIdSet && previousProps.getCellContent === nextProps.getCellContent && areTreeListGuideArraysEqual(previousProps.guideMask, nextProps.guideMask) && areTreeListGuideArraysEqual(
|
|
9283
9709
|
previousProps.guideOffsets,
|
|
9284
9710
|
nextProps.guideOffsets
|
|
9285
|
-
) && previousProps.hasNextSibling === nextProps.hasNextSibling && previousProps.item === nextProps.item && previousProps.onActivateItem === nextProps.onActivateItem && previousProps.onDoubleClickItem === nextProps.onDoubleClickItem && previousProps.onToggleItemCheck === nextProps.onToggleItemCheck && previousProps.onToggleItemExpanded === nextProps.onToggleItemExpanded && previousProps.originOffset === nextProps.originOffset && previousProps.registerItemRef === nextProps.registerItemRef && previousProps.rowIndexMap === nextProps.rowIndexMap && previousProps.templateColumns === nextProps.templateColumns && previousProps.treeColumnId === nextProps.treeColumnId && previousProps.treeId === nextProps.treeId && previousProps.uncheckedShape === nextProps.uncheckedShape;
|
|
9711
|
+
) && previousProps.hasNextSibling === nextProps.hasNextSibling && previousProps.item === nextProps.item && previousProps.onActivateItem === nextProps.onActivateItem && previousProps.onDoubleClickItem === nextProps.onDoubleClickItem && previousProps.onPopupMenuItem === nextProps.onPopupMenuItem && previousProps.onToggleItemCheck === nextProps.onToggleItemCheck && previousProps.onToggleItemExpanded === nextProps.onToggleItemExpanded && previousProps.originOffset === nextProps.originOffset && previousProps.registerItemRef === nextProps.registerItemRef && previousProps.rowIndexMap === nextProps.rowIndexMap && previousProps.templateColumns === nextProps.templateColumns && previousProps.treeColumnId === nextProps.treeColumnId && previousProps.treeId === nextProps.treeId && previousProps.uncheckedShape === nextProps.uncheckedShape;
|
|
9286
9712
|
}
|
|
9287
9713
|
var TreeListViewRow = memo5(
|
|
9288
9714
|
TreeListViewRowInner,
|
|
@@ -9290,33 +9716,39 @@ var TreeListViewRow = memo5(
|
|
|
9290
9716
|
);
|
|
9291
9717
|
|
|
9292
9718
|
// src/components/TreeListView/TreeListView.tsx
|
|
9293
|
-
import { jsx as
|
|
9719
|
+
import { jsx as jsx61, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
9294
9720
|
function TreeListViewInner({
|
|
9721
|
+
acceptsDrop,
|
|
9295
9722
|
activeItemId: activeItemIdProp,
|
|
9296
9723
|
checkedIds,
|
|
9297
9724
|
className,
|
|
9298
9725
|
columns,
|
|
9726
|
+
onPopupMenu,
|
|
9299
9727
|
data,
|
|
9300
9728
|
dataVersion,
|
|
9301
9729
|
defaultActiveItemId,
|
|
9302
9730
|
defaultExpandedIds,
|
|
9303
9731
|
emptyText = "No items",
|
|
9304
9732
|
expandedIds,
|
|
9733
|
+
getDragItem,
|
|
9305
9734
|
getCellContent,
|
|
9306
9735
|
onActiveItemChange,
|
|
9307
9736
|
onExpandedIdsChange,
|
|
9308
9737
|
onItemCheckChange,
|
|
9309
9738
|
onItemDoubleClick,
|
|
9739
|
+
onItemDragOut,
|
|
9310
9740
|
onItemSelect,
|
|
9741
|
+
onDrop,
|
|
9311
9742
|
selectedId,
|
|
9312
9743
|
uncheckedShape = "box",
|
|
9313
9744
|
...props
|
|
9314
9745
|
}, ref) {
|
|
9315
|
-
const rootRef =
|
|
9746
|
+
const rootRef = useRef22(null);
|
|
9747
|
+
const [rootElement, setRootElement] = useState30(null);
|
|
9316
9748
|
const treeId = useId17();
|
|
9317
|
-
const itemRefs =
|
|
9318
|
-
const resizeFrameRef =
|
|
9319
|
-
const resizeStateRef =
|
|
9749
|
+
const itemRefs = useRef22({});
|
|
9750
|
+
const resizeFrameRef = useRef22(null);
|
|
9751
|
+
const resizeStateRef = useRef22(null);
|
|
9320
9752
|
const isExpandedControlled = expandedIds !== void 0;
|
|
9321
9753
|
const [uncontrolledExpandedIds, setUncontrolledExpandedIds] = useState30(() => {
|
|
9322
9754
|
const expandedFromData = collectExpandedTreeListIds(data);
|
|
@@ -9330,15 +9762,15 @@ function TreeListViewInner({
|
|
|
9330
9762
|
const [userColumnWidths, setUserColumnWidths] = useState30({});
|
|
9331
9763
|
const isActiveControlled = activeItemIdProp !== void 0;
|
|
9332
9764
|
const resolvedExpandedIds = isExpandedControlled ? expandedIds : uncontrolledExpandedIds;
|
|
9333
|
-
const expandedIdSet =
|
|
9765
|
+
const expandedIdSet = useMemo20(
|
|
9334
9766
|
() => new Set(resolvedExpandedIds),
|
|
9335
9767
|
[resolvedExpandedIds]
|
|
9336
9768
|
);
|
|
9337
|
-
const visibleItems =
|
|
9769
|
+
const visibleItems = useMemo20(
|
|
9338
9770
|
() => collectVisibleTreeListItems(data, expandedIdSet),
|
|
9339
9771
|
[data, expandedIdSet]
|
|
9340
9772
|
);
|
|
9341
|
-
const selectableItems =
|
|
9773
|
+
const selectableItems = useMemo20(
|
|
9342
9774
|
() => visibleItems.filter(({ item }) => !item.disabled),
|
|
9343
9775
|
[visibleItems]
|
|
9344
9776
|
);
|
|
@@ -9347,7 +9779,7 @@ function TreeListViewInner({
|
|
|
9347
9779
|
const [uncontrolledActiveItemId, setUncontrolledActiveItemId] = useState30(() => defaultActiveItemId ?? resolvedSelectedId);
|
|
9348
9780
|
const activeItemId = activeItemIdProp !== void 0 ? activeItemIdProp : uncontrolledActiveItemId;
|
|
9349
9781
|
const resolvedActiveItemId = activeItemId && selectableItems.some((entry) => entry.itemId === activeItemId) ? activeItemId : resolvedSelectedId;
|
|
9350
|
-
const minColumnWidthById =
|
|
9782
|
+
const minColumnWidthById = useMemo20(
|
|
9351
9783
|
() => Object.fromEntries(
|
|
9352
9784
|
columns.map(
|
|
9353
9785
|
(column) => [column.id, column.minWidth ?? 0]
|
|
@@ -9355,24 +9787,33 @@ function TreeListViewInner({
|
|
|
9355
9787
|
),
|
|
9356
9788
|
[columns]
|
|
9357
9789
|
);
|
|
9358
|
-
const templateColumns =
|
|
9790
|
+
const templateColumns = useMemo20(
|
|
9359
9791
|
() => getTreeListTemplateColumns(columns, {
|
|
9360
9792
|
autoColumnWidths,
|
|
9361
9793
|
userColumnWidths
|
|
9362
9794
|
}),
|
|
9363
9795
|
[autoColumnWidths, columns, userColumnWidths]
|
|
9364
9796
|
);
|
|
9365
|
-
const treeColumnId =
|
|
9797
|
+
const treeColumnId = useMemo20(
|
|
9366
9798
|
() => getTreeListTreeColumnId(columns),
|
|
9367
9799
|
[columns]
|
|
9368
9800
|
);
|
|
9369
|
-
const rowIndexMap =
|
|
9801
|
+
const rowIndexMap = useMemo20(
|
|
9370
9802
|
() => new Map(
|
|
9371
9803
|
visibleItems.map((entry, index) => [entry.itemId, index])
|
|
9372
9804
|
),
|
|
9373
9805
|
[visibleItems]
|
|
9374
9806
|
);
|
|
9375
|
-
|
|
9807
|
+
const dropTargetOptions = useMemo20(
|
|
9808
|
+
() => onDrop ? { accepts: acceptsDrop, onDrop, type: "tree-list" } : void 0,
|
|
9809
|
+
[acceptsDrop, onDrop]
|
|
9810
|
+
);
|
|
9811
|
+
useNuDropTarget(rootElement, dropTargetOptions);
|
|
9812
|
+
const setRootRef = useCallback8((node) => {
|
|
9813
|
+
rootRef.current = node;
|
|
9814
|
+
setRootElement(node);
|
|
9815
|
+
}, []);
|
|
9816
|
+
useEffect17(() => {
|
|
9376
9817
|
if (!resolvedActiveItemId) {
|
|
9377
9818
|
return;
|
|
9378
9819
|
}
|
|
@@ -9426,7 +9867,7 @@ function TreeListViewInner({
|
|
|
9426
9867
|
return didChange ? nextWidths : currentWidths;
|
|
9427
9868
|
});
|
|
9428
9869
|
}, [columns, userColumnWidths, visibleItems]);
|
|
9429
|
-
|
|
9870
|
+
useEffect17(() => {
|
|
9430
9871
|
return () => {
|
|
9431
9872
|
if (resizeFrameRef.current !== null) {
|
|
9432
9873
|
window.cancelAnimationFrame(resizeFrameRef.current);
|
|
@@ -9465,6 +9906,18 @@ function TreeListViewInner({
|
|
|
9465
9906
|
},
|
|
9466
9907
|
[onItemSelect, selectedId, updateActiveItem]
|
|
9467
9908
|
);
|
|
9909
|
+
const handleItemPopupMenu = useCallback8(
|
|
9910
|
+
(event, item, context) => {
|
|
9911
|
+
if (item.disabled || !onPopupMenu) {
|
|
9912
|
+
return;
|
|
9913
|
+
}
|
|
9914
|
+
event.preventDefault();
|
|
9915
|
+
event.stopPropagation();
|
|
9916
|
+
activateEntry(item, item.id);
|
|
9917
|
+
onPopupMenu(event, item, context);
|
|
9918
|
+
},
|
|
9919
|
+
[activateEntry, onPopupMenu]
|
|
9920
|
+
);
|
|
9468
9921
|
const activateResolvedItem = useCallback8(
|
|
9469
9922
|
(itemId) => {
|
|
9470
9923
|
if (!itemId) {
|
|
@@ -9715,11 +10168,11 @@ function TreeListViewInner({
|
|
|
9715
10168
|
className: ["nu-tree-list-view", className].filter(Boolean).join(" "),
|
|
9716
10169
|
"data-version": dataVersion,
|
|
9717
10170
|
onKeyDown: handleKeyDown,
|
|
9718
|
-
ref:
|
|
10171
|
+
ref: setRootRef,
|
|
9719
10172
|
role: "treegrid",
|
|
9720
10173
|
tabIndex: 0,
|
|
9721
10174
|
children: [
|
|
9722
|
-
/* @__PURE__ */
|
|
10175
|
+
/* @__PURE__ */ jsx61(
|
|
9723
10176
|
"div",
|
|
9724
10177
|
{
|
|
9725
10178
|
className: "nu-tree-list-view__header",
|
|
@@ -9738,8 +10191,8 @@ function TreeListViewInner({
|
|
|
9738
10191
|
"data-column-id": column.id,
|
|
9739
10192
|
role: "columnheader",
|
|
9740
10193
|
children: [
|
|
9741
|
-
/* @__PURE__ */
|
|
9742
|
-
column.resizable !== false ? /* @__PURE__ */
|
|
10194
|
+
/* @__PURE__ */ jsx61("span", { className: "nu-tree-list-view__header-label", children: renderMnemonicText(column.title) }),
|
|
10195
|
+
column.resizable !== false ? /* @__PURE__ */ jsx61(
|
|
9743
10196
|
"button",
|
|
9744
10197
|
{
|
|
9745
10198
|
"aria-label": `Resize ${column.title} column`,
|
|
@@ -9755,7 +10208,7 @@ function TreeListViewInner({
|
|
|
9755
10208
|
))
|
|
9756
10209
|
}
|
|
9757
10210
|
),
|
|
9758
|
-
/* @__PURE__ */
|
|
10211
|
+
/* @__PURE__ */ jsx61("div", { className: "nu-tree-list-view__body", children: visibleItems.length > 0 ? data.map((item, index) => /* @__PURE__ */ jsx61(
|
|
9759
10212
|
TreeListViewRow,
|
|
9760
10213
|
{
|
|
9761
10214
|
activeItemId: resolvedActiveItemId,
|
|
@@ -9764,12 +10217,15 @@ function TreeListViewInner({
|
|
|
9764
10217
|
depth: 0,
|
|
9765
10218
|
expandedIdSet,
|
|
9766
10219
|
getCellContent: getCellContent ? resolveCellContent : void 0,
|
|
10220
|
+
getDragItem,
|
|
9767
10221
|
guideMask: [],
|
|
9768
10222
|
guideOffsets: [],
|
|
9769
10223
|
hasNextSibling: index < data.length - 1,
|
|
9770
10224
|
item,
|
|
9771
10225
|
onActivateItem: activateEntry,
|
|
9772
10226
|
onDoubleClickItem: onItemDoubleClick ? handleItemDoubleClick : void 0,
|
|
10227
|
+
onItemDragOut,
|
|
10228
|
+
onPopupMenuItem: handleItemPopupMenu,
|
|
9773
10229
|
onToggleItemCheck: handleItemCheckChange,
|
|
9774
10230
|
onToggleItemExpanded: setExpandedState,
|
|
9775
10231
|
originOffset: 0,
|
|
@@ -9782,7 +10238,7 @@ function TreeListViewInner({
|
|
|
9782
10238
|
uncheckedShape
|
|
9783
10239
|
},
|
|
9784
10240
|
item.id
|
|
9785
|
-
)) : /* @__PURE__ */
|
|
10241
|
+
)) : /* @__PURE__ */ jsx61("div", { className: "nu-tree-list-view__empty", children: emptyText }) })
|
|
9786
10242
|
]
|
|
9787
10243
|
}
|
|
9788
10244
|
);
|
|
@@ -9793,7 +10249,7 @@ var TreeListView = forwardRef4(TreeListViewInner);
|
|
|
9793
10249
|
import {
|
|
9794
10250
|
useCallback as useCallback9,
|
|
9795
10251
|
useId as useId18,
|
|
9796
|
-
useMemo as
|
|
10252
|
+
useMemo as useMemo21,
|
|
9797
10253
|
useState as useState31
|
|
9798
10254
|
} from "react";
|
|
9799
10255
|
|
|
@@ -9811,10 +10267,12 @@ var classicTheme = {
|
|
|
9811
10267
|
panelBackground: "#6262e3",
|
|
9812
10268
|
panelInsetBackground: "#6262e3",
|
|
9813
10269
|
titleBackground: "#ffffff",
|
|
10270
|
+
menuBackground: "#ffffff",
|
|
9814
10271
|
titleText: "#1f36bc",
|
|
9815
10272
|
textPrimary: "#ffffff",
|
|
9816
10273
|
textMuted: "#dfe3ff",
|
|
9817
10274
|
textInverse: "#000000",
|
|
10275
|
+
mainMenuText: "#000000",
|
|
9818
10276
|
textAccent: "#ffff55",
|
|
9819
10277
|
textHotkey: "#ff5555",
|
|
9820
10278
|
buttonFace: "#ffffff",
|
|
@@ -9847,10 +10305,12 @@ var amberTheme = {
|
|
|
9847
10305
|
panelBackground: "#4b2b00",
|
|
9848
10306
|
panelInsetBackground: "#382000",
|
|
9849
10307
|
titleBackground: "#ffd28f",
|
|
10308
|
+
menuBackground: "#ffd28f",
|
|
9850
10309
|
titleText: "#4b2b00",
|
|
9851
10310
|
textPrimary: "#ffd28f",
|
|
9852
10311
|
textMuted: "#d6b57a",
|
|
9853
10312
|
textInverse: "#201000",
|
|
10313
|
+
mainMenuText: "#201000",
|
|
9854
10314
|
textAccent: "#fff27a",
|
|
9855
10315
|
textHotkey: "#ff5f00",
|
|
9856
10316
|
buttonFace: "#ffd28f",
|
|
@@ -9883,10 +10343,12 @@ var phosphorTheme = {
|
|
|
9883
10343
|
panelBackground: "#11351a",
|
|
9884
10344
|
panelInsetBackground: "#0d2813",
|
|
9885
10345
|
titleBackground: "#b7ffbf",
|
|
10346
|
+
menuBackground: "#b7ffbf",
|
|
9886
10347
|
titleText: "#0b2310",
|
|
9887
10348
|
textPrimary: "#b7ffbf",
|
|
9888
10349
|
textMuted: "#8ed39a",
|
|
9889
10350
|
textInverse: "#061208",
|
|
10351
|
+
mainMenuText: "#061208",
|
|
9890
10352
|
textAccent: "#f7ff7a",
|
|
9891
10353
|
textHotkey: "#ff6f6f",
|
|
9892
10354
|
buttonFace: "#b7ffbf",
|
|
@@ -9915,29 +10377,31 @@ var midnightTheme = {
|
|
|
9915
10377
|
shellBackground: "#101722",
|
|
9916
10378
|
appBackground: "#17273b",
|
|
9917
10379
|
appBackgroundAlt: "#0d1724",
|
|
9918
|
-
chromeBackground: "#
|
|
9919
|
-
panelBackground: "#
|
|
10380
|
+
chromeBackground: "#36547d",
|
|
10381
|
+
panelBackground: "#192c43",
|
|
9920
10382
|
panelInsetBackground: "#111e2e",
|
|
9921
|
-
titleBackground: "#
|
|
9922
|
-
|
|
9923
|
-
|
|
9924
|
-
|
|
9925
|
-
|
|
9926
|
-
|
|
9927
|
-
|
|
9928
|
-
|
|
9929
|
-
|
|
9930
|
-
|
|
10383
|
+
titleBackground: "#0b2432",
|
|
10384
|
+
menuBackground: "#1c2945",
|
|
10385
|
+
titleText: "#c2d0e5",
|
|
10386
|
+
textPrimary: "#6b9adb",
|
|
10387
|
+
textMuted: "#65a8ec",
|
|
10388
|
+
textInverse: "#b7caf0",
|
|
10389
|
+
mainMenuText: "#b7caf0",
|
|
10390
|
+
textAccent: "#ffcd57",
|
|
10391
|
+
textHotkey: "#fb0404",
|
|
10392
|
+
buttonFace: "#5074af",
|
|
10393
|
+
buttonFaceAlt: "#3c5372",
|
|
10394
|
+
buttonDanger: "#4e0e15",
|
|
9931
10395
|
buttonSuccess: "#3c936d",
|
|
9932
|
-
buttonText: "#
|
|
10396
|
+
buttonText: "#ffffff",
|
|
9933
10397
|
fieldBackground: "#09111c",
|
|
9934
|
-
fieldText: "#
|
|
9935
|
-
borderLight: "#
|
|
9936
|
-
borderDark: "#
|
|
9937
|
-
borderAccent: "#
|
|
10398
|
+
fieldText: "#627b9d",
|
|
10399
|
+
borderLight: "#415776",
|
|
10400
|
+
borderDark: "#1d2134",
|
|
10401
|
+
borderAccent: "#3b5681",
|
|
9938
10402
|
shadowColor: "#070c14",
|
|
9939
10403
|
panelShadowColor: "rgb(7 12 20 / 0.56)",
|
|
9940
|
-
focusColor: "#
|
|
10404
|
+
focusColor: "#af532c",
|
|
9941
10405
|
windowInactiveOverlay: "rgb(7 12 20 / 0.3)",
|
|
9942
10406
|
windowModalBackdrop: "rgb(7 12 20 / 0.48)"
|
|
9943
10407
|
}
|
|
@@ -9955,10 +10419,12 @@ var grayscaleTheme = {
|
|
|
9955
10419
|
panelBackground: "#3f3f3f",
|
|
9956
10420
|
panelInsetBackground: "#343434",
|
|
9957
10421
|
titleBackground: "#262626",
|
|
10422
|
+
menuBackground: "#262626",
|
|
9958
10423
|
titleText: "#d0d0d0",
|
|
9959
10424
|
textPrimary: "#c8c8c8",
|
|
9960
10425
|
textMuted: "#969696",
|
|
9961
10426
|
textInverse: "#d0d0d0",
|
|
10427
|
+
mainMenuText: "#d0d0d0",
|
|
9962
10428
|
textAccent: "#e0e0e0",
|
|
9963
10429
|
textHotkey: "#ffffff",
|
|
9964
10430
|
buttonFace: "#5b5b5b",
|
|
@@ -10002,10 +10468,12 @@ function getNuThemeStyle(theme) {
|
|
|
10002
10468
|
"--nu-color-panel": theme.tokens.panelBackground,
|
|
10003
10469
|
"--nu-color-panel-inset": theme.tokens.panelInsetBackground,
|
|
10004
10470
|
"--nu-color-title-bg": theme.tokens.titleBackground,
|
|
10471
|
+
"--nu-color-menu": theme.tokens.menuBackground,
|
|
10005
10472
|
"--nu-color-title-text": theme.tokens.titleText,
|
|
10006
10473
|
"--nu-text-primary": theme.tokens.textPrimary,
|
|
10007
10474
|
"--nu-text-muted": theme.tokens.textMuted,
|
|
10008
10475
|
"--nu-text-inverse": theme.tokens.textInverse,
|
|
10476
|
+
"--nu-main-menu-text": theme.tokens.mainMenuText,
|
|
10009
10477
|
"--nu-text-accent": theme.tokens.textAccent,
|
|
10010
10478
|
"--nu-text-hotkey": theme.tokens.textHotkey,
|
|
10011
10479
|
"--nu-color-button-face": theme.tokens.buttonFace,
|
|
@@ -10062,10 +10530,10 @@ function getNuDesktopPatternStyle(mode) {
|
|
|
10062
10530
|
}
|
|
10063
10531
|
|
|
10064
10532
|
// src/theme/themeContext.ts
|
|
10065
|
-
import { createContext as
|
|
10066
|
-
var NuThemeContext =
|
|
10533
|
+
import { createContext as createContext6, useContext as useContext10 } from "react";
|
|
10534
|
+
var NuThemeContext = createContext6(null);
|
|
10067
10535
|
function useNuTheme() {
|
|
10068
|
-
const context =
|
|
10536
|
+
const context = useContext10(NuThemeContext);
|
|
10069
10537
|
if (!context) {
|
|
10070
10538
|
throw new Error("useNuTheme must be used within a NuThemeProvider.");
|
|
10071
10539
|
}
|
|
@@ -10073,7 +10541,7 @@ function useNuTheme() {
|
|
|
10073
10541
|
}
|
|
10074
10542
|
|
|
10075
10543
|
// src/theme/NuThemeProvider.tsx
|
|
10076
|
-
import { jsx as
|
|
10544
|
+
import { jsx as jsx62, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
10077
10545
|
function NuThemeProvider({
|
|
10078
10546
|
children,
|
|
10079
10547
|
className,
|
|
@@ -10089,6 +10557,7 @@ function NuThemeProvider({
|
|
|
10089
10557
|
onFontFamilyChange,
|
|
10090
10558
|
onFontSizeChange,
|
|
10091
10559
|
onThemeChange,
|
|
10560
|
+
style,
|
|
10092
10561
|
theme
|
|
10093
10562
|
}) {
|
|
10094
10563
|
const generatedId = useId18();
|
|
@@ -10138,7 +10607,7 @@ function NuThemeProvider({
|
|
|
10138
10607
|
},
|
|
10139
10608
|
[fontSize, onFontSizeChange]
|
|
10140
10609
|
);
|
|
10141
|
-
const contextValue =
|
|
10610
|
+
const contextValue = useMemo21(
|
|
10142
10611
|
() => ({
|
|
10143
10612
|
desktopPatternMode: resolvedDesktopPatternMode,
|
|
10144
10613
|
fontFamily: resolvedFontFamily,
|
|
@@ -10163,7 +10632,7 @@ function NuThemeProvider({
|
|
|
10163
10632
|
handleThemeChange
|
|
10164
10633
|
]
|
|
10165
10634
|
);
|
|
10166
|
-
return /* @__PURE__ */
|
|
10635
|
+
return /* @__PURE__ */ jsx62(NuThemeContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs40(
|
|
10167
10636
|
"div",
|
|
10168
10637
|
{
|
|
10169
10638
|
className: ["nu-theme-root", className].filter(Boolean).join(" "),
|
|
@@ -10174,10 +10643,11 @@ function NuThemeProvider({
|
|
|
10174
10643
|
...getNuThemeStyle(resolvedTheme),
|
|
10175
10644
|
"--nu-font-body": resolvedFontFamily,
|
|
10176
10645
|
fontFamily: resolvedFontFamily,
|
|
10177
|
-
fontSize: `${resolvedFontSize}px
|
|
10646
|
+
fontSize: `${resolvedFontSize}px`,
|
|
10647
|
+
...style
|
|
10178
10648
|
},
|
|
10179
10649
|
children: [
|
|
10180
|
-
crtGlitch ? /* @__PURE__ */
|
|
10650
|
+
crtGlitch ? /* @__PURE__ */ jsx62(NuCrtGlitch, { ...typeof crtGlitch === "object" ? crtGlitch : {} }) : null,
|
|
10181
10651
|
children
|
|
10182
10652
|
]
|
|
10183
10653
|
}
|
|
@@ -10204,6 +10674,7 @@ export {
|
|
|
10204
10674
|
NuAppHostProvider,
|
|
10205
10675
|
NuCrtGlitch,
|
|
10206
10676
|
NuDesktop,
|
|
10677
|
+
NuDragDropProvider,
|
|
10207
10678
|
NuGlyph,
|
|
10208
10679
|
NuIconGrid,
|
|
10209
10680
|
NuIconProvider,
|
|
@@ -10249,6 +10720,9 @@ export {
|
|
|
10249
10720
|
resolveNuTheme,
|
|
10250
10721
|
useAppHostMenu,
|
|
10251
10722
|
useMainMenuState,
|
|
10723
|
+
useNuDragDrop,
|
|
10724
|
+
useNuDragSource,
|
|
10725
|
+
useNuDropTarget,
|
|
10252
10726
|
useNuIconManager,
|
|
10253
10727
|
useNuTheme,
|
|
10254
10728
|
useNuWindowManager,
|