"use client";
import type { SelectFieldClientComponent } from "payload";

import { SelectField } from "@payloadcms/ui";
import React from "react";
import { State } from "country-state-city";

const InputState: SelectFieldClientComponent = ({ field, ...props }) => {
  const statesData = State.getStatesOfCountry("US").map((st) => ({ value: st.isoCode, label: st.name }));
  field.options = statesData;
  return <SelectField field={field} {...props} />;
};

export default InputState;
