@volverjs/ui-vue 0.0.1-beta.5 → 0.0.1-beta.8

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 (82) hide show
  1. package/README.md +61 -2
  2. package/dist/components/VvButton/vv-button.es.js +56 -58
  3. package/dist/components/VvButton/vv-button.umd.js +1 -1
  4. package/dist/components/VvCheckGroup/vv-check-group.es.js +221 -203
  5. package/dist/components/VvCheckGroup/vv-check-group.umd.js +2 -2
  6. package/dist/components/VvInputText/VvInputText.d.ts +14 -0
  7. package/dist/components/VvInputText/VvInputText.vue.d.ts +36 -1
  8. package/dist/components/VvInputText/VvInputTextActions.d.ts +3 -0
  9. package/dist/components/VvInputText/vv-input-text.es.js +509 -380
  10. package/dist/components/VvInputText/vv-input-text.umd.js +2 -2
  11. package/dist/components/VvNativeSelect/vv-native-select.es.js +180 -161
  12. package/dist/components/VvNativeSelect/vv-native-select.umd.js +2 -2
  13. package/dist/components/VvRadioGroup/vv-radio-group.es.js +211 -193
  14. package/dist/components/VvRadioGroup/vv-radio-group.umd.js +2 -2
  15. package/dist/components/VvSelect/vv-select.es.js +189 -171
  16. package/dist/components/VvSelect/vv-select.umd.js +2 -2
  17. package/dist/components/VvTextarea/VvTextarea.d.ts +43 -22
  18. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +140 -85
  19. package/dist/components/VvTextarea/vv-textarea.es.js +364 -288
  20. package/dist/components/VvTextarea/vv-textarea.umd.js +2 -2
  21. package/dist/composables/debouncedInput/useDebouncedInput.d.ts +2 -0
  22. package/dist/composables/icons/useComponentIcons.d.ts +6 -0
  23. package/dist/composables/textLimit/useTextLimit.d.ts +14 -0
  24. package/dist/composables/useModifiers.d.ts +3 -2
  25. package/dist/icons.es.js +3 -3
  26. package/dist/icons.umd.js +1 -1
  27. package/dist/props/index.d.ts +42 -0
  28. package/dist/stories/utils.d.ts +5 -0
  29. package/dist/ui-vue.es.js +417 -401
  30. package/dist/ui-vue.umd.js +2 -2
  31. package/package.json +3 -1
  32. package/src/assets/icons/detailed.json +1 -1
  33. package/src/assets/icons/normal.json +1 -1
  34. package/src/assets/icons/simple.json +1 -1
  35. package/src/components/VvButton/VvButton.vue +1 -2
  36. package/src/components/VvInputText/VvInputText.ts +19 -2
  37. package/src/components/VvInputText/VvInputText.vue +123 -149
  38. package/src/components/VvInputText/VvInputTextActions.ts +151 -0
  39. package/src/components/VvTextarea/VvTextarea.ts +25 -16
  40. package/src/components/VvTextarea/VvTextarea.vue +89 -93
  41. package/src/components/common/HintSlot.ts +31 -13
  42. package/src/composables/debouncedInput/useDebouncedInput.ts +19 -0
  43. package/src/composables/icons/useComponentIcons.ts +35 -0
  44. package/src/composables/textLimit/useTextLimit.ts +44 -0
  45. package/src/composables/useModifiers.ts +47 -1
  46. package/src/props/index.ts +39 -0
  47. package/src/stories/InputText/InputTextMaxLength.stories.mdx +21 -0
  48. package/src/stories/Textarea/Textarea.stories.mdx +33 -51
  49. package/src/stories/Textarea/TextareaAutoclear.stories.mdx +23 -0
  50. package/src/stories/Textarea/TextareaAutocomplete.stories.mdx +10 -2
  51. package/src/stories/Textarea/TextareaAutofocus.stories.mdx +5 -1
  52. package/src/stories/Textarea/TextareaDebounce.stories.mdx +23 -0
  53. package/src/stories/Textarea/TextareaDisabled.stories.mdx +5 -1
  54. package/src/stories/Textarea/TextareaError.stories.mdx +6 -3
  55. package/src/stories/Textarea/TextareaErrorLabel.stories.mdx +37 -0
  56. package/src/stories/Textarea/TextareaFloating.stories.mdx +7 -2
  57. package/src/stories/Textarea/TextareaHintLabel.stories.mdx +5 -1
  58. package/src/stories/Textarea/TextareaIcon.stories.mdx +5 -1
  59. package/src/stories/Textarea/TextareaIconPosition.stories.mdx +9 -1
  60. package/src/stories/Textarea/TextareaId.stories.mdx +19 -0
  61. package/src/stories/Textarea/TextareaLabel.stories.mdx +5 -1
  62. package/src/stories/Textarea/TextareaLimit.stories.mdx +50 -0
  63. package/src/stories/Textarea/TextareaLoading.stories.mdx +6 -3
  64. package/src/stories/Textarea/TextareaLoadingLabel.stories.mdx +23 -0
  65. package/src/stories/Textarea/TextareaMaxLength.stories.mdx +6 -2
  66. package/src/stories/Textarea/TextareaMinLength.stories.mdx +5 -1
  67. package/src/stories/Textarea/TextareaModifiers.stories.mdx +24 -0
  68. package/src/stories/Textarea/TextareaName.stories.mdx +23 -0
  69. package/src/stories/Textarea/TextareaPlaceholder.stories.mdx +5 -1
  70. package/src/stories/Textarea/TextareaReadonly.stories.mdx +5 -1
  71. package/src/stories/Textarea/TextareaRequired.stories.mdx +22 -0
  72. package/src/stories/Textarea/TextareaResizable.stories.mdx +22 -0
  73. package/src/stories/Textarea/TextareaRowsCols.stories.mdx +9 -1
  74. package/src/stories/Textarea/TextareaValid.stories.mdx +7 -4
  75. package/src/stories/Textarea/TextareaValidLabel.stories.mdx +35 -0
  76. package/src/stories/stories.scss +11 -0
  77. package/src/stories/utils.ts +12 -0
  78. package/src/stories/volver-ui-vue.stories.mdx +7 -1
  79. package/dist/components/VvInputText/useInputNumber.d.ts +0 -16
  80. package/dist/components/VvInputText/useInputPassword.d.ts +0 -16
  81. package/src/components/VvInputText/useInputNumber.ts +0 -40
  82. package/src/components/VvInputText/useInputPassword.ts +0 -38
