@volverjs/ui-vue 0.0.3 → 0.0.4

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 (145) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +52 -13
  3. package/dist/Volver.d.ts +5 -1
  4. package/dist/components/VvAccordion/VvAccordion.es.js +113 -66
  5. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  6. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +159 -101
  7. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  8. package/dist/components/VvAction/VvAction.es.js +170 -0
  9. package/dist/components/VvAction/VvAction.umd.js +1 -0
  10. package/dist/components/VvAction/VvAction.vue.d.ts +63 -0
  11. package/dist/components/VvAction/index.d.ts +24 -0
  12. package/dist/components/VvBadge/VvBadge.es.js +86 -16
  13. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  14. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +97 -41
  15. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  16. package/dist/components/VvButton/VvButton.es.js +434 -251
  17. package/dist/components/VvButton/VvButton.umd.js +1 -1
  18. package/dist/components/VvButton/VvButton.vue.d.ts +50 -50
  19. package/dist/components/VvButton/index.d.ts +22 -67
  20. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +118 -43
  21. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  22. package/dist/components/VvCard/VvCard.es.js +38 -25
  23. package/dist/components/VvCard/VvCard.umd.js +1 -1
  24. package/dist/components/VvCheckbox/VvCheckbox.es.js +334 -154
  25. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  26. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +2 -2
  27. package/dist/components/VvCheckbox/index.d.ts +1 -1
  28. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +401 -204
  29. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  30. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +2 -2
  31. package/dist/components/VvCheckboxGroup/index.d.ts +1 -1
  32. package/dist/components/VvCombobox/VvCombobox.es.js +950 -594
  33. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  34. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +54 -30
  35. package/dist/components/VvCombobox/index.d.ts +18 -13
  36. package/dist/components/VvDialog/VvDialog.es.js +139 -64
  37. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  38. package/dist/components/VvDropdown/VvDropdown.es.js +276 -158
  39. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  40. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +9 -9
  41. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +61 -0
  42. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +52 -0
  43. package/dist/components/VvDropdown/index.d.ts +6 -9
  44. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +251 -0
  45. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -0
  46. package/dist/components/VvDropdownItem/VvDropdownItem.es.js +30 -15
  47. package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
  48. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +176 -0
  49. package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -0
  50. package/dist/components/VvIcon/VvIcon.es.js +48 -32
  51. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  52. package/dist/components/VvInputText/VvInputText.es.js +508 -344
  53. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  54. package/dist/components/VvInputText/VvInputText.vue.d.ts +11 -4
  55. package/dist/components/VvInputText/index.d.ts +13 -2
  56. package/dist/components/VvProgress/VvProgress.es.js +90 -20
  57. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  58. package/dist/components/VvRadio/VvRadio.es.js +305 -125
  59. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  60. package/dist/components/VvRadio/VvRadio.vue.d.ts +2 -2
  61. package/dist/components/VvRadio/index.d.ts +1 -1
  62. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +372 -175
  63. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  64. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +2 -2
  65. package/dist/components/VvRadioGroup/index.d.ts +1 -1
  66. package/dist/components/VvSelect/VvSelect.es.js +371 -216
  67. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  68. package/dist/components/VvSelect/VvSelect.vue.d.ts +11 -4
  69. package/dist/components/VvSelect/index.d.ts +5 -5
  70. package/dist/components/VvTextarea/VvTextarea.es.js +408 -244
  71. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  72. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +11 -4
  73. package/dist/components/VvTextarea/index.d.ts +5 -5
  74. package/dist/components/VvTooltip/VvTooltip.es.js +88 -18
  75. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
  76. package/dist/components/index.es.js +1913 -1521
  77. package/dist/components/index.umd.js +1 -1
  78. package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
  79. package/dist/composables/dropdown/useProvideDropdown.d.ts +2 -2
  80. package/dist/constants.d.ts +30 -0
  81. package/dist/directives/index.es.js +128 -0
  82. package/dist/directives/index.umd.js +1 -0
  83. package/dist/directives/v-tooltip.es.js +126 -0
  84. package/dist/directives/v-tooltip.umd.js +1 -0
  85. package/dist/icons.es.js +3 -3
  86. package/dist/icons.umd.js +1 -1
  87. package/dist/index.es.js +2102 -1761
  88. package/dist/index.umd.js +1 -1
  89. package/dist/props/index.d.ts +179 -11
  90. package/dist/resolvers/unplugin.d.ts +8 -8
  91. package/dist/resolvers/unplugin.es.js +51 -30
  92. package/dist/resolvers/unplugin.umd.js +1 -1
  93. package/dist/stories/Combobox/Combobox.settings.d.ts +44 -0
  94. package/dist/stories/Dropdown/Dropdown.settings.d.ts +3 -2
  95. package/package.json +60 -34
  96. package/src/Volver.ts +12 -5
  97. package/src/assets/icons/detailed.json +1 -1
  98. package/src/assets/icons/normal.json +1 -1
  99. package/src/assets/icons/simple.json +1 -1
  100. package/src/components/VvAction/VvAction.vue +144 -0
  101. package/src/components/VvAction/index.ts +5 -0
  102. package/src/components/VvButton/VvButton.vue +31 -114
  103. package/src/components/VvButton/index.ts +6 -79
  104. package/src/components/VvCombobox/VvCombobox.vue +54 -42
  105. package/src/components/VvCombobox/index.ts +11 -9
  106. package/src/components/VvDropdown/VvDropdownAction.vue +44 -0
  107. package/src/components/VvDropdown/VvDropdownOption.vue +65 -0
  108. package/src/components/VvDropdown/index.ts +4 -9
  109. package/src/components/VvSelect/index.ts +2 -4
  110. package/src/composables/dropdown/useInjectDropdown.ts +1 -1
  111. package/src/composables/dropdown/useProvideDropdown.ts +7 -9
  112. package/src/composables/useModifiers.ts +4 -7
  113. package/src/constants.ts +36 -0
  114. package/src/props/index.ts +106 -14
  115. package/src/resolvers/unplugin.ts +81 -48
  116. package/src/stories/Accordion/AccordionSlots.stories.mdx +2 -2
  117. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +2 -1
  118. package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +2 -1
  119. package/src/stories/Button/Button.stories.mdx +4 -2
  120. package/src/stories/Button/Button.test.ts +3 -1
  121. package/src/stories/Button/ButtonModifiers.stories.mdx +2 -2
  122. package/src/stories/Button/ButtonSlots.stories.mdx +8 -7
  123. package/src/stories/Button/ButtonState.stories.mdx +2 -11
  124. package/src/stories/Card/Card.stories.mdx +2 -1
  125. package/src/stories/Checkbox/Checkbox.stories.mdx +2 -1
  126. package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +2 -1
  127. package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +2 -1
  128. package/src/stories/Combobox/Combobox.settings.ts +44 -0
  129. package/src/stories/Combobox/Combobox.stories.mdx +40 -1
  130. package/src/stories/Dialog/Dialog.stories.mdx +2 -1
  131. package/src/stories/Dropdown/Dropdown.settings.ts +3 -2
  132. package/src/stories/Dropdown/Dropdown.stories.mdx +14 -12
  133. package/src/stories/Dropdown/DropdownMultilevel.stories.mdx +56 -0
  134. package/src/stories/Dropdown/DropdownSlots.stories.mdx +14 -13
  135. package/src/stories/Icon/Icon.stories.mdx +2 -1
  136. package/src/stories/Icon/IconsCollection.stories.mdx +2 -1
  137. package/src/stories/InputText/InputText.stories.mdx +2 -1
  138. package/src/stories/Progress/Progress.stories.mdx +2 -1
  139. package/src/stories/Radio/Radio.stories.mdx +2 -1
  140. package/src/stories/RadioGroup/RadioGroup.stories.mdx +2 -1
  141. package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +2 -1
  142. package/src/stories/Select/Select.stories.mdx +2 -1
  143. package/src/stories/Textarea/Textarea.stories.mdx +2 -1
  144. package/src/stories/Tooltip/Tooltip.stories.mdx +2 -1
  145. package/src/stories/Tooltip/TooltipDirective.stories.mdx +2 -1
