vue-composable-ui 1.1.1 → 1.1.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 (61) hide show
  1. package/dist/{combobox.vue_vue_type_script_setup_true_lang-ChCbDl0x.js → combobox.vue_vue_type_script_setup_true_lang-sMngTuXu.js} +10 -10
  2. package/dist/{comboboxHiddenInput.vue_vue_type_script_setup_true_lang-Ba-UPd-M.js → comboboxHiddenInput.vue_vue_type_script_setup_true_lang-BtODyQnH.js} +2 -2
  3. package/dist/{comboboxInput.vue_vue_type_script_setup_true_lang-D3KIXNRO.js → comboboxInput.vue_vue_type_script_setup_true_lang-Be5FBBbM.js} +3 -3
  4. package/dist/{comboboxOption.vue_vue_type_script_setup_true_lang-C9FIG5ye.js → comboboxOption.vue_vue_type_script_setup_true_lang-DmF_EaqI.js} +4 -4
  5. package/dist/comboboxOptions.vue_vue_type_script_setup_true_lang-DN0tz5dv.js +20 -0
  6. package/dist/composable-ui.js +22 -22
  7. package/dist/composable-ui10.js +1 -1
  8. package/dist/composable-ui11.js +1 -1
  9. package/dist/composable-ui12.js +1 -1
  10. package/dist/composable-ui13.js +1 -1
  11. package/dist/composable-ui14.js +1 -1
  12. package/dist/composable-ui15.js +1 -1
  13. package/dist/composable-ui16.js +1 -1
  14. package/dist/composable-ui17.js +1 -1
  15. package/dist/composable-ui18.js +2 -29
  16. package/dist/composable-ui19.js +5 -2
  17. package/dist/composable-ui2.js +2 -28
  18. package/dist/composable-ui20.js +53 -2
  19. package/dist/composable-ui21.js +29 -2
  20. package/dist/composable-ui22.js +132 -91
  21. package/dist/composable-ui23.js +90 -132
  22. package/dist/composable-ui25.js +28 -5
  23. package/dist/composable-ui3.js +2 -53
  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-BJS1g6K9.js → listbox.vue_vue_type_script_setup_true_lang-OvzuliPQ.js} +8 -8
  31. package/dist/{listboxOption.vue_vue_type_script_setup_true_lang-DMkQ_ZA_.js → listboxOption.vue_vue_type_script_setup_true_lang-BhQm7GxW.js} +3 -3
  32. package/dist/{menu.vue_vue_type_script_setup_true_lang-BTGGj0FY.js → menu.vue_vue_type_script_setup_true_lang-B0Jm9v_v.js} +9 -9
  33. package/dist/{menuItem.vue_vue_type_script_setup_true_lang-CSWsvc1p.js → menuItem.vue_vue_type_script_setup_true_lang-IZgj64N4.js} +4 -4
  34. package/dist/{menuItems.vue_vue_type_script_setup_true_lang-DZL1uyoq.js → menuItems.vue_vue_type_script_setup_true_lang-DQV-lU_A.js} +5 -5
  35. package/dist/{popover.vue_vue_type_script_setup_true_lang-C13ARHho.js → popover.vue_vue_type_script_setup_true_lang-D1gc6B-4.js} +2 -2
  36. package/dist/popoverDialog.vue_vue_type_script_setup_true_lang-ApsJsSDN.js +30 -0
  37. package/dist/{tab.vue_vue_type_script_setup_true_lang-BSckMUwj.js → tab.vue_vue_type_script_setup_true_lang-C12uJKqo.js} +3 -3
  38. package/dist/{tabContainer.vue_vue_type_script_setup_true_lang-YfrBXoWm.js → tabContainer.vue_vue_type_script_setup_true_lang-yqy32Zx5.js} +4 -4
  39. package/dist/{tabList.vue_vue_type_script_setup_true_lang-DLoNOwJ7.js → tabList.vue_vue_type_script_setup_true_lang-BjKRcoyi.js} +3 -3
  40. package/dist/{tabPanel.vue_vue_type_script_setup_true_lang-DZfMk_Sn.js → tabPanel.vue_vue_type_script_setup_true_lang-DwEwu3p7.js} +4 -4
  41. package/dist/{tooltip.vue_vue_type_script_setup_true_lang-CXxwHtxF.js → tooltip.vue_vue_type_script_setup_true_lang-kslDnoRH.js} +5 -5
  42. package/dist/types/components/combobox/combobox.vue.d.ts +8 -6
  43. package/dist/types/components/combobox/comboboxHiddenInput.vue.d.ts +2 -1
  44. package/dist/types/components/combobox/comboboxInput.vue.d.ts +4 -3
  45. package/dist/types/components/combobox/comboboxOption.vue.d.ts +3 -2
  46. package/dist/types/components/combobox/comboboxOptions.vue.d.ts +3 -2
  47. package/dist/types/components/listbox/listbox.vue.d.ts +5 -3
  48. package/dist/types/components/listbox/listboxOption.vue.d.ts +3 -2
  49. package/dist/types/components/menu/menu.vue.d.ts +5 -3
  50. package/dist/types/components/menu/menuItem.vue.d.ts +3 -2
  51. package/dist/types/components/menu/menuItems.vue.d.ts +3 -2
  52. package/dist/types/components/popover/popover.vue.d.ts +3 -2
  53. package/dist/types/components/popover/popoverDialog.vue.d.ts +3 -2
  54. package/dist/types/components/tabs/tab.vue.d.ts +3 -2
  55. package/dist/types/components/tabs/tabContainer.vue.d.ts +5 -4
  56. package/dist/types/components/tabs/tabList.vue.d.ts +3 -2
  57. package/dist/types/components/tabs/tabPanel.vue.d.ts +3 -2
  58. package/dist/types/components/tooltip.vue.d.ts +5 -4
  59. package/package.json +5 -5
  60. package/dist/comboboxOptions.vue_vue_type_script_setup_true_lang-DLv4KjF8.js +0 -20
  61. package/dist/popoverDialog.vue_vue_type_script_setup_true_lang-C2z6To-6.js +0 -33
