@manohub/ui 1.2.13 → 1.3.1

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 (31) hide show
  1. package/README.md +1 -1
  2. package/dist/components/button/index.d.ts +20 -106
  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/notice/index.d.ts +1 -1
  15. package/dist/components/notification/index.d.ts +1 -1
  16. package/dist/components/select/index.js +2 -1
  17. package/dist/components/select/select-shared.d.ts +2 -7
  18. package/dist/components/select/select-shared.js +3 -3
  19. package/dist/components/select/select-tree.js +2 -1
  20. package/dist/components/toast/index.d.ts +4 -4
  21. package/dist/components/tooltip/index.d.ts +1 -1
  22. package/dist/index.d.ts +1 -0
  23. package/dist/index.js +2 -0
  24. package/dist/styles/components/button.css +6 -59
  25. package/dist/styles/components/button.tokens.css +4 -4
  26. package/dist/styles/components/dropdown.css +124 -0
  27. package/dist/styles/components/dropdown.tokens.css +16 -0
  28. package/dist/styles/index.css +2 -0
  29. package/dist/utils/popover.d.ts +14 -0
  30. package/dist/utils/popover.js +8 -0
  31. package/package.json +2 -2
@@ -0,0 +1,282 @@
1
+ import { defineComponent, ref, computed, watch, onMounted, provide, toRef, createVNode, mergeProps, nextTick } from "vue";
2
+ import { Icon } from "@manohub/icon";
3
+ import { showPanel, hidePanel } from "../../utils/popover.js";
4
+ import { Button } from "../button/index.js";
5
+ import { DropdownItem } from "./dropdown-item.js";
6
+ import { DropdownPanel } from "./dropdown-panel.js";
7
+ import { DropdownSeparator } from "./dropdown-separator.js";
8
+ import { createDropdownPanelId, DROPDOWN_CONTEXT } from "./dropdown-shared.js";
9
+ const dropdownProps = {
10
+ /** 受控开合;给了就是受控(必须接 `update:open` / `v-model:open`) */
11
+ open: {
12
+ type: Boolean,
13
+ default: void 0
14
+ },
15
+ /** 非受控初始开合 */
16
+ defaultOpen: {
17
+ type: Boolean,
18
+ default: false
19
+ },
20
+ /** 内建触发器文案(给 `#trigger` 时不生效) */
21
+ label: {
22
+ type: String,
23
+ default: "更多"
24
+ },
25
+ /** 内建触发器的按钮型 */
26
+ variant: {
27
+ type: String,
28
+ default: "secondary"
29
+ },
30
+ /** 内建触发器尺寸 + 菜单项密度(`sm` 24 / `md` 32 / `lg` 40) */
31
+ size: {
32
+ type: String,
33
+ default: "md"
34
+ },
35
+ /** 整个菜单禁用(触发器不可开、菜单项不响应) */
36
+ disabled: {
37
+ type: Boolean,
38
+ default: false
39
+ },
40
+ /** 面板落在锚点哪一侧 */
41
+ side: {
42
+ type: String,
43
+ default: "bottom"
44
+ },
45
+ /** 两侧对齐;`center` 不写 `data-align` */
46
+ align: {
47
+ type: String,
48
+ default: "start"
49
+ },
50
+ /** 面板最小宽度是否对齐触发器 */
51
+ matchWidth: {
52
+ type: Boolean,
53
+ default: false
54
+ },
55
+ /** 选中后是否收起 */
56
+ closeOnSelect: {
57
+ type: Boolean,
58
+ default: true
59
+ },
60
+ /** 菜单的可访问名;不给则由触发器的 id 反推 `aria-labelledby` */
61
+ ariaLabel: {
62
+ type: String,
63
+ default: void 0
64
+ }
65
+ };
66
+ const DropdownBase = /* @__PURE__ */ defineComponent({
67
+ name: "Dropdown",
68
+ inheritAttrs: false,
69
+ props: dropdownProps,
70
+ emits: {
71
+ "update:open": (_open) => true,
72
+ openChange: (_open) => true
73
+ },
74
+ slots: Object,
75
+ setup(props, {
76
+ slots,
77
+ attrs,
78
+ emit
79
+ }) {
80
+ const panelId = createDropdownPanelId();
81
+ const triggerId = `${panelId}-trigger`;
82
+ const rootRef = ref(null);
83
+ const panelRef = ref(null);
84
+ const innerOpen = ref(props.defaultOpen);
85
+ const nativeOpen = ref(false);
86
+ const restoreFocus = ref(false);
87
+ const pendingFocus = ref(null);
88
+ const isControlled = computed(() => props.open !== void 0);
89
+ const open = computed(() => props.open ?? innerOpen.value);
90
+ const syncPanel = (next) => {
91
+ if (next === nativeOpen.value) return;
92
+ nativeOpen.value = next;
93
+ try {
94
+ if (next) showPanel(panelRef.value);
95
+ else hidePanel(panelRef.value);
96
+ } catch {
97
+ }
98
+ };
99
+ const itemElements = () => [...panelRef.value?.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])') ?? []];
100
+ const focusInitial = () => {
101
+ if (!nativeOpen.value) return;
102
+ const target = pendingFocus.value;
103
+ pendingFocus.value = null;
104
+ const items = itemElements();
105
+ if (!items.length) {
106
+ panelRef.value?.focus({
107
+ preventScroll: true
108
+ });
109
+ return;
110
+ }
111
+ const el = target === "last" ? items[items.length - 1] : items[0];
112
+ el.focus({
113
+ preventScroll: true
114
+ });
115
+ };
116
+ const triggerEl = () => rootRef.value?.querySelector("[popovertarget]") ?? rootRef.value?.firstElementChild ?? null;
117
+ const shouldRestoreFocus = () => {
118
+ const active = document.activeElement;
119
+ if (!active || active === document.body) return true;
120
+ if (panelRef.value?.contains(active)) return true;
121
+ return active === triggerEl();
122
+ };
123
+ const close = (reason) => {
124
+ if (reason === "select" || reason === "escape") restoreFocus.value = true;
125
+ if (isControlled.value) {
126
+ emit("update:open", false);
127
+ return;
128
+ }
129
+ innerOpen.value = false;
130
+ syncPanel(false);
131
+ };
132
+ const openPanel = (position) => {
133
+ if (props.disabled) return;
134
+ pendingFocus.value = position;
135
+ if (open.value && nativeOpen.value) {
136
+ focusInitial();
137
+ return;
138
+ }
139
+ if (isControlled.value) {
140
+ emit("update:open", true);
141
+ if (open.value && !nativeOpen.value) syncPanel(true);
142
+ return;
143
+ }
144
+ innerOpen.value = true;
145
+ syncPanel(true);
146
+ };
147
+ const onTriggerKeydown = (event) => {
148
+ if (props.disabled) return;
149
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
150
+ event.preventDefault();
151
+ openPanel(event.key === "ArrowDown" ? "first" : "last");
152
+ }
153
+ };
154
+ const onPanelKeydown = (event) => {
155
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
156
+ event.preventDefault();
157
+ const items = itemElements();
158
+ if (!items.length) return;
159
+ const current = items.indexOf(document.activeElement);
160
+ const dir = event.key === "ArrowDown" ? 1 : -1;
161
+ const next = current < 0 ? dir > 0 ? 0 : items.length - 1 : (current + dir + items.length) % items.length;
162
+ items[next]?.focus();
163
+ return;
164
+ }
165
+ if (event.key === "Home" || event.key === "End") {
166
+ event.preventDefault();
167
+ const items = itemElements();
168
+ items[event.key === "Home" ? 0 : items.length - 1]?.focus();
169
+ return;
170
+ }
171
+ if (event.key === "Escape") {
172
+ restoreFocus.value = true;
173
+ return;
174
+ }
175
+ if (event.key === "Tab") {
176
+ requestAnimationFrame(() => {
177
+ if (panelRef.value) close("tab");
178
+ });
179
+ }
180
+ };
181
+ const onPanelFocusout = (event) => {
182
+ const next = event.relatedTarget;
183
+ if (!next) return;
184
+ if (rootRef.value?.contains(next)) return;
185
+ if (!nativeOpen.value) return;
186
+ close("outside");
187
+ };
188
+ const onToggle = (event) => {
189
+ const opening = event.newState === "open";
190
+ nativeOpen.value = opening;
191
+ if (!isControlled.value) innerOpen.value = opening;
192
+ emit("update:open", opening);
193
+ emit("openChange", opening);
194
+ if (opening) {
195
+ restoreFocus.value = false;
196
+ nextTick(focusInitial);
197
+ return;
198
+ }
199
+ if (restoreFocus.value) {
200
+ restoreFocus.value = false;
201
+ nextTick(() => {
202
+ if (shouldRestoreFocus()) triggerEl()?.focus();
203
+ });
204
+ }
205
+ pendingFocus.value = null;
206
+ };
207
+ const triggerProps = () => ({
208
+ id: triggerId,
209
+ popoverTarget: props.disabled ? void 0 : panelId,
210
+ "aria-haspopup": "menu",
211
+ "aria-expanded": open.value ? "true" : "false",
212
+ "aria-controls": panelId,
213
+ onKeydown: onTriggerKeydown,
214
+ disabled: props.disabled || void 0,
215
+ "aria-disabled": props.disabled ? "true" : void 0
216
+ });
217
+ watch(() => props.open, (value) => {
218
+ if (value !== void 0) syncPanel(value);
219
+ }, {
220
+ flush: "post"
221
+ });
222
+ onMounted(() => {
223
+ if (open.value) syncPanel(true);
224
+ });
225
+ provide(DROPDOWN_CONTEXT, {
226
+ close,
227
+ closeOnSelect: toRef(props, "closeOnSelect"),
228
+ disabled: toRef(props, "disabled")
229
+ });
230
+ return () => {
231
+ const trigger = slots.trigger ? slots.trigger({
232
+ triggerProps: triggerProps(),
233
+ open: open.value,
234
+ panelId
235
+ }) : createVNode(Button, mergeProps({
236
+ "variant": props.variant,
237
+ "size": props.size,
238
+ "disabled": props.disabled
239
+ }, {
240
+ id: triggerId,
241
+ popovertarget: props.disabled ? void 0 : panelId,
242
+ "aria-haspopup": "menu",
243
+ "aria-expanded": open.value ? "true" : "false",
244
+ "aria-controls": panelId,
245
+ onKeydown: onTriggerKeydown
246
+ }), {
247
+ default: () => [props.label, createVNode(Icon, {
248
+ "name": "chevron-down",
249
+ "class": "mh-button__caret mh-popup-caret"
250
+ }, null)]
251
+ });
252
+ return createVNode("span", mergeProps({
253
+ "ref": rootRef
254
+ }, attrs, {
255
+ "class": ["mh-dropdown", "mh-popup-host", props.size === "md" ? "" : `mh-dropdown--${props.size}`, attrs.class].filter(Boolean).join(" "),
256
+ "style": attrs.style
257
+ }), [createVNode("span", {
258
+ "class": "mh-popup-anchor"
259
+ }, [trigger]), createVNode(DropdownPanel, {
260
+ "id": panelId,
261
+ "panelRef": panelRef,
262
+ "side": props.side,
263
+ "align": props.align,
264
+ "matchWidth": props.matchWidth,
265
+ "ariaLabel": props.ariaLabel,
266
+ "labelledby": triggerId,
267
+ "onToggle": onToggle,
268
+ "onKeydown": onPanelKeydown,
269
+ "onFocusout": onPanelFocusout
270
+ }, {
271
+ default: () => slots.default?.()
272
+ })]);
273
+ };
274
+ }
275
+ });
276
+ const Dropdown = Object.assign(DropdownBase, {
277
+ Item: DropdownItem,
278
+ Separator: DropdownSeparator
279
+ });
280
+ export {
281
+ Dropdown
282
+ };
@@ -116,7 +116,7 @@ export declare const Notice: import("vue").DefineComponent<import("vue").Extract
116
116
  default: undefined;
