@activecollab/components 2.0.92 → 2.0.94

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.
Files changed (41) hide show
  1. package/dist/cjs/components/EditableCurrency/EditableCurrency.js +8 -5
  2. package/dist/cjs/components/EditableCurrency/EditableCurrency.js.map +1 -1
  3. package/dist/cjs/components/Input/InputNumber.js +5 -2
  4. package/dist/cjs/components/Input/InputNumber.js.map +1 -1
  5. package/dist/cjs/hooks/useInputNumber.js +10 -8
  6. package/dist/cjs/hooks/useInputNumber.js.map +1 -1
  7. package/dist/cjs/utils/currencyUtils.js +50 -8
  8. package/dist/cjs/utils/currencyUtils.js.map +1 -1
  9. package/dist/cjs/utils/currencyUtils.test.js +272 -19
  10. package/dist/cjs/utils/currencyUtils.test.js.map +1 -1
  11. package/dist/cjs/utils/index.js +8 -1
  12. package/dist/cjs/utils/index.js.map +1 -1
  13. package/dist/cjs/utils/types.js.map +1 -1
  14. package/dist/esm/components/EditableCurrency/EditableCurrency.d.ts.map +1 -1
  15. package/dist/esm/components/EditableCurrency/EditableCurrency.js +6 -4
  16. package/dist/esm/components/EditableCurrency/EditableCurrency.js.map +1 -1
  17. package/dist/esm/components/Input/InputNumber.d.ts.map +1 -1
  18. package/dist/esm/components/Input/InputNumber.js +3 -1
  19. package/dist/esm/components/Input/InputNumber.js.map +1 -1
  20. package/dist/esm/hooks/useInputNumber.d.ts +3 -2
  21. package/dist/esm/hooks/useInputNumber.d.ts.map +1 -1
  22. package/dist/esm/hooks/useInputNumber.js +9 -8
  23. package/dist/esm/hooks/useInputNumber.js.map +1 -1
  24. package/dist/esm/utils/currencyUtils.d.ts +4 -3
  25. package/dist/esm/utils/currencyUtils.d.ts.map +1 -1
  26. package/dist/esm/utils/currencyUtils.js +65 -7
  27. package/dist/esm/utils/currencyUtils.js.map +1 -1
  28. package/dist/esm/utils/currencyUtils.test.js +277 -20
  29. package/dist/esm/utils/currencyUtils.test.js.map +1 -1
  30. package/dist/esm/utils/index.d.ts +1 -1
  31. package/dist/esm/utils/index.d.ts.map +1 -1
  32. package/dist/esm/utils/index.js +1 -1
  33. package/dist/esm/utils/index.js.map +1 -1
  34. package/dist/esm/utils/types.d.ts +8 -0
  35. package/dist/esm/utils/types.d.ts.map +1 -1
  36. package/dist/esm/utils/types.js.map +1 -1
  37. package/dist/index.js +73 -22
  38. package/dist/index.js.map +1 -1
  39. package/dist/index.min.js +1 -1
  40. package/dist/index.min.js.map +1 -1
  41. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["default","useForkRef","useResizeObserver","decimalToHours","formatNumber","numberWithSeparator"],"sources":["../../../src/utils/index.ts"],"sourcesContent":["export * from \"./layers\";\nexport * from \"./colors\";\nexport * from \"./validation\";\nexport { default as useForkRef } from \"./useForkRef\";\nexport { default as useResizeObserver } from \"./useResizeObserver\";\nexport { decimalToHours } from \"./timeUtils\";\nexport { formatNumber, numberWithSeparator } from \"./currencyUtils\";\n"],"mappings":"AAAA,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,cAAc;AAC5B,SAASA,OAAO,IAAIC,UAAU,QAAQ,cAAc;AACpD,SAASD,OAAO,IAAIE,iBAAiB,QAAQ,qBAAqB;AAClE,SAASC,cAAc,QAAQ,aAAa;AAC5C,SAASC,YAAY,EAAEC,mBAAmB,QAAQ,iBAAiB"}
