vue-composable-ui 1.0.6 → 1.1.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 (47) hide show
  1. package/dist/{combobox.vue_vue_type_script_setup_true_lang-BhfoMt6j.js → combobox.vue_vue_type_script_setup_true_lang-ChCbDl0x.js} +35 -36
  2. package/dist/comboboxInput.vue_vue_type_script_setup_true_lang-D3KIXNRO.js +34 -0
  3. package/dist/{comboboxOption.vue_vue_type_script_setup_true_lang-DPEArk3M.js → comboboxOption.vue_vue_type_script_setup_true_lang-C9FIG5ye.js} +2 -2
  4. package/dist/{comboboxOptions.vue_vue_type_script_setup_true_lang-Doy6MfEQ.js → comboboxOptions.vue_vue_type_script_setup_true_lang-DLv4KjF8.js} +1 -1
  5. package/dist/composable-ui.js +45 -43
  6. package/dist/composable-ui10.js +1 -1
  7. package/dist/composable-ui11.js +1 -1
  8. package/dist/composable-ui12.js +1 -1
  9. package/dist/composable-ui13.js +1 -1
  10. package/dist/composable-ui14.js +1 -1
  11. package/dist/composable-ui15.js +1 -1
  12. package/dist/composable-ui16.js +1 -1
  13. package/dist/composable-ui17.js +2 -29
  14. package/dist/composable-ui18.js +29 -2
  15. package/dist/composable-ui19.js +1 -1
  16. package/dist/composable-ui2.js +24 -49
  17. package/dist/composable-ui20.js +1 -1
  18. package/dist/composable-ui21.js +2 -101
  19. package/dist/composable-ui22.js +91 -132
  20. package/dist/composable-ui23.js +141 -4
  21. package/dist/composable-ui24.js +5 -5
  22. package/dist/composable-ui25.js +7 -0
  23. package/dist/composable-ui3.js +53 -2
  24. package/dist/composable-ui4.js +1 -1
  25. package/dist/composable-ui5.js +1 -1
  26. package/dist/composable-ui6.js +1 -1
  27. package/dist/composable-ui7.js +1 -1
  28. package/dist/composable-ui8.js +1 -1
  29. package/dist/composable-ui9.js +1 -1
  30. package/dist/{listbox.vue_vue_type_script_setup_true_lang-CP8lV3wp.js → listbox.vue_vue_type_script_setup_true_lang-BJS1g6K9.js} +1 -1
  31. package/dist/{listboxOption.vue_vue_type_script_setup_true_lang-C1-Q-dSr.js → listboxOption.vue_vue_type_script_setup_true_lang-DMkQ_ZA_.js} +1 -1
  32. package/dist/{menu.vue_vue_type_script_setup_true_lang-Ci7q2rOg.js → menu.vue_vue_type_script_setup_true_lang-BTGGj0FY.js} +3 -3
  33. package/dist/{menuItem.vue_vue_type_script_setup_true_lang-ezPw3j-i.js → menuItem.vue_vue_type_script_setup_true_lang-CSWsvc1p.js} +2 -2
  34. package/dist/{menuItems.vue_vue_type_script_setup_true_lang-p9vftREy.js → menuItems.vue_vue_type_script_setup_true_lang-DZL1uyoq.js} +1 -1
  35. package/dist/{popover.vue_vue_type_script_setup_true_lang-DhKF7_nY.js → popover.vue_vue_type_script_setup_true_lang-C13ARHho.js} +2 -2
  36. package/dist/{popoverDialog.vue_vue_type_script_setup_true_lang-CDXUO7wZ.js → popoverDialog.vue_vue_type_script_setup_true_lang-C2z6To-6.js} +1 -1
  37. package/dist/{tab.vue_vue_type_script_setup_true_lang-Y5OFGqMB.js → tab.vue_vue_type_script_setup_true_lang-BSckMUwj.js} +1 -1
  38. package/dist/{tabContainer.vue_vue_type_script_setup_true_lang-fPpLno2Z.js → tabContainer.vue_vue_type_script_setup_true_lang-YfrBXoWm.js} +2 -2
  39. package/dist/{tabList.vue_vue_type_script_setup_true_lang-CZyqGCuj.js → tabList.vue_vue_type_script_setup_true_lang-DLoNOwJ7.js} +1 -1
  40. package/dist/{tabPanel.vue_vue_type_script_setup_true_lang-CGhP6SHR.js → tabPanel.vue_vue_type_script_setup_true_lang-DZfMk_Sn.js} +2 -2
  41. package/dist/{tooltip.vue_vue_type_script_setup_true_lang-D4uAZmQb.js → tooltip.vue_vue_type_script_setup_true_lang-CXxwHtxF.js} +1 -1
  42. package/dist/types/components/combobox/combobox.vue.d.ts +0 -3
  43. package/dist/types/components/injectionKeys.d.ts +1 -0
  44. package/dist/types/main.d.ts +1 -0
  45. package/dist/types/utils/validation.d.ts +25 -0
  46. package/package.json +1 -1
  47. package/dist/comboboxInput.vue_vue_type_script_setup_true_lang-DzRfJ5ke.js +0 -33
