@deadragdoll/reactnu 0.1.49 → 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/NuIconGrid.d.ts +10 -3
- package/dist/components/ListBox/ListBox.d.ts +11 -2
- package/dist/components/ListBox/internals/ListBoxGroupView.d.ts +4 -1
- package/dist/components/ListBox/internals/ListBoxItemView.d.ts +4 -1
- package/dist/components/TreeListView/TreeListView.d.ts +11 -2
- package/dist/components/TreeListView/internals/TreeListViewRow.d.ts +4 -1
- package/dist/index.cjs +1049 -795
- package/dist/index.d.ts +1 -0
- package/dist/index.js +831 -576
- 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 +5 -0
- package/docs/ListBox.md +7 -0
- package/docs/NuDragDropProvider.md +43 -0
- package/docs/NuThemeProvider.md +1 -1
- package/docs/TreeListView.md +7 -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,9 +1166,10 @@ 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,
|
|
@@ -947,11 +1178,18 @@ function ListBoxItemViewInner({
|
|
|
947
1178
|
onActivate,
|
|
948
1179
|
onPopupMenu,
|
|
949
1180
|
onDoubleClick,
|
|
1181
|
+
onDragOut,
|
|
950
1182
|
onToggleCheck,
|
|
951
1183
|
registerItemRef,
|
|
952
1184
|
rightCheckBox,
|
|
953
1185
|
uncheckedShape
|
|
954
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
|
+
});
|
|
955
1193
|
function handleActivate() {
|
|
956
1194
|
if (!item.disabled) {
|
|
957
1195
|
onActivate(item, group, itemId);
|
|
@@ -970,7 +1208,7 @@ function ListBoxItemViewInner({
|
|
|
970
1208
|
function handleToggleCheck() {
|
|
971
1209
|
onToggleCheck(itemId);
|
|
972
1210
|
}
|
|
973
|
-
const checkControl = item.checkable ? /* @__PURE__ */
|
|
1211
|
+
const checkControl = item.checkable ? /* @__PURE__ */ jsx10(
|
|
974
1212
|
ListBoxCheckControl,
|
|
975
1213
|
{
|
|
976
1214
|
isChecked,
|
|
@@ -997,6 +1235,10 @@ function ListBoxItemViewInner({
|
|
|
997
1235
|
onClick: handleActivate,
|
|
998
1236
|
onContextMenu: onPopupMenu ? handleContextMenu : void 0,
|
|
999
1237
|
onDoubleClick: handleDoubleClick,
|
|
1238
|
+
onPointerCancel: dragSource.onPointerCancel,
|
|
1239
|
+
onPointerDown: dragSource.onPointerDown,
|
|
1240
|
+
onPointerMove: dragSource.onPointerMove,
|
|
1241
|
+
onPointerUp: dragSource.onPointerUp,
|
|
1000
1242
|
ref: (node) => registerItemRef(itemId, node),
|
|
1001
1243
|
role: "option",
|
|
1002
1244
|
children: [
|
|
@@ -1004,7 +1246,7 @@ function ListBoxItemViewInner({
|
|
|
1004
1246
|
rightCheckBox ? null : checkControl,
|
|
1005
1247
|
renderLabel(item.name, "nu-listbox__item-label")
|
|
1006
1248
|
] }),
|
|
1007
|
-
item.details ? /* @__PURE__ */
|
|
1249
|
+
item.details ? /* @__PURE__ */ jsx10("span", { className: "nu-listbox__item-details", children: item.details }) : null,
|
|
1008
1250
|
rightCheckBox ? checkControl : null
|
|
1009
1251
|
]
|
|
1010
1252
|
}
|
|
@@ -1013,14 +1255,16 @@ function ListBoxItemViewInner({
|
|
|
1013
1255
|
var ListBoxItemView = memo(ListBoxItemViewInner);
|
|
1014
1256
|
|
|
1015
1257
|
// src/components/ListBox/internals/ListBoxGroupView.tsx
|
|
1016
|
-
import { jsx as
|
|
1258
|
+
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1017
1259
|
function ListBoxGroupView({
|
|
1018
1260
|
group,
|
|
1019
1261
|
groupIndex,
|
|
1262
|
+
getDragItem,
|
|
1020
1263
|
isItemChecked,
|
|
1021
1264
|
listboxId,
|
|
1022
1265
|
onActivateItem,
|
|
1023
1266
|
onDoubleClickItem,
|
|
1267
|
+
onItemDragOut,
|
|
1024
1268
|
onPopupMenuItem,
|
|
1025
1269
|
onToggleItemCheck,
|
|
1026
1270
|
registerItemRef,
|
|
@@ -1030,7 +1274,7 @@ function ListBoxGroupView({
|
|
|
1030
1274
|
uncheckedShape
|
|
1031
1275
|
}) {
|
|
1032
1276
|
return /* @__PURE__ */ jsxs7("div", { className: "nu-listbox__group", role: "group", children: [
|
|
1033
|
-
group.category ? /* @__PURE__ */
|
|
1277
|
+
group.category ? /* @__PURE__ */ jsx11(ListBoxCategoryView, { category: group.category }) : null,
|
|
1034
1278
|
group.items.map((item, itemIndex) => {
|
|
1035
1279
|
const itemId = buildListBoxItemId(
|
|
1036
1280
|
listboxId,
|
|
@@ -1042,10 +1286,11 @@ function ListBoxGroupView({
|
|
|
1042
1286
|
const isSelected = selectedId ? item.id === selectedId : item.selected;
|
|
1043
1287
|
const isActive = resolvedActiveId === itemId;
|
|
1044
1288
|
const isChecked = isItemChecked(item);
|
|
1045
|
-
return /* @__PURE__ */
|
|
1289
|
+
return /* @__PURE__ */ jsx11(
|
|
1046
1290
|
ListBoxItemView,
|
|
1047
1291
|
{
|
|
1048
1292
|
group,
|
|
1293
|
+
getDragItem,
|
|
1049
1294
|
isActive,
|
|
1050
1295
|
isChecked,
|
|
1051
1296
|
isSelected: Boolean(isSelected),
|
|
@@ -1053,6 +1298,7 @@ function ListBoxGroupView({
|
|
|
1053
1298
|
itemId,
|
|
1054
1299
|
onActivate: onActivateItem,
|
|
1055
1300
|
onDoubleClick: onDoubleClickItem,
|
|
1301
|
+
onDragOut: onItemDragOut,
|
|
1056
1302
|
onPopupMenu: onPopupMenuItem,
|
|
1057
1303
|
onToggleCheck: onToggleItemCheck,
|
|
1058
1304
|
registerItemRef,
|
|
@@ -1066,38 +1312,52 @@ function ListBoxGroupView({
|
|
|
1066
1312
|
}
|
|
1067
1313
|
|
|
1068
1314
|
// src/components/ListBox/ListBox.tsx
|
|
1069
|
-
import { jsx as
|
|
1315
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1070
1316
|
function ListBoxInner({
|
|
1317
|
+
acceptsDrop,
|
|
1071
1318
|
className,
|
|
1072
1319
|
data,
|
|
1073
1320
|
checkedIds,
|
|
1074
1321
|
emptyText = "No items",
|
|
1322
|
+
getDragItem,
|
|
1075
1323
|
onPopupMenu,
|
|
1076
1324
|
onItemCheckChange,
|
|
1077
1325
|
onItemDoubleClick,
|
|
1326
|
+
onItemDragOut,
|
|
1078
1327
|
onItemSelect,
|
|
1328
|
+
onDrop,
|
|
1079
1329
|
rightCheckBox = false,
|
|
1080
1330
|
selectedId,
|
|
1081
1331
|
uncheckedShape = "box",
|
|
1082
1332
|
...props
|
|
1083
1333
|
}, ref) {
|
|
1084
1334
|
const hasItems = data.some((group) => group.items.length > 0);
|
|
1085
|
-
const rootRef =
|
|
1335
|
+
const rootRef = useRef4(null);
|
|
1336
|
+
const [rootElement, setRootElement] = useState4(null);
|
|
1086
1337
|
const listboxId = useId();
|
|
1087
|
-
const itemRefs =
|
|
1088
|
-
const flattenedItems =
|
|
1338
|
+
const itemRefs = useRef4({});
|
|
1339
|
+
const flattenedItems = useMemo3(
|
|
1089
1340
|
() => flattenListBoxData(data, listboxId),
|
|
1090
1341
|
[data, listboxId]
|
|
1091
1342
|
);
|
|
1092
|
-
const selectableItems =
|
|
1343
|
+
const selectableItems = useMemo3(
|
|
1093
1344
|
() => flattenedItems.filter(({ item }) => !item.disabled),
|
|
1094
1345
|
[flattenedItems]
|
|
1095
1346
|
);
|
|
1096
1347
|
const [activeId, setActiveId] = useState4(
|
|
1097
1348
|
() => getInitialActiveId(selectableItems, selectedId)
|
|
1098
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
|
+
}, []);
|
|
1099
1359
|
const resolvedActiveId = activeId && selectableItems.some((entry) => entry.itemId === activeId) ? activeId : getInitialActiveId(selectableItems, selectedId);
|
|
1100
|
-
|
|
1360
|
+
useEffect4(() => {
|
|
1101
1361
|
if (!resolvedActiveId) {
|
|
1102
1362
|
return;
|
|
1103
1363
|
}
|
|
@@ -1244,7 +1504,7 @@ function ListBoxInner({
|
|
|
1244
1504
|
break;
|
|
1245
1505
|
}
|
|
1246
1506
|
}
|
|
1247
|
-
return /* @__PURE__ */
|
|
1507
|
+
return /* @__PURE__ */ jsx12(
|
|
1248
1508
|
"div",
|
|
1249
1509
|
{
|
|
1250
1510
|
...props,
|
|
@@ -1252,18 +1512,20 @@ function ListBoxInner({
|
|
|
1252
1512
|
className: ["nu-listbox", className].filter(Boolean).join(" "),
|
|
1253
1513
|
"data-right-checkbox": rightCheckBox || void 0,
|
|
1254
1514
|
onKeyDown: handleKeyDown,
|
|
1255
|
-
ref:
|
|
1515
|
+
ref: setRootRef,
|
|
1256
1516
|
role: "listbox",
|
|
1257
1517
|
tabIndex: 0,
|
|
1258
|
-
children: hasItems ? data.map((group, groupIndex) => /* @__PURE__ */
|
|
1518
|
+
children: hasItems ? data.map((group, groupIndex) => /* @__PURE__ */ jsx12(
|
|
1259
1519
|
ListBoxGroupView,
|
|
1260
1520
|
{
|
|
1261
1521
|
group,
|
|
1262
1522
|
groupIndex,
|
|
1263
1523
|
isItemChecked,
|
|
1524
|
+
getDragItem,
|
|
1264
1525
|
listboxId,
|
|
1265
1526
|
onActivateItem: activateItem,
|
|
1266
1527
|
onDoubleClickItem: onItemDoubleClick,
|
|
1528
|
+
onItemDragOut,
|
|
1267
1529
|
onPopupMenuItem: handleItemPopupMenu,
|
|
1268
1530
|
onToggleItemCheck: toggleItemCheck,
|
|
1269
1531
|
registerItemRef,
|
|
@@ -1273,14 +1535,14 @@ function ListBoxInner({
|
|
|
1273
1535
|
uncheckedShape
|
|
1274
1536
|
},
|
|
1275
1537
|
`${group.category?.text ?? "group"}-${groupIndex}`
|
|
1276
|
-
)) : /* @__PURE__ */
|
|
1538
|
+
)) : /* @__PURE__ */ jsx12("div", { className: "nu-listbox__empty", children: emptyText })
|
|
1277
1539
|
}
|
|
1278
1540
|
);
|
|
1279
1541
|
}
|
|
1280
1542
|
var ListBox = forwardRef(ListBoxInner);
|
|
1281
1543
|
|
|
1282
1544
|
// src/components/Stack/Stack.tsx
|
|
1283
|
-
import { jsx as
|
|
1545
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1284
1546
|
function resolveFlexAlign(align) {
|
|
1285
1547
|
if (align === "start") {
|
|
1286
1548
|
return "flex-start";
|
|
@@ -1309,7 +1571,7 @@ function Stack({
|
|
|
1309
1571
|
style,
|
|
1310
1572
|
...props
|
|
1311
1573
|
}) {
|
|
1312
|
-
return /* @__PURE__ */
|
|
1574
|
+
return /* @__PURE__ */ jsx13(
|
|
1313
1575
|
"div",
|
|
1314
1576
|
{
|
|
1315
1577
|
...props,
|
|
@@ -1329,7 +1591,7 @@ function Stack({
|
|
|
1329
1591
|
}
|
|
1330
1592
|
|
|
1331
1593
|
// src/windowing/internals/MdiWindowPickerDialog.tsx
|
|
1332
|
-
import { jsx as
|
|
1594
|
+
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1333
1595
|
function isPickerEligibleWindow(windowEntry) {
|
|
1334
1596
|
if (windowEntry.mode === "window") {
|
|
1335
1597
|
return true;
|
|
@@ -1363,7 +1625,7 @@ function MdiWindowPickerDialog({
|
|
|
1363
1625
|
onClose,
|
|
1364
1626
|
windows
|
|
1365
1627
|
}) {
|
|
1366
|
-
const resolvedWindows =
|
|
1628
|
+
const resolvedWindows = useMemo4(
|
|
1367
1629
|
() => windows.filter(
|
|
1368
1630
|
(windowEntry) => isPickerEligibleWindow(windowEntry) && (!domain || windowEntry.domain === domain)
|
|
1369
1631
|
),
|
|
@@ -1383,7 +1645,7 @@ function MdiWindowPickerDialog({
|
|
|
1383
1645
|
onClose();
|
|
1384
1646
|
}
|
|
1385
1647
|
return /* @__PURE__ */ jsxs8(Stack, { gap: "md", children: [
|
|
1386
|
-
/* @__PURE__ */
|
|
1648
|
+
/* @__PURE__ */ jsx14(
|
|
1387
1649
|
ListBox,
|
|
1388
1650
|
{
|
|
1389
1651
|
data: [
|
|
@@ -1418,14 +1680,14 @@ function MdiWindowPickerDialog({
|
|
|
1418
1680
|
}
|
|
1419
1681
|
),
|
|
1420
1682
|
/* @__PURE__ */ jsxs8(Stack, { direction: "row", gap: "sm", children: [
|
|
1421
|
-
/* @__PURE__ */
|
|
1422
|
-
/* @__PURE__ */
|
|
1683
|
+
/* @__PURE__ */ jsx14(Button, { defaultFocused: true, onClick: handleActivate, children: "Activate" }),
|
|
1684
|
+
/* @__PURE__ */ jsx14(Button, { onClick: onClose, variant: "secondary", children: "Cancel" })
|
|
1423
1685
|
] })
|
|
1424
1686
|
] });
|
|
1425
1687
|
}
|
|
1426
1688
|
|
|
1427
1689
|
// src/windowing/mdiMenu.tsx
|
|
1428
|
-
import { jsx as
|
|
1690
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1429
1691
|
var MDI_HOST_ID = "mdi.host";
|
|
1430
1692
|
function createMdiDivider(id) {
|
|
1431
1693
|
return {
|
|
@@ -1464,7 +1726,7 @@ function openMdiWindowPicker(bridge) {
|
|
|
1464
1726
|
bridge.openDialog({
|
|
1465
1727
|
appModal: true,
|
|
1466
1728
|
border: "double",
|
|
1467
|
-
content: ({ close }) => /* @__PURE__ */
|
|
1729
|
+
content: ({ close }) => /* @__PURE__ */ jsx15(
|
|
1468
1730
|
MdiWindowPickerDialog,
|
|
1469
1731
|
{
|
|
1470
1732
|
activeWindowId,
|
|
@@ -1551,12 +1813,12 @@ function resolveMdiMainMenuItems(items, bridge) {
|
|
|
1551
1813
|
}
|
|
1552
1814
|
|
|
1553
1815
|
// src/appHost/appHostContext.ts
|
|
1554
|
-
import { createContext, useContext } from "react";
|
|
1555
|
-
var AppHostMenuContext =
|
|
1816
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
1817
|
+
var AppHostMenuContext = createContext2(
|
|
1556
1818
|
null
|
|
1557
1819
|
);
|
|
1558
1820
|
function useAppHostMenu() {
|
|
1559
|
-
const context =
|
|
1821
|
+
const context = useContext2(AppHostMenuContext);
|
|
1560
1822
|
if (!context) {
|
|
1561
1823
|
throw new Error("useAppHostMenu must be used within a NuAppHostProvider.");
|
|
1562
1824
|
}
|
|
@@ -1581,7 +1843,7 @@ function useAppHostMenu() {
|
|
|
1581
1843
|
}
|
|
1582
1844
|
|
|
1583
1845
|
// src/appHost/NuAppHostProvider.tsx
|
|
1584
|
-
import { jsx as
|
|
1846
|
+
import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1585
1847
|
function NuAppHostProvider({
|
|
1586
1848
|
children,
|
|
1587
1849
|
renderMenu = true
|
|
@@ -1590,11 +1852,11 @@ function NuAppHostProvider({
|
|
|
1590
1852
|
const [windowBridge, setWindowBridge] = useState6(
|
|
1591
1853
|
null
|
|
1592
1854
|
);
|
|
1593
|
-
const resolvedMainMenu =
|
|
1855
|
+
const resolvedMainMenu = useMemo5(
|
|
1594
1856
|
() => resolveMdiMainMenuItems(menuState.mainMenu, windowBridge),
|
|
1595
1857
|
[menuState.mainMenu, windowBridge]
|
|
1596
1858
|
);
|
|
1597
|
-
const contextValue =
|
|
1859
|
+
const contextValue = useMemo5(
|
|
1598
1860
|
() => ({
|
|
1599
1861
|
...menuState,
|
|
1600
1862
|
setWindowBridge,
|
|
@@ -1603,7 +1865,7 @@ function NuAppHostProvider({
|
|
|
1603
1865
|
[menuState, windowBridge]
|
|
1604
1866
|
);
|
|
1605
1867
|
return /* @__PURE__ */ jsxs9(AppHostMenuContext.Provider, { value: contextValue, children: [
|
|
1606
|
-
renderMenu && hasVisibleMainMenuItems(resolvedMainMenu) ? /* @__PURE__ */
|
|
1868
|
+
renderMenu && hasVisibleMainMenuItems(resolvedMainMenu) ? /* @__PURE__ */ jsx16(MainMenu, { items: resolvedMainMenu }) : null,
|
|
1607
1869
|
children
|
|
1608
1870
|
] });
|
|
1609
1871
|
}
|
|
@@ -1612,27 +1874,27 @@ function NuAppHostProvider({
|
|
|
1612
1874
|
import {
|
|
1613
1875
|
Fragment as Fragment3,
|
|
1614
1876
|
useCallback as useCallback3,
|
|
1615
|
-
useContext as
|
|
1616
|
-
useEffect as
|
|
1617
|
-
useMemo as
|
|
1618
|
-
useRef as
|
|
1877
|
+
useContext as useContext7,
|
|
1878
|
+
useEffect as useEffect6,
|
|
1879
|
+
useMemo as useMemo7,
|
|
1880
|
+
useRef as useRef7,
|
|
1619
1881
|
useState as useState9
|
|
1620
1882
|
} from "react";
|
|
1621
1883
|
|
|
1622
1884
|
// src/components/Window/Window.tsx
|
|
1623
1885
|
import {
|
|
1624
1886
|
memo as memo2,
|
|
1625
|
-
useContext as
|
|
1887
|
+
useContext as useContext5,
|
|
1626
1888
|
useLayoutEffect,
|
|
1627
|
-
useMemo as
|
|
1628
|
-
useRef as
|
|
1889
|
+
useMemo as useMemo6,
|
|
1890
|
+
useRef as useRef5
|
|
1629
1891
|
} from "react";
|
|
1630
1892
|
|
|
1631
1893
|
// src/components/Window/internals/WindowStatusBar.tsx
|
|
1632
1894
|
import { Children } from "react";
|
|
1633
1895
|
|
|
1634
1896
|
// src/components/Window/StatusBarItem.tsx
|
|
1635
|
-
import { jsx as
|
|
1897
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1636
1898
|
function StatusBarItem({
|
|
1637
1899
|
align = "start",
|
|
1638
1900
|
children,
|
|
@@ -1640,7 +1902,7 @@ function StatusBarItem({
|
|
|
1640
1902
|
grow = false,
|
|
1641
1903
|
...props
|
|
1642
1904
|
}) {
|
|
1643
|
-
return /* @__PURE__ */
|
|
1905
|
+
return /* @__PURE__ */ jsx17(
|
|
1644
1906
|
"span",
|
|
1645
1907
|
{
|
|
1646
1908
|
...props,
|
|
@@ -1656,7 +1918,7 @@ function StatusBarItem({
|
|
|
1656
1918
|
}
|
|
1657
1919
|
|
|
1658
1920
|
// src/components/Window/internals/WindowStatusBar.tsx
|
|
1659
|
-
import { jsx as
|
|
1921
|
+
import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1660
1922
|
function WindowStatusBar({
|
|
1661
1923
|
children,
|
|
1662
1924
|
onResizeStart,
|
|
@@ -1672,15 +1934,15 @@ function WindowStatusBar({
|
|
|
1672
1934
|
{
|
|
1673
1935
|
className: ["nu-window__status-bar", statusBarClassName].filter(Boolean).join(" "),
|
|
1674
1936
|
children: [
|
|
1675
|
-
/* @__PURE__ */
|
|
1676
|
-
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(
|
|
1677
1939
|
"button",
|
|
1678
1940
|
{
|
|
1679
1941
|
"aria-label": "Resize window",
|
|
1680
1942
|
className: "nu-window__resize-handle",
|
|
1681
1943
|
onPointerDown: onResizeStart,
|
|
1682
1944
|
type: "button",
|
|
1683
|
-
children: /* @__PURE__ */
|
|
1945
|
+
children: /* @__PURE__ */ jsx18(NuGlyph, { name: "window-resize" })
|
|
1684
1946
|
}
|
|
1685
1947
|
) : null
|
|
1686
1948
|
]
|
|
@@ -1689,18 +1951,18 @@ function WindowStatusBar({
|
|
|
1689
1951
|
}
|
|
1690
1952
|
|
|
1691
1953
|
// src/components/Window/WindowTitleButton.tsx
|
|
1692
|
-
import { jsx as
|
|
1954
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1693
1955
|
function renderWindowTriangleGlyph(icon) {
|
|
1694
1956
|
const glyphNameByIcon = {
|
|
1695
1957
|
maximize: "window-maximize",
|
|
1696
1958
|
minimize: "window-minimize",
|
|
1697
1959
|
restore: "window-restore"
|
|
1698
1960
|
};
|
|
1699
|
-
return /* @__PURE__ */
|
|
1961
|
+
return /* @__PURE__ */ jsx19(NuGlyph, { className: "nu-window__title-glyph", name: glyphNameByIcon[icon] });
|
|
1700
1962
|
}
|
|
1701
1963
|
function renderTitleButtonIcon(icon) {
|
|
1702
1964
|
if (icon === "close") {
|
|
1703
|
-
return /* @__PURE__ */
|
|
1965
|
+
return /* @__PURE__ */ jsx19(NuGlyph, { className: "nu-window__title-glyph", name: "window-close" });
|
|
1704
1966
|
}
|
|
1705
1967
|
if (icon === "minimize" || icon === "maximize" || icon === "restore") {
|
|
1706
1968
|
return renderWindowTriangleGlyph(
|
|
@@ -1719,7 +1981,7 @@ function WindowTitleButton({
|
|
|
1719
1981
|
variant = icon === "close" ? "close" : "default",
|
|
1720
1982
|
...props
|
|
1721
1983
|
}) {
|
|
1722
|
-
return /* @__PURE__ */
|
|
1984
|
+
return /* @__PURE__ */ jsx19(
|
|
1723
1985
|
"button",
|
|
1724
1986
|
{
|
|
1725
1987
|
...props,
|
|
@@ -1741,7 +2003,7 @@ function WindowTitleButton({
|
|
|
1741
2003
|
}
|
|
1742
2004
|
|
|
1743
2005
|
// src/components/Window/internals/WindowTitleBar.tsx
|
|
1744
|
-
import { jsx as
|
|
2006
|
+
import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1745
2007
|
function WindowTitleBar({
|
|
1746
2008
|
draggable,
|
|
1747
2009
|
onDragStart,
|
|
@@ -1759,8 +2021,8 @@ function WindowTitleBar({
|
|
|
1759
2021
|
"--nu-window-title-controls-width": controlsWidth
|
|
1760
2022
|
},
|
|
1761
2023
|
children: [
|
|
1762
|
-
/* @__PURE__ */
|
|
1763
|
-
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(
|
|
1764
2026
|
WindowTitleButton,
|
|
1765
2027
|
{
|
|
1766
2028
|
ariaLabel: button.ariaLabel,
|
|
@@ -1817,10 +2079,10 @@ function useWindowTitleButtons({
|
|
|
1817
2079
|
}
|
|
1818
2080
|
|
|
1819
2081
|
// src/windowing/windowContext.ts
|
|
1820
|
-
import { createContext as
|
|
1821
|
-
var NuWindowContext =
|
|
2082
|
+
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
2083
|
+
var NuWindowContext = createContext3(null);
|
|
1822
2084
|
function useNuWindowManager() {
|
|
1823
|
-
const context =
|
|
2085
|
+
const context = useContext3(NuWindowContext);
|
|
1824
2086
|
if (!context) {
|
|
1825
2087
|
throw new Error(
|
|
1826
2088
|
"useNuWindowManager must be used within a NuWindowProvider."
|
|
@@ -1830,10 +2092,10 @@ function useNuWindowManager() {
|
|
|
1830
2092
|
}
|
|
1831
2093
|
|
|
1832
2094
|
// src/components/Window/windowMenuContext.ts
|
|
1833
|
-
import { createContext as
|
|
1834
|
-
var WindowMenuContext =
|
|
2095
|
+
import { createContext as createContext4, useContext as useContext4 } from "react";
|
|
2096
|
+
var WindowMenuContext = createContext4(null);
|
|
1835
2097
|
function useWindowMenu() {
|
|
1836
|
-
const context =
|
|
2098
|
+
const context = useContext4(WindowMenuContext);
|
|
1837
2099
|
if (!context) {
|
|
1838
2100
|
throw new Error("useWindowMenu must be used within a Window menu scope.");
|
|
1839
2101
|
}
|
|
@@ -1841,7 +2103,7 @@ function useWindowMenu() {
|
|
|
1841
2103
|
}
|
|
1842
2104
|
|
|
1843
2105
|
// src/components/Window/Window.tsx
|
|
1844
|
-
import { jsx as
|
|
2106
|
+
import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1845
2107
|
function getWindowLayerBounds(node) {
|
|
1846
2108
|
const parentNode = node.parentElement;
|
|
1847
2109
|
if (!parentNode) {
|
|
@@ -1889,18 +2151,18 @@ function WindowInner({
|
|
|
1889
2151
|
title,
|
|
1890
2152
|
...props
|
|
1891
2153
|
}) {
|
|
1892
|
-
const windowRef =
|
|
1893
|
-
const dragFrameRef =
|
|
1894
|
-
const dragPositionRef =
|
|
1895
|
-
const resizeFrameRef =
|
|
1896
|
-
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);
|
|
1897
2159
|
const menuState = useMainMenuState();
|
|
1898
|
-
const windowManager =
|
|
2160
|
+
const windowManager = useContext5(NuWindowContext);
|
|
1899
2161
|
const isDraggable = draggable ?? mode === "window";
|
|
1900
2162
|
const isMaximizable = maximizable ?? mode === "window";
|
|
1901
2163
|
const isMinimizable = minimizable ?? mode === "window";
|
|
1902
2164
|
const isResizable = resizable ?? mode === "window";
|
|
1903
|
-
const mdiBridge =
|
|
2165
|
+
const mdiBridge = useMemo6(
|
|
1904
2166
|
() => ({
|
|
1905
2167
|
activateWindow: windowManager?.activateWindow ?? (() => void 0),
|
|
1906
2168
|
openDialog: windowManager?.openDialog ?? (() => ""),
|
|
@@ -1908,7 +2170,7 @@ function WindowInner({
|
|
|
1908
2170
|
}),
|
|
1909
2171
|
[windowManager?.activateWindow, windowManager?.openDialog, windowManager?.windows]
|
|
1910
2172
|
);
|
|
1911
|
-
const resolvedMainMenu =
|
|
2173
|
+
const resolvedMainMenu = useMemo6(
|
|
1912
2174
|
() => resolveMdiMainMenuItems(menuState.mainMenu, mdiBridge),
|
|
1913
2175
|
[menuState.mainMenu, mdiBridge]
|
|
1914
2176
|
);
|
|
@@ -2136,14 +2398,14 @@ function WindowInner({
|
|
|
2136
2398
|
ref: windowRef,
|
|
2137
2399
|
style,
|
|
2138
2400
|
children: [
|
|
2139
|
-
/* @__PURE__ */
|
|
2401
|
+
/* @__PURE__ */ jsx21(
|
|
2140
2402
|
"span",
|
|
2141
2403
|
{
|
|
2142
2404
|
"aria-hidden": true,
|
|
2143
2405
|
className: "nu-window__shadow nu-window__shadow--right"
|
|
2144
2406
|
}
|
|
2145
2407
|
),
|
|
2146
|
-
/* @__PURE__ */
|
|
2408
|
+
/* @__PURE__ */ jsx21(
|
|
2147
2409
|
"span",
|
|
2148
2410
|
{
|
|
2149
2411
|
"aria-hidden": true,
|
|
@@ -2151,7 +2413,7 @@ function WindowInner({
|
|
|
2151
2413
|
}
|
|
2152
2414
|
),
|
|
2153
2415
|
/* @__PURE__ */ jsxs12(WindowMenuContext.Provider, { value: menuState, children: [
|
|
2154
|
-
/* @__PURE__ */
|
|
2416
|
+
/* @__PURE__ */ jsx21(
|
|
2155
2417
|
WindowTitleBar,
|
|
2156
2418
|
{
|
|
2157
2419
|
draggable: isDraggable,
|
|
@@ -2160,8 +2422,8 @@ function WindowInner({
|
|
|
2160
2422
|
titleButtons: resolvedTitleButtons
|
|
2161
2423
|
}
|
|
2162
2424
|
),
|
|
2163
|
-
hasVisibleMainMenuItems(resolvedMainMenu) ? /* @__PURE__ */
|
|
2164
|
-
/* @__PURE__ */
|
|
2425
|
+
hasVisibleMainMenuItems(resolvedMainMenu) ? /* @__PURE__ */ jsx21(MainMenu, { items: resolvedMainMenu }) : null,
|
|
2426
|
+
/* @__PURE__ */ jsx21(
|
|
2165
2427
|
"div",
|
|
2166
2428
|
{
|
|
2167
2429
|
className: [
|
|
@@ -2172,7 +2434,7 @@ function WindowInner({
|
|
|
2172
2434
|
children
|
|
2173
2435
|
}
|
|
2174
2436
|
),
|
|
2175
|
-
mode === "window" && (statusBar || isResizable) ? /* @__PURE__ */
|
|
2437
|
+
mode === "window" && (statusBar || isResizable) ? /* @__PURE__ */ jsx21(
|
|
2176
2438
|
WindowStatusBar,
|
|
2177
2439
|
{
|
|
2178
2440
|
onResizeStart: handleResizePointerDown,
|
|
@@ -2189,9 +2451,9 @@ function WindowInner({
|
|
|
2189
2451
|
var Window = memo2(WindowInner);
|
|
2190
2452
|
|
|
2191
2453
|
// src/windowing/AppBarHost.tsx
|
|
2192
|
-
import { jsx as
|
|
2454
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
2193
2455
|
function AppBarHost({ children, inline = false }) {
|
|
2194
|
-
return /* @__PURE__ */
|
|
2456
|
+
return /* @__PURE__ */ jsx22(
|
|
2195
2457
|
"aside",
|
|
2196
2458
|
{
|
|
2197
2459
|
className: [
|
|
@@ -2207,7 +2469,7 @@ function AppBarHost({ children, inline = false }) {
|
|
|
2207
2469
|
}
|
|
2208
2470
|
|
|
2209
2471
|
// src/windowing/WindowBar.tsx
|
|
2210
|
-
import { useContext as
|
|
2472
|
+
import { useContext as useContext6 } from "react";
|
|
2211
2473
|
|
|
2212
2474
|
// src/windowing/AppBarItem.tsx
|
|
2213
2475
|
import {
|
|
@@ -2281,7 +2543,7 @@ function AppBarItem(props) {
|
|
|
2281
2543
|
}
|
|
2282
2544
|
|
|
2283
2545
|
// src/windowing/WindowBar.tsx
|
|
2284
|
-
import { jsx as
|
|
2546
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
2285
2547
|
function buildWindowBarGroups(items) {
|
|
2286
2548
|
const groups = [];
|
|
2287
2549
|
const groupsByDomain = /* @__PURE__ */ new Map();
|
|
@@ -2315,7 +2577,7 @@ function buildWindowBarGroups(items) {
|
|
|
2315
2577
|
return groups;
|
|
2316
2578
|
}
|
|
2317
2579
|
function WindowBar({ items, onActivateWindow }) {
|
|
2318
|
-
const windowManager =
|
|
2580
|
+
const windowManager = useContext6(NuWindowContext);
|
|
2319
2581
|
const groups = buildWindowBarGroups(items);
|
|
2320
2582
|
function activateGroup(group) {
|
|
2321
2583
|
if (group.items.length <= 1) {
|
|
@@ -2333,7 +2595,7 @@ function WindowBar({ items, onActivateWindow }) {
|
|
|
2333
2595
|
const dialogDefinition = {
|
|
2334
2596
|
appModal: true,
|
|
2335
2597
|
border: "double",
|
|
2336
|
-
content: ({ close }) => /* @__PURE__ */
|
|
2598
|
+
content: ({ close }) => /* @__PURE__ */ jsx23(
|
|
2337
2599
|
MdiWindowPickerDialog,
|
|
2338
2600
|
{
|
|
2339
2601
|
activeWindowId: activeGroupWindowId,
|
|
@@ -2354,7 +2616,7 @@ function WindowBar({ items, onActivateWindow }) {
|
|
|
2354
2616
|
};
|
|
2355
2617
|
windowManager.openDialog(dialogDefinition);
|
|
2356
2618
|
}
|
|
2357
|
-
return /* @__PURE__ */
|
|
2619
|
+
return /* @__PURE__ */ jsx23("div", { className: "nu-window-bar", role: "group", "aria-label": "Open windows", children: groups.map((group) => /* @__PURE__ */ jsx23(
|
|
2358
2620
|
AppBarItem,
|
|
2359
2621
|
{
|
|
2360
2622
|
active: group.active,
|
|
@@ -2372,12 +2634,12 @@ import { useState as useState8 } from "react";
|
|
|
2372
2634
|
|
|
2373
2635
|
// src/components/TextField/TextField.tsx
|
|
2374
2636
|
import {
|
|
2375
|
-
useEffect as
|
|
2637
|
+
useEffect as useEffect5,
|
|
2376
2638
|
useId as useId2,
|
|
2377
|
-
useRef as
|
|
2639
|
+
useRef as useRef6,
|
|
2378
2640
|
useState as useState7
|
|
2379
2641
|
} from "react";
|
|
2380
|
-
import { jsx as
|
|
2642
|
+
import { jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2381
2643
|
function TextField({
|
|
2382
2644
|
className,
|
|
2383
2645
|
debounceMs = 0,
|
|
@@ -2398,12 +2660,12 @@ function TextField({
|
|
|
2398
2660
|
const fieldId = id ?? generatedId;
|
|
2399
2661
|
const hintId = hint ? `${fieldId}-hint` : void 0;
|
|
2400
2662
|
const isControlled = value !== void 0;
|
|
2401
|
-
const hasMountedRef =
|
|
2663
|
+
const hasMountedRef = useRef6(false);
|
|
2402
2664
|
const [uncontrolledValue, setUncontrolledValue] = useState7(
|
|
2403
2665
|
() => defaultValue == null ? "" : String(defaultValue)
|
|
2404
2666
|
);
|
|
2405
2667
|
const resolvedValue = isControlled ? value == null ? "" : String(value) : uncontrolledValue;
|
|
2406
|
-
|
|
2668
|
+
useEffect5(() => {
|
|
2407
2669
|
if (!onDebouncedChange) {
|
|
2408
2670
|
return;
|
|
2409
2671
|
}
|
|
@@ -2435,7 +2697,7 @@ function TextField({
|
|
|
2435
2697
|
htmlFor: fieldId,
|
|
2436
2698
|
style: slotStyles?.root,
|
|
2437
2699
|
children: [
|
|
2438
|
-
/* @__PURE__ */
|
|
2700
|
+
/* @__PURE__ */ jsx24(
|
|
2439
2701
|
"span",
|
|
2440
2702
|
{
|
|
2441
2703
|
className: cx("nu-text-field__label", slotClassNames?.label),
|
|
@@ -2449,7 +2711,7 @@ function TextField({
|
|
|
2449
2711
|
className: cx("nu-text-field__slot", slotClassNames?.slot),
|
|
2450
2712
|
style: slotStyles?.slot,
|
|
2451
2713
|
children: [
|
|
2452
|
-
/* @__PURE__ */
|
|
2714
|
+
/* @__PURE__ */ jsx24(
|
|
2453
2715
|
"span",
|
|
2454
2716
|
{
|
|
2455
2717
|
"aria-hidden": "true",
|
|
@@ -2458,7 +2720,7 @@ function TextField({
|
|
|
2458
2720
|
children: "["
|
|
2459
2721
|
}
|
|
2460
2722
|
),
|
|
2461
|
-
/* @__PURE__ */
|
|
2723
|
+
/* @__PURE__ */ jsx24(
|
|
2462
2724
|
"span",
|
|
2463
2725
|
{
|
|
2464
2726
|
className: cx(
|
|
@@ -2466,7 +2728,7 @@ function TextField({
|
|
|
2466
2728
|
slotClassNames?.inputShell
|
|
2467
2729
|
),
|
|
2468
2730
|
style: slotStyles?.inputShell,
|
|
2469
|
-
children: /* @__PURE__ */
|
|
2731
|
+
children: /* @__PURE__ */ jsx24(
|
|
2470
2732
|
"input",
|
|
2471
2733
|
{
|
|
2472
2734
|
...props,
|
|
@@ -2485,7 +2747,7 @@ function TextField({
|
|
|
2485
2747
|
)
|
|
2486
2748
|
}
|
|
2487
2749
|
),
|
|
2488
|
-
/* @__PURE__ */
|
|
2750
|
+
/* @__PURE__ */ jsx24(
|
|
2489
2751
|
"span",
|
|
2490
2752
|
{
|
|
2491
2753
|
"aria-hidden": "true",
|
|
@@ -2497,7 +2759,7 @@ function TextField({
|
|
|
2497
2759
|
]
|
|
2498
2760
|
}
|
|
2499
2761
|
),
|
|
2500
|
-
hint ? /* @__PURE__ */
|
|
2762
|
+
hint ? /* @__PURE__ */ jsx24(
|
|
2501
2763
|
"span",
|
|
2502
2764
|
{
|
|
2503
2765
|
className: cx("nu-text-field__hint", slotClassNames?.hint),
|
|
@@ -2512,7 +2774,7 @@ function TextField({
|
|
|
2512
2774
|
}
|
|
2513
2775
|
|
|
2514
2776
|
// src/components/View/NuView.tsx
|
|
2515
|
-
import { jsx as
|
|
2777
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
2516
2778
|
function NuView({
|
|
2517
2779
|
children,
|
|
2518
2780
|
className,
|
|
@@ -2521,7 +2783,7 @@ function NuView({
|
|
|
2521
2783
|
scroll = "auto",
|
|
2522
2784
|
...props
|
|
2523
2785
|
}) {
|
|
2524
|
-
return /* @__PURE__ */
|
|
2786
|
+
return /* @__PURE__ */ jsx25(
|
|
2525
2787
|
"div",
|
|
2526
2788
|
{
|
|
2527
2789
|
...props,
|
|
@@ -2535,7 +2797,7 @@ function NuView({
|
|
|
2535
2797
|
}
|
|
2536
2798
|
|
|
2537
2799
|
// src/windowing/dialogHelpers.tsx
|
|
2538
|
-
import { jsx as
|
|
2800
|
+
import { jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2539
2801
|
function getPresetButtons(preset) {
|
|
2540
2802
|
switch (preset) {
|
|
2541
2803
|
case "ok-cancel":
|
|
@@ -2638,8 +2900,8 @@ function MessageBoxDialogContent({
|
|
|
2638
2900
|
const bodyStyle = kind === "error" ? {
|
|
2639
2901
|
background: "var(--nu-color-button-danger)"
|
|
2640
2902
|
} : void 0;
|
|
2641
|
-
return /* @__PURE__ */
|
|
2642
|
-
/* @__PURE__ */
|
|
2903
|
+
return /* @__PURE__ */ jsx26(NuView, { padding: "cell", style: bodyStyle, children: /* @__PURE__ */ jsxs14(Stack, { gap: "md", children: [
|
|
2904
|
+
/* @__PURE__ */ jsx26(
|
|
2643
2905
|
"div",
|
|
2644
2906
|
{
|
|
2645
2907
|
style: tone ? {
|
|
@@ -2649,7 +2911,7 @@ function MessageBoxDialogContent({
|
|
|
2649
2911
|
}
|
|
2650
2912
|
),
|
|
2651
2913
|
/* @__PURE__ */ jsxs14(Stack, { direction: "row", gap: "sm", justify: "center", children: [
|
|
2652
|
-
ok ? /* @__PURE__ */
|
|
2914
|
+
ok ? /* @__PURE__ */ jsx26(
|
|
2653
2915
|
Button,
|
|
2654
2916
|
{
|
|
2655
2917
|
className: "nu-dialog-helper__button",
|
|
@@ -2658,7 +2920,7 @@ function MessageBoxDialogContent({
|
|
|
2658
2920
|
children: okLabel
|
|
2659
2921
|
}
|
|
2660
2922
|
) : null,
|
|
2661
|
-
yes ? /* @__PURE__ */
|
|
2923
|
+
yes ? /* @__PURE__ */ jsx26(
|
|
2662
2924
|
Button,
|
|
2663
2925
|
{
|
|
2664
2926
|
className: "nu-dialog-helper__button",
|
|
@@ -2667,7 +2929,7 @@ function MessageBoxDialogContent({
|
|
|
2667
2929
|
children: yesLabel
|
|
2668
2930
|
}
|
|
2669
2931
|
) : null,
|
|
2670
|
-
no ? /* @__PURE__ */
|
|
2932
|
+
no ? /* @__PURE__ */ jsx26(
|
|
2671
2933
|
Button,
|
|
2672
2934
|
{
|
|
2673
2935
|
className: "nu-dialog-helper__button",
|
|
@@ -2676,7 +2938,7 @@ function MessageBoxDialogContent({
|
|
|
2676
2938
|
children: noLabel
|
|
2677
2939
|
}
|
|
2678
2940
|
) : null,
|
|
2679
|
-
cancel ? /* @__PURE__ */
|
|
2941
|
+
cancel ? /* @__PURE__ */ jsx26(
|
|
2680
2942
|
Button,
|
|
2681
2943
|
{
|
|
2682
2944
|
className: "nu-dialog-helper__button",
|
|
@@ -2698,8 +2960,8 @@ function InputBoxDialogContent({
|
|
|
2698
2960
|
placeholder
|
|
2699
2961
|
}) {
|
|
2700
2962
|
const [value, setValue] = useState8(defaultValue ?? "");
|
|
2701
|
-
return /* @__PURE__ */
|
|
2702
|
-
/* @__PURE__ */
|
|
2963
|
+
return /* @__PURE__ */ jsx26(NuView, { padding: "cell", children: /* @__PURE__ */ jsxs14(Stack, { gap: "md", children: [
|
|
2964
|
+
/* @__PURE__ */ jsx26(
|
|
2703
2965
|
TextField,
|
|
2704
2966
|
{
|
|
2705
2967
|
autoFocus: true,
|
|
@@ -2711,7 +2973,7 @@ function InputBoxDialogContent({
|
|
|
2711
2973
|
}
|
|
2712
2974
|
),
|
|
2713
2975
|
/* @__PURE__ */ jsxs14(Stack, { direction: "row", gap: "sm", justify: "center", children: [
|
|
2714
|
-
/* @__PURE__ */
|
|
2976
|
+
/* @__PURE__ */ jsx26(
|
|
2715
2977
|
Button,
|
|
2716
2978
|
{
|
|
2717
2979
|
className: "nu-dialog-helper__button",
|
|
@@ -2720,7 +2982,7 @@ function InputBoxDialogContent({
|
|
|
2720
2982
|
children: okLabel
|
|
2721
2983
|
}
|
|
2722
2984
|
),
|
|
2723
|
-
/* @__PURE__ */
|
|
2985
|
+
/* @__PURE__ */ jsx26(
|
|
2724
2986
|
Button,
|
|
2725
2987
|
{
|
|
2726
2988
|
className: "nu-dialog-helper__button",
|
|
@@ -2734,7 +2996,7 @@ function InputBoxDialogContent({
|
|
|
2734
2996
|
}
|
|
2735
2997
|
|
|
2736
2998
|
// src/windowing/NuWindowProvider.tsx
|
|
2737
|
-
import { jsx as
|
|
2999
|
+
import { jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2738
3000
|
function getDefaultWindowStyle(mode, index) {
|
|
2739
3001
|
const offset = index * 18;
|
|
2740
3002
|
return {
|
|
@@ -2878,12 +3140,12 @@ function NuWindowProvider({
|
|
|
2878
3140
|
onAppModalChange,
|
|
2879
3141
|
renderAppBar = false
|
|
2880
3142
|
}) {
|
|
2881
|
-
const creationOrderRef =
|
|
2882
|
-
const idRef =
|
|
2883
|
-
const windowBoundsByIdRef =
|
|
3143
|
+
const creationOrderRef = useRef7(0);
|
|
3144
|
+
const idRef = useRef7(0);
|
|
3145
|
+
const windowBoundsByIdRef = useRef7({});
|
|
2884
3146
|
const [windows, setWindows] = useState9([]);
|
|
2885
3147
|
const [windowBoundsById, setWindowBoundsById] = useState9({});
|
|
2886
|
-
const appHostMenuContext =
|
|
3148
|
+
const appHostMenuContext = useContext7(AppHostMenuContext);
|
|
2887
3149
|
const nextId = useCallback3(() => {
|
|
2888
3150
|
idRef.current += 1;
|
|
2889
3151
|
return `nu-window-${idRef.current}`;
|
|
@@ -3128,7 +3390,7 @@ function NuWindowProvider({
|
|
|
3128
3390
|
openDialog({
|
|
3129
3391
|
appModal: options.appModal ?? true,
|
|
3130
3392
|
closeable: true,
|
|
3131
|
-
content: ({ close }) => /* @__PURE__ */
|
|
3393
|
+
content: ({ close }) => /* @__PURE__ */ jsx27(
|
|
3132
3394
|
MessageBoxDialogContent,
|
|
3133
3395
|
{
|
|
3134
3396
|
cancel: buttons.cancel,
|
|
@@ -3171,7 +3433,7 @@ function NuWindowProvider({
|
|
|
3171
3433
|
openDialog({
|
|
3172
3434
|
appModal: options.appModal ?? true,
|
|
3173
3435
|
closeable: true,
|
|
3174
|
-
content: ({ close }) => /* @__PURE__ */
|
|
3436
|
+
content: ({ close }) => /* @__PURE__ */ jsx27(
|
|
3175
3437
|
InputBoxDialogContent,
|
|
3176
3438
|
{
|
|
3177
3439
|
cancelLabel: options.cancelLabel ?? "&Cancel",
|
|
@@ -3210,7 +3472,7 @@ function NuWindowProvider({
|
|
|
3210
3472
|
const topmostAppModalId = topmostAppModalIndex >= 0 ? visibleWindows[topmostAppModalIndex]?.id : void 0;
|
|
3211
3473
|
const activeWindowId = topmostAppModalIndex >= 0 ? visibleWindows[topmostAppModalIndex]?.id : visibleWindows[visibleWindows.length - 1]?.id;
|
|
3212
3474
|
const hasAppModal = topmostAppModalIndex >= 0;
|
|
3213
|
-
const windowsInfo =
|
|
3475
|
+
const windowsInfo = useMemo7(
|
|
3214
3476
|
() => [...windows].sort(
|
|
3215
3477
|
(leftWindow, rightWindow) => leftWindow.creationOrder - rightWindow.creationOrder
|
|
3216
3478
|
).map((windowEntry) => ({
|
|
@@ -3236,7 +3498,7 @@ function NuWindowProvider({
|
|
|
3236
3498
|
})),
|
|
3237
3499
|
[activeWindowId, windows]
|
|
3238
3500
|
);
|
|
3239
|
-
const mdiBridge =
|
|
3501
|
+
const mdiBridge = useMemo7(
|
|
3240
3502
|
() => ({
|
|
3241
3503
|
activateWindow,
|
|
3242
3504
|
openDialog,
|
|
@@ -3244,7 +3506,7 @@ function NuWindowProvider({
|
|
|
3244
3506
|
}),
|
|
3245
3507
|
[activateWindow, openDialog, windowsInfo]
|
|
3246
3508
|
);
|
|
3247
|
-
const contextValue =
|
|
3509
|
+
const contextValue = useMemo7(
|
|
3248
3510
|
() => ({
|
|
3249
3511
|
activateWindow,
|
|
3250
3512
|
bringToFront,
|
|
@@ -3274,13 +3536,13 @@ function NuWindowProvider({
|
|
|
3274
3536
|
windowsInfo
|
|
3275
3537
|
]
|
|
3276
3538
|
);
|
|
3277
|
-
|
|
3539
|
+
useEffect6(() => {
|
|
3278
3540
|
if (!appHostMenuContext) {
|
|
3279
3541
|
return;
|
|
3280
3542
|
}
|
|
3281
3543
|
appHostMenuContext.setWindowBridge(mdiBridge);
|
|
3282
3544
|
}, [appHostMenuContext, mdiBridge]);
|
|
3283
|
-
|
|
3545
|
+
useEffect6(() => {
|
|
3284
3546
|
if (!appHostMenuContext) {
|
|
3285
3547
|
return;
|
|
3286
3548
|
}
|
|
@@ -3288,12 +3550,12 @@ function NuWindowProvider({
|
|
|
3288
3550
|
appHostMenuContext.setWindowBridge(null);
|
|
3289
3551
|
};
|
|
3290
3552
|
}, [appHostMenuContext]);
|
|
3291
|
-
|
|
3553
|
+
useEffect6(() => {
|
|
3292
3554
|
onAppModalChange?.(hasAppModal);
|
|
3293
3555
|
}, [hasAppModal, onAppModalChange]);
|
|
3294
|
-
return /* @__PURE__ */
|
|
3556
|
+
return /* @__PURE__ */ jsx27(NuWindowContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs15("div", { className: ["nu-window-host", className].filter(Boolean).join(" "), children: [
|
|
3295
3557
|
children,
|
|
3296
|
-
/* @__PURE__ */
|
|
3558
|
+
/* @__PURE__ */ jsx27("div", { className: "nu-window-layer", children: renderWindows.map((windowEntry) => {
|
|
3297
3559
|
const isActiveWindow = windowEntry.id === activeWindowId;
|
|
3298
3560
|
const stackIndex = stackIndexById.get(windowEntry.id);
|
|
3299
3561
|
const isTopmostAppModal = windowEntry.id === topmostAppModalId;
|
|
@@ -3323,20 +3585,20 @@ function NuWindowProvider({
|
|
|
3323
3585
|
};
|
|
3324
3586
|
const content = typeof windowEntry.content === "function" ? windowEntry.content(controls) : windowEntry.content;
|
|
3325
3587
|
return /* @__PURE__ */ jsxs15(Fragment3, { children: [
|
|
3326
|
-
isTopmostAppModal ? /* @__PURE__ */
|
|
3588
|
+
isTopmostAppModal ? /* @__PURE__ */ jsx27(
|
|
3327
3589
|
"div",
|
|
3328
3590
|
{
|
|
3329
3591
|
className: "nu-window-layer__modal-backdrop",
|
|
3330
3592
|
style: { zIndex: visibleWindows.length + 1 }
|
|
3331
3593
|
}
|
|
3332
|
-
) : ownerBackdropStyle ? /* @__PURE__ */
|
|
3594
|
+
) : ownerBackdropStyle ? /* @__PURE__ */ jsx27(
|
|
3333
3595
|
"div",
|
|
3334
3596
|
{
|
|
3335
3597
|
className: "nu-window-layer__modal-backdrop",
|
|
3336
3598
|
style: ownerBackdropStyle
|
|
3337
3599
|
}
|
|
3338
3600
|
) : null,
|
|
3339
|
-
/* @__PURE__ */
|
|
3601
|
+
/* @__PURE__ */ jsx27(
|
|
3340
3602
|
Window,
|
|
3341
3603
|
{
|
|
3342
3604
|
active: isActiveWindow,
|
|
@@ -3369,7 +3631,7 @@ function NuWindowProvider({
|
|
|
3369
3631
|
)
|
|
3370
3632
|
] }, windowEntry.id);
|
|
3371
3633
|
}) }),
|
|
3372
|
-
renderAppBar ? /* @__PURE__ */
|
|
3634
|
+
renderAppBar ? /* @__PURE__ */ jsx27(AppBarHost, { children: /* @__PURE__ */ jsx27(
|
|
3373
3635
|
WindowBar,
|
|
3374
3636
|
{
|
|
3375
3637
|
items: windowsInfo.map((windowEntry) => ({
|
|
@@ -3386,11 +3648,11 @@ function NuWindowProvider({
|
|
|
3386
3648
|
}
|
|
3387
3649
|
|
|
3388
3650
|
// src/components/Desktop/Desktop.tsx
|
|
3389
|
-
import { jsx as
|
|
3651
|
+
import { jsx as jsx28, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3390
3652
|
function DesktopWindowRegion({ appBar, children }) {
|
|
3391
3653
|
return /* @__PURE__ */ jsxs16(Fragment4, { children: [
|
|
3392
|
-
/* @__PURE__ */
|
|
3393
|
-
appBar ? /* @__PURE__ */
|
|
3654
|
+
/* @__PURE__ */ jsx28("div", { className: "nu-desktop__workspace", children }),
|
|
3655
|
+
appBar ? /* @__PURE__ */ jsx28("div", { className: "nu-desktop__app-bar", children: appBar }) : null
|
|
3394
3656
|
] });
|
|
3395
3657
|
}
|
|
3396
3658
|
function NuDesktop({
|
|
@@ -3401,11 +3663,11 @@ function NuDesktop({
|
|
|
3401
3663
|
...props
|
|
3402
3664
|
}) {
|
|
3403
3665
|
const [hasAppModal, setHasAppModal] = useState10(false);
|
|
3404
|
-
const appHostContext =
|
|
3666
|
+
const appHostContext = useContext8(AppHostMenuContext);
|
|
3405
3667
|
if (appHostContext) {
|
|
3406
3668
|
throw new Error("NuDesktop should not be nested inside another app host.");
|
|
3407
3669
|
}
|
|
3408
|
-
return /* @__PURE__ */
|
|
3670
|
+
return /* @__PURE__ */ jsx28(NuAppHostProvider, { renderMenu: false, children: /* @__PURE__ */ jsx28(
|
|
3409
3671
|
NuDesktopShell,
|
|
3410
3672
|
{
|
|
3411
3673
|
appBar: appBar ?? appBarContent,
|
|
@@ -3425,7 +3687,7 @@ function NuDesktopShell({
|
|
|
3425
3687
|
onAppModalChange,
|
|
3426
3688
|
props
|
|
3427
3689
|
}) {
|
|
3428
|
-
const appHostContext =
|
|
3690
|
+
const appHostContext = useContext8(AppHostMenuContext);
|
|
3429
3691
|
if (!appHostContext) {
|
|
3430
3692
|
throw new Error("NuDesktop must be used within a NuAppHostProvider.");
|
|
3431
3693
|
}
|
|
@@ -3440,14 +3702,14 @@ function NuDesktopShell({
|
|
|
3440
3702
|
className: ["nu-desktop", className].filter(Boolean).join(" "),
|
|
3441
3703
|
"data-modal-active": hasAppModal || void 0,
|
|
3442
3704
|
children: [
|
|
3443
|
-
hasVisibleMainMenuItems(resolvedMainMenu) ? /* @__PURE__ */
|
|
3444
|
-
/* @__PURE__ */
|
|
3705
|
+
hasVisibleMainMenuItems(resolvedMainMenu) ? /* @__PURE__ */ jsx28("div", { className: "nu-desktop__menu", children: /* @__PURE__ */ jsx28(MainMenu, { items: resolvedMainMenu }) }) : null,
|
|
3706
|
+
/* @__PURE__ */ jsx28(
|
|
3445
3707
|
NuWindowProvider,
|
|
3446
3708
|
{
|
|
3447
3709
|
className: "nu-desktop__window-region",
|
|
3448
3710
|
onAppModalChange,
|
|
3449
3711
|
renderAppBar: false,
|
|
3450
|
-
children: /* @__PURE__ */
|
|
3712
|
+
children: /* @__PURE__ */ jsx28(DesktopWindowRegion, { appBar, children })
|
|
3451
3713
|
}
|
|
3452
3714
|
)
|
|
3453
3715
|
]
|
|
@@ -3456,7 +3718,7 @@ function NuDesktopShell({
|
|
|
3456
3718
|
}
|
|
3457
3719
|
|
|
3458
3720
|
// src/components/Dashboard/Dashboard.tsx
|
|
3459
|
-
import { jsx as
|
|
3721
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
3460
3722
|
function resolveDashboardGap(gap) {
|
|
3461
3723
|
if (typeof gap === "number") {
|
|
3462
3724
|
return `${gap}px`;
|
|
@@ -3477,7 +3739,7 @@ function Dashboard({
|
|
|
3477
3739
|
const resolvedGap = resolveDashboardGap(gap);
|
|
3478
3740
|
if (layout === "lanes") {
|
|
3479
3741
|
const lanes = Array.from({ length: laneCount }, (_, index) => index + 1);
|
|
3480
|
-
return /* @__PURE__ */
|
|
3742
|
+
return /* @__PURE__ */ jsx29(
|
|
3481
3743
|
"div",
|
|
3482
3744
|
{
|
|
3483
3745
|
...props,
|
|
@@ -3489,7 +3751,7 @@ function Dashboard({
|
|
|
3489
3751
|
"--nu-dashboard-gap": resolvedGap,
|
|
3490
3752
|
"--nu-dashboard-lane-count": laneCount
|
|
3491
3753
|
},
|
|
3492
|
-
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(
|
|
3493
3755
|
"div",
|
|
3494
3756
|
{
|
|
3495
3757
|
className: "nu-dashboard__cell",
|
|
@@ -3501,14 +3763,14 @@ function Dashboard({
|
|
|
3501
3763
|
minWidth: item.minWidth,
|
|
3502
3764
|
width: item.width
|
|
3503
3765
|
},
|
|
3504
|
-
children: /* @__PURE__ */
|
|
3766
|
+
children: /* @__PURE__ */ jsx29("div", { className: "nu-dashboard__content", children: item.content })
|
|
3505
3767
|
},
|
|
3506
3768
|
item.id
|
|
3507
3769
|
)) }, lane))
|
|
3508
3770
|
}
|
|
3509
3771
|
);
|
|
3510
3772
|
}
|
|
3511
|
-
return /* @__PURE__ */
|
|
3773
|
+
return /* @__PURE__ */ jsx29(
|
|
3512
3774
|
"div",
|
|
3513
3775
|
{
|
|
3514
3776
|
...props,
|
|
@@ -3519,7 +3781,7 @@ function Dashboard({
|
|
|
3519
3781
|
"--nu-dashboard-column-count": columnCount,
|
|
3520
3782
|
"--nu-dashboard-gap": resolvedGap
|
|
3521
3783
|
},
|
|
3522
|
-
children: items.map((item) => /* @__PURE__ */
|
|
3784
|
+
children: items.map((item) => /* @__PURE__ */ jsx29(
|
|
3523
3785
|
"div",
|
|
3524
3786
|
{
|
|
3525
3787
|
className: "nu-dashboard__cell",
|
|
@@ -3533,7 +3795,7 @@ function Dashboard({
|
|
|
3533
3795
|
minWidth: item.minWidth,
|
|
3534
3796
|
width: item.width
|
|
3535
3797
|
},
|
|
3536
|
-
children: /* @__PURE__ */
|
|
3798
|
+
children: /* @__PURE__ */ jsx29("div", { className: "nu-dashboard__content", children: item.content })
|
|
3537
3799
|
},
|
|
3538
3800
|
item.id
|
|
3539
3801
|
))
|
|
@@ -3543,7 +3805,7 @@ function Dashboard({
|
|
|
3543
3805
|
|
|
3544
3806
|
// src/components/CheckBox/CheckBox.tsx
|
|
3545
3807
|
import { useId as useId3, useState as useState11 } from "react";
|
|
3546
|
-
import { jsx as
|
|
3808
|
+
import { jsx as jsx30, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3547
3809
|
function CheckBox({
|
|
3548
3810
|
checked,
|
|
3549
3811
|
className,
|
|
@@ -3582,7 +3844,7 @@ function CheckBox({
|
|
|
3582
3844
|
className: cx("nu-check-box__main", slotClassNames?.main),
|
|
3583
3845
|
style: slotStyles?.main,
|
|
3584
3846
|
children: [
|
|
3585
|
-
/* @__PURE__ */
|
|
3847
|
+
/* @__PURE__ */ jsx30(
|
|
3586
3848
|
"input",
|
|
3587
3849
|
{
|
|
3588
3850
|
...props,
|
|
@@ -3596,19 +3858,19 @@ function CheckBox({
|
|
|
3596
3858
|
type: "checkbox"
|
|
3597
3859
|
}
|
|
3598
3860
|
),
|
|
3599
|
-
/* @__PURE__ */
|
|
3861
|
+
/* @__PURE__ */ jsx30(
|
|
3600
3862
|
"span",
|
|
3601
3863
|
{
|
|
3602
3864
|
"aria-hidden": "true",
|
|
3603
3865
|
className: cx("nu-check-box__control", slotClassNames?.control),
|
|
3604
3866
|
style: slotStyles?.control,
|
|
3605
|
-
children: /* @__PURE__ */
|
|
3867
|
+
children: /* @__PURE__ */ jsx30(
|
|
3606
3868
|
"span",
|
|
3607
3869
|
{
|
|
3608
3870
|
className: cx("nu-check-box__box", slotClassNames?.box),
|
|
3609
3871
|
"data-unchecked-shape": uncheckedShape,
|
|
3610
3872
|
style: slotStyles?.box,
|
|
3611
|
-
children: resolvedChecked ? /* @__PURE__ */
|
|
3873
|
+
children: resolvedChecked ? /* @__PURE__ */ jsx30(
|
|
3612
3874
|
NuGlyph,
|
|
3613
3875
|
{
|
|
3614
3876
|
className: cx("nu-check-box__mark", slotClassNames?.mark),
|
|
@@ -3620,7 +3882,7 @@ function CheckBox({
|
|
|
3620
3882
|
)
|
|
3621
3883
|
}
|
|
3622
3884
|
),
|
|
3623
|
-
/* @__PURE__ */
|
|
3885
|
+
/* @__PURE__ */ jsx30(
|
|
3624
3886
|
"span",
|
|
3625
3887
|
{
|
|
3626
3888
|
className: cx("nu-check-box__label", slotClassNames?.label),
|
|
@@ -3631,7 +3893,7 @@ function CheckBox({
|
|
|
3631
3893
|
]
|
|
3632
3894
|
}
|
|
3633
3895
|
),
|
|
3634
|
-
hint ? /* @__PURE__ */
|
|
3896
|
+
hint ? /* @__PURE__ */ jsx30(
|
|
3635
3897
|
"span",
|
|
3636
3898
|
{
|
|
3637
3899
|
className: cx("nu-check-box__hint", slotClassNames?.hint),
|
|
@@ -3647,29 +3909,29 @@ function CheckBox({
|
|
|
3647
3909
|
|
|
3648
3910
|
// src/components/Dropdown/Dropdown.tsx
|
|
3649
3911
|
import {
|
|
3650
|
-
useEffect as
|
|
3912
|
+
useEffect as useEffect7,
|
|
3651
3913
|
useId as useId4,
|
|
3652
|
-
useMemo as
|
|
3653
|
-
useRef as
|
|
3914
|
+
useMemo as useMemo8,
|
|
3915
|
+
useRef as useRef8,
|
|
3654
3916
|
useState as useState12
|
|
3655
3917
|
} from "react";
|
|
3656
3918
|
import { createPortal } from "react-dom";
|
|
3657
3919
|
|
|
3658
3920
|
// src/components/_shared/ControlOpener.tsx
|
|
3659
|
-
import { jsx as
|
|
3921
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
3660
3922
|
function ControlOpener(props) {
|
|
3661
3923
|
const { children, className, glyphClassName, glyphStyle, style } = props;
|
|
3662
3924
|
if (props.as === "button") {
|
|
3663
3925
|
const { as: _as2, type = "button", ...buttonProps } = props;
|
|
3664
3926
|
void _as2;
|
|
3665
|
-
return /* @__PURE__ */
|
|
3927
|
+
return /* @__PURE__ */ jsx31(
|
|
3666
3928
|
"button",
|
|
3667
3929
|
{
|
|
3668
3930
|
...buttonProps,
|
|
3669
3931
|
className: cx("nu-control-opener", className),
|
|
3670
3932
|
style,
|
|
3671
3933
|
type,
|
|
3672
|
-
children: children ?? /* @__PURE__ */
|
|
3934
|
+
children: children ?? /* @__PURE__ */ jsx31(
|
|
3673
3935
|
NuGlyph,
|
|
3674
3936
|
{
|
|
3675
3937
|
className: cx("nu-control-opener__glyph", glyphClassName),
|
|
@@ -3682,14 +3944,14 @@ function ControlOpener(props) {
|
|
|
3682
3944
|
}
|
|
3683
3945
|
const { ariaHidden = false, as: _as, ...spanProps } = props;
|
|
3684
3946
|
void _as;
|
|
3685
|
-
return /* @__PURE__ */
|
|
3947
|
+
return /* @__PURE__ */ jsx31(
|
|
3686
3948
|
"span",
|
|
3687
3949
|
{
|
|
3688
3950
|
...spanProps,
|
|
3689
3951
|
"aria-hidden": ariaHidden,
|
|
3690
3952
|
className: cx("nu-control-opener", className),
|
|
3691
3953
|
style,
|
|
3692
|
-
children: children ?? /* @__PURE__ */
|
|
3954
|
+
children: children ?? /* @__PURE__ */ jsx31(
|
|
3693
3955
|
NuGlyph,
|
|
3694
3956
|
{
|
|
3695
3957
|
className: cx("nu-control-opener__glyph", glyphClassName),
|
|
@@ -3805,7 +4067,7 @@ function usePopupPosition({
|
|
|
3805
4067
|
}
|
|
3806
4068
|
|
|
3807
4069
|
// src/components/Dropdown/Dropdown.tsx
|
|
3808
|
-
import { jsx as
|
|
4070
|
+
import { jsx as jsx32, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3809
4071
|
function flattenDropdownOptions(data) {
|
|
3810
4072
|
const options = [];
|
|
3811
4073
|
data.forEach((group) => {
|
|
@@ -3854,13 +4116,13 @@ function Dropdown({
|
|
|
3854
4116
|
style,
|
|
3855
4117
|
...props
|
|
3856
4118
|
}) {
|
|
3857
|
-
const rootRef =
|
|
3858
|
-
const triggerRef =
|
|
3859
|
-
const fieldRef =
|
|
3860
|
-
const popupRef =
|
|
3861
|
-
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);
|
|
3862
4124
|
const [open, setOpen] = useState12(false);
|
|
3863
|
-
const options =
|
|
4125
|
+
const options = useMemo8(() => flattenDropdownOptions(data), [data]);
|
|
3864
4126
|
const generatedId = useId4();
|
|
3865
4127
|
const fieldId = `${generatedId}-dropdown`;
|
|
3866
4128
|
const labelId = `${fieldId}-label`;
|
|
@@ -3868,16 +4130,16 @@ function Dropdown({
|
|
|
3868
4130
|
const isControlled = value !== void 0;
|
|
3869
4131
|
const [uncontrolledValue, setUncontrolledValue] = useState12(() => getInitialValue(options, defaultValue));
|
|
3870
4132
|
const resolvedValue = isControlled ? value : uncontrolledValue;
|
|
3871
|
-
const selectedOption =
|
|
4133
|
+
const selectedOption = useMemo8(
|
|
3872
4134
|
() => findSelectedOption(options, resolvedValue),
|
|
3873
4135
|
[options, resolvedValue]
|
|
3874
4136
|
);
|
|
3875
|
-
const selectableOptions =
|
|
4137
|
+
const selectableOptions = useMemo8(
|
|
3876
4138
|
() => options.filter((option) => !option.item.disabled),
|
|
3877
4139
|
[options]
|
|
3878
4140
|
);
|
|
3879
4141
|
const displayText = selectedOption?.item.name.text ?? placeholder;
|
|
3880
|
-
|
|
4142
|
+
useEffect7(() => {
|
|
3881
4143
|
if (!open) {
|
|
3882
4144
|
return;
|
|
3883
4145
|
}
|
|
@@ -3905,7 +4167,7 @@ function Dropdown({
|
|
|
3905
4167
|
open,
|
|
3906
4168
|
popupRef
|
|
3907
4169
|
});
|
|
3908
|
-
|
|
4170
|
+
useEffect7(() => {
|
|
3909
4171
|
if (!open) {
|
|
3910
4172
|
return;
|
|
3911
4173
|
}
|
|
@@ -3979,7 +4241,7 @@ function Dropdown({
|
|
|
3979
4241
|
ref: rootRef,
|
|
3980
4242
|
style: mergeSlotStyle(style, slotStyles?.root),
|
|
3981
4243
|
children: [
|
|
3982
|
-
/* @__PURE__ */
|
|
4244
|
+
/* @__PURE__ */ jsx32(
|
|
3983
4245
|
"span",
|
|
3984
4246
|
{
|
|
3985
4247
|
className: cx("nu-dropdown__label", slotClassNames?.label),
|
|
@@ -3988,7 +4250,7 @@ function Dropdown({
|
|
|
3988
4250
|
children: renderMnemonicText(label)
|
|
3989
4251
|
}
|
|
3990
4252
|
),
|
|
3991
|
-
/* @__PURE__ */
|
|
4253
|
+
/* @__PURE__ */ jsx32(
|
|
3992
4254
|
"button",
|
|
3993
4255
|
{
|
|
3994
4256
|
"aria-describedby": hintId,
|
|
@@ -4019,7 +4281,7 @@ function Dropdown({
|
|
|
4019
4281
|
ref: fieldRef,
|
|
4020
4282
|
style: slotStyles?.field,
|
|
4021
4283
|
children: [
|
|
4022
|
-
/* @__PURE__ */
|
|
4284
|
+
/* @__PURE__ */ jsx32(
|
|
4023
4285
|
"span",
|
|
4024
4286
|
{
|
|
4025
4287
|
"aria-hidden": "true",
|
|
@@ -4028,7 +4290,7 @@ function Dropdown({
|
|
|
4028
4290
|
children: "["
|
|
4029
4291
|
}
|
|
4030
4292
|
),
|
|
4031
|
-
/* @__PURE__ */
|
|
4293
|
+
/* @__PURE__ */ jsx32(
|
|
4032
4294
|
"span",
|
|
4033
4295
|
{
|
|
4034
4296
|
className: cx(
|
|
@@ -4036,7 +4298,7 @@ function Dropdown({
|
|
|
4036
4298
|
slotClassNames?.valueShell
|
|
4037
4299
|
),
|
|
4038
4300
|
style: slotStyles?.valueShell,
|
|
4039
|
-
children: /* @__PURE__ */
|
|
4301
|
+
children: /* @__PURE__ */ jsx32(
|
|
4040
4302
|
"span",
|
|
4041
4303
|
{
|
|
4042
4304
|
className: cx("nu-dropdown__value", slotClassNames?.value),
|
|
@@ -4046,7 +4308,7 @@ function Dropdown({
|
|
|
4046
4308
|
)
|
|
4047
4309
|
}
|
|
4048
4310
|
),
|
|
4049
|
-
/* @__PURE__ */
|
|
4311
|
+
/* @__PURE__ */ jsx32(
|
|
4050
4312
|
"span",
|
|
4051
4313
|
{
|
|
4052
4314
|
"aria-hidden": "true",
|
|
@@ -4058,7 +4320,7 @@ function Dropdown({
|
|
|
4058
4320
|
]
|
|
4059
4321
|
}
|
|
4060
4322
|
),
|
|
4061
|
-
/* @__PURE__ */
|
|
4323
|
+
/* @__PURE__ */ jsx32(
|
|
4062
4324
|
ControlOpener,
|
|
4063
4325
|
{
|
|
4064
4326
|
ariaHidden: true,
|
|
@@ -4069,7 +4331,7 @@ function Dropdown({
|
|
|
4069
4331
|
slotClassNames?.arrowShell
|
|
4070
4332
|
),
|
|
4071
4333
|
style: slotStyles?.arrowShell,
|
|
4072
|
-
children: /* @__PURE__ */
|
|
4334
|
+
children: /* @__PURE__ */ jsx32(
|
|
4073
4335
|
NuGlyph,
|
|
4074
4336
|
{
|
|
4075
4337
|
className: cx(
|
|
@@ -4088,7 +4350,7 @@ function Dropdown({
|
|
|
4088
4350
|
)
|
|
4089
4351
|
}
|
|
4090
4352
|
),
|
|
4091
|
-
hint ? /* @__PURE__ */
|
|
4353
|
+
hint ? /* @__PURE__ */ jsx32(
|
|
4092
4354
|
"span",
|
|
4093
4355
|
{
|
|
4094
4356
|
className: cx("nu-dropdown__hint", slotClassNames?.hint),
|
|
@@ -4098,7 +4360,7 @@ function Dropdown({
|
|
|
4098
4360
|
}
|
|
4099
4361
|
) : null,
|
|
4100
4362
|
open && typeof document !== "undefined" ? createPortal(
|
|
4101
|
-
/* @__PURE__ */
|
|
4363
|
+
/* @__PURE__ */ jsx32(
|
|
4102
4364
|
"div",
|
|
4103
4365
|
{
|
|
4104
4366
|
className: cx("nu-dropdown__popup", slotClassNames?.popup),
|
|
@@ -4107,7 +4369,7 @@ function Dropdown({
|
|
|
4107
4369
|
{ left: 0, top: 0, visibility: "hidden", width: 0 },
|
|
4108
4370
|
slotStyles?.popup
|
|
4109
4371
|
),
|
|
4110
|
-
children: /* @__PURE__ */
|
|
4372
|
+
children: /* @__PURE__ */ jsx32(
|
|
4111
4373
|
"div",
|
|
4112
4374
|
{
|
|
4113
4375
|
className: cx(
|
|
@@ -4116,7 +4378,7 @@ function Dropdown({
|
|
|
4116
4378
|
),
|
|
4117
4379
|
ref: popupListRef,
|
|
4118
4380
|
style: slotStyles?.popupShell,
|
|
4119
|
-
children: /* @__PURE__ */
|
|
4381
|
+
children: /* @__PURE__ */ jsx32(
|
|
4120
4382
|
ListBox,
|
|
4121
4383
|
{
|
|
4122
4384
|
className: cx(
|
|
@@ -4149,7 +4411,7 @@ function Dropdown({
|
|
|
4149
4411
|
}
|
|
4150
4412
|
|
|
4151
4413
|
// src/components/Frame/Frame.tsx
|
|
4152
|
-
import { jsx as
|
|
4414
|
+
import { jsx as jsx33, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4153
4415
|
function Frame({
|
|
4154
4416
|
children,
|
|
4155
4417
|
className,
|
|
@@ -4193,7 +4455,7 @@ function Frame({
|
|
|
4193
4455
|
className: cx("nu-frame__title", slotClassNames?.title),
|
|
4194
4456
|
style: mergeSlotStyle(titleStyle, slotStyles?.title),
|
|
4195
4457
|
children: [
|
|
4196
|
-
titleStart ? /* @__PURE__ */
|
|
4458
|
+
titleStart ? /* @__PURE__ */ jsx33(
|
|
4197
4459
|
"span",
|
|
4198
4460
|
{
|
|
4199
4461
|
className: cx(
|
|
@@ -4204,7 +4466,7 @@ function Frame({
|
|
|
4204
4466
|
children: titleStart
|
|
4205
4467
|
}
|
|
4206
4468
|
) : null,
|
|
4207
|
-
resolvedTitleContent ? /* @__PURE__ */
|
|
4469
|
+
resolvedTitleContent ? /* @__PURE__ */ jsx33(
|
|
4208
4470
|
"span",
|
|
4209
4471
|
{
|
|
4210
4472
|
className: cx(
|
|
@@ -4215,7 +4477,7 @@ function Frame({
|
|
|
4215
4477
|
children: resolvedTitleContent
|
|
4216
4478
|
}
|
|
4217
4479
|
) : null,
|
|
4218
|
-
titleEnd ? /* @__PURE__ */
|
|
4480
|
+
titleEnd ? /* @__PURE__ */ jsx33(
|
|
4219
4481
|
"span",
|
|
4220
4482
|
{
|
|
4221
4483
|
className: cx("nu-frame__title-end", slotClassNames?.titleEnd),
|
|
@@ -4226,7 +4488,7 @@ function Frame({
|
|
|
4226
4488
|
]
|
|
4227
4489
|
}
|
|
4228
4490
|
) : null,
|
|
4229
|
-
/* @__PURE__ */
|
|
4491
|
+
/* @__PURE__ */ jsx33(
|
|
4230
4492
|
"div",
|
|
4231
4493
|
{
|
|
4232
4494
|
className: cx("nu-frame__body", slotClassNames?.body),
|
|
@@ -4240,7 +4502,7 @@ function Frame({
|
|
|
4240
4502
|
}
|
|
4241
4503
|
|
|
4242
4504
|
// src/components/Info/Info.tsx
|
|
4243
|
-
import { jsx as
|
|
4505
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
4244
4506
|
function Info({
|
|
4245
4507
|
accentColor,
|
|
4246
4508
|
children,
|
|
@@ -4249,7 +4511,7 @@ function Info({
|
|
|
4249
4511
|
style,
|
|
4250
4512
|
...props
|
|
4251
4513
|
}) {
|
|
4252
|
-
return /* @__PURE__ */
|
|
4514
|
+
return /* @__PURE__ */ jsx34(
|
|
4253
4515
|
"div",
|
|
4254
4516
|
{
|
|
4255
4517
|
...props,
|
|
@@ -4273,7 +4535,7 @@ function InfoAccent({
|
|
|
4273
4535
|
upper = false,
|
|
4274
4536
|
...props
|
|
4275
4537
|
}) {
|
|
4276
|
-
return /* @__PURE__ */
|
|
4538
|
+
return /* @__PURE__ */ jsx34(
|
|
4277
4539
|
"span",
|
|
4278
4540
|
{
|
|
4279
4541
|
...props,
|
|
@@ -4290,48 +4552,22 @@ function InfoAccent({
|
|
|
4290
4552
|
|
|
4291
4553
|
// src/components/IconGrid/NuIconGrid.tsx
|
|
4292
4554
|
import {
|
|
4293
|
-
useEffect as useEffect8,
|
|
4294
4555
|
useLayoutEffect as useLayoutEffect4,
|
|
4295
|
-
useMemo as
|
|
4296
|
-
useRef as
|
|
4556
|
+
useMemo as useMemo9,
|
|
4557
|
+
useRef as useRef10,
|
|
4297
4558
|
useState as useState15
|
|
4298
4559
|
} from "react";
|
|
4299
4560
|
|
|
4300
4561
|
// src/components/PopupMenu/PopupMenu.tsx
|
|
4301
4562
|
import {
|
|
4302
4563
|
useCallback as useCallback4,
|
|
4303
|
-
useEffect as
|
|
4564
|
+
useEffect as useEffect8,
|
|
4304
4565
|
useLayoutEffect as useLayoutEffect3,
|
|
4305
|
-
useRef as
|
|
4566
|
+
useRef as useRef9,
|
|
4306
4567
|
useState as useState13
|
|
4307
4568
|
} from "react";
|
|
4308
4569
|
import { createPortal as createPortal2 } from "react-dom";
|
|
4309
|
-
|
|
4310
|
-
// src/components/_shared/themePortal.ts
|
|
4311
|
-
function getThemePortalStyle(anchor) {
|
|
4312
|
-
if (typeof window === "undefined") {
|
|
4313
|
-
return void 0;
|
|
4314
|
-
}
|
|
4315
|
-
const themeRoot = anchor?.closest(".nu-theme-root");
|
|
4316
|
-
if (!themeRoot) {
|
|
4317
|
-
return void 0;
|
|
4318
|
-
}
|
|
4319
|
-
const computed = window.getComputedStyle(themeRoot);
|
|
4320
|
-
const style = {
|
|
4321
|
-
color: computed.color,
|
|
4322
|
-
fontFamily: computed.fontFamily,
|
|
4323
|
-
fontSize: computed.fontSize
|
|
4324
|
-
};
|
|
4325
|
-
for (const propertyName of computed) {
|
|
4326
|
-
if (propertyName.startsWith("--nu-")) {
|
|
4327
|
-
style[propertyName] = computed.getPropertyValue(propertyName).trim();
|
|
4328
|
-
}
|
|
4329
|
-
}
|
|
4330
|
-
return style;
|
|
4331
|
-
}
|
|
4332
|
-
|
|
4333
|
-
// src/components/PopupMenu/PopupMenu.tsx
|
|
4334
|
-
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
4570
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
4335
4571
|
function hasVisibleChildren2(item) {
|
|
4336
4572
|
return Boolean(item.items?.some((child) => !child.hidden));
|
|
4337
4573
|
}
|
|
@@ -4372,7 +4608,7 @@ function PopupMenu({
|
|
|
4372
4608
|
uncheckedShape = "box",
|
|
4373
4609
|
...props
|
|
4374
4610
|
}) {
|
|
4375
|
-
const rootRef =
|
|
4611
|
+
const rootRef = useRef9(null);
|
|
4376
4612
|
const [activePath, setActivePath] = useState13([]);
|
|
4377
4613
|
const [uncontrolledOpen, setUncontrolledOpen] = useState13(defaultOpen);
|
|
4378
4614
|
const isControlled = open !== void 0;
|
|
@@ -4390,7 +4626,7 @@ function PopupMenu({
|
|
|
4390
4626
|
},
|
|
4391
4627
|
[isControlled, onOpenChange]
|
|
4392
4628
|
);
|
|
4393
|
-
|
|
4629
|
+
useEffect8(() => {
|
|
4394
4630
|
if (!resolvedOpen) {
|
|
4395
4631
|
return;
|
|
4396
4632
|
}
|
|
@@ -4465,7 +4701,7 @@ function PopupMenu({
|
|
|
4465
4701
|
return null;
|
|
4466
4702
|
}
|
|
4467
4703
|
return createPortal2(
|
|
4468
|
-
/* @__PURE__ */
|
|
4704
|
+
/* @__PURE__ */ jsx35(
|
|
4469
4705
|
"div",
|
|
4470
4706
|
{
|
|
4471
4707
|
...props,
|
|
@@ -4481,7 +4717,7 @@ function PopupMenu({
|
|
|
4481
4717
|
top: 0,
|
|
4482
4718
|
visibility: "hidden"
|
|
4483
4719
|
},
|
|
4484
|
-
children: /* @__PURE__ */
|
|
4720
|
+
children: /* @__PURE__ */ jsx35("div", { className: "nu-popup-menu__shell", children: /* @__PURE__ */ jsx35(
|
|
4485
4721
|
MainMenuList,
|
|
4486
4722
|
{
|
|
4487
4723
|
activePath,
|
|
@@ -4543,10 +4779,10 @@ function usePopupMenu() {
|
|
|
4543
4779
|
}
|
|
4544
4780
|
|
|
4545
4781
|
// src/components/IconGrid/iconContext.ts
|
|
4546
|
-
import { createContext as
|
|
4547
|
-
var NuIconContext =
|
|
4782
|
+
import { createContext as createContext5, useContext as useContext9 } from "react";
|
|
4783
|
+
var NuIconContext = createContext5(null);
|
|
4548
4784
|
function useNuIconContext() {
|
|
4549
|
-
const context =
|
|
4785
|
+
const context = useContext9(NuIconContext);
|
|
4550
4786
|
if (!context) {
|
|
4551
4787
|
throw new Error("useNuIconManager must be used within a NuIconProvider.");
|
|
4552
4788
|
}
|
|
@@ -4560,8 +4796,8 @@ function useNuIconGridContext() {
|
|
|
4560
4796
|
}
|
|
4561
4797
|
|
|
4562
4798
|
// src/components/IconGrid/NuIconGrid.tsx
|
|
4563
|
-
import { Fragment as Fragment5, jsx as
|
|
4564
|
-
var
|
|
4799
|
+
import { Fragment as Fragment5, jsx as jsx36, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4800
|
+
var DRAG_THRESHOLD2 = 3;
|
|
4565
4801
|
var gridRegistrations = /* @__PURE__ */ new Map();
|
|
4566
4802
|
function clamp2(value, minimum, maximum) {
|
|
4567
4803
|
return Math.min(Math.max(value, minimum), maximum);
|
|
@@ -4609,60 +4845,24 @@ function getTransferredPosition(targetGrid, iconElement, clientX, clientY) {
|
|
|
4609
4845
|
)
|
|
4610
4846
|
};
|
|
4611
4847
|
}
|
|
4612
|
-
function createDragPreview(iconElement) {
|
|
4613
|
-
const rect = iconElement.getBoundingClientRect();
|
|
4614
|
-
const preview = iconElement.cloneNode(true);
|
|
4615
|
-
preview.removeAttribute("id");
|
|
4616
|
-
preview.setAttribute("aria-hidden", "true");
|
|
4617
|
-
preview.setAttribute("disabled", "");
|
|
4618
|
-
preview.setAttribute("tabindex", "-1");
|
|
4619
|
-
Object.assign(preview.style, {
|
|
4620
|
-
height: `${rect.height}px`,
|
|
4621
|
-
left: `${rect.left}px`,
|
|
4622
|
-
margin: "0",
|
|
4623
|
-
opacity: window.getComputedStyle(iconElement).getPropertyValue("--nu-icon-grid-icon-drag-preview-opacity").trim() || "0.85",
|
|
4624
|
-
pointerEvents: "none",
|
|
4625
|
-
position: "fixed",
|
|
4626
|
-
top: `${rect.top}px`,
|
|
4627
|
-
width: `${rect.width}px`,
|
|
4628
|
-
zIndex: "2147483647"
|
|
4629
|
-
});
|
|
4630
|
-
const themeStyle = getThemePortalStyle(iconElement);
|
|
4631
|
-
Object.entries(themeStyle ?? {}).forEach(([property, value]) => {
|
|
4632
|
-
if (value !== void 0) {
|
|
4633
|
-
preview.style.setProperty(property, String(value));
|
|
4634
|
-
}
|
|
4635
|
-
});
|
|
4636
|
-
document.body.append(preview);
|
|
4637
|
-
return preview;
|
|
4638
|
-
}
|
|
4639
|
-
function moveDragPreview(preview, iconElement, clientX, clientY) {
|
|
4640
|
-
const rect = iconElement.getBoundingClientRect();
|
|
4641
|
-
preview.style.left = `${Math.round(clientX - rect.width / 2)}px`;
|
|
4642
|
-
preview.style.top = `${Math.round(clientY - rect.height / 2)}px`;
|
|
4643
|
-
}
|
|
4644
4848
|
function NuIconGridItem({
|
|
4645
4849
|
gridElement,
|
|
4646
4850
|
icon,
|
|
4851
|
+
onDragOut,
|
|
4647
4852
|
onIconMoveOut
|
|
4648
4853
|
}) {
|
|
4649
4854
|
const manager = useNuIconGridContext();
|
|
4855
|
+
const dragDrop = useNuDragDrop();
|
|
4650
4856
|
const contextMenu = usePopupMenu();
|
|
4651
|
-
const dragStartRef =
|
|
4652
|
-
const isDraggingRef =
|
|
4653
|
-
const dragPreviewRef = useRef9(null);
|
|
4857
|
+
const dragStartRef = useRef10(void 0);
|
|
4858
|
+
const isDraggingRef = useRef10(false);
|
|
4654
4859
|
const [isDragging, setIsDragging] = useState15(false);
|
|
4655
|
-
const suppressClickRef =
|
|
4656
|
-
const latestPositionRef =
|
|
4860
|
+
const suppressClickRef = useRef10(false);
|
|
4861
|
+
const latestPositionRef = useRef10(icon.position);
|
|
4657
4862
|
const contextMenuItems = resolveIconContextMenuItems(
|
|
4658
4863
|
icon.contextMenuItems,
|
|
4659
4864
|
icon
|
|
4660
4865
|
);
|
|
4661
|
-
function removeDragPreview() {
|
|
4662
|
-
dragPreviewRef.current?.remove();
|
|
4663
|
-
dragPreviewRef.current = null;
|
|
4664
|
-
}
|
|
4665
|
-
useEffect8(() => removeDragPreview, []);
|
|
4666
4866
|
function handlePointerDown(event) {
|
|
4667
4867
|
if (event.button !== 0 || icon.disabled) {
|
|
4668
4868
|
return;
|
|
@@ -4685,22 +4885,19 @@ function NuIconGridItem({
|
|
|
4685
4885
|
}
|
|
4686
4886
|
const deltaX = event.clientX - dragStart.clientX;
|
|
4687
4887
|
const deltaY = event.clientY - dragStart.clientY;
|
|
4688
|
-
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) {
|
|
4689
4889
|
return;
|
|
4690
4890
|
}
|
|
4691
4891
|
if (!isDraggingRef.current) {
|
|
4692
4892
|
isDraggingRef.current = true;
|
|
4693
4893
|
setIsDragging(true);
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
if (dragPreviewRef.current) {
|
|
4697
|
-
moveDragPreview(
|
|
4698
|
-
dragPreviewRef.current,
|
|
4894
|
+
dragDrop.beginDrag(
|
|
4895
|
+
{ data: icon, id: icon.id, type: "icon" },
|
|
4699
4896
|
event.currentTarget,
|
|
4700
|
-
|
|
4701
|
-
event.clientY
|
|
4897
|
+
"icon-grid"
|
|
4702
4898
|
);
|
|
4703
4899
|
}
|
|
4900
|
+
dragDrop.moveDrag(event.clientX, event.clientY);
|
|
4704
4901
|
const gridRect = gridElement.getBoundingClientRect();
|
|
4705
4902
|
const iconRect = event.currentTarget.getBoundingClientRect();
|
|
4706
4903
|
const position = {
|
|
@@ -4730,7 +4927,6 @@ function NuIconGridItem({
|
|
|
4730
4927
|
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
4731
4928
|
}
|
|
4732
4929
|
dragStartRef.current = void 0;
|
|
4733
|
-
removeDragPreview();
|
|
4734
4930
|
if (!isDraggingRef.current) {
|
|
4735
4931
|
return;
|
|
4736
4932
|
}
|
|
@@ -4738,6 +4934,12 @@ function NuIconGridItem({
|
|
|
4738
4934
|
isDraggingRef.current = false;
|
|
4739
4935
|
setIsDragging(false);
|
|
4740
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" });
|
|
4741
4943
|
return;
|
|
4742
4944
|
}
|
|
4743
4945
|
const targetRegistration = findGridRegistrationAtPoint(
|
|
@@ -4828,12 +5030,12 @@ function NuIconGridItem({
|
|
|
4828
5030
|
style: { left: icon.position.x, top: icon.position.y },
|
|
4829
5031
|
type: "button",
|
|
4830
5032
|
children: [
|
|
4831
|
-
/* @__PURE__ */
|
|
4832
|
-
/* @__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) })
|
|
4833
5035
|
]
|
|
4834
5036
|
}
|
|
4835
5037
|
),
|
|
4836
|
-
/* @__PURE__ */
|
|
5038
|
+
/* @__PURE__ */ jsx36(
|
|
4837
5039
|
PopupMenu,
|
|
4838
5040
|
{
|
|
4839
5041
|
anchor: contextMenu.anchor,
|
|
@@ -4846,26 +5048,38 @@ function NuIconGridItem({
|
|
|
4846
5048
|
}
|
|
4847
5049
|
function NuIconGrid({
|
|
4848
5050
|
accepts,
|
|
5051
|
+
acceptsDrop,
|
|
4849
5052
|
className,
|
|
4850
5053
|
contextMenuItems: contextMenuItemsSource,
|
|
4851
5054
|
defaultArrangeMode,
|
|
4852
5055
|
dropTarget = false,
|
|
5056
|
+
onDragOut,
|
|
4853
5057
|
onIconDrop,
|
|
4854
5058
|
onIconMoveOut,
|
|
5059
|
+
onDrop,
|
|
4855
5060
|
onContextMenu,
|
|
4856
5061
|
onPointerDown,
|
|
4857
5062
|
...props
|
|
4858
5063
|
}) {
|
|
4859
5064
|
const [gridElement, setGridElement] = useState15(null);
|
|
4860
5065
|
const manager = useNuIconGridContext();
|
|
4861
|
-
const hasAppliedDefaultArrangementRef =
|
|
5066
|
+
const hasAppliedDefaultArrangementRef = useRef10(false);
|
|
4862
5067
|
const arrangeIcons = manager.arrangeIcons;
|
|
4863
5068
|
const setGridSize = manager.setGridSize;
|
|
4864
5069
|
const contextMenu = usePopupMenu();
|
|
4865
|
-
const contextMenuItems =
|
|
5070
|
+
const contextMenuItems = useMemo9(
|
|
4866
5071
|
() => resolveGridContextMenuItems(contextMenuItemsSource, manager),
|
|
4867
5072
|
[contextMenuItemsSource, manager]
|
|
4868
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);
|
|
4869
5083
|
useLayoutEffect4(() => {
|
|
4870
5084
|
if (!gridElement) {
|
|
4871
5085
|
return;
|
|
@@ -4930,16 +5144,17 @@ function NuIconGrid({
|
|
|
4930
5144
|
ref: setGridElement,
|
|
4931
5145
|
role: "group",
|
|
4932
5146
|
children: [
|
|
4933
|
-
manager.icons.map((icon) => /* @__PURE__ */
|
|
5147
|
+
manager.icons.map((icon) => /* @__PURE__ */ jsx36(
|
|
4934
5148
|
NuIconGridItem,
|
|
4935
5149
|
{
|
|
4936
5150
|
gridElement,
|
|
4937
5151
|
icon,
|
|
5152
|
+
onDragOut,
|
|
4938
5153
|
onIconMoveOut
|
|
4939
5154
|
},
|
|
4940
5155
|
icon.id
|
|
4941
5156
|
)),
|
|
4942
|
-
/* @__PURE__ */
|
|
5157
|
+
/* @__PURE__ */ jsx36(
|
|
4943
5158
|
PopupMenu,
|
|
4944
5159
|
{
|
|
4945
5160
|
anchor: contextMenu.anchor,
|
|
@@ -4956,11 +5171,11 @@ function NuIconGrid({
|
|
|
4956
5171
|
// src/components/IconGrid/NuIconProvider.tsx
|
|
4957
5172
|
import {
|
|
4958
5173
|
useCallback as useCallback5,
|
|
4959
|
-
useMemo as
|
|
4960
|
-
useRef as
|
|
5174
|
+
useMemo as useMemo10,
|
|
5175
|
+
useRef as useRef11,
|
|
4961
5176
|
useState as useState16
|
|
4962
5177
|
} from "react";
|
|
4963
|
-
import { jsx as
|
|
5178
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
4964
5179
|
var GRID_PADDING = 12;
|
|
4965
5180
|
var ICON_CELL_HEIGHT = 104;
|
|
4966
5181
|
var ICON_CELL_WIDTH = 104;
|
|
@@ -5025,8 +5240,8 @@ function NuIconProvider({
|
|
|
5025
5240
|
children,
|
|
5026
5241
|
defaultIcons = []
|
|
5027
5242
|
}) {
|
|
5028
|
-
const idRef =
|
|
5029
|
-
const gridSizeRef =
|
|
5243
|
+
const idRef = useRef11(defaultIcons.length);
|
|
5244
|
+
const gridSizeRef = useRef11({ height: 0, width: 0 });
|
|
5030
5245
|
const [icons, setIcons] = useState16(
|
|
5031
5246
|
() => getInitialIcons(defaultIcons)
|
|
5032
5247
|
);
|
|
@@ -5085,7 +5300,7 @@ function NuIconProvider({
|
|
|
5085
5300
|
const setGridSize = useCallback5((size) => {
|
|
5086
5301
|
gridSizeRef.current = size;
|
|
5087
5302
|
}, []);
|
|
5088
|
-
const contextValue =
|
|
5303
|
+
const contextValue = useMemo10(
|
|
5089
5304
|
() => ({
|
|
5090
5305
|
addIcon,
|
|
5091
5306
|
arrangeIcons,
|
|
@@ -5108,19 +5323,19 @@ function NuIconProvider({
|
|
|
5108
5323
|
updateIcon
|
|
5109
5324
|
]
|
|
5110
5325
|
);
|
|
5111
|
-
return /* @__PURE__ */
|
|
5326
|
+
return /* @__PURE__ */ jsx37(NuIconContext.Provider, { value: contextValue, children });
|
|
5112
5327
|
}
|
|
5113
5328
|
|
|
5114
5329
|
// src/components/ComboBox/ComboBox.tsx
|
|
5115
5330
|
import {
|
|
5116
5331
|
useEffect as useEffect9,
|
|
5117
5332
|
useId as useId5,
|
|
5118
|
-
useMemo as
|
|
5119
|
-
useRef as
|
|
5333
|
+
useMemo as useMemo11,
|
|
5334
|
+
useRef as useRef12,
|
|
5120
5335
|
useState as useState17
|
|
5121
5336
|
} from "react";
|
|
5122
5337
|
import { createPortal as createPortal3 } from "react-dom";
|
|
5123
|
-
import { jsx as
|
|
5338
|
+
import { jsx as jsx38, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5124
5339
|
function flattenComboBoxOptions(data) {
|
|
5125
5340
|
const options = [];
|
|
5126
5341
|
data.forEach((group) => {
|
|
@@ -5161,16 +5376,16 @@ function ComboBox({
|
|
|
5161
5376
|
value,
|
|
5162
5377
|
...props
|
|
5163
5378
|
}) {
|
|
5164
|
-
const rootRef =
|
|
5165
|
-
const inputRef =
|
|
5166
|
-
const fieldRef =
|
|
5167
|
-
const popupRef =
|
|
5379
|
+
const rootRef = useRef12(null);
|
|
5380
|
+
const inputRef = useRef12(null);
|
|
5381
|
+
const fieldRef = useRef12(null);
|
|
5382
|
+
const popupRef = useRef12(null);
|
|
5168
5383
|
const generatedId = useId5();
|
|
5169
5384
|
const fieldId = `${generatedId}-combo-box`;
|
|
5170
5385
|
const labelId = `${fieldId}-label`;
|
|
5171
5386
|
const hintId = hint ? `${fieldId}-hint` : void 0;
|
|
5172
5387
|
const [open, setOpen] = useState17(false);
|
|
5173
|
-
const options =
|
|
5388
|
+
const options = useMemo11(() => flattenComboBoxOptions(data), [data]);
|
|
5174
5389
|
const isValueControlled = value !== void 0;
|
|
5175
5390
|
const isInputControlled = inputValueProp !== void 0;
|
|
5176
5391
|
const [uncontrolledValue, setUncontrolledValue] = useState17(() => defaultValue);
|
|
@@ -5179,13 +5394,13 @@ function ComboBox({
|
|
|
5179
5394
|
() => defaultInputValue ?? initialSelectedOption?.item.name.text ?? ""
|
|
5180
5395
|
);
|
|
5181
5396
|
const resolvedValue = isValueControlled ? value : uncontrolledValue;
|
|
5182
|
-
const selectedOption =
|
|
5397
|
+
const selectedOption = useMemo11(
|
|
5183
5398
|
() => findComboBoxOption(options, resolvedValue),
|
|
5184
5399
|
[options, resolvedValue]
|
|
5185
5400
|
);
|
|
5186
5401
|
const resolvedInputValue = isInputControlled ? inputValueProp ?? "" : uncontrolledInputValue;
|
|
5187
5402
|
const normalizedFilter = resolvedInputValue.trim().toLowerCase();
|
|
5188
|
-
const filteredData =
|
|
5403
|
+
const filteredData = useMemo11(() => {
|
|
5189
5404
|
if (!normalizedFilter) {
|
|
5190
5405
|
return data;
|
|
5191
5406
|
}
|
|
@@ -5196,7 +5411,7 @@ function ComboBox({
|
|
|
5196
5411
|
)
|
|
5197
5412
|
})).filter((group) => group.items.length > 0);
|
|
5198
5413
|
}, [data, normalizedFilter]);
|
|
5199
|
-
const filteredOptions =
|
|
5414
|
+
const filteredOptions = useMemo11(
|
|
5200
5415
|
() => flattenComboBoxOptions(filteredData).filter(
|
|
5201
5416
|
(option) => !option.item.disabled
|
|
5202
5417
|
),
|
|
@@ -5288,7 +5503,7 @@ function ComboBox({
|
|
|
5288
5503
|
ref: rootRef,
|
|
5289
5504
|
style: mergeSlotStyle(style, slotStyles?.root),
|
|
5290
5505
|
children: [
|
|
5291
|
-
/* @__PURE__ */
|
|
5506
|
+
/* @__PURE__ */ jsx38(
|
|
5292
5507
|
"label",
|
|
5293
5508
|
{
|
|
5294
5509
|
className: cx("nu-combo-box__label", slotClassNames?.label),
|
|
@@ -5311,7 +5526,7 @@ function ComboBox({
|
|
|
5311
5526
|
ref: fieldRef,
|
|
5312
5527
|
style: slotStyles?.field,
|
|
5313
5528
|
children: [
|
|
5314
|
-
/* @__PURE__ */
|
|
5529
|
+
/* @__PURE__ */ jsx38(
|
|
5315
5530
|
"span",
|
|
5316
5531
|
{
|
|
5317
5532
|
"aria-hidden": "true",
|
|
@@ -5320,7 +5535,7 @@ function ComboBox({
|
|
|
5320
5535
|
children: "["
|
|
5321
5536
|
}
|
|
5322
5537
|
),
|
|
5323
|
-
/* @__PURE__ */
|
|
5538
|
+
/* @__PURE__ */ jsx38(
|
|
5324
5539
|
"span",
|
|
5325
5540
|
{
|
|
5326
5541
|
className: cx(
|
|
@@ -5328,7 +5543,7 @@ function ComboBox({
|
|
|
5328
5543
|
slotClassNames?.inputShell
|
|
5329
5544
|
),
|
|
5330
5545
|
style: slotStyles?.inputShell,
|
|
5331
|
-
children: /* @__PURE__ */
|
|
5546
|
+
children: /* @__PURE__ */ jsx38(
|
|
5332
5547
|
"input",
|
|
5333
5548
|
{
|
|
5334
5549
|
"aria-autocomplete": "list",
|
|
@@ -5355,7 +5570,7 @@ function ComboBox({
|
|
|
5355
5570
|
)
|
|
5356
5571
|
}
|
|
5357
5572
|
),
|
|
5358
|
-
/* @__PURE__ */
|
|
5573
|
+
/* @__PURE__ */ jsx38(
|
|
5359
5574
|
"span",
|
|
5360
5575
|
{
|
|
5361
5576
|
"aria-hidden": "true",
|
|
@@ -5367,7 +5582,7 @@ function ComboBox({
|
|
|
5367
5582
|
]
|
|
5368
5583
|
}
|
|
5369
5584
|
),
|
|
5370
|
-
/* @__PURE__ */
|
|
5585
|
+
/* @__PURE__ */ jsx38(
|
|
5371
5586
|
ControlOpener,
|
|
5372
5587
|
{
|
|
5373
5588
|
"aria-label": open ? "Collapse list" : "Expand list",
|
|
@@ -5385,7 +5600,7 @@ function ComboBox({
|
|
|
5385
5600
|
]
|
|
5386
5601
|
}
|
|
5387
5602
|
),
|
|
5388
|
-
hint ? /* @__PURE__ */
|
|
5603
|
+
hint ? /* @__PURE__ */ jsx38(
|
|
5389
5604
|
"span",
|
|
5390
5605
|
{
|
|
5391
5606
|
className: cx("nu-combo-box__hint", slotClassNames?.hint),
|
|
@@ -5395,7 +5610,7 @@ function ComboBox({
|
|
|
5395
5610
|
}
|
|
5396
5611
|
) : null,
|
|
5397
5612
|
open && popupRoot ? createPortal3(
|
|
5398
|
-
/* @__PURE__ */
|
|
5613
|
+
/* @__PURE__ */ jsx38(
|
|
5399
5614
|
"div",
|
|
5400
5615
|
{
|
|
5401
5616
|
className: cx("nu-combo-box__popup", slotClassNames?.popup),
|
|
@@ -5405,12 +5620,12 @@ function ComboBox({
|
|
|
5405
5620
|
themePortalStyle,
|
|
5406
5621
|
slotStyles?.popup
|
|
5407
5622
|
),
|
|
5408
|
-
children: /* @__PURE__ */
|
|
5623
|
+
children: /* @__PURE__ */ jsx38(
|
|
5409
5624
|
"div",
|
|
5410
5625
|
{
|
|
5411
5626
|
className: cx("nu-combo-box__listbox", slotClassNames?.listbox),
|
|
5412
5627
|
style: slotStyles?.listbox,
|
|
5413
|
-
children: /* @__PURE__ */
|
|
5628
|
+
children: /* @__PURE__ */ jsx38(
|
|
5414
5629
|
ListBox,
|
|
5415
5630
|
{
|
|
5416
5631
|
data: filteredData,
|
|
@@ -5443,7 +5658,7 @@ function ComboBox({
|
|
|
5443
5658
|
import {
|
|
5444
5659
|
Fragment as Fragment6
|
|
5445
5660
|
} from "react";
|
|
5446
|
-
import { jsx as
|
|
5661
|
+
import { jsx as jsx39, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5447
5662
|
var COMMAND_BUTTON_GLYPH_NAMES = /* @__PURE__ */ new Set([
|
|
5448
5663
|
"check-fill",
|
|
5449
5664
|
"check-mark",
|
|
@@ -5484,7 +5699,7 @@ function CommandButton({
|
|
|
5484
5699
|
const hasMenu = menuItems.length > 0;
|
|
5485
5700
|
const showCaret = dropdown || hasMenu;
|
|
5486
5701
|
const resolvedToggled = toggled ?? pressed;
|
|
5487
|
-
const resolvedIcon = typeof icon === "string" && isCommandButtonGlyphName(icon) ? /* @__PURE__ */
|
|
5702
|
+
const resolvedIcon = typeof icon === "string" && isCommandButtonGlyphName(icon) ? /* @__PURE__ */ jsx39(NuGlyph, { name: icon }) : icon ?? null;
|
|
5488
5703
|
function handleClick(event) {
|
|
5489
5704
|
onClick?.(event);
|
|
5490
5705
|
if (event.defaultPrevented || !hasMenu) {
|
|
@@ -5509,7 +5724,7 @@ function CommandButton({
|
|
|
5509
5724
|
type,
|
|
5510
5725
|
onClick: handleClick,
|
|
5511
5726
|
children: [
|
|
5512
|
-
resolvedIcon ? /* @__PURE__ */
|
|
5727
|
+
resolvedIcon ? /* @__PURE__ */ jsx39(
|
|
5513
5728
|
"span",
|
|
5514
5729
|
{
|
|
5515
5730
|
className: cx(
|
|
@@ -5521,7 +5736,7 @@ function CommandButton({
|
|
|
5521
5736
|
children: resolvedIcon
|
|
5522
5737
|
}
|
|
5523
5738
|
) : null,
|
|
5524
|
-
children ? /* @__PURE__ */
|
|
5739
|
+
children ? /* @__PURE__ */ jsx39(
|
|
5525
5740
|
"span",
|
|
5526
5741
|
{
|
|
5527
5742
|
className: cx(
|
|
@@ -5533,7 +5748,7 @@ function CommandButton({
|
|
|
5533
5748
|
children: renderMnemonicNode(children)
|
|
5534
5749
|
}
|
|
5535
5750
|
) : null,
|
|
5536
|
-
showCaret ? /* @__PURE__ */
|
|
5751
|
+
showCaret ? /* @__PURE__ */ jsx39(
|
|
5537
5752
|
"span",
|
|
5538
5753
|
{
|
|
5539
5754
|
className: cx(
|
|
@@ -5542,13 +5757,13 @@ function CommandButton({
|
|
|
5542
5757
|
slotClassNames?.caret
|
|
5543
5758
|
),
|
|
5544
5759
|
style: slotStyles?.caret,
|
|
5545
|
-
children: /* @__PURE__ */
|
|
5760
|
+
children: /* @__PURE__ */ jsx39(NuGlyph, { name: "dropdown-arrow" })
|
|
5546
5761
|
}
|
|
5547
5762
|
) : null
|
|
5548
5763
|
]
|
|
5549
5764
|
}
|
|
5550
5765
|
),
|
|
5551
|
-
hasMenu ? /* @__PURE__ */
|
|
5766
|
+
hasMenu ? /* @__PURE__ */ jsx39(
|
|
5552
5767
|
PopupMenu,
|
|
5553
5768
|
{
|
|
5554
5769
|
anchor: popupMenu.anchor,
|
|
@@ -5563,8 +5778,8 @@ function CommandButton({
|
|
|
5563
5778
|
}
|
|
5564
5779
|
|
|
5565
5780
|
// src/components/CrtGlitch/CrtGlitch.tsx
|
|
5566
|
-
import { useEffect as useEffect10, useId as useId6, useRef as
|
|
5567
|
-
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";
|
|
5568
5783
|
var DEFAULT_INTERVAL_MS = 3e3;
|
|
5569
5784
|
var DEFAULT_DURATION_MS = 2500;
|
|
5570
5785
|
var DEFAULT_TOP_LEVEL_RATIO = 1 / 3;
|
|
@@ -5590,12 +5805,12 @@ function NuCrtGlitch({
|
|
|
5590
5805
|
topLevelRatio = DEFAULT_TOP_LEVEL_RATIO
|
|
5591
5806
|
}) {
|
|
5592
5807
|
const filterId = useId6().replace(/:/g, "");
|
|
5593
|
-
const turbulenceRef =
|
|
5594
|
-
const warpRef =
|
|
5595
|
-
const rOffsetRef =
|
|
5596
|
-
const bOffsetRef =
|
|
5597
|
-
const rafRef =
|
|
5598
|
-
const targetElRef =
|
|
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);
|
|
5599
5814
|
useEffect10(() => {
|
|
5600
5815
|
if (!enabled) {
|
|
5601
5816
|
return;
|
|
@@ -5698,7 +5913,7 @@ function NuCrtGlitch({
|
|
|
5698
5913
|
}
|
|
5699
5914
|
};
|
|
5700
5915
|
}, [durationMs, enabled, filterId, intervalMs, targetSelector, topLevelRatio]);
|
|
5701
|
-
return /* @__PURE__ */
|
|
5916
|
+
return /* @__PURE__ */ jsx40("svg", { "aria-hidden": "true", height: "0", style: { position: "absolute" }, width: "0", children: /* @__PURE__ */ jsx40("defs", { children: /* @__PURE__ */ jsxs23(
|
|
5702
5917
|
"filter",
|
|
5703
5918
|
{
|
|
5704
5919
|
"color-interpolation-filters": "sRGB",
|
|
@@ -5708,7 +5923,7 @@ function NuCrtGlitch({
|
|
|
5708
5923
|
x: "-15%",
|
|
5709
5924
|
y: "-5%",
|
|
5710
5925
|
children: [
|
|
5711
|
-
/* @__PURE__ */
|
|
5926
|
+
/* @__PURE__ */ jsx40(
|
|
5712
5927
|
"feTurbulence",
|
|
5713
5928
|
{
|
|
5714
5929
|
baseFrequency: "0.001 0.045",
|
|
@@ -5719,7 +5934,7 @@ function NuCrtGlitch({
|
|
|
5719
5934
|
type: "turbulence"
|
|
5720
5935
|
}
|
|
5721
5936
|
),
|
|
5722
|
-
/* @__PURE__ */
|
|
5937
|
+
/* @__PURE__ */ jsx40(
|
|
5723
5938
|
"feDisplacementMap",
|
|
5724
5939
|
{
|
|
5725
5940
|
in: "SourceGraphic",
|
|
@@ -5731,8 +5946,8 @@ function NuCrtGlitch({
|
|
|
5731
5946
|
yChannelSelector: "A"
|
|
5732
5947
|
}
|
|
5733
5948
|
),
|
|
5734
|
-
/* @__PURE__ */
|
|
5735
|
-
/* @__PURE__ */
|
|
5949
|
+
/* @__PURE__ */ jsx40("feOffset", { dx: 0, dy: 0, in: "warped", ref: rOffsetRef, result: "rOff" }),
|
|
5950
|
+
/* @__PURE__ */ jsx40(
|
|
5736
5951
|
"feColorMatrix",
|
|
5737
5952
|
{
|
|
5738
5953
|
in: "rOff",
|
|
@@ -5741,7 +5956,7 @@ function NuCrtGlitch({
|
|
|
5741
5956
|
values: "1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0"
|
|
5742
5957
|
}
|
|
5743
5958
|
),
|
|
5744
|
-
/* @__PURE__ */
|
|
5959
|
+
/* @__PURE__ */ jsx40(
|
|
5745
5960
|
"feColorMatrix",
|
|
5746
5961
|
{
|
|
5747
5962
|
in: "warped",
|
|
@@ -5750,8 +5965,8 @@ function NuCrtGlitch({
|
|
|
5750
5965
|
values: "0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0"
|
|
5751
5966
|
}
|
|
5752
5967
|
),
|
|
5753
|
-
/* @__PURE__ */
|
|
5754
|
-
/* @__PURE__ */
|
|
5968
|
+
/* @__PURE__ */ jsx40("feOffset", { dx: 0, dy: 0, in: "warped", ref: bOffsetRef, result: "bOff" }),
|
|
5969
|
+
/* @__PURE__ */ jsx40(
|
|
5755
5970
|
"feColorMatrix",
|
|
5756
5971
|
{
|
|
5757
5972
|
in: "bOff",
|
|
@@ -5760,8 +5975,8 @@ function NuCrtGlitch({
|
|
|
5760
5975
|
values: "0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0"
|
|
5761
5976
|
}
|
|
5762
5977
|
),
|
|
5763
|
-
/* @__PURE__ */
|
|
5764
|
-
/* @__PURE__ */
|
|
5978
|
+
/* @__PURE__ */ jsx40("feBlend", { in: "rOnly", in2: "gOnly", mode: "screen", result: "rg" }),
|
|
5979
|
+
/* @__PURE__ */ jsx40("feBlend", { in: "rg", in2: "bOnly", mode: "screen" })
|
|
5765
5980
|
]
|
|
5766
5981
|
}
|
|
5767
5982
|
) }) });
|
|
@@ -5773,8 +5988,8 @@ import {
|
|
|
5773
5988
|
useCallback as useCallback6,
|
|
5774
5989
|
useEffect as useEffect11,
|
|
5775
5990
|
useImperativeHandle as useImperativeHandle2,
|
|
5776
|
-
useMemo as
|
|
5777
|
-
useRef as
|
|
5991
|
+
useMemo as useMemo12,
|
|
5992
|
+
useRef as useRef14,
|
|
5778
5993
|
useState as useState18
|
|
5779
5994
|
} from "react";
|
|
5780
5995
|
|
|
@@ -5813,14 +6028,14 @@ function renderListViewCellValue(row, column) {
|
|
|
5813
6028
|
import { memo as memo3 } from "react";
|
|
5814
6029
|
|
|
5815
6030
|
// src/components/ListView/internals/ListViewCheckControl.tsx
|
|
5816
|
-
import { jsx as
|
|
6031
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
5817
6032
|
function ListViewCheckControl({
|
|
5818
6033
|
isChecked,
|
|
5819
6034
|
onActivate,
|
|
5820
6035
|
onToggleCheck,
|
|
5821
6036
|
uncheckedShape
|
|
5822
6037
|
}) {
|
|
5823
|
-
return /* @__PURE__ */
|
|
6038
|
+
return /* @__PURE__ */ jsx41(
|
|
5824
6039
|
"button",
|
|
5825
6040
|
{
|
|
5826
6041
|
"aria-label": isChecked ? "Uncheck row" : "Check row",
|
|
@@ -5833,13 +6048,13 @@ function ListViewCheckControl({
|
|
|
5833
6048
|
onToggleCheck();
|
|
5834
6049
|
},
|
|
5835
6050
|
type: "button",
|
|
5836
|
-
children: /* @__PURE__ */
|
|
6051
|
+
children: /* @__PURE__ */ jsx41(
|
|
5837
6052
|
"span",
|
|
5838
6053
|
{
|
|
5839
6054
|
"aria-hidden": "true",
|
|
5840
6055
|
className: "nu-list-view__check-box",
|
|
5841
6056
|
"data-unchecked-shape": uncheckedShape,
|
|
5842
|
-
children: isChecked ? /* @__PURE__ */
|
|
6057
|
+
children: isChecked ? /* @__PURE__ */ jsx41(
|
|
5843
6058
|
NuGlyph,
|
|
5844
6059
|
{
|
|
5845
6060
|
className: "nu-list-view__check-indicator",
|
|
@@ -5853,7 +6068,7 @@ function ListViewCheckControl({
|
|
|
5853
6068
|
}
|
|
5854
6069
|
|
|
5855
6070
|
// src/components/ListView/internals/ListViewRow.tsx
|
|
5856
|
-
import { jsx as
|
|
6071
|
+
import { jsx as jsx42, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5857
6072
|
function ListViewRowInner({
|
|
5858
6073
|
columns,
|
|
5859
6074
|
isActive,
|
|
@@ -5905,7 +6120,7 @@ function ListViewRowInner({
|
|
|
5905
6120
|
"--nu-list-view-columns": templateColumns
|
|
5906
6121
|
},
|
|
5907
6122
|
children: [
|
|
5908
|
-
showCheckBox ? /* @__PURE__ */
|
|
6123
|
+
showCheckBox ? /* @__PURE__ */ jsx42("span", { className: "nu-list-view__check-cell", role: "gridcell", children: /* @__PURE__ */ jsx42(
|
|
5909
6124
|
ListViewCheckControl,
|
|
5910
6125
|
{
|
|
5911
6126
|
isChecked,
|
|
@@ -5914,7 +6129,7 @@ function ListViewRowInner({
|
|
|
5914
6129
|
uncheckedShape
|
|
5915
6130
|
}
|
|
5916
6131
|
) }) : null,
|
|
5917
|
-
columns.map((column) => /* @__PURE__ */
|
|
6132
|
+
columns.map((column) => /* @__PURE__ */ jsx42(
|
|
5918
6133
|
"span",
|
|
5919
6134
|
{
|
|
5920
6135
|
className: [
|
|
@@ -5934,7 +6149,7 @@ function ListViewRowInner({
|
|
|
5934
6149
|
var ListViewRow = memo3(ListViewRowInner);
|
|
5935
6150
|
|
|
5936
6151
|
// src/components/ListView/ListView.tsx
|
|
5937
|
-
import { jsx as
|
|
6152
|
+
import { jsx as jsx43, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5938
6153
|
function ListViewInner({
|
|
5939
6154
|
activeRowId: activeRowIdProp,
|
|
5940
6155
|
checkedIds,
|
|
@@ -5952,9 +6167,9 @@ function ListViewInner({
|
|
|
5952
6167
|
uncheckedShape = "box",
|
|
5953
6168
|
...props
|
|
5954
6169
|
}, ref) {
|
|
5955
|
-
const rootRef =
|
|
5956
|
-
const rowRefs =
|
|
5957
|
-
const selectableRows =
|
|
6170
|
+
const rootRef = useRef14(null);
|
|
6171
|
+
const rowRefs = useRef14({});
|
|
6172
|
+
const selectableRows = useMemo12(
|
|
5958
6173
|
() => data.filter((row) => !row.disabled),
|
|
5959
6174
|
[data]
|
|
5960
6175
|
);
|
|
@@ -5964,7 +6179,7 @@ function ListViewInner({
|
|
|
5964
6179
|
);
|
|
5965
6180
|
const activeRowId = activeRowIdProp !== void 0 ? activeRowIdProp : uncontrolledActiveRowId;
|
|
5966
6181
|
const resolvedActiveRowId = activeRowId && selectableRows.some((row) => row.id === activeRowId) ? activeRowId : getInitialActiveRowId(selectableRows, selectedId);
|
|
5967
|
-
const templateColumns =
|
|
6182
|
+
const templateColumns = useMemo12(() => {
|
|
5968
6183
|
const checkboxColumn = showCheckBox ? "var(--nu-glyph-cell-size)" : null;
|
|
5969
6184
|
const dataColumns = columns.map(
|
|
5970
6185
|
(column) => column.width ?? "minmax(0, 1fr)"
|
|
@@ -6122,8 +6337,8 @@ function ListViewInner({
|
|
|
6122
6337
|
"--nu-list-view-columns": templateColumns
|
|
6123
6338
|
},
|
|
6124
6339
|
children: [
|
|
6125
|
-
showCheckBox ? /* @__PURE__ */
|
|
6126
|
-
columns.map((column) => /* @__PURE__ */
|
|
6340
|
+
showCheckBox ? /* @__PURE__ */ jsx43("span", { className: "nu-list-view__header-cell", role: "columnheader" }) : null,
|
|
6341
|
+
columns.map((column) => /* @__PURE__ */ jsx43(
|
|
6127
6342
|
"span",
|
|
6128
6343
|
{
|
|
6129
6344
|
className: [
|
|
@@ -6139,7 +6354,7 @@ function ListViewInner({
|
|
|
6139
6354
|
]
|
|
6140
6355
|
}
|
|
6141
6356
|
),
|
|
6142
|
-
/* @__PURE__ */
|
|
6357
|
+
/* @__PURE__ */ jsx43("div", { className: "nu-list-view__body", children: data.length > 0 ? data.map((row) => /* @__PURE__ */ jsx43(
|
|
6143
6358
|
ListViewRow,
|
|
6144
6359
|
{
|
|
6145
6360
|
columns,
|
|
@@ -6156,7 +6371,7 @@ function ListViewInner({
|
|
|
6156
6371
|
uncheckedShape
|
|
6157
6372
|
},
|
|
6158
6373
|
row.id
|
|
6159
|
-
)) : /* @__PURE__ */
|
|
6374
|
+
)) : /* @__PURE__ */ jsx43("div", { className: "nu-list-view__empty", children: emptyText }) })
|
|
6160
6375
|
]
|
|
6161
6376
|
}
|
|
6162
6377
|
);
|
|
@@ -6167,8 +6382,8 @@ var ListView = forwardRef2(ListViewInner);
|
|
|
6167
6382
|
import {
|
|
6168
6383
|
useEffect as useEffect12,
|
|
6169
6384
|
useId as useId7,
|
|
6170
|
-
useMemo as
|
|
6171
|
-
useRef as
|
|
6385
|
+
useMemo as useMemo13,
|
|
6386
|
+
useRef as useRef15,
|
|
6172
6387
|
useState as useState19
|
|
6173
6388
|
} from "react";
|
|
6174
6389
|
|
|
@@ -6334,7 +6549,7 @@ function getMaskedFieldState(mask, rawValue) {
|
|
|
6334
6549
|
}
|
|
6335
6550
|
|
|
6336
6551
|
// src/components/MaskedField/MaskedField.tsx
|
|
6337
|
-
import { jsx as
|
|
6552
|
+
import { jsx as jsx44, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
6338
6553
|
function MaskedField({
|
|
6339
6554
|
"aria-invalid": ariaInvalid,
|
|
6340
6555
|
className,
|
|
@@ -6357,7 +6572,7 @@ function MaskedField({
|
|
|
6357
6572
|
const fieldId = id ?? generatedId;
|
|
6358
6573
|
const hintId = hint ? `${fieldId}-hint` : void 0;
|
|
6359
6574
|
const isControlled = value !== void 0;
|
|
6360
|
-
const hasMountedRef =
|
|
6575
|
+
const hasMountedRef = useRef15(false);
|
|
6361
6576
|
const [uncontrolledValue, setUncontrolledValue] = useState19(
|
|
6362
6577
|
() => defaultValue == null ? "" : getMaskedFieldState(mask, String(defaultValue)).formattedValue
|
|
6363
6578
|
);
|
|
@@ -6367,7 +6582,7 @@ function MaskedField({
|
|
|
6367
6582
|
rawResolvedValue
|
|
6368
6583
|
);
|
|
6369
6584
|
const resolvedAriaInvalid = ariaInvalid ?? (isInvalid ? true : void 0);
|
|
6370
|
-
const maskInputMode =
|
|
6585
|
+
const maskInputMode = useMemo13(
|
|
6371
6586
|
() => props.inputMode === void 0 ? getTextMaskInputMode(mask) : void 0,
|
|
6372
6587
|
[mask, props.inputMode]
|
|
6373
6588
|
);
|
|
@@ -6418,7 +6633,7 @@ function MaskedField({
|
|
|
6418
6633
|
htmlFor: fieldId,
|
|
6419
6634
|
style: mergeSlotStyle(style, slotStyles?.root),
|
|
6420
6635
|
children: [
|
|
6421
|
-
/* @__PURE__ */
|
|
6636
|
+
/* @__PURE__ */ jsx44(
|
|
6422
6637
|
"span",
|
|
6423
6638
|
{
|
|
6424
6639
|
className: cx("nu-masked-field__label", slotClassNames?.label),
|
|
@@ -6432,7 +6647,7 @@ function MaskedField({
|
|
|
6432
6647
|
className: cx("nu-masked-field__slot", slotClassNames?.slot),
|
|
6433
6648
|
style: slotStyles?.slot,
|
|
6434
6649
|
children: [
|
|
6435
|
-
/* @__PURE__ */
|
|
6650
|
+
/* @__PURE__ */ jsx44(
|
|
6436
6651
|
"span",
|
|
6437
6652
|
{
|
|
6438
6653
|
"aria-hidden": "true",
|
|
@@ -6441,7 +6656,7 @@ function MaskedField({
|
|
|
6441
6656
|
children: "["
|
|
6442
6657
|
}
|
|
6443
6658
|
),
|
|
6444
|
-
/* @__PURE__ */
|
|
6659
|
+
/* @__PURE__ */ jsx44(
|
|
6445
6660
|
"span",
|
|
6446
6661
|
{
|
|
6447
6662
|
className: cx(
|
|
@@ -6449,7 +6664,7 @@ function MaskedField({
|
|
|
6449
6664
|
slotClassNames?.inputShell
|
|
6450
6665
|
),
|
|
6451
6666
|
style: slotStyles?.inputShell,
|
|
6452
|
-
children: /* @__PURE__ */
|
|
6667
|
+
children: /* @__PURE__ */ jsx44(
|
|
6453
6668
|
"input",
|
|
6454
6669
|
{
|
|
6455
6670
|
...props,
|
|
@@ -6467,7 +6682,7 @@ function MaskedField({
|
|
|
6467
6682
|
)
|
|
6468
6683
|
}
|
|
6469
6684
|
),
|
|
6470
|
-
/* @__PURE__ */
|
|
6685
|
+
/* @__PURE__ */ jsx44(
|
|
6471
6686
|
"span",
|
|
6472
6687
|
{
|
|
6473
6688
|
"aria-hidden": "true",
|
|
@@ -6479,7 +6694,7 @@ function MaskedField({
|
|
|
6479
6694
|
]
|
|
6480
6695
|
}
|
|
6481
6696
|
),
|
|
6482
|
-
hint ? /* @__PURE__ */
|
|
6697
|
+
hint ? /* @__PURE__ */ jsx44(
|
|
6483
6698
|
"span",
|
|
6484
6699
|
{
|
|
6485
6700
|
className: cx("nu-masked-field__hint", slotClassNames?.hint),
|
|
@@ -6497,7 +6712,7 @@ function MaskedField({
|
|
|
6497
6712
|
import {
|
|
6498
6713
|
useState as useState20
|
|
6499
6714
|
} from "react";
|
|
6500
|
-
import { jsx as
|
|
6715
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
6501
6716
|
function Memo({
|
|
6502
6717
|
background,
|
|
6503
6718
|
className,
|
|
@@ -6527,7 +6742,7 @@ function Memo({
|
|
|
6527
6742
|
onValueChange?.(event.target.value);
|
|
6528
6743
|
onChange?.(event);
|
|
6529
6744
|
}
|
|
6530
|
-
return /* @__PURE__ */
|
|
6745
|
+
return /* @__PURE__ */ jsx45(
|
|
6531
6746
|
"div",
|
|
6532
6747
|
{
|
|
6533
6748
|
className: ["nu-memo", className].filter(Boolean).join(" "),
|
|
@@ -6540,7 +6755,7 @@ function Memo({
|
|
|
6540
6755
|
"--nu-memo-focus-text": focusTextColor,
|
|
6541
6756
|
"--nu-memo-text": textColor
|
|
6542
6757
|
},
|
|
6543
|
-
children: /* @__PURE__ */
|
|
6758
|
+
children: /* @__PURE__ */ jsx45("div", { className: "nu-memo__viewport", children: /* @__PURE__ */ jsx45(
|
|
6544
6759
|
"textarea",
|
|
6545
6760
|
{
|
|
6546
6761
|
...props,
|
|
@@ -6556,11 +6771,11 @@ function Memo({
|
|
|
6556
6771
|
// src/components/PageControl/PageControl.tsx
|
|
6557
6772
|
import {
|
|
6558
6773
|
useId as useId8,
|
|
6559
|
-
useMemo as
|
|
6560
|
-
useRef as
|
|
6774
|
+
useMemo as useMemo14,
|
|
6775
|
+
useRef as useRef16,
|
|
6561
6776
|
useState as useState21
|
|
6562
6777
|
} from "react";
|
|
6563
|
-
import { jsx as
|
|
6778
|
+
import { jsx as jsx46, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6564
6779
|
function PageControl({
|
|
6565
6780
|
activePageId: activePageIdProp,
|
|
6566
6781
|
className,
|
|
@@ -6574,12 +6789,12 @@ function PageControl({
|
|
|
6574
6789
|
}) {
|
|
6575
6790
|
const generatedId = useId8();
|
|
6576
6791
|
const isControlled = activePageIdProp !== void 0;
|
|
6577
|
-
const tabRefs =
|
|
6792
|
+
const tabRefs = useRef16({});
|
|
6578
6793
|
const [uncontrolledActivePageId, setUncontrolledActivePageId] = useState21(
|
|
6579
6794
|
() => defaultActivePageId ?? pages.find((page) => !page.disabled)?.id ?? pages[0]?.id
|
|
6580
6795
|
);
|
|
6581
6796
|
const activePageId = isControlled ? activePageIdProp : uncontrolledActivePageId;
|
|
6582
|
-
const resolvedActivePage =
|
|
6797
|
+
const resolvedActivePage = useMemo14(() => {
|
|
6583
6798
|
const byId = pages.find(
|
|
6584
6799
|
(page) => page.id === activePageId && !page.disabled
|
|
6585
6800
|
);
|
|
@@ -6656,7 +6871,7 @@ function PageControl({
|
|
|
6656
6871
|
slotStyles?.root
|
|
6657
6872
|
),
|
|
6658
6873
|
children: [
|
|
6659
|
-
/* @__PURE__ */
|
|
6874
|
+
/* @__PURE__ */ jsx46(
|
|
6660
6875
|
"div",
|
|
6661
6876
|
{
|
|
6662
6877
|
className: cx("nu-page-control__tabs", slotClassNames?.tabs),
|
|
@@ -6667,7 +6882,7 @@ function PageControl({
|
|
|
6667
6882
|
const isActive = page.id === resolvedActivePage?.id;
|
|
6668
6883
|
const panelId = `${generatedId}-panel-${page.id}`;
|
|
6669
6884
|
const tabId = `${generatedId}-tab-${page.id}`;
|
|
6670
|
-
return /* @__PURE__ */
|
|
6885
|
+
return /* @__PURE__ */ jsx46(
|
|
6671
6886
|
"button",
|
|
6672
6887
|
{
|
|
6673
6888
|
"aria-controls": panelId,
|
|
@@ -6691,7 +6906,7 @@ function PageControl({
|
|
|
6691
6906
|
})
|
|
6692
6907
|
}
|
|
6693
6908
|
),
|
|
6694
|
-
/* @__PURE__ */
|
|
6909
|
+
/* @__PURE__ */ jsx46(
|
|
6695
6910
|
"div",
|
|
6696
6911
|
{
|
|
6697
6912
|
"aria-labelledby": resolvedActivePage ? `${generatedId}-tab-${resolvedActivePage.id}` : void 0,
|
|
@@ -6708,7 +6923,7 @@ function PageControl({
|
|
|
6708
6923
|
}
|
|
6709
6924
|
|
|
6710
6925
|
// src/components/Panel/Panel.tsx
|
|
6711
|
-
import { jsx as
|
|
6926
|
+
import { jsx as jsx47, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6712
6927
|
function Panel({
|
|
6713
6928
|
children,
|
|
6714
6929
|
className,
|
|
@@ -6726,7 +6941,7 @@ function Panel({
|
|
|
6726
6941
|
className: cx("nu-panel", slotClassNames?.root, className),
|
|
6727
6942
|
style: mergeSlotStyle(props.style, slotStyles?.root),
|
|
6728
6943
|
children: [
|
|
6729
|
-
title ? /* @__PURE__ */
|
|
6944
|
+
title ? /* @__PURE__ */ jsx47(
|
|
6730
6945
|
"header",
|
|
6731
6946
|
{
|
|
6732
6947
|
className: cx("nu-panel__header", slotClassNames?.header),
|
|
@@ -6734,7 +6949,7 @@ function Panel({
|
|
|
6734
6949
|
children: renderMnemonicText(title)
|
|
6735
6950
|
}
|
|
6736
6951
|
) : null,
|
|
6737
|
-
/* @__PURE__ */
|
|
6952
|
+
/* @__PURE__ */ jsx47(
|
|
6738
6953
|
"div",
|
|
6739
6954
|
{
|
|
6740
6955
|
className: cx(
|
|
@@ -6746,7 +6961,7 @@ function Panel({
|
|
|
6746
6961
|
children
|
|
6747
6962
|
}
|
|
6748
6963
|
),
|
|
6749
|
-
footer ? /* @__PURE__ */
|
|
6964
|
+
footer ? /* @__PURE__ */ jsx47(
|
|
6750
6965
|
"footer",
|
|
6751
6966
|
{
|
|
6752
6967
|
className: cx("nu-panel__footer", slotClassNames?.footer),
|
|
@@ -6762,11 +6977,11 @@ function Panel({
|
|
|
6762
6977
|
// src/components/PropertyGrid/PropertyGrid.tsx
|
|
6763
6978
|
import {
|
|
6764
6979
|
useId as useId9,
|
|
6765
|
-
useMemo as
|
|
6766
|
-
useRef as
|
|
6980
|
+
useMemo as useMemo15,
|
|
6981
|
+
useRef as useRef17,
|
|
6767
6982
|
useState as useState22
|
|
6768
6983
|
} from "react";
|
|
6769
|
-
import { jsx as
|
|
6984
|
+
import { jsx as jsx48, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6770
6985
|
function collectGroupIds(entries) {
|
|
6771
6986
|
const groupIds = /* @__PURE__ */ new Set();
|
|
6772
6987
|
function visit(nextEntries) {
|
|
@@ -6874,23 +7089,23 @@ function PropertyGrid({
|
|
|
6874
7089
|
...props
|
|
6875
7090
|
}) {
|
|
6876
7091
|
const editorIdPrefix = useId9();
|
|
6877
|
-
const rowButtonRefs =
|
|
6878
|
-
const groupIds =
|
|
7092
|
+
const rowButtonRefs = useRef17({});
|
|
7093
|
+
const groupIds = useMemo15(() => collectGroupIds(entries), [entries]);
|
|
6879
7094
|
const isExpandedControlled = expandedIdsProp !== void 0;
|
|
6880
7095
|
const isActiveControlled = activeIdProp !== void 0;
|
|
6881
7096
|
const [uncontrolledExpandedIds, setUncontrolledExpandedIds] = useState22(() => getInitialExpandedIds(entries, defaultExpandedIds));
|
|
6882
7097
|
const resolvedExpandedIds = expandedIdsProp ?? uncontrolledExpandedIds;
|
|
6883
|
-
const expandedIdSet =
|
|
7098
|
+
const expandedIdSet = useMemo15(
|
|
6884
7099
|
() => new Set(
|
|
6885
7100
|
resolvedExpandedIds.filter((expandedId) => groupIds.has(expandedId))
|
|
6886
7101
|
),
|
|
6887
7102
|
[groupIds, resolvedExpandedIds]
|
|
6888
7103
|
);
|
|
6889
|
-
const rows =
|
|
7104
|
+
const rows = useMemo15(
|
|
6890
7105
|
() => collectVisibleRows(entries, expandedIdSet),
|
|
6891
7106
|
[entries, expandedIdSet]
|
|
6892
7107
|
);
|
|
6893
|
-
const interactiveRows =
|
|
7108
|
+
const interactiveRows = useMemo15(() => collectInteractiveRows(rows), [rows]);
|
|
6894
7109
|
const [uncontrolledActiveId, setUncontrolledActiveId] = useState22(() => getInitialActiveId2(interactiveRows, defaultActiveId));
|
|
6895
7110
|
const requestedActiveId = isActiveControlled ? activeIdProp : uncontrolledActiveId;
|
|
6896
7111
|
const resolvedActiveId = requestedActiveId && interactiveRows.some((row) => row.id === requestedActiveId) ? requestedActiveId : interactiveRows[0]?.id;
|
|
@@ -7010,7 +7225,7 @@ function PropertyGrid({
|
|
|
7010
7225
|
const nextExpandedIds = expandedIdSet.has(entry.id) ? resolvedExpandedIds.filter((expandedId) => expandedId !== entry.id) : [...resolvedExpandedIds, entry.id];
|
|
7011
7226
|
updateExpandedIds(nextExpandedIds);
|
|
7012
7227
|
}
|
|
7013
|
-
return /* @__PURE__ */
|
|
7228
|
+
return /* @__PURE__ */ jsx48(
|
|
7014
7229
|
"div",
|
|
7015
7230
|
{
|
|
7016
7231
|
...props,
|
|
@@ -7021,9 +7236,9 @@ function PropertyGrid({
|
|
|
7021
7236
|
...style,
|
|
7022
7237
|
"--nu-property-grid-label-width": labelWidth
|
|
7023
7238
|
},
|
|
7024
|
-
children: /* @__PURE__ */
|
|
7239
|
+
children: /* @__PURE__ */ jsx48("div", { className: "nu-property-grid__body", children: rows.map((row) => {
|
|
7025
7240
|
if (row.type === "section") {
|
|
7026
|
-
return /* @__PURE__ */
|
|
7241
|
+
return /* @__PURE__ */ jsx48("div", { className: "nu-property-grid__section", children: renderMnemonicText(row.entry.title) }, row.entry.id);
|
|
7027
7242
|
}
|
|
7028
7243
|
if (row.type === "group") {
|
|
7029
7244
|
const isExpanded = expandedIdSet.has(row.entry.id);
|
|
@@ -7036,7 +7251,7 @@ function PropertyGrid({
|
|
|
7036
7251
|
"data-expanded": isExpanded || void 0,
|
|
7037
7252
|
"data-group": true,
|
|
7038
7253
|
children: [
|
|
7039
|
-
/* @__PURE__ */
|
|
7254
|
+
/* @__PURE__ */ jsx48(
|
|
7040
7255
|
"button",
|
|
7041
7256
|
{
|
|
7042
7257
|
className: "nu-property-grid__label nu-property-grid__label-button",
|
|
@@ -7057,17 +7272,17 @@ function PropertyGrid({
|
|
|
7057
7272
|
},
|
|
7058
7273
|
type: "button",
|
|
7059
7274
|
children: /* @__PURE__ */ jsxs29("span", { className: "nu-property-grid__lead", children: [
|
|
7060
|
-
/* @__PURE__ */
|
|
7275
|
+
/* @__PURE__ */ jsx48("span", { className: "nu-property-grid__expander", children: /* @__PURE__ */ jsx48(
|
|
7061
7276
|
NuGlyph,
|
|
7062
7277
|
{
|
|
7063
7278
|
name: isExpanded ? "tree-caret-down" : "tree-caret-right"
|
|
7064
7279
|
}
|
|
7065
7280
|
) }),
|
|
7066
|
-
/* @__PURE__ */
|
|
7281
|
+
/* @__PURE__ */ jsx48("span", { className: "nu-property-grid__label-text", children: renderMnemonicText(row.entry.label) })
|
|
7067
7282
|
] })
|
|
7068
7283
|
}
|
|
7069
7284
|
),
|
|
7070
|
-
/* @__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 })
|
|
7071
7286
|
]
|
|
7072
7287
|
},
|
|
7073
7288
|
row.entry.id
|
|
@@ -7081,7 +7296,7 @@ function PropertyGrid({
|
|
|
7081
7296
|
"data-active": resolvedActiveId === row.entry.id || void 0,
|
|
7082
7297
|
"data-disabled": row.entry.disabled || void 0,
|
|
7083
7298
|
children: [
|
|
7084
|
-
/* @__PURE__ */
|
|
7299
|
+
/* @__PURE__ */ jsx48(
|
|
7085
7300
|
"button",
|
|
7086
7301
|
{
|
|
7087
7302
|
className: "nu-property-grid__label nu-property-grid__label-button",
|
|
@@ -7102,8 +7317,8 @@ function PropertyGrid({
|
|
|
7102
7317
|
},
|
|
7103
7318
|
type: "button",
|
|
7104
7319
|
children: /* @__PURE__ */ jsxs29("span", { className: "nu-property-grid__lead", children: [
|
|
7105
|
-
/* @__PURE__ */
|
|
7106
|
-
/* @__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) })
|
|
7107
7322
|
] })
|
|
7108
7323
|
}
|
|
7109
7324
|
),
|
|
@@ -7114,8 +7329,8 @@ function PropertyGrid({
|
|
|
7114
7329
|
id: editorId,
|
|
7115
7330
|
onFocusCapture: () => updateActiveId(row.entry.id),
|
|
7116
7331
|
children: [
|
|
7117
|
-
/* @__PURE__ */
|
|
7118
|
-
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
|
|
7119
7334
|
]
|
|
7120
7335
|
}
|
|
7121
7336
|
)
|
|
@@ -7129,7 +7344,7 @@ function PropertyGrid({
|
|
|
7129
7344
|
}
|
|
7130
7345
|
|
|
7131
7346
|
// src/components/ProgressBar/ProgressBar.tsx
|
|
7132
|
-
import { jsx as
|
|
7347
|
+
import { jsx as jsx49, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
7133
7348
|
function clamp3(value, min, max) {
|
|
7134
7349
|
return Math.min(max, Math.max(min, value));
|
|
7135
7350
|
}
|
|
@@ -7165,7 +7380,7 @@ function ProgressBar({
|
|
|
7165
7380
|
role: "progressbar",
|
|
7166
7381
|
style: mergeSlotStyle(style, slotStyles?.root),
|
|
7167
7382
|
children: [
|
|
7168
|
-
label ? /* @__PURE__ */
|
|
7383
|
+
label ? /* @__PURE__ */ jsx49(
|
|
7169
7384
|
"span",
|
|
7170
7385
|
{
|
|
7171
7386
|
className: cx("nu-progress-bar__label", slotClassNames?.label),
|
|
@@ -7184,7 +7399,7 @@ function ProgressBar({
|
|
|
7184
7399
|
slotStyles?.track
|
|
7185
7400
|
),
|
|
7186
7401
|
children: [
|
|
7187
|
-
/* @__PURE__ */
|
|
7402
|
+
/* @__PURE__ */ jsx49(
|
|
7188
7403
|
"div",
|
|
7189
7404
|
{
|
|
7190
7405
|
className: cx("nu-progress-bar__fill", slotClassNames?.fill),
|
|
@@ -7197,7 +7412,7 @@ function ProgressBar({
|
|
|
7197
7412
|
)
|
|
7198
7413
|
}
|
|
7199
7414
|
),
|
|
7200
|
-
showValue ? /* @__PURE__ */
|
|
7415
|
+
showValue ? /* @__PURE__ */ jsx49(
|
|
7201
7416
|
"span",
|
|
7202
7417
|
{
|
|
7203
7418
|
className: cx("nu-progress-bar__value", slotClassNames?.value),
|
|
@@ -7208,7 +7423,7 @@ function ProgressBar({
|
|
|
7208
7423
|
]
|
|
7209
7424
|
}
|
|
7210
7425
|
),
|
|
7211
|
-
hint ? /* @__PURE__ */
|
|
7426
|
+
hint ? /* @__PURE__ */ jsx49(
|
|
7212
7427
|
"span",
|
|
7213
7428
|
{
|
|
7214
7429
|
className: cx("nu-progress-bar__hint", slotClassNames?.hint),
|
|
@@ -7223,7 +7438,7 @@ function ProgressBar({
|
|
|
7223
7438
|
|
|
7224
7439
|
// src/components/RadioGroup/RadioButton.tsx
|
|
7225
7440
|
import { useId as useId10, useState as useState23 } from "react";
|
|
7226
|
-
import { jsx as
|
|
7441
|
+
import { jsx as jsx50, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
7227
7442
|
function RadioButton({
|
|
7228
7443
|
checked,
|
|
7229
7444
|
className,
|
|
@@ -7249,7 +7464,7 @@ function RadioButton({
|
|
|
7249
7464
|
}
|
|
7250
7465
|
return /* @__PURE__ */ jsxs31("label", { className: ["nu-radio-button", className].filter(Boolean).join(" "), children: [
|
|
7251
7466
|
/* @__PURE__ */ jsxs31("span", { className: "nu-radio-button__main", children: [
|
|
7252
|
-
/* @__PURE__ */
|
|
7467
|
+
/* @__PURE__ */ jsx50(
|
|
7253
7468
|
"input",
|
|
7254
7469
|
{
|
|
7255
7470
|
...props,
|
|
@@ -7262,19 +7477,19 @@ function RadioButton({
|
|
|
7262
7477
|
type: "radio"
|
|
7263
7478
|
}
|
|
7264
7479
|
),
|
|
7265
|
-
/* @__PURE__ */
|
|
7266
|
-
/* @__PURE__ */
|
|
7267
|
-
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
|
|
7268
7483
|
] }) }),
|
|
7269
|
-
/* @__PURE__ */
|
|
7484
|
+
/* @__PURE__ */ jsx50("span", { className: "nu-radio-button__label", children: renderMnemonicText(label) })
|
|
7270
7485
|
] }),
|
|
7271
|
-
hint ? /* @__PURE__ */
|
|
7486
|
+
hint ? /* @__PURE__ */ jsx50("span", { className: "nu-radio-button__hint", id: hintId, children: hint }) : null
|
|
7272
7487
|
] });
|
|
7273
7488
|
}
|
|
7274
7489
|
|
|
7275
7490
|
// src/components/RadioGroup/RadioGroup.tsx
|
|
7276
7491
|
import { useId as useId11, useState as useState24 } from "react";
|
|
7277
|
-
import { jsx as
|
|
7492
|
+
import { jsx as jsx51, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
7278
7493
|
function RadioGroup({
|
|
7279
7494
|
className,
|
|
7280
7495
|
defaultValue,
|
|
@@ -7309,7 +7524,7 @@ function RadioGroup({
|
|
|
7309
7524
|
className: cx("nu-radio-group", slotClassNames?.root, className),
|
|
7310
7525
|
style: mergeSlotStyle(style, slotStyles?.root),
|
|
7311
7526
|
children: [
|
|
7312
|
-
label ? /* @__PURE__ */
|
|
7527
|
+
label ? /* @__PURE__ */ jsx51(
|
|
7313
7528
|
"legend",
|
|
7314
7529
|
{
|
|
7315
7530
|
className: cx("nu-radio-group__label", slotClassNames?.label),
|
|
@@ -7317,12 +7532,12 @@ function RadioGroup({
|
|
|
7317
7532
|
children: renderMnemonicText(label)
|
|
7318
7533
|
}
|
|
7319
7534
|
) : null,
|
|
7320
|
-
/* @__PURE__ */
|
|
7535
|
+
/* @__PURE__ */ jsx51(
|
|
7321
7536
|
"div",
|
|
7322
7537
|
{
|
|
7323
7538
|
className: cx("nu-radio-group__options", slotClassNames?.options),
|
|
7324
7539
|
style: slotStyles?.options,
|
|
7325
|
-
children: options.map((option) => /* @__PURE__ */
|
|
7540
|
+
children: options.map((option) => /* @__PURE__ */ jsx51(
|
|
7326
7541
|
RadioButton,
|
|
7327
7542
|
{
|
|
7328
7543
|
checked: resolvedValue === option.value,
|
|
@@ -7341,7 +7556,7 @@ function RadioGroup({
|
|
|
7341
7556
|
))
|
|
7342
7557
|
}
|
|
7343
7558
|
),
|
|
7344
|
-
hint ? /* @__PURE__ */
|
|
7559
|
+
hint ? /* @__PURE__ */ jsx51(
|
|
7345
7560
|
"span",
|
|
7346
7561
|
{
|
|
7347
7562
|
className: cx("nu-radio-group__hint", slotClassNames?.hint),
|
|
@@ -7356,14 +7571,14 @@ function RadioGroup({
|
|
|
7356
7571
|
}
|
|
7357
7572
|
|
|
7358
7573
|
// src/components/ReportCell/ReportCell.tsx
|
|
7359
|
-
import { jsx as
|
|
7574
|
+
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
7360
7575
|
function ReportCell({
|
|
7361
7576
|
align = "start",
|
|
7362
7577
|
className,
|
|
7363
7578
|
tone = "default",
|
|
7364
7579
|
...props
|
|
7365
7580
|
}) {
|
|
7366
|
-
return /* @__PURE__ */
|
|
7581
|
+
return /* @__PURE__ */ jsx52(
|
|
7367
7582
|
"span",
|
|
7368
7583
|
{
|
|
7369
7584
|
...props,
|
|
@@ -7381,12 +7596,12 @@ function ReportCell({
|
|
|
7381
7596
|
import {
|
|
7382
7597
|
useEffect as useEffect13,
|
|
7383
7598
|
useId as useId12,
|
|
7384
|
-
useMemo as
|
|
7385
|
-
useRef as
|
|
7599
|
+
useMemo as useMemo16,
|
|
7600
|
+
useRef as useRef18,
|
|
7386
7601
|
useState as useState25
|
|
7387
7602
|
} from "react";
|
|
7388
7603
|
import { createPortal as createPortal4 } from "react-dom";
|
|
7389
|
-
import { jsx as
|
|
7604
|
+
import { jsx as jsx53, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
7390
7605
|
function resolveSearchBoxPortalRoot() {
|
|
7391
7606
|
return document.body;
|
|
7392
7607
|
}
|
|
@@ -7414,11 +7629,11 @@ function SearchBox({
|
|
|
7414
7629
|
style,
|
|
7415
7630
|
...props
|
|
7416
7631
|
}) {
|
|
7417
|
-
const rootRef =
|
|
7418
|
-
const fieldRef =
|
|
7419
|
-
const inputRef =
|
|
7420
|
-
const popupRef =
|
|
7421
|
-
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);
|
|
7422
7637
|
const generatedId = useId12();
|
|
7423
7638
|
const fieldId = `${generatedId}-search-box`;
|
|
7424
7639
|
const labelId = `${fieldId}-label`;
|
|
@@ -7431,7 +7646,7 @@ function SearchBox({
|
|
|
7431
7646
|
const [selectedValue, setSelectedValue] = useState25(null);
|
|
7432
7647
|
const normalizedQuery = (isQueryControlled ? queryProp : uncontrolledQuery) ?? "";
|
|
7433
7648
|
const trimmedQuery = normalizedQuery.trim();
|
|
7434
|
-
const resultOptions =
|
|
7649
|
+
const resultOptions = useMemo16(() => {
|
|
7435
7650
|
return results.map((item, index) => ({
|
|
7436
7651
|
item,
|
|
7437
7652
|
listBoxItem: {
|
|
@@ -7445,7 +7660,7 @@ function SearchBox({
|
|
|
7445
7660
|
value: getItemId(item, index)
|
|
7446
7661
|
}));
|
|
7447
7662
|
}, [getItemDetails, getItemDisabled, getItemId, getItemText, results]);
|
|
7448
|
-
const listBoxData =
|
|
7663
|
+
const listBoxData = useMemo16(
|
|
7449
7664
|
() => [
|
|
7450
7665
|
{
|
|
7451
7666
|
category: null,
|
|
@@ -7536,15 +7751,15 @@ function SearchBox({
|
|
|
7536
7751
|
}
|
|
7537
7752
|
function renderPopupContent() {
|
|
7538
7753
|
if (status === "loading") {
|
|
7539
|
-
return /* @__PURE__ */
|
|
7754
|
+
return /* @__PURE__ */ jsx53("div", { className: "nu-search-box__status", children: loadingText });
|
|
7540
7755
|
}
|
|
7541
7756
|
if (status === "error") {
|
|
7542
|
-
return /* @__PURE__ */
|
|
7757
|
+
return /* @__PURE__ */ jsx53("div", { className: "nu-search-box__status", children: errorText });
|
|
7543
7758
|
}
|
|
7544
7759
|
if (trimmedQuery.length < minQueryLength) {
|
|
7545
|
-
return /* @__PURE__ */
|
|
7760
|
+
return /* @__PURE__ */ jsx53("div", { className: "nu-search-box__status", children: idleText });
|
|
7546
7761
|
}
|
|
7547
|
-
return /* @__PURE__ */
|
|
7762
|
+
return /* @__PURE__ */ jsx53("div", { className: "nu-search-box__listbox", children: /* @__PURE__ */ jsx53(
|
|
7548
7763
|
ListBox,
|
|
7549
7764
|
{
|
|
7550
7765
|
data: listBoxData,
|
|
@@ -7589,10 +7804,10 @@ function SearchBox({
|
|
|
7589
7804
|
ref: rootRef,
|
|
7590
7805
|
style,
|
|
7591
7806
|
children: [
|
|
7592
|
-
/* @__PURE__ */
|
|
7807
|
+
/* @__PURE__ */ jsx53("label", { className: "nu-search-box__label", htmlFor: fieldId, id: labelId, children: renderMnemonicText(label) }),
|
|
7593
7808
|
/* @__PURE__ */ jsxs33("span", { className: "nu-search-box__slot", ref: fieldRef, children: [
|
|
7594
|
-
/* @__PURE__ */
|
|
7595
|
-
/* @__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(
|
|
7596
7811
|
"input",
|
|
7597
7812
|
{
|
|
7598
7813
|
"aria-autocomplete": "list",
|
|
@@ -7617,11 +7832,11 @@ function SearchBox({
|
|
|
7617
7832
|
value: normalizedQuery
|
|
7618
7833
|
}
|
|
7619
7834
|
) }),
|
|
7620
|
-
/* @__PURE__ */
|
|
7835
|
+
/* @__PURE__ */ jsx53("span", { "aria-hidden": "true", className: "nu-search-box__bracket", children: "]" })
|
|
7621
7836
|
] }),
|
|
7622
|
-
hint ? /* @__PURE__ */
|
|
7837
|
+
hint ? /* @__PURE__ */ jsx53("span", { className: "nu-search-box__hint", id: hintId, children: hint }) : null,
|
|
7623
7838
|
open && popupRoot ? createPortal4(
|
|
7624
|
-
/* @__PURE__ */
|
|
7839
|
+
/* @__PURE__ */ jsx53(
|
|
7625
7840
|
"div",
|
|
7626
7841
|
{
|
|
7627
7842
|
className: "nu-search-box__popup",
|
|
@@ -7641,10 +7856,10 @@ function SearchBox({
|
|
|
7641
7856
|
// src/components/SpinBox/SpinBox.tsx
|
|
7642
7857
|
import {
|
|
7643
7858
|
useId as useId13,
|
|
7644
|
-
useMemo as
|
|
7859
|
+
useMemo as useMemo17,
|
|
7645
7860
|
useState as useState26
|
|
7646
7861
|
} from "react";
|
|
7647
|
-
import { jsx as
|
|
7862
|
+
import { jsx as jsx54, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
7648
7863
|
function clampSpinValue(value, min, max) {
|
|
7649
7864
|
let nextValue = value;
|
|
7650
7865
|
if (min !== void 0) {
|
|
@@ -7749,11 +7964,11 @@ function SpinBox({
|
|
|
7749
7964
|
}
|
|
7750
7965
|
onKeyDown?.(event);
|
|
7751
7966
|
}
|
|
7752
|
-
const decrementDisabled =
|
|
7967
|
+
const decrementDisabled = useMemo17(
|
|
7753
7968
|
() => disabled || min !== void 0 && numericValue <= min,
|
|
7754
7969
|
[disabled, min, numericValue]
|
|
7755
7970
|
);
|
|
7756
|
-
const incrementDisabled =
|
|
7971
|
+
const incrementDisabled = useMemo17(
|
|
7757
7972
|
() => disabled || max !== void 0 && numericValue >= max,
|
|
7758
7973
|
[disabled, max, numericValue]
|
|
7759
7974
|
);
|
|
@@ -7764,7 +7979,7 @@ function SpinBox({
|
|
|
7764
7979
|
htmlFor: fieldId,
|
|
7765
7980
|
style: mergeSlotStyle(style, slotStyles?.root),
|
|
7766
7981
|
children: [
|
|
7767
|
-
/* @__PURE__ */
|
|
7982
|
+
/* @__PURE__ */ jsx54(
|
|
7768
7983
|
"span",
|
|
7769
7984
|
{
|
|
7770
7985
|
className: cx("nu-spin-box__label", slotClassNames?.label),
|
|
@@ -7778,7 +7993,7 @@ function SpinBox({
|
|
|
7778
7993
|
className: cx("nu-spin-box__slot", slotClassNames?.slot),
|
|
7779
7994
|
style: slotStyles?.slot,
|
|
7780
7995
|
children: [
|
|
7781
|
-
/* @__PURE__ */
|
|
7996
|
+
/* @__PURE__ */ jsx54(
|
|
7782
7997
|
"span",
|
|
7783
7998
|
{
|
|
7784
7999
|
"aria-hidden": "true",
|
|
@@ -7787,12 +8002,12 @@ function SpinBox({
|
|
|
7787
8002
|
children: "["
|
|
7788
8003
|
}
|
|
7789
8004
|
),
|
|
7790
|
-
/* @__PURE__ */
|
|
8005
|
+
/* @__PURE__ */ jsx54(
|
|
7791
8006
|
"span",
|
|
7792
8007
|
{
|
|
7793
8008
|
className: cx("nu-spin-box__input-shell", slotClassNames?.inputShell),
|
|
7794
8009
|
style: slotStyles?.inputShell,
|
|
7795
|
-
children: /* @__PURE__ */
|
|
8010
|
+
children: /* @__PURE__ */ jsx54(
|
|
7796
8011
|
"input",
|
|
7797
8012
|
{
|
|
7798
8013
|
...props,
|
|
@@ -7811,7 +8026,7 @@ function SpinBox({
|
|
|
7811
8026
|
)
|
|
7812
8027
|
}
|
|
7813
8028
|
),
|
|
7814
|
-
/* @__PURE__ */
|
|
8029
|
+
/* @__PURE__ */ jsx54(
|
|
7815
8030
|
"span",
|
|
7816
8031
|
{
|
|
7817
8032
|
"aria-hidden": "true",
|
|
@@ -7826,7 +8041,7 @@ function SpinBox({
|
|
|
7826
8041
|
className: cx("nu-spin-box__controls", slotClassNames?.controls),
|
|
7827
8042
|
style: slotStyles?.controls,
|
|
7828
8043
|
children: [
|
|
7829
|
-
/* @__PURE__ */
|
|
8044
|
+
/* @__PURE__ */ jsx54(
|
|
7830
8045
|
"button",
|
|
7831
8046
|
{
|
|
7832
8047
|
className: cx("nu-spin-box__button", slotClassNames?.button),
|
|
@@ -7837,7 +8052,7 @@ function SpinBox({
|
|
|
7837
8052
|
children: "-"
|
|
7838
8053
|
}
|
|
7839
8054
|
),
|
|
7840
|
-
/* @__PURE__ */
|
|
8055
|
+
/* @__PURE__ */ jsx54(
|
|
7841
8056
|
"button",
|
|
7842
8057
|
{
|
|
7843
8058
|
className: cx("nu-spin-box__button", slotClassNames?.button),
|
|
@@ -7854,7 +8069,7 @@ function SpinBox({
|
|
|
7854
8069
|
]
|
|
7855
8070
|
}
|
|
7856
8071
|
),
|
|
7857
|
-
hint ? /* @__PURE__ */
|
|
8072
|
+
hint ? /* @__PURE__ */ jsx54(
|
|
7858
8073
|
"span",
|
|
7859
8074
|
{
|
|
7860
8075
|
className: cx("nu-spin-box__hint", slotClassNames?.hint),
|
|
@@ -7872,10 +8087,10 @@ function SpinBox({
|
|
|
7872
8087
|
import {
|
|
7873
8088
|
useEffect as useEffect14,
|
|
7874
8089
|
useId as useId14,
|
|
7875
|
-
useRef as
|
|
8090
|
+
useRef as useRef19,
|
|
7876
8091
|
useState as useState27
|
|
7877
8092
|
} from "react";
|
|
7878
|
-
import { jsx as
|
|
8093
|
+
import { jsx as jsx55, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
7879
8094
|
function clamp4(value, min, max) {
|
|
7880
8095
|
return Math.min(max, Math.max(min, value));
|
|
7881
8096
|
}
|
|
@@ -7909,9 +8124,9 @@ function Splitter({
|
|
|
7909
8124
|
const [uncontrolledValue, setUncontrolledValue] = useState27(
|
|
7910
8125
|
clamp4(getSavedValue() ?? defaultValue, min, max)
|
|
7911
8126
|
);
|
|
7912
|
-
const rootRef =
|
|
7913
|
-
const dragFrameRef =
|
|
7914
|
-
const dragValueRef =
|
|
8127
|
+
const rootRef = useRef19(null);
|
|
8128
|
+
const dragFrameRef = useRef19(null);
|
|
8129
|
+
const dragValueRef = useRef19(null);
|
|
7915
8130
|
const activeValue = clamp4(
|
|
7916
8131
|
(isControlled ? value : uncontrolledValue) ?? defaultValue,
|
|
7917
8132
|
min,
|
|
@@ -8042,8 +8257,8 @@ function Splitter({
|
|
|
8042
8257
|
"--nu-splitter-value": `${activeValue * 100}%`
|
|
8043
8258
|
},
|
|
8044
8259
|
children: [
|
|
8045
|
-
/* @__PURE__ */
|
|
8046
|
-
/* @__PURE__ */
|
|
8260
|
+
/* @__PURE__ */ jsx55("div", { className: "nu-splitter__pane", id: firstPaneId, children: first }),
|
|
8261
|
+
/* @__PURE__ */ jsx55(
|
|
8047
8262
|
"div",
|
|
8048
8263
|
{
|
|
8049
8264
|
"aria-controls": `${firstPaneId} ${secondPaneId}`,
|
|
@@ -8056,7 +8271,7 @@ function Splitter({
|
|
|
8056
8271
|
onPointerDown: handlePointerDown,
|
|
8057
8272
|
role: "separator",
|
|
8058
8273
|
tabIndex: 0,
|
|
8059
|
-
children: /* @__PURE__ */
|
|
8274
|
+
children: /* @__PURE__ */ jsx55(
|
|
8060
8275
|
"span",
|
|
8061
8276
|
{
|
|
8062
8277
|
"aria-hidden": "true",
|
|
@@ -8066,7 +8281,7 @@ function Splitter({
|
|
|
8066
8281
|
)
|
|
8067
8282
|
}
|
|
8068
8283
|
),
|
|
8069
|
-
/* @__PURE__ */
|
|
8284
|
+
/* @__PURE__ */ jsx55("div", { className: "nu-splitter__pane", id: secondPaneId, children: second })
|
|
8070
8285
|
]
|
|
8071
8286
|
}
|
|
8072
8287
|
);
|
|
@@ -8076,11 +8291,11 @@ function Splitter({
|
|
|
8076
8291
|
import {
|
|
8077
8292
|
useEffect as useEffect15,
|
|
8078
8293
|
useId as useId15,
|
|
8079
|
-
useMemo as
|
|
8080
|
-
useRef as
|
|
8294
|
+
useMemo as useMemo18,
|
|
8295
|
+
useRef as useRef20,
|
|
8081
8296
|
useState as useState28
|
|
8082
8297
|
} from "react";
|
|
8083
|
-
import { jsx as
|
|
8298
|
+
import { jsx as jsx56, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
8084
8299
|
function clamp5(value, min, max) {
|
|
8085
8300
|
return Math.min(max, Math.max(min, value));
|
|
8086
8301
|
}
|
|
@@ -8127,10 +8342,10 @@ function TickBar({
|
|
|
8127
8342
|
);
|
|
8128
8343
|
const [uncontrolledValue, setUncontrolledValue] = useState28(initialValue);
|
|
8129
8344
|
const [dragging, setDragging] = useState28(false);
|
|
8130
|
-
const trackRef =
|
|
8345
|
+
const trackRef = useRef20(null);
|
|
8131
8346
|
const resolvedValue = isControlled ? clamp5(snapToStep(value ?? initialValue, min, safeStep), min, safeMax) : uncontrolledValue;
|
|
8132
8347
|
const ratio = safeMax === min ? 0 : (resolvedValue - min) / (safeMax - min);
|
|
8133
|
-
const derivedTickCount =
|
|
8348
|
+
const derivedTickCount = useMemo18(() => {
|
|
8134
8349
|
if (tickCount !== void 0) {
|
|
8135
8350
|
return Math.max(2, tickCount);
|
|
8136
8351
|
}
|
|
@@ -8229,7 +8444,7 @@ function TickBar({
|
|
|
8229
8444
|
slotStyles?.root
|
|
8230
8445
|
),
|
|
8231
8446
|
children: [
|
|
8232
|
-
label ? /* @__PURE__ */
|
|
8447
|
+
label ? /* @__PURE__ */ jsx56(
|
|
8233
8448
|
"span",
|
|
8234
8449
|
{
|
|
8235
8450
|
className: cx("nu-tick-bar__label", slotClassNames?.label),
|
|
@@ -8285,19 +8500,19 @@ function TickBar({
|
|
|
8285
8500
|
style: slotStyles?.track,
|
|
8286
8501
|
tabIndex: disabled ? -1 : 0,
|
|
8287
8502
|
children: [
|
|
8288
|
-
/* @__PURE__ */
|
|
8503
|
+
/* @__PURE__ */ jsx56(
|
|
8289
8504
|
"div",
|
|
8290
8505
|
{
|
|
8291
8506
|
className: cx("nu-tick-bar__rail", slotClassNames?.rail),
|
|
8292
8507
|
style: slotStyles?.rail
|
|
8293
8508
|
}
|
|
8294
8509
|
),
|
|
8295
|
-
/* @__PURE__ */
|
|
8510
|
+
/* @__PURE__ */ jsx56(
|
|
8296
8511
|
"div",
|
|
8297
8512
|
{
|
|
8298
8513
|
className: cx("nu-tick-bar__ticks", slotClassNames?.ticks),
|
|
8299
8514
|
style: slotStyles?.ticks,
|
|
8300
|
-
children: Array.from({ length: derivedTickCount }, (_, index) => /* @__PURE__ */
|
|
8515
|
+
children: Array.from({ length: derivedTickCount }, (_, index) => /* @__PURE__ */ jsx56(
|
|
8301
8516
|
"span",
|
|
8302
8517
|
{
|
|
8303
8518
|
"aria-hidden": "true",
|
|
@@ -8308,7 +8523,7 @@ function TickBar({
|
|
|
8308
8523
|
))
|
|
8309
8524
|
}
|
|
8310
8525
|
),
|
|
8311
|
-
/* @__PURE__ */
|
|
8526
|
+
/* @__PURE__ */ jsx56(
|
|
8312
8527
|
"div",
|
|
8313
8528
|
{
|
|
8314
8529
|
"aria-hidden": "true",
|
|
@@ -8326,7 +8541,7 @@ function TickBar({
|
|
|
8326
8541
|
]
|
|
8327
8542
|
}
|
|
8328
8543
|
),
|
|
8329
|
-
showValue ? /* @__PURE__ */
|
|
8544
|
+
showValue ? /* @__PURE__ */ jsx56(
|
|
8330
8545
|
"span",
|
|
8331
8546
|
{
|
|
8332
8547
|
className: cx("nu-tick-bar__value", slotClassNames?.value),
|
|
@@ -8337,7 +8552,7 @@ function TickBar({
|
|
|
8337
8552
|
]
|
|
8338
8553
|
}
|
|
8339
8554
|
),
|
|
8340
|
-
hint ? /* @__PURE__ */
|
|
8555
|
+
hint ? /* @__PURE__ */ jsx56(
|
|
8341
8556
|
"span",
|
|
8342
8557
|
{
|
|
8343
8558
|
className: cx("nu-tick-bar__hint", slotClassNames?.hint),
|
|
@@ -8352,7 +8567,7 @@ function TickBar({
|
|
|
8352
8567
|
}
|
|
8353
8568
|
|
|
8354
8569
|
// src/components/ToolBar/ToolBar.tsx
|
|
8355
|
-
import { jsx as
|
|
8570
|
+
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
8356
8571
|
function ToolBar({
|
|
8357
8572
|
children,
|
|
8358
8573
|
className,
|
|
@@ -8362,7 +8577,7 @@ function ToolBar({
|
|
|
8362
8577
|
wrap = false,
|
|
8363
8578
|
...props
|
|
8364
8579
|
}) {
|
|
8365
|
-
return /* @__PURE__ */
|
|
8580
|
+
return /* @__PURE__ */ jsx57(
|
|
8366
8581
|
"div",
|
|
8367
8582
|
{
|
|
8368
8583
|
...props,
|
|
@@ -8381,7 +8596,7 @@ function ToolButton({
|
|
|
8381
8596
|
slotStyles,
|
|
8382
8597
|
...props
|
|
8383
8598
|
}) {
|
|
8384
|
-
return /* @__PURE__ */
|
|
8599
|
+
return /* @__PURE__ */ jsx57(
|
|
8385
8600
|
CommandButton,
|
|
8386
8601
|
{
|
|
8387
8602
|
...props,
|
|
@@ -8411,7 +8626,7 @@ function ToolDropButton({
|
|
|
8411
8626
|
uncheckedShape,
|
|
8412
8627
|
...props
|
|
8413
8628
|
}) {
|
|
8414
|
-
return /* @__PURE__ */
|
|
8629
|
+
return /* @__PURE__ */ jsx57(
|
|
8415
8630
|
CommandButton,
|
|
8416
8631
|
{
|
|
8417
8632
|
...props,
|
|
@@ -8437,7 +8652,7 @@ function ToolDropButton({
|
|
|
8437
8652
|
);
|
|
8438
8653
|
}
|
|
8439
8654
|
function ToolSeparator({ className, ...props }) {
|
|
8440
|
-
return /* @__PURE__ */
|
|
8655
|
+
return /* @__PURE__ */ jsx57(
|
|
8441
8656
|
"div",
|
|
8442
8657
|
{
|
|
8443
8658
|
...props,
|
|
@@ -8459,8 +8674,8 @@ import {
|
|
|
8459
8674
|
useEffect as useEffect16,
|
|
8460
8675
|
useId as useId16,
|
|
8461
8676
|
useImperativeHandle as useImperativeHandle3,
|
|
8462
|
-
useMemo as
|
|
8463
|
-
useRef as
|
|
8677
|
+
useMemo as useMemo19,
|
|
8678
|
+
useRef as useRef21,
|
|
8464
8679
|
useState as useState29
|
|
8465
8680
|
} from "react";
|
|
8466
8681
|
|
|
@@ -8559,7 +8774,7 @@ function collectVisibleTreeItems(items, expandedIds, depth = 0, guideMask = [],
|
|
|
8559
8774
|
|
|
8560
8775
|
// src/components/TreeView/internals/TreeViewItem.tsx
|
|
8561
8776
|
import { memo as memo4 } from "react";
|
|
8562
|
-
import { jsx as
|
|
8777
|
+
import { jsx as jsx58, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
8563
8778
|
function areTreeViewGuideArraysEqual(previousArray, nextArray) {
|
|
8564
8779
|
if (previousArray.length !== nextArray.length) {
|
|
8565
8780
|
return false;
|
|
@@ -8654,7 +8869,7 @@ function TreeViewItemInner({
|
|
|
8654
8869
|
role: "treeitem",
|
|
8655
8870
|
children: [
|
|
8656
8871
|
/* @__PURE__ */ jsxs37("span", { "aria-hidden": "true", className: "nu-tree-view__prefix", children: [
|
|
8657
|
-
guideMask.map((hasGuide, guideIndex) => /* @__PURE__ */
|
|
8872
|
+
guideMask.map((hasGuide, guideIndex) => /* @__PURE__ */ jsx58(
|
|
8658
8873
|
"span",
|
|
8659
8874
|
{
|
|
8660
8875
|
className: "nu-tree-view__guide",
|
|
@@ -8673,19 +8888,19 @@ function TreeViewItemInner({
|
|
|
8673
8888
|
"--nu-tree-view-origin-offset": originOffset
|
|
8674
8889
|
},
|
|
8675
8890
|
children: [
|
|
8676
|
-
depth > 0 ? /* @__PURE__ */
|
|
8891
|
+
depth > 0 ? /* @__PURE__ */ jsx58(
|
|
8677
8892
|
"span",
|
|
8678
8893
|
{
|
|
8679
8894
|
className: "nu-tree-view__branch",
|
|
8680
8895
|
"data-branch": hasNextSibling ? "tee" : "elbow"
|
|
8681
8896
|
}
|
|
8682
8897
|
) : null,
|
|
8683
|
-
hasChildren ? /* @__PURE__ */
|
|
8898
|
+
hasChildren ? /* @__PURE__ */ jsx58(
|
|
8684
8899
|
"span",
|
|
8685
8900
|
{
|
|
8686
8901
|
className: "nu-tree-view__expander",
|
|
8687
8902
|
"data-connector": depth > 0 ? "lead" : void 0,
|
|
8688
|
-
children: /* @__PURE__ */
|
|
8903
|
+
children: /* @__PURE__ */ jsx58(
|
|
8689
8904
|
"button",
|
|
8690
8905
|
{
|
|
8691
8906
|
"aria-label": isExpanded ? "Collapse item" : "Expand item",
|
|
@@ -8693,7 +8908,7 @@ function TreeViewItemInner({
|
|
|
8693
8908
|
onClick: handleToggleExpanded,
|
|
8694
8909
|
tabIndex: -1,
|
|
8695
8910
|
type: "button",
|
|
8696
|
-
children: /* @__PURE__ */
|
|
8911
|
+
children: /* @__PURE__ */ jsx58(
|
|
8697
8912
|
NuGlyph,
|
|
8698
8913
|
{
|
|
8699
8914
|
name: isExpanded ? "tree-caret-down" : "tree-caret-right"
|
|
@@ -8702,7 +8917,7 @@ function TreeViewItemInner({
|
|
|
8702
8917
|
}
|
|
8703
8918
|
)
|
|
8704
8919
|
}
|
|
8705
|
-
) : depth > 0 ? /* @__PURE__ */
|
|
8920
|
+
) : depth > 0 ? /* @__PURE__ */ jsx58(
|
|
8706
8921
|
"span",
|
|
8707
8922
|
{
|
|
8708
8923
|
className: "nu-tree-view__expander-placeholder",
|
|
@@ -8714,7 +8929,7 @@ function TreeViewItemInner({
|
|
|
8714
8929
|
)
|
|
8715
8930
|
] }),
|
|
8716
8931
|
/* @__PURE__ */ jsxs37("span", { className: "nu-tree-view__content", children: [
|
|
8717
|
-
isCheckable ? /* @__PURE__ */
|
|
8932
|
+
isCheckable ? /* @__PURE__ */ jsx58("span", { className: "nu-tree-view__check-slot", children: /* @__PURE__ */ jsx58(
|
|
8718
8933
|
"button",
|
|
8719
8934
|
{
|
|
8720
8935
|
"aria-label": isChecked ? "Uncheck item" : "Check item",
|
|
@@ -8722,12 +8937,12 @@ function TreeViewItemInner({
|
|
|
8722
8937
|
onClick: handleToggleChecked,
|
|
8723
8938
|
tabIndex: -1,
|
|
8724
8939
|
type: "button",
|
|
8725
|
-
children: /* @__PURE__ */
|
|
8940
|
+
children: /* @__PURE__ */ jsx58(
|
|
8726
8941
|
"span",
|
|
8727
8942
|
{
|
|
8728
8943
|
className: "nu-tree-view__check-box",
|
|
8729
8944
|
"data-unchecked-shape": uncheckedShape,
|
|
8730
|
-
children: isChecked ? /* @__PURE__ */
|
|
8945
|
+
children: isChecked ? /* @__PURE__ */ jsx58(
|
|
8731
8946
|
NuGlyph,
|
|
8732
8947
|
{
|
|
8733
8948
|
className: "nu-tree-view__check-mark",
|
|
@@ -8738,14 +8953,14 @@ function TreeViewItemInner({
|
|
|
8738
8953
|
)
|
|
8739
8954
|
}
|
|
8740
8955
|
) }) : null,
|
|
8741
|
-
item.icon ? /* @__PURE__ */
|
|
8742
|
-
/* @__PURE__ */
|
|
8743
|
-
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
|
|
8744
8959
|
] })
|
|
8745
8960
|
]
|
|
8746
8961
|
}
|
|
8747
8962
|
),
|
|
8748
|
-
hasChildren && isExpanded ? /* @__PURE__ */
|
|
8963
|
+
hasChildren && isExpanded ? /* @__PURE__ */ jsx58("div", { role: "group", children: (item.children ?? []).map((child, index) => /* @__PURE__ */ jsx58(
|
|
8749
8964
|
TreeViewItem,
|
|
8750
8965
|
{
|
|
8751
8966
|
depth: depth + 1,
|
|
@@ -8781,7 +8996,7 @@ function areTreeViewItemPropsEqual(previousProps, nextProps) {
|
|
|
8781
8996
|
var TreeViewItem = memo4(TreeViewItemInner, areTreeViewItemPropsEqual);
|
|
8782
8997
|
|
|
8783
8998
|
// src/components/TreeView/TreeView.tsx
|
|
8784
|
-
import { jsx as
|
|
8999
|
+
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
8785
9000
|
function TreeViewInner({
|
|
8786
9001
|
className,
|
|
8787
9002
|
data,
|
|
@@ -8796,9 +9011,9 @@ function TreeViewInner({
|
|
|
8796
9011
|
uncheckedShape = "box",
|
|
8797
9012
|
...props
|
|
8798
9013
|
}, ref) {
|
|
8799
|
-
const rootRef =
|
|
9014
|
+
const rootRef = useRef21(null);
|
|
8800
9015
|
const treeId = useId16();
|
|
8801
|
-
const itemRefs =
|
|
9016
|
+
const itemRefs = useRef21({});
|
|
8802
9017
|
const isExpandedControlled = expandedIds !== void 0;
|
|
8803
9018
|
const [uncontrolledExpandedIds, setUncontrolledExpandedIds] = useState29(() => {
|
|
8804
9019
|
const expandedFromData = collectExpandedTreeIds(data);
|
|
@@ -8809,15 +9024,15 @@ function TreeViewInner({
|
|
|
8809
9024
|
});
|
|
8810
9025
|
const [uncontrolledSelectedId, setUncontrolledSelectedId] = useState29(null);
|
|
8811
9026
|
const resolvedExpandedIds = isExpandedControlled ? expandedIds : uncontrolledExpandedIds;
|
|
8812
|
-
const expandedIdSet =
|
|
9027
|
+
const expandedIdSet = useMemo19(
|
|
8813
9028
|
() => new Set(resolvedExpandedIds),
|
|
8814
9029
|
[resolvedExpandedIds]
|
|
8815
9030
|
);
|
|
8816
|
-
const visibleItems =
|
|
9031
|
+
const visibleItems = useMemo19(
|
|
8817
9032
|
() => collectVisibleTreeItems(data, expandedIdSet),
|
|
8818
9033
|
[data, expandedIdSet]
|
|
8819
9034
|
);
|
|
8820
|
-
const selectableItems =
|
|
9035
|
+
const selectableItems = useMemo19(
|
|
8821
9036
|
() => visibleItems.filter(({ item }) => !item.disabled),
|
|
8822
9037
|
[visibleItems]
|
|
8823
9038
|
);
|
|
@@ -9032,7 +9247,7 @@ function TreeViewInner({
|
|
|
9032
9247
|
setExpandedState
|
|
9033
9248
|
]
|
|
9034
9249
|
);
|
|
9035
|
-
return /* @__PURE__ */
|
|
9250
|
+
return /* @__PURE__ */ jsx59(
|
|
9036
9251
|
"div",
|
|
9037
9252
|
{
|
|
9038
9253
|
...props,
|
|
@@ -9042,7 +9257,7 @@ function TreeViewInner({
|
|
|
9042
9257
|
ref: rootRef,
|
|
9043
9258
|
role: "tree",
|
|
9044
9259
|
tabIndex: 0,
|
|
9045
|
-
children: visibleItems.length > 0 ? data.map((item, index) => /* @__PURE__ */
|
|
9260
|
+
children: visibleItems.length > 0 ? data.map((item, index) => /* @__PURE__ */ jsx59(
|
|
9046
9261
|
TreeViewItem,
|
|
9047
9262
|
{
|
|
9048
9263
|
depth: 0,
|
|
@@ -9062,7 +9277,7 @@ function TreeViewInner({
|
|
|
9062
9277
|
uncheckedShape
|
|
9063
9278
|
},
|
|
9064
9279
|
item.id
|
|
9065
|
-
)) : /* @__PURE__ */
|
|
9280
|
+
)) : /* @__PURE__ */ jsx59("div", { className: "nu-tree-view__empty", children: emptyText })
|
|
9066
9281
|
}
|
|
9067
9282
|
);
|
|
9068
9283
|
}
|
|
@@ -9076,8 +9291,8 @@ import {
|
|
|
9076
9291
|
useId as useId17,
|
|
9077
9292
|
useImperativeHandle as useImperativeHandle4,
|
|
9078
9293
|
useLayoutEffect as useLayoutEffect5,
|
|
9079
|
-
useMemo as
|
|
9080
|
-
useRef as
|
|
9294
|
+
useMemo as useMemo20,
|
|
9295
|
+
useRef as useRef22,
|
|
9081
9296
|
useState as useState30
|
|
9082
9297
|
} from "react";
|
|
9083
9298
|
|
|
@@ -9169,11 +9384,11 @@ function renderTreeListCellValue(item, column) {
|
|
|
9169
9384
|
|
|
9170
9385
|
// src/components/TreeListView/internals/TreeListViewRow.tsx
|
|
9171
9386
|
import { memo as memo5 } from "react";
|
|
9172
|
-
import { Fragment as Fragment7, jsx as
|
|
9387
|
+
import { Fragment as Fragment7, jsx as jsx60, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
9173
9388
|
function renderTreeTitleContent(item) {
|
|
9174
9389
|
return /* @__PURE__ */ jsxs38(Fragment7, { children: [
|
|
9175
|
-
/* @__PURE__ */
|
|
9176
|
-
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
|
|
9177
9392
|
] });
|
|
9178
9393
|
}
|
|
9179
9394
|
function renderReportCellContent(item, column, depth, rowIndex, getCellContent) {
|
|
@@ -9213,12 +9428,14 @@ function TreeListViewRowInner({
|
|
|
9213
9428
|
depth,
|
|
9214
9429
|
expandedIdSet,
|
|
9215
9430
|
getCellContent,
|
|
9431
|
+
getDragItem,
|
|
9216
9432
|
guideMask,
|
|
9217
9433
|
guideOffsets,
|
|
9218
9434
|
hasNextSibling,
|
|
9219
9435
|
item,
|
|
9220
9436
|
onActivateItem,
|
|
9221
9437
|
onDoubleClickItem,
|
|
9438
|
+
onItemDragOut,
|
|
9222
9439
|
onPopupMenuItem,
|
|
9223
9440
|
onToggleItemCheck,
|
|
9224
9441
|
onToggleItemExpanded,
|
|
@@ -9240,6 +9457,18 @@ function TreeListViewRowInner({
|
|
|
9240
9457
|
const isSelected = itemId === selectedItemId;
|
|
9241
9458
|
const rowIndex = rowIndexMap.get(itemId) ?? 0;
|
|
9242
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
|
+
});
|
|
9243
9472
|
function handleActivate() {
|
|
9244
9473
|
if (item.disabled) {
|
|
9245
9474
|
return;
|
|
@@ -9286,7 +9515,7 @@ function TreeListViewRowInner({
|
|
|
9286
9515
|
onToggleItemCheck?.(item, !isChecked);
|
|
9287
9516
|
}
|
|
9288
9517
|
return /* @__PURE__ */ jsxs38(Fragment7, { children: [
|
|
9289
|
-
/* @__PURE__ */
|
|
9518
|
+
/* @__PURE__ */ jsx60(
|
|
9290
9519
|
"div",
|
|
9291
9520
|
{
|
|
9292
9521
|
"aria-disabled": item.disabled || void 0,
|
|
@@ -9304,6 +9533,10 @@ function TreeListViewRowInner({
|
|
|
9304
9533
|
onClick: handleActivate,
|
|
9305
9534
|
onContextMenu: onPopupMenuItem ? handleContextMenu : void 0,
|
|
9306
9535
|
onDoubleClick: handleDoubleClick,
|
|
9536
|
+
onPointerCancel: dragSource.onPointerCancel,
|
|
9537
|
+
onPointerDown: dragSource.onPointerDown,
|
|
9538
|
+
onPointerMove: dragSource.onPointerMove,
|
|
9539
|
+
onPointerUp: dragSource.onPointerUp,
|
|
9307
9540
|
ref: (node) => registerItemRef(itemId, node),
|
|
9308
9541
|
role: "row",
|
|
9309
9542
|
style: {
|
|
@@ -9323,7 +9556,7 @@ function TreeListViewRowInner({
|
|
|
9323
9556
|
role: "gridcell",
|
|
9324
9557
|
children: [
|
|
9325
9558
|
/* @__PURE__ */ jsxs38("span", { "aria-hidden": "true", className: "nu-tree-list-view__prefix", children: [
|
|
9326
|
-
guideMask.map((hasGuide, guideIndex) => /* @__PURE__ */
|
|
9559
|
+
guideMask.map((hasGuide, guideIndex) => /* @__PURE__ */ jsx60(
|
|
9327
9560
|
"span",
|
|
9328
9561
|
{
|
|
9329
9562
|
className: "nu-tree-list-view__guide",
|
|
@@ -9342,19 +9575,19 @@ function TreeListViewRowInner({
|
|
|
9342
9575
|
"--nu-tree-list-view-origin-offset": originOffset
|
|
9343
9576
|
},
|
|
9344
9577
|
children: [
|
|
9345
|
-
depth > 0 ? /* @__PURE__ */
|
|
9578
|
+
depth > 0 ? /* @__PURE__ */ jsx60(
|
|
9346
9579
|
"span",
|
|
9347
9580
|
{
|
|
9348
9581
|
className: "nu-tree-list-view__branch",
|
|
9349
9582
|
"data-branch": hasNextSibling ? "tee" : "elbow"
|
|
9350
9583
|
}
|
|
9351
9584
|
) : null,
|
|
9352
|
-
hasChildren ? /* @__PURE__ */
|
|
9585
|
+
hasChildren ? /* @__PURE__ */ jsx60(
|
|
9353
9586
|
"span",
|
|
9354
9587
|
{
|
|
9355
9588
|
className: "nu-tree-list-view__expander",
|
|
9356
9589
|
"data-connector": depth > 0 ? "lead" : void 0,
|
|
9357
|
-
children: /* @__PURE__ */
|
|
9590
|
+
children: /* @__PURE__ */ jsx60(
|
|
9358
9591
|
"button",
|
|
9359
9592
|
{
|
|
9360
9593
|
"aria-label": isExpanded ? "Collapse item" : "Expand item",
|
|
@@ -9362,7 +9595,7 @@ function TreeListViewRowInner({
|
|
|
9362
9595
|
onClick: handleToggleExpanded,
|
|
9363
9596
|
tabIndex: -1,
|
|
9364
9597
|
type: "button",
|
|
9365
|
-
children: /* @__PURE__ */
|
|
9598
|
+
children: /* @__PURE__ */ jsx60(
|
|
9366
9599
|
NuGlyph,
|
|
9367
9600
|
{
|
|
9368
9601
|
name: isExpanded ? "tree-caret-down" : "tree-caret-right"
|
|
@@ -9371,7 +9604,7 @@ function TreeListViewRowInner({
|
|
|
9371
9604
|
}
|
|
9372
9605
|
)
|
|
9373
9606
|
}
|
|
9374
|
-
) : depth > 0 ? /* @__PURE__ */
|
|
9607
|
+
) : depth > 0 ? /* @__PURE__ */ jsx60(
|
|
9375
9608
|
"span",
|
|
9376
9609
|
{
|
|
9377
9610
|
className: "nu-tree-list-view__expander-placeholder",
|
|
@@ -9383,7 +9616,7 @@ function TreeListViewRowInner({
|
|
|
9383
9616
|
)
|
|
9384
9617
|
] }),
|
|
9385
9618
|
/* @__PURE__ */ jsxs38("span", { className: "nu-tree-list-view__tree-content", children: [
|
|
9386
|
-
isCheckable ? /* @__PURE__ */
|
|
9619
|
+
isCheckable ? /* @__PURE__ */ jsx60("span", { className: "nu-tree-list-view__check-slot", children: /* @__PURE__ */ jsx60(
|
|
9387
9620
|
"button",
|
|
9388
9621
|
{
|
|
9389
9622
|
"aria-label": isChecked ? "Uncheck item" : "Check item",
|
|
@@ -9391,12 +9624,12 @@ function TreeListViewRowInner({
|
|
|
9391
9624
|
onClick: handleToggleChecked,
|
|
9392
9625
|
tabIndex: -1,
|
|
9393
9626
|
type: "button",
|
|
9394
|
-
children: /* @__PURE__ */
|
|
9627
|
+
children: /* @__PURE__ */ jsx60(
|
|
9395
9628
|
"span",
|
|
9396
9629
|
{
|
|
9397
9630
|
className: "nu-tree-list-view__check-box",
|
|
9398
9631
|
"data-unchecked-shape": uncheckedShape,
|
|
9399
|
-
children: isChecked ? /* @__PURE__ */
|
|
9632
|
+
children: isChecked ? /* @__PURE__ */ jsx60(
|
|
9400
9633
|
NuGlyph,
|
|
9401
9634
|
{
|
|
9402
9635
|
className: "nu-tree-list-view__check-mark",
|
|
@@ -9407,13 +9640,13 @@ function TreeListViewRowInner({
|
|
|
9407
9640
|
)
|
|
9408
9641
|
}
|
|
9409
9642
|
) }) : null,
|
|
9410
|
-
item.icon ? /* @__PURE__ */
|
|
9643
|
+
item.icon ? /* @__PURE__ */ jsx60("span", { className: "nu-tree-list-view__icon", children: item.icon }) : null,
|
|
9411
9644
|
renderTreeTitleContent(item)
|
|
9412
9645
|
] })
|
|
9413
9646
|
]
|
|
9414
9647
|
},
|
|
9415
9648
|
column.id
|
|
9416
|
-
) : /* @__PURE__ */
|
|
9649
|
+
) : /* @__PURE__ */ jsx60(
|
|
9417
9650
|
"span",
|
|
9418
9651
|
{
|
|
9419
9652
|
className: [
|
|
@@ -9436,7 +9669,7 @@ function TreeListViewRowInner({
|
|
|
9436
9669
|
)
|
|
9437
9670
|
}
|
|
9438
9671
|
),
|
|
9439
|
-
hasChildren && isExpanded ? /* @__PURE__ */
|
|
9672
|
+
hasChildren && isExpanded ? /* @__PURE__ */ jsx60("div", { role: "rowgroup", children: (item.children ?? []).map((child, index) => /* @__PURE__ */ jsx60(
|
|
9440
9673
|
TreeListViewRow,
|
|
9441
9674
|
{
|
|
9442
9675
|
activeItemId,
|
|
@@ -9445,12 +9678,14 @@ function TreeListViewRowInner({
|
|
|
9445
9678
|
depth: depth + 1,
|
|
9446
9679
|
expandedIdSet,
|
|
9447
9680
|
getCellContent,
|
|
9681
|
+
getDragItem,
|
|
9448
9682
|
guideMask: [...guideMask, hasNextSibling],
|
|
9449
9683
|
guideOffsets: [...guideOffsets, originOffset],
|
|
9450
9684
|
hasNextSibling: index < (item.children?.length ?? 0) - 1,
|
|
9451
9685
|
item: child,
|
|
9452
9686
|
onActivateItem,
|
|
9453
9687
|
onDoubleClickItem,
|
|
9688
|
+
onItemDragOut,
|
|
9454
9689
|
onPopupMenuItem,
|
|
9455
9690
|
onToggleItemCheck,
|
|
9456
9691
|
onToggleItemExpanded,
|
|
@@ -9481,8 +9716,9 @@ var TreeListViewRow = memo5(
|
|
|
9481
9716
|
);
|
|
9482
9717
|
|
|
9483
9718
|
// src/components/TreeListView/TreeListView.tsx
|
|
9484
|
-
import { jsx as
|
|
9719
|
+
import { jsx as jsx61, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
9485
9720
|
function TreeListViewInner({
|
|
9721
|
+
acceptsDrop,
|
|
9486
9722
|
activeItemId: activeItemIdProp,
|
|
9487
9723
|
checkedIds,
|
|
9488
9724
|
className,
|
|
@@ -9494,21 +9730,25 @@ function TreeListViewInner({
|
|
|
9494
9730
|
defaultExpandedIds,
|
|
9495
9731
|
emptyText = "No items",
|
|
9496
9732
|
expandedIds,
|
|
9733
|
+
getDragItem,
|
|
9497
9734
|
getCellContent,
|
|
9498
9735
|
onActiveItemChange,
|
|
9499
9736
|
onExpandedIdsChange,
|
|
9500
9737
|
onItemCheckChange,
|
|
9501
9738
|
onItemDoubleClick,
|
|
9739
|
+
onItemDragOut,
|
|
9502
9740
|
onItemSelect,
|
|
9741
|
+
onDrop,
|
|
9503
9742
|
selectedId,
|
|
9504
9743
|
uncheckedShape = "box",
|
|
9505
9744
|
...props
|
|
9506
9745
|
}, ref) {
|
|
9507
|
-
const rootRef =
|
|
9746
|
+
const rootRef = useRef22(null);
|
|
9747
|
+
const [rootElement, setRootElement] = useState30(null);
|
|
9508
9748
|
const treeId = useId17();
|
|
9509
|
-
const itemRefs =
|
|
9510
|
-
const resizeFrameRef =
|
|
9511
|
-
const resizeStateRef =
|
|
9749
|
+
const itemRefs = useRef22({});
|
|
9750
|
+
const resizeFrameRef = useRef22(null);
|
|
9751
|
+
const resizeStateRef = useRef22(null);
|
|
9512
9752
|
const isExpandedControlled = expandedIds !== void 0;
|
|
9513
9753
|
const [uncontrolledExpandedIds, setUncontrolledExpandedIds] = useState30(() => {
|
|
9514
9754
|
const expandedFromData = collectExpandedTreeListIds(data);
|
|
@@ -9522,15 +9762,15 @@ function TreeListViewInner({
|
|
|
9522
9762
|
const [userColumnWidths, setUserColumnWidths] = useState30({});
|
|
9523
9763
|
const isActiveControlled = activeItemIdProp !== void 0;
|
|
9524
9764
|
const resolvedExpandedIds = isExpandedControlled ? expandedIds : uncontrolledExpandedIds;
|
|
9525
|
-
const expandedIdSet =
|
|
9765
|
+
const expandedIdSet = useMemo20(
|
|
9526
9766
|
() => new Set(resolvedExpandedIds),
|
|
9527
9767
|
[resolvedExpandedIds]
|
|
9528
9768
|
);
|
|
9529
|
-
const visibleItems =
|
|
9769
|
+
const visibleItems = useMemo20(
|
|
9530
9770
|
() => collectVisibleTreeListItems(data, expandedIdSet),
|
|
9531
9771
|
[data, expandedIdSet]
|
|
9532
9772
|
);
|
|
9533
|
-
const selectableItems =
|
|
9773
|
+
const selectableItems = useMemo20(
|
|
9534
9774
|
() => visibleItems.filter(({ item }) => !item.disabled),
|
|
9535
9775
|
[visibleItems]
|
|
9536
9776
|
);
|
|
@@ -9539,7 +9779,7 @@ function TreeListViewInner({
|
|
|
9539
9779
|
const [uncontrolledActiveItemId, setUncontrolledActiveItemId] = useState30(() => defaultActiveItemId ?? resolvedSelectedId);
|
|
9540
9780
|
const activeItemId = activeItemIdProp !== void 0 ? activeItemIdProp : uncontrolledActiveItemId;
|
|
9541
9781
|
const resolvedActiveItemId = activeItemId && selectableItems.some((entry) => entry.itemId === activeItemId) ? activeItemId : resolvedSelectedId;
|
|
9542
|
-
const minColumnWidthById =
|
|
9782
|
+
const minColumnWidthById = useMemo20(
|
|
9543
9783
|
() => Object.fromEntries(
|
|
9544
9784
|
columns.map(
|
|
9545
9785
|
(column) => [column.id, column.minWidth ?? 0]
|
|
@@ -9547,23 +9787,32 @@ function TreeListViewInner({
|
|
|
9547
9787
|
),
|
|
9548
9788
|
[columns]
|
|
9549
9789
|
);
|
|
9550
|
-
const templateColumns =
|
|
9790
|
+
const templateColumns = useMemo20(
|
|
9551
9791
|
() => getTreeListTemplateColumns(columns, {
|
|
9552
9792
|
autoColumnWidths,
|
|
9553
9793
|
userColumnWidths
|
|
9554
9794
|
}),
|
|
9555
9795
|
[autoColumnWidths, columns, userColumnWidths]
|
|
9556
9796
|
);
|
|
9557
|
-
const treeColumnId =
|
|
9797
|
+
const treeColumnId = useMemo20(
|
|
9558
9798
|
() => getTreeListTreeColumnId(columns),
|
|
9559
9799
|
[columns]
|
|
9560
9800
|
);
|
|
9561
|
-
const rowIndexMap =
|
|
9801
|
+
const rowIndexMap = useMemo20(
|
|
9562
9802
|
() => new Map(
|
|
9563
9803
|
visibleItems.map((entry, index) => [entry.itemId, index])
|
|
9564
9804
|
),
|
|
9565
9805
|
[visibleItems]
|
|
9566
9806
|
);
|
|
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
|
+
}, []);
|
|
9567
9816
|
useEffect17(() => {
|
|
9568
9817
|
if (!resolvedActiveItemId) {
|
|
9569
9818
|
return;
|
|
@@ -9919,11 +10168,11 @@ function TreeListViewInner({
|
|
|
9919
10168
|
className: ["nu-tree-list-view", className].filter(Boolean).join(" "),
|
|
9920
10169
|
"data-version": dataVersion,
|
|
9921
10170
|
onKeyDown: handleKeyDown,
|
|
9922
|
-
ref:
|
|
10171
|
+
ref: setRootRef,
|
|
9923
10172
|
role: "treegrid",
|
|
9924
10173
|
tabIndex: 0,
|
|
9925
10174
|
children: [
|
|
9926
|
-
/* @__PURE__ */
|
|
10175
|
+
/* @__PURE__ */ jsx61(
|
|
9927
10176
|
"div",
|
|
9928
10177
|
{
|
|
9929
10178
|
className: "nu-tree-list-view__header",
|
|
@@ -9942,8 +10191,8 @@ function TreeListViewInner({
|
|
|
9942
10191
|
"data-column-id": column.id,
|
|
9943
10192
|
role: "columnheader",
|
|
9944
10193
|
children: [
|
|
9945
|
-
/* @__PURE__ */
|
|
9946
|
-
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(
|
|
9947
10196
|
"button",
|
|
9948
10197
|
{
|
|
9949
10198
|
"aria-label": `Resize ${column.title} column`,
|
|
@@ -9959,7 +10208,7 @@ function TreeListViewInner({
|
|
|
9959
10208
|
))
|
|
9960
10209
|
}
|
|
9961
10210
|
),
|
|
9962
|
-
/* @__PURE__ */
|
|
10211
|
+
/* @__PURE__ */ jsx61("div", { className: "nu-tree-list-view__body", children: visibleItems.length > 0 ? data.map((item, index) => /* @__PURE__ */ jsx61(
|
|
9963
10212
|
TreeListViewRow,
|
|
9964
10213
|
{
|
|
9965
10214
|
activeItemId: resolvedActiveItemId,
|
|
@@ -9968,12 +10217,14 @@ function TreeListViewInner({
|
|
|
9968
10217
|
depth: 0,
|
|
9969
10218
|
expandedIdSet,
|
|
9970
10219
|
getCellContent: getCellContent ? resolveCellContent : void 0,
|
|
10220
|
+
getDragItem,
|
|
9971
10221
|
guideMask: [],
|
|
9972
10222
|
guideOffsets: [],
|
|
9973
10223
|
hasNextSibling: index < data.length - 1,
|
|
9974
10224
|
item,
|
|
9975
10225
|
onActivateItem: activateEntry,
|
|
9976
10226
|
onDoubleClickItem: onItemDoubleClick ? handleItemDoubleClick : void 0,
|
|
10227
|
+
onItemDragOut,
|
|
9977
10228
|
onPopupMenuItem: handleItemPopupMenu,
|
|
9978
10229
|
onToggleItemCheck: handleItemCheckChange,
|
|
9979
10230
|
onToggleItemExpanded: setExpandedState,
|
|
@@ -9987,7 +10238,7 @@ function TreeListViewInner({
|
|
|
9987
10238
|
uncheckedShape
|
|
9988
10239
|
},
|
|
9989
10240
|
item.id
|
|
9990
|
-
)) : /* @__PURE__ */
|
|
10241
|
+
)) : /* @__PURE__ */ jsx61("div", { className: "nu-tree-list-view__empty", children: emptyText }) })
|
|
9991
10242
|
]
|
|
9992
10243
|
}
|
|
9993
10244
|
);
|
|
@@ -9998,7 +10249,7 @@ var TreeListView = forwardRef4(TreeListViewInner);
|
|
|
9998
10249
|
import {
|
|
9999
10250
|
useCallback as useCallback9,
|
|
10000
10251
|
useId as useId18,
|
|
10001
|
-
useMemo as
|
|
10252
|
+
useMemo as useMemo21,
|
|
10002
10253
|
useState as useState31
|
|
10003
10254
|
} from "react";
|
|
10004
10255
|
|
|
@@ -10126,31 +10377,31 @@ var midnightTheme = {
|
|
|
10126
10377
|
shellBackground: "#101722",
|
|
10127
10378
|
appBackground: "#17273b",
|
|
10128
10379
|
appBackgroundAlt: "#0d1724",
|
|
10129
|
-
chromeBackground: "#
|
|
10130
|
-
panelBackground: "#
|
|
10380
|
+
chromeBackground: "#36547d",
|
|
10381
|
+
panelBackground: "#192c43",
|
|
10131
10382
|
panelInsetBackground: "#111e2e",
|
|
10132
|
-
titleBackground: "#
|
|
10133
|
-
menuBackground: "#
|
|
10134
|
-
titleText: "#
|
|
10135
|
-
textPrimary: "#
|
|
10136
|
-
textMuted: "#
|
|
10137
|
-
textInverse: "#
|
|
10138
|
-
mainMenuText: "#
|
|
10139
|
-
textAccent: "#
|
|
10140
|
-
textHotkey: "#
|
|
10141
|
-
buttonFace: "#
|
|
10142
|
-
buttonFaceAlt: "#
|
|
10143
|
-
buttonDanger: "#
|
|
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",
|
|
10144
10395
|
buttonSuccess: "#3c936d",
|
|
10145
|
-
buttonText: "#
|
|
10396
|
+
buttonText: "#ffffff",
|
|
10146
10397
|
fieldBackground: "#09111c",
|
|
10147
|
-
fieldText: "#
|
|
10148
|
-
borderLight: "#
|
|
10149
|
-
borderDark: "#
|
|
10150
|
-
borderAccent: "#
|
|
10398
|
+
fieldText: "#627b9d",
|
|
10399
|
+
borderLight: "#415776",
|
|
10400
|
+
borderDark: "#1d2134",
|
|
10401
|
+
borderAccent: "#3b5681",
|
|
10151
10402
|
shadowColor: "#070c14",
|
|
10152
10403
|
panelShadowColor: "rgb(7 12 20 / 0.56)",
|
|
10153
|
-
focusColor: "#
|
|
10404
|
+
focusColor: "#af532c",
|
|
10154
10405
|
windowInactiveOverlay: "rgb(7 12 20 / 0.3)",
|
|
10155
10406
|
windowModalBackdrop: "rgb(7 12 20 / 0.48)"
|
|
10156
10407
|
}
|
|
@@ -10279,10 +10530,10 @@ function getNuDesktopPatternStyle(mode) {
|
|
|
10279
10530
|
}
|
|
10280
10531
|
|
|
10281
10532
|
// src/theme/themeContext.ts
|
|
10282
|
-
import { createContext as
|
|
10283
|
-
var NuThemeContext =
|
|
10533
|
+
import { createContext as createContext6, useContext as useContext10 } from "react";
|
|
10534
|
+
var NuThemeContext = createContext6(null);
|
|
10284
10535
|
function useNuTheme() {
|
|
10285
|
-
const context =
|
|
10536
|
+
const context = useContext10(NuThemeContext);
|
|
10286
10537
|
if (!context) {
|
|
10287
10538
|
throw new Error("useNuTheme must be used within a NuThemeProvider.");
|
|
10288
10539
|
}
|
|
@@ -10290,7 +10541,7 @@ function useNuTheme() {
|
|
|
10290
10541
|
}
|
|
10291
10542
|
|
|
10292
10543
|
// src/theme/NuThemeProvider.tsx
|
|
10293
|
-
import { jsx as
|
|
10544
|
+
import { jsx as jsx62, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
10294
10545
|
function NuThemeProvider({
|
|
10295
10546
|
children,
|
|
10296
10547
|
className,
|
|
@@ -10356,7 +10607,7 @@ function NuThemeProvider({
|
|
|
10356
10607
|
},
|
|
10357
10608
|
[fontSize, onFontSizeChange]
|
|
10358
10609
|
);
|
|
10359
|
-
const contextValue =
|
|
10610
|
+
const contextValue = useMemo21(
|
|
10360
10611
|
() => ({
|
|
10361
10612
|
desktopPatternMode: resolvedDesktopPatternMode,
|
|
10362
10613
|
fontFamily: resolvedFontFamily,
|
|
@@ -10381,7 +10632,7 @@ function NuThemeProvider({
|
|
|
10381
10632
|
handleThemeChange
|
|
10382
10633
|
]
|
|
10383
10634
|
);
|
|
10384
|
-
return /* @__PURE__ */
|
|
10635
|
+
return /* @__PURE__ */ jsx62(NuThemeContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs40(
|
|
10385
10636
|
"div",
|
|
10386
10637
|
{
|
|
10387
10638
|
className: ["nu-theme-root", className].filter(Boolean).join(" "),
|
|
@@ -10396,7 +10647,7 @@ function NuThemeProvider({
|
|
|
10396
10647
|
...style
|
|
10397
10648
|
},
|
|
10398
10649
|
children: [
|
|
10399
|
-
crtGlitch ? /* @__PURE__ */
|
|
10650
|
+
crtGlitch ? /* @__PURE__ */ jsx62(NuCrtGlitch, { ...typeof crtGlitch === "object" ? crtGlitch : {} }) : null,
|
|
10400
10651
|
children
|
|
10401
10652
|
]
|
|
10402
10653
|
}
|
|
@@ -10423,6 +10674,7 @@ export {
|
|
|
10423
10674
|
NuAppHostProvider,
|
|
10424
10675
|
NuCrtGlitch,
|
|
10425
10676
|
NuDesktop,
|
|
10677
|
+
NuDragDropProvider,
|
|
10426
10678
|
NuGlyph,
|
|
10427
10679
|
NuIconGrid,
|
|
10428
10680
|
NuIconProvider,
|
|
@@ -10468,6 +10720,9 @@ export {
|
|
|
10468
10720
|
resolveNuTheme,
|
|
10469
10721
|
useAppHostMenu,
|
|
10470
10722
|
useMainMenuState,
|
|
10723
|
+
useNuDragDrop,
|
|
10724
|
+
useNuDragSource,
|
|
10725
|
+
useNuDropTarget,
|
|
10471
10726
|
useNuIconManager,
|
|
10472
10727
|
useNuTheme,
|
|
10473
10728
|
useNuWindowManager,
|