@volverjs/ui-vue 0.0.10-beta.25 → 0.0.10-beta.26
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/auto-imports.d.ts +1 -0
- package/dist/components/VvAccordion/VvAccordion.es.js +14 -12
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +91 -38
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +13 -2
- package/dist/components/VvAccordionGroup/index.d.ts +6 -4
- package/dist/components/VvAction/VvAction.es.js +14 -12
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +2 -11
- package/dist/components/VvAction/index.d.ts +1 -5
- package/dist/components/VvAlert/VvAlert.es.js +14 -12
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +14 -12
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAvatar/VvAvatar.es.js +14 -12
- package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +14 -12
- package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.es.js +14 -12
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +14 -12
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +1 -1
- package/dist/components/VvButton/VvButton.es.js +14 -12
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +2 -19
- package/dist/components/VvButton/index.d.ts +1 -5
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +14 -12
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvCard/VvCard.es.js +14 -12
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +14 -12
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +14 -12
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.es.js +58 -34
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +2 -8
- package/dist/components/VvCombobox/index.d.ts +9 -2
- package/dist/components/VvDialog/VvDialog.es.js +14 -12
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +24 -16
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +2 -19
- package/dist/components/VvDropdown/VvDropdownItem.vue.d.ts +13 -1
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +9 -0
- package/dist/components/VvDropdown/index.d.ts +37 -0
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +64 -15
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +322 -1
- package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +14 -12
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +131 -76
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
- package/dist/components/VvInputFile/VvInputFile.es.js +14 -12
- package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
- package/dist/components/VvInputFile/index.d.ts +5 -5
- package/dist/components/VvInputText/VvInputText.es.js +979 -107
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +44 -1
- package/dist/components/VvInputText/index.d.ts +28 -0
- package/dist/components/VvNav/VvNav.es.js +14 -12
- package/dist/components/VvNav/VvNav.umd.js +1 -1
- package/dist/components/VvNav/VvNav.vue.d.ts +1 -1
- package/dist/components/VvNavItem/VvNavItem.es.js +14 -12
- package/dist/components/VvNavItem/VvNavItem.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.es.js +14 -12
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +14 -12
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +14 -12
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.es.js +14 -12
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvTab/VvTab.es.js +14 -12
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/VvTab/VvTab.vue.d.ts +1 -1
- package/dist/components/VvTextarea/VvTextarea.es.js +14 -12
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.es.js +14 -12
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/index.es.js +357 -144
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/dropdown/useInjectDropdown.d.ts +3 -23
- package/dist/composables/dropdown/useProvideDropdown.d.ts +2 -3
- package/dist/composables/usePersistence.d.ts +3 -0
- package/dist/constants.d.ts +24 -21
- package/dist/directives/index.es.js +14 -12
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-tooltip.es.js +14 -12
- 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/props/index.d.ts +11 -11
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +27 -4
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +176 -29
- package/dist/stories/Button/Button.settings.d.ts +0 -1
- package/dist/types/nav.d.ts +1 -2
- package/package.json +1 -1
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvAccordionGroup/VvAccordionGroup.vue +13 -19
- package/src/components/VvAccordionGroup/index.ts +2 -5
- package/src/components/VvCombobox/VvCombobox.vue +2 -0
- package/src/components/VvDropdown/VvDropdown.vue +11 -2
- package/src/components/VvDropdown/VvDropdownItem.vue +4 -1
- package/src/components/VvDropdown/VvDropdownOption.vue +3 -21
- package/src/components/VvDropdown/index.ts +35 -1
- package/src/components/VvInputText/VvInputText.vue +98 -3
- package/src/components/VvInputText/index.ts +24 -1
- package/src/composables/dropdown/useProvideDropdown.ts +4 -4
- package/src/composables/usePersistence.ts +76 -0
- package/src/constants.ts +23 -18
- package/src/props/index.ts +12 -7
- package/src/stories/Button/Button.settings.ts +1 -4
- package/src/types/nav.ts +1 -3
package/auto-imports.d.ts
CHANGED
|
@@ -227,6 +227,7 @@ declare global {
|
|
|
227
227
|
const useParentElement: typeof import('@vueuse/core')['useParentElement']
|
|
228
228
|
const usePerformanceObserver: typeof import('@vueuse/core')['usePerformanceObserver']
|
|
229
229
|
const usePermission: typeof import('@vueuse/core')['usePermission']
|
|
230
|
+
const usePersistence: typeof import('./src/composables/usePersistence')['usePersistence']
|
|
230
231
|
const usePointer: typeof import('@vueuse/core')['usePointer']
|
|
231
232
|
const usePointerLock: typeof import('@vueuse/core')['usePointerLock']
|
|
232
233
|
const usePointerSwipe: typeof import('@vueuse/core')['usePointerSwipe']
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { inject, computed, toRef, unref, defineComponent, useAttrs, toRefs, ref, watch, onBeforeUnmount, openBlock, createElementBlock, normalizeClass, createElementVNode, withModifiers, renderSlot, normalizeProps, guardReactiveProps, createTextVNode, toDisplayString } from "vue";
|
|
2
2
|
import { uid } from "uid";
|
|
3
3
|
import { useVModel } from "@vueuse/core";
|
|
4
|
+
var StorageType = /* @__PURE__ */ ((StorageType2) => {
|
|
5
|
+
StorageType2["local"] = "local";
|
|
6
|
+
StorageType2["session"] = "session";
|
|
7
|
+
return StorageType2;
|
|
8
|
+
})(StorageType || {});
|
|
4
9
|
var Strategy = /* @__PURE__ */ ((Strategy2) => {
|
|
5
10
|
Strategy2["absolute"] = "absolute";
|
|
6
11
|
Strategy2["fixed"] = "fixed";
|
|
@@ -42,13 +47,6 @@ var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
|
|
|
42
47
|
ActionTag2["button"] = "button";
|
|
43
48
|
return ActionTag2;
|
|
44
49
|
})(ActionTag || {});
|
|
45
|
-
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
46
|
-
AnchorTarget2["_blank"] = "_blank";
|
|
47
|
-
AnchorTarget2["_self"] = "_self";
|
|
48
|
-
AnchorTarget2["_parent"] = "_parent";
|
|
49
|
-
AnchorTarget2["_top"] = "_top";
|
|
50
|
-
return AnchorTarget2;
|
|
51
|
-
})(AnchorTarget || {});
|
|
52
50
|
const INJECTION_KEY_ACCORDION_GROUP = Symbol.for(
|
|
53
51
|
"accordionGroup"
|
|
54
52
|
);
|
|
@@ -67,11 +65,7 @@ const LinkProps = {
|
|
|
67
65
|
/**
|
|
68
66
|
* Anchor target
|
|
69
67
|
*/
|
|
70
|
-
target:
|
|
71
|
-
type: String,
|
|
72
|
-
default: void 0,
|
|
73
|
-
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
74
|
-
},
|
|
68
|
+
target: String,
|
|
75
69
|
/**
|
|
76
70
|
* Anchor rel
|
|
77
71
|
*/
|
|
@@ -276,6 +270,14 @@ const ModifiersProps = {
|
|
|
276
270
|
default: ActionTag.button
|
|
277
271
|
}
|
|
278
272
|
});
|
|
273
|
+
({
|
|
274
|
+
storageType: {
|
|
275
|
+
type: String,
|
|
276
|
+
default: StorageType.local,
|
|
277
|
+
validator: (value) => Object.values(StorageType).includes(value)
|
|
278
|
+
},
|
|
279
|
+
storageKey: String
|
|
280
|
+
});
|
|
279
281
|
function useInjectedGroupState(groupKey) {
|
|
280
282
|
const group = inject(groupKey, void 0);
|
|
281
283
|
const isInGroup = computed(() => group !== void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("uid"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","uid","@vueuse/core"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvAccordion=o(e.vue,e.uid,e.core)}(this,(function(e,o,n){"use strict";var t=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("uid"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","uid","@vueuse/core"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvAccordion=o(e.vue,e.uid,e.core)}(this,(function(e,o,n){"use strict";var t=(e=>(e.local="local",e.session="session",e))(t||{}),a=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(a||{}),r=(e=>(e.before="before",e.after="after",e))(r||{}),u=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(u||{}),l=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(l||{});const i=Symbol.for("accordionGroup"),d=(Boolean,Boolean,Boolean,Boolean,{modifiers:{type:[String,Array],default:void 0}});r.before,a.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,u.button,l.button,t.local;const s={...d,name:String,title:String,content:String,modelValue:{type:Boolean,default:void 0},disabled:Boolean,not:Boolean};function c(o){const{group:n,isInGroup:t}=function(o){const n=e.inject(o,void 0),t=e.computed((()=>void 0!==n));return{group:n,isInGroup:t,getGroupOrLocalRef:function(o,t,a){const r=null==n?void 0:n[o];if(r)return e.computed({get:()=>r.value,set(e){r.value=e}});const u=e.toRef(t,o);return e.computed({get:()=>u.value,set(e){a&&a(`update:${o}`,e)}})}}}(i),a=e.computed((()=>Boolean(o.disabled||(null==n?void 0:n.disabled.value)))),r=e.computed((()=>{let e=o.modifiers,t=null==n?void 0:n.modifiers.value;const a=new Set;return e&&(Array.isArray(e)||(e=e.split(" ")),e.forEach((e=>a.add(e)))),t&&(Array.isArray(t)||(t=t.split(" ")),t.forEach((e=>a.add(e)))),Array.from(a)}));return{isInGroup:t,group:n,modifiers:r,disabled:a,bus:null==n?void 0:n.bus}}const p=["id","open"],m=["aria-controls","aria-expanded"],f=["aria-hidden"];return e.defineComponent({name:"VvAccordion",props:s,emits:["update:modelValue"],setup(t,{expose:a,emit:r}){const u=t,l=e.useAttrs(),i=r,d=n.useVModel(u,"modelValue",i),s=e.computed((()=>u.name||(null==l?void 0:l.id)||o.uid())),{title:v,content:g,not:b}=e.toRefs(u),{isInGroup:y,modifiers:x,disabled:B,bus:h}=c(u),A=e.ref(!1);e.watch(d,(e=>{"boolean"==typeof e&&(A.value=b.value?!e:e)}),{immediate:!0}),e.watch(A,(e=>{d.value=b.value?!e:e})),null==h||h.on("toggle",(({name:e,value:o})=>{e===s.value&&(A.value=o)}));const E=()=>{B.value||(y.value?null==h||h.emit("toggle",{name:s.value,value:!A.value}):A.value=!A.value)};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})}));const V=()=>{A.value||E()},S=()=>{A.value&&E()},$=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`)},k=e=>{h?null==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`)};a({isExpanded:A,expand:V,collapse:S,groupExpand:$,groupCollapse:k});const w=function(o,n,t){return e.computed((()=>{const a={[o]:!0},r="string"==typeof(null==n?void 0:n.value)?n.value.split(" "):null==n?void 0:n.value;return r&&Array.isArray(r)&&r.forEach((e=>{e&&(a[`${o}--${e}`]=!0)})),t&&Object.keys(t.value).forEach((n=>{a[`${o}--${n}`]=e.unref(t.value[n])})),a}))}("vv-accordion",x,e.computed((()=>({disabled:B.value}))));return(o,n)=>(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:n[0]||(n[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(v)),1)]))],8,m),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(g)),1)]))],8,f)],10,p))}})}));
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { inject, computed, toRef, unref, defineComponent, useAttrs, toRefs, ref, watch, onBeforeUnmount, openBlock, createElementBlock, normalizeClass, createElementVNode, withModifiers, renderSlot, normalizeProps, guardReactiveProps, createTextVNode, toDisplayString, provide, watchEffect, reactive, onMounted, nextTick, Fragment, renderList, createBlock, mergeProps, createSlots, withCtx } from "vue";
|
|
1
|
+
import { inject, computed, toRef, unref, defineComponent, useAttrs, toRefs, ref, watch, onBeforeUnmount, openBlock, createElementBlock, normalizeClass, createElementVNode, withModifiers, renderSlot, normalizeProps, guardReactiveProps, createTextVNode, toDisplayString, isRef, provide, watchEffect, reactive, onMounted, nextTick, Fragment, renderList, createBlock, mergeProps, createSlots, withCtx } from "vue";
|
|
2
2
|
import mitt from "mitt";
|
|
3
3
|
import { uid } from "uid";
|
|
4
|
-
import { useVModel,
|
|
4
|
+
import { useVModel, useStorage } from "@vueuse/core";
|
|
5
|
+
var StorageType = /* @__PURE__ */ ((StorageType2) => {
|
|
6
|
+
StorageType2["local"] = "local";
|
|
7
|
+
StorageType2["session"] = "session";
|
|
8
|
+
return StorageType2;
|
|
9
|
+
})(StorageType || {});
|
|
5
10
|
var Strategy = /* @__PURE__ */ ((Strategy2) => {
|
|
6
11
|
Strategy2["absolute"] = "absolute";
|
|
7
12
|
Strategy2["fixed"] = "fixed";
|
|
@@ -43,13 +48,6 @@ var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
|
|
|
43
48
|
ActionTag2["button"] = "button";
|
|
44
49
|
return ActionTag2;
|
|
45
50
|
})(ActionTag || {});
|
|
46
|
-
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
47
|
-
AnchorTarget2["_blank"] = "_blank";
|
|
48
|
-
AnchorTarget2["_self"] = "_self";
|
|
49
|
-
AnchorTarget2["_parent"] = "_parent";
|
|
50
|
-
AnchorTarget2["_top"] = "_top";
|
|
51
|
-
return AnchorTarget2;
|
|
52
|
-
})(AnchorTarget || {});
|
|
53
51
|
const INJECTION_KEY_ACCORDION_GROUP = Symbol.for(
|
|
54
52
|
"accordionGroup"
|
|
55
53
|
);
|
|
@@ -68,11 +66,7 @@ const LinkProps = {
|
|
|
68
66
|
/**
|
|
69
67
|
* Anchor target
|
|
70
68
|
*/
|
|
71
|
-
target:
|
|
72
|
-
type: String,
|
|
73
|
-
default: void 0,
|
|
74
|
-
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
75
|
-
},
|
|
69
|
+
target: String,
|
|
76
70
|
/**
|
|
77
71
|
* Anchor rel
|
|
78
72
|
*/
|
|
@@ -277,6 +271,14 @@ const ModifiersProps = {
|
|
|
277
271
|
default: ActionTag.button
|
|
278
272
|
}
|
|
279
273
|
});
|
|
274
|
+
const StorageProps = {
|
|
275
|
+
storageType: {
|
|
276
|
+
type: String,
|
|
277
|
+
default: StorageType.local,
|
|
278
|
+
validator: (value) => Object.values(StorageType).includes(value)
|
|
279
|
+
},
|
|
280
|
+
storageKey: String
|
|
281
|
+
};
|
|
280
282
|
function useInjectedGroupState(groupKey) {
|
|
281
283
|
const group = inject(groupKey, void 0);
|
|
282
284
|
const isInGroup = computed(() => group !== void 0);
|
|
@@ -563,6 +565,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
563
565
|
});
|
|
564
566
|
const VvAccordionGroupProps = {
|
|
565
567
|
...ModifiersProps,
|
|
568
|
+
...StorageProps,
|
|
566
569
|
/**
|
|
567
570
|
* VModel
|
|
568
571
|
*/
|
|
@@ -596,13 +599,69 @@ const VvAccordionGroupProps = {
|
|
|
596
599
|
/**
|
|
597
600
|
* If true, the accordion items will be opened by default
|
|
598
601
|
*/
|
|
599
|
-
not: Boolean
|
|
600
|
-
/**
|
|
601
|
-
* Enable local storage persistence
|
|
602
|
-
*/
|
|
603
|
-
storeKey: String
|
|
602
|
+
not: Boolean
|
|
604
603
|
};
|
|
605
604
|
const VvAccordionGroupEvents = ["update:modelValue"];
|
|
605
|
+
const usePersistence = (storageKey, storageType = StorageType.local, defaultValue) => {
|
|
606
|
+
const localValue = ref();
|
|
607
|
+
if (defaultValue) {
|
|
608
|
+
localValue.value = defaultValue;
|
|
609
|
+
}
|
|
610
|
+
let storageValue;
|
|
611
|
+
if (storageKey) {
|
|
612
|
+
watch(
|
|
613
|
+
storageKey,
|
|
614
|
+
(newKey, oldKey) => {
|
|
615
|
+
const storage = unref(storageType) === StorageType.session ? sessionStorage : localStorage;
|
|
616
|
+
if (oldKey && oldKey !== newKey) {
|
|
617
|
+
storage.removeItem(oldKey);
|
|
618
|
+
}
|
|
619
|
+
if (newKey) {
|
|
620
|
+
storageValue = useStorage(
|
|
621
|
+
newKey,
|
|
622
|
+
(storageValue == null ? void 0 : storageValue.value) ?? localValue.value,
|
|
623
|
+
storage
|
|
624
|
+
);
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
storageValue = void 0;
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
immediate: true
|
|
631
|
+
}
|
|
632
|
+
);
|
|
633
|
+
}
|
|
634
|
+
if (isRef(storageType)) {
|
|
635
|
+
watch(storageType, (newType, oldType) => {
|
|
636
|
+
if (storageKey == null ? void 0 : storageKey.value) {
|
|
637
|
+
if (newType) {
|
|
638
|
+
const storage = newType === StorageType.session ? sessionStorage : localStorage;
|
|
639
|
+
storageValue = useStorage(
|
|
640
|
+
storageKey.value,
|
|
641
|
+
(storageValue == null ? void 0 : storageValue.value) ?? localValue.value,
|
|
642
|
+
storage
|
|
643
|
+
);
|
|
644
|
+
}
|
|
645
|
+
if (oldType && oldType !== newType) {
|
|
646
|
+
const oldStorage = oldType === StorageType.session ? sessionStorage : localStorage;
|
|
647
|
+
oldStorage.removeItem(storageKey.value);
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
return computed({
|
|
653
|
+
get: () => {
|
|
654
|
+
return (storageValue == null ? void 0 : storageValue.value) ?? localValue.value;
|
|
655
|
+
},
|
|
656
|
+
set: (value) => {
|
|
657
|
+
if (storageValue) {
|
|
658
|
+
storageValue.value = value;
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
localValue.value = value;
|
|
662
|
+
}
|
|
663
|
+
});
|
|
664
|
+
};
|
|
606
665
|
function useProvideGroupState(key, groupState) {
|
|
607
666
|
provide(key, groupState);
|
|
608
667
|
}
|
|
@@ -616,7 +675,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
616
675
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
617
676
|
const props = __props;
|
|
618
677
|
const emit = __emit;
|
|
619
|
-
const {
|
|
678
|
+
const {
|
|
679
|
+
disabled,
|
|
680
|
+
modifiers,
|
|
681
|
+
itemModifiers,
|
|
682
|
+
items,
|
|
683
|
+
storageKey,
|
|
684
|
+
storageType
|
|
685
|
+
} = toRefs(props);
|
|
620
686
|
watchEffect(() => {
|
|
621
687
|
if (typeof props.modelValue === "string" && props.collapse) {
|
|
622
688
|
console.warn(
|
|
@@ -625,33 +691,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
625
691
|
}
|
|
626
692
|
});
|
|
627
693
|
const accordionNames = reactive(/* @__PURE__ */ new Set());
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
(newKey, oldKey) => {
|
|
632
|
-
if (oldKey && oldKey !== newKey) {
|
|
633
|
-
localStorage.removeItem(oldKey);
|
|
634
|
-
}
|
|
635
|
-
if (newKey) {
|
|
636
|
-
storeModelValue = useLocalStorage(newKey, storeModelValue.value);
|
|
637
|
-
return;
|
|
638
|
-
}
|
|
639
|
-
storeModelValue = ref(storeModelValue.value);
|
|
640
|
-
},
|
|
641
|
-
{
|
|
642
|
-
immediate: true
|
|
643
|
-
}
|
|
694
|
+
const storageModelValue = usePersistence(
|
|
695
|
+
storageKey,
|
|
696
|
+
storageType
|
|
644
697
|
);
|
|
645
698
|
const localModelValue = computed({
|
|
646
699
|
get: () => {
|
|
647
700
|
if (props.modelValue !== null && props.modelValue !== void 0) {
|
|
648
701
|
return props.modelValue;
|
|
649
702
|
}
|
|
650
|
-
return
|
|
703
|
+
return storageModelValue.value;
|
|
651
704
|
},
|
|
652
705
|
set: (newValue) => {
|
|
653
706
|
emit("update:modelValue", newValue);
|
|
654
|
-
|
|
707
|
+
storageModelValue.value = newValue;
|
|
655
708
|
}
|
|
656
709
|
});
|
|
657
710
|
const expandedAccordions = computed({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("mitt"),require("uid"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","mitt","uid","@vueuse/core"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvAccordionGroup=o(e.vue,e.mitt,e.uid,e.core)}(this,(function(e,o,t,a){"use strict";var n=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("mitt"),require("uid"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","mitt","uid","@vueuse/core"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvAccordionGroup=o(e.vue,e.mitt,e.uid,e.core)}(this,(function(e,o,t,a){"use strict";var n=(e=>(e.local="local",e.session="session",e))(n||{}),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||{}),u=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(u||{}),i=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(i||{});const s=Symbol.for("accordionGroup"),d=(Boolean,Boolean,Boolean,Boolean,{modifiers:{type:[String,Array],default:void 0}});r.before,l.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,u.button,i.button;const c={storageType:{type:String,default:n.local,validator:e=>Object.values(n).includes(e)},storageKey:String};const m={...d,name:String,title:String,content:String,modelValue:{type:Boolean,default:void 0},disabled:Boolean,not:Boolean};function v(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 l=null==t?void 0:t[o];if(l)return e.computed({get:()=>l.value,set(e){l.value=e}});const r=e.toRef(a,o);return e.computed({get:()=>r.value,set(e){n&&n(`update:${o}`,e)}})}}}(s),n=e.computed((()=>Boolean(o.disabled||(null==t?void 0:t.disabled.value)))),l=e.computed((()=>{let e=o.modifiers,a=null==t?void 0: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:l,disabled:n,bus:null==t?void 0:t.bus}}function p(o,t,a){return e.computed((()=>{const n={[o]:!0},l="string"==typeof(null==t?void 0:t.value)?t.value.split(" "):null==t?void 0:t.value;return l&&Array.isArray(l)&&l.forEach((e=>{e&&(n[`${o}--${e}`]=!0)})),a&&Object.keys(a.value).forEach((t=>{n[`${o}--${t}`]=e.unref(a.value[t])})),n}))}const f=["id","open"],g=["aria-controls","aria-expanded"],y=["aria-hidden"],b=e.defineComponent({name:"VvAccordion",props:m,emits:["update:modelValue"],setup(o,{expose:n,emit:l}){const r=o,u=e.useAttrs(),i=l,s=a.useVModel(r,"modelValue",i),d=e.computed((()=>r.name||(null==u?void 0:u.id)||t.uid())),{title:c,content:m,not:b}=e.toRefs(r),{isInGroup:S,modifiers:x,disabled:A,bus:B}=v(r),h=e.ref(!1);e.watch(s,(e=>{"boolean"==typeof e&&(h.value=b.value?!e:e)}),{immediate:!0}),e.watch(h,(e=>{s.value=b.value?!e:e})),null==B||B.on("toggle",(({name:e,value:o})=>{e===d.value&&(h.value=o)}));const V=()=>{A.value||(S.value?null==B||B.emit("toggle",{name:d.value,value:!h.value}):h.value=!h.value)};e.watch(d,((e,o)=>{B&&(o&&o!==e&&B.emit("unregister",{name:o}),B.emit("register",{name:e}))}),{immediate:!0}),e.onBeforeUnmount((()=>{B&&B.emit("unregister",{name:d.value})}));const w=()=>{h.value||V()},k=()=>{h.value&&V()},$=e=>{B?B.emit("expand",{name:e}):console.warn(`[VvAccordion]: You are trying to expand accordion group of "${d.value}" but it is not in a group`)},E=e=>{B?null==B||B.emit("collapse",{name:e}):console.warn(`[VvAccordion]: You are trying to collapse accordion group of "${d.value}" but it is not in a group`)};n({isExpanded:h,expand:w,collapse:k,groupExpand:$,groupCollapse:E});const P=p("vv-accordion",x,e.computed((()=>({disabled:A.value}))));return(o,t)=>(e.openBlock(),e.createElementBlock("details",{id:e.unref(d),class:e.normalizeClass(e.unref(P)),open:e.unref(h)},[e.createElementVNode("summary",{"aria-controls":e.unref(d),"aria-expanded":e.unref(h),class:"vv-accordion__summary",onClick:t[0]||(t[0]=e.withModifiers((e=>V()),["prevent"]))},[e.renderSlot(o.$slots,"summary",e.normalizeProps(e.guardReactiveProps({isExpanded:e.unref(h),expand:w,collapse:k,groupExpand:$,groupCollapse:E})),(()=>[e.createTextVNode(e.toDisplayString(e.unref(c)),1)]))],8,g),e.createElementVNode("div",{"aria-hidden":!e.unref(h),class:"vv-accordion__content"},[e.renderSlot(o.$slots,"default",e.normalizeProps(e.guardReactiveProps({isExpanded:e.unref(h),expand:w,collapse:k,groupExpand:$,groupCollapse:E})),(()=>[e.createTextVNode(e.toDisplayString(e.unref(m)),1)]))],8,y)],10,f))}}),S={...d,...c,modelValue:{type:[String,Array],default:void 0},items:{type:Array,default:()=>[]},collapse:Boolean,itemModifiers:{type:[String,Array],default:""},disabled:Boolean,not:Boolean};return e.defineComponent({name:"VvAccordionGroup",props:S,emits:["update:modelValue"],setup(t,{expose:l,emit:r}){const u=t,i=r,{disabled:d,modifiers:c,itemModifiers:m,items:v,storageKey:f,storageType:g}=e.toRefs(u);e.watchEffect((()=>{"string"==typeof u.modelValue&&u.collapse&&console.warn("[VvAccordionGroup]: modelValue is a string but collapse is true.")}));const y=e.reactive(new Set),S=((o,t=n.local,l)=>{const r=e.ref();let u;return l&&(r.value=l),o&&e.watch(o,((o,l)=>{const i=e.unref(t)===n.session?sessionStorage:localStorage;l&&l!==o&&i.removeItem(l),u=o?a.useStorage(o,(null==u?void 0:u.value)??r.value,i):void 0}),{immediate:!0}),e.isRef(t)&&e.watch(t,((e,t)=>{if(null==o?void 0:o.value){if(e){const t=e===n.session?sessionStorage:localStorage;u=a.useStorage(o.value,(null==u?void 0:u.value)??r.value,t)}t&&t!==e&&(t===n.session?sessionStorage:localStorage).removeItem(o.value)}})),e.computed({get:()=>(null==u?void 0:u.value)??r.value,set:e=>{u?u.value=e:r.value=e}})})(f,g),x=e.computed({get:()=>null!==u.modelValue&&void 0!==u.modelValue?u.modelValue:S.value,set:e=>{i("update:modelValue",e),S.value=e}}),A=e.computed({get:()=>{if(void 0===x.value)return new Set;let e=new Set;return u.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=>{u.not?x.value=[...y].filter((o=>!e.has(o))):u.collapse?x.value=[...e]:x.value=e.values().next().value}});e.onMounted((()=>{u.not&&void 0===x.value&&(x.value=u.collapse?[]:[...y.values()].splice(1,y.size)),e.nextTick((()=>{for(const e of y)B.emit("toggle",{name:e,value:A.value.has(e)})}))}));const B=o();var h,V;h=s,V={disabled:d,modifiers:m,bus:B},e.provide(h,V),B.on("register",(({name:e})=>{y.add(e)})),B.on("unregister",(({name:e})=>{y.delete(e)})),B.on("toggle",(({name:e,value:o})=>{const t=new Set(A.value);if(o){if(!u.collapse){for(const o of t)o!==e&&B.emit("toggle",{name:o,value:!1});t.clear()}return t.add(e),void(A.value=t)}t.delete(e),A.value=t}));const w=e=>{if("string"!=typeof e)if(Array.isArray(e))for(const o of e)B.emit("toggle",{name:o,value:!0});else for(const o of y)B.emit("toggle",{name:o,value:!0});else B.emit("toggle",{name:e,value:!0})};B.on("expand",(({name:e})=>w(e)));const k=e=>{if("string"!=typeof e)if(Array.isArray(e))for(const o of e)B.emit("toggle",{name:o,value:!1});else for(const o of y)B.emit("toggle",{name:o,value:!1});else B.emit("toggle",{name:e,value:!1})};B.on("collapse",(({name:e})=>k(e))),l({expandedAccordions:A,expand:w,collapse:k});const $=p("vv-accordion-group",c,e.computed((()=>({disabled:d.value}))));return(o,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref($))},[e.renderSlot(o.$slots,"default",e.normalizeProps(e.guardReactiveProps({expandedAccordions:e.unref(A),expand:w,collapse:k})),(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(v),(t=>(e.openBlock(),e.createBlock(b,e.mergeProps({key:t.title},{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.normalizeProps(e.guardReactiveProps(a)))])),key:"0"}:void 0,o.$slots[`content::${t.name}`]?{name:"default",fn:e.withCtx((a=>[e.renderSlot(o.$slots,`content::${t.name}`,e.normalizeProps(e.guardReactiveProps(a)))])),key:"1"}:void 0]),1040)))),128))]))],2))}})}));
|
|
@@ -14,7 +14,12 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
14
14
|
};
|
|
15
15
|
disabled: BooleanConstructor;
|
|
16
16
|
not: BooleanConstructor;
|
|
17
|
-
|
|
17
|
+
storageType: {
|
|
18
|
+
type: globalThis.PropType<"local" | "session">;
|
|
19
|
+
default: import("../../constants").StorageType;
|
|
20
|
+
validator: (value: import("../../constants").StorageType) => boolean;
|
|
21
|
+
};
|
|
22
|
+
storageKey: StringConstructor;
|
|
18
23
|
modifiers: {
|
|
19
24
|
type: globalThis.PropType<string | string[]>;
|
|
20
25
|
default: undefined;
|
|
@@ -41,7 +46,12 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
41
46
|
};
|
|
42
47
|
disabled: BooleanConstructor;
|
|
43
48
|
not: BooleanConstructor;
|
|
44
|
-
|
|
49
|
+
storageType: {
|
|
50
|
+
type: globalThis.PropType<"local" | "session">;
|
|
51
|
+
default: import("../../constants").StorageType;
|
|
52
|
+
validator: (value: import("../../constants").StorageType) => boolean;
|
|
53
|
+
};
|
|
54
|
+
storageKey: StringConstructor;
|
|
45
55
|
modifiers: {
|
|
46
56
|
type: globalThis.PropType<string | string[]>;
|
|
47
57
|
default: undefined;
|
|
@@ -54,6 +64,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
54
64
|
modifiers: string | string[];
|
|
55
65
|
items: import(".").VvAccordionGroupItem[];
|
|
56
66
|
itemModifiers: string | string[];
|
|
67
|
+
storageType: "local" | "session";
|
|
57
68
|
}, {}>, Partial<Record<`summary::${string}`, (_: {
|
|
58
69
|
isExpanded: boolean;
|
|
59
70
|
expand: () => void;
|
|
@@ -40,10 +40,12 @@ export declare const VvAccordionGroupProps: {
|
|
|
40
40
|
* If true, the accordion items will be opened by default
|
|
41
41
|
*/
|
|
42
42
|
not: BooleanConstructor;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
storageType: {
|
|
44
|
+
type: globalThis.PropType<"local" | "session">;
|
|
45
|
+
default: import("../../constants").StorageType;
|
|
46
|
+
validator: (value: import("../../constants").StorageType) => boolean;
|
|
47
|
+
};
|
|
48
|
+
storageKey: StringConstructor;
|
|
47
49
|
modifiers: {
|
|
48
50
|
type: globalThis.PropType<string | string[]>;
|
|
49
51
|
default: undefined;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { inject, defineComponent, ref, watch, computed, openBlock, createBlock, resolveDynamicComponent, unref, mergeProps, withCtx, renderSlot, createTextVNode, toDisplayString } from "vue";
|
|
2
|
+
var StorageType = /* @__PURE__ */ ((StorageType2) => {
|
|
3
|
+
StorageType2["local"] = "local";
|
|
4
|
+
StorageType2["session"] = "session";
|
|
5
|
+
return StorageType2;
|
|
6
|
+
})(StorageType || {});
|
|
2
7
|
var Strategy = /* @__PURE__ */ ((Strategy2) => {
|
|
3
8
|
Strategy2["absolute"] = "absolute";
|
|
4
9
|
Strategy2["fixed"] = "fixed";
|
|
@@ -40,13 +45,6 @@ var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
|
|
|
40
45
|
ActionTag2["button"] = "button";
|
|
41
46
|
return ActionTag2;
|
|
42
47
|
})(ActionTag || {});
|
|
43
|
-
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
44
|
-
AnchorTarget2["_blank"] = "_blank";
|
|
45
|
-
AnchorTarget2["_self"] = "_self";
|
|
46
|
-
AnchorTarget2["_parent"] = "_parent";
|
|
47
|
-
AnchorTarget2["_top"] = "_top";
|
|
48
|
-
return AnchorTarget2;
|
|
49
|
-
})(AnchorTarget || {});
|
|
50
48
|
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
51
49
|
const INJECTION_KEY_DROPDOWN_TRIGGER = Symbol.for(
|
|
52
50
|
"dropdownTrigger"
|
|
@@ -69,11 +67,7 @@ const LinkProps = {
|
|
|
69
67
|
/**
|
|
70
68
|
* Anchor target
|
|
71
69
|
*/
|
|
72
|
-
target:
|
|
73
|
-
type: String,
|
|
74
|
-
default: void 0,
|
|
75
|
-
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
76
|
-
},
|
|
70
|
+
target: String,
|
|
77
71
|
/**
|
|
78
72
|
* Anchor rel
|
|
79
73
|
*/
|
|
@@ -269,6 +263,14 @@ const ActionProps = {
|
|
|
269
263
|
default: ActionTag.button
|
|
270
264
|
}
|
|
271
265
|
};
|
|
266
|
+
({
|
|
267
|
+
storageType: {
|
|
268
|
+
type: String,
|
|
269
|
+
default: StorageType.local,
|
|
270
|
+
validator: (value) => Object.values(StorageType).includes(value)
|
|
271
|
+
},
|
|
272
|
+
storageKey: String
|
|
273
|
+
});
|
|
272
274
|
const VvActionEvents = ["click", "mouseover", "mouseleave"];
|
|
273
275
|
const VvActionProps = ActionProps;
|
|
274
276
|
function useVolver() {
|
|
@@ -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.vue)}(this,(function(e){"use strict";var t=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",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||{}),l=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(l||{});const a=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}},v={pressed:{type:Boolean,default:!1}},p={label:{type:[String,Number],default:void 0}};r.before,o.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const b={...d,...p,...v,...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:l.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.inject(a),c=e.ref(null);o({$el:c});const{reference:f,bus:v,aria:p,expanded:b}=e.inject(u,{});e.watch((()=>c.value),(e=>{f&&(f.value=e)}));const m=e.computed((()=>n.pressed||(null==b?void 0:b.value))),{role:g}=e.inject(i,{}),y=e.computed((()=>{switch(!0){case n.disabled:return l.button;case void 0!==n.to:return(null==d?void 0:d.nuxt)?l.nuxtLink:l.routerLink;case void 0!==n.href:return l.a;default:return n.defaultTag}})),k=e.computed((()=>{const e={...null==p?void 0:p.value,ariaPressed:!!m.value||void 0,ariaLabel:n.ariaLabel,role:null==g?void 0:g.value};switch(y.value){case l.a:return{...e,href:n.href,target:n.target,rel:n.rel};case l.routerLink:case l.nuxtLink:return{...e,to:n.to,target:n.target};case l.button:return{...e,type:n.type,disabled:n.disabled};default:return e}})),B=e=>{n.disabled?e.preventDefault():(null==v||v.emit("click",e),s("click",e))},h=e=>{null==v||v.emit("mouseover",e),s("mouseover",e)},S=e=>{null==v||v.emit("mouseleave",e),s("mouseleave",e)};return(t,o)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(y)),e.mergeProps(e.unref(k),{ref_key:"element",ref:c,class:{active:t.active,pressed:e.unref(m),disabled:t.disabled,current:t.current},onClickPassive:B,onMouseoverPassive:h,onMouseleavePassive:S}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]))])),_:3},16,["class"]))}})}));
|
|
@@ -17,11 +17,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
17
17
|
type: (ObjectConstructor | StringConstructor)[];
|
|
18
18
|
};
|
|
19
19
|
href: StringConstructor;
|
|
20
|
-
target:
|
|
21
|
-
type: globalThis.PropType<"_blank" | "_self" | "_parent" | "_top">;
|
|
22
|
-
default: undefined;
|
|
23
|
-
validator: (value: import("../../constants").AnchorTarget) => boolean;
|
|
24
|
-
};
|
|
20
|
+
target: StringConstructor;
|
|
25
21
|
rel: {
|
|
26
22
|
type: StringConstructor;
|
|
27
23
|
default: string;
|
|
@@ -68,11 +64,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
68
64
|
type: (ObjectConstructor | StringConstructor)[];
|
|
69
65
|
};
|
|
70
66
|
href: StringConstructor;
|
|
71
|
-
target:
|
|
72
|
-
type: globalThis.PropType<"_blank" | "_self" | "_parent" | "_top">;
|
|
73
|
-
default: undefined;
|
|
74
|
-
validator: (value: import("../../constants").AnchorTarget) => boolean;
|
|
75
|
-
};
|
|
67
|
+
target: StringConstructor;
|
|
76
68
|
rel: {
|
|
77
69
|
type: StringConstructor;
|
|
78
70
|
default: string;
|
|
@@ -101,7 +93,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
101
93
|
label: string | number;
|
|
102
94
|
disabled: boolean;
|
|
103
95
|
type: "button" | "submit" | "reset";
|
|
104
|
-
target: "_blank" | "_self" | "_parent" | "_top";
|
|
105
96
|
ariaLabel: string;
|
|
106
97
|
defaultTag: string;
|
|
107
98
|
rel: string;
|
|
@@ -17,11 +17,7 @@ export declare const VvActionProps: {
|
|
|
17
17
|
type: (ObjectConstructor | StringConstructor)[];
|
|
18
18
|
};
|
|
19
19
|
href: StringConstructor;
|
|
20
|
-
target:
|
|
21
|
-
type: globalThis.PropType<"_blank" | "_self" | "_parent" | "_top">;
|
|
22
|
-
default: undefined;
|
|
23
|
-
validator: (value: import("../../constants").AnchorTarget) => boolean;
|
|
24
|
-
};
|
|
20
|
+
target: StringConstructor;
|
|
25
21
|
rel: {
|
|
26
22
|
type: StringConstructor;
|
|
27
23
|
default: string;
|
|
@@ -5,6 +5,11 @@ const VvIconPropsDefaults = {
|
|
|
5
5
|
prefix: "normal"
|
|
6
6
|
/* normal */
|
|
7
7
|
};
|
|
8
|
+
var StorageType = /* @__PURE__ */ ((StorageType2) => {
|
|
9
|
+
StorageType2["local"] = "local";
|
|
10
|
+
StorageType2["session"] = "session";
|
|
11
|
+
return StorageType2;
|
|
12
|
+
})(StorageType || {});
|
|
8
13
|
var Strategy = /* @__PURE__ */ ((Strategy2) => {
|
|
9
14
|
Strategy2["absolute"] = "absolute";
|
|
10
15
|
Strategy2["fixed"] = "fixed";
|
|
@@ -46,13 +51,6 @@ var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
|
|
|
46
51
|
ActionTag2["button"] = "button";
|
|
47
52
|
return ActionTag2;
|
|
48
53
|
})(ActionTag || {});
|
|
49
|
-
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
50
|
-
AnchorTarget2["_blank"] = "_blank";
|
|
51
|
-
AnchorTarget2["_self"] = "_self";
|
|
52
|
-
AnchorTarget2["_parent"] = "_parent";
|
|
53
|
-
AnchorTarget2["_top"] = "_top";
|
|
54
|
-
return AnchorTarget2;
|
|
55
|
-
})(AnchorTarget || {});
|
|
56
54
|
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
57
55
|
const INJECTION_KEY_ALERT_GROUP = Symbol.for(
|
|
58
56
|
"alertGroup"
|
|
@@ -211,11 +209,7 @@ const LinkProps = {
|
|
|
211
209
|
/**
|
|
212
210
|
* Anchor target
|
|
213
211
|
*/
|
|
214
|
-
target:
|
|
215
|
-
type: String,
|
|
216
|
-
default: void 0,
|
|
217
|
-
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
218
|
-
},
|
|
212
|
+
target: String,
|
|
219
213
|
/**
|
|
220
214
|
* Anchor rel
|
|
221
215
|
*/
|
|
@@ -427,6 +421,14 @@ const IdProps = {
|
|
|
427
421
|
default: ActionTag.button
|
|
428
422
|
}
|
|
429
423
|
});
|
|
424
|
+
({
|
|
425
|
+
storageType: {
|
|
426
|
+
type: String,
|
|
427
|
+
default: StorageType.local,
|
|
428
|
+
validator: (value) => Object.values(StorageType).includes(value)
|
|
429
|
+
},
|
|
430
|
+
storageKey: String
|
|
431
|
+
});
|
|
430
432
|
function useInjectedAlertGroup() {
|
|
431
433
|
return inject(INJECTION_KEY_ALERT_GROUP, {});
|
|
432
434
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("@iconify/vue"),require("uid")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","uid"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvAlert=o(e.vue,e.vue$1,e.uid)}(this,(function(e,o,t){"use strict";const l={prefix:"normal"};var n=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("@iconify/vue"),require("uid")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","uid"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvAlert=o(e.vue,e.vue$1,e.uid)}(this,(function(e,o,t){"use strict";const l={prefix:"normal"};var n=(e=>(e.local="local",e.session="session",e))(n||{}),i=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(i||{}),r=(e=>(e.before="before",e.after="after",e))(r||{}),a=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(a||{}),s=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(s||{});const u=Symbol.for("volver"),c=Symbol.for("alertGroup");function d(o,t,l){return e.computed((()=>{const n={[o]:!0},i="string"==typeof(null==t?void 0:t.value)?t.value.split(" "):null==t?void 0:t.value;return i&&Array.isArray(i)&&i.forEach((e=>{e&&(n[`${o}--${e}`]=!0)})),l&&Object.keys(l.value).forEach((t=>{n[`${o}--${t}`]=e.unref(l.value[t])})),n}))}const v=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:{}},l),setup(t){const l=t,n=e.computed((()=>"string"==typeof l.rotate?parseFloat(l.rotate):l.rotate)),i=e.ref(!0),r=e.inject(u),{modifiers:a}=e.toRefs(l),s=d("vv-icon",a),c=e.computed((()=>l.provider||(null==r?void 0:r.iconsProvider))),v=e.computed((()=>{const e=l.name??"",t=`@${c.value}:${l.prefix}:${e}`;if(o.iconExists(t))return t;const n=null==r?void 0:r.iconsCollections.find((t=>{const l=`@${c.value}:${t.prefix}:${e}`;return o.iconExists(l)}));return n?`@${c.value}:${n.prefix}:${e}`:e}));function f(e){const t=function(e){let o;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");o=(new e).window}return(o?new o.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),n=(null==t?void 0:t.innerHTML.trim())||"";t&&n&&o.addIcon(`@${c.value}:${l.prefix}:${l.name}`,{body:n,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return r&&l.src&&!o.iconExists(`@${c.value}:${l.prefix}:${l.name}`)&&(i.value=!1,r.fetchIcon(l.src).then((e=>{e&&(f(e),i.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),l.svg&&f(l.svg),(t,l)=>e.unref(i)?(e.openBlock(),e.createBlock(e.unref(o.Icon),e.mergeProps({key:0,class:e.unref(s)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:e.unref(n),color:t.color,onLoad:t.onLoad,icon:e.unref(v)}),null,16,["class"])):e.createCommentVNode("v-if",!0)}}),f=(Boolean,Boolean,Boolean,Boolean,{modifiers:{type:[String,Array],default:void 0}}),p={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:r.before,validation:e=>Object.values(r).includes(e)}},m={id:[String,Number]};i.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,a.button,s.button,n.local;const h={...m,...f,...p,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:"alert"}},b=(o,l)=>{const{bus:n}=e.inject(c,{}),a=(s=e.computed((()=>o.id)),e.computed((()=>String((null==s?void 0:s.value)||t.uid()))));var s;const u=e.computed((()=>`${a.value}-title`)),{hasIcon:v}=function(o,t){const l=e.computed((()=>"string"==typeof(null==o?void 0:o.value)?{name:null==o?void 0:o.value}:null==o?void 0:o.value)),n=e.computed((()=>(null==t?void 0:t.value)===r.before?l.value:void 0)),a=e.computed((()=>(null==t?void 0:t.value)===r.after?l.value:void 0)),s=e.computed((()=>(null==t?void 0:t.value)===i.left?l.value:void 0)),u=e.computed((()=>(null==t?void 0:t.value)===i.right?l.value:void 0)),c=e.computed((()=>(null==t?void 0:t.value)===i.top?l.value:void 0)),d=e.computed((()=>(null==t?void 0:t.value)===i.bottom?l.value:void 0));return{hasIcon:l,hasIconLeft:s,hasIconRight:u,hasIconTop:c,hasIconBottom:d,hasIconBefore:n,hasIconAfter:a}}(e.computed((()=>o.icon))),f=d("vv-alert",e.computed((()=>o.modifiers)),e.computed((()=>({dismissable:o.autoClose>0||o.dismissable,"auto-close":o.autoClose>0,hover:b.value})))),p=e.computed((()=>({"--alert-duration":`${o.autoClose}ms`}))),m=()=>{h&&clearTimeout(h),l("close",a.value),null==n||n.emit("close",a.value)};let h;e.watch((()=>o.autoClose),(e=>{e>0?h=setTimeout(m,e):h&&clearTimeout(h)}),{immediate:!0});const b=e.ref(!1),y=e.withModifiers((()=>{b.value=!0,h&&clearTimeout(h)}),["passive"]),g=e.withModifiers((()=>{b.value=!1,o.autoClose>0&&(h=setTimeout(m,o.autoClose))}),["passive"]);return{close:m,hasIcon:v,hasTitleId:u,hasProps:e.computed((()=>({onMouseover:y,onMouseleave:g,class:f.value,style:p.value,role:o.role,"aria-labelledby":u.value})))}},y={key:0,class:"vv-alert__header"},g=["id"],$=["aria-label"],B=[e.createElementVNode("div",{class:"vv-alert__close-mask"},null,-1)],k={key:1,class:"vv-alert__content"},S={key:2,class:"vv-alert__footer"};return e.defineComponent({name:"VvAlert",props:h,emits:["close"],setup(o,{expose:t,emit:l}){const n=o,i=l,{hasProps:r,hasTitleId:a,hasIcon:s,close:u}=b(n,i);return t({close:u}),(o,t)=>(e.openBlock(),e.createElementBlock("div",e.normalizeProps(e.guardReactiveProps(e.unref(r))),[o.$slots.header||o.$slots.title||o.$slots.close||o.$slots["title::before"]||o.$slots["title::after"]||o.title||o.dismissable||o.autoClose?(e.openBlock(),e.createElementBlock("div",y,[e.unref(s)?(e.openBlock(),e.createBlock(v,e.mergeProps({key:0},e.unref(s),{class:"vv-alert__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.renderSlot(o.$slots,"header",{},(()=>[e.renderSlot(o.$slots,"title::before"),o.$slots.title||o.title?(e.openBlock(),e.createElementBlock("strong",{key:0,id:e.unref(a),class:"vv-alert__title"},[e.renderSlot(o.$slots,"title",{},(()=>[e.createTextVNode(e.toDisplayString(o.title),1)]))],8,g)):e.createCommentVNode("v-if",!0),e.renderSlot(o.$slots,"title::after")])),e.renderSlot(o.$slots,"close",e.normalizeProps(e.guardReactiveProps({close:e.unref(u)})),(()=>[o.dismissable||o.autoClose?(e.openBlock(),e.createElementBlock("button",{key:0,class:"vv-alert__close",type:"button","aria-label":o.closeLabel,onClick:t[0]||(t[0]=e.withModifiers(((...o)=>e.unref(u)&&e.unref(u)(...o)),["stop"]))},B,8,$)):e.createCommentVNode("v-if",!0)]))])):e.createCommentVNode("v-if",!0),o.$slots.default||o.content?(e.openBlock(),e.createElementBlock("div",k,[e.renderSlot(o.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(o.content),1)]))])):e.createCommentVNode("v-if",!0),o.$slots.footer||o.footer?(e.openBlock(),e.createElementBlock("div",S,[e.renderSlot(o.$slots,"footer",{},(()=>[e.createTextVNode(e.toDisplayString(o.footer),1)]))])):e.createCommentVNode("v-if",!0)],16))}})}));
|