@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.
@@ -7957,7 +7957,8 @@
7957
7957
  defaultDateRange,
7958
7958
  CustomResetButton,
7959
7959
  onCancelChanges,
7960
- "data-testid": dataTestId
7960
+ "data-testid": dataTestId,
7961
+ defaultOpen = false
7961
7962
  } = props;
7962
7963
  const ref = React.useRef();
7963
7964
  const { group } = react.useMultiStyleConfig("DatePicker");
@@ -7983,7 +7984,8 @@
7983
7984
  isDateUnavailable: props.isDateUnavailable,
7984
7985
  allowsNonContiguousRanges: props.allowsNonContiguousRanges,
7985
7986
  shouldCloseOnSelect: false,
7986
- hideTimeZone: true
7987
+ hideTimeZone: true,
7988
+ defaultOpen
7987
7989
  });
7988
7990
  const {
7989
7991
  groupProps,
@@ -8109,7 +8111,7 @@
8109
8111
  RangeCalendar,
8110
8112
  __spreadProps$g(__spreadValues$1q({}, calendarProps), {
8111
8113
  resetDate: cancelOrResetDateChange,
8112
- handleClose,
8114
+ handleClose: handleModalClose,
8113
8115
  fiscalStartMonth: fiscalStartMonth || 0,
8114
8116
  fiscalStartDay: fiscalStartDay || 0,
8115
8117
  isClearable,
@@ -13797,7 +13799,7 @@
13797
13799
  isPercentage = false,
13798
13800
  onChange = ramda.identity,
13799
13801
  value: valueProp,
13800
- numberOfDecimals = 2,
13802
+ numberOfDecimals,
13801
13803
  max = Infinity,
13802
13804
  min = -Infinity,
13803
13805
  inputLeftElement,
@@ -13817,6 +13819,7 @@
13817
13819
  ]);
13818
13820
  const props = presetMap[preset];
13819
13821
  const value = valueProp != null ? valueProp : "";
13822
+ const defaultNumberOfDecimals = ramda.defaultTo(2, numberOfDecimals);
13820
13823
  const getNumberFormatValues = (number) => ({
13821
13824
  floatValue: number,
13822
13825
  formattedValue: reactNumberFormat.numericFormatter(number.toString(), props),
@@ -13826,18 +13829,22 @@
13826
13829
  if (ramda.isNil(value))
13827
13830
  return;
13828
13831
  const vNum = typeof value === "string" ? parseFloat(value) : value;
13832
+ if (ramda.isNil(numberOfDecimals) && !isPercentage) {
13833
+ onChange(getNumberFormatValues(vNum));
13834
+ return;
13835
+ }
13829
13836
  const factor = isPercentage ? 100 : 1;
13830
13837
  if (vNum * factor > max) {
13831
- const newValue = roundToPrecision(max / factor, numberOfDecimals);
13838
+ const newValue = roundToPrecision(max / factor, defaultNumberOfDecimals);
13832
13839
  onChange(getNumberFormatValues(newValue));
13833
13840
  }
13834
13841
  if (vNum * factor < min) {
13835
- const newValue = roundToPrecision(min / factor, numberOfDecimals);
13842
+ const newValue = roundToPrecision(min / factor, defaultNumberOfDecimals);
13836
13843
  onChange(getNumberFormatValues(newValue));
13837
13844
  }
13838
13845
  };
13839
13846
  const onValueChangeHandler = (values, sourceInfo) => {
13840
- const newFloatValue = values.floatValue && isPercentage ? roundToPrecision(values.floatValue / 100, numberOfDecimals) : values.floatValue;
13847
+ const newFloatValue = values.floatValue && isPercentage ? roundToPrecision(values.floatValue / 100, defaultNumberOfDecimals) : values.floatValue;
13841
13848
  onChange(
13842
13849
  __spreadProps$3(__spreadValues$k({}, values), {
13843
13850
  floatValue: newFloatValue
@@ -13865,7 +13872,7 @@
13865
13872
  },
13866
13873
  onValueChange: onValueChangeHandler,
13867
13874
  decimalScale: numberOfDecimals,
13868
- value: isPercentage ? roundToPrecision(parseFloat(`${value != null ? value : 0}`) * 100, numberOfDecimals) : value,
13875
+ value: isPercentage ? roundToPrecision(parseFloat(`${value != null ? value : 0}`) * 100, defaultNumberOfDecimals) : value,
13869
13876
  suffix: isPercentage ? "%" : ""
13870
13877
  }, props), rest)
13871
13878
  )