@volverjs/ui-vue 0.0.3 → 0.0.5-beta.1

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 (236) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +54 -15
  3. package/auto-imports.d.ts +12 -3
  4. package/bin/icons.cjs +1 -73
  5. package/dist/Volver.d.ts +23 -11
  6. package/dist/components/VvAccordion/VvAccordion.es.js +180 -74
  7. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  8. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -1
  9. package/dist/components/VvAccordion/index.d.ts +8 -3
  10. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +280 -122
  11. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  12. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +15 -12
  13. package/dist/components/VvAccordionGroup/index.d.ts +8 -0
  14. package/dist/components/VvAction/VvAction.es.js +338 -0
  15. package/dist/components/VvAction/VvAction.umd.js +1 -0
  16. package/dist/components/VvAction/VvAction.vue.d.ts +63 -0
  17. package/dist/components/VvAction/index.d.ts +24 -0
  18. package/dist/components/VvBadge/VvBadge.es.js +251 -22
  19. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  20. package/dist/components/VvBadge/VvBadge.vue.d.ts +2 -2
  21. package/dist/components/VvBadge/index.d.ts +1 -1
  22. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +280 -62
  23. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  24. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +11 -11
  25. package/dist/components/VvBreadcrumb/index.d.ts +1 -1
  26. package/dist/components/VvButton/VvButton.es.js +720 -261
  27. package/dist/components/VvButton/VvButton.umd.js +1 -1
  28. package/dist/components/VvButton/VvButton.vue.d.ts +54 -54
  29. package/dist/components/VvButton/index.d.ts +30 -75
  30. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +296 -49
  31. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  32. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +2 -2
  33. package/dist/components/VvButtonGroup/index.d.ts +1 -1
  34. package/dist/components/VvCard/VvCard.es.js +60 -28
  35. package/dist/components/VvCard/VvCard.umd.js +1 -1
  36. package/dist/components/VvCheckbox/VvCheckbox.es.js +630 -172
  37. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  38. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +4 -4
  39. package/dist/components/VvCheckbox/index.d.ts +6 -6
  40. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +736 -228
  41. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  42. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +9 -9
  43. package/dist/components/VvCheckboxGroup/index.d.ts +4 -4
  44. package/dist/components/VvCombobox/VvCombobox.es.js +1673 -768
  45. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  46. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +159 -61
  47. package/dist/components/VvCombobox/index.d.ts +54 -23
  48. package/dist/components/VvDialog/VvDialog.es.js +426 -115
  49. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  50. package/dist/components/VvDialog/VvDialog.vue.d.ts +12 -3
  51. package/dist/components/VvDialog/index.d.ts +4 -1
  52. package/dist/components/VvDropdown/VvDropdown.es.js +504 -190
  53. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  54. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +114 -42
  55. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +61 -0
  56. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +52 -0
  57. package/dist/components/VvDropdown/index.d.ts +35 -14
  58. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +454 -0
  59. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -0
  60. package/dist/components/VvDropdownItem/VvDropdownItem.es.js +48 -18
  61. package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
  62. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +361 -0
  63. package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -0
  64. package/dist/components/VvIcon/VvIcon.es.js +116 -52
  65. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  66. package/dist/components/VvIcon/VvIcon.vue.d.ts +7 -7
  67. package/dist/components/VvIcon/index.d.ts +2 -2
  68. package/dist/components/VvInputText/VvInputPasswordAction.d.ts +2 -2
  69. package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
  70. package/dist/components/VvInputText/VvInputText.es.js +1054 -376
  71. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  72. package/dist/components/VvInputText/VvInputText.vue.d.ts +107 -20
  73. package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
  74. package/dist/components/VvInputText/index.d.ts +67 -3
  75. package/dist/components/VvProgress/VvProgress.es.js +254 -23
  76. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  77. package/dist/components/VvProgress/VvProgress.vue.d.ts +2 -2
  78. package/dist/components/VvProgress/index.d.ts +1 -1
  79. package/dist/components/VvRadio/VvRadio.es.js +568 -137
  80. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  81. package/dist/components/VvRadio/VvRadio.vue.d.ts +4 -4
  82. package/dist/components/VvRadio/index.d.ts +6 -6
  83. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +674 -193
  84. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  85. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +9 -9
  86. package/dist/components/VvRadioGroup/index.d.ts +4 -4
  87. package/dist/components/VvSelect/VvSelect.es.js +703 -251
  88. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  89. package/dist/components/VvSelect/VvSelect.vue.d.ts +24 -17
  90. package/dist/components/VvSelect/index.d.ts +8 -8
  91. package/dist/components/VvTextarea/VvTextarea.es.js +747 -272
  92. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  93. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +21 -14
  94. package/dist/components/VvTextarea/index.d.ts +7 -7
  95. package/dist/components/VvTooltip/VvTooltip.es.js +252 -24
  96. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
  97. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +7 -7
  98. package/dist/components/VvTooltip/index.d.ts +2 -2
  99. package/dist/components/index.es.js +3676 -2007
  100. package/dist/components/index.umd.js +1 -1
  101. package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
  102. package/dist/composables/dropdown/useProvideDropdown.d.ts +3 -3
  103. package/dist/composables/group/useInjectedGroupState.d.ts +2 -2
  104. package/dist/composables/group/useProvideGroupState.d.ts +1 -1
  105. package/dist/composables/useComponentFocus.d.ts +1 -1
  106. package/dist/composables/useComponentIcon.d.ts +7 -7
  107. package/dist/composables/useDebouncedInput.d.ts +4 -1
  108. package/dist/composables/useDefaults.d.ts +2 -0
  109. package/dist/composables/useModifiers.d.ts +1 -1
  110. package/dist/composables/useOptions.d.ts +2 -2
  111. package/dist/composables/useTextCount.d.ts +3 -3
  112. package/dist/composables/useUniqueId.d.ts +1 -1
  113. package/dist/composables/useVolver.d.ts +1 -1
  114. package/dist/constants.d.ts +30 -0
  115. package/dist/directives/index.es.js +288 -0
  116. package/dist/directives/index.umd.js +1 -0
  117. package/dist/directives/v-tooltip.es.js +285 -0
  118. package/dist/directives/v-tooltip.umd.js +1 -0
  119. package/dist/icons.es.js +38 -23
  120. package/dist/icons.umd.js +1 -1
  121. package/dist/index.d.ts +0 -1
  122. package/dist/index.es.js +115 -3269
  123. package/dist/index.umd.js +1 -1
  124. package/dist/props/index.d.ts +215 -23
  125. package/dist/resolvers/unplugin.d.ts +14 -8
  126. package/dist/resolvers/unplugin.es.js +94 -33
  127. package/dist/resolvers/unplugin.umd.js +1 -1
  128. package/dist/stories/Combobox/Combobox.settings.d.ts +44 -0
  129. package/dist/stories/Dropdown/Dropdown.settings.d.ts +3 -2
  130. package/dist/stories/InputText/InputText.settings.d.ts +53 -0
  131. package/dist/stories/argTypes.d.ts +1 -1
  132. package/package.json +167 -63
  133. package/src/Volver.ts +60 -26
  134. package/src/assets/icons/detailed.json +1 -1
  135. package/src/assets/icons/normal.json +1 -1
  136. package/src/assets/icons/simple.json +1 -1
  137. package/src/components/VvAccordion/VvAccordion.vue +19 -22
  138. package/src/components/VvAccordion/index.ts +12 -4
  139. package/src/components/VvAccordionGroup/VvAccordionGroup.vue +19 -10
  140. package/src/components/VvAccordionGroup/index.ts +8 -0
  141. package/src/components/VvAction/VvAction.vue +144 -0
  142. package/src/components/VvAction/index.ts +5 -0
  143. package/src/components/VvBadge/VvBadge.vue +2 -2
  144. package/src/components/VvBadge/index.ts +1 -1
  145. package/src/components/VvBreadcrumb/VvBreadcrumb.vue +3 -3
  146. package/src/components/VvButton/VvButton.vue +41 -124
  147. package/src/components/VvButton/index.ts +16 -88
  148. package/src/components/VvButtonGroup/VvButtonGroup.vue +4 -7
  149. package/src/components/VvButtonGroup/index.ts +1 -1
  150. package/src/components/VvCard/VvCard.vue +2 -2
  151. package/src/components/VvCheckbox/VvCheckbox.vue +3 -7
  152. package/src/components/VvCheckbox/index.ts +11 -7
  153. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +7 -10
  154. package/src/components/VvCheckboxGroup/index.ts +1 -1
  155. package/src/components/VvCombobox/VvCombobox.vue +85 -57
  156. package/src/components/VvCombobox/index.ts +12 -10
  157. package/src/components/VvDialog/VvDialog.vue +28 -11
  158. package/src/components/VvDialog/index.ts +5 -2
  159. package/src/components/VvDropdown/VvDropdown.vue +6 -5
  160. package/src/components/VvDropdown/VvDropdownAction.vue +46 -0
  161. package/src/components/VvDropdown/VvDropdownOption.vue +72 -0
  162. package/src/components/VvDropdown/index.ts +6 -11
  163. package/src/components/VvIcon/VvIcon.vue +3 -3
  164. package/src/components/VvIcon/index.ts +3 -3
  165. package/src/components/VvInputText/VvInputClearAction.ts +2 -2
  166. package/src/components/VvInputText/VvInputPasswordAction.ts +3 -4
  167. package/src/components/VvInputText/VvInputStepAction.ts +3 -2
  168. package/src/components/VvInputText/VvInputText.vue +128 -35
  169. package/src/components/VvInputText/VvInputTextActions.ts +5 -8
  170. package/src/components/VvInputText/index.ts +62 -1
  171. package/src/components/VvProgress/VvProgress.vue +2 -2
  172. package/src/components/VvProgress/index.ts +1 -1
  173. package/src/components/VvRadio/VvRadio.vue +3 -7
  174. package/src/components/VvRadio/index.ts +11 -7
  175. package/src/components/VvRadioGroup/VvRadioGroup.vue +7 -10
  176. package/src/components/VvRadioGroup/index.ts +1 -1
  177. package/src/components/VvSelect/VvSelect.vue +4 -4
  178. package/src/components/VvSelect/index.ts +3 -5
  179. package/src/components/VvTextarea/VvTextarea.vue +4 -4
  180. package/src/components/VvTextarea/index.ts +1 -1
  181. package/src/components/VvTooltip/VvTooltip.vue +2 -2
  182. package/src/components/VvTooltip/index.ts +3 -3
  183. package/src/composables/dropdown/useInjectDropdown.ts +2 -2
  184. package/src/composables/dropdown/useProvideDropdown.ts +9 -11
  185. package/src/composables/group/useInjectedGroupState.ts +1 -1
  186. package/src/composables/group/useProvideGroupState.ts +1 -1
  187. package/src/composables/useComponentIcon.ts +1 -1
  188. package/src/composables/useDebouncedInput.ts +10 -3
  189. package/src/composables/useDefaults.ts +89 -0
  190. package/src/composables/useModifiers.ts +8 -9
  191. package/src/composables/useOptions.ts +1 -1
  192. package/src/composables/useVolver.ts +2 -2
  193. package/src/constants.ts +36 -0
  194. package/src/directives/index.ts +1 -1
  195. package/src/directives/v-tooltip.ts +2 -2
  196. package/src/index.ts +0 -2
  197. package/src/props/index.ts +111 -19
  198. package/src/resolvers/unplugin.ts +96 -49
  199. package/src/stories/Accordion/Accordion.stories.mdx +8 -2
  200. package/src/stories/Accordion/Accordion.test.ts +21 -15
  201. package/src/stories/Accordion/AccordionSlots.stories.mdx +8 -8
  202. package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +17 -1
  203. package/src/stories/AccordionGroup/AccordionGroup.test.ts +18 -12
  204. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +3 -2
  205. package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +2 -1
  206. package/src/stories/Button/Button.stories.mdx +4 -2
  207. package/src/stories/Button/Button.test.ts +3 -1
  208. package/src/stories/Button/ButtonModifiers.stories.mdx +2 -2
  209. package/src/stories/Button/ButtonSlots.stories.mdx +8 -7
  210. package/src/stories/Button/ButtonState.stories.mdx +2 -11
  211. package/src/stories/Card/Card.stories.mdx +2 -1
  212. package/src/stories/Checkbox/Checkbox.stories.mdx +2 -1
  213. package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +2 -1
  214. package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +2 -1
  215. package/src/stories/Combobox/Combobox.settings.ts +44 -0
  216. package/src/stories/Combobox/Combobox.stories.mdx +40 -1
  217. package/src/stories/Dialog/Dialog.stories.mdx +2 -1
  218. package/src/stories/Dropdown/Dropdown.settings.ts +3 -2
  219. package/src/stories/Dropdown/Dropdown.stories.mdx +14 -12
  220. package/src/stories/Dropdown/DropdownMultilevel.stories.mdx +56 -0
  221. package/src/stories/Dropdown/DropdownSlots.stories.mdx +14 -13
  222. package/src/stories/Icon/Icon.stories.mdx +2 -1
  223. package/src/stories/Icon/IconsCollection.stories.mdx +2 -1
  224. package/src/stories/InputText/InputText.settings.ts +53 -0
  225. package/src/stories/InputText/InputText.stories.mdx +42 -1
  226. package/src/stories/InputText/InputText.test.ts +5 -2
  227. package/src/stories/Progress/Progress.stories.mdx +2 -1
  228. package/src/stories/Radio/Radio.stories.mdx +2 -1
  229. package/src/stories/RadioGroup/RadioGroup.stories.mdx +2 -1
  230. package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +2 -1
  231. package/src/stories/Select/Select.stories.mdx +2 -1
  232. package/src/stories/Textarea/Textarea.stories.mdx +2 -1
  233. package/src/stories/Tooltip/Tooltip.stories.mdx +2 -1
  234. package/src/stories/Tooltip/TooltipDirective.stories.mdx +2 -1
  235. package/src/stories/argTypes.ts +2 -2
  236. package/src/types/group.d.ts +5 -0
