@northlight/ui 2.36.8 → 2.36.10
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/umd/northlight.cjs
CHANGED
|
@@ -1592,7 +1592,10 @@
|
|
|
1592
1592
|
const processColorSchemeBasedOnTheme = ({
|
|
1593
1593
|
currentTheme,
|
|
1594
1594
|
colorScheme
|
|
1595
|
-
}) =>
|
|
1595
|
+
}) => {
|
|
1596
|
+
var _a;
|
|
1597
|
+
return (_a = ramda.path([currentTheme, colorScheme], themeMap)) != null ? _a : colorScheme;
|
|
1598
|
+
};
|
|
1596
1599
|
|
|
1597
1600
|
const Tag$1 = {
|
|
1598
1601
|
parts: ["container"],
|
|
@@ -13460,10 +13463,8 @@
|
|
|
13460
13463
|
"inputRightElement",
|
|
13461
13464
|
"onBlur"
|
|
13462
13465
|
]);
|
|
13463
|
-
const [valueState, setValueState] = React.useState(valueProp);
|
|
13464
|
-
const isControlled = typeof valueProp !== "undefined";
|
|
13465
|
-
const value = isControlled ? valueProp : valueState;
|
|
13466
13466
|
const props = presetMap[preset];
|
|
13467
|
+
const value = valueProp != null ? valueProp : "";
|
|
13467
13468
|
const getNumberFormatValues = (number) => ({
|
|
13468
13469
|
floatValue: number,
|
|
13469
13470
|
formattedValue: reactNumberFormat.numericFormatter(number.toString(), props),
|
|
@@ -13476,18 +13477,15 @@
|
|
|
13476
13477
|
const factor = isPercentage ? 100 : 1;
|
|
13477
13478
|
if (vNum * factor > max) {
|
|
13478
13479
|
const newValue = roundToPrecision(max / factor, numberOfDecimals);
|
|
13479
|
-
setValueState(newValue);
|
|
13480
13480
|
onChange(getNumberFormatValues(newValue));
|
|
13481
13481
|
}
|
|
13482
13482
|
if (vNum * factor < min) {
|
|
13483
13483
|
const newValue = roundToPrecision(min / factor, numberOfDecimals);
|
|
13484
|
-
setValueState(newValue);
|
|
13485
13484
|
onChange(getNumberFormatValues(newValue));
|
|
13486
13485
|
}
|
|
13487
13486
|
};
|
|
13488
13487
|
const onValueChangeHandler = (values, sourceInfo) => {
|
|
13489
13488
|
const newFloatValue = values.floatValue && isPercentage ? roundToPrecision(values.floatValue / 100, numberOfDecimals) : values.floatValue;
|
|
13490
|
-
setValueState(newFloatValue);
|
|
13491
13489
|
onChange(
|
|
13492
13490
|
__spreadProps$3(__spreadValues$k({}, values), {
|
|
13493
13491
|
floatValue: newFloatValue
|
|
@@ -14723,13 +14721,9 @@
|
|
|
14723
14721
|
]);
|
|
14724
14722
|
var _a2, _b2, _c;
|
|
14725
14723
|
const { isOpen, onToggle, onClose } = react.useDisclosure();
|
|
14726
|
-
const [
|
|
14727
|
-
const [
|
|
14724
|
+
const [inputValue, setInputValue] = React.useState(valueProp == null ? void 0 : valueProp.input);
|
|
14725
|
+
const [selectOption, setSelectOption] = React.useState(valueProp == null ? void 0 : valueProp.option);
|
|
14728
14726
|
const [enableSelectInput, setEnableSelectInput] = React.useState(false);
|
|
14729
|
-
const isInputValueControlled = typeof (valueProp == null ? void 0 : valueProp.input) !== "undefined";
|
|
14730
|
-
const inputValue = isInputValueControlled ? valueProp.input : inputValueState;
|
|
14731
|
-
const isOptionControlled = typeof (valueProp == null ? void 0 : valueProp.option) !== "undefined";
|
|
14732
|
-
const selectOption = isOptionControlled ? valueProp.option : selectOptionState;
|
|
14733
14727
|
const buttonRef = React.useRef();
|
|
14734
14728
|
const selectRef = React.useRef();
|
|
14735
14729
|
const getNewValue = (option, input) => {
|
|
@@ -14737,8 +14731,7 @@
|
|
|
14737
14731
|
return ramda.is(Number, input) ? { input: Number(input), option: newValueOption } : { option: newValueOption };
|
|
14738
14732
|
};
|
|
14739
14733
|
const handleInputChange = (newInputvalue) => {
|
|
14740
|
-
const newValue = getNewValue(
|
|
14741
|
-
setInputValueState(newValue.input);
|
|
14734
|
+
const newValue = getNewValue(valueProp == null ? void 0 : valueProp.option, newInputvalue);
|
|
14742
14735
|
onChange == null ? void 0 : onChange(newValue);
|
|
14743
14736
|
};
|
|
14744
14737
|
const handleSelectClose = () => {
|
|
@@ -14750,8 +14743,7 @@
|
|
|
14750
14743
|
};
|
|
14751
14744
|
const handleSelectChange = (selectedOption) => {
|
|
14752
14745
|
if (selectedOption) {
|
|
14753
|
-
|
|
14754
|
-
onChange == null ? void 0 : onChange(getNewValue(selectedOption, inputValue));
|
|
14746
|
+
onChange == null ? void 0 : onChange(getNewValue(selectedOption, valueProp == null ? void 0 : valueProp.input));
|
|
14755
14747
|
if (isOpen) {
|
|
14756
14748
|
handleSelectClose();
|
|
14757
14749
|
}
|
|
@@ -14769,20 +14761,13 @@
|
|
|
14769
14761
|
}
|
|
14770
14762
|
}, [enableSelectInput]);
|
|
14771
14763
|
React.useEffect(() => {
|
|
14772
|
-
|
|
14773
|
-
const
|
|
14774
|
-
const
|
|
14775
|
-
|
|
14776
|
-
|
|
14777
|
-
|
|
14778
|
-
|
|
14779
|
-
if (needsToCorrectInput) {
|
|
14780
|
-
setInputValueState(input);
|
|
14781
|
-
}
|
|
14782
|
-
if (needsToCorrectOption || needsToCorrectInput) {
|
|
14783
|
-
onChange == null ? void 0 : onChange(getNewValue(option, input));
|
|
14784
|
-
}
|
|
14785
|
-
}, [inputValue, defaultToZeroIfEmpty]);
|
|
14764
|
+
var _a3, _b3;
|
|
14765
|
+
const option = (_a3 = valueProp == null ? void 0 : valueProp.option) != null ? _a3 : options[0];
|
|
14766
|
+
const input = defaultToZeroIfEmpty ? (_b3 = valueProp == null ? void 0 : valueProp.input) != null ? _b3 : 0 : valueProp == null ? void 0 : valueProp.input;
|
|
14767
|
+
setSelectOption(option);
|
|
14768
|
+
setInputValue(input);
|
|
14769
|
+
onChange == null ? void 0 : onChange(getNewValue(option, input));
|
|
14770
|
+
}, [valueProp == null ? void 0 : valueProp.input, valueProp == null ? void 0 : valueProp.option, defaultToZeroIfEmpty, options]);
|
|
14786
14771
|
const buttonWidth = (_b2 = (_a2 = buttonRef.current) == null ? void 0 : _a2.offsetWidth) != null ? _b2 : 0;
|
|
14787
14772
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
14788
14773
|
FormattedNumberInput,
|