1
+ {"version":3,"file":"index.js","names":["default","useForkRef","useResizeObserver","decimalToHours","formatNumber","numberWithSeparator","getNumberFromString"],"sources":["../../../src/utils/index.ts"],"sourcesContent":["export * from \"./layers\";\nexport * from \"./colors\";\nexport * from \"./validation\";\nexport { default as useForkRef } from \"./useForkRef\";\nexport { default as useResizeObserver } from \"./useResizeObserver\";\nexport { decimalToHours } from \"./timeUtils\";\nexport {\n formatNumber,\n numberWithSeparator,\n getNumberFromString,\n} from \"./currencyUtils\";\n"],"mappings":"AAAA,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,cAAc;AAC5B,SAASA,OAAO,IAAIC,UAAU,QAAQ,cAAc;AACpD,SAASD,OAAO,IAAIE,iBAAiB,QAAQ,qBAAqB;AAClE,SAASC,cAAc,QAAQ,aAAa;AAC5C,SACEC,YAAY,EACZC,mBAAmB,EACnBC,mBAAmB,QACd,iBAAiB"}
@@ -35,5 +35,13 @@ export type PolymorphicRef<C extends React.ElementType> = React.ComponentPropsWi
35
35
  export type PolymorphicComponentPropsWithRef<C extends React.ElementType, Props = Record<string, unknown>> = PolymorphicComponentProps<C, Props> & {
36
36
  ref?: PolymorphicRef<C>;
37
37
  };
38
+ export interface FormatNumberArgs {
39
+ value: string | number;
40
+ thousandSeparator?: "," | "." | " ";
41
+ decimalSeparator?: "," | ".";
42
+ trimDecimals?: boolean;
43
+ decimalSpaces?: number;
44
+ format?: "long" | "short";
45
+ }
38
46
  export {};