@@ -0,0 +1,454 @@
1
+ import { inject, defineComponent, ref, watch, computed, openBlock, createBlock, resolveDynamicComponent, unref, mergeProps, withCtx, renderSlot, createTextVNode, toDisplayString, provide, createElementBlock, toRefs, createVNode } from "vue";
2
+ import "mitt";
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 ActionTag = /* @__PURE__ */ ((ActionTag2) => {
34
+ ActionTag2["nuxtLink"] = "nuxt-link";
35
+ ActionTag2["routerLink"] = "router-link";
36
+ ActionTag2["a"] = "a";
37
+ ActionTag2["button"] = "button";
38
+ return ActionTag2;
39
+ })(ActionTag || {});
40
+ var ActionRoles = /* @__PURE__ */ ((ActionRoles2) => {
41
+ ActionRoles2["button"] = "button";
42
+ ActionRoles2["link"] = "link";
43
+ ActionRoles2["menuitem"] = "menuitem";
44
+ return ActionRoles2;
45
+ })(ActionRoles || {});
46
+ var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
47
+ AnchorTarget2["_blank"] = "_blank";
48
+ AnchorTarget2["_self"] = "_self";
49
+ AnchorTarget2["_parent"] = "_parent";
50
+ AnchorTarget2["_top"] = "_top";
51
+ return AnchorTarget2;
52
+ })(AnchorTarget || {});
53
+ const INJECTION_KEY_VOLVER = Symbol.for("volver");
54
+ const INJECTION_KEY_DROPDOWN_TRIGGER = Symbol.for("dropdownTrigger");
55
+ const INJECTION_KEY_DROPDOWN_ITEM = Symbol.for("dropdownItem");
56
+ const INJECTION_KEY_DROPDOWN_ACTION = Symbol.for("dropdownAction");
57
+ const LinkProps = {
58
+ /**
59
+ * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
60
+ * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
61
+ */
62
+ to: {
63
+ type: [String, Object]
64
+ },
65
+ /**
66
+ * Anchor href
67
+ */
68
+ href: String,
69
+ /**
70
+ * Anchor target
71
+ */
72
+ target: {
73
+ type: String,
74
+ validator: (value) => Object.values(AnchorTarget).includes(value)
75
+ },
76
+ /**
77
+ * Anchor rel
78
+ */
79
+ rel: {
80
+ type: String,
81
+ default: "noopener noreferrer"
82
+ }
83
+ };
84
+ const DisabledProps = {
85
+ /**
86
+ * Whether the form control is disabled
87
+ */
88
+ disabled: Boolean
89
+ };
90
+ const ActiveProps = {
91
+ /**
92
+ * Whether the item is active
93
+ */
94
+ active: Boolean
95
+ };
96
+ const PressedProps = {
97
+ /**
98
+ * Whether the item is pressed
99
+ */
100
+ pressed: Boolean
101
+ };
102
+ const LabelProps = {
103
+ /**
104
+ * The item label
105
+ */
106
+ label: [String, Number]
107
+ };
108
+ const ModifiersProps = {
109
+ /**
110
+ * Component BEM modifiers
111
+ */
112
+ modifiers: [String, Array]
113
+ };
114
+ ({
115
+ /**
116
+ * VvIcon name or props
117
+ * @see VVIcon
118
+ */
119
+ icon: { type: [String, Object] },
120
+ /**
121
+ * VvIcon position
122
+ */
123
+ iconPosition: {
124
+ type: String,
125
+ default: Position.before,
126
+ validation: (value) => Object.values(Position).includes(value)
127
+ }
128
+ });
129
+ ({
130
+ /**
131
+ * Dropdown placement
132
+ */
133
+ placement: {
134
+ type: String,
135
+ default: Side.bottom,
136
+ validator: (value) => {
137
+ return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
138
+ }
139
+ },
140
+ /**
141
+ * Dropdown show / hide transition name
142
+ */
143
+ transitionName: {
144
+ type: String
145
+ },
146
+ /**
147
+ * Offset of the dropdown from the trigger
148
+ * @see https://floating-ui.com/docs/offset
149
+ */
150
+ offset: {
151
+ type: [Number, String, Object],
152
+ default: 0
153
+ },
154
+ /**
155
+ * Move dropdown to the side if there is no space in the default position
156
+ * @see https://floating-ui.com/docs/shift
157
+ */
158
+ shift: {
159
+ type: [Boolean, Object],
160
+ default: false
161
+ },
162
+ /**
163
+ * Flip dropdown position if there is no space in the default position
164
+ * @see https://floating-ui.com/docs/flip
165
+ */
166
+ flip: {
167
+ type: [Boolean, Object],
168
+ default: true
169
+ },
170
+ /**
171
+ * Size of the dropdown
172
+ * @see https://floating-ui.com/docs/size
173
+ */
174
+ size: {
175
+ type: [Boolean, Object],
176
+ default: () => ({ padding: 10 })
177
+ },
178
+ /**
179
+ * Automatically change the position of the dropdown
180
+ * @see https://floating-ui.com/docs/autoPlacement
181
+ */
182
+ autoPlacement: {
183
+ type: [Boolean, Object],
184
+ default: false
185
+ },
186
+ /**
187
+ * Add arrow to the dropdown
188
+ * @see https://floating-ui.com/docs/arrow
189
+ */
190
+ arrow: {
191
+ type: Boolean,
192
+ default: false
193
+ },
194
+ /**
195
+ * Close dropdown on click outside
196
+ */
197
+ autoClose: {
198
+ type: Boolean,
199
+ default: true
200
+ },
201
+ /**
202
+ * Autofocus first item on dropdown open
203
+ */
204
+ autofocusFirst: {
205
+ type: Boolean,
206
+ default: true
207
+ },
208
+ /**
209
+ * Set dropdown width to the same as the trigger
210
+ */
211
+ triggerWidth: {
212
+ type: Boolean
213
+ }
214
+ });
215
+ const ActionProps = {
216
+ ...DisabledProps,
217
+ ...LabelProps,
218
+ ...PressedProps,
219
+ ...ActiveProps,
220
+ ...LinkProps,
221
+ /**
222
+ * Button type
223
+ */
224
+ type: {
225
+ type: String,
226
+ default: ButtonType.button,
227
+ validator: (value) => Object.values(ButtonType).includes(value)
228
+ }
229
+ };
230
+ const VvActionEvents = ["click", "mouseover", "mouseleave"];
231
+ const VvActionProps = ActionProps;
232
+ function useVolver() {
233
+ return inject(INJECTION_KEY_VOLVER);
234
+ }
235
+ function useInjectedDropdownTrigger() {
236
+ return inject(INJECTION_KEY_DROPDOWN_TRIGGER, {});
237
+ }
238
+ function useInjectedDropdownItem() {
239
+ return inject(INJECTION_KEY_DROPDOWN_ITEM, {});
240
+ }
241
+ function useInjectedDropdownAction() {
242
+ return inject(INJECTION_KEY_DROPDOWN_ACTION, {});
243
+ }
244
+ const __default__$2 = {
245
+ name: "VvAction"
246
+ };
247
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
248
+ ...__default__$2,
249
+ props: VvActionProps,
250
+ emits: VvActionEvents,
251
+ setup(__props, { expose, emit }) {
252
+ const props = __props;
253
+ const volver = useVolver();
254
+ const element = ref(null);
255
+ expose({ $el: element });
256
+ const {
257
+ reference: dropdownTriggerReference,
258
+ bus: dropdownEventBus,
259
+ aria: dropdownAria,
260
+ expanded: dropdownExpanded
261
+ } = useInjectedDropdownTrigger();
262
+ watch(
263
+ () => element.value,
264
+ (newValue) => {
265
+ if (dropdownTriggerReference) {
266
+ dropdownTriggerReference.value = newValue;
267
+ }
268
+ }
269
+ );
270
+ const pressed = computed(() => {
271
+ return props.pressed || (dropdownExpanded == null ? void 0 : dropdownExpanded.value);
272
+ });
273
+ const { role } = useInjectedDropdownAction();
274
+ const hasTag = computed(() => {
275
+ switch (true) {
276
+ case props.disabled:
277
+ return ActionTag.button;
278
+ case props.to !== void 0:
279
+ return (volver == null ? void 0 : volver.nuxt) ? ActionTag.nuxtLink : ActionTag.routerLink;
280
+ case props.href !== void 0:
281
+ return ActionTag.a;
282
+ default:
283
+ return ActionTag.button;
284
+ }
285
+ });
286
+ const hasProps = computed(() => {
287
+ const toReturn = {
288
+ ...dropdownAria == null ? void 0 : dropdownAria.value,
289
+ "aria-pressed": pressed.value ? true : void 0,
290
+ role
291
+ };
292
+ switch (hasTag.value) {
293
+ case ActionTag.a:
294
+ return {
295
+ ...toReturn,
296
+ href: props.href,
297
+ target: props.target,
298
+ rel: props.rel
299
+ };
300
+ case ActionTag.routerLink:
301
+ case ActionTag.nuxtLink:
302
+ return {
303
+ ...toReturn,
304
+ to: props.to,
305
+ target: props.target
306
+ };
307
+ default:
308
+ return {
309
+ ...toReturn,
310
+ type: props.type,
311
+ disabled: props.disabled
312
+ };
313
+ }
314
+ });
315
+ const onClick = (e) => {
316
+ if (props.disabled) {
317
+ e.preventDefault();
318
+ return;
319
+ }
320
+ dropdownEventBus == null ? void 0 : dropdownEventBus.emit("click", e);
321
+ emit("click", e);
322
+ };
323
+ const onMouseover = (e) => {
324
+ dropdownEventBus == null ? void 0 : dropdownEventBus.emit("mouseover", e);
325
+ emit("mouseover", e);
326
+ };
327
+ const onMouseleave = (e) => {
328
+ dropdownEventBus == null ? void 0 : dropdownEventBus.emit("mouseleave", e);
329
+ emit("mouseleave", e);
330
+ };
331
+ return (_ctx, _cache) => {
332
+ return openBlock(), createBlock(resolveDynamicComponent(unref(hasTag)), mergeProps(unref(hasProps), {
333
+ ref_key: "element",
334
+ ref: element,
335
+ class: {
336
+ active: _ctx.active,
337
+ pressed: unref(pressed),
338
+ disabled: _ctx.disabled
339
+ },
340
+ onClickPassive: onClick,
341
+ onMouseoverPassive: onMouseover,
342
+ onMouseleavePassive: onMouseleave
343
+ }), {
344
+ default: withCtx(() => [
345
+ renderSlot(_ctx.$slots, "default", {}, () => [
346
+ createTextVNode(toDisplayString(_ctx.label), 1)
347
+ ])
348
+ ]),
349
+ _: 3
350
+ }, 16, ["class"]);
351
+ };
352
+ }
353
+ });
354
+ function useProvideDropdownAction({
355
+ expanded
356
+ }) {
357
+ provide(INJECTION_KEY_DROPDOWN_ACTION, {
358
+ role: ActionRoles.menuitem,
359
+ expanded
360
+ });
361
+ }
362
+ const __default__$1 = {
363
+ name: "VvDropdownItem"
364
+ };
365
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
366
+ ...__default__$1,
367
+ setup(__props) {
368
+ const { role, expanded } = useInjectedDropdownItem();
369
+ const element = ref(null);
370
+ useProvideDropdownAction({ expanded });
371
+ const hovered = useElementHover(element);
372
+ const { focused } = useFocus(element);
373
+ const { focused: focusedWithin } = useFocusWithin(element);
374
+ watch(hovered, (newValue) => {
375
+ if (newValue) {
376
+ focused.value = true;
377
+ }
378
+ });
379
+ return (_ctx, _cache) => {
380
+ return openBlock(), createElementBlock("li", mergeProps({ role: unref(role) }, {
381
+ ref_key: "element",
382
+ ref: element,
383
+ class: ["vv-dropdown__item", { "focus-visible": unref(focused) || unref(focusedWithin) }]
384
+ }), [
385
+ renderSlot(_ctx.$slots, "default")
386
+ ], 16);
387
+ };
388
+ }
389
+ });
390
+ function useModifiers(prefix, modifiers, others) {
391
+ return computed(() => {
392
+ const toReturn = {
393
+ [prefix]: true
394
+ };
395
+ const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
396
+ if (modifiersArray) {
397
+ if (Array.isArray(modifiersArray)) {
398
+ modifiersArray.forEach((modifier) => {
399
+ if (modifier) {
400
+ toReturn[`${prefix}--${modifier}`] = true;
401
+ }
402
+ });
403
+ }
404
+ }
405
+ if (others) {
406
+ Object.keys(others.value).forEach((key) => {
407
+ toReturn[`${prefix}--${key}`] = unref(others.value[key]);
408
+ });
409
+ }
410
+ return toReturn;
411
+ });
412
+ }
413
+ const __default__ = {
414
+ name: "VvDropdownAction"
415
+ };
416
+ const _sfc_main = /* @__PURE__ */ defineComponent({
417
+ ...__default__,
418
+ props: {
419
+ ...ActionProps,
420
+ ...ModifiersProps
421
+ },
422
+ setup(__props) {
423
+ const props = __props;
424
+ const { modifiers } = toRefs(props);
425
+ const bemCssClasses = useModifiers("vv-dropdown-action", modifiers);
426
+ return (_ctx, _cache) => {
427
+ return openBlock(), createBlock(_sfc_main$1, null, {
428
+ default: withCtx(() => [
429
+ createVNode(_sfc_main$2, mergeProps({
430
+ disabled: _ctx.disabled,
431
+ pressed: _ctx.pressed,
432
+ active: _ctx.active,
433
+ type: _ctx.type,
434
+ to: _ctx.to,
435
+ href: _ctx.href,
436
+ target: _ctx.target,
437
+ rel: _ctx.rel
438
+ }, { class: unref(bemCssClasses) }), {
439
+ default: withCtx(() => [
440
+ renderSlot(_ctx.$slots, "default", {}, () => [
441
+ createTextVNode(toDisplayString(_ctx.label), 1)
442
+ ])
443
+ ]),
444
+ _: 3
445
+ }, 16, ["class"])
446
+ ]),
447
+ _: 3
448
+ });
449
+ };
450
+ }
451
+ });
452
+ export {
453
+ _sfc_main as default
454
+ };
@@ -0,0 +1 @@
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).VvDropdownAction=t(e.vue,null,e.core)}(this,(function(e,t,o){"use strict";var r=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(r||{}),n=(e=>(e.before="before",e.after="after",e))(n||{}),l=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(l||{}),u=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(u||{}),a=(e=>(e.button="button",e.link="link",e.menuitem="menuitem",e))(a||{}),s=(e=>(e._blank="_blank",e._self="_self",e._parent="_parent",e._top="_top",e))(s||{});const i=Symbol.for("volver"),d=Symbol.for("dropdownTrigger"),c=Symbol.for("dropdownItem"),f=Symbol.for("dropdownAction"),p={to:{type:[String,Object]},href:String,target:{type:String,validator:e=>Object.values(s).includes(e)},rel:{type:String,default:"noopener noreferrer"}},v={disabled:Boolean},m={active:Boolean},b={pressed:Boolean},y={label:[String,Number]},g={modifiers:[String,Array]};n.before,r.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const k={...v,...y,...b,...m,...p,type:{type:String,default:l.button,validator:e=>Object.values(l).includes(e)}},h=k;const x=e.defineComponent({name:"VvAction",props:h,emits:["click","mouseover","mouseleave"],setup(t,{expose:o,emit:r}){const n=t,l=e.inject(i),a=e.ref(null);o({$el:a});const{reference:s,bus:c,aria:p,expanded:v}=e.inject(d,{});e.watch((()=>a.value),(e=>{s&&(s.value=e)}));const m=e.computed((()=>n.pressed||(null==v?void 0:v.value))),{role:b}=e.inject(f,{}),y=e.computed((()=>{switch(!0){case n.disabled:return u.button;case void 0!==n.to:return(null==l?void 0:l.nuxt)?u.nuxtLink:u.routerLink;case void 0!==n.href:return u.a;default:return u.button}})),g=e.computed((()=>{const e={...null==p?void 0:p.value,"aria-pressed":!!m.value||void 0,role:b};switch(y.value){case u.a:return{...e,href:n.href,target:n.target,rel:n.rel};case u.routerLink:case u.nuxtLink:return{...e,to:n.to,target:n.target};default:return{...e,type:n.type,disabled:n.disabled}}})),k=e=>{n.disabled?e.preventDefault():(null==c||c.emit("click",e),r("click",e))},h=e=>{null==c||c.emit("mouseover",e),r("mouseover",e)},x=e=>{null==c||c.emit("mouseleave",e),r("mouseleave",e)};return(t,o)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(y)),e.mergeProps(e.unref(g),{ref_key:"element",ref:a,class:{active:t.active,pressed:e.unref(m),disabled:t.disabled},onClickPassive:k,onMouseoverPassive:h,onMouseleavePassive:x}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]))])),_:3},16,["class"]))}});const B=e.defineComponent({name:"VvDropdownItem",setup(t){const{role:r,expanded:n}=e.inject(c,{}),l=e.ref(null);!function({expanded:t}){e.provide(f,{role:a.menuitem,expanded:t})}({expanded:n});const u=o.useElementHover(l),{focused:s}=o.useFocus(l),{focused:i}=o.useFocusWithin(l);return e.watch(u,(e=>{e&&(s.value=!0)})),(t,o)=>(e.openBlock(),e.createElementBlock("li",e.mergeProps({role:e.unref(r)},{ref_key:"element",ref:l,class:["vv-dropdown__item",{"focus-visible":e.unref(s)||e.unref(i)}]}),[e.renderSlot(t.$slots,"default")],16))}});return e.defineComponent({name:"VvDropdownAction",props:{...k,...g},setup(t){const o=t,{modifiers:r}=e.toRefs(o),n=function(t,o,r){return e.computed((()=>{const n={[t]:!0},l="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return l&&Array.isArray(l)&&l.forEach((e=>{e&&(n[`${t}--${e}`]=!0)})),r&&Object.keys(r.value).forEach((o=>{n[`${t}--${o}`]=e.unref(r.value[o])})),n}))}("vv-dropdown-action",r);return(t,o)=>(e.openBlock(),e.createBlock(B,null,{default:e.withCtx((()=>[e.createVNode(x,e.mergeProps({disabled:t.disabled,pressed:t.pressed,active:t.active,type:t.type,to:t.to,href:t.href,target:t.target,rel:t.rel},{class:e.unref(n)}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]))])),_:3},16,["class"])])),_:3}))}})}));
@@ -1,23 +1,53 @@
1
- import { defineComponent as l, openBlock as d, createElementBlock as f, mergeProps as i, unref as t, renderSlot as m } from "vue";
2
- const p = {
1
+ import { inject, provide, defineComponent, ref, watch, openBlock, createElementBlock, mergeProps, unref, renderSlot } from "vue";
2
+ import "mitt";
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, {});
14
+ }
15
+ function useProvideDropdownAction({
16
+ expanded
17
+ }) {
18
+ provide(INJECTION_KEY_DROPDOWN_ACTION, {
19
+ role: ActionRoles.menuitem,
20
+ expanded
21
+ });
22
+ }
23
+ const __default__ = {
3
24
  name: "VvDropdownItem"
4
- }, h = /* @__PURE__ */ l({
5
- ...p,
6
- setup(a) {
7
- const { role: s, expanded: r } = useInjectedDropdownItem(), e = ref(null);
8
- useProvideDropdownAction({ expanded: r });
9
- const c = useElementHover(e), { focused: n } = useFocus(e), { focused: u } = useFocusWithin(e);
10
- return watch(c, (o) => {
11
- o && (n.value = !0);
12
- }), (o, _) => (d(), f("li", i({ role: t(s) }, {
13
- ref_key: "element",
14
- ref: e,
15
- class: ["vv-dropdown__item", { "focus-visible": t(n) || t(u) }]
16
- }), [
17
- m(o.$slots, "default")
18
- ], 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
+ };
19
49
  }
20
50
  });
21
51
  export {
22
- h as default
52
+ _sfc_main as default
23
53
  };
@@ -1 +1 @@
1
- (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("vue")):typeof define=="function"&&define.amd?define(["vue"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.VvDropdownItem=n(e.vue))})(this,function(e){"use strict";const n={name:"VvDropdownItem"};return e.defineComponent({...n,setup(i){const{role:r,expanded:d}=useInjectedDropdownItem(),o=ref(null);useProvideDropdownAction({expanded:d});const u=useElementHover(o),{focused:s}=useFocus(o),{focused:c}=useFocusWithin(o);return watch(u,t=>{t&&(s.value=!0)}),(t,l)=>(e.openBlock(),e.createElementBlock("li",e.mergeProps({role:e.unref(r)},{ref_key:"element",ref:o,class:["vv-dropdown__item",{"focus-visible":e.unref(s)||e.unref(c)}]}),[e.renderSlot(t.$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))}})}));