/** * Cart-element icon registry. * * Maps each selectable cart icon id to its icon component (src/admin/icons.tsx). The ids and * order mirror the PHP source of truth (Elements::cart_icon_choices() / * cart_icon_shapes()), which renders matching inline SVG on the front end so the * picker is WYSIWYG. Labels come from the schema (`cartIcons`). */ import { ShoppingCart, ShoppingBag, ShoppingBasket, Package, type LucideIcon, } from '../../icons'; export const CART_ICONS: Record< string, LucideIcon > = { cart: ShoppingCart, bag: ShoppingBag, basket: ShoppingBasket, package: Package, }; export const DEFAULT_CART_ICON = 'cart'; /** * The lucide component for a cart icon id, falling back to the shopping cart. * @param id Cart icon id. */ export const cartIconFor = ( id: string ): LucideIcon => CART_ICONS[ id ] ?? CART_ICONS[ DEFAULT_CART_ICON ];