@oliasoft-open-source/react-ui-library 4.13.0-beta-14 → 4.13.0-beta-15

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
@@ -1038,10 +1038,9 @@ export declare interface IPortalProps {
1038
1038
  }
1039
1039
 
1040
1040
  declare interface IPredefinedOption {
1041
- value: string;
1041
+ value?: string;
1042
1042
  label: string;
1043
1043
  valueKey?: string;
1044
- unit?: string;
1045
1044
  }
1046
1045
 
1047
1046
  export declare interface IPrintHeaderProps {
@@ -1561,13 +1560,17 @@ export declare interface IUnitInputProps {
1561
1560
  unitkey?: string;
1562
1561
  initUnit?: string;
1563
1562
  noConversion?: boolean;
1563
+ doNotConvertValue?: boolean;
1564
1564
  testId?: string;
1565
1565
  warning?: string | boolean | null;
1566
1566
  predefinedOptions?: IPredefinedOption[] | null;
1567
- initialPredefinedOption?: string;
1567
+ initialPredefinedOption?: boolean;
1568
+ shouldLinkAutomaticly?: boolean;
1569
+ selectedPredefinedOptionKey?: string;
1568
1570
  validationCallback?: (name: string, error: string | null) => any;
1569
1571
  disabledValidation?: boolean;
1570
1572
  allowEmpty?: boolean;
1573
+ autoValue?: string;
1571
1574
  onChange?: TOnChangeEventHandler;
1572
1575
  onSwitchUnit?: (unit: string) => void;
1573
1576
  onClick?: MouseEventHandler<HTMLInputElement>;
@@ -1870,7 +1873,7 @@ declare type TUnitTableCellShape = TCellShape | IUnitTableStaticCell | IUnitTabl
1870
1873
 
1871
1874
  declare type UnitContextType = any;
1872
1875
 
1873
- 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, validationCallback, disabledValidation, allowEmpty, convertBackToStorageUnit, enableCosmeticRounding, enableDisplayRounding, roundDisplayValue, }: IUnitInputProps) => JSX_2.Element;
1876
+ 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;
1874
1877
 
1875
1878
  export declare const UnitTable: ({ table, unitConfig, convertBackToStorageUnit, enableCosmeticRounding, enableDisplayRounding, }: IUnitTableProps) => JSX_2.Element;
