@teamix-evo/ui 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -50
- package/manifest.json +406 -653
- package/package.json +15 -34
- package/src/_design-system/theme-tokens/stories.tsx +1474 -0
- package/src/components/accordion/index.tsx +139 -0
- package/src/components/accordion/meta.md +162 -0
- package/src/components/accordion/stories.tsx +145 -0
- package/src/components/affix/index.tsx +149 -0
- package/src/components/affix/meta.md +23 -0
- package/src/components/affix/stories.tsx +70 -0
- package/src/components/alert/index.tsx +220 -0
- package/src/components/alert/meta.md +133 -0
- package/src/components/alert/stories.tsx +126 -0
- package/src/components/alert-dialog/index.tsx +282 -0
- package/src/components/alert-dialog/meta.md +86 -0
- package/src/components/alert-dialog/stories.tsx +163 -0
- package/src/components/avatar/index.tsx +159 -0
- package/src/components/avatar/meta.md +242 -0
- package/src/components/avatar/stories.tsx +241 -0
- package/src/components/badge/index.tsx +299 -0
- package/src/components/badge/meta.md +237 -0
- package/src/components/badge/stories.tsx +275 -0
- package/src/components/breadcrumb/index.tsx +137 -0
- package/src/components/breadcrumb/meta.md +64 -0
- package/src/components/breadcrumb/stories.tsx +86 -0
- package/src/components/button/index.tsx +202 -0
- package/src/components/button/meta.md +209 -0
- package/src/components/button/stories.tsx +215 -0
- package/src/components/button-group/index.tsx +211 -0
- package/src/components/button-group/meta.md +190 -0
- package/src/components/button-group/stories.tsx +182 -0
- package/src/components/calendar/index.tsx +240 -0
- package/src/components/calendar/meta.md +36 -0
- package/src/components/calendar/stories.tsx +36 -0
- package/src/components/card/index.tsx +262 -0
- package/src/components/card/meta.md +194 -0
- package/src/components/card/stories.tsx +202 -0
- package/src/components/carousel/index.tsx +481 -0
- package/src/components/carousel/meta.md +208 -0
- package/src/components/carousel/stories.tsx +271 -0
- package/src/components/cascader-select/index.tsx +308 -0
- package/src/components/cascader-select/meta.md +28 -0
- package/src/components/cascader-select/stories.tsx +118 -0
- package/src/components/checkbox/index.tsx +208 -0
- package/src/components/checkbox/meta.md +166 -0
- package/src/components/checkbox/stories.tsx +206 -0
- package/src/components/collapsible/index.tsx +72 -0
- package/src/components/collapsible/meta.md +87 -0
- package/src/components/collapsible/stories.tsx +97 -0
- package/src/components/color-picker/index.tsx +677 -0
- package/src/components/color-picker/meta.md +83 -0
- package/src/components/color-picker/stories.tsx +172 -0
- package/src/components/combobox/index.tsx +687 -0
- package/src/components/combobox/meta.md +83 -0
- package/src/components/combobox/stories.tsx +179 -0
- package/src/components/command/index.tsx +238 -0
- package/src/components/command/meta.md +48 -0
- package/src/components/command/stories.tsx +83 -0
- package/src/components/data-table/index.tsx +1537 -0
- package/src/components/data-table/meta.md +107 -0
- package/src/components/data-table/stories.tsx +1234 -0
- package/src/components/date-picker/index.tsx +1492 -0
- package/src/components/date-picker/meta.md +103 -0
- package/src/components/date-picker/stories.tsx +125 -0
- package/src/components/descriptions/index.tsx +535 -0
- package/src/components/descriptions/meta.md +104 -0
- package/src/components/descriptions/stories.tsx +389 -0
- package/src/components/dialog/index.tsx +255 -0
- package/src/components/dialog/meta.md +244 -0
- package/src/components/dialog/stories.tsx +330 -0
- package/src/components/dropdown-menu/index.tsx +301 -0
- package/src/components/dropdown-menu/meta.md +93 -0
- package/src/components/dropdown-menu/stories.tsx +124 -0
- package/src/components/empty/index.tsx +431 -0
- package/src/components/empty/meta.md +274 -0
- package/src/components/empty/stories.tsx +278 -0
- package/src/components/field/index.tsx +374 -0
- package/src/components/field/meta.md +283 -0
- package/src/components/field/stories.tsx +327 -0
- package/src/components/filter-bar/index.tsx +976 -0
- package/src/components/filter-bar/meta.md +57 -0
- package/src/components/filter-bar/stories.tsx +496 -0
- package/src/components/float-button/index.tsx +163 -0
- package/src/components/float-button/meta.md +73 -0
- package/src/components/float-button/stories.tsx +68 -0
- package/src/components/form/index.tsx +218 -0
- package/src/components/form/meta.md +16 -0
- package/src/components/form/stories.tsx +301 -0
- package/src/components/hover-card/index.tsx +103 -0
- package/src/components/hover-card/meta.md +71 -0
- package/src/components/hover-card/stories.tsx +107 -0
- package/src/components/icon/index.tsx +225 -0
- package/src/components/icon/meta.md +102 -0
- package/src/components/icon/stories.tsx +127 -0
- package/src/components/image/index.tsx +147 -0
- package/src/components/image/meta.md +55 -0
- package/src/components/image/stories.tsx +48 -0
- package/src/components/input/index.tsx +63 -0
- package/src/components/input/meta.md +57 -0
- package/src/components/input/stories.tsx +66 -0
- package/src/components/input-group/index.tsx +292 -0
- package/src/components/input-group/meta.md +108 -0
- package/src/components/input-group/stories.tsx +258 -0
- package/src/components/input-ip/index.tsx +288 -0
- package/src/components/input-ip/meta.md +48 -0
- package/src/components/input-ip/stories.tsx +69 -0
- package/src/components/input-number/index.tsx +360 -0
- package/src/components/input-number/meta.md +156 -0
- package/src/components/input-number/stories.tsx +187 -0
- package/src/components/item/index.tsx +368 -0
- package/src/components/item/meta.md +395 -0
- package/src/components/item/stories.tsx +432 -0
- package/src/components/label/index.tsx +44 -0
- package/src/components/label/meta.md +68 -0
- package/src/components/label/stories.tsx +64 -0
- package/src/components/mentions/index.tsx +369 -0
- package/src/components/mentions/meta.md +118 -0
- package/src/components/mentions/stories.tsx +153 -0
- package/src/components/menubar/index.tsx +313 -0
- package/src/components/menubar/meta.md +52 -0
- package/src/components/menubar/stories.tsx +99 -0
- package/src/components/navigation-menu/index.tsx +216 -0
- package/src/components/navigation-menu/meta.md +66 -0
- package/src/components/navigation-menu/stories.tsx +137 -0
- package/src/components/page-header/index.tsx +218 -0
- package/src/components/page-header/meta.md +211 -0
- package/src/components/page-header/stories.tsx +290 -0
- package/src/components/page-shell/index.tsx +119 -0
- package/src/components/page-shell/meta.md +115 -0
- package/src/components/page-shell/stories.tsx +154 -0
- package/src/components/pagination/index.tsx +580 -0
- package/src/components/pagination/meta.md +39 -0
- package/src/components/pagination/stories.tsx +319 -0
- package/src/components/popconfirm/index.tsx +477 -0
- package/src/components/popconfirm/meta.md +164 -0
- package/src/components/popconfirm/stories.tsx +231 -0
- package/src/components/popover/index.tsx +181 -0
- package/src/components/popover/meta.md +97 -0
- package/src/components/popover/stories.tsx +169 -0
- package/src/components/progress/index.tsx +176 -0
- package/src/components/progress/meta.md +95 -0
- package/src/components/progress/stories.tsx +115 -0
- package/src/components/radio-group/index.tsx +78 -0
- package/src/components/radio-group/meta.md +137 -0
- package/src/components/radio-group/stories.tsx +285 -0
- package/src/components/rate/index.tsx +284 -0
- package/src/components/rate/meta.md +63 -0
- package/src/components/rate/stories.tsx +107 -0
- package/src/components/resizable/index.tsx +122 -0
- package/src/components/resizable/meta.md +142 -0
- package/src/components/resizable/stories.tsx +105 -0
- package/src/components/scroll-area/index.tsx +83 -0
- package/src/components/scroll-area/meta.md +85 -0
- package/src/components/scroll-area/stories.tsx +82 -0
- package/src/components/select/index.tsx +325 -0
- package/src/components/select/meta.md +183 -0
- package/src/components/select/stories.tsx +210 -0
- package/src/components/separator/index.tsx +51 -0
- package/src/components/separator/meta.md +68 -0
- package/src/components/separator/stories.tsx +53 -0
- package/src/components/sheet/index.tsx +293 -0
- package/src/components/sheet/meta.md +226 -0
- package/src/components/sheet/stories.tsx +405 -0
- package/src/components/sidebar/index.tsx +715 -0
- package/src/components/sidebar/meta.md +14 -0
- package/src/components/sidebar/{sidebar.stories.tsx → stories.tsx} +250 -330
- package/src/components/skeleton/index.tsx +415 -0
- package/src/components/skeleton/meta.md +210 -0
- package/src/components/skeleton/stories.tsx +197 -0
- package/src/components/slider/index.tsx +222 -0
- package/src/components/slider/meta.md +125 -0
- package/src/components/slider/stories.tsx +109 -0
- package/src/components/sonner/index.tsx +149 -0
- package/src/components/sonner/meta.md +156 -0
- package/src/components/sonner/stories.tsx +285 -0
- package/src/components/spinner/index.tsx +335 -0
- package/src/components/spinner/meta.md +172 -0
- package/src/components/spinner/stories.tsx +197 -0
- package/src/components/statistic/{statistic.tsx → index.tsx} +25 -26
- package/src/components/statistic/meta.md +94 -0
- package/src/components/statistic/stories.tsx +85 -0
- package/src/components/steps/index.tsx +500 -0
- package/src/components/steps/meta.md +245 -0
- package/src/components/steps/stories.tsx +287 -0
- package/src/components/switch/index.tsx +175 -0
- package/src/components/switch/meta.md +107 -0
- package/src/components/switch/stories.tsx +154 -0
- package/src/components/table/index.tsx +350 -0
- package/src/components/table/meta.md +148 -0
- package/src/components/table/stories.tsx +189 -0
- package/src/components/tabs/index.tsx +379 -0
- package/src/components/tabs/meta.md +244 -0
- package/src/components/tabs/stories.tsx +312 -0
- package/src/components/tag/index.tsx +774 -0
- package/src/components/tag/meta.md +256 -0
- package/src/components/tag/stories.tsx +431 -0
- package/src/components/textarea/index.tsx +62 -0
- package/src/components/textarea/meta.md +77 -0
- package/src/components/textarea/stories.tsx +112 -0
- package/src/components/time-picker/index.tsx +887 -0
- package/src/components/time-picker/meta.md +102 -0
- package/src/components/time-picker/stories.tsx +125 -0
- package/src/components/timeline/index.tsx +422 -0
- package/src/components/timeline/meta.md +352 -0
- package/src/components/timeline/stories.tsx +369 -0
- package/src/components/toggle/index.tsx +74 -0
- package/src/components/toggle/meta.md +76 -0
- package/src/components/toggle/stories.tsx +66 -0
- package/src/components/toggle-group/index.tsx +167 -0
- package/src/components/toggle-group/meta.md +141 -0
- package/src/components/toggle-group/stories.tsx +124 -0
- package/src/components/tooltip/index.tsx +144 -0
- package/src/components/tooltip/meta.md +186 -0
- package/src/components/tooltip/stories.tsx +212 -0
- package/src/components/transfer/index.tsx +639 -0
- package/src/components/transfer/meta.md +76 -0
- package/src/components/transfer/stories.tsx +221 -0
- package/src/components/tree/index.tsx +764 -0
- package/src/components/tree/meta.md +96 -0
- package/src/components/tree/stories.tsx +385 -0
- package/src/components/tree/utils.ts +269 -0
- package/src/components/tree-select/index.tsx +400 -0
- package/src/components/tree-select/meta.md +78 -0
- package/src/components/tree-select/stories.tsx +234 -0
- package/src/components/typography/index.tsx +290 -0
- package/src/components/typography/meta.md +151 -0
- package/src/components/typography/stories.tsx +151 -0
- package/src/components/upload/index.tsx +858 -0
- package/src/components/upload/meta.md +122 -0
- package/src/components/upload/stories.tsx +261 -0
- package/src/components/watermark/index.tsx +152 -0
- package/src/components/watermark/meta.md +67 -0
- package/src/components/watermark/stories.tsx +59 -0
- package/src/hooks/use-mobile.ts +9 -11
- package/src/lib/color.ts +243 -0
- package/src/{utils/cn.ts → lib/utils.ts} +1 -1
- package/src/components/accordion/accordion.meta.md +0 -88
- package/src/components/accordion/accordion.stories.tsx +0 -72
- package/src/components/accordion/accordion.tsx +0 -154
- package/src/components/affix/affix.meta.md +0 -98
- package/src/components/affix/affix.stories.tsx +0 -134
- package/src/components/affix/affix.tsx +0 -167
- package/src/components/alert/alert.meta.md +0 -132
- package/src/components/alert/alert.stories.tsx +0 -138
- package/src/components/alert/alert.tsx +0 -179
- package/src/components/alert-dialog/alert-dialog.meta.md +0 -152
- package/src/components/alert-dialog/alert-dialog.stories.tsx +0 -223
- package/src/components/alert-dialog/alert-dialog.tsx +0 -183
- package/src/components/anchor/anchor.meta.md +0 -92
- package/src/components/anchor/anchor.stories.tsx +0 -74
- package/src/components/anchor/anchor.tsx +0 -130
- package/src/components/app/app.meta.md +0 -91
- package/src/components/app/app.stories.tsx +0 -64
- package/src/components/app/app.tsx +0 -58
- package/src/components/aspect-ratio/aspect-ratio.meta.md +0 -82
- package/src/components/aspect-ratio/aspect-ratio.stories.tsx +0 -59
- package/src/components/aspect-ratio/aspect-ratio.tsx +0 -22
- package/src/components/auto-complete/auto-complete.meta.md +0 -110
- package/src/components/auto-complete/auto-complete.stories.tsx +0 -136
- package/src/components/auto-complete/auto-complete.tsx +0 -253
- package/src/components/avatar/avatar.meta.md +0 -93
- package/src/components/avatar/avatar.stories.tsx +0 -98
- package/src/components/avatar/avatar.tsx +0 -127
- package/src/components/badge/badge.meta.md +0 -120
- package/src/components/badge/badge.stories.tsx +0 -153
- package/src/components/badge/badge.tsx +0 -204
- package/src/components/breadcrumb/breadcrumb.meta.md +0 -127
- package/src/components/breadcrumb/breadcrumb.stories.tsx +0 -207
- package/src/components/breadcrumb/breadcrumb.tsx +0 -136
- package/src/components/button/button.meta.md +0 -335
- package/src/components/button/button.stories.tsx +0 -743
- package/src/components/button/button.tsx +0 -466
- package/src/components/calendar/calendar.meta.md +0 -128
- package/src/components/calendar/calendar.stories.tsx +0 -68
- package/src/components/calendar/calendar.tsx +0 -172
- package/src/components/card/card.meta.md +0 -139
- package/src/components/card/card.stories.tsx +0 -151
- package/src/components/card/card.tsx +0 -306
- package/src/components/carousel/carousel.meta.md +0 -118
- package/src/components/carousel/carousel.stories.tsx +0 -89
- package/src/components/carousel/carousel.tsx +0 -224
- package/src/components/cascader/cascader.meta.md +0 -140
- package/src/components/cascader/cascader.stories.tsx +0 -120
- package/src/components/cascader/cascader.tsx +0 -548
- package/src/components/checkbox/checkbox.meta.md +0 -167
- package/src/components/checkbox/checkbox.stories.tsx +0 -288
- package/src/components/checkbox/checkbox.tsx +0 -195
- package/src/components/collapsible/collapsible.meta.md +0 -88
- package/src/components/collapsible/collapsible.stories.tsx +0 -43
- package/src/components/collapsible/collapsible.tsx +0 -105
- package/src/components/color-picker/color-picker.meta.md +0 -89
- package/src/components/color-picker/color-picker.stories.tsx +0 -159
- package/src/components/color-picker/color-picker.tsx +0 -171
- package/src/components/command/command.meta.md +0 -120
- package/src/components/command/command.stories.tsx +0 -59
- package/src/components/command/command.tsx +0 -158
- package/src/components/context-menu/context-menu.meta.md +0 -93
- package/src/components/context-menu/context-menu.stories.tsx +0 -54
- package/src/components/context-menu/context-menu.tsx +0 -204
- package/src/components/data-table/data-table.meta.md +0 -150
- package/src/components/data-table/data-table.stories.tsx +0 -132
- package/src/components/data-table/data-table.tsx +0 -185
- package/src/components/date-picker/date-picker.meta.md +0 -175
- package/src/components/date-picker/date-picker.stories.tsx +0 -108
- package/src/components/date-picker/date-picker.tsx +0 -1554
- package/src/components/descriptions/descriptions.meta.md +0 -83
- package/src/components/descriptions/descriptions.stories.tsx +0 -60
- package/src/components/descriptions/descriptions.tsx +0 -137
- package/src/components/dialog/dialog.meta.md +0 -168
- package/src/components/dialog/dialog.stories.tsx +0 -255
- package/src/components/dialog/dialog.tsx +0 -180
- package/src/components/dialog/imperative.tsx +0 -252
- package/src/components/drawer/drawer.meta.md +0 -95
- package/src/components/drawer/drawer.stories.tsx +0 -71
- package/src/components/drawer/drawer.tsx +0 -23
- package/src/components/dropdown-menu/dropdown-menu.meta.md +0 -171
- package/src/components/dropdown-menu/dropdown-menu.stories.tsx +0 -198
- package/src/components/dropdown-menu/dropdown-menu.tsx +0 -209
- package/src/components/ellipsis/ellipsis.meta.md +0 -87
- package/src/components/ellipsis/ellipsis.stories.tsx +0 -72
- package/src/components/ellipsis/ellipsis.tsx +0 -153
- package/src/components/empty/empty.meta.md +0 -86
- package/src/components/empty/empty.stories.tsx +0 -46
- package/src/components/empty/empty.tsx +0 -54
- package/src/components/field/field.meta.md +0 -154
- package/src/components/field/field.stories.tsx +0 -497
- package/src/components/field/field.tsx +0 -392
- package/src/components/filter-bar/filter-bar.meta.md +0 -92
- package/src/components/filter-bar/filter-bar.stories.tsx +0 -1086
- package/src/components/filter-bar/filter-bar.tsx +0 -568
- package/src/components/flex/flex.meta.md +0 -142
- package/src/components/flex/flex.stories.tsx +0 -199
- package/src/components/flex/flex.tsx +0 -145
- package/src/components/float-button/float-button.meta.md +0 -92
- package/src/components/float-button/float-button.stories.tsx +0 -80
- package/src/components/float-button/float-button.tsx +0 -143
- package/src/components/form/form.meta.md +0 -153
- package/src/components/form/form.stories.tsx +0 -472
- package/src/components/form/form.tsx +0 -260
- package/src/components/grid/grid.meta.md +0 -92
- package/src/components/grid/grid.stories.tsx +0 -101
- package/src/components/grid/grid.tsx +0 -130
- package/src/components/hover-card/hover-card.meta.md +0 -103
- package/src/components/hover-card/hover-card.stories.tsx +0 -97
- package/src/components/hover-card/hover-card.tsx +0 -67
- package/src/components/icon/DEVELOPMENT.md +0 -809
- package/src/components/icon/icon.meta.md +0 -170
- package/src/components/icon/icon.stories.tsx +0 -344
- package/src/components/icon/icon.tsx +0 -248
- package/src/components/image/image.meta.md +0 -99
- package/src/components/image/image.stories.tsx +0 -55
- package/src/components/image/image.tsx +0 -140
- package/src/components/input/input.meta.md +0 -115
- package/src/components/input/input.stories.tsx +0 -144
- package/src/components/input/input.tsx +0 -212
- package/src/components/input-group/input-group.meta.md +0 -124
- package/src/components/input-group/input-group.stories.tsx +0 -121
- package/src/components/input-group/input-group.tsx +0 -143
- package/src/components/input-number/input-number.meta.md +0 -148
- package/src/components/input-number/input-number.stories.tsx +0 -125
- package/src/components/input-number/input-number.tsx +0 -283
- package/src/components/input-otp/input-otp.meta.md +0 -106
- package/src/components/input-otp/input-otp.stories.tsx +0 -65
- package/src/components/input-otp/input-otp.tsx +0 -97
- package/src/components/item/item.meta.md +0 -121
- package/src/components/item/item.stories.tsx +0 -116
- package/src/components/item/item.tsx +0 -172
- package/src/components/kbd/kbd.meta.md +0 -94
- package/src/components/kbd/kbd.stories.tsx +0 -70
- package/src/components/kbd/kbd.tsx +0 -86
- package/src/components/label/label.meta.md +0 -99
- package/src/components/label/label.stories.tsx +0 -145
- package/src/components/label/label.tsx +0 -138
- package/src/components/masonry/masonry.meta.md +0 -90
- package/src/components/masonry/masonry.stories.tsx +0 -68
- package/src/components/masonry/masonry.tsx +0 -60
- package/src/components/mentions/mentions.meta.md +0 -119
- package/src/components/mentions/mentions.stories.tsx +0 -189
- package/src/components/mentions/mentions.tsx +0 -243
- package/src/components/menubar/menubar.meta.md +0 -118
- package/src/components/menubar/menubar.stories.tsx +0 -141
- package/src/components/menubar/menubar.tsx +0 -232
- package/src/components/native-select/native-select.meta.md +0 -93
- package/src/components/native-select/native-select.stories.tsx +0 -83
- package/src/components/native-select/native-select.tsx +0 -54
- package/src/components/navigation-menu/navigation-menu.meta.md +0 -118
- package/src/components/navigation-menu/navigation-menu.stories.tsx +0 -215
- package/src/components/navigation-menu/navigation-menu.tsx +0 -129
- package/src/components/notification/notification.meta.md +0 -133
- package/src/components/notification/notification.stories.tsx +0 -98
- package/src/components/notification/notification.tsx +0 -99
- package/src/components/page-header/DEVELOPMENT.md +0 -842
- package/src/components/page-header/page-header.meta.md +0 -210
- package/src/components/page-header/page-header.stories.tsx +0 -428
- package/src/components/page-header/page-header.tsx +0 -284
- package/src/components/page-shell/page-shell.meta.md +0 -116
- package/src/components/page-shell/page-shell.stories.tsx +0 -149
- package/src/components/page-shell/page-shell.tsx +0 -115
- package/src/components/pagination/pagination.meta.md +0 -230
- package/src/components/pagination/pagination.stories.tsx +0 -284
- package/src/components/pagination/pagination.tsx +0 -567
- package/src/components/popconfirm/popconfirm.meta.md +0 -114
- package/src/components/popconfirm/popconfirm.stories.tsx +0 -75
- package/src/components/popconfirm/popconfirm.tsx +0 -134
- package/src/components/popover/popover.meta.md +0 -154
- package/src/components/popover/popover.stories.tsx +0 -158
- package/src/components/popover/popover.tsx +0 -104
- package/src/components/progress/progress.meta.md +0 -118
- package/src/components/progress/progress.stories.tsx +0 -75
- package/src/components/progress/progress.tsx +0 -203
- package/src/components/radio-group/radio-group.meta.md +0 -175
- package/src/components/radio-group/radio-group.stories.tsx +0 -113
- package/src/components/radio-group/radio-group.tsx +0 -209
- package/src/components/rate/rate.meta.md +0 -118
- package/src/components/rate/rate.stories.tsx +0 -89
- package/src/components/rate/rate.tsx +0 -180
- package/src/components/resizable/resizable.meta.md +0 -95
- package/src/components/resizable/resizable.stories.tsx +0 -104
- package/src/components/resizable/resizable.tsx +0 -56
- package/src/components/result/result.meta.md +0 -95
- package/src/components/result/result.stories.tsx +0 -67
- package/src/components/result/result.tsx +0 -100
- package/src/components/scroll-area/scroll-area.meta.md +0 -85
- package/src/components/scroll-area/scroll-area.stories.tsx +0 -49
- package/src/components/scroll-area/scroll-area.tsx +0 -51
- package/src/components/segmented/segmented.meta.md +0 -106
- package/src/components/segmented/segmented.stories.tsx +0 -130
- package/src/components/segmented/segmented.tsx +0 -146
- package/src/components/select/select.meta.md +0 -255
- package/src/components/select/select.stories.tsx +0 -275
- package/src/components/select/select.tsx +0 -735
- package/src/components/separator/separator.meta.md +0 -75
- package/src/components/separator/separator.stories.tsx +0 -71
- package/src/components/separator/separator.tsx +0 -100
- package/src/components/sheet/sheet.meta.md +0 -113
- package/src/components/sheet/sheet.stories.tsx +0 -188
- package/src/components/sheet/sheet.tsx +0 -226
- package/src/components/sidebar/sidebar.meta.md +0 -151
- package/src/components/sidebar/sidebar.tsx +0 -853
- package/src/components/skeleton/skeleton.meta.md +0 -94
- package/src/components/skeleton/skeleton.stories.tsx +0 -79
- package/src/components/skeleton/skeleton.tsx +0 -144
- package/src/components/slider/slider.meta.md +0 -146
- package/src/components/slider/slider.stories.tsx +0 -121
- package/src/components/slider/slider.tsx +0 -227
- package/src/components/sonner/sonner.meta.md +0 -147
- package/src/components/sonner/sonner.stories.tsx +0 -164
- package/src/components/sonner/sonner.tsx +0 -169
- package/src/components/spinner/spinner.meta.md +0 -125
- package/src/components/spinner/spinner.stories.tsx +0 -123
- package/src/components/spinner/spinner.tsx +0 -166
- package/src/components/statistic/statistic.meta.md +0 -104
- package/src/components/statistic/statistic.stories.tsx +0 -67
- package/src/components/steps/steps.meta.md +0 -116
- package/src/components/steps/steps.stories.tsx +0 -115
- package/src/components/steps/steps.tsx +0 -173
- package/src/components/switch/switch.meta.md +0 -138
- package/src/components/switch/switch.stories.tsx +0 -75
- package/src/components/switch/switch.tsx +0 -169
- package/src/components/table/table.meta.md +0 -106
- package/src/components/table/table.stories.tsx +0 -80
- package/src/components/table/table.tsx +0 -124
- package/src/components/tabs/tabs.meta.md +0 -111
- package/src/components/tabs/tabs.stories.tsx +0 -156
- package/src/components/tabs/tabs.tsx +0 -190
- package/src/components/tag/tag.meta.md +0 -159
- package/src/components/tag/tag.stories.tsx +0 -250
- package/src/components/tag/tag.tsx +0 -386
- package/src/components/textarea/textarea.meta.md +0 -99
- package/src/components/textarea/textarea.stories.tsx +0 -89
- package/src/components/textarea/textarea.tsx +0 -137
- package/src/components/time-picker/time-picker.meta.md +0 -175
- package/src/components/time-picker/time-picker.stories.tsx +0 -129
- package/src/components/time-picker/time-picker.tsx +0 -946
- package/src/components/timeline/timeline.meta.md +0 -110
- package/src/components/timeline/timeline.stories.tsx +0 -134
- package/src/components/timeline/timeline.tsx +0 -168
- package/src/components/toggle/toggle.meta.md +0 -89
- package/src/components/toggle/toggle.stories.tsx +0 -66
- package/src/components/toggle/toggle.tsx +0 -54
- package/src/components/toggle-group/toggle-group.meta.md +0 -91
- package/src/components/toggle-group/toggle-group.stories.tsx +0 -83
- package/src/components/toggle-group/toggle-group.tsx +0 -78
- package/src/components/tooltip/tooltip.meta.md +0 -149
- package/src/components/tooltip/tooltip.stories.tsx +0 -108
- package/src/components/tooltip/tooltip.tsx +0 -153
- package/src/components/tour/tour.meta.md +0 -121
- package/src/components/tour/tour.stories.tsx +0 -66
- package/src/components/tour/tour.tsx +0 -242
- package/src/components/transfer/transfer.meta.md +0 -95
- package/src/components/transfer/transfer.stories.tsx +0 -64
- package/src/components/transfer/transfer.tsx +0 -258
- package/src/components/tree/tree.meta.md +0 -169
- package/src/components/tree/tree.stories.tsx +0 -128
- package/src/components/tree/tree.tsx +0 -368
- package/src/components/tree-select/tree-select.meta.md +0 -151
- package/src/components/tree-select/tree-select.stories.tsx +0 -80
- package/src/components/tree-select/tree-select.tsx +0 -206
- package/src/components/typography/typography.meta.md +0 -149
- package/src/components/typography/typography.stories.tsx +0 -116
- package/src/components/typography/typography.tsx +0 -260
- package/src/components/upload/upload.meta.md +0 -156
- package/src/components/upload/upload.stories.tsx +0 -135
- package/src/components/upload/upload.tsx +0 -398
- package/src/components/watermark/watermark.meta.md +0 -100
- package/src/components/watermark/watermark.stories.tsx +0 -170
- package/src/components/watermark/watermark.tsx +0 -166
- package/src/hooks/use-breakpoint.ts +0 -117
- package/src/hooks/use-debounce-callback.ts +0 -52
- package/src/stories/theme-tokens.stories.tsx +0 -747
- package/src/utils/trigger-input.ts +0 -57
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 输入框 Input
|
|
3
|
+
*
|
|
4
|
+
* 通过键盘输入内容,是最基础的表单域包装。
|
|
5
|
+
*
|
|
6
|
+
* @when
|
|
7
|
+
* - 需要用户输入单行文本时(用户名、搜索关键词、URL 等)
|
|
8
|
+
* - 需要配合表单进行数据收集时
|
|
9
|
+
* - 需要前后缀装饰 / 清除按钮 / 密码切换 / 字符计数等复合形态时,请改用 [InputGroup](../input-group/index.tsx)
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import * as React from 'react';
|
|
13
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
14
|
+
|
|
15
|
+
import { cn } from '@/lib/utils';
|
|
16
|
+
|
|
17
|
+
// ─── Input cva ──────────────────────────────────────────────────────────────
|
|
18
|
+
|
|
19
|
+
const inputVariants = cva(
|
|
20
|
+
'w-full min-w-0 cursor-text rounded-md border border-input bg-transparent font-normal transition-colors outline-none file:inline-flex file:cursor-pointer file:border-0 file:bg-transparent file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20',
|
|
21
|
+
{
|
|
22
|
+
variants: {
|
|
23
|
+
size: {
|
|
24
|
+
sm: 'h-6 px-2 text-xs file:h-4 file:text-xs',
|
|
25
|
+
default: 'h-8 px-2.5 text-xs file:h-6 file:text-xs',
|
|
26
|
+
lg: 'h-9 px-3 text-sm file:h-7 file:text-sm',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: {
|
|
30
|
+
size: 'default',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
// ─── Types ──────────────────────────────────────────────────────────────────
|
|
36
|
+
|
|
37
|
+
export type InputSize = 'sm' | 'default' | 'lg';
|
|
38
|
+
|
|
39
|
+
export interface InputProps
|
|
40
|
+
extends Omit<React.ComponentProps<'input'>, 'size'>,
|
|
41
|
+
VariantProps<typeof inputVariants> {
|
|
42
|
+
/** 尺寸。 @default default */
|
|
43
|
+
size?: InputSize;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// ─── Input ──────────────────────────────────────────────────────────────────
|
|
47
|
+
|
|
48
|
+
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
49
|
+
({ className, type, size, ...props }, ref) => {
|
|
50
|
+
return (
|
|
51
|
+
<input
|
|
52
|
+
ref={ref}
|
|
53
|
+
type={type}
|
|
54
|
+
data-slot="input"
|
|
55
|
+
className={cn(inputVariants({ size, className }))}
|
|
56
|
+
{...props}
|
|
57
|
+
/>
|
|
58
|
+
);
|
|
59
|
+
},
|
|
60
|
+
);
|
|
61
|
+
Input.displayName = 'Input';
|
|
62
|
+
|
|
63
|
+
export { Input, inputVariants };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Input
|
|
2
|
+
|
|
3
|
+
> 本文件由 `pnpm gen:meta` 自动生成,**请勿手动编辑**。
|
|
4
|
+
|
|
5
|
+
## 描述
|
|
6
|
+
|
|
7
|
+
输入框 Input
|
|
8
|
+
通过键盘输入内容,是最基础的表单域包装。
|
|
9
|
+
|
|
10
|
+
## 使用场景
|
|
11
|
+
|
|
12
|
+
- 需要用户输入单行文本时(用户名、搜索关键词、URL 等)
|
|
13
|
+
- 需要配合表单进行数据收集时
|
|
14
|
+
- 需要前后缀装饰 / 清除按钮 / 密码切换 / 字符计数等复合形态时,请改用 [InputGroup](../input-group/index.tsx)
|
|
15
|
+
|
|
16
|
+
## Props
|
|
17
|
+
|
|
18
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
19
|
+
| --- | --- | --- | --- | --- |
|
|
20
|
+
| `size` | `InputSize` | `default` | – | 尺寸。 |
|
|
21
|
+
|
|
22
|
+
## 示例
|
|
23
|
+
|
|
24
|
+
### Sizes
|
|
25
|
+
|
|
26
|
+
可以通过设置 `size` 属性控制输入框的尺寸,可选值为 `sm` `default` `lg`。
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
<div className="flex flex-col gap-3">
|
|
30
|
+
<Input size="sm" placeholder="小 Small 24px" />
|
|
31
|
+
<Input placeholder="中 Default 32px" />
|
|
32
|
+
<Input size="lg" placeholder="大 Large 36px" />
|
|
33
|
+
</div>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Disabled
|
|
37
|
+
|
|
38
|
+
添加 `disabled` 属性即可让输入框处于不可用状态。
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
<div className="flex flex-col gap-3">
|
|
42
|
+
<Input placeholder="不可编辑" disabled />
|
|
43
|
+
<Input placeholder="不可编辑" disabled value="已填内容" />
|
|
44
|
+
</div>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Widths
|
|
48
|
+
|
|
49
|
+
Input 默认宽度为 100%,可通过 `className` 控制宽度。
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
<div className="flex flex-col gap-3">
|
|
53
|
+
<Input className="w-48" placeholder="w-48" />
|
|
54
|
+
<Input className="w-64" placeholder="w-64" />
|
|
55
|
+
<Input className="w-full" placeholder="w-full (默认)" />
|
|
56
|
+
</div>
|
|
57
|
+
```
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Input } from './index';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Input> = {
|
|
5
|
+
title: '数据录入 · Data Entry/Input 输入框',
|
|
6
|
+
component: Input,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component:
|
|
12
|
+
'极薄的原生 `<input>` 包装:仅提供 size 三档与 aria-invalid 错误态。需要前后缀图标 / 清除按钮 / 密码切换 / 字符计数等复合形态时,请改用 [InputGroup](/docs/数据录入-·-data-entry-inputgroup-输入框组合--docs)。',
|
|
13
|
+
},
|
|
14
|
+
source: { type: 'dynamic' },
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
|
|
20
|
+
type Story = StoryObj<typeof meta>;
|
|
21
|
+
|
|
22
|
+
export const Default: Story = {
|
|
23
|
+
args: { placeholder: '请输入内容' },
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** 可以通过设置 `size` 属性控制输入框的尺寸,可选值为 `sm` `default` `lg`。 */
|
|
27
|
+
export const Sizes: Story = {
|
|
28
|
+
render: () => (
|
|
29
|
+
<div className="flex flex-col gap-3">
|
|
30
|
+
<Input size="sm" placeholder="小 Small 24px" />
|
|
31
|
+
<Input placeholder="中 Default 32px" />
|
|
32
|
+
<Input size="lg" placeholder="大 Large 36px" />
|
|
33
|
+
</div>
|
|
34
|
+
),
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** 添加 `disabled` 属性即可让输入框处于不可用状态。 */
|
|
38
|
+
export const Disabled: Story = {
|
|
39
|
+
render: () => (
|
|
40
|
+
<div className="flex flex-col gap-3">
|
|
41
|
+
<Input placeholder="不可编辑" disabled />
|
|
42
|
+
<Input placeholder="不可编辑" disabled value="已填内容" />
|
|
43
|
+
</div>
|
|
44
|
+
),
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** 通过 `aria-invalid` 属性标记错误状态,通常用于表单校验失败时。 */
|
|
48
|
+
export const Invalid: Story = {
|
|
49
|
+
render: () => <Input placeholder="请输入邮箱" aria-invalid="true" />,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/** Input 默认宽度为 100%,可通过 `className` 控制宽度。 */
|
|
53
|
+
export const Widths: Story = {
|
|
54
|
+
render: () => (
|
|
55
|
+
<div className="flex flex-col gap-3">
|
|
56
|
+
<Input className="w-48" placeholder="w-48" />
|
|
57
|
+
<Input className="w-64" placeholder="w-64" />
|
|
58
|
+
<Input className="w-full" placeholder="w-full (默认)" />
|
|
59
|
+
</div>
|
|
60
|
+
),
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/** `readOnly` 属性让输入框只读,用户可复制但无法编辑。 */
|
|
64
|
+
export const ReadOnly: Story = {
|
|
65
|
+
render: () => <Input readOnly value="只读内容,可复制" />,
|
|
66
|
+
};
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 输入组 InputGroup
|
|
3
|
+
*
|
|
4
|
+
* 将输入框与前后缀装饰(图标、按钮、文字)组合为一个视觉整体。
|
|
5
|
+
*
|
|
6
|
+
* @when
|
|
7
|
+
* - 需要为输入框添加前后缀图标或文字时(搜索图标、金额单位)
|
|
8
|
+
* - 需要在输入框内嵌入按钮时(密码可见切换、清除)
|
|
9
|
+
* - 需要文本字符计数 / 越界提示时(InputGroupShowCount)
|
|
10
|
+
* - Input 单独使用无法满足复合布局需求时
|
|
11
|
+
*
|
|
12
|
+
* 组合结构:InputGroup > InputGroupAddon + (InputGroupInput | InputGroupTextarea)
|
|
13
|
+
* helper 原子:InputGroupClear / InputGroupPasswordToggle / InputGroupShowCount
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import * as React from 'react';
|
|
17
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
18
|
+
import { EyeIcon, EyeOffIcon, XIcon } from 'lucide-react';
|
|
19
|
+
|
|
20
|
+
import { cn } from '@/lib/utils';
|
|
21
|
+
import { Button } from '@/components/button';
|
|
22
|
+
import { Input, type InputProps } from '@/components/input';
|
|
23
|
+
import { Textarea } from '@/components/textarea';
|
|
24
|
+
|
|
25
|
+
const InputGroup = React.forwardRef<
|
|
26
|
+
HTMLDivElement,
|
|
27
|
+
React.ComponentProps<'div'>
|
|
28
|
+
>(({ className, ...props }, ref) => {
|
|
29
|
+
return (
|
|
30
|
+
<div
|
|
31
|
+
ref={ref}
|
|
32
|
+
data-slot="input-group"
|
|
33
|
+
role="group"
|
|
34
|
+
className={cn(
|
|
35
|
+
'group/input-group relative flex h-8 w-full min-w-0 items-center rounded-md border border-input transition-colors outline-none has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-1 has-[[data-slot=input-group-control]:focus-visible]:ring-ring has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-1 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5',
|
|
36
|
+
className,
|
|
37
|
+
)}
|
|
38
|
+
{...props}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
InputGroup.displayName = 'InputGroup';
|
|
43
|
+
|
|
44
|
+
const inputGroupAddonVariants = cva(
|
|
45
|
+
"flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-xs font-normal text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-sm [&>svg:not([class*='size-'])]:size-4",
|
|
46
|
+
{
|
|
47
|
+
variants: {
|
|
48
|
+
align: {
|
|
49
|
+
'inline-start':
|
|
50
|
+
'order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:-ml-0.5',
|
|
51
|
+
'inline-end': 'order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:-mr-0.5',
|
|
52
|
+
'block-start':
|
|
53
|
+
'order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2',
|
|
54
|
+
'block-end':
|
|
55
|
+
'order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
defaultVariants: {
|
|
59
|
+
align: 'inline-start',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
function InputGroupAddon({
|
|
65
|
+
className,
|
|
66
|
+
align = 'inline-start',
|
|
67
|
+
...props
|
|
68
|
+
}: React.ComponentProps<'div'> & VariantProps<typeof inputGroupAddonVariants>) {
|
|
69
|
+
return (
|
|
70
|
+
<div
|
|
71
|
+
role="group"
|
|
72
|
+
data-slot="input-group-addon"
|
|
73
|
+
data-align={align}
|
|
74
|
+
className={cn(inputGroupAddonVariants({ align }), className)}
|
|
75
|
+
onClick={(e) => {
|
|
76
|
+
if ((e.target as HTMLElement).closest('button')) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
e.currentTarget.parentElement?.querySelector('input')?.focus();
|
|
80
|
+
}}
|
|
81
|
+
{...props}
|
|
82
|
+
/>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const inputGroupButtonVariants = cva(
|
|
87
|
+
'flex items-center gap-2 text-sm shadow-none',
|
|
88
|
+
{
|
|
89
|
+
variants: {
|
|
90
|
+
size: {
|
|
91
|
+
xs: "h-6 gap-1 rounded-sm px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
|
|
92
|
+
sm: '',
|
|
93
|
+
'icon-xs': 'size-6 rounded-sm p-0 has-[>svg]:p-0',
|
|
94
|
+
'icon-sm': 'size-8 p-0 has-[>svg]:p-0',
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
defaultVariants: {
|
|
98
|
+
size: 'xs',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
function InputGroupButton({
|
|
104
|
+
className,
|
|
105
|
+
type = 'button',
|
|
106
|
+
variant = 'ghost',
|
|
107
|
+
size = 'xs',
|
|
108
|
+
...props
|
|
109
|
+
}: Omit<React.ComponentProps<typeof Button>, 'size'> &
|
|
110
|
+
VariantProps<typeof inputGroupButtonVariants>) {
|
|
111
|
+
return (
|
|
112
|
+
<Button
|
|
113
|
+
type={type}
|
|
114
|
+
data-size={size}
|
|
115
|
+
variant={variant}
|
|
116
|
+
className={cn(inputGroupButtonVariants({ size }), className)}
|
|
117
|
+
{...props}
|
|
118
|
+
/>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function InputGroupText({ className, ...props }: React.ComponentProps<'span'>) {
|
|
123
|
+
return (
|
|
124
|
+
<span
|
|
125
|
+
className={cn(
|
|
126
|
+
"flex items-center gap-2 text-xs font-normal text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
127
|
+
className,
|
|
128
|
+
)}
|
|
129
|
+
{...props}
|
|
130
|
+
/>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function InputGroupInput({ className, ...props }: InputProps) {
|
|
135
|
+
return (
|
|
136
|
+
<Input
|
|
137
|
+
data-slot="input-group-control"
|
|
138
|
+
className={cn(
|
|
139
|
+
'flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0',
|
|
140
|
+
className,
|
|
141
|
+
)}
|
|
142
|
+
{...props}
|
|
143
|
+
/>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function InputGroupTextarea({
|
|
148
|
+
className,
|
|
149
|
+
...props
|
|
150
|
+
}: React.ComponentProps<'textarea'>) {
|
|
151
|
+
return (
|
|
152
|
+
<Textarea
|
|
153
|
+
data-slot="input-group-control"
|
|
154
|
+
className={cn(
|
|
155
|
+
'flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0',
|
|
156
|
+
className,
|
|
157
|
+
)}
|
|
158
|
+
{...props}
|
|
159
|
+
/>
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// ─── InputGroupClear ──────────────────────────────────────────────────────────────
|
|
164
|
+
|
|
165
|
+
export interface InputGroupClearProps
|
|
166
|
+
extends Omit<
|
|
167
|
+
React.ComponentProps<typeof InputGroupButton>,
|
|
168
|
+
'children' | 'aria-label'
|
|
169
|
+
> {
|
|
170
|
+
/** 是否显示。受控用法下一般绑定 `value.length > 0`。 @default true */
|
|
171
|
+
visible?: boolean;
|
|
172
|
+
/** 无障碍 label。 @default '清除' */
|
|
173
|
+
'aria-label'?: string;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* `InputGroupClear` 清除按钮,默认右侧插槽。
|
|
178
|
+
* 在 `<InputGroupAddon align="inline-end">` 中使用;onClick 由外部控制 value 清零。
|
|
179
|
+
*/
|
|
180
|
+
function InputGroupClear({
|
|
181
|
+
visible = true,
|
|
182
|
+
className,
|
|
183
|
+
'aria-label': ariaLabel = '清除',
|
|
184
|
+
...props
|
|
185
|
+
}: InputGroupClearProps) {
|
|
186
|
+
if (!visible) return null;
|
|
187
|
+
return (
|
|
188
|
+
<InputGroupButton
|
|
189
|
+
data-slot="input-group-clear"
|
|
190
|
+
size="icon-xs"
|
|
191
|
+
aria-label={ariaLabel}
|
|
192
|
+
className={cn(
|
|
193
|
+
'text-muted-foreground hover:bg-transparent hover:text-foreground',
|
|
194
|
+
className,
|
|
195
|
+
)}
|
|
196
|
+
{...props}
|
|
197
|
+
>
|
|
198
|
+
<XIcon />
|
|
199
|
+
</InputGroupButton>
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// ─── InputGroupPasswordToggle ───────────────────────────────────────────────────────
|
|
204
|
+
|
|
205
|
+
export interface InputGroupPasswordToggleProps
|
|
206
|
+
extends Omit<
|
|
207
|
+
React.ComponentProps<typeof InputGroupButton>,
|
|
208
|
+
'children' | 'onClick'
|
|
209
|
+
> {
|
|
210
|
+
/** 当前密码是否可见。 */
|
|
211
|
+
visible: boolean;
|
|
212
|
+
/** 切换可见性,由父级同步修改 `<InputGroupInput type>` 。 */
|
|
213
|
+
onVisibleChange: (visible: boolean) => void;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* `InputGroupPasswordToggle` 密码可见性切换按钮。
|
|
218
|
+
* 受控级别:visible 必填,由父级同时控制 input 的 `type` 与此 prop。
|
|
219
|
+
*/
|
|
220
|
+
function InputGroupPasswordToggle({
|
|
221
|
+
visible,
|
|
222
|
+
onVisibleChange,
|
|
223
|
+
className,
|
|
224
|
+
...props
|
|
225
|
+
}: InputGroupPasswordToggleProps) {
|
|
226
|
+
return (
|
|
227
|
+
<InputGroupButton
|
|
228
|
+
data-slot="input-group-password-toggle"
|
|
229
|
+
size="icon-xs"
|
|
230
|
+
aria-label={visible ? '隐藏密码' : '显示密码'}
|
|
231
|
+
aria-pressed={visible}
|
|
232
|
+
onClick={() => onVisibleChange(!visible)}
|
|
233
|
+
className={cn(
|
|
234
|
+
'text-muted-foreground hover:bg-transparent hover:text-foreground',
|
|
235
|
+
className,
|
|
236
|
+
)}
|
|
237
|
+
{...props}
|
|
238
|
+
>
|
|
239
|
+
{visible ? <EyeOffIcon /> : <EyeIcon />}
|
|
240
|
+
</InputGroupButton>
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// ─── InputGroupShowCount ─────────────────────────────────────────────────────────
|
|
245
|
+
|
|
246
|
+
export interface InputGroupShowCountProps extends React.ComponentProps<'span'> {
|
|
247
|
+
/** 当前长度(从 value.length 或自定义计算传入。不耦合 value)。 */
|
|
248
|
+
current: number;
|
|
249
|
+
/** 最大长度,对齐 `<input maxLength>`。不传时仅显示当前长度。 */
|
|
250
|
+
max?: number;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* `InputGroupShowCount` 字符计数提示。
|
|
255
|
+
* - 形式:传 max 时显示 `current/max`,否则仅显示 `current`。
|
|
256
|
+
* - 越界样式:自动加 `data-overflow` 并变为 destructive 色。
|
|
257
|
+
* - 位置:高频与 `<InputGroupAddon align="block-end">` 配合用于 textarea。
|
|
258
|
+
*/
|
|
259
|
+
function InputGroupShowCount({
|
|
260
|
+
current,
|
|
261
|
+
max,
|
|
262
|
+
className,
|
|
263
|
+
...props
|
|
264
|
+
}: InputGroupShowCountProps) {
|
|
265
|
+
const overflow = typeof max === 'number' && current > max;
|
|
266
|
+
return (
|
|
267
|
+
<span
|
|
268
|
+
data-slot="input-group-show-count"
|
|
269
|
+
data-overflow={overflow || undefined}
|
|
270
|
+
className={cn(
|
|
271
|
+
'flex items-center text-xs tabular-nums text-muted-foreground select-none',
|
|
272
|
+
'data-[overflow]:text-destructive',
|
|
273
|
+
className,
|
|
274
|
+
)}
|
|
275
|
+
{...props}
|
|
276
|
+
>
|
|
277
|
+
{typeof max === 'number' ? `${current}/${max}` : current}
|
|
278
|
+
</span>
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export {
|
|
283
|
+
InputGroup,
|
|
284
|
+
InputGroupAddon,
|
|
285
|
+
InputGroupButton,
|
|
286
|
+
InputGroupText,
|
|
287
|
+
InputGroupInput,
|
|
288
|
+
InputGroupTextarea,
|
|
289
|
+
InputGroupClear,
|
|
290
|
+
InputGroupPasswordToggle,
|
|
291
|
+
InputGroupShowCount,
|
|
292
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# InputGroupClear
|
|
2
|
+
|
|
3
|
+
> 本文件由 `pnpm gen:meta` 自动生成,**请勿手动编辑**。
|
|
4
|
+
|
|
5
|
+
## 描述
|
|
6
|
+
|
|
7
|
+
输入组 InputGroup
|
|
8
|
+
将输入框与前后缀装饰(图标、按钮、文字)组合为一个视觉整体。
|
|
9
|
+
|
|
10
|
+
## 使用场景
|
|
11
|
+
|
|
12
|
+
- 需要为输入框添加前后缀图标或文字时(搜索图标、金额单位)
|
|
13
|
+
- 需要在输入框内嵌入按钮时(密码可见切换、清除)
|
|
14
|
+
- 需要文本字符计数 / 越界提示时(InputGroupShowCount)
|
|
15
|
+
- Input 单独使用无法满足复合布局需求时
|
|
16
|
+
- 组合结构:InputGroup > InputGroupAddon + (InputGroupInput | InputGroupTextarea)
|
|
17
|
+
- helper 原子:InputGroupClear / InputGroupPasswordToggle / InputGroupShowCount
|
|
18
|
+
|
|
19
|
+
## Props
|
|
20
|
+
|
|
21
|
+
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
22
|
+
| --- | --- | --- | --- | --- |
|
|
23
|
+
| `visible` | `boolean` | `true` | – | 是否显示。受控用法下一般绑定 `value.length > 0`。 |
|
|
24
|
+
| `'aria-label'` | `string` | `'清除'` | – | 无障碍 label。 |
|
|
25
|
+
| `visible` | `boolean` | – | ✓ | 当前密码是否可见。 |
|
|
26
|
+
| `onVisibleChange` | `(visible: boolean) => void` | – | ✓ | 切换可见性,由父级同步修改 `<InputGroupInput type>` 。 |
|
|
27
|
+
| `current` | `number` | – | ✓ | 当前长度(从 value.length 或自定义计算传入。不耦合 value)。 |
|
|
28
|
+
| `max` | `number` | – | – | 最大长度,对齐 `<input maxLength>`。不传时仅显示当前长度。 |
|
|
29
|
+
|
|
30
|
+
## 示例
|
|
31
|
+
|
|
32
|
+
### WithLeadingIcon
|
|
33
|
+
|
|
34
|
+
前置图标插槽,聚焦时整体高亮。
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
<InputGroup className="w-64">
|
|
38
|
+
<InputGroupAddon>
|
|
39
|
+
<InputGroupText>
|
|
40
|
+
<SearchIcon />
|
|
41
|
+
</InputGroupText>
|
|
42
|
+
</InputGroupAddon>
|
|
43
|
+
<InputGroupInput placeholder="搜索..." />
|
|
44
|
+
</InputGroup>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Email
|
|
48
|
+
|
|
49
|
+
邮箱输入:左侧邮件图标 + 右侧域名后缀文本。
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
<InputGroup className="w-80">
|
|
53
|
+
<InputGroupAddon>
|
|
54
|
+
<InputGroupText>
|
|
55
|
+
<MailIcon />
|
|
56
|
+
</InputGroupText>
|
|
57
|
+
</InputGroupAddon>
|
|
58
|
+
<InputGroupInput placeholder="username" />
|
|
59
|
+
<InputGroupAddon align="inline-end">
|
|
60
|
+
<InputGroupText>@example.com</InputGroupText>
|
|
61
|
+
</InputGroupAddon>
|
|
62
|
+
</InputGroup>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Loading
|
|
66
|
+
|
|
67
|
+
校验中:右侧旋转 loading 图标,对齐 cloud-design `state="loading"`。
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
<InputGroup className="w-64">
|
|
71
|
+
<InputGroupInput placeholder="校验中..." defaultValue="abc@" />
|
|
72
|
+
<InputGroupAddon align="inline-end">
|
|
73
|
+
<InputGroupText>
|
|
74
|
+
<Loader2Icon className="animate-spin" />
|
|
75
|
+
</InputGroupText>
|
|
76
|
+
</InputGroupAddon>
|
|
77
|
+
</InputGroup>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Disabled
|
|
81
|
+
|
|
82
|
+
禁用状态的输入框组合。
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
<InputGroup className="w-64">
|
|
86
|
+
<InputGroupAddon>
|
|
87
|
+
<InputGroupText>
|
|
88
|
+
<SearchIcon />
|
|
89
|
+
</InputGroupText>
|
|
90
|
+
</InputGroupAddon>
|
|
91
|
+
<InputGroupInput placeholder="不可编辑" disabled />
|
|
92
|
+
</InputGroup>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Invalid
|
|
96
|
+
|
|
97
|
+
错误态:内部 `InputGroupInput` 透传 `aria-invalid`,整体边框转 destructive 色。
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
<InputGroup className="w-64">
|
|
101
|
+
<InputGroupAddon>
|
|
102
|
+
<InputGroupText>
|
|
103
|
+
<MailIcon />
|
|
104
|
+
</InputGroupText>
|
|
105
|
+
</InputGroupAddon>
|
|
106
|
+
<InputGroupInput placeholder="请输入邮箱" aria-invalid="true" />
|
|
107
|
+
</InputGroup>
|
|
108
|
+
```
|