@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,144 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
|
-
import { Search } from 'lucide-react';
|
|
4
|
-
import { Input } from './input';
|
|
5
|
-
import {
|
|
6
|
-
InputGroup,
|
|
7
|
-
InputGroupAddon,
|
|
8
|
-
InputGroupInput,
|
|
9
|
-
} from '@/components/input-group/input-group';
|
|
10
|
-
|
|
11
|
-
const meta: Meta<typeof Input> = {
|
|
12
|
-
title: '数据录入 · Data Entry/Input',
|
|
13
|
-
component: Input,
|
|
14
|
-
tags: ['autodocs'],
|
|
15
|
-
parameters: {
|
|
16
|
-
docs: {
|
|
17
|
-
description: {
|
|
18
|
-
component:
|
|
19
|
-
'输入框 — shadcn 简洁基底 + antd 并集中保留为内建逻辑能力的:`size` 三档(sm/md/lg,与 `Button` 同档)、`clearable` 一键清空、`showCount` + `maxLength` 字数统计、`error` / `aria-invalid` 错误态。**前后缀 / 单位 / 协议头 / 内嵌按钮**等"装饰类"形态请用同库 `InputGroup` 复合插槽(见下方 `WithInputGroup` 示例)— 单一职责更清晰,与 shadcn 2025-10 拆分对齐(ADR 0029)。',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
argTypes: {
|
|
24
|
-
size: { control: 'inline-radio', options: ['sm', 'md', 'lg'] },
|
|
25
|
-
type: {
|
|
26
|
-
control: 'select',
|
|
27
|
-
options: ['text', 'email', 'password', 'search', 'tel', 'url'],
|
|
28
|
-
},
|
|
29
|
-
clearable: { control: 'boolean' },
|
|
30
|
-
showCount: { control: 'boolean' },
|
|
31
|
-
disabled: { control: 'boolean' },
|
|
32
|
-
error: { control: 'boolean' },
|
|
33
|
-
placeholder: { control: 'text' },
|
|
34
|
-
maxLength: { control: 'number' },
|
|
35
|
-
},
|
|
36
|
-
args: {
|
|
37
|
-
size: 'md',
|
|
38
|
-
type: 'text',
|
|
39
|
-
clearable: false,
|
|
40
|
-
showCount: false,
|
|
41
|
-
disabled: false,
|
|
42
|
-
error: false,
|
|
43
|
-
placeholder: '请输入...',
|
|
44
|
-
},
|
|
45
|
-
decorators: [
|
|
46
|
-
(Story) => (
|
|
47
|
-
<div className="w-72">
|
|
48
|
-
<Story />
|
|
49
|
-
</div>
|
|
50
|
-
),
|
|
51
|
-
],
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export default meta;
|
|
55
|
-
type Story = StoryObj<typeof Input>;
|
|
56
|
-
|
|
57
|
-
export const Playground: Story = {};
|
|
58
|
-
|
|
59
|
-
export const Sizes: Story = {
|
|
60
|
-
parameters: { controls: { disable: true } },
|
|
61
|
-
render: () => (
|
|
62
|
-
<div className="flex flex-col gap-3">
|
|
63
|
-
<Input size="sm" placeholder="Small (h-6 / text-xs / 24px)" />
|
|
64
|
-
<Input size="md" placeholder="Medium (h-8 / text-xs / 32px)" />
|
|
65
|
-
<Input size="lg" placeholder="Large (h-9 / text-sm / 36px)" />
|
|
66
|
-
</div>
|
|
67
|
-
),
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export const Clearable: Story = {
|
|
71
|
-
parameters: { controls: { disable: true } },
|
|
72
|
-
render: () => {
|
|
73
|
-
const [v, setV] = React.useState('Hello');
|
|
74
|
-
return (
|
|
75
|
-
<Input
|
|
76
|
-
clearable
|
|
77
|
-
value={v}
|
|
78
|
-
onChange={(e) => setV(e.target.value)}
|
|
79
|
-
placeholder="可清除..."
|
|
80
|
-
/>
|
|
81
|
-
);
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export const ShowCount: Story = {
|
|
86
|
-
parameters: { controls: { disable: true } },
|
|
87
|
-
render: () => <Input showCount maxLength={140} placeholder="发布动态" />,
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export const Error: Story = {
|
|
91
|
-
parameters: { controls: { disable: true } },
|
|
92
|
-
render: () => (
|
|
93
|
-
<div className="flex flex-col gap-3">
|
|
94
|
-
<Input error placeholder="必填" />
|
|
95
|
-
<Input error defaultValue="非法值" />
|
|
96
|
-
</div>
|
|
97
|
-
),
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export const Disabled: Story = {
|
|
101
|
-
parameters: { controls: { disable: true } },
|
|
102
|
-
render: () => (
|
|
103
|
-
<div className="flex flex-col gap-3">
|
|
104
|
-
<Input disabled placeholder="禁用态" />
|
|
105
|
-
<Input disabled defaultValue="只读内容" />
|
|
106
|
-
</div>
|
|
107
|
-
),
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* 想加图标 / 单位 / 协议头?用 `InputGroup` 复合插槽 — 不再用已废弃的
|
|
112
|
-
* `prefix` / `suffix` / `addonBefore` / `addonAfter` 快捷 prop(ADR 0029)。
|
|
113
|
-
*
|
|
114
|
-
* 详细演示与 API 见 `数据录入 · Data Entry/InputGroup` 故事集。
|
|
115
|
-
*/
|
|
116
|
-
export const WithInputGroup: Story = {
|
|
117
|
-
name: '配合 InputGroup(替代旧 prefix/suffix/addon)',
|
|
118
|
-
parameters: { controls: { disable: true } },
|
|
119
|
-
render: () => (
|
|
120
|
-
<div className="flex w-80 flex-col gap-3">
|
|
121
|
-
{/* 图标前缀(替代旧 prefix={<Search />}) */}
|
|
122
|
-
<InputGroup>
|
|
123
|
-
<InputGroupAddon position="before" variant="icon">
|
|
124
|
-
<Search className="size-4" />
|
|
125
|
-
</InputGroupAddon>
|
|
126
|
-
<InputGroupInput placeholder="搜索..." />
|
|
127
|
-
</InputGroup>
|
|
128
|
-
|
|
129
|
-
{/* URL 协议头/后缀(替代旧 addonBefore="https://" addonAfter=".com") */}
|
|
130
|
-
<InputGroup>
|
|
131
|
-
<InputGroupAddon position="before">https://</InputGroupAddon>
|
|
132
|
-
<InputGroupInput defaultValue="example" />
|
|
133
|
-
<InputGroupAddon position="after">.com</InputGroupAddon>
|
|
134
|
-
</InputGroup>
|
|
135
|
-
|
|
136
|
-
{/* 金额/单位(替代旧 prefix="¥" suffix="USD") */}
|
|
137
|
-
<InputGroup>
|
|
138
|
-
<InputGroupAddon position="before">¥</InputGroupAddon>
|
|
139
|
-
<InputGroupInput type="number" defaultValue={199} />
|
|
140
|
-
<InputGroupAddon position="after">/ 月</InputGroupAddon>
|
|
141
|
-
</InputGroup>
|
|
142
|
-
</div>
|
|
143
|
-
),
|
|
144
|
-
};
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { cva } from 'class-variance-authority';
|
|
3
|
-
import { X } from 'lucide-react';
|
|
4
|
-
|
|
5
|
-
import { cn } from '@/utils/cn';
|
|
6
|
-
|
|
7
|
-
// ─── shared sizing(对齐 Button 三档:24 / 32 / 36px) ────────────────────────
|
|
8
|
-
//
|
|
9
|
-
// 高度 24/32/36px 与 Button / Select 同档;
|
|
10
|
-
// 这里直接用对应的 Tailwind 高度刻度 `h-6 / h-8 / h-9`,字号档位与 Button 同步。
|
|
11
|
-
const SIZE_TO_HEIGHT = {
|
|
12
|
-
sm: 'h-6 text-xs',
|
|
13
|
-
// medium 字号对齐 cd hybridcloud --form-element-medium-font-size: 12px (ADR 0027)
|
|
14
|
-
md: 'h-8 text-xs',
|
|
15
|
-
lg: 'h-9 text-sm',
|
|
16
|
-
/** @deprecated 兼容旧调用,等价于 `md`。 */
|
|
17
|
-
default: 'h-8 text-xs',
|
|
18
|
-
} as const;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Input 主体(无 affix 时直接使用此变体)。
|
|
22
|
-
* 高度 `h-6 / h-8 / h-9`(24 / 32 / 36px,与 Button / Select 同档);
|
|
23
|
-
* 圆角走 Tailwind v4 标准 namespace `--radius-md`(uni-manager 2px / opentrek 6px),
|
|
24
|
-
* 与 Button 同档 — 同行混排时视觉自动对齐。
|
|
25
|
-
*
|
|
26
|
-
* **前后缀 / addon 不再内置** — 需要前后缀图标 / 文本 / 按钮请用同库 `InputGroup`
|
|
27
|
-
* + `InputGroupAddon` + `InputGroupInput` 复合 API(自由嵌套 icon / button / text)。
|
|
28
|
-
* 字符计数 `showCount` + 一键清空 `clearable` 仍保留为 Input 的内建逻辑能力。
|
|
29
|
-
*/
|
|
30
|
-
const inputVariants = cva(
|
|
31
|
-
'flex w-full rounded-md border border-input bg-card px-[var(--input-padding-x)] py-[var(--input-padding-y)] shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none hover:border-ring focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/10 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:focus-visible:ring-destructive/10',
|
|
32
|
-
{
|
|
33
|
-
variants: { size: SIZE_TO_HEIGHT },
|
|
34
|
-
defaultVariants: { size: 'md' },
|
|
35
|
-
},
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Input 包壳容器(`clearable` 启用时承载 border + ring,把内部 input 的边框转移到外层)。
|
|
40
|
-
*/
|
|
41
|
-
const inputWrapperVariants = cva(
|
|
42
|
-
'flex w-full items-center gap-2 rounded-md border border-input bg-card px-[var(--input-padding-x)] shadow-sm transition-colors hover:border-ring focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/10 aria-invalid:border-destructive aria-invalid:focus-within:ring-destructive/10',
|
|
43
|
-
{
|
|
44
|
-
variants: { size: SIZE_TO_HEIGHT },
|
|
45
|
-
defaultVariants: { size: 'md' },
|
|
46
|
-
},
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
export interface InputProps
|
|
50
|
-
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'> {
|
|
51
|
-
/**
|
|
52
|
-
* 显示清除按钮,有内容时点击清空(antd `allowClear` 并集)。
|
|
53
|
-
*
|
|
54
|
-
* 注:仅"快捷一键清空"逻辑保留为 Input 内建能力 — 复合的前后缀(图标 / 文本 / 按钮)
|
|
55
|
-
* 请用 `InputGroup` 系列。
|
|
56
|
-
* @default false
|
|
57
|
-
*/
|
|
58
|
-
clearable?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* 显示字符计数(antd `showCount` 并集);需配合 `maxLength` 一起使用。
|
|
61
|
-
* @default false
|
|
62
|
-
*/
|
|
63
|
-
showCount?: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* 尺寸三档,与 `Button` 同档:`sm`(24px) / `md`(32px,默认) / `lg`(36px)。
|
|
66
|
-
* `"default"` 为兼容旧调用的别名,等价于 `"md"`,新代码请用 `"md"`。
|
|
67
|
-
* @default "md"
|
|
68
|
-
*/
|
|
69
|
-
size?: 'sm' | 'md' | 'lg' | 'default';
|
|
70
|
-
/**
|
|
71
|
-
* 错误态(快捷开关),会同时设置 `aria-invalid`,渲染 destructive 边框 / ring。
|
|
72
|
-
* 也可以直接传 `aria-invalid` 原生属性达到同效果。
|
|
73
|
-
* @default false
|
|
74
|
-
*/
|
|
75
|
-
error?: boolean;
|
|
76
|
-
/** 受控值,用于 clearable / showCount 的逻辑;未传时回退到 uncontrolled 行为。 */
|
|
77
|
-
value?: string;
|
|
78
|
-
/** uncontrolled 初始值。 */
|
|
79
|
-
defaultValue?: string;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Input 单行文本输入 — shadcn 简洁基底 + antd `clearable` / `showCount` / `size` / `error` 并集。
|
|
84
|
-
*
|
|
85
|
-
* **想加图标 / 单位 / 按钮 / 协议头?用 InputGroup 复合插槽:**
|
|
86
|
-
* ```tsx
|
|
87
|
-
* import { InputGroup, InputGroupAddon, InputGroupInput } from '@/components/input-group/input-group';
|
|
88
|
-
* // 搜索图标 + 输入
|
|
89
|
-
* <InputGroup>
|
|
90
|
-
* <InputGroupAddon position="before" variant="icon"><Search /></InputGroupAddon>
|
|
91
|
-
* <InputGroupInput placeholder="搜索..." />
|
|
92
|
-
* </InputGroup>
|
|
93
|
-
* // URL(text 前后缀)
|
|
94
|
-
* <InputGroup>
|
|
95
|
-
* <InputGroupAddon position="before">https://</InputGroupAddon>
|
|
96
|
-
* <InputGroupInput defaultValue="example" />
|
|
97
|
-
* <InputGroupAddon position="after">.com</InputGroupAddon>
|
|
98
|
-
* </InputGroup>
|
|
99
|
-
* ```
|
|
100
|
-
*/
|
|
101
|
-
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
102
|
-
(
|
|
103
|
-
{
|
|
104
|
-
className,
|
|
105
|
-
type = 'text',
|
|
106
|
-
clearable = false,
|
|
107
|
-
showCount = false,
|
|
108
|
-
size = 'md',
|
|
109
|
-
error = false,
|
|
110
|
-
value,
|
|
111
|
-
defaultValue,
|
|
112
|
-
onChange,
|
|
113
|
-
maxLength,
|
|
114
|
-
disabled,
|
|
115
|
-
'aria-invalid': ariaInvalidProp,
|
|
116
|
-
...props
|
|
117
|
-
},
|
|
118
|
-
ref,
|
|
119
|
-
) => {
|
|
120
|
-
// Track the current value for clearable / showCount; mirror uncontrolled
|
|
121
|
-
// input via internal state when `value` prop isn't provided.
|
|
122
|
-
const isControlled = value !== undefined;
|
|
123
|
-
const [internal, setInternal] = React.useState<string>(defaultValue ?? '');
|
|
124
|
-
const current = isControlled ? value : internal;
|
|
125
|
-
|
|
126
|
-
const innerRef = React.useRef<HTMLInputElement | null>(null);
|
|
127
|
-
React.useImperativeHandle(ref, () => innerRef.current as HTMLInputElement);
|
|
128
|
-
|
|
129
|
-
const ariaInvalid = ariaInvalidProp ?? (error ? true : undefined);
|
|
130
|
-
|
|
131
|
-
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
132
|
-
if (!isControlled) setInternal(e.target.value);
|
|
133
|
-
onChange?.(e);
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
const handleClear = () => {
|
|
137
|
-
if (!isControlled) setInternal('');
|
|
138
|
-
const target = innerRef.current;
|
|
139
|
-
if (target) {
|
|
140
|
-
const proto = Object.getPrototypeOf(target);
|
|
141
|
-
const desc = Object.getOwnPropertyDescriptor(proto, 'value');
|
|
142
|
-
desc?.set?.call(target, '');
|
|
143
|
-
target.dispatchEvent(new Event('input', { bubbles: true }));
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
const showClearBtn =
|
|
148
|
-
clearable && current && current.length > 0 && !disabled;
|
|
149
|
-
|
|
150
|
-
const innerInput = clearable ? (
|
|
151
|
-
<div
|
|
152
|
-
aria-invalid={ariaInvalid}
|
|
153
|
-
className={cn(
|
|
154
|
-
inputWrapperVariants({ size }),
|
|
155
|
-
disabled && 'cursor-not-allowed opacity-50',
|
|
156
|
-
className,
|
|
157
|
-
)}
|
|
158
|
-
>
|
|
159
|
-
<input
|
|
160
|
-
ref={innerRef}
|
|
161
|
-
type={type}
|
|
162
|
-
value={isControlled ? value : undefined}
|
|
163
|
-
defaultValue={!isControlled ? defaultValue : undefined}
|
|
164
|
-
maxLength={maxLength}
|
|
165
|
-
disabled={disabled}
|
|
166
|
-
aria-invalid={ariaInvalid}
|
|
167
|
-
onChange={handleChange}
|
|
168
|
-
className="grow bg-transparent outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed"
|
|
169
|
-
{...props}
|
|
170
|
-
/>
|
|
171
|
-
{showClearBtn ? (
|
|
172
|
-
<button
|
|
173
|
-
type="button"
|
|
174
|
-
onClick={handleClear}
|
|
175
|
-
aria-label="Clear"
|
|
176
|
-
className="shrink-0 cursor-pointer rounded-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
|
177
|
-
>
|
|
178
|
-
<X className="size-4" />
|
|
179
|
-
</button>
|
|
180
|
-
) : null}
|
|
181
|
-
</div>
|
|
182
|
-
) : (
|
|
183
|
-
<input
|
|
184
|
-
ref={innerRef}
|
|
185
|
-
type={type}
|
|
186
|
-
value={isControlled ? value : undefined}
|
|
187
|
-
defaultValue={!isControlled ? defaultValue : undefined}
|
|
188
|
-
maxLength={maxLength}
|
|
189
|
-
disabled={disabled}
|
|
190
|
-
aria-invalid={ariaInvalid}
|
|
191
|
-
onChange={handleChange}
|
|
192
|
-
className={cn(inputVariants({ size }), className)}
|
|
193
|
-
{...props}
|
|
194
|
-
/>
|
|
195
|
-
);
|
|
196
|
-
|
|
197
|
-
if (showCount && maxLength) {
|
|
198
|
-
return (
|
|
199
|
-
<div className="flex flex-col gap-1">
|
|
200
|
-
{innerInput}
|
|
201
|
-
<div className="text-right text-xs text-muted-foreground tabular-nums">
|
|
202
|
-
{current?.length ?? 0} / {maxLength}
|
|
203
|
-
</div>
|
|
204
|
-
</div>
|
|
205
|
-
);
|
|
206
|
-
}
|
|
207
|
-
return innerInput;
|
|
208
|
-
},
|
|
209
|
-
);
|
|
210
|
-
Input.displayName = 'Input';
|
|
211
|
-
|
|
212
|
-
export { Input, inputVariants };
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: input-group
|
|
3
|
-
name: InputGroup
|
|
4
|
-
type: component
|
|
5
|
-
category: data-entry
|
|
6
|
-
since: 0.2.0
|
|
7
|
-
package: '@teamix-evo/ui'
|
|
8
|
-
displayName: 输入框组
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# InputGroup 输入框组
|
|
12
|
-
|
|
13
|
-
输入框 + addon 统一容器 — **shadcn 2025-10 新增**。等价 antd `Input` 的 `prefix` / `suffix` / `addonBefore` / `addonAfter` 集合,**单独一个 entry**,与 [`Input`](../input/input.meta.md) 拆开管理(对齐 shadcn 2025-10 拆分粒度)。
|
|
14
|
-
|
|
15
|
-
复合插槽:`<InputGroupAddon position variant>` + `<InputGroupInput>` / `<InputGroupTextarea>`,自由嵌套图标 / 按钮 / 文本(URL / 金额 / 搜索 / Send 等形态)。容器外壳承担 border + ring + focus-within,内部全部去边框 — 与 Input / Button / Select 同档高度(32px)。
|
|
16
|
-
|
|
17
|
-
## When to use
|
|
18
|
-
|
|
19
|
-
- 输入框需要**前 / 后缀**(`https://` `.com`、`¥`、`/ 月`)
|
|
20
|
-
- 输入框 + 操作按钮(搜索、清空、复制、Send)
|
|
21
|
-
- 输入框 + 图标(搜索、loading spinner、状态指示)
|
|
22
|
-
- Textarea + 上传 / 录音 / 发送类辅助按钮
|
|
23
|
-
|
|
24
|
-
## When NOT to use
|
|
25
|
-
|
|
26
|
-
- 仅"一键清空" → `Input` 自带 `clearable`,无需 InputGroup 包裹
|
|
27
|
-
- 字符计数 → `Input` 自带 `showCount` + `maxLength`
|
|
28
|
-
- @提及输入 → `Mentions`
|
|
29
|
-
- 多个**独立**输入框横排(姓 / 名 / 中间名)→ 用 `Flex` 直接 gap 排列,不要套 InputGroup(InputGroup 的"统一外壳"语义不适用)
|
|
30
|
-
|
|
31
|
-
## Props
|
|
32
|
-
|
|
33
|
-
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成。
|
|
34
|
-
|
|
35
|
-
<!-- auto:props:begin -->
|
|
36
|
-
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
37
|
-
| --- | --- | --- | --- | --- |
|
|
38
|
-
| `disabled` | `boolean` | – | – | 整组禁用样式(子项请单独传 `disabled`,这里仅影响视觉上的 opacity)。 |
|
|
39
|
-
<!-- auto:props:end -->
|
|
40
|
-
|
|
41
|
-
## 依赖
|
|
42
|
-
|
|
43
|
-
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成,数据源是 [`manifest.json`](../../../manifest.json)。**手工编辑 marker 之间的内容会在下次生成时被覆盖**。
|
|
44
|
-
|
|
45
|
-
<!-- auto:deps:begin -->
|
|
46
|
-
### 同库依赖
|
|
47
|
-
|
|
48
|
-
> `teamix-evo ui add input-group` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
49
|
-
|
|
50
|
-
| Entry | 类型 | 描述 |
|
|
51
|
-
| --- | --- | --- |
|
|
52
|
-
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
53
|
-
|
|
54
|
-
### npm 依赖
|
|
55
|
-
|
|
56
|
-
_无 — 本组件不依赖任何 npm 包。_
|
|
57
|
-
<!-- auto:deps:end -->
|
|
58
|
-
|
|
59
|
-
## AI 生成纪律
|
|
60
|
-
|
|
61
|
-
- **顺序按 JSX 写**:`<InputGroup>` 内的子节点顺序就是渲染顺序 —— `<InputGroupAddon position="before" />` 必须在主体前
|
|
62
|
-
- **不要在 `InputGroupAddon` 里再放 Input** —— addon 是辅助槽,主输入必须用 `InputGroupInput` / `InputGroupTextarea`
|
|
63
|
-
- **`variant="icon"`** 给图标用(无背景、紧凑);**`variant="text"`** 给纯文本前后缀(muted 背景);**`variant="button"`** 给嵌入 Button(去内边距 + 去圆角,避免双重边线)
|
|
64
|
-
- **嵌入 `Button`**:用 `<InputGroupAddon variant="button">` 包,Button 自身 `variant="ghost"` 或 `size="icon"` 效果最自然
|
|
65
|
-
- **不要套两层** —— `<InputGroup>` 内不要再嵌 `<Input>`(主输入用 `<InputGroupInput>`,因为 Input 自带 border 会与外壳冲突 1px 几何)
|
|
66
|
-
- **error 态走子项 `aria-invalid`** —— InputGroup 不直接支持 `error` prop,把 `aria-invalid` 写在 `InputGroupInput` 上即可触发外壳的 destructive 边框
|
|
67
|
-
- **不要硬编码颜色** —— `bg-background` / `border-input` / `bg-muted` 都是 design token
|
|
68
|
-
|
|
69
|
-
## Examples
|
|
70
|
-
|
|
71
|
-
```tsx
|
|
72
|
-
import {
|
|
73
|
-
InputGroup,
|
|
74
|
-
InputGroupAddon,
|
|
75
|
-
InputGroupInput,
|
|
76
|
-
InputGroupTextarea,
|
|
77
|
-
} from '@/components/ui/input-group';
|
|
78
|
-
import { Button } from '@/components/ui/button';
|
|
79
|
-
import { Search, Send } from 'lucide-react';
|
|
80
|
-
|
|
81
|
-
// 搜索图标 + 输入(替代旧 <Input prefix={<Search />} />)
|
|
82
|
-
<InputGroup>
|
|
83
|
-
<InputGroupAddon position="before" variant="icon">
|
|
84
|
-
<Search className="size-4" />
|
|
85
|
-
</InputGroupAddon>
|
|
86
|
-
<InputGroupInput placeholder="搜索文档..." />
|
|
87
|
-
</InputGroup>
|
|
88
|
-
|
|
89
|
-
// URL 输入(替代旧 <Input addonBefore="https://" addonAfter=".com" />)
|
|
90
|
-
<InputGroup>
|
|
91
|
-
<InputGroupAddon position="before">https://</InputGroupAddon>
|
|
92
|
-
<InputGroupInput defaultValue="example" />
|
|
93
|
-
<InputGroupAddon position="after">.com</InputGroupAddon>
|
|
94
|
-
</InputGroup>
|
|
95
|
-
|
|
96
|
-
// 金额输入
|
|
97
|
-
<InputGroup>
|
|
98
|
-
<InputGroupAddon position="before">¥</InputGroupAddon>
|
|
99
|
-
<InputGroupInput type="number" defaultValue={199} />
|
|
100
|
-
<InputGroupAddon position="after">/ 月</InputGroupAddon>
|
|
101
|
-
</InputGroup>
|
|
102
|
-
|
|
103
|
-
// Textarea + 发送按钮
|
|
104
|
-
<InputGroup className="items-end">
|
|
105
|
-
<InputGroupTextarea rows={3} placeholder="发表评论..." />
|
|
106
|
-
<InputGroupAddon position="after" variant="button">
|
|
107
|
-
<Button size="icon" icon={<Send />} aria-label="发送" />
|
|
108
|
-
</InputGroupAddon>
|
|
109
|
-
</InputGroup>
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
## Migration · 从旧 `Input` 快捷 prop 迁移
|
|
113
|
-
|
|
114
|
-
> v0.2 起 `<Input>` 的 `prefix` / `suffix` / `addonBefore` / `addonAfter` 已**移除**。请改用 InputGroup 复合 API(更灵活、可嵌任意子节点)。
|
|
115
|
-
|
|
116
|
-
| 旧用法(已移除) | 新用法 |
|
|
117
|
-
| ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
118
|
-
| `<Input prefix={<Search />} />` | `<InputGroup><InputGroupAddon position="before" variant="icon"><Search /></InputGroupAddon><InputGroupInput /></InputGroup>` |
|
|
119
|
-
| `<Input suffix={<Mail />} />` | `<InputGroup><InputGroupInput /><InputGroupAddon position="after" variant="icon"><Mail /></InputGroupAddon></InputGroup>` |
|
|
120
|
-
| `<Input addonBefore="https://" />` | `<InputGroup><InputGroupAddon position="before">https://</InputGroupAddon><InputGroupInput /></InputGroup>` |
|
|
121
|
-
| `<Input addonAfter=".com" />` | `<InputGroup><InputGroupInput /><InputGroupAddon position="after">.com</InputGroupAddon></InputGroup>` |
|
|
122
|
-
| `<Input prefix="¥" suffix="USD" />` | `<InputGroup><InputGroupAddon position="before">¥</InputGroupAddon><InputGroupInput /><InputGroupAddon position="after">USD</InputGroupAddon></InputGroup>` |
|
|
123
|
-
|
|
124
|
-
> 保留在 Input 的快捷能力:`clearable`(逻辑) / `showCount`(下方计数)/ `size` / `error` —— 这些与"前后缀"语义无关,继续作为 Input 的内建逻辑能力。
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
|
-
import { Search, Send, X } from 'lucide-react';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
InputGroup,
|
|
7
|
-
InputGroupAddon,
|
|
8
|
-
InputGroupInput,
|
|
9
|
-
InputGroupTextarea,
|
|
10
|
-
} from './input-group';
|
|
11
|
-
import { Button } from '@/components/button/button';
|
|
12
|
-
|
|
13
|
-
const meta: Meta<typeof InputGroup> = {
|
|
14
|
-
title: '数据录入 · Data Entry/InputGroup',
|
|
15
|
-
component: InputGroup,
|
|
16
|
-
tags: ['autodocs'],
|
|
17
|
-
parameters: {
|
|
18
|
-
docs: {
|
|
19
|
-
description: {
|
|
20
|
-
component:
|
|
21
|
-
'InputGroup 输入框组 —— 等价 antd `Input` 的 `prefix` / `suffix` / `addonBefore` / `addonAfter` 集合,**完整覆盖前后缀图标 / 文本 / 按钮所有形态**。复合插槽:`<InputGroupAddon position variant>` + `<InputGroupInput>` / `<InputGroupTextarea>`,自由嵌套图标、文本、按钮(URL / 金额 / 搜索 / Send 等)。`shadcn 2025-10` 新增,与 Input / Button / Select 同档高度(32px)。视觉走 OpenTrek semantic tokens,所有样式来自 `@teamix-evo/tokens`,无 mock。',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
decorators: [
|
|
26
|
-
(Story) => (
|
|
27
|
-
<div className="w-96">
|
|
28
|
-
<Story />
|
|
29
|
-
</div>
|
|
30
|
-
),
|
|
31
|
-
],
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export default meta;
|
|
35
|
-
type Story = StoryObj<typeof InputGroup>;
|
|
36
|
-
|
|
37
|
-
/** 基础 —— 前置图标 + 单行输入(替代旧 `<Input prefix={<Search />} />`)。 */
|
|
38
|
-
export const Basic: Story = {
|
|
39
|
-
parameters: { controls: { disable: true } },
|
|
40
|
-
render: () => (
|
|
41
|
-
<InputGroup>
|
|
42
|
-
<InputGroupAddon position="before" variant="icon">
|
|
43
|
-
<Search className="size-4" />
|
|
44
|
-
</InputGroupAddon>
|
|
45
|
-
<InputGroupInput placeholder="搜索文档..." />
|
|
46
|
-
</InputGroup>
|
|
47
|
-
),
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
/** URL 输入 —— text 前后缀(替代旧 `<Input addonBefore="https://" addonAfter=".com" />`)。 */
|
|
51
|
-
export const Url: Story = {
|
|
52
|
-
parameters: { controls: { disable: true } },
|
|
53
|
-
render: () => (
|
|
54
|
-
<InputGroup>
|
|
55
|
-
<InputGroupAddon position="before">https://</InputGroupAddon>
|
|
56
|
-
<InputGroupInput defaultValue="example" />
|
|
57
|
-
<InputGroupAddon position="after">.com</InputGroupAddon>
|
|
58
|
-
</InputGroup>
|
|
59
|
-
),
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
/** 金额输入 —— text 前后缀。 */
|
|
63
|
-
export const Currency: Story = {
|
|
64
|
-
parameters: { controls: { disable: true } },
|
|
65
|
-
render: () => (
|
|
66
|
-
<InputGroup>
|
|
67
|
-
<InputGroupAddon position="before">¥</InputGroupAddon>
|
|
68
|
-
<InputGroupInput type="number" defaultValue={199} />
|
|
69
|
-
<InputGroupAddon position="after">/ 月</InputGroupAddon>
|
|
70
|
-
</InputGroup>
|
|
71
|
-
),
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
/** 可清空搜索 —— icon 前后缀,后缀槽放可点击的清空按钮。 */
|
|
75
|
-
export const SearchWithClear: Story = {
|
|
76
|
-
parameters: { controls: { disable: true } },
|
|
77
|
-
render: () => (
|
|
78
|
-
<InputGroup>
|
|
79
|
-
<InputGroupAddon position="before" variant="icon">
|
|
80
|
-
<Search className="size-4" />
|
|
81
|
-
</InputGroupAddon>
|
|
82
|
-
<InputGroupInput
|
|
83
|
-
defaultValue="OpenTrek 设计令牌"
|
|
84
|
-
placeholder="输入关键词..."
|
|
85
|
-
/>
|
|
86
|
-
<InputGroupAddon position="after" variant="icon">
|
|
87
|
-
<button
|
|
88
|
-
type="button"
|
|
89
|
-
aria-label="清空"
|
|
90
|
-
className="rounded-sm p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground"
|
|
91
|
-
>
|
|
92
|
-
<X className="size-4" />
|
|
93
|
-
</button>
|
|
94
|
-
</InputGroupAddon>
|
|
95
|
-
</InputGroup>
|
|
96
|
-
),
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
/** Textarea + Send 按钮 —— `variant="button"` 把 Button 的边框 / 圆角去掉,与外壳合一。 */
|
|
100
|
-
export const TextareaWithSend: Story = {
|
|
101
|
-
parameters: { controls: { disable: true } },
|
|
102
|
-
render: () => (
|
|
103
|
-
<InputGroup className="items-end">
|
|
104
|
-
<InputGroupTextarea rows={3} placeholder="发表评论..." />
|
|
105
|
-
<InputGroupAddon position="after" variant="button">
|
|
106
|
-
<Button size="icon" icon={<Send />} aria-label="发送" />
|
|
107
|
-
</InputGroupAddon>
|
|
108
|
-
</InputGroup>
|
|
109
|
-
),
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
/** 整组禁用 —— `disabled` 仅控制视觉 opacity,子项 disabled 仍需自行传。 */
|
|
113
|
-
export const Disabled: Story = {
|
|
114
|
-
parameters: { controls: { disable: true } },
|
|
115
|
-
render: () => (
|
|
116
|
-
<InputGroup disabled>
|
|
117
|
-
<InputGroupAddon position="before">@</InputGroupAddon>
|
|
118
|
-
<InputGroupInput defaultValue="alice" disabled />
|
|
119
|
-
</InputGroup>
|
|
120
|
-
),
|
|
121
|
-
};
|