lingee-ui 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +88 -0
- package/dist/button/index.css +1 -1
- package/dist/button/index.d.mts +1 -1
- package/dist/button/index.d.ts +1 -1
- package/dist/button/index.js +1 -1
- package/dist/button/index.mjs +1 -1
- package/dist/chunk-7F53VFM6.mjs +1 -0
- package/dist/chunk-FQRDHJQZ.mjs +1 -0
- package/dist/chunk-JKY43GCS.mjs +1 -0
- package/dist/chunk-KQ733636.mjs +1 -0
- package/dist/chunk-KT3HSLBA.js +1 -0
- package/dist/chunk-P56ABRDC.js +1 -0
- package/dist/chunk-PQVYDWUK.js +1 -0
- package/dist/chunk-RM4W5RV7.mjs +1 -0
- package/dist/{chunk-MUKM5CN4.js → chunk-SXHF5CXB.js} +1 -1
- package/dist/chunk-T5QR25R6.js +1 -0
- package/dist/{index-B4ySDWo5.d.mts → index-BVXwKHfX.d.mts} +2 -2
- package/dist/{index-B4ySDWo5.d.ts → index-BVXwKHfX.d.ts} +2 -2
- package/dist/index.css +1 -1
- package/dist/index.d.mts +434 -111
- package/dist/index.d.ts +434 -111
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/input/index.css +1 -1
- package/dist/input/index.d.mts +9 -3
- package/dist/input/index.d.ts +9 -3
- package/dist/input/index.js +1 -1
- package/dist/input/index.mjs +1 -1
- package/dist/popover/index.d.mts +6 -6
- package/dist/popover/index.d.ts +6 -6
- package/dist/switch/index.d.mts +2 -2
- package/dist/switch/index.d.ts +2 -2
- package/dist/tabs/index.css +1 -1
- package/dist/tabs/index.d.mts +10 -6
- package/dist/tabs/index.d.ts +10 -6
- package/dist/tabs/index.js +1 -1
- package/dist/tabs/index.mjs +1 -1
- package/dist/textarea/index.d.mts +2 -2
- package/dist/textarea/index.d.ts +2 -2
- package/dist/toast/index.css +1 -1
- package/dist/toast/index.js +1 -1
- package/dist/toast/index.mjs +1 -1
- package/dist/tokens.css +1 -1
- package/dist/tooltip/index.css +1 -1
- package/dist/tooltip/index.d.mts +6 -1
- package/dist/tooltip/index.d.ts +6 -1
- package/dist/tooltip/index.js +1 -1
- package/dist/tooltip/index.mjs +1 -1
- package/package.json +8 -3
- package/skill/AGENTS-SNIPPET.md +253 -0
- package/skill/SKILL.md +205 -0
- package/skill/VERSION.json +7 -0
- package/skill/references/components/alert.md +30 -0
- package/skill/references/components/avatar.md +45 -0
- package/skill/references/components/button.md +40 -0
- package/skill/references/components/checkbox.md +39 -0
- package/skill/references/components/color-picker.md +40 -0
- package/skill/references/components/date-picker.md +46 -0
- package/skill/references/components/dialog.md +68 -0
- package/skill/references/components/divider.md +30 -0
- package/skill/references/components/drawer.md +42 -0
- package/skill/references/components/dropdown.md +93 -0
- package/skill/references/components/empty.md +28 -0
- package/skill/references/components/flex.md +44 -0
- package/skill/references/components/form.md +57 -0
- package/skill/references/components/image.md +37 -0
- package/skill/references/components/input.md +33 -0
- package/skill/references/components/pagination.md +42 -0
- package/skill/references/components/popover.md +45 -0
- package/skill/references/components/progress.md +36 -0
- package/skill/references/components/radio.md +43 -0
- package/skill/references/components/range-picker.md +49 -0
- package/skill/references/components/scroll-area.md +50 -0
- package/skill/references/components/select.md +52 -0
- package/skill/references/components/sidebar.md +187 -0
- package/skill/references/components/skeleton.md +39 -0
- package/skill/references/components/slider.md +42 -0
- package/skill/references/components/spin.md +25 -0
- package/skill/references/components/steps.md +34 -0
- package/skill/references/components/switch.md +26 -0
- package/skill/references/components/table.md +44 -0
- package/skill/references/components/tabs.md +49 -0
- package/skill/references/components/tag.md +59 -0
- package/skill/references/components/textarea.md +30 -0
- package/skill/references/components/time-picker.md +49 -0
- package/skill/references/components/toast.md +47 -0
- package/skill/references/components/tooltip.md +33 -0
- package/skill/references/components/upload.md +38 -0
- package/skill/references/icons.md +1117 -0
- package/skill/references/setup.md +132 -0
- package/skill/references/tokens.md +201 -0
- package/dist/chunk-22G7TVQU.mjs +0 -1
- package/dist/chunk-3VTWGWRW.mjs +0 -1
- package/dist/chunk-BURKV6KR.js +0 -1
- package/dist/chunk-EWZCOQ5H.js +0 -1
- package/dist/chunk-I5FIN7UX.mjs +0 -1
- package/dist/chunk-LGFBC4UA.mjs +0 -1
- package/dist/chunk-U5VI5OCN.mjs +0 -1
- package/dist/chunk-WJXAQ3RX.js +0 -1
- package/dist/chunk-ZXRCMMQM.js +0 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Progress 进度条
|
|
2
|
+
|
|
3
|
+
展示操作的当前进度,支持线性和环形两种形态。
|
|
4
|
+
|
|
5
|
+
- 导入:`import { Progress } from "lingee-ui";`
|
|
6
|
+
- 可用类型:`ProgressProps`, `ProgressStatus`, `ProgressType`
|
|
7
|
+
|
|
8
|
+
## 最小示例
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { Progress } from "lingee-ui";
|
|
12
|
+
|
|
13
|
+
export default function BasicDemo() {
|
|
14
|
+
return (
|
|
15
|
+
<div style={{ display: "flex", flexDirection: "column", gap: 16, maxWidth: 400 }}>
|
|
16
|
+
<Progress percent={30} />
|
|
17
|
+
<Progress percent={70} />
|
|
18
|
+
<Progress percent={100} status="success" />
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## API
|
|
25
|
+
|
|
26
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
27
|
+
|------|------|------|--------|
|
|
28
|
+
| `percent` | 进度百分比,-1 为不确定进度 | `number` | `0` |
|
|
29
|
+
| `type` | 类型 | `"line" \| "circle"` | `"line"` |
|
|
30
|
+
| `size` | 线性进度条高度 / 环形进度条直径 | `number` | 线性 `8`,环形 `80` |
|
|
31
|
+
| `status` | 状态 | `"normal" \| "success" \| "error" \| "active"` | `"normal"` |
|
|
32
|
+
| `showInfo` | 是否显示进度数值 | `boolean` | `true` |
|
|
33
|
+
| `strokeColor` | 进度条颜色 | `string` | - |
|
|
34
|
+
| `trailColor` | 轨道颜色 | `string` | - |
|
|
35
|
+
| `strokeWidth` | 环形进度条线宽 | `number` | - |
|
|
36
|
+
| `format` | 自定义格式化显示 | `(percent: number) => ReactNode` | - |
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Radio 单选
|
|
2
|
+
|
|
3
|
+
单选框组件,用于在一组互斥选项中选择一个。
|
|
4
|
+
|
|
5
|
+
- 导入:`import { RadioGroup, RadioItem } from "lingee-ui";`
|
|
6
|
+
- 可用类型:`RadioGroupProps`, `RadioItemProps`, `RadioSize`
|
|
7
|
+
|
|
8
|
+
## 最小示例
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { RadioGroup, RadioItem } from "lingee-ui";
|
|
12
|
+
|
|
13
|
+
export default function BasicDemo() {
|
|
14
|
+
return (
|
|
15
|
+
<RadioGroup defaultValue="a">
|
|
16
|
+
<RadioItem value="a">Option A</RadioItem>
|
|
17
|
+
<RadioItem value="b">Option B</RadioItem>
|
|
18
|
+
<RadioItem value="c">Option C</RadioItem>
|
|
19
|
+
</RadioGroup>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## API
|
|
25
|
+
|
|
26
|
+
### RadioGroup
|
|
27
|
+
|
|
28
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
29
|
+
|------|------|------|--------|
|
|
30
|
+
| `value` | 受控选中值 | `string` | - |
|
|
31
|
+
| `defaultValue` | 默认选中值 | `string` | - |
|
|
32
|
+
| `onValueChange` | 选中值变化回调 | `(value: string) => void` | - |
|
|
33
|
+
| `disabled` | 是否整组禁用 | `boolean` | `false` |
|
|
34
|
+
| `orientation` | 排列方向 | `"horizontal" \| "vertical"` | `"vertical"` |
|
|
35
|
+
| `size` | 尺寸 | `"sm" \| "md" \| "lg"` | `"md"` |
|
|
36
|
+
|
|
37
|
+
### RadioItem
|
|
38
|
+
|
|
39
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
40
|
+
|------|------|------|--------|
|
|
41
|
+
| `value` | 选项值 | `string` | - |
|
|
42
|
+
| `disabled` | 是否禁用 | `boolean` | `false` |
|
|
43
|
+
| `children` | 标签文本 | `ReactNode` | - |
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# RangePicker 日期范围选择器
|
|
2
|
+
|
|
3
|
+
用于选择日期范围的输入组件。
|
|
4
|
+
|
|
5
|
+
- 导入:`import { RangePicker } from "lingee-ui";`
|
|
6
|
+
- 可用类型:`RangePickerProps`, `RangePickerSize`, `DateRange`
|
|
7
|
+
|
|
8
|
+
## 最小示例
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { useState } from "react";
|
|
12
|
+
import { RangePicker } from "lingee-ui";
|
|
13
|
+
|
|
14
|
+
export default function BasicDemo() {
|
|
15
|
+
const [value, setValue] = useState(null);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div style={{ width: 320 }}>
|
|
19
|
+
<RangePicker
|
|
20
|
+
value={value}
|
|
21
|
+
onChange={(v) => setValue(v)}
|
|
22
|
+
/>
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## API
|
|
29
|
+
|
|
30
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
31
|
+
|------|------|------|--------|
|
|
32
|
+
| `value` | 当前日期范围(受控) | `DateRange \| null` | - |
|
|
33
|
+
| `defaultValue` | 默认日期范围(非受控) | `DateRange` | - |
|
|
34
|
+
| `onChange` | 范围变化回调 | `(range: DateRange \| null) => void` | - |
|
|
35
|
+
| `placeholder` | 占位文本 | `[string, string]` | - |
|
|
36
|
+
| `disabled` | 是否禁用 | `boolean` | `false` |
|
|
37
|
+
| `error` | 是否显示错误状态 | `boolean` | `false` |
|
|
38
|
+
| `errorMessage` | 错误提示信息 | `string` | - |
|
|
39
|
+
| `minDate` | 最小可选日期 | `Date` | - |
|
|
40
|
+
| `maxDate` | 最大可选日期 | `Date` | - |
|
|
41
|
+
|
|
42
|
+
### DateRange
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
interface DateRange {
|
|
46
|
+
from: Date | null;
|
|
47
|
+
to: Date | null;
|
|
48
|
+
}
|
|
49
|
+
```
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# ScrollArea 自定义滚动区域
|
|
2
|
+
|
|
3
|
+
自定义样式的滚动容器组件,提供美观的滚动条体验。
|
|
4
|
+
|
|
5
|
+
- 导入:`import { ScrollArea, ScrollBar } from "lingee-ui";`
|
|
6
|
+
- 可用类型:`ScrollAreaProps`, `ScrollBarProps`
|
|
7
|
+
|
|
8
|
+
## 最小示例
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { ScrollArea } from "lingee-ui";
|
|
12
|
+
|
|
13
|
+
const items = Array.from({ length: 50 }, (_, i) => `Item ${i + 1}`);
|
|
14
|
+
|
|
15
|
+
export default function BasicDemo() {
|
|
16
|
+
return (
|
|
17
|
+
<div style={{ width: 280, border: "1px solid #e0e0e0", borderRadius: 8 }}>
|
|
18
|
+
<ScrollArea style={{ maxHeight: 300 }}>
|
|
19
|
+
<div style={{ padding: 8 }}>
|
|
20
|
+
{items.map((item) => (
|
|
21
|
+
<div
|
|
22
|
+
key={item}
|
|
23
|
+
style={{
|
|
24
|
+
padding: "8px 12px",
|
|
25
|
+
borderBottom: "1px solid #f0f0f0",
|
|
26
|
+
fontSize: 14,
|
|
27
|
+
}}
|
|
28
|
+
>
|
|
29
|
+
{item}
|
|
30
|
+
</div>
|
|
31
|
+
))}
|
|
32
|
+
</div>
|
|
33
|
+
</ScrollArea>
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## API
|
|
40
|
+
|
|
41
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
42
|
+
|------|------|------|--------|
|
|
43
|
+
| `type` | 滚动条显示策略 | `"scroll" \| "hover" \| "auto" \| "always"` | `"scroll"` |
|
|
44
|
+
| `scrollbars` | 滚动条方向 | `"vertical" \| "horizontal" \| "both"` | `"vertical"` |
|
|
45
|
+
| `scrollbarSize` | 滚动条默认宽度(px) | `number` | `4` |
|
|
46
|
+
| `scrollbarHoverSize` | 滚动条悬浮时宽度(px) | `number` | `6` |
|
|
47
|
+
| `scrollHideDelay` | 滚动条隐藏延迟(ms) | `number` | `1000` |
|
|
48
|
+
| `className` | 自定义类名 | `string` | - |
|
|
49
|
+
| `style` | 自定义样式 | `CSSProperties` | - |
|
|
50
|
+
| `children` | 子内容 | `ReactNode` | - |
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Select 选择器
|
|
2
|
+
|
|
3
|
+
下拉选择器,支持单选、多选、搜索和远程加载。
|
|
4
|
+
|
|
5
|
+
- 导入:`import { Select } from "lingee-ui";`
|
|
6
|
+
- 可用类型:`SelectProps`, `SelectOption`, `SelectOptionGroup`, `SelectSize`, `SelectMode`, `SelectDropdownProps`
|
|
7
|
+
|
|
8
|
+
## 最小示例
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { useState } from "react";
|
|
12
|
+
import { Select } from "lingee-ui";
|
|
13
|
+
|
|
14
|
+
export default function BasicDemo() {
|
|
15
|
+
const [value, setValue] = useState<string>("");
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Select
|
|
19
|
+
options={[
|
|
20
|
+
{ label: "View only", value: "view" },
|
|
21
|
+
{ label: "Can edit", value: "edit" },
|
|
22
|
+
{ label: "Admin", value: "admin" },
|
|
23
|
+
]}
|
|
24
|
+
value={value}
|
|
25
|
+
onChange={(v) => setValue(v as string)}
|
|
26
|
+
placeholder="Select a permission"
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## API
|
|
33
|
+
|
|
34
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
35
|
+
|------|------|------|--------|
|
|
36
|
+
| `options` | 选项数据 | `Array<{ label: string; value: T }>` | `[]` |
|
|
37
|
+
| `value` | 当前选中值 | `T \| T[]` | - |
|
|
38
|
+
| `onChange` | 选中值变化回调 | `(value: T \| T[]) => void` | - |
|
|
39
|
+
| `placeholder` | 占位文本 | `string` | - |
|
|
40
|
+
| `showSearch` | 是否支持搜索 | `boolean` | `false` |
|
|
41
|
+
| `filterOption` | 是否本地过滤(设为 false 配合 onSearch 远程搜索) | `boolean` | `true` |
|
|
42
|
+
| `onSearch` | 搜索回调 | `(keyword: string) => void` | - |
|
|
43
|
+
| `disabled` | 是否禁用 | `boolean` | `false` |
|
|
44
|
+
| `error` | 是否错误态 | `boolean` | `false` |
|
|
45
|
+
| `mode` | 选择模式 | `"single" \| "multiple"` | `"single"` |
|
|
46
|
+
| `allowClear` | 是否可清空 | `boolean` | `false` |
|
|
47
|
+
| `loading` | 是否加载中 | `boolean` | `false` |
|
|
48
|
+
| `loadError` | 是否加载失败 | `boolean` | `false` |
|
|
49
|
+
| `size` | 尺寸 | `"sm" \| "md" \| "lg"` | `"md"` |
|
|
50
|
+
| `suffixIcon` | 后缀图标 | `ReactNode` | - |
|
|
51
|
+
| `maxTagCount` | 多选模式最多显示 Tag 数 | `number` | - |
|
|
52
|
+
| `dropdown` | 下拉面板配置 | `SelectDropdownProps` | - |
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# Sidebar 侧边栏
|
|
2
|
+
|
|
3
|
+
侧边栏复合组件,提供根容器、页签、导航项、分组、列表项、占位项与底栏,通过 Sidebar.xxx 组合使用。
|
|
4
|
+
|
|
5
|
+
- 导入:`import { Sidebar, SidebarRoot, SidebarHeader, SidebarTabBar, SidebarNavItem, SidebarCollapsibleNavItem, SidebarGroupHeader, SidebarListItem, SidebarCollapsibleListItem, SidebarSkeletonItem, SidebarFooter } from "lingee-ui";`
|
|
6
|
+
- 可用类型:`SidebarRootProps`, `SidebarHeaderProps`, `SidebarTabBarProps`, `SidebarTabItem`, `SidebarNavItemProps`, `SidebarCollapsibleNavItemProps`, `SidebarCollapsibleNavItemChild`, `SidebarGroupHeaderProps`, `SidebarListItemProps`, `SidebarIndicatorType`, `SidebarCollapsibleListItemProps`, `SidebarSkeletonItemProps`, `SidebarSkeletonItemStatus`, `SidebarSkeletonItemVariant`, `SidebarSkeletonItemSpacing`, `SidebarFooterProps`
|
|
7
|
+
|
|
8
|
+
## 最小示例
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { useState } from "react";
|
|
12
|
+
import { Sidebar, ScrollArea } from "lingee-ui";
|
|
13
|
+
import { List, Enterprise, NewChat, AlarmClock, Agent } from "lingee-icon";
|
|
14
|
+
|
|
15
|
+
export default function BasicDemo() {
|
|
16
|
+
const [tab, setTab] = useState("work");
|
|
17
|
+
const [active, setActive] = useState("new-task");
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Sidebar.Root
|
|
21
|
+
style={{ height: 420, borderRadius: 12 }}
|
|
22
|
+
>
|
|
23
|
+
<Sidebar.TabBar
|
|
24
|
+
items={[
|
|
25
|
+
{ key: "work", label: "工作", icon: <List size={20} /> },
|
|
26
|
+
{ key: "manage", label: "管理", icon: <Enterprise size={20} /> },
|
|
27
|
+
]}
|
|
28
|
+
activeKey={tab}
|
|
29
|
+
onChange={setTab}
|
|
30
|
+
/>
|
|
31
|
+
|
|
32
|
+
<ScrollArea className="lg-sidebar__scroll">
|
|
33
|
+
{/* 区块内缩用 lg-sidebar__section,无需自行写 padding */}
|
|
34
|
+
<div className="lg-sidebar__section">
|
|
35
|
+
<Sidebar.NavItem
|
|
36
|
+
icon={<NewChat size={18} />}
|
|
37
|
+
label="新任务"
|
|
38
|
+
active={active === "new-task"}
|
|
39
|
+
onClick={() => setActive("new-task")}
|
|
40
|
+
/>
|
|
41
|
+
<Sidebar.NavItem
|
|
42
|
+
icon={<AlarmClock size={18} />}
|
|
43
|
+
label="定时任务"
|
|
44
|
+
active={active === "scheduled"}
|
|
45
|
+
onClick={() => setActive("scheduled")}
|
|
46
|
+
/>
|
|
47
|
+
<Sidebar.NavItem
|
|
48
|
+
icon={<Agent size={18} />}
|
|
49
|
+
label="智能体"
|
|
50
|
+
active={active === "agent"}
|
|
51
|
+
onClick={() => setActive("agent")}
|
|
52
|
+
/>
|
|
53
|
+
</div>
|
|
54
|
+
</ScrollArea>
|
|
55
|
+
</Sidebar.Root>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## API
|
|
61
|
+
|
|
62
|
+
### Sidebar.Root
|
|
63
|
+
|
|
64
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
65
|
+
|------|------|------|--------|
|
|
66
|
+
| `width` | 展开宽度(px) | `number` | `280` |
|
|
67
|
+
| `collapsed` | 折叠态。传入即启用双层结构与宽度过渡;不传则宽度恒定 | `boolean` | - |
|
|
68
|
+
| `safeAreaTop` | 顶部安全区高度(px),用于让位固定顶栏 | `number` | `0` |
|
|
69
|
+
|
|
70
|
+
### Sidebar.Header
|
|
71
|
+
|
|
72
|
+
纯插槽容器。平台相关处理(窗口拖拽区、系统按钮避让)由消费方通过 `children` 与 `style` 注入。
|
|
73
|
+
|
|
74
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
75
|
+
|------|------|------|--------|
|
|
76
|
+
| `children` | 内容 | `ReactNode` | - |
|
|
77
|
+
|
|
78
|
+
### Sidebar.TabBar
|
|
79
|
+
|
|
80
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
81
|
+
|------|------|------|--------|
|
|
82
|
+
| `items` | 页签列表 `{ key, label, icon?, disabled?, ariaLabel? }` | `SidebarTabItem[]` | - |
|
|
83
|
+
| `activeKey` | 当前选中 key | `string` | - |
|
|
84
|
+
| `onChange` | 切换回调 | `(key: string) => void` | - |
|
|
85
|
+
|
|
86
|
+
页签显隐过滤(如权限控制)请在传入 `items` 前完成,组件不介入。
|
|
87
|
+
|
|
88
|
+
### Sidebar.NavItem
|
|
89
|
+
|
|
90
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
91
|
+
|------|------|------|--------|
|
|
92
|
+
| `icon` | 左侧图标 | `ReactNode` | - |
|
|
93
|
+
| `label` | 文本 | `ReactNode` | - |
|
|
94
|
+
| `active` | 选中态 | `boolean` | `false` |
|
|
95
|
+
| `disabled` | 禁用态 | `boolean` | `false` |
|
|
96
|
+
| `badge` | 右侧徽章插槽。传纯文本即得药丸样式;传自带样式的节点可覆盖 | `ReactNode` | - |
|
|
97
|
+
| `onClick` | 点击回调 | `() => void` | - |
|
|
98
|
+
|
|
99
|
+
文本溢出时自动显示 Tooltip,无需外层包裹。
|
|
100
|
+
|
|
101
|
+
### Sidebar.CollapsibleNavItem
|
|
102
|
+
|
|
103
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
104
|
+
|------|------|------|--------|
|
|
105
|
+
| `icon` | 左侧图标 | `ReactNode` | - |
|
|
106
|
+
| `label` | 分组标题 | `ReactNode` | - |
|
|
107
|
+
| `active` | 头部高亮。内部与子项 active 互斥 | `boolean` | `false` |
|
|
108
|
+
| `open` | 受控展开态 | `boolean` | - |
|
|
109
|
+
| `defaultOpen` | 非受控初始展开态 | `boolean` | `false` |
|
|
110
|
+
| `onOpenChange` | 展开态变化回调 | `(next: boolean) => void` | - |
|
|
111
|
+
| `onLabelClick` | 标签区点击。传入后标签与箭头分离命中 | `() => void` | - |
|
|
112
|
+
| `items` | 子项列表 `{ key, label, active?, disabled?, onClick? }` | `SidebarCollapsibleNavItemChild[]` | - |
|
|
113
|
+
| `extra` | 头部右侧插槽 | `ReactNode` | - |
|
|
114
|
+
| `disabled` | 禁用态 | `boolean` | `false` |
|
|
115
|
+
| `expandLabel` / `collapseLabel` | 箭头无障碍标签 | `string` | - |
|
|
116
|
+
|
|
117
|
+
### Sidebar.GroupHeader
|
|
118
|
+
|
|
119
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
120
|
+
|------|------|------|--------|
|
|
121
|
+
| `title` | 标题 | `ReactNode` | - |
|
|
122
|
+
| `collapsible` | 可折叠 | `boolean` | `false` |
|
|
123
|
+
| `expanded` | 展开态,仅 `collapsible` 时生效 | `boolean` | `true` |
|
|
124
|
+
| `onToggle` | 切换回调 | `() => void` | - |
|
|
125
|
+
| `actions` | 右侧操作区插槽 | `ReactNode` | - |
|
|
126
|
+
|
|
127
|
+
折叠箭头与操作区悬停显现,展开态箭头常显。
|
|
128
|
+
|
|
129
|
+
### Sidebar.ListItem
|
|
130
|
+
|
|
131
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
132
|
+
|------|------|------|--------|
|
|
133
|
+
| `title` | 标题 | `ReactNode` | - |
|
|
134
|
+
| `active` | 选中态 | `boolean` | `false` |
|
|
135
|
+
| `indicator` | 状态指示器 | `"running" \| "clarification" \| "unread" \| null` | - |
|
|
136
|
+
| `prefix` | 标题前插槽 | `ReactNode` | - |
|
|
137
|
+
| `onSelect` | 点击回调 | `() => void` | - |
|
|
138
|
+
| `menu` | 右侧菜单插槽(需自带触发按钮) | `ReactNode` | - |
|
|
139
|
+
|
|
140
|
+
### Sidebar.CollapsibleListItem
|
|
141
|
+
|
|
142
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
143
|
+
|------|------|------|--------|
|
|
144
|
+
| `icon` | 头部图标。需随展开态切换时由消费方传入对应图标 | `ReactNode` | - |
|
|
145
|
+
| `title` | 标题 | `ReactNode` | - |
|
|
146
|
+
| `expanded` | 展开态 | `boolean` | `false` |
|
|
147
|
+
| `onToggle` | 切换回调 | `() => void` | - |
|
|
148
|
+
| `actions` | 头部操作区插槽 | `ReactNode` | - |
|
|
149
|
+
| `actionsVisible` | 操作区常显。菜单打开时置 `true` | `boolean` | `false` |
|
|
150
|
+
| `active` | 头部高亮 | `boolean` | `false` |
|
|
151
|
+
| `children` | 展开区内容 | `ReactNode` | - |
|
|
152
|
+
| `expandLabel` / `collapseLabel` | 无障碍标签 | `string` | - |
|
|
153
|
+
|
|
154
|
+
### Sidebar.SkeletonItem
|
|
155
|
+
|
|
156
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
157
|
+
|------|------|------|--------|
|
|
158
|
+
| `status` | 状态,决定默认图标与无障碍语义 | `"loading" \| "empty" \| "error"` | - |
|
|
159
|
+
| `text` | 提示文案 | `ReactNode` | - |
|
|
160
|
+
| `icon` | 覆盖默认图标;传 `null` 不渲染图标 | `ReactNode \| null` | 按 `status` 取 |
|
|
161
|
+
| `variant` | 布局:`block` 区块级 / `inline` 行内轻量 | `"block" \| "inline"` | `"block"` |
|
|
162
|
+
| `spacing` | 留白档位。`loose` 为顶部大留白(列表级空态) | `"none" \| "normal" \| "loose"` | `"normal"` |
|
|
163
|
+
| `onRetry` | 重试回调。仅 `status="error"` 生效,传入后整体可点击 | `() => void` | - |
|
|
164
|
+
|
|
165
|
+
默认图标:`loading` 用旋转的 `LoaderCircle`,`empty` 用 `Inbox`,`error` 用 `ExclamationCircle`。
|
|
166
|
+
|
|
167
|
+
**三态等高**:组件按 `variant` + `spacing` 设定 `min-height`,同档位下
|
|
168
|
+
`loading` / `empty` / `error` 高度完全一致,因此「加载中 → 空态 / 错误态」
|
|
169
|
+
切换时容器高度不变,列表不会跳动。
|
|
170
|
+
|
|
171
|
+
| variant | spacing | 高度 |
|
|
172
|
+
|---------|---------|------|
|
|
173
|
+
| `block` | `none` | 24px |
|
|
174
|
+
| `block` | `normal` | 48px |
|
|
175
|
+
| `block` | `loose` | 80px(顶部 44 + 内容 24 + 底部 12) |
|
|
176
|
+
| `inline` | `normal` | 26px |
|
|
177
|
+
|
|
178
|
+
### Sidebar.Footer
|
|
179
|
+
|
|
180
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
181
|
+
|------|------|------|--------|
|
|
182
|
+
| `avatar` | 头像插槽 | `ReactNode` | - |
|
|
183
|
+
| `name` | 名称,为空时不渲染身份区 | `ReactNode` | - |
|
|
184
|
+
| `nameSuffix` | 名称后插槽(套餐标签等) | `ReactNode` | - |
|
|
185
|
+
| `menuOpen` | 菜单展开态,驱动触发区高亮与箭头旋转 | `boolean` | `false` |
|
|
186
|
+
| `onTriggerClick` | 点击触发区,回传 `DOMRect` 供手动定位浮层 | `(rect: DOMRect) => void` | - |
|
|
187
|
+
| `actions` | 右侧动作区插槽 | `ReactNode` | - |
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Skeleton 骨架屏
|
|
2
|
+
|
|
3
|
+
在数据加载完成前通过占位图形展示页面结构,降低用户等待焦虑。
|
|
4
|
+
|
|
5
|
+
- 导入:`import { Skeleton } from "lingee-ui";`
|
|
6
|
+
- 可用类型:`SkeletonProps`, `SkeletonVariant`, `SkeletonAnimation`
|
|
7
|
+
|
|
8
|
+
## 最小示例
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { Skeleton } from "lingee-ui";
|
|
12
|
+
|
|
13
|
+
export default function BasicDemo() {
|
|
14
|
+
return (
|
|
15
|
+
<div style={{ display: "flex", flexDirection: "column", gap: 16 }}>
|
|
16
|
+
<div style={{ display: "flex", flexDirection: "column", gap: 8 }}>
|
|
17
|
+
<Skeleton variant="text" width="100%" />
|
|
18
|
+
<Skeleton variant="text" width="80%" />
|
|
19
|
+
<Skeleton variant="text" width="60%" />
|
|
20
|
+
</div>
|
|
21
|
+
<div style={{ display: "flex", alignItems: "center", gap: 12 }}>
|
|
22
|
+
<Skeleton variant="circle" size={40} />
|
|
23
|
+
<Skeleton variant="rect" width={120} height={36} />
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
33
|
+
|------|------|------|--------|
|
|
34
|
+
| `variant` | 形状预设 | `"text" \| "circle" \| "rect"` | `"text"` |
|
|
35
|
+
| `width` | 宽度 | `string \| number` | `"100%"` |
|
|
36
|
+
| `height` | 高度 | `string \| number` | - |
|
|
37
|
+
| `size` | 圆形/方形尺寸(同时设置宽高) | `number` | - |
|
|
38
|
+
| `borderRadius` | 圆角 | `string \| number` | - |
|
|
39
|
+
| `animation` | 动画类型 | `"shimmer" \| "pulse" \| false` | `"shimmer"` |
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Slider 数值滑块
|
|
2
|
+
|
|
3
|
+
滑动输入器,用于在数值区间内进行选择。
|
|
4
|
+
|
|
5
|
+
- 导入:`import { Slider } from "lingee-ui";`
|
|
6
|
+
- 可用类型:`SliderProps`, `SliderSize`
|
|
7
|
+
|
|
8
|
+
## 最小示例
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { useState } from "react";
|
|
12
|
+
import { Slider } from "lingee-ui";
|
|
13
|
+
|
|
14
|
+
export default function BasicDemo() {
|
|
15
|
+
const [value, setValue] = useState([50]);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div style={{ width: 300 }}>
|
|
19
|
+
<Slider value={value} onChange={setValue} />
|
|
20
|
+
<p style={{ marginTop: 12, fontSize: 14, color: "#666" }}>
|
|
21
|
+
Current value: {value[0]}
|
|
22
|
+
</p>
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## API
|
|
29
|
+
|
|
30
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
31
|
+
|------|------|------|--------|
|
|
32
|
+
| `value` | 当前值(受控) | `number[]` | - |
|
|
33
|
+
| `defaultValue` | 默认值(非受控) | `number[]` | `[0]` |
|
|
34
|
+
| `onChange` | 值变化回调 | `(value: number[]) => void` | - |
|
|
35
|
+
| `min` | 最小值 | `number` | `0` |
|
|
36
|
+
| `max` | 最大值 | `number` | `100` |
|
|
37
|
+
| `step` | 步长 | `number` | `1` |
|
|
38
|
+
| `disabled` | 是否禁用 | `boolean` | `false` |
|
|
39
|
+
| `size` | 尺寸 | `"sm" \| "md" \| "lg"` | `"md"` |
|
|
40
|
+
| `orientation` | 方向 | `"horizontal" \| "vertical"` | `"horizontal"` |
|
|
41
|
+
| `tooltip` | 是否显示 Tooltip | `boolean` | `true` |
|
|
42
|
+
| `tipFormatter` | Tooltip 格式化 | `(value: number) => string` | - |
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Spin 加载中
|
|
2
|
+
|
|
3
|
+
用于页面和区域的加载中状态指示器。
|
|
4
|
+
|
|
5
|
+
- 导入:`import { Spin } from "lingee-ui";`
|
|
6
|
+
- 可用类型:`SpinProps`, `SpinSize`
|
|
7
|
+
|
|
8
|
+
## 最小示例
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { Spin } from "lingee-ui";
|
|
12
|
+
|
|
13
|
+
export default function BasicDemo() {
|
|
14
|
+
return <Spin spinning size="lg" />;
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
21
|
+
|------|------|------|--------|
|
|
22
|
+
| `size` | 尺寸 | `"sm" \| "md" \| "lg"` | `"md"` |
|
|
23
|
+
| `spinning` | 是否显示加载 | `boolean` | `true` |
|
|
24
|
+
| `tip` | 加载提示文本 | `string` | - |
|
|
25
|
+
| `children` | 包裹内容(容器模式) | `ReactNode` | - |
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Steps 步骤条
|
|
2
|
+
|
|
3
|
+
引导用户按照流程完成任务的导航条。
|
|
4
|
+
|
|
5
|
+
- 导入:`import { Steps } from "lingee-ui";`
|
|
6
|
+
- 可用类型:`StepsProps`, `StepItem`, `StepStatus`, `StepsSize`, `StepsTitlePlacement`
|
|
7
|
+
|
|
8
|
+
## 最小示例
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { Steps } from "lingee-ui";
|
|
12
|
+
|
|
13
|
+
const items = [
|
|
14
|
+
{ title: "Select product" },
|
|
15
|
+
{ title: "Confirm order" },
|
|
16
|
+
{ title: "Payment" },
|
|
17
|
+
{ title: "Done" },
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
export default function BasicDemo() {
|
|
21
|
+
return <Steps items={items} current={1} />;
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## API
|
|
26
|
+
|
|
27
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
28
|
+
|------|------|------|--------|
|
|
29
|
+
| `current` | 当前步骤索引(从 0 开始) | `number` | `0` |
|
|
30
|
+
| `items` | 步骤配置 | `Array<{ title, description? }>` | - |
|
|
31
|
+
| `size` | 尺寸 | `"default" \| "small"` | `"default"` |
|
|
32
|
+
| `status` | 当前步骤状态 | `"process" \| "error"` | `"process"` |
|
|
33
|
+
| `titlePlacement` | 标题方向 | `"vertical" \| "horizontal"` | `"vertical"` |
|
|
34
|
+
| `onChange` | 步骤点击回调 | `(current: number) => void` | - |
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Switch 开关
|
|
2
|
+
|
|
3
|
+
用于在两个互斥状态之间切换,如启用/禁用。
|
|
4
|
+
|
|
5
|
+
- 导入:`import { Switch } from "lingee-ui";`
|
|
6
|
+
- 可用类型:`SwitchProps`, `SwitchSize`
|
|
7
|
+
|
|
8
|
+
## 最小示例
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { Switch } from "lingee-ui";
|
|
12
|
+
|
|
13
|
+
export default function BasicDemo() {
|
|
14
|
+
return <Switch defaultChecked />;
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
21
|
+
|------|------|------|--------|
|
|
22
|
+
| `checked` | 开关状态(受控) | `boolean` | - |
|
|
23
|
+
| `defaultChecked` | 默认开关状态(非受控) | `boolean` | `false` |
|
|
24
|
+
| `onChange` | 状态变更回调 | `(checked: boolean) => void` | - |
|
|
25
|
+
| `size` | 开关尺寸 | `"sm" \| "md" \| "lg"` | `"md"` |
|
|
26
|
+
| `disabled` | 禁用状态 | `boolean` | `false` |
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Table 表格
|
|
2
|
+
|
|
3
|
+
用于展示行列数据的表格组件,支持排序、行选择、加载态等。
|
|
4
|
+
|
|
5
|
+
- 导入:`import { Table } from "lingee-ui";`
|
|
6
|
+
- 可用类型:`TableProps`, `TableColumnType`, `TableRowSelection`, `TableSize`, `TableSorterState`
|
|
7
|
+
|
|
8
|
+
## 最小示例
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { Table } from "lingee-ui";
|
|
12
|
+
|
|
13
|
+
const columns = [
|
|
14
|
+
{ title: "Name", dataIndex: "name", key: "name" },
|
|
15
|
+
{ title: "Age", dataIndex: "age", key: "age" },
|
|
16
|
+
{ title: "Department", dataIndex: "department", key: "department" },
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
const dataSource = [
|
|
20
|
+
{ key: "1", name: "Alice Chen", age: 28, department: "Engineering" },
|
|
21
|
+
{ key: "2", name: "Bob Liu", age: 32, department: "Product" },
|
|
22
|
+
{ key: "3", name: "Carol Wang", age: 25, department: "Design" },
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
export default function BasicDemo() {
|
|
26
|
+
return <Table columns={columns} dataSource={dataSource} />;
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
33
|
+
|------|------|------|--------|
|
|
34
|
+
| `columns` | 列定义 | `Array<{ title, dataIndex, key, render?, width?, align?, fixed?, sorter? }>` | - |
|
|
35
|
+
| `dataSource` | 数据源 | `Array<Record<string, any>>` | `[]` |
|
|
36
|
+
| `loading` | 是否显示加载状态 | `boolean` | `false` |
|
|
37
|
+
| `rowKey` | 行唯一标识字段 | `string \| ((record) => string)` | `"key"` |
|
|
38
|
+
| `rowSelection` | 行选择配置 | `{ selectedRowKeys, onChange }` | - |
|
|
39
|
+
| `onRow` | 行事件 | `(record, index) => HTMLAttributes` | - |
|
|
40
|
+
| `size` | 尺寸 | `"default" \| "large"` | `"default"` |
|
|
41
|
+
| `bordered` | 是否显示边框 | `boolean` | `false` |
|
|
42
|
+
| `striped` | 是否显示斑马纹 | `boolean` | `false` |
|
|
43
|
+
| `hoverable` | 是否行悬浮高亮 | `boolean` | `true` |
|
|
44
|
+
| `scroll` | 滚动设置 | `{ x?: number, y?: number }` | - |
|