vue-composable-ui 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.
Files changed (65) hide show
  1. package/dist/combobox.vue_vue_type_script_setup_true_lang-BhVMcx67.js +140 -0
  2. package/dist/comboboxHiddenInput.vue_vue_type_script_setup_true_lang-Ba-UPd-M.js +29 -0
  3. package/dist/comboboxInput.vue_vue_type_script_setup_true_lang-DzRfJ5ke.js +33 -0
  4. package/dist/comboboxOption.vue_vue_type_script_setup_true_lang-OyJxB4Jk.js +42 -0
  5. package/dist/comboboxOptions.vue_vue_type_script_setup_true_lang-Doy6MfEQ.js +20 -0
  6. package/dist/composable-ui.js +47 -1112
  7. package/dist/composable-ui10.js +4 -0
  8. package/dist/composable-ui11.js +4 -0
  9. package/dist/composable-ui12.js +4 -0
  10. package/dist/composable-ui13.js +4 -0
  11. package/dist/composable-ui14.js +4 -0
  12. package/dist/composable-ui15.js +4 -0
  13. package/dist/composable-ui16.js +4 -0
  14. package/dist/composable-ui17.js +31 -0
  15. package/dist/composable-ui18.js +4 -0
  16. package/dist/composable-ui19.js +4 -0
  17. package/dist/composable-ui2.js +55 -0
  18. package/dist/composable-ui20.js +4 -0
  19. package/dist/composable-ui21.js +100 -0
  20. package/dist/composable-ui22.js +144 -0
  21. package/dist/composable-ui23.js +7 -0
  22. package/dist/composable-ui24.js +7 -0
  23. package/dist/composable-ui3.js +4 -0
  24. package/dist/composable-ui4.js +4 -0
  25. package/dist/composable-ui5.js +4 -0
  26. package/dist/composable-ui6.js +4 -0
  27. package/dist/composable-ui7.js +4 -0
  28. package/dist/composable-ui8.js +4 -0
  29. package/dist/composable-ui9.js +4 -0
  30. package/dist/listbox.vue_vue_type_script_setup_true_lang-Bj1ZXiBX.js +69 -0
  31. package/dist/listboxOption.vue_vue_type_script_setup_true_lang-B_yRptJm.js +37 -0
  32. package/dist/menu.vue_vue_type_script_setup_true_lang-Ci7q2rOg.js +82 -0
  33. package/dist/menuItem.vue_vue_type_script_setup_true_lang-mXtMa4gO.js +63 -0
  34. package/dist/menuItems.vue_vue_type_script_setup_true_lang-p9vftREy.js +49 -0
  35. package/dist/popover.vue_vue_type_script_setup_true_lang-DhKF7_nY.js +50 -0
  36. package/dist/popoverDialog.vue_vue_type_script_setup_true_lang-CDXUO7wZ.js +33 -0
  37. package/dist/tab.vue_vue_type_script_setup_true_lang-Y5OFGqMB.js +29 -0
  38. package/dist/tabContainer.vue_vue_type_script_setup_true_lang-fPpLno2Z.js +40 -0
  39. package/dist/tabList.vue_vue_type_script_setup_true_lang-CZyqGCuj.js +48 -0
  40. package/dist/tabPanel.vue_vue_type_script_setup_true_lang-CGhP6SHR.js +31 -0
  41. package/dist/tooltip.vue_vue_type_script_setup_true_lang-DVKYJyfL.js +85 -0
  42. package/dist/types/components/combobox/combobox.vue.d.ts +45 -0
  43. package/dist/types/components/combobox/comboboxHiddenInput.vue.d.ts +3 -5
  44. package/dist/types/components/combobox/comboboxInput.vue.d.ts +3 -3
  45. package/dist/types/components/combobox/comboboxOption.vue.d.ts +12 -14
  46. package/dist/types/components/combobox/comboboxOptions.vue.d.ts +6 -5
  47. package/dist/types/components/listbox/listbox.vue.d.ts +11 -11
  48. package/dist/types/components/listbox/listboxOption.vue.d.ts +12 -14
  49. package/dist/types/components/menu/menu.vue.d.ts +42 -0
  50. package/dist/types/components/menu/menuItem.vue.d.ts +13 -15
  51. package/dist/types/components/menu/menuItems.vue.d.ts +6 -5
  52. package/dist/types/components/popover/popover.vue.d.ts +40 -0
  53. package/dist/types/components/popover/popoverDialog.vue.d.ts +6 -5
  54. package/dist/types/components/tabs/tab.vue.d.ts +9 -11
  55. package/dist/types/components/tabs/tabContainer.vue.d.ts +8 -7
  56. package/dist/types/components/tabs/tabList.vue.d.ts +9 -9
  57. package/dist/types/components/tabs/tabPanel.vue.d.ts +9 -9
  58. package/dist/types/components/tooltip.vue.d.ts +23 -25
  59. package/dist/types/composables/list.d.ts +5 -1
  60. package/dist/types/composables/listOption.d.ts +4 -0
  61. package/dist/types/main.d.ts +21 -23
  62. package/dist/types/utils/element.d.ts +2 -2
  63. package/package.json +11 -8
  64. package/dist/composable-ui.umd.cjs +0 -1
  65. package/dist/types/utils/id.d.ts +0 -1
