@teamix-evo/ui 0.1.1 → 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 (295) hide show
  1. package/README.md +184 -184
  2. package/manifest.json +680 -492
  3. package/package.json +20 -10
  4. package/src/components/accordion/accordion.meta.md +5 -4
  5. package/src/components/accordion/accordion.stories.tsx +14 -9
  6. package/src/components/accordion/accordion.tsx +104 -8
  7. package/src/components/affix/affix.meta.md +20 -2
  8. package/src/components/affix/affix.stories.tsx +102 -25
  9. package/src/components/affix/affix.tsx +79 -9
  10. package/src/components/alert/alert.meta.md +44 -13
  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 +61 -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 +8 -3
  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 +9 -4
  20. package/src/components/app/app.stories.tsx +9 -7
  21. package/src/components/aspect-ratio/aspect-ratio.meta.md +4 -3
  22. package/src/components/aspect-ratio/aspect-ratio.stories.tsx +3 -3
  23. package/src/components/auto-complete/auto-complete.meta.md +14 -6
  24. package/src/components/auto-complete/auto-complete.stories.tsx +47 -4
  25. package/src/components/auto-complete/auto-complete.tsx +119 -71
  26. package/src/components/avatar/avatar.meta.md +6 -7
  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 +10 -9
  30. package/src/components/badge/badge.stories.tsx +2 -2
  31. package/src/components/badge/badge.tsx +9 -15
  32. package/src/components/breadcrumb/breadcrumb.meta.md +27 -7
  33. package/src/components/breadcrumb/breadcrumb.stories.tsx +127 -4
  34. package/src/components/breadcrumb/breadcrumb.tsx +22 -8
  35. package/src/components/button/button.meta.md +258 -21
  36. package/src/components/button/button.stories.tsx +549 -41
  37. package/src/components/button/button.tsx +335 -33
  38. package/src/components/button/demo/as-child.tsx +24 -0
  39. package/src/components/button/demo/basic.tsx +8 -0
  40. package/src/components/button/demo/block.tsx +16 -0
  41. package/src/components/button/demo/loading.tsx +19 -0
  42. package/src/components/button/demo/shapes.tsx +18 -0
  43. package/src/components/button/demo/sizes.tsx +19 -0
  44. package/src/components/button/demo/variants.tsx +19 -0
  45. package/src/components/button/demo/with-icon.tsx +20 -0
  46. package/src/components/calendar/calendar.meta.md +13 -3
  47. package/src/components/calendar/calendar.stories.tsx +6 -6
  48. package/src/components/calendar/calendar.tsx +73 -8
  49. package/src/components/card/card.meta.md +27 -5
  50. package/src/components/card/card.stories.tsx +42 -3
  51. package/src/components/card/card.tsx +146 -63
  52. package/src/components/carousel/carousel.meta.md +4 -3
  53. package/src/components/carousel/carousel.stories.tsx +11 -6
  54. package/src/components/cascader/cascader.meta.md +47 -17
  55. package/src/components/cascader/cascader.stories.tsx +22 -10
  56. package/src/components/cascader/cascader.tsx +428 -85
  57. package/src/components/checkbox/checkbox.meta.md +75 -7
  58. package/src/components/checkbox/checkbox.stories.tsx +161 -3
  59. package/src/components/checkbox/checkbox.tsx +77 -9
  60. package/src/components/collapsible/collapsible.meta.md +14 -6
  61. package/src/components/collapsible/collapsible.stories.tsx +10 -2
  62. package/src/components/collapsible/collapsible.tsx +93 -6
  63. package/src/components/color-picker/color-picker.meta.md +12 -7
  64. package/src/components/color-picker/color-picker.stories.tsx +86 -7
  65. package/src/components/color-picker/color-picker.tsx +20 -9
  66. package/src/components/command/command.meta.md +29 -13
  67. package/src/components/command/command.stories.tsx +4 -4
  68. package/src/components/command/command.tsx +19 -8
  69. package/src/components/context-menu/context-menu.meta.md +11 -8
  70. package/src/components/context-menu/context-menu.stories.tsx +11 -3
  71. package/src/components/context-menu/context-menu.tsx +21 -8
  72. package/src/components/data-table/data-table.meta.md +6 -5
  73. package/src/components/data-table/data-table.stories.tsx +13 -6
  74. package/src/components/data-table/data-table.tsx +2 -2
  75. package/src/components/date-picker/date-picker.meta.md +88 -19
  76. package/src/components/date-picker/date-picker.stories.tsx +55 -5
  77. package/src/components/date-picker/date-picker.tsx +1489 -91
  78. package/src/components/descriptions/descriptions.meta.md +10 -5
  79. package/src/components/descriptions/descriptions.stories.tsx +3 -3
  80. package/src/components/descriptions/descriptions.tsx +22 -14
  81. package/src/components/dialog/dialog.meta.md +76 -13
  82. package/src/components/dialog/dialog.stories.tsx +182 -20
  83. package/src/components/dialog/dialog.tsx +67 -15
  84. package/src/components/dialog/imperative.tsx +252 -0
  85. package/src/components/drawer/drawer.meta.md +33 -34
  86. package/src/components/drawer/drawer.stories.tsx +29 -12
  87. package/src/components/drawer/drawer.tsx +22 -113
  88. package/src/components/dropdown-menu/dropdown-menu.meta.md +78 -10
  89. package/src/components/dropdown-menu/dropdown-menu.stories.tsx +88 -2
  90. package/src/components/dropdown-menu/dropdown-menu.tsx +24 -10
  91. package/src/components/ellipsis/ellipsis.meta.md +87 -0
  92. package/src/components/ellipsis/ellipsis.stories.tsx +72 -0
  93. package/src/components/ellipsis/ellipsis.tsx +153 -0
  94. package/src/components/empty/empty.meta.md +9 -4
  95. package/src/components/empty/empty.stories.tsx +4 -4
  96. package/src/components/empty/empty.tsx +10 -3
  97. package/src/components/field/field.meta.md +47 -9
  98. package/src/components/field/field.stories.tsx +385 -5
  99. package/src/components/field/field.tsx +263 -35
  100. package/src/components/filter-bar/filter-bar.meta.md +92 -0
  101. package/src/components/filter-bar/filter-bar.stories.tsx +1083 -0
  102. package/src/components/filter-bar/filter-bar.tsx +568 -0
  103. package/src/components/flex/flex.meta.md +54 -6
  104. package/src/components/flex/flex.stories.tsx +107 -20
  105. package/src/components/flex/flex.tsx +27 -4
  106. package/src/components/float-button/float-button.meta.md +8 -3
  107. package/src/components/float-button/float-button.stories.tsx +9 -7
  108. package/src/components/float-button/float-button.tsx +1 -1
  109. package/src/components/form/form.meta.md +39 -17
  110. package/src/components/form/form.stories.tsx +350 -3
  111. package/src/components/form/form.tsx +101 -35
  112. package/src/components/grid/grid.meta.md +7 -2
  113. package/src/components/grid/grid.stories.tsx +6 -4
  114. package/src/components/hover-card/hover-card.meta.md +20 -9
  115. package/src/components/hover-card/hover-card.stories.tsx +34 -5
  116. package/src/components/hover-card/hover-card.tsx +51 -13
  117. package/src/components/icon/DEVELOPMENT.md +809 -0
  118. package/src/components/icon/icon.meta.md +170 -0
  119. package/src/components/icon/icon.stories.tsx +344 -0
  120. package/src/components/icon/icon.tsx +248 -0
  121. package/src/components/image/image.meta.md +9 -4
  122. package/src/components/image/image.stories.tsx +3 -3
  123. package/src/components/image/image.tsx +6 -4
  124. package/src/components/input/demo/basic.tsx +12 -0
  125. package/src/components/input/demo/clearable.tsx +21 -0
  126. package/src/components/input/demo/show-count.tsx +18 -0
  127. package/src/components/input/demo/sizes.tsx +15 -0
  128. package/src/components/input/input.meta.md +39 -33
  129. package/src/components/input/input.stories.tsx +62 -35
  130. package/src/components/input/input.tsx +97 -98
  131. package/src/components/input-group/input-group.meta.md +54 -22
  132. package/src/components/input-group/input-group.stories.tsx +49 -16
  133. package/src/components/input-group/input-group.tsx +44 -8
  134. package/src/components/input-number/input-number.meta.md +64 -7
  135. package/src/components/input-number/input-number.stories.tsx +46 -8
  136. package/src/components/input-number/input-number.tsx +99 -26
  137. package/src/components/input-otp/input-otp.meta.md +4 -3
  138. package/src/components/input-otp/input-otp.stories.tsx +3 -3
  139. package/src/components/input-otp/input-otp.tsx +1 -1
  140. package/src/components/item/item.meta.md +8 -3
  141. package/src/components/item/item.stories.tsx +8 -5
  142. package/src/components/item/item.tsx +7 -6
  143. package/src/components/kbd/kbd.meta.md +13 -4
  144. package/src/components/kbd/kbd.stories.tsx +4 -4
  145. package/src/components/kbd/kbd.tsx +10 -5
  146. package/src/components/label/label.meta.md +18 -10
  147. package/src/components/label/label.stories.tsx +64 -6
  148. package/src/components/label/label.tsx +91 -19
  149. package/src/components/masonry/masonry.meta.md +8 -3
  150. package/src/components/masonry/masonry.stories.tsx +7 -5
  151. package/src/components/masonry/masonry.tsx +1 -0
  152. package/src/components/mentions/mentions.meta.md +36 -6
  153. package/src/components/mentions/mentions.stories.tsx +120 -6
  154. package/src/components/mentions/mentions.tsx +11 -5
  155. package/src/components/menubar/menubar.meta.md +30 -12
  156. package/src/components/menubar/menubar.stories.tsx +62 -2
  157. package/src/components/menubar/menubar.tsx +9 -9
  158. package/src/components/native-select/native-select.meta.md +8 -3
  159. package/src/components/native-select/native-select.stories.tsx +8 -5
  160. package/src/components/native-select/native-select.tsx +1 -1
  161. package/src/components/navigation-menu/navigation-menu.meta.md +19 -9
  162. package/src/components/navigation-menu/navigation-menu.stories.tsx +112 -9
  163. package/src/components/navigation-menu/navigation-menu.tsx +8 -4
  164. package/src/components/notification/notification.meta.md +52 -10
  165. package/src/components/notification/notification.stories.tsx +11 -9
  166. package/src/components/notification/notification.tsx +36 -21
  167. package/src/components/page-header/DEVELOPMENT.md +842 -0
  168. package/src/components/page-header/page-header.meta.md +208 -0
  169. package/src/components/page-header/page-header.stories.tsx +421 -0
  170. package/src/components/page-header/page-header.tsx +281 -0
  171. package/src/components/pagination/pagination.meta.md +140 -37
  172. package/src/components/pagination/pagination.stories.tsx +232 -10
  173. package/src/components/pagination/pagination.tsx +355 -63
  174. package/src/components/popconfirm/popconfirm.meta.md +9 -4
  175. package/src/components/popconfirm/popconfirm.stories.tsx +3 -4
  176. package/src/components/popconfirm/popconfirm.tsx +2 -2
  177. package/src/components/popover/popover.meta.md +62 -5
  178. package/src/components/popover/popover.stories.tsx +83 -7
  179. package/src/components/popover/popover.tsx +77 -28
  180. package/src/components/progress/progress.meta.md +38 -6
  181. package/src/components/progress/progress.stories.tsx +3 -3
  182. package/src/components/progress/progress.tsx +24 -16
  183. package/src/components/radio-group/radio-group.meta.md +79 -7
  184. package/src/components/radio-group/radio-group.stories.tsx +39 -3
  185. package/src/components/radio-group/radio-group.tsx +149 -18
  186. package/src/components/rate/rate.meta.md +35 -4
  187. package/src/components/rate/rate.stories.tsx +13 -5
  188. package/src/components/rate/rate.tsx +37 -10
  189. package/src/components/resizable/resizable.meta.md +7 -4
  190. package/src/components/resizable/resizable.stories.tsx +6 -6
  191. package/src/components/resizable/resizable.tsx +1 -1
  192. package/src/components/result/result.meta.md +7 -2
  193. package/src/components/result/result.stories.tsx +4 -8
  194. package/src/components/result/result.tsx +24 -15
  195. package/src/components/scroll-area/scroll-area.meta.md +4 -3
  196. package/src/components/scroll-area/scroll-area.stories.tsx +12 -4
  197. package/src/components/scroll-area/scroll-area.tsx +3 -3
  198. package/src/components/segmented/segmented.meta.md +7 -4
  199. package/src/components/segmented/segmented.stories.tsx +37 -8
  200. package/src/components/segmented/segmented.tsx +15 -7
  201. package/src/components/select/select.meta.md +197 -52
  202. package/src/components/select/select.stories.tsx +238 -63
  203. package/src/components/select/select.tsx +718 -171
  204. package/src/components/separator/separator.meta.md +4 -3
  205. package/src/components/separator/separator.stories.tsx +3 -3
  206. package/src/components/separator/separator.tsx +3 -7
  207. package/src/components/sheet/sheet.meta.md +32 -16
  208. package/src/components/sheet/sheet.stories.tsx +116 -10
  209. package/src/components/sheet/sheet.tsx +116 -29
  210. package/src/components/sidebar/sidebar.meta.md +37 -18
  211. package/src/components/sidebar/sidebar.stories.tsx +701 -29
  212. package/src/components/sidebar/sidebar.tsx +615 -142
  213. package/src/components/skeleton/skeleton.meta.md +4 -5
  214. package/src/components/skeleton/skeleton.stories.tsx +4 -4
  215. package/src/components/skeleton/skeleton.tsx +7 -7
  216. package/src/components/slider/slider.meta.md +57 -5
  217. package/src/components/slider/slider.stories.tsx +58 -6
  218. package/src/components/slider/slider.tsx +154 -13
  219. package/src/components/sonner/sonner.meta.md +58 -7
  220. package/src/components/sonner/sonner.stories.tsx +78 -5
  221. package/src/components/sonner/sonner.tsx +137 -8
  222. package/src/components/spinner/spinner.meta.md +62 -13
  223. package/src/components/spinner/spinner.stories.tsx +66 -14
  224. package/src/components/spinner/spinner.tsx +111 -9
  225. package/src/components/statistic/statistic.meta.md +7 -2
  226. package/src/components/statistic/statistic.stories.tsx +3 -7
  227. package/src/components/statistic/statistic.tsx +5 -6
  228. package/src/components/steps/steps.meta.md +18 -4
  229. package/src/components/steps/steps.stories.tsx +43 -3
  230. package/src/components/steps/steps.tsx +15 -12
  231. package/src/components/switch/switch.meta.md +51 -5
  232. package/src/components/switch/switch.stories.tsx +6 -6
  233. package/src/components/switch/switch.tsx +109 -41
  234. package/src/components/table/table.meta.md +17 -6
  235. package/src/components/table/table.stories.tsx +10 -5
  236. package/src/components/table/table.tsx +4 -4
  237. package/src/components/tabs/tabs.meta.md +38 -25
  238. package/src/components/tabs/tabs.stories.tsx +111 -25
  239. package/src/components/tabs/tabs.tsx +125 -54
  240. package/src/components/tag/tag.meta.md +105 -40
  241. package/src/components/tag/tag.stories.tsx +189 -16
  242. package/src/components/tag/tag.tsx +222 -21
  243. package/src/components/textarea/textarea.meta.md +35 -19
  244. package/src/components/textarea/textarea.stories.tsx +32 -6
  245. package/src/components/textarea/textarea.tsx +33 -9
  246. package/src/components/time-picker/time-picker.meta.md +124 -32
  247. package/src/components/time-picker/time-picker.stories.tsx +85 -15
  248. package/src/components/time-picker/time-picker.tsx +913 -61
  249. package/src/components/timeline/timeline.meta.md +14 -6
  250. package/src/components/timeline/timeline.stories.tsx +37 -7
  251. package/src/components/timeline/timeline.tsx +35 -14
  252. package/src/components/toggle/toggle.meta.md +5 -4
  253. package/src/components/toggle/toggle.stories.tsx +4 -4
  254. package/src/components/toggle/toggle.tsx +4 -3
  255. package/src/components/toggle-group/toggle-group.meta.md +5 -4
  256. package/src/components/toggle-group/toggle-group.stories.tsx +3 -3
  257. package/src/components/toggle-group/toggle-group.tsx +2 -2
  258. package/src/components/tooltip/tooltip.meta.md +55 -5
  259. package/src/components/tooltip/tooltip.stories.tsx +42 -5
  260. package/src/components/tooltip/tooltip.tsx +81 -21
  261. package/src/components/tour/tour.meta.md +9 -4
  262. package/src/components/tour/tour.stories.tsx +3 -3
  263. package/src/components/tour/tour.tsx +4 -4
  264. package/src/components/transfer/transfer.meta.md +11 -6
  265. package/src/components/transfer/transfer.stories.tsx +4 -8
  266. package/src/components/transfer/transfer.tsx +28 -21
  267. package/src/components/tree/tree.meta.md +63 -5
  268. package/src/components/tree/tree.stories.tsx +31 -12
  269. package/src/components/tree/tree.tsx +9 -8
  270. package/src/components/tree-select/tree-select.meta.md +59 -8
  271. package/src/components/tree-select/tree-select.stories.tsx +3 -3
  272. package/src/components/tree-select/tree-select.tsx +42 -7
  273. package/src/components/typography/typography.meta.md +61 -14
  274. package/src/components/typography/typography.stories.tsx +12 -11
  275. package/src/components/typography/typography.tsx +43 -28
  276. package/src/components/upload/upload.meta.md +49 -4
  277. package/src/components/upload/upload.stories.tsx +72 -12
  278. package/src/components/upload/upload.tsx +170 -37
  279. package/src/components/watermark/watermark.meta.md +7 -2
  280. package/src/components/watermark/watermark.stories.tsx +101 -9
  281. package/src/components/watermark/watermark.tsx +1 -0
  282. package/src/hooks/use-breakpoint.ts +117 -0
  283. package/src/hooks/use-debounce-callback.ts +52 -0
  284. package/src/hooks/use-mobile.ts +23 -0
  285. package/src/stories/theme-tokens.stories.tsx +747 -0
  286. package/src/utils/trigger-input.ts +53 -0
  287. package/src/components/button-group/button-group.meta.md +0 -92
  288. package/src/components/button-group/button-group.stories.tsx +0 -90
  289. package/src/components/button-group/button-group.tsx +0 -75
  290. package/src/components/combobox/combobox.meta.md +0 -93
  291. package/src/components/combobox/combobox.stories.tsx +0 -55
  292. package/src/components/combobox/combobox.tsx +0 -130
  293. package/src/components/space/space.meta.md +0 -94
  294. package/src/components/space/space.stories.tsx +0 -94
  295. package/src/components/space/space.tsx +0 -106
