@teamix-evo/ui 0.2.0 → 0.3.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 +184 -184
- package/manifest.json +680 -492
- package/package.json +15 -9
- package/src/components/accordion/accordion.meta.md +5 -9
- package/src/components/accordion/accordion.stories.tsx +3 -3
- package/src/components/accordion/accordion.tsx +104 -8
- package/src/components/affix/affix.meta.md +21 -12
- package/src/components/affix/affix.stories.tsx +101 -26
- package/src/components/affix/affix.tsx +79 -9
- package/src/components/alert/alert.meta.md +52 -26
- package/src/components/alert/alert.stories.tsx +66 -21
- package/src/components/alert/alert.tsx +81 -34
- package/src/components/alert-dialog/alert-dialog.meta.md +48 -16
- package/src/components/alert-dialog/alert-dialog.stories.tsx +145 -3
- package/src/components/alert-dialog/alert-dialog.tsx +60 -13
- package/src/components/anchor/anchor.meta.md +10 -14
- package/src/components/anchor/anchor.stories.tsx +3 -3
- package/src/components/anchor/anchor.tsx +2 -2
- package/src/components/app/app.meta.md +10 -14
- package/src/components/app/app.stories.tsx +6 -6
- package/src/components/aspect-ratio/aspect-ratio.meta.md +4 -8
- package/src/components/aspect-ratio/aspect-ratio.stories.tsx +3 -3
- package/src/components/auto-complete/auto-complete.meta.md +19 -20
- package/src/components/auto-complete/auto-complete.stories.tsx +44 -3
- package/src/components/auto-complete/auto-complete.tsx +119 -71
- package/src/components/avatar/avatar.meta.md +9 -22
- package/src/components/avatar/avatar.stories.tsx +21 -3
- package/src/components/avatar/avatar.tsx +24 -23
- package/src/components/badge/badge.meta.md +14 -18
- package/src/components/badge/badge.stories.tsx +2 -2
- package/src/components/badge/badge.tsx +2 -2
- package/src/components/breadcrumb/breadcrumb.meta.md +29 -20
- package/src/components/breadcrumb/breadcrumb.stories.tsx +120 -5
- package/src/components/breadcrumb/breadcrumb.tsx +22 -8
- package/src/components/button/button.meta.md +261 -29
- package/src/components/button/button.stories.tsx +549 -41
- package/src/components/button/button.tsx +335 -33
- package/src/components/calendar/calendar.meta.md +19 -14
- package/src/components/calendar/calendar.stories.tsx +5 -5
- package/src/components/calendar/calendar.tsx +73 -8
- package/src/components/card/card.meta.md +31 -34
- package/src/components/card/card.stories.tsx +34 -3
- package/src/components/card/card.tsx +146 -63
- package/src/components/carousel/carousel.meta.md +10 -14
- package/src/components/carousel/carousel.stories.tsx +1 -1
- package/src/components/cascader/cascader.meta.md +43 -22
- package/src/components/cascader/cascader.stories.tsx +13 -2
- package/src/components/cascader/cascader.tsx +427 -84
- package/src/components/checkbox/checkbox.meta.md +74 -24
- package/src/components/checkbox/checkbox.stories.tsx +160 -2
- package/src/components/checkbox/checkbox.tsx +77 -9
- package/src/components/collapsible/collapsible.meta.md +7 -6
- package/src/components/collapsible/collapsible.stories.tsx +2 -2
- package/src/components/collapsible/collapsible.tsx +93 -6
- package/src/components/color-picker/color-picker.meta.md +16 -20
- package/src/components/color-picker/color-picker.stories.tsx +86 -7
- package/src/components/color-picker/color-picker.tsx +19 -9
- package/src/components/command/command.meta.md +7 -11
- package/src/components/command/command.stories.tsx +4 -4
- package/src/components/command/command.tsx +18 -7
- package/src/components/context-menu/context-menu.meta.md +5 -25
- package/src/components/context-menu/context-menu.stories.tsx +4 -4
- package/src/components/context-menu/context-menu.tsx +21 -8
- package/src/components/data-table/data-table.meta.md +14 -18
- package/src/components/data-table/data-table.stories.tsx +1 -1
- package/src/components/data-table/data-table.tsx +2 -2
- package/src/components/date-picker/date-picker.meta.md +90 -41
- package/src/components/date-picker/date-picker.stories.tsx +55 -5
- package/src/components/date-picker/date-picker.tsx +1489 -91
- package/src/components/descriptions/descriptions.meta.md +12 -16
- package/src/components/descriptions/descriptions.stories.tsx +2 -2
- package/src/components/descriptions/descriptions.tsx +22 -14
- package/src/components/dialog/dialog.meta.md +67 -17
- package/src/components/dialog/dialog.stories.tsx +182 -20
- package/src/components/dialog/dialog.tsx +67 -15
- package/src/components/dialog/imperative.tsx +252 -0
- package/src/components/drawer/drawer.meta.md +27 -39
- package/src/components/drawer/drawer.stories.tsx +29 -12
- package/src/components/drawer/drawer.tsx +22 -114
- package/src/components/dropdown-menu/dropdown-menu.meta.md +64 -24
- package/src/components/dropdown-menu/dropdown-menu.stories.tsx +81 -3
- package/src/components/dropdown-menu/dropdown-menu.tsx +24 -10
- package/src/components/ellipsis/ellipsis.meta.md +87 -0
- package/src/components/ellipsis/ellipsis.stories.tsx +72 -0
- package/src/components/ellipsis/ellipsis.tsx +153 -0
- package/src/components/empty/empty.meta.md +10 -14
- package/src/components/empty/empty.stories.tsx +3 -3
- package/src/components/empty/empty.tsx +10 -3
- package/src/components/field/field.meta.md +46 -25
- package/src/components/field/field.stories.tsx +380 -3
- package/src/components/field/field.tsx +263 -35
- package/src/components/filter-bar/filter-bar.meta.md +92 -0
- package/src/components/filter-bar/filter-bar.stories.tsx +1083 -0
- package/src/components/filter-bar/filter-bar.tsx +568 -0
- package/src/components/flex/flex.meta.md +59 -20
- package/src/components/flex/flex.stories.tsx +65 -10
- package/src/components/flex/flex.tsx +27 -4
- package/src/components/float-button/float-button.meta.md +10 -29
- package/src/components/float-button/float-button.stories.tsx +6 -6
- package/src/components/form/form.meta.md +31 -52
- package/src/components/form/form.stories.tsx +350 -3
- package/src/components/form/form.tsx +101 -35
- package/src/components/grid/grid.meta.md +4 -24
- package/src/components/grid/grid.stories.tsx +2 -2
- package/src/components/hover-card/hover-card.meta.md +9 -10
- package/src/components/hover-card/hover-card.stories.tsx +29 -4
- package/src/components/hover-card/hover-card.tsx +51 -13
- package/src/components/icon/DEVELOPMENT.md +809 -0
- package/src/components/icon/icon.meta.md +170 -0
- package/src/components/icon/icon.stories.tsx +344 -0
- package/src/components/icon/icon.tsx +248 -0
- package/src/components/image/image.meta.md +14 -18
- package/src/components/image/image.stories.tsx +3 -3
- package/src/components/image/image.tsx +2 -0
- package/src/components/input/demo/sizes.tsx +2 -2
- package/src/components/input/input.meta.md +44 -43
- package/src/components/input/input.stories.tsx +62 -35
- package/src/components/input/input.tsx +96 -101
- package/src/components/input-group/input-group.meta.md +53 -39
- package/src/components/input-group/input-group.stories.tsx +49 -16
- package/src/components/input-group/input-group.tsx +43 -8
- package/src/components/input-number/input-number.meta.md +68 -20
- package/src/components/input-number/input-number.stories.tsx +33 -6
- package/src/components/input-number/input-number.tsx +79 -20
- package/src/components/input-otp/input-otp.meta.md +8 -20
- package/src/components/input-otp/input-otp.stories.tsx +3 -3
- package/src/components/input-otp/input-otp.tsx +1 -1
- package/src/components/item/item.meta.md +8 -26
- package/src/components/item/item.stories.tsx +3 -3
- package/src/components/item/item.tsx +7 -6
- package/src/components/kbd/kbd.meta.md +7 -19
- package/src/components/kbd/kbd.stories.tsx +4 -4
- package/src/components/kbd/kbd.tsx +8 -4
- package/src/components/label/label.meta.md +21 -18
- package/src/components/label/label.stories.tsx +64 -6
- package/src/components/label/label.tsx +91 -19
- package/src/components/masonry/masonry.meta.md +8 -12
- package/src/components/masonry/masonry.stories.tsx +4 -4
- package/src/components/mentions/mentions.meta.md +42 -21
- package/src/components/mentions/mentions.stories.tsx +120 -6
- package/src/components/mentions/mentions.tsx +10 -5
- package/src/components/menubar/menubar.meta.md +4 -8
- package/src/components/menubar/menubar.stories.tsx +55 -3
- package/src/components/menubar/menubar.tsx +9 -9
- package/src/components/native-select/native-select.meta.md +7 -11
- package/src/components/native-select/native-select.stories.tsx +4 -4
- package/src/components/native-select/native-select.tsx +1 -1
- package/src/components/navigation-menu/navigation-menu.meta.md +4 -8
- package/src/components/navigation-menu/navigation-menu.stories.tsx +106 -3
- package/src/components/navigation-menu/navigation-menu.tsx +6 -3
- package/src/components/notification/notification.meta.md +41 -8
- package/src/components/notification/notification.stories.tsx +9 -9
- package/src/components/notification/notification.tsx +34 -19
- package/src/components/page-header/DEVELOPMENT.md +842 -0
- package/src/components/page-header/page-header.meta.md +208 -0
- package/src/components/page-header/page-header.stories.tsx +421 -0
- package/src/components/page-header/page-header.tsx +281 -0
- package/src/components/pagination/pagination.meta.md +122 -50
- package/src/components/pagination/pagination.stories.tsx +227 -11
- package/src/components/pagination/pagination.tsx +355 -63
- package/src/components/popconfirm/popconfirm.meta.md +19 -23
- package/src/components/popconfirm/popconfirm.stories.tsx +2 -2
- package/src/components/popconfirm/popconfirm.tsx +1 -1
- package/src/components/popover/popover.meta.md +64 -12
- package/src/components/popover/popover.stories.tsx +83 -7
- package/src/components/popover/popover.tsx +77 -28
- package/src/components/progress/progress.meta.md +43 -26
- package/src/components/progress/progress.stories.tsx +2 -2
- package/src/components/progress/progress.tsx +19 -11
- package/src/components/radio-group/radio-group.meta.md +78 -11
- package/src/components/radio-group/radio-group.stories.tsx +38 -2
- package/src/components/radio-group/radio-group.tsx +149 -18
- package/src/components/rate/rate.meta.md +41 -19
- package/src/components/rate/rate.stories.tsx +2 -2
- package/src/components/rate/rate.tsx +37 -10
- package/src/components/resizable/resizable.meta.md +4 -12
- package/src/components/resizable/resizable.stories.tsx +5 -5
- package/src/components/resizable/resizable.tsx +1 -1
- package/src/components/result/result.meta.md +10 -14
- package/src/components/result/result.stories.tsx +2 -2
- package/src/components/result/result.tsx +21 -12
- package/src/components/scroll-area/scroll-area.meta.md +4 -8
- package/src/components/scroll-area/scroll-area.stories.tsx +5 -5
- package/src/components/segmented/segmented.meta.md +15 -17
- package/src/components/segmented/segmented.stories.tsx +3 -3
- package/src/components/segmented/segmented.tsx +15 -7
- package/src/components/select/select.meta.md +199 -67
- package/src/components/select/select.stories.tsx +238 -63
- package/src/components/select/select.tsx +718 -171
- package/src/components/separator/separator.meta.md +10 -14
- package/src/components/separator/separator.stories.tsx +2 -2
- package/src/components/separator/separator.tsx +3 -7
- package/src/components/sheet/sheet.meta.md +26 -21
- package/src/components/sheet/sheet.stories.tsx +116 -10
- package/src/components/sheet/sheet.tsx +116 -29
- package/src/components/sidebar/sidebar.meta.md +28 -38
- package/src/components/sidebar/sidebar.stories.tsx +696 -29
- package/src/components/sidebar/sidebar.tsx +615 -142
- package/src/components/skeleton/skeleton.meta.md +7 -31
- package/src/components/skeleton/skeleton.stories.tsx +3 -3
- package/src/components/skeleton/skeleton.tsx +7 -7
- package/src/components/slider/slider.meta.md +60 -13
- package/src/components/slider/slider.stories.tsx +58 -6
- package/src/components/slider/slider.tsx +154 -13
- package/src/components/sonner/sonner.meta.md +54 -8
- package/src/components/sonner/sonner.stories.tsx +79 -11
- package/src/components/sonner/sonner.tsx +137 -8
- package/src/components/spinner/spinner.meta.md +57 -21
- package/src/components/spinner/spinner.stories.tsx +66 -14
- package/src/components/spinner/spinner.tsx +111 -9
- package/src/components/statistic/statistic.meta.md +14 -30
- package/src/components/statistic/statistic.stories.tsx +1 -1
- package/src/components/statistic/statistic.tsx +4 -5
- package/src/components/steps/steps.meta.md +20 -15
- package/src/components/steps/steps.stories.tsx +37 -2
- package/src/components/steps/steps.tsx +15 -12
- package/src/components/switch/switch.meta.md +56 -15
- package/src/components/switch/switch.stories.tsx +5 -5
- package/src/components/switch/switch.tsx +59 -13
- package/src/components/table/table.meta.md +3 -7
- package/src/components/table/table.stories.tsx +1 -1
- package/src/components/table/table.tsx +4 -4
- package/src/components/tabs/tabs.meta.md +40 -32
- package/src/components/tabs/tabs.stories.tsx +104 -26
- package/src/components/tabs/tabs.tsx +125 -54
- package/src/components/tag/tag.meta.md +104 -68
- package/src/components/tag/tag.stories.tsx +183 -15
- package/src/components/tag/tag.tsx +222 -21
- package/src/components/textarea/textarea.meta.md +42 -31
- package/src/components/textarea/textarea.stories.tsx +32 -6
- package/src/components/textarea/textarea.tsx +32 -8
- package/src/components/time-picker/time-picker.meta.md +119 -50
- package/src/components/time-picker/time-picker.stories.tsx +65 -33
- package/src/components/time-picker/time-picker.tsx +889 -101
- package/src/components/timeline/timeline.meta.md +16 -17
- package/src/components/timeline/timeline.stories.tsx +24 -4
- package/src/components/timeline/timeline.tsx +32 -12
- package/src/components/toggle/toggle.meta.md +8 -12
- package/src/components/toggle/toggle.stories.tsx +4 -4
- package/src/components/toggle/toggle.tsx +4 -3
- package/src/components/toggle-group/toggle-group.meta.md +10 -14
- package/src/components/toggle-group/toggle-group.stories.tsx +3 -3
- package/src/components/toggle-group/toggle-group.tsx +2 -2
- package/src/components/tooltip/tooltip.meta.md +63 -18
- package/src/components/tooltip/tooltip.stories.tsx +42 -5
- package/src/components/tooltip/tooltip.tsx +81 -21
- package/src/components/tour/tour.meta.md +16 -20
- package/src/components/tour/tour.stories.tsx +3 -3
- package/src/components/tour/tour.tsx +3 -3
- package/src/components/transfer/transfer.meta.md +18 -22
- package/src/components/transfer/transfer.stories.tsx +2 -2
- package/src/components/transfer/transfer.tsx +28 -21
- package/src/components/tree/tree.meta.md +67 -22
- package/src/components/tree/tree.stories.tsx +1 -1
- package/src/components/tree/tree.tsx +9 -8
- package/src/components/tree-select/tree-select.meta.md +59 -23
- package/src/components/tree-select/tree-select.stories.tsx +2 -2
- package/src/components/tree-select/tree-select.tsx +42 -7
- package/src/components/typography/typography.meta.md +61 -39
- package/src/components/typography/typography.stories.tsx +14 -9
- package/src/components/typography/typography.tsx +38 -25
- package/src/components/upload/upload.meta.md +61 -25
- package/src/components/upload/upload.stories.tsx +69 -3
- package/src/components/upload/upload.tsx +170 -37
- package/src/components/watermark/watermark.meta.md +15 -19
- package/src/components/watermark/watermark.stories.tsx +98 -8
- package/src/hooks/use-breakpoint.ts +117 -0
- package/src/hooks/use-debounce-callback.ts +52 -0
- package/src/hooks/use-mobile.ts +23 -0
- package/src/stories/theme-tokens.stories.tsx +747 -0
- package/src/utils/trigger-input.ts +53 -0
- package/src/components/button-group/button-group.meta.md +0 -101
- package/src/components/button-group/button-group.stories.tsx +0 -93
- package/src/components/button-group/button-group.tsx +0 -75
- package/src/components/combobox/combobox.meta.md +0 -102
- package/src/components/combobox/combobox.stories.tsx +0 -55
- package/src/components/combobox/combobox.tsx +0 -130
- package/src/components/input/demo/addon.tsx +0 -15
- package/src/components/input/demo/with-prefix-suffix.tsx +0 -19
- package/src/components/space/space.meta.md +0 -103
- package/src/components/space/space.stories.tsx +0 -108
- package/src/components/space/space.tsx +0 -106
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
id: input-otp
|
|
3
3
|
name: InputOTP
|
|
4
4
|
type: component
|
|
5
|
-
category:
|
|
5
|
+
category: deprecated
|
|
6
6
|
since: 0.1.0
|
|
7
7
|
package: '@teamix-evo/ui'
|
|
8
8
|
displayName: 验证码输入
|
|
@@ -30,20 +30,10 @@ OTP 验证码输入 — 基于 [`input-otp`](https://github.com/guilhermerodz/in
|
|
|
30
30
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成。`InputOTP` 透传 `input-otp` 的所有 props。
|
|
31
31
|
|
|
32
32
|
<!-- auto:props:begin -->
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
|
37
|
-
| -------------------- | -------- | ------ | ---- | -------------------------------------------------------------------------------------------- |
|
|
38
|
-
| `className` | `string` | – | – | 输入框 className,作用在隐藏的真实 input 上;通常无需关心。 |
|
|
39
|
-
| `containerClassName` | `string` | – | – | 容器 className,作用在 slot 列表外层 wrapper 上, 用于覆盖默认的 `flex items-center gap-2`。 |
|
|
40
|
-
|
|
41
|
-
#### InputOTPSlot
|
|
42
|
-
|
|
43
|
-
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
44
|
-
| ------- | -------- | ------ | ---- | ------------------------------------------ |
|
|
45
|
-
| `index` | `number` | – | ✔ | Slot 索引(必传)。OTP 的 slots 数组下标。 |
|
|
46
|
-
|
|
33
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
34
|
+
| --- | --- | --- | --- | --- |
|
|
35
|
+
| `className` | `string` | – | – | 输入框 className,作用在隐藏的真实 input 上;通常无需关心。 |
|
|
36
|
+
| `containerClassName` | `string` | – | – | 容器 className,作用在 slot 列表外层 wrapper 上, 用于覆盖默认的 `flex items-center gap-2`。 |
|
|
47
37
|
<!-- auto:props:end -->
|
|
48
38
|
|
|
49
39
|
## 依赖
|
|
@@ -51,14 +41,13 @@ OTP 验证码输入 — 基于 [`input-otp`](https://github.com/guilhermerodz/in
|
|
|
51
41
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成,数据源是 [`manifest.json`](../../../manifest.json)。**手工编辑 marker 之间的内容会在下次生成时被覆盖**。
|
|
52
42
|
|
|
53
43
|
<!-- auto:deps:begin -->
|
|
54
|
-
|
|
55
44
|
### 同库依赖
|
|
56
45
|
|
|
57
46
|
> `teamix-evo ui add input-otp` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
58
47
|
|
|
59
|
-
| Entry | 类型 | 描述
|
|
60
|
-
|
|
|
61
|
-
| `cn`
|
|
48
|
+
| Entry | 类型 | 描述 |
|
|
49
|
+
| --- | --- | --- |
|
|
50
|
+
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
62
51
|
|
|
63
52
|
### npm 依赖
|
|
64
53
|
|
|
@@ -67,7 +56,6 @@ OTP 验证码输入 — 基于 [`input-otp`](https://github.com/guilhermerodz/in
|
|
|
67
56
|
```bash
|
|
68
57
|
pnpm add input-otp@^1.2.0 lucide-react@^0.460.0
|
|
69
58
|
```
|
|
70
|
-
|
|
71
59
|
<!-- auto:deps:end -->
|
|
72
60
|
|
|
73
61
|
> 子组件:`InputOTP`(Root)/ `InputOTPGroup`(slot 容器)/ `InputOTPSlot`(单 slot,需 `index`)/ `InputOTPSeparator`(分隔符,如 4-4 数字之间的点)。
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
3
|
import { REGEXP_ONLY_DIGITS } from 'input-otp';
|
|
4
4
|
import {
|
|
5
5
|
InputOTP,
|
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
} from './input-otp';
|
|
10
10
|
|
|
11
11
|
const meta: Meta<typeof InputOTP> = {
|
|
12
|
-
title: '
|
|
12
|
+
title: '废弃 · Deprecated/InputOTP',
|
|
13
13
|
component: InputOTP,
|
|
14
14
|
tags: ['autodocs'],
|
|
15
15
|
parameters: {
|
|
16
16
|
docs: {
|
|
17
17
|
description: {
|
|
18
18
|
component:
|
|
19
|
-
'一次性密码输入 — 短信 / 邮箱验证码场景的格式化输入,每位字符独立可视 slot。基于 [`input-otp`](https://input-otp.rodz.dev/) 实现,自动处理粘贴、键盘前后切换、IME 与 SMS autofill;通过 `pattern` 限制输入字符集(数字 / 字母数字)。shadcn 专有能力,填补 antd 未提供的验证码输入场景。',
|
|
19
|
+
'⚠️ **已废弃** — 仅 Storybook 留档,不通过 manifest 对外发布。\n\n一次性密码输入 — 短信 / 邮箱验证码场景的格式化输入,每位字符独立可视 slot。基于 [`input-otp`](https://input-otp.rodz.dev/) 实现,自动处理粘贴、键盘前后切换、IME 与 SMS autofill;通过 `pattern` 限制输入字符集(数字 / 字母数字)。shadcn 专有能力,填补 antd 未提供的验证码输入场景。',
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
22
|
},
|
|
@@ -67,7 +67,7 @@ const InputOTPSlot = React.forwardRef<
|
|
|
67
67
|
<div
|
|
68
68
|
ref={ref}
|
|
69
69
|
className={cn(
|
|
70
|
-
'relative flex size-10 items-center justify-center border-y border-r border-input text-
|
|
70
|
+
'relative flex size-10 items-center justify-center border-y border-r border-input text-xs shadow-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md',
|
|
71
71
|
isActive && 'z-10 ring-1 ring-ring',
|
|
72
72
|
className,
|
|
73
73
|
)}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
id: item
|
|
3
3
|
name: Item
|
|
4
4
|
type: component
|
|
5
|
-
category:
|
|
5
|
+
category: data-display
|
|
6
6
|
since: 0.1.0
|
|
7
7
|
package: '@teamix-evo/ui'
|
|
8
8
|
displayName: 列表项
|
|
@@ -28,39 +28,22 @@ displayName: 列表项
|
|
|
28
28
|
## Props
|
|
29
29
|
|
|
30
30
|
<!-- auto:props:begin -->
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
|
35
|
-
| ------------- | ----------------------------------- | ----------- | ---- | --------------------------------------------------------------------------------------------------- |
|
|
36
|
-
| `variant` | `'default' \| 'outline' \| 'muted'` | `"default"` | – | 视觉变体 — `default` 透明无边框(嵌入 List / Group 用);`outline` 卡片化(独立卡片);`muted` 灰底卡片。 |
|
|
37
|
-
| `interactive` | `boolean` | `false` | – | 是否带 hover 高亮 + cursor-pointer(行可点击场景)。 |
|
|
38
|
-
|
|
39
|
-
#### ItemMedia
|
|
40
|
-
|
|
41
|
-
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
42
|
-
| ------ | ------------------- | ----------- | ---- | ------------------------------------------- |
|
|
43
|
-
| `size` | `'default' \| 'lg'` | `"default"` | – | 媒体尺寸 — `lg` 适用于大封面 / 大头像场景。 |
|
|
44
|
-
|
|
45
|
-
#### ItemGroup
|
|
46
|
-
|
|
47
|
-
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
48
|
-
| --------- | --------- | ------ | ---- | ------------------------------ |
|
|
49
|
-
| `divided` | `boolean` | `true` | – | 是否在各 Item 之间显示分割线。 |
|
|
50
|
-
|
|
31
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
32
|
+
| --- | --- | --- | --- | --- |
|
|
33
|
+
| `variant` | `'default' \| 'outline' \| 'muted'` | `"default"` | – | 视觉变体 — `default` 透明无边框(嵌入 List / Group 用);`outline` 卡片化(独立卡片);`muted` 灰底卡片。 |
|
|
34
|
+
| `interactive` | `boolean` | `false` | – | 是否带 hover 高亮 + cursor-pointer(行可点击场景)。 |
|
|
51
35
|
<!-- auto:props:end -->
|
|
52
36
|
|
|
53
37
|
## 依赖
|
|
54
38
|
|
|
55
39
|
<!-- auto:deps:begin -->
|
|
56
|
-
|
|
57
40
|
### 同库依赖
|
|
58
41
|
|
|
59
42
|
> `teamix-evo ui add item` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
60
43
|
|
|
61
|
-
| Entry | 类型 | 描述
|
|
62
|
-
|
|
|
63
|
-
| `cn`
|
|
44
|
+
| Entry | 类型 | 描述 |
|
|
45
|
+
| --- | --- | --- |
|
|
46
|
+
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
64
47
|
|
|
65
48
|
### npm 依赖
|
|
66
49
|
|
|
@@ -69,7 +52,6 @@ displayName: 列表项
|
|
|
69
52
|
```bash
|
|
70
53
|
pnpm add class-variance-authority@^0.7.0
|
|
71
54
|
```
|
|
72
|
-
|
|
73
55
|
<!-- auto:deps:end -->
|
|
74
56
|
|
|
75
57
|
## AI 生成纪律
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import {
|
|
3
3
|
Item,
|
|
4
4
|
ItemMedia,
|
|
@@ -13,7 +13,7 @@ import { Button } from '@/components/button/button';
|
|
|
13
13
|
import { Switch } from '@/components/switch/switch';
|
|
14
14
|
|
|
15
15
|
const meta: Meta<typeof Item> = {
|
|
16
|
-
title: '
|
|
16
|
+
title: '数据展示 · Data Display/Item',
|
|
17
17
|
component: Item,
|
|
18
18
|
tags: ['autodocs'],
|
|
19
19
|
parameters: {
|
|
@@ -60,7 +60,7 @@ const users = [
|
|
|
60
60
|
export const ContactList: Story = {
|
|
61
61
|
parameters: { controls: { disable: true } },
|
|
62
62
|
render: () => (
|
|
63
|
-
<ItemGroup className="w-96 rounded-md border">
|
|
63
|
+
<ItemGroup className="w-96 rounded-md border border-border">
|
|
64
64
|
{users.map((u) => (
|
|
65
65
|
<Item key={u.id} interactive className="px-3 py-2">
|
|
66
66
|
<ItemMedia>
|
|
@@ -4,12 +4,13 @@ import { cva, type VariantProps } from 'class-variance-authority';
|
|
|
4
4
|
import { cn } from '@/utils/cn';
|
|
5
5
|
|
|
6
6
|
const itemVariants = cva(
|
|
7
|
-
'flex w-full items-start gap-3 text-
|
|
7
|
+
'flex w-full items-start gap-3 text-xs transition-colors',
|
|
8
8
|
{
|
|
9
9
|
variants: {
|
|
10
10
|
variant: {
|
|
11
11
|
default: '',
|
|
12
|
-
outline:
|
|
12
|
+
outline:
|
|
13
|
+
'rounded-md border border-border bg-card p-3 text-card-foreground shadow-sm',
|
|
13
14
|
muted: 'rounded-md bg-muted p-3',
|
|
14
15
|
},
|
|
15
16
|
interactive: {
|
|
@@ -61,11 +62,11 @@ export interface ItemMediaProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
61
62
|
* 媒体尺寸 — `default` 用于头像 / 图标;`lg` 用于缩略图。
|
|
62
63
|
* @default "default"
|
|
63
64
|
*/
|
|
64
|
-
size?: 'default' | 'lg';
|
|
65
|
+
size?: 'md' | 'default' | 'lg';
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
const ItemMedia = React.forwardRef<HTMLDivElement, ItemMediaProps>(
|
|
68
|
-
({ size = '
|
|
69
|
+
({ size = 'md', className, ...props }, ref) => (
|
|
69
70
|
<div
|
|
70
71
|
ref={ref}
|
|
71
72
|
className={cn(
|
|
@@ -101,7 +102,7 @@ const ItemTitle = React.forwardRef<
|
|
|
101
102
|
>(({ className, ...props }, ref) => (
|
|
102
103
|
<div
|
|
103
104
|
ref={ref}
|
|
104
|
-
className={cn('truncate text-
|
|
105
|
+
className={cn('truncate text-xs font-semibold leading-none', className)}
|
|
105
106
|
{...props}
|
|
106
107
|
/>
|
|
107
108
|
));
|
|
@@ -113,7 +114,7 @@ const ItemDescription = React.forwardRef<
|
|
|
113
114
|
>(({ className, ...props }, ref) => (
|
|
114
115
|
<p
|
|
115
116
|
ref={ref}
|
|
116
|
-
className={cn('truncate text-
|
|
117
|
+
className={cn('truncate text-xs text-muted-foreground', className)}
|
|
117
118
|
{...props}
|
|
118
119
|
/>
|
|
119
120
|
));
|
|
@@ -3,7 +3,7 @@ id: kbd
|
|
|
3
3
|
name: Kbd
|
|
4
4
|
displayName: 键位展示
|
|
5
5
|
type: component
|
|
6
|
-
category:
|
|
6
|
+
category: deprecated
|
|
7
7
|
since: 0.1.0
|
|
8
8
|
package: '@teamix-evo/ui'
|
|
9
9
|
---
|
|
@@ -28,19 +28,9 @@ package: '@teamix-evo/ui'
|
|
|
28
28
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成。
|
|
29
29
|
|
|
30
30
|
<!-- auto:props:begin -->
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
35
|
-
| ------ | --------------------------- | ----------- | ---- | ------------------------------------------------------------- |
|
|
36
|
-
| `size` | `'sm' \| 'default' \| 'lg'` | `"default"` | – | 尺寸 — 与文字行高匹配,大尺寸用于 Command Palette 等突出展示。 |
|
|
37
|
-
|
|
38
|
-
#### KbdGroup
|
|
39
|
-
|
|
40
|
-
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
41
|
-
| ----------- | -------- | ------ | ---- | ----------------------------------------------------- |
|
|
42
|
-
| `separator` | `string` | `""` | – | 组合键之间的分隔符(如 `"+"` / `"→"`),留空时仅用 gap。 |
|
|
43
|
-
|
|
31
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
32
|
+
| --- | --- | --- | --- | --- |
|
|
33
|
+
| `size` | `'sm' \| 'md' \| 'default' \| 'lg'` | `"default"` | – | 尺寸 — 与文字行高匹配,大尺寸用于 Command Palette 等突出展示。 |
|
|
44
34
|
<!-- auto:props:end -->
|
|
45
35
|
|
|
46
36
|
## 依赖
|
|
@@ -48,14 +38,13 @@ package: '@teamix-evo/ui'
|
|
|
48
38
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成,数据源是 [`manifest.json`](../../../manifest.json)。**手工编辑 marker 之间的内容会在下次生成时被覆盖**。
|
|
49
39
|
|
|
50
40
|
<!-- auto:deps:begin -->
|
|
51
|
-
|
|
52
41
|
### 同库依赖
|
|
53
42
|
|
|
54
43
|
> `teamix-evo ui add kbd` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
55
44
|
|
|
56
|
-
| Entry | 类型 | 描述
|
|
57
|
-
|
|
|
58
|
-
| `cn`
|
|
45
|
+
| Entry | 类型 | 描述 |
|
|
46
|
+
| --- | --- | --- |
|
|
47
|
+
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
59
48
|
|
|
60
49
|
### npm 依赖
|
|
61
50
|
|
|
@@ -64,7 +53,6 @@ package: '@teamix-evo/ui'
|
|
|
64
53
|
```bash
|
|
65
54
|
pnpm add class-variance-authority@^0.7.0
|
|
66
55
|
```
|
|
67
|
-
|
|
68
56
|
<!-- auto:deps:end -->
|
|
69
57
|
|
|
70
58
|
## AI 生成纪律
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import { Kbd, KbdGroup } from './kbd';
|
|
3
3
|
|
|
4
4
|
const meta: Meta<typeof Kbd> = {
|
|
5
|
-
title: '
|
|
5
|
+
title: '废弃 · Deprecated/Kbd',
|
|
6
6
|
component: Kbd,
|
|
7
7
|
tags: ['autodocs'],
|
|
8
8
|
parameters: {
|
|
9
9
|
docs: {
|
|
10
10
|
description: {
|
|
11
11
|
component:
|
|
12
|
-
'键位展示 — 语义化 `<kbd>` 元素,标注快捷键(⌘K / Ctrl + Enter)。单键 + KbdGroup 组合容器,常用于 Command Palette、Tooltip、文档帮助。antd 体系无对应原子。',
|
|
12
|
+
'⚠️ **已废弃** — 仅 Storybook 留档,不通过 manifest 对外发布。\n\n键位展示 — 语义化 `<kbd>` 元素,标注快捷键(⌘K / Ctrl + Enter)。单键 + KbdGroup 组合容器,常用于 Command Palette、Tooltip、文档帮助。antd 体系无对应原子。',
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
15
|
},
|
|
@@ -59,7 +59,7 @@ export const WinCombo: Story = {
|
|
|
59
59
|
export const InContext: Story = {
|
|
60
60
|
parameters: { controls: { disable: true } },
|
|
61
61
|
render: () => (
|
|
62
|
-
<div className="flex items-center justify-between rounded-md border bg-card p-3 text-sm">
|
|
62
|
+
<div className="flex items-center justify-between rounded-md border border-border bg-card p-3 text-sm">
|
|
63
63
|
<span>打开命令面板</span>
|
|
64
64
|
<KbdGroup>
|
|
65
65
|
<Kbd>⌘</Kbd>
|
|
@@ -5,16 +5,17 @@ import { cn } from '@/utils/cn';
|
|
|
5
5
|
|
|
6
6
|
const kbdVariants = cva(
|
|
7
7
|
// eslint-disable-next-line teamix-evo/no-arbitrary-tw-value -- physical-key inset shadow; one-off effect not used elsewhere.
|
|
8
|
-
'pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted font-mono tabular-nums text-muted-foreground shadow-[0_1px_0_0_rgba(0,0,0,0.08)]',
|
|
8
|
+
'pointer-events-none inline-flex select-none items-center gap-1 rounded border border-border bg-muted font-mono tabular-nums text-muted-foreground shadow-[0_1px_0_0_rgba(0,0,0,0.08)]',
|
|
9
9
|
{
|
|
10
10
|
variants: {
|
|
11
11
|
size: {
|
|
12
12
|
sm: 'h-4 px-1 text-xxs',
|
|
13
|
+
md: 'h-5 px-1.5 text-xs',
|
|
13
14
|
default: 'h-5 px-1.5 text-xs',
|
|
14
15
|
lg: 'h-6 px-2 text-sm',
|
|
15
16
|
},
|
|
16
17
|
},
|
|
17
|
-
defaultVariants: { size: '
|
|
18
|
+
defaultVariants: { size: 'md' },
|
|
18
19
|
},
|
|
19
20
|
);
|
|
20
21
|
|
|
@@ -25,7 +26,7 @@ export interface KbdProps
|
|
|
25
26
|
* 尺寸 — 与文字行高匹配,大尺寸用于 Command Palette 等突出展示。
|
|
26
27
|
* @default "default"
|
|
27
28
|
*/
|
|
28
|
-
size?: 'sm' | 'default' | 'lg';
|
|
29
|
+
size?: 'sm' | 'md' | 'default' | 'lg';
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
/**
|
|
@@ -66,7 +67,10 @@ const KbdGroup = React.forwardRef<HTMLSpanElement, KbdGroupProps>(
|
|
|
66
67
|
{items.map((child, i) => (
|
|
67
68
|
<React.Fragment key={i}>
|
|
68
69
|
{i > 0 && separator ? (
|
|
69
|
-
<span
|
|
70
|
+
<span
|
|
71
|
+
aria-hidden="true"
|
|
72
|
+
className="text-xs text-muted-foreground"
|
|
73
|
+
>
|
|
70
74
|
{separator}
|
|
71
75
|
</span>
|
|
72
76
|
) : null}
|
|
@@ -3,7 +3,7 @@ id: label
|
|
|
3
3
|
name: Label
|
|
4
4
|
displayName: 标签
|
|
5
5
|
type: component
|
|
6
|
-
category:
|
|
6
|
+
category: data-entry
|
|
7
7
|
since: 0.1.0
|
|
8
8
|
package: '@teamix-evo/ui'
|
|
9
9
|
---
|
|
@@ -11,7 +11,7 @@ package: '@teamix-evo/ui'
|
|
|
11
11
|
# Label 标签
|
|
12
12
|
|
|
13
13
|
表单字段标签 — 基于 [`@radix-ui/react-label`](https://www.radix-ui.com/primitives/docs/components/label) 包装。
|
|
14
|
-
shadcn 原版只继承 Radix 的 `peer-disabled:`
|
|
14
|
+
shadcn 原版只继承 Radix 的 `peer-disabled:` 联动;本版本补一条 antd Form.Item 风格的 `required`(红色 `*` 标记,**后置**在文字和 tooltip icon 右侧)+ 显式 `disabled` prop,适合 label 与目标控件**不直接相邻**的场景。
|
|
15
15
|
|
|
16
16
|
## When to use
|
|
17
17
|
|
|
@@ -28,12 +28,14 @@ shadcn 原版只继承 Radix 的 `peer-disabled:` 联动;本版本补一条 antd
|
|
|
28
28
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成,数据源是 [`label.tsx`](./label.tsx) 的 `LabelProps` interface JSDoc。**手工编辑 marker 之间的内容会在下次生成时被覆盖**。
|
|
29
29
|
|
|
30
30
|
<!-- auto:props:begin -->
|
|
31
|
-
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
|
|
31
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
32
|
+
| --- | --- | --- | --- | --- |
|
|
33
|
+
| `disabled` | `boolean` | `false` | – | 视觉禁用态。除原生 `peer-disabled:` 联动外,显式置 `true` 也会触发禁用样式; 适合 label 与目标控件不直接相邻、无法走 `peer` 约束的场景。 |
|
|
34
|
+
| `required` | `boolean` | `false` | – | 必填标记。`true` 时在 children 与 info icon **后**追加红色 `*` (语义来自 design destructive token);顺序为 `文字 ⓘ *`,三者间距 4px。 配合 `aria-required` 在 input 上一起使用以保证可访问性。 |
|
|
35
|
+
| `tooltip` | `string` | – | – | 辅助说明文本 — 有值时在 label 文字后渲染 info icon + hover tooltip (对齐 antd `Form.Item.tooltip` 习惯)。 |
|
|
36
|
+
| `tooltipSide` | `'top' \| 'right' \| 'bottom' \| 'left'` | `'top'` | – | Tooltip 弹出方向。 |
|
|
37
|
+
| `maxWidth` | `number \| string` | `undefined` | – | 最大宽度 — 超出时截断省略号。数字单位为 px,字符串直接用作 CSS 值。 适合长字段名在固定宽度表单中防止换行影响布局。 |
|
|
38
|
+
| `minWidth` | `number` | `undefined` | – | 最小宽度(px) — 防止过度压缩,在响应式布局中保留可读宽度下限。 |
|
|
37
39
|
<!-- auto:props:end -->
|
|
38
40
|
|
|
39
41
|
## 依赖
|
|
@@ -41,14 +43,13 @@ shadcn 原版只继承 Radix 的 `peer-disabled:` 联动;本版本补一条 antd
|
|
|
41
43
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成,数据源是 [`manifest.json`](../../../manifest.json)。**手工编辑 marker 之间的内容会在下次生成时被覆盖**。
|
|
42
44
|
|
|
43
45
|
<!-- auto:deps:begin -->
|
|
44
|
-
|
|
45
46
|
### 同库依赖
|
|
46
47
|
|
|
47
48
|
> `teamix-evo ui add label` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
48
49
|
|
|
49
|
-
| Entry | 类型 | 描述
|
|
50
|
-
|
|
|
51
|
-
| `cn`
|
|
50
|
+
| Entry | 类型 | 描述 |
|
|
51
|
+
| --- | --- | --- |
|
|
52
|
+
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
52
53
|
|
|
53
54
|
### npm 依赖
|
|
54
55
|
|
|
@@ -57,18 +58,20 @@ shadcn 原版只继承 Radix 的 `peer-disabled:` 联动;本版本补一条 antd
|
|
|
57
58
|
```bash
|
|
58
59
|
pnpm add @radix-ui/react-label@^2.1.0 class-variance-authority@^0.7.0
|
|
59
60
|
```
|
|
60
|
-
|
|
61
61
|
<!-- auto:deps:end -->
|
|
62
62
|
|
|
63
63
|
> 除上述 props 外,Label 透传所有 `<label>` 原生属性(`htmlFor` / `id` / `aria-*` / `onClick` / ...)。
|
|
64
64
|
|
|
65
65
|
## AI 生成纪律
|
|
66
66
|
|
|
67
|
-
- **`htmlFor`
|
|
68
|
-
- **`required` 配 `aria-required
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
67
|
+
- **`htmlFor` 必填**:Label 必须通过 `htmlFor` 关联到目标控件的 `id`,或把控件包裹在 Label 内。**不要**只渲染孤立 Label。
|
|
68
|
+
- **`required` 配 `aria-required`**:仅视觉的 `*` 不够,目标 input 也要 `aria-required="true"`。
|
|
69
|
+
- **`*` 后置不可额外加空格**:请使用 `required` prop,不要手写 `<span>邮箱 *</span>`,走组件才能保证间距一致 + double-click 文字可快捷选中标题。
|
|
70
|
+
- **`disabled` 不替代 input 的 disabled**:Label 的 `disabled` 仅控制视觉,目标控件的 `disabled` 必须独立设置。
|
|
71
|
+
- **不内嵌交互元素**:Label 内不要放 button / link / 复杂控件 — Radix Label 的事件冒泡可能误触发关联控件。
|
|
72
|
+
- **文案克制**:Label 文字 ≤ 8 个汉字 / 16 字符,过长用 `tooltip` prop 补充说明(不要手写 `<Tooltip>` 包裹)。
|
|
73
|
+
- **截断走 `maxWidth`**:长 label 用 `maxWidth` 自动截断 + ellipsis,不要手写 `truncate` className。
|
|
74
|
+
- **horizontal 对齐走 `minWidth`**:表单 label 列宽对齐用 `minWidth={120}` 等档位,不要手写 `min-w-32` 等 utility。
|
|
72
75
|
|
|
73
76
|
## Examples
|
|
74
77
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import { Label } from './label';
|
|
3
3
|
|
|
4
4
|
const meta: Meta<typeof Label> = {
|
|
5
|
-
title: '
|
|
5
|
+
title: '数据录入 · Data Entry/Label',
|
|
6
6
|
component: Label,
|
|
7
7
|
tags: ['autodocs'],
|
|
8
8
|
parameters: {
|
|
9
9
|
docs: {
|
|
10
10
|
description: {
|
|
11
11
|
component:
|
|
12
|
-
'表单字段标签
|
|
12
|
+
'表单字段标签 —— 标记并描述表单控件的文本入口。Radix Label 实现 + 工程化扩展并集:`disabled` 显式禁用态(脱离 peer 也工作)、`required` 后置红色 `*`(顺序为 `文字 ⓘ *`,对齐设计规范)、`tooltip` 文字后 info icon hover 提示(对齐 antd `Form.Item.tooltip`)、`maxWidth` / `minWidth` 宽度约束 + `truncate` 省略号(应对长字段名固定栅格表单场景)。视觉走 OpenTrek semantic tokens,所有样式来自 `@teamix-evo/design`,无 mock。',
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
15
|
},
|
|
@@ -19,13 +19,31 @@ const meta: Meta<typeof Label> = {
|
|
|
19
19
|
control: 'boolean',
|
|
20
20
|
},
|
|
21
21
|
required: {
|
|
22
|
-
description:
|
|
22
|
+
description:
|
|
23
|
+
'必填标记,在文字和 tooltip icon **后**追加红色 `*`(顺序为 `文字 ⓘ *`)',
|
|
23
24
|
control: 'boolean',
|
|
24
25
|
},
|
|
25
26
|
children: {
|
|
26
27
|
description: '标签文本',
|
|
27
28
|
control: 'text',
|
|
28
29
|
},
|
|
30
|
+
tooltip: {
|
|
31
|
+
description: '辅助说明文本,有值时在文字后渲染 info icon + hover tooltip',
|
|
32
|
+
control: 'text',
|
|
33
|
+
},
|
|
34
|
+
tooltipSide: {
|
|
35
|
+
description: 'tooltip 弹出方向',
|
|
36
|
+
control: 'inline-radio',
|
|
37
|
+
options: ['top', 'right', 'bottom', 'left'],
|
|
38
|
+
},
|
|
39
|
+
maxWidth: {
|
|
40
|
+
description: '最大宽度,超出截断省略号',
|
|
41
|
+
control: 'number',
|
|
42
|
+
},
|
|
43
|
+
minWidth: {
|
|
44
|
+
description: '最小宽度(px)',
|
|
45
|
+
control: 'number',
|
|
46
|
+
},
|
|
29
47
|
},
|
|
30
48
|
args: {
|
|
31
49
|
children: '邮箱',
|
|
@@ -38,14 +56,27 @@ const meta: Meta<typeof Label> = {
|
|
|
38
56
|
export default meta;
|
|
39
57
|
type Story = StoryObj<typeof Label>;
|
|
40
58
|
|
|
41
|
-
/** 默认 Label
|
|
59
|
+
/** 默认 Label,可在 Controls 调 `required` / `disabled` 等 props。 */
|
|
42
60
|
export const Playground: Story = {};
|
|
43
61
|
|
|
44
|
-
/**
|
|
62
|
+
/** 必填态:文字和 tooltip icon **后**追加红色 `*`(顺序为 `文字 ⓘ *`,语义来自 design destructive token,对齐设计规范,不要手写颜色)。 */
|
|
45
63
|
export const Required: Story = {
|
|
46
64
|
args: { children: '用户名', required: true },
|
|
47
65
|
};
|
|
48
66
|
|
|
67
|
+
/** 对比:仅视觉示范必填 vs 非必填。 */
|
|
68
|
+
export const RequiredComparison: Story = {
|
|
69
|
+
parameters: { controls: { disable: true } },
|
|
70
|
+
render: () => (
|
|
71
|
+
<div className="flex flex-col gap-3">
|
|
72
|
+
<Label htmlFor="req-1" required>
|
|
73
|
+
必填字段
|
|
74
|
+
</Label>
|
|
75
|
+
<Label htmlFor="req-2">可选字段</Label>
|
|
76
|
+
</div>
|
|
77
|
+
),
|
|
78
|
+
};
|
|
79
|
+
|
|
49
80
|
/** 禁用态:文字 70% 透明 + cursor-not-allowed。 */
|
|
50
81
|
export const Disabled: Story = {
|
|
51
82
|
args: { children: '只读字段', disabled: true },
|
|
@@ -85,3 +116,30 @@ export const PeerDisabled: Story = {
|
|
|
85
116
|
</div>
|
|
86
117
|
),
|
|
87
118
|
};
|
|
119
|
+
|
|
120
|
+
/** 带 tooltip:文字后跟随 info icon,hover 触发气泡说明,对齐 antd `Form.Item.tooltip`。 */
|
|
121
|
+
export const WithTooltip: Story = {
|
|
122
|
+
args: {
|
|
123
|
+
children: '客户编号',
|
|
124
|
+
tooltip: '由系统自动生成的全局唯一编号,提交后不可修改',
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/** 截断:当字段名过长且布局栅格固定时,使用 `maxWidth` 触发 truncate 省略号。 */
|
|
129
|
+
export const Truncated: Story = {
|
|
130
|
+
args: {
|
|
131
|
+
children: '这是一段非常非常非常长的字段标签文本',
|
|
132
|
+
maxWidth: 160,
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
/** 全特性组合:required 红 `*` + tooltip info icon + maxWidth 截断(典型业务表单形态)。 */
|
|
137
|
+
export const WithAllFeatures: Story = {
|
|
138
|
+
args: {
|
|
139
|
+
children: '这是一段需要被截断的必填字段标签',
|
|
140
|
+
required: true,
|
|
141
|
+
tooltip: '该字段必填,长度限制 32 字符;超出栅格宽度自动省略,hover label 看完整文案。',
|
|
142
|
+
tooltipSide: 'right',
|
|
143
|
+
maxWidth: 200,
|
|
144
|
+
},
|
|
145
|
+
};
|