@volverjs/ui-vue 0.0.10-beta.25 → 0.0.10-beta.27
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 +92 -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 +358 -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 +8 -8
- 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 +14 -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 +100 -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
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue")):"function"==typeof define&&define.amd?define(["vue"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvButtonGroup=o(e.vue)}(this,(function(e){"use strict";var o=(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")):"function"==typeof define&&define.amd?define(["vue"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvButtonGroup=o(e.vue)}(this,(function(e){"use strict";var o=(e=>(e.local="local",e.session="session",e))(o||{}),t=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(t||{}),l=(e=>(e.before="before",e.after="after",e))(l||{}),u=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(u||{}),a=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(a||{});const n=Symbol.for("buttonGroup"),r={disabled:{type:Boolean,default:!1}},i=(Boolean,Boolean,Boolean,{modifiers:{type:[String,Array],default:void 0}});l.before;const s={unselectable:{type:Boolean,default:!0}};t.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,u.button,a.button,o.local;const d={...i,...r,...s,itemModifiers:{type:[String,Array],default:""},toggle:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},modelValue:{type:[String,Number,Boolean,Array],default:void 0}};return e.defineComponent({name:"VvButtonGroup",props:d,emits:["update:modelValue"],setup(o,{emit:t}){const l=t,u=o,{disabled:a,toggle:r,modifiers:i,multiple:s,unselectable:d,itemModifiers:f}=e.toRefs(u);e.watchEffect((()=>{"string"==typeof u.modelValue&&s.value&&console.warn("[VvButtonGroup]: modelValue is a string but multiple is true.")}));const m=e.computed({get:()=>s.value?u.modelValue:Array.isArray(u.modelValue)?u.modelValue[0]:u.modelValue,set:e=>void 0===e||!Array.isArray(u.modelValue)&&!s.value||Array.isArray(e)?l("update:modelValue",e):l("update:modelValue",[e])});var p,c;p=n,c={modelValue:m,disabled:a,toggle:r,multiple:s,unselectable:d,modifiers:f},e.provide(p,c);const b=function(o,t,l){return e.computed((()=>{const u={[o]:!0},a="string"==typeof(null==t?void 0:t.value)?t.value.split(" "):null==t?void 0:t.value;return a&&Array.isArray(a)&&a.forEach((e=>{e&&(u[`${o}--${e}`]=!0)})),l&&Object.keys(l.value).forEach((t=>{u[`${o}--${t}`]=e.unref(l.value[t])})),u}))}("vv-button-group",i);return(o,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(b)),role:"group"},[e.renderSlot(o.$slots,"default")],2))}})}));
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { computed, unref, defineComponent, toRefs, openBlock, createElementBlock, normalizeClass, renderSlot, createTextVNode, toDisplayString, createCommentVNode } 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 LinkProps = {
|
|
51
49
|
/**
|
|
52
50
|
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
@@ -62,11 +60,7 @@ const LinkProps = {
|
|
|
62
60
|
/**
|
|
63
61
|
* Anchor target
|
|
64
62
|
*/
|
|
65
|
-
target:
|
|
66
|
-
type: String,
|
|
67
|
-
default: void 0,
|
|
68
|
-
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
69
|
-
},
|
|
63
|
+
target: String,
|
|
70
64
|
/**
|
|
71
65
|
* Anchor rel
|
|
72
66
|
*/
|
|
@@ -271,6 +265,14 @@ const ModifiersProps = {
|
|
|
271
265
|
default: ActionTag.button
|
|
272
266
|
}
|
|
273
267
|
});
|
|
268
|
+
({
|
|
269
|
+
storageType: {
|
|
270
|
+
type: String,
|
|
271
|
+
default: StorageType.local,
|
|
272
|
+
validator: (value) => Object.values(StorageType).includes(value)
|
|
273
|
+
},
|
|
274
|
+
storageKey: String
|
|
275
|
+
});
|
|
274
276
|
const VvCardProps = {
|
|
275
277
|
...ModifiersProps,
|
|
276
278
|
title: String
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue")):"function"==typeof define&&define.amd?define(["vue"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCard=o(e.vue)}(this,(function(e){"use strict";var o=(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")):"function"==typeof define&&define.amd?define(["vue"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCard=o(e.vue)}(this,(function(e){"use strict";var o=(e=>(e.local="local",e.session="session",e))(o||{}),t=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(t||{}),n=(e=>(e.before="before",e.after="after",e))(n||{}),r=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(r||{}),l=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(l||{});Boolean,Boolean,Boolean,Boolean;const a={modifiers:{type:[String,Array],default:void 0}};n.before,t.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,r.button,l.button,o.local;const s={...a,title:String};const i={key:0,class:"vv-card__header"},c={key:1,class:"vv-card__content"},u={key:2,class:"vv-card__footer"};return e.defineComponent({name:"VvCard",props:s,setup(o){const t=o,{modifiers:n}=e.toRefs(t),r=function(o,t,n){return e.computed((()=>{const r={[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&&(r[`${o}--${e}`]=!0)})),n&&Object.keys(n.value).forEach((t=>{r[`${o}--${t}`]=e.unref(n.value[t])})),r}))}("vv-card",n);return(o,t)=>(e.openBlock(),e.createElementBlock("article",{class:e.normalizeClass(e.unref(r))},[o.$slots.header||o.title?(e.openBlock(),e.createElementBlock("header",i,[e.renderSlot(o.$slots,"header",{},(()=>[e.createTextVNode(e.toDisplayString(o.title),1)]))])):e.createCommentVNode("v-if",!0),e.renderSlot(o.$slots,"default"),o.$slots.content?(e.openBlock(),e.createElementBlock("div",c,[e.renderSlot(o.$slots,"content")])):e.createCommentVNode("v-if",!0),o.$slots.footer?(e.openBlock(),e.createElementBlock("footer",u,[e.renderSlot(o.$slots,"footer")])):e.createCommentVNode("v-if",!0)],2))}})}));
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { inject, computed, toRef, toRefs, isRef, defineComponent, h, unref, useSlots, ref, watchEffect, watch, onMounted, openBlock, createElementBlock, normalizeClass, withDirectives, createElementVNode, vModelCheckbox, renderSlot, createTextVNode, toDisplayString, createVNode, createSlots, withCtx, normalizeProps, guardReactiveProps } from "vue";
|
|
2
2
|
import { uid } from "uid";
|
|
3
|
+
var StorageType = /* @__PURE__ */ ((StorageType2) => {
|
|
4
|
+
StorageType2["local"] = "local";
|
|
5
|
+
StorageType2["session"] = "session";
|
|
6
|
+
return StorageType2;
|
|
7
|
+
})(StorageType || {});
|
|
3
8
|
var Strategy = /* @__PURE__ */ ((Strategy2) => {
|
|
4
9
|
Strategy2["absolute"] = "absolute";
|
|
5
10
|
Strategy2["fixed"] = "fixed";
|
|
@@ -41,13 +46,6 @@ var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
|
|
|
41
46
|
ActionTag2["button"] = "button";
|
|
42
47
|
return ActionTag2;
|
|
43
48
|
})(ActionTag || {});
|
|
44
|
-
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
45
|
-
AnchorTarget2["_blank"] = "_blank";
|
|
46
|
-
AnchorTarget2["_self"] = "_self";
|
|
47
|
-
AnchorTarget2["_parent"] = "_parent";
|
|
48
|
-
AnchorTarget2["_top"] = "_top";
|
|
49
|
-
return AnchorTarget2;
|
|
50
|
-
})(AnchorTarget || {});
|
|
51
49
|
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
52
50
|
const INJECTION_KEY_CHECK_GROUP = Symbol.for(
|
|
53
51
|
"checkGroup"
|
|
@@ -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
|
*/
|
|
@@ -377,6 +371,14 @@ const CheckboxRadioProps = {
|
|
|
377
371
|
default: ActionTag.button
|
|
378
372
|
}
|
|
379
373
|
});
|
|
374
|
+
({
|
|
375
|
+
storageType: {
|
|
376
|
+
type: String,
|
|
377
|
+
default: StorageType.local,
|
|
378
|
+
validator: (value) => Object.values(StorageType).includes(value)
|
|
379
|
+
},
|
|
380
|
+
storageKey: String
|
|
381
|
+
});
|
|
380
382
|
function useInjectedGroupState(groupKey) {
|
|
381
383
|
const group = inject(groupKey, void 0);
|
|
382
384
|
const isInGroup = computed(() => group !== void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("uid")):"function"==typeof define&&define.amd?define(["vue","uid"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckbox=t(e.vue,e.uid)}(this,(function(e,t){"use strict";var l=(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"),require("uid")):"function"==typeof define&&define.amd?define(["vue","uid"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckbox=t(e.vue,e.uid)}(this,(function(e,t){"use strict";var l=(e=>(e.local="local",e.session="session",e))(l||{}),a=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(a||{}),n=(e=>(e.before="before",e.after="after",e))(n||{}),o=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(o||{}),i=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(i||{});const r=Symbol.for("volver"),u=Symbol.for("checkGroup"),d={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},s={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},v={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},c={disabled:{type:Boolean,default:!1}},f=(Boolean,Boolean,Boolean,{label:{type:[String,Number],default:void 0}}),p={readonly:{type:Boolean,default:!1}},b={modifiers:{type:[String,Array],default:void 0}},h={hintLabel:{type:String,default:""}};n.before;const m={tabindex:{type:[String,Number],default:0}},y={id:[String,Number]};a.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const g={...{...y,name:{type:String,required:!0}},...m,...d,...s,...h,...c,...p,...b,...f,...v,value:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[Object,Number,Boolean,String],default:void 0}};o.button,i.button,l.local;const S={...g,...b,indeterminate:Boolean,uncheckedValue:[String,Number,Boolean],switch:Boolean};function L(t,l){const{group:a,isInGroup:n,getGroupOrLocalRef:o}=function(t){const l=e.inject(t,void 0),a=e.computed((()=>void 0!==l));return{group:l,isInGroup:a,getGroupOrLocalRef:function(t,a,n){const o=null==l?void 0:l[t];if(o)return e.computed({get:()=>o.value,set(e){o.value=e}});const i=e.toRef(a,t);return e.computed({get:()=>i.value,set(e){n&&n(`update:${t}`,e)}})}}}(u),{id:i,switch:r,indeterminate:d}=e.toRefs(t),s=o("modelValue",t,l),v=o("valid",t),c=o("invalid",t),f=e.computed((()=>Boolean(t.readonly||(null==a?void 0:a.readonly.value)))),p=e.computed((()=>Boolean(t.disabled||(null==a?void 0:a.disabled.value))));return{id:i,propsSwitch:r,indeterminate:d,group:a,isInGroup:n,modelValue:s,valid:v,invalid:c,readonly:f,disabled:p}}function k(e,t,l){return l?O(e,l)===O(t,l):B(e,t)}function B(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const l=Array.isArray(e),a=Array.isArray(t);let n,o,i;if(l&&a){if(o=e.length,o!=t.length)return!1;for(n=o;0!=n--;)if(!B(e[n],t[n]))return!1;return!0}if(l!=a)return!1;const r=e instanceof Date,u=t instanceof Date;if(r!=u)return!1;if(r&&u)return e.getTime()==t.getTime();const d=e instanceof RegExp,s=t instanceof RegExp;if(d!=s)return!1;if(d&&s)return e.toString()==t.toString();const v=Object.keys(e);if(o=v.length,o!==Object.keys(t).length)return!1;for(n=o;0!=n--;)if(!Object.prototype.hasOwnProperty.call(t,v[n]))return!1;for(n=o;0!=n--;)if(i=v[n],!B(e[i],t[i]))return!1;return!0}return e!=e&&t!=t}function O(e,t){if(e&&Object.keys(e).length&&t){if(-1===t.indexOf("."))return e[t];{const l=t.split(".");let a=e;for(let t=0,n=l.length;t<n;++t){if(null==e)return null;a=a[l[t]]}return a}}return null}function x(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}function V(t,l,a){const n=e.inject(r),o=e.computed((()=>{var e;if(n&&(null==(e=n.defaults.value)?void 0:e[t]))return n.defaults.value[t]}));return e.computed((()=>{if(void 0===o.value)return a;const e=o.value,t=l,n=a;return Object.keys(t).reduce(((l,a)=>{const o=n[a];if(l[a]=o,a in e){if(Array.isArray(t[a])){const n=t[a];if(n.length){n[0]===o&&(l[a]=e[a])}}if("function"==typeof t[a]){(0,t[a])()===o&&(l[a]=e[a])}if("object"==typeof t[a]){let n=t[a].default;"function"==typeof n&&(n=n()),"object"==typeof n?JSON.stringify(n)===JSON.stringify(o)&&(l[a]=e[a]):n===o&&(l[a]=e[a])}}return l}),{})}))}const A=["for"],$=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"];return e.defineComponent({name:"VvCheckbox",props:S,emits:["click","update:modelValue","change","blur"],setup(l,{emit:a}){const n=l,o=a,i=e.useSlots(),r=V("VvCheckbox",S,n),{id:u,disabled:d,readonly:s,valid:v,invalid:c,propsSwitch:f,modelValue:p,indeterminate:b,isInGroup:h}=L(n,o),m=(l=>e.computed((()=>String((null==l?void 0:l.value)||t.uid()))))(u),y=e.computed((()=>`${m.value}-hint`)),g=e.computed((()=>j.value?-1:n.tabindex)),B=e.ref(),O=e.computed((()=>void 0!==n.uncheckedValue&&!h.value)),j=e.computed((()=>d.value||s.value)),w=e.computed((()=>!0===c.value||!0!==v.value&&void 0)),R=e.computed((()=>O.value?p.value===n.value:Array.isArray(p.value)?function(e,t){if(null!=e&&t&&t.length)for(const l of t)if(k(e,l))return!0;return!1}(n.value,p.value):k(n.value,p.value))),C=e.computed((()=>!!b.value||!(R.value||!O.value||n.uncheckedValue===p.value))),N=e.computed((()=>{if(!O.value)return!["string","number","boolean"].includes(typeof n.value)||n.value})),I=e.computed({get:()=>R.value,set(e){if(O.value)p.value=e?n.value:n.uncheckedValue;else if(Array.isArray(p.value)||h.value){const t=new Set(Array.isArray(p.value)?p.value:void 0!==p.value?[p.value]:[]);e?t.add(n.value):t.delete(n.value),p.value=[...t]}else p.value=e?n.value:void 0;o("change",e)}}),{modifiers:P}=e.toRefs(n),E=function(t,l,a){return e.computed((()=>{const n={[t]:!0},o="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return o&&Array.isArray(o)&&o.forEach((e=>{e&&(n[`${t}--${e}`]=!0)})),a&&Object.keys(a.value).forEach((l=>{n[`${t}--${l}`]=e.unref(a.value[l])})),n}))}("vv-checkbox",P,e.computed((()=>({switch:f.value,valid:v.value,invalid:c.value,disabled:d.value,readonly:s.value,indeterminate:b.value}))));e.watchEffect((()=>{O.value&&Array.isArray(p.value)&&console.warn("[VvCheckbox] The model value is an array but the component is in binary mode.")})),e.watch((()=>C.value),(e=>{B.value.indeterminate=!!e})),e.onMounted((()=>{C.value&&(B.value.indeterminate=!0)}));const{HintSlot:G,hasHintLabelOrSlot:H,hasInvalidLabelOrSlot:T,hintSlotScope:_}=function(t,l){const a=e.computed((()=>e.isRef(t)?t.value:t)),n=e.computed((()=>x(a.value.invalidLabel))),o=e.computed((()=>x(a.value.validLabel))),i=e.computed((()=>a.value.loadingLabel)),r=e.computed((()=>a.value.hintLabel)),u=e.computed((()=>Boolean(a.value.loading&&(l.loading||i.value)))),d=e.computed((()=>!u.value&&Boolean(a.value.invalid&&(l.invalid||n.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(a.value.valid&&(l.valid||o.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(l.hint||r.value))),c=e.computed((()=>d.value||s.value||u.value||v.value)),f=e.computed((()=>({modelValue:a.value.modelValue,valid:a.value.valid,invalid:a.value.invalid,loading:a.value.loading}))),p=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:c,invalidLabel:n,validLabel:o,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var t,l,a,n,o,i,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(n=(a=this.$slots).invalid)?void 0:n.call(a))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(o=this.$slots).valid)?void 0:i.call(o))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:v,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:f,HintSlot:p}}(r,i);return(t,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(E)),for:e.unref(m)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(m),ref_key:"input",ref:B,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(I)?I.value=t:null),type:"checkbox",class:"vv-checkbox__input",name:t.name,disabled:e.unref(j),value:e.unref(N),tabindex:e.unref(g),"aria-invalid":e.unref(w),"aria-describedby":e.unref(H)?e.unref(y):void 0,"aria-errormessage":e.unref(T)?e.unref(y):void 0},null,8,$),[[e.vModelCheckbox,e.unref(I)]]),e.renderSlot(t.$slots,"default",{value:e.unref(p)},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)])),e.createVNode(e.unref(G),{id:e.unref(y),class:"vv-checkbox__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(_))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(_))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(_))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(_))))])),key:"3"}:void 0]),1032,["id"])],10,A))}})}));
|
|
@@ -2,6 +2,11 @@ import { computed, isRef, defineComponent, h, inject, toRef, toRefs, unref, useS
|
|
|
2
2
|
import { uid } from "uid";
|
|
3
3
|
import { useVModel } from "@vueuse/core";
|
|
4
4
|
import { get } from "ts-dot-prop";
|
|
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_VOLVER = Symbol.for("volver");
|
|
54
52
|
const INJECTION_KEY_CHECK_GROUP = Symbol.for(
|
|
55
53
|
"checkGroup"
|
|
@@ -269,11 +267,7 @@ const LinkProps = {
|
|
|
269
267
|
/**
|
|
270
268
|
* Anchor target
|
|
271
269
|
*/
|
|
272
|
-
target:
|
|
273
|
-
type: String,
|
|
274
|
-
default: void 0,
|
|
275
|
-
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
276
|
-
},
|
|
270
|
+
target: String,
|
|
277
271
|
/**
|
|
278
272
|
* Anchor rel
|
|
279
273
|
*/
|
|
@@ -629,6 +623,14 @@ const CheckboxRadioGroupProps = {
|
|
|
629
623
|
default: ActionTag.button
|
|
630
624
|
}
|
|
631
625
|
});
|
|
626
|
+
({
|
|
627
|
+
storageType: {
|
|
628
|
+
type: String,
|
|
629
|
+
default: StorageType.local,
|
|
630
|
+
validator: (value) => Object.values(StorageType).includes(value)
|
|
631
|
+
},
|
|
632
|
+
storageKey: String
|
|
633
|
+
});
|
|
632
634
|
function useInjectedGroupState(groupKey) {
|
|
633
635
|
const group = inject(groupKey, void 0);
|
|
634
636
|
const isInGroup = computed(() => group !== void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("uid"),require("@vueuse/core"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","uid","@vueuse/core","ts-dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckboxGroup=t(e.vue,e.uid,e.core,e.tsDotProp)}(this,(function(e,t,l,a){"use strict";var o=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(o||{}),n=(e=>(e.before="before",e.after="after",e))(n||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{}),r=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(r||{});const u=Symbol.for("volver"),d=Symbol.for("checkGroup");function s(e,t,l){return l?c(e,l)===c(t,l):v(e,t)}function v(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const l=Array.isArray(e),a=Array.isArray(t);let o,n,i;if(l&&a){if(n=e.length,n!=t.length)return!1;for(o=n;0!=o--;)if(!v(e[o],t[o]))return!1;return!0}if(l!=a)return!1;const r=e instanceof Date,u=t instanceof Date;if(r!=u)return!1;if(r&&u)return e.getTime()==t.getTime();const d=e instanceof RegExp,s=t instanceof RegExp;if(d!=s)return!1;if(d&&s)return e.toString()==t.toString();const c=Object.keys(e);if(n=c.length,n!==Object.keys(t).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(t,c[o]))return!1;for(o=n;0!=o--;)if(i=c[o],!v(e[i],t[i]))return!1;return!0}return e!=e&&t!=t}function c(e,t){if(e&&Object.keys(e).length&&t){if(-1===t.indexOf("."))return e[t];{const l=t.split(".");let a=e;for(let t=0,o=l.length;t<o;++t){if(null==e)return null;a=a[l[t]]}return a}}return null}function f(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}function p(t,l){const a=e.computed((()=>e.isRef(t)?t.value:t)),o=e.computed((()=>f(a.value.invalidLabel))),n=e.computed((()=>f(a.value.validLabel))),i=e.computed((()=>a.value.loadingLabel)),r=e.computed((()=>a.value.hintLabel)),u=e.computed((()=>Boolean(a.value.loading&&(l.loading||i.value)))),d=e.computed((()=>!u.value&&Boolean(a.value.invalid&&(l.invalid||o.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(a.value.valid&&(l.valid||n.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(l.hint||r.value))),c=e.computed((()=>d.value||s.value||u.value||v.value)),p=e.computed((()=>({modelValue:a.value.modelValue,valid:a.value.valid,invalid:a.value.invalid,loading:a.value.loading}))),b=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:c,invalidLabel:o,validLabel:n,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var t,l,a,o,n,i,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(o=(a=this.$slots).invalid)?void 0:o.call(a))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(n=this.$slots).valid)?void 0:i.call(n))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:v,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:p,HintSlot:b}}const b={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},m={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},h={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},y={disabled:{type:Boolean,default:!1}},g=(Boolean,Boolean,Boolean,{label:{type:[String,Number],default:void 0}}),S={readonly:{type:Boolean,default:!1}},k={modifiers:{type:[String,Array],default:void 0}},L={hintLabel:{type:String,default:""}},B={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}};n.before;const V={tabindex:{type:[String,Number],default:0}},x={id:[String,Number]};o.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const O={...{...x,name:{type:String,required:!0}},...V,...b,...m,...L,...y,...S,...k,...g,...h,value:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[Object,Number,Boolean,String],default:void 0}},$={...b,...m,...B,...L,...y,...S,...k,...g,...h,modelValue:{type:[String,Array,Boolean,Number,Symbol],default:void 0},name:{type:String,required:!0},vertical:{type:Boolean,default:!1}};i.button,r.button;const A={...O,...k,indeterminate:Boolean,uncheckedValue:[String,Number,Boolean],switch:Boolean};function C(t,l){const{group:a,isInGroup:o,getGroupOrLocalRef:n}=function(t){const l=e.inject(t,void 0),a=e.computed((()=>void 0!==l));return{group:l,isInGroup:a,getGroupOrLocalRef:function(t,a,o){const n=null==l?void 0:l[t];if(n)return e.computed({get:()=>n.value,set(e){n.value=e}});const i=e.toRef(a,t);return e.computed({get:()=>i.value,set(e){o&&o(`update:${t}`,e)}})}}}(d),{id:i,switch:r,indeterminate:u}=e.toRefs(t),s=n("modelValue",t,l),v=n("valid",t),c=n("invalid",t),f=e.computed((()=>Boolean(t.readonly||(null==a?void 0:a.readonly.value)))),p=e.computed((()=>Boolean(t.disabled||(null==a?void 0:a.disabled.value))));return{id:i,propsSwitch:r,indeterminate:u,group:a,isInGroup:o,modelValue:s,valid:v,invalid:c,readonly:f,disabled:p}}function w(t,l,a){const o=e.inject(u),n=e.computed((()=>{var e;if(o&&(null==(e=o.defaults.value)?void 0:e[t]))return o.defaults.value[t]}));return e.computed((()=>{if(void 0===n.value)return a;const e=n.value,t=l,o=a;return Object.keys(t).reduce(((l,a)=>{const n=o[a];if(l[a]=n,a in e){if(Array.isArray(t[a])){const o=t[a];if(o.length){o[0]===n&&(l[a]=e[a])}}if("function"==typeof t[a]){(0,t[a])()===n&&(l[a]=e[a])}if("object"==typeof t[a]){let o=t[a].default;"function"==typeof o&&(o=o()),"object"==typeof o?JSON.stringify(o)===JSON.stringify(n)&&(l[a]=e[a]):o===n&&(l[a]=e[a])}}return l}),{})}))}function j(t,l,a){return e.computed((()=>{const o={[t]:!0},n="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(o[`${t}--${e}`]=!0)})),a&&Object.keys(a.value).forEach((l=>{o[`${t}--${l}`]=e.unref(a.value[l])})),o}))}const P=["for"],R=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"],N=e.defineComponent({name:"VvCheckbox",props:A,emits:["click","update:modelValue","change","blur"],setup(l,{emit:a}){const o=l,n=a,i=e.useSlots(),r=w("VvCheckbox",A,o),{id:u,disabled:d,readonly:v,valid:c,invalid:f,propsSwitch:b,modelValue:m,indeterminate:h,isInGroup:y}=C(o,n),g=(l=>e.computed((()=>String((null==l?void 0:l.value)||t.uid()))))(u),S=e.computed((()=>`${g.value}-hint`)),k=e.computed((()=>V.value?-1:o.tabindex)),L=e.ref(),B=e.computed((()=>void 0!==o.uncheckedValue&&!y.value)),V=e.computed((()=>d.value||v.value)),x=e.computed((()=>!0===f.value||!0!==c.value&&void 0)),O=e.computed((()=>B.value?m.value===o.value:Array.isArray(m.value)?function(e,t){if(null!=e&&t&&t.length)for(const l of t)if(s(e,l))return!0;return!1}(o.value,m.value):s(o.value,m.value))),$=e.computed((()=>!!h.value||!(O.value||!B.value||o.uncheckedValue===m.value))),N=e.computed((()=>{if(!B.value)return!["string","number","boolean"].includes(typeof o.value)||o.value})),_=e.computed({get:()=>O.value,set(e){if(B.value)m.value=e?o.value:o.uncheckedValue;else if(Array.isArray(m.value)||y.value){const t=new Set(Array.isArray(m.value)?m.value:void 0!==m.value?[m.value]:[]);e?t.add(o.value):t.delete(o.value),m.value=[...t]}else m.value=e?o.value:void 0;n("change",e)}}),{modifiers:z}=e.toRefs(o),E=j("vv-checkbox",z,e.computed((()=>({switch:b.value,valid:c.value,invalid:f.value,disabled:d.value,readonly:v.value,indeterminate:h.value}))));e.watchEffect((()=>{B.value&&Array.isArray(m.value)&&console.warn("[VvCheckbox] The model value is an array but the component is in binary mode.")})),e.watch((()=>$.value),(e=>{L.value.indeterminate=!!e})),e.onMounted((()=>{$.value&&(L.value.indeterminate=!0)}));const{HintSlot:G,hasHintLabelOrSlot:I,hasInvalidLabelOrSlot:D,hintSlotScope:H}=p(r,i);return(t,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(E)),for:e.unref(g)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(g),ref_key:"input",ref:L,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(_)?_.value=t:null),type:"checkbox",class:"vv-checkbox__input",name:t.name,disabled:e.unref(V),value:e.unref(N),tabindex:e.unref(k),"aria-invalid":e.unref(x),"aria-describedby":e.unref(I)?e.unref(S):void 0,"aria-errormessage":e.unref(D)?e.unref(S):void 0},null,8,R),[[e.vModelCheckbox,e.unref(_)]]),e.renderSlot(t.$slots,"default",{value:e.unref(m)},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)])),e.createVNode(e.unref(G),{id:e.unref(S),class:"vv-checkbox__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"3"}:void 0]),1032,["id"])],10,P))}}),_=$;const z=["textContent"],E={class:"vv-checkbox-group__wrapper"};return e.defineComponent({name:"VvCheckboxGroup",props:_,emits:["update:modelValue","change"],setup(t,{emit:o}){const n=t,i=o,r=e.useSlots(),u=w("VvCheckboxGroup",_,n),s=l.useVModel(n,"modelValue",i),{disabled:v,readonly:c,vertical:f,valid:b,invalid:m,modifiers:h}=e.toRefs(n);var y,g;y=d,g={modelValue:s,disabled:v,readonly:c,valid:b,invalid:m},e.provide(y,g);const{getOptionLabel:S,getOptionValue:k}=function(t){const{options:l,labelKey:o,valueKey:n,disabledKey:i}=e.toRefs(t);return{options:l,getOptionLabel:e=>"object"!=typeof e&&null!==e?e:String("function"==typeof o.value?o.value(e):a.get(e,o.value)),getOptionValue:e=>"object"!=typeof e&&null!==e?e:"function"==typeof n.value?n.value(e):a.get(e,n.value),isOptionDisabled:e=>("object"==typeof e||null===e)&&("function"==typeof i.value?i.value(e):a.get(e,i.value)),getOptionGrouped:e=>"object"!=typeof e&&null!==e?[]:e.options||[]}}(n),L=j("vv-checkbox-group",h,e.computed((()=>({disabled:v.value,readonly:c.value,horizontal:!f.value,valid:b.value,invalid:m.value})))),{HintSlot:B,hintSlotScope:V}=p(u,r);return(t,l)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(L))},[t.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(t.label)},null,8,z)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",E,[t.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.options,((t,l)=>(e.openBlock(),e.createBlock(N,e.mergeProps({key:l},((e,t)=>({id:`${n.name}_opt${t}`,name:n.name,label:S(e),value:k(e)}))(t,l)),null,16)))),128)):e.renderSlot(t.$slots,"default",{key:1})]),e.createVNode(e.unref(B),{class:"vv-checkbox-group__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(V))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(V))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(V))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(V))))])),key:"3"}:void 0]),1024)],2))}})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("uid"),require("@vueuse/core"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","uid","@vueuse/core","ts-dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckboxGroup=t(e.vue,e.uid,e.core,e.tsDotProp)}(this,(function(e,t,l,a){"use strict";var o=(e=>(e.local="local",e.session="session",e))(o||{}),n=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(n||{}),i=(e=>(e.before="before",e.after="after",e))(i||{}),r=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(r||{}),u=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(u||{});const d=Symbol.for("volver"),s=Symbol.for("checkGroup");function v(e,t,l){return l?f(e,l)===f(t,l):c(e,t)}function c(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const l=Array.isArray(e),a=Array.isArray(t);let o,n,i;if(l&&a){if(n=e.length,n!=t.length)return!1;for(o=n;0!=o--;)if(!c(e[o],t[o]))return!1;return!0}if(l!=a)return!1;const r=e instanceof Date,u=t instanceof Date;if(r!=u)return!1;if(r&&u)return e.getTime()==t.getTime();const d=e instanceof RegExp,s=t instanceof RegExp;if(d!=s)return!1;if(d&&s)return e.toString()==t.toString();const v=Object.keys(e);if(n=v.length,n!==Object.keys(t).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(t,v[o]))return!1;for(o=n;0!=o--;)if(i=v[o],!c(e[i],t[i]))return!1;return!0}return e!=e&&t!=t}function f(e,t){if(e&&Object.keys(e).length&&t){if(-1===t.indexOf("."))return e[t];{const l=t.split(".");let a=e;for(let t=0,o=l.length;t<o;++t){if(null==e)return null;a=a[l[t]]}return a}}return null}function p(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}function b(t,l){const a=e.computed((()=>e.isRef(t)?t.value:t)),o=e.computed((()=>p(a.value.invalidLabel))),n=e.computed((()=>p(a.value.validLabel))),i=e.computed((()=>a.value.loadingLabel)),r=e.computed((()=>a.value.hintLabel)),u=e.computed((()=>Boolean(a.value.loading&&(l.loading||i.value)))),d=e.computed((()=>!u.value&&Boolean(a.value.invalid&&(l.invalid||o.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(a.value.valid&&(l.valid||n.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(l.hint||r.value))),c=e.computed((()=>d.value||s.value||u.value||v.value)),f=e.computed((()=>({modelValue:a.value.modelValue,valid:a.value.valid,invalid:a.value.invalid,loading:a.value.loading}))),b=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:c,invalidLabel:o,validLabel:n,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var t,l,a,o,n,i,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(o=(a=this.$slots).invalid)?void 0:o.call(a))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(n=this.$slots).valid)?void 0:i.call(n))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:v,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:f,HintSlot:b}}const m={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},h={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},y={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},g={disabled:{type:Boolean,default:!1}},S=(Boolean,Boolean,Boolean,{label:{type:[String,Number],default:void 0}}),k={readonly:{type:Boolean,default:!1}},L={modifiers:{type:[String,Array],default:void 0}},B={hintLabel:{type:String,default:""}},V={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}};i.before;const x={tabindex:{type:[String,Number],default:0}},O={id:[String,Number]};n.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const $={...{...O,name:{type:String,required:!0}},...x,...m,...h,...B,...g,...k,...L,...S,...y,value:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[Object,Number,Boolean,String],default:void 0}},A={...m,...h,...V,...B,...g,...k,...L,...S,...y,modelValue:{type:[String,Array,Boolean,Number,Symbol],default:void 0},name:{type:String,required:!0},vertical:{type:Boolean,default:!1}};r.button,u.button,o.local;const C={...$,...L,indeterminate:Boolean,uncheckedValue:[String,Number,Boolean],switch:Boolean};function w(t,l){const{group:a,isInGroup:o,getGroupOrLocalRef:n}=function(t){const l=e.inject(t,void 0),a=e.computed((()=>void 0!==l));return{group:l,isInGroup:a,getGroupOrLocalRef:function(t,a,o){const n=null==l?void 0:l[t];if(n)return e.computed({get:()=>n.value,set(e){n.value=e}});const i=e.toRef(a,t);return e.computed({get:()=>i.value,set(e){o&&o(`update:${t}`,e)}})}}}(s),{id:i,switch:r,indeterminate:u}=e.toRefs(t),d=n("modelValue",t,l),v=n("valid",t),c=n("invalid",t),f=e.computed((()=>Boolean(t.readonly||(null==a?void 0:a.readonly.value)))),p=e.computed((()=>Boolean(t.disabled||(null==a?void 0:a.disabled.value))));return{id:i,propsSwitch:r,indeterminate:u,group:a,isInGroup:o,modelValue:d,valid:v,invalid:c,readonly:f,disabled:p}}function j(t,l,a){const o=e.inject(d),n=e.computed((()=>{var e;if(o&&(null==(e=o.defaults.value)?void 0:e[t]))return o.defaults.value[t]}));return e.computed((()=>{if(void 0===n.value)return a;const e=n.value,t=l,o=a;return Object.keys(t).reduce(((l,a)=>{const n=o[a];if(l[a]=n,a in e){if(Array.isArray(t[a])){const o=t[a];if(o.length){o[0]===n&&(l[a]=e[a])}}if("function"==typeof t[a]){(0,t[a])()===n&&(l[a]=e[a])}if("object"==typeof t[a]){let o=t[a].default;"function"==typeof o&&(o=o()),"object"==typeof o?JSON.stringify(o)===JSON.stringify(n)&&(l[a]=e[a]):o===n&&(l[a]=e[a])}}return l}),{})}))}function P(t,l,a){return e.computed((()=>{const o={[t]:!0},n="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(o[`${t}--${e}`]=!0)})),a&&Object.keys(a.value).forEach((l=>{o[`${t}--${l}`]=e.unref(a.value[l])})),o}))}const R=["for"],N=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"],_=e.defineComponent({name:"VvCheckbox",props:C,emits:["click","update:modelValue","change","blur"],setup(l,{emit:a}){const o=l,n=a,i=e.useSlots(),r=j("VvCheckbox",C,o),{id:u,disabled:d,readonly:s,valid:c,invalid:f,propsSwitch:p,modelValue:m,indeterminate:h,isInGroup:y}=w(o,n),g=(l=>e.computed((()=>String((null==l?void 0:l.value)||t.uid()))))(u),S=e.computed((()=>`${g.value}-hint`)),k=e.computed((()=>V.value?-1:o.tabindex)),L=e.ref(),B=e.computed((()=>void 0!==o.uncheckedValue&&!y.value)),V=e.computed((()=>d.value||s.value)),x=e.computed((()=>!0===f.value||!0!==c.value&&void 0)),O=e.computed((()=>B.value?m.value===o.value:Array.isArray(m.value)?function(e,t){if(null!=e&&t&&t.length)for(const l of t)if(v(e,l))return!0;return!1}(o.value,m.value):v(o.value,m.value))),$=e.computed((()=>!!h.value||!(O.value||!B.value||o.uncheckedValue===m.value))),A=e.computed((()=>{if(!B.value)return!["string","number","boolean"].includes(typeof o.value)||o.value})),_=e.computed({get:()=>O.value,set(e){if(B.value)m.value=e?o.value:o.uncheckedValue;else if(Array.isArray(m.value)||y.value){const t=new Set(Array.isArray(m.value)?m.value:void 0!==m.value?[m.value]:[]);e?t.add(o.value):t.delete(o.value),m.value=[...t]}else m.value=e?o.value:void 0;n("change",e)}}),{modifiers:z}=e.toRefs(o),E=P("vv-checkbox",z,e.computed((()=>({switch:p.value,valid:c.value,invalid:f.value,disabled:d.value,readonly:s.value,indeterminate:h.value}))));e.watchEffect((()=>{B.value&&Array.isArray(m.value)&&console.warn("[VvCheckbox] The model value is an array but the component is in binary mode.")})),e.watch((()=>$.value),(e=>{L.value.indeterminate=!!e})),e.onMounted((()=>{$.value&&(L.value.indeterminate=!0)}));const{HintSlot:G,hasHintLabelOrSlot:I,hasInvalidLabelOrSlot:D,hintSlotScope:H}=b(r,i);return(t,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(E)),for:e.unref(g)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(g),ref_key:"input",ref:L,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(_)?_.value=t:null),type:"checkbox",class:"vv-checkbox__input",name:t.name,disabled:e.unref(V),value:e.unref(A),tabindex:e.unref(k),"aria-invalid":e.unref(x),"aria-describedby":e.unref(I)?e.unref(S):void 0,"aria-errormessage":e.unref(D)?e.unref(S):void 0},null,8,N),[[e.vModelCheckbox,e.unref(_)]]),e.renderSlot(t.$slots,"default",{value:e.unref(m)},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)])),e.createVNode(e.unref(G),{id:e.unref(S),class:"vv-checkbox__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"3"}:void 0]),1032,["id"])],10,R))}}),z=A;const E=["textContent"],G={class:"vv-checkbox-group__wrapper"};return e.defineComponent({name:"VvCheckboxGroup",props:z,emits:["update:modelValue","change"],setup(t,{emit:o}){const n=t,i=o,r=e.useSlots(),u=j("VvCheckboxGroup",z,n),d=l.useVModel(n,"modelValue",i),{disabled:v,readonly:c,vertical:f,valid:p,invalid:m,modifiers:h}=e.toRefs(n);var y,g;y=s,g={modelValue:d,disabled:v,readonly:c,valid:p,invalid:m},e.provide(y,g);const{getOptionLabel:S,getOptionValue:k}=function(t){const{options:l,labelKey:o,valueKey:n,disabledKey:i}=e.toRefs(t);return{options:l,getOptionLabel:e=>"object"!=typeof e&&null!==e?e:String("function"==typeof o.value?o.value(e):a.get(e,o.value)),getOptionValue:e=>"object"!=typeof e&&null!==e?e:"function"==typeof n.value?n.value(e):a.get(e,n.value),isOptionDisabled:e=>("object"==typeof e||null===e)&&("function"==typeof i.value?i.value(e):a.get(e,i.value)),getOptionGrouped:e=>"object"!=typeof e&&null!==e?[]:e.options||[]}}(n),L=P("vv-checkbox-group",h,e.computed((()=>({disabled:v.value,readonly:c.value,horizontal:!f.value,valid:p.value,invalid:m.value})))),{HintSlot:B,hintSlotScope:V}=b(u,r);return(t,l)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(L))},[t.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(t.label)},null,8,E)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",G,[t.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.options,((t,l)=>(e.openBlock(),e.createBlock(_,e.mergeProps({key:l},((e,t)=>({id:`${n.name}_opt${t}`,name:n.name,label:S(e),value:k(e)}))(t,l)),null,16)))),128)):e.renderSlot(t.$slots,"default",{key:1})]),e.createVNode(e.unref(B),{class:"vv-checkbox-group__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(V))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(V))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(V))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(V))))])),key:"3"}:void 0]),1024)],2))}})}));
|
|
@@ -2,9 +2,14 @@ import { inject, computed, unref, defineComponent, mergeDefaults, ref, toRefs, o
|
|
|
2
2
|
import { iconExists, Icon, addIcon } from "@iconify/vue";
|
|
3
3
|
import { autoPlacement, flip, shift, size, offset, arrow, useFloating, autoUpdate } from "@floating-ui/vue";
|
|
4
4
|
import { uid } from "uid";
|
|
5
|
-
import { useMutationObserver, useVModel, onClickOutside, useFocusWithin,
|
|
5
|
+
import { useMutationObserver, useVModel, onClickOutside, useFocusWithin, useElementHover, onKeyStroke, useFocus, useElementVisibility, refDebounced, computedAsync } from "@vueuse/core";
|
|
6
6
|
import mitt from "mitt";
|
|
7
7
|
import { get } from "ts-dot-prop";
|
|
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";
|
|
@@ -62,13 +67,6 @@ var DropdownItemRole = /* @__PURE__ */ ((DropdownItemRole2) => {
|
|
|
62
67
|
DropdownItemRole2["presentation"] = "presentation";
|
|
63
68
|
return DropdownItemRole2;
|
|
64
69
|
})(DropdownItemRole || {});
|
|
65
|
-
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
66
|
-
AnchorTarget2["_blank"] = "_blank";
|
|
67
|
-
AnchorTarget2["_self"] = "_self";
|
|
68
|
-
AnchorTarget2["_parent"] = "_parent";
|
|
69
|
-
AnchorTarget2["_top"] = "_top";
|
|
70
|
-
return AnchorTarget2;
|
|
71
|
-
})(AnchorTarget || {});
|
|
72
70
|
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
73
71
|
const INJECTION_KEY_BUTTON_GROUP = Symbol.for(
|
|
74
72
|
"buttonGroup"
|
|
@@ -97,11 +95,7 @@ const LinkProps = {
|
|
|
97
95
|
/**
|
|
98
96
|
* Anchor target
|
|
99
97
|
*/
|
|
100
|
-
target:
|
|
101
|
-
type: String,
|
|
102
|
-
default: void 0,
|
|
103
|
-
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
104
|
-
},
|
|
98
|
+
target: String,
|
|
105
99
|
/**
|
|
106
100
|
* Anchor rel
|
|
107
101
|
*/
|
|
@@ -442,6 +436,14 @@ const ActionProps = {
|
|
|
442
436
|
default: ActionTag.button
|
|
443
437
|
}
|
|
444
438
|
};
|
|
439
|
+
({
|
|
440
|
+
storageType: {
|
|
441
|
+
type: String,
|
|
442
|
+
default: StorageType.local,
|
|
443
|
+
validator: (value) => Object.values(StorageType).includes(value)
|
|
444
|
+
},
|
|
445
|
+
storageKey: String
|
|
446
|
+
});
|
|
445
447
|
const VvComboboxEvents = [
|
|
446
448
|
"update:modelValue",
|
|
447
449
|
"update:search",
|
|
@@ -765,6 +767,31 @@ const VvDropdownProps = {
|
|
|
765
767
|
validator: (value) => Object.values(DropdownRole).includes(value)
|
|
766
768
|
}
|
|
767
769
|
};
|
|
770
|
+
const VvDropdownItemProps = {
|
|
771
|
+
focusOnHover: {
|
|
772
|
+
type: Boolean,
|
|
773
|
+
default: false
|
|
774
|
+
}
|
|
775
|
+
};
|
|
776
|
+
const VvDropdownOptionProps = {
|
|
777
|
+
...DisabledProps,
|
|
778
|
+
...SelectedProps,
|
|
779
|
+
...UnselectableProps,
|
|
780
|
+
...ModifiersProps,
|
|
781
|
+
deselectHintLabel: {
|
|
782
|
+
type: String
|
|
783
|
+
},
|
|
784
|
+
selectHintLabel: {
|
|
785
|
+
type: String
|
|
786
|
+
},
|
|
787
|
+
selectedHintLabel: {
|
|
788
|
+
type: String
|
|
789
|
+
},
|
|
790
|
+
focusOnHover: {
|
|
791
|
+
type: Boolean,
|
|
792
|
+
default: false
|
|
793
|
+
}
|
|
794
|
+
};
|
|
768
795
|
const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || uid()));
|
|
769
796
|
function useProvideDropdownTrigger({
|
|
770
797
|
reference,
|
|
@@ -796,14 +823,14 @@ function useProvideDropdownTrigger({
|
|
|
796
823
|
}
|
|
797
824
|
function useProvideDropdownItem({
|
|
798
825
|
role,
|
|
799
|
-
|
|
826
|
+
...others
|
|
800
827
|
}) {
|
|
801
828
|
const itemRole = computed(
|
|
802
829
|
() => role.value === DropdownRole.listbox ? DropdownItemRole.option : DropdownItemRole.presentation
|
|
803
830
|
);
|
|
804
831
|
provide(INJECTION_KEY_DROPDOWN_ITEM, {
|
|
805
832
|
role: itemRole,
|
|
806
|
-
|
|
833
|
+
...others
|
|
807
834
|
});
|
|
808
835
|
return { itemRole };
|
|
809
836
|
}
|
|
@@ -1054,7 +1081,6 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
1054
1081
|
});
|
|
1055
1082
|
bus.on("click", toggle);
|
|
1056
1083
|
const { role, modifiers } = toRefs(props);
|
|
1057
|
-
const { itemRole } = useProvideDropdownItem({ role, expanded });
|
|
1058
1084
|
const bemCssClasses = useModifiers(
|
|
1059
1085
|
"vv-dropdown",
|
|
1060
1086
|
modifiers,
|
|
@@ -1123,6 +1149,13 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
1123
1149
|
}
|
|
1124
1150
|
});
|
|
1125
1151
|
};
|
|
1152
|
+
const hovered = useElementHover(floatingEl);
|
|
1153
|
+
const { itemRole } = useProvideDropdownItem({
|
|
1154
|
+
role,
|
|
1155
|
+
expanded,
|
|
1156
|
+
focused,
|
|
1157
|
+
hovered
|
|
1158
|
+
});
|
|
1126
1159
|
onKeyStroke("Escape", (e) => {
|
|
1127
1160
|
if (expanded.value) {
|
|
1128
1161
|
e.preventDefault();
|
|
@@ -1257,7 +1290,9 @@ const __default__$7 = {
|
|
|
1257
1290
|
};
|
|
1258
1291
|
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
1259
1292
|
...__default__$7,
|
|
1293
|
+
props: VvDropdownItemProps,
|
|
1260
1294
|
setup(__props) {
|
|
1295
|
+
const props = __props;
|
|
1261
1296
|
const { role, expanded } = useInjectedDropdownItem();
|
|
1262
1297
|
const element = ref(null);
|
|
1263
1298
|
useProvideDropdownAction({ expanded });
|
|
@@ -1265,7 +1300,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
1265
1300
|
const { focused } = useFocus(element);
|
|
1266
1301
|
const { focused: focusedWithin } = useFocusWithin(element);
|
|
1267
1302
|
watch(hovered, (newValue) => {
|
|
1268
|
-
if (newValue) {
|
|
1303
|
+
if (newValue && props.focusOnHover) {
|
|
1269
1304
|
focused.value = true;
|
|
1270
1305
|
}
|
|
1271
1306
|
});
|
|
@@ -1292,21 +1327,7 @@ const __default__$6 = {
|
|
|
1292
1327
|
};
|
|
1293
1328
|
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
1294
1329
|
...__default__$6,
|
|
1295
|
-
props:
|
|
1296
|
-
...DisabledProps,
|
|
1297
|
-
...SelectedProps,
|
|
1298
|
-
...UnselectableProps,
|
|
1299
|
-
...ModifiersProps,
|
|
1300
|
-
deselectHintLabel: {
|
|
1301
|
-
type: String
|
|
1302
|
-
},
|
|
1303
|
-
selectHintLabel: {
|
|
1304
|
-
type: String
|
|
1305
|
-
},
|
|
1306
|
-
selectedHintLabel: {
|
|
1307
|
-
type: String
|
|
1308
|
-
}
|
|
1309
|
-
},
|
|
1330
|
+
props: VvDropdownOptionProps,
|
|
1310
1331
|
setup(__props) {
|
|
1311
1332
|
const props = __props;
|
|
1312
1333
|
const { modifiers } = toRefs(props);
|
|
@@ -1332,7 +1353,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1332
1353
|
class: normalizeClass(unref(bemCssClasses)),
|
|
1333
1354
|
tabindex: _ctx.disabled ? -1 : 0,
|
|
1334
1355
|
"aria-selected": _ctx.selected,
|
|
1335
|
-
"aria-disabled": _ctx.disabled
|
|
1356
|
+
"aria-disabled": _ctx.disabled,
|
|
1357
|
+
"focus-on-hover": _ctx.focusOnHover
|
|
1336
1358
|
}, {
|
|
1337
1359
|
default: withCtx(() => [
|
|
1338
1360
|
renderSlot(_ctx.$slots, "default"),
|
|
@@ -1351,7 +1373,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1351
1373
|
]),
|
|
1352
1374
|
_: 3
|
|
1353
1375
|
/* FORWARDED */
|
|
1354
|
-
}, 8, ["class", "tabindex", "aria-selected", "aria-disabled"]);
|
|
1376
|
+
}, 8, ["class", "tabindex", "aria-selected", "aria-disabled", "focus-on-hover"]);
|
|
1355
1377
|
};
|
|
1356
1378
|
}
|
|
1357
1379
|
});
|
|
@@ -2948,6 +2970,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2948
2970
|
}, {
|
|
2949
2971
|
key: i,
|
|
2950
2972
|
class: "vv-dropdown-option",
|
|
2973
|
+
"focus-on-hover": "",
|
|
2951
2974
|
onClickPassive: ($event) => onInput(item)
|
|
2952
2975
|
}), {
|
|
2953
2976
|
default: withCtx(() => [
|
|
@@ -2983,6 +3006,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2983
3006
|
selectedHintLabel: unref(propsDefaults).selectedHintLabel
|
|
2984
3007
|
}, {
|
|
2985
3008
|
class: "vv-dropdown-option",
|
|
3009
|
+
"focus-on-hover": "",
|
|
2986
3010
|
onClickPassive: ($event) => onInput(option)
|
|
2987
3011
|
}), {
|
|
2988
3012
|
default: withCtx(() => [
|