@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,260 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
-
import {
|
|
4
|
-
Controller,
|
|
5
|
-
FormProvider,
|
|
6
|
-
useFormContext,
|
|
7
|
-
type ControllerProps,
|
|
8
|
-
type FieldPath,
|
|
9
|
-
type FieldValues,
|
|
10
|
-
type UseFormReturn,
|
|
11
|
-
} from 'react-hook-form';
|
|
12
|
-
|
|
13
|
-
import { cn } from '@/utils/cn';
|
|
14
|
-
import {
|
|
15
|
-
Field,
|
|
16
|
-
FieldLabel,
|
|
17
|
-
FieldDescription,
|
|
18
|
-
FieldSection,
|
|
19
|
-
FieldActions,
|
|
20
|
-
type FieldProps,
|
|
21
|
-
type FieldLabelProps,
|
|
22
|
-
type FieldSectionProps,
|
|
23
|
-
type FieldActionsProps,
|
|
24
|
-
} from '@/components/field/field';
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* `Form` props — 即 `useForm()` 返回值(`UseFormReturn<TFieldValues>`) 的全部方法,
|
|
28
|
-
* 加上 `children`。`Form` 本质是 `react-hook-form.FormProvider` 的别名;
|
|
29
|
-
* 该 interface 用于 Props 表生成与类型提示。
|
|
30
|
-
*/
|
|
31
|
-
export interface FormProps<TFieldValues extends FieldValues = FieldValues>
|
|
32
|
-
extends UseFormReturn<TFieldValues> {
|
|
33
|
-
/**
|
|
34
|
-
* 表单内容 — 通常是 `<form>` + `<FormField>` 列表。
|
|
35
|
-
*/
|
|
36
|
-
children?: React.ReactNode;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* `Form` = `react-hook-form` 的 `FormProvider` 别名。
|
|
41
|
-
* 配合 `useForm()` 使用,把表单实例下发给所有 `FormField`。
|
|
42
|
-
*/
|
|
43
|
-
const Form = FormProvider;
|
|
44
|
-
|
|
45
|
-
// ─── FormField context ────────────────────────────────────────────────────────
|
|
46
|
-
|
|
47
|
-
interface FormFieldContextValue<
|
|
48
|
-
TFieldValues extends FieldValues = FieldValues,
|
|
49
|
-
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
|
50
|
-
> {
|
|
51
|
-
name: TName;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const FormFieldContext = React.createContext<FormFieldContextValue>(
|
|
55
|
-
{} as FormFieldContextValue,
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* `FormField` = `Controller` 包装,把 `name` 注入下层的 useFormField hook。
|
|
60
|
-
* 用法:`<FormField name="email" control={form.control} render={({ field }) => <FormItem>...</FormItem>} />`
|
|
61
|
-
*/
|
|
62
|
-
function FormField<
|
|
63
|
-
TFieldValues extends FieldValues = FieldValues,
|
|
64
|
-
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
|
65
|
-
>({ ...props }: ControllerProps<TFieldValues, TName>) {
|
|
66
|
-
return (
|
|
67
|
-
<FormFieldContext.Provider value={{ name: props.name }}>
|
|
68
|
-
<Controller {...props} />
|
|
69
|
-
</FormFieldContext.Provider>
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// ─── FormItem context ─────────────────────────────────────────────────────────
|
|
74
|
-
|
|
75
|
-
interface FormItemContextValue {
|
|
76
|
-
id: string;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const FormItemContext = React.createContext<FormItemContextValue>(
|
|
80
|
-
{} as FormItemContextValue,
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* 组合 FormField + FormItem 的字段元数据,用于 Label / Control / Description / Message。
|
|
85
|
-
*/
|
|
86
|
-
const useFormField = () => {
|
|
87
|
-
const fieldContext = React.useContext(FormFieldContext);
|
|
88
|
-
const itemContext = React.useContext(FormItemContext);
|
|
89
|
-
const { getFieldState, formState } = useFormContext();
|
|
90
|
-
const fieldState = getFieldState(fieldContext.name, formState);
|
|
91
|
-
|
|
92
|
-
if (!fieldContext) {
|
|
93
|
-
throw new Error('useFormField should be used within <FormField>');
|
|
94
|
-
}
|
|
95
|
-
const { id } = itemContext;
|
|
96
|
-
return {
|
|
97
|
-
id,
|
|
98
|
-
name: fieldContext.name,
|
|
99
|
-
formItemId: `${id}-form-item`,
|
|
100
|
-
formDescriptionId: `${id}-form-item-description`,
|
|
101
|
-
formMessageId: `${id}-form-item-message`,
|
|
102
|
-
...fieldState,
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
// ─── FormItem(下沉到 Field atom)─────────────────────────────────────────────
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* `FormItemProps` 透传 Field 所有 props(orientation 响应式 / inputWidth / 等),
|
|
110
|
-
* **但不接受 `invalid`** — RHF 流程下 invalid 由 fieldState.error 自动决定。
|
|
111
|
-
*/
|
|
112
|
-
export type FormItemProps = Omit<FieldProps, 'invalid'>;
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* `FormItem` 渲染单个表单字段容器 — 内部用 `Field` 作为视觉骨架,
|
|
116
|
-
* 自动从 RHF `fieldState.error` 注入 `invalid`,Label/Description/Message 关联用稳定 id。
|
|
117
|
-
*
|
|
118
|
-
* 等于"RHF 接入 + 自动 invalid 注入" 的 Field —— 完整继承 Field 的:
|
|
119
|
-
* - orientation(标量 / 响应式)
|
|
120
|
-
* - inputWidth(5 档宽度)
|
|
121
|
-
* - className / style / data-* 透传
|
|
122
|
-
*/
|
|
123
|
-
const FormItem = React.forwardRef<HTMLDivElement, FormItemProps>(
|
|
124
|
-
({ children, ...fieldProps }, ref) => {
|
|
125
|
-
const id = React.useId();
|
|
126
|
-
return (
|
|
127
|
-
<FormItemContext.Provider value={{ id }}>
|
|
128
|
-
<FormItemBody ref={ref} {...fieldProps}>
|
|
129
|
-
{children}
|
|
130
|
-
</FormItemBody>
|
|
131
|
-
</FormItemContext.Provider>
|
|
132
|
-
);
|
|
133
|
-
},
|
|
134
|
-
);
|
|
135
|
-
FormItem.displayName = 'FormItem';
|
|
136
|
-
|
|
137
|
-
const FormItemBody = React.forwardRef<HTMLDivElement, FormItemProps>(
|
|
138
|
-
({ children, ...fieldProps }, ref) => {
|
|
139
|
-
const { error } = useFormField();
|
|
140
|
-
return (
|
|
141
|
-
<Field ref={ref} invalid={!!error} {...fieldProps}>
|
|
142
|
-
{children}
|
|
143
|
-
</Field>
|
|
144
|
-
);
|
|
145
|
-
},
|
|
146
|
-
);
|
|
147
|
-
FormItemBody.displayName = 'FormItemBody';
|
|
148
|
-
|
|
149
|
-
// ─── FormLabel / FormControl / FormDescription / FormMessage ─────────────────
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* `FormLabel` = `FieldLabel` 包装 + 自动 `htmlFor=formItemId`。
|
|
153
|
-
* 着色(invalid → destructive)/ 必填 `*` / horizontal max ⅓ 等所有视觉行为继承自 FieldLabel。
|
|
154
|
-
*/
|
|
155
|
-
const FormLabel = React.forwardRef<HTMLLabelElement, FieldLabelProps>(
|
|
156
|
-
({ className, ...props }, ref) => {
|
|
157
|
-
const { formItemId } = useFormField();
|
|
158
|
-
return (
|
|
159
|
-
<FieldLabel
|
|
160
|
-
ref={ref}
|
|
161
|
-
htmlFor={formItemId}
|
|
162
|
-
className={className}
|
|
163
|
-
{...props}
|
|
164
|
-
/>
|
|
165
|
-
);
|
|
166
|
-
},
|
|
167
|
-
);
|
|
168
|
-
FormLabel.displayName = 'FormLabel';
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* `FormControl` 用 Radix Slot 注入 `id` / `aria-describedby` / `aria-invalid` 到子控件。
|
|
172
|
-
* 内部仅放真正的输入控件(Input / Select / Checkbox / RadioGroup 等)。
|
|
173
|
-
*/
|
|
174
|
-
const FormControl = React.forwardRef<
|
|
175
|
-
React.ElementRef<typeof Slot>,
|
|
176
|
-
React.ComponentPropsWithoutRef<typeof Slot>
|
|
177
|
-
>(({ ...props }, ref) => {
|
|
178
|
-
const { error, formItemId, formDescriptionId, formMessageId } =
|
|
179
|
-
useFormField();
|
|
180
|
-
return (
|
|
181
|
-
<Slot
|
|
182
|
-
ref={ref}
|
|
183
|
-
id={formItemId}
|
|
184
|
-
aria-describedby={
|
|
185
|
-
error ? `${formDescriptionId} ${formMessageId}` : `${formDescriptionId}`
|
|
186
|
-
}
|
|
187
|
-
aria-invalid={!!error}
|
|
188
|
-
{...props}
|
|
189
|
-
/>
|
|
190
|
-
);
|
|
191
|
-
});
|
|
192
|
-
FormControl.displayName = 'FormControl';
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* `FormDescription` = `FieldDescription` 包装 + 自动 `id=formDescriptionId`(给 aria-describedby 用)。
|
|
196
|
-
*/
|
|
197
|
-
const FormDescription = React.forwardRef<
|
|
198
|
-
HTMLParagraphElement,
|
|
199
|
-
React.HTMLAttributes<HTMLParagraphElement>
|
|
200
|
-
>(({ className, ...props }, ref) => {
|
|
201
|
-
const { formDescriptionId } = useFormField();
|
|
202
|
-
return (
|
|
203
|
-
<FieldDescription
|
|
204
|
-
ref={ref}
|
|
205
|
-
id={formDescriptionId}
|
|
206
|
-
className={className}
|
|
207
|
-
{...props}
|
|
208
|
-
/>
|
|
209
|
-
);
|
|
210
|
-
});
|
|
211
|
-
FormDescription.displayName = 'FormDescription';
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* `FormMessage` 渲染错误信息 — 有 RHF `error.message` 时取其文本,否则取 children;都没就不渲染。
|
|
215
|
-
* 视觉等同 FieldError(`-mt-1 text-xs font-medium text-destructive`),
|
|
216
|
-
* 但显示条件由 `error || children` 决定(非 Field.invalid),保留 shadcn 原语义。
|
|
217
|
-
*/
|
|
218
|
-
const FormMessage = React.forwardRef<
|
|
219
|
-
HTMLParagraphElement,
|
|
220
|
-
React.HTMLAttributes<HTMLParagraphElement>
|
|
221
|
-
>(({ className, children, ...props }, ref) => {
|
|
222
|
-
const { error, formMessageId } = useFormField();
|
|
223
|
-
const body = error ? String(error?.message ?? '') : children;
|
|
224
|
-
if (!body) return null;
|
|
225
|
-
return (
|
|
226
|
-
<p
|
|
227
|
-
ref={ref}
|
|
228
|
-
id={formMessageId}
|
|
229
|
-
role="alert"
|
|
230
|
-
className={cn('-mt-1 text-xs font-medium text-destructive', className)}
|
|
231
|
-
{...props}
|
|
232
|
-
>
|
|
233
|
-
{body}
|
|
234
|
-
</p>
|
|
235
|
-
);
|
|
236
|
-
});
|
|
237
|
-
FormMessage.displayName = 'FormMessage';
|
|
238
|
-
|
|
239
|
-
// ─── FormSection / FormActions ────────────────────────────────────────────────
|
|
240
|
-
//
|
|
241
|
-
// 共享 Field 包的同款实现 — 同一职责一处实现(避免规范变更时双写)。
|
|
242
|
-
// - FormSection: title + columns(1|2|3|4 多栏 grid)
|
|
243
|
-
// - FormActions: container 容器感知 + position + align + alignWithInput(基线对齐)
|
|
244
|
-
// 见 `packages/ui/src/components/field/field.tsx`。
|
|
245
|
-
|
|
246
|
-
export type FormSectionProps = FieldSectionProps;
|
|
247
|
-
export type FormActionsProps = FieldActionsProps;
|
|
248
|
-
|
|
249
|
-
export {
|
|
250
|
-
useFormField,
|
|
251
|
-
Form,
|
|
252
|
-
FormItem,
|
|
253
|
-
FormLabel,
|
|
254
|
-
FormControl,
|
|
255
|
-
FormDescription,
|
|
256
|
-
FormMessage,
|
|
257
|
-
FormField,
|
|
258
|
-
FieldSection as FormSection,
|
|
259
|
-
FieldActions as FormActions,
|
|
260
|
-
};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: grid
|
|
3
|
-
name: Grid
|
|
4
|
-
displayName: 栅格
|
|
5
|
-
type: component
|
|
6
|
-
category: layout
|
|
7
|
-
since: 0.1.0
|
|
8
|
-
package: '@teamix-evo/ui'
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Grid (Row / Col) 栅格
|
|
12
|
-
|
|
13
|
-
24 栅格系统 — antd 独有补足。**等价 antd `Row` + `Col`**:基于 CSS Grid 的 24 列容器,支持 `span` / `offset` / `order` / `flex` / `gutter` / `justify` / `align` 等核心 API,中后台表单 / 看板布局基石。
|
|
14
|
-
|
|
15
|
-
## When to use
|
|
16
|
-
|
|
17
|
-
- 中后台多列表单(`<Col span={12}>` 二等分,`<Col span={8}>` 三等分)
|
|
18
|
-
- 数据看板的卡片网格(配 `gutter` 控制水平 / 垂直间距)
|
|
19
|
-
- 响应式布局(配业务侧 Tailwind 断点 className,如 `className="md:col-span-12 col-span-24"`)
|
|
20
|
-
|
|
21
|
-
## When NOT to use
|
|
22
|
-
|
|
23
|
-
- 简单 flex 容器 → `Flex`
|
|
24
|
-
- inline 间距小集合 → `Space`
|
|
25
|
-
- 不固定列数的卡片墙 → 直接用 Tailwind `grid-cols-N` 或 `Item` 配 `ItemGroup`
|
|
26
|
-
|
|
27
|
-
## Props
|
|
28
|
-
|
|
29
|
-
<!-- auto:props:begin -->
|
|
30
|
-
_(组件无 `<Name>Props` interface — props 详见 [`grid.tsx`](./grid.tsx))_
|
|
31
|
-
<!-- auto:props:end -->
|
|
32
|
-
|
|
33
|
-
## 依赖
|
|
34
|
-
|
|
35
|
-
<!-- auto:deps:begin -->
|
|
36
|
-
### 同库依赖
|
|
37
|
-
|
|
38
|
-
> `teamix-evo ui add grid` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
39
|
-
|
|
40
|
-
| Entry | 类型 | 描述 |
|
|
41
|
-
| --- | --- | --- |
|
|
42
|
-
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
43
|
-
|
|
44
|
-
### npm 依赖
|
|
45
|
-
|
|
46
|
-
_无 — 本组件不依赖任何 npm 包。_
|
|
47
|
-
<!-- auto:deps:end -->
|
|
48
|
-
|
|
49
|
-
## AI 生成纪律
|
|
50
|
-
|
|
51
|
-
- **`span` 默认 24**(占满一行) — 不传等于"独占整行"
|
|
52
|
-
- **`gutter` 走 design 间距刻度**:接受 number(等价 `[n, n]`)或 `[h, v]`,实际值就是 `n * 4px`(Tailwind gap-N 同源)
|
|
53
|
-
- **`offset`** 用百分比定位,不要超过 24 - span(否则越界)
|
|
54
|
-
- **`flex={true}`** 等价 antd `flex="auto"` — 撑满剩余空间;启用后 `span` 失效
|
|
55
|
-
- **`span={0}` 隐藏**(antd 兼容行为) — 用 `0` 隐藏比 `display: none` 语义更明确
|
|
56
|
-
- **响应式**:本组件不内置 antd 的 `xs/sm/md/lg/xl/xxl` 断点 prop — 业务侧请用 Tailwind `md:col-span-12` 等响应式 className(更原生、更可控)
|
|
57
|
-
- **不要嵌套 Row 表达卡片网格** — 那是 `Item` + Tailwind grid 的活
|
|
58
|
-
|
|
59
|
-
## Examples
|
|
60
|
-
|
|
61
|
-
```tsx
|
|
62
|
-
import { Row, Col } from '@/components/ui/grid';
|
|
63
|
-
|
|
64
|
-
// 二等分表单
|
|
65
|
-
<Row gutter={4}>
|
|
66
|
-
<Col span={12}>
|
|
67
|
-
<Field><FieldLabel>姓</FieldLabel><Input /></Field>
|
|
68
|
-
</Col>
|
|
69
|
-
<Col span={12}>
|
|
70
|
-
<Field><FieldLabel>名</FieldLabel><Input /></Field>
|
|
71
|
-
</Col>
|
|
72
|
-
</Row>
|
|
73
|
-
|
|
74
|
-
// 8-8-8 三等分
|
|
75
|
-
<Row gutter={[4, 4]}>
|
|
76
|
-
<Col span={8}><Card /></Col>
|
|
77
|
-
<Col span={8}><Card /></Col>
|
|
78
|
-
<Col span={8}><Card /></Col>
|
|
79
|
-
</Row>
|
|
80
|
-
|
|
81
|
-
// 主区 + 侧边(主区 flex 撑满)
|
|
82
|
-
<Row gutter={4}>
|
|
83
|
-
<Col flex><MainContent /></Col>
|
|
84
|
-
<Col span={6}><Sidebar /></Col>
|
|
85
|
-
</Row>
|
|
86
|
-
|
|
87
|
-
// 偏移
|
|
88
|
-
<Row gutter={4}>
|
|
89
|
-
<Col span={8} offset={4}>居中的 8 列</Col>
|
|
90
|
-
<Col span={8} offset={4}>另一个</Col>
|
|
91
|
-
</Row>
|
|
92
|
-
```
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { Row, Col } from './grid';
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof Row> = {
|
|
5
|
-
title: '布局 · Layout/Grid',
|
|
6
|
-
component: Row,
|
|
7
|
-
tags: ['autodocs'],
|
|
8
|
-
parameters: {
|
|
9
|
-
docs: {
|
|
10
|
-
description: {
|
|
11
|
-
component:
|
|
12
|
-
'24 栅格 — 基于 CSS Grid 的 24 列容器(antd Row + Col)。中后台表单 / 看板布局基石,支持 span / offset / order / flex / gutter / justify / align。响应式建议直接用 Tailwind 断点 className。',
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default meta;
|
|
19
|
-
type Story = StoryObj<typeof Row>;
|
|
20
|
-
|
|
21
|
-
const Box = ({ children }: { children: React.ReactNode }) => (
|
|
22
|
-
<div className="rounded-md bg-muted px-3 py-4 text-center text-sm">
|
|
23
|
-
{children}
|
|
24
|
-
</div>
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
export const Playground: Story = {
|
|
28
|
-
parameters: { controls: { disable: true } },
|
|
29
|
-
render: () => (
|
|
30
|
-
<Row gutter={4}>
|
|
31
|
-
<Col span={12}>
|
|
32
|
-
<Box>span = 12</Box>
|
|
33
|
-
</Col>
|
|
34
|
-
<Col span={12}>
|
|
35
|
-
<Box>span = 12</Box>
|
|
36
|
-
</Col>
|
|
37
|
-
</Row>
|
|
38
|
-
),
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const Thirds: Story = {
|
|
42
|
-
parameters: { controls: { disable: true } },
|
|
43
|
-
render: () => (
|
|
44
|
-
<Row gutter={[4, 4]}>
|
|
45
|
-
<Col span={8}>
|
|
46
|
-
<Box>span = 8</Box>
|
|
47
|
-
</Col>
|
|
48
|
-
<Col span={8}>
|
|
49
|
-
<Box>span = 8</Box>
|
|
50
|
-
</Col>
|
|
51
|
-
<Col span={8}>
|
|
52
|
-
<Box>span = 8</Box>
|
|
53
|
-
</Col>
|
|
54
|
-
</Row>
|
|
55
|
-
),
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const WithFlex: Story = {
|
|
59
|
-
parameters: { controls: { disable: true } },
|
|
60
|
-
render: () => (
|
|
61
|
-
<Row gutter={4}>
|
|
62
|
-
<Col flex>
|
|
63
|
-
<Box>flex(撑满)</Box>
|
|
64
|
-
</Col>
|
|
65
|
-
<Col span={6}>
|
|
66
|
-
<Box>span = 6 sidebar</Box>
|
|
67
|
-
</Col>
|
|
68
|
-
</Row>
|
|
69
|
-
),
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export const Offset: Story = {
|
|
73
|
-
parameters: { controls: { disable: true } },
|
|
74
|
-
render: () => (
|
|
75
|
-
<Row gutter={4}>
|
|
76
|
-
<Col span={8} offset={4}>
|
|
77
|
-
<Box>span=8 offset=4</Box>
|
|
78
|
-
</Col>
|
|
79
|
-
<Col span={8} offset={4}>
|
|
80
|
-
<Box>span=8 offset=4</Box>
|
|
81
|
-
</Col>
|
|
82
|
-
</Row>
|
|
83
|
-
),
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export const JustifyCenter: Story = {
|
|
87
|
-
parameters: { controls: { disable: true } },
|
|
88
|
-
render: () => (
|
|
89
|
-
<Row gutter={4} justify="center">
|
|
90
|
-
<Col span={6}>
|
|
91
|
-
<Box>1</Box>
|
|
92
|
-
</Col>
|
|
93
|
-
<Col span={6}>
|
|
94
|
-
<Box>2</Box>
|
|
95
|
-
</Col>
|
|
96
|
-
<Col span={6}>
|
|
97
|
-
<Box>3</Box>
|
|
98
|
-
</Col>
|
|
99
|
-
</Row>
|
|
100
|
-
),
|
|
101
|
-
};
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import { cn } from '@/utils/cn';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* antd 24 栅格的端口实现。底层使用 CSS Grid + 24 column,与 antd `Row` / `Col` 语义对齐。
|
|
7
|
-
* `span` / `offset` 接受 1~24 整数;`gutter` 是 `[水平, 垂直]` 间距(任选传 number 等价 `[n, n]`)。
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
const justifyMap = {
|
|
11
|
-
start: 'justify-start',
|
|
12
|
-
center: 'justify-center',
|
|
13
|
-
end: 'justify-end',
|
|
14
|
-
'space-between': 'justify-between',
|
|
15
|
-
'space-around': 'justify-around',
|
|
16
|
-
'space-evenly': 'justify-evenly',
|
|
17
|
-
} as const;
|
|
18
|
-
|
|
19
|
-
const alignMap = {
|
|
20
|
-
top: 'items-start',
|
|
21
|
-
middle: 'items-center',
|
|
22
|
-
bottom: 'items-end',
|
|
23
|
-
stretch: 'items-stretch',
|
|
24
|
-
} as const;
|
|
25
|
-
|
|
26
|
-
export interface RowProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
27
|
-
/**
|
|
28
|
-
* 子项间距 — number 等价 `[n, n]`;`[h, v]` 分别控制水平 / 垂直。
|
|
29
|
-
* 注意:走 design 间距刻度,实际渲染值就是 `n * 4px`(Tailwind gap-N)。
|
|
30
|
-
* @default 0
|
|
31
|
-
*/
|
|
32
|
-
gutter?: number | [number, number];
|
|
33
|
-
/**
|
|
34
|
-
* 水平排列(antd `justify` 并集)。
|
|
35
|
-
* @default "start"
|
|
36
|
-
*/
|
|
37
|
-
justify?: keyof typeof justifyMap;
|
|
38
|
-
/**
|
|
39
|
-
* 垂直对齐(antd `align` 并集)。
|
|
40
|
-
* @default "top"
|
|
41
|
-
*/
|
|
42
|
-
align?: keyof typeof alignMap;
|
|
43
|
-
/**
|
|
44
|
-
* 是否允许换行(antd `wrap` 并集)。
|
|
45
|
-
* @default true
|
|
46
|
-
*/
|
|
47
|
-
wrap?: boolean;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const Row = React.forwardRef<HTMLDivElement, RowProps>(
|
|
51
|
-
(
|
|
52
|
-
{
|
|
53
|
-
gutter = 0,
|
|
54
|
-
justify = 'start',
|
|
55
|
-
align = 'top',
|
|
56
|
-
wrap = true,
|
|
57
|
-
className,
|
|
58
|
-
children,
|
|
59
|
-
style,
|
|
60
|
-
...props
|
|
61
|
-
},
|
|
62
|
-
ref,
|
|
63
|
-
) => {
|
|
64
|
-
const [hGutter, vGutter] =
|
|
65
|
-
Array.isArray(gutter) ? gutter : [gutter, gutter];
|
|
66
|
-
return (
|
|
67
|
-
<div
|
|
68
|
-
ref={ref}
|
|
69
|
-
className={cn('grid', justifyMap[justify], alignMap[align], className)}
|
|
70
|
-
style={{
|
|
71
|
-
gridTemplateColumns: 'repeat(24, minmax(0, 1fr))',
|
|
72
|
-
columnGap: `${hGutter * 4}px`,
|
|
73
|
-
rowGap: `${vGutter * 4}px`,
|
|
74
|
-
...style,
|
|
75
|
-
}}
|
|
76
|
-
{...props}
|
|
77
|
-
>
|
|
78
|
-
{children}
|
|
79
|
-
</div>
|
|
80
|
-
);
|
|
81
|
-
},
|
|
82
|
-
);
|
|
83
|
-
Row.displayName = 'Row';
|
|
84
|
-
|
|
85
|
-
export interface ColProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
86
|
-
/**
|
|
87
|
-
* 占用栅格数(1~24,antd `span` 并集) — 0 表示隐藏(对齐 antd 行为)。
|
|
88
|
-
* @default 24
|
|
89
|
-
*/
|
|
90
|
-
span?: number;
|
|
91
|
-
/**
|
|
92
|
-
* 左侧偏移栅格数(antd `offset` 并集)。
|
|
93
|
-
* @default 0
|
|
94
|
-
*/
|
|
95
|
-
offset?: number;
|
|
96
|
-
/**
|
|
97
|
-
* 顺序(antd `order` 并集) — 用于响应式 / a11y 顺序变更场景。
|
|
98
|
-
*/
|
|
99
|
-
order?: number;
|
|
100
|
-
/**
|
|
101
|
-
* 自动撑满剩余空间(antd `flex="auto"` 等价) — 设置后忽略 span。
|
|
102
|
-
* @default false
|
|
103
|
-
*/
|
|
104
|
-
flex?: boolean;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const Col = React.forwardRef<HTMLDivElement, ColProps>(
|
|
108
|
-
({ span = 24, offset = 0, order, flex = false, className, style, ...props }, ref) => {
|
|
109
|
-
if (span === 0) return null;
|
|
110
|
-
const computedStyle: React.CSSProperties = { ...style };
|
|
111
|
-
if (flex) {
|
|
112
|
-
computedStyle.flex = '1 1 0%';
|
|
113
|
-
} else {
|
|
114
|
-
computedStyle.gridColumn = `span ${Math.max(1, Math.min(24, span))} / span ${Math.max(1, Math.min(24, span))}`;
|
|
115
|
-
if (offset > 0) computedStyle.marginLeft = `${(offset / 24) * 100}%`;
|
|
116
|
-
}
|
|
117
|
-
if (typeof order === 'number') computedStyle.order = order;
|
|
118
|
-
return (
|
|
119
|
-
<div
|
|
120
|
-
ref={ref}
|
|
121
|
-
className={cn('min-w-0', className)}
|
|
122
|
-
style={computedStyle}
|
|
123
|
-
{...props}
|
|
124
|
-
/>
|
|
125
|
-
);
|
|
126
|
-
},
|
|
127
|
-
);
|
|
128
|
-
Col.displayName = 'Col';
|
|
129
|
-
|
|
130
|
-
export { Row, Col };
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: hover-card
|
|
3
|
-
name: HoverCard
|
|
4
|
-
type: component
|
|
5
|
-
category: data-display
|
|
6
|
-
since: 0.1.0
|
|
7
|
-
package: '@teamix-evo/ui'
|
|
8
|
-
displayName: 悬浮卡片
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# HoverCard 悬浮卡片
|
|
12
|
-
|
|
13
|
-
悬浮信息卡 — Radix HoverCard 包装。**shadcn-only**(antd 无对标 — antd Tooltip 仅文字,Popover 是 click 触发,HoverCard 是 hover 触发的富内容)。与 Tooltip / Popover 对齐,使用 `showArrow` 统一控制尖角(默认 `false`)。
|
|
14
|
-
|
|
15
|
-
`Tooltip` 与 `HoverCard` 的边界:
|
|
16
|
-
|
|
17
|
-
- 1 行简短文字 → `Tooltip`
|
|
18
|
-
- 多行 / 含图片 / 含弱交互(链接 / Avatar)→ `HoverCard`
|
|
19
|
-
|
|
20
|
-
## When to use
|
|
21
|
-
|
|
22
|
-
- 鼠标悬浮在 @username / 资源名 上展示卡片(GitHub / Twitter 风格)
|
|
23
|
-
- 列表项的 hover 预览(标题 + 摘要 + tag)
|
|
24
|
-
- 缩略链接预览(URL + 简介 + 域名)
|
|
25
|
-
|
|
26
|
-
## When NOT to use
|
|
27
|
-
|
|
28
|
-
- 移动端首要功能 → 触屏不触发 hover,改 `Popover`
|
|
29
|
-
- 强交互 → `Popover`
|
|
30
|
-
- 简短文字 → `Tooltip`
|
|
31
|
-
|
|
32
|
-
## Props
|
|
33
|
-
|
|
34
|
-
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成。下表为 `HoverCardContent` 的 props;`HoverCard` Root 透传 `openDelay / closeDelay / open / defaultOpen / onOpenChange`。
|
|
35
|
-
|
|
36
|
-
<!-- auto:props:begin -->
|
|
37
|
-
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
38
|
-
| --- | --- | --- | --- | --- |
|
|
39
|
-
| `showArrow` | `boolean` | `false` | – | 是否显示三角形箭头(antd `arrow` 并集)。 与 Tooltip / Popover 统一用 `showArrow`。 |
|
|
40
|
-
<!-- auto:props:end -->
|
|
41
|
-
|
|
42
|
-
## 依赖
|
|
43
|
-
|
|
44
|
-
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成,数据源是 [`manifest.json`](../../../manifest.json)。**手工编辑 marker 之间的内容会在下次生成时被覆盖**。
|
|
45
|
-
|
|
46
|
-
<!-- auto:deps:begin -->
|
|
47
|
-
### 同库依赖
|
|
48
|
-
|
|
49
|
-
> `teamix-evo ui add hover-card` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
50
|
-
|
|
51
|
-
| Entry | 类型 | 描述 |
|
|
52
|
-
| --- | --- | --- |
|
|
53
|
-
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
54
|
-
|
|
55
|
-
### npm 依赖
|
|
56
|
-
|
|
57
|
-
> 业务侧需要先 `pnpm add` / `npm install` 这些包。CLI 在 `ui add` 完成后会列出此提示。
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
pnpm add @radix-ui/react-hover-card@^1.1.0
|
|
61
|
-
```
|
|
62
|
-
<!-- auto:deps:end -->
|
|
63
|
-
|
|
64
|
-
## AI 生成纪律
|
|
65
|
-
|
|
66
|
-
- **Trigger 用 `asChild`**:wrap 已有元素而非新增 button
|
|
67
|
-
- **`openDelay` 别太短**:用户快速划过时不要把卡片闪一下;**默认 700ms** 通常合理
|
|
68
|
-
- **HoverCard 内不放表单**:表单需要 click 焦点 → 用 `Popover`
|
|
69
|
-
- **不要嵌套 HoverCard**:嵌套 hover 状态混乱
|
|
70
|
-
- **尖角名称用 `showArrow`**:与 Tooltip / Popover 保持一致;资源卡/名片场景建议保持默认无尖角以减少视觉噪点,仅在需要强调与 trigger 的联动时开启
|
|
71
|
-
|
|
72
|
-
## Examples
|
|
73
|
-
|
|
74
|
-
```tsx
|
|
75
|
-
import {
|
|
76
|
-
HoverCard,
|
|
77
|
-
HoverCardTrigger,
|
|
78
|
-
HoverCardContent,
|
|
79
|
-
} from '@/components/ui/hover-card';
|
|
80
|
-
import { Avatar, AvatarImage, AvatarFallback } from '@/components/ui/avatar';
|
|
81
|
-
|
|
82
|
-
<HoverCard>
|
|
83
|
-
<HoverCardTrigger asChild>
|
|
84
|
-
<a href="/u/lyca" className="font-medium text-primary hover:underline">
|
|
85
|
-
@lyca
|
|
86
|
-
</a>
|
|
87
|
-
</HoverCardTrigger>
|
|
88
|
-
<HoverCardContent>
|
|
89
|
-
<div className="flex gap-3">
|
|
90
|
-
<Avatar>
|
|
91
|
-
<AvatarImage src="/u/lyca.jpg" />
|
|
92
|
-
<AvatarFallback>LY</AvatarFallback>
|
|
93
|
-
</Avatar>
|
|
94
|
-
<div className="space-y-1">
|
|
95
|
-
<h4 className="text-sm font-semibold">@lyca</h4>
|
|
96
|
-
<p className="text-xs text-muted-foreground">
|
|
97
|
-
Frontend engineer · Joined 2020
|
|
98
|
-
</p>
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
101
|
-
</HoverCardContent>
|
|
102
|
-
</HoverCard>;
|
|
103
|
-
```
|