39
47
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,MAAM,OAAO,CACjB,CAAC,SAAS,MAAM,GAAG,CAAC,iBAAiB,GAAG,KAAK,CAAC,qBAAqB,CAAC,OAAO,CAAC,IAC1E,GAAG,CAAC,wBAAwB,CAAC,CAAC,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC;AAEvE,KAAK,MAAM,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,IAAI;IACzC;;;OAGG;IACH,EAAE,CAAC,EAAE,CAAC,CAAC;CACR,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,eAAe,CACzB,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvC,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IACrC,aAAa,GAAG,IAAI,CAAC,aAAa,EAAE,MAAM,aAAa,CAAC,CAAC;AAE7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,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/utils/types.ts"],"sourcesContent":["import React from \"react\";\n\n// Source: https://github.com/emotion-js/emotion/blob/master/packages/styled-base/types/helper.d.ts\n// A more precise version of just React.ComponentPropsWithoutRef on its own\nexport type PropsOf<\n C extends keyof JSX.IntrinsicElements | React.JSXElementConstructor<unknown>\n> = JSX.LibraryManagedAttributes<C, React.ComponentPropsWithoutRef<C>>;\n\ntype AsProp<C extends React.ElementType> = {\n /**\n * An override of the default HTML tag.\n * Can also be another React component.\n */\n as?: C;\n};\n\n/**\n * Allows for extending a set of props (`ExtendedProps`) by an overriding set of props\n * (`OverrideProps`), ensuring that any duplicates are overridden by the overriding\n * set of props.\n */\nexport type ExtendableProps<\n ExtendedProps = Record<string, unknown>,\n OverrideProps = Record<string, unknown>\n> = OverrideProps & Omit<ExtendedProps, keyof OverrideProps>;\n\n/**\n * Allows for inheriting the props from the specified element type so that\n * props like children, className & style work, as well as element-specific\n * attributes like aria roles. The component (`C`) must be passed in.\n */\nexport type InheritableElementProps<\n C extends React.ElementType,\n Props = Record<string, unknown>\n> = ExtendableProps<PropsOf<C>, Props>;\n\n/**\n * A more sophisticated version of `InheritableElementProps` where\n * the passed in `as` prop will determine which props can be included\n */\nexport type PolymorphicComponentProps<\n C extends React.ElementType,\n Props = Record<string, unknown>\n> = InheritableElementProps<C, Props & AsProp<C>>;\n\n/**\n * Utility type to extract the `ref` prop from a polymorphic component\n */\nexport type PolymorphicRef<C extends React.ElementType> =\n React.ComponentPropsWithRef<C>[\"ref\"];\n/**\n * A wrapper of `PolymorphicComponentProps` that also includes the `ref`\n * prop for the polymorphic component\n */\nexport type PolymorphicComponentPropsWithRef<\n C extends React.ElementType,\n Props = Record<string, unknown>\n> = PolymorphicComponentProps<C, Props> & { ref?: PolymorphicRef<C> };\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/utils/types.ts"],"sourcesContent":["import React from \"react\";\n\n// Source: https://github.com/emotion-js/emotion/blob/master/packages/styled-base/types/helper.d.ts\n// A more precise version of just React.ComponentPropsWithoutRef on its own\nexport type PropsOf<\n C extends keyof JSX.IntrinsicElements | React.JSXElementConstructor<unknown>\n> = JSX.LibraryManagedAttributes<C, React.ComponentPropsWithoutRef<C>>;\n\ntype AsProp<C extends React.ElementType> = {\n /**\n * An override of the default HTML tag.\n * Can also be another React component.\n */\n as?: C;\n};\n\n/**\n * Allows for extending a set of props (`ExtendedProps`) by an overriding set of props\n * (`OverrideProps`), ensuring that any duplicates are overridden by the overriding\n * set of props.\n */\nexport type ExtendableProps<\n ExtendedProps = Record<string, unknown>,\n OverrideProps = Record<string, unknown>\n> = OverrideProps & Omit<ExtendedProps, keyof OverrideProps>;\n\n/**\n * Allows for inheriting the props from the specified element type so that\n * props like children, className & style work, as well as element-specific\n * attributes like aria roles. The component (`C`) must be passed in.\n */\nexport type InheritableElementProps<\n C extends React.ElementType,\n Props = Record<string, unknown>\n> = ExtendableProps<PropsOf<C>, Props>;\n\n/**\n * A more sophisticated version of `InheritableElementProps` where\n * the passed in `as` prop will determine which props can be included\n */\nexport type PolymorphicComponentProps<\n C extends React.ElementType,\n Props = Record<string, unknown>\n> = InheritableElementProps<C, Props & AsProp<C>>;\n\n/**\n * Utility type to extract the `ref` prop from a polymorphic component\n */\nexport type PolymorphicRef<C extends React.ElementType> =\n React.ComponentPropsWithRef<C>[\"ref\"];\n/**\n * A wrapper of `PolymorphicComponentProps` that also includes the `ref`\n * prop for the polymorphic component\n */\nexport type PolymorphicComponentPropsWithRef<\n C extends React.ElementType,\n Props = Record<string, unknown>\n> = PolymorphicComponentProps<C, Props> & { ref?: PolymorphicRef<C> };\n\nexport interface FormatNumberArgs {\n value: string | number;\n thousandSeparator?: \",\" | \".\" | \" \";\n decimalSeparator?: \",\" | \".\";\n trimDecimals?: boolean;\n decimalSpaces?: number;\n format?: \"long\" | \"short\";\n}\n"],"mappings":""}
package/dist/index.js CHANGED
@@ -567,9 +567,49 @@
567
567
  b: 1000000000,
568
568
  t: 1000000000000
569
569
  };
