@volverjs/ui-vue 0.0.3 → 0.0.5-beta.1

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 (236) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +54 -15
  3. package/auto-imports.d.ts +12 -3
  4. package/bin/icons.cjs +1 -73
  5. package/dist/Volver.d.ts +23 -11
  6. package/dist/components/VvAccordion/VvAccordion.es.js +180 -74
  7. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  8. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -1
  9. package/dist/components/VvAccordion/index.d.ts +8 -3
  10. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +280 -122
  11. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  12. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +15 -12
  13. package/dist/components/VvAccordionGroup/index.d.ts +8 -0
  14. package/dist/components/VvAction/VvAction.es.js +338 -0
  15. package/dist/components/VvAction/VvAction.umd.js +1 -0
  16. package/dist/components/VvAction/VvAction.vue.d.ts +63 -0
  17. package/dist/components/VvAction/index.d.ts +24 -0
  18. package/dist/components/VvBadge/VvBadge.es.js +251 -22
  19. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  20. package/dist/components/VvBadge/VvBadge.vue.d.ts +2 -2
  21. package/dist/components/VvBadge/index.d.ts +1 -1
  22. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +280 -62
  23. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  24. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +11 -11
  25. package/dist/components/VvBreadcrumb/index.d.ts +1 -1
  26. package/dist/components/VvButton/VvButton.es.js +720 -261
  27. package/dist/components/VvButton/VvButton.umd.js +1 -1
  28. package/dist/components/VvButton/VvButton.vue.d.ts +54 -54
  29. package/dist/components/VvButton/index.d.ts +30 -75
  30. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +296 -49
  31. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  32. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +2 -2
  33. package/dist/components/VvButtonGroup/index.d.ts +1 -1
  34. package/dist/components/VvCard/VvCard.es.js +60 -28
  35. package/dist/components/VvCard/VvCard.umd.js +1 -1
  36. package/dist/components/VvCheckbox/VvCheckbox.es.js +630 -172
  37. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  38. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +4 -4
  39. package/dist/components/VvCheckbox/index.d.ts +6 -6
  40. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +736 -228
  41. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  42. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +9 -9
  43. package/dist/components/VvCheckboxGroup/index.d.ts +4 -4
  44. package/dist/components/VvCombobox/VvCombobox.es.js +1673 -768
  45. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  46. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +159 -61
  47. package/dist/components/VvCombobox/index.d.ts +54 -23
  48. package/dist/components/VvDialog/VvDialog.es.js +426 -115
  49. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  50. package/dist/components/VvDialog/VvDialog.vue.d.ts +12 -3
  51. package/dist/components/VvDialog/index.d.ts +4 -1
  52. package/dist/components/VvDropdown/VvDropdown.es.js +504 -190
  53. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  54. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +114 -42
  55. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +61 -0
  56. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +52 -0
  57. package/dist/components/VvDropdown/index.d.ts +35 -14
  58. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +454 -0
  59. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -0
  60. package/dist/components/VvDropdownItem/VvDropdownItem.es.js +48 -18
  61. package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
  62. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +361 -0
  63. package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -0
  64. package/dist/components/VvIcon/VvIcon.es.js +116 -52
  65. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  66. package/dist/components/VvIcon/VvIcon.vue.d.ts +7 -7
  67. package/dist/components/VvIcon/index.d.ts +2 -2
  68. package/dist/components/VvInputText/VvInputPasswordAction.d.ts +2 -2
  69. package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
  70. package/dist/components/VvInputText/VvInputText.es.js +1054 -376
  71. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  72. package/dist/components/VvInputText/VvInputText.vue.d.ts +107 -20
  73. package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
  74. package/dist/components/VvInputText/index.d.ts +67 -3
  75. package/dist/components/VvProgress/VvProgress.es.js +254 -23
  76. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  77. package/dist/components/VvProgress/VvProgress.vue.d.ts +2 -2
  78. package/dist/components/VvProgress/index.d.ts +1 -1
  79. package/dist/components/VvRadio/VvRadio.es.js +568 -137
  80. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  81. package/dist/components/VvRadio/VvRadio.vue.d.ts +4 -4
  82. package/dist/components/VvRadio/index.d.ts +6 -6
  83. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +674 -193
  84. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  85. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +9 -9
  86. package/dist/components/VvRadioGroup/index.d.ts +4 -4
  87. package/dist/components/VvSelect/VvSelect.es.js +703 -251
  88. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  89. package/dist/components/VvSelect/VvSelect.vue.d.ts +24 -17
  90. package/dist/components/VvSelect/index.d.ts +8 -8
  91. package/dist/components/VvTextarea/VvTextarea.es.js +747 -272
  92. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  93. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +21 -14
  94. package/dist/components/VvTextarea/index.d.ts +7 -7
  95. package/dist/components/VvTooltip/VvTooltip.es.js +252 -24
  96. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
  97. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +7 -7
  98. package/dist/components/VvTooltip/index.d.ts +2 -2
  99. package/dist/components/index.es.js +3676 -2007
  100. package/dist/components/index.umd.js +1 -1
  101. package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
  102. package/dist/composables/dropdown/useProvideDropdown.d.ts +3 -3
  103. package/dist/composables/group/useInjectedGroupState.d.ts +2 -2
  104. package/dist/composables/group/useProvideGroupState.d.ts +1 -1
  105. package/dist/composables/useComponentFocus.d.ts +1 -1
  106. package/dist/composables/useComponentIcon.d.ts +7 -7
  107. package/dist/composables/useDebouncedInput.d.ts +4 -1
  108. package/dist/composables/useDefaults.d.ts +2 -0
  109. package/dist/composables/useModifiers.d.ts +1 -1
  110. package/dist/composables/useOptions.d.ts +2 -2
  111. package/dist/composables/useTextCount.d.ts +3 -3
  112. package/dist/composables/useUniqueId.d.ts +1 -1
  113. package/dist/composables/useVolver.d.ts +1 -1
  114. package/dist/constants.d.ts +30 -0
  115. package/dist/directives/index.es.js +288 -0
  116. package/dist/directives/index.umd.js +1 -0
  117. package/dist/directives/v-tooltip.es.js +285 -0
  118. package/dist/directives/v-tooltip.umd.js +1 -0
  119. package/dist/icons.es.js +38 -23
  120. package/dist/icons.umd.js +1 -1
  121. package/dist/index.d.ts +0 -1
  122. package/dist/index.es.js +115 -3269
  123. package/dist/index.umd.js +1 -1
  124. package/dist/props/index.d.ts +215 -23
  125. package/dist/resolvers/unplugin.d.ts +14 -8
  126. package/dist/resolvers/unplugin.es.js +94 -33
  127. package/dist/resolvers/unplugin.umd.js +1 -1
  128. package/dist/stories/Combobox/Combobox.settings.d.ts +44 -0
  129. package/dist/stories/Dropdown/Dropdown.settings.d.ts +3 -2
  130. package/dist/stories/InputText/InputText.settings.d.ts +53 -0
  131. package/dist/stories/argTypes.d.ts +1 -1
  132. package/package.json +167 -63
  133. package/src/Volver.ts +60 -26
  134. package/src/assets/icons/detailed.json +1 -1
  135. package/src/assets/icons/normal.json +1 -1
  136. package/src/assets/icons/simple.json +1 -1
  137. package/src/components/VvAccordion/VvAccordion.vue +19 -22
  138. package/src/components/VvAccordion/index.ts +12 -4
  139. package/src/components/VvAccordionGroup/VvAccordionGroup.vue +19 -10
  140. package/src/components/VvAccordionGroup/index.ts +8 -0
  141. package/src/components/VvAction/VvAction.vue +144 -0
  142. package/src/components/VvAction/index.ts +5 -0
  143. package/src/components/VvBadge/VvBadge.vue +2 -2
  144. package/src/components/VvBadge/index.ts +1 -1
  145. package/src/components/VvBreadcrumb/VvBreadcrumb.vue +3 -3
  146. package/src/components/VvButton/VvButton.vue +41 -124
  147. package/src/components/VvButton/index.ts +16 -88
  148. package/src/components/VvButtonGroup/VvButtonGroup.vue +4 -7
  149. package/src/components/VvButtonGroup/index.ts +1 -1
  150. package/src/components/VvCard/VvCard.vue +2 -2
  151. package/src/components/VvCheckbox/VvCheckbox.vue +3 -7
  152. package/src/components/VvCheckbox/index.ts +11 -7
  153. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +7 -10
  154. package/src/components/VvCheckboxGroup/index.ts +1 -1
  155. package/src/components/VvCombobox/VvCombobox.vue +85 -57
  156. package/src/components/VvCombobox/index.ts +12 -10
  157. package/src/components/VvDialog/VvDialog.vue +28 -11
  158. package/src/components/VvDialog/index.ts +5 -2
  159. package/src/components/VvDropdown/VvDropdown.vue +6 -5
  160. package/src/components/VvDropdown/VvDropdownAction.vue +46 -0
  161. package/src/components/VvDropdown/VvDropdownOption.vue +72 -0
  162. package/src/components/VvDropdown/index.ts +6 -11
  163. package/src/components/VvIcon/VvIcon.vue +3 -3
  164. package/src/components/VvIcon/index.ts +3 -3
  165. package/src/components/VvInputText/VvInputClearAction.ts +2 -2
  166. package/src/components/VvInputText/VvInputPasswordAction.ts +3 -4
  167. package/src/components/VvInputText/VvInputStepAction.ts +3 -2
  168. package/src/components/VvInputText/VvInputText.vue +128 -35
  169. package/src/components/VvInputText/VvInputTextActions.ts +5 -8
  170. package/src/components/VvInputText/index.ts +62 -1
  171. package/src/components/VvProgress/VvProgress.vue +2 -2
  172. package/src/components/VvProgress/index.ts +1 -1
  173. package/src/components/VvRadio/VvRadio.vue +3 -7
  174. package/src/components/VvRadio/index.ts +11 -7
  175. package/src/components/VvRadioGroup/VvRadioGroup.vue +7 -10
  176. package/src/components/VvRadioGroup/index.ts +1 -1
  177. package/src/components/VvSelect/VvSelect.vue +4 -4
  178. package/src/components/VvSelect/index.ts +3 -5
  179. package/src/components/VvTextarea/VvTextarea.vue +4 -4
  180. package/src/components/VvTextarea/index.ts +1 -1
  181. package/src/components/VvTooltip/VvTooltip.vue +2 -2
  182. package/src/components/VvTooltip/index.ts +3 -3
  183. package/src/composables/dropdown/useInjectDropdown.ts +2 -2
  184. package/src/composables/dropdown/useProvideDropdown.ts +9 -11
  185. package/src/composables/group/useInjectedGroupState.ts +1 -1
  186. package/src/composables/group/useProvideGroupState.ts +1 -1
  187. package/src/composables/useComponentIcon.ts +1 -1
  188. package/src/composables/useDebouncedInput.ts +10 -3
  189. package/src/composables/useDefaults.ts +89 -0
  190. package/src/composables/useModifiers.ts +8 -9
  191. package/src/composables/useOptions.ts +1 -1
  192. package/src/composables/useVolver.ts +2 -2
  193. package/src/constants.ts +36 -0
  194. package/src/directives/index.ts +1 -1
  195. package/src/directives/v-tooltip.ts +2 -2
  196. package/src/index.ts +0 -2
  197. package/src/props/index.ts +111 -19
  198. package/src/resolvers/unplugin.ts +96 -49
  199. package/src/stories/Accordion/Accordion.stories.mdx +8 -2
  200. package/src/stories/Accordion/Accordion.test.ts +21 -15
  201. package/src/stories/Accordion/AccordionSlots.stories.mdx +8 -8
  202. package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +17 -1
  203. package/src/stories/AccordionGroup/AccordionGroup.test.ts +18 -12
  204. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +3 -2
  205. package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +2 -1
  206. package/src/stories/Button/Button.stories.mdx +4 -2
  207. package/src/stories/Button/Button.test.ts +3 -1
  208. package/src/stories/Button/ButtonModifiers.stories.mdx +2 -2
  209. package/src/stories/Button/ButtonSlots.stories.mdx +8 -7
  210. package/src/stories/Button/ButtonState.stories.mdx +2 -11
  211. package/src/stories/Card/Card.stories.mdx +2 -1
  212. package/src/stories/Checkbox/Checkbox.stories.mdx +2 -1
  213. package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +2 -1
  214. package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +2 -1
  215. package/src/stories/Combobox/Combobox.settings.ts +44 -0
  216. package/src/stories/Combobox/Combobox.stories.mdx +40 -1
  217. package/src/stories/Dialog/Dialog.stories.mdx +2 -1
  218. package/src/stories/Dropdown/Dropdown.settings.ts +3 -2
  219. package/src/stories/Dropdown/Dropdown.stories.mdx +14 -12
  220. package/src/stories/Dropdown/DropdownMultilevel.stories.mdx +56 -0
  221. package/src/stories/Dropdown/DropdownSlots.stories.mdx +14 -13
  222. package/src/stories/Icon/Icon.stories.mdx +2 -1
  223. package/src/stories/Icon/IconsCollection.stories.mdx +2 -1
  224. package/src/stories/InputText/InputText.settings.ts +53 -0
  225. package/src/stories/InputText/InputText.stories.mdx +42 -1
  226. package/src/stories/InputText/InputText.test.ts +5 -2
  227. package/src/stories/Progress/Progress.stories.mdx +2 -1
  228. package/src/stories/Radio/Radio.stories.mdx +2 -1
  229. package/src/stories/RadioGroup/RadioGroup.stories.mdx +2 -1
  230. package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +2 -1
  231. package/src/stories/Select/Select.stories.mdx +2 -1
  232. package/src/stories/Textarea/Textarea.stories.mdx +2 -1
  233. package/src/stories/Tooltip/Tooltip.stories.mdx +2 -1
  234. package/src/stories/Tooltip/TooltipDirective.stories.mdx +2 -1
  235. package/src/stories/argTypes.ts +2 -2
  236. package/src/types/group.d.ts +5 -0
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,7 +90,13 @@ Than you can import components and use them in your templates.
70
90
 
