@helpdice/ui 1.7.5 → 1.7.8

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 (304) hide show
  1. package/dist/CurrencyInput/index.js +2981 -0
  2. package/dist/LinearProgress/index.d.ts +2 -0
  3. package/dist/{css-baseline → LinearProgress}/index.js +25 -317
  4. package/dist/LinearProgress/linear-progress.d.ts +9 -0
  5. package/dist/Loadable/index.js +570 -0
  6. package/dist/PhoneInput/index.js +2136 -314
  7. package/dist/Placeholder/index.js +2116 -254
  8. package/dist/auto-complete/index.js +2145 -652
  9. package/dist/avatar/index.js +2119 -333
  10. package/dist/badge/index.js +2117 -331
  11. package/dist/breadcrumbs/index.js +2126 -340
  12. package/dist/button/button.compact.d.ts +2 -0
  13. package/dist/button/index.js +2214 -342
  14. package/dist/button-dropdown/index.js +2120 -291
  15. package/dist/button-group/index.js +2117 -331
  16. package/dist/capacity/index.js +2117 -331
  17. package/dist/card/index.js +2127 -298
  18. package/dist/checkbox/index.js +2119 -290
  19. package/dist/code/index.js +2116 -297
  20. package/dist/collapse/index.js +2117 -475
  21. package/dist/description/index.js +2117 -331
  22. package/dist/display/index.js +2117 -331
  23. package/dist/divider/index.js +2118 -332
  24. package/dist/dot/index.js +2117 -331
  25. package/dist/drawer/index.js +2129 -439
  26. package/dist/fieldset/index.js +2121 -354
  27. package/dist/grid/index.js +2119 -333
  28. package/dist/image/index.js +2122 -336
  29. package/dist/index.d.ts +2 -14
  30. package/dist/index.js +3175 -1879
  31. package/dist/input/index.js +2125 -296
  32. package/dist/keyboard/index.js +2116 -297
  33. package/dist/link/index.js +2117 -331
  34. package/dist/list/index.js +2119 -333
  35. package/dist/loading/index.js +2117 -331
  36. package/dist/menu/index.js +77 -45
  37. package/dist/modal/index.js +2145 -452
  38. package/dist/note/index.js +2117 -331
  39. package/dist/page/index.js +2117 -331
  40. package/dist/pagination/index.js +2118 -351
  41. package/dist/popover/index.js +2123 -354
  42. package/dist/progress/index.js +2117 -331
  43. package/dist/radio/index.js +2120 -334
  44. package/dist/rating/index.js +2118 -332
  45. package/dist/row/index.js +2115 -296
  46. package/dist/select/index.js +2151 -688
  47. package/dist/slider/index.js +2123 -356
  48. package/dist/snippet/index.js +2118 -421
  49. package/dist/spacer/index.js +2115 -296
  50. package/dist/spinner/index.js +2117 -331
  51. package/dist/table/index.js +2341 -754
  52. package/dist/tabs/index.js +2123 -344
  53. package/dist/tag/index.js +2116 -254
  54. package/dist/text/index.js +2116 -297
  55. package/dist/textarea/index.js +2117 -288
  56. package/dist/toggle/index.js +2117 -331
  57. package/dist/tooltip/index.js +2120 -351
  58. package/dist/tree/index.js +2123 -459
  59. package/dist/use-input/index.js +2122 -24
  60. package/dist/use-modal/index.js +2122 -24
  61. package/dist/use-network-status/index.d.ts +2 -0
  62. package/dist/{use-current-state → use-network-status}/index.js +22 -15
  63. package/dist/use-network-status/use-netowork-status.d.ts +4 -0
  64. package/dist/use-scale/index.js +2115 -296
  65. package/dist/use-tabs/index.js +2122 -24
  66. package/dist/user/index.js +2123 -337
  67. package/esm/CurrencyInput/components/CurrencyInput.js +342 -0
  68. package/esm/CurrencyInput/components/CurrencyInputProps.js +1 -0
  69. package/esm/CurrencyInput/components/utils/addSeparators.js +7 -0
  70. package/esm/CurrencyInput/components/utils/cleanValue.js +69 -0
  71. package/esm/CurrencyInput/components/utils/escapeRegExp.js +8 -0
  72. package/esm/CurrencyInput/components/utils/fixedDecimalValue.js +29 -0
  73. package/esm/CurrencyInput/components/utils/formatValue.js +124 -0
  74. package/esm/CurrencyInput/components/utils/getLocaleConfig.js +47 -0
  75. package/esm/CurrencyInput/components/utils/getSuffix.js +10 -0
  76. package/esm/CurrencyInput/components/utils/index.js +8 -0
  77. package/esm/CurrencyInput/components/utils/isNumber.js +3 -0
  78. package/esm/CurrencyInput/components/utils/padTrimValue.js +27 -0
  79. package/esm/CurrencyInput/components/utils/parseAbbrValue.js +43 -0
  80. package/esm/CurrencyInput/components/utils/removeInvalidChars.js +10 -0
  81. package/esm/CurrencyInput/components/utils/removeSeparators.js +10 -0
  82. package/esm/CurrencyInput/components/utils/repositionCursor.js +35 -0
  83. package/esm/CurrencyInput/index.js +4 -0
  84. package/esm/LinearProgress/index.d.ts +2 -0
  85. package/esm/LinearProgress/index.js +2 -0
  86. package/esm/LinearProgress/linear-progress.d.ts +9 -0
  87. package/esm/LinearProgress/linear-progress.js +28 -0
  88. package/esm/Loadable/index.js +2 -0
  89. package/esm/PhoneInput/phone.js +22 -19
  90. package/esm/auto-complete/auto-complete-dropdown.js +1 -3
  91. package/esm/auto-complete/auto-complete-item.js +1 -3
  92. package/esm/auto-complete/auto-complete-searching.js +1 -1
  93. package/esm/auto-complete/auto-complete.js +1 -1
  94. package/esm/avatar/avatar-group.js +1 -2
  95. package/esm/avatar/avatar.js +1 -2
  96. package/esm/badge/badge.js +1 -2
  97. package/esm/breadcrumbs/breadcrumbs-item.js +1 -1
  98. package/esm/breadcrumbs/breadcrumbs-separator.js +1 -1
  99. package/esm/breadcrumbs/breadcrumbs.js +1 -1
  100. package/esm/button/button-icon.js +1 -1
  101. package/esm/button/button.compact.d.ts +2 -0
  102. package/esm/button/button.compact.js +94 -50
  103. package/esm/button/button.js +1 -2
  104. package/esm/button/utils.js +1 -1
  105. package/esm/button-dropdown/button-dropdown-item.js +1 -1
  106. package/esm/button-dropdown/button-dropdown.js +1 -2
  107. package/esm/button-group/button-group.js +1 -2
  108. package/esm/capacity/capacity.js +1 -2
  109. package/esm/card/card-content.js +1 -1
  110. package/esm/card/card-footer.js +1 -2
  111. package/esm/card/card.js +1 -2
  112. package/esm/carousal/Arrow.js +18 -0
  113. package/esm/carousal/Indicator.js +20 -0
  114. package/esm/carousal/Thumbs.js +302 -0
  115. package/esm/carousal/animations.js +162 -0
  116. package/esm/carousal/index.js +683 -0
  117. package/esm/carousal/types.js +1 -0
  118. package/esm/carousal/utils.js +49 -0
  119. package/esm/checkbox/checkbox-group.js +1 -1
  120. package/esm/checkbox/checkbox.icon.js +1 -1
  121. package/esm/checkbox/checkbox.js +1 -2
  122. package/esm/code/code.js +1 -1
  123. package/esm/collapse/collapse-group.js +1 -2
  124. package/esm/collapse/collapse.js +1 -4
  125. package/esm/description/description.js +1 -2
  126. package/esm/display/display.js +1 -2
  127. package/esm/divider/divider.js +1 -2
  128. package/esm/dot/dot.js +1 -2
  129. package/esm/drawer/drawer-wrapper.js +1 -3
  130. package/esm/drawer/drawer.js +1 -1
  131. package/esm/fieldset/fieldset-content.js +1 -1
  132. package/esm/fieldset/fieldset-footer.js +1 -1
  133. package/esm/fieldset/fieldset-group.js +1 -3
  134. package/esm/fieldset/fieldset-title.js +1 -1
  135. package/esm/fieldset/fieldset.js +1 -2
  136. package/esm/grid/basic-item.js +1 -2
  137. package/esm/grid/grid-container.js +1 -1
  138. package/esm/grid/grid.js +1 -1
  139. package/esm/image/image-browser.js +1 -2
  140. package/esm/image/image.js +1 -2
  141. package/esm/image/image.skeleton.js +1 -1
  142. package/esm/index.d.ts +2 -14
  143. package/esm/index.js +5 -9
  144. package/esm/input/input-block-label.js +1 -1
  145. package/esm/input/input-icon-clear.js +1 -2
  146. package/esm/input/input-label.js +1 -1
  147. package/esm/input/input.js +1 -2
  148. package/esm/keyboard/keyboard.js +1 -1
  149. package/esm/link/link.js +1 -2
  150. package/esm/list/list-item.js +1 -2
  151. package/esm/loading/loading.js +1 -2
  152. package/esm/modal/modal-action.js +1 -2
  153. package/esm/modal/modal-actions.js +1 -1
  154. package/esm/modal/modal-content.js +1 -1
  155. package/esm/modal/modal-subtitle.js +1 -1
  156. package/esm/modal/modal-title.js +1 -1
  157. package/esm/modal/modal-wrapper.js +1 -3
  158. package/esm/modal/modal.js +1 -1
  159. package/esm/note/note.js +1 -2
  160. package/esm/page/page-header.js +1 -1
  161. package/esm/page/page.js +1 -1
  162. package/esm/pagination/pagination-item.js +1 -2
  163. package/esm/pagination/pagination.js +1 -1
  164. package/esm/popover/popover-item.js +1 -2
  165. package/esm/popover/popover.js +1 -1
  166. package/esm/progress/progress.js +1 -2
  167. package/esm/radio/radio-description.js +1 -1
  168. package/esm/radio/radio-group.js +1 -1
  169. package/esm/radio/radio.js +1 -2
  170. package/esm/rating/rating.js +1 -2
  171. package/esm/row/row.js +1 -1
  172. package/esm/select/select-dropdown.js +1 -3
  173. package/esm/select/select-icon-clear.js +1 -1
  174. package/esm/select/select-multiple-value.js +1 -1
  175. package/esm/select/select-option.js +1 -3
  176. package/esm/select/select.js +9 -12
  177. package/esm/slider/slider-dot.js +1 -2
  178. package/esm/slider/slider-mark.js +1 -1
  179. package/esm/slider/slider.js +1 -3
  180. package/esm/snippet/snippet.js +1 -3
  181. package/esm/spinner/spinner.js +1 -2
  182. package/esm/table/table-body.js +1 -2
  183. package/esm/table/table-head.js +3 -2
  184. package/esm/tabs/tabs-item.js +1 -2
  185. package/esm/tabs/tabs.js +1 -3
  186. package/esm/tag/tag.js +1 -1
  187. package/esm/text/child.js +1 -1
  188. package/esm/textarea/textarea.js +1 -2
  189. package/esm/toggle/toggle.js +1 -2
  190. package/esm/tooltip/tooltip-content.js +1 -3
  191. package/esm/tooltip/tooltip-icon.js +1 -1
  192. package/esm/tooltip/tooltip.js +1 -1
  193. package/esm/tree/tree-file-icon.js +1 -1
  194. package/esm/tree/tree-file.js +1 -2
  195. package/esm/tree/tree-folder-icon.js +1 -1
  196. package/esm/tree/tree-folder.js +1 -3
  197. package/esm/tree/tree-status-icon.js +1 -1
  198. package/esm/tree/tree.js +1 -1
  199. package/esm/use-input/use-input.js +1 -1
  200. package/esm/use-modal/use-modal.js +1 -1
  201. package/esm/use-network-status/index.d.ts +2 -0
  202. package/esm/use-network-status/index.js +2 -0
  203. package/esm/use-network-status/use-netowork-status.d.ts +4 -0
  204. package/esm/use-network-status/use-netowork-status.js +29 -0
  205. package/esm/use-scale/with-scale.js +1 -1
  206. package/esm/use-tabs/use-tabs.js +1 -1
  207. package/esm/user/user.js +1 -2
  208. package/esm/utils/use-context-state/use-context-state.js +1 -1
  209. package/esm/utils/use-drag.js +1 -1
  210. package/package.json +12 -4
  211. package/dist/css-baseline/css-baseline.d.ts +0 -9
  212. package/dist/css-baseline/index.d.ts +0 -1
  213. package/dist/shared/backdrop.d.ts +0 -14
  214. package/dist/shared/css-transition.d.ts +0 -13
  215. package/dist/shared/dropdown.d.ts +0 -9
  216. package/dist/shared/ellipsis.d.ts +0 -6
  217. package/dist/shared/expand.d.ts +0 -7
  218. package/dist/shared/highlight.d.ts +0 -13
  219. package/dist/ui-provider/index.d.ts +0 -3
  220. package/dist/ui-provider/index.js +0 -2186
  221. package/dist/ui-provider/theme-provider.d.ts +0 -8
  222. package/dist/ui-provider/ui-provider.d.ts +0 -8
  223. package/dist/use-all-themes/all-themes-context.d.ts +0 -7
  224. package/dist/use-all-themes/index.d.ts +0 -3
  225. package/dist/use-all-themes/index.js +0 -311
  226. package/dist/use-classes/index.d.ts +0 -2
  227. package/dist/use-classes/index.js +0 -48
  228. package/dist/use-classes/use-classes.d.ts +0 -4
  229. package/dist/use-current-state/index.d.ts +0 -2
  230. package/dist/use-current-state/use-current-state.d.ts +0 -4
  231. package/dist/use-media-query/index.d.ts +0 -3
  232. package/dist/use-media-query/index.js +0 -444
  233. package/dist/use-media-query/use-media-query.d.ts +0 -12
  234. package/dist/use-theme/index.d.ts +0 -2
  235. package/dist/use-theme/index.js +0 -309
  236. package/dist/use-theme/theme-context.d.ts +0 -4
  237. package/dist/use-toasts/helpers.d.ts +0 -18
  238. package/dist/use-toasts/index.d.ts +0 -3
  239. package/dist/use-toasts/index.js +0 -204
  240. package/dist/use-toasts/toast-container.d.ts +0 -3
  241. package/dist/use-toasts/toast-item.d.ts +0 -8
  242. package/dist/use-toasts/use-toast.d.ts +0 -40
  243. package/dist/utils/use-current-state.d.ts +0 -2
  244. package/dist/utils/use-dom-observer.d.ts +0 -3
  245. package/dist/utils/use-hd-ui-context.d.ts +0 -16
  246. package/dist/utils/use-previous.d.ts +0 -2
  247. package/esm/captcha/index.js +0 -128
  248. package/esm/css-baseline/css-baseline.d.ts +0 -9
  249. package/esm/css-baseline/css-baseline.js +0 -23
  250. package/esm/css-baseline/index.d.ts +0 -1
  251. package/esm/css-baseline/index.js +0 -2
  252. package/esm/shared/backdrop.d.ts +0 -14
  253. package/esm/shared/backdrop.js +0 -66
  254. package/esm/shared/css-transition.d.ts +0 -13
  255. package/esm/shared/css-transition.js +0 -65
  256. package/esm/shared/dropdown.d.ts +0 -9
  257. package/esm/shared/dropdown.js +0 -99
  258. package/esm/shared/ellipsis.d.ts +0 -6
  259. package/esm/shared/ellipsis.js +0 -13
  260. package/esm/shared/expand.d.ts +0 -7
  261. package/esm/shared/expand.js +0 -86
  262. package/esm/shared/highlight.d.ts +0 -13
  263. package/esm/shared/highlight.js +0 -46
  264. package/esm/ui-provider/index.d.ts +0 -3
  265. package/esm/ui-provider/index.js +0 -4
  266. package/esm/ui-provider/theme-provider.d.ts +0 -8
  267. package/esm/ui-provider/theme-provider.js +0 -45
  268. package/esm/ui-provider/ui-provider.d.ts +0 -8
  269. package/esm/ui-provider/ui-provider.js +0 -55
  270. package/esm/use-all-themes/all-themes-context.d.ts +0 -7
  271. package/esm/use-all-themes/all-themes-context.js +0 -11
  272. package/esm/use-all-themes/index.d.ts +0 -3
  273. package/esm/use-all-themes/index.js +0 -2
  274. package/esm/use-classes/index.d.ts +0 -2
  275. package/esm/use-classes/index.js +0 -2
  276. package/esm/use-classes/use-classes.d.ts +0 -4
  277. package/esm/use-classes/use-classes.js +0 -34
  278. package/esm/use-current-state/index.d.ts +0 -2
  279. package/esm/use-current-state/index.js +0 -2
  280. package/esm/use-current-state/use-current-state.d.ts +0 -4
  281. package/esm/use-current-state/use-current-state.js +0 -23
  282. package/esm/use-media-query/index.d.ts +0 -3
  283. package/esm/use-media-query/index.js +0 -2
  284. package/esm/use-media-query/use-media-query.d.ts +0 -12
  285. package/esm/use-media-query/use-media-query.js +0 -81
  286. package/esm/use-theme/index.d.ts +0 -2
  287. package/esm/use-theme/index.js +0 -2
  288. package/esm/use-theme/theme-context.d.ts +0 -4
  289. package/esm/use-theme/theme-context.js +0 -9
  290. package/esm/use-toasts/helpers.d.ts +0 -18
  291. package/esm/use-toasts/helpers.js +0 -68
  292. package/esm/use-toasts/index.d.ts +0 -3
  293. package/esm/use-toasts/index.js +0 -2
  294. package/esm/use-toasts/toast-container.d.ts +0 -3
  295. package/esm/use-toasts/toast-container.js +0 -120
  296. package/esm/use-toasts/toast-item.d.ts +0 -8
  297. package/esm/use-toasts/toast-item.js +0 -45
  298. package/esm/use-toasts/use-toast.d.ts +0 -40
  299. package/esm/use-toasts/use-toast.js +0 -103
  300. package/esm/utils/use-current-state.d.ts +0 -2
  301. package/esm/utils/use-current-state.js +0 -2
  302. package/esm/utils/use-dom-observer.d.ts +0 -3
  303. package/esm/utils/use-hd-ui-context.d.ts +0 -16
  304. package/esm/utils/use-previous.d.ts +0 -2
