@oliasoft-open-source/react-ui-library 4.15.1-beta-4 → 4.15.1-beta-6

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
@@ -762,7 +762,7 @@ export declare interface IMenuProps {
762
762
  selected?: boolean;
763
763
  }
764
764
 
765
- declare interface IMenuSection {
765
+ export declare interface IMenuSection {
766
766
  type: TMenuType | string;
767
767
  label?: ReactNode;
768
768
  icon?: string | ReactNode;
@@ -1569,7 +1569,6 @@ export declare interface IUnitInputProps {
1569
1569
  unitkey?: string;
1570
1570
  initUnit?: string;
1571
1571
  noConversion?: boolean;
1572
- doNotConvertValue?: boolean;
1573
1572
  testId?: string;
1574
1573
  warning?: string | boolean | null;
1575
1574
  predefinedOptions?: IPredefinedOption[] | null;
@@ -1579,7 +1578,6 @@ export declare interface IUnitInputProps {
1579
1578
  validationCallback?: (name: string, error: string | null) => any;
1580
1579
  disabledValidation?: boolean;
1581
1580
  allowEmpty?: boolean;
1582
- autoValue?: string;
1583
1581
  onChange?: TOnChangeEventHandler;
1584
1582
  onSwitchUnit?: (unit: string) => void;
1585
1583
  onClick?: MouseEventHandler<HTMLInputElement>;
@@ -1886,7 +1884,7 @@ declare type TUnitTableCellShape = TCellShape | IUnitTableStaticCell | IUnitTabl
1886
1884
 
1887
1885
  declare type UnitContextType = any;
1888
1886
 
1889
- export declare const UnitInput: ({ name, placeholder, disabled, disabledUnit, error, left, small, width, value, unitkey, initUnit, noConversion, onChange, onClick, onFocus, onSwitchUnit, unitTemplate, doNotConvertValue, testId, warning, predefinedOptions, initialPredefinedOption, shouldLinkAutomaticly, selectedPredefinedOptionKey, validationCallback, disabledValidation, allowEmpty, autoValue, convertBackToStorageUnit, enableCosmeticRounding, enableDisplayRounding, roundDisplayValue, }: IUnitInputProps) => JSX_2.Element;
1887
+ export declare const UnitInput: ({ name, placeholder, disabled, disabledUnit, error, left, small, width, value, unitkey, initUnit, noConversion, onChange, onClick, onFocus, onSwitchUnit, unitTemplate, testId, warning, predefinedOptions, initialPredefinedOption, shouldLinkAutomaticly, selectedPredefinedOptionKey, validationCallback, disabledValidation, allowEmpty, convertBackToStorageUnit, enableCosmeticRounding, enableDisplayRounding, roundDisplayValue, }: IUnitInputProps) => JSX_2.Element;
1890
1888
 
1891
1889
  export declare const UnitTable: ({ table, unitConfig, convertBackToStorageUnit, enableCosmeticRounding, enableDisplayRounding, }: IUnitTableProps) => JSX_2.Element;
1892
1890
 
package/dist/index.js CHANGED
@@ -20929,11 +20929,12 @@ const Trigger = ({
20929
20929
  order2
20930
20930
  ),
20931
20931
  onClick: (evt) => {
20932
- console.log("TRIGGER ONCLICK");
20932
+ onClickTrigger(evt);
20933
20933
  if (typeof setInputFocus === "function") {
20934
- setInputFocus();
20934
+ setTimeout(() => {
20935
+ setInputFocus();
20936
+ }, 0);
20935
20937
  }
20936
- onClickTrigger(evt);
20937
20938
  },
20938
20939
  onFocus,
20939
20940
  onBlur,
@@ -70316,7 +70317,6 @@ const UnitInput = ({
70316
70317
  onFocus = noop$3,
70317
70318
  onSwitchUnit = noop$3,
70318
70319
  unitTemplate,
70319
- doNotConvertValue = false,
70320
70320
  testId,
70321
70321
  warning: warning2 = null,
70322
70322
  predefinedOptions,
@@ -70326,7 +70326,6 @@ const UnitInput = ({
70326
70326
  validationCallback = () => ({ name: "", error: null }),
70327
70327
  disabledValidation = false,
70328
70328
  allowEmpty = false,
70329
- autoValue,
70330
70329
  convertBackToStorageUnit = false,
70331
70330
  enableCosmeticRounding = true,
70332
70331
  enableDisplayRounding = false,
@@ -70338,7 +70337,6 @@ const UnitInput = ({
70338
70337
  value = `${value}`;
70339
70338
  }
70340
70339
  const [propValue = "", propUnit = ""] = value !== void 0 ? split$1(value) : [];
70341
- const propAutoUnit = autoValue ? getUnit(autoValue) : "";
70342
70340
  const preferredUnit = useMemo$1(
70343
70341
  () => getPreferredUnit(unitkey, unitTemplate || (context2 == null ? void 0 : context2.unitTemplate)),
70344
70342
  [unitkey, unitTemplate, context2 == null ? void 0 : context2.unitTemplate]
@@ -70351,23 +70349,15 @@ const UnitInput = ({
70351
70349
  toUnit: initDisplayUnit,
70352
70350
  unitkey,
70353
70351
  defaultFromUnit: propUnit,
70354
- doNotConvertValue
70355
- });
70356
- const { value: convertedAutoValue } = safeConvertValue({
70357
- value: autoValue,
70358
- toUnit: initDisplayUnit,
70359
- unitkey,
70360
- defaultFromUnit: propAutoUnit,
70361
- doNotConvertValue
70352
+ doNotConvertValue: noConversion
70362
70353
  });
70363
- const initDisplayLayer = convertedValue !== "" ? { value: convertedValue, unit: initDisplayUnit } : convertedAutoValue !== "" ? { value: convertedAutoValue, unit: initDisplayUnit } : { value: propValue, unit: propUnit };
70354
+ const initDisplayLayer = convertedValue !== "" ? { value: convertedValue, unit: initDisplayUnit } : { value: propValue, unit: propUnit };
70364
70355
  const [displayLayer, setDisplayLayer] = useState(initDisplayLayer);
70365
70356
  const derivedAllowEmpty = allowEmpty || (displayLayer == null ? void 0 : displayLayer.value) === void 0;
70366
70357
  const [predefinedOptionsMenuState, setPredefinedOptionsMenuState] = useState(
70367
70358
  initialPredefinedOption ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM
70368
70359
  );
70369
- const isAutoValue = propValue === "" && autoValue;
70370
- const disableInternalErrorValidationMessages = !!(disabledValidation || autoValue || disabled2);
70360
+ const disableInternalErrorValidationMessages = !!(disabledValidation || disabled2);
70371
70361
  const foundPredefinedMenuOption = predefinedOptions && predefinedOptions.find((el2) => {
70372
70362
  if (!(el2 == null ? void 0 : el2.value)) return;
70373
70363
  if (selectedPredefinedOptionKey) {
@@ -70382,7 +70372,7 @@ const UnitInput = ({
70382
70372
  return withUnit(resultValue, predefinedMenuItemUnit) === el2.value;
70383
70373
  });
70384
70374
  const getAlternativeUnits = () => {
70385
- const valueToList = isAutoValue ? autoValue : value ?? "";
70375
+ const valueToList = value ?? "";
70386
70376
  const initToUnit = displayLayer.unit;
70387
70377
  const shouldConvert = checkConversion({
70388
70378
  value: valueToList,
@@ -70441,7 +70431,7 @@ const UnitInput = ({
70441
70431
  toUnit: initDisplayUnit,
70442
70432
  unitkey,
70443
70433
  defaultFromUnit: propUnit,
70444
- doNotConvertValue
70434
+ doNotConvertValue: noConversion
70445
70435
  });
70446
70436
  newValue = resultValue;
70447
70437
  newUnit = initDisplayUnit;
@@ -70451,7 +70441,7 @@ const UnitInput = ({
70451
70441
  toUnit: displayLayer.unit,
70452
70442
  unitkey,
70453
70443
  defaultFromUnit: propUnit,
70454
- doNotConvertValue
70444
+ doNotConvertValue: noConversion
70455
70445
  });
70456
70446
  newValue = resultValue;
70457
70447
  newUnit = displayLayer.unit;
@@ -70524,23 +70514,14 @@ const UnitInput = ({
70524
70514
  sectionsPredefinedMenu = [...sectionsPredefinedMenu, ...dynamicOptions];
70525
70515
  }
70526
70516
  const getPlaceholder = (placeholder22) => {
70527
- if (isAutoValue) {
70528
- const { value: resultValue } = safeConvertValue({
70529
- value: autoValue,
70530
- toUnit: displayLayer.unit,
70531
- unitkey,
70532
- defaultFromUnit: propAutoUnit,
70533
- doNotConvertValue
70534
- });
70535
- return resultValue;
70536
- } else if (isValueWithUnit(placeholder22)) {
70517
+ if (isValueWithUnit(placeholder22)) {
70537
70518
  const placeholderUnit = getUnit(placeholder22);
70538
70519
  const { value: resultValue } = safeConvertValue({
70539
70520
  value: placeholder22,
70540
70521
  toUnit: displayLayer.unit,
70541
70522
  unitkey,
70542
70523
  defaultFromUnit: placeholderUnit,
70543
- doNotConvertValue
70524
+ doNotConvertValue: noConversion
70544
70525
  });
70545
70526
  return resultValue;
70546
70527
  }
@@ -70625,7 +70606,7 @@ const UnitInput = ({
70625
70606
  inline: true,
70626
70607
  onClick: (evt) => {
70627
70608
  evt.stopPropagation();
70628
- onClickUnit(isAutoValue ? "" : value2, altUnit);
70609
+ onClickUnit(value2, altUnit);
70629
70610
  },
70630
70611
  description: displayUnit,
70631
70612
  selected: displayUnit === displayUnitLabel,