iter: d02 select/radioGroup 补 disabled + 修复 select 箭头旋转

This commit is contained in:
ui-arch-bot
2026-10-23 16:47:03 +08:00
parent 84277a744e
commit 6b9fa95d1e
11 changed files with 75 additions and 15 deletions
+2 -1
View File
@@ -24,6 +24,7 @@ export function select(props: SelectProps): HTMLElement {
class: 'ua-select-trigger',
'aria-haspopup': 'listbox',
'aria-expanded': () => String(open()),
disabled: props.disabled, // 布尔或信号禁用,h() 直接透传(原生 button 拦截点击)
onClick: () => open(!open()),
},
h('span', { class: () => `ua-select-value${value() ? '' : ' is-empty'}` }, () => current() || props.placeholder || ''),
@@ -46,7 +47,7 @@ export function select(props: SelectProps): HTMLElement {
);
const pop = h('div', { class: () => `ua-select-pop${open() ? ' ua-open' : ''}`, role: 'listbox' }, ...options);
const root = h('div', { class: 'ua-select' }, trigger, pop);
const root = h('div', { class: () => `ua-select${open() ? ' ua-open' : ''}` }, trigger, pop); // 根带开合类,供箭头旋转
root.addEventListener('keydown', (e: KeyboardEvent) => {
if (e.key === 'Escape') open(false); // Esc 关闭弹层