@@ -1,13 +1,13 @@
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";
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
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
- import { _ as $ } from "./comboboxHiddenInput.vue_vue_type_script_setup_true_lang-Ba-UPd-M.js";
6
- import { injectCombobox as J } from "./composable-ui25.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
7
  const ae = /* @__PURE__ */ B({
8
8
  inheritAttrs: !1,
9
9
  __name: "combobox",
10
- props: /* @__PURE__ */ H({
10
+ props: /* @__PURE__ */ _({
11
11
  displayValue: { type: Function, default: (e) => Array.isArray(e) ? e.map((t) => t.toString()).join(", ") : e?.toString() },
12
12
  id: {},
13
13
  activatorId: {},
@@ -19,7 +19,7 @@ const ae = /* @__PURE__ */ B({
19
19
  }),
20
20
  emits: ["update:modelValue"],
21
21
  setup(e) {
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(
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
23
  `#${y}`,
24
24
  `#${l}`,
25
25
  {
@@ -40,7 +40,7 @@ const ae = /* @__PURE__ */ B({
40
40
  activateNextItem: S,
41
41
  activatePrevItem: C
42
42
  } = G(c), g = p(() => t.displayValue(c.value));
43
- K(w, () => {
43
+ j(w, () => {
44
44
  !f.value && w.value.length && (O({ focus: !1 }), f.value || d({ focus: !1 }));
45
45
  });
46
46
  function D() {
@@ -103,7 +103,7 @@ const ae = /* @__PURE__ */ B({
103
103
  "aria-haspopup": "listbox",
104
104
  role: "combobox"
105
105
  }));
106
- return N(J, {
106
+ return K(J, {
107
107
  displayValue: g,
108
108
  popoverId: l,
109
109
  isOpen: o,
@@ -115,7 +115,7 @@ const ae = /* @__PURE__ */ B({
115
115
  activatorOnKeyDown: M
116
116
  }), (a, Q) => (r(), v(b, null, [
117
117
  e.name ? (r(), v(b, { key: 0 }, [
118
- k(u) ? (r(!0), v(b, { key: 0 }, _(I.value, (F, L) => (r(), A($, {
118
+ k(u) ? (r(!0), v(b, { key: 0 }, N(I.value, (F, L) => (r(), A($, {
119
119
  name: `${e.name}[${L}]`,
120
120
  value: F
121
121
  }, null, 8, ["name", "value"]))), 256)) : (r(), A($, {
@@ -1,4 +1,4 @@
1
- import { defineComponent as l, computed as p, createElementBlock as r, openBlock as u, Fragment as m, renderList as i } from "vue";
1
+ import { defineComponent as l, computed as p, openBlock as r, createElementBlock as u, Fragment as m, renderList as i } from "vue";
2
2
  const d = ["name", "value"], f = /* @__PURE__ */ l({
3
3
  __name: "comboboxHiddenInput",
4
4
  props: {
@@ -17,7 +17,7 @@ const d = ["name", "value"], f = /* @__PURE__ */ l({
17
17
  [e.name]: e.value
18
18
  };
19
19
  });
20
- return (n, o) => (u(!0), r(m, null, i(c.value, (t, s) => (u(), r("input", {
20
+ return (n, o) => (r(!0), u(m, null, i(c.value, (t, s) => (r(), u("input", {
21
21
  name: s,
22
22
  value: t,
23
23
  type: "hidden"
@@ -1,5 +1,5 @@
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";
1
+ import { defineComponent as r, inject as a, useModel as m, watch as p, withDirectives as d, openBlock as s, createElementBlock as f, mergeProps as v, unref as n, vModelDynamic as c } from "vue";
2
+ import { injectCombobox as b } from "./composable-ui19.js";
3
3
  const y = /* @__PURE__ */ r({
4
4
  __name: "comboboxInput",
5
5
  props: {
@@ -15,7 +15,7 @@ const y = /* @__PURE__ */ r({
15
15
  function u() {
16
16
  l.value = e.displayValue.value;
17
17
  }
18
- return p(e.displayValue, u, { immediate: !0 }), (w, o) => d((f(), s("input", v({
18
+ return p(e.displayValue, u, { immediate: !0 }), (w, o) => d((s(), f("input", v({
19
19
  "onUpdate:modelValue": o[0] || (o[0] = (t) => l.value = t)
20
20
  }, n(e).activatorAttrs, {
21
21
  onClick: o[1] || (o[1] = (t) => n(e).open({ focus: !1 })),
@@ -1,6 +1,6 @@
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-ui18.js";
3
- import { injectCombobox as C } from "./composable-ui25.js";
1
+ import { defineComponent as f, useId as b, useTemplateRef as p, inject as v, openBlock as x, createElementBlock as E, unref as e, renderSlot as _ } from "vue";
2
+ import { useListOption as k } from "./composable-ui21.js";
3
+ import { injectCombobox as C } from "./composable-ui19.js";
4
4
  const j = ["id", "data-active", "aria-selected", "aria-disabled"], A = /* @__PURE__ */ f({
5
5
  __name: "comboboxOption",
6
6
  props: {
@@ -19,7 +19,7 @@ const j = ["id", "data-active", "aria-selected", "aria-disabled"], A = /* @__PUR
19
19
  function m() {
20
20
  r(), t.isMultiselectable.value ? t.focus() : t.close({ focus: !0 });
21
21
  }
22
- return (u, l) => (E(), x("div", {
22
+ return (u, l) => (x(), E("div", {
23
23
  ref_key: "itemEl",
24
24
  ref: s,
25
25
  id: e(c),
@@ -0,0 +1,20 @@
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,26 +1,26 @@
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";
1
+ import { usePopover as e } from "./composable-ui23.js";
2
+ import { useList as p } from "./composable-ui22.js";
3
+ import { useListOption as s } from "./composable-ui21.js";
4
+ import { useFormControl as a } from "./composable-ui20.js";
5
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";
6
+ import { useValidation as b } from "./composable-ui25.js";
7
+ import { injectCombobox as u, injectMenu as C, injectPopover as T, injectTabs as l } from "./composable-ui19.js";
8
+ import { _ as M } from "./listbox.vue_vue_type_script_setup_true_lang-OvzuliPQ.js";
9
+ import { _ as c } from "./listboxOption.vue_vue_type_script_setup_true_lang-BhQm7GxW.js";
10
+ import { _ as v } from "./tabContainer.vue_vue_type_script_setup_true_lang-yqy32Zx5.js";
11
+ import { _ as I } from "./tabList.vue_vue_type_script_setup_true_lang-BjKRcoyi.js";
12
+ import { _ as g } from "./tab.vue_vue_type_script_setup_true_lang-C12uJKqo.js";
13
+ import { _ as E } from "./tabPanel.vue_vue_type_script_setup_true_lang-DwEwu3p7.js";
14
+ import { _ as H } from "./popover.vue_vue_type_script_setup_true_lang-D1gc6B-4.js";
15
+ import { _ as h } from "./popoverDialog.vue_vue_type_script_setup_true_lang-ApsJsSDN.js";
16
+ import { _ as q } from "./tooltip.vue_vue_type_script_setup_true_lang-kslDnoRH.js";
17
+ import { _ as y } from "./menu.vue_vue_type_script_setup_true_lang-B0Jm9v_v.js";
18
+ import { _ as A } from "./menuItems.vue_vue_type_script_setup_true_lang-DQV-lU_A.js";
19
+ import { _ as G } from "./menuItem.vue_vue_type_script_setup_true_lang-IZgj64N4.js";
20
+ import { _ as K } from "./combobox.vue_vue_type_script_setup_true_lang-sMngTuXu.js";
21
+ import { _ as Q } from "./comboboxInput.vue_vue_type_script_setup_true_lang-Be5FBBbM.js";
22
+ import { _ as S } from "./comboboxOptions.vue_vue_type_script_setup_true_lang-DN0tz5dv.js";
23
+ import { _ as W } from "./comboboxOption.vue_vue_type_script_setup_true_lang-DmF_EaqI.js";
24
24
  export {
25
25
  K as Combobox,
26
26
  Q as ComboboxInput,
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./popover.vue_vue_type_script_setup_true_lang-C13ARHho.js";
1
+ import { _ as f } from "./menuItem.vue_vue_type_script_setup_true_lang-IZgj64N4.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./menuItems.vue_vue_type_script_setup_true_lang-DZL1uyoq.js";
1
+ import { _ as f } from "./menuItems.vue_vue_type_script_setup_true_lang-DQV-lU_A.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-CSWsvc1p.js";
1
+ import { _ as f } from "./popover.vue_vue_type_script_setup_true_lang-D1gc6B-4.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-BTGGj0FY.js";
1
+ import { _ as f } from "./popoverDialog.vue_vue_type_script_setup_true_lang-ApsJsSDN.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-DMkQ_ZA_.js";
1
+ import { _ as f } from "./tab.vue_vue_type_script_setup_true_lang-C12uJKqo.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-BJS1g6K9.js";
1
+ import { _ as f } from "./tabContainer.vue_vue_type_script_setup_true_lang-yqy32Zx5.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-DLv4KjF8.js";
1
+ import { _ as f } from "./tabList.vue_vue_type_script_setup_true_lang-BjKRcoyi.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-C9FIG5ye.js";
1
+ import { _ as f } from "./tabPanel.vue_vue_type_script_setup_true_lang-DwEwu3p7.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-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
- }
1
+ import { _ as f } from "./tooltip.vue_vue_type_script_setup_true_lang-kslDnoRH.js";
29
2
  export {
30
- S as useListOption
3
+ f as default
31
4
  };
@@ -1,4 +1,7 @@
1
- import { _ as f } from "./comboboxInput.vue_vue_type_script_setup_true_lang-D3KIXNRO.js";
1
+ const o = /* @__PURE__ */ Symbol(), n = /* @__PURE__ */ Symbol(), t = /* @__PURE__ */ Symbol(), c = /* @__PURE__ */ Symbol();
2
2
  export {
3
- f as default
3
+ c as injectCombobox,
4
+ t as injectMenu,
5
+ n as injectPopover,
6
+ o as injectTabs
4
7
  };
@@ -1,30 +1,4 @@
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;
10
- }
11
- return e.value;
12
- }
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)
26
- };
27
- }
1
+ import { _ as f } from "./combobox.vue_vue_type_script_setup_true_lang-sMngTuXu.js";
28
2
  export {
29
- h as useValidation
3
+ f as default
30
4
  };
@@ -1,4 +1,55 @@
1
- import { _ as f } from "./comboboxHiddenInput.vue_vue_type_script_setup_true_lang-Ba-UPd-M.js";
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-ui24.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
+ }
21
+ }
22
+ }
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
51
+ };
52
+ }
2
53
  export {
3
- f as default
54
+ k as useFormControl
4
55
  };
@@ -1,4 +1,31 @@
1
- import { _ as f } from "./combobox.vue_vue_type_script_setup_true_lang-ChCbDl0x.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-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
+ }
2
29
  export {
3
- f as default
30
+ S as useListOption
4
31
  };
@@ -1,103 +1,144 @@
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-ui24.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;
1
+ import { shallowRef as N, ref as R, computed as g, provide as B, readonly as h, shallowReadonly as J, triggerRef as S, unref as s } from "vue";
2
+ import { useHTMLElement as _ } from "./composable-ui24.js";
3
+ const q = /* @__PURE__ */ Symbol();
4
+ function d(r, c) {
5
+ const [n, l] = [s(r), s(c)];
6
+ return typeof n == "object" ? typeof l == "object" ? JSON.stringify(n) === JSON.stringify(l) : !1 : n === l;
7
+ }
8
+ function P(r) {
9
+ let c = 0;
10
+ const n = N([]), l = R(), v = g(() => Array.isArray(r.value));
11
+ function o(e) {
12
+ const t = n.value.find((i) => i.id === e);
13
+ if (!t) throw new Error(`Item not found: (${e})`);
14
+ return t;
15
15
  }
16
- function $() {
17
- const e = k(z);
18
- if (!e.value) throw new Error("Popover element is undefined");
19
- return e.value;
16
+ function b(e) {
17
+ const t = s(e.element);
18
+ if (t)
19
+ return t.focus(), t;
20
20
  }
21
- function B({ focus: e = !0 } = {}) {
22
- s.value = !0, e && P(() => {
23
- $().focus();
24
- });
21
+ function f(e, { focus: t = !1 } = {}) {
22
+ l.value = e?.id ?? void 0, e !== void 0 && t && b(e);
25
23
  }
26
- function E({ focus: e = !0 } = {}) {
27
- s.value = !1, e && v().focus();
24
+ function O(e, { focus: t = !1 } = {}) {
25
+ const i = o(e);
26
+ return f(i, { focus: t });
28
27
  }
29
- function O(e) {
30
- s.value ? E(e) : B(e);
28
+ function m(e) {
29
+ return l.value === e;
31
30
  }
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];
31
+ function w(e, t, i = !1) {
32
+ const a = _(e), u = c++;
33
+ return n.value.push({
34
+ id: u,
35
+ value: t,
36
+ element: a,
37
+ disabled: i
38
+ }), S(n), u;
58
39
  }
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
- }
40
+ function A(e) {
41
+ m(e) && f();
42
+ const t = o(e), i = n.value.indexOf(t);
43
+ n.value.splice(i, 1), S(n);
44
+ }
45
+ function I(e) {
46
+ const t = o(e);
47
+ if (s(t.disabled)) return;
48
+ const i = s(t.value);
49
+ if (i !== void 0) {
50
+ if (s(v)) {
51
+ const a = r.value.findIndex(
52
+ (u) => d(i, u)
53
+ );
54
+ a > -1 ? r.value.splice(a, 1) : r.value = [...r.value, i];
55
+ } else
56
+ r.value = i;
57
+ f(t);
58
+ }
59
+ }
60
+ function y(e) {
61
+ return s(v) ? !!r.value.find(
62
+ (t) => d(e.value, t)
63
+ ) : d(r, e.value);
64
+ }
65
+ function L(e) {
66
+ try {
67
+ const t = o(e);
68
+ return y(t);
69
+ } catch {
70
+ return !1;
71
+ }
72
+ }
73
+ function j({ focus: e = !1 } = {}) {
74
+ for (let t of n.value)
75
+ if (y(t))
76
+ return f(t, { focus: e });
75
77
  }
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();
78
+ function p({ focus: e = !1 } = {}) {
79
+ if (n.value.length)
80
+ return f(n.value[0], { focus: e });
81
+ }
82
+ function x({ focus: e = !1 } = {}) {
83
+ if (n.value.length)
84
+ return f(n.value[n.value.length - 1], { focus: e });
85
+ }
86
+ function E({
87
+ focus: e = !1,
88
+ loop: t = !1
89
+ } = {}) {
90
+ if (l.value === void 0) return p({ focus: e });
91
+ const i = o(l.value), a = n.value.indexOf(i);
92
+ let u;
93
+ if (a + 1 < n.value.length)
94
+ u = n.value[a + 1];
95
+ else if (t)
96
+ u = n.value[0];
97
+ else
98
+ return;
99
+ return f(u, { focus: e });
100
+ }
101
+ function M({
102
+ focus: e = !1,
103
+ loop: t = !1
104
+ } = {}) {
105
+ if (l.value === void 0) return x({ focus: e });
106
+ const i = o(l.value), a = n.value.indexOf(i);
107
+ let u;
108
+ if (a - 1 > -1)
109
+ u = n.value[a - 1];
110
+ else if (t)
111
+ u = n.value[n.value.length - 1];
112
+ else
113
+ return;
114
+ return f(u, { focus: e });
115
+ }
116
+ return B(q, {
117
+ value: h(r),
118
+ selectItem: I,
119
+ activateItem: O,
120
+ deactivateItem: () => f(),
121
+ isSelected: L,
122
+ isActive: m,
123
+ addItem: w,
124
+ removeItem: A
94
125
  }), {
95
- isOpen: s,
96
- open: B,
97
- close: E,
98
- toggle: O
126
+ items: J(n),
127
+ isMultiselectable: h(v),
128
+ activeItem: g(
129
+ () => l.value !== void 0 ? o(l.value) : void 0
130
+ ),
131
+ selectActiveItem: () => {
132
+ l.value !== void 0 && I(l.value);
133
+ },
134
+ activateSelectedItem: j,
135
+ activateFirstItem: p,
136
+ activateLastItem: x,
137
+ activateNextItem: E,
138
+ activatePrevItem: M
99
139
  };
100
140
  }
101
141
  export {
102
- G as usePopover
142
+ q as injectList,
143
+ P as useList
103
144
  };