import dynamic from "next/dynamic"; import type { ChangeEvent } from "react"; import type { ButtonGroupProps, ButtonProps, ConjsProps, FieldProps, ProviderProps, } from "react-awesome-query-builder"; import { Button as CalButton, TextField, TextArea } from "@calcom/ui"; import { Trash, Plus } from "@calcom/ui/components/icon"; const Select = dynamic( async () => (await import("@calcom/ui")).SelectWithValidation ) as unknown as typeof import("@calcom/ui").SelectWithValidation; export type CommonProps< TVal extends | string | boolean | string[] | { value: string; optionValue: string; } > = { placeholder?: string; readOnly?: boolean; className?: string; name?: string; label?: string; value: TVal; setValue: (value: TVal) => void; /** * required and other validations are supported using zodResolver from react-hook-form */ // required?: boolean; }; export type SelectLikeComponentProps< TVal extends | string | string[] | { value: string; optionValue: string; } = string > = { options: { label: string; value: TVal extends (infer P)[] ? P : TVal extends { value: string; } ? TVal["value"] : TVal; }[]; } & CommonProps; export type SelectLikeComponentPropsRAQB = { listValues: { title: string; value: TVal extends (infer P)[] ? P : TVal }[]; } & CommonProps; export type TextLikeComponentProps = CommonProps & { name?: string; }; export type TextLikeComponentPropsRAQB = TextLikeComponentProps & { customProps?: object; type?: "text" | "number" | "email" | "tel"; maxLength?: number; noLabel?: boolean; }; const TextAreaWidget = (props: TextLikeComponentPropsRAQB) => { const { value, setValue, readOnly, placeholder, maxLength, customProps, ...remainingProps } = props; const onChange = (e: ChangeEvent) => { const val = e.target.value; setValue(val); }; const textValue = value || ""; return (