@teamix-evo/ui 0.2.0 → 0.3.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.
Files changed (282) hide show
  1. package/README.md +184 -184
  2. package/manifest.json +680 -492
  3. package/package.json +15 -9
  4. package/src/components/accordion/accordion.meta.md +5 -9
  5. package/src/components/accordion/accordion.stories.tsx +3 -3
  6. package/src/components/accordion/accordion.tsx +104 -8
  7. package/src/components/affix/affix.meta.md +21 -12
  8. package/src/components/affix/affix.stories.tsx +101 -26
  9. package/src/components/affix/affix.tsx +79 -9
  10. package/src/components/alert/alert.meta.md +52 -26
  11. package/src/components/alert/alert.stories.tsx +66 -21
  12. package/src/components/alert/alert.tsx +81 -34
  13. package/src/components/alert-dialog/alert-dialog.meta.md +48 -16
  14. package/src/components/alert-dialog/alert-dialog.stories.tsx +145 -3
  15. package/src/components/alert-dialog/alert-dialog.tsx +60 -13
  16. package/src/components/anchor/anchor.meta.md +10 -14
  17. package/src/components/anchor/anchor.stories.tsx +3 -3
  18. package/src/components/anchor/anchor.tsx +2 -2
  19. package/src/components/app/app.meta.md +10 -14
  20. package/src/components/app/app.stories.tsx +6 -6
  21. package/src/components/aspect-ratio/aspect-ratio.meta.md +4 -8
  22. package/src/components/aspect-ratio/aspect-ratio.stories.tsx +3 -3
  23. package/src/components/auto-complete/auto-complete.meta.md +19 -20
  24. package/src/components/auto-complete/auto-complete.stories.tsx +44 -3
  25. package/src/components/auto-complete/auto-complete.tsx +119 -71
  26. package/src/components/avatar/avatar.meta.md +9 -22
  27. package/src/components/avatar/avatar.stories.tsx +21 -3
  28. package/src/components/avatar/avatar.tsx +24 -23
  29. package/src/components/badge/badge.meta.md +14 -18
  30. package/src/components/badge/badge.stories.tsx +2 -2
  31. package/src/components/badge/badge.tsx +2 -2
  32. package/src/components/breadcrumb/breadcrumb.meta.md +29 -20
  33. package/src/components/breadcrumb/breadcrumb.stories.tsx +120 -5
  34. package/src/components/breadcrumb/breadcrumb.tsx +22 -8
  35. package/src/components/button/button.meta.md +261 -29
  36. package/src/components/button/button.stories.tsx +549 -41
  37. package/src/components/button/button.tsx +335 -33
  38. package/src/components/calendar/calendar.meta.md +19 -14
  39. package/src/components/calendar/calendar.stories.tsx +5 -5
  40. package/src/components/calendar/calendar.tsx +73 -8
  41. package/src/components/card/card.meta.md +31 -34
  42. package/src/components/card/card.stories.tsx +34 -3
  43. package/src/components/card/card.tsx +146 -63
  44. package/src/components/carousel/carousel.meta.md +10 -14
  45. package/src/components/carousel/carousel.stories.tsx +1 -1
  46. package/src/components/cascader/cascader.meta.md +43 -22
  47. package/src/components/cascader/cascader.stories.tsx +13 -2
  48. package/src/components/cascader/cascader.tsx +427 -84
  49. package/src/components/checkbox/checkbox.meta.md +74 -24
  50. package/src/components/checkbox/checkbox.stories.tsx +160 -2
  51. package/src/components/checkbox/checkbox.tsx +77 -9
  52. package/src/components/collapsible/collapsible.meta.md +7 -6
  53. package/src/components/collapsible/collapsible.stories.tsx +2 -2
  54. package/src/components/collapsible/collapsible.tsx +93 -6
  55. package/src/components/color-picker/color-picker.meta.md +16 -20
  56. package/src/components/color-picker/color-picker.stories.tsx +86 -7
  57. package/src/components/color-picker/color-picker.tsx +19 -9
  58. package/src/components/command/command.meta.md +7 -11
  59. package/src/components/command/command.stories.tsx +4 -4
  60. package/src/components/command/command.tsx +18 -7
  61. package/src/components/context-menu/context-menu.meta.md +5 -25
  62. package/src/components/context-menu/context-menu.stories.tsx +4 -4
  63. package/src/components/context-menu/context-menu.tsx +21 -8
  64. package/src/components/data-table/data-table.meta.md +14 -18
  65. package/src/components/data-table/data-table.stories.tsx +1 -1
  66. package/src/components/data-table/data-table.tsx +2 -2
  67. package/src/components/date-picker/date-picker.meta.md +90 -41
  68. package/src/components/date-picker/date-picker.stories.tsx +55 -5
  69. package/src/components/date-picker/date-picker.tsx +1489 -91
  70. package/src/components/descriptions/descriptions.meta.md +12 -16
  71. package/src/components/descriptions/descriptions.stories.tsx +2 -2
  72. package/src/components/descriptions/descriptions.tsx +22 -14
  73. package/src/components/dialog/dialog.meta.md +67 -17
  74. package/src/components/dialog/dialog.stories.tsx +182 -20
  75. package/src/components/dialog/dialog.tsx +67 -15
  76. package/src/components/dialog/imperative.tsx +252 -0
  77. package/src/components/drawer/drawer.meta.md +27 -39
  78. package/src/components/drawer/drawer.stories.tsx +29 -12
  79. package/src/components/drawer/drawer.tsx +22 -114
  80. package/src/components/dropdown-menu/dropdown-menu.meta.md +64 -24
  81. package/src/components/dropdown-menu/dropdown-menu.stories.tsx +81 -3
  82. package/src/components/dropdown-menu/dropdown-menu.tsx +24 -10
  83. package/src/components/ellipsis/ellipsis.meta.md +87 -0
  84. package/src/components/ellipsis/ellipsis.stories.tsx +72 -0
  85. package/src/components/ellipsis/ellipsis.tsx +153 -0
  86. package/src/components/empty/empty.meta.md +10 -14
  87. package/src/components/empty/empty.stories.tsx +3 -3
  88. package/src/components/empty/empty.tsx +10 -3
  89. package/src/components/field/field.meta.md +46 -25
  90. package/src/components/field/field.stories.tsx +380 -3
  91. package/src/components/field/field.tsx +263 -35
  92. package/src/components/filter-bar/filter-bar.meta.md +92 -0
  93. package/src/components/filter-bar/filter-bar.stories.tsx +1083 -0
  94. package/src/components/filter-bar/filter-bar.tsx +568 -0
  95. package/src/components/flex/flex.meta.md +59 -20
  96. package/src/components/flex/flex.stories.tsx +65 -10
  97. package/src/components/flex/flex.tsx +27 -4
  98. package/src/components/float-button/float-button.meta.md +10 -29
  99. package/src/components/float-button/float-button.stories.tsx +6 -6
  100. package/src/components/form/form.meta.md +31 -52
  101. package/src/components/form/form.stories.tsx +350 -3
  102. package/src/components/form/form.tsx +101 -35
  103. package/src/components/grid/grid.meta.md +4 -24
  104. package/src/components/grid/grid.stories.tsx +2 -2
  105. package/src/components/hover-card/hover-card.meta.md +9 -10
  106. package/src/components/hover-card/hover-card.stories.tsx +29 -4
  107. package/src/components/hover-card/hover-card.tsx +51 -13
  108. package/src/components/icon/DEVELOPMENT.md +809 -0
  109. package/src/components/icon/icon.meta.md +170 -0
  110. package/src/components/icon/icon.stories.tsx +344 -0
  111. package/src/components/icon/icon.tsx +248 -0
  112. package/src/components/image/image.meta.md +14 -18
  113. package/src/components/image/image.stories.tsx +3 -3
  114. package/src/components/image/image.tsx +2 -0
  115. package/src/components/input/demo/sizes.tsx +2 -2
  116. package/src/components/input/input.meta.md +44 -43
  117. package/src/components/input/input.stories.tsx +62 -35
  118. package/src/components/input/input.tsx +96 -101
  119. package/src/components/input-group/input-group.meta.md +53 -39
  120. package/src/components/input-group/input-group.stories.tsx +49 -16
  121. package/src/components/input-group/input-group.tsx +43 -8
  122. package/src/components/input-number/input-number.meta.md +68 -20
  123. package/src/components/input-number/input-number.stories.tsx +33 -6
  124. package/src/components/input-number/input-number.tsx +79 -20
  125. package/src/components/input-otp/input-otp.meta.md +8 -20
  126. package/src/components/input-otp/input-otp.stories.tsx +3 -3
  127. package/src/components/input-otp/input-otp.tsx +1 -1
  128. package/src/components/item/item.meta.md +8 -26
  129. package/src/components/item/item.stories.tsx +3 -3
  130. package/src/components/item/item.tsx +7 -6
  131. package/src/components/kbd/kbd.meta.md +7 -19
  132. package/src/components/kbd/kbd.stories.tsx +4 -4
  133. package/src/components/kbd/kbd.tsx +8 -4
  134. package/src/components/label/label.meta.md +21 -18
  135. package/src/components/label/label.stories.tsx +64 -6
  136. package/src/components/label/label.tsx +91 -19
  137. package/src/components/masonry/masonry.meta.md +8 -12
  138. package/src/components/masonry/masonry.stories.tsx +4 -4
  139. package/src/components/mentions/mentions.meta.md +42 -21
  140. package/src/components/mentions/mentions.stories.tsx +120 -6
  141. package/src/components/mentions/mentions.tsx +10 -5
  142. package/src/components/menubar/menubar.meta.md +4 -8
  143. package/src/components/menubar/menubar.stories.tsx +55 -3
  144. package/src/components/menubar/menubar.tsx +9 -9
  145. package/src/components/native-select/native-select.meta.md +7 -11
  146. package/src/components/native-select/native-select.stories.tsx +4 -4
  147. package/src/components/native-select/native-select.tsx +1 -1
  148. package/src/components/navigation-menu/navigation-menu.meta.md +4 -8
  149. package/src/components/navigation-menu/navigation-menu.stories.tsx +106 -3
  150. package/src/components/navigation-menu/navigation-menu.tsx +6 -3
  151. package/src/components/notification/notification.meta.md +41 -8
  152. package/src/components/notification/notification.stories.tsx +9 -9
  153. package/src/components/notification/notification.tsx +34 -19
  154. package/src/components/page-header/DEVELOPMENT.md +842 -0
  155. package/src/components/page-header/page-header.meta.md +208 -0
  156. package/src/components/page-header/page-header.stories.tsx +421 -0
  157. package/src/components/page-header/page-header.tsx +281 -0
  158. package/src/components/pagination/pagination.meta.md +122 -50
  159. package/src/components/pagination/pagination.stories.tsx +227 -11
  160. package/src/components/pagination/pagination.tsx +355 -63
  161. package/src/components/popconfirm/popconfirm.meta.md +19 -23
  162. package/src/components/popconfirm/popconfirm.stories.tsx +2 -2
  163. package/src/components/popconfirm/popconfirm.tsx +1 -1
  164. package/src/components/popover/popover.meta.md +64 -12
  165. package/src/components/popover/popover.stories.tsx +83 -7
  166. package/src/components/popover/popover.tsx +77 -28
  167. package/src/components/progress/progress.meta.md +43 -26
  168. package/src/components/progress/progress.stories.tsx +2 -2
  169. package/src/components/progress/progress.tsx +19 -11
  170. package/src/components/radio-group/radio-group.meta.md +78 -11
  171. package/src/components/radio-group/radio-group.stories.tsx +38 -2
  172. package/src/components/radio-group/radio-group.tsx +149 -18
  173. package/src/components/rate/rate.meta.md +41 -19
  174. package/src/components/rate/rate.stories.tsx +2 -2
  175. package/src/components/rate/rate.tsx +37 -10
  176. package/src/components/resizable/resizable.meta.md +4 -12
  177. package/src/components/resizable/resizable.stories.tsx +5 -5
  178. package/src/components/resizable/resizable.tsx +1 -1
  179. package/src/components/result/result.meta.md +10 -14
  180. package/src/components/result/result.stories.tsx +2 -2
  181. package/src/components/result/result.tsx +21 -12
  182. package/src/components/scroll-area/scroll-area.meta.md +4 -8
  183. package/src/components/scroll-area/scroll-area.stories.tsx +5 -5
  184. package/src/components/segmented/segmented.meta.md +15 -17
  185. package/src/components/segmented/segmented.stories.tsx +3 -3
  186. package/src/components/segmented/segmented.tsx +15 -7
  187. package/src/components/select/select.meta.md +199 -67
  188. package/src/components/select/select.stories.tsx +238 -63
  189. package/src/components/select/select.tsx +718 -171
  190. package/src/components/separator/separator.meta.md +10 -14
  191. package/src/components/separator/separator.stories.tsx +2 -2
  192. package/src/components/separator/separator.tsx +3 -7
  193. package/src/components/sheet/sheet.meta.md +26 -21
  194. package/src/components/sheet/sheet.stories.tsx +116 -10
  195. package/src/components/sheet/sheet.tsx +116 -29
  196. package/src/components/sidebar/sidebar.meta.md +28 -38
  197. package/src/components/sidebar/sidebar.stories.tsx +696 -29
  198. package/src/components/sidebar/sidebar.tsx +615 -142
  199. package/src/components/skeleton/skeleton.meta.md +7 -31
  200. package/src/components/skeleton/skeleton.stories.tsx +3 -3
  201. package/src/components/skeleton/skeleton.tsx +7 -7
  202. package/src/components/slider/slider.meta.md +60 -13
  203. package/src/components/slider/slider.stories.tsx +58 -6
  204. package/src/components/slider/slider.tsx +154 -13
  205. package/src/components/sonner/sonner.meta.md +54 -8
  206. package/src/components/sonner/sonner.stories.tsx +79 -11
  207. package/src/components/sonner/sonner.tsx +137 -8
  208. package/src/components/spinner/spinner.meta.md +57 -21
  209. package/src/components/spinner/spinner.stories.tsx +66 -14
  210. package/src/components/spinner/spinner.tsx +111 -9
  211. package/src/components/statistic/statistic.meta.md +14 -30
  212. package/src/components/statistic/statistic.stories.tsx +1 -1
  213. package/src/components/statistic/statistic.tsx +4 -5
  214. package/src/components/steps/steps.meta.md +20 -15
  215. package/src/components/steps/steps.stories.tsx +37 -2
  216. package/src/components/steps/steps.tsx +15 -12
  217. package/src/components/switch/switch.meta.md +56 -15
  218. package/src/components/switch/switch.stories.tsx +5 -5
  219. package/src/components/switch/switch.tsx +59 -13
  220. package/src/components/table/table.meta.md +3 -7
  221. package/src/components/table/table.stories.tsx +1 -1
  222. package/src/components/table/table.tsx +4 -4
  223. package/src/components/tabs/tabs.meta.md +40 -32
  224. package/src/components/tabs/tabs.stories.tsx +104 -26
  225. package/src/components/tabs/tabs.tsx +125 -54
  226. package/src/components/tag/tag.meta.md +104 -68
  227. package/src/components/tag/tag.stories.tsx +183 -15
  228. package/src/components/tag/tag.tsx +222 -21
  229. package/src/components/textarea/textarea.meta.md +42 -31
  230. package/src/components/textarea/textarea.stories.tsx +32 -6
  231. package/src/components/textarea/textarea.tsx +32 -8
  232. package/src/components/time-picker/time-picker.meta.md +119 -50
  233. package/src/components/time-picker/time-picker.stories.tsx +65 -33
  234. package/src/components/time-picker/time-picker.tsx +889 -101
  235. package/src/components/timeline/timeline.meta.md +16 -17
  236. package/src/components/timeline/timeline.stories.tsx +24 -4
  237. package/src/components/timeline/timeline.tsx +32 -12
  238. package/src/components/toggle/toggle.meta.md +8 -12
  239. package/src/components/toggle/toggle.stories.tsx +4 -4
  240. package/src/components/toggle/toggle.tsx +4 -3
  241. package/src/components/toggle-group/toggle-group.meta.md +10 -14
  242. package/src/components/toggle-group/toggle-group.stories.tsx +3 -3
  243. package/src/components/toggle-group/toggle-group.tsx +2 -2
  244. package/src/components/tooltip/tooltip.meta.md +63 -18
  245. package/src/components/tooltip/tooltip.stories.tsx +42 -5
  246. package/src/components/tooltip/tooltip.tsx +81 -21
  247. package/src/components/tour/tour.meta.md +16 -20
  248. package/src/components/tour/tour.stories.tsx +3 -3
  249. package/src/components/tour/tour.tsx +3 -3
  250. package/src/components/transfer/transfer.meta.md +18 -22
  251. package/src/components/transfer/transfer.stories.tsx +2 -2
  252. package/src/components/transfer/transfer.tsx +28 -21
  253. package/src/components/tree/tree.meta.md +67 -22
  254. package/src/components/tree/tree.stories.tsx +1 -1
  255. package/src/components/tree/tree.tsx +9 -8
  256. package/src/components/tree-select/tree-select.meta.md +59 -23
  257. package/src/components/tree-select/tree-select.stories.tsx +2 -2
  258. package/src/components/tree-select/tree-select.tsx +42 -7
  259. package/src/components/typography/typography.meta.md +61 -39
  260. package/src/components/typography/typography.stories.tsx +14 -9
  261. package/src/components/typography/typography.tsx +38 -25
  262. package/src/components/upload/upload.meta.md +61 -25
  263. package/src/components/upload/upload.stories.tsx +69 -3
  264. package/src/components/upload/upload.tsx +170 -37
  265. package/src/components/watermark/watermark.meta.md +15 -19
  266. package/src/components/watermark/watermark.stories.tsx +98 -8
  267. package/src/hooks/use-breakpoint.ts +117 -0
  268. package/src/hooks/use-debounce-callback.ts +52 -0
  269. package/src/hooks/use-mobile.ts +23 -0
  270. package/src/stories/theme-tokens.stories.tsx +747 -0
  271. package/src/utils/trigger-input.ts +53 -0
  272. package/src/components/button-group/button-group.meta.md +0 -101
  273. package/src/components/button-group/button-group.stories.tsx +0 -93
  274. package/src/components/button-group/button-group.tsx +0 -75
  275. package/src/components/combobox/combobox.meta.md +0 -102
  276. package/src/components/combobox/combobox.stories.tsx +0 -55
  277. package/src/components/combobox/combobox.tsx +0 -130
  278. package/src/components/input/demo/addon.tsx +0 -15
  279. package/src/components/input/demo/with-prefix-suffix.tsx +0 -19
  280. package/src/components/space/space.meta.md +0 -103
  281. package/src/components/space/space.stories.tsx +0 -108
  282. package/src/components/space/space.tsx +0 -106