package/README.md CHANGED
@@ -25,8 +25,67 @@
25
25
  $ npm i @volverjs/ui-vue
26
26
  ```
27
27
 
28
+ ## Style
29
+
30
+ #### @volverjs/ui-vue is closely linked to [@volverjs/style](https://volverjs.github.io/style/) and is neeeded to style components
31
+
32
+ <br />
33
+
28
34
  ## Basic usage
29
35
 
30
- ```html
31
- <vv-text weight="thin">Size thin</vv-text>
36
+ ```typescript
37
+ import { iconsSimple, iconsNormal, iconsDetailed } from '@volverjs/ui-vue/icons'
38
+ import { DesygnSystem } from '@volverjs/ui-vue'
39
+
40
+ const volver = new DesignSystem({
41
+ iconsCollections: [iconsSimple, iconsNormal, iconsDetailed]
42
+ })
43
+
44
+ app.use(volver)
45
+ ```
46
+
47
+ Constructor parameters:
48
+
49
+ ```typescript
50
+ interface IDesignSystemParams {
51
+ /**
52
+ * If true set "fetchOptions" with credentials: 'include'
53
+ */
54
+ fetchWithCredentials?: boolean
55
+ /**
56
+ * Optional fetch params
57
+ */
58
+ fetchOptions?: RequestInit
59
+ /**
60
+ * Array of https://docs.iconify.design/types/iconify-json.html
61
+ * This collections will be added during plugin install
62
+ */
63
+ iconsCollections?: IconifyJSON[]
64
+ }
65
+ ```
66
+
67
+ Design System definition
68
+
69
+ ```typescript
70
+ interface IDesignSystem extends IDesignSystemParams {
71
+ /**
72
+ * @param {String} src Icon source path (url)
73
+ * @param {RequestInit} options
74
+ * @returns {Promise<string | undefined>} String SVG if exist
75
+ */
76
+ fetchIcon(src: string, options?: RequestInit): Promise<string | undefined>
77
+ /**
78
+ * Add iconify collection to library https://docs.iconify.design/icon-components/vue/add-collection.html
79
+ * @param {IconifyJSON} collection
80
+ * @param {String} providerName Optional provider name
81
+ */
82
+ addCollection(collection: IconifyJSON, providerName?: string): boolean
83
+ /**
84
+ * Add icon to collection https://docs.iconify.design/icon-components/vue/add-icon.html
85
+ * @param {String} name
86
+ * @param {IconifyIcon} data
87
+ * @returns {Boolean} true on success, false if something is wrong with data
88
+ */
89
+ addIcon(name: string, data: IconifyIcon): boolean
90
+ }
32
91
  ```
@@ -1,8 +1,8 @@
1
- import { computed as f, unref as y, defineComponent as D, ref as T, toRefs as q, inject as F, openBlock as b, createBlock as O, mergeProps as P, createCommentVNode as C, toRef as Z, useAttrs as z, useSlots as H, resolveDynamicComponent as J, withCtx as K, renderSlot as A, createElementBlock as w, toDisplayString as L, Fragment as W, createTextVNode as X } from "vue";
2
- import { v4 as Y } from "uuid";
3
- import { iconExists as j, Icon as ee, addIcon as te } from "@iconify/vue";
1
+ import { computed as f, unref as y, defineComponent as D, ref as T, toRefs as q, inject as F, openBlock as b, createBlock as O, mergeProps as P, createCommentVNode as C, toRef as Z, useAttrs as z, resolveDynamicComponent as H, withCtx as J, renderSlot as A, createElementBlock as w, toDisplayString as L, Fragment as K, createTextVNode as W } from "vue";
2
+ import { v4 as X } from "uuid";
3
+ import { iconExists as j, Icon as Y, addIcon as ee } from "@iconify/vue";
4
4
  var _ = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(_ || {}), k = /* @__PURE__ */ ((e) => (e.nuxtLink = "nuxt-link", e.routerLink = "router-link", e.a = "a", e.button = "button", e))(k || {}), R = /* @__PURE__ */ ((e) => (e._blank = "_blank", e._self = "_self", e._parent = "_parent", e._top = "_top", e))(R || {});
