@volverjs/ui-vue 0.0.9 → 0.0.10-beta.2

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 (42) hide show
  1. package/README.md +64 -1
  2. package/auto-imports.d.ts +1 -1
  3. package/bin/icons.cjs +1 -1
  4. package/bin/icons.js +13 -5
  5. package/dist/components/VvAccordion/index.d.ts +1 -1
  6. package/dist/components/VvButton/VvButton.es.js +3 -3
  7. package/dist/components/VvCheckbox/VvCheckbox.es.js +3 -3
  8. package/dist/components/VvCheckbox/index.d.ts +1 -1
  9. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +5 -5
  10. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  11. package/dist/components/VvCombobox/VvCombobox.es.js +21 -32
  12. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  13. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +66 -66
  14. package/dist/components/VvCombobox/index.d.ts +22 -22
  15. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +156 -156
  16. package/dist/components/VvDropdown/index.d.ts +22 -22
  17. package/dist/components/VvRadio/VvRadio.es.js +3 -3
  18. package/dist/components/VvRadio/index.d.ts +1 -1
  19. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +5 -5
  20. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  21. package/dist/components/VvSelect/VvSelect.es.js +6 -6
  22. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  23. package/dist/components/index.es.js +21 -32
  24. package/dist/components/index.umd.js +1 -1
  25. package/dist/composables/group/useInjectedGroupState.d.ts +1 -1
  26. package/dist/composables/useOptions.d.ts +1 -1
  27. package/dist/icons.es.js +3 -3
  28. package/dist/icons.umd.js +1 -1
  29. package/dist/props/index.d.ts +22 -22
  30. package/dist/stories/Combobox/ComboboxOptions.stories.d.ts +1 -0
  31. package/dist/stories/InputText/InputTextMask.stories.d.ts +1 -1
  32. package/package.json +8 -7
  33. package/src/assets/icons/detailed.json +1 -1
  34. package/src/assets/icons/normal.json +1 -1
  35. package/src/assets/icons/simple.json +1 -1
  36. package/src/components/VvCombobox/VvCombobox.vue +13 -25
  37. package/src/components/VvSelect/VvSelect.vue +4 -4
  38. package/src/composables/useOptions.ts +2 -2
  39. package/src/stories/Button/ButtonModifiers.stories.ts +4 -14
  40. package/src/stories/Combobox/ComboboxOptions.stories.ts +18 -0
  41. package/src/stories/InputText/InputTextMask.stories.ts +1 -1
  42. package/src/utils/ObjectUtilities.ts +3 -2
