"use client"; // Synced from Subframe ("Dropdown Menu select", 2026-07-21) for WF-P8 S02/S05. // // The searchable single-select counterpart of DropdownMenuMultiSelect: `Select` // has no search and the multi-select has the wrong cardinality. // // The same two export defects as the multi-select apply here and are fixed the // same way, both reported to David: // 1. The search input is dead markup — hardcoded `value=""`, no handler and a // hardcoded German placeholder. It is a controlled input here, and the // placeholder is a prop so the caller supplies a translated string. // 2. The item checkboxes are hardcoded unselected. Here they follow the // `selected` prop, so a chosen option reads as chosen. // // Unlike the multi-select, `DropdownItem` keeps the Radix close-on-select // behaviour: picking the one value is the end of the interaction. 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, ...otherProps }: DropdownItemProps, ref ) { return (
{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; selected?: boolean; showCheckbox?: boolean; /** Avatar fallback initials; the export hardcoded "OR". */ initials?: string; className?: string; } const DropdownUserItem = React.forwardRef< HTMLDivElement, DropdownUserItemProps >(function DropdownUserItem( { title, subtitle, image, selected = false, showCheckbox = false, initials, 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 DropdownMenuSelectRootProps 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 DropdownMenuSelectRoot = React.forwardRef< HTMLDivElement, DropdownMenuSelectRootProps >(function DropdownMenuSelectRoot( { children, showSearch = false, searchValue, searchPlaceholder, onSearchChange, className, ...otherProps }: DropdownMenuSelectRootProps, ref ) { return (
onSearchChange?.(event.target.value)} type="search" />
{children ? (
{children}
) : null}
); }); export const DropdownMenuSelect = Object.assign(DropdownMenuSelectRoot, { DropdownDivider, DropdownItem, DropdownUserItem, DropdownCustomItem, DropdownNestedItem, });