@teamix-evo/ui 0.1.1 → 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 +20 -10
- package/src/components/accordion/accordion.meta.md +5 -4
- package/src/components/accordion/accordion.stories.tsx +14 -9
- package/src/components/accordion/accordion.tsx +104 -8
- package/src/components/affix/affix.meta.md +20 -2
- package/src/components/affix/affix.stories.tsx +102 -25
- package/src/components/affix/affix.tsx +79 -9
- package/src/components/alert/alert.meta.md +44 -13
- 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 +61 -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 +8 -3
- package/src/components/anchor/anchor.stories.tsx +3 -3
- package/src/components/anchor/anchor.tsx +2 -2
- package/src/components/app/app.meta.md +9 -4
- package/src/components/app/app.stories.tsx +9 -7
- package/src/components/aspect-ratio/aspect-ratio.meta.md +4 -3
- package/src/components/aspect-ratio/aspect-ratio.stories.tsx +3 -3
- package/src/components/auto-complete/auto-complete.meta.md +14 -6
- package/src/components/auto-complete/auto-complete.stories.tsx +47 -4
- package/src/components/auto-complete/auto-complete.tsx +119 -71
- package/src/components/avatar/avatar.meta.md +6 -7
- package/src/components/avatar/avatar.stories.tsx +21 -3
- package/src/components/avatar/avatar.tsx +24 -23
- package/src/components/badge/badge.meta.md +10 -9
- package/src/components/badge/badge.stories.tsx +2 -2
- package/src/components/badge/badge.tsx +9 -15
- package/src/components/breadcrumb/breadcrumb.meta.md +27 -7
- package/src/components/breadcrumb/breadcrumb.stories.tsx +127 -4
- package/src/components/breadcrumb/breadcrumb.tsx +22 -8
- package/src/components/button/button.meta.md +258 -21
- package/src/components/button/button.stories.tsx +549 -41
- package/src/components/button/button.tsx +335 -33
- 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/calendar/calendar.meta.md +13 -3
- package/src/components/calendar/calendar.stories.tsx +6 -6
- package/src/components/calendar/calendar.tsx +73 -8
- package/src/components/card/card.meta.md +27 -5
- package/src/components/card/card.stories.tsx +42 -3
- package/src/components/card/card.tsx +146 -63
- package/src/components/carousel/carousel.meta.md +4 -3
- package/src/components/carousel/carousel.stories.tsx +11 -6
- package/src/components/cascader/cascader.meta.md +47 -17
- package/src/components/cascader/cascader.stories.tsx +22 -10
- package/src/components/cascader/cascader.tsx +428 -85
- package/src/components/checkbox/checkbox.meta.md +75 -7
- package/src/components/checkbox/checkbox.stories.tsx +161 -3
- package/src/components/checkbox/checkbox.tsx +77 -9
- package/src/components/collapsible/collapsible.meta.md +14 -6
- package/src/components/collapsible/collapsible.stories.tsx +10 -2
- package/src/components/collapsible/collapsible.tsx +93 -6
- package/src/components/color-picker/color-picker.meta.md +12 -7
- package/src/components/color-picker/color-picker.stories.tsx +86 -7
- package/src/components/color-picker/color-picker.tsx +20 -9
- package/src/components/command/command.meta.md +29 -13
- package/src/components/command/command.stories.tsx +4 -4
- package/src/components/command/command.tsx +19 -8
- package/src/components/context-menu/context-menu.meta.md +11 -8
- package/src/components/context-menu/context-menu.stories.tsx +11 -3
- package/src/components/context-menu/context-menu.tsx +21 -8
- package/src/components/data-table/data-table.meta.md +6 -5
- package/src/components/data-table/data-table.stories.tsx +13 -6
- package/src/components/data-table/data-table.tsx +2 -2
- package/src/components/date-picker/date-picker.meta.md +88 -19
- 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 +10 -5
- package/src/components/descriptions/descriptions.stories.tsx +3 -3
- package/src/components/descriptions/descriptions.tsx +22 -14
- package/src/components/dialog/dialog.meta.md +76 -13
- 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 +33 -34
- package/src/components/drawer/drawer.stories.tsx +29 -12
- package/src/components/drawer/drawer.tsx +22 -113
- package/src/components/dropdown-menu/dropdown-menu.meta.md +78 -10
- package/src/components/dropdown-menu/dropdown-menu.stories.tsx +88 -2
- 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 +9 -4
- package/src/components/empty/empty.stories.tsx +4 -4
- package/src/components/empty/empty.tsx +10 -3
- package/src/components/field/field.meta.md +47 -9
- package/src/components/field/field.stories.tsx +385 -5
- 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 +54 -6
- package/src/components/flex/flex.stories.tsx +107 -20
- package/src/components/flex/flex.tsx +27 -4
- package/src/components/float-button/float-button.meta.md +8 -3
- package/src/components/float-button/float-button.stories.tsx +9 -7
- package/src/components/float-button/float-button.tsx +1 -1
- package/src/components/form/form.meta.md +39 -17
- package/src/components/form/form.stories.tsx +350 -3
- package/src/components/form/form.tsx +101 -35
- package/src/components/grid/grid.meta.md +7 -2
- package/src/components/grid/grid.stories.tsx +6 -4
- package/src/components/hover-card/hover-card.meta.md +20 -9
- package/src/components/hover-card/hover-card.stories.tsx +34 -5
- 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 +9 -4
- package/src/components/image/image.stories.tsx +3 -3
- package/src/components/image/image.tsx +6 -4
- 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/input.meta.md +39 -33
- package/src/components/input/input.stories.tsx +62 -35
- package/src/components/input/input.tsx +97 -98
- package/src/components/input-group/input-group.meta.md +54 -22
- package/src/components/input-group/input-group.stories.tsx +49 -16
- package/src/components/input-group/input-group.tsx +44 -8
- package/src/components/input-number/input-number.meta.md +64 -7
- package/src/components/input-number/input-number.stories.tsx +46 -8
- package/src/components/input-number/input-number.tsx +99 -26
- package/src/components/input-otp/input-otp.meta.md +4 -3
- 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 -3
- package/src/components/item/item.stories.tsx +8 -5
- package/src/components/item/item.tsx +7 -6
- package/src/components/kbd/kbd.meta.md +13 -4
- package/src/components/kbd/kbd.stories.tsx +4 -4
- package/src/components/kbd/kbd.tsx +10 -5
- package/src/components/label/label.meta.md +18 -10
- 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 -3
- package/src/components/masonry/masonry.stories.tsx +7 -5
- package/src/components/masonry/masonry.tsx +1 -0
- package/src/components/mentions/mentions.meta.md +36 -6
- package/src/components/mentions/mentions.stories.tsx +120 -6
- package/src/components/mentions/mentions.tsx +11 -5
- package/src/components/menubar/menubar.meta.md +30 -12
- package/src/components/menubar/menubar.stories.tsx +62 -2
- package/src/components/menubar/menubar.tsx +9 -9
- package/src/components/native-select/native-select.meta.md +8 -3
- package/src/components/native-select/native-select.stories.tsx +8 -5
- package/src/components/native-select/native-select.tsx +1 -1
- package/src/components/navigation-menu/navigation-menu.meta.md +19 -9
- package/src/components/navigation-menu/navigation-menu.stories.tsx +112 -9
- package/src/components/navigation-menu/navigation-menu.tsx +8 -4
- package/src/components/notification/notification.meta.md +52 -10
- package/src/components/notification/notification.stories.tsx +11 -9
- package/src/components/notification/notification.tsx +36 -21
- 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 +140 -37
- package/src/components/pagination/pagination.stories.tsx +232 -10
- package/src/components/pagination/pagination.tsx +355 -63
- package/src/components/popconfirm/popconfirm.meta.md +9 -4
- package/src/components/popconfirm/popconfirm.stories.tsx +3 -4
- package/src/components/popconfirm/popconfirm.tsx +2 -2
- package/src/components/popover/popover.meta.md +62 -5
- package/src/components/popover/popover.stories.tsx +83 -7
- package/src/components/popover/popover.tsx +77 -28
- package/src/components/progress/progress.meta.md +38 -6
- package/src/components/progress/progress.stories.tsx +3 -3
- package/src/components/progress/progress.tsx +24 -16
- package/src/components/radio-group/radio-group.meta.md +79 -7
- package/src/components/radio-group/radio-group.stories.tsx +39 -3
- package/src/components/radio-group/radio-group.tsx +149 -18
- package/src/components/rate/rate.meta.md +35 -4
- package/src/components/rate/rate.stories.tsx +13 -5
- package/src/components/rate/rate.tsx +37 -10
- package/src/components/resizable/resizable.meta.md +7 -4
- package/src/components/resizable/resizable.stories.tsx +6 -6
- package/src/components/resizable/resizable.tsx +1 -1
- package/src/components/result/result.meta.md +7 -2
- package/src/components/result/result.stories.tsx +4 -8
- package/src/components/result/result.tsx +24 -15
- package/src/components/scroll-area/scroll-area.meta.md +4 -3
- package/src/components/scroll-area/scroll-area.stories.tsx +12 -4
- package/src/components/scroll-area/scroll-area.tsx +3 -3
- package/src/components/segmented/segmented.meta.md +7 -4
- package/src/components/segmented/segmented.stories.tsx +37 -8
- package/src/components/segmented/segmented.tsx +15 -7
- package/src/components/select/select.meta.md +197 -52
- package/src/components/select/select.stories.tsx +238 -63
- package/src/components/select/select.tsx +718 -171
- package/src/components/separator/separator.meta.md +4 -3
- package/src/components/separator/separator.stories.tsx +3 -3
- package/src/components/separator/separator.tsx +3 -7
- package/src/components/sheet/sheet.meta.md +32 -16
- package/src/components/sheet/sheet.stories.tsx +116 -10
- package/src/components/sheet/sheet.tsx +116 -29
- package/src/components/sidebar/sidebar.meta.md +37 -18
- package/src/components/sidebar/sidebar.stories.tsx +701 -29
- package/src/components/sidebar/sidebar.tsx +615 -142
- package/src/components/skeleton/skeleton.meta.md +4 -5
- package/src/components/skeleton/skeleton.stories.tsx +4 -4
- package/src/components/skeleton/skeleton.tsx +7 -7
- package/src/components/slider/slider.meta.md +57 -5
- package/src/components/slider/slider.stories.tsx +58 -6
- package/src/components/slider/slider.tsx +154 -13
- package/src/components/sonner/sonner.meta.md +58 -7
- package/src/components/sonner/sonner.stories.tsx +78 -5
- package/src/components/sonner/sonner.tsx +137 -8
- package/src/components/spinner/spinner.meta.md +62 -13
- package/src/components/spinner/spinner.stories.tsx +66 -14
- package/src/components/spinner/spinner.tsx +111 -9
- package/src/components/statistic/statistic.meta.md +7 -2
- package/src/components/statistic/statistic.stories.tsx +3 -7
- package/src/components/statistic/statistic.tsx +5 -6
- package/src/components/steps/steps.meta.md +18 -4
- package/src/components/steps/steps.stories.tsx +43 -3
- package/src/components/steps/steps.tsx +15 -12
- package/src/components/switch/switch.meta.md +51 -5
- package/src/components/switch/switch.stories.tsx +6 -6
- package/src/components/switch/switch.tsx +109 -41
- package/src/components/table/table.meta.md +17 -6
- package/src/components/table/table.stories.tsx +10 -5
- package/src/components/table/table.tsx +4 -4
- package/src/components/tabs/tabs.meta.md +38 -25
- package/src/components/tabs/tabs.stories.tsx +111 -25
- package/src/components/tabs/tabs.tsx +125 -54
- package/src/components/tag/tag.meta.md +105 -40
- package/src/components/tag/tag.stories.tsx +189 -16
- package/src/components/tag/tag.tsx +222 -21
- package/src/components/textarea/textarea.meta.md +35 -19
- package/src/components/textarea/textarea.stories.tsx +32 -6
- package/src/components/textarea/textarea.tsx +33 -9
- package/src/components/time-picker/time-picker.meta.md +124 -32
- package/src/components/time-picker/time-picker.stories.tsx +85 -15
- package/src/components/time-picker/time-picker.tsx +913 -61
- package/src/components/timeline/timeline.meta.md +14 -6
- package/src/components/timeline/timeline.stories.tsx +37 -7
- package/src/components/timeline/timeline.tsx +35 -14
- package/src/components/toggle/toggle.meta.md +5 -4
- 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 +5 -4
- 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 +55 -5
- package/src/components/tooltip/tooltip.stories.tsx +42 -5
- package/src/components/tooltip/tooltip.tsx +81 -21
- package/src/components/tour/tour.meta.md +9 -4
- package/src/components/tour/tour.stories.tsx +3 -3
- package/src/components/tour/tour.tsx +4 -4
- package/src/components/transfer/transfer.meta.md +11 -6
- package/src/components/transfer/transfer.stories.tsx +4 -8
- package/src/components/transfer/transfer.tsx +28 -21
- package/src/components/tree/tree.meta.md +63 -5
- package/src/components/tree/tree.stories.tsx +31 -12
- package/src/components/tree/tree.tsx +9 -8
- package/src/components/tree-select/tree-select.meta.md +59 -8
- package/src/components/tree-select/tree-select.stories.tsx +3 -3
- package/src/components/tree-select/tree-select.tsx +42 -7
- package/src/components/typography/typography.meta.md +61 -14
- package/src/components/typography/typography.stories.tsx +12 -11
- package/src/components/typography/typography.tsx +43 -28
- package/src/components/upload/upload.meta.md +49 -4
- package/src/components/upload/upload.stories.tsx +72 -12
- package/src/components/upload/upload.tsx +170 -37
- package/src/components/watermark/watermark.meta.md +7 -2
- package/src/components/watermark/watermark.stories.tsx +101 -9
- package/src/components/watermark/watermark.tsx +1 -0
- 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 -92
- package/src/components/button-group/button-group.stories.tsx +0 -90
- package/src/components/button-group/button-group.tsx +0 -75
- package/src/components/combobox/combobox.meta.md +0 -93
- package/src/components/combobox/combobox.stories.tsx +0 -55
- package/src/components/combobox/combobox.tsx +0 -130
- package/src/components/space/space.meta.md +0 -94
- package/src/components/space/space.stories.tsx +0 -94
- package/src/components/space/space.tsx +0 -106
|
@@ -2,12 +2,13 @@
|
|
|
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
|
-
package:
|
|
7
|
+
package: '@teamix-evo/ui'
|
|
8
|
+
displayName: 验证码输入
|
|
8
9
|
---
|
|
9
10
|
|
|
10
|
-
# InputOTP
|
|
11
|
+
# InputOTP 验证码输入
|
|
11
12
|
|
|
12
13
|
OTP 验证码输入 — 基于 [`input-otp`](https://github.com/guilhermerodz/input-otp)。**shadcn-only**(antd 无对标组件)。
|
|
13
14
|
4~8 位短验证码常见场景:登录、二步验证、支付确认。
|
|
@@ -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,12 +2,13 @@
|
|
|
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
|
-
package:
|
|
7
|
+
package: '@teamix-evo/ui'
|
|
8
|
+
displayName: 列表项
|
|
8
9
|
---
|
|
9
10
|
|
|
10
|
-
# Item
|
|
11
|
+
# Item 列表项
|
|
11
12
|
|
|
12
13
|
通用列表项 / 卡片项容器 — shadcn 2025-10 新增。**取代我们之前自实现的 `List.Item` + `List.Item.Meta`**(antd 老 List 在 v6 已 deprecated)。用 5 个语义槽组合:`ItemMedia` 媒体 / `ItemContent` 主体 / `ItemTitle` 标题 / `ItemDescription` 描述 / `ItemActions` 操作。排列用 `ItemGroup`(纵向 + 分隔)或自行 div / ul 自由布局。
|
|
13
14
|
|
|
@@ -24,6 +25,8 @@ package: "@teamix-evo/ui"
|
|
|
24
25
|
- 完整业务卡片(带 Header / Cover / Footer)→ `Card`
|
|
25
26
|
- 树形嵌套 → `Tree`
|
|
26
27
|
|
|
28
|
+
## Props
|
|
29
|
+
|
|
27
30
|
<!-- auto:props:begin -->
|
|
28
31
|
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
29
32
|
| --- | --- | --- | --- | --- |
|
|
@@ -31,6 +34,8 @@ package: "@teamix-evo/ui"
|
|
|
31
34
|
| `interactive` | `boolean` | `false` | – | 是否带 hover 高亮 + cursor-pointer(行可点击场景)。 |
|
|
32
35
|
<!-- auto:props:end -->
|
|
33
36
|
|
|
37
|
+
## 依赖
|
|
38
|
+
|
|
34
39
|
<!-- auto:deps:begin -->
|
|
35
40
|
### 同库依赖
|
|
36
41
|
|
|
@@ -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,19 +13,22 @@ 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: {
|
|
20
20
|
docs: {
|
|
21
21
|
description: {
|
|
22
22
|
component:
|
|
23
|
-
'通用列表项 / 卡片项 — 5
|
|
23
|
+
'通用列表项 / 卡片项 — 5 个语义槽组合(ItemMedia / ItemContent / ItemTitle / ItemDescription / ItemActions),配 ItemGroup 纵向排列。shadcn 2025-10 新增,取代之前自实现的 List.Item(antd 老 List 在 v6 已 deprecated)。',
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
27
|
argTypes: {
|
|
28
|
-
variant: {
|
|
28
|
+
variant: {
|
|
29
|
+
control: 'inline-radio',
|
|
30
|
+
options: ['default', 'outline', 'muted'],
|
|
31
|
+
},
|
|
29
32
|
interactive: { control: 'boolean' },
|
|
30
33
|
},
|
|
31
34
|
args: { variant: 'default', interactive: false },
|
|
@@ -57,7 +60,7 @@ const users = [
|
|
|
57
60
|
export const ContactList: Story = {
|
|
58
61
|
parameters: { controls: { disable: true } },
|
|
59
62
|
render: () => (
|
|
60
|
-
<ItemGroup className="w-96 rounded-md border">
|
|
63
|
+
<ItemGroup className="w-96 rounded-md border border-border">
|
|
61
64
|
{users.map((u) => (
|
|
62
65
|
<Item key={u.id} interactive className="px-3 py-2">
|
|
63
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
|
));
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: kbd
|
|
3
3
|
name: Kbd
|
|
4
|
+
displayName: 键位展示
|
|
4
5
|
type: component
|
|
5
|
-
category:
|
|
6
|
+
category: deprecated
|
|
6
7
|
since: 0.1.0
|
|
7
|
-
package:
|
|
8
|
+
package: '@teamix-evo/ui'
|
|
8
9
|
---
|
|
9
10
|
|
|
10
|
-
# Kbd
|
|
11
|
+
# Kbd 键位展示
|
|
11
12
|
|
|
12
13
|
键位展示 — shadcn 2025-10 新增。语义化的 `<kbd>` 元素 + `KbdGroup` 组合容器,用于在 UI 中标注**快捷键**(`⌘K` / `Ctrl + Enter` / `Esc`)。常见于 Command Palette、Tooltip、文档 / 帮助提示。
|
|
13
14
|
|
|
@@ -22,12 +23,20 @@ package: "@teamix-evo/ui"
|
|
|
22
23
|
- 引用代码片段 → 用 `<code>` / Typography Code(`<Kbd>` 语义是物理键位)
|
|
23
24
|
- 普通行内强调 → 用 `<strong>` / Typography Text strong
|
|
24
25
|
|
|
26
|
+
## Props
|
|
27
|
+
|
|
28
|
+
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成。
|
|
29
|
+
|
|
25
30
|
<!-- auto:props:begin -->
|
|
26
31
|
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
27
32
|
| --- | --- | --- | --- | --- |
|
|
28
|
-
| `size` | `'sm' \| 'default' \| 'lg'` | `"default"` | – | 尺寸 — 与文字行高匹配,大尺寸用于 Command Palette 等突出展示。 |
|
|
33
|
+
| `size` | `'sm' \| 'md' \| 'default' \| 'lg'` | `"default"` | – | 尺寸 — 与文字行高匹配,大尺寸用于 Command Palette 等突出展示。 |
|
|
29
34
|
<!-- auto:props:end -->
|
|
30
35
|
|
|
36
|
+
## 依赖
|
|
37
|
+
|
|
38
|
+
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成,数据源是 [`manifest.json`](../../../manifest.json)。**手工编辑 marker 之间的内容会在下次生成时被覆盖**。
|
|
39
|
+
|
|
31
40
|
<!-- auto:deps:begin -->
|
|
32
41
|
### 同库依赖
|
|
33
42
|
|
|
@@ -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>`
|
|
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>
|
|
@@ -4,16 +4,18 @@ import { cva, type VariantProps } from 'class-variance-authority';
|
|
|
4
4
|
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 border-border bg-muted font-mono tabular-nums text-muted-foreground shadow-[0_1px_0_0_rgba(0,0,0,0.08)]',
|
|
8
9
|
{
|
|
9
10
|
variants: {
|
|
10
11
|
size: {
|
|
11
|
-
sm: 'h-4 px-1 text-
|
|
12
|
+
sm: 'h-4 px-1 text-xxs',
|
|
13
|
+
md: 'h-5 px-1.5 text-xs',
|
|
12
14
|
default: 'h-5 px-1.5 text-xs',
|
|
13
15
|
lg: 'h-6 px-2 text-sm',
|
|
14
16
|
},
|
|
15
17
|
},
|
|
16
|
-
defaultVariants: { size: '
|
|
18
|
+
defaultVariants: { size: 'md' },
|
|
17
19
|
},
|
|
18
20
|
);
|
|
19
21
|
|
|
@@ -24,7 +26,7 @@ export interface KbdProps
|
|
|
24
26
|
* 尺寸 — 与文字行高匹配,大尺寸用于 Command Palette 等突出展示。
|
|
25
27
|
* @default "default"
|
|
26
28
|
*/
|
|
27
|
-
size?: 'sm' | 'default' | 'lg';
|
|
29
|
+
size?: 'sm' | 'md' | 'default' | 'lg';
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
/**
|
|
@@ -65,7 +67,10 @@ const KbdGroup = React.forwardRef<HTMLSpanElement, KbdGroupProps>(
|
|
|
65
67
|
{items.map((child, i) => (
|
|
66
68
|
<React.Fragment key={i}>
|
|
67
69
|
{i > 0 && separator ? (
|
|
68
|
-
<span
|
|
70
|
+
<span
|
|
71
|
+
aria-hidden="true"
|
|
72
|
+
className="text-xs text-muted-foreground"
|
|
73
|
+
>
|
|
69
74
|
{separator}
|
|
70
75
|
</span>
|
|
71
76
|
) : null}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: label
|
|
3
3
|
name: Label
|
|
4
|
+
displayName: 标签
|
|
4
5
|
type: component
|
|
5
|
-
category:
|
|
6
|
+
category: data-entry
|
|
6
7
|
since: 0.1.0
|
|
7
|
-
package:
|
|
8
|
+
package: '@teamix-evo/ui'
|
|
8
9
|
---
|
|
9
10
|
|
|
10
|
-
# Label
|
|
11
|
+
# Label 标签
|
|
11
12
|
|
|
12
13
|
表单字段标签 — 基于 [`@radix-ui/react-label`](https://www.radix-ui.com/primitives/docs/components/label) 包装。
|
|
13
|
-
shadcn 原版只继承 Radix 的 `peer-disabled:`
|
|
14
|
+
shadcn 原版只继承 Radix 的 `peer-disabled:` 联动;本版本补一条 antd Form.Item 风格的 `required`(红色 `*` 标记,**后置**在文字和 tooltip icon 右侧)+ 显式 `disabled` prop,适合 label 与目标控件**不直接相邻**的场景。
|
|
14
15
|
|
|
15
16
|
## When to use
|
|
16
17
|
|
|
@@ -30,7 +31,11 @@ shadcn 原版只继承 Radix 的 `peer-disabled:` 联动;本版本补一条 antd
|
|
|
30
31
|
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
31
32
|
| --- | --- | --- | --- | --- |
|
|
32
33
|
| `disabled` | `boolean` | `false` | – | 视觉禁用态。除原生 `peer-disabled:` 联动外,显式置 `true` 也会触发禁用样式; 适合 label 与目标控件不直接相邻、无法走 `peer` 约束的场景。 |
|
|
33
|
-
| `required` | `boolean` | `false` | – | 必填标记。`true` 时在 children
|
|
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) — 防止过度压缩,在响应式布局中保留可读宽度下限。 |
|
|
34
39
|
<!-- auto:props:end -->
|
|
35
40
|
|
|
36
41
|
## 依赖
|
|
@@ -59,11 +64,14 @@ pnpm add @radix-ui/react-label@^2.1.0 class-variance-authority@^0.7.0
|
|
|
59
64
|
|
|
60
65
|
## AI 生成纪律
|
|
61
66
|
|
|
62
|
-
- **`htmlFor`
|
|
63
|
-
- **`required` 配 `aria-required
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
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。
|
|
67
75
|
|
|
68
76
|
## Examples
|
|
69
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
|
+
};
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
3
3
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
4
|
+
import { Info } from 'lucide-react';
|
|
4
5
|
|
|
5
6
|
import { cn } from '@/utils/cn';
|
|
7
|
+
import {
|
|
8
|
+
TooltipContent,
|
|
9
|
+
TooltipProvider,
|
|
10
|
+
TooltipRoot,
|
|
11
|
+
TooltipTrigger,
|
|
12
|
+
} from '@/components/tooltip/tooltip';
|
|
6
13
|
|
|
7
14
|
const labelVariants = cva(
|
|
8
|
-
'text-
|
|
15
|
+
'text-xs font-medium leading-8 peer-disabled:cursor-not-allowed peer-disabled:opacity-70',
|
|
9
16
|
{
|
|
10
17
|
variants: {
|
|
11
18
|
disabled: {
|
|
@@ -29,11 +36,33 @@ export interface LabelProps
|
|
|
29
36
|
*/
|
|
30
37
|
disabled?: boolean;
|
|
31
38
|
/**
|
|
32
|
-
* 必填标记。`true` 时在 children
|
|
39
|
+
* 必填标记。`true` 时在 children 与 info icon **后**追加红色 `*`
|
|
40
|
+
* (语义来自 design destructive token);顺序为 `文字 ⓘ *`,三者间距 4px。
|
|
33
41
|
* 配合 `aria-required` 在 input 上一起使用以保证可访问性。
|
|
34
42
|
* @default false
|
|
35
43
|
*/
|
|
36
44
|
required?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* 辅助说明文本 — 有值时在 label 文字后渲染 info icon + hover tooltip
|
|
47
|
+
* (对齐 antd `Form.Item.tooltip` 习惯)。
|
|
48
|
+
*/
|
|
49
|
+
tooltip?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Tooltip 弹出方向。
|
|
52
|
+
* @default 'top'
|
|
53
|
+
*/
|
|
54
|
+
tooltipSide?: 'top' | 'right' | 'bottom' | 'left';
|
|
55
|
+
/**
|
|
56
|
+
* 最大宽度 — 超出时截断省略号。数字单位为 px,字符串直接用作 CSS 值。
|
|
57
|
+
* 适合长字段名在固定宽度表单中防止换行影响布局。
|
|
58
|
+
* @default undefined
|
|
59
|
+
*/
|
|
60
|
+
maxWidth?: number | string;
|
|
61
|
+
/**
|
|
62
|
+
* 最小宽度(px) — 防止过度压缩,在响应式布局中保留可读宽度下限。
|
|
63
|
+
* @default undefined
|
|
64
|
+
*/
|
|
65
|
+
minWidth?: number;
|
|
37
66
|
}
|
|
38
67
|
|
|
39
68
|
const Label = React.forwardRef<
|
|
@@ -41,25 +70,68 @@ const Label = React.forwardRef<
|
|
|
41
70
|
LabelProps
|
|
42
71
|
>(
|
|
43
72
|
(
|
|
44
|
-
{
|
|
73
|
+
{
|
|
74
|
+
className,
|
|
75
|
+
style,
|
|
76
|
+
disabled = false,
|
|
77
|
+
required = false,
|
|
78
|
+
tooltip,
|
|
79
|
+
tooltipSide = 'top',
|
|
80
|
+
maxWidth,
|
|
81
|
+
minWidth,
|
|
82
|
+
children,
|
|
83
|
+
...props
|
|
84
|
+
},
|
|
45
85
|
ref,
|
|
46
|
-
) =>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
{
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
86
|
+
) => {
|
|
87
|
+
const mergedStyle: React.CSSProperties = {
|
|
88
|
+
...style,
|
|
89
|
+
...(maxWidth !== undefined && {
|
|
90
|
+
maxWidth: typeof maxWidth === 'number' ? `${maxWidth}px` : maxWidth,
|
|
91
|
+
}),
|
|
92
|
+
...(minWidth !== undefined && { minWidth: `${minWidth}px` }),
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<LabelPrimitive.Root
|
|
97
|
+
ref={ref}
|
|
98
|
+
data-required={required ? '' : undefined}
|
|
99
|
+
style={mergedStyle}
|
|
100
|
+
className={cn(
|
|
101
|
+
labelVariants({ disabled }),
|
|
102
|
+
maxWidth !== undefined && 'truncate',
|
|
103
|
+
className,
|
|
104
|
+
)}
|
|
105
|
+
{...props}
|
|
106
|
+
>
|
|
107
|
+
<span className="inline-flex items-center gap-1 align-middle">
|
|
108
|
+
<span className={cn(maxWidth !== undefined && 'truncate')}>
|
|
109
|
+
{children}
|
|
110
|
+
</span>
|
|
111
|
+
{tooltip ? (
|
|
112
|
+
<TooltipProvider delayDuration={200}>
|
|
113
|
+
<TooltipRoot>
|
|
114
|
+
<TooltipTrigger asChild>
|
|
115
|
+
<Info
|
|
116
|
+
className="size-3.5 shrink-0 cursor-help text-muted-foreground transition-colors hover:text-foreground"
|
|
117
|
+
aria-hidden="true"
|
|
118
|
+
/>
|
|
119
|
+
</TooltipTrigger>
|
|
120
|
+
<TooltipContent side={tooltipSide}>
|
|
121
|
+
<p className="max-w-xs text-xs">{tooltip}</p>
|
|
122
|
+
</TooltipContent>
|
|
123
|
+
</TooltipRoot>
|
|
124
|
+
</TooltipProvider>
|
|
125
|
+
) : null}
|
|
126
|
+
{required ? (
|
|
127
|
+
<span className="shrink-0 text-destructive" aria-hidden="true">
|
|
128
|
+
*
|
|
129
|
+
</span>
|
|
130
|
+
) : null}
|
|
59
131
|
</span>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
132
|
+
</LabelPrimitive.Root>
|
|
133
|
+
);
|
|
134
|
+
},
|
|
63
135
|
);
|
|
64
136
|
Label.displayName = 'Label';
|
|
65
137
|
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: masonry
|
|
3
3
|
name: Masonry
|
|
4
|
+
displayName: 瀑布流
|
|
4
5
|
type: component
|
|
5
|
-
category:
|
|
6
|
+
category: deprecated
|
|
6
7
|
since: 0.1.0
|
|
7
|
-
package:
|
|
8
|
+
package: '@teamix-evo/ui'
|
|
8
9
|
---
|
|
9
10
|
|
|
10
|
-
# Masonry
|
|
11
|
+
# Masonry 瀑布流
|
|
11
12
|
|
|
12
13
|
瀑布流 — antd 独有补足。**等价 antd `Masonry`**(v6.0 新)。基于 CSS `column-count` + `break-inside: avoid` 的纯 CSS 实现 — **0 JS、SSR 友好、自动按 children 高度填充列**。
|
|
13
14
|
|
|
@@ -23,6 +24,8 @@ package: "@teamix-evo/ui"
|
|
|
23
24
|
- 严格视觉对齐(按"哪列最矮就填哪列")→ 用 JS-driven masonry(react-masonry-css)
|
|
24
25
|
- 等宽等高数据流 → `List grid={{column:N}}` / `Item` + Tailwind grid
|
|
25
26
|
|
|
27
|
+
## Props
|
|
28
|
+
|
|
26
29
|
<!-- auto:props:begin -->
|
|
27
30
|
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
28
31
|
| --- | --- | --- | --- | --- |
|
|
@@ -30,6 +33,8 @@ package: "@teamix-evo/ui"
|
|
|
30
33
|
| `gap` | `number` | `16` | – | 列间距(像素)。 |
|
|
31
34
|
<!-- auto:props:end -->
|
|
32
35
|
|
|
36
|
+
## 依赖
|
|
37
|
+
|
|
33
38
|
<!-- auto:deps:begin -->
|
|
34
39
|
### 同库依赖
|
|
35
40
|
|