@manohub/ui 1.2.12 → 1.2.14

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 (32) hide show
  1. package/README.md +1 -1
  2. package/dist/components/button/index.d.ts +12 -98
  3. package/dist/components/button/index.js +17 -41
  4. package/dist/components/dropdown/dropdown-item.d.ts +88 -0
  5. package/dist/components/dropdown/dropdown-item.js +84 -0
  6. package/dist/components/dropdown/dropdown-panel.d.ts +129 -0
  7. package/dist/components/dropdown/dropdown-panel.js +89 -0
  8. package/dist/components/dropdown/dropdown-separator.d.ts +1 -0
  9. package/dist/components/dropdown/dropdown-separator.js +17 -0
  10. package/dist/components/dropdown/dropdown-shared.d.ts +33 -0
  11. package/dist/components/dropdown/dropdown-shared.js +8 -0
  12. package/dist/components/dropdown/index.d.ts +372 -0
  13. package/dist/components/dropdown/index.js +282 -0
  14. package/dist/components/select/index.js +2 -1
  15. package/dist/components/select/select-shared.d.ts +2 -7
  16. package/dist/components/select/select-shared.js +3 -3
  17. package/dist/components/select/select-tree.js +2 -1
  18. package/dist/components/tooltip/index.d.ts +1 -1
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.js +2 -0
  21. package/dist/styles/components/button.css +6 -59
  22. package/dist/styles/components/button.tokens.css +4 -4
  23. package/dist/styles/components/dialog.css +18 -9
  24. package/dist/styles/components/drawer.css +25 -9
  25. package/dist/styles/components/dropdown.css +124 -0
  26. package/dist/styles/components/dropdown.tokens.css +16 -0
  27. package/dist/styles/components/tooltip.css +6 -2
  28. package/dist/styles/index.css +2 -0
  29. package/dist/styles/operations/popup.css +15 -8
  30. package/dist/utils/popover.d.ts +14 -0
  31. package/dist/utils/popover.js +8 -0
  32. package/package.json +2 -2
package/README.md CHANGED
@@ -74,7 +74,7 @@ import { Card, Form, Tree, Checkbox } from '@manohub/ui'
74
74
  | 容器与分区 | `Page`(页面级骨架:`.Header` / `.Body` / `.Footer` / `.Filter` / `.Split`)、`Panel`(+ `.Header` / `.Body` / `.Footer`)、`Card`(+ 三件)、`Layout`(`Layout.Row` 排「行」/ `Layout.Column` 排「列」:轴向 × 间距档 × 对齐) |
75
75
  | 数据展示 | `Tree`(层级)、`List`(扁平导航;与 `Tree` 同族:同目录 / 同一份面 / 同一份行渲染)、`ListView`(+ `.CardItem`)、`Badge`、`Tag`(`Badge` 的可关闭 / 可新增封装) |
76
76
  | 展示 | `Avatar`(+ `.Group`)、`Skeleton`(行 / 列表 / 块状) |
77
- | 表单基础(**自绘**) | `Button`(+ `.Group` / `.Divider`;五型 / 小号 / 加载 / 菜单按钮 / 连体切换)、`Input`(+ `.Group` / `.Chip` / `.Display` / `.Textarea`;清除 / 可见性切换 / 校验)、`Search`(搜索框:值 / 搜索 / 清空三条回调)、`Select`(单选 / 多选 / 搜索 / 加载;面板用原生 popover)、`SelectTree`(树形态:仅叶子可选 + 本地过滤 + 命中高亮;与 `Select` 平级导出、共用触发器与面板)、`DatePicker`(+ `.Range`;值与比较都是 `YYYY-MM-DD` 字符串,**独立一族**、自带触发器 / 面板壳 / 面文件,面板是原生 popover 里的一段日历)、`DateTimePicker`(日期 + 时间:值 `YYYY-MM-DD HH:mm:ss`,面板底部一行「时 : 分 [: 秒] + 此刻」)、`Switch`(表格档 / 表单档) |
77
+ | 表单基础(**自绘**) | `Button`(+ `.Group` / `.Divider`;五型 / 小号 / 加载 / 按钮组 / 连体切换)、`Dropdown`(+ `.Item` / `.Separator`;动作菜单:声明式项 / 分隔线 / 图标 / 快捷键 / 受控 `v-model:open`;面板用原生 popover,值选择仍归 `Select`)、`Input`(+ `.Group` / `.Chip` / `.Display` / `.Textarea`;清除 / 可见性切换 / 校验)、`Search`(搜索框:值 / 搜索 / 清空三条回调)、`Select`(单选 / 多选 / 搜索 / 加载;面板用原生 popover)、`SelectTree`(树形态:仅叶子可选 + 本地过滤 + 命中高亮;与 `Select` 平级导出、共用触发器与面板)、`DatePicker`(+ `.Range`;值与比较都是 `YYYY-MM-DD` 字符串,**独立一族**、自带触发器 / 面板壳 / 面文件,面板是原生 popover 里的一段日历)、`DateTimePicker`(日期 + 时间:值 `YYYY-MM-DD HH:mm:ss`,面板底部一行「时 : 分 [: 秒] + 此刻」)、`Switch`(表格档 / 表单档) |
78
78
  | 表单与选择 | `Form`(+ `.Header` / `.Item`;标签体系、成员归位、`v-model` 值收集与命令式 `clear()`)、`Filter`(+ `.Item`;`Form` 的壳:条件字段写成子件、控件自放、查询/重置与快照归一)、`Checkbox`、`Radio`(+ `.Group`(唯一组壳,`layout="inline" | "card"` 两种形态)/ `.Card`(卡片选项叶))、`Capsule`(胶囊选择器;胶囊 / 方形两档外形,与 `Tabs` 组合即页签) |
