@oliasoft-open-source/react-ui-library 4.15.4-beta-1 → 4.15.4-beta-2

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.d.ts CHANGED
@@ -502,6 +502,7 @@ declare interface IInputCell extends TCommonCell {
502
502
  warning?: string;
503
503
  disabled?: boolean;
504
504
  maxTooltipWidth?: TStringOrNumber;
505
+ selectOnFocus?: boolean;
505
506
  tooltip?: StringNumberOrNode;
506
507
  }
507
508
 
@@ -528,6 +529,7 @@ export declare interface IInputProps {
528
529
  onFocus?: (evt: FocusEvent_2<HTMLInputElement>) => void;
529
530
  onBlur?: (evt: FocusEvent_2<HTMLInputElement>) => void;
530
531
  onPaste?: default_2.ClipboardEventHandler<HTMLInputElement>;
532
+ selectOnFocus?: boolean;
531
533
  small?: boolean;
532
534
  placeholder?: string | null;
533
535
  tabIndex?: number;
@@ -907,6 +909,7 @@ declare interface INumberInputCell extends TCommonCell {
907
909
  enableCosmeticRounding: boolean;
908
910
  enableDisplayRounding: boolean;
909
911
  roundDisplayValue: (value: TStringOrNumber) => TStringOrNumber;
912
+ selectOnFocus?: boolean;
910
913
  }
911
914
 
912
915
  export declare interface INumberInputProps {
@@ -923,6 +926,7 @@ export declare interface INumberInputProps {
923
926
  onChange?: TChangeEventHandler;
924
927
  onFocus?: (evt: FocusEvent_2<HTMLInputElement>) => void;
925
928
  onBlur?: (evt: FocusEvent_2<HTMLInputElement>) => void;
929
+ selectOnFocus?: boolean;
926
930
  tabIndex?: number;
927
931
  testId?: string;
928
932
  tooltip?: TStringOrNumber | default_2.ReactNode;
@@ -1669,7 +1673,7 @@ export declare const Modal: ({ children, visible, centered, width, onEnter, onEs
1669
1673
 
1670
1674
  export declare const NativeSelect: ({ disabled, error, warning, tooltip, options, onChange, onFocus, onBlur, right, small, tabIndex, selectedOption, width, groupOrder, testId, isInTable, clearable, placeholder, hasNonExistentValue, maxTooltipWidth, borderRadius, }: INativeSelectProps) => JSX_2.Element;
1671
1675
 
1672
- export declare const NumberInput: ({ name, placeholder, disabled, error, left, small, width, value, onChange, onFocus, onBlur, tabIndex, testId, tooltip, warning, validationCallback, allowEmpty, isInTable, groupOrder, enableCosmeticRounding, enableDisplayRounding, roundDisplayValue, disableInternalErrorValidationMessages, }: INumberInputProps) => JSX_2.Element;
1676
+ export declare const NumberInput: ({ name, placeholder, disabled, error, left, small, width, value, onChange, onFocus, onBlur, selectOnFocus, tabIndex, testId, tooltip, warning, validationCallback, allowEmpty, isInTable, groupOrder, enableCosmeticRounding, enableDisplayRounding, roundDisplayValue, disableInternalErrorValidationMessages, }: INumberInputProps) => JSX_2.Element;
1673
1677
 
1674
1678
  export declare const OptionDropdown: ({ name, label, options, onChange, small, showHeader, maxHeight, }: IOptionDropdownProps) => ReactElement;
1675
1679
 
package/dist/index.js CHANGED
@@ -9082,6 +9082,7 @@ const Input$1 = forwardRef(
9082
9082
  },
9083
9083
  onPaste = () => {
9084
9084
  },
9085
+ selectOnFocus = false,
9085
9086
  name: name2 = void 0,
9086
9087
  type = "text",
9087
9088
  tabIndex = 0,
@@ -9110,6 +9111,12 @@ const Input$1 = forwardRef(
9110
9111
  return "";
9111
9112
  })();
9112
9113
  const width2 = propWidth || (size2 ? "auto" : "100%");
9114
+ const handleFocus = (e2) => {
9115
+ onFocus(e2);
9116
+ if (selectOnFocus) {
9117
+ e2.target.select();
9118
+ }
9119
+ };
9113
9120
  return /* @__PURE__ */ jsx("div", { style: { width: width2 }, className: order2, children: /* @__PURE__ */ jsx(
9114
9121
  Tooltip,
9115
9122
  {
@@ -9130,7 +9137,7 @@ const Input$1 = forwardRef(
9130
9137
  value: value ?? "",
9131
9138
  onChange,
9132
9139
  onKeyPress,
9133
- onFocus,
9140
+ onFocus: handleFocus,
9134
9141
  onBlur,
9135
9142
  onPaste,
9136
9143
  name: name2,
@@ -19539,7 +19546,7 @@ const Layer$1 = ({
19539
19546
  return /* @__PURE__ */ jsx(
19540
19547
  Option$1,
19541
19548
  {
19542
- option: { ...option2, key: `${index2}` },
19549
+ option: option2,
19543
19550
  onChange: (evt) => {
19544
19551
  const { value } = option2;
19545
19552
  const next2 = options.map(
@@ -19563,7 +19570,6 @@ const OptionDropdown = ({
19563
19570
  showHeader = true,
19564
19571
  maxHeight = "40vh"
19565
19572
  }) => {
19566
- const [newOptions, setNewOptions] = useState(options);
19567
19573
  return /* @__PURE__ */ jsx(
19568
19574
  Menu,
19569
19575
  {
@@ -19575,11 +19581,11 @@ const OptionDropdown = ({
19575
19581
  sections: /* @__PURE__ */ jsx(
19576
19582
  Layer$1,
19577
19583
  {
19578
- options: newOptions,
19584
+ options,
19579
19585
  onChangeOptions: (evt, nextOptions) => {
19586
+ evt.stopPropagation();
19580
19587
  evt.target.name = name2;
19581
19588
  evt.target.value = nextOptions;
19582
- setNewOptions(nextOptions);
19583
19589
  onChange(evt);
19584
19590
  },
19585
19591
  showHeader,
@@ -55636,6 +55642,7 @@ const InputCell = ({
55636
55642
  isInTable: true,
55637
55643
  maxTooltipWidth: cell2.maxTooltipWidth,
55638
55644
  right: columnAlignment === Align.RIGHT,
55645
+ selectOnFocus: cell2.selectOnFocus,
55639
55646
  testId,
55640
55647
  tabIndex: cell2.disabled ? -1 : 0,
55641
55648
  tooltip: cell2.tooltip,
@@ -55675,6 +55682,7 @@ const NumberInput = ({
55675
55682
  },
55676
55683
  onBlur = () => {
55677
55684
  },
55685
+ selectOnFocus = false,
55678
55686
  tabIndex = 0,
55679
55687
  testId,
55680
55688
  tooltip: tooltip2 = null,
@@ -55757,6 +55765,7 @@ const NumberInput = ({
55757
55765
  }
55758
55766
  };
55759
55767
  useEffect(() => {
55768
+ if (selectOnFocus) return;
55760
55769
  if (inputRef && (inputRef == null ? void 0 : inputRef.current) && enableDisplayRounding && focus2) {
55761
55770
  const textInput = inputRef.current;
55762
55771
  if (textInput) {
@@ -55802,6 +55811,7 @@ const NumberInput = ({
55802
55811
  width: width2,
55803
55812
  isInTable: isInTable2,
55804
55813
  groupOrder,
55814
+ selectOnFocus,
55805
55815
  tabIndex,
55806
55816
  tooltip: tooltip2,
55807
55817
  ref: inputRef
@@ -55833,6 +55843,7 @@ const NumberInputCell = ({
55833
55843
  disabled: cell2.disabled,
55834
55844
  isInTable: true,
55835
55845
  left: cell2.left ?? columnAlignment === Align.LEFT,
55846
+ selectOnFocus: cell2.selectOnFocus,
55836
55847
  tabIndex: cell2.disabled ? -1 : 0,
55837
55848
  testId,
55838
55849
  tooltip: cell2.tooltip,
@@ -70699,6 +70710,7 @@ const convertVisibleRows = ({
70699
70710
  enableCosmeticRounding,
70700
70711
  enableDisplayRounding,
70701
70712
  roundDisplayValue,
70713
+ selectOnFocus: true,
70702
70714
  onChange: (evt) => {
70703
70715
  const { value: value2 } = evt.target;
70704
70716
  const storageUnit2 = storageUnits[unitKey];