@teamix-evo/ui 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -50
- package/manifest.json +406 -653
- package/package.json +15 -34
- package/src/_design-system/theme-tokens/stories.tsx +1474 -0
- package/src/components/accordion/index.tsx +139 -0
- package/src/components/accordion/meta.md +162 -0
- package/src/components/accordion/stories.tsx +145 -0
- package/src/components/affix/index.tsx +149 -0
- package/src/components/affix/meta.md +23 -0
- package/src/components/affix/stories.tsx +70 -0
- package/src/components/alert/index.tsx +220 -0
- package/src/components/alert/meta.md +133 -0
- package/src/components/alert/stories.tsx +126 -0
- package/src/components/alert-dialog/index.tsx +282 -0
- package/src/components/alert-dialog/meta.md +86 -0
- package/src/components/alert-dialog/stories.tsx +163 -0
- package/src/components/avatar/index.tsx +159 -0
- package/src/components/avatar/meta.md +242 -0
- package/src/components/avatar/stories.tsx +241 -0
- package/src/components/badge/index.tsx +299 -0
- package/src/components/badge/meta.md +237 -0
- package/src/components/badge/stories.tsx +275 -0
- package/src/components/breadcrumb/index.tsx +137 -0
- package/src/components/breadcrumb/meta.md +64 -0
- package/src/components/breadcrumb/stories.tsx +86 -0
- package/src/components/button/index.tsx +202 -0
- package/src/components/button/meta.md +209 -0
- package/src/components/button/stories.tsx +215 -0
- package/src/components/button-group/index.tsx +211 -0
- package/src/components/button-group/meta.md +190 -0
- package/src/components/button-group/stories.tsx +182 -0
- package/src/components/calendar/index.tsx +240 -0
- package/src/components/calendar/meta.md +36 -0
- package/src/components/calendar/stories.tsx +36 -0
- package/src/components/card/index.tsx +262 -0
- package/src/components/card/meta.md +194 -0
- package/src/components/card/stories.tsx +202 -0
- package/src/components/carousel/index.tsx +481 -0
- package/src/components/carousel/meta.md +208 -0
- package/src/components/carousel/stories.tsx +271 -0
- package/src/components/cascader-select/index.tsx +308 -0
- package/src/components/cascader-select/meta.md +28 -0
- package/src/components/cascader-select/stories.tsx +118 -0
- package/src/components/checkbox/index.tsx +208 -0
- package/src/components/checkbox/meta.md +166 -0
- package/src/components/checkbox/stories.tsx +206 -0
- package/src/components/collapsible/index.tsx +72 -0
- package/src/components/collapsible/meta.md +87 -0
- package/src/components/collapsible/stories.tsx +97 -0
- package/src/components/color-picker/index.tsx +677 -0
- package/src/components/color-picker/meta.md +83 -0
- package/src/components/color-picker/stories.tsx +172 -0
- package/src/components/combobox/index.tsx +687 -0
- package/src/components/combobox/meta.md +83 -0
- package/src/components/combobox/stories.tsx +179 -0
- package/src/components/command/index.tsx +238 -0
- package/src/components/command/meta.md +48 -0
- package/src/components/command/stories.tsx +83 -0
- package/src/components/data-table/index.tsx +1537 -0
- package/src/components/data-table/meta.md +107 -0
- package/src/components/data-table/stories.tsx +1234 -0
- package/src/components/date-picker/index.tsx +1492 -0
- package/src/components/date-picker/meta.md +103 -0
- package/src/components/date-picker/stories.tsx +125 -0
- package/src/components/descriptions/index.tsx +535 -0
- package/src/components/descriptions/meta.md +104 -0
- package/src/components/descriptions/stories.tsx +389 -0
- package/src/components/dialog/index.tsx +255 -0
- package/src/components/dialog/meta.md +244 -0
- package/src/components/dialog/stories.tsx +330 -0
- package/src/components/dropdown-menu/index.tsx +301 -0
- package/src/components/dropdown-menu/meta.md +93 -0
- package/src/components/dropdown-menu/stories.tsx +124 -0
- package/src/components/empty/index.tsx +431 -0
- package/src/components/empty/meta.md +274 -0
- package/src/components/empty/stories.tsx +278 -0
- package/src/components/field/index.tsx +374 -0
- package/src/components/field/meta.md +283 -0
- package/src/components/field/stories.tsx +327 -0
- package/src/components/filter-bar/index.tsx +976 -0
- package/src/components/filter-bar/meta.md +57 -0
- package/src/components/filter-bar/stories.tsx +496 -0
- package/src/components/float-button/index.tsx +163 -0
- package/src/components/float-button/meta.md +73 -0
- package/src/components/float-button/stories.tsx +68 -0
- package/src/components/form/index.tsx +218 -0
- package/src/components/form/meta.md +16 -0
- package/src/components/form/stories.tsx +301 -0
- package/src/components/hover-card/index.tsx +103 -0
- package/src/components/hover-card/meta.md +71 -0
- package/src/components/hover-card/stories.tsx +107 -0
- package/src/components/icon/index.tsx +225 -0
- package/src/components/icon/meta.md +102 -0
- package/src/components/icon/stories.tsx +127 -0
- package/src/components/image/index.tsx +147 -0
- package/src/components/image/meta.md +55 -0
- package/src/components/image/stories.tsx +48 -0
- package/src/components/input/index.tsx +63 -0
- package/src/components/input/meta.md +57 -0
- package/src/components/input/stories.tsx +66 -0
- package/src/components/input-group/index.tsx +292 -0
- package/src/components/input-group/meta.md +108 -0
- package/src/components/input-group/stories.tsx +258 -0
- package/src/components/input-ip/index.tsx +288 -0
- package/src/components/input-ip/meta.md +48 -0
- package/src/components/input-ip/stories.tsx +69 -0
- package/src/components/input-number/index.tsx +360 -0
- package/src/components/input-number/meta.md +156 -0
- package/src/components/input-number/stories.tsx +187 -0
- package/src/components/item/index.tsx +368 -0
- package/src/components/item/meta.md +395 -0
- package/src/components/item/stories.tsx +432 -0
- package/src/components/label/index.tsx +44 -0
- package/src/components/label/meta.md +68 -0
- package/src/components/label/stories.tsx +64 -0
- package/src/components/mentions/index.tsx +369 -0
- package/src/components/mentions/meta.md +118 -0
- package/src/components/mentions/stories.tsx +153 -0
- package/src/components/menubar/index.tsx +313 -0
- package/src/components/menubar/meta.md +52 -0
- package/src/components/menubar/stories.tsx +99 -0
- package/src/components/navigation-menu/index.tsx +216 -0
- package/src/components/navigation-menu/meta.md +66 -0
- package/src/components/navigation-menu/stories.tsx +137 -0
- package/src/components/page-header/index.tsx +218 -0
- package/src/components/page-header/meta.md +211 -0
- package/src/components/page-header/stories.tsx +290 -0
- package/src/components/page-shell/index.tsx +119 -0
- package/src/components/page-shell/meta.md +115 -0
- package/src/components/page-shell/stories.tsx +154 -0
- package/src/components/pagination/index.tsx +580 -0
- package/src/components/pagination/meta.md +39 -0
- package/src/components/pagination/stories.tsx +319 -0
- package/src/components/popconfirm/index.tsx +477 -0
- package/src/components/popconfirm/meta.md +164 -0
- package/src/components/popconfirm/stories.tsx +231 -0
- package/src/components/popover/index.tsx +181 -0
- package/src/components/popover/meta.md +97 -0
- package/src/components/popover/stories.tsx +169 -0
- package/src/components/progress/index.tsx +176 -0
- package/src/components/progress/meta.md +95 -0
- package/src/components/progress/stories.tsx +115 -0
- package/src/components/radio-group/index.tsx +78 -0
- package/src/components/radio-group/meta.md +137 -0
- package/src/components/radio-group/stories.tsx +285 -0
- package/src/components/rate/index.tsx +284 -0
- package/src/components/rate/meta.md +63 -0
- package/src/components/rate/stories.tsx +107 -0
- package/src/components/resizable/index.tsx +122 -0
- package/src/components/resizable/meta.md +142 -0
- package/src/components/resizable/stories.tsx +105 -0
- package/src/components/scroll-area/index.tsx +83 -0
- package/src/components/scroll-area/meta.md +85 -0
- package/src/components/scroll-area/stories.tsx +82 -0
- package/src/components/select/index.tsx +325 -0
- package/src/components/select/meta.md +183 -0
- package/src/components/select/stories.tsx +210 -0
- package/src/components/separator/index.tsx +51 -0
- package/src/components/separator/meta.md +68 -0
- package/src/components/separator/stories.tsx +53 -0
- package/src/components/sheet/index.tsx +293 -0
- package/src/components/sheet/meta.md +226 -0
- package/src/components/sheet/stories.tsx +405 -0
- package/src/components/sidebar/index.tsx +715 -0
- package/src/components/sidebar/meta.md +14 -0
- package/src/components/sidebar/{sidebar.stories.tsx → stories.tsx} +250 -330
- package/src/components/skeleton/index.tsx +415 -0
- package/src/components/skeleton/meta.md +210 -0
- package/src/components/skeleton/stories.tsx +197 -0
- package/src/components/slider/index.tsx +222 -0
- package/src/components/slider/meta.md +125 -0
- package/src/components/slider/stories.tsx +109 -0
- package/src/components/sonner/index.tsx +149 -0
- package/src/components/sonner/meta.md +156 -0
- package/src/components/sonner/stories.tsx +285 -0
- package/src/components/spinner/index.tsx +335 -0
- package/src/components/spinner/meta.md +172 -0
- package/src/components/spinner/stories.tsx +197 -0
- package/src/components/statistic/{statistic.tsx → index.tsx} +25 -26
- package/src/components/statistic/meta.md +94 -0
- package/src/components/statistic/stories.tsx +85 -0
- package/src/components/steps/index.tsx +500 -0
- package/src/components/steps/meta.md +245 -0
- package/src/components/steps/stories.tsx +287 -0
- package/src/components/switch/index.tsx +175 -0
- package/src/components/switch/meta.md +107 -0
- package/src/components/switch/stories.tsx +154 -0
- package/src/components/table/index.tsx +350 -0
- package/src/components/table/meta.md +148 -0
- package/src/components/table/stories.tsx +189 -0
- package/src/components/tabs/index.tsx +379 -0
- package/src/components/tabs/meta.md +244 -0
- package/src/components/tabs/stories.tsx +312 -0
- package/src/components/tag/index.tsx +774 -0
- package/src/components/tag/meta.md +256 -0
- package/src/components/tag/stories.tsx +431 -0
- package/src/components/textarea/index.tsx +62 -0
- package/src/components/textarea/meta.md +77 -0
- package/src/components/textarea/stories.tsx +112 -0
- package/src/components/time-picker/index.tsx +887 -0
- package/src/components/time-picker/meta.md +102 -0
- package/src/components/time-picker/stories.tsx +125 -0
- package/src/components/timeline/index.tsx +422 -0
- package/src/components/timeline/meta.md +352 -0
- package/src/components/timeline/stories.tsx +369 -0
- package/src/components/toggle/index.tsx +74 -0
- package/src/components/toggle/meta.md +76 -0
- package/src/components/toggle/stories.tsx +66 -0
- package/src/components/toggle-group/index.tsx +167 -0
- package/src/components/toggle-group/meta.md +141 -0
- package/src/components/toggle-group/stories.tsx +124 -0
- package/src/components/tooltip/index.tsx +144 -0
- package/src/components/tooltip/meta.md +186 -0
- package/src/components/tooltip/stories.tsx +212 -0
- package/src/components/transfer/index.tsx +639 -0
- package/src/components/transfer/meta.md +76 -0
- package/src/components/transfer/stories.tsx +221 -0
- package/src/components/tree/index.tsx +764 -0
- package/src/components/tree/meta.md +96 -0
- package/src/components/tree/stories.tsx +385 -0
- package/src/components/tree/utils.ts +269 -0
- package/src/components/tree-select/index.tsx +400 -0
- package/src/components/tree-select/meta.md +78 -0
- package/src/components/tree-select/stories.tsx +234 -0
- package/src/components/typography/index.tsx +290 -0
- package/src/components/typography/meta.md +151 -0
- package/src/components/typography/stories.tsx +151 -0
- package/src/components/upload/index.tsx +858 -0
- package/src/components/upload/meta.md +122 -0
- package/src/components/upload/stories.tsx +261 -0
- package/src/components/watermark/index.tsx +152 -0
- package/src/components/watermark/meta.md +67 -0
- package/src/components/watermark/stories.tsx +59 -0
- package/src/hooks/use-mobile.ts +9 -11
- package/src/lib/color.ts +243 -0
- package/src/{utils/cn.ts → lib/utils.ts} +1 -1
- package/src/components/accordion/accordion.meta.md +0 -88
- package/src/components/accordion/accordion.stories.tsx +0 -72
- package/src/components/accordion/accordion.tsx +0 -154
- package/src/components/affix/affix.meta.md +0 -98
- package/src/components/affix/affix.stories.tsx +0 -134
- package/src/components/affix/affix.tsx +0 -167
- package/src/components/alert/alert.meta.md +0 -132
- package/src/components/alert/alert.stories.tsx +0 -138
- package/src/components/alert/alert.tsx +0 -179
- package/src/components/alert-dialog/alert-dialog.meta.md +0 -152
- package/src/components/alert-dialog/alert-dialog.stories.tsx +0 -223
- package/src/components/alert-dialog/alert-dialog.tsx +0 -183
- package/src/components/anchor/anchor.meta.md +0 -92
- package/src/components/anchor/anchor.stories.tsx +0 -74
- package/src/components/anchor/anchor.tsx +0 -130
- package/src/components/app/app.meta.md +0 -91
- package/src/components/app/app.stories.tsx +0 -64
- package/src/components/app/app.tsx +0 -58
- package/src/components/aspect-ratio/aspect-ratio.meta.md +0 -82
- package/src/components/aspect-ratio/aspect-ratio.stories.tsx +0 -59
- package/src/components/aspect-ratio/aspect-ratio.tsx +0 -22
- package/src/components/auto-complete/auto-complete.meta.md +0 -110
- package/src/components/auto-complete/auto-complete.stories.tsx +0 -136
- package/src/components/auto-complete/auto-complete.tsx +0 -253
- package/src/components/avatar/avatar.meta.md +0 -93
- package/src/components/avatar/avatar.stories.tsx +0 -98
- package/src/components/avatar/avatar.tsx +0 -127
- package/src/components/badge/badge.meta.md +0 -120
- package/src/components/badge/badge.stories.tsx +0 -153
- package/src/components/badge/badge.tsx +0 -204
- package/src/components/breadcrumb/breadcrumb.meta.md +0 -127
- package/src/components/breadcrumb/breadcrumb.stories.tsx +0 -207
- package/src/components/breadcrumb/breadcrumb.tsx +0 -136
- package/src/components/button/button.meta.md +0 -335
- package/src/components/button/button.stories.tsx +0 -743
- package/src/components/button/button.tsx +0 -466
- package/src/components/calendar/calendar.meta.md +0 -128
- package/src/components/calendar/calendar.stories.tsx +0 -68
- package/src/components/calendar/calendar.tsx +0 -172
- package/src/components/card/card.meta.md +0 -139
- package/src/components/card/card.stories.tsx +0 -151
- package/src/components/card/card.tsx +0 -306
- package/src/components/carousel/carousel.meta.md +0 -118
- package/src/components/carousel/carousel.stories.tsx +0 -89
- package/src/components/carousel/carousel.tsx +0 -224
- package/src/components/cascader/cascader.meta.md +0 -140
- package/src/components/cascader/cascader.stories.tsx +0 -120
- package/src/components/cascader/cascader.tsx +0 -548
- package/src/components/checkbox/checkbox.meta.md +0 -167
- package/src/components/checkbox/checkbox.stories.tsx +0 -288
- package/src/components/checkbox/checkbox.tsx +0 -195
- package/src/components/collapsible/collapsible.meta.md +0 -88
- package/src/components/collapsible/collapsible.stories.tsx +0 -43
- package/src/components/collapsible/collapsible.tsx +0 -105
- package/src/components/color-picker/color-picker.meta.md +0 -89
- package/src/components/color-picker/color-picker.stories.tsx +0 -159
- package/src/components/color-picker/color-picker.tsx +0 -171
- package/src/components/command/command.meta.md +0 -120
- package/src/components/command/command.stories.tsx +0 -59
- package/src/components/command/command.tsx +0 -158
- package/src/components/context-menu/context-menu.meta.md +0 -93
- package/src/components/context-menu/context-menu.stories.tsx +0 -54
- package/src/components/context-menu/context-menu.tsx +0 -204
- package/src/components/data-table/data-table.meta.md +0 -150
- package/src/components/data-table/data-table.stories.tsx +0 -132
- package/src/components/data-table/data-table.tsx +0 -185
- package/src/components/date-picker/date-picker.meta.md +0 -175
- package/src/components/date-picker/date-picker.stories.tsx +0 -108
- package/src/components/date-picker/date-picker.tsx +0 -1554
- package/src/components/descriptions/descriptions.meta.md +0 -83
- package/src/components/descriptions/descriptions.stories.tsx +0 -60
- package/src/components/descriptions/descriptions.tsx +0 -137
- package/src/components/dialog/dialog.meta.md +0 -168
- package/src/components/dialog/dialog.stories.tsx +0 -255
- package/src/components/dialog/dialog.tsx +0 -180
- package/src/components/dialog/imperative.tsx +0 -252
- package/src/components/drawer/drawer.meta.md +0 -95
- package/src/components/drawer/drawer.stories.tsx +0 -71
- package/src/components/drawer/drawer.tsx +0 -23
- package/src/components/dropdown-menu/dropdown-menu.meta.md +0 -171
- package/src/components/dropdown-menu/dropdown-menu.stories.tsx +0 -198
- package/src/components/dropdown-menu/dropdown-menu.tsx +0 -209
- package/src/components/ellipsis/ellipsis.meta.md +0 -87
- package/src/components/ellipsis/ellipsis.stories.tsx +0 -72
- package/src/components/ellipsis/ellipsis.tsx +0 -153
- package/src/components/empty/empty.meta.md +0 -86
- package/src/components/empty/empty.stories.tsx +0 -46
- package/src/components/empty/empty.tsx +0 -54
- package/src/components/field/field.meta.md +0 -154
- package/src/components/field/field.stories.tsx +0 -497
- package/src/components/field/field.tsx +0 -392
- package/src/components/filter-bar/filter-bar.meta.md +0 -92
- package/src/components/filter-bar/filter-bar.stories.tsx +0 -1086
- package/src/components/filter-bar/filter-bar.tsx +0 -568
- package/src/components/flex/flex.meta.md +0 -142
- package/src/components/flex/flex.stories.tsx +0 -199
- package/src/components/flex/flex.tsx +0 -145
- package/src/components/float-button/float-button.meta.md +0 -92
- package/src/components/float-button/float-button.stories.tsx +0 -80
- package/src/components/float-button/float-button.tsx +0 -143
- package/src/components/form/form.meta.md +0 -153
- package/src/components/form/form.stories.tsx +0 -472
- package/src/components/form/form.tsx +0 -260
- package/src/components/grid/grid.meta.md +0 -92
- package/src/components/grid/grid.stories.tsx +0 -101
- package/src/components/grid/grid.tsx +0 -130
- package/src/components/hover-card/hover-card.meta.md +0 -103
- package/src/components/hover-card/hover-card.stories.tsx +0 -97
- package/src/components/hover-card/hover-card.tsx +0 -67
- package/src/components/icon/DEVELOPMENT.md +0 -809
- package/src/components/icon/icon.meta.md +0 -170
- package/src/components/icon/icon.stories.tsx +0 -344
- package/src/components/icon/icon.tsx +0 -248
- package/src/components/image/image.meta.md +0 -99
- package/src/components/image/image.stories.tsx +0 -55
- package/src/components/image/image.tsx +0 -140
- package/src/components/input/input.meta.md +0 -115
- package/src/components/input/input.stories.tsx +0 -144
- package/src/components/input/input.tsx +0 -212
- package/src/components/input-group/input-group.meta.md +0 -124
- package/src/components/input-group/input-group.stories.tsx +0 -121
- package/src/components/input-group/input-group.tsx +0 -143
- package/src/components/input-number/input-number.meta.md +0 -148
- package/src/components/input-number/input-number.stories.tsx +0 -125
- package/src/components/input-number/input-number.tsx +0 -283
- package/src/components/input-otp/input-otp.meta.md +0 -106
- package/src/components/input-otp/input-otp.stories.tsx +0 -65
- package/src/components/input-otp/input-otp.tsx +0 -97
- package/src/components/item/item.meta.md +0 -121
- package/src/components/item/item.stories.tsx +0 -116
- package/src/components/item/item.tsx +0 -172
- package/src/components/kbd/kbd.meta.md +0 -94
- package/src/components/kbd/kbd.stories.tsx +0 -70
- package/src/components/kbd/kbd.tsx +0 -86
- package/src/components/label/label.meta.md +0 -99
- package/src/components/label/label.stories.tsx +0 -145
- package/src/components/label/label.tsx +0 -138
- package/src/components/masonry/masonry.meta.md +0 -90
- package/src/components/masonry/masonry.stories.tsx +0 -68
- package/src/components/masonry/masonry.tsx +0 -60
- package/src/components/mentions/mentions.meta.md +0 -119
- package/src/components/mentions/mentions.stories.tsx +0 -189
- package/src/components/mentions/mentions.tsx +0 -243
- package/src/components/menubar/menubar.meta.md +0 -118
- package/src/components/menubar/menubar.stories.tsx +0 -141
- package/src/components/menubar/menubar.tsx +0 -232
- package/src/components/native-select/native-select.meta.md +0 -93
- package/src/components/native-select/native-select.stories.tsx +0 -83
- package/src/components/native-select/native-select.tsx +0 -54
- package/src/components/navigation-menu/navigation-menu.meta.md +0 -118
- package/src/components/navigation-menu/navigation-menu.stories.tsx +0 -215
- package/src/components/navigation-menu/navigation-menu.tsx +0 -129
- package/src/components/notification/notification.meta.md +0 -133
- package/src/components/notification/notification.stories.tsx +0 -98
- package/src/components/notification/notification.tsx +0 -99
- package/src/components/page-header/DEVELOPMENT.md +0 -842
- package/src/components/page-header/page-header.meta.md +0 -210
- package/src/components/page-header/page-header.stories.tsx +0 -428
- package/src/components/page-header/page-header.tsx +0 -284
- package/src/components/page-shell/page-shell.meta.md +0 -116
- package/src/components/page-shell/page-shell.stories.tsx +0 -149
- package/src/components/page-shell/page-shell.tsx +0 -115
- package/src/components/pagination/pagination.meta.md +0 -230
- package/src/components/pagination/pagination.stories.tsx +0 -284
- package/src/components/pagination/pagination.tsx +0 -567
- package/src/components/popconfirm/popconfirm.meta.md +0 -114
- package/src/components/popconfirm/popconfirm.stories.tsx +0 -75
- package/src/components/popconfirm/popconfirm.tsx +0 -134
- package/src/components/popover/popover.meta.md +0 -154
- package/src/components/popover/popover.stories.tsx +0 -158
- package/src/components/popover/popover.tsx +0 -104
- package/src/components/progress/progress.meta.md +0 -118
- package/src/components/progress/progress.stories.tsx +0 -75
- package/src/components/progress/progress.tsx +0 -203
- package/src/components/radio-group/radio-group.meta.md +0 -175
- package/src/components/radio-group/radio-group.stories.tsx +0 -113
- package/src/components/radio-group/radio-group.tsx +0 -209
- package/src/components/rate/rate.meta.md +0 -118
- package/src/components/rate/rate.stories.tsx +0 -89
- package/src/components/rate/rate.tsx +0 -180
- package/src/components/resizable/resizable.meta.md +0 -95
- package/src/components/resizable/resizable.stories.tsx +0 -104
- package/src/components/resizable/resizable.tsx +0 -56
- package/src/components/result/result.meta.md +0 -95
- package/src/components/result/result.stories.tsx +0 -67
- package/src/components/result/result.tsx +0 -100
- package/src/components/scroll-area/scroll-area.meta.md +0 -85
- package/src/components/scroll-area/scroll-area.stories.tsx +0 -49
- package/src/components/scroll-area/scroll-area.tsx +0 -51
- package/src/components/segmented/segmented.meta.md +0 -106
- package/src/components/segmented/segmented.stories.tsx +0 -130
- package/src/components/segmented/segmented.tsx +0 -146
- package/src/components/select/select.meta.md +0 -255
- package/src/components/select/select.stories.tsx +0 -275
- package/src/components/select/select.tsx +0 -735
- package/src/components/separator/separator.meta.md +0 -75
- package/src/components/separator/separator.stories.tsx +0 -71
- package/src/components/separator/separator.tsx +0 -100
- package/src/components/sheet/sheet.meta.md +0 -113
- package/src/components/sheet/sheet.stories.tsx +0 -188
- package/src/components/sheet/sheet.tsx +0 -226
- package/src/components/sidebar/sidebar.meta.md +0 -151
- package/src/components/sidebar/sidebar.tsx +0 -853
- package/src/components/skeleton/skeleton.meta.md +0 -94
- package/src/components/skeleton/skeleton.stories.tsx +0 -79
- package/src/components/skeleton/skeleton.tsx +0 -144
- package/src/components/slider/slider.meta.md +0 -146
- package/src/components/slider/slider.stories.tsx +0 -121
- package/src/components/slider/slider.tsx +0 -227
- package/src/components/sonner/sonner.meta.md +0 -147
- package/src/components/sonner/sonner.stories.tsx +0 -164
- package/src/components/sonner/sonner.tsx +0 -169
- package/src/components/spinner/spinner.meta.md +0 -125
- package/src/components/spinner/spinner.stories.tsx +0 -123
- package/src/components/spinner/spinner.tsx +0 -166
- package/src/components/statistic/statistic.meta.md +0 -104
- package/src/components/statistic/statistic.stories.tsx +0 -67
- package/src/components/steps/steps.meta.md +0 -116
- package/src/components/steps/steps.stories.tsx +0 -115
- package/src/components/steps/steps.tsx +0 -173
- package/src/components/switch/switch.meta.md +0 -138
- package/src/components/switch/switch.stories.tsx +0 -75
- package/src/components/switch/switch.tsx +0 -169
- package/src/components/table/table.meta.md +0 -106
- package/src/components/table/table.stories.tsx +0 -80
- package/src/components/table/table.tsx +0 -124
- package/src/components/tabs/tabs.meta.md +0 -111
- package/src/components/tabs/tabs.stories.tsx +0 -156
- package/src/components/tabs/tabs.tsx +0 -190
- package/src/components/tag/tag.meta.md +0 -159
- package/src/components/tag/tag.stories.tsx +0 -250
- package/src/components/tag/tag.tsx +0 -386
- package/src/components/textarea/textarea.meta.md +0 -99
- package/src/components/textarea/textarea.stories.tsx +0 -89
- package/src/components/textarea/textarea.tsx +0 -137
- package/src/components/time-picker/time-picker.meta.md +0 -175
- package/src/components/time-picker/time-picker.stories.tsx +0 -129
- package/src/components/time-picker/time-picker.tsx +0 -946
- package/src/components/timeline/timeline.meta.md +0 -110
- package/src/components/timeline/timeline.stories.tsx +0 -134
- package/src/components/timeline/timeline.tsx +0 -168
- package/src/components/toggle/toggle.meta.md +0 -89
- package/src/components/toggle/toggle.stories.tsx +0 -66
- package/src/components/toggle/toggle.tsx +0 -54
- package/src/components/toggle-group/toggle-group.meta.md +0 -91
- package/src/components/toggle-group/toggle-group.stories.tsx +0 -83
- package/src/components/toggle-group/toggle-group.tsx +0 -78
- package/src/components/tooltip/tooltip.meta.md +0 -149
- package/src/components/tooltip/tooltip.stories.tsx +0 -108
- package/src/components/tooltip/tooltip.tsx +0 -153
- package/src/components/tour/tour.meta.md +0 -121
- package/src/components/tour/tour.stories.tsx +0 -66
- package/src/components/tour/tour.tsx +0 -242
- package/src/components/transfer/transfer.meta.md +0 -95
- package/src/components/transfer/transfer.stories.tsx +0 -64
- package/src/components/transfer/transfer.tsx +0 -258
- package/src/components/tree/tree.meta.md +0 -169
- package/src/components/tree/tree.stories.tsx +0 -128
- package/src/components/tree/tree.tsx +0 -368
- package/src/components/tree-select/tree-select.meta.md +0 -151
- package/src/components/tree-select/tree-select.stories.tsx +0 -80
- package/src/components/tree-select/tree-select.tsx +0 -206
- package/src/components/typography/typography.meta.md +0 -149
- package/src/components/typography/typography.stories.tsx +0 -116
- package/src/components/typography/typography.tsx +0 -260
- package/src/components/upload/upload.meta.md +0 -156
- package/src/components/upload/upload.stories.tsx +0 -135
- package/src/components/upload/upload.tsx +0 -398
- package/src/components/watermark/watermark.meta.md +0 -100
- package/src/components/watermark/watermark.stories.tsx +0 -170
- package/src/components/watermark/watermark.tsx +0 -166
- package/src/hooks/use-breakpoint.ts +0 -117
- package/src/hooks/use-debounce-callback.ts +0 -52
- package/src/stories/theme-tokens.stories.tsx +0 -747
- package/src/utils/trigger-input.ts +0 -57
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: progress
|
|
3
|
-
name: Progress
|
|
4
|
-
type: component
|
|
5
|
-
category: feedback
|
|
6
|
-
since: 0.1.0
|
|
7
|
-
package: '@teamix-evo/ui'
|
|
8
|
-
displayName: 进度条
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Progress 进度条
|
|
12
|
-
|
|
13
|
-
进度条 — Radix Progress + antd 的 `status / showInfo / Progress.Circle` 并集。
|
|
14
|
-
|
|
15
|
-
`Progress`(线性)和 `ProgressCircle`(环形)是两个独立组件,共享 `value / status / showInfo` 三 prop 心智。
|
|
16
|
-
|
|
17
|
-
## When to use
|
|
18
|
-
|
|
19
|
-
- **线性 Progress**:文件上传、表单提交、长任务进度;占据一行宽度
|
|
20
|
-
- **环形 ProgressCircle**:数据完成度、空间占用、健康度等需要紧凑展示的场景;不撑宽
|
|
21
|
-
|
|
22
|
-
## When NOT to use
|
|
23
|
-
|
|
24
|
-
- 进度不可知 → 用 `Spinner`(loading 视觉)或 `Skeleton`
|
|
25
|
-
- 仅做"是否完成"二元状态 → 用 `Badge` 或 `Switch`
|
|
26
|
-
|
|
27
|
-
## Props
|
|
28
|
-
|
|
29
|
-
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成。
|
|
30
|
-
|
|
31
|
-
<!-- auto:props:begin -->
|
|
32
|
-
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
33
|
-
| --- | --- | --- | --- | --- |
|
|
34
|
-
| `value` | `number` | `0` | – | 当前百分比(0~100)。 |
|
|
35
|
-
| `status` | `ProgressStatus` | `"normal"` | – | 状态色,自动优先级:`exception > warning > success > normal`。 |
|
|
36
|
-
| `showInfo` | `boolean` | `false` | – | 是否在右侧显示百分比文字(antd showInfo 并集)。 |
|
|
37
|
-
| `size` | `'sm' \| 'md' \| 'default' \| 'lg'` | `"md"` | – | 进度条尺寸。 |
|
|
38
|
-
<!-- auto:props:end -->
|
|
39
|
-
|
|
40
|
-
## 依赖
|
|
41
|
-
|
|
42
|
-
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成,数据源是 [`manifest.json`](../../../manifest.json)。**手工编辑 marker 之间的内容会在下次生成时被覆盖**。
|
|
43
|
-
|
|
44
|
-
<!-- auto:deps:begin -->
|
|
45
|
-
### 同库依赖
|
|
46
|
-
|
|
47
|
-
> `teamix-evo ui add progress` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
48
|
-
|
|
49
|
-
| Entry | 类型 | 描述 |
|
|
50
|
-
| --- | --- | --- |
|
|
51
|
-
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
52
|
-
|
|
53
|
-
### npm 依赖
|
|
54
|
-
|
|
55
|
-
> 业务侧需要先 `pnpm add` / `npm install` 这些包。CLI 在 `ui add` 完成后会列出此提示。
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
pnpm add @radix-ui/react-progress@^1.1.0
|
|
59
|
-
```
|
|
60
|
-
<!-- auto:deps:end -->
|
|
61
|
-
|
|
62
|
-
## AI 生成纪律
|
|
63
|
-
|
|
64
|
-
- **`status` 反映业务语义**:正常进行 `normal`、完成 `success`、警告 `warning`、失败/异常 `exception`,**不要**用颜色 prop 绕过 status 直接调色
|
|
65
|
-
- **`value` 范围 0~100**:超出会被 clamp,但写代码时不要传超出值
|
|
66
|
-
- **showInfo 默认行为不同**:线性默认 `false`(节省横向空间),环形默认 `true`(圆心天然有空位)
|
|
67
|
-
- **不要替代 Spinner**:已知"正在加载但不知比例"应该用 `Spinner` 或 `Skeleton`,**不要**用 `<Progress value={undefined} />` 做不确定态
|
|
68
|
-
- **超过一屏的长任务**:Progress 配 ETA 文字 + 取消按钮,提供退路
|
|
69
|
-
|
|
70
|
-
## Examples
|
|
71
|
-
|
|
72
|
-
```tsx
|
|
73
|
-
import { Progress, ProgressCircle } from '@/components/ui/progress';
|
|
74
|
-
|
|
75
|
-
// 线性
|
|
76
|
-
<Progress value={42} showInfo />
|
|
77
|
-
<Progress value={100} status="success" showInfo />
|
|
78
|
-
<Progress value={66} status="warning" showInfo />
|
|
79
|
-
<Progress value={20} status="exception" showInfo />
|
|
80
|
-
|
|
81
|
-
// 环形
|
|
82
|
-
<ProgressCircle value={75} />
|
|
83
|
-
<ProgressCircle value={100} status="success" size={120} />
|
|
84
|
-
<ProgressCircle value={42} showInfo={false} size={48} />
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## Progress 形态 — 旧库 API → 新映射
|
|
90
|
-
|
|
91
|
-
> 旧库 `Progress`(hybridcloud,shape='line'|'circle') → 新库 `Progress`(线形) + `ProgressCircle`(环形)。
|
|
92
|
-
> 新库基于 Radix Progress Primitive + SVG circle,语义色对齐 ADR 0021。
|
|
93
|
-
|
|
94
|
-
### 命名 & 结构映射
|
|
95
|
-
|
|
96
|
-
| 旧库 | 新库 | 说明 |
|
|
97
|
-
| -------------------------- | ----------------------------------------- | ------------------------------ |
|
|
98
|
-
| `Progress shape='line'` | `Progress` | 线形进度条 |
|
|
99
|
-
| `Progress shape='circle'` | `ProgressCircle` | 环形(独立组件) |
|
|
100
|
-
| `percent` | `value` | 属性重命名(0~100) |
|
|
101
|
-
| `state='normal'` | `status='normal'` | state → status |
|
|
102
|
-
| `state='error'` | `status='exception'` | error → exception |
|
|
103
|
-
| `state='success'` | `status='success'` | 直接映射 |
|
|
104
|
-
| — | `status='warning'` | 新增警告状态 |
|
|
105
|
-
| `size: small/medium/large` | `size: 'sm' \| 'md' \| 'default' \| 'lg'` | md = medium = default |
|
|
106
|
-
| `textRender` | `showInfo`(布尔) | 自定义 → 开关;复杂文本外部组合 |
|
|
107
|
-
| `progressive` (渐变色) | 不复刻 | 用 status 语义色替代 |
|
|
108
|
-
| `color` (任意 CSS) | 不复刻 | 仅走 status 语义色 |
|
|
109
|
-
| `hasBorder` | 不复刻 | 新库无此选项 |
|
|
110
|
-
|
|
111
|
-
### 迁移 FAQ
|
|
112
|
-
|
|
113
|
-
| 问题 | 回答 |
|
|
114
|
-
| ----------------- | -------------------------------------------------------------- |
|
|
115
|
-
| percent → value? | 直接改名,语义相同(0~100) |
|
|
116
|
-
| 环形怎么写? | `<ProgressCircle value={75} size={80} />`;带文字 `showInfo` |
|
|
117
|
-
| 怎么做自定义文字? | 外部组合: `<div><Progress value={x} /><span>{x}%</span></div>` |
|
|
118
|
-
| 失败状态怎么显示? | `status="exception"` — 自动变红色(destructive) |
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { Progress, ProgressCircle } from './progress';
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof Progress> = {
|
|
5
|
-
title: '反馈 · Feedback/Progress',
|
|
6
|
-
component: Progress,
|
|
7
|
-
tags: ['autodocs'],
|
|
8
|
-
parameters: {
|
|
9
|
-
docs: {
|
|
10
|
-
description: {
|
|
11
|
-
component:
|
|
12
|
-
'进度条 — 展示一个任务的完成进度,访问友好的状态反馈。Radix Progress 实现 + antd Progress 的能力并集:除默认线形(`Progress`)外还提供环形 `ProgressCircle`,支持 `status`(normal / success / warning / exception)、`size`、`showInfo` 以及任意 `format` 提示。',
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
argTypes: {
|
|
17
|
-
value: { control: { type: 'range', min: 0, max: 100 } },
|
|
18
|
-
status: {
|
|
19
|
-
control: 'select',
|
|
20
|
-
options: ['normal', 'success', 'warning', 'exception'],
|
|
21
|
-
},
|
|
22
|
-
showInfo: { control: 'boolean' },
|
|
23
|
-
size: { control: 'inline-radio', options: ['sm', 'default', 'lg'] },
|
|
24
|
-
},
|
|
25
|
-
args: { value: 42, status: 'normal', showInfo: true, size: 'default' },
|
|
26
|
-
decorators: [
|
|
27
|
-
(Story) => (
|
|
28
|
-
<div className="w-80">
|
|
29
|
-
<Story />
|
|
30
|
-
</div>
|
|
31
|
-
),
|
|
32
|
-
],
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export default meta;
|
|
36
|
-
type Story = StoryObj<typeof Progress>;
|
|
37
|
-
|
|
38
|
-
export const Playground: Story = {};
|
|
39
|
-
|
|
40
|
-
export const Statuses: Story = {
|
|
41
|
-
parameters: { controls: { disable: true } },
|
|
42
|
-
render: () => (
|
|
43
|
-
<div className="flex flex-col gap-3">
|
|
44
|
-
<Progress value={20} showInfo />
|
|
45
|
-
<Progress value={66} status="warning" showInfo />
|
|
46
|
-
<Progress value={100} status="success" showInfo />
|
|
47
|
-
<Progress value={45} status="exception" showInfo />
|
|
48
|
-
</div>
|
|
49
|
-
),
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export const Sizes: Story = {
|
|
53
|
-
parameters: { controls: { disable: true } },
|
|
54
|
-
render: () => (
|
|
55
|
-
<div className="flex flex-col gap-3">
|
|
56
|
-
<Progress value={42} size="sm" showInfo />
|
|
57
|
-
<Progress value={42} size="default" showInfo />
|
|
58
|
-
<Progress value={42} size="lg" showInfo />
|
|
59
|
-
</div>
|
|
60
|
-
),
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export const Circle: StoryObj<typeof ProgressCircle> = {
|
|
64
|
-
parameters: { controls: { disable: true } },
|
|
65
|
-
render: () => (
|
|
66
|
-
<div className="flex items-center gap-6">
|
|
67
|
-
<ProgressCircle value={20} />
|
|
68
|
-
<ProgressCircle value={66} status="warning" />
|
|
69
|
-
<ProgressCircle value={100} status="success" />
|
|
70
|
-
<ProgressCircle value={42} status="exception" />
|
|
71
|
-
<ProgressCircle value={75} size={120} />
|
|
72
|
-
<ProgressCircle value={75} size={40} showInfo={false} />
|
|
73
|
-
</div>
|
|
74
|
-
),
|
|
75
|
-
};
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
|
3
|
-
|
|
4
|
-
import { cn } from '@/utils/cn';
|
|
5
|
-
|
|
6
|
-
export type ProgressStatus = 'normal' | 'success' | 'warning' | 'exception';
|
|
7
|
-
|
|
8
|
-
const statusBarColor: Record<ProgressStatus, string> = {
|
|
9
|
-
normal: 'bg-primary',
|
|
10
|
-
success: 'bg-success',
|
|
11
|
-
warning: 'bg-warning',
|
|
12
|
-
exception: 'bg-destructive',
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const statusTextColor: Record<ProgressStatus, string> = {
|
|
16
|
-
normal: 'text-foreground',
|
|
17
|
-
success: 'text-success',
|
|
18
|
-
warning: 'text-warning',
|
|
19
|
-
exception: 'text-destructive',
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export interface ProgressProps
|
|
23
|
-
extends Omit<
|
|
24
|
-
React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>,
|
|
25
|
-
'value'
|
|
26
|
-
> {
|
|
27
|
-
/**
|
|
28
|
-
* 当前百分比(0~100)。
|
|
29
|
-
* @default 0
|
|
30
|
-
*/
|
|
31
|
-
value?: number;
|
|
32
|
-
/**
|
|
33
|
-
* 状态色,自动优先级:`exception > warning > success > normal`。
|
|
34
|
-
* @default "normal"
|
|
35
|
-
*/
|
|
36
|
-
status?: ProgressStatus;
|
|
37
|
-
/**
|
|
38
|
-
* 是否在右侧显示百分比文字(antd showInfo 并集)。
|
|
39
|
-
* @default false
|
|
40
|
-
*/
|
|
41
|
-
showInfo?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* 进度条尺寸。
|
|
44
|
-
* @default "md"
|
|
45
|
-
*/
|
|
46
|
-
size?: 'sm' | 'md' | 'default' | 'lg';
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const Progress = React.forwardRef<
|
|
50
|
-
React.ElementRef<typeof ProgressPrimitive.Root>,
|
|
51
|
-
ProgressProps
|
|
52
|
-
>(
|
|
53
|
-
(
|
|
54
|
-
{
|
|
55
|
-
className,
|
|
56
|
-
value = 0,
|
|
57
|
-
status = 'normal',
|
|
58
|
-
showInfo = false,
|
|
59
|
-
size = 'md',
|
|
60
|
-
...props
|
|
61
|
-
},
|
|
62
|
-
ref,
|
|
63
|
-
) => {
|
|
64
|
-
const h = size === 'sm' ? 'h-1.5' : size === 'lg' ? 'h-3' : 'h-2';
|
|
65
|
-
return (
|
|
66
|
-
<div className={cn('flex items-center gap-3', className)}>
|
|
67
|
-
<ProgressPrimitive.Root
|
|
68
|
-
ref={ref}
|
|
69
|
-
value={value}
|
|
70
|
-
className={cn(
|
|
71
|
-
'relative w-full overflow-hidden rounded-full bg-secondary',
|
|
72
|
-
h,
|
|
73
|
-
)}
|
|
74
|
-
{...props}
|
|
75
|
-
>
|
|
76
|
-
<ProgressPrimitive.Indicator
|
|
77
|
-
className={cn(
|
|
78
|
-
'size-full flex-1 transition-all',
|
|
79
|
-
statusBarColor[status],
|
|
80
|
-
)}
|
|
81
|
-
style={{
|
|
82
|
-
transform: `translateX(-${
|
|
83
|
-
100 - Math.min(100, Math.max(0, value))
|
|
84
|
-
}%)`,
|
|
85
|
-
}}
|
|
86
|
-
/>
|
|
87
|
-
</ProgressPrimitive.Root>
|
|
88
|
-
{showInfo ? (
|
|
89
|
-
<span
|
|
90
|
-
className={cn(
|
|
91
|
-
'shrink-0 text-xs font-medium tabular-nums',
|
|
92
|
-
statusTextColor[status],
|
|
93
|
-
)}
|
|
94
|
-
>
|
|
95
|
-
{Math.round(value)}%
|
|
96
|
-
</span>
|
|
97
|
-
) : null}
|
|
98
|
-
</div>
|
|
99
|
-
);
|
|
100
|
-
},
|
|
101
|
-
);
|
|
102
|
-
Progress.displayName = 'Progress';
|
|
103
|
-
|
|
104
|
-
// ─── ProgressCircle(antd 并集)────────────────────────────────────────────
|
|
105
|
-
|
|
106
|
-
export interface ProgressCircleProps
|
|
107
|
-
extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
108
|
-
/** 当前百分比(0~100)。 @default 0 */
|
|
109
|
-
value?: number;
|
|
110
|
-
/** 状态色。 @default "normal" */
|
|
111
|
-
status?: ProgressStatus;
|
|
112
|
-
/** 圆环直径(px)。 @default 80 */
|
|
113
|
-
size?: number;
|
|
114
|
-
/** 圆环描边宽度(px)。 @default 6 */
|
|
115
|
-
strokeWidth?: number;
|
|
116
|
-
/**
|
|
117
|
-
* 是否在圆心显示百分比文字。
|
|
118
|
-
* @default true
|
|
119
|
-
*/
|
|
120
|
-
showInfo?: boolean;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const ProgressCircle = React.forwardRef<HTMLDivElement, ProgressCircleProps>(
|
|
124
|
-
(
|
|
125
|
-
{
|
|
126
|
-
className,
|
|
127
|
-
value = 0,
|
|
128
|
-
status = 'normal',
|
|
129
|
-
size = 80,
|
|
130
|
-
strokeWidth = 6,
|
|
131
|
-
showInfo = true,
|
|
132
|
-
...props
|
|
133
|
-
},
|
|
134
|
-
ref,
|
|
135
|
-
) => {
|
|
136
|
-
const radius = (size - strokeWidth) / 2;
|
|
137
|
-
const circumference = 2 * Math.PI * radius;
|
|
138
|
-
const offset =
|
|
139
|
-
circumference * (1 - Math.min(100, Math.max(0, value)) / 100);
|
|
140
|
-
return (
|
|
141
|
-
<div
|
|
142
|
-
ref={ref}
|
|
143
|
-
className={cn(
|
|
144
|
-
'relative inline-flex items-center justify-center',
|
|
145
|
-
className,
|
|
146
|
-
)}
|
|
147
|
-
style={{ width: size, height: size }}
|
|
148
|
-
role="progressbar"
|
|
149
|
-
aria-valuenow={value}
|
|
150
|
-
aria-valuemin={0}
|
|
151
|
-
aria-valuemax={100}
|
|
152
|
-
{...props}
|
|
153
|
-
>
|
|
154
|
-
<svg
|
|
155
|
-
width={size}
|
|
156
|
-
height={size}
|
|
157
|
-
className="-rotate-90"
|
|
158
|
-
aria-hidden="true"
|
|
159
|
-
>
|
|
160
|
-
<circle
|
|
161
|
-
cx={size / 2}
|
|
162
|
-
cy={size / 2}
|
|
163
|
-
r={radius}
|
|
164
|
-
strokeWidth={strokeWidth}
|
|
165
|
-
className="fill-none stroke-secondary"
|
|
166
|
-
/>
|
|
167
|
-
<circle
|
|
168
|
-
cx={size / 2}
|
|
169
|
-
cy={size / 2}
|
|
170
|
-
r={radius}
|
|
171
|
-
strokeWidth={strokeWidth}
|
|
172
|
-
strokeLinecap="round"
|
|
173
|
-
strokeDasharray={circumference}
|
|
174
|
-
strokeDashoffset={offset}
|
|
175
|
-
className={cn(
|
|
176
|
-
'fill-none transition-all',
|
|
177
|
-
status === 'success'
|
|
178
|
-
? 'stroke-success'
|
|
179
|
-
: status === 'warning'
|
|
180
|
-
? 'stroke-warning'
|
|
181
|
-
: status === 'exception'
|
|
182
|
-
? 'stroke-destructive'
|
|
183
|
-
: 'stroke-primary',
|
|
184
|
-
)}
|
|
185
|
-
/>
|
|
186
|
-
</svg>
|
|
187
|
-
{showInfo ? (
|
|
188
|
-
<span
|
|
189
|
-
className={cn(
|
|
190
|
-
'absolute text-xs font-semibold tabular-nums',
|
|
191
|
-
statusTextColor[status],
|
|
192
|
-
)}
|
|
193
|
-
>
|
|
194
|
-
{Math.round(value)}%
|
|
195
|
-
</span>
|
|
196
|
-
) : null}
|
|
197
|
-
</div>
|
|
198
|
-
);
|
|
199
|
-
},
|
|
200
|
-
);
|
|
201
|
-
ProgressCircle.displayName = 'ProgressCircle';
|
|
202
|
-
|
|
203
|
-
export { Progress, ProgressCircle };
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: radio-group
|
|
3
|
-
name: RadioGroup
|
|
4
|
-
displayName: 单选组
|
|
5
|
-
type: component
|
|
6
|
-
category: data-entry
|
|
7
|
-
since: 0.1.0
|
|
8
|
-
package: '@teamix-evo/ui'
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# RadioGroup 单选组
|
|
12
|
-
|
|
13
|
-
单选组 — Radix RadioGroup,**两种渲染**:
|
|
14
|
-
|
|
15
|
-
| variant | 形态 | 适用 |
|
|
16
|
-
| --------- | ------------------------------ | ------------------------------------ |
|
|
17
|
-
| `default` | 圆点 + 文字(shadcn 风格) | 表单 / 设置面板 |
|
|
18
|
-
| `button` | 按钮组(antd Radio.Button 并集) | 视图切换 / 时间区间切换 / 紧凑工具栏 |
|
|
19
|
-
|
|
20
|
-
## When to use
|
|
21
|
-
|
|
22
|
-
- 互斥单选(必选其一)
|
|
23
|
-
- 视图切换(列表 / 卡片 / 网格)
|
|
24
|
-
- 时间区间切换(今日 / 本周 / 本月)
|
|
25
|
-
|
|
26
|
-
## When NOT to use
|
|
27
|
-
|
|
28
|
-
- 多选 → `Checkbox` / `CheckboxGroup`
|
|
29
|
-
- 选项数 > 5 → `Select`
|
|
30
|
-
- 可搜索 → `Combobox`(v0.x)
|
|
31
|
-
|
|
32
|
-
## Props
|
|
33
|
-
|
|
34
|
-
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成。
|
|
35
|
-
|
|
36
|
-
<!-- auto:props:begin -->
|
|
37
|
-
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
38
|
-
| --- | --- | --- | --- | --- |
|
|
39
|
-
| `value` | `string` | – | – | 受控选中值(等价 antd `value`,Radix 命名一致)。 与 `defaultValue` 二选一,不同时传。 |
|
|
40
|
-
| `defaultValue` | `string` | – | – | 非受控初始选中值。 |
|
|
41
|
-
| `onValueChange` | `(value: string) => void` | – | – | 选中变化回调 — Radix 命名,等价 antd `onChange(value)`。 |
|
|
42
|
-
| `disabled` | `boolean` | `false` | – | 整组禁用(灰化所有 Item / Button + 不响应交互)。 |
|
|
43
|
-
| `required` | `boolean` | `false` | – | 表单必填 — 设置 HTML 原生 `required`,表单层校验依赖此值。 |
|
|
44
|
-
| `name` | `string` | – | – | 表单字段名(原生 `<input name>`,提交表单时使用;同组所有 Item 共用)。 |
|
|
45
|
-
| `orientation` | `'horizontal' \| 'vertical'` | `"vertical"` | – | 排列方向(键盘导航方向也跟随此值)。 |
|
|
46
|
-
| `variant` | `'default' \| 'button'` | `"default"` | – | 渲染样式 — `default` 经典圆点;`button` 渲染为按钮组(antd `Radio.Button` 并集)。 |
|
|
47
|
-
| `options` | `RadioGroupOption[]` | – | – | 选项数据源(数据驱动模式,与 CheckboxGroup `options` 对齐)。 传入后内部自动渲染 `RadioGroupItem` / `RadioGroupButton`,无需 `children`. 当同时存在 `children` 与 `options` 时,`children` 优先。 |
|
|
48
|
-
<!-- auto:props:end -->
|
|
49
|
-
|
|
50
|
-
## 依赖
|
|
51
|
-
|
|
52
|
-
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成,数据源是 [`manifest.json`](../../../manifest.json)。**手工编辑 marker 之间的内容会在下次生成时被覆盖**。
|
|
53
|
-
|
|
54
|
-
<!-- auto:deps:begin -->
|
|
55
|
-
### 同库依赖
|
|
56
|
-
|
|
57
|
-
> `teamix-evo ui add radio-group` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
58
|
-
|
|
59
|
-
| Entry | 类型 | 描述 |
|
|
60
|
-
| --- | --- | --- |
|
|
61
|
-
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
62
|
-
|
|
63
|
-
### npm 依赖
|
|
64
|
-
|
|
65
|
-
> 业务侧需要先 `pnpm add` / `npm install` 这些包。CLI 在 `ui add` 完成后会列出此提示。
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
pnpm add @radix-ui/react-radio-group@^1.2.0 lucide-react@^0.460.0
|
|
69
|
-
```
|
|
70
|
-
<!-- auto:deps:end -->
|
|
71
|
-
|
|
72
|
-
> 子组件 `RadioGroupItem`(默认形态)/ `RadioGroupButton`(按钮形态)各自的 props 见 [`radio-group.tsx`](./radio-group.tsx)。
|
|
73
|
-
|
|
74
|
-
## AI 生成纪律
|
|
75
|
-
|
|
76
|
-
- **形态由父级 variant 决定**:`default` 用 `RadioGroupItem`,`button` 用 `RadioGroupButton`,**不要混用**(默认形态用 Button 子项视觉怪异)
|
|
77
|
-
- **必须有 default 选中项**:用户进入页面看到全部未选会困惑;用 `defaultValue` 给一个合理初值
|
|
78
|
-
- **每项必关联 Label**:`<RadioGroupItem id="r1" value="a" /> + <Label htmlFor="r1">A</Label>` 或包裹模式
|
|
79
|
-
- **value 唯一稳定**:不要用 index,变化时 controlled diff 失败
|
|
80
|
-
- **横向排列固定 16px(组件内置 `gap-4`)**:对齐《Teamix UI 表单设计规范》§3.1 规则 3 "checkbox/radio 横向 16px";不要手动加 `gap-3` / `space-x-2` 等覆盖。纵向自动用 `gap-2`(8px,紧凑列表)。
|
|
81
|
-
|
|
82
|
-
## Examples
|
|
83
|
-
|
|
84
|
-
```tsx
|
|
85
|
-
import {
|
|
86
|
-
RadioGroup, RadioGroupItem, RadioGroupButton,
|
|
87
|
-
} from '@/components/ui/radio-group';
|
|
88
|
-
import { Label } from '@/components/ui/label';
|
|
89
|
-
|
|
90
|
-
// 默认形态
|
|
91
|
-
<RadioGroup defaultValue="comfortable" className="grid gap-2">
|
|
92
|
-
<div className="flex items-center gap-2">
|
|
93
|
-
<RadioGroupItem value="default" id="r1" />
|
|
94
|
-
<Label htmlFor="r1">Default</Label>
|
|
95
|
-
</div>
|
|
96
|
-
<div className="flex items-center gap-2">
|
|
97
|
-
<RadioGroupItem value="comfortable" id="r2" />
|
|
98
|
-
<Label htmlFor="r2">Comfortable</Label>
|
|
99
|
-
</div>
|
|
100
|
-
<div className="flex items-center gap-2">
|
|
101
|
-
<RadioGroupItem value="compact" id="r3" />
|
|
102
|
-
<Label htmlFor="r3">Compact</Label>
|
|
103
|
-
</div>
|
|
104
|
-
</RadioGroup>
|
|
105
|
-
|
|
106
|
-
// 按钮形态(antd Radio.Button)
|
|
107
|
-
<RadioGroup variant="button" defaultValue="month">
|
|
108
|
-
<RadioGroupButton value="day">日</RadioGroupButton>
|
|
109
|
-
<RadioGroupButton value="week">周</RadioGroupButton>
|
|
110
|
-
<RadioGroupButton value="month">月</RadioGroupButton>
|
|
111
|
-
<RadioGroupButton value="year">年</RadioGroupButton>
|
|
112
|
-
</RadioGroup>
|
|
113
|
-
|
|
114
|
-
// 数据驱动模式(对齐 CheckboxGroup)
|
|
115
|
-
<RadioGroup
|
|
116
|
-
options={[
|
|
117
|
-
{ label: '苹果', value: 'apple' },
|
|
118
|
-
{ label: '香蕉', value: 'banana' },
|
|
119
|
-
{ label: '橘子', value: 'orange', disabled: true },
|
|
120
|
-
]}
|
|
121
|
-
defaultValue="apple"
|
|
122
|
-
/>
|
|
123
|
-
|
|
124
|
-
// 数据驱动 + 按钮模式
|
|
125
|
-
<RadioGroup
|
|
126
|
-
variant="button"
|
|
127
|
-
options={[
|
|
128
|
-
{ label: '日', value: 'day' },
|
|
129
|
-
{ label: '周', value: 'week' },
|
|
130
|
-
{ label: '月', value: 'month' },
|
|
131
|
-
]}
|
|
132
|
-
defaultValue="month"
|
|
133
|
-
/>
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
## Radio 形态 — 旧库 API → 新映射
|
|
137
|
-
|
|
138
|
-
> 决策:**不新增独立组件**,直接用 `RadioGroup` + `RadioGroupItem` / `RadioGroupButton` 承接 cloud-design `Radio` / `Radio.Group` 全部用法。本章节是从旧库平滑迁移的查表索引,与 [上面的 Props 表](#props) 互补。
|
|
139
|
-
|
|
140
|
-
### 命名映射
|
|
141
|
-
|
|
142
|
-
| cloud-design 旧库 | `@teamix-evo/ui` | 说明 |
|
|
143
|
-
| ----------------------------------------- | ------------------------------------------------------ | ------------------------------------------------------------------- |
|
|
144
|
-
| `Radio` + `Radio.Group` | `RadioGroup` + `RadioGroupItem` / `RadioGroupButton` | 父子拆分导出,shadcn 风格 |
|
|
145
|
-
| `Radio.Group shape="button"` | `<RadioGroup variant="button">` + `<RadioGroupButton>` | `shape` → `variant`(Radix 语义) |
|
|
146
|
-
| `Radio.Group direction="hor\|ver"` | `<RadioGroup orientation="horizontal\|vertical">` | 完整单词,Radix 原生 prop |
|
|
147
|
-
| `Radio.Group dataSource=[{label,value}]` | `<RadioGroup options={[{label,value}]}>` | `dataSource` → `options`(对齐 antd / CheckboxGroup) |
|
|
148
|
-
| `Radio.Group value / onChange` | `<RadioGroup value onValueChange>` | Radix 命名:`onValueChange(val: string)` |
|
|
149
|
-
| `Radio.Group defaultValue` | `<RadioGroup defaultValue>` | 同名 |
|
|
150
|
-
| `Radio.Group disabled` | `<RadioGroup disabled>` | 整组禁用 |
|
|
151
|
-
| `Radio.Group size="small\|medium\|large"` | Radix 无内置 size;可通过 className 调整 | 新库不内置 size — 按钮模式固定 h-9,圆点模式固定 size-4,满足多数场景 |
|
|
152
|
-
|
|
153
|
-
### Breaking Changes(从旧库迁移时需改写)
|
|
154
|
-
|
|
155
|
-
1. `Radio` → `RadioGroupItem`(import + 命名)
|
|
156
|
-
2. `Radio.Group` → `RadioGroup`(独立 named export)
|
|
157
|
-
3. `shape="button"` → `variant="button"`(子项同步换成 `RadioGroupButton`)
|
|
158
|
-
4. `direction` → `orientation`(取值从 `hor/ver` 改为 `horizontal/vertical`)
|
|
159
|
-
5. `dataSource` → `options`(签名一致)
|
|
160
|
-
6. `onChange(value)` → `onValueChange(value)` (Radix 命名)
|
|
161
|
-
|
|
162
|
-
### 不修复 / 后续工序清单
|
|
163
|
-
|
|
164
|
-
- **按钮模式圆角**(2px → 4px):报告 §2.2,归 `@teamix-evo/tokens` 后续工序
|
|
165
|
-
- **按钮模式选中视觉**(old: 品牌色边框+浅蓝底 vs new: 品牌色填充+白字):报告 §5 已标注 "新库更现代,设计确认后保留",**不修复**
|
|
166
|
-
- **disabled opacity vs 灰色**:全局策略,**不修复**
|
|
167
|
-
- **size prop**:新库不内置 size(Radix 无此 prop),圆点 `size-4` / 按钮 `h-9` 已覆盖多数场景;如业务确有 size 需求,属于二级 slot 后续添加
|
|
168
|
-
|
|
169
|
-
### Radio 专项 AI 生成纪律
|
|
170
|
-
|
|
171
|
-
- **形态由父级 `variant` + 子项组件共同决定**:default → `RadioGroupItem`,button → `RadioGroupButton`,**不要混用**
|
|
172
|
-
- **数据驱动 `options` 模式与 children 互斥**:同时传时 children 优先;统一用一种写法
|
|
173
|
-
- **必须有初始选中**:用 `defaultValue` 给一个合理初值(用户进入页面看到全未选会困惑)
|
|
174
|
-
- **`value` 稳定唯一**:options[].value 不要用 index / 动态 ID;类同 CheckboxGroup 约束
|
|
175
|
-
- **Radix `onValueChange(val: string)`**:单参数字符串,**不要按旧库习惯**期待事件对象
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { RadioGroup, RadioGroupItem, RadioGroupButton } from './radio-group';
|
|
3
|
-
import type { RadioGroupOption } from './radio-group';
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof RadioGroup> = {
|
|
6
|
-
title: '数据录入 · Data Entry/RadioGroup',
|
|
7
|
-
component: RadioGroup,
|
|
8
|
-
tags: ['autodocs'],
|
|
9
|
-
parameters: {
|
|
10
|
-
docs: {
|
|
11
|
-
description: {
|
|
12
|
-
component:
|
|
13
|
-
'单选组 — 在一组互斥选项中选中唯一一个。Radix RadioGroup 实现 + antd Radio 的并集能力:同时提供默认的点选型 `RadioGroupItem` 与按钮型 `RadioGroupButton`(对齐 antd `Radio.Button`),通过 `variant` prop 切换。',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
argTypes: {
|
|
18
|
-
variant: { control: 'inline-radio', options: ['default', 'button'] },
|
|
19
|
-
disabled: { control: 'boolean' },
|
|
20
|
-
},
|
|
21
|
-
args: { variant: 'default', defaultValue: 'comfortable' },
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default meta;
|
|
25
|
-
type Story = StoryObj<typeof RadioGroup>;
|
|
26
|
-
|
|
27
|
-
export const Playground: Story = {
|
|
28
|
-
render: (args) => (
|
|
29
|
-
<RadioGroup {...args}>
|
|
30
|
-
<div className="flex items-center gap-2 text-sm">
|
|
31
|
-
<RadioGroupItem value="default" id="rg-a" />
|
|
32
|
-
<label htmlFor="rg-a">Default</label>
|
|
33
|
-
</div>
|
|
34
|
-
<div className="flex items-center gap-2 text-sm">
|
|
35
|
-
<RadioGroupItem value="comfortable" id="rg-b" />
|
|
36
|
-
<label htmlFor="rg-b">Comfortable</label>
|
|
37
|
-
</div>
|
|
38
|
-
<div className="flex items-center gap-2 text-sm">
|
|
39
|
-
<RadioGroupItem value="compact" id="rg-c" />
|
|
40
|
-
<label htmlFor="rg-c">Compact</label>
|
|
41
|
-
</div>
|
|
42
|
-
</RadioGroup>
|
|
43
|
-
),
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const ButtonStyle: Story = {
|
|
47
|
-
parameters: { controls: { disable: true } },
|
|
48
|
-
render: () => (
|
|
49
|
-
<RadioGroup variant="button" defaultValue="month">
|
|
50
|
-
<RadioGroupButton value="day">日</RadioGroupButton>
|
|
51
|
-
<RadioGroupButton value="week">周</RadioGroupButton>
|
|
52
|
-
<RadioGroupButton value="month">月</RadioGroupButton>
|
|
53
|
-
<RadioGroupButton value="year">年</RadioGroupButton>
|
|
54
|
-
</RadioGroup>
|
|
55
|
-
),
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const Disabled: Story = {
|
|
59
|
-
parameters: { controls: { disable: true } },
|
|
60
|
-
render: () => (
|
|
61
|
-
<div className="flex flex-col gap-6">
|
|
62
|
-
<RadioGroup defaultValue="a" disabled>
|
|
63
|
-
<div className="flex items-center gap-2 text-sm">
|
|
64
|
-
<RadioGroupItem value="a" id="rd-1" />
|
|
65
|
-
<label htmlFor="rd-1">禁用 - 选项 A</label>
|
|
66
|
-
</div>
|
|
67
|
-
<div className="flex items-center gap-2 text-sm">
|
|
68
|
-
<RadioGroupItem value="b" id="rd-2" />
|
|
69
|
-
<label htmlFor="rd-2">禁用 - 选项 B</label>
|
|
70
|
-
</div>
|
|
71
|
-
</RadioGroup>
|
|
72
|
-
<RadioGroup variant="button" defaultValue="b" disabled>
|
|
73
|
-
<RadioGroupButton value="a">A</RadioGroupButton>
|
|
74
|
-
<RadioGroupButton value="b">B</RadioGroupButton>
|
|
75
|
-
</RadioGroup>
|
|
76
|
-
</div>
|
|
77
|
-
),
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
// ─── 数据驱动 options 模式(与 CheckboxGroup 对齐)──────────────────
|
|
81
|
-
|
|
82
|
-
const fruitOptions: RadioGroupOption[] = [
|
|
83
|
-
{ label: '苹果', value: 'apple' },
|
|
84
|
-
{ label: '香蕉', value: 'banana' },
|
|
85
|
-
{ label: '橘子', value: 'orange', disabled: true },
|
|
86
|
-
];
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* 数据驱动 — 对齐 cloud-design `Radio.Group dataSource` / antd `Radio.Group options`。
|
|
90
|
-
* 传入 `options` prop 即可,内部自动渲染 `RadioGroupItem` + Label。
|
|
91
|
-
*/
|
|
92
|
-
export const OptionsGroup: Story = {
|
|
93
|
-
parameters: { controls: { disable: true } },
|
|
94
|
-
render: () => <RadioGroup options={fruitOptions} defaultValue="apple" />,
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* 数据驱动 + 按钮模式 — `variant="button"` + `options`。
|
|
99
|
-
*/
|
|
100
|
-
export const OptionsButtonGroup: Story = {
|
|
101
|
-
parameters: { controls: { disable: true } },
|
|
102
|
-
render: () => (
|
|
103
|
-
<RadioGroup
|
|
104
|
-
variant="button"
|
|
105
|
-
options={[
|
|
106
|
-
{ label: '日', value: 'day' },
|
|
107
|
-
{ label: '周', value: 'week' },
|
|
108
|
-
{ label: '月', value: 'month' },
|
|
109
|
-
]}
|
|
110
|
-
defaultValue="month"
|
|
111
|
-
/>
|
|
112
|
-
),
|
|
113
|
-
};
|