vue-composable-ui 1.1.5 → 1.3.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.
Files changed (40) hide show
  1. package/dist/combobox.vue_vue_type_script_setup_true_lang-CFyb8irG.js +144 -0
  2. package/dist/comboboxOptions.vue_vue_type_script_setup_true_lang-DZuDsRZX.js +21 -0
  3. package/dist/composable-ui.js +27 -27
  4. package/dist/composable-ui11.js +1 -1
  5. package/dist/composable-ui12.js +1 -1
  6. package/dist/composable-ui13.js +1 -1
  7. package/dist/composable-ui15.js +1 -1
  8. package/dist/composable-ui18.js +1 -1
  9. package/dist/composable-ui2.js +1 -1
  10. package/dist/composable-ui20.js +17 -18
  11. package/dist/composable-ui22.js +117 -105
  12. package/dist/composable-ui23.js +71 -82
  13. package/dist/composable-ui24.js +7 -4
  14. package/dist/composable-ui6.js +1 -1
  15. package/dist/composable-ui9.js +1 -1
  16. package/dist/menu.vue_vue_type_script_setup_true_lang-CXMH_Siw.js +82 -0
  17. package/dist/{menuItems.vue_vue_type_script_setup_true_lang-DQV-lU_A.js → menuItems.vue_vue_type_script_setup_true_lang-C7feROa2.js} +10 -9
  18. package/dist/popover.vue_vue_type_script_setup_true_lang-2uGxM2x-.js +64 -0
  19. package/dist/popoverDialog.vue_vue_type_script_setup_true_lang-C_cJy27S.js +23 -0
  20. package/dist/tabContainer.vue_vue_type_script_setup_true_lang-B65gXNdp.js +42 -0
  21. package/dist/tooltip.vue_vue_type_script_setup_true_lang-DX78jdaW.js +81 -0
  22. package/dist/types/components/combobox/combobox.vue.d.ts +9 -1
  23. package/dist/types/components/injectionKeys.d.ts +20 -2
  24. package/dist/types/components/menu/menu.vue.d.ts +2 -0
  25. package/dist/types/components/popover/popover.vue.d.ts +21 -7
  26. package/dist/types/components/tooltip.vue.d.ts +2 -2
  27. package/dist/types/composables/formControl.d.ts +3 -4
  28. package/dist/types/composables/list.d.ts +8 -4
  29. package/dist/types/composables/listOption.d.ts +3 -4
  30. package/dist/types/composables/popover.d.ts +19 -11
  31. package/dist/types/main.d.ts +2 -2
  32. package/dist/types/utils/element.d.ts +10 -3
  33. package/package.json +1 -1
  34. package/dist/combobox.vue_vue_type_script_setup_true_lang-sMngTuXu.js +0 -139
  35. package/dist/comboboxOptions.vue_vue_type_script_setup_true_lang-DN0tz5dv.js +0 -20
  36. package/dist/menu.vue_vue_type_script_setup_true_lang-B0Jm9v_v.js +0 -82
  37. package/dist/popover.vue_vue_type_script_setup_true_lang-D1gc6B-4.js +0 -50
  38. package/dist/popoverDialog.vue_vue_type_script_setup_true_lang-ApsJsSDN.js +0 -30
  39. package/dist/tabContainer.vue_vue_type_script_setup_true_lang-yqy32Zx5.js +0 -40
  40. package/dist/tooltip.vue_vue_type_script_setup_true_lang-kslDnoRH.js +0 -85
