import React, { useCallback } from "react"; import { EnumType, FieldProps } from "../../types"; import { FieldHelperText, LabelWithIcon } from "../components"; import { EnumValuesChip } from "../../preview"; import { getIconForProperty } from "../../util"; import { ClearIcon, cn, IconButton, Select, SelectItem } from "@firecms/ui"; import { useClearRestoreValue } from "../useClearRestoreValue"; type SelectProps = FieldProps; /** * If `enumValues` are set in the string config, this field renders a select * where each option is a colored chip. * * This is one of the internal components that get mapped natively inside forms * and tables to the specified properties. * @group Form fields */ export function SelectFieldBinding({ propertyKey, value, setValue, error, showError, disabled, autoFocus, touched, property, includeDescription }: SelectProps) { console.log("SelectFieldBinding", propertyKey, value,) const enumValues = property.enumValues; useClearRestoreValue({ property, value, setValue }); const handleClearClick = useCallback((e: React.MouseEvent) => { e.stopPropagation(); e.preventDefault(); setValue(null); }, [setValue]); return ( <> ); }