feat(ui): 新增 Caret / SortableList,箭头画法收成一份

- Caret:6px CSS 折角(open 切朝向,size 可调),Menu 与 Select 改为复用它,
  两处各自的画法删掉,全库只剩一份
- SortableList:可拖拽排序的条目列表(items / activeKey / onSelect / onReorder),
  拖拽位置计算从应用里挪进组件,顺序没变不回调
- 展示页:菜单补「折叠箭头」,新增 #sortable 一节并挂到导航
- COMPONENTS.md 契约 3.48 / 3.49、组件地图、README 清单、变更记录同步
This commit is contained in:
2026-11-01 22:07:31 +08:00
parent cc35400f67
commit 5eb1506650
14 changed files with 407 additions and 36 deletions
+30 -1
View File
@@ -1,5 +1,5 @@
import { useState } from 'react'
import { Card, Icon, Menu, Text } from '../../src'
import { Card, Caret, Icon, Menu, Space, Text } from '../../src'
import { Demo } from '../components/Demo'
import { PropsTable } from '../components/PropsTable'
import { Section } from '../components/Section'
@@ -79,6 +79,28 @@ export function MenuSection() {
</Card>
</Demo>
<Demo
title="折叠箭头"
desc="Caret 是菜单、下拉、可折叠表格行共用的 6px 折角:收起朝下、展开朝上,纯装饰,无障碍状态由外层按钮的 aria-expanded 承担。"
code={`<Caret />
<Caret open />`}
>
<Space gap="lg">
<Space gap="sm" align="center">
<Caret />
<Text size="sm" tone="muted">
收起
</Text>
</Space>
<Space gap="sm" align="center">
<Caret open />
<Text size="sm" tone="muted">
展开
</Text>
</Space>
</Space>
</Demo>
<PropsTable
rows={[
{ name: 'items', type: 'MenuItem[]', required: true, desc: '{ key, label, icon?, children? }' },
@@ -88,6 +110,13 @@ export function MenuSection() {
{ name: 'itemHeight', type: 'number', defaultValue: '36', desc: '一级菜单行高(px)' },
]}
/>
<PropsTable
rows={[
{ name: 'open', type: 'boolean', defaultValue: 'false', desc: '展开状态(决定箭头朝向)' },
{ name: 'size', type: 'number', defaultValue: '6', desc: '折角边长(px)' },
]}
/>
</Section>
)
}