| 
									
										
										
										
											2021-08-25 10:18:37 +00:00
										 |  |  | import React from "react"; | 
					
						
							| 
									
										
										
										
											2022-03-03 09:57:59 +00:00
										 |  |  | import { Control } from "react-hook-form"; | 
					
						
							|  |  |  | import BasePhoneInput, { Props } from "react-phone-number-input/react-hook-form"; | 
					
						
							| 
									
										
										
										
											2021-09-22 19:52:38 +00:00
										 |  |  | import "react-phone-number-input/style.css"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-25 10:18:37 +00:00
										 |  |  | import classNames from "@lib/classNames"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-03 09:57:59 +00:00
										 |  |  | type PhoneInputProps = { | 
					
						
							|  |  |  |   value: string; | 
					
						
							|  |  |  |   id: string; | 
					
						
							|  |  |  |   placeholder: string; | 
					
						
							|  |  |  |   required: boolean; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export const PhoneInput = ({ control, name, ...rest }: Props<PhoneInputProps>) => ( | 
					
						
							| 
									
										
										
										
											2021-08-25 10:18:37 +00:00
										 |  |  |   <BasePhoneInput | 
					
						
							| 
									
										
										
										
											2022-03-03 09:57:59 +00:00
										 |  |  |     {...rest} | 
					
						
							|  |  |  |     name={name} | 
					
						
							|  |  |  |     control={control} | 
					
						
							| 
									
										
										
										
											2021-08-25 10:18:37 +00:00
										 |  |  |     className={classNames( | 
					
						
							| 
									
										
										
										
											2022-03-03 09:57:59 +00:00
										 |  |  |       "border-1 focus-within:border-brand block w-full rounded-sm border border-gray-300 py-px px-3 shadow-sm ring-black focus-within:ring-1 dark:border-black dark:bg-black dark:text-white" | 
					
						
							| 
									
										
										
										
											2021-08-25 10:18:37 +00:00
										 |  |  |     )} | 
					
						
							|  |  |  |     onChange={() => { | 
					
						
							|  |  |  |       /* DO NOT REMOVE: Callback required by PhoneInput, comment added to satisfy eslint:no-empty-function */ | 
					
						
							|  |  |  |     }} | 
					
						
							|  |  |  |   /> | 
					
						
							|  |  |  | ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export default PhoneInput; |