@volverjs/ui-vue 0.0.10-beta.53 → 0.0.10-beta.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +13 -1
  2. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  3. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +9 -0
  4. package/dist/components/VvCheckboxGroup/index.d.ts +4 -0
  5. package/dist/components/VvCombobox/VvCombobox.es.js +357 -357
  6. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  7. package/dist/components/VvInputFile/VvInputFile.es.js +17 -3
  8. package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
  9. package/dist/components/VvInputFile/VvInputFile.vue.d.ts +9 -0
  10. package/dist/components/VvInputFile/index.d.ts +4 -0
  11. package/dist/components/VvInputText/VvInputText.es.js +18 -20
  12. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  13. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +13 -1
  14. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  15. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +9 -0
  16. package/dist/components/VvRadioGroup/index.d.ts +4 -0
  17. package/dist/components/VvTextarea/VvTextarea.es.js +1296 -397
  18. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  19. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +52 -0
  20. package/dist/components/VvTextarea/index.d.ts +37 -1
  21. package/dist/components/index.es.js +421 -261
  22. package/dist/components/index.umd.js +1 -1
  23. package/dist/icons.es.js +3 -3
  24. package/dist/icons.umd.js +1 -1
  25. package/dist/props/index.d.ts +8 -1
  26. package/dist/stories/InputText/InputText.stories.d.ts +2 -0
  27. package/dist/stories/InputText/InputText.test.d.ts +2 -0
  28. package/package.json +23 -23
  29. package/src/assets/icons/detailed.json +1 -1
  30. package/src/assets/icons/normal.json +1 -1
  31. package/src/assets/icons/simple.json +1 -1
  32. package/src/components/VvCheckbox/VvCheckbox.vue +2 -2
  33. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +2 -0
  34. package/src/components/VvCombobox/VvCombobox.vue +3 -3
  35. package/src/components/VvInputFile/VvInputFile.vue +12 -8
  36. package/src/components/VvInputFile/index.ts +2 -0
  37. package/src/components/VvInputText/VvInputText.vue +20 -22
  38. package/src/components/VvRadio/VvRadio.vue +2 -2
  39. package/src/components/VvRadioGroup/VvRadioGroup.vue +2 -0
  40. package/src/components/VvTextarea/VvTextarea.vue +109 -6
  41. package/src/components/VvTextarea/index.ts +32 -1
  42. package/src/props/index.ts +2 -1
  43. package/src/stories/InputText/InputText.stories.ts +37 -1
  44. package/src/stories/InputText/InputText.test.ts +18 -0
  45. package/src/stories/Textarea/Textarea.stories.ts +1 -1
@@ -123,6 +123,15 @@ const DisabledProps = {
123
123
  default: false
124
124
  }
125
125
  };
