@teamix-evo/ui 0.2.0 → 0.4.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 +695 -487
- package/package.json +16 -10
- 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 +341 -35
- 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 +147 -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 +439 -89
- package/src/components/checkbox/checkbox.meta.md +74 -24
- package/src/components/checkbox/checkbox.stories.tsx +160 -2
- package/src/components/checkbox/checkbox.tsx +79 -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 +1086 -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 +354 -4
- 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/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 +45 -10
- 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 +81 -22
- 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 +2 -2
- 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 +210 -0
- package/src/components/page-header/page-header.stories.tsx +428 -0
- package/src/components/page-header/page-header.tsx +284 -0
- package/src/components/page-shell/page-shell.meta.md +116 -0
- package/src/components/page-shell/page-shell.stories.tsx +149 -0
- package/src/components/page-shell/page-shell.tsx +115 -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 +345 -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 +16 -8
- 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 +29 -38
- package/src/components/sidebar/sidebar.stories.tsx +696 -29
- package/src/components/sidebar/sidebar.tsx +643 -141
- 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 +8 -6
- 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 +57 -0
- package/src/components/button/demo/as-child.tsx +0 -24
- package/src/components/button/demo/basic.tsx +0 -8
- package/src/components/button/demo/block.tsx +0 -16
- package/src/components/button/demo/loading.tsx +0 -19
- package/src/components/button/demo/shapes.tsx +0 -18
- package/src/components/button/demo/sizes.tsx +0 -19
- package/src/components/button/demo/variants.tsx +0 -19
- package/src/components/button/demo/with-icon.tsx +0 -20
- 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/basic.tsx +0 -12
- package/src/components/input/demo/clearable.tsx +0 -21
- package/src/components/input/demo/show-count.tsx +0 -18
- package/src/components/input/demo/sizes.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
|
@@ -6,16 +6,36 @@ import {
|
|
|
6
6
|
ChevronsRight,
|
|
7
7
|
MoreHorizontal,
|
|
8
8
|
} from 'lucide-react';
|
|
9
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
9
10
|
|
|
10
11
|
import { cn } from '@/utils/cn';
|
|
11
12
|
import { Button, type ButtonProps } from '@/components/button/button';
|
|
13
|
+
import { Input } from '@/components/input/input';
|
|
14
|
+
import { Select } from '@/components/select/select';
|
|
15
|
+
|
|
16
|
+
// ─── 尺寸映射 — 对齐 Button/Input 的 h-7 / h-8 / h-9 三档 ──────────────────────
|
|
17
|
+
|
|
18
|
+
export type PaginationSize = 'sm' | 'md' | 'lg';
|
|
19
|
+
export type PaginationType = 'normal' | 'simple' | 'mini';
|
|
20
|
+
|
|
21
|
+
const sizeClass: Record<PaginationSize, string> = {
|
|
22
|
+
sm: 'text-xs',
|
|
23
|
+
md: 'text-xs',
|
|
24
|
+
lg: 'text-sm',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const minWClass: Record<PaginationSize, string> = {
|
|
28
|
+
// sm 28px — 对齐 --button-sm-height
|
|
29
|
+
sm: 'min-w-[var(--button-sm-height)]',
|
|
30
|
+
// md 32px — 对齐 OpenTrek v4.1 --pagination-button-size
|
|
31
|
+
md: 'min-w-[var(--pagination-button-size)]',
|
|
32
|
+
// lg 36px — 仅 lg 档使用,保留 utility(无业务 token 对应)
|
|
33
|
+
lg: 'min-w-9',
|
|
34
|
+
};
|
|
12
35
|
|
|
13
36
|
// ─── shadcn-style primitives ──────────────────────────────────────────────────
|
|
14
37
|
|
|
15
|
-
const Pagination = ({
|
|
16
|
-
className,
|
|
17
|
-
...props
|
|
18
|
-
}: React.ComponentProps<'nav'>) => (
|
|
38
|
+
const Pagination = ({ className, ...props }: React.ComponentProps<'nav'>) => (
|
|
19
39
|
<nav
|
|
20
40
|
role="navigation"
|
|
21
41
|
aria-label="pagination"
|
|
@@ -46,92 +66,189 @@ const PaginationItem = React.forwardRef<
|
|
|
46
66
|
PaginationItem.displayName = 'PaginationItem';
|
|
47
67
|
|
|
48
68
|
interface PaginationLinkProps
|
|
49
|
-
extends
|
|
50
|
-
|
|
69
|
+
extends Omit<ButtonProps, 'size' | 'variant' | 'shape'> {
|
|
70
|
+
/** 当前激活状态(高亮选中页)。 */
|
|
51
71
|
isActive?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* 尺寸,对齐 Button/Input 三档。
|
|
74
|
+
* @default "md"
|
|
75
|
+
*/
|
|
76
|
+
size?: PaginationSize;
|
|
52
77
|
}
|
|
53
78
|
|
|
54
79
|
const PaginationLink = ({
|
|
55
80
|
className,
|
|
56
81
|
isActive,
|
|
57
|
-
size = '
|
|
82
|
+
size = 'md',
|
|
58
83
|
...props
|
|
59
84
|
}: PaginationLinkProps) => (
|
|
60
85
|
<Button
|
|
61
86
|
aria-current={isActive ? 'page' : undefined}
|
|
62
87
|
variant={isActive ? 'outline' : 'ghost'}
|
|
63
88
|
size={size}
|
|
64
|
-
className={cn(
|
|
89
|
+
className={cn(
|
|
90
|
+
// 让数字键看起来近似方块,最小宽度 = 高度
|
|
91
|
+
minWClass[size],
|
|
92
|
+
// 数字键以 padding 收紧(等宽数字)
|
|
93
|
+
'tabular-nums',
|
|
94
|
+
isActive && 'border-primary text-primary',
|
|
95
|
+
className,
|
|
96
|
+
)}
|
|
65
97
|
{...props}
|
|
66
98
|
/>
|
|
67
99
|
);
|
|
68
100
|
PaginationLink.displayName = 'PaginationLink';
|
|
69
101
|
|
|
102
|
+
interface PaginationNavProps extends Omit<PaginationLinkProps, 'isActive'> {
|
|
103
|
+
/**
|
|
104
|
+
* 仅显示图标(不显示「上一页 / 下一页」文字),用于 mini 与图标条形态。
|
|
105
|
+
* @default false
|
|
106
|
+
*/
|
|
107
|
+
iconOnly?: boolean;
|
|
108
|
+
}
|
|
109
|
+
|
|
70
110
|
const PaginationPrevious = ({
|
|
71
111
|
className,
|
|
112
|
+
size = 'md',
|
|
113
|
+
iconOnly = false,
|
|
114
|
+
children,
|
|
72
115
|
...props
|
|
73
|
-
}:
|
|
116
|
+
}: PaginationNavProps) => (
|
|
74
117
|
<PaginationLink
|
|
75
118
|
aria-label="Go to previous page"
|
|
76
|
-
size=
|
|
77
|
-
className={cn('gap-1
|
|
119
|
+
size={size}
|
|
120
|
+
className={cn(iconOnly ? 'aspect-square px-0' : 'gap-1 px-2.5', className)}
|
|
78
121
|
{...props}
|
|
79
122
|
>
|
|
80
123
|
<ChevronLeft className="size-4" />
|
|
81
|
-
<span>上一页</span>
|
|
124
|
+
{!iconOnly && (children ?? <span>上一页</span>)}
|
|
82
125
|
</PaginationLink>
|
|
83
126
|
);
|
|
84
127
|
PaginationPrevious.displayName = 'PaginationPrevious';
|
|
85
128
|
|
|
86
129
|
const PaginationNext = ({
|
|
87
130
|
className,
|
|
131
|
+
size = 'md',
|
|
132
|
+
iconOnly = false,
|
|
133
|
+
children,
|
|
88
134
|
...props
|
|
89
|
-
}:
|
|
135
|
+
}: PaginationNavProps) => (
|
|
90
136
|
<PaginationLink
|
|
91
137
|
aria-label="Go to next page"
|
|
92
|
-
size=
|
|
93
|
-
className={cn('gap-1
|
|
138
|
+
size={size}
|
|
139
|
+
className={cn(iconOnly ? 'aspect-square px-0' : 'gap-1 px-2.5', className)}
|
|
94
140
|
{...props}
|
|
95
141
|
>
|
|
96
|
-
<span>下一页</span>
|
|
142
|
+
{!iconOnly && (children ?? <span>下一页</span>)}
|
|
97
143
|
<ChevronRight className="size-4" />
|
|
98
144
|
</PaginationLink>
|
|
99
145
|
);
|
|
100
146
|
PaginationNext.displayName = 'PaginationNext';
|
|
101
147
|
|
|
148
|
+
const ellipsisVariants = cva(
|
|
149
|
+
'flex items-center justify-center text-muted-foreground',
|
|
150
|
+
{
|
|
151
|
+
variants: {
|
|
152
|
+
size: {
|
|
153
|
+
sm: 'h-7 w-7 [&_svg]:size-3.5',
|
|
154
|
+
md: 'h-8 w-8 [&_svg]:size-4',
|
|
155
|
+
lg: 'h-9 w-9 [&_svg]:size-4',
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
defaultVariants: { size: 'md' },
|
|
159
|
+
},
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
interface PaginationEllipsisProps
|
|
163
|
+
extends React.ComponentProps<'span'>,
|
|
164
|
+
VariantProps<typeof ellipsisVariants> {}
|
|
165
|
+
|
|
102
166
|
const PaginationEllipsis = ({
|
|
103
167
|
className,
|
|
168
|
+
size,
|
|
104
169
|
...props
|
|
105
|
-
}:
|
|
170
|
+
}: PaginationEllipsisProps) => (
|
|
106
171
|
<span
|
|
107
172
|
aria-hidden="true"
|
|
108
|
-
className={cn(
|
|
173
|
+
className={cn(ellipsisVariants({ size }), className)}
|
|
109
174
|
{...props}
|
|
110
175
|
>
|
|
111
|
-
<MoreHorizontal
|
|
176
|
+
<MoreHorizontal />
|
|
112
177
|
<span className="sr-only">More pages</span>
|
|
113
178
|
</span>
|
|
114
179
|
);
|
|
115
180
|
PaginationEllipsis.displayName = 'PaginationEllipsis';
|
|
116
181
|
|
|
117
|
-
// ───
|
|
182
|
+
// ─── 高阶 SimplePagination — antd 风格 props 化 ───────────────────────────────
|
|
118
183
|
|
|
119
184
|
export interface SimplePaginationProps {
|
|
120
|
-
/**
|
|
185
|
+
/**
|
|
186
|
+
* 当前页(1-based,受控)。与 `defaultCurrent` 互斥。
|
|
187
|
+
*/
|
|
121
188
|
current?: number;
|
|
122
|
-
/**
|
|
123
|
-
|
|
189
|
+
/**
|
|
190
|
+
* 默认当前页(非受控)。
|
|
191
|
+
* @default 1
|
|
192
|
+
*/
|
|
193
|
+
defaultCurrent?: number;
|
|
194
|
+
/**
|
|
195
|
+
* 页码 / pageSize 变化回调。第二参为变化后的 pageSize。
|
|
196
|
+
*/
|
|
197
|
+
onChange?: (page: number, pageSize: number) => void;
|
|
124
198
|
/** 总条数。 */
|
|
125
199
|
total: number;
|
|
126
|
-
/**
|
|
200
|
+
/**
|
|
201
|
+
* 每页大小(受控)。与 `defaultPageSize` 互斥。
|
|
202
|
+
*/
|
|
127
203
|
pageSize?: number;
|
|
128
|
-
/**
|
|
204
|
+
/**
|
|
205
|
+
* 默认每页大小(非受控)。
|
|
206
|
+
* @default 10
|
|
207
|
+
*/
|
|
208
|
+
defaultPageSize?: number;
|
|
209
|
+
/**
|
|
210
|
+
* 每页大小可选项(用于 `pageSizeSelector`)。
|
|
211
|
+
* @default [10, 20, 50, 100]
|
|
212
|
+
*/
|
|
213
|
+
pageSizeList?: number[];
|
|
214
|
+
/**
|
|
215
|
+
* 显示每页大小选择器(对齐 antd `showSizeChanger` / cloud-design `pageSizeSelector`)。
|
|
216
|
+
* @default false
|
|
217
|
+
*/
|
|
218
|
+
pageSizeSelector?: boolean;
|
|
219
|
+
/** pageSize 变化回调。 */
|
|
220
|
+
onPageSizeChange?: (pageSize: number) => void;
|
|
221
|
+
/**
|
|
222
|
+
* 组件大小,对齐 Button / Input 的 sm(h-7) / md(h-8) / lg(h-9) 三档。
|
|
223
|
+
* @default "md"
|
|
224
|
+
*/
|
|
225
|
+
size?: PaginationSize;
|
|
226
|
+
/**
|
|
227
|
+
* 组件类型 — `normal` 完整 / `simple` 简化(prev + 页码/总页 + next) / `mini` 极简(仅前后箭头)。
|
|
228
|
+
* @default "normal"
|
|
229
|
+
*/
|
|
230
|
+
type?: PaginationType;
|
|
231
|
+
/**
|
|
232
|
+
* `normal` 类型下,显示首末页快捷按钮。
|
|
233
|
+
* @default false
|
|
234
|
+
*/
|
|
129
235
|
showFirstLast?: boolean;
|
|
130
|
-
/**
|
|
236
|
+
/**
|
|
237
|
+
* 显示总数文本(`mini` 类型默认不显示)。
|
|
238
|
+
* @default true
|
|
239
|
+
*/
|
|
131
240
|
showTotal?: boolean;
|
|
132
|
-
/**
|
|
241
|
+
/** 自定义总数渲染。 */
|
|
133
242
|
totalRender?: (total: number, range: [number, number]) => React.ReactNode;
|
|
134
|
-
/**
|
|
243
|
+
/**
|
|
244
|
+
* `normal` 类型下,显示跳转输入框。
|
|
245
|
+
* @default false
|
|
246
|
+
*/
|
|
247
|
+
showJump?: boolean;
|
|
248
|
+
/**
|
|
249
|
+
* 中间显示几个页号。建议奇数。
|
|
250
|
+
* @default 5
|
|
251
|
+
*/
|
|
135
252
|
siblingCount?: number;
|
|
136
253
|
/** 容器 className。 */
|
|
137
254
|
className?: string;
|
|
@@ -139,25 +256,62 @@ export interface SimplePaginationProps {
|
|
|
139
256
|
|
|
140
257
|
/**
|
|
141
258
|
* 高阶 Pagination — antd 风格 `total / pageSize / current / onChange` props 化用法,
|
|
142
|
-
* 自动计算页码窗口 + 折叠 ellipsis
|
|
259
|
+
* 自动计算页码窗口 + 折叠 ellipsis,并支持 `size` / `type` / `pageSizeSelector` 三档语义化扩展。
|
|
143
260
|
*
|
|
144
261
|
* 内部组合 `Pagination / PaginationContent / PaginationItem / PaginationLink /
|
|
145
262
|
* PaginationPrevious / PaginationNext / PaginationEllipsis` 这套 shadcn primitives,
|
|
146
263
|
* 业务方需要更细粒度时直接使用 primitives 自行拼装。
|
|
147
264
|
*/
|
|
148
265
|
const SimplePagination = ({
|
|
149
|
-
current
|
|
266
|
+
current,
|
|
267
|
+
defaultCurrent = 1,
|
|
150
268
|
onChange,
|
|
151
269
|
total,
|
|
152
|
-
pageSize
|
|
270
|
+
pageSize,
|
|
271
|
+
defaultPageSize = 10,
|
|
272
|
+
pageSizeList = [10, 20, 50, 100],
|
|
273
|
+
pageSizeSelector = false,
|
|
274
|
+
onPageSizeChange,
|
|
275
|
+
size = 'md',
|
|
276
|
+
type = 'normal',
|
|
153
277
|
showFirstLast = false,
|
|
154
278
|
showTotal = true,
|
|
155
279
|
totalRender,
|
|
280
|
+
showJump = false,
|
|
156
281
|
siblingCount = 5,
|
|
157
282
|
className,
|
|
158
283
|
}: SimplePaginationProps) => {
|
|
159
|
-
const
|
|
160
|
-
const
|
|
284
|
+
const [innerCurrent, setInnerCurrent] = React.useState(defaultCurrent);
|
|
285
|
+
const [innerPageSize, setInnerPageSize] = React.useState(defaultPageSize);
|
|
286
|
+
|
|
287
|
+
const finalCurrent = current ?? innerCurrent;
|
|
288
|
+
const finalPageSize = pageSize ?? innerPageSize;
|
|
289
|
+
const totalPages = Math.max(1, Math.ceil(total / finalPageSize));
|
|
290
|
+
const page = Math.min(Math.max(1, finalCurrent), totalPages);
|
|
291
|
+
|
|
292
|
+
const goto = (n: number) => {
|
|
293
|
+
if (n < 1 || n > totalPages || n === page) return;
|
|
294
|
+
if (current === undefined) setInnerCurrent(n);
|
|
295
|
+
onChange?.(n, finalPageSize);
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
const handlePageSizeChange = (value: string | string[]) => {
|
|
299
|
+
const raw = Array.isArray(value) ? value[0] : value;
|
|
300
|
+
const v = Number(raw);
|
|
301
|
+
if (Number.isNaN(v)) return;
|
|
302
|
+
if (pageSize === undefined) setInnerPageSize(v);
|
|
303
|
+
if (current === undefined) setInnerCurrent(1);
|
|
304
|
+
onPageSizeChange?.(v);
|
|
305
|
+
onChange?.(1, v);
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
const [jumperVal, setJumperVal] = React.useState('');
|
|
309
|
+
const handleJumpKey = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
|
310
|
+
if (e.key !== 'Enter') return;
|
|
311
|
+
const v = Number(jumperVal);
|
|
312
|
+
if (Number.isFinite(v)) goto(v);
|
|
313
|
+
setJumperVal('');
|
|
314
|
+
};
|
|
161
315
|
|
|
162
316
|
const pages = React.useMemo(() => {
|
|
163
317
|
const half = Math.floor(siblingCount / 2);
|
|
@@ -171,39 +325,106 @@ const SimplePagination = ({
|
|
|
171
325
|
return arr;
|
|
172
326
|
}, [page, siblingCount, totalPages]);
|
|
173
327
|
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
onChange?.(n);
|
|
177
|
-
};
|
|
328
|
+
const rangeStart = total === 0 ? 0 : (page - 1) * finalPageSize + 1;
|
|
329
|
+
const rangeEnd = Math.min(page * finalPageSize, total);
|
|
178
330
|
|
|
179
|
-
const
|
|
180
|
-
const
|
|
331
|
+
const showLeftEllipsis = (pages[0] ?? 1) > 2;
|
|
332
|
+
const showRightEllipsis =
|
|
333
|
+
(pages[pages.length - 1] ?? totalPages) < totalPages - 1;
|
|
181
334
|
|
|
182
|
-
|
|
183
|
-
const
|
|
335
|
+
// ─── 总数文本(mini 类型默认隐藏)─────────────────────────────────────────
|
|
336
|
+
const totalNode =
|
|
337
|
+
showTotal && type !== 'mini' ? (
|
|
338
|
+
<p className={cn('text-muted-foreground tabular-nums', sizeClass[size])}>
|
|
339
|
+
{totalRender
|
|
340
|
+
? totalRender(total, [rangeStart, rangeEnd])
|
|
341
|
+
: `共 ${total} 条 · 第 ${rangeStart}-${rangeEnd} 条`}
|
|
342
|
+
</p>
|
|
343
|
+
) : (
|
|
344
|
+
<span />
|
|
345
|
+
);
|
|
184
346
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
347
|
+
// ─── 主体内容 ────────────────────────────────────────────────────────────
|
|
348
|
+
let body: React.ReactNode;
|
|
349
|
+
|
|
350
|
+
if (type === 'mini') {
|
|
351
|
+
body = (
|
|
352
|
+
<Pagination className="mx-0 w-auto">
|
|
353
|
+
<PaginationContent>
|
|
354
|
+
<PaginationItem>
|
|
355
|
+
<PaginationPrevious
|
|
356
|
+
size={size}
|
|
357
|
+
iconOnly
|
|
358
|
+
disabled={page === 1}
|
|
359
|
+
onClick={() => goto(page - 1)}
|
|
360
|
+
/>
|
|
361
|
+
</PaginationItem>
|
|
362
|
+
<PaginationItem>
|
|
363
|
+
<span
|
|
364
|
+
className={cn(
|
|
365
|
+
'px-2 tabular-nums text-muted-foreground',
|
|
366
|
+
sizeClass[size],
|
|
367
|
+
)}
|
|
368
|
+
>
|
|
369
|
+
{page} / {totalPages}
|
|
370
|
+
</span>
|
|
371
|
+
</PaginationItem>
|
|
372
|
+
<PaginationItem>
|
|
373
|
+
<PaginationNext
|
|
374
|
+
size={size}
|
|
375
|
+
iconOnly
|
|
376
|
+
disabled={page === totalPages}
|
|
377
|
+
onClick={() => goto(page + 1)}
|
|
378
|
+
/>
|
|
379
|
+
</PaginationItem>
|
|
380
|
+
</PaginationContent>
|
|
381
|
+
</Pagination>
|
|
382
|
+
);
|
|
383
|
+
} else if (type === 'simple') {
|
|
384
|
+
body = (
|
|
385
|
+
<Pagination className="mx-0 w-auto">
|
|
386
|
+
<PaginationContent>
|
|
387
|
+
<PaginationItem>
|
|
388
|
+
<PaginationPrevious
|
|
389
|
+
size={size}
|
|
390
|
+
iconOnly
|
|
391
|
+
disabled={page === 1}
|
|
392
|
+
onClick={() => goto(page - 1)}
|
|
393
|
+
/>
|
|
394
|
+
</PaginationItem>
|
|
395
|
+
<PaginationItem>
|
|
396
|
+
<span
|
|
397
|
+
className={cn(
|
|
398
|
+
'flex items-center gap-1 px-2 tabular-nums',
|
|
399
|
+
sizeClass[size],
|
|
400
|
+
)}
|
|
401
|
+
>
|
|
402
|
+
<strong className="text-foreground">{page}</strong>
|
|
403
|
+
<span className="text-muted-foreground">/</span>
|
|
404
|
+
<span className="text-muted-foreground">{totalPages}</span>
|
|
405
|
+
</span>
|
|
406
|
+
</PaginationItem>
|
|
407
|
+
<PaginationItem>
|
|
408
|
+
<PaginationNext
|
|
409
|
+
size={size}
|
|
410
|
+
iconOnly
|
|
411
|
+
disabled={page === totalPages}
|
|
412
|
+
onClick={() => goto(page + 1)}
|
|
413
|
+
/>
|
|
414
|
+
</PaginationItem>
|
|
415
|
+
</PaginationContent>
|
|
416
|
+
</Pagination>
|
|
417
|
+
);
|
|
418
|
+
} else {
|
|
419
|
+
body = (
|
|
201
420
|
<Pagination className="mx-0 w-auto">
|
|
202
421
|
<PaginationContent>
|
|
203
422
|
{showFirstLast ? (
|
|
204
423
|
<PaginationItem>
|
|
205
424
|
<PaginationLink
|
|
206
425
|
aria-label="First"
|
|
426
|
+
size={size}
|
|
427
|
+
className="aspect-square px-0"
|
|
207
428
|
disabled={page === 1}
|
|
208
429
|
onClick={() => goto(1)}
|
|
209
430
|
>
|
|
@@ -213,23 +434,28 @@ const SimplePagination = ({
|
|
|
213
434
|
) : null}
|
|
214
435
|
<PaginationItem>
|
|
215
436
|
<PaginationPrevious
|
|
437
|
+
size={size}
|
|
438
|
+
iconOnly
|
|
216
439
|
disabled={page === 1}
|
|
217
440
|
onClick={() => goto(page - 1)}
|
|
218
441
|
/>
|
|
219
442
|
</PaginationItem>
|
|
220
|
-
{pages[0]
|
|
443
|
+
{(pages[0] ?? 1) > 1 ? (
|
|
221
444
|
<PaginationItem>
|
|
222
|
-
<PaginationLink onClick={() => goto(1)}>
|
|
445
|
+
<PaginationLink size={size} onClick={() => goto(1)}>
|
|
446
|
+
1
|
|
447
|
+
</PaginationLink>
|
|
223
448
|
</PaginationItem>
|
|
224
449
|
) : null}
|
|
225
450
|
{showLeftEllipsis ? (
|
|
226
451
|
<PaginationItem>
|
|
227
|
-
<PaginationEllipsis />
|
|
452
|
+
<PaginationEllipsis size={size} />
|
|
228
453
|
</PaginationItem>
|
|
229
454
|
) : null}
|
|
230
455
|
{pages.map((p) => (
|
|
231
456
|
<PaginationItem key={p}>
|
|
232
457
|
<PaginationLink
|
|
458
|
+
size={size}
|
|
233
459
|
isActive={p === page}
|
|
234
460
|
onClick={() => goto(p)}
|
|
235
461
|
>
|
|
@@ -239,18 +465,20 @@ const SimplePagination = ({
|
|
|
239
465
|
))}
|
|
240
466
|
{showRightEllipsis ? (
|
|
241
467
|
<PaginationItem>
|
|
242
|
-
<PaginationEllipsis />
|
|
468
|
+
<PaginationEllipsis size={size} />
|
|
243
469
|
</PaginationItem>
|
|
244
470
|
) : null}
|
|
245
|
-
{pages[pages.length - 1]
|
|
471
|
+
{(pages[pages.length - 1] ?? totalPages) < totalPages ? (
|
|
246
472
|
<PaginationItem>
|
|
247
|
-
<PaginationLink onClick={() => goto(totalPages)}>
|
|
473
|
+
<PaginationLink size={size} onClick={() => goto(totalPages)}>
|
|
248
474
|
{totalPages}
|
|
249
475
|
</PaginationLink>
|
|
250
476
|
</PaginationItem>
|
|
251
477
|
) : null}
|
|
252
478
|
<PaginationItem>
|
|
253
479
|
<PaginationNext
|
|
480
|
+
size={size}
|
|
481
|
+
iconOnly
|
|
254
482
|
disabled={page === totalPages}
|
|
255
483
|
onClick={() => goto(page + 1)}
|
|
256
484
|
/>
|
|
@@ -259,6 +487,8 @@ const SimplePagination = ({
|
|
|
259
487
|
<PaginationItem>
|
|
260
488
|
<PaginationLink
|
|
261
489
|
aria-label="Last"
|
|
490
|
+
size={size}
|
|
491
|
+
className="aspect-square px-0"
|
|
262
492
|
disabled={page === totalPages}
|
|
263
493
|
onClick={() => goto(totalPages)}
|
|
264
494
|
>
|
|
@@ -268,6 +498,58 @@ const SimplePagination = ({
|
|
|
268
498
|
) : null}
|
|
269
499
|
</PaginationContent>
|
|
270
500
|
</Pagination>
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
// ─── 附加 — pageSize 选择器 / 跳转(仅 normal)─────────────────────────────
|
|
505
|
+
const showAddons = type === 'normal' && (pageSizeSelector || showJump);
|
|
506
|
+
|
|
507
|
+
const selectSize = size === 'lg' ? 'lg' : size === 'sm' ? 'sm' : 'md';
|
|
508
|
+
|
|
509
|
+
const addons = showAddons ? (
|
|
510
|
+
<div className={cn('flex items-center gap-2', sizeClass[size])}>
|
|
511
|
+
{pageSizeSelector ? (
|
|
512
|
+
<Select
|
|
513
|
+
aria-label="每页显示"
|
|
514
|
+
size={selectSize}
|
|
515
|
+
value={String(finalPageSize)}
|
|
516
|
+
onChange={handlePageSizeChange}
|
|
517
|
+
options={pageSizeList.map((opt) => ({
|
|
518
|
+
label: `${opt} 条/页`,
|
|
519
|
+
value: String(opt),
|
|
520
|
+
}))}
|
|
521
|
+
/>
|
|
522
|
+
) : null}
|
|
523
|
+
{showJump ? (
|
|
524
|
+
<span className="inline-flex items-center gap-1 text-muted-foreground">
|
|
525
|
+
前往
|
|
526
|
+
<Input
|
|
527
|
+
size={selectSize}
|
|
528
|
+
inputMode="numeric"
|
|
529
|
+
value={jumperVal}
|
|
530
|
+
onChange={(e) => setJumperVal(e.target.value)}
|
|
531
|
+
onKeyDown={handleJumpKey}
|
|
532
|
+
className="w-12 text-center tabular-nums"
|
|
533
|
+
aria-label="跳转到页"
|
|
534
|
+
/>
|
|
535
|
+
页
|
|
536
|
+
</span>
|
|
537
|
+
) : null}
|
|
538
|
+
</div>
|
|
539
|
+
) : null;
|
|
540
|
+
|
|
541
|
+
return (
|
|
542
|
+
<div
|
|
543
|
+
className={cn(
|
|
544
|
+
'flex w-full flex-wrap items-center justify-between gap-3',
|
|
545
|
+
className,
|
|
546
|
+
)}
|
|
547
|
+
>
|
|
548
|
+
{totalNode}
|
|
549
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
550
|
+
{body}
|
|
551
|
+
{addons}
|
|
552
|
+
</div>
|
|
271
553
|
</div>
|
|
272
554
|
);
|
|
273
555
|
};
|
|
@@ -27,37 +27,34 @@ displayName: 气泡确认
|
|
|
27
27
|
## Props
|
|
28
28
|
|
|
29
29
|
<!-- auto:props:begin -->
|
|
30
|
-
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
40
|
-
| `
|
|
41
|
-
| `
|
|
42
|
-
| `
|
|
43
|
-
| `
|
|
44
|
-
| `disabled` | `boolean` | – | – | 禁用(子节点点击不弹出)。 |
|
|
45
|
-
|
|
30
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
31
|
+
| --- | --- | --- | --- | --- |
|
|
32
|
+
| `children` | `React.ReactElement` | – | ✓ | 触发节点(通常是 Button / a)。 |
|
|
33
|
+
| `title` | `React.ReactNode` | – | ✓ | 主标题(antd `title` 并集)。 |
|
|
34
|
+
| `description` | `React.ReactNode` | – | – | 副描述(antd `description` 并集) — 解释操作后果。 |
|
|
35
|
+
| `icon` | `React.ReactNode` | – | – | 触发图标(antd `icon` 并集) — 默认警示图标。 |
|
|
36
|
+
| `okText` | `string` | `"确定"` | – | 确认按钮文本(antd `okText` 并集)。 |
|
|
37
|
+
| `cancelText` | `string` | `"取消"` | – | 取消按钮文本(antd `cancelText` 并集)。 |
|
|
38
|
+
| `okType` | `'default' \| 'destructive'` | `"default"` | – | 确认按钮 variant(antd `okType` 并集) — 危险操作请用 `destructive`。 |
|
|
39
|
+
| `onConfirm` | `() => void \| Promise<void>` | – | – | 确认回调。 |
|
|
40
|
+
| `onCancel` | `() => void` | – | – | 取消回调。 |
|
|
41
|
+
| `open` | `boolean` | – | – | 受控 open(antd `open` 并集) — 不传时本组件自管 open 状态。 |
|
|
42
|
+
| `onOpenChange` | `(next: boolean) => void` | – | – | open 变化回调。 |
|
|
43
|
+
| `disabled` | `boolean` | – | – | 禁用(子节点点击不弹出)。 |
|
|
46
44
|
<!-- auto:props:end -->
|
|
47
45
|
|
|
48
46
|
## 依赖
|
|
49
47
|
|
|
50
48
|
<!-- auto:deps:begin -->
|
|
51
|
-
|
|
52
49
|
### 同库依赖
|
|
53
50
|
|
|
54
51
|
> `teamix-evo ui add popconfirm` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
55
52
|
|
|
56
|
-
| Entry
|
|
57
|
-
|
|
|
58
|
-
| `cn`
|
|
59
|
-
| `button`
|
|
60
|
-
| `popover` | component | 可交互浮层 — Radix Popover + antd arrow
|
|
53
|
+
| Entry | 类型 | 描述 |
|
|
54
|
+
| --- | --- | --- |
|
|
55
|
+
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
56
|
+
| `button` | component | 通用按钮 — shadcn 实现 + cloud-design 能力并集(loading / icon / shape / block / dashed variant / color 语义双 prop / disabledTooltip)。同文件合一导出 ButtonGroup + ButtonGroupText(等价 antd Space.Compact + cd SplitButton)。 |
|
|
57
|
+
| `popover` | component | 可交互浮层 — Radix Popover + antd arrow 并集,使用 showArrow 控制尖角(与 Tooltip / HoverCard 命名统一) |
|
|
61
58
|
|
|
62
59
|
### npm 依赖
|
|
63
60
|
|
|
@@ -66,7 +63,6 @@ displayName: 气泡确认
|
|
|
66
63
|
```bash
|
|
67
64
|
pnpm add lucide-react@^0.460.0
|
|
68
65
|
```
|
|
69
|
-
|
|
70
66
|
<!-- auto:deps:end -->
|
|
71
67
|
|
|
72
68
|
## AI 生成纪律
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import { RefreshCcw } from 'lucide-react';
|
|
3
3
|
import { Popconfirm } from './popconfirm';
|
|
4
4
|
import { Button } from '@/components/button/button';
|
|
5
5
|
|
|
6
6
|
const meta: Meta<typeof Popconfirm> = {
|
|
7
|
-
title: '
|
|
7
|
+
title: '反馈 · Feedback/Popconfirm',
|
|
8
8
|
component: Popconfirm,
|
|
9
9
|
tags: ['autodocs'],
|
|
10
10
|
parameters: {
|
|
@@ -98,7 +98,7 @@ const Popconfirm: React.FC<PopconfirmProps> = ({
|
|
|
98
98
|
{icon ?? <AlertCircle className="size-4" />}
|
|
99
99
|
</span>
|
|
100
100
|
<div className="min-w-0 flex-1">
|
|
101
|
-
<div className="text-
|
|
101
|
+
<div className="text-xs font-medium">{title}</div>
|
|
102
102
|
{description ? (
|
|
103
103
|
<div className={cn('mt-1 text-xs text-muted-foreground')}>
|
|
104
104
|
{description}
|