79
79
  | 反馈与三态 | `Notice`(条状提示)、`Notification`(通知卡:标题 + 头像 / 标签 / 操作 / 关闭位)、`QueryState`(三态容器;内建空 / 错误插画取自设计交付的四张 SVG,内联在 `src/utils/state-illustration.ts`,四张合计约 26 KB)、`Loading`(转圈 + 遮罩:行内 / 区域 / 全屏三形态) |
80
80
  | 反馈与引导(**自绘**) | `Toast`(消息提示:语义四档 / loading + 可选动作 + 自动消失计时 + `.Stack` 堆叠)、`Steps`(步骤条:节点式 / 燕尾段式 / `.Progress` 进度条) |
@@ -19,16 +19,17 @@ import type { ControlSize } from '../control-size';
19
19
  export type ButtonVariant = 'primary' | 'secondary' | 'dashed' | 'danger' | 'text' | 'link' | 'icon' | 'off';
20
20
  /** 外形档:`round` = 胶囊;`circle` = 正圆(配 `variant="icon"` 用) */
21
21
  export type ButtonShape = 'default' | 'round' | 'circle';
22
- /** 按钮(**自绘**;按钮族:六型 × 三档尺寸 × 外形 × 危险色 + 加载 / 图标 / 菜单形态 + 组容器)。
22
+ /** 按钮(**自绘**;按钮族:六型 × 三档尺寸 × 外形 × 危险色 + 加载 / 图标 + 组容器)。
23
23
  *
24
24
  * 词表:`variant` = `primary` / `secondary` / `dashed` / `danger` / `text` / `link` / `icon` / `off`;`size`:`sm` 24 /
25
25
  * `md` 32(标准)/ `lg` 40 —— 三档**真实不同高**(与 `--ui-control-height-*` 同值);`shape` / `danger` /
26
- * `block` 是正交修饰(可叠加任意型);`loading` 会置 `disabled`(真正吞掉点击的是原生 `disabled`,不只是光标);
27
- * `menu` + `caret` 组合出菜单按钮(包一层文字区 + 右侧箭头区;**不画竖分割线** —— 分隔靠白空,
28
- * 面板交给操作层组合)。
26
+ * `block` 是正交修饰(可叠加任意型);`loading` 会置 `disabled`(真正吞掉点击的是原生 `disabled`,不只是光标)。
29
27
  *
30
- * 图标走 `@manohub/icon`(`icon` prop 传图标名,写错编译期即报错);菜单箭头由
31
- * `styles/operations/popup.css` 负责转向,故箭头图标的类名是 `mh-button__caret mh-popup-caret` 两个。
28
+ * 右侧箭头不在本件内建:需要「按钮 + 箭头」时,把
29
+ * `<Icon name="chevron-down" class="mh-button__caret mh-popup-caret" />` 当普通子节点传给按钮即可
30
+ * (`Dropdown` 的内建触发器就是这么组合的)。
31
+ *
32
+ * 图标走 `@manohub/icon`(`icon` prop 传图标名,写错编译期即报错)。
32
33
  * `href` 存在时渲染成 `<a>`(链接语义 + 原生右键菜单);此时 `disabled` 只能靠 `aria-disabled` 与拦截点击表达
33
34
  * (`<a>` 没有原生禁用),这是有意的取舍。
34
35
  */
@@ -72,21 +73,11 @@ export declare const Button: import("vue").DefineComponent<import("vue").Extract
72
73
  type: PropType<IconName>;
