cal.pub0.org/packages/ui/form/AddressInput.tsx

52 lines
1.7 KiB
TypeScript
Raw Normal View History

import { UseFormReturn } from "react-hook-form";
import { Props } from "react-phone-number-input/react-hook-form";
import { EventLocationType } from "@calcom/app-store/locations";
import { FiMapPin } from "../components/icon";
type BookingFormValues = {
name: string;
email: string;
notes?: string;
locationType?: EventLocationType["type"];
Add additional guests (#6419) * Add additional guests * WIP * WIP * Type fix * WIP * Add validation for already invited attendees * Revert type to email * remove controlled fields * disables signups via env variable (#6212) * disables signups via env variable * Apply suggestions from code review Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Omar López <zomars@me.com> * Reusable Upgrade component for teams only features (#6473) Co-authored-by: CarinaWolli <wollencarina@gmail.com> * i18n udpate * fix: darkmode in booking/[id] page (#6458) * fix: text-area style * fix: border styles * fix: german translation for reschedule booking email subject (#6483) * fix: german translation for reschedule subject * fix: add a full stop * fix: app store spacing issues (#6481) * feat: add equal spacing with gap * fix: title style * fix: title style * fix: remove margin * fix: remove margin * fix: sub header spacing and slider button * fix: category card text * fix: app store spacing issues * fix: tab in tablet * fix: shell * fix: styling of dropdown component (#6440) * fix: styling of dropdown component Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> * Apply suggestions from code review * fix: use dropdown item in all pages Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> * chore: undo Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> Co-authored-by: Peer Richelsen <peeroke@gmail.com> * readding sidebar tips for everyone, added 3 more features to teams empty screen (#6475) * readding sidebar tips for everyone * added 3 more features to teams plan * responsive fixes * responsive fixes * small responsive fix * CTA alignment fixed * Minor alignment fixes to Shell for event-types/[type] Co-authored-by: Alex van Andel <me@alexvanandel.com> * fix: wrong i18n placeholder in many locales (#6496) * fix: czech translation * fix: spanish translation * fix: italian translation * fix: japanese translation * fix: korean translation * fix: dutch translation * fix: norwegian translation * fix: polish translation * fix: portuguese translation * fix: portuguese translation * fix: romanian translation * fix: russian translation * fix: serbian translation * fix: swedish translation * fix: turkish translation * fix: ukrainian translation * fix: vietnamese translation * fix: chinese simplified translation * fix: chinese traditional translation * Disable redirect for cancellation page (#6498) * [CAL-677] /event-type : Event Setup sidebar item doesn't reflect multiple durations (#6390) Co-authored-by: gitstart-calcom <gitstart@users.noreply.github.com> * Added fallback to hostsFixed too which is used in COLLECTIVE (#6500) * Don't update the field when changing the select (#6486) * Don't update the field when changing the select * Fixing missing label * Applied the correct y-8 vertical margin * Changed the description vertical offset from title a bit more * Add Trash icon on Availability list dropdown * fix: tablet sidebar profile being too wide and not centered (#6490) * feat: updated app list items styling issues inside settings/conferencing * feat: fixed tablet sidebar width and not centered issue * fix: removed un-related changes from this pr * deleted .env * fix: added the accidentaly deleted .env file * fix: removed unwanted .env file from the pr Co-authored-by: Peer Richelsen <peeroke@gmail.com> * Bring back PublicShell (#6505) * Add red text to error message * WIP * Rearrange guest input * Fix validate unique guests logic * Allow guests on reschedule * Lint fix * More lint fixes * Lint fixes * More lint fixes * Fix remove guest button margin --------- Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: Jeff Loiselle <jeff@loiselles.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Omar López <zomars@me.com> Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com> Co-authored-by: CarinaWolli <wollencarina@gmail.com> Co-authored-by: Peer Richelsen <peer@cal.com> Co-authored-by: Nafees Nazik <84864519+G3root@users.noreply.github.com> Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Co-authored-by: Alex van Andel <me@alexvanandel.com> Co-authored-by: Hariom Balhara <hariombalhara@gmail.com> Co-authored-by: GitStart-Cal.com <121884634+gitstart-calcom@users.noreply.github.com> Co-authored-by: gitstart-calcom <gitstart@users.noreply.github.com> Co-authored-by: Ronit Panda <72537293+rtpa25@users.noreply.github.com> Co-authored-by: Alan <alannnc@gmail.com>
2023-01-31 17:36:38 +00:00
guests?: { email: string }[];
address?: string;
attendeeAddress?: string;
phone?: string;
hostPhoneNumber?: string; // Maybe come up with a better way to name this to distingish between two types of phone numbers
customInputs?: {
[key: string]: string | boolean;
};
rescheduleReason?: string;
smsReminderNumber?: string;
};
export type AddressInputProps<FormValues> = Props<
{
value: string;
id: string;
placeholder: string;
required: boolean;
bookingForm: UseFormReturn<BookingFormValues>;
},
FormValues
>;
function AddressInput<FormValues>({ bookingForm, name, className, ...rest }: AddressInputProps<FormValues>) {
return (
<div className="relative ">
<FiMapPin color="#D2D2D2" className="absolute top-1/2 left-0.5 ml-3 h-6 -translate-y-1/2" />
<input
{...rest}
{...bookingForm.register("attendeeAddress")}
name={name}
color="#D2D2D2"
className={`${className} focus-within:border-brand dark:bg-darkgray-100 dark:border-darkgray-300 block h-10 w-full rounded-md border border border-gray-300 py-px pl-10 text-sm outline-none ring-black focus-within:ring-1 disabled:text-gray-500 disabled:opacity-50 dark:text-white dark:placeholder-gray-500 dark:selection:bg-green-500 disabled:dark:text-gray-500`}
/>
</div>
);
}
export default AddressInput;