@volverjs/ui-vue 0.0.3-beta.2 → 0.0.3-beta.3

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 (131) hide show
  1. package/dist/components/VvAccordion/VvAccordion.es.js +63 -131
  2. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  3. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +2 -2
  4. package/dist/components/VvAccordion/index.d.ts +2 -2
  5. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +97 -176
  6. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  7. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +4 -4
  8. package/dist/components/VvAccordionGroup/index.d.ts +2 -2
  9. package/dist/components/VvBadge/VvBadge.es.js +16 -50
  10. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  11. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +38 -45
  12. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  13. package/dist/components/VvButton/VvButton.es.js +170 -306
  14. package/dist/components/VvButton/VvButton.umd.js +1 -1
  15. package/dist/components/VvButton/VvButton.vue.d.ts +4 -4
  16. package/dist/components/VvButton/index.d.ts +3 -3
  17. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +39 -84
  18. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  19. package/dist/components/VvCard/VvCard.es.js +26 -60
  20. package/dist/components/VvCard/VvCard.umd.js +1 -1
  21. package/dist/components/VvCard/VvCard.vue.d.ts +2 -2
  22. package/dist/components/VvCard/index.d.ts +1 -1
  23. package/dist/components/VvCheckbox/VvCheckbox.es.js +144 -282
  24. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  25. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +6 -6
  26. package/dist/components/VvCheckbox/index.d.ts +10 -4
  27. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +190 -346
  28. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  29. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +7 -7
  30. package/dist/components/VvCheckboxGroup/index.d.ts +3 -3
  31. package/dist/components/VvCombobox/VvCombobox.es.js +330 -487
  32. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  33. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +8 -8
  34. package/dist/components/VvCombobox/index.d.ts +4 -4
  35. package/dist/components/VvDialog/VvDialog.es.js +66 -102
  36. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  37. package/dist/components/VvDropdown/VvDropdown.es.js +61 -185
  38. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  39. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +2 -2
  40. package/dist/components/VvDropdown/index.d.ts +1 -1
  41. package/dist/components/VvIcon/VvIcon.es.js +30 -65
  42. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  43. package/dist/components/VvInputText/VvInputText.es.js +304 -407
  44. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  45. package/dist/components/VvInputText/VvInputText.vue.d.ts +10 -10
  46. package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
  47. package/dist/components/VvInputText/index.d.ts +5 -5
  48. package/dist/components/VvProgress/VvProgress.es.js +17 -51
  49. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  50. package/dist/components/VvRadio/VvRadio.es.js +110 -249
  51. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  52. package/dist/components/VvRadio/VvRadio.vue.d.ts +6 -6
  53. package/dist/components/VvRadio/index.d.ts +3 -3
  54. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +161 -318
  55. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  56. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +7 -7
  57. package/dist/components/VvRadioGroup/index.d.ts +3 -3
  58. package/dist/components/VvSelect/VvSelect.es.js +200 -292
  59. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  60. package/dist/components/VvSelect/VvSelect.vue.d.ts +8 -8
  61. package/dist/components/VvSelect/index.d.ts +4 -4
  62. package/dist/components/VvTextarea/VvTextarea.es.js +195 -254
  63. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  64. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +6 -6
  65. package/dist/components/VvTextarea/index.d.ts +3 -3
  66. package/dist/components/common/HintSlot.d.ts +1 -1
  67. package/dist/components/index.es.js +1168 -1360
  68. package/dist/components/index.umd.js +1 -1
  69. package/dist/composables/group/useInjectedGroupState.d.ts +1 -1
  70. package/dist/composables/useComponentFocus.d.ts +1 -1
  71. package/dist/composables/useComponentIcons.d.ts +1 -1
  72. package/dist/composables/useDebouncedInput.d.ts +1 -1
  73. package/dist/composables/useModifiers.d.ts +1 -1
  74. package/dist/composables/useTextCount.d.ts +1 -1
  75. package/dist/icons.es.js +3 -3
  76. package/dist/icons.umd.js +1 -1
  77. package/dist/index.es.js +1203 -1396
  78. package/dist/index.umd.js +1 -1
  79. package/dist/props/index.d.ts +12 -12
  80. package/dist/utils/ObjectUtilities.d.ts +1 -1
  81. package/package.json +1 -1
  82. package/src/assets/icons/detailed.json +1 -1
  83. package/src/assets/icons/normal.json +1 -1
  84. package/src/assets/icons/simple.json +1 -1
  85. package/src/components/VvAccordion/VvAccordion.vue +0 -3
  86. package/src/components/VvAccordion/index.ts +1 -2
  87. package/src/components/VvAccordionGroup/VvAccordionGroup.vue +1 -3
  88. package/src/components/VvBadge/VvBadge.vue +0 -1
  89. package/src/components/VvButton/VvButton.vue +0 -3
  90. package/src/components/VvButton/index.ts +2 -10
  91. package/src/components/VvButtonGroup/VvButtonGroup.vue +0 -3
  92. package/src/components/VvCard/VvCard.vue +0 -1
  93. package/src/components/VvCheckbox/VvCheckbox.vue +0 -3
  94. package/src/components/VvCheckbox/index.ts +1 -2
  95. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +0 -5
  96. package/src/components/VvCombobox/VvCombobox.vue +0 -7
  97. package/src/components/VvDialog/VvDialog.vue +1 -2
  98. package/src/components/VvDropdown/VvDropdown.vue +0 -4
  99. package/src/components/VvIcon/VvIcon.vue +0 -2
  100. package/src/components/VvInputText/VvInputClearAction.ts +0 -1
  101. package/src/components/VvInputText/VvInputPasswordAction.ts +0 -1
  102. package/src/components/VvInputText/VvInputStepAction.ts +0 -1
  103. package/src/components/VvInputText/VvInputText.vue +1 -16
  104. package/src/components/VvInputText/VvInputTextActions.ts +1 -1
  105. package/src/components/VvProgress/VvProgress.vue +0 -2
  106. package/src/components/VvRadio/VvRadio.vue +0 -3
  107. package/src/components/VvRadio/index.ts +0 -1
  108. package/src/components/VvRadioGroup/VvRadioGroup.vue +0 -5
  109. package/src/components/VvSelect/VvSelect.vue +1 -14
  110. package/src/components/common/HintSlot.ts +1 -11
  111. package/src/composables/group/types/IAccordionGroupState.ts +0 -1
  112. package/src/composables/group/types/IButtonGroupState.ts +0 -1
  113. package/src/composables/group/types/IInputGroup.ts +0 -1
  114. package/src/composables/group/useInjectedGroupState.ts +1 -2
  115. package/src/composables/group/useProvideGroupState.ts +0 -1
  116. package/src/composables/useComponentFocus.ts +1 -2
  117. package/src/composables/useComponentIcons.ts +1 -1
  118. package/src/composables/useDebouncedInput.ts +1 -1
  119. package/src/composables/useModifiers.ts +1 -2
  120. package/src/composables/useOptions.ts +0 -1
  121. package/src/composables/useTextCount.ts +1 -1
  122. package/src/stories/Breadcrumb/Breadcrumb.settings.ts +0 -1
  123. package/src/stories/ButtonGroup/ButtonGroup.settings.ts +0 -1
  124. package/src/stories/Combobox/Combobox.settings.ts +0 -1
  125. package/src/stories/Dropdown/Dropdown.settings.ts +0 -1
  126. package/src/stories/Icon/Icon.settings.ts +0 -1
  127. package/src/stories/InputText/InputText.settings.ts +0 -1
  128. package/src/stories/Select/Select.settings.ts +0 -1
  129. package/src/stories/Textarea/Textarea.settings.ts +0 -1
  130. package/src/stories/Tooltip/Tooltip.settings.ts +0 -1
  131. package/src/utils/ObjectUtilities.ts +1 -1
