@teamix-evo/ui 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -50
- package/manifest.json +406 -653
- package/package.json +15 -34
- package/src/_design-system/theme-tokens/stories.tsx +1474 -0
- package/src/components/accordion/index.tsx +139 -0
- package/src/components/accordion/meta.md +162 -0
- package/src/components/accordion/stories.tsx +145 -0
- package/src/components/affix/index.tsx +149 -0
- package/src/components/affix/meta.md +23 -0
- package/src/components/affix/stories.tsx +70 -0
- package/src/components/alert/index.tsx +220 -0
- package/src/components/alert/meta.md +133 -0
- package/src/components/alert/stories.tsx +126 -0
- package/src/components/alert-dialog/index.tsx +282 -0
- package/src/components/alert-dialog/meta.md +86 -0
- package/src/components/alert-dialog/stories.tsx +163 -0
- package/src/components/avatar/index.tsx +159 -0
- package/src/components/avatar/meta.md +242 -0
- package/src/components/avatar/stories.tsx +241 -0
- package/src/components/badge/index.tsx +299 -0
- package/src/components/badge/meta.md +237 -0
- package/src/components/badge/stories.tsx +275 -0
- package/src/components/breadcrumb/index.tsx +137 -0
- package/src/components/breadcrumb/meta.md +64 -0
- package/src/components/breadcrumb/stories.tsx +86 -0
- package/src/components/button/index.tsx +202 -0
- package/src/components/button/meta.md +209 -0
- package/src/components/button/stories.tsx +215 -0
- package/src/components/button-group/index.tsx +211 -0
- package/src/components/button-group/meta.md +190 -0
- package/src/components/button-group/stories.tsx +182 -0
- package/src/components/calendar/index.tsx +240 -0
- package/src/components/calendar/meta.md +36 -0
- package/src/components/calendar/stories.tsx +36 -0
- package/src/components/card/index.tsx +262 -0
- package/src/components/card/meta.md +194 -0
- package/src/components/card/stories.tsx +202 -0
- package/src/components/carousel/index.tsx +481 -0
- package/src/components/carousel/meta.md +208 -0
- package/src/components/carousel/stories.tsx +271 -0
- package/src/components/cascader-select/index.tsx +308 -0
- package/src/components/cascader-select/meta.md +28 -0
- package/src/components/cascader-select/stories.tsx +118 -0
- package/src/components/checkbox/index.tsx +208 -0
- package/src/components/checkbox/meta.md +166 -0
- package/src/components/checkbox/stories.tsx +206 -0
- package/src/components/collapsible/index.tsx +72 -0
- package/src/components/collapsible/meta.md +87 -0
- package/src/components/collapsible/stories.tsx +97 -0
- package/src/components/color-picker/index.tsx +677 -0
- package/src/components/color-picker/meta.md +83 -0
- package/src/components/color-picker/stories.tsx +172 -0
- package/src/components/combobox/index.tsx +687 -0
- package/src/components/combobox/meta.md +83 -0
- package/src/components/combobox/stories.tsx +179 -0
- package/src/components/command/index.tsx +238 -0
- package/src/components/command/meta.md +48 -0
- package/src/components/command/stories.tsx +83 -0
- package/src/components/data-table/index.tsx +1537 -0
- package/src/components/data-table/meta.md +107 -0
- package/src/components/data-table/stories.tsx +1234 -0
- package/src/components/date-picker/index.tsx +1492 -0
- package/src/components/date-picker/meta.md +103 -0
- package/src/components/date-picker/stories.tsx +125 -0
- package/src/components/descriptions/index.tsx +535 -0
- package/src/components/descriptions/meta.md +104 -0
- package/src/components/descriptions/stories.tsx +389 -0
- package/src/components/dialog/index.tsx +255 -0
- package/src/components/dialog/meta.md +244 -0
- package/src/components/dialog/stories.tsx +330 -0
- package/src/components/dropdown-menu/index.tsx +301 -0
- package/src/components/dropdown-menu/meta.md +93 -0
- package/src/components/dropdown-menu/stories.tsx +124 -0
- package/src/components/empty/index.tsx +431 -0
- package/src/components/empty/meta.md +274 -0
- package/src/components/empty/stories.tsx +278 -0
- package/src/components/field/index.tsx +374 -0
- package/src/components/field/meta.md +283 -0
- package/src/components/field/stories.tsx +327 -0
- package/src/components/filter-bar/index.tsx +976 -0
- package/src/components/filter-bar/meta.md +57 -0
- package/src/components/filter-bar/stories.tsx +496 -0
- package/src/components/float-button/index.tsx +163 -0
- package/src/components/float-button/meta.md +73 -0
- package/src/components/float-button/stories.tsx +68 -0
- package/src/components/form/index.tsx +218 -0
- package/src/components/form/meta.md +16 -0
- package/src/components/form/stories.tsx +301 -0
- package/src/components/hover-card/index.tsx +103 -0
- package/src/components/hover-card/meta.md +71 -0
- package/src/components/hover-card/stories.tsx +107 -0
- package/src/components/icon/index.tsx +225 -0
- package/src/components/icon/meta.md +102 -0
- package/src/components/icon/stories.tsx +127 -0
- package/src/components/image/index.tsx +147 -0
- package/src/components/image/meta.md +55 -0
- package/src/components/image/stories.tsx +48 -0
- package/src/components/input/index.tsx +63 -0
- package/src/components/input/meta.md +57 -0
- package/src/components/input/stories.tsx +66 -0
- package/src/components/input-group/index.tsx +292 -0
- package/src/components/input-group/meta.md +108 -0
- package/src/components/input-group/stories.tsx +258 -0
- package/src/components/input-ip/index.tsx +288 -0
- package/src/components/input-ip/meta.md +48 -0
- package/src/components/input-ip/stories.tsx +69 -0
- package/src/components/input-number/index.tsx +360 -0
- package/src/components/input-number/meta.md +156 -0
- package/src/components/input-number/stories.tsx +187 -0
- package/src/components/item/index.tsx +368 -0
- package/src/components/item/meta.md +395 -0
- package/src/components/item/stories.tsx +432 -0
- package/src/components/label/index.tsx +44 -0
- package/src/components/label/meta.md +68 -0
- package/src/components/label/stories.tsx +64 -0
- package/src/components/mentions/index.tsx +369 -0
- package/src/components/mentions/meta.md +118 -0
- package/src/components/mentions/stories.tsx +153 -0
- package/src/components/menubar/index.tsx +313 -0
- package/src/components/menubar/meta.md +52 -0
- package/src/components/menubar/stories.tsx +99 -0
- package/src/components/navigation-menu/index.tsx +216 -0
- package/src/components/navigation-menu/meta.md +66 -0
- package/src/components/navigation-menu/stories.tsx +137 -0
- package/src/components/page-header/index.tsx +218 -0
- package/src/components/page-header/meta.md +211 -0
- package/src/components/page-header/stories.tsx +290 -0
- package/src/components/page-shell/index.tsx +119 -0
- package/src/components/page-shell/meta.md +115 -0
- package/src/components/page-shell/stories.tsx +154 -0
- package/src/components/pagination/index.tsx +580 -0
- package/src/components/pagination/meta.md +39 -0
- package/src/components/pagination/stories.tsx +319 -0
- package/src/components/popconfirm/index.tsx +477 -0
- package/src/components/popconfirm/meta.md +164 -0
- package/src/components/popconfirm/stories.tsx +231 -0
- package/src/components/popover/index.tsx +181 -0
- package/src/components/popover/meta.md +97 -0
- package/src/components/popover/stories.tsx +169 -0
- package/src/components/progress/index.tsx +176 -0
- package/src/components/progress/meta.md +95 -0
- package/src/components/progress/stories.tsx +115 -0
- package/src/components/radio-group/index.tsx +78 -0
- package/src/components/radio-group/meta.md +137 -0
- package/src/components/radio-group/stories.tsx +285 -0
- package/src/components/rate/index.tsx +284 -0
- package/src/components/rate/meta.md +63 -0
- package/src/components/rate/stories.tsx +107 -0
- package/src/components/resizable/index.tsx +122 -0
- package/src/components/resizable/meta.md +142 -0
- package/src/components/resizable/stories.tsx +105 -0
- package/src/components/scroll-area/index.tsx +83 -0
- package/src/components/scroll-area/meta.md +85 -0
- package/src/components/scroll-area/stories.tsx +82 -0
- package/src/components/select/index.tsx +325 -0
- package/src/components/select/meta.md +183 -0
- package/src/components/select/stories.tsx +210 -0
- package/src/components/separator/index.tsx +51 -0
- package/src/components/separator/meta.md +68 -0
- package/src/components/separator/stories.tsx +53 -0
- package/src/components/sheet/index.tsx +293 -0
- package/src/components/sheet/meta.md +226 -0
- package/src/components/sheet/stories.tsx +405 -0
- package/src/components/sidebar/index.tsx +715 -0
- package/src/components/sidebar/meta.md +14 -0
- package/src/components/sidebar/{sidebar.stories.tsx → stories.tsx} +250 -330
- package/src/components/skeleton/index.tsx +415 -0
- package/src/components/skeleton/meta.md +210 -0
- package/src/components/skeleton/stories.tsx +197 -0
- package/src/components/slider/index.tsx +222 -0
- package/src/components/slider/meta.md +125 -0
- package/src/components/slider/stories.tsx +109 -0
- package/src/components/sonner/index.tsx +149 -0
- package/src/components/sonner/meta.md +156 -0
- package/src/components/sonner/stories.tsx +285 -0
- package/src/components/spinner/index.tsx +335 -0
- package/src/components/spinner/meta.md +172 -0
- package/src/components/spinner/stories.tsx +197 -0
- package/src/components/statistic/{statistic.tsx → index.tsx} +25 -26
- package/src/components/statistic/meta.md +94 -0
- package/src/components/statistic/stories.tsx +85 -0
- package/src/components/steps/index.tsx +500 -0
- package/src/components/steps/meta.md +245 -0
- package/src/components/steps/stories.tsx +287 -0
- package/src/components/switch/index.tsx +175 -0
- package/src/components/switch/meta.md +107 -0
- package/src/components/switch/stories.tsx +154 -0
- package/src/components/table/index.tsx +350 -0
- package/src/components/table/meta.md +148 -0
- package/src/components/table/stories.tsx +189 -0
- package/src/components/tabs/index.tsx +379 -0
- package/src/components/tabs/meta.md +244 -0
- package/src/components/tabs/stories.tsx +312 -0
- package/src/components/tag/index.tsx +774 -0
- package/src/components/tag/meta.md +256 -0
- package/src/components/tag/stories.tsx +431 -0
- package/src/components/textarea/index.tsx +62 -0
- package/src/components/textarea/meta.md +77 -0
- package/src/components/textarea/stories.tsx +112 -0
- package/src/components/time-picker/index.tsx +887 -0
- package/src/components/time-picker/meta.md +102 -0
- package/src/components/time-picker/stories.tsx +125 -0
- package/src/components/timeline/index.tsx +422 -0
- package/src/components/timeline/meta.md +352 -0
- package/src/components/timeline/stories.tsx +369 -0
- package/src/components/toggle/index.tsx +74 -0
- package/src/components/toggle/meta.md +76 -0
- package/src/components/toggle/stories.tsx +66 -0
- package/src/components/toggle-group/index.tsx +167 -0
- package/src/components/toggle-group/meta.md +141 -0
- package/src/components/toggle-group/stories.tsx +124 -0
- package/src/components/tooltip/index.tsx +144 -0
- package/src/components/tooltip/meta.md +186 -0
- package/src/components/tooltip/stories.tsx +212 -0
- package/src/components/transfer/index.tsx +639 -0
- package/src/components/transfer/meta.md +76 -0
- package/src/components/transfer/stories.tsx +221 -0
- package/src/components/tree/index.tsx +764 -0
- package/src/components/tree/meta.md +96 -0
- package/src/components/tree/stories.tsx +385 -0
- package/src/components/tree/utils.ts +269 -0
- package/src/components/tree-select/index.tsx +400 -0
- package/src/components/tree-select/meta.md +78 -0
- package/src/components/tree-select/stories.tsx +234 -0
- package/src/components/typography/index.tsx +290 -0
- package/src/components/typography/meta.md +151 -0
- package/src/components/typography/stories.tsx +151 -0
- package/src/components/upload/index.tsx +858 -0
- package/src/components/upload/meta.md +122 -0
- package/src/components/upload/stories.tsx +261 -0
- package/src/components/watermark/index.tsx +152 -0
- package/src/components/watermark/meta.md +67 -0
- package/src/components/watermark/stories.tsx +59 -0
- package/src/hooks/use-mobile.ts +9 -11
- package/src/lib/color.ts +243 -0
- package/src/{utils/cn.ts → lib/utils.ts} +1 -1
- package/src/components/accordion/accordion.meta.md +0 -88
- package/src/components/accordion/accordion.stories.tsx +0 -72
- package/src/components/accordion/accordion.tsx +0 -154
- package/src/components/affix/affix.meta.md +0 -98
- package/src/components/affix/affix.stories.tsx +0 -134
- package/src/components/affix/affix.tsx +0 -167
- package/src/components/alert/alert.meta.md +0 -132
- package/src/components/alert/alert.stories.tsx +0 -138
- package/src/components/alert/alert.tsx +0 -179
- package/src/components/alert-dialog/alert-dialog.meta.md +0 -152
- package/src/components/alert-dialog/alert-dialog.stories.tsx +0 -223
- package/src/components/alert-dialog/alert-dialog.tsx +0 -183
- package/src/components/anchor/anchor.meta.md +0 -92
- package/src/components/anchor/anchor.stories.tsx +0 -74
- package/src/components/anchor/anchor.tsx +0 -130
- package/src/components/app/app.meta.md +0 -91
- package/src/components/app/app.stories.tsx +0 -64
- package/src/components/app/app.tsx +0 -58
- package/src/components/aspect-ratio/aspect-ratio.meta.md +0 -82
- package/src/components/aspect-ratio/aspect-ratio.stories.tsx +0 -59
- package/src/components/aspect-ratio/aspect-ratio.tsx +0 -22
- package/src/components/auto-complete/auto-complete.meta.md +0 -110
- package/src/components/auto-complete/auto-complete.stories.tsx +0 -136
- package/src/components/auto-complete/auto-complete.tsx +0 -253
- package/src/components/avatar/avatar.meta.md +0 -93
- package/src/components/avatar/avatar.stories.tsx +0 -98
- package/src/components/avatar/avatar.tsx +0 -127
- package/src/components/badge/badge.meta.md +0 -120
- package/src/components/badge/badge.stories.tsx +0 -153
- package/src/components/badge/badge.tsx +0 -204
- package/src/components/breadcrumb/breadcrumb.meta.md +0 -127
- package/src/components/breadcrumb/breadcrumb.stories.tsx +0 -207
- package/src/components/breadcrumb/breadcrumb.tsx +0 -136
- package/src/components/button/button.meta.md +0 -335
- package/src/components/button/button.stories.tsx +0 -743
- package/src/components/button/button.tsx +0 -466
- package/src/components/calendar/calendar.meta.md +0 -128
- package/src/components/calendar/calendar.stories.tsx +0 -68
- package/src/components/calendar/calendar.tsx +0 -172
- package/src/components/card/card.meta.md +0 -139
- package/src/components/card/card.stories.tsx +0 -151
- package/src/components/card/card.tsx +0 -306
- package/src/components/carousel/carousel.meta.md +0 -118
- package/src/components/carousel/carousel.stories.tsx +0 -89
- package/src/components/carousel/carousel.tsx +0 -224
- package/src/components/cascader/cascader.meta.md +0 -140
- package/src/components/cascader/cascader.stories.tsx +0 -120
- package/src/components/cascader/cascader.tsx +0 -548
- package/src/components/checkbox/checkbox.meta.md +0 -167
- package/src/components/checkbox/checkbox.stories.tsx +0 -288
- package/src/components/checkbox/checkbox.tsx +0 -195
- package/src/components/collapsible/collapsible.meta.md +0 -88
- package/src/components/collapsible/collapsible.stories.tsx +0 -43
- package/src/components/collapsible/collapsible.tsx +0 -105
- package/src/components/color-picker/color-picker.meta.md +0 -89
- package/src/components/color-picker/color-picker.stories.tsx +0 -159
- package/src/components/color-picker/color-picker.tsx +0 -171
- package/src/components/command/command.meta.md +0 -120
- package/src/components/command/command.stories.tsx +0 -59
- package/src/components/command/command.tsx +0 -158
- package/src/components/context-menu/context-menu.meta.md +0 -93
- package/src/components/context-menu/context-menu.stories.tsx +0 -54
- package/src/components/context-menu/context-menu.tsx +0 -204
- package/src/components/data-table/data-table.meta.md +0 -150
- package/src/components/data-table/data-table.stories.tsx +0 -132
- package/src/components/data-table/data-table.tsx +0 -185
- package/src/components/date-picker/date-picker.meta.md +0 -175
- package/src/components/date-picker/date-picker.stories.tsx +0 -108
- package/src/components/date-picker/date-picker.tsx +0 -1554
- package/src/components/descriptions/descriptions.meta.md +0 -83
- package/src/components/descriptions/descriptions.stories.tsx +0 -60
- package/src/components/descriptions/descriptions.tsx +0 -137
- package/src/components/dialog/dialog.meta.md +0 -168
- package/src/components/dialog/dialog.stories.tsx +0 -255
- package/src/components/dialog/dialog.tsx +0 -180
- package/src/components/dialog/imperative.tsx +0 -252
- package/src/components/drawer/drawer.meta.md +0 -95
- package/src/components/drawer/drawer.stories.tsx +0 -71
- package/src/components/drawer/drawer.tsx +0 -23
- package/src/components/dropdown-menu/dropdown-menu.meta.md +0 -171
- package/src/components/dropdown-menu/dropdown-menu.stories.tsx +0 -198
- package/src/components/dropdown-menu/dropdown-menu.tsx +0 -209
- package/src/components/ellipsis/ellipsis.meta.md +0 -87
- package/src/components/ellipsis/ellipsis.stories.tsx +0 -72
- package/src/components/ellipsis/ellipsis.tsx +0 -153
- package/src/components/empty/empty.meta.md +0 -86
- package/src/components/empty/empty.stories.tsx +0 -46
- package/src/components/empty/empty.tsx +0 -54
- package/src/components/field/field.meta.md +0 -154
- package/src/components/field/field.stories.tsx +0 -497
- package/src/components/field/field.tsx +0 -392
- package/src/components/filter-bar/filter-bar.meta.md +0 -92
- package/src/components/filter-bar/filter-bar.stories.tsx +0 -1086
- package/src/components/filter-bar/filter-bar.tsx +0 -568
- package/src/components/flex/flex.meta.md +0 -142
- package/src/components/flex/flex.stories.tsx +0 -199
- package/src/components/flex/flex.tsx +0 -145
- package/src/components/float-button/float-button.meta.md +0 -92
- package/src/components/float-button/float-button.stories.tsx +0 -80
- package/src/components/float-button/float-button.tsx +0 -143
- package/src/components/form/form.meta.md +0 -153
- package/src/components/form/form.stories.tsx +0 -472
- package/src/components/form/form.tsx +0 -260
- package/src/components/grid/grid.meta.md +0 -92
- package/src/components/grid/grid.stories.tsx +0 -101
- package/src/components/grid/grid.tsx +0 -130
- package/src/components/hover-card/hover-card.meta.md +0 -103
- package/src/components/hover-card/hover-card.stories.tsx +0 -97
- package/src/components/hover-card/hover-card.tsx +0 -67
- package/src/components/icon/DEVELOPMENT.md +0 -809
- package/src/components/icon/icon.meta.md +0 -170
- package/src/components/icon/icon.stories.tsx +0 -344
- package/src/components/icon/icon.tsx +0 -248
- package/src/components/image/image.meta.md +0 -99
- package/src/components/image/image.stories.tsx +0 -55
- package/src/components/image/image.tsx +0 -140
- package/src/components/input/input.meta.md +0 -115
- package/src/components/input/input.stories.tsx +0 -144
- package/src/components/input/input.tsx +0 -212
- package/src/components/input-group/input-group.meta.md +0 -124
- package/src/components/input-group/input-group.stories.tsx +0 -121
- package/src/components/input-group/input-group.tsx +0 -143
- package/src/components/input-number/input-number.meta.md +0 -148
- package/src/components/input-number/input-number.stories.tsx +0 -125
- package/src/components/input-number/input-number.tsx +0 -283
- package/src/components/input-otp/input-otp.meta.md +0 -106
- package/src/components/input-otp/input-otp.stories.tsx +0 -65
- package/src/components/input-otp/input-otp.tsx +0 -97
- package/src/components/item/item.meta.md +0 -121
- package/src/components/item/item.stories.tsx +0 -116
- package/src/components/item/item.tsx +0 -172
- package/src/components/kbd/kbd.meta.md +0 -94
- package/src/components/kbd/kbd.stories.tsx +0 -70
- package/src/components/kbd/kbd.tsx +0 -86
- package/src/components/label/label.meta.md +0 -99
- package/src/components/label/label.stories.tsx +0 -145
- package/src/components/label/label.tsx +0 -138
- package/src/components/masonry/masonry.meta.md +0 -90
- package/src/components/masonry/masonry.stories.tsx +0 -68
- package/src/components/masonry/masonry.tsx +0 -60
- package/src/components/mentions/mentions.meta.md +0 -119
- package/src/components/mentions/mentions.stories.tsx +0 -189
- package/src/components/mentions/mentions.tsx +0 -243
- package/src/components/menubar/menubar.meta.md +0 -118
- package/src/components/menubar/menubar.stories.tsx +0 -141
- package/src/components/menubar/menubar.tsx +0 -232
- package/src/components/native-select/native-select.meta.md +0 -93
- package/src/components/native-select/native-select.stories.tsx +0 -83
- package/src/components/native-select/native-select.tsx +0 -54
- package/src/components/navigation-menu/navigation-menu.meta.md +0 -118
- package/src/components/navigation-menu/navigation-menu.stories.tsx +0 -215
- package/src/components/navigation-menu/navigation-menu.tsx +0 -129
- package/src/components/notification/notification.meta.md +0 -133
- package/src/components/notification/notification.stories.tsx +0 -98
- package/src/components/notification/notification.tsx +0 -99
- package/src/components/page-header/DEVELOPMENT.md +0 -842
- package/src/components/page-header/page-header.meta.md +0 -210
- package/src/components/page-header/page-header.stories.tsx +0 -428
- package/src/components/page-header/page-header.tsx +0 -284
- package/src/components/page-shell/page-shell.meta.md +0 -116
- package/src/components/page-shell/page-shell.stories.tsx +0 -149
- package/src/components/page-shell/page-shell.tsx +0 -115
- package/src/components/pagination/pagination.meta.md +0 -230
- package/src/components/pagination/pagination.stories.tsx +0 -284
- package/src/components/pagination/pagination.tsx +0 -567
- package/src/components/popconfirm/popconfirm.meta.md +0 -114
- package/src/components/popconfirm/popconfirm.stories.tsx +0 -75
- package/src/components/popconfirm/popconfirm.tsx +0 -134
- package/src/components/popover/popover.meta.md +0 -154
- package/src/components/popover/popover.stories.tsx +0 -158
- package/src/components/popover/popover.tsx +0 -104
- package/src/components/progress/progress.meta.md +0 -118
- package/src/components/progress/progress.stories.tsx +0 -75
- package/src/components/progress/progress.tsx +0 -203
- package/src/components/radio-group/radio-group.meta.md +0 -175
- package/src/components/radio-group/radio-group.stories.tsx +0 -113
- package/src/components/radio-group/radio-group.tsx +0 -209
- package/src/components/rate/rate.meta.md +0 -118
- package/src/components/rate/rate.stories.tsx +0 -89
- package/src/components/rate/rate.tsx +0 -180
- package/src/components/resizable/resizable.meta.md +0 -95
- package/src/components/resizable/resizable.stories.tsx +0 -104
- package/src/components/resizable/resizable.tsx +0 -56
- package/src/components/result/result.meta.md +0 -95
- package/src/components/result/result.stories.tsx +0 -67
- package/src/components/result/result.tsx +0 -100
- package/src/components/scroll-area/scroll-area.meta.md +0 -85
- package/src/components/scroll-area/scroll-area.stories.tsx +0 -49
- package/src/components/scroll-area/scroll-area.tsx +0 -51
- package/src/components/segmented/segmented.meta.md +0 -106
- package/src/components/segmented/segmented.stories.tsx +0 -130
- package/src/components/segmented/segmented.tsx +0 -146
- package/src/components/select/select.meta.md +0 -255
- package/src/components/select/select.stories.tsx +0 -275
- package/src/components/select/select.tsx +0 -735
- package/src/components/separator/separator.meta.md +0 -75
- package/src/components/separator/separator.stories.tsx +0 -71
- package/src/components/separator/separator.tsx +0 -100
- package/src/components/sheet/sheet.meta.md +0 -113
- package/src/components/sheet/sheet.stories.tsx +0 -188
- package/src/components/sheet/sheet.tsx +0 -226
- package/src/components/sidebar/sidebar.meta.md +0 -151
- package/src/components/sidebar/sidebar.tsx +0 -853
- package/src/components/skeleton/skeleton.meta.md +0 -94
- package/src/components/skeleton/skeleton.stories.tsx +0 -79
- package/src/components/skeleton/skeleton.tsx +0 -144
- package/src/components/slider/slider.meta.md +0 -146
- package/src/components/slider/slider.stories.tsx +0 -121
- package/src/components/slider/slider.tsx +0 -227
- package/src/components/sonner/sonner.meta.md +0 -147
- package/src/components/sonner/sonner.stories.tsx +0 -164
- package/src/components/sonner/sonner.tsx +0 -169
- package/src/components/spinner/spinner.meta.md +0 -125
- package/src/components/spinner/spinner.stories.tsx +0 -123
- package/src/components/spinner/spinner.tsx +0 -166
- package/src/components/statistic/statistic.meta.md +0 -104
- package/src/components/statistic/statistic.stories.tsx +0 -67
- package/src/components/steps/steps.meta.md +0 -116
- package/src/components/steps/steps.stories.tsx +0 -115
- package/src/components/steps/steps.tsx +0 -173
- package/src/components/switch/switch.meta.md +0 -138
- package/src/components/switch/switch.stories.tsx +0 -75
- package/src/components/switch/switch.tsx +0 -169
- package/src/components/table/table.meta.md +0 -106
- package/src/components/table/table.stories.tsx +0 -80
- package/src/components/table/table.tsx +0 -124
- package/src/components/tabs/tabs.meta.md +0 -111
- package/src/components/tabs/tabs.stories.tsx +0 -156
- package/src/components/tabs/tabs.tsx +0 -190
- package/src/components/tag/tag.meta.md +0 -159
- package/src/components/tag/tag.stories.tsx +0 -250
- package/src/components/tag/tag.tsx +0 -386
- package/src/components/textarea/textarea.meta.md +0 -99
- package/src/components/textarea/textarea.stories.tsx +0 -89
- package/src/components/textarea/textarea.tsx +0 -137
- package/src/components/time-picker/time-picker.meta.md +0 -175
- package/src/components/time-picker/time-picker.stories.tsx +0 -129
- package/src/components/time-picker/time-picker.tsx +0 -946
- package/src/components/timeline/timeline.meta.md +0 -110
- package/src/components/timeline/timeline.stories.tsx +0 -134
- package/src/components/timeline/timeline.tsx +0 -168
- package/src/components/toggle/toggle.meta.md +0 -89
- package/src/components/toggle/toggle.stories.tsx +0 -66
- package/src/components/toggle/toggle.tsx +0 -54
- package/src/components/toggle-group/toggle-group.meta.md +0 -91
- package/src/components/toggle-group/toggle-group.stories.tsx +0 -83
- package/src/components/toggle-group/toggle-group.tsx +0 -78
- package/src/components/tooltip/tooltip.meta.md +0 -149
- package/src/components/tooltip/tooltip.stories.tsx +0 -108
- package/src/components/tooltip/tooltip.tsx +0 -153
- package/src/components/tour/tour.meta.md +0 -121
- package/src/components/tour/tour.stories.tsx +0 -66
- package/src/components/tour/tour.tsx +0 -242
- package/src/components/transfer/transfer.meta.md +0 -95
- package/src/components/transfer/transfer.stories.tsx +0 -64
- package/src/components/transfer/transfer.tsx +0 -258
- package/src/components/tree/tree.meta.md +0 -169
- package/src/components/tree/tree.stories.tsx +0 -128
- package/src/components/tree/tree.tsx +0 -368
- package/src/components/tree-select/tree-select.meta.md +0 -151
- package/src/components/tree-select/tree-select.stories.tsx +0 -80
- package/src/components/tree-select/tree-select.tsx +0 -206
- package/src/components/typography/typography.meta.md +0 -149
- package/src/components/typography/typography.stories.tsx +0 -116
- package/src/components/typography/typography.tsx +0 -260
- package/src/components/upload/upload.meta.md +0 -156
- package/src/components/upload/upload.stories.tsx +0 -135
- package/src/components/upload/upload.tsx +0 -398
- package/src/components/watermark/watermark.meta.md +0 -100
- package/src/components/watermark/watermark.stories.tsx +0 -170
- package/src/components/watermark/watermark.tsx +0 -166
- package/src/hooks/use-breakpoint.ts +0 -117
- package/src/hooks/use-debounce-callback.ts +0 -52
- package/src/stories/theme-tokens.stories.tsx +0 -747
- package/src/utils/trigger-input.ts +0 -57
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
|
+
import { Heart } from 'lucide-react';
|
|
4
|
+
|
|
5
|
+
import { Rate } from '.';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Rate> = {
|
|
8
|
+
title: '数据录入 · Data Entry/Rate 评分',
|
|
9
|
+
component: Rate,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof Rate>;
|
|
15
|
+
|
|
16
|
+
export const Basic: Story = {
|
|
17
|
+
name: '基础',
|
|
18
|
+
args: { defaultValue: 3 },
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const HalfStar: Story = {
|
|
22
|
+
name: '半星',
|
|
23
|
+
args: { allowHalf: true, defaultValue: 2.5 },
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const Disabled: Story = {
|
|
27
|
+
name: '禁用',
|
|
28
|
+
args: { value: 3, disabled: true },
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const ReadOnly: Story = {
|
|
32
|
+
name: '只读',
|
|
33
|
+
args: { value: 4, readOnly: true },
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Sizes: Story = {
|
|
37
|
+
name: '尺寸',
|
|
38
|
+
parameters: { controls: { disable: true } },
|
|
39
|
+
render: () => (
|
|
40
|
+
<div className="flex flex-col gap-3">
|
|
41
|
+
<Rate size="sm" defaultValue={3} />
|
|
42
|
+
<Rate size="default" defaultValue={3} />
|
|
43
|
+
<Rate size="lg" defaultValue={3} />
|
|
44
|
+
</div>
|
|
45
|
+
),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const CustomCount: Story = {
|
|
49
|
+
name: '自定义数量',
|
|
50
|
+
args: { count: 8, defaultValue: 5 },
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const Controlled: Story = {
|
|
54
|
+
name: '受控',
|
|
55
|
+
parameters: { controls: { disable: true } },
|
|
56
|
+
render: () => {
|
|
57
|
+
const [value, setValue] = React.useState(3);
|
|
58
|
+
return (
|
|
59
|
+
<div className="flex items-center gap-3">
|
|
60
|
+
<Rate value={value} onValueChange={setValue} />
|
|
61
|
+
<span className="text-sm text-muted-foreground">{value} / 5</span>
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const WithLabel: Story = {
|
|
68
|
+
name: '等级文案',
|
|
69
|
+
parameters: { controls: { disable: true } },
|
|
70
|
+
render: () => {
|
|
71
|
+
const grades = ['很差', '一般', '还行', '不错', '完美'];
|
|
72
|
+
const [value, setValue] = React.useState(3);
|
|
73
|
+
return (
|
|
74
|
+
<div className="flex items-center gap-3">
|
|
75
|
+
<Rate value={value} onValueChange={setValue} />
|
|
76
|
+
<span className="text-sm text-foreground">
|
|
77
|
+
{grades[value - 1] ?? '未评分'}
|
|
78
|
+
</span>
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const CustomCharacter: Story = {
|
|
85
|
+
name: '自定义图标',
|
|
86
|
+
parameters: { controls: { disable: true } },
|
|
87
|
+
render: () => (
|
|
88
|
+
<Rate
|
|
89
|
+
defaultValue={3}
|
|
90
|
+
character={<Heart className="size-4 fill-current" aria-hidden />}
|
|
91
|
+
/>
|
|
92
|
+
),
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const Keyboard: Story = {
|
|
96
|
+
name: '键盘无障碍',
|
|
97
|
+
parameters: { controls: { disable: true } },
|
|
98
|
+
render: () => (
|
|
99
|
+
<div className="flex flex-col gap-2">
|
|
100
|
+
<Rate defaultValue={3} allowHalf />
|
|
101
|
+
<p className="text-xs text-muted-foreground">
|
|
102
|
+
Tab 聚焦后按 ←↓ / →↑ 调整,Home / End 跳到最小 / 最大,Enter 或 Space
|
|
103
|
+
在已有值时清零。
|
|
104
|
+
</p>
|
|
105
|
+
</div>
|
|
106
|
+
),
|
|
107
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 可调整大小面板 Resizable
|
|
3
|
+
*
|
|
4
|
+
* 支持拖拽调整大小的布局面板,基于 react-resizable-panels。
|
|
5
|
+
*
|
|
6
|
+
* @when
|
|
7
|
+
* - IDE 式布局(侧边栏 + 主内容 + 面板)
|
|
8
|
+
* - 可调整宽度的分栏展示
|
|
9
|
+
* - 拖拽调整工作区域
|
|
10
|
+
*/
|
|
11
|
+
'use client';
|
|
12
|
+
|
|
13
|
+
import { GripVerticalIcon } from 'lucide-react';
|
|
14
|
+
import * as ResizablePrimitive from 'react-resizable-panels';
|
|
15
|
+
|
|
16
|
+
import { cn } from '@/lib/utils';
|
|
17
|
+
|
|
18
|
+
// ─── Types ──────────────────────────────────────────────────────────────────
|
|
19
|
+
|
|
20
|
+
export interface ResizablePanelGroupProps
|
|
21
|
+
extends ResizablePrimitive.GroupProps {
|
|
22
|
+
/** 面板组方向,决定 Panel 排布与可拖拽方向。 @default 'horizontal' */
|
|
23
|
+
orientation?: ResizablePrimitive.Orientation;
|
|
24
|
+
/** 默认布局,键为 Panel id,值为百分比 0..100;可配合 storage 跨刷新持久化。 */
|
|
25
|
+
defaultLayout?: ResizablePrimitive.GroupProps['defaultLayout'];
|
|
26
|
+
/** 禁用整组的拖拽尺寸调整。 @default false */
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/** 禁用拖拽过程中的全局光标视觉反馈。 @default false */
|
|
29
|
+
disableCursor?: boolean;
|
|
30
|
+
/** 布局变化回调(拖拽中每帧触发)。 */
|
|
31
|
+
onLayoutChange?: ResizablePrimitive.GroupProps['onLayoutChange'];
|
|
32
|
+
/** 布局变化稳定后的回调(拖拽结束触发一次)。 */
|
|
33
|
+
onLayoutChanged?: ResizablePrimitive.GroupProps['onLayoutChanged'];
|
|
34
|
+
/** 根 div 的 ref,如需获取 DOM 则传入。 */
|
|
35
|
+
elementRef?: ResizablePrimitive.GroupProps['elementRef'];
|
|
36
|
+
/** 命令式 API ref:提供 `getLayout()` / `setLayout(layout)`,可配 `useGroupRef` 使用。 */
|
|
37
|
+
groupRef?: ResizablePrimitive.GroupProps['groupRef'];
|
|
38
|
+
/** 拖拽热区最小点击区域,区分鼠标 `fine` 与触控 `coarse`,防误点。 */
|
|
39
|
+
resizeTargetMinimumSize?: ResizablePrimitive.GroupProps['resizeTargetMinimumSize'];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface ResizablePanelProps extends ResizablePrimitive.PanelProps {
|
|
43
|
+
/** 默认尺寸;数字按百分比 0..100,字符串支持 `px` / `%` / `rem` / `vh` 等单位。 */
|
|
44
|
+
defaultSize?: ResizablePrimitive.PanelProps['defaultSize'];
|
|
45
|
+
/** 最小尺寸;超过约束会被夹到此值。 */
|
|
46
|
+
minSize?: ResizablePrimitive.PanelProps['minSize'];
|
|
47
|
+
/** 最大尺寸;超过约束会被夹到此值。 */
|
|
48
|
+
maxSize?: ResizablePrimitive.PanelProps['maxSize'];
|
|
49
|
+
/** 允许折叠:尺寸小于 `minSize` 时折叠到 `collapsedSize`。 @default false */
|
|
50
|
+
collapsible?: boolean;
|
|
51
|
+
/** 折叠后的尺寸。 @default 0 */
|
|
52
|
+
collapsedSize?: ResizablePrimitive.PanelProps['collapsedSize'];
|
|
53
|
+
/** 禁用本 Panel 尺寸调整(不影响兄弟 Panel)。 @default false */
|
|
54
|
+
disabled?: boolean;
|
|
55
|
+
/** 尺寸变化回调,返回当前百分比与像素尺寸。 */
|
|
56
|
+
onResize?: ResizablePrimitive.PanelProps['onResize'];
|
|
57
|
+
/** 根 div 的 ref,如需获取 DOM 则传入。 */
|
|
58
|
+
elementRef?: ResizablePrimitive.PanelProps['elementRef'];
|
|
59
|
+
/** 命令式 API ref:`collapse` / `expand` / `getSize` / `isCollapsed` / `resize`。 */
|
|
60
|
+
panelRef?: ResizablePrimitive.PanelProps['panelRef'];
|
|
61
|
+
/** 父组变尺时本 Panel 的行为:`preserve-relative-size`(保持百分比)或 `preserve-pixel-size`(保持像素)。 @default 'preserve-relative-size' */
|
|
62
|
+
groupResizeBehavior?: ResizablePrimitive.PanelProps['groupResizeBehavior'];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface ResizableHandleProps
|
|
66
|
+
extends ResizablePrimitive.SeparatorProps {
|
|
67
|
+
/** 显示带 GripVertical 图标的可见拖动手柄,提升可发现性。 @default false */
|
|
68
|
+
withHandle?: boolean;
|
|
69
|
+
/** 禁用本分隔条的拖拽。 @default false */
|
|
70
|
+
disabled?: boolean;
|
|
71
|
+
/** 禁用双击复位到默认布局的行为。 @default false */
|
|
72
|
+
disableDoubleClick?: boolean;
|
|
73
|
+
/** 根 div 的 ref,如需获取 DOM 则传入。 */
|
|
74
|
+
elementRef?: ResizablePrimitive.SeparatorProps['elementRef'];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// ─── Components ─────────────────────────────────────────────────────────────
|
|
78
|
+
|
|
79
|
+
function ResizablePanelGroup({
|
|
80
|
+
className,
|
|
81
|
+
...props
|
|
82
|
+
}: ResizablePanelGroupProps) {
|
|
83
|
+
return (
|
|
84
|
+
<ResizablePrimitive.Group
|
|
85
|
+
data-slot="resizable-panel-group"
|
|
86
|
+
className={cn(
|
|
87
|
+
'flex h-full w-full aria-[orientation=vertical]:flex-col',
|
|
88
|
+
className,
|
|
89
|
+
)}
|
|
90
|
+
{...props}
|
|
91
|
+
/>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function ResizablePanel({ ...props }: ResizablePanelProps) {
|
|
96
|
+
return <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} />;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function ResizableHandle({
|
|
100
|
+
withHandle,
|
|
101
|
+
className,
|
|
102
|
+
...props
|
|
103
|
+
}: ResizableHandleProps) {
|
|
104
|
+
return (
|
|
105
|
+
<ResizablePrimitive.Separator
|
|
106
|
+
data-slot="resizable-handle"
|
|
107
|
+
className={cn(
|
|
108
|
+
'relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90',
|
|
109
|
+
className,
|
|
110
|
+
)}
|
|
111
|
+
{...props}
|
|
112
|
+
>
|
|
113
|
+
{withHandle && (
|
|
114
|
+
<div className="z-10 flex h-4 w-3 items-center justify-center rounded-xs border border-border bg-border">
|
|
115
|
+
<GripVerticalIcon className="size-2.5" />
|
|
116
|
+
</div>
|
|
117
|
+
)}
|
|
118
|
+
</ResizablePrimitive.Separator>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export { ResizableHandle, ResizablePanel, ResizablePanelGroup };
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# ResizablePanelGroup
|
|
2
|
+
|
|
3
|
+
> 本文件由 `pnpm gen:meta` 自动生成,**请勿手动编辑**。
|
|
4
|
+
|
|
5
|
+
## 描述
|
|
6
|
+
|
|
7
|
+
可调整大小面板 Resizable
|
|
8
|
+
支持拖拽调整大小的布局面板,基于 react-resizable-panels。
|
|
9
|
+
|
|
10
|
+
## 使用场景
|
|
11
|
+
|
|
12
|
+
- IDE 式布局(侧边栏 + 主内容 + 面板)
|
|
13
|
+
- 可调整宽度的分栏展示
|
|
14
|
+
- 拖拽调整工作区域
|
|
15
|
+
|
|
16
|
+
## Props
|
|
17
|
+
|
|
18
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
19
|
+
| --- | --- | --- | --- | --- |
|
|
20
|
+
| `orientation` | `ResizablePrimitive.Orientation` | `'horizontal'` | – | 面板组方向,决定 Panel 排布与可拖拽方向。 |
|
|
21
|
+
| `defaultLayout` | `ResizablePrimitive.GroupProps['defaultLayout']` | – | – | 默认布局,键为 Panel id,值为百分比 0..100;可配合 storage 跨刷新持久化。 |
|
|
22
|
+
| `disabled` | `boolean` | `false` | – | 禁用整组的拖拽尺寸调整。 |
|
|
23
|
+
| `disableCursor` | `boolean` | `false` | – | 禁用拖拽过程中的全局光标视觉反馈。 |
|
|
24
|
+
| `onLayoutChange` | `ResizablePrimitive.GroupProps['onLayoutChange']` | – | – | 布局变化回调(拖拽中每帧触发)。 |
|
|
25
|
+
| `onLayoutChanged` | `ResizablePrimitive.GroupProps['onLayoutChanged']` | – | – | 布局变化稳定后的回调(拖拽结束触发一次)。 |
|
|
26
|
+
| `elementRef` | `ResizablePrimitive.GroupProps['elementRef']` | – | – | 根 div 的 ref,如需获取 DOM 则传入。 |
|
|
27
|
+
| `groupRef` | `ResizablePrimitive.GroupProps['groupRef']` | – | – | 命令式 API ref:提供 `getLayout()` / `setLayout(layout)`,可配 `useGroupRef` 使用。 |
|
|
28
|
+
| `resizeTargetMinimumSize` | `ResizablePrimitive.GroupProps['resizeTargetMinimumSize']` | – | – | 拖拽热区最小点击区域,区分鼠标 `fine` 与触控 `coarse`,防误点。 |
|
|
29
|
+
| `defaultSize` | `ResizablePrimitive.PanelProps['defaultSize']` | – | – | 默认尺寸;数字按百分比 0..100,字符串支持 `px` / `%` / `rem` / `vh` 等单位。 |
|
|
30
|
+
| `minSize` | `ResizablePrimitive.PanelProps['minSize']` | – | – | 最小尺寸;超过约束会被夹到此值。 |
|
|
31
|
+
| `maxSize` | `ResizablePrimitive.PanelProps['maxSize']` | – | – | 最大尺寸;超过约束会被夹到此值。 |
|
|
32
|
+
| `collapsible` | `boolean` | `false` | – | 允许折叠:尺寸小于 `minSize` 时折叠到 `collapsedSize`。 |
|
|
33
|
+
| `collapsedSize` | `ResizablePrimitive.PanelProps['collapsedSize']` | `0` | – | 折叠后的尺寸。 |
|
|
34
|
+
| `disabled` | `boolean` | `false` | – | 禁用本 Panel 尺寸调整(不影响兄弟 Panel)。 |
|
|
35
|
+
| `onResize` | `ResizablePrimitive.PanelProps['onResize']` | – | – | 尺寸变化回调,返回当前百分比与像素尺寸。 |
|
|
36
|
+
| `elementRef` | `ResizablePrimitive.PanelProps['elementRef']` | – | – | 根 div 的 ref,如需获取 DOM 则传入。 |
|
|
37
|
+
| `panelRef` | `ResizablePrimitive.PanelProps['panelRef']` | – | – | 命令式 API ref:`collapse` / `expand` / `getSize` / `isCollapsed` / `resize`。 |
|
|
38
|
+
| `groupResizeBehavior` | `ResizablePrimitive.PanelProps['groupResizeBehavior']` | `'preserve-relative-size'` | – | 父组变尺时本 Panel 的行为:`preserve-relative-size`(保持百分比)或 `preserve-pixel-size`(保持像素)。 |
|
|
39
|
+
| `withHandle` | `boolean` | `false` | – | 显示带 GripVertical 图标的可见拖动手柄,提升可发现性。 |
|
|
40
|
+
| `disabled` | `boolean` | `false` | – | 禁用本分隔条的拖拽。 |
|
|
41
|
+
| `disableDoubleClick` | `boolean` | `false` | – | 禁用双击复位到默认布局的行为。 |
|
|
42
|
+
| `elementRef` | `ResizablePrimitive.SeparatorProps['elementRef']` | – | – | 根 div 的 ref,如需获取 DOM 则传入。 |
|
|
43
|
+
|
|
44
|
+
## 示例
|
|
45
|
+
|
|
46
|
+
### Horizontal
|
|
47
|
+
|
|
48
|
+
水平方向双栏可拖拽调节宽度。
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
<ResizablePanelGroup
|
|
52
|
+
orientation="horizontal"
|
|
53
|
+
className="min-h-48 max-w-md rounded-lg border border-border"
|
|
54
|
+
>
|
|
55
|
+
<ResizablePanel defaultSize={50}>
|
|
56
|
+
<div className="flex h-full items-center justify-center p-4">
|
|
57
|
+
<span className="text-xs text-muted-foreground">左侧面板</span>
|
|
58
|
+
</div>
|
|
59
|
+
</ResizablePanel>
|
|
60
|
+
<ResizableHandle />
|
|
61
|
+
<ResizablePanel defaultSize={50}>
|
|
62
|
+
<div className="flex h-full items-center justify-center p-4">
|
|
63
|
+
<span className="text-xs text-muted-foreground">右侧面板</span>
|
|
64
|
+
</div>
|
|
65
|
+
</ResizablePanel>
|
|
66
|
+
</ResizablePanelGroup>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Vertical
|
|
70
|
+
|
|
71
|
+
垂直方向双栏可拖拽调节高度。
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
<ResizablePanelGroup
|
|
75
|
+
orientation="vertical"
|
|
76
|
+
className="min-h-48 max-w-md rounded-lg border border-border"
|
|
77
|
+
>
|
|
78
|
+
<ResizablePanel defaultSize={50}>
|
|
79
|
+
<div className="flex h-full items-center justify-center p-4">
|
|
80
|
+
<span className="text-xs text-muted-foreground">上方面板</span>
|
|
81
|
+
</div>
|
|
82
|
+
</ResizablePanel>
|
|
83
|
+
<ResizableHandle />
|
|
84
|
+
<ResizablePanel defaultSize={50}>
|
|
85
|
+
<div className="flex h-full items-center justify-center p-4">
|
|
86
|
+
<span className="text-xs text-muted-foreground">下方面板</span>
|
|
87
|
+
</div>
|
|
88
|
+
</ResizablePanel>
|
|
89
|
+
</ResizablePanelGroup>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### WithHandle
|
|
93
|
+
|
|
94
|
+
带拖动手柄的分隔条,提升可见性与可操作性。
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
<ResizablePanelGroup
|
|
98
|
+
orientation="horizontal"
|
|
99
|
+
className="min-h-48 max-w-md rounded-lg border border-border"
|
|
100
|
+
>
|
|
101
|
+
<ResizablePanel defaultSize={40}>
|
|
102
|
+
<div className="flex h-full items-center justify-center p-4">
|
|
103
|
+
<span className="text-xs text-muted-foreground">侧栏</span>
|
|
104
|
+
</div>
|
|
105
|
+
</ResizablePanel>
|
|
106
|
+
<ResizableHandle withHandle />
|
|
107
|
+
<ResizablePanel defaultSize={60}>
|
|
108
|
+
<div className="flex h-full items-center justify-center p-4">
|
|
109
|
+
<span className="text-xs text-muted-foreground">主内容</span>
|
|
110
|
+
</div>
|
|
111
|
+
</ResizablePanel>
|
|
112
|
+
</ResizablePanelGroup>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### ThreeColumns
|
|
116
|
+
|
|
117
|
+
三栏布局,左侧边栏 + 主内容 + 右侧面板。
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
<ResizablePanelGroup
|
|
121
|
+
orientation="horizontal"
|
|
122
|
+
className="min-h-48 max-w-lg rounded-lg border border-border"
|
|
123
|
+
>
|
|
124
|
+
<ResizablePanel defaultSize={25} minSize={15}>
|
|
125
|
+
<div className="flex h-full items-center justify-center p-4">
|
|
126
|
+
<span className="text-xs text-muted-foreground">导航</span>
|
|
127
|
+
</div>
|
|
128
|
+
</ResizablePanel>
|
|
129
|
+
<ResizableHandle />
|
|
130
|
+
<ResizablePanel defaultSize={50}>
|
|
131
|
+
<div className="flex h-full items-center justify-center p-4">
|
|
132
|
+
<span className="text-xs text-muted-foreground">内容</span>
|
|
133
|
+
</div>
|
|
134
|
+
</ResizablePanel>
|
|
135
|
+
<ResizableHandle />
|
|
136
|
+
<ResizablePanel defaultSize={25} minSize={15}>
|
|
137
|
+
<div className="flex h-full items-center justify-center p-4">
|
|
138
|
+
<span className="text-xs text-muted-foreground">详情</span>
|
|
139
|
+
</div>
|
|
140
|
+
</ResizablePanel>
|
|
141
|
+
</ResizablePanelGroup>
|
|
142
|
+
```
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { ResizablePanelGroup, ResizablePanel, ResizableHandle } from './index';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof ResizablePanelGroup> = {
|
|
5
|
+
title: '布局 · Layout/Resizable 可调尺寸面板',
|
|
6
|
+
component: ResizablePanelGroup,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
|
|
11
|
+
type Story = StoryObj<typeof meta>;
|
|
12
|
+
|
|
13
|
+
/** 水平方向双栏可拖拽调节宽度。 */
|
|
14
|
+
export const Horizontal: Story = {
|
|
15
|
+
render: () => (
|
|
16
|
+
<ResizablePanelGroup
|
|
17
|
+
orientation="horizontal"
|
|
18
|
+
className="min-h-48 max-w-md rounded-lg border border-border"
|
|
19
|
+
>
|
|
20
|
+
<ResizablePanel defaultSize={50}>
|
|
21
|
+
<div className="flex h-full items-center justify-center p-4">
|
|
22
|
+
<span className="text-xs text-muted-foreground">左侧面板</span>
|
|
23
|
+
</div>
|
|
24
|
+
</ResizablePanel>
|
|
25
|
+
<ResizableHandle />
|
|
26
|
+
<ResizablePanel defaultSize={50}>
|
|
27
|
+
<div className="flex h-full items-center justify-center p-4">
|
|
28
|
+
<span className="text-xs text-muted-foreground">右侧面板</span>
|
|
29
|
+
</div>
|
|
30
|
+
</ResizablePanel>
|
|
31
|
+
</ResizablePanelGroup>
|
|
32
|
+
),
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** 垂直方向双栏可拖拽调节高度。 */
|
|
36
|
+
export const Vertical: Story = {
|
|
37
|
+
render: () => (
|
|
38
|
+
<ResizablePanelGroup
|
|
39
|
+
orientation="vertical"
|
|
40
|
+
className="min-h-48 max-w-md rounded-lg border border-border"
|
|
41
|
+
>
|
|
42
|
+
<ResizablePanel defaultSize={50}>
|
|
43
|
+
<div className="flex h-full items-center justify-center p-4">
|
|
44
|
+
<span className="text-xs text-muted-foreground">上方面板</span>
|
|
45
|
+
</div>
|
|
46
|
+
</ResizablePanel>
|
|
47
|
+
<ResizableHandle />
|
|
48
|
+
<ResizablePanel defaultSize={50}>
|
|
49
|
+
<div className="flex h-full items-center justify-center p-4">
|
|
50
|
+
<span className="text-xs text-muted-foreground">下方面板</span>
|
|
51
|
+
</div>
|
|
52
|
+
</ResizablePanel>
|
|
53
|
+
</ResizablePanelGroup>
|
|
54
|
+
),
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/** 带拖动手柄的分隔条,提升可见性与可操作性。 */
|
|
58
|
+
export const WithHandle: Story = {
|
|
59
|
+
render: () => (
|
|
60
|
+
<ResizablePanelGroup
|
|
61
|
+
orientation="horizontal"
|
|
62
|
+
className="min-h-48 max-w-md rounded-lg border border-border"
|
|
63
|
+
>
|
|
64
|
+
<ResizablePanel defaultSize={40}>
|
|
65
|
+
<div className="flex h-full items-center justify-center p-4">
|
|
66
|
+
<span className="text-xs text-muted-foreground">侧栏</span>
|
|
67
|
+
</div>
|
|
68
|
+
</ResizablePanel>
|
|
69
|
+
<ResizableHandle withHandle />
|
|
70
|
+
<ResizablePanel defaultSize={60}>
|
|
71
|
+
<div className="flex h-full items-center justify-center p-4">
|
|
72
|
+
<span className="text-xs text-muted-foreground">主内容</span>
|
|
73
|
+
</div>
|
|
74
|
+
</ResizablePanel>
|
|
75
|
+
</ResizablePanelGroup>
|
|
76
|
+
),
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/** 三栏布局,左侧边栏 + 主内容 + 右侧面板。 */
|
|
80
|
+
export const ThreeColumns: Story = {
|
|
81
|
+
render: () => (
|
|
82
|
+
<ResizablePanelGroup
|
|
83
|
+
orientation="horizontal"
|
|
84
|
+
className="min-h-48 max-w-lg rounded-lg border border-border"
|
|
85
|
+
>
|
|
86
|
+
<ResizablePanel defaultSize={25} minSize={15}>
|
|
87
|
+
<div className="flex h-full items-center justify-center p-4">
|
|
88
|
+
<span className="text-xs text-muted-foreground">导航</span>
|
|
89
|
+
</div>
|
|
90
|
+
</ResizablePanel>
|
|
91
|
+
<ResizableHandle />
|
|
92
|
+
<ResizablePanel defaultSize={50}>
|
|
93
|
+
<div className="flex h-full items-center justify-center p-4">
|
|
94
|
+
<span className="text-xs text-muted-foreground">内容</span>
|
|
95
|
+
</div>
|
|
96
|
+
</ResizablePanel>
|
|
97
|
+
<ResizableHandle />
|
|
98
|
+
<ResizablePanel defaultSize={25} minSize={15}>
|
|
99
|
+
<div className="flex h-full items-center justify-center p-4">
|
|
100
|
+
<span className="text-xs text-muted-foreground">详情</span>
|
|
101
|
+
</div>
|
|
102
|
+
</ResizablePanel>
|
|
103
|
+
</ResizablePanelGroup>
|
|
104
|
+
),
|
|
105
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 滚动区域 ScrollArea
|
|
3
|
+
*
|
|
4
|
+
* 自定义滚动条的滚动容器,基于 Radix ScrollArea 原语。
|
|
5
|
+
*
|
|
6
|
+
* @when
|
|
7
|
+
* - 固定高度的列表容器
|
|
8
|
+
* - 侧边栏内容溢出
|
|
9
|
+
* - 代码块 / 日志展示区
|
|
10
|
+
*/
|
|
11
|
+
import * as React from 'react';
|
|
12
|
+
import { ScrollArea as ScrollAreaPrimitive } from 'radix-ui';
|
|
13
|
+
|
|
14
|
+
import { cn } from '@/lib/utils';
|
|
15
|
+
|
|
16
|
+
export interface ScrollAreaProps
|
|
17
|
+
extends Omit<
|
|
18
|
+
React.ComponentProps<typeof ScrollAreaPrimitive.Root>,
|
|
19
|
+
'type' | 'scrollHideDelay' | 'dir'
|
|
20
|
+
> {
|
|
21
|
+
/**
|
|
22
|
+
* 滚动条显示策略。
|
|
23
|
+
* - `auto`(默认):需要滚动时才显示
|
|
24
|
+
* - `always`:始终显示
|
|
25
|
+
* - `scroll`:滚动时显示,停止后淡出
|
|
26
|
+
* - `hover`:悬停时显示
|
|
27
|
+
* @default 'hover'
|
|
28
|
+
*/
|
|
29
|
+
type?: 'auto' | 'always' | 'scroll' | 'hover';
|
|
30
|
+
/** type='scroll'/'hover' 时滚动条隐藏前的延迟(毫秒)。 @default 600 */
|
|
31
|
+
scrollHideDelay?: number;
|
|
32
|
+
/** 文字方向。 */
|
|
33
|
+
dir?: 'ltr' | 'rtl';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function ScrollArea({ className, children, ...props }: ScrollAreaProps) {
|
|
37
|
+
return (
|
|
38
|
+
<ScrollAreaPrimitive.Root
|
|
39
|
+
data-slot="scroll-area"
|
|
40
|
+
className={cn('relative', className)}
|
|
41
|
+
{...props}
|
|
42
|
+
>
|
|
43
|
+
<ScrollAreaPrimitive.Viewport
|
|
44
|
+
data-slot="scroll-area-viewport"
|
|
45
|
+
// eslint-disable-next-line teamix-evo/no-arbitrary-tw-value -- rounded-[inherit] is the only way to inherit parent's border-radius.
|
|
46
|
+
className="size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-1"
|
|
47
|
+
>
|
|
48
|
+
{children}
|
|
49
|
+
</ScrollAreaPrimitive.Viewport>
|
|
50
|
+
<ScrollBar />
|
|
51
|
+
<ScrollAreaPrimitive.Corner />
|
|
52
|
+
</ScrollAreaPrimitive.Root>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function ScrollBar({
|
|
57
|
+
className,
|
|
58
|
+
orientation = 'vertical',
|
|
59
|
+
...props
|
|
60
|
+
}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {
|
|
61
|
+
return (
|
|
62
|
+
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
|
63
|
+
data-slot="scroll-area-scrollbar"
|
|
64
|
+
orientation={orientation}
|
|
65
|
+
className={cn(
|
|
66
|
+
'flex touch-none p-px transition-colors select-none',
|
|
67
|
+
orientation === 'vertical' &&
|
|
68
|
+
'h-full w-2.5 border-l border-l-transparent',
|
|
69
|
+
orientation === 'horizontal' &&
|
|
70
|
+
'h-2.5 flex-col border-t border-t-transparent',
|
|
71
|
+
className,
|
|
72
|
+
)}
|
|
73
|
+
{...props}
|
|
74
|
+
>
|
|
75
|
+
<ScrollAreaPrimitive.ScrollAreaThumb
|
|
76
|
+
data-slot="scroll-area-thumb"
|
|
77
|
+
className="relative flex-1 rounded-full bg-border"
|
|
78
|
+
/>
|
|
79
|
+
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { ScrollArea, ScrollBar };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# ScrollArea
|
|
2
|
+
|
|
3
|
+
> 本文件由 `pnpm gen:meta` 自动生成,**请勿手动编辑**。
|
|
4
|
+
|
|
5
|
+
## 描述
|
|
6
|
+
|
|
7
|
+
滚动区域 ScrollArea
|
|
8
|
+
自定义滚动条的滚动容器,基于 Radix ScrollArea 原语。
|
|
9
|
+
|
|
10
|
+
## 使用场景
|
|
11
|
+
|
|
12
|
+
- 固定高度的列表容器
|
|
13
|
+
- 侧边栏内容溢出
|
|
14
|
+
- 代码块 / 日志展示区
|
|
15
|
+
|
|
16
|
+
## Props
|
|
17
|
+
|
|
18
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
19
|
+
| --- | --- | --- | --- | --- |
|
|
20
|
+
| `type` | `'auto' \| 'always' \| 'scroll' \| 'hover'` | `'hover'` | – | 滚动条显示策略。 - `auto`(默认):需要滚动时才显示 - `always`:始终显示 - `scroll`:滚动时显示,停止后淡出 - `hover`:悬停时显示 |
|
|
21
|
+
| `scrollHideDelay` | `number` | `600` | – | type='scroll'/'hover' 时滚动条隐藏前的延迟(毫秒)。 |
|
|
22
|
+
| `dir` | `'ltr' \| 'rtl'` | – | – | 文字方向。 |
|
|
23
|
+
|
|
24
|
+
## 示例
|
|
25
|
+
|
|
26
|
+
### Vertical
|
|
27
|
+
|
|
28
|
+
垂直滚动区域,限定高度后内容超出时出现滚动条。
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
<ScrollArea className="h-72 w-48 rounded-md border border-border">
|
|
32
|
+
<div className="p-4">
|
|
33
|
+
<h4 className="mb-3 text-xs font-medium">版本列表</h4>
|
|
34
|
+
{tags.map((tag) => (
|
|
35
|
+
<div key={tag}>
|
|
36
|
+
<div className="py-1.5 text-xs">{tag}</div>
|
|
37
|
+
<Separator />
|
|
38
|
+
</div>
|
|
39
|
+
))}
|
|
40
|
+
</div>
|
|
41
|
+
</ScrollArea>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### HorizontalScroll
|
|
45
|
+
|
|
46
|
+
水平滚动区域,通过设置内容宽度和 `orientation="horizontal"` 实现。
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
<ScrollArea className="w-96 whitespace-nowrap rounded-md border border-border">
|
|
50
|
+
<div className="flex gap-4 p-4">
|
|
51
|
+
{artworks.map((art) => (
|
|
52
|
+
<figure key={art.title} className="shrink-0">
|
|
53
|
+
<div className="h-24 w-36 overflow-hidden rounded-md bg-muted" />
|
|
54
|
+
<figcaption className="pt-2 text-xs">
|
|
55
|
+
<span className="font-medium">{art.title}</span>
|
|
56
|
+
<span className="ml-2 text-muted-foreground">{art.artist}</span>
|
|
57
|
+
</figcaption>
|
|
58
|
+
</figure>
|
|
59
|
+
))}
|
|
60
|
+
</div>
|
|
61
|
+
<ScrollBar orientation="horizontal" />
|
|
62
|
+
</ScrollArea>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### BothDirections
|
|
66
|
+
|
|
67
|
+
同时支持垂直和水平双向滚动的区域。
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
<ScrollArea className="h-48 w-64 rounded-md border border-border">
|
|
71
|
+
<div className="w-96 p-4">
|
|
72
|
+
<p className="text-xs text-muted-foreground">
|
|
73
|
+
这是一段很长的内容,同时具有纵向和横向滚动。水平方向的内容宽度超出容器,
|
|
74
|
+
垂直方向的内容高度也超出容器。用户可以在两个方向上自由滚动查看完整内容。
|
|
75
|
+
这是一段很长的内容,同时具有纵向和横向滚动。水平方向的内容宽度超出容器,
|
|
76
|
+
垂直方向的内容高度也超出容器。用户可以在两个方向上自由滚动查看完整内容。
|
|
77
|
+
</p>
|
|
78
|
+
<p className="mt-4 text-xs text-muted-foreground">
|
|
79
|
+
这是一段很长的内容,同时具有纵向和横向滚动。水平方向的内容宽度超出容器,
|
|
80
|
+
垂直方向的内容高度也超出容器。用户可以在两个方向上自由滚动查看完整内容。
|
|
81
|
+
</p>
|
|
82
|
+
</div>
|
|
83
|
+
<ScrollBar orientation="horizontal" />
|
|
84
|
+
</ScrollArea>
|
|
85
|
+
```
|