@teamix-evo/ui 0.1.1 → 0.2.0
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/README.md +1 -1
- package/package.json +8 -4
- package/src/components/accordion/accordion.meta.md +10 -5
- package/src/components/accordion/accordion.stories.tsx +11 -6
- package/src/components/affix/affix.meta.md +19 -10
- package/src/components/affix/affix.stories.tsx +4 -2
- package/src/components/alert/alert.meta.md +19 -14
- package/src/components/alert/alert.stories.tsx +1 -1
- package/src/components/alert/alert.tsx +5 -5
- package/src/components/alert-dialog/alert-dialog.meta.md +23 -10
- package/src/components/alert-dialog/alert-dialog.stories.tsx +1 -1
- package/src/components/alert-dialog/alert-dialog.tsx +1 -1
- package/src/components/anchor/anchor.meta.md +20 -11
- package/src/components/anchor/anchor.stories.tsx +1 -1
- package/src/components/app/app.meta.md +19 -10
- package/src/components/app/app.stories.tsx +4 -2
- package/src/components/aspect-ratio/aspect-ratio.meta.md +10 -5
- package/src/components/aspect-ratio/aspect-ratio.stories.tsx +1 -1
- package/src/components/auto-complete/auto-complete.meta.md +25 -16
- package/src/components/auto-complete/auto-complete.stories.tsx +4 -2
- package/src/components/avatar/avatar.meta.md +23 -11
- package/src/components/avatar/avatar.stories.tsx +1 -1
- package/src/components/badge/badge.meta.md +26 -21
- package/src/components/badge/badge.tsx +7 -13
- package/src/components/breadcrumb/breadcrumb.meta.md +21 -10
- package/src/components/breadcrumb/breadcrumb.stories.tsx +8 -0
- package/src/components/button/button.meta.md +22 -17
- package/src/components/button/button.stories.tsx +1 -1
- package/src/components/button/demo/as-child.tsx +24 -0
- package/src/components/button/demo/basic.tsx +8 -0
- package/src/components/button/demo/block.tsx +16 -0
- package/src/components/button/demo/loading.tsx +19 -0
- package/src/components/button/demo/shapes.tsx +18 -0
- package/src/components/button/demo/sizes.tsx +19 -0
- package/src/components/button/demo/variants.tsx +19 -0
- package/src/components/button/demo/with-icon.tsx +20 -0
- package/src/components/button-group/button-group.meta.md +18 -9
- package/src/components/button-group/button-group.stories.tsx +5 -2
- package/src/components/calendar/calendar.meta.md +14 -9
- package/src/components/calendar/calendar.stories.tsx +1 -1
- package/src/components/calendar/calendar.tsx +1 -1
- package/src/components/card/card.meta.md +36 -11
- package/src/components/card/card.stories.tsx +8 -0
- package/src/components/carousel/carousel.meta.md +16 -11
- package/src/components/carousel/carousel.stories.tsx +10 -5
- package/src/components/cascader/cascader.meta.md +28 -19
- package/src/components/cascader/cascader.stories.tsx +9 -8
- package/src/components/cascader/cascader.tsx +2 -2
- package/src/components/checkbox/checkbox.meta.md +26 -8
- package/src/components/checkbox/checkbox.stories.tsx +1 -1
- package/src/components/collapsible/collapsible.meta.md +11 -4
- package/src/components/collapsible/collapsible.stories.tsx +8 -0
- package/src/components/color-picker/color-picker.meta.md +27 -18
- package/src/components/color-picker/color-picker.stories.tsx +1 -1
- package/src/components/color-picker/color-picker.tsx +1 -0
- package/src/components/combobox/combobox.meta.md +29 -20
- package/src/components/combobox/combobox.stories.tsx +1 -1
- package/src/components/combobox/combobox.tsx +3 -3
- package/src/components/command/command.meta.md +32 -12
- package/src/components/command/command.stories.tsx +1 -1
- package/src/components/command/command.tsx +1 -1
- package/src/components/context-menu/context-menu.meta.md +34 -11
- package/src/components/context-menu/context-menu.stories.tsx +8 -0
- package/src/components/context-menu/context-menu.tsx +2 -2
- package/src/components/data-table/data-table.meta.md +24 -19
- package/src/components/data-table/data-table.stories.tsx +12 -5
- package/src/components/date-picker/date-picker.meta.md +40 -20
- package/src/components/date-picker/date-picker.stories.tsx +1 -1
- package/src/components/descriptions/descriptions.meta.md +23 -14
- package/src/components/descriptions/descriptions.stories.tsx +1 -1
- package/src/components/dialog/dialog.meta.md +25 -12
- package/src/components/dialog/dialog.stories.tsx +1 -1
- package/src/components/dialog/dialog.tsx +1 -1
- package/src/components/drawer/drawer.meta.md +19 -8
- package/src/components/drawer/drawer.stories.tsx +1 -1
- package/src/components/drawer/drawer.tsx +1 -0
- package/src/components/dropdown-menu/dropdown-menu.meta.md +42 -14
- package/src/components/dropdown-menu/dropdown-menu.stories.tsx +8 -0
- package/src/components/dropdown-menu/dropdown-menu.tsx +2 -2
- package/src/components/empty/empty.meta.md +20 -11
- package/src/components/empty/empty.stories.tsx +1 -1
- package/src/components/field/field.meta.md +27 -10
- package/src/components/field/field.stories.tsx +6 -3
- package/src/components/flex/flex.meta.md +23 -14
- package/src/components/flex/flex.stories.tsx +46 -14
- package/src/components/float-button/float-button.meta.md +35 -11
- package/src/components/float-button/float-button.stories.tsx +4 -2
- package/src/components/float-button/float-button.tsx +1 -1
- package/src/components/form/form.meta.md +57 -14
- package/src/components/form/form.stories.tsx +1 -1
- package/src/components/grid/grid.meta.md +31 -6
- package/src/components/grid/grid.stories.tsx +4 -2
- package/src/components/hover-card/hover-card.meta.md +21 -9
- package/src/components/hover-card/hover-card.stories.tsx +6 -2
- package/src/components/image/image.meta.md +24 -15
- package/src/components/image/image.stories.tsx +1 -1
- package/src/components/image/image.tsx +4 -4
- package/src/components/input/demo/addon.tsx +15 -0
- package/src/components/input/demo/basic.tsx +12 -0
- package/src/components/input/demo/clearable.tsx +21 -0
- package/src/components/input/demo/show-count.tsx +18 -0
- package/src/components/input/demo/sizes.tsx +15 -0
- package/src/components/input/demo/with-prefix-suffix.tsx +19 -0
- package/src/components/input/input.meta.md +21 -16
- package/src/components/input/input.stories.tsx +1 -1
- package/src/components/input/input.tsx +51 -47
- package/src/components/input-group/input-group.meta.md +26 -8
- package/src/components/input-group/input-group.stories.tsx +1 -1
- package/src/components/input-group/input-group.tsx +4 -3
- package/src/components/input-number/input-number.meta.md +26 -17
- package/src/components/input-number/input-number.stories.tsx +14 -3
- package/src/components/input-number/input-number.tsx +20 -6
- package/src/components/input-otp/input-otp.meta.md +22 -9
- package/src/components/input-otp/input-otp.stories.tsx +1 -1
- package/src/components/item/item.meta.md +32 -9
- package/src/components/item/item.stories.tsx +5 -2
- package/src/components/kbd/kbd.meta.md +29 -8
- package/src/components/kbd/kbd.stories.tsx +1 -1
- package/src/components/kbd/kbd.tsx +2 -1
- package/src/components/label/label.meta.md +14 -9
- package/src/components/masonry/masonry.meta.md +18 -9
- package/src/components/masonry/masonry.stories.tsx +4 -2
- package/src/components/masonry/masonry.tsx +1 -0
- package/src/components/mentions/mentions.meta.md +28 -19
- package/src/components/mentions/mentions.stories.tsx +1 -1
- package/src/components/mentions/mentions.tsx +2 -1
- package/src/components/menubar/menubar.meta.md +36 -14
- package/src/components/menubar/menubar.stories.tsx +8 -0
- package/src/components/menubar/menubar.tsx +2 -2
- package/src/components/native-select/native-select.meta.md +17 -8
- package/src/components/native-select/native-select.stories.tsx +6 -3
- package/src/components/navigation-menu/navigation-menu.meta.md +25 -11
- package/src/components/navigation-menu/navigation-menu.stories.tsx +11 -11
- package/src/components/navigation-menu/navigation-menu.tsx +3 -2
- package/src/components/notification/notification.meta.md +14 -5
- package/src/components/notification/notification.stories.tsx +5 -3
- package/src/components/notification/notification.tsx +3 -3
- package/src/components/pagination/pagination.meta.md +59 -28
- package/src/components/pagination/pagination.stories.tsx +9 -3
- package/src/components/popconfirm/popconfirm.meta.md +30 -21
- package/src/components/popconfirm/popconfirm.stories.tsx +1 -2
- package/src/components/popconfirm/popconfirm.tsx +1 -1
- package/src/components/popover/popover.meta.md +13 -8
- package/src/components/popover/popover.stories.tsx +1 -1
- package/src/components/progress/progress.meta.md +28 -13
- package/src/components/progress/progress.stories.tsx +1 -1
- package/src/components/progress/progress.tsx +6 -6
- package/src/components/radio-group/radio-group.meta.md +17 -12
- package/src/components/radio-group/radio-group.stories.tsx +1 -1
- package/src/components/rate/rate.meta.md +25 -16
- package/src/components/rate/rate.stories.tsx +11 -3
- package/src/components/rate/rate.tsx +2 -2
- package/src/components/resizable/resizable.meta.md +19 -8
- package/src/components/resizable/resizable.stories.tsx +1 -1
- package/src/components/result/result.meta.md +21 -12
- package/src/components/result/result.stories.tsx +2 -6
- package/src/components/result/result.tsx +3 -3
- package/src/components/scroll-area/scroll-area.meta.md +10 -5
- package/src/components/scroll-area/scroll-area.stories.tsx +8 -0
- package/src/components/scroll-area/scroll-area.tsx +3 -3
- package/src/components/segmented/segmented.meta.md +19 -14
- package/src/components/segmented/segmented.stories.tsx +35 -6
- package/src/components/select/select.meta.md +22 -9
- package/src/components/select/select.stories.tsx +1 -1
- package/src/components/select/select.tsx +2 -2
- package/src/components/separator/separator.meta.md +16 -11
- package/src/components/separator/separator.stories.tsx +1 -1
- package/src/components/sheet/sheet.meta.md +22 -11
- package/src/components/sheet/sheet.stories.tsx +1 -1
- package/src/components/sidebar/sidebar.meta.md +47 -18
- package/src/components/sidebar/sidebar.stories.tsx +10 -5
- package/src/components/skeleton/skeleton.meta.md +33 -10
- package/src/components/skeleton/skeleton.stories.tsx +1 -1
- package/src/components/slider/slider.meta.md +12 -7
- package/src/components/slider/slider.stories.tsx +1 -1
- package/src/components/sonner/sonner.meta.md +8 -3
- package/src/components/sonner/sonner.stories.tsx +13 -8
- package/src/components/space/space.meta.md +22 -13
- package/src/components/space/space.stories.tsx +20 -6
- package/src/components/spinner/spinner.meta.md +23 -10
- package/src/components/spinner/spinner.stories.tsx +1 -1
- package/src/components/statistic/statistic.meta.md +37 -16
- package/src/components/statistic/statistic.stories.tsx +2 -6
- package/src/components/statistic/statistic.tsx +1 -1
- package/src/components/steps/steps.meta.md +21 -12
- package/src/components/steps/steps.stories.tsx +7 -2
- package/src/components/switch/switch.meta.md +16 -11
- package/src/components/switch/switch.stories.tsx +1 -1
- package/src/components/switch/switch.tsx +58 -36
- package/src/components/table/table.meta.md +24 -9
- package/src/components/table/table.stories.tsx +9 -4
- package/src/components/tabs/tabs.meta.md +14 -9
- package/src/components/tabs/tabs.stories.tsx +8 -0
- package/src/components/tag/tag.meta.md +39 -10
- package/src/components/tag/tag.stories.tsx +7 -2
- package/src/components/tag/tag.tsx +3 -3
- package/src/components/textarea/textarea.meta.md +17 -12
- package/src/components/textarea/textarea.stories.tsx +1 -1
- package/src/components/textarea/textarea.tsx +1 -1
- package/src/components/time-picker/time-picker.meta.md +38 -15
- package/src/components/time-picker/time-picker.stories.tsx +44 -6
- package/src/components/time-picker/time-picker.tsx +74 -10
- package/src/components/timeline/timeline.meta.md +20 -11
- package/src/components/timeline/timeline.stories.tsx +14 -4
- package/src/components/timeline/timeline.tsx +3 -2
- package/src/components/toggle/toggle.meta.md +14 -9
- package/src/components/toggle/toggle.stories.tsx +1 -1
- package/src/components/toggle-group/toggle-group.meta.md +16 -11
- package/src/components/toggle-group/toggle-group.stories.tsx +1 -1
- package/src/components/tooltip/tooltip.meta.md +18 -13
- package/src/components/tooltip/tooltip.stories.tsx +1 -1
- package/src/components/tour/tour.meta.md +25 -16
- package/src/components/tour/tour.stories.tsx +1 -1
- package/src/components/tour/tour.tsx +1 -1
- package/src/components/transfer/transfer.meta.md +29 -20
- package/src/components/transfer/transfer.stories.tsx +2 -6
- package/src/components/tree/tree.meta.md +36 -23
- package/src/components/tree/tree.stories.tsx +30 -11
- package/src/components/tree-select/tree-select.meta.md +37 -22
- package/src/components/tree-select/tree-select.stories.tsx +1 -1
- package/src/components/tree-select/tree-select.tsx +1 -1
- package/src/components/typography/typography.meta.md +41 -16
- package/src/components/typography/typography.stories.tsx +4 -8
- package/src/components/typography/typography.tsx +5 -3
- package/src/components/upload/upload.meta.md +31 -22
- package/src/components/upload/upload.stories.tsx +8 -14
- package/src/components/watermark/watermark.meta.md +26 -17
- package/src/components/watermark/watermark.stories.tsx +4 -2
- package/src/components/watermark/watermark.tsx +1 -0
|
@@ -4,10 +4,11 @@ name: AutoComplete
|
|
|
4
4
|
type: component
|
|
5
5
|
category: form
|
|
6
6
|
since: 0.1.0
|
|
7
|
-
package:
|
|
7
|
+
package: '@teamix-evo/ui'
|
|
8
|
+
displayName: 自动补全
|
|
8
9
|
---
|
|
9
10
|
|
|
10
|
-
# AutoComplete
|
|
11
|
+
# AutoComplete 自动补全
|
|
11
12
|
|
|
12
13
|
输入即建议 — antd 独有补足。**等价 antd `AutoComplete`**。键入触发候选下拉,可选可改;**最终 value 可以是任意字符串**(不强制为选项之一),与 `Combobox`(必选)互补。配 `onSearch` 实现异步建议。
|
|
13
14
|
|
|
@@ -23,33 +24,41 @@ package: "@teamix-evo/ui"
|
|
|
23
24
|
- 多选 → `Select multiple`
|
|
24
25
|
- @提及输入 → `Mentions`
|
|
25
26
|
|
|
27
|
+
## Props
|
|
28
|
+
|
|
26
29
|
<!-- auto:props:begin -->
|
|
27
|
-
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
| `
|
|
31
|
-
| `
|
|
32
|
-
| `
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
30
|
+
|
|
31
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
32
|
+
| -------------- | ----------------------------------------------------- | ------------ | ---- | ----------------------------------------------------------------------------------------------- |
|
|
33
|
+
| `options` | `AutoCompleteOption[]` | – | ✓ | 候选项(antd `options` 并集) — 通常由 onSearch 回调刷新。 |
|
|
34
|
+
| `value` | `string` | – | – | 受控值。 |
|
|
35
|
+
| `defaultValue` | `string` | – | – | uncontrolled 初值。 |
|
|
36
|
+
| `onChange` | `(value: string) => void` | – | – | 值变化回调 — 用户键入 / 选中候选时触发。 |
|
|
37
|
+
| `onSearch` | `(query: string) => void` | – | – | 用户输入时回调,用于刷新 `options`(异步建议)。 |
|
|
38
|
+
| `onSelect` | `(value: string, option: AutoCompleteOption) => void` | – | – | 选中候选时回调。 |
|
|
39
|
+
| `openOnFocus` | `boolean` | `false` | – | 是否在输入框聚焦但 query 为空时显示完整 `options`(antd `defaultActiveFirstOption` 行为的近似)。 |
|
|
40
|
+
| `emptyText` | `string` | `"无匹配项"` | – | 无匹配时的提示文本。 |
|
|
41
|
+
| `size` | `'sm' \| 'default' \| 'lg'` | `"default"` | – | 容器尺寸 — 透传 Input.size。 |
|
|
42
|
+
|
|
38
43
|
<!-- auto:props:end -->
|
|
39
44
|
|
|
45
|
+
## 依赖
|
|
46
|
+
|
|
40
47
|
<!-- auto:deps:begin -->
|
|
48
|
+
|
|
41
49
|
### 同库依赖
|
|
42
50
|
|
|
43
51
|
> `teamix-evo ui add auto-complete` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
44
52
|
|
|
45
|
-
| Entry
|
|
46
|
-
|
|
|
47
|
-
| `cn`
|
|
53
|
+
| Entry | 类型 | 描述 |
|
|
54
|
+
| ------- | --------- | ----------------------------------------------------------------------------------------------- |
|
|
55
|
+
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
48
56
|
| `input` | component | 文本输入 — shadcn 简洁基底 + antd prefix/suffix/clearable/showCount/addonBefore/addonAfter/size |
|
|
49
57
|
|
|
50
58
|
### npm 依赖
|
|
51
59
|
|
|
52
60
|
_无 — 本组件不依赖任何 npm 包。_
|
|
61
|
+
|
|
53
62
|
<!-- auto:deps:end -->
|
|
54
63
|
|
|
55
64
|
## AI 生成纪律
|
|
@@ -10,7 +10,7 @@ const meta: Meta<typeof AutoComplete> = {
|
|
|
10
10
|
docs: {
|
|
11
11
|
description: {
|
|
12
12
|
component:
|
|
13
|
-
'输入即建议 —
|
|
13
|
+
'输入即建议 — 键入触发候选下拉,可选可改。最终 value 是自由文本,不强制为选项之一(与 Combobox 必选互补)。配 onSearch 实现异步建议。等价 antd `AutoComplete`。',
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
},
|
|
@@ -81,7 +81,9 @@ export const AsyncSearch: Story = {
|
|
|
81
81
|
options={opts}
|
|
82
82
|
onSearch={(q) => {
|
|
83
83
|
window.setTimeout(() => {
|
|
84
|
-
setOpts(
|
|
84
|
+
setOpts(
|
|
85
|
+
all.filter((v) => v.includes(q)).map((v) => ({ value: v })),
|
|
86
|
+
);
|
|
85
87
|
}, 80);
|
|
86
88
|
}}
|
|
87
89
|
placeholder="搜索城市(模拟异步)..."
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: avatar
|
|
3
3
|
name: Avatar
|
|
4
|
+
displayName: 头像
|
|
4
5
|
type: component
|
|
5
6
|
category: foundation
|
|
6
7
|
since: 0.1.0
|
|
7
|
-
package:
|
|
8
|
+
package: '@teamix-evo/ui'
|
|
8
9
|
---
|
|
9
10
|
|
|
10
|
-
# Avatar
|
|
11
|
+
# Avatar 头像
|
|
11
12
|
|
|
12
13
|
头像 — Radix Avatar(图片加载失败自动回退到 Fallback)+ antd Avatar 的 `size / shape / Avatar.Group` 并集。
|
|
13
14
|
|
|
@@ -27,10 +28,21 @@ package: "@teamix-evo/ui"
|
|
|
27
28
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成。
|
|
28
29
|
|
|
29
30
|
<!-- auto:props:begin -->
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
|
31
|
+
|
|
32
|
+
#### Avatar
|
|
33
|
+
|
|
34
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
35
|
+
| ------- | ----------------------------------- | ----------- | ---- | ---------------------------------------------------- |
|
|
36
|
+
| `size` | `'sm' \| 'default' \| 'lg' \| 'xl'` | `"default"` | – | 尺寸(antd 并集:sm 32 / default 40 / lg 48 / xl 64)。 |
|
|
37
|
+
| `shape` | `'circle' \| 'square'` | `"circle"` | – | 形状(antd 并集)。 |
|
|
38
|
+
|
|
39
|
+
#### AvatarGroup
|
|
40
|
+
|
|
41
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
42
|
+
| ------ | ----------------------------------- | ------ | ---- | -------------------------------------------------- |
|
|
43
|
+
| `max` | `number` | `3` | – | 显示前 N 个 Avatar,其余收为 `+N` 折叠气泡。 |
|
|
44
|
+
| `size` | `'sm' \| 'default' \| 'lg' \| 'xl'` | – | – | Group 内所有 Avatar 共享的尺寸,会覆盖单个 Avatar。 |
|
|
45
|
+
|
|
34
46
|
<!-- auto:props:end -->
|
|
35
47
|
|
|
36
48
|
## 依赖
|
|
@@ -38,13 +50,14 @@ package: "@teamix-evo/ui"
|
|
|
38
50
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成,数据源是 [`manifest.json`](../../../manifest.json)。**手工编辑 marker 之间的内容会在下次生成时被覆盖**。
|
|
39
51
|
|
|
40
52
|
<!-- auto:deps:begin -->
|
|
53
|
+
|
|
41
54
|
### 同库依赖
|
|
42
55
|
|
|
43
56
|
> `teamix-evo ui add avatar` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
44
57
|
|
|
45
|
-
| Entry | 类型 | 描述
|
|
46
|
-
|
|
|
47
|
-
| `cn`
|
|
58
|
+
| Entry | 类型 | 描述 |
|
|
59
|
+
| ----- | ---- | -------------------------------------------------- |
|
|
60
|
+
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
48
61
|
|
|
49
62
|
### npm 依赖
|
|
50
63
|
|
|
@@ -53,9 +66,8 @@ package: "@teamix-evo/ui"
|
|
|
53
66
|
```bash
|
|
54
67
|
pnpm add @radix-ui/react-avatar@^1.1.0 class-variance-authority@^0.7.0
|
|
55
68
|
```
|
|
56
|
-
<!-- auto:deps:end -->
|
|
57
69
|
|
|
58
|
-
|
|
70
|
+
<!-- auto:deps:end -->
|
|
59
71
|
|
|
60
72
|
## AI 生成纪律
|
|
61
73
|
|
|
@@ -9,7 +9,7 @@ const meta: Meta<typeof Avatar> = {
|
|
|
9
9
|
docs: {
|
|
10
10
|
description: {
|
|
11
11
|
component:
|
|
12
|
-
'头像 — 表示用户或对象,支持图片 / 文字 / 图标三种回退源。基于 Radix Avatar
|
|
12
|
+
'头像 — 表示用户或对象,支持图片 / 文字 / 图标三种回退源。基于 Radix Avatar(图片加载失败自动回退到 fallback)+ antd 增强:尺寸 sm/default/lg、形状 circle/square、`AvatarGroup` 堆叠。Image / Fallback 通过命名子组件组合。',
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
15
|
},
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: badge
|
|
3
3
|
name: Badge
|
|
4
|
+
displayName: 徽标
|
|
4
5
|
type: component
|
|
5
6
|
category: foundation
|
|
6
7
|
since: 0.1.0
|
|
7
|
-
package:
|
|
8
|
+
package: '@teamix-evo/ui'
|
|
8
9
|
---
|
|
9
10
|
|
|
10
|
-
# Badge
|
|
11
|
+
# Badge 徽标
|
|
11
12
|
|
|
12
13
|
徽标 — shadcn 文本标签风格 + antd 数字徽标 / 红点 / 状态点的合集。
|
|
13
14
|
**单组件四种形态**,根据 props 自动切换:
|
|
14
15
|
|
|
15
|
-
| 形态
|
|
16
|
-
|
|
|
17
|
-
| 文本徽标(shadcn) | 无 `count / dot / status`,仅 `children` | `<Badge>New</Badge>`
|
|
18
|
-
| 包裹徽标(antd)
|
|
19
|
-
| 独立数字气泡
|
|
20
|
-
| 状态点 + 文字
|
|
16
|
+
| 形态 | 触发条件 | 示例 |
|
|
17
|
+
| ---------------- | --------------------------------------- | ------------------------------------------ |
|
|
18
|
+
| 文本徽标(shadcn) | 无 `count / dot / status`,仅 `children` | `<Badge>New</Badge>` |
|
|
19
|
+
| 包裹徽标(antd) | 有 `children` + `count` 或 `dot` | `<Badge count={5}><Avatar /></Badge>` |
|
|
20
|
+
| 独立数字气泡 | 仅 `count`,无 `children` | `<Badge count={3} />` |
|
|
21
|
+
| 状态点 + 文字 | 有 `status` | `<Badge status="success" text="运行中" />` |
|
|
21
22
|
|
|
22
23
|
## When to use
|
|
23
24
|
|
|
@@ -37,16 +38,18 @@ package: "@teamix-evo/ui"
|
|
|
37
38
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成,数据源是 [`badge.tsx`](./badge.tsx) 的 `BadgeProps` interface JSDoc。**手工编辑 marker 之间的内容会在下次生成时被覆盖**。
|
|
38
39
|
|
|
39
40
|
<!-- auto:props:begin -->
|
|
40
|
-
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
45
|
-
| `
|
|
46
|
-
| `
|
|
47
|
-
| `
|
|
48
|
-
| `
|
|
49
|
-
| `
|
|
41
|
+
|
|
42
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
43
|
+
| --------------- | ---------------------------------------------------------------------------------- | ----------- | ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
44
|
+
| `variant` | `'default' \| 'secondary' \| 'destructive' \| 'outline' \| 'success' \| 'warning'` | `"default"` | – | 视觉风格;`default / secondary / destructive / outline` 来自 shadcn, `success / warning` 来自 antd 状态色补足。 |
|
|
45
|
+
| `count` | `number` | – | – | 数字徽标内容。配合 `children` 时,数字气泡浮在右上角(包裹模式); 无 `children` 时,渲染为独立小气泡(standalone 模式)。 `0` 默认不显示,需配 `showZero`。 |
|
|
46
|
+
| `overflowCount` | `number` | `99` | – | 数字超过此值时显示 `${overflowCount}+`。仅在有 `count` 时生效。 |
|
|
47
|
+
| `showZero` | `boolean` | `false` | – | `true` 时即使 `count === 0` 也显示气泡。 |
|
|
48
|
+
| `dot` | `boolean` | `false` | – | `true` 时渲染为纯红点(无文字)。配合 `children` 时浮在右上角。 `dot` 与 `count` 同时存在,`dot` 优先。 |
|
|
49
|
+
| `status` | `BadgeStatus` | – | – | 状态点 + 文字(`<dot> <text>` 行内组合),用于"运行中 / 已停止"等状态描述。 必须与 `children` 互斥使用 — 这是 standalone 状态条形态。 |
|
|
50
|
+
| `text` | `React.ReactNode` | – | – | 配合 `status` 使用,渲染在状态点右侧。无 `status` 时忽略。 |
|
|
51
|
+
| `children` | `React.ReactNode` | – | – | 被包裹的元素(包裹模式)或徽标文本内容(standalone 文本模式)。 |
|
|
52
|
+
|
|
50
53
|
<!-- auto:props:end -->
|
|
51
54
|
|
|
52
55
|
## 依赖
|
|
@@ -54,13 +57,14 @@ package: "@teamix-evo/ui"
|
|
|
54
57
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成,数据源是 [`manifest.json`](../../../manifest.json)。**手工编辑 marker 之间的内容会在下次生成时被覆盖**。
|
|
55
58
|
|
|
56
59
|
<!-- auto:deps:begin -->
|
|
60
|
+
|
|
57
61
|
### 同库依赖
|
|
58
62
|
|
|
59
63
|
> `teamix-evo ui add badge` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
60
64
|
|
|
61
|
-
| Entry | 类型 | 描述
|
|
62
|
-
|
|
|
63
|
-
| `cn`
|
|
65
|
+
| Entry | 类型 | 描述 |
|
|
66
|
+
| ----- | ---- | -------------------------------------------------- |
|
|
67
|
+
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
64
68
|
|
|
65
69
|
### npm 依赖
|
|
66
70
|
|
|
@@ -69,6 +73,7 @@ package: "@teamix-evo/ui"
|
|
|
69
73
|
```bash
|
|
70
74
|
pnpm add class-variance-authority@^0.7.0
|
|
71
75
|
```
|
|
76
|
+
|
|
72
77
|
<!-- auto:deps:end -->
|
|
73
78
|
|
|
74
79
|
> 除上述 props 外,Badge 透传所有 `<span>` 原生属性(`onClick` / `aria-*` / `id` / ...)。
|
|
@@ -16,9 +16,9 @@ const badgeVariants = cva(
|
|
|
16
16
|
'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80',
|
|
17
17
|
outline: 'text-foreground',
|
|
18
18
|
success:
|
|
19
|
-
'border-transparent bg-
|
|
19
|
+
'border-transparent bg-success text-success-foreground hover:bg-success/80',
|
|
20
20
|
warning:
|
|
21
|
-
'border-transparent bg-
|
|
21
|
+
'border-transparent bg-warning text-warning-foreground hover:bg-warning/80',
|
|
22
22
|
},
|
|
23
23
|
},
|
|
24
24
|
defaultVariants: {
|
|
@@ -27,18 +27,12 @@ const badgeVariants = cva(
|
|
|
27
27
|
},
|
|
28
28
|
);
|
|
29
29
|
|
|
30
|
-
/**
|
|
31
|
-
* 状态点的语义色映射。来自 design `foundations/color/semantic.md`。
|
|
32
|
-
* 之所以这里硬编码 hex/tailwind class 而非 design token,
|
|
33
|
-
* 是因为 status 是数值化状态枚举(antd 体系),需要稳定一对一映射;
|
|
34
|
-
* 切换 design variant 时通过 token 层调整这些颜色,而非组件层。
|
|
35
|
-
*/
|
|
36
30
|
const statusDotClasses: Record<BadgeStatus, string> = {
|
|
37
31
|
default: 'bg-muted-foreground',
|
|
38
|
-
success: 'bg-
|
|
39
|
-
processing: 'bg-
|
|
32
|
+
success: 'bg-success',
|
|
33
|
+
processing: 'bg-info',
|
|
40
34
|
error: 'bg-destructive',
|
|
41
|
-
warning: 'bg-
|
|
35
|
+
warning: 'bg-warning',
|
|
42
36
|
};
|
|
43
37
|
|
|
44
38
|
export type BadgeStatus =
|
|
@@ -154,7 +148,7 @@ const Badge = React.forwardRef<HTMLSpanElement, BadgeProps>(
|
|
|
154
148
|
aria-hidden="true"
|
|
155
149
|
/>
|
|
156
150
|
) : (
|
|
157
|
-
<span className="absolute right-0 top-0 inline-flex min-w-
|
|
151
|
+
<span className="absolute right-0 top-0 inline-flex h-5 min-w-counter -translate-y-1/2 translate-x-1/2 items-center justify-center rounded-full bg-destructive px-1.5 text-xs font-semibold leading-none text-destructive-foreground ring-2 ring-background">
|
|
158
152
|
{display}
|
|
159
153
|
</span>
|
|
160
154
|
)}
|
|
@@ -183,7 +177,7 @@ const Badge = React.forwardRef<HTMLSpanElement, BadgeProps>(
|
|
|
183
177
|
<span
|
|
184
178
|
ref={ref}
|
|
185
179
|
className={cn(
|
|
186
|
-
'inline-flex min-w-
|
|
180
|
+
'inline-flex h-5 min-w-counter items-center justify-center rounded-full bg-destructive px-1.5 text-xs font-semibold leading-none text-destructive-foreground',
|
|
187
181
|
className,
|
|
188
182
|
)}
|
|
189
183
|
{...props}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: breadcrumb
|
|
3
3
|
name: Breadcrumb
|
|
4
|
+
displayName: 面包屑
|
|
4
5
|
type: component
|
|
5
6
|
category: navigation
|
|
6
7
|
since: 0.1.0
|
|
7
|
-
package:
|
|
8
|
+
package: '@teamix-evo/ui'
|
|
8
9
|
---
|
|
9
10
|
|
|
10
|
-
# Breadcrumb
|
|
11
|
+
# Breadcrumb 面包屑
|
|
11
12
|
|
|
12
13
|
面包屑 — 纯组合组件 + antd `separator` 自定义并集。
|
|
13
14
|
**与 antd Breadcrumb 的差异**:antd 用 `routes` 数组配置;本组件走 shadcn 的**组合式**(每项手写 `<BreadcrumbItem>`),配 React Router / Next.js Link 时更灵活。
|
|
@@ -29,9 +30,19 @@ package: "@teamix-evo/ui"
|
|
|
29
30
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成。
|
|
30
31
|
|
|
31
32
|
<!-- auto:props:begin -->
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
|
|
34
|
+
#### Breadcrumb
|
|
35
|
+
|
|
36
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
37
|
+
| ----------- | ----------------- | ------ | ---- | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
38
|
+
| `separator` | `React.ReactNode` | – | – | 自定义分隔符(antd `separator` 并集)。每个 `<BreadcrumbSeparator />` 默认渲染 `<ChevronRight />`, 通过设置 children 可全局覆盖。 |
|
|
39
|
+
|
|
40
|
+
#### BreadcrumbLink
|
|
41
|
+
|
|
42
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
43
|
+
| --------- | --------- | ------ | ---- | ---------------------------------------------------------- |
|
|
44
|
+
| `asChild` | `boolean` | – | – | 用 Slot 渲染为子元素(常配合 React Router / Next.js Link)。 |
|
|
45
|
+
|
|
35
46
|
<!-- auto:props:end -->
|
|
36
47
|
|
|
37
48
|
## 依赖
|
|
@@ -39,13 +50,14 @@ package: "@teamix-evo/ui"
|
|
|
39
50
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成,数据源是 [`manifest.json`](../../../manifest.json)。**手工编辑 marker 之间的内容会在下次生成时被覆盖**。
|
|
40
51
|
|
|
41
52
|
<!-- auto:deps:begin -->
|
|
53
|
+
|
|
42
54
|
### 同库依赖
|
|
43
55
|
|
|
44
56
|
> `teamix-evo ui add breadcrumb` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
45
57
|
|
|
46
|
-
| Entry | 类型 | 描述
|
|
47
|
-
|
|
|
48
|
-
| `cn`
|
|
58
|
+
| Entry | 类型 | 描述 |
|
|
59
|
+
| ----- | ---- | -------------------------------------------------- |
|
|
60
|
+
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
49
61
|
|
|
50
62
|
### npm 依赖
|
|
51
63
|
|
|
@@ -54,9 +66,8 @@ package: "@teamix-evo/ui"
|
|
|
54
66
|
```bash
|
|
55
67
|
pnpm add @radix-ui/react-slot@^1.1.0 lucide-react@^0.460.0
|
|
56
68
|
```
|
|
57
|
-
<!-- auto:deps:end -->
|
|
58
69
|
|
|
59
|
-
|
|
70
|
+
<!-- auto:deps:end -->
|
|
60
71
|
|
|
61
72
|
## AI 生成纪律
|
|
62
73
|
|
|
@@ -14,6 +14,14 @@ const meta: Meta<typeof Breadcrumb> = {
|
|
|
14
14
|
title: '导航 · Navigation/Breadcrumb',
|
|
15
15
|
component: Breadcrumb,
|
|
16
16
|
tags: ['autodocs'],
|
|
17
|
+
parameters: {
|
|
18
|
+
docs: {
|
|
19
|
+
description: {
|
|
20
|
+
component:
|
|
21
|
+
'面包屑 — 纯组合组件 + antd separator 自定义并集。支持 asChild 配合 React Router / Next.js Link,支持长路径省略(Ellipsis)。',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
17
25
|
};
|
|
18
26
|
|
|
19
27
|
export default meta;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: button
|
|
3
3
|
name: Button
|
|
4
|
+
displayName: 按钮
|
|
4
5
|
type: component
|
|
5
6
|
category: foundation
|
|
6
7
|
since: 0.1.0
|
|
7
|
-
package:
|
|
8
|
+
package: '@teamix-evo/ui'
|
|
8
9
|
---
|
|
9
10
|
|
|
10
|
-
# Button
|
|
11
|
+
# Button 按钮
|
|
11
12
|
|
|
12
13
|
通用按钮 — 基于 shadcn/ui Button 二次封装,补齐 antd 的 `loading / icon / shape / block` 等开箱即用能力。
|
|
13
14
|
按钮文本、aria 状态由消费方提供;视觉与可访问性由组件保障。
|
|
@@ -15,7 +16,7 @@ package: "@teamix-evo/ui"
|
|
|
15
16
|
## When to use
|
|
16
17
|
|
|
17
18
|
- 表单提交、对话框确认、列表行操作等触发性交互
|
|
18
|
-
- 需要明确反馈"
|
|
19
|
+
- 需要明确反馈"按下 → 处理中 → 完成"过程的场景(用 `loading`)
|
|
19
20
|
- 需要纯图标按钮时(用 `size="icon"` + `shape="circle"` 组合)
|
|
20
21
|
|
|
21
22
|
## When NOT to use
|
|
@@ -29,17 +30,19 @@ package: "@teamix-evo/ui"
|
|
|
29
30
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成,数据源是 [`button.tsx`](./button.tsx) 的 `ButtonProps` interface JSDoc。**手工编辑 marker 之间的内容会在下次生成时被覆盖**。
|
|
30
31
|
|
|
31
32
|
<!-- auto:props:begin -->
|
|
32
|
-
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
40
|
-
| `
|
|
41
|
-
| `
|
|
42
|
-
| `
|
|
33
|
+
|
|
34
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
35
|
+
| -------------- | ----------------------------------------------------------------------------------------- | ----------- | ---- | ----------------------------------------------------------------- |
|
|
36
|
+
| `variant` | `'default' \| 'secondary' \| 'destructive' \| 'outline' \| 'dashed' \| 'ghost' \| 'link'` | `"default"` | – | 视觉风格,语义按 design token 走。 |
|
|
37
|
+
| `size` | `'sm' \| 'default' \| 'lg' \| 'icon'` | `"default"` | – | 尺寸,`icon` 为正方形纯图标按钮。 |
|
|
38
|
+
| `shape` | `'default' \| 'round' \| 'circle'` | `"default"` | – | 形状,`circle` 配 `size="icon"` 得圆形按钮。 |
|
|
39
|
+
| `block` | `boolean` | `false` | – | `true` 时撑满父容器宽度。 |
|
|
40
|
+
| `asChild` | `boolean` | `false` | – | 用 Radix Slot 模式渲染为子元素;此时 `loading` / `icon` 被忽略。 |
|
|
41
|
+
| `loading` | `boolean` | `false` | – | 显示自旋 spinner,自动 disabled,保留视觉宽度。 |
|
|
42
|
+
| `icon` | `React.ReactNode` | – | – | 前置 / 后置图标(来自 `lucide-react`)。loading 时被 spinner 替换。 |
|
|
43
|
+
| `iconPosition` | `'start' \| 'end'` | `"start"` | – | 图标 / spinner 相对文本的位置。 |
|
|
44
|
+
| `children` | `React.ReactNode` | – | – | 按钮文本 / 内容。 |
|
|
45
|
+
|
|
43
46
|
<!-- auto:props:end -->
|
|
44
47
|
|
|
45
48
|
## 依赖
|
|
@@ -47,13 +50,14 @@ package: "@teamix-evo/ui"
|
|
|
47
50
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成,数据源是 [`manifest.json`](../../../manifest.json)。**手工编辑 marker 之间的内容会在下次生成时被覆盖**。
|
|
48
51
|
|
|
49
52
|
<!-- auto:deps:begin -->
|
|
53
|
+
|
|
50
54
|
### 同库依赖
|
|
51
55
|
|
|
52
56
|
> `teamix-evo ui add button` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
53
57
|
|
|
54
|
-
| Entry | 类型 | 描述
|
|
55
|
-
|
|
|
56
|
-
| `cn`
|
|
58
|
+
| Entry | 类型 | 描述 |
|
|
59
|
+
| ----- | ---- | -------------------------------------------------- |
|
|
60
|
+
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
57
61
|
|
|
58
62
|
### npm 依赖
|
|
59
63
|
|
|
@@ -62,6 +66,7 @@ package: "@teamix-evo/ui"
|
|
|
62
66
|
```bash
|
|
63
67
|
pnpm add @radix-ui/react-slot@^1.1.0 class-variance-authority@^0.7.0 lucide-react@^0.460.0
|
|
64
68
|
```
|
|
69
|
+
|
|
65
70
|
<!-- auto:deps:end -->
|
|
66
71
|
|
|
67
72
|
> 除上述声明的 props 外,Button 同时透传所有原生 `<button>` 属性(`onClick` / `type` / `aria-*` / ...);`asChild=true` 时透传至 Radix Slot 的子元素。
|
|
@@ -25,7 +25,7 @@ const meta: Meta<typeof Button> = {
|
|
|
25
25
|
docs: {
|
|
26
26
|
description: {
|
|
27
27
|
component:
|
|
28
|
-
'通用按钮 — shadcn 实现 + antd 功能扩展(loading / icon / shape / block / dashed variant)
|
|
28
|
+
'通用按钮 — shadcn 实现 + antd 功能扩展(loading / icon / shape / block / dashed variant)。支持 7 种视觉风格、4 种尺寸、3 种形状,`loading` 自动禁用并显示 spinner,`asChild` 可渲染为任意元素。',
|
|
29
29
|
},
|
|
30
30
|
},
|
|
31
31
|
},
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Button } from '@/components/ui/button';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* asChild:用 Radix Slot 渲染为子元素(如 `<a>` / 路由 Link)。
|
|
5
|
+
* 此时 `loading` / `icon` prop 会被忽略,因为底层不再是 `<button>`。
|
|
6
|
+
*/
|
|
7
|
+
export default function Demo() {
|
|
8
|
+
return (
|
|
9
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
10
|
+
<Button asChild variant="link">
|
|
11
|
+
<a href="/ui/components/button">查看文档</a>
|
|
12
|
+
</Button>
|
|
13
|
+
<Button asChild>
|
|
14
|
+
<a
|
|
15
|
+
href="https://github.com/teamix-evo/teamix-evo"
|
|
16
|
+
target="_blank"
|
|
17
|
+
rel="noreferrer"
|
|
18
|
+
>
|
|
19
|
+
GitHub 仓库
|
|
20
|
+
</a>
|
|
21
|
+
</Button>
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Button } from '@/components/ui/button';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 块级按钮:撑满父容器宽度。
|
|
5
|
+
* 不要再额外加 `className="w-full"` 重复声明。
|
|
6
|
+
*/
|
|
7
|
+
export default function Demo() {
|
|
8
|
+
return (
|
|
9
|
+
<div className="flex w-80 flex-col gap-3">
|
|
10
|
+
<Button block>登录</Button>
|
|
11
|
+
<Button block variant="outline">
|
|
12
|
+
注册
|
|
13
|
+
</Button>
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Button } from '@/components/ui/button';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Loading 状态:自动 disabled,spinner 替换 icon 占位,按钮宽度保持。
|
|
5
|
+
* 写 `loading` 即可,不要额外加 `disabled`。
|
|
6
|
+
*/
|
|
7
|
+
export default function Demo() {
|
|
8
|
+
return (
|
|
9
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
10
|
+
<Button loading>提交中</Button>
|
|
11
|
+
<Button variant="secondary" loading>
|
|
12
|
+
加载
|
|
13
|
+
</Button>
|
|
14
|
+
<Button variant="destructive" loading>
|
|
15
|
+
删除中
|
|
16
|
+
</Button>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { X } from 'lucide-react';
|
|
2
|
+
import { Button } from '@/components/ui/button';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 三种形状:default / round / circle。
|
|
6
|
+
* circle 必须配 `size="icon"`,否则视觉会扁圆变形。
|
|
7
|
+
*/
|
|
8
|
+
export default function Demo() {
|
|
9
|
+
return (
|
|
10
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
11
|
+
<Button>Default</Button>
|
|
12
|
+
<Button shape="round">Round</Button>
|
|
13
|
+
<Button shape="circle" size="icon" variant="ghost" aria-label="关闭">
|
|
14
|
+
<X />
|
|
15
|
+
</Button>
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Plus } from 'lucide-react';
|
|
2
|
+
import { Button } from '@/components/ui/button';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 四种尺寸:sm / default / lg / icon。
|
|
6
|
+
* icon 为正方形纯图标按钮,配合 `size="icon"` 使用。
|
|
7
|
+
*/
|
|
8
|
+
export default function Demo() {
|
|
9
|
+
return (
|
|
10
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
11
|
+
<Button size="sm">Small</Button>
|
|
12
|
+
<Button size="default">Default</Button>
|
|
13
|
+
<Button size="lg">Large</Button>
|
|
14
|
+
<Button size="icon" aria-label="Add">
|
|
15
|
+
<Plus />
|
|
16
|
+
</Button>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
}
|