@alikhalilll/ui 1.0.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/LICENSE +21 -0
- package/README.md +286 -0
- package/dist/index.d.ts +1009 -0
- package/dist/index.mjs +1519 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles.css +74 -0
- package/package.json +81 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1009 @@
|
|
|
1
|
+
import { ClassProp } from 'class-variance-authority/types';
|
|
2
|
+
import { ClassValue } from 'clsx';
|
|
3
|
+
import { ComponentOptionsMixin } from 'vue';
|
|
4
|
+
import { ComponentProvideOptions } from 'vue';
|
|
5
|
+
import { ComputedRef } from 'vue';
|
|
6
|
+
import { DefineComponent } from 'vue';
|
|
7
|
+
import { DialogContentProps } from 'reka-ui';
|
|
8
|
+
import { DialogOverlayProps } from 'reka-ui';
|
|
9
|
+
import { DrawerRootProps } from 'vaul-vue';
|
|
10
|
+
import { DrawerTriggerProps } from 'vaul-vue';
|
|
11
|
+
import { FocusOutsideEvent } from 'reka-ui';
|
|
12
|
+
import { HTMLAttributes } from 'vue';
|
|
13
|
+
import { PointerDownOutsideEvent } from 'reka-ui';
|
|
14
|
+
import { PopoverContentProps } from 'reka-ui';
|
|
15
|
+
import { PopoverRootProps } from 'reka-ui';
|
|
16
|
+
import { PopoverTriggerProps } from 'reka-ui';
|
|
17
|
+
import { PublicProps } from 'vue';
|
|
18
|
+
import { Ref } from 'vue';
|
|
19
|
+
import { VariantProps } from 'class-variance-authority';
|
|
20
|
+
|
|
21
|
+
declare const __VLS_component: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
22
|
+
"update:modelValue": (payload: string | number) => any;
|
|
23
|
+
}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
24
|
+
"onUpdate:modelValue"?: ((payload: string | number) => any) | undefined;
|
|
25
|
+
}>, {
|
|
26
|
+
size: Size;
|
|
27
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
|
|
29
|
+
declare const __VLS_component_10: DefineComponent<__VLS_Props_7, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_7> & Readonly<{}>, {
|
|
30
|
+
sideOffset: number;
|
|
31
|
+
align: "start" | "center" | "end";
|
|
32
|
+
overlay: boolean;
|
|
33
|
+
breakpoint: string;
|
|
34
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
35
|
+
|
|
36
|
+
declare const __VLS_component_11: DefineComponent<__VLS_PublicProps_2, {
|
|
37
|
+
validation: ComputedRef<PhoneValidationResult>;
|
|
38
|
+
required: ComputedRef<PhoneRequiredInfo | null>;
|
|
39
|
+
selectedDialCode: ComputedRef<string | null>;
|
|
40
|
+
validationState: ComputedRef<"error" | "idle" | "valid">;
|
|
41
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
42
|
+
"update:phone": (value: string) => any;
|
|
43
|
+
"update:country": (value: string) => any;
|
|
44
|
+
}, string, PublicProps, Readonly<__VLS_PublicProps_2> & Readonly<{
|
|
45
|
+
"onUpdate:phone"?: ((value: string) => any) | undefined;
|
|
46
|
+
"onUpdate:country"?: ((value: string) => any) | undefined;
|
|
47
|
+
}>, {
|
|
48
|
+
size: ATellInputSize;
|
|
49
|
+
placeholder: string;
|
|
50
|
+
ipEndpoint: string;
|
|
51
|
+
defaultCountry: string;
|
|
52
|
+
detectCountry: DetectionStrategy;
|
|
53
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
54
|
+
|
|
55
|
+
declare const __VLS_component_12: DefineComponent<__VLS_PublicProps_3, {
|
|
56
|
+
open: Ref<boolean, boolean>;
|
|
57
|
+
setOpen: (v: boolean) => boolean;
|
|
58
|
+
search: Ref<string, string>;
|
|
59
|
+
setSearch: (v: string) => string;
|
|
60
|
+
selectedCountry: ComputedRef<CountryOption<RestCountry> | null>;
|
|
61
|
+
selectCountry: typeof selectCountry;
|
|
62
|
+
countries: ComputedRef<CountryOption<RestCountry>[]>;
|
|
63
|
+
recents: Ref<string[], string[]>;
|
|
64
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
65
|
+
"update:selected": (value: string) => any;
|
|
66
|
+
}, string, PublicProps, Readonly<__VLS_PublicProps_3> & Readonly<{
|
|
67
|
+
"onUpdate:selected"?: ((value: string) => any) | undefined;
|
|
68
|
+
}>, {
|
|
69
|
+
size: Size;
|
|
70
|
+
searchPlaceholder: string;
|
|
71
|
+
emptyText: string;
|
|
72
|
+
loadingText: string;
|
|
73
|
+
suggestedLabel: string;
|
|
74
|
+
allCountriesLabel: string;
|
|
75
|
+
suggestedLimit: number;
|
|
76
|
+
maxResults: number;
|
|
77
|
+
kbdOpen: string | null;
|
|
78
|
+
kbdClose: string | null;
|
|
79
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
80
|
+
|
|
81
|
+
declare const __VLS_component_13: DefineComponent<__VLS_Props_10, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_10> & Readonly<{}>, {
|
|
82
|
+
width: number;
|
|
83
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
84
|
+
|
|
85
|
+
declare const __VLS_component_2: DefineComponent<PopoverRootProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
86
|
+
"update:open": (value: boolean) => any;
|
|
87
|
+
}, string, PublicProps, Readonly<PopoverRootProps> & Readonly<{
|
|
88
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
89
|
+
}>, {
|
|
90
|
+
modal: boolean;
|
|
91
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
92
|
+
|
|
93
|
+
declare const __VLS_component_3: DefineComponent<PopoverTriggerProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<PopoverTriggerProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
94
|
+
|
|
95
|
+
declare const __VLS_component_4: DefineComponent<__VLS_Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
96
|
+
escapeKeyDown: (event: KeyboardEvent) => any;
|
|
97
|
+
pointerDownOutside: (event: PointerDownOutsideEvent) => any;
|
|
98
|
+
focusOutside: (event: FocusOutsideEvent) => any;
|
|
99
|
+
interactOutside: (event: PointerDownOutsideEvent | FocusOutsideEvent) => any;
|
|
100
|
+
openAutoFocus: (event: Event) => any;
|
|
101
|
+
closeAutoFocus: (event: Event) => any;
|
|
102
|
+
}, string, PublicProps, Readonly<__VLS_Props_2> & Readonly<{
|
|
103
|
+
onEscapeKeyDown?: ((event: KeyboardEvent) => any) | undefined;
|
|
104
|
+
onPointerDownOutside?: ((event: PointerDownOutsideEvent) => any) | undefined;
|
|
105
|
+
onFocusOutside?: ((event: FocusOutsideEvent) => any) | undefined;
|
|
106
|
+
onInteractOutside?: ((event: PointerDownOutsideEvent | FocusOutsideEvent) => any) | undefined;
|
|
107
|
+
onOpenAutoFocus?: ((event: Event) => any) | undefined;
|
|
108
|
+
onCloseAutoFocus?: ((event: Event) => any) | undefined;
|
|
109
|
+
}>, {
|
|
110
|
+
sideOffset: number;
|
|
111
|
+
align: "start" | "center" | "end";
|
|
112
|
+
overlay: boolean;
|
|
113
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
114
|
+
|
|
115
|
+
declare const __VLS_component_5: DefineComponent<DrawerRootProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
116
|
+
"update:open": (open: boolean) => any;
|
|
117
|
+
animationEnd: (open: boolean) => any;
|
|
118
|
+
drag: (percentageDragged: number) => any;
|
|
119
|
+
release: (open: boolean) => any;
|
|
120
|
+
close: () => any;
|
|
121
|
+
"update:activeSnapPoint": (val: string | number) => any;
|
|
122
|
+
}, string, PublicProps, Readonly<DrawerRootProps> & Readonly<{
|
|
123
|
+
"onUpdate:open"?: ((open: boolean) => any) | undefined;
|
|
124
|
+
onAnimationEnd?: ((open: boolean) => any) | undefined;
|
|
125
|
+
onDrag?: ((percentageDragged: number) => any) | undefined;
|
|
126
|
+
onRelease?: ((open: boolean) => any) | undefined;
|
|
127
|
+
onClose?: (() => any) | undefined;
|
|
128
|
+
"onUpdate:activeSnapPoint"?: ((val: string | number) => any) | undefined;
|
|
129
|
+
}>, {
|
|
130
|
+
shouldScaleBackground: boolean;
|
|
131
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
132
|
+
|
|
133
|
+
declare const __VLS_component_6: DefineComponent<DrawerTriggerProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<DrawerTriggerProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
134
|
+
|
|
135
|
+
declare const __VLS_component_7: DefineComponent<__VLS_Props_3, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
136
|
+
escapeKeyDown: (event: KeyboardEvent) => any;
|
|
137
|
+
pointerDownOutside: (event: PointerDownOutsideEvent) => any;
|
|
138
|
+
focusOutside: (event: FocusOutsideEvent) => any;
|
|
139
|
+
interactOutside: (event: PointerDownOutsideEvent | FocusOutsideEvent) => any;
|
|
140
|
+
openAutoFocus: (event: Event) => any;
|
|
141
|
+
closeAutoFocus: (event: Event) => any;
|
|
142
|
+
}, string, PublicProps, Readonly<__VLS_Props_3> & Readonly<{
|
|
143
|
+
onEscapeKeyDown?: ((event: KeyboardEvent) => any) | undefined;
|
|
144
|
+
onPointerDownOutside?: ((event: PointerDownOutsideEvent) => any) | undefined;
|
|
145
|
+
onFocusOutside?: ((event: FocusOutsideEvent) => any) | undefined;
|
|
146
|
+
onInteractOutside?: ((event: PointerDownOutsideEvent | FocusOutsideEvent) => any) | undefined;
|
|
147
|
+
onOpenAutoFocus?: ((event: Event) => any) | undefined;
|
|
148
|
+
onCloseAutoFocus?: ((event: Event) => any) | undefined;
|
|
149
|
+
}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
150
|
+
|
|
151
|
+
declare const __VLS_component_8: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
152
|
+
"update:open": (value: boolean) => any;
|
|
153
|
+
}, string, PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
154
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
155
|
+
}>, {
|
|
156
|
+
modal: boolean;
|
|
157
|
+
breakpoint: string;
|
|
158
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
159
|
+
|
|
160
|
+
declare const __VLS_component_9: DefineComponent<__VLS_Props_6, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_6> & Readonly<{}>, {
|
|
161
|
+
breakpoint: string;
|
|
162
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
163
|
+
|
|
164
|
+
declare type __VLS_Props = {
|
|
165
|
+
defaultValue?: string | number;
|
|
166
|
+
modelValue?: string | number;
|
|
167
|
+
class?: HTMLAttributes['class'];
|
|
168
|
+
/** Classes for the inner <input> element (useful when prefix/suffix are present). */
|
|
169
|
+
inputClass?: HTMLAttributes['class'];
|
|
170
|
+
/** Classes for the prefix wrapper. */
|
|
171
|
+
prefixClass?: HTMLAttributes['class'];
|
|
172
|
+
/** Classes for the suffix wrapper. */
|
|
173
|
+
suffixClass?: HTMLAttributes['class'];
|
|
174
|
+
size?: Size;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
declare type __VLS_Props_10 = {
|
|
178
|
+
/** ISO 3166-1 alpha-2 country code, case-insensitive. */
|
|
179
|
+
iso2: string;
|
|
180
|
+
/** Pixel width served by flagcdn. 40 is crisp at retina up to ~24px wide. */
|
|
181
|
+
width?: number;
|
|
182
|
+
/** Optional explicit URL override. When set, `iso2` / `width` / `flagUrl` are ignored. */
|
|
183
|
+
src?: string | null;
|
|
184
|
+
/** Function `(iso2, width) => string` — fully replace the URL builder. */
|
|
185
|
+
flagUrl?: FlagUrlBuilder;
|
|
186
|
+
alt?: string;
|
|
187
|
+
class?: HTMLAttributes['class'];
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
declare type __VLS_Props_2 = PopoverContentProps & {
|
|
191
|
+
class?: HTMLAttributes['class'];
|
|
192
|
+
/** Render a dimmed, clickable backdrop behind the popover. Pair with `<APopover modal>`. */
|
|
193
|
+
overlay?: boolean;
|
|
194
|
+
overlayClass?: HTMLAttributes['class'];
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
declare type __VLS_Props_3 = DialogContentProps & {
|
|
198
|
+
class?: HTMLAttributes['class'];
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
declare type __VLS_Props_4 = DialogOverlayProps & {
|
|
202
|
+
class?: HTMLAttributes['class'];
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
declare type __VLS_Props_5 = {
|
|
206
|
+
/** CSS media query for the desktop break. Below this width we render a vaul drawer. */
|
|
207
|
+
breakpoint?: string;
|
|
208
|
+
/**
|
|
209
|
+
* When true, the popover (desktop) locks page scroll, traps focus, and renders an overlay.
|
|
210
|
+
* The drawer (mobile) is always modal-like (vaul-vue ships its own overlay + scroll-lock).
|
|
211
|
+
*/
|
|
212
|
+
modal?: boolean;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
declare type __VLS_Props_6 = {
|
|
216
|
+
breakpoint?: string;
|
|
217
|
+
asChild?: boolean;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
declare type __VLS_Props_7 = {
|
|
221
|
+
breakpoint?: string;
|
|
222
|
+
/** Classes applied on both branches. Avoid width / inset classes here. */
|
|
223
|
+
class?: HTMLAttributes['class'];
|
|
224
|
+
/** Classes applied only when the popover (desktop) branch is rendered. */
|
|
225
|
+
popoverClass?: HTMLAttributes['class'];
|
|
226
|
+
/** Classes applied only when the drawer (mobile) branch is rendered. */
|
|
227
|
+
drawerClass?: HTMLAttributes['class'];
|
|
228
|
+
/**
|
|
229
|
+
* Render the dimmed overlay on the desktop popover branch. Defaults to `false` — popovers
|
|
230
|
+
* on desktop are non-modal-looking by convention. The mobile drawer always has its own
|
|
231
|
+
* overlay (vaul-vue's `DrawerOverlay`) regardless of this prop.
|
|
232
|
+
*/
|
|
233
|
+
overlay?: boolean;
|
|
234
|
+
align?: 'start' | 'center' | 'end';
|
|
235
|
+
sideOffset?: number;
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
declare type __VLS_Props_8 = ExtendedProps;
|
|
239
|
+
|
|
240
|
+
declare type __VLS_Props_9 = {
|
|
241
|
+
class?: HTMLAttributes['class'];
|
|
242
|
+
triggerClass?: HTMLAttributes['class'];
|
|
243
|
+
contentClass?: HTMLAttributes['class'];
|
|
244
|
+
popoverClass?: HTMLAttributes['class'];
|
|
245
|
+
drawerClass?: HTMLAttributes['class'];
|
|
246
|
+
searchPlaceholder?: string;
|
|
247
|
+
emptyText?: string;
|
|
248
|
+
loadingText?: string;
|
|
249
|
+
suggestedLabel?: string;
|
|
250
|
+
allCountriesLabel?: string;
|
|
251
|
+
/** ISO2 codes that are selectable. Others are listed but disabled. */
|
|
252
|
+
allowedDialCodes?: string[];
|
|
253
|
+
disabled?: boolean;
|
|
254
|
+
/** Drives the trigger button padding + text size. Matches ATellInput's `size`. */
|
|
255
|
+
size?: Size;
|
|
256
|
+
/** Max items rendered under the "Suggested" header (current + recents, deduped). */
|
|
257
|
+
suggestedLimit?: number;
|
|
258
|
+
/** Cap the number of matching countries shown in search results. */
|
|
259
|
+
maxResults?: number;
|
|
260
|
+
/** Override the flag URL builder, e.g. `(iso, w) => \`/flags/${iso}.svg\``. */
|
|
261
|
+
flagUrl?: (iso2: string, width: number) => string;
|
|
262
|
+
/**
|
|
263
|
+
* Custom search predicate. Default: substring match on the precomputed `search_key`.
|
|
264
|
+
* Return `true` to keep the country in results.
|
|
265
|
+
*/
|
|
266
|
+
searcher?: (query: string, country: CountryOption) => boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Provide your own country list (bypasses the REST Countries fetch). Useful when you
|
|
269
|
+
* already have a curated subset, an i18n'd list, or want to avoid the network call.
|
|
270
|
+
*/
|
|
271
|
+
countries?: CountryOption[];
|
|
272
|
+
/** Override the right-side kbd hints. Pass `null` to hide. */
|
|
273
|
+
kbdOpen?: string | null;
|
|
274
|
+
kbdClose?: string | null;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
declare type __VLS_PublicProps = {
|
|
278
|
+
'open'?: boolean;
|
|
279
|
+
} & __VLS_Props_5;
|
|
280
|
+
|
|
281
|
+
declare type __VLS_PublicProps_2 = {
|
|
282
|
+
'phone'?: string;
|
|
283
|
+
'country'?: string;
|
|
284
|
+
} & __VLS_Props_8;
|
|
285
|
+
|
|
286
|
+
declare type __VLS_PublicProps_3 = {
|
|
287
|
+
'selected'?: string;
|
|
288
|
+
} & __VLS_Props_9;
|
|
289
|
+
|
|
290
|
+
declare function __VLS_template(): {
|
|
291
|
+
attrs: Partial<{}>;
|
|
292
|
+
slots: Readonly<{
|
|
293
|
+
/** Content rendered inside the input's border, left of the field. */
|
|
294
|
+
prefix?: () => unknown;
|
|
295
|
+
/** Content rendered inside the input's border, right of the field. */
|
|
296
|
+
suffix?: () => unknown;
|
|
297
|
+
}> & {
|
|
298
|
+
/** Content rendered inside the input's border, left of the field. */
|
|
299
|
+
prefix?: () => unknown;
|
|
300
|
+
/** Content rendered inside the input's border, right of the field. */
|
|
301
|
+
suffix?: () => unknown;
|
|
302
|
+
};
|
|
303
|
+
refs: {};
|
|
304
|
+
rootEl: any;
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
declare function __VLS_template_10(): {
|
|
308
|
+
attrs: Partial<{}>;
|
|
309
|
+
slots: {
|
|
310
|
+
default?(_: {}): any;
|
|
311
|
+
default?(_: {}): any;
|
|
312
|
+
};
|
|
313
|
+
refs: {};
|
|
314
|
+
rootEl: any;
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
declare function __VLS_template_11(): {
|
|
318
|
+
attrs: Partial<{}>;
|
|
319
|
+
slots: Readonly<{
|
|
320
|
+
/** Content before the country select trigger (e.g. an icon). */
|
|
321
|
+
prefix?: () => unknown;
|
|
322
|
+
/** Content between the input and the validation icons. */
|
|
323
|
+
suffix?: (props: {
|
|
324
|
+
validationState: "idle" | "valid" | "error";
|
|
325
|
+
validation: PhoneValidationResult;
|
|
326
|
+
}) => unknown;
|
|
327
|
+
/** Replace the green check shown when the number validates. */
|
|
328
|
+
'valid-icon'?: () => unknown;
|
|
329
|
+
/** Replace the warning icon shown when the number fails validation. */
|
|
330
|
+
'error-icon'?: (props: {
|
|
331
|
+
reason: string;
|
|
332
|
+
}) => unknown;
|
|
333
|
+
/** Replace the dim helper line shown below the input when empty. */
|
|
334
|
+
hint?: (props: {
|
|
335
|
+
country: string;
|
|
336
|
+
formatHint: string;
|
|
337
|
+
example: string | null;
|
|
338
|
+
}) => unknown;
|
|
339
|
+
/** Replace the error message rendered when invalid. */
|
|
340
|
+
error?: (props: {
|
|
341
|
+
message: string;
|
|
342
|
+
reason: string;
|
|
343
|
+
validation: PhoneValidationResult;
|
|
344
|
+
}) => unknown;
|
|
345
|
+
/** Forwarded to ACountrySelect — replace the trigger button. */
|
|
346
|
+
trigger?: (props: {
|
|
347
|
+
selectedCountry: CountryOption | null;
|
|
348
|
+
open: boolean;
|
|
349
|
+
sizeClasses: string;
|
|
350
|
+
}) => unknown;
|
|
351
|
+
/** Forwarded to ACountrySelect — replace the chevron. */
|
|
352
|
+
chevron?: (props: {
|
|
353
|
+
open: boolean;
|
|
354
|
+
}) => unknown;
|
|
355
|
+
/** Forwarded — replace any flag rendering. */
|
|
356
|
+
flag?: (props: {
|
|
357
|
+
country: CountryOption;
|
|
358
|
+
context: "trigger" | "item";
|
|
359
|
+
}) => unknown;
|
|
360
|
+
/** Forwarded — replace each country list row. */
|
|
361
|
+
item?: (props: {
|
|
362
|
+
country: CountryOption;
|
|
363
|
+
selected: boolean;
|
|
364
|
+
disabled: boolean;
|
|
365
|
+
select: () => void;
|
|
366
|
+
}) => unknown;
|
|
367
|
+
/** Forwarded — section header. */
|
|
368
|
+
'group-header'?: (props: {
|
|
369
|
+
label: string;
|
|
370
|
+
group: "suggested" | "all";
|
|
371
|
+
}) => unknown;
|
|
372
|
+
/** Forwarded — search bar. */
|
|
373
|
+
search?: (props: {
|
|
374
|
+
value: string;
|
|
375
|
+
setValue: (v: string) => void;
|
|
376
|
+
isSearching: boolean;
|
|
377
|
+
}) => unknown;
|
|
378
|
+
loading?: () => unknown;
|
|
379
|
+
empty?: (props: {
|
|
380
|
+
query: string;
|
|
381
|
+
}) => unknown;
|
|
382
|
+
}> & {
|
|
383
|
+
/** Content before the country select trigger (e.g. an icon). */
|
|
384
|
+
prefix?: () => unknown;
|
|
385
|
+
/** Content between the input and the validation icons. */
|
|
386
|
+
suffix?: (props: {
|
|
387
|
+
validationState: "idle" | "valid" | "error";
|
|
388
|
+
validation: PhoneValidationResult;
|
|
389
|
+
}) => unknown;
|
|
390
|
+
/** Replace the green check shown when the number validates. */
|
|
391
|
+
'valid-icon'?: () => unknown;
|
|
392
|
+
/** Replace the warning icon shown when the number fails validation. */
|
|
393
|
+
'error-icon'?: (props: {
|
|
394
|
+
reason: string;
|
|
395
|
+
}) => unknown;
|
|
396
|
+
/** Replace the dim helper line shown below the input when empty. */
|
|
397
|
+
hint?: (props: {
|
|
398
|
+
country: string;
|
|
399
|
+
formatHint: string;
|
|
400
|
+
example: string | null;
|
|
401
|
+
}) => unknown;
|
|
402
|
+
/** Replace the error message rendered when invalid. */
|
|
403
|
+
error?: (props: {
|
|
404
|
+
message: string;
|
|
405
|
+
reason: string;
|
|
406
|
+
validation: PhoneValidationResult;
|
|
407
|
+
}) => unknown;
|
|
408
|
+
/** Forwarded to ACountrySelect — replace the trigger button. */
|
|
409
|
+
trigger?: (props: {
|
|
410
|
+
selectedCountry: CountryOption | null;
|
|
411
|
+
open: boolean;
|
|
412
|
+
sizeClasses: string;
|
|
413
|
+
}) => unknown;
|
|
414
|
+
/** Forwarded to ACountrySelect — replace the chevron. */
|
|
415
|
+
chevron?: (props: {
|
|
416
|
+
open: boolean;
|
|
417
|
+
}) => unknown;
|
|
418
|
+
/** Forwarded — replace any flag rendering. */
|
|
419
|
+
flag?: (props: {
|
|
420
|
+
country: CountryOption;
|
|
421
|
+
context: "trigger" | "item";
|
|
422
|
+
}) => unknown;
|
|
423
|
+
/** Forwarded — replace each country list row. */
|
|
424
|
+
item?: (props: {
|
|
425
|
+
country: CountryOption;
|
|
426
|
+
selected: boolean;
|
|
427
|
+
disabled: boolean;
|
|
428
|
+
select: () => void;
|
|
429
|
+
}) => unknown;
|
|
430
|
+
/** Forwarded — section header. */
|
|
431
|
+
'group-header'?: (props: {
|
|
432
|
+
label: string;
|
|
433
|
+
group: "suggested" | "all";
|
|
434
|
+
}) => unknown;
|
|
435
|
+
/** Forwarded — search bar. */
|
|
436
|
+
search?: (props: {
|
|
437
|
+
value: string;
|
|
438
|
+
setValue: (v: string) => void;
|
|
439
|
+
isSearching: boolean;
|
|
440
|
+
}) => unknown;
|
|
441
|
+
loading?: () => unknown;
|
|
442
|
+
empty?: (props: {
|
|
443
|
+
query: string;
|
|
444
|
+
}) => unknown;
|
|
445
|
+
};
|
|
446
|
+
refs: {};
|
|
447
|
+
rootEl: HTMLDivElement;
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
declare function __VLS_template_12(): {
|
|
451
|
+
attrs: Partial<{}>;
|
|
452
|
+
slots: Readonly<{
|
|
453
|
+
/** Replace the entire country picker trigger button. */
|
|
454
|
+
trigger?: (props: {
|
|
455
|
+
selectedCountry: CountryOption | null;
|
|
456
|
+
open: boolean;
|
|
457
|
+
sizeClasses: string;
|
|
458
|
+
}) => unknown;
|
|
459
|
+
/** Replace the chevron icon. */
|
|
460
|
+
chevron?: (props: {
|
|
461
|
+
open: boolean;
|
|
462
|
+
}) => unknown;
|
|
463
|
+
/** Replace just the flag rendered in the trigger and items. */
|
|
464
|
+
flag?: (props: {
|
|
465
|
+
country: CountryOption;
|
|
466
|
+
context: "trigger" | "item";
|
|
467
|
+
}) => unknown;
|
|
468
|
+
/** Replace the entire search bar (input + icon + kbd). */
|
|
469
|
+
search?: (props: {
|
|
470
|
+
value: string;
|
|
471
|
+
setValue: (v: string) => void;
|
|
472
|
+
isSearching: boolean;
|
|
473
|
+
}) => unknown;
|
|
474
|
+
/** Replace the search-bar leading icon. */
|
|
475
|
+
'search-icon'?: () => unknown;
|
|
476
|
+
/** Replace the loading state. */
|
|
477
|
+
loading?: () => unknown;
|
|
478
|
+
/** Replace the empty/no-results state. */
|
|
479
|
+
empty?: (props: {
|
|
480
|
+
query: string;
|
|
481
|
+
}) => unknown;
|
|
482
|
+
/** Replace a section header. */
|
|
483
|
+
'group-header'?: (props: {
|
|
484
|
+
label: string;
|
|
485
|
+
group: "suggested" | "all";
|
|
486
|
+
}) => unknown;
|
|
487
|
+
/** Replace each country list row. Default render still available via <ACountrySelectItem />. */
|
|
488
|
+
item?: (props: {
|
|
489
|
+
country: CountryOption;
|
|
490
|
+
selected: boolean;
|
|
491
|
+
disabled: boolean;
|
|
492
|
+
select: () => void;
|
|
493
|
+
}) => unknown;
|
|
494
|
+
/** Replace just the right-side check icon for the selected row. */
|
|
495
|
+
'item-check'?: (props: {
|
|
496
|
+
country: CountryOption;
|
|
497
|
+
}) => unknown;
|
|
498
|
+
}> & {
|
|
499
|
+
/** Replace the entire country picker trigger button. */
|
|
500
|
+
trigger?: (props: {
|
|
501
|
+
selectedCountry: CountryOption | null;
|
|
502
|
+
open: boolean;
|
|
503
|
+
sizeClasses: string;
|
|
504
|
+
}) => unknown;
|
|
505
|
+
/** Replace the chevron icon. */
|
|
506
|
+
chevron?: (props: {
|
|
507
|
+
open: boolean;
|
|
508
|
+
}) => unknown;
|
|
509
|
+
/** Replace just the flag rendered in the trigger and items. */
|
|
510
|
+
flag?: (props: {
|
|
511
|
+
country: CountryOption;
|
|
512
|
+
context: "trigger" | "item";
|
|
513
|
+
}) => unknown;
|
|
514
|
+
/** Replace the entire search bar (input + icon + kbd). */
|
|
515
|
+
search?: (props: {
|
|
516
|
+
value: string;
|
|
517
|
+
setValue: (v: string) => void;
|
|
518
|
+
isSearching: boolean;
|
|
519
|
+
}) => unknown;
|
|
520
|
+
/** Replace the search-bar leading icon. */
|
|
521
|
+
'search-icon'?: () => unknown;
|
|
522
|
+
/** Replace the loading state. */
|
|
523
|
+
loading?: () => unknown;
|
|
524
|
+
/** Replace the empty/no-results state. */
|
|
525
|
+
empty?: (props: {
|
|
526
|
+
query: string;
|
|
527
|
+
}) => unknown;
|
|
528
|
+
/** Replace a section header. */
|
|
529
|
+
'group-header'?: (props: {
|
|
530
|
+
label: string;
|
|
531
|
+
group: "suggested" | "all";
|
|
532
|
+
}) => unknown;
|
|
533
|
+
/** Replace each country list row. Default render still available via <ACountrySelectItem />. */
|
|
534
|
+
item?: (props: {
|
|
535
|
+
country: CountryOption;
|
|
536
|
+
selected: boolean;
|
|
537
|
+
disabled: boolean;
|
|
538
|
+
select: () => void;
|
|
539
|
+
}) => unknown;
|
|
540
|
+
/** Replace just the right-side check icon for the selected row. */
|
|
541
|
+
'item-check'?: (props: {
|
|
542
|
+
country: CountryOption;
|
|
543
|
+
}) => unknown;
|
|
544
|
+
};
|
|
545
|
+
refs: {};
|
|
546
|
+
rootEl: any;
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
declare function __VLS_template_13(): {
|
|
550
|
+
attrs: Partial<{}>;
|
|
551
|
+
slots: {
|
|
552
|
+
empty?(_: {}): any;
|
|
553
|
+
};
|
|
554
|
+
refs: {};
|
|
555
|
+
rootEl: any;
|
|
556
|
+
};
|
|
557
|
+
|
|
558
|
+
declare function __VLS_template_2(): {
|
|
559
|
+
attrs: Partial<{}>;
|
|
560
|
+
slots: {
|
|
561
|
+
default?(_: {
|
|
562
|
+
open: boolean;
|
|
563
|
+
close: () => void;
|
|
564
|
+
}): any;
|
|
565
|
+
};
|
|
566
|
+
refs: {};
|
|
567
|
+
rootEl: any;
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
declare function __VLS_template_3(): {
|
|
571
|
+
attrs: Partial<{}>;
|
|
572
|
+
slots: {
|
|
573
|
+
default?(_: {}): any;
|
|
574
|
+
};
|
|
575
|
+
refs: {};
|
|
576
|
+
rootEl: any;
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
declare function __VLS_template_4(): {
|
|
580
|
+
attrs: Partial<{}>;
|
|
581
|
+
slots: {
|
|
582
|
+
default?(_: {}): any;
|
|
583
|
+
};
|
|
584
|
+
refs: {};
|
|
585
|
+
rootEl: any;
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
declare function __VLS_template_5(): {
|
|
589
|
+
attrs: Partial<{}>;
|
|
590
|
+
slots: {
|
|
591
|
+
default?(_: {}): any;
|
|
592
|
+
};
|
|
593
|
+
refs: {};
|
|
594
|
+
rootEl: any;
|
|
595
|
+
};
|
|
596
|
+
|
|
597
|
+
declare function __VLS_template_6(): {
|
|
598
|
+
attrs: Partial<{}>;
|
|
599
|
+
slots: {
|
|
600
|
+
default?(_: {}): any;
|
|
601
|
+
};
|
|
602
|
+
refs: {};
|
|
603
|
+
rootEl: any;
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
declare function __VLS_template_7(): {
|
|
607
|
+
attrs: Partial<{}>;
|
|
608
|
+
slots: {
|
|
609
|
+
default?(_: {}): any;
|
|
610
|
+
};
|
|
611
|
+
refs: {};
|
|
612
|
+
rootEl: any;
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
declare function __VLS_template_8(): {
|
|
616
|
+
attrs: Partial<{}>;
|
|
617
|
+
slots: {
|
|
618
|
+
default?(_: {
|
|
619
|
+
isDesktop: boolean;
|
|
620
|
+
}): any;
|
|
621
|
+
};
|
|
622
|
+
refs: {};
|
|
623
|
+
rootEl: any;
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
declare function __VLS_template_9(): {
|
|
627
|
+
attrs: Partial<{}>;
|
|
628
|
+
slots: {
|
|
629
|
+
default?(_: {}): any;
|
|
630
|
+
};
|
|
631
|
+
refs: {};
|
|
632
|
+
rootEl: any;
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
636
|
+
|
|
637
|
+
declare type __VLS_TemplateResult_10 = ReturnType<typeof __VLS_template_10>;
|
|
638
|
+
|
|
639
|
+
declare type __VLS_TemplateResult_11 = ReturnType<typeof __VLS_template_11>;
|
|
640
|
+
|
|
641
|
+
declare type __VLS_TemplateResult_12 = ReturnType<typeof __VLS_template_12>;
|
|
642
|
+
|
|
643
|
+
declare type __VLS_TemplateResult_13 = ReturnType<typeof __VLS_template_13>;
|
|
644
|
+
|
|
645
|
+
declare type __VLS_TemplateResult_2 = ReturnType<typeof __VLS_template_2>;
|
|
646
|
+
|
|
647
|
+
declare type __VLS_TemplateResult_3 = ReturnType<typeof __VLS_template_3>;
|
|
648
|
+
|
|
649
|
+
declare type __VLS_TemplateResult_4 = ReturnType<typeof __VLS_template_4>;
|
|
650
|
+
|
|
651
|
+
declare type __VLS_TemplateResult_5 = ReturnType<typeof __VLS_template_5>;
|
|
652
|
+
|
|
653
|
+
declare type __VLS_TemplateResult_6 = ReturnType<typeof __VLS_template_6>;
|
|
654
|
+
|
|
655
|
+
declare type __VLS_TemplateResult_7 = ReturnType<typeof __VLS_template_7>;
|
|
656
|
+
|
|
657
|
+
declare type __VLS_TemplateResult_8 = ReturnType<typeof __VLS_template_8>;
|
|
658
|
+
|
|
659
|
+
declare type __VLS_TemplateResult_9 = ReturnType<typeof __VLS_template_9>;
|
|
660
|
+
|
|
661
|
+
declare type __VLS_WithTemplateSlots<T, S> = T & {
|
|
662
|
+
new (): {
|
|
663
|
+
$slots: S;
|
|
664
|
+
};
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
declare type __VLS_WithTemplateSlots_10<T, S> = T & {
|
|
668
|
+
new (): {
|
|
669
|
+
$slots: S;
|
|
670
|
+
};
|
|
671
|
+
};
|
|
672
|
+
|
|
673
|
+
declare type __VLS_WithTemplateSlots_11<T, S> = T & {
|
|
674
|
+
new (): {
|
|
675
|
+
$slots: S;
|
|
676
|
+
};
|
|
677
|
+
};
|
|
678
|
+
|
|
679
|
+
declare type __VLS_WithTemplateSlots_12<T, S> = T & {
|
|
680
|
+
new (): {
|
|
681
|
+
$slots: S;
|
|
682
|
+
};
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
declare type __VLS_WithTemplateSlots_13<T, S> = T & {
|
|
686
|
+
new (): {
|
|
687
|
+
$slots: S;
|
|
688
|
+
};
|
|
689
|
+
};
|
|
690
|
+
|
|
691
|
+
declare type __VLS_WithTemplateSlots_2<T, S> = T & {
|
|
692
|
+
new (): {
|
|
693
|
+
$slots: S;
|
|
694
|
+
};
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
declare type __VLS_WithTemplateSlots_3<T, S> = T & {
|
|
698
|
+
new (): {
|
|
699
|
+
$slots: S;
|
|
700
|
+
};
|
|
701
|
+
};
|
|
702
|
+
|
|
703
|
+
declare type __VLS_WithTemplateSlots_4<T, S> = T & {
|
|
704
|
+
new (): {
|
|
705
|
+
$slots: S;
|
|
706
|
+
};
|
|
707
|
+
};
|
|
708
|
+
|
|
709
|
+
declare type __VLS_WithTemplateSlots_5<T, S> = T & {
|
|
710
|
+
new (): {
|
|
711
|
+
$slots: S;
|
|
712
|
+
};
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
declare type __VLS_WithTemplateSlots_6<T, S> = T & {
|
|
716
|
+
new (): {
|
|
717
|
+
$slots: S;
|
|
718
|
+
};
|
|
719
|
+
};
|
|
720
|
+
|
|
721
|
+
declare type __VLS_WithTemplateSlots_7<T, S> = T & {
|
|
722
|
+
new (): {
|
|
723
|
+
$slots: S;
|
|
724
|
+
};
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
declare type __VLS_WithTemplateSlots_8<T, S> = T & {
|
|
728
|
+
new (): {
|
|
729
|
+
$slots: S;
|
|
730
|
+
};
|
|
731
|
+
};
|
|
732
|
+
|
|
733
|
+
declare type __VLS_WithTemplateSlots_9<T, S> = T & {
|
|
734
|
+
new (): {
|
|
735
|
+
$slots: S;
|
|
736
|
+
};
|
|
737
|
+
};
|
|
738
|
+
|
|
739
|
+
export declare const ACountryFlag: __VLS_WithTemplateSlots_13<typeof __VLS_component_13, __VLS_TemplateResult_13["slots"]>;
|
|
740
|
+
|
|
741
|
+
export declare const ACountrySelect: __VLS_WithTemplateSlots_12<typeof __VLS_component_12, __VLS_TemplateResult_12["slots"]>;
|
|
742
|
+
|
|
743
|
+
export declare const ADrawer: __VLS_WithTemplateSlots_5<typeof __VLS_component_5, __VLS_TemplateResult_5["slots"]>;
|
|
744
|
+
|
|
745
|
+
export declare const ADrawerContent: __VLS_WithTemplateSlots_7<typeof __VLS_component_7, __VLS_TemplateResult_7["slots"]>;
|
|
746
|
+
|
|
747
|
+
export declare const ADrawerOverlay: DefineComponent<__VLS_Props_4, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_4> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
748
|
+
|
|
749
|
+
export declare const ADrawerTrigger: __VLS_WithTemplateSlots_6<typeof __VLS_component_6, __VLS_TemplateResult_6["slots"]>;
|
|
750
|
+
|
|
751
|
+
export declare const AInput: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
752
|
+
|
|
753
|
+
export declare const APopover: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
|
|
754
|
+
|
|
755
|
+
export declare const APopoverContent: __VLS_WithTemplateSlots_4<typeof __VLS_component_4, __VLS_TemplateResult_4["slots"]>;
|
|
756
|
+
|
|
757
|
+
export declare const APopoverTrigger: __VLS_WithTemplateSlots_3<typeof __VLS_component_3, __VLS_TemplateResult_3["slots"]>;
|
|
758
|
+
|
|
759
|
+
export declare const AResponsivePopover: __VLS_WithTemplateSlots_8<typeof __VLS_component_8, __VLS_TemplateResult_8["slots"]>;
|
|
760
|
+
|
|
761
|
+
export declare const AResponsivePopoverContent: __VLS_WithTemplateSlots_10<typeof __VLS_component_10, __VLS_TemplateResult_10["slots"]>;
|
|
762
|
+
|
|
763
|
+
export declare const AResponsivePopoverTrigger: __VLS_WithTemplateSlots_9<typeof __VLS_component_9, __VLS_TemplateResult_9["slots"]>;
|
|
764
|
+
|
|
765
|
+
export declare const ATellInput: __VLS_WithTemplateSlots_11<typeof __VLS_component_11, __VLS_TemplateResult_11["slots"]>;
|
|
766
|
+
|
|
767
|
+
export declare interface ATellInputProps {
|
|
768
|
+
class?: HTMLAttributes['class'];
|
|
769
|
+
placeholder?: string;
|
|
770
|
+
disabled?: boolean;
|
|
771
|
+
loading?: boolean;
|
|
772
|
+
size?: ATellInputSize;
|
|
773
|
+
/**
|
|
774
|
+
* Whitelist of allowed dial-digit codes (no `+`), e.g. `['20', '966']`.
|
|
775
|
+
* Countries outside this list are still shown in the picker but rendered as disabled.
|
|
776
|
+
*/
|
|
777
|
+
allowedDialCodes?: string[];
|
|
778
|
+
/** Show validation error text beneath the input when invalid. */
|
|
779
|
+
showValidation?: boolean;
|
|
780
|
+
/**
|
|
781
|
+
* Country auto-detect strategy. Defaults to `'auto'` — try IP geolocation first, then
|
|
782
|
+
* timezone, then `navigator.language`, finally `defaultCountry`.
|
|
783
|
+
*/
|
|
784
|
+
detectCountry?: DetectionStrategy;
|
|
785
|
+
/** Fallback ISO2 when detection fails or is disabled. */
|
|
786
|
+
defaultCountry?: string;
|
|
787
|
+
/** Override the IP geolocation endpoint. Must return JSON with `country_code` or `country`. */
|
|
788
|
+
ipEndpoint?: string;
|
|
789
|
+
/** Localized strings for the country picker UI. */
|
|
790
|
+
searchPlaceholder?: string;
|
|
791
|
+
emptyText?: string;
|
|
792
|
+
loadingText?: string;
|
|
793
|
+
/** Error labels keyed by reason. Each gets a sensible English default. */
|
|
794
|
+
errorMessages?: Partial<Record<PhoneValidationReason, string>>;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
/** Alias for the shared `Size` scale — kept for backwards-friendly naming. */
|
|
798
|
+
export declare type ATellInputSize = Size;
|
|
799
|
+
|
|
800
|
+
export declare type ATellInputVariants = VariantProps<typeof aTellInputVariants>;
|
|
801
|
+
|
|
802
|
+
export declare const aTellInputVariants: (props?: ({
|
|
803
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
804
|
+
} & ClassProp) | undefined) => string;
|
|
805
|
+
|
|
806
|
+
export declare function cn(...inputs: ClassValue[]): string;
|
|
807
|
+
|
|
808
|
+
/** Tailwind height utility per size. md uses an arbitrary value because 43px isn't on the spacing scale. */
|
|
809
|
+
export declare const controlHeight: Record<Size, string>;
|
|
810
|
+
|
|
811
|
+
/** Pixel values exposed so non-template code (icons, ResizeObserver, etc.) can read the height. */
|
|
812
|
+
export declare const controlHeightPx: Record<Size, number>;
|
|
813
|
+
|
|
814
|
+
export declare const controlPaddingX: Record<Size, string>;
|
|
815
|
+
|
|
816
|
+
export declare const controlTextSize: Record<Size, string>;
|
|
817
|
+
|
|
818
|
+
export declare interface CountryOption<T = RestCountry> {
|
|
819
|
+
/** Display label, e.g. "Egypt (+20)". */
|
|
820
|
+
label: string;
|
|
821
|
+
/** Stable unique ID — the ISO 3166-1 alpha-2 code, e.g. "EG". */
|
|
822
|
+
value: string;
|
|
823
|
+
/** Precomputed normalized string for fast substring search. */
|
|
824
|
+
search_key: string;
|
|
825
|
+
raw_data: {
|
|
826
|
+
iso2: string;
|
|
827
|
+
dial_code: string;
|
|
828
|
+
dial_digits: string;
|
|
829
|
+
name: string;
|
|
830
|
+
flag: string | null;
|
|
831
|
+
source: 'restcountries' | 'fallback';
|
|
832
|
+
original: T;
|
|
833
|
+
};
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
export declare const DEFAULT_ERROR_MESSAGES: Record<PhoneValidationReason, string>;
|
|
837
|
+
|
|
838
|
+
export declare const DEFAULT_SIZE: Size;
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* Default flag URL builder — flagcdn.com hosts PNG flags at multiple widths and is
|
|
842
|
+
* generous with caching + no API key required. Swap via the `flagUrl` prop on
|
|
843
|
+
* ATellInput / ACountrySelect / ACountryFlag to use any other source.
|
|
844
|
+
*/
|
|
845
|
+
export declare function defaultFlagUrl(iso2: string, width?: number): string;
|
|
846
|
+
|
|
847
|
+
/**
|
|
848
|
+
* Imperative API. Use this when you want to call detection from outside Vue (e.g. inside a
|
|
849
|
+
* non-component composable, server middleware, or unit test).
|
|
850
|
+
*/
|
|
851
|
+
export declare function detectCountry(opts?: DetectCountryOptions): Promise<string>;
|
|
852
|
+
|
|
853
|
+
export declare interface DetectCountryOptions {
|
|
854
|
+
/**
|
|
855
|
+
* - `'auto'` — try IP geolocation first, then timezone, then `navigator.language`, then default.
|
|
856
|
+
* - `'locale'` — skip the network call, use timezone + locale only.
|
|
857
|
+
* - `'none'` — return `defaultCountry` immediately.
|
|
858
|
+
*/
|
|
859
|
+
strategy?: DetectionStrategy;
|
|
860
|
+
/** Endpoint returning a JSON body with a `country_code` (or `country`) field. */
|
|
861
|
+
ipEndpoint?: string;
|
|
862
|
+
/** Fallback ISO2 used when every step fails. */
|
|
863
|
+
defaultCountry?: string;
|
|
864
|
+
/** Abort the IP request after this many ms. */
|
|
865
|
+
timeoutMs?: number;
|
|
866
|
+
/** Persist the resolved country in sessionStorage so re-mounts within the session skip detection. */
|
|
867
|
+
cache?: boolean;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
export declare type DetectionStrategy = 'auto' | 'locale' | 'none';
|
|
871
|
+
|
|
872
|
+
declare interface ExtendedProps extends ATellInputProps {
|
|
873
|
+
/** Override the flag URL builder, forwarded to ACountrySelect. */
|
|
874
|
+
flagUrl?: (iso2: string, width: number) => string;
|
|
875
|
+
/** Custom search predicate, forwarded to ACountrySelect. */
|
|
876
|
+
searcher?: (query: string, country: CountryOption) => boolean;
|
|
877
|
+
/** Provide your own country list, forwarded to ACountrySelect. */
|
|
878
|
+
countries?: CountryOption[];
|
|
879
|
+
/**
|
|
880
|
+
* Fully custom country detection. When provided, this function runs in place of the
|
|
881
|
+
* built-in chain — `detectCountry`-style options are still honored but the function
|
|
882
|
+
* receives them and is free to ignore them.
|
|
883
|
+
*/
|
|
884
|
+
detector?: (options: DetectCountryOptions) => Promise<string | null | undefined>;
|
|
885
|
+
/** Forwarded to ACountrySelect: classes for the popover content surface. */
|
|
886
|
+
contentClass?: string;
|
|
887
|
+
popoverClass?: string;
|
|
888
|
+
drawerClass?: string;
|
|
889
|
+
/** Classes for the inner phone field input element. */
|
|
890
|
+
inputClass?: string;
|
|
891
|
+
/** Classes for the outer wrapper that holds country select + input. */
|
|
892
|
+
fieldClass?: string;
|
|
893
|
+
/** Classes for the helper hint line. */
|
|
894
|
+
hintClass?: string;
|
|
895
|
+
/** Classes for the error message line. */
|
|
896
|
+
errorClass?: string;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
export declare type FlagUrlBuilder = (iso2: string, width: number) => string;
|
|
900
|
+
|
|
901
|
+
export declare interface PhoneRequiredInfo {
|
|
902
|
+
iso2: string;
|
|
903
|
+
dial_code: string;
|
|
904
|
+
/** Empty by default — consumer passes a placeholder via the component prop. */
|
|
905
|
+
placeholder: string;
|
|
906
|
+
example_national: string;
|
|
907
|
+
example_e164: string;
|
|
908
|
+
national_number_length: {
|
|
909
|
+
min: number | null;
|
|
910
|
+
max: number | null;
|
|
911
|
+
};
|
|
912
|
+
format_hint: string;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
export declare type PhoneValidationReason = 'missing_country' | 'country_not_supported' | 'phone_has_non_digits' | 'too_short' | 'too_long' | 'invalid_phone' | 'parse_failed';
|
|
916
|
+
|
|
917
|
+
export declare interface PhoneValidationResult {
|
|
918
|
+
ok: boolean;
|
|
919
|
+
reason: PhoneValidationReason | null;
|
|
920
|
+
country: {
|
|
921
|
+
iso2: string;
|
|
922
|
+
dial_code: string;
|
|
923
|
+
} | null;
|
|
924
|
+
phone: {
|
|
925
|
+
raw: string | null;
|
|
926
|
+
digits: string;
|
|
927
|
+
};
|
|
928
|
+
full_phone: string | null;
|
|
929
|
+
required: PhoneRequiredInfo | null;
|
|
930
|
+
details?: Record<string, unknown>;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
export declare interface RestCountry {
|
|
934
|
+
name?: {
|
|
935
|
+
common?: string;
|
|
936
|
+
};
|
|
937
|
+
cca2?: string;
|
|
938
|
+
idd?: {
|
|
939
|
+
root?: string;
|
|
940
|
+
suffixes?: string[];
|
|
941
|
+
};
|
|
942
|
+
flags?: {
|
|
943
|
+
png?: string;
|
|
944
|
+
svg?: string;
|
|
945
|
+
};
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
declare function selectCountry(option: CountryOption): void;
|
|
949
|
+
|
|
950
|
+
/**
|
|
951
|
+
* Shared size scale for every interactive UI component in @alikhalilll/ui.
|
|
952
|
+
*
|
|
953
|
+
* xs = 28px · sm = 36px · md = 43px (default) · lg = 52px · xl = 60px
|
|
954
|
+
*
|
|
955
|
+
* Use the {@link controlHeight}, {@link controlPaddingX}, {@link controlTextSize}
|
|
956
|
+
* maps when building a CVA variant so every component stays in lockstep.
|
|
957
|
+
*/
|
|
958
|
+
export declare type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
959
|
+
|
|
960
|
+
export declare const SIZES: readonly Size[];
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
* Reactive wrapper. Kicks off detection in `onMounted` so SSR renders an empty value and the
|
|
964
|
+
* client patches in the real country once resolved.
|
|
965
|
+
*/
|
|
966
|
+
export declare function useCountryDetection(opts?: DetectCountryOptions): UseCountryDetectionReturn;
|
|
967
|
+
|
|
968
|
+
export declare interface UseCountryDetectionReturn {
|
|
969
|
+
/** Resolved ISO2 code. Initially `null` until detection completes. */
|
|
970
|
+
country: Ref<string | null>;
|
|
971
|
+
/** True while detection is in flight. */
|
|
972
|
+
isLoading: Ref<boolean>;
|
|
973
|
+
/** Manually re-run detection (e.g. after the user changes their VPN). */
|
|
974
|
+
refresh: () => Promise<string>;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
export declare function usePhoneValidation(): UsePhoneValidationReturn;
|
|
978
|
+
|
|
979
|
+
export declare interface UsePhoneValidationReturn {
|
|
980
|
+
countries: Ref<CountryOption[]>;
|
|
981
|
+
isCountriesLoading: Ref<boolean>;
|
|
982
|
+
getCountries(options?: {
|
|
983
|
+
force?: boolean;
|
|
984
|
+
}): Promise<CountryOption[]>;
|
|
985
|
+
searchCountries(keyword: string, limit?: number): CountryOption[];
|
|
986
|
+
getCountryByValue(value: string): CountryOption | null;
|
|
987
|
+
getCountriesByDial(dial: string): CountryOption[];
|
|
988
|
+
getRequiredInfo(country: {
|
|
989
|
+
iso2: string;
|
|
990
|
+
dial_code?: string;
|
|
991
|
+
}): PhoneRequiredInfo | null;
|
|
992
|
+
validate(input: ValidateArgs): PhoneValidationResult;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
export declare type ValidateArgs = {
|
|
996
|
+
country: {
|
|
997
|
+
iso2: string;
|
|
998
|
+
dial_code?: string;
|
|
999
|
+
} | null | undefined;
|
|
1000
|
+
phone?: undefined;
|
|
1001
|
+
} | {
|
|
1002
|
+
country: {
|
|
1003
|
+
iso2: string;
|
|
1004
|
+
dial_code?: string;
|
|
1005
|
+
} | null | undefined;
|
|
1006
|
+
phone: string | null;
|
|
1007
|
+
};
|
|
1008
|
+
|
|
1009
|
+
export { }
|