@teamix-evo/ui 0.2.0 → 0.4.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 (296) hide show
  1. package/README.md +184 -184
  2. package/manifest.json +695 -487
  3. package/package.json +16 -10
  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 +341 -35
  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 +147 -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 +439 -89
  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 +79 -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 +1086 -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 +354 -4
  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/input.meta.md +44 -43
  116. package/src/components/input/input.stories.tsx +62 -35
  117. package/src/components/input/input.tsx +96 -101
  118. package/src/components/input-group/input-group.meta.md +53 -39
  119. package/src/components/input-group/input-group.stories.tsx +49 -16
  120. package/src/components/input-group/input-group.tsx +45 -10
  121. package/src/components/input-number/input-number.meta.md +68 -20
  122. package/src/components/input-number/input-number.stories.tsx +33 -6
  123. package/src/components/input-number/input-number.tsx +81 -22
  124. package/src/components/input-otp/input-otp.meta.md +8 -20
  125. package/src/components/input-otp/input-otp.stories.tsx +3 -3
  126. package/src/components/input-otp/input-otp.tsx +1 -1
  127. package/src/components/item/item.meta.md +8 -26
  128. package/src/components/item/item.stories.tsx +3 -3
  129. package/src/components/item/item.tsx +7 -6
  130. package/src/components/kbd/kbd.meta.md +7 -19
  131. package/src/components/kbd/kbd.stories.tsx +4 -4
  132. package/src/components/kbd/kbd.tsx +8 -4
  133. package/src/components/label/label.meta.md +21 -18
  134. package/src/components/label/label.stories.tsx +64 -6
  135. package/src/components/label/label.tsx +91 -19
  136. package/src/components/masonry/masonry.meta.md +8 -12
  137. package/src/components/masonry/masonry.stories.tsx +4 -4
  138. package/src/components/mentions/mentions.meta.md +42 -21
  139. package/src/components/mentions/mentions.stories.tsx +120 -6
  140. package/src/components/mentions/mentions.tsx +10 -5
  141. package/src/components/menubar/menubar.meta.md +4 -8
  142. package/src/components/menubar/menubar.stories.tsx +55 -3
  143. package/src/components/menubar/menubar.tsx +9 -9
  144. package/src/components/native-select/native-select.meta.md +7 -11
  145. package/src/components/native-select/native-select.stories.tsx +4 -4
  146. package/src/components/native-select/native-select.tsx +2 -2
  147. package/src/components/navigation-menu/navigation-menu.meta.md +4 -8
  148. package/src/components/navigation-menu/navigation-menu.stories.tsx +106 -3
  149. package/src/components/navigation-menu/navigation-menu.tsx +6 -3
  150. package/src/components/notification/notification.meta.md +41 -8
  151. package/src/components/notification/notification.stories.tsx +9 -9
  152. package/src/components/notification/notification.tsx +34 -19
  153. package/src/components/page-header/DEVELOPMENT.md +842 -0
  154. package/src/components/page-header/page-header.meta.md +210 -0
  155. package/src/components/page-header/page-header.stories.tsx +428 -0
  156. package/src/components/page-header/page-header.tsx +284 -0
  157. package/src/components/page-shell/page-shell.meta.md +116 -0
  158. package/src/components/page-shell/page-shell.stories.tsx +149 -0
  159. package/src/components/page-shell/page-shell.tsx +115 -0
  160. package/src/components/pagination/pagination.meta.md +122 -50
  161. package/src/components/pagination/pagination.stories.tsx +227 -11
  162. package/src/components/pagination/pagination.tsx +345 -63
  163. package/src/components/popconfirm/popconfirm.meta.md +19 -23
  164. package/src/components/popconfirm/popconfirm.stories.tsx +2 -2
  165. package/src/components/popconfirm/popconfirm.tsx +1 -1
  166. package/src/components/popover/popover.meta.md +64 -12
  167. package/src/components/popover/popover.stories.tsx +83 -7
  168. package/src/components/popover/popover.tsx +77 -28
  169. package/src/components/progress/progress.meta.md +43 -26
  170. package/src/components/progress/progress.stories.tsx +2 -2
  171. package/src/components/progress/progress.tsx +19 -11
  172. package/src/components/radio-group/radio-group.meta.md +78 -11
  173. package/src/components/radio-group/radio-group.stories.tsx +38 -2
  174. package/src/components/radio-group/radio-group.tsx +149 -18
  175. package/src/components/rate/rate.meta.md +41 -19
  176. package/src/components/rate/rate.stories.tsx +2 -2
  177. package/src/components/rate/rate.tsx +37 -10
  178. package/src/components/resizable/resizable.meta.md +4 -12
  179. package/src/components/resizable/resizable.stories.tsx +5 -5
  180. package/src/components/resizable/resizable.tsx +1 -1
  181. package/src/components/result/result.meta.md +10 -14
  182. package/src/components/result/result.stories.tsx +2 -2
  183. package/src/components/result/result.tsx +21 -12
  184. package/src/components/scroll-area/scroll-area.meta.md +4 -8
  185. package/src/components/scroll-area/scroll-area.stories.tsx +5 -5
  186. package/src/components/segmented/segmented.meta.md +15 -17
  187. package/src/components/segmented/segmented.stories.tsx +3 -3
  188. package/src/components/segmented/segmented.tsx +16 -8
  189. package/src/components/select/select.meta.md +199 -67
  190. package/src/components/select/select.stories.tsx +238 -63
  191. package/src/components/select/select.tsx +718 -171
  192. package/src/components/separator/separator.meta.md +10 -14
  193. package/src/components/separator/separator.stories.tsx +2 -2
  194. package/src/components/separator/separator.tsx +3 -7
  195. package/src/components/sheet/sheet.meta.md +26 -21
  196. package/src/components/sheet/sheet.stories.tsx +116 -10
  197. package/src/components/sheet/sheet.tsx +116 -29
  198. package/src/components/sidebar/sidebar.meta.md +29 -38
  199. package/src/components/sidebar/sidebar.stories.tsx +696 -29
  200. package/src/components/sidebar/sidebar.tsx +643 -141
  201. package/src/components/skeleton/skeleton.meta.md +7 -31
  202. package/src/components/skeleton/skeleton.stories.tsx +3 -3
  203. package/src/components/skeleton/skeleton.tsx +7 -7
  204. package/src/components/slider/slider.meta.md +60 -13
  205. package/src/components/slider/slider.stories.tsx +58 -6
  206. package/src/components/slider/slider.tsx +154 -13
  207. package/src/components/sonner/sonner.meta.md +54 -8
  208. package/src/components/sonner/sonner.stories.tsx +79 -11
  209. package/src/components/sonner/sonner.tsx +137 -8
  210. package/src/components/spinner/spinner.meta.md +57 -21
  211. package/src/components/spinner/spinner.stories.tsx +66 -14
  212. package/src/components/spinner/spinner.tsx +111 -9
  213. package/src/components/statistic/statistic.meta.md +14 -30
  214. package/src/components/statistic/statistic.stories.tsx +1 -1
  215. package/src/components/statistic/statistic.tsx +4 -5
  216. package/src/components/steps/steps.meta.md +20 -15
  217. package/src/components/steps/steps.stories.tsx +37 -2
  218. package/src/components/steps/steps.tsx +15 -12
  219. package/src/components/switch/switch.meta.md +56 -15
  220. package/src/components/switch/switch.stories.tsx +5 -5
  221. package/src/components/switch/switch.tsx +59 -13
  222. package/src/components/table/table.meta.md +3 -7
  223. package/src/components/table/table.stories.tsx +1 -1
  224. package/src/components/table/table.tsx +8 -6
  225. package/src/components/tabs/tabs.meta.md +40 -32
  226. package/src/components/tabs/tabs.stories.tsx +104 -26
  227. package/src/components/tabs/tabs.tsx +125 -54
  228. package/src/components/tag/tag.meta.md +104 -68
  229. package/src/components/tag/tag.stories.tsx +183 -15
  230. package/src/components/tag/tag.tsx +222 -21
  231. package/src/components/textarea/textarea.meta.md +42 -31
  232. package/src/components/textarea/textarea.stories.tsx +32 -6
  233. package/src/components/textarea/textarea.tsx +32 -8
  234. package/src/components/time-picker/time-picker.meta.md +119 -50
  235. package/src/components/time-picker/time-picker.stories.tsx +65 -33
  236. package/src/components/time-picker/time-picker.tsx +889 -101
  237. package/src/components/timeline/timeline.meta.md +16 -17
  238. package/src/components/timeline/timeline.stories.tsx +24 -4
  239. package/src/components/timeline/timeline.tsx +32 -12
  240. package/src/components/toggle/toggle.meta.md +8 -12
  241. package/src/components/toggle/toggle.stories.tsx +4 -4
  242. package/src/components/toggle/toggle.tsx +4 -3
  243. package/src/components/toggle-group/toggle-group.meta.md +10 -14
  244. package/src/components/toggle-group/toggle-group.stories.tsx +3 -3
  245. package/src/components/toggle-group/toggle-group.tsx +2 -2
  246. package/src/components/tooltip/tooltip.meta.md +63 -18
  247. package/src/components/tooltip/tooltip.stories.tsx +42 -5
  248. package/src/components/tooltip/tooltip.tsx +81 -21
  249. package/src/components/tour/tour.meta.md +16 -20
  250. package/src/components/tour/tour.stories.tsx +3 -3
  251. package/src/components/tour/tour.tsx +3 -3
  252. package/src/components/transfer/transfer.meta.md +18 -22
  253. package/src/components/transfer/transfer.stories.tsx +2 -2
  254. package/src/components/transfer/transfer.tsx +28 -21
  255. package/src/components/tree/tree.meta.md +67 -22
  256. package/src/components/tree/tree.stories.tsx +1 -1
  257. package/src/components/tree/tree.tsx +9 -8
  258. package/src/components/tree-select/tree-select.meta.md +59 -23
  259. package/src/components/tree-select/tree-select.stories.tsx +2 -2
  260. package/src/components/tree-select/tree-select.tsx +42 -7
  261. package/src/components/typography/typography.meta.md +61 -39
  262. package/src/components/typography/typography.stories.tsx +14 -9
  263. package/src/components/typography/typography.tsx +38 -25
  264. package/src/components/upload/upload.meta.md +61 -25
  265. package/src/components/upload/upload.stories.tsx +69 -3
  266. package/src/components/upload/upload.tsx +170 -37
  267. package/src/components/watermark/watermark.meta.md +15 -19
  268. package/src/components/watermark/watermark.stories.tsx +98 -8
  269. package/src/hooks/use-breakpoint.ts +117 -0
  270. package/src/hooks/use-debounce-callback.ts +52 -0
  271. package/src/hooks/use-mobile.ts +23 -0
  272. package/src/stories/theme-tokens.stories.tsx +747 -0
  273. package/src/utils/trigger-input.ts +57 -0
  274. package/src/components/button/demo/as-child.tsx +0 -24
  275. package/src/components/button/demo/basic.tsx +0 -8
  276. package/src/components/button/demo/block.tsx +0 -16
  277. package/src/components/button/demo/loading.tsx +0 -19
  278. package/src/components/button/demo/shapes.tsx +0 -18
  279. package/src/components/button/demo/sizes.tsx +0 -19
  280. package/src/components/button/demo/variants.tsx +0 -19
  281. package/src/components/button/demo/with-icon.tsx +0 -20
  282. package/src/components/button-group/button-group.meta.md +0 -101
  283. package/src/components/button-group/button-group.stories.tsx +0 -93
  284. package/src/components/button-group/button-group.tsx +0 -75
  285. package/src/components/combobox/combobox.meta.md +0 -102
  286. package/src/components/combobox/combobox.stories.tsx +0 -55
  287. package/src/components/combobox/combobox.tsx +0 -130
  288. package/src/components/input/demo/addon.tsx +0 -15
  289. package/src/components/input/demo/basic.tsx +0 -12
  290. package/src/components/input/demo/clearable.tsx +0 -21
  291. package/src/components/input/demo/show-count.tsx +0 -18
  292. package/src/components/input/demo/sizes.tsx +0 -15
  293. package/src/components/input/demo/with-prefix-suffix.tsx +0 -19
  294. package/src/components/space/space.meta.md +0 -103
  295. package/src/components/space/space.stories.tsx +0 -108
  296. package/src/components/space/space.tsx +0 -106
