@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,6 +1,7 @@
1
- import { defineComponent as E, unref as c, openBlock as b, createBlock as B, mergeProps as C, createCommentVNode as I, resolveDynamicComponent as Q, withCtx as T, renderSlot as w, createElementBlock as L, toDisplayString as F, Fragment as X, createTextVNode as Z } from "vue";
2
- import { iconExists as j, Icon as ee, addIcon as te } from "@iconify/vue";
3
- const oe = {
1
+ import { inject as V, computed as g, unref as p, defineComponent as G, ref as D, toRefs as z, openBlock as k, createBlock as j, mergeProps as w, createCommentVNode as I, watch as ee, resolveDynamicComponent as te, withCtx as K, renderSlot as $, createTextVNode as U, toDisplayString as N, toRef as ne, useAttrs as re, useSlots as oe, createElementBlock as L, Fragment as se } from "vue";
2
+ import { iconExists as B, Icon as le, addIcon as ae } from "@iconify/vue";
3
+ import { nanoid as ie } from "nanoid";
4
+ const ue = {
4
5
  /**
5
6
  * Color
6
7
  */
@@ -93,352 +94,534 @@ const oe = {
93
94
  modifiers: {
94
95
  type: [String, Array]
95
96
  }
96
- }, re = {
97
+ };
98
+ var S = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(S || {}), Y = /* @__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))(Y || {}), C = /* @__PURE__ */ ((e) => (e.before = "before", e.after = "after", e))(C || {}), R = /* @__PURE__ */ ((e) => (e.button = "button", e.submit = "submit", e.reset = "reset", e))(R || {}), h = /* @__PURE__ */ ((e) => (e.nuxtLink = "nuxt-link", e.routerLink = "router-link", e.a = "a", e.button = "button", e))(h || {}), W = /* @__PURE__ */ ((e) => (e._blank = "_blank", e._self = "_self", e._parent = "_parent", e._top = "_top", e))(W || {});
99
+ const ce = Symbol.for("volver"), fe = Symbol.for("buttonGroup"), de = Symbol.for("dropdownTrigger"), ve = Symbol.for("dropdownAction");
100
+ function H() {
101
+ return V(ce);
102
+ }
103
+ function Q(e, t, o) {
104
+ return g(() => {
105
+ const r = {
106
+ [e]: !0
107
+ }, s = typeof (t == null ? void 0 : t.value) == "string" ? t.value.split(" ") : t == null ? void 0 : t.value;
108
+ return s && Array.isArray(s) && s.forEach((i) => {
109
+ r[`${e}--${i}`] = !0;
110
+ }), o && Object.keys(o.value).forEach((i) => {
111
+ r[`${e}--${i}`] = p(o.value[i]);
112
+ }), r;
113
+ });
114
+ }
115
+ const pe = {
97
116
  name: "VvIcon"
98
- }, q = /* @__PURE__ */ E({
99
- ...re,
100
- props: oe,
117
+ }, T = /* @__PURE__ */ G({
118
+ ...pe,
119
+ props: ue,
101
120
  setup(e) {
102
- const l = e, s = ref(!0), n = useVolver(), { modifiers: d } = toRefs(l), k = useBemModifiers("vv-icon", d), m = computed(() => l.provider || (n == null ? void 0 : n.provider)), _ = computed(() => {
103
- const t = l.name ?? "", o = `@${m.value}:${l.prefix}:${l.name}`;
104
- return j(t) ? t : j(o) ? o : (n == null ? void 0 : n.iconsCollections.find(
105
- (u) => {
106
- const g = `@${m.value}:${u.prefix}:${t}`;
107
- if (j(g))
108
- return g;
121
+ const t = e, o = D(!0), r = H(), { modifiers: s } = z(t), i = Q("vv-icon", s), v = g(() => t.provider || (r == null ? void 0 : r.provider)), f = g(() => {
122
+ const n = t.name ?? "", l = `@${v.value}:${t.prefix}:${t.name}`;
123
+ return B(n) ? n : B(l) ? l : (r == null ? void 0 : r.iconsCollections.find(
124
+ (m) => {
125
+ const b = `@${v.value}:${m.prefix}:${n}`;
126
+ if (B(b))
127
+ return b;
109
128
  }
110
- )) || t;
129
+ )) || n;
111
130
  });
112
- function y(t) {
113
- let o = null;
131
+ function d(n) {
132
+ let l = null;
114
133
  if (typeof window > "u") {
115
- const { JSDOM: h } = require("jsdom");
116
- o = new h().window;
134
+ const { JSDOM: O } = require("jsdom");
135
+ l = new O().window;
117
136
  }
118
- return (o ? new o.DOMParser() : new window.DOMParser()).parseFromString(t, "text/html").querySelector("svg");
137
+ return (l ? new l.DOMParser() : new window.DOMParser()).parseFromString(n, "text/html").querySelector("svg");
119
138
  }
120
- function a(t) {
121
- const o = y(t), u = (o == null ? void 0 : o.innerHTML.trim()) || "";
122
- o && u && te(`@${m.value}:${l.prefix}:${l.name}`, {
123
- body: u,
139
+ function a(n) {
140
+ const l = d(n), m = (l == null ? void 0 : l.innerHTML.trim()) || "";
141
+ l && m && ae(`@${v.value}:${t.prefix}:${t.name}`, {
142
+ body: m,
124
143
  // Set height and width from svg content
125
- height: o.viewBox.baseVal.height,
126
- width: o.viewBox.baseVal.width
144
+ height: l.viewBox.baseVal.height,
145
+ width: l.viewBox.baseVal.width
127
146
  });
128
147
  }
129
- return n && (l.src && !j(`@${m.value}:${l.prefix}:${l.name}`) ? (s.value = !1, n.fetchIcon(l.src).then((t) => {
130
- t && (a(t), s.value = !0);
131
- }).catch((t) => {
132
- throw new Error(`During fetch icon: ${t == null ? void 0 : t.message}`);
133
- })) : l.svg && a(l.svg)), (t, o) => c(s) ? (b(), B(c(ee), C({
148
+ return r && (t.src && !B(`@${v.value}:${t.prefix}:${t.name}`) ? (o.value = !1, r.fetchIcon(t.src).then((n) => {
149
+ n && (a(n), o.value = !0);
150
+ }).catch((n) => {
151
+ throw new Error(`During fetch icon: ${n == null ? void 0 : n.message}`);
152
+ })) : t.svg && a(t.svg)), (n, l) => p(o) ? (k(), j(p(le), w({
134
153
  key: 0,
135
- class: c(k)
154
+ class: p(i)
136
155
  }, {
137
- inline: t.inline,
138
- width: t.width,
139
- height: t.height,
140
- horizontalFlip: t.horizontalFlip,
141
- verticalFlip: t.verticalFlip,
142
- flip: t.flip,
143
- rotate: t.rotate,
144
- color: t.color,
145
- onLoad: t.onLoad,
146
- icon: c(_)
156
+ inline: n.inline,
157
+ width: n.width,
158
+ height: n.height,
159
+ horizontalFlip: n.horizontalFlip,
160
+ verticalFlip: n.verticalFlip,
161
+ flip: n.flip,
162
+ rotate: n.rotate,
163
+ color: n.color,
164
+ onLoad: n.onLoad,
165
+ icon: p(f)
147
166
  }), null, 16, ["class"])) : I("", !0);
148
167
  }
149
- });
150
- var p = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(p || {}), G = /* @__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))(G || {}), M = /* @__PURE__ */ ((e) => (e.before = "before", e.after = "after", e))(M || {});
151
- const ne = Symbol.for("buttonGroup"), ae = {
152
- /**
153
- * Whether the form control is disabled
154
- */
155
- disabled: Boolean
156
- }, le = {
157
- /**
158
- * Component BEM modifiers
159
- */
160
- modifiers: [String, Array]
161
- };
162
- M.before;
163
- const se = {
164
- /**
165
- * If true the input will be unselectable
166
- */
167
- unselectable: { type: Boolean, default: !0 }
168
- }, ie = {
168
+ }), ge = {
169
169
  /**
170
- * Global attribute id
171
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
170
+ * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
171
+ * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
172
172
  */
173
- id: [String, Number]
174
- };
175
- p.bottom;
176
- var R = /* @__PURE__ */ ((e) => (e.button = "button", e.submit = "submit", e.reset = "reset", e))(R || {}), v = /* @__PURE__ */ ((e) => (e.nuxtLink = "nuxt-link", e.routerLink = "router-link", e.a = "a", e.button = "button", e))(v || {}), z = /* @__PURE__ */ ((e) => (e._blank = "_blank", e._self = "_self", e._parent = "_parent", e._top = "_top", e))(z || {});
177
- const ue = ["update:modelValue"], ce = {
178
- ...ie,
179
- ...le,
180
- ...ae,
181
- ...se,
173
+ to: {
174
+ type: [String, Object]
175
+ },
182
176
  /**
183
- * Button icon
177
+ * Anchor href
184
178
  */
185
- icon: [String, Object],
179
+ href: String,
186
180
  /**
187
- * Button icon position
181
+ * Anchor target
188
182
  */
189
- iconPosition: {
183
+ target: {
190
184
  type: String,
191
- default: p.left,
192
- validator: (e) => Object.values(p).includes(e)
185
+ validator: (e) => Object.values(W).includes(e)
193
186
  },
194
187
  /**
195
- * Button label
188
+ * Anchor rel
196
189
  */
197
- label: [String, Number],
190
+ rel: {
191
+ type: String,
192
+ default: "noopener noreferrer"
193
+ }
194
+ }, me = {
198
195
  /**
199
196
  * Loading status
200
197
  */
201
198
  loading: Boolean,
202
- /**
203
- * Loading icon
204
- */
205
- loadingIcon: { type: String, default: "eos-icons:bubble-loading" },
206
199
  /**
207
200
  * Loading label
208
201
  */
209
202
  loadingLabel: {
210
203
  type: String,
211
204
  default: "Loading..."
212
- },
205
+ }
206
+ }, ye = {
213
207
  /**
214
- * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
215
- * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
208
+ * Whether the form control is disabled
216
209
  */
217
- to: {
218
- type: [String, Object]
219
- },
210
+ disabled: Boolean
211
+ }, be = {
220
212
  /**
221
- * Link href
213
+ * Whether the item is active
222
214
  */
223
- href: String,
215
+ active: Boolean
216
+ }, he = {
224
217
  /**
225
- * Link target
218
+ * Whether the item is pressed
226
219
  */
227
- target: {
228
- type: String,
229
- validator: (e) => Object.values(z).includes(e)
230
- },
231
- active: Boolean,
220
+ pressed: Boolean
221
+ }, Se = {
232
222
  /**
233
- * Button pressed mode
223
+ * The item label
234
224
  */
235
- pressed: Boolean,
225
+ label: [String, Number]
226
+ }, Oe = {
236
227
  /**
237
- * Link rel
228
+ * Component BEM modifiers
238
229
  */
239
- rel: {
240
- type: String,
241
- default: "noopener noreferrer"
242
- },
230
+ modifiers: [String, Array]
231
+ };
232
+ C.before;
233
+ const ke = {
234
+ /**
235
+ * If true the input will be unselectable
236
+ */
237
+ unselectable: { type: Boolean, default: !0 }
238
+ }, _e = {
239
+ /**
240
+ * Global attribute id
241
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
242
+ */
243
+ id: [String, Number]
244
+ };
245
+ S.bottom;
246
+ const X = {
247
+ ...ye,
248
+ ...Se,
249
+ ...he,
250
+ ...be,
251
+ ...ge,
243
252
  /**
244
253
  * Button type
245
254
  */
246
255
  type: {
247
256
  type: String,
248
- default: "button",
257
+ default: R.button,
249
258
  validator: (e) => Object.values(R).includes(e)
259
+ }
260
+ }, $e = ["click", "mouseover", "mouseleave"], Ie = X;
261
+ function je() {
262
+ return V(de, {});
263
+ }
264
+ function Pe() {
265
+ return V(ve, {});
266
+ }
267
+ const Ae = {
268
+ name: "VvAction"
269
+ }, Be = /* @__PURE__ */ G({
270
+ ...Ae,
271
+ props: Ie,
272
+ emits: $e,
273
+ setup(e, { expose: t, emit: o }) {
274
+ const r = e, s = H(), i = D(null);
275
+ t({ $el: i });
276
+ const {
277
+ reference: v,
278
+ bus: f,
279
+ aria: d,
280
+ expanded: a
281
+ } = je();
282
+ ee(
283
+ () => i.value,
284
+ (u) => {
285
+ v && (v.value = u);
286
+ }
287
+ );
288
+ const n = g(() => r.pressed || (a == null ? void 0 : a.value)), { role: l } = Pe(), m = g(() => {
289
+ switch (!0) {
290
+ case r.disabled:
291
+ return h.button;
292
+ case r.to !== void 0:
293
+ return s != null && s.nuxt ? h.nuxtLink : h.routerLink;
294
+ case r.href !== void 0:
295
+ return h.a;
296
+ default:
297
+ return h.button;
298
+ }
299
+ }), b = g(() => {
300
+ const u = {
301
+ ...d == null ? void 0 : d.value,
302
+ "aria-pressed": n.value ? !0 : void 0,
303
+ role: l
304
+ };
305
+ switch (m.value) {
306
+ case h.a:
307
+ return {
308
+ ...u,
309
+ href: r.href,
310
+ target: r.target,
311
+ rel: r.rel
312
+ };
313
+ case h.routerLink:
314
+ case h.nuxtLink:
315
+ return {
316
+ ...u,
317
+ to: r.to,
318
+ target: r.target
319
+ };
320
+ default:
321
+ return {
322
+ ...u,
323
+ type: r.type,
324
+ disabled: r.disabled
325
+ };
326
+ }
327
+ }), _ = (u) => {
328
+ if (r.disabled) {
329
+ u.preventDefault();
330
+ return;
331
+ }
332
+ f == null || f.emit("click", u), o("click", u);
333
+ }, O = (u) => {
334
+ f == null || f.emit("mouseover", u), o("mouseover", u);
335
+ }, y = (u) => {
336
+ f == null || f.emit("mouseleave", u), o("mouseleave", u);
337
+ };
338
+ return (u, P) => (k(), j(te(p(m)), w(p(b), {
339
+ ref_key: "element",
340
+ ref: i,
341
+ class: {
342
+ active: u.active,
343
+ pressed: p(n),
344
+ disabled: u.disabled
345
+ },
346
+ onClickPassive: _,
347
+ onMouseoverPassive: O,
348
+ onMouseleavePassive: y
349
+ }), {
350
+ default: K(() => [
351
+ $(u.$slots, "default", {}, () => [
352
+ U(N(u.label), 1)
353
+ ])
354
+ ]),
355
+ _: 3
356
+ }, 16, ["class"]));
357
+ }
358
+ });
359
+ function M(e, t, o) {
360
+ return o ? q(e, o) === q(t, o) : F(e, t);
361
+ }
362
+ function F(e, t) {
363
+ if (e === t)
364
+ return !0;
365
+ if (e && t && typeof e == "object" && typeof t == "object") {
366
+ const o = Array.isArray(e), r = Array.isArray(t);
367
+ let s, i, v;
368
+ if (o && r) {
369
+ if (i = e.length, i != t.length)
370
+ return !1;
371
+ for (s = i; s-- !== 0; )
372
+ if (!F(e[s], t[s]))
373
+ return !1;
374
+ return !0;
375
+ }
376
+ if (o != r)
377
+ return !1;
378
+ const f = e instanceof Date, d = t instanceof Date;
379
+ if (f != d)
380
+ return !1;
381
+ if (f && d)
382
+ return e.getTime() == t.getTime();
383
+ const a = e instanceof RegExp, n = t instanceof RegExp;
384
+ if (a != n)
385
+ return !1;
386
+ if (a && n)
387
+ return e.toString() == t.toString();
388
+ const l = Object.keys(e);
389
+ if (i = l.length, i !== Object.keys(t).length)
390
+ return !1;
391
+ for (s = i; s-- !== 0; )
392
+ if (!Object.prototype.hasOwnProperty.call(t, l[s]))
393
+ return !1;
394
+ for (s = i; s-- !== 0; )
395
+ if (v = l[s], !F(e[v], t[v]))
396
+ return !1;
397
+ return !0;
398
+ }
399
+ return e !== e && t !== t;
400
+ }
401
+ function q(e, t) {
402
+ if (e && Object.keys(e).length && t) {
403
+ if (t.indexOf(".") === -1)
404
+ return e[t];
405
+ {
406
+ const o = t.split(".");
407
+ let r = e;
408
+ for (let s = 0, i = o.length; s < i; ++s) {
409
+ if (e == null)
410
+ return null;
411
+ r = r[o[s]];
412
+ }
413
+ return r;
414
+ }
415
+ } else
416
+ return null;
417
+ }
418
+ function J(e, t) {
419
+ if (e != null && t && t.length) {
420
+ for (const o of t)
421
+ if (M(e, o))
422
+ return !0;
423
+ }
424
+ return !1;
425
+ }
426
+ function we(e) {
427
+ return ((t) => t == null || t === "" || Array.isArray(t) && t.length === 0 || !(t instanceof Date) && typeof t == "object" && Object.keys(t).length === 0)(p(e));
428
+ }
429
+ function Ve(e) {
430
+ const t = V(e, void 0), o = g(() => !we(t));
431
+ function r(s, i, v) {
432
+ if (t != null && t.value) {
433
+ const d = p(t.value)[s];
434
+ return g({
435
+ get() {
436
+ return d == null ? void 0 : d.value;
437
+ },
438
+ set(a) {
439
+ d.value = a;
440
+ }
441
+ });
442
+ }
443
+ const f = ne(i, s);
444
+ return g({
445
+ get() {
446
+ return f.value;
447
+ },
448
+ set(d) {
449
+ v && v(`update:${s}`, d);
450
+ }
451
+ });
452
+ }
453
+ return {
454
+ group: t,
455
+ isInGroup: o,
456
+ getGroupOrLocalRef: r
457
+ };
458
+ }
459
+ const De = ["update:modelValue"], Ee = {
460
+ ...X,
461
+ ..._e,
462
+ ...Oe,
463
+ ...ke,
464
+ ...me,
465
+ /**
466
+ * Button icon
467
+ */
468
+ icon: [String, Object],
469
+ /**
470
+ * Button icon position
471
+ */
472
+ iconPosition: {
473
+ type: String,
474
+ default: S.left,
475
+ validator: (e) => Object.values(S).includes(e)
250
476
  },
477
+ /**
478
+ * Loading icon
479
+ */
480
+ loadingIcon: { type: String, default: "eos-icons:bubble-loading" },
251
481
  toggle: {
252
482
  type: Boolean,
253
483
  default: !1
254
484
  },
255
485
  modelValue: String
256
486
  };
257
- function de(e, l) {
258
- var S;
259
- const { group: s, isInGroup: n, getGroupOrLocalRef: d } = useInjectedGroupState(ne), {
260
- id: k,
261
- iconPosition: m,
262
- icon: _,
263
- label: y,
487
+ function Le(e, t) {
488
+ var u;
489
+ const { group: o, isInGroup: r, getGroupOrLocalRef: s } = Ve(fe), {
490
+ id: i,
491
+ iconPosition: v,
492
+ icon: f,
493
+ label: d,
264
494
  pressed: a,
265
- modifiers: t
266
- } = toRefs(e), o = d("modelValue", e, l), u = d("disabled", e), g = d("toggle", e), O = d(
495
+ modifiers: n
496
+ } = z(e), l = s("modelValue", e, t), m = s("disabled", e), b = s("toggle", e), _ = s(
267
497
  "unselectable",
268
498
  e
269
- ), h = ((S = s == null ? void 0 : s.value) == null ? void 0 : S.multiple) ?? ref(!1), f = computed(() => {
270
- var i;
271
- const $ = t != null && t.value ? Array.isArray(t.value) ? t.value : [t.value] : [], V = (i = s == null ? void 0 : s.value.itemModifiers) != null && i.value ? Array.isArray(s.value.itemModifiers.value) ? s.value.itemModifiers.value : [s.value.itemModifiers.value] : [];
272
- return [...$, ...V];
499
+ ), O = ((u = o == null ? void 0 : o.value) == null ? void 0 : u.multiple) ?? D(!1), y = g(() => {
500
+ var A;
501
+ const P = n != null && n.value ? Array.isArray(n.value) ? n.value : n.value.split(" ") : [], E = (A = o == null ? void 0 : o.value.itemModifiers) != null && A.value ? Array.isArray(o.value.itemModifiers.value) ? o.value.itemModifiers.value : o.value.itemModifiers.value.split(" ") : [];
502
+ return [...P, ...E];
273
503
  });
274
504
  return {
275
505
  // group props
276
- group: s,
277
- isInGroup: n,
278
- modelValue: o,
279
- disabled: u,
280
- toggle: g,
281
- unselectable: O,
282
- multiple: h,
506
+ group: o,
507
+ isInGroup: r,
508
+ modelValue: l,
509
+ disabled: m,
510
+ toggle: b,
511
+ unselectable: _,
512
+ multiple: O,
283
513
  // local props
284
- id: k,
285
- modifiers: f,
514
+ id: i,
515
+ modifiers: y,
286
516
  pressed: a,
287
- iconPosition: m,
288
- icon: _,
289
- label: y
517
+ iconPosition: v,
518
+ icon: f,
519
+ label: d
290
520
  };
291
521
  }
292
- const fe = {
522
+ const Ne = (e) => g(() => String((e == null ? void 0 : e.value) || ie())), Ce = {
293
523
  key: 1,
294
524
  class: "vv-button__label"
295
- }, ve = {
525
+ }, Re = {
296
526
  key: 1,
297
527
  class: "vv-button__label"
298
- }, pe = {
528
+ }, Me = {
299
529
  name: "VvButton"
300
- }, be = /* @__PURE__ */ E({
301
- ...pe,
302
- props: ce,
303
- emits: ue,
304
- setup(e, { expose: l, emit: s }) {
305
- const n = e, d = useAttrs(), k = useSlots(), {
306
- id: m,
307
- modifiers: _,
308
- iconPosition: y,
530
+ }, Je = /* @__PURE__ */ G({
531
+ ...Me,
532
+ props: Ee,
533
+ emits: De,
534
+ setup(e, { expose: t, emit: o }) {
535
+ const r = e, s = re(), i = oe(), {
536
+ id: v,
537
+ modifiers: f,
538
+ iconPosition: d,
309
539
  icon: a,
310
- label: t,
311
- modelValue: o,
312
- disabled: u,
313
- toggle: g,
314
- unselectable: O
315
- } = de(n, s), h = useUniqueId(m), f = computed(() => (d == null ? void 0 : d.name) || h.value), S = useVolver(), $ = ref(null);
316
- l({ $el: $ });
317
- const {
318
- reference: V,
319
- bus: i,
320
- aria: P
321
- } = useInjectedDropdownTrigger();
322
- watch(
323
- () => $.value,
324
- (r) => {
325
- V && (V.value = r);
326
- }
327
- );
328
- const { role: U } = useInjectedDropdownAction(), N = computed(() => {
329
- switch (!0) {
330
- case u.value:
331
- return v.button;
332
- case n.to !== void 0:
333
- return S != null && S.nuxt ? v.nuxtLink : v.routerLink;
334
- case n.href !== void 0:
335
- return v.a;
336
- default:
337
- return v.button;
338
- }
339
- }), A = computed(() => g.value ? Array.isArray(o.value) ? contains(f.value, o.value) : equals(f.value, o.value) : n.pressed), J = useBemModifiers(
540
+ label: n,
541
+ modelValue: l,
542
+ disabled: m,
543
+ toggle: b,
544
+ unselectable: _
545
+ } = Le(r, o), O = Ne(v), y = g(() => (s == null ? void 0 : s.name) || O.value), u = D(null), P = g(() => {
546
+ var c;
547
+ return (c = u.value) == null ? void 0 : c.$el;
548
+ });
549
+ t({ $el: P });
550
+ const E = g(() => b.value ? Array.isArray(l.value) ? J(y.value, l.value) : M(y.value, l.value) : r.pressed), A = Q(
340
551
  "vv-button",
341
- _,
342
- computed(() => ({
343
- active: n.active,
344
- pressed: A.value,
345
- disabled: u.value,
346
- reverse: [p.right, p.bottom].includes(y.value),
347
- column: [p.top, p.bottom].includes(y.value),
348
- iconOnly: Boolean((a == null ? void 0 : a.value) && !(t != null && t.value) && !k.default)
552
+ f,
553
+ g(() => ({
554
+ reverse: [S.right, S.bottom].includes(d.value),
555
+ column: [S.top, S.bottom].includes(d.value),
556
+ "icon-only": Boolean(
557
+ (a == null ? void 0 : a.value) && !(n != null && n.value) && !i.default
558
+ )
349
559
  }))
350
- ), H = computed(
560
+ ), Z = g(
351
561
  () => typeof (a == null ? void 0 : a.value) == "string" ? { name: a == null ? void 0 : a.value } : a == null ? void 0 : a.value
352
- ), K = computed(() => {
353
- const r = {
354
- ...P == null ? void 0 : P.value,
355
- "aria-pressed": A.value ? !0 : void 0,
356
- class: J.value,
357
- role: U
358
- };
359
- switch (N.value) {
360
- case v.a:
361
- return {
362
- ...r,
363
- role: r.role ?? "button",
364
- href: n.href,
365
- target: n.target,
366
- rel: n.rel
367
- };
368
- case v.routerLink:
369
- case v.nuxtLink:
370
- return {
371
- ...r,
372
- role: r.role ?? "button",
373
- to: n.to,
374
- target: n.target
375
- };
376
- default:
377
- return {
378
- ...r,
379
- type: n.type,
380
- disabled: u.value
381
- };
382
- }
383
- }), W = (r) => {
384
- if (i == null || i.emit("click", r), g.value) {
385
- if (Array.isArray(o.value)) {
386
- if (contains(f.value, o.value)) {
387
- O.value && (o.value = o.value.filter(
388
- (D) => D !== f.value
562
+ ), x = () => {
563
+ if (b.value) {
564
+ if (Array.isArray(l.value)) {
565
+ if (J(y.value, l.value)) {
566
+ _.value && (l.value = l.value.filter(
567
+ (c) => c !== y.value
389
568
  ));
390
569
  return;
391
570
  }
392
- o.value.push(f.value);
571
+ l.value.push(y.value);
393
572
  return;
394
573
  }
395
- if (equals(f, o.value) && O.value) {
396
- o.value = void 0;
574
+ if (M(y.value, l.value) && _.value) {
575
+ l.value = void 0;
397
576
  return;
398
577
  }
399
- o.value = f.value;
578
+ l.value = y.value;
400
579
  }
401
- }, Y = (r) => {
402
- i == null || i.emit("mouseover", r);
403
- }, x = (r) => {
404
- i == null || i.emit("mouseleave", r);
405
580
  };
406
- return (r, D) => (b(), B(Q(c(N)), C(c(K), {
407
- id: c(h),
408
- ref_key: "$el",
409
- ref: $,
410
- onClickPassive: W,
411
- onMouseoverPassive: Y,
412
- onMouseleavePassive: x
581
+ return (c, Fe) => (k(), j(Be, w({
582
+ disabled: p(m),
583
+ pressed: p(E),
584
+ active: c.active,
585
+ type: c.type,
586
+ to: c.to,
587
+ href: c.href,
588
+ target: c.target,
589
+ rel: c.rel
590
+ }, {
591
+ id: p(O),
592
+ ref_key: "element",
593
+ ref: u,
594
+ class: p(A),
595
+ onClick: x
413
596
  }), {
414
- default: T(() => [
415
- w(r.$slots, "default", {}, () => [
416
- r.loading ? w(r.$slots, "loading", { key: 0 }, () => [
417
- r.loadingIcon ? (b(), B(q, {
597
+ default: K(() => [
598
+ $(c.$slots, "default", {}, () => [
599
+ c.loading ? $(c.$slots, "loading", { key: 0 }, () => [
600
+ c.loadingIcon ? (k(), j(T, {
418
601
  key: 0,
419
602
  class: "vv-button__loading-icon",
420
- name: r.loadingIcon
603
+ name: c.loadingIcon
421
604
  }, null, 8, ["name"])) : I("", !0),
422
- r.loadingLabel ? (b(), L("span", fe, F(r.loadingLabel), 1)) : I("", !0)
423
- ]) : (b(), L(X, { key: 1 }, [
424
- w(r.$slots, "before"),
425
- c(a) ? (b(), B(q, C({
605
+ c.loadingLabel ? (k(), L("span", Ce, N(c.loadingLabel), 1)) : I("", !0)
606
+ ]) : (k(), L(se, { key: 1 }, [
607
+ $(c.$slots, "before"),
608
+ p(a) ? (k(), j(T, w({
426
609
  key: 0,
427
610
  class: "vv-button__icon"
428
- }, c(H)), null, 16)) : I("", !0),
429
- c(t) ? (b(), L("span", ve, [
430
- w(r.$slots, "label", {}, () => [
431
- Z(F(c(t)), 1)
611
+ }, p(Z)), null, 16)) : I("", !0),
612
+ p(n) ? (k(), L("span", Re, [
613
+ $(c.$slots, "label", {}, () => [
614
+ U(N(p(n)), 1)
432
615
  ])
433
616
  ])) : I("", !0),
434
- w(r.$slots, "after")
617
+ $(c.$slots, "after")
435
618
  ], 64))
436
619
  ])
437
620
  ]),
438
621
  _: 3
439
- }, 16, ["id"]));
622
+ }, 16, ["id", "class"]));
440
623
  }
441
624
  });
442
625
  export {
443
- be as default
626
+ Je as default
444
627
  };