@teamix-evo/ui 0.4.0 → 0.5.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 +46 -50
- package/manifest.json +406 -653
- package/package.json +15 -34
- package/src/_design-system/theme-tokens/stories.tsx +1474 -0
- package/src/components/accordion/index.tsx +139 -0
- package/src/components/accordion/meta.md +162 -0
- package/src/components/accordion/stories.tsx +145 -0
- package/src/components/affix/index.tsx +149 -0
- package/src/components/affix/meta.md +23 -0
- package/src/components/affix/stories.tsx +70 -0
- package/src/components/alert/index.tsx +220 -0
- package/src/components/alert/meta.md +133 -0
- package/src/components/alert/stories.tsx +126 -0
- package/src/components/alert-dialog/index.tsx +282 -0
- package/src/components/alert-dialog/meta.md +86 -0
- package/src/components/alert-dialog/stories.tsx +163 -0
- package/src/components/avatar/index.tsx +159 -0
- package/src/components/avatar/meta.md +242 -0
- package/src/components/avatar/stories.tsx +241 -0
- package/src/components/badge/index.tsx +299 -0
- package/src/components/badge/meta.md +237 -0
- package/src/components/badge/stories.tsx +275 -0
- package/src/components/breadcrumb/index.tsx +137 -0
- package/src/components/breadcrumb/meta.md +64 -0
- package/src/components/breadcrumb/stories.tsx +86 -0
- package/src/components/button/index.tsx +202 -0
- package/src/components/button/meta.md +209 -0
- package/src/components/button/stories.tsx +215 -0
- package/src/components/button-group/index.tsx +211 -0
- package/src/components/button-group/meta.md +190 -0
- package/src/components/button-group/stories.tsx +182 -0
- package/src/components/calendar/index.tsx +240 -0
- package/src/components/calendar/meta.md +36 -0
- package/src/components/calendar/stories.tsx +36 -0
- package/src/components/card/index.tsx +262 -0
- package/src/components/card/meta.md +194 -0
- package/src/components/card/stories.tsx +202 -0
- package/src/components/carousel/index.tsx +481 -0
- package/src/components/carousel/meta.md +208 -0
- package/src/components/carousel/stories.tsx +271 -0
- package/src/components/cascader-select/index.tsx +308 -0
- package/src/components/cascader-select/meta.md +28 -0
- package/src/components/cascader-select/stories.tsx +118 -0
- package/src/components/checkbox/index.tsx +208 -0
- package/src/components/checkbox/meta.md +166 -0
- package/src/components/checkbox/stories.tsx +206 -0
- package/src/components/collapsible/index.tsx +72 -0
- package/src/components/collapsible/meta.md +87 -0
- package/src/components/collapsible/stories.tsx +97 -0
- package/src/components/color-picker/index.tsx +677 -0
- package/src/components/color-picker/meta.md +83 -0
- package/src/components/color-picker/stories.tsx +172 -0
- package/src/components/combobox/index.tsx +687 -0
- package/src/components/combobox/meta.md +83 -0
- package/src/components/combobox/stories.tsx +179 -0
- package/src/components/command/index.tsx +238 -0
- package/src/components/command/meta.md +48 -0
- package/src/components/command/stories.tsx +83 -0
- package/src/components/data-table/index.tsx +1537 -0
- package/src/components/data-table/meta.md +107 -0
- package/src/components/data-table/stories.tsx +1234 -0
- package/src/components/date-picker/index.tsx +1492 -0
- package/src/components/date-picker/meta.md +103 -0
- package/src/components/date-picker/stories.tsx +125 -0
- package/src/components/descriptions/index.tsx +535 -0
- package/src/components/descriptions/meta.md +104 -0
- package/src/components/descriptions/stories.tsx +389 -0
- package/src/components/dialog/index.tsx +255 -0
- package/src/components/dialog/meta.md +244 -0
- package/src/components/dialog/stories.tsx +330 -0
- package/src/components/dropdown-menu/index.tsx +301 -0
- package/src/components/dropdown-menu/meta.md +93 -0
- package/src/components/dropdown-menu/stories.tsx +124 -0
- package/src/components/empty/index.tsx +431 -0
- package/src/components/empty/meta.md +274 -0
- package/src/components/empty/stories.tsx +278 -0
- package/src/components/field/index.tsx +374 -0
- package/src/components/field/meta.md +283 -0
- package/src/components/field/stories.tsx +327 -0
- package/src/components/filter-bar/index.tsx +976 -0
- package/src/components/filter-bar/meta.md +57 -0
- package/src/components/filter-bar/stories.tsx +496 -0
- package/src/components/float-button/index.tsx +163 -0
- package/src/components/float-button/meta.md +73 -0
- package/src/components/float-button/stories.tsx +68 -0
- package/src/components/form/index.tsx +218 -0
- package/src/components/form/meta.md +16 -0
- package/src/components/form/stories.tsx +301 -0
- package/src/components/hover-card/index.tsx +103 -0
- package/src/components/hover-card/meta.md +71 -0
- package/src/components/hover-card/stories.tsx +107 -0
- package/src/components/icon/index.tsx +225 -0
- package/src/components/icon/meta.md +102 -0
- package/src/components/icon/stories.tsx +127 -0
- package/src/components/image/index.tsx +147 -0
- package/src/components/image/meta.md +55 -0
- package/src/components/image/stories.tsx +48 -0
- package/src/components/input/index.tsx +63 -0
- package/src/components/input/meta.md +57 -0
- package/src/components/input/stories.tsx +66 -0
- package/src/components/input-group/index.tsx +292 -0
- package/src/components/input-group/meta.md +108 -0
- package/src/components/input-group/stories.tsx +258 -0
- package/src/components/input-ip/index.tsx +288 -0
- package/src/components/input-ip/meta.md +48 -0
- package/src/components/input-ip/stories.tsx +69 -0
- package/src/components/input-number/index.tsx +360 -0
- package/src/components/input-number/meta.md +156 -0
- package/src/components/input-number/stories.tsx +187 -0
- package/src/components/item/index.tsx +368 -0
- package/src/components/item/meta.md +395 -0
- package/src/components/item/stories.tsx +432 -0
- package/src/components/label/index.tsx +44 -0
- package/src/components/label/meta.md +68 -0
- package/src/components/label/stories.tsx +64 -0
- package/src/components/mentions/index.tsx +369 -0
- package/src/components/mentions/meta.md +118 -0
- package/src/components/mentions/stories.tsx +153 -0
- package/src/components/menubar/index.tsx +313 -0
- package/src/components/menubar/meta.md +52 -0
- package/src/components/menubar/stories.tsx +99 -0
- package/src/components/navigation-menu/index.tsx +216 -0
- package/src/components/navigation-menu/meta.md +66 -0
- package/src/components/navigation-menu/stories.tsx +137 -0
- package/src/components/page-header/index.tsx +218 -0
- package/src/components/page-header/meta.md +211 -0
- package/src/components/page-header/stories.tsx +290 -0
- package/src/components/page-shell/index.tsx +119 -0
- package/src/components/page-shell/meta.md +115 -0
- package/src/components/page-shell/stories.tsx +154 -0
- package/src/components/pagination/index.tsx +580 -0
- package/src/components/pagination/meta.md +39 -0
- package/src/components/pagination/stories.tsx +319 -0
- package/src/components/popconfirm/index.tsx +477 -0
- package/src/components/popconfirm/meta.md +164 -0
- package/src/components/popconfirm/stories.tsx +231 -0
- package/src/components/popover/index.tsx +181 -0
- package/src/components/popover/meta.md +97 -0
- package/src/components/popover/stories.tsx +169 -0
- package/src/components/progress/index.tsx +176 -0
- package/src/components/progress/meta.md +95 -0
- package/src/components/progress/stories.tsx +115 -0
- package/src/components/radio-group/index.tsx +78 -0
- package/src/components/radio-group/meta.md +137 -0
- package/src/components/radio-group/stories.tsx +285 -0
- package/src/components/rate/index.tsx +284 -0
- package/src/components/rate/meta.md +63 -0
- package/src/components/rate/stories.tsx +107 -0
- package/src/components/resizable/index.tsx +122 -0
- package/src/components/resizable/meta.md +142 -0
- package/src/components/resizable/stories.tsx +105 -0
- package/src/components/scroll-area/index.tsx +83 -0
- package/src/components/scroll-area/meta.md +85 -0
- package/src/components/scroll-area/stories.tsx +82 -0
- package/src/components/select/index.tsx +325 -0
- package/src/components/select/meta.md +183 -0
- package/src/components/select/stories.tsx +210 -0
- package/src/components/separator/index.tsx +51 -0
- package/src/components/separator/meta.md +68 -0
- package/src/components/separator/stories.tsx +53 -0
- package/src/components/sheet/index.tsx +293 -0
- package/src/components/sheet/meta.md +226 -0
- package/src/components/sheet/stories.tsx +405 -0
- package/src/components/sidebar/index.tsx +715 -0
- package/src/components/sidebar/meta.md +14 -0
- package/src/components/sidebar/{sidebar.stories.tsx → stories.tsx} +250 -330
- package/src/components/skeleton/index.tsx +415 -0
- package/src/components/skeleton/meta.md +210 -0
- package/src/components/skeleton/stories.tsx +197 -0
- package/src/components/slider/index.tsx +222 -0
- package/src/components/slider/meta.md +125 -0
- package/src/components/slider/stories.tsx +109 -0
- package/src/components/sonner/index.tsx +149 -0
- package/src/components/sonner/meta.md +156 -0
- package/src/components/sonner/stories.tsx +285 -0
- package/src/components/spinner/index.tsx +335 -0
- package/src/components/spinner/meta.md +172 -0
- package/src/components/spinner/stories.tsx +197 -0
- package/src/components/statistic/{statistic.tsx → index.tsx} +25 -26
- package/src/components/statistic/meta.md +94 -0
- package/src/components/statistic/stories.tsx +85 -0
- package/src/components/steps/index.tsx +500 -0
- package/src/components/steps/meta.md +245 -0
- package/src/components/steps/stories.tsx +287 -0
- package/src/components/switch/index.tsx +175 -0
- package/src/components/switch/meta.md +107 -0
- package/src/components/switch/stories.tsx +154 -0
- package/src/components/table/index.tsx +350 -0
- package/src/components/table/meta.md +148 -0
- package/src/components/table/stories.tsx +189 -0
- package/src/components/tabs/index.tsx +379 -0
- package/src/components/tabs/meta.md +244 -0
- package/src/components/tabs/stories.tsx +312 -0
- package/src/components/tag/index.tsx +774 -0
- package/src/components/tag/meta.md +256 -0
- package/src/components/tag/stories.tsx +431 -0
- package/src/components/textarea/index.tsx +62 -0
- package/src/components/textarea/meta.md +77 -0
- package/src/components/textarea/stories.tsx +112 -0
- package/src/components/time-picker/index.tsx +887 -0
- package/src/components/time-picker/meta.md +102 -0
- package/src/components/time-picker/stories.tsx +125 -0
- package/src/components/timeline/index.tsx +422 -0
- package/src/components/timeline/meta.md +352 -0
- package/src/components/timeline/stories.tsx +369 -0
- package/src/components/toggle/index.tsx +74 -0
- package/src/components/toggle/meta.md +76 -0
- package/src/components/toggle/stories.tsx +66 -0
- package/src/components/toggle-group/index.tsx +167 -0
- package/src/components/toggle-group/meta.md +141 -0
- package/src/components/toggle-group/stories.tsx +124 -0
- package/src/components/tooltip/index.tsx +144 -0
- package/src/components/tooltip/meta.md +186 -0
- package/src/components/tooltip/stories.tsx +212 -0
- package/src/components/transfer/index.tsx +639 -0
- package/src/components/transfer/meta.md +76 -0
- package/src/components/transfer/stories.tsx +221 -0
- package/src/components/tree/index.tsx +764 -0
- package/src/components/tree/meta.md +96 -0
- package/src/components/tree/stories.tsx +385 -0
- package/src/components/tree/utils.ts +269 -0
- package/src/components/tree-select/index.tsx +400 -0
- package/src/components/tree-select/meta.md +78 -0
- package/src/components/tree-select/stories.tsx +234 -0
- package/src/components/typography/index.tsx +290 -0
- package/src/components/typography/meta.md +151 -0
- package/src/components/typography/stories.tsx +151 -0
- package/src/components/upload/index.tsx +858 -0
- package/src/components/upload/meta.md +122 -0
- package/src/components/upload/stories.tsx +261 -0
- package/src/components/watermark/index.tsx +152 -0
- package/src/components/watermark/meta.md +67 -0
- package/src/components/watermark/stories.tsx +59 -0
- package/src/hooks/use-mobile.ts +9 -11
- package/src/lib/color.ts +243 -0
- package/src/{utils/cn.ts → lib/utils.ts} +1 -1
- package/src/components/accordion/accordion.meta.md +0 -88
- package/src/components/accordion/accordion.stories.tsx +0 -72
- package/src/components/accordion/accordion.tsx +0 -154
- package/src/components/affix/affix.meta.md +0 -98
- package/src/components/affix/affix.stories.tsx +0 -134
- package/src/components/affix/affix.tsx +0 -167
- package/src/components/alert/alert.meta.md +0 -132
- package/src/components/alert/alert.stories.tsx +0 -138
- package/src/components/alert/alert.tsx +0 -179
- package/src/components/alert-dialog/alert-dialog.meta.md +0 -152
- package/src/components/alert-dialog/alert-dialog.stories.tsx +0 -223
- package/src/components/alert-dialog/alert-dialog.tsx +0 -183
- package/src/components/anchor/anchor.meta.md +0 -92
- package/src/components/anchor/anchor.stories.tsx +0 -74
- package/src/components/anchor/anchor.tsx +0 -130
- package/src/components/app/app.meta.md +0 -91
- package/src/components/app/app.stories.tsx +0 -64
- package/src/components/app/app.tsx +0 -58
- package/src/components/aspect-ratio/aspect-ratio.meta.md +0 -82
- package/src/components/aspect-ratio/aspect-ratio.stories.tsx +0 -59
- package/src/components/aspect-ratio/aspect-ratio.tsx +0 -22
- package/src/components/auto-complete/auto-complete.meta.md +0 -110
- package/src/components/auto-complete/auto-complete.stories.tsx +0 -136
- package/src/components/auto-complete/auto-complete.tsx +0 -253
- package/src/components/avatar/avatar.meta.md +0 -93
- package/src/components/avatar/avatar.stories.tsx +0 -98
- package/src/components/avatar/avatar.tsx +0 -127
- package/src/components/badge/badge.meta.md +0 -120
- package/src/components/badge/badge.stories.tsx +0 -153
- package/src/components/badge/badge.tsx +0 -204
- package/src/components/breadcrumb/breadcrumb.meta.md +0 -127
- package/src/components/breadcrumb/breadcrumb.stories.tsx +0 -207
- package/src/components/breadcrumb/breadcrumb.tsx +0 -136
- package/src/components/button/button.meta.md +0 -335
- package/src/components/button/button.stories.tsx +0 -743
- package/src/components/button/button.tsx +0 -466
- package/src/components/calendar/calendar.meta.md +0 -128
- package/src/components/calendar/calendar.stories.tsx +0 -68
- package/src/components/calendar/calendar.tsx +0 -172
- package/src/components/card/card.meta.md +0 -139
- package/src/components/card/card.stories.tsx +0 -151
- package/src/components/card/card.tsx +0 -306
- package/src/components/carousel/carousel.meta.md +0 -118
- package/src/components/carousel/carousel.stories.tsx +0 -89
- package/src/components/carousel/carousel.tsx +0 -224
- package/src/components/cascader/cascader.meta.md +0 -140
- package/src/components/cascader/cascader.stories.tsx +0 -120
- package/src/components/cascader/cascader.tsx +0 -548
- package/src/components/checkbox/checkbox.meta.md +0 -167
- package/src/components/checkbox/checkbox.stories.tsx +0 -288
- package/src/components/checkbox/checkbox.tsx +0 -195
- package/src/components/collapsible/collapsible.meta.md +0 -88
- package/src/components/collapsible/collapsible.stories.tsx +0 -43
- package/src/components/collapsible/collapsible.tsx +0 -105
- package/src/components/color-picker/color-picker.meta.md +0 -89
- package/src/components/color-picker/color-picker.stories.tsx +0 -159
- package/src/components/color-picker/color-picker.tsx +0 -171
- package/src/components/command/command.meta.md +0 -120
- package/src/components/command/command.stories.tsx +0 -59
- package/src/components/command/command.tsx +0 -158
- package/src/components/context-menu/context-menu.meta.md +0 -93
- package/src/components/context-menu/context-menu.stories.tsx +0 -54
- package/src/components/context-menu/context-menu.tsx +0 -204
- package/src/components/data-table/data-table.meta.md +0 -150
- package/src/components/data-table/data-table.stories.tsx +0 -132
- package/src/components/data-table/data-table.tsx +0 -185
- package/src/components/date-picker/date-picker.meta.md +0 -175
- package/src/components/date-picker/date-picker.stories.tsx +0 -108
- package/src/components/date-picker/date-picker.tsx +0 -1554
- package/src/components/descriptions/descriptions.meta.md +0 -83
- package/src/components/descriptions/descriptions.stories.tsx +0 -60
- package/src/components/descriptions/descriptions.tsx +0 -137
- package/src/components/dialog/dialog.meta.md +0 -168
- package/src/components/dialog/dialog.stories.tsx +0 -255
- package/src/components/dialog/dialog.tsx +0 -180
- package/src/components/dialog/imperative.tsx +0 -252
- package/src/components/drawer/drawer.meta.md +0 -95
- package/src/components/drawer/drawer.stories.tsx +0 -71
- package/src/components/drawer/drawer.tsx +0 -23
- package/src/components/dropdown-menu/dropdown-menu.meta.md +0 -171
- package/src/components/dropdown-menu/dropdown-menu.stories.tsx +0 -198
- package/src/components/dropdown-menu/dropdown-menu.tsx +0 -209
- package/src/components/ellipsis/ellipsis.meta.md +0 -87
- package/src/components/ellipsis/ellipsis.stories.tsx +0 -72
- package/src/components/ellipsis/ellipsis.tsx +0 -153
- package/src/components/empty/empty.meta.md +0 -86
- package/src/components/empty/empty.stories.tsx +0 -46
- package/src/components/empty/empty.tsx +0 -54
- package/src/components/field/field.meta.md +0 -154
- package/src/components/field/field.stories.tsx +0 -497
- package/src/components/field/field.tsx +0 -392
- package/src/components/filter-bar/filter-bar.meta.md +0 -92
- package/src/components/filter-bar/filter-bar.stories.tsx +0 -1086
- package/src/components/filter-bar/filter-bar.tsx +0 -568
- package/src/components/flex/flex.meta.md +0 -142
- package/src/components/flex/flex.stories.tsx +0 -199
- package/src/components/flex/flex.tsx +0 -145
- package/src/components/float-button/float-button.meta.md +0 -92
- package/src/components/float-button/float-button.stories.tsx +0 -80
- package/src/components/float-button/float-button.tsx +0 -143
- package/src/components/form/form.meta.md +0 -153
- package/src/components/form/form.stories.tsx +0 -472
- package/src/components/form/form.tsx +0 -260
- package/src/components/grid/grid.meta.md +0 -92
- package/src/components/grid/grid.stories.tsx +0 -101
- package/src/components/grid/grid.tsx +0 -130
- package/src/components/hover-card/hover-card.meta.md +0 -103
- package/src/components/hover-card/hover-card.stories.tsx +0 -97
- package/src/components/hover-card/hover-card.tsx +0 -67
- package/src/components/icon/DEVELOPMENT.md +0 -809
- package/src/components/icon/icon.meta.md +0 -170
- package/src/components/icon/icon.stories.tsx +0 -344
- package/src/components/icon/icon.tsx +0 -248
- package/src/components/image/image.meta.md +0 -99
- package/src/components/image/image.stories.tsx +0 -55
- package/src/components/image/image.tsx +0 -140
- package/src/components/input/input.meta.md +0 -115
- package/src/components/input/input.stories.tsx +0 -144
- package/src/components/input/input.tsx +0 -212
- package/src/components/input-group/input-group.meta.md +0 -124
- package/src/components/input-group/input-group.stories.tsx +0 -121
- package/src/components/input-group/input-group.tsx +0 -143
- package/src/components/input-number/input-number.meta.md +0 -148
- package/src/components/input-number/input-number.stories.tsx +0 -125
- package/src/components/input-number/input-number.tsx +0 -283
- package/src/components/input-otp/input-otp.meta.md +0 -106
- package/src/components/input-otp/input-otp.stories.tsx +0 -65
- package/src/components/input-otp/input-otp.tsx +0 -97
- package/src/components/item/item.meta.md +0 -121
- package/src/components/item/item.stories.tsx +0 -116
- package/src/components/item/item.tsx +0 -172
- package/src/components/kbd/kbd.meta.md +0 -94
- package/src/components/kbd/kbd.stories.tsx +0 -70
- package/src/components/kbd/kbd.tsx +0 -86
- package/src/components/label/label.meta.md +0 -99
- package/src/components/label/label.stories.tsx +0 -145
- package/src/components/label/label.tsx +0 -138
- package/src/components/masonry/masonry.meta.md +0 -90
- package/src/components/masonry/masonry.stories.tsx +0 -68
- package/src/components/masonry/masonry.tsx +0 -60
- package/src/components/mentions/mentions.meta.md +0 -119
- package/src/components/mentions/mentions.stories.tsx +0 -189
- package/src/components/mentions/mentions.tsx +0 -243
- package/src/components/menubar/menubar.meta.md +0 -118
- package/src/components/menubar/menubar.stories.tsx +0 -141
- package/src/components/menubar/menubar.tsx +0 -232
- package/src/components/native-select/native-select.meta.md +0 -93
- package/src/components/native-select/native-select.stories.tsx +0 -83
- package/src/components/native-select/native-select.tsx +0 -54
- package/src/components/navigation-menu/navigation-menu.meta.md +0 -118
- package/src/components/navigation-menu/navigation-menu.stories.tsx +0 -215
- package/src/components/navigation-menu/navigation-menu.tsx +0 -129
- package/src/components/notification/notification.meta.md +0 -133
- package/src/components/notification/notification.stories.tsx +0 -98
- package/src/components/notification/notification.tsx +0 -99
- package/src/components/page-header/DEVELOPMENT.md +0 -842
- package/src/components/page-header/page-header.meta.md +0 -210
- package/src/components/page-header/page-header.stories.tsx +0 -428
- package/src/components/page-header/page-header.tsx +0 -284
- package/src/components/page-shell/page-shell.meta.md +0 -116
- package/src/components/page-shell/page-shell.stories.tsx +0 -149
- package/src/components/page-shell/page-shell.tsx +0 -115
- package/src/components/pagination/pagination.meta.md +0 -230
- package/src/components/pagination/pagination.stories.tsx +0 -284
- package/src/components/pagination/pagination.tsx +0 -567
- package/src/components/popconfirm/popconfirm.meta.md +0 -114
- package/src/components/popconfirm/popconfirm.stories.tsx +0 -75
- package/src/components/popconfirm/popconfirm.tsx +0 -134
- package/src/components/popover/popover.meta.md +0 -154
- package/src/components/popover/popover.stories.tsx +0 -158
- package/src/components/popover/popover.tsx +0 -104
- package/src/components/progress/progress.meta.md +0 -118
- package/src/components/progress/progress.stories.tsx +0 -75
- package/src/components/progress/progress.tsx +0 -203
- package/src/components/radio-group/radio-group.meta.md +0 -175
- package/src/components/radio-group/radio-group.stories.tsx +0 -113
- package/src/components/radio-group/radio-group.tsx +0 -209
- package/src/components/rate/rate.meta.md +0 -118
- package/src/components/rate/rate.stories.tsx +0 -89
- package/src/components/rate/rate.tsx +0 -180
- package/src/components/resizable/resizable.meta.md +0 -95
- package/src/components/resizable/resizable.stories.tsx +0 -104
- package/src/components/resizable/resizable.tsx +0 -56
- package/src/components/result/result.meta.md +0 -95
- package/src/components/result/result.stories.tsx +0 -67
- package/src/components/result/result.tsx +0 -100
- package/src/components/scroll-area/scroll-area.meta.md +0 -85
- package/src/components/scroll-area/scroll-area.stories.tsx +0 -49
- package/src/components/scroll-area/scroll-area.tsx +0 -51
- package/src/components/segmented/segmented.meta.md +0 -106
- package/src/components/segmented/segmented.stories.tsx +0 -130
- package/src/components/segmented/segmented.tsx +0 -146
- package/src/components/select/select.meta.md +0 -255
- package/src/components/select/select.stories.tsx +0 -275
- package/src/components/select/select.tsx +0 -735
- package/src/components/separator/separator.meta.md +0 -75
- package/src/components/separator/separator.stories.tsx +0 -71
- package/src/components/separator/separator.tsx +0 -100
- package/src/components/sheet/sheet.meta.md +0 -113
- package/src/components/sheet/sheet.stories.tsx +0 -188
- package/src/components/sheet/sheet.tsx +0 -226
- package/src/components/sidebar/sidebar.meta.md +0 -151
- package/src/components/sidebar/sidebar.tsx +0 -853
- package/src/components/skeleton/skeleton.meta.md +0 -94
- package/src/components/skeleton/skeleton.stories.tsx +0 -79
- package/src/components/skeleton/skeleton.tsx +0 -144
- package/src/components/slider/slider.meta.md +0 -146
- package/src/components/slider/slider.stories.tsx +0 -121
- package/src/components/slider/slider.tsx +0 -227
- package/src/components/sonner/sonner.meta.md +0 -147
- package/src/components/sonner/sonner.stories.tsx +0 -164
- package/src/components/sonner/sonner.tsx +0 -169
- package/src/components/spinner/spinner.meta.md +0 -125
- package/src/components/spinner/spinner.stories.tsx +0 -123
- package/src/components/spinner/spinner.tsx +0 -166
- package/src/components/statistic/statistic.meta.md +0 -104
- package/src/components/statistic/statistic.stories.tsx +0 -67
- package/src/components/steps/steps.meta.md +0 -116
- package/src/components/steps/steps.stories.tsx +0 -115
- package/src/components/steps/steps.tsx +0 -173
- package/src/components/switch/switch.meta.md +0 -138
- package/src/components/switch/switch.stories.tsx +0 -75
- package/src/components/switch/switch.tsx +0 -169
- package/src/components/table/table.meta.md +0 -106
- package/src/components/table/table.stories.tsx +0 -80
- package/src/components/table/table.tsx +0 -124
- package/src/components/tabs/tabs.meta.md +0 -111
- package/src/components/tabs/tabs.stories.tsx +0 -156
- package/src/components/tabs/tabs.tsx +0 -190
- package/src/components/tag/tag.meta.md +0 -159
- package/src/components/tag/tag.stories.tsx +0 -250
- package/src/components/tag/tag.tsx +0 -386
- package/src/components/textarea/textarea.meta.md +0 -99
- package/src/components/textarea/textarea.stories.tsx +0 -89
- package/src/components/textarea/textarea.tsx +0 -137
- package/src/components/time-picker/time-picker.meta.md +0 -175
- package/src/components/time-picker/time-picker.stories.tsx +0 -129
- package/src/components/time-picker/time-picker.tsx +0 -946
- package/src/components/timeline/timeline.meta.md +0 -110
- package/src/components/timeline/timeline.stories.tsx +0 -134
- package/src/components/timeline/timeline.tsx +0 -168
- package/src/components/toggle/toggle.meta.md +0 -89
- package/src/components/toggle/toggle.stories.tsx +0 -66
- package/src/components/toggle/toggle.tsx +0 -54
- package/src/components/toggle-group/toggle-group.meta.md +0 -91
- package/src/components/toggle-group/toggle-group.stories.tsx +0 -83
- package/src/components/toggle-group/toggle-group.tsx +0 -78
- package/src/components/tooltip/tooltip.meta.md +0 -149
- package/src/components/tooltip/tooltip.stories.tsx +0 -108
- package/src/components/tooltip/tooltip.tsx +0 -153
- package/src/components/tour/tour.meta.md +0 -121
- package/src/components/tour/tour.stories.tsx +0 -66
- package/src/components/tour/tour.tsx +0 -242
- package/src/components/transfer/transfer.meta.md +0 -95
- package/src/components/transfer/transfer.stories.tsx +0 -64
- package/src/components/transfer/transfer.tsx +0 -258
- package/src/components/tree/tree.meta.md +0 -169
- package/src/components/tree/tree.stories.tsx +0 -128
- package/src/components/tree/tree.tsx +0 -368
- package/src/components/tree-select/tree-select.meta.md +0 -151
- package/src/components/tree-select/tree-select.stories.tsx +0 -80
- package/src/components/tree-select/tree-select.tsx +0 -206
- package/src/components/typography/typography.meta.md +0 -149
- package/src/components/typography/typography.stories.tsx +0 -116
- package/src/components/typography/typography.tsx +0 -260
- package/src/components/upload/upload.meta.md +0 -156
- package/src/components/upload/upload.stories.tsx +0 -135
- package/src/components/upload/upload.tsx +0 -398
- package/src/components/watermark/watermark.meta.md +0 -100
- package/src/components/watermark/watermark.stories.tsx +0 -170
- package/src/components/watermark/watermark.tsx +0 -166
- package/src/hooks/use-breakpoint.ts +0 -117
- package/src/hooks/use-debounce-callback.ts +0 -52
- package/src/stories/theme-tokens.stories.tsx +0 -747
- package/src/utils/trigger-input.ts +0 -57
|
@@ -1,567 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
ChevronLeft,
|
|
4
|
-
ChevronRight,
|
|
5
|
-
ChevronsLeft,
|
|
6
|
-
ChevronsRight,
|
|
7
|
-
MoreHorizontal,
|
|
8
|
-
} from 'lucide-react';
|
|
9
|
-
import { cva, type VariantProps } from 'class-variance-authority';
|
|
10
|
-
|
|
11
|
-
import { cn } from '@/utils/cn';
|
|
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
|
-
};
|
|
35
|
-
|
|
36
|
-
// ─── shadcn-style primitives ──────────────────────────────────────────────────
|
|
37
|
-
|
|
38
|
-
const Pagination = ({ className, ...props }: React.ComponentProps<'nav'>) => (
|
|
39
|
-
<nav
|
|
40
|
-
role="navigation"
|
|
41
|
-
aria-label="pagination"
|
|
42
|
-
className={cn('mx-auto flex w-full justify-center', className)}
|
|
43
|
-
{...props}
|
|
44
|
-
/>
|
|
45
|
-
);
|
|
46
|
-
Pagination.displayName = 'Pagination';
|
|
47
|
-
|
|
48
|
-
const PaginationContent = React.forwardRef<
|
|
49
|
-
HTMLUListElement,
|
|
50
|
-
React.ComponentProps<'ul'>
|
|
51
|
-
>(({ className, ...props }, ref) => (
|
|
52
|
-
<ul
|
|
53
|
-
ref={ref}
|
|
54
|
-
className={cn('flex flex-row items-center gap-1', className)}
|
|
55
|
-
{...props}
|
|
56
|
-
/>
|
|
57
|
-
));
|
|
58
|
-
PaginationContent.displayName = 'PaginationContent';
|
|
59
|
-
|
|
60
|
-
const PaginationItem = React.forwardRef<
|
|
61
|
-
HTMLLIElement,
|
|
62
|
-
React.ComponentProps<'li'>
|
|
63
|
-
>(({ className, ...props }, ref) => (
|
|
64
|
-
<li ref={ref} className={cn('', className)} {...props} />
|
|
65
|
-
));
|
|
66
|
-
PaginationItem.displayName = 'PaginationItem';
|
|
67
|
-
|
|
68
|
-
interface PaginationLinkProps
|
|
69
|
-
extends Omit<ButtonProps, 'size' | 'variant' | 'shape'> {
|
|
70
|
-
/** 当前激活状态(高亮选中页)。 */
|
|
71
|
-
isActive?: boolean;
|
|
72
|
-
/**
|
|
73
|
-
* 尺寸,对齐 Button/Input 三档。
|
|
74
|
-
* @default "md"
|
|
75
|
-
*/
|
|
76
|
-
size?: PaginationSize;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const PaginationLink = ({
|
|
80
|
-
className,
|
|
81
|
-
isActive,
|
|
82
|
-
size = 'md',
|
|
83
|
-
...props
|
|
84
|
-
}: PaginationLinkProps) => (
|
|
85
|
-
<Button
|
|
86
|
-
aria-current={isActive ? 'page' : undefined}
|
|
87
|
-
variant={isActive ? 'outline' : 'ghost'}
|
|
88
|
-
size={size}
|
|
89
|
-
className={cn(
|
|
90
|
-
// 让数字键看起来近似方块,最小宽度 = 高度
|
|
91
|
-
minWClass[size],
|
|
92
|
-
// 数字键以 padding 收紧(等宽数字)
|
|
93
|
-
'tabular-nums',
|
|
94
|
-
isActive && 'border-primary text-primary',
|
|
95
|
-
className,
|
|
96
|
-
)}
|
|
97
|
-
{...props}
|
|
98
|
-
/>
|
|
99
|
-
);
|
|
100
|
-
PaginationLink.displayName = 'PaginationLink';
|
|
101
|
-
|
|
102
|
-
interface PaginationNavProps extends Omit<PaginationLinkProps, 'isActive'> {
|
|
103
|
-
/**
|
|
104
|
-
* 仅显示图标(不显示「上一页 / 下一页」文字),用于 mini 与图标条形态。
|
|
105
|
-
* @default false
|
|
106
|
-
*/
|
|
107
|
-
iconOnly?: boolean;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const PaginationPrevious = ({
|
|
111
|
-
className,
|
|
112
|
-
size = 'md',
|
|
113
|
-
iconOnly = false,
|
|
114
|
-
children,
|
|
115
|
-
...props
|
|
116
|
-
}: PaginationNavProps) => (
|
|
117
|
-
<PaginationLink
|
|
118
|
-
aria-label="Go to previous page"
|
|
119
|
-
size={size}
|
|
120
|
-
className={cn(iconOnly ? 'aspect-square px-0' : 'gap-1 px-2.5', className)}
|
|
121
|
-
{...props}
|
|
122
|
-
>
|
|
123
|
-
<ChevronLeft className="size-4" />
|
|
124
|
-
{!iconOnly && (children ?? <span>上一页</span>)}
|
|
125
|
-
</PaginationLink>
|
|
126
|
-
);
|
|
127
|
-
PaginationPrevious.displayName = 'PaginationPrevious';
|
|
128
|
-
|
|
129
|
-
const PaginationNext = ({
|
|
130
|
-
className,
|
|
131
|
-
size = 'md',
|
|
132
|
-
iconOnly = false,
|
|
133
|
-
children,
|
|
134
|
-
...props
|
|
135
|
-
}: PaginationNavProps) => (
|
|
136
|
-
<PaginationLink
|
|
137
|
-
aria-label="Go to next page"
|
|
138
|
-
size={size}
|
|
139
|
-
className={cn(iconOnly ? 'aspect-square px-0' : 'gap-1 px-2.5', className)}
|
|
140
|
-
{...props}
|
|
141
|
-
>
|
|
142
|
-
{!iconOnly && (children ?? <span>下一页</span>)}
|
|
143
|
-
<ChevronRight className="size-4" />
|
|
144
|
-
</PaginationLink>
|
|
145
|
-
);
|
|
146
|
-
PaginationNext.displayName = 'PaginationNext';
|
|
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
|
-
|
|
166
|
-
const PaginationEllipsis = ({
|
|
167
|
-
className,
|
|
168
|
-
size,
|
|
169
|
-
...props
|
|
170
|
-
}: PaginationEllipsisProps) => (
|
|
171
|
-
<span
|
|
172
|
-
aria-hidden="true"
|
|
173
|
-
className={cn(ellipsisVariants({ size }), className)}
|
|
174
|
-
{...props}
|
|
175
|
-
>
|
|
176
|
-
<MoreHorizontal />
|
|
177
|
-
<span className="sr-only">More pages</span>
|
|
178
|
-
</span>
|
|
179
|
-
);
|
|
180
|
-
PaginationEllipsis.displayName = 'PaginationEllipsis';
|
|
181
|
-
|
|
182
|
-
// ─── 高阶 SimplePagination — antd 风格 props 化 ───────────────────────────────
|
|
183
|
-
|
|
184
|
-
export interface SimplePaginationProps {
|
|
185
|
-
/**
|
|
186
|
-
* 当前页(1-based,受控)。与 `defaultCurrent` 互斥。
|
|
187
|
-
*/
|
|
188
|
-
current?: number;
|
|
189
|
-
/**
|
|
190
|
-
* 默认当前页(非受控)。
|
|
191
|
-
* @default 1
|
|
192
|
-
*/
|
|
193
|
-
defaultCurrent?: number;
|
|
194
|
-
/**
|
|
195
|
-
* 页码 / pageSize 变化回调。第二参为变化后的 pageSize。
|
|
196
|
-
*/
|
|
197
|
-
onChange?: (page: number, pageSize: number) => void;
|
|
198
|
-
/** 总条数。 */
|
|
199
|
-
total: number;
|
|
200
|
-
/**
|
|
201
|
-
* 每页大小(受控)。与 `defaultPageSize` 互斥。
|
|
202
|
-
*/
|
|
203
|
-
pageSize?: number;
|
|
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
|
-
*/
|
|
235
|
-
showFirstLast?: boolean;
|
|
236
|
-
/**
|
|
237
|
-
* 显示总数文本(`mini` 类型默认不显示)。
|
|
238
|
-
* @default true
|
|
239
|
-
*/
|
|
240
|
-
showTotal?: boolean;
|
|
241
|
-
/** 自定义总数渲染。 */
|
|
242
|
-
totalRender?: (total: number, range: [number, number]) => React.ReactNode;
|
|
243
|
-
/**
|
|
244
|
-
* `normal` 类型下,显示跳转输入框。
|
|
245
|
-
* @default false
|
|
246
|
-
*/
|
|
247
|
-
showJump?: boolean;
|
|
248
|
-
/**
|
|
249
|
-
* 中间显示几个页号。建议奇数。
|
|
250
|
-
* @default 5
|
|
251
|
-
*/
|
|
252
|
-
siblingCount?: number;
|
|
253
|
-
/** 容器 className。 */
|
|
254
|
-
className?: string;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* 高阶 Pagination — antd 风格 `total / pageSize / current / onChange` props 化用法,
|
|
259
|
-
* 自动计算页码窗口 + 折叠 ellipsis,并支持 `size` / `type` / `pageSizeSelector` 三档语义化扩展。
|
|
260
|
-
*
|
|
261
|
-
* 内部组合 `Pagination / PaginationContent / PaginationItem / PaginationLink /
|
|
262
|
-
* PaginationPrevious / PaginationNext / PaginationEllipsis` 这套 shadcn primitives,
|
|
263
|
-
* 业务方需要更细粒度时直接使用 primitives 自行拼装。
|
|
264
|
-
*/
|
|
265
|
-
const SimplePagination = ({
|
|
266
|
-
current,
|
|
267
|
-
defaultCurrent = 1,
|
|
268
|
-
onChange,
|
|
269
|
-
total,
|
|
270
|
-
pageSize,
|
|
271
|
-
defaultPageSize = 10,
|
|
272
|
-
pageSizeList = [10, 20, 50, 100],
|
|
273
|
-
pageSizeSelector = false,
|
|
274
|
-
onPageSizeChange,
|
|
275
|
-
size = 'md',
|
|
276
|
-
type = 'normal',
|
|
277
|
-
showFirstLast = false,
|
|
278
|
-
showTotal = true,
|
|
279
|
-
totalRender,
|
|
280
|
-
showJump = false,
|
|
281
|
-
siblingCount = 5,
|
|
282
|
-
className,
|
|
283
|
-
}: SimplePaginationProps) => {
|
|
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
|
-
};
|
|
315
|
-
|
|
316
|
-
const pages = React.useMemo(() => {
|
|
317
|
-
const half = Math.floor(siblingCount / 2);
|
|
318
|
-
let start = Math.max(1, page - half);
|
|
319
|
-
let end = Math.min(totalPages, start + siblingCount - 1);
|
|
320
|
-
if (end - start + 1 < siblingCount) {
|
|
321
|
-
start = Math.max(1, end - siblingCount + 1);
|
|
322
|
-
}
|
|
323
|
-
const arr: number[] = [];
|
|
324
|
-
for (let i = start; i <= end; i++) arr.push(i);
|
|
325
|
-
return arr;
|
|
326
|
-
}, [page, siblingCount, totalPages]);
|
|
327
|
-
|
|
328
|
-
const rangeStart = total === 0 ? 0 : (page - 1) * finalPageSize + 1;
|
|
329
|
-
const rangeEnd = Math.min(page * finalPageSize, total);
|
|
330
|
-
|
|
331
|
-
const showLeftEllipsis = (pages[0] ?? 1) > 2;
|
|
332
|
-
const showRightEllipsis =
|
|
333
|
-
(pages[pages.length - 1] ?? totalPages) < totalPages - 1;
|
|
334
|
-
|
|
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
|
-
);
|
|
346
|
-
|
|
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 = (
|
|
420
|
-
<Pagination className="mx-0 w-auto">
|
|
421
|
-
<PaginationContent>
|
|
422
|
-
{showFirstLast ? (
|
|
423
|
-
<PaginationItem>
|
|
424
|
-
<PaginationLink
|
|
425
|
-
aria-label="First"
|
|
426
|
-
size={size}
|
|
427
|
-
className="aspect-square px-0"
|
|
428
|
-
disabled={page === 1}
|
|
429
|
-
onClick={() => goto(1)}
|
|
430
|
-
>
|
|
431
|
-
<ChevronsLeft className="size-4" />
|
|
432
|
-
</PaginationLink>
|
|
433
|
-
</PaginationItem>
|
|
434
|
-
) : null}
|
|
435
|
-
<PaginationItem>
|
|
436
|
-
<PaginationPrevious
|
|
437
|
-
size={size}
|
|
438
|
-
iconOnly
|
|
439
|
-
disabled={page === 1}
|
|
440
|
-
onClick={() => goto(page - 1)}
|
|
441
|
-
/>
|
|
442
|
-
</PaginationItem>
|
|
443
|
-
{(pages[0] ?? 1) > 1 ? (
|
|
444
|
-
<PaginationItem>
|
|
445
|
-
<PaginationLink size={size} onClick={() => goto(1)}>
|
|
446
|
-
1
|
|
447
|
-
</PaginationLink>
|
|
448
|
-
</PaginationItem>
|
|
449
|
-
) : null}
|
|
450
|
-
{showLeftEllipsis ? (
|
|
451
|
-
<PaginationItem>
|
|
452
|
-
<PaginationEllipsis size={size} />
|
|
453
|
-
</PaginationItem>
|
|
454
|
-
) : null}
|
|
455
|
-
{pages.map((p) => (
|
|
456
|
-
<PaginationItem key={p}>
|
|
457
|
-
<PaginationLink
|
|
458
|
-
size={size}
|
|
459
|
-
isActive={p === page}
|
|
460
|
-
onClick={() => goto(p)}
|
|
461
|
-
>
|
|
462
|
-
{p}
|
|
463
|
-
</PaginationLink>
|
|
464
|
-
</PaginationItem>
|
|
465
|
-
))}
|
|
466
|
-
{showRightEllipsis ? (
|
|
467
|
-
<PaginationItem>
|
|
468
|
-
<PaginationEllipsis size={size} />
|
|
469
|
-
</PaginationItem>
|
|
470
|
-
) : null}
|
|
471
|
-
{(pages[pages.length - 1] ?? totalPages) < totalPages ? (
|
|
472
|
-
<PaginationItem>
|
|
473
|
-
<PaginationLink size={size} onClick={() => goto(totalPages)}>
|
|
474
|
-
{totalPages}
|
|
475
|
-
</PaginationLink>
|
|
476
|
-
</PaginationItem>
|
|
477
|
-
) : null}
|
|
478
|
-
<PaginationItem>
|
|
479
|
-
<PaginationNext
|
|
480
|
-
size={size}
|
|
481
|
-
iconOnly
|
|
482
|
-
disabled={page === totalPages}
|
|
483
|
-
onClick={() => goto(page + 1)}
|
|
484
|
-
/>
|
|
485
|
-
</PaginationItem>
|
|
486
|
-
{showFirstLast ? (
|
|
487
|
-
<PaginationItem>
|
|
488
|
-
<PaginationLink
|
|
489
|
-
aria-label="Last"
|
|
490
|
-
size={size}
|
|
491
|
-
className="aspect-square px-0"
|
|
492
|
-
disabled={page === totalPages}
|
|
493
|
-
onClick={() => goto(totalPages)}
|
|
494
|
-
>
|
|
495
|
-
<ChevronsRight className="size-4" />
|
|
496
|
-
</PaginationLink>
|
|
497
|
-
</PaginationItem>
|
|
498
|
-
) : null}
|
|
499
|
-
</PaginationContent>
|
|
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>
|
|
553
|
-
</div>
|
|
554
|
-
);
|
|
555
|
-
};
|
|
556
|
-
SimplePagination.displayName = 'SimplePagination';
|
|
557
|
-
|
|
558
|
-
export {
|
|
559
|
-
Pagination,
|
|
560
|
-
PaginationContent,
|
|
561
|
-
PaginationItem,
|
|
562
|
-
PaginationLink,
|
|
563
|
-
PaginationPrevious,
|
|
564
|
-
PaginationNext,
|
|
565
|
-
PaginationEllipsis,
|
|
566
|
-
SimplePagination,
|
|
567
|
-
};
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: popconfirm
|
|
3
|
-
name: Popconfirm
|
|
4
|
-
type: component
|
|
5
|
-
category: feedback
|
|
6
|
-
since: 0.1.0
|
|
7
|
-
package: '@teamix-evo/ui'
|
|
8
|
-
displayName: 气泡确认
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Popconfirm 气泡确认
|
|
12
|
-
|
|
13
|
-
轻量级确认弹层 — antd 独有补足。**等价 antd `Popconfirm`**。用于"小风险"操作的二次确认(删除一行、忽略某条通知),视觉比 `AlertDialog` 更轻、不阻塞页面;`onConfirm` 支持返回 Promise(等待时按钮自动 loading)。
|
|
14
|
-
|
|
15
|
-
## When to use
|
|
16
|
-
|
|
17
|
-
- 删除某一行 / 移除单个标签 / 取消订阅(影响小,可撤销)
|
|
18
|
-
- 列表行末"忽略"、"已读"等次级操作的确认
|
|
19
|
-
- 业务流程中"不希望误点"的轻量动作
|
|
20
|
-
|
|
21
|
-
## When NOT to use
|
|
22
|
-
|
|
23
|
-
- **高风险 / 不可逆操作**(注销账号、删除整库)→ `AlertDialog`(全屏阻塞)
|
|
24
|
-
- 无后果的纯展示 → `Tooltip` / `Popover`
|
|
25
|
-
- 长决策路径(需要填写理由)→ `Dialog` / `Drawer`
|
|
26
|
-
|
|
27
|
-
## Props
|
|
28
|
-
|
|
29
|
-
<!-- auto:props:begin -->
|
|
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` | – | – | 禁用(子节点点击不弹出)。 |
|
|
44
|
-
<!-- auto:props:end -->
|
|
45
|
-
|
|
46
|
-
## 依赖
|
|
47
|
-
|
|
48
|
-
<!-- auto:deps:begin -->
|
|
49
|
-
### 同库依赖
|
|
50
|
-
|
|
51
|
-
> `teamix-evo ui add popconfirm` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
52
|
-
|
|
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 命名统一) |
|
|
58
|
-
|
|
59
|
-
### npm 依赖
|
|
60
|
-
|
|
61
|
-
> 业务侧需要先 `pnpm add` / `npm install` 这些包。CLI 在 `ui add` 完成后会列出此提示。
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
pnpm add lucide-react@^0.460.0
|
|
65
|
-
```
|
|
66
|
-
<!-- auto:deps:end -->
|
|
67
|
-
|
|
68
|
-
## AI 生成纪律
|
|
69
|
-
|
|
70
|
-
- **`title` 短句直白**(动词开头)— "删除此评论?"/"取消订阅?";**不要**用模糊措辞
|
|
71
|
-
- **`description` 写后果**:"删除后无法恢复"/"取消后将停止收到通知";**不要**写废话
|
|
72
|
-
- **危险动作**:`okType="destructive"` 必须配合 destructive variant 视觉,与 `AlertDialog` 一致的语义
|
|
73
|
-
- **`onConfirm` 返回 Promise**:组件会自动给确认按钮加 loading,**不要**自己在 onConfirm 外再做 spinner
|
|
74
|
-
- **`disabled`** 直接返回 children,不挂监听 — 用于"按钮已经做了别的事"的场景
|
|
75
|
-
- **不要嵌套 Popconfirm**:两层确认极少合理,改用 AlertDialog
|
|
76
|
-
|
|
77
|
-
## Examples
|
|
78
|
-
|
|
79
|
-
```tsx
|
|
80
|
-
import { Popconfirm } from '@/components/ui/popconfirm';
|
|
81
|
-
import { Button } from '@/components/ui/button';
|
|
82
|
-
|
|
83
|
-
// 危险删除
|
|
84
|
-
<Popconfirm
|
|
85
|
-
title="删除此评论?"
|
|
86
|
-
description="删除后无法恢复"
|
|
87
|
-
okType="destructive"
|
|
88
|
-
okText="删除"
|
|
89
|
-
onConfirm={async () => {
|
|
90
|
-
await api.deleteComment(id);
|
|
91
|
-
toast.success('已删除');
|
|
92
|
-
}}
|
|
93
|
-
>
|
|
94
|
-
<Button variant="ghost" size="sm">删除</Button>
|
|
95
|
-
</Popconfirm>
|
|
96
|
-
|
|
97
|
-
// 普通确认
|
|
98
|
-
<Popconfirm
|
|
99
|
-
title="确认取消订阅?"
|
|
100
|
-
description="你将停止收到每日摘要邮件"
|
|
101
|
-
onConfirm={() => unsubscribe()}
|
|
102
|
-
>
|
|
103
|
-
<Button variant="outline">取消订阅</Button>
|
|
104
|
-
</Popconfirm>
|
|
105
|
-
|
|
106
|
-
// 自定义图标
|
|
107
|
-
<Popconfirm
|
|
108
|
-
title="重置筛选条件?"
|
|
109
|
-
icon={<RefreshCcw className="size-4 text-primary" />}
|
|
110
|
-
onConfirm={resetFilters}
|
|
111
|
-
>
|
|
112
|
-
<Button variant="ghost">重置</Button>
|
|
113
|
-
</Popconfirm>
|
|
114
|
-
```
|