@@ -2,7 +2,7 @@
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
7
  package: '@teamix-evo/ui'
8
8
  displayName: 导航菜单
@@ -30,9 +30,7 @@ displayName: 导航菜单
30
30
  > 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成。下表是 `NavigationMenu`(Root) 的 props。
31
31
 
32
32
  <!-- auto:props:begin -->
33
-
34
33
  _(组件无 `<Name>Props` interface — props 详见 [`navigation-menu.tsx`](./navigation-menu.tsx))_
35
-
36
34
  <!-- auto:props:end -->
37
35
 
38
36
  ## 依赖
@@ -40,14 +38,13 @@ _(组件无 `<Name>Props` interface — props 详见 [`navigation-menu.tsx`](./n
40
38
  > 以下表格由 `pnpm --filter @teamix-evo/ui gen:meta` 自动生成,数据源是 [`manifest.json`](../../../manifest.json)。**手工编辑 marker 之间的内容会在下次生成时被覆盖**。
41
39
 
42
40
  <!-- auto:deps:begin -->
43
-
44
41
  ### 同库依赖
45
42
 
46
43
  > `teamix-evo ui add navigation-menu` 时,以下 entry 会被自动连带安装(无需手动 add)。
47
44
 
48
- | Entry | 类型 | 描述 |
49
- | ----- | ---- | -------------------------------------------------- |
50
- | `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
45
+ | Entry | 类型 | 描述 |
46
+ | --- | --- | --- |
47
+ | `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
51
48
 
52
49
  ### npm 依赖
53
50
 
@@ -56,7 +53,6 @@ _(组件无 `<Name>Props` interface — props 详见 [`navigation-menu.tsx`](./n
56
53
  ```bash
57
54
  pnpm add @radix-ui/react-navigation-menu@^1.2.0 class-variance-authority@^0.7.0 lucide-react@^0.460.0
58
55
  ```
59
-
60
56
  <!-- auto:deps:end -->
61
57
 
62
58
  > 完整子组件:`NavigationMenu` / `NavigationMenuList` / `NavigationMenuItem` / `NavigationMenuTrigger` / `NavigationMenuContent` / `NavigationMenuLink` / `NavigationMenuIndicator` / `NavigationMenuViewport` + `navigationMenuTriggerStyle`(给独立 Link 复用 trigger 视觉)。
@@ -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,16 +8,17 @@ 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'],
16
17
  parameters: {
17
18
  docs: {
18
19
  description: {
19
20
  component:
20
- '导航菜单网站 / 营销页 / 应用顶部主导航(产品 / 文档 / 定价),每项可有富 Content 面板展示子页面预览。Radix NavigationMenu 实现,shadcn 显式版,与 Menubar(应用级菜单)互补。',
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。',
21
22
  },
22
23
  },
23
24
  },
@@ -106,6 +107,108 @@ export const Default: Story = {
106
107
  </a>
107
108
  </NavigationMenuLink>
108
109
  </NavigationMenuItem>
110
+ <NavigationMenuItem>
111
+ <NavigationMenuLink
112
+ asChild
113
+ className={cn(
114
+ navigationMenuTriggerStyle(),
115
+ 'pointer-events-none opacity-50',
116
+ )}
117
+ aria-disabled
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()}>
156
+ <a href="#docs" onClick={(e) => e.preventDefault()}>
157
+ 文档
158
+ </a>
159
+ </NavigationMenuLink>
160
+ </NavigationMenuItem>
161
+ <NavigationMenuItem>
162
+ <NavigationMenuLink
163
+ asChild
164
+ aria-disabled
165
+ className={cn(
166
+ navigationMenuTriggerStyle(),
167
+ 'pointer-events-none opacity-50',
168
+ )}
169
+ >
170
+ <span>API(内部预览)</span>
171
+ </NavigationMenuLink>
172
+ </NavigationMenuItem>
173
+ <NavigationMenuItem>
174
+ <NavigationMenuLink asChild className={navigationMenuTriggerStyle()}>
175
+ <a href="#blog" onClick={(e) => e.preventDefault()}>
176
+ 博客
177
+ </a>
178
+ </NavigationMenuLink>
179
+ </NavigationMenuItem>
180
+ </NavigationMenuList>
181
+ </NavigationMenu>
182
+ ),
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
+ ))}
109
212
  </NavigationMenuList>
