@volverjs/ui-vue 0.0.10-beta.74 → 0.0.10-beta.76
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.
- package/README.md +8 -8
- package/bin/icons.cjs +1 -1
- package/bin/icons.js +3 -3
- package/dist/components/VvAccordion/VvAccordion.es.js +9 -9
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +14 -15
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAction/VvAction.es.js +10 -13
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.es.js +19 -19
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +19 -19
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAvatar/VvAvatar.es.js +1 -1
- package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +7 -8
- package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.es.js +1 -1
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +12 -18
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvButton/VvButton.es.js +32 -38
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvCard/VvCard.es.js +1 -1
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +10 -12
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +18 -22
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.es.js +266 -285
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +22 -14
- package/dist/components/VvCombobox/index.d.ts +22 -0
- package/dist/components/VvDialog/VvDialog.es.js +5 -7
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +10 -15
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +2 -2
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +2 -2
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +11 -14
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.es.js +5 -5
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvInputFile/VvInputFile.es.js +6829 -72
- package/dist/components/VvInputFile/VvInputFile.umd.js +7 -1
- package/dist/components/VvInputFile/VvInputFile.vue.d.ts +1 -1
- package/dist/components/VvInputText/VvInputText.es.js +54 -66
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +1 -1
- package/dist/components/VvNav/VvNav.es.js +16 -21
- package/dist/components/VvNav/VvNav.umd.js +1 -1
- package/dist/components/VvNavItem/VvNavItem.es.js +10 -13
- package/dist/components/VvNavItem/VvNavItem.umd.js +1 -1
- package/dist/components/VvNavSeparator/VvNavSeparator.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.es.js +1 -1
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +10 -12
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +18 -22
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.es.js +27 -30
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +3 -3
- package/dist/components/VvTab/VvTab.es.js +18 -25
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.es.js +47 -57
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +1 -1
- package/dist/components/VvTooltip/VvTooltip.es.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/index.es.js +7352 -629
- package/dist/components/index.umd.js +7 -1
- package/dist/composables/index.es.js +1787 -16
- package/dist/composables/index.umd.js +7 -1
- package/dist/directives/index.es.js +1782 -15
- package/dist/directives/index.umd.js +7 -1
- package/dist/directives/v-contextmenu.es.js +1781 -14
- package/dist/directives/v-contextmenu.umd.js +7 -1
- package/dist/directives/v-tooltip.es.js +1 -1
- package/dist/directives/v-tooltip.umd.js +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/index.es.js +9 -12
- package/dist/index.umd.js +1 -1
- package/dist/resolvers/unplugin.es.js +1 -1
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +2 -2
- package/dist/stories/Combobox/Combobox.stories.d.ts +1 -0
- package/package.json +35 -32
package/README.md
CHANGED
|
@@ -167,14 +167,14 @@ export default defineConfig({
|
|
|
167
167
|
Used to show alert messages and notifications
|
|
168
168
|
|
|
169
169
|
```typescript
|
|
170
|
-
export type AlertModifier
|
|
171
|
-
| 'success'
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
170
|
+
export type AlertModifier
|
|
171
|
+
= | 'success'
|
|
172
|
+
| 'info'
|
|
173
|
+
| 'warning'
|
|
174
|
+
| 'danger'
|
|
175
|
+
| 'brand'
|
|
176
|
+
| 'accent'
|
|
177
|
+
| string
|
|
178
178
|
```
|
|
179
179
|
|
|
180
180
|
```typescript
|
package/bin/icons.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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.
|
|
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.fs,e.path,e.yargs,e.yargsHelpers,e.IconifyTools,e.IconifyUtils,e.chokidar)}(this,function(e,o,r,n,i,t,s,c){"use strict";function a(e,n="iconify",i={}){return o.readdirSync(e).forEach(t=>{o.statSync(`${e}/${t}`).isDirectory()?i=a(`${e}/${t}`,t,i):t.includes(".svg")&&(i[n]?i[n].push(r.join(e,"/",t)):i[n]=[r.join(e,"/",t)])}),i}function l(e,n,i){const c=a(e,i?.prefix);Object.keys(c).length?Object.keys(c).forEach(e=>{!async function(e,n,i,c){const a=t.blankIconSet(e);for(const r of n)try{const e=await o.promises.readFile(r,{encoding:"utf-8"}),n=new t.SVG(e);await t.cleanupSVG(n),c?.keepColors||await t.parseColors(n,{defaultColor:"currentColor",callback:(e,o,r)=>!r||t.isEmptyColor(r)||o.includes("var(")?o:"currentColor"}),await t.runSVGO(n);const i=r.replace(/^.*[\\/]/,"").split(".")[0].replace(/ /g,"-").replace(/[^a-z0-9-]/gi,"");a.fromSVG(i,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=`${i}/${l.prefix}.json`;o.mkdirSync(r.dirname(f),{recursive:!0}),o.writeFileSync(f,JSON.stringify(l))}(e,c[e],n,i),console.info(`Icons generated in: ${n}/${e}.json\n`)}):console.error(`There are no files in ${e}`)}const f=n(i.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 y={prefix:f.prefix,keepColors:f.keepColors};f.watch?(l(d,p,y),c.watch(d,{ignoreInitial:!0}).on("add",()=>{l(d,p,y)}).on("change",()=>{l(d,p,y)})):l(d,p,y),e.createIconifyJsonFiles=l,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
package/bin/icons.js
CHANGED
|
@@ -28,7 +28,7 @@ async function generateIcons(prefix, files, destPath2, options2) {
|
|
|
28
28
|
});
|
|
29
29
|
const svg = new SVG(content);
|
|
30
30
|
await cleanupSVG(svg);
|
|
31
|
-
if (!
|
|
31
|
+
if (!options2?.keepColors) {
|
|
32
32
|
await parseColors(svg, {
|
|
33
33
|
defaultColor: "currentColor",
|
|
34
34
|
callback: (_attr, colorStr, color) => {
|
|
@@ -48,7 +48,7 @@ async function generateIcons(prefix, files, destPath2, options2) {
|
|
|
48
48
|
validateIconSet(iconifyJson);
|
|
49
49
|
} catch (error) {
|
|
50
50
|
throw new Error(
|
|
51
|
-
`Icon set is not valid: ${error
|
|
51
|
+
`Icon set is not valid: ${error?.message}`
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
const filename = `${destPath2}/${iconifyJson.prefix}.json`;
|
|
@@ -56,7 +56,7 @@ async function generateIcons(prefix, files, destPath2, options2) {
|
|
|
56
56
|
fileSystem.writeFileSync(filename, JSON.stringify(iconifyJson));
|
|
57
57
|
}
|
|
58
58
|
function createIconifyJsonFiles(srcPath2, destPath2, options2) {
|
|
59
|
-
const objectFiles = getAllFiles(srcPath2, options2
|
|
59
|
+
const objectFiles = getAllFiles(srcPath2, options2?.prefix);
|
|
60
60
|
if (!Object.keys(objectFiles).length) {
|
|
61
61
|
console.error(`There are no files in ${srcPath2}`);
|
|
62
62
|
} else {
|
|
@@ -81,7 +81,7 @@ function useGroupStateInject(groupKey) {
|
|
|
81
81
|
const group = inject(groupKey, void 0);
|
|
82
82
|
const isInGroup = computed(() => group !== void 0);
|
|
83
83
|
function getGroupOrLocalRef(propName, props, emit) {
|
|
84
|
-
const groupPropValue = group
|
|
84
|
+
const groupPropValue = group?.[propName];
|
|
85
85
|
if (groupPropValue) {
|
|
86
86
|
return computed({
|
|
87
87
|
get() {
|
|
@@ -146,11 +146,11 @@ function useGroupProps(props) {
|
|
|
146
146
|
INJECTION_KEY_ACCORDION_GROUP
|
|
147
147
|
);
|
|
148
148
|
const disabled = computed(
|
|
149
|
-
() => Boolean(props.disabled ||
|
|
149
|
+
() => Boolean(props.disabled || group?.disabled.value)
|
|
150
150
|
);
|
|
151
151
|
const modifiers = computed(() => {
|
|
152
152
|
let localModifiers = props.modifiers;
|
|
153
|
-
let groupModifiers = group
|
|
153
|
+
let groupModifiers = group?.modifiers.value;
|
|
154
154
|
const toReturn = /* @__PURE__ */ new Set();
|
|
155
155
|
if (localModifiers) {
|
|
156
156
|
if (!Array.isArray(localModifiers)) {
|
|
@@ -172,7 +172,7 @@ function useGroupProps(props) {
|
|
|
172
172
|
group,
|
|
173
173
|
modifiers,
|
|
174
174
|
disabled,
|
|
175
|
-
bus: group
|
|
175
|
+
bus: group?.bus
|
|
176
176
|
};
|
|
177
177
|
}
|
|
178
178
|
function useModifiers(prefix, modifiers, others) {
|
|
@@ -180,7 +180,7 @@ function useModifiers(prefix, modifiers, others) {
|
|
|
180
180
|
const toReturn = {
|
|
181
181
|
[prefix]: true
|
|
182
182
|
};
|
|
183
|
-
const modifiersArray = typeof
|
|
183
|
+
const modifiersArray = typeof modifiers?.value === "string" ? modifiers.value.split(" ") : modifiers?.value;
|
|
184
184
|
if (modifiersArray) {
|
|
185
185
|
if (Array.isArray(modifiersArray)) {
|
|
186
186
|
modifiersArray.forEach((modifier) => {
|
|
@@ -214,7 +214,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
214
214
|
const attrs = useAttrs();
|
|
215
215
|
const modelValue = useVModel(props, "modelValue", emit);
|
|
216
216
|
const accordionName = computed(
|
|
217
|
-
() => props.name ||
|
|
217
|
+
() => props.name || attrs?.id || useId()
|
|
218
218
|
);
|
|
219
219
|
const { title, content, not } = toRefs(props);
|
|
220
220
|
const { isInGroup, modifiers, disabled, bus } = useGroupProps(props);
|
|
@@ -231,7 +231,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
231
231
|
watch(isExpanded, (newValue) => {
|
|
232
232
|
modelValue.value = not.value ? !newValue : newValue;
|
|
233
233
|
});
|
|
234
|
-
bus
|
|
234
|
+
bus?.on("toggle", ({ name, value }) => {
|
|
235
235
|
if (name !== accordionName.value) {
|
|
236
236
|
return;
|
|
237
237
|
}
|
|
@@ -242,7 +242,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
244
|
if (isInGroup.value) {
|
|
245
|
-
bus
|
|
245
|
+
bus?.emit("toggle", {
|
|
246
246
|
name: accordionName.value,
|
|
247
247
|
value: !isExpanded.value
|
|
248
248
|
});
|
|
@@ -297,7 +297,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
297
297
|
);
|
|
298
298
|
return;
|
|
299
299
|
}
|
|
300
|
-
bus
|
|
300
|
+
bus?.emit("collapse", { name });
|
|
301
301
|
}
|
|
302
302
|
__expose({
|
|
303
303
|
isExpanded,
|
|
@@ -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.
|
|
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.VueUse)}(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),V=e.ref(!1);function A(){x.value||(b.value?h?.emit("toggle",{name:s.value,value:!V.value}):V.value=!V.value)}function E(){V.value||A()}function S(){V.value&&A()}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&&(V.value=g.value?!e:e)},{immediate:!0}),e.watch(V,e=>{l.value=g.value?!e:e}),h?.on("toggle",({name:e,value:o})=>{e===s.value&&(V.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:V,expand:E,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(V)},[e.createElementVNode("summary",{"aria-controls":e.unref(s),"aria-expanded":e.unref(V),class:"vv-accordion__summary",onClick:t[0]||(t[0]=e.withModifiers(e=>A(),["prevent"]))},[e.renderSlot(o.$slots,"summary",e.normalizeProps(e.guardReactiveProps({isExpanded:e.unref(V),expand:E,collapse:S,groupExpand:$,groupCollapse:k})),()=>[e.createTextVNode(e.toDisplayString(e.unref(m)),1)])],8,p),e.createElementVNode("div",{"aria-hidden":!e.unref(V),class:"vv-accordion__content"},[e.renderSlot(o.$slots,"default",e.normalizeProps(e.guardReactiveProps({isExpanded:e.unref(V),expand:E,collapse:S,groupExpand:$,groupCollapse:k})),()=>[e.createTextVNode(e.toDisplayString(e.unref(v)),1)])],8,f)],10,c))}})});
|
|
@@ -124,7 +124,7 @@ function useGroupStateInject(groupKey) {
|
|
|
124
124
|
const group = inject(groupKey, void 0);
|
|
125
125
|
const isInGroup = computed(() => group !== void 0);
|
|
126
126
|
function getGroupOrLocalRef(propName, props, emit) {
|
|
127
|
-
const groupPropValue = group
|
|
127
|
+
const groupPropValue = group?.[propName];
|
|
128
128
|
if (groupPropValue) {
|
|
129
129
|
return computed({
|
|
130
130
|
get() {
|
|
@@ -189,11 +189,11 @@ function useGroupProps(props) {
|
|
|
189
189
|
INJECTION_KEY_ACCORDION_GROUP
|
|
190
190
|
);
|
|
191
191
|
const disabled = computed(
|
|
192
|
-
() => Boolean(props.disabled ||
|
|
192
|
+
() => Boolean(props.disabled || group?.disabled.value)
|
|
193
193
|
);
|
|
194
194
|
const modifiers = computed(() => {
|
|
195
195
|
let localModifiers = props.modifiers;
|
|
196
|
-
let groupModifiers = group
|
|
196
|
+
let groupModifiers = group?.modifiers.value;
|
|
197
197
|
const toReturn = /* @__PURE__ */ new Set();
|
|
198
198
|
if (localModifiers) {
|
|
199
199
|
if (!Array.isArray(localModifiers)) {
|
|
@@ -215,7 +215,7 @@ function useGroupProps(props) {
|
|
|
215
215
|
group,
|
|
216
216
|
modifiers,
|
|
217
217
|
disabled,
|
|
218
|
-
bus: group
|
|
218
|
+
bus: group?.bus
|
|
219
219
|
};
|
|
220
220
|
}
|
|
221
221
|
function useModifiers(prefix, modifiers, others) {
|
|
@@ -223,7 +223,7 @@ function useModifiers(prefix, modifiers, others) {
|
|
|
223
223
|
const toReturn = {
|
|
224
224
|
[prefix]: true
|
|
225
225
|
};
|
|
226
|
-
const modifiersArray = typeof
|
|
226
|
+
const modifiersArray = typeof modifiers?.value === "string" ? modifiers.value.split(" ") : modifiers?.value;
|
|
227
227
|
if (modifiersArray) {
|
|
228
228
|
if (Array.isArray(modifiersArray)) {
|
|
229
229
|
modifiersArray.forEach((modifier) => {
|
|
@@ -257,7 +257,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
257
257
|
const attrs = useAttrs();
|
|
258
258
|
const modelValue = useVModel(props, "modelValue", emit);
|
|
259
259
|
const accordionName = computed(
|
|
260
|
-
() => props.name ||
|
|
260
|
+
() => props.name || attrs?.id || useId()
|
|
261
261
|
);
|
|
262
262
|
const { title, content, not } = toRefs(props);
|
|
263
263
|
const { isInGroup, modifiers, disabled, bus } = useGroupProps(props);
|
|
@@ -274,7 +274,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
274
274
|
watch(isExpanded, (newValue) => {
|
|
275
275
|
modelValue.value = not.value ? !newValue : newValue;
|
|
276
276
|
});
|
|
277
|
-
bus
|
|
277
|
+
bus?.on("toggle", ({ name, value }) => {
|
|
278
278
|
if (name !== accordionName.value) {
|
|
279
279
|
return;
|
|
280
280
|
}
|
|
@@ -285,7 +285,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
285
285
|
return;
|
|
286
286
|
}
|
|
287
287
|
if (isInGroup.value) {
|
|
288
|
-
bus
|
|
288
|
+
bus?.emit("toggle", {
|
|
289
289
|
name: accordionName.value,
|
|
290
290
|
value: !isExpanded.value
|
|
291
291
|
});
|
|
@@ -340,7 +340,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
340
340
|
);
|
|
341
341
|
return;
|
|
342
342
|
}
|
|
343
|
-
bus
|
|
343
|
+
bus?.emit("collapse", { name });
|
|
344
344
|
}
|
|
345
345
|
__expose({
|
|
346
346
|
isExpanded,
|
|
@@ -422,7 +422,7 @@ function usePersistence(storageKey, storageType = StorageType.local, defaultValu
|
|
|
422
422
|
if (newKey) {
|
|
423
423
|
storageValue = useStorage(
|
|
424
424
|
newKey,
|
|
425
|
-
|
|
425
|
+
storageValue?.value ?? localValue.value,
|
|
426
426
|
storage
|
|
427
427
|
);
|
|
428
428
|
if (storageValue.value) {
|
|
@@ -439,12 +439,12 @@ function usePersistence(storageKey, storageType = StorageType.local, defaultValu
|
|
|
439
439
|
}
|
|
440
440
|
if (isRef(storageType)) {
|
|
441
441
|
watch(storageType, (newType, oldType) => {
|
|
442
|
-
if (storageKey
|
|
442
|
+
if (storageKey?.value) {
|
|
443
443
|
if (newType) {
|
|
444
444
|
const storage = newType === StorageType.session ? sessionStorage : localStorage;
|
|
445
445
|
storageValue = useStorage(
|
|
446
446
|
storageKey.value,
|
|
447
|
-
|
|
447
|
+
storageValue?.value ?? localValue.value,
|
|
448
448
|
storage
|
|
449
449
|
);
|
|
450
450
|
}
|
|
@@ -657,9 +657,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
657
657
|
return openBlock(), createBlock(
|
|
658
658
|
_sfc_main$1,
|
|
659
659
|
mergeProps({
|
|
660
|
-
key: item.title
|
|
661
|
-
|
|
662
|
-
}, {
|
|
660
|
+
key: item.title
|
|
661
|
+
}, { ref_for: true }, {
|
|
663
662
|
name: item.name,
|
|
664
663
|
title: item.title,
|
|
665
664
|
content: item.content
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("mitt"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","mitt","@vueuse/core"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvAccordionGroup=o(e.
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("mitt"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","mitt","@vueuse/core"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvAccordionGroup=o(e.Vue,e.mitt,e.VueUse)}(this,function(e,o,t){"use strict";var a=(e=>(e.local="local",e.session="session",e))(a||{}),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||{}),l=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(l||{}),i=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(i||{});const u=Symbol.for("accordionGroup"),s={modifiers:{type:[String,Array],default:void 0}};r.before,n.bottom,l.button,i.button;const d={storageType:{type:String,default:a.local,validator:e=>Object.values(a).includes(e)},storageKey:String},c={...s,...d,modelValue:{type:[String,Array],default:void 0},items:{type:Array,default:()=>[]},collapse:Boolean,itemModifiers:{type:[String,Array],default:""},disabled:Boolean,not:Boolean};const m={...s,name:String,title:String,content:String,modelValue:{type:Boolean,default:void 0},disabled:Boolean,not:Boolean};function p(o){const{group:t,isInGroup:a}=function(o){const t=e.inject(o,void 0),a=e.computed(()=>void 0!==t);return{group:t,isInGroup:a,getGroupOrLocalRef:function(o,a,n){const r=t?.[o];if(r)return e.computed({get:()=>r.value,set(e){r.value=e}});const l=e.toRef(a,o);return e.computed({get:()=>l.value,set(e){n&&n(`update:${o}`,e)}})}}}(u),n=e.computed(()=>Boolean(o.disabled||t?.disabled.value)),r=e.computed(()=>{let e=o.modifiers,a=t?.modifiers.value;const n=new Set;return e&&(Array.isArray(e)||(e=e.split(" ")),e.forEach(e=>n.add(e))),a&&(Array.isArray(a)||(a=a.split(" ")),a.forEach(e=>n.add(e))),Array.from(n)});return{isInGroup:a,group:t,modifiers:r,disabled:n,bus:t?.bus}}function f(o,t,a){return e.computed(()=>{const n={[o]:!0},r="string"==typeof t?.value?t.value.split(" "):t?.value;return r&&Array.isArray(r)&&r.forEach(e=>{e&&(n[`${o}--${e}`]=!0)}),a&&Object.keys(a.value).forEach(t=>{n[`${o}--${t}`]=e.unref(a.value[t])}),n})}const v=["id","open"],g=["aria-controls","aria-expanded"],y=["aria-hidden"],b=e.defineComponent({name:"VvAccordion",props:m,emits:["update:modelValue"],setup(o,{expose:a,emit:n}){const r=o,l=n,i=e.useAttrs(),u=t.useVModel(r,"modelValue",l),s=e.computed(()=>r.name||i?.id||e.useId()),{title:d,content:c,not:m}=e.toRefs(r),{isInGroup:b,modifiers:S,disabled:x,bus:A}=p(r),V=e.ref(!1);function h(){x.value||(b.value?A?.emit("toggle",{name:s.value,value:!V.value}):V.value=!V.value)}function w(){V.value||h()}function k(){V.value&&h()}function $(e){A?A.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 B(e){A?A?.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(u,e=>{"boolean"==typeof e&&(V.value=m.value?!e:e)},{immediate:!0}),e.watch(V,e=>{u.value=m.value?!e:e}),A?.on("toggle",({name:e,value:o})=>{e===s.value&&(V.value=o)}),e.watch(s,(e,o)=>{A&&(o&&o!==e&&A.emit("unregister",{name:o}),A.emit("register",{name:e}))},{immediate:!0}),e.onBeforeUnmount(()=>{A&&A.emit("unregister",{name:s.value})}),a({isExpanded:V,expand:w,collapse:k,groupExpand:$,groupCollapse:B});const E=f("vv-accordion",S,e.computed(()=>({disabled:x.value})));return(o,t)=>(e.openBlock(),e.createElementBlock("details",{id:e.unref(s),class:e.normalizeClass(e.unref(E)),open:e.unref(V)},[e.createElementVNode("summary",{"aria-controls":e.unref(s),"aria-expanded":e.unref(V),class:"vv-accordion__summary",onClick:t[0]||(t[0]=e.withModifiers(e=>h(),["prevent"]))},[e.renderSlot(o.$slots,"summary",e.normalizeProps(e.guardReactiveProps({isExpanded:e.unref(V),expand:w,collapse:k,groupExpand:$,groupCollapse:B})),()=>[e.createTextVNode(e.toDisplayString(e.unref(d)),1)])],8,g),e.createElementVNode("div",{"aria-hidden":!e.unref(V),class:"vv-accordion__content"},[e.renderSlot(o.$slots,"default",e.normalizeProps(e.guardReactiveProps({isExpanded:e.unref(V),expand:w,collapse:k,groupExpand:$,groupCollapse:B})),()=>[e.createTextVNode(e.toDisplayString(e.unref(c)),1)])],8,y)],10,v))}});return e.defineComponent({name:"VvAccordionGroup",props:c,emits:["update:modelValue"],setup(n,{expose:r,emit:l}){const i=n,s=l,{disabled:d,modifiers:c,itemModifiers:m,items:p,storageKey:v,storageType:g}=e.toRefs(i);e.watchEffect(()=>{"string"==typeof i.modelValue&&i.collapse&&console.warn("[VvAccordionGroup]: modelValue is a string but collapse is true.")});const y=e.reactive(new Set),S=function(o,n=a.local,r){const l=e.ref();let i;return r&&(l.value=r),e.onMounted(()=>{o&&e.watch(o,(o,r)=>{const u=e.unref(n)===a.session?sessionStorage:localStorage;if(r&&r!==o&&u.removeItem(r),o)return i=t.useStorage(o,i?.value??l.value,u),void(i.value&&(l.value=i.value));i=void 0},{immediate:!0}),e.isRef(n)&&e.watch(n,(e,n)=>{if(o?.value){if(e){const n=e===a.session?sessionStorage:localStorage;i=t.useStorage(o.value,i?.value??l.value,n)}n&&n!==e&&(n===a.session?sessionStorage:localStorage).removeItem(o.value)}})}),e.watch(l,e=>{i&&(i.value=e)},{deep:!0,immediate:!0}),l}(v,g,[]),x=e.computed({get:()=>null!==i.modelValue&&void 0!==i.modelValue?i.modelValue:S.value,set:e=>{s("update:modelValue",e),S.value=e}}),A=e.computed({get:()=>{if(void 0===x.value)return new Set;let e=new Set;return i.not?"string"==typeof x.value?e=new Set([...y].filter(e=>e!==x.value)):Array.isArray(x.value)&&(e=new Set([...y].filter(e=>!x.value.includes(e)))):"string"==typeof x.value?e=new Set([x.value]):Array.isArray(x.value)&&(e=new Set(x.value)),e},set:e=>{i.not?x.value=[...y].filter(o=>!e.has(o)):i.collapse?x.value=[...e]:x.value=e.values().next().value}});e.onMounted(()=>{i.not&&void 0===x.value&&(x.value=i.collapse?[]:[...y.values()].splice(1,y.size)),e.nextTick(()=>{for(const e of y)V.emit("toggle",{name:e,value:A.value.has(e)})})});const V=o();var h,w;function k(e){if("string"!=typeof e)if(Array.isArray(e))for(const o of e)V.emit("toggle",{name:o,value:!0});else for(const o of y)V.emit("toggle",{name:o,value:!0});else V.emit("toggle",{name:e,value:!0})}function $(e){if("string"!=typeof e)if(Array.isArray(e))for(const o of e)V.emit("toggle",{name:o,value:!1});else for(const o of y)V.emit("toggle",{name:o,value:!1});else V.emit("toggle",{name:e,value:!1})}h=u,w={disabled:d,modifiers:m,bus:V},e.provide(h,w),V.on("register",({name:e})=>{y.add(e)}),V.on("unregister",({name:e})=>{y.delete(e)}),V.on("toggle",({name:e,value:o})=>{const t=new Set(A.value);if(o){if(!i.collapse){for(const o of t)o!==e&&V.emit("toggle",{name:o,value:!1});t.clear()}return t.add(e),void(A.value=t)}t.delete(e),A.value=t}),V.on("expand",({name:e})=>k(e)),V.on("collapse",({name:e})=>$(e)),r({expandedAccordions:A,expand:k,collapse:$});const B=f("vv-accordion-group",c,e.computed(()=>({disabled:d.value})));return(o,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(B))},[e.renderSlot(o.$slots,"default",e.normalizeProps(e.guardReactiveProps({expandedAccordions:e.unref(A),expand:k,collapse:$})),()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(p),t=>(e.openBlock(),e.createBlock(b,e.mergeProps({key:t.title},{ref_for:!0},{name:t.name,title:t.title,content:t.content}),e.createSlots({_:2},[o.$slots[`summary::${t.name}`]?{name:"summary",fn:e.withCtx(a=>[e.renderSlot(o.$slots,`summary::${t.name}`,e.mergeProps({ref_for:!0},a))]),key:"0"}:void 0,o.$slots[`content::${t.name}`]?{name:"default",fn:e.withCtx(a=>[e.renderSlot(o.$slots,`content::${t.name}`,e.mergeProps({ref_for:!0},a))]),key:"1"}:void 0]),1040))),128))])],2))}})});
|
|
@@ -196,7 +196,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
196
196
|
}
|
|
197
197
|
);
|
|
198
198
|
const pressed = computed(() => {
|
|
199
|
-
return props.pressed ||
|
|
199
|
+
return props.pressed || dropdownExpanded?.value;
|
|
200
200
|
});
|
|
201
201
|
const { role } = useInjectedDropdownAction();
|
|
202
202
|
const hasTag = computed(() => {
|
|
@@ -204,7 +204,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
204
204
|
case props.disabled:
|
|
205
205
|
return ActionTag.button;
|
|
206
206
|
case props.to !== void 0:
|
|
207
|
-
return
|
|
207
|
+
return volver?.nuxt ? resolveComponent(ActionTag.nuxtLink) : ActionTag.routerLink;
|
|
208
208
|
case props.href !== void 0:
|
|
209
209
|
return ActionTag.a;
|
|
210
210
|
default:
|
|
@@ -213,10 +213,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
213
213
|
});
|
|
214
214
|
const hasProps = computed(() => {
|
|
215
215
|
const toReturn = {
|
|
216
|
-
...dropdownAria
|
|
216
|
+
...dropdownAria?.value,
|
|
217
217
|
ariaPressed: pressed.value ? true : void 0,
|
|
218
218
|
ariaLabel: props.ariaLabel,
|
|
219
|
-
role: role
|
|
219
|
+
role: role?.value
|
|
220
220
|
};
|
|
221
221
|
switch (hasTag.value) {
|
|
222
222
|
case ActionTag.a:
|
|
@@ -244,32 +244,29 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
244
244
|
}
|
|
245
245
|
});
|
|
246
246
|
function onClick(e) {
|
|
247
|
-
var _a;
|
|
248
247
|
if (props.disabled) {
|
|
249
248
|
e.preventDefault();
|
|
250
249
|
return;
|
|
251
250
|
}
|
|
252
|
-
if (
|
|
251
|
+
if (instance?.vnode.props?.onClick) {
|
|
253
252
|
emit("click", e);
|
|
254
253
|
return;
|
|
255
254
|
}
|
|
256
|
-
dropdownEventBus
|
|
255
|
+
dropdownEventBus?.emit("click", e);
|
|
257
256
|
}
|
|
258
257
|
function onMouseover(e) {
|
|
259
|
-
|
|
260
|
-
if ((_a = instance == null ? void 0 : instance.vnode.props) == null ? void 0 : _a.onMouseover) {
|
|
258
|
+
if (instance?.vnode.props?.onMouseover) {
|
|
261
259
|
emit("mouseover", e);
|
|
262
260
|
return;
|
|
263
261
|
}
|
|
264
|
-
dropdownEventBus
|
|
262
|
+
dropdownEventBus?.emit("mouseover", e);
|
|
265
263
|
}
|
|
266
264
|
function onMouseleave(e) {
|
|
267
|
-
|
|
268
|
-
if ((_a = instance == null ? void 0 : instance.vnode.props) == null ? void 0 : _a.onMouseleave) {
|
|
265
|
+
if (instance?.vnode.props?.onMouseleave) {
|
|
269
266
|
emit("mouseleave", e);
|
|
270
267
|
return;
|
|
271
268
|
}
|
|
272
|
-
dropdownEventBus
|
|
269
|
+
dropdownEventBus?.emit("mouseleave", e);
|
|
273
270
|
}
|
|
274
271
|
return (_ctx, _cache) => {
|
|
275
272
|
return openBlock(), createBlock(resolveDynamicComponent(unref(hasTag)), mergeProps(unref(hasProps), {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue")):"function"==typeof define&&define.amd?define(["vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvAction=t(e.
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue")):"function"==typeof define&&define.amd?define(["vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvAction=t(e.Vue)}(this,function(e){"use strict";var t=(e=>(e.local="local",e.session="session",e))(t||{}),o=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(o||{}),r=(e=>(e.before="before",e.after="after",e))(r||{}),n=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(n||{}),a=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(a||{});const l=Symbol.for("volver"),u=Symbol.for("dropdownTrigger"),i=Symbol.for("dropdownAction"),s={to:{type:[String,Object]},href:String,target:String,rel:{type:String,default:"noopener noreferrer"}},d={disabled:{type:Boolean,default:!1}},c={active:{type:Boolean,default:!1}},f={current:{type:Boolean,default:!1}},p={pressed:{type:Boolean,default:!1}},v={label:{type:[String,Number],default:void 0}};r.before,o.bottom;const b={...d,...v,...p,...c,...f,...s,type:{type:String,default:n.button,validator:e=>Object.values(n).includes(e)},ariaLabel:{type:String,default:void 0},defaultTag:{type:String,default:a.button}};t.local;const m=b;return e.defineComponent({name:"VvAction",props:m,emits:["click","mouseover","mouseleave"],setup(t,{expose:o,emit:r}){const n=t,s=r,d=e.getCurrentInstance(),c=e.inject(l,void 0),f=e.ref(null);o({$el:f});const{reference:p,bus:v,aria:b,expanded:m}=e.inject(u,{});e.watch(()=>f.value,e=>{p&&(p.value=e)});const g=e.computed(()=>n.pressed||m?.value),{role:y}=e.inject(i,{}),k=e.computed(()=>{switch(!0){case n.disabled:return a.button;case void 0!==n.to:return c?.nuxt?e.resolveComponent(a.nuxtLink):a.routerLink;case void 0!==n.href:return a.a;default:return n.defaultTag}}),h=e.computed(()=>{const e={...b?.value,ariaPressed:!!g.value||void 0,ariaLabel:n.ariaLabel,role:y?.value};switch(k.value){case a.a:return{...e,href:n.href,target:n.target,rel:n.rel};case a.routerLink:case a.nuxtLink:return{...e,to:n.to,target:n.target};case a.button:return{...e,type:n.type,disabled:n.disabled};default:return e}});function S(e){n.disabled?e.preventDefault():d?.vnode.props?.onClick?s("click",e):v?.emit("click",e)}function x(e){d?.vnode.props?.onMouseover?s("mouseover",e):v?.emit("mouseover",e)}function L(e){d?.vnode.props?.onMouseleave?s("mouseleave",e):v?.emit("mouseleave",e)}return(t,o)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(k)),e.mergeProps(e.unref(h),{ref_key:"element",ref:f,class:{active:t.active,pressed:e.unref(g),disabled:t.disabled,current:t.current},onClickPassive:S,onMouseoverPassive:x,onMouseleavePassive:L}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])]),_:3},16,["class"]))}})});
|
|
@@ -99,32 +99,32 @@ function useInjectedAlertGroup() {
|
|
|
99
99
|
return inject(INJECTION_KEY_ALERT_GROUP, {});
|
|
100
100
|
}
|
|
101
101
|
function useUniqueId(id) {
|
|
102
|
-
return computed(() => String(
|
|
102
|
+
return computed(() => String(id?.value || useId()));
|
|
103
103
|
}
|
|
104
104
|
function useComponentIcon(icon, iconPosition) {
|
|
105
105
|
const hasIcon = computed(() => {
|
|
106
|
-
if (typeof
|
|
107
|
-
return { name: icon
|
|
106
|
+
if (typeof icon?.value === "string") {
|
|
107
|
+
return { name: icon?.value };
|
|
108
108
|
}
|
|
109
|
-
return icon
|
|
109
|
+
return icon?.value;
|
|
110
110
|
});
|
|
111
111
|
const hasIconBefore = computed(
|
|
112
|
-
() =>
|
|
112
|
+
() => iconPosition?.value === Position.before ? hasIcon.value : void 0
|
|
113
113
|
);
|
|
114
114
|
const hasIconAfter = computed(
|
|
115
|
-
() =>
|
|
115
|
+
() => iconPosition?.value === Position.after ? hasIcon.value : void 0
|
|
116
116
|
);
|
|
117
117
|
const hasIconLeft = computed(
|
|
118
|
-
() =>
|
|
118
|
+
() => iconPosition?.value === Side.left ? hasIcon.value : void 0
|
|
119
119
|
);
|
|
120
120
|
const hasIconRight = computed(
|
|
121
|
-
() =>
|
|
121
|
+
() => iconPosition?.value === Side.right ? hasIcon.value : void 0
|
|
122
122
|
);
|
|
123
123
|
const hasIconTop = computed(
|
|
124
|
-
() =>
|
|
124
|
+
() => iconPosition?.value === Side.top ? hasIcon.value : void 0
|
|
125
125
|
);
|
|
126
126
|
const hasIconBottom = computed(
|
|
127
|
-
() =>
|
|
127
|
+
() => iconPosition?.value === Side.bottom ? hasIcon.value : void 0
|
|
128
128
|
);
|
|
129
129
|
return {
|
|
130
130
|
hasIcon,
|
|
@@ -141,7 +141,7 @@ function useModifiers(prefix, modifiers, others) {
|
|
|
141
141
|
const toReturn = {
|
|
142
142
|
[prefix]: true
|
|
143
143
|
};
|
|
144
|
-
const modifiersArray = typeof
|
|
144
|
+
const modifiersArray = typeof modifiers?.value === "string" ? modifiers.value.split(" ") : modifiers?.value;
|
|
145
145
|
if (modifiersArray) {
|
|
146
146
|
if (Array.isArray(modifiersArray)) {
|
|
147
147
|
modifiersArray.forEach((modifier) => {
|
|
@@ -247,7 +247,7 @@ function useVvAlert(props, emit) {
|
|
|
247
247
|
clearTimeout(timeout);
|
|
248
248
|
}
|
|
249
249
|
emit("close", hasId.value);
|
|
250
|
-
bus
|
|
250
|
+
bus?.emit("close", hasId.value);
|
|
251
251
|
};
|
|
252
252
|
watch(
|
|
253
253
|
() => props.autoClose,
|
|
@@ -343,7 +343,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
343
343
|
const { modifiers } = toRefs(props);
|
|
344
344
|
const bemCssClasses = useModifiers("vv-icon", modifiers);
|
|
345
345
|
const provider = computed(() => {
|
|
346
|
-
return props.provider ||
|
|
346
|
+
return props.provider || volver?.iconsProvider;
|
|
347
347
|
});
|
|
348
348
|
const icon = computed(() => {
|
|
349
349
|
const name = props.name ?? "";
|
|
@@ -351,7 +351,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
351
351
|
if (iconLoaded(iconName)) {
|
|
352
352
|
return iconName;
|
|
353
353
|
}
|
|
354
|
-
const iconsCollection = volver
|
|
354
|
+
const iconsCollection = volver?.iconsCollections.find(
|
|
355
355
|
(iconsCollection2) => {
|
|
356
356
|
const icon2 = `@${provider.value}:${iconsCollection2.prefix}:${name}`;
|
|
357
357
|
return iconLoaded(icon2);
|
|
@@ -375,7 +375,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
375
375
|
}
|
|
376
376
|
function addIconFromSvg(svg) {
|
|
377
377
|
const svgContentEl = getSvgContent(svg);
|
|
378
|
-
const svgContent =
|
|
378
|
+
const svgContent = svgContentEl?.innerHTML.trim() || "";
|
|
379
379
|
if (svgContentEl && svgContent) {
|
|
380
380
|
addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
|
|
381
381
|
body: svgContent,
|
|
@@ -394,7 +394,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
394
394
|
show.value = true;
|
|
395
395
|
}
|
|
396
396
|
}).catch((e) => {
|
|
397
|
-
throw new Error(`Error during fetch icon: ${e
|
|
397
|
+
throw new Error(`Error during fetch icon: ${e?.message}`);
|
|
398
398
|
});
|
|
399
399
|
}
|
|
400
400
|
}
|
|
@@ -486,15 +486,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
486
486
|
(...args) => unref(close) && unref(close)(...args),
|
|
487
487
|
["stop"]
|
|
488
488
|
))
|
|
489
|
-
}, _cache[1] || (_cache[1] = [
|
|
489
|
+
}, [..._cache[1] || (_cache[1] = [
|
|
490
490
|
createElementVNode(
|
|
491
491
|
"div",
|
|
492
492
|
{ class: "vv-alert__close-mask" },
|
|
493
493
|
null,
|
|
494
494
|
-1
|
|
495
|
-
/*
|
|
495
|
+
/* CACHED */
|
|
496
496
|
)
|
|
497
|
-
]), 8, _hoisted_3)) : createCommentVNode("v-if", true)
|
|
497
|
+
])], 8, _hoisted_3)) : createCommentVNode("v-if", true)
|
|
498
498
|
])
|
|
499
499
|
])) : createCommentVNode("v-if", true),
|
|
500
500
|
_ctx.$slots.default || _ctx.content ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@iconify/vue")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvAlert=t(e.Vue,e.Iconify)}(this,function(e,t){"use strict";var o=(e=>(e.local="local",e.session="session",e))(o||{}),l=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(l||{}),r=(e=>(e.before="before",e.after="after",e))(r||{}),n=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(n||{}),a=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(a||{}),i=(e=>(e.alert="alert",e.alertdialog="alertdialog",e))(i||{});const s=Symbol.for("volver"),c=Symbol.for("alertGroup"),u={prefix:"normal"},d={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:r.before,validation:e=>Object.values(r).includes(e)}},f={id:[String,Number]};function v(t,o,l){return e.computed(()=>{const r={[t]:!0},n="string"==typeof o?.value?o.value.split(" "):o?.value;return n&&Array.isArray(n)&&n.forEach(e=>{e&&(r[`${t}--${e}`]=!0)}),l&&Object.keys(l.value).forEach(o=>{r[`${t}--${o}`]=e.unref(l.value[o])}),r})}l.bottom,n.button,a.button,o.local;const p={...f,...d,modifiers:{type:[String,Array],default:void 0},dismissable:{type:Boolean,default:!1},autoClose:{type:Number,default:0},closeLabel:{type:String,default:"Close"},title:{type:String,default:void 0},content:{type:String,default:void 0},footer:{type:String,default:void 0},role:{type:String,default:i.alert}};function m(t,o){const{bus:n}=e.inject(c,{}),a=(i=e.computed(()=>t.id),e.computed(()=>String(i?.value||e.useId())));var i;const s=e.computed(()=>`${a.value}-title`);let u;const d=()=>{u&&clearTimeout(u),o("close",a.value),n?.emit("close",a.value)};e.watch(()=>t.autoClose,e=>{e>0?u=setTimeout(d,e):u&&clearTimeout(u)},{immediate:!0});const f=e.ref(!1),p=()=>{f.value=!0,u&&clearTimeout(u)},m=()=>{f.value=!1,t.autoClose>0&&(u=setTimeout(d,t.autoClose))},{hasIcon:h}=function(t,o){const n=e.computed(()=>"string"==typeof t?.value?{name:t?.value}:t?.value),a=e.computed(()=>o?.value===r.before?n.value:void 0),i=e.computed(()=>o?.value===r.after?n.value:void 0),s=e.computed(()=>o?.value===l.left?n.value:void 0),c=e.computed(()=>o?.value===l.right?n.value:void 0),u=e.computed(()=>o?.value===l.top?n.value:void 0),d=e.computed(()=>o?.value===l.bottom?n.value:void 0);return{hasIcon:n,hasIconLeft:s,hasIconRight:c,hasIconTop:u,hasIconBottom:d,hasIconBefore:a,hasIconAfter:i}}(e.computed(()=>t.icon)),b=v("vv-alert",e.computed(()=>t.modifiers),e.computed(()=>({dismissable:t.autoClose>0||t.dismissable,"auto-close":t.autoClose>0,hover:f.value}))),y=e.computed(()=>({"--alert-duration":`${t.autoClose}ms`}));return{close:d,hasIcon:h,hasTitleId:s,hasProps:e.computed(()=>({onMouseover:p,onMouseleave:m,class:b.value,style:y.value,role:t.role,"aria-labelledby":s.value}))}}const h=e.defineComponent({name:"VvIcon",props:e.mergeDefaults({name:{},color:{},width:{},height:{},provider:{},prefix:{},src:{},horizontalFlip:{type:Boolean},verticalFlip:{type:Boolean},flip:{},mode:{},inline:{type:Boolean},rotate:{},onLoad:{type:Function},svg:{},modifiers:{}},u),setup(o){const l=o,r=e.computed(()=>"string"==typeof l.rotate?Number.parseFloat(l.rotate):l.rotate),n=e.ref(!0),a=e.inject(s,void 0),{modifiers:i}=e.toRefs(l),c=v("vv-icon",i),u=e.computed(()=>l.provider||a?.iconsProvider),d=e.computed(()=>{const e=l.name??"",o=`@${u.value}:${l.prefix}:${e}`;if(t.iconLoaded(o))return o;const r=a?.iconsCollections.find(o=>{const l=`@${u.value}:${o.prefix}:${e}`;return t.iconLoaded(l)});return r?`@${u.value}:${r.prefix}:${e}`:e});function f(e){const o=function(e){let t;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");t=(new e).window}return(t?new t.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),r=o?.innerHTML.trim()||"";o&&r&&t.addIcon(`@${u.value}:${l.prefix}:${l.name}`,{body:r,height:o.viewBox.baseVal.height,width:o.viewBox.baseVal.width})}return a&&l.src&&!t.iconLoaded(`@${u.value}:${l.prefix}:${l.name}`)&&(n.value=!1,a.fetchIcon(l.src).then(e=>{e&&(f(e),n.value=!0)}).catch(e=>{throw new Error(`Error during fetch icon: ${e?.message}`)})),l.svg&&f(l.svg),(o,l)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(t.Icon),e.mergeProps({key:0,class:e.unref(c)},{inline:o.inline,width:o.width,height:o.height,horizontalFlip:o.horizontalFlip,verticalFlip:o.verticalFlip,flip:o.flip,rotate:e.unref(r),color:o.color,icon:e.unref(d)},{onLoad:o.onLoad}),null,16,["class","onLoad"])):e.createCommentVNode("v-if",!0)}}),b={key:0,class:"vv-alert__header"},y=["id"],g=["aria-label"],$={key:1,class:"vv-alert__content"},k={key:2,class:"vv-alert__footer"};return e.defineComponent({name:"VvAlert",props:p,emits:["close"],setup(t,{expose:o,emit:l}){const r=t,n=l,{hasProps:a,hasTitleId:i,hasIcon:s,close:c}=m(r,n);return o({close:c}),(t,o)=>(e.openBlock(),e.createElementBlock("div",e.normalizeProps(e.guardReactiveProps(e.unref(a))),[t.$slots.header||t.$slots.title||t.$slots.close||t.$slots["title::before"]||t.$slots["title::after"]||t.title||e.unref(s)||t.dismissable||t.autoClose?(e.openBlock(),e.createElementBlock("div",b,[e.unref(s)?(e.openBlock(),e.createBlock(h,e.mergeProps({key:0},e.unref(s),{class:"vv-alert__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.renderSlot(t.$slots,"header",{},()=>[e.renderSlot(t.$slots,"title::before"),t.$slots.title||t.title?(e.openBlock(),e.createElementBlock("strong",{key:0,id:e.unref(i),class:"vv-alert__title"},[e.renderSlot(t.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])],8,y)):e.createCommentVNode("v-if",!0),e.renderSlot(t.$slots,"title::after")]),e.renderSlot(t.$slots,"close",e.normalizeProps(e.guardReactiveProps({close:e.unref(c)})),()=>[t.dismissable||t.autoClose?(e.openBlock(),e.createElementBlock("button",{key:0,class:"vv-alert__close",type:"button","aria-label":t.closeLabel,onClick:o[0]||(o[0]=e.withModifiers((...t)=>e.unref(c)&&e.unref(c)(...t),["stop"]))},[...o[1]||(o[1]=[e.createElementVNode("div",{class:"vv-alert__close-mask"},null,-1)])],8,g)):e.createCommentVNode("v-if",!0)])])):e.createCommentVNode("v-if",!0),t.$slots.default||t.content?(e.openBlock(),e.createElementBlock("div",$,[e.renderSlot(t.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.content),1)])])):e.createCommentVNode("v-if",!0),t.$slots.footer||t.footer?(e.openBlock(),e.createElementBlock("div",k,[e.renderSlot(t.$slots,"footer",{},()=>[e.createTextVNode(e.toDisplayString(t.footer),1)])])):e.createCommentVNode("v-if",!0)],16))}})});
|