@alfalab/core-components-number-input 2.7.2 → 3.0.0-snapshot-6a9d3fc

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 (235) hide show
  1. package/Component.responsive.d.ts +3 -5
  2. package/Component.responsive.js +3 -2
  3. package/Component.responsive.js.map +1 -0
  4. package/components/number-input/Component.d.ts +4 -7
  5. package/components/number-input/Component.js +3 -2
  6. package/components/number-input/Component.js.map +1 -0
  7. package/components/number-input/index.d.ts +1 -1
  8. package/components/number-input/index.js +3 -2
  9. package/components/number-input/index.js.map +1 -0
  10. package/components/steppers/Component.d.ts +3 -4
  11. package/components/steppers/Component.js +10 -15
  12. package/components/steppers/Component.js.map +1 -0
  13. package/components/steppers/default.css +6 -28
  14. package/components/steppers/default.module.css.js +8 -0
  15. package/components/steppers/default.module.css.js.map +1 -0
  16. package/components/steppers/index.css +9 -31
  17. package/components/steppers/index.d.ts +1 -1
  18. package/components/steppers/index.js +3 -2
  19. package/components/steppers/index.js.map +1 -0
  20. package/components/steppers/index.module.css.js +8 -0
  21. package/components/steppers/index.module.css.js.map +1 -0
  22. package/components/steppers/inverted.css +6 -28
  23. package/components/steppers/inverted.module.css.js +8 -0
  24. package/components/steppers/inverted.module.css.js.map +1 -0
  25. package/constants/min-max-safe-integer.d.ts +2 -3
  26. package/constants/min-max-safe-integer.js +1 -0
  27. package/constants/min-max-safe-integer.js.map +1 -0
  28. package/cssm/Component.responsive.d.ts +3 -5
  29. package/cssm/Component.responsive.js +6 -5
  30. package/cssm/Component.responsive.js.map +1 -0
  31. package/cssm/components/number-input/Component.d.ts +4 -7
  32. package/cssm/components/number-input/Component.js +7 -6
  33. package/cssm/components/number-input/Component.js.map +1 -0
  34. package/cssm/components/number-input/index.d.ts +1 -1
  35. package/cssm/components/number-input/index.js +3 -2
  36. package/cssm/components/number-input/index.js.map +1 -0
  37. package/cssm/components/steppers/Component.d.ts +3 -4
  38. package/cssm/components/steppers/Component.js +5 -4
  39. package/cssm/components/steppers/Component.js.map +1 -0
  40. package/cssm/components/steppers/default.module.css +3 -24
  41. package/cssm/components/steppers/index.d.ts +1 -1
  42. package/cssm/components/steppers/index.js +3 -2
  43. package/cssm/components/steppers/index.js.map +1 -0
  44. package/cssm/components/steppers/index.module.css +4 -25
  45. package/cssm/components/steppers/inverted.module.css +3 -24
  46. package/cssm/constants/min-max-safe-integer.d.ts +2 -3
  47. package/cssm/constants/min-max-safe-integer.js +1 -0
  48. package/cssm/constants/min-max-safe-integer.js.map +1 -0
  49. package/cssm/desktop/Component.desktop.d.ts +3 -5
  50. package/cssm/desktop/Component.desktop.js +3 -2
  51. package/cssm/desktop/Component.desktop.js.map +1 -0
  52. package/cssm/desktop/index.d.ts +1 -2
  53. package/cssm/desktop/index.js +3 -2
  54. package/cssm/desktop/index.js.map +1 -0
  55. package/cssm/index.d.ts +1 -2
  56. package/cssm/index.js +1 -0
  57. package/cssm/index.js.map +1 -0
  58. package/cssm/mobile/Component.mobile.d.ts +3 -5
  59. package/cssm/mobile/Component.mobile.js +3 -2
  60. package/cssm/mobile/Component.mobile.js.map +1 -0
  61. package/cssm/mobile/index.d.ts +1 -2
  62. package/cssm/mobile/index.js +3 -2
  63. package/cssm/mobile/index.js.map +1 -0
  64. package/cssm/shared/index.d.ts +3 -3
  65. package/cssm/shared/index.js +3 -2
  66. package/cssm/shared/index.js.map +1 -0
  67. package/cssm/utils.d.ts +10 -11
  68. package/cssm/utils.js +14 -13
  69. package/cssm/utils.js.map +1 -0
  70. package/desktop/Component.desktop.d.ts +3 -5
  71. package/desktop/Component.desktop.js +3 -2
  72. package/desktop/Component.desktop.js.map +1 -0
  73. package/desktop/index.d.ts +1 -2
  74. package/desktop/index.js +3 -2
  75. package/desktop/index.js.map +1 -0
  76. package/esm/Component.responsive.d.ts +3 -5
  77. package/esm/Component.responsive.js +1 -0
  78. package/esm/Component.responsive.js.map +1 -0
  79. package/esm/components/number-input/Component.d.ts +4 -7
  80. package/esm/components/number-input/Component.js +2 -1
  81. package/esm/components/number-input/Component.js.map +1 -0
  82. package/esm/components/number-input/index.d.ts +1 -1
  83. package/esm/components/number-input/index.js +1 -0
  84. package/esm/components/number-input/index.js.map +1 -0
  85. package/esm/components/steppers/Component.d.ts +3 -4
  86. package/esm/components/steppers/Component.js +4 -9
  87. package/esm/components/steppers/Component.js.map +1 -0
  88. package/esm/components/steppers/default.css +6 -28
  89. package/esm/components/steppers/default.module.css.js +6 -0
  90. package/esm/components/steppers/default.module.css.js.map +1 -0
  91. package/esm/components/steppers/index.css +9 -31
  92. package/esm/components/steppers/index.d.ts +1 -1
  93. package/esm/components/steppers/index.js +1 -0
  94. package/esm/components/steppers/index.js.map +1 -0
  95. package/esm/components/steppers/index.module.css.js +6 -0
  96. package/esm/components/steppers/index.module.css.js.map +1 -0
  97. package/esm/components/steppers/inverted.css +6 -28
  98. package/esm/components/steppers/inverted.module.css.js +6 -0
  99. package/esm/components/steppers/inverted.module.css.js.map +1 -0
  100. package/esm/constants/min-max-safe-integer.d.ts +2 -3
  101. package/esm/constants/min-max-safe-integer.js +1 -0
  102. package/esm/constants/min-max-safe-integer.js.map +1 -0
  103. package/esm/desktop/Component.desktop.d.ts +3 -5
  104. package/esm/desktop/Component.desktop.js +1 -0
  105. package/esm/desktop/Component.desktop.js.map +1 -0
  106. package/esm/desktop/index.d.ts +1 -2
  107. package/esm/desktop/index.js +1 -0
  108. package/esm/desktop/index.js.map +1 -0
  109. package/esm/index.d.ts +1 -2
  110. package/esm/index.js +1 -0
  111. package/esm/index.js.map +1 -0
  112. package/esm/mobile/Component.mobile.d.ts +3 -5
  113. package/esm/mobile/Component.mobile.js +1 -0
  114. package/esm/mobile/Component.mobile.js.map +1 -0
  115. package/esm/mobile/index.d.ts +1 -2
  116. package/esm/mobile/index.js +1 -0
  117. package/esm/mobile/index.js.map +1 -0
  118. package/esm/shared/index.d.ts +3 -3
  119. package/esm/shared/index.js +1 -0
  120. package/esm/shared/index.js.map +1 -0
  121. package/esm/utils.d.ts +10 -11
  122. package/esm/utils.js +3 -2
  123. package/esm/utils.js.map +1 -0
  124. package/index.d.ts +1 -2
  125. package/index.js +1 -0
  126. package/index.js.map +1 -0
  127. package/mobile/Component.mobile.d.ts +3 -5
  128. package/mobile/Component.mobile.js +3 -2
  129. package/mobile/Component.mobile.js.map +1 -0
  130. package/mobile/index.d.ts +1 -2
  131. package/mobile/index.js +3 -2
  132. package/mobile/index.js.map +1 -0
  133. package/modern/Component.responsive.d.ts +3 -5
  134. package/modern/Component.responsive.js +1 -0
  135. package/modern/Component.responsive.js.map +1 -0
  136. package/modern/components/number-input/Component.d.ts +4 -7
  137. package/modern/components/number-input/Component.js +2 -1
  138. package/modern/components/number-input/Component.js.map +1 -0
  139. package/modern/components/number-input/index.d.ts +1 -1
  140. package/modern/components/number-input/index.js +1 -0
  141. package/modern/components/number-input/index.js.map +1 -0
  142. package/modern/components/steppers/Component.d.ts +3 -4
  143. package/modern/components/steppers/Component.js +4 -9
  144. package/modern/components/steppers/Component.js.map +1 -0
  145. package/modern/components/steppers/default.css +6 -28
  146. package/modern/components/steppers/default.module.css.js +6 -0
  147. package/modern/components/steppers/default.module.css.js.map +1 -0
  148. package/modern/components/steppers/index.css +9 -31
  149. package/modern/components/steppers/index.d.ts +1 -1
  150. package/modern/components/steppers/index.js +1 -0
  151. package/modern/components/steppers/index.js.map +1 -0
  152. package/modern/components/steppers/index.module.css.js +6 -0
  153. package/modern/components/steppers/index.module.css.js.map +1 -0
  154. package/modern/components/steppers/inverted.css +6 -28
  155. package/modern/components/steppers/inverted.module.css.js +6 -0
  156. package/modern/components/steppers/inverted.module.css.js.map +1 -0
  157. package/modern/constants/min-max-safe-integer.d.ts +2 -3
  158. package/modern/constants/min-max-safe-integer.js +2 -1
  159. package/modern/constants/min-max-safe-integer.js.map +1 -0
  160. package/modern/desktop/Component.desktop.d.ts +3 -5
  161. package/modern/desktop/Component.desktop.js +1 -0
  162. package/modern/desktop/Component.desktop.js.map +1 -0
  163. package/modern/desktop/index.d.ts +1 -2
  164. package/modern/desktop/index.js +1 -0
  165. package/modern/desktop/index.js.map +1 -0
  166. package/modern/index.d.ts +1 -2
  167. package/modern/index.js +1 -0
  168. package/modern/index.js.map +1 -0
  169. package/modern/mobile/Component.mobile.d.ts +3 -5
  170. package/modern/mobile/Component.mobile.js +1 -0
  171. package/modern/mobile/Component.mobile.js.map +1 -0
  172. package/modern/mobile/index.d.ts +1 -2
  173. package/modern/mobile/index.js +1 -0
  174. package/modern/mobile/index.js.map +1 -0
  175. package/modern/shared/index.d.ts +3 -3
  176. package/modern/shared/index.js +1 -0
  177. package/modern/shared/index.js.map +1 -0
  178. package/modern/utils.d.ts +10 -11
  179. package/modern/utils.js +3 -2
  180. package/modern/utils.js.map +1 -0
  181. package/moderncssm/Component.responsive.d.ts +3 -5
  182. package/moderncssm/Component.responsive.js +1 -0
  183. package/moderncssm/Component.responsive.js.map +1 -0
  184. package/moderncssm/components/number-input/Component.d.ts +4 -7
  185. package/moderncssm/components/number-input/Component.js +2 -1
  186. package/moderncssm/components/number-input/Component.js.map +1 -0
  187. package/moderncssm/components/number-input/index.d.ts +1 -1
  188. package/moderncssm/components/number-input/index.js +1 -0
  189. package/moderncssm/components/number-input/index.js.map +1 -0
  190. package/moderncssm/components/steppers/Component.d.ts +3 -4
  191. package/moderncssm/components/steppers/Component.js +1 -0
  192. package/moderncssm/components/steppers/Component.js.map +1 -0
  193. package/moderncssm/components/steppers/default.module.css +0 -2
  194. package/moderncssm/components/steppers/index.d.ts +1 -1
  195. package/moderncssm/components/steppers/index.js +1 -0
  196. package/moderncssm/components/steppers/index.js.map +1 -0
  197. package/moderncssm/components/steppers/index.module.css +0 -2
  198. package/moderncssm/components/steppers/inverted.module.css +0 -2
  199. package/moderncssm/constants/min-max-safe-integer.d.ts +2 -3
  200. package/moderncssm/constants/min-max-safe-integer.js +2 -1
  201. package/moderncssm/constants/min-max-safe-integer.js.map +1 -0
  202. package/moderncssm/desktop/Component.desktop.d.ts +3 -5
  203. package/moderncssm/desktop/Component.desktop.js +1 -0
  204. package/moderncssm/desktop/Component.desktop.js.map +1 -0
  205. package/moderncssm/desktop/index.d.ts +1 -2
  206. package/moderncssm/desktop/index.js +1 -0
  207. package/moderncssm/desktop/index.js.map +1 -0
  208. package/moderncssm/index.d.ts +1 -2
  209. package/moderncssm/index.js +1 -0
  210. package/moderncssm/index.js.map +1 -0
  211. package/moderncssm/mobile/Component.mobile.d.ts +3 -5
  212. package/moderncssm/mobile/Component.mobile.js +1 -0
  213. package/moderncssm/mobile/Component.mobile.js.map +1 -0
  214. package/moderncssm/mobile/index.d.ts +1 -2
  215. package/moderncssm/mobile/index.js +1 -0
  216. package/moderncssm/mobile/index.js.map +1 -0
  217. package/moderncssm/shared/index.d.ts +3 -3
  218. package/moderncssm/shared/index.js +1 -0
  219. package/moderncssm/shared/index.js.map +1 -0
  220. package/moderncssm/utils.d.ts +10 -11
  221. package/moderncssm/utils.js +3 -2
  222. package/moderncssm/utils.js.map +1 -0
  223. package/package.json +9 -8
  224. package/shared/index.d.ts +3 -3
  225. package/shared/index.js +3 -2
  226. package/shared/index.js.map +1 -0
  227. package/utils.d.ts +10 -11
  228. package/utils.js +4 -3
  229. package/utils.js.map +1 -0
  230. package/desktop/package.json +0 -3
  231. package/mobile/package.json +0 -3
  232. package/shared/package.json +0 -3
  233. package/src/desktop/package.json +0 -3
  234. package/src/mobile/package.json +0 -3
  235. package/src/shared/package.json +0 -3
