@v-c/dropdown 1.0.0 → 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 +15 -13
- package/dist/Dropdown.js +3 -4
- package/dist/Overlay.cjs +5 -2
- package/dist/Overlay.js +1 -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,
|
|
@@ -147,12 +150,11 @@ var Dropdown = /* @__PURE__ */ (0, vue.defineComponent)((props, { expose, slots
|
|
|
147
150
|
default: void 0
|
|
148
151
|
},
|
|
149
152
|
overlayStyle: {
|
|
150
|
-
type:
|
|
153
|
+
type: Object,
|
|
151
154
|
required: false,
|
|
152
155
|
default: void 0
|
|
153
156
|
},
|
|
154
157
|
placement: {
|
|
155
|
-
type: null,
|
|
156
158
|
required: false,
|
|
157
159
|
default: void 0
|
|
158
160
|
},
|
|
@@ -164,6 +166,7 @@ var Dropdown = /* @__PURE__ */ (0, vue.defineComponent)((props, { expose, slots
|
|
|
164
166
|
overlay: {
|
|
165
167
|
type: [
|
|
166
168
|
Function,
|
|
169
|
+
Object,
|
|
167
170
|
String,
|
|
168
171
|
Number,
|
|
169
172
|
null,
|
|
@@ -171,7 +174,6 @@ var Dropdown = /* @__PURE__ */ (0, vue.defineComponent)((props, { expose, slots
|
|
|
171
174
|
Array
|
|
172
175
|
],
|
|
173
176
|
required: false,
|
|
174
|
-
skipCheck: true,
|
|
175
177
|
default: void 0
|
|
176
178
|
},
|
|
177
179
|
trigger: {
|
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,
|
|
@@ -145,12 +145,11 @@ var Dropdown_default = /* @__PURE__ */ defineComponent((props, { expose, slots }
|
|
|
145
145
|
default: void 0
|
|
146
146
|
},
|
|
147
147
|
overlayStyle: {
|
|
148
|
-
type:
|
|
148
|
+
type: Object,
|
|
149
149
|
required: false,
|
|
150
150
|
default: void 0
|
|
151
151
|
},
|
|
152
152
|
placement: {
|
|
153
|
-
type: null,
|
|
154
153
|
required: false,
|
|
155
154
|
default: void 0
|
|
156
155
|
},
|
|
@@ -162,6 +161,7 @@ var Dropdown_default = /* @__PURE__ */ defineComponent((props, { expose, slots }
|
|
|
162
161
|
overlay: {
|
|
163
162
|
type: [
|
|
164
163
|
Function,
|
|
164
|
+
Object,
|
|
165
165
|
String,
|
|
166
166
|
Number,
|
|
167
167
|
null,
|
|
@@ -169,7 +169,6 @@ var Dropdown_default = /* @__PURE__ */ defineComponent((props, { expose, slots }
|
|
|
169
169
|
Array
|
|
170
170
|
],
|
|
171
171
|
required: false,
|
|
172
|
-
skipCheck: true,
|
|
173
172
|
default: void 0
|
|
174
173
|
},
|
|
175
174
|
trigger: {
|
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) => {
|
|
@@ -15,6 +18,7 @@ var Overlay = /* @__PURE__ */ (0, vue.defineComponent)((props) => {
|
|
|
15
18
|
overlay: {
|
|
16
19
|
type: [
|
|
17
20
|
Function,
|
|
21
|
+
Object,
|
|
18
22
|
String,
|
|
19
23
|
Number,
|
|
20
24
|
null,
|
|
@@ -22,7 +26,6 @@ var Overlay = /* @__PURE__ */ (0, vue.defineComponent)((props) => {
|
|
|
22
26
|
Array
|
|
23
27
|
],
|
|
24
28
|
required: false,
|
|
25
|
-
skipCheck: true,
|
|
26
29
|
default: void 0
|
|
27
30
|
},
|
|
28
31
|
arrow: {
|
package/dist/Overlay.js
CHANGED
|
@@ -13,6 +13,7 @@ var Overlay_default = /* @__PURE__ */ defineComponent((props) => {
|
|
|
13
13
|
overlay: {
|
|
14
14
|
type: [
|
|
15
15
|
Function,
|
|
16
|
+
Object,
|
|
16
17
|
String,
|
|
17
18
|
Number,
|
|
18
19
|
null,
|
|
@@ -20,7 +21,6 @@ var Overlay_default = /* @__PURE__ */ defineComponent((props) => {
|
|
|
20
21
|
Array
|
|
21
22
|
],
|
|
22
23
|
required: false,
|
|
23
|
-
skipCheck: true,
|
|
24
24
|
default: void 0
|
|
25
25
|
},
|
|
26
26
|
arrow: {
|
|
@@ -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/trigger": "^1.0.
|
|
33
|
-
"@v-c/util": "^1.0.
|
|
32
|
+
"@v-c/trigger": "^1.0.6",
|
|
33
|
+
"@v-c/util": "^1.0.9"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "vite build",
|