import type { ChangeEvent } from "react"; import type { ButtonGroupProps, ButtonProps, ConjsProps, FieldProps, ProviderProps, } from "react-awesome-query-builder"; import { Button as CalButton, SelectWithValidation as Select, TextField } from "@calcom/ui"; import { FiTrash, FiPlus } from "@calcom/ui/components/icon"; export type CommonProps< TVal extends | string | boolean | string[] | { value: string; optionValue: string; } > = { placeholder?: string; readOnly?: boolean; className?: 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 (