@volverjs/ui-vue 0.0.3 → 0.0.4

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 (145) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +52 -13
  3. package/dist/Volver.d.ts +5 -1
  4. package/dist/components/VvAccordion/VvAccordion.es.js +113 -66
  5. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  6. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +159 -101
  7. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  8. package/dist/components/VvAction/VvAction.es.js +170 -0
  9. package/dist/components/VvAction/VvAction.umd.js +1 -0
  10. package/dist/components/VvAction/VvAction.vue.d.ts +63 -0
  11. package/dist/components/VvAction/index.d.ts +24 -0
  12. package/dist/components/VvBadge/VvBadge.es.js +86 -16
  13. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  14. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +97 -41
  15. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  16. package/dist/components/VvButton/VvButton.es.js +434 -251
  17. package/dist/components/VvButton/VvButton.umd.js +1 -1
  18. package/dist/components/VvButton/VvButton.vue.d.ts +50 -50
  19. package/dist/components/VvButton/index.d.ts +22 -67
  20. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +118 -43
  21. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  22. package/dist/components/VvCard/VvCard.es.js +38 -25
  23. package/dist/components/VvCard/VvCard.umd.js +1 -1
  24. package/dist/components/VvCheckbox/VvCheckbox.es.js +334 -154
  25. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  26. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +2 -2
  27. package/dist/components/VvCheckbox/index.d.ts +1 -1
  28. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +401 -204
  29. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  30. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +2 -2
  31. package/dist/components/VvCheckboxGroup/index.d.ts +1 -1
  32. package/dist/components/VvCombobox/VvCombobox.es.js +950 -594
  33. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  34. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +54 -30
  35. package/dist/components/VvCombobox/index.d.ts +18 -13
  36. package/dist/components/VvDialog/VvDialog.es.js +139 -64
  37. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  38. package/dist/components/VvDropdown/VvDropdown.es.js +276 -158
  39. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  40. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +9 -9
  41. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +61 -0
  42. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +52 -0
  43. package/dist/components/VvDropdown/index.d.ts +6 -9
  44. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +251 -0
  45. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -0
  46. package/dist/components/VvDropdownItem/VvDropdownItem.es.js +30 -15
  47. package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
  48. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +176 -0
  49. package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -0
  50. package/dist/components/VvIcon/VvIcon.es.js +48 -32
  51. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  52. package/dist/components/VvInputText/VvInputText.es.js +508 -344
  53. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  54. package/dist/components/VvInputText/VvInputText.vue.d.ts +11 -4
  55. package/dist/components/VvInputText/index.d.ts +13 -2
  56. package/dist/components/VvProgress/VvProgress.es.js +90 -20
  57. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  58. package/dist/components/VvRadio/VvRadio.es.js +305 -125
  59. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  60. package/dist/components/VvRadio/VvRadio.vue.d.ts +2 -2
  61. package/dist/components/VvRadio/index.d.ts +1 -1
  62. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +372 -175
  63. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  64. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +2 -2
  65. package/dist/components/VvRadioGroup/index.d.ts +1 -1
  66. package/dist/components/VvSelect/VvSelect.es.js +371 -216
  67. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  68. package/dist/components/VvSelect/VvSelect.vue.d.ts +11 -4
  69. package/dist/components/VvSelect/index.d.ts +5 -5
  70. package/dist/components/VvTextarea/VvTextarea.es.js +408 -244
  71. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  72. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +11 -4
  73. package/dist/components/VvTextarea/index.d.ts +5 -5
  74. package/dist/components/VvTooltip/VvTooltip.es.js +88 -18
  75. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
  76. package/dist/components/index.es.js +1913 -1521
  77. package/dist/components/index.umd.js +1 -1
  78. package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
  79. package/dist/composables/dropdown/useProvideDropdown.d.ts +2 -2
  80. package/dist/constants.d.ts +30 -0
  81. package/dist/directives/index.es.js +128 -0
  82. package/dist/directives/index.umd.js +1 -0
  83. package/dist/directives/v-tooltip.es.js +126 -0
  84. package/dist/directives/v-tooltip.umd.js +1 -0
  85. package/dist/icons.es.js +3 -3
  86. package/dist/icons.umd.js +1 -1
  87. package/dist/index.es.js +2102 -1761
  88. package/dist/index.umd.js +1 -1
  89. package/dist/props/index.d.ts +179 -11
  90. package/dist/resolvers/unplugin.d.ts +8 -8
  91. package/dist/resolvers/unplugin.es.js +51 -30
  92. package/dist/resolvers/unplugin.umd.js +1 -1
  93. package/dist/stories/Combobox/Combobox.settings.d.ts +44 -0
  94. package/dist/stories/Dropdown/Dropdown.settings.d.ts +3 -2
  95. package/package.json +60 -34
  96. package/src/Volver.ts +12 -5
  97. package/src/assets/icons/detailed.json +1 -1
  98. package/src/assets/icons/normal.json +1 -1
  99. package/src/assets/icons/simple.json +1 -1
  100. package/src/components/VvAction/VvAction.vue +144 -0
  101. package/src/components/VvAction/index.ts +5 -0
  102. package/src/components/VvButton/VvButton.vue +31 -114
  103. package/src/components/VvButton/index.ts +6 -79
  104. package/src/components/VvCombobox/VvCombobox.vue +54 -42
  105. package/src/components/VvCombobox/index.ts +11 -9
  106. package/src/components/VvDropdown/VvDropdownAction.vue +44 -0
  107. package/src/components/VvDropdown/VvDropdownOption.vue +65 -0
  108. package/src/components/VvDropdown/index.ts +4 -9
  109. package/src/components/VvSelect/index.ts +2 -4
  110. package/src/composables/dropdown/useInjectDropdown.ts +1 -1
  111. package/src/composables/dropdown/useProvideDropdown.ts +7 -9
  112. package/src/composables/useModifiers.ts +4 -7
  113. package/src/constants.ts +36 -0
  114. package/src/props/index.ts +106 -14
  115. package/src/resolvers/unplugin.ts +81 -48
  116. package/src/stories/Accordion/AccordionSlots.stories.mdx +2 -2
  117. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +2 -1
  118. package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +2 -1
  119. package/src/stories/Button/Button.stories.mdx +4 -2
  120. package/src/stories/Button/Button.test.ts +3 -1
  121. package/src/stories/Button/ButtonModifiers.stories.mdx +2 -2
  122. package/src/stories/Button/ButtonSlots.stories.mdx +8 -7
  123. package/src/stories/Button/ButtonState.stories.mdx +2 -11
  124. package/src/stories/Card/Card.stories.mdx +2 -1
  125. package/src/stories/Checkbox/Checkbox.stories.mdx +2 -1
  126. package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +2 -1
  127. package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +2 -1
  128. package/src/stories/Combobox/Combobox.settings.ts +44 -0
  129. package/src/stories/Combobox/Combobox.stories.mdx +40 -1
  130. package/src/stories/Dialog/Dialog.stories.mdx +2 -1
  131. package/src/stories/Dropdown/Dropdown.settings.ts +3 -2
  132. package/src/stories/Dropdown/Dropdown.stories.mdx +14 -12
  133. package/src/stories/Dropdown/DropdownMultilevel.stories.mdx +56 -0
  134. package/src/stories/Dropdown/DropdownSlots.stories.mdx +14 -13
  135. package/src/stories/Icon/Icon.stories.mdx +2 -1
  136. package/src/stories/Icon/IconsCollection.stories.mdx +2 -1
  137. package/src/stories/InputText/InputText.stories.mdx +2 -1
  138. package/src/stories/Progress/Progress.stories.mdx +2 -1
  139. package/src/stories/Radio/Radio.stories.mdx +2 -1
  140. package/src/stories/RadioGroup/RadioGroup.stories.mdx +2 -1
  141. package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +2 -1
  142. package/src/stories/Select/Select.stories.mdx +2 -1
  143. package/src/stories/Textarea/Textarea.stories.mdx +2 -1
  144. package/src/stories/Tooltip/Tooltip.stories.mdx +2 -1
  145. package/src/stories/Tooltip/TooltipDirective.stories.mdx +2 -1
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 volverjs
3
+ Copyright (c) 2022-2023 24/Consulting
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -26,13 +26,13 @@
26
26
 
