1"use client";
2
3import { Check, ChevronDown } from "lucide-react";
4import { Slot as SlotPrimitive } from "radix-ui";
5import * as React from "react";
6import { useComposedRefs } from "@/lib/compose-refs";
7import { cn } from "@/lib/utils";
8import { VisuallyHiddenInput } from "@/registry/bases/radix/components/visually-hidden-input";
9import { useAsRef } from "@/registry/bases/radix/hooks/use-as-ref";
10import { useIsomorphicLayoutEffect } from "@/registry/bases/radix/hooks/use-isomorphic-layout-effect";
11import { useLazyRef } from "@/registry/bases/radix/hooks/use-lazy-ref";
12import {
13 Command,
14 CommandEmpty,
15 CommandGroup,
16 CommandInput,
17 CommandItem,
18 CommandList,
19} from "@/registry/bases/radix/ui/command";
20import { Input } from "@/registry/bases/radix/ui/input";
21import {
22 Popover,
23 PopoverContent,
24 PopoverTrigger,
25} from "@/registry/bases/radix/ui/popover";
26
27const ROOT_NAME = "PhoneInput";
28const COUNTRY_SELECT_NAME = "PhoneInputCountrySelect";
29const FIELD_NAME = "PhoneInputField";
30
31/**
32 * @see https://github.com/mukeshsoni/country-telephone-data/blob/master/country_telephone_data.js
33 * @format [iso2, dialCode]
34 */
35const COUNTRY_DATA: [string, string][] = [
36 ["af", "93"],
37 ["ax", "358"],
38 ["al", "355"],
39 ["dz", "213"],
40 ["as", "1684"],
41 ["ad", "376"],
42 ["ao", "244"],
43 ["ai", "1264"],
44 ["ag", "1268"],
45 ["ar", "54"],
46 ["am", "374"],
47 ["aw", "297"],
48 ["au", "61"],
49 ["at", "43"],
50 ["az", "994"],
51 ["bs", "1242"],
52 ["bh", "973"],
53 ["bd", "880"],
54 ["bb", "1246"],
55 ["by", "375"],
56 ["be", "32"],
57 ["bz", "501"],
58 ["bj", "229"],
59 ["bm", "1441"],
60 ["bt", "975"],
61 ["bo", "591"],
62 ["ba", "387"],
63 ["bw", "267"],
64 ["br", "55"],
65 ["io", "246"],
66 ["vg", "1284"],
67 ["bn", "673"],
68 ["bg", "359"],
69 ["bf", "226"],
70 ["bi", "257"],
71 ["kh", "855"],
72 ["cm", "237"],
73 ["ca", "1"],
74 ["cv", "238"],
75 ["bq", "599"],
76 ["ky", "1345"],
77 ["cf", "236"],
78 ["td", "235"],
79 ["cl", "56"],
80 ["cn", "86"],
81 ["co", "57"],
82 ["km", "269"],
83 ["cd", "243"],
84 ["cg", "242"],
85 ["ck", "682"],
86 ["cr", "506"],
87 ["ci", "225"],
88 ["hr", "385"],
89 ["cu", "53"],
90 ["cw", "599"],
91 ["cy", "357"],
92 ["cz", "420"],
93 ["dk", "45"],
94 ["dj", "253"],
95 ["dm", "1767"],
96 ["do", "1"],
97 ["ec", "593"],
98 ["eg", "20"],
99 ["sv", "503"],
100 ["gq", "240"],
101 ["er", "291"],
102 ["ee", "372"],
103 ["et", "251"],
104 ["fk", "500"],
105 ["fo", "298"],
106 ["fj", "679"],
107 ["fi", "358"],
108 ["fr", "33"],
109 ["gf", "594"],
110 ["pf", "689"],
111 ["ga", "241"],
112 ["gm", "220"],
113 ["ge", "995"],
114 ["de", "49"],
115 ["gh", "233"],
116 ["gi", "350"],
117 ["gr", "30"],
118 ["gl", "299"],
119 ["gd", "1473"],
120 ["gp", "590"],
121 ["gu", "1671"],
122 ["gt", "502"],
123 ["gg", "44"],
124 ["gn", "224"],
125 ["gw", "245"],
126 ["gy", "592"],
127 ["ht", "509"],
128 ["hn", "504"],
129 ["hk", "852"],
130 ["hu", "36"],
131 ["is", "354"],
132 ["in", "91"],
133 ["id", "62"],
134 ["ir", "98"],
135 ["iq", "964"],
136 ["ie", "353"],
137 ["im", "44"],
138 ["il", "972"],
139 ["it", "39"],
140 ["jm", "1876"],
141 ["jp", "81"],
142 ["je", "44"],
143 ["jo", "962"],
144 ["kz", "7"],
145 ["ke", "254"],
146 ["ki", "686"],
147 ["xk", "383"],
148 ["kw", "965"],
149 ["kg", "996"],
150 ["la", "856"],
151 ["lv", "371"],
152 ["lb", "961"],
153 ["ls", "266"],
154 ["lr", "231"],
155 ["ly", "218"],
156 ["li", "423"],
157 ["lt", "370"],
158 ["lu", "352"],
159 ["mo", "853"],
160 ["mk", "389"],
161 ["mg", "261"],
162 ["mw", "265"],
163 ["my", "60"],
164 ["mv", "960"],
165 ["ml", "223"],
166 ["mt", "356"],
167 ["mh", "692"],
168 ["mq", "596"],
169 ["mr", "222"],
170 ["mu", "230"],
171 ["mx", "52"],
172 ["fm", "691"],
173 ["md", "373"],
174 ["mc", "377"],
175 ["mn", "976"],
176 ["me", "382"],
177 ["ms", "1664"],
178 ["ma", "212"],
179 ["mz", "258"],
180 ["mm", "95"],
181 ["na", "264"],
182 ["nr", "674"],
183 ["np", "977"],
184 ["nl", "31"],
185 ["nc", "687"],
186 ["nz", "64"],
187 ["ni", "505"],
188 ["ne", "227"],
189 ["ng", "234"],
190 ["nu", "683"],
191 ["nf", "672"],
192 ["kp", "850"],
193 ["mp", "1670"],
194 ["no", "47"],
195 ["om", "968"],
196 ["pk", "92"],
197 ["pw", "680"],
198 ["ps", "970"],
199 ["pa", "507"],
200 ["pg", "675"],
201 ["py", "595"],
202 ["pe", "51"],
203 ["ph", "63"],
204 ["pl", "48"],
205 ["pt", "351"],
206 ["pr", "1"],
207 ["qa", "974"],
208 ["re", "262"],
209 ["ro", "40"],
210 ["ru", "7"],
211 ["rw", "250"],
212 ["bl", "590"],
213 ["sh", "290"],
214 ["kn", "1869"],
215 ["lc", "1758"],
216 ["mf", "590"],
217 ["pm", "508"],
218 ["vc", "1784"],
219 ["ws", "685"],
220 ["sm", "378"],
221 ["st", "239"],
222 ["sa", "966"],
223 ["sn", "221"],
224 ["rs", "381"],
225 ["sc", "248"],
226 ["sl", "232"],
227 ["sg", "65"],
228 ["sx", "1721"],
229 ["sk", "421"],
230 ["si", "386"],
231 ["sb", "677"],
232 ["so", "252"],
233 ["za", "27"],
234 ["kr", "82"],
235 ["ss", "211"],
236 ["es", "34"],
237 ["lk", "94"],
238 ["sd", "249"],
239 ["sr", "597"],
240 ["sz", "268"],
241 ["se", "46"],
242 ["ch", "41"],
243 ["sy", "963"],
244 ["tw", "886"],
245 ["tj", "992"],
246 ["tz", "255"],
247 ["th", "66"],
248 ["tl", "670"],
249 ["tg", "228"],
250 ["tk", "690"],
251 ["to", "676"],
252 ["tt", "1868"],
253 ["tn", "216"],
254 ["tr", "90"],
255 ["tm", "993"],
256 ["tc", "1649"],
257 ["tv", "688"],
258 ["vi", "1340"],
259 ["ug", "256"],
260 ["ua", "380"],
261 ["ae", "971"],
262 ["gb", "44"],
263 ["us", "1"],
264 ["uy", "598"],
265 ["uz", "998"],
266 ["vu", "678"],
267 ["va", "39"],
268 ["ve", "58"],
269 ["vn", "84"],
270 ["wf", "681"],
271 ["eh", "212"],
272 ["ye", "967"],
273 ["zm", "260"],
274 ["zw", "263"],
275];
276
277interface Country {
278 code: string;
279 name: string;
280 dialCode: string;
281 flag?: string;
282}
283
284function getCountryName(countryCode: string, locale = "en"): string {
285 try {
286 const regionNames = new Intl.DisplayNames([locale], { type: "region" });
287 return regionNames.of(countryCode) ?? countryCode;
288 } catch {
289 return countryCode;
290 }
291}
292
293function getFlagEmoji(countryCode: string): string {
294 const codePoints = countryCode
295 .toUpperCase()
296 .split("")
297 .map((char) => 127397 + char.charCodeAt(0));
298 return String.fromCodePoint(...codePoints);
299}
300
301function getCountries(): Country[] {
302 return COUNTRY_DATA.map(([iso2, dialCode]): Country => {
303 const code = iso2.toUpperCase();
304 return {
305 code,
306 name: getCountryName(code),
307 dialCode: `+${dialCode}`,
308 flag: getFlagEmoji(code),
309 };
310 }).sort((a, b) => a.name.localeCompare(b.name));
311}
312
313function detectCountryFromNumber(
314 value: string,
315 countries: Country[],
316): Country | undefined {
317 if (!value?.startsWith("+")) return undefined;
318
319 const digits = value.slice(1).replace(/\D/g, "");
320 if (!digits) return undefined;
321
322 const sorted = [...countries].sort(
323 (a, b) => b.dialCode.length - a.dialCode.length,
324 );
325
326 const matches: Country[] = [];
327 for (const country of sorted) {
328 const dialCode = country.dialCode.slice(1);
329 if (digits.startsWith(dialCode)) {
330 matches.push(country);
331 }
332 }
333
334 if (matches.length === 0) return undefined;
335
336 if (matches.length > 1 && matches[0]?.dialCode === "+1") {
337 const usCountry = matches.find((c) => c.code === "US");
338 if (usCountry) return usCountry;
339 }
340
341 return matches[0];
342}
343
344function formatPhoneNumber(value: string, countries: Country[]): string {
345 if (!value) return "";
346
347 const normalized = value.startsWith("+") ? value : `+${value}`;
348
349 const digits = normalized.slice(1).replace(/\D/g, "");
350 if (!digits) return "+";
351
352 const detected = detectCountryFromNumber(`+${digits}`, countries);
353 const dialCodeLength = detected
354 ? detected.dialCode.slice(1).length
355 : Math.min(digits.length, 3);
356
357 const countryCode = digits.slice(0, dialCodeLength);
358 const rest = digits.slice(dialCodeLength);
359
360 let formatted = `+${countryCode}`;
361
362 if (rest) {
363 formatted += " ";
364 for (let i = 0; i < rest.length; i++) {
365 if (i > 0 && i % 3 === 0) {
366 formatted += " ";
367 }
368 formatted += rest[i];
369 }
370 }
371
372 return formatted;
373}
374
375type RootElement = React.ComponentRef<typeof PhoneInput>;
376
377interface StoreState {
378 value: string;
379 country: string;
380 open: boolean;
381 startsWithPlus: boolean;
382}
383
384interface Store {
385 subscribe: (callback: () => void) => () => void;
386 getState: () => StoreState;
387 setState: <K extends keyof StoreState>(key: K, value: StoreState[K]) => void;
388 notify: () => void;
389}
390
391const StoreContext = React.createContext<Store | null>(null);
392
393function useStoreContext(consumerName: string) {
394 const context = React.useContext(StoreContext);
395 if (!context) {
396 throw new Error(`\`${consumerName}\` must be used within \`${ROOT_NAME}\``);
397 }
398 return context;
399}
400
401function useStore<T>(
402 selector: (state: StoreState) => T,
403 ogStore?: Store | null,
404): T {
405 const contextStore = React.useContext(StoreContext);
406
407 const store = ogStore ?? contextStore;
408
409 if (!store) {
410 throw new Error(`\`useStore\` must be used within \`${ROOT_NAME}\``);
411 }
412
413 const getSnapshot = React.useCallback(
414 () => selector(store.getState()),
415 [store, selector],
416 );
417
418 return React.useSyncExternalStore(store.subscribe, getSnapshot, getSnapshot);
419}
420
421interface PhoneInputContextValue {
422 rootId: string;
423 countries: Country[];
424 placeholder: string;
425 disabled?: boolean;
426 readOnly?: boolean;
427 required?: boolean;
428 invalid?: boolean;
429 showFlag: boolean;
430 inputRef: React.RefObject<HTMLInputElement | null>;
431}
432
433const PhoneInputContext = React.createContext<PhoneInputContextValue | null>(
434 null,
435);
436
437function usePhoneInputContext(consumerName: string) {
438 const context = React.useContext(PhoneInputContext);
439 if (!context) {
440 throw new Error(`\`${consumerName}\` must be used within \`${ROOT_NAME}\``);
441 }
442 return context;
443}
444
445interface PhoneInputProps extends React.ComponentProps<"div"> {
446 defaultValue?: string;
447 value?: string;
448 onValueChange?: (value: string) => void;
449 defaultCountry?: string;
450 country?: string;
451 onCountryChange?: (country: string) => void;
452 countries?: Country[];
453 name?: string;
454 placeholder?: string;
455 asChild?: boolean;
456 disabled?: boolean;
457 readOnly?: boolean;
458 required?: boolean;
459 invalid?: boolean;
460 showFlag?: boolean;
461}
462
463function PhoneInput(props: PhoneInputProps) {
464 const {
465 value: valueProp,
466 defaultValue,
467 defaultCountry,
468 country: countryProp,
469 onValueChange,
470 onCountryChange,
471 countries = getCountries(),
472 name,
473 placeholder = "Enter phone number",
474 asChild,
475 disabled,
476 required,
477 readOnly,
478 invalid,
479 showFlag = true,
480 className,
481 id,
482 ref,
483 ...rootProps
484 } = props;
485
486 const instanceId = React.useId();
487 const rootId = id ?? instanceId;
488
489 const inputRef = React.useRef<HTMLInputElement>(null);
490
491 const [formTrigger, setFormTrigger] = React.useState<RootElement | null>(
492 null,
493 );
494 const composedRef = useComposedRefs(ref, (node) => setFormTrigger(node));
495 const isFormControl = formTrigger ? !!formTrigger.closest("form") : true;
496
497 const listenersRef = useLazyRef(() => new Set<() => void>());
498 const stateRef = useLazyRef<StoreState>(() => {
499 const initialValue = valueProp ?? defaultValue ?? "";
500 const initialCountry = countryProp ?? defaultCountry ?? "";
501
502 return {
503 value: initialValue,
504 country: initialCountry,
505 open: false,
506 startsWithPlus: initialValue.startsWith("+"),
507 };
508 });
509
510 const propsRef = useAsRef({
511 onValueChange,
512 onCountryChange,
513 });
514
515 const store = React.useMemo<Store>(() => {
516 return {
517 subscribe: (cb) => {
518 listenersRef.current.add(cb);
519 return () => listenersRef.current.delete(cb);
520 },
521 getState: () => stateRef.current,
522 setState: (key, value) => {
523 if (Object.is(stateRef.current[key], value)) return;
524
525 if (key === "value" && typeof value === "string") {
526 stateRef.current.value = value;
527 propsRef.current.onValueChange?.(value);
528 } else if (key === "country" && typeof value === "string") {
529 stateRef.current.country = value;
530 propsRef.current.onCountryChange?.(value);
531 } else {
532 stateRef.current[key] = value;
533 }
534
535 store.notify();
536 },
537 notify: () => {
538 for (const cb of listenersRef.current) {
539 cb();
540 }
541 },
542 };
543 }, [listenersRef, stateRef, propsRef]);
544
545 const value = useStore((state) => state.value, store);
546 const country = useStore((state) => state.country, store);
547
548 useIsomorphicLayoutEffect(() => {
549 if (valueProp !== undefined) {
550 store.setState("value", valueProp);
551 }
552 }, [valueProp]);
553
554 useIsomorphicLayoutEffect(() => {
555 if (countryProp !== undefined) {
556 store.setState("country", countryProp);
557 }
558 }, [countryProp]);
559
560 const startsWithPlus = useStore((state) => state.startsWithPlus, store);
561
562 React.useEffect(() => {
563 if (!value) return;
564
565 const digits = value.slice(1).replace(/\D/g, "");
566 const shouldDetect = startsWithPlus || digits.length >= 10;
567
568 if (!shouldDetect) return;
569
570 const detected = detectCountryFromNumber(value, countries);
571 if (detected && detected.code !== country) {
572 store.setState("country", detected.code);
573 }
574 }, [value, countries, country, store, startsWithPlus]);
575
576 const contextValue = React.useMemo<PhoneInputContextValue>(
577 () => ({
578 rootId,
579 countries,
580 placeholder,
581 disabled,
582 readOnly,
583 required,
584 invalid,
585 showFlag,
586 inputRef,
587 }),
588 [
589 rootId,
590 countries,
591 placeholder,
592 disabled,
593 required,
594 readOnly,
595 invalid,
596 showFlag,
597 ],
598 );
599
600 const RootPrimitive = asChild ? SlotPrimitive.Slot : "div";
601
602 return (
603 <StoreContext.Provider value={store}>
604 <PhoneInputContext.Provider value={contextValue}>
605 <RootPrimitive
606 role="group"
607 data-slot="phone-input"
608 data-disabled={disabled ? "" : undefined}
609 data-invalid={invalid ? "" : undefined}
610 data-readonly={readOnly ? "" : undefined}
611 id={rootId}
612 {...rootProps}
613 ref={composedRef}
614 className={cn(
615 "relative flex h-10 w-full items-center rounded-md border border-input bg-background transition-colors has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot=input-group-control]:focus-visible]:ring-[3px] has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:ring-[3px] has-[[data-slot][aria-invalid=true]]:ring-destructive/20 data-disabled:cursor-not-allowed data-disabled:opacity-50 dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",
616 className,
617 )}
618 />
619 {isFormControl && (
620 <VisuallyHiddenInput
621 type="hidden"
622 control={formTrigger}
623 name={name}
624 value={value}
625 disabled={disabled}
626 readOnly={readOnly}
627 required={required}
628 />
629 )}
630 </PhoneInputContext.Provider>
631 </StoreContext.Provider>
632 );
633}
634
635interface PhoneInputCountrySelectProps
636 extends React.ComponentProps<typeof Popover>,
637 Pick<
638 React.ComponentProps<typeof PopoverTrigger>,
639 "disabled" | "className"
640 > {}
641
642function PhoneInputCountrySelect(props: PhoneInputCountrySelectProps) {
643 const {
644 disabled: disabledProp,
645 className,
646 children,
647 onOpenChange: onOpenChangeProp,
648 ...popoverProps
649 } = props;
650
651 const { countries, inputRef, disabled, showFlag } =
652 usePhoneInputContext(COUNTRY_SELECT_NAME);
653 const store = useStoreContext(COUNTRY_SELECT_NAME);
654 const country = useStore((state) => state.country);
655 const open = useStore((state) => state.open);
656 const onOpenChangeRef = useAsRef(onOpenChangeProp);
657
658 const isDisabled = disabledProp || disabled;
659
660 const countryContext = countries.find((c) => c.code === country);
661
662 const onOpenChange = React.useCallback(
663 (open: boolean) => {
664 store.setState("open", open);
665 onOpenChangeRef.current?.(open);
666 },
667 [store, onOpenChangeRef],
668 );
669
670 return (
671 <Popover open={open} onOpenChange={onOpenChange} {...popoverProps}>
672 <PopoverTrigger
673 data-slot="phone-input-country-select"
674 disabled={isDisabled}
675 className={cn(
676 "flex h-full shrink-0 items-center gap-2 rounded-l-md border-input border-r bg-transparent px-3 text-sm transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:z-10 focus-visible:border-ring focus-visible:outline-hidden focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
677 className,
678 )}
679 >
680 {!countryContext ? (
681 <div className="h-4 w-6 rounded bg-muted/50" />
682 ) : (
683 showFlag &&
684 countryContext.flag && (
685 <div className="w-6 text-lg leading-none">
686 {countryContext.flag}
687 </div>
688 )
689 )}
690 <ChevronDown className="size-4 opacity-50" />
691 </PopoverTrigger>
692 <PopoverContent className="w-[300px] p-0" align="start">
693 <Command>
694 <CommandInput placeholder="Search country..." />
695 <CommandList>
696 <CommandEmpty>No country found.</CommandEmpty>
697 <CommandGroup>
698 {countries.map((c) => (
699 <CommandItem
700 key={c.code}
701 value={`${c.name} ${c.dialCode} ${c.code}`}
702 onSelect={() => {
703 store.setState("country", c.code);
704 store.setState("open", false);
705 requestAnimationFrame(() => {
706 inputRef.current?.focus();
707 });
708 }}
709 >
710 {showFlag && c.flag && (
711 <span className="text-lg">{c.flag}</span>
712 )}
713 <span className="flex-1">{c.name}</span>
714 <span className="text-muted-foreground">{c.dialCode}</span>
715 <Check
716 className={cn(
717 "size-4",
718 country === c.code ? "opacity-100" : "opacity-0",
719 )}
720 />
721 </CommandItem>
722 ))}
723 </CommandGroup>
724 </CommandList>
725 </Command>
726 </PopoverContent>
727 </Popover>
728 );
729}
730
731function PhoneInputField(props: React.ComponentProps<"input">) {
732 const {
733 onChange: onChangeProp,
734 className,
735 disabled: disabledProp,
736 readOnly: readOnlyProp,
737 required: requiredProp,
738 ref,
739 ...inputProps
740 } = props;
741
742 const {
743 inputRef,
744 disabled,
745 invalid,
746 readOnly,
747 required,
748 placeholder,
749 countries,
750 } = usePhoneInputContext(FIELD_NAME);
751 const store = useStoreContext(FIELD_NAME);
752 const value = useStore((state) => state.value);
753
754 const composedRef = useComposedRefs(ref, inputRef);
755
756 const onChangeRef = useAsRef(onChangeProp);
757
758 const isDisabled = disabledProp || disabled;
759 const isReadOnly = readOnlyProp || readOnly;
760 const isRequired = requiredProp || required;
761
762 const onChange = React.useCallback(
763 (event: React.ChangeEvent<HTMLInputElement>) => {
764 if (isDisabled || isReadOnly) return;
765
766 onChangeRef.current?.(event);
767 if (event.defaultPrevented) return;
768
769 const inputValue = event.target.value;
770
771 const startsWithPlus = inputValue.startsWith("+");
772 const digits = inputValue.replace(/\D/g, "");
773 const newValue = digits ? `+${digits}` : startsWithPlus ? "+" : "";
774 store.setState("startsWithPlus", startsWithPlus);
775 store.setState("value", newValue);
776 },
777 [store, onChangeRef, isDisabled, isReadOnly],
778 );
779
780 const displayValue = React.useMemo(() => {
781 return formatPhoneNumber(value, countries);
782 }, [value, countries]);
783
784 return (
785 <Input
786 type="tel"
787 inputMode="tel"
788 aria-required={isRequired}
789 aria-invalid={invalid}
790 data-slot="phone-input-field"
791 disabled={isDisabled}
792 readOnly={isReadOnly}
793 required={isRequired}
794 {...inputProps}
795 ref={composedRef}
796 className={cn(
797 "h-full flex-1 rounded-r-md rounded-l-none border-0 bg-transparent shadow-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:bg-transparent aria-invalid:border-destructive aria-invalid:ring-[3px] aria-invalid:ring-destructive/20 dark:bg-transparent dark:aria-invalid:ring-destructive/40 dark:disabled:bg-transparent",
798 className,
799 )}
800 placeholder={placeholder}
801 value={displayValue}
802 onChange={onChange}
803 />
804 );
805}
806
807export {
808 PhoneInput,
809 PhoneInputCountrySelect,
810 PhoneInputField,
811 type PhoneInputProps,
812 useStore as usePhoneInput,
813};
814