@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,299 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 徽标 Badge
|
|
3
|
+
*
|
|
4
|
+
* 用于状态标识、计数提醒或角标指示。单组件支持四种形态:
|
|
5
|
+
* - **Label**:内联文本徽标(`<Badge>进行中</Badge>`),通过 `variant` 切换底色风格。
|
|
6
|
+
* - **Wrapped**:包裹目标元素,在右上角浮一个 `count` 数字胶囊或小红点(`<Badge count={5}><Avatar /></Badge>`)。
|
|
7
|
+
* - **Standalone**:不传 children,单独渲染数字胶囊或小红点(`<Badge count={25} />` / `<Badge dot />`)。
|
|
8
|
+
* - **Status**:语义状态点 + 文本(`<Badge status="processing">运行中</Badge>`),processing 带脉冲动画。
|
|
9
|
+
*
|
|
10
|
+
* 形态自动判定:传入 `status` / `dot` / `count` / `content` 时进入指示器形态,否则为 label。
|
|
11
|
+
*
|
|
12
|
+
* @when
|
|
13
|
+
* - 头像 / 图标 / 链接右上角的未读数 / 新消息红点
|
|
14
|
+
* - 列表项末尾的状态文本(进行中 / 已完成)
|
|
15
|
+
* - 任务 / 资源 5 档语义状态点
|
|
16
|
+
* - 顶栏图标的小红点提醒
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import * as React from 'react';
|
|
20
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
21
|
+
import { Slot } from 'radix-ui';
|
|
22
|
+
|
|
23
|
+
import { cn } from '@/lib/utils';
|
|
24
|
+
|
|
25
|
+
// ─── Label cva(与 v1 完全一致,保证向后兼容) ──────────────────────────
|
|
26
|
+
const badgeVariants = cva(
|
|
27
|
+
'group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&>svg]:pointer-events-none [&>svg]:size-3!',
|
|
28
|
+
{
|
|
29
|
+
variants: {
|
|
30
|
+
variant: {
|
|
31
|
+
default: 'bg-primary text-primary-foreground [a]:hover:bg-primary/80',
|
|
32
|
+
secondary:
|
|
33
|
+
'bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80',
|
|
34
|
+
destructive:
|
|
35
|
+
'bg-destructive/10 text-destructive focus-visible:ring-destructive/20 [a]:hover:bg-destructive/20',
|
|
36
|
+
outline:
|
|
37
|
+
'border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground',
|
|
38
|
+
ghost: 'hover:bg-muted hover:text-muted-foreground',
|
|
39
|
+
link: 'text-primary',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
defaultVariants: { variant: 'default' },
|
|
43
|
+
},
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
// ─── Status 5 档(对齐 antd / cloud-design 语义) ──────────────────────
|
|
47
|
+
export type BadgeStatus =
|
|
48
|
+
| 'default'
|
|
49
|
+
| 'processing'
|
|
50
|
+
| 'success'
|
|
51
|
+
| 'warning'
|
|
52
|
+
| 'error';
|
|
53
|
+
|
|
54
|
+
const STATUS_TOKEN_MAP: Record<BadgeStatus, string> = {
|
|
55
|
+
default: 'var(--color-muted-foreground)',
|
|
56
|
+
processing: 'var(--color-primary)',
|
|
57
|
+
success: 'var(--color-success)',
|
|
58
|
+
warning: 'var(--color-warning)',
|
|
59
|
+
error: 'var(--color-destructive)',
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// ─── Props ─────────────────────────────────────────────────────────────
|
|
63
|
+
export interface BadgeProps
|
|
64
|
+
extends Omit<React.ComponentProps<'span'>, 'content'>,
|
|
65
|
+
VariantProps<typeof badgeVariants> {
|
|
66
|
+
/** 使用 Slot 模式渲染(仅 label 形态生效) */
|
|
67
|
+
asChild?: boolean;
|
|
68
|
+
/** 数字内容;为 0 且 `showZero=false` 时不渲染 indicator */
|
|
69
|
+
count?: number;
|
|
70
|
+
/** count 封顶值,超出显示为 `${overflowCount}+`(默认 99) */
|
|
71
|
+
overflowCount?: number;
|
|
72
|
+
/** count 为 0 时是否仍显示 indicator(默认 false) */
|
|
73
|
+
showZero?: boolean;
|
|
74
|
+
/** 仅显示小红点(不显示数字) */
|
|
75
|
+
dot?: boolean;
|
|
76
|
+
/** 状态语义点;与 count / dot 互斥,触发 status 形态 */
|
|
77
|
+
status?: BadgeStatus;
|
|
78
|
+
/** 自定义 indicator 颜色(CSS 颜色字面量),覆盖 status / 默认红 */
|
|
79
|
+
color?: string;
|
|
80
|
+
/** 自定义 indicator 内容(图标 / 文本),优先级高于 count / dot */
|
|
81
|
+
content?: React.ReactNode;
|
|
82
|
+
/** indicator 像素偏移 [x, y],仅 wrapped 模式生效 */
|
|
83
|
+
offset?: [number, number];
|
|
84
|
+
/** indicator 尺寸(默认 default) */
|
|
85
|
+
size?: 'sm' | 'default';
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// ─── 形态分流工具 ──────────────────────────────────────────────────────
|
|
89
|
+
type IndicatorKind = 'status' | 'dot' | 'count' | 'content' | null;
|
|
90
|
+
|
|
91
|
+
function resolveKind(props: {
|
|
92
|
+
status?: BadgeStatus;
|
|
93
|
+
dot?: boolean;
|
|
94
|
+
count?: number;
|
|
95
|
+
content?: React.ReactNode;
|
|
96
|
+
}): IndicatorKind {
|
|
97
|
+
if (props.status) return 'status';
|
|
98
|
+
if (props.dot) return 'dot';
|
|
99
|
+
if (props.count != null) return 'count';
|
|
100
|
+
if (props.content != null) return 'content';
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function formatCount(count: number, overflowCount: number): string {
|
|
105
|
+
return count > overflowCount ? `${overflowCount}+` : String(count);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// ─── Indicator 子节点(wrapped / standalone 共用) ──────────────────────
|
|
109
|
+
interface IndicatorProps {
|
|
110
|
+
kind: Exclude<IndicatorKind, null | 'status'>;
|
|
111
|
+
size: 'sm' | 'default';
|
|
112
|
+
color?: string;
|
|
113
|
+
content?: React.ReactNode;
|
|
114
|
+
countText?: string;
|
|
115
|
+
/** 是否处于 wrapped 模式(影响 ring + 绝对定位) */
|
|
116
|
+
wrapped: boolean;
|
|
117
|
+
offset?: [number, number];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function Indicator({
|
|
121
|
+
kind,
|
|
122
|
+
size,
|
|
123
|
+
color,
|
|
124
|
+
content,
|
|
125
|
+
countText,
|
|
126
|
+
wrapped,
|
|
127
|
+
offset,
|
|
128
|
+
}: IndicatorProps) {
|
|
129
|
+
const isDot = kind === 'dot';
|
|
130
|
+
const isContent = kind === 'content';
|
|
131
|
+
|
|
132
|
+
const style: React.CSSProperties = {};
|
|
133
|
+
if (color) style.backgroundColor = color;
|
|
134
|
+
if (wrapped && offset) {
|
|
135
|
+
const [x, y] = offset;
|
|
136
|
+
style.transform = `translate(calc(50% + ${x}px), calc(-50% + ${y}px))`;
|
|
137
|
+
}
|
|
138
|
+
// content 形态:让用户完全自定义底色(透明 / 自定义),不强制 destructive
|
|
139
|
+
if (isContent && !color) style.backgroundColor = 'transparent';
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<span
|
|
143
|
+
data-slot="badge-indicator"
|
|
144
|
+
data-indicator-kind={kind}
|
|
145
|
+
data-size={size}
|
|
146
|
+
className={cn(
|
|
147
|
+
'pointer-events-none inline-flex items-center justify-center rounded-full font-medium leading-none select-none',
|
|
148
|
+
// 默认色(content 形态走透明,由 color / 自定义 className 决定)
|
|
149
|
+
!isContent && 'bg-destructive text-destructive-foreground',
|
|
150
|
+
// content 形态 + 有色非透明底 → 白色文字
|
|
151
|
+
isContent &&
|
|
152
|
+
color &&
|
|
153
|
+
color !== 'transparent' &&
|
|
154
|
+
'text-destructive-foreground',
|
|
155
|
+
// 尺寸
|
|
156
|
+
isDot
|
|
157
|
+
? size === 'sm'
|
|
158
|
+
? 'size-1.5'
|
|
159
|
+
: 'size-2'
|
|
160
|
+
: size === 'sm'
|
|
161
|
+
? 'h-3.5 min-w-3.5 px-1 text-xs'
|
|
162
|
+
: 'h-4 min-w-4 px-1 text-xs',
|
|
163
|
+
// wrapped 模式:绝对定位 + ring 描边
|
|
164
|
+
wrapped &&
|
|
165
|
+
'absolute top-0 right-0 z-10 origin-center -translate-y-1/2 translate-x-1/2 ring-2 ring-background',
|
|
166
|
+
)}
|
|
167
|
+
style={style}
|
|
168
|
+
>
|
|
169
|
+
{isContent ? content : isDot ? null : countText}
|
|
170
|
+
</span>
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// ─── 主组件 ────────────────────────────────────────────────────────────
|
|
175
|
+
function Badge({
|
|
176
|
+
className,
|
|
177
|
+
variant = 'default',
|
|
178
|
+
asChild = false,
|
|
179
|
+
count,
|
|
180
|
+
overflowCount = 99,
|
|
181
|
+
showZero = false,
|
|
182
|
+
dot,
|
|
183
|
+
status,
|
|
184
|
+
color,
|
|
185
|
+
content,
|
|
186
|
+
offset,
|
|
187
|
+
size = 'default',
|
|
188
|
+
children,
|
|
189
|
+
...props
|
|
190
|
+
}: BadgeProps) {
|
|
191
|
+
const kind = resolveKind({ status, dot, count, content });
|
|
192
|
+
|
|
193
|
+
// ─── 1. Label 模式(向后兼容) ──────────────────────────────────────
|
|
194
|
+
if (kind === null) {
|
|
195
|
+
const Comp = asChild ? Slot.Root : 'span';
|
|
196
|
+
return (
|
|
197
|
+
<Comp
|
|
198
|
+
data-slot="badge"
|
|
199
|
+
data-mode="label"
|
|
200
|
+
data-variant={variant}
|
|
201
|
+
data-size={size}
|
|
202
|
+
className={cn(badgeVariants({ variant }), className)}
|
|
203
|
+
{...props}
|
|
204
|
+
>
|
|
205
|
+
{children}
|
|
206
|
+
</Comp>
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// ─── 2. Status 模式:内联 [dot] [text] ─────────────────────────────
|
|
211
|
+
if (kind === 'status') {
|
|
212
|
+
const dotColor = color ?? STATUS_TOKEN_MAP[status!];
|
|
213
|
+
return (
|
|
214
|
+
<span
|
|
215
|
+
data-slot="badge"
|
|
216
|
+
data-mode="status"
|
|
217
|
+
data-status={status}
|
|
218
|
+
data-size={size}
|
|
219
|
+
className={cn(
|
|
220
|
+
'inline-flex items-center gap-1.5 text-xs whitespace-nowrap',
|
|
221
|
+
className,
|
|
222
|
+
)}
|
|
223
|
+
{...props}
|
|
224
|
+
>
|
|
225
|
+
<span
|
|
226
|
+
data-slot="badge-indicator"
|
|
227
|
+
data-indicator-kind="status"
|
|
228
|
+
className={cn(
|
|
229
|
+
'relative inline-flex shrink-0 rounded-full',
|
|
230
|
+
size === 'sm' ? 'size-1.5' : 'size-2',
|
|
231
|
+
)}
|
|
232
|
+
>
|
|
233
|
+
{status === 'processing' && (
|
|
234
|
+
<span
|
|
235
|
+
aria-hidden
|
|
236
|
+
className="absolute inset-0 inline-flex animate-ping rounded-full opacity-75"
|
|
237
|
+
style={{ backgroundColor: dotColor }}
|
|
238
|
+
/>
|
|
239
|
+
)}
|
|
240
|
+
<span
|
|
241
|
+
aria-hidden
|
|
242
|
+
className="relative inline-flex size-full rounded-full"
|
|
243
|
+
style={{ backgroundColor: dotColor }}
|
|
244
|
+
/>
|
|
245
|
+
</span>
|
|
246
|
+
{children}
|
|
247
|
+
</span>
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// ─── 3. Count / Dot / Content 形态(wrapped 或 standalone) ────────
|
|
252
|
+
// count = 0 且 showZero=false → 不渲染 indicator
|
|
253
|
+
const hideZero = kind === 'count' && (count ?? 0) === 0 && !showZero;
|
|
254
|
+
const countText =
|
|
255
|
+
kind === 'count' ? formatCount(count ?? 0, overflowCount) : undefined;
|
|
256
|
+
|
|
257
|
+
const hasChildren = React.Children.count(children) > 0;
|
|
258
|
+
|
|
259
|
+
// 3a. Wrapped 模式(有 children)
|
|
260
|
+
if (hasChildren) {
|
|
261
|
+
return (
|
|
262
|
+
<span
|
|
263
|
+
data-slot="badge"
|
|
264
|
+
data-mode="wrapped"
|
|
265
|
+
data-size={size}
|
|
266
|
+
className={cn('relative inline-flex', className)}
|
|
267
|
+
{...props}
|
|
268
|
+
>
|
|
269
|
+
{children}
|
|
270
|
+
{!hideZero && (
|
|
271
|
+
<Indicator
|
|
272
|
+
kind={kind}
|
|
273
|
+
size={size}
|
|
274
|
+
color={color}
|
|
275
|
+
content={content}
|
|
276
|
+
countText={countText}
|
|
277
|
+
wrapped
|
|
278
|
+
offset={offset}
|
|
279
|
+
/>
|
|
280
|
+
)}
|
|
281
|
+
</span>
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// 3b. Standalone 模式(无 children)
|
|
286
|
+
if (hideZero) return null;
|
|
287
|
+
return (
|
|
288
|
+
<Indicator
|
|
289
|
+
kind={kind}
|
|
290
|
+
size={size}
|
|
291
|
+
color={color}
|
|
292
|
+
content={content}
|
|
293
|
+
countText={countText}
|
|
294
|
+
wrapped={false}
|
|
295
|
+
/>
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# Badge
|
|
2
|
+
|
|
3
|
+
> 本文件由 `pnpm gen:meta` 自动生成,**请勿手动编辑**。
|
|
4
|
+
|
|
5
|
+
## 描述
|
|
6
|
+
|
|
7
|
+
徽标 Badge
|
|
8
|
+
用于状态标识、计数提醒或角标指示。单组件支持四种形态:
|
|
9
|
+
- **Label**:内联文本徽标(`<Badge>进行中</Badge>`),通过 `variant` 切换底色风格。
|
|
10
|
+
- **Wrapped**:包裹目标元素,在右上角浮一个 `count` 数字胶囊或小红点(`<Badge count={5}><Avatar /></Badge>`)。
|
|
11
|
+
- **Standalone**:不传 children,单独渲染数字胶囊或小红点(`<Badge count={25} />` / `<Badge dot />`)。
|
|
12
|
+
- **Status**:语义状态点 + 文本(`<Badge status="processing">运行中</Badge>`),processing 带脉冲动画。
|
|
13
|
+
形态自动判定:传入 `status` / `dot` / `count` / `content` 时进入指示器形态,否则为 label。
|
|
14
|
+
|
|
15
|
+
## 使用场景
|
|
16
|
+
|
|
17
|
+
- 头像 / 图标 / 链接右上角的未读数 / 新消息红点
|
|
18
|
+
- 列表项末尾的状态文本(进行中 / 已完成)
|
|
19
|
+
- 任务 / 资源 5 档语义状态点
|
|
20
|
+
- 顶栏图标的小红点提醒
|
|
21
|
+
|
|
22
|
+
## Props
|
|
23
|
+
|
|
24
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
25
|
+
| --- | --- | --- | --- | --- |
|
|
26
|
+
| `variant` | `"default" \| "secondary" \| "destructive" \| "outline" \| "ghost" \| "link"` | `"default"` | – | – |
|
|
27
|
+
| `asChild` | `boolean` | – | – | 使用 Slot 模式渲染(仅 label 形态生效) |
|
|
28
|
+
| `count` | `number` | – | – | 数字内容;为 0 且 `showZero=false` 时不渲染 indicator |
|
|
29
|
+
| `overflowCount` | `number` | – | – | count 封顶值,超出显示为 `${overflowCount}+`(默认 99) |
|
|
30
|
+
| `showZero` | `boolean` | – | – | count 为 0 时是否仍显示 indicator(默认 false) |
|
|
31
|
+
| `dot` | `boolean` | – | – | 仅显示小红点(不显示数字) |
|
|
32
|
+
| `status` | `BadgeStatus` | – | – | 状态语义点;与 count / dot 互斥,触发 status 形态 |
|
|
33
|
+
| `color` | `string` | – | – | 自定义 indicator 颜色(CSS 颜色字面量),覆盖 status / 默认红 |
|
|
34
|
+
| `content` | `React.ReactNode` | – | – | 自定义 indicator 内容(图标 / 文本),优先级高于 count / dot |
|
|
35
|
+
| `offset` | `[number, number]` | – | – | indicator 像素偏移 [x, y],仅 wrapped 模式生效 |
|
|
36
|
+
| `size` | `'sm' \| 'default'` | – | – | indicator 尺寸(默认 default) |
|
|
37
|
+
|
|
38
|
+
## 示例
|
|
39
|
+
|
|
40
|
+
### Variants
|
|
41
|
+
|
|
42
|
+
所有 label 变体。
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
46
|
+
<Badge variant="default">Default</Badge>
|
|
47
|
+
<Badge variant="secondary">Secondary</Badge>
|
|
48
|
+
<Badge variant="destructive">Destructive</Badge>
|
|
49
|
+
<Badge variant="outline">Outline</Badge>
|
|
50
|
+
<Badge variant="ghost">Ghost</Badge>
|
|
51
|
+
<Badge variant="link">Link</Badge>
|
|
52
|
+
</div>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Basic
|
|
56
|
+
|
|
57
|
+
基本:包裹元素后右上角浮一个数字胶囊。
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
<div className="flex items-center gap-6">
|
|
61
|
+
<Badge count={5}>
|
|
62
|
+
<Avatar>
|
|
63
|
+
<AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
64
|
+
<AvatarFallback>SC</AvatarFallback>
|
|
65
|
+
</Avatar>
|
|
66
|
+
</Badge>
|
|
67
|
+
<Badge count={0} showZero>
|
|
68
|
+
<Avatar>
|
|
69
|
+
<AvatarFallback>SZ</AvatarFallback>
|
|
70
|
+
</Avatar>
|
|
71
|
+
</Badge>
|
|
72
|
+
</div>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Dot
|
|
76
|
+
|
|
77
|
+
小红点:仅展示一个红点提示,不显示数字。
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
<div className="flex items-center gap-6">
|
|
81
|
+
<Badge dot>
|
|
82
|
+
<Button variant="ghost" size="icon" aria-label="messages">
|
|
83
|
+
<MailIcon />
|
|
84
|
+
</Button>
|
|
85
|
+
</Badge>
|
|
86
|
+
<Badge dot>
|
|
87
|
+
<Button variant="ghost" size="icon" aria-label="notifications">
|
|
88
|
+
<BellIcon />
|
|
89
|
+
</Button>
|
|
90
|
+
</Badge>
|
|
91
|
+
<Badge dot>
|
|
92
|
+
<a href="#">A Link</a>
|
|
93
|
+
</Badge>
|
|
94
|
+
</div>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### OverflowCount
|
|
98
|
+
|
|
99
|
+
封顶数字:超过 `overflowCount` 显示为 `${overflowCount}+`。
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
<div className="flex items-center gap-6">
|
|
103
|
+
<Badge count={99}>
|
|
104
|
+
<Avatar>
|
|
105
|
+
<AvatarFallback>99</AvatarFallback>
|
|
106
|
+
</Avatar>
|
|
107
|
+
</Badge>
|
|
108
|
+
<Badge count={100}>
|
|
109
|
+
<Avatar>
|
|
110
|
+
<AvatarFallback>A</AvatarFallback>
|
|
111
|
+
</Avatar>
|
|
112
|
+
</Badge>
|
|
113
|
+
<Badge count={100} overflowCount={10}>
|
|
114
|
+
<Avatar>
|
|
115
|
+
<AvatarFallback>B</AvatarFallback>
|
|
116
|
+
</Avatar>
|
|
117
|
+
</Badge>
|
|
118
|
+
<Badge count={1000} overflowCount={999}>
|
|
119
|
+
<Avatar>
|
|
120
|
+
<AvatarFallback>C</AvatarFallback>
|
|
121
|
+
</Avatar>
|
|
122
|
+
</Badge>
|
|
123
|
+
</div>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Standalone
|
|
127
|
+
|
|
128
|
+
独立使用:不传 children,单独渲染数字 / 红点 / 自定义内容。
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
132
|
+
<Badge count={25} />
|
|
133
|
+
<Badge count={109} color="var(--color-success)" />
|
|
134
|
+
<Badge dot />
|
|
135
|
+
<Badge content="hot" color="var(--color-destructive)" />
|
|
136
|
+
</div>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### CustomContent
|
|
140
|
+
|
|
141
|
+
自定义内容:通过 `content` 注入文本或图标,`color` 覆盖底色。
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
<div className="flex items-center gap-6">
|
|
145
|
+
<Badge content="hot" color="var(--color-destructive)">
|
|
146
|
+
<Avatar>
|
|
147
|
+
<AvatarFallback>H</AvatarFallback>
|
|
148
|
+
</Avatar>
|
|
149
|
+
</Badge>
|
|
150
|
+
<Badge content={<BellIcon className="size-3" />} color="transparent">
|
|
151
|
+
<Avatar>
|
|
152
|
+
<AvatarFallback>B</AvatarFallback>
|
|
153
|
+
</Avatar>
|
|
154
|
+
</Badge>
|
|
155
|
+
</div>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Clickable
|
|
159
|
+
|
|
160
|
+
整个徽标 + 目标元素均可点击,外层 `<a>` 包裹 Badge。
|
|
161
|
+
|
|
162
|
+
```tsx
|
|
163
|
+
<a href="#" className="inline-block">
|
|
164
|
+
<Badge count={5}>
|
|
165
|
+
<Avatar>
|
|
166
|
+
<AvatarFallback>L</AvatarFallback>
|
|
167
|
+
</Avatar>
|
|
168
|
+
</Badge>
|
|
169
|
+
</a>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Status
|
|
173
|
+
|
|
174
|
+
状态点:5 档语义色 + 文本,processing 带脉冲动画。
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
<div className="flex flex-col gap-2">
|
|
178
|
+
<Badge status="default">Default</Badge>
|
|
179
|
+
<Badge status="processing">Processing</Badge>
|
|
180
|
+
<Badge status="success">Success</Badge>
|
|
181
|
+
<Badge status="warning">Warning</Badge>
|
|
182
|
+
<Badge status="error">Error</Badge>
|
|
183
|
+
</div>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Size
|
|
187
|
+
|
|
188
|
+
尺寸:sm 与 default 对比。
|
|
189
|
+
|
|
190
|
+
```tsx
|
|
191
|
+
<div className="flex items-center gap-8">
|
|
192
|
+
<Badge size="sm" count={5}>
|
|
193
|
+
<Avatar>
|
|
194
|
+
<AvatarFallback>S</AvatarFallback>
|
|
195
|
+
</Avatar>
|
|
196
|
+
</Badge>
|
|
197
|
+
<Badge count={5}>
|
|
198
|
+
<Avatar>
|
|
199
|
+
<AvatarFallback>D</AvatarFallback>
|
|
200
|
+
</Avatar>
|
|
201
|
+
</Badge>
|
|
202
|
+
<Badge size="sm" dot>
|
|
203
|
+
<Avatar>
|
|
204
|
+
<AvatarFallback>S</AvatarFallback>
|
|
205
|
+
</Avatar>
|
|
206
|
+
</Badge>
|
|
207
|
+
<Badge dot>
|
|
208
|
+
<Avatar>
|
|
209
|
+
<AvatarFallback>D</AvatarFallback>
|
|
210
|
+
</Avatar>
|
|
211
|
+
</Badge>
|
|
212
|
+
</div>
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Offset
|
|
216
|
+
|
|
217
|
+
偏移:通过 `offset=[x, y]` 微调 indicator 位置。
|
|
218
|
+
|
|
219
|
+
```tsx
|
|
220
|
+
<div className="flex items-center gap-8">
|
|
221
|
+
<Badge count={5}>
|
|
222
|
+
<Avatar>
|
|
223
|
+
<AvatarFallback>0</AvatarFallback>
|
|
224
|
+
</Avatar>
|
|
225
|
+
</Badge>
|
|
226
|
+
<Badge count={5} offset={[-4, 4]}>
|
|
227
|
+
<Avatar>
|
|
228
|
+
<AvatarFallback>L</AvatarFallback>
|
|
229
|
+
</Avatar>
|
|
230
|
+
</Badge>
|
|
231
|
+
<Badge count={5} offset={[4, -4]}>
|
|
232
|
+
<Avatar>
|
|
233
|
+
<AvatarFallback>R</AvatarFallback>
|
|
234
|
+
</Avatar>
|
|
235
|
+
</Badge>
|
|
236
|
+
</div>
|
|
237
|
+
```
|