@@ -1,3 +1,4 @@
1
+ import { type ComponentPublicInstance } from "vue";
1
2
  type __VLS_Props = {
2
3
  id?: string;
3
4
  activatorId?: string;
@@ -6,30 +7,43 @@ type __VLS_Props = {
6
7
  position?: "fixed" | "absolute";
7
8
  closeOnOutsideClick?: boolean;
8
9
  closeOnInsideClick?: boolean;
9
- role?: "dialog" | "listbox" | "menu" | "tree" | "grid";
10
+ role?: "dialog" | "listbox" | "menu" | "tree" | "grid" | "none";
10
11
  };
12
+ type __VLS_ModelProps = {
13
+ /**
14
+ * Optional two-way binding on the open state, for closing the popover from
15
+ * outside the slot scope - on a route change, say.
16
+ */
17
+ "open"?: boolean;
18
+ };
19
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
11
20
  declare var __VLS_1: {
12
21
  attrs: {
22
+ ref: import("vue").ShallowRef<HTMLElement | ComponentPublicInstance | null, HTMLElement | ComponentPublicInstance | null>;
13
23
  id: string;
14
24
  "aria-controls": string | undefined;
15
- "aria-haspopup": "dialog" | "menu" | "listbox" | "tree" | "grid";
25
+ "aria-haspopup": "dialog" | "listbox" | "menu" | "tree" | "grid" | undefined;
16
26
  "aria-expanded": boolean;
17
27
  };
18
28
  isOpen: boolean;
19
- toggle: () => void;
20
- open: () => void;
21
- close: () => void;
29
+ toggle: (options?: import("../../main").PopoverFocusOptions) => void;
30
+ open: (options?: import("../../main").PopoverFocusOptions) => void;
31
+ close: (options?: import("../../main").PopoverFocusOptions) => void;
22
32
  };
23
33
  type __VLS_Slots = {} & {
24
34
  default?: (props: typeof __VLS_1) => any;
25
35
  };
26
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
27
- role: "dialog" | "listbox" | "menu" | "tree" | "grid";
36
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
37
+ "update:open": (value: boolean | undefined) => any;
38
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
39
+ "onUpdate:open"?: ((value: boolean | undefined) => any) | undefined;
40
+ }>, {
28
41
  direction: "up" | "down" | "left" | "right";
29
42
  align: "top" | "bottom" | "left" | "right" | "center" | "stretch";
30
43
  position: "fixed" | "absolute";
31
44
  closeOnOutsideClick: boolean;
32
45
  closeOnInsideClick: boolean;
46
+ role: "dialog" | "listbox" | "menu" | "tree" | "grid" | "none";
33
47
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
34
48
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
35
49
  declare const _default: typeof __VLS_export;
@@ -1,3 +1,4 @@
1
+ import { type ComponentPublicInstance } from "vue";
1
2
  type __VLS_Props = {
2
3
  id?: string;
3
4
  text?: string;
@@ -6,15 +7,14 @@ type __VLS_Props = {
6
7
  };
7
8
  declare function open(): void;
8
9
  declare function close(): void;
9
- declare function onKeyDown(evt: KeyboardEvent): void;
10
10
  declare var __VLS_1: {
11
11
  attrs: {
12
+ ref: import("vue").ShallowRef<HTMLElement | ComponentPublicInstance | null, HTMLElement | ComponentPublicInstance | null>;
12
13
  "aria-describedby": string;
13
14
  onmouseenter: typeof open;
14
15
  onmouseleave: typeof close;
15
16
  onfocus: typeof open;
16
17
  onblur: typeof close;
17
- onkeydown: typeof onKeyDown;
18
18
  };
19
19
  }, __VLS_9: {};
20
20
  type __VLS_Slots = {} & {
@@ -1,5 +1,4 @@
1
- import type { MaybeRef, Ref } from "vue";
2
- import type { TemplateRefOrSelector } from "../utils/element";
1
+ import type { MaybeRef, Ref, TemplateRef } from "vue";
3
2
  type FormElement = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;
4
3
  /**
5
4
  * A validating function must return `true` or a string describing the error
@@ -38,11 +37,11 @@ export interface useFormControlReturn {
38
37
  /**
39
38
  * Utilizes Constraint Validation API to enable custom validation constrains for a form control
40
39
  *
41
- * @param el A template ref or a CSS selector
40
+ * @param el A template ref pointing at the form control
42
41
  * @param validators An array of validating functions
43
42
  * @param showValidationError Whether to show the default browser validation error (true by default)
44
43
  *
45
44
  * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation}
46
45
  */
47
- export declare function useFormControl(el: TemplateRefOrSelector<FormElement>, validators?: MaybeRef<FormValidator[]>, showValidationError?: MaybeRef<boolean>): useFormControlReturn;
46
+ export declare function useFormControl(el: TemplateRef<FormElement>, validators?: MaybeRef<FormValidator[]>, showValidationError?: MaybeRef<boolean>): useFormControlReturn;
48
47
  export {};
@@ -1,9 +1,9 @@
1
- import type { ComputedRef, MaybeRef, Ref, ShallowRef, InjectionKey } from "vue";
2
- import { TemplateRefOrSelector } from "../utils/element";
1
+ import type { ComponentPublicInstance, ComputedRef, MaybeRef, Ref, ShallowRef, InjectionKey, TemplateRef } from "vue";
3
2
  export type ItemValue = unknown;
4
3
  export interface Item {
5
4
  id: number;
6
- element: Ref<HTMLElement | null>;
5
+ /** The registered element, resolved from the template ref it was added with. */
6
+ element: ComputedRef<HTMLElement | null>;
7
7
  value: ItemValue;
8
8
  disabled: MaybeRef<boolean>;
9
9
  }
@@ -36,6 +36,10 @@ export interface UseListReturn {
36
36
  * Currently active item
37
37
  */
38
38
  activeItem: ComputedRef<Item | undefined>;
39
+ /**
40
+ * The first selected item, of which a multiselectable list may have several
41
+ */
42
+ selectedItem: ComputedRef<Item | undefined>;
39
43
  /**
40
44
  * Select the currently active item
41
45
  */
@@ -91,7 +95,7 @@ interface UseListInjectionKey {
91
95
  *
92
96
  * @returns New item ID
93
97
  */
94
- addItem: (itemEl: TemplateRefOrSelector, itemVal: ItemValue, disabled?: MaybeRef<boolean>) => number;
98
+ addItem: (itemEl: TemplateRef<HTMLElement | ComponentPublicInstance>, itemVal: ItemValue, disabled?: MaybeRef<boolean>) => number;
95
99
  /**
96
100
  * Remove an item from the list by ID
97
101
  */
@@ -1,5 +1,4 @@
1
- import type { ComputedRef, MaybeRef } from "vue";
2
- import type { TemplateRefOrSelector } from "../utils/element";
1
+ import type { ComponentPublicInstance, ComputedRef, MaybeRef, TemplateRef } from "vue";
3
2
  import type { ItemValue, ActivationOptions } from "./list";
4
3
  interface UseListOptionReturn {
5
4
  /**
@@ -26,9 +25,9 @@ interface UseListOptionReturn {
26
25
  /**
27
26
  * Registers an HTML element and an associated value in the list created in the parent component
28
27
  *
29
- * @param el A template ref or a CSS selector
28
+ * @param el A template ref pointing at the element to register
30
29
  * @param value A value of any type
31
30
  * @param disabled Whether the item is disabled (false by default)
32
31
  */
33
- export declare function useListOption(el: TemplateRefOrSelector, value: ItemValue, disabled?: MaybeRef<boolean>): UseListOptionReturn;
32
+ export declare function useListOption(el: TemplateRef<HTMLElement | ComponentPublicInstance>, value: ItemValue, disabled?: MaybeRef<boolean>): UseListOptionReturn;
34
33
  export {};
@@ -1,5 +1,4 @@
1
- import type { Ref } from "vue";
2
- import { TemplateRefOrSelector } from "../utils/element";
1
+ import type { ComponentPublicInstance, Ref, TemplateRef } from "vue";
3
2
  interface UsePopoverOptions {
4
3
  /**
5
4
  * The direction of the popover dialog
@@ -32,11 +31,20 @@ interface UsePopoverOptions {
32
31
  */
33
32
  closeOnInsideClick?: boolean;
34
33
  }
35
- interface FocusOptions {
34
+ /**
35
+ * Focus behaviour of an individual open/close/toggle call.
36
+ *
37
+ * Named to avoid shadowing the DOM's global `FocusOptions`.
38
+ */
39
+ export interface PopoverFocusOptions {
36
40
  /**
37
- * Focus the popover/activator
41
+ * Focus the popover on open, or return focus to the activator on close.
38
42
  *
39
- * @defaultValue `true`
43
+ * Closing defaults to returning focus only when the popover currently holds
44
+ * it: a popover dismissed by Escape must hand focus back, but one dismissed
45
+ * by the pointer leaving it must not pull focus across the page.
46
+ *
47
+ * @defaultValue `true` on open, focus containment on close
40
48
  */
41
49
  focus?: boolean;
42
50
  }
@@ -48,21 +56,21 @@ export interface UsePopoverReturn {
48
56
  /**
49
57
  * Open the popover
50
58
  */
51
- open: (options?: FocusOptions) => void;
59
+ open: (options?: PopoverFocusOptions) => void;
52
60
  /**
53
61
  * Close the popover
54
62
  */
55
- close: (options?: FocusOptions) => void;
63
+ close: (options?: PopoverFocusOptions) => void;
56
64
  /**
57
65
  * Toggle the popover
58
66
  */
59
- toggle: (options?: FocusOptions) => void;
67
+ toggle: (options?: PopoverFocusOptions) => void;
60
68
  }
61
69
  /**
62
70
  *
63
- * @param activatorEl A template ref or a CSS selector
64
- * @param popupEl A template ref or a CSS selector
71
+ * @param activatorEl A template ref pointing at the activator element
72
+ * @param popupEl A template ref pointing at the popover element
65
73
  * @param options Popover options
66
74
  */
67
- export declare function usePopover(activatorEl: TemplateRefOrSelector, popupEl: TemplateRefOrSelector, { direction, align, position, closeOnOutsideClick, closeOnInsideClick, }?: UsePopoverOptions): UsePopoverReturn;
75
+ export declare function usePopover(activatorEl: TemplateRef<HTMLElement | ComponentPublicInstance>, popupEl: TemplateRef<HTMLElement | ComponentPublicInstance>, { direction, align, position, closeOnOutsideClick, closeOnInsideClick, }?: UsePopoverOptions): UsePopoverReturn;
68
76
  export {};
@@ -1,8 +1,8 @@
1
- export { usePopover } from "./composables/popover";
1
+ export { usePopover, type PopoverFocusOptions } from "./composables/popover";
2
2
  export { useList } from "./composables/list";
3
3
  export { useListOption } from "./composables/listOption";
4
4
  export { useFormControl } from "./composables/formControl";
5
- export { useHTMLElement } from "./utils/element";
5
+ export { toElement } from "./utils/element";
6
6
  export { useValidation, type Validator } from "./utils/validation";
7
7
  export * from "./components/injectionKeys";
8
8
  export { default as Listbox } from "./components/listbox/listbox.vue";
@@ -1,3 +1,10 @@
1
- import type { Ref } from "vue";
2
- export type TemplateRefOrSelector<E extends HTMLElement = HTMLElement> = Ref<E | null> | E | string;
3
- export declare function useHTMLElement<E extends HTMLElement = HTMLElement>(el: TemplateRefOrSelector<E>): Ref<E | null, E | null> | ([E | null] extends [Ref<any, any>] ? import("@vue/shared").IfAny<Ref<any, any> & E, Ref<Ref<any, any> & E, Ref<any, any> & E>, Ref<any, any> & E> : Ref<import("vue").UnwrapRef<E> | null, E | import("vue").UnwrapRef<E> | null>);
1
+ import type { ComponentPublicInstance, TemplateRef } from "vue";
2
+ /**
3
+ * Resolve a template ref to its element, or `null` when there is none yet.
4
+ *
5
+ * `unref` stops one step short: a ref placed on a component holds the
6
+ * instance, not an element, so single-root components are unwrapped through
7
+ * `$el` — that is what lets an activator be a `<Btn v-bind="attrs">` as
8
+ * readily as a `<button>`.
9
+ */
10
+ export declare function toElement<E extends HTMLElement = HTMLElement>(el: TemplateRef<E | ComponentPublicInstance>): E | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-composable-ui",
3
- "version": "1.1.5",
3
+ "version": "1.3.0",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,139 +0,0 @@
1
- import { defineComponent as B, computed as p, useModel as H, useId as T, watch as j, provide as K, openBlock as r, createElementBlock as v, Fragment as b, unref as k, renderList as N, createBlock as A, createCommentVNode as P, renderSlot as U, mergeModels as _, nextTick as h } from "vue";
2
- import { useHTMLElement as q } from "./composable-ui24.js";
3
- import { usePopover as z } from "./composable-ui23.js";
4
- import { useList as G } from "./composable-ui22.js";
5
- import { _ as $ } from "./comboboxHiddenInput.vue_vue_type_script_setup_true_lang-BtODyQnH.js";
6
- import { injectCombobox as J } from "./composable-ui19.js";
7
- const ae = /* @__PURE__ */ B({
8
- inheritAttrs: !1,
9
- __name: "combobox",
10
- props: /* @__PURE__ */ _({
11
- displayValue: { type: Function, default: (e) => Array.isArray(e) ? e.map((t) => t.toString()).join(", ") : e?.toString() },
12
- id: {},
13
- activatorId: {},
14
- name: {},
15
- formValue: { type: Function, default: (e) => e }
16
- }, {
17
- modelValue: {},
18
- modelModifiers: {}
19
- }),
20
- emits: ["update:modelValue"],
21
- setup(e) {
22
- const t = e, I = p(() => u.value ? c.value.map((a) => t.formValue(a)) : t.formValue(c.value)), c = H(e, "modelValue"), i = t.id ?? T(), y = t.activatorId ?? i, l = `${i}-popover`, { isOpen: o, toggle: E, open: n, close: s } = z(
23
- `#${y}`,
24
- `#${l}`,
25
- {
26
- direction: "down",
27
- align: "stretch",
28
- position: "fixed",
29
- closeOnOutsideClick: !0,
30
- closeOnInsideClick: !1
31
- }
32
- ), {
33
- items: w,
34
- activeItem: f,
35
- isMultiselectable: u,
36
- selectActiveItem: m,
37
- activateSelectedItem: O,
38
- activateFirstItem: d,
39
- activateLastItem: V,
40
- activateNextItem: S,
41
- activatePrevItem: C
42
- } = G(c), g = p(() => t.displayValue(c.value));
43
- j(w, () => {
44
- !f.value && w.value.length && (O({ focus: !1 }), f.value || d({ focus: !1 }));
45
- });
46
- function D() {
47
- q(`#${y}`).value?.focus();
48
- }
49
- function M(a) {
50
- if (o.value)
51
- switch (a.code) {
52
- case "Space":
53
- m(), u.value || s({ focus: !0 });
54
- break;
55
- case "Enter":
56
- m(), s({ focus: !0 });
57
- break;
58
- case "Tab":
59
- m(), s({ focus: !0 });
60
- return;
61
- case "ArrowUp":
62
- C({ focus: !1, loop: !1 });
63
- break;
64
- case "ArrowDown":
65
- S({ focus: !1, loop: !1 });
66
- break;
67
- case "Home":
68
- d({ focus: !1 });
69
- break;
70
- case "End":
71
- V({ focus: !1 });
72
- break;
73
- case "Escape":
74
- s({ focus: !0 });
75
- break;
76
- default:
77
- return;
78
- }
79
- else
80
- switch (a.code) {
81
- case "Space":
82
- case "Enter":
83
- n({ focus: !1 });
84
- break;
85
- case "End":
86
- case "ArrowUp":
87
- n({ focus: !1 }), h(() => V({ focus: !1 }));
88
- break;
89
- case "Home":
90
- case "ArrowDown":
91
- n({ focus: !1 }), h(() => d({ focus: !1 }));
92
- break;
93
- default:
94
- return;
95
- }
96
- a.preventDefault();
97
- }
98
- const x = p(() => ({
99
- id: i,
100
- "aria-controls": o.value ? l : void 0,
101
- "aria-expanded": o.value,
102
- "aria-activedescendant": f.value?.element.value?.id,
103
- "aria-haspopup": "listbox",
104
- role: "combobox"
105
- }));
106
- return K(J, {
107
- displayValue: g,
108
- popoverId: l,
109
- isOpen: o,
110
- open: n,
111
- close: s,
112
- focus: D,
113
- isMultiselectable: u,
114
- activatorAttrs: x,
115
- activatorOnKeyDown: M
116
- }), (a, Q) => (r(), v(b, null, [
117
- e.name ? (r(), v(b, { key: 0 }, [
118
- k(u) ? (r(!0), v(b, { key: 0 }, N(I.value, (F, L) => (r(), A($, {
119
- name: `${e.name}[${L}]`,
120
- value: F
121
- }, null, 8, ["name", "value"]))), 256)) : (r(), A($, {
122
- key: 1,
123
- name: e.name,
124
- value: I.value
125
- }, null, 8, ["name", "value"]))
126
- ], 64)) : P("", !0),
127
- U(a.$slots, "default", {
128
- popoverId: l,
129
- isOpen: k(o),
130
- toggle: () => k(E)(),
131
- displayValue: g.value,
132
- attrs: x.value
133
- })
134
- ], 64));
135
- }
136
- });
137
- export {
138
- ae as _
139
- };
@@ -1,20 +0,0 @@
1
- import { defineComponent as n, inject as r, unref as e, openBlock as i, createElementBlock as c, renderSlot as m, createCommentVNode as s } from "vue";
2
- import { injectCombobox as p } from "./composable-ui19.js";
3
- const d = ["id"], f = /* @__PURE__ */ n({
4
- __name: "comboboxOptions",
5
- setup(b) {
6
- const o = r(p);
7
- if (!o)
8
- throw new Error("Combobox injectable context is not provided");
9
- return (t, l) => e(o).isOpen.value ? (i(), c("div", {
10
- key: 0,
11
- id: e(o).popoverId,
12
- role: "listbox"
13
- }, [
14
- m(t.$slots, "default")
15
- ], 8, d)) : s("", !0);
16
- }
17
- });
18
- export {
19
- f as _
20
- };
@@ -1,82 +0,0 @@
1
- import { defineComponent as b, useId as u, useModel as M, computed as m, provide as O, renderSlot as A, unref as _, mergeModels as h, nextTick as r } from "vue";
2
- import { usePopover as C } from "./composable-ui23.js";
3
- import { useList as D } from "./composable-ui22.js";
4
- import { injectMenu as V } from "./composable-ui19.js";
5
- const j = /* @__PURE__ */ b({
6
- __name: "menu",
7
- props: /* @__PURE__ */ h({
8
- id: {},
9
- activatorId: {},
10
- direction: { default: "down" },
11
- align: { default: "left" },
12
- position: { default: "fixed" }
13
- }, {
14
- modelValue: {},
15
- modelModifiers: {}
16
- }),
17
- emits: ["update:modelValue"],
18
- setup(s) {
19
- const e = s, a = e.id ?? u(), i = e.activatorId ?? u(), p = M(s, "modelValue"), {
20
- isMultiselectable: v,
21
- activeItem: f,
22
- activateFirstItem: n,
23
- activateLastItem: c,
24
- activateNextItem: I,
25
- activatePrevItem: k
26
- } = D(p), { isOpen: t, toggle: d, open: l, close: w } = C(
27
- `#${i}`,
28
- `#${a}`,
29
- {
30
- direction: e.direction,
31
- align: e.align,
32
- position: e.position,
33
- closeOnOutsideClick: !0,
34
- closeOnInsideClick: !1
35
- }
36
- );
37
- function g(o) {
38
- switch (o.code) {
39
- case "Space":
40
- case "Enter":
41
- d(), t.value && r(n);
42
- break;
43
- case "ArrowUp":
44
- l(), r(c);
45
- break;
46
- case "ArrowDown":
47
- l(), r(n);
48
- break;
49
- default:
50
- return;
51
- }
52
- o.preventDefault();
53
- }
54
- const x = m(() => ({
55
- id: i,
56
- "aria-controls": t.value ? a : void 0,
57
- "aria-haspopup": "menu",
58
- "aria-expanded": t.value,
59
- onclick: () => d(),
60
- onkeydown: g,
61
- tabindex: 0
62
- }));
63
- return O(V, {
64
- menuId: a,
65
- activatorId: i,
66
- isOpen: t,
67
- close: w,
68
- isMultiselectable: v,
69
- activeItemId: m(() => f.value?.element.value?.id),
70
- activateFirstItem: n,
71
- activateLastItem: c,
72
- activateNextItem: I,
73
- activatePrevItem: k
74
- }), (o, $) => A(o.$slots, "default", {
75
- attrs: x.value,
76
- isOpen: _(t)
77
- });
78
- }
79
- });
80
- export {
81
- j as _
82
- };
@@ -1,50 +0,0 @@
1
- import { defineComponent as u, useId as r, computed as f, provide as v, renderSlot as O, unref as t } from "vue";
2
- import { usePopover as m } from "./composable-ui23.js";
3
- import { injectPopover as g } from "./composable-ui19.js";
4
- const x = /* @__PURE__ */ u({
5
- __name: "popover",
6
- props: {
7
- id: {},
8
- activatorId: {},
9
- direction: { default: "down" },
10
- align: { default: "left" },
11
- position: { default: "fixed" },
12
- closeOnOutsideClick: { type: Boolean, default: !0 },
13
- closeOnInsideClick: { type: Boolean, default: !1 },
14
- role: { default: "dialog" }
15
- },
16
- setup(s) {
17
- const e = s, n = e.id ?? r(), i = e.activatorId ?? r(), { isOpen: o, toggle: a, open: d, close: l } = m(
18
- `#${i}`,
19
- `#${n}`,
20
- {
21
- direction: e.direction,
22
- align: e.align,
23
- position: e.position,
24
- closeOnOutsideClick: e.closeOnOutsideClick,
25
- closeOnInsideClick: e.closeOnInsideClick
26
- }
27
- ), c = f(() => ({
28
- id: i,
29
- "aria-controls": o.value ? e.id : void 0,
30
- "aria-haspopup": e.role,
31
- "aria-expanded": o.value
32
- }));
33
- return v(g, {
34
- popoverId: n,
35
- activatorId: i,
36
- role: e.role,
37
- isOpen: o,
38
- close: l
39
- }), (p, I) => O(p.$slots, "default", {
40
- attrs: c.value,
41
- isOpen: t(o),
42
- toggle: () => t(a)(),
43
- open: () => t(d)(),
44
- close: () => t(l)()
45
- });
46
- }
47
- });
48
- export {
49
- x as _
50
- };
@@ -1,30 +0,0 @@
1
- import { defineComponent as n, inject as a, unref as r, openBlock as i, createElementBlock as c, renderSlot as l, createCommentVNode as p } from "vue";
2
- import { injectPopover as d } from "./composable-ui19.js";
3
- const s = ["id", "role", "aria-labelledby"], v = /* @__PURE__ */ n({
4
- __name: "popoverDialog",
5
- setup(u) {
6
- const e = a(d);
7
- if (!e)
8
- throw new Error("Popover injectable context is not provided");
9
- function t(o) {
10
- if (o.code === "Escape")
11
- e.close();
12
- else
13
- return;
14
- o.preventDefault();
15
- }
16
- return (o, f) => r(e).isOpen.value ? (i(), c("div", {
17
- key: 0,
18
- onKeydown: t,
19
- id: r(e).popoverId,
20
- role: r(e).role,
21
- "aria-labelledby": r(e).activatorId,
22
- tabindex: "-1"
23
- }, [
24
- l(o.$slots, "default")
25
- ], 40, s)) : p("", !0);
26
- }
27
- });
28
- export {
29
- v as _
30
- };
@@ -1,40 +0,0 @@
1
- import { defineComponent as c, useModel as u, provide as v, computed as p, openBlock as f, createElementBlock as I, renderSlot as _ } from "vue";
2
- import { useList as b } from "./composable-ui22.js";
3
- import { injectTabs as g } from "./composable-ui19.js";
4
- const x = /* @__PURE__ */ c({
5
- __name: "tabContainer",
6
- props: {
7
- modelValue: {},
8
- modelModifiers: {}
9
- },
10
- emits: ["update:modelValue"],
11
- setup(o) {
12
- const a = u(o, "modelValue"), {
13
- items: i,
14
- selectActiveItem: l,
15
- activateFirstItem: m,
16
- activateLastItem: r,
17
- activateNextItem: n,
18
- activatePrevItem: s
19
- } = b(a);
20
- return v(g, {
21
- getIds: (e) => p(() => {
22
- const t = i.value.find((d) => d.value === e);
23
- return {
24
- tabId: t?.element.value?.getAttribute("id") || void 0,
25
- panelId: t?.element.value?.getAttribute("aria-controls") || void 0
26
- };
27
- }),
28
- selectActiveItem: l,
29
- activateFirstItem: m,
30
- activateLastItem: r,
31
- activateNextItem: n,
32
- activatePrevItem: s
33
- }), (e, t) => (f(), I("div", null, [
34
- _(e.$slots, "default")
35
- ]));
36
- }
37
- });
38
- export {
39
- x as _
40
- };