package/modern/utils.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { maskitoTransform } from '@maskito/core';
2
- import { getDataTestId, fnUtils } from '@alfalab/core-components-shared/modern';
3
- import { MIN_SAFE_INTEGER, MAX_SAFE_INTEGER } from './constants/min-max-safe-integer.js';
2
+ import { fnUtils, getDataTestId } from '@alfalab/core-components-shared/modern';
3
+ import { MAX_SAFE_INTEGER, MIN_SAFE_INTEGER } from './constants/min-max-safe-integer.js';
4
4
 
5
5
  /* eslint-disable no-param-reassign */
6
6
  const MINUS_SIGN = '-';
@@ -252,3 +252,4 @@ const getMinMaxOrDefault = ({ minProp, maxProp, }) => {
252
252
  };
253
253
 
254
254
  export { MAX_DIGITS, MINUS_SIGN, SEPARATORS, createMaskOptions, createMinMaxPlugin, createNotEmptyPartsPlugin, getMinMaxOrDefault, getNumberInputTestIds, parseNumber, stringifyNumberWithoutExp };
255
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport {\n MaskitoOptions,\n MaskitoPlugin,\n MaskitoPostprocessor,\n MaskitoPreprocessor,\n maskitoTransform,\n} from '@maskito/core';\n\nimport { fnUtils, getDataTestId } from '@alfalab/core-components-shared';\n\nimport { MAX_SAFE_INTEGER, MIN_SAFE_INTEGER } from './constants/min-max-safe-integer';\n\nexport const MINUS_SIGN = '-';\nexport const SEPARATORS = [',', '.'];\nexport const MAX_DIGITS = 15; // с 16 уже упираемся в MAX_SAFE_INTEGER\n\nexport function parseNumber(value: string | number | null = '') {\n if (typeof value === 'number') return value;\n\n const pseudoSeparatorsRegExp = new RegExp(`[${SEPARATORS.join('')}]`, 'gi');\n\n return value\n ? parseFloat(\n value\n .replace(new RegExp(`[^${MINUS_SIGN}${SEPARATORS.join('')}0-9]`, 'gi'), '')\n .replace(pseudoSeparatorsRegExp, '.'),\n )\n : NaN;\n}\n\n/**\n * Преобразовать число в строку с заменой экспоненты на десятичную дробь\n */\nexport function stringifyNumberWithoutExp(value: number): string {\n const valueString = String(value);\n const [numberPart, expPart] = valueString.split('e-');\n\n let valueWithoutExp = valueString;\n\n if (expPart) {\n const [, fractionalPart] = numberPart.split('.');\n const decimalDigits = Number(expPart) + (fractionalPart?.length || 0);\n\n valueWithoutExp = value.toFixed(decimalDigits);\n }\n\n return valueWithoutExp;\n}\n\nconst getNumberRegExp = (min: number, fractionLength: number): RegExp => {\n let reStr = '[0-9]*';\n\n if (min < 0) {\n reStr = `(\\\\${MINUS_SIGN})?${reStr}`;\n }\n\n if (fractionLength !== 0) {\n reStr = `${reStr}[${SEPARATORS.map((s) => `\\\\${s}`).join('')}]?[0-9]{0,${\n fractionLength || MAX_DIGITS\n }}`;\n }\n\n return new RegExp(`^${reStr}$`);\n};\n\nexport function createMaskOptions({\n separator,\n fractionLength,\n min,\n max,\n}: {\n separator: string;\n fractionLength: number;\n min: number;\n max: number;\n}): MaskitoOptions {\n return {\n mask: getNumberRegExp(min, fractionLength),\n preprocessors: [\n createPseudoSeparatorPreprocessor(separator),\n createNotEmptyIntegerPartPreprocessor({ separator, fractionLength }),\n createZeroFractionLengthPreprocessor(fractionLength, separator),\n createRepeatedSeparatorPreprocessor(separator),\n ],\n postprocessors: [\n createLeadingZeroesValidationPostprocessor(separator),\n createMinMaxPostprocessor({ min, max, separator }),\n ],\n plugins: [createNotEmptyPartsPlugin(separator), createMinMaxPlugin({ min, max })],\n };\n}\n\n/**\n * Заполняет целочисленную часть при вводе separator.\n * @example Type , => 0,\n */\nfunction createNotEmptyIntegerPartPreprocessor({\n separator,\n fractionLength,\n}: {\n separator: string;\n fractionLength: number;\n}): MaskitoPreprocessor {\n const startWithDecimalSepRegExp = new RegExp(`^\\\\D*\\\\${separator}`);\n\n return ({ elementState, data }) => {\n const { value, selection } = elementState;\n const [from] = selection;\n\n if (\n fractionLength <= 0 ||\n value.includes(separator) ||\n !data.match(startWithDecimalSepRegExp)\n ) {\n return { elementState, data };\n }\n\n const digitsBeforeCursor = value.slice(0, from).match(/\\d+/);\n\n return {\n elementState,\n data: digitsBeforeCursor ? data : `0${data}`,\n };\n };\n}\n\n/**\n * Не позволяет вводить невалидный разделитель.\n */\nfunction createPseudoSeparatorPreprocessor(separator: string): MaskitoPreprocessor {\n const pseudoSeparatorsRegExp = new RegExp(`[${SEPARATORS.join('')}]`, 'gi');\n\n return ({ elementState, data }) => {\n const { value, selection } = elementState;\n\n return {\n elementState: {\n selection,\n value: value.replace(pseudoSeparatorsRegExp, separator),\n },\n data: data.replace(pseudoSeparatorsRegExp, separator),\n };\n };\n}\n\n/**\n * Помогает верно обрезать значения при вставке, если fractionLength===0\n * @example paste 123,123 -> 123\n */\nfunction createZeroFractionLengthPreprocessor(\n fractionLength: number,\n separator: string,\n): MaskitoPreprocessor {\n if (fractionLength > 0) {\n return (state) => state;\n }\n\n const decimalPartRegExp = new RegExp(`\\\\${separator}.*$`, 'g');\n\n return ({ elementState, data }) => {\n const { value, selection } = elementState;\n const [from, to] = selection;\n const newValue = value.replace(decimalPartRegExp, '');\n\n return {\n elementState: {\n selection: [Math.min(from, newValue.length), Math.min(to, newValue.length)],\n value: newValue,\n },\n data: data.replace(decimalPartRegExp, ''),\n };\n };\n}\n\n/**\n * Запрещает вводить второй сепаратор\n */\nfunction createRepeatedSeparatorPreprocessor(separator: string): MaskitoPreprocessor {\n return ({ elementState, data }) => {\n const { value, selection } = elementState;\n const [from, to] = selection;\n\n return {\n elementState,\n data:\n !value.includes(separator) || value.slice(from, to + 1).includes(separator)\n ? data\n : data.replace(new RegExp(`\\\\${separator}`), ''),\n };\n };\n}\n\n/**\n * Удаляет лишние нули в начале целой части.\n * @example 0,|00005 => Backspace => |5\n * @example -0,|00005 => Backspace => -|5\n * @example \"000000\" => 0|\n * @example 0| => Type \"5\" => 5|\n */\nfunction createLeadingZeroesValidationPostprocessor(separator: string): MaskitoPostprocessor {\n const trimLeadingZeroes = (value: string): string =>\n value\n .replace(new RegExp('^(\\\\D+)?0+(?=0)'), '$1')\n .replace(new RegExp('^(\\\\D+)?0+(?=[1-9])'), '$1');\n\n const countTrimmedZeroesBefore = (value: string, index: number): number => {\n const valueBefore = value.slice(0, index);\n const followedByZero = value.slice(index).startsWith('0');\n\n return (\n valueBefore.length - trimLeadingZeroes(valueBefore).length + (followedByZero ? 1 : 0)\n );\n };\n\n return ({ value, selection }) => {\n const [from, to] = selection;\n const hasSeparator = value.includes(separator);\n const [integerPart, decimalPart = ''] = value.split(separator);\n const zeroTrimmedIntegerPart = trimLeadingZeroes(integerPart);\n\n if (integerPart === zeroTrimmedIntegerPart) {\n return { value, selection };\n }\n\n const newFrom = from - countTrimmedZeroesBefore(value, from);\n const newTo = to - countTrimmedZeroesBefore(value, to);\n\n return {\n value: zeroTrimmedIntegerPart + (hasSeparator ? separator : '') + decimalPart,\n selection: [Math.max(newFrom, 0), Math.max(newTo, 0)],\n };\n };\n}\n\n/**\n * Валидирует значение с учетом min max значений.\n * Работает совместно с createMinMaxPlugin\n */\nfunction createMinMaxPostprocessor({\n min,\n max,\n separator,\n}: {\n min: number;\n max: number;\n separator: string;\n}): MaskitoPostprocessor {\n return ({ value, selection }) => {\n const parsedNumber = parseNumber(value);\n\n const limitedValue =\n /**\n * Здесь невозможно ограничить нижнюю границу, если пользователь вводит положительное число.\n * То же самое для верхней границы и отрицательного числа.\n * Если min=5, то без этого условия не получится ввести 40, похожая ситуация и с отрицательным max\n */\n parsedNumber > 0 ? Math.min(parsedNumber, max) : Math.max(parsedNumber, min);\n\n if (!Number.isNaN(parsedNumber) && limitedValue !== parsedNumber) {\n const newValue = `${limitedValue}`.replace('.', separator);\n\n return {\n value: newValue,\n selection: [newValue.length, newValue.length],\n };\n }\n\n return {\n value,\n selection,\n };\n };\n}\n\nexport function createMinMaxPlugin({ min, max }: { min: number; max: number }): MaskitoPlugin {\n return (element, options) => {\n const listener = () => {\n const parsedNumber = parseNumber(element.value);\n\n const clampedNumber = fnUtils.clamp(parsedNumber, min, max);\n\n if (!Number.isNaN(parsedNumber) && parsedNumber !== clampedNumber) {\n element.value = maskitoTransform(stringifyNumberWithoutExp(clampedNumber), options);\n element.dispatchEvent(new Event('input', { bubbles: true }));\n }\n };\n\n const evListenerOptions = { capture: true };\n\n element.addEventListener('blur', listener, evListenerOptions);\n\n return () => element.removeEventListener('blur', listener, evListenerOptions);\n };\n}\n\nexport function createNotEmptyPartsPlugin(separator: string): MaskitoPlugin {\n return (element) => {\n const listener = () => {\n const newValue = element.value\n // 0,9000000 -> 0,9\n .replace(new RegExp(`(\\\\${separator}\\\\d*?)(0+$)`), '$1')\n // ,2 => 0,2\n .replace(new RegExp(`^(\\\\D+)?\\\\${separator}`), `$10${separator}`)\n // 0, -> 0\n .replace(new RegExp(`\\\\${separator}$`), '')\n // -0 -> 0\n .replace(new RegExp(`^${MINUS_SIGN}0$`), '0')\n // - -> ''\n .replace(new RegExp(`^${MINUS_SIGN}$`), '');\n\n if (newValue !== element.value) {\n element.value = newValue;\n element.dispatchEvent(new Event('input', { bubbles: true }));\n }\n };\n\n const evListenerOptions = { capture: true };\n\n element.addEventListener('blur', listener, evListenerOptions);\n\n return () => element.removeEventListener('blur', listener, evListenerOptions);\n };\n}\n\nexport function getNumberInputTestIds(dataTestId: string) {\n return {\n input: dataTestId,\n inputWrapper: getDataTestId(dataTestId, 'form-control'),\n inputWrapperInner: getDataTestId(dataTestId, 'form-control-inner'),\n leftAddons: getDataTestId(dataTestId, 'form-control-left-addons'),\n rightAddons: getDataTestId(dataTestId, 'form-control-right-addons'),\n error: getDataTestId(dataTestId, 'form-control-error-message'),\n hint: getDataTestId(dataTestId, 'form-control-hint'),\n decrementButton: getDataTestId(dataTestId, 'decrement-button'),\n incrementButton: getDataTestId(dataTestId, 'increment-button'),\n };\n}\n\n/**\n * Определение минимального / максимального значения\n * @description Если значение не передано, вернется { Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER }\n */\nexport const getMinMaxOrDefault = ({\n minProp,\n maxProp,\n}: {\n minProp?: number;\n maxProp?: number;\n}) => {\n const min = Math.max(MIN_SAFE_INTEGER, minProp ?? MIN_SAFE_INTEGER);\n const max = Math.min(MAX_SAFE_INTEGER, maxProp ?? MAX_SAFE_INTEGER);\n\n return { min, max };\n};\n"],"names":[],"mappings":";;;;AAAA;AAaO,MAAM,UAAU,GAAG;MACb,UAAU,GAAG,CAAC,GAAG,EAAE,GAAG;AACtB,MAAA,UAAU,GAAG,GAAG;AAEb,SAAA,WAAW,CAAC,KAAA,GAAgC,EAAE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I,CAAC,GAAG,CAAC,gBAAgB,EAAE,OAAO,IAAI,gBAAgB,CAAC;AAEnE,IAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE;AACvB;;;;"}
@@ -1,6 +1,4 @@
1
- /// <reference types="react" />
2
1
  import React from 'react';
