@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
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: descriptions
|
|
3
3
|
name: Descriptions
|
|
4
|
+
displayName: 描述列表
|
|
4
5
|
type: component
|
|
5
|
-
category:
|
|
6
|
+
category: data-display
|
|
6
7
|
since: 0.1.0
|
|
7
|
-
package:
|
|
8
|
+
package: '@teamix-evo/ui'
|
|
8
9
|
---
|
|
9
10
|
|
|
10
|
-
# Descriptions
|
|
11
|
+
# Descriptions 描述列表
|
|
11
12
|
|
|
12
13
|
描述列表 — antd 独有补足。**键值对详情**(资源详情 / 用户信息 / 配置预览),声明式 `items` 数组驱动,自动布局到等分列。
|
|
13
14
|
|
|
@@ -23,6 +24,8 @@ package: "@teamix-evo/ui"
|
|
|
23
24
|
- 表格(行 = 同质对象)→ `Table`
|
|
24
25
|
- 富文本 → `Prose`
|
|
25
26
|
|
|
27
|
+
## Props
|
|
28
|
+
|
|
26
29
|
<!-- auto:props:begin -->
|
|
27
30
|
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
28
31
|
| --- | --- | --- | --- | --- |
|
|
@@ -31,9 +34,11 @@ package: "@teamix-evo/ui"
|
|
|
31
34
|
| `column` | `1 \| 2 \| 3 \| 4` | `3` | – | 列数(antd `column` 并集) — 等分。响应式可在容器侧加 className 处理。 |
|
|
32
35
|
| `layout` | `'horizontal' \| 'vertical'` | `"horizontal"` | – | 布局方向。`horizontal`(默认):label 在左,value 在右;`vertical`:label 在上,value 在下。 |
|
|
33
36
|
| `bordered` | `boolean` | `false` | – | 带边框(每项独立单元格)。 |
|
|
34
|
-
| `size` | `'sm' \| 'default'` | `"default"` | – | 尺寸。 |
|
|
37
|
+
| `size` | `'sm' \| 'md' \| 'default'` | `"default"` | – | 尺寸。 |
|
|
35
38
|
<!-- auto:props:end -->
|
|
36
39
|
|
|
40
|
+
## 依赖
|
|
41
|
+
|
|
37
42
|
<!-- auto:deps:begin -->
|
|
38
43
|
### 同库依赖
|
|
39
44
|
|
|
@@ -74,5 +79,5 @@ import { Badge } from '@/components/ui/badge';
|
|
|
74
79
|
{ label: '创建时间', value: '2024-12-01' },
|
|
75
80
|
{ label: '描述', value: '中后台运营管理系统', span: 3 },
|
|
76
81
|
]}
|
|
77
|
-
|
|
82
|
+
/>;
|
|
78
83
|
```
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import { Descriptions } from './descriptions';
|
|
3
3
|
import { Badge } from '@/components/badge/badge';
|
|
4
4
|
|
|
5
5
|
const meta: Meta<typeof Descriptions> = {
|
|
6
|
-
title: '
|
|
6
|
+
title: '数据展示 · Data Display/Descriptions',
|
|
7
7
|
component: Descriptions,
|
|
8
8
|
tags: ['autodocs'],
|
|
9
9
|
parameters: {
|
|
10
10
|
docs: {
|
|
11
11
|
description: {
|
|
12
12
|
component:
|
|
13
|
-
'描述列表 —
|
|
13
|
+
'描述列表 — 键值对详情(资源详情 / 用户信息 / 配置预览)。声明式 items 数组驱动,自动布局,支持横/纵布局、bordered、span 跨列。等价 antd Descriptions。',
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
},
|
|
@@ -36,7 +36,7 @@ export interface DescriptionsProps
|
|
|
36
36
|
* 尺寸。
|
|
37
37
|
* @default "default"
|
|
38
38
|
*/
|
|
39
|
-
size?: 'sm' | 'default';
|
|
39
|
+
size?: 'sm' | 'md' | 'default';
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
const Descriptions = React.forwardRef<HTMLDivElement, DescriptionsProps>(
|
|
@@ -47,18 +47,17 @@ const Descriptions = React.forwardRef<HTMLDivElement, DescriptionsProps>(
|
|
|
47
47
|
column = 3,
|
|
48
48
|
layout = 'horizontal',
|
|
49
49
|
bordered = false,
|
|
50
|
-
size = '
|
|
50
|
+
size = 'md',
|
|
51
51
|
className,
|
|
52
52
|
...props
|
|
53
53
|
},
|
|
54
54
|
ref,
|
|
55
55
|
) => {
|
|
56
|
-
const isSm = size === 'sm';
|
|
57
56
|
return (
|
|
58
57
|
<div
|
|
59
58
|
ref={ref}
|
|
60
59
|
className={cn(
|
|
61
|
-
bordered && 'overflow-hidden rounded-md border',
|
|
60
|
+
bordered && 'overflow-hidden rounded-md border border-border',
|
|
62
61
|
className,
|
|
63
62
|
)}
|
|
64
63
|
{...props}
|
|
@@ -67,7 +66,9 @@ const Descriptions = React.forwardRef<HTMLDivElement, DescriptionsProps>(
|
|
|
67
66
|
<div
|
|
68
67
|
className={cn(
|
|
69
68
|
'font-semibold',
|
|
70
|
-
bordered
|
|
69
|
+
bordered
|
|
70
|
+
? 'border-b border-b-border bg-muted/50 px-4 py-2 text-xs'
|
|
71
|
+
: 'mb-3 text-base',
|
|
71
72
|
)}
|
|
72
73
|
>
|
|
73
74
|
{title}
|
|
@@ -76,15 +77,23 @@ const Descriptions = React.forwardRef<HTMLDivElement, DescriptionsProps>(
|
|
|
76
77
|
<div
|
|
77
78
|
className={cn(
|
|
78
79
|
'grid',
|
|
79
|
-
{
|
|
80
|
-
|
|
80
|
+
{
|
|
81
|
+
1: 'grid-cols-1',
|
|
82
|
+
2: 'grid-cols-2',
|
|
83
|
+
3: 'grid-cols-3',
|
|
84
|
+
4: 'grid-cols-4',
|
|
85
|
+
}[column],
|
|
86
|
+
bordered
|
|
87
|
+
? 'divide-x divide-y divide-border'
|
|
88
|
+
: 'gap-x-6 gap-y-3 p-0',
|
|
81
89
|
)}
|
|
82
90
|
>
|
|
83
91
|
{items.map((it, i) => (
|
|
84
92
|
<div
|
|
85
93
|
key={i}
|
|
86
94
|
style={{
|
|
87
|
-
gridColumn:
|
|
95
|
+
gridColumn:
|
|
96
|
+
it.span && it.span > 1 ? `span ${it.span}` : undefined,
|
|
88
97
|
}}
|
|
89
98
|
className={cn(
|
|
90
99
|
bordered
|
|
@@ -92,18 +101,17 @@ const Descriptions = React.forwardRef<HTMLDivElement, DescriptionsProps>(
|
|
|
92
101
|
? 'flex divide-x divide-border'
|
|
93
102
|
: 'flex flex-col'
|
|
94
103
|
: layout === 'horizontal'
|
|
95
|
-
|
|
96
|
-
|
|
104
|
+
? 'flex gap-3'
|
|
105
|
+
: 'flex flex-col gap-1',
|
|
97
106
|
)}
|
|
98
107
|
>
|
|
99
108
|
<div
|
|
100
109
|
className={cn(
|
|
101
|
-
'shrink-0 text-muted-foreground',
|
|
102
|
-
isSm ? 'text-xs' : 'text-sm',
|
|
110
|
+
'shrink-0 text-xs text-muted-foreground',
|
|
103
111
|
bordered &&
|
|
104
112
|
(layout === 'horizontal'
|
|
105
113
|
? 'w-32 bg-muted/30 px-3 py-2'
|
|
106
|
-
: 'border-b bg-muted/30 px-3 py-2'),
|
|
114
|
+
: 'border-b border-b-border bg-muted/30 px-3 py-2'),
|
|
107
115
|
!bordered && layout === 'horizontal' && 'min-w-24',
|
|
108
116
|
)}
|
|
109
117
|
>
|
|
@@ -111,7 +119,7 @@ const Descriptions = React.forwardRef<HTMLDivElement, DescriptionsProps>(
|
|
|
111
119
|
</div>
|
|
112
120
|
<div
|
|
113
121
|
className={cn(
|
|
114
|
-
|
|
122
|
+
'text-xs',
|
|
115
123
|
bordered ? 'flex-1 px-3 py-2' : 'flex-1',
|
|
116
124
|
)}
|
|
117
125
|
>
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: dialog
|
|
3
3
|
name: Dialog
|
|
4
|
+
displayName: 对话框
|
|
4
5
|
type: component
|
|
5
6
|
category: feedback
|
|
6
7
|
since: 0.1.0
|
|
7
|
-
package:
|
|
8
|
+
package: '@teamix-evo/ui'
|
|
8
9
|
---
|
|
9
10
|
|
|
10
|
-
# Dialog
|
|
11
|
+
# Dialog 对话框
|
|
11
12
|
|
|
12
|
-
模态对话框 — Radix Dialog + antd Modal 并集。**组合式 API**(shadcn 风格,非 antd 的 props 配置式),通过 `DialogHeader` / `DialogFooter` / `DialogTitle` / `DialogDescription`
|
|
13
|
+
模态对话框 — Radix Dialog + antd Modal 并集。**组合式 API**(shadcn 风格,非 antd 的 props 配置式),通过 `DialogHeader` / `DialogFooter` / `DialogTitle` / `DialogDescription` 子组件灵活组装内容。视觉上**圆角 16px**(`--radius-dialog`)、**无 border**(纯白 + shadow 分界)、内置 X 关闭按钮在标题区右侧、`size` 四档绑定 `--layout-dialog-{sm|md|lg|xl}`。
|
|
13
14
|
|
|
14
|
-
> antd 用户对照:`title` → `<DialogTitle>`,`children` → `<DialogContent>`,`footer` → `<DialogFooter>`,`onOk/onCancel` → 自行接 `<DialogClose>`
|
|
15
|
+
> antd 用户对照:`title` → `<DialogTitle>`,`children` → `<DialogContent>`,`footer` → `<DialogFooter>`,`onOk/onCancel` → 自行接 `<DialogClose>` 与回调;`width` → `size` 或 `className` 自定义 `max-w-[...]`。
|
|
15
16
|
|
|
16
17
|
## When to use
|
|
17
18
|
|
|
@@ -27,6 +28,17 @@ package: "@teamix-evo/ui"
|
|
|
27
28
|
- 短暂提示 → `Sonner`(toast)
|
|
28
29
|
- 行内编辑 → `Popover`
|
|
29
30
|
|
|
31
|
+
## Size 档位(token 绑定)
|
|
32
|
+
|
|
33
|
+
| size | token | OpenTrek 基准 | 典型场景 |
|
|
34
|
+
| ---- | -------------------- | ------------- | ------------------------------------ |
|
|
35
|
+
| `sm` | `--layout-dialog-sm` | 400px | 确认 / 单字段输入 / 简短表单 |
|
|
36
|
+
| `md` | `--layout-dialog-md` | 600px | **默认**,常规编辑表单 / 简单详情 |
|
|
37
|
+
| `lg` | `--layout-dialog-lg` | 800px | 复杂表单 / 多 tab / 富文本编辑 |
|
|
38
|
+
| `xl` | `--layout-dialog-xl` | 1200px | 数据预览 / 表格嵌入 / 设计画布等大图 |
|
|
39
|
+
|
|
40
|
+
> 数值是 OpenTrek variant 的基准;其他 variant(如 uni-manager)按自己的 tokens 给值,组件不变。
|
|
41
|
+
|
|
30
42
|
## Props
|
|
31
43
|
|
|
32
44
|
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成。下表是 `DialogContent` 的 props;`Dialog`(Root)透传 Radix `open / defaultOpen / onOpenChange / modal`。
|
|
@@ -34,7 +46,8 @@ package: "@teamix-evo/ui"
|
|
|
34
46
|
<!-- auto:props:begin -->
|
|
35
47
|
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
36
48
|
| --- | --- | --- | --- | --- |
|
|
37
|
-
| `showClose` | `boolean` | `true` | – |
|
|
49
|
+
| `showClose` | `boolean` | `true` | – | 是否在标题区右侧显示默认关闭按钮(antd Modal 默认行为)。 |
|
|
50
|
+
| `size` | `DialogSize` | `"md"` | – | 对话框尺寸 — 绑定 design tokens `--layout-dialog-{sm\|md\|lg\|xl}`。 OpenTrek 基准:sm=400 / md=600 / lg=800 / xl=1200。 |
|
|
38
51
|
<!-- auto:props:end -->
|
|
39
52
|
|
|
40
53
|
## 依赖
|
|
@@ -49,13 +62,14 @@ package: "@teamix-evo/ui"
|
|
|
49
62
|
| Entry | 类型 | 描述 |
|
|
50
63
|
| --- | --- | --- |
|
|
51
64
|
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
65
|
+
| `button` | component | 通用按钮 — shadcn 实现 + cloud-design 能力并集(loading / icon / shape / block / dashed variant / color 语义双 prop / disabledTooltip)。同文件合一导出 ButtonGroup + ButtonGroupText(等价 antd Space.Compact + cd SplitButton)。 |
|
|
52
66
|
|
|
53
67
|
### npm 依赖
|
|
54
68
|
|
|
55
69
|
> 业务侧需要先 `pnpm add` / `npm install` 这些包。CLI 在 `ui add` 完成后会列出此提示。
|
|
56
70
|
|
|
57
71
|
```bash
|
|
58
|
-
pnpm add @radix-ui/react-dialog@^1.1.0 lucide-react@^0.460.0
|
|
72
|
+
pnpm add @radix-ui/react-dialog@^1.1.0 class-variance-authority@^0.7.0 lucide-react@^0.460.0 react-dom@>=18
|
|
59
73
|
```
|
|
60
74
|
<!-- auto:deps:end -->
|
|
61
75
|
|
|
@@ -69,22 +83,31 @@ pnpm add @radix-ui/react-dialog@^1.1.0 lucide-react@^0.460.0
|
|
|
69
83
|
- **`onOpenChange` 关闭后清表单**:用户可能 ESC 关闭,需要清理状态
|
|
70
84
|
- **Footer 主操作右对齐**:遵循 design `principles.md` P3 Predictability(主操作位置一致)
|
|
71
85
|
- **危险动作单独走 `AlertDialog`**:Dialog 不强制二次确认,destructive 场景必须切换组件
|
|
86
|
+
- **`size` 选择**:不要为了"显得大气"一律 `lg`/`xl` — 信息密度匹配档位,过宽内容反而难读;表单场景默认 `md` 即可
|
|
87
|
+
- **不要硬编码圆角 / 宽度**:圆角已绑定 `--radius-dialog`,不要在 `className` 里覆盖 `rounded-*`;宽度优先用 `size`,只有需要锁绝对像素时才用 `className="max-w-[var(--xxx)]"` 形式继续走 tokens
|
|
88
|
+
- **不要画外边框**:`DialogContent` 已 `border-0`,设计上靠 shadow 与背景对比分界,加 `border` 会破坏 OpenTrek 视觉(P3 一致性)
|
|
72
89
|
|
|
73
90
|
## Examples
|
|
74
91
|
|
|
75
92
|
```tsx
|
|
76
93
|
import {
|
|
77
|
-
Dialog,
|
|
78
|
-
|
|
94
|
+
Dialog,
|
|
95
|
+
DialogTrigger,
|
|
96
|
+
DialogContent,
|
|
97
|
+
DialogHeader,
|
|
98
|
+
DialogFooter,
|
|
99
|
+
DialogTitle,
|
|
100
|
+
DialogDescription,
|
|
101
|
+
DialogClose,
|
|
79
102
|
} from '@/components/ui/dialog';
|
|
80
103
|
import { Button } from '@/components/ui/button';
|
|
81
104
|
|
|
82
|
-
//
|
|
105
|
+
// 基础(默认 md = 600px)
|
|
83
106
|
<Dialog>
|
|
84
107
|
<DialogTrigger asChild>
|
|
85
108
|
<Button variant="outline">编辑</Button>
|
|
86
109
|
</DialogTrigger>
|
|
87
|
-
<DialogContent
|
|
110
|
+
<DialogContent>
|
|
88
111
|
<DialogHeader>
|
|
89
112
|
<DialogTitle>编辑资料</DialogTitle>
|
|
90
113
|
<DialogDescription>保存后立即生效。</DialogDescription>
|
|
@@ -97,9 +120,49 @@ import { Button } from '@/components/ui/button';
|
|
|
97
120
|
<Button>保存</Button>
|
|
98
121
|
</DialogFooter>
|
|
99
122
|
</DialogContent>
|
|
100
|
-
</Dialog
|
|
123
|
+
</Dialog>;
|
|
101
124
|
|
|
102
|
-
// 受控
|
|
125
|
+
// 大尺寸 + 受控
|
|
103
126
|
const [open, setOpen] = React.useState(false);
|
|
104
|
-
<Dialog open={open} onOpenChange={setOpen}
|
|
127
|
+
<Dialog open={open} onOpenChange={setOpen}>
|
|
128
|
+
<DialogContent size="xl">{/* ... */}</DialogContent>
|
|
129
|
+
</Dialog>;
|
|
130
|
+
|
|
131
|
+
// 隐藏 X 关闭(强制用户走 Footer 按钮)
|
|
132
|
+
<DialogContent showClose={false}>...</DialogContent>;
|
|
105
133
|
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Dialog 形态 — 旧库 API → 新映射
|
|
138
|
+
|
|
139
|
+
> 旧库 `Dialog`(hybridcloud,含 Dialog.show / Dialog.confirm / Dialog.alert) → 新库 `Dialog`(声明式组合) + `AlertDialog`(确认弹窗)。
|
|
140
|
+
> 新库基于 Radix Dialog Primitive,组合式子组件架构(非配置式 prop)。
|
|
141
|
+
|
|
142
|
+
### 命名 & 结构映射
|
|
143
|
+
|
|
144
|
+
| 旧库 | 新库 | 说明 |
|
|
145
|
+
| ------------------------------------- | ------------------------------------ | ---------------------------- |
|
|
146
|
+
| `Dialog` | `Dialog` + 子组件 | 组合式(非 props 配置式) |
|
|
147
|
+
| `Dialog.confirm()` / `Dialog.alert()` | `AlertDialog` | 声明式替代命令式 |
|
|
148
|
+
| `Dialog.show()` | _(未来 P1: useConfirm hook)_ | MVP 用声明式 + useState 控制 |
|
|
149
|
+
| `visible` | `open` | 受控状态 |
|
|
150
|
+
| `onClose` | `onOpenChange` | 开关回调 |
|
|
151
|
+
| `title` (prop) | `<DialogTitle>` | 子组件组合 |
|
|
152
|
+
| `footer` (prop) | `<DialogFooter>` | 子组件组合 |
|
|
153
|
+
| `size: mini/small/medium/large` | `size: 'sm' \| 'md' \| 'lg' \| 'xl'` | token 驱动宽度 |
|
|
154
|
+
| `closeable / closeMode` | `showClose` + Radix 内建 Esc/点击外 | 简化 |
|
|
155
|
+
| 快捷类型 error/success/warning | _(未来 P2: ConfirmDialog preset)_ | MVP 自行组合 icon + 文案 |
|
|
156
|
+
| `cache` (保留 DOM) | Radix `forceMount` | 已支持 |
|
|
157
|
+
| `hasMask` | 不复刻 | 始终有 overlay(无障碍) |
|
|
158
|
+
| `locale` | 不复刻 | 开发者直接写按钮文案 |
|
|
159
|
+
| `v2/align/minMargin/isFullScreen` | 不复刻 | 旧 v1 遗留 |
|
|
160
|
+
|
|
161
|
+
### 迁移 FAQ
|
|
162
|
+
|
|
163
|
+
| 问题 | 回答 |
|
|
164
|
+
| ------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
165
|
+
| 命令式 Dialog.confirm 怎么替代? | 用 `<AlertDialog>` 声明式 + `open` 受控;或等 P1 useConfirm hook |
|
|
166
|
+
| footer 怎么写? | `<DialogFooter><Button variant="outline">取消</Button><Button>确定</Button></DialogFooter>` |
|
|
167
|
+
| 怎么阻止点击外部关闭? | 用 `<AlertDialog>` 而非 `<Dialog>`;或设 `onInteractOutside={(e) => e.preventDefault()}` |
|
|
168
|
+
| size 对应宽度? | sm=400px, md=600px, lg=800px, xl=1000px(token 变量控制) |
|
|
@@ -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
|
Dialog,
|
|
4
4
|
DialogTrigger,
|
|
@@ -14,50 +14,143 @@ import { Input } from '@/components/input/input';
|
|
|
14
14
|
import { Label } from '@/components/label/label';
|
|
15
15
|
|
|
16
16
|
const meta: Meta<typeof DialogContent> = {
|
|
17
|
-
title: '
|
|
17
|
+
title: '反馈 · Feedback/Dialog',
|
|
18
18
|
component: DialogContent,
|
|
19
19
|
tags: ['autodocs'],
|
|
20
20
|
parameters: {
|
|
21
21
|
docs: {
|
|
22
22
|
description: {
|
|
23
23
|
component:
|
|
24
|
-
'
|
|
24
|
+
'对话框 —— 在不离开当前页的前提下,承载需要用户聚焦完成的任务(表单 / 确认 / 详情查看)。基于 Radix Dialog 内核(自动焦点陷阱、ESC 关闭、`aria-modal`) + 对齐 antd `Modal` 的组合式范式(`DialogHeader` / `DialogFooter` / `DialogTitle` / `DialogDescription`):提供四档 `size`(sm/md/lg/xl)绑定 OpenTrek `--layout-dialog-*` tokens、统一 16px 圆角(`--radius-dialog`)、无 border border-border 设计(纯白 + shadow 分界),以及标题区右侧 X 关闭按钮(`showClose`)。视觉走 OpenTrek semantic tokens,所有样式来自 `@teamix-evo/tokens`,无 mock。',
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
27
|
},
|
|
28
28
|
argTypes: {
|
|
29
|
-
|
|
29
|
+
size: {
|
|
30
|
+
control: 'inline-radio',
|
|
31
|
+
options: ['sm', 'md', 'lg', 'xl'],
|
|
32
|
+
description:
|
|
33
|
+
'对话框宽度档位,绑定 `--layout-dialog-{sm|md|lg|xl}`(OpenTrek 基准 400/600/800/1200px)',
|
|
34
|
+
},
|
|
35
|
+
showClose: {
|
|
36
|
+
control: 'boolean',
|
|
37
|
+
description: '是否在标题区右侧显示默认 X 关闭按钮',
|
|
38
|
+
},
|
|
30
39
|
},
|
|
31
|
-
args: { showClose: true },
|
|
40
|
+
args: { size: 'md', showClose: true },
|
|
32
41
|
};
|
|
33
42
|
|
|
34
43
|
export default meta;
|
|
35
44
|
type Story = StoryObj<typeof DialogContent>;
|
|
36
45
|
|
|
46
|
+
const SampleForm = () => (
|
|
47
|
+
<div className="grid gap-3 py-2">
|
|
48
|
+
<div className="grid grid-cols-4 items-center gap-3">
|
|
49
|
+
<Label htmlFor="name" className="text-right">
|
|
50
|
+
名称
|
|
51
|
+
</Label>
|
|
52
|
+
<Input id="name" defaultValue="lyca" className="col-span-3" />
|
|
53
|
+
</div>
|
|
54
|
+
<div className="grid grid-cols-4 items-center gap-3">
|
|
55
|
+
<Label htmlFor="bio" className="text-right">
|
|
56
|
+
简介
|
|
57
|
+
</Label>
|
|
58
|
+
<Input id="bio" defaultValue="Frontend" className="col-span-3" />
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
|
|
37
63
|
export const Playground: Story = {
|
|
38
64
|
render: (args) => (
|
|
39
65
|
<Dialog>
|
|
40
66
|
<DialogTrigger asChild>
|
|
41
67
|
<Button variant="outline">打开对话框</Button>
|
|
42
68
|
</DialogTrigger>
|
|
43
|
-
<DialogContent {...args}
|
|
69
|
+
<DialogContent {...args}>
|
|
44
70
|
<DialogHeader>
|
|
45
71
|
<DialogTitle>编辑资料</DialogTitle>
|
|
46
72
|
<DialogDescription>保存后立即对所有页面生效。</DialogDescription>
|
|
47
73
|
</DialogHeader>
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
74
|
+
<SampleForm />
|
|
75
|
+
<DialogFooter>
|
|
76
|
+
<DialogClose asChild>
|
|
77
|
+
<Button variant="outline">取消</Button>
|
|
78
|
+
</DialogClose>
|
|
79
|
+
<Button>保存</Button>
|
|
80
|
+
</DialogFooter>
|
|
81
|
+
</DialogContent>
|
|
82
|
+
</Dialog>
|
|
83
|
+
),
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const SizeSmall: Story = {
|
|
87
|
+
name: 'Size · sm (400px)',
|
|
88
|
+
parameters: { controls: { disable: true } },
|
|
89
|
+
render: () => (
|
|
90
|
+
<Dialog>
|
|
91
|
+
<DialogTrigger asChild>
|
|
92
|
+
<Button variant="outline">sm — 400px</Button>
|
|
93
|
+
</DialogTrigger>
|
|
94
|
+
<DialogContent size="sm">
|
|
95
|
+
<DialogHeader>
|
|
96
|
+
<DialogTitle>添加标签</DialogTitle>
|
|
97
|
+
<DialogDescription>简短确认 / 单字段输入场景。</DialogDescription>
|
|
98
|
+
</DialogHeader>
|
|
99
|
+
<Input placeholder="输入标签名" />
|
|
100
|
+
<DialogFooter>
|
|
101
|
+
<DialogClose asChild>
|
|
102
|
+
<Button variant="outline">取消</Button>
|
|
103
|
+
</DialogClose>
|
|
104
|
+
<Button>添加</Button>
|
|
105
|
+
</DialogFooter>
|
|
106
|
+
</DialogContent>
|
|
107
|
+
</Dialog>
|
|
108
|
+
),
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const SizeMedium: Story = {
|
|
112
|
+
name: 'Size · md (600px,默认)',
|
|
113
|
+
parameters: { controls: { disable: true } },
|
|
114
|
+
render: () => (
|
|
115
|
+
<Dialog>
|
|
116
|
+
<DialogTrigger asChild>
|
|
117
|
+
<Button variant="outline">md — 600px</Button>
|
|
118
|
+
</DialogTrigger>
|
|
119
|
+
<DialogContent>
|
|
120
|
+
<DialogHeader>
|
|
121
|
+
<DialogTitle>编辑资料</DialogTitle>
|
|
122
|
+
<DialogDescription>常规编辑表单 / 简单详情。</DialogDescription>
|
|
123
|
+
</DialogHeader>
|
|
124
|
+
<SampleForm />
|
|
125
|
+
<DialogFooter>
|
|
126
|
+
<DialogClose asChild>
|
|
127
|
+
<Button variant="outline">取消</Button>
|
|
128
|
+
</DialogClose>
|
|
129
|
+
<Button>保存</Button>
|
|
130
|
+
</DialogFooter>
|
|
131
|
+
</DialogContent>
|
|
132
|
+
</Dialog>
|
|
133
|
+
),
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export const SizeLarge: Story = {
|
|
137
|
+
name: 'Size · lg (800px)',
|
|
138
|
+
parameters: { controls: { disable: true } },
|
|
139
|
+
render: () => (
|
|
140
|
+
<Dialog>
|
|
141
|
+
<DialogTrigger asChild>
|
|
142
|
+
<Button variant="outline">lg — 800px</Button>
|
|
143
|
+
</DialogTrigger>
|
|
144
|
+
<DialogContent size="lg">
|
|
145
|
+
<DialogHeader>
|
|
146
|
+
<DialogTitle>批量编辑</DialogTitle>
|
|
147
|
+
<DialogDescription>
|
|
148
|
+
复杂表单 / 多 tab / 富文本编辑;800px 提供更舒展的列布局。
|
|
149
|
+
</DialogDescription>
|
|
150
|
+
</DialogHeader>
|
|
151
|
+
<div className="grid grid-cols-2 gap-4 py-2">
|
|
152
|
+
<SampleForm />
|
|
153
|
+
<SampleForm />
|
|
61
154
|
</div>
|
|
62
155
|
<DialogFooter>
|
|
63
156
|
<DialogClose asChild>
|
|
@@ -70,7 +163,37 @@ export const Playground: Story = {
|
|
|
70
163
|
),
|
|
71
164
|
};
|
|
72
165
|
|
|
166
|
+
export const SizeXLarge: Story = {
|
|
167
|
+
name: 'Size · xl (1200px)',
|
|
168
|
+
parameters: { controls: { disable: true } },
|
|
169
|
+
render: () => (
|
|
170
|
+
<Dialog>
|
|
171
|
+
<DialogTrigger asChild>
|
|
172
|
+
<Button variant="outline">xl — 1200px</Button>
|
|
173
|
+
</DialogTrigger>
|
|
174
|
+
<DialogContent size="xl">
|
|
175
|
+
<DialogHeader>
|
|
176
|
+
<DialogTitle>数据预览</DialogTitle>
|
|
177
|
+
<DialogDescription>
|
|
178
|
+
数据预览 / 表格嵌入 / 设计画布等需大画幅的场景。
|
|
179
|
+
</DialogDescription>
|
|
180
|
+
</DialogHeader>
|
|
181
|
+
<div className="grid h-64 place-items-center rounded-md bg-muted text-sm text-muted-foreground">
|
|
182
|
+
1200px 宽 · 业务画布占位
|
|
183
|
+
</div>
|
|
184
|
+
<DialogFooter>
|
|
185
|
+
<DialogClose asChild>
|
|
186
|
+
<Button variant="outline">关闭</Button>
|
|
187
|
+
</DialogClose>
|
|
188
|
+
<Button>导出</Button>
|
|
189
|
+
</DialogFooter>
|
|
190
|
+
</DialogContent>
|
|
191
|
+
</Dialog>
|
|
192
|
+
),
|
|
193
|
+
};
|
|
194
|
+
|
|
73
195
|
export const NoCloseButton: Story = {
|
|
196
|
+
name: '隐藏 X 关闭(showClose=false)',
|
|
74
197
|
parameters: { controls: { disable: true } },
|
|
75
198
|
render: () => (
|
|
76
199
|
<Dialog>
|
|
@@ -80,7 +203,9 @@ export const NoCloseButton: Story = {
|
|
|
80
203
|
<DialogContent showClose={false}>
|
|
81
204
|
<DialogHeader>
|
|
82
205
|
<DialogTitle>必须选择操作</DialogTitle>
|
|
83
|
-
<DialogDescription
|
|
206
|
+
<DialogDescription>
|
|
207
|
+
隐藏 X 后,用户只能通过 Footer 按钮关闭(避免误关重要决策)。
|
|
208
|
+
</DialogDescription>
|
|
84
209
|
</DialogHeader>
|
|
85
210
|
<DialogFooter>
|
|
86
211
|
<DialogClose asChild>
|
|
@@ -91,3 +216,40 @@ export const NoCloseButton: Story = {
|
|
|
91
216
|
</Dialog>
|
|
92
217
|
),
|
|
93
218
|
};
|
|
219
|
+
|
|
220
|
+
export const BorderlessShowcase: Story = {
|
|
221
|
+
name: '无 border border-border · 纯白 + shadow 分界',
|
|
222
|
+
parameters: {
|
|
223
|
+
controls: { disable: true },
|
|
224
|
+
docs: {
|
|
225
|
+
description: {
|
|
226
|
+
story:
|
|
227
|
+
'`DialogContent` 已 `border-0`,视觉分界完全依赖 shadow 与 overlay 的明度对比;16px 圆角(`--radius-dialog`)给整体一个柔和的"卡片漂浮"感。请不要在 `className` 里加 `border *` 或覆盖 `rounded-*`。',
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
render: () => (
|
|
232
|
+
<Dialog>
|
|
233
|
+
<DialogTrigger asChild>
|
|
234
|
+
<Button>打开示例</Button>
|
|
235
|
+
</DialogTrigger>
|
|
236
|
+
<DialogContent>
|
|
237
|
+
<DialogHeader>
|
|
238
|
+
<DialogTitle>无 border / 16px 圆角</DialogTitle>
|
|
239
|
+
<DialogDescription>
|
|
240
|
+
纯白背景 + shadow 形成视觉分界,16px 圆角统一全站 dialog 类容器观感。
|
|
241
|
+
</DialogDescription>
|
|
242
|
+
</DialogHeader>
|
|
243
|
+
<p className="text-sm text-muted-foreground">
|
|
244
|
+
切换 Storybook toolbar 上的主题变体,可以看到不同 variant 下 token
|
|
245
|
+
实际值(uni-manager 与 opentrek 圆角一致 16px,但宽度档位可能不同)。
|
|
246
|
+
</p>
|
|
247
|
+
<DialogFooter>
|
|
248
|
+
<DialogClose asChild>
|
|
249
|
+
<Button variant="outline">关闭</Button>
|
|
250
|
+
</DialogClose>
|
|
251
|
+
</DialogFooter>
|
|
252
|
+
</DialogContent>
|
|
253
|
+
</Dialog>
|
|
254
|
+
),
|
|
255
|
+
};
|