@alikhalilll/ui 1.1.0 → 1.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/dist/index.d.ts CHANGED
@@ -26,7 +26,7 @@ declare const __VLS_component: DefineComponent<__VLS_Props, {}, {}, {}, {}, Comp
26
26
  size: Size;
27
27
  }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
28
28
 
29
- declare const __VLS_component_10: DefineComponent<__VLS_Props_7, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_7> & Readonly<{}>, {
29
+ declare const __VLS_component_10: DefineComponent<__VLS_Props_8, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_8> & Readonly<{}>, {
30
30
  sideOffset: number;
31
31
  align: "start" | "center" | "end";
32
32
  overlay: boolean;
@@ -74,13 +74,15 @@ emptyText: string;
74
74
  loadingText: string;
75
75
  suggestedLabel: string;
76
76
  allCountriesLabel: string;
77
+ countryLabel: string;
78
+ selectCountryLabel: string;
77
79
  suggestedLimit: number;
78
80
  maxResults: number;
79
81
  kbdOpen: string | null;
80
82
  kbdClose: string | null;
81
83
  }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
82
84
 
83
- declare const __VLS_component_13: DefineComponent<__VLS_Props_10, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_10> & Readonly<{}>, {
85
+ declare const __VLS_component_13: DefineComponent<__VLS_Props_11, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_11> & Readonly<{}>, {
84
86
  width: number;
85
87
  }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
86
88
 
@@ -134,14 +136,14 @@ shouldScaleBackground: boolean;
134
136
 
135
137
  declare const __VLS_component_6: DefineComponent<DrawerTriggerProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<DrawerTriggerProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
136
138
 
137
- declare const __VLS_component_7: DefineComponent<__VLS_Props_3, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
139
+ declare const __VLS_component_7: DefineComponent<__VLS_Props_4, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
138
140
  escapeKeyDown: (event: KeyboardEvent) => any;
139
141
  pointerDownOutside: (event: PointerDownOutsideEvent) => any;
140
142
  focusOutside: (event: FocusOutsideEvent) => any;
141
143
  interactOutside: (event: PointerDownOutsideEvent | FocusOutsideEvent) => any;
142
144
  openAutoFocus: (event: Event) => any;
143
145
  closeAutoFocus: (event: Event) => any;
144
- }, string, PublicProps, Readonly<__VLS_Props_3> & Readonly<{
146
+ }, string, PublicProps, Readonly<__VLS_Props_4> & Readonly<{
145
147
  onEscapeKeyDown?: ((event: KeyboardEvent) => any) | undefined;
146
148
  onPointerDownOutside?: ((event: PointerDownOutsideEvent) => any) | undefined;
147
149
  onFocusOutside?: ((event: FocusOutsideEvent) => any) | undefined;
@@ -159,7 +161,7 @@ modal: boolean;
159
161
  breakpoint: string;
160
162
  }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
161
163
 
162
- declare const __VLS_component_9: DefineComponent<__VLS_Props_6, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_6> & Readonly<{}>, {
164
+ declare const __VLS_component_9: DefineComponent<__VLS_Props_7, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_7> & Readonly<{}>, {
163
165
  breakpoint: string;
164
166
  }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
165
167
 
@@ -177,6 +179,49 @@ declare type __VLS_Props = {
177
179
  };
178
180
 
179
181
  declare type __VLS_Props_10 = {
182
+ class?: HTMLAttributes['class'];
183
+ triggerClass?: HTMLAttributes['class'];
184
+ contentClass?: HTMLAttributes['class'];
185
+ popoverClass?: HTMLAttributes['class'];
186
+ drawerClass?: HTMLAttributes['class'];
187
+ searchPlaceholder?: string;
188
+ emptyText?: string;
189
+ loadingText?: string;
190
+ suggestedLabel?: string;
191
+ allCountriesLabel?: string;
192
+ /** ISO2 codes that are selectable. Others are listed but disabled. */
193
+ allowedDialCodes?: string[];
194
+ disabled?: boolean;
195
+ /** Drives the trigger button padding + text size. Matches ATellInput's `size`. */
196
+ size?: Size;
197
+ /** Max items rendered under the "Suggested" header (current + recents, deduped). */
198
+ suggestedLimit?: number;
199
+ /** Cap the number of matching countries shown in search results. */
200
+ maxResults?: number;
201
+ /** Override the flag URL builder, e.g. `(iso, w) => \`/flags/${iso}.svg\``. */
202
+ flagUrl?: (iso2: string, width: number) => string;
203
+ /**
204
+ * Custom search predicate. Default: substring match on the precomputed `search_key`.
205
+ * Return `true` to keep the country in results.
206
+ */
207
+ searcher?: (query: string, country: CountryOption) => boolean;
208
+ /**
209
+ * Provide your own country list (bypasses the REST Countries fetch). Useful when you
210
+ * already have a curated subset, an i18n'd list, or want to avoid the network call.
211
+ */
212
+ countries?: CountryOption[];
213
+ /** Override the right-side kbd hints. Pass `null` to hide. */
214
+ kbdOpen?: string | null;
215
+ kbdClose?: string | null;
216
+ /** BCP-47 locale — country names render localized via `Intl.DisplayNames`. */
217
+ locale?: string;
218
+ /** Prefix of the trigger's `aria-label` when a country is selected, e.g. `"Country"`. */
219
+ countryLabel?: string;
220
+ /** Trigger's `aria-label` when no country is selected. */
221
+ selectCountryLabel?: string;
222
+ };
223
+
224
+ declare type __VLS_Props_11 = {
180
225
  /** ISO 3166-1 alpha-2 country code, case-insensitive. */
181
226
  iso2: string;
182
227
  /** Pixel width served by flagcdn. 40 is crisp at retina up to ~24px wide. */
@@ -191,20 +236,26 @@ declare type __VLS_Props_10 = {
191
236
 
192
237
  declare type __VLS_Props_2 = PopoverContentProps & {
193
238
  class?: HTMLAttributes['class'];
194
- /** Render a dimmed, clickable backdrop behind the popover. Pair with `<APopover modal>`. */
239
+ /** Dim the entire viewport behind the popover and block all interaction with the
240
+ * page (clicks are captured by the overlay; body scroll is locked while open).
241
+ * Pair with `<APopover :modal="true">` (the default) for the full modal behaviour. */
195
242
  overlay?: boolean;
196
243
  overlayClass?: HTMLAttributes['class'];
197
244
  };
198
245
 
199
- declare type __VLS_Props_3 = DialogContentProps & {
246
+ declare type __VLS_Props_3 = {
247
+ class?: HTMLAttributes['class'];
248
+ };
249
+
250
+ declare type __VLS_Props_4 = DialogContentProps & {
200
251
  class?: HTMLAttributes['class'];
201
252
  };
202
253
 
203
- declare type __VLS_Props_4 = DialogOverlayProps & {
254
+ declare type __VLS_Props_5 = DialogOverlayProps & {
204
255
  class?: HTMLAttributes['class'];
205
256
  };
206
257
 
207
- declare type __VLS_Props_5 = {
258
+ declare type __VLS_Props_6 = {
208
259
  /** CSS media query for the desktop break. Below this width we render a vaul drawer. */
209
260
  breakpoint?: string;
210
261
  /**
@@ -214,12 +265,12 @@ declare type __VLS_Props_5 = {
214
265
  modal?: boolean;
215
266
  };
216
267
 
217
- declare type __VLS_Props_6 = {
268
+ declare type __VLS_Props_7 = {
218
269
  breakpoint?: string;
219
270
  asChild?: boolean;
220
271
  };
221
272
 
222
- declare type __VLS_Props_7 = {
273
+ declare type __VLS_Props_8 = {
223
274
  breakpoint?: string;
224
275
  /** Classes applied on both branches. Avoid width / inset classes here. */
225
276
  class?: HTMLAttributes['class'];
@@ -237,57 +288,20 @@ declare type __VLS_Props_7 = {
237
288
  sideOffset?: number;
238
289
  };
239
290
 
240
- declare type __VLS_Props_8 = ExtendedProps;
241
-
242
- declare type __VLS_Props_9 = {
243
- class?: HTMLAttributes['class'];
244
- triggerClass?: HTMLAttributes['class'];
245
- contentClass?: HTMLAttributes['class'];
246
- popoverClass?: HTMLAttributes['class'];
247
- drawerClass?: HTMLAttributes['class'];
248
- searchPlaceholder?: string;
249
- emptyText?: string;
250
- loadingText?: string;
251
- suggestedLabel?: string;
252
- allCountriesLabel?: string;
253
- /** ISO2 codes that are selectable. Others are listed but disabled. */
254
- allowedDialCodes?: string[];
255
- disabled?: boolean;
256
- /** Drives the trigger button padding + text size. Matches ATellInput's `size`. */
257
- size?: Size;
258
- /** Max items rendered under the "Suggested" header (current + recents, deduped). */
259
- suggestedLimit?: number;
260
- /** Cap the number of matching countries shown in search results. */
261
- maxResults?: number;
262
- /** Override the flag URL builder, e.g. `(iso, w) => \`/flags/${iso}.svg\``. */
263
- flagUrl?: (iso2: string, width: number) => string;
264
- /**
265
- * Custom search predicate. Default: substring match on the precomputed `search_key`.
266
- * Return `true` to keep the country in results.
267
- */
268
- searcher?: (query: string, country: CountryOption) => boolean;
269
- /**
270
- * Provide your own country list (bypasses the REST Countries fetch). Useful when you
271
- * already have a curated subset, an i18n'd list, or want to avoid the network call.
272
- */
273
- countries?: CountryOption[];
274
- /** Override the right-side kbd hints. Pass `null` to hide. */
275
- kbdOpen?: string | null;
276
- kbdClose?: string | null;
277
- };
291
+ declare type __VLS_Props_9 = ExtendedProps;
278
292
 
279
293
  declare type __VLS_PublicProps = {
280
294
  'open'?: boolean;
281
- } & __VLS_Props_5;
295
+ } & __VLS_Props_6;
282
296
 
283
297
  declare type __VLS_PublicProps_2 = {
284
298
  'phone'?: string;
285
299
  'country'?: number | null;
286
- } & __VLS_Props_8;
300
+ } & __VLS_Props_9;
287
301
 
288
302
  declare type __VLS_PublicProps_3 = {
289
303
  'selected'?: string;
290
- } & __VLS_Props_9;
304
+ } & __VLS_Props_10;
291
305
 
292
306
  declare function __VLS_template(): {
293
307
  attrs: Partial<{}>;
@@ -746,7 +760,7 @@ export declare const ADrawer: __VLS_WithTemplateSlots_5<typeof __VLS_component_5
746
760
 
747
761
  export declare const ADrawerContent: __VLS_WithTemplateSlots_7<typeof __VLS_component_7, __VLS_TemplateResult_7["slots"]>;
748
762
 
749
- export declare const ADrawerOverlay: DefineComponent<__VLS_Props_4, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_4> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
763
+ export declare const ADrawerOverlay: DefineComponent<__VLS_Props_5, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_5> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
750
764
 
751
765
  export declare const ADrawerTrigger: __VLS_WithTemplateSlots_6<typeof __VLS_component_6, __VLS_TemplateResult_6["slots"]>;
752
766
 
@@ -756,6 +770,8 @@ export declare const APopover: __VLS_WithTemplateSlots_2<typeof __VLS_component_
756
770
 
757
771
  export declare const APopoverContent: __VLS_WithTemplateSlots_4<typeof __VLS_component_4, __VLS_TemplateResult_4["slots"]>;
758
772
 
773
+ export declare const APopoverOverlay: DefineComponent<__VLS_Props_3, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_3> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
774
+
759
775
  export declare const APopoverTrigger: __VLS_WithTemplateSlots_3<typeof __VLS_component_3, __VLS_TemplateResult_3["slots"]>;
760
776
 
761
777
  export declare const AResponsivePopover: __VLS_WithTemplateSlots_8<typeof __VLS_component_8, __VLS_TemplateResult_8["slots"]>;
@@ -766,12 +782,32 @@ export declare const AResponsivePopoverTrigger: __VLS_WithTemplateSlots_9<typeof
766
782
 
767
783
  export declare const ATellInput: __VLS_WithTemplateSlots_11<typeof __VLS_component_11, __VLS_TemplateResult_11["slots"]>;
768
784
 
785
+ /** Text direction for the field. `'auto'` (or omitting the prop) inherits from the
786
+ * nearest `[dir]` ancestor / `<html dir>`; `'ltr'` / `'rtl'` force it. */
787
+ export declare type ATellInputDir = 'ltr' | 'rtl' | 'auto';
788
+
769
789
  export declare interface ATellInputProps {
770
790
  class?: HTMLAttributes['class'];
771
791
  placeholder?: string;
772
792
  disabled?: boolean;
773
793
  loading?: boolean;
774
794
  size?: ATellInputSize;
795
+ /**
796
+ * Text direction. Omit (or pass `'auto'`) to inherit from the page — RTL pages get an
797
+ * RTL field automatically. Pass `'ltr'` / `'rtl'` to force it.
798
+ */
799
+ dir?: ATellInputDir;
800
+ /**
801
+ * BCP-47 locale (e.g. `'ar'`, `'fr'`). When set, country names render localized via
802
+ * `Intl.DisplayNames` and the format hint uses the locale's numerals.
803
+ */
804
+ locale?: string;
805
+ /**
806
+ * Localized UI strings. A single bag covering the picker, validation errors, and a11y
807
+ * labels. Individual props (`searchPlaceholder`, `emptyText`, `loadingText`,
808
+ * `errorMessages`) take precedence over the matching `messages` key when both are set.
809
+ */
810
+ messages?: TellInputMessagesInput;
775
811
  /**
776
812
  * Whitelist of allowed dial-digit codes (no `+`), e.g. `['20', '966']`.
777
813
  * Countries outside this list are still shown in the picker but rendered as disabled.
@@ -854,6 +890,9 @@ export declare interface CountryOption<T = RestCountry> {
854
890
 
855
891
  export declare const DEFAULT_ERROR_MESSAGES: Record<PhoneValidationReason, string>;
856
892
 
893
+ /** English defaults for every {@link TellInputMessages} key. */
894
+ export declare const DEFAULT_MESSAGES: TellInputMessages;
895
+
857
896
  export declare const DEFAULT_SIZE: Size;
858
897
 
859
898
  /**
@@ -917,6 +956,30 @@ declare interface ExtendedProps extends ATellInputProps {
917
956
 
918
957
  export declare type FlagUrlBuilder = (iso2: string, width: number) => string;
919
958
 
959
+ /**
960
+ * Base code points of contiguous decimal-digit blocks. Each block runs `base`‥`base+9`
961
+ * for digit `0`‥`9`, so the ASCII digit is `codePoint - base`. Add a script by appending
962
+ * one entry here.
963
+ */
964
+ export declare const LOCALE_DIGIT_RANGES: {
965
+ name: string;
966
+ base: number;
967
+ }[];
968
+
969
+ /**
970
+ * Return a copy of the country list with display names localized to `locale` via
971
+ * `Intl.DisplayNames`. `search_key` is rebuilt (keeping the English name too) so search
972
+ * still matches either spelling. Unknown locales / regions fall back to the English name.
973
+ */
974
+ export declare function localizeCountries(list: CountryOption[], locale?: string): CountryOption[];
975
+
976
+ /**
977
+ * Replace any supported non-ASCII decimal digit with its ASCII equivalent. Every other
978
+ * character (spaces, `+`, separators, letters) is left untouched — callers still run their
979
+ * own `\D` cleanup afterwards.
980
+ */
981
+ export declare function normalizeDigits(input: string): string;
982
+
920
983
  export declare interface PhoneRequiredInfo {
921
984
  iso2: string;
922
985
  dial_code: string;
@@ -949,6 +1012,12 @@ export declare interface PhoneValidationResult {
949
1012
  details?: Record<string, unknown>;
950
1013
  }
951
1014
 
1015
+ /**
1016
+ * Merge a partial `messages` override onto the English defaults. Used internally by
1017
+ * `ATellInput` to resolve a complete {@link TellInputMessages} object.
1018
+ */
1019
+ export declare function resolveMessages(input?: TellInputMessagesInput): TellInputMessages;
1020
+
952
1021
  export declare interface RestCountry {
953
1022
  name?: {
954
1023
  common?: string;
@@ -978,6 +1047,36 @@ export declare type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
978
1047
 
979
1048
  export declare const SIZES: readonly Size[];
980
1049
 
1050
+ /**
1051
+ * Every user-facing string in the tell-input UI, bundled so a consumer can localize the
1052
+ * component in one prop. Each key has an English default in {@link DEFAULT_MESSAGES}.
1053
+ */
1054
+ export declare interface TellInputMessages {
1055
+ /** Placeholder of the country-picker search box. */
1056
+ searchPlaceholder: string;
1057
+ /** Shown when a search yields no countries. */
1058
+ emptyText: string;
1059
+ /** Shown while the country list is loading. */
1060
+ loadingText: string;
1061
+ /** Header of the "Suggested" group (current + recent picks). */
1062
+ suggestedLabel: string;
1063
+ /** Header of the full country list. */
1064
+ allCountriesLabel: string;
1065
+ /** Validation error text, keyed by reason. */
1066
+ errorMessages: Record<PhoneValidationReason, string>;
1067
+ /** Prefix of the country trigger's `aria-label`, e.g. `"Country: Egypt"`. */
1068
+ countryLabel: string;
1069
+ /** `aria-label` of the country trigger when no country is selected. */
1070
+ selectCountryLabel: string;
1071
+ /** `aria-label` of the phone input element. */
1072
+ phoneInputLabel: string;
1073
+ }
1074
+
1075
+ /** Partial override shape for the `messages` prop — every key (and every error reason) is optional. */
1076
+ export declare type TellInputMessagesInput = Partial<Omit<TellInputMessages, 'errorMessages'>> & {
1077
+ errorMessages?: Partial<Record<PhoneValidationReason, string>>;
1078
+ };
1079
+
981
1080
  /**
982
1081
  * Reactive wrapper. Kicks off detection in `onMounted` so SSR renders an empty value and the
983
1082
  * client patches in the real country once resolved.
@@ -1007,7 +1106,7 @@ export declare interface UsePhoneValidationReturn {
1007
1106
  getRequiredInfo(country: {
1008
1107
  iso2: string;
1009
1108
  dial_code?: string;
1010
- }): PhoneRequiredInfo | null;
1109
+ }, locale?: string): PhoneRequiredInfo | null;
1011
1110
  validate(input: ValidateArgs): PhoneValidationResult;
1012
1111
  }
1013
1112
 
@@ -1017,12 +1116,16 @@ export declare type ValidateArgs = {
1017
1116
  dial_code?: string;
1018
1117
  } | null | undefined;
1019
1118
  phone?: undefined;
1119
+ /** BCP-47 locale — localizes the numerals in the returned `required.format_hint`. */
1120
+ locale?: string;
1020
1121
  } | {
1021
1122
  country: {
1022
1123
  iso2: string;
1023
1124
  dial_code?: string;
1024
1125
  } | null | undefined;
1025
1126
  phone: string | null;
1127
+ /** BCP-47 locale — localizes the numerals in the returned `required.format_hint`. */
1128
+ locale?: string;
1026
1129
  };
1027
1130
 
1028
1131
  export { }
package/dist/index.mjs CHANGED
@@ -1,37 +1,43 @@
1
- import { _ as a } from "./chunks/AInput.vue_vue_type_script_setup_true_lang-BJUP7ePq.mjs";
2
- import { _ as s, a as t, b as n } from "./chunks/APopoverContent.vue_vue_type_script_setup_true_lang-BRqULKIg.mjs";
3
- import { _ as A, a as l, b as i, c } from "./chunks/ADrawerContent.vue_vue_type_script_setup_true_lang-BivIZvV1.mjs";
4
- import { _ as u, a as v, b as f } from "./chunks/AResponsivePopoverContent.vue_vue_type_script_setup_true_lang-CCGyy9Lp.mjs";
5
- import { _ as D, a as P, b as S, D as T, c as _, d, e as m, u as C, f as E } from "./chunks/ATellInput.vue_vue_type_script_setup_true_lang-B4lyNu_f.mjs";
6
- import { c as b } from "./chunks/cn-B6yFEsav.mjs";
7
- import { D as I, S as w, c as F, a as h, b as U, d as H } from "./chunks/sizes-B_9MfLkz.mjs";
1
+ import { _ as o } from "./chunks/AInput.vue_vue_type_script_setup_true_lang-BJUP7ePq.mjs";
2
+ import { _ as s, a as t, b as n, c as A } from "./chunks/APopoverContent.vue_vue_type_script_setup_true_lang-o1XhV9DM.mjs";
3
+ import { _ as p, a as i, b as c, c as g } from "./chunks/ADrawerContent.vue_vue_type_script_setup_true_lang-BivIZvV1.mjs";
4
+ import { _ as S, a as u, b as D } from "./chunks/AResponsivePopoverContent.vue_vue_type_script_setup_true_lang-BYEb5UBL.mjs";
5
+ import { _, a as P, b as T, D as f, c as x, L as C, d as m, e as d, f as I, l as R, n as y, r as L, u as b, g as F } from "./chunks/ATellInput.vue_vue_type_script_setup_true_lang-Bv_lLV_l.mjs";
6
+ import { c as G } from "./chunks/cn-B6yFEsav.mjs";
7
+ import { D as U, S as h, c as z, a as M, b as H, d as V } from "./chunks/sizes-B_9MfLkz.mjs";
8
8
  export {
9
- D as ACountryFlag,
9
+ _ as ACountryFlag,
10
10
  P as ACountrySelect,
11
- A as ADrawer,
12
- l as ADrawerContent,
13
- i as ADrawerOverlay,
14
- c as ADrawerTrigger,
15
- a as AInput,
11
+ p as ADrawer,
12
+ i as ADrawerContent,
13
+ c as ADrawerOverlay,
14
+ g as ADrawerTrigger,
15
+ o as AInput,
16
16
  s as APopover,
17
17
  t as APopoverContent,
18
- n as APopoverTrigger,
19
- u as AResponsivePopover,
20
- v as AResponsivePopoverContent,
21
- f as AResponsivePopoverTrigger,
22
- S as ATellInput,
23
- T as DEFAULT_ERROR_MESSAGES,
24
- I as DEFAULT_SIZE,
25
- w as SIZES,
26
- _ as aTellInputVariants,
27
- b as cn,
28
- F as controlHeight,
29
- h as controlHeightPx,
30
- U as controlPaddingX,
31
- H as controlTextSize,
18
+ n as APopoverOverlay,
19
+ A as APopoverTrigger,
20
+ S as AResponsivePopover,
21
+ u as AResponsivePopoverContent,
22
+ D as AResponsivePopoverTrigger,
23
+ T as ATellInput,
24
+ f as DEFAULT_ERROR_MESSAGES,
25
+ x as DEFAULT_MESSAGES,
26
+ U as DEFAULT_SIZE,
27
+ C as LOCALE_DIGIT_RANGES,
28
+ h as SIZES,
29
+ m as aTellInputVariants,
30
+ G as cn,
31
+ z as controlHeight,
32
+ M as controlHeightPx,
33
+ H as controlPaddingX,
34
+ V as controlTextSize,
32
35
  d as defaultFlagUrl,
33
- m as detectCountry,
34
- C as useCountryDetection,
35
- E as usePhoneValidation
36
+ I as detectCountry,
37
+ R as localizeCountries,
38
+ y as normalizeDigits,
39
+ L as resolveMessages,
40
+ b as useCountryDetection,
41
+ F as usePhoneValidation
36
42
  };
37
43
  //# sourceMappingURL=index.mjs.map
package/dist/popover.d.ts CHANGED
@@ -41,11 +41,17 @@ overlay: boolean;
41
41
 
42
42
  declare type __VLS_Props = PopoverContentProps & {
43
43
  class?: HTMLAttributes['class'];
44
- /** Render a dimmed, clickable backdrop behind the popover. Pair with `<APopover modal>`. */
44
+ /** Dim the entire viewport behind the popover and block all interaction with the
45
+ * page (clicks are captured by the overlay; body scroll is locked while open).
46
+ * Pair with `<APopover :modal="true">` (the default) for the full modal behaviour. */
45
47
  overlay?: boolean;
46
48
  overlayClass?: HTMLAttributes['class'];
47
49
  };
48
50
 
51
+ declare type __VLS_Props_2 = {
52
+ class?: HTMLAttributes['class'];
53
+ };
54
+
49
55
  declare function __VLS_template(): {
50
56
  attrs: Partial<{}>;
51
57
  slots: {
@@ -104,6 +110,8 @@ export declare const APopover: __VLS_WithTemplateSlots<typeof __VLS_component, _
104
110
 
105
111
  export declare const APopoverContent: __VLS_WithTemplateSlots_3<typeof __VLS_component_3, __VLS_TemplateResult_3["slots"]>;
106
112
 
113
+ export declare const APopoverOverlay: DefineComponent<__VLS_Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_2> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
114
+
107
115
  export declare const APopoverTrigger: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
108
116
 
109
117
  export { }
package/dist/popover.mjs CHANGED
@@ -1,7 +1,8 @@
1
- import { _ as e, a, b as p } from "./chunks/APopoverContent.vue_vue_type_script_setup_true_lang-BRqULKIg.mjs";
1
+ import { _ as e, a, b as p, c as v } from "./chunks/APopoverContent.vue_vue_type_script_setup_true_lang-o1XhV9DM.mjs";
2
2
  export {
3
3
  e as APopover,
4
4
  a as APopoverContent,
5
- p as APopoverTrigger
5
+ p as APopoverOverlay,
6
+ v as APopoverTrigger
6
7
  };
7
8
  //# sourceMappingURL=popover.mjs.map
@@ -1,4 +1,4 @@
1
- import { _ as s, a as p, b as r } from "./chunks/AResponsivePopoverContent.vue_vue_type_script_setup_true_lang-CCGyy9Lp.mjs";
1
+ import { _ as s, a as p, b as r } from "./chunks/AResponsivePopoverContent.vue_vue_type_script_setup_true_lang-BYEb5UBL.mjs";
2
2
  export {
3
3
  s as AResponsivePopover,
4
4
  p as AResponsivePopoverContent,
@@ -49,6 +49,8 @@ emptyText: string;
49
49
  loadingText: string;
50
50
  suggestedLabel: string;
51
51
  allCountriesLabel: string;
52
+ countryLabel: string;
53
+ selectCountryLabel: string;
52
54
  suggestedLimit: number;
53
55
  maxResults: number;
54
56
  kbdOpen: string | null;
@@ -96,6 +98,12 @@ declare type __VLS_Props_2 = {
96
98
  /** Override the right-side kbd hints. Pass `null` to hide. */
97
99
  kbdOpen?: string | null;
98
100
  kbdClose?: string | null;
101
+ /** BCP-47 locale — country names render localized via `Intl.DisplayNames`. */
102
+ locale?: string;
103
+ /** Prefix of the trigger's `aria-label` when a country is selected, e.g. `"Country"`. */
104
+ countryLabel?: string;
105
+ /** Trigger's `aria-label` when no country is selected. */
106
+ selectCountryLabel?: string;
99
107
  };
100
108
 
101
109
  declare type __VLS_Props_3 = {
@@ -391,12 +399,32 @@ export declare const ACountrySelect: __VLS_WithTemplateSlots_2<typeof __VLS_comp
391
399
 
392
400
  export declare const ATellInput: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
393
401
 
402
+ /** Text direction for the field. `'auto'` (or omitting the prop) inherits from the
403
+ * nearest `[dir]` ancestor / `<html dir>`; `'ltr'` / `'rtl'` force it. */
404
+ export declare type ATellInputDir = 'ltr' | 'rtl' | 'auto';
405
+
394
406
  export declare interface ATellInputProps {
395
407
  class?: HTMLAttributes['class'];
396
408
  placeholder?: string;
397
409
  disabled?: boolean;
398
410
  loading?: boolean;
399
411
  size?: ATellInputSize;
412
+ /**
413
+ * Text direction. Omit (or pass `'auto'`) to inherit from the page — RTL pages get an
414
+ * RTL field automatically. Pass `'ltr'` / `'rtl'` to force it.
415
+ */
416
+ dir?: ATellInputDir;
417
+ /**
418
+ * BCP-47 locale (e.g. `'ar'`, `'fr'`). When set, country names render localized via
419
+ * `Intl.DisplayNames` and the format hint uses the locale's numerals.
420
+ */
421
+ locale?: string;
422
+ /**
423
+ * Localized UI strings. A single bag covering the picker, validation errors, and a11y
424
+ * labels. Individual props (`searchPlaceholder`, `emptyText`, `loadingText`,
425
+ * `errorMessages`) take precedence over the matching `messages` key when both are set.
426
+ */
427
+ messages?: TellInputMessagesInput;
400
428
  /**
401
429
  * Whitelist of allowed dial-digit codes (no `+`), e.g. `['20', '966']`.
402
430
  * Countries outside this list are still shown in the picker but rendered as disabled.
@@ -467,6 +495,9 @@ export declare interface CountryOption<T = RestCountry> {
467
495
 
468
496
  export declare const DEFAULT_ERROR_MESSAGES: Record<PhoneValidationReason, string>;
469
497
 
498
+ /** English defaults for every {@link TellInputMessages} key. */
499
+ export declare const DEFAULT_MESSAGES: TellInputMessages;
500
+
470
501
  /**
471
502
  * Default flag URL builder — flagcdn.com hosts PNG flags at multiple widths and is
472
503
  * generous with caching + no API key required. Swap via the `flagUrl` prop on
@@ -528,6 +559,30 @@ declare interface ExtendedProps extends ATellInputProps {
528
559
 
529
560
  export declare type FlagUrlBuilder = (iso2: string, width: number) => string;
530
561
 
562
+ /**
563
+ * Base code points of contiguous decimal-digit blocks. Each block runs `base`‥`base+9`
564
+ * for digit `0`‥`9`, so the ASCII digit is `codePoint - base`. Add a script by appending
565
+ * one entry here.
566
+ */
567
+ export declare const LOCALE_DIGIT_RANGES: {
568
+ name: string;
569
+ base: number;
570
+ }[];
571
+
572
+ /**
573
+ * Return a copy of the country list with display names localized to `locale` via
574
+ * `Intl.DisplayNames`. `search_key` is rebuilt (keeping the English name too) so search
575
+ * still matches either spelling. Unknown locales / regions fall back to the English name.
576
+ */
577
+ export declare function localizeCountries(list: CountryOption[], locale?: string): CountryOption[];
578
+
579
+ /**
580
+ * Replace any supported non-ASCII decimal digit with its ASCII equivalent. Every other
581
+ * character (spaces, `+`, separators, letters) is left untouched — callers still run their
582
+ * own `\D` cleanup afterwards.
583
+ */
584
+ export declare function normalizeDigits(input: string): string;
585
+
531
586
  export declare interface PhoneRequiredInfo {
532
587
  iso2: string;
533
588
  dial_code: string;
@@ -560,6 +615,12 @@ export declare interface PhoneValidationResult {
560
615
  details?: Record<string, unknown>;
561
616
  }
562
617
 
618
+ /**
619
+ * Merge a partial `messages` override onto the English defaults. Used internally by
620
+ * `ATellInput` to resolve a complete {@link TellInputMessages} object.
621
+ */
622
+ export declare function resolveMessages(input?: TellInputMessagesInput): TellInputMessages;
623
+
563
624
  export declare interface RestCountry {
564
625
  name?: {
565
626
  common?: string;
@@ -587,6 +648,36 @@ declare function selectCountry(option: CountryOption): void;
587
648
  */
588
649
  declare type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
589
650
 
651
+ /**
652
+ * Every user-facing string in the tell-input UI, bundled so a consumer can localize the
653
+ * component in one prop. Each key has an English default in {@link DEFAULT_MESSAGES}.
654
+ */
655
+ export declare interface TellInputMessages {
656
+ /** Placeholder of the country-picker search box. */
657
+ searchPlaceholder: string;
658
+ /** Shown when a search yields no countries. */
659
+ emptyText: string;
660
+ /** Shown while the country list is loading. */
661
+ loadingText: string;
662
+ /** Header of the "Suggested" group (current + recent picks). */
663
+ suggestedLabel: string;
664
+ /** Header of the full country list. */
665
+ allCountriesLabel: string;
666
+ /** Validation error text, keyed by reason. */
667
+ errorMessages: Record<PhoneValidationReason, string>;
668
+ /** Prefix of the country trigger's `aria-label`, e.g. `"Country: Egypt"`. */
669
+ countryLabel: string;
670
+ /** `aria-label` of the country trigger when no country is selected. */
671
+ selectCountryLabel: string;
672
+ /** `aria-label` of the phone input element. */
673
+ phoneInputLabel: string;
674
+ }
675
+
676
+ /** Partial override shape for the `messages` prop — every key (and every error reason) is optional. */
677
+ export declare type TellInputMessagesInput = Partial<Omit<TellInputMessages, 'errorMessages'>> & {
678
+ errorMessages?: Partial<Record<PhoneValidationReason, string>>;
679
+ };
680
+
590
681
  /**
591
682
  * Reactive wrapper. Kicks off detection in `onMounted` so SSR renders an empty value and the
592
683
  * client patches in the real country once resolved.
@@ -616,7 +707,7 @@ export declare interface UsePhoneValidationReturn {
616
707
  getRequiredInfo(country: {
617
708
  iso2: string;
618
709
  dial_code?: string;
619
- }): PhoneRequiredInfo | null;
710
+ }, locale?: string): PhoneRequiredInfo | null;
620
711
  validate(input: ValidateArgs): PhoneValidationResult;
621
712
  }
622
713
 
@@ -626,12 +717,16 @@ export declare type ValidateArgs = {
626
717
  dial_code?: string;
627
718
  } | null | undefined;
628
719
  phone?: undefined;
720
+ /** BCP-47 locale — localizes the numerals in the returned `required.format_hint`. */
721
+ locale?: string;
629
722
  } | {
630
723
  country: {
631
724
  iso2: string;
632
725
  dial_code?: string;
633
726
  } | null | undefined;
634
727
  phone: string | null;
728
+ /** BCP-47 locale — localizes the numerals in the returned `required.format_hint`. */
729
+ locale?: string;
635
730
  };
636
731
 
637
732
  export { }