package/README.md CHANGED
@@ -68,7 +68,7 @@ app.use(VolverPlugin, {
68
68
  * if you want can import components globally
69
69
  * components: { VvButton, VvInputText }
70
70
  */
71
- compoments: undefined,
71
+ components: undefined,
72
72
  /*
73
73
  * if you want can import directives globally
74
74
  * directives: { toolip: VTooltip }
@@ -158,6 +158,69 @@ export default defineConfig({
158
158
  })
159
159
  ```
160
160
 
161
+ ## Composables
162
+
163
+ `@volverjs/ui-vue`utility composables
164
+
165
+ ### useAlert
166
+
167
+ Used to show alert messages and notifications
168
+
169
+ ```typescript
170
+ export type AlertModifiers =
171
+ | 'success'
172
+ | 'info'
173
+ | 'warning'
174
+ | 'danger'
175
+ | 'brand'
176
+ | 'accent'
177
+ ```
178
+
179
+ ```typescript
180
+ export type Alert = {
181
+ id: string | number
182
+ group: string
183
+ title?: string
184
+ icon: string | Record<string, unknown>
185
+ content?: string
186
+ footer?: string
187
+ modifiers: AlertModifiers
188
+ dismissable: boolean
189
+ autoClose: number
190
+ timestamp: number
191
+ }
192
+ ```
193
+
194
+ ##### Usage
195
+
196
+ ```typescript
197
+ import { useAlert } from '@volverjs/ui-vue/composables'
198
+
199
+ const { addAlert, removeAlert, alerts } = useAlert()
200
+
201
+ function showSuccess() {
202
+ addAlert({
203
+ title: 'Success!',
204
+ modifiers: 'success'
205
+ })
206
+ }
207
+ ```
208
+
209
+ ```html
210
+ <vv-alert-group name="alert-group" :items="alerts" @close="removeAlert" />
211
+
212
+ <div class="flex gap-md">
213
+ <vv-button
214
+ label="Show success"
215
+ modifiers="secondary"
216
+ @click="showSuccess"
217
+ class="mb-lg"
218
+ />
219
+ </div>
220
+ ```
221
+
222
+ ###
223
+
161
224
  ## Roadmap
162
225
 
163
226
  The following features are planned for the next releases:
package/auto-imports.d.ts CHANGED
@@ -312,5 +312,5 @@ declare global {
312
312
  // for type re-export
313
313
  declare global {
314
314
  // @ts-ignore
315
- export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode } from 'vue'
315
+ export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
316
316
  }
package/bin/icons.cjs CHANGED
@@ -1 +1 @@
1
- !function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("fs"),require("yargs"),require("yargs/helpers"),require("@iconify/tools"),require("path"),require("@iconify/utils")):"function"==typeof define&&define.amd?define(["exports","fs","yargs","yargs/helpers","@iconify/tools","path","@iconify/utils"],o):o((e="undefined"!=typeof globalThis?globalThis:e||self)["generate-icons"]={},e.fileSystem,e.yargs,e.helpers,e.tools,e.path,e.utils)}(this,(function(e,o,t,r,n,i,s){"use strict";function c(e,t="iconify",r={}){return o.readdirSync(e).forEach((function(n){o.statSync(e+"/"+n).isDirectory()?r=c(e+"/"+n,n,r):n.includes(".svg")&&(r[t]?r[t].push(i.join(e,"/",n)):r[t]=[i.join(e,"/",n)])})),r}function a(e,t,r){const i=c(e,r);Object.keys(i).length?Object.keys(i).forEach((e=>{!async function(e,t,r){const i=n.blankIconSet(e);for(const s of t){const e=await o.promises.readFile(s,{encoding:"utf-8"}),t=new n.SVG(e);await n.cleanupSVG(t),await n.parseColors(t,{defaultColor:"currentColor",callback:(e,o,t)=>!t||n.isEmptyColor(t)?o:"currentColor"}),await n.runSVGO(t);const r=s.replace(/^.*[\\/]/,"").split(".")[0].replace(/ /g,"-").replace(/[^a-z0-9-]/gi,"");i.fromSVG(r,t)}const c=i.export();try{s.validateIconSet(c)}catch(a){throw new Error(`Icon set is not valid: ${null==a?void 0:a.message}`)}o.writeFileSync(`${r}/${c.prefix}.json`,JSON.stringify(c))}(e,i[e],t),console.info(`Icons generated in: ${t}/${e}.json\n`)})):console.error(`There are no files in ${e}`)}const l=t(r.hideBin(process.argv)).argv,f=l.srcPath,u=l.destPath||f;f&&u||(console.error("Please specify the srcPath and destPath with --srcPath and --destPath"),process.exit()),a(f,u,l.prefix),e.createIconifyJsonFiles=a,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
1
+ !function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("fs"),require("yargs"),require("yargs/helpers"),require("@iconify/tools"),require("path"),require("@iconify/utils"),require("chokidar")):"function"==typeof define&&define.amd?define(["exports","fs","yargs","yargs/helpers","@iconify/tools","path","@iconify/utils","chokidar"],o):o((e="undefined"!=typeof globalThis?globalThis:e||self)["generate-icons"]={},e.fileSystem,e.yargs,e.helpers,e.tools,e.path,e.utils,e.chokidar)}(this,(function(e,o,r,i,t,n,s,c){"use strict";function a(e,r="iconify",i={}){return o.readdirSync(e).forEach((function(t){o.statSync(e+"/"+t).isDirectory()?i=a(e+"/"+t,t,i):t.includes(".svg")&&(i[r]?i[r].push(n.join(e,"/",t)):i[r]=[n.join(e,"/",t)])})),i}function l(e,r,i){const c=a(e,i);Object.keys(c).length?Object.keys(c).forEach((e=>{!async function(e,r,i){const c=t.blankIconSet(e);for(const n of r){const e=await o.promises.readFile(n,{encoding:"utf-8"}),r=new t.SVG(e);await t.cleanupSVG(r),await t.parseColors(r,{defaultColor:"currentColor",callback:(e,o,r)=>!r||t.isEmptyColor(r)?o:"currentColor"}),await t.runSVGO(r);const i=n.replace(/^.*[\\/]/,"").split(".")[0].replace(/ /g,"-").replace(/[^a-z0-9-]/gi,"");c.fromSVG(i,r)}const a=c.export();try{s.validateIconSet(a)}catch(f){throw new Error(`Icon set is not valid: ${null==f?void 0:f.message}`)}const l=`${i}/${a.prefix}.json`;o.mkdirSync(n.dirname(l),{recursive:!0}),o.writeFileSync(l,JSON.stringify(a))}(e,c[e],r),console.info(`Icons generated in: ${r}/${e}.json\n`)})):console.error(`There are no files in ${e}`)}const f=r(i.hideBin(process.argv)).argv,d=f.srcPath,u=f.destPath||d;d&&u||(console.error("Please specify the srcPath and destPath with --srcPath and --destPath"),process.exit()),f.watch?c.watch(d).on("add",(()=>{l(d,u,f.prefix)})).on("change",(()=>{l(d,u,f.prefix)})):l(d,u,f.prefix),e.createIconifyJsonFiles=l,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
package/bin/icons.js CHANGED
@@ -4,6 +4,7 @@ import { hideBin } from "yargs/helpers";
4
4
  import { blankIconSet, SVG, cleanupSVG, parseColors, isEmptyColor, runSVGO } from "@iconify/tools";
5
5
  import path from "path";
6
6
  import { validateIconSet } from "@iconify/utils";
7
+ import chokidar from "chokidar";
7
8
  function getAllFiles(dirPath, prefix = "iconify", objectFiles = {}) {
8
9
  const files = fileSystem.readdirSync(dirPath);
9
10
  files.forEach(function(file) {
@@ -43,10 +44,9 @@ async function generateIcons(prefix, files, destPath2) {
43
44
  `Icon set is not valid: ${error == null ? void 0 : error.message}`
44
45
  );
45
46
  }
46
- fileSystem.writeFileSync(
47
- `${destPath2}/${iconifyJson.prefix}.json`,
48
- JSON.stringify(iconifyJson)
49
- );
47
+ const filename = `${destPath2}/${iconifyJson.prefix}.json`;
48
+ fileSystem.mkdirSync(path.dirname(filename), { recursive: true });
49
+ fileSystem.writeFileSync(filename, JSON.stringify(iconifyJson));
50
50
  }
51
51
  function createIconifyJsonFiles(srcPath2, destPath2, prefix) {
52
52
  const objectFiles = getAllFiles(srcPath2, prefix);
@@ -69,7 +69,15 @@ if (!srcPath || !destPath) {
69
69
  );
70
70
  process.exit();
71
71
  }
72
- createIconifyJsonFiles(srcPath, destPath, argv.prefix);
72
+ if (argv.watch) {
73
+ chokidar.watch(srcPath).on("add", () => {
74
+ createIconifyJsonFiles(srcPath, destPath, argv.prefix);
75
+ }).on("change", () => {
76
+ createIconifyJsonFiles(srcPath, destPath, argv.prefix);
77
+ });
78
+ } else {
79
+ createIconifyJsonFiles(srcPath, destPath, argv.prefix);
80
+ }
73
81
  export {
74
82
  createIconifyJsonFiles
75
83
  };
@@ -36,7 +36,7 @@ export type VvAccordionPropsTypes = ExtractPropTypes<typeof VvAccordionProps>;
36
36
  * Merges local and group props
37
37
  */
38
38
  export declare function useGroupProps(props: VvAccordionPropsTypes, emit: (event: string, value: unknown) => void): {
39
- modelValue: import("vue").WritableComputedRef<any>;
39
+ modelValue: globalThis.WritableComputedRef<any>;
40
40
  not: Ref<boolean>;
41
41
  isInGroup: globalThis.ComputedRef<boolean>;
42
42
  group: Ref<AccordionGroupState> | undefined;
@@ -605,10 +605,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
605
605
  }
606
606
  });
