@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,283 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ChevronDown, ChevronUp, Minus, Plus } from 'lucide-react';
|
|
3
|
-
|
|
4
|
-
import { cn } from '@/utils/cn';
|
|
5
|
-
|
|
6
|
-
export interface InputNumberProps
|
|
7
|
-
extends Omit<
|
|
8
|
-
React.InputHTMLAttributes<HTMLInputElement>,
|
|
9
|
-
| 'onChange'
|
|
10
|
-
| 'value'
|
|
11
|
-
| 'defaultValue'
|
|
12
|
-
| 'min'
|
|
13
|
-
| 'max'
|
|
14
|
-
| 'step'
|
|
15
|
-
| 'type'
|
|
16
|
-
| 'size'
|
|
17
|
-
> {
|
|
18
|
-
/**
|
|
19
|
-
* 大数/高精度字符串模式(antd `stringMode` 并集)。开启后:
|
|
20
|
-
* - `value` / `defaultValue` / `onChange` 使用 `string` 类型(避免 IEEE 754 精度丢失)
|
|
21
|
-
* - 步进 / 夹紧仍用 `parseFloat` 执行算术,但最终返回 string
|
|
22
|
-
* @default false
|
|
23
|
-
*/
|
|
24
|
-
stringMode?: boolean;
|
|
25
|
-
/** 受控值 — `null` 等价空输入。`stringMode` 时为 `string | null`。 */
|
|
26
|
-
value?: number | string | null;
|
|
27
|
-
/** uncontrolled 初值。`stringMode` 时为 `string | null`。 */
|
|
28
|
-
defaultValue?: number | string | null;
|
|
29
|
-
/**
|
|
30
|
-
* 值变化回调 — 输入清空时传 `null`。
|
|
31
|
-
* `stringMode` 时回调 `(value: string | null) => void`;
|
|
32
|
-
* 普通模式 `(value: number | null) => void`。
|
|
33
|
-
*/
|
|
34
|
-
onChange?: (value: number | string | null) => void;
|
|
35
|
-
/** 最小值(antd `min` 并集)。 */
|
|
36
|
-
min?: number;
|
|
37
|
-
/** 最大值(antd `max` 并集)。 */
|
|
38
|
-
max?: number;
|
|
39
|
-
/**
|
|
40
|
-
* 步长(antd `step` 并集) — 增 / 减按钮以及键盘 ↑↓ 都按此步长。
|
|
41
|
-
* @default 1
|
|
42
|
-
*/
|
|
43
|
-
step?: number;
|
|
44
|
-
/**
|
|
45
|
-
* 数值精度(antd `precision` 并集) — 保留小数位数(超出会四舍五入)。
|
|
46
|
-
*/
|
|
47
|
-
precision?: number;
|
|
48
|
-
/**
|
|
49
|
-
* 千分位分隔展示(仅展示用,实际 value 仍是 number)。
|
|
50
|
-
* @default false
|
|
51
|
-
*/
|
|
52
|
-
groupSeparator?: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* 是否显示右侧上下步进按钮(antd `controls` 并集) — `false` 时隐藏。
|
|
55
|
-
* @default true
|
|
56
|
-
*/
|
|
57
|
-
controls?: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* 形态(cloud-design `type` 并集) — `"normal"` 右侧叠加 ChevronUp/Down 按钮(默认),
|
|
60
|
-
* `"inline"` 两侧各一个 Plus/Minus 按钮(【−】 value 【+】),适合紧凑表单。
|
|
61
|
-
* @default "normal"
|
|
62
|
-
*/
|
|
63
|
-
type?: 'normal' | 'inline';
|
|
64
|
-
/**
|
|
65
|
-
* 尺寸。`md` 与 `default` 完全等价,后者作为向后兼容别名保留;新代码请优先使用 `md`,
|
|
66
|
-
* 与 Button / Input / Select 等表单原子的 size enum 一致。
|
|
67
|
-
* @default "md"
|
|
68
|
-
*/
|
|
69
|
-
size?: 'sm' | 'md' | 'default' | 'lg';
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function format(
|
|
73
|
-
raw: number | null,
|
|
74
|
-
precision: number | undefined,
|
|
75
|
-
groupSeparator: boolean,
|
|
76
|
-
): string {
|
|
77
|
-
if (raw === null || Number.isNaN(raw)) return '';
|
|
78
|
-
const fixed = precision !== undefined ? raw.toFixed(precision) : String(raw);
|
|
79
|
-
if (!groupSeparator) return fixed;
|
|
80
|
-
const [intPart, decPart] = fixed.split('.');
|
|
81
|
-
const grouped = intPart!.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
82
|
-
return decPart !== undefined ? `${grouped}.${decPart}` : grouped;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const sizeMap = {
|
|
86
|
-
sm: 'h-6 text-xs',
|
|
87
|
-
md: 'h-8 text-xs',
|
|
88
|
-
default: 'h-8 text-xs',
|
|
89
|
-
lg: 'h-9 text-sm',
|
|
90
|
-
} as const;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* 数字输入框 — antd 独有补足。**等价 antd `InputNumber`**。区别于原生 `<input type="number">`:
|
|
94
|
-
* - 步进按钮可自定义显隐
|
|
95
|
-
* - 范围裁剪与 precision 由组件保证(超出 min/max 自动夹紧)
|
|
96
|
-
* - 千分位展示(仅 UI)
|
|
97
|
-
* - 支持空状态(value=null)
|
|
98
|
-
*/
|
|
99
|
-
const InputNumber = React.forwardRef<HTMLInputElement, InputNumberProps>(
|
|
100
|
-
(
|
|
101
|
-
{
|
|
102
|
-
value,
|
|
103
|
-
defaultValue,
|
|
104
|
-
onChange,
|
|
105
|
-
min,
|
|
106
|
-
max,
|
|
107
|
-
step = 1,
|
|
108
|
-
precision,
|
|
109
|
-
groupSeparator = false,
|
|
110
|
-
controls = true,
|
|
111
|
-
type = 'normal',
|
|
112
|
-
size = 'md',
|
|
113
|
-
stringMode = false,
|
|
114
|
-
disabled,
|
|
115
|
-
className,
|
|
116
|
-
onBlur,
|
|
117
|
-
onKeyDown,
|
|
118
|
-
...props
|
|
119
|
-
},
|
|
120
|
-
ref,
|
|
121
|
-
) => {
|
|
122
|
-
const isControlled = value !== undefined;
|
|
123
|
-
const toNum = (v: number | string | null | undefined): number | null => {
|
|
124
|
-
if (v == null) return null;
|
|
125
|
-
const n = typeof v === 'string' ? parseFloat(v) : v;
|
|
126
|
-
return Number.isNaN(n) ? null : n;
|
|
127
|
-
};
|
|
128
|
-
const [internal, setInternal] = React.useState<number | null>(
|
|
129
|
-
toNum(defaultValue),
|
|
130
|
-
);
|
|
131
|
-
const current = isControlled ? toNum(value) : internal;
|
|
132
|
-
const [editing, setEditing] = React.useState<string | null>(null);
|
|
133
|
-
|
|
134
|
-
const display =
|
|
135
|
-
editing !== null ? editing : format(current, precision, groupSeparator);
|
|
136
|
-
|
|
137
|
-
const clamp = (n: number): number => {
|
|
138
|
-
let v = n;
|
|
139
|
-
if (typeof min === 'number') v = Math.max(min, v);
|
|
140
|
-
if (typeof max === 'number') v = Math.min(max, v);
|
|
141
|
-
if (typeof precision === 'number') v = Number(v.toFixed(precision));
|
|
142
|
-
return v;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
const commit = (next: number | null) => {
|
|
146
|
-
if (!isControlled) setInternal(next);
|
|
147
|
-
if (stringMode) {
|
|
148
|
-
onChange?.(next === null ? null : String(next));
|
|
149
|
-
} else {
|
|
150
|
-
onChange?.(next);
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
const handleInput = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
155
|
-
const raw = e.target.value;
|
|
156
|
-
// Allow free typing of intermediate states ("-", "1.").
|
|
157
|
-
setEditing(raw);
|
|
158
|
-
if (raw === '' || raw === '-' || raw === '.') return;
|
|
159
|
-
const parsed = Number(raw.replace(/,/g, ''));
|
|
160
|
-
if (!Number.isNaN(parsed)) commit(clamp(parsed));
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {
|
|
164
|
-
setEditing(null);
|
|
165
|
-
const raw = e.target.value;
|
|
166
|
-
if (raw === '' || raw === '-' || raw === '.') {
|
|
167
|
-
commit(null);
|
|
168
|
-
} else {
|
|
169
|
-
const parsed = Number(raw.replace(/,/g, ''));
|
|
170
|
-
commit(Number.isNaN(parsed) ? null : clamp(parsed));
|
|
171
|
-
}
|
|
172
|
-
onBlur?.(e);
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
const step1 = (sign: 1 | -1) => {
|
|
176
|
-
if (disabled) return;
|
|
177
|
-
const base = current ?? 0;
|
|
178
|
-
commit(clamp(base + sign * step));
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
|
182
|
-
if (e.key === 'ArrowUp') {
|
|
183
|
-
e.preventDefault();
|
|
184
|
-
step1(1);
|
|
185
|
-
} else if (e.key === 'ArrowDown') {
|
|
186
|
-
e.preventDefault();
|
|
187
|
-
step1(-1);
|
|
188
|
-
}
|
|
189
|
-
onKeyDown?.(e);
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
return (
|
|
193
|
-
<div
|
|
194
|
-
className={cn(
|
|
195
|
-
'inline-flex items-stretch overflow-hidden rounded-md border border-input bg-card shadow-sm',
|
|
196
|
-
'hover:border-ring focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/10',
|
|
197
|
-
disabled && 'cursor-not-allowed opacity-50',
|
|
198
|
-
className,
|
|
199
|
-
)}
|
|
200
|
-
>
|
|
201
|
-
{controls && type === 'inline' ? (
|
|
202
|
-
<button
|
|
203
|
-
type="button"
|
|
204
|
-
tabIndex={-1}
|
|
205
|
-
disabled={
|
|
206
|
-
disabled ||
|
|
207
|
-
(typeof min === 'number' && (current ?? Infinity) <= min)
|
|
208
|
-
}
|
|
209
|
-
onClick={() => step1(-1)}
|
|
210
|
-
aria-label="减少"
|
|
211
|
-
className="flex items-center justify-center border-r border-input px-2 text-muted-foreground hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-30"
|
|
212
|
-
>
|
|
213
|
-
<Minus className="size-3.5" />
|
|
214
|
-
</button>
|
|
215
|
-
) : null}
|
|
216
|
-
<input
|
|
217
|
-
ref={ref}
|
|
218
|
-
type="text"
|
|
219
|
-
inputMode="decimal"
|
|
220
|
-
value={display}
|
|
221
|
-
disabled={disabled}
|
|
222
|
-
onChange={handleInput}
|
|
223
|
-
onBlur={handleBlur}
|
|
224
|
-
onKeyDown={handleKeyDown}
|
|
225
|
-
className={cn(
|
|
226
|
-
'w-full bg-transparent px-3 text-foreground placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed',
|
|
227
|
-
type === 'inline' && 'text-center',
|
|
228
|
-
sizeMap[size],
|
|
229
|
-
)}
|
|
230
|
-
{...props}
|
|
231
|
-
/>
|
|
232
|
-
{controls && type === 'inline' ? (
|
|
233
|
-
<button
|
|
234
|
-
type="button"
|
|
235
|
-
tabIndex={-1}
|
|
236
|
-
disabled={
|
|
237
|
-
disabled ||
|
|
238
|
-
(typeof max === 'number' && (current ?? -Infinity) >= max)
|
|
239
|
-
}
|
|
240
|
-
onClick={() => step1(1)}
|
|
241
|
-
aria-label="增加"
|
|
242
|
-
className="flex items-center justify-center border-l border-input px-2 text-muted-foreground hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-30"
|
|
243
|
-
>
|
|
244
|
-
<Plus className="size-3.5" />
|
|
245
|
-
</button>
|
|
246
|
-
) : null}
|
|
247
|
-
{controls && type === 'normal' ? (
|
|
248
|
-
<div className="flex flex-col border-l border-input">
|
|
249
|
-
<button
|
|
250
|
-
type="button"
|
|
251
|
-
tabIndex={-1}
|
|
252
|
-
disabled={
|
|
253
|
-
disabled ||
|
|
254
|
-
(typeof max === 'number' && (current ?? -Infinity) >= max)
|
|
255
|
-
}
|
|
256
|
-
onClick={() => step1(1)}
|
|
257
|
-
aria-label="增加"
|
|
258
|
-
className="flex h-1/2 items-center justify-center px-1.5 text-muted-foreground hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-30"
|
|
259
|
-
>
|
|
260
|
-
<ChevronUp className="size-3.5" />
|
|
261
|
-
</button>
|
|
262
|
-
<button
|
|
263
|
-
type="button"
|
|
264
|
-
tabIndex={-1}
|
|
265
|
-
disabled={
|
|
266
|
-
disabled ||
|
|
267
|
-
(typeof min === 'number' && (current ?? Infinity) <= min)
|
|
268
|
-
}
|
|
269
|
-
onClick={() => step1(-1)}
|
|
270
|
-
aria-label="减少"
|
|
271
|
-
className="flex h-1/2 items-center justify-center border-t border-input px-1.5 text-muted-foreground hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-30"
|
|
272
|
-
>
|
|
273
|
-
<ChevronDown className="size-3.5" />
|
|
274
|
-
</button>
|
|
275
|
-
</div>
|
|
276
|
-
) : null}
|
|
277
|
-
</div>
|
|
278
|
-
);
|
|
279
|
-
},
|
|
280
|
-
);
|
|
281
|
-
InputNumber.displayName = 'InputNumber';
|
|
282
|
-
|
|
283
|
-
export { InputNumber };
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: input-otp
|
|
3
|
-
name: InputOTP
|
|
4
|
-
type: component
|
|
5
|
-
category: deprecated
|
|
6
|
-
since: 0.1.0
|
|
7
|
-
package: '@teamix-evo/ui'
|
|
8
|
-
displayName: 验证码输入
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# InputOTP 验证码输入
|
|
12
|
-
|
|
13
|
-
OTP 验证码输入 — 基于 [`input-otp`](https://github.com/guilhermerodz/input-otp)。**shadcn-only**(antd 无对标组件)。
|
|
14
|
-
4~8 位短验证码常见场景:登录、二步验证、支付确认。
|
|
15
|
-
|
|
16
|
-
## When to use
|
|
17
|
-
|
|
18
|
-
- 短信 / 邮件验证码输入
|
|
19
|
-
- 二步验证(TOTP / 短信)
|
|
20
|
-
- 支付密码 / PIN
|
|
21
|
-
|
|
22
|
-
## When NOT to use
|
|
23
|
-
|
|
24
|
-
- 长密码输入 → `Input type="password"`
|
|
25
|
-
- 富文本 / 自由格式 → `Input` / `Textarea`
|
|
26
|
-
- 银行卡号 → `Input` + `format` 函数
|
|
27
|
-
|
|
28
|
-
## Props
|
|
29
|
-
|
|
30
|
-
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成。`InputOTP` 透传 `input-otp` 的所有 props。
|
|
31
|
-
|
|
32
|
-
<!-- auto:props:begin -->
|
|
33
|
-
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
34
|
-
| --- | --- | --- | --- | --- |
|
|
35
|
-
| `className` | `string` | – | – | 输入框 className,作用在隐藏的真实 input 上;通常无需关心。 |
|
|
36
|
-
| `containerClassName` | `string` | – | – | 容器 className,作用在 slot 列表外层 wrapper 上, 用于覆盖默认的 `flex items-center gap-2`。 |
|
|
37
|
-
<!-- auto:props:end -->
|
|
38
|
-
|
|
39
|
-
## 依赖
|
|
40
|
-
|
|
41
|
-
> 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成,数据源是 [`manifest.json`](../../../manifest.json)。**手工编辑 marker 之间的内容会在下次生成时被覆盖**。
|
|
42
|
-
|
|
43
|
-
<!-- auto:deps:begin -->
|
|
44
|
-
### 同库依赖
|
|
45
|
-
|
|
46
|
-
> `teamix-evo ui add input-otp` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
47
|
-
|
|
48
|
-
| Entry | 类型 | 描述 |
|
|
49
|
-
| --- | --- | --- |
|
|
50
|
-
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
51
|
-
|
|
52
|
-
### npm 依赖
|
|
53
|
-
|
|
54
|
-
> 业务侧需要先 `pnpm add` / `npm install` 这些包。CLI 在 `ui add` 完成后会列出此提示。
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
pnpm add input-otp@^1.2.0 lucide-react@^0.460.0
|
|
58
|
-
```
|
|
59
|
-
<!-- auto:deps:end -->
|
|
60
|
-
|
|
61
|
-
> 子组件:`InputOTP`(Root)/ `InputOTPGroup`(slot 容器)/ `InputOTPSlot`(单 slot,需 `index`)/ `InputOTPSeparator`(分隔符,如 4-4 数字之间的点)。
|
|
62
|
-
|
|
63
|
-
## AI 生成纪律
|
|
64
|
-
|
|
65
|
-
- **`maxLength` 必传**:声明位数(常见 4 / 6 / 8)
|
|
66
|
-
- **每个 Slot 必传 `index`**:0-based,与 maxLength 对应
|
|
67
|
-
- **`pattern` 限制字符类**:数字 OTP 用 `pattern={REGEXP_ONLY_DIGITS}`(从 `input-otp` 导入),避免用户粘贴混合字符
|
|
68
|
-
- **多 Group 用 Separator**:6 位时分 3-3 或 4-2 提升可读性
|
|
69
|
-
- **复制粘贴自带**:input-otp 自动处理,不需要再监听 paste
|
|
70
|
-
|
|
71
|
-
## Examples
|
|
72
|
-
|
|
73
|
-
```tsx
|
|
74
|
-
import {
|
|
75
|
-
InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator,
|
|
76
|
-
} from '@/components/ui/input-otp';
|
|
77
|
-
import { REGEXP_ONLY_DIGITS } from 'input-otp';
|
|
78
|
-
|
|
79
|
-
// 6 位
|
|
80
|
-
<InputOTP maxLength={6} pattern={REGEXP_ONLY_DIGITS}>
|
|
81
|
-
<InputOTPGroup>
|
|
82
|
-
{[0, 1, 2, 3, 4, 5].map((i) => <InputOTPSlot key={i} index={i} />)}
|
|
83
|
-
</InputOTPGroup>
|
|
84
|
-
</InputOTP>
|
|
85
|
-
|
|
86
|
-
// 6 位,3-3 分组
|
|
87
|
-
<InputOTP maxLength={6} pattern={REGEXP_ONLY_DIGITS}>
|
|
88
|
-
<InputOTPGroup>
|
|
89
|
-
<InputOTPSlot index={0} />
|
|
90
|
-
<InputOTPSlot index={1} />
|
|
91
|
-
<InputOTPSlot index={2} />
|
|
92
|
-
</InputOTPGroup>
|
|
93
|
-
<InputOTPSeparator />
|
|
94
|
-
<InputOTPGroup>
|
|
95
|
-
<InputOTPSlot index={3} />
|
|
96
|
-
<InputOTPSlot index={4} />
|
|
97
|
-
<InputOTPSlot index={5} />
|
|
98
|
-
</InputOTPGroup>
|
|
99
|
-
</InputOTP>
|
|
100
|
-
|
|
101
|
-
// 受控
|
|
102
|
-
const [v, setV] = React.useState('');
|
|
103
|
-
<InputOTP maxLength={6} value={v} onChange={setV}>
|
|
104
|
-
<InputOTPGroup>...</InputOTPGroup>
|
|
105
|
-
</InputOTP>
|
|
106
|
-
```
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
|
-
import { REGEXP_ONLY_DIGITS } from 'input-otp';
|
|
4
|
-
import {
|
|
5
|
-
InputOTP,
|
|
6
|
-
InputOTPGroup,
|
|
7
|
-
InputOTPSlot,
|
|
8
|
-
InputOTPSeparator,
|
|
9
|
-
} from './input-otp';
|
|
10
|
-
|
|
11
|
-
const meta: Meta<typeof InputOTP> = {
|
|
12
|
-
title: '废弃 · Deprecated/InputOTP',
|
|
13
|
-
component: InputOTP,
|
|
14
|
-
tags: ['autodocs'],
|
|
15
|
-
parameters: {
|
|
16
|
-
docs: {
|
|
17
|
-
description: {
|
|
18
|
-
component:
|
|
19
|
-
'⚠️ **已废弃** — 仅 Storybook 留档,不通过 manifest 对外发布。\n\n一次性密码输入 — 短信 / 邮箱验证码场景的格式化输入,每位字符独立可视 slot。基于 [`input-otp`](https://input-otp.rodz.dev/) 实现,自动处理粘贴、键盘前后切换、IME 与 SMS autofill;通过 `pattern` 限制输入字符集(数字 / 字母数字)。shadcn 专有能力,填补 antd 未提供的验证码输入场景。',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default meta;
|
|
26
|
-
type Story = StoryObj<typeof InputOTP>;
|
|
27
|
-
|
|
28
|
-
export const SixDigits: Story = {
|
|
29
|
-
render: () => {
|
|
30
|
-
const [v, setV] = React.useState('');
|
|
31
|
-
return (
|
|
32
|
-
<InputOTP
|
|
33
|
-
maxLength={6}
|
|
34
|
-
pattern={REGEXP_ONLY_DIGITS}
|
|
35
|
-
value={v}
|
|
36
|
-
onChange={setV}
|
|
37
|
-
>
|
|
38
|
-
<InputOTPGroup>
|
|
39
|
-
{[0, 1, 2, 3, 4, 5].map((i) => (
|
|
40
|
-
<InputOTPSlot key={i} index={i} />
|
|
41
|
-
))}
|
|
42
|
-
</InputOTPGroup>
|
|
43
|
-
</InputOTP>
|
|
44
|
-
);
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const Grouped: Story = {
|
|
49
|
-
parameters: { controls: { disable: true } },
|
|
50
|
-
render: () => (
|
|
51
|
-
<InputOTP maxLength={6} pattern={REGEXP_ONLY_DIGITS}>
|
|
52
|
-
<InputOTPGroup>
|
|
53
|
-
<InputOTPSlot index={0} />
|
|
54
|
-
<InputOTPSlot index={1} />
|
|
55
|
-
<InputOTPSlot index={2} />
|
|
56
|
-
</InputOTPGroup>
|
|
57
|
-
<InputOTPSeparator />
|
|
58
|
-
<InputOTPGroup>
|
|
59
|
-
<InputOTPSlot index={3} />
|
|
60
|
-
<InputOTPSlot index={4} />
|
|
61
|
-
<InputOTPSlot index={5} />
|
|
62
|
-
</InputOTPGroup>
|
|
63
|
-
</InputOTP>
|
|
64
|
-
),
|
|
65
|
-
};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { OTPInput, OTPInputContext } from 'input-otp';
|
|
3
|
-
import { Dot } from 'lucide-react';
|
|
4
|
-
|
|
5
|
-
import { cn } from '@/utils/cn';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* InputOTP 自身的可定制属性。底层 `OTPInput` 的所有 props
|
|
9
|
-
* (`maxLength` / `pattern` / `value` / `onChange` / `onComplete` /
|
|
10
|
-
* `children` / `render` / ...)由 input-otp 透传。
|
|
11
|
-
*/
|
|
12
|
-
export interface InputOTPProps {
|
|
13
|
-
/**
|
|
14
|
-
* 输入框 className,作用在隐藏的真实 input 上;通常无需关心。
|
|
15
|
-
*/
|
|
16
|
-
className?: string;
|
|
17
|
-
/**
|
|
18
|
-
* 容器 className,作用在 slot 列表外层 wrapper 上,
|
|
19
|
-
* 用于覆盖默认的 `flex items-center gap-2`。
|
|
20
|
-
*/
|
|
21
|
-
containerClassName?: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function InputOTP({
|
|
25
|
-
className,
|
|
26
|
-
containerClassName,
|
|
27
|
-
...props
|
|
28
|
-
}: InputOTPProps & React.ComponentPropsWithoutRef<typeof OTPInput>) {
|
|
29
|
-
return (
|
|
30
|
-
<OTPInput
|
|
31
|
-
containerClassName={cn(
|
|
32
|
-
'flex items-center gap-2 has-[:disabled]:opacity-50',
|
|
33
|
-
containerClassName,
|
|
34
|
-
)}
|
|
35
|
-
className={cn('disabled:cursor-not-allowed', className)}
|
|
36
|
-
{...props}
|
|
37
|
-
/>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
InputOTP.displayName = 'InputOTP';
|
|
41
|
-
|
|
42
|
-
const InputOTPGroup = React.forwardRef<
|
|
43
|
-
React.ElementRef<'div'>,
|
|
44
|
-
React.ComponentPropsWithoutRef<'div'>
|
|
45
|
-
>(({ className, ...props }, ref) => (
|
|
46
|
-
<div ref={ref} className={cn('flex items-center', className)} {...props} />
|
|
47
|
-
));
|
|
48
|
-
InputOTPGroup.displayName = 'InputOTPGroup';
|
|
49
|
-
|
|
50
|
-
export interface InputOTPSlotProps
|
|
51
|
-
extends React.ComponentPropsWithoutRef<'div'> {
|
|
52
|
-
/** Slot 索引(必传)。OTP 的 slots 数组下标。 */
|
|
53
|
-
index: number;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const InputOTPSlot = React.forwardRef<
|
|
57
|
-
React.ElementRef<'div'>,
|
|
58
|
-
InputOTPSlotProps
|
|
59
|
-
>(({ index, className, ...props }, ref) => {
|
|
60
|
-
const inputOTPContext = React.useContext(OTPInputContext);
|
|
61
|
-
const slot = inputOTPContext.slots[index];
|
|
62
|
-
const char = slot?.char;
|
|
63
|
-
const hasFakeCaret = slot?.hasFakeCaret;
|
|
64
|
-
const isActive = slot?.isActive;
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<div
|
|
68
|
-
ref={ref}
|
|
69
|
-
className={cn(
|
|
70
|
-
'relative flex size-10 items-center justify-center border-y border-r border-input text-xs shadow-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md',
|
|
71
|
-
isActive && 'z-10 ring-1 ring-ring',
|
|
72
|
-
className,
|
|
73
|
-
)}
|
|
74
|
-
{...props}
|
|
75
|
-
>
|
|
76
|
-
{char}
|
|
77
|
-
{hasFakeCaret ? (
|
|
78
|
-
<div className="pointer-events-none absolute inset-0 flex items-center justify-center">
|
|
79
|
-
<div className="h-4 w-px animate-caret-blink bg-foreground duration-1000" />
|
|
80
|
-
</div>
|
|
81
|
-
) : null}
|
|
82
|
-
</div>
|
|
83
|
-
);
|
|
84
|
-
});
|
|
85
|
-
InputOTPSlot.displayName = 'InputOTPSlot';
|
|
86
|
-
|
|
87
|
-
const InputOTPSeparator = React.forwardRef<
|
|
88
|
-
React.ElementRef<'div'>,
|
|
89
|
-
React.ComponentPropsWithoutRef<'div'>
|
|
90
|
-
>(({ ...props }, ref) => (
|
|
91
|
-
<div ref={ref} role="separator" {...props}>
|
|
92
|
-
<Dot className="size-4" />
|
|
93
|
-
</div>
|
|
94
|
-
));
|
|
95
|
-
InputOTPSeparator.displayName = 'InputOTPSeparator';
|
|
96
|
-
|
|
97
|
-
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: item
|
|
3
|
-
name: Item
|
|
4
|
-
type: component
|
|
5
|
-
category: data-display
|
|
6
|
-
since: 0.1.0
|
|
7
|
-
package: '@teamix-evo/ui'
|
|
8
|
-
displayName: 列表项
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Item 列表项
|
|
12
|
-
|
|
13
|
-
通用列表项 / 卡片项容器 — shadcn 2025-10 新增。**取代我们之前自实现的 `List.Item` + `List.Item.Meta`**(antd 老 List 在 v6 已 deprecated)。用 5 个语义槽组合:`ItemMedia` 媒体 / `ItemContent` 主体 / `ItemTitle` 标题 / `ItemDescription` 描述 / `ItemActions` 操作。排列用 `ItemGroup`(纵向 + 分隔)或自行 div / ul 自由布局。
|
|
14
|
-
|
|
15
|
-
## When to use
|
|
16
|
-
|
|
17
|
-
- 消息流 / 通知列表的单条
|
|
18
|
-
- 设置项(标题 + 描述 + 开关 / 按钮)
|
|
19
|
-
- 文件 / 联系人 / 任务卡片化展示
|
|
20
|
-
- 配 Flex / Grid / Card / Sidebar 自由组合排列容器
|
|
21
|
-
|
|
22
|
-
## When NOT to use
|
|
23
|
-
|
|
24
|
-
- 结构化数据(有列对齐 / 排序)→ `Table` / `DataTable`
|
|
25
|
-
- 完整业务卡片(带 Header / Cover / Footer)→ `Card`
|
|
26
|
-
- 树形嵌套 → `Tree`
|
|
27
|
-
|
|
28
|
-
## Props
|
|
29
|
-
|
|
30
|
-
<!-- auto:props:begin -->
|
|
31
|
-
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|
|
32
|
-
| --- | --- | --- | --- | --- |
|
|
33
|
-
| `variant` | `'default' \| 'outline' \| 'muted'` | `"default"` | – | 视觉变体 — `default` 透明无边框(嵌入 List / Group 用);`outline` 卡片化(独立卡片);`muted` 灰底卡片。 |
|
|
34
|
-
| `interactive` | `boolean` | `false` | – | 是否带 hover 高亮 + cursor-pointer(行可点击场景)。 |
|
|
35
|
-
<!-- auto:props:end -->
|
|
36
|
-
|
|
37
|
-
## 依赖
|
|
38
|
-
|
|
39
|
-
<!-- auto:deps:begin -->
|
|
40
|
-
### 同库依赖
|
|
41
|
-
|
|
42
|
-
> `teamix-evo ui add item` 时,以下 entry 会被自动连带安装(无需手动 add)。
|
|
43
|
-
|
|
44
|
-
| Entry | 类型 | 描述 |
|
|
45
|
-
| --- | --- | --- |
|
|
46
|
-
| `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
|
|
47
|
-
|
|
48
|
-
### npm 依赖
|
|
49
|
-
|
|
50
|
-
> 业务侧需要先 `pnpm add` / `npm install` 这些包。CLI 在 `ui add` 完成后会列出此提示。
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
pnpm add class-variance-authority@^0.7.0
|
|
54
|
-
```
|
|
55
|
-
<!-- auto:deps:end -->
|
|
56
|
-
|
|
57
|
-
## AI 生成纪律
|
|
58
|
-
|
|
59
|
-
- **5 个槽是约定不是强制**:`Item` 内子节点顺序就是渲染顺序,可以只用 `ItemContent + ItemActions`,也可以五个都用
|
|
60
|
-
- **`ItemContent`** 必须放主体内容,它有 `min-w-0 flex-1` 用来对抗 truncate;不要外面再裹 div
|
|
61
|
-
- **`ItemTitle / ItemDescription` 自带 `truncate`** — 不希望截断的场景请覆盖 `className="whitespace-normal"`
|
|
62
|
-
- **`variant="default"`(默认)透明无边框** — 嵌入 `ItemGroup` / `List` / `Sidebar` 容器使用
|
|
63
|
-
- **`variant="outline"` 卡片化** — 独立单 Item 卡片(关注小白卡 / 消息中心整条)
|
|
64
|
-
- **`interactive=true` 等价 cursor-pointer + hover 高亮** — 配合 `onClick` 或外层 `<a>` 包裹;**不要**给 Item 加 `role="button"`,完整按钮请用 Button
|
|
65
|
-
|
|
66
|
-
## Examples
|
|
67
|
-
|
|
68
|
-
```tsx
|
|
69
|
-
import {
|
|
70
|
-
Item,
|
|
71
|
-
ItemMedia,
|
|
72
|
-
ItemContent,
|
|
73
|
-
ItemTitle,
|
|
74
|
-
ItemDescription,
|
|
75
|
-
ItemActions,
|
|
76
|
-
ItemGroup,
|
|
77
|
-
} from '@/components/ui/item';
|
|
78
|
-
import { Avatar, AvatarFallback } from '@/components/ui/avatar';
|
|
79
|
-
import { Button } from '@/components/ui/button';
|
|
80
|
-
import { Switch } from '@/components/ui/switch';
|
|
81
|
-
|
|
82
|
-
// 设置项
|
|
83
|
-
<Item>
|
|
84
|
-
<ItemContent>
|
|
85
|
-
<ItemTitle>邮件通知</ItemTitle>
|
|
86
|
-
<ItemDescription>有重要事件时给我发邮件</ItemDescription>
|
|
87
|
-
</ItemContent>
|
|
88
|
-
<ItemActions>
|
|
89
|
-
<Switch defaultChecked />
|
|
90
|
-
</ItemActions>
|
|
91
|
-
</Item>
|
|
92
|
-
|
|
93
|
-
// 联系人列表
|
|
94
|
-
<ItemGroup>
|
|
95
|
-
{users.map((u) => (
|
|
96
|
-
<Item key={u.id} interactive>
|
|
97
|
-
<ItemMedia>
|
|
98
|
-
<Avatar><AvatarFallback>{u.initials}</AvatarFallback></Avatar>
|
|
99
|
-
</ItemMedia>
|
|
100
|
-
<ItemContent>
|
|
101
|
-
<ItemTitle>{u.name}</ItemTitle>
|
|
102
|
-
<ItemDescription>{u.email}</ItemDescription>
|
|
103
|
-
</ItemContent>
|
|
104
|
-
<ItemActions>
|
|
105
|
-
<Button variant="ghost" size="sm">邀请</Button>
|
|
106
|
-
</ItemActions>
|
|
107
|
-
</Item>
|
|
108
|
-
))}
|
|
109
|
-
</ItemGroup>
|
|
110
|
-
|
|
111
|
-
// 独立卡片化 Item
|
|
112
|
-
<Item variant="outline" interactive>
|
|
113
|
-
<ItemContent>
|
|
114
|
-
<ItemTitle>升级到 Pro</ItemTitle>
|
|
115
|
-
<ItemDescription>解锁更多组件与高级模板</ItemDescription>
|
|
116
|
-
</ItemContent>
|
|
117
|
-
<ItemActions>
|
|
118
|
-
<Button>升级</Button>
|
|
119
|
-
</ItemActions>
|
|
120
|
-
</Item>
|
|
121
|
-
```
|