@volverjs/ui-vue 0.0.13-beta.4 → 0.0.13-beta.5

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 (89) hide show
  1. package/bin/icons.cjs +2 -1
  2. package/bin/icons.js +61 -1
  3. package/dist/components/VvAccordion/VvAccordion.es.js +244 -1
  4. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  5. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +529 -2
  6. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  7. package/dist/components/VvAction/VvAction.es.js +235 -1
  8. package/dist/components/VvAction/VvAction.umd.js +1 -1
  9. package/dist/components/VvAlert/VvAlert.es.js +374 -1
  10. package/dist/components/VvAlert/VvAlert.umd.js +1 -1
  11. package/dist/components/VvAlertGroup/VvAlertGroup.es.js +539 -1
  12. package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
  13. package/dist/components/VvAvatar/VvAvatar.es.js +57 -1
  14. package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
  15. package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +150 -1
  16. package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
  17. package/dist/components/VvBadge/VvBadge.es.js +58 -1
  18. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  19. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +322 -1
  20. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  21. package/dist/components/VvButton/VvButton.es.js +687 -1
  22. package/dist/components/VvButton/VvButton.umd.js +1 -1
  23. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +125 -1
  24. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  25. package/dist/components/VvCard/VvCard.es.js +76 -1
  26. package/dist/components/VvCard/VvCard.umd.js +1 -1
  27. package/dist/components/VvCheckbox/VvCheckbox.es.js +521 -1
  28. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  29. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +708 -1
  30. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  31. package/dist/components/VvCombobox/VvCombobox.es.js +2801 -1
  32. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  33. package/dist/components/VvDialog/VvDialog.es.js +215 -1
  34. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  35. package/dist/components/VvDropdown/VvDropdown.es.js +559 -1
  36. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  37. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +339 -1
  38. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
  39. package/dist/components/VvDropdownItem/VvDropdownItem.es.js +60 -1
  40. package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
  41. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +42 -1
  42. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
  43. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +162 -1
  44. package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
  45. package/dist/components/VvIcon/VvIcon.es.js +94 -1
  46. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  47. package/dist/components/VvInputFile/VvInputFile.es.js +1315 -1
  48. package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
  49. package/dist/components/VvInputText/VvInputText.es.js +2225 -4
  50. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  51. package/dist/components/VvNav/VvNav.es.js +345 -1
  52. package/dist/components/VvNav/VvNav.umd.js +1 -1
  53. package/dist/components/VvNavItem/VvNavItem.es.js +265 -1
  54. package/dist/components/VvNavItem/VvNavItem.umd.js +1 -1
  55. package/dist/components/VvNavSeparator/VvNavSeparator.es.js +21 -1
  56. package/dist/components/VvNavSeparator/VvNavSeparator.umd.js +1 -1
  57. package/dist/components/VvProgress/VvProgress.es.js +85 -1
  58. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  59. package/dist/components/VvRadio/VvRadio.es.js +469 -1
  60. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  61. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +656 -1
  62. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  63. package/dist/components/VvSelect/VvSelect.es.js +803 -1
  64. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  65. package/dist/components/VvTab/VvTab.es.js +436 -1
  66. package/dist/components/VvTab/VvTab.umd.js +1 -1
  67. package/dist/components/VvTextarea/VvTextarea.es.js +1533 -2
  68. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  69. package/dist/components/VvTooltip/VvTooltip.es.js +78 -1
  70. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
  71. package/dist/components/VvVirtualScroll/VvVirtualScroll.es.js +153 -1
  72. package/dist/components/VvVirtualScroll/VvVirtualScroll.umd.js +1 -1
  73. package/dist/components/index.es.js +7005 -6
  74. package/dist/components/index.umd.js +1 -1
  75. package/dist/composables/index.es.js +232 -2
  76. package/dist/composables/index.umd.js +1 -1
  77. package/dist/directives/index.es.js +186 -2
  78. package/dist/directives/index.umd.js +1 -1
  79. package/dist/directives/v-contextmenu.es.js +97 -2
  80. package/dist/directives/v-contextmenu.umd.js +1 -1
  81. package/dist/directives/v-tooltip.es.js +93 -1
  82. package/dist/directives/v-tooltip.umd.js +1 -1
  83. package/dist/icons.es.js +24 -1
  84. package/dist/icons.umd.js +1 -1
  85. package/dist/index.es.js +160 -1
  86. package/dist/index.umd.js +1 -1
  87. package/dist/resolvers/unplugin.es.js +128 -1
  88. package/dist/resolvers/unplugin.umd.js +1 -1
  89. package/package.json +24 -24
