import * as React from "react"; import { cn } from "@/lib/utils"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { DatePicker } from "@/components/ui/date-picker"; import { LoanOptionGroup, type LoanOptionItem, } from "@/components/ui/loan-option-group"; // ─── Option lists (mirror loan-application-constants.tsx) ───────────────────── const TITLE_OPTIONS: LoanOptionItem[] = [ { value: "Dr", label: "Dr" }, { value: "Miss", label: "Miss" }, { value: "Mrs", label: "Mrs" }, { value: "Mr", label: "Mr" }, { value: "Prof", label: "Prof" }, { value: "Rev", label: "Rev" }, ]; const GENDER_OPTIONS: LoanOptionItem[] = [ { value: "M", label: "Male" }, { value: "F", label: "Female" }, { value: "PS", label: "Prefer not to say" }, ]; const CITIZEN_STATUS_OPTIONS: LoanOptionItem[] = [ { value: "australian-citizen", label: "Australian Citizen" }, { value: "permanent-resident", label: "Permanent Resident" }, { value: "non-citizen", label: "Non-Citizen" }, ]; const APPLICANT_RELATIONSHIP_OPTIONS: LoanOptionItem[] = [ { value: "Married", label: "Married" }, { value: "DeFacto", label: "De Facto" }, { value: "Friend", label: "Friend" }, { value: "FamilyMember", label: "Family Member" }, ]; const MARITAL_STATUS_OPTIONS: LoanOptionItem[] = [ { value: "Single", label: "Single" }, { value: "Married", label: "Married" }, { value: "DeFacto", label: "De Facto" }, { value: "Separated", label: "Separated" }, { value: "Divorced", label: "Divorced" }, { value: "Widowed", label: "Widowed" }, ]; const YES_NO_OPTIONS: LoanOptionItem[] = [ { value: "Yes", label: "Yes" }, { value: "No", label: "No" }, ]; const PROPERTY_OWNERSHIP_OPTIONS: LoanOptionItem[] = [ { value: "trust", label: "Yes — via Trust" }, { value: "company", label: "Yes — via Company" }, { value: "no", label: "No" }, ]; export const MAX_DEPENDANTS = 20; // ─── Types ──────────────────────────────────────────────────────────────────── export type AboutYouFormData = { title?: string; gender?: string; citizenStatus?: string; /** Only relevant for joint applications */ applicantRelationship?: string; maritalStatus?: string; hasDependants?: "Yes" | "No"; dependants?: number; dependantDobs?: (Date | null)[]; /** Only relevant for joint applications where co-applicant is married/defacto */ childrenShared?: "Yes" | "No"; propertyOwnership?: "trust" | "company" | "no"; trustOrCompanyName?: string; tradingAs?: string; dateCommenced?: string; numberOfDirectors?: number | null; numberOfEmployees?: number | null; }; export type AboutYouFormProps = { /** Current form values */ data: AboutYouFormData; /** Called on every field change */ onChange: (data: AboutYouFormData) => void; /** * When provided, the Relationship field is shown with this label, * e.g. "Relationship with James Harbour" */ coApplicantName?: string; /** Whether this form is for the main applicant (affects relationship field visibility) */ isMainApplicant?: boolean; className?: string; }; // ─── Internal helpers ───────────────────────────────────────────────────────── type FieldRowProps = { label: string; htmlFor?: string; children: React.ReactNode; className?: string; }; function FieldRow({ label, htmlFor, children, className }: FieldRowProps) { return (