110
213
  </NavigationMenu>
111
214
  ),
@@ -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-radix-nav-viewport 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-radix-nav-viewport',
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}
@@ -10,7 +10,7 @@ displayName: 通知
10
10
 
11
11
  # Notification 通知
12
12
 
13
- 卡片式通知 — 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`。
14
14
 
15
15
  ## When to use
16
16
 
@@ -40,10 +40,10 @@ _(组件无 `<Name>Props` interface — props 详见 [`notification.tsx`](./noti
40
40
 
41
41
  > `teamix-evo ui add notification` 时,以下 entry 会被自动连带安装(无需手动 add)。
42
42
 
43
- | Entry | 类型 | 描述 |
44
- | -------- | --------- | ------------------------------------------------------------------------------------------------- |
45
- | `cn` | util | Tailwind className 合并工具(clsx + tailwind-merge) |
46
- | `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 状态图标 + 无边框) |
47
47
 
48
48
  ### npm 依赖
49
49
 
@@ -60,7 +60,7 @@ pnpm add sonner@^1.5.0 lucide-react@^0.460.0
60
60
  - **业务侧必须挂载 `<Toaster />`** —— Notification 与 toast 共用同一容器,通常挂在 root layout
61
61
  - **`title` 用动词或事件名**:"部署成功"/"订单已创建";**不要**写"提示"等空话