607
607
  function equals(obj1, obj2, field) {
608
- if (field)
608
+ if (field) {
609
609
  return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
610
- else
611
- return deepEquals(obj1, obj2);
610
+ }
611
+ return deepEquals(obj1, obj2);
612
612
  }
613
613
  function deepEquals(a, b) {
614
614
  if (a === b)
@@ -316,10 +316,10 @@ const CheckboxRadioProps = {
316
316
  }
317
317
  });
318
318
  function equals(obj1, obj2, field) {
319
- if (field)
319
+ if (field) {
320
320
  return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
321
- else
322
- return deepEquals(obj1, obj2);
321
+ }
322
+ return deepEquals(obj1, obj2);
323
323
  }
324
324
  function deepEquals(a, b) {
325
325
  if (a === b)
@@ -53,7 +53,7 @@ export declare function useGroupProps(props: VvCheckboxPropsTypes, emit: (event:
53
53
  indeterminate: Ref<boolean>;
54
54
  group: Ref<InputGroupState> | undefined;
55
55
  isInGroup: globalThis.ComputedRef<boolean>;
56
- modelValue: import("vue").WritableComputedRef<any>;
56
+ modelValue: globalThis.WritableComputedRef<any>;
57
57
  valid: Ref<boolean>;
58
58
  invalid: Ref<boolean>;
59
59
  readonly: globalThis.ComputedRef<boolean>;
@@ -46,10 +46,10 @@ var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
46
46
  const INJECTION_KEY_VOLVER = Symbol.for("volver");
47
47
  const INJECTION_KEY_CHECK_GROUP = Symbol.for("checkGroup");
48
48
  function equals(obj1, obj2, field) {
49
- if (field)
49
+ if (field) {
50
50
  return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
51
- else
52
- return deepEquals(obj1, obj2);
51
+ }
52
+ return deepEquals(obj1, obj2);
53
53
  }
54
54
  function deepEquals(a, b) {
55
55
  if (a === b)
@@ -944,7 +944,7 @@ function useOptions(props) {
944
944
  return option;
945
945
  return typeof valueKey.value === "function" ? valueKey.value(option) : get(option, valueKey.value);
946
946
  };
947
- const getOptionDisabled = (option) => {
947
+ const isOptionDisabled = (option) => {
948
948
  if (typeof option !== "object" && option !== null)
949
949
  return false;
950
950
  return typeof disabledKey.value === "function" ? disabledKey.value(option) : get(option, disabledKey.value);
@@ -958,7 +958,7 @@ function useOptions(props) {
958
958
  options,
959
959
  getOptionLabel,
960
960
  getOptionValue,
961
- getOptionDisabled,
961
+ isOptionDisabled,
962
962
  getOptionGrouped
963
963
  };
964
964
  }
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("nanoid"),require("@vueuse/core"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","nanoid","@vueuse/core","ts-dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckboxGroup=t(e.vue,e.nanoid,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||{});const r=Symbol.for("volver"),u=Symbol.for("checkGroup");function d(e,t,l){return l?v(e,l)===v(t,l):s(e,t)}function s(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(!s(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,v=t instanceof RegExp;if(d!=v)return!1;if(d&&v)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],!s(e[i],t[i]))return!1;return!0}return e!=e&&t!=t}function v(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 c(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}function f(t,l){const a=e.computed((()=>e.isRef(t)?t.value:t)),o=e.computed((()=>c(a.value.invalidLabel))),n=e.computed((()=>c(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))),f=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}))),m=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:f,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:m}}const p={valid:Boolean,validLabel:[String,Array]},m={invalid:Boolean,invalidLabel:[String,Array]},b={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},h={disabled:Boolean},g=(Boolean,Boolean,{label:[String,Number]}),y={readonly:Boolean},S={modifiers:[String,Array]},k={hintLabel:{type:String,default:""}},L={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 B={tabindex:{type:[String,Number],default:0}},O={id:[String,Number]};o.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const V={...{...O,name:{type:String,required:!0}},...B,...p,...m,...k,...h,...y,...S,...g,...b,value:[String,Number,Boolean],modelValue:[Object,Number,Boolean,String]},x={...p,...m,...L,...k,...h,...y,...S,...g,...b,modelValue:[String,Array,Boolean,Number,Symbol],name:{type:String,required:!0},vertical:Boolean};function $(t){const l=e.inject(t,void 0),a=e.computed((()=>{return t=l,!(null==(a=e.unref(t))||""===a||Array.isArray(a)&&0===a.length||!(a instanceof Date)&&"object"==typeof a&&0===Object.keys(a).length);var t,a}));return{group:l,isInGroup:a,getGroupOrLocalRef:function(t,a,o){if(null==l?void 0:l.value){const a=e.unref(l.value)[t];return e.computed({get:()=>null==a?void 0:a.value,set(e){a.value=e}})}const n=e.toRef(a,t);return e.computed({get:()=>n.value,set(e){o&&o(`update:${t}`,e)}})}}}i.button;const A={...V,...S,indeterminate:Boolean,uncheckedValue:[String,Number,Boolean],switch:Boolean};function C(t,l,a){const o=e.inject(r),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 w=["for"],R=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"],P=e.defineComponent({name:"VvCheckbox",props:A,emits:["click","update:modelValue","change","blur"],setup(l,{emit:a}){const o=l,n=e.useSlots(),i=C("VvCheckbox",A,o),{id:r,disabled:s,readonly:v,valid:c,invalid:p,propsSwitch:m,modelValue:b,indeterminate:h,isInGroup:g}=function(t,l){const{group:a,isInGroup:o,getGroupOrLocalRef:n}=$(u),{id:i,switch:r,indeterminate:d}=e.toRefs(t),s=n("modelValue",t,l),v=n("valid",t),c=n("invalid",t),f=e.computed((()=>{var e;return Boolean(t.readonly||(null==(e=null==a?void 0:a.value)?void 0:e.readonly.value))})),p=e.computed((()=>{var e;return Boolean(t.disabled||(null==(e=null==a?void 0:a.value)?void 0:e.disabled.value))}));return{id:i,propsSwitch:r,indeterminate:d,group:a,isInGroup:o,modelValue:s,valid:v,invalid:c,readonly:f,disabled:p}}(o,a),y=(l=>e.computed((()=>String((null==l?void 0:l.value)||t.nanoid()))))(r),S=e.computed((()=>`${y.value}-hint`)),k=e.computed((()=>O.value?-1:o.tabindex)),L=e.ref(),B=e.computed((()=>void 0!==o.uncheckedValue&&!g.value)),O=e.computed((()=>s.value||v.value)),V=e.computed((()=>!0===p.value||!0!==c.value&&void 0)),x=e.computed((()=>B.value?b.value===o.value:Array.isArray(b.value)?function(e,t){if(null!=e&&t&&t.length)for(const l of t)if(d(e,l))return!0;return!1}(o.value,b.value):d(o.value,b.value))),P=e.computed((()=>!!h.value||!(x.value||!B.value||o.uncheckedValue===b.value))),N=e.computed((()=>{if(!B.value)return!["string","number","boolean"].includes(typeof o.value)||o.value})),E=e.computed({get:()=>x.value,set(e){if(B.value)b.value=e?o.value:o.uncheckedValue;else if(Array.isArray(b.value)||g.value){const t=new Set(Array.isArray(b.value)?b.value:void 0!==b.value?[b.value]:[]);e?t.add(o.value):t.delete(o.value),b.value=[...t]}else b.value=e?o.value:void 0;a("change",e)}}),{modifiers:_}=e.toRefs(o),z=j("vv-checkbox",_,e.computed((()=>({switch:m.value,valid:c.value,invalid:p.value,disabled:s.value,readonly:v.value,indeterminate:h.value}))));e.watchEffect((()=>{B.value&&Array.isArray(b.value)&&console.warn("[VvCheckbox] The model value is an array but the component is in binary mode.")})),e.watch((()=>P.value),(e=>{L.value.indeterminate=!!e})),e.onMounted((()=>{P.value&&(L.value.indeterminate=!0)}));const{HintSlot:G,hasHintLabelOrSlot:I,hasInvalidLabelOrSlot:D,hintSlotScope:H}=f(i,n);return(t,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(z)),for:e.unref(y)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(y),ref_key:"input",ref:L,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(E)?E.value=t:null),type:"checkbox",class:"vv-checkbox__input",name:t.name,disabled:e.unref(O),value:e.unref(N),tabindex:e.unref(k),"aria-invalid":e.unref(V),"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)]]),e.renderSlot(t.$slots,"default",{value:e.unref(b)},(()=>[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,w))}}),N=x;const E=["textContent"],_={class:"vv-checkbox-group__wrapper"};return e.defineComponent({name:"VvCheckboxGroup",props:N,emits:["update:modelValue","change"],setup(t,{emit:o}){const n=t,i=e.useSlots(),r=C("VvCheckboxGroup",N,n),d=l.useVModel(n,"modelValue",o),{disabled:s,readonly:v,vertical:c,valid:p,invalid:m,modifiers:b}=e.toRefs(n);!function(t){if(Object.keys(t).some((l=>"key"!==l&&!e.isRef(t[l]))))throw Error("One or more groupState props aren't ref.");e.provide(t.key,e.computed((()=>t)))}({key:u,modelValue:d,disabled:s,readonly:v,valid:p,invalid:m});const{getOptionLabel:h,getOptionValue:g}=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),getOptionDisabled: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),y=j("vv-checkbox-group",b,e.computed((()=>({disabled:s.value,readonly:v.value,horizontal:!c.value,valid:p.value,invalid:m.value})))),{HintSlot:S,hintSlotScope:k}=f(r,i);return(t,l)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(y))},[t.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(t.label)},null,8,E)):e.createCommentVNode("",!0),e.createElementVNode("div",_,[t.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.options,((t,l)=>(e.openBlock(),e.createBlock(P,e.mergeProps({key:l},((e,t)=>({id:`${n.name}_opt${t}`,name:n.name,label:h(e),value:g(e)}))(t,l)),null,16)))),128)):e.renderSlot(t.$slots,"default",{key:1})]),e.createVNode(e.unref(S),{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(k))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"3"}:void 0]),1024)],2))}})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("nanoid"),require("@vueuse/core"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","nanoid","@vueuse/core","ts-dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckboxGroup=t(e.vue,e.nanoid,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||{});const r=Symbol.for("volver"),u=Symbol.for("checkGroup");function d(e,t,l){return l?v(e,l)===v(t,l):s(e,t)}function s(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(!s(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,v=t instanceof RegExp;if(d!=v)return!1;if(d&&v)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],!s(e[i],t[i]))return!1;return!0}return e!=e&&t!=t}function v(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 c(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}function f(t,l){const a=e.computed((()=>e.isRef(t)?t.value:t)),o=e.computed((()=>c(a.value.invalidLabel))),n=e.computed((()=>c(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))),f=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}))),m=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:f,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:m}}const p={valid:Boolean,validLabel:[String,Array]},m={invalid:Boolean,invalidLabel:[String,Array]},b={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},h={disabled:Boolean},g=(Boolean,Boolean,{label:[String,Number]}),y={readonly:Boolean},S={modifiers:[String,Array]},k={hintLabel:{type:String,default:""}},L={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 B={tabindex:{type:[String,Number],default:0}},O={id:[String,Number]};o.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const V={...{...O,name:{type:String,required:!0}},...B,...p,...m,...k,...h,...y,...S,...g,...b,value:[String,Number,Boolean],modelValue:[Object,Number,Boolean,String]},x={...p,...m,...L,...k,...h,...y,...S,...g,...b,modelValue:[String,Array,Boolean,Number,Symbol],name:{type:String,required:!0},vertical:Boolean};function $(t){const l=e.inject(t,void 0),a=e.computed((()=>{return t=l,!(null==(a=e.unref(t))||""===a||Array.isArray(a)&&0===a.length||!(a instanceof Date)&&"object"==typeof a&&0===Object.keys(a).length);var t,a}));return{group:l,isInGroup:a,getGroupOrLocalRef:function(t,a,o){if(null==l?void 0:l.value){const a=e.unref(l.value)[t];return e.computed({get:()=>null==a?void 0:a.value,set(e){a.value=e}})}const n=e.toRef(a,t);return e.computed({get:()=>n.value,set(e){o&&o(`update:${t}`,e)}})}}}i.button;const A={...V,...S,indeterminate:Boolean,uncheckedValue:[String,Number,Boolean],switch:Boolean};function C(t,l,a){const o=e.inject(r),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 w=["for"],R=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"],P=e.defineComponent({name:"VvCheckbox",props:A,emits:["click","update:modelValue","change","blur"],setup(l,{emit:a}){const o=l,n=e.useSlots(),i=C("VvCheckbox",A,o),{id:r,disabled:s,readonly:v,valid:c,invalid:p,propsSwitch:m,modelValue:b,indeterminate:h,isInGroup:g}=function(t,l){const{group:a,isInGroup:o,getGroupOrLocalRef:n}=$(u),{id:i,switch:r,indeterminate:d}=e.toRefs(t),s=n("modelValue",t,l),v=n("valid",t),c=n("invalid",t),f=e.computed((()=>{var e;return Boolean(t.readonly||(null==(e=null==a?void 0:a.value)?void 0:e.readonly.value))})),p=e.computed((()=>{var e;return Boolean(t.disabled||(null==(e=null==a?void 0:a.value)?void 0:e.disabled.value))}));return{id:i,propsSwitch:r,indeterminate:d,group:a,isInGroup:o,modelValue:s,valid:v,invalid:c,readonly:f,disabled:p}}(o,a),y=(l=>e.computed((()=>String((null==l?void 0:l.value)||t.nanoid()))))(r),S=e.computed((()=>`${y.value}-hint`)),k=e.computed((()=>O.value?-1:o.tabindex)),L=e.ref(),B=e.computed((()=>void 0!==o.uncheckedValue&&!g.value)),O=e.computed((()=>s.value||v.value)),V=e.computed((()=>!0===p.value||!0!==c.value&&void 0)),x=e.computed((()=>B.value?b.value===o.value:Array.isArray(b.value)?function(e,t){if(null!=e&&t&&t.length)for(const l of t)if(d(e,l))return!0;return!1}(o.value,b.value):d(o.value,b.value))),P=e.computed((()=>!!h.value||!(x.value||!B.value||o.uncheckedValue===b.value))),N=e.computed((()=>{if(!B.value)return!["string","number","boolean"].includes(typeof o.value)||o.value})),E=e.computed({get:()=>x.value,set(e){if(B.value)b.value=e?o.value:o.uncheckedValue;else if(Array.isArray(b.value)||g.value){const t=new Set(Array.isArray(b.value)?b.value:void 0!==b.value?[b.value]:[]);e?t.add(o.value):t.delete(o.value),b.value=[...t]}else b.value=e?o.value:void 0;a("change",e)}}),{modifiers:_}=e.toRefs(o),z=j("vv-checkbox",_,e.computed((()=>({switch:m.value,valid:c.value,invalid:p.value,disabled:s.value,readonly:v.value,indeterminate:h.value}))));e.watchEffect((()=>{B.value&&Array.isArray(b.value)&&console.warn("[VvCheckbox] The model value is an array but the component is in binary mode.")})),e.watch((()=>P.value),(e=>{L.value.indeterminate=!!e})),e.onMounted((()=>{P.value&&(L.value.indeterminate=!0)}));const{HintSlot:G,hasHintLabelOrSlot:I,hasInvalidLabelOrSlot:D,hintSlotScope:H}=f(i,n);return(t,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(z)),for:e.unref(y)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(y),ref_key:"input",ref:L,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(E)?E.value=t:null),type:"checkbox",class:"vv-checkbox__input",name:t.name,disabled:e.unref(O),value:e.unref(N),tabindex:e.unref(k),"aria-invalid":e.unref(V),"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)]]),e.renderSlot(t.$slots,"default",{value:e.unref(b)},(()=>[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,w))}}),N=x;const E=["textContent"],_={class:"vv-checkbox-group__wrapper"};return e.defineComponent({name:"VvCheckboxGroup",props:N,emits:["update:modelValue","change"],setup(t,{emit:o}){const n=t,i=e.useSlots(),r=C("VvCheckboxGroup",N,n),d=l.useVModel(n,"modelValue",o),{disabled:s,readonly:v,vertical:c,valid:p,invalid:m,modifiers:b}=e.toRefs(n);!function(t){if(Object.keys(t).some((l=>"key"!==l&&!e.isRef(t[l]))))throw Error("One or more groupState props aren't ref.");e.provide(t.key,e.computed((()=>t)))}({key:u,modelValue:d,disabled:s,readonly:v,valid:p,invalid:m});const{getOptionLabel:h,getOptionValue:g}=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),y=j("vv-checkbox-group",b,e.computed((()=>({disabled:s.value,readonly:v.value,horizontal:!c.value,valid:p.value,invalid:m.value})))),{HintSlot:S,hintSlotScope:k}=f(r,i);return(t,l)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(y))},[t.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(t.label)},null,8,E)):e.createCommentVNode("",!0),e.createElementVNode("div",_,[t.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.options,((t,l)=>(e.openBlock(),e.createBlock(P,e.mergeProps({key:l},((e,t)=>({id:`${n.name}_opt${t}`,name:n.name,label:h(e),value:g(e)}))(t,l)),null,16)))),128)):e.renderSlot(t.$slots,"default",{key:1})]),e.createVNode(e.unref(S),{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(k))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"3"}:void 0]),1024)],2))}})}));
@@ -1355,10 +1355,10 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1355
1355
  }
