@oliasoft-open-source/react-ui-library 4.12.0-beta-3 → 4.12.0
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/404.html +1 -0
- package/dist/assets/{index-BaYhOc6M.css → index-BU9wzZv9.css} +5 -37
- package/dist/assets/{index-BMWyiwz3.js → index-BVCFmQTa.js} +145 -169
- package/dist/index.d.ts +6 -2
- package/dist/index.html +1 -1
- package/dist/index.js +136 -135
- package/dist/index.js.map +1 -1
- package/dist/storybook/assets/{Color-KGDBMAHA-BU5Cvr93.js → Color-KGDBMAHA-DX793BVg.js} +1 -1
- package/dist/storybook/assets/{DocsRenderer-PKQXORMH-giM41WN8.js → DocsRenderer-PKQXORMH-CaajuS1x.js} +1 -1
- package/dist/storybook/assets/{buttons-and-links-BA3MNFjq.js → buttons-and-links-BBI2j2NQ.js} +1 -1
- package/dist/storybook/assets/{chunk-HLWAVYOI-Dvbg03uT.js → chunk-HLWAVYOI-CMOqkjap.js} +1 -1
- package/dist/storybook/assets/{color-DIyQ13kP.js → color-ClSYef1s.js} +1 -1
- package/dist/storybook/assets/{iframe-B0e2q2Zd.js → iframe-DoiQVlDm.js} +2 -2
- package/dist/storybook/assets/{index-BXJ79Lvz.js → index-C7wMBNKk.js} +1 -1
- package/dist/storybook/assets/{index-BlyDuQBv.js → index-DR_rkfUM.js} +88 -88
- package/dist/storybook/assets/{input-validation-CLZKtfoW.js → input-validation-DP5gVriP.js} +1 -1
- package/dist/storybook/assets/{inputs-DlW6Jeem.js → inputs-pjdW6Iyv.js} +1 -1
- package/dist/storybook/assets/{layout-forms-C6ZH-nYk.js → layout-forms-Bu6pFVA8.js} +1 -1
- package/dist/storybook/assets/{layout-general-CWqOMwXA.js → layout-general-B0LrW-Ux.js} +1 -1
- package/dist/storybook/assets/{padding-and-spacing-CfnXk0Zn.js → padding-and-spacing-Ro5zno4Z.js} +1 -1
- package/dist/storybook/assets/{preview-b9pkIJl_.js → preview-D81P9wUG.js} +2 -2
- package/dist/storybook/assets/{preview-jWpKVqju.js → preview-DxVss8pC.js} +1 -1
- package/dist/storybook/iframe.html +1 -1
- package/dist/storybook/project.json +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1569,13 +1569,17 @@ export declare interface IUnitInputProps {
|
|
|
1569
1569
|
unitkey?: string;
|
|
1570
1570
|
initUnit?: string;
|
|
1571
1571
|
noConversion?: boolean;
|
|
1572
|
+
doNotConvertValue?: boolean;
|
|
1572
1573
|
testId?: string;
|
|
1573
1574
|
warning?: string | boolean | null;
|
|
1574
1575
|
predefinedOptions?: IPredefinedOption[] | null;
|
|
1575
|
-
initialPredefinedOption?:
|
|
1576
|
+
initialPredefinedOption?: boolean;
|
|
1577
|
+
shouldLinkAutomaticly?: boolean;
|
|
1578
|
+
selectedPredefinedOptionKey?: string;
|
|
1576
1579
|
validationCallback?: (name: string, error: string | null) => any;
|
|
1577
1580
|
disabledValidation?: boolean;
|
|
1578
1581
|
allowEmpty?: boolean;
|
|
1582
|
+
autoValue?: string;
|
|
1579
1583
|
onChange?: (event: TChangeEvent | ICustomChangeEvent) => void;
|
|
1580
1584
|
onSwitchUnit?: (unit: string) => void;
|
|
1581
1585
|
onClick?: MouseEventHandler<HTMLInputElement>;
|
|
@@ -1861,7 +1865,7 @@ declare type TUnitTableCellShape = TCellShape | IUnitTableStaticCell | IUnitTabl
|
|
|
1861
1865
|
|
|
1862
1866
|
declare type UnitContextType = any;
|
|
1863
1867
|
|
|
1864
|
-
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, }: IUnitInputProps) => JSX_2.Element;
|
|
1868
|
+
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, }: IUnitInputProps) => JSX_2.Element;
|
|
1865
1869
|
|
|
1866
1870
|
export declare const UnitTable: ({ table, unitConfig, convertBackToStorageUnit, enableCosmeticRounding, enableDisplayRounding, }: IUnitTableProps) => JSX_2.Element;
|
|
1867
1871
|
|
package/dist/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><head><title>React UI Library</title><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1" user-scalable="no"><meta name="apple-mobile-web-app-capable" content="yes"><script type="module" crossorigin src="/react-ui-library/assets/index-
|
|
1
|
+
<!doctype html><head><title>React UI Library</title><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1" user-scalable="no"><meta name="apple-mobile-web-app-capable" content="yes"><script type="module" crossorigin src="/react-ui-library/assets/index-BVCFmQTa.js"></script><link rel="stylesheet" crossorigin href="/react-ui-library/assets/index-BU9wzZv9.css"></head><body><div id="content"></div></body>
|
package/dist/index.js
CHANGED
|
@@ -55652,6 +55652,10 @@ const NumberInput = ({
|
|
|
55652
55652
|
const validateInputValue = (value2) => {
|
|
55653
55653
|
const validation = validateNumber(value2);
|
|
55654
55654
|
const isPlaceholder = placeholder3 && isEmptyNullOrUndefined(value2);
|
|
55655
|
+
const isInfinity = [Infinity, -Infinity].includes(Number(value2));
|
|
55656
|
+
if (isInfinity) {
|
|
55657
|
+
return { valid: true, errors: [] };
|
|
55658
|
+
}
|
|
55655
55659
|
if (isPlaceholder) {
|
|
55656
55660
|
return { valid: true, errors: [] };
|
|
55657
55661
|
}
|
|
@@ -70248,109 +70252,6 @@ const initializeContext = (context2) => {
|
|
|
70248
70252
|
UnitContext = context2;
|
|
70249
70253
|
}
|
|
70250
70254
|
};
|
|
70251
|
-
const PredefinedOptionsMenu = ({
|
|
70252
|
-
predefinedOptions,
|
|
70253
|
-
value = "",
|
|
70254
|
-
onPredefinedOptionSelect,
|
|
70255
|
-
disabled: disabled2,
|
|
70256
|
-
initialPredefinedOption,
|
|
70257
|
-
predefinedOptionsMenuState,
|
|
70258
|
-
setPredefinedOptionsMenuState,
|
|
70259
|
-
testId
|
|
70260
|
-
}) => {
|
|
70261
|
-
const extractedValue = isValueWithUnit(value) ? getValue$1(value) : value;
|
|
70262
|
-
const [foundPredefinedMenuOption, setFoundPredefinedMenuOption] = useState(void 0);
|
|
70263
|
-
const createPredefinedOption = (el2) => {
|
|
70264
|
-
const elementValue = (el2 == null ? void 0 : el2.value) ? el2.value : "";
|
|
70265
|
-
const [inputValue = "", unit2 = ""] = isValueWithUnit(elementValue) ? split$1(elementValue) : [elementValue];
|
|
70266
|
-
return {
|
|
70267
|
-
type: MenuType.OPTION,
|
|
70268
|
-
inline: true,
|
|
70269
|
-
onClick: () => {
|
|
70270
|
-
const validation = validateNumber(inputValue);
|
|
70271
|
-
if (validation.valid && !disabled2) {
|
|
70272
|
-
setPredefinedOptionsMenuState(PredefinedOptionsMenuState.PREDEFINED);
|
|
70273
|
-
onPredefinedOptionSelect(elementValue);
|
|
70274
|
-
setFoundPredefinedMenuOption(el2);
|
|
70275
|
-
}
|
|
70276
|
-
},
|
|
70277
|
-
label: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
70278
|
-
/* @__PURE__ */ jsx(Text, { children: el2.label }),
|
|
70279
|
-
/* @__PURE__ */ jsx(Spacer, { width: "20px", height: "0" })
|
|
70280
|
-
] }),
|
|
70281
|
-
description: isValueWithUnit(elementValue) ? `${inputValue} ${unit2}` : elementValue,
|
|
70282
|
-
selected: extractedValue === elementValue && predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED
|
|
70283
|
-
};
|
|
70284
|
-
};
|
|
70285
|
-
const initialPredefinedOptionObject = useMemo$1(() => {
|
|
70286
|
-
return predefinedOptions.find(
|
|
70287
|
-
(option2) => option2.value === initialPredefinedOption || option2.label === initialPredefinedOption || option2.valueKey === initialPredefinedOption
|
|
70288
|
-
);
|
|
70289
|
-
}, [initialPredefinedOption, predefinedOptions]);
|
|
70290
|
-
useEffect(() => {
|
|
70291
|
-
if (initialPredefinedOptionObject) {
|
|
70292
|
-
setPredefinedOptionsMenuState(PredefinedOptionsMenuState.PREDEFINED);
|
|
70293
|
-
setFoundPredefinedMenuOption(initialPredefinedOptionObject);
|
|
70294
|
-
onPredefinedOptionSelect(initialPredefinedOptionObject.value);
|
|
70295
|
-
}
|
|
70296
|
-
}, [initialPredefinedOptionObject]);
|
|
70297
|
-
useEffect(() => {
|
|
70298
|
-
const foundOption = predefinedOptions.find((option2) => {
|
|
70299
|
-
const currentValue = isValueWithUnit((option2 == null ? void 0 : option2.value) ?? "") ? getValue$1((option2 == null ? void 0 : option2.value) ?? "") : option2.value;
|
|
70300
|
-
return currentValue === extractedValue;
|
|
70301
|
-
});
|
|
70302
|
-
if (foundOption) {
|
|
70303
|
-
setPredefinedOptionsMenuState(PredefinedOptionsMenuState.PREDEFINED);
|
|
70304
|
-
setFoundPredefinedMenuOption(foundOption);
|
|
70305
|
-
} else {
|
|
70306
|
-
setPredefinedOptionsMenuState(PredefinedOptionsMenuState.CUSTOM);
|
|
70307
|
-
setFoundPredefinedMenuOption(void 0);
|
|
70308
|
-
}
|
|
70309
|
-
}, [extractedValue, predefinedOptions]);
|
|
70310
|
-
const sectionsPredefinedMenu = [
|
|
70311
|
-
{
|
|
70312
|
-
type: MenuType.OPTION,
|
|
70313
|
-
inline: true,
|
|
70314
|
-
onClick: () => {
|
|
70315
|
-
if (!disabled2) {
|
|
70316
|
-
setPredefinedOptionsMenuState(PredefinedOptionsMenuState.CUSTOM);
|
|
70317
|
-
}
|
|
70318
|
-
},
|
|
70319
|
-
label: "Custom",
|
|
70320
|
-
selected: predefinedOptionsMenuState === PredefinedOptionsMenuState.CUSTOM
|
|
70321
|
-
},
|
|
70322
|
-
...predefinedOptions.map(createPredefinedOption)
|
|
70323
|
-
];
|
|
70324
|
-
return /* @__PURE__ */ jsx(
|
|
70325
|
-
Tooltip,
|
|
70326
|
-
{
|
|
70327
|
-
text: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? foundPredefinedMenuOption == null ? void 0 : foundPredefinedMenuOption.label : "",
|
|
70328
|
-
children: /* @__PURE__ */ jsx(
|
|
70329
|
-
Menu,
|
|
70330
|
-
{
|
|
70331
|
-
testId: testId && `${testId}-predefined-menu`,
|
|
70332
|
-
maxHeight: 380,
|
|
70333
|
-
groupOrder: "first",
|
|
70334
|
-
disabled: disabled2,
|
|
70335
|
-
menu: {
|
|
70336
|
-
colored: true,
|
|
70337
|
-
trigger: "Component",
|
|
70338
|
-
component: /* @__PURE__ */ jsx(
|
|
70339
|
-
Button$1,
|
|
70340
|
-
{
|
|
70341
|
-
groupOrder: "first",
|
|
70342
|
-
active: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED,
|
|
70343
|
-
icon: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? "link" : "unlink"
|
|
70344
|
-
}
|
|
70345
|
-
),
|
|
70346
|
-
small: true,
|
|
70347
|
-
sections: sectionsPredefinedMenu
|
|
70348
|
-
}
|
|
70349
|
-
}
|
|
70350
|
-
)
|
|
70351
|
-
}
|
|
70352
|
-
);
|
|
70353
|
-
};
|
|
70354
70255
|
const predefinedMenuActive = "_predefinedMenuActive_ye9w9_1";
|
|
70355
70256
|
const inputWrapper = "_inputWrapper_ye9w9_4";
|
|
70356
70257
|
const styles = {
|
|
@@ -70375,24 +70276,28 @@ const UnitInput = ({
|
|
|
70375
70276
|
onFocus = noop$3,
|
|
70376
70277
|
onSwitchUnit = noop$3,
|
|
70377
70278
|
unitTemplate,
|
|
70279
|
+
doNotConvertValue = false,
|
|
70378
70280
|
testId,
|
|
70379
70281
|
warning: warning2 = null,
|
|
70380
70282
|
predefinedOptions,
|
|
70381
|
-
initialPredefinedOption =
|
|
70283
|
+
initialPredefinedOption = false,
|
|
70284
|
+
shouldLinkAutomaticly = true,
|
|
70285
|
+
selectedPredefinedOptionKey,
|
|
70382
70286
|
validationCallback = () => ({ name: "", error: null }),
|
|
70383
70287
|
disabledValidation = false,
|
|
70384
70288
|
allowEmpty = false,
|
|
70289
|
+
autoValue,
|
|
70385
70290
|
convertBackToStorageUnit = false,
|
|
70386
70291
|
enableCosmeticRounding = true,
|
|
70387
70292
|
enableDisplayRounding = false
|
|
70388
70293
|
}) => {
|
|
70389
70294
|
const context2 = useUnitContext();
|
|
70390
70295
|
const runAfterUpdate = useRunAfterUpdate();
|
|
70391
|
-
const [predefinedOptionsMenuState, setPredefinedOptionsMenuState] = useState(PredefinedOptionsMenuState.CUSTOM);
|
|
70392
70296
|
if (typeof value === "number") {
|
|
70393
70297
|
value = `${value}`;
|
|
70394
70298
|
}
|
|
70395
70299
|
const [propValue = "", propUnit = ""] = value !== void 0 ? split$1(value) : [];
|
|
70300
|
+
const propAutoUnit = autoValue ? getUnit(autoValue) : "";
|
|
70396
70301
|
const preferredUnit = useMemo$1(
|
|
70397
70302
|
() => getPreferredUnit(unitkey, unitTemplate || (context2 == null ? void 0 : context2.unitTemplate)),
|
|
70398
70303
|
[unitkey, unitTemplate, context2 == null ? void 0 : context2.unitTemplate]
|
|
@@ -70405,14 +70310,38 @@ const UnitInput = ({
|
|
|
70405
70310
|
toUnit: initDisplayUnit,
|
|
70406
70311
|
unitkey,
|
|
70407
70312
|
defaultFromUnit: propUnit,
|
|
70408
|
-
doNotConvertValue
|
|
70313
|
+
doNotConvertValue
|
|
70409
70314
|
});
|
|
70410
|
-
const
|
|
70315
|
+
const { value: convertedAutoValue } = safeConvertValue({
|
|
70316
|
+
value: autoValue,
|
|
70317
|
+
toUnit: initDisplayUnit,
|
|
70318
|
+
unitkey,
|
|
70319
|
+
defaultFromUnit: propAutoUnit,
|
|
70320
|
+
doNotConvertValue
|
|
70321
|
+
});
|
|
70322
|
+
const initDisplayLayer = convertedValue !== "" ? { value: convertedValue, unit: initDisplayUnit } : convertedAutoValue !== "" ? { value: convertedAutoValue, unit: initDisplayUnit } : { value: propValue, unit: propUnit };
|
|
70411
70323
|
const [displayLayer, setDisplayLayer] = useState(initDisplayLayer);
|
|
70412
70324
|
const derivedAllowEmpty = allowEmpty || (displayLayer == null ? void 0 : displayLayer.value) === void 0;
|
|
70413
|
-
const
|
|
70325
|
+
const [predefinedOptionsMenuState, setPredefinedOptionsMenuState] = useState(
|
|
70326
|
+
initialPredefinedOption ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM
|
|
70327
|
+
);
|
|
70328
|
+
const isAutoValue = propValue === "" && autoValue;
|
|
70329
|
+
const disableInternalErrorValidationMessages = !!(disabledValidation || autoValue);
|
|
70330
|
+
const foundPredefinedMenuOption = predefinedOptions && predefinedOptions.find((el2) => {
|
|
70331
|
+
if (!(el2 == null ? void 0 : el2.value)) return;
|
|
70332
|
+
if (selectedPredefinedOptionKey) {
|
|
70333
|
+
return selectedPredefinedOptionKey === el2.valueKey;
|
|
70334
|
+
}
|
|
70335
|
+
const predefinedMenuItemUnit = isValueWithUnit(el2.value) ? getUnit(el2.value) : "";
|
|
70336
|
+
const { value: resultValue = value } = convertUnit({
|
|
70337
|
+
value: String(value),
|
|
70338
|
+
unitkey,
|
|
70339
|
+
toUnit: predefinedMenuItemUnit
|
|
70340
|
+
});
|
|
70341
|
+
return withUnit(resultValue, predefinedMenuItemUnit) === el2.value;
|
|
70342
|
+
});
|
|
70414
70343
|
const getAlternativeUnits = () => {
|
|
70415
|
-
const valueToList = value ?? "";
|
|
70344
|
+
const valueToList = isAutoValue ? autoValue : value ?? "";
|
|
70416
70345
|
const initToUnit = displayLayer.unit;
|
|
70417
70346
|
const shouldConvert = checkConversion({
|
|
70418
70347
|
value: valueToList,
|
|
@@ -70471,7 +70400,7 @@ const UnitInput = ({
|
|
|
70471
70400
|
toUnit: initDisplayUnit,
|
|
70472
70401
|
unitkey,
|
|
70473
70402
|
defaultFromUnit: propUnit,
|
|
70474
|
-
doNotConvertValue
|
|
70403
|
+
doNotConvertValue
|
|
70475
70404
|
});
|
|
70476
70405
|
newValue = resultValue;
|
|
70477
70406
|
newUnit = initDisplayUnit;
|
|
@@ -70481,29 +70410,96 @@ const UnitInput = ({
|
|
|
70481
70410
|
toUnit: displayLayer.unit,
|
|
70482
70411
|
unitkey,
|
|
70483
70412
|
defaultFromUnit: propUnit,
|
|
70484
|
-
doNotConvertValue
|
|
70413
|
+
doNotConvertValue
|
|
70485
70414
|
});
|
|
70486
70415
|
newValue = resultValue;
|
|
70487
70416
|
newUnit = displayLayer.unit;
|
|
70488
70417
|
}
|
|
70489
|
-
if (newValue !== void 0
|
|
70418
|
+
if (newValue !== void 0) {
|
|
70490
70419
|
setDisplayLayer({ value: newValue, unit: newUnit });
|
|
70491
70420
|
}
|
|
70421
|
+
if (predefinedOptions) {
|
|
70422
|
+
if (foundPredefinedMenuOption && shouldLinkAutomaticly) {
|
|
70423
|
+
setPredefinedOptionsMenuState(PredefinedOptionsMenuState.PREDEFINED);
|
|
70424
|
+
} else {
|
|
70425
|
+
setPredefinedOptionsMenuState(PredefinedOptionsMenuState.CUSTOM);
|
|
70426
|
+
}
|
|
70427
|
+
}
|
|
70492
70428
|
}
|
|
70493
|
-
}, [initDisplayUnit, value, error2]);
|
|
70429
|
+
}, [initDisplayUnit, value, error2, shouldLinkAutomaticly]);
|
|
70494
70430
|
const alternativeUnits = getAlternativeUnits();
|
|
70495
70431
|
const displayUnitLabel = label$b(displayLayer.unit) || displayLayer.unit || "";
|
|
70496
70432
|
const noConvert = noConversion || !alternativeUnits || alternativeUnits && alternativeUnits.length === 1;
|
|
70497
70433
|
const stringName = getStringName(name2);
|
|
70434
|
+
let sectionsPredefinedMenu;
|
|
70435
|
+
const createPredefinedOption = (el2) => {
|
|
70436
|
+
const elementValue = (el2 == null ? void 0 : el2.value) ? el2.value : "";
|
|
70437
|
+
const [value2 = "", unit2 = ""] = isValueWithUnit(elementValue) ? split$1(elementValue) : [elementValue];
|
|
70438
|
+
return {
|
|
70439
|
+
type: MenuType.OPTION,
|
|
70440
|
+
inline: true,
|
|
70441
|
+
onClick: () => {
|
|
70442
|
+
const validation = validateNumber(value2);
|
|
70443
|
+
if (validation.valid && !disabled2) {
|
|
70444
|
+
setPredefinedOptionsMenuState(PredefinedOptionsMenuState.PREDEFINED);
|
|
70445
|
+
onChange({
|
|
70446
|
+
target: {
|
|
70447
|
+
value: elementValue,
|
|
70448
|
+
name: typeof name2 === "string" ? name2 : (name2 == null ? void 0 : name2.fieldName) || "",
|
|
70449
|
+
predefinedSelected: true,
|
|
70450
|
+
predefinedOption: el2
|
|
70451
|
+
}
|
|
70452
|
+
});
|
|
70453
|
+
}
|
|
70454
|
+
},
|
|
70455
|
+
label: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
70456
|
+
/* @__PURE__ */ jsx(Text, { children: el2.label }),
|
|
70457
|
+
/* @__PURE__ */ jsx(Spacer, { width: "20px", height: "0" })
|
|
70458
|
+
] }),
|
|
70459
|
+
description: isValueWithUnit(elementValue) ? `${value2} ${unit2}` : elementValue,
|
|
70460
|
+
selected: foundPredefinedMenuOption === el2 && predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED
|
|
70461
|
+
};
|
|
70462
|
+
};
|
|
70463
|
+
sectionsPredefinedMenu = [
|
|
70464
|
+
{
|
|
70465
|
+
type: MenuType.OPTION,
|
|
70466
|
+
inline: true,
|
|
70467
|
+
onClick: () => {
|
|
70468
|
+
if (predefinedOptionsMenuState !== PredefinedOptionsMenuState.CUSTOM && !disabled2) {
|
|
70469
|
+
onChange({
|
|
70470
|
+
target: {
|
|
70471
|
+
value: withUnit(displayLayer.value, displayLayer.unit),
|
|
70472
|
+
name: typeof name2 === "string" ? name2 : (name2 == null ? void 0 : name2.fieldName) || ""
|
|
70473
|
+
}
|
|
70474
|
+
});
|
|
70475
|
+
}
|
|
70476
|
+
},
|
|
70477
|
+
label: "Custom",
|
|
70478
|
+
selected: predefinedOptionsMenuState === PredefinedOptionsMenuState.CUSTOM
|
|
70479
|
+
}
|
|
70480
|
+
];
|
|
70481
|
+
if (predefinedOptions == null ? void 0 : predefinedOptions.length) {
|
|
70482
|
+
const dynamicOptions = predefinedOptions.map(createPredefinedOption);
|
|
70483
|
+
sectionsPredefinedMenu = [...sectionsPredefinedMenu, ...dynamicOptions];
|
|
70484
|
+
}
|
|
70498
70485
|
const getPlaceholder = (placeholder22) => {
|
|
70499
|
-
if (
|
|
70486
|
+
if (isAutoValue) {
|
|
70487
|
+
const { value: resultValue } = safeConvertValue({
|
|
70488
|
+
value: autoValue,
|
|
70489
|
+
toUnit: displayLayer.unit,
|
|
70490
|
+
unitkey,
|
|
70491
|
+
defaultFromUnit: propAutoUnit,
|
|
70492
|
+
doNotConvertValue
|
|
70493
|
+
});
|
|
70494
|
+
return resultValue;
|
|
70495
|
+
} else if (isValueWithUnit(placeholder22)) {
|
|
70500
70496
|
const placeholderUnit = getUnit(placeholder22);
|
|
70501
70497
|
const { value: resultValue } = safeConvertValue({
|
|
70502
70498
|
value: placeholder22,
|
|
70503
70499
|
toUnit: displayLayer.unit,
|
|
70504
70500
|
unitkey,
|
|
70505
70501
|
defaultFromUnit: placeholderUnit,
|
|
70506
|
-
doNotConvertValue
|
|
70502
|
+
doNotConvertValue
|
|
70507
70503
|
});
|
|
70508
70504
|
return resultValue;
|
|
70509
70505
|
}
|
|
@@ -70515,27 +70511,32 @@ const UnitInput = ({
|
|
|
70515
70511
|
className: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? cx$2(styles.predefinedMenuActive) : "",
|
|
70516
70512
|
children: /* @__PURE__ */ jsxs(InputGroup, { small: small2, width: width2, children: [
|
|
70517
70513
|
predefinedOptions && /* @__PURE__ */ jsx(
|
|
70518
|
-
|
|
70514
|
+
Tooltip,
|
|
70519
70515
|
{
|
|
70520
|
-
|
|
70521
|
-
|
|
70522
|
-
|
|
70523
|
-
|
|
70524
|
-
|
|
70525
|
-
|
|
70526
|
-
|
|
70527
|
-
|
|
70516
|
+
text: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? foundPredefinedMenuOption == null ? void 0 : foundPredefinedMenuOption.label : "",
|
|
70517
|
+
children: /* @__PURE__ */ jsx(
|
|
70518
|
+
Menu,
|
|
70519
|
+
{
|
|
70520
|
+
maxHeight: 380,
|
|
70521
|
+
groupOrder: "first",
|
|
70522
|
+
testId: testId && `${testId}-predefined-menu`,
|
|
70523
|
+
disabled: disabled2,
|
|
70524
|
+
menu: {
|
|
70525
|
+
colored: true,
|
|
70526
|
+
trigger: "Component",
|
|
70527
|
+
component: /* @__PURE__ */ jsx(
|
|
70528
|
+
Button$1,
|
|
70529
|
+
{
|
|
70530
|
+
groupOrder: "first",
|
|
70531
|
+
active: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED,
|
|
70532
|
+
icon: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? "link" : "unlink"
|
|
70533
|
+
}
|
|
70534
|
+
),
|
|
70535
|
+
small: small2,
|
|
70536
|
+
sections: sectionsPredefinedMenu
|
|
70528
70537
|
}
|
|
70529
|
-
}
|
|
70530
|
-
|
|
70531
|
-
value: newValue,
|
|
70532
|
-
unit: getUnit(newValue) || displayLayer.unit
|
|
70533
|
-
});
|
|
70534
|
-
},
|
|
70535
|
-
disabled: disabled2,
|
|
70536
|
-
initialPredefinedOption,
|
|
70537
|
-
predefinedOptionsMenuState,
|
|
70538
|
-
setPredefinedOptionsMenuState
|
|
70538
|
+
}
|
|
70539
|
+
)
|
|
70539
70540
|
}
|
|
70540
70541
|
),
|
|
70541
70542
|
/* @__PURE__ */ jsx("div", { className: styles.inputWrapper, children: /* @__PURE__ */ jsx(
|
|
@@ -70582,7 +70583,7 @@ const UnitInput = ({
|
|
|
70582
70583
|
inline: true,
|
|
70583
70584
|
onClick: (evt) => {
|
|
70584
70585
|
evt.stopPropagation();
|
|
70585
|
-
onClickUnit(value2, altUnit);
|
|
70586
|
+
onClickUnit(isAutoValue ? "" : value2, altUnit);
|
|
70586
70587
|
},
|
|
70587
70588
|
description: displayUnit,
|
|
70588
70589
|
selected: displayUnit === displayUnitLabel,
|