@alfalab/core-components-phone-input 5.2.0
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.
- package/CHANGELOG.md +316 -0
- package/dist/Component.d.ts +10 -0
- package/dist/Component.js +136 -0
- package/dist/cssm/Component.d.ts +10 -0
- package/dist/cssm/Component.js +136 -0
- package/dist/cssm/index.d.ts +1 -0
- package/dist/cssm/index.js +13 -0
- package/dist/cssm/utils/index.d.ts +17 -0
- package/dist/cssm/utils/index.js +37 -0
- package/dist/esm/Component.d.ts +10 -0
- package/dist/esm/Component.js +128 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/utils/index.d.ts +17 -0
- package/dist/esm/utils/index.js +31 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +13 -0
- package/dist/modern/Component.d.ts +10 -0
- package/dist/modern/Component.js +88 -0
- package/dist/modern/index.d.ts +1 -0
- package/dist/modern/index.js +5 -0
- package/dist/modern/utils/index.d.ts +17 -0
- package/dist/modern/utils/index.js +27 -0
- package/dist/send-stats.js +82 -0
- package/dist/utils/index.d.ts +17 -0
- package/dist/utils/index.js +37 -0
- package/package.json +27 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
# [5.2.0](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@5.1.7...@alfalab/core-components-phone-input@5.2.0) (2021-09-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* change error type to ReactNode ([#825](https://github.com/alfa-laboratory/core-components/issues/825)) ([c6d95c1](https://github.com/alfa-laboratory/core-components/commit/c6d95c1c6239f2b2a3bf2c1639554d8500e794f3))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [5.1.7](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@5.1.6...@alfalab/core-components-phone-input@5.1.7) (2021-08-27)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [5.1.6](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@5.1.5...@alfalab/core-components-phone-input@5.1.6) (2021-08-23)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## [5.1.5](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@5.1.4...@alfalab/core-components-phone-input@5.1.5) (2021-08-23)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
38
|
+
* **input:** smart error icon ([#746](https://github.com/alfa-laboratory/core-components/issues/746)) ([f1950d6](https://github.com/alfa-laboratory/core-components/commit/f1950d6d516d17d993f0865c10390b6301bb2707)), closes [#782](https://github.com/alfa-laboratory/core-components/issues/782)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
## [5.1.4](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@5.1.3...@alfalab/core-components-phone-input@5.1.4) (2021-08-11)
|
|
45
|
+
|
|
46
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
## [5.1.3](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@5.1.2...@alfalab/core-components-phone-input@5.1.3) (2021-08-04)
|
|
53
|
+
|
|
54
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## [5.1.2](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@5.1.1...@alfalab/core-components-phone-input@5.1.2) (2021-07-23)
|
|
61
|
+
|
|
62
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
## [5.1.1](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@5.1.0...@alfalab/core-components-phone-input@5.1.1) (2021-07-20)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
### Bug Fixes
|
|
72
|
+
|
|
73
|
+
* **phone-input:** value prop ([#757](https://github.com/alfa-laboratory/core-components/issues/757)) ([3ba0168](https://github.com/alfa-laboratory/core-components/commit/3ba01686ffa950bd74d9ab28bfa961c6cf74a5d8))
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
# [5.1.0](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@5.0.1...@alfalab/core-components-phone-input@5.1.0) (2021-07-19)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
### Features
|
|
83
|
+
|
|
84
|
+
* **phone-input:** add 'clearableCountyCode' prop ([#749](https://github.com/alfa-laboratory/core-components/issues/749)) ([d110ae7](https://github.com/alfa-laboratory/core-components/commit/d110ae76594ccbf7f6d8a5764d3c2a72b1ae9a26))
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
## [5.0.1](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@5.0.0...@alfalab/core-components-phone-input@5.0.1) (2021-07-09)
|
|
91
|
+
|
|
92
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
# [5.0.0](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@4.0.20...@alfalab/core-components-phone-input@5.0.0) (2021-07-08)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
### Features
|
|
102
|
+
|
|
103
|
+
* upgrade storybook ([#696](https://github.com/alfa-laboratory/core-components/issues/696))
|
|
104
|
+
|
|
105
|
+
## [4.0.20](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@4.0.19...@alfalab/core-components-phone-input@4.0.20) (2021-06-22)
|
|
106
|
+
|
|
107
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
## [4.0.19](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@4.0.18...@alfalab/core-components-phone-input@4.0.19) (2021-06-08)
|
|
114
|
+
|
|
115
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
## [4.0.18](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@4.0.17...@alfalab/core-components-phone-input@4.0.18) (2021-05-31)
|
|
122
|
+
|
|
123
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
## [4.0.17](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@4.0.16...@alfalab/core-components-phone-input@4.0.17) (2021-05-25)
|
|
130
|
+
|
|
131
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
## [4.0.16](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@4.0.15...@alfalab/core-components-phone-input@4.0.16) (2021-05-25)
|
|
138
|
+
|
|
139
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
## [4.0.15](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@4.0.14...@alfalab/core-components-phone-input@4.0.15) (2021-05-18)
|
|
146
|
+
|
|
147
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
## [4.0.14](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@4.0.13...@alfalab/core-components-phone-input@4.0.14) (2021-05-07)
|
|
154
|
+
|
|
155
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
## [4.0.13](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@4.0.12...@alfalab/core-components-phone-input@4.0.13) (2021-04-26)
|
|
162
|
+
|
|
163
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
## [4.0.12](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@4.0.11...@alfalab/core-components-phone-input@4.0.12) (2021-04-09)
|
|
170
|
+
|
|
171
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
## [4.0.11](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@4.0.10...@alfalab/core-components-phone-input@4.0.11) (2021-04-01)
|
|
178
|
+
|
|
179
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
## [4.0.10](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@4.0.9...@alfalab/core-components-phone-input@4.0.10) (2021-03-30)
|
|
186
|
+
|
|
187
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
## [4.0.9](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@4.0.8...@alfalab/core-components-phone-input@4.0.9) (2021-03-24)
|
|
194
|
+
|
|
195
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
## [4.0.8](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@4.0.7...@alfalab/core-components-phone-input@4.0.8) (2021-03-19)
|
|
202
|
+
|
|
203
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
## [4.0.7](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@4.0.5...@alfalab/core-components-phone-input@4.0.7) (2021-03-18)
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
### Bug Fixes
|
|
213
|
+
|
|
214
|
+
* one more sborka bug ([#579](https://github.com/alfa-laboratory/core-components/issues/579)) ([9fbe0be](https://github.com/alfa-laboratory/core-components/commit/9fbe0beca56ec5971de78b3f6cda25305b260efc))
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
## [4.0.5](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@4.0.3...@alfalab/core-components-phone-input@4.0.5) (2021-03-16)
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
### Bug Fixes
|
|
224
|
+
|
|
225
|
+
* border-radius in packages ([781749e](https://github.com/alfa-laboratory/core-components/commit/781749ef38aefd5a6707ac56d2e297dce9f3e073))
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
## [4.0.3](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@4.0.2...@alfalab/core-components-phone-input@4.0.3) (2021-03-15)
|
|
232
|
+
|
|
233
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
## [4.0.2](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@4.0.1...@alfalab/core-components-phone-input@4.0.2) (2021-03-14)
|
|
240
|
+
|
|
241
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
## [4.0.1](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@4.0.0...@alfalab/core-components-phone-input@4.0.1) (2021-03-10)
|
|
248
|
+
|
|
249
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
# [4.0.0](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@3.2.7...@alfalab/core-components-phone-input@4.0.0) (2021-03-04)
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
### Features
|
|
259
|
+
|
|
260
|
+
* **phone-input:** changed size L (72 → 64), added size XL (72) ([13257c5](https://github.com/alfa-laboratory/core-components/commit/13257c54543b2f1a870527093df11c532143dab9))
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
### BREAKING CHANGES
|
|
264
|
+
|
|
265
|
+
* **phone-input:** size L changed to size XL
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
## [3.2.7](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@3.2.6...@alfalab/core-components-phone-input@3.2.7) (2021-03-03)
|
|
272
|
+
|
|
273
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
## [3.2.6](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@3.2.5...@alfalab/core-components-phone-input@3.2.6) (2021-03-03)
|
|
280
|
+
|
|
281
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
## [3.2.5](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@3.2.4...@alfalab/core-components-phone-input@3.2.5) (2021-03-03)
|
|
288
|
+
|
|
289
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
## [3.2.4](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@3.2.3...@alfalab/core-components-phone-input@3.2.4) (2021-02-20)
|
|
296
|
+
|
|
297
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
## [3.2.3](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@3.2.2...@alfalab/core-components-phone-input@3.2.3) (2021-02-19)
|
|
304
|
+
|
|
305
|
+
**Note:** Version bump only for package @alfalab/core-components-phone-input
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
## [3.2.2](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-phone-input@3.2.1...@alfalab/core-components-phone-input@3.2.2) (2021-02-18)
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
### Bug Fixes
|
|
315
|
+
|
|
316
|
+
* update versions ([#525](https://github.com/alfa-laboratory/core-components/issues/525)) ([31b2e4c](https://github.com/alfa-laboratory/core-components/commit/31b2e4c92fde6e2b63a3391a4e053cd328e93e70))
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { MaskedInputProps } from "@alfalab/core-components-masked-input";
|
|
4
|
+
type PhoneInputProps = Omit<MaskedInputProps, 'onBeforeDisplay' | 'type' | 'mask'> & {
|
|
5
|
+
clearableCountryCode?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const PhoneInput: React.ForwardRefExoticComponent<Pick<MaskedInputProps, "className" | "dataTestId" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "children" | "leftAddons" | "rightAddons" | "size" | "block" | "colors" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "list" | "step" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "value" | "fieldClassName" | "labelClassName" | "addonsClassName" | "error" | "hint" | "bottomAddons" | "accept" | "alt" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "height" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "readOnly" | "required" | "src" | "width" | "clear" | "success" | "inputClassName" | "focusedClassName" | "filledClassName" | "onClear" | "wrapperRef" | "keepCharPositions"> & {
|
|
8
|
+
clearableCountryCode?: boolean | undefined;
|
|
9
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
10
|
+
export { PhoneInputProps, PhoneInput };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var textMaskCore = require('text-mask-core');
|
|
7
|
+
var coreComponentsMaskedInput = require('@alfalab/core-components-masked-input');
|
|
8
|
+
var utils_index = require('./utils/index.js');
|
|
9
|
+
|
|
10
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
+
|
|
12
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
13
|
+
|
|
14
|
+
/*! *****************************************************************************
|
|
15
|
+
Copyright (c) Microsoft Corporation.
|
|
16
|
+
|
|
17
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
18
|
+
purpose with or without fee is hereby granted.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
21
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
22
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
23
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
24
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
25
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
26
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
27
|
+
***************************************************************************** */
|
|
28
|
+
var __assign = function () {
|
|
29
|
+
__assign = Object.assign || function __assign(t) {
|
|
30
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
31
|
+
s = arguments[i];
|
|
32
|
+
for (var p in s)
|
|
33
|
+
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
34
|
+
t[p] = s[p];
|
|
35
|
+
}
|
|
36
|
+
return t;
|
|
37
|
+
};
|
|
38
|
+
return __assign.apply(this, arguments);
|
|
39
|
+
};
|
|
40
|
+
function __rest(s, e) {
|
|
41
|
+
var t = {};
|
|
42
|
+
for (var p in s)
|
|
43
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
44
|
+
t[p] = s[p];
|
|
45
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
46
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
47
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
48
|
+
t[p[i]] = s[p[i]];
|
|
49
|
+
}
|
|
50
|
+
return t;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
var mask = [
|
|
54
|
+
'+',
|
|
55
|
+
'7',
|
|
56
|
+
' ',
|
|
57
|
+
/([0-6]|[8-9])/,
|
|
58
|
+
/\d/,
|
|
59
|
+
/\d/,
|
|
60
|
+
' ',
|
|
61
|
+
/\d/,
|
|
62
|
+
/\d/,
|
|
63
|
+
/\d/,
|
|
64
|
+
'-',
|
|
65
|
+
/\d/,
|
|
66
|
+
/\d/,
|
|
67
|
+
'-',
|
|
68
|
+
/\d/,
|
|
69
|
+
/\d/,
|
|
70
|
+
];
|
|
71
|
+
var countryPrefix = '+7 ';
|
|
72
|
+
var PhoneInput = React__default['default'].forwardRef(function (_a, ref) {
|
|
73
|
+
var _b = _a.clearableCountryCode, clearableCountryCode = _b === void 0 ? true : _b, restProps = __rest(_a, ["clearableCountryCode"]);
|
|
74
|
+
var inputRef = React.useRef(null);
|
|
75
|
+
// Оставляет возможность прокинуть ref извне
|
|
76
|
+
React.useImperativeHandle(ref, function () { return inputRef.current; });
|
|
77
|
+
var handleBeforeDisplay = React.useCallback(function (conformedValue, config) {
|
|
78
|
+
var rawValue = config.rawValue, previousConformedValue = config.previousConformedValue, currentCaretPosition = config.currentCaretPosition;
|
|
79
|
+
/*
|
|
80
|
+
* код ниже нужен для фикса следующих багов библиотеки text-mask:
|
|
81
|
+
* 1) так как код страны указан в маске жестко как "+7",
|
|
82
|
+
* то при удалении цифры перед ним каретка устанавливается перед кодом страны
|
|
83
|
+
* 2) в номере телефона есть пробелы и дефисы,
|
|
84
|
+
* при редактировании цифр рядом с этими символами каретка перескакивает через них,
|
|
85
|
+
* а не остается на том же месте, на котором была до редактирования
|
|
86
|
+
*/
|
|
87
|
+
var previousValueWithoutFormatting = previousConformedValue
|
|
88
|
+
? utils_index.deleteFormatting(previousConformedValue)
|
|
89
|
+
: '';
|
|
90
|
+
var currentValueWithoutFormatting = utils_index.deleteFormatting(conformedValue) || '';
|
|
91
|
+
if (previousConformedValue &&
|
|
92
|
+
(([3, 6].includes(currentCaretPosition) &&
|
|
93
|
+
Math.abs(previousValueWithoutFormatting.length -
|
|
94
|
+
currentValueWithoutFormatting.length) === 1) ||
|
|
95
|
+
([7, 10, 13].includes(currentCaretPosition) &&
|
|
96
|
+
previousConformedValue.length > currentCaretPosition))) {
|
|
97
|
+
utils_index.setCaretPosition({ position: currentCaretPosition, inputRef: inputRef });
|
|
98
|
+
}
|
|
99
|
+
// Удаление цифры перед кодом страны удаляет только саму цифру, код остается ("+7 1" -> "+7 ")
|
|
100
|
+
if (rawValue === countryPrefix) {
|
|
101
|
+
return rawValue;
|
|
102
|
+
}
|
|
103
|
+
// Вставка номера с 10 цифрами без кода страны
|
|
104
|
+
if (rawValue.length === 10 && conformedValue.length === mask.length) {
|
|
105
|
+
var masked = textMaskCore.conformToMask("+7" + rawValue, mask, config);
|
|
106
|
+
return masked.conformedValue;
|
|
107
|
+
}
|
|
108
|
+
var insertedNumber = utils_index.getInsertedNumber({
|
|
109
|
+
rawValue: rawValue,
|
|
110
|
+
clearableCountryCode: clearableCountryCode,
|
|
111
|
+
countryPrefix: countryPrefix,
|
|
112
|
+
previousConformedValue: previousConformedValue,
|
|
113
|
+
});
|
|
114
|
+
// Вставка номера, начинающегося с 8 или 7: 89990313131, 71112223344
|
|
115
|
+
if (conformedValue.length === mask.length &&
|
|
116
|
+
(insertedNumber.startsWith('8') || insertedNumber.startsWith('7'))) {
|
|
117
|
+
var masked = textMaskCore.conformToMask("+7" + insertedNumber.slice(1), mask, config);
|
|
118
|
+
return masked.conformedValue;
|
|
119
|
+
}
|
|
120
|
+
// Если ввод начат с 7 или 8 - выводит "+7 " и дает продолжить ввод со след. цифры
|
|
121
|
+
if (rawValue.length === 1 && ['7', '8'].includes(rawValue[0])) {
|
|
122
|
+
return countryPrefix;
|
|
123
|
+
}
|
|
124
|
+
var abortCountryCodeClearing = !clearableCountryCode && !conformedValue;
|
|
125
|
+
if (abortCountryCodeClearing) {
|
|
126
|
+
utils_index.setCaretPosition({ position: countryPrefix.length, inputRef: inputRef });
|
|
127
|
+
if (!rawValue.length)
|
|
128
|
+
return countryPrefix;
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
return conformedValue;
|
|
132
|
+
}, [clearableCountryCode]);
|
|
133
|
+
return (React__default['default'].createElement(coreComponentsMaskedInput.MaskedInput, __assign({}, restProps, { defaultValue: clearableCountryCode ? restProps.defaultValue : countryPrefix, mask: mask, onBeforeDisplay: handleBeforeDisplay, type: 'tel', ref: inputRef })));
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
exports.PhoneInput = PhoneInput;
|