@mekari/pixel3-popover 0.0.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.
- package/dist/chunk-2ZUCITXI.mjs +8 -0
- package/dist/chunk-3VISLXE6.mjs +94 -0
- package/dist/chunk-6AOSFLZR.mjs +55 -0
- package/dist/chunk-7E4KFP32.mjs +10045 -0
- package/dist/chunk-E2N74NQW.mjs +29 -0
- package/dist/chunk-EOUKE4WB.mjs +308 -0
- package/dist/chunk-KRK533DP.mjs +25 -0
- package/dist/chunk-OBEDLACV.mjs +44 -0
- package/dist/chunk-QZ7VFGWC.mjs +6 -0
- package/dist/chunk-SMKHJPNG.mjs +55 -0
- package/dist/content.d.mts +8 -0
- package/dist/content.d.ts +8 -0
- package/dist/content.js +233 -0
- package/dist/content.mjs +10 -0
- package/dist/index.d.mts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +10607 -0
- package/dist/index.mjs +30 -0
- package/dist/list-item.d.mts +8 -0
- package/dist/list-item.d.ts +8 -0
- package/dist/list-item.js +10593 -0
- package/dist/list-item.mjs +15 -0
- package/dist/list.d.mts +5 -0
- package/dist/list.d.ts +5 -0
- package/dist/list.js +71 -0
- package/dist/list.mjs +9 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -0
- package/dist/modules/popover.context.d.mts +13 -0
- package/dist/modules/popover.context.d.ts +13 -0
- package/dist/modules/popover.context.js +33 -0
- package/dist/modules/popover.context.mjs +9 -0
- package/dist/modules/popover.hooks.d.mts +111 -0
- package/dist/modules/popover.hooks.d.ts +111 -0
- package/dist/modules/popover.hooks.js +337 -0
- package/dist/modules/popover.hooks.mjs +18 -0
- package/dist/modules/popover.props.d.mts +153 -0
- package/dist/modules/popover.props.d.ts +153 -0
- package/dist/modules/popover.props.js +121 -0
- package/dist/modules/popover.props.mjs +13 -0
- package/dist/popover.d.mts +126 -0
- package/dist/popover.d.ts +126 -0
- package/dist/popover.js +213 -0
- package/dist/popover.mjs +10 -0
- package/dist/singleton-popover.d.mts +135 -0
- package/dist/singleton-popover.d.ts +135 -0
- package/dist/singleton-popover.js +197 -0
- package/dist/singleton-popover.mjs +10 -0
- package/dist/trigger.d.mts +5 -0
- package/dist/trigger.d.ts +5 -0
- package/dist/trigger.js +115 -0
- package/dist/trigger.mjs +9 -0
- package/package.json +42 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { PopoverProps, PopoverEmits, SingletonPopoverProps, MaybeElement, PopoverContentProps, PopoverContentEmits, PopoverListItemProps } from './popover.props.js';
|
|
2
|
+
import * as _floating_ui_vue from '@floating-ui/vue';
|
|
3
|
+
import * as vue from 'vue';
|
|
4
|
+
import '@mekari/pixel3-utils';
|
|
5
|
+
|
|
6
|
+
declare function usePopover(props: PopoverProps, emit: PopoverEmits): {
|
|
7
|
+
isOpen: vue.Ref<boolean | undefined>;
|
|
8
|
+
isHovering: vue.Ref<boolean>;
|
|
9
|
+
onOpenPopover: () => void;
|
|
10
|
+
onClosePopover: () => void;
|
|
11
|
+
setHovering: (value: boolean) => void;
|
|
12
|
+
triggerNode: vue.Ref<null>;
|
|
13
|
+
contentNode: vue.Ref<null>;
|
|
14
|
+
floatingStyles: Readonly<vue.Ref<{
|
|
15
|
+
position: _floating_ui_vue.Strategy;
|
|
16
|
+
top: string;
|
|
17
|
+
left: string;
|
|
18
|
+
transform?: string | undefined;
|
|
19
|
+
willChange?: string | undefined;
|
|
20
|
+
}>>;
|
|
21
|
+
};
|
|
22
|
+
declare function useSingletonPopover(props: SingletonPopoverProps, emit: PopoverEmits): {
|
|
23
|
+
triggerNode: Readonly<vue.Ref<MaybeElement>>;
|
|
24
|
+
contentNode: vue.Ref<null>;
|
|
25
|
+
floatingStyles: Readonly<vue.Ref<{
|
|
26
|
+
position: _floating_ui_vue.Strategy;
|
|
27
|
+
top: string;
|
|
28
|
+
left: string;
|
|
29
|
+
transform?: string | undefined;
|
|
30
|
+
willChange?: string | undefined;
|
|
31
|
+
}>>;
|
|
32
|
+
isOpen: vue.Ref<boolean | undefined>;
|
|
33
|
+
onOpenPopover: () => void;
|
|
34
|
+
onClosePopover: () => void;
|
|
35
|
+
isHovering: vue.Ref<boolean>;
|
|
36
|
+
setHovering: (value: boolean) => void;
|
|
37
|
+
};
|
|
38
|
+
declare function usePopoverTrigger(): {
|
|
39
|
+
rootAttrs: vue.ComputedRef<{
|
|
40
|
+
ref: vue.Ref<null>;
|
|
41
|
+
'data-pixel-component': string;
|
|
42
|
+
id: string;
|
|
43
|
+
onClick: () => void;
|
|
44
|
+
onMouseenter: () => void;
|
|
45
|
+
onMouseleave: () => void;
|
|
46
|
+
}>;
|
|
47
|
+
};
|
|
48
|
+
declare function usePopoverContent(props: PopoverContentProps, emit: PopoverContentEmits): {
|
|
49
|
+
rootAttrs: vue.ComputedRef<{
|
|
50
|
+
ref: vue.Ref<null>;
|
|
51
|
+
'data-pixel-component': string;
|
|
52
|
+
id: string;
|
|
53
|
+
class: string;
|
|
54
|
+
style: {
|
|
55
|
+
width: string;
|
|
56
|
+
minWidth: string;
|
|
57
|
+
maxWidth: string;
|
|
58
|
+
position: _floating_ui_vue.Strategy;
|
|
59
|
+
top: string;
|
|
60
|
+
left: string;
|
|
61
|
+
transform?: string | undefined;
|
|
62
|
+
willChange?: string | undefined;
|
|
63
|
+
display: string;
|
|
64
|
+
} | {
|
|
65
|
+
width?: undefined;
|
|
66
|
+
minWidth?: undefined;
|
|
67
|
+
maxWidth?: undefined;
|
|
68
|
+
position: _floating_ui_vue.Strategy;
|
|
69
|
+
top: string;
|
|
70
|
+
left: string;
|
|
71
|
+
transform?: string | undefined;
|
|
72
|
+
willChange?: string | undefined;
|
|
73
|
+
display: string;
|
|
74
|
+
};
|
|
75
|
+
onMouseenter: () => void;
|
|
76
|
+
onMouseleave: () => void;
|
|
77
|
+
}>;
|
|
78
|
+
popoverProps: vue.ToRefs<PopoverProps>;
|
|
79
|
+
isOpen: vue.Ref<boolean | undefined>;
|
|
80
|
+
floatingStyles: Readonly<vue.Ref<{
|
|
81
|
+
position: _floating_ui_vue.Strategy;
|
|
82
|
+
top: string;
|
|
83
|
+
left: string;
|
|
84
|
+
transform?: string | undefined;
|
|
85
|
+
willChange?: string | undefined;
|
|
86
|
+
}>>;
|
|
87
|
+
};
|
|
88
|
+
declare function usePopoverList(): {
|
|
89
|
+
rootAttrs: {
|
|
90
|
+
'data-pixel-component': string;
|
|
91
|
+
class: string;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
declare function usePopoverListItem(props: PopoverListItemProps): {
|
|
95
|
+
rootAttrs: vue.ComputedRef<{
|
|
96
|
+
'data-pixel-component': string;
|
|
97
|
+
role: string | undefined;
|
|
98
|
+
class: string;
|
|
99
|
+
disabled: boolean | undefined;
|
|
100
|
+
'data-highlight': true | undefined;
|
|
101
|
+
'data-active': true | undefined;
|
|
102
|
+
onmouseenter: () => true;
|
|
103
|
+
onmouseleave: () => false;
|
|
104
|
+
}>;
|
|
105
|
+
contentAttrs: {
|
|
106
|
+
class: string;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
type UsePopoverReturn = ReturnType<typeof usePopover>;
|
|
110
|
+
|
|
111
|
+
export { UsePopoverReturn, usePopover, usePopoverContent, usePopoverList, usePopoverListItem, usePopoverTrigger, useSingletonPopover };
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/modules/popover.hooks.ts
|
|
22
|
+
var popover_hooks_exports = {};
|
|
23
|
+
__export(popover_hooks_exports, {
|
|
24
|
+
usePopover: () => usePopover,
|
|
25
|
+
usePopoverContent: () => usePopoverContent,
|
|
26
|
+
usePopoverList: () => usePopoverList,
|
|
27
|
+
usePopoverListItem: () => usePopoverListItem,
|
|
28
|
+
usePopoverTrigger: () => usePopoverTrigger,
|
|
29
|
+
useSingletonPopover: () => useSingletonPopover
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(popover_hooks_exports);
|
|
32
|
+
var import_vue = require("vue");
|
|
33
|
+
var import_vue2 = require("@floating-ui/vue");
|
|
34
|
+
var import_pixel3_utils2 = require("@mekari/pixel3-utils");
|
|
35
|
+
var import_recipes = require("@mekari/pixel3-styled-system/recipes");
|
|
36
|
+
var import_patterns = require("@mekari/pixel3-styled-system/patterns");
|
|
37
|
+
|
|
38
|
+
// src/modules/popover.context.ts
|
|
39
|
+
var import_pixel3_utils = require("@mekari/pixel3-utils");
|
|
40
|
+
var [PopoverProvider, usePopoverContext] = (0, import_pixel3_utils.usePixelCreateContext)("PopoverContext");
|
|
41
|
+
|
|
42
|
+
// src/modules/popover.hooks.ts
|
|
43
|
+
function usePopover(props, emit) {
|
|
44
|
+
const isOpen = (0, import_vue.ref)(props.defaultIsOpen);
|
|
45
|
+
const triggerNode = (0, import_vue.ref)(null);
|
|
46
|
+
const contentNode = (0, import_vue.ref)(null);
|
|
47
|
+
const placement = (0, import_vue.ref)(props.placement);
|
|
48
|
+
const middleware = (0, import_vue.ref)([(0, import_vue2.offset)(4), (0, import_vue2.flip)(), (0, import_vue2.shift)()]);
|
|
49
|
+
const isHovering = (0, import_vue.ref)(false);
|
|
50
|
+
const {
|
|
51
|
+
floatingStyles
|
|
52
|
+
} = (0, import_vue2.useFloating)(triggerNode, contentNode, {
|
|
53
|
+
placement,
|
|
54
|
+
middleware,
|
|
55
|
+
whileElementsMounted: import_vue2.autoUpdate
|
|
56
|
+
});
|
|
57
|
+
function onOpenPopover() {
|
|
58
|
+
emit("open", {
|
|
59
|
+
isOpen,
|
|
60
|
+
triggerNode,
|
|
61
|
+
contentNode,
|
|
62
|
+
placement
|
|
63
|
+
});
|
|
64
|
+
if (props.isManual)
|
|
65
|
+
return;
|
|
66
|
+
isOpen.value = true;
|
|
67
|
+
}
|
|
68
|
+
__name(onOpenPopover, "onOpenPopover");
|
|
69
|
+
function onClosePopover() {
|
|
70
|
+
emit("close", {
|
|
71
|
+
isOpen,
|
|
72
|
+
triggerNode,
|
|
73
|
+
contentNode,
|
|
74
|
+
placement
|
|
75
|
+
});
|
|
76
|
+
if (props.isManual)
|
|
77
|
+
return;
|
|
78
|
+
isOpen.value = false;
|
|
79
|
+
}
|
|
80
|
+
__name(onClosePopover, "onClosePopover");
|
|
81
|
+
function setHovering(value) {
|
|
82
|
+
isHovering.value = value;
|
|
83
|
+
}
|
|
84
|
+
__name(setHovering, "setHovering");
|
|
85
|
+
(0, import_vue.watch)(() => props.isOpen, (newValue) => {
|
|
86
|
+
if (props.isManual) {
|
|
87
|
+
if (newValue) {
|
|
88
|
+
isOpen.value = newValue;
|
|
89
|
+
emit("open");
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
isOpen.value = newValue;
|
|
93
|
+
emit("close");
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
return {
|
|
97
|
+
isOpen,
|
|
98
|
+
isHovering,
|
|
99
|
+
onOpenPopover,
|
|
100
|
+
onClosePopover,
|
|
101
|
+
setHovering,
|
|
102
|
+
triggerNode,
|
|
103
|
+
contentNode,
|
|
104
|
+
floatingStyles
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
__name(usePopover, "usePopover");
|
|
108
|
+
function useSingletonPopover(props, emit) {
|
|
109
|
+
const {
|
|
110
|
+
triggerNode
|
|
111
|
+
} = (0, import_vue.toRefs)(props);
|
|
112
|
+
const isOpen = (0, import_vue.ref)(props.defaultIsOpen);
|
|
113
|
+
const contentNode = (0, import_vue.ref)(null);
|
|
114
|
+
const placement = (0, import_vue.ref)(props.placement);
|
|
115
|
+
const middleware = (0, import_vue.ref)([(0, import_vue2.offset)(4), (0, import_vue2.flip)(), (0, import_vue2.shift)()]);
|
|
116
|
+
const isHovering = (0, import_vue.ref)(false);
|
|
117
|
+
const {
|
|
118
|
+
floatingStyles
|
|
119
|
+
} = (0, import_vue2.useFloating)(triggerNode, contentNode, {
|
|
120
|
+
placement,
|
|
121
|
+
middleware,
|
|
122
|
+
whileElementsMounted: import_vue2.autoUpdate
|
|
123
|
+
});
|
|
124
|
+
function onOpenPopover() {
|
|
125
|
+
emit("open");
|
|
126
|
+
}
|
|
127
|
+
__name(onOpenPopover, "onOpenPopover");
|
|
128
|
+
function onClosePopover() {
|
|
129
|
+
emit("close");
|
|
130
|
+
}
|
|
131
|
+
__name(onClosePopover, "onClosePopover");
|
|
132
|
+
function setHovering(value) {
|
|
133
|
+
isHovering.value = value;
|
|
134
|
+
}
|
|
135
|
+
__name(setHovering, "setHovering");
|
|
136
|
+
(0, import_vue.watch)(() => props.isOpen, (newValue) => {
|
|
137
|
+
if (newValue) {
|
|
138
|
+
isOpen.value = newValue;
|
|
139
|
+
emit("open");
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
isOpen.value = newValue;
|
|
143
|
+
emit("close");
|
|
144
|
+
});
|
|
145
|
+
return {
|
|
146
|
+
triggerNode,
|
|
147
|
+
contentNode,
|
|
148
|
+
floatingStyles,
|
|
149
|
+
isOpen,
|
|
150
|
+
onOpenPopover,
|
|
151
|
+
onClosePopover,
|
|
152
|
+
isHovering,
|
|
153
|
+
setHovering
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
__name(useSingletonPopover, "useSingletonPopover");
|
|
157
|
+
function usePopoverTrigger() {
|
|
158
|
+
const {
|
|
159
|
+
isOpen,
|
|
160
|
+
isHovering,
|
|
161
|
+
setHovering,
|
|
162
|
+
onOpenPopover,
|
|
163
|
+
onClosePopover,
|
|
164
|
+
triggerNode,
|
|
165
|
+
rootProps: popoverProps
|
|
166
|
+
} = usePopoverContext();
|
|
167
|
+
const {
|
|
168
|
+
id,
|
|
169
|
+
trigger
|
|
170
|
+
} = popoverProps;
|
|
171
|
+
const getId = (0, import_vue.computed)(() => (id == null ? void 0 : id.value) ? `popover-trigger-${id.value}` : `popover-trigger-${(0, import_pixel3_utils2.useId)(4)}`);
|
|
172
|
+
const rootAttrs = (0, import_vue.computed)(() => {
|
|
173
|
+
return {
|
|
174
|
+
ref: triggerNode,
|
|
175
|
+
"data-pixel-component": "MpPopoverTrigger",
|
|
176
|
+
id: getId.value,
|
|
177
|
+
onClick: () => {
|
|
178
|
+
if (trigger.value === "click") {
|
|
179
|
+
isOpen.value ? onClosePopover() : onOpenPopover();
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
onMouseenter: () => {
|
|
183
|
+
if (trigger.value === "hover") {
|
|
184
|
+
setHovering(true);
|
|
185
|
+
setTimeout(() => {
|
|
186
|
+
onOpenPopover();
|
|
187
|
+
}, 300);
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
onMouseleave: () => {
|
|
191
|
+
if (trigger.value === "hover") {
|
|
192
|
+
setHovering(false);
|
|
193
|
+
setTimeout(() => {
|
|
194
|
+
if (isHovering.value === false) {
|
|
195
|
+
onClosePopover();
|
|
196
|
+
}
|
|
197
|
+
}, 300);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
});
|
|
202
|
+
return {
|
|
203
|
+
rootAttrs
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
__name(usePopoverTrigger, "usePopoverTrigger");
|
|
207
|
+
function usePopoverContent(props, emit) {
|
|
208
|
+
const {
|
|
209
|
+
isOpen,
|
|
210
|
+
isHovering,
|
|
211
|
+
setHovering,
|
|
212
|
+
triggerNode,
|
|
213
|
+
contentNode,
|
|
214
|
+
floatingStyles,
|
|
215
|
+
onOpenPopover,
|
|
216
|
+
onClosePopover,
|
|
217
|
+
rootProps: popoverProps
|
|
218
|
+
} = usePopoverContext();
|
|
219
|
+
const {
|
|
220
|
+
id,
|
|
221
|
+
closeOnBlur,
|
|
222
|
+
closeOnEscape,
|
|
223
|
+
trigger,
|
|
224
|
+
isAdaptiveWidth,
|
|
225
|
+
usePortal
|
|
226
|
+
} = popoverProps;
|
|
227
|
+
const restContentNode = (0, import_vue.computed)(() => isOpen.value ? contentNode.value : null);
|
|
228
|
+
const getId = (0, import_vue.computed)(() => (id == null ? void 0 : id.value) ? `popover-content-${id.value}` : `popover-content-${(0, import_pixel3_utils2.useId)(4)}`);
|
|
229
|
+
(0, import_pixel3_utils2.onClickOutside)(restContentNode, (e) => {
|
|
230
|
+
emit("blur", e);
|
|
231
|
+
if (closeOnBlur.value) {
|
|
232
|
+
onClosePopover();
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
(0, import_pixel3_utils2.onKeyStroke)("Escape", (e) => {
|
|
236
|
+
if (isOpen.value) {
|
|
237
|
+
emit("escape");
|
|
238
|
+
if (closeOnEscape.value) {
|
|
239
|
+
onClosePopover();
|
|
240
|
+
e.preventDefault();
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
const rootAttrs = (0, import_vue.computed)(() => {
|
|
245
|
+
const triggerEl = (0, import_pixel3_utils2.unrefElement)(triggerNode);
|
|
246
|
+
const adaptiveWidthStyle = isAdaptiveWidth.value ? {
|
|
247
|
+
width: "max-content",
|
|
248
|
+
minWidth: (usePortal == null ? void 0 : usePortal.value) ? `${triggerEl == null ? void 0 : triggerEl.clientWidth}px` : "100%",
|
|
249
|
+
maxWidth: "90vw"
|
|
250
|
+
} : {};
|
|
251
|
+
return {
|
|
252
|
+
ref: contentNode,
|
|
253
|
+
"data-pixel-component": "MpPopoverContent",
|
|
254
|
+
id: getId.value,
|
|
255
|
+
class: (0, import_recipes.popoverContentRecipe)({
|
|
256
|
+
isDark: props.isDark,
|
|
257
|
+
isUnstyled: props.isUnstyled
|
|
258
|
+
}),
|
|
259
|
+
style: {
|
|
260
|
+
display: isOpen.value ? "unset" : "none",
|
|
261
|
+
...floatingStyles.value,
|
|
262
|
+
...adaptiveWidthStyle
|
|
263
|
+
},
|
|
264
|
+
onMouseenter: () => {
|
|
265
|
+
if (trigger.value === "hover") {
|
|
266
|
+
setHovering(true);
|
|
267
|
+
setTimeout(() => {
|
|
268
|
+
onOpenPopover();
|
|
269
|
+
}, 300);
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
onMouseleave: () => {
|
|
273
|
+
if (trigger.value === "hover") {
|
|
274
|
+
setHovering(false);
|
|
275
|
+
setTimeout(() => {
|
|
276
|
+
if (isHovering.value === false) {
|
|
277
|
+
onClosePopover();
|
|
278
|
+
}
|
|
279
|
+
}, 300);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
});
|
|
284
|
+
return {
|
|
285
|
+
rootAttrs,
|
|
286
|
+
popoverProps,
|
|
287
|
+
isOpen,
|
|
288
|
+
floatingStyles
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
__name(usePopoverContent, "usePopoverContent");
|
|
292
|
+
function usePopoverList() {
|
|
293
|
+
const rootAttrs = {
|
|
294
|
+
"data-pixel-component": "MpPopoverList",
|
|
295
|
+
class: (0, import_recipes.popoverListRecipe)()
|
|
296
|
+
};
|
|
297
|
+
return {
|
|
298
|
+
rootAttrs
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
__name(usePopoverList, "usePopoverList");
|
|
302
|
+
function usePopoverListItem(props) {
|
|
303
|
+
const isHighligted = (0, import_vue.ref)(false);
|
|
304
|
+
const rootAttrs = (0, import_vue.computed)(() => {
|
|
305
|
+
return {
|
|
306
|
+
"data-pixel-component": "MpPopoverListItem",
|
|
307
|
+
role: props.role,
|
|
308
|
+
class: (0, import_recipes.popoverListItemRecipe)(),
|
|
309
|
+
disabled: props.isDisabled,
|
|
310
|
+
"data-highlight": isHighligted.value || void 0,
|
|
311
|
+
"data-active": props.isActive || void 0,
|
|
312
|
+
onmouseenter: () => isHighligted.value = true,
|
|
313
|
+
onmouseleave: () => isHighligted.value = false
|
|
314
|
+
};
|
|
315
|
+
});
|
|
316
|
+
const contentAttrs = {
|
|
317
|
+
class: (0, import_patterns.flex)({
|
|
318
|
+
justifyContent: "space-between",
|
|
319
|
+
alignItems: "center",
|
|
320
|
+
width: "full"
|
|
321
|
+
})
|
|
322
|
+
};
|
|
323
|
+
return {
|
|
324
|
+
rootAttrs,
|
|
325
|
+
contentAttrs
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
__name(usePopoverListItem, "usePopoverListItem");
|
|
329
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
330
|
+
0 && (module.exports = {
|
|
331
|
+
usePopover,
|
|
332
|
+
usePopoverContent,
|
|
333
|
+
usePopoverList,
|
|
334
|
+
usePopoverListItem,
|
|
335
|
+
usePopoverTrigger,
|
|
336
|
+
useSingletonPopover
|
|
337
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
usePopover,
|
|
3
|
+
usePopoverContent,
|
|
4
|
+
usePopoverList,
|
|
5
|
+
usePopoverListItem,
|
|
6
|
+
usePopoverTrigger,
|
|
7
|
+
useSingletonPopover
|
|
8
|
+
} from "../chunk-EOUKE4WB.mjs";
|
|
9
|
+
import "../chunk-2ZUCITXI.mjs";
|
|
10
|
+
import "../chunk-QZ7VFGWC.mjs";
|
|
11
|
+
export {
|
|
12
|
+
usePopover,
|
|
13
|
+
usePopoverContent,
|
|
14
|
+
usePopoverList,
|
|
15
|
+
usePopoverListItem,
|
|
16
|
+
usePopoverTrigger,
|
|
17
|
+
useSingletonPopover
|
|
18
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { ComponentPublicInstance, Ref, PropType, ExtractPropTypes } from 'vue';
|
|
2
|
+
import { Placement } from '@floating-ui/vue';
|
|
3
|
+
import { ComponentWithProps } from '@mekari/pixel3-utils';
|
|
4
|
+
|
|
5
|
+
type MaybeElement = ComponentPublicInstance | null | undefined;
|
|
6
|
+
type TriggerNode = Readonly<Ref<MaybeElement>>;
|
|
7
|
+
declare const popoverProps: {
|
|
8
|
+
placement: {
|
|
9
|
+
type: PropType<Placement>;
|
|
10
|
+
default: string;
|
|
11
|
+
};
|
|
12
|
+
id: {
|
|
13
|
+
type: PropType<string>;
|
|
14
|
+
};
|
|
15
|
+
trigger: {
|
|
16
|
+
type: PropType<"click" | "hover">;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
19
|
+
triggerId: {
|
|
20
|
+
type: PropType<string>;
|
|
21
|
+
};
|
|
22
|
+
defaultIsOpen: {
|
|
23
|
+
type: PropType<boolean>;
|
|
24
|
+
};
|
|
25
|
+
isManual: {
|
|
26
|
+
type: PropType<boolean>;
|
|
27
|
+
};
|
|
28
|
+
isOpen: {
|
|
29
|
+
type: PropType<boolean>;
|
|
30
|
+
};
|
|
31
|
+
returnFocusOnClose: {
|
|
32
|
+
type: PropType<boolean>;
|
|
33
|
+
};
|
|
34
|
+
initialFocusRef: {
|
|
35
|
+
type: PropType<boolean>;
|
|
36
|
+
};
|
|
37
|
+
closeOnBlur: {
|
|
38
|
+
type: PropType<boolean>;
|
|
39
|
+
default: boolean;
|
|
40
|
+
};
|
|
41
|
+
closeOnEscape: {
|
|
42
|
+
type: PropType<boolean>;
|
|
43
|
+
default: boolean;
|
|
44
|
+
};
|
|
45
|
+
closeOnSelect: {
|
|
46
|
+
type: PropType<boolean>;
|
|
47
|
+
default: boolean;
|
|
48
|
+
};
|
|
49
|
+
usePortal: {
|
|
50
|
+
type: PropType<boolean>;
|
|
51
|
+
default: boolean;
|
|
52
|
+
};
|
|
53
|
+
isKeepAlive: {
|
|
54
|
+
type: PropType<boolean>;
|
|
55
|
+
default: boolean;
|
|
56
|
+
};
|
|
57
|
+
isAdaptiveWidth: {
|
|
58
|
+
type: PropType<boolean>;
|
|
59
|
+
default: boolean;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
declare const singletonPopoverProps: {
|
|
63
|
+
placement: {
|
|
64
|
+
type: PropType<Placement>;
|
|
65
|
+
default: string;
|
|
66
|
+
};
|
|
67
|
+
id: {
|
|
68
|
+
type: PropType<string>;
|
|
69
|
+
};
|
|
70
|
+
trigger: {
|
|
71
|
+
type: PropType<"click" | "hover">;
|
|
72
|
+
default: string;
|
|
73
|
+
};
|
|
74
|
+
triggerId: {
|
|
75
|
+
type: PropType<string>;
|
|
76
|
+
};
|
|
77
|
+
defaultIsOpen: {
|
|
78
|
+
type: PropType<boolean>;
|
|
79
|
+
};
|
|
80
|
+
isManual: {
|
|
81
|
+
type: PropType<boolean>;
|
|
82
|
+
};
|
|
83
|
+
isOpen: {
|
|
84
|
+
type: PropType<boolean>;
|
|
85
|
+
};
|
|
86
|
+
returnFocusOnClose: {
|
|
87
|
+
type: PropType<boolean>;
|
|
88
|
+
};
|
|
89
|
+
initialFocusRef: {
|
|
90
|
+
type: PropType<boolean>;
|
|
91
|
+
};
|
|
92
|
+
closeOnBlur: {
|
|
93
|
+
type: PropType<boolean>;
|
|
94
|
+
default: boolean;
|
|
95
|
+
};
|
|
96
|
+
closeOnEscape: {
|
|
97
|
+
type: PropType<boolean>;
|
|
98
|
+
default: boolean;
|
|
99
|
+
};
|
|
100
|
+
closeOnSelect: {
|
|
101
|
+
type: PropType<boolean>;
|
|
102
|
+
default: boolean;
|
|
103
|
+
};
|
|
104
|
+
usePortal: {
|
|
105
|
+
type: PropType<boolean>;
|
|
106
|
+
default: boolean;
|
|
107
|
+
};
|
|
108
|
+
isKeepAlive: {
|
|
109
|
+
type: PropType<boolean>;
|
|
110
|
+
default: boolean;
|
|
111
|
+
};
|
|
112
|
+
isAdaptiveWidth: {
|
|
113
|
+
type: PropType<boolean>;
|
|
114
|
+
default: boolean;
|
|
115
|
+
};
|
|
116
|
+
triggerNode: {
|
|
117
|
+
type: PropType<Readonly<Ref<MaybeElement>>>;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
declare const popoverContentProps: {
|
|
121
|
+
isDark: {
|
|
122
|
+
type: PropType<boolean>;
|
|
123
|
+
};
|
|
124
|
+
isUnstyled: {
|
|
125
|
+
type: PropType<boolean>;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
declare const popoverListItemProps: {
|
|
129
|
+
as: {
|
|
130
|
+
type: PropType<string>;
|
|
131
|
+
};
|
|
132
|
+
role: {
|
|
133
|
+
type: PropType<string>;
|
|
134
|
+
};
|
|
135
|
+
isDisabled: {
|
|
136
|
+
type: PropType<boolean>;
|
|
137
|
+
};
|
|
138
|
+
isActive: {
|
|
139
|
+
type: PropType<boolean>;
|
|
140
|
+
};
|
|
141
|
+
isArrow: {
|
|
142
|
+
type: PropType<boolean>;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
type PopoverEmits = (e: 'open' | 'close', value?: unknown) => void;
|
|
146
|
+
type PopoverProps = ExtractPropTypes<typeof popoverProps>;
|
|
147
|
+
type SingletonPopoverProps = ExtractPropTypes<typeof singletonPopoverProps>;
|
|
148
|
+
type PopoverContentEmits = (e: 'blur' | 'escape', value?: unknown) => void;
|
|
149
|
+
type PopoverContentProps = ExtractPropTypes<typeof popoverContentProps>;
|
|
150
|
+
type PopoverListItemProps = ExtractPropTypes<typeof popoverListItemProps>;
|
|
151
|
+
type MpPopoverContentType = ComponentWithProps<PopoverContentProps>;
|
|
152
|
+
|
|
153
|
+
export { MaybeElement, MpPopoverContentType, PopoverContentEmits, PopoverContentProps, PopoverEmits, PopoverListItemProps, PopoverProps, SingletonPopoverProps, TriggerNode, popoverContentProps, popoverListItemProps, popoverProps, singletonPopoverProps };
|