@@ -1,9 +1,9 @@
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";
2
- import { useHTMLElement as q } from "./composable-ui23.js";
3
- import { usePopover as z } from "./composable-ui21.js";
4
- import { useList as G } from "./composable-ui22.js";
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
+ import { useHTMLElement as q } from "./composable-ui24.js";
3
+ import { usePopover as z } from "./composable-ui22.js";
4
+ import { useList as G } from "./composable-ui23.js";
5
5
  import { _ as $ } from "./comboboxHiddenInput.vue_vue_type_script_setup_true_lang-Ba-UPd-M.js";
6
- import { injectCombobox as J } from "./composable-ui24.js";
6
+ import { injectCombobox as J } from "./composable-ui25.js";
7
7
  const ae = /* @__PURE__ */ B({
8
8
  inheritAttrs: !1,
9
9
  __name: "combobox",
@@ -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-ui25.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
+ };
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as f, useId as b, useTemplateRef as p, inject as v, createElementBlock as x, openBlock as E, unref as e, renderSlot as _ } from "vue";
2
- import { useListOption as k } from "./composable-ui17.js";
3
- import { injectCombobox as C } from "./composable-ui24.js";
2
+ import { useListOption as k } from "./composable-ui18.js";
3
+ import { injectCombobox as C } from "./composable-ui25.js";
4
4
  const j = ["id", "data-active", "aria-selected", "aria-disabled"], A = /* @__PURE__ */ f({
5
5
  __name: "comboboxOption",
6
6
  props: {
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as n, inject as r, createElementBlock as i, createCommentVNode as c, unref as e, openBlock as m, renderSlot as s } from "vue";
2
- import { injectCombobox as p } from "./composable-ui24.js";
2
+ import { injectCombobox as p } from "./composable-ui25.js";
3
3
  const d = ["id"], f = /* @__PURE__ */ n({
4
4
  __name: "comboboxOptions",
5
5
  setup(b) {
@@ -1,49 +1,51 @@
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-CP8lV3wp.js";
8
- import { _ as M } from "./listboxOption.vue_vue_type_script_setup_true_lang-C1-Q-dSr.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-D4uAZmQb.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-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";
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-DPEArk3M.js";
1
+ import { usePopover as e } from "./composable-ui22.js";
2
+ import { useList as p } from "./composable-ui23.js";
3
+ import { useListOption as s } from "./composable-ui18.js";
4
+ import { useFormControl as a } from "./composable-ui3.js";
5
+ import { useHTMLElement as n } from "./composable-ui24.js";
6
+ import { useValidation as b } from "./composable-ui2.js";
7
+ import { injectCombobox as u, injectMenu as C, injectPopover as T, injectTabs as l } from "./composable-ui25.js";
8
+ import { _ as M } from "./listbox.vue_vue_type_script_setup_true_lang-BJS1g6K9.js";
9
+ import { _ as c } from "./listboxOption.vue_vue_type_script_setup_true_lang-DMkQ_ZA_.js";
10
+ import { _ as v } from "./tabContainer.vue_vue_type_script_setup_true_lang-YfrBXoWm.js";
11
+ import { _ as I } from "./tabList.vue_vue_type_script_setup_true_lang-DLoNOwJ7.js";
12
+ import { _ as g } from "./tab.vue_vue_type_script_setup_true_lang-BSckMUwj.js";
13
+ import { _ as E } from "./tabPanel.vue_vue_type_script_setup_true_lang-DZfMk_Sn.js";
14
+ import { _ as H } from "./popover.vue_vue_type_script_setup_true_lang-C13ARHho.js";
15
+ import { _ as h } from "./popoverDialog.vue_vue_type_script_setup_true_lang-C2z6To-6.js";
16
+ import { _ as q } from "./tooltip.vue_vue_type_script_setup_true_lang-CXxwHtxF.js";
17
+ import { _ as y } from "./menu.vue_vue_type_script_setup_true_lang-BTGGj0FY.js";
18
+ import { _ as A } from "./menuItems.vue_vue_type_script_setup_true_lang-DZL1uyoq.js";
19
+ import { _ as G } from "./menuItem.vue_vue_type_script_setup_true_lang-CSWsvc1p.js";
20
+ import { _ as K } from "./combobox.vue_vue_type_script_setup_true_lang-ChCbDl0x.js";
21
+ import { _ as Q } from "./comboboxInput.vue_vue_type_script_setup_true_lang-D3KIXNRO.js";
22
+ import { _ as S } from "./comboboxOptions.vue_vue_type_script_setup_true_lang-DLv4KjF8.js";
23
+ import { _ as W } from "./comboboxOption.vue_vue_type_script_setup_true_lang-C9FIG5ye.js";
23
24
  export {
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,
25
+ K as Combobox,
26
+ Q as ComboboxInput,
27
+ W as ComboboxOption,
28
+ S as ComboboxOptions,
29
+ M as Listbox,
30
+ c as ListboxOption,
31
+ y as Menu,
32
+ G as MenuItem,
33
+ A as MenuItems,
34
+ H as Popover,
35
+ h as PopoverDialog,
36
+ g as Tab,
37
+ v as TabContainer,
38
+ I as TabList,
39
+ E as TabPanel,
40
+ q as Tooltip,
41
+ u as injectCombobox,
42
+ C as injectMenu,
43
+ T as injectPopover,
44
+ l as injectTabs,
44
45
  a as useFormControl,
45
46
  n as useHTMLElement,
46
47
  p as useList,
47
48
  s as useListOption,
48
- e as usePopover
49
+ e as usePopover,
50
+ b as useValidation
49
51
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./menuItems.vue_vue_type_script_setup_true_lang-p9vftREy.js";
1
+ import { _ as f } from "./popover.vue_vue_type_script_setup_true_lang-C13ARHho.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./menuItem.vue_vue_type_script_setup_true_lang-ezPw3j-i.js";
1
+ import { _ as f } from "./menuItems.vue_vue_type_script_setup_true_lang-DZL1uyoq.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./menu.vue_vue_type_script_setup_true_lang-Ci7q2rOg.js";
1
+ import { _ as f } from "./menuItem.vue_vue_type_script_setup_true_lang-CSWsvc1p.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./listboxOption.vue_vue_type_script_setup_true_lang-C1-Q-dSr.js";
1
+ import { _ as f } from "./menu.vue_vue_type_script_setup_true_lang-BTGGj0FY.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./listbox.vue_vue_type_script_setup_true_lang-CP8lV3wp.js";
1
+ import { _ as f } from "./listboxOption.vue_vue_type_script_setup_true_lang-DMkQ_ZA_.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./comboboxOptions.vue_vue_type_script_setup_true_lang-Doy6MfEQ.js";
1
+ import { _ as f } from "./listbox.vue_vue_type_script_setup_true_lang-BJS1g6K9.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./comboboxOption.vue_vue_type_script_setup_true_lang-DPEArk3M.js";
1
+ import { _ as f } from "./comboboxOptions.vue_vue_type_script_setup_true_lang-DLv4KjF8.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,31 +1,4 @@
1
- import { inject as l, ref as d, computed as n, onMounted as f, onUnmounted as p, unref as I } from "vue";
2
- import { injectList as j } from "./composable-ui22.js";
3
- function S(c, o, i) {
4
- const e = l(j);
5
- if (!e)
6
- throw new Error("List injectable context is not provided");
7
- const t = d(-1), r = n(() => e.isSelected(t.value)), u = n(() => e.isActive(t.value));
8
- function s() {
9
- e.selectItem(t.value);
10
- }
11
- function a({ focus: m = !0 } = {}) {
12
- I(i) || e.activateItem(t.value, { focus: m });
13
- }
14
- function v() {
15
- e.deactivateItem();
16
- }
17
- return f(() => {
18
- t.value = e.addItem(c, o, i);
19
- }), p(() => {
20
- e.removeItem(t.value);
21
- }), {
22
- isSelected: r,
23
- isActive: u,
24
- select: s,
25
- activate: a,
26
- deactivate: v
27
- };
28
- }
1
+ import { _ as f } from "./comboboxOption.vue_vue_type_script_setup_true_lang-C9FIG5ye.js";
29
2
  export {
30
- S as useListOption
3
+ f as default
31
4
  };
@@ -1,4 +1,31 @@
1
- import { _ as f } from "./comboboxInput.vue_vue_type_script_setup_true_lang-DzRfJ5ke.js";
1
+ import { inject as l, ref as d, computed as n, onMounted as f, onUnmounted as p, unref as I } from "vue";
2
+ import { injectList as j } from "./composable-ui23.js";
3
+ function S(c, o, i) {
4
+ const e = l(j);
5
+ if (!e)
6
+ throw new Error("List injectable context is not provided");
7
+ const t = d(-1), r = n(() => e.isSelected(t.value)), u = n(() => e.isActive(t.value));
8
+ function s() {
9
+ e.selectItem(t.value);
10
+ }
11
+ function a({ focus: m = !0 } = {}) {
12
+ I(i) || e.activateItem(t.value, { focus: m });
13
+ }
14
+ function v() {
15
+ e.deactivateItem();
16
+ }
17
+ return f(() => {
18
+ t.value = e.addItem(c, o, i);
19
+ }), p(() => {
20
+ e.removeItem(t.value);
21
+ }), {
22
+ isSelected: r,
23
+ isActive: u,
24
+ select: s,
25
+ activate: a,
26
+ deactivate: v
27
+ };
28
+ }
2
29
  export {
3
- f as default
30
+ S as useListOption
4
31
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./comboboxHiddenInput.vue_vue_type_script_setup_true_lang-Ba-UPd-M.js";
1
+ import { _ as f } from "./comboboxInput.vue_vue_type_script_setup_true_lang-D3KIXNRO.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,55 +1,30 @@
1
- import { ref as t, onMounted as V, onBeforeUnmount as M, readonly as m, unref as g } from "vue";
2
- import { useHTMLElement as b } from "./composable-ui23.js";
3
- function k(y, h = [], w = !0) {
4
- const a = t(!1), n = t(!0), l = t(), r = t("");
5
- let e, u;
6
- function s() {
7
- e?.focus();
8
- }
9
- function d() {
10
- n.value = e.validity.valid, l.value = e.validity, r.value = e.validationMessage;
11
- }
12
- function f() {
13
- if (!e) throw new Error("Form element is undefined");
14
- const o = e.value;
15
- for (const p of g(h)) {
16
- const c = p(o);
17
- if (c !== !0) {
18
- e.setCustomValidity(c);
19
- break;
20
- }
1
+ import { ref as l, watch as V, toValue as u, readonly as n } from "vue";
2
+ function h(s, f = [], c = !1) {
3
+ const e = l(!0), r = l([]);
4
+ function d(t, a, o) {
5
+ r.value = [], e.value = !0;
6
+ for (const v of a) {
7
+ const i = v(t);
8
+ if (i !== !0 && (r.value.push(i), e.value = !1, o))
9
+ return !1;
21
10
  }
11
+ return e.value;
22
12
  }
23
- function v() {
24
- if (!e) throw new Error("Form element is undefined");
25
- return e.setCustomValidity(""), e.validity.valid && f(), d(), n.value;
26
- }
27
- function C(o) {
28
- d(), g(w) || o.preventDefault();
29
- }
30
- function E() {
31
- v(), a.value = u !== e.value;
32
- }
33
- let i = new AbortController();
34
- return V(() => {
35
- if (e = b(y).value, !e) throw new Error("Form element is undefined");
36
- f(), u = e.value, e.addEventListener("change", E, {
37
- signal: i.signal,
38
- passive: !0
39
- }), e.addEventListener("invalid", C, {
40
- signal: i.signal
41
- }), e?.autofocus && s();
42
- }), M(() => {
43
- i.abort();
44
- }), {
45
- focus: s,
46
- validate: v,
47
- isValid: n,
48
- validity: m(l),
49
- validationMessage: m(r),
50
- isChanged: a
13
+ return V(
14
+ [
15
+ () => u(s),
16
+ () => u(f),
17
+ () => u(c)
18
+ ],
19
+ ([t, a, o]) => {
20
+ d(t, a, o);
21
+ },
22
+ { immediate: !0 }
23
+ ), {
24
+ isValid: n(e),
25
+ errors: n(r)
51
26
  };
52
27
  }
53
28
  export {
54
- k as useFormControl
29
+ h as useValidation
55
30
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./combobox.vue_vue_type_script_setup_true_lang-BhfoMt6j.js";
1
+ import { _ as f } from "./comboboxHiddenInput.vue_vue_type_script_setup_true_lang-Ba-UPd-M.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,103 +1,4 @@
1
- import { ref as T, watch as _, nextTick as P, onBeforeMount as F, onMounted as U, onBeforeUnmount as j } from "vue";
2
- import { useHTMLElement as k } from "./composable-ui23.js";
3
- function G(y, z, {
4
- direction: c = "down",
5
- align: u = "left",
6
- position: L = "fixed",
7
- closeOnOutsideClick: A = !0,
8
- closeOnInsideClick: M = !1
9
- } = {}) {
10
- const s = T(!1);
11
- function v() {
12
- const e = k(y);
13
- if (!e.value) throw new Error("Activator element is undefined");
14
- return e.value;
15
- }
16
- function $() {
17
- const e = k(z);
18
- if (!e.value) throw new Error("Popover element is undefined");
19
- return e.value;
20
- }
21
- function B({ focus: e = !0 } = {}) {
22
- s.value = !0, e && P(() => {
23
- $().focus();
24
- });
25
- }
26
- function E({ focus: e = !0 } = {}) {
27
- s.value = !1, e && v().focus();
28
- }
29
- function O(e) {
30
- s.value ? E(e) : B(e);
31
- }
32
- function h() {
33
- if (!s.value) return;
34
- const e = v(), r = $();
35
- r.style.position = L;
36
- const {
37
- top: f,
38
- right: l,
39
- bottom: w,
40
- left: p,
41
- width: m,
42
- height: W
43
- } = e.getBoundingClientRect(), a = r.offsetHeight, d = r.offsetWidth, x = document.documentElement.clientHeight, b = document.documentElement.clientWidth;
44
- let i = c;
45
- c == "up" ? f - a < 0 && (i = "down") : c == "down" ? w + a > x && (i = "up") : c == "right" ? l + d > b && (i = "left") : c == "left" && p - d < 0 && (i = "right");
46
- let o = u;
47
- u == "left" ? p + d > b && (o = "right") : u == "right" ? l - d < 0 && (o = "left") : u == "top" ? f + a > x && (o = "bottom") : u == "bottom" && w - a < 0 && (o = "top");
48
- const t = {
49
- top: "auto",
50
- bottom: "auto",
51
- left: "auto",
52
- right: "auto",
53
- width: "auto"
54
- }, n = L === "fixed";
55
- i == "up" ? t.bottom = `${W + (n ? x - w : 0)}px` : i == "down" ? t.top = `${W + (n ? f : 0)}px` : i == "right" ? t.left = `${m + (n ? p : 0)}px` : i == "left" && (t.right = `${m + (n ? b - l : 0)}px`), ["up", "down"].includes(i) ? o == "right" ? t.right = `${n ? b - l : 0}px` : o == "left" || o == "stretch" ? t.left = `${n ? p : 0}px` : o == "center" && (t.left = `${(n ? p : 0) - (d - m) / 2}px`) : o == "bottom" ? t.bottom = `${n ? x - w : 0}px` : o == "top" ? t.top = `${n ? f : 0}px` : o == "center" && (t.top = `${(n ? f : 0) - (a - W) / 2}px`), ["up", "down"].includes(i) && o === "stretch" && (t.width = m + "px");
56
- for (const C in t)
57
- r.style[C] = t[C];
58
- }
59
- _(
60
- s,
61
- (e) => {
62
- e && P(() => {
63
- h();
64
- });
65
- },
66
- { flush: "pre" }
67
- );
68
- function R(e) {
69
- const r = e.target;
70
- if (!v().contains(r))
71
- try {
72
- $().contains(r) ? M && E() : A && (s.value = !1);
73
- } catch {
74
- }
75
- }
76
- let H;
77
- const g = new AbortController();
78
- return F(() => {
79
- H = new ResizeObserver(h);
80
- }), U(() => {
81
- window.addEventListener("resize", h, {
82
- passive: !0,
83
- signal: g.signal
84
- }), window.addEventListener("scroll", h, {
85
- passive: !0,
86
- //capture: true,
87
- signal: g.signal
88
- }), window.addEventListener("click", R, {
89
- passive: !0,
90
- signal: g.signal
91
- }), H.observe(v());
92
- }), j(() => {
93
- g.abort(), H.disconnect();
94
- }), {
95
- isOpen: s,
96
- open: B,
97
- close: E,
98
- toggle: O
99
- };
100
- }
1
+ import { _ as f } from "./combobox.vue_vue_type_script_setup_true_lang-ChCbDl0x.js";
101
2
  export {
102
- G as usePopover
3
+ f as default
103
4
  };