570
+ var fixedDecimalSpaces = function fixedDecimalSpaces(num, fixed) {
571
+ fixed = fixed || 0;
572
+ fixed = Math.pow(10, fixed);
573
+ var parts = num.toString().split(".");
574
+ if (parts.length > 1 && parseInt(parts[1]) > fixed) {
575
+ return Math.floor(num * fixed) / fixed;
576
+ }
577
+ return Math.round(num * fixed) / fixed;
578
+ };
579
+ var getNumberFromString = function getNumberFromString(number) {
580
+ var thousandSeparator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ",";
581
+ var decimalSeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ".";
582
+ if (typeof number === "number") {
583
+ return number;
584
+ }
585
+ if (decimalSeparator === ",") {
586
+ var parts = number.split(decimalSeparator);
587
+ var result = 0;
588
+ if (parts.length === 2) {
589
+ result = parts[0] ? parseFloat(String(parts[0]).replaceAll(thousandSeparator, "")) : 0;
590
+ if (result < 0) {
591
+ result -= parts[1] ? parseFloat(String(parts[1])) / Math.pow(10, parts[1].length) : 0;
592
+ } else {
593
+ result += parts[1] ? parseFloat(String(parts[1])) / Math.pow(10, parts[1].length) : 0;
594
+ }
595
+ return result;
596
+ }
597
+ if (parts.length === 1) {
598
+ result = parseFloat(String(parts[0]).replaceAll(thousandSeparator, ""));
599
+ return result;
600
+ }
601
+ return 0;
602
+ } else {
603
+ return parseFloat(String(number).replaceAll(thousandSeparator, ""));
604
+ }
605
+ };
570
606
  var formatNumber = function formatNumber(n) {
571
607
  var thousandSeparator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ",";
572
- var number = parseFloat(String(n).replaceAll(thousandSeparator, ""));
608
+ var decimalSeperator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ".";
609
+ var trimDecimals = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
610
+ var decimalSpaces = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2;
611
+ var format = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : "short";
612
+ var number = getNumberFromString(n, thousandSeparator, decimalSeperator);
573
613
  if (isNaN(number)) {
574
614
  return "";
575
615
  }
@@ -577,22 +617,24 @@
577
617
  var absoluteNumber = Math.abs(number);
578
618
  var suffixes = ["", "K", "M", "B", "T"];
579
619
  var scale = 0;
580
- while (absoluteNumber >= 1000 && scale < suffixes.length - 1) {
620
+ while (absoluteNumber >= 1000 && scale < suffixes.length - 1 && format === "short") {
581
621
  absoluteNumber /= 1000;
582
622
  scale++;
583
623
  }
584
- var formattedNum = scale === 0 ? absoluteNumber.toFixed(0) : absoluteNumber.toFixed(1);
585
- var result = formattedNum.endsWith(".0") ? formattedNum.slice(0, -2) : formattedNum;
624
+ var formattedNum = scale === 0 ? fixedDecimalSpaces(absoluteNumber, decimalSpaces) : parseFloat(absoluteNumber.toFixed(1));
625
+ var result = numberWithSeparator(trimDecimals ? formattedNum : formattedNum.toFixed(decimalSpaces), thousandSeparator, decimalSeperator);
586
626
  return isNegative ? "-".concat(result).concat(suffixes[scale]) : "".concat(result).concat(suffixes[scale]);
587
627
  };
588
- var numberWithSeparator = function numberWithSeparator(x, thousandSeparator) {
589
- var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
628
+ var numberWithSeparator = function numberWithSeparator(x) {
629
+ var thousandSeparator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ",";
630
+ var decimalSeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ".";
631
+ var format = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
590
632
  if (!format) {
591
633
  return x;
592
634
  }
593
635
  var parts = x.toString().split(".");
594
636
  parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, thousandSeparator);
595
- return parts.join(".");
637
+ return parts.join(decimalSeparator);
596
638
  };
597
639
 
598
640
  var validateStopwatchTime = function validateStopwatchTime(value) {
@@ -11934,17 +11976,19 @@
11934
11976
  allowEmptyValue = _ref.allowEmptyValue,
11935
11977
  _ref$step = _ref.step,
11936
11978
  step = _ref$step === void 0 ? 1 : _ref$step,
11979
+ _ref$trimDecimals = _ref.trimDecimals,
11980
+ trimDecimals = _ref$trimDecimals === void 0 ? true : _ref$trimDecimals,
11937
11981
  limit = _ref.limit,
11938
11982
  _ref$validation = _ref.validation,
11939
11983
  validation = _ref$validation === void 0 ? validateNumberInput : _ref$validation;
11940
11984
  var _useState = React.useState(function () {
11941
- return disableAbbreviation ? value : formatNumber(value, thousandSeparator);
11985
+ return disableAbbreviation ? value : formatNumber(value, thousandSeparator, decimalSeparator, trimDecimals, decimalLength);
11942
11986
  }),
11943
11987
  _useState2 = _slicedToArray(_useState, 2),
11944
11988
  currentValue = _useState2[0],
11945
11989
  setCurrentValue = _useState2[1];
11946
11990
  var _useState3 = React.useState(function () {
11947
- return disableAbbreviation ? value : formatNumber(value, thousandSeparator);
11991
+ return disableAbbreviation ? value : formatNumber(value, thousandSeparator, decimalSeparator, trimDecimals, decimalLength);
11948
11992
  }),
11949
11993
  _useState4 = _slicedToArray(_useState3, 2),
11950
11994
  prevValue = _useState4[0],
@@ -11957,12 +12001,12 @@
11957
12001
  setUnformattedValue = _useState6[1];
11958
12002
  React.useEffect(function () {
11959
12003
  if (value !== prevValue) {
11960
- setCurrentValue(disableAbbreviation ? value : formatNumber(value, thousandSeparator));
11961
- setPrevValue(disableAbbreviation ? value : formatNumber(value, thousandSeparator));
12004
+ setCurrentValue(disableAbbreviation ? value : formatNumber(value, thousandSeparator, decimalSeparator, trimDecimals, decimalLength));
12005
+ setPrevValue(disableAbbreviation ? value : formatNumber(value, thousandSeparator, decimalSeparator, trimDecimals, decimalLength));
11962
12006
  setUnformattedValue(value);
11963
12007
  }
11964
12008
  // eslint-disable-next-line react-hooks/exhaustive-deps
11965
- }, [disableAbbreviation, thousandSeparator, value]);
12009
+ }, [disableAbbreviation, thousandSeparator, decimalSeparator, decimalLength, trimDecimals, value]);
11966
12010
  var _useState7 = React.useState(false),
