@v-c/dropdown 1.0.1 → 1.0.2
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.
- package/dist/Dropdown.cjs +13 -10
- package/dist/Dropdown.js +1 -1
- package/dist/Overlay.cjs +4 -1
- package/dist/hooks/useAccessibility.cjs +10 -7
- package/dist/index.cjs +4 -1
- package/dist/placements.cjs +4 -1
- package/package.json +3 -3
package/dist/Dropdown.cjs
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
Object.
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
2
5
|
const require_rolldown_runtime = require("./_virtual/rolldown_runtime.cjs");
|
|
3
6
|
const require_useAccessibility = require("./hooks/useAccessibility.cjs");
|
|
4
7
|
const require_Overlay = require("./Overlay.cjs");
|
|
5
8
|
const require_placements = require("./placements.cjs");
|
|
6
9
|
let vue = require("vue");
|
|
7
|
-
let
|
|
8
|
-
let
|
|
9
|
-
let
|
|
10
|
+
let _v_c_trigger = require("@v-c/trigger");
|
|
11
|
+
let _v_c_util = require("@v-c/util");
|
|
12
|
+
let _v_c_util_dist_props_util = require("@v-c/util/dist/props-util");
|
|
10
13
|
function _isSlot(s) {
|
|
11
14
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
12
15
|
}
|
|
@@ -18,7 +21,7 @@ var defaults = {
|
|
|
18
21
|
trigger: ["hover"]
|
|
19
22
|
};
|
|
20
23
|
var Dropdown = /* @__PURE__ */ (0, vue.defineComponent)((props, { expose, slots }) => {
|
|
21
|
-
const { autoFocus } = (0,
|
|
24
|
+
const { autoFocus } = (0, _v_c_util_dist_props_util.toPropsRefs)(props, "autoFocus");
|
|
22
25
|
const triggerVisible = (0, vue.shallowRef)();
|
|
23
26
|
const mergedVisible = (0, vue.computed)(() => {
|
|
24
27
|
return props?.visible ?? triggerVisible.value;
|
|
@@ -48,7 +51,7 @@ var Dropdown = /* @__PURE__ */ (0, vue.defineComponent)((props, { expose, slots
|
|
|
48
51
|
if (onOverlayClick) onOverlayClick(e);
|
|
49
52
|
};
|
|
50
53
|
return () => {
|
|
51
|
-
const { overlay, prefixCls, arrow, hideAction, trigger, placement, placements, overlayClassName, getPopupContainer, showAction, overlayStyle, align
|
|
54
|
+
const { overlay, prefixCls, arrow, hideAction, trigger, placement, placements, overlayClassName, getPopupContainer, showAction, overlayStyle, align, ...otherProps } = props;
|
|
52
55
|
const getMenuElement = () => (0, vue.createVNode)(require_Overlay.default, {
|
|
53
56
|
"ref": overlayRef,
|
|
54
57
|
"overlay": overlay,
|
|
@@ -69,17 +72,17 @@ var Dropdown = /* @__PURE__ */ (0, vue.defineComponent)((props, { expose, slots
|
|
|
69
72
|
if (openClassName !== void 0) return openClassName;
|
|
70
73
|
return `${prefixCls}-open`;
|
|
71
74
|
};
|
|
72
|
-
const children = (0,
|
|
75
|
+
const children = (0, _v_c_util_dist_props_util.filterEmpty)(slots?.default?.() ?? [])?.[0];
|
|
73
76
|
const childrenNode = (0, vue.createVNode)(children, {
|
|
74
|
-
class: (0,
|
|
77
|
+
class: (0, _v_c_util.clsx)(mergedVisible.value && getOpenClassName()),
|
|
75
78
|
ref: childRef
|
|
76
79
|
});
|
|
77
80
|
let triggerHideAction = hideAction;
|
|
78
81
|
if (!triggerHideAction && trigger?.includes("contextMenu")) triggerHideAction = ["click"];
|
|
79
|
-
return (0, vue.createVNode)(
|
|
82
|
+
return (0, vue.createVNode)(_v_c_trigger.Trigger, (0, vue.mergeProps)({ "builtinPlacements": placements }, (0, _v_c_util_dist_props_util.removeUndefined)(otherProps), {
|
|
80
83
|
"prefixCls": prefixCls,
|
|
81
84
|
"ref": triggerRef,
|
|
82
|
-
"popupClassName": (0,
|
|
85
|
+
"popupClassName": (0, _v_c_util.clsx)(overlayClassName, { [`${prefixCls}-show-arrow`]: arrow }),
|
|
83
86
|
"popupStyle": overlayStyle,
|
|
84
87
|
"action": trigger,
|
|
85
88
|
"showAction": showAction,
|
package/dist/Dropdown.js
CHANGED
|
@@ -46,7 +46,7 @@ var Dropdown_default = /* @__PURE__ */ defineComponent((props, { expose, slots }
|
|
|
46
46
|
if (onOverlayClick) onOverlayClick(e);
|
|
47
47
|
};
|
|
48
48
|
return () => {
|
|
49
|
-
const { overlay, prefixCls, arrow, hideAction, trigger, placement, placements, overlayClassName, getPopupContainer, showAction, overlayStyle, align
|
|
49
|
+
const { overlay, prefixCls, arrow, hideAction, trigger, placement, placements, overlayClassName, getPopupContainer, showAction, overlayStyle, align, ...otherProps } = props;
|
|
50
50
|
const getMenuElement = () => createVNode(Overlay_default, {
|
|
51
51
|
"ref": overlayRef,
|
|
52
52
|
"overlay": overlay,
|
package/dist/Overlay.cjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
Object.
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
2
5
|
const require_rolldown_runtime = require("./_virtual/rolldown_runtime.cjs");
|
|
3
6
|
let vue = require("vue");
|
|
4
7
|
var Overlay = /* @__PURE__ */ (0, vue.defineComponent)((props) => {
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
Object.
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
2
5
|
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
3
6
|
let vue = require("vue");
|
|
4
|
-
let
|
|
5
|
-
|
|
6
|
-
let
|
|
7
|
-
|
|
8
|
-
var { ESC, TAB } =
|
|
7
|
+
let _v_c_util_dist_KeyCode = require("@v-c/util/dist/KeyCode");
|
|
8
|
+
_v_c_util_dist_KeyCode = require_rolldown_runtime.__toESM(_v_c_util_dist_KeyCode);
|
|
9
|
+
let _v_c_util_dist_raf = require("@v-c/util/dist/raf");
|
|
10
|
+
_v_c_util_dist_raf = require_rolldown_runtime.__toESM(_v_c_util_dist_raf);
|
|
11
|
+
var { ESC, TAB } = _v_c_util_dist_KeyCode.default;
|
|
9
12
|
function useAccessibility({ visible, triggerRef, onVisibleChange, autoFocus, overlayRef }) {
|
|
10
13
|
const focusMenuRef = (0, vue.shallowRef)(false);
|
|
11
14
|
const handleCloseMenuAndReturnFocus = () => {
|
|
@@ -39,7 +42,7 @@ function useAccessibility({ visible, triggerRef, onVisibleChange, autoFocus, ove
|
|
|
39
42
|
(0, vue.watch)(visible, (_n, _o, onCleanup) => {
|
|
40
43
|
if (visible.value) {
|
|
41
44
|
window.addEventListener("keydown", handleKeyDown);
|
|
42
|
-
if (autoFocus) (0,
|
|
45
|
+
if (autoFocus) (0, _v_c_util_dist_raf.default)(focusMenu, 3);
|
|
43
46
|
onCleanup(() => {
|
|
44
47
|
window.removeEventListener("keydown", handleKeyDown);
|
|
45
48
|
focusMenuRef.value = false;
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
Object.
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
2
5
|
const require_Dropdown = require("./Dropdown.cjs");
|
|
3
6
|
var src_default = require_Dropdown.default;
|
|
4
7
|
exports.default = src_default;
|
package/dist/placements.cjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/dropdown",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"description": "dropdown ui component for vue",
|
|
6
6
|
"author": "",
|
|
7
7
|
"license": "MIT",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"vue": "^3.0.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@v-c/
|
|
33
|
-
"@v-c/
|
|
32
|
+
"@v-c/trigger": "^1.0.6",
|
|
33
|
+
"@v-c/util": "^1.0.9"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "vite build",
|