71
91
  ```html
72
92
  <script setup lang="ts">
73
- import { VvButton } from '@volverjs/ui-vue'
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
+ */
99
+ import { VvButton } from '@volverjs/ui-vue/components'
74
100
  /*
75
101
  * import the component style
76
102
  * for scss support you can import the scss file
@@ -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
  })
@@ -124,12 +163,12 @@ The following features are planned for the next releases:
124
163
  - [x] (v0.0.3) `VvTooltip` component and `v-tooltip` directive;
125
164
  - [x] (v0.0.3) Redesign of `VvCombobox` for better accessibility and more features;
126
165
  - [x] (v0.0.3) Rewrite of `VvDropdown` to get it applicable to any element;
166
+ - [x] (v0.0.5) Input masks for `VvInputText` component;
127
167
  - [ ] `VvAvatar` component;
128
168
  - [ ] `VvAvatarGroup` component;
129
169
  - [ ] Alerts, notifications and toasts with `VvAlert` and `VvToast` component;
130
170
  - [ ] Loaders with `VvLoader` and `VvSkeleton`;
131
171
  - [ ] Menus, navigation and tabs with `VvNav`;
132
- - [ ] Input masks for `VvInputText` component;
133
172
  - [ ] `VvTable` component with sort, filters, pagination and cell editing;
134
173
  - [ ] Multiple uploads, image crop and file previews with `VvInputFile`;
135
174
  - [ ] Carousel and galleries with `VvCarousel` component;
package/auto-imports.d.ts CHANGED
@@ -1,4 +1,7 @@
1
- // Generated by 'unplugin-auto-import'
1
+ /* eslint-disable */
2
+ /* prettier-ignore */
3
+ // @ts-nocheck
4
+ // Generated by unplugin-auto-import
2
5
  export {}
3
6
  declare global {
4
7
  const EffectScope: typeof import('vue')['EffectScope']
@@ -84,7 +87,6 @@ declare global {
84
87
  const refWithControl: typeof import('@vueuse/core')['refWithControl']
85
88
  const removeFromList: typeof import('./src/utils/ObjectUtilities')['removeFromList']
86
89
  const resolveComponent: typeof import('vue')['resolveComponent']
87
- const resolveDirective: typeof import('vue')['resolveDirective']
88
90
  const resolveFieldData: typeof import('./src/utils/ObjectUtilities')['resolveFieldData']
89
91
  const resolveRef: typeof import('@vueuse/core')['resolveRef']
90
92
  const resolveUnref: typeof import('@vueuse/core')['resolveUnref']
@@ -114,6 +116,7 @@ declare global {
114
116
  const useArrayFilter: typeof import('@vueuse/core')['useArrayFilter']
115
117
  const useArrayFind: typeof import('@vueuse/core')['useArrayFind']
116
118
  const useArrayFindIndex: typeof import('@vueuse/core')['useArrayFindIndex']
119
+ const useArrayFindLast: typeof import('@vueuse/core')['useArrayFindLast']
117
120
  const useArrayJoin: typeof import('@vueuse/core')['useArrayJoin']
118
121
  const useArrayMap: typeof import('@vueuse/core')['useArrayMap']
119
122
  const useArrayReduce: typeof import('@vueuse/core')['useArrayReduce']
@@ -124,7 +127,6 @@ declare global {
124
127
  const useAttrs: typeof import('vue')['useAttrs']
125
128
  const useBase64: typeof import('@vueuse/core')['useBase64']
126
129
  const useBattery: typeof import('@vueuse/core')['useBattery']
127
- const useBemModifiers: typeof import('./src/composables/useModifiers')['useBemModifiers']
128
130
  const useBluetooth: typeof import('@vueuse/core')['useBluetooth']
129
131
  const useBreakpoints: typeof import('@vueuse/core')['useBreakpoints']
130
132
  const useBroadcastChannel: typeof import('@vueuse/core')['useBroadcastChannel']
@@ -148,6 +150,7 @@ declare global {
148
150
  const useDebounceFn: typeof import('@vueuse/core')['useDebounceFn']
149
151
  const useDebouncedInput: typeof import('./src/composables/useDebouncedInput')['useDebouncedInput']
150
152
  const useDebouncedRefHistory: typeof import('@vueuse/core')['useDebouncedRefHistory']
153
+ const useDefaults: typeof import('./src/composables/useDefaults')['useDefaults']
151
154
  const useDeviceMotion: typeof import('@vueuse/core')['useDeviceMotion']
152
155
  const useDeviceOrientation: typeof import('@vueuse/core')['useDeviceOrientation']
153
156
  const useDevicePixelRatio: typeof import('@vueuse/core')['useDevicePixelRatio']
@@ -194,6 +197,7 @@ declare global {
194
197
  const useMediaQuery: typeof import('@vueuse/core')['useMediaQuery']
195
198
  const useMemoize: typeof import('@vueuse/core')['useMemoize']
196
199
  const useMemory: typeof import('@vueuse/core')['useMemory']
200
+ const useModifiers: typeof import('./src/composables/useModifiers')['useModifiers']
197
201
  const useMounted: typeof import('@vueuse/core')['useMounted']
198
202
  const useMouse: typeof import('@vueuse/core')['useMouse']
199
203
  const useMouseInElement: typeof import('@vueuse/core')['useMouseInElement']
@@ -291,3 +295,8 @@ declare global {
291
295
  const watchWithFilter: typeof import('@vueuse/core')['watchWithFilter']
292
296
  const whenever: typeof import('@vueuse/core')['whenever']
293
297
  }
298
+ // for type re-export
299
+ declare global {
300
+ // @ts-ignore
301
+ export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode } from 'vue'
302
+ }
package/bin/icons.cjs CHANGED
@@ -1,73 +1 @@
1
- (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("fs"), require("yargs"), require("yargs/helpers"), require("@iconify/tools"), require("path"), require("@iconify/utils")) : typeof define === "function" && define.amd ? define(["exports", "fs", "yargs", "yargs/helpers", "@iconify/tools", "path", "@iconify/utils"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["generate-icons"] = {}, global.fileSystem, global.yargs, global.helpers, global.tools, global.path, global.utils));
3
- })(this, function(exports2, fileSystem, yargs, helpers, tools, path, utils) {
4
- "use strict";
5
- function getAllFiles(dirPath, prefix = "iconify", objectFiles = {}) {
6
- const files = fileSystem.readdirSync(dirPath);
7
- files.forEach(function(file) {
8
- if (fileSystem.statSync(dirPath + "/" + file).isDirectory()) {
9
- objectFiles = getAllFiles(dirPath + "/" + file, file, objectFiles);
10
- } else {
11
- if (file.includes(".svg")) {
12
- objectFiles[prefix] ? objectFiles[prefix].push(path.join(dirPath, "/", file)) : objectFiles[prefix] = [path.join(dirPath, "/", file)];
13
- }
14
- }
15
- });
16
- return objectFiles;
17
- }
18
- async function generateIcons(prefix, files, destPath2) {
19
- const iconSet = tools.blankIconSet(prefix);
20
- for (const file of files) {
21
- const content = await fileSystem.promises.readFile(file, {
22
- encoding: "utf-8"
23
- });
24
- const svg = new tools.SVG(content);
25
- await tools.cleanupSVG(svg);
26
- await tools.parseColors(svg, {
27
- defaultColor: "currentColor",
28
- callback: (attr, colorStr, color) => {
29
- return !color || tools.isEmptyColor(color) ? colorStr : "currentColor";
30
- }
31
- });
32
- await tools.runSVGO(svg);
33
- const fileName = file.replace(/^.*[\\/]/, "").split(".")[0].replace(/ /g, "-").replace(/[^a-z0-9-]/gi, "");
34
- iconSet.fromSVG(fileName, svg);
35
- }
36
- const iconifyJson = iconSet.export();
37
- try {
38
- utils.validateIconSet(iconifyJson);
39
- } catch (error) {
40
- throw new Error(
41
- `Icon set is not valid: ${error == null ? void 0 : error.message}`
42
- );
43
- }
44
- fileSystem.writeFileSync(
45
- `${destPath2}/${iconifyJson.prefix}.json`,
46
- JSON.stringify(iconifyJson)
47
- );
48
- }
49
- function createIconifyJsonFiles(srcPath2, destPath2, prefix) {
50
- const objectFiles = getAllFiles(srcPath2, prefix);
51
- if (!Object.keys(objectFiles).length) {
52
- console.error(`There are no files in ${srcPath2}`);
53
- } else {
54
- Object.keys(objectFiles).forEach((prefix2) => {
55
- generateIcons(prefix2, objectFiles[prefix2], destPath2);
56
- console.info(`Icons generated in: ${destPath2}/${prefix2}.json
57
- `);
58
- });
59
- }
60
- }
61
- const argv = yargs(helpers.hideBin(process.argv)).argv;
62
- const srcPath = argv.srcPath;
63
- const destPath = argv.destPath || srcPath;
64
- if (!srcPath || !destPath) {
65
- console.error(
66
- "Please specify the srcPath and destPath with --srcPath and --destPath"
67
- );
68
- process.exit();
69
- }
70
- createIconifyJsonFiles(srcPath, destPath, argv.prefix);
71
- exports2.createIconifyJsonFiles = createIconifyJsonFiles;
72
- Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
73
- });
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"})}));
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, Ref } 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 = {
@@ -25,7 +25,7 @@ export type VolverOptions = {
25
25
  * @see https://docs.iconify.design/icon-components/vue/add-collection.html
26
26
  * @default 'vv'
27
27
  */
28
- provider?: string;
28
+ iconsProvider?: string;
29
29
  /**
30
30
  * Components to install
31
31
  */
@@ -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
  */
@@ -62,16 +66,16 @@ export interface VolverInterface {
62
66
  */
63
67
  addIcon(name: string, data: IconifyIcon): boolean;
64
68
  /**
65
- * Add custom config for provider
69
+ * Add custom config for icons provider
66
70
  * @param {String} provider
67
71
  * @param {PartialIconifyAPIConfig} customConfig
68
72
  * @returns {Boolean} true on success, false if something is wrong with data
69
73
  */
70
- addAPIProvider(provider: string, customConfig: PartialIconifyAPIConfig): boolean;
74
+ addIconsAPIProvider(provider: string, customConfig: PartialIconifyAPIConfig): boolean;
71
75
  /**
72
76
  * Current provider
73
77
  */
74
- provider: string;
78
+ iconsProvider: string;
75
79
  /**
76
80
  * Array of installed iconify collections
77
81
  * @see https://docs.iconify.design/types/iconify-json.html
@@ -81,16 +85,24 @@ export interface VolverInterface {
81
85
  * Set true inside nuxt
82
86
  */
83
87
  nuxt: boolean;
88
+ /**
89
+ * Components defaults options
90
+ */
91
+ defaults: Ref<DefaultOptions>;
84
92
  }
85
93
  export declare class Volver implements VolverInterface {
86
- fetchOptions: RequestInit;
87
- nuxt: boolean;
88
- iconsCollections: IconifyJSON[];
89
- provider: string;
90
- constructor({ fetchWithCredentials, fetchOptions, provider, nuxt, iconsCollections, }?: VolverOptions);
94
+ private _fetchOptions;
95
+ private _iconsCollections;
96
+ private _iconsProvider;
97
+ private _nuxt;
98
+ defaults: Ref<DefaultOptions>;
99
+ constructor({ fetchWithCredentials, fetchOptions, iconsProvider, nuxt, iconsCollections, defaults, }?: VolverOptions);
100
+ get nuxt(): boolean;
101
+ get iconsProvider(): string;
102
+ get iconsCollections(): IconifyJSON[];
91
103
  addCollection(collection: IconifyJSON, providerName?: string): boolean;
92
104
  addIcon(name: string, data: IconifyIcon): boolean;
93
- addAPIProvider(provider: string, customConfig: PartialIconifyAPIConfig): boolean;
105
+ addIconsAPIProvider(provider: string, customConfig: PartialIconifyAPIConfig): boolean;
94
106
  fetchIcon(src: string, options?: RequestInit): Promise<string | undefined>;
95
107
  }
96
108
  declare const VolverPlugin: Plugin;
@@ -1,6 +1,43 @@
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, inject, computed, toRef, toRefs, defineComponent, useAttrs, ref, openBlock, createElementBlock, normalizeClass, createElementVNode, withModifiers, renderSlot, normalizeProps, guardReactiveProps, createTextVNode, toDisplayString } from "vue";
2
+ import { nanoid } from "nanoid";
3
+ import { useToggle } from "@vueuse/core";
4
+ const INJECTION_KEY_ACCORDION_GROUP = Symbol.for("accordionGroup");
5
+ function isEmpty(value) {
6
+ return ((value2) => value2 === null || value2 === void 0 || value2 === "" || Array.isArray(value2) && value2.length === 0 || !(value2 instanceof Date) && typeof value2 === "object" && Object.keys(value2).length === 0)(unref(value));
7
+ }
8
+ function useInjectedGroupState(groupKey) {
9
+ const group = inject(groupKey, void 0);
10
+ const isInGroup = computed(() => !isEmpty(group));
11
+ function getGroupOrLocalRef(propName, props, emit) {
12
+ if (group == null ? void 0 : group.value) {
13
+ const groupPropValue = unref(group.value)[propName];
14
+ return computed({
15
+ get() {
16
+ return groupPropValue == null ? void 0 : groupPropValue.value;
17
+ },
18
+ set(value) {
19
+ groupPropValue.value = value;
20
+ }
21
+ });
22
+ }
23
+ const propRef = toRef(props, propName);
24
+ return computed({
25
+ get() {
26
+ return propRef.value;
27
+ },
28
+ set(value) {
29
+ if (emit)
30
+ emit(`update:${propName}`, value);
31
+ }
32
+ });
33
+ }
34
+ return {
35
+ group,
36
+ isInGroup,
37
+ getGroupOrLocalRef
38
+ };
39
+ }
40
+ const VvAccordionProps = {
4
41
  /**
5
42
  * Accordion name
6
43
  */
@@ -27,98 +64,167 @@ const P = Symbol.for("accordionGroup"), R = {
27
64
  /**
28
65
  * If true, the accordion will be disabled
29
66
  */
30
- 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);
67
+ disabled: Boolean,
68
+ /**
69
+ * If true, the accordion will be opened by default
70
+ */
71
+ not: Boolean
72
+ };
73
+ const VvAccordionEvents = ["update:modelValue"];
74
+ function useGroupProps(props, emit) {
75
+ const { group, isInGroup, getGroupOrLocalRef } = useInjectedGroupState(
76
+ INJECTION_KEY_ACCORDION_GROUP
77
+ );
78
+ const { title, content } = toRefs(props);
79
+ const modelValue = getGroupOrLocalRef("modelValue", props, emit);
80
+ const not = getGroupOrLocalRef("not", props);
81
+ const collapse = getGroupOrLocalRef("collapse", props);
82
+ const modifiers = getGroupOrLocalRef("modifiers", props);
83
+ const disabled = computed(
84
+ () => {
85
+ var _a;
86
+ return Boolean(props.disabled || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.disabled.value));
87
+ }
88
+ );
36
89
  return {
37
90
  // group props
38
- modelValue: m,
39
- disabled: p,
40
- isInGroup: s,
41
- group: l,
42
- collapse: i,
43
- modifiers: e,
91
+ modelValue,
92
+ not,
93
+ isInGroup,
94
+ group,
95
+ collapse,
96
+ modifiers,
97
+ disabled,
44
98
  // local props
45
- title: c,
46
- content: v
99
+ title,
100
+ content
47
101
  };
48
102
  }
49
- const M = ["id", "open"], T = ["aria-controls", "aria-expanded"], $ = ["aria-hidden"], z = {
103
+ function useModifiers(prefix, modifiers, others) {
104
+ return computed(() => {
105
+ const toReturn = {
106
+ [prefix]: true
107
+ };
108
+ const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
109
+ if (modifiersArray) {
110
+ if (Array.isArray(modifiersArray)) {
111
+ modifiersArray.forEach((modifier) => {
112
+ if (modifier) {
113
+ toReturn[`${prefix}--${modifier}`] = true;
114
+ }
115
+ });
116
+ }
117
+ }
118
+ if (others) {
119
+ Object.keys(others.value).forEach((key) => {
120
+ toReturn[`${prefix}--${key}`] = unref(others.value[key]);
121
+ });
122
+ }
123
+ return toReturn;
124
+ });
125
+ }
126
+ const _hoisted_1 = ["id", "open"];
127
+ const _hoisted_2 = ["aria-controls", "aria-expanded"];
128
+ const _hoisted_3 = ["aria-hidden"];
129
+ const __default__ = {
50
130
  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()
58
- ), {
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);
131
+ };
132
+ const _sfc_main = /* @__PURE__ */ defineComponent({
133
+ ...__default__,
134
+ props: VvAccordionProps,
135
+ emits: VvAccordionEvents,
136
+ setup(__props, { emit }) {
137
+ const props = __props;
138
+ const attrs = useAttrs();
139
+ const accordionName = computed(
140
+ () => props.name || (attrs == null ? void 0 : attrs.id) || nanoid()
141
+ );
142
+ const {
143
+ modifiers,
144
+ title,
145
+ content,
146
+ disabled,
147
+ collapse,
148
+ modelValue,
149
+ isInGroup,
150
+ not
151
+ } = useGroupProps(props, emit);
152
+ const localModelValue = ref(false);
153
+ const isOpen = computed({
154
+ get: () => {
155
+ let toReturn = modelValue.value;
156
+ if (isInGroup.value) {
157
+ if (collapse.value && Array.isArray(modelValue.value)) {
158
+ toReturn = modelValue.value.includes(accordionName.value);
159
+ } else {
160
+ toReturn = modelValue.value === accordionName.value;
161
+ }
162
+ } else if (modelValue.value === void 0) {
163
+ toReturn = localModelValue.value;
164
+ }
165
+ return not.value ? !toReturn : toReturn;
166
+ },
167
+ set: (newValue) => {
168
+ if (not.value) {
169
+ newValue = !newValue;
170
+ }
171
+ if (isInGroup.value) {
172
+ if (collapse.value && Array.isArray(modelValue.value)) {
173
+ if (newValue) {
174
+ modelValue.value.push(accordionName.value);
73
175
  return;
74
176
  }
75
- e.value = e.value.filter(
76
- (u) => u !== o.value
177
+ modelValue.value = modelValue.value.filter(
178
+ (name) => name !== accordionName.value
77
179
  );
78
180
  return;
79
181
  }
80
- e.value = a ? o.value : null;
182
+ modelValue.value = newValue ? accordionName.value : null;
81
183
  return;
82
184
  }
83
- if (e.value === void 0 && typeof a == "boolean") {
84
- _.value = a;
185
+ if (modelValue.value === void 0 && typeof newValue === "boolean") {
186
+ localModelValue.value = newValue;
85
187
  return;
86
188
  }
87
- e.value = a;
189
+ modelValue.value = newValue;
88
190
  }
89
- }), G = useBemModifiers(
191
+ });
192
+ const bemCssClasses = useModifiers(
90
193
  "vv-accordion",
91
- c,
194
+ modifiers,
92
195
  computed(() => ({
93
- disabled: p.value
196
+ disabled: disabled.value
94
197
  }))
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"]))
101
- }, [
102
- y("summary", {
103
- "aria-controls": t(o),
104
- "aria-expanded": t(r),
105
- class: "vv-collapse__summary"
106
- }, [
107
- g(a.$slots, "summary", A(C({ open: t(r) })), () => [
108
- b(S(t(v)), 1)
109
- ])
110
- ], 8, T),
111
- y("div", {
112
- "aria-hidden": !t(r),
113
- class: "vv-collapse__content"
198
+ );
199
+ const onClick = useToggle(isOpen);
200
+ return (_ctx, _cache) => {
201
+ return openBlock(), createElementBlock("details", {
202
+ id: unref(accordionName),
203
+ class: normalizeClass(unref(bemCssClasses)),
204
+ open: unref(isOpen)
114
205
  }, [
115
- g(a.$slots, "details", A(C({ open: t(r) })), () => [
116
- b(S(t(m)), 1)
117
- ])
118
- ], 8, $)
119
- ], 10, M));
206
+ createElementVNode("summary", {
207
+ "aria-controls": unref(accordionName),
208
+ "aria-expanded": unref(isOpen),
209
+ class: "vv-accordion__summary",
210
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => unref(onClick)(), ["prevent"]))
211
+ }, [
212
+ renderSlot(_ctx.$slots, "summary", normalizeProps(guardReactiveProps({ open: unref(isOpen) })), () => [
213
+ createTextVNode(toDisplayString(unref(title)), 1)
214
+ ])
215
+ ], 8, _hoisted_2),
216
+ createElementVNode("div", {
217
+ "aria-hidden": !unref(isOpen),
218
+ class: "vv-accordion__content"
219
+ }, [
220
+ renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({ open: unref(isOpen) })), () => [
221
+ createTextVNode(toDisplayString(unref(content)), 1)
222
+ ])
223
+ ], 8, _hoisted_3)
224
+ ], 10, _hoisted_1);
225
+ };
120
226
  }
121
227
  });
122
228
  export {
123
- K as default
229
+ _sfc_main as default
124
230
  };
@@ -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,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("nanoid"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","nanoid","@vueuse/core"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvAccordion=o(e.vue,e.nanoid,e.core)}(this,(function(e,o,n){"use strict";const r=Symbol.for("accordionGroup");function t(o){const n=e.inject(o,void 0),r=e.computed((()=>{return o=n,!(null==(r=e.unref(o))||""===r||Array.isArray(r)&&0===r.length||!(r instanceof Date)&&"object"==typeof r&&0===Object.keys(r).length);var o,r}));return{group:n,isInGroup:r,getGroupOrLocalRef:function(o,r,t){if(null==n?void 0:n.value){const r=e.unref(n.value)[o];return e.computed({get:()=>null==r?void 0:r.value,set(e){r.value=e}})}const u=e.toRef(r,o);return e.computed({get:()=>u.value,set(e){t&&t(`update:${o}`,e)}})}}}const u={name:String,title:String,content:String,modelValue:{type:Boolean,default:void 0},modifiers:[String,Array],disabled:Boolean,not:Boolean};const a=["id","open"],l=["aria-controls","aria-expanded"],i=["aria-hidden"];return e.defineComponent({name:"VvAccordion",props:u,emits:["update:modelValue"],setup(u,{emit:d}){const s=u,c=e.useAttrs(),v=e.computed((()=>s.name||(null==c?void 0:c.id)||o.nanoid())),{modifiers:f,title:p,content:m,disabled:y,collapse:g,modelValue:b,isInGroup:A,not:h}=function(o,n){const{group:u,isInGroup:a,getGroupOrLocalRef:l}=t(r),{title:i,content:d}=e.toRefs(o),s=l("modelValue",o,n),c=l("not",o),v=l("collapse",o),f=l("modifiers",o),p=e.computed((()=>{var e;return Boolean(o.disabled||(null==(e=null==u?void 0:u.value)?void 0:e.disabled.value))}));return{modelValue:s,not:c,isInGroup:a,group:u,collapse:v,modifiers:f,disabled:p,title:i,content:d}}(s,d),V=e.ref(!1),S=e.computed({get:()=>{let e=b.value;return A.value?e=g.value&&Array.isArray(b.value)?b.value.includes(v.value):b.value===v.value:void 0===b.value&&(e=V.value),h.value?!e:e},set:e=>{if(h.value&&(e=!e),A.value)return g.value&&Array.isArray(b.value)?e?void b.value.push(v.value):void(b.value=b.value.filter((e=>e!==v.value))):void(b.value=e?v.value:null);void 0!==b.value||"boolean"!=typeof e?b.value=e:V.value=e}}),G=function(o,n,r){return e.computed((()=>{const t={[o]:!0},u="string"==typeof(null==n?void 0:n.value)?n.value.split(" "):null==n?void 0:n.value;return u&&Array.isArray(u)&&u.forEach((e=>{e&&(t[`${o}--${e}`]=!0)})),r&&Object.keys(r.value).forEach((n=>{t[`${o}--${n}`]=e.unref(r.value[n])})),t}))}("vv-accordion",f,e.computed((()=>({disabled:y.value})))),$=n.useToggle(S);return(o,n)=>(e.openBlock(),e.createElementBlock("details",{id:e.unref(v),class:e.normalizeClass(e.unref(G)),open:e.unref(S)},[e.createElementVNode("summary",{"aria-controls":e.unref(v),"aria-expanded":e.unref(S),class:"vv-accordion__summary",onClick:n[0]||(n[0]=e.withModifiers((o=>e.unref($)()),["prevent"]))},[e.renderSlot(o.$slots,"summary",e.normalizeProps(e.guardReactiveProps({open:e.unref(S)})),(()=>[e.createTextVNode(e.toDisplayString(e.unref(p)),1)]))],8,l),e.createElementVNode("div",{"aria-hidden":!e.unref(S),class:"vv-accordion__content"},[e.renderSlot(o.$slots,"default",e.normalizeProps(e.guardReactiveProps({open:e.unref(S)})),(()=>[e.createTextVNode(e.toDisplayString(e.unref(m)),1)]))],8,i)],10,a))}})}));