@oliasoft-open-source/react-ui-library 10.7.0-beta-9 → 10.8.0-beta-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/global.css +1734 -1765
- package/dist/index.d.ts +10 -9
- package/dist/index.js +584 -333
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,9 @@ import { CSSTransition } from "react-transition-group";
|
|
|
6
6
|
import { CheckboxButton, CheckboxField } from "react-aria-components/Checkbox";
|
|
7
7
|
import { ColorArea, ColorPicker, ColorSlider, ColorSwatch, ColorSwatchPicker, ColorSwatchPickerItem, ColorThumb, DialogTrigger, Focusable, OverlayArrow, Popover as Popover$1, Pressable, RouterProvider, SliderTrack, Tooltip as Tooltip$1, TooltipTrigger, TooltipTriggerStateContext, useLocale } from "react-aria-components";
|
|
8
8
|
import { clamp, cloneDeep, cloneDeepWith, debounce, every, get, isArray, isBoolean, isEmpty, isEqual, isFinite, isFunction, isNil, isNumber, isObject, isPlainObject, isString, keys, noop, sortBy, toLower, toNumber, upperFirst, values } from "es-toolkit/compat";
|
|
9
|
-
import { Header, Menu as Menu$1, MenuItem, MenuTrigger, Separator, SubmenuTrigger } from "react-aria-components/Menu";
|
|
9
|
+
import { Header, Menu as Menu$1, MenuItem, MenuTrigger, Pressable as Pressable$1, Separator, SubmenuTrigger } from "react-aria-components/Menu";
|
|
10
|
+
import { Autocomplete } from "react-aria-components/Autocomplete";
|
|
11
|
+
import { Input as Input$1, SearchField } from "react-aria-components/SearchField";
|
|
10
12
|
import { Breadcrumb as Breadcrumb$1, Breadcrumbs, Link } from "react-aria-components/Breadcrumbs";
|
|
11
13
|
import { colord, extend } from "colord";
|
|
12
14
|
import lchPlugin from "colord/plugins/lch";
|
|
@@ -18,7 +20,7 @@ import { ALT_UNITS, KNOWN_UNITS, altUnitsList, cleanNumStr, convertAndGetValue,
|
|
|
18
20
|
import { ListBox, ListBoxItem } from "react-aria-components/ListBox";
|
|
19
21
|
import { ListLayout, Virtualizer } from "react-aria-components/Virtualizer";
|
|
20
22
|
import { SortableContext, useSortable, verticalListSortingStrategy } from "@dnd-kit/sortable";
|
|
21
|
-
import { CSS } from "@dnd-kit/utilities";
|
|
23
|
+
import { CSS as CSS$1 } from "@dnd-kit/utilities";
|
|
22
24
|
import * as RadixSlider from "@radix-ui/react-slider";
|
|
23
25
|
import memoizeOne from "memoize-one";
|
|
24
26
|
import isEqual$1 from "react-fast-compare";
|
|
@@ -1056,32 +1058,35 @@ var isMenuEmpty = (menu) => {
|
|
|
1056
1058
|
return !isValidElement(sections) && (!Array.isArray(sections) || sections.every((section) => isEmpty(section)));
|
|
1057
1059
|
};
|
|
1058
1060
|
var menu_module_default = {
|
|
1059
|
-
layer: "
|
|
1060
|
-
nested: "
|
|
1061
|
-
fileInput: "
|
|
1062
|
-
trigger: "
|
|
1063
|
-
heading: "
|
|
1064
|
-
headingIcon: "
|
|
1065
|
-
clickable: "
|
|
1066
|
-
option: "
|
|
1067
|
-
active: "
|
|
1068
|
-
disabled: "
|
|
1069
|
-
selected: "
|
|
1070
|
-
optionContent: "
|
|
1071
|
-
description: "
|
|
1072
|
-
inline: "
|
|
1073
|
-
icon: "
|
|
1074
|
-
check: "
|
|
1075
|
-
label: "
|
|
1076
|
-
arrow: "
|
|
1077
|
-
divider: "
|
|
1078
|
-
buttonLabel: "
|
|
1079
|
-
component: "
|
|
1080
|
-
right: "
|
|
1081
|
-
actions: "
|
|
1082
|
-
menuPopover: "
|
|
1083
|
-
menuPopoverNested: "
|
|
1084
|
-
menuItem: "
|
|
1061
|
+
layer: "_layer_lg82f_1",
|
|
1062
|
+
nested: "_nested_lg82f_14",
|
|
1063
|
+
fileInput: "_fileInput_lg82f_17",
|
|
1064
|
+
trigger: "_trigger_lg82f_23",
|
|
1065
|
+
heading: "_heading_lg82f_32",
|
|
1066
|
+
headingIcon: "_headingIcon_lg82f_38",
|
|
1067
|
+
clickable: "_clickable_lg82f_45",
|
|
1068
|
+
option: "_option_lg82f_49",
|
|
1069
|
+
active: "_active_lg82f_68",
|
|
1070
|
+
disabled: "_disabled_lg82f_73",
|
|
1071
|
+
selected: "_selected_lg82f_76",
|
|
1072
|
+
optionContent: "_optionContent_lg82f_83",
|
|
1073
|
+
description: "_description_lg82f_87",
|
|
1074
|
+
inline: "_inline_lg82f_91",
|
|
1075
|
+
icon: "_icon_lg82f_96",
|
|
1076
|
+
check: "_check_lg82f_97",
|
|
1077
|
+
label: "_label_lg82f_123",
|
|
1078
|
+
arrow: "_arrow_lg82f_139",
|
|
1079
|
+
divider: "_divider_lg82f_143",
|
|
1080
|
+
buttonLabel: "_buttonLabel_lg82f_151",
|
|
1081
|
+
component: "_component_lg82f_158",
|
|
1082
|
+
right: "_right_lg82f_164",
|
|
1083
|
+
actions: "_actions_lg82f_169",
|
|
1084
|
+
menuPopover: "_menuPopover_lg82f_176",
|
|
1085
|
+
menuPopoverNested: "_menuPopoverNested_lg82f_198",
|
|
1086
|
+
menuItem: "_menuItem_lg82f_201",
|
|
1087
|
+
overlayScope: "_overlayScope_lg82f_216",
|
|
1088
|
+
noResults: "_noResults_lg82f_219",
|
|
1089
|
+
searchInput: "_searchInput_lg82f_223"
|
|
1085
1090
|
};
|
|
1086
1091
|
//#endregion
|
|
1087
1092
|
//#region src/components/menu/layer/heading.tsx
|
|
@@ -1117,6 +1122,12 @@ var Option$2 = ({ actions, label, url, onClick, description, icon, selected, clo
|
|
|
1117
1122
|
}
|
|
1118
1123
|
onClick === null || onClick === void 0 || onClick(evt);
|
|
1119
1124
|
};
|
|
1125
|
+
const handleClickCapture = (evt) => {
|
|
1126
|
+
if (disabled) {
|
|
1127
|
+
evt.preventDefault();
|
|
1128
|
+
evt.stopPropagation();
|
|
1129
|
+
}
|
|
1130
|
+
};
|
|
1120
1131
|
const handleFileChange = (evt) => {
|
|
1121
1132
|
var _evt$target;
|
|
1122
1133
|
const { files } = (_evt$target = evt === null || evt === void 0 ? void 0 : evt.target) !== null && _evt$target !== void 0 ? _evt$target : {};
|
|
@@ -1141,6 +1152,7 @@ var Option$2 = ({ actions, label, url, onClick, description, icon, selected, clo
|
|
|
1141
1152
|
isDisabled: disabled,
|
|
1142
1153
|
shouldCloseOnSelect: upload ? false : closeOnOptionClick,
|
|
1143
1154
|
onClick: handleClick,
|
|
1155
|
+
onClickCapture: handleClickCapture,
|
|
1144
1156
|
"data-testid": testId,
|
|
1145
1157
|
children: [
|
|
1146
1158
|
icon ? /* @__PURE__ */ jsx("span", {
|
|
@@ -1171,9 +1183,9 @@ var Option$2 = ({ actions, label, url, onClick, description, icon, selected, clo
|
|
|
1171
1183
|
}),
|
|
1172
1184
|
/* @__PURE__ */ jsxs("div", {
|
|
1173
1185
|
className: menu_module_default.right,
|
|
1174
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
1186
|
+
children: [selected && /* @__PURE__ */ jsx("span", {
|
|
1175
1187
|
className: menu_module_default.check,
|
|
1176
|
-
children:
|
|
1188
|
+
children: /* @__PURE__ */ jsx(Icon, { icon: IconType.CHECK })
|
|
1177
1189
|
}), !!(actions === null || actions === void 0 ? void 0 : actions.length) && /* @__PURE__ */ jsx("div", {
|
|
1178
1190
|
className: menu_module_default.actions,
|
|
1179
1191
|
onClick: (evt) => evt.stopPropagation(),
|
|
@@ -1240,6 +1252,74 @@ var Section$1 = ({ section, closeOnOptionClick, close }) => {
|
|
|
1240
1252
|
}
|
|
1241
1253
|
};
|
|
1242
1254
|
//#endregion
|
|
1255
|
+
//#region src/helpers/search.ts
|
|
1256
|
+
/**
|
|
1257
|
+
* Shared text-search matching for searchable components (Select, Menu).
|
|
1258
|
+
* Case-insensitive substring match — keep behaviour identical across components.
|
|
1259
|
+
*/
|
|
1260
|
+
var normalizeSearch = (value) => String(value !== null && value !== void 0 ? value : "").toLowerCase();
|
|
1261
|
+
var matchesSearch = (query, ...texts) => {
|
|
1262
|
+
const normalizedQuery = normalizeSearch(query);
|
|
1263
|
+
if (!normalizedQuery) return true;
|
|
1264
|
+
return texts.some((text) => text != null && normalizeSearch(text).includes(normalizedQuery));
|
|
1265
|
+
};
|
|
1266
|
+
//#endregion
|
|
1267
|
+
//#region src/components/menu/filter-menu-sections.ts
|
|
1268
|
+
var getSearchText = (label) => typeof label === "string" || typeof label === "number" ? String(label) : "";
|
|
1269
|
+
var isItem = (section) => section.type === MenuType.OPTION || section.type === MenuType.MENU;
|
|
1270
|
+
var isBoundary = (section) => section.type === MenuType.HEADING || section.type === MenuType.DIVIDER;
|
|
1271
|
+
/** Drop headings with no items under them, and leading / trailing / doubled dividers. */
|
|
1272
|
+
var tidy = (sections) => {
|
|
1273
|
+
var _result;
|
|
1274
|
+
const withoutEmptyHeadings = sections.filter((section, i) => {
|
|
1275
|
+
if (section.type !== MenuType.HEADING) return true;
|
|
1276
|
+
const next = sections.slice(i + 1).find((s) => isItem(s) || isBoundary(s));
|
|
1277
|
+
return !!next && isItem(next);
|
|
1278
|
+
});
|
|
1279
|
+
const result = [];
|
|
1280
|
+
withoutEmptyHeadings.forEach((section) => {
|
|
1281
|
+
const previous = result[result.length - 1];
|
|
1282
|
+
if (section.type === MenuType.DIVIDER && (!previous || previous.type === MenuType.DIVIDER)) return;
|
|
1283
|
+
result.push(section);
|
|
1284
|
+
});
|
|
1285
|
+
if (((_result = result[result.length - 1]) === null || _result === void 0 ? void 0 : _result.type) === MenuType.DIVIDER) result.pop();
|
|
1286
|
+
return result;
|
|
1287
|
+
};
|
|
1288
|
+
/**
|
|
1289
|
+
* Filters menu sections by a search query while preserving structure:
|
|
1290
|
+
* - options are kept when their label or description matches
|
|
1291
|
+
* - submenus are kept when their own label matches (with all children), or when any
|
|
1292
|
+
* descendant matches (with children filtered recursively)
|
|
1293
|
+
* - headings / dividers are kept only where they still separate visible items
|
|
1294
|
+
* Labels that are not plain strings/numbers cannot be matched.
|
|
1295
|
+
*/
|
|
1296
|
+
var filterMenuSections = (sections, query) => {
|
|
1297
|
+
if (isValidElement(sections) || !Array.isArray(sections)) return [];
|
|
1298
|
+
if (!normalizeSearch(query)) return sections;
|
|
1299
|
+
return tidy(sections.flatMap((section) => {
|
|
1300
|
+
switch (section === null || section === void 0 ? void 0 : section.type) {
|
|
1301
|
+
case MenuType.HEADING:
|
|
1302
|
+
case MenuType.DIVIDER: return [section];
|
|
1303
|
+
case MenuType.OPTION: return matchesSearch(query, getSearchText(section.label), section.description) ? [section] : [];
|
|
1304
|
+
case MenuType.MENU: {
|
|
1305
|
+
var _section$menu$label, _section$menu, _section$menu$section, _section$menu2;
|
|
1306
|
+
if (matchesSearch(query, getSearchText((_section$menu$label = (_section$menu = section.menu) === null || _section$menu === void 0 ? void 0 : _section$menu.label) !== null && _section$menu$label !== void 0 ? _section$menu$label : section.label))) return [section];
|
|
1307
|
+
const children = filterMenuSections((_section$menu$section = (_section$menu2 = section.menu) === null || _section$menu2 === void 0 ? void 0 : _section$menu2.sections) !== null && _section$menu$section !== void 0 ? _section$menu$section : [], query);
|
|
1308
|
+
if (!children.some(isItem)) return [];
|
|
1309
|
+
return [{
|
|
1310
|
+
...section,
|
|
1311
|
+
menu: {
|
|
1312
|
+
trigger: "Text",
|
|
1313
|
+
...section.menu,
|
|
1314
|
+
sections: children
|
|
1315
|
+
}
|
|
1316
|
+
}];
|
|
1317
|
+
}
|
|
1318
|
+
default: return [];
|
|
1319
|
+
}
|
|
1320
|
+
}));
|
|
1321
|
+
};
|
|
1322
|
+
//#endregion
|
|
1243
1323
|
//#region src/components/menu/trigger/text.tsx
|
|
1244
1324
|
var Text$1 = forwardRef(({ label, title, carat, disabled, isOpen, selected, className, ...domProps }, ref) => {
|
|
1245
1325
|
let titleText;
|
|
@@ -1264,11 +1344,22 @@ var Text$1 = forwardRef(({ label, title, carat, disabled, isOpen, selected, clas
|
|
|
1264
1344
|
});
|
|
1265
1345
|
//#endregion
|
|
1266
1346
|
//#region src/components/menu/layer/layer.tsx
|
|
1347
|
+
var MENU_SCOPE_ATTRIBUTE = "data-menu-scope";
|
|
1348
|
+
/**
|
|
1349
|
+
* Marks every popover (root + submenus) belonging to one searchable menu, so outside-press
|
|
1350
|
+
* detection can tell clicks inside the menu apart from clicks elsewhere.
|
|
1351
|
+
*/
|
|
1352
|
+
var OverlayScope = ({ scopeId, children }) => scopeId ? /* @__PURE__ */ jsx("div", {
|
|
1353
|
+
[MENU_SCOPE_ATTRIBUTE]: scopeId,
|
|
1354
|
+
className: menu_module_default.overlayScope,
|
|
1355
|
+
onMouseDown: (evt) => evt.preventDefault(),
|
|
1356
|
+
children
|
|
1357
|
+
}) : /* @__PURE__ */ jsx(Fragment$1, { children });
|
|
1267
1358
|
var getTextValue = (label) => {
|
|
1268
1359
|
if (typeof label === "string" || typeof label === "number") return String(label);
|
|
1269
1360
|
return "";
|
|
1270
1361
|
};
|
|
1271
|
-
var renderSection = (section, index, { closeOnOptionClick, close, maxHeight, width }) => {
|
|
1362
|
+
var renderSection = (section, index, { closeOnOptionClick, close, maxHeight, width, scopeId }) => {
|
|
1272
1363
|
if (section.type === MenuType.MENU) {
|
|
1273
1364
|
var _section$menu, _section$menu2, _section$menu3, _section$menu$label, _section$menu4, _ref, _section$menu$label2, _section$menu5, _section$menu6, _section$menu$section, _section$menu7;
|
|
1274
1365
|
const submenuSections = (_section$menu = section.menu) === null || _section$menu === void 0 ? void 0 : _section$menu.sections;
|
|
@@ -1292,14 +1383,18 @@ var renderSection = (section, index, { closeOnOptionClick, close, maxHeight, wid
|
|
|
1292
1383
|
placement: submenuPlacement,
|
|
1293
1384
|
isNested: true,
|
|
1294
1385
|
"data-testid": (_section$menu6 = section.menu) === null || _section$menu6 === void 0 ? void 0 : _section$menu6.testId,
|
|
1295
|
-
children: /* @__PURE__ */ jsx(
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1386
|
+
children: /* @__PURE__ */ jsx(OverlayScope, {
|
|
1387
|
+
scopeId,
|
|
1388
|
+
children: /* @__PURE__ */ jsx(Layer$2, {
|
|
1389
|
+
sections: (_section$menu$section = (_section$menu7 = section.menu) === null || _section$menu7 === void 0 ? void 0 : _section$menu7.sections) !== null && _section$menu$section !== void 0 ? _section$menu$section : [],
|
|
1390
|
+
isNested: true,
|
|
1391
|
+
width,
|
|
1392
|
+
closeOnOptionClick,
|
|
1393
|
+
close,
|
|
1394
|
+
maxHeight,
|
|
1395
|
+
testId: nestedTestId ? `${nestedTestId}-layer` : void 0,
|
|
1396
|
+
scopeId
|
|
1397
|
+
})
|
|
1303
1398
|
})
|
|
1304
1399
|
})] }, `${section.type}-${index}`);
|
|
1305
1400
|
}
|
|
@@ -1309,11 +1404,12 @@ var renderSection = (section, index, { closeOnOptionClick, close, maxHeight, wid
|
|
|
1309
1404
|
close
|
|
1310
1405
|
}, `${section.type}-${index}`);
|
|
1311
1406
|
};
|
|
1312
|
-
var Layer$2 = ({ sections, isNested = false, width, closeOnOptionClick, close, maxHeight, showAllButton, testId }) => {
|
|
1313
|
-
var _showAllButton$additi, _showAllButton$additi2;
|
|
1407
|
+
var Layer$2 = ({ sections, isNested = false, width, closeOnOptionClick, close, maxHeight, showAllButton, testId, search, scopeId }) => {
|
|
1408
|
+
var _showAllButton$additi, _showAllButton$additi2, _search$value;
|
|
1314
1409
|
const [showAll, setShowAll] = useState(!(showAllButton === null || showAllButton === void 0 ? void 0 : showAllButton.visible));
|
|
1315
1410
|
if (isValidElement(sections)) return /* @__PURE__ */ jsx(Fragment$1, { children: sections });
|
|
1316
1411
|
const sectionsArray = sections;
|
|
1412
|
+
const isSearching = !!(search === null || search === void 0 ? void 0 : search.value);
|
|
1317
1413
|
const additionalSections = (_showAllButton$additi = showAllButton === null || showAllButton === void 0 || (_showAllButton$additi2 = showAllButton.additionalSections) === null || _showAllButton$additi2 === void 0 ? void 0 : _showAllButton$additi2.map((s) => ({
|
|
1318
1414
|
...s,
|
|
1319
1415
|
closeOnOptionClick,
|
|
@@ -1326,7 +1422,10 @@ var Layer$2 = ({ sections, isNested = false, width, closeOnOptionClick, close, m
|
|
|
1326
1422
|
visible: true,
|
|
1327
1423
|
closeOnOptionClick: false
|
|
1328
1424
|
}] : [];
|
|
1329
|
-
const localSections = (showAllButton === null || showAllButton === void 0 ? void 0 : showAllButton.visible) ?
|
|
1425
|
+
const localSections = isSearching ? filterMenuSections([...sectionsArray, ...(showAllButton === null || showAllButton === void 0 ? void 0 : showAllButton.visible) ? additionalSections : []], (_search$value = search === null || search === void 0 ? void 0 : search.value) !== null && _search$value !== void 0 ? _search$value : "").map((s) => ({
|
|
1426
|
+
...s,
|
|
1427
|
+
closeOnOptionClick
|
|
1428
|
+
})) : (showAllButton === null || showAllButton === void 0 ? void 0 : showAllButton.visible) ? sectionsArray.map((s, i) => {
|
|
1330
1429
|
return showAll || i <= 3 ? {
|
|
1331
1430
|
...s,
|
|
1332
1431
|
visible: true,
|
|
@@ -1345,14 +1444,120 @@ var Layer$2 = ({ sections, isNested = false, width, closeOnOptionClick, close, m
|
|
|
1345
1444
|
shouldCloseOnSelect: closeOnOptionClick,
|
|
1346
1445
|
autoFocus: isNested ? void 0 : "first",
|
|
1347
1446
|
"data-testid": testId,
|
|
1447
|
+
renderEmptyState: search ? () => {
|
|
1448
|
+
var _search$noResultsText;
|
|
1449
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1450
|
+
className: menu_module_default.noResults,
|
|
1451
|
+
children: (_search$noResultsText = search.noResultsText) !== null && _search$noResultsText !== void 0 ? _search$noResultsText : "No results"
|
|
1452
|
+
});
|
|
1453
|
+
} : void 0,
|
|
1348
1454
|
children: localSections.map((section, i) => renderSection(section, i, {
|
|
1349
1455
|
closeOnOptionClick: section.closeOnOptionClick,
|
|
1350
1456
|
close,
|
|
1351
1457
|
maxHeight,
|
|
1352
|
-
width
|
|
1458
|
+
width,
|
|
1459
|
+
scopeId
|
|
1353
1460
|
}))
|
|
1354
1461
|
});
|
|
1355
1462
|
};
|
|
1463
|
+
var trigger_module_default = {
|
|
1464
|
+
inputInTable: "_inputInTable_c2rg4_1",
|
|
1465
|
+
inputHover: "_inputHover_c2rg4_13",
|
|
1466
|
+
inputFocus: "_inputFocus_c2rg4_18",
|
|
1467
|
+
controlFocusVisible: "_controlFocusVisible_c2rg4_25",
|
|
1468
|
+
inputError: "_inputError_c2rg4_29",
|
|
1469
|
+
inputWarning: "_inputWarning_c2rg4_30",
|
|
1470
|
+
inputDisabled: "_inputDisabled_c2rg4_65",
|
|
1471
|
+
hideScrollbars: "_hideScrollbars_c2rg4_71",
|
|
1472
|
+
trigger: "_trigger_c2rg4_81",
|
|
1473
|
+
isInTable: "_isInTable_c2rg4_97",
|
|
1474
|
+
input: "_input_c2rg4_1",
|
|
1475
|
+
isOpen: "_isOpen_c2rg4_118",
|
|
1476
|
+
disabled: "_disabled_c2rg4_161",
|
|
1477
|
+
icons: "_icons_c2rg4_167",
|
|
1478
|
+
clearAll: "_clearAll_c2rg4_174",
|
|
1479
|
+
iconOpen: "_iconOpen_c2rg4_175",
|
|
1480
|
+
small: "_small_c2rg4_186",
|
|
1481
|
+
triggerInputContainer: "_triggerInputContainer_c2rg4_194",
|
|
1482
|
+
right: "_right_c2rg4_203",
|
|
1483
|
+
multiOptions: "_multiOptions_c2rg4_216",
|
|
1484
|
+
multiOption: "_multiOption_c2rg4_216",
|
|
1485
|
+
label: "_label_c2rg4_244",
|
|
1486
|
+
closeMultiOption: "_closeMultiOption_c2rg4_247",
|
|
1487
|
+
focus: "_focus_c2rg4_258",
|
|
1488
|
+
selectedSingleValue: "_selectedSingleValue_c2rg4_262",
|
|
1489
|
+
placeHolder: "_placeHolder_c2rg4_263",
|
|
1490
|
+
groupOrderFirst: "_groupOrderFirst_c2rg4_302",
|
|
1491
|
+
groupOrderMiddle: "_groupOrderMiddle_c2rg4_303",
|
|
1492
|
+
groupOrderLast: "_groupOrderLast_c2rg4_307",
|
|
1493
|
+
detailedLabel: "_detailedLabel_c2rg4_312"
|
|
1494
|
+
};
|
|
1495
|
+
//#endregion
|
|
1496
|
+
//#region src/components/menu/trigger/search-trigger.tsx
|
|
1497
|
+
var groupOrderClass = (groupOrder) => {
|
|
1498
|
+
switch (groupOrder) {
|
|
1499
|
+
case GroupOrder.FIRST: return trigger_module_default.groupOrderFirst;
|
|
1500
|
+
case GroupOrder.LAST: return trigger_module_default.groupOrderLast;
|
|
1501
|
+
case void 0: return;
|
|
1502
|
+
default: return trigger_module_default.groupOrderMiddle;
|
|
1503
|
+
}
|
|
1504
|
+
};
|
|
1505
|
+
/**
|
|
1506
|
+
* Select-style search input acting as the Menu trigger. Must render inside an RAC `Autocomplete`
|
|
1507
|
+
* (wires the input to the menu via virtual focus / aria-activedescendant) and a `MenuTrigger`.
|
|
1508
|
+
* Behaviour mirrors the searchable Select: click anywhere toggles, typing / ArrowDown opens,
|
|
1509
|
+
* Escape / Tab close.
|
|
1510
|
+
*/
|
|
1511
|
+
var SearchTrigger = forwardRef(({ label, searchValue, isOpen, disabled, small, width, groupOrder, error, warning, tabIndex, testId, inputRef, onOpen, onClose }, ref) => {
|
|
1512
|
+
const handleMouseDown = (evt) => evt.preventDefault();
|
|
1513
|
+
const handleClick = () => {
|
|
1514
|
+
var _inputRef$current;
|
|
1515
|
+
if (disabled) return;
|
|
1516
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
|
1517
|
+
if (isOpen) onClose();
|
|
1518
|
+
else onOpen();
|
|
1519
|
+
};
|
|
1520
|
+
const handleKeyDown = (evt) => {
|
|
1521
|
+
if (!isOpen && evt.key === "ArrowDown") onOpen();
|
|
1522
|
+
if (isOpen && (evt.key === "Escape" || evt.key === "Tab")) onClose();
|
|
1523
|
+
};
|
|
1524
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1525
|
+
ref,
|
|
1526
|
+
className: cx(trigger_module_default.trigger, isOpen && trigger_module_default.isOpen, disabled && trigger_module_default.disabled, small && trigger_module_default.small, groupOrderClass(groupOrder)),
|
|
1527
|
+
style: { width },
|
|
1528
|
+
onMouseDown: handleMouseDown,
|
|
1529
|
+
onClick: handleClick,
|
|
1530
|
+
"data-error": error || null,
|
|
1531
|
+
"data-warning": warning || null,
|
|
1532
|
+
"data-testid": testId,
|
|
1533
|
+
children: [/* @__PURE__ */ jsxs(SearchField, {
|
|
1534
|
+
"aria-label": typeof label === "string" ? label : "Search",
|
|
1535
|
+
isDisabled: disabled,
|
|
1536
|
+
onKeyDown: handleKeyDown,
|
|
1537
|
+
className: trigger_module_default.triggerInputContainer,
|
|
1538
|
+
children: [!searchValue && /* @__PURE__ */ jsx("span", {
|
|
1539
|
+
className: trigger_module_default.selectedSingleValue,
|
|
1540
|
+
"data-testid": testId && `${testId}-value`,
|
|
1541
|
+
children: label
|
|
1542
|
+
}), /* @__PURE__ */ jsx(Input$1, {
|
|
1543
|
+
ref: inputRef,
|
|
1544
|
+
className: cx(trigger_module_default.input, menu_module_default.searchInput),
|
|
1545
|
+
size: searchValue.length + 1,
|
|
1546
|
+
tabIndex,
|
|
1547
|
+
"data-testid": testId ? `${testId}-input` : void 0
|
|
1548
|
+
})]
|
|
1549
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1550
|
+
className: trigger_module_default.icons,
|
|
1551
|
+
children: /* @__PURE__ */ jsx(Pressable$1, {
|
|
1552
|
+
isDisabled: true,
|
|
1553
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
1554
|
+
className: trigger_module_default.iconOpen,
|
|
1555
|
+
children: /* @__PURE__ */ jsx(Icon, { icon: IconType.CHEVRON_DOWN })
|
|
1556
|
+
})
|
|
1557
|
+
})
|
|
1558
|
+
})]
|
|
1559
|
+
});
|
|
1560
|
+
});
|
|
1356
1561
|
//#endregion
|
|
1357
1562
|
//#region src/components/menu/layer/placementOptions.ts
|
|
1358
1563
|
var placementOptions = (placement, isNested = false) => ({ placement: placement || (isNested ? "right-start" : "bottom-start") });
|
|
@@ -1400,7 +1605,7 @@ var Badge = ({ children, color = "", textColor: textColorProp = "", title = null
|
|
|
1400
1605
|
};
|
|
1401
1606
|
//#endregion
|
|
1402
1607
|
//#region src/components/menu/trigger/button.tsx
|
|
1403
|
-
var Button$1 = React.forwardRef(({ trigger, label, colored,
|
|
1608
|
+
var Button$1 = React.forwardRef(({ trigger, label, colored, small, width, disabled, groupOrder, loading, error, warning, active, tabIndex, testId, ...domProps }, ref) => {
|
|
1404
1609
|
const disabledContext = useContext(DisabledContext);
|
|
1405
1610
|
const isDropdown = trigger === TriggerType.DROP_DOWN_BUTTON;
|
|
1406
1611
|
return /* @__PURE__ */ jsx(Button, {
|
|
@@ -1410,7 +1615,6 @@ var Button$1 = React.forwardRef(({ trigger, label, colored, basic, small, width,
|
|
|
1410
1615
|
children: label
|
|
1411
1616
|
}),
|
|
1412
1617
|
colored,
|
|
1413
|
-
basic,
|
|
1414
1618
|
small,
|
|
1415
1619
|
width,
|
|
1416
1620
|
groupOrder,
|
|
@@ -1493,7 +1697,7 @@ var withBadge = (children, { isNested, badgeTitle, badgeDot }) => !isNested && (
|
|
|
1493
1697
|
* Renders the menu trigger control only (Button / Text / Component).
|
|
1494
1698
|
* OverlayTriggerChild owns the Pressable host — do not wrap a focus shell here.
|
|
1495
1699
|
*/
|
|
1496
|
-
var Trigger$1 = React.forwardRef(({ active, disabled, loading, width, trigger, label, title, colored,
|
|
1700
|
+
var Trigger$1 = React.forwardRef(({ active, disabled, loading, width, trigger, label, title, colored, small, isNested, component, groupOrder, isOpen, error, warning, testId, selected, tabIndex, ...domProps }, ref) => {
|
|
1497
1701
|
const isButtonTrigger = trigger === TriggerType.BUTTON || trigger === TriggerType.DROP_DOWN_BUTTON;
|
|
1498
1702
|
const isComponentTrigger = trigger === TriggerType.COMPONENT;
|
|
1499
1703
|
if (isButtonTrigger) return /* @__PURE__ */ jsx(Button$1, {
|
|
@@ -1501,7 +1705,6 @@ var Trigger$1 = React.forwardRef(({ active, disabled, loading, width, trigger, l
|
|
|
1501
1705
|
trigger,
|
|
1502
1706
|
label: label !== null && label !== void 0 ? label : "",
|
|
1503
1707
|
colored,
|
|
1504
|
-
basic,
|
|
1505
1708
|
small,
|
|
1506
1709
|
width,
|
|
1507
1710
|
disabled,
|
|
@@ -1538,22 +1741,40 @@ var Trigger$1 = React.forwardRef(({ active, disabled, loading, width, trigger, l
|
|
|
1538
1741
|
});
|
|
1539
1742
|
//#endregion
|
|
1540
1743
|
//#region src/components/menu/menu.tsx
|
|
1541
|
-
var Menu = ({ menu, width, disabled = false, badgeTitle, badgeDot = false, loading = false, closeOnOptionClick = true, maxHeight, testId, open: openProp, setOpen: setOpenProp, tooltip, error, warning, tabIndex, active, groupOrder, offset = 0 }) => {
|
|
1744
|
+
var Menu = ({ menu, width, disabled = false, badgeTitle, badgeDot = false, loading = false, closeOnOptionClick = true, maxHeight, testId, open: openProp, setOpen: setOpenProp, tooltip, error, warning, tabIndex, active, groupOrder, offset = 0, searchable = false, searchNoResultsText }) => {
|
|
1542
1745
|
const disabledContext = useContext(DisabledContext);
|
|
1543
1746
|
const triggerRef = useRef(null);
|
|
1544
1747
|
const [internalOpen, setInternalOpen] = useState(false);
|
|
1545
|
-
const
|
|
1748
|
+
const [searchValue, setSearchValue] = useState("");
|
|
1749
|
+
const scopeId = useId();
|
|
1750
|
+
const searchTriggerRef = useRef(null);
|
|
1751
|
+
const searchInputRef = useRef(null);
|
|
1752
|
+
const { label, title, trigger, colored, small, sections, component, placement, showAllButton } = menu;
|
|
1546
1753
|
const isControlled = isBoolean(openProp) && isFunction(setOpenProp);
|
|
1547
1754
|
const isOpen = isControlled ? openProp : internalOpen;
|
|
1548
1755
|
const isDisabled = disabled || isMenuEmpty(menu) || disabledContext;
|
|
1756
|
+
const isSearchable = searchable && !isValidElement(sections);
|
|
1757
|
+
/** Input trigger, or any popover (root / submenu) belonging to this menu. */
|
|
1758
|
+
const isInSearchScope = (el) => {
|
|
1759
|
+
var _searchTriggerRef$cur;
|
|
1760
|
+
return el instanceof Element && (!!((_searchTriggerRef$cur = searchTriggerRef.current) === null || _searchTriggerRef$cur === void 0 ? void 0 : _searchTriggerRef$cur.contains(el)) || !!el.closest(`[data-menu-scope="${CSS.escape(scopeId)}"]`));
|
|
1761
|
+
};
|
|
1549
1762
|
const handleOpenChange = useCallback((open) => {
|
|
1550
1763
|
if (isDisabled && open) return;
|
|
1764
|
+
if (!open) {
|
|
1765
|
+
setSearchValue("");
|
|
1766
|
+
if (isSearchable && isInSearchScope(document.activeElement) && document.activeElement !== searchInputRef.current) {
|
|
1767
|
+
var _searchInputRef$curre;
|
|
1768
|
+
(_searchInputRef$curre = searchInputRef.current) === null || _searchInputRef$curre === void 0 || _searchInputRef$curre.focus();
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1551
1771
|
if (isControlled) setOpenProp(open);
|
|
1552
1772
|
else setInternalOpen(open);
|
|
1553
1773
|
}, [
|
|
1554
1774
|
isControlled,
|
|
1555
1775
|
isDisabled,
|
|
1556
|
-
setOpenProp
|
|
1776
|
+
setOpenProp,
|
|
1777
|
+
isSearchable
|
|
1557
1778
|
]);
|
|
1558
1779
|
const close = useCallback(() => {
|
|
1559
1780
|
handleOpenChange(false);
|
|
@@ -1571,6 +1792,23 @@ var Menu = ({ menu, width, disabled = false, badgeTitle, badgeDot = false, loadi
|
|
|
1571
1792
|
evt.stopPropagation();
|
|
1572
1793
|
evt.preventDefault();
|
|
1573
1794
|
};
|
|
1795
|
+
const handleSearchChange = (value) => {
|
|
1796
|
+
setSearchValue(value);
|
|
1797
|
+
if (value && !isOpen) handleOpenChange(true);
|
|
1798
|
+
};
|
|
1799
|
+
useEffect(() => {
|
|
1800
|
+
if (!isSearchable || !isOpen) return;
|
|
1801
|
+
const onPointerDown = (evt) => {
|
|
1802
|
+
if (!isInSearchScope(evt.target)) close();
|
|
1803
|
+
};
|
|
1804
|
+
document.addEventListener("pointerdown", onPointerDown, true);
|
|
1805
|
+
return () => document.removeEventListener("pointerdown", onPointerDown, true);
|
|
1806
|
+
}, [
|
|
1807
|
+
isSearchable,
|
|
1808
|
+
isOpen,
|
|
1809
|
+
close
|
|
1810
|
+
]);
|
|
1811
|
+
const ignorePopoverClose = () => {};
|
|
1574
1812
|
const triggerControl = /* @__PURE__ */ jsx(OverlayTriggerChild, {
|
|
1575
1813
|
behavior: OverlayTriggerBehavior.PRESS,
|
|
1576
1814
|
testId,
|
|
@@ -1587,7 +1825,6 @@ var Menu = ({ menu, width, disabled = false, badgeTitle, badgeDot = false, loadi
|
|
|
1587
1825
|
label,
|
|
1588
1826
|
title,
|
|
1589
1827
|
colored,
|
|
1590
|
-
basic,
|
|
1591
1828
|
small,
|
|
1592
1829
|
component,
|
|
1593
1830
|
groupOrder,
|
|
@@ -1598,6 +1835,67 @@ var Menu = ({ menu, width, disabled = false, badgeTitle, badgeDot = false, loadi
|
|
|
1598
1835
|
onClick: handleTriggerClick
|
|
1599
1836
|
})
|
|
1600
1837
|
});
|
|
1838
|
+
const layer = /* @__PURE__ */ jsx(Layer$2, {
|
|
1839
|
+
sections,
|
|
1840
|
+
width,
|
|
1841
|
+
closeOnOptionClick,
|
|
1842
|
+
close,
|
|
1843
|
+
maxHeight,
|
|
1844
|
+
showAllButton,
|
|
1845
|
+
testId: layerTestId,
|
|
1846
|
+
search: isSearchable ? {
|
|
1847
|
+
value: searchValue,
|
|
1848
|
+
noResultsText: searchNoResultsText
|
|
1849
|
+
} : void 0,
|
|
1850
|
+
scopeId: isSearchable ? scopeId : void 0
|
|
1851
|
+
});
|
|
1852
|
+
if (isSearchable) return /* @__PURE__ */ jsx(MenuTrigger, {
|
|
1853
|
+
isOpen,
|
|
1854
|
+
onOpenChange: handleOpenChange,
|
|
1855
|
+
children: /* @__PURE__ */ jsxs(Autocomplete, {
|
|
1856
|
+
inputValue: searchValue,
|
|
1857
|
+
onInputChange: handleSearchChange,
|
|
1858
|
+
children: [/* @__PURE__ */ jsx(TriggerTooltip, {
|
|
1859
|
+
tooltip,
|
|
1860
|
+
error,
|
|
1861
|
+
warning,
|
|
1862
|
+
children: withBadge(/* @__PURE__ */ jsx(SearchTrigger, {
|
|
1863
|
+
ref: searchTriggerRef,
|
|
1864
|
+
inputRef: searchInputRef,
|
|
1865
|
+
label,
|
|
1866
|
+
searchValue,
|
|
1867
|
+
isOpen,
|
|
1868
|
+
disabled: isDisabled,
|
|
1869
|
+
small,
|
|
1870
|
+
width,
|
|
1871
|
+
groupOrder,
|
|
1872
|
+
error,
|
|
1873
|
+
warning,
|
|
1874
|
+
tabIndex,
|
|
1875
|
+
testId,
|
|
1876
|
+
onOpen: () => handleOpenChange(true),
|
|
1877
|
+
onClose: close
|
|
1878
|
+
}), {
|
|
1879
|
+
badgeTitle,
|
|
1880
|
+
badgeDot
|
|
1881
|
+
})
|
|
1882
|
+
}), /* @__PURE__ */ jsx(AriaOverlayPopover, {
|
|
1883
|
+
className: menu_module_default.menuPopover,
|
|
1884
|
+
placement: resolvedPlacement,
|
|
1885
|
+
triggerRef: searchTriggerRef,
|
|
1886
|
+
portalTriggerRef: searchTriggerRef,
|
|
1887
|
+
offset,
|
|
1888
|
+
isNonModal: true,
|
|
1889
|
+
isOpen,
|
|
1890
|
+
onOpenChange: ignorePopoverClose,
|
|
1891
|
+
"data-testid": menu.testId,
|
|
1892
|
+
children: /* @__PURE__ */ jsx(OverlayScope, {
|
|
1893
|
+
scopeId,
|
|
1894
|
+
children: layer
|
|
1895
|
+
})
|
|
1896
|
+
})]
|
|
1897
|
+
})
|
|
1898
|
+
});
|
|
1601
1899
|
return /* @__PURE__ */ jsxs(MenuTrigger, {
|
|
1602
1900
|
isOpen,
|
|
1603
1901
|
onOpenChange: handleOpenChange,
|
|
@@ -1615,15 +1913,7 @@ var Menu = ({ menu, width, disabled = false, badgeTitle, badgeDot = false, loadi
|
|
|
1615
1913
|
portalTriggerRef: triggerRef,
|
|
1616
1914
|
offset,
|
|
1617
1915
|
"data-testid": menu.testId,
|
|
1618
|
-
children:
|
|
1619
|
-
sections,
|
|
1620
|
-
width,
|
|
1621
|
-
closeOnOptionClick,
|
|
1622
|
-
close,
|
|
1623
|
-
maxHeight,
|
|
1624
|
-
showAllButton,
|
|
1625
|
-
testId: layerTestId
|
|
1626
|
-
})
|
|
1916
|
+
children: layer
|
|
1627
1917
|
})]
|
|
1628
1918
|
});
|
|
1629
1919
|
};
|
|
@@ -2681,6 +2971,25 @@ var Drawer = ({ background = "var(--color-background-raised)", fixed = false, op
|
|
|
2681
2971
|
})
|
|
2682
2972
|
});
|
|
2683
2973
|
};
|
|
2974
|
+
//#endregion
|
|
2975
|
+
//#region src/components/table/table-import-context.tsx
|
|
2976
|
+
var TableImportRevisionContext = createContext(0);
|
|
2977
|
+
var TableImportCompleteContext = createContext(null);
|
|
2978
|
+
var TableImportProvider = ({ children }) => {
|
|
2979
|
+
const [revision, setRevision] = useState(0);
|
|
2980
|
+
const onImportComplete = useCallback(() => {
|
|
2981
|
+
setRevision((previous) => {
|
|
2982
|
+
return previous + 1;
|
|
2983
|
+
});
|
|
2984
|
+
}, []);
|
|
2985
|
+
return /* @__PURE__ */ jsx(TableImportCompleteContext.Provider, {
|
|
2986
|
+
value: onImportComplete,
|
|
2987
|
+
children: /* @__PURE__ */ jsx(TableImportRevisionContext.Provider, {
|
|
2988
|
+
value: revision,
|
|
2989
|
+
children
|
|
2990
|
+
})
|
|
2991
|
+
});
|
|
2992
|
+
};
|
|
2684
2993
|
var input_group_module_default = {
|
|
2685
2994
|
inputGroup: "_inputGroup_q46ua_1",
|
|
2686
2995
|
isInTable: "_isInTable_q46ua_8"
|
|
@@ -2716,53 +3025,28 @@ var InputGroup = ({ children, small = false, width = "100%", isInTable: isInTabl
|
|
|
2716
3025
|
})
|
|
2717
3026
|
});
|
|
2718
3027
|
};
|
|
2719
|
-
//#endregion
|
|
2720
|
-
//#region src/hooks/use-element-width.ts
|
|
2721
|
-
var useElementWidth = (enabled = true) => {
|
|
2722
|
-
const [element, setElement] = useState(null);
|
|
2723
|
-
const [width, setWidth] = useState(null);
|
|
2724
|
-
const ref = useCallback((node) => {
|
|
2725
|
-
setElement(node);
|
|
2726
|
-
}, []);
|
|
2727
|
-
useLayoutEffect(() => {
|
|
2728
|
-
if (!enabled || !element) {
|
|
2729
|
-
setWidth(null);
|
|
2730
|
-
return;
|
|
2731
|
-
}
|
|
2732
|
-
const measure = () => setWidth(element.getBoundingClientRect().width);
|
|
2733
|
-
measure();
|
|
2734
|
-
if (typeof ResizeObserver === "undefined") return;
|
|
2735
|
-
const observer = new ResizeObserver(measure);
|
|
2736
|
-
observer.observe(element);
|
|
2737
|
-
return () => observer.disconnect();
|
|
2738
|
-
}, [enabled, element]);
|
|
2739
|
-
return [ref, width];
|
|
2740
|
-
};
|
|
2741
3028
|
var input_module_default = {
|
|
2742
|
-
inputInTable: "
|
|
2743
|
-
inputHover: "
|
|
2744
|
-
inputFocus: "
|
|
2745
|
-
controlFocusVisible: "
|
|
2746
|
-
inputError: "
|
|
2747
|
-
inputWarning: "
|
|
2748
|
-
inputDisabled: "
|
|
2749
|
-
hideScrollbars: "
|
|
2750
|
-
wrapper: "
|
|
2751
|
-
input: "
|
|
2752
|
-
isInTable: "
|
|
2753
|
-
small: "
|
|
2754
|
-
right: "
|
|
2755
|
-
groupOrderFirst: "
|
|
2756
|
-
groupOrderMiddle: "
|
|
2757
|
-
groupOrderLast: "
|
|
2758
|
-
|
|
2759
|
-
slotLeft: "_slotLeft_1w4lm_207",
|
|
2760
|
-
slotRight: "_slotRight_1w4lm_212",
|
|
2761
|
-
icon: "_icon_1w4lm_225"
|
|
3029
|
+
inputInTable: "_inputInTable_o2gwb_1",
|
|
3030
|
+
inputHover: "_inputHover_o2gwb_13",
|
|
3031
|
+
inputFocus: "_inputFocus_o2gwb_18",
|
|
3032
|
+
controlFocusVisible: "_controlFocusVisible_o2gwb_25",
|
|
3033
|
+
inputError: "_inputError_o2gwb_29",
|
|
3034
|
+
inputWarning: "_inputWarning_o2gwb_30",
|
|
3035
|
+
inputDisabled: "_inputDisabled_o2gwb_65",
|
|
3036
|
+
hideScrollbars: "_hideScrollbars_o2gwb_71",
|
|
3037
|
+
wrapper: "_wrapper_o2gwb_81",
|
|
3038
|
+
input: "_input_o2gwb_1",
|
|
3039
|
+
isInTable: "_isInTable_o2gwb_107",
|
|
3040
|
+
small: "_small_o2gwb_131",
|
|
3041
|
+
right: "_right_o2gwb_177",
|
|
3042
|
+
groupOrderFirst: "_groupOrderFirst_o2gwb_180",
|
|
3043
|
+
groupOrderMiddle: "_groupOrderMiddle_o2gwb_181",
|
|
3044
|
+
groupOrderLast: "_groupOrderLast_o2gwb_185",
|
|
3045
|
+
icon: "_icon_o2gwb_190"
|
|
2762
3046
|
};
|
|
2763
3047
|
//#endregion
|
|
2764
3048
|
//#region src/components/input/input.tsx
|
|
2765
|
-
var Input = forwardRef(({ error = null, tooltip = null, isInTable: isInTableProp, width: propWidth = void 0, small = false, onChange = noop, placeholder = "", value = "", icon,
|
|
3049
|
+
var Input = forwardRef(({ error = null, tooltip = null, isInTable: isInTableProp, width: propWidth = void 0, small = false, onChange = noop, placeholder = "", value = "", icon, onKeyPress = () => {}, onFocus = () => {}, onBlur = () => {}, onPaste = () => {}, onKeyDown = () => {}, selectOnFocus = true, name = void 0, type = "text", tabIndex = 0, disabled = false, right = false, warning = null, groupOrder = null, maxTooltipWidth = void 0, testId = void 0, size = null }, ref) => {
|
|
2766
3050
|
const disabledContext = useContext(DisabledContext);
|
|
2767
3051
|
const isInTable = useIsInTable(isInTableProp);
|
|
2768
3052
|
const order = (() => {
|
|
@@ -2774,67 +3058,48 @@ var Input = forwardRef(({ error = null, tooltip = null, isInTable: isInTableProp
|
|
|
2774
3058
|
return "";
|
|
2775
3059
|
})();
|
|
2776
3060
|
const width = propWidth || (size ? "auto" : "100%");
|
|
2777
|
-
const leftContent = icon ? /* @__PURE__ */ jsx("span", {
|
|
2778
|
-
className: input_module_default.icon,
|
|
2779
|
-
children: /* @__PURE__ */ jsx(Icon, { icon })
|
|
2780
|
-
}) : leftSlot;
|
|
2781
|
-
const [leftSlotRef, leftSlotWidth] = useElementWidth(!!leftContent);
|
|
2782
|
-
const [rightSlotRef, rightSlotWidth] = useElementWidth(!!rightSlot);
|
|
2783
3061
|
const handleFocus = (e) => {
|
|
2784
3062
|
onFocus(e);
|
|
2785
3063
|
if (selectOnFocus) setTimeout(() => {
|
|
2786
3064
|
if (e.target === document.activeElement) e.target.select();
|
|
2787
3065
|
}, 0);
|
|
2788
3066
|
};
|
|
2789
|
-
return /* @__PURE__ */
|
|
3067
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2790
3068
|
style: { width },
|
|
2791
3069
|
className: cx(order, input_module_default.wrapper),
|
|
2792
|
-
children:
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
...rightSlotWidth ? { paddingRight: rightSlotWidth } : null
|
|
2826
|
-
},
|
|
2827
|
-
"data-error": error || null,
|
|
2828
|
-
"data-warning": warning || null,
|
|
2829
|
-
"data-testid": testId
|
|
2830
|
-
})
|
|
2831
|
-
}),
|
|
2832
|
-
rightSlot && /* @__PURE__ */ jsx("div", {
|
|
2833
|
-
ref: rightSlotRef,
|
|
2834
|
-
className: cx(input_module_default.slot, input_module_default.slotRight),
|
|
2835
|
-
children: rightSlot
|
|
2836
|
-
})
|
|
2837
|
-
]
|
|
3070
|
+
children: /* @__PURE__ */ jsxs(Tooltip, {
|
|
3071
|
+
error: !!error,
|
|
3072
|
+
warning: !!warning,
|
|
3073
|
+
text: tooltip || error || warning,
|
|
3074
|
+
enabled: tooltip && isStringNumberOrNode(tooltip) || error && isStringNumberOrNode(error) || warning && isStringNumberOrNode(warning) || false,
|
|
3075
|
+
maxWidth: maxTooltipWidth,
|
|
3076
|
+
display: "block",
|
|
3077
|
+
children: [icon && /* @__PURE__ */ jsx("span", {
|
|
3078
|
+
className: input_module_default.icon,
|
|
3079
|
+
children: /* @__PURE__ */ jsx(Icon, { icon })
|
|
3080
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
3081
|
+
ref,
|
|
3082
|
+
type: type || "text",
|
|
3083
|
+
size: size || 20,
|
|
3084
|
+
placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : "",
|
|
3085
|
+
value: value !== null && value !== void 0 ? value : "",
|
|
3086
|
+
onChange,
|
|
3087
|
+
onKeyPress,
|
|
3088
|
+
onKeyDown,
|
|
3089
|
+
onFocus: handleFocus,
|
|
3090
|
+
onBlur,
|
|
3091
|
+
onPaste,
|
|
3092
|
+
name,
|
|
3093
|
+
tabIndex,
|
|
3094
|
+
autoComplete: "off",
|
|
3095
|
+
disabled: disabled || disabledContext,
|
|
3096
|
+
className: cx(input_module_default.input, right ? input_module_default.right : "", small ? input_module_default.small : "", isInTable ? input_module_default.isInTable : ""),
|
|
3097
|
+
style: { width },
|
|
3098
|
+
"data-error": error || null,
|
|
3099
|
+
"data-warning": warning || null,
|
|
3100
|
+
"data-testid": testId
|
|
3101
|
+
})]
|
|
3102
|
+
})
|
|
2838
3103
|
});
|
|
2839
3104
|
});
|
|
2840
3105
|
var file_input_module_default = { fileInput: "_fileInput_1elar_1" };
|
|
@@ -3736,38 +4001,6 @@ var Layer$1 = ({ listRef, sections, selectedOptions, onSelectOption, focusedOpti
|
|
|
3736
4001
|
children: listBox
|
|
3737
4002
|
});
|
|
3738
4003
|
};
|
|
3739
|
-
var trigger_module_default = {
|
|
3740
|
-
inputInTable: "_inputInTable_c2rg4_1",
|
|
3741
|
-
inputHover: "_inputHover_c2rg4_13",
|
|
3742
|
-
inputFocus: "_inputFocus_c2rg4_18",
|
|
3743
|
-
controlFocusVisible: "_controlFocusVisible_c2rg4_25",
|
|
3744
|
-
inputError: "_inputError_c2rg4_29",
|
|
3745
|
-
inputWarning: "_inputWarning_c2rg4_30",
|
|
3746
|
-
inputDisabled: "_inputDisabled_c2rg4_65",
|
|
3747
|
-
hideScrollbars: "_hideScrollbars_c2rg4_71",
|
|
3748
|
-
trigger: "_trigger_c2rg4_81",
|
|
3749
|
-
isInTable: "_isInTable_c2rg4_97",
|
|
3750
|
-
input: "_input_c2rg4_1",
|
|
3751
|
-
isOpen: "_isOpen_c2rg4_118",
|
|
3752
|
-
disabled: "_disabled_c2rg4_161",
|
|
3753
|
-
icons: "_icons_c2rg4_167",
|
|
3754
|
-
clearAll: "_clearAll_c2rg4_174",
|
|
3755
|
-
iconOpen: "_iconOpen_c2rg4_175",
|
|
3756
|
-
small: "_small_c2rg4_186",
|
|
3757
|
-
triggerInputContainer: "_triggerInputContainer_c2rg4_194",
|
|
3758
|
-
right: "_right_c2rg4_203",
|
|
3759
|
-
multiOptions: "_multiOptions_c2rg4_216",
|
|
3760
|
-
multiOption: "_multiOption_c2rg4_216",
|
|
3761
|
-
label: "_label_c2rg4_244",
|
|
3762
|
-
closeMultiOption: "_closeMultiOption_c2rg4_247",
|
|
3763
|
-
focus: "_focus_c2rg4_258",
|
|
3764
|
-
selectedSingleValue: "_selectedSingleValue_c2rg4_262",
|
|
3765
|
-
placeHolder: "_placeHolder_c2rg4_263",
|
|
3766
|
-
groupOrderFirst: "_groupOrderFirst_c2rg4_302",
|
|
3767
|
-
groupOrderMiddle: "_groupOrderMiddle_c2rg4_303",
|
|
3768
|
-
groupOrderLast: "_groupOrderLast_c2rg4_307",
|
|
3769
|
-
detailedLabel: "_detailedLabel_c2rg4_312"
|
|
3770
|
-
};
|
|
3771
4004
|
//#endregion
|
|
3772
4005
|
//#region src/components/select/custom-select/trigger/multi-selected-options.tsx
|
|
3773
4006
|
var MultiSelectedOptions = ({ selectedOptions, small, width, testId }) => {
|
|
@@ -3812,7 +4045,7 @@ var MultiSelectedOptions = ({ selectedOptions, small, width, testId }) => {
|
|
|
3812
4045
|
};
|
|
3813
4046
|
//#endregion
|
|
3814
4047
|
//#region src/components/select/custom-select/trigger/input.tsx
|
|
3815
|
-
var Input$
|
|
4048
|
+
var Input$2 = ({ selectedOptions, searchable = false, searchValue, onChange = noop, inputRef, error, placeholder = "Select...", small, testId }) => {
|
|
3816
4049
|
const containerRef = useRef(null);
|
|
3817
4050
|
const isMulti = Array.isArray(selectedOptions);
|
|
3818
4051
|
const hasSelectedValues = isMulti ? selectedOptions.length > 0 : !!selectedOptions;
|
|
@@ -3892,7 +4125,7 @@ var Trigger = ({ selectedOptions, searchValue, searchable, clearable, onClickTri
|
|
|
3892
4125
|
"data-error": error || null,
|
|
3893
4126
|
"data-warning": warning || null,
|
|
3894
4127
|
"data-testid": testId,
|
|
3895
|
-
children: [/* @__PURE__ */ jsx(Input$
|
|
4128
|
+
children: [/* @__PURE__ */ jsx(Input$2, {
|
|
3896
4129
|
selectedOptions: selectedOptionsWithDetails,
|
|
3897
4130
|
placeholder,
|
|
3898
4131
|
searchable,
|
|
@@ -4564,17 +4797,16 @@ var validateSelectedPage = (selectedPage, numPages, errorMessageTemplate = "Sele
|
|
|
4564
4797
|
};
|
|
4565
4798
|
var pagination_module_default = { paginationContainer: "_paginationContainer_1tmz4_1" };
|
|
4566
4799
|
var input_group_addon_module_default = {
|
|
4567
|
-
addon: "
|
|
4568
|
-
small: "
|
|
4569
|
-
groupOrderFirst: "
|
|
4570
|
-
groupOrderMiddle: "
|
|
4571
|
-
groupOrderLast: "
|
|
4572
|
-
isInTable: "
|
|
4573
|
-
borderless: "_borderless_4fbro_38"
|
|
4800
|
+
addon: "_addon_11bnn_1",
|
|
4801
|
+
small: "_small_11bnn_12",
|
|
4802
|
+
groupOrderFirst: "_groupOrderFirst_11bnn_16",
|
|
4803
|
+
groupOrderMiddle: "_groupOrderMiddle_11bnn_17",
|
|
4804
|
+
groupOrderLast: "_groupOrderLast_11bnn_21",
|
|
4805
|
+
isInTable: "_isInTable_11bnn_26"
|
|
4574
4806
|
};
|
|
4575
4807
|
//#endregion
|
|
4576
4808
|
//#region src/components/input-group/input-group-addon/input-group-addon.tsx
|
|
4577
|
-
var InputGroupAddon = ({ children, groupOrder, small = false
|
|
4809
|
+
var InputGroupAddon = ({ children, groupOrder, small = false }) => {
|
|
4578
4810
|
const isInTable = useIsInTable();
|
|
4579
4811
|
const order = (() => {
|
|
4580
4812
|
if (groupOrder) switch (groupOrder) {
|
|
@@ -4585,7 +4817,7 @@ var InputGroupAddon = ({ children, groupOrder, small = false, borderless = false
|
|
|
4585
4817
|
return "";
|
|
4586
4818
|
})();
|
|
4587
4819
|
return /* @__PURE__ */ jsx("span", {
|
|
4588
|
-
className: cx(input_group_addon_module_default.addon, order, small ? input_group_addon_module_default.small : "", isInTable && input_group_addon_module_default.isInTable
|
|
4820
|
+
className: cx(input_group_addon_module_default.addon, order, small ? input_group_addon_module_default.small : "", isInTable && input_group_addon_module_default.isInTable),
|
|
4589
4821
|
children
|
|
4590
4822
|
});
|
|
4591
4823
|
};
|
|
@@ -4774,37 +5006,37 @@ var getHeaderAlignment = (alignments, isHeader = false, rowIndex = 0) => {
|
|
|
4774
5006
|
}
|
|
4775
5007
|
};
|
|
4776
5008
|
var cell_module_default = {
|
|
4777
|
-
inputInTable: "
|
|
4778
|
-
inputHover: "
|
|
4779
|
-
inputFocus: "
|
|
4780
|
-
controlFocusVisible: "
|
|
4781
|
-
inputError: "
|
|
4782
|
-
inputWarning: "
|
|
4783
|
-
inputDisabled: "
|
|
4784
|
-
hideScrollbars: "
|
|
4785
|
-
cell: "
|
|
4786
|
-
disabledLink: "
|
|
4787
|
-
inputWrapper: "
|
|
4788
|
-
numberInputWrapper: "
|
|
4789
|
-
unitInputWrapper: "
|
|
4790
|
-
breakWord: "
|
|
4791
|
-
inputCell: "
|
|
4792
|
-
sliderCell: "
|
|
4793
|
-
staticCell: "
|
|
4794
|
-
staticCellContent: "
|
|
4795
|
-
unit: "
|
|
4796
|
-
sortingCell: "
|
|
4797
|
-
sortingCellIcon: "
|
|
4798
|
-
icon: "
|
|
4799
|
-
checkBoxCell: "
|
|
4800
|
-
iconCellWrapper: "
|
|
4801
|
-
actionsCell: "
|
|
4802
|
-
rightAligned: "
|
|
4803
|
-
centerAligned: "
|
|
4804
|
-
leftAligned: "
|
|
4805
|
-
popover: "
|
|
4806
|
-
disabledPointerEvents: "
|
|
4807
|
-
standaloneCheckbox: "
|
|
5009
|
+
inputInTable: "_inputInTable_1ull1_1",
|
|
5010
|
+
inputHover: "_inputHover_1ull1_13",
|
|
5011
|
+
inputFocus: "_inputFocus_1ull1_18",
|
|
5012
|
+
controlFocusVisible: "_controlFocusVisible_1ull1_25",
|
|
5013
|
+
inputError: "_inputError_1ull1_29",
|
|
5014
|
+
inputWarning: "_inputWarning_1ull1_30",
|
|
5015
|
+
inputDisabled: "_inputDisabled_1ull1_65",
|
|
5016
|
+
hideScrollbars: "_hideScrollbars_1ull1_71",
|
|
5017
|
+
cell: "_cell_1ull1_81",
|
|
5018
|
+
disabledLink: "_disabledLink_1ull1_91",
|
|
5019
|
+
inputWrapper: "_inputWrapper_1ull1_95",
|
|
5020
|
+
numberInputWrapper: "_numberInputWrapper_1ull1_110",
|
|
5021
|
+
unitInputWrapper: "_unitInputWrapper_1ull1_117",
|
|
5022
|
+
breakWord: "_breakWord_1ull1_125",
|
|
5023
|
+
inputCell: "_inputCell_1ull1_128",
|
|
5024
|
+
sliderCell: "_sliderCell_1ull1_131",
|
|
5025
|
+
staticCell: "_staticCell_1ull1_135",
|
|
5026
|
+
staticCellContent: "_staticCellContent_1ull1_138",
|
|
5027
|
+
unit: "_unit_1ull1_117",
|
|
5028
|
+
sortingCell: "_sortingCell_1ull1_162",
|
|
5029
|
+
sortingCellIcon: "_sortingCellIcon_1ull1_173",
|
|
5030
|
+
icon: "_icon_1ull1_184",
|
|
5031
|
+
checkBoxCell: "_checkBoxCell_1ull1_188",
|
|
5032
|
+
iconCellWrapper: "_iconCellWrapper_1ull1_192",
|
|
5033
|
+
actionsCell: "_actionsCell_1ull1_196",
|
|
5034
|
+
rightAligned: "_rightAligned_1ull1_204",
|
|
5035
|
+
centerAligned: "_centerAligned_1ull1_210",
|
|
5036
|
+
leftAligned: "_leftAligned_1ull1_216",
|
|
5037
|
+
popover: "_popover_1ull1_219",
|
|
5038
|
+
disabledPointerEvents: "_disabledPointerEvents_1ull1_222",
|
|
5039
|
+
standaloneCheckbox: "_standaloneCheckbox_1ull1_225"
|
|
4808
5040
|
};
|
|
4809
5041
|
//#endregion
|
|
4810
5042
|
//#region src/components/table/cell/cell-types/input-cell.tsx
|
|
@@ -4850,7 +5082,7 @@ var startsWithDecimal = (value) => value.startsWith(".");
|
|
|
4850
5082
|
* undoing deletion of the leading zero when editing values like 0.1 → 1.1.
|
|
4851
5083
|
*/
|
|
4852
5084
|
var preserveLeadingDecimalDraft = (rawInput, cleaned) => startsWithDecimal(rawInput) && cleaned === `0${rawInput}` ? rawInput : cleaned;
|
|
4853
|
-
var NumberInput = ({ name, placeholder = "", disabled = false, error = false, left = false, small = false, width = "100%", value = "", onChange = () => {}, onFocus = () => {}, onBlur = () => {}, selectOnFocus = true, tabIndex = 0, testId, tooltip = null, warning = false, validationCallback = () => {}, allowEmpty = false, isInTable, groupOrder, enableCosmeticRounding = true, enableDisplayRounding = false, roundDisplayValue, disableInternalErrorValidationMessages = false, disableValidationOnFocus = false
|
|
5085
|
+
var NumberInput = ({ name, placeholder = "", disabled = false, error = false, left = false, small = false, width = "100%", value = "", onChange = () => {}, onFocus = () => {}, onBlur = () => {}, selectOnFocus = true, tabIndex = 0, testId, tooltip = null, warning = false, validationCallback = () => {}, allowEmpty = false, isInTable, groupOrder, enableCosmeticRounding = true, enableDisplayRounding = false, roundDisplayValue, disableInternalErrorValidationMessages = false, disableValidationOnFocus = false }) => {
|
|
4854
5086
|
const validateInputValue = (value) => {
|
|
4855
5087
|
const validation = validateNumber(value);
|
|
4856
5088
|
const isPlaceholder = placeholder && isEmptyNullOrUndefined(value);
|
|
@@ -4962,9 +5194,7 @@ var NumberInput = ({ name, placeholder = "", disabled = false, error = false, le
|
|
|
4962
5194
|
selectOnFocus,
|
|
4963
5195
|
tabIndex,
|
|
4964
5196
|
tooltip,
|
|
4965
|
-
ref: inputRef
|
|
4966
|
-
leftSlot,
|
|
4967
|
-
rightSlot
|
|
5197
|
+
ref: inputRef
|
|
4968
5198
|
}, stringName);
|
|
4969
5199
|
};
|
|
4970
5200
|
//#endregion
|
|
@@ -5183,11 +5413,9 @@ var safeRoundNumbers = (value) => {
|
|
|
5183
5413
|
return !isScientificStringNum(value) ? roundByMagnitude(value) : value;
|
|
5184
5414
|
};
|
|
5185
5415
|
var unit_input_module_default = {
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
predefinedMenuActive: "_predefinedMenuActive_1ogvr_13",
|
|
5190
|
-
isInTable: "_isInTable_1ogvr_16"
|
|
5416
|
+
predefinedMenuActive: "_predefinedMenuActive_13yll_1",
|
|
5417
|
+
inputWrapper: "_inputWrapper_13yll_4",
|
|
5418
|
+
isInTable: "_isInTable_13yll_9"
|
|
5191
5419
|
};
|
|
5192
5420
|
//#endregion
|
|
5193
5421
|
//#region src/components/unit-input/unit-input.tsx
|
|
@@ -5370,7 +5598,10 @@ var UnitInput = ({ name, placeholder = "", disabled = false, disabledUnit = fals
|
|
|
5370
5598
|
} });
|
|
5371
5599
|
}
|
|
5372
5600
|
},
|
|
5373
|
-
label: el.label,
|
|
5601
|
+
label: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Text, { children: el.label }), /* @__PURE__ */ jsx(Spacer, {
|
|
5602
|
+
width: "20px",
|
|
5603
|
+
height: "0"
|
|
5604
|
+
})] }),
|
|
5374
5605
|
description,
|
|
5375
5606
|
selected: foundPredefinedMenuOption === el && predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED
|
|
5376
5607
|
};
|
|
@@ -5405,92 +5636,100 @@ var UnitInput = ({ name, placeholder = "", disabled = false, disabledUnit = fals
|
|
|
5405
5636
|
}
|
|
5406
5637
|
return placeholder;
|
|
5407
5638
|
};
|
|
5639
|
+
const hasPredefinedOptions = Boolean(predefinedOptions);
|
|
5640
|
+
const hasUnitControl = Boolean(displayUnitLabel);
|
|
5641
|
+
const inputGroupOrder = (() => {
|
|
5642
|
+
if (hasPredefinedOptions && hasUnitControl) return GroupOrder.MIDDLE;
|
|
5643
|
+
if (hasPredefinedOptions) return !groupOrder || groupOrder === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
|
|
5644
|
+
if (hasUnitControl) return !groupOrder || groupOrder === GroupOrder.FIRST ? GroupOrder.FIRST : GroupOrder.MIDDLE;
|
|
5645
|
+
return groupOrder !== null && groupOrder !== void 0 ? groupOrder : GroupOrder.FIRST;
|
|
5646
|
+
})();
|
|
5647
|
+
const unitGroupOrder = !groupOrder || groupOrder === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
|
|
5408
5648
|
return /* @__PURE__ */ jsx("div", {
|
|
5409
|
-
className: cx(
|
|
5410
|
-
|
|
5411
|
-
children: /* @__PURE__ */ jsx(NumberInput, {
|
|
5412
|
-
name: stringName,
|
|
5413
|
-
testId,
|
|
5414
|
-
disabled,
|
|
5415
|
-
placeholder: getPlaceholder(placeholder),
|
|
5416
|
-
value: displayLayer.value,
|
|
5417
|
-
onChange: onSetValue,
|
|
5418
|
-
onFocus,
|
|
5419
|
-
error: error === null ? void 0 : error,
|
|
5420
|
-
warning: warning === null ? void 0 : warning,
|
|
5421
|
-
left,
|
|
5422
|
-
allowEmpty: derivedAllowEmpty,
|
|
5423
|
-
validationCallback: (_name, error) => validationCallback(stringName, error),
|
|
5424
|
-
enableCosmeticRounding,
|
|
5425
|
-
enableDisplayRounding,
|
|
5426
|
-
roundDisplayValue,
|
|
5427
|
-
groupOrder,
|
|
5428
|
-
disableInternalErrorValidationMessages,
|
|
5649
|
+
className: cx(predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED && unit_input_module_default.predefinedMenuActive, isInTable && unit_input_module_default.isInTable),
|
|
5650
|
+
children: /* @__PURE__ */ jsxs(InputGroup, {
|
|
5429
5651
|
small,
|
|
5430
|
-
width
|
|
5652
|
+
width,
|
|
5431
5653
|
isInTable,
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5654
|
+
children: [
|
|
5655
|
+
predefinedOptions && /* @__PURE__ */ jsx(Menu, {
|
|
5656
|
+
maxHeight: 380,
|
|
5657
|
+
groupOrder: "first",
|
|
5658
|
+
testId: testId && `${testId}-predefined-menu`,
|
|
5659
|
+
disabled,
|
|
5660
|
+
menu: {
|
|
5661
|
+
colored: true,
|
|
5662
|
+
trigger: "Component",
|
|
5663
|
+
component: /* @__PURE__ */ jsx(Button, {
|
|
5664
|
+
groupOrder: "first",
|
|
5665
|
+
active: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED,
|
|
5666
|
+
icon: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? "link" : "unlink",
|
|
5667
|
+
small
|
|
5668
|
+
}),
|
|
5669
|
+
small,
|
|
5670
|
+
sections: sectionsPredefinedMenu
|
|
5671
|
+
},
|
|
5672
|
+
tooltip: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? foundPredefinedMenuOption === null || foundPredefinedMenuOption === void 0 ? void 0 : foundPredefinedMenuOption.label : ""
|
|
5673
|
+
}),
|
|
5674
|
+
/* @__PURE__ */ jsx("div", {
|
|
5675
|
+
className: unit_input_module_default.inputWrapper,
|
|
5676
|
+
children: /* @__PURE__ */ jsx(NumberInput, {
|
|
5677
|
+
name: stringName,
|
|
5678
|
+
testId,
|
|
5679
|
+
disabled,
|
|
5680
|
+
placeholder: getPlaceholder(placeholder),
|
|
5681
|
+
value: displayLayer.value,
|
|
5682
|
+
onChange: onSetValue,
|
|
5683
|
+
onFocus,
|
|
5684
|
+
error: error === null ? void 0 : error,
|
|
5685
|
+
warning: warning === null ? void 0 : warning,
|
|
5686
|
+
left,
|
|
5687
|
+
allowEmpty: derivedAllowEmpty,
|
|
5688
|
+
validationCallback: (_name, error) => validationCallback(stringName, error),
|
|
5689
|
+
enableCosmeticRounding,
|
|
5690
|
+
enableDisplayRounding,
|
|
5691
|
+
roundDisplayValue,
|
|
5692
|
+
groupOrder: inputGroupOrder,
|
|
5693
|
+
disableInternalErrorValidationMessages,
|
|
5694
|
+
small,
|
|
5695
|
+
selectOnFocus,
|
|
5696
|
+
tooltip
|
|
5697
|
+
}, stringName)
|
|
5698
|
+
}),
|
|
5699
|
+
displayUnitLabel && (noConvert || !knownUnit ? /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
5700
|
+
groupOrder: unitGroupOrder,
|
|
5470
5701
|
small,
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5702
|
+
children: displayUnitLabel
|
|
5703
|
+
}) : /* @__PURE__ */ jsx(Menu, {
|
|
5704
|
+
groupOrder: unitGroupOrder,
|
|
5705
|
+
maxHeight: 380,
|
|
5706
|
+
disabled: disabledUnit,
|
|
5707
|
+
testId: testId && `${testId}-menu`,
|
|
5708
|
+
tabIndex: -1,
|
|
5709
|
+
menu: {
|
|
5710
|
+
label: displayUnitLabel,
|
|
5711
|
+
trigger: "DropDownButton",
|
|
5712
|
+
small,
|
|
5713
|
+
sections: alternativeUnits.map(([value = "", altUnit = "", label]) => {
|
|
5714
|
+
const displayUnit = label || altUnit || "";
|
|
5715
|
+
const safeValue = isValidNum(value) ? value : "";
|
|
5716
|
+
return {
|
|
5717
|
+
type: "Option",
|
|
5718
|
+
label: enableCosmeticRounding ? safeRoundNumbers(safeValue) : safeValue,
|
|
5719
|
+
inline: true,
|
|
5720
|
+
onClick: (evt) => {
|
|
5721
|
+
evt.stopPropagation();
|
|
5722
|
+
onClickUnit(value, altUnit);
|
|
5723
|
+
},
|
|
5724
|
+
description: displayUnit,
|
|
5725
|
+
selected: displayUnit === displayUnitLabel,
|
|
5726
|
+
testId: `${testId}-unit-${displayUnit}`
|
|
5727
|
+
};
|
|
5728
|
+
})
|
|
5729
|
+
}
|
|
5730
|
+
}))
|
|
5731
|
+
]
|
|
5732
|
+
})
|
|
5494
5733
|
});
|
|
5495
5734
|
};
|
|
5496
5735
|
//#endregion
|
|
@@ -6207,7 +6446,7 @@ var Row$1 = ({ row, rowIndex, isHeader = false, columnCount, colSpan, columnHead
|
|
|
6207
6446
|
]);
|
|
6208
6447
|
const rowRef = measureRef ? setMeasuredRowRef : !row.noDrag ? setNodeRef : null;
|
|
6209
6448
|
const style = {
|
|
6210
|
-
transform: !dropDisabled ? CSS.Translate.toString(transform) : void 0,
|
|
6449
|
+
transform: !dropDisabled ? CSS$1.Translate.toString(transform) : void 0,
|
|
6211
6450
|
height,
|
|
6212
6451
|
transition,
|
|
6213
6452
|
opacity: isDragging ? 0 : void 0
|
|
@@ -6445,10 +6684,11 @@ var TableScrollWrapper = ({ table, children }) => {
|
|
|
6445
6684
|
};
|
|
6446
6685
|
//#endregion
|
|
6447
6686
|
//#region src/components/table/table.tsx
|
|
6448
|
-
var
|
|
6687
|
+
var TableContent = (props) => {
|
|
6449
6688
|
var _footer$pagination, _footer$pagination2, _footer$pagination3, _footer$pagination4, _defaultEmptyRow$cell;
|
|
6450
6689
|
const { onListReorder = () => {}, canListReorder = () => true, beforeRenderRow, table: propTable } = props;
|
|
6451
6690
|
const { columnWidths, footer, name, rows: propRows = [], actions, actionsRight, columnHeaderAlignments, columnAlignment, striped = true, testId, draggable, defaultEmptyRow = null, onAddRow = null, bordered = true, maxHeight, fixedWidth: width } = propTable;
|
|
6691
|
+
const importRevision = useContext(TableImportRevisionContext);
|
|
6452
6692
|
const tbodyRef = useRef(null);
|
|
6453
6693
|
const headers = get(props, "table.headers", []);
|
|
6454
6694
|
const columnCount = getColumnCount$1(propRows, headers);
|
|
@@ -6570,7 +6810,7 @@ var Table = (props) => {
|
|
|
6570
6810
|
dropDisabled
|
|
6571
6811
|
}, `1_${index}`);
|
|
6572
6812
|
})
|
|
6573
|
-
})]
|
|
6813
|
+
}, importRevision)]
|
|
6574
6814
|
})
|
|
6575
6815
|
})
|
|
6576
6816
|
}),
|
|
@@ -6582,6 +6822,9 @@ var Table = (props) => {
|
|
|
6582
6822
|
]
|
|
6583
6823
|
});
|
|
6584
6824
|
};
|
|
6825
|
+
var Table = (props) => {
|
|
6826
|
+
return /* @__PURE__ */ jsx(TableImportProvider, { children: /* @__PURE__ */ jsx(TableContent, { ...props }) });
|
|
6827
|
+
};
|
|
6585
6828
|
//#endregion
|
|
6586
6829
|
//#region src/components/data-import-export/constants.ts
|
|
6587
6830
|
var placeholder$1 = "blank";
|
|
@@ -6591,7 +6834,7 @@ var MAX_IMPORT_ROWS = 1e4;
|
|
|
6591
6834
|
var getUpdatedErrors = (existingErrors, rowLabel, fieldKey, error) => {
|
|
6592
6835
|
const prefix = `${rowLabel} → ${fieldKey}:`;
|
|
6593
6836
|
const withoutOld = existingErrors.filter((e) => !e.startsWith(prefix));
|
|
6594
|
-
const updatedErrors = error ? [...withoutOld, `${prefix} ${error}`] : withoutOld;
|
|
6837
|
+
const updatedErrors = isString(error) && error ? [...withoutOld, `${prefix} ${error}`] : withoutOld;
|
|
6595
6838
|
return {
|
|
6596
6839
|
updatedErrors,
|
|
6597
6840
|
isValid: updatedErrors.length === 0
|
|
@@ -6624,7 +6867,7 @@ var Table$1 = ({ validationRules, parsedResult, updateState, testId }) => {
|
|
|
6624
6867
|
const errorPrefix = `${`Row ${absoluteIdx + 1}`} → ${key}:`;
|
|
6625
6868
|
const validationError = validator(v);
|
|
6626
6869
|
const persistedError = (_parsedResult$errors$ = parsedResult === null || parsedResult === void 0 || (_parsedResult$errors = parsedResult.errors) === null || _parsedResult$errors === void 0 ? void 0 : _parsedResult$errors.find((e) => e.startsWith(errorPrefix))) !== null && _parsedResult$errors$ !== void 0 ? _parsedResult$errors$ : null;
|
|
6627
|
-
const cellError = validationError || persistedError || null;
|
|
6870
|
+
const cellError = (isString(validationError) ? validationError : null) || persistedError || null;
|
|
6628
6871
|
return {
|
|
6629
6872
|
name: key,
|
|
6630
6873
|
value: v,
|
|
@@ -8080,8 +8323,16 @@ var TableImportExport = ({ config, smartUploadConfig, testId }) => {
|
|
|
8080
8323
|
const t = useTranslationMap(translations);
|
|
8081
8324
|
const resolveExportData = useExportData(t, exportData, beforeExportData);
|
|
8082
8325
|
const [isPending, startTransition] = useTransition();
|
|
8326
|
+
const notifyImported = useContext(TableImportCompleteContext);
|
|
8327
|
+
const completeImport = useCallback((data) => {
|
|
8328
|
+
onImportComplete === null || onImportComplete === void 0 || onImportComplete(data);
|
|
8329
|
+
notifyImported === null || notifyImported === void 0 || notifyImported();
|
|
8330
|
+
}, [onImportComplete, notifyImported]);
|
|
8083
8331
|
const dataImportActions = useDataImportActions({
|
|
8084
|
-
config
|
|
8332
|
+
config: {
|
|
8333
|
+
...config,
|
|
8334
|
+
onImportComplete: completeImport
|
|
8335
|
+
},
|
|
8085
8336
|
state,
|
|
8086
8337
|
setState,
|
|
8087
8338
|
smartUploadConfig,
|
|
@@ -8205,7 +8456,7 @@ var TableImportExport = ({ config, smartUploadConfig, testId }) => {
|
|
|
8205
8456
|
readAndParseInput,
|
|
8206
8457
|
onCloseModal: closeModals,
|
|
8207
8458
|
validationRules,
|
|
8208
|
-
onCompleteImport:
|
|
8459
|
+
onCompleteImport: completeImport,
|
|
8209
8460
|
prevalidationConfig,
|
|
8210
8461
|
t,
|
|
8211
8462
|
loading: isPending,
|
|
@@ -8672,7 +8923,7 @@ var ListRow = forwardRef(({ item, index, expanding, invokeEditOnRowClick, dragga
|
|
|
8672
8923
|
animateLayoutChanges: () => false
|
|
8673
8924
|
});
|
|
8674
8925
|
const style = {
|
|
8675
|
-
transform: CSS.Translate.toString(transform),
|
|
8926
|
+
transform: CSS$1.Translate.toString(transform),
|
|
8676
8927
|
transition,
|
|
8677
8928
|
opacity: isDragging ? 0 : 1
|
|
8678
8929
|
};
|
|
@@ -10178,7 +10429,7 @@ var Link$1 = ({ label, url, icon, onClick, active, disabled, testId, component:
|
|
|
10178
10429
|
};
|
|
10179
10430
|
//#endregion
|
|
10180
10431
|
//#region src/components/top-bar/element/element.tsx
|
|
10181
|
-
var Element = ({ element }) => {
|
|
10432
|
+
var Element$1 = ({ element }) => {
|
|
10182
10433
|
switch (element.type) {
|
|
10183
10434
|
case ElementType.LINK: return /* @__PURE__ */ jsx("div", {
|
|
10184
10435
|
className: top_bar_module_default.item,
|
|
@@ -10249,14 +10500,14 @@ var TopBar = ({ title, appSwitcher, content = [], contentRight = [], warning = "
|
|
|
10249
10500
|
version: title.version,
|
|
10250
10501
|
onClick: title.onClick
|
|
10251
10502
|
}), content.map((element, i) => {
|
|
10252
|
-
if (element) return /* @__PURE__ */ jsx(Element, { element }, i);
|
|
10503
|
+
if (element) return /* @__PURE__ */ jsx(Element$1, { element }, i);
|
|
10253
10504
|
return null;
|
|
10254
10505
|
})]
|
|
10255
10506
|
}),
|
|
10256
10507
|
/* @__PURE__ */ jsx("div", {
|
|
10257
10508
|
className: top_bar_module_default.right,
|
|
10258
10509
|
children: contentRight.map((element, i) => {
|
|
10259
|
-
if (element) return /* @__PURE__ */ jsx(Element, { element }, i);
|
|
10510
|
+
if (element) return /* @__PURE__ */ jsx(Element$1, { element }, i);
|
|
10260
10511
|
return null;
|
|
10261
10512
|
})
|
|
10262
10513
|
})
|