@alikhalilll/ui 1.0.0 → 1.1.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.
Files changed (43) hide show
  1. package/README.md +20 -4
  2. package/dist/chunks/ADrawerContent.vue_vue_type_script_setup_true_lang-BivIZvV1.mjs +108 -0
  3. package/dist/chunks/ADrawerContent.vue_vue_type_script_setup_true_lang-BivIZvV1.mjs.map +1 -0
  4. package/dist/chunks/AInput.vue_vue_type_script_setup_true_lang-BJUP7ePq.mjs +81 -0
  5. package/dist/chunks/AInput.vue_vue_type_script_setup_true_lang-BJUP7ePq.mjs.map +1 -0
  6. package/dist/chunks/APopoverContent.vue_vue_type_script_setup_true_lang-BRqULKIg.mjs +103 -0
  7. package/dist/chunks/APopoverContent.vue_vue_type_script_setup_true_lang-BRqULKIg.mjs.map +1 -0
  8. package/dist/chunks/AResponsivePopoverContent.vue_vue_type_script_setup_true_lang-CCGyy9Lp.mjs +92 -0
  9. package/dist/chunks/AResponsivePopoverContent.vue_vue_type_script_setup_true_lang-CCGyy9Lp.mjs.map +1 -0
  10. package/dist/chunks/ATellInput.vue_vue_type_script_setup_true_lang-B4lyNu_f.mjs +1353 -0
  11. package/dist/chunks/ATellInput.vue_vue_type_script_setup_true_lang-B4lyNu_f.mjs.map +1 -0
  12. package/dist/chunks/cn-B6yFEsav.mjs +9 -0
  13. package/dist/chunks/cn-B6yFEsav.mjs.map +1 -0
  14. package/dist/chunks/sizes-B_9MfLkz.mjs +34 -0
  15. package/dist/chunks/sizes-B_9MfLkz.mjs.map +1 -0
  16. package/dist/drawer.d.ts +116 -0
  17. package/dist/drawer.mjs +8 -0
  18. package/dist/drawer.mjs.map +1 -0
  19. package/dist/index.d.ts +23 -4
  20. package/dist/index.mjs +34 -1516
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/input.d.ts +65 -0
  23. package/dist/input.mjs +5 -0
  24. package/dist/input.mjs.map +1 -0
  25. package/dist/popover.d.ts +109 -0
  26. package/dist/popover.mjs +7 -0
  27. package/dist/popover.mjs.map +1 -0
  28. package/dist/responsive-popover.d.ts +124 -0
  29. package/dist/responsive-popover.mjs +7 -0
  30. package/dist/responsive-popover.mjs.map +1 -0
  31. package/dist/tell-input.d.ts +637 -0
  32. package/dist/tell-input.mjs +13 -0
  33. package/dist/tell-input.mjs.map +1 -0
  34. package/dist/utils.d.ts +29 -0
  35. package/dist/utils.mjs +12 -0
  36. package/dist/utils.mjs.map +1 -0
  37. package/entries/drawer/README.md +39 -0
  38. package/entries/input/README.md +42 -0
  39. package/entries/popover/README.md +37 -0
  40. package/entries/responsive-popover/README.md +47 -0
  41. package/entries/tell-input/README.md +52 -0
  42. package/package.json +30 -4
  43. /package/dist/{styles.css → assets/styles.css} +0 -0
