@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,209 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
3
|
-
import { Circle } from 'lucide-react';
|
|
4
|
-
|
|
5
|
-
import { cn } from '@/utils/cn';
|
|
6
|
-
|
|
7
|
-
// ─── RadioGroupOption(数据驱动模式,对齐 CheckboxGroup)────────────────
|
|
8
|
-
|
|
9
|
-
export interface RadioGroupOption {
|
|
10
|
-
label: React.ReactNode;
|
|
11
|
-
value: string;
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface RadioGroupProps
|
|
16
|
-
extends Omit<
|
|
17
|
-
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>,
|
|
18
|
-
| 'value'
|
|
19
|
-
| 'defaultValue'
|
|
20
|
-
| 'onValueChange'
|
|
21
|
-
| 'disabled'
|
|
22
|
-
| 'required'
|
|
23
|
-
| 'name'
|
|
24
|
-
| 'orientation'
|
|
25
|
-
| 'dir'
|
|
26
|
-
| 'loop'
|
|
27
|
-
> {
|
|
28
|
-
/**
|
|
29
|
-
* 受控选中值(等价 antd `value`,Radix 命名一致)。
|
|
30
|
-
* 与 `defaultValue` 二选一,不同时传。
|
|
31
|
-
*/
|
|
32
|
-
value?: string;
|
|
33
|
-
/** 非受控初始选中值。 */
|
|
34
|
-
defaultValue?: string;
|
|
35
|
-
/**
|
|
36
|
-
* 选中变化回调 — Radix 命名,等价 antd `onChange(value)`。
|
|
37
|
-
*/
|
|
38
|
-
onValueChange?: (value: string) => void;
|
|
39
|
-
/**
|
|
40
|
-
* 整组禁用(灰化所有 Item / Button + 不响应交互)。
|
|
41
|
-
* @default false
|
|
42
|
-
*/
|
|
43
|
-
disabled?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* 表单必填 — 设置 HTML 原生 `required`,表单层校验依赖此值。
|
|
46
|
-
* @default false
|
|
47
|
-
*/
|
|
48
|
-
required?: boolean;
|
|
49
|
-
/** 表单字段名(原生 `<input name>`,提交表单时使用;同组所有 Item 共用)。 */
|
|
50
|
-
name?: string;
|
|
51
|
-
/**
|
|
52
|
-
* 排列方向(键盘导航方向也跟随此值)。
|
|
53
|
-
* @default "vertical"
|
|
54
|
-
*/
|
|
55
|
-
orientation?: 'horizontal' | 'vertical';
|
|
56
|
-
/**
|
|
57
|
-
* 渲染样式 — `default` 经典圆点;`button` 渲染为按钮组(antd `Radio.Button` 并集)。
|
|
58
|
-
* @default "default"
|
|
59
|
-
*/
|
|
60
|
-
variant?: 'default' | 'button';
|
|
61
|
-
/**
|
|
62
|
-
* 选项数据源(数据驱动模式,与 CheckboxGroup `options` 对齐)。
|
|
63
|
-
* 传入后内部自动渲染 `RadioGroupItem` / `RadioGroupButton`,无需 `children`.
|
|
64
|
-
* 当同时存在 `children` 与 `options` 时,`children` 优先。
|
|
65
|
-
*/
|
|
66
|
-
options?: RadioGroupOption[];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const RadioGroup = React.forwardRef<
|
|
70
|
-
React.ElementRef<typeof RadioGroupPrimitive.Root>,
|
|
71
|
-
RadioGroupProps
|
|
72
|
-
>(({ className, variant = 'default', orientation = 'vertical', options, children, ...props }, ref) => {
|
|
73
|
-
// children 优先;仅当无 children 且传入 options 时内部渲染
|
|
74
|
-
const content =
|
|
75
|
-
children ||
|
|
76
|
-
(options &&
|
|
77
|
-
options.map((opt) =>
|
|
78
|
-
variant === 'button' ? (
|
|
79
|
-
<RadioGroupButton
|
|
80
|
-
key={opt.value}
|
|
81
|
-
value={opt.value}
|
|
82
|
-
disabled={opt.disabled}
|
|
83
|
-
>
|
|
84
|
-
{opt.label}
|
|
85
|
-
</RadioGroupButton>
|
|
86
|
-
) : (
|
|
87
|
-
<div key={opt.value} className="flex items-center gap-2 text-xs">
|
|
88
|
-
<RadioGroupItem
|
|
89
|
-
value={opt.value}
|
|
90
|
-
id={`rg-opt-${opt.value}`}
|
|
91
|
-
disabled={opt.disabled}
|
|
92
|
-
/>
|
|
93
|
-
<label
|
|
94
|
-
htmlFor={`rg-opt-${opt.value}`}
|
|
95
|
-
className={cn(
|
|
96
|
-
(opt.disabled || props.disabled) &&
|
|
97
|
-
'cursor-not-allowed opacity-60',
|
|
98
|
-
)}
|
|
99
|
-
>
|
|
100
|
-
{opt.label}
|
|
101
|
-
</label>
|
|
102
|
-
</div>
|
|
103
|
-
),
|
|
104
|
-
));
|
|
105
|
-
|
|
106
|
-
return (
|
|
107
|
-
<RadioGroupPrimitive.Root
|
|
108
|
-
ref={ref}
|
|
109
|
-
data-variant={variant}
|
|
110
|
-
data-orientation={orientation}
|
|
111
|
-
orientation={orientation}
|
|
112
|
-
className={cn(
|
|
113
|
-
variant === 'button'
|
|
114
|
-
? 'inline-flex divide-x divide-input overflow-hidden rounded-md border border-input shadow-sm'
|
|
115
|
-
: // 默认形态:横向 16px (gap-4, 对齐规范 §3.1 规则 3 "checkbox/radio 横向 16px"),
|
|
116
|
-
// 纵向 8px (gap-2, 紧凑列表)
|
|
117
|
-
orientation === 'horizontal'
|
|
118
|
-
? 'flex flex-wrap gap-4'
|
|
119
|
-
: 'grid gap-2',
|
|
120
|
-
className,
|
|
121
|
-
)}
|
|
122
|
-
{...props}
|
|
123
|
-
>
|
|
124
|
-
{content}
|
|
125
|
-
</RadioGroupPrimitive.Root>
|
|
126
|
-
);
|
|
127
|
-
});
|
|
128
|
-
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
129
|
-
|
|
130
|
-
export interface RadioGroupItemProps
|
|
131
|
-
extends Omit<
|
|
132
|
-
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>,
|
|
133
|
-
'value' | 'disabled' | 'required' | 'id'
|
|
134
|
-
> {
|
|
135
|
-
/**
|
|
136
|
-
* 选项 value — 选中时把此值赋给 RadioGroup 的 `value`。
|
|
137
|
-
* **必填** — 每个 Item 必须有稳定唯一的 value(string)。
|
|
138
|
-
*/
|
|
139
|
-
value: string;
|
|
140
|
-
/**
|
|
141
|
-
* 禁用此选项(整组 `disabled` 会覆盖单项的 `disabled={false}`)。
|
|
142
|
-
* @default false
|
|
143
|
-
*/
|
|
144
|
-
disabled?: boolean;
|
|
145
|
-
/** 必填(透传 HTML required)。 */
|
|
146
|
-
required?: boolean;
|
|
147
|
-
/** id 属性,配合 `<label htmlFor>` 关联选项文字。 */
|
|
148
|
-
id?: string;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
const RadioGroupItem = React.forwardRef<
|
|
152
|
-
React.ElementRef<typeof RadioGroupPrimitive.Item>,
|
|
153
|
-
RadioGroupItemProps
|
|
154
|
-
>(({ className, ...props }, ref) => (
|
|
155
|
-
<RadioGroupPrimitive.Item
|
|
156
|
-
ref={ref}
|
|
157
|
-
className={cn(
|
|
158
|
-
'aspect-square size-4 cursor-pointer rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50',
|
|
159
|
-
className,
|
|
160
|
-
)}
|
|
161
|
-
{...props}
|
|
162
|
-
>
|
|
163
|
-
<RadioGroupPrimitive.Indicator className="flex items-center justify-center">
|
|
164
|
-
<Circle className="size-2.5 fill-primary" />
|
|
165
|
-
</RadioGroupPrimitive.Indicator>
|
|
166
|
-
</RadioGroupPrimitive.Item>
|
|
167
|
-
));
|
|
168
|
-
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
169
|
-
|
|
170
|
-
// ─── RadioGroupButton(Button-style item, antd `Radio.Button` 并集)───────
|
|
171
|
-
|
|
172
|
-
export interface RadioGroupButtonProps
|
|
173
|
-
extends Omit<
|
|
174
|
-
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>,
|
|
175
|
-
'value' | 'disabled' | 'required' | 'id'
|
|
176
|
-
> {
|
|
177
|
-
/**
|
|
178
|
-
* 选项 value — 选中时把此值赋给 RadioGroup 的 `value`。**必填**,稳定唯一。
|
|
179
|
-
*/
|
|
180
|
-
value: string;
|
|
181
|
-
/**
|
|
182
|
-
* 禁用此选项(整组 `disabled` 会覆盖单项的 `disabled={false}`)。
|
|
183
|
-
* @default false
|
|
184
|
-
*/
|
|
185
|
-
disabled?: boolean;
|
|
186
|
-
/** 必填(透传 HTML required)。 */
|
|
187
|
-
required?: boolean;
|
|
188
|
-
/** id 属性,通常无需手传(按钮组形态自身已含可点击区域)。 */
|
|
189
|
-
id?: string;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
const RadioGroupButton = React.forwardRef<
|
|
193
|
-
React.ElementRef<typeof RadioGroupPrimitive.Item>,
|
|
194
|
-
RadioGroupButtonProps
|
|
195
|
-
>(({ className, children, ...props }, ref) => (
|
|
196
|
-
<RadioGroupPrimitive.Item
|
|
197
|
-
ref={ref}
|
|
198
|
-
className={cn(
|
|
199
|
-
'inline-flex h-9 cursor-pointer items-center justify-center px-4 text-xs font-medium transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:hover:bg-primary/90',
|
|
200
|
-
className,
|
|
201
|
-
)}
|
|
202
|
-
{...props}
|
|
203
|
-
>
|
|
204
|
-
{children}
|
|
205
|
-
</RadioGroupPrimitive.Item>
|
|
206
|
-
));
|
|
207
|
-
RadioGroupButton.displayName = 'RadioGroupButton';
|
|
208
|
-
|
|
209
|
-
export { RadioGroup, RadioGroupItem, RadioGroupButton };
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: rate
|
|
3
|
-
name: Rate
|
|
4
|
-
displayName: 评分
|
|
5
|
-
type: component
|
|
6
|
-
category: data-entry
|
|
7
|
-
since: 0.1.0
|
|
8
|
-
package: '@teamix-evo/ui'
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Rate 评分
|
|
12
|
-
|
|
13
|
-
星级评分 — antd 独有补足。**等价 antd `Rate`**。支持半星(`allowHalf`)、再次点击清零(`allowClear`)、自定义图标(`character`)、只读展示(`disabled`)。
|
|
14
|
-
|
|
15
|
-
## When to use
|
|
16
|
-
|
|
17
|
-
- 评论 / 评分场景(电商商品、酒店、餐厅)
|
|
18
|
-
- 用户偏好评分(满意度调查)
|
|
19
|
-
- 只读展示评分均值(`disabled` + `value`)
|
|
20
|
-
|
|
21
|
-
## When NOT to use
|
|
22
|
-
|
|
23
|
-
- 二元选择(喜欢 / 不喜欢)→ `Toggle` / `Button` 配 icon
|
|
24
|
-
- 多档定量评分(0~100)→ `Slider`
|
|
25
|
-
|
|
26
|
-
## Props
|
|
27
|
-
|
|
28
|
-
<!-- auto:props:begin -->
|
|
29
|
-
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
30
|
-
| --- | --- | --- | --- | --- |
|
|
31
|
-
| `count` | `number` | `5` | – | 总星数(antd `count` 并集)。 |
|
|
32
|
-
| `value` | `number` | – | – | 受控值。 |
|
|
33
|
-
| `defaultValue` | `number` | – | – | uncontrolled 初值。 |
|
|
34
|
-
| `allowHalf` | `boolean` | `false` | – | 允许半星(antd `allowHalf` 并集) — 启用后单星可点击左半 / 右半。 |
|
|
35
|
-
| `allowClear` | `boolean` | `true` | – | 允许再次点击同值清零(antd `allowClear` 并集)。 |
|
|
36
|
-
| `disabled` | `boolean` | – | – | 禁用(只展示)。 |
|
|
37
|
-
| `size` | `'sm' \| 'md' \| 'default' \| 'lg'` | `"default"` | – | 尺寸(影响星图大小)。 |
|
|
38
|
-
| `character` | `React.ReactNode` | – | – | 自定义图标(antd `character` 并集) — 默认 `lucide-react` 的 `Star`。 |
|
|
39
|
-
| `onChange` | `(value: number) => void` | – | – | value 变化回调。 |
|
|
40
|
-
<!-- auto:props:end -->
|
|
41
|
-
|
|
42
|
-
## 依赖
|
|
43
|
-
|
|
44
|
-
<!-- auto:deps:begin -->
|
|
45
|
-
### 同库依赖
|
|
46
|
-
|
|
47
|
-
> `teamix-evo ui add rate` 时,以下 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 lucide-react@^0.460.0
|
|
59
|
-
```
|
|
60
|
-
<!-- auto:deps:end -->
|
|
61
|
-
|
|
62
|
-
## AI 生成纪律
|
|
63
|
-
|
|
64
|
-
- **`disabled` 即只读** — 配 `value` 显示评分均值;**不要**模拟"半禁用"或"局部可改"
|
|
65
|
-
- **`allowHalf` 仅前端显示用** — 业务层数据建议存为 number(允许 0.5 步长)
|
|
66
|
-
- **`allowClear` 默认 true** — 与 antd 一致;关闭后用户无法清空评分,只能改值
|
|
67
|
-
- **`character` 自定义图标**:必须是 `React.isValidElement` 节点,组件会在选中态注入 `fill="currentColor"`;**不要**传字符串
|
|
68
|
-
- **大评分场景**(`count > 7`)视觉拥挤,建议改用 `Slider` + 数字展示
|
|
69
|
-
- **尺寸与 cloud-design 对齐**:`sm/default/lg` = 16/20/24px,与其他表单表一致的密度作业
|
|
70
|
-
- **半星渲染分两层**:底层 `text-muted-foreground/30` 描边空星 · 上层 `clipPath: inset(0 50% 0 0)` 裁切到左半边 + `text-warning` 填充;**不要**反过来(会丢失右半边描边)
|
|
71
|
-
|
|
72
|
-
## Examples
|
|
73
|
-
|
|
74
|
-
```tsx
|
|
75
|
-
import { Rate } from '@/components/ui/rate';
|
|
76
|
-
import { Heart } from 'lucide-react';
|
|
77
|
-
import * as React from 'react';
|
|
78
|
-
|
|
79
|
-
// 基础
|
|
80
|
-
<Rate defaultValue={3} />
|
|
81
|
-
|
|
82
|
-
// 半星
|
|
83
|
-
<Rate allowHalf defaultValue={3.5} />
|
|
84
|
-
|
|
85
|
-
// 受控
|
|
86
|
-
const [v, setV] = React.useState(0);
|
|
87
|
-
<Rate value={v} onChange={setV} allowHalf />
|
|
88
|
-
|
|
89
|
-
// 自定义图标
|
|
90
|
-
<Rate character={<Heart className="size-5" />} count={5} defaultValue={3} />
|
|
91
|
-
|
|
92
|
-
// 只读
|
|
93
|
-
<Rate disabled value={4.5} allowHalf />
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## Rating 形态 — 旧库 API → 新库映射
|
|
97
|
-
|
|
98
|
-
> 旧库(Teamix 1.0 / `@alifd/next.Rating`)→ 新库 `Rate`(对齐 antd 命名)。能力**全部并集已实现**,只有少量低频 prop 不修复。
|
|
99
|
-
|
|
100
|
-
| 旧库 API | 新库 API | 备注 |
|
|
101
|
-
| --- | --- | --- |
|
|
102
|
-
| 组件名 `Rating` | `Rate` | 对齐 antd 命名 |
|
|
103
|
-
| `count` | `count` | 同名 |
|
|
104
|
-
| `value` / `defaultValue` | `value` / `defaultValue` | 同名 |
|
|
105
|
-
| `onChange` | `onChange` | 同名 |
|
|
106
|
-
| `allowHalf` | `allowHalf` | ✅ 已实现 — 半星裁切渲染(clipPath) |
|
|
107
|
-
| `readOnly` | `disabled` | 只展示场景用 `disabled` 实现(antd 当前版本也只有 disabled) |
|
|
108
|
-
| `size="small\|medium\|large"` | `size="sm\|md\|lg"` | 三档对应 16/20/24px |
|
|
109
|
-
| `character` 自定义图标 | `character` | ✅ 已实现 — 默认 `lucide.Star`,可传任意 ReactNode |
|
|
110
|
-
| `showGrade` 文案展示 | 不修复 | 外部组合 `<Text>` 更灵活,P2 |
|
|
111
|
-
| `onHoverChange` 悬浮值回调 | 不修复 | 低频,P2 |
|
|
112
|
-
| `isPreview` / `renderPreview` | `disabled` 替代 | 旧库低频 API,直接用 disabled |
|
|
113
|
-
|
|
114
|
-
### 不修复 / 后续工序清单
|
|
115
|
-
|
|
116
|
-
- **`showGrade` 文案展示**(P2):用 `<Rate value={4} disabled /> <Text>4.5 / 5</Text>` 外部组合更灵活
|
|
117
|
-
- **`onHoverChange` 悬浮回调**(P2):低频,业务侧用 `onMouseEnter` 事件捕获 thumb 位置自管
|
|
118
|
-
- **`isPreview` / `renderPreview`**:报告 §5 已列入"保留新库优势",`disabled` 已能替代,**不修复**
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
|
-
import { Heart } from 'lucide-react';
|
|
4
|
-
import { Rate } from './rate';
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof Rate> = {
|
|
7
|
-
title: '数据录入 · Data Entry/Rate',
|
|
8
|
-
component: Rate,
|
|
9
|
-
tags: ['autodocs'],
|
|
10
|
-
parameters: {
|
|
11
|
-
docs: {
|
|
12
|
-
description: {
|
|
13
|
-
component:
|
|
14
|
-
'星级评分 — 评论 / 商品评分 / 偏好满意度。支持半星 + 再次点击清零 + 自定义图标 + 只读展示。等价 antd `Rate`。',
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
argTypes: {
|
|
19
|
-
count: { control: { type: 'number', min: 3, max: 10 } },
|
|
20
|
-
allowHalf: { control: 'boolean' },
|
|
21
|
-
allowClear: { control: 'boolean' },
|
|
22
|
-
disabled: { control: 'boolean' },
|
|
23
|
-
size: { control: 'inline-radio', options: ['sm', 'default', 'lg'] },
|
|
24
|
-
},
|
|
25
|
-
args: {
|
|
26
|
-
count: 5,
|
|
27
|
-
allowHalf: false,
|
|
28
|
-
allowClear: true,
|
|
29
|
-
disabled: false,
|
|
30
|
-
size: 'default',
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export default meta;
|
|
35
|
-
type Story = StoryObj<typeof Rate>;
|
|
36
|
-
|
|
37
|
-
export const Playground: Story = {
|
|
38
|
-
render: (args) => <Rate {...args} defaultValue={3} />,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const HalfStar: Story = {
|
|
42
|
-
parameters: { controls: { disable: true } },
|
|
43
|
-
render: () => <Rate allowHalf defaultValue={3.5} />,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const Controlled: Story = {
|
|
47
|
-
parameters: { controls: { disable: true } },
|
|
48
|
-
render: () => {
|
|
49
|
-
const [v, setV] = React.useState<number>(0);
|
|
50
|
-
return (
|
|
51
|
-
<div className="flex items-center gap-3">
|
|
52
|
-
<Rate value={v} onChange={setV} allowHalf />
|
|
53
|
-
<span className="text-sm text-muted-foreground tabular-nums">
|
|
54
|
-
{v.toFixed(1)} / 5
|
|
55
|
-
</span>
|
|
56
|
-
</div>
|
|
57
|
-
);
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const CustomIcon: Story = {
|
|
62
|
-
parameters: { controls: { disable: true } },
|
|
63
|
-
render: () => (
|
|
64
|
-
<Rate character={<Heart className="size-5" />} count={5} defaultValue={3} />
|
|
65
|
-
),
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export const ReadOnly: Story = {
|
|
69
|
-
parameters: { controls: { disable: true } },
|
|
70
|
-
render: () => (
|
|
71
|
-
<div className="flex items-center gap-2">
|
|
72
|
-
<Rate disabled value={4.5} allowHalf size="sm" />
|
|
73
|
-
<span className="text-sm text-muted-foreground">
|
|
74
|
-
4.5 / 5 (1,287 评价)
|
|
75
|
-
</span>
|
|
76
|
-
</div>
|
|
77
|
-
),
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const Sizes: Story = {
|
|
81
|
-
parameters: { controls: { disable: true } },
|
|
82
|
-
render: () => (
|
|
83
|
-
<div className="flex items-center gap-6">
|
|
84
|
-
<Rate size="sm" defaultValue={3} />
|
|
85
|
-
<Rate size="default" defaultValue={3} />
|
|
86
|
-
<Rate size="lg" defaultValue={3} />
|
|
87
|
-
</div>
|
|
88
|
-
),
|
|
89
|
-
};
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Star } from 'lucide-react';
|
|
3
|
-
|
|
4
|
-
import { cn } from '@/utils/cn';
|
|
5
|
-
|
|
6
|
-
export interface RateProps
|
|
7
|
-
extends Omit<
|
|
8
|
-
React.HTMLAttributes<HTMLDivElement>,
|
|
9
|
-
'onChange' | 'defaultValue'
|
|
10
|
-
> {
|
|
11
|
-
/**
|
|
12
|
-
* 总星数(antd `count` 并集)。
|
|
13
|
-
* @default 5
|
|
14
|
-
*/
|
|
15
|
-
count?: number;
|
|
16
|
-
/** 受控值。 */
|
|
17
|
-
value?: number;
|
|
18
|
-
/** uncontrolled 初值。 */
|
|
19
|
-
defaultValue?: number;
|
|
20
|
-
/**
|
|
21
|
-
* 允许半星(antd `allowHalf` 并集) — 启用后单星可点击左半 / 右半。
|
|
22
|
-
* @default false
|
|
23
|
-
*/
|
|
24
|
-
allowHalf?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* 允许再次点击同值清零(antd `allowClear` 并集)。
|
|
27
|
-
* @default true
|
|
28
|
-
*/
|
|
29
|
-
allowClear?: boolean;
|
|
30
|
-
/** 禁用(只展示)。 */
|
|
31
|
-
disabled?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* 尺寸(影响星图大小)。
|
|
34
|
-
* @default "default"
|
|
35
|
-
*/
|
|
36
|
-
size?: 'sm' | 'md' | 'default' | 'lg';
|
|
37
|
-
/**
|
|
38
|
-
* 自定义图标(antd `character` 并集) — 默认 `lucide-react` 的 `Star`。
|
|
39
|
-
*/
|
|
40
|
-
character?: React.ReactNode;
|
|
41
|
-
/** value 变化回调。 */
|
|
42
|
-
onChange?: (value: number) => void;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// 与 cloud-design Rating small/medium/large = 16/20/24 对齐,使用三档以调与其他表单控件一致的视觉密度。
|
|
46
|
-
const sizeMap = {
|
|
47
|
-
sm: 'size-4',
|
|
48
|
-
md: 'size-5',
|
|
49
|
-
default: 'size-5',
|
|
50
|
-
lg: 'size-6',
|
|
51
|
-
} as const;
|
|
52
|
-
|
|
53
|
-
const Rate = React.forwardRef<HTMLDivElement, RateProps>(
|
|
54
|
-
(
|
|
55
|
-
{
|
|
56
|
-
count = 5,
|
|
57
|
-
value,
|
|
58
|
-
defaultValue,
|
|
59
|
-
allowHalf = false,
|
|
60
|
-
allowClear = true,
|
|
61
|
-
disabled = false,
|
|
62
|
-
size = 'md',
|
|
63
|
-
character,
|
|
64
|
-
onChange,
|
|
65
|
-
className,
|
|
66
|
-
...props
|
|
67
|
-
},
|
|
68
|
-
ref,
|
|
69
|
-
) => {
|
|
70
|
-
const isControlled = value !== undefined;
|
|
71
|
-
const [internal, setInternal] = React.useState<number>(defaultValue ?? 0);
|
|
72
|
-
const current = isControlled ? value! : internal;
|
|
73
|
-
const [hover, setHover] = React.useState<number | null>(null);
|
|
74
|
-
|
|
75
|
-
const active = hover ?? current;
|
|
76
|
-
|
|
77
|
-
const set = (next: number) => {
|
|
78
|
-
const final = allowClear && next === current ? 0 : next;
|
|
79
|
-
if (!isControlled) setInternal(final);
|
|
80
|
-
onChange?.(final);
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const Icon = character ?? <Star className={cn(sizeMap[size])} />;
|
|
84
|
-
|
|
85
|
-
// 未选中的底色 — 使用 `text-muted-foreground/30` 与 cloud-design 空星描边一致
|
|
86
|
-
const inactiveClass = 'text-muted-foreground/30';
|
|
87
|
-
const activeClass = 'text-warning';
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<div
|
|
91
|
-
ref={ref}
|
|
92
|
-
role="radiogroup"
|
|
93
|
-
aria-disabled={disabled}
|
|
94
|
-
className={cn(
|
|
95
|
-
'inline-flex items-center gap-1',
|
|
96
|
-
disabled && 'cursor-not-allowed opacity-50',
|
|
97
|
-
className,
|
|
98
|
-
)}
|
|
99
|
-
onMouseLeave={() => !disabled && setHover(null)}
|
|
100
|
-
{...props}
|
|
101
|
-
>
|
|
102
|
-
{Array.from({ length: count }).map((_, i) => {
|
|
103
|
-
const fullValue = i + 1;
|
|
104
|
-
const halfValue = i + 0.5;
|
|
105
|
-
const filledFull = active >= fullValue;
|
|
106
|
-
const filledHalf = !filledFull && allowHalf && active >= halfValue;
|
|
107
|
-
|
|
108
|
-
return (
|
|
109
|
-
<span
|
|
110
|
-
key={i}
|
|
111
|
-
role="radio"
|
|
112
|
-
aria-checked={current >= fullValue}
|
|
113
|
-
className="relative inline-flex"
|
|
114
|
-
>
|
|
115
|
-
{allowHalf && !disabled ? (
|
|
116
|
-
<>
|
|
117
|
-
<span
|
|
118
|
-
onMouseEnter={() => setHover(halfValue)}
|
|
119
|
-
onClick={() => set(halfValue)}
|
|
120
|
-
className="absolute left-0 top-0 z-10 size-1/2 cursor-pointer"
|
|
121
|
-
aria-hidden="true"
|
|
122
|
-
/>
|
|
123
|
-
<span
|
|
124
|
-
onMouseEnter={() => setHover(fullValue)}
|
|
125
|
-
onClick={() => set(fullValue)}
|
|
126
|
-
className="absolute right-0 top-0 z-10 size-1/2 cursor-pointer"
|
|
127
|
-
aria-hidden="true"
|
|
128
|
-
/>
|
|
129
|
-
</>
|
|
130
|
-
) : !disabled ? (
|
|
131
|
-
<span
|
|
132
|
-
onMouseEnter={() => setHover(fullValue)}
|
|
133
|
-
onClick={() => set(fullValue)}
|
|
134
|
-
className="absolute inset-0 z-10 cursor-pointer"
|
|
135
|
-
aria-hidden="true"
|
|
136
|
-
/>
|
|
137
|
-
) : null}
|
|
138
|
-
|
|
139
|
-
{filledFull ? (
|
|
140
|
-
<span className={activeClass}>
|
|
141
|
-
{React.isValidElement(Icon)
|
|
142
|
-
? React.cloneElement(
|
|
143
|
-
Icon as React.ReactElement<{ fill?: string }>,
|
|
144
|
-
{ fill: 'currentColor' },
|
|
145
|
-
)
|
|
146
|
-
: Icon}
|
|
147
|
-
</span>
|
|
148
|
-
) : filledHalf ? (
|
|
149
|
-
<span className="relative inline-block">
|
|
150
|
-
{/* 底层:描边空星(完整轮廓,取代 muted-foreground/40 深度运动) */}
|
|
151
|
-
<span className={inactiveClass}>{Icon}</span>
|
|
152
|
-
{/* 上层:裁切到左半边 + 填充 currentColor */}
|
|
153
|
-
<span
|
|
154
|
-
className={cn(
|
|
155
|
-
'absolute inset-0 overflow-hidden',
|
|
156
|
-
activeClass,
|
|
157
|
-
)}
|
|
158
|
-
style={{ clipPath: 'inset(0 50% 0 0)' }}
|
|
159
|
-
>
|
|
160
|
-
{React.isValidElement(Icon)
|
|
161
|
-
? React.cloneElement(
|
|
162
|
-
Icon as React.ReactElement<{ fill?: string }>,
|
|
163
|
-
{ fill: 'currentColor' },
|
|
164
|
-
)
|
|
165
|
-
: Icon}
|
|
166
|
-
</span>
|
|
167
|
-
</span>
|
|
168
|
-
) : (
|
|
169
|
-
<span className={inactiveClass}>{Icon}</span>
|
|
170
|
-
)}
|
|
171
|
-
</span>
|
|
172
|
-
);
|
|
173
|
-
})}
|
|
174
|
-
</div>
|
|
175
|
-
);
|
|
176
|
-
},
|
|
177
|
-
);
|
|
178
|
-
Rate.displayName = 'Rate';
|
|
179
|
-
|
|
180
|
-
export { Rate };
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: resizable
|
|
3
|
-
name: Resizable
|
|
4
|
-
displayName: 可拖拽分栏
|
|
5
|
-
type: component
|
|
6
|
-
category: layout
|
|
7
|
-
since: 0.1.0
|
|
8
|
-
package: '@teamix-evo/ui'
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Resizable 可拖拽分栏
|
|
12
|
-
|
|
13
|
-
可拖拽分栏 — 基于 [`react-resizable-panels`](https://react-resizable-panels.vercel.app/),桌面应用 / 编辑器风格(VS Code、Figma、Slack)。
|
|
14
|
-
对应 antd `Splitter`(v5.16+)的核心场景。
|
|
15
|
-
|
|
16
|
-
## When to use
|
|
17
|
-
|
|
18
|
-
- 编辑器双栏 / 三栏布局(目录 / 编辑区 / 预览)
|
|
19
|
-
- 可调宽度的侧边栏 + 主区
|
|
20
|
-
- 上下分割面板(终端 / 输出)
|
|
21
|
-
- 嵌套面板(网格化布局)
|
|
22
|
-
|
|
23
|
-
## When NOT to use
|
|
24
|
-
|
|
25
|
-
- 固定宽度的 Sidebar → `Sidebar`(支持折叠 / icon 模式)
|
|
26
|
-
- 临时分栏 → `Sheet` / `Drawer`
|
|
27
|
-
- 卡片网格 → CSS Grid
|
|
28
|
-
|
|
29
|
-
## Props
|
|
30
|
-
|
|
31
|
-
<!-- auto:props:begin -->
|
|
32
|
-
_(组件无 `<Name>Props` interface — props 详见 [`resizable.tsx`](./resizable.tsx))_
|
|
33
|
-
<!-- auto:props:end -->
|
|
34
|
-
|
|
35
|
-
## 依赖
|
|
36
|
-
|
|
37
|
-
<!-- auto:deps:begin -->
|
|
38
|
-
### 同库依赖
|
|
39
|
-
|
|
40
|
-
> `teamix-evo ui add resizable` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
41
|
-
|
|
42
|
-
| Entry | 类型 | 描述 |
|
|
43
|
-
| --- | --- | --- |
|
|
44
|
-
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
45
|
-
|
|
46
|
-
### npm 依赖
|
|
47
|
-
|
|
48
|
-
> 业务侧需要先 `pnpm add` / `npm install` 这些包。CLI 在 `ui add` 完成后会列出此提示。
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
pnpm add react-resizable-panels@^2.0.0 lucide-react@^0.460.0
|
|
52
|
-
```
|
|
53
|
-
<!-- auto:deps:end -->
|
|
54
|
-
|
|
55
|
-
## AI 生成纪律
|
|
56
|
-
|
|
57
|
-
- **`PanelGroup` 必给容器固定尺寸**:height / width 不能 0(否则面板无可分配空间)
|
|
58
|
-
- **`defaultSize` 总和应为 100**:N 个 panel 的默认大小相加 = 100
|
|
59
|
-
- **`minSize` 防止面板被拖到 0**:推荐每个 panel 最小 10~15(百分比)
|
|
60
|
-
- **`withHandle` 提升可发现性**:握把图标让用户立刻意识到可拖拽
|
|
61
|
-
- **嵌套**:嵌套 `PanelGroup` 时内层 `direction` 与外层不同,做网格化布局
|
|
62
|
-
|
|
63
|
-
## Examples
|
|
64
|
-
|
|
65
|
-
```tsx
|
|
66
|
-
import {
|
|
67
|
-
ResizablePanelGroup, ResizablePanel, ResizableHandle,
|
|
68
|
-
} from '@/components/ui/resizable';
|
|
69
|
-
|
|
70
|
-
// 横向双栏
|
|
71
|
-
<ResizablePanelGroup direction="horizontal" className="min-h-[300px] rounded-lg border">
|
|
72
|
-
<ResizablePanel defaultSize={30} minSize={20}>
|
|
73
|
-
<div className="flex h-full items-center justify-center p-6">侧栏</div>
|
|
74
|
-
</ResizablePanel>
|
|
75
|
-
<ResizableHandle withHandle />
|
|
76
|
-
<ResizablePanel defaultSize={70}>
|
|
77
|
-
<div className="flex h-full items-center justify-center p-6">主区</div>
|
|
78
|
-
</ResizablePanel>
|
|
79
|
-
</ResizablePanelGroup>
|
|
80
|
-
|
|
81
|
-
// 编辑器三栏(嵌套)
|
|
82
|
-
<ResizablePanelGroup direction="horizontal" className="min-h-[400px]">
|
|
83
|
-
<ResizablePanel defaultSize={20}>目录</ResizablePanel>
|
|
84
|
-
<ResizableHandle />
|
|
85
|
-
<ResizablePanel defaultSize={55}>
|
|
86
|
-
<ResizablePanelGroup direction="vertical">
|
|
87
|
-
<ResizablePanel defaultSize={70}>编辑区</ResizablePanel>
|
|
88
|
-
<ResizableHandle />
|
|
89
|
-
<ResizablePanel defaultSize={30}>终端</ResizablePanel>
|
|
90
|
-
</ResizablePanelGroup>
|
|
91
|
-
</ResizablePanel>
|
|
92
|
-
<ResizableHandle />
|
|
93
|
-
<ResizablePanel defaultSize={25}>预览</ResizablePanel>
|
|
94
|
-
</ResizablePanelGroup>
|
|
95
|
-
```
|