1876
1879
 
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import React__default, { useContext, isValidElement, useState, useRef, useEffect
15
15
  import * as PropTypes from "prop-types";
16
16
  import PropTypes__default from "prop-types";
17
17
  import ReactDOM, { createPortal, unstable_batchedUpdates, render } from "react-dom";
18
- import { noop as noop$3, set, get as get$2, isString as isString$3, isNumber as isNumber$1, isBoolean as isBoolean$2, isFunction as isFunction$3, isEmpty, isArray as isArray$1, toNumber, debounce as debounce$2, isObject as isObject$5, isNil, isEqual as isEqual$4 } from "lodash";
18
+ import { noop as noop$3, set, get as get$2, isString as isString$3, isNumber as isNumber$1, isBoolean as isBoolean$2, isFunction as isFunction$3, isEmpty, isArray as isArray$1, toNumber, debounce as debounce$2, isObject as isObject$5, isEqual as isEqual$4 } from "lodash";
19
19
  import { toString as toString$1, isScientificStringNum, roundToPrecision, toNum, validateNumber, cleanNumStr, stripLeadingZeros, roundToFixed, roundByMagnitude, unitFromQuantity, getUnit, KNOWN_UNITS, ALT_UNITS, isValueWithUnit, getValue as getValue$1, withUnit, convertSamePrecision, convertAndGetValue, split as split$1, label as label$b, isValidNum, getAltUnitsListByQuantity, altUnitsList, getUnitsForQuantity, roundByMagnitudeToFixed } from "@oliasoft-open-source/units";
20
20
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
21
21
  function getDefaultExportFromCjs(x2) {
@@ -70233,7 +70233,6 @@ const safeConvertValue = ({
70233
70233
  }) => {
70234
70234
  const rawValue = getValue$1(value);
70235
70235
  const isInvalidInput = isWrongValue(rawValue);
70236
- const availableUnits = ALT_UNITS[unitkey];
70237
70236
  if (isValueWithUnknownUnit(value)) {
70238
70237
  return { value: rawValue };
70239
70238
  }
@@ -70243,9 +70242,6 @@ const safeConvertValue = ({
70243
70242
  if (!isValueWithUnit(value)) {
70244
70243
  return { value };
70245
70244
  }
70246
- if (!(availableUnits == null ? void 0 : availableUnits.includes(getUnit(value)))) {
70247
- return { value: rawValue };
70248
- }
70249
70245
  return convertUnit({
70250
70246
  value,
70251
70247
  unitkey,
@@ -70280,134 +70276,6 @@ const initializeContext = (context2) => {
70280
70276
  UnitContext = context2;
70281
70277
  }
70282
70278
  };
70283
- const extractValue = (value) => {
70284
- if (isNil(value)) return value;
70285
- return isValueWithUnit(value) ? getValue$1(value) : value;
70286
- };
70287
- const PredefinedOptionsMenu = ({
70288
- predefinedOptions,
70289
- displayLayer,
70290
- unitkey: rootUnitKey,
70291
- unitTemplate,
70292
- onPredefinedOptionSelect,
70293
- disabled: disabled2,
70294
- initialPredefinedOption,
70295
- predefinedOptionsMenuState,
70296
- setPredefinedOptionsMenuState,
70297
- testId
70298
- }) => {
70299
- const extractedValue = extractValue(displayLayer == null ? void 0 : displayLayer.value);
70300
- const [foundPredefinedMenuOption, setFoundPredefinedMenuOption] = useState(void 0);
70301
- const convertPredefinedOptions = ({
70302
- value,
70303
- unit: optionUnitKey
70304
- }) => {
70305
- if (!value || !rootUnitKey) return value;
70306
- if (!isValueWithUnit(value)) return value;
70307
- const selectedUnitKey = optionUnitKey || rootUnitKey;
70308
- const preferredOptionUnit = getPreferredUnit(selectedUnitKey, unitTemplate);
70309
- const { value: resultValue } = safeConvertValue({
70310
- value,
70311
- toUnit: preferredOptionUnit,
70312
- unitkey: selectedUnitKey,
70313
- defaultFromUnit: "",
70314
- doNotConvertValue: false
70315
- });
70316
- return withUnit(resultValue, preferredOptionUnit);
70317
- };
70318
- const createPredefinedOption = (el2) => {
70319
- const convertedValue = convertPredefinedOptions(el2);
70320
- const [inputValue = "", unit2 = ""] = split$1(convertedValue);
70321
- return {
70322
- type: MenuType.OPTION,
70323
- inline: true,
70324
- onClick: () => {
70325
- const validation = validateNumber(inputValue);
70326
- const optionState = {
70327
- predefinedSelected: true,
70328
- predefinedOption: el2
70329
- };
70330
- if (validation.valid && !disabled2) {
70331
- setPredefinedOptionsMenuState(PredefinedOptionsMenuState.PREDEFINED);
70332
- onPredefinedOptionSelect(convertedValue, optionState);
70333
- setFoundPredefinedMenuOption(el2);
70334
- }
70335
- },
70336
- label: /* @__PURE__ */ jsxs(Fragment$1, { children: [
70337
- /* @__PURE__ */ jsx(Text, { children: el2.label }),
70338
- /* @__PURE__ */ jsx(Spacer, { width: "20px", height: "0" })
70339
- ] }),
70340
- description: `${inputValue} ${unit2}`,
70341
- selected: isEqual$4(foundPredefinedMenuOption, el2) && predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED
70342
- };
70343
- };
70344
- const initialPredefinedOptionObject = useMemo$1(() => {
70345
- return predefinedOptions.find(
70346
- (option2) => option2.value === initialPredefinedOption || option2.label === initialPredefinedOption || option2.valueKey === initialPredefinedOption
70347
- );
70348
- }, [initialPredefinedOption, predefinedOptions]);
70349
- useEffect(() => {
70350
- if (initialPredefinedOptionObject) {
70351
- setPredefinedOptionsMenuState(PredefinedOptionsMenuState.PREDEFINED);
70352
- setFoundPredefinedMenuOption(initialPredefinedOptionObject);
70353
- onPredefinedOptionSelect(initialPredefinedOptionObject.value, {
70354
- predefinedSelected: true,
70355
- predefinedOption: initialPredefinedOptionObject
70356
- });
70357
- }
70358
- }, [initialPredefinedOptionObject]);
70359
- useEffect(() => {
70360
- const foundOption = predefinedOptions.find((option2) => {
70361
- const convertedValue = convertPredefinedOptions(option2);
70362
- return convertedValue === withUnit(displayLayer == null ? void 0 : displayLayer.value, (displayLayer == null ? void 0 : displayLayer.unit) ?? "");
70363
- });
70364
- if (foundOption) {
70365
- setPredefinedOptionsMenuState(PredefinedOptionsMenuState.PREDEFINED);
70366
- setFoundPredefinedMenuOption(foundOption);
70367
- } else {
70368
- setPredefinedOptionsMenuState(PredefinedOptionsMenuState.CUSTOM);
70369
- setFoundPredefinedMenuOption(void 0);
70370
- }
70371
- }, [extractedValue]);
70372
- const sectionsPredefinedMenu = [
70373
- {
70374
- type: MenuType.OPTION,
70375
- inline: true,
70376
- onClick: () => {
70377
- if (!disabled2) {
70378
- setPredefinedOptionsMenuState(PredefinedOptionsMenuState.CUSTOM);
70379
- }
70380
- },
70381
- label: "Custom",
70382
- selected: predefinedOptionsMenuState === PredefinedOptionsMenuState.CUSTOM
70383
- },
70384
- ...predefinedOptions.map(createPredefinedOption)
70385
- ];
70386
- return /* @__PURE__ */ jsx(
70387
- Menu,
70388
- {
70389
- testId: testId && `${testId}-predefined-menu`,
70390
- maxHeight: 380,
70391
- groupOrder: "first",
70392
- disabled: disabled2,
70393
- menu: {
70394
- colored: true,
70395
- trigger: "Component",
70396
- component: /* @__PURE__ */ jsx(
70397
- Button$1,
70398
- {
70399
- groupOrder: "first",
70400
- active: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED,
70401
- icon: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? "link" : "unlink"
70402
- }
70403
- ),
70404
- small: true,
70405
- sections: sectionsPredefinedMenu
70406
- },
70407
- tooltip: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? foundPredefinedMenuOption == null ? void 0 : foundPredefinedMenuOption.label : ""
70408
- }
70409
- );
70410
- };
70411
70279
  const predefinedMenuActive = "_predefinedMenuActive_ye9w9_1";
70412
70280
  const inputWrapper = "_inputWrapper_ye9w9_4";
70413
70281
  const styles = {
@@ -70432,13 +70300,17 @@ const UnitInput = ({
70432
70300
  onFocus = noop$3,
70433
70301
  onSwitchUnit = noop$3,
70434
70302
  unitTemplate,
70303
+ doNotConvertValue = false,
70435
70304
  testId,
70436
70305
  warning: warning2 = null,
70437
70306
  predefinedOptions,
70438
- initialPredefinedOption = "",
70307
+ initialPredefinedOption = false,
70308
+ shouldLinkAutomaticly = true,
70309
+ selectedPredefinedOptionKey,
70439
70310
  validationCallback = () => ({ name: "", error: null }),
70440
70311
  disabledValidation = false,
70441
70312
  allowEmpty = false,
70313
+ autoValue,
70442
70314
  convertBackToStorageUnit = false,
70443
70315
  enableCosmeticRounding = true,
70444
70316
  enableDisplayRounding = false,
@@ -70446,11 +70318,11 @@ const UnitInput = ({
70446
70318
  }) => {
70447
70319
  const context2 = useUnitContext();
70448
70320
  const runAfterUpdate = useRunAfterUpdate();
70449
- const [predefinedOptionsMenuState, setPredefinedOptionsMenuState] = useState(PredefinedOptionsMenuState.CUSTOM);
70450
70321
  if (typeof value === "number") {
70451
70322
  value = `${value}`;
70452
70323
  }
70453
70324
  const [propValue = "", propUnit = ""] = value !== void 0 ? split$1(value) : [];
70325
+ const propAutoUnit = autoValue ? getUnit(autoValue) : "";
70454
70326
  const preferredUnit = useMemo$1(
70455
70327
  () => getPreferredUnit(unitkey, unitTemplate || (context2 == null ? void 0 : context2.unitTemplate)),
70456
70328
  [unitkey, unitTemplate, context2 == null ? void 0 : context2.unitTemplate]
@@ -70463,15 +70335,39 @@ const UnitInput = ({
70463
70335
  toUnit: initDisplayUnit,
70464
70336
  unitkey,
70465
70337
  defaultFromUnit: propUnit,
70466
- doNotConvertValue: noConversion
70338
+ doNotConvertValue
70339
+ });
70340
+ const { value: convertedAutoValue } = safeConvertValue({
70341
+ value: autoValue,
70342
+ toUnit: initDisplayUnit,
70343
+ unitkey,
70344
+ defaultFromUnit: propAutoUnit,
70345
+ doNotConvertValue
70467
70346
  });
70468
- const initDisplayLayer = convertedValue !== "" ? { value: convertedValue, unit: initDisplayUnit } : { value: propValue, unit: propUnit };
70347
+ const initDisplayLayer = convertedValue !== "" ? { value: convertedValue, unit: initDisplayUnit } : convertedAutoValue !== "" ? { value: convertedAutoValue, unit: initDisplayUnit } : { value: propValue, unit: propUnit };
70469
70348
  const [displayLayer, setDisplayLayer] = useState(initDisplayLayer);
70470
70349
  const derivedAllowEmpty = allowEmpty || (displayLayer == null ? void 0 : displayLayer.value) === void 0;
70471
- const disableInternalErrorValidationMessages = !!disabledValidation || disabled2;
70350
+ const [predefinedOptionsMenuState, setPredefinedOptionsMenuState] = useState(
70351
+ initialPredefinedOption ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM
70352
+ );
70353
+ const isAutoValue = propValue === "" && autoValue;
70354
+ const disableInternalErrorValidationMessages = !!(disabledValidation || autoValue || disabled2);
70355
+ const foundPredefinedMenuOption = predefinedOptions && predefinedOptions.find((el2) => {
70356
+ if (!(el2 == null ? void 0 : el2.value)) return;
70357
+ if (selectedPredefinedOptionKey) {
70358
+ return selectedPredefinedOptionKey === el2.valueKey;
70359
+ }
70360
+ const predefinedMenuItemUnit = isValueWithUnit(el2.value) ? getUnit(el2.value) : "";
70361
+ const { value: resultValue = value } = convertUnit({
70362
+ value: String(value),
70363
+ unitkey,
70364
+ toUnit: predefinedMenuItemUnit
70365
+ });
70366
+ return withUnit(resultValue, predefinedMenuItemUnit) === el2.value;
70367
+ });
70472
70368
  const getAlternativeUnits = () => {
70473
- const valueToList = value ?? "";
70474
- const initToUnit = displayLayer == null ? void 0 : displayLayer.unit;
70369
+ const valueToList = isAutoValue ? autoValue : value ?? "";
70370
+ const initToUnit = displayLayer.unit;
70475
70371
  const shouldConvert = checkConversion({
70476
70372
  value: valueToList,
70477
70373
  unitkey,
@@ -70529,7 +70425,7 @@ const UnitInput = ({
70529
70425
  toUnit: initDisplayUnit,
70530
70426
  unitkey,
70531
70427
  defaultFromUnit: propUnit,
70532
- doNotConvertValue: noConversion
70428
+ doNotConvertValue
70533
70429
  });
70534
70430
  newValue = resultValue;
70535
70431
  newUnit = initDisplayUnit;
@@ -70539,29 +70435,96 @@ const UnitInput = ({
70539
70435
  toUnit: displayLayer.unit,
70540
70436
  unitkey,
70541
70437
  defaultFromUnit: propUnit,
70542
- doNotConvertValue: noConversion
70438
+ doNotConvertValue
70543
70439
  });
70544
70440
  newValue = resultValue;
70545
70441
  newUnit = displayLayer.unit;
70546
70442
  }
70547
- if (newValue !== void 0 && !initialPredefinedOption) {
70443
+ if (newValue !== void 0) {
70548
70444
  setDisplayLayer({ value: newValue, unit: newUnit });
70549
70445
  }
70446
+ if (predefinedOptions) {
70447
+ if (foundPredefinedMenuOption && shouldLinkAutomaticly) {
70448
+ setPredefinedOptionsMenuState(PredefinedOptionsMenuState.PREDEFINED);
70449
+ } else {
70450
+ setPredefinedOptionsMenuState(PredefinedOptionsMenuState.CUSTOM);
70451
+ }
70452
+ }
70550
70453
  }
70551
- }, [initDisplayUnit, value, error2]);
70454
+ }, [initDisplayUnit, value, error2, shouldLinkAutomaticly]);
70552
70455
  const alternativeUnits = getAlternativeUnits();
70553
70456
  const displayUnitLabel = label$b(displayLayer.unit) || displayLayer.unit || "";
70554
70457
  const noConvert = noConversion || !alternativeUnits || alternativeUnits && alternativeUnits.length === 1;
70555
70458
  const stringName = getStringName(name2);
70459
+ let sectionsPredefinedMenu;
70460
+ const createPredefinedOption = (el2) => {
70461
+ const elementValue = (el2 == null ? void 0 : el2.value) ? el2.value : "";
70462
+ const [value2 = "", unit2 = ""] = isValueWithUnit(elementValue) ? split$1(elementValue) : [elementValue];
70463
+ return {
70464
+ type: MenuType.OPTION,
70465
+ inline: true,
70466
+ onClick: () => {
70467
+ const validation = validateNumber(value2);
70468
+ if (validation.valid && !disabled2) {
70469
+ setPredefinedOptionsMenuState(PredefinedOptionsMenuState.PREDEFINED);
70470
+ onChange({
70471
+ target: {
70472
+ value: elementValue,
70473
+ name: typeof name2 === "string" ? name2 : (name2 == null ? void 0 : name2.fieldName) || "",
70474
+ predefinedSelected: true,
70475
+ predefinedOption: el2
70476
+ }
70477
+ });
70478
+ }
70479
+ },
70480
+ label: /* @__PURE__ */ jsxs(Fragment$1, { children: [
70481
+ /* @__PURE__ */ jsx(Text, { children: el2.label }),
70482
+ /* @__PURE__ */ jsx(Spacer, { width: "20px", height: "0" })
70483
+ ] }),
70484
+ description: isValueWithUnit(elementValue) ? `${value2} ${unit2}` : elementValue,
70485
+ selected: foundPredefinedMenuOption === el2 && predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED
70486
+ };
70487
+ };
70488
+ sectionsPredefinedMenu = [
70489
+ {
70490
+ type: MenuType.OPTION,
70491
+ inline: true,
70492
+ onClick: () => {
70493
+ if (predefinedOptionsMenuState !== PredefinedOptionsMenuState.CUSTOM && !disabled2) {
70494
+ onChange({
70495
+ target: {
70496
+ value: withUnit(displayLayer.value, displayLayer.unit),
70497
+ name: typeof name2 === "string" ? name2 : (name2 == null ? void 0 : name2.fieldName) || ""
70498
+ }
70499
+ });
70500
+ }
70501
+ },
70502
+ label: "Custom",
70503
+ selected: predefinedOptionsMenuState === PredefinedOptionsMenuState.CUSTOM
70504
+ }
70505
+ ];
70506
+ if (predefinedOptions == null ? void 0 : predefinedOptions.length) {
70507
+ const dynamicOptions = predefinedOptions.map(createPredefinedOption);
70508
+ sectionsPredefinedMenu = [...sectionsPredefinedMenu, ...dynamicOptions];
70509
+ }
70556
70510
  const getPlaceholder = (placeholder22) => {
70557
- if (isValueWithUnit(placeholder22)) {
70511
+ if (isAutoValue) {
70512
+ const { value: resultValue } = safeConvertValue({
70513
+ value: autoValue,
70514
+ toUnit: displayLayer.unit,
70515
+ unitkey,
70516
+ defaultFromUnit: propAutoUnit,
70517
+ doNotConvertValue
70518
+ });
70519
+ return resultValue;
70520
+ } else if (isValueWithUnit(placeholder22)) {
70558
70521
  const placeholderUnit = getUnit(placeholder22);
70559
70522
  const { value: resultValue } = safeConvertValue({
70560
70523
  value: placeholder22,
70561
70524
  toUnit: displayLayer.unit,
70562
70525
  unitkey,
70563
70526
  defaultFromUnit: placeholderUnit,
70564
- doNotConvertValue: noConversion
70527
+ doNotConvertValue
70565
70528
  });
70566
70529
  return resultValue;
70567
70530
  }
@@ -70573,31 +70536,32 @@ const UnitInput = ({
70573
70536
  className: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? cx$2(styles.predefinedMenuActive) : "",
70574
70537
  children: /* @__PURE__ */ jsxs(InputGroup, { small: small2, width: width2, children: [
70575
70538
  predefinedOptions && /* @__PURE__ */ jsx(
70576
- PredefinedOptionsMenu,
70539
+ Tooltip,
70577
70540
  {
70578
- testId,
70579
- unitTemplate: unitTemplate || (context2 == null ? void 0 : context2.unitTemplate),
70580
- unitkey,
70581
- predefinedOptions,
70582
- displayLayer,
70583
- onPredefinedOptionSelect: (newValue, optionState) => {
70584
- onChange({
70585
- target: {
70586
- value: newValue,
70587
- name: stringName,
70588
- predefinedSelected: optionState == null ? void 0 : optionState.predefinedSelected,
70589
- predefinedOption: optionState == null ? void 0 : optionState.predefinedOption
70541
+ text: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? foundPredefinedMenuOption == null ? void 0 : foundPredefinedMenuOption.label : "",
70542
+ children: /* @__PURE__ */ jsx(
70543
+ Menu,
70544
+ {
70545
+ maxHeight: 380,
70546
+ groupOrder: "first",
70547
+ testId: testId && `${testId}-predefined-menu`,
70548
+ disabled: disabled2,
70549
+ menu: {
70550
+ colored: true,
70551
+ trigger: "Component",
70552
+ component: /* @__PURE__ */ jsx(
70553
+ Button$1,
70554
+ {
70555
+ groupOrder: "first",
70556
+ active: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED,
70557
+ icon: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? "link" : "unlink"
70558
+ }
70559
+ ),
70560
+ small: small2,
70561
+ sections: sectionsPredefinedMenu
70590
70562
  }
70591
- });
70592
- setDisplayLayer({
70593
- value: newValue,
70594
- unit: getUnit(newValue) || displayLayer.unit
70595
- });
70596
- },
70597
- disabled: disabled2,
70598
- initialPredefinedOption,
70599
- predefinedOptionsMenuState,
70600
- setPredefinedOptionsMenuState
70563
+ }
70564
+ )
70601
70565
  }
70602
70566
  ),
70603
70567
  /* @__PURE__ */ jsx("div", { className: styles.inputWrapper, children: /* @__PURE__ */ jsx(
@@ -70645,7 +70609,7 @@ const UnitInput = ({
70645
70609
  inline: true,
70646
70610
  onClick: (evt) => {
70647
70611
  evt.stopPropagation();
70648
- onClickUnit(value2, altUnit);
70612
+ onClickUnit(isAutoValue ? "" : value2, altUnit);
70649
70613
  },
70650
70614
  description: displayUnit,
70651
70615
  selected: displayUnit === displayUnitLabel,