@volverjs/ui-vue 0.0.4 → 0.0.5-beta.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 (215) hide show
  1. package/README.md +2 -2
  2. package/auto-imports.d.ts +12 -3
  3. package/bin/icons.cjs +1 -73
  4. package/dist/Volver.d.ts +19 -11
  5. package/dist/components/VvAccordion/VvAccordion.es.js +165 -106
  6. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  7. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -1
  8. package/dist/components/VvAccordion/index.d.ts +8 -3
  9. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +264 -164
  10. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  11. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +15 -12
  12. package/dist/components/VvAccordionGroup/index.d.ts +8 -0
  13. package/dist/components/VvAction/VvAction.es.js +276 -98
  14. package/dist/components/VvAction/VvAction.umd.js +1 -1
  15. package/dist/components/VvAction/VvAction.vue.d.ts +12 -12
  16. package/dist/components/VvAction/index.d.ts +2 -2
  17. package/dist/components/VvBadge/VvBadge.es.js +213 -44
  18. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  19. package/dist/components/VvBadge/VvBadge.vue.d.ts +2 -2
  20. package/dist/components/VvBadge/index.d.ts +1 -1
  21. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +247 -75
  22. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  23. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +11 -11
  24. package/dist/components/VvBreadcrumb/index.d.ts +1 -1
  25. package/dist/components/VvButton/VvButton.es.js +646 -360
  26. package/dist/components/VvButton/VvButton.umd.js +1 -1
  27. package/dist/components/VvButton/VvButton.vue.d.ts +18 -18
  28. package/dist/components/VvButton/index.d.ts +13 -13
  29. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +261 -79
  30. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  31. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +2 -2
  32. package/dist/components/VvButtonGroup/index.d.ts +1 -1
  33. package/dist/components/VvCard/VvCard.es.js +57 -38
  34. package/dist/components/VvCard/VvCard.umd.js +1 -1
  35. package/dist/components/VvCheckbox/VvCheckbox.es.js +562 -274
  36. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  37. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +2 -2
  38. package/dist/components/VvCheckbox/index.d.ts +5 -5
  39. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +661 -340
  40. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  41. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +7 -7
  42. package/dist/components/VvCheckboxGroup/index.d.ts +3 -3
  43. package/dist/components/VvCombobox/VvCombobox.es.js +1546 -983
  44. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  45. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +138 -51
  46. package/dist/components/VvCombobox/index.d.ts +41 -10
  47. package/dist/components/VvDialog/VvDialog.es.js +387 -141
  48. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  49. package/dist/components/VvDialog/VvDialog.vue.d.ts +12 -3
  50. package/dist/components/VvDialog/index.d.ts +4 -1
  51. package/dist/components/VvDropdown/VvDropdown.es.js +452 -244
  52. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  53. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +130 -42
  54. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +13 -13
  55. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +2 -2
  56. package/dist/components/VvDropdown/index.d.ts +40 -11
  57. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +373 -160
  58. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
  59. package/dist/components/VvDropdownItem/VvDropdownItem.es.js +43 -28
  60. package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
  61. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +285 -90
  62. package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
  63. package/dist/components/VvIcon/VvIcon.es.js +113 -65
  64. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  65. package/dist/components/VvIcon/VvIcon.vue.d.ts +7 -7
  66. package/dist/components/VvIcon/index.d.ts +2 -2
  67. package/dist/components/VvInputText/VvInputPasswordAction.d.ts +2 -2
  68. package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
  69. package/dist/components/VvInputText/VvInputText.es.js +986 -462
  70. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  71. package/dist/components/VvInputText/VvInputText.vue.d.ts +100 -20
  72. package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
  73. package/dist/components/VvInputText/index.d.ts +66 -13
  74. package/dist/components/VvProgress/VvProgress.es.js +216 -45
  75. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  76. package/dist/components/VvProgress/VvProgress.vue.d.ts +2 -2
  77. package/dist/components/VvProgress/index.d.ts +1 -1
  78. package/dist/components/VvRadio/VvRadio.es.js +499 -238
  79. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  80. package/dist/components/VvRadio/VvRadio.vue.d.ts +2 -2
  81. package/dist/components/VvRadio/index.d.ts +5 -5
  82. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +598 -304
  83. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  84. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +7 -7
  85. package/dist/components/VvRadioGroup/index.d.ts +3 -3
  86. package/dist/components/VvSelect/VvSelect.es.js +631 -324
  87. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  88. package/dist/components/VvSelect/VvSelect.vue.d.ts +13 -13
  89. package/dist/components/VvSelect/index.d.ts +3 -3
  90. package/dist/components/VvTextarea/VvTextarea.es.js +676 -355
  91. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  92. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +20 -20
  93. package/dist/components/VvTextarea/index.d.ts +4 -4
  94. package/dist/components/VvTooltip/VvTooltip.es.js +215 -47
  95. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
  96. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +7 -7
  97. package/dist/components/VvTooltip/index.d.ts +2 -2
  98. package/dist/components/index.es.js +3522 -2231
  99. package/dist/components/index.umd.js +1 -1
  100. package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
  101. package/dist/composables/dropdown/useProvideDropdown.d.ts +3 -3
  102. package/dist/composables/group/useInjectedGroupState.d.ts +2 -2
  103. package/dist/composables/group/useProvideGroupState.d.ts +1 -1
  104. package/dist/composables/useComponentFocus.d.ts +1 -1
  105. package/dist/composables/useComponentIcon.d.ts +7 -7
  106. package/dist/composables/useDebouncedInput.d.ts +4 -1
  107. package/dist/composables/useDefaults.d.ts +2 -0
  108. package/dist/composables/useModifiers.d.ts +1 -1
  109. package/dist/composables/useOptions.d.ts +2 -2
  110. package/dist/composables/useTextCount.d.ts +3 -3
  111. package/dist/composables/useUniqueId.d.ts +1 -1
  112. package/dist/composables/useVolver.d.ts +1 -1
  113. package/dist/directives/index.d.ts +1 -0
  114. package/dist/directives/index.es.js +264 -55
  115. package/dist/directives/index.umd.js +1 -1
  116. package/dist/directives/v-contextmenu.d.ts +3 -0
  117. package/dist/directives/v-contextmenu.es.js +42 -0
  118. package/dist/directives/v-contextmenu.umd.js +1 -0
  119. package/dist/directives/v-tooltip.es.js +222 -53
  120. package/dist/directives/v-tooltip.umd.js +1 -1
  121. package/dist/icons.d.ts +3 -1
  122. package/dist/icons.es.js +40 -23
  123. package/dist/icons.umd.js +1 -1
  124. package/dist/index.d.ts +0 -1
  125. package/dist/index.es.js +112 -3607
  126. package/dist/index.umd.js +1 -1
  127. package/dist/props/index.d.ts +50 -18
  128. package/dist/resolvers/unplugin.d.ts +7 -1
  129. package/dist/resolvers/unplugin.es.js +77 -37
  130. package/dist/resolvers/unplugin.umd.js +1 -1
  131. package/dist/stories/Combobox/Combobox.settings.d.ts +12 -0
  132. package/dist/stories/Dropdown/Dropdown.settings.d.ts +12 -0
  133. package/dist/stories/InputText/InputText.settings.d.ts +53 -0
  134. package/dist/stories/argTypes.d.ts +13 -1
  135. package/package.json +126 -40
  136. package/src/Volver.ts +49 -22
  137. package/src/assets/icons/detailed.json +1 -1
  138. package/src/assets/icons/normal.json +1 -1
  139. package/src/assets/icons/simple.json +1 -1
  140. package/src/components/VvAccordion/VvAccordion.vue +19 -22
  141. package/src/components/VvAccordion/index.ts +12 -4
  142. package/src/components/VvAccordionGroup/VvAccordionGroup.vue +19 -10
  143. package/src/components/VvAccordionGroup/index.ts +8 -0
  144. package/src/components/VvAction/VvAction.vue +7 -7
  145. package/src/components/VvAction/index.ts +1 -1
  146. package/src/components/VvBadge/VvBadge.vue +2 -2
  147. package/src/components/VvBadge/index.ts +1 -1
  148. package/src/components/VvBreadcrumb/VvBreadcrumb.vue +3 -3
  149. package/src/components/VvButton/VvButton.vue +11 -11
  150. package/src/components/VvButton/index.ts +10 -9
  151. package/src/components/VvButtonGroup/VvButtonGroup.vue +4 -7
  152. package/src/components/VvButtonGroup/index.ts +1 -1
  153. package/src/components/VvCard/VvCard.vue +2 -2
  154. package/src/components/VvCheckbox/VvCheckbox.vue +3 -7
  155. package/src/components/VvCheckbox/index.ts +11 -7
  156. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +7 -10
  157. package/src/components/VvCheckboxGroup/index.ts +1 -1
  158. package/src/components/VvCombobox/VvCombobox.vue +44 -26
  159. package/src/components/VvCombobox/index.ts +1 -1
  160. package/src/components/VvDialog/VvDialog.vue +28 -11
  161. package/src/components/VvDialog/index.ts +5 -2
  162. package/src/components/VvDropdown/VvDropdown.vue +7 -5
  163. package/src/components/VvDropdown/VvDropdownAction.vue +7 -5
  164. package/src/components/VvDropdown/VvDropdownOption.vue +17 -10
  165. package/src/components/VvDropdown/index.ts +3 -3
  166. package/src/components/VvIcon/VvIcon.vue +3 -3
  167. package/src/components/VvIcon/index.ts +3 -3
  168. package/src/components/VvInputText/VvInputClearAction.ts +2 -2
  169. package/src/components/VvInputText/VvInputPasswordAction.ts +3 -4
  170. package/src/components/VvInputText/VvInputStepAction.ts +3 -2
  171. package/src/components/VvInputText/VvInputText.vue +130 -37
  172. package/src/components/VvInputText/VvInputTextActions.ts +5 -8
  173. package/src/components/VvInputText/index.ts +62 -1
  174. package/src/components/VvProgress/VvProgress.vue +2 -2
  175. package/src/components/VvProgress/index.ts +1 -1
  176. package/src/components/VvRadio/VvRadio.vue +3 -7
  177. package/src/components/VvRadio/index.ts +11 -7
  178. package/src/components/VvRadioGroup/VvRadioGroup.vue +7 -10
  179. package/src/components/VvRadioGroup/index.ts +1 -1
  180. package/src/components/VvSelect/VvSelect.vue +4 -4
  181. package/src/components/VvSelect/index.ts +1 -1
  182. package/src/components/VvTextarea/VvTextarea.vue +6 -6
  183. package/src/components/VvTextarea/index.ts +1 -1
  184. package/src/components/VvTooltip/VvTooltip.vue +2 -2
  185. package/src/components/VvTooltip/index.ts +3 -3
  186. package/src/composables/dropdown/useInjectDropdown.ts +2 -2
  187. package/src/composables/dropdown/useProvideDropdown.ts +2 -2
  188. package/src/composables/group/useInjectedGroupState.ts +1 -1
  189. package/src/composables/group/useProvideGroupState.ts +1 -1
  190. package/src/composables/useComponentIcon.ts +1 -1
  191. package/src/composables/useDebouncedInput.ts +10 -3
  192. package/src/composables/useDefaults.ts +89 -0
  193. package/src/composables/useModifiers.ts +4 -2
  194. package/src/composables/useOptions.ts +1 -1
  195. package/src/composables/useVolver.ts +2 -2
  196. package/src/directives/index.ts +3 -1
  197. package/src/directives/v-contextmenu.ts +40 -0
  198. package/src/directives/v-tooltip.ts +2 -2
  199. package/src/icons.ts +1 -1
  200. package/src/index.ts +0 -2
  201. package/src/props/index.ts +20 -10
  202. package/src/resolvers/unplugin.ts +15 -1
  203. package/src/stories/Accordion/Accordion.stories.mdx +8 -2
  204. package/src/stories/Accordion/Accordion.test.ts +21 -15
  205. package/src/stories/Accordion/AccordionSlots.stories.mdx +8 -8
  206. package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +17 -1
  207. package/src/stories/AccordionGroup/AccordionGroup.test.ts +18 -12
  208. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +1 -1
  209. package/src/stories/Dropdown/DropdownContextmenuDirective.stories.mdx +41 -0
  210. package/src/stories/InputText/InputText.settings.ts +53 -0
  211. package/src/stories/InputText/InputText.stories.mdx +40 -0
  212. package/src/stories/InputText/InputText.test.ts +5 -2
  213. package/src/stories/Tooltip/TooltipDirective.stories.mdx +1 -1
  214. package/src/stories/argTypes.ts +12 -2
  215. package/src/types/group.d.ts +5 -0