1356
1356
  });
1357
1357
  function equals(obj1, obj2, field) {
1358
- if (field)
1358
+ if (field) {
1359
1359
  return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
1360
- else
1361
- return deepEquals(obj1, obj2);
1360
+ }
1361
+ return deepEquals(obj1, obj2);
1362
1362
  }
1363
1363
  function deepEquals(a, b) {
1364
1364
  if (a === b)
@@ -1737,7 +1737,7 @@ function useOptions(props) {
1737
1737
  return option;
1738
1738
  return typeof valueKey.value === "function" ? valueKey.value(option) : get(option, valueKey.value);
1739
1739
  };
1740
- const getOptionDisabled = (option) => {
1740
+ const isOptionDisabled = (option) => {
1741
1741
  if (typeof option !== "object" && option !== null)
1742
1742
  return false;
1743
1743
  return typeof disabledKey.value === "function" ? disabledKey.value(option) : get(option, disabledKey.value);
@@ -1751,7 +1751,7 @@ function useOptions(props) {
1751
1751
  options,
1752
1752
  getOptionLabel,
1753
1753
  getOptionValue,
1754
- getOptionDisabled,
1754
+ isOptionDisabled,
1755
1755
  getOptionGrouped
1756
1756
  };
1757
1757
  }
@@ -1872,7 +1872,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1872
1872
  const {
1873
1873
  getOptionLabel,
1874
1874
  getOptionValue,
1875
- getOptionDisabled,
1875
+ isOptionDisabled,
1876
1876
  getOptionGrouped
1877
1877
  } = useOptions(props);
1878
1878
  const localModelValue = computed({
@@ -1924,17 +1924,17 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1924
1924
  return openBlock(), createElementBlock(Fragment, null, [
1925
1925
  !isGroup(option) ? (openBlock(), createElementBlock("option", {
1926
1926
  key: index,
1927
- disabled: unref(getOptionDisabled)(option),
1927
+ disabled: unref(isOptionDisabled)(option),
1928
1928
  value: unref(getOptionValue)(option)
1929
1929
  }, toDisplayString(unref(getOptionLabel)(option)), 9, _hoisted_7$1)) : (openBlock(), createElementBlock("optgroup", {
1930
1930
  key: `group-${index}`,
1931
- disabled: unref(getOptionDisabled)(option),
1931
+ disabled: unref(isOptionDisabled)(option),
1932
1932
  label: unref(getOptionLabel)(option)
1933
1933
  }, [
1934
1934
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getOptionGrouped)(option), (item, i) => {
1935
1935
  return openBlock(), createElementBlock("option", {
1936
1936
  key: `group-${index}-item-${i}`,
1937
- disabled: unref(getOptionDisabled)(item),
1937
+ disabled: unref(isOptionDisabled)(item),
1938
1938
  value: unref(getOptionValue)(item)
1939
1939
  }, toDisplayString(unref(getOptionLabel)(item)), 9, _hoisted_9$1);
1940
1940
  }), 128))
@@ -2561,8 +2561,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2561
2561
  const {
2562
2562
  getOptionLabel,
2563
2563
  getOptionValue,
2564
- getOptionDisabled,
2565
- getOptionGrouped
2564
+ getOptionGrouped,
2565
+ isOptionDisabled
2566
2566
  } = useOptions(props);
2567
2567
  const filteredOptions = computedAsync(async () => {
2568
2568
  var _a;
@@ -2581,19 +2581,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2581
2581
  return getOptionLabel(option).toLowerCase().includes(debouncedSearchText.value.toLowerCase().trim());
2582
2582
  });
2583
2583
  });
2584
- function getOptionSelected(option) {
2584
+ function isOptionSelected(option) {
2585
2585
  if (Array.isArray(props.modelValue)) {
2586
2586
  return contains(option, props.modelValue) || contains(getOptionValue(option), props.modelValue);
2587
2587
  }
2588
2588
  return equals(option, props.modelValue) || equals(getOptionValue(option), props.modelValue);
2589
2589
  }
2590
2590
  const selectedOptions = computed(() => {
2591
- let selectedValues = [];
2592
- if (Array.isArray(props.modelValue)) {
2593
- selectedValues = props.modelValue;
2594
- } else if (props.modelValue) {
2595
- selectedValues = [props.modelValue];
2596
- }
2597
2591
  const options = props.options.reduce(
2598
2592
  (acc, value) => {
2599
2593
  if (isGroup(value)) {
@@ -2604,12 +2598,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2604
2598
  []
2605
2599
  );
2606
2600
  return options.filter((option) => {
2607
- if (isGroup(option)) {
2608
- return getOptionGrouped(option).some(
2609
- (item) => selectedValues.includes(getOptionValue(item))
2610
- );
2611
- }
2612
- return selectedValues.includes(getOptionValue(option));
2601
+ return isOptionSelected(option);
2613
2602
  });
2614
2603
  });
2615
2604
  const hasValue = computed(() => {
@@ -2804,8 +2793,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2804
2793
  option
2805
2794
  ), (item, i) => {
2806
2795
  return openBlock(), createBlock(_sfc_main$6, mergeProps({
2807
- disabled: unref(getOptionDisabled)(item),
2808
- selected: getOptionSelected(item),
2796
+ selected: isOptionSelected(item),
2797
+ disabled: unref(isOptionDisabled)(item),
2809
2798
  unselectable: _ctx.unselectable,
2810
2799
  deselectHintLabel: unref(propsDefaults).deselectHintLabel,
2811
2800
  selectHintLabel: unref(propsDefaults).selectHintLabel,
@@ -2819,8 +2808,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2819
2808
  renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
2820
2809
  option,
2821
2810
  selectedOptions: unref(selectedOptions),
2822
- selected: getOptionSelected(item),
2823
- disabled: unref(getOptionDisabled)(item)
2811
+ selected: isOptionSelected(item),
2812
+ disabled: unref(isOptionDisabled)(item)
2824
2813
  })), () => [
2825
2814
  createTextVNode(toDisplayString(unref(getOptionLabel)(item)), 1)
2826
2815
  ])
@@ -2829,8 +2818,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2829
2818
  }, 1040, ["onClickPassive"]);
2830
2819
  }), 128))
2831
2820
  ], 64)) : (openBlock(), createBlock(_sfc_main$6, mergeProps({ key: 1 }, {
2832
- disabled: unref(getOptionDisabled)(option),
2833
- selected: getOptionSelected(option),
2821
+ selected: isOptionSelected(option),
2822
+ disabled: unref(isOptionDisabled)(option),
2834
2823
  unselectable: _ctx.unselectable,
2835
2824
  deselectHintLabel: unref(propsDefaults).deselectHintLabel,
2836
2825
  selectHintLabel: unref(propsDefaults).selectHintLabel,
@@ -2843,8 +2832,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2843
2832
  renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
2844
2833
  option,
2845
2834
  selectedOptions: unref(selectedOptions),
2846
- selected: getOptionSelected(option),
2847
- disabled: unref(getOptionDisabled)(option)
2835
+ selected: isOptionSelected(option),
2836
+ disabled: unref(isOptionDisabled)(option)
2848
2837
  })), () => [
2849
2838
  createTextVNode(toDisplayString(unref(getOptionLabel)(option)), 1)
2850
2839
  ])