@@ -0,0 +1,342 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
+ var _excluded = ["allowDecimals", "allowNegativeValue", "id", "name", "className", "customInput", "decimalsLimit", "defaultValue", "disabled", "maxLength", "value", "onValueChange", "fixedDecimalLength", "placeholder", "decimalScale", "prefix", "suffix", "intlConfig", "step", "min", "max", "disableGroupSeparators", "disableAbbreviations", "decimalSeparator", "groupSeparator", "onChange", "onFocus", "onBlur", "onKeyDown", "onKeyUp", "transformRawValue", "formatValueOnBlur", "children"];
5
+ import React, { useState, useEffect, useRef, forwardRef, useMemo, useImperativeHandle } from 'react';
6
+ import { isNumber, cleanValue, fixedDecimalValue, formatValue, getLocaleConfig, padTrimValue, getSuffix, repositionCursor } from './utils';
7
+ import { useTheme } from '@helpdice/theme';
8
+ export var InputCurrency = /*#__PURE__*/forwardRef(function (_ref, ref) {
9
+ var _ref$allowDecimals = _ref.allowDecimals,
10
+ allowDecimals = _ref$allowDecimals === void 0 ? true : _ref$allowDecimals,
11
+ _ref$allowNegativeVal = _ref.allowNegativeValue,
12
+ allowNegativeValue = _ref$allowNegativeVal === void 0 ? true : _ref$allowNegativeVal,
13
+ id = _ref.id,
14
+ name = _ref.name,
15
+ className = _ref.className,
16
+ customInput = _ref.customInput,
17
+ decimalsLimit = _ref.decimalsLimit,
18
+ defaultValue = _ref.defaultValue,
19
+ _ref$disabled = _ref.disabled,
20
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
21
+ userMaxLength = _ref.maxLength,
22
+ userValue = _ref.value,
23
+ onValueChange = _ref.onValueChange,
24
+ fixedDecimalLength = _ref.fixedDecimalLength,
25
+ placeholder = _ref.placeholder,
26
+ decimalScale = _ref.decimalScale,
27
+ prefix = _ref.prefix,
28
+ suffix = _ref.suffix,
29
+ intlConfig = _ref.intlConfig,
30
+ step = _ref.step,
31
+ min = _ref.min,
32
+ max = _ref.max,
33
+ _ref$disableGroupSepa = _ref.disableGroupSeparators,
34
+ disableGroupSeparators = _ref$disableGroupSepa === void 0 ? false : _ref$disableGroupSepa,
35
+ _ref$disableAbbreviat = _ref.disableAbbreviations,
36
+ disableAbbreviations = _ref$disableAbbreviat === void 0 ? false : _ref$disableAbbreviat,
37
+ _decimalSeparator = _ref.decimalSeparator,
38
+ _groupSeparator = _ref.groupSeparator,
39
+ onChange = _ref.onChange,
40
+ onFocus = _ref.onFocus,
41
+ onBlur = _ref.onBlur,
42
+ onKeyDown = _ref.onKeyDown,
43
+ onKeyUp = _ref.onKeyUp,
44
+ transformRawValue = _ref.transformRawValue,
45
+ _ref$formatValueOnBlu = _ref.formatValueOnBlur,
46
+ formatValueOnBlur = _ref$formatValueOnBlu === void 0 ? true : _ref$formatValueOnBlu,
47
+ children = _ref.children,
48
+ props = _objectWithoutProperties(_ref, _excluded);
49
+ var theme = useTheme();
50
+ if (_decimalSeparator && isNumber(_decimalSeparator)) {
51
+ throw new Error('decimalSeparator cannot be a number');
52
+ }
53
+ if (_groupSeparator && isNumber(_groupSeparator)) {
54
+ throw new Error('groupSeparator cannot be a number');
55
+ }
56
+ var localeConfig = useMemo(function () {
57
+ return getLocaleConfig(intlConfig);
58
+ }, [intlConfig]);
59
+ var decimalSeparator = _decimalSeparator || localeConfig.decimalSeparator || '';
60
+ var groupSeparator = _groupSeparator || localeConfig.groupSeparator || '';
61
+ if (decimalSeparator && groupSeparator && decimalSeparator === groupSeparator && disableGroupSeparators === false) {
62
+ throw new Error('decimalSeparator cannot be the same as groupSeparator');
63
+ }
64
+ var formatValueOptions = {
65
+ decimalSeparator: decimalSeparator,
66
+ groupSeparator: groupSeparator,
67
+ disableGroupSeparators: disableGroupSeparators,
68
+ intlConfig: intlConfig,
69
+ prefix: prefix || localeConfig.prefix,
70
+ suffix: suffix
71
+ };
72
+ var cleanValueOptions = {
73
+ decimalSeparator: decimalSeparator,
74
+ groupSeparator: groupSeparator,
75
+ allowDecimals: allowDecimals,
76
+ decimalsLimit: decimalsLimit || fixedDecimalLength || 2,
77
+ allowNegativeValue: allowNegativeValue,
78
+ disableAbbreviations: disableAbbreviations,
79
+ prefix: prefix || localeConfig.prefix,
80
+ transformRawValue: transformRawValue
81
+ };
82
+ var _useState = useState(function () {
83
+ return defaultValue != null ? formatValue(_extends({}, formatValueOptions, {
84
+ decimalScale: decimalScale,
85
+ value: String(defaultValue)
86
+ })) : userValue != null ? formatValue(_extends({}, formatValueOptions, {
87
+ decimalScale: decimalScale,
88
+ value: String(userValue)
89
+ })) : '';
90
+ }),
91
+ _useState2 = _slicedToArray(_useState, 2),
92
+ stateValue = _useState2[0],
93
+ setStateValue = _useState2[1];
94
+ var _useState3 = useState(false),
95
+ _useState4 = _slicedToArray(_useState3, 2),
96
+ dirty = _useState4[0],
97
+ setDirty = _useState4[1];
98
+ var _useState5 = useState(0),
99
+ _useState6 = _slicedToArray(_useState5, 2),
100
+ cursor = _useState6[0],
101
+ setCursor = _useState6[1];
102
+ var _useState7 = useState(0),
103
+ _useState8 = _slicedToArray(_useState7, 2),
104
+ changeCount = _useState8[0],
105
+ setChangeCount = _useState8[1];
106
+ var _useState9 = useState(null),
107
+ _useState10 = _slicedToArray(_useState9, 2),
108
+ lastKeyStroke = _useState10[0],
109
+ setLastKeyStroke = _useState10[1];
110
+ var inputRef = useRef(null);
111
+ useImperativeHandle(ref, function () {
112
+ return inputRef.current;
113
+ });
114
+
115
+ /**
116
+ * Process change in value
117
+ */
118
+ var processChange = function processChange(value, selectionStart) {
119
+ setDirty(true);
120
+ var _repositionCursor = repositionCursor({
121
+ selectionStart: selectionStart,
122
+ value: value,
123
+ lastKeyStroke: lastKeyStroke,
124
+ stateValue: stateValue,
125
+ groupSeparator: groupSeparator
126
+ }),
127
+ modifiedValue = _repositionCursor.modifiedValue,
128
+ cursorPosition = _repositionCursor.cursorPosition;
129
+ var stringValue = cleanValue(_extends({
130
+ value: modifiedValue
131
+ }, cleanValueOptions));
132
+ if (userMaxLength && stringValue.replace(/-/g, '').length > userMaxLength) {
133
+ return;
134
+ }
135
+ if (stringValue === '' || stringValue === '-' || stringValue === decimalSeparator) {
136
+ onValueChange && onValueChange(undefined, name, {
137
+ "float": null,
138
+ formatted: '',
139
+ value: ''
140
+ });
141
+ setStateValue(stringValue);
142
+ // Always sets cursor after '-' or decimalSeparator input
143
+ setCursor(1);
144
+ return;
145
+ }
146
+ var stringValueWithoutSeparator = decimalSeparator ? stringValue.replace(decimalSeparator, '.') : stringValue;
147
+ var numberValue = parseFloat(stringValueWithoutSeparator);
148
+ var formattedValue = formatValue(_extends({
149
+ value: stringValue
150
+ }, formatValueOptions));
151
+ if (cursorPosition != null) {
152
+ // Prevent cursor jumping
153
+ var newCursor = cursorPosition + (formattedValue.length - value.length);
154
+ newCursor = newCursor <= 0 ? prefix ? prefix.length : 0 : newCursor;
155
+ setCursor(newCursor);
156
+ setChangeCount(changeCount + 1);
157
+ }
158
+ setStateValue(formattedValue);
159
+ if (onValueChange) {
160
+ var values = {
161
+ "float": numberValue,
162
+ formatted: formattedValue,
163
+ value: stringValue
164
+ };
165
+ onValueChange(stringValue, name, values);
166
+ }
167
+ };
168
+
169
+ /**
170
+ * Handle change event
171
+ */
172
+ var handleOnChange = function handleOnChange(event) {
173
+ var _event$target = event.target,
174
+ value = _event$target.value,
175
+ selectionStart = _event$target.selectionStart;
176
+ processChange(value, selectionStart);
177
+ onChange && onChange(event);
178
+ };
179
+
180
+ /**
181
+ * Handle focus event
182
+ */
183
+ var handleOnFocus = function handleOnFocus(event) {
184
+ onFocus && onFocus(event);
185
+ return stateValue ? stateValue.length : 0;
186
+ };
187
+
188
+ /**
189
+ * Handle blur event
190
+ *
191
+ * Format value by padding/trimming decimals if required by
192
+ */
193
+ var handleOnBlur = function handleOnBlur(event) {
194
+ var value = event.target.value;
195
+ var valueOnly = cleanValue(_extends({
196
+ value: value
197
+ }, cleanValueOptions));
198
+ if (valueOnly === '-' || valueOnly === decimalSeparator || !valueOnly) {
199
+ setStateValue('');
200
+ onBlur && onBlur(event);
201
+ return;
202
+ }
203
+ var fixedDecimals = fixedDecimalValue(valueOnly, decimalSeparator, fixedDecimalLength);
204
+ var newValue = padTrimValue(fixedDecimals, decimalSeparator, decimalScale !== undefined ? decimalScale : fixedDecimalLength);
205
+ var numberValue = parseFloat(newValue.replace(decimalSeparator, '.'));
206
+ var formattedValue = formatValue(_extends({}, formatValueOptions, {
207
+ value: newValue
208
+ }));
209
+ if (onValueChange && formatValueOnBlur) {
210
+ onValueChange(newValue, name, {
211
+ "float": numberValue,
212
+ formatted: formattedValue,
213
+ value: newValue
214
+ });
215
+ }
216
+ setStateValue(formattedValue);
217
+ onBlur && onBlur(event);
218
+ };
219
+
220
+ /**
221
+ * Handle key down event
222
+ *
223
+ * Increase or decrease value by step
224
+ */
225
+ var handleOnKeyDown = function handleOnKeyDown(event) {
226
+ var key = event.key;
227
+ setLastKeyStroke(key);
228
+ if (step && (key === 'ArrowUp' || key === 'ArrowDown')) {
229
+ event.preventDefault();
230
+ setCursor(stateValue.length);
231
+ var currentValue = parseFloat(userValue != null ? String(userValue).replace(decimalSeparator, '.') : cleanValue(_extends({
232
+ value: stateValue
233
+ }, cleanValueOptions))) || 0;
234
+ var newValue = key === 'ArrowUp' ? currentValue + step : currentValue - step;
235
+ if (min !== undefined && newValue < Number(min)) {
236
+ return;
237
+ }
238
+ if (max !== undefined && newValue > Number(max)) {
239
+ return;
240
+ }
241
+ var fixedLength = String(step).includes('.') ? Number(String(step).split('.')[1].length) : undefined;
242
+ processChange(String(fixedLength ? newValue.toFixed(fixedLength) : newValue).replace('.', decimalSeparator));
243
+ }
244
+ onKeyDown && onKeyDown(event);
245
+ };
246
+
247
+ /**
248
+ * Handle key up event
249
+ *
250
+ * Move cursor if there is a suffix to prevent user typing past suffix
251
+ */
252
+ var handleOnKeyUp = function handleOnKeyUp(event) {
253
+ var key = event.key,
254
+ selectionStart = event.currentTarget.selectionStart;
255
+ if (key !== 'ArrowUp' && key !== 'ArrowDown' && stateValue !== '-') {
256
+ var _suffix = getSuffix(stateValue, {
257
+ groupSeparator: groupSeparator,
258
+ decimalSeparator: decimalSeparator
259
+ });
260
+ if (_suffix && selectionStart && selectionStart > stateValue.length - _suffix.length) {
261
+ /* istanbul ignore else */
262
+ if (inputRef.current) {
263
+ var newCursor = stateValue.length - _suffix.length;
264
+ inputRef.current.setSelectionRange(newCursor, newCursor);
265
+ }
266
+ }
267
+ }
268
+ onKeyUp && onKeyUp(event);
269
+ };
270
+
271
+ // Update state if userValue changes to undefined
272
+ useEffect(function () {
273
+ if (userValue == null && defaultValue == null) {
274
+ setStateValue('');
275
+ }
276
+ }, [defaultValue, userValue]);
277
+ useEffect(function () {
278
+ // prevent cursor jumping if editing value
279
+ if (dirty && stateValue !== '-' && inputRef.current && document.activeElement === inputRef.current) {
280
+ inputRef.current.setSelectionRange(cursor, cursor);
281
+ }
282
+ }, [stateValue, cursor, inputRef, dirty, changeCount]);
283
+
284
+ /**
285
+ * If user has only entered "-" or decimal separator,
286
+ * keep the char to allow them to enter next value
287
+ */
288
+ var getRenderValue = function getRenderValue() {
289
+ if (userValue != null && stateValue !== '-' && (!decimalSeparator || stateValue !== decimalSeparator)) {
290
+ return formatValue(_extends({}, formatValueOptions, {
291
+ decimalScale: dirty ? undefined : decimalScale,
292
+ value: String(userValue)
293
+ }));
294
+ }
295
+ return stateValue;
296
+ };
297
+ var inputProps = _extends({
298
+ type: 'text',
299
+ inputMode: 'decimal',
300
+ id: id,
301
+ name: name,
302
+ className: className,
303
+ onChange: handleOnChange,
304
+ onBlur: handleOnBlur,
305
+ onFocus: handleOnFocus,
306
+ onKeyDown: handleOnKeyDown,
307
+ onKeyUp: handleOnKeyUp,
308
+ placeholder: placeholder,
309
+ disabled: disabled,
310
+ value: getRenderValue(),
311
+ ref: inputRef
312
+ }, props);
313
+ if (customInput) {
314
+ var CustomInput = customInput;
315
+ return /*#__PURE__*/React.createElement(CustomInput, inputProps);
316
+ }
317
+ return /*#__PURE__*/React.createElement("div", null, children && /*#__PURE__*/React.createElement("label", {
318
+ style: {
319
+ display: 'block',
320
+ marginBottom: '0.7rem',
321
+ fontSize: '14px',
322
+ fontWeight: 'light'
323
+ }
324
+ }, children), /*#__PURE__*/React.createElement("input", _extends({}, inputProps, {
325
+ style: {
326
+ textAlign: 'right',
327
+ border: "1px solid ".concat(theme.palette.border),
328
+ fontSize: '14px',
329
+ borderRadius: '5px',
330
+ height: '35px',
331
+ padding: '5px 10px',
332
+ fontWeight: 'light',
333
+ width: 'auto',
334
+ background: 'transparent',
335
+ minWidth: '200px'
336
+ }
337
+ })));
338
+ });
339
+
340
+ // CurrencyInput.displayName = 'CurrencyInput';
341
+
342
+ export default InputCurrency;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Add group separator to value eg. 1000 > 1,000
3
+ */
4
+ export var addSeparators = function addSeparators(value) {
5
+ var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ',';
6
+ return value.replace(/\B(?=(\d{3})+(?!\d))/g, separator);
7
+ };
@@ -0,0 +1,69 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import { parseAbbrValue } from './parseAbbrValue';
3
+ import { removeSeparators } from './removeSeparators';
4
+ import { removeInvalidChars } from './removeInvalidChars';
5
+ import { escapeRegExp } from './escapeRegExp';
6
+ /**
7
+ * Remove prefix, separators and extra decimals from value
8
+ */
9
+ export var cleanValue = function cleanValue(_ref) {
10
+ var value = _ref.value,
11
+ _ref$groupSeparator = _ref.groupSeparator,
12
+ groupSeparator = _ref$groupSeparator === void 0 ? ',' : _ref$groupSeparator,
13
+ _ref$decimalSeparator = _ref.decimalSeparator,
14
+ decimalSeparator = _ref$decimalSeparator === void 0 ? '.' : _ref$decimalSeparator,
15
+ _ref$allowDecimals = _ref.allowDecimals,
16
+ allowDecimals = _ref$allowDecimals === void 0 ? true : _ref$allowDecimals,
17
+ _ref$decimalsLimit = _ref.decimalsLimit,
18
+ decimalsLimit = _ref$decimalsLimit === void 0 ? 2 : _ref$decimalsLimit,
19
+ _ref$allowNegativeVal = _ref.allowNegativeValue,
20
+ allowNegativeValue = _ref$allowNegativeVal === void 0 ? true : _ref$allowNegativeVal,
21
+ _ref$disableAbbreviat = _ref.disableAbbreviations,
22
+ disableAbbreviations = _ref$disableAbbreviat === void 0 ? false : _ref$disableAbbreviat,
23
+ _ref$prefix = _ref.prefix,
24
+ prefix = _ref$prefix === void 0 ? '' : _ref$prefix,
25
+ _ref$transformRawValu = _ref.transformRawValue,
26
+ transformRawValue = _ref$transformRawValu === void 0 ? function (rawValue) {
27
+ return rawValue;
28
+ } : _ref$transformRawValu;
29
+ var transformedValue = transformRawValue(value);
30
+ if (transformedValue === '-') {
31
+ return transformedValue;
32
+ }
33
+ var abbreviations = disableAbbreviations ? [] : ['k', 'm', 'b'];
34
+ var reg = new RegExp("((^|\\D)-\\d)|(-".concat(escapeRegExp(prefix), ")"));
35
+ var isNegative = reg.test(transformedValue);
36
+
37
+ // Is there a digit before the prefix? eg. 1$
38
+ var _ref2 = RegExp("(\\d+)-?".concat(escapeRegExp(prefix))).exec(value) || [],
39
+ _ref3 = _slicedToArray(_ref2, 2),
40
+ prefixWithValue = _ref3[0],
41
+ preValue = _ref3[1];
42
+ var withoutPrefix = prefix ? prefixWithValue ? transformedValue.replace(prefixWithValue, '').concat(preValue) : transformedValue.replace(prefix, '') : transformedValue;
43
+ var withoutSeparators = removeSeparators(withoutPrefix, groupSeparator);
44
+ var withoutInvalidChars = removeInvalidChars(withoutSeparators, [groupSeparator, decimalSeparator].concat(abbreviations));
45
+ var valueOnly = withoutInvalidChars;
46
+ if (!disableAbbreviations) {
47
+ // disallow letter without number
48
+ if (abbreviations.some(function (letter) {
49
+ return letter === withoutInvalidChars.toLowerCase().replace(decimalSeparator, '');
50
+ })) {
51
+ return '';
52
+ }
53
+ var parsed = parseAbbrValue(withoutInvalidChars, decimalSeparator);
54
+ if (parsed) {
55
+ valueOnly = String(parsed);
56
+ }
57
+ }
58
+ var includeNegative = isNegative && allowNegativeValue ? '-' : '';
59
+ if (decimalSeparator && valueOnly.includes(decimalSeparator)) {
60
+ var _withoutInvalidChars$ = withoutInvalidChars.split(decimalSeparator),
61
+ _withoutInvalidChars$2 = _slicedToArray(_withoutInvalidChars$, 2),
62
+ _int = _withoutInvalidChars$2[0],
63
+ decimals = _withoutInvalidChars$2[1];
64
+ var trimmedDecimals = decimalsLimit && decimals ? decimals.slice(0, decimalsLimit) : decimals;
65
+ var includeDecimals = allowDecimals ? "".concat(decimalSeparator).concat(trimmedDecimals) : '';
66
+ return "".concat(includeNegative).concat(_int).concat(includeDecimals);
67
+ }
68
+ return "".concat(includeNegative).concat(valueOnly);
69
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Escape regex char
3
+ *
4
+ * See: https://stackoverflow.com/questions/17885855/use-dynamic-variable-string-as-regex-pattern-in-javascript
5
+ */
6
+ export var escapeRegExp = function escapeRegExp(stringToGoIntoTheRegex) {
7
+ return stringToGoIntoTheRegex.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
8
+ };
@@ -0,0 +1,29 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ export var fixedDecimalValue = function fixedDecimalValue(value, decimalSeparator, fixedDecimalLength) {
3
+ if (fixedDecimalLength !== undefined && value.length > 1) {
4
+ if (fixedDecimalLength === 0) {
5
+ return value.replace(decimalSeparator, '');
6
+ }
7
+ if (value.includes(decimalSeparator)) {
8
+ var _value$split = value.split(decimalSeparator),
9
+ _value$split2 = _slicedToArray(_value$split, 2),
10
+ _int = _value$split2[0],
11
+ decimals = _value$split2[1];
12
+ if (decimals.length === fixedDecimalLength) {
13
+ return value;
14
+ }
15
+ if (decimals.length > fixedDecimalLength) {
16
+ return "".concat(_int).concat(decimalSeparator).concat(decimals.slice(0, fixedDecimalLength));
17
+ }
18
+ }
19
+ var reg = value.length > fixedDecimalLength ? new RegExp("(\\d+)(\\d{".concat(fixedDecimalLength, "})")) : new RegExp("(\\d)(\\d+)");
20
+ var match = value.match(reg);
21
+ if (match) {
22
+ var _match = _slicedToArray(match, 3),
23
+ _int2 = _match[1],
24
+ _decimals = _match[2];
25
+ return "".concat(_int2).concat(decimalSeparator).concat(_decimals);
26
+ }
27
+ }
28
+ return value;
29
+ };
@@ -0,0 +1,124 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
+ /* eslint-disable @typescript-eslint/no-use-before-define */
5
+
6
+ import { escapeRegExp } from './escapeRegExp';
7
+ import { getSuffix } from './getSuffix';
8
+ /**
9
+ * Format value with decimal separator, group separator and prefix
10
+ */
11
+ export var formatValue = function formatValue(options) {
12
+ var _value = options.value,
13
+ decimalSeparator = options.decimalSeparator,
14
+ intlConfig = options.intlConfig,
15
+ decimalScale = options.decimalScale,
16
+ _options$prefix = options.prefix,
17
+ prefix = _options$prefix === void 0 ? '' : _options$prefix,
18
+ _options$suffix = options.suffix,
19
+ suffix = _options$suffix === void 0 ? '' : _options$suffix;
20
+ if (_value === '' || _value === undefined) {
21
+ return '';
22
+ }
23
+ if (_value === '-') {
24
+ return '-';
25
+ }
26
+ var isNegative = new RegExp("^\\d?-".concat(prefix ? "".concat(escapeRegExp(prefix), "?") : '', "\\d")).test(_value);
27
+ var value = decimalSeparator !== '.' ? replaceDecimalSeparator(_value, decimalSeparator, isNegative) : _value;
28
+ if (decimalSeparator && decimalSeparator !== '-' && value.startsWith(decimalSeparator)) {
29
+ value = '0' + value;
30
+ }
31
+ var defaultNumberFormatOptions = {
32
+ minimumFractionDigits: decimalScale || 0,
33
+ maximumFractionDigits: 20
34
+ };
35
+ var numberFormatter = intlConfig ? new Intl.NumberFormat(intlConfig.locale, intlConfig.currency ? _extends({}, defaultNumberFormatOptions, {
36
+ style: 'currency',
37
+ currency: intlConfig.currency
38
+ }) : defaultNumberFormatOptions) : new Intl.NumberFormat(undefined, defaultNumberFormatOptions);
39
+ var parts = numberFormatter.formatToParts(Number(value));
40
+ var formatted = replaceParts(parts, options);
41
+
42
+ // Does intl formatting add a suffix?
43
+ var intlSuffix = getSuffix(formatted, _extends({}, options));
44
+
45
+ // Include decimal separator if user input ends with decimal separator
46
+ var includeDecimalSeparator = _value.slice(-1) === decimalSeparator ? decimalSeparator : '';
47
+ var _ref = value.match(RegExp('\\d+\\.(\\d+)')) || [],
48
+ _ref2 = _slicedToArray(_ref, 2),
49
+ decimals = _ref2[1];
50
+
51
+ // Keep original decimal padding if no decimalScale
52
+ if (decimalScale === undefined && decimals && decimalSeparator) {
53
+ if (formatted.includes(decimalSeparator)) {
54
+ formatted = formatted.replace(RegExp("(\\d+)(".concat(escapeRegExp(decimalSeparator), ")(\\d+)"), 'g'), "$1$2".concat(decimals));
55
+ } else {
56
+ if (intlSuffix && !suffix) {
57
+ formatted = formatted.replace(intlSuffix, "".concat(decimalSeparator).concat(decimals).concat(intlSuffix));
58
+ } else {
59
+ formatted = "".concat(formatted).concat(decimalSeparator).concat(decimals);
60
+ }
61
+ }
62
+ }
63
+ if (suffix && includeDecimalSeparator) {
64
+ return "".concat(formatted).concat(includeDecimalSeparator).concat(suffix);
65
+ }
66
+ if (intlSuffix && includeDecimalSeparator) {
67
+ return formatted.replace(intlSuffix, "".concat(includeDecimalSeparator).concat(intlSuffix));
68
+ }
69
+ if (intlSuffix && suffix) {
70
+ return formatted.replace(intlSuffix, "".concat(includeDecimalSeparator).concat(suffix));
71
+ }
72
+ return [formatted, includeDecimalSeparator, suffix].join('');
73
+ };
74
+
75
+ /**
76
+ * Before converting to Number, decimal separator has to be .
77
+ */
78
+ var replaceDecimalSeparator = function replaceDecimalSeparator(value, decimalSeparator, isNegative) {
79
+ var newValue = value;
80
+ if (decimalSeparator && decimalSeparator !== '.') {
81
+ newValue = newValue.replace(RegExp(escapeRegExp(decimalSeparator), 'g'), '.');
82
+ if (isNegative && decimalSeparator === '-') {
83
+ newValue = "-".concat(newValue.slice(1));
84
+ }
85
+ }
86
+ return newValue;
87
+ };
88
+ var replaceParts = function replaceParts(parts, _ref3) {
89
+ var prefix = _ref3.prefix,
90
+ groupSeparator = _ref3.groupSeparator,
91
+ decimalSeparator = _ref3.decimalSeparator,
92
+ decimalScale = _ref3.decimalScale,
93
+ _ref3$disableGroupSep = _ref3.disableGroupSeparators,
94
+ disableGroupSeparators = _ref3$disableGroupSep === void 0 ? false : _ref3$disableGroupSep;
95
+ return parts.reduce(function (prev, _ref4, i) {
96
+ var type = _ref4.type,
97
+ value = _ref4.value;
98
+ if (i === 0 && prefix) {
99
+ if (type === 'minusSign') {
100
+ return [value, prefix];
101
+ }
102
+ if (type === 'currency') {
103
+ return [].concat(_toConsumableArray(prev), [prefix]);
104
+ }
105
+ return [prefix, value];
106
+ }
107
+ if (type === 'currency') {
108
+ return prefix ? prev : [].concat(_toConsumableArray(prev), [value]);
109
+ }
110
+ if (type === 'group') {
111
+ return !disableGroupSeparators ? [].concat(_toConsumableArray(prev), [groupSeparator !== undefined ? groupSeparator : value]) : prev;
112
+ }
113
+ if (type === 'decimal') {
114
+ if (decimalScale !== undefined && decimalScale === 0) {
115
+ return prev;
116
+ }
117
+ return [].concat(_toConsumableArray(prev), [decimalSeparator !== undefined ? decimalSeparator : value]);
118
+ }
119
+ if (type === 'fraction') {
120
+ return [].concat(_toConsumableArray(prev), [decimalScale !== undefined ? value.slice(0, decimalScale) : value]);
121
+ }
122
+ return [].concat(_toConsumableArray(prev), [value]);
123
+ }, ['']).join('');
124
+ };
@@ -0,0 +1,47 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ var defaultConfig = {
3
+ currencySymbol: '',
4
+ groupSeparator: '',
5
+ decimalSeparator: '',
6
+ prefix: '',
7
+ suffix: ''
8
+ };
9
+
10
+ /**
11
+ * Get locale config from input or default
12
+ */
13
+ export var getLocaleConfig = function getLocaleConfig(intlConfig) {
14
+ var _ref = intlConfig || {},
15
+ locale = _ref.locale,
16
+ currency = _ref.currency;
17
+ var numberFormatter = locale ? new Intl.NumberFormat(locale, currency ? {
18
+ currency: currency,
19
+ style: 'currency'
20
+ } : undefined) : new Intl.NumberFormat();
21
+ return numberFormatter.formatToParts(1000.1).reduce(function (prev, curr, i) {
22
+ if (curr.type === 'currency') {
23
+ if (i === 0) {
24
+ return _extends({}, prev, {
25
+ currencySymbol: curr.value,
26
+ prefix: curr.value
27
+ });
28
+ } else {
29
+ return _extends({}, prev, {
30
+ currencySymbol: curr.value,
31
+ suffix: curr.value
32
+ });
33
+ }
34
+ }
35
+ if (curr.type === 'group') {
36
+ return _extends({}, prev, {
37
+ groupSeparator: curr.value
38
+ });
39
+ }
40
+ if (curr.type === 'decimal') {
41
+ return _extends({}, prev, {
42
+ decimalSeparator: curr.value
43
+ });
44
+ }
45
+ return prev;
46
+ }, defaultConfig);
47
+ };
@@ -0,0 +1,10 @@
1
+ import { escapeRegExp } from './escapeRegExp';
2
+ export var getSuffix = function getSuffix(value, _ref) {
3
+ var _ref$groupSeparator = _ref.groupSeparator,
4
+ groupSeparator = _ref$groupSeparator === void 0 ? ',' : _ref$groupSeparator,
5
+ _ref$decimalSeparator = _ref.decimalSeparator,
6
+ decimalSeparator = _ref$decimalSeparator === void 0 ? '.' : _ref$decimalSeparator;
7
+ var suffixReg = new RegExp("\\d([^".concat(escapeRegExp(groupSeparator)).concat(escapeRegExp(decimalSeparator), "0-9]+)"));
8
+ var suffixMatch = value.match(suffixReg);
9
+ return suffixMatch ? suffixMatch[1] : undefined;
10
+ };
@@ -0,0 +1,8 @@
1
+ export * from './cleanValue';
2
+ export * from './fixedDecimalValue';
3
+ export * from './formatValue';
4
+ export * from './getLocaleConfig';
5
+ export * from './getSuffix';
6
+ export * from './isNumber';
7
+ export * from './padTrimValue';
8
+ export * from './repositionCursor';
@@ -0,0 +1,3 @@
1
+ export var isNumber = function isNumber(input) {
2
+ return RegExp(/\d/, 'gi').test(input);
3
+ };