/** * Toggle-button icon registry. * * Maps each selectable toggle icon id to its lucide-react component. The ids and * order mirror the PHP source of truth (Elements::toggle_icon_choices() / * toggle_icon_shapes()), which renders matching inline SVG on the front end so * the picker is WYSIWYG. Labels come from the schema (`toggleIcons`). */ import { Menu, AlignJustify, AlignLeft, AlignRight, List, Ellipsis, GripHorizontal, PanelRight, LayoutGrid, type LucideIcon, } from 'lucide-react'; export const TOGGLE_ICONS: Record< string, LucideIcon > = { menu: Menu, 'align-justify': AlignJustify, 'align-left': AlignLeft, 'align-right': AlignRight, list: List, dots: Ellipsis, grip: GripHorizontal, panel: PanelRight, grid: LayoutGrid, }; export const DEFAULT_TOGGLE_ICON = 'menu'; /** * The lucide component for an icon id, falling back to the hamburger. * @param id Toggle icon id. */ export const toggleIconFor = ( id: string ): LucideIcon => TOGGLE_ICONS[ id ] ?? TOGGLE_ICONS[ DEFAULT_TOGGLE_ICON ];