3
- import { NumberInputProps } from "./components/number-input/index";
4
- type NumberInputResponsiveProps = Omit<NumberInputProps, 'Input' | 'view'>;
5
- declare const NumberInputResponsive: React.ForwardRefExoticComponent<NumberInputResponsiveProps & React.RefAttributes<HTMLInputElement>>;
6
- export { NumberInputResponsiveProps, NumberInputResponsive };
2
+ import { NumberInputProps } from './components/number-input';
3
+ export declare type NumberInputResponsiveProps = Omit<NumberInputProps, 'Input' | 'view'>;
4
+ export declare const NumberInputResponsive: React.ForwardRefExoticComponent<NumberInputResponsiveProps & React.RefAttributes<HTMLInputElement>>;
@@ -10,3 +10,4 @@ const NumberInputResponsive = forwardRef(({ breakpoint, client, defaultMatchMedi
10
10
  NumberInputResponsive.displayName = 'NumberInputResponsive';
11
11
 
12
12
  export { NumberInputResponsive };
13
+ //# sourceMappingURL=Component.responsive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Component.responsive.js","sources":["../src/Component.responsive.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { Input } from '@alfalab/core-components-input';\nimport { useIsDesktop } from '@alfalab/core-components-mq';\n\nimport { NumberInput, NumberInputProps } from './components/number-input';\n\nexport type NumberInputResponsiveProps = Omit<NumberInputProps, 'Input' | 'view'>;\n\nexport const NumberInputResponsive = forwardRef<HTMLInputElement, NumberInputResponsiveProps>(\n (\n {\n breakpoint,\n client,\n defaultMatchMediaValue = client === undefined ? undefined : client === 'desktop',\n ...restProps\n },\n ref,\n ) => {\n const isDesktop = useIsDesktop(breakpoint, defaultMatchMediaValue);\n\n return (\n <NumberInput\n {...restProps}\n Input={Input}\n ref={ref}\n view={isDesktop ? 'desktop' : 'mobile'}\n breakpoint={breakpoint}\n defaultMatchMediaValue={defaultMatchMediaValue}\n />\n );\n },\n);\n\nNumberInputResponsive.displayName = 'NumberInputResponsive';\n"],"names":[],"mappings":";;;;;AASO,MAAM,qBAAqB,GAAG,UAAU,CAC3C,CACI,EACI,UAAU,EACV,MAAM,EACN,sBAAsB,GAAG,MAAM,KAAK,SAAS,GAAG,SAAS,GAAG,MAAM,KAAK,SAAS,EAChF,GAAG,SAAS,EACf,EACD,GAAG,KACH;IACA,MAAM,SAAS,GAAG,YAAY,CAAC,UAAU,EAAE,sBAAsB,CAAC;AAElE,IAAA,QACI,KAAA,CAAA,aAAA,CAAC,WAAW,EAAA,EAAA,GACJ,SAAS,EACb,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,EACtC,UAAU,EAAE,UAAU,EACtB,sBAAsB,EAAE,sBAAsB,EAAA,CAChD;AAEV,CAAC;AAGL,qBAAqB,CAAC,WAAW,GAAG,uBAAuB;;;;"}
@@ -1,8 +1,6 @@
1
- /// <reference types="react" />
2
- import React from 'react';
3
- import { ChangeEvent, FC, Ref } from "react";
4
- import { InputProps } from "@alfalab/core-components-input";
5
- interface NumberInputProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'defaultValue' | 'dataTestId'> {
1
+ import React, { ChangeEvent, FC, Ref } from 'react';
2
+ import type { InputProps } from '@alfalab/core-components-input';
3
+ export interface NumberInputProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'defaultValue' | 'dataTestId'> {
6
4
  /**
7
5
  * Значение поля ввода
8
6
  */
@@ -56,5 +54,4 @@ interface NumberInputProps extends Omit<InputProps, 'value' | 'onChange' | 'type
56
54
  */
57
55
  dataTestId?: string;
58
56
  }
59
- declare const NumberInput: React.ForwardRefExoticComponent<NumberInputProps & React.RefAttributes<HTMLInputElement>>;
60
- export { NumberInputProps, NumberInput };
57
+ export declare const NumberInput: React.ForwardRefExoticComponent<NumberInputProps & React.RefAttributes<HTMLInputElement>>;
@@ -3,7 +3,7 @@ import mergeRefs from 'react-merge-refs';
3
3
  import { maskitoTransform } from '@maskito/core';
4
4
  import { useMaskito } from '@maskito/react';
5
5
  import { fnUtils, os } from '@alfalab/core-components-shared/moderncssm';
6
- import { createMaskOptions, parseNumber, stringifyNumberWithoutExp, MAX_DIGITS, getMinMaxOrDefault, MINUS_SIGN } from '../../utils.js';
6
+ import { createMaskOptions, MAX_DIGITS, getMinMaxOrDefault, parseNumber, stringifyNumberWithoutExp, MINUS_SIGN } from '../../utils.js';
7
7
  import { Steppers } from '../steppers/Component.js';
8
8
 
9
9
  const NumberInput = forwardRef(({ value: propValue, onChange, separator = ',', fractionLength = MAX_DIGITS, defaultValue, Input, min: minProp, max: maxProp, rightAddons, dataTestId, disabled, onBlur, onFocus, view, step: stepProp, size = 48, disableUserInput, clear: clearProp, colors = 'default', ...restProps }, ref) => {
@@ -84,3 +84,4 @@ const NumberInput = forwardRef(({ value: propValue, onChange, separator = ',', f
84
84
  });
85
85
 
86
86
  export { NumberInput };
87
+ //# sourceMappingURL=Component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Component.js","sources":["../../../src/components/number-input/Component.tsx"],"sourcesContent":["import React, {\n ChangeEvent,\n FC,\n FocusEvent,\n forwardRef,\n Ref,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport mergeRefs from 'react-merge-refs';\nimport { MaskitoOptions, maskitoTransform } from '@maskito/core';\nimport { useMaskito } from '@maskito/react';\n\nimport type { InputProps } from '@alfalab/core-components-input';\nimport { fnUtils, os } from '@alfalab/core-components-shared';\n\nimport {\n createMaskOptions,\n getMinMaxOrDefault,\n MAX_DIGITS,\n MINUS_SIGN,\n parseNumber,\n stringifyNumberWithoutExp,\n} from '../../utils';\nimport { Steppers } from '../steppers';\n\nexport interface NumberInputProps\n extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'defaultValue' | 'dataTestId'> {\n /**\n * Значение поля ввода\n */\n value?: string | number | null;\n\n /**\n * Значение по-умолчанию\n */\n defaultValue?: string | number | null;\n\n /**\n * Разделитель ',' или '.'\n */\n separator?: '.' | ',';\n\n /**\n * Количество символов после разделителя\n * Если указан проп step, то всегда 0\n */\n fractionLength?: number;\n\n /**\n * Шаг инкремента/декремента. Используйте только целочисленные значения\n */\n step?: number;\n\n /**\n * Минимальное значение\n * @default Number.MIN_SAFE_INTEGER\n */\n min?: number;\n\n /**\n * Максимальное значение\n * @default Number.MAX_SAFE_INTEGER\n */\n max?: number;\n\n /**\n * Отображение компонента в мобильном или десктопном виде\n */\n view?: 'desktop' | 'mobile';\n\n /**\n * Компонент инпута\n */\n Input: FC<InputProps & { ref?: Ref<HTMLInputElement> }>;\n\n /**\n * Обработчик события изменения значения\n */\n onChange?: (e: ChangeEvent<HTMLInputElement> | null, payload: { value: number | null }) => void;\n\n /**\n * Идентификатор для систем автоматизированного тестирования.\n * Для кнопки инкремента используется модификатор -increment-button, декремента -decrement-button\n */\n dataTestId?: string;\n}\n\nexport const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(\n (\n {\n value: propValue,\n onChange,\n separator = ',',\n fractionLength = MAX_DIGITS,\n defaultValue,\n Input,\n min: minProp,\n max: maxProp,\n rightAddons,\n dataTestId,\n disabled,\n onBlur,\n onFocus,\n view,\n step: stepProp,\n size = 48,\n disableUserInput,\n clear: clearProp,\n colors = 'default',\n ...restProps\n },\n ref,\n ) => {\n const { min, max } = getMinMaxOrDefault({ minProp, maxProp });\n const withStepper = stepProp !== undefined;\n\n const maskOptions: MaskitoOptions = useMemo(\n () =>\n createMaskOptions({\n separator,\n fractionLength: withStepper ? 0 : fractionLength,\n min,\n max,\n }),\n [separator, fractionLength, min, max, withStepper],\n );\n\n const [focused, setFocused] = useState(false);\n const [value, setValue] = useState(() => {\n if (defaultValue == null) {\n return withStepper ? fnUtils.clamp(0, min, max).toString() : '';\n }\n\n return fnUtils\n .clamp(\n parseNumber(maskitoTransform(defaultValue.toString(), maskOptions)),\n min,\n max,\n )\n .toString();\n });\n\n const maskRef = useMaskito({ options: maskOptions });\n\n useEffect(() => {\n if (propValue !== undefined) {\n setValue((prev) => {\n const parsedNumber = parseNumber(propValue);\n\n if (parsedNumber !== parseNumber(prev)) {\n return maskitoTransform(\n stringifyNumberWithoutExp(parsedNumber),\n maskOptions,\n );\n }\n\n return prev;\n });\n }\n }, [maskOptions, propValue, separator]);\n\n const getMaxLength = (valueString: string) => {\n const hasSeparator = valueString?.includes(separator);\n const hasSigns = valueString?.startsWith(MINUS_SIGN);\n\n return MAX_DIGITS + (hasSeparator ? 1 : 0) + (hasSigns ? 1 : 0);\n };\n\n const getStep = () => Math.round(stepProp ?? 1);\n\n const changeValue = (\n event: ChangeEvent<HTMLInputElement> | null,\n newValue: number | null,\n ) => {\n const isNaNValue = Number.isNaN(newValue);\n const valueString = event?.target.value ?? newValue?.toString() ?? '';\n\n setValue(valueString);\n\n if (valueString === '' || !isNaNValue) {\n onChange?.(event, {\n value: isNaNValue ? null : newValue,\n });\n }\n };\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n const valueString = event.target.value;\n\n changeValue(event, parseNumber(valueString));\n };\n\n const handleIncrement = () => {\n const parsed = parseNumber(value);\n const nextValue = maskitoTransform(\n (Number.isNaN(parsed) ? min : parsed + getStep()).toString(),\n maskOptions,\n );\n\n changeValue(null, parseNumber(nextValue));\n };\n\n const handleDecrement = () => {\n const parsed = parseNumber(value);\n const nextValue = maskitoTransform(\n (Number.isNaN(parsed) ? max : parsed - getStep()).toString(),\n maskOptions,\n );\n\n changeValue(null, parseNumber(nextValue));\n };\n\n const handleFocus = (e: FocusEvent<HTMLInputElement>) => {\n onFocus?.(e);\n\n if (!disableUserInput) {\n setFocused(true);\n }\n };\n\n const handleBlur = (e: FocusEvent<HTMLInputElement>) => {\n onBlur?.(e);\n setFocused(false);\n };\n\n return (\n <Input\n maxLength={getMaxLength(value)}\n {...restProps}\n // В iOS в цифровой клавиатуре невозможно ввести минус.\n inputMode={min < 0 && os.isIOS() ? 'text' : 'decimal'}\n ref={mergeRefs([ref, maskRef])}\n value={value}\n onInput={handleChange}\n dataTestId={dataTestId}\n colors={colors}\n disabled={disabled}\n onFocus={handleFocus}\n onBlur={handleBlur}\n size={size}\n disableUserInput={disableUserInput}\n clear={clearProp && /\\d/.test(value)}\n rightAddons={\n withStepper ? (\n <React.Fragment>\n {rightAddons}\n <Steppers\n colors={colors}\n dataTestId={dataTestId}\n disabled={disabled}\n focused={focused}\n value={parseNumber(value)}\n min={min}\n max={max}\n onIncrement={handleIncrement}\n onDecrement={handleDecrement}\n size={size}\n />\n </React.Fragment>\n ) : (\n rightAddons\n )\n }\n />\n );\n },\n);\n"],"names":[],"mappings":";;;;;;;;AAyFO,MAAM,WAAW,GAAG,UAAU,CACjC,CACI,EACI,KAAK,EAAE,SAAS,EAChB,QAAQ,EACR,SAAS,GAAG,GAAG,EACf,cAAc,GAAG,UAAU,EAC3B,YAAY,EACZ,KAAK,EACL,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,OAAO,EACZ,WAAW,EACX,UAAU,EACV,QAAQ,EACR,MAAM,EACN,OAAO,EACP,IAAI,EACJ,IAAI,EAAE,QAAQ,EACd,IAAI,GAAG,EAAE,EACT,gBAAgB,EAChB,KAAK,EAAE,SAAS,EAChB,MAAM,GAAG,SAAS,EAClB,GAAG,SAAS,EACf,EACD,GAAG,KACH;AACA,IAAA,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,kBAAkB,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC7D,IAAA,MAAM,WAAW,GAAG,QAAQ,KAAK,SAAS;IAE1C,MAAM,WAAW,GAAmB,OAAO,CACvC,MACI,iBAAiB,CAAC;QACd,SAAS;QACT,cAAc,EAAE,WAAW,GAAG,CAAC,GAAG,cAAc;QAChD,GAAG;QACH,GAAG;AACN,KAAA,CAAC,EACN,CAAC,SAAS,EAAE,cAAc,EAAE,GAAG,EAAE,GAAG,EAAE,WAAW,CAAC,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E,WAAW,CAAC,KAAK,CAAC,EACzB,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,eAAe,EAC5B,WAAW,EAAE,eAAe,EAC5B,IAAI,EAAE,IAAI,EAAA,CACZ,CACW,KAEjB,WAAW,CACd,EAEP,CAAA;AAEV,CAAC;;;;"}
@@ -1 +1 @@
1
- export { NumberInput, NumberInputProps } from "./Component";
1
+ export { NumberInput, NumberInputProps } from './Component';
@@ -1 +1,2 @@
1
1
  export { NumberInput } from './Component.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,6 +1,6 @@
1
1
  import { FC } from 'react';
2
- import { InputProps } from "@alfalab/core-components-input";
3
- type SteppersProps = {
2
+ import { InputProps } from '@alfalab/core-components-input';
3
+ export declare type SteppersProps = {
4
4
  value: number;
5
5
  min: number;
6
6
  max: number;
@@ -13,5 +13,4 @@ type SteppersProps = {
13
13
  colors: 'default' | 'inverted';
14
14
  size: InputProps['size'];
15
15
  };
16
- declare const Steppers: FC<SteppersProps>;
17
- export { SteppersProps, Steppers };
16
+ export declare const Steppers: FC<SteppersProps>;
@@ -44,3 +44,4 @@ const Steppers = ({ className, onIncrement, onDecrement, value, min, max, disabl
44
44
  Steppers.displayName = 'Steppers';
45
45
 
46
46
  export { Steppers };
47
+ //# sourceMappingURL=Component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Component.js","sources":["../../../src/components/steppers/Component.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport cn from 'classnames';\n\nimport { IconButton } from '@alfalab/core-components-icon-button';\nimport { InputProps } from '@alfalab/core-components-input';\nimport { getDataTestId } from '@alfalab/core-components-shared';\nimport { MinusMIcon } from '@alfalab/icons-glyph/MinusMIcon';\nimport { MinusSIcon } from '@alfalab/icons-glyph/MinusSIcon';\nimport { PlusMediumMIcon } from '@alfalab/icons-glyph/PlusMediumMIcon';\nimport { PlusSIcon } from '@alfalab/icons-glyph/PlusSIcon';\n\nimport defaultColors from './default.module.css';\nimport styles from './index.module.css';\nimport invertedColors from './inverted.module.css';\n\nexport type SteppersProps = {\n value: number;\n min: number;\n max: number;\n className?: string;\n disabled?: boolean;\n focused?: boolean;\n onIncrement: () => void;\n onDecrement: () => void;\n dataTestId?: string;\n colors: 'default' | 'inverted';\n size: InputProps['size'];\n};\n\nconst colorStyles = {\n default: defaultColors,\n inverted: invertedColors,\n};\n\nfunction preventDefault(e: React.MouseEvent<HTMLElement>) {\n e.preventDefault();\n}\n\nconst SIZE_TO_CLASSNAME_MAP = {\n s: 'size-48',\n m: 'size-56',\n l: 'size-64',\n xl: 'size-72',\n 40: 'size-40',\n 48: 'size-48',\n 56: 'size-56',\n 64: 'size-64',\n 72: 'size-72',\n};\n\nexport const Steppers: FC<SteppersProps> = ({\n className,\n onIncrement,\n onDecrement,\n value,\n min,\n max,\n disabled,\n focused,\n dataTestId,\n colors,\n size = 48,\n}) => {\n const decButtonDisabled = disabled || value <= min;\n const incButtonDisabled = disabled || value >= max;\n\n const MinusIconComponent = size === 40 ? MinusSIcon : MinusMIcon;\n const PlusIconComponent = size === 40 ? PlusSIcon : PlusMediumMIcon;\n\n return (\n <div\n className={cn(\n styles.component,\n colorStyles[colors].steppers,\n styles[SIZE_TO_CLASSNAME_MAP[size]],\n className,\n {\n [colorStyles[colors].steppersFocused]: focused,\n [colorStyles[colors].steppersDisabled]: disabled,\n },\n )}\n >\n <IconButton\n colors={colors}\n disabled={decButtonDisabled}\n className={styles.button}\n icon={<MinusIconComponent />}\n aria-label='уменьшить'\n onMouseDown={preventDefault}\n onClick={onDecrement}\n dataTestId={getDataTestId(dataTestId, 'decrement-button')}\n view='secondary'\n />\n <div className={cn(styles.separator, colorStyles[colors].separator)} />\n <IconButton\n colors={colors}\n disabled={incButtonDisabled}\n className={styles.button}\n icon={<PlusIconComponent />}\n aria-label='увеличить'\n onMouseDown={preventDefault}\n onClick={onIncrement}\n dataTestId={getDataTestId(dataTestId, 'increment-button')}\n view='secondary'\n />\n </div>\n );\n};\n\nSteppers.displayName = 'Steppers';\n"],"names":[],"mappings":";;;;;;;;;;;;AA6BA,MAAM,WAAW,GAAG;AAChB,IAAA,OAAO,EAAE,aAAa;AACtB,IAAA,QAAQ,EAAE,cAAc;CAC3B;AAED,SAAS,cAAc,CAAC,CAAgC,EAAA;IACpD,CAAC,CAAC,cAAc,EAAE;AACtB;AAEA,MAAM,qBAAqB,GAAG;AAC1B,IAAA,CAAC,EAAE,SAAS;AACZ,IAAA,CAAC,EAAE,SAAS;AACZ,IAAA,CAAC,EAAE,SAAS;AACZ,IAAA,EAAE,EAAE,SAAS;AACb,IAAA,EAAE,EAAE,SAAS;AACb,IAAA,EAAE,EAAE,SAAS;AACb,IAAA,EAAE,EAAE,SAAS;AACb,IAAA,EAAE,EAAE,SAAS;AACb,IAAA,EAAE,EAAE,SAAS;CAChB;AAEM,MAAM,QAAQ,GAAsB,CAAC,EACxC,SAAS,EACT,WAAW,EACX,WAAW,EACX,KAAK,EACL,GAAG,EACH,GAAG,EACH,QAAQ,EACR,OAAO,EACP,UAAU,EACV,MAAM,EACN,IAAI,GAAG,EAAE,GACZ,KAAI;AACD,IAAA,MAAM,iBAAiB,GAAG,QAAQ,IAAI,KAAK,IAAI,GAAG;AAClD,IAAA,MAAM,iBAAiB,GAAG,QAAQ,IAAI,KAAK,IAAI,GAAG;AAElD,IAAA,MAAM,kBAAkB,GAAG,IAAI,KAAK,EAAE,GAAG,UAAU,GAAG,UAAU;AAChE,IAAA,MAAM,iBAAiB,GAAG,IAAI,KAAK,EAAE,GAAG,SAAS,GAAG,eAAe;IAEnE,QACI,KACI,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAE,EAAE,CACT,MAAM,CAAC,SAAS,EAChB,WAAW,CAAC,MAAM,CAAC,CAAC,QAAQ,EAC5B,MAAM,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,EACnC,SAAS,EACT;YACI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,eAAe,GAAG,OAAO;YAC9C,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,gBAAgB,GAAG,QAAQ;SACnD,CACJ,EAAA;QAED,KAAC,CAAA,aAAA,CAAA,UAAU,IACP,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,iBAAiB,EAC3B,SAAS,EAAE,MAAM,CAAC,MAAM,EACxB,IAAI,EAAE,KAAA,CAAA,aAAA,CAAC,kBAAkB,EAAG,IAAA,CAAA,EAAA,YAAA,EACjB,wDAAW,EACtB,WAAW,EAAE,cAAc,EAC3B,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,aAAa,CAAC,UAAU,EAAE,kBAAkB,CAAC,EACzD,IAAI,EAAC,WAAW,EAClB,CAAA;AACF,QAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,EAAI,CAAA;QACvE,KAAC,CAAA,aAAA,CAAA,UAAU,IACP,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,iBAAiB,EAC3B,SAAS,EAAE,MAAM,CAAC,MAAM,EACxB,IAAI,EAAE,KAAA,CAAA,aAAA,CAAC,iBAAiB,EAAA,IAAA,CAAG,EAChB,YAAA,EAAA,wDAAW,EACtB,WAAW,EAAE,cAAc,EAC3B,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,aAAa,CAAC,UAAU,EAAE,kBAAkB,CAAC,EACzD,IAAI,EAAC,WAAW,EAAA,CAClB,CACA;AAEd;AAEA,QAAQ,CAAC,WAAW,GAAG,UAAU;;;;"}
@@ -1,5 +1,3 @@
1
- /* */
2
-
3
1
  .separator {
4
2
  background-color: var(--color-light-neutral-translucent-300);
5
3
  }
@@ -1 +1 @@
1
- export * from "./Component";
1
+ export * from './Component';
@@ -1 +1,2 @@
1
1
  export { Steppers } from './Component.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,5 +1,3 @@
1
- /* */
2
-
3
1
  .component {
4
2
  display: flex;
5
3
  flex-flow: row nowrap;
@@ -1,5 +1,3 @@
1
- /* */
2
-
3
1
  .separator {
4
2
  background-color: var(--color-light-neutral-translucent-300-inverted);
5
3
  }
@@ -1,3 +1,2 @@
1
- declare const MAX_SAFE_INTEGER: number;
2
- declare const MIN_SAFE_INTEGER: number;
3
- export { MAX_SAFE_INTEGER, MIN_SAFE_INTEGER };
1
+ export declare const MAX_SAFE_INTEGER: number;
2
+ export declare const MIN_SAFE_INTEGER: number;
@@ -1,4 +1,5 @@
1
1
  const MAX_SAFE_INTEGER = 2 ** 53 - 1;
2
- const MIN_SAFE_INTEGER = -MAX_SAFE_INTEGER;
2
+ const MIN_SAFE_INTEGER = -9007199254740991;
3
3
 
4
4
  export { MAX_SAFE_INTEGER, MIN_SAFE_INTEGER };
5
+ //# sourceMappingURL=min-max-safe-integer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"min-max-safe-integer.js","sources":["../../src/constants/min-max-safe-integer.ts"],"sourcesContent":["export const MAX_SAFE_INTEGER = 2 ** 53 - 1;\nexport const MIN_SAFE_INTEGER = -MAX_SAFE_INTEGER;\n"],"names":[],"mappings":"MAAa,gBAAgB,GAAG,CAAC,IAAI,EAAE,GAAG;AAC7B,MAAA,gBAAgB,GAAG;;;;"}
@@ -1,6 +1,4 @@
1
- /// <reference types="react" />
2
1
  import React from 'react';
3
- import { NumberInputProps } from "../components/number-input/index";
4
- type NumberInputDesktopProps = Omit<NumberInputProps, 'Input' | 'breakpoint' | 'view'>;
5
- declare const NumberInputDesktop: React.ForwardRefExoticComponent<NumberInputDesktopProps & React.RefAttributes<HTMLInputElement>>;
6
- export { NumberInputDesktopProps, NumberInputDesktop };
2
+ import { NumberInputProps } from '../components/number-input';
3
+ export declare type NumberInputDesktopProps = Omit<NumberInputProps, 'Input' | 'breakpoint' | 'view'>;
4
+ export declare const NumberInputDesktop: React.ForwardRefExoticComponent<NumberInputDesktopProps & React.RefAttributes<HTMLInputElement>>;
@@ -5,3 +5,4 @@ import { NumberInput } from '../components/number-input/Component.js';
5
5
  const NumberInputDesktop = forwardRef((props, ref) => React.createElement(NumberInput, { ...props, Input: InputDesktop, ref: ref, view: 'desktop' }));
6
6
 
7
7
  export { NumberInputDesktop };
8
+ //# sourceMappingURL=Component.desktop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Component.desktop.js","sources":["../../src/desktop/Component.desktop.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { InputDesktop } from '@alfalab/core-components-input/desktop';\n\nimport { NumberInput, NumberInputProps } from '../components/number-input';\n\nexport type NumberInputDesktopProps = Omit<NumberInputProps, 'Input' | 'breakpoint' | 'view'>;\n\nexport const NumberInputDesktop = forwardRef<HTMLInputElement, NumberInputDesktopProps>(\n (props, ref) => <NumberInput {...props} Input={InputDesktop} ref={ref} view='desktop' />,\n);\n"],"names":[],"mappings":";;;;AAQO,MAAM,kBAAkB,GAAG,UAAU,CACxC,CAAC,KAAK,EAAE,GAAG,KAAK,KAAC,CAAA,aAAA,CAAA,WAAW,EAAK,EAAA,GAAA,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAC,SAAS,EAAA,CAAG;;;;"}
@@ -1,2 +1 @@
1
- export { NumberInputDesktop, NumberInputDesktopProps } from "./Component.desktop";
2
- export {};
1
+ export { NumberInputDesktop, NumberInputDesktopProps } from './Component.desktop';
@@ -1 +1,2 @@
1
1
  export { NumberInputDesktop } from './Component.desktop.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1 @@
1
- export { NumberInputResponsive as NumberInput, NumberInputResponsiveProps as NumberInputProps } from "./Component.responsive";
2
- export {};
1
+ export { NumberInputResponsive as NumberInput, NumberInputResponsiveProps as NumberInputProps, } from './Component.responsive';
@@ -1 +1,2 @@
1
1
  export { NumberInputResponsive as NumberInput } from './Component.responsive.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,6 +1,4 @@
1
- /// <reference types="react" />
2
1
  import React from 'react';
3
- import { NumberInputProps } from "../components/number-input/index";
4
- type NumberInputMobileProps = Omit<NumberInputProps, 'Input' | 'breakpoint' | 'view'>;
5
- declare const NumberInputMobile: React.ForwardRefExoticComponent<NumberInputMobileProps & React.RefAttributes<HTMLInputElement>>;
6
- export { NumberInputMobileProps, NumberInputMobile };
2
+ import { NumberInputProps } from '../components/number-input';
3
+ export declare type NumberInputMobileProps = Omit<NumberInputProps, 'Input' | 'breakpoint' | 'view'>;
4
+ export declare const NumberInputMobile: React.ForwardRefExoticComponent<NumberInputMobileProps & React.RefAttributes<HTMLInputElement>>;
@@ -5,3 +5,4 @@ import { NumberInput } from '../components/number-input/Component.js';
5
5
  const NumberInputMobile = forwardRef((props, ref) => React.createElement(NumberInput, { ...props, Input: InputMobile, ref: ref, view: 'mobile' }));
6
6
 
7
7
  export { NumberInputMobile };
8
+ //# sourceMappingURL=Component.mobile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Component.mobile.js","sources":["../../src/mobile/Component.mobile.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { InputMobile } from '@alfalab/core-components-input/mobile';\n\nimport { NumberInput, NumberInputProps } from '../components/number-input';\n\nexport type NumberInputMobileProps = Omit<NumberInputProps, 'Input' | 'breakpoint' | 'view'>;\n\nexport const NumberInputMobile = forwardRef<HTMLInputElement, NumberInputMobileProps>(\n (props, ref) => <NumberInput {...props} Input={InputMobile} ref={ref} view='mobile' />,\n);\n"],"names":[],"mappings":";;;;AAQO,MAAM,iBAAiB,GAAG,UAAU,CACvC,CAAC,KAAK,EAAE,GAAG,KAAK,KAAC,CAAA,aAAA,CAAA,WAAW,EAAK,EAAA,GAAA,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAC,QAAQ,EAAA,CAAG;;;;"}
@@ -1,2 +1 @@
1
- export { NumberInputMobile, NumberInputMobileProps } from "./Component.mobile";
2
- export {};
1
+ export { NumberInputMobile, NumberInputMobileProps } from './Component.mobile';
@@ -1 +1,2 @@
1
1
  export { NumberInputMobile } from './Component.mobile.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,3 +1,3 @@
1
- export { getNumberInputTestIds } from "../utils";
2
- export { Steppers } from "../components/steppers/index";
3
- export type { SteppersProps } from "../components/steppers/index";
1
+ export { getNumberInputTestIds } from '../utils';
2
+ export { Steppers } from '../components/steppers';
3
+ export type { SteppersProps } from '../components/steppers';
@@ -1,2 +1,3 @@
1
1
  export { getNumberInputTestIds } from '../utils.js';
2
2
  export { Steppers } from '../components/steppers/Component.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,24 +1,24 @@
1
1
  import { MaskitoOptions, MaskitoPlugin } from '@maskito/core';
2
- declare const MINUS_SIGN = "-";
3
- declare const SEPARATORS: string[];
4
- declare const MAX_DIGITS = 15;
5
- declare function parseNumber(value?: string | number | null): number;
2
+ export declare const MINUS_SIGN = "-";
3
+ export declare const SEPARATORS: string[];
4
+ export declare const MAX_DIGITS = 15;
5
+ export declare function parseNumber(value?: string | number | null): number;
6
6
  /**
7
7
  * Преобразовать число в строку с заменой экспоненты на десятичную дробь
8
8
  */
9
- declare function stringifyNumberWithoutExp(value: number): string;
10
- declare function createMaskOptions({ separator, fractionLength, min, max, }: {
9
+ export declare function stringifyNumberWithoutExp(value: number): string;
10
+ export declare function createMaskOptions({ separator, fractionLength, min, max, }: {
11
11
  separator: string;
12
12
  fractionLength: number;
13
13
  min: number;
14
14
  max: number;
15
15
  }): MaskitoOptions;
16
- declare function createMinMaxPlugin({ min, max }: {
16
+ export declare function createMinMaxPlugin({ min, max }: {
17
17
  min: number;
18
18
  max: number;
19
19
  }): MaskitoPlugin;
20
- declare function createNotEmptyPartsPlugin(separator: string): MaskitoPlugin;
21
- declare function getNumberInputTestIds(dataTestId: string): {
20
+ export declare function createNotEmptyPartsPlugin(separator: string): MaskitoPlugin;
21
+ export declare function getNumberInputTestIds(dataTestId: string): {
22
22
  input: string;
23
23
  inputWrapper: string;
24
24
  inputWrapperInner: string;
@@ -33,11 +33,10 @@ declare function getNumberInputTestIds(dataTestId: string): {
33
33
  * Определение минимального / максимального значения
34
34
  * @description Если значение не передано, вернется { Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER }
35
35
  */
36
- declare const getMinMaxOrDefault: ({ minProp, maxProp, }: {
36
+ export declare const getMinMaxOrDefault: ({ minProp, maxProp, }: {
37
37
  minProp?: number | undefined;
38
38
  maxProp?: number | undefined;
39
39
  }) => {
40
40
  min: number;
41
41
  max: number;
42
42
  };
43
- export { MINUS_SIGN, SEPARATORS, MAX_DIGITS, parseNumber, stringifyNumberWithoutExp, createMaskOptions, createMinMaxPlugin, createNotEmptyPartsPlugin, getNumberInputTestIds, getMinMaxOrDefault };
@@ -1,6 +1,6 @@
1
1
  import { maskitoTransform } from '@maskito/core';
2
- import { getDataTestId, fnUtils } from '@alfalab/core-components-shared/moderncssm';
3
- import { MIN_SAFE_INTEGER, MAX_SAFE_INTEGER } from './constants/min-max-safe-integer.js';
2
+ import { fnUtils, getDataTestId } from '@alfalab/core-components-shared/moderncssm';
3
+ import { MAX_SAFE_INTEGER, MIN_SAFE_INTEGER } from './constants/min-max-safe-integer.js';
4
4
 
5
5
  /* eslint-disable no-param-reassign */
6
6
  const MINUS_SIGN = '-';
@@ -252,3 +252,4 @@ const getMinMaxOrDefault = ({ minProp, maxProp, }) => {
252
252
  };
253
253
 
254
254
  export { MAX_DIGITS, MINUS_SIGN, SEPARATORS, createMaskOptions, createMinMaxPlugin, createNotEmptyPartsPlugin, getMinMaxOrDefault, getNumberInputTestIds, parseNumber, stringifyNumberWithoutExp };
255
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport {\n MaskitoOptions,\n MaskitoPlugin,\n MaskitoPostprocessor,\n MaskitoPreprocessor,\n maskitoTransform,\n} from '@maskito/core';\n\nimport { fnUtils, getDataTestId } from '@alfalab/core-components-shared';\n\nimport { MAX_SAFE_INTEGER, MIN_SAFE_INTEGER } from './constants/min-max-safe-integer';\n\nexport const MINUS_SIGN = '-';\nexport const SEPARATORS = [',', '.'];\nexport const MAX_DIGITS = 15; // с 16 уже упираемся в MAX_SAFE_INTEGER\n\nexport function parseNumber(value: string | number | null = '') {\n if (typeof value === 'number') return value;\n\n const pseudoSeparatorsRegExp = new RegExp(`[${SEPARATORS.join('')}]`, 'gi');\n\n return value\n ? parseFloat(\n value\n .replace(new RegExp(`[^${MINUS_SIGN}${SEPARATORS.join('')}0-9]`, 'gi'), '')\n .replace(pseudoSeparatorsRegExp, '.'),\n )\n : NaN;\n}\n\n/**\n * Преобразовать число в строку с заменой экспоненты на десятичную дробь\n */\nexport function stringifyNumberWithoutExp(value: number): string {\n const valueString = String(value);\n const [numberPart, expPart] = valueString.split('e-');\n\n let valueWithoutExp = valueString;\n\n if (expPart) {\n const [, fractionalPart] = numberPart.split('.');\n const decimalDigits = Number(expPart) + (fractionalPart?.length || 0);\n\n valueWithoutExp = value.toFixed(decimalDigits);\n }\n\n return valueWithoutExp;\n}\n\nconst getNumberRegExp = (min: number, fractionLength: number): RegExp => {\n let reStr = '[0-9]*';\n\n if (min < 0) {\n reStr = `(\\\\${MINUS_SIGN})?${reStr}`;\n }\n\n if (fractionLength !== 0) {\n reStr = `${reStr}[${SEPARATORS.map((s) => `\\\\${s}`).join('')}]?[0-9]{0,${\n fractionLength || MAX_DIGITS\n }}`;\n }\n\n return new RegExp(`^${reStr}$`);\n};\n\nexport function createMaskOptions({\n separator,\n fractionLength,\n min,\n max,\n}: {\n separator: string;\n fractionLength: number;\n min: number;\n max: number;\n}): MaskitoOptions {\n return {\n mask: getNumberRegExp(min, fractionLength),\n preprocessors: [\n createPseudoSeparatorPreprocessor(separator),\n createNotEmptyIntegerPartPreprocessor({ separator, fractionLength }),\n createZeroFractionLengthPreprocessor(fractionLength, separator),\n createRepeatedSeparatorPreprocessor(separator),\n ],\n postprocessors: [\n createLeadingZeroesValidationPostprocessor(separator),\n createMinMaxPostprocessor({ min, max, separator }),\n ],\n plugins: [createNotEmptyPartsPlugin(separator), createMinMaxPlugin({ min, max })],\n };\n}\n\n/**\n * Заполняет целочисленную часть при вводе separator.\n * @example Type , => 0,\n */\nfunction createNotEmptyIntegerPartPreprocessor({\n separator,\n fractionLength,\n}: {\n separator: string;\n fractionLength: number;\n}): MaskitoPreprocessor {\n const startWithDecimalSepRegExp = new RegExp(`^\\\\D*\\\\${separator}`);\n\n return ({ elementState, data }) => {\n const { value, selection } = elementState;\n const [from] = selection;\n\n if (\n fractionLength <= 0 ||\n value.includes(separator) ||\n !data.match(startWithDecimalSepRegExp)\n ) {\n return { elementState, data };\n }\n\n const digitsBeforeCursor = value.slice(0, from).match(/\\d+/);\n\n return {\n elementState,\n data: digitsBeforeCursor ? data : `0${data}`,\n };\n };\n}\n\n/**\n * Не позволяет вводить невалидный разделитель.\n */\nfunction createPseudoSeparatorPreprocessor(separator: string): MaskitoPreprocessor {\n const pseudoSeparatorsRegExp = new RegExp(`[${SEPARATORS.join('')}]`, 'gi');\n\n return ({ elementState, data }) => {\n const { value, selection } = elementState;\n\n return {\n elementState: {\n selection,\n value: value.replace(pseudoSeparatorsRegExp, separator),\n },\n data: data.replace(pseudoSeparatorsRegExp, separator),\n };\n };\n}\n\n/**\n * Помогает верно обрезать значения при вставке, если fractionLength===0\n * @example paste 123,123 -> 123\n */\nfunction createZeroFractionLengthPreprocessor(\n fractionLength: number,\n separator: string,\n): MaskitoPreprocessor {\n if (fractionLength > 0) {\n return (state) => state;\n }\n\n const decimalPartRegExp = new RegExp(`\\\\${separator}.*$`, 'g');\n\n return ({ elementState, data }) => {\n const { value, selection } = elementState;\n const [from, to] = selection;\n const newValue = value.replace(decimalPartRegExp, '');\n\n return {\n elementState: {\n selection: [Math.min(from, newValue.length), Math.min(to, newValue.length)],\n value: newValue,\n },\n data: data.replace(decimalPartRegExp, ''),\n };\n };\n}\n\n/**\n * Запрещает вводить второй сепаратор\n */\nfunction createRepeatedSeparatorPreprocessor(separator: string): MaskitoPreprocessor {\n return ({ elementState, data }) => {\n const { value, selection } = elementState;\n const [from, to] = selection;\n\n return {\n elementState,\n data:\n !value.includes(separator) || value.slice(from, to + 1).includes(separator)\n ? data\n : data.replace(new RegExp(`\\\\${separator}`), ''),\n };\n };\n}\n\n/**\n * Удаляет лишние нули в начале целой части.\n * @example 0,|00005 => Backspace => |5\n * @example -0,|00005 => Backspace => -|5\n * @example \"000000\" => 0|\n * @example 0| => Type \"5\" => 5|\n */\nfunction createLeadingZeroesValidationPostprocessor(separator: string): MaskitoPostprocessor {\n const trimLeadingZeroes = (value: string): string =>\n value\n .replace(new RegExp('^(\\\\D+)?0+(?=0)'), '$1')\n .replace(new RegExp('^(\\\\D+)?0+(?=[1-9])'), '$1');\n\n const countTrimmedZeroesBefore = (value: string, index: number): number => {\n const valueBefore = value.slice(0, index);\n const followedByZero = value.slice(index).startsWith('0');\n\n return (\n valueBefore.length - trimLeadingZeroes(valueBefore).length + (followedByZero ? 1 : 0)\n );\n };\n\n return ({ value, selection }) => {\n const [from, to] = selection;\n const hasSeparator = value.includes(separator);\n const [integerPart, decimalPart = ''] = value.split(separator);\n const zeroTrimmedIntegerPart = trimLeadingZeroes(integerPart);\n\n if (integerPart === zeroTrimmedIntegerPart) {\n return { value, selection };\n }\n\n const newFrom = from - countTrimmedZeroesBefore(value, from);\n const newTo = to - countTrimmedZeroesBefore(value, to);\n\n return {\n value: zeroTrimmedIntegerPart + (hasSeparator ? separator : '') + decimalPart,\n selection: [Math.max(newFrom, 0), Math.max(newTo, 0)],\n };\n };\n}\n\n/**\n * Валидирует значение с учетом min max значений.\n * Работает совместно с createMinMaxPlugin\n */\nfunction createMinMaxPostprocessor({\n min,\n max,\n separator,\n}: {\n min: number;\n max: number;\n separator: string;\n}): MaskitoPostprocessor {\n return ({ value, selection }) => {\n const parsedNumber = parseNumber(value);\n\n const limitedValue =\n /**\n * Здесь невозможно ограничить нижнюю границу, если пользователь вводит положительное число.\n * То же самое для верхней границы и отрицательного числа.\n * Если min=5, то без этого условия не получится ввести 40, похожая ситуация и с отрицательным max\n */\n parsedNumber > 0 ? Math.min(parsedNumber, max) : Math.max(parsedNumber, min);\n\n if (!Number.isNaN(parsedNumber) && limitedValue !== parsedNumber) {\n const newValue = `${limitedValue}`.replace('.', separator);\n\n return {\n value: newValue,\n selection: [newValue.length, newValue.length],\n };\n }\n\n return {\n value,\n selection,\n };\n };\n}\n\nexport function createMinMaxPlugin({ min, max }: { min: number; max: number }): MaskitoPlugin {\n return (element, options) => {\n const listener = () => {\n const parsedNumber = parseNumber(element.value);\n\n const clampedNumber = fnUtils.clamp(parsedNumber, min, max);\n\n if (!Number.isNaN(parsedNumber) && parsedNumber !== clampedNumber) {\n element.value = maskitoTransform(stringifyNumberWithoutExp(clampedNumber), options);\n element.dispatchEvent(new Event('input', { bubbles: true }));\n }\n };\n\n const evListenerOptions = { capture: true };\n\n element.addEventListener('blur', listener, evListenerOptions);\n\n return () => element.removeEventListener('blur', listener, evListenerOptions);\n };\n}\n\nexport function createNotEmptyPartsPlugin(separator: string): MaskitoPlugin {\n return (element) => {\n const listener = () => {\n const newValue = element.value\n // 0,9000000 -> 0,9\n .replace(new RegExp(`(\\\\${separator}\\\\d*?)(0+$)`), '$1')\n // ,2 => 0,2\n .replace(new RegExp(`^(\\\\D+)?\\\\${separator}`), `$10${separator}`)\n // 0, -> 0\n .replace(new RegExp(`\\\\${separator}$`), '')\n // -0 -> 0\n .replace(new RegExp(`^${MINUS_SIGN}0$`), '0')\n // - -> ''\n .replace(new RegExp(`^${MINUS_SIGN}$`), '');\n\n if (newValue !== element.value) {\n element.value = newValue;\n element.dispatchEvent(new Event('input', { bubbles: true }));\n }\n };\n\n const evListenerOptions = { capture: true };\n\n element.addEventListener('blur', listener, evListenerOptions);\n\n return () => element.removeEventListener('blur', listener, evListenerOptions);\n };\n}\n\nexport function getNumberInputTestIds(dataTestId: string) {\n return {\n input: dataTestId,\n inputWrapper: getDataTestId(dataTestId, 'form-control'),\n inputWrapperInner: getDataTestId(dataTestId, 'form-control-inner'),\n leftAddons: getDataTestId(dataTestId, 'form-control-left-addons'),\n rightAddons: getDataTestId(dataTestId, 'form-control-right-addons'),\n error: getDataTestId(dataTestId, 'form-control-error-message'),\n hint: getDataTestId(dataTestId, 'form-control-hint'),\n decrementButton: getDataTestId(dataTestId, 'decrement-button'),\n incrementButton: getDataTestId(dataTestId, 'increment-button'),\n };\n}\n\n/**\n * Определение минимального / максимального значения\n * @description Если значение не передано, вернется { Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER }\n */\nexport const getMinMaxOrDefault = ({\n minProp,\n maxProp,\n}: {\n minProp?: number;\n maxProp?: number;\n}) => {\n const min = Math.max(MIN_SAFE_INTEGER, minProp ?? MIN_SAFE_INTEGER);\n const max = Math.min(MAX_SAFE_INTEGER, maxProp ?? MAX_SAFE_INTEGER);\n\n return { min, max };\n};\n"],"names":[],"mappings":";;;;AAAA;AAaO,MAAM,UAAU,GAAG;MACb,UAAU,GAAG,CAAC,GAAG,EAAE,GAAG;AACtB,MAAA,UAAU,GAAG,GAAG;AAEb,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C;AACnE,IAAA,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,OAAO,IAAI,gBAAgB,CAAC;AAEnE,IAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE;AACvB;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-number-input",
3
- "version": "2.7.2",
3
+ "version": "3.0.0-snapshot-6a9d3fc",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -12,13 +12,14 @@
12
12
  },
13
13
  "sideEffects": false,
14
14
  "peerDependencies": {
15
- "react": "^16.9.0 || ^17.0.1 || ^18.0.0"
15
+ "react": "^16.9.0 || ^17.0.1 || ^18.0.0",
16
+ "react-dom": "^16.9.0 || ^17.0.1 || ^18.0.0"
16
17
  },
17
18
  "dependencies": {
18
- "@alfalab/core-components-input": "^15.6.2",
19
- "@alfalab/core-components-mq": "^4.4.1",
20
- "@alfalab/core-components-icon-button": "^6.11.13",
21
- "@alfalab/core-components-shared": "^0.18.0",
19
+ "@alfalab/core-components-input": "16.0.0-snapshot-6a9d3fc",
20
+ "@alfalab/core-components-mq": "5.0.0-snapshot-6a9d3fc",
21
+ "@alfalab/core-components-icon-button": "7.0.0-snapshot-6a9d3fc",
22
+ "@alfalab/core-components-shared": "1.0.0-snapshot-6a9d3fc",
22
23
  "@alfalab/icons-glyph": "^2.210.0",
23
24
  "@maskito/core": "^1.7.0",
24
25
  "@maskito/react": "^1.7.0",
@@ -26,6 +27,6 @@
26
27
  "react-merge-refs": "^1.1.0",
27
28
  "tslib": "^2.4.0"
28
29
  },
29
- "themesVersion": "13.7.4",
30
- "varsVersion": "9.20.1"
30
+ "themesVersion": "14.0.0-snapshot-6a9d3fc",
31
+ "varsVersion": "10.0.0-snapshot-6a9d3fc"
31
32
  }
package/shared/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { getNumberInputTestIds } from "../utils";
2
- export { Steppers } from "../components/steppers/index";
3
- export type { SteppersProps } from "../components/steppers/index";
1
+ export { getNumberInputTestIds } from '../utils';
2
+ export { Steppers } from '../components/steppers';
3
+ export type { SteppersProps } from '../components/steppers';
package/shared/index.js CHANGED
@@ -3,9 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var utils = require('../utils.js');
6
- var components_steppers_Component = require('../components/steppers/Component.js');
6
+ var Component = require('../components/steppers/Component.js');
7
7
 
8
8
 
9
9
 
10
10
  exports.getNumberInputTestIds = utils.getNumberInputTestIds;
11
- exports.Steppers = components_steppers_Component.Steppers;
11
+ exports.Steppers = Component.Steppers;
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
package/utils.d.ts CHANGED
@@ -1,24 +1,24 @@
1
1
  import { MaskitoOptions, MaskitoPlugin } from '@maskito/core';
2
- declare const MINUS_SIGN = "-";
3
- declare const SEPARATORS: string[];
4
- declare const MAX_DIGITS = 15;
5
- declare function parseNumber(value?: string | number | null): number;
2
+ export declare const MINUS_SIGN = "-";
3
+ export declare const SEPARATORS: string[];
4
+ export declare const MAX_DIGITS = 15;
5
+ export declare function parseNumber(value?: string | number | null): number;
6
6
  /**
7
7
  * Преобразовать число в строку с заменой экспоненты на десятичную дробь
8
8
  */
9
- declare function stringifyNumberWithoutExp(value: number): string;
10
- declare function createMaskOptions({ separator, fractionLength, min, max, }: {
9
+ export declare function stringifyNumberWithoutExp(value: number): string;
10
+ export declare function createMaskOptions({ separator, fractionLength, min, max, }: {
11
11
  separator: string;
12
12
  fractionLength: number;
13
13
  min: number;
14
14
  max: number;
15
15
  }): MaskitoOptions;
16
- declare function createMinMaxPlugin({ min, max }: {
16
+ export declare function createMinMaxPlugin({ min, max }: {
17
17
  min: number;
18
18
  max: number;
19
19
  }): MaskitoPlugin;
20
- declare function createNotEmptyPartsPlugin(separator: string): MaskitoPlugin;
21
- declare function getNumberInputTestIds(dataTestId: string): {
20
+ export declare function createNotEmptyPartsPlugin(separator: string): MaskitoPlugin;
21
+ export declare function getNumberInputTestIds(dataTestId: string): {
22
22
  input: string;
23
23
  inputWrapper: string;
24
24
  inputWrapperInner: string;
@@ -33,11 +33,10 @@ declare function getNumberInputTestIds(dataTestId: string): {
33
33
  * Определение минимального / максимального значения
34
34
  * @description Если значение не передано, вернется { Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER }
35
35
  */
36
- declare const getMinMaxOrDefault: ({ minProp, maxProp, }: {
36
+ export declare const getMinMaxOrDefault: ({ minProp, maxProp, }: {
37
37
  minProp?: number | undefined;
38
38
  maxProp?: number | undefined;
39
39
  }) => {
40
40
  min: number;
41
41
  max: number;
42
42
  };
43
- export { MINUS_SIGN, SEPARATORS, MAX_DIGITS, parseNumber, stringifyNumberWithoutExp, createMaskOptions, createMinMaxPlugin, createNotEmptyPartsPlugin, getNumberInputTestIds, getMinMaxOrDefault };