package/bin/icons.cjs CHANGED
@@ -1 +1,2 @@
1
- !function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("node:fs"),require("node:path"),require("yargs"),require("yargs/helpers"),require("@iconify/tools"),require("@iconify/utils"),require("chokidar")):"function"==typeof define&&define.amd?define(["exports","node:fs","node:path","yargs","yargs/helpers","@iconify/tools","@iconify/utils","chokidar"],o):o((e="undefined"!=typeof globalThis?globalThis:e||self)["generate-icons"]={},e.fileSystem,e.path,e.yargs,e.helpers,e.tools,e.utils,e.chokidar)}(this,function(e,o,r,n,t,i,s,c){"use strict";function a(e,n="iconify",t={}){return o.readdirSync(e).forEach(i=>{o.statSync(`${e}/${i}`).isDirectory()?t=a(`${e}/${i}`,i,t):i.includes(".svg")&&(t[n]?t[n].push(r.join(e,"/",i)):t[n]=[r.join(e,"/",i)])}),t}function l(e,n,t){const c=a(e,t?.prefix);Object.keys(c).length?Object.keys(c).forEach(e=>{!async function(e,n,t,c){const a=i.blankIconSet(e);for(const r of n)try{const e=await o.promises.readFile(r,{encoding:"utf-8"}),n=new i.SVG(e);await i.cleanupSVG(n),c?.keepColors||await i.parseColors(n,{defaultColor:"currentColor",callback:(e,o,r)=>!r||i.isEmptyColor(r)||o.includes("var(")?o:"currentColor"}),await i.runSVGO(n);const t=r.replace(/^.*[\\/]/,"").split(".")[0].replace(/ /g,"-").replace(/[^a-z0-9-]/gi,"");a.fromSVG(t,n)}catch(d){console.error(d)}const l=a.export();try{s.validateIconSet(l)}catch(d){throw new Error(`Icon set is not valid: ${d?.message}`)}const f=`${t}/${l.prefix}.json`;o.mkdirSync(r.dirname(f),{recursive:!0}),o.writeFileSync(f,JSON.stringify(l))}(e,c[e],n,t),console.info(`Icons generated in: ${n}/${e}.json\n`)}):console.error(`There are no files in ${e}`)}const f=n(t.hideBin(process.argv)).argv,d=f.srcPath,p=f.destPath||d;d&&p||(console.error("Please specify the srcPath and destPath with --srcPath and --destPath"),process.exit());const u={prefix:f.prefix,keepColors:f.keepColors};f.watch?(l(d,p,u),c.watch(d,{ignoreInitial:!0}).on("add",()=>{l(d,p,u)}).on("change",()=>{l(d,p,u)})):l(d,p,u),e.createIconifyJsonFiles=l,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
1
+ (function(e,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("node:fs"),require("node:path"),require("yargs"),require("yargs/helpers"),require("@iconify/tools"),require("@iconify/utils"),require("chokidar")):typeof define=="function"&&define.amd?define(["exports","node:fs","node:path","yargs","yargs/helpers","@iconify/tools","@iconify/utils","chokidar"],i):(e=typeof globalThis<"u"?globalThis:e||self,i(e["generate-icons"]={},e.fileSystem,e.path,e.yargs,e.helpers,e.tools,e.utils,e.chokidar))})(this,(function(e,i,l,m,C,c,I,q){"use strict";function w(o,s="iconify",r={}){return i.readdirSync(o).forEach(n=>{i.statSync(`${o}/${n}`).isDirectory()?r=w(`${o}/${n}`,n,r):n.includes(".svg")&&(r[s]?r[s].push(l.join(o,"/",n)):r[s]=[l.join(o,"/",n)])}),r}async function O(o,s,r,a){const n=c.blankIconSet(o);for(const y of s)try{const k=await i.promises.readFile(y,{encoding:"utf-8"}),h=new c.SVG(k);await c.cleanupSVG(h),a?.keepColors||await c.parseColors(h,{defaultColor:"currentColor",callback:(x,S,$)=>!$||c.isEmptyColor($)||S.includes("var(")?S:"currentColor"}),await c.runSVGO(h);const j=y.replace(/^.*[\\/]/,"").split(".")[0].replace(/ /g,"-").replace(/[^a-z0-9-]/gi,"");n.fromSVG(j,h)}catch(k){console.error(k)}const g=n.export();try{I.validateIconSet(g)}catch(y){throw new Error(`Icon set is not valid: ${y?.message}`)}const v=`${r}/${g.prefix}.json`;i.mkdirSync(l.dirname(v),{recursive:!0}),i.writeFileSync(v,JSON.stringify(g))}function f(o,s,r){const a=w(o,r?.prefix);Object.keys(a).length?Object.keys(a).forEach(n=>{O(n,a[n],s,r),console.info(`Icons generated in: ${s}/${n}.json
2
+ `)}):console.error(`There are no files in ${o}`)}const u=m(C.hideBin(process.argv)).argv,t=u.srcPath,d=u.destPath||t;(!t||!d)&&(console.error("Please specify the srcPath and destPath with --srcPath and --destPath"),process.exit());const p={prefix:u.prefix,keepColors:u.keepColors};u.watch?(f(t,d,p),q.watch(t,{ignoreInitial:!0}).on("add",()=>{f(t,d,p)}).on("change",()=>{f(t,d,p)})):f(t,d,p),e.createIconifyJsonFiles=f,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
package/bin/icons.js CHANGED
@@ -1,2 +1,62 @@
1
1
  #!/usr/bin/env node
2
- import o from"node:fs";import r from"node:path";import e from"yargs";import{hideBin as t}from"yargs/helpers";import{blankIconSet as n,SVG as i,cleanupSVG as c,parseColors as s,isEmptyColor as a,runSVGO as f}from"@iconify/tools";import{validateIconSet as l}from"@iconify/utils";import p from"chokidar";function h(e,t="iconify",n={}){return o.readdirSync(e).forEach(i=>{o.statSync(`${e}/${i}`).isDirectory()?n=h(`${e}/${i}`,i,n):i.includes(".svg")&&(n[t]?n[t].push(r.join(e,"/",i)):n[t]=[r.join(e,"/",i)])}),n}function d(e,t,p){const d=h(e,p?.prefix);Object.keys(d).length?Object.keys(d).forEach(e=>{!async function(e,t,p,h){const d=n(e);for(const r of t)try{const e=await o.promises.readFile(r,{encoding:"utf-8"}),t=new i(e);await c(t),h?.keepColors||await s(t,{defaultColor:"currentColor",callback:(o,r,e)=>!e||a(e)||r.includes("var(")?r:"currentColor"}),await f(t);const n=r.replace(/^.*[\\/]/,"").split(".")[0].replace(/ /g,"-").replace(/[^a-z0-9-]/gi,"");d.fromSVG(n,t)}catch(g){console.error(g)}const m=d.export();try{l(m)}catch(g){throw new Error(`Icon set is not valid: ${g?.message}`)}const y=`${p}/${m.prefix}.json`;o.mkdirSync(r.dirname(y),{recursive:!0}),o.writeFileSync(y,JSON.stringify(m))}(e,d[e],t,p),console.info(`Icons generated in: ${t}/${e}.json\n`)}):console.error(`There are no files in ${e}`)}const m=e(t(process.argv)).argv,y=m.srcPath,g=m.destPath||y;y&&g||(console.error("Please specify the srcPath and destPath with --srcPath and --destPath"),process.exit());const u={prefix:m.prefix,keepColors:m.keepColors};m.watch?(d(y,g,u),p.watch(y,{ignoreInitial:!0}).on("add",()=>{d(y,g,u)}).on("change",()=>{d(y,g,u)})):d(y,g,u);export{d as createIconifyJsonFiles};
2
+ import i from "node:fs";
3
+ import u from "node:path";
4
+ import $ from "yargs";
5
+ import { hideBin as k } from "yargs/helpers";
6
+ import { blankIconSet as C, SVG as I, cleanupSVG as E, parseColors as G, isEmptyColor as O, runSVGO as V } from "@iconify/tools";
7
+ import { validateIconSet as x } from "@iconify/utils";
8
+ import J from "chokidar";
9
+ function w(r, n = "iconify", o = {}) {
10
+ return i.readdirSync(r).forEach((e) => {
11
+ i.statSync(`${r}/${e}`).isDirectory() ? o = w(`${r}/${e}`, e, o) : e.includes(".svg") && (o[n] ? o[n].push(u.join(r, "/", e)) : o[n] = [u.join(r, "/", e)]);
12
+ }), o;
13
+ }
14
+ async function P(r, n, o, s) {
15
+ const e = C(r);
16
+ for (const l of n)
17
+ try {
18
+ const h = await i.promises.readFile(l, {
19
+ encoding: "utf-8"
20
+ }), f = new I(h);
21
+ await E(f), s?.keepColors || await G(f, {
22
+ defaultColor: "currentColor",
23
+ callback: (j, g, S) => !S || O(S) || g.includes("var(") ? g : "currentColor"
24
+ }), await V(f);
25
+ const v = l.replace(/^.*[\\/]/, "").split(".")[0].replace(/ /g, "-").replace(/[^a-z0-9-]/gi, "");
26
+ e.fromSVG(v, f);
27
+ } catch (h) {
28
+ console.error(h);
29
+ }
30
+ const d = e.export();
31
+ try {
32
+ x(d);
33
+ } catch (l) {
34
+ throw new Error(
35
+ `Icon set is not valid: ${l?.message}`
36
+ );
37
+ }
38
+ const y = `${o}/${d.prefix}.json`;
39
+ i.mkdirSync(u.dirname(y), { recursive: !0 }), i.writeFileSync(y, JSON.stringify(d));
40
+ }
41
+ function p(r, n, o) {
42
+ const s = w(r, o?.prefix);
43
+ Object.keys(s).length ? Object.keys(s).forEach((e) => {
44
+ P(e, s[e], n, o), console.info(`Icons generated in: ${n}/${e}.json
45
+ `);
46
+ }) : console.error(`There are no files in ${r}`);
47
+ }
48
+ const a = $(k(process.argv)).argv, t = a.srcPath, c = a.destPath || t;
49
+ (!t || !c) && (console.error(
50
+ "Please specify the srcPath and destPath with --srcPath and --destPath"
51
+ ), process.exit());
52
+ const m = { prefix: a.prefix, keepColors: a.keepColors };
53
+ a.watch ? (p(t, c, m), J.watch(t, {
54
+ ignoreInitial: !0
55
+ }).on("add", () => {
56
+ p(t, c, m);
57
+ }).on("change", () => {
58
+ p(t, c, m);
59
+ })) : p(t, c, m);
60
+ export {
61
+ p as createIconifyJsonFiles
62
+ };
@@ -1 +1,244 @@
1
- import{inject as e,computed as o,toRef as a,unref as t,defineComponent as n,useAttrs as r,useId as i,toRefs as u,ref as l,watch as s,onBeforeUnmount as d,createElementBlock as c,openBlock as p,normalizeClass as v,createElementVNode as m,withModifiers as f,renderSlot as g,normalizeProps as b,guardReactiveProps as y,createTextVNode as x,toDisplayString as A}from"vue";import{useVModel as E}from"@vueuse/core";var $=/* @__PURE__ */(e=>(e.local="local",e.session="session",e))($||{}),h=/* @__PURE__ */(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(h||{}),k=/* @__PURE__ */(e=>(e.before="before",e.after="after",e))(k||{}),G=/* @__PURE__ */(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(G||{}),S=/* @__PURE__ */(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(S||{});const V=/* @__PURE__ */Symbol.for("accordionGroup"),B={modifiers:{type:[String,Array],default:void 0}};k.before,h.bottom,G.button,S.button,$.local;const C={...B,name:String,title:String,content:String,modelValue:{type:Boolean,default:void 0},disabled:Boolean,not:Boolean};function I(t){const{group:n,isInGroup:r}=function(t){const n=e(t,void 0),r=o(()=>void 0!==n);return{group:n,isInGroup:r,getGroupOrLocalRef:function(e,t,r){const i=n?.[e];if(i)return o({get:()=>i.value,set(e){i.value=e}});const u=a(t,e);return o({get:()=>u.value,set(o){r&&r(`update:${e}`,o)}})}}}(V),i=o(()=>Boolean(t.disabled||n?.disabled.value)),u=o(()=>{let e=t.modifiers,o=n?.modifiers.value;const a=/* @__PURE__ */new Set;return e&&(Array.isArray(e)||(e=e.split(" ")),e.forEach(e=>a.add(e))),o&&(Array.isArray(o)||(o=o.split(" ")),o.forEach(e=>a.add(e))),Array.from(a)});return{isInGroup:r,group:n,modifiers:u,disabled:i,bus:n?.bus}}const _=["id","open"],w=["aria-controls","aria-expanded"],L=["aria-hidden"],O=/* @__PURE__ */n({name:"VvAccordion",props:C,emits:["update:modelValue"],setup(e,{expose:a,emit:n}){const $=e,h=n,k=r(),G=E($,"modelValue",h),S=o(()=>$.name||k?.id||i()),{title:V,content:B,not:C}=u($),{isInGroup:O,modifiers:Y,disabled:j,bus:R}=I($),q=l(!1);function z(){j.value||(O.value?R?.emit("toggle",{name:S.value,value:!q.value}):q.value=!q.value)}function D(){q.value||z()}function F(){q.value&&z()}function H(e){R?R.emit("expand",{name:e}):console.warn(`[VvAccordion]: You are trying to expand accordion group of "${S.value}" but it is not in a group`)}function J(e){R?R?.emit("collapse",{name:e}):console.warn(`[VvAccordion]: You are trying to collapse accordion group of "${S.value}" but it is not in a group`)}s(G,e=>{"boolean"==typeof e&&(q.value=C.value?!e:e)},{immediate:!0}),s(q,e=>{G.value=C.value?!e:e}),R?.on("toggle",({name:e,value:o})=>{e===S.value&&(q.value=o)}),s(S,(e,o)=>{R&&(o&&o!==e&&R.emit("unregister",{name:o}),R.emit("register",{name:e}))},{immediate:!0}),d(()=>{R&&R.emit("unregister",{name:S.value})}),a({isExpanded:q,expand:D,collapse:F,groupExpand:H,groupCollapse:J});const K=function(e,a,n){return o(()=>{const o={[e]:!0},r="string"==typeof a?.value?a.value.split(" "):a?.value;return r&&Array.isArray(r)&&r.forEach(a=>{a&&(o[`${e}--${a}`]=!0)}),n&&Object.keys(n.value).forEach(a=>{o[`${e}--${a}`]=t(n.value[a])}),o})}("vv-accordion",Y,o(()=>({disabled:j.value})));return(e,o)=>(p(),c("details",{id:t(S),class:v(t(K)),open:t(q)},[m("summary",{"aria-controls":t(S),"aria-expanded":t(q),class:"vv-accordion__summary",onClick:o[0]||(o[0]=f(e=>z(),["prevent"]))},[g(e.$slots,"summary",b(y({isExpanded:t(q),expand:D,collapse:F,groupExpand:H,groupCollapse:J})),()=>[x(A(t(V)),1)])],8,w),m("div",{"aria-hidden":!t(q),class:"vv-accordion__content"},[g(e.$slots,"default",b(y({isExpanded:t(q),expand:D,collapse:F,groupExpand:H,groupCollapse:J})),()=>[x(A(t(B)),1)])],8,L)],10,_))}});export{O as default};
1
+ import { inject as L, computed as p, toRef as Y, unref as c, defineComponent as z, useAttrs as D, useId as U, toRefs as w, ref as J, watch as E, onBeforeUnmount as K, createElementBlock as q, openBlock as F, normalizeClass as H, createElementVNode as C, withModifiers as Q, renderSlot as $, normalizeProps as R, guardReactiveProps as k, createTextVNode as G, toDisplayString as I } from "vue";
2
+ import { useVModel as W } from "@vueuse/core";
3
+ var P = /* @__PURE__ */ ((e) => (e.local = "local", e.session = "session", e))(P || {}), V = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(V || {}), M = /* @__PURE__ */ ((e) => (e.before = "before", e.after = "after", e))(M || {}), O = /* @__PURE__ */ ((e) => (e.button = "button", e.submit = "submit", e.reset = "reset", e))(O || {}), B = /* @__PURE__ */ ((e) => (e.nuxtLink = "nuxt-link", e.routerLink = "router-link", e.a = "a", e.button = "button", e))(B || {});
4
+ const X = /* @__PURE__ */ Symbol.for(
5
+ "accordionGroup"
6
+ ), Z = {
7
+ /**
8
+ * Component BEM modifiers
9
+ */
10
+ modifiers: {
11
+ type: [String, Array],
12
+ default: void 0
13
+ }
14
+ };
15
+ M.before;
16
+ V.bottom;
17
+ O.button, B.button;
18
+ P.local;
19
+ function T(e) {
20
+ const n = L(e, void 0), d = p(() => n !== void 0);
21
+ function i(s, r, u) {
22
+ const o = n?.[s];
23
+ if (o)
24
+ return p({
25
+ get() {
26
+ return o.value;
27
+ },
28
+ set(m) {
29
+ o.value = m;
30
+ }
31
+ });
32
+ const v = Y(r, s);
33
+ return p({
34
+ get() {
35
+ return v.value;
36
+ },
37
+ set(m) {
38
+ u && u(`update:${s}`, m);
39
+ }
40
+ });
41
+ }
42
+ return {
43
+ group: n,
44
+ isInGroup: d,
45
+ getGroupOrLocalRef: i
46
+ };
47
+ }
48
+ const ee = {
49
+ ...Z,
50
+ /**
51
+ * Accordion name
52
+ */
53
+ name: String,
54
+ /**
55
+ * Header title
56
+ */
57
+ title: String,
58
+ /**
59
+ * Content text
60
+ */
61
+ content: String,
62
+ /**
63
+ * (Optional) Defines if item is open. Event "update:modelValue" is emitted on accordion header click
64
+ */
65
+ modelValue: {
66
+ type: Boolean,
67
+ default: void 0
68
+ },
69
+ /**
70
+ * If true, the accordion will be disabled
71
+ */
72
+ disabled: Boolean,
73
+ /**
74
+ * If true, the accordion will be opened by default
75
+ */
76
+ not: Boolean
77
+ }, te = ["update:modelValue"];
78
+ function oe(e) {
79
+ const { group: n, isInGroup: d } = T(
80
+ X
81
+ ), i = p(
82
+ () => !!(e.disabled || n?.disabled.value)
83
+ ), s = p(() => {
84
+ let r = e.modifiers, u = n?.modifiers.value;
85
+ const o = /* @__PURE__ */ new Set();
86
+ return r && (Array.isArray(r) || (r = r.split(" ")), r.forEach((v) => o.add(v))), u && (Array.isArray(u) || (u = u.split(" ")), u.forEach((v) => o.add(v))), Array.from(o);
87
+ });
88
+ return {
89
+ // group props
90
+ isInGroup: d,
91
+ group: n,
92
+ modifiers: s,
93
+ disabled: i,
94
+ bus: n?.bus
95
+ };
96
+ }
97
+ function re(e, n, d) {
98
+ return p(() => {
99
+ const i = {
100
+ [e]: !0
101
+ }, s = typeof n?.value == "string" ? n.value.split(" ") : n?.value;
102
+ return s && Array.isArray(s) && s.forEach((r) => {
103
+ r && (i[`${e}--${r}`] = !0);
104
+ }), d && Object.keys(d.value).forEach((r) => {
105
+ i[`${e}--${r}`] = c(d.value[r]);
106
+ }), i;
107
+ });
108
+ }
109
+ const ne = ["id", "open"], ae = ["aria-controls", "aria-expanded"], ie = ["aria-hidden"], se = {
110
+ name: "VvAccordion"
111
+ }, de = /* @__PURE__ */ z({
112
+ ...se,
113
+ props: ee,
114
+ emits: te,
115
+ setup(e, { expose: n, emit: d }) {
116
+ const i = e, s = d, r = D(), u = W(i, "modelValue", s), o = p(
117
+ () => i.name || r?.id || U()
118
+ ), { title: v, content: m, not: x } = w(i), { isInGroup: S, modifiers: N, disabled: h, bus: l } = oe(i), a = J(!1);
119
+ E(
120
+ u,
121
+ (t) => {
122
+ typeof t == "boolean" && (a.value = x.value ? !t : t);
123
+ },
124
+ { immediate: !0 }
125
+ ), E(a, (t) => {
126
+ u.value = x.value ? !t : t;
127
+ }), l?.on("toggle", ({ name: t, value: f }) => {
128
+ t === o.value && (a.value = f);
129
+ });
130
+ function b() {
131
+ if (!h.value) {
132
+ if (S.value) {
133
+ l?.emit("toggle", {
134
+ name: o.value,
135
+ value: !a.value
136
+ });
137
+ return;
138
+ }
139
+ a.value = !a.value;
140
+ }
141
+ }
142
+ E(
143
+ o,
144
+ (t, f) => {
145
+ l && (f && f !== t && l.emit("unregister", { name: f }), l.emit("register", { name: t }));
146
+ },
147
+ {
148
+ immediate: !0
149
+ }
150
+ ), K(() => {
151
+ l && l.emit("unregister", { name: o.value });
152
+ });
153
+ function g() {
154
+ a.value || b();
155
+ }
156
+ function y() {
157
+ a.value && b();
158
+ }
159
+ function _(t) {
160
+ if (!l) {
161
+ console.warn(
162
+ `[VvAccordion]: You are trying to expand accordion group of "${o.value}" but it is not in a group`
163
+ );
164
+ return;
165
+ }
166
+ l.emit("expand", { name: t });
167
+ }
168
+ function A(t) {
169
+ if (!l) {
170
+ console.warn(
171
+ `[VvAccordion]: You are trying to collapse accordion group of "${o.value}" but it is not in a group`
172
+ );
173
+ return;
174
+ }
175
+ l?.emit("collapse", { name: t });
176
+ }
177
+ n({
178
+ /** Whether the accordion is expanded */
179
+ isExpanded: a,
180
+ /** Expand the accordion */
181
+ expand: g,
182
+ /** Collapse the accordion */
183
+ collapse: y,
184
+ /** Expand accordions in the same group */
185
+ groupExpand: _,
186
+ /** Collapse accordions in the same group */
187
+ groupCollapse: A
188
+ });
189
+ const j = re(
190
+ "vv-accordion",
191
+ N,
192
+ p(() => ({
193
+ disabled: h.value
194
+ }))
195
+ );
196
+ return (t, f) => (F(), q("details", {
197
+ id: c(o),
198
+ class: H(c(j)),
199
+ open: c(a)
200
+ }, [
201
+ C("summary", {
202
+ "aria-controls": c(o),
203
+ "aria-expanded": c(a),
204
+ class: "vv-accordion__summary",
205
+ onClick: f[0] || (f[0] = Q((ue) => b(), ["prevent"]))
206
+ }, [
207
+ $(t.$slots, "summary", R(k({
208
+ isExpanded: c(a),
209
+ expand: g,
210
+ collapse: y,
211
+ groupExpand: _,
212
+ groupCollapse: A
213
+ })), () => [
214
+ G(
215
+ I(c(v)),
216
+ 1
217
+ /* TEXT */
218
+ )
219
+ ])
220
+ ], 8, ae),
221
+ C("div", {
222
+ "aria-hidden": !c(a),
223
+ class: "vv-accordion__content"
224
+ }, [
225
+ $(t.$slots, "default", R(k({
226
+ isExpanded: c(a),
227
+ expand: g,
228
+ collapse: y,
229
+ groupExpand: _,
230
+ groupCollapse: A
231
+ })), () => [
232
+ G(
233
+ I(c(m)),
234
+ 1
235
+ /* TEXT */
236
+ )
237
+ ])
238
+ ], 8, ie)
239
+ ], 10, ne));
240
+ }
241
+ });
242
+ export {
243
+ de as default
244
+ };
@@ -1 +1 @@
1
- !function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","@vueuse/core"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvAccordion=o(e.vue,e.core)}(this,function(e,o){"use strict";var t=(e=>(e.local="local",e.session="session",e))(t||{}),n=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(n||{}),r=(e=>(e.before="before",e.after="after",e))(r||{}),a=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(a||{}),u=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(u||{});const i=Symbol.for("accordionGroup"),l={modifiers:{type:[String,Array],default:void 0}};r.before,n.bottom,a.button,u.button,t.local;const s={...l,name:String,title:String,content:String,modelValue:{type:Boolean,default:void 0},disabled:Boolean,not:Boolean};function d(o){const{group:t,isInGroup:n}=function(o){const t=e.inject(o,void 0),n=e.computed(()=>void 0!==t);return{group:t,isInGroup:n,getGroupOrLocalRef:function(o,n,r){const a=t?.[o];if(a)return e.computed({get:()=>a.value,set(e){a.value=e}});const u=e.toRef(n,o);return e.computed({get:()=>u.value,set(e){r&&r(`update:${o}`,e)}})}}}(i),r=e.computed(()=>Boolean(o.disabled||t?.disabled.value)),a=e.computed(()=>{let e=o.modifiers,n=t?.modifiers.value;const r=new Set;return e&&(Array.isArray(e)||(e=e.split(" ")),e.forEach(e=>r.add(e))),n&&(Array.isArray(n)||(n=n.split(" ")),n.forEach(e=>r.add(e))),Array.from(r)});return{isInGroup:n,group:t,modifiers:a,disabled:r,bus:t?.bus}}const c=["id","open"],p=["aria-controls","aria-expanded"],f=["aria-hidden"];return e.defineComponent({name:"VvAccordion",props:s,emits:["update:modelValue"],setup(t,{expose:n,emit:r}){const a=t,u=r,i=e.useAttrs(),l=o.useVModel(a,"modelValue",u),s=e.computed(()=>a.name||i?.id||e.useId()),{title:m,content:v,not:g}=e.toRefs(a),{isInGroup:b,modifiers:y,disabled:x,bus:h}=d(a),A=e.ref(!1);function E(){x.value||(b.value?h?.emit("toggle",{name:s.value,value:!A.value}):A.value=!A.value)}function V(){A.value||E()}function S(){A.value&&E()}function $(e){h?h.emit("expand",{name:e}):console.warn(`[VvAccordion]: You are trying to expand accordion group of "${s.value}" but it is not in a group`)}function k(e){h?h?.emit("collapse",{name:e}):console.warn(`[VvAccordion]: You are trying to collapse accordion group of "${s.value}" but it is not in a group`)}e.watch(l,e=>{"boolean"==typeof e&&(A.value=g.value?!e:e)},{immediate:!0}),e.watch(A,e=>{l.value=g.value?!e:e}),h?.on("toggle",({name:e,value:o})=>{e===s.value&&(A.value=o)}),e.watch(s,(e,o)=>{h&&(o&&o!==e&&h.emit("unregister",{name:o}),h.emit("register",{name:e}))},{immediate:!0}),e.onBeforeUnmount(()=>{h&&h.emit("unregister",{name:s.value})}),n({isExpanded:A,expand:V,collapse:S,groupExpand:$,groupCollapse:k});const w=function(o,t,n){return e.computed(()=>{const r={[o]:!0},a="string"==typeof t?.value?t.value.split(" "):t?.value;return a&&Array.isArray(a)&&a.forEach(e=>{e&&(r[`${o}--${e}`]=!0)}),n&&Object.keys(n.value).forEach(t=>{r[`${o}--${t}`]=e.unref(n.value[t])}),r})}("vv-accordion",y,e.computed(()=>({disabled:x.value})));return(o,t)=>(e.openBlock(),e.createElementBlock("details",{id:e.unref(s),class:e.normalizeClass(e.unref(w)),open:e.unref(A)},[e.createElementVNode("summary",{"aria-controls":e.unref(s),"aria-expanded":e.unref(A),class:"vv-accordion__summary",onClick:t[0]||(t[0]=e.withModifiers(e=>E(),["prevent"]))},[e.renderSlot(o.$slots,"summary",e.normalizeProps(e.guardReactiveProps({isExpanded:e.unref(A),expand:V,collapse:S,groupExpand:$,groupCollapse:k})),()=>[e.createTextVNode(e.toDisplayString(e.unref(m)),1)])],8,p),e.createElementVNode("div",{"aria-hidden":!e.unref(A),class:"vv-accordion__content"},[e.renderSlot(o.$slots,"default",e.normalizeProps(e.guardReactiveProps({isExpanded:e.unref(A),expand:V,collapse:S,groupExpand:$,groupCollapse:k})),()=>[e.createTextVNode(e.toDisplayString(e.unref(v)),1)])],8,f)],10,c))}})});
1
+ (function(e,m){typeof exports=="object"&&typeof module<"u"?module.exports=m(require("vue"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["vue","@vueuse/core"],m):(e=typeof globalThis<"u"?globalThis:e||self,e.VvAccordion=m(e.vue,e.core))})(this,(function(e,m){"use strict";var A=(t=>(t.local="local",t.session="session",t))(A||{}),E=(t=>(t.left="left",t.right="right",t.top="top",t.bottom="bottom",t))(E||{}),x=(t=>(t.before="before",t.after="after",t))(x||{}),C=(t=>(t.button="button",t.submit="submit",t.reset="reset",t))(C||{}),R=(t=>(t.nuxtLink="nuxt-link",t.routerLink="router-link",t.a="a",t.button="button",t))(R||{});const P=Symbol.for("accordionGroup"),k={modifiers:{type:[String,Array],default:void 0}};x.before,E.bottom,C.button,R.button,A.local;function G(t){const i=e.inject(t,void 0),d=e.computed(()=>i!==void 0);function s(u,n,c){const r=i?.[u];if(r)return e.computed({get(){return r.value},set(g){r.value=g}});const p=e.toRef(n,u);return e.computed({get(){return p.value},set(g){c&&c(`update:${u}`,g)}})}return{group:i,isInGroup:d,getGroupOrLocalRef:s}}const I={...k,name:String,title:String,content:String,modelValue:{type:Boolean,default:void 0},disabled:Boolean,not:Boolean},S=["update:modelValue"];function M(t){const{group:i,isInGroup:d}=G(P),s=e.computed(()=>!!(t.disabled||i?.disabled.value)),u=e.computed(()=>{let n=t.modifiers,c=i?.modifiers.value;const r=new Set;return n&&(Array.isArray(n)||(n=n.split(" ")),n.forEach(p=>r.add(p))),c&&(Array.isArray(c)||(c=c.split(" ")),c.forEach(p=>r.add(p))),Array.from(r)});return{isInGroup:d,group:i,modifiers:u,disabled:s,bus:i?.bus}}function N(t,i,d){return e.computed(()=>{const s={[t]:!0},u=typeof i?.value=="string"?i.value.split(" "):i?.value;return u&&Array.isArray(u)&&u.forEach(n=>{n&&(s[`${t}--${n}`]=!0)}),d&&Object.keys(d.value).forEach(n=>{s[`${t}--${n}`]=e.unref(d.value[n])}),s})}const O=["id","open"],B=["aria-controls","aria-expanded"],j=["aria-hidden"],w={name:"VvAccordion"};return e.defineComponent({...w,props:I,emits:S,setup(t,{expose:i,emit:d}){const s=t,u=d,n=e.useAttrs(),c=m.useVModel(s,"modelValue",u),r=e.computed(()=>s.name||n?.id||e.useId()),{title:p,content:g,not:V}=e.toRefs(s),{isInGroup:z,modifiers:D,disabled:$,bus:l}=M(s),a=e.ref(!1);e.watch(c,o=>{typeof o=="boolean"&&(a.value=V.value?!o:o)},{immediate:!0}),e.watch(a,o=>{c.value=V.value?!o:o}),l?.on("toggle",({name:o,value:f})=>{o===r.value&&(a.value=f)});function b(){if(!$.value){if(z.value){l?.emit("toggle",{name:r.value,value:!a.value});return}a.value=!a.value}}e.watch(r,(o,f)=>{l&&(f&&f!==o&&l.emit("unregister",{name:f}),l.emit("register",{name:o}))},{immediate:!0}),e.onBeforeUnmount(()=>{l&&l.emit("unregister",{name:r.value})});function y(){a.value||b()}function _(){a.value&&b()}function v(o){if(!l){console.warn(`[VvAccordion]: You are trying to expand accordion group of "${r.value}" but it is not in a group`);return}l.emit("expand",{name:o})}function h(o){if(!l){console.warn(`[VvAccordion]: You are trying to collapse accordion group of "${r.value}" but it is not in a group`);return}l?.emit("collapse",{name:o})}i({isExpanded:a,expand:y,collapse:_,groupExpand:v,groupCollapse:h});const L=N("vv-accordion",D,e.computed(()=>({disabled:$.value})));return(o,f)=>(e.openBlock(),e.createElementBlock("details",{id:e.unref(r),class:e.normalizeClass(e.unref(L)),open:e.unref(a)},[e.createElementVNode("summary",{"aria-controls":e.unref(r),"aria-expanded":e.unref(a),class:"vv-accordion__summary",onClick:f[0]||(f[0]=e.withModifiers(q=>b(),["prevent"]))},[e.renderSlot(o.$slots,"summary",e.normalizeProps(e.guardReactiveProps({isExpanded:e.unref(a),expand:y,collapse:_,groupExpand:v,groupCollapse:h})),()=>[e.createTextVNode(e.toDisplayString(e.unref(p)),1)])],8,B),e.createElementVNode("div",{"aria-hidden":!e.unref(a),class:"vv-accordion__content"},[e.renderSlot(o.$slots,"default",e.normalizeProps(e.guardReactiveProps({isExpanded:e.unref(a),expand:y,collapse:_,groupExpand:v,groupCollapse:h})),()=>[e.createTextVNode(e.toDisplayString(e.unref(g)),1)])],8,j)],10,O))}})}));