126
+ const RequiredProps = {
127
+ /**
128
+ * Whether the form control is required
129
+ */
130
+ required: {
131
+ type: Boolean,
132
+ default: false
133
+ }
134
+ };
126
135
  const ActiveProps = {
127
136
  /**
128
137
  * Whether the item is active
@@ -373,6 +382,7 @@ const CheckboxRadioGroupProps = {
373
382
  ...ModifiersProps,
374
383
  ...LabelProps,
375
384
  ...LoadingProps,
385
+ ...RequiredProps,
376
386
  /**
377
387
  * Input value
378
388
  */
@@ -1059,6 +1069,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1059
1069
  computed(() => ({
1060
1070
  disabled: disabled.value,
1061
1071
  readonly: readonly.value,
1072
+ required: props.required,
1062
1073
  horizontal: !vertical.value,
1063
1074
  valid: valid.value,
1064
1075
  invalid: invalid.value
@@ -1069,7 +1080,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1069
1080
  id: `${props.name}_opt${index}`,
1070
1081
  name: props.name,
1071
1082
  label: getOptionLabel(option),
1072
- value: getOptionValue(option)
1083
+ value: getOptionValue(option),
1084
+ required: props.required
1073
1085
  };
1074
1086
  }
1075
1087
  const { HintSlot, hintSlotScope } = HintSlotFactory(propsDefaults, slots);
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@vueuse/core"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","@vueuse/core","ts-dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckboxGroup=t(e.vue,e.core,e.tsDotProp)}(this,(function(e,t,l){"use strict";var a=(e=>(e.local="local",e.session="session",e))(a||{}),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"),s={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},v={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},c={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},f={disabled:{type:Boolean,default:!1}},p=(Boolean,Boolean,Boolean,{label:{type:[String,Number],default:void 0}}),m={readonly:{type:Boolean,default:!1}},b={modifiers:{type:[String,Array],default:void 0}},h={hintLabel:{type:String,default:""}},y={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 g={tabindex:{type:[String,Number],default:0}},S={id:[String,Number]};o.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const k={...{...S,name:{type:String,required:!0}},...g,...s,...v,...h,...f,...m,...b,...p,...c,value:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[Object,Number,Boolean,String],default:void 0}},L={...s,...v,...y,...h,...f,...m,...b,...p,...c,modelValue:{type:[String,Array,Boolean,Number,Symbol],default:void 0},name:{type:String,required:!0},vertical:{type:Boolean,default:!1}};i.button,r.button,a.local;const B=L;function V(e,t,l){return x(e,t)}function x(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(!x(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],!x(e[i],t[i]))return!1;return!0}return Number.isNaN(e)&&Number.isNaN(t)}function O(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}function $(t,l){const a=e.computed((()=>e.isRef(t)?t.value:t)),o=e.computed((()=>O(a.value.invalidLabel))),n=e.computed((()=>O(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}))),p=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:p}}const A={...k,...b,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 N(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 w(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"],j=e.defineComponent({name:"VvCheckbox",props:A,emits:["click","update:modelValue","change","blur"],setup(t,{emit:l}){const a=t,o=l,n=e.useSlots(),i=N("VvCheckbox",A,a),{id:r,disabled:u,readonly:d,valid:s,invalid:v,propsSwitch:c,modelValue:f,indeterminate:p,isInGroup:m}=C(a,o),b=function(t){return e.computed((()=>String((null==t?void 0:t.value)||e.useId())))}(r),h=e.computed((()=>`${b.value}-hint`)),y=e.computed((()=>k.value?-1:a.tabindex)),g=e.ref(),S=e.computed((()=>void 0!==a.uncheckedValue&&!m.value)),k=e.computed((()=>u.value||d.value)),L=e.computed((()=>!0===v.value||!0!==s.value&&void 0)),B=e.computed((()=>S.value?f.value===a.value:Array.isArray(f.value)?function(e,t){if(null!=e&&t&&t.length)for(const l of t)if(V(e,l))return!0;return!1}(a.value,f.value):V(a.value,f.value))),x=e.computed((()=>!!p.value||!(B.value||!S.value||a.uncheckedValue===f.value))),O=e.computed((()=>{if(!S.value)return!["string","number","boolean"].includes(typeof a.value)||a.value})),j=e.computed({get:()=>B.value,set(e){if(S.value)f.value=e?a.value:a.uncheckedValue;else if(Array.isArray(f.value)||m.value){const t=f.value??[],l=new Set(Array.isArray(t)?t:[t]);e?l.add(a.value):l.delete(a.value),f.value=[...l]}else f.value=e?a.value:void 0;o("change",e)}}),{modifiers:_}=e.toRefs(a),z=w("vv-checkbox",_,e.computed((()=>({switch:c.value,valid:s.value,invalid:v.value,disabled:u.value,readonly:d.value,indeterminate:p.value}))));e.watchEffect((()=>{S.value&&Array.isArray(f.value)&&console.warn("[VvCheckbox] The model value is an array but the component is in binary mode.")})),e.watch((()=>x.value),(e=>{g.value.indeterminate=!!e})),e.onMounted((()=>{x.value&&(g.value.indeterminate=!0)}));const{HintSlot:E,hasHintLabelOrSlot:G,hasInvalidLabelOrSlot:I,hintSlotScope:D}=$(i,n);return(t,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(z)),for:e.unref(b)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(b),ref_key:"input",ref:g,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(j)?j.value=t:null),type:"checkbox",class:"vv-checkbox__input",name:t.name,disabled:e.unref(k),value:e.unref(O),tabindex:e.unref(y),"aria-invalid":e.unref(L),"aria-describedby":e.unref(G)?e.unref(h):void 0,"aria-errormessage":e.unref(I)?e.unref(h):void 0},null,8,R),[[e.vModelCheckbox,e.unref(j)]]),e.renderSlot(t.$slots,"default",{value:e.unref(f)},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)])),e.createVNode(e.unref(E),{id:e.unref(h),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(D))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(D))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(D))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(D))))])),key:"3"}:void 0]),1032,["id"])],10,P))}});const _=["textContent"],z={class:"vv-checkbox-group__wrapper"};return e.defineComponent({name:"VvCheckboxGroup",props:B,emits:["update:modelValue","change"],setup(a,{emit:o}){const n=a,i=o,r=e.useSlots(),u=N("VvCheckboxGroup",B,n),s=t.useVModel(n,"modelValue",i),{disabled:v,readonly:c,vertical:f,valid:p,invalid:m,modifiers:b}=e.toRefs(n);var h,y;h=d,y={modelValue:s,disabled:v,readonly:c,valid:p,invalid:m},e.provide(h,y);const{getOptionLabel:g,getOptionValue:S}=function(t){const{options:a,labelKey:o,valueKey:n,disabledKey:i}=e.toRefs(t);return{options:a,getOptionLabel:e=>"string"==typeof e?e:"function"==typeof o.value?o.value(e):String(o.value?l.get(e,o.value):e),getOptionValue:e=>"string"==typeof e?e:"function"==typeof n.value?n.value(e):n.value?l.get(e,n.value):e,isOptionDisabled:e=>"string"!=typeof e&&("function"==typeof i.value?i.value(e):!!i.value&&l.get(e,i.value)),getOptionGrouped:e=>"string"==typeof e?[]:"object"==typeof e&&e&&"options"in e?e.options:[]}}(n),k=w("vv-checkbox-group",b,e.computed((()=>({disabled:v.value,readonly:c.value,horizontal:!f.value,valid:p.value,invalid:m.value}))));const{HintSlot:L,hintSlotScope:V}=$(u,r);return(t,l)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(k))},[t.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(t.label)},null,8,_)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",z,[t.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.options,((t,l)=>(e.openBlock(),e.createBlock(j,e.mergeProps({key:l,ref_for:!0},function(e,t){return{id:`${n.name}_opt${t}`,name:n.name,label:g(e),value:S(e)}}(t,l)),null,16)))),128)):e.renderSlot(t.$slots,"default",{key:1})]),e.createVNode(e.unref(L),{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("@vueuse/core"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","@vueuse/core","ts-dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckboxGroup=t(e.vue,e.core,e.tsDotProp)}(this,(function(e,t,l){"use strict";var a=(e=>(e.local="local",e.session="session",e))(a||{}),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"),s={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},v={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},c={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},f={disabled:{type:Boolean,default:!1}},p={required:{type:Boolean,default:!1}},m=(Boolean,Boolean,Boolean,{label:{type:[String,Number],default:void 0}}),b={readonly:{type:Boolean,default:!1}},h={modifiers:{type:[String,Array],default:void 0}},y={hintLabel:{type:String,default:""}},g={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 S={tabindex:{type:[String,Number],default:0}},k={id:[String,Number]};o.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const L={...{...k,name:{type:String,required:!0}},...S,...s,...v,...y,...f,...b,...h,...m,...c,value:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[Object,Number,Boolean,String],default:void 0}},B={...s,...v,...g,...y,...f,...b,...h,...m,...c,...p,modelValue:{type:[String,Array,Boolean,Number,Symbol],default:void 0},name:{type:String,required:!0},vertical:{type:Boolean,default:!1}};i.button,r.button,a.local;const V=B;function x(e,t,l){return O(e,t)}function O(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(!O(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],!O(e[i],t[i]))return!1;return!0}return Number.isNaN(e)&&Number.isNaN(t)}function $(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}function A(t,l){const a=e.computed((()=>e.isRef(t)?t.value:t)),o=e.computed((()=>$(a.value.invalidLabel))),n=e.computed((()=>$(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}))),p=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:p}}const C={...L,...h,indeterminate:Boolean,uncheckedValue:[String,Number,Boolean],switch:Boolean};function N(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 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"],j=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"],_=e.defineComponent({name:"VvCheckbox",props:C,emits:["click","update:modelValue","change","blur"],setup(t,{emit:l}){const a=t,o=l,n=e.useSlots(),i=w("VvCheckbox",C,a),{id:r,disabled:u,readonly:d,valid:s,invalid:v,propsSwitch:c,modelValue:f,indeterminate:p,isInGroup:m}=N(a,o),b=function(t){return e.computed((()=>String((null==t?void 0:t.value)||e.useId())))}(r),h=e.computed((()=>`${b.value}-hint`)),y=e.computed((()=>k.value?-1:a.tabindex)),g=e.ref(),S=e.computed((()=>void 0!==a.uncheckedValue&&!m.value)),k=e.computed((()=>u.value||d.value)),L=e.computed((()=>!0===v.value||!0!==s.value&&void 0)),B=e.computed((()=>S.value?f.value===a.value:Array.isArray(f.value)?function(e,t){if(null!=e&&t&&t.length)for(const l of t)if(x(e,l))return!0;return!1}(a.value,f.value):x(a.value,f.value))),V=e.computed((()=>!!p.value||!(B.value||!S.value||a.uncheckedValue===f.value))),O=e.computed((()=>{if(!S.value)return!["string","number","boolean"].includes(typeof a.value)||a.value})),$=e.computed({get:()=>B.value,set(e){if(S.value)f.value=e?a.value:a.uncheckedValue;else if(Array.isArray(f.value)||m.value){const t=f.value??[],l=new Set(Array.isArray(t)?t:[t]);e?l.add(a.value):l.delete(a.value),f.value=[...l]}else f.value=e?a.value:void 0;o("change",e)}}),{modifiers:_}=e.toRefs(a),z=P("vv-checkbox",_,e.computed((()=>({switch:c.value,valid:s.value,invalid:v.value,disabled:u.value,readonly:d.value,indeterminate:p.value}))));e.watchEffect((()=>{S.value&&Array.isArray(f.value)&&console.warn("[VvCheckbox] The model value is an array but the component is in binary mode.")})),e.watch((()=>V.value),(e=>{g.value.indeterminate=!!e})),e.onMounted((()=>{V.value&&(g.value.indeterminate=!0)}));const{HintSlot:E,hasHintLabelOrSlot:G,hasInvalidLabelOrSlot:q,hintSlotScope:I}=A(i,n);return(t,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(z)),for:e.unref(b)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(b),ref_key:"input",ref:g,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef($)?$.value=t:null),type:"checkbox",class:"vv-checkbox__input",name:t.name,disabled:e.unref(k),value:e.unref(O),tabindex:e.unref(y),"aria-invalid":e.unref(L),"aria-describedby":e.unref(G)?e.unref(h):void 0,"aria-errormessage":e.unref(q)?e.unref(h):void 0},null,8,j),[[e.vModelCheckbox,e.unref($)]]),e.renderSlot(t.$slots,"default",{value:e.unref(f)},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)])),e.createVNode(e.unref(E),{id:e.unref(h),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(I))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(I))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(I))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(I))))])),key:"3"}:void 0]),1032,["id"])],10,R))}});const z=["textContent"],E={class:"vv-checkbox-group__wrapper"};return e.defineComponent({name:"VvCheckboxGroup",props:V,emits:["update:modelValue","change"],setup(a,{emit:o}){const n=a,i=o,r=e.useSlots(),u=w("VvCheckboxGroup",V,n),s=t.useVModel(n,"modelValue",i),{disabled:v,readonly:c,vertical:f,valid:p,invalid:m,modifiers:b}=e.toRefs(n);var h,y;h=d,y={modelValue:s,disabled:v,readonly:c,valid:p,invalid:m},e.provide(h,y);const{getOptionLabel:g,getOptionValue:S}=function(t){const{options:a,labelKey:o,valueKey:n,disabledKey:i}=e.toRefs(t);return{options:a,getOptionLabel:e=>"string"==typeof e?e:"function"==typeof o.value?o.value(e):String(o.value?l.get(e,o.value):e),getOptionValue:e=>"string"==typeof e?e:"function"==typeof n.value?n.value(e):n.value?l.get(e,n.value):e,isOptionDisabled:e=>"string"!=typeof e&&("function"==typeof i.value?i.value(e):!!i.value&&l.get(e,i.value)),getOptionGrouped:e=>"string"==typeof e?[]:"object"==typeof e&&e&&"options"in e?e.options:[]}}(n),k=P("vv-checkbox-group",b,e.computed((()=>({disabled:v.value,readonly:c.value,required:n.required,horizontal:!f.value,valid:p.value,invalid:m.value}))));const{HintSlot:L,hintSlotScope:B}=A(u,r);return(t,l)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(k))},[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(_,e.mergeProps({key:l,ref_for:!0},function(e,t){return{id:`${n.name}_opt${t}`,name:n.name,label:g(e),value:S(e),required:n.required}}(t,l)),null,16)))),128)):e.renderSlot(t.$slots,"default",{key:1})]),e.createVNode(e.unref(L),{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(B))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(B))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(B))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(B))))])),key:"3"}:void 0]),1024)],2))}})}));
@@ -12,6 +12,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<gl
12
12
  type: BooleanConstructor;
13
13
  default: boolean;
14
14
  };
15
+ required: {
16
+ type: BooleanConstructor;
17
+ default: boolean;
18
+ };
15
19
  loading: {
16
20
  type: BooleanConstructor;
17
21
  default: boolean;
@@ -85,6 +89,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<gl
85
89
  type: BooleanConstructor;
86
90
  default: boolean;
87
91
  };
92
+ required: {
93
+ type: BooleanConstructor;
94
+ default: boolean;
95
+ };
88
96
  loading: {
89
97
  type: BooleanConstructor;
90
98
  default: boolean;
@@ -150,6 +158,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<gl
150
158
  disabled: boolean;
151
159
  modelValue: string | number | boolean | symbol | unknown[];
152
160
  modifiers: string | string[];
161
+ required: boolean;
153
162
  loading: boolean;
154
163
  loadingLabel: string;
155
164
  readonly: boolean;
@@ -11,6 +11,10 @@ export declare const VvCheckboxGroupProps: {
11
11
  type: BooleanConstructor;
12
12
  default: boolean;
13
13
  };
14
+ required: {
15
+ type: BooleanConstructor;
16
+ default: boolean;
17
+ };
14
18
  loading: {
15
19
  type: BooleanConstructor;
16
20
  default: boolean;