"use client"; import { memo } from "react"; import Chip from "../Chip"; import InputLabel from "../../utility/InputLabel"; import type { MultiSelectViewProps } from "./MultiSelect.types"; function MultiSelectView({ label, showHelpIcon, size, palette, options, onChipClick, onAddClick, addButton, addButtonText, formHeader = true, onCustomChipConfirm, onCustomChipClose, className, }: MultiSelectViewProps) { const isSmall = size === "s"; const isInverse = palette === "inverse"; // Size-based spacing const gapClass = isSmall ? "gap-[var(--measures-spacing-200,8px)]" : "gap-[var(--measures-spacing-300,12px)]"; const chipSize = isSmall ? "S" : "M"; return (
{/* Label using InputLabel component */} {formHeader && label && ( )} {/* Chips container */}
{options.map((option) => ( { // Only toggle if not in Custom state if (option.state !== "Custom" && onChipClick) { onChipClick(option.id); } }} onCheck={(value, e) => { e.stopPropagation(); if (onCustomChipConfirm) { onCustomChipConfirm(option.id, value); } }} onClose={(e) => { e.stopPropagation(); if (onCustomChipClose) { onCustomChipClose(option.id); } }} /> ))} {/* Add button — icon-only: bordered circle + brand icon (chips stay yellow). With label: Figma 19688:38288 — brand + icon, primary label text, no fill/border. */} {addButton && ( )}
); } MultiSelectView.displayName = "MultiSelectView"; export default memo(MultiSelectView);