@oliasoft-open-source/react-ui-library 10.8.0-beta-1 → 10.8.0-beta-3
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 +242 -194
- package/dist/index.d.ts +39 -9
- package/dist/index.js +311 -253
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1058,35 +1058,36 @@ var isMenuEmpty = (menu) => {
|
|
|
1058
1058
|
return !isValidElement(sections) && (!Array.isArray(sections) || sections.every((section) => isEmpty(section)));
|
|
1059
1059
|
};
|
|
1060
1060
|
var menu_module_default = {
|
|
1061
|
-
layer: "
|
|
1062
|
-
nested: "
|
|
1063
|
-
fileInput: "
|
|
1064
|
-
trigger: "
|
|
1065
|
-
heading: "
|
|
1066
|
-
headingIcon: "
|
|
1067
|
-
clickable: "
|
|
1068
|
-
option: "
|
|
1069
|
-
active: "
|
|
1070
|
-
disabled: "
|
|
1071
|
-
selected: "
|
|
1072
|
-
optionContent: "
|
|
1073
|
-
description: "
|
|
1074
|
-
inline: "
|
|
1075
|
-
icon: "
|
|
1076
|
-
check: "
|
|
1077
|
-
label: "
|
|
1078
|
-
arrow: "
|
|
1079
|
-
divider: "
|
|
1080
|
-
buttonLabel: "
|
|
1081
|
-
component: "
|
|
1082
|
-
right: "
|
|
1083
|
-
actions: "
|
|
1084
|
-
menuPopover: "
|
|
1085
|
-
menuPopoverNested: "
|
|
1086
|
-
menuItem: "
|
|
1087
|
-
overlayScope: "
|
|
1088
|
-
noResults: "
|
|
1089
|
-
|
|
1061
|
+
layer: "_layer_19h1u_1",
|
|
1062
|
+
nested: "_nested_19h1u_14",
|
|
1063
|
+
fileInput: "_fileInput_19h1u_17",
|
|
1064
|
+
trigger: "_trigger_19h1u_23",
|
|
1065
|
+
heading: "_heading_19h1u_32",
|
|
1066
|
+
headingIcon: "_headingIcon_19h1u_38",
|
|
1067
|
+
clickable: "_clickable_19h1u_45",
|
|
1068
|
+
option: "_option_19h1u_49",
|
|
1069
|
+
active: "_active_19h1u_68",
|
|
1070
|
+
disabled: "_disabled_19h1u_73",
|
|
1071
|
+
selected: "_selected_19h1u_76",
|
|
1072
|
+
optionContent: "_optionContent_19h1u_89",
|
|
1073
|
+
description: "_description_19h1u_93",
|
|
1074
|
+
inline: "_inline_19h1u_97",
|
|
1075
|
+
icon: "_icon_19h1u_102",
|
|
1076
|
+
check: "_check_19h1u_103",
|
|
1077
|
+
label: "_label_19h1u_130",
|
|
1078
|
+
arrow: "_arrow_19h1u_148",
|
|
1079
|
+
divider: "_divider_19h1u_152",
|
|
1080
|
+
buttonLabel: "_buttonLabel_19h1u_160",
|
|
1081
|
+
component: "_component_19h1u_167",
|
|
1082
|
+
right: "_right_19h1u_173",
|
|
1083
|
+
actions: "_actions_19h1u_178",
|
|
1084
|
+
menuPopover: "_menuPopover_19h1u_185",
|
|
1085
|
+
menuPopoverNested: "_menuPopoverNested_19h1u_207",
|
|
1086
|
+
menuItem: "_menuItem_19h1u_210",
|
|
1087
|
+
overlayScope: "_overlayScope_19h1u_229",
|
|
1088
|
+
noResults: "_noResults_19h1u_232",
|
|
1089
|
+
searchField: "_searchField_19h1u_236",
|
|
1090
|
+
searchInput: "_searchInput_19h1u_236"
|
|
1090
1091
|
};
|
|
1091
1092
|
//#endregion
|
|
1092
1093
|
//#region src/components/menu/layer/heading.tsx
|
|
@@ -1183,9 +1184,9 @@ var Option$2 = ({ actions, label, url, onClick, description, icon, selected, clo
|
|
|
1183
1184
|
}),
|
|
1184
1185
|
/* @__PURE__ */ jsxs("div", {
|
|
1185
1186
|
className: menu_module_default.right,
|
|
1186
|
-
children: [
|
|
1187
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1187
1188
|
className: menu_module_default.check,
|
|
1188
|
-
children: /* @__PURE__ */ jsx(Icon, { icon: IconType.CHECK })
|
|
1189
|
+
children: selected && /* @__PURE__ */ jsx(Icon, { icon: IconType.CHECK })
|
|
1189
1190
|
}), !!(actions === null || actions === void 0 ? void 0 : actions.length) && /* @__PURE__ */ jsx("div", {
|
|
1190
1191
|
className: menu_module_default.actions,
|
|
1191
1192
|
onClick: (evt) => evt.stopPropagation(),
|
|
@@ -1210,6 +1211,15 @@ var MenuCarat = /* @__PURE__ */ function(MenuCarat) {
|
|
|
1210
1211
|
MenuCarat["DOWN"] = "down";
|
|
1211
1212
|
return MenuCarat;
|
|
1212
1213
|
}({});
|
|
1214
|
+
/** Menu trigger variants. Extends shared `TriggerType` with Search. */
|
|
1215
|
+
var MenuTriggerType = /* @__PURE__ */ function(MenuTriggerType) {
|
|
1216
|
+
MenuTriggerType["TEXT"] = "Text";
|
|
1217
|
+
MenuTriggerType["BUTTON"] = "Button";
|
|
1218
|
+
MenuTriggerType["DROP_DOWN_BUTTON"] = "DropDownButton";
|
|
1219
|
+
MenuTriggerType["COMPONENT"] = "Component";
|
|
1220
|
+
MenuTriggerType["SEARCH"] = "Search";
|
|
1221
|
+
return MenuTriggerType;
|
|
1222
|
+
}({});
|
|
1213
1223
|
//#endregion
|
|
1214
1224
|
//#region src/components/menu/layer/section.tsx
|
|
1215
1225
|
/** Leaf section types only. Submenus are owned by Layer. */
|
|
@@ -1444,13 +1454,10 @@ var Layer$2 = ({ sections, isNested = false, width, closeOnOptionClick, close, m
|
|
|
1444
1454
|
shouldCloseOnSelect: closeOnOptionClick,
|
|
1445
1455
|
autoFocus: isNested ? void 0 : "first",
|
|
1446
1456
|
"data-testid": testId,
|
|
1447
|
-
renderEmptyState: search ? () => {
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
children: (_search$noResultsText = search.noResultsText) !== null && _search$noResultsText !== void 0 ? _search$noResultsText : "No results"
|
|
1452
|
-
});
|
|
1453
|
-
} : void 0,
|
|
1457
|
+
renderEmptyState: search ? () => /* @__PURE__ */ jsx("div", {
|
|
1458
|
+
className: menu_module_default.noResults,
|
|
1459
|
+
children: "No results"
|
|
1460
|
+
}) : void 0,
|
|
1454
1461
|
children: localSections.map((section, i) => renderSection(section, i, {
|
|
1455
1462
|
closeOnOptionClick: section.closeOnOptionClick,
|
|
1456
1463
|
close,
|
|
@@ -1494,6 +1501,7 @@ var trigger_module_default = {
|
|
|
1494
1501
|
};
|
|
1495
1502
|
//#endregion
|
|
1496
1503
|
//#region src/components/menu/trigger/search-trigger.tsx
|
|
1504
|
+
var hasDisplayValue = (value) => value != null && value !== "";
|
|
1497
1505
|
var groupOrderClass = (groupOrder) => {
|
|
1498
1506
|
switch (groupOrder) {
|
|
1499
1507
|
case GroupOrder.FIRST: return trigger_module_default.groupOrderFirst;
|
|
@@ -1508,7 +1516,7 @@ var groupOrderClass = (groupOrder) => {
|
|
|
1508
1516
|
* Behaviour mirrors the searchable Select: click anywhere toggles, typing / ArrowDown opens,
|
|
1509
1517
|
* Escape / Tab close.
|
|
1510
1518
|
*/
|
|
1511
|
-
var SearchTrigger = forwardRef(({ label, searchValue, isOpen, disabled, small, width, groupOrder, error, warning, tabIndex, testId, inputRef, onOpen, onClose }, ref) => {
|
|
1519
|
+
var SearchTrigger = forwardRef(({ label, placeholder, searchValue, isOpen, disabled, small, width, groupOrder, error, warning, tabIndex, testId, isInTable, inputRef, onOpen, onClose }, ref) => {
|
|
1512
1520
|
const handleMouseDown = (evt) => evt.preventDefault();
|
|
1513
1521
|
const handleClick = () => {
|
|
1514
1522
|
var _inputRef$current;
|
|
@@ -1521,9 +1529,12 @@ var SearchTrigger = forwardRef(({ label, searchValue, isOpen, disabled, small, w
|
|
|
1521
1529
|
if (!isOpen && evt.key === "ArrowDown") onOpen();
|
|
1522
1530
|
if (isOpen && (evt.key === "Escape" || evt.key === "Tab")) onClose();
|
|
1523
1531
|
};
|
|
1532
|
+
const showLabel = !searchValue && hasDisplayValue(label);
|
|
1533
|
+
const showPlaceholder = !searchValue && !showLabel && hasDisplayValue(placeholder);
|
|
1534
|
+
const ariaLabel = typeof label === "string" && label || typeof placeholder === "string" && placeholder || "Search";
|
|
1524
1535
|
return /* @__PURE__ */ jsxs("div", {
|
|
1525
1536
|
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)),
|
|
1537
|
+
className: cx(trigger_module_default.trigger, isOpen && trigger_module_default.isOpen, disabled && trigger_module_default.disabled, small && trigger_module_default.small, isInTable && trigger_module_default.isInTable, groupOrderClass(groupOrder)),
|
|
1527
1538
|
style: { width },
|
|
1528
1539
|
onMouseDown: handleMouseDown,
|
|
1529
1540
|
onClick: handleClick,
|
|
@@ -1531,21 +1542,28 @@ var SearchTrigger = forwardRef(({ label, searchValue, isOpen, disabled, small, w
|
|
|
1531
1542
|
"data-warning": warning || null,
|
|
1532
1543
|
"data-testid": testId,
|
|
1533
1544
|
children: [/* @__PURE__ */ jsxs(SearchField, {
|
|
1534
|
-
"aria-label":
|
|
1545
|
+
"aria-label": ariaLabel,
|
|
1535
1546
|
isDisabled: disabled,
|
|
1536
1547
|
onKeyDown: handleKeyDown,
|
|
1537
|
-
className: trigger_module_default.triggerInputContainer,
|
|
1538
|
-
children: [
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1548
|
+
className: cx(trigger_module_default.triggerInputContainer, menu_module_default.searchField),
|
|
1549
|
+
children: [
|
|
1550
|
+
showLabel && /* @__PURE__ */ jsx("span", {
|
|
1551
|
+
className: trigger_module_default.selectedSingleValue,
|
|
1552
|
+
"data-testid": testId && `${testId}-value`,
|
|
1553
|
+
children: label
|
|
1554
|
+
}),
|
|
1555
|
+
showPlaceholder && /* @__PURE__ */ jsx("span", {
|
|
1556
|
+
className: trigger_module_default.placeHolder,
|
|
1557
|
+
children: placeholder
|
|
1558
|
+
}),
|
|
1559
|
+
/* @__PURE__ */ jsx(Input$1, {
|
|
1560
|
+
ref: inputRef,
|
|
1561
|
+
className: cx(trigger_module_default.input, menu_module_default.searchInput),
|
|
1562
|
+
size: searchValue.length + 1,
|
|
1563
|
+
tabIndex,
|
|
1564
|
+
"data-testid": testId ? `${testId}-input` : void 0
|
|
1565
|
+
})
|
|
1566
|
+
]
|
|
1549
1567
|
}), /* @__PURE__ */ jsx("span", {
|
|
1550
1568
|
className: trigger_module_default.icons,
|
|
1551
1569
|
children: /* @__PURE__ */ jsx(Pressable$1, {
|
|
@@ -1605,7 +1623,7 @@ var Badge = ({ children, color = "", textColor: textColorProp = "", title = null
|
|
|
1605
1623
|
};
|
|
1606
1624
|
//#endregion
|
|
1607
1625
|
//#region src/components/menu/trigger/button.tsx
|
|
1608
|
-
var Button$1 = React.forwardRef(({ trigger, label, colored, small, width, disabled, groupOrder, loading, error, warning, active, tabIndex, testId, ...domProps }, ref) => {
|
|
1626
|
+
var Button$1 = React.forwardRef(({ trigger, label, colored, basic, small, width, disabled, groupOrder, loading, error, warning, active, tabIndex, testId, ...domProps }, ref) => {
|
|
1609
1627
|
const disabledContext = useContext(DisabledContext);
|
|
1610
1628
|
const isDropdown = trigger === TriggerType.DROP_DOWN_BUTTON;
|
|
1611
1629
|
return /* @__PURE__ */ jsx(Button, {
|
|
@@ -1615,6 +1633,7 @@ var Button$1 = React.forwardRef(({ trigger, label, colored, small, width, disabl
|
|
|
1615
1633
|
children: label
|
|
1616
1634
|
}),
|
|
1617
1635
|
colored,
|
|
1636
|
+
basic,
|
|
1618
1637
|
small,
|
|
1619
1638
|
width,
|
|
1620
1639
|
groupOrder,
|
|
@@ -1697,7 +1716,7 @@ var withBadge = (children, { isNested, badgeTitle, badgeDot }) => !isNested && (
|
|
|
1697
1716
|
* Renders the menu trigger control only (Button / Text / Component).
|
|
1698
1717
|
* OverlayTriggerChild owns the Pressable host — do not wrap a focus shell here.
|
|
1699
1718
|
*/
|
|
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) => {
|
|
1719
|
+
var Trigger$1 = React.forwardRef(({ active, disabled, loading, width, trigger, label, title, colored, basic, small, isNested, component, groupOrder, isOpen, error, warning, testId, selected, tabIndex, ...domProps }, ref) => {
|
|
1701
1720
|
const isButtonTrigger = trigger === TriggerType.BUTTON || trigger === TriggerType.DROP_DOWN_BUTTON;
|
|
1702
1721
|
const isComponentTrigger = trigger === TriggerType.COMPONENT;
|
|
1703
1722
|
if (isButtonTrigger) return /* @__PURE__ */ jsx(Button$1, {
|
|
@@ -1705,6 +1724,7 @@ var Trigger$1 = React.forwardRef(({ active, disabled, loading, width, trigger, l
|
|
|
1705
1724
|
trigger,
|
|
1706
1725
|
label: label !== null && label !== void 0 ? label : "",
|
|
1707
1726
|
colored,
|
|
1727
|
+
basic,
|
|
1708
1728
|
small,
|
|
1709
1729
|
width,
|
|
1710
1730
|
disabled,
|
|
@@ -1741,7 +1761,7 @@ var Trigger$1 = React.forwardRef(({ active, disabled, loading, width, trigger, l
|
|
|
1741
1761
|
});
|
|
1742
1762
|
//#endregion
|
|
1743
1763
|
//#region src/components/menu/menu.tsx
|
|
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,
|
|
1764
|
+
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, isInTable = false }) => {
|
|
1745
1765
|
const disabledContext = useContext(DisabledContext);
|
|
1746
1766
|
const triggerRef = useRef(null);
|
|
1747
1767
|
const [internalOpen, setInternalOpen] = useState(false);
|
|
@@ -1749,11 +1769,11 @@ var Menu = ({ menu, width, disabled = false, badgeTitle, badgeDot = false, loadi
|
|
|
1749
1769
|
const scopeId = useId();
|
|
1750
1770
|
const searchTriggerRef = useRef(null);
|
|
1751
1771
|
const searchInputRef = useRef(null);
|
|
1752
|
-
const { label, title, trigger, colored, small, sections, component, placement, showAllButton } = menu;
|
|
1772
|
+
const { label, title, trigger, colored, basic, small, sections, component, placement, showAllButton, placeholder } = menu;
|
|
1753
1773
|
const isControlled = isBoolean(openProp) && isFunction(setOpenProp);
|
|
1754
1774
|
const isOpen = isControlled ? openProp : internalOpen;
|
|
1755
1775
|
const isDisabled = disabled || isMenuEmpty(menu) || disabledContext;
|
|
1756
|
-
const isSearchable =
|
|
1776
|
+
const isSearchable = trigger === MenuTriggerType.SEARCH && !isValidElement(sections);
|
|
1757
1777
|
/** Input trigger, or any popover (root / submenu) belonging to this menu. */
|
|
1758
1778
|
const isInSearchScope = (el) => {
|
|
1759
1779
|
var _searchTriggerRef$cur;
|
|
@@ -1825,6 +1845,7 @@ var Menu = ({ menu, width, disabled = false, badgeTitle, badgeDot = false, loadi
|
|
|
1825
1845
|
label,
|
|
1826
1846
|
title,
|
|
1827
1847
|
colored,
|
|
1848
|
+
basic,
|
|
1828
1849
|
small,
|
|
1829
1850
|
component,
|
|
1830
1851
|
groupOrder,
|
|
@@ -1843,10 +1864,7 @@ var Menu = ({ menu, width, disabled = false, badgeTitle, badgeDot = false, loadi
|
|
|
1843
1864
|
maxHeight,
|
|
1844
1865
|
showAllButton,
|
|
1845
1866
|
testId: layerTestId,
|
|
1846
|
-
search: isSearchable ? {
|
|
1847
|
-
value: searchValue,
|
|
1848
|
-
noResultsText: searchNoResultsText
|
|
1849
|
-
} : void 0,
|
|
1867
|
+
search: isSearchable ? { value: searchValue } : void 0,
|
|
1850
1868
|
scopeId: isSearchable ? scopeId : void 0
|
|
1851
1869
|
});
|
|
1852
1870
|
if (isSearchable) return /* @__PURE__ */ jsx(MenuTrigger, {
|
|
@@ -1863,6 +1881,7 @@ var Menu = ({ menu, width, disabled = false, badgeTitle, badgeDot = false, loadi
|
|
|
1863
1881
|
ref: searchTriggerRef,
|
|
1864
1882
|
inputRef: searchInputRef,
|
|
1865
1883
|
label,
|
|
1884
|
+
placeholder,
|
|
1866
1885
|
searchValue,
|
|
1867
1886
|
isOpen,
|
|
1868
1887
|
disabled: isDisabled,
|
|
@@ -1873,6 +1892,7 @@ var Menu = ({ menu, width, disabled = false, badgeTitle, badgeDot = false, loadi
|
|
|
1873
1892
|
warning,
|
|
1874
1893
|
tabIndex,
|
|
1875
1894
|
testId,
|
|
1895
|
+
isInTable,
|
|
1876
1896
|
onOpen: () => handleOpenChange(true),
|
|
1877
1897
|
onClose: close
|
|
1878
1898
|
}), {
|
|
@@ -3025,28 +3045,53 @@ var InputGroup = ({ children, small = false, width = "100%", isInTable: isInTabl
|
|
|
3025
3045
|
})
|
|
3026
3046
|
});
|
|
3027
3047
|
};
|
|
3048
|
+
//#endregion
|
|
3049
|
+
//#region src/hooks/use-element-width.ts
|
|
3050
|
+
var useElementWidth = (enabled = true) => {
|
|
3051
|
+
const [element, setElement] = useState(null);
|
|
3052
|
+
const [width, setWidth] = useState(null);
|
|
3053
|
+
const ref = useCallback((node) => {
|
|
3054
|
+
setElement(node);
|
|
3055
|
+
}, []);
|
|
3056
|
+
useLayoutEffect(() => {
|
|
3057
|
+
if (!enabled || !element) {
|
|
3058
|
+
setWidth(null);
|
|
3059
|
+
return;
|
|
3060
|
+
}
|
|
3061
|
+
const measure = () => setWidth(element.getBoundingClientRect().width);
|
|
3062
|
+
measure();
|
|
3063
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
3064
|
+
const observer = new ResizeObserver(measure);
|
|
3065
|
+
observer.observe(element);
|
|
3066
|
+
return () => observer.disconnect();
|
|
3067
|
+
}, [enabled, element]);
|
|
3068
|
+
return [ref, width];
|
|
3069
|
+
};
|
|
3028
3070
|
var input_module_default = {
|
|
3029
|
-
inputInTable: "
|
|
3030
|
-
inputHover: "
|
|
3031
|
-
inputFocus: "
|
|
3032
|
-
controlFocusVisible: "
|
|
3033
|
-
inputError: "
|
|
3034
|
-
inputWarning: "
|
|
3035
|
-
inputDisabled: "
|
|
3036
|
-
hideScrollbars: "
|
|
3037
|
-
wrapper: "
|
|
3038
|
-
input: "
|
|
3039
|
-
isInTable: "
|
|
3040
|
-
small: "
|
|
3041
|
-
right: "
|
|
3042
|
-
groupOrderFirst: "
|
|
3043
|
-
groupOrderMiddle: "
|
|
3044
|
-
groupOrderLast: "
|
|
3045
|
-
|
|
3071
|
+
inputInTable: "_inputInTable_1w4lm_1",
|
|
3072
|
+
inputHover: "_inputHover_1w4lm_13",
|
|
3073
|
+
inputFocus: "_inputFocus_1w4lm_18",
|
|
3074
|
+
controlFocusVisible: "_controlFocusVisible_1w4lm_25",
|
|
3075
|
+
inputError: "_inputError_1w4lm_29",
|
|
3076
|
+
inputWarning: "_inputWarning_1w4lm_30",
|
|
3077
|
+
inputDisabled: "_inputDisabled_1w4lm_65",
|
|
3078
|
+
hideScrollbars: "_hideScrollbars_1w4lm_71",
|
|
3079
|
+
wrapper: "_wrapper_1w4lm_81",
|
|
3080
|
+
input: "_input_1w4lm_1",
|
|
3081
|
+
isInTable: "_isInTable_1w4lm_107",
|
|
3082
|
+
small: "_small_1w4lm_131",
|
|
3083
|
+
right: "_right_1w4lm_177",
|
|
3084
|
+
groupOrderFirst: "_groupOrderFirst_1w4lm_180",
|
|
3085
|
+
groupOrderMiddle: "_groupOrderMiddle_1w4lm_181",
|
|
3086
|
+
groupOrderLast: "_groupOrderLast_1w4lm_185",
|
|
3087
|
+
slot: "_slot_1w4lm_190",
|
|
3088
|
+
slotLeft: "_slotLeft_1w4lm_207",
|
|
3089
|
+
slotRight: "_slotRight_1w4lm_212",
|
|
3090
|
+
icon: "_icon_1w4lm_225"
|
|
3046
3091
|
};
|
|
3047
3092
|
//#endregion
|
|
3048
3093
|
//#region src/components/input/input.tsx
|
|
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) => {
|
|
3094
|
+
var Input = forwardRef(({ error = null, tooltip = null, isInTable: isInTableProp, width: propWidth = void 0, small = false, onChange = noop, placeholder = "", value = "", icon, leftSlot, rightSlot, 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) => {
|
|
3050
3095
|
const disabledContext = useContext(DisabledContext);
|
|
3051
3096
|
const isInTable = useIsInTable(isInTableProp);
|
|
3052
3097
|
const order = (() => {
|
|
@@ -3058,48 +3103,67 @@ var Input = forwardRef(({ error = null, tooltip = null, isInTable: isInTableProp
|
|
|
3058
3103
|
return "";
|
|
3059
3104
|
})();
|
|
3060
3105
|
const width = propWidth || (size ? "auto" : "100%");
|
|
3106
|
+
const leftContent = icon ? /* @__PURE__ */ jsx("span", {
|
|
3107
|
+
className: input_module_default.icon,
|
|
3108
|
+
children: /* @__PURE__ */ jsx(Icon, { icon })
|
|
3109
|
+
}) : leftSlot;
|
|
3110
|
+
const [leftSlotRef, leftSlotWidth] = useElementWidth(!!leftContent);
|
|
3111
|
+
const [rightSlotRef, rightSlotWidth] = useElementWidth(!!rightSlot);
|
|
3061
3112
|
const handleFocus = (e) => {
|
|
3062
3113
|
onFocus(e);
|
|
3063
3114
|
if (selectOnFocus) setTimeout(() => {
|
|
3064
3115
|
if (e.target === document.activeElement) e.target.select();
|
|
3065
3116
|
}, 0);
|
|
3066
3117
|
};
|
|
3067
|
-
return /* @__PURE__ */
|
|
3118
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3068
3119
|
style: { width },
|
|
3069
3120
|
className: cx(order, input_module_default.wrapper),
|
|
3070
|
-
children:
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3121
|
+
children: [
|
|
3122
|
+
leftContent && /* @__PURE__ */ jsx("div", {
|
|
3123
|
+
ref: leftSlotRef,
|
|
3124
|
+
className: cx(input_module_default.slot, input_module_default.slotLeft),
|
|
3125
|
+
children: leftContent
|
|
3126
|
+
}),
|
|
3127
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
3128
|
+
error: !!error,
|
|
3129
|
+
warning: !!warning,
|
|
3130
|
+
text: tooltip || error || warning,
|
|
3131
|
+
enabled: tooltip && isStringNumberOrNode(tooltip) || error && isStringNumberOrNode(error) || warning && isStringNumberOrNode(warning) || false,
|
|
3132
|
+
maxWidth: maxTooltipWidth,
|
|
3133
|
+
display: "block",
|
|
3134
|
+
children: /* @__PURE__ */ jsx("input", {
|
|
3135
|
+
ref,
|
|
3136
|
+
type: type || "text",
|
|
3137
|
+
size: size || 20,
|
|
3138
|
+
placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : "",
|
|
3139
|
+
value: value !== null && value !== void 0 ? value : "",
|
|
3140
|
+
onChange,
|
|
3141
|
+
onKeyPress,
|
|
3142
|
+
onKeyDown,
|
|
3143
|
+
onFocus: handleFocus,
|
|
3144
|
+
onBlur,
|
|
3145
|
+
onPaste,
|
|
3146
|
+
name,
|
|
3147
|
+
tabIndex,
|
|
3148
|
+
autoComplete: "off",
|
|
3149
|
+
disabled: disabled || disabledContext,
|
|
3150
|
+
className: cx(input_module_default.input, right ? input_module_default.right : "", small ? input_module_default.small : "", isInTable ? input_module_default.isInTable : ""),
|
|
3151
|
+
style: {
|
|
3152
|
+
width,
|
|
3153
|
+
...leftSlotWidth ? { paddingLeft: leftSlotWidth } : null,
|
|
3154
|
+
...rightSlotWidth ? { paddingRight: rightSlotWidth } : null
|
|
3155
|
+
},
|
|
3156
|
+
"data-error": error || null,
|
|
3157
|
+
"data-warning": warning || null,
|
|
3158
|
+
"data-testid": testId
|
|
3159
|
+
})
|
|
3160
|
+
}),
|
|
3161
|
+
rightSlot && /* @__PURE__ */ jsx("div", {
|
|
3162
|
+
ref: rightSlotRef,
|
|
3163
|
+
className: cx(input_module_default.slot, input_module_default.slotRight),
|
|
3164
|
+
children: rightSlot
|
|
3165
|
+
})
|
|
3166
|
+
]
|
|
3103
3167
|
});
|
|
3104
3168
|
});
|
|
3105
3169
|
var file_input_module_default = { fileInput: "_fileInput_1elar_1" };
|
|
@@ -4797,16 +4861,17 @@ var validateSelectedPage = (selectedPage, numPages, errorMessageTemplate = "Sele
|
|
|
4797
4861
|
};
|
|
4798
4862
|
var pagination_module_default = { paginationContainer: "_paginationContainer_1tmz4_1" };
|
|
4799
4863
|
var input_group_addon_module_default = {
|
|
4800
|
-
addon: "
|
|
4801
|
-
small: "
|
|
4802
|
-
groupOrderFirst: "
|
|
4803
|
-
groupOrderMiddle: "
|
|
4804
|
-
groupOrderLast: "
|
|
4805
|
-
isInTable: "
|
|
4864
|
+
addon: "_addon_4fbro_1",
|
|
4865
|
+
small: "_small_4fbro_12",
|
|
4866
|
+
groupOrderFirst: "_groupOrderFirst_4fbro_16",
|
|
4867
|
+
groupOrderMiddle: "_groupOrderMiddle_4fbro_17",
|
|
4868
|
+
groupOrderLast: "_groupOrderLast_4fbro_21",
|
|
4869
|
+
isInTable: "_isInTable_4fbro_26",
|
|
4870
|
+
borderless: "_borderless_4fbro_38"
|
|
4806
4871
|
};
|
|
4807
4872
|
//#endregion
|
|
4808
4873
|
//#region src/components/input-group/input-group-addon/input-group-addon.tsx
|
|
4809
|
-
var InputGroupAddon = ({ children, groupOrder, small = false }) => {
|
|
4874
|
+
var InputGroupAddon = ({ children, groupOrder, small = false, borderless = false }) => {
|
|
4810
4875
|
const isInTable = useIsInTable();
|
|
4811
4876
|
const order = (() => {
|
|
4812
4877
|
if (groupOrder) switch (groupOrder) {
|
|
@@ -4817,7 +4882,7 @@ var InputGroupAddon = ({ children, groupOrder, small = false }) => {
|
|
|
4817
4882
|
return "";
|
|
4818
4883
|
})();
|
|
4819
4884
|
return /* @__PURE__ */ jsx("span", {
|
|
4820
|
-
className: cx(input_group_addon_module_default.addon, order, small ? input_group_addon_module_default.small : "", isInTable && input_group_addon_module_default.isInTable),
|
|
4885
|
+
className: cx(input_group_addon_module_default.addon, order, small ? input_group_addon_module_default.small : "", isInTable && input_group_addon_module_default.isInTable, borderless && input_group_addon_module_default.borderless),
|
|
4821
4886
|
children
|
|
4822
4887
|
});
|
|
4823
4888
|
};
|
|
@@ -5006,37 +5071,37 @@ var getHeaderAlignment = (alignments, isHeader = false, rowIndex = 0) => {
|
|
|
5006
5071
|
}
|
|
5007
5072
|
};
|
|
5008
5073
|
var cell_module_default = {
|
|
5009
|
-
inputInTable: "
|
|
5010
|
-
inputHover: "
|
|
5011
|
-
inputFocus: "
|
|
5012
|
-
controlFocusVisible: "
|
|
5013
|
-
inputError: "
|
|
5014
|
-
inputWarning: "
|
|
5015
|
-
inputDisabled: "
|
|
5016
|
-
hideScrollbars: "
|
|
5017
|
-
cell: "
|
|
5018
|
-
disabledLink: "
|
|
5019
|
-
inputWrapper: "
|
|
5020
|
-
numberInputWrapper: "
|
|
5021
|
-
unitInputWrapper: "
|
|
5022
|
-
breakWord: "
|
|
5023
|
-
inputCell: "
|
|
5024
|
-
sliderCell: "
|
|
5025
|
-
staticCell: "
|
|
5026
|
-
staticCellContent: "
|
|
5027
|
-
unit: "
|
|
5028
|
-
sortingCell: "
|
|
5029
|
-
sortingCellIcon: "
|
|
5030
|
-
icon: "
|
|
5031
|
-
checkBoxCell: "
|
|
5032
|
-
iconCellWrapper: "
|
|
5033
|
-
actionsCell: "
|
|
5034
|
-
rightAligned: "
|
|
5035
|
-
centerAligned: "
|
|
5036
|
-
leftAligned: "
|
|
5037
|
-
popover: "
|
|
5038
|
-
disabledPointerEvents: "
|
|
5039
|
-
standaloneCheckbox: "
|
|
5074
|
+
inputInTable: "_inputInTable_1vfnu_1",
|
|
5075
|
+
inputHover: "_inputHover_1vfnu_13",
|
|
5076
|
+
inputFocus: "_inputFocus_1vfnu_18",
|
|
5077
|
+
controlFocusVisible: "_controlFocusVisible_1vfnu_25",
|
|
5078
|
+
inputError: "_inputError_1vfnu_29",
|
|
5079
|
+
inputWarning: "_inputWarning_1vfnu_30",
|
|
5080
|
+
inputDisabled: "_inputDisabled_1vfnu_65",
|
|
5081
|
+
hideScrollbars: "_hideScrollbars_1vfnu_71",
|
|
5082
|
+
cell: "_cell_1vfnu_81",
|
|
5083
|
+
disabledLink: "_disabledLink_1vfnu_91",
|
|
5084
|
+
inputWrapper: "_inputWrapper_1vfnu_95",
|
|
5085
|
+
numberInputWrapper: "_numberInputWrapper_1vfnu_110",
|
|
5086
|
+
unitInputWrapper: "_unitInputWrapper_1vfnu_117",
|
|
5087
|
+
breakWord: "_breakWord_1vfnu_123",
|
|
5088
|
+
inputCell: "_inputCell_1vfnu_126",
|
|
5089
|
+
sliderCell: "_sliderCell_1vfnu_129",
|
|
5090
|
+
staticCell: "_staticCell_1vfnu_133",
|
|
5091
|
+
staticCellContent: "_staticCellContent_1vfnu_136",
|
|
5092
|
+
unit: "_unit_1vfnu_117",
|
|
5093
|
+
sortingCell: "_sortingCell_1vfnu_160",
|
|
5094
|
+
sortingCellIcon: "_sortingCellIcon_1vfnu_171",
|
|
5095
|
+
icon: "_icon_1vfnu_182",
|
|
5096
|
+
checkBoxCell: "_checkBoxCell_1vfnu_186",
|
|
5097
|
+
iconCellWrapper: "_iconCellWrapper_1vfnu_190",
|
|
5098
|
+
actionsCell: "_actionsCell_1vfnu_194",
|
|
5099
|
+
rightAligned: "_rightAligned_1vfnu_202",
|
|
5100
|
+
centerAligned: "_centerAligned_1vfnu_208",
|
|
5101
|
+
leftAligned: "_leftAligned_1vfnu_214",
|
|
5102
|
+
popover: "_popover_1vfnu_217",
|
|
5103
|
+
disabledPointerEvents: "_disabledPointerEvents_1vfnu_220",
|
|
5104
|
+
standaloneCheckbox: "_standaloneCheckbox_1vfnu_223"
|
|
5040
5105
|
};
|
|
5041
5106
|
//#endregion
|
|
5042
5107
|
//#region src/components/table/cell/cell-types/input-cell.tsx
|
|
@@ -5082,7 +5147,7 @@ var startsWithDecimal = (value) => value.startsWith(".");
|
|
|
5082
5147
|
* undoing deletion of the leading zero when editing values like 0.1 → 1.1.
|
|
5083
5148
|
*/
|
|
5084
5149
|
var preserveLeadingDecimalDraft = (rawInput, cleaned) => startsWithDecimal(rawInput) && cleaned === `0${rawInput}` ? rawInput : cleaned;
|
|
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 }) => {
|
|
5150
|
+
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, leftSlot, rightSlot }) => {
|
|
5086
5151
|
const validateInputValue = (value) => {
|
|
5087
5152
|
const validation = validateNumber(value);
|
|
5088
5153
|
const isPlaceholder = placeholder && isEmptyNullOrUndefined(value);
|
|
@@ -5194,7 +5259,9 @@ var NumberInput = ({ name, placeholder = "", disabled = false, error = false, le
|
|
|
5194
5259
|
selectOnFocus,
|
|
5195
5260
|
tabIndex,
|
|
5196
5261
|
tooltip,
|
|
5197
|
-
ref: inputRef
|
|
5262
|
+
ref: inputRef,
|
|
5263
|
+
leftSlot,
|
|
5264
|
+
rightSlot
|
|
5198
5265
|
}, stringName);
|
|
5199
5266
|
};
|
|
5200
5267
|
//#endregion
|
|
@@ -5413,9 +5480,11 @@ var safeRoundNumbers = (value) => {
|
|
|
5413
5480
|
return !isScientificStringNum(value) ? roundByMagnitude(value) : value;
|
|
5414
5481
|
};
|
|
5415
5482
|
var unit_input_module_default = {
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5483
|
+
unitInput: "_unitInput_1ogvr_1",
|
|
5484
|
+
unitTriggerLabel: "_unitTriggerLabel_1ogvr_5",
|
|
5485
|
+
unitValue: "_unitValue_1ogvr_8",
|
|
5486
|
+
predefinedMenuActive: "_predefinedMenuActive_1ogvr_13",
|
|
5487
|
+
isInTable: "_isInTable_1ogvr_16"
|
|
5419
5488
|
};
|
|
5420
5489
|
//#endregion
|
|
5421
5490
|
//#region src/components/unit-input/unit-input.tsx
|
|
@@ -5598,10 +5667,7 @@ var UnitInput = ({ name, placeholder = "", disabled = false, disabledUnit = fals
|
|
|
5598
5667
|
} });
|
|
5599
5668
|
}
|
|
5600
5669
|
},
|
|
5601
|
-
label:
|
|
5602
|
-
width: "20px",
|
|
5603
|
-
height: "0"
|
|
5604
|
-
})] }),
|
|
5670
|
+
label: el.label,
|
|
5605
5671
|
description,
|
|
5606
5672
|
selected: foundPredefinedMenuOption === el && predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED
|
|
5607
5673
|
};
|
|
@@ -5636,100 +5702,92 @@ var UnitInput = ({ name, placeholder = "", disabled = false, disabledUnit = fals
|
|
|
5636
5702
|
}
|
|
5637
5703
|
return placeholder;
|
|
5638
5704
|
};
|
|
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;
|
|
5648
5705
|
return /* @__PURE__ */ jsx("div", {
|
|
5649
|
-
className: cx(predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED && unit_input_module_default.predefinedMenuActive, isInTable && unit_input_module_default.isInTable),
|
|
5650
|
-
|
|
5706
|
+
className: cx(unit_input_module_default.unitInput, predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED && unit_input_module_default.predefinedMenuActive, isInTable && unit_input_module_default.isInTable),
|
|
5707
|
+
style: { width },
|
|
5708
|
+
children: /* @__PURE__ */ jsx(NumberInput, {
|
|
5709
|
+
name: stringName,
|
|
5710
|
+
testId,
|
|
5711
|
+
disabled,
|
|
5712
|
+
placeholder: getPlaceholder(placeholder),
|
|
5713
|
+
value: displayLayer.value,
|
|
5714
|
+
onChange: onSetValue,
|
|
5715
|
+
onFocus,
|
|
5716
|
+
error: error === null ? void 0 : error,
|
|
5717
|
+
warning: warning === null ? void 0 : warning,
|
|
5718
|
+
left,
|
|
5719
|
+
allowEmpty: derivedAllowEmpty,
|
|
5720
|
+
validationCallback: (_name, error) => validationCallback(stringName, error),
|
|
5721
|
+
enableCosmeticRounding,
|
|
5722
|
+
enableDisplayRounding,
|
|
5723
|
+
roundDisplayValue,
|
|
5724
|
+
groupOrder,
|
|
5725
|
+
disableInternalErrorValidationMessages,
|
|
5651
5726
|
small,
|
|
5652
|
-
width,
|
|
5727
|
+
width: "100%",
|
|
5653
5728
|
isInTable,
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
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,
|
|
5729
|
+
selectOnFocus,
|
|
5730
|
+
tooltip,
|
|
5731
|
+
leftSlot: predefinedOptions && /* @__PURE__ */ jsx(Menu, {
|
|
5732
|
+
maxHeight: 380,
|
|
5733
|
+
testId: testId && `${testId}-predefined-menu`,
|
|
5734
|
+
disabled,
|
|
5735
|
+
menu: {
|
|
5736
|
+
trigger: "Component",
|
|
5737
|
+
component: /* @__PURE__ */ jsx(Button, {
|
|
5738
|
+
basic: true,
|
|
5739
|
+
colored: Color.MUTED,
|
|
5740
|
+
active: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED,
|
|
5741
|
+
icon: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? "link" : "unlink",
|
|
5742
|
+
small
|
|
5743
|
+
}),
|
|
5701
5744
|
small,
|
|
5702
|
-
|
|
5703
|
-
}
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5745
|
+
sections: sectionsPredefinedMenu
|
|
5746
|
+
},
|
|
5747
|
+
tooltip: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? foundPredefinedMenuOption === null || foundPredefinedMenuOption === void 0 ? void 0 : foundPredefinedMenuOption.label : ""
|
|
5748
|
+
}),
|
|
5749
|
+
rightSlot: displayUnitLabel && (noConvert || !knownUnit ? /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
5750
|
+
borderless: true,
|
|
5751
|
+
small,
|
|
5752
|
+
children: displayUnitLabel
|
|
5753
|
+
}) : /* @__PURE__ */ jsx(Menu, {
|
|
5754
|
+
maxHeight: 380,
|
|
5755
|
+
disabled: disabledUnit,
|
|
5756
|
+
testId: testId && `${testId}-menu`,
|
|
5757
|
+
tabIndex: -1,
|
|
5758
|
+
menu: {
|
|
5759
|
+
trigger: TriggerType.DROP_DOWN_BUTTON,
|
|
5760
|
+
label: /* @__PURE__ */ jsx("span", {
|
|
5761
|
+
className: unit_input_module_default.unitTriggerLabel,
|
|
5762
|
+
children: displayUnitLabel
|
|
5763
|
+
}),
|
|
5764
|
+
colored: Color.MUTED,
|
|
5765
|
+
basic: true,
|
|
5766
|
+
placement: "bottom-end",
|
|
5767
|
+
small,
|
|
5768
|
+
sections: alternativeUnits.map(([value = "", altUnit = "", label]) => {
|
|
5769
|
+
const displayUnit = label || altUnit || "";
|
|
5770
|
+
const safeValue = isValidNum(value) ? value : "";
|
|
5771
|
+
const displayValue = enableCosmeticRounding ? safeRoundNumbers(safeValue) : safeValue;
|
|
5772
|
+
return {
|
|
5773
|
+
type: "Option",
|
|
5774
|
+
label: /* @__PURE__ */ jsx("span", {
|
|
5775
|
+
className: unit_input_module_default.unitValue,
|
|
5776
|
+
children: displayValue
|
|
5777
|
+
}),
|
|
5778
|
+
inline: true,
|
|
5779
|
+
onClick: (evt) => {
|
|
5780
|
+
evt.stopPropagation();
|
|
5781
|
+
onClickUnit(value, altUnit);
|
|
5782
|
+
},
|
|
5783
|
+
description: displayUnit,
|
|
5784
|
+
selected: displayUnit === displayUnitLabel,
|
|
5785
|
+
testId: `${testId}-unit-${displayUnit}`
|
|
5786
|
+
};
|
|
5787
|
+
})
|
|
5788
|
+
}
|
|
5789
|
+
}))
|
|
5790
|
+
}, stringName)
|
|
5733
5791
|
});
|
|
5734
5792
|
};
|
|
5735
5793
|
//#endregion
|
|
@@ -14835,4 +14893,4 @@ var initializeGuiLibrary = (config) => {
|
|
|
14835
14893
|
});
|
|
14836
14894
|
};
|
|
14837
14895
|
//#endregion
|
|
14838
|
-
export { Accordion, AccordionWithDefaultToggle, Actions, Align, AuditLog, Badge, Breadcrumb, BreadcrumbLinkType, Button, ButtonGroup, ButtonPosition, ButtonType, Card, CheckBox, Chevron, Collapse, Color, ColorInput, ColorInputPopover, Column, Dialog, DiffCode, DiffTable, DiffViewer, DisabledContext, Divider, Drawer, ElementType, Empty, ErrorBoundary, Field, FileButton, FileInput, Flex, FormRow, Grid, GroupOrder, Heading, HelpIcon, Icon, IconType, Input, InputGroup, InputGroupAddon, InputReaderMethods, InputType, Label, List, ListHeading, ListSubheading, Loader, Mention, Menu, MenuCarat, MenuType, Message, MessageType, Modal, NativeSelect, NumberInput, OptionDropdown, Page, Pagination, PopConfirm, Popover, Portal, PrintHeader, ProgressBar, RadioButton, Resizable, RichTextInput, Row, Select, SettingField, SideBar, Skeleton, Slider, SmartUploadModal, Spacer, Spinner, Table, TableImportExport, Tabs, Text, TextArea, TextLink, TextTransform, Theme, Toaster, Toggle, Tooltip, TopBar, Tree, TreeTable, TriggerType, UnitInput, UnitSlider, UnitTable, UsageTracker, dismissToast, initializeContext, initializeGuiLibrary, readFile, toast, useFocus, useKeyboardEvent, useWindowWidth, withChainableErrorBoundary, withErrorBoundary };
|
|
14896
|
+
export { Accordion, AccordionWithDefaultToggle, Actions, Align, AuditLog, Badge, Breadcrumb, BreadcrumbLinkType, Button, ButtonGroup, ButtonPosition, ButtonType, Card, CheckBox, Chevron, Collapse, Color, ColorInput, ColorInputPopover, Column, Dialog, DiffCode, DiffTable, DiffViewer, DisabledContext, Divider, Drawer, ElementType, Empty, ErrorBoundary, Field, FileButton, FileInput, Flex, FormRow, Grid, GroupOrder, Heading, HelpIcon, Icon, IconType, Input, InputGroup, InputGroupAddon, InputReaderMethods, InputType, Label, List, ListHeading, ListSubheading, Loader, Mention, Menu, MenuCarat, MenuTriggerType, MenuType, Message, MessageType, Modal, NativeSelect, NumberInput, OptionDropdown, Page, Pagination, PopConfirm, Popover, Portal, PrintHeader, ProgressBar, RadioButton, Resizable, RichTextInput, Row, Select, SettingField, SideBar, Skeleton, Slider, SmartUploadModal, Spacer, Spinner, Table, TableImportExport, Tabs, Text, TextArea, TextLink, TextTransform, Theme, Toaster, Toggle, Tooltip, TopBar, Tree, TreeTable, TriggerType, UnitInput, UnitSlider, UnitTable, UsageTracker, dismissToast, initializeContext, initializeGuiLibrary, readFile, toast, useFocus, useKeyboardEvent, useWindowWidth, withChainableErrorBoundary, withErrorBoundary };
|