73
74
  default: undefined;
74
75
  };
75
- /** 尾部图标名(菜单按钮的箭头用 `caret`,这个是普通尾图标) */
76
+ /** 尾部图标名(普通尾图标;菜单箭头请用子节点自己组合) */
76
77
  trailingIcon: {
77
78
  type: PropType<IconName>;
78
79
  default: undefined;
79
80
  };
80
- /** 渲染下拉箭头(菜单按钮形态;转向由 popup.css 承担) */
81
- caret: {
82
- type: BooleanConstructor;
83
- default: boolean;
84
- };
85
- /** 菜单按钮结构(文字区包一层 + 右侧留出箭头区;分割线已撤,见 `button.css` 的「菜单按钮」节) */
86
- menu: {
87
- type: BooleanConstructor;
88
- default: boolean;
89
- };
90
81
  /** 原生按钮类型(缺省 `button`:不给默认值会让表单里的按钮意外提交) */
91
82
  type: {
92
83
  type: PropType<"button" | "submit" | "reset">;
@@ -107,11 +98,6 @@ export declare const Button: import("vue").DefineComponent<import("vue").Extract
107
98
  type: StringConstructor;
108
99
  default: undefined;
109
100
  };
110
- /** 原生 popover 目标 id(菜单按钮用;开合交给操作层) */
111
- popoverTarget: {
112
- type: StringConstructor;
113
- default: undefined;
114
- };
115
101
  onClick: {
116
102
  type: PropType<(e: MouseEvent) => void>;
117
103
  default: undefined;
@@ -156,21 +142,11 @@ export declare const Button: import("vue").DefineComponent<import("vue").Extract
156
142
  type: PropType<IconName>;
157
143
  default: undefined;
158
144
  };
159
- /** 尾部图标名(菜单按钮的箭头用 `caret`,这个是普通尾图标) */
145
+ /** 尾部图标名(普通尾图标;菜单箭头请用子节点自己组合) */
160
146
  trailingIcon: {
161
147
  type: PropType<IconName>;
162
148
  default: undefined;
163
149
  };
164
- /** 渲染下拉箭头(菜单按钮形态;转向由 popup.css 承担) */
165
- caret: {
166
- type: BooleanConstructor;
167
- default: boolean;
168
- };
169
- /** 菜单按钮结构(文字区包一层 + 右侧留出箭头区;分割线已撤,见 `button.css` 的「菜单按钮」节) */
170
- menu: {
171
- type: BooleanConstructor;
172
- default: boolean;
173
- };
174
150
  /** 原生按钮类型(缺省 `button`:不给默认值会让表单里的按钮意外提交) */
175
151
  type: {
176
152
  type: PropType<"button" | "submit" | "reset">;
@@ -191,11 +167,6 @@ export declare const Button: import("vue").DefineComponent<import("vue").Extract
191
167
  type: StringConstructor;
192
168
  default: undefined;
193
169
  };