27
27
  ```bash
28
28
  # pnpm
29
- pnpm add @volverjs/style @volverjs/ui-vue
29
+ pnpm add @volverjs/ui-vue
30
30
 
31
31
  # yarn
32
- yarn add @volverjs/style @volverjs/ui-vue
32
+ yarn add @volverjs/ui-vue
33
33
 
34
34
  # npm
35
- npm install @volverjs/style @volverjs/ui-vue --save
35
+ npm install @volverjs/ui-vue --save
36
36
  ```
37
37
 
38
38
  <br />
@@ -42,6 +42,7 @@ npm install @volverjs/style @volverjs/ui-vue --save
42
42
  Install the plugin in your `main.ts` file.
43
43
 
44
44
  ```typescript
45
+ // main.ts
45
46
  import { createApp } from 'vue'
46
47
  import App from './App.vue'
47
48
 
@@ -50,19 +51,38 @@ import { VolverPlugin } from '@volverjs/ui-vue'
50
51
  // import @volverjs/ui-vue icons collections
51
52
  import iconsCollections from '@volverjs/ui-vue/icons'
52
53
  /*
53
- * import @volverjs/style reset and props
54
- * for scss support you can import the scss files
55
- * import '@volverjs/style/scss/reset'
56
- * import '@volverjs/style/scss/props'
54
+ * import @volverjs/style base style with reset and props
55
+ * for scss support you can import the scss file
56
+ * import '@volverjs/style/scss/base'
57
57
  */
58
- import '@volverjs/style/reset'
59
- import '@volverjs/style/props'
58
+ import '@volverjs/style/base'
60
59
 
61
60
  const app = createApp(App).mount('#app')
62
61
 
63
62
  // install the plugin
64
63
  app.use(VolverPlugin, {
65
- iconsCollections
64
+ iconsCollections,
65
+ /*
66
+ * if you want can import components globally
67
+ * components: { VvButton, VvInputText }
68
+ */
69
+ compoments: undefined,
70
+ /*
71
+ * if you want can import directives globally
72
+ * directives: { toolip: VTooltip }
73
+ */
74
+ directives: undefined,
75
+ /*
76
+ * if you want can create components aliases
77
+ * aliases: { Btn: VvButton, BtnDanger: VvButton}
78
+ */
79
+ aliases: undefined,
80
+ /*
81
+ * if you want can change default props
82
+ * for globally imported components and aliases
83
+ * defaults: { VvButton: { modifiers: 'secondary', BtnDanger: { modifiers: 'danger' } }
84
+ */
85
+ defaults: undefined
66
86
  })
67
87
  ```