@@ -33,7 +33,7 @@ const NativeSelect = React.forwardRef<HTMLSelectElement, NativeSelectProps>(
33
33
  ref={ref}
34
34
  disabled={disabled}
35
35
  className={cn(
36
- 'flex h-9 w-full appearance-none rounded-md border border-input bg-background py-1 pl-3 pr-8 text-sm shadow-sm',
36
+ 'flex h-9 w-full appearance-none rounded-md border border-input bg-background py-1 pl-3 pr-8 text-xs shadow-sm',
37
37
  'focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring',
38
38
  'disabled:cursor-not-allowed disabled:opacity-50',
39
39
  className,
@@ -2,12 +2,13 @@
2
2
  id: navigation-menu
3
3
  name: NavigationMenu
4
4
  type: component
5
- category: navigation
5
+ category: deprecated
6
6
  since: 0.1.0
7
- package: "@teamix-evo/ui"
7
+ package: '@teamix-evo/ui'
8
+ displayName: 导航菜单
8
9
  ---
9
10
 
10
- # NavigationMenu
11
+ # NavigationMenu 导航菜单
11
12
 
12
13
  主导航菜单 — Radix NavigationMenu。**用于网站 / 营销页 / 应用顶部主导航**(产品 / 文档 / 定价 / 关于)。
13
14
  **与 Menubar 区别**:NavigationMenu 是**网页级横向导航**(每项可有富 Content 面板,展示子页面预览);Menubar 是**应用级菜单**(文件 / 编辑等)。
@@ -68,9 +69,13 @@ pnpm add @radix-ui/react-navigation-menu@^1.2.0 class-variance-authority@^0.7.0
68
69
  ```tsx
69
70
  import * as React from 'react';
70
71
  import {
71
- NavigationMenu, NavigationMenuList, NavigationMenuItem,
72
- NavigationMenuTrigger, NavigationMenuContent,
73
- NavigationMenuLink, navigationMenuTriggerStyle,
72
+ NavigationMenu,
73
+ NavigationMenuList,
74
+ NavigationMenuItem,
75
+ NavigationMenuTrigger,
76
+ NavigationMenuContent,
77
+ NavigationMenuLink,
78
+ navigationMenuTriggerStyle,
74
79
  } from '@/components/ui/navigation-menu';
75
80
 
76
81
  <NavigationMenu>
@@ -81,9 +86,14 @@ import {
81
86
  <ul className="grid w-[400px] gap-3 p-4 md:w-[500px] md:grid-cols-2">
82
87
  <li>
83
88
  <NavigationMenuLink asChild>
84
- <a href="/design" className="block rounded-md p-3 hover:bg-accent">
89
+ <a
90
+ href="/design"
91
+ className="block rounded-md p-3 hover:bg-accent"
92
+ >
85
93
  <div className="text-sm font-medium">Design</div>
86
- <p className="text-xs text-muted-foreground">设计体系与 tokens</p>
94
+ <p className="text-xs text-muted-foreground">
95
+ 设计体系与 tokens
96
+ </p>
87
97
  </a>
88
98
  </NavigationMenuLink>
89
99
  </li>
@@ -104,5 +114,5 @@ import {
104
114
  </NavigationMenuLink>
105
115
  </NavigationMenuItem>
106
116
  </NavigationMenuList>
107
- </NavigationMenu>
117
+ </NavigationMenu>;
108
118
  ```
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import {
3
3
  NavigationMenu,
4
4
  NavigationMenuList,
@@ -8,11 +8,20 @@ import {
8
8
  NavigationMenuLink,
9
9
  navigationMenuTriggerStyle,
10
10
  } from './navigation-menu';
11
+ import { cn } from '@/utils/cn';
11
12
 
12
13
  const meta: Meta<typeof NavigationMenu> = {
13
- title: '导航 · Navigation/NavigationMenu',
14
+ title: '废弃 · Deprecated/NavigationMenu',
14
15
  component: NavigationMenu,
15
16
  tags: ['autodocs'],
17
+ parameters: {
18
+ docs: {
19
+ description: {
20
+ component:
21
+ '⚠️ **已废弃** — 仅 Storybook 留档,不通过 manifest 对外发布。\n\nNavigationMenu 导航菜单 —— 在网站、营销页或应用顶部承载主导航,每项可展开富面板预览子页面。Radix `NavigationMenu` 内核 + shadcn 原子,**对齐 antd `Menu mode="horizontal"`** 的水平主导航能力,对齐 shadcn `NavigationMenu` 的 `NavigationMenuTrigger` / `NavigationMenuContent` / `NavigationMenuLink` / `navigationMenuTriggerStyle`,并补足 antd 的 `disabled` 项与简单链接形态。视觉走 OpenTrek semantic tokens,所有样式来自 `@teamix-evo/tokens`,无 mock。',
22
+ },
23
+ },
24
+ },
16
25
  };
17
26
 
18
27
  export default meta;
@@ -77,20 +86,73 @@ export const Default: Story = {
77
86
  className="block rounded-md p-3 hover:bg-accent"
78
87
  >
79
88
  <div className="text-sm font-medium">Skills</div>
80
- <p className="text-xs text-muted-foreground">
81
- AI IDE 技能
82
- </p>
89
+ <p className="text-xs text-muted-foreground">AI IDE 技能</p>
83
90
  </a>
84
91
  </NavigationMenuLink>
85
92
  </li>
86
93
  </ul>
87
94
  </NavigationMenuContent>
88
95
  </NavigationMenuItem>
96
+ <NavigationMenuItem>
97
+ <NavigationMenuLink asChild className={navigationMenuTriggerStyle()}>
98
+ <a href="#docs" onClick={(e) => e.preventDefault()}>
99
+ 文档
100
+ </a>
101
+ </NavigationMenuLink>
102
+ </NavigationMenuItem>
103
+ <NavigationMenuItem>
104
+ <NavigationMenuLink asChild className={navigationMenuTriggerStyle()}>
105
+ <a href="#pricing" onClick={(e) => e.preventDefault()}>
106
+ 定价
107
+ </a>
108
+ </NavigationMenuLink>
109
+ </NavigationMenuItem>
89
110
  <NavigationMenuItem>
90
111
  <NavigationMenuLink
91
112
  asChild
92
- className={navigationMenuTriggerStyle()}
113
+ className={cn(
114
+ navigationMenuTriggerStyle(),
115
+ 'pointer-events-none opacity-50',
116
+ )}
117
+ aria-disabled
93
118
  >
119
+ <span>企业版(即将上线)</span>
120
+ </NavigationMenuLink>
121
+ </NavigationMenuItem>
122
+ </NavigationMenuList>
123
+ </NavigationMenu>
124
+ ),
125
+ };
126
+
127
+ export const SimpleLinks: Story = {
128
+ parameters: { layout: 'centered' },
129
+ render: () => (
130
+ <NavigationMenu>
131
+ <NavigationMenuList>
132
+ {['首页', '产品', '文档', '社区', '联系我们'].map((label) => (
133
+ <NavigationMenuItem key={label}>
134
+ <NavigationMenuLink
135
+ asChild
136
+ className={navigationMenuTriggerStyle()}
137
+ >
138
+ <a href={`#${label}`} onClick={(e) => e.preventDefault()}>
139
+ {label}
140
+ </a>
141
+ </NavigationMenuLink>
142
+ </NavigationMenuItem>
143
+ ))}
144
+ </NavigationMenuList>
145
+ </NavigationMenu>
146
+ ),
147
+ };
148
+
149
+ export const DisabledItem: Story = {
150
+ parameters: { layout: 'centered' },
151
+ render: () => (
152
+ <NavigationMenu>
153
+ <NavigationMenuList>
154
+ <NavigationMenuItem>
155
+ <NavigationMenuLink asChild className={navigationMenuTriggerStyle()}>
94
156
  <a href="#docs" onClick={(e) => e.preventDefault()}>
95
157
  文档
96
158
  </a>
@@ -99,10 +161,19 @@ export const Default: Story = {
99
161
  <NavigationMenuItem>
100
162
  <NavigationMenuLink
101
163
  asChild
102
- className={navigationMenuTriggerStyle()}
164
+ aria-disabled
165
+ className={cn(
166
+ navigationMenuTriggerStyle(),
167
+ 'pointer-events-none opacity-50',
168
+ )}
103
169
  >
104
- <a href="#pricing" onClick={(e) => e.preventDefault()}>
105
- 定价
170
+ <span>API(内部预览)</span>
171
+ </NavigationMenuLink>
172
+ </NavigationMenuItem>
173
+ <NavigationMenuItem>
174
+ <NavigationMenuLink asChild className={navigationMenuTriggerStyle()}>
175
+ <a href="#blog" onClick={(e) => e.preventDefault()}>
176
+ 博客
106
177
  </a>
107
178
  </NavigationMenuLink>
108
179
  </NavigationMenuItem>
@@ -110,3 +181,35 @@ export const Default: Story = {
110
181
  </NavigationMenu>
111
182
  ),
112
183
  };
184
+
185
+ /**
186
+ * “纵向”其实是侧边列表形态的导航。Radix `NavigationMenu` 主要面向水平、
187
+ * 可开富面板的主导航;需要侧边导航选 `Sidebar`。下面是将 NavigationMenu
188
+ * `orientation="vertical"` 下的简样实例(供对齐 antd `Menu mode="vertical"` 的过度能力)。
189
+ */
190
+ export const Vertical: Story = {
191
+ parameters: { layout: 'centered' },
192
+ render: () => (
193
+ <NavigationMenu orientation="vertical" className="w-56 max-w-none flex-col items-stretch">
194
+ <NavigationMenuList className="w-full flex-col items-stretch gap-0">
195
+ {[
196
+ { label: '仪表盘', href: '#dashboard' },
197
+ { label: '项目', href: '#projects' },
198
+ { label: '任务', href: '#tasks' },
199
+ { label: '设置', href: '#settings' },
200
+ ].map((it) => (
201
+ <NavigationMenuItem key={it.label} className="w-full">
202
+ <NavigationMenuLink
203
+ asChild
204
+ className={cn(navigationMenuTriggerStyle(), 'w-full justify-start')}
205
+ >
206
+ <a href={it.href} onClick={(e) => e.preventDefault()}>
207
+ {it.label}
208
+ </a>
209
+ </NavigationMenuLink>
210
+ </NavigationMenuItem>
211
+ ))}
212
+ </NavigationMenuList>
213
+ </NavigationMenu>
214
+ ),
215
+ };
@@ -11,7 +11,10 @@ const NavigationMenu = React.forwardRef<
11
11
  >(({ className, children, ...props }, ref) => (
12
12
  <NavigationMenuPrimitive.Root
13
13
  ref={ref}
14
- className={cn('relative z-10 flex max-w-max flex-1 items-center justify-center', className)}
14
+ className={cn(
15
+ 'relative z-10 flex max-w-max flex-1 items-center justify-center',
16
+ className,
17
+ )}
15
18
  {...props}
16
19
  >
17
20
  {children}
@@ -38,7 +41,7 @@ NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName;
38
41
  const NavigationMenuItem = NavigationMenuPrimitive.Item;
39
42
 
40
43
  const navigationMenuTriggerStyle = cva(
41
- 'group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50',
44
+ 'group inline-flex h-9 w-max cursor-pointer items-center justify-center rounded-md bg-background px-4 py-2 text-xs font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50',
42
45
  );
43
46
 
44
47
  const NavigationMenuTrigger = React.forwardRef<
@@ -84,7 +87,7 @@ const NavigationMenuViewport = React.forwardRef<
84
87
  <NavigationMenuPrimitive.Viewport
85
88
  ref={ref}
86
89
  className={cn(
87
- 'origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]',
90
+ 'origin-top-center relative mt-1.5 h-radix-nav-viewport w-full overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-radix-nav-viewport',
88
91
  className,
89
92
  )}
90
93
  {...props}
@@ -101,11 +104,12 @@ const NavigationMenuIndicator = React.forwardRef<
101
104
  <NavigationMenuPrimitive.Indicator
102
105
  ref={ref}
103
106
  className={cn(
104
- 'top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in',
107
+ 'top-full z-1 flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in',
105
108
  className,
106
109
  )}
107
110
  {...props}
108
111
  >
112
+ {/* eslint-disable-next-line teamix-evo/no-arbitrary-tw-value -- indicator arrow tip alignment 60% is shadcn-canonical, not a tokenizable layout value. */}
109
113
  <div className="relative top-[60%] size-2 rotate-45 rounded-tl-sm bg-border shadow-md" />
110
114
  </NavigationMenuPrimitive.Indicator>
111
115
  ));
@@ -4,12 +4,13 @@ name: notification
4
4
  type: component
5
5
  category: feedback
6
6
  since: 0.1.0
7
- package: "@teamix-evo/ui"
7
+ package: '@teamix-evo/ui'
8
+ displayName: 通知
8
9
  ---
9
10
 
10
- # Notification
11
+ # Notification 通知
11
12
 
12
- 卡片式通知 — antd 独有补足。**等价 antd `Notification`**(右上角 title + description 卡片),与 sonner 同一渲染栈。基于 sonner `toast.custom` 二次封装,业务侧**只需要挂载一次 `<Toaster />`**,后续在任意地方调 `notification.success(...)` / `notification.error(...)` 等触发。
13
+ 卡片式通知 — antd 独有补足。**等价 antd `Notification`**(右上角 title + description 卡片),与 sonner 同一渲染栈。基于 sonner `toast.custom` 二次封装,业务侧**只需要挂载一次 `<Toaster />`**,后续在任意地方调 `notification.success(...)` / `notification.destructive(...)` 等触发。4 档语义色对齐 [ADR 0021](../../../../docs/adr/0021-semantic-color-api-unification.md):`primary / success / warning / destructive`。
13
14
 
14
15
  ## When to use
15
16
 
@@ -23,19 +24,26 @@ package: "@teamix-evo/ui"
23
24
  - 阻塞式确认 → `Dialog` / `AlertDialog` / `Popconfirm`
24
25
  - 表单字段错误 → `FieldError`(就近显示)
25
26
 
27
+ ## Props
28
+
26
29
  <!-- auto:props:begin -->
30
+
27
31
  _(组件无 `<Name>Props` interface — props 详见 [`notification.tsx`](./notification.tsx))_
32
+
28
33
  <!-- auto:props:end -->
29
34
 
35
+ ## 依赖
36
+
30
37
  <!-- auto:deps:begin -->
38
+
31
39
  ### 同库依赖
32
40
 
33
41
  > `teamix-evo ui add notification` 时,以下 entry 会被自动连带安装(无需手动 add)。
34
42
 
35
- | Entry | 类型 | 描述 |
36
- | --- | --- | --- |
37
- | `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
38
- | `sonner` | component | Toast 通知 — sonner 包装,等价 antd message + notification 并集(toast() 函数式 API + Toaster 容器) |
43
+ | Entry | 类型 | 描述 |
44
+ | -------- | --------- | -------------------------------------------------------------------------------------------------------------------------- |
45
+ | `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
46
+ | `sonner` | component | Toast 通知 — sonner 包装,等价 antd message + notification 并集(toast() 函数式 API + Toaster 容器,面性 5 状态图标 + 无边框) |
39
47
 
40
48
  ### npm 依赖
41
49
 
@@ -44,6 +52,7 @@ _(组件无 `<Name>Props` interface — props 详见 [`notification.tsx`](./noti
44
52
  ```bash
45
53
  pnpm add sonner@^1.5.0 lucide-react@^0.460.0
46
54
  ```
55
+
47
56
  <!-- auto:deps:end -->
48
57
 
49
58
  ## AI 生成纪律
@@ -51,7 +60,7 @@ pnpm add sonner@^1.5.0 lucide-react@^0.460.0
51
60
  - **业务侧必须挂载 `<Toaster />`** —— Notification 与 toast 共用同一容器,通常挂在 root layout
52
61
  - **`title` 用动词或事件名**:"部署成功"/"订单已创建";**不要**写"提示"等空话
53
62
  - **`description` 解释后果或下一步**:"用户可在 1 分钟内访问新版本"/"详情请查看订单页";**不要**重复 title
54
- - **类型语义不要混淆**:`success` 用于成功完成,`warning` 用于风险提示但操作未失败,`error` 用于真正失败 — 与 `Alert` / `Toast` 的语义一致
63
+ - **语义不要混淆**:`success` 用于成功完成,`warning` 用于风险提示但操作未失败,`destructive` 用于真正失败 — 与 `Alert` / `Toast` 的语义一致(对齐 ADR 0021,不再使用 `info` / `error` 字面)
55
64
  - **不要在 onConfirm 里同时调 toast 和 notification** — 单次反馈选一种,避免视觉噪音
56
65
  - **`destroy(id)` 主动关闭**:用于"自动重试成功"等场景,把之前的 error notification 替换掉
57
66
 
@@ -71,14 +80,14 @@ notification.warning({
71
80
  description: '请在 3 天内续费,否则服务将暂停',
72
81
  });
73
82
 
74
- notification.error({
83
+ notification.destructive({
75
84
  title: '上传失败',
76
85
  description: '请检查网络连接后重试',
77
86
  });
78
87
 
79
88
  // 自定义 + 操作按钮(action 透传 sonner)
80
89
  const id = notification.open({
81
- type: 'info',
90
+ color: 'primary',
82
91
  title: '新版本可用',
83
92
  description: 'v2.5 已发布,刷新页面以应用更新',
84
93
  action: { label: '刷新', onClick: () => location.reload() },
@@ -89,3 +98,36 @@ notification.destroy(id);
89
98
  ```
90
99
 
91
100
  > 应用根组件需要挂载一次 `<Toaster />`(来自 `sonner` entry),Notification 与 toast 共用此容器。
101
+
102
+ ---
103
+
104
+ ## Notification 形态 — 旧库 API → 新映射
105
+
106
+ > 旧库 `Notification`(hybridcloud,含 open/success/error/warning 命令式) → 新库 `notification`(小写对象)。
107
+ > 新库基于 sonner `toast.custom` 封装,共用 `<Toaster />` 容器。
108
+
109
+ ### 命名 & 结构映射
110
+
111
+ | 旧库 | 新库 | 说明 |
112
+ | ------------------------------------ | ----------------------------------------- | ----------------------------- |
113
+ | `Notification` (类) | `notification` (对象) | 大小写变更 |
114
+ | `Notification.success()` | `notification.success()` | 直接映射 |
115
+ | `Notification.error()` | `notification.destructive()` | error → destructive(ADR 0021) |
116
+ | `Notification.warning()` | `notification.warning()` | 直接映射 |
117
+ | `Notification.notice()` | `notification.open({ color: 'primary' })` | notice → primary |
118
+ | `options.content` | `options.description` | 字段重命名 |
119
+ | `options.type` | `options.color` | type → color(4 档语义色) |
120
+ | `Notification.close(key)` | `notification.destroy(id)` | 主动关闭 |
121
+ | `Notification.config({ placement })` | `<Toaster position="..." />` | 声明式配置 |
122
+ | `size: large/medium` | 不复刻 | 固定尺寸 |
123
+ | `icon` 自定义 | 不复刻 | 固定语义图标(规范化) |
124
+ | `type='help'` | `notification.open({ color: 'primary' })` | 合并到 primary |
125
+
126
+ ### 迁移 FAQ
127
+
128
+ | 问题 | 回答 |
129
+ | ----------------------------- | ------------------------------------------------------------------- |
130
+ | error 为什么变成 destructive? | 对齐 ADR 0021 语义色规范,统一用 destructive 表示错误/危险 |
131
+ | Notification 和 toast 的关系? | 共用 Toaster 容器;简短提示用 toast,带标题+描述的卡片用 notification |
132
+ | 怎么控制位置? | `<Toaster position="top-right" />`(默认右上) |
133
+ | 怎么加 action 按钮? | `notification.open({ ..., action: { label, onClick } })` |
@@ -1,16 +1,16 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import { Toaster } from '@/components/sonner/sonner';
3
3
  import { notification } from './notification';
4
4
  import { Button } from '@/components/button/button';
5
5
 
6
6
  const meta: Meta = {
7
- title: '反馈与浮层 · Feedback/Notification',
7
+ title: '反馈 · Feedback/Notification',
8
8
  tags: ['autodocs'],
9
9
  parameters: {
10
10
  docs: {
11
11
  description: {
12
12
  component:
13
- '卡片式通知 — 右上角 title + description 卡片(部署成功 / 配额提醒)。基于 sonner toast.custom,业务侧只需挂载一次 `<Toaster />`,后续在任意地方 imperative 触发。等价 antd `Notification`,与 toast(message)互补。视觉走 OpenTrek tokens,所有样式来自 `@teamix-evo/design`,无 mock。',
13
+ '卡片式通知 — 右上角 title + description 卡片(部署成功 / 配额提醒)。基于 sonner toast.custom,业务侧只需挂载一次 `<Toaster />`,后续在任意地方 imperative 触发。4 档语义色(primary / success / warning / destructive)对齐 ADR 0021,与 toast(message)互补。',
14
14
  },
15
15
  },
16
16
  },
@@ -27,10 +27,13 @@ export const Playground: Story = {
27
27
  <Button
28
28
  variant="outline"
29
29
  onClick={() =>
30
- notification.info({ title: '提示', description: '这是一条 info 通知' })
30
+ notification.primary({
31
+ title: '提示',
32
+ description: '这是一条 primary 通知',
33
+ })
31
34
  }
32
35
  >
33
- Info
36
+ Primary
34
37
  </Button>
35
38
  <Button
36
39
  onClick={() =>
@@ -56,13 +59,13 @@ export const Playground: Story = {
56
59
  <Button
57
60
  variant="destructive"
58
61
  onClick={() =>
59
- notification.error({
62
+ notification.destructive({
60
63
  title: '上传失败',
61
64
  description: '请检查网络连接后重试',
62
65
  })
63
66
  }
64
67
  >
65
- Error
68
+ Destructive
66
69
  </Button>
67
70
  </div>
68
71
  </div>
@@ -76,13 +79,12 @@ export const WithAction: Story = {
76
79
  <Button
77
80
  onClick={() =>
78
81
  notification.open({
79
- type: 'info',
82
+ color: 'primary',
80
83
  title: '新版本可用',
81
84
  description: 'v2.5 已发布,刷新页面以应用更新',
82
85
  action: {
83
86
  label: '刷新',
84
87
  onClick: () => {
85
- // eslint-disable-next-line no-alert
86
88
  alert('刷新');
87
89
  },
88
90
  },
@@ -14,40 +14,54 @@ import { cn } from '@/utils/cn';
14
14
  * - `notification.open()` 是 **title + description 卡片**(对应 antd `notification`)
15
15
  */
16
16
 
17
- export type NotificationType = 'info' | 'success' | 'warning' | 'error';
17
+ export type NotificationColor =
18
+ | 'primary'
19
+ | 'success'
20
+ | 'warning'
21
+ | 'destructive';
18
22
 
19
- export interface NotificationOptions extends Omit<ExternalToast, 'description' | 'icon'> {
23
+ export interface NotificationOptions
24
+ extends Omit<ExternalToast, 'description' | 'icon'> {
20
25
  /** 标题(antd `message` 并集,但 antd 这里命名为 message,易混淆 — 我们用更准确的 `title`)。 */
21
26
  title: React.ReactNode;
22
27
  /** 描述(antd `description` 并集)。 */
23
28
  description?: React.ReactNode;
24
29
  /**
25
- * 状态 — 决定左侧 icon 颜色;`open()` 默认 `info`。
26
- * `success` / `warning` / `error` 也可用对应快捷方法。
30
+ * 语义色(对齐 ADR 0021)— 决定左侧 icon 颜色;`open()` 默认 `primary`。
31
+ * `success` / `warning` / `destructive` 也可用对应快捷方法。
27
32
  */
28
- type?: NotificationType;
33
+ color?: NotificationColor;
34
+ /**
35
+ * 自定义左侧 icon — 覆盖默认按 `color` 映射的 lucide icon。
36
+ * 传 `null` 显式隐藏 icon(只展示文字内容)。
37
+ * @example
38
+ * notification.open({ icon: <UserPlus className="size-5 text-primary" />, title: '新用户加入' })
39
+ */
40
+ icon?: React.ReactNode | null;
29
41
  }
30
42
 
31
- const iconMap: Record<NotificationType, React.ReactNode> = {
32
- info: <Info className="size-5 text-primary" />,
33
- success: <CheckCircle2 className="size-5 text-emerald-500" />,
34
- warning: <AlertCircle className="size-5 text-amber-500" />,
35
- error: <XCircle className="size-5 text-destructive" />,
43
+ const iconMap: Record<NotificationColor, React.ReactNode> = {
44
+ primary: <Info className="size-5 text-primary" />,
45
+ success: <CheckCircle2 className="size-5 text-success" />,
46
+ warning: <AlertCircle className="size-5 text-warning" />,
47
+ destructive: <XCircle className="size-5 text-destructive" />,
36
48
  };
37
49
 
38
50
  function fire(
39
- type: NotificationType,
40
- { title, description, ...rest }: NotificationOptions,
51
+ color: NotificationColor,
52
+ { title, description, icon, ...rest }: NotificationOptions,
41
53
  ) {
54
+ // icon: undefined → 默认按 color 映射;null → 显式隐藏 icon;其他 ReactNode → 自定义
55
+ const iconNode = icon === undefined ? iconMap[color] : icon;
42
56
  return toast.custom(
43
57
  (id) => (
44
58
  <div
45
59
  role="alert"
46
60
  className={cn(
47
- 'flex w-[360px] gap-3 rounded-md border bg-background p-4 text-sm shadow-lg',
61
+ 'flex w-notification gap-3 rounded-md border border-border bg-background p-4 text-xs shadow-lg',
48
62
  )}
49
63
  >
50
- <span className="mt-0.5 shrink-0">{iconMap[type]}</span>
64
+ {iconNode ? <span className="mt-0.5 shrink-0">{iconNode}</span> : null}
51
65
  <div className="min-w-0 flex-1">
52
66
  <div className="font-semibold leading-tight">{title}</div>
53
67
  {description ? (
@@ -58,7 +72,7 @@ function fire(
58
72
  type="button"
59
73
  aria-label="关闭"
60
74
  onClick={() => toast.dismiss(id)}
61
- className="text-muted-foreground transition-colors hover:text-foreground"
75
+ className="cursor-pointer text-muted-foreground transition-colors hover:text-foreground"
62
76
  >
63
77
  ×
64
78
  </button>
@@ -70,13 +84,14 @@ function fire(
70
84
 
71
85
  const notification = {
72
86
  /**
73
- * 通用打开 — 通过 `type` 区分状态;若只传 title,样式同 `info`。
87
+ * 通用打开 — 通过 `color` 区分状态;若只传 title,样式同 `primary`。
74
88
  */
75
- open: (opts: NotificationOptions) => fire(opts.type ?? 'info', opts),
76
- info: (opts: Omit<NotificationOptions, 'type'>) => fire('info', opts),
77
- success: (opts: Omit<NotificationOptions, 'type'>) => fire('success', opts),
78
- warning: (opts: Omit<NotificationOptions, 'type'>) => fire('warning', opts),
79
- error: (opts: Omit<NotificationOptions, 'type'>) => fire('error', opts),
89
+ open: (opts: NotificationOptions) => fire(opts.color ?? 'primary', opts),
90
+ primary: (opts: Omit<NotificationOptions, 'color'>) => fire('primary', opts),
91
+ success: (opts: Omit<NotificationOptions, 'color'>) => fire('success', opts),
92
+ warning: (opts: Omit<NotificationOptions, 'color'>) => fire('warning', opts),
93
+ destructive: (opts: Omit<NotificationOptions, 'color'>) =>
94
+ fire('destructive', opts),
80
95
  /** 主动关闭某条(传 `id`)/ 全部(不传)。 */
81
96
  destroy: (id?: string | number) => toast.dismiss(id),
82
97
  };