/*! Strand UI | MIT License | dillingerstaffing.com */ import type { JSX } from "preact"; import { forwardRef } from "preact/compat"; import { cx } from "../../internal/index.js"; export type MapLegendCategory = "tech" | "health" | "trades" | "finance"; export interface MapLegendItem { /** Sector dot to draw. */ category: MapLegendCategory; label: string; /** Makes the row a filter button. */ onSelect?: () => void; } export interface MapLegendProps extends JSX.HTMLAttributes { /** Overline heading. */ title?: string; items: MapLegendItem[]; className?: string; } /** * Category key for a map on an instrument viewport; a row is a button only when it filters. * * @example * filter("tech") }]} /> */ export const MapLegend = forwardRef( ({ title = "Legend", items, className = "", ...rest }, ref) => (
{title}
{items.map((item) => { const dot =
), ); MapLegend.displayName = "MapLegend";