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

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,9 +1038,11 @@ 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
+ linked?: boolean;
1044
1046
  }
1045
1047
 
1046
1048
  export declare interface IPrintHeaderProps {
@@ -1560,17 +1562,13 @@ export declare interface IUnitInputProps {
1560
1562
  unitkey?: string;
1561
1563
  initUnit?: string;
1562
1564
  noConversion?: boolean;
1563
- doNotConvertValue?: boolean;
1564
1565
  testId?: string;
1565
1566
  warning?: string | boolean | null;
1566
1567
  predefinedOptions?: IPredefinedOption[] | null;
1567
- initialPredefinedOption?: boolean;
1568
- shouldLinkAutomaticly?: boolean;
1569
- selectedPredefinedOptionKey?: string;
1568
+ initialPredefinedOption?: string;
1570
1569
  validationCallback?: (name: string, error: string | null) => any;
1571
1570
  disabledValidation?: boolean;
1572
1571
  allowEmpty?: boolean;
1573
- autoValue?: string;
1574
1572
  onChange?: TOnChangeEventHandler;
1575
1573
  onSwitchUnit?: (unit: string) => void;
1576
1574
  onClick?: MouseEventHandler<HTMLInputElement>;
@@ -1873,7 +1871,7 @@ declare type TUnitTableCellShape = TCellShape | IUnitTableStaticCell | IUnitTabl
1873
1871
 
1874
1872
  declare type UnitContextType = any;
1875
1873
 
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
+ 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;
1877
1875
 
1878
1876
  export declare const UnitTable: ({ table, unitConfig, convertBackToStorageUnit, enableCosmeticRounding, enableDisplayRounding, }: IUnitTableProps) => JSX_2.Element;
1879
1877
 
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, 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, isNil, 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,6 +70233,7 @@ const safeConvertValue = ({
70233
70233
  }) => {
70234
70234
  const rawValue = getValue$1(value);
70235
70235
  const isInvalidInput = isWrongValue(rawValue);
70236
+ const availableUnits = ALT_UNITS[unitkey];
70236
70237
  if (isValueWithUnknownUnit(value)) {
70237
70238
  return { value: rawValue };
70238
70239
  }
@@ -70242,6 +70243,9 @@ const safeConvertValue = ({
70242
70243
  if (!isValueWithUnit(value)) {
70243
70244
  return { value };
70244
70245
  }
70246
+ if (!(availableUnits == null ? void 0 : availableUnits.includes(getUnit(value)))) {
70247
+ return { value: rawValue };
70248
+ }
70245
70249
  return convertUnit({
70246
70250
  value,
70247
70251
  unitkey,
@@ -70276,6 +70280,143 @@ const initializeContext = (context2) => {
70276
70280
  UnitContext = context2;
70277
70281
  }
70278
70282
  };
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, option2.label, option2.valueKey].includes(
70347
+ initialPredefinedOption
70348
+ )
70349
+ );
70350
+ }, [initialPredefinedOption]);
70351
+ useEffect(() => {
70352
+ if (initialPredefinedOptionObject) {
70353
+ setPredefinedOptionsMenuState(PredefinedOptionsMenuState.PREDEFINED);
70354
+ setFoundPredefinedMenuOption(initialPredefinedOptionObject);
70355
+ if (!(initialPredefinedOptionObject == null ? void 0 : initialPredefinedOptionObject.linked)) {
70356
+ onPredefinedOptionSelect(initialPredefinedOptionObject.value, {
70357
+ predefinedSelected: true,
70358
+ predefinedOption: initialPredefinedOptionObject
70359
+ });
70360
+ }
70361
+ }
70362
+ }, [
70363
+ initialPredefinedOptionObject == null ? void 0 : initialPredefinedOptionObject.value,
70364
+ initialPredefinedOptionObject == null ? void 0 : initialPredefinedOptionObject.label
70365
+ ]);
70366
+ useEffect(() => {
70367
+ const foundOption = predefinedOptions.find((option2) => {
70368
+ const convertedValue = convertPredefinedOptions(option2);
70369
+ return convertedValue === withUnit(displayLayer == null ? void 0 : displayLayer.value, (displayLayer == null ? void 0 : displayLayer.unit) ?? "");
70370
+ });
70371
+ if (foundOption || initialPredefinedOptionObject) {
70372
+ setPredefinedOptionsMenuState(PredefinedOptionsMenuState.PREDEFINED);
70373
+ setFoundPredefinedMenuOption(
70374
+ foundOption || initialPredefinedOptionObject
70375
+ );
70376
+ } else {
70377
+ setPredefinedOptionsMenuState(PredefinedOptionsMenuState.CUSTOM);
70378
+ setFoundPredefinedMenuOption(void 0);
70379
+ }
70380
+ }, [extractedValue]);
70381
+ const sectionsPredefinedMenu = [
70382
+ {
70383
+ type: MenuType.OPTION,
70384
+ inline: true,
70385
+ onClick: () => {
70386
+ if (!disabled2) {
70387
+ setPredefinedOptionsMenuState(PredefinedOptionsMenuState.CUSTOM);
70388
+ }
70389
+ },
70390
+ label: "Custom",
70391
+ selected: predefinedOptionsMenuState === PredefinedOptionsMenuState.CUSTOM
70392
+ },
70393
+ ...predefinedOptions.map(createPredefinedOption)
70394
+ ];
70395
+ return /* @__PURE__ */ jsx(
70396
+ Menu,
70397
+ {
70398
+ testId: testId && `${testId}-predefined-menu`,
70399
+ maxHeight: 380,
70400
+ groupOrder: "first",
70401
+ disabled: disabled2,
70402
+ menu: {
70403
+ colored: true,
70404
+ trigger: "Component",
70405
+ component: /* @__PURE__ */ jsx(
70406
+ Button$1,
70407
+ {
70408
+ groupOrder: "first",
70409
+ active: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED,
70410
+ icon: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? "link" : "unlink"
70411
+ }
70412
+ ),
70413
+ small: true,
70414
+ sections: sectionsPredefinedMenu
70415
+ },
70416
+ tooltip: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? foundPredefinedMenuOption == null ? void 0 : foundPredefinedMenuOption.label : ""
70417
+ }
70418
+ );
70419
+ };
70279
70420
  const predefinedMenuActive = "_predefinedMenuActive_ye9w9_1";
70280
70421
  const inputWrapper = "_inputWrapper_ye9w9_4";
70281
70422
  const styles = {
@@ -70300,17 +70441,13 @@ const UnitInput = ({
70300
70441
  onFocus = noop$3,
70301
70442
  onSwitchUnit = noop$3,
70302
70443
  unitTemplate,
70303
- doNotConvertValue = false,
70304
70444
  testId,
70305
70445
  warning: warning2 = null,
70306
70446
  predefinedOptions,
70307
- initialPredefinedOption = false,
70308
- shouldLinkAutomaticly = true,
70309
- selectedPredefinedOptionKey,
70447
+ initialPredefinedOption = "",
70310
70448
  validationCallback = () => ({ name: "", error: null }),
70311
70449
  disabledValidation = false,
70312
70450
  allowEmpty = false,
70313
- autoValue,
70314
70451
  convertBackToStorageUnit = false,
70315
70452
  enableCosmeticRounding = true,
70316
70453
  enableDisplayRounding = false,
@@ -70318,11 +70455,11 @@ const UnitInput = ({
70318
70455
  }) => {
70319
70456
  const context2 = useUnitContext();
70320
70457
  const runAfterUpdate = useRunAfterUpdate();
70458
+ const [predefinedOptionsMenuState, setPredefinedOptionsMenuState] = useState(PredefinedOptionsMenuState.CUSTOM);
70321
70459
  if (typeof value === "number") {
70322
70460
  value = `${value}`;
70323
70461
  }
70324
70462
  const [propValue = "", propUnit = ""] = value !== void 0 ? split$1(value) : [];
70325
- const propAutoUnit = autoValue ? getUnit(autoValue) : "";
70326
70463
  const preferredUnit = useMemo$1(
70327
70464
  () => getPreferredUnit(unitkey, unitTemplate || (context2 == null ? void 0 : context2.unitTemplate)),
70328
70465
  [unitkey, unitTemplate, context2 == null ? void 0 : context2.unitTemplate]
@@ -70335,39 +70472,15 @@ const UnitInput = ({
70335
70472
  toUnit: initDisplayUnit,
70336
70473
  unitkey,
70337
70474
  defaultFromUnit: propUnit,
70338
- doNotConvertValue
70475
+ doNotConvertValue: noConversion
70339
70476
  });
70340
- const { value: convertedAutoValue } = safeConvertValue({
70341
- value: autoValue,
70342
- toUnit: initDisplayUnit,
70343
- unitkey,
70344
- defaultFromUnit: propAutoUnit,
70345
- doNotConvertValue
70346
- });
70347
- const initDisplayLayer = convertedValue !== "" ? { value: convertedValue, unit: initDisplayUnit } : convertedAutoValue !== "" ? { value: convertedAutoValue, unit: initDisplayUnit } : { value: propValue, unit: propUnit };
70477
+ const initDisplayLayer = convertedValue !== "" ? { value: convertedValue, unit: initDisplayUnit } : { value: propValue, unit: propUnit };
70348
70478
  const [displayLayer, setDisplayLayer] = useState(initDisplayLayer);
70349
70479
  const derivedAllowEmpty = allowEmpty || (displayLayer == null ? void 0 : displayLayer.value) === void 0;
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
- });
70480
+ const disableInternalErrorValidationMessages = !!disabledValidation || disabled2;
70368
70481
  const getAlternativeUnits = () => {
70369
- const valueToList = isAutoValue ? autoValue : value ?? "";
70370
- const initToUnit = displayLayer.unit;
70482
+ const valueToList = value ?? "";
70483
+ const initToUnit = displayLayer == null ? void 0 : displayLayer.unit;
70371
70484
  const shouldConvert = checkConversion({
70372
70485
  value: valueToList,
70373
70486
  unitkey,
@@ -70425,7 +70538,7 @@ const UnitInput = ({
70425
70538
  toUnit: initDisplayUnit,
70426
70539
  unitkey,
70427
70540
  defaultFromUnit: propUnit,
70428
- doNotConvertValue
70541
+ doNotConvertValue: noConversion
70429
70542
  });
70430
70543
  newValue = resultValue;
70431
70544
  newUnit = initDisplayUnit;
@@ -70435,96 +70548,29 @@ const UnitInput = ({
70435
70548
  toUnit: displayLayer.unit,
70436
70549
  unitkey,
70437
70550
  defaultFromUnit: propUnit,
70438
- doNotConvertValue
70551
+ doNotConvertValue: noConversion
70439
70552
  });
70440
70553
  newValue = resultValue;
70441
70554
  newUnit = displayLayer.unit;
70442
70555
  }
70443
- if (newValue !== void 0) {
70556
+ if (newValue !== void 0 && !initialPredefinedOption) {
70444
70557
  setDisplayLayer({ value: newValue, unit: newUnit });
70445
70558
  }
70446
- if (predefinedOptions) {
70447
- if (foundPredefinedMenuOption && shouldLinkAutomaticly) {
70448
- setPredefinedOptionsMenuState(PredefinedOptionsMenuState.PREDEFINED);
70449
- } else {
70450
- setPredefinedOptionsMenuState(PredefinedOptionsMenuState.CUSTOM);
70451
- }
70452
- }
70453
70559
  }
70454
- }, [initDisplayUnit, value, error2, shouldLinkAutomaticly]);
70560
+ }, [initDisplayUnit, value, error2]);
70455
70561
  const alternativeUnits = getAlternativeUnits();
70456
70562
  const displayUnitLabel = label$b(displayLayer.unit) || displayLayer.unit || "";
70457
70563
  const noConvert = noConversion || !alternativeUnits || alternativeUnits && alternativeUnits.length === 1;
70458
70564
  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
- }
70510
70565
  const getPlaceholder = (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)) {
70566
+ if (isValueWithUnit(placeholder22)) {
70521
70567
  const placeholderUnit = getUnit(placeholder22);
70522
70568
  const { value: resultValue } = safeConvertValue({
70523
70569
  value: placeholder22,
70524
70570
  toUnit: displayLayer.unit,
70525
70571
  unitkey,
70526
70572
  defaultFromUnit: placeholderUnit,
70527
- doNotConvertValue
70573
+ doNotConvertValue: noConversion
70528
70574
  });
70529
70575
  return resultValue;
70530
70576
  }
@@ -70536,32 +70582,31 @@ const UnitInput = ({
70536
70582
  className: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? cx$2(styles.predefinedMenuActive) : "",
70537
70583
  children: /* @__PURE__ */ jsxs(InputGroup, { small: small2, width: width2, children: [
70538
70584
  predefinedOptions && /* @__PURE__ */ jsx(
70539
- Tooltip,
70585
+ PredefinedOptionsMenu,
70540
70586
  {
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
70587
+ testId,
70588
+ unitTemplate: unitTemplate || (context2 == null ? void 0 : context2.unitTemplate),
70589
+ unitkey,
70590
+ predefinedOptions,
70591
+ displayLayer,
70592
+ onPredefinedOptionSelect: (newValue, optionState) => {
70593
+ onChange({
70594
+ target: {
70595
+ value: newValue,
70596
+ name: stringName,
70597
+ predefinedSelected: optionState == null ? void 0 : optionState.predefinedSelected,
70598
+ predefinedOption: optionState == null ? void 0 : optionState.predefinedOption
70562
70599
  }
70563
- }
70564
- )
70600
+ });
70601
+ setDisplayLayer({
70602
+ value: newValue,
70603
+ unit: getUnit(newValue) || displayLayer.unit
70604
+ });
70605
+ },
70606
+ disabled: disabled2,
70607
+ initialPredefinedOption,
70608
+ predefinedOptionsMenuState,
70609
+ setPredefinedOptionsMenuState
70565
70610
  }
70566
70611
  ),
70567
70612
  /* @__PURE__ */ jsx("div", { className: styles.inputWrapper, children: /* @__PURE__ */ jsx(
@@ -70609,7 +70654,7 @@ const UnitInput = ({
70609
70654
  inline: true,
70610
70655
  onClick: (evt) => {
70611
70656
  evt.stopPropagation();
70612
- onClickUnit(isAutoValue ? "" : value2, altUnit);
70657
+ onClickUnit(value2, altUnit);
70613
70658
  },
70614
70659
  description: displayUnit,
70615
70660
  selected: displayUnit === displayUnitLabel,