@northlight/ui 2.39.0 → 2.39.2
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/es/northlight.js
CHANGED
|
@@ -7980,7 +7980,8 @@ const DateRangePicker = (props) => {
|
|
|
7980
7980
|
defaultDateRange,
|
|
7981
7981
|
CustomResetButton,
|
|
7982
7982
|
onCancelChanges,
|
|
7983
|
-
"data-testid": dataTestId
|
|
7983
|
+
"data-testid": dataTestId,
|
|
7984
|
+
defaultOpen = false
|
|
7984
7985
|
} = props;
|
|
7985
7986
|
const ref = useRef();
|
|
7986
7987
|
const { group } = useMultiStyleConfig("DatePicker");
|
|
@@ -8006,7 +8007,8 @@ const DateRangePicker = (props) => {
|
|
|
8006
8007
|
isDateUnavailable: props.isDateUnavailable,
|
|
8007
8008
|
allowsNonContiguousRanges: props.allowsNonContiguousRanges,
|
|
8008
8009
|
shouldCloseOnSelect: false,
|
|
8009
|
-
hideTimeZone: true
|
|
8010
|
+
hideTimeZone: true,
|
|
8011
|
+
defaultOpen
|
|
8010
8012
|
});
|
|
8011
8013
|
const {
|
|
8012
8014
|
groupProps,
|
|
@@ -8132,7 +8134,7 @@ const DateRangePicker = (props) => {
|
|
|
8132
8134
|
RangeCalendar,
|
|
8133
8135
|
__spreadProps$g(__spreadValues$1q({}, calendarProps), {
|
|
8134
8136
|
resetDate: cancelOrResetDateChange,
|
|
8135
|
-
handleClose,
|
|
8137
|
+
handleClose: handleModalClose,
|
|
8136
8138
|
fiscalStartMonth: fiscalStartMonth || 0,
|
|
8137
8139
|
fiscalStartDay: fiscalStartDay || 0,
|
|
8138
8140
|
isClearable,
|
|
@@ -13820,7 +13822,7 @@ const FormattedNumberInput = (_a) => {
|
|
|
13820
13822
|
isPercentage = false,
|
|
13821
13823
|
onChange = identity,
|
|
13822
13824
|
value: valueProp,
|
|
13823
|
-
numberOfDecimals
|
|
13825
|
+
numberOfDecimals,
|
|
13824
13826
|
max = Infinity,
|
|
13825
13827
|
min = -Infinity,
|
|
13826
13828
|
inputLeftElement,
|
|
@@ -13840,6 +13842,7 @@ const FormattedNumberInput = (_a) => {
|
|
|
13840
13842
|
]);
|
|
13841
13843
|
const props = presetMap[preset];
|
|
13842
13844
|
const value = valueProp != null ? valueProp : "";
|
|
13845
|
+
const defaultNumberOfDecimals = defaultTo(2, numberOfDecimals);
|
|
13843
13846
|
const getNumberFormatValues = (number) => ({
|
|
13844
13847
|
floatValue: number,
|
|
13845
13848
|
formattedValue: numericFormatter(number.toString(), props),
|
|
@@ -13849,18 +13852,22 @@ const FormattedNumberInput = (_a) => {
|
|
|
13849
13852
|
if (isNil(value))
|
|
13850
13853
|
return;
|
|
13851
13854
|
const vNum = typeof value === "string" ? parseFloat(value) : value;
|
|
13855
|
+
if (isNil(numberOfDecimals) && !isPercentage) {
|
|
13856
|
+
onChange(getNumberFormatValues(vNum));
|
|
13857
|
+
return;
|
|
13858
|
+
}
|
|
13852
13859
|
const factor = isPercentage ? 100 : 1;
|
|
13853
13860
|
if (vNum * factor > max) {
|
|
13854
|
-
const newValue = roundToPrecision(max / factor,
|
|
13861
|
+
const newValue = roundToPrecision(max / factor, defaultNumberOfDecimals);
|
|
13855
13862
|
onChange(getNumberFormatValues(newValue));
|
|
13856
13863
|
}
|
|
13857
13864
|
if (vNum * factor < min) {
|
|
13858
|
-
const newValue = roundToPrecision(min / factor,
|
|
13865
|
+
const newValue = roundToPrecision(min / factor, defaultNumberOfDecimals);
|
|
13859
13866
|
onChange(getNumberFormatValues(newValue));
|
|
13860
13867
|
}
|
|
13861
13868
|
};
|
|
13862
13869
|
const onValueChangeHandler = (values, sourceInfo) => {
|
|
13863
|
-
const newFloatValue = values.floatValue && isPercentage ? roundToPrecision(values.floatValue / 100,
|
|
13870
|
+
const newFloatValue = values.floatValue && isPercentage ? roundToPrecision(values.floatValue / 100, defaultNumberOfDecimals) : values.floatValue;
|
|
13864
13871
|
onChange(
|
|
13865
13872
|
__spreadProps$3(__spreadValues$k({}, values), {
|
|
13866
13873
|
floatValue: newFloatValue
|
|
@@ -13888,7 +13895,7 @@ const FormattedNumberInput = (_a) => {
|
|
|
13888
13895
|
},
|
|
13889
13896
|
onValueChange: onValueChangeHandler,
|
|
13890
13897
|
decimalScale: numberOfDecimals,
|
|
13891
|
-
value: isPercentage ? roundToPrecision(parseFloat(`${value != null ? value : 0}`) * 100,
|
|
13898
|
+
value: isPercentage ? roundToPrecision(parseFloat(`${value != null ? value : 0}`) * 100, defaultNumberOfDecimals) : value,
|
|
13892
13899
|
suffix: isPercentage ? "%" : ""
|
|
13893
13900
|
}, props), rest)
|
|
13894
13901
|
)
|