@@ -1,27 +1,76 @@
1
- import { defineComponent as de, openBlock as A, createElementBlock as N, Fragment as ce, createVNode as V, unref as r, withCtx as j, renderSlot as c, normalizeProps as p, guardReactiveProps as v, Transition as pe, withDirectives as ve, createElementVNode as C, normalizeStyle as W, normalizeClass as me, createCommentVNode as he, mergeProps as be, vShow as ge } from "vue";
2
- import { autoPlacement as z, flip as R, shift as F, size as I, offset as y, arrow as ye, useFloating as we, autoUpdate as xe } from "@floating-ui/vue";
3
- var w = /* @__PURE__ */ ((t) => (t.left = "left", t.right = "right", t.top = "top", t.bottom = "bottom", t))(w || {}), K = /* @__PURE__ */ ((t) => (t.topStart = "top-start", t.topEnd = "top-end", t.bottomStart = "bottom-start", t.bottomEnd = "bottom-end", t.leftStart = "left-start", t.leftEnd = "left-end", t.rightStart = "right-start", t.rightEnd = "right-end", t))(K || {}), x = /* @__PURE__ */ ((t) => (t.before = "before", t.after = "after", t))(x || {});
4
- const Ee = {
1
+ import { computed as s, defineComponent as X, h as we, Fragment as Z, provide as xe, unref as a, toRefs as M, useAttrs as _e, ref as p, watch as Oe, nextTick as D, openBlock as T, createElementBlock as K, createVNode as L, withCtx as U, renderSlot as E, normalizeProps as w, guardReactiveProps as x, Transition as Se, withDirectives as Pe, createElementVNode as q, normalizeStyle as G, normalizeClass as $e, createCommentVNode as De, mergeProps as Ne, vShow as je } from "vue";
2
+ import { autoPlacement as H, flip as J, shift as Y, size as Q, offset as N, arrow as ke, useFloating as Be, autoUpdate as Ae } from "@floating-ui/vue";
3
+ import { nanoid as Ie } from "nanoid";
4
+ import { useVModel as Ve, onClickOutside as Ce, useFocusWithin as We, onKeyStroke as _ } from "@vueuse/core";
5
+ import Re from "mitt";
6
+ var j = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(j || {}), ee = /* @__PURE__ */ ((e) => (e.topStart = "top-start", e.topEnd = "top-end", e.bottomStart = "bottom-start", e.bottomEnd = "bottom-end", e.leftStart = "left-start", e.leftEnd = "left-end", e.rightStart = "right-start", e.rightEnd = "right-end", e))(ee || {}), k = /* @__PURE__ */ ((e) => (e.before = "before", e.after = "after", e))(k || {}), B = /* @__PURE__ */ ((e) => (e.button = "button", e.submit = "submit", e.reset = "reset", e))(B || {}), O = /* @__PURE__ */ ((e) => (e.listbox = "listbox", e.menu = "menu", e))(O || {}), A = /* @__PURE__ */ ((e) => (e.option = "option", e.presentation = "presentation", e))(A || {}), te = /* @__PURE__ */ ((e) => (e._blank = "_blank", e._self = "_self", e._parent = "_parent", e._top = "_top", e))(te || {});
7
+ const ze = Symbol.for("dropdownTrigger"), Fe = Symbol.for("dropdownItem"), Me = {
8
+ /**
9
+ * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
10
+ * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
11
+ */
12
+ to: {
13
+ type: [String, Object]
14
+ },
15
+ /**
16
+ * Anchor href
17
+ */
18
+ href: String,
19
+ /**
20
+ * Anchor target
21
+ */
22
+ target: {
23
+ type: String,
24
+ validator: (e) => Object.values(te).includes(e)
25
+ },
26
+ /**
27
+ * Anchor rel
28
+ */
29
+ rel: {
30
+ type: String,
31
+ default: "noopener noreferrer"
32
+ }
33
+ }, Te = {
34
+ /**
35
+ * Whether the form control is disabled
36
+ */
37
+ disabled: Boolean
38
+ }, Ke = {
39
+ /**
40
+ * Whether the item is active
41
+ */
42
+ active: Boolean
43
+ }, Le = {
44
+ /**
45
+ * Whether the item is pressed
46
+ */
47
+ pressed: Boolean
48
+ }, Ue = {
49
+ /**
50
+ * The item label
51
+ */
52
+ label: [String, Number]
53
+ }, qe = {
5
54
  /**
6
55
  * Component BEM modifiers
7
56
  */
8
57
  modifiers: [String, Array]
9
58
  };
10
- x.before;
11
- const Se = {
59
+ k.before;
60
+ const Ge = {
12
61
  /**
13
62
  * Global attribute id
14
63
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
15
64
  */
16
65
  id: [String, Number]
17
- }, ke = {
66
+ }, He = {
18
67
  /**
19
68
  * Dropdown placement
20
69
  */
21
70
  placement: {
22
71
  type: String,
23
- default: w.bottom,
24
- validator: (t) => Object.values(w).includes(t) || Object.values(K).includes(t)
72
+ default: j.bottom,
73
+ validator: (e) => Object.values(j).includes(e) || Object.values(ee).includes(e)
25
74
  },
26
75
  /**
27
76
  * Dropdown show / hide transition name
@@ -97,10 +146,22 @@ const Se = {
97
146
  triggerWidth: {
98
147
  type: Boolean
99
148
  }
100
- }, T = ["listbox", "menu"], Oe = {
101
- ...Se,
102
- ...Ee,
103
- ...ke,
149
+ };
150
+ ({
151
+ ...Te,
152
+ ...Ue,
153
+ ...Le,
154
+ ...Ke,
155
+ ...Me,
156
+ /**
157
+ * Button type
158
+ */
159
+ type: B.button
160
+ });
161
+ const Je = {
162
+ ...Ge,
163
+ ...qe,
164
+ ...He,
104
165
  /**
105
166
  * Show / hide dropdown programmatically
106
167
  */
@@ -120,218 +181,275 @@ const Se = {
120
181
  */
121
182
  role: {
122
183
  type: String,
123
- default: T[1],
124
- validator: (t) => T.includes(t)
184
+ default: O.menu,
185
+ validator: (e) => Object.values(O).includes(e)
125
186
  }
126
- }, De = ["id", "tabindex", "role", "aria-labelledby"], _e = {
187
+ }, Ye = (e) => s(() => String((e == null ? void 0 : e.value) || Ie()));
188
+ function Qe({
189
+ reference: e,
190
+ id: l,
191
+ expanded: o,
192
+ aria: f
193
+ }) {
194
+ const u = Re(), i = X({
195
+ name: "VvDropdownTriggerProvider",
196
+ provide() {
197
+ return {
198
+ [ze]: {
199
+ reference: e,
200
+ id: l,
201
+ expanded: o,
202
+ aria: f,
203
+ bus: u
204
+ }
205
+ };
206
+ },
207
+ setup() {
208
+ return {};
209
+ },
210
+ render() {
211
+ var v, m;
212
+ return we(Z, {}, (m = (v = this.$slots).default) == null ? void 0 : m.call(v));
213
+ }
214
+ });
215
+ return {
216
+ bus: u,
217
+ component: i
218
+ };
219
+ }
220
+ function Xe({
221
+ role: e,
222
+ expanded: l
223
+ }) {
224
+ const o = s(
225
+ () => e.value === O.listbox ? A.option : A.presentation
226
+ );
227
+ return xe(Fe, {
228
+ role: o,
229
+ expanded: l
230
+ }), { itemRole: o };
231
+ }
232
+ function Ze(e, l, o) {
233
+ return s(() => {
234
+ const f = {
235
+ [e]: !0
236
+ }, u = typeof (l == null ? void 0 : l.value) == "string" ? l.value.split(" ") : l == null ? void 0 : l.value;
237
+ return u && Array.isArray(u) && u.forEach((i) => {
238
+ f[`${e}--${i}`] = !0;
239
+ }), o && Object.keys(o.value).forEach((i) => {
240
+ f[`${e}--${i}`] = a(o.value[i]);
241
+ }), f;
242
+ });
243
+ }
244
+ const et = ["id", "tabindex", "role", "aria-labelledby"], tt = {
127
245
  name: "VvDropdown",
128
246
  inheritAttrs: !1
129
- }, Pe = /* @__PURE__ */ de({
130
- ..._e,
131
- props: Oe,
247
+ }, st = /* @__PURE__ */ X({
248
+ ...tt,
249
+ props: Je,
132
250
  emits: ["update:modelValue"],
133
- setup(t, { emit: M }) {
134
- const o = t, { id: U } = toRefs(o), m = useUniqueId(U), q = useAttrs(), E = ref("auto"), S = ref("auto"), k = ref(null), n = ref(null), u = ref(null), H = ref(null), s = computed({
135
- get: () => o.reference ?? k.value,
136
- set: (e) => {
137
- k.value = e;
251
+ setup(e, { emit: l }) {
252
+ const o = e, { id: f } = M(o), u = Ye(f), i = _e(), v = p("auto"), m = p("auto"), I = p(null), c = p(null), g = p(null), oe = p(null), d = s({
253
+ get: () => o.reference ?? I.value,
254
+ set: (t) => {
255
+ I.value = t;
138
256
  }
139
- }), L = computed(() => {
140
- const e = [];
141
- if (o.autoPlacement ? typeof o.autoPlacement == "boolean" ? e.push(z()) : e.push(
142
- z(o.autoPlacement)
143
- ) : o.flip && (typeof o.flip == "boolean" ? e.push(R()) : e.push(R(o.flip))), o.shift && (typeof o.shift == "boolean" ? e.push(F()) : e.push(F(o.shift))), o.size) {
144
- const l = ({
145
- availableWidth: f,
146
- availableHeight: d
257
+ }), re = s(() => {
258
+ const t = [];
259
+ if (o.autoPlacement ? typeof o.autoPlacement == "boolean" ? t.push(H()) : t.push(
260
+ H(o.autoPlacement)
261
+ ) : o.flip && (typeof o.flip == "boolean" ? t.push(J()) : t.push(J(o.flip))), o.shift && (typeof o.shift == "boolean" ? t.push(Y()) : t.push(Y(o.shift))), o.size) {
262
+ const r = ({
263
+ availableWidth: h,
264
+ availableHeight: y
147
265
  }) => {
148
- E.value = `${f}px`, S.value = `${d}px`;
266
+ v.value = `${h}px`, m.value = `${y}px`;
149
267
  };
150
- typeof o.size == "boolean" ? e.push(
151
- I({
152
- apply: l
268
+ typeof o.size == "boolean" ? t.push(
269
+ Q({
270
+ apply: r
153
271
  })
154
- ) : e.push(
155
- I({
272
+ ) : t.push(
273
+ Q({
156
274
  ...o.size,
157
- apply: l
275
+ apply: r
158
276
  })
159
277
  );
160
278
  }
161
- return o.offset && (e.push(y(Number(o.offset))), ["string", "number"].includes(typeof o.offset) ? e.push(y(Number(o.offset))) : e.push(y(o.offset))), o.arrow && e.push(
162
- ye({
163
- element: u
279
+ return o.offset && (t.push(N(Number(o.offset))), ["string", "number"].includes(typeof o.offset) ? t.push(N(Number(o.offset))) : t.push(N(o.offset))), o.arrow && t.push(
280
+ ke({
281
+ element: g
164
282
  })
165
- ), e;
166
- }), { x: G, y: J, strategy: Q, middlewareData: O, placement: X } = we(
167
- s,
168
- n,
283
+ ), t;
284
+ }), { x: ne, y: ae, strategy: le, middlewareData: V, placement: se } = Be(
285
+ d,
286
+ c,
169
287
  {
170
- whileElementsMounted: xe,
288
+ whileElementsMounted: Ae,
171
289
  placement: o.placement,
172
- middleware: L
290
+ middleware: re
173
291
  }
174
- ), Y = computed(() => ({
175
- position: Q.value,
176
- top: `${J.value ?? 0}px`,
177
- left: `${G.value ?? 0}px`,
178
- maxWidth: E.value,
179
- maxHeight: S.value,
180
- width: o.triggerWidth && s.value ? `${s.value.offsetWidth}px` : void 0
181
- })), Z = computed(() => X.value.split("-")[0]), h = computed(
292
+ ), ue = s(() => ({
293
+ position: le.value,
294
+ top: `${ae.value ?? 0}px`,
295
+ left: `${ne.value ?? 0}px`,
296
+ maxWidth: v.value,
297
+ maxHeight: m.value,
298
+ width: o.triggerWidth && d.value ? `${d.value.offsetWidth}px` : void 0
299
+ })), ie = s(() => se.value.split("-")[0]), S = s(
182
300
  () => ({
183
301
  top: "bottom",
184
302
  right: "left",
185
303
  bottom: "top",
186
304
  left: "right"
187
- })[Z.value] ?? "bottom"
188
- ), ee = computed(() => {
189
- var e, l, f, d;
190
- return ["bottom", "top"].includes(h.value) ? {
191
- right: `${((e = O.value.arrow) == null ? void 0 : e.x) ?? 0}px`,
192
- [h.value]: `${-(((l = u.value) == null ? void 0 : l.offsetWidth) ?? 0) / 2}px`
305
+ })[ie.value] ?? "bottom"
306
+ ), fe = s(() => {
307
+ var t, r, h, y;
308
+ return ["bottom", "top"].includes(S.value) ? {
309
+ right: `${((t = V.value.arrow) == null ? void 0 : t.x) ?? 0}px`,
310
+ [S.value]: `${-(((r = g.value) == null ? void 0 : r.offsetWidth) ?? 0) / 2}px`
193
311
  } : {
194
- top: `${((f = O.value.arrow) == null ? void 0 : f.y) ?? 0}px`,
195
- [h.value]: `${-(((d = u.value) == null ? void 0 : d.offsetWidth) ?? 0) / 2}px`
312
+ top: `${((h = V.value.arrow) == null ? void 0 : h.y) ?? 0}px`,
313
+ [S.value]: `${-(((y = g.value) == null ? void 0 : y.offsetWidth) ?? 0) / 2}px`
196
314
  };
197
- }), b = useVModel(o, "modelValue", M), D = ref(!1), a = computed({
198
- get: () => b.value ?? D.value,
199
- set: (e) => {
200
- if (b.value === void 0) {
201
- D.value = e;
315
+ }), P = Ve(o, "modelValue", l), C = p(!1), n = s({
316
+ get: () => P.value ?? C.value,
317
+ set: (t) => {
318
+ if (P.value === void 0) {
319
+ C.value = t;
202
320
  return;
203
321
  }
204
- b.value = e;
322
+ P.value = t;
205
323
  }
206
- }), te = () => {
207
- a.value = !0;
208
- }, _ = () => {
209
- a.value = !1;
210
- }, $ = () => {
211
- a.value = !a.value;
212
- }, oe = (e) => {
213
- s.value = e;
324
+ }), ce = () => {
325
+ n.value = !0;
326
+ }, W = () => {
327
+ n.value = !1;
328
+ }, R = () => {
329
+ n.value = !n.value;
330
+ }, de = (t) => {
331
+ d.value = t;
214
332
  };
215
- watch(a, (e) => {
216
- e && o.autofocusFirst && nextTick(() => {
217
- const l = g(
218
- n.value
333
+ Oe(n, (t) => {
334
+ t && o.autofocusFirst && D(() => {
335
+ const r = $(
336
+ c.value
219
337
  );
220
- l.length > 0 && l[0].focus();
338
+ r.length > 0 && r[0].focus();
221
339
  });
222
- }), onClickOutside(
223
- n,
340
+ }), Ce(
341
+ c,
224
342
  () => {
225
- o.autoClose && (a.value = !1);
343
+ o.autoClose && (n.value = !1);
226
344
  },
227
- { ignore: [s] }
345
+ { ignore: [d] }
228
346
  );
229
- const le = computed(() => {
230
- var e;
231
- return ((e = s.value) == null ? void 0 : e.getAttribute("id")) ?? void 0;
232
- }), B = computed(() => ({
233
- "aria-controls": m.value,
347
+ const pe = s(() => {
348
+ var t;
349
+ return ((t = d.value) == null ? void 0 : t.getAttribute("id")) ?? void 0;
350
+ }), z = s(() => ({
351
+ "aria-controls": u.value,
234
352
  "aria-haspopup": !0,
235
- "aria-expanded": a.value
236
- })), { component: ae, bus: re } = useProvideDropdownTrigger({
237
- reference: s,
238
- id: m,
239
- expanded: a,
240
- aria: B
353
+ "aria-expanded": n.value
354
+ })), { component: ve, bus: me } = Qe({
355
+ reference: d,
356
+ id: u,
357
+ expanded: n,
358
+ aria: z
241
359
  });
242
- re.on("click", $);
243
- const { role: P, modifiers: ne } = toRefs(o), { itemRole: se } = useProvideDropdownItem({ role: P, expanded: a }), ie = useBemModifiers(
360
+ me.on("click", R);
361
+ const { role: F, modifiers: be } = M(o), { itemRole: ge } = Xe({ role: F, expanded: n }), he = Ze(
244
362
  "vv-dropdown",
245
- ne,
246
- computed(() => ({
363
+ be,
364
+ s(() => ({
247
365
  arrow: o.arrow
248
366
  }))
249
- ), { focused: i } = useFocusWithin(n);
250
- function g(e) {
251
- return e ? [
252
- ...e.querySelectorAll(
367
+ ), { focused: b } = We(c);
368
+ function $(t) {
369
+ return t ? [
370
+ ...t.querySelectorAll(
253
371
  'a[href], button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])'
254
372
  )
255
373
  ].filter(
256
- (l) => !l.hasAttribute("disabled") && !l.getAttribute("aria-hidden")
374
+ (r) => !r.hasAttribute("disabled") && !r.getAttribute("aria-hidden")
257
375
  ) : [];
258
376
  }
259
- const ue = () => {
260
- nextTick(() => {
261
- if (i.value) {
262
- const e = g(
263
- n.value
377
+ const ye = () => {
378
+ D(() => {
379
+ if (b.value) {
380
+ const t = $(
381
+ c.value
264
382
  );
265
- if (e.length === 0 || !document.activeElement)
383
+ if (t.length === 0 || !document.activeElement)
266
384
  return;
267
- const l = e.indexOf(
385
+ const r = t.indexOf(
268
386
  document.activeElement
269
387
  );
270
- l < e.length - 1 ? e[l + 1].focus() : e[0].focus();
388
+ r < t.length - 1 ? t[r + 1].focus() : t[0].focus();
271
389
  }
272
390
  });
273
- }, fe = () => {
274
- nextTick(() => {
275
- if (i.value) {
276
- const e = g(
277
- n.value
391
+ }, Ee = () => {
392
+ D(() => {
393
+ if (b.value) {
394
+ const t = $(
395
+ c.value
278
396
  );
279
- if (e.length === 0 || !document.activeElement)
397
+ if (t.length === 0 || !document.activeElement)
280
398
  return;
281
- const l = e.indexOf(
399
+ const r = t.indexOf(
282
400
  document.activeElement
283
401
  );
284
- l > 0 ? e[l - 1].focus() : e[e.length - 1].focus();
402
+ r > 0 ? t[r - 1].focus() : t[t.length - 1].focus();
285
403
  }
286
404
  });
287
405
  };
288
- return onKeyStroke("Escape", (e) => {
289
- a.value && (e.preventDefault(), _());
290
- }), onKeyStroke("ArrowDown", (e) => {
291
- a.value && i.value && (e.preventDefault(), ue());
292
- }), onKeyStroke("ArrowUp", (e) => {
293
- a.value && i.value && (e.preventDefault(), fe());
294
- }), onKeyStroke([" ", "Enter"], (e) => {
295
- a.value && i.value && (e.preventDefault(), document.activeElement.click());
296
- }), (e, l) => (A(), N(ce, null, [
297
- V(r(ae), null, {
298
- default: j(() => [
299
- c(e.$slots, "default", p(v({ init: oe, show: te, hide: _, toggle: $, expanded: r(a), aria: r(B) })))
406
+ return _("Escape", (t) => {
407
+ n.value && (t.preventDefault(), W());
408
+ }), _("ArrowDown", (t) => {
409
+ n.value && b.value && (t.preventDefault(), ye());
410
+ }), _("ArrowUp", (t) => {
411
+ n.value && b.value && (t.preventDefault(), Ee());
412
+ }), _([" ", "Enter"], (t) => {
413
+ n.value && b.value && (t.preventDefault(), document.activeElement.click());
414
+ }), (t, r) => (T(), K(Z, null, [
415
+ L(a(ve), null, {
416
+ default: U(() => [
417
+ E(t.$slots, "default", w(x({ init: de, show: ce, hide: W, toggle: R, expanded: a(n), aria: a(z) })))
300
418
  ]),
301
419
  _: 3
302
420
  }),
303
- V(pe, { name: e.transitionName }, {
304
- default: j(() => [
305
- ve(C("div", {
421
+ L(Se, { name: t.transitionName }, {
422
+ default: U(() => [
423
+ Pe(q("div", {
306
424
  ref_key: "floatingEl",
307
- ref: n,
308
- style: W(r(Y)),
309
- class: me(r(ie))
425
+ ref: c,
426
+ style: G(a(ue)),
427
+ class: $e(a(he))
310
428
  }, [
311
- o.arrow ? (A(), N("div", {
429
+ o.arrow ? (T(), K("div", {
312
430
  key: 0,
313
431
  ref_key: "arrowEl",
314
- ref: u,
315
- style: W(r(ee)),
432
+ ref: g,
433
+ style: G(a(fe)),
316
434
  class: "vv-dropdown__arrow"
317
- }, null, 4)) : he("", !0),
318
- c(e.$slots, "before", p(v({ expanded: r(a) }))),
319
- C("ul", be(r(q), {
320
- id: r(m),
435
+ }, null, 4)) : De("", !0),
436
+ E(t.$slots, "before", w(x({ expanded: a(n) }))),
437
+ q("ul", Ne(a(i), {
438
+ id: a(u),
321
439
  ref_key: "listEl",
322
- ref: H,
323
- tabindex: r(a) ? void 0 : -1,
324
- role: r(P),
325
- "aria-labelledby": r(le),
440
+ ref: oe,
441
+ tabindex: a(n) ? void 0 : -1,
442
+ role: a(F),
443
+ "aria-labelledby": a(pe),
326
444
  class: "vv-dropdown__list"
327
445
  }), [
328
- c(e.$slots, "items", p(v({
329
- role: r(se)
446
+ E(t.$slots, "items", w(x({
447
+ role: a(ge)
330
448
  })))
331
- ], 16, De),
332
- c(e.$slots, "after", p(v({ expanded: r(a) })))
449
+ ], 16, et),
450
+ E(t.$slots, "after", w(x({ expanded: a(n) })))
333
451
  ], 6), [
334
- [ge, r(a)]
452
+ [je, a(n)]
335
453
  ])
336
454
  ]),
337
455
  _: 3
@@ -340,5 +458,5 @@ const Se = {
340
458
  }
341
459
  });
342
460
  export {
343
- Pe as default
461
+ st as default
344
462
  };
@@ -1 +1 @@
1
- (function(t,l){typeof exports=="object"&&typeof module<"u"?module.exports=l(require("vue"),require("@floating-ui/vue")):typeof define=="function"&&define.amd?define(["vue","@floating-ui/vue"],l):(t=typeof globalThis<"u"?globalThis:t||self,t.VvDropdown=l(t.vue,t.vue$1))})(this,function(t,l){"use strict";var p=(o=>(o.left="left",o.right="right",o.top="top",o.bottom="bottom",o))(p||{}),v=(o=>(o.topStart="top-start",o.topEnd="top-end",o.bottomStart="bottom-start",o.bottomEnd="bottom-end",o.leftStart="left-start",o.leftEnd="left-end",o.rightStart="right-start",o.rightEnd="right-end",o))(v||{}),m=(o=>(o.before="before",o.after="after",o))(m||{});const V={modifiers:[String,Array]};m.before;const z={id:[String,Number]},N={placement:{type:String,default:p.bottom,validator:o=>Object.values(p).includes(o)||Object.values(v).includes(o)},transitionName:{type:String},offset:{type:[Number,String,Object],default:0},shift:{type:[Boolean,Object],default:!1},flip:{type:[Boolean,Object],default:!0},size:{type:[Boolean,Object],default:()=>({padding:10})},autoPlacement:{type:[Boolean,Object],default:!1},arrow:{type:Boolean,default:!1},autoClose:{type:Boolean,default:!0},autofocusFirst:{type:Boolean,default:!0},triggerWidth:{type:Boolean}},w=["listbox","menu"],j={...z,...V,...N,modelValue:{type:Boolean,default:void 0},reference:{type:Object,default:null},role:{type:String,default:w[1],validator:o=>w.includes(o)}},A=["id","tabindex","role","aria-labelledby"],R={name:"VvDropdown",inheritAttrs:!1};return t.defineComponent({...R,props:j,emits:["update:modelValue"],setup(o,{emit:C}){const r=o,{id:W}=toRefs(r),h=useUniqueId(W),T=useAttrs(),x=ref("auto"),E=ref("auto"),S=ref(null),s=ref(null),u=ref(null),F=ref(null),i=computed({get:()=>r.reference??S.value,set:e=>{S.value=e}}),I=computed(()=>{const e=[];if(r.autoPlacement?typeof r.autoPlacement=="boolean"?e.push(l.autoPlacement()):e.push(l.autoPlacement(r.autoPlacement)):r.flip&&(typeof r.flip=="boolean"?e.push(l.flip()):e.push(l.flip(r.flip))),r.shift&&(typeof r.shift=="boolean"?e.push(l.shift()):e.push(l.shift(r.shift))),r.size){const n=({availableWidth:d,availableHeight:c})=>{x.value=`${d}px`,E.value=`${c}px`};typeof r.size=="boolean"?e.push(l.size({apply:n})):e.push(l.size({...r.size,apply:n}))}return r.offset&&(e.push(l.offset(Number(r.offset))),["string","number"].includes(typeof r.offset)?e.push(l.offset(Number(r.offset))):e.push(l.offset(r.offset))),r.arrow&&e.push(l.arrow({element:u})),e}),{x:K,y:M,strategy:q,middlewareData:P,placement:U}=l.useFloating(i,s,{whileElementsMounted:l.autoUpdate,placement:r.placement,middleware:I}),H=computed(()=>({position:q.value,top:`${M.value??0}px`,left:`${K.value??0}px`,maxWidth:x.value,maxHeight:E.value,width:r.triggerWidth&&i.value?`${i.value.offsetWidth}px`:void 0})),L=computed(()=>U.value.split("-")[0]),b=computed(()=>({top:"bottom",right:"left",bottom:"top",left:"right"})[L.value]??"bottom"),$=computed(()=>{var e,n,d,c;return["bottom","top"].includes(b.value)?{right:`${((e=P.value.arrow)==null?void 0:e.x)??0}px`,[b.value]:`${-(((n=u.value)==null?void 0:n.offsetWidth)??0)/2}px`}:{top:`${((d=P.value.arrow)==null?void 0:d.y)??0}px`,[b.value]:`${-(((c=u.value)==null?void 0:c.offsetWidth)??0)/2}px`}}),g=useVModel(r,"modelValue",C),k=ref(!1),a=computed({get:()=>g.value??k.value,set:e=>{if(g.value===void 0){k.value=e;return}g.value=e}}),G=()=>{a.value=!0},_=()=>{a.value=!1},D=()=>{a.value=!a.value},J=e=>{i.value=e};watch(a,e=>{e&&r.autofocusFirst&&nextTick(()=>{const n=y(s.value);n.length>0&&n[0].focus()})}),onClickOutside(s,()=>{r.autoClose&&(a.value=!1)},{ignore:[i]});const Q=computed(()=>{var e;return((e=i.value)==null?void 0:e.getAttribute("id"))??void 0}),O=computed(()=>({"aria-controls":h.value,"aria-haspopup":!0,"aria-expanded":a.value})),{component:X,bus:Y}=useProvideDropdownTrigger({reference:i,id:h,expanded:a,aria:O});Y.on("click",D);const{role:B,modifiers:Z}=toRefs(r),{itemRole:ee}=useProvideDropdownItem({role:B,expanded:a}),te=useBemModifiers("vv-dropdown",Z,computed(()=>({arrow:r.arrow}))),{focused:f}=useFocusWithin(s);function y(e){return e?[...e.querySelectorAll('a[href], button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])')].filter(n=>!n.hasAttribute("disabled")&&!n.getAttribute("aria-hidden")):[]}const oe=()=>{nextTick(()=>{if(f.value){const e=y(s.value);if(e.length===0||!document.activeElement)return;const n=e.indexOf(document.activeElement);n<e.length-1?e[n+1].focus():e[0].focus()}})},re=()=>{nextTick(()=>{if(f.value){const e=y(s.value);if(e.length===0||!document.activeElement)return;const n=e.indexOf(document.activeElement);n>0?e[n-1].focus():e[e.length-1].focus()}})};return onKeyStroke("Escape",e=>{a.value&&(e.preventDefault(),_())}),onKeyStroke("ArrowDown",e=>{a.value&&f.value&&(e.preventDefault(),oe())}),onKeyStroke("ArrowUp",e=>{a.value&&f.value&&(e.preventDefault(),re())}),onKeyStroke([" ","Enter"],e=>{a.value&&f.value&&(e.preventDefault(),document.activeElement.click())}),(e,n)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(t.unref(X),null,{default:t.withCtx(()=>[t.renderSlot(e.$slots,"default",t.normalizeProps(t.guardReactiveProps({init:J,show:G,hide:_,toggle:D,expanded:t.unref(a),aria:t.unref(O)})))]),_:3}),t.createVNode(t.Transition,{name:e.transitionName},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",{ref_key:"floatingEl",ref:s,style:t.normalizeStyle(t.unref(H)),class:t.normalizeClass(t.unref(te))},[r.arrow?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"arrowEl",ref:u,style:t.normalizeStyle(t.unref($)),class:"vv-dropdown__arrow"},null,4)):t.createCommentVNode("",!0),t.renderSlot(e.$slots,"before",t.normalizeProps(t.guardReactiveProps({expanded:t.unref(a)}))),t.createElementVNode("ul",t.mergeProps(t.unref(T),{id:t.unref(h),ref_key:"listEl",ref:F,tabindex:t.unref(a)?void 0:-1,role:t.unref(B),"aria-labelledby":t.unref(Q),class:"vv-dropdown__list"}),[t.renderSlot(e.$slots,"items",t.normalizeProps(t.guardReactiveProps({role:t.unref(ee)})))],16,A),t.renderSlot(e.$slots,"after",t.normalizeProps(t.guardReactiveProps({expanded:t.unref(a)})))],6),[[t.vShow,t.unref(a)]])]),_:3},8,["name"])],64))}})});
1
+ (function(e,a){typeof exports=="object"&&typeof module<"u"?module.exports=a(require("vue"),require("@floating-ui/vue"),require("nanoid"),require("@vueuse/core"),require("mitt")):typeof define=="function"&&define.amd?define(["vue","@floating-ui/vue","nanoid","@vueuse/core","mitt"],a):(e=typeof globalThis<"u"?globalThis:e||self,e.VvDropdown=a(e.vue,e.vue$1,e.nanoid,e.core,e.mitt))})(this,function(e,a,I,u,W){"use strict";var x=(t=>(t.left="left",t.right="right",t.top="top",t.bottom="bottom",t))(x||{}),N=(t=>(t.topStart="top-start",t.topEnd="top-end",t.bottomStart="bottom-start",t.bottomEnd="bottom-end",t.leftStart="left-start",t.leftEnd="left-end",t.rightStart="right-start",t.rightEnd="right-end",t))(N||{}),v=(t=>(t.before="before",t.after="after",t))(v||{}),S=(t=>(t.button="button",t.submit="submit",t.reset="reset",t))(S||{}),g=(t=>(t.listbox="listbox",t.menu="menu",t))(g||{}),_=(t=>(t.option="option",t.presentation="presentation",t))(_||{}),D=(t=>(t._blank="_blank",t._self="_self",t._parent="_parent",t._top="_top",t))(D||{});const T=Symbol.for("dropdownTrigger"),q=Symbol.for("dropdownItem"),F={to:{type:[String,Object]},href:String,target:{type:String,validator:t=>Object.values(D).includes(t)},rel:{type:String,default:"noopener noreferrer"}},K={disabled:Boolean},M={active:Boolean},$={pressed:Boolean},L={label:[String,Number]},U={modifiers:[String,Array]};v.before;const G={id:[String,Number]},H={placement:{type:String,default:x.bottom,validator:t=>Object.values(x).includes(t)||Object.values(N).includes(t)},transitionName:{type:String},offset:{type:[Number,String,Object],default:0},shift:{type:[Boolean,Object],default:!1},flip:{type:[Boolean,Object],default:!0},size:{type:[Boolean,Object],default:()=>({padding:10})},autoPlacement:{type:[Boolean,Object],default:!1},arrow:{type:Boolean,default:!1},autoClose:{type:Boolean,default:!0},autofocusFirst:{type:Boolean,default:!0},triggerWidth:{type:Boolean}};({...K,...L,...$,...M,...F,type:S.button});const J={...G,...U,...H,modelValue:{type:Boolean,default:void 0},reference:{type:Object,default:null},role:{type:String,default:g.menu,validator:t=>Object.values(g).includes(t)}},Y=t=>e.computed(()=>String((t==null?void 0:t.value)||I.nanoid()));function Q({reference:t,id:s,expanded:n,aria:c}){const i=W(),f=e.defineComponent({name:"VvDropdownTriggerProvider",provide(){return{[T]:{reference:t,id:s,expanded:n,aria:c,bus:i}}},setup(){return{}},render(){var m,b;return e.h(e.Fragment,{},(b=(m=this.$slots).default)==null?void 0:b.call(m))}});return{bus:i,component:f}}function X({role:t,expanded:s}){const n=e.computed(()=>t.value===g.listbox?_.option:_.presentation);return e.provide(q,{role:n,expanded:s}),{itemRole:n}}function Z(t,s,n){return e.computed(()=>{const c={[t]:!0},i=typeof(s==null?void 0:s.value)=="string"?s.value.split(" "):s==null?void 0:s.value;return i&&Array.isArray(i)&&i.forEach(f=>{c[`${t}--${f}`]=!0}),n&&Object.keys(n.value).forEach(f=>{c[`${t}--${f}`]=e.unref(n.value[f])}),c})}const ee=["id","tabindex","role","aria-labelledby"],te={name:"VvDropdown",inheritAttrs:!1};return e.defineComponent({...te,props:J,emits:["update:modelValue"],setup(t,{emit:s}){const n=t,{id:c}=e.toRefs(n),i=Y(c),f=e.useAttrs(),m=e.ref("auto"),b=e.ref("auto"),j=e.ref(null),d=e.ref(null),y=e.ref(null),oe=e.ref(null),p=e.computed({get:()=>n.reference??j.value,set:o=>{j.value=o}}),ne=e.computed(()=>{const o=[];if(n.autoPlacement?typeof n.autoPlacement=="boolean"?o.push(a.autoPlacement()):o.push(a.autoPlacement(n.autoPlacement)):n.flip&&(typeof n.flip=="boolean"?o.push(a.flip()):o.push(a.flip(n.flip))),n.shift&&(typeof n.shift=="boolean"?o.push(a.shift()):o.push(a.shift(n.shift))),n.size){const r=({availableWidth:E,availableHeight:w})=>{m.value=`${E}px`,b.value=`${w}px`};typeof n.size=="boolean"?o.push(a.size({apply:r})):o.push(a.size({...n.size,apply:r}))}return n.offset&&(o.push(a.offset(Number(n.offset))),["string","number"].includes(typeof n.offset)?o.push(a.offset(Number(n.offset))):o.push(a.offset(n.offset))),n.arrow&&o.push(a.arrow({element:y})),o}),{x:re,y:ae,strategy:le,middlewareData:B,placement:se}=a.useFloating(p,d,{whileElementsMounted:a.autoUpdate,placement:n.placement,middleware:ne}),ie=e.computed(()=>({position:le.value,top:`${ae.value??0}px`,left:`${re.value??0}px`,maxWidth:m.value,maxHeight:b.value,width:n.triggerWidth&&p.value?`${p.value.offsetWidth}px`:void 0})),fe=e.computed(()=>se.value.split("-")[0]),P=e.computed(()=>({top:"bottom",right:"left",bottom:"top",left:"right"})[fe.value]??"bottom"),ue=e.computed(()=>{var o,r,E,w;return["bottom","top"].includes(P.value)?{right:`${((o=B.value.arrow)==null?void 0:o.x)??0}px`,[P.value]:`${-(((r=y.value)==null?void 0:r.offsetWidth)??0)/2}px`}:{top:`${((E=B.value.arrow)==null?void 0:E.y)??0}px`,[P.value]:`${-(((w=y.value)==null?void 0:w.offsetWidth)??0)/2}px`}}),O=u.useVModel(n,"modelValue",s),V=e.ref(!1),l=e.computed({get:()=>O.value??V.value,set:o=>{if(O.value===void 0){V.value=o;return}O.value=o}}),ce=()=>{l.value=!0},z=()=>{l.value=!1},C=()=>{l.value=!l.value},de=o=>{p.value=o};e.watch(l,o=>{o&&n.autofocusFirst&&e.nextTick(()=>{const r=k(d.value);r.length>0&&r[0].focus()})}),u.onClickOutside(d,()=>{n.autoClose&&(l.value=!1)},{ignore:[p]});const pe=e.computed(()=>{var o;return((o=p.value)==null?void 0:o.getAttribute("id"))??void 0}),R=e.computed(()=>({"aria-controls":i.value,"aria-haspopup":!0,"aria-expanded":l.value})),{component:me,bus:be}=Q({reference:p,id:i,expanded:l,aria:R});be.on("click",C);const{role:A,modifiers:he}=e.toRefs(n),{itemRole:ge}=X({role:A,expanded:l}),ye=Z("vv-dropdown",he,e.computed(()=>({arrow:n.arrow}))),{focused:h}=u.useFocusWithin(d);function k(o){return o?[...o.querySelectorAll('a[href], button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])')].filter(r=>!r.hasAttribute("disabled")&&!r.getAttribute("aria-hidden")):[]}const Ee=()=>{e.nextTick(()=>{if(h.value){const o=k(d.value);if(o.length===0||!document.activeElement)return;const r=o.indexOf(document.activeElement);r<o.length-1?o[r+1].focus():o[0].focus()}})},we=()=>{e.nextTick(()=>{if(h.value){const o=k(d.value);if(o.length===0||!document.activeElement)return;const r=o.indexOf(document.activeElement);r>0?o[r-1].focus():o[o.length-1].focus()}})};return u.onKeyStroke("Escape",o=>{l.value&&(o.preventDefault(),z())}),u.onKeyStroke("ArrowDown",o=>{l.value&&h.value&&(o.preventDefault(),Ee())}),u.onKeyStroke("ArrowUp",o=>{l.value&&h.value&&(o.preventDefault(),we())}),u.onKeyStroke([" ","Enter"],o=>{l.value&&h.value&&(o.preventDefault(),document.activeElement.click())}),(o,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(me),null,{default:e.withCtx(()=>[e.renderSlot(o.$slots,"default",e.normalizeProps(e.guardReactiveProps({init:de,show:ce,hide:z,toggle:C,expanded:e.unref(l),aria:e.unref(R)})))]),_:3}),e.createVNode(e.Transition,{name:o.transitionName},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"floatingEl",ref:d,style:e.normalizeStyle(e.unref(ie)),class:e.normalizeClass(e.unref(ye))},[n.arrow?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"arrowEl",ref:y,style:e.normalizeStyle(e.unref(ue)),class:"vv-dropdown__arrow"},null,4)):e.createCommentVNode("",!0),e.renderSlot(o.$slots,"before",e.normalizeProps(e.guardReactiveProps({expanded:e.unref(l)}))),e.createElementVNode("ul",e.mergeProps(e.unref(f),{id:e.unref(i),ref_key:"listEl",ref:oe,tabindex:e.unref(l)?void 0:-1,role:e.unref(A),"aria-labelledby":e.unref(pe),class:"vv-dropdown__list"}),[e.renderSlot(o.$slots,"items",e.normalizeProps(e.guardReactiveProps({role:e.unref(ge)})))],16,ee),e.renderSlot(o.$slots,"after",e.normalizeProps(e.guardReactiveProps({expanded:e.unref(l)})))],6),[[e.vShow,e.unref(l)]])]),_:3},8,["name"])],64))}})});
@@ -8,9 +8,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
8
8
  default: null;
9
9
  };
10
10
  role: {
11
- type: import("vue").PropType<"menu" | "listbox">;
12
- default: "menu";
13
- validator: (value: string) => boolean;
11
+ type: import("vue").PropType<import("../../constants.js").DropdownRole>;
12
+ default: import("../../constants.js").DropdownRole;
13
+ validator: (value: import("../../constants.js").DropdownRole) => boolean;
14
14
  };
15
15
  placement: {
16
16
  type: import("vue").PropType<import("../../constants.js").Side | import("../../constants.js").Placement>;
@@ -84,9 +84,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
84
84
  default: null;
85
85
  };
86
86
  role: {
87
- type: import("vue").PropType<"menu" | "listbox">;
88
- default: "menu";
89
- validator: (value: string) => boolean;
87
+ type: import("vue").PropType<import("../../constants.js").DropdownRole>;
88
+ default: import("../../constants.js").DropdownRole;
89
+ validator: (value: import("../../constants.js").DropdownRole) => boolean;
90
90
  };
91
91
  placement: {
92
92
  type: import("vue").PropType<import("../../constants.js").Side | import("../../constants.js").Placement>;
@@ -157,11 +157,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
157
157
  shift: boolean | Partial<import("@floating-ui/core").ShiftOptions & Omit<import("@floating-ui/core").DetectOverflowOptions, "boundary"> & {
158
158
  boundary: import("@floating-ui/vue").Boundary;
159
159
  }> | undefined;
160
+ reference: HTMLElement | null;
161
+ role: import("../../constants.js").DropdownRole;
160
162
  flip: boolean | Partial<import("@floating-ui/core").FlipOptions & Omit<import("@floating-ui/core").DetectOverflowOptions, "boundary"> & {
161
163
  boundary: import("@floating-ui/vue").Boundary;
162
164
  }> | undefined;
163
- reference: HTMLElement | null;
164
- role: "menu" | "listbox";
165
165
  placement: import("../../constants.js").Side | import("../../constants.js").Placement;
166
166
  offset: string | import("@floating-ui/core").OffsetOptions | undefined;
167
167
  size: boolean | Partial<Omit<import("@floating-ui/core").SizeOptions, "apply"> & {
@@ -198,7 +198,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
198
198
  expanded: boolean;
199
199
  }) => any;
200
200
  items: (_: {
201
- role: "option" | "presentation";
201
+ role: import("../../constants.js").DropdownItemRole;
202
202
  }) => any;
203
203
  after: (_: {
204
204
  expanded: boolean;