vue-composable-ui 1.0.6 → 1.0.7

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.
@@ -1,4 +1,4 @@
1
- import { defineComponent as B, mergeModels as H, computed as p, useModel as T, useId as j, watch as N, provide as P, createElementBlock as v, openBlock as r, Fragment as b, createCommentVNode as U, renderSlot as K, createBlock as A, unref as k, renderList as _, nextTick as h } from "vue";
1
+ import { defineComponent as B, mergeModels as H, computed as p, useModel as T, useId as j, watch as K, provide as N, createElementBlock as v, openBlock as r, Fragment as b, createCommentVNode as P, renderSlot as U, createBlock as A, unref as k, renderList as _, nextTick as h } from "vue";
2
2
  import { useHTMLElement as q } from "./composable-ui23.js";
3
3
  import { usePopover as z } from "./composable-ui21.js";
4
4
  import { useList as G } from "./composable-ui22.js";
@@ -19,9 +19,9 @@ const ae = /* @__PURE__ */ B({
19
19
  }),
20
20
  emits: ["update:modelValue"],
21
21
  setup(e) {
22
- const t = e, I = p(() => u.value ? l.value.map((a) => t.formValue(a)) : t.formValue(l.value)), l = T(e, "modelValue"), i = t.id ?? j(), y = t.activatorId ?? i, n = `${i}-popover`, { isOpen: o, toggle: E, open: s, close: c } = z(
22
+ const t = e, I = p(() => u.value ? c.value.map((a) => t.formValue(a)) : t.formValue(c.value)), c = T(e, "modelValue"), i = t.id ?? j(), y = t.activatorId ?? i, l = `${i}-popover`, { isOpen: o, toggle: E, open: n, close: s } = z(
23
23
  `#${y}`,
24
- `#${n}`,
24
+ `#${l}`,
25
25
  {
26
26
  direction: "down",
27
27
  align: "stretch",
@@ -34,35 +34,35 @@ const ae = /* @__PURE__ */ B({
34
34
  activeItem: f,
35
35
  isMultiselectable: u,
36
36
  selectActiveItem: m,
37
- activateSelectedItem: S,
37
+ activateSelectedItem: O,
38
38
  activateFirstItem: d,
39
39
  activateLastItem: V,
40
- activateNextItem: C,
41
- activatePrevItem: M
42
- } = G(l), g = p(() => t.displayValue(l.value));
43
- N(w, () => {
44
- !f.value && w.value.length && (S({ focus: !1 }), f.value || d({ focus: !1 }));
40
+ activateNextItem: S,
41
+ activatePrevItem: C
42
+ } = G(c), g = p(() => t.displayValue(c.value));
43
+ K(w, () => {
44
+ !f.value && w.value.length && (O({ focus: !1 }), f.value || d({ focus: !1 }));
45
45
  });
46
- function O() {
46
+ function D() {
47
47
  q(`#${y}`).value?.focus();
48
48
  }
49
- function D(a) {
49
+ function M(a) {
50
50
  if (o.value)
51
51
  switch (a.code) {
52
52
  case "Space":
53
- m(), u.value || c({ focus: !0 });
53
+ m(), u.value || s({ focus: !0 });
54
54
  break;
55
55
  case "Enter":
56
- m(), c({ focus: !0 });
56
+ m(), s({ focus: !0 });
57
57
  break;
58
58
  case "Tab":
59
- m(), c({ focus: !0 });
59
+ m(), s({ focus: !0 });
60
60
  return;
61
61
  case "ArrowUp":
62
- M({ focus: !1, loop: !1 });
62
+ C({ focus: !1, loop: !1 });
63
63
  break;
64
64
  case "ArrowDown":
65
- C({ focus: !1, loop: !1 });
65
+ S({ focus: !1, loop: !1 });
66
66
  break;
67
67
  case "Home":
68
68
  d({ focus: !1 });
@@ -71,7 +71,7 @@ const ae = /* @__PURE__ */ B({
71
71
  V({ focus: !1 });
72
72
  break;
73
73
  case "Escape":
74
- c({ focus: !0 });
74
+ s({ focus: !0 });
75
75
  break;
76
76
  default:
77
77
  return;
@@ -80,15 +80,15 @@ const ae = /* @__PURE__ */ B({
80
80
  switch (a.code) {
81
81
  case "Space":
82
82
  case "Enter":
83
- s({ focus: !1 });
83
+ n({ focus: !1 });
84
84
  break;
85
85
  case "End":
86
86
  case "ArrowUp":
87
- s({ focus: !1 }), h(() => V({ focus: !1 }));
87
+ n({ focus: !1 }), h(() => V({ focus: !1 }));
88
88
  break;
89
89
  case "Home":
90
90
  case "ArrowDown":
91
- s({ focus: !1 }), h(() => d({ focus: !1 }));
91
+ n({ focus: !1 }), h(() => d({ focus: !1 }));
92
92
  break;
93
93
  default:
94
94
  return;
@@ -96,24 +96,23 @@ const ae = /* @__PURE__ */ B({
96
96
  a.preventDefault();
97
97
  }
98
98
  const x = p(() => ({
99
- onkeydown: D,
100
- onclick: () => s({ focus: !1 }),
101
99
  id: i,
102
- "aria-controls": o.value ? n : void 0,
100
+ "aria-controls": o.value ? l : void 0,
103
101
  "aria-expanded": o.value,
104
102
  "aria-activedescendant": f.value?.element.value?.id,
105
103
  "aria-haspopup": "listbox",
106
104
  role: "combobox"
107
105
  }));
108
- return P(J, {
106
+ return N(J, {
109
107
  displayValue: g,
110
- popoverId: n,
108
+ popoverId: l,
111
109
  isOpen: o,
112
- open: s,
113
- close: c,
114
- focus: O,
110
+ open: n,
111
+ close: s,
112
+ focus: D,
115
113
  isMultiselectable: u,
116
- activatorAttrs: x
114
+ activatorAttrs: x,
115
+ activatorOnKeyDown: M
117
116
  }), (a, Q) => (r(), v(b, null, [
118
117
  e.name ? (r(), v(b, { key: 0 }, [
119
118
  k(u) ? (r(!0), v(b, { key: 0 }, _(I.value, (F, L) => (r(), A($, {
@@ -124,9 +123,9 @@ const ae = /* @__PURE__ */ B({
124
123
  name: e.name,
125
124
  value: I.value
126
125
  }, null, 8, ["name", "value"]))
127
- ], 64)) : U("", !0),
128
- K(a.$slots, "default", {
129
- popoverId: n,
126
+ ], 64)) : P("", !0),
127
+ U(a.$slots, "default", {
128
+ popoverId: l,
130
129
  isOpen: k(o),
131
130
  toggle: () => k(E)(),
132
131
  displayValue: g.value,
@@ -0,0 +1,34 @@
1
+ import { defineComponent as r, inject as a, useModel as m, watch as p, withDirectives as d, createElementBlock as s, openBlock as f, mergeProps as v, unref as n, vModelDynamic as c } from "vue";
2
+ import { injectCombobox as b } from "./composable-ui24.js";
3
+ const y = /* @__PURE__ */ r({
4
+ __name: "comboboxInput",
5
+ props: {
6
+ modelValue: {},
7
+ modelModifiers: {}
8
+ },
9
+ emits: ["update:modelValue"],
10
+ setup(i) {
11
+ const e = a(b);
12
+ if (!e)
13
+ throw new Error("Combobox injectable context is not provided");
14
+ const l = m(i, "modelValue");
15
+ function u() {
16
+ l.value = e.displayValue.value;
17
+ }
18
+ return p(e.displayValue, u, { immediate: !0 }), (w, o) => d((f(), s("input", v({
19
+ "onUpdate:modelValue": o[0] || (o[0] = (t) => l.value = t)
20
+ }, n(e).activatorAttrs, {
21
+ onClick: o[1] || (o[1] = (t) => n(e).open({ focus: !1 })),
22
+ onKeydown: o[2] || (o[2] = //@ts-ignore
23
+ (...t) => n(e).activatorOnKeyDown && n(e).activatorOnKeyDown(...t)),
24
+ onInput: o[3] || (o[3] = (t) => n(e).open({ focus: !0 })),
25
+ onChange: u,
26
+ autocomplete: "off"
27
+ }), null, 16)), [
28
+ [c, l.value]
29
+ ]);
30
+ }
31
+ });
32
+ export {
33
+ y as _
34
+ };
@@ -16,8 +16,8 @@ import { _ as k } from "./tooltip.vue_vue_type_script_setup_true_lang-D4uAZmQb.j
16
16
  import { _ as w } from "./menu.vue_vue_type_script_setup_true_lang-Ci7q2rOg.js";
17
17
  import { _ as z } from "./menuItems.vue_vue_type_script_setup_true_lang-p9vftREy.js";
18
18
  import { _ as B } from "./menuItem.vue_vue_type_script_setup_true_lang-ezPw3j-i.js";
19
- import { _ as J } from "./combobox.vue_vue_type_script_setup_true_lang-BhfoMt6j.js";
20
- import { _ as N } from "./comboboxInput.vue_vue_type_script_setup_true_lang-DzRfJ5ke.js";
19
+ import { _ as J } from "./combobox.vue_vue_type_script_setup_true_lang-8JadictW.js";
20
+ import { _ as N } from "./comboboxInput.vue_vue_type_script_setup_true_lang-Cjl65Eoo.js";
21
21
  import { _ as R } from "./comboboxOptions.vue_vue_type_script_setup_true_lang-Doy6MfEQ.js";
22
22
  import { _ as U } from "./comboboxOption.vue_vue_type_script_setup_true_lang-DPEArk3M.js";
23
23
  export {
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./comboboxInput.vue_vue_type_script_setup_true_lang-DzRfJ5ke.js";
1
+ import { _ as f } from "./comboboxInput.vue_vue_type_script_setup_true_lang-Cjl65Eoo.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./combobox.vue_vue_type_script_setup_true_lang-BhfoMt6j.js";
1
+ import { _ as f } from "./combobox.vue_vue_type_script_setup_true_lang-8JadictW.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -5,7 +5,6 @@ type __VLS_Props = {
5
5
  name?: string;
6
6
  formValue?: (item: any) => Record<string, string> | string;
7
7
  };
8
- declare function onKeyDown(evt: KeyboardEvent): void;
9
8
  type __VLS_PublicProps = __VLS_Props & {
10
9
  modelValue?: any;
11
10
  };
@@ -15,8 +14,6 @@ declare var __VLS_9: {
15
14
  toggle: () => void;
16
15
  displayValue: ((value: any) => string) & string;
17
16
  attrs: {
18
- onkeydown: typeof onKeyDown;
19
- onclick: () => void;
20
17
  id: string;
21
18
  "aria-controls": string | undefined;
22
19
  "aria-expanded": boolean;
@@ -40,4 +40,5 @@ export declare const injectCombobox: InjectionKey<{
40
40
  isMultiselectable: UseListReturn["isMultiselectable"];
41
41
  focus: () => void;
42
42
  activatorAttrs: ComputedRef<Record<string, any>>;
43
+ activatorOnKeyDown: (e: KeyboardEvent) => void;
43
44
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-composable-ui",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,33 +0,0 @@
1
- import { defineComponent as i, inject as m, useModel as r, watch as c, computed as p, withDirectives as d, createElementBlock as s, openBlock as f, mergeProps as v, vModelDynamic as b } from "vue";
2
- import { injectCombobox as x } from "./composable-ui24.js";
3
- const h = /* @__PURE__ */ i({
4
- __name: "comboboxInput",
5
- props: {
6
- modelValue: {},
7
- modelModifiers: {}
8
- },
9
- emits: ["update:modelValue"],
10
- setup(l) {
11
- const e = m(x);
12
- if (!e)
13
- throw new Error("Combobox injectable context is not provided");
14
- const o = r(l, "modelValue");
15
- function t() {
16
- o.value = e.displayValue.value;
17
- }
18
- c(e.displayValue, t, { immediate: !0 });
19
- const u = p(() => ({
20
- oninput: () => e.open({ focus: !0 }),
21
- onchange: t,
22
- ...e.activatorAttrs.value
23
- }));
24
- return (V, n) => d((f(), s("input", v({
25
- "onUpdate:modelValue": n[0] || (n[0] = (a) => o.value = a)
26
- }, u.value, { autocomplete: "off" }), null, 16)), [
27
- [b, o.value]
28
- ]);
29
- }
30
- });
31
- export {
32
- h as _
33
- };