@@ -1,38 +1,53 @@
1
- import { inject as d, provide as l, defineComponent as f, ref as p, watch as _, openBlock as a, createElementBlock as v, mergeProps as I, unref as t, renderSlot as w } from "vue";
1
+ import { inject, provide, defineComponent, ref, watch, openBlock, createElementBlock, mergeProps, unref, renderSlot } from "vue";
2
2
  import "mitt";
3
- import { useElementHover as D, useFocus as E, useFocusWithin as N } from "@vueuse/core";
4
- var u = /* @__PURE__ */ ((e) => (e.button = "button", e.link = "link", e.menuitem = "menuitem", e))(u || {});
5
- const O = Symbol.for("dropdownItem"), b = Symbol.for("dropdownAction");
6
- function h() {
7
- return d(O, {});
3
+ import { useElementHover, useFocus, useFocusWithin } from "@vueuse/core";
4
+ var ActionRoles = /* @__PURE__ */ ((ActionRoles2) => {
5
+ ActionRoles2["button"] = "button";
6
+ ActionRoles2["link"] = "link";
7
+ ActionRoles2["menuitem"] = "menuitem";
8
+ return ActionRoles2;
9
+ })(ActionRoles || {});
10
+ const INJECTION_KEY_DROPDOWN_ITEM = Symbol.for("dropdownItem");
11
+ const INJECTION_KEY_DROPDOWN_ACTION = Symbol.for("dropdownAction");
12
+ function useInjectedDropdownItem() {
13
+ return inject(INJECTION_KEY_DROPDOWN_ITEM, {});
8
14
  }
9
- function k({
10
- expanded: e
15
+ function useProvideDropdownAction({
16
+ expanded
11
17
  }) {
12
- l(b, {
13
- role: u.menuitem,
14
- expanded: e
18
+ provide(INJECTION_KEY_DROPDOWN_ACTION, {
19
+ role: ActionRoles.menuitem,
20
+ expanded
15
21
  });
16
22
  }
17
- const C = {
23
+ const __default__ = {
18
24
  name: "VvDropdownItem"
19
- }, S = /* @__PURE__ */ f({
20
- ...C,
21
- setup(e) {
22
- const { role: s, expanded: c } = h(), o = p(null);
23
- k({ expanded: c });
24
- const m = D(o), { focused: r } = E(o), { focused: i } = N(o);
25
- return _(m, (n) => {
26
- n && (r.value = !0);
27
- }), (n, P) => (a(), v("li", I({ role: t(s) }, {
28
- ref_key: "element",
29
- ref: o,
30
- class: ["vv-dropdown__item", { "focus-visible": t(r) || t(i) }]
31
- }), [
32
- w(n.$slots, "default")
33
- ], 16));
25
+ };
26
+ const _sfc_main = /* @__PURE__ */ defineComponent({
27
+ ...__default__,
28
+ setup(__props) {
29
+ const { role, expanded } = useInjectedDropdownItem();
30
+ const element = ref(null);
31
+ useProvideDropdownAction({ expanded });
32
+ const hovered = useElementHover(element);
33
+ const { focused } = useFocus(element);
34
+ const { focused: focusedWithin } = useFocusWithin(element);
35
+ watch(hovered, (newValue) => {
36
+ if (newValue) {
37
+ focused.value = true;
38
+ }
39
+ });
40
+ return (_ctx, _cache) => {
41
+ return openBlock(), createElementBlock("li", mergeProps({ role: unref(role) }, {
42
+ ref_key: "element",
43
+ ref: element,
44
+ class: ["vv-dropdown__item", { "focus-visible": unref(focused) || unref(focusedWithin) }]
45
+ }), [
46
+ renderSlot(_ctx.$slots, "default")
47
+ ], 16);
48
+ };
34
49
  }
35
50
  });
36
51
  export {
37
- S as default
52
+ _sfc_main as default
38
53
  };
@@ -1 +1 @@
1
- (function(e,t){typeof exports=="object"&&typeof module<"u"?module.exports=t(require("vue"),require("mitt"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["vue","mitt","@vueuse/core"],t):(e=typeof globalThis<"u"?globalThis:e||self,e.VvDropdownItem=t(e.vue,null,e.core))})(this,function(e,t,r){"use strict";var u=(n=>(n.button="button",n.link="link",n.menuitem="menuitem",n))(u||{});const d=Symbol.for("dropdownItem"),c=Symbol.for("dropdownAction");function f(){return e.inject(d,{})}function m({expanded:n}){e.provide(c,{role:u.menuitem,expanded:n})}const l={name:"VvDropdownItem"};return e.defineComponent({...l,setup(n){const{role:p,expanded:_}=f(),o=e.ref(null);m({expanded:_});const I=r.useElementHover(o),{focused:s}=r.useFocus(o),{focused:a}=r.useFocusWithin(o);return e.watch(I,i=>{i&&(s.value=!0)}),(i,w)=>(e.openBlock(),e.createElementBlock("li",e.mergeProps({role:e.unref(p)},{ref_key:"element",ref:o,class:["vv-dropdown__item",{"focus-visible":e.unref(s)||e.unref(a)}]}),[e.renderSlot(i.$slots,"default")],16))}})});
1
+ !function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("mitt"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","mitt","@vueuse/core"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvDropdownItem=o(e.vue,null,e.core)}(this,(function(e,o,n){"use strict";var t=(e=>(e.button="button",e.link="link",e.menuitem="menuitem",e))(t||{});const u=Symbol.for("dropdownItem"),r=Symbol.for("dropdownAction");return e.defineComponent({name:"VvDropdownItem",setup(o){const{role:i,expanded:d}=e.inject(u,{}),l=e.ref(null);!function({expanded:o}){e.provide(r,{role:t.menuitem,expanded:o})}({expanded:d});const s=n.useElementHover(l),{focused:f}=n.useFocus(l),{focused:c}=n.useFocusWithin(l);return e.watch(s,(e=>{e&&(f.value=!0)})),(o,n)=>(e.openBlock(),e.createElementBlock("li",e.mergeProps({role:e.unref(i)},{ref_key:"element",ref:l,class:["vv-dropdown__item",{"focus-visible":e.unref(f)||e.unref(c)}]}),[e.renderSlot(o.$slots,"default")],16))}})}));
@@ -1,38 +1,90 @@
1
- import { inject as B, provide as E, defineComponent as y, ref as N, watch as w, openBlock as s, createElementBlock as i, mergeProps as k, unref as a, renderSlot as u, computed as g, toRefs as C, createBlock as D, normalizeClass as I, withCtx as P, createElementVNode as $, normalizeProps as L, guardReactiveProps as H, Fragment as f, createTextVNode as m, toDisplayString as v, createCommentVNode as V } from "vue";
1
+ import { inject, provide, defineComponent, ref, watch, openBlock, createElementBlock, mergeProps, unref, renderSlot, computed, toRefs, createBlock, normalizeClass, withCtx, createElementVNode, normalizeProps, guardReactiveProps, createTextVNode, toDisplayString } from "vue";
2
2
  import "mitt";
3
- import { useElementHover as W, useFocus as F, useFocusWithin as z } from "@vueuse/core";
4
- var c = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(c || {}), _ = /* @__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))(_ || {}), p = /* @__PURE__ */ ((e) => (e.before = "before", e.after = "after", e))(p || {}), b = /* @__PURE__ */ ((e) => (e.button = "button", e.submit = "submit", e.reset = "reset", e))(b || {}), O = /* @__PURE__ */ ((e) => (e.button = "button", e.link = "link", e.menuitem = "menuitem", e))(O || {}), S = /* @__PURE__ */ ((e) => (e._blank = "_blank", e._self = "_self", e._parent = "_parent", e._top = "_top", e))(S || {});
5
- const A = Symbol.for("dropdownItem"), M = Symbol.for("dropdownAction");
6
- function R() {
7
- return B(A, {});
3
+ import { useElementHover, useFocus, useFocusWithin } from "@vueuse/core";
4
+ var Side = /* @__PURE__ */ ((Side2) => {
5
+ Side2["left"] = "left";
6
+ Side2["right"] = "right";
7
+ Side2["top"] = "top";
8
+ Side2["bottom"] = "bottom";
9
+ return Side2;
10
+ })(Side || {});
11
+ var Placement = /* @__PURE__ */ ((Placement2) => {
12
+ Placement2["topStart"] = "top-start";
13
+ Placement2["topEnd"] = "top-end";
14
+ Placement2["bottomStart"] = "bottom-start";
15
+ Placement2["bottomEnd"] = "bottom-end";
16
+ Placement2["leftStart"] = "left-start";
17
+ Placement2["leftEnd"] = "left-end";
18
+ Placement2["rightStart"] = "right-start";
19
+ Placement2["rightEnd"] = "right-end";
20
+ return Placement2;
21
+ })(Placement || {});
22
+ var Position = /* @__PURE__ */ ((Position2) => {
23
+ Position2["before"] = "before";
24
+ Position2["after"] = "after";
25
+ return Position2;
26
+ })(Position || {});
27
+ var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
28
+ ButtonType2["button"] = "button";
29
+ ButtonType2["submit"] = "submit";
30
+ ButtonType2["reset"] = "reset";
31
+ return ButtonType2;
32
+ })(ButtonType || {});
33
+ var ActionRoles = /* @__PURE__ */ ((ActionRoles2) => {
34
+ ActionRoles2["button"] = "button";
35
+ ActionRoles2["link"] = "link";
36
+ ActionRoles2["menuitem"] = "menuitem";
37
+ return ActionRoles2;
38
+ })(ActionRoles || {});
39
+ var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
40
+ AnchorTarget2["_blank"] = "_blank";
41
+ AnchorTarget2["_self"] = "_self";
42
+ AnchorTarget2["_parent"] = "_parent";
43
+ AnchorTarget2["_top"] = "_top";
44
+ return AnchorTarget2;
45
+ })(AnchorTarget || {});
46
+ const INJECTION_KEY_DROPDOWN_ITEM = Symbol.for("dropdownItem");
47
+ const INJECTION_KEY_DROPDOWN_ACTION = Symbol.for("dropdownAction");
48
+ function useInjectedDropdownItem() {
49
+ return inject(INJECTION_KEY_DROPDOWN_ITEM, {});
8
50
  }
9
- function J({
10
- expanded: e
51
+ function useProvideDropdownAction({
52
+ expanded
11
53
  }) {
12
- E(M, {
13
- role: O.menuitem,
14
- expanded: e
54
+ provide(INJECTION_KEY_DROPDOWN_ACTION, {
55
+ role: ActionRoles.menuitem,
56
+ expanded
15
57
  });
16
58
  }
17
- const K = {
59
+ const __default__$1 = {
18
60
  name: "VvDropdownItem"
19
- }, Y = /* @__PURE__ */ y({
20
- ...K,
21
- setup(e) {
22
- const { role: o, expanded: l } = R(), n = N(null);
23
- J({ expanded: l });
24
- const t = W(n), { focused: r } = F(n), { focused: j } = z(n);
25
- return w(t, (d) => {
26
- d && (r.value = !0);
27
- }), (d, oe) => (s(), i("li", k({ role: a(o) }, {
28
- ref_key: "element",
29
- ref: n,
30
- class: ["vv-dropdown__item", { "focus-visible": a(r) || a(j) }]
31
- }), [
32
- u(d.$slots, "default")
33
- ], 16));
61
+ };
62
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
63
+ ...__default__$1,
64
+ setup(__props) {
65
+ const { role, expanded } = useInjectedDropdownItem();
66
+ const element = ref(null);
67
+ useProvideDropdownAction({ expanded });
68
+ const hovered = useElementHover(element);
69
+ const { focused } = useFocus(element);
70
+ const { focused: focusedWithin } = useFocusWithin(element);
71
+ watch(hovered, (newValue) => {
72
+ if (newValue) {
73
+ focused.value = true;
74
+ }
75
+ });
76
+ return (_ctx, _cache) => {
77
+ return openBlock(), createElementBlock("li", mergeProps({ role: unref(role) }, {
78
+ ref_key: "element",
79
+ ref: element,
80
+ class: ["vv-dropdown__item", { "focus-visible": unref(focused) || unref(focusedWithin) }]
81
+ }), [
82
+ renderSlot(_ctx.$slots, "default")
83
+ ], 16);
84
+ };
34
85
  }
35
- }), U = {
86
+ });
87
+ const LinkProps = {
36
88
  /**
37
89
  * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
38
90
  * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
@@ -49,7 +101,7 @@ const K = {
49
101
  */
50
102
  target: {
51
103
  type: String,
52
- validator: (e) => Object.values(S).includes(e)
104
+ validator: (value) => Object.values(AnchorTarget).includes(value)
53
105
  },
54
106
  /**
55
107
  * Anchor rel
@@ -58,77 +110,209 @@ const K = {
58
110
  type: String,
59
111
  default: "noopener noreferrer"
60
112
  }
61
- }, h = {
113
+ };
114
+ const DisabledProps = {
62
115
  /**
63
116
  * Whether the form control is disabled
64
117
  */
65
118
  disabled: Boolean
66
- }, q = {
119
+ };
120
+ const SelectedProps = {
67
121
  /**
68
122
  * Whether the item is selected
69
123
  */
70
124
  selected: Boolean
71
- }, G = {
125
+ };
126
+ const ActiveProps = {
72
127
  /**
73
128
  * Whether the item is active
74
129
  */
75
130
  active: Boolean
76
- }, Q = {
131
+ };
132
+ const PressedProps = {
77
133
  /**
78
134
  * Whether the item is pressed
79
135
  */
80
136
  pressed: Boolean
81
- }, T = {
137
+ };
138
+ const LabelProps = {
82
139
  /**
83
140
  * The item label
84
141
  */
85
142
  label: [String, Number]
86
- }, X = {
143
+ };
144
+ const ModifiersProps = {
87
145
  /**
88
146
  * Component BEM modifiers
89
147
  */
90
148
  modifiers: [String, Array]
91
149
  };
92
- p.before;
93
- const Z = {
150
+ ({
151
+ /**
152
+ * VvIcon name or props
153
+ * @see VVIcon
154
+ */
155
+ icon: { type: [String, Object] },
156
+ /**
157
+ * VvIcon position
158
+ */
159
+ iconPosition: {
160
+ type: String,
161
+ default: Position.before,
162
+ validation: (value) => Object.values(Position).includes(value)
163
+ }
164
+ });
165
+ const UnselectableProps = {
94
166
  /**
95
167
  * If true the input will be unselectable
96
168
  */
97
- unselectable: { type: Boolean, default: !0 }
169
+ unselectable: { type: Boolean, default: true }
98
170
  };
99
- c.bottom;
100
171
  ({
101
- ...h,
102
- ...T,
103
- ...Q,
104
- ...G,
105
- ...U,
172
+ /**
173
+ * Dropdown placement
174
+ */
175
+ placement: {
176
+ type: String,
177
+ default: Side.bottom,
178
+ validator: (value) => {
179
+ return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
180
+ }
181
+ },
182
+ /**
183
+ * Dropdown strategy
184
+ */
185
+ strategy: {
186
+ type: String,
187
+ default: "absolute",
188
+ validator: (value) => {
189
+ return ["fixed", "absolute"].includes(value);
190
+ }
191
+ },
192
+ /**
193
+ * Dropdown show / hide transition name
194
+ */
195
+ transitionName: {
196
+ type: String
197
+ },
198
+ /**
199
+ * Offset of the dropdown from the trigger
200
+ * @see https://floating-ui.com/docs/offset
201
+ */
202
+ offset: {
203
+ type: [Number, String, Object],
204
+ default: 0
205
+ },
206
+ /**
207
+ * Move dropdown to the side if there is no space in the default position
208
+ * @see https://floating-ui.com/docs/shift
209
+ */
210
+ shift: {
211
+ type: [Boolean, Object],
212
+ default: false
213
+ },
214
+ /**
215
+ * Flip dropdown position if there is no space in the default position
216
+ * @see https://floating-ui.com/docs/flip
217
+ */
218
+ flip: {
219
+ type: [Boolean, Object],
220
+ default: true
221
+ },
222
+ /**
223
+ * Size of the dropdown
224
+ * @see https://floating-ui.com/docs/size
225
+ */
226
+ size: {
227
+ type: [Boolean, Object],
228
+ default: () => ({ padding: 10 })
229
+ },
230
+ /**
231
+ * Automatically change the position of the dropdown
232
+ * @see https://floating-ui.com/docs/autoPlacement
233
+ */
234
+ autoPlacement: {
235
+ type: [Boolean, Object],
236
+ default: false
237
+ },
238
+ /**
239
+ * Add arrow to the dropdown
240
+ * @see https://floating-ui.com/docs/arrow
241
+ */
242
+ arrow: {
243
+ type: Boolean,
244
+ default: false
245
+ },
246
+ /**
247
+ * Close dropdown on click outside
248
+ */
249
+ autoClose: {
250
+ type: Boolean,
251
+ default: true
252
+ },
253
+ /**
254
+ * Autofocus first item on dropdown open
255
+ */
256
+ autofocusFirst: {
257
+ type: Boolean,
258
+ default: true
259
+ },
260
+ /**
261
+ * Set dropdown width to the same as the trigger
262
+ */
263
+ triggerWidth: {
264
+ type: Boolean
265
+ }
266
+ });
267
+ ({
268
+ ...DisabledProps,
269
+ ...LabelProps,
270
+ ...PressedProps,
271
+ ...ActiveProps,
272
+ ...LinkProps,
106
273
  /**
107
274
  * Button type
108
275
  */
109
- type: b.button
276
+ type: {
277
+ type: String,
278
+ default: ButtonType.button,
279
+ validator: (value) => Object.values(ButtonType).includes(value)
280
+ }
110
281
  });
111
- function x(e, o, l) {
112
- return g(() => {
113
- const n = {
114
- [e]: !0
115
- }, t = typeof (o == null ? void 0 : o.value) == "string" ? o.value.split(" ") : o == null ? void 0 : o.value;
116
- return t && Array.isArray(t) && t.forEach((r) => {
117
- n[`${e}--${r}`] = !0;
118
- }), l && Object.keys(l.value).forEach((r) => {
119
- n[`${e}--${r}`] = a(l.value[r]);
120
- }), n;
282
+ function useModifiers(prefix, modifiers, others) {
283
+ return computed(() => {
284
+ const toReturn = {
285
+ [prefix]: true
286
+ };
287
+ const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
288
+ if (modifiersArray) {
289
+ if (Array.isArray(modifiersArray)) {
290
+ modifiersArray.forEach((modifier) => {
291
+ if (modifier) {
292
+ toReturn[`${prefix}--${modifier}`] = true;
293
+ }
294
+ });
295
+ }
296
+ }
297
+ if (others) {
298
+ Object.keys(others.value).forEach((key) => {
299
+ toReturn[`${prefix}--${key}`] = unref(others.value[key]);
300
+ });
301
+ }
302
+ return toReturn;
121
303
  });
122
304
  }
123
- const ee = { class: "vv-dropdown-option__hint" }, te = {
305
+ const _hoisted_1 = ["title"];
306
+ const __default__ = {
124
307
  name: "VvDropdownOption"
125
- }, ae = /* @__PURE__ */ y({
126
- ...te,
308
+ };
309
+ const _sfc_main = /* @__PURE__ */ defineComponent({
310
+ ...__default__,
127
311
  props: {
128
- ...h,
129
- ...q,
130
- ...Z,
131
- ...X,
312
+ ...DisabledProps,
313
+ ...SelectedProps,
314
+ ...UnselectableProps,
315
+ ...ModifiersProps,
132
316
  deselectHintLabel: {
133
317
  type: String
134
318
  },
@@ -139,38 +323,49 @@ const ee = { class: "vv-dropdown-option__hint" }, te = {
139
323
  type: String
140
324
  }
141
325
  },
142
- setup(e) {
143
- const o = e, { modifiers: l } = C(o), n = x(
326
+ setup(__props) {
327
+ const props = __props;
328
+ const { modifiers } = toRefs(props);
329
+ const bemCssClasses = useModifiers(
144
330
  "vv-dropdown-option",
145
- l,
146
- g(() => ({
147
- disabled: o.disabled,
148
- selected: o.selected,
149
- unselectable: o.unselectable && o.selected
331
+ modifiers,
332
+ computed(() => ({
333
+ disabled: props.disabled,
334
+ selected: props.selected,
335
+ unselectable: props.unselectable && props.selected
150
336
  }))
151
337
  );
152
- return (t, r) => (s(), D(Y, {
153
- class: I(a(n)),
154
- tabindex: t.disabled ? -1 : 0,
155
- "aria-selected": t.selected,
156
- "aria-disabled": t.disabled
157
- }, {
158
- default: P(() => [
159
- u(t.$slots, "default"),
160
- $("span", ee, [
161
- u(t.$slots, "hint", L(H({ disabled: t.disabled, selected: t.selected, unselectable: t.unselectable })), () => [
162
- t.selected ? (s(), i(f, { key: 0 }, [
163
- m(v(t.unselectable ? e.deselectHintLabel : e.selectedHintLabel), 1)
164
- ], 64)) : t.disabled ? V("", !0) : (s(), i(f, { key: 1 }, [
165
- m(v(e.selectHintLabel), 1)
166
- ], 64))
167
- ])
168
- ])
169
- ]),
170
- _: 3
171
- }, 8, ["class", "tabindex", "aria-selected", "aria-disabled"]));
338
+ const hintLabel = computed(() => {
339
+ if (props.selected) {
340
+ return props.unselectable ? props.deselectHintLabel : props.selectedHintLabel;
341
+ }
342
+ if (!props.disabled) {
343
+ return props.selectHintLabel;
344
+ }
345
+ });
346
+ return (_ctx, _cache) => {
347
+ return openBlock(), createBlock(_sfc_main$1, {
348
+ class: normalizeClass(unref(bemCssClasses)),
349
+ tabindex: _ctx.disabled ? -1 : 0,
350
+ "aria-selected": _ctx.selected,
351
+ "aria-disabled": _ctx.disabled
352
+ }, {
353
+ default: withCtx(() => [
354
+ renderSlot(_ctx.$slots, "default"),
355
+ createElementVNode("span", {
356
+ class: "vv-dropdown-option__hint",
357
+ title: unref(hintLabel)
358
+ }, [
359
+ renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps({ disabled: _ctx.disabled, selected: _ctx.selected, unselectable: _ctx.unselectable })), () => [
360
+ createTextVNode(toDisplayString(unref(hintLabel)), 1)
361
+ ])
362
+ ], 8, _hoisted_1)
363
+ ]),
364
+ _: 3
365
+ }, 8, ["class", "tabindex", "aria-selected", "aria-disabled"]);
366
+ };
172
367
  }
173
368
  });
174
369
  export {
175
- ae as default
370
+ _sfc_main as default
176
371
  };
@@ -1 +1 @@
1
- (function(t,a){typeof exports=="object"&&typeof module<"u"?module.exports=a(require("vue"),require("mitt"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["vue","mitt","@vueuse/core"],a):(t=typeof globalThis<"u"?globalThis:t||self,t.VvDropdownOption=a(t.vue,null,t.core))})(this,function(t,a,i){"use strict";var d=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(d||{}),f=(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))(f||{}),c=(e=>(e.before="before",e.after="after",e))(c||{}),u=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(u||{}),b=(e=>(e.button="button",e.link="link",e.menuitem="menuitem",e))(b||{}),m=(e=>(e._blank="_blank",e._self="_self",e._parent="_parent",e._top="_top",e))(m||{});const g=Symbol.for("dropdownItem"),S=Symbol.for("dropdownAction");function _(){return t.inject(g,{})}function O({expanded:e}){t.provide(S,{role:b.menuitem,expanded:e})}const B={name:"VvDropdownItem"},h=t.defineComponent({...B,setup(e){const{role:o,expanded:s}=_(),r=t.ref(null);O({expanded:s});const n=i.useElementHover(r),{focused:l}=i.useFocus(r),{focused:L}=i.useFocusWithin(r);return t.watch(n,p=>{p&&(l.value=!0)}),(p,V)=>(t.openBlock(),t.createElementBlock("li",t.mergeProps({role:t.unref(o)},{ref_key:"element",ref:r,class:["vv-dropdown__item",{"focus-visible":t.unref(l)||t.unref(L)}]}),[t.renderSlot(p.$slots,"default")],16))}}),j={to:{type:[String,Object]},href:String,target:{type:String,validator:e=>Object.values(m).includes(e)},rel:{type:String,default:"noopener noreferrer"}},y={disabled:Boolean},k={selected:Boolean},E={active:Boolean},N={pressed:Boolean},w={label:[String,Number]},D={modifiers:[String,Array]};c.before;const C={unselectable:{type:Boolean,default:!0}};d.bottom,{...y,...w,...N,...E,...j,type:u.button};function I(e,o,s){return t.computed(()=>{const r={[e]:!0},n=typeof(o==null?void 0:o.value)=="string"?o.value.split(" "):o==null?void 0:o.value;return n&&Array.isArray(n)&&n.forEach(l=>{r[`${e}--${l}`]=!0}),s&&Object.keys(s.value).forEach(l=>{r[`${e}--${l}`]=t.unref(s.value[l])}),r})}const P={class:"vv-dropdown-option__hint"},$={name:"VvDropdownOption"};return t.defineComponent({...$,props:{...y,...k,...C,...D,deselectHintLabel:{type:String},selectHintLabel:{type:String},selectedHintLabel:{type:String}},setup(e){const o=e,{modifiers:s}=t.toRefs(o),r=I("vv-dropdown-option",s,t.computed(()=>({disabled:o.disabled,selected:o.selected,unselectable:o.unselectable&&o.selected})));return(n,l)=>(t.openBlock(),t.createBlock(h,{class:t.normalizeClass(t.unref(r)),tabindex:n.disabled?-1:0,"aria-selected":n.selected,"aria-disabled":n.disabled},{default:t.withCtx(()=>[t.renderSlot(n.$slots,"default"),t.createElementVNode("span",P,[t.renderSlot(n.$slots,"hint",t.normalizeProps(t.guardReactiveProps({disabled:n.disabled,selected:n.selected,unselectable:n.unselectable})),()=>[n.selected?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createTextVNode(t.toDisplayString(n.unselectable?e.deselectHintLabel:e.selectedHintLabel),1)],64)):n.disabled?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(e.selectHintLabel),1)],64))])])]),_:3},8,["class","tabindex","aria-selected","aria-disabled"]))}})});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("mitt"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","mitt","@vueuse/core"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvDropdownOption=t(e.vue,null,e.core)}(this,(function(e,t,o){"use strict";var n=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(n||{}),l=(e=>(e.before="before",e.after="after",e))(l||{}),r=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(r||{}),s=(e=>(e.button="button",e.link="link",e.menuitem="menuitem",e))(s||{});const d=Symbol.for("dropdownItem"),i=Symbol.for("dropdownAction");const a=e.defineComponent({name:"VvDropdownItem",setup(t){const{role:n,expanded:l}=e.inject(d,{}),r=e.ref(null);!function({expanded:t}){e.provide(i,{role:s.menuitem,expanded:t})}({expanded:l});const a=o.useElementHover(r),{focused:u}=o.useFocus(r),{focused:c}=o.useFocusWithin(r);return e.watch(a,(e=>{e&&(u.value=!0)})),(t,o)=>(e.openBlock(),e.createElementBlock("li",e.mergeProps({role:e.unref(n)},{ref_key:"element",ref:r,class:["vv-dropdown__item",{"focus-visible":e.unref(u)||e.unref(c)}]}),[e.renderSlot(t.$slots,"default")],16))}}),u={disabled:Boolean},c={selected:Boolean},f=(Boolean,Boolean,{modifiers:[String,Array]});l.before;const p={unselectable:{type:Boolean,default:!0}};n.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,r.button;const b=["title"];return e.defineComponent({name:"VvDropdownOption",props:{...u,...c,...p,...f,deselectHintLabel:{type:String},selectHintLabel:{type:String},selectedHintLabel:{type:String}},setup(t){const o=t,{modifiers:n}=e.toRefs(o),l=function(t,o,n){return e.computed((()=>{const l={[t]:!0},r="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return r&&Array.isArray(r)&&r.forEach((e=>{e&&(l[`${t}--${e}`]=!0)})),n&&Object.keys(n.value).forEach((o=>{l[`${t}--${o}`]=e.unref(n.value[o])})),l}))}("vv-dropdown-option",n,e.computed((()=>({disabled:o.disabled,selected:o.selected,unselectable:o.unselectable&&o.selected})))),r=e.computed((()=>o.selected?o.unselectable?o.deselectHintLabel:o.selectedHintLabel:o.disabled?void 0:o.selectHintLabel));return(t,o)=>(e.openBlock(),e.createBlock(a,{class:e.normalizeClass(e.unref(l)),tabindex:t.disabled?-1:0,"aria-selected":t.selected,"aria-disabled":t.disabled},{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default"),e.createElementVNode("span",{class:"vv-dropdown-option__hint",title:e.unref(r)},[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps({disabled:t.disabled,selected:t.selected,unselectable:t.unselectable})),(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)),1)]))],8,b)])),_:3},8,["class","tabindex","aria-selected","aria-disabled"]))}})}));