@oliasoft-open-source/react-ui-library 10.6.1 → 10.7.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/index.js CHANGED
@@ -979,7 +979,7 @@ var ButtonTooltipWrapper = ({ children, tooltip = null }) => {
979
979
  children
980
980
  });
981
981
  };
982
- var Button = React.forwardRef(({ active = false, basic = false, colored = false, disabled = false, ignoreDisabledContext = false, groupOrder, icon = null, rightIcon = null, label = "", loading = false, name, pill = false, round = false, small = false, styles = "", width = "", title = "", type = ButtonType.BUTTON, onClick = () => {}, error, warning, testId, tooltip, inverted = false, component: Component = "button", url, tabIndex, ...domProps }, ref) => {
982
+ var Button = React.forwardRef(({ active = false, basic = false, colored = false, disabled = false, ignoreDisabledContext = false, groupOrder, icon = null, rightIcon = null, label = "", loading = false, name, pill = false, round = false, small = false, styles = "", width = "", fontWeight, title = "", type = ButtonType.BUTTON, onClick = () => {}, error, warning, testId, tooltip, inverted = false, component: Component = "button", url, tabIndex, ...domProps }, ref) => {
983
983
  const disabledContext = useContext(DisabledContext);
984
984
  const isInTable = useIsInTable();
985
985
  const color = (() => {
@@ -1012,7 +1012,10 @@ var Button = React.forwardRef(({ active = false, basic = false, colored = false,
1012
1012
  name: name !== null && name !== void 0 ? name : "",
1013
1013
  onClick,
1014
1014
  ...title ? { title } : {},
1015
- style: { width },
1015
+ style: {
1016
+ width,
1017
+ fontWeight
1018
+ },
1016
1019
  "data-error": error || null,
1017
1020
  "data-warning": warning || null,
1018
1021
  "data-testid": testId,
@@ -1056,32 +1059,33 @@ var isMenuEmpty = (menu) => {
1056
1059
  return !isValidElement(sections) && (!Array.isArray(sections) || sections.every((section) => isEmpty(section)));
1057
1060
  };
1058
1061
  var menu_module_default = {
1059
- layer: "_layer_15mfd_1",
1060
- nested: "_nested_15mfd_14",
1061
- fileInput: "_fileInput_15mfd_17",
1062
- trigger: "_trigger_15mfd_23",
1063
- heading: "_heading_15mfd_32",
1064
- headingIcon: "_headingIcon_15mfd_38",
1065
- clickable: "_clickable_15mfd_45",
1066
- option: "_option_15mfd_49",
1067
- active: "_active_15mfd_68",
1068
- disabled: "_disabled_15mfd_73",
1069
- selected: "_selected_15mfd_76",
1070
- optionContent: "_optionContent_15mfd_83",
1071
- description: "_description_15mfd_87",
1072
- inline: "_inline_15mfd_91",
1073
- icon: "_icon_15mfd_96",
1074
- check: "_check_15mfd_97",
1075
- label: "_label_15mfd_123",
1076
- arrow: "_arrow_15mfd_139",
1077
- divider: "_divider_15mfd_143",
1078
- buttonLabel: "_buttonLabel_15mfd_151",
1079
- component: "_component_15mfd_158",
1080
- right: "_right_15mfd_164",
1081
- actions: "_actions_15mfd_169",
1082
- menuPopover: "_menuPopover_15mfd_176",
1083
- menuPopoverNested: "_menuPopoverNested_15mfd_198",
1084
- menuItem: "_menuItem_15mfd_201"
1062
+ layer: "_layer_1hkuy_1",
1063
+ nested: "_nested_1hkuy_14",
1064
+ fileInput: "_fileInput_1hkuy_17",
1065
+ trigger: "_trigger_1hkuy_23",
1066
+ heading: "_heading_1hkuy_32",
1067
+ headingIcon: "_headingIcon_1hkuy_38",
1068
+ clickable: "_clickable_1hkuy_45",
1069
+ option: "_option_1hkuy_49",
1070
+ active: "_active_1hkuy_69",
1071
+ disabled: "_disabled_1hkuy_74",
1072
+ selected: "_selected_1hkuy_77",
1073
+ optionContent: "_optionContent_1hkuy_84",
1074
+ description: "_description_1hkuy_88",
1075
+ inline: "_inline_1hkuy_92",
1076
+ alignRight: "_alignRight_1hkuy_98",
1077
+ label: "_label_1hkuy_103",
1078
+ right: "_right_1hkuy_106",
1079
+ icon: "_icon_1hkuy_113",
1080
+ check: "_check_1hkuy_114",
1081
+ arrow: "_arrow_1hkuy_157",
1082
+ divider: "_divider_1hkuy_161",
1083
+ buttonLabel: "_buttonLabel_1hkuy_169",
1084
+ component: "_component_1hkuy_176",
1085
+ actions: "_actions_1hkuy_187",
1086
+ menuPopover: "_menuPopover_1hkuy_194",
1087
+ menuPopoverNested: "_menuPopoverNested_1hkuy_216",
1088
+ menuItem: "_menuItem_1hkuy_219"
1085
1089
  };
1086
1090
  //#endregion
1087
1091
  //#region src/components/menu/layer/heading.tsx
@@ -1102,7 +1106,7 @@ var getTextValue$1 = (label) => {
1102
1106
  if (typeof label === "string" || typeof label === "number") return String(label);
1103
1107
  return "";
1104
1108
  };
1105
- var Option$2 = ({ actions, label, url, onClick, description, icon, selected, closeOnOptionClick = true, close, disabled, inline, title, upload, uploadType, onChange, testId }) => {
1109
+ var Option$2 = ({ actions, label, url, onClick, description, icon, selected, closeOnOptionClick = true, close, disabled, inline, align, title, upload, uploadType, onChange, testId }) => {
1106
1110
  const fileInputRef = useRef(null);
1107
1111
  const handleClick = (evt) => {
1108
1112
  if (disabled) {
@@ -1135,7 +1139,7 @@ var Option$2 = ({ actions, label, url, onClick, description, icon, selected, clo
1135
1139
  }
1136
1140
  };
1137
1141
  return /* @__PURE__ */ jsxs(MenuItem, {
1138
- className: cx(menu_module_default.menuItem, menu_module_default.option, inline && menu_module_default.inline, selected && menu_module_default.selected),
1142
+ className: cx(menu_module_default.menuItem, menu_module_default.option, inline && menu_module_default.inline, align === "right" && menu_module_default.alignRight, selected && menu_module_default.selected),
1139
1143
  textValue: getTextValue$1(label),
1140
1144
  href: url,
1141
1145
  isDisabled: disabled,
@@ -1171,9 +1175,9 @@ var Option$2 = ({ actions, label, url, onClick, description, icon, selected, clo
1171
1175
  }),
1172
1176
  /* @__PURE__ */ jsxs("div", {
1173
1177
  className: menu_module_default.right,
1174
- children: [selected && /* @__PURE__ */ jsx("span", {
1178
+ children: [/* @__PURE__ */ jsx("span", {
1175
1179
  className: menu_module_default.check,
1176
- children: /* @__PURE__ */ jsx(Icon, { icon: IconType.CHECK })
1180
+ children: selected && /* @__PURE__ */ jsx(Icon, { icon: IconType.CHECK })
1177
1181
  }), !!(actions === null || actions === void 0 ? void 0 : actions.length) && /* @__PURE__ */ jsx("div", {
1178
1182
  className: menu_module_default.actions,
1179
1183
  onClick: (evt) => evt.stopPropagation(),
@@ -1230,6 +1234,7 @@ var Section$1 = ({ section, closeOnOptionClick, close }) => {
1230
1234
  close,
1231
1235
  disabled: (section === null || section === void 0 ? void 0 : section.disabled) || disabledContext,
1232
1236
  inline: section === null || section === void 0 ? void 0 : section.inline,
1237
+ align: section === null || section === void 0 ? void 0 : section.align,
1233
1238
  title: section === null || section === void 0 ? void 0 : section.title,
1234
1239
  upload: section === null || section === void 0 ? void 0 : section.upload,
1235
1240
  uploadType: section === null || section === void 0 ? void 0 : section.uploadType,
@@ -2713,28 +2718,51 @@ var InputGroup = ({ children, small = false, width = "100%", isInTable: isInTabl
2713
2718
  })
2714
2719
  });
2715
2720
  };
2721
+ //#endregion
2722
+ //#region src/hooks/use-element-width.ts
2723
+ var useElementWidth = (enabled = true) => {
2724
+ const ref = useRef(null);
2725
+ const [width, setWidth] = useState(null);
2726
+ useLayoutEffect(() => {
2727
+ const element = ref.current;
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]);
2739
+ return [ref, width];
2740
+ };
2716
2741
  var input_module_default = {
2717
- inputInTable: "_inputInTable_o2gwb_1",
2718
- inputHover: "_inputHover_o2gwb_13",
2719
- inputFocus: "_inputFocus_o2gwb_18",
2720
- controlFocusVisible: "_controlFocusVisible_o2gwb_25",
2721
- inputError: "_inputError_o2gwb_29",
2722
- inputWarning: "_inputWarning_o2gwb_30",
2723
- inputDisabled: "_inputDisabled_o2gwb_65",
2724
- hideScrollbars: "_hideScrollbars_o2gwb_71",
2725
- wrapper: "_wrapper_o2gwb_81",
2726
- input: "_input_o2gwb_1",
2727
- isInTable: "_isInTable_o2gwb_107",
2728
- small: "_small_o2gwb_131",
2729
- right: "_right_o2gwb_177",
2730
- groupOrderFirst: "_groupOrderFirst_o2gwb_180",
2731
- groupOrderMiddle: "_groupOrderMiddle_o2gwb_181",
2732
- groupOrderLast: "_groupOrderLast_o2gwb_185",
2733
- icon: "_icon_o2gwb_190"
2742
+ inputInTable: "_inputInTable_1w4lm_1",
2743
+ inputHover: "_inputHover_1w4lm_13",
2744
+ inputFocus: "_inputFocus_1w4lm_18",
2745
+ controlFocusVisible: "_controlFocusVisible_1w4lm_25",
2746
+ inputError: "_inputError_1w4lm_29",
2747
+ inputWarning: "_inputWarning_1w4lm_30",
2748
+ inputDisabled: "_inputDisabled_1w4lm_65",
2749
+ hideScrollbars: "_hideScrollbars_1w4lm_71",
2750
+ wrapper: "_wrapper_1w4lm_81",
2751
+ input: "_input_1w4lm_1",
2752
+ isInTable: "_isInTable_1w4lm_107",
2753
+ small: "_small_1w4lm_131",
2754
+ right: "_right_1w4lm_177",
2755
+ groupOrderFirst: "_groupOrderFirst_1w4lm_180",
2756
+ groupOrderMiddle: "_groupOrderMiddle_1w4lm_181",
2757
+ groupOrderLast: "_groupOrderLast_1w4lm_185",
2758
+ slot: "_slot_1w4lm_190",
2759
+ slotLeft: "_slotLeft_1w4lm_207",
2760
+ slotRight: "_slotRight_1w4lm_212",
2761
+ icon: "_icon_1w4lm_225"
2734
2762
  };
2735
2763
  //#endregion
2736
2764
  //#region src/components/input/input.tsx
2737
- 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) => {
2765
+ 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) => {
2738
2766
  const disabledContext = useContext(DisabledContext);
2739
2767
  const isInTable = useIsInTable(isInTableProp);
2740
2768
  const order = (() => {
@@ -2746,48 +2774,67 @@ var Input = forwardRef(({ error = null, tooltip = null, isInTable: isInTableProp
2746
2774
  return "";
2747
2775
  })();
2748
2776
  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);
2749
2783
  const handleFocus = (e) => {
2750
2784
  onFocus(e);
2751
2785
  if (selectOnFocus) setTimeout(() => {
2752
2786
  if (e.target === document.activeElement) e.target.select();
2753
2787
  }, 0);
2754
2788
  };
2755
- return /* @__PURE__ */ jsx("div", {
2789
+ return /* @__PURE__ */ jsxs("div", {
2756
2790
  style: { width },
2757
2791
  className: cx(order, input_module_default.wrapper),
2758
- children: /* @__PURE__ */ jsxs(Tooltip, {
2759
- error: !!error,
2760
- warning: !!warning,
2761
- text: tooltip || error || warning,
2762
- enabled: tooltip && isStringNumberOrNode(tooltip) || error && isStringNumberOrNode(error) || warning && isStringNumberOrNode(warning) || false,
2763
- maxWidth: maxTooltipWidth,
2764
- display: "block",
2765
- children: [icon && /* @__PURE__ */ jsx("span", {
2766
- className: input_module_default.icon,
2767
- children: /* @__PURE__ */ jsx(Icon, { icon })
2768
- }), /* @__PURE__ */ jsx("input", {
2769
- ref,
2770
- type: type || "text",
2771
- size: size || 20,
2772
- placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : "",
2773
- value: value !== null && value !== void 0 ? value : "",
2774
- onChange,
2775
- onKeyPress,
2776
- onKeyDown,
2777
- onFocus: handleFocus,
2778
- onBlur,
2779
- onPaste,
2780
- name,
2781
- tabIndex,
2782
- autoComplete: "off",
2783
- disabled: disabled || disabledContext,
2784
- className: cx(input_module_default.input, right ? input_module_default.right : "", small ? input_module_default.small : "", isInTable ? input_module_default.isInTable : ""),
2785
- style: { width },
2786
- "data-error": error || null,
2787
- "data-warning": warning || null,
2788
- "data-testid": testId
2789
- })]
2790
- })
2792
+ children: [
2793
+ leftContent && /* @__PURE__ */ jsx("div", {
2794
+ ref: leftSlotRef,
2795
+ className: cx(input_module_default.slot, input_module_default.slotLeft),
2796
+ children: leftContent
2797
+ }),
2798
+ /* @__PURE__ */ jsx(Tooltip, {
2799
+ error: !!error,
2800
+ warning: !!warning,
2801
+ text: tooltip || error || warning,
2802
+ enabled: tooltip && isStringNumberOrNode(tooltip) || error && isStringNumberOrNode(error) || warning && isStringNumberOrNode(warning) || false,
2803
+ maxWidth: maxTooltipWidth,
2804
+ display: "block",
2805
+ children: /* @__PURE__ */ jsx("input", {
2806
+ ref,
2807
+ type: type || "text",
2808
+ size: size || 20,
2809
+ placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : "",
2810
+ value: value !== null && value !== void 0 ? value : "",
2811
+ onChange,
2812
+ onKeyPress,
2813
+ onKeyDown,
2814
+ onFocus: handleFocus,
2815
+ onBlur,
2816
+ onPaste,
2817
+ name,
2818
+ tabIndex,
2819
+ autoComplete: "off",
2820
+ disabled: disabled || disabledContext,
2821
+ className: cx(input_module_default.input, right ? input_module_default.right : "", small ? input_module_default.small : "", isInTable ? input_module_default.isInTable : ""),
2822
+ style: {
2823
+ width,
2824
+ ...leftSlotWidth !== null && { paddingLeft: leftSlotWidth },
2825
+ ...rightSlotWidth !== null && { paddingRight: rightSlotWidth }
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
+ ]
2791
2838
  });
2792
2839
  });
2793
2840
  var file_input_module_default = { fileInput: "_fileInput_1elar_1" };
@@ -4517,16 +4564,17 @@ var validateSelectedPage = (selectedPage, numPages, errorMessageTemplate = "Sele
4517
4564
  };
4518
4565
  var pagination_module_default = { paginationContainer: "_paginationContainer_1tmz4_1" };
4519
4566
  var input_group_addon_module_default = {
4520
- addon: "_addon_11bnn_1",
4521
- small: "_small_11bnn_12",
4522
- groupOrderFirst: "_groupOrderFirst_11bnn_16",
4523
- groupOrderMiddle: "_groupOrderMiddle_11bnn_17",
4524
- groupOrderLast: "_groupOrderLast_11bnn_21",
4525
- isInTable: "_isInTable_11bnn_26"
4567
+ addon: "_addon_4fbro_1",
4568
+ small: "_small_4fbro_12",
4569
+ groupOrderFirst: "_groupOrderFirst_4fbro_16",
4570
+ groupOrderMiddle: "_groupOrderMiddle_4fbro_17",
4571
+ groupOrderLast: "_groupOrderLast_4fbro_21",
4572
+ isInTable: "_isInTable_4fbro_26",
4573
+ borderless: "_borderless_4fbro_38"
4526
4574
  };
4527
4575
  //#endregion
4528
4576
  //#region src/components/input-group/input-group-addon/input-group-addon.tsx
4529
- var InputGroupAddon = ({ children, groupOrder, small = false }) => {
4577
+ var InputGroupAddon = ({ children, groupOrder, small = false, borderless = false }) => {
4530
4578
  const isInTable = useIsInTable();
4531
4579
  const order = (() => {
4532
4580
  if (groupOrder) switch (groupOrder) {
@@ -4537,7 +4585,7 @@ var InputGroupAddon = ({ children, groupOrder, small = false }) => {
4537
4585
  return "";
4538
4586
  })();
4539
4587
  return /* @__PURE__ */ jsx("span", {
4540
- className: cx(input_group_addon_module_default.addon, order, small ? input_group_addon_module_default.small : "", isInTable && input_group_addon_module_default.isInTable),
4588
+ 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),
4541
4589
  children
4542
4590
  });
4543
4591
  };
@@ -4726,37 +4774,37 @@ var getHeaderAlignment = (alignments, isHeader = false, rowIndex = 0) => {
4726
4774
  }
4727
4775
  };
4728
4776
  var cell_module_default = {
4729
- inputInTable: "_inputInTable_1ull1_1",
4730
- inputHover: "_inputHover_1ull1_13",
4731
- inputFocus: "_inputFocus_1ull1_18",
4732
- controlFocusVisible: "_controlFocusVisible_1ull1_25",
4733
- inputError: "_inputError_1ull1_29",
4734
- inputWarning: "_inputWarning_1ull1_30",
4735
- inputDisabled: "_inputDisabled_1ull1_65",
4736
- hideScrollbars: "_hideScrollbars_1ull1_71",
4737
- cell: "_cell_1ull1_81",
4738
- disabledLink: "_disabledLink_1ull1_91",
4739
- inputWrapper: "_inputWrapper_1ull1_95",
4740
- numberInputWrapper: "_numberInputWrapper_1ull1_110",
4741
- unitInputWrapper: "_unitInputWrapper_1ull1_117",
4742
- breakWord: "_breakWord_1ull1_125",
4743
- inputCell: "_inputCell_1ull1_128",
4744
- sliderCell: "_sliderCell_1ull1_131",
4745
- staticCell: "_staticCell_1ull1_135",
4746
- staticCellContent: "_staticCellContent_1ull1_138",
4747
- unit: "_unit_1ull1_117",
4748
- sortingCell: "_sortingCell_1ull1_162",
4749
- sortingCellIcon: "_sortingCellIcon_1ull1_173",
4750
- icon: "_icon_1ull1_184",
4751
- checkBoxCell: "_checkBoxCell_1ull1_188",
4752
- iconCellWrapper: "_iconCellWrapper_1ull1_192",
4753
- actionsCell: "_actionsCell_1ull1_196",
4754
- rightAligned: "_rightAligned_1ull1_204",
4755
- centerAligned: "_centerAligned_1ull1_210",
4756
- leftAligned: "_leftAligned_1ull1_216",
4757
- popover: "_popover_1ull1_219",
4758
- disabledPointerEvents: "_disabledPointerEvents_1ull1_222",
4759
- standaloneCheckbox: "_standaloneCheckbox_1ull1_225"
4777
+ inputInTable: "_inputInTable_1vfnu_1",
4778
+ inputHover: "_inputHover_1vfnu_13",
4779
+ inputFocus: "_inputFocus_1vfnu_18",
4780
+ controlFocusVisible: "_controlFocusVisible_1vfnu_25",
4781
+ inputError: "_inputError_1vfnu_29",
4782
+ inputWarning: "_inputWarning_1vfnu_30",
4783
+ inputDisabled: "_inputDisabled_1vfnu_65",
4784
+ hideScrollbars: "_hideScrollbars_1vfnu_71",
4785
+ cell: "_cell_1vfnu_81",
4786
+ disabledLink: "_disabledLink_1vfnu_91",
4787
+ inputWrapper: "_inputWrapper_1vfnu_95",
4788
+ numberInputWrapper: "_numberInputWrapper_1vfnu_110",
4789
+ unitInputWrapper: "_unitInputWrapper_1vfnu_117",
4790
+ breakWord: "_breakWord_1vfnu_123",
4791
+ inputCell: "_inputCell_1vfnu_126",
4792
+ sliderCell: "_sliderCell_1vfnu_129",
4793
+ staticCell: "_staticCell_1vfnu_133",
4794
+ staticCellContent: "_staticCellContent_1vfnu_136",
4795
+ unit: "_unit_1vfnu_117",
4796
+ sortingCell: "_sortingCell_1vfnu_160",
4797
+ sortingCellIcon: "_sortingCellIcon_1vfnu_171",
4798
+ icon: "_icon_1vfnu_182",
4799
+ checkBoxCell: "_checkBoxCell_1vfnu_186",
4800
+ iconCellWrapper: "_iconCellWrapper_1vfnu_190",
4801
+ actionsCell: "_actionsCell_1vfnu_194",
4802
+ rightAligned: "_rightAligned_1vfnu_202",
4803
+ centerAligned: "_centerAligned_1vfnu_208",
4804
+ leftAligned: "_leftAligned_1vfnu_214",
4805
+ popover: "_popover_1vfnu_217",
4806
+ disabledPointerEvents: "_disabledPointerEvents_1vfnu_220",
4807
+ standaloneCheckbox: "_standaloneCheckbox_1vfnu_223"
4760
4808
  };
4761
4809
  //#endregion
4762
4810
  //#region src/components/table/cell/cell-types/input-cell.tsx
@@ -4802,7 +4850,7 @@ var startsWithDecimal = (value) => value.startsWith(".");
4802
4850
  * undoing deletion of the leading zero when editing values like 0.1 → 1.1.
4803
4851
  */
4804
4852
  var preserveLeadingDecimalDraft = (rawInput, cleaned) => startsWithDecimal(rawInput) && cleaned === `0${rawInput}` ? rawInput : cleaned;
4805
- 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 }) => {
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, leftSlot, rightSlot }) => {
4806
4854
  const validateInputValue = (value) => {
4807
4855
  const validation = validateNumber(value);
4808
4856
  const isPlaceholder = placeholder && isEmptyNullOrUndefined(value);
@@ -4908,7 +4956,9 @@ var NumberInput = ({ name, placeholder = "", disabled = false, error = false, le
4908
4956
  selectOnFocus,
4909
4957
  tabIndex,
4910
4958
  tooltip,
4911
- ref: inputRef
4959
+ ref: inputRef,
4960
+ leftSlot,
4961
+ rightSlot
4912
4962
  }, stringName);
4913
4963
  };
4914
4964
  //#endregion
@@ -5136,9 +5186,8 @@ var safeRoundNumbers = (value) => {
5136
5186
  return !isScientificStringNum(value) ? roundByMagnitude(value) : value;
5137
5187
  };
5138
5188
  var unit_input_module_default = {
5139
- predefinedMenuActive: "_predefinedMenuActive_13yll_1",
5140
- inputWrapper: "_inputWrapper_13yll_4",
5141
- isInTable: "_isInTable_13yll_9"
5189
+ predefinedMenuActive: "_predefinedMenuActive_1kqia_1",
5190
+ isInTable: "_isInTable_1kqia_4"
5142
5191
  };
5143
5192
  //#endregion
5144
5193
  //#region src/components/unit-input/unit-input.tsx
@@ -5311,10 +5360,7 @@ var UnitInput = ({ name, placeholder = "", disabled = false, disabledUnit = fals
5311
5360
  } });
5312
5361
  }
5313
5362
  },
5314
- label: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Text, { children: el.label }), /* @__PURE__ */ jsx(Spacer, {
5315
- width: "20px",
5316
- height: "0"
5317
- })] }),
5363
+ label: el.label,
5318
5364
  description,
5319
5365
  selected: foundPredefinedMenuOption === el && predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED
5320
5366
  };
@@ -5349,100 +5395,89 @@ var UnitInput = ({ name, placeholder = "", disabled = false, disabledUnit = fals
5349
5395
  }
5350
5396
  return placeholder;
5351
5397
  };
5352
- const hasPredefinedOptions = Boolean(predefinedOptions);
5353
- const hasUnitControl = Boolean(displayUnitLabel);
5354
- const inputGroupOrder = (() => {
5355
- if (hasPredefinedOptions && hasUnitControl) return GroupOrder.MIDDLE;
5356
- if (hasPredefinedOptions) return !groupOrder || groupOrder === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
5357
- if (hasUnitControl) return !groupOrder || groupOrder === GroupOrder.FIRST ? GroupOrder.FIRST : GroupOrder.MIDDLE;
5358
- return groupOrder !== null && groupOrder !== void 0 ? groupOrder : GroupOrder.FIRST;
5359
- })();
5360
- const unitGroupOrder = !groupOrder || groupOrder === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
5361
5398
  return /* @__PURE__ */ jsx("div", {
5362
5399
  className: cx(predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED && unit_input_module_default.predefinedMenuActive, isInTable && unit_input_module_default.isInTable),
5363
- children: /* @__PURE__ */ jsxs(InputGroup, {
5400
+ children: /* @__PURE__ */ jsx(NumberInput, {
5401
+ name: stringName,
5402
+ testId,
5403
+ disabled,
5404
+ placeholder: getPlaceholder(placeholder),
5405
+ value: displayLayer.value,
5406
+ onChange: onSetValue,
5407
+ onFocus,
5408
+ error: error === null ? void 0 : error,
5409
+ warning: warning === null ? void 0 : warning,
5410
+ left,
5411
+ allowEmpty: derivedAllowEmpty,
5412
+ validationCallback: (_name, error) => validationCallback(stringName, error),
5413
+ enableCosmeticRounding,
5414
+ enableDisplayRounding,
5415
+ roundDisplayValue,
5416
+ groupOrder,
5417
+ disableInternalErrorValidationMessages,
5364
5418
  small,
5365
5419
  width,
5366
5420
  isInTable,
5367
- children: [
5368
- predefinedOptions && /* @__PURE__ */ jsx(Menu, {
5369
- maxHeight: 380,
5370
- groupOrder: "first",
5371
- testId: testId && `${testId}-predefined-menu`,
5372
- disabled,
5373
- menu: {
5374
- colored: true,
5375
- trigger: "Component",
5376
- component: /* @__PURE__ */ jsx(Button, {
5377
- groupOrder: "first",
5378
- active: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED,
5379
- icon: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? "link" : "unlink",
5380
- small
5381
- }),
5382
- small,
5383
- sections: sectionsPredefinedMenu
5384
- },
5385
- tooltip: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? foundPredefinedMenuOption === null || foundPredefinedMenuOption === void 0 ? void 0 : foundPredefinedMenuOption.label : ""
5386
- }),
5387
- /* @__PURE__ */ jsx("div", {
5388
- className: unit_input_module_default.inputWrapper,
5389
- children: /* @__PURE__ */ jsx(NumberInput, {
5390
- name: stringName,
5391
- testId,
5392
- disabled,
5393
- placeholder: getPlaceholder(placeholder),
5394
- value: displayLayer.value,
5395
- onChange: onSetValue,
5396
- onFocus,
5397
- error: error === null ? void 0 : error,
5398
- warning: warning === null ? void 0 : warning,
5399
- left,
5400
- allowEmpty: derivedAllowEmpty,
5401
- validationCallback: (_name, error) => validationCallback(stringName, error),
5402
- enableCosmeticRounding,
5403
- enableDisplayRounding,
5404
- roundDisplayValue,
5405
- groupOrder: inputGroupOrder,
5406
- disableInternalErrorValidationMessages,
5407
- small,
5408
- selectOnFocus,
5409
- tooltip
5410
- }, stringName)
5411
- }),
5412
- displayUnitLabel && (noConvert || !knownUnit ? /* @__PURE__ */ jsx(InputGroupAddon, {
5413
- groupOrder: unitGroupOrder,
5421
+ selectOnFocus,
5422
+ tooltip,
5423
+ leftSlot: predefinedOptions && /* @__PURE__ */ jsx(Menu, {
5424
+ maxHeight: 380,
5425
+ testId: testId && `${testId}-predefined-menu`,
5426
+ disabled,
5427
+ menu: {
5428
+ trigger: "Component",
5429
+ component: /* @__PURE__ */ jsx(Button, {
5430
+ basic: true,
5431
+ colored: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? true : Color.MUTED,
5432
+ icon: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? "link" : "unlink",
5433
+ small
5434
+ }),
5414
5435
  small,
5415
- children: displayUnitLabel
5416
- }) : /* @__PURE__ */ jsx(Menu, {
5417
- groupOrder: unitGroupOrder,
5418
- maxHeight: 380,
5419
- disabled: disabledUnit,
5420
- testId: testId && `${testId}-menu`,
5421
- tabIndex: -1,
5422
- menu: {
5436
+ sections: sectionsPredefinedMenu
5437
+ },
5438
+ tooltip: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? foundPredefinedMenuOption === null || foundPredefinedMenuOption === void 0 ? void 0 : foundPredefinedMenuOption.label : ""
5439
+ }),
5440
+ rightSlot: displayUnitLabel && (noConvert || !knownUnit ? /* @__PURE__ */ jsx(InputGroupAddon, {
5441
+ borderless: true,
5442
+ small,
5443
+ children: displayUnitLabel
5444
+ }) : /* @__PURE__ */ jsx(Menu, {
5445
+ maxHeight: 380,
5446
+ disabled: disabledUnit,
5447
+ testId: testId && `${testId}-menu`,
5448
+ tabIndex: -1,
5449
+ menu: {
5450
+ trigger: "Component",
5451
+ component: /* @__PURE__ */ jsx(Button, {
5452
+ basic: true,
5453
+ colored: Color.MUTED,
5423
5454
  label: displayUnitLabel,
5424
- trigger: "DropDownButton",
5425
- small,
5426
- sections: alternativeUnits.map(([value = "", altUnit = "", label]) => {
5427
- const displayUnit = label || altUnit || "";
5428
- const safeValue = isValidNum(value) ? value : "";
5429
- return {
5430
- type: "Option",
5431
- label: enableCosmeticRounding ? safeRoundNumbers(safeValue) : safeValue,
5432
- inline: true,
5433
- onClick: (evt) => {
5434
- evt.stopPropagation();
5435
- onClickUnit(value, altUnit);
5436
- },
5437
- description: displayUnit,
5438
- selected: displayUnit === displayUnitLabel,
5439
- testId: `${testId}-unit-${displayUnit}`
5440
- };
5441
- })
5442
- }
5443
- }))
5444
- ]
5445
- })
5455
+ fontWeight: "normal",
5456
+ rightIcon: IconType.CHEVRON_DOWN,
5457
+ small
5458
+ }),
5459
+ placement: "bottom-end",
5460
+ small,
5461
+ sections: alternativeUnits.map(([value = "", altUnit = "", label]) => {
5462
+ const displayUnit = label || altUnit || "";
5463
+ const safeValue = isValidNum(value) ? value : "";
5464
+ return {
5465
+ type: "Option",
5466
+ label: enableCosmeticRounding ? safeRoundNumbers(safeValue) : safeValue,
5467
+ inline: true,
5468
+ align: "right",
5469
+ onClick: (evt) => {
5470
+ evt.stopPropagation();
5471
+ onClickUnit(value, altUnit);
5472
+ },
5473
+ description: displayUnit,
5474
+ selected: displayUnit === displayUnitLabel,
5475
+ testId: `${testId}-unit-${displayUnit}`
5476
+ };
5477
+ })
5478
+ }
5479
+ }))
5480
+ }, stringName)
5446
5481
  });
5447
5482
  };
5448
5483
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/react-ui-library",
3
- "version": "10.6.1",
3
+ "version": "10.7.0-beta-1",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
6
6
  "bugs": {