"use client"; // Synced from Subframe ("Dropdown Menu multi select", 2026-07-21) for WF-P8 S01. // // Two deliberate local deviations, both reported to David — the export renders // a multi-select that cannot express selection or survive a click: // 1. The item checkboxes are hardcoded unselected. Here they follow the // `selected` prop, so a checked facet option actually reads as checked. // 2. `DropdownItem` wraps a Radix `DropdownMenu.Item`, which closes the menu // on select. A multi-select must stay open, so the default `onSelect` // preventsDefault; a caller that wants the closing behaviour back passes // its own `onSelect`. import React from "react"; import { FeatherLayers } from "@subframe/core"; import { FeatherSearch } from "@subframe/core"; import * as SubframeCore from "@subframe/core"; import * as SubframeUtils from "../../utils"; import { Accordion } from "../Accordion"; import { Avatar } from "../Avatar"; import { Checkbox } from "../Checkbox"; export interface DropdownDividerProps extends React.HTMLAttributes { className?: string; } const DropdownDivider = React.forwardRef( function DropdownDivider( { className, ...otherProps }: DropdownDividerProps, ref ) { return (
); } ); export interface DropdownItemProps extends React.ComponentProps { children?: React.ReactNode; icon?: React.ReactNode; iconRight?: React.ReactNode; image?: string; selected?: boolean; showCheckbox?: boolean; className?: string; } const DropdownItem = React.forwardRef( function DropdownItem( { children, icon = null, iconRight = null, image, selected = false, showCheckbox = false, className, onSelect, ...otherProps }: DropdownItemProps, ref ) { return ( event.preventDefault())} {...otherProps} >
{image ? ( ) : null} {icon ? ( {icon} ) : null} {children ? ( {children} ) : null} {iconRight ? ( {iconRight} ) : null}
); } ); export interface DropdownUserItemProps extends Omit, "title"> { title?: React.ReactNode; subtitle?: React.ReactNode; image?: string; /** Initials fallback when there is no photo — the export hardcoded "OR". */ initials?: string; selected?: boolean; showCheckbox?: boolean; className?: string; } const DropdownUserItem = React.forwardRef< HTMLDivElement, DropdownUserItemProps >(function DropdownUserItem( { title, subtitle, image, initials, selected = false, showCheckbox = false, className, ...otherProps }: DropdownUserItemProps, ref ) { return (
{initials ?? ""}
{title ? ( {title} ) : null} {subtitle ? ( {subtitle} ) : null}
); }); export interface DropdownCustomItemProps extends React.HTMLAttributes { children?: React.ReactNode; selected?: boolean; showCheckbox?: boolean; size?: "medium" | "small" | "large"; className?: string; } const DropdownCustomItem = React.forwardRef< HTMLDivElement, DropdownCustomItemProps >(function DropdownCustomItem( { children, selected = false, showCheckbox = false, size = "medium", className, ...otherProps }: DropdownCustomItemProps, ref ) { return (
{children ? (
{children}
) : null}
); }); export interface DropdownNestedItemProps extends React.ComponentProps { children?: React.ReactNode; label?: React.ReactNode; icon?: React.ReactNode; className?: string; } const DropdownNestedItem = React.forwardRef< React.ElementRef, DropdownNestedItemProps >(function DropdownNestedItem( { children, label, icon = , className, ...otherProps }: DropdownNestedItemProps, ref ) { return ( {icon ? ( {icon} ) : null} {label ? ( {label} ) : null}
} ref={ref} {...otherProps} > {children ? (
{children}
) : null} ); }); export interface DropdownMenuMultiSelectRootProps extends React.HTMLAttributes { children?: React.ReactNode; showSearch?: boolean; /** Controlled search term — the export shipped a dead, hardcoded input. */ searchValue?: string; searchPlaceholder?: string; onSearchChange?: (value: string) => void; className?: string; } const DropdownMenuMultiSelectRoot = React.forwardRef< HTMLDivElement, DropdownMenuMultiSelectRootProps >(function DropdownMenuMultiSelectRoot( { children, showSearch = false, searchValue, searchPlaceholder, onSearchChange, className, ...otherProps }: DropdownMenuMultiSelectRootProps, ref ) { return (
onSearchChange?.(event.target.value)} type="search" />
{children ? (
{children}
) : null}
); }); export const DropdownMenuMultiSelect = Object.assign( DropdownMenuMultiSelectRoot, { DropdownDivider, DropdownItem, DropdownUserItem, DropdownCustomItem, DropdownNestedItem, } );