@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
|
@@ -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
|
AlertDialog,
|
|
4
4
|
AlertDialogTrigger,
|
|
@@ -13,23 +13,60 @@ import {
|
|
|
13
13
|
import { Button, buttonVariants } from '@/components/button/button';
|
|
14
14
|
|
|
15
15
|
const meta: Meta<typeof AlertDialogContent> = {
|
|
16
|
-
title: '
|
|
16
|
+
title: '反馈 · Feedback/AlertDialog',
|
|
17
17
|
component: AlertDialogContent,
|
|
18
18
|
tags: ['autodocs'],
|
|
19
19
|
parameters: {
|
|
20
20
|
docs: {
|
|
21
21
|
description: {
|
|
22
22
|
component:
|
|
23
|
-
'确认对话框
|
|
23
|
+
'确认对话框 —— 对高风险、不可逆的操作做二次拦截,强制用户在「确认 / 取消」之间做出选择。基于 Radix AlertDialog 内核(焦点陷阱 + ESC 行为受控 + `role="alertdialog"`)+ 对齐 antd `Modal.confirm` / `Modal.alert` 的双按钮范式(`AlertDialogAction` / `AlertDialogCancel`);视觉上与 `Dialog` 同源(`--radius-dialog` 16px、无 border、纯白 + shadow 分界),`size` 四档绑定 `--layout-dialog-{sm|md|lg|xl}`,默认 `sm`(确认场景信息密度低)。视觉走 OpenTrek semantic tokens,所有样式来自 `@teamix-evo/tokens`,无 mock。',
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
|
+
argTypes: {
|
|
28
|
+
size: {
|
|
29
|
+
control: 'inline-radio',
|
|
30
|
+
options: ['sm', 'md', 'lg', 'xl'],
|
|
31
|
+
description:
|
|
32
|
+
'宽度档位,绑定 `--layout-dialog-{sm|md|lg|xl}`(OpenTrek 400/600/800/1200px)',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
args: { size: 'sm' },
|
|
27
36
|
};
|
|
28
37
|
|
|
29
38
|
export default meta;
|
|
30
39
|
type Story = StoryObj<typeof AlertDialogContent>;
|
|
31
40
|
|
|
41
|
+
export const Playground: Story = {
|
|
42
|
+
render: (args) => (
|
|
43
|
+
<AlertDialog>
|
|
44
|
+
<AlertDialogTrigger asChild>
|
|
45
|
+
<Button variant="destructive">删除项目</Button>
|
|
46
|
+
</AlertDialogTrigger>
|
|
47
|
+
<AlertDialogContent {...args}>
|
|
48
|
+
<AlertDialogHeader>
|
|
49
|
+
<AlertDialogTitle>确认删除项目?</AlertDialogTitle>
|
|
50
|
+
<AlertDialogDescription>
|
|
51
|
+
将永久删除 <b>"运营后台"</b> 项目及其下 142 个资源。此操作不可撤销。
|
|
52
|
+
</AlertDialogDescription>
|
|
53
|
+
</AlertDialogHeader>
|
|
54
|
+
<AlertDialogFooter>
|
|
55
|
+
<AlertDialogCancel>取消</AlertDialogCancel>
|
|
56
|
+
<AlertDialogAction
|
|
57
|
+
className={buttonVariants({ variant: 'destructive' })}
|
|
58
|
+
>
|
|
59
|
+
删除
|
|
60
|
+
</AlertDialogAction>
|
|
61
|
+
</AlertDialogFooter>
|
|
62
|
+
</AlertDialogContent>
|
|
63
|
+
</AlertDialog>
|
|
64
|
+
),
|
|
65
|
+
};
|
|
66
|
+
|
|
32
67
|
export const Destructive: Story = {
|
|
68
|
+
name: '高危删除(destructive)',
|
|
69
|
+
parameters: { controls: { disable: true } },
|
|
33
70
|
render: () => (
|
|
34
71
|
<AlertDialog>
|
|
35
72
|
<AlertDialogTrigger asChild>
|
|
@@ -58,6 +95,7 @@ export const Destructive: Story = {
|
|
|
58
95
|
};
|
|
59
96
|
|
|
60
97
|
export const NormalConfirm: Story = {
|
|
98
|
+
name: '业务确认(primary action)',
|
|
61
99
|
parameters: { controls: { disable: true } },
|
|
62
100
|
render: () => (
|
|
63
101
|
<AlertDialog>
|
|
@@ -79,3 +117,107 @@ export const NormalConfirm: Story = {
|
|
|
79
117
|
</AlertDialog>
|
|
80
118
|
),
|
|
81
119
|
};
|
|
120
|
+
|
|
121
|
+
export const AlertOnly: Story = {
|
|
122
|
+
name: 'Alert(单一确认,模拟 Modal.alert)',
|
|
123
|
+
parameters: {
|
|
124
|
+
controls: { disable: true },
|
|
125
|
+
docs: {
|
|
126
|
+
description: {
|
|
127
|
+
story:
|
|
128
|
+
'只展示单个 Action 按钮 — 模拟 antd `Modal.alert` 的单确认形态。适用于"已完成"、"权限不足"等仅需告知的场景。',
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
render: () => (
|
|
133
|
+
<AlertDialog>
|
|
134
|
+
<AlertDialogTrigger asChild>
|
|
135
|
+
<Button variant="outline">查看通知</Button>
|
|
136
|
+
</AlertDialogTrigger>
|
|
137
|
+
<AlertDialogContent>
|
|
138
|
+
<AlertDialogHeader>
|
|
139
|
+
<AlertDialogTitle>升级完成</AlertDialogTitle>
|
|
140
|
+
<AlertDialogDescription>
|
|
141
|
+
已切换到企业版,新功能将在下次刷新页面后生效。
|
|
142
|
+
</AlertDialogDescription>
|
|
143
|
+
</AlertDialogHeader>
|
|
144
|
+
<AlertDialogFooter>
|
|
145
|
+
<AlertDialogAction>知道了</AlertDialogAction>
|
|
146
|
+
</AlertDialogFooter>
|
|
147
|
+
</AlertDialogContent>
|
|
148
|
+
</AlertDialog>
|
|
149
|
+
),
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export const SizeMatrix: Story = {
|
|
153
|
+
name: 'Size 档位 · sm / md / lg / xl',
|
|
154
|
+
parameters: {
|
|
155
|
+
controls: { disable: true },
|
|
156
|
+
docs: {
|
|
157
|
+
description: {
|
|
158
|
+
story:
|
|
159
|
+
'依次触发四档尺寸 — 确认对话框默认 `sm` 即可,只有当需要列出资源清单 / 影响图谱时才升档。',
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
render: () => (
|
|
164
|
+
<div className="flex flex-wrap gap-2">
|
|
165
|
+
{(['sm', 'md', 'lg', 'xl'] as const).map((size) => (
|
|
166
|
+
<AlertDialog key={size}>
|
|
167
|
+
<AlertDialogTrigger asChild>
|
|
168
|
+
<Button variant="outline">size = {size}</Button>
|
|
169
|
+
</AlertDialogTrigger>
|
|
170
|
+
<AlertDialogContent size={size}>
|
|
171
|
+
<AlertDialogHeader>
|
|
172
|
+
<AlertDialogTitle>确认操作?({size})</AlertDialogTitle>
|
|
173
|
+
<AlertDialogDescription>
|
|
174
|
+
宽度绑定 `--layout-dialog-{size}`,实际像素由当前主题变体的
|
|
175
|
+
tokens 决定。
|
|
176
|
+
</AlertDialogDescription>
|
|
177
|
+
</AlertDialogHeader>
|
|
178
|
+
<AlertDialogFooter>
|
|
179
|
+
<AlertDialogCancel>取消</AlertDialogCancel>
|
|
180
|
+
<AlertDialogAction>确认</AlertDialogAction>
|
|
181
|
+
</AlertDialogFooter>
|
|
182
|
+
</AlertDialogContent>
|
|
183
|
+
</AlertDialog>
|
|
184
|
+
))}
|
|
185
|
+
</div>
|
|
186
|
+
),
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export const BorderlessShowcase: Story = {
|
|
190
|
+
name: '无 border border-border · 16px 圆角',
|
|
191
|
+
parameters: {
|
|
192
|
+
controls: { disable: true },
|
|
193
|
+
docs: {
|
|
194
|
+
description: {
|
|
195
|
+
story:
|
|
196
|
+
'与 `Dialog` 同源 — `AlertDialogContent` 已 `border-0`,16px 圆角(`--radius-dialog`)由 tokens 提供。请不要在 `className` 里加 `border *` 或覆盖 `rounded-*`。',
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
render: () => (
|
|
201
|
+
<AlertDialog>
|
|
202
|
+
<AlertDialogTrigger asChild>
|
|
203
|
+
<Button variant="destructive">释放实例</Button>
|
|
204
|
+
</AlertDialogTrigger>
|
|
205
|
+
<AlertDialogContent>
|
|
206
|
+
<AlertDialogHeader>
|
|
207
|
+
<AlertDialogTitle>确认释放实例?</AlertDialogTitle>
|
|
208
|
+
<AlertDialogDescription>
|
|
209
|
+
释放后实例及挂载数据将无法恢复。请确认已完成数据备份。
|
|
210
|
+
</AlertDialogDescription>
|
|
211
|
+
</AlertDialogHeader>
|
|
212
|
+
<AlertDialogFooter>
|
|
213
|
+
<AlertDialogCancel>取消</AlertDialogCancel>
|
|
214
|
+
<AlertDialogAction
|
|
215
|
+
className={buttonVariants({ variant: 'destructive' })}
|
|
216
|
+
>
|
|
217
|
+
确认释放
|
|
218
|
+
</AlertDialogAction>
|
|
219
|
+
</AlertDialogFooter>
|
|
220
|
+
</AlertDialogContent>
|
|
221
|
+
</AlertDialog>
|
|
222
|
+
),
|
|
223
|
+
};
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
4
|
|
|
4
5
|
import { cn } from '@/utils/cn';
|
|
5
6
|
import { buttonVariants } from '@/components/button/button';
|
|
6
7
|
|
|
7
8
|
const AlertDialog = AlertDialogPrimitive.Root;
|
|
8
|
-
const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
|
|
9
9
|
const AlertDialogPortal = AlertDialogPrimitive.Portal;
|
|
10
10
|
|
|
11
|
+
const AlertDialogTrigger = React.forwardRef<
|
|
12
|
+
React.ElementRef<typeof AlertDialogPrimitive.Trigger>,
|
|
13
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Trigger>
|
|
14
|
+
>(({ className, ...props }, ref) => (
|
|
15
|
+
<AlertDialogPrimitive.Trigger
|
|
16
|
+
ref={ref}
|
|
17
|
+
className={cn('cursor-pointer', className)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
));
|
|
21
|
+
AlertDialogTrigger.displayName = AlertDialogPrimitive.Trigger.displayName;
|
|
22
|
+
|
|
11
23
|
const AlertDialogOverlay = React.forwardRef<
|
|
12
24
|
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
|
|
13
25
|
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
|
|
@@ -23,21 +35,53 @@ const AlertDialogOverlay = React.forwardRef<
|
|
|
23
35
|
));
|
|
24
36
|
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
|
|
25
37
|
|
|
38
|
+
/**
|
|
39
|
+
* AlertDialog content 变体 — 与 Dialog 保持同源视觉。
|
|
40
|
+
* - 圆角 `--radius-dialog`(16px)
|
|
41
|
+
* - 无 border,纯白 + shadow 作为视觉分界
|
|
42
|
+
* - size 绑定 `--layout-dialog-{sm|md|lg|xl}` tokens(确认类默认 `sm`,更紧凑)
|
|
43
|
+
*/
|
|
44
|
+
const alertDialogContentVariants = cva(
|
|
45
|
+
'fixed left-1/2 top-1/2 z-50 grid w-full translate-x-[-50%] translate-y-[-50%] gap-4 border-0 bg-background p-6 shadow-lg duration-200 rounded-[var(--radius-dialog)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',
|
|
46
|
+
{
|
|
47
|
+
variants: {
|
|
48
|
+
size: {
|
|
49
|
+
sm: 'max-w-[var(--layout-dialog-sm)]',
|
|
50
|
+
md: 'max-w-[var(--layout-dialog-md)]',
|
|
51
|
+
lg: 'max-w-[var(--layout-dialog-lg)]',
|
|
52
|
+
xl: 'max-w-[var(--layout-dialog-xl)]',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
defaultVariants: { size: 'sm' },
|
|
56
|
+
},
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
export type AlertDialogSize = NonNullable<
|
|
60
|
+
VariantProps<typeof alertDialogContentVariants>['size']
|
|
61
|
+
>;
|
|
62
|
+
|
|
26
63
|
export interface AlertDialogContentProps
|
|
27
|
-
extends React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content
|
|
64
|
+
extends React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>,
|
|
65
|
+
VariantProps<typeof alertDialogContentVariants> {
|
|
66
|
+
/**
|
|
67
|
+
* 确认对话框尺寸 — 绑定 design tokens `--layout-dialog-{sm|md|lg|xl}`。
|
|
68
|
+
* OpenTrek 基准:sm=400 / md=600 / lg=800 / xl=1200。
|
|
69
|
+
* 确认场景文案短、信息少,默认 `sm`。
|
|
70
|
+
* @default "sm"
|
|
71
|
+
*/
|
|
72
|
+
size?: AlertDialogSize;
|
|
73
|
+
}
|
|
28
74
|
|
|
29
75
|
const AlertDialogContent = React.forwardRef<
|
|
30
76
|
React.ElementRef<typeof AlertDialogPrimitive.Content>,
|
|
31
77
|
AlertDialogContentProps
|
|
32
|
-
>(({ className, ...props }, ref) => (
|
|
78
|
+
>(({ className, size = 'sm', ...props }, ref) => (
|
|
33
79
|
<AlertDialogPortal>
|
|
34
80
|
<AlertDialogOverlay />
|
|
35
81
|
<AlertDialogPrimitive.Content
|
|
36
82
|
ref={ref}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
className,
|
|
40
|
-
)}
|
|
83
|
+
data-slot="dialog-content"
|
|
84
|
+
className={cn(alertDialogContentVariants({ size }), className)}
|
|
41
85
|
{...props}
|
|
42
86
|
/>
|
|
43
87
|
</AlertDialogPortal>
|
|
@@ -49,10 +93,7 @@ const AlertDialogHeader = ({
|
|
|
49
93
|
...props
|
|
50
94
|
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
51
95
|
<div
|
|
52
|
-
className={cn(
|
|
53
|
-
'flex flex-col space-y-2 text-center sm:text-left',
|
|
54
|
-
className,
|
|
55
|
-
)}
|
|
96
|
+
className={cn('flex flex-col gap-2 text-center sm:text-left', className)}
|
|
56
97
|
{...props}
|
|
57
98
|
/>
|
|
58
99
|
);
|
|
@@ -78,6 +119,7 @@ const AlertDialogTitle = React.forwardRef<
|
|
|
78
119
|
>(({ className, ...props }, ref) => (
|
|
79
120
|
<AlertDialogPrimitive.Title
|
|
80
121
|
ref={ref}
|
|
122
|
+
data-slot="dialog-title"
|
|
81
123
|
className={cn('text-lg font-semibold', className)}
|
|
82
124
|
{...props}
|
|
83
125
|
/>
|
|
@@ -90,7 +132,7 @@ const AlertDialogDescription = React.forwardRef<
|
|
|
90
132
|
>(({ className, ...props }, ref) => (
|
|
91
133
|
<AlertDialogPrimitive.Description
|
|
92
134
|
ref={ref}
|
|
93
|
-
className={cn('text-
|
|
135
|
+
className={cn('text-xs text-muted-foreground', className)}
|
|
94
136
|
{...props}
|
|
95
137
|
/>
|
|
96
138
|
));
|
|
@@ -115,7 +157,11 @@ const AlertDialogCancel = React.forwardRef<
|
|
|
115
157
|
>(({ className, ...props }, ref) => (
|
|
116
158
|
<AlertDialogPrimitive.Cancel
|
|
117
159
|
ref={ref}
|
|
118
|
-
className={cn(
|
|
160
|
+
className={cn(
|
|
161
|
+
buttonVariants({ variant: 'outline' }),
|
|
162
|
+
'mt-2 sm:mt-0',
|
|
163
|
+
className,
|
|
164
|
+
)}
|
|
119
165
|
{...props}
|
|
120
166
|
/>
|
|
121
167
|
));
|
|
@@ -133,4 +179,5 @@ export {
|
|
|
133
179
|
AlertDialogDescription,
|
|
134
180
|
AlertDialogAction,
|
|
135
181
|
AlertDialogCancel,
|
|
182
|
+
alertDialogContentVariants,
|
|
136
183
|
};
|
|
@@ -3,7 +3,7 @@ id: anchor
|
|
|
3
3
|
name: Anchor
|
|
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
|
---
|
|
@@ -27,32 +27,28 @@ package: '@teamix-evo/ui'
|
|
|
27
27
|
## Props
|
|
28
28
|
|
|
29
29
|
<!-- auto:props:begin -->
|
|
30
|
-
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `onChange` | `(key: string) => void` | – | – | 当前高亮变化回调。 |
|
|
37
|
-
|
|
30
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
31
|
+
| --- | --- | --- | --- | --- |
|
|
32
|
+
| `items` | `AnchorItem[]` | – | ✓ | 锚点项树(antd `items` 并集)。 |
|
|
33
|
+
| `offsetTop` | `number` | `0` | – | 当目标元素距视口顶部小于此值时高亮(IntersectionObserver `rootMargin`)。 |
|
|
34
|
+
| `scrollBehavior` | `'smooth' \| 'auto'` | `"smooth"` | – | 点击锚点平滑滚动行为。 |
|
|
35
|
+
| `onChange` | `(key: string) => void` | – | – | 当前高亮变化回调。 |
|
|
38
36
|
<!-- auto:props:end -->
|
|
39
37
|
|
|
40
38
|
## 依赖
|
|
41
39
|
|
|
42
40
|
<!-- auto:deps:begin -->
|
|
43
|
-
|
|
44
41
|
### 同库依赖
|
|
45
42
|
|
|
46
43
|
> `teamix-evo ui add anchor` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
47
44
|
|
|
48
|
-
| Entry | 类型 | 描述
|
|
49
|
-
|
|
|
50
|
-
| `cn`
|
|
45
|
+
| Entry | 类型 | 描述 |
|
|
46
|
+
| --- | --- | --- |
|
|
47
|
+
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
51
48
|
|
|
52
49
|
### npm 依赖
|
|
53
50
|
|
|
54
51
|
_无 — 本组件不依赖任何 npm 包。_
|
|
55
|
-
|
|
56
52
|
<!-- auto:deps:end -->
|
|
57
53
|
|
|
58
54
|
## 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 { Anchor } from './anchor';
|
|
3
3
|
|
|
4
4
|
const meta: Meta<typeof Anchor> = {
|
|
5
|
-
title: '
|
|
5
|
+
title: '废弃 · Deprecated/Anchor',
|
|
6
6
|
component: Anchor,
|
|
7
7
|
tags: ['autodocs'],
|
|
8
8
|
parameters: {
|
|
9
9
|
docs: {
|
|
10
10
|
description: {
|
|
11
11
|
component:
|
|
12
|
-
'锚点导航 — 长文档 / 详情页侧边目录,点击滚动到 id 节点,滚动时 IntersectionObserver 自动高亮。等价 antd `Anchor`。',
|
|
12
|
+
'⚠️ **已废弃** — 仅 Storybook 留档,不通过 manifest 对外发布。\n\n锚点导航 — 长文档 / 详情页侧边目录,点击滚动到 id 节点,滚动时 IntersectionObserver 自动高亮。等价 antd `Anchor`。',
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
15
|
},
|
|
@@ -98,7 +98,7 @@ const Anchor = React.forwardRef<HTMLElement, AnchorProps>(
|
|
|
98
98
|
href={`#${it.key}`}
|
|
99
99
|
onClick={(e) => handleClick(e, it.key)}
|
|
100
100
|
className={cn(
|
|
101
|
-
'block border-l-2 py-1 pr-2 text-
|
|
101
|
+
'block border-l-2 py-1 pr-2 text-xs transition-colors',
|
|
102
102
|
depth === 0 ? 'pl-3' : depth === 1 ? 'pl-6' : 'pl-9',
|
|
103
103
|
active === it.key
|
|
104
104
|
? 'border-primary text-primary'
|
|
@@ -117,7 +117,7 @@ const Anchor = React.forwardRef<HTMLElement, AnchorProps>(
|
|
|
117
117
|
<nav
|
|
118
118
|
ref={ref}
|
|
119
119
|
aria-label="目录"
|
|
120
|
-
className={cn('text-
|
|
120
|
+
className={cn('text-xs', className)}
|
|
121
121
|
{...props}
|
|
122
122
|
>
|
|
123
123
|
<ul>{items.map((it) => renderItem(it, 0))}</ul>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
id: app
|
|
3
3
|
name: App
|
|
4
4
|
type: component
|
|
5
|
-
category:
|
|
5
|
+
category: deprecated
|
|
6
6
|
since: 0.1.0
|
|
7
7
|
package: '@teamix-evo/ui'
|
|
8
8
|
displayName: 应用容器
|
|
@@ -27,32 +27,28 @@ displayName: 应用容器
|
|
|
27
27
|
## Props
|
|
28
28
|
|
|
29
29
|
<!-- auto:props:begin -->
|
|
30
|
-
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
35
|
-
| `dir` | `'ltr' \| 'rtl'` | `"ltr"` | – | 文字方向 — 设到根容器的 `dir` 属性,Radix 等组件会自动适配。 |
|
|
36
|
-
|
|
30
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
31
|
+
| --- | --- | --- | --- | --- |
|
|
32
|
+
| `withToaster` | `boolean` | `true` | – | 是否挂载 `<Toaster />`(antd `App` 内部托管 message / notification 静态实例) — 全应用根挂一次。 |
|
|
33
|
+
| `toasterProps` | `ToasterProps` | – | – | 传递给 Toaster 的配置(位置 / 主题 / 自动关闭等) — 仅 `withToaster=true` 时生效。 |
|
|
34
|
+
| `dir` | `'ltr' \| 'rtl'` | `"ltr"` | – | 文字方向 — 设到根容器的 `dir` 属性,Radix 等组件会自动适配。 |
|
|
37
35
|
<!-- auto:props:end -->
|
|
38
36
|
|
|
39
37
|
## 依赖
|
|
40
38
|
|
|
41
39
|
<!-- auto:deps:begin -->
|
|
42
|
-
|
|
43
40
|
### 同库依赖
|
|
44
41
|
|
|
45
42
|
> `teamix-evo ui add app` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
46
43
|
|
|
47
|
-
| Entry
|
|
48
|
-
|
|
|
49
|
-
| `cn`
|
|
50
|
-
| `sonner` | component | Toast 通知 — sonner 包装,等价 antd message + notification 并集(toast() 函数式 API + Toaster
|
|
44
|
+
| Entry | 类型 | 描述 |
|
|
45
|
+
| --- | --- | --- |
|
|
46
|
+
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
47
|
+
| `sonner` | component | Toast 通知 — sonner 包装,等价 antd message + notification 并集(toast() 函数式 API + Toaster 容器,面性 5 状态图标 + 无边框) |
|
|
51
48
|
|
|
52
49
|
### npm 依赖
|
|
53
50
|
|
|
54
51
|
_无 — 本组件不依赖任何 npm 包。_
|
|
55
|
-
|
|
56
52
|
<!-- auto:deps:end -->
|
|
57
53
|
|
|
58
54
|
## AI 生成纪律
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import { App } from './app';
|
|
3
3
|
import { Button } from '@/components/button/button';
|
|
4
4
|
import { toast } from '@/components/sonner/sonner';
|
|
5
5
|
import { notification } from '@/components/notification/notification';
|
|
6
6
|
|
|
7
7
|
const meta: Meta<typeof App> = {
|
|
8
|
-
title: '
|
|
8
|
+
title: '废弃 · Deprecated/App',
|
|
9
9
|
component: App,
|
|
10
10
|
tags: ['autodocs'],
|
|
11
11
|
parameters: {
|
|
12
12
|
docs: {
|
|
13
13
|
description: {
|
|
14
14
|
component:
|
|
15
|
-
'应用根容器 — 挂全局 Toaster + 设置 dir / lang + 承载根级 className。对标 antd `App`,但不接管主题(主题靠 design tokens / CSS vars),也不收敛 useApp() hook。',
|
|
15
|
+
'⚠️ **已废弃** — 仅 Storybook 留档,不通过 manifest 对外发布。\n\n应用根容器 — 挂全局 Toaster + 设置 dir / lang + 承载根级 className。对标 antd `App`,但不接管主题(主题靠 design tokens / CSS vars),也不收敛 useApp() hook。',
|
|
16
16
|
},
|
|
17
17
|
},
|
|
18
18
|
},
|
|
@@ -28,7 +28,7 @@ type Story = StoryObj<typeof App>;
|
|
|
28
28
|
|
|
29
29
|
export const Playground: Story = {
|
|
30
30
|
render: (args) => (
|
|
31
|
-
<App {...args} className="rounded-md border p-6">
|
|
31
|
+
<App {...args} className="rounded-md border border-border p-6">
|
|
32
32
|
<div className="flex flex-col gap-3">
|
|
33
33
|
<span className="text-sm text-muted-foreground">
|
|
34
34
|
App 内挂载了 Toaster,可直接触发:
|
|
@@ -38,7 +38,7 @@ export const Playground: Story = {
|
|
|
38
38
|
<Button
|
|
39
39
|
variant="outline"
|
|
40
40
|
onClick={() =>
|
|
41
|
-
notification.
|
|
41
|
+
notification.primary({
|
|
42
42
|
title: 'App 容器在生效',
|
|
43
43
|
description: '右上角 Toaster 是 App 默认挂载的',
|
|
44
44
|
})
|
|
@@ -55,7 +55,7 @@ export const Playground: Story = {
|
|
|
55
55
|
export const RTL: Story = {
|
|
56
56
|
parameters: { controls: { disable: true } },
|
|
57
57
|
render: () => (
|
|
58
|
-
<App dir="rtl" className="rounded-md border p-6">
|
|
58
|
+
<App dir="rtl" className="rounded-md border border-border p-6">
|
|
59
59
|
<div className="text-sm">
|
|
60
60
|
当前方向: <strong>rtl</strong> — 你会看到自然的右到左流向
|
|
61
61
|
</div>
|
|
@@ -3,7 +3,7 @@ id: aspect-ratio
|
|
|
3
3
|
name: AspectRatio
|
|
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
|
---
|
|
@@ -29,11 +29,9 @@ shadcn-only,antd 无对标。
|
|
|
29
29
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成。
|
|
30
30
|
|
|
31
31
|
<!-- auto:props:begin -->
|
|
32
|
-
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
| `ratio` | `number` | `1` | – | 宽高比 = 宽 / 高(必传)。常见值:`16 / 9` / `4 / 3` / `1` / `9 / 16`。 |
|
|
36
|
-
|
|
32
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
33
|
+
| --- | --- | --- | --- | --- |
|
|
34
|
+
| `ratio` | `number` | `1` | – | 宽高比 = 宽 / 高(必传)。常见值:`16 / 9` / `4 / 3` / `1` / `9 / 16`。 |
|
|
37
35
|
<!-- auto:props:end -->
|
|
38
36
|
|
|
39
37
|
## 依赖
|
|
@@ -41,7 +39,6 @@ shadcn-only,antd 无对标。
|
|
|
41
39
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成,数据源是 [`manifest.json`](../../../manifest.json)。**手工编辑 marker 之间的内容会在下次生成时被覆盖**。
|
|
42
40
|
|
|
43
41
|
<!-- auto:deps:begin -->
|
|
44
|
-
|
|
45
42
|
### 同库依赖
|
|
46
43
|
|
|
47
44
|
_无 — 本组件不依赖其他 ui entry。_
|
|
@@ -53,7 +50,6 @@ _无 — 本组件不依赖其他 ui entry。_
|
|
|
53
50
|
```bash
|
|
54
51
|
pnpm add @radix-ui/react-aspect-ratio@^1.1.0
|
|
55
52
|
```
|
|
56
|
-
|
|
57
53
|
<!-- auto:deps:end -->
|
|
58
54
|
|
|
59
55
|
> 透传所有 `<div>` 原生属性。`ratio: number` 是最关键的 prop(必传),如 `16 / 9` / `4 / 3` / `1`。
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import { AspectRatio } from './aspect-ratio';
|
|
3
3
|
|
|
4
4
|
const meta: Meta<typeof AspectRatio> = {
|
|
5
|
-
title: '
|
|
5
|
+
title: '废弃 · Deprecated/AspectRatio',
|
|
6
6
|
component: AspectRatio,
|
|
7
7
|
tags: ['autodocs'],
|
|
8
8
|
parameters: {
|
|
9
9
|
docs: {
|
|
10
10
|
description: {
|
|
11
11
|
component:
|
|
12
|
-
'宽高比容器 — 强制子元素按指定比例渲染,常用于图片 / 视频 / iframe 等响应式封面容器。基于 Radix AspectRatio,通过 `ratio` prop 传入任意宽高比。shadcn 专有,填补了 antd 未提供的纯布局能力。',
|
|
12
|
+
'⚠️ **已废弃** — 仅 Storybook 留档,不通过 manifest 对外发布。\n\n宽高比容器 — 强制子元素按指定比例渲染,常用于图片 / 视频 / iframe 等响应式封面容器。基于 Radix AspectRatio,通过 `ratio` prop 传入任意宽高比。shadcn 专有,填补了 antd 未提供的纯布局能力。',
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
15
|
},
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
id: auto-complete
|
|
3
3
|
name: AutoComplete
|
|
4
4
|
type: component
|
|
5
|
-
category:
|
|
5
|
+
category: data-entry
|
|
6
6
|
since: 0.1.0
|
|
7
7
|
package: '@teamix-evo/ui'
|
|
8
8
|
displayName: 自动补全
|
|
@@ -27,38 +27,37 @@ displayName: 自动补全
|
|
|
27
27
|
## Props
|
|
28
28
|
|
|
29
29
|
<!-- auto:props:begin -->
|
|
30
|
-
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
40
|
-
| `
|
|
41
|
-
| `
|
|
42
|
-
|
|
30
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
31
|
+
| --- | --- | --- | --- | --- |
|
|
32
|
+
| `options` | `AutoCompleteOption[]` | – | ✓ | 候选项(antd `options` 并集) — 通常由 onSearch 回调刷新。 |
|
|
33
|
+
| `value` | `string` | – | – | 受控值。 |
|
|
34
|
+
| `defaultValue` | `string` | – | – | uncontrolled 初值。 |
|
|
35
|
+
| `onChange` | `(value: string) => void` | – | – | 值变化回调 — 用户键入 / 选中候选时触发。 |
|
|
36
|
+
| `onSearch` | `(query: string) => void` | – | – | 用户输入时回调,用于刷新 `options`(异步建议)。 提供该回调后,内部不再对 `options` 做本地过滤(由外部按 query 自行刷新)。 |
|
|
37
|
+
| `onSelect` | `(value: string, option: AutoCompleteOption) => void` | – | – | 选中候选时回调。 |
|
|
38
|
+
| `openOnFocus` | `boolean` | `false` | – | 是否在输入框聚焦但 query 为空时显示完整 `options`(antd `defaultActiveFirstOption` 行为的近似)。 |
|
|
39
|
+
| `emptyText` | `string` | `"无匹配项"` | – | 无匹配时的提示文本。 |
|
|
40
|
+
| `size` | `'sm' \| 'md' \| 'default' \| 'lg'` | `"md"` | – | 容器尺寸 — 透传 Input.size。 |
|
|
41
|
+
| `error` | `boolean` | `false` | – | 错误态视觉(校验失败) — 透传给内部 Input,红色 border + ring,自动写 `aria-invalid="true"`。 |
|
|
43
42
|
<!-- auto:props:end -->
|
|
44
43
|
|
|
45
44
|
## 依赖
|
|
46
45
|
|
|
47
46
|
<!-- auto:deps:begin -->
|
|
48
|
-
|
|
49
47
|
### 同库依赖
|
|
50
48
|
|
|
51
49
|
> `teamix-evo ui add auto-complete` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
52
50
|
|
|
53
|
-
| Entry
|
|
54
|
-
|
|
|
55
|
-
| `cn`
|
|
56
|
-
| `input` | component |
|
|
51
|
+
| Entry | 类型 | 描述 |
|
|
52
|
+
| --- | --- | --- |
|
|
53
|
+
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
54
|
+
| `input` | component | 单行文本输入 — clearable / showCount / size(sm 24 / md 32 / lg 36,与 Button 同档)/ error 四档内建能力。前缀/后缀/addon 等复合形态已拆出独立 InputGroup;多行已拆出独立 Textarea |
|
|
55
|
+
| `popover` | component | 可交互浮层 — Radix Popover + antd arrow 并集,使用 showArrow 控制尖角(与 Tooltip / HoverCard 命名统一) |
|
|
56
|
+
| `command` | component | 命令面板 / 下拉底座 — cmdk(Linear / Raycast 风格)提供过滤 / 键盘导航 / a11y;同时为 Combobox / Select / AutoComplete 提供同源下拉内核 |
|
|
57
57
|
|
|
58
58
|
### npm 依赖
|
|
59
59
|
|
|
60
60
|
_无 — 本组件不依赖任何 npm 包。_
|
|
61
|
-
|
|
62
61
|
<!-- auto:deps:end -->
|
|
63
62
|
|
|
64
63
|
## AI 生成纪律
|