@@ -1,1114 +1,49 @@
1
- import { ref as S, watch as oe, nextTick as H, onMounted as ae, onBeforeUnmount as G, shallowRef as pe, computed as E, provide as U, readonly as J, shallowReadonly as me, triggerRef as ce, unref as s, inject as B, onBeforeMount as be, defineComponent as A, mergeModels as ie, useModel as W, openBlock as _, createElementBlock as y, renderSlot as O, createCommentVNode as N, useSlots as Ie, Fragment as z, createBlock as te, Teleport as we, mergeProps as de, createTextVNode as he, toDisplayString as _e, renderList as fe, withDirectives as ge, vModelDynamic as ye } from "vue";
2
- function R(i) {
3
- return typeof i == "string" ? S(document.querySelector(i) || void 0) : i instanceof HTMLElement ? S(i) : i;
4
- }
5
- function Q(i, e, {
6
- direction: t = "down",
7
- align: o = "left",
8
- position: n = "fixed",
9
- closeOnOutsideClick: r = !0,
10
- closeOnInsideClick: f = !1
11
- } = {}) {
12
- const a = S(!1);
13
- function c() {
14
- const v = R(i);
15
- if (!v.value) throw new Error("Activator element is undefined");
16
- return v.value;
17
- }
18
- function u() {
19
- const v = R(e);
20
- if (!v.value) throw new Error("Popover element is undefined");
21
- return v.value;
22
- }
23
- function m({ focus: v = !0 } = {}) {
24
- a.value = !0, v && H(() => {
25
- u().focus();
26
- });
27
- }
28
- function b({ focus: v = !0 } = {}) {
29
- a.value = !1, v && c().focus();
30
- }
31
- function d(v) {
32
- a.value ? b(v) : m(v);
33
- }
34
- function w() {
35
- if (!a.value) return;
36
- const v = c(), $ = u();
37
- $.style.position = n;
38
- const {
39
- top: j,
40
- right: l,
41
- bottom: p,
42
- left: h,
43
- width: x,
44
- height: I
45
- } = v.getBoundingClientRect(), L = $.offsetHeight, F = $.offsetWidth, K = document.documentElement.clientHeight, q = document.documentElement.clientWidth;
46
- let P = t;
47
- t == "up" ? j - L < 0 && (P = "down") : t == "down" ? p + L > K && (P = "up") : t == "right" ? l + F > q && (P = "left") : t == "left" && h - F < 0 && (P = "right");
48
- let M = o;
49
- o == "left" ? h + F > q && (M = "right") : o == "right" ? l - F < 0 && (M = "left") : o == "top" ? j + L > K && (M = "bottom") : o == "bottom" && p - L < 0 && (M = "top");
50
- const V = {
51
- top: "auto",
52
- bottom: "auto",
53
- left: "auto",
54
- right: "auto",
55
- width: "auto"
56
- }, T = n === "fixed";
57
- P == "up" ? V.bottom = `${I + (T ? K - p : 0)}px` : P == "down" ? V.top = `${I + (T ? j : 0)}px` : P == "right" ? V.left = `${x + (T ? h : 0)}px` : P == "left" && (V.right = `${x + (T ? q - l : 0)}px`), ["up", "down"].includes(P) ? M == "right" ? V.right = `${T ? q - l : 0}px` : M == "left" || M == "stretch" ? V.left = `${T ? h : 0}px` : M == "center" && (V.left = `${(T ? h : 0) - (F - x) / 2}px`) : M == "bottom" ? V.bottom = `${T ? K - p : 0}px` : M == "top" ? V.top = `${T ? j : 0}px` : M == "center" && (V.top = `${(T ? j : 0) - (L - I) / 2}px`), ["up", "down"].includes(P) && M === "stretch" && (V.width = x + "px");
58
- for (const le in V)
59
- $.style[le] = V[le];
60
- }
61
- oe(
62
- a,
63
- (v) => {
64
- v && H(() => {
65
- w();
66
- });
67
- },
68
- { flush: "pre" }
69
- );
70
- function C(v) {
71
- const $ = v.target;
72
- if (!c().contains($))
73
- try {
74
- u().contains($) ? f && b() : r && (a.value = !1);
75
- } catch {
76
- }
77
- }
78
- const g = new ResizeObserver(w), k = new AbortController();
79
- return ae(() => {
80
- window.addEventListener("resize", w, {
81
- passive: !0,
82
- signal: k.signal
83
- }), window.addEventListener("scroll", w, {
84
- passive: !0,
85
- //capture: true,
86
- signal: k.signal
87
- }), window.addEventListener("click", C, {
88
- passive: !0,
89
- signal: k.signal
90
- }), g.observe(c());
91
- }), G(() => {
92
- k.abort(), g.disconnect();
93
- }), {
94
- isOpen: a,
95
- open: m,
96
- close: b,
97
- toggle: d
98
- };
99
- }
100
- const ne = Symbol();
101
- function ee(i, e) {
102
- const [t, o] = [s(i), s(e)];
103
- return typeof t == "object" ? typeof o == "object" ? JSON.stringify(t) === JSON.stringify(o) : !1 : t === o;
104
- }
105
- function X(i) {
106
- let e = 0;
107
- const t = pe([]), o = S(), n = E(() => Array.isArray(i.value));
108
- function r(l) {
109
- const p = t.value.find((h) => h.id === l);
110
- if (!p) throw new Error(`Item not found: (${l})`);
111
- return p;
112
- }
113
- function f(l) {
114
- const p = s(l.element);
115
- if (p)
116
- return p.focus(), p;
117
- }
118
- function a(l, { focus: p = !1 } = {}) {
119
- o.value = (l == null ? void 0 : l.id) ?? void 0, l !== void 0 && p && f(l);
120
- }
121
- function c(l, { focus: p = !1 } = {}) {
122
- const h = r(l);
123
- return a(h, { focus: p });
124
- }
125
- function u(l) {
126
- return o.value === l;
127
- }
128
- function m(l, p, h = !1) {
129
- const x = R(l), I = e++;
130
- return t.value.push({
131
- id: I,
132
- value: p,
133
- element: x,
134
- disabled: h
135
- }), ce(t), I;
136
- }
137
- function b(l) {
138
- u(l) && a();
139
- const p = r(l), h = t.value.indexOf(p);
140
- t.value.splice(h, 1), ce(t);
141
- }
142
- function d(l) {
143
- const p = r(l);
144
- if (s(p.disabled)) return;
145
- const h = s(p.value);
146
- if (h !== void 0) {
147
- if (s(n)) {
148
- const x = i.value.findIndex(
149
- (I) => ee(h, I)
150
- );
151
- x > -1 ? i.value.splice(x, 1) : i.value = [...i.value, h];
152
- } else
153
- i.value = h;
154
- a(p);
155
- }
156
- }
157
- function w(l) {
158
- return s(n) ? !!i.value.find(
159
- (p) => ee(l.value, p)
160
- ) : ee(i, l.value);
161
- }
162
- function C(l) {
163
- try {
164
- const p = r(l);
165
- return w(p);
166
- } catch {
167
- return !1;
168
- }
169
- }
170
- function g({ focus: l = !1 } = {}) {
171
- for (let p of t.value)
172
- if (w(p))
173
- return a(p, { focus: l });
174
- }
175
- function k({ focus: l = !1 } = {}) {
176
- if (t.value.length)
177
- return a(t.value[0], { focus: l });
178
- }
179
- function v({ focus: l = !1 } = {}) {
180
- if (t.value.length)
181
- return a(t.value[t.value.length - 1], { focus: l });
182
- }
183
- function $({
184
- focus: l = !1,
185
- loop: p = !1
186
- } = {}) {
187
- if (o.value === void 0) return k({ focus: l });
188
- const h = r(o.value), x = t.value.indexOf(h);
189
- let I;
190
- if (x + 1 < t.value.length)
191
- I = t.value[x + 1];
192
- else if (p)
193
- I = t.value[0];
194
- else
195
- return;
196
- return a(I, { focus: l });
197
- }
198
- function j({
199
- focus: l = !1,
200
- loop: p = !1
201
- } = {}) {
202
- if (o.value === void 0) return v({ focus: l });
203
- const h = r(o.value), x = t.value.indexOf(h);
204
- let I;
205
- if (x - 1 > -1)
206
- I = t.value[x - 1];
207
- else if (p)
208
- I = t.value[t.value.length - 1];
209
- else
210
- return;
211
- return a(I, { focus: l });
212
- }
213
- return U(ne, {
214
- value: J(i),
215
- selectItem: d,
216
- activateItem: c,
217
- isSelected: C,
218
- isActive: u,
219
- addItem: m,
220
- removeItem: b
221
- }), {
222
- items: me(t),
223
- isMultiselectable: J(n),
224
- activeItem: E(
225
- () => o.value !== void 0 ? r(o.value) : void 0
226
- ),
227
- selectActiveItem: () => {
228
- o.value !== void 0 && d(o.value);
229
- },
230
- activateSelectedItem: g,
231
- activateFirstItem: k,
232
- activateLastItem: v,
233
- activateNextItem: $,
234
- activatePrevItem: j
235
- };
236
- }
237
- function Y(i, e, t) {
238
- const o = B(ne);
239
- if (!o)
240
- throw new Error("List injectable context is not provided");
241
- const n = S(-1), r = E(() => o.isSelected(n.value)), f = E(() => o.isActive(n.value));
242
- function a() {
243
- o.selectItem(n.value);
244
- }
245
- function c({ focus: u = !0 } = {}) {
246
- s(t) || o.activateItem(n.value, { focus: u });
247
- }
248
- return be(() => {
249
- n.value = o.addItem(i, e, t);
250
- }), G(() => {
251
- o.removeItem(n.value);
252
- }), {
253
- isSelected: r,
254
- isActive: f,
255
- select: a,
256
- activate: c
257
- };
258
- }
259
- function Te(i, e = [], t = !0) {
260
- const o = S(!1), n = S(!0), r = S(), f = S("");
261
- let a, c;
262
- function u() {
263
- a == null || a.focus();
264
- }
265
- function m() {
266
- n.value = a.validity.valid, r.value = a.validity, f.value = a.validationMessage;
267
- }
268
- function b() {
269
- if (!a) throw new Error("Form element is undefined");
270
- if (a.setCustomValidity(""), a.validity.valid) {
271
- const g = a.value;
272
- for (const k of s(e)) {
273
- const v = k(g);
274
- if (v !== !0) {
275
- a.setCustomValidity(v);
276
- break;
277
- }
278
- }
279
- }
280
- return m(), n.value;
281
- }
282
- function d(g) {
283
- m(), s(t) || g.preventDefault();
284
- }
285
- function w() {
286
- b(), o.value = c !== a.value;
287
- }
288
- let C = new AbortController();
289
- return ae(() => {
290
- if (a = R(i).value, !a) throw new Error("Form element is undefined");
291
- c = a.value, a.addEventListener("change", w, {
292
- signal: C.signal,
293
- passive: !0
294
- }), a.addEventListener("invalid", d, {
295
- signal: C.signal
296
- }), a != null && a.autofocus && u();
297
- }), G(() => {
298
- C.abort();
299
- }), {
300
- focus: u,
301
- validate: b,
302
- isValid: n,
303
- validity: J(r),
304
- validationMessage: J(f),
305
- isChanged: o
306
- };
307
- }
308
- let ke = 0;
309
- function D(i = "id") {
310
- return `${i}-${++ke}`;
311
- }
312
- const se = Symbol(), ve = Symbol(), re = Symbol(), Z = Symbol(), xe = ["aria-activedescendant", "aria-orientation", "aria-multiselectable"], Be = /* @__PURE__ */ A({
313
- __name: "listbox",
314
- props: /* @__PURE__ */ ie({
315
- orientation: { default: "vertical" },
316
- loop: { type: Boolean, default: !1 }
317
- }, {
318
- modelValue: {},
319
- modelModifiers: {}
320
- }),
321
- emits: ["update:modelValue"],
322
- setup(i) {
323
- const e = i, t = W(i, "modelValue"), {
324
- isMultiselectable: o,
325
- activeItem: n,
326
- selectActiveItem: r,
327
- activateFirstItem: f,
328
- activateLastItem: a,
329
- activateNextItem: c,
330
- activatePrevItem: u
331
- } = X(t), m = E(() => {
332
- var d, w;
333
- return (w = (d = n.value) == null ? void 0 : d.element.value) == null ? void 0 : w.id;
334
- });
335
- function b(d) {
336
- switch (d.code) {
337
- case "Space":
338
- r();
339
- break;
340
- case "ArrowUp":
341
- if (e.orientation === "horizontal") return;
342
- u({ focus: !1, loop: e.loop }), o.value || r();
343
- break;
344
- case "ArrowDown":
345
- if (e.orientation === "horizontal") return;
346
- c({ focus: !1, loop: e.loop }), o.value || r();
347
- break;
348
- case "ArrowLeft":
349
- if (e.orientation === "vertical") return;
350
- u({ focus: !1, loop: e.loop }), o.value || r();
351
- break;
352
- case "ArrowRight":
353
- if (e.orientation === "vertical") return;
354
- c({ focus: !1, loop: e.loop }), o.value || r();
355
- break;
356
- case "Home":
357
- f({ focus: !1 });
358
- break;
359
- case "End":
360
- a({ focus: !1 });
361
- break;
362
- default:
363
- return;
364
- }
365
- d.preventDefault();
366
- }
367
- return (d, w) => (_(), y("div", {
368
- onKeydown: b,
369
- "aria-activedescendant": m.value,
370
- "aria-orientation": d.orientation,
371
- "aria-multiselectable": s(o),
372
- role: "listbox",
373
- tabindex: "0"
374
- }, [
375
- O(d.$slots, "default")
376
- ], 40, xe));
377
- }
378
- }), $e = ["id", "aria-disabled", "aria-selected", "data-active"], Fe = /* @__PURE__ */ A({
379
- __name: "listboxOption",
380
- props: {
381
- id: {},
382
- value: {},
383
- disabled: { type: Boolean }
384
- },
385
- setup(i) {
386
- const e = i, t = e.id ?? D("list-option"), o = S(), { isSelected: n, isActive: r, select: f } = Y(
387
- o,
388
- e.value,
389
- e.disabled
390
- );
391
- return (a, c) => (_(), y("div", {
392
- ref_key: "itemEl",
393
- ref: o,
394
- id: s(t),
395
- onClick: c[0] || (c[0] = //@ts-ignore
396
- (...u) => s(f) && s(f)(...u)),
397
- "aria-disabled": a.disabled,
398
- "aria-selected": s(n),
399
- "data-active": s(r),
400
- role: "option",
401
- tabindex: "-1"
402
- }, [
403
- O(a.$slots, "default", {
404
- isSelected: s(n),
405
- isActive: s(r)
406
- })
407
- ], 8, $e));
408
- }
409
- }), He = /* @__PURE__ */ A({
410
- __name: "tabContainer",
411
- props: {
412
- modelValue: {},
413
- modelModifiers: {}
414
- },
415
- emits: ["update:modelValue"],
416
- setup(i) {
417
- const e = W(i, "modelValue"), {
418
- items: t,
419
- selectActiveItem: o,
420
- activateFirstItem: n,
421
- activateLastItem: r,
422
- activateNextItem: f,
423
- activatePrevItem: a
424
- } = X(e);
425
- return U(se, {
426
- getIds: (c) => E(() => {
427
- var m, b;
428
- const u = t.value.find((d) => d.value === c);
429
- return {
430
- tabId: ((m = u == null ? void 0 : u.element.value) == null ? void 0 : m.getAttribute("id")) || void 0,
431
- panelId: ((b = u == null ? void 0 : u.element.value) == null ? void 0 : b.getAttribute("aria-controls")) || void 0
432
- };
433
- }),
434
- selectActiveItem: o,
435
- activateFirstItem: n,
436
- activateLastItem: r,
437
- activateNextItem: f,
438
- activatePrevItem: a
439
- }), (c, u) => (_(), y("div", null, [
440
- O(c.$slots, "default")
441
- ]));
442
- }
443
- }), Ae = ["aria-orientation"], Ke = /* @__PURE__ */ A({
444
- __name: "tabList",
445
- props: {
446
- orientation: { default: "horizontal" }
447
- },
448
- setup(i) {
449
- const e = i, t = B(se);
450
- if (!t)
451
- throw new Error("Tabs injectable context is not provided");
452
- function o(n) {
453
- switch (n.code) {
454
- case "ArrowUp":
455
- e.orientation === "vertical" && t.activatePrevItem({ focus: !0, loop: !0 });
456
- break;
457
- case "ArrowDown":
458
- e.orientation === "vertical" && t.activateNextItem({ focus: !0, loop: !0 });
459
- break;
460
- case "ArrowLeft":
461
- e.orientation === "horizontal" && t.activatePrevItem({ focus: !0, loop: !0 });
462
- break;
463
- case "ArrowRight":
464
- e.orientation === "horizontal" && t.activateNextItem({ focus: !0, loop: !0 });
465
- break;
466
- case "Home":
467
- t.activateFirstItem({ focus: !0 });
468
- break;
469
- case "End":
470
- t.activateLastItem({ focus: !0 });
471
- break;
472
- default:
473
- return;
474
- }
475
- t.selectActiveItem(), n.preventDefault();
476
- }
477
- return (n, r) => (_(), y("div", {
478
- onKeydown: o,
479
- "aria-orientation": e.orientation,
480
- role: "tablist"
481
- }, [
482
- O(n.$slots, "default")
483
- ], 40, Ae));
484
- }
485
- }), Ee = ["id", "aria-selected", "aria-controls", "tabindex"], Ne = /* @__PURE__ */ A({
486
- __name: "tab",
487
- props: {
488
- id: {},
489
- ariaControls: {},
490
- value: {}
491
- },
492
- setup(i) {
493
- const e = i, t = S(), { isSelected: o, select: n } = Y(t, e.value), r = e.id ?? D("tab"), f = e.ariaControls ?? D("tab-panel");
494
- return (a, c) => (_(), y("button", {
495
- ref_key: "tab",
496
- ref: t,
497
- onClick: c[0] || (c[0] = //@ts-ignore
498
- (...u) => s(n) && s(n)(...u)),
499
- id: s(r),
500
- "aria-selected": s(o),
501
- "aria-controls": s(f),
502
- tabindex: s(o) ? 0 : -1,
503
- role: "tab"
504
- }, [
505
- O(a.$slots, "default")
506
- ], 8, Ee));
507
- }
508
- }), Oe = ["id", "aria-labelledby"], ze = /* @__PURE__ */ A({
509
- __name: "tabPanel",
510
- props: {
511
- value: {}
512
- },
513
- setup(i) {
514
- const e = i, t = B(ne);
515
- if (!t)
516
- throw new Error("List injectable context is not provided");
517
- const o = B(se);
518
- if (!o)
519
- throw new Error("Tabs injectable context is not provided");
520
- const n = E(() => e.value === t.value.value), r = o.getIds(e.value);
521
- return (f, a) => n.value ? (_(), y("div", {
522
- key: 0,
523
- id: s(r).panelId,
524
- "aria-labelledby": s(r).tabId,
525
- tabindex: "0",
526
- role: "tabpanel"
527
- }, [
528
- O(f.$slots, "default")
529
- ], 8, Oe)) : N("", !0);
530
- }
531
- }), Re = /* @__PURE__ */ A({
532
- __name: "popover",
533
- props: {
534
- id: {},
535
- activatorId: {},
536
- direction: { default: "down" },
537
- align: { default: "left" },
538
- position: { default: "fixed" },
539
- closeOnOutsideClick: { type: Boolean, default: !0 },
540
- closeOnInsideClick: { type: Boolean, default: !1 },
541
- role: { default: "dialog" }
542
- },
543
- setup(i) {
544
- const e = i, t = e.id ?? D("popover"), o = e.activatorId ?? D("popover-activator"), { isOpen: n, toggle: r, open: f, close: a } = Q(
545
- `#${o}`,
546
- `#${t}`,
547
- {
548
- direction: e.direction,
549
- align: e.align,
550
- position: e.position,
551
- closeOnOutsideClick: e.closeOnOutsideClick,
552
- closeOnInsideClick: e.closeOnInsideClick
553
- }
554
- ), c = E(() => ({
555
- id: o,
556
- "aria-controls": n.value ? e.id : void 0,
557
- "aria-haspopup": e.role,
558
- "aria-expanded": n.value
559
- }));
560
- return U(ve, {
561
- popoverId: t,
562
- activatorId: o,
563
- role: e.role,
564
- isOpen: n,
565
- close: a
566
- }), (u, m) => O(u.$slots, "default", {
567
- attrs: c.value,
568
- isOpen: s(n),
569
- toggle: s(r),
570
- open: s(f),
571
- close: s(a)
572
- });
573
- }
574
- }), Ce = ["id", "role", "aria-labelledby"], Ue = /* @__PURE__ */ A({
575
- __name: "popoverDialog",
576
- setup(i) {
577
- const e = B(ve);
578
- if (!e)
579
- throw new Error("Popover injectable context is not provided");
580
- function t(o) {
581
- switch (o.code) {
582
- case "Escape":
583
- e.close();
584
- break;
585
- default:
586
- return;
587
- }
588
- o.preventDefault();
589
- }
590
- return (o, n) => s(e).isOpen.value ? (_(), y("div", {
591
- key: 0,
592
- onKeydown: t,
593
- id: s(e).popoverId,
594
- role: s(e).role,
595
- "aria-labelledby": s(e).activatorId,
596
- tabindex: "-1"
597
- }, [
598
- O(o.$slots, "default")
599
- ], 40, Ce)) : N("", !0);
600
- }
601
- }), Se = ["id"], We = /* @__PURE__ */ A({
602
- inheritAttrs: !1,
603
- __name: "tooltip",
604
- props: {
605
- id: {},
606
- text: {},
607
- delay: {},
608
- direction: { default: "up" }
609
- },
610
- setup(i) {
611
- const e = i, t = Ie(), o = S();
612
- let n;
613
- const r = e.id ?? D("tooltip"), { isOpen: f } = Q(`[aria-describedby=${r}]`, o, {
614
- direction: e.direction,
615
- align: "center"
616
- });
617
- function a() {
618
- n = setTimeout(
619
- () => {
620
- f.value = !0;
621
- },
622
- typeof e.delay == "string" ? parseInt(e.delay) : e.delay
623
- );
624
- }
625
- function c() {
626
- f.value = !1, clearTimeout(n);
627
- }
628
- function u(d) {
629
- d.key === "Escape" && c();
630
- }
631
- const m = {
632
- "aria-describedby": r,
633
- onmouseenter: a,
634
- onmouseleave: c,
635
- onfocus: a,
636
- onblur: c,
637
- onkeydown: u
638
- }, b = new AbortController();
639
- return ae(() => {
640
- if (t.default) return;
641
- const d = document.querySelector(
642
- `[aria-describedby=${r}]`
643
- );
644
- if (!d)
645
- throw new Error(`Tooltip activator not found: ${r}`);
646
- d.addEventListener("mouseenter", a, {
647
- signal: b.signal,
648
- passive: !0
649
- }), d.addEventListener("mouseleave", c, {
650
- signal: b.signal,
651
- passive: !0
652
- }), d.addEventListener("focus", a, {
653
- signal: b.signal,
654
- passive: !0
655
- }), d.addEventListener("blur", c, {
656
- signal: b.signal,
657
- passive: !0
658
- }), d.addEventListener("keydown", u, {
659
- signal: b.signal,
660
- passive: !0
661
- });
662
- }), G(() => {
663
- b.abort();
664
- }), (d, w) => (_(), y(z, null, [
665
- O(d.$slots, "default", { attrs: m }),
666
- (_(), te(we, { to: "body" }, [
667
- s(f) ? (_(), y("div", de({
668
- key: 0,
669
- ref_key: "popupEl",
670
- ref: o,
671
- id: s(r)
672
- }, d.$attrs, { role: "tooltip" }), [
673
- O(d.$slots, "content", {}, () => [
674
- he(_e(d.text), 1)
675
- ])
676
- ], 16, Se)) : N("", !0)
677
- ]))
678
- ], 64));
679
- }
680
- }), qe = /* @__PURE__ */ A({
681
- __name: "menu",
682
- props: /* @__PURE__ */ ie({
683
- id: {},
684
- activatorId: {},
685
- direction: { default: "down" },
686
- align: { default: "left" },
687
- position: { default: "fixed" }
688
- }, {
689
- modelValue: {},
690
- modelModifiers: {}
691
- }),
692
- emits: ["update:modelValue"],
693
- setup(i) {
694
- const e = i, t = e.id ?? D("menu"), o = e.activatorId ?? D("menu-activator"), n = W(i, "modelValue"), {
695
- isMultiselectable: r,
696
- activeItem: f,
697
- activateFirstItem: a,
698
- activateLastItem: c,
699
- activateNextItem: u,
700
- activatePrevItem: m
701
- } = X(n), { isOpen: b, toggle: d, open: w, close: C } = Q(
702
- `#${o}`,
703
- `#${t}`,
704
- {
705
- direction: e.direction,
706
- align: e.align,
707
- position: e.position,
708
- closeOnOutsideClick: !0,
709
- closeOnInsideClick: !1
710
- }
711
- );
712
- function g(v) {
713
- switch (v.code) {
714
- case "Space":
715
- case "Enter":
716
- d(), b.value && H(a);
717
- break;
718
- case "ArrowUp":
719
- w(), H(c);
720
- break;
721
- case "ArrowDown":
722
- w(), H(a);
723
- break;
724
- default:
725
- return;
726
- }
727
- v.preventDefault();
728
- }
729
- const k = E(() => ({
730
- id: o,
731
- "aria-controls": b.value ? t : void 0,
732
- "aria-haspopup": "menu",
733
- "aria-expanded": b.value,
734
- onclick: d,
735
- onkeydown: g,
736
- tabindex: 0
737
- }));
738
- return U(re, {
739
- menuId: t,
740
- activatorId: o,
741
- isOpen: b,
742
- close: C,
743
- isMultiselectable: r,
744
- activeItemId: E(() => {
745
- var v, $;
746
- return ($ = (v = f.value) == null ? void 0 : v.element.value) == null ? void 0 : $.id;
747
- }),
748
- activateFirstItem: a,
749
- activateLastItem: c,
750
- activateNextItem: u,
751
- activatePrevItem: m
752
- }), (v, $) => O(v.$slots, "default", { attrs: k.value });
753
- }
754
- }), Ve = ["id", "aria-activedescendant", "aria-labelledby"], Je = /* @__PURE__ */ A({
755
- __name: "menuItems",
756
- setup(i) {
757
- const e = B(re);
758
- if (!e)
759
- throw new Error("Menu injectable context is not provided");
760
- function t(o) {
761
- switch (o.code) {
762
- case "ArrowUp":
763
- e.activatePrevItem({ focus: !0, loop: !1 });
764
- break;
765
- case "ArrowDown":
766
- e.activateNextItem({ focus: !0, loop: !1 });
767
- break;
768
- case "Home":
769
- e.activateFirstItem({ focus: !0 });
770
- break;
771
- case "End":
772
- e.activateLastItem({ focus: !0 });
773
- break;
774
- case "Escape":
775
- e.close();
776
- break;
777
- case "Tab":
778
- e.isOpen.value = !1;
779
- return;
780
- default:
781
- return;
782
- }
783
- o.preventDefault();
784
- }
785
- return (o, n) => s(e).isOpen.value ? (_(), y("div", {
786
- key: 0,
787
- onKeydown: t,
788
- id: s(e).menuId,
789
- "aria-activedescendant": s(e).activeItemId.value,
790
- "aria-labelledby": s(e).activatorId,
791
- role: "menu",
792
- tabindex: "-1"
793
- }, [
794
- O(o.$slots, "default")
795
- ], 40, Ve)) : N("", !0);
796
- }
797
- }), Le = ["id", "data-active", "role", "aria-checked", "aria-disabled"], Ge = /* @__PURE__ */ A({
798
- __name: "menuItem",
799
- props: {
800
- id: {},
801
- value: {},
802
- disabled: { type: Boolean }
803
- },
804
- emits: ["select"],
805
- setup(i, { emit: e }) {
806
- const t = i, o = e, n = t.id ?? D("menu-item"), r = S(), { isSelected: f, isActive: a, select: c, activate: u } = Y(
807
- r,
808
- t.value,
809
- t.disabled
810
- ), m = B(re);
811
- if (!m)
812
- throw new Error("Menu injectable context is not provided");
813
- const b = E(() => t.value !== void 0 ? m.isMultiselectable.value ? "menuitemcheckbox" : "menuitemradio" : "menuitem");
814
- function d() {
815
- c(), o("select", t.value);
816
- }
817
- function w() {
818
- d(), (t.value === void 0 || !(m != null && m.isMultiselectable.value)) && m.close();
819
- }
820
- function C(g) {
821
- switch (g.code) {
822
- case "Space":
823
- d(), t.value === void 0 && m.close();
824
- break;
825
- case "Enter":
826
- d(), m.close();
827
- break;
828
- default:
829
- return;
830
- }
831
- g.preventDefault();
832
- }
833
- return (g, k) => (_(), y("div", {
834
- ref_key: "itemEl",
835
- ref: r,
836
- id: s(n),
837
- onClick: w,
838
- onKeydown: C,
839
- onMouseenter: k[0] || (k[0] = (v) => s(u)({ focus: !1 })),
840
- "data-active": s(a),
841
- role: b.value,
842
- "aria-checked": g.value !== void 0 ? s(f) : void 0,
843
- "aria-disabled": g.disabled || void 0,
844
- tabindex: "-1"
845
- }, [
846
- O(g.$slots, "default", {
847
- isSelected: s(f),
848
- isActive: s(a)
849
- })
850
- ], 40, Le));
851
- }
852
- }), Me = ["name", "value"], ue = /* @__PURE__ */ A({
853
- __name: "comboboxHiddenInput",
854
- props: {
855
- name: {},
856
- value: {}
857
- },
858
- setup(i) {
859
- const e = i, t = E(() => {
860
- if (typeof e.value == "object") {
861
- const o = {};
862
- for (const [n, r] of Object.entries(e.value))
863
- o[`${e.name}[${n}]`] = r;
864
- return o;
865
- } else
866
- return {
867
- [e.name]: e.value
868
- };
869
- });
870
- return (o, n) => (_(!0), y(z, null, fe(t.value, (r, f) => (_(), y("input", {
871
- name: f,
872
- value: r,
873
- type: "hidden"
874
- }, null, 8, Me))), 256));
875
- }
876
- }), Qe = /* @__PURE__ */ A({
877
- inheritAttrs: !1,
878
- __name: "combobox",
879
- props: /* @__PURE__ */ ie({
880
- displayValue: { type: Function, default: (i) => Array.isArray(i) ? i.map((e) => e.toString()).join(", ") : i.toString() },
881
- id: {},
882
- activatorId: {},
883
- name: {},
884
- formValue: { type: Function, default: (i) => i }
885
- }, {
886
- modelValue: {},
887
- modelModifiers: {}
888
- }),
889
- emits: ["update:modelValue"],
890
- setup(i) {
891
- const e = i, t = E(() => w.value ? o.value.map((I) => e.formValue(I)) : e.formValue(o.value)), o = W(i, "modelValue"), n = e.id ?? D("combobox"), r = e.activatorId ?? n, f = `${n}-popover`, { isOpen: a, toggle: c, open: u, close: m } = Q(
892
- `#${r}`,
893
- `#${f}`,
894
- {
895
- direction: "down",
896
- align: "stretch",
897
- position: "fixed",
898
- closeOnOutsideClick: !0,
899
- closeOnInsideClick: !1
900
- }
901
- ), {
902
- items: b,
903
- activeItem: d,
904
- isMultiselectable: w,
905
- selectActiveItem: C,
906
- activateSelectedItem: g,
907
- activateFirstItem: k,
908
- activateLastItem: v,
909
- activateNextItem: $,
910
- activatePrevItem: j
911
- } = X(o), l = E(() => e.displayValue(o.value));
912
- oe(b, () => {
913
- !d.value && b.value.length && (g({ focus: !1 }), d.value || k({ focus: !1 }));
914
- });
915
- function p() {
916
- var L;
917
- (L = R(`#${r}`).value) == null || L.focus();
918
- }
919
- function h(I) {
920
- if (a.value)
921
- switch (I.code) {
922
- case "Space":
923
- C(), w.value || m({ focus: !0 });
924
- break;
925
- case "Enter":
926
- C(), m({ focus: !0 });
927
- break;
928
- case "Tab":
929
- C(), m({ focus: !0 });
930
- return;
931
- case "ArrowUp":
932
- j({ focus: !1, loop: !1 });
933
- break;
934
- case "ArrowDown":
935
- $({ focus: !1, loop: !1 });
936
- break;
937
- case "Home":
938
- k({ focus: !1 });
939
- break;
940
- case "End":
941
- v({ focus: !1 });
942
- break;
943
- case "Escape":
944
- m({ focus: !0 });
945
- break;
946
- default:
947
- return;
948
- }
949
- else
950
- switch (I.code) {
951
- case "Space":
952
- case "Enter":
953
- u({ focus: !1 });
954
- break;
955
- case "End":
956
- case "ArrowUp":
957
- u({ focus: !1 }), H(() => v({ focus: !1 }));
958
- break;
959
- case "Home":
960
- case "ArrowDown":
961
- u({ focus: !1 }), H(() => k({ focus: !1 }));
962
- break;
963
- default:
964
- return;
965
- }
966
- I.preventDefault();
967
- }
968
- const x = E(() => {
969
- var I, L;
970
- return {
971
- onkeydown: h,
972
- onclick: () => u({ focus: !1 }),
973
- id: n,
974
- "aria-controls": a.value ? f : void 0,
975
- "aria-expanded": a.value,
976
- "aria-activedescendant": (L = (I = d.value) == null ? void 0 : I.element.value) == null ? void 0 : L.id,
977
- "aria-haspopup": "listbox",
978
- role: "combobox"
979
- };
980
- });
981
- return U(Z, {
982
- displayValue: l,
983
- popoverId: f,
984
- isOpen: a,
985
- open: u,
986
- close: m,
987
- focus: p,
988
- isMultiselectable: w,
989
- activatorAttrs: x
990
- }), (I, L) => (_(), y(z, null, [
991
- I.name ? (_(), y(z, { key: 0 }, [
992
- s(w) ? (_(!0), y(z, { key: 0 }, fe(t.value, (F, K) => (_(), te(ue, {
993
- name: `${I.name}[${K}]`,
994
- value: F
995
- }, null, 8, ["name", "value"]))), 256)) : (_(), te(ue, {
996
- key: 1,
997
- name: I.name,
998
- value: t.value
999
- }, null, 8, ["name", "value"]))
1000
- ], 64)) : N("", !0),
1001
- O(I.$slots, "default", {
1002
- popoverId: f,
1003
- isOpen: s(a),
1004
- toggle: s(c),
1005
- displayValue: l.value,
1006
- attrs: x.value
1007
- })
1008
- ], 64));
1009
- }
1010
- }), Xe = /* @__PURE__ */ A({
1011
- __name: "comboboxInput",
1012
- props: {
1013
- modelValue: {},
1014
- modelModifiers: {}
1015
- },
1016
- emits: ["update:modelValue"],
1017
- setup(i) {
1018
- const e = B(Z);
1019
- if (!e)
1020
- throw new Error("Combobox injectable context is not provided");
1021
- const t = W(i, "modelValue");
1022
- function o() {
1023
- t.value = e.displayValue.value;
1024
- }
1025
- oe(e.displayValue, o, { immediate: !0 });
1026
- const n = E(() => ({
1027
- oninput: () => e.open({ focus: !0 }),
1028
- onchange: o,
1029
- ...e.activatorAttrs.value
1030
- }));
1031
- return (r, f) => ge((_(), y("input", de({
1032
- "onUpdate:modelValue": f[0] || (f[0] = (a) => t.value = a)
1033
- }, n.value, { autocomplete: "off" }), null, 16)), [
1034
- [ye, t.value]
1035
- ]);
1036
- }
1037
- }), De = ["id"], Ye = /* @__PURE__ */ A({
1038
- __name: "comboboxOptions",
1039
- setup(i) {
1040
- const e = B(Z);
1041
- if (!e)
1042
- throw new Error("Combobox injectable context is not provided");
1043
- return (t, o) => s(e).isOpen.value ? (_(), y("div", {
1044
- key: 0,
1045
- id: s(e).popoverId,
1046
- role: "listbox"
1047
- }, [
1048
- O(t.$slots, "default")
1049
- ], 8, De)) : N("", !0);
1050
- }
1051
- }), je = ["id", "data-active", "aria-selected", "aria-disabled"], Ze = /* @__PURE__ */ A({
1052
- __name: "comboboxOption",
1053
- props: {
1054
- id: {},
1055
- value: {},
1056
- disabled: { type: Boolean }
1057
- },
1058
- setup(i) {
1059
- const e = i, t = e.id ?? D("combobox-option"), o = S(), { isSelected: n, isActive: r, activate: f, select: a } = Y(
1060
- o,
1061
- e.value,
1062
- e.disabled
1063
- ), c = B(Z);
1064
- if (!c)
1065
- throw new Error("Combobox injectable context is not provided");
1066
- function u() {
1067
- a(), c.isMultiselectable.value ? c.focus() : c.close({ focus: !0 });
1068
- }
1069
- return (m, b) => (_(), y("div", {
1070
- ref_key: "itemEl",
1071
- ref: o,
1072
- id: s(t),
1073
- onClick: u,
1074
- onMouseenter: b[0] || (b[0] = (d) => s(f)({ focus: !1 })),
1075
- "data-active": s(r),
1076
- "aria-selected": s(n),
1077
- "aria-disabled": m.disabled || void 0,
1078
- role: "option"
1079
- }, [
1080
- O(m.$slots, "default", {
1081
- isSelected: s(n),
1082
- isActive: s(r)
1083
- })
1084
- ], 40, je));
1085
- }
1086
- });
1
+ import { usePopover as e } from "./composable-ui21.js";
2
+ import { useList as p } from "./composable-ui22.js";
3
+ import { useListOption as s } from "./composable-ui17.js";
4
+ import { useFormControl as a } from "./composable-ui2.js";
5
+ import { useHTMLElement as n } from "./composable-ui23.js";
6
+ import { injectCombobox as i, injectMenu as _, injectPopover as u, injectTabs as C } from "./composable-ui24.js";
7
+ import { _ as L } from "./listbox.vue_vue_type_script_setup_true_lang-Bj1ZXiBX.js";
8
+ import { _ as M } from "./listboxOption.vue_vue_type_script_setup_true_lang-B_yRptJm.js";
9
+ import { _ as c } from "./tabContainer.vue_vue_type_script_setup_true_lang-fPpLno2Z.js";
10
+ import { _ as v } from "./tabList.vue_vue_type_script_setup_true_lang-CZyqGCuj.js";
11
+ import { _ as I } from "./tab.vue_vue_type_script_setup_true_lang-Y5OFGqMB.js";
12
+ import { _ as D } from "./tabPanel.vue_vue_type_script_setup_true_lang-CGhP6SHR.js";
13
+ import { _ as F } from "./popover.vue_vue_type_script_setup_true_lang-DhKF7_nY.js";
14
+ import { _ as d } from "./popoverDialog.vue_vue_type_script_setup_true_lang-CDXUO7wZ.js";
15
+ import { _ as k } from "./tooltip.vue_vue_type_script_setup_true_lang-DVKYJyfL.js";
16
+ import { _ as w } from "./menu.vue_vue_type_script_setup_true_lang-Ci7q2rOg.js";
17
+ import { _ as z } from "./menuItems.vue_vue_type_script_setup_true_lang-p9vftREy.js";
18
+ import { _ as B } from "./menuItem.vue_vue_type_script_setup_true_lang-mXtMa4gO.js";
19
+ import { _ as J } from "./combobox.vue_vue_type_script_setup_true_lang-BhVMcx67.js";
20
+ import { _ as N } from "./comboboxInput.vue_vue_type_script_setup_true_lang-DzRfJ5ke.js";
21
+ import { _ as R } from "./comboboxOptions.vue_vue_type_script_setup_true_lang-Doy6MfEQ.js";
22
+ import { _ as U } from "./comboboxOption.vue_vue_type_script_setup_true_lang-OyJxB4Jk.js";
1087
23
  export {
1088
- Qe as Combobox,
1089
- Xe as ComboboxInput,
1090
- Ze as ComboboxOption,
1091
- Ye as ComboboxOptions,
1092
- Be as Listbox,
1093
- Fe as ListboxOption,
1094
- qe as Menu,
1095
- Ge as MenuItem,
1096
- Je as MenuItems,
1097
- Re as Popover,
1098
- Ue as PopoverDialog,
1099
- Ne as Tab,
1100
- He as TabContainer,
1101
- Ke as TabList,
1102
- ze as TabPanel,
1103
- We as Tooltip,
1104
- Z as injectCombobox,
1105
- re as injectMenu,
1106
- ve as injectPopover,
1107
- se as injectTabs,
1108
- Te as useFormControl,
1109
- R as useHTMLElement,
1110
- X as useList,
1111
- Y as useListOption,
1112
- Q as usePopover,
1113
- D as useSequentialId
24
+ J as Combobox,
25
+ N as ComboboxInput,
26
+ U as ComboboxOption,
27
+ R as ComboboxOptions,
28
+ L as Listbox,
29
+ M as ListboxOption,
30
+ w as Menu,
31
+ B as MenuItem,
32
+ z as MenuItems,
33
+ F as Popover,
34
+ d as PopoverDialog,
35
+ I as Tab,
36
+ c as TabContainer,
37
+ v as TabList,
38
+ D as TabPanel,
39
+ k as Tooltip,
40
+ i as injectCombobox,
41
+ _ as injectMenu,
42
+ u as injectPopover,
43
+ C as injectTabs,
44
+ a as useFormControl,
45
+ n as useHTMLElement,
46
+ p as useList,
47
+ s as useListOption,
48
+ e as usePopover
1114
49
  };