import { Select } from "antd"; import { __ } from "@wordpress/i18n"; import type { SelectProps } from "antd"; import type { Element } from "@wordpress/element"; // --- TYPE DEFINITIONS --- // The structure for each option in our custom select component. export interface BetterSelectOption { value: string; label: string; icon?: Element; description?: string; className?: string; // Optional class for custom styling tags?: (Element | false)[]; dimmed?: boolean; // Optional flag to apply opacity styling } // Support for option groups export interface BetterSelectGroup { label: string; options: BetterSelectOption[]; key?: string | number; className?: string; } type BetterSelectItem = BetterSelectOption | BetterSelectGroup; // The props for our main component, extending Ant Design's SelectProps. export interface BetterSelectProps extends Omit, "options" | "optionRender"> { options: BetterSelectItem[]; descriptionIndent?: boolean; // Optional indent for description text onChange: any; } // --- THE ENHANCED SELECT COMPONENT --- const BetterSelect: React.FC = ({ options, className, descriptionIndent = true, // Default to indent for descriptions ...rest }) => { return (