@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
|
@@ -0,0 +1,580 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 分页 Pagination
|
|
3
|
+
*
|
|
4
|
+
* 展示分页导航,支持翻页、跳转和省略标识。
|
|
5
|
+
* 两套 API:
|
|
6
|
+
* 1. primitives(Pagination / Content / Item / Link / Previous / Next / Ellipsis)— 完全可组合
|
|
7
|
+
* 2. Pagination — props 化高阶封装,自动计算页码窗口 + 折叠 ellipsis
|
|
8
|
+
*
|
|
9
|
+
* @when
|
|
10
|
+
* - 数据列表条目过多需分页展示
|
|
11
|
+
* - 配合 Table / DataTable 组件使用
|
|
12
|
+
* - 内容流布局底部导航
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import * as React from 'react';
|
|
16
|
+
import {
|
|
17
|
+
ChevronLeftIcon,
|
|
18
|
+
ChevronRightIcon,
|
|
19
|
+
ChevronsLeftIcon,
|
|
20
|
+
ChevronsRightIcon,
|
|
21
|
+
MoreHorizontalIcon,
|
|
22
|
+
} from 'lucide-react';
|
|
23
|
+
|
|
24
|
+
import { cn } from '@/lib/utils';
|
|
25
|
+
import { Button } from '@/components/button';
|
|
26
|
+
import { Input } from '@/components/input';
|
|
27
|
+
import {
|
|
28
|
+
Select,
|
|
29
|
+
SelectContent,
|
|
30
|
+
SelectItem,
|
|
31
|
+
SelectTrigger,
|
|
32
|
+
SelectValue,
|
|
33
|
+
} from '@/components/select';
|
|
34
|
+
|
|
35
|
+
// ─── 尺寸映射 ────────────────────────────────────────────────────────────────
|
|
36
|
+
|
|
37
|
+
export type PaginationSize = 'sm' | 'md' | 'lg';
|
|
38
|
+
export type PaginationType = 'normal' | 'simple' | 'mini';
|
|
39
|
+
|
|
40
|
+
/** pagination size → Button/Input size */
|
|
41
|
+
const toComponentSize = (s: PaginationSize) =>
|
|
42
|
+
s === 'sm' ? 'sm' : s === 'lg' ? 'lg' : ('default' as const);
|
|
43
|
+
|
|
44
|
+
const sizeClass: Record<PaginationSize, string> = {
|
|
45
|
+
sm: 'text-xs',
|
|
46
|
+
md: 'text-xs',
|
|
47
|
+
lg: 'text-sm',
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const buttonHeightClass: Record<PaginationSize, string> = {
|
|
51
|
+
sm: 'size-6',
|
|
52
|
+
md: 'size-8',
|
|
53
|
+
lg: 'size-9',
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// ─── shadcn-style primitives ────────────────────────────────────────────────
|
|
57
|
+
|
|
58
|
+
/** 分页根容器(内部使用)。 */
|
|
59
|
+
function PaginationNav({ className, ...props }: React.ComponentProps<'nav'>) {
|
|
60
|
+
return (
|
|
61
|
+
<nav
|
|
62
|
+
role="navigation"
|
|
63
|
+
aria-label="pagination"
|
|
64
|
+
data-slot="pagination"
|
|
65
|
+
className={cn(
|
|
66
|
+
'mx-auto flex w-full items-center justify-center',
|
|
67
|
+
className,
|
|
68
|
+
)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** 分页项列表。 */
|
|
75
|
+
function PaginationContent({
|
|
76
|
+
className,
|
|
77
|
+
...props
|
|
78
|
+
}: React.ComponentProps<'ul'>) {
|
|
79
|
+
return (
|
|
80
|
+
<ul
|
|
81
|
+
data-slot="pagination-content"
|
|
82
|
+
className={cn('flex items-center gap-1', className)}
|
|
83
|
+
{...props}
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** 单个分页项包裹。 */
|
|
89
|
+
function PaginationItem({ ...props }: React.ComponentProps<'li'>) {
|
|
90
|
+
return <li data-slot="pagination-item" {...props} />;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
interface PaginationLinkProps
|
|
94
|
+
extends Omit<
|
|
95
|
+
React.ComponentProps<typeof Button>,
|
|
96
|
+
'size' | 'variant' | 'shape'
|
|
97
|
+
> {
|
|
98
|
+
/** 当前激活状态(高亮选中页)。 */
|
|
99
|
+
isActive?: boolean;
|
|
100
|
+
/** 尺寸。 @default "md" */
|
|
101
|
+
size?: PaginationSize;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** 可点击的分页链接/按钮。 */
|
|
105
|
+
function PaginationLink({
|
|
106
|
+
className,
|
|
107
|
+
isActive,
|
|
108
|
+
size = 'md',
|
|
109
|
+
...props
|
|
110
|
+
}: PaginationLinkProps) {
|
|
111
|
+
return (
|
|
112
|
+
<Button
|
|
113
|
+
aria-current={isActive ? 'page' : undefined}
|
|
114
|
+
data-slot="pagination-link"
|
|
115
|
+
data-active={isActive}
|
|
116
|
+
variant="ghost"
|
|
117
|
+
size={toComponentSize(size)}
|
|
118
|
+
className={cn(
|
|
119
|
+
// 让数字键近似方块: min-width = height
|
|
120
|
+
buttonHeightClass[size],
|
|
121
|
+
'min-w-0 p-0 tabular-nums',
|
|
122
|
+
isActive
|
|
123
|
+
? 'border border-primary bg-card text-primary hover:bg-card hover:text-primary'
|
|
124
|
+
: 'hover:bg-muted hover:text-foreground',
|
|
125
|
+
className,
|
|
126
|
+
)}
|
|
127
|
+
{...props}
|
|
128
|
+
/>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
interface PaginationNavProps
|
|
133
|
+
extends Omit<
|
|
134
|
+
React.ComponentProps<typeof Button>,
|
|
135
|
+
'size' | 'variant' | 'shape'
|
|
136
|
+
> {
|
|
137
|
+
/** 尺寸。 @default "md" */
|
|
138
|
+
size?: PaginationSize;
|
|
139
|
+
/** 仅显示图标(不显示文字)。 @default false */
|
|
140
|
+
iconOnly?: boolean;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** 上一页按钮。 */
|
|
144
|
+
function PaginationPrevious({
|
|
145
|
+
className,
|
|
146
|
+
size = 'md',
|
|
147
|
+
iconOnly = false,
|
|
148
|
+
children,
|
|
149
|
+
...props
|
|
150
|
+
}: PaginationNavProps) {
|
|
151
|
+
return (
|
|
152
|
+
<Button
|
|
153
|
+
aria-label="Go to previous page"
|
|
154
|
+
data-slot="pagination-previous"
|
|
155
|
+
variant="ghost"
|
|
156
|
+
size={toComponentSize(size)}
|
|
157
|
+
className={cn(
|
|
158
|
+
buttonHeightClass[size],
|
|
159
|
+
'min-w-0 p-0 text-muted-foreground hover:bg-muted hover:text-foreground',
|
|
160
|
+
iconOnly && 'aspect-square',
|
|
161
|
+
!iconOnly && 'gap-1 px-2.5',
|
|
162
|
+
className,
|
|
163
|
+
)}
|
|
164
|
+
{...props}
|
|
165
|
+
>
|
|
166
|
+
<ChevronLeftIcon className="size-4" />
|
|
167
|
+
{!iconOnly && (children ?? <span>上一页</span>)}
|
|
168
|
+
</Button>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** 下一页按钮。 */
|
|
173
|
+
function PaginationNext({
|
|
174
|
+
className,
|
|
175
|
+
size = 'md',
|
|
176
|
+
iconOnly = false,
|
|
177
|
+
children,
|
|
178
|
+
...props
|
|
179
|
+
}: PaginationNavProps) {
|
|
180
|
+
return (
|
|
181
|
+
<Button
|
|
182
|
+
aria-label="Go to next page"
|
|
183
|
+
data-slot="pagination-next"
|
|
184
|
+
variant="ghost"
|
|
185
|
+
size={toComponentSize(size)}
|
|
186
|
+
className={cn(
|
|
187
|
+
buttonHeightClass[size],
|
|
188
|
+
'min-w-0 p-0 text-muted-foreground hover:bg-muted hover:text-foreground',
|
|
189
|
+
iconOnly && 'aspect-square',
|
|
190
|
+
!iconOnly && 'gap-1 px-2.5',
|
|
191
|
+
className,
|
|
192
|
+
)}
|
|
193
|
+
{...props}
|
|
194
|
+
>
|
|
195
|
+
{!iconOnly && (children ?? <span>下一页</span>)}
|
|
196
|
+
<ChevronRightIcon className="size-4" />
|
|
197
|
+
</Button>
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/** 省略号标识。 */
|
|
202
|
+
function PaginationEllipsis({
|
|
203
|
+
className,
|
|
204
|
+
size = 'md',
|
|
205
|
+
...props
|
|
206
|
+
}: React.ComponentProps<'span'> & { size?: PaginationSize }) {
|
|
207
|
+
return (
|
|
208
|
+
<span
|
|
209
|
+
aria-hidden="true"
|
|
210
|
+
data-slot="pagination-ellipsis"
|
|
211
|
+
className={cn(
|
|
212
|
+
'flex items-center justify-center text-muted-foreground',
|
|
213
|
+
buttonHeightClass[size],
|
|
214
|
+
className,
|
|
215
|
+
)}
|
|
216
|
+
{...props}
|
|
217
|
+
>
|
|
218
|
+
<MoreHorizontalIcon className="size-4" />
|
|
219
|
+
<span className="sr-only">More pages</span>
|
|
220
|
+
</span>
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// ─── Pagination 高阶组件 ────────────────────────────────────────────────────
|
|
225
|
+
|
|
226
|
+
export interface PaginationProps {
|
|
227
|
+
/** 当前页(1-based,受控)。与 `defaultCurrent` 互斥。 */
|
|
228
|
+
current?: number;
|
|
229
|
+
/** 默认当前页(非受控)。 @default 1 */
|
|
230
|
+
defaultCurrent?: number;
|
|
231
|
+
/** 页码 / pageSize 变化回调。第二参为变化后的 pageSize。 */
|
|
232
|
+
onChange?: (page: number, pageSize: number) => void;
|
|
233
|
+
/** 总条数。 */
|
|
234
|
+
total: number;
|
|
235
|
+
/** 每页大小(受控)。与 `defaultPageSize` 互斥。 */
|
|
236
|
+
pageSize?: number;
|
|
237
|
+
/** 默认每页大小(非受控)。 @default 10 */
|
|
238
|
+
defaultPageSize?: number;
|
|
239
|
+
/** 每页大小可选项。 @default [10, 20, 50, 100] */
|
|
240
|
+
pageSizeOptions?: number[];
|
|
241
|
+
/** 显示每页大小选择器。 @default false */
|
|
242
|
+
showSizeChanger?: boolean;
|
|
243
|
+
/** pageSize 变化回调。 */
|
|
244
|
+
onPageSizeChange?: (pageSize: number) => void;
|
|
245
|
+
/** 组件大小: sm(h-6) / md(h-8) / lg(h-9)。 @default "md" */
|
|
246
|
+
size?: PaginationSize;
|
|
247
|
+
/** 组件类型: normal(完整) / simple(简化) / mini(极简)。 @default "normal" */
|
|
248
|
+
type?: PaginationType;
|
|
249
|
+
/** normal 类型下显示首末页快捷按钮。 @default false */
|
|
250
|
+
showFirstLast?: boolean;
|
|
251
|
+
/** 显示总数文本。 @default false */
|
|
252
|
+
showTotal?: boolean;
|
|
253
|
+
/** 自定义总数渲染。 */
|
|
254
|
+
totalRender?: (total: number, range: [number, number]) => React.ReactNode;
|
|
255
|
+
/** normal 类型下显示快速跳转输入框。 @default false */
|
|
256
|
+
showQuickJumper?: boolean;
|
|
257
|
+
/** 中间显示几个页号(建议奇数)。 @default 5 */
|
|
258
|
+
siblingCount?: number;
|
|
259
|
+
/** 容器 className。 */
|
|
260
|
+
className?: string;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Pagination — props 化用法,
|
|
265
|
+
* 自动计算页码窗口 + 折叠 ellipsis,支持 size / type / showSizeChanger。
|
|
266
|
+
*/
|
|
267
|
+
function Pagination({
|
|
268
|
+
current,
|
|
269
|
+
defaultCurrent = 1,
|
|
270
|
+
onChange,
|
|
271
|
+
total,
|
|
272
|
+
pageSize,
|
|
273
|
+
defaultPageSize = 10,
|
|
274
|
+
pageSizeOptions = [10, 20, 50, 100],
|
|
275
|
+
showSizeChanger = false,
|
|
276
|
+
onPageSizeChange,
|
|
277
|
+
size = 'md',
|
|
278
|
+
type = 'normal',
|
|
279
|
+
showFirstLast = false,
|
|
280
|
+
showTotal = false,
|
|
281
|
+
totalRender,
|
|
282
|
+
showQuickJumper = false,
|
|
283
|
+
siblingCount = 5,
|
|
284
|
+
className,
|
|
285
|
+
}: PaginationProps) {
|
|
286
|
+
const [innerCurrent, setInnerCurrent] = React.useState(defaultCurrent);
|
|
287
|
+
const [innerPageSize, setInnerPageSize] = React.useState(defaultPageSize);
|
|
288
|
+
|
|
289
|
+
const finalCurrent = current ?? innerCurrent;
|
|
290
|
+
const finalPageSize = pageSize ?? innerPageSize;
|
|
291
|
+
const totalPages = Math.max(1, Math.ceil(total / finalPageSize));
|
|
292
|
+
const page = Math.min(Math.max(1, finalCurrent), totalPages);
|
|
293
|
+
|
|
294
|
+
const goto = (n: number) => {
|
|
295
|
+
if (n < 1 || n > totalPages || n === page) return;
|
|
296
|
+
if (current === undefined) setInnerCurrent(n);
|
|
297
|
+
onChange?.(n, finalPageSize);
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
const handlePageSizeChange = (value: string) => {
|
|
301
|
+
const v = Number(value);
|
|
302
|
+
if (Number.isNaN(v)) return;
|
|
303
|
+
if (pageSize === undefined) setInnerPageSize(v);
|
|
304
|
+
if (current === undefined) setInnerCurrent(1);
|
|
305
|
+
onPageSizeChange?.(v);
|
|
306
|
+
onChange?.(1, v);
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
const [jumperVal, setJumperVal] = React.useState('');
|
|
310
|
+
const handleJumpKey = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
|
311
|
+
if (e.key !== 'Enter') return;
|
|
312
|
+
const v = Number(jumperVal);
|
|
313
|
+
if (Number.isFinite(v)) goto(v);
|
|
314
|
+
setJumperVal('');
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
const pages = React.useMemo(() => {
|
|
318
|
+
const half = Math.floor(siblingCount / 2);
|
|
319
|
+
let start = Math.max(1, page - half);
|
|
320
|
+
const end = Math.min(totalPages, start + siblingCount - 1);
|
|
321
|
+
if (end - start + 1 < siblingCount) {
|
|
322
|
+
start = Math.max(1, end - siblingCount + 1);
|
|
323
|
+
}
|
|
324
|
+
const arr: number[] = [];
|
|
325
|
+
for (let i = start; i <= end; i++) arr.push(i);
|
|
326
|
+
return arr;
|
|
327
|
+
}, [page, siblingCount, totalPages]);
|
|
328
|
+
|
|
329
|
+
const rangeStart = total === 0 ? 0 : (page - 1) * finalPageSize + 1;
|
|
330
|
+
const rangeEnd = Math.min(page * finalPageSize, total);
|
|
331
|
+
|
|
332
|
+
const showLeftEllipsis = (pages[0] ?? 1) > 2;
|
|
333
|
+
const showRightEllipsis =
|
|
334
|
+
(pages[pages.length - 1] ?? totalPages) < totalPages - 1;
|
|
335
|
+
|
|
336
|
+
// ─── 总数文本 ─────────────────────────────────────────────────────────────
|
|
337
|
+
const totalNode =
|
|
338
|
+
showTotal && type !== 'mini' ? (
|
|
339
|
+
<p className={cn('text-muted-foreground tabular-nums', sizeClass[size])}>
|
|
340
|
+
{totalRender
|
|
341
|
+
? totalRender(total, [rangeStart, rangeEnd])
|
|
342
|
+
: `共 ${total} 条`}
|
|
343
|
+
</p>
|
|
344
|
+
) : null;
|
|
345
|
+
|
|
346
|
+
// ─── 主体 ─────────────────────────────────────────────────────────────────
|
|
347
|
+
let body: React.ReactNode;
|
|
348
|
+
|
|
349
|
+
if (type === 'mini') {
|
|
350
|
+
body = (
|
|
351
|
+
<PaginationNav className="mx-0 w-auto">
|
|
352
|
+
<PaginationContent>
|
|
353
|
+
<PaginationItem>
|
|
354
|
+
<PaginationPrevious
|
|
355
|
+
size={size}
|
|
356
|
+
iconOnly
|
|
357
|
+
disabled={page === 1}
|
|
358
|
+
onClick={() => goto(page - 1)}
|
|
359
|
+
/>
|
|
360
|
+
</PaginationItem>
|
|
361
|
+
<PaginationItem>
|
|
362
|
+
<PaginationNext
|
|
363
|
+
size={size}
|
|
364
|
+
iconOnly
|
|
365
|
+
disabled={page === totalPages}
|
|
366
|
+
onClick={() => goto(page + 1)}
|
|
367
|
+
/>
|
|
368
|
+
</PaginationItem>
|
|
369
|
+
</PaginationContent>
|
|
370
|
+
</PaginationNav>
|
|
371
|
+
);
|
|
372
|
+
} else if (type === 'simple') {
|
|
373
|
+
body = (
|
|
374
|
+
<PaginationNav className="mx-0 w-auto">
|
|
375
|
+
<PaginationContent>
|
|
376
|
+
<PaginationItem>
|
|
377
|
+
<PaginationPrevious
|
|
378
|
+
size={size}
|
|
379
|
+
iconOnly
|
|
380
|
+
disabled={page === 1}
|
|
381
|
+
onClick={() => goto(page - 1)}
|
|
382
|
+
/>
|
|
383
|
+
</PaginationItem>
|
|
384
|
+
<PaginationItem>
|
|
385
|
+
<span
|
|
386
|
+
className={cn(
|
|
387
|
+
'flex items-center gap-1 px-2 tabular-nums',
|
|
388
|
+
sizeClass[size],
|
|
389
|
+
)}
|
|
390
|
+
>
|
|
391
|
+
<span className="text-foreground">{page}</span>
|
|
392
|
+
<span className="text-muted-foreground">/</span>
|
|
393
|
+
<span className="text-muted-foreground">{totalPages}</span>
|
|
394
|
+
</span>
|
|
395
|
+
</PaginationItem>
|
|
396
|
+
<PaginationItem>
|
|
397
|
+
<PaginationNext
|
|
398
|
+
size={size}
|
|
399
|
+
iconOnly
|
|
400
|
+
disabled={page === totalPages}
|
|
401
|
+
onClick={() => goto(page + 1)}
|
|
402
|
+
/>
|
|
403
|
+
</PaginationItem>
|
|
404
|
+
</PaginationContent>
|
|
405
|
+
</PaginationNav>
|
|
406
|
+
);
|
|
407
|
+
} else {
|
|
408
|
+
body = (
|
|
409
|
+
<PaginationNav className="mx-0 w-auto">
|
|
410
|
+
<PaginationContent>
|
|
411
|
+
{showFirstLast && (
|
|
412
|
+
<PaginationItem>
|
|
413
|
+
<PaginationLink
|
|
414
|
+
aria-label="First"
|
|
415
|
+
size={size}
|
|
416
|
+
disabled={page === 1}
|
|
417
|
+
onClick={() => goto(1)}
|
|
418
|
+
>
|
|
419
|
+
<ChevronsLeftIcon className="size-4" />
|
|
420
|
+
</PaginationLink>
|
|
421
|
+
</PaginationItem>
|
|
422
|
+
)}
|
|
423
|
+
<PaginationItem>
|
|
424
|
+
<PaginationPrevious
|
|
425
|
+
size={size}
|
|
426
|
+
iconOnly
|
|
427
|
+
disabled={page === 1}
|
|
428
|
+
onClick={() => goto(page - 1)}
|
|
429
|
+
/>
|
|
430
|
+
</PaginationItem>
|
|
431
|
+
{(pages[0] ?? 1) > 1 && (
|
|
432
|
+
<PaginationItem>
|
|
433
|
+
<PaginationLink size={size} onClick={() => goto(1)}>
|
|
434
|
+
1
|
|
435
|
+
</PaginationLink>
|
|
436
|
+
</PaginationItem>
|
|
437
|
+
)}
|
|
438
|
+
{showLeftEllipsis && (
|
|
439
|
+
<PaginationItem>
|
|
440
|
+
<PaginationEllipsis size={size} />
|
|
441
|
+
</PaginationItem>
|
|
442
|
+
)}
|
|
443
|
+
{pages.map((p) => (
|
|
444
|
+
<PaginationItem key={p}>
|
|
445
|
+
<PaginationLink
|
|
446
|
+
size={size}
|
|
447
|
+
isActive={p === page}
|
|
448
|
+
onClick={() => goto(p)}
|
|
449
|
+
>
|
|
450
|
+
{p}
|
|
451
|
+
</PaginationLink>
|
|
452
|
+
</PaginationItem>
|
|
453
|
+
))}
|
|
454
|
+
{showRightEllipsis && (
|
|
455
|
+
<PaginationItem>
|
|
456
|
+
<PaginationEllipsis size={size} />
|
|
457
|
+
</PaginationItem>
|
|
458
|
+
)}
|
|
459
|
+
{(pages[pages.length - 1] ?? totalPages) < totalPages && (
|
|
460
|
+
<PaginationItem>
|
|
461
|
+
<PaginationLink size={size} onClick={() => goto(totalPages)}>
|
|
462
|
+
{totalPages}
|
|
463
|
+
</PaginationLink>
|
|
464
|
+
</PaginationItem>
|
|
465
|
+
)}
|
|
466
|
+
<PaginationItem>
|
|
467
|
+
<PaginationNext
|
|
468
|
+
size={size}
|
|
469
|
+
iconOnly
|
|
470
|
+
disabled={page === totalPages}
|
|
471
|
+
onClick={() => goto(page + 1)}
|
|
472
|
+
/>
|
|
473
|
+
</PaginationItem>
|
|
474
|
+
{showFirstLast && (
|
|
475
|
+
<PaginationItem>
|
|
476
|
+
<PaginationLink
|
|
477
|
+
aria-label="Last"
|
|
478
|
+
size={size}
|
|
479
|
+
disabled={page === totalPages}
|
|
480
|
+
onClick={() => goto(totalPages)}
|
|
481
|
+
>
|
|
482
|
+
<ChevronsRightIcon className="size-4" />
|
|
483
|
+
</PaginationLink>
|
|
484
|
+
</PaginationItem>
|
|
485
|
+
)}
|
|
486
|
+
</PaginationContent>
|
|
487
|
+
{/* 页码指示器 */}
|
|
488
|
+
<span
|
|
489
|
+
className={cn(
|
|
490
|
+
'ml-2 tabular-nums text-muted-foreground',
|
|
491
|
+
sizeClass[size],
|
|
492
|
+
)}
|
|
493
|
+
>
|
|
494
|
+
{page}/{totalPages}
|
|
495
|
+
</span>
|
|
496
|
+
</PaginationNav>
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
// ─── 附加区域(pageSizeSelector / 跳转)仅 normal 生效 ─────────────────────
|
|
501
|
+
const showAddons = type === 'normal' && (showSizeChanger || showQuickJumper);
|
|
502
|
+
|
|
503
|
+
const addons = showAddons ? (
|
|
504
|
+
<div className={cn('flex items-center gap-2', sizeClass[size])}>
|
|
505
|
+
{showSizeChanger && (
|
|
506
|
+
<Select
|
|
507
|
+
value={String(finalPageSize)}
|
|
508
|
+
onValueChange={handlePageSizeChange}
|
|
509
|
+
>
|
|
510
|
+
<SelectTrigger
|
|
511
|
+
size={size === 'sm' ? 'sm' : 'default'}
|
|
512
|
+
aria-label="每页显示"
|
|
513
|
+
>
|
|
514
|
+
<SelectValue />
|
|
515
|
+
</SelectTrigger>
|
|
516
|
+
<SelectContent>
|
|
517
|
+
{pageSizeOptions.map((opt) => (
|
|
518
|
+
<SelectItem key={opt} value={String(opt)}>
|
|
519
|
+
{opt} 条/页
|
|
520
|
+
</SelectItem>
|
|
521
|
+
))}
|
|
522
|
+
</SelectContent>
|
|
523
|
+
</Select>
|
|
524
|
+
)}
|
|
525
|
+
{showQuickJumper && (
|
|
526
|
+
<span className="inline-flex items-center gap-2 text-muted-foreground">
|
|
527
|
+
到第
|
|
528
|
+
<Input
|
|
529
|
+
size={size === 'sm' ? 'sm' : size === 'lg' ? 'lg' : 'default'}
|
|
530
|
+
inputMode="numeric"
|
|
531
|
+
value={jumperVal}
|
|
532
|
+
onChange={(e) => setJumperVal(e.target.value)}
|
|
533
|
+
onKeyDown={handleJumpKey}
|
|
534
|
+
className="w-12 text-center tabular-nums"
|
|
535
|
+
aria-label="跳转到页"
|
|
536
|
+
/>
|
|
537
|
+
页
|
|
538
|
+
<Button
|
|
539
|
+
variant="outline"
|
|
540
|
+
size={toComponentSize(size)}
|
|
541
|
+
className="text-foreground hover:text-foreground"
|
|
542
|
+
onClick={() => {
|
|
543
|
+
const v = Number(jumperVal);
|
|
544
|
+
if (Number.isFinite(v)) goto(v);
|
|
545
|
+
setJumperVal('');
|
|
546
|
+
}}
|
|
547
|
+
>
|
|
548
|
+
确定
|
|
549
|
+
</Button>
|
|
550
|
+
</span>
|
|
551
|
+
)}
|
|
552
|
+
</div>
|
|
553
|
+
) : null;
|
|
554
|
+
|
|
555
|
+
return (
|
|
556
|
+
<div
|
|
557
|
+
className={cn(
|
|
558
|
+
'flex w-full flex-wrap items-center justify-end gap-3',
|
|
559
|
+
className,
|
|
560
|
+
)}
|
|
561
|
+
>
|
|
562
|
+
{totalNode}
|
|
563
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
564
|
+
{body}
|
|
565
|
+
{addons}
|
|
566
|
+
</div>
|
|
567
|
+
</div>
|
|
568
|
+
);
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
export {
|
|
572
|
+
Pagination,
|
|
573
|
+
PaginationContent,
|
|
574
|
+
PaginationEllipsis,
|
|
575
|
+
PaginationItem,
|
|
576
|
+
PaginationLink,
|
|
577
|
+
PaginationNav,
|
|
578
|
+
PaginationNext,
|
|
579
|
+
PaginationPrevious,
|
|
580
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Pagination
|
|
2
|
+
|
|
3
|
+
> 本文件由 `pnpm gen:meta` 自动生成,**请勿手动编辑**。
|
|
4
|
+
|
|
5
|
+
## 描述
|
|
6
|
+
|
|
7
|
+
分页 Pagination
|
|
8
|
+
展示分页导航,支持翻页、跳转和省略标识。
|
|
9
|
+
两套 API:
|
|
10
|
+
1. primitives(Pagination / Content / Item / Link / Previous / Next / Ellipsis)— 完全可组合
|
|
11
|
+
2. Pagination — props 化高阶封装,自动计算页码窗口 + 折叠 ellipsis
|
|
12
|
+
|
|
13
|
+
## 使用场景
|
|
14
|
+
|
|
15
|
+
- 数据列表条目过多需分页展示
|
|
16
|
+
- 配合 Table / DataTable 组件使用
|
|
17
|
+
- 内容流布局底部导航
|
|
18
|
+
|
|
19
|
+
## Props
|
|
20
|
+
|
|
21
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
22
|
+
| --- | --- | --- | --- | --- |
|
|
23
|
+
| `current` | `number` | – | – | 当前页(1-based,受控)。与 `defaultCurrent` 互斥。 |
|
|
24
|
+
| `defaultCurrent` | `number` | `1` | – | 默认当前页(非受控)。 |
|
|
25
|
+
| `onChange` | `(page: number, pageSize: number) => void` | – | – | 页码 / pageSize 变化回调。第二参为变化后的 pageSize。 |
|
|
26
|
+
| `total` | `number` | – | ✓ | 总条数。 |
|
|
27
|
+
| `pageSize` | `number` | – | – | 每页大小(受控)。与 `defaultPageSize` 互斥。 |
|
|
28
|
+
| `defaultPageSize` | `number` | `10` | – | 默认每页大小(非受控)。 |
|
|
29
|
+
| `pageSizeOptions` | `number[]` | `[10, 20, 50, 100]` | – | 每页大小可选项。 |
|
|
30
|
+
| `showSizeChanger` | `boolean` | `false` | – | 显示每页大小选择器。 |
|
|
31
|
+
| `onPageSizeChange` | `(pageSize: number) => void` | – | – | pageSize 变化回调。 |
|
|
32
|
+
| `size` | `PaginationSize` | `"md"` | – | 组件大小: sm(h-6) / md(h-8) / lg(h-9)。 |
|
|
33
|
+
| `type` | `PaginationType` | `"normal"` | – | 组件类型: normal(完整) / simple(简化) / mini(极简)。 |
|
|
34
|
+
| `showFirstLast` | `boolean` | `false` | – | normal 类型下显示首末页快捷按钮。 |
|
|
35
|
+
| `showTotal` | `boolean` | `false` | – | 显示总数文本。 |
|
|
36
|
+
| `totalRender` | `(total: number, range: [number, number]) => React.ReactNode` | – | – | 自定义总数渲染。 |
|
|
37
|
+
| `showQuickJumper` | `boolean` | `false` | – | normal 类型下显示快速跳转输入框。 |
|
|
38
|
+
| `siblingCount` | `number` | `5` | – | 中间显示几个页号(建议奇数)。 |
|
|
39
|
+
| `className` | `string` | – | – | 容器 className。 |
|