| 
									
										
										
										
											2021-09-22 11:04:32 +00:00
										 |  |  | import React, { forwardRef, InputHTMLAttributes } from "react"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type Props = InputHTMLAttributes<HTMLInputElement> & { | 
					
						
							| 
									
										
										
										
											2022-01-25 00:31:05 +00:00
										 |  |  |   label: React.ReactNode; | 
					
						
							| 
									
										
										
										
											2021-09-22 11:04:32 +00:00
										 |  |  |   description: string; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const CheckboxField = forwardRef<HTMLInputElement, Props>(({ label, description, ...rest }, ref) => { | 
					
						
							|  |  |  |   return ( | 
					
						
							| 
									
										
										
										
											2022-02-09 00:05:13 +00:00
										 |  |  |     <div className="block items-center sm:flex"> | 
					
						
							| 
									
										
										
										
											2022-02-09 22:32:31 +00:00
										 |  |  |       <div className="min-w-48 mb-4 sm:mb-0"> | 
					
						
							| 
									
										
										
										
											2021-09-22 11:04:32 +00:00
										 |  |  |         <label htmlFor={rest.id} className="flex text-sm font-medium text-neutral-700"> | 
					
						
							|  |  |  |           {label} | 
					
						
							|  |  |  |         </label> | 
					
						
							|  |  |  |       </div> | 
					
						
							|  |  |  |       <div className="w-full"> | 
					
						
							|  |  |  |         <div className="relative flex items-start"> | 
					
						
							| 
									
										
										
										
											2022-02-09 00:05:13 +00:00
										 |  |  |           <div className="flex h-5 items-center"> | 
					
						
							| 
									
										
										
										
											2021-09-22 11:04:32 +00:00
										 |  |  |             <input | 
					
						
							|  |  |  |               {...rest} | 
					
						
							|  |  |  |               ref={ref} | 
					
						
							|  |  |  |               type="checkbox" | 
					
						
							| 
									
										
										
										
											2022-02-09 22:32:31 +00:00
										 |  |  |               className="text-primary-600 focus:ring-primary-500 h-4 w-4 rounded border-gray-300" | 
					
						
							| 
									
										
										
										
											2021-09-22 11:04:32 +00:00
										 |  |  |             /> | 
					
						
							|  |  |  |           </div> | 
					
						
							| 
									
										
										
										
											2022-02-09 00:05:13 +00:00
										 |  |  |           <div className="text-sm ltr:ml-3 rtl:mr-3"> | 
					
						
							| 
									
										
										
										
											2021-09-22 11:04:32 +00:00
										 |  |  |             <p className="text-neutral-900">{description}</p> | 
					
						
							|  |  |  |           </div> | 
					
						
							|  |  |  |         </div> | 
					
						
							|  |  |  |       </div> | 
					
						
							|  |  |  |     </div> | 
					
						
							|  |  |  |   ); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | CheckboxField.displayName = "CheckboxField"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export default CheckboxField; |