import { useEffect, useId, useMemo, useRef, useState } from 'react' import { createPortal } from 'react-dom' import { cn } from '../../lib/cn' import { sameValue, summaryOf, toOptions, type OptionLike } from './options' import { contentWidth, usePopup } from './use-popup' import { filterBarCls, itemCls, listCls, noneCls, popCls, triggerCls } from './parts' import { Caret } from './Caret' /** * 全站统一「多选下拉」(替代原生 setQuery(e.target.value)} onKeyDown={onSearchKeydown} /> )} {count ? `已选 ${count} 项` : '未选择'}
{view.map((i) => { const o = opts[i] const on = isSelected(o.value) return (
setActive(i)} onClick={() => toggleIndex(i)}> {on && } {o.label}
) })} {!view.length &&
{opts.length ? '没有匹配的选项' : '无可选项'}
}
, document.body)} ) }