5
- const ne = {
5
+ const te = {
6
6
  icon: String,
7
7
  iconPosition: {
8
8
  type: String,
@@ -58,19 +58,19 @@ const ne = {
58
58
  return !1;
59
59
  if (u && c)
60
60
  return e.getTime() == t.getTime();
61
- const v = e instanceof RegExp, i = t instanceof RegExp;
62
- if (v != i)
61
+ const v = e instanceof RegExp, s = t instanceof RegExp;
62
+ if (v != s)
63
63
  return !1;
64
- if (v && i)
64
+ if (v && s)
65
65
  return e.toString() == t.toString();
66
- const s = Object.keys(e);
67
- if (l = s.length, l !== Object.keys(t).length)
66
+ const i = Object.keys(e);
67
+ if (l = i.length, l !== Object.keys(t).length)
68
68
  return !1;
69
69
  for (r = l; r-- !== 0; )
70
- if (!Object.prototype.hasOwnProperty.call(t, s[r]))
70
+ if (!Object.prototype.hasOwnProperty.call(t, i[r]))
71
71
  return !1;
72
72
  for (r = l; r-- !== 0; )
73
- if (a = s[r], !this.deepEquals(e[a], t[a]))
73
+ if (a = i[r], !this.deepEquals(e[a], t[a]))
74
74
  return !1;
75
75
  return !0;
76
76
  }
@@ -152,7 +152,7 @@ const ne = {
152
152
  /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g
153
153
  )) == null ? void 0 : t.join("-")) == null ? void 0 : n.toLowerCase();
154
154
  }
