"use client"; import { memo } from "react"; import { getAssetPath, ASSETS } from "../../../lib/assetUtils"; import Chip from "../Chip"; import type { MultiSelectViewProps } from "./MultiSelect.types"; function MultiSelectView({ label, showHelpIcon, size, options, onChipClick, onAddClick, showAddButton, addButtonText, onCustomChipConfirm, onCustomChipClose, className, }: MultiSelectViewProps) { const isSmall = size === "s"; // Size-based spacing and typography const gapClass = isSmall ? "gap-[var(--measures-spacing-200,8px)]" : "gap-[var(--measures-spacing-300,12px)]"; const labelGapClass = isSmall ? "gap-[var(--measures-spacing-200,4px_8px)]" : "gap-[4px]"; const labelTextSize = isSmall ? "text-[length:var(--sizing-350,14px)] leading-[20px]" : "text-[length:var(--sizing-400,16px)] leading-[24px]"; const helpIconSize = isSmall ? "size-[12px]" : "size-[16px]"; const chipSize = isSmall ? "S" : "M"; return (
{/* Label with help icon */} {label && (
{showHelpIcon && (
Help
)}
)} {/* 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 - Ghost button style */} {showAddButton && ( )}
); } MultiSelectView.displayName = "MultiSelectView"; export default memo(MultiSelectView);