vue-composable-ui 0.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/LICENSE +1 -1
- package/README.md +5 -1
- package/dist/combobox.vue_vue_type_script_setup_true_lang-BhVMcx67.js +140 -0
- package/dist/comboboxHiddenInput.vue_vue_type_script_setup_true_lang-Ba-UPd-M.js +29 -0
- package/dist/comboboxInput.vue_vue_type_script_setup_true_lang-DzRfJ5ke.js +33 -0
- package/dist/comboboxOption.vue_vue_type_script_setup_true_lang-OyJxB4Jk.js +42 -0
- package/dist/comboboxOptions.vue_vue_type_script_setup_true_lang-Doy6MfEQ.js +20 -0
- package/dist/composable-ui.js +49 -0
- package/dist/composable-ui10.js +4 -0
- package/dist/composable-ui11.js +4 -0
- package/dist/composable-ui12.js +4 -0
- package/dist/composable-ui13.js +4 -0
- package/dist/composable-ui14.js +4 -0
- package/dist/composable-ui15.js +4 -0
- package/dist/composable-ui16.js +4 -0
- package/dist/composable-ui17.js +31 -0
- package/dist/composable-ui18.js +4 -0
- package/dist/composable-ui19.js +4 -0
- package/dist/composable-ui2.js +55 -0
- package/dist/composable-ui20.js +4 -0
- package/dist/composable-ui21.js +100 -0
- package/dist/composable-ui22.js +144 -0
- package/dist/composable-ui23.js +7 -0
- package/dist/composable-ui24.js +7 -0
- package/dist/composable-ui3.js +4 -0
- package/dist/composable-ui4.js +4 -0
- package/dist/composable-ui5.js +4 -0
- package/dist/composable-ui6.js +4 -0
- package/dist/composable-ui7.js +4 -0
- package/dist/composable-ui8.js +4 -0
- package/dist/composable-ui9.js +4 -0
- package/dist/listbox.vue_vue_type_script_setup_true_lang-Bj1ZXiBX.js +69 -0
- package/dist/listboxOption.vue_vue_type_script_setup_true_lang-B_yRptJm.js +37 -0
- package/dist/menu.vue_vue_type_script_setup_true_lang-Ci7q2rOg.js +82 -0
- package/dist/menuItem.vue_vue_type_script_setup_true_lang-mXtMa4gO.js +63 -0
- package/dist/menuItems.vue_vue_type_script_setup_true_lang-p9vftREy.js +49 -0
- package/dist/popover.vue_vue_type_script_setup_true_lang-DhKF7_nY.js +50 -0
- package/dist/popoverDialog.vue_vue_type_script_setup_true_lang-CDXUO7wZ.js +33 -0
- package/dist/tab.vue_vue_type_script_setup_true_lang-Y5OFGqMB.js +29 -0
- package/dist/tabContainer.vue_vue_type_script_setup_true_lang-fPpLno2Z.js +40 -0
- package/dist/tabList.vue_vue_type_script_setup_true_lang-CZyqGCuj.js +48 -0
- package/dist/tabPanel.vue_vue_type_script_setup_true_lang-CGhP6SHR.js +31 -0
- package/dist/tooltip.vue_vue_type_script_setup_true_lang-DVKYJyfL.js +85 -0
- package/dist/types/components/combobox/combobox.vue.d.ts +45 -0
- package/dist/types/components/combobox/comboboxHiddenInput.vue.d.ts +6 -0
- package/dist/types/components/combobox/comboboxInput.vue.d.ts +9 -0
- package/dist/types/components/combobox/comboboxOption.vue.d.ts +20 -0
- package/dist/types/components/combobox/comboboxOptions.vue.d.ts +12 -0
- package/dist/types/components/injectionKeys.d.ts +43 -0
- package/dist/types/components/listbox/listbox.vue.d.ts +26 -0
- package/dist/types/components/listbox/listboxOption.vue.d.ts +20 -0
- package/dist/types/components/menu/menu.vue.d.ts +42 -0
- package/dist/types/components/menu/menuItem.vue.d.ts +24 -0
- package/dist/types/components/menu/menuItems.vue.d.ts +12 -0
- package/dist/types/components/popover/popover.vue.d.ts +40 -0
- package/dist/types/components/popover/popoverDialog.vue.d.ts +12 -0
- package/dist/types/components/tabs/tab.vue.d.ts +17 -0
- package/dist/types/components/tabs/tabContainer.vue.d.ts +19 -0
- package/dist/types/components/tabs/tabList.vue.d.ts +17 -0
- package/dist/types/components/tabs/tabPanel.vue.d.ts +15 -0
- package/dist/types/components/tooltip.vue.d.ts +34 -0
- package/dist/types/composables/formControl.d.ts +48 -0
- package/dist/types/composables/list.d.ts +107 -0
- package/dist/types/composables/listOption.d.ts +34 -0
- package/dist/types/composables/popover.d.ts +68 -0
- package/dist/types/main.d.ts +22 -0
- package/dist/types/utils/element.d.ts +3 -0
- package/package.json +28 -12
- package/.github/workflows/deploy.yml +0 -21
- package/.github/workflows/docs.yml +0 -62
- package/.vscode/extensions.json +0 -7
- package/docs/.vitepress/config.mts +0 -40
- package/docs/.vitepress/theme/index.js +0 -4
- package/docs/.vitepress/theme/style.scss +0 -155
- package/docs/components/combobox.md +0 -174
- package/docs/components/demos/combobox.vue +0 -142
- package/docs/components/demos/combobox_autocomplete.vue +0 -75
- package/docs/components/demos/combobox_tags.vue +0 -127
- package/docs/components/demos/input.vue +0 -35
- package/docs/components/demos/listbox.vue +0 -64
- package/docs/components/demos/menu.vue +0 -93
- package/docs/components/demos/popover.vue +0 -16
- package/docs/components/demos/tabs.vue +0 -59
- package/docs/components/demos/tooltip.vue +0 -27
- package/docs/components/listbox.md +0 -9
- package/docs/components/menu.md +0 -121
- package/docs/components/popover.md +0 -82
- package/docs/components/tabs.md +0 -9
- package/docs/components/tooltip.md +0 -78
- package/docs/composables/form-control.md +0 -130
- package/docs/composables/list-option.md +0 -47
- package/docs/composables/list.md +0 -192
- package/docs/composables/popover.md +0 -90
- package/docs/index.md +0 -24
- package/docs/intro.md +0 -0
- package/src/components/combobox/combobox.vue +0 -229
- package/src/components/combobox/comboboxFormInput.vue +0 -33
- package/src/components/combobox/comboboxOption.vue +0 -52
- package/src/components/combobox/comboboxOptions.vue +0 -17
- package/src/components/injectionKeys.ts +0 -50
- package/src/components/listbox/listbox.vue +0 -91
- package/src/components/listbox/listboxOption.vue +0 -37
- package/src/components/menu/menu.vue +0 -100
- package/src/components/menu/menuItem.vue +0 -86
- package/src/components/menu/menuItems.vue +0 -51
- package/src/components/popover/popover.vue +0 -68
- package/src/components/popover/popoverDialog.vue +0 -35
- package/src/components/tabs/tab.vue +0 -35
- package/src/components/tabs/tabContainer.vue +0 -50
- package/src/components/tabs/tabList.vue +0 -52
- package/src/components/tabs/tabPanel.vue +0 -36
- package/src/components/tooltip.vue +0 -115
- package/src/composables/formControl.ts +0 -144
- package/src/composables/list.ts +0 -326
- package/src/composables/listOption.ts +0 -80
- package/src/composables/popover.ts +0 -306
- package/src/main.ts +0 -65
- package/src/utils/element.ts +0 -19
- package/src/utils/id.ts +0 -5
- package/src/vite-env.d.ts +0 -1
- package/tsconfig.json +0 -27
- package/tsconfig.node.json +0 -10
- package/vite.config.ts +0 -28
|
@@ -1,306 +0,0 @@
|
|
|
1
|
-
import type { Ref } from "vue";
|
|
2
|
-
import { ref, watch, onMounted, onBeforeUnmount, nextTick } from "vue";
|
|
3
|
-
import { useHTMLElement, TemplateRefOrSelector } from "../utils/element";
|
|
4
|
-
|
|
5
|
-
interface UsePopoverOptions {
|
|
6
|
-
/**
|
|
7
|
-
* The direction of the popover dialog
|
|
8
|
-
*
|
|
9
|
-
* @defaultValue `"down"`
|
|
10
|
-
*/
|
|
11
|
-
direction?: "up" | "down" | "left" | "right";
|
|
12
|
-
/**
|
|
13
|
-
* The alignment of the popover dialog
|
|
14
|
-
*
|
|
15
|
-
* @defaultValue `"left"`
|
|
16
|
-
*/
|
|
17
|
-
align?: "top" | "bottom" | "left" | "right" | "center" | "stretch";
|
|
18
|
-
/**
|
|
19
|
-
* The CSS position of the popover dialog
|
|
20
|
-
*
|
|
21
|
-
* @defaultValue `"fixed"`
|
|
22
|
-
*/
|
|
23
|
-
position?: "fixed" | "absolute";
|
|
24
|
-
/**
|
|
25
|
-
* Close the popover on a click outside of the dialog
|
|
26
|
-
*
|
|
27
|
-
* @defaultValue `true`
|
|
28
|
-
*/
|
|
29
|
-
closeOnOutsideClick?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Close the popover on a click inside of the dialog
|
|
32
|
-
*
|
|
33
|
-
* @defaultValue `false`
|
|
34
|
-
*/
|
|
35
|
-
closeOnInsideClick?: boolean;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
interface FocusOptions {
|
|
39
|
-
/**
|
|
40
|
-
* Focus the popover/activator
|
|
41
|
-
*
|
|
42
|
-
* @defaultValue `true`
|
|
43
|
-
*/
|
|
44
|
-
focus?: boolean;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface UsePopoverReturn {
|
|
48
|
-
/**
|
|
49
|
-
* The popover state
|
|
50
|
-
*/
|
|
51
|
-
isOpen: Ref<boolean>;
|
|
52
|
-
/**
|
|
53
|
-
* Open the popover
|
|
54
|
-
*/
|
|
55
|
-
open: (options?: FocusOptions) => void;
|
|
56
|
-
/**
|
|
57
|
-
* Close the popover
|
|
58
|
-
*/
|
|
59
|
-
close: (options?: FocusOptions) => void;
|
|
60
|
-
/**
|
|
61
|
-
* Toggle the popover
|
|
62
|
-
*/
|
|
63
|
-
toggle: (options?: FocusOptions) => void;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
*
|
|
68
|
-
* @param activatorEl A template ref or a CSS selector
|
|
69
|
-
* @param popupEl A template ref or a CSS selector
|
|
70
|
-
* @param options Popover options
|
|
71
|
-
*/
|
|
72
|
-
export function usePopover(
|
|
73
|
-
activatorEl: TemplateRefOrSelector,
|
|
74
|
-
popupEl: TemplateRefOrSelector,
|
|
75
|
-
{
|
|
76
|
-
direction = "down",
|
|
77
|
-
align = "left",
|
|
78
|
-
position = "fixed",
|
|
79
|
-
closeOnOutsideClick = true,
|
|
80
|
-
closeOnInsideClick = false,
|
|
81
|
-
}: UsePopoverOptions = {}
|
|
82
|
-
): UsePopoverReturn {
|
|
83
|
-
const isOpen = ref(false);
|
|
84
|
-
|
|
85
|
-
function getActivator() {
|
|
86
|
-
const el = useHTMLElement(activatorEl);
|
|
87
|
-
if (!el.value) throw new Error("Activator element is undefined");
|
|
88
|
-
return el.value;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function getPopup() {
|
|
92
|
-
const el = useHTMLElement(popupEl);
|
|
93
|
-
if (!el.value) throw new Error("Popover element is undefined");
|
|
94
|
-
return el.value;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function open({ focus = true }: FocusOptions = {}) {
|
|
98
|
-
isOpen.value = true;
|
|
99
|
-
if (focus)
|
|
100
|
-
nextTick(() => {
|
|
101
|
-
const popover = getPopup();
|
|
102
|
-
popover.focus();
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function close({ focus = true }: FocusOptions = {}) {
|
|
107
|
-
isOpen.value = false;
|
|
108
|
-
if (focus) {
|
|
109
|
-
const activator = getActivator();
|
|
110
|
-
activator.focus();
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function toggle(options?: FocusOptions) {
|
|
115
|
-
if (isOpen.value) {
|
|
116
|
-
close(options);
|
|
117
|
-
} else {
|
|
118
|
-
open(options);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function calcPosition() {
|
|
123
|
-
if (!isOpen.value) return;
|
|
124
|
-
|
|
125
|
-
const activator = getActivator();
|
|
126
|
-
const popover = getPopup();
|
|
127
|
-
|
|
128
|
-
popover.style.position = position;
|
|
129
|
-
const {
|
|
130
|
-
top: aTop,
|
|
131
|
-
right: aRight,
|
|
132
|
-
bottom: aBottom,
|
|
133
|
-
left: aLeft,
|
|
134
|
-
width: aWidth,
|
|
135
|
-
height: aHeight,
|
|
136
|
-
} = activator.getBoundingClientRect();
|
|
137
|
-
|
|
138
|
-
const popoverHeight = popover.offsetHeight;
|
|
139
|
-
const popoverWidth = popover.offsetWidth; //> aWidth ? popover.offsetWidth : aWidth;
|
|
140
|
-
|
|
141
|
-
const viewportHeight = document.documentElement.clientHeight;
|
|
142
|
-
const viewportWidth = document.documentElement.clientWidth;
|
|
143
|
-
|
|
144
|
-
// reverse menu direction if it doesnt fit in the viewport
|
|
145
|
-
let _direction = direction;
|
|
146
|
-
|
|
147
|
-
if (direction == "up") {
|
|
148
|
-
if (aTop - popoverHeight < 0) {
|
|
149
|
-
_direction = "down";
|
|
150
|
-
}
|
|
151
|
-
} else if (direction == "down") {
|
|
152
|
-
if (aBottom + popoverHeight > viewportHeight) {
|
|
153
|
-
_direction = "up";
|
|
154
|
-
}
|
|
155
|
-
} else if (direction == "right") {
|
|
156
|
-
if (aRight + popoverWidth > viewportWidth) {
|
|
157
|
-
_direction = "left";
|
|
158
|
-
}
|
|
159
|
-
} else if (direction == "left") {
|
|
160
|
-
if (aLeft - popoverWidth < 0) {
|
|
161
|
-
_direction = "right";
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
let _align = align;
|
|
166
|
-
|
|
167
|
-
if (align == "left") {
|
|
168
|
-
if (aLeft + popoverWidth > viewportWidth) {
|
|
169
|
-
_align = "right";
|
|
170
|
-
}
|
|
171
|
-
} else if (align == "right") {
|
|
172
|
-
if (aRight - popoverWidth < 0) {
|
|
173
|
-
_align = "left";
|
|
174
|
-
}
|
|
175
|
-
} else if (align == "top") {
|
|
176
|
-
if (aTop + popoverHeight > viewportHeight) {
|
|
177
|
-
_align = "bottom";
|
|
178
|
-
}
|
|
179
|
-
} else if (align == "bottom") {
|
|
180
|
-
if (aBottom - popoverHeight < 0) {
|
|
181
|
-
_align = "top";
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
const _position = {
|
|
186
|
-
top: "auto",
|
|
187
|
-
bottom: "auto",
|
|
188
|
-
left: "auto",
|
|
189
|
-
right: "auto",
|
|
190
|
-
width: "auto",
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
const isFixed = position === "fixed";
|
|
194
|
-
|
|
195
|
-
if (_direction == "up") {
|
|
196
|
-
_position.bottom = `${
|
|
197
|
-
aHeight + (isFixed ? viewportHeight - aBottom : 0)
|
|
198
|
-
}px`;
|
|
199
|
-
} else if (_direction == "down") {
|
|
200
|
-
_position.top = `${aHeight + (isFixed ? aTop : 0)}px`;
|
|
201
|
-
} else if (_direction == "right") {
|
|
202
|
-
_position.left = `${aWidth + (isFixed ? aLeft : 0)}px`;
|
|
203
|
-
} else if (_direction == "left") {
|
|
204
|
-
_position.right = `${aWidth + (isFixed ? viewportWidth - aRight : 0)}px`;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
if (["up", "down"].includes(_direction)) {
|
|
208
|
-
if (_align == "right") {
|
|
209
|
-
_position.right = `${isFixed ? viewportWidth - aRight : 0}px`;
|
|
210
|
-
} else if (_align == "left" || _align == "stretch") {
|
|
211
|
-
_position.left = `${isFixed ? aLeft : 0}px`;
|
|
212
|
-
} else if (_align == "center") {
|
|
213
|
-
_position.left = `${
|
|
214
|
-
(isFixed ? aLeft : 0) - (popoverWidth - aWidth) / 2
|
|
215
|
-
}px`;
|
|
216
|
-
}
|
|
217
|
-
} else {
|
|
218
|
-
if (_align == "bottom") {
|
|
219
|
-
_position.bottom = `${isFixed ? viewportHeight - aBottom : 0}px`;
|
|
220
|
-
} else if (_align == "top") {
|
|
221
|
-
_position.top = `${isFixed ? aTop : 0}px`;
|
|
222
|
-
} else if (_align == "center") {
|
|
223
|
-
_position.top = `${
|
|
224
|
-
(isFixed ? aTop : 0) - (popoverHeight - aHeight) / 2
|
|
225
|
-
}px`;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
if (["up", "down"].includes(_direction) && _align === "stretch") {
|
|
230
|
-
_position["width"] = aWidth + "px";
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
for (const prop in _position) {
|
|
234
|
-
popover.style[prop as keyof typeof _position] =
|
|
235
|
-
_position[prop as keyof typeof _position];
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
watch(
|
|
240
|
-
isOpen,
|
|
241
|
-
(val) => {
|
|
242
|
-
if (val) {
|
|
243
|
-
nextTick(() => {
|
|
244
|
-
calcPosition();
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
},
|
|
248
|
-
{ flush: "pre" }
|
|
249
|
-
);
|
|
250
|
-
|
|
251
|
-
function onWindowClick(evt: MouseEvent) {
|
|
252
|
-
const target = evt.target as HTMLElement;
|
|
253
|
-
|
|
254
|
-
// ignore activator clicks
|
|
255
|
-
const activator = getActivator();
|
|
256
|
-
if (activator.contains(target)) return;
|
|
257
|
-
|
|
258
|
-
try {
|
|
259
|
-
const popover = getPopup();
|
|
260
|
-
// inside
|
|
261
|
-
if (popover.contains(target)) {
|
|
262
|
-
if (closeOnInsideClick) {
|
|
263
|
-
close();
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
// outside
|
|
267
|
-
else {
|
|
268
|
-
if (closeOnOutsideClick) {
|
|
269
|
-
isOpen.value = false;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
} catch (e) {}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
const resizeObserver = new ResizeObserver(calcPosition);
|
|
276
|
-
const abortController = new AbortController();
|
|
277
|
-
|
|
278
|
-
onMounted(() => {
|
|
279
|
-
window.addEventListener("resize", calcPosition, {
|
|
280
|
-
passive: true,
|
|
281
|
-
signal: abortController.signal,
|
|
282
|
-
});
|
|
283
|
-
window.addEventListener("scroll", calcPosition, {
|
|
284
|
-
passive: true,
|
|
285
|
-
//capture: true,
|
|
286
|
-
signal: abortController.signal,
|
|
287
|
-
});
|
|
288
|
-
window.addEventListener("click", onWindowClick, {
|
|
289
|
-
passive: true,
|
|
290
|
-
signal: abortController.signal,
|
|
291
|
-
});
|
|
292
|
-
resizeObserver.observe(getActivator());
|
|
293
|
-
});
|
|
294
|
-
|
|
295
|
-
onBeforeUnmount(() => {
|
|
296
|
-
abortController.abort();
|
|
297
|
-
resizeObserver.disconnect();
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
return {
|
|
301
|
-
isOpen,
|
|
302
|
-
open,
|
|
303
|
-
close,
|
|
304
|
-
toggle,
|
|
305
|
-
};
|
|
306
|
-
}
|
package/src/main.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// Composables
|
|
2
|
-
|
|
3
|
-
import { usePopover } from "./composables/popover";
|
|
4
|
-
import { useList } from "./composables/list";
|
|
5
|
-
import { useListOption } from "./composables/listOption";
|
|
6
|
-
import { useFormControl } from "./composables/formControl";
|
|
7
|
-
|
|
8
|
-
// Utils
|
|
9
|
-
|
|
10
|
-
import { useHTMLElement } from "./utils/element";
|
|
11
|
-
import { useSequentialId } from "./utils/id";
|
|
12
|
-
|
|
13
|
-
// Components
|
|
14
|
-
|
|
15
|
-
import Listbox from "./components/listbox/listbox.vue";
|
|
16
|
-
import ListboxOption from "./components/listbox/listboxOption.vue";
|
|
17
|
-
|
|
18
|
-
import TabContainer from "./components/tabs/tabContainer.vue";
|
|
19
|
-
import TabList from "./components/tabs/tabList.vue";
|
|
20
|
-
import Tab from "./components/tabs/tab.vue";
|
|
21
|
-
import TabPanel from "./components/tabs/tabPanel.vue";
|
|
22
|
-
|
|
23
|
-
import Popover from "./components/popover/popover.vue";
|
|
24
|
-
import PopoverDialog from "./components/popover/popoverDialog.vue";
|
|
25
|
-
|
|
26
|
-
import Tooltip from "./components/tooltip.vue";
|
|
27
|
-
|
|
28
|
-
import Menu from "./components/menu/menu.vue";
|
|
29
|
-
import MenuItems from "./components/menu/menuItems.vue";
|
|
30
|
-
import MenuItem from "./components/menu/menuItem.vue";
|
|
31
|
-
|
|
32
|
-
import Combobox from "./components/combobox/combobox.vue";
|
|
33
|
-
import ComboboxOptions from "./components/combobox/comboboxOptions.vue";
|
|
34
|
-
import ComboboxOption from "./components/combobox/comboboxOption.vue";
|
|
35
|
-
|
|
36
|
-
export {
|
|
37
|
-
usePopover,
|
|
38
|
-
useList,
|
|
39
|
-
useListOption,
|
|
40
|
-
useFormControl,
|
|
41
|
-
//
|
|
42
|
-
useHTMLElement,
|
|
43
|
-
useSequentialId,
|
|
44
|
-
//
|
|
45
|
-
Listbox,
|
|
46
|
-
ListboxOption,
|
|
47
|
-
//
|
|
48
|
-
Popover,
|
|
49
|
-
PopoverDialog,
|
|
50
|
-
//
|
|
51
|
-
TabContainer,
|
|
52
|
-
TabList,
|
|
53
|
-
Tab,
|
|
54
|
-
TabPanel,
|
|
55
|
-
//
|
|
56
|
-
Tooltip,
|
|
57
|
-
//
|
|
58
|
-
Menu,
|
|
59
|
-
MenuItems,
|
|
60
|
-
MenuItem,
|
|
61
|
-
//
|
|
62
|
-
Combobox,
|
|
63
|
-
ComboboxOptions,
|
|
64
|
-
ComboboxOption,
|
|
65
|
-
};
|
package/src/utils/element.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Ref } from "vue";
|
|
2
|
-
import { ref } from "vue";
|
|
3
|
-
|
|
4
|
-
export type TemplateRefOrSelector<E extends HTMLElement = HTMLElement> =
|
|
5
|
-
| Ref<E | undefined>
|
|
6
|
-
| E
|
|
7
|
-
| string;
|
|
8
|
-
|
|
9
|
-
export function useHTMLElement<E extends HTMLElement = HTMLElement>(
|
|
10
|
-
el: TemplateRefOrSelector<E>
|
|
11
|
-
) {
|
|
12
|
-
if (typeof el === "string") {
|
|
13
|
-
return ref<E | undefined>(document.querySelector<E>(el) || undefined);
|
|
14
|
-
} else if (el instanceof HTMLElement) {
|
|
15
|
-
return ref<E | undefined>(el);
|
|
16
|
-
} else {
|
|
17
|
-
return el;
|
|
18
|
-
}
|
|
19
|
-
}
|
package/src/utils/id.ts
DELETED
package/src/vite-env.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
package/tsconfig.json
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"useDefineForClassFields": true,
|
|
5
|
-
"module": "ESNext",
|
|
6
|
-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
|
|
9
|
-
/* Bundler mode */
|
|
10
|
-
"outDir": "dist/types",
|
|
11
|
-
"declaration": true,
|
|
12
|
-
"moduleResolution": "bundler",
|
|
13
|
-
"allowImportingTsExtensions": true,
|
|
14
|
-
"resolveJsonModule": true,
|
|
15
|
-
"isolatedModules": true,
|
|
16
|
-
"emitDeclarationOnly": true,
|
|
17
|
-
"jsx": "preserve",
|
|
18
|
-
|
|
19
|
-
/* Linting */
|
|
20
|
-
"strict": true,
|
|
21
|
-
"noUnusedLocals": true,
|
|
22
|
-
"noUnusedParameters": true,
|
|
23
|
-
"noFallthroughCasesInSwitch": true
|
|
24
|
-
},
|
|
25
|
-
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
|
|
26
|
-
"references": [{ "path": "./tsconfig.node.json" }]
|
|
27
|
-
}
|
package/tsconfig.node.json
DELETED
package/vite.config.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { resolve } from "path";
|
|
2
|
-
import { defineConfig } from "vite";
|
|
3
|
-
import vue from "@vitejs/plugin-vue";
|
|
4
|
-
|
|
5
|
-
export default defineConfig({
|
|
6
|
-
plugins: [vue()],
|
|
7
|
-
build: {
|
|
8
|
-
lib: {
|
|
9
|
-
// Could also be a dictionary or array of multiple entry points
|
|
10
|
-
entry: resolve(__dirname, "src/main.ts"),
|
|
11
|
-
name: "Vue Composable UI",
|
|
12
|
-
// the proper extensions will be added
|
|
13
|
-
fileName: "composable-ui",
|
|
14
|
-
},
|
|
15
|
-
rollupOptions: {
|
|
16
|
-
// make sure to externalize deps that shouldn't be bundled
|
|
17
|
-
// into your library
|
|
18
|
-
external: ["vue"],
|
|
19
|
-
output: {
|
|
20
|
-
// Provide global variables to use in the UMD build
|
|
21
|
-
// for externalized deps
|
|
22
|
-
globals: {
|
|
23
|
-
vue: "Vue",
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
});
|