155
- }, re = {
155
+ }, ne = {
156
156
  color: String,
157
157
  width: {
158
158
  type: [String, Number]
@@ -215,49 +215,49 @@ function x(e, t) {
215
215
  }
216
216
  const I = /* @__PURE__ */ D({
217
217
  __name: "VvIcon",
218
- props: re,
218
+ props: ne,
219
219
  setup(e) {
220
220
  const t = e, n = T(!0), { modifiers: o } = q(t), r = F("ds"), { bemCssClasses: l } = x("vv-icon", {
221
221
  modifiers: o
222
222
  }), a = f(() => t.provider || (r == null ? void 0 : r.provider)), u = f(() => {
223
- const i = t.name || "", s = `@${a.value}:${t.prefix}:${t.name}`;
224
- return j(i) ? i : j(s) ? s : (r == null ? void 0 : r.iconsCollections.find((d) => {
225
- const g = `@${a.value}:${d.prefix}:${i}`;
223
+ const s = t.name || "", i = `@${a.value}:${t.prefix}:${t.name}`;
224
+ return j(s) ? s : j(i) ? i : (r == null ? void 0 : r.iconsCollections.find((d) => {
225
+ const g = `@${a.value}:${d.prefix}:${s}`;
226
226
  if (j(g))
227
227
  return g;
228
- })) || i;
228
+ })) || s;
229
229
  });
230
- function c(i) {
231
- let s = null;
230
+ function c(s) {
231
+ let i = null;
232
232
  if (typeof window > "u") {
233
233
  const { JSDOM: S } = require("jsdom");
234
- s = new S().window;
234
+ i = new S().window;
235
235
  }
236
- return (s ? new s.DOMParser() : new window.DOMParser()).parseFromString(i, "text/html").querySelector("svg");
236
+ return (i ? new i.DOMParser() : new window.DOMParser()).parseFromString(s, "text/html").querySelector("svg");
237
237
  }
238
- function v(i) {
239
- const s = c(i), d = (s == null ? void 0 : s.innerHTML.trim()) || "";
240
- s && d && te(`@${a.value}:${t.prefix}:${t.name}`, {
238
+ function v(s) {
239
+ const i = c(s), d = (i == null ? void 0 : i.innerHTML.trim()) || "";
240
+ i && d && ee(`@${a.value}:${t.prefix}:${t.name}`, {
241
241
  body: d,
242
- height: s.viewBox.baseVal.height,
243
- width: s.viewBox.baseVal.width
242
+ height: i.viewBox.baseVal.height,
243
+ width: i.viewBox.baseVal.width
244
244
  });
245
245
  }
246
- return r && (t.src ? (n.value = !1, r.fetchIcon(t.src).then((i) => {
247
- i && (v(i), n.value = !0);
248
- }).catch((i) => {
249
- throw new Error(`During fetch icon: ${i == null ? void 0 : i.message}`);
250
- })) : t.svg && v(t.svg)), (i, s) => n.value ? (b(), O(y(ee), P({
246
+ return r && (t.src ? (n.value = !1, r.fetchIcon(t.src).then((s) => {
247
+ s && (v(s), n.value = !0);
248
+ }).catch((s) => {
249
+ throw new Error(`During fetch icon: ${s == null ? void 0 : s.message}`);
250
+ })) : t.svg && v(t.svg)), (s, i) => n.value ? (b(), O(y(Y), P({
251
251
  key: 0,
252
252
  class: y(l)
253
253
  }, {
254
- ...i.$props,
254
+ ...s.$props,
255
255
  provider: y(a),
256
256
  icon: y(u)
257
257
  }), null, 16, ["class"])) : C("", !0);
258
258
  }
259
259
  });
260
- function oe(e) {
260
+ function re(e) {
261
261
  const t = F(e, void 0);
262
262
  console.log("Inject - ", t);
263
263
  const n = f(() => h.isNotEmpty(t));
@@ -290,11 +290,11 @@ function oe(e) {
290
290
  getGroupOrLocalRef: o
291
291
  };
292
292
  }
293
- const se = Symbol("VV_BUTTON_GROUP");
293
+ const oe = Symbol("VV_BUTTON_GROUP");
294
294
  function ie(e) {
295
- const { group: t, isInGroup: n, getGroupOrLocalRef: o } = oe(se), { modifiers: r, fullBleed: l, iconPosition: a, icon: u, label: c, block: v, selected: i } = q(e), s = o("modelValue", e), d = o("disabled", e), g = o("toggle", e), p = o("rounded", e), S = o("action", e), $ = o("actionQuiet", e);
295
+ const { group: t, isInGroup: n, getGroupOrLocalRef: o } = re(oe), { modifiers: r, fullBleed: l, iconPosition: a, icon: u, label: c, block: v, selected: s } = q(e), i = o("modelValue", e), d = o("disabled", e), g = o("toggle", e), p = o("rounded", e), S = o("action", e), $ = o("actionQuiet", e);
296
296
  return {
297
- modelValue: s,
297
+ modelValue: i,
298
298
  disabled: d,
299
299
  toggle: g,
300
300
  isInGroup: n,
@@ -302,7 +302,7 @@ function ie(e) {
302
302
  modifiers: r,
303
303
  action: S,
304
304
  actionQuiet: $,
305
- selected: i,
305
+ selected: s,
306
306
  block: v,
307
307
  rounded: p,
308
308
  fullBleed: l,
@@ -311,27 +311,25 @@ function ie(e) {
311
311
  label: c
312
312
  };
313
313
  }
314
- const le = {
314
+ const se = {
315
315
  key: 1,
316
316
  class: "vv-button__label"
317
- }, ae = {
317
+ }, le = {
318
318
  key: 1,
319
319
  class: "vv-button__label"
320
- }, de = /* @__PURE__ */ D({
320
+ }, fe = /* @__PURE__ */ D({
321
321
  __name: "VvButton",
322
- props: ne,
322
+ props: te,
323
323
  setup(e) {
324
- const t = e, n = z();
325
- H();
326
- const o = (n == null ? void 0 : n.name) || Y(), {
324
+ const t = e, n = z(), o = (n == null ? void 0 : n.name) || X(), {
327
325
  modifiers: r,
328
326
  action: l,
329
327
  actionQuiet: a,
330
328
  block: u,
331
329
  rounded: c,
332
330
  fullBleed: v,
333
- iconPosition: i,
334
- icon: s,
331
+ iconPosition: s,
332
+ icon: i,
335
333
  label: d,
336
334
  modelValue: g,
337
335
  disabled: p,
@@ -360,15 +358,15 @@ const le = {
360
358
  disabled: p,
361
359
  reverse: f(
362
360
  () => [_.right, _.bottom].includes(
363
- i.value
361
+ s.value
364
362
  )
365
363
  ),
366
364
  column: f(
367
365
  () => [_.top, _.bottom].includes(
368
- i.value
366
+ s.value
369
367
  )
370
368
  ),
371
- iconOnly: f(() => (s == null ? void 0 : s.value) && !(d != null && d.value))
369
+ iconOnly: f(() => (i == null ? void 0 : i.value) && !(d != null && d.value))
372
370
  }), M = f(() => ({
373
371
  ...U.value,
374
372
  "aria-label": t.label || n["aria-label"],
@@ -389,8 +387,8 @@ const le = {
389
387
  function Q() {
390
388
  $.value && (g.value = o);
391
389
  }
392
- return (m, B) => (b(), O(J(y(E)), P(y(M), { onClickPassive: Q }), {
393
- default: K(() => [
390
+ return (m, B) => (b(), O(H(y(E)), P(y(M), { onClickPassive: Q }), {
391
+ default: J(() => [
394
392
  A(m.$slots, "default", {}, () => [
395
393
  m.loading ? A(m.$slots, "loading", { key: 0 }, () => [
396
394
  m.loadingIcon ? (b(), O(I, {
@@ -398,17 +396,17 @@ const le = {
398
396
  class: "vv-button__loading-icon",
399
397
  name: m.loadingIcon
400
398
  }, null, 8, ["name"])) : C("", !0),
401
- m.loadingLabel ? (b(), w("span", le, L(m.loadingLabel), 1)) : C("", !0)
402
- ]) : (b(), w(W, { key: 1 }, [
399
+ m.loadingLabel ? (b(), w("span", se, L(m.loadingLabel), 1)) : C("", !0)
400
+ ]) : (b(), w(K, { key: 1 }, [
403
401
  A(m.$slots, "before"),
404
- y(s) ? (b(), O(I, {
402
+ y(i) ? (b(), O(I, {
405
403
  key: 0,
406
404
  class: "vv-button__icon",
407
- name: y(s)
405
+ name: y(i)
408
406
  }, null, 8, ["name"])) : C("", !0),
409
- y(d) ? (b(), w("span", ae, [
407
+ y(d) ? (b(), w("span", le, [
410
408
  A(m.$slots, "label", {}, () => [
411
- X(L(y(d)), 1)
409
+ W(L(y(d)), 1)
412
410
  ])
413
411
  ])) : C("", !0),
414
412
  A(m.$slots, "after")
@@ -420,5 +418,5 @@ const le = {
420
418
  }
421
419
  });
422
420
  export {
423
- de as default
421
+ fe as default
424
422
  };
@@ -1 +1 @@
1
- (function(n,B){typeof exports=="object"&&typeof module<"u"?module.exports=B(require("vue"),require("uuid"),require("@iconify/vue")):typeof define=="function"&&define.amd?define(["vue","uuid","@iconify/vue"],B):(n=typeof globalThis<"u"?globalThis:n||self,n.VvButton=B(n.vue,n.uuid,n.vue$1))})(this,function(n,B,_){"use strict";var b=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(b||{}),k=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(k||{}),O=(e=>(e._blank="_blank",e._self="_self",e._parent="_parent",e._top="_top",e))(O||{});const j={icon:String,iconPosition:{type:String,default:"left",validator:e=>e in b},label:String,loading:Boolean,loadingIcon:{type:String,default:"eos-icons:bubble-loading"},loadingLabel:{type:String,default:"Loading..."},to:{type:[String,Object]},href:String,target:{type:String,validator:e=>e in O},block:Boolean,active:Boolean,rounded:Boolean,disabled:Boolean,fullBleed:Boolean,action:Boolean,actionQuiet:Boolean,selected:Boolean,modifiers:[Array,String]},y={equals(e,t,r){return r?this.resolveFieldData(e,r)===this.resolveFieldData(t,r):this.deepEquals(e,t)},deepEquals(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){const r=Array.isArray(e),i=Array.isArray(t);let o,c,a;if(r&&i){if(c=e.length,c!=t.length)return!1;for(o=c;o--!==0;)if(!this.deepEquals(e[o],t[o]))return!1;return!0}if(r!=i)return!1;const u=e instanceof Date,f=t instanceof Date;if(u!=f)return!1;if(u&&f)return e.getTime()==t.getTime();const p=e instanceof RegExp,l=t instanceof RegExp;if(p!=l)return!1;if(p&&l)return e.toString()==t.toString();const s=Object.keys(e);if(c=s.length,c!==Object.keys(t).length)return!1;for(o=c;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,s[o]))return!1;for(o=c;o--!==0;)if(a=s[o],!this.deepEquals(e[a],t[a]))return!1;return!0}return e!==e&&t!==t},resolveFieldData(e,t){if(e&&Object.keys(e).length&&t){if(t.indexOf(".")===-1)return e[t];{const r=t.split(".");let i=e;for(let o=0,c=r.length;o<c;++o){if(e==null)return null;i=i[r[o]]}return i}}else return null},isFunction(e){return!!(e&&e.constructor&&e.call&&e.apply)},findIndexInList(e,t){let r=-1;if(t){for(let i=0;i<t.length;i++)if(this.equals(t[i],e)){r=i;break}}return r},contains(e,t){if(e!=null&&t&&t.length){for(const r of t)if(this.equals(e,r))return!0}return!1},isEmpty(e){return e==null||e===""||Array.isArray(e)&&e.length===0||!(e instanceof Date)&&typeof e=="object"&&Object.keys(e).length===0},isNotEmpty(e){return!this.isEmpty(e)},pickBy(e,t){return Object.fromEntries(Object.entries(e).filter(([r])=>t(r)))},removeFromList(e,t){const r=this.findIndexInList(e,t);return r>-1?t.filter((i,o)=>o!==r):t},isString(e){return typeof e=="string"||e instanceof String},propsToObject(e){return Object.keys(e).reduce((t,r)=>{var i,o,c,a,u;return this.isFunction(e[r])?t[r]=e[r]():Array.isArray(e[r])?t[r]=e[r][0]():(i=e[r])!=null&&i.type&&(Array.isArray(e[r].type)?t[r]=((o=e[r])==null?void 0:o.default)||((c=e[r])==null?void 0:c.type[0]()):t[r]=((a=e[r])==null?void 0:a.default)||((u=e[r])==null?void 0:u.type())),t},{})},filterArray(e,t,r){return e.filter(i=>t.some(o=>typeof o=="string"?i[r]==o:this.equals(i[r],o[r])))},kebabCase(e){var t,r;if(e)return(r=(t=e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:t.join("-"))==null?void 0:r.toLowerCase()}},q={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}};function w(e,t){const r={[`${e}`]:!0};return{bemCssClasses:n.computed(()=>Object.keys(t).reduce((o,c)=>{const a=n.unref(t[c])||!1;if(!a)return o;if(c==="modifiers"){const u=Array.isArray(a)?a:[a];return{...o,...u.reduce((f,p)=>({...f,[`${e}--${y.kebabCase(p)}`]:!0}),{})}}else return{...o,[`${e}--${y.kebabCase(c)}`]:a}},r)||{})}}const E=n.defineComponent({__name:"VvIcon",props:q,setup(e){const t=e,r=n.ref(!0),{modifiers:i}=n.toRefs(t),o=n.inject("ds"),{bemCssClasses:c}=w("vv-icon",{modifiers:i}),a=n.computed(()=>t.provider||(o==null?void 0:o.provider)),u=n.computed(()=>{const l=t.name||"",s=`@${a.value}:${t.prefix}:${t.name}`;return _.iconExists(l)?l:_.iconExists(s)?s:(o==null?void 0:o.iconsCollections.find(d=>{const m=`@${a.value}:${d.prefix}:${l}`;if(_.iconExists(m))return m}))||l});function f(l){let s=null;if(typeof window>"u"){const{JSDOM:S}=require("jsdom");s=new S().window}return(s?new s.DOMParser:new window.DOMParser).parseFromString(l,"text/html").querySelector("svg")}function p(l){const s=f(l),d=(s==null?void 0:s.innerHTML.trim())||"";s&&d&&_.addIcon(`@${a.value}:${t.prefix}:${t.name}`,{body:d,height:s.viewBox.baseVal.height,width:s.viewBox.baseVal.width})}return o&&(t.src?(r.value=!1,o.fetchIcon(t.src).then(l=>{l&&(p(l),r.value=!0)}).catch(l=>{throw new Error(`During fetch icon: ${l==null?void 0:l.message}`)})):t.svg&&p(t.svg)),(l,s)=>r.value?(n.openBlock(),n.createBlock(n.unref(_.Icon),n.mergeProps({key:0,class:n.unref(c)},{...l.$props,provider:n.unref(a),icon:n.unref(u)}),null,16,["class"])):n.createCommentVNode("",!0)}});function L(e){const t=n.inject(e,void 0);console.log("Inject - ",t);const r=n.computed(()=>y.isNotEmpty(t));function i(o,c,a){if(t!=null&&t.value){const u=n.unref(t.value)[o];return n.computed({get(){return u==null?void 0:u.value},set(f){u.value=f}})}else{const u=n.toRef(c,o);return n.computed({get(){return u.value},set(f){a&&a(`update:${o}`,f)}})}}return{group:t,isInGroup:r,getGroupOrLocalRef:i}}const D=Symbol("VV_BUTTON_GROUP");function I(e){const{group:t,isInGroup:r,getGroupOrLocalRef:i}=L(D),{modifiers:o,fullBleed:c,iconPosition:a,icon:u,label:f,block:p,selected:l}=n.toRefs(e),s=i("modelValue",e),d=i("disabled",e),m=i("toggle",e),h=i("rounded",e),S=i("action",e),C=i("actionQuiet",e);return{modelValue:s,disabled:d,toggle:m,isInGroup:r,group:t,modifiers:o,action:S,actionQuiet:C,selected:l,block:p,rounded:h,fullBleed:c,iconPosition:a,icon:u,label:f}}const V={key:1,class:"vv-button__label"},x={key:1,class:"vv-button__label"};return n.defineComponent({__name:"VvButton",props:j,setup(e){const t=e,r=n.useAttrs();n.useSlots();const i=(r==null?void 0:r.name)||B.v4(),{modifiers:o,action:c,actionQuiet:a,block:u,rounded:f,fullBleed:p,iconPosition:l,icon:s,label:d,modelValue:m,disabled:h,toggle:S,isInGroup:C}=I(t),$=n.computed(()=>{switch(!0){case h.value:return k.button;case t.to!==void 0:return k.routerLink;case t.href!==void 0:return k.a;default:return k.button}}),N=n.computed(()=>S.value?Array.isArray(m.value)?y.contains(i,m.value):y.equals(i,m.value):t.active),P=n.computed(()=>S.value?Array.isArray(m.value)?y.contains(i,m.value):y.equals(i,m.value):t.selected),{bemCssClasses:R}=w("vv-button",{modifiers:o,active:N,action:c,actionQuiet:a,selected:P,block:u,rounded:f,fullBleed:p,disabled:h,reverse:n.computed(()=>[b.right,b.bottom].includes(l.value)),column:n.computed(()=>[b.top,b.bottom].includes(l.value)),iconOnly:n.computed(()=>(s==null?void 0:s.value)&&!(d!=null&&d.value))}),F=n.computed(()=>({...G.value,"aria-label":t.label||r["aria-label"],"aria-disabled":h.value,role:"button",class:R.value,to:t.to})),G=n.computed(()=>{const g=$.value===k.a;let A={};return g&&(A=h.value?{href:"javascript:;"}:{target:t.target,href:t.href}),A});function M(){C.value&&(m.value=i)}return(g,A)=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref($)),n.mergeProps(n.unref(F),{onClickPassive:M}),{default:n.withCtx(()=>[n.renderSlot(g.$slots,"default",{},()=>[g.loading?n.renderSlot(g.$slots,"loading",{key:0},()=>[g.loadingIcon?(n.openBlock(),n.createBlock(E,{key:0,class:"vv-button__loading-icon",name:g.loadingIcon},null,8,["name"])):n.createCommentVNode("",!0),g.loadingLabel?(n.openBlock(),n.createElementBlock("span",V,n.toDisplayString(g.loadingLabel),1)):n.createCommentVNode("",!0)]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.renderSlot(g.$slots,"before"),n.unref(s)?(n.openBlock(),n.createBlock(E,{key:0,class:"vv-button__icon",name:n.unref(s)},null,8,["name"])):n.createCommentVNode("",!0),n.unref(d)?(n.openBlock(),n.createElementBlock("span",x,[n.renderSlot(g.$slots,"label",{},()=>[n.createTextVNode(n.toDisplayString(n.unref(d)),1)])])):n.createCommentVNode("",!0),n.renderSlot(g.$slots,"after")],64))])]),_:3},16))}})});
1
+ (function(n,B){typeof exports=="object"&&typeof module<"u"?module.exports=B(require("vue"),require("uuid"),require("@iconify/vue")):typeof define=="function"&&define.amd?define(["vue","uuid","@iconify/vue"],B):(n=typeof globalThis<"u"?globalThis:n||self,n.VvButton=B(n.vue,n.uuid,n.vue$1))})(this,function(n,B,_){"use strict";var b=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(b||{}),k=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(k||{}),O=(e=>(e._blank="_blank",e._self="_self",e._parent="_parent",e._top="_top",e))(O||{});const j={icon:String,iconPosition:{type:String,default:"left",validator:e=>e in b},label:String,loading:Boolean,loadingIcon:{type:String,default:"eos-icons:bubble-loading"},loadingLabel:{type:String,default:"Loading..."},to:{type:[String,Object]},href:String,target:{type:String,validator:e=>e in O},block:Boolean,active:Boolean,rounded:Boolean,disabled:Boolean,fullBleed:Boolean,action:Boolean,actionQuiet:Boolean,selected:Boolean,modifiers:[Array,String]},y={equals(e,t,r){return r?this.resolveFieldData(e,r)===this.resolveFieldData(t,r):this.deepEquals(e,t)},deepEquals(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){const r=Array.isArray(e),i=Array.isArray(t);let o,c,a;if(r&&i){if(c=e.length,c!=t.length)return!1;for(o=c;o--!==0;)if(!this.deepEquals(e[o],t[o]))return!1;return!0}if(r!=i)return!1;const u=e instanceof Date,f=t instanceof Date;if(u!=f)return!1;if(u&&f)return e.getTime()==t.getTime();const p=e instanceof RegExp,l=t instanceof RegExp;if(p!=l)return!1;if(p&&l)return e.toString()==t.toString();const s=Object.keys(e);if(c=s.length,c!==Object.keys(t).length)return!1;for(o=c;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,s[o]))return!1;for(o=c;o--!==0;)if(a=s[o],!this.deepEquals(e[a],t[a]))return!1;return!0}return e!==e&&t!==t},resolveFieldData(e,t){if(e&&Object.keys(e).length&&t){if(t.indexOf(".")===-1)return e[t];{const r=t.split(".");let i=e;for(let o=0,c=r.length;o<c;++o){if(e==null)return null;i=i[r[o]]}return i}}else return null},isFunction(e){return!!(e&&e.constructor&&e.call&&e.apply)},findIndexInList(e,t){let r=-1;if(t){for(let i=0;i<t.length;i++)if(this.equals(t[i],e)){r=i;break}}return r},contains(e,t){if(e!=null&&t&&t.length){for(const r of t)if(this.equals(e,r))return!0}return!1},isEmpty(e){return e==null||e===""||Array.isArray(e)&&e.length===0||!(e instanceof Date)&&typeof e=="object"&&Object.keys(e).length===0},isNotEmpty(e){return!this.isEmpty(e)},pickBy(e,t){return Object.fromEntries(Object.entries(e).filter(([r])=>t(r)))},removeFromList(e,t){const r=this.findIndexInList(e,t);return r>-1?t.filter((i,o)=>o!==r):t},isString(e){return typeof e=="string"||e instanceof String},propsToObject(e){return Object.keys(e).reduce((t,r)=>{var i,o,c,a,u;return this.isFunction(e[r])?t[r]=e[r]():Array.isArray(e[r])?t[r]=e[r][0]():(i=e[r])!=null&&i.type&&(Array.isArray(e[r].type)?t[r]=((o=e[r])==null?void 0:o.default)||((c=e[r])==null?void 0:c.type[0]()):t[r]=((a=e[r])==null?void 0:a.default)||((u=e[r])==null?void 0:u.type())),t},{})},filterArray(e,t,r){return e.filter(i=>t.some(o=>typeof o=="string"?i[r]==o:this.equals(i[r],o[r])))},kebabCase(e){var t,r;if(e)return(r=(t=e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:t.join("-"))==null?void 0:r.toLowerCase()}},q={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}};function w(e,t){const r={[`${e}`]:!0};return{bemCssClasses:n.computed(()=>Object.keys(t).reduce((o,c)=>{const a=n.unref(t[c])||!1;if(!a)return o;if(c==="modifiers"){const u=Array.isArray(a)?a:[a];return{...o,...u.reduce((f,p)=>({...f,[`${e}--${y.kebabCase(p)}`]:!0}),{})}}else return{...o,[`${e}--${y.kebabCase(c)}`]:a}},r)||{})}}const E=n.defineComponent({__name:"VvIcon",props:q,setup(e){const t=e,r=n.ref(!0),{modifiers:i}=n.toRefs(t),o=n.inject("ds"),{bemCssClasses:c}=w("vv-icon",{modifiers:i}),a=n.computed(()=>t.provider||(o==null?void 0:o.provider)),u=n.computed(()=>{const l=t.name||"",s=`@${a.value}:${t.prefix}:${t.name}`;return _.iconExists(l)?l:_.iconExists(s)?s:(o==null?void 0:o.iconsCollections.find(d=>{const m=`@${a.value}:${d.prefix}:${l}`;if(_.iconExists(m))return m}))||l});function f(l){let s=null;if(typeof window>"u"){const{JSDOM:S}=require("jsdom");s=new S().window}return(s?new s.DOMParser:new window.DOMParser).parseFromString(l,"text/html").querySelector("svg")}function p(l){const s=f(l),d=(s==null?void 0:s.innerHTML.trim())||"";s&&d&&_.addIcon(`@${a.value}:${t.prefix}:${t.name}`,{body:d,height:s.viewBox.baseVal.height,width:s.viewBox.baseVal.width})}return o&&(t.src?(r.value=!1,o.fetchIcon(t.src).then(l=>{l&&(p(l),r.value=!0)}).catch(l=>{throw new Error(`During fetch icon: ${l==null?void 0:l.message}`)})):t.svg&&p(t.svg)),(l,s)=>r.value?(n.openBlock(),n.createBlock(n.unref(_.Icon),n.mergeProps({key:0,class:n.unref(c)},{...l.$props,provider:n.unref(a),icon:n.unref(u)}),null,16,["class"])):n.createCommentVNode("",!0)}});function L(e){const t=n.inject(e,void 0);console.log("Inject - ",t);const r=n.computed(()=>y.isNotEmpty(t));function i(o,c,a){if(t!=null&&t.value){const u=n.unref(t.value)[o];return n.computed({get(){return u==null?void 0:u.value},set(f){u.value=f}})}else{const u=n.toRef(c,o);return n.computed({get(){return u.value},set(f){a&&a(`update:${o}`,f)}})}}return{group:t,isInGroup:r,getGroupOrLocalRef:i}}const D=Symbol("VV_BUTTON_GROUP");function I(e){const{group:t,isInGroup:r,getGroupOrLocalRef:i}=L(D),{modifiers:o,fullBleed:c,iconPosition:a,icon:u,label:f,block:p,selected:l}=n.toRefs(e),s=i("modelValue",e),d=i("disabled",e),m=i("toggle",e),h=i("rounded",e),S=i("action",e),C=i("actionQuiet",e);return{modelValue:s,disabled:d,toggle:m,isInGroup:r,group:t,modifiers:o,action:S,actionQuiet:C,selected:l,block:p,rounded:h,fullBleed:c,iconPosition:a,icon:u,label:f}}const V={key:1,class:"vv-button__label"},x={key:1,class:"vv-button__label"};return n.defineComponent({__name:"VvButton",props:j,setup(e){const t=e,r=n.useAttrs(),i=(r==null?void 0:r.name)||B.v4(),{modifiers:o,action:c,actionQuiet:a,block:u,rounded:f,fullBleed:p,iconPosition:l,icon:s,label:d,modelValue:m,disabled:h,toggle:S,isInGroup:C}=I(t),$=n.computed(()=>{switch(!0){case h.value:return k.button;case t.to!==void 0:return k.routerLink;case t.href!==void 0:return k.a;default:return k.button}}),N=n.computed(()=>S.value?Array.isArray(m.value)?y.contains(i,m.value):y.equals(i,m.value):t.active),P=n.computed(()=>S.value?Array.isArray(m.value)?y.contains(i,m.value):y.equals(i,m.value):t.selected),{bemCssClasses:R}=w("vv-button",{modifiers:o,active:N,action:c,actionQuiet:a,selected:P,block:u,rounded:f,fullBleed:p,disabled:h,reverse:n.computed(()=>[b.right,b.bottom].includes(l.value)),column:n.computed(()=>[b.top,b.bottom].includes(l.value)),iconOnly:n.computed(()=>(s==null?void 0:s.value)&&!(d!=null&&d.value))}),F=n.computed(()=>({...G.value,"aria-label":t.label||r["aria-label"],"aria-disabled":h.value,role:"button",class:R.value,to:t.to})),G=n.computed(()=>{const g=$.value===k.a;let A={};return g&&(A=h.value?{href:"javascript:;"}:{target:t.target,href:t.href}),A});function M(){C.value&&(m.value=i)}return(g,A)=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref($)),n.mergeProps(n.unref(F),{onClickPassive:M}),{default:n.withCtx(()=>[n.renderSlot(g.$slots,"default",{},()=>[g.loading?n.renderSlot(g.$slots,"loading",{key:0},()=>[g.loadingIcon?(n.openBlock(),n.createBlock(E,{key:0,class:"vv-button__loading-icon",name:g.loadingIcon},null,8,["name"])):n.createCommentVNode("",!0),g.loadingLabel?(n.openBlock(),n.createElementBlock("span",V,n.toDisplayString(g.loadingLabel),1)):n.createCommentVNode("",!0)]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.renderSlot(g.$slots,"before"),n.unref(s)?(n.openBlock(),n.createBlock(E,{key:0,class:"vv-button__icon",name:n.unref(s)},null,8,["name"])):n.createCommentVNode("",!0),n.unref(d)?(n.openBlock(),n.createElementBlock("span",x,[n.renderSlot(g.$slots,"label",{},()=>[n.createTextVNode(n.toDisplayString(n.unref(d)),1)])])):n.createCommentVNode("",!0),n.renderSlot(g.$slots,"after")],64))])]),_:3},16))}})});