@@ -1,22 +1,27 @@
1
1
  import * as React from 'react';
2
- import type { Meta, StoryObj } from '@storybook/react';
3
- import { Mail, Search } from 'lucide-react';
2
+ import type { Meta, StoryObj } from '@storybook/react-vite';
3
+ import { Search } from 'lucide-react';
4
4
  import { Input } from './input';
5
+ import {
6
+ InputGroup,
7
+ InputGroupAddon,
8
+ InputGroupInput,
9
+ } from '@/components/input-group/input-group';
5
10
 
6
11
  const meta: Meta<typeof Input> = {
7
- title: '表单与输入 · Form/Input',
12
+ title: '数据录入 · Data Entry/Input',
8
13
  component: Input,
9
14
  tags: ['autodocs'],
10
15
  parameters: {
11
16
  docs: {
12
17
  description: {
13
18
  component:
14
- '输入框 — 文本 / 邮箱 / 密码 / 搜索等单行输入。shadcn 原生 `<input>` 风格 + antd 扩展:`size` 三档、`prefix` / `suffix` 前后缀、`addonBefore` / `addonAfter` 外联组、`clearable` 一键清空、`showCount` + `maxLength` 字数统计。',
19
+ '输入框 — shadcn 简洁基底 + antd 并集中保留为内建逻辑能力的:`size` 三档(sm/md/lg,与 `Button` 同档)、`clearable` 一键清空、`showCount` + `maxLength` 字数统计、`error` / `aria-invalid` 错误态。**前后缀 / 单位 / 协议头 / 内嵌按钮**等"装饰类"形态请用同库 `InputGroup` 复合插槽(见下方 `WithInputGroup` 示例)— 单一职责更清晰,与 shadcn 2025-10 拆分对齐(ADR 0029)。',
15
20
  },
16
21
  },
17
22
  },
18
23
  argTypes: {
19
- size: { control: 'inline-radio', options: ['sm', 'default', 'lg'] },
24
+ size: { control: 'inline-radio', options: ['sm', 'md', 'lg'] },
20
25
  type: {
21
26
  control: 'select',
22
27
  options: ['text', 'email', 'password', 'search', 'tel', 'url'],
@@ -24,15 +29,17 @@ const meta: Meta<typeof Input> = {
24
29
  clearable: { control: 'boolean' },
25
30
  showCount: { control: 'boolean' },
26
31
  disabled: { control: 'boolean' },
32
+ error: { control: 'boolean' },
27
33
  placeholder: { control: 'text' },
28
34
  maxLength: { control: 'number' },
29
35
  },
30
36
  args: {
31
- size: 'default',
37
+ size: 'md',
32
38
  type: 'text',
33
39
  clearable: false,
34
40
  showCount: false,
35
41
  disabled: false,
42
+ error: false,
36
43
  placeholder: '请输入...',
37
44
  },
38
45
  decorators: [
@@ -53,35 +60,9 @@ export const Sizes: Story = {
53
60
  parameters: { controls: { disable: true } },
54
61
  render: () => (
55
62
  <div className="flex flex-col gap-3">
56
- <Input size="sm" placeholder="Small" />
57
- <Input size="default" placeholder="Default" />
58
- <Input size="lg" placeholder="Large" />
59
- </div>
60
- ),
61
- };
62
-
63
- export const PrefixSuffix: Story = {
64
- parameters: { controls: { disable: true } },
65
- render: () => (
66
- <div className="flex flex-col gap-3">
67
- <Input prefix={<Search />} placeholder="搜索..." />
68
- <Input type="email" suffix={<Mail />} placeholder="you@example.com" />
69
- <Input prefix="¥" suffix="USD" placeholder="0.00" />
70
- </div>
71
- ),
72
- };
73
-
74
- export const Addon: Story = {
75
- parameters: { controls: { disable: true } },
76
- render: () => (
77
- <div className="flex flex-col gap-3">
78
- <Input
79
- addonBefore="https://"
80
- defaultValue="teamix-evo"
81
- addonAfter=".com"
82
- />
83
- <Input addonBefore="@" placeholder="username" />
84
- <Input addonAfter="kg" defaultValue="42" />
63
+ <Input size="sm" placeholder="Small (h-6 / text-xs / 24px)" />
64
+ <Input size="md" placeholder="Medium (h-8 / text-xs / 32px)" />
65
+ <Input size="lg" placeholder="Large (h-9 / text-sm / 36px)" />
85
66
  </div>
86
67
  ),
87
68
  };
@@ -106,6 +87,16 @@ export const ShowCount: Story = {
106
87
  render: () => <Input showCount maxLength={140} placeholder="发布动态" />,
107
88
  };
108
89
 
90
+ export const Error: Story = {
91
+ parameters: { controls: { disable: true } },
92
+ render: () => (
93
+ <div className="flex flex-col gap-3">
94
+ <Input error placeholder="必填" />
95
+ <Input error defaultValue="非法值" />
96
+ </div>
97
+ ),
98
+ };
99
+
109
100
  export const Disabled: Story = {
110
101
  parameters: { controls: { disable: true } },
111
102
  render: () => (
@@ -115,3 +106,39 @@ export const Disabled: Story = {
115
106
  </div>
116
107
  ),
117
108
  };
109
+
110
+ /**
111
+ * 想加图标 / 单位 / 协议头?用 `InputGroup` 复合插槽 — 不再用已废弃的
112
+ * `prefix` / `suffix` / `addonBefore` / `addonAfter` 快捷 prop(ADR 0029)。
113
+ *
114
+ * 详细演示与 API 见 `数据录入 · Data Entry/InputGroup` 故事集。
115
+ */
116
+ export const WithInputGroup: Story = {
117
+ name: '配合 InputGroup(替代旧 prefix/suffix/addon)',
118
+ parameters: { controls: { disable: true } },
119
+ render: () => (
120
+ <div className="flex w-80 flex-col gap-3">
121
+ {/* 图标前缀(替代旧 prefix={<Search />}) */}
122
+ <InputGroup>
123
+ <InputGroupAddon position="before" variant="icon">
124
+ <Search className="size-4" />
125
+ </InputGroupAddon>
126
+ <InputGroupInput placeholder="搜索..." />
127
+ </InputGroup>
128
+
129
+ {/* URL 协议头/后缀(替代旧 addonBefore="https://" addonAfter=".com") */}
130
+ <InputGroup>
131
+ <InputGroupAddon position="before">https://</InputGroupAddon>
132
+ <InputGroupInput defaultValue="example" />
133
+ <InputGroupAddon position="after">.com</InputGroupAddon>
134
+ </InputGroup>
135
+
136
+ {/* 金额/单位(替代旧 prefix="¥" suffix="USD") */}
137
+ <InputGroup>
138
+ <InputGroupAddon position="before">¥</InputGroupAddon>
139
+ <InputGroupInput type="number" defaultValue={199} />
140
+ <InputGroupAddon position="after">/ 月</InputGroupAddon>
141
+ </InputGroup>
142
+ </div>
143
+ ),
144
+ };
@@ -1,19 +1,58 @@
1
1
  import * as React from 'react';
2
+ import { cva } from 'class-variance-authority';
2
3
  import { X } from 'lucide-react';
3
4
 
4
5
  import { cn } from '@/utils/cn';
5
6
 
7
+ // ─── shared sizing(对齐 Button 三档:24 / 32 / 36px) ────────────────────────
8
+ //
9
+ // 高度 24/32/36px 与 Button / Select 同档;
10
+ // 这里直接用对应的 Tailwind 高度刻度 `h-6 / h-8 / h-9`,字号档位与 Button 同步。
11
+ const SIZE_TO_HEIGHT = {
12
+ sm: 'h-6 text-xs',
13
+ // medium 字号对齐 cd hybridcloud --form-element-medium-font-size: 12px (ADR 0027)
14
+ md: 'h-8 text-xs',
15
+ lg: 'h-9 text-sm',
16
+ /** @deprecated 兼容旧调用,等价于 `md`。 */
17
+ default: 'h-8 text-xs',
18
+ } as const;
19
+
20
+ /**
21
+ * Input 主体(无 affix 时直接使用此变体)。
22
+ * 高度 `h-6 / h-8 / h-9`(24 / 32 / 36px,与 Button / Select 同档);
23
+ * 圆角走 Tailwind v4 标准 namespace `--radius-md`(uni-manager 2px / opentrek 6px),
24
+ * 与 Button 同档 — 同行混排时视觉自动对齐。
25
+ *
26
+ * **前后缀 / addon 不再内置** — 需要前后缀图标 / 文本 / 按钮请用同库 `InputGroup`
27
+ * + `InputGroupAddon` + `InputGroupInput` 复合 API(自由嵌套 icon / button / text)。
28
+ * 字符计数 `showCount` + 一键清空 `clearable` 仍保留为 Input 的内建逻辑能力。
29
+ */
30
+ const inputVariants = cva(
31
+ 'flex w-full rounded-md border border-input bg-background px-3 py-1 shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:focus-visible:ring-destructive',
32
+ {
33
+ variants: { size: SIZE_TO_HEIGHT },
34
+ defaultVariants: { size: 'md' },
35
+ },
36
+ );
37
+
38
+ /**
39
+ * Input 包壳容器(`clearable` 启用时承载 border + ring,把内部 input 的边框转移到外层)。
40
+ */
41
+ const inputWrapperVariants = cva(
42
+ 'flex w-full items-center gap-2 rounded-md border border-input bg-background px-3 shadow-sm transition-colors focus-within:ring-1 focus-within:ring-ring aria-invalid:border-destructive aria-invalid:focus-within:ring-destructive',
43
+ {
44
+ variants: { size: SIZE_TO_HEIGHT },
45
+ defaultVariants: { size: 'md' },
46
+ },
47
+ );
48
+
6
49
  export interface InputProps
7
- extends Omit<
8
- React.InputHTMLAttributes<HTMLInputElement>,
9
- 'size' | 'prefix' | 'suffix'
10
- > {
11
- /** 输入框前置图标 / 文本(antd `prefix` 并集)。 */
12
- prefix?: React.ReactNode;
13
- /** 输入框后置图标 / 文本(antd `suffix` 并集)。 */
14
- suffix?: React.ReactNode;
50
+ extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'> {
15
51
  /**
16
52
  * 显示清除按钮,有内容时点击清空(antd `allowClear` 并集)。
53
+ *
54
+ * 注:仅"快捷一键清空"逻辑保留为 Input 内建能力 — 复合的前后缀(图标 / 文本 / 按钮)
55
+ * 请用 `InputGroup` 系列。
17
56
  * @default false
18
57
  */
19
58
  clearable?: boolean;
@@ -22,38 +61,58 @@ export interface InputProps
22
61
  * @default false
23
62
  */
24
63
  showCount?: boolean;
25
- /** 输入框前置标签(antd `addonBefore` 并集),与外层组合形成 input-group。 */
26
- addonBefore?: React.ReactNode;
27
- /** 输入框后置标签(antd `addonAfter` 并集)。 */
28
- addonAfter?: React.ReactNode;
29
64
  /**
30
- * 尺寸。
31
- * @default "default"
65
+ * 尺寸三档,与 `Button` 同档:`sm`(24px) / `md`(32px,默认) / `lg`(36px)。
66
+ * `"default"` 为兼容旧调用的别名,等价于 `"md"`,新代码请用 `"md"`。
67
+ * @default "md"
68
+ */
69
+ size?: 'sm' | 'md' | 'lg' | 'default';
70
+ /**
71
+ * 错误态(快捷开关),会同时设置 `aria-invalid`,渲染 destructive 边框 / ring。
72
+ * 也可以直接传 `aria-invalid` 原生属性达到同效果。
73
+ * @default false
32
74
  */
33
- size?: 'sm' | 'default' | 'lg';
75
+ error?: boolean;
34
76
  /** 受控值,用于 clearable / showCount 的逻辑;未传时回退到 uncontrolled 行为。 */
35
77
  value?: string;
36
78
  /** uncontrolled 初始值。 */
37
79
  defaultValue?: string;
38
80
  }
39
81
 
82
+ /**
83
+ * Input 单行文本输入 — shadcn 简洁基底 + antd `clearable` / `showCount` / `size` / `error` 并集。
84
+ *
85
+ * **想加图标 / 单位 / 按钮 / 协议头?用 InputGroup 复合插槽:**
86
+ * ```tsx
87
+ * import { InputGroup, InputGroupAddon, InputGroupInput } from '@/components/input-group/input-group';
88
+ * // 搜索图标 + 输入
89
+ * <InputGroup>
90
+ * <InputGroupAddon position="before" variant="icon"><Search /></InputGroupAddon>
91
+ * <InputGroupInput placeholder="搜索..." />
92
+ * </InputGroup>
93
+ * // URL(text 前后缀)
94
+ * <InputGroup>
95
+ * <InputGroupAddon position="before">https://</InputGroupAddon>
96
+ * <InputGroupInput defaultValue="example" />
97
+ * <InputGroupAddon position="after">.com</InputGroupAddon>
98
+ * </InputGroup>
99
+ * ```
100
+ */
40
101
  const Input = React.forwardRef<HTMLInputElement, InputProps>(
41
102
  (
42
103
  {
43
104
  className,
44
105
  type = 'text',
45
- prefix,
46
- suffix,
47
106
  clearable = false,
48
107
  showCount = false,
49
- addonBefore,
50
- addonAfter,
51
- size = 'default',
108
+ size = 'md',
109
+ error = false,
52
110
  value,
53
111
  defaultValue,
54
112
  onChange,
55
113
  maxLength,
56
114
  disabled,
115
+ 'aria-invalid': ariaInvalidProp,
57
116
  ...props
58
117
  },
59
118
  ref,
@@ -67,15 +126,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
67
126
  const innerRef = React.useRef<HTMLInputElement | null>(null);
68
127
  React.useImperativeHandle(ref, () => innerRef.current as HTMLInputElement);
69
128
 
70
- const h =
71
- size === 'sm'
72
- ? 'h-8 text-xs'
73
- : size === 'lg'
74
- ? 'h-10 text-base'
75
- : 'h-9 text-sm';
76
-
77
- const hasAffix = prefix != null || suffix != null || clearable;
78
- const hasAddon = addonBefore != null || addonAfter != null;
129
+ const ariaInvalid = ariaInvalidProp ?? (error ? true : undefined);
79
130
 
80
131
  const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
81
132
  if (!isControlled) setInternal(e.target.value);
@@ -84,7 +135,6 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
84
135
 
85
136
  const handleClear = () => {
86
137
  if (!isControlled) setInternal('');
87
- // Synthetic event for callers wiring onChange to a setter
88
138
  const target = innerRef.current;
89
139
  if (target) {
90
140
  const proto = Object.getPrototypeOf(target);
@@ -94,26 +144,18 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
94
144
  }
95
145
  };
96
146
 
97
- // Inner input + (optional) prefix/suffix wrapper
98
- // 当存在 addon 时,外层 addonWrapper 持有 border + rounded + focus-within ring,
99
- // 内层 wrapper / input 完全去掉自身的 border / shadow / ring,避免出现
100
- // "内部输入框单独一圈黑框" 的视觉。
101
- const innerInput = hasAffix ? (
147
+ const showClearBtn =
148
+ clearable && current && current.length > 0 && !disabled;
149
+
150
+ const innerInput = clearable ? (
102
151
  <div
152
+ aria-invalid={ariaInvalid}
103
153
  className={cn(
104
- 'flex items-center gap-2 rounded-md border border-input bg-background px-3 shadow-sm transition-colors focus-within:ring-1 focus-within:ring-ring',
105
- h,
154
+ inputWrapperVariants({ size }),
106
155
  disabled && 'cursor-not-allowed opacity-50',
107
- hasAddon &&
108
- 'min-w-0 flex-1 rounded-none border-0 shadow-none transition-none focus-within:ring-0',
109
- !hasAddon && className,
156
+ className,
110
157
  )}
111
158
  >
112
- {prefix ? (
113
- <span className="flex shrink-0 items-center text-muted-foreground [&_svg]:size-4">
114
- {prefix}
115
- </span>
116
- ) : null}
117
159
  <input
118
160
  ref={innerRef}
119
161
  type={type}
@@ -121,25 +163,21 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
121
163
  defaultValue={!isControlled ? defaultValue : undefined}
122
164
  maxLength={maxLength}
123
165
  disabled={disabled}
166
+ aria-invalid={ariaInvalid}
124
167
  onChange={handleChange}
125
168
  className="grow bg-transparent outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed"
126
169
  {...props}
127
170
  />
128
- {clearable && current && current.length > 0 && !disabled ? (
171
+ {showClearBtn ? (
129
172
  <button
130
173
  type="button"
131
174
  onClick={handleClear}
132
175
  aria-label="Clear"
133
- className="shrink-0 rounded-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
176
+ className="shrink-0 cursor-pointer rounded-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
134
177
  >
135
178
  <X className="size-4" />
136
179
  </button>
137
180
  ) : null}
138
- {suffix ? (
139
- <span className="flex shrink-0 items-center text-muted-foreground [&_svg]:size-4">
140
- {suffix}
141
- </span>
142
- ) : null}
143
181
  </div>
144
182
  ) : (
145
183
  <input
@@ -149,69 +187,26 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
149
187
  defaultValue={!isControlled ? defaultValue : undefined}
150
188
  maxLength={maxLength}
151
189
  disabled={disabled}
190
+ aria-invalid={ariaInvalid}
152
191
  onChange={handleChange}
153
- className={cn(
154
- 'flex w-full rounded-md border border-input bg-background px-3 py-1 shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50',
155
- h,
156
- hasAddon &&
157
- 'min-w-0 flex-1 rounded-none border-0 shadow-none transition-none focus-visible:ring-0',
158
- !hasAddon && className,
159
- )}
192
+ className={cn(inputVariants({ size }), className)}
160
193
  {...props}
161
194
  />
162
195
  );
163
196
 
164
- // Wrap with addons if any.
165
- // addonWrapper 是带 addon 时的统一外壳:持有 border + rounded + shadow +
166
- // focus-within ring;addon 自身只用浅灰分隔边 (border-input),input 主体
167
- // 不再持有任何边框 / ring,避免内部 "双重黑框" 视觉。
168
- const addonWrapper = hasAddon ? (
169
- <div
170
- className={cn(
171
- 'flex w-full overflow-hidden rounded-md border border-input bg-background shadow-sm transition-colors focus-within:ring-1 focus-within:ring-ring',
172
- disabled && 'cursor-not-allowed opacity-50',
173
- className,
174
- )}
175
- >
176
- {addonBefore ? (
177
- <span
178
- className={cn(
179
- 'inline-flex shrink-0 items-center border-r border-input bg-muted px-3 text-muted-foreground',
180
- h,
181
- )}
182
- >
183
- {addonBefore}
184
- </span>
185
- ) : null}
186
- {innerInput}
187
- {addonAfter ? (
188
- <span
189
- className={cn(
190
- 'inline-flex shrink-0 items-center border-l border-input bg-muted px-3 text-muted-foreground',
191
- h,
192
- )}
193
- >
194
- {addonAfter}
195
- </span>
196
- ) : null}
197
- </div>
198
- ) : (
199
- innerInput
200
- );
201
-
202
197
  if (showCount && maxLength) {
203
198
  return (
204
- <div className="space-y-1">
205
- {addonWrapper}
199
+ <div className="flex flex-col gap-1">
200
+ {innerInput}
206
201
  <div className="text-right text-xs text-muted-foreground tabular-nums">
207
202
  {current?.length ?? 0} / {maxLength}
208
203
  </div>
209
204
  </div>
210
205
  );
211
206
  }
212
- return addonWrapper;
207
+ return innerInput;
213
208
  },
214
209
  );
215
210
  Input.displayName = 'Input';
216
211
 
217
- export { Input };
212
+ export { Input, inputVariants };
@@ -2,73 +2,69 @@
2
2
  id: input-group
3
3
  name: InputGroup
4
4
  type: component
5
- category: form
6
- since: 0.1.0
5
+ category: data-entry
6
+ since: 0.2.0
7
7
  package: '@teamix-evo/ui'
8
8
  displayName: 输入框组
9
9
  ---
10
10
 
11
11
  # InputGroup 输入框组
12
12
 
13
- 输入框 + addon 统一容器 — shadcn 2025-10 新增。**等价 antd `Input` 的 `prefix` / `suffix` / `addonBefore` / `addonAfter` 集合**,但拆为更通用的复合插槽:`InputGroupAddon`(图标 / 文本 / 按钮)+ `InputGroupInput` / `InputGroupTextarea`(主体)。
13
+ 输入框 + addon 统一容器 — **shadcn 2025-10 新增**。等价 antd `Input` 的 `prefix` / `suffix` / `addonBefore` / `addonAfter` 集合,**单独一个 entry**,与 [`Input`](../input/input.meta.md) 拆开管理(对齐 shadcn 2025-10 拆分粒度)。
14
+
15
+ 复合插槽:`<InputGroupAddon position variant>` + `<InputGroupInput>` / `<InputGroupTextarea>`,自由嵌套图标 / 按钮 / 文本(URL / 金额 / 搜索 / Send 等形态)。容器外壳承担 border + ring + focus-within,内部全部去边框 — 与 Input / Button / Select 同档高度(32px)。
14
16
 
15
17
  ## When to use
16
18
 
17
- - 输入框需要前 / 后缀(`https://` `.com`、`$`、`/月`)
18
- - 输入框 + 操作按钮(搜索、清空、复制)
19
- - 输入框 + 图标(搜索图标、loading spinner)
20
- - Textarea + 上传 / 录音类辅助按钮
19
+ - 输入框需要**前 / 后缀**(`https://` `.com`、`¥`、`/ 月`)
20
+ - 输入框 + 操作按钮(搜索、清空、复制、Send)
21
+ - 输入框 + 图标(搜索、loading spinner、状态指示)
22
+ - Textarea + 上传 / 录音 / 发送类辅助按钮
21
23
 
22
24
  ## When NOT to use
23
25
 
24
- - 仅需输入框 → `Input`
25
- - 仅需 textarea → `Textarea`
26
- - 多个按钮拼接 → `ButtonGroup`
26
+ - 仅"一键清空" → `Input` 自带 `clearable`,无需 InputGroup 包裹
27
+ - 字符计数 → `Input` 自带 `showCount` + `maxLength`
28
+ - @提及输入 → `Mentions`
29
+ - 多个**独立**输入框横排(姓 / 名 / 中间名)→ 用 `Flex` 直接 gap 排列,不要套 InputGroup(InputGroup 的"统一外壳"语义不适用)
27
30
 
28
31
  ## Props
29
32
 
30
- <!-- auto:props:begin -->
31
-
32
- #### InputGroup
33
-
34
- | 名称 | 类型 | 默认值 | 必填 | 说明 |
35
- | ---------- | --------- | ------ | ---- | --------------------------------------------------------------------- |
36
- | `disabled` | `boolean` | – | – | 整组禁用样式(子项请单独传 `disabled`,这里仅影响视觉上的 opacity)。 |
37
-
38
- #### InputGroupAddon
39
-
40
- | 名称 | 类型 | 默认值 | 必填 | 说明 |
41
- | ---------- | ------------------------------ | ---------- | ---- | ---------------------------------------------------------------------------------------------------------------- |
42
- | `position` | `'before' \| 'after'` | `"before"` | – | 位于输入框的哪一侧。 |
43
- | `variant` | `'text' \| 'icon' \| 'button'` | `"text"` | – | `text` = 默认 muted 文本背景 / `icon` = 紧凑、透明背景(图标专用)/ `button` = 用于嵌入 `<Button>`(去内边距)。 |
33
+ > 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成。
44
34
 
35
+ <!-- auto:props:begin -->
36
+ | 名称 | 类型 | 默认值 | 必填 | 说明 |
37
+ | --- | --- | --- | --- | --- |
38
+ | `disabled` | `boolean` | – | – | 整组禁用样式(子项请单独传 `disabled`,这里仅影响视觉上的 opacity)。 |
45
39
  <!-- auto:props:end -->
46
40
 
47
41
  ## 依赖
48
42
 
49
- <!-- auto:deps:begin -->
43
+ > 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成,数据源是 [`manifest.json`](../../../manifest.json)。**手工编辑 marker 之间的内容会在下次生成时被覆盖**。
50
44
 
45
+ <!-- auto:deps:begin -->
51
46
  ### 同库依赖
52
47
 
53
48
  > `teamix-evo ui add input-group` 时,以下 entry 会被自动连带安装(无需手动 add)。
54
49
 
55
- | Entry | 类型 | 描述 |
56
- | ----- | ---- | -------------------------------------------------- |
57
- | `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
50
+ | Entry | 类型 | 描述 |
51
+ | --- | --- | --- |
52
+ | `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
58
53
 
59
54
  ### npm 依赖
60
55
 
61
56
  _无 — 本组件不依赖任何 npm 包。_
62
-
63
57
  <!-- auto:deps:end -->
64
58
 
65
59
  ## AI 生成纪律
66
60
 
67
- - **顺序按 JSX 写**:`<InputGroup>` 内的子节点顺序就是渲染顺序 `<Addon position="before" />` 必须在 `<Input />` 前面,反之亦然
68
- - **不要在 InputGroupAddon 里再放 Input** addon 是辅助槽,主输入必须用 `InputGroupInput` / `InputGroupTextarea`
61
+ - **顺序按 JSX 写**:`<InputGroup>` 内的子节点顺序就是渲染顺序 —— `<InputGroupAddon position="before" />` 必须在主体前
62
+ - **不要在 `InputGroupAddon` 里再放 Input** —— addon 是辅助槽,主输入必须用 `InputGroupInput` / `InputGroupTextarea`
69
63
  - **`variant="icon"`** 给图标用(无背景、紧凑);**`variant="text"`** 给纯文本前后缀(muted 背景);**`variant="button"`** 给嵌入 Button(去内边距 + 去圆角,避免双重边线)
70
- - **disabled**:整组传 `disabled` 仅影响外观;子项的真实 disabled 需要单独传(防止误整组禁用)
71
- - **嵌入 `Button`**:用 `<InputGroupAddon variant="button">` 包,Button 自身 `variant="ghost"` 效果最自然
64
+ - **嵌入 `Button`**:用 `<InputGroupAddon variant="button">` 包,Button 自身 `variant="ghost"` `size="icon"` 效果最自然
65
+ - **不要套两层** —— `<InputGroup>` 内不要再嵌 `<Input>`(主输入用 `<InputGroupInput>`,因为 Input 自带 border 会与外壳冲突 1px 几何)
66
+ - **error 态走子项 `aria-invalid`** —— InputGroup 不直接支持 `error` prop,把 `aria-invalid` 写在 `InputGroupInput` 上即可触发外壳的 destructive 边框
67
+ - **不要硬编码颜色** —— `bg-background` / `border-input` / `bg-muted` 都是 design token
72
68
 
73
69
  ## Examples
74
70
 
@@ -82,29 +78,47 @@ import {
82
78
  import { Button } from '@/components/ui/button';
83
79
  import { Search, Send } from 'lucide-react';
84
80
 
85
- // 前缀图标 + 后缀按钮
81
+ // 搜索图标 + 输入(替代旧 <Input prefix={<Search />} />)
86
82
  <InputGroup>
87
83
  <InputGroupAddon position="before" variant="icon">
88
84
  <Search className="size-4" />
89
85
  </InputGroupAddon>
90
86
  <InputGroupInput placeholder="搜索文档..." />
91
- <InputGroupAddon position="after" variant="button">
92
- <Button variant="ghost" size="sm">搜索</Button>
93
- </InputGroupAddon>
94
87
  </InputGroup>
95
88
 
96
- // 前后缀文本(URL 输入)
89
+ // URL 输入(替代旧 <Input addonBefore="https://" addonAfter=".com" />)
97
90
  <InputGroup>
98
91
  <InputGroupAddon position="before">https://</InputGroupAddon>
99
92
  <InputGroupInput defaultValue="example" />
100
93
  <InputGroupAddon position="after">.com</InputGroupAddon>
101
94
  </InputGroup>
102
95
 
103
- // Textarea + 发送按钮
96
+ // 金额输入
104
97
  <InputGroup>
98
+ <InputGroupAddon position="before">¥</InputGroupAddon>
99
+ <InputGroupInput type="number" defaultValue={199} />
100
+ <InputGroupAddon position="after">/ 月</InputGroupAddon>
101
+ </InputGroup>
102
+
103
+ // Textarea + 发送按钮
104
+ <InputGroup className="items-end">
105
105
  <InputGroupTextarea rows={3} placeholder="发表评论..." />
106
106
  <InputGroupAddon position="after" variant="button">
107
107
  <Button size="icon" icon={<Send />} aria-label="发送" />
108
108
  </InputGroupAddon>
109
109
  </InputGroup>
110
110
  ```
111
+
112
+ ## Migration · 从旧 `Input` 快捷 prop 迁移
113
+
114
+ > v0.2 起 `<Input>` 的 `prefix` / `suffix` / `addonBefore` / `addonAfter` 已**移除**。请改用 InputGroup 复合 API(更灵活、可嵌任意子节点)。
115
+
116
+ | 旧用法(已移除) | 新用法 |
117
+ | ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
118
+ | `<Input prefix={<Search />} />` | `<InputGroup><InputGroupAddon position="before" variant="icon"><Search /></InputGroupAddon><InputGroupInput /></InputGroup>` |
119
+ | `<Input suffix={<Mail />} />` | `<InputGroup><InputGroupInput /><InputGroupAddon position="after" variant="icon"><Mail /></InputGroupAddon></InputGroup>` |
120
+ | `<Input addonBefore="https://" />` | `<InputGroup><InputGroupAddon position="before">https://</InputGroupAddon><InputGroupInput /></InputGroup>` |
121
+ | `<Input addonAfter=".com" />` | `<InputGroup><InputGroupInput /><InputGroupAddon position="after">.com</InputGroupAddon></InputGroup>` |
122
+ | `<Input prefix="¥" suffix="USD" />` | `<InputGroup><InputGroupAddon position="before">¥</InputGroupAddon><InputGroupInput /><InputGroupAddon position="after">USD</InputGroupAddon></InputGroup>` |
123
+
124
+ > 保留在 Input 的快捷能力:`clearable`(逻辑) / `showCount`(下方计数)/ `size` / `error` —— 这些与"前后缀"语义无关,继续作为 Input 的内建逻辑能力。