68
88
 
@@ -70,6 +90,12 @@ Than you can import components and use them in your templates.
70
90
 
71
91
  ```html
72
92
  <script setup lang="ts">
93
+ // MyComponent.vue
94
+ /*
95
+ * import the component
96
+ * all components are also available with a dedicated export
97
+ * import VvButton from '@volverjs/ui-vue/vv-button'
98
+ */
73
99
  import { VvButton } from '@volverjs/ui-vue'
74
100
  /*
75
101
  * import the component style
@@ -107,9 +133,22 @@ export default defineConfig({
107
133
  Components({
108
134
  resolvers: [
109
135
  VolverResolver({
110
- // enable/disable import of style
111
- // default: false
112
- importStyle: 'css' // or 'scss'
136
+ /*
137
+ * enable/disable auto import of components style
138
+ * also accept 'scss' for scss support
139
+ * default: false
140
+ */
141
+ importStyle: false,
142
+ /*
143
+ * enable/disable auto import of directives
144
+ * default: false
145
+ */
146
+ directives: false,
147
+ /*
148
+ * Change components prefix
149
+ * default: 'vv'
150
+ */
151
+ prefix: 'vv'
113
152
  })
114
153
  ]
115
154
  })
package/dist/Volver.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type IconifyIcon, type IconifyJSON, type PartialIconifyAPIConfig } from '@iconify/vue';
2
- import type { Component, Plugin } from 'vue';
2
+ import type { Component, Directive, Plugin } from 'vue';
3
3
  export declare function useDefaultProps(component: Component, defaults?: Record<string, unknown>, name?: string): Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
4
4
  export type DefaultOptions = Record<string, Record<string, unknown>>;
5
5
  export type VolverOptions = {
@@ -34,6 +34,10 @@ export type VolverOptions = {
34
34
  * Alias to install
35
35
  */
36
36
  aliases?: Record<string, Component>;
37
+ /**
38
+ * Directives to install
39
+ */
40
+ directives?: Record<string, Directive>;
37
41
  /**
38
42
  * Default props for components
39
43
  */
@@ -1,6 +1,41 @@
1
- import { defineComponent as h, openBlock as I, createElementBlock as N, unref as t, normalizeClass as O, withModifiers as B, createElementVNode as y, renderSlot as g, normalizeProps as A, guardReactiveProps as C, createTextVNode as b, toDisplayString as S } from "vue";
2
- import { nanoid as E } from "nanoid";
3
- const P = Symbol.for("accordionGroup"), R = {
1
+ import { unref as r, inject as E, computed as i, toRef as S, toRefs as $, defineComponent as I, useAttrs as V, ref as j, openBlock as k, createElementBlock as B, normalizeClass as N, withModifiers as P, createElementVNode as g, renderSlot as A, normalizeProps as b, guardReactiveProps as C, createTextVNode as G, toDisplayString as O } from "vue";
2
+ import { nanoid as D } from "nanoid";
3
+ import { useToggle as M } from "@vueuse/core";
4
+ const T = Symbol.for("accordionGroup");
5
+ function z(o) {
6
+ return ((e) => e == null || e === "" || Array.isArray(e) && e.length === 0 || !(e instanceof Date) && typeof e == "object" && Object.keys(e).length === 0)(r(o));
7
+ }
8
+ function L(o) {
9
+ const e = E(o, void 0), l = i(() => !z(e));
10
+ function a(t, s, d) {
11
+ if (e != null && e.value) {
12
+ const u = r(e.value)[t];
13
+ return i({
14
+ get() {
15
+ return u == null ? void 0 : u.value;
16
+ },
17
+ set(v) {
18
+ u.value = v;
19
+ }
20
+ });
21
+ }
22
+ const p = S(s, t);
23
+ return i({
24
+ get() {
25
+ return p.value;
26
+ },
27
+ set(u) {
28
+ d && d(`update:${t}`, u);
29
+ }
30
+ });
31
+ }
32
+ return {
33
+ group: e,
34
+ isInGroup: l,
35
+ getGroupOrLocalRef: a
36
+ };
37
+ }
38
+ const x = {
4
39
  /**
5
40
  * Accordion name
6
41
  */
@@ -28,97 +63,109 @@ const P = Symbol.for("accordionGroup"), R = {
28
63
  * If true, the accordion will be disabled
29
64
  */
30
65
  disabled: Boolean
31
- }, k = ["update:modelValue"];
32
- function x(n, d) {
33
- const { group: l, isInGroup: s, getGroupOrLocalRef: o } = useInjectedGroupState(
34
- P
35
- ), { title: c, content: v } = toRefs(n), m = o("modelValue", n, d), p = o("disabled", n), i = o("collapse", n), e = o("modifiers", n);
66
+ }, J = ["update:modelValue"];
67
+ function K(o, e) {
68
+ const { group: l, isInGroup: a, getGroupOrLocalRef: t } = L(
69
+ T
70
+ ), { title: s, content: d } = $(o), p = t("modelValue", o, e), u = t("disabled", o), v = t("collapse", o), n = t("modifiers", o);
36
71
  return {
37
72
  // group props
38
- modelValue: m,
39
- disabled: p,
40
- isInGroup: s,
73
+ modelValue: p,
74
+ disabled: u,
75
+ isInGroup: a,
41
76
  group: l,
42
- collapse: i,
43
- modifiers: e,
77
+ collapse: v,
78
+ modifiers: n,
44
79
  // local props
45
- title: c,
46
- content: v
80
+ title: s,
81
+ content: d
47
82
  };
48
83
  }
49
- const M = ["id", "open"], T = ["aria-controls", "aria-expanded"], $ = ["aria-hidden"], z = {
84
+ function U(o, e, l) {
85
+ return i(() => {
86
+ const a = {
87
+ [o]: !0
88
+ }, t = typeof (e == null ? void 0 : e.value) == "string" ? e.value.split(" ") : e == null ? void 0 : e.value;
89
+ return t && Array.isArray(t) && t.forEach((s) => {
90
+ a[`${o}--${s}`] = !0;
91
+ }), l && Object.keys(l.value).forEach((s) => {
92
+ a[`${o}--${s}`] = r(l.value[s]);
93
+ }), a;
94
+ });
95
+ }
96
+ const Y = ["id", "open"], q = ["aria-controls", "aria-expanded"], F = ["aria-hidden"], H = {
50
97
  name: "VvAccordion"
51
- }, K = /* @__PURE__ */ h({
52
- ...z,
53
- props: R,
54
- emits: k,
55
- setup(n, { emit: d }) {
56
- const l = n, s = useAttrs(), o = computed(
57
- () => l.name || (s == null ? void 0 : s.id) || E()
98
+ }, w = /* @__PURE__ */ I({
99
+ ...H,
100
+ props: x,
101
+ emits: J,
102
+ setup(o, { emit: e }) {
103
+ const l = o, a = V(), t = i(
104
+ () => l.name || (a == null ? void 0 : a.id) || D()
58
105
  ), {
59
- modifiers: c,
60
- title: v,
61
- content: m,
62
- disabled: p,
63
- collapse: i,
64
- modelValue: e,
65
- isInGroup: f
66
- } = x(l, d), _ = ref(!1), r = computed({
67
- get: () => f.value ? i.value && Array.isArray(e.value) ? e.value.includes(o.value) : e.value === o.value : e.value === void 0 ? _.value : e.value,
68
- set: (a) => {
69
- if (f.value) {
70
- if (i.value && Array.isArray(e.value)) {
71
- if (a) {
72
- e.value.push(o.value);
106
+ modifiers: s,
107
+ title: d,
108
+ content: p,
109
+ disabled: u,
110
+ collapse: v,
111
+ modelValue: n,
112
+ isInGroup: y
113
+ } = K(l, e), _ = j(!1), f = i({
114
+ get: () => y.value ? v.value && Array.isArray(n.value) ? n.value.includes(t.value) : n.value === t.value : n.value === void 0 ? _.value : n.value,
115
+ set: (c) => {
116
+ if (y.value) {
117
+ if (v.value && Array.isArray(n.value)) {
118
+ if (c) {
119
+ n.value.push(t.value);
73
120
  return;
74
121
  }
75
- e.value = e.value.filter(
76
- (u) => u !== o.value
122
+ n.value = n.value.filter(
123
+ (m) => m !== t.value
77
124
  );
78
125
  return;
79
126
  }
80
- e.value = a ? o.value : null;
127
+ n.value = c ? t.value : null;
81
128
  return;
82
129
  }
83
- if (e.value === void 0 && typeof a == "boolean") {
84
- _.value = a;
130
+ if (n.value === void 0 && typeof c == "boolean") {
131
+ _.value = c;
85
132
  return;
86
133
  }
87
- e.value = a;
134
+ n.value = c;
88
135
  }
89
- }), G = useBemModifiers(
136
+ }), R = U(
90
137
  "vv-accordion",
91
- c,
92
- computed(() => ({
93
- disabled: p.value
138
+ s,
139
+ i(() => ({
140
+ disabled: u.value
94
141
  }))
95
- ), V = useToggle(r);
96
- return (a, u) => (I(), N("details", {
97
- id: t(o),
98
- class: O(t(G)),
99
- open: t(r),
100
- onClick: u[0] || (u[0] = B((D) => t(V)(), ["prevent"]))
142
+ ), h = M(f);
143
+ return (c, m) => (k(), B("details", {
144
+ id: r(t),
145
+ class: N(r(R)),
146
+ open: r(f),
147
+ onClick: m[0] || (m[0] = P((Q) => r(h)(), ["prevent"]))
101
148
  }, [
102
- y("summary", {
103
- "aria-controls": t(o),
104
- "aria-expanded": t(r),
149
+ g("summary", {
150
+ "aria-controls": r(t),
151
+ "aria-expanded": r(f),
105
152
  class: "vv-collapse__summary"
106
153
  }, [
107
- g(a.$slots, "summary", A(C({ open: t(r) })), () => [
108
- b(S(t(v)), 1)
154
+ A(c.$slots, "summary", b(C({ open: r(f) })), () => [
155
+ G(O(r(d)), 1)
109
156
  ])
110
- ], 8, T),
111
- y("div", {
112
- "aria-hidden": !t(r),
157
+ ], 8, q),
158
+ g("div", {
159
+ "aria-hidden": !r(f),
113
160
  class: "vv-collapse__content"
114
161
  }, [
115
- g(a.$slots, "details", A(C({ open: t(r) })), () => [
116
- b(S(t(m)), 1)
162
+ A(c.$slots, "details", b(C({ open: r(f) })), () => [
163
+ G(O(r(p)), 1)
117
164
  ])
118
- ], 8, $)
119
- ], 10, M));
165
+ ], 8, F)
166
+ ], 10, Y));
120
167
  }
121
168
  });
122
169
  export {
123
- K as default
170
+ w as default
124
171
  };
@@ -1 +1 @@
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 g=Symbol.for("accordionGroup"),A={name:String,title:String,content:String,modelValue:{type:Boolean,default:void 0},modifiers:[String,Array],disabled:Boolean},S=["update:modelValue"];function V(r,u){const{group:l,isInGroup:a,getGroupOrLocalRef:n}=useInjectedGroupState(g),{title:f,content:p}=toRefs(r),m=n("modelValue",r,u),v=n("disabled",r),d=n("collapse",r),o=n("modifiers",r);return{modelValue:m,disabled:v,isInGroup:a,group:l,collapse:d,modifiers:o,title:f,content:p}}const h=["id","open"],C=["aria-controls","aria-expanded"],N=["aria-hidden"],b={name:"VvAccordion"};return e.defineComponent({...b,props:A,emits:S,setup(r,{emit:u}){const l=r,a=useAttrs(),n=computed(()=>l.name||(a==null?void 0:a.id)||s.nanoid()),{modifiers:f,title:p,content:m,disabled:v,collapse:d,modelValue:o,isInGroup:_}=V(l,u),y=ref(!1),i=computed({get:()=>_.value?d.value&&Array.isArray(o.value)?o.value.includes(n.value):o.value===n.value:o.value===void 0?y.value:o.value,set:t=>{if(_.value){if(d.value&&Array.isArray(o.value)){if(t){o.value.push(n.value);return}o.value=o.value.filter(c=>c!==n.value);return}o.value=t?n.value:null;return}if(o.value===void 0&&typeof t=="boolean"){y.value=t;return}o.value=t}}),G=useBemModifiers("vv-accordion",f,computed(()=>({disabled:v.value}))),P=useToggle(i);return(t,c)=>(e.openBlock(),e.createElementBlock("details",{id:e.unref(n),class:e.normalizeClass(e.unref(G)),open:e.unref(i),onClick:c[0]||(c[0]=e.withModifiers(I=>e.unref(P)(),["prevent"]))},[e.createElementVNode("summary",{"aria-controls":e.unref(n),"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,C),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,N)],10,h))}})});
1
+ (function(e,p){typeof exports=="object"&&typeof module<"u"?module.exports=p(require("vue"),require("nanoid"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["vue","nanoid","@vueuse/core"],p):(e=typeof globalThis<"u"?globalThis:e||self,e.VvAccordion=p(e.vue,e.nanoid,e.core))})(this,function(e,p,g){"use strict";const h=Symbol.for("accordionGroup");function v(o){return(n=>n==null||n===""||Array.isArray(n)&&n.length===0||!(n instanceof Date)&&typeof n=="object"&&Object.keys(n).length===0)(e.unref(o))}function R(o){const n=e.inject(o,void 0),s=e.computed(()=>!v(n));function a(t,i,u){if(n!=null&&n.value){const c=e.unref(n.value)[t];return e.computed({get(){return c==null?void 0:c.value},set(d){c.value=d}})}const m=e.toRef(i,t);return e.computed({get(){return m.value},set(c){u&&u(`update:${t}`,c)}})}return{group:n,isInGroup:s,getGroupOrLocalRef:a}}const S={name:String,title:String,content:String,modelValue:{type:Boolean,default:void 0},modifiers:[String,Array],disabled:Boolean},b=["update:modelValue"];function C(o,n){const{group:s,isInGroup:a,getGroupOrLocalRef:t}=R(h),{title:i,content:u}=e.toRefs(o),m=t("modelValue",o,n),c=t("disabled",o),d=t("collapse",o),r=t("modifiers",o);return{modelValue:m,disabled:c,isInGroup:a,group:s,collapse:d,modifiers:r,title:i,content:u}}function E(o,n,s){return e.computed(()=>{const a={[o]:!0},t=typeof(n==null?void 0:n.value)=="string"?n.value.split(" "):n==null?void 0:n.value;return t&&Array.isArray(t)&&t.forEach(i=>{a[`${o}--${i}`]=!0}),s&&Object.keys(s.value).forEach(i=>{a[`${o}--${i}`]=e.unref(s.value[i])}),a})}const G=["id","open"],O=["aria-controls","aria-expanded"],V=["aria-hidden"],$={name:"VvAccordion"};return e.defineComponent({...$,props:S,emits:b,setup(o,{emit:n}){const s=o,a=e.useAttrs(),t=e.computed(()=>s.name||(a==null?void 0:a.id)||p.nanoid()),{modifiers:i,title:u,content:m,disabled:c,collapse:d,modelValue:r,isInGroup:_}=C(s,n),A=e.ref(!1),f=e.computed({get:()=>_.value?d.value&&Array.isArray(r.value)?r.value.includes(t.value):r.value===t.value:r.value===void 0?A.value:r.value,set:l=>{if(_.value){if(d.value&&Array.isArray(r.value)){if(l){r.value.push(t.value);return}r.value=r.value.filter(y=>y!==t.value);return}r.value=l?t.value:null;return}if(r.value===void 0&&typeof l=="boolean"){A.value=l;return}r.value=l}}),I=E("vv-accordion",i,e.computed(()=>({disabled:c.value}))),j=g.useToggle(f);return(l,y)=>(e.openBlock(),e.createElementBlock("details",{id:e.unref(t),class:e.normalizeClass(e.unref(I)),open:e.unref(f),onClick:y[0]||(y[0]=e.withModifiers(P=>e.unref(j)(),["prevent"]))},[e.createElementVNode("summary",{"aria-controls":e.unref(t),"aria-expanded":e.unref(f),class:"vv-collapse__summary"},[e.renderSlot(l.$slots,"summary",e.normalizeProps(e.guardReactiveProps({open:e.unref(f)})),()=>[e.createTextVNode(e.toDisplayString(e.unref(u)),1)])],8,O),e.createElementVNode("div",{"aria-hidden":!e.unref(f),class:"vv-collapse__content"},[e.renderSlot(l.$slots,"details",e.normalizeProps(e.guardReactiveProps({open:e.unref(f)})),()=>[e.createTextVNode(e.toDisplayString(e.unref(m)),1)])],8,V)],10,G))}})});