@xsolla/xui-input-phone 0.119.0 → 0.120.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsolla/xui-input-phone",
3
- "version": "0.119.0",
3
+ "version": "0.120.0",
4
4
  "main": "./web/index.js",
5
5
  "module": "./web/index.mjs",
6
6
  "types": "./web/index.d.ts",
@@ -13,8 +13,8 @@
13
13
  "test:coverage": "vitest run --coverage"
14
14
  },
15
15
  "dependencies": {
16
- "@xsolla/xui-core": "0.119.0",
17
- "@xsolla/xui-primitives-core": "0.119.0",
16
+ "@xsolla/xui-core": "0.120.0",
17
+ "@xsolla/xui-primitives-core": "0.120.0",
18
18
  "libphonenumber-js": "^1.10.56"
19
19
  },
20
20
  "peerDependencies": {
@@ -1,247 +0,0 @@
1
- /**
2
- * Flowtype definitions for index
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
-
8
- import React, { Node, InputHTMLAttributes } from "react";
9
-
10
- /**
11
- * Country data for phone input
12
- */
13
- declare interface Country {
14
- /**
15
- * ISO 3166-1 alpha-2 country code (e.g., "US", "GB")
16
- */
17
- code: string;
18
-
19
- /**
20
- * Country name
21
- */
22
- name: string;
23
-
24
- /**
25
- * International dial code (e.g., "+1", "+44")
26
- */
27
- dialCode: string;
28
-
29
- /**
30
- * Flag icon component
31
- */
32
- flag?: Node;
33
- }
34
- declare type InputPhoneProps = {
35
- /**
36
- * Property for specifying the value of the control.
37
- */
38
- value?: string,
39
-
40
- /**
41
- * Property for specifying the placeholder of the control.
42
- */
43
- placeholder?: string,
44
-
45
- /**
46
- * Event handler when the value changes (for controlled mode).
47
- */
48
- onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void,
49
-
50
- /**
51
- * Event handler when the text changes (alternative to onChange).
52
- */
53
- onChangeText?: (text: string) => void,
54
-
55
- /**
56
- * Property for changing the size of the input.
57
- */
58
- size?: "xl" | "lg" | "md" | "sm" | "xs",
59
-
60
- /**
61
- * Property for specifying the name of the control.
62
- */
63
- name?: string,
64
-
65
- /**
66
- * Property for disabling the control.
67
- */
68
- disabled?: boolean,
69
-
70
- /**
71
- * Property for displaying an error message and highlighting the control as invalid.
72
- */
73
- errorMessage?: string,
74
-
75
- /**
76
- * Property for displaying an error and highlighting the control as invalid.
77
- */
78
- error?: boolean,
79
-
80
- /**
81
- * Array of countries to display in the dropdown.
82
- * Defaults to all 200+ countries if not provided.
83
- */
84
- countries?: Country[],
85
-
86
- /**
87
- * Currently selected country.
88
- */
89
- selectedCountry?: Country,
90
-
91
- /**
92
- * Callback when a country is selected.
93
- */
94
- onCountryChange?: (country: Country) => void,
95
-
96
- /**
97
- * Add function clear for input.
98
- */
99
- extraClear?: boolean,
100
-
101
- /**
102
- * Function triggered when user clicks on extraClear button.
103
- */
104
- onRemove?: () => void,
105
-
106
- /**
107
- * Property for show checked status in input. Show only if not errorMessage.
108
- */
109
- checked?: boolean,
110
-
111
- /**
112
- * Property for passing a new icon to replace the default checked icon.
113
- */
114
- checkedIcon?: Node,
115
-
116
- /**
117
- * Unique identifier for the input element. Used for accessibility linking.
118
- */
119
- id?: string,
120
-
121
- /**
122
- * Accessible label for screen readers when no visible label is present.
123
- */
124
- "aria-label"?: string,
125
-
126
- /**
127
- * Test identifier for the component.
128
- */
129
- testID?: string,
130
- ...
131
- } & $Diff<InputHTMLAttributes<HTMLInputElement>, { size: any, onChange: any }>;
132
- declare var InputPhone: React.ForwardRefExoticComponent<{
133
- ...InputPhoneProps,
134
- ...React.RefAttributes<HTMLInputElement>,
135
- }>;
136
- declare interface UsePhoneNumberOptions {
137
- /**
138
- * Initial country code (ISO 3166-1 alpha-2, e.g., "US", "MY")
139
- */
140
- initialCountry?: string;
141
-
142
- /**
143
- * Initial phone number value
144
- */
145
- initialValue?: string;
146
-
147
- /**
148
- * Callback when phone number changes
149
- */
150
- onChange?: (phoneNumber: string) => void;
151
-
152
- /**
153
- * Callback when country changes
154
- */
155
- onCountryChange?: (country: Country | void) => void;
156
- }
157
- declare interface UsePhoneNumberReturn {
158
- /**
159
- * Raw phone number (with country code)
160
- */
161
- phoneNumber: string;
162
-
163
- /**
164
- * Formatted phone number for display
165
- */
166
- formattedPhoneNumber: string;
167
-
168
- /**
169
- * Currently detected/selected country
170
- */
171
- country: Country | void;
172
-
173
- /**
174
- * All available countries
175
- */
176
- countries: Country[];
177
-
178
- /**
179
- * Handle phone number input change
180
- */
181
- handlePhoneChange: (value: string) => void;
182
-
183
- /**
184
- * Handle country selection change
185
- */
186
- handleCountryChange: (country: Country) => void;
187
-
188
- /**
189
- * Set phone number programmatically
190
- */
191
- setPhoneNumber: (value: string) => void;
192
- }
193
- /**
194
- * Hook for managing phone number input with formatting and country detection
195
- * @example ```tsx
196
- * const {
197
- * phoneNumber,
198
- * formattedPhoneNumber,
199
- * country,
200
- * countries,
201
- * handlePhoneChange,
202
- * handleCountryChange,
203
- * } = usePhoneNumber({
204
- * initialCountry: "MY",
205
- * onChange: (phone) => console.log("Phone:", phone),
206
- * });
207
- * ```
208
- */
209
- declare var usePhoneNumber: (
210
- options?: UsePhoneNumberOptions
211
- ) => UsePhoneNumberReturn;
212
- /**
213
- * Get flag component for a country code
214
- */
215
- declare var getFlag: (code: string) => React.ReactNode;
216
- /**
217
- * Complete list of all countries with flags
218
- * Sorted alphabetically by name
219
- */
220
- declare var allCountries: Country[];
221
- /**
222
- * Get a country by its ISO code
223
- */
224
- declare var getCountryByCode: (code: string) => Country | void;
225
- /**
226
- * Get a country by its dial code
227
- */
228
- declare var getCountryByDialCode: (dialCode: string) => Country | void;
229
- /**
230
- * Default countries (commonly used)
231
- */
232
- declare var defaultCountries: Country[];
233
- export type {
234
- Country,
235
- InputPhoneProps,
236
- UsePhoneNumberOptions,
237
- UsePhoneNumberReturn,
238
- };
239
- declare export {
240
- InputPhone,
241
- allCountries,
242
- defaultCountries,
243
- getCountryByCode,
244
- getCountryByDialCode,
245
- getFlag,
246
- usePhoneNumber,
247
- };
package/web/index.js.flow DELETED
@@ -1,247 +0,0 @@
1
- /**
2
- * Flowtype definitions for index
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
-
8
- import React, { Node, InputHTMLAttributes } from "react";
9
-
10
- /**
11
- * Country data for phone input
12
- */
13
- declare interface Country {
14
- /**
15
- * ISO 3166-1 alpha-2 country code (e.g., "US", "GB")
16
- */
17
- code: string;
18
-
19
- /**
20
- * Country name
21
- */
22
- name: string;
23
-
24
- /**
25
- * International dial code (e.g., "+1", "+44")
26
- */
27
- dialCode: string;
28
-
29
- /**
30
- * Flag icon component
31
- */
32
- flag?: Node;
33
- }
34
- declare type InputPhoneProps = {
35
- /**
36
- * Property for specifying the value of the control.
37
- */
38
- value?: string,
39
-
40
- /**
41
- * Property for specifying the placeholder of the control.
42
- */
43
- placeholder?: string,
44
-
45
- /**
46
- * Event handler when the value changes (for controlled mode).
47
- */
48
- onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void,
49
-
50
- /**
51
- * Event handler when the text changes (alternative to onChange).
52
- */
53
- onChangeText?: (text: string) => void,
54
-
55
- /**
56
- * Property for changing the size of the input.
57
- */
58
- size?: "xl" | "lg" | "md" | "sm" | "xs",
59
-
60
- /**
61
- * Property for specifying the name of the control.
62
- */
63
- name?: string,
64
-
65
- /**
66
- * Property for disabling the control.
67
- */
68
- disabled?: boolean,
69
-
70
- /**
71
- * Property for displaying an error message and highlighting the control as invalid.
72
- */
73
- errorMessage?: string,
74
-
75
- /**
76
- * Property for displaying an error and highlighting the control as invalid.
77
- */
78
- error?: boolean,
79
-
80
- /**
81
- * Array of countries to display in the dropdown.
82
- * Defaults to all 200+ countries if not provided.
83
- */
84
- countries?: Country[],
85
-
86
- /**
87
- * Currently selected country.
88
- */
89
- selectedCountry?: Country,
90
-
91
- /**
92
- * Callback when a country is selected.
93
- */
94
- onCountryChange?: (country: Country) => void,
95
-
96
- /**
97
- * Add function clear for input.
98
- */
99
- extraClear?: boolean,
100
-
101
- /**
102
- * Function triggered when user clicks on extraClear button.
103
- */
104
- onRemove?: () => void,
105
-
106
- /**
107
- * Property for show checked status in input. Show only if not errorMessage.
108
- */
109
- checked?: boolean,
110
-
111
- /**
112
- * Property for passing a new icon to replace the default checked icon.
113
- */
114
- checkedIcon?: Node,
115
-
116
- /**
117
- * Unique identifier for the input element. Used for accessibility linking.
118
- */
119
- id?: string,
120
-
121
- /**
122
- * Accessible label for screen readers when no visible label is present.
123
- */
124
- "aria-label"?: string,
125
-
126
- /**
127
- * Test identifier for the component.
128
- */
129
- testID?: string,
130
- ...
131
- } & $Diff<InputHTMLAttributes<HTMLInputElement>, { size: any, onChange: any }>;
132
- declare var InputPhone: React.ForwardRefExoticComponent<{
133
- ...InputPhoneProps,
134
- ...React.RefAttributes<HTMLInputElement>,
135
- }>;
136
- declare interface UsePhoneNumberOptions {
137
- /**
138
- * Initial country code (ISO 3166-1 alpha-2, e.g., "US", "MY")
139
- */
140
- initialCountry?: string;
141
-
142
- /**
143
- * Initial phone number value
144
- */
145
- initialValue?: string;
146
-
147
- /**
148
- * Callback when phone number changes
149
- */
150
- onChange?: (phoneNumber: string) => void;
151
-
152
- /**
153
- * Callback when country changes
154
- */
155
- onCountryChange?: (country: Country | void) => void;
156
- }
157
- declare interface UsePhoneNumberReturn {
158
- /**
159
- * Raw phone number (with country code)
160
- */
161
- phoneNumber: string;
162
-
163
- /**
164
- * Formatted phone number for display
165
- */
166
- formattedPhoneNumber: string;
167
-
168
- /**
169
- * Currently detected/selected country
170
- */
171
- country: Country | void;
172
-
173
- /**
174
- * All available countries
175
- */
176
- countries: Country[];
177
-
178
- /**
179
- * Handle phone number input change
180
- */
181
- handlePhoneChange: (value: string) => void;
182
-
183
- /**
184
- * Handle country selection change
185
- */
186
- handleCountryChange: (country: Country) => void;
187
-
188
- /**
189
- * Set phone number programmatically
190
- */
191
- setPhoneNumber: (value: string) => void;
192
- }
193
- /**
194
- * Hook for managing phone number input with formatting and country detection
195
- * @example ```tsx
196
- * const {
197
- * phoneNumber,
198
- * formattedPhoneNumber,
199
- * country,
200
- * countries,
201
- * handlePhoneChange,
202
- * handleCountryChange,
203
- * } = usePhoneNumber({
204
- * initialCountry: "MY",
205
- * onChange: (phone) => console.log("Phone:", phone),
206
- * });
207
- * ```
208
- */
209
- declare var usePhoneNumber: (
210
- options?: UsePhoneNumberOptions
211
- ) => UsePhoneNumberReturn;
212
- /**
213
- * Get flag component for a country code
214
- */
215
- declare var getFlag: (code: string) => React.ReactNode;
216
- /**
217
- * Complete list of all countries with flags
218
- * Sorted alphabetically by name
219
- */
220
- declare var allCountries: Country[];
221
- /**
222
- * Get a country by its ISO code
223
- */
224
- declare var getCountryByCode: (code: string) => Country | void;
225
- /**
226
- * Get a country by its dial code
227
- */
228
- declare var getCountryByDialCode: (dialCode: string) => Country | void;
229
- /**
230
- * Default countries (commonly used)
231
- */
232
- declare var defaultCountries: Country[];
233
- export type {
234
- Country,
235
- InputPhoneProps,
236
- UsePhoneNumberOptions,
237
- UsePhoneNumberReturn,
238
- };
239
- declare export {
240
- InputPhone,
241
- allCountries,
242
- defaultCountries,
243
- getCountryByCode,
244
- getCountryByDialCode,
245
- getFlag,
246
- usePhoneNumber,
247
- };