@@ -0,0 +1,637 @@
1
+ import { ClassProp } from 'class-variance-authority/types';
2
+ import { ComponentOptionsMixin } from 'vue';
3
+ import { ComponentProvideOptions } from 'vue';
4
+ import { ComputedRef } from 'vue';
5
+ import { DefineComponent } from 'vue';
6
+ import { HTMLAttributes } from 'vue';
7
+ import { PublicProps } from 'vue';
8
+ import { Ref } from 'vue';
9
+ import { VariantProps } from 'class-variance-authority';
10
+
11
+ declare const __VLS_component: DefineComponent<__VLS_PublicProps, {
12
+ validation: ComputedRef<PhoneValidationResult>;
13
+ required: ComputedRef<PhoneRequiredInfo | null>;
14
+ selectedDialCode: ComputedRef<string | null>;
15
+ validationState: ComputedRef<"error" | "idle" | "valid">;
16
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
17
+ "update:phone": (value: string) => any;
18
+ "update:country": (value: number | null) => any;
19
+ }, string, PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
20
+ "onUpdate:phone"?: ((value: string) => any) | undefined;
21
+ "onUpdate:country"?: ((value: number | null) => any) | undefined;
22
+ }>, {
23
+ size: ATellInputSize;
24
+ placeholder: string;
25
+ ipEndpoint: string;
26
+ defaultCountry: string;
27
+ detectCountry: DetectionStrategy;
28
+ detectFromInput: boolean;
29
+ detectDebounceMs: number;
30
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
31
+
32
+ declare const __VLS_component_2: DefineComponent<__VLS_PublicProps_2, {
33
+ open: Ref<boolean, boolean>;
34
+ setOpen: (v: boolean) => boolean;
35
+ search: Ref<string, string>;
36
+ setSearch: (v: string) => string;
37
+ selectedCountry: ComputedRef<CountryOption<RestCountry> | null>;
38
+ selectCountry: typeof selectCountry;
39
+ countries: ComputedRef<CountryOption<RestCountry>[]>;
40
+ recents: Ref<string[], string[]>;
41
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
42
+ "update:selected": (value: string) => any;
43
+ }, string, PublicProps, Readonly<__VLS_PublicProps_2> & Readonly<{
44
+ "onUpdate:selected"?: ((value: string) => any) | undefined;
45
+ }>, {
46
+ size: Size;
47
+ searchPlaceholder: string;
48
+ emptyText: string;
49
+ loadingText: string;
50
+ suggestedLabel: string;
51
+ allCountriesLabel: string;
52
+ suggestedLimit: number;
53
+ maxResults: number;
54
+ kbdOpen: string | null;
55
+ kbdClose: string | null;
56
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
57
+
58
+ declare const __VLS_component_3: DefineComponent<__VLS_Props_3, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_3> & Readonly<{}>, {
59
+ width: number;
60
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
61
+
62
+ declare type __VLS_Props = ExtendedProps;
63
+
64
+ declare type __VLS_Props_2 = {
65
+ class?: HTMLAttributes['class'];
66
+ triggerClass?: HTMLAttributes['class'];
67
+ contentClass?: HTMLAttributes['class'];
68
+ popoverClass?: HTMLAttributes['class'];
69
+ drawerClass?: HTMLAttributes['class'];
70
+ searchPlaceholder?: string;
71
+ emptyText?: string;
72
+ loadingText?: string;
73
+ suggestedLabel?: string;
74
+ allCountriesLabel?: string;
75
+ /** ISO2 codes that are selectable. Others are listed but disabled. */
76
+ allowedDialCodes?: string[];
77
+ disabled?: boolean;
78
+ /** Drives the trigger button padding + text size. Matches ATellInput's `size`. */
79
+ size?: Size;
80
+ /** Max items rendered under the "Suggested" header (current + recents, deduped). */
81
+ suggestedLimit?: number;
82
+ /** Cap the number of matching countries shown in search results. */
83
+ maxResults?: number;
84
+ /** Override the flag URL builder, e.g. `(iso, w) => \`/flags/${iso}.svg\``. */
85
+ flagUrl?: (iso2: string, width: number) => string;
86
+ /**
87
+ * Custom search predicate. Default: substring match on the precomputed `search_key`.
88
+ * Return `true` to keep the country in results.
89
+ */
90
+ searcher?: (query: string, country: CountryOption) => boolean;
91
+ /**
92
+ * Provide your own country list (bypasses the REST Countries fetch). Useful when you
93
+ * already have a curated subset, an i18n'd list, or want to avoid the network call.
94
+ */
95
+ countries?: CountryOption[];
96
+ /** Override the right-side kbd hints. Pass `null` to hide. */
97
+ kbdOpen?: string | null;
98
+ kbdClose?: string | null;
99
+ };
100
+
101
+ declare type __VLS_Props_3 = {
102
+ /** ISO 3166-1 alpha-2 country code, case-insensitive. */
103
+ iso2: string;
104
+ /** Pixel width served by flagcdn. 40 is crisp at retina up to ~24px wide. */
105
+ width?: number;
106
+ /** Optional explicit URL override. When set, `iso2` / `width` / `flagUrl` are ignored. */
107
+ src?: string | null;
108
+ /** Function `(iso2, width) => string` — fully replace the URL builder. */
109
+ flagUrl?: FlagUrlBuilder;
110
+ alt?: string;
111
+ class?: HTMLAttributes['class'];
112
+ };
113
+
114
+ declare type __VLS_PublicProps = {
115
+ 'phone'?: string;
116
+ 'country'?: number | null;
117
+ } & __VLS_Props;
118
+
119
+ declare type __VLS_PublicProps_2 = {
120
+ 'selected'?: string;
121
+ } & __VLS_Props_2;
122
+
123
+ declare function __VLS_template(): {
124
+ attrs: Partial<{}>;
125
+ slots: Readonly<{
126
+ /** Content before the country select trigger (e.g. an icon). */
127
+ prefix?: () => unknown;
128
+ /** Content between the input and the validation icons. */
129
+ suffix?: (props: {
130
+ validationState: "idle" | "valid" | "error";
131
+ validation: PhoneValidationResult;
132
+ }) => unknown;
133
+ /** Replace the green check shown when the number validates. */
134
+ 'valid-icon'?: () => unknown;
135
+ /** Replace the warning icon shown when the number fails validation. */
136
+ 'error-icon'?: (props: {
137
+ reason: string;
138
+ }) => unknown;
139
+ /** Replace the dim helper line shown below the input when empty. */
140
+ hint?: (props: {
141
+ country: string;
142
+ formatHint: string;
143
+ example: string | null;
144
+ }) => unknown;
145
+ /** Replace the error message rendered when invalid. */
146
+ error?: (props: {
147
+ message: string;
148
+ reason: string;
149
+ validation: PhoneValidationResult;
150
+ }) => unknown;
151
+ /** Forwarded to ACountrySelect — replace the trigger button. */
152
+ trigger?: (props: {
153
+ selectedCountry: CountryOption | null;
154
+ open: boolean;
155
+ sizeClasses: string;
156
+ }) => unknown;
157
+ /** Forwarded to ACountrySelect — replace the chevron. */
158
+ chevron?: (props: {
159
+ open: boolean;
160
+ }) => unknown;
161
+ /** Forwarded — replace any flag rendering. */
162
+ flag?: (props: {
163
+ country: CountryOption;
164
+ context: "trigger" | "item";
165
+ }) => unknown;
166
+ /** Forwarded — replace each country list row. */
167
+ item?: (props: {
168
+ country: CountryOption;
169
+ selected: boolean;
170
+ disabled: boolean;
171
+ select: () => void;
172
+ }) => unknown;
173
+ /** Forwarded — section header. */
174
+ 'group-header'?: (props: {
175
+ label: string;
176
+ group: "suggested" | "all";
177
+ }) => unknown;
178
+ /** Forwarded — search bar. */
179
+ search?: (props: {
180
+ value: string;
181
+ setValue: (v: string) => void;
182
+ isSearching: boolean;
183
+ }) => unknown;
184
+ loading?: () => unknown;
185
+ empty?: (props: {
186
+ query: string;
187
+ }) => unknown;
188
+ }> & {
189
+ /** Content before the country select trigger (e.g. an icon). */
190
+ prefix?: () => unknown;
191
+ /** Content between the input and the validation icons. */
192
+ suffix?: (props: {
193
+ validationState: "idle" | "valid" | "error";
194
+ validation: PhoneValidationResult;
195
+ }) => unknown;
196
+ /** Replace the green check shown when the number validates. */
197
+ 'valid-icon'?: () => unknown;
198
+ /** Replace the warning icon shown when the number fails validation. */
199
+ 'error-icon'?: (props: {
200
+ reason: string;
201
+ }) => unknown;
202
+ /** Replace the dim helper line shown below the input when empty. */
203
+ hint?: (props: {
204
+ country: string;
205
+ formatHint: string;
206
+ example: string | null;
207
+ }) => unknown;
208
+ /** Replace the error message rendered when invalid. */
209
+ error?: (props: {
210
+ message: string;
211
+ reason: string;
212
+ validation: PhoneValidationResult;
213
+ }) => unknown;
214
+ /** Forwarded to ACountrySelect — replace the trigger button. */
215
+ trigger?: (props: {
216
+ selectedCountry: CountryOption | null;
217
+ open: boolean;
218
+ sizeClasses: string;
219
+ }) => unknown;
220
+ /** Forwarded to ACountrySelect — replace the chevron. */
221
+ chevron?: (props: {
222
+ open: boolean;
223
+ }) => unknown;
224
+ /** Forwarded — replace any flag rendering. */
225
+ flag?: (props: {
226
+ country: CountryOption;
227
+ context: "trigger" | "item";
228
+ }) => unknown;
229
+ /** Forwarded — replace each country list row. */
230
+ item?: (props: {
231
+ country: CountryOption;
232
+ selected: boolean;
233
+ disabled: boolean;
234
+ select: () => void;
235
+ }) => unknown;
236
+ /** Forwarded — section header. */
237
+ 'group-header'?: (props: {
238
+ label: string;
239
+ group: "suggested" | "all";
240
+ }) => unknown;
241
+ /** Forwarded — search bar. */
242
+ search?: (props: {
243
+ value: string;
244
+ setValue: (v: string) => void;
245
+ isSearching: boolean;
246
+ }) => unknown;
247
+ loading?: () => unknown;
248
+ empty?: (props: {
249
+ query: string;
250
+ }) => unknown;
251
+ };
252
+ refs: {};
253
+ rootEl: HTMLDivElement;
254
+ };
255
+
256
+ declare function __VLS_template_2(): {
257
+ attrs: Partial<{}>;
258
+ slots: Readonly<{
259
+ /** Replace the entire country picker trigger button. */
260
+ trigger?: (props: {
261
+ selectedCountry: CountryOption | null;
262
+ open: boolean;
263
+ sizeClasses: string;
264
+ }) => unknown;
265
+ /** Replace the chevron icon. */
266
+ chevron?: (props: {
267
+ open: boolean;
268
+ }) => unknown;
269
+ /** Replace just the flag rendered in the trigger and items. */
270
+ flag?: (props: {
271
+ country: CountryOption;
272
+ context: "trigger" | "item";
273
+ }) => unknown;
274
+ /** Replace the entire search bar (input + icon + kbd). */
275
+ search?: (props: {
276
+ value: string;
277
+ setValue: (v: string) => void;
278
+ isSearching: boolean;
279
+ }) => unknown;
280
+ /** Replace the search-bar leading icon. */
281
+ 'search-icon'?: () => unknown;
282
+ /** Replace the loading state. */
283
+ loading?: () => unknown;
284
+ /** Replace the empty/no-results state. */
285
+ empty?: (props: {
286
+ query: string;
287
+ }) => unknown;
288
+ /** Replace a section header. */
289
+ 'group-header'?: (props: {
290
+ label: string;
291
+ group: "suggested" | "all";
292
+ }) => unknown;
293
+ /** Replace each country list row. Default render still available via &lt;ACountrySelectItem /&gt;. */
294
+ item?: (props: {
295
+ country: CountryOption;
296
+ selected: boolean;
297
+ disabled: boolean;
298
+ select: () => void;
299
+ }) => unknown;
300
+ /** Replace just the right-side check icon for the selected row. */
301
+ 'item-check'?: (props: {
302
+ country: CountryOption;
303
+ }) => unknown;
304
+ }> & {
305
+ /** Replace the entire country picker trigger button. */
306
+ trigger?: (props: {
307
+ selectedCountry: CountryOption | null;
308
+ open: boolean;
309
+ sizeClasses: string;
310
+ }) => unknown;
311
+ /** Replace the chevron icon. */
312
+ chevron?: (props: {
313
+ open: boolean;
314
+ }) => unknown;
315
+ /** Replace just the flag rendered in the trigger and items. */
316
+ flag?: (props: {
317
+ country: CountryOption;
318
+ context: "trigger" | "item";
319
+ }) => unknown;
320
+ /** Replace the entire search bar (input + icon + kbd). */
321
+ search?: (props: {
322
+ value: string;
323
+ setValue: (v: string) => void;
324
+ isSearching: boolean;
325
+ }) => unknown;
326
+ /** Replace the search-bar leading icon. */
327
+ 'search-icon'?: () => unknown;
328
+ /** Replace the loading state. */
329
+ loading?: () => unknown;
330
+ /** Replace the empty/no-results state. */
331
+ empty?: (props: {
332
+ query: string;
333
+ }) => unknown;
334
+ /** Replace a section header. */
335
+ 'group-header'?: (props: {
336
+ label: string;
337
+ group: "suggested" | "all";
338
+ }) => unknown;
339
+ /** Replace each country list row. Default render still available via &lt;ACountrySelectItem /&gt;. */
340
+ item?: (props: {
341
+ country: CountryOption;
342
+ selected: boolean;
343
+ disabled: boolean;
344
+ select: () => void;
345
+ }) => unknown;
346
+ /** Replace just the right-side check icon for the selected row. */
347
+ 'item-check'?: (props: {
348
+ country: CountryOption;
349
+ }) => unknown;
350
+ };
351
+ refs: {};
352
+ rootEl: any;
353
+ };
354
+
355
+ declare function __VLS_template_3(): {
356
+ attrs: Partial<{}>;
357
+ slots: {
358
+ empty?(_: {}): any;
359
+ };
360
+ refs: {};
361
+ rootEl: any;
362
+ };
363
+
364
+ declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
365
+
366
+ declare type __VLS_TemplateResult_2 = ReturnType<typeof __VLS_template_2>;
367
+
368
+ declare type __VLS_TemplateResult_3 = ReturnType<typeof __VLS_template_3>;
369
+
370
+ declare type __VLS_WithTemplateSlots<T, S> = T & {
371
+ new (): {
372
+ $slots: S;
373
+ };
374
+ };
375
+
376
+ declare type __VLS_WithTemplateSlots_2<T, S> = T & {
377
+ new (): {
378
+ $slots: S;
379
+ };
380
+ };
381
+
382
+ declare type __VLS_WithTemplateSlots_3<T, S> = T & {
383
+ new (): {
384
+ $slots: S;
385
+ };
386
+ };
387
+
388
+ export declare const ACountryFlag: __VLS_WithTemplateSlots_3<typeof __VLS_component_3, __VLS_TemplateResult_3["slots"]>;
389
+
390
+ export declare const ACountrySelect: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
391
+
392
+ export declare const ATellInput: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
393
+
394
+ export declare interface ATellInputProps {
395
+ class?: HTMLAttributes['class'];
396
+ placeholder?: string;
397
+ disabled?: boolean;
398
+ loading?: boolean;
399
+ size?: ATellInputSize;
400
+ /**
401
+ * Whitelist of allowed dial-digit codes (no `+`), e.g. `['20', '966']`.
402
+ * Countries outside this list are still shown in the picker but rendered as disabled.
403
+ */
404
+ allowedDialCodes?: string[];
405
+ /** Show validation error text beneath the input when invalid. */
406
+ showValidation?: boolean;
407
+ /**
408
+ * Country auto-detect strategy. Defaults to `'auto'` — try IP geolocation first, then
409
+ * timezone, then `navigator.language`, finally `defaultCountry`.
410
+ */
411
+ detectCountry?: DetectionStrategy;
412
+ /**
413
+ * Initial country. Accepts either an ISO2 code (`'EG'`) or a dial-digit string
414
+ * (`'20'`, `'+20'`). When set, the picker is visible at mount with this country
415
+ * pre-selected — overrides the hidden-until-detected default.
416
+ */
417
+ defaultCountry?: string;
418
+ /** Override the IP geolocation endpoint. Must return JSON with `country_code` or `country`. */
419
+ ipEndpoint?: string;
420
+ /** Localized strings for the country picker UI. */
421
+ searchPlaceholder?: string;
422
+ emptyText?: string;
423
+ loadingText?: string;
424
+ /** Error labels keyed by reason. Each gets a sensible English default. */
425
+ errorMessages?: Partial<Record<PhoneValidationReason, string>>;
426
+ /**
427
+ * When true, the country picker is hidden until a leading dial code is detected in the
428
+ * phone input. Every keystroke runs a longest-prefix match against known dial codes; on
429
+ * first match the picker reveals with that country and the matched dial digits are
430
+ * stripped from `phone`. Skips the onMount IP/timezone/locale detection chain.
431
+ */
432
+ detectFromInput?: boolean;
433
+ /**
434
+ * Debounce window (ms) for `detectFromInput` detection. Each keystroke schedules the
435
+ * libphonenumber parse + lookup; bursts of typing/paste collapse into a single call.
436
+ * Clearing the input is not debounced — the picker hides immediately. Default 150ms.
437
+ */
438
+ detectDebounceMs?: number;
439
+ }
440
+
441
+ /** Alias for the shared `Size` scale — kept for backwards-friendly naming. */
442
+ export declare type ATellInputSize = Size;
443
+
444
+ export declare type ATellInputVariants = VariantProps<typeof aTellInputVariants>;
445
+
446
+ export declare const aTellInputVariants: (props?: ({
447
+ size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
448
+ } & ClassProp) | undefined) => string;
449
+
450
+ export declare interface CountryOption<T = RestCountry> {
451
+ /** Display label, e.g. "Egypt (+20)". */
452
+ label: string;
453
+ /** Stable unique ID — the ISO 3166-1 alpha-2 code, e.g. "EG". */
454
+ value: string;
455
+ /** Precomputed normalized string for fast substring search. */
456
+ search_key: string;
457
+ raw_data: {
458
+ iso2: string;
459
+ dial_code: string;
460
+ dial_digits: string;
461
+ name: string;
462
+ flag: string | null;
463
+ source: 'restcountries' | 'fallback';
464
+ original: T;
465
+ };
466
+ }
467
+
468
+ export declare const DEFAULT_ERROR_MESSAGES: Record<PhoneValidationReason, string>;
469
+
470
+ /**
471
+ * Default flag URL builder — flagcdn.com hosts PNG flags at multiple widths and is
472
+ * generous with caching + no API key required. Swap via the `flagUrl` prop on
473
+ * ATellInput / ACountrySelect / ACountryFlag to use any other source.
474
+ */
475
+ export declare function defaultFlagUrl(iso2: string, width?: number): string;
476
+
477
+ /**
478
+ * Imperative API. Use this when you want to call detection from outside Vue (e.g. inside a
479
+ * non-component composable, server middleware, or unit test).
480
+ */
481
+ export declare function detectCountry(opts?: DetectCountryOptions): Promise<string>;
482
+
483
+ export declare interface DetectCountryOptions {
484
+ /**
485
+ * - `'auto'` — try IP geolocation first, then timezone, then `navigator.language`, then default.
486
+ * - `'locale'` — skip the network call, use timezone + locale only.
487
+ * - `'none'` — return `defaultCountry` immediately.
488
+ */
489
+ strategy?: DetectionStrategy;
490
+ /** Endpoint returning a JSON body with a `country_code` (or `country`) field. */
491
+ ipEndpoint?: string;
492
+ /** Fallback ISO2 used when every step fails. */
493
+ defaultCountry?: string;
494
+ /** Abort the IP request after this many ms. */
495
+ timeoutMs?: number;
496
+ /** Persist the resolved country in sessionStorage so re-mounts within the session skip detection. */
497
+ cache?: boolean;
498
+ }
499
+
500
+ export declare type DetectionStrategy = 'auto' | 'locale' | 'none';
501
+
502
+ declare interface ExtendedProps extends ATellInputProps {
503
+ /** Override the flag URL builder, forwarded to ACountrySelect. */
504
+ flagUrl?: (iso2: string, width: number) => string;
505
+ /** Custom search predicate, forwarded to ACountrySelect. */
506
+ searcher?: (query: string, country: CountryOption) => boolean;
507
+ /** Provide your own country list, forwarded to ACountrySelect. */
508
+ countries?: CountryOption[];
509
+ /**
510
+ * Fully custom country detection. When provided, this function runs in place of the
511
+ * built-in chain — `detectCountry`-style options are still honored but the function
512
+ * receives them and is free to ignore them.
513
+ */
514
+ detector?: (options: DetectCountryOptions) => Promise<string | null | undefined>;
515
+ /** Forwarded to ACountrySelect: classes for the popover content surface. */
516
+ contentClass?: string;
517
+ popoverClass?: string;
518
+ drawerClass?: string;
519
+ /** Classes for the inner phone field input element. */
520
+ inputClass?: string;
521
+ /** Classes for the outer wrapper that holds country select + input. */
522
+ fieldClass?: string;
523
+ /** Classes for the helper hint line. */
524
+ hintClass?: string;
525
+ /** Classes for the error message line. */
526
+ errorClass?: string;
527
+ }
528
+
529
+ export declare type FlagUrlBuilder = (iso2: string, width: number) => string;
530
+
531
+ export declare interface PhoneRequiredInfo {
532
+ iso2: string;
533
+ dial_code: string;
534
+ /** Empty by default — consumer passes a placeholder via the component prop. */
535
+ placeholder: string;
536
+ example_national: string;
537
+ example_e164: string;
538
+ national_number_length: {
539
+ min: number | null;
540
+ max: number | null;
541
+ };
542
+ format_hint: string;
543
+ }
544
+
545
+ export declare type PhoneValidationReason = 'missing_country' | 'country_not_supported' | 'phone_has_non_digits' | 'too_short' | 'too_long' | 'invalid_phone' | 'parse_failed';
546
+
547
+ export declare interface PhoneValidationResult {
548
+ ok: boolean;
549
+ reason: PhoneValidationReason | null;
550
+ country: {
551
+ iso2: string;
552
+ dial_code: string;
553
+ } | null;
554
+ phone: {
555
+ raw: string | null;
556
+ digits: string;
557
+ };
558
+ full_phone: string | null;
559
+ required: PhoneRequiredInfo | null;
560
+ details?: Record<string, unknown>;
561
+ }
562
+
563
+ export declare interface RestCountry {
564
+ name?: {
565
+ common?: string;
566
+ };
567
+ cca2?: string;
568
+ idd?: {
569
+ root?: string;
570
+ suffixes?: string[];
571
+ };
572
+ flags?: {
573
+ png?: string;
574
+ svg?: string;
575
+ };
576
+ }
577
+
578
+ declare function selectCountry(option: CountryOption): void;
579
+
580
+ /**
581
+ * Shared size scale for every interactive UI component in @alikhalilll/ui.
582
+ *
583
+ * xs = 28px · sm = 36px · md = 43px (default) · lg = 52px · xl = 60px
584
+ *
585
+ * Use the {@link controlHeight}, {@link controlPaddingX}, {@link controlTextSize}
586
+ * maps when building a CVA variant so every component stays in lockstep.
587
+ */
588
+ declare type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
589
+
590
+ /**
591
+ * Reactive wrapper. Kicks off detection in `onMounted` so SSR renders an empty value and the
592
+ * client patches in the real country once resolved.
593
+ */
594
+ export declare function useCountryDetection(opts?: DetectCountryOptions): UseCountryDetectionReturn;
595
+
596
+ export declare interface UseCountryDetectionReturn {
597
+ /** Resolved ISO2 code. Initially `null` until detection completes. */
598
+ country: Ref<string | null>;
599
+ /** True while detection is in flight. */
600
+ isLoading: Ref<boolean>;
601
+ /** Manually re-run detection (e.g. after the user changes their VPN). */
602
+ refresh: () => Promise<string>;
603
+ }
604
+
605
+ export declare function usePhoneValidation(): UsePhoneValidationReturn;
606
+
607
+ export declare interface UsePhoneValidationReturn {
608
+ countries: Ref<CountryOption[]>;
609
+ isCountriesLoading: Ref<boolean>;
610
+ getCountries(options?: {
611
+ force?: boolean;
612
+ }): Promise<CountryOption[]>;
613
+ searchCountries(keyword: string, limit?: number): CountryOption[];
614
+ getCountryByValue(value: string): CountryOption | null;
615
+ getCountriesByDial(dial: string): CountryOption[];
616
+ getRequiredInfo(country: {
617
+ iso2: string;
618
+ dial_code?: string;
619
+ }): PhoneRequiredInfo | null;
620
+ validate(input: ValidateArgs): PhoneValidationResult;
621
+ }
622
+
623
+ export declare type ValidateArgs = {
624
+ country: {
625
+ iso2: string;
626
+ dial_code?: string;
627
+ } | null | undefined;
628
+ phone?: undefined;
629
+ } | {
630
+ country: {
631
+ iso2: string;
632
+ dial_code?: string;
633
+ } | null | undefined;
634
+ phone: string | null;
635
+ };
636
+
637
+ export { }
@@ -0,0 +1,13 @@
1
+ import { _ as e, a as s, b as l, D as n, c as u, d as o, e as r, u as A, f as c } from "./chunks/ATellInput.vue_vue_type_script_setup_true_lang-B4lyNu_f.mjs";
2
+ export {
3
+ e as ACountryFlag,
4
+ s as ACountrySelect,
5
+ l as ATellInput,
6
+ n as DEFAULT_ERROR_MESSAGES,
7
+ u as aTellInputVariants,
8
+ o as defaultFlagUrl,
9
+ r as detectCountry,
10
+ A as useCountryDetection,
11
+ c as usePhoneValidation
12
+ };
13
+ //# sourceMappingURL=tell-input.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tell-input.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,29 @@
1
+ import { ClassValue } from 'clsx';
2
+
3
+ export declare function cn(...inputs: ClassValue[]): string;
4
+
5
+ /** Tailwind height utility per size. md uses an arbitrary value because 43px isn't on the spacing scale. */
6
+ export declare const controlHeight: Record<Size, string>;
7
+
8
+ /** Pixel values exposed so non-template code (icons, ResizeObserver, etc.) can read the height. */
9
+ export declare const controlHeightPx: Record<Size, number>;
10
+
11
+ export declare const controlPaddingX: Record<Size, string>;
12
+
13
+ export declare const controlTextSize: Record<Size, string>;
14
+
15
+ export declare const DEFAULT_SIZE: Size;
16
+
17
+ /**
18
+ * Shared size scale for every interactive UI component in @alikhalilll/ui.
19
+ *
20
+ * xs = 28px · sm = 36px · md = 43px (default) · lg = 52px · xl = 60px
21
+ *
22
+ * Use the {@link controlHeight}, {@link controlPaddingX}, {@link controlTextSize}
23
+ * maps when building a CVA variant so every component stays in lockstep.
24
+ */
25
+ export declare type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
26
+
27
+ export declare const SIZES: readonly Size[];
28
+
29
+ export { }
package/dist/utils.mjs ADDED
@@ -0,0 +1,12 @@
1
+ import { c as t } from "./chunks/cn-B6yFEsav.mjs";
2
+ import { D as c, S as s, c as e, a as n, b as S, d as i } from "./chunks/sizes-B_9MfLkz.mjs";
3
+ export {
4
+ c as DEFAULT_SIZE,
5
+ s as SIZES,
6
+ t as cn,
7
+ e as controlHeight,
8
+ n as controlHeightPx,
9
+ S as controlPaddingX,
10
+ i as controlTextSize
11
+ };
12
+ //# sourceMappingURL=utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}