11967
12011
  _useState8 = _slicedToArray(_useState7, 2),
11968
12012
  focused = _useState8[0],
@@ -11974,7 +12018,7 @@
11974
12018
  setUnformattedValue(prevValue);
11975
12019
  } else {
11976
12020
  if (e.target.value.trim().length > 0 && prevValue !== e.target.value) {
11977
- var _value = disableAbbreviation ? currentValue : formatNumber(currentValue, thousandSeparator);
12021
+ var _value = disableAbbreviation ? currentValue : formatNumber(currentValue, thousandSeparator, decimalSeparator, trimDecimals, decimalLength);
11978
12022
  setPrevValue(_value);
11979
12023
  setUnformattedValue(currentValue);
11980
12024
  setCurrentValue(_value);
@@ -11994,7 +12038,7 @@
11994
12038
  }
11995
12039
  }
11996
12040
  setFocused(false);
11997
- }, [allowEmptyValue, disableAbbreviation, onCancel, onSave, prevValue, thousandSeparator, currentValue]);
12041
+ }, [prevValue, disableAbbreviation, currentValue, thousandSeparator, decimalSeparator, decimalLength, trimDecimals, onSave, allowEmptyValue, onCancel]);
11998
12042
  var updateValue = React.useCallback(function (type) {
11999
12043
  var value = String(unformattedValue);
12000
12044
  var decimalPart = "";
@@ -12017,7 +12061,7 @@
12017
12061
  if (value.includes(decimalSeparator)) {
12018
12062
  increasedValue = parseFloat(increasedValue.toFixed(decimalLength));
12019
12063
  }
12020
- var joinedValue = numberWithSeparator(increasedValue, thousandSeparator, value.includes(thousandSeparator));
12064
+ var joinedValue = numberWithSeparator(increasedValue, thousandSeparator, decimalSeparator, value.includes(thousandSeparator));
12021
12065
  setUnformattedValue(decimalPart ? joinedValue + decimalPart : joinedValue);
12022
12066
  setCurrentValue(decimalPart ? joinedValue + decimalPart : joinedValue);
12023
12067
  }, [decimalLength, decimalSeparator, step, thousandSeparator, unformattedValue]);
@@ -13556,7 +13600,7 @@
13556
13600
  });
13557
13601
  InputHours.displayName = "InputHours";
13558
13602
 
13559
- var _excluded$K = ["decimalLength", "decimalSeparator", "disableAbbreviation", "disabled", "disableMacros", "invalid", "step", "thousandSeparator", "value", "onCancel", "onSave", "onEnterKeyPress", "allowEmptyValue", "onChange", "onClick", "limit", "placeholder"];
13603
+ var _excluded$K = ["decimalLength", "decimalSeparator", "disableAbbreviation", "disabled", "disableMacros", "invalid", "step", "thousandSeparator", "value", "onCancel", "onSave", "onEnterKeyPress", "allowEmptyValue", "onChange", "onClick", "limit", "placeholder", "trimDecimals"];
13560
13604
  var InputNumber = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
13561
13605
  var _ref$decimalLength = _ref.decimalLength,
13562
13606
  decimalLength = _ref$decimalLength === void 0 ? 2 : _ref$decimalLength,
@@ -13581,6 +13625,8 @@
13581
13625
  externalOnClick = _ref.onClick,
13582
13626
  limit = _ref.limit,
13583
13627
  placeholder = _ref.placeholder,