117
117
  };
118
118
  }>> & Readonly<{}>, {
119
- icon: boolean | "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";
119
+ icon: boolean | "search" | "split" | "link" | "sub" | "join" | "filter" | "copy" | "help" | "table" | "menu" | "xor" | "close" | "input" | "pause" | "play" | "code" | "data" | "output" | "image" | "stop" | "call" | "delete" | "union" | "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" | "stop-filled" | "send" | "event" | "gear" | "hand" | "rule" | "receive" | "or" | "note" | "store" | "group" | "doc" | "globe" | "braces" | "transform" | "aggregate" | "and" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history" | "maximize" | "minimize";
120
120
  message: string;
121
121
  onClose: () => void;
122
122
  closable: boolean;
@@ -109,7 +109,7 @@ export declare const Notification: import("vue").DefineComponent<import("vue").E
109
109
  default: undefined;
110
110
  };
111
111
  }>> & Readonly<{}>, {
112
- icon: boolean | "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";
112
+ icon: boolean | "search" | "split" | "link" | "sub" | "join" | "filter" | "copy" | "help" | "table" | "menu" | "xor" | "close" | "input" | "pause" | "play" | "code" | "data" | "output" | "image" | "stop" | "call" | "delete" | "union" | "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" | "stop-filled" | "send" | "event" | "gear" | "hand" | "rule" | "receive" | "or" | "note" | "store" | "group" | "doc" | "globe" | "braces" | "transform" | "aggregate" | "and" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history" | "maximize" | "minimize";
113
113
  title: string;
114
114
  onClose: () => void;
115
115
  closable: boolean;
@@ -2,7 +2,8 @@ import { defineComponent, ref, computed, watch, createVNode, Fragment } from "vu
2
2
  import { SelectList } from "./select-list.js";
3
3
  import { SelectPanel } from "./select-panel.js";
4
4
  import { SelectTrigger } from "./select-trigger.js";
5
- import { createSelectPanelId, isGroup, activatableOptions, activatableCount, createTriggerKeydown, optionDomId, showPanel, hidePanel } from "./select-shared.js";
5
+ import { createSelectPanelId, isGroup, activatableOptions, activatableCount, createTriggerKeydown, optionDomId } from "./select-shared.js";
6
+ import { showPanel, hidePanel } from "../../utils/popover.js";
6
7
  const Select = /* @__PURE__ */ defineComponent({
7
8
  name: "Select",
8
9
  inheritAttrs: false,
@@ -7,6 +7,8 @@
7
7
  * 全页唯一)、popover 开合、触发器键盘契约、可激活项的摊平顺序(两件必须同一份)。
8
8
  */
9
9
  import type { Ref } from 'vue';
10
+ import { hidePanel, showPanel } from '../../utils/popover';
11
+ export { hidePanel, showPanel };
10
12
  /** 选项(平铺项与分组内选项同构) */
11
13
  export interface SelectOption {
12
14
  label: string;
@@ -38,13 +40,6 @@ export declare const activatableCount: (items: SelectItem[], creatable: boolean)
38
40
  export declare const optionDomId: (panelId: string, index: number) => string;
39
41
  /** 生成全页唯一的面板 id(随机段与全库其它随机 id 同法) */
40
42
  export declare const createSelectPanelId: () => string;
41
- /**
42
- * 开 / 收面板 —— 调**原生** `showPopover()` / `hidePopover()`,不是自建浮层逻辑(开合、Esc、点外部关闭、顶层渲染全归
43
- * 浏览器与 `styles/operations/popup.css`)。先探存在性再调用:jsdom 至今没实现这套 API,直接 `?.()` 会在测试里抛
44
- * 「不是函数」。
45
- */
46
- export declare const showPanel: (element: HTMLElement | null) => void;
47
- export declare const hidePanel: (element: HTMLElement | null) => void;
48
43
  /** 触发器键盘契约的输入 */
49
44
  export interface TriggerKeydownOptions {
50
45
  /** 有清除位时才接 `Delete` 清值(与输入框的键盘清除同款) */
@@ -1,11 +1,11 @@
1
+ import { createPanelId } from "../../utils/popover.js";
2
+ import { hidePanel, showPanel } from "../../utils/popover.js";
1
3
  const isGroup = (item) => Array.isArray(item.options);
2
4
  const activatableOptions = (items) => items.flatMap((item) => isGroup(item) ? item.options : [item]).filter((option) => !option.disabled);
3
5
  const activatableCount = (items, creatable) => activatableOptions(items).length + (creatable ? 1 : 0);
4
6
  const optionDomId = (panelId, index) => `${panelId}-opt-${index}`;
5
7
  const PANEL_ID_PREFIX = "mh-select-";
6
- const createSelectPanelId = () => `${PANEL_ID_PREFIX}${Math.random().toString(36).slice(2, 10)}`;
7
- const showPanel = (element) => element?.showPopover?.();
8
- const hidePanel = (element) => element?.hidePopover?.();
8
+ const createSelectPanelId = () => createPanelId(PANEL_ID_PREFIX);
9
9
  function createTriggerKeydown(options) {
10
10
  return (event) => {
11
11
  if (options.readonly) return;
@@ -1,9 +1,10 @@
1
1
  import { defineComponent, ref, computed, watch, createVNode, createTextVNode, Fragment } from "vue";
2
2
  import { SelectPanel } from "./select-panel.js";
3
3
  import { SelectTrigger } from "./select-trigger.js";
4
- import { createSelectPanelId, createTriggerKeydown, showPanel, hidePanel } from "./select-shared.js";
4
+ import { createSelectPanelId, createTriggerKeydown } from "./select-shared.js";
5
5
  import { filterTreeNodes, findTreeNode, treeLabel, splitHighlight, treeChildren, treeNodeKey } from "./select-tree-filter.js";
6
6
  import { Tree } from "../list/tree.js";
7
+ import { showPanel, hidePanel } from "../../utils/popover.js";
7
8
  const SelectTree = /* @__PURE__ */ defineComponent({
8
9
  name: "SelectTree",
9
10
  inheritAttrs: false,
@@ -108,7 +108,7 @@ export declare const Toast: import("vue").DefineComponent<import("vue").ExtractP
108
108
  onClose?: (() => any) | undefined;
109
109
  }>, {
110
110
  text: string;
111
- icon: boolean | "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";
111
+ icon: boolean | "search" | "split" | "link" | "sub" | "join" | "filter" | "copy" | "help" | "table" | "menu" | "xor" | "close" | "input" | "pause" | "play" | "code" | "data" | "output" | "image" | "stop" | "call" | "delete" | "union" | "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" | "stop-filled" | "send" | "event" | "gear" | "hand" | "rule" | "receive" | "or" | "note" | "store" | "group" | "doc" | "globe" | "braces" | "transform" | "aggregate" | "and" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history" | "maximize" | "minimize";
112
112
  closable: boolean;
113
113
  tone: ToastTone;
114
114
  action: string;
@@ -170,7 +170,7 @@ export declare const ToastCompound: {
170
170
  close: () => true;
171
171
  }, import("vue").PublicProps, {
172
172
  text: string;
173
- icon: boolean | "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";
173
+ icon: boolean | "search" | "split" | "link" | "sub" | "join" | "filter" | "copy" | "help" | "table" | "menu" | "xor" | "close" | "input" | "pause" | "play" | "code" | "data" | "output" | "image" | "stop" | "call" | "delete" | "union" | "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" | "stop-filled" | "send" | "event" | "gear" | "hand" | "rule" | "receive" | "or" | "note" | "store" | "group" | "doc" | "globe" | "braces" | "transform" | "aggregate" | "and" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history" | "maximize" | "minimize";
174
174
  closable: boolean;
175
175
  tone: ToastTone;
176
176
  action: string;
@@ -234,7 +234,7 @@ export declare const ToastCompound: {
234
234
  onClose?: (() => any) | undefined;
235
235
  }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, {
236
236
  text: string;
237
- icon: boolean | "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";
237
+ icon: boolean | "search" | "split" | "link" | "sub" | "join" | "filter" | "copy" | "help" | "table" | "menu" | "xor" | "close" | "input" | "pause" | "play" | "code" | "data" | "output" | "image" | "stop" | "call" | "delete" | "union" | "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" | "stop-filled" | "send" | "event" | "gear" | "hand" | "rule" | "receive" | "or" | "note" | "store" | "group" | "doc" | "globe" | "braces" | "transform" | "aggregate" | "and" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history" | "maximize" | "minimize";
238
238
  closable: boolean;
239
239
  tone: ToastTone;
240
240
  action: string;
@@ -295,7 +295,7 @@ export declare const ToastCompound: {
295
295
  close: () => true;
296
296
  }, string, {
297
297
  text: string;
298
- icon: boolean | "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";
298
+ icon: boolean | "search" | "split" | "link" | "sub" | "join" | "filter" | "copy" | "help" | "table" | "menu" | "xor" | "close" | "input" | "pause" | "play" | "code" | "data" | "output" | "image" | "stop" | "call" | "delete" | "union" | "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" | "stop-filled" | "send" | "event" | "gear" | "hand" | "rule" | "receive" | "or" | "note" | "store" | "group" | "doc" | "globe" | "braces" | "transform" | "aggregate" | "and" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history" | "maximize" | "minimize";
299
299
  closable: boolean;
300
300
  tone: ToastTone;
301
301
  action: string;
@@ -103,9 +103,9 @@ export declare const Tooltip: import("vue").DefineComponent<import("vue").Extrac
103
103
  content: string;
104
104
  title: string;
105
105
  align: TooltipAlign;
106
- action: string;
107
106
  side: TooltipSide;
108
107
  trigger: TooltipTrigger;
108
+ action: string;
109
109
  guide: boolean;
110
110
  onAction: () => void;
111
111
  }, SlotsType<{
package/dist/index.d.ts CHANGED
@@ -31,6 +31,7 @@ export { List, Tree, type ListNode } from './components/list';
31
31
  export { ListView, type ListViewProps, type ListViewStatus, type ListViewStatusTone, type ListViewCardItemProps, type ListViewCompound, } from './components/list-view';
32
32
  export { Badge, type BadgeTone, type BadgeShape, type BadgeSize, type BadgeDot, type BadgeStatus, } from './components/badge';
33
33
  export { Button, Segmented, type ButtonVariant, type ButtonCompound, type ButtonCompoundType, type SegmentedOption, type SegmentedValue, } from './components/button';
34
+ export { Dropdown, type DropdownProps, type DropdownItemProps, type DropdownSide, type DropdownAlign, type DropdownCompound, } from './components/dropdown';
34
35
  export { Input, Textarea, NumberInput, type TextareaProps, type NumberInputProps, type InputCompound, type InputCompoundType, } from './components/input';
35
36
  export { Search, type SearchProps } from './components/search';
36
37
  export { Select, SelectTree, type SelectOption, type SelectValue } from './components/select';
package/dist/index.js CHANGED
@@ -13,6 +13,7 @@ import { Text } from "./components/text/index.js";
13
13
  import { ListView } from "./components/list-view/index.js";
14
14
  import { Badge } from "./components/badge/index.js";
15
15
  import { Button } from "./components/button/index.js";
16
+ import { Dropdown } from "./components/dropdown/index.js";
16
17
  import { Input, Textarea } from "./components/input/index.js";
17
18
  import { Search } from "./components/search/index.js";
18
19
  import { Select } from "./components/select/index.js";
@@ -61,6 +62,7 @@ export {
61
62
  Dialog,
62
63
  Divider,
63
64
  Drawer,
65
+ Dropdown,
64
66
  FILTER_ALL,
65
67
  Filter,
66
68
  FilterItem,
@@ -93,15 +93,7 @@
93
93
  width: var(--ui-button-icon-size-lg);
94
94
  height: var(--ui-button-icon-size-lg);
95
95
  }
96
- /* 尺寸档的菜单结构:**内距归容器**,故按档位给 `.mh-button--menu` 自己(特异性 0-2-0 压过
97
- `.mh-button--menu` 的 md 缺省值)。
98
- (原先还有「分割线高度跟档位」两条 —— 菜单按钮自 2026-10-12 起不再渲染分割线,那两条随之撤掉) */
99
- .mh-button--sm.mh-button--menu {
100
- padding: 0 var(--ui-button-padding-x-sm);
101
- }
102
- .mh-button--lg.mh-button--menu {
103
- padding: 0 var(--ui-button-padding-x-lg);
104
- }
96
+ /* 尺寸档的图标槽在上面的 `.mh-button--sm/lg .mh-button__icon, .mh-button__caret` 已统一处理 */
105
97
 
106
98
  /* ===== 外形修饰(与型正交) ===== */
107
99
  .mh-button--round {
@@ -346,7 +338,7 @@
346
338
  }
347
339
  }
348
340
 
349
- /* ===== 下拉箭头槽 =====
341
+ /* ===== 尾部方向图标槽(Dropdown 的内建触发器 / Button.Group 的「更多」共用) =====
350
342
  * **只给槽位尺寸,不给字形**:字形由 `@manohub/icon` 的 `<Icon name="chevron-down">` 画,展开时的转向
351
343
  * 由操作层 `popup.css` 的 `.mh-popup-caret` 承担(本件不定义第二份 mask / 第二处转向)。 */
352
344
  .mh-button__caret {
@@ -355,25 +347,6 @@
355
347
  height: var(--ui-button-icon-size);
356
348
  }
357
349
 
358
- /* ===== 菜单按钮(文字区 + 箭头区;**不画竖分割线**,色调随修饰符) =====
359
- 分割线原属「文本区 ‖ 分割线 ‖ 箭头区」的三段结构,2026-10-12 按设计口径撤掉:
360
- 线压在实心主色底上太重,把一颗按钮切成两半。两区之间现在靠白空分开。
361
-
362
- **内距与两区间隔都归容器**(`.mh-button--menu` 自己吃左右内距、用 `gap` 给间隔),
363
- `label` 与 `caret` 都不再自带内距 / margin —— 间距只由一处拥有,否则「文字 → 箭头」会空出双份
364
- (与组容器那条 `.mh-button__group > .mh-button--text { padding-inline: 0 }` 同一口径)。 */
365
- .mh-button--menu {
366
- padding: 0 var(--ui-button-padding-x);
367
- gap: var(--ui-button-gap);
368
- }
369
- /* 文字区只是文字容器:内距全归 `.mh-button--menu`(这条留着是为了「不吃内距」有据可查) */
370
- .mh-button__label {
371
- padding: 0;
372
- }
373
- .mh-button--menu .mh-button__caret {
374
- margin: 0;
375
- }
376
-
377
350
  /* 竖分割线(1px,跟按钮同高)—— 现在只服务 `Button.Divider`(组内分割线),菜单按钮不再渲染它 */
378
351
  .mh-button__divider {
379
352
  flex: none;
@@ -494,42 +467,16 @@
494
467
  outline-offset: -2px;
495
468
  }
496
469
 
497
- /* ===== 子菜单浮层皮肤(与操作层并列组合:`class="mh-popup mh-button__menu"`) =====
498
- * 只给面(底 / 圆角 / 内距 / 阴影 / 选项行),开合、Esc、点外部关闭、顶层渲染、定位档全在 popup.css。 */
499
- .mh-button__menu {
500
- width: 130px;
501
- padding: var(--ui-space-1) 6px;
502
- /* 圆角取容器档(不写硬编码 px,改版时才会跟随);投影取锚定浮层档,不是居中浮层档 */
503
- border-radius: var(--ui-radius-md);
504
- background: var(--ui-base-100);
505
- box-shadow: var(--ui-shadow-popover);
506
- }
507
- .mh-button__menu-item {
508
- height: 30px;
509
- padding: 0 var(--ui-space-2);
510
- border-radius: var(--ui-button-radius);
511
- font-size: var(--ui-button-font-size);
512
- line-height: 30px;
513
- color: var(--ui-base-content);
514
- cursor: pointer;
515
- }
516
- .mh-button__menu-item:hover,
517
- .mh-button__menu-item.is-hover {
518
- background: var(--ui-base-200);
519
- }
520
-
521
470
  /* ===== 按钮组的收纳面板皮肤(`Button.Group maxVisible` 用)=====
522
- * 为什么不复用 `.mh-button__menu`:那套装的是**菜单项**(固定 130 宽 + `.mh-button__menu-item` 行),
523
- * 而收纳面板装的是**原样的 Button**(原 `variant` / `danger` 全保留 —— 「保存是主色、删除是危险色」
524
- * 这类语义不该因为被收进抽屉就丢掉),要的是**竖排一列按钮**。两者只有「面」同源(底 / 圆角 /
525
- * 内距 / 投影),版式不同:这里宽度随内容、每颗按钮独立成行。
526
- * 开合、Esc、点外部关闭、顶层渲染、定位档仍全在 `operations/popup.css`。 */
471
+ * 这里装的是**原样的 Button**(原 `variant` / `danger` 全保留 —— 「保存是主色、删除是危险色」
472
+ * 这类语义不该因为被收进抽屉就丢掉),要的是**竖排一列按钮**;与动作菜单的 `.mh-dropdown__panel`
473
+ * 是两种面(那边装菜单项)。开合、Esc、点外部关闭、顶层渲染、定位档仍全在 `operations/popup.css`。 */
527
474
  .mh-button__group-menu {
528
475
  display: flex;
529
476
  flex-direction: column;
530
477
  align-items: stretch;
531
478
  gap: var(--ui-space-1);
532
- /* 宽度随最宽那颗按钮(不取 `mh-button__menu` 的固定 130 —— 按钮文案可能更长) */
479
+ /* 宽度随最宽那颗按钮(按钮文案可能很长,不能像菜单那样定宽) */
533
480
  width: max-content;
534
481
  padding: var(--ui-space-1) 6px;
535
482
  border-radius: var(--ui-radius-md);
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * 单件令牌(只服务本件,故不进 `@manohub/theme`)。
3
3
  *
4
- * **本件有一批令牌是「跨分件消费」的**:`--ui-button-group-gap` 归组容器 `.mh-button__group`、组内分割线
5
- * 高度与菜单项圆角归 `.mh-button__menu`(popover 面板,与按钮**兄弟**、不在它的子树里)—— 自定义属性只
6
- * 向下继承,声明在 `.mh-button` 上这类分件取不到值(声明作废且不报错)。锚到容器后**容器是每个分件的
7
- * 祖先**,「把令牌同时声明在 4 个外层类上」那类 workaround 整块撤掉 —— 这正是本文件抽出来的原因。
4
+ * **本件有一批令牌是「跨分件消费」的**:`--ui-button-group-gap` 归组容器 `.mh-button__group`、
5
+ * `--ui-button-height` 归组内分割线 `.mh-button__divider` —— 自定义属性只向下继承,声明在 `.mh-button`
6
+ * 上这类分件取不到值(声明作废且不报错)。锚到容器后**容器是每个分件的祖先**,「把令牌同时声明在
7
+ * 4 个外层类上」那类 workaround 整块撤掉 —— 这正是本文件抽出来的原因。
8
8
  * ⚠️ `.mh-<件>--<档>` 这类**档位改写**留在面文件的修饰符块里(拆开会让档位失效)。
9
9
  */
10
10
  [data-manohub-ui] {