62
62
  - **`description` 解释后果或下一步**:"用户可在 1 分钟内访问新版本"/"详情请查看订单页";**不要**重复 title
63
- - **类型语义不要混淆**:`success` 用于成功完成,`warning` 用于风险提示但操作未失败,`error` 用于真正失败 — 与 `Alert` / `Toast` 的语义一致
63
+ - **语义不要混淆**:`success` 用于成功完成,`warning` 用于风险提示但操作未失败,`destructive` 用于真正失败 — 与 `Alert` / `Toast` 的语义一致(对齐 ADR 0021,不再使用 `info` / `error` 字面)
64
64
  - **不要在 onConfirm 里同时调 toast 和 notification** — 单次反馈选一种,避免视觉噪音
65
65
  - **`destroy(id)` 主动关闭**:用于"自动重试成功"等场景,把之前的 error notification 替换掉
66
66
 
@@ -80,14 +80,14 @@ notification.warning({
80
80
  description: '请在 3 天内续费,否则服务将暂停',
81
81
  });
82
82
 
83
- notification.error({
83
+ notification.destructive({
84
84
  title: '上传失败',
85
85
  description: '请检查网络连接后重试',
86
86
  });
87
87
 
88
88
  // 自定义 + 操作按钮(action 透传 sonner)
89
89
  const id = notification.open({
90
- type: 'info',
90
+ color: 'primary',
91
91
  title: '新版本可用',
92
92
  description: 'v2.5 已发布,刷新页面以应用更新',
93
93
  action: { label: '刷新', onClick: () => location.reload() },
@@ -98,3 +98,36 @@ notification.destroy(id);
98
98
  ```
99
99
 
100
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)互补。',
13
+ '卡片式通知 — 右上角 title + description 卡片(部署成功 / 配额提醒)。基于 sonner toast.custom,业务侧只需挂载一次 `<Toaster />`,后续在任意地方 imperative 触发。4 档语义色(primary / success / warning / destructive)对齐 ADR 0021,与 toast(message)互补。',
14
14
  },
15
15
  },
16
16
  },
@@ -27,13 +27,13 @@ export const Playground: Story = {
27
27
  <Button
28
28
  variant="outline"
29
29
  onClick={() =>
30
- notification.info({
30
+ notification.primary({
31
31
  title: '提示',
32
- description: '这是一条 info 通知',
32
+ description: '这是一条 primary 通知',
33
33
  })
34
34
  }
35
35
  >
36
- Info
36
+ Primary
37
37
  </Button>
38
38
  <Button
39
39
  onClick={() =>
@@ -59,13 +59,13 @@ export const Playground: Story = {
59
59
  <Button
60
60
  variant="destructive"
61
61
  onClick={() =>
62
- notification.error({
62
+ notification.destructive({
63
63
  title: '上传失败',
64
64
  description: '请检查网络连接后重试',
65
65
  })
66
66
  }
67
67
  >
68
- Error
68
+ Destructive
69
69
  </Button>
70
70
  </div>
71
71
  </div>
@@ -79,7 +79,7 @@ export const WithAction: Story = {
79
79
  <Button
80
80
  onClick={() =>
81
81
  notification.open({
82
- type: 'info',
82
+ color: 'primary',
83
83
  title: '新版本可用',
84
84
  description: 'v2.5 已发布,刷新页面以应用更新',
85
85
  action: {
@@ -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" />,
43
+ const iconMap: Record<NotificationColor, React.ReactNode> = {
44
+ primary: <Info className="size-5 text-primary" />,
33
45
  success: <CheckCircle2 className="size-5 text-success" />,
34
46
  warning: <AlertCircle className="size-5 text-warning" />,
35
- error: <XCircle className="size-5 text-destructive" />,
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-notification 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
  };