194
- /** 原生 popover 目标 id(菜单按钮用;开合交给操作层) */
195
- popoverTarget: {
196
- type: StringConstructor;
197
- default: undefined;
198
- };
199
170
  onClick: {
200
171
  type: PropType<(e: MouseEvent) => void>;
201
172
  default: undefined;
@@ -204,8 +175,6 @@ export declare const Button: import("vue").DefineComponent<import("vue").Extract
204
175
  block: boolean;
205
176
  size: ControlSize;
206
177
  icon: "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "close" | "pause" | "play" | "image" | "delete" | "key" | "application" | "client" | "service" | "schema" | "compose" | "log" | "mcp" | "agent" | "server" | "exposure" | "openapi" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "chevrons-left" | "chevrons-right" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "page-title" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "info-circle" | "check-circle" | "alert-circle" | "play-filled" | "pause-filled" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history" | "maximize" | "minimize";
207
- menu: boolean;
208
- caret: boolean;
209
178
  disabled: boolean;
210
179
  title: string;
211
180
  onClick: (e: MouseEvent) => void;
@@ -217,7 +186,6 @@ export declare const Button: import("vue").DefineComponent<import("vue").Extract
217
186
  trailingIcon: "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "close" | "pause" | "play" | "image" | "delete" | "key" | "application" | "client" | "service" | "schema" | "compose" | "log" | "mcp" | "agent" | "server" | "exposure" | "openapi" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "chevrons-left" | "chevrons-right" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "page-title" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "info-circle" | "check-circle" | "alert-circle" | "play-filled" | "pause-filled" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history" | "maximize" | "minimize";
218
187
  href: string;
219
188
  target: string;
220
- popoverTarget: string;
221
189
  }, SlotsType<{
222
190
  default?: () => VNodeChild;
223
191
  icon?: () => VNodeChild;
@@ -311,21 +279,11 @@ export declare const ButtonCompound: {
311
279
  type: PropType<IconName>;
312
280
  default: undefined;
313
281
  };
314
- /** 尾部图标名(菜单按钮的箭头用 `caret`,这个是普通尾图标) */
282
+ /** 尾部图标名(普通尾图标;菜单箭头请用子节点自己组合) */
315
283
  trailingIcon: {
316
284
  type: PropType<IconName>;
317
285
  default: undefined;
318
286
  };
319
- /** 渲染下拉箭头(菜单按钮形态;转向由 popup.css 承担) */
320
- caret: {
321
- type: BooleanConstructor;
322
- default: boolean;
323
- };
324
- /** 菜单按钮结构(文字区包一层 + 右侧留出箭头区;分割线已撤,见 `button.css` 的「菜单按钮」节) */
325
- menu: {
326
- type: BooleanConstructor;
327
- default: boolean;
328
- };
329
287
  /** 原生按钮类型(缺省 `button`:不给默认值会让表单里的按钮意外提交) */
330
288
  type: {
331
289
  type: PropType<"button" | "submit" | "reset">;
@@ -346,11 +304,6 @@ export declare const ButtonCompound: {
346
304
  type: StringConstructor;
347
305
  default: undefined;
348
306
  };
349
- /** 原生 popover 目标 id(菜单按钮用;开合交给操作层) */
350
- popoverTarget: {
351
- type: StringConstructor;
352
- default: undefined;
353
- };
354
307
  onClick: {
355
308
  type: PropType<(e: MouseEvent) => void>;
356
309
  default: undefined;
@@ -359,8 +312,6 @@ export declare const ButtonCompound: {
359
312
  block: boolean;
360
313
  size: ControlSize;
361
314
  icon: "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "close" | "pause" | "play" | "image" | "delete" | "key" | "application" | "client" | "service" | "schema" | "compose" | "log" | "mcp" | "agent" | "server" | "exposure" | "openapi" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "chevrons-left" | "chevrons-right" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "page-title" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "info-circle" | "check-circle" | "alert-circle" | "play-filled" | "pause-filled" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history" | "maximize" | "minimize";
362
- menu: boolean;
363
- caret: boolean;
364
315
  disabled: boolean;
365
316
  title: string;
366
317
  onClick: (e: MouseEvent) => void;
@@ -372,7 +323,6 @@ export declare const ButtonCompound: {
372
323
  trailingIcon: "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "close" | "pause" | "play" | "image" | "delete" | "key" | "application" | "client" | "service" | "schema" | "compose" | "log" | "mcp" | "agent" | "server" | "exposure" | "openapi" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "chevrons-left" | "chevrons-right" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "page-title" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "info-circle" | "check-circle" | "alert-circle" | "play-filled" | "pause-filled" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history" | "maximize" | "minimize";
373
324
  href: string;
374
325
  target: string;
375
- popoverTarget: string;
376
326
  }, true, {}, SlotsType<{
377
327
  default?: () => VNodeChild;
378
328
  icon?: () => VNodeChild;
@@ -423,21 +373,11 @@ export declare const ButtonCompound: {
423
373
  type: PropType<IconName>;
424
374
  default: undefined;
425
375
  };
426
- /** 尾部图标名(菜单按钮的箭头用 `caret`,这个是普通尾图标) */
376
+ /** 尾部图标名(普通尾图标;菜单箭头请用子节点自己组合) */
427
377
  trailingIcon: {
428
378
  type: PropType<IconName>;
429
379
  default: undefined;
430
380
  };
431
- /** 渲染下拉箭头(菜单按钮形态;转向由 popup.css 承担) */
432
- caret: {
433
- type: BooleanConstructor;
434
- default: boolean;
435
- };
436
- /** 菜单按钮结构(文字区包一层 + 右侧留出箭头区;分割线已撤,见 `button.css` 的「菜单按钮」节) */
437
- menu: {
438
- type: BooleanConstructor;
439
- default: boolean;
440
- };
441
381
  /** 原生按钮类型(缺省 `button`:不给默认值会让表单里的按钮意外提交) */
442
382
  type: {
443
383
  type: PropType<"button" | "submit" | "reset">;
@@ -458,11 +398,6 @@ export declare const ButtonCompound: {
458
398
  type: StringConstructor;
459
399
  default: undefined;
460
400
  };
461
- /** 原生 popover 目标 id(菜单按钮用;开合交给操作层) */
462
- popoverTarget: {
463
- type: StringConstructor;
464
- default: undefined;
465
- };
466
401
  onClick: {
467
402
  type: PropType<(e: MouseEvent) => void>;
468
403
  default: undefined;
@@ -471,8 +406,6 @@ export declare const ButtonCompound: {
471
406
  block: boolean;
472
407
  size: ControlSize;
473
408
  icon: "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "close" | "pause" | "play" | "image" | "delete" | "key" | "application" | "client" | "service" | "schema" | "compose" | "log" | "mcp" | "agent" | "server" | "exposure" | "openapi" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "chevrons-left" | "chevrons-right" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "page-title" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "info-circle" | "check-circle" | "alert-circle" | "play-filled" | "pause-filled" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history" | "maximize" | "minimize";
474
- menu: boolean;
475
- caret: boolean;
476
409
  disabled: boolean;
477
410
  title: string;
478
411
  onClick: (e: MouseEvent) => void;
@@ -484,7 +417,6 @@ export declare const ButtonCompound: {
484
417
  trailingIcon: "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "close" | "pause" | "play" | "image" | "delete" | "key" | "application" | "client" | "service" | "schema" | "compose" | "log" | "mcp" | "agent" | "server" | "exposure" | "openapi" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "chevrons-left" | "chevrons-right" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "page-title" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "info-circle" | "check-circle" | "alert-circle" | "play-filled" | "pause-filled" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history" | "maximize" | "minimize";
485
418
  href: string;
486
419
  target: string;
487
- popoverTarget: string;
488
420
  }>;
489
421
  __isFragment?: never;
490
422
  __isTeleport?: never;
@@ -529,21 +461,11 @@ export declare const ButtonCompound: {
529
461
  type: PropType<IconName>;
530
462
  default: undefined;
531
463
  };
532
- /** 尾部图标名(菜单按钮的箭头用 `caret`,这个是普通尾图标) */
464
+ /** 尾部图标名(普通尾图标;菜单箭头请用子节点自己组合) */
533
465
  trailingIcon: {
534
466
  type: PropType<IconName>;
535
467
  default: undefined;
536
468
  };
537
- /** 渲染下拉箭头(菜单按钮形态;转向由 popup.css 承担) */
538
- caret: {
539
- type: BooleanConstructor;
540
- default: boolean;
541
- };
542
- /** 菜单按钮结构(文字区包一层 + 右侧留出箭头区;分割线已撤,见 `button.css` 的「菜单按钮」节) */
543
- menu: {
544
- type: BooleanConstructor;
545
- default: boolean;
546
- };
547
469
  /** 原生按钮类型(缺省 `button`:不给默认值会让表单里的按钮意外提交) */
548
470
  type: {
549
471
  type: PropType<"button" | "submit" | "reset">;
@@ -564,11 +486,6 @@ export declare const ButtonCompound: {
564
486
  type: StringConstructor;
565
487
  default: undefined;
566
488
  };
567
- /** 原生 popover 目标 id(菜单按钮用;开合交给操作层) */
568
- popoverTarget: {
569
- type: StringConstructor;
570
- default: undefined;
571
- };
572
489
  onClick: {
573
490
  type: PropType<(e: MouseEvent) => void>;
574
491
  default: undefined;
@@ -577,8 +494,6 @@ export declare const ButtonCompound: {
577
494
  block: boolean;
578
495
  size: ControlSize;
579
496
  icon: "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "close" | "pause" | "play" | "image" | "delete" | "key" | "application" | "client" | "service" | "schema" | "compose" | "log" | "mcp" | "agent" | "server" | "exposure" | "openapi" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "chevrons-left" | "chevrons-right" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "page-title" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "info-circle" | "check-circle" | "alert-circle" | "play-filled" | "pause-filled" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history" | "maximize" | "minimize";
580
- menu: boolean;
581
- caret: boolean;
582
497
  disabled: boolean;
583
498
  title: string;
584
499
  onClick: (e: MouseEvent) => void;
@@ -590,7 +505,6 @@ export declare const ButtonCompound: {
590
505
  trailingIcon: "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "close" | "pause" | "play" | "image" | "delete" | "key" | "application" | "client" | "service" | "schema" | "compose" | "log" | "mcp" | "agent" | "server" | "exposure" | "openapi" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "chevrons-left" | "chevrons-right" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "page-title" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "info-circle" | "check-circle" | "alert-circle" | "play-filled" | "pause-filled" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history" | "maximize" | "minimize";
591
506
  href: string;
592
507
  target: string;
593
- popoverTarget: string;
594
508
  }, {}, string, SlotsType<{
595
509
  default?: () => VNodeChild;
596
510
  icon?: () => VNodeChild;
@@ -44,21 +44,11 @@ const Button = /* @__PURE__ */ defineComponent({
44
44
  type: String,
45
45
  default: void 0
46
46
  },
47
- /** 尾部图标名(菜单按钮的箭头用 `caret`,这个是普通尾图标) */
47
+ /** 尾部图标名(普通尾图标;菜单箭头请用子节点自己组合) */
48
48
  trailingIcon: {
49
49
  type: String,
50
50
  default: void 0
51
51
  },
52
- /** 渲染下拉箭头(菜单按钮形态;转向由 popup.css 承担) */
53
- caret: {
54
- type: Boolean,
55
- default: false
56
- },
57
- /** 菜单按钮结构(文字区包一层 + 右侧留出箭头区;分割线已撤,见 `button.css` 的「菜单按钮」节) */
58
- menu: {
59
- type: Boolean,
60
- default: false
61
- },
62
52
  /** 原生按钮类型(缺省 `button`:不给默认值会让表单里的按钮意外提交) */
63
53
  type: {
64
54
  type: String,
@@ -79,11 +69,6 @@ const Button = /* @__PURE__ */ defineComponent({
79
69
  type: String,
80
70
  default: void 0
81
71
  },
82
- /** 原生 popover 目标 id(菜单按钮用;开合交给操作层) */
83
- popoverTarget: {
84
- type: String,
85
- default: void 0
86
- },
87
72
  onClick: {
88
73
  type: Function,
89
74
  default: void 0
@@ -96,25 +81,17 @@ const Button = /* @__PURE__ */ defineComponent({
96
81
  }) {
97
82
  const isDanger = computed(() => props.danger || props.variant === "danger");
98
83
  const baseVariant = computed(() => props.variant === "danger" ? "primary" : props.variant);
99
- const classes = computed(() => ["mh-button", `mh-button--${baseVariant.value}`, props.size === "md" ? "" : `mh-button--${props.size}`, props.shape === "default" ? "" : `mh-button--${props.shape}`, isDanger.value ? "mh-button--danger" : "", props.block ? "mh-button--block" : "", props.menu ? "mh-button--menu" : "", props.loading ? "mh-button--loading" : "", props.disabled ? "is-disabled" : "", attrs.class].filter(Boolean).join(" "));
84
+ const classes = computed(() => ["mh-button", `mh-button--${baseVariant.value}`, props.size === "md" ? "" : `mh-button--${props.size}`, props.shape === "default" ? "" : `mh-button--${props.shape}`, isDanger.value ? "mh-button--danger" : "", props.block ? "mh-button--block" : "", props.loading ? "mh-button--loading" : "", props.disabled ? "is-disabled" : "", attrs.class].filter(Boolean).join(" "));
100
85
  const renderIcon = (name, cls) => slots.icon && cls === "mh-button__icon" ? slots.icon() : name ? createVNode(Icon, {
101
86
  "name": name,
102
87
  "class": cls
103
88
  }, null) : null;
104
- const content = () => {
105
- const body = props.menu ? createVNode("span", {
106
- "class": "mh-button__label"
107
- }, [slots.default?.()]) : slots.default?.();
108
- return createVNode(Fragment, null, [props.loading ? createVNode("span", {
109
- "class": "mh-button__spinner"
110
- }, null) : renderIcon(props.icon, "mh-button__icon"), body, props.caret ? createVNode(Icon, {
111
- "name": "chevron-down",
112
- "class": "mh-button__caret mh-popup-caret"
113
- }, null) : null, props.trailingIcon ? createVNode(Icon, {
114
- "name": props.trailingIcon,
115
- "class": "mh-button__icon"
116
- }, null) : null]);
117
- };
89
+ const content = () => createVNode(Fragment, null, [props.loading ? createVNode("span", {
90
+ "class": "mh-button__spinner"
91
+ }, null) : renderIcon(props.icon, "mh-button__icon"), slots.default?.(), props.trailingIcon ? createVNode(Icon, {
92
+ "name": props.trailingIcon,
93
+ "class": "mh-button__icon"
94
+ }, null) : null]);
118
95
  return () => {
119
96
  const common = {
120
97
  ...attrs,
@@ -139,10 +116,7 @@ const Button = /* @__PURE__ */ defineComponent({
139
116
  }
140
117
  return createVNode("button", mergeProps(common, {
141
118
  "type": props.type,
142
- "disabled": props.disabled || props.loading
143
- }, {
144
- popovertarget: props.popoverTarget
145
- }, {
119
+ "disabled": props.disabled || props.loading,
146
120
  "onClick": props.onClick
147
121
  }), [content()]);
148
122
  };
@@ -191,14 +165,16 @@ const ButtonGroup = /* @__PURE__ */ defineComponent({
191
165
  return createVNode("span", mergeProps(attrs, {
192
166
  "class": `${classes} mh-popup-host`,
193
167
  "style": attrs.style
194
- }), [children.slice(0, limit), createVNode(Button, {
168
+ }), [children.slice(0, limit), createVNode(Button, mergeProps({
195
169
  "variant": "text",
196
- "size": triggerSize.value,
197
- "menu": true,
198
- "caret": true,
199
- "popoverTarget": panelId.value
170
+ "size": triggerSize.value
200
171
  }, {
201
- default: () => [createTextVNode("更多")]
172
+ popovertarget: panelId.value
173
+ }), {
174
+ default: () => [createTextVNode("更多"), createVNode(Icon, {
175
+ "name": "chevron-down",
176
+ "class": "mh-button__caret mh-popup-caret"
177
+ }, null)]
202
178
  }), createVNode("div", mergeProps({
203
179
  "id": panelId.value
204
180
  }, {
@@ -0,0 +1,88 @@
1
+ /**
2
+ * DropdownItem —— 动作菜单的一行(`<button type="button" role="menuitem" tabindex="-1">`)。
3
+ *
4
+ * 为什么是 `<button>` 而不是 `div[role=menuitem]`:
5
+ * 1. 原生回车 / 空格激活、原生可聚焦,键盘契约不用再自己造一遍(方向键 / Home / End 仍归面板壳);
6
+ * 2. 语义上它就是一个「按下去执行命令」的控件,`menuitem` 是它的角色,不是伪装;
7
+ * 3. 代价是必须自带 `border` / `background` / `padding` —— 本包的 reset 不替裸按钮归零
8
+ * (`contract-reset.spec.ts` 会按标签扫源码,漏了即红)。
9
+ *
10
+ * 焦点 / 高亮就是 `:focus`(不用 `data-active`):鼠标移入时本件主动 `focus()`,让「悬停项」与
11
+ * 「回车会触发的项」始终是同一行。禁用项不进入键盘序列(面板壳按 `[role="menuitem"]:not([aria-disabled])`
12
+ * 查询),也不发 `select`。
13
+ *
14
+ * 默认插槽是**展示内容**(图标 / 文本 / 标签片),不要放 `<input>` / `<button>` 一类的可交互子件 ——
15
+ * 菜单项是叶控件,嵌套交互会同时破坏焦点与读屏。
16
+ *
17
+ * 用法见 `docs/demos/dropdown/`(文档页 `docs/components/dropdown.md`)。
18
+ */
19
+ import { type IconName } from '@manohub/icon';
20
+ import { type PropType, type SlotsType, type VNodeChild } from 'vue';
21
+ export declare const DropdownItem: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
22
+ /** 文案;给了默认插槽时以插槽为准 */
23
+ label: {
24
+ type: StringConstructor;
25
+ default: undefined;
26
+ };
27
+ /** 前置图标(`@manohub/icon` 的闭合枚举) */
28
+ icon: {
29
+ type: PropType<IconName>;
30
+ default: undefined;
31
+ };
32
+ /** 不可点、键盘跳过、`aria-disabled="true"` */
33
+ disabled: {
34
+ type: BooleanConstructor;
35
+ default: boolean;
36
+ };
37
+ /** 危险色(删除 / 停用一类动作) */
38
+ danger: {
39
+ type: BooleanConstructor;
40
+ default: boolean;
41
+ };
42
+ /** 右侧快捷键提示(纯展示;`#trailing` 优先) */
43
+ shortcut: {
44
+ type: StringConstructor;
45
+ default: undefined;
46
+ };
47
+ }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
48
+ /** 项被激活(点击 / 回车 / 空格)——载荷是触发的原生事件 */
49
+ select: (_event: MouseEvent) => true;
50
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
51
+ /** 文案;给了默认插槽时以插槽为准 */
52
+ label: {
53
+ type: StringConstructor;
54
+ default: undefined;
55
+ };
56
+ /** 前置图标(`@manohub/icon` 的闭合枚举) */
57
+ icon: {
58
+ type: PropType<IconName>;
59
+ default: undefined;
60
+ };
61
+ /** 不可点、键盘跳过、`aria-disabled="true"` */
62
+ disabled: {
63
+ type: BooleanConstructor;
64
+ default: boolean;
65
+ };
66
+ /** 危险色(删除 / 停用一类动作) */
67
+ danger: {
68
+ type: BooleanConstructor;
69
+ default: boolean;
70
+ };
71
+ /** 右侧快捷键提示(纯展示;`#trailing` 优先) */
72
+ shortcut: {
73
+ type: StringConstructor;
74
+ default: undefined;
75
+ };
76
+ }>> & Readonly<{
77
+ onSelect?: ((_event: MouseEvent) => any) | undefined;
78
+ }>, {
79
+ icon: "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "close" | "pause" | "play" | "image" | "delete" | "key" | "application" | "client" | "service" | "schema" | "compose" | "log" | "mcp" | "agent" | "server" | "exposure" | "openapi" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "chevrons-left" | "chevrons-right" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "page-title" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "info-circle" | "check-circle" | "alert-circle" | "play-filled" | "pause-filled" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history" | "maximize" | "minimize";
80
+ disabled: boolean;
81
+ label: string;
82
+ danger: boolean;
83
+ shortcut: string;
84
+ }, SlotsType<{
85
+ default?: () => VNodeChild;
86
+ /** 右侧附加位(勾选图标 / 自定义尾注);优先于 `shortcut` */
87
+ trailing?: () => VNodeChild;
88
+ }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,84 @@
1
+ import { defineComponent, inject, computed, createVNode, mergeProps } from "vue";
2
+ import { Icon } from "@manohub/icon";
3
+ import { DROPDOWN_CONTEXT } from "./dropdown-shared.js";
4
+ const DropdownItem = /* @__PURE__ */ defineComponent({
5
+ name: "DropdownItem",
6
+ inheritAttrs: false,
7
+ props: {
8
+ /** 文案;给了默认插槽时以插槽为准 */
9
+ label: {
10
+ type: String,
11
+ default: void 0
12
+ },
13
+ /** 前置图标(`@manohub/icon` 的闭合枚举) */
14
+ icon: {
15
+ type: String,
16
+ default: void 0
17
+ },
18
+ /** 不可点、键盘跳过、`aria-disabled="true"` */
19
+ disabled: {
20
+ type: Boolean,
21
+ default: false
22
+ },
23
+ /** 危险色(删除 / 停用一类动作) */
24
+ danger: {
25
+ type: Boolean,
26
+ default: false
27
+ },
28
+ /** 右侧快捷键提示(纯展示;`#trailing` 优先) */
29
+ shortcut: {
30
+ type: String,
31
+ default: void 0
32
+ }
33
+ },
34
+ emits: {
35
+ /** 项被激活(点击 / 回车 / 空格)——载荷是触发的原生事件 */
36
+ select: (_event) => true
37
+ },
38
+ slots: Object,
39
+ setup(props, {
40
+ slots,
41
+ attrs,
42
+ emit
43
+ }) {
44
+ const context = inject(DROPDOWN_CONTEXT, null);
45
+ const isDisabled = computed(() => props.disabled || Boolean(context?.disabled.value));
46
+ const classes = computed(() => ["mh-dropdown__item", props.danger ? "mh-dropdown__item--danger" : "", attrs.class].filter(Boolean).join(" "));
47
+ const handleClick = (event) => {
48
+ event.stopPropagation();
49
+ if (isDisabled.value) {
50
+ event.preventDefault();
51
+ return;
52
+ }
53
+ emit("select", event);
54
+ if (context?.closeOnSelect.value) context.close("select");
55
+ };
56
+ const handleMouseEnter = (event) => {
57
+ if (isDisabled.value) return;
58
+ event.currentTarget.focus({
59
+ preventScroll: true
60
+ });
61
+ };
62
+ return () => createVNode("button", mergeProps(attrs, {
63
+ "type": "button",
64
+ "role": "menuitem",
65
+ "tabindex": -1,
66
+ "aria-disabled": isDisabled.value ? "true" : void 0,
67
+ "class": classes.value,
68
+ "style": attrs.style,
69
+ "title": attrs.title ?? props.label,
70
+ "onClick": handleClick,
71
+ "onMouseenter": handleMouseEnter
72
+ }), [props.icon ? createVNode(Icon, {
73
+ "name": props.icon,
74
+ "class": "mh-dropdown__icon"
75
+ }, null) : null, createVNode("span", {
76
+ "class": "mh-dropdown__label"
77
+ }, [slots.default ? slots.default() : props.label]), slots.trailing ? slots.trailing() : props.shortcut ? createVNode("span", {
78
+ "class": "mh-dropdown__shortcut"
79
+ }, [props.shortcut]) : null]);
80
+ }
81
+ });
82
+ export {
83
+ DropdownItem
84
+ };