13628
+ _ref$trimDecimals = _ref.trimDecimals,
13629
+ trimDecimals = _ref$trimDecimals === void 0 ? true : _ref$trimDecimals,
13584
13630
  rest = _objectWithoutProperties(_ref, _excluded$K);
13585
13631
  var inputRef = React.useRef(null);
13586
13632
  var handleRef = useForkRef(ref, inputRef);
@@ -13598,7 +13644,8 @@
13598
13644
  onCancel,
13599
13645
  onSave,
13600
13646
  allowEmptyValue,
13601
- limit
13647
+ limit,
13648
+ trimDecimals
13602
13649
  }, inputRef),
13603
13650
  inputProps = _useInputNumber.inputProps;
13604
13651
  var value = inputProps.value,
@@ -17646,7 +17693,7 @@
17646
17693
  });
17647
17694
  EditableHours.displayName = "EditableHours";
17648
17695
 
17649
- var _excluded$c = ["decimalLength", "decimalSeparator", "disableAbbreviation", "disabled", "disableMacros", "step", "thousandSeparator", "value", "onSave", "onCancel", "className", "allowEmptyValue", "onEnterKeyPress", "onClick", "onChange"];
17696
+ var _excluded$c = ["decimalLength", "decimalSeparator", "disableAbbreviation", "disabled", "disableMacros", "step", "thousandSeparator", "value", "onSave", "onCancel", "className", "allowEmptyValue", "onEnterKeyPress", "onClick", "onChange", "trimDecimals"];
17650
17697
  var EditableCurrency = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
17651
17698
  var _ref$decimalLength = _ref.decimalLength,
17652
17699
  decimalLength = _ref$decimalLength === void 0 ? 2 : _ref$decimalLength,
@@ -17669,6 +17716,8 @@
17669
17716
  externalEnterKeyPress = _ref.onEnterKeyPress,
17670
17717
  externalOnClick = _ref.onClick,
17671
17718
  externalOnChange = _ref.onChange,
17719
+ _ref$trimDecimals = _ref.trimDecimals,
17720
+ trimDecimals = _ref$trimDecimals === void 0 ? true : _ref$trimDecimals,
17672
17721
  rest = _objectWithoutProperties(_ref, _excluded$c);
17673
17722
  var inputRef = React.useRef(null);
17674
17723
  var handleRef = useForkRef(ref, inputRef);
@@ -17685,7 +17734,8 @@
17685
17734
  onCancel,
17686
17735
  onChange: externalOnChange,
17687
17736
  onEnterKeyPress: externalEnterKeyPress,
17688
- onClick: externalOnClick
17737
+ onClick: externalOnClick,
17738
+ trimDecimals
17689
17739
  }, inputRef),
17690
17740
  inputProps = _useInputNumber.inputProps;
17691
17741
  var value = inputProps.value,
@@ -17698,10 +17748,10 @@
17698
17748
  focused = inputProps.focused,
17699
17749
  unformattedValue = inputProps.unformattedValue;
17700
17750
  var formattedValue = React.useMemo(function () {
17701
- return focused ? value : numberWithSeparator(value !== null && value !== void 0 ? value : "", thousandSeparator);
17702
- }, [focused, value, thousandSeparator]);
17751
+ return focused ? value : numberWithSeparator(value !== null && value !== void 0 ? value : "", thousandSeparator, decimalSeparator);
17752
+ }, [focused, value, thousandSeparator, decimalSeparator]);
17703
17753
  return /*#__PURE__*/React__default["default"].createElement(Tooltip, {
17704
- title: unformattedValue,
17754
+ title: numberWithSeparator(unformattedValue !== null && unformattedValue !== void 0 ? unformattedValue : "", thousandSeparator, decimalSeparator),
17705
17755
  disable: focused
17706
17756
  }, /*#__PURE__*/React__default["default"].createElement(EditableContent, {
17707
17757
  disabled: disabled,
@@ -19478,6 +19528,7 @@
19478
19528
  exports.colors = colors$1;
19479
19529
  exports.decimalToHours = decimalToHours;
19480
19530
  exports.formatNumber = formatNumber;
19531
+ exports.getNumberFromString = getNumberFromString;
19481
19532
  exports.isOptionGroup = isOptionGroup;
19482
19533
  exports.isValidUrl = isValidUrl;
19483
19534
  exports.layers = layers;