@@ -1,74 +1,6 @@
1
- import { unref as r, computed as v, inject as $, toRef as k, toRefs as S, defineComponent as j, useAttrs as I, ref as B, openBlock as P, createElementBlock as z, normalizeClass as D, withModifiers as E, createElementVNode as A, renderSlot as C, normalizeProps as b, guardReactiveProps as g, createTextVNode as O, toDisplayString as R } from "vue";
2
- import { useToggle as M } from "@vueuse/core";
3
- import { nanoid as Z } from "nanoid";
4
- function L(o) {
5
- return ((e) => e == null || e === "" || Array.isArray(e) && e.length === 0 || !(e instanceof Date) && typeof e == "object" && Object.keys(e).length === 0)(r(o));
6
- }
7
- function V(o) {
8
- var e, a;
9
- if (o)
10
- return (a = (e = o.match(
11
- /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g
12
- )) == null ? void 0 : e.join("-")) == null ? void 0 : a.toLowerCase();
13
- }
14
- function N(o, e) {
15
- const a = { [`${o}`]: !0 };
16
- return {
17
- bemCssClasses: v(() => Object.keys(e).reduce((t, l) => {
18
- const s = r(e[l]) || !1;
19
- if (!s)
20
- return t;
21
- if (l === "modifiers") {
22
- const f = Array.isArray(s) ? s : s.split(" ");
23
- return {
24
- ...t,
25
- ...f.reduce(
26
- (i, c) => ({
27
- ...i,
28
- [`${o}--${V(c)}`]: !0
29
- }),
30
- {}
31
- )
32
- };
33
- } else
34
- return {
35
- ...t,
36
- [`${o}--${V(l)}`]: s
37
- };
38
- }, a) || {})
39
- };
40
- }
41
- function T(o) {
42
- const e = $(o, void 0), a = v(() => !L(e));
43
- function u(t, l, s) {
44
- if (e != null && e.value) {
45
- const i = r(e.value)[t];
46
- return v({
47
- get() {
48
- return i == null ? void 0 : i.value;
49
- },
50
- set(c) {
51
- i.value = c;
52
- }
53
- });
54
- }
55
- const f = k(l, t);
56
- return v({
57
- get() {
58
- return f.value;
59
- },
60
- set(i) {
61
- s && s(`update:${t}`, i);
62
- }
63
- });
64
- }
65
- return {
66
- group: e,
67
- isInGroup: a,
68
- getGroupOrLocalRef: u
69
- };
70
- }
71
- const U = "VV_ACCORDION_GROUP", x = {
1
+ import { defineComponent as S, openBlock as b, createElementBlock as h, unref as t, normalizeClass as P, withModifiers as B, createElementVNode as g, renderSlot as y, normalizeProps as A, guardReactiveProps as V, createTextVNode as C, toDisplayString as O } from "vue";
2
+ import { nanoid as I } from "nanoid";
3
+ const N = "VV_ACCORDION_GROUP", k = {
72
4
  name: String,
73
5
  title: String,
74
6
  content: String,
@@ -78,88 +10,88 @@ const U = "VV_ACCORDION_GROUP", x = {
78
10
  },
79
11
  modifiers: [String, Array],
80
12
  disabled: Boolean
81
- }, q = ["update:modelValue"];
82
- function F(o, e) {
83
- const { group: a, isInGroup: u, getGroupOrLocalRef: t } = T(U), { title: l, content: s } = S(o), f = t("modelValue", o, e), i = t("disabled", o), c = t("collapse", o), n = t("modifiers", o);
13
+ }, x = ["update:modelValue"];
14
+ function D(s, d) {
15
+ const { group: l, isInGroup: a, getGroupOrLocalRef: o } = useInjectedGroupState(N), { title: u, content: v } = toRefs(s), m = o("modelValue", s, d), p = o("disabled", s), i = o("collapse", s), e = o("modifiers", s);
84
16
  return {
85
- modelValue: f,
86
- disabled: i,
87
- isInGroup: u,
88
- group: a,
89
- collapse: c,
90
- modifiers: n,
91
- title: l,
92
- content: s
17
+ modelValue: m,
18
+ disabled: p,
19
+ isInGroup: a,
20
+ group: l,
21
+ collapse: i,
22
+ modifiers: e,
23
+ title: u,
24
+ content: v
93
25
  };
94
26
  }
95
- const H = ["id", "open"], J = ["aria-controls", "aria-expanded"], K = ["aria-hidden"], Q = {
27
+ const E = ["id", "open"], M = ["aria-controls", "aria-expanded"], $ = ["aria-hidden"], z = {
96
28
  name: "VvAccordion"
97
- }, ee = /* @__PURE__ */ j({
98
- ...Q,
99
- props: x,
100
- emits: q,
101
- setup(o, { emit: e }) {
102
- const a = o, u = I(), t = a.name || (u == null ? void 0 : u.id) || Z(), {
103
- modifiers: l,
104
- title: s,
105
- content: f,
106
- disabled: i,
107
- collapse: c,
108
- modelValue: n,
109
- isInGroup: _
110
- } = F(a, e), y = B(!1), m = v({
111
- get: () => _.value ? c.value && Array.isArray(n.value) ? n.value.includes(t) : n.value === t : n.value === void 0 ? y.value : n.value,
112
- set: (d) => {
113
- if (_.value) {
114
- if (c.value && Array.isArray(n.value)) {
115
- if (d) {
116
- n.value.push(t);
29
+ }, L = /* @__PURE__ */ S({
30
+ ...z,
31
+ props: k,
32
+ emits: x,
33
+ setup(s, { emit: d }) {
34
+ const l = s, a = useAttrs(), o = l.name || (a == null ? void 0 : a.id) || I(), {
35
+ modifiers: u,
36
+ title: v,
37
+ content: m,
38
+ disabled: p,
39
+ collapse: i,
40
+ modelValue: e,
41
+ isInGroup: f
42
+ } = D(l, d), _ = ref(!1), r = computed({
43
+ get: () => f.value ? i.value && Array.isArray(e.value) ? e.value.includes(o) : e.value === o : e.value === void 0 ? _.value : e.value,
44
+ set: (n) => {
45
+ if (f.value) {
46
+ if (i.value && Array.isArray(e.value)) {
47
+ if (n) {
48
+ e.value.push(o);
117
49
  return;
118
50
  }
119
- n.value = n.value.filter(
120
- (p) => p !== t
51
+ e.value = e.value.filter(
52
+ (c) => c !== o
121
53
  );
122
54
  return;
123
55
  }
124
- n.value = d ? t : null;
56
+ e.value = n ? o : null;
125
57
  return;
126
58
  }
127
- if (n.value === void 0 && typeof d == "boolean") {
128
- y.value = d;
59
+ if (e.value === void 0 && typeof n == "boolean") {
60
+ _.value = n;
129
61
  return;
130
62
  }
131
- n.value = d;
63
+ e.value = n;
132
64
  }
133
- }), { bemCssClasses: h } = N("vv-accordion", {
134
- modifiers: l,
135
- disabled: i
136
- }), G = M(m);
137
- return (d, p) => (P(), z("details", {
138
- id: r(t),
139
- class: D(r(h)),
140
- open: r(m),
141
- onClick: p[0] || (p[0] = E((W) => r(G)(), ["prevent"]))
65
+ }), { bemCssClasses: G } = useBemModifiers("vv-accordion", {
66
+ modifiers: u,
67
+ disabled: p
68
+ }), R = useToggle(r);
69
+ return (n, c) => (b(), h("details", {
70
+ id: t(o),
71
+ class: P(t(G)),
72
+ open: t(r),
73
+ onClick: c[0] || (c[0] = B((T) => t(R)(), ["prevent"]))
142
74
  }, [
143
- A("summary", {
144
- "aria-controls": r(t),
145
- "aria-expanded": r(m),
75
+ g("summary", {
76
+ "aria-controls": t(o),
77
+ "aria-expanded": t(r),
146
78
  class: "vv-collapse__summary"
147
79
  }, [
148
- C(d.$slots, "summary", b(g({ open: r(m) })), () => [
149
- O(R(r(s)), 1)
80
+ y(n.$slots, "summary", A(V({ open: t(r) })), () => [
81
+ C(O(t(v)), 1)
150
82
  ])
151
- ], 8, J),
152
- A("div", {
153
- "aria-hidden": !r(m),
83
+ ], 8, M),
84
+ g("div", {
85
+ "aria-hidden": !t(r),
154
86
  class: "vv-collapse__content"
155
87
  }, [
156
- C(d.$slots, "details", b(g({ open: r(m) })), () => [
157
- O(R(r(f)), 1)
88
+ y(n.$slots, "details", A(V({ open: t(r) })), () => [
89
+ C(O(t(m)), 1)
158
90
  ])
159
- ], 8, K)
160
- ], 10, H));
91
+ ], 8, $)
92
+ ], 10, E));
161
93
  }
162
94
  });
163
95
  export {
164
- ee as default
96
+ L as default
165
97
  };
@@ -1 +1 @@
1
- (function(e,m){typeof exports=="object"&&typeof module<"u"?module.exports=m(require("vue"),require("@vueuse/core"),require("nanoid")):typeof define=="function"&&define.amd?define(["vue","@vueuse/core","nanoid"],m):(e=typeof globalThis<"u"?globalThis:e||self,e.VvAccordion=m(e.vue,e.core,e.nanoid))})(this,function(e,m,g){"use strict";function b(r){return(n=>n==null||n===""||Array.isArray(n)&&n.length===0||!(n instanceof Date)&&typeof n=="object"&&Object.keys(n).length===0)(e.unref(r))}function _(r){var n,a;if(r)return(a=(n=r.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:n.join("-"))==null?void 0:a.toLowerCase()}function V(r,n){const a={[`${r}`]:!0};return{bemCssClasses:e.computed(()=>Object.keys(n).reduce((t,c)=>{const s=e.unref(n[c])||!1;if(!s)return t;if(c==="modifiers"){const f=Array.isArray(s)?s:s.split(" ");return{...t,...f.reduce((i,l)=>({...i,[`${r}--${_(l)}`]:!0}),{})}}else return{...t,[`${r}--${_(c)}`]:s}},a)||{})}}function h(r){const n=e.inject(r,void 0),a=e.computed(()=>!b(n));function d(t,c,s){if(n!=null&&n.value){const i=e.unref(n.value)[t];return e.computed({get(){return i==null?void 0:i.value},set(l){i.value=l}})}const f=e.toRef(c,t);return e.computed({get(){return f.value},set(i){s&&s(`update:${t}`,i)}})}return{group:n,isInGroup:a,getGroupOrLocalRef:d}}const O="VV_ACCORDION_GROUP",R={name:String,title:String,content:String,modelValue:{type:Boolean,default:void 0},modifiers:[String,Array],disabled:Boolean},G=["update:modelValue"];function S(r,n){const{group:a,isInGroup:d,getGroupOrLocalRef:t}=h(O),{title:c,content:s}=e.toRefs(r),f=t("modelValue",r,n),i=t("disabled",r),l=t("collapse",r),o=t("modifiers",r);return{modelValue:f,disabled:i,isInGroup:d,group:a,collapse:l,modifiers:o,title:c,content:s}}const $=["id","open"],j=["aria-controls","aria-expanded"],k=["aria-hidden"],P={name:"VvAccordion"};return e.defineComponent({...P,props:R,emits:G,setup(r,{emit:n}){const a=r,d=e.useAttrs(),t=a.name||(d==null?void 0:d.id)||g.nanoid(),{modifiers:c,title:s,content:f,disabled:i,collapse:l,modelValue:o,isInGroup:A}=S(a,n),C=e.ref(!1),p=e.computed({get:()=>A.value?l.value&&Array.isArray(o.value)?o.value.includes(t):o.value===t:o.value===void 0?C.value:o.value,set:u=>{if(A.value){if(l.value&&Array.isArray(o.value)){if(u){o.value.push(t);return}o.value=o.value.filter(y=>y!==t);return}o.value=u?t:null;return}if(o.value===void 0&&typeof u=="boolean"){C.value=u;return}o.value=u}}),{bemCssClasses:I}=V("vv-accordion",{modifiers:c,disabled:i}),z=m.useToggle(p);return(u,y)=>(e.openBlock(),e.createElementBlock("details",{id:e.unref(t),class:e.normalizeClass(e.unref(I)),open:e.unref(p),onClick:y[0]||(y[0]=e.withModifiers(D=>e.unref(z)(),["prevent"]))},[e.createElementVNode("summary",{"aria-controls":e.unref(t),"aria-expanded":e.unref(p),class:"vv-collapse__summary"},[e.renderSlot(u.$slots,"summary",e.normalizeProps(e.guardReactiveProps({open:e.unref(p)})),()=>[e.createTextVNode(e.toDisplayString(e.unref(s)),1)])],8,j),e.createElementVNode("div",{"aria-hidden":!e.unref(p),class:"vv-collapse__content"},[e.renderSlot(u.$slots,"details",e.normalizeProps(e.guardReactiveProps({open:e.unref(p)})),()=>[e.createTextVNode(e.toDisplayString(e.unref(f)),1)])],8,k)],10,$))}})});
1
+ (function(e,s){typeof exports=="object"&&typeof module<"u"?module.exports=s(require("vue"),require("nanoid")):typeof define=="function"&&define.amd?define(["vue","nanoid"],s):(e=typeof globalThis<"u"?globalThis:e||self,e.VvAccordion=s(e.vue,e.nanoid))})(this,function(e,s){"use strict";const v="VV_ACCORDION_GROUP",A={name:String,title:String,content:String,modelValue:{type:Boolean,default:void 0},modifiers:[String,Array],disabled:Boolean},g=["update:modelValue"];function C(r,u){const{group:l,isInGroup:a,getGroupOrLocalRef:o}=useInjectedGroupState(v),{title:f,content:p}=toRefs(r),m=o("modelValue",r,u),_=o("disabled",r),d=o("collapse",r),n=o("modifiers",r);return{modelValue:m,disabled:_,isInGroup:a,group:l,collapse:d,modifiers:n,title:f,content:p}}const h=["id","open"],S=["aria-controls","aria-expanded"],O=["aria-hidden"],P={name:"VvAccordion"};return e.defineComponent({...P,props:A,emits:g,setup(r,{emit:u}){const l=r,a=useAttrs(),o=l.name||(a==null?void 0:a.id)||s.nanoid(),{modifiers:f,title:p,content:m,disabled:_,collapse:d,modelValue:n,isInGroup:y}=C(l,u),V=ref(!1),i=computed({get:()=>y.value?d.value&&Array.isArray(n.value)?n.value.includes(o):n.value===o:n.value===void 0?V.value:n.value,set:t=>{if(y.value){if(d.value&&Array.isArray(n.value)){if(t){n.value.push(o);return}n.value=n.value.filter(c=>c!==o);return}n.value=t?o:null;return}if(n.value===void 0&&typeof t=="boolean"){V.value=t;return}n.value=t}}),{bemCssClasses:R}=useBemModifiers("vv-accordion",{modifiers:f,disabled:_}),G=useToggle(i);return(t,c)=>(e.openBlock(),e.createElementBlock("details",{id:e.unref(o),class:e.normalizeClass(e.unref(R)),open:e.unref(i),onClick:c[0]||(c[0]=e.withModifiers(b=>e.unref(G)(),["prevent"]))},[e.createElementVNode("summary",{"aria-controls":e.unref(o),"aria-expanded":e.unref(i),class:"vv-collapse__summary"},[e.renderSlot(t.$slots,"summary",e.normalizeProps(e.guardReactiveProps({open:e.unref(i)})),()=>[e.createTextVNode(e.toDisplayString(e.unref(p)),1)])],8,S),e.createElementVNode("div",{"aria-hidden":!e.unref(i),class:"vv-collapse__content"},[e.renderSlot(t.$slots,"details",e.normalizeProps(e.guardReactiveProps({open:e.unref(i)})),()=>[e.createTextVNode(e.toDisplayString(e.unref(m)),1)])],8,O)],10,h))}})});
@@ -6,7 +6,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
6
6
  type: BooleanConstructor;
7
7
  default: undefined;
8
8
  };
9
- modifiers: (ArrayConstructor | StringConstructor)[];
9
+ modifiers: (StringConstructor | ArrayConstructor)[];
10
10
  disabled: BooleanConstructor;
11
11
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, string[], string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
12
12
  name: StringConstructor;
@@ -16,7 +16,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
16
16
  type: BooleanConstructor;
17
17
  default: undefined;
18
18
  };
19
- modifiers: (ArrayConstructor | StringConstructor)[];
19
+ modifiers: (StringConstructor | ArrayConstructor)[];
20
20
  disabled: BooleanConstructor;
21
21
  }>> & {
22
22
  [x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
@@ -1,4 +1,4 @@
1
- import { type ExtractPropTypes, type Ref } from 'vue';
1
+ import type { ExtractPropTypes, Ref } from 'vue';
2
2
  import type IAccordionGroupState from '@/composables/group/types/IAccordionGroupState';
3
3
  export declare const VvAccordionProps: {
4
4
  /**
@@ -23,7 +23,7 @@ export declare const VvAccordionProps: {
23
23
  /**
24
24
  * String or String[] of css classes (modifiers) that will be concatenated to prefix 'vv-accordion--'
25
25
  */
26
- modifiers: (ArrayConstructor | StringConstructor)[];
26
+ modifiers: (StringConstructor | ArrayConstructor)[];
27
27
  /**
28
28
  * If true, the accordion will be disabled
29
29
  */
@@ -1,85 +1,6 @@
1
- import { isRef as z, provide as D, computed as y, unref as a, inject as L, toRef as Z, toRefs as B, defineComponent as P, useAttrs as N, ref as j, openBlock as C, createElementBlock as $, normalizeClass as E, withModifiers as T, createElementVNode as h, renderSlot as _, normalizeProps as b, guardReactiveProps as G, createTextVNode as O, toDisplayString as k, watchEffect as U, Fragment as F, renderList as q, createBlock as x, mergeProps as H, withCtx as R } from "vue";
2
- import { useToggle as J } from "@vueuse/core";
3
- import { nanoid as K } from "nanoid";
4
- const M = "VV_ACCORDION_GROUP";
5
- function Q(r) {
6
- if (Object.keys(r).some(
7
- (e) => e !== "key" && !z(r[e])
8
- ))
9
- throw Error("One or more groupState props aren't ref.");
10
- D(
11
- r.key,
12
- y(() => r)
13
- );
14
- }
15
- function W(r) {
16
- return ((e) => e == null || e === "" || Array.isArray(e) && e.length === 0 || !(e instanceof Date) && typeof e == "object" && Object.keys(e).length === 0)(a(r));
17
- }
18
- function S(r) {
19
- var e, t;
20
- if (r)
21
- return (t = (e = r.match(
22
- /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g
23
- )) == null ? void 0 : e.join("-")) == null ? void 0 : t.toLowerCase();
24
- }
25
- function I(r, e) {
26
- const t = { [`${r}`]: !0 };
27
- return {
28
- bemCssClasses: y(() => Object.keys(e).reduce((o, c) => {
29
- const l = a(e[c]) || !1;
30
- if (!l)
31
- return o;
32
- if (c === "modifiers") {
33
- const f = Array.isArray(l) ? l : l.split(" ");
34
- return {
35
- ...o,
36
- ...f.reduce(
37
- (n, d) => ({
38
- ...n,
39
- [`${r}--${S(d)}`]: !0
40
- }),
41
- {}
42
- )
43
- };
44
- } else
45
- return {
46
- ...o,
47
- [`${r}--${S(c)}`]: l
48
- };
49
- }, t) || {})
50
- };
51
- }
52
- function X(r) {
53
- const e = L(r, void 0), t = y(() => !W(e));
54
- function u(o, c, l) {
55
- if (e != null && e.value) {
56
- const n = a(e.value)[o];
57
- return y({
58
- get() {
59
- return n == null ? void 0 : n.value;
60
- },
61
- set(d) {
62
- n.value = d;
63
- }
64
- });
65
- }
66
- const f = Z(c, o);
67
- return y({
68
- get() {
69
- return f.value;
70
- },
71
- set(n) {
72
- l && l(`update:${o}`, n);
73
- }
74
- });
75
- }
76
- return {
77
- group: e,
78
- isInGroup: t,
79
- getGroupOrLocalRef: u
80
- };
81
- }
82
- const Y = {
1
+ import { defineComponent as P, openBlock as g, createElementBlock as S, unref as a, normalizeClass as O, withModifiers as k, createElementVNode as h, renderSlot as A, normalizeProps as C, guardReactiveProps as G, createTextVNode as b, toDisplayString as $, Fragment as M, renderList as E, createBlock as I, mergeProps as N, withCtx as B } from "vue";
2
+ import { nanoid as D } from "nanoid";
3
+ const R = "VV_ACCORDION_GROUP", x = {
83
4
  name: String,
84
5
  title: String,
85
6
  content: String,
@@ -89,88 +10,88 @@ const Y = {
89
10
  },
90
11
  modifiers: [String, Array],
91
12
  disabled: Boolean
92
- }, w = ["update:modelValue"];
93
- function ee(r, e) {
94
- const { group: t, isInGroup: u, getGroupOrLocalRef: o } = X(M), { title: c, content: l } = B(r), f = o("modelValue", r, e), n = o("disabled", r), d = o("collapse", r), i = o("modifiers", r);
13
+ }, z = ["update:modelValue"];
14
+ function L(s, m) {
15
+ const { group: t, isInGroup: l, getGroupOrLocalRef: e } = useInjectedGroupState(R), { title: p, content: v } = toRefs(s), f = e("modelValue", s, m), d = e("disabled", s), c = e("collapse", s), r = e("modifiers", s);
95
16
  return {
96
17
  modelValue: f,
97
- disabled: n,
98
- isInGroup: u,
18
+ disabled: d,
19
+ isInGroup: l,
99
20
  group: t,
100
- collapse: d,
101
- modifiers: i,
102
- title: c,
103
- content: l
21
+ collapse: c,
22
+ modifiers: r,
23
+ title: p,
24
+ content: v
104
25
  };
105
26
  }
106
- const oe = ["id", "open"], re = ["aria-controls", "aria-expanded"], te = ["aria-hidden"], se = {
27
+ const T = ["id", "open"], U = ["aria-controls", "aria-expanded"], j = ["aria-hidden"], F = {
107
28
  name: "VvAccordion"
108
- }, ne = /* @__PURE__ */ P({
109
- ...se,
110
- props: Y,
111
- emits: w,
112
- setup(r, { emit: e }) {
113
- const t = r, u = N(), o = t.name || (u == null ? void 0 : u.id) || K(), {
114
- modifiers: c,
115
- title: l,
29
+ }, q = /* @__PURE__ */ P({
30
+ ...F,
31
+ props: x,
32
+ emits: z,
33
+ setup(s, { emit: m }) {
34
+ const t = s, l = useAttrs(), e = t.name || (l == null ? void 0 : l.id) || D(), {
35
+ modifiers: p,
36
+ title: v,
116
37
  content: f,
117
- disabled: n,
118
- collapse: d,
119
- modelValue: i,
120
- isInGroup: g
121
- } = ee(t, e), s = j(!1), v = y({
122
- get: () => g.value ? d.value && Array.isArray(i.value) ? i.value.includes(o) : i.value === o : i.value === void 0 ? s.value : i.value,
123
- set: (p) => {
124
- if (g.value) {
125
- if (d.value && Array.isArray(i.value)) {
126
- if (p) {
127
- i.value.push(o);
38
+ disabled: d,
39
+ collapse: c,
40
+ modelValue: r,
41
+ isInGroup: _
42
+ } = L(t, m), o = ref(!1), u = computed({
43
+ get: () => _.value ? c.value && Array.isArray(r.value) ? r.value.includes(e) : r.value === e : r.value === void 0 ? o.value : r.value,
44
+ set: (i) => {
45
+ if (_.value) {
46
+ if (c.value && Array.isArray(r.value)) {
47
+ if (i) {
48
+ r.value.push(e);
128
49
  return;
129
50
  }
130
- i.value = i.value.filter(
131
- (V) => V !== o
51
+ r.value = r.value.filter(
52
+ (V) => V !== e
132
53
  );
133
54
  return;
134
55
  }
135
- i.value = p ? o : null;
56
+ r.value = i ? e : null;
136
57
  return;
137
58
  }
138
- if (i.value === void 0 && typeof p == "boolean") {
139
- s.value = p;
59
+ if (r.value === void 0 && typeof i == "boolean") {
60
+ o.value = i;
140
61
  return;
141
62
  }
142
- i.value = p;
63
+ r.value = i;
143
64
  }
144
- }), { bemCssClasses: m } = I("vv-accordion", {
145
- modifiers: c,
146
- disabled: n
147
- }), A = J(v);
148
- return (p, V) => (C(), $("details", {
149
- id: a(o),
150
- class: E(a(m)),
151
- open: a(v),
152
- onClick: V[0] || (V[0] = T((ue) => a(A)(), ["prevent"]))
65
+ }), { bemCssClasses: n } = useBemModifiers("vv-accordion", {
66
+ modifiers: p,
67
+ disabled: d
68
+ }), y = useToggle(u);
69
+ return (i, V) => (g(), S("details", {
70
+ id: a(e),
71
+ class: O(a(n)),
72
+ open: a(u),
73
+ onClick: V[0] || (V[0] = k((Q) => a(y)(), ["prevent"]))
153
74
  }, [
154
75
  h("summary", {
155
- "aria-controls": a(o),
156
- "aria-expanded": a(v),
76
+ "aria-controls": a(e),
77
+ "aria-expanded": a(u),
157
78
  class: "vv-collapse__summary"
158
79
  }, [
159
- _(p.$slots, "summary", b(G({ open: a(v) })), () => [
160
- O(k(a(l)), 1)
80
+ A(i.$slots, "summary", C(G({ open: a(u) })), () => [
81
+ b($(a(v)), 1)
161
82
  ])
162
- ], 8, re),
83
+ ], 8, U),
163
84
  h("div", {
164
- "aria-hidden": !a(v),
85
+ "aria-hidden": !a(u),
165
86
  class: "vv-collapse__content"
166
87
  }, [
167
- _(p.$slots, "details", b(G({ open: a(v) })), () => [
168
- O(k(a(f)), 1)
88
+ A(i.$slots, "details", C(G({ open: a(u) })), () => [
89
+ b($(a(f)), 1)
169
90
  ])
170
- ], 8, te)
171
- ], 10, oe));
91
+ ], 8, j)
92
+ ], 10, T));
172
93
  }
173
- }), ae = {
94
+ }), H = {
174
95
  modelValue: [String, Array],
175
96
  items: { type: Array, default: () => [] },
176
97
  collapse: Boolean,
@@ -180,57 +101,57 @@ const oe = ["id", "open"], re = ["aria-controls", "aria-expanded"], te = ["aria-
180
101
  default: ""
181
102
  },
182
103
  disabled: Boolean
183
- }, ie = ["update:modelValue"], le = {
104
+ }, J = ["update:modelValue"], K = {
184
105
  name: "VvAccordionGroup"
185
- }, me = /* @__PURE__ */ P({
186
- ...le,
187
- props: ae,
188
- emits: ie,
189
- setup(r, { emit: e }) {
190
- const t = r, { disabled: u, collapse: o, modifiers: c, itemModifiers: l, items: f } = B(t);
191
- U(() => {
192
- typeof t.modelValue == "string" && o.value && console.warn(
106
+ }, Y = /* @__PURE__ */ P({
107
+ ...K,
108
+ props: H,
109
+ emits: J,
110
+ setup(s, { emit: m }) {
111
+ const t = s, { disabled: l, collapse: e, modifiers: p, itemModifiers: v, items: f } = toRefs(t);
112
+ watchEffect(() => {
113
+ typeof t.modelValue == "string" && e.value && console.warn(
193
114
  "[VvAccordionGroup]: modelValue is a string but collapse is true."
194
115
  );
195
116
  });
196
- const n = j([]), d = y({
117
+ const d = ref([]), c = computed({
197
118
  get: () => {
198
- var s;
199
- return t.modelValue !== void 0 ? o.value ? t.modelValue : Array.isArray(t.modelValue) ? t.modelValue[0] : t.modelValue : o.value ? n.value : (s = n.value) == null ? void 0 : s[0];
119
+ var o;
120
+ return t.modelValue !== void 0 ? e.value ? t.modelValue : Array.isArray(t.modelValue) ? t.modelValue[0] : t.modelValue : e.value ? d.value : (o = d.value) == null ? void 0 : o[0];
200
121
  },
201
- set: (s) => {
122
+ set: (o) => {
202
123
  if (t.modelValue !== void 0)
203
- return (Array.isArray(t.modelValue) || o.value) && !Array.isArray(s) && (s = [s]), e("update:modelValue", s);
204
- n.value = Array.isArray(s) ? s : [s];
124
+ return (Array.isArray(t.modelValue) || e.value) && !Array.isArray(o) && (o = [o]), m("update:modelValue", o);
125
+ d.value = Array.isArray(o) ? o : [o];
205
126
  }
127
+ }), r = {
128
+ key: R,
129
+ modelValue: c,
130
+ disabled: l,
131
+ collapse: e,
132
+ modifiers: v
133
+ };
134
+ useProvideGroupState(r);
135
+ const { bemCssClasses: _ } = useBemModifiers("vv-accordion-group", {
136
+ modifiers: p,
137
+ disabled: l
206
138
  });
207
- Q({
208
- key: M,
209
- modelValue: d,
210
- disabled: u,
211
- collapse: o,
212
- modifiers: l
213
- });
214
- const { bemCssClasses: g } = I("vv-accordion-group", {
215
- modifiers: c,
216
- disabled: u
217
- });
218
- return (s, v) => (C(), $("div", {
219
- class: E(a(g))
139
+ return (o, u) => (g(), S("div", {
140
+ class: O(a(_))
220
141
  }, [
221
- _(s.$slots, "default", {}, () => [
222
- (C(!0), $(F, null, q(a(f), (m) => (C(), x(ne, H({
223
- key: m.title
142
+ A(o.$slots, "default", {}, () => [
143
+ (g(!0), S(M, null, E(a(f), (n) => (g(), I(q, N({
144
+ key: n.title
224
145
  }, {
225
- name: m.name,
226
- title: m.title,
227
- content: m.content
146
+ name: n.name,
147
+ title: n.title,
148
+ content: n.content
228
149
  }), {
229
- header: R((A) => [
230
- _(s.$slots, `header::${m.name}`, b(G(A)))
150
+ header: B((y) => [
151
+ A(o.$slots, `header::${n.name}`, C(G(y)))
231
152
  ]),
232
- details: R((A) => [
233
- _(s.$slots, `details::${m.name}`, b(G(A)))
153
+ details: B((y) => [
154
+ A(o.$slots, `details::${n.name}`, C(G(y)))
234
155
  ]),
235
156
  _: 2
236
157
  }, 1040))), 128))
@@ -239,5 +160,5 @@ const oe = ["id", "open"], re = ["aria-controls", "aria-expanded"], te = ["aria-
239
160
  }
240
161
  });
241
162
  export {
242
- me as default
163
+ Y as default
243
164
  };
@@ -1 +1 @@
1
- (function(e,A){typeof exports=="object"&&typeof module<"u"?module.exports=A(require("vue"),require("@vueuse/core"),require("nanoid")):typeof define=="function"&&define.amd?define(["vue","@vueuse/core","nanoid"],A):(e=typeof globalThis<"u"?globalThis:e||self,e.VvAccordionGroup=A(e.vue,e.core,e.nanoid))})(this,function(e,A,k){"use strict";const g="VV_ACCORDION_GROUP";function G(t){if(Object.keys(t).some(r=>r!=="key"&&!e.isRef(t[r])))throw Error("One or more groupState props aren't ref.");e.provide(t.key,e.computed(()=>t))}function S(t){return(r=>r==null||r===""||Array.isArray(r)&&r.length===0||!(r instanceof Date)&&typeof r=="object"&&Object.keys(r).length===0)(e.unref(t))}function h(t){var r,n;if(t)return(n=(r=t.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:r.join("-"))==null?void 0:n.toLowerCase()}function b(t,r){const n={[`${t}`]:!0};return{bemCssClasses:e.computed(()=>Object.keys(r).reduce((o,d)=>{const l=e.unref(r[d])||!1;if(!l)return o;if(d==="modifiers"){const u=Array.isArray(l)?l:l.split(" ");return{...o,...u.reduce((i,f)=>({...i,[`${t}--${h(f)}`]:!0}),{})}}else return{...o,[`${t}--${h(d)}`]:l}},n)||{})}}function $(t){const r=e.inject(t,void 0),n=e.computed(()=>!S(r));function c(o,d,l){if(r!=null&&r.value){const i=e.unref(r.value)[o];return e.computed({get(){return i==null?void 0:i.value},set(f){i.value=f}})}const u=e.toRef(d,o);return e.computed({get(){return u.value},set(i){l&&l(`update:${o}`,i)}})}return{group:r,isInGroup:n,getGroupOrLocalRef:c}}const R={name:String,title:String,content:String,modelValue:{type:Boolean,default:void 0},modifiers:[String,Array],disabled:Boolean},P=["update:modelValue"];function B(t,r){const{group:n,isInGroup:c,getGroupOrLocalRef:o}=$(g),{title:d,content:l}=e.toRefs(t),u=o("modelValue",t,r),i=o("disabled",t),f=o("collapse",t),a=o("modifiers",t);return{modelValue:u,disabled:i,isInGroup:c,group:n,collapse:f,modifiers:a,title:d,content:l}}const O=["id","open"],E=["aria-controls","aria-expanded"],j=["aria-hidden"],z={name:"VvAccordion"},M=e.defineComponent({...z,props:R,emits:P,setup(t,{emit:r}){const n=t,c=e.useAttrs(),o=n.name||(c==null?void 0:c.id)||k.nanoid(),{modifiers:d,title:l,content:u,disabled:i,collapse:f,modelValue:a,isInGroup:V}=B(n,r),s=e.ref(!1),y=e.computed({get:()=>V.value?f.value&&Array.isArray(a.value)?a.value.includes(o):a.value===o:a.value===void 0?s.value:a.value,set:m=>{if(V.value){if(f.value&&Array.isArray(a.value)){if(m){a.value.push(o);return}a.value=a.value.filter(C=>C!==o);return}a.value=m?o:null;return}if(a.value===void 0&&typeof m=="boolean"){s.value=m;return}a.value=m}}),{bemCssClasses:p}=b("vv-accordion",{modifiers:d,disabled:i}),_=A.useToggle(y);return(m,C)=>(e.openBlock(),e.createElementBlock("details",{id:e.unref(o),class:e.normalizeClass(e.unref(p)),open:e.unref(y),onClick:C[0]||(C[0]=e.withModifiers(L=>e.unref(_)(),["prevent"]))},[e.createElementVNode("summary",{"aria-controls":e.unref(o),"aria-expanded":e.unref(y),class:"vv-collapse__summary"},[e.renderSlot(m.$slots,"summary",e.normalizeProps(e.guardReactiveProps({open:e.unref(y)})),()=>[e.createTextVNode(e.toDisplayString(e.unref(l)),1)])],8,E),e.createElementVNode("div",{"aria-hidden":!e.unref(y),class:"vv-collapse__content"},[e.renderSlot(m.$slots,"details",e.normalizeProps(e.guardReactiveProps({open:e.unref(y)})),()=>[e.createTextVNode(e.toDisplayString(e.unref(u)),1)])],8,j)],10,O))}}),I={modelValue:[String,Array],items:{type:Array,default:()=>[]},collapse:Boolean,modifiers:[String,Array],itemModifiers:{type:[String,Array],default:""},disabled:Boolean},D=["update:modelValue"],N={name:"VvAccordionGroup"};return e.defineComponent({...N,props:I,emits:D,setup(t,{emit:r}){const n=t,{disabled:c,collapse:o,modifiers:d,itemModifiers:l,items:u}=e.toRefs(n);e.watchEffect(()=>{typeof n.modelValue=="string"&&o.value&&console.warn("[VvAccordionGroup]: modelValue is a string but collapse is true.")});const i=e.ref([]),f=e.computed({get:()=>{var s;return n.modelValue!==void 0?o.value?n.modelValue:Array.isArray(n.modelValue)?n.modelValue[0]:n.modelValue:o.value?i.value:(s=i.value)==null?void 0:s[0]},set:s=>{if(n.modelValue!==void 0)return(Array.isArray(n.modelValue)||o.value)&&!Array.isArray(s)&&(s=[s]),r("update:modelValue",s);i.value=Array.isArray(s)?s:[s]}});G({key:g,modelValue:f,disabled:c,collapse:o,modifiers:l});const{bemCssClasses:V}=b("vv-accordion-group",{modifiers:d,disabled:c});return(s,y)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(V))},[e.renderSlot(s.$slots,"default",{},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(u),p=>(e.openBlock(),e.createBlock(M,e.mergeProps({key:p.title},{name:p.name,title:p.title,content:p.content}),{header:e.withCtx(_=>[e.renderSlot(s.$slots,`header::${p.name}`,e.normalizeProps(e.guardReactiveProps(_)))]),details:e.withCtx(_=>[e.renderSlot(s.$slots,`details::${p.name}`,e.normalizeProps(e.guardReactiveProps(_)))]),_:2},1040))),128))])],2))}})});
1
+ (function(e,f){typeof exports=="object"&&typeof module<"u"?module.exports=f(require("vue"),require("nanoid")):typeof define=="function"&&define.amd?define(["vue","nanoid"],f):(e=typeof globalThis<"u"?globalThis:e||self,e.VvAccordionGroup=f(e.vue,e.nanoid))})(this,function(e,f){"use strict";const S="VV_ACCORDION_GROUP",C={name:String,title:String,content:String,modelValue:{type:Boolean,default:void 0},modifiers:[String,Array],disabled:Boolean},h=["update:modelValue"];function P(s,p){const{group:n,isInGroup:a,getGroupOrLocalRef:o}=useInjectedGroupState(S),{title:m,content:y}=toRefs(s),A=o("modelValue",s,p),d=o("disabled",s),u=o("collapse",s),t=o("modifiers",s);return{modelValue:A,disabled:d,isInGroup:a,group:n,collapse:u,modifiers:t,title:m,content:y}}const B=["id","open"],G=["aria-controls","aria-expanded"],k=["aria-hidden"],v={name:"VvAccordion"},R=e.defineComponent({...v,props:C,emits:h,setup(s,{emit:p}){const n=s,a=useAttrs(),o=n.name||(a==null?void 0:a.id)||f.nanoid(),{modifiers:m,title:y,content:A,disabled:d,collapse:u,modelValue:t,isInGroup:_}=P(n,p),r=ref(!1),c=computed({get:()=>_.value?u.value&&Array.isArray(t.value)?t.value.includes(o):t.value===o:t.value===void 0?r.value:t.value,set:i=>{if(_.value){if(u.value&&Array.isArray(t.value)){if(i){t.value.push(o);return}t.value=t.value.filter(g=>g!==o);return}t.value=i?o:null;return}if(t.value===void 0&&typeof i=="boolean"){r.value=i;return}t.value=i}}),{bemCssClasses:l}=useBemModifiers("vv-accordion",{modifiers:m,disabled:d}),V=useToggle(c);return(i,g)=>(e.openBlock(),e.createElementBlock("details",{id:e.unref(o),class:e.normalizeClass(e.unref(l)),open:e.unref(c),onClick:g[0]||(g[0]=e.withModifiers(M=>e.unref(V)(),["prevent"]))},[e.createElementVNode("summary",{"aria-controls":e.unref(o),"aria-expanded":e.unref(c),class:"vv-collapse__summary"},[e.renderSlot(i.$slots,"summary",e.normalizeProps(e.guardReactiveProps({open:e.unref(c)})),()=>[e.createTextVNode(e.toDisplayString(e.unref(y)),1)])],8,G),e.createElementVNode("div",{"aria-hidden":!e.unref(c),class:"vv-collapse__content"},[e.renderSlot(i.$slots,"details",e.normalizeProps(e.guardReactiveProps({open:e.unref(c)})),()=>[e.createTextVNode(e.toDisplayString(e.unref(A)),1)])],8,k)],10,B))}}),$={modelValue:[String,Array],items:{type:Array,default:()=>[]},collapse:Boolean,modifiers:[String,Array],itemModifiers:{type:[String,Array],default:""},disabled:Boolean},b=["update:modelValue"],E={name:"VvAccordionGroup"};return e.defineComponent({...E,props:$,emits:b,setup(s,{emit:p}){const n=s,{disabled:a,collapse:o,modifiers:m,itemModifiers:y,items:A}=toRefs(n);watchEffect(()=>{typeof n.modelValue=="string"&&o.value&&console.warn("[VvAccordionGroup]: modelValue is a string but collapse is true.")});const d=ref([]),u=computed({get:()=>{var r;return n.modelValue!==void 0?o.value?n.modelValue:Array.isArray(n.modelValue)?n.modelValue[0]:n.modelValue:o.value?d.value:(r=d.value)==null?void 0:r[0]},set:r=>{if(n.modelValue!==void 0)return(Array.isArray(n.modelValue)||o.value)&&!Array.isArray(r)&&(r=[r]),p("update:modelValue",r);d.value=Array.isArray(r)?r:[r]}}),t={key:S,modelValue:u,disabled:a,collapse:o,modifiers:y};useProvideGroupState(t);const{bemCssClasses:_}=useBemModifiers("vv-accordion-group",{modifiers:m,disabled:a});return(r,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(_))},[e.renderSlot(r.$slots,"default",{},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(A),l=>(e.openBlock(),e.createBlock(R,e.mergeProps({key:l.title},{name:l.name,title:l.title,content:l.content}),{header:e.withCtx(V=>[e.renderSlot(r.$slots,`header::${l.name}`,e.normalizeProps(e.guardReactiveProps(V)))]),details:e.withCtx(V=>[e.renderSlot(r.$slots,`details::${l.name}`,e.normalizeProps(e.guardReactiveProps(V)))]),_:2},1040))),128))])],2))}})});