@redneckz/wildless-cms-uni-blocks 0.14.617 → 0.14.618

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 (157) hide show
  1. package/bundle/bundle.umd.js +15 -22
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/dist/ui-kit/FormField/Fields/DependentsField.js +2 -2
  4. package/dist/ui-kit/FormField/Fields/DependentsField.js.map +1 -1
  5. package/dist/ui-kit/FormField/Fields/DulNumberField.js +2 -2
  6. package/dist/ui-kit/FormField/Fields/DulNumberField.js.map +1 -1
  7. package/dist/ui-kit/FormField/Fields/DulSerieField.js +2 -2
  8. package/dist/ui-kit/FormField/Fields/DulSerieField.js.map +1 -1
  9. package/dist/ui-kit/FormField/Fields/DulSubdivisionCodeField.js +2 -2
  10. package/dist/ui-kit/FormField/Fields/DulSubdivisionCodeField.js.map +1 -1
  11. package/dist/ui-kit/FormField/Fields/Experience5YearsField.js +2 -2
  12. package/dist/ui-kit/FormField/Fields/Experience5YearsField.js.map +1 -1
  13. package/dist/ui-kit/FormField/Fields/FamilyMembersField.js +2 -2
  14. package/dist/ui-kit/FormField/Fields/FamilyMembersField.js.map +1 -1
  15. package/dist/ui-kit/FormField/Fields/GeneralSeniorityField.js +2 -2
  16. package/dist/ui-kit/FormField/Fields/GeneralSeniorityField.js.map +1 -1
  17. package/dist/ui-kit/FormField/Fields/InnField.js +2 -2
  18. package/dist/ui-kit/FormField/Fields/InnField.js.map +1 -1
  19. package/dist/ui-kit/FormField/Fields/JobsNumberField.js +2 -2
  20. package/dist/ui-kit/FormField/Fields/JobsNumberField.js.map +1 -1
  21. package/dist/ui-kit/FormField/Fields/LastJobExperienceField.js +2 -2
  22. package/dist/ui-kit/FormField/Fields/LastJobExperienceField.js.map +1 -1
  23. package/dist/ui-kit/FormField/Fields/PartInBusinessField.js +2 -2
  24. package/dist/ui-kit/FormField/Fields/PartInBusinessField.js.map +1 -1
  25. package/dist/ui-kit/Input/InputControl.js +4 -2
  26. package/dist/ui-kit/Input/InputControl.js.map +1 -1
  27. package/lib/ui-kit/FormField/Fields/DependentsField.js +2 -2
  28. package/lib/ui-kit/FormField/Fields/DependentsField.js.map +1 -1
  29. package/lib/ui-kit/FormField/Fields/DulNumberField.js +2 -2
  30. package/lib/ui-kit/FormField/Fields/DulNumberField.js.map +1 -1
  31. package/lib/ui-kit/FormField/Fields/DulSerieField.js +2 -2
  32. package/lib/ui-kit/FormField/Fields/DulSerieField.js.map +1 -1
  33. package/lib/ui-kit/FormField/Fields/DulSubdivisionCodeField.js +2 -2
  34. package/lib/ui-kit/FormField/Fields/DulSubdivisionCodeField.js.map +1 -1
  35. package/lib/ui-kit/FormField/Fields/Experience5YearsField.js +2 -2
  36. package/lib/ui-kit/FormField/Fields/Experience5YearsField.js.map +1 -1
  37. package/lib/ui-kit/FormField/Fields/FamilyMembersField.js +2 -2
  38. package/lib/ui-kit/FormField/Fields/FamilyMembersField.js.map +1 -1
  39. package/lib/ui-kit/FormField/Fields/GeneralSeniorityField.js +2 -2
  40. package/lib/ui-kit/FormField/Fields/GeneralSeniorityField.js.map +1 -1
  41. package/lib/ui-kit/FormField/Fields/InnField.js +2 -2
  42. package/lib/ui-kit/FormField/Fields/InnField.js.map +1 -1
  43. package/lib/ui-kit/FormField/Fields/JobsNumberField.js +2 -2
  44. package/lib/ui-kit/FormField/Fields/JobsNumberField.js.map +1 -1
  45. package/lib/ui-kit/FormField/Fields/LastJobExperienceField.js +2 -2
  46. package/lib/ui-kit/FormField/Fields/LastJobExperienceField.js.map +1 -1
  47. package/lib/ui-kit/FormField/Fields/PartInBusinessField.js +2 -2
  48. package/lib/ui-kit/FormField/Fields/PartInBusinessField.js.map +1 -1
  49. package/lib/ui-kit/Input/InputControl.js +4 -2
  50. package/lib/ui-kit/Input/InputControl.js.map +1 -1
  51. package/mobile/bundle/bundle.umd.js +15 -22
  52. package/mobile/bundle/bundle.umd.min.js +1 -1
  53. package/mobile/dist/ui-kit/FormField/Fields/DependentsField.js +2 -2
  54. package/mobile/dist/ui-kit/FormField/Fields/DependentsField.js.map +1 -1
  55. package/mobile/dist/ui-kit/FormField/Fields/DulNumberField.js +2 -2
  56. package/mobile/dist/ui-kit/FormField/Fields/DulNumberField.js.map +1 -1
  57. package/mobile/dist/ui-kit/FormField/Fields/DulSerieField.js +2 -2
  58. package/mobile/dist/ui-kit/FormField/Fields/DulSerieField.js.map +1 -1
  59. package/mobile/dist/ui-kit/FormField/Fields/DulSubdivisionCodeField.js +2 -2
  60. package/mobile/dist/ui-kit/FormField/Fields/DulSubdivisionCodeField.js.map +1 -1
  61. package/mobile/dist/ui-kit/FormField/Fields/Experience5YearsField.js +2 -2
  62. package/mobile/dist/ui-kit/FormField/Fields/Experience5YearsField.js.map +1 -1
  63. package/mobile/dist/ui-kit/FormField/Fields/FamilyMembersField.js +2 -2
  64. package/mobile/dist/ui-kit/FormField/Fields/FamilyMembersField.js.map +1 -1
  65. package/mobile/dist/ui-kit/FormField/Fields/GeneralSeniorityField.js +2 -2
  66. package/mobile/dist/ui-kit/FormField/Fields/GeneralSeniorityField.js.map +1 -1
  67. package/mobile/dist/ui-kit/FormField/Fields/InnField.js +2 -2
  68. package/mobile/dist/ui-kit/FormField/Fields/InnField.js.map +1 -1
  69. package/mobile/dist/ui-kit/FormField/Fields/JobsNumberField.js +2 -2
  70. package/mobile/dist/ui-kit/FormField/Fields/JobsNumberField.js.map +1 -1
  71. package/mobile/dist/ui-kit/FormField/Fields/LastJobExperienceField.js +2 -2
  72. package/mobile/dist/ui-kit/FormField/Fields/LastJobExperienceField.js.map +1 -1
  73. package/mobile/dist/ui-kit/FormField/Fields/PartInBusinessField.js +2 -2
  74. package/mobile/dist/ui-kit/FormField/Fields/PartInBusinessField.js.map +1 -1
  75. package/mobile/dist/ui-kit/Input/InputControl.js +4 -2
  76. package/mobile/dist/ui-kit/Input/InputControl.js.map +1 -1
  77. package/mobile/lib/ui-kit/FormField/Fields/DependentsField.js +2 -2
  78. package/mobile/lib/ui-kit/FormField/Fields/DependentsField.js.map +1 -1
  79. package/mobile/lib/ui-kit/FormField/Fields/DulNumberField.js +2 -2
  80. package/mobile/lib/ui-kit/FormField/Fields/DulNumberField.js.map +1 -1
  81. package/mobile/lib/ui-kit/FormField/Fields/DulSerieField.js +2 -2
  82. package/mobile/lib/ui-kit/FormField/Fields/DulSerieField.js.map +1 -1
  83. package/mobile/lib/ui-kit/FormField/Fields/DulSubdivisionCodeField.js +2 -2
  84. package/mobile/lib/ui-kit/FormField/Fields/DulSubdivisionCodeField.js.map +1 -1
  85. package/mobile/lib/ui-kit/FormField/Fields/Experience5YearsField.js +2 -2
  86. package/mobile/lib/ui-kit/FormField/Fields/Experience5YearsField.js.map +1 -1
  87. package/mobile/lib/ui-kit/FormField/Fields/FamilyMembersField.js +2 -2
  88. package/mobile/lib/ui-kit/FormField/Fields/FamilyMembersField.js.map +1 -1
  89. package/mobile/lib/ui-kit/FormField/Fields/GeneralSeniorityField.js +2 -2
  90. package/mobile/lib/ui-kit/FormField/Fields/GeneralSeniorityField.js.map +1 -1
  91. package/mobile/lib/ui-kit/FormField/Fields/InnField.js +2 -2
  92. package/mobile/lib/ui-kit/FormField/Fields/InnField.js.map +1 -1
  93. package/mobile/lib/ui-kit/FormField/Fields/JobsNumberField.js +2 -2
  94. package/mobile/lib/ui-kit/FormField/Fields/JobsNumberField.js.map +1 -1
  95. package/mobile/lib/ui-kit/FormField/Fields/LastJobExperienceField.js +2 -2
  96. package/mobile/lib/ui-kit/FormField/Fields/LastJobExperienceField.js.map +1 -1
  97. package/mobile/lib/ui-kit/FormField/Fields/PartInBusinessField.js +2 -2
  98. package/mobile/lib/ui-kit/FormField/Fields/PartInBusinessField.js.map +1 -1
  99. package/mobile/lib/ui-kit/Input/InputControl.js +4 -2
  100. package/mobile/lib/ui-kit/Input/InputControl.js.map +1 -1
  101. package/mobile/src/ui-kit/FormField/Fields/DependentsField.tsx +2 -2
  102. package/mobile/src/ui-kit/FormField/Fields/DulNumberField.tsx +2 -2
  103. package/mobile/src/ui-kit/FormField/Fields/DulSerieField.tsx +2 -2
  104. package/mobile/src/ui-kit/FormField/Fields/DulSubdivisionCodeField.tsx +2 -2
  105. package/mobile/src/ui-kit/FormField/Fields/Experience5YearsField.tsx +2 -2
  106. package/mobile/src/ui-kit/FormField/Fields/FamilyMembersField.tsx +2 -2
  107. package/mobile/src/ui-kit/FormField/Fields/GeneralSeniorityField.tsx +2 -2
  108. package/mobile/src/ui-kit/FormField/Fields/InnField.tsx +3 -2
  109. package/mobile/src/ui-kit/FormField/Fields/JobsNumberField.tsx +2 -2
  110. package/mobile/src/ui-kit/FormField/Fields/LastJobExperienceField.tsx +2 -2
  111. package/mobile/src/ui-kit/FormField/Fields/PartInBusinessField.tsx +2 -2
  112. package/mobile/src/ui-kit/Input/InputControl.tsx +8 -1
  113. package/package.json +1 -1
  114. package/src/ui-kit/FormField/Fields/DependentsField.tsx +2 -2
  115. package/src/ui-kit/FormField/Fields/DulNumberField.tsx +2 -2
  116. package/src/ui-kit/FormField/Fields/DulSerieField.tsx +2 -2
  117. package/src/ui-kit/FormField/Fields/DulSubdivisionCodeField.tsx +2 -2
  118. package/src/ui-kit/FormField/Fields/Experience5YearsField.tsx +2 -2
  119. package/src/ui-kit/FormField/Fields/FamilyMembersField.tsx +2 -2
  120. package/src/ui-kit/FormField/Fields/GeneralSeniorityField.tsx +2 -2
  121. package/src/ui-kit/FormField/Fields/InnField.tsx +3 -2
  122. package/src/ui-kit/FormField/Fields/JobsNumberField.tsx +2 -2
  123. package/src/ui-kit/FormField/Fields/LastJobExperienceField.tsx +2 -2
  124. package/src/ui-kit/FormField/Fields/PartInBusinessField.tsx +2 -2
  125. package/src/ui-kit/Input/InputControl.tsx +8 -1
  126. package/bundle/ui-kit/Input/InputNumberControl.d.ts +0 -2
  127. package/bundle/ui-kit/InputNumber/InputNumber.d.ts +0 -2
  128. package/dist/ui-kit/Input/InputNumberControl.d.ts +0 -2
  129. package/dist/ui-kit/Input/InputNumberControl.js +0 -10
  130. package/dist/ui-kit/Input/InputNumberControl.js.map +0 -1
  131. package/dist/ui-kit/InputNumber/InputNumber.d.ts +0 -2
  132. package/dist/ui-kit/InputNumber/InputNumber.js +0 -12
  133. package/dist/ui-kit/InputNumber/InputNumber.js.map +0 -1
  134. package/lib/ui-kit/Input/InputNumberControl.d.ts +0 -2
  135. package/lib/ui-kit/Input/InputNumberControl.js +0 -8
  136. package/lib/ui-kit/Input/InputNumberControl.js.map +0 -1
  137. package/lib/ui-kit/InputNumber/InputNumber.d.ts +0 -2
  138. package/lib/ui-kit/InputNumber/InputNumber.js +0 -10
  139. package/lib/ui-kit/InputNumber/InputNumber.js.map +0 -1
  140. package/mobile/bundle/ui-kit/Input/InputNumberControl.d.ts +0 -2
  141. package/mobile/bundle/ui-kit/InputNumber/InputNumber.d.ts +0 -2
  142. package/mobile/dist/ui-kit/Input/InputNumberControl.d.ts +0 -2
  143. package/mobile/dist/ui-kit/Input/InputNumberControl.js +0 -10
  144. package/mobile/dist/ui-kit/Input/InputNumberControl.js.map +0 -1
  145. package/mobile/dist/ui-kit/InputNumber/InputNumber.d.ts +0 -2
  146. package/mobile/dist/ui-kit/InputNumber/InputNumber.js +0 -12
  147. package/mobile/dist/ui-kit/InputNumber/InputNumber.js.map +0 -1
  148. package/mobile/lib/ui-kit/Input/InputNumberControl.d.ts +0 -2
  149. package/mobile/lib/ui-kit/Input/InputNumberControl.js +0 -8
  150. package/mobile/lib/ui-kit/Input/InputNumberControl.js.map +0 -1
  151. package/mobile/lib/ui-kit/InputNumber/InputNumber.d.ts +0 -2
  152. package/mobile/lib/ui-kit/InputNumber/InputNumber.js +0 -10
  153. package/mobile/lib/ui-kit/InputNumber/InputNumber.js.map +0 -1
  154. package/mobile/src/ui-kit/Input/InputNumberControl.tsx +0 -18
  155. package/mobile/src/ui-kit/InputNumber/InputNumber.tsx +0 -24
  156. package/src/ui-kit/Input/InputNumberControl.tsx +0 -18
  157. package/src/ui-kit/InputNumber/InputNumber.tsx +0 -24
@@ -1,11 +1,11 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { InputNumberControl } from '../../Input/InputNumberControl';
2
+ import { InputControl } from '../../Input/InputControl';
3
3
  import { type CustomFieldProps } from '../CustomFieldProps';
4
4
  import { validatorObj } from '../getObjectValidator';
5
5
  import { getValidation } from '../getValidation';
6
6
 
7
7
  export const DulNumberField = JSX<CustomFieldProps>(({ field, input }) => (
8
- <InputNumberControl
8
+ <InputControl
9
9
  label="Номер документа"
10
10
  inputLength={6}
11
11
  {...getValidation(field('dulNumber'), validatorObj.dulNumber, input?.required)}
@@ -1,11 +1,11 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { InputNumberControl } from '../../Input/InputNumberControl';
2
+ import { InputControl } from '../../Input/InputControl';
3
3
  import { type CustomFieldProps } from '../CustomFieldProps';
4
4
  import { validatorObj } from '../getObjectValidator';
5
5
  import { getValidation } from '../getValidation';
6
6
 
7
7
  export const DulSerieField = JSX<CustomFieldProps>(({ field, input }) => (
8
- <InputNumberControl
8
+ <InputControl
9
9
  label="Серия документа"
10
10
  inputLength={4}
11
11
  {...getValidation(field('dulSerie'), validatorObj.dulSerie, input?.required)}
@@ -1,7 +1,7 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { type DaDataSuggestion } from '../../../api/dadataHints/dadataHintsType';
4
- import { InputNumberControl } from '../../Input/InputNumberControl';
4
+ import { InputControl } from '../../Input/InputControl';
5
5
  import { type CustomFieldProps } from '../CustomFieldProps';
6
6
  import { validatorObj } from '../getObjectValidator';
7
7
  import { getValidation } from '../getValidation';
@@ -12,7 +12,7 @@ export const DulSubdivisionCodeField = JSX<CustomFieldProps>(({ field, input })
12
12
  }, []);
13
13
 
14
14
  return (
15
- <InputNumberControl
15
+ <InputControl
16
16
  label="Код подразделения"
17
17
  {...input}
18
18
  inputLength={6}
@@ -1,11 +1,11 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { InputNumberControl } from '../../Input/InputNumberControl';
2
+ import { InputControl } from '../../Input/InputControl';
3
3
  import { type CustomFieldProps } from '../CustomFieldProps';
4
4
  import { validatorObj } from '../getObjectValidator';
5
5
  import { getValidation } from '../getValidation';
6
6
 
7
7
  export const Experience5YearsField = JSX<CustomFieldProps>(({ field, input }) => (
8
- <InputNumberControl
8
+ <InputControl
9
9
  label="Стаж"
10
10
  placeholder="За последние 5 лет"
11
11
  inputLength={2}
@@ -1,11 +1,11 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { InputNumberControl } from '../../Input/InputNumberControl';
2
+ import { InputControl } from '../../Input/InputControl';
3
3
  import { type CustomFieldProps } from '../CustomFieldProps';
4
4
  import { validatorObj } from '../getObjectValidator';
5
5
  import { getValidation } from '../getValidation';
6
6
 
7
7
  export const FamilyMembersField = JSX<CustomFieldProps>(({ field, input }) => (
8
- <InputNumberControl
8
+ <InputControl
9
9
  label="Количество членов семьи"
10
10
  placeholder="Введите значение"
11
11
  inputLength={2}
@@ -1,11 +1,11 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { InputNumberControl } from '../../Input/InputNumberControl';
2
+ import { InputControl } from '../../Input/InputControl';
3
3
  import { type CustomFieldProps } from '../CustomFieldProps';
4
4
  import { validatorObj } from '../getObjectValidator';
5
5
  import { getValidation } from '../getValidation';
6
6
 
7
7
  export const GeneralSeniorityField = JSX<CustomFieldProps>(({ field, input }) => (
8
- <InputNumberControl
8
+ <InputControl
9
9
  label="Общий стаж"
10
10
  inputLength={2}
11
11
  placeholder="Количество лет"
@@ -1,7 +1,7 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { type DaDataSuggestion } from '../../../api/dadataHints/dadataHintsType';
4
- import { InputNumberControl } from '../../Input/InputNumberControl';
4
+ import { InputControl } from '../../Input/InputControl';
5
5
  import { type CustomFieldProps } from '../CustomFieldProps';
6
6
  import { validatorObj } from '../getObjectValidator';
7
7
  import { getValidation } from '../getValidation';
@@ -13,8 +13,9 @@ export const InnField = JSX<CustomFieldProps>(({ field, input }) => {
13
13
  }, []);
14
14
 
15
15
  return (
16
- <InputNumberControl
16
+ <InputControl
17
17
  label="ИНН"
18
+ type="number"
18
19
  inputLength={12}
19
20
  {...input}
20
21
  {...getValidation(field('inn'), validatorObj.inn, input?.required)}
@@ -1,11 +1,11 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { InputNumberControl } from '../../Input/InputNumberControl';
2
+ import { InputControl } from '../../Input/InputControl';
3
3
  import { type CustomFieldProps } from '../CustomFieldProps';
4
4
  import { validatorObj } from '../getObjectValidator';
5
5
  import { getValidation } from '../getValidation';
6
6
 
7
7
  export const JobsNumberField = JSX<CustomFieldProps>(({ field, input }) => (
8
- <InputNumberControl
8
+ <InputControl
9
9
  label="Количество мест работы за последние 5 лет"
10
10
  placeholder="Количество мест"
11
11
  inputLength={2}
@@ -1,11 +1,11 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { InputNumberControl } from '../../Input/InputNumberControl';
2
+ import { InputControl } from '../../Input/InputControl';
3
3
  import { type CustomFieldProps } from '../CustomFieldProps';
4
4
  import { validatorObj } from '../getObjectValidator';
5
5
  import { getValidation } from '../getValidation';
6
6
 
7
7
  export const LastJobExperienceField = JSX<CustomFieldProps>(({ field, input }) => (
8
- <InputNumberControl
8
+ <InputControl
9
9
  label="Стаж на последнем рабочем месте"
10
10
  placeholder="Количество лет"
11
11
  inputLength={2}
@@ -1,11 +1,11 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { InputNumberControl } from '../../Input/InputNumberControl';
2
+ import { InputControl } from '../../Input/InputControl';
3
3
  import { type CustomFieldProps } from '../CustomFieldProps';
4
4
  import { validatorObj } from '../getObjectValidator';
5
5
  import { getValidation } from '../getValidation';
6
6
 
7
7
  export const PartInBusinessField = JSX<CustomFieldProps>(({ field, input }) => (
8
- <InputNumberControl
8
+ <InputControl
9
9
  label="Доля участия в бизнесе"
10
10
  placeholder="в %"
11
11
  inputLength={2}
@@ -1,4 +1,5 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
+ import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
2
3
  import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
3
4
  import { useOutsideClick } from '@redneckz/uni-jsx/lib/hooks/useOutsideClick';
4
5
  import { getRequiredLabel } from '../../utils/getRequiredLabel';
@@ -24,11 +25,17 @@ export const InputControl = JSX<InputProps>(
24
25
  type,
25
26
  name = '',
26
27
  daDataQueryPrefix,
28
+ inputLength,
27
29
  dadata = false,
28
30
  }) => {
29
31
  const [isOpen, { setFalse: close, setTrue: open }] = useBool();
30
32
  const popupRef = useOutsideClick<HTMLDivElement>(close);
31
33
 
34
+ const handleChange = useCallback(
35
+ (v: string) => (inputLength ? v.length <= inputLength && onChange(v) : onChange(v)),
36
+ [onChange],
37
+ );
38
+
32
39
  const inputRef = useInputPopup({
33
40
  isOpen: isOpen && dadata,
34
41
  name,
@@ -52,7 +59,7 @@ export const InputControl = JSX<InputProps>(
52
59
  label={getRequiredLabel({ label, errors })}
53
60
  valid={Boolean(!error)}
54
61
  value={value}
55
- onChange={onChange}
62
+ onChange={handleChange}
56
63
  onBlur={onBlur}
57
64
  isTextarea={isTextarea}
58
65
  placeholder={getPlaceholder(placeholder, errors, label)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.14.617",
3
+ "version": "0.14.618",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -1,11 +1,11 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { InputNumberControl } from '../../Input/InputNumberControl';
2
+ import { InputControl } from '../../Input/InputControl';
3
3
  import { type CustomFieldProps } from '../CustomFieldProps';
4
4
  import { validatorObj } from '../getObjectValidator';
5
5
  import { getValidation } from '../getValidation';
6
6
 
7
7
  export const DependentsField = JSX<CustomFieldProps>(({ field, input }) => (
8
- <InputNumberControl
8
+ <InputControl
9
9
  label="Количество иждивенцев"
10
10
  placeholder="За исключение детей до 18 лет"
11
11
  inputLength={2}
@@ -1,11 +1,11 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { InputNumberControl } from '../../Input/InputNumberControl';
2
+ import { InputControl } from '../../Input/InputControl';
3
3
  import { type CustomFieldProps } from '../CustomFieldProps';
4
4
  import { validatorObj } from '../getObjectValidator';
5
5
  import { getValidation } from '../getValidation';
6
6
 
7
7
  export const DulNumberField = JSX<CustomFieldProps>(({ field, input }) => (
8
- <InputNumberControl
8
+ <InputControl
9
9
  label="Номер документа"
10
10
  inputLength={6}
11
11
  {...getValidation(field('dulNumber'), validatorObj.dulNumber, input?.required)}
@@ -1,11 +1,11 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { InputNumberControl } from '../../Input/InputNumberControl';
2
+ import { InputControl } from '../../Input/InputControl';
3
3
  import { type CustomFieldProps } from '../CustomFieldProps';
4
4
  import { validatorObj } from '../getObjectValidator';
5
5
  import { getValidation } from '../getValidation';
6
6
 
7
7
  export const DulSerieField = JSX<CustomFieldProps>(({ field, input }) => (
8
- <InputNumberControl
8
+ <InputControl
9
9
  label="Серия документа"
10
10
  inputLength={4}
11
11
  {...getValidation(field('dulSerie'), validatorObj.dulSerie, input?.required)}
@@ -1,7 +1,7 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { type DaDataSuggestion } from '../../../api/dadataHints/dadataHintsType';
4
- import { InputNumberControl } from '../../Input/InputNumberControl';
4
+ import { InputControl } from '../../Input/InputControl';
5
5
  import { type CustomFieldProps } from '../CustomFieldProps';
6
6
  import { validatorObj } from '../getObjectValidator';
7
7
  import { getValidation } from '../getValidation';
@@ -12,7 +12,7 @@ export const DulSubdivisionCodeField = JSX<CustomFieldProps>(({ field, input })
12
12
  }, []);
13
13
 
14
14
  return (
15
- <InputNumberControl
15
+ <InputControl
16
16
  label="Код подразделения"
17
17
  {...input}
18
18
  inputLength={6}
@@ -1,11 +1,11 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { InputNumberControl } from '../../Input/InputNumberControl';
2
+ import { InputControl } from '../../Input/InputControl';
3
3
  import { type CustomFieldProps } from '../CustomFieldProps';
4
4
  import { validatorObj } from '../getObjectValidator';
5
5
  import { getValidation } from '../getValidation';
6
6
 
7
7
  export const Experience5YearsField = JSX<CustomFieldProps>(({ field, input }) => (
8
- <InputNumberControl
8
+ <InputControl
9
9
  label="Стаж"
10
10
  placeholder="За последние 5 лет"
11
11
  inputLength={2}
@@ -1,11 +1,11 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { InputNumberControl } from '../../Input/InputNumberControl';
2
+ import { InputControl } from '../../Input/InputControl';
3
3
  import { type CustomFieldProps } from '../CustomFieldProps';
4
4
  import { validatorObj } from '../getObjectValidator';
5
5
  import { getValidation } from '../getValidation';
6
6
 
7
7
  export const FamilyMembersField = JSX<CustomFieldProps>(({ field, input }) => (
8
- <InputNumberControl
8
+ <InputControl
9
9
  label="Количество членов семьи"
10
10
  placeholder="Введите значение"
11
11
  inputLength={2}
@@ -1,11 +1,11 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { InputNumberControl } from '../../Input/InputNumberControl';
2
+ import { InputControl } from '../../Input/InputControl';
3
3
  import { type CustomFieldProps } from '../CustomFieldProps';
4
4
  import { validatorObj } from '../getObjectValidator';
5
5
  import { getValidation } from '../getValidation';
6
6
 
7
7
  export const GeneralSeniorityField = JSX<CustomFieldProps>(({ field, input }) => (
8
- <InputNumberControl
8
+ <InputControl
9
9
  label="Общий стаж"
10
10
  inputLength={2}
11
11
  placeholder="Количество лет"
@@ -1,7 +1,7 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { type DaDataSuggestion } from '../../../api/dadataHints/dadataHintsType';
4
- import { InputNumberControl } from '../../Input/InputNumberControl';
4
+ import { InputControl } from '../../Input/InputControl';
5
5
  import { type CustomFieldProps } from '../CustomFieldProps';
6
6
  import { validatorObj } from '../getObjectValidator';
7
7
  import { getValidation } from '../getValidation';
@@ -13,8 +13,9 @@ export const InnField = JSX<CustomFieldProps>(({ field, input }) => {
13
13
  }, []);
14
14
 
15
15
  return (
16
- <InputNumberControl
16
+ <InputControl
17
17
  label="ИНН"
18
+ type="number"
18
19
  inputLength={12}
19
20
  {...input}
20
21
  {...getValidation(field('inn'), validatorObj.inn, input?.required)}
@@ -1,11 +1,11 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { InputNumberControl } from '../../Input/InputNumberControl';
2
+ import { InputControl } from '../../Input/InputControl';
3
3
  import { type CustomFieldProps } from '../CustomFieldProps';
4
4
  import { validatorObj } from '../getObjectValidator';
5
5
  import { getValidation } from '../getValidation';
6
6
 
7
7
  export const JobsNumberField = JSX<CustomFieldProps>(({ field, input }) => (
8
- <InputNumberControl
8
+ <InputControl
9
9
  label="Количество мест работы за последние 5 лет"
10
10
  placeholder="Количество мест"
11
11
  inputLength={2}
@@ -1,11 +1,11 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { InputNumberControl } from '../../Input/InputNumberControl';
2
+ import { InputControl } from '../../Input/InputControl';
3
3
  import { type CustomFieldProps } from '../CustomFieldProps';
4
4
  import { validatorObj } from '../getObjectValidator';
5
5
  import { getValidation } from '../getValidation';
6
6
 
7
7
  export const LastJobExperienceField = JSX<CustomFieldProps>(({ field, input }) => (
8
- <InputNumberControl
8
+ <InputControl
9
9
  label="Стаж на последнем рабочем месте"
10
10
  placeholder="Количество лет"
11
11
  inputLength={2}
@@ -1,11 +1,11 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { InputNumberControl } from '../../Input/InputNumberControl';
2
+ import { InputControl } from '../../Input/InputControl';
3
3
  import { type CustomFieldProps } from '../CustomFieldProps';
4
4
  import { validatorObj } from '../getObjectValidator';
5
5
  import { getValidation } from '../getValidation';
6
6
 
7
7
  export const PartInBusinessField = JSX<CustomFieldProps>(({ field, input }) => (
8
- <InputNumberControl
8
+ <InputControl
9
9
  label="Доля участия в бизнесе"
10
10
  placeholder="в %"
11
11
  inputLength={2}
@@ -1,4 +1,5 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
+ import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
2
3
  import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
3
4
  import { useOutsideClick } from '@redneckz/uni-jsx/lib/hooks/useOutsideClick';
4
5
  import { getRequiredLabel } from '../../utils/getRequiredLabel';
@@ -24,11 +25,17 @@ export const InputControl = JSX<InputProps>(
24
25
  type,
25
26
  name = '',
26
27
  daDataQueryPrefix,
28
+ inputLength,
27
29
  dadata = false,
28
30
  }) => {
29
31
  const [isOpen, { setFalse: close, setTrue: open }] = useBool();
30
32
  const popupRef = useOutsideClick<HTMLDivElement>(close);
31
33
 
34
+ const handleChange = useCallback(
35
+ (v: string) => (inputLength ? v.length <= inputLength && onChange(v) : onChange(v)),
36
+ [onChange],
37
+ );
38
+
32
39
  const inputRef = useInputPopup({
33
40
  isOpen: isOpen && dadata,
34
41
  name,
@@ -52,7 +59,7 @@ export const InputControl = JSX<InputProps>(
52
59
  label={getRequiredLabel({ label, errors })}
53
60
  valid={Boolean(!error)}
54
61
  value={value}
55
- onChange={onChange}
62
+ onChange={handleChange}
56
63
  onBlur={onBlur}
57
64
  isTextarea={isTextarea}
58
65
  placeholder={getPlaceholder(placeholder, errors, label)}
@@ -1,2 +0,0 @@
1
- import { type InputProps } from './InputProps';
2
- export declare const InputNumberControl: import("@redneckz/uni-jsx").UNIComponent<InputProps<string>, any, any>;
@@ -1,2 +0,0 @@
1
- import { type InputProps } from '../Input/InputProps';
2
- export declare const InputNumber: import("@redneckz/uni-jsx").UNIComponent<InputProps<string>, any, any>;
@@ -1,2 +0,0 @@
1
- import { type InputProps } from './InputProps';
2
- export declare const InputNumberControl: import("@redneckz/uni-jsx").UNIComponent<InputProps<string>, any, any>;
@@ -1,10 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.InputNumberControl = void 0;
3
- const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
4
- const uni_jsx_1 = require("@redneckz/uni-jsx");
5
- const getRequiredLabel_1 = require("../../utils/getRequiredLabel");
6
- const style_1 = require("../../utils/style");
7
- const InputNumber_1 = require("../InputNumber/InputNumber");
8
- const renderErrorText_1 = require("./renderErrorText");
9
- exports.InputNumberControl = (0, uni_jsx_1.JSX)(({ className, label, error, ...rest }) => ((0, jsx_runtime_1.jsxs)("div", { className: (0, style_1.style)('shrink-0 w-full', className), children: [(0, jsx_runtime_1.jsx)(InputNumber_1.InputNumber, { "aria-label": label, label: (0, getRequiredLabel_1.getRequiredLabel)({ label, errors: rest?.errors }), valid: Boolean(!error), ...rest }), (0, renderErrorText_1.renderErrorText)(error)] })));
10
- //# sourceMappingURL=InputNumberControl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InputNumberControl.js","sourceRoot":"","sources":["../../../src/ui-kit/Input/InputNumberControl.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,mEAAgE;AAChE,6CAA0C;AAC1C,4DAAyD;AAEzD,uDAAoD;AAEvC,QAAA,kBAAkB,GAAG,IAAA,aAAG,EAAa,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,CAAC,CAC1F,iCAAK,SAAS,EAAE,IAAA,aAAK,EAAC,iBAAiB,EAAE,SAAS,CAAC,aACjD,uBAAC,yBAAW,kBACE,KAAK,EACjB,KAAK,EAAE,IAAA,mCAAgB,EAAC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EACxD,KAAK,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,KAClB,IAAI,GACR,EACD,IAAA,iCAAe,EAAC,KAAK,CAAC,IACnB,CACP,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- import { type InputProps } from '../Input/InputProps';
2
- export declare const InputNumber: import("@redneckz/uni-jsx").UNIComponent<InputProps<string>, any, any>;
@@ -1,12 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.InputNumber = void 0;
3
- const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
4
- const uni_jsx_1 = require("@redneckz/uni-jsx");
5
- const hooks_1 = require("@redneckz/uni-jsx/lib/hooks");
6
- const Input_1 = require("../Input/Input");
7
- exports.InputNumber = (0, uni_jsx_1.JSX)(({ children, onChange, inputLength, ...inputProps }) => {
8
- const handleChange = (0, hooks_1.useCallback)((v) => onChange && inputLength && v.length <= inputLength && onChange(normalizeInput(v)), [onChange]);
9
- return ((0, jsx_runtime_1.jsx)(Input_1.Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), children: children }));
10
- });
11
- const normalizeInput = (value) => value.replace(/\D/g, '');
12
- //# sourceMappingURL=InputNumber.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InputNumber.js","sourceRoot":"","sources":["../../../src/ui-kit/InputNumber/InputNumber.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,uDAA0D;AAC1D,0CAAuC;AAG1B,QAAA,WAAW,GAAG,IAAA,aAAG,EAAa,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,UAAU,EAAE,EAAE,EAAE;IAChG,MAAM,YAAY,GAAG,IAAA,mBAAW,EAC9B,CAAC,CAAS,EAAE,EAAE,CACZ,QAAQ,IAAI,WAAW,IAAI,CAAC,CAAC,MAAM,IAAI,WAAW,IAAI,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EACnF,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,OAAO,CACL,uBAAC,aAAK,OACA,UAAU,EACd,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,YAAY,CAAE,EAAE,EAAE,MAA2B,EAAE,KAAK,IAAI,EAAE,CAAC,YAE3E,QAAQ,GACH,CACT,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- import { type InputProps } from './InputProps';
2
- export declare const InputNumberControl: import("@redneckz/uni-jsx").UNIComponent<InputProps<string>, any, any>;
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
2
- import { JSX } from '@redneckz/uni-jsx';
3
- import { getRequiredLabel } from '../../utils/getRequiredLabel.js';
4
- import { style } from '../../utils/style.js';
5
- import { InputNumber } from '../InputNumber/InputNumber.js';
6
- import { renderErrorText } from './renderErrorText.js';
7
- export const InputNumberControl = JSX(({ className, label, error, ...rest }) => (_jsxs("div", { className: style('shrink-0 w-full', className), children: [_jsx(InputNumber, { "aria-label": label, label: getRequiredLabel({ label, errors: rest?.errors }), valid: Boolean(!error), ...rest }), renderErrorText(error)] })));
8
- //# sourceMappingURL=InputNumberControl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InputNumberControl.js","sourceRoot":"","sources":["../../../src/ui-kit/Input/InputNumberControl.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAa,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,CAAC,CAC1F,eAAK,SAAS,EAAE,KAAK,CAAC,iBAAiB,EAAE,SAAS,CAAC,aACjD,KAAC,WAAW,kBACE,KAAK,EACjB,KAAK,EAAE,gBAAgB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EACxD,KAAK,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,KAClB,IAAI,GACR,EACD,eAAe,CAAC,KAAK,CAAC,IACnB,CACP,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- import { type InputProps } from '../Input/InputProps';
2
- export declare const InputNumber: import("@redneckz/uni-jsx").UNIComponent<InputProps<string>, any, any>;
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
2
- import { JSX } from '@redneckz/uni-jsx';
3
- import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
4
- import { Input } from '../Input/Input.js';
5
- export const InputNumber = JSX(({ children, onChange, inputLength, ...inputProps }) => {
6
- const handleChange = useCallback((v) => onChange && inputLength && v.length <= inputLength && onChange(normalizeInput(v)), [onChange]);
7
- return (_jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), children: children }));
8
- });
9
- const normalizeInput = (value) => value.replace(/\D/g, '');
10
- //# sourceMappingURL=InputNumber.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InputNumber.js","sourceRoot":"","sources":["../../../src/ui-kit/InputNumber/InputNumber.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAa,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,UAAU,EAAE,EAAE,EAAE;IAChG,MAAM,YAAY,GAAG,WAAW,CAC9B,CAAC,CAAS,EAAE,EAAE,CACZ,QAAQ,IAAI,WAAW,IAAI,CAAC,CAAC,MAAM,IAAI,WAAW,IAAI,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EACnF,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,OAAO,CACL,KAAC,KAAK,OACA,UAAU,EACd,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,YAAY,CAAE,EAAE,EAAE,MAA2B,EAAE,KAAK,IAAI,EAAE,CAAC,YAE3E,QAAQ,GACH,CACT,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- import { type InputProps } from './InputProps';
2
- export declare const InputNumberControl: import("@redneckz/uni-jsx").UNIComponent<InputProps<string>, any, any>;
@@ -1,2 +0,0 @@
1
- import { type InputProps } from '../Input/InputProps';
2
- export declare const InputNumber: import("@redneckz/uni-jsx").UNIComponent<InputProps<string>, any, any>;
@@ -1,2 +0,0 @@
1
- import { type InputProps } from './InputProps';
2
- export declare const InputNumberControl: import("@redneckz/uni-jsx").UNIComponent<InputProps<string>, any, any>;
@@ -1,10 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.InputNumberControl = void 0;
3
- const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
4
- const uni_jsx_1 = require("@redneckz/uni-jsx");
5
- const getRequiredLabel_1 = require("../../utils/getRequiredLabel");
6
- const style_1 = require("../../utils/style");
7
- const InputNumber_1 = require("../InputNumber/InputNumber");
8
- const renderErrorText_1 = require("./renderErrorText");
9
- exports.InputNumberControl = (0, uni_jsx_1.JSX)(({ className, label, error, ...rest }) => ((0, jsx_runtime_1.jsxs)("div", { className: (0, style_1.style)('shrink-0 w-full', className), children: [(0, jsx_runtime_1.jsx)(InputNumber_1.InputNumber, { "aria-label": label, label: (0, getRequiredLabel_1.getRequiredLabel)({ label, errors: rest?.errors }), valid: Boolean(!error), ...rest }), (0, renderErrorText_1.renderErrorText)(error)] })));
10
- //# sourceMappingURL=InputNumberControl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InputNumberControl.js","sourceRoot":"","sources":["../../../src/ui-kit/Input/InputNumberControl.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,mEAAgE;AAChE,6CAA0C;AAC1C,4DAAyD;AAEzD,uDAAoD;AAEvC,QAAA,kBAAkB,GAAG,IAAA,aAAG,EAAa,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,CAAC,CAC1F,iCAAK,SAAS,EAAE,IAAA,aAAK,EAAC,iBAAiB,EAAE,SAAS,CAAC,aACjD,uBAAC,yBAAW,kBACE,KAAK,EACjB,KAAK,EAAE,IAAA,mCAAgB,EAAC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EACxD,KAAK,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,KAClB,IAAI,GACR,EACD,IAAA,iCAAe,EAAC,KAAK,CAAC,IACnB,CACP,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- import { type InputProps } from '../Input/InputProps';
2
- export declare const InputNumber: import("@redneckz/uni-jsx").UNIComponent<InputProps<string>, any, any>;
@@ -1,12 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.InputNumber = void 0;
3
- const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
4
- const uni_jsx_1 = require("@redneckz/uni-jsx");
5
- const hooks_1 = require("@redneckz/uni-jsx/lib/hooks");
6
- const Input_1 = require("../Input/Input");
7
- exports.InputNumber = (0, uni_jsx_1.JSX)(({ children, onChange, inputLength, ...inputProps }) => {
8
- const handleChange = (0, hooks_1.useCallback)((v) => onChange && inputLength && v.length <= inputLength && onChange(normalizeInput(v)), [onChange]);
9
- return ((0, jsx_runtime_1.jsx)(Input_1.Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), children: children }));
10
- });
11
- const normalizeInput = (value) => value.replace(/\D/g, '');
12
- //# sourceMappingURL=InputNumber.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InputNumber.js","sourceRoot":"","sources":["../../../src/ui-kit/InputNumber/InputNumber.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,uDAA0D;AAC1D,0CAAuC;AAG1B,QAAA,WAAW,GAAG,IAAA,aAAG,EAAa,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,UAAU,EAAE,EAAE,EAAE;IAChG,MAAM,YAAY,GAAG,IAAA,mBAAW,EAC9B,CAAC,CAAS,EAAE,EAAE,CACZ,QAAQ,IAAI,WAAW,IAAI,CAAC,CAAC,MAAM,IAAI,WAAW,IAAI,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EACnF,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,OAAO,CACL,uBAAC,aAAK,OACA,UAAU,EACd,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,YAAY,CAAE,EAAE,EAAE,MAA2B,EAAE,KAAK,IAAI,EAAE,CAAC,YAE3E,QAAQ,GACH,CACT,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- import { type InputProps } from './InputProps';
2
- export declare const InputNumberControl: import("@redneckz/uni-jsx").UNIComponent<InputProps<string>, any, any>;
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
2
- import { JSX } from '@redneckz/uni-jsx';
3
- import { getRequiredLabel } from '../../utils/getRequiredLabel.js';
4
- import { style } from '../../utils/style.js';
5
- import { InputNumber } from '../InputNumber/InputNumber.js';
6
- import { renderErrorText } from './renderErrorText.js';
7
- export const InputNumberControl = JSX(({ className, label, error, ...rest }) => (_jsxs("div", { className: style('shrink-0 w-full', className), children: [_jsx(InputNumber, { "aria-label": label, label: getRequiredLabel({ label, errors: rest?.errors }), valid: Boolean(!error), ...rest }), renderErrorText(error)] })));
8
- //# sourceMappingURL=InputNumberControl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InputNumberControl.js","sourceRoot":"","sources":["../../../src/ui-kit/Input/InputNumberControl.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAa,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,CAAC,CAC1F,eAAK,SAAS,EAAE,KAAK,CAAC,iBAAiB,EAAE,SAAS,CAAC,aACjD,KAAC,WAAW,kBACE,KAAK,EACjB,KAAK,EAAE,gBAAgB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EACxD,KAAK,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,KAClB,IAAI,GACR,EACD,eAAe,CAAC,KAAK,CAAC,IACnB,CACP,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- import { type InputProps } from '../Input/InputProps';
2
- export declare const InputNumber: import("@redneckz/uni-jsx").UNIComponent<InputProps<string>, any, any>;
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
2
- import { JSX } from '@redneckz/uni-jsx';
3
- import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
4
- import { Input } from '../Input/Input.js';
5
- export const InputNumber = JSX(({ children, onChange, inputLength, ...inputProps }) => {
6
- const handleChange = useCallback((v) => onChange && inputLength && v.length <= inputLength && onChange(normalizeInput(v)), [onChange]);
7
- return (_jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), children: children }));
8
- });
9
- const normalizeInput = (value) => value.replace(/\D/g, '');
10
- //# sourceMappingURL=InputNumber.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InputNumber.js","sourceRoot":"","sources":["../../../src/ui-kit/InputNumber/InputNumber.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAa,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,UAAU,EAAE,EAAE,EAAE;IAChG,MAAM,YAAY,GAAG,WAAW,CAC9B,CAAC,CAAS,EAAE,EAAE,CACZ,QAAQ,IAAI,WAAW,IAAI,CAAC,CAAC,MAAM,IAAI,WAAW,IAAI,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EACnF,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,OAAO,CACL,KAAC,KAAK,OACA,UAAU,EACd,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,YAAY,CAAE,EAAE,EAAE,MAA2B,EAAE,KAAK,IAAI,EAAE,CAAC,YAE3E,QAAQ,GACH,CACT,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC"}