@volverjs/ui-vue 0.0.9 → 0.0.10-beta.10
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.
- package/README.md +64 -1
- package/auto-imports.d.ts +1 -1
- package/bin/icons.cjs +1 -1
- package/bin/icons.js +34 -19
- package/dist/components/VvAccordion/VvAccordion.es.js +33 -4
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -4
- package/dist/components/VvAccordion/index.d.ts +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +75 -27
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +5 -5
- package/dist/components/VvAction/VvAction.es.js +26 -4
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +17 -4
- package/dist/components/VvAction/index.d.ts +5 -0
- package/dist/components/VvAlert/VvAlert.es.js +96 -45
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +4 -4
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +136 -66
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +4 -4
- package/dist/components/VvAvatar/VvAvatar.es.js +22 -1
- package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +79 -28
- package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.es.js +39 -8
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +224 -41
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +14 -3
- package/dist/components/VvBreadcrumb/index.d.ts +2 -9
- package/dist/components/VvButton/VvButton.es.js +70 -25
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +25 -9
- package/dist/components/VvButton/index.d.ts +5 -0
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +33 -6
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +6 -6
- package/dist/components/VvCard/VvCard.es.js +47 -16
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +35 -7
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +8 -8
- package/dist/components/VvCheckbox/index.d.ts +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +106 -51
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +7 -7
- package/dist/components/VvCheckboxGroup/index.d.ts +1 -1
- package/dist/components/VvCombobox/VvCombobox.es.js +635 -400
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +112 -112
- package/dist/components/VvCombobox/index.d.ts +32 -32
- package/dist/components/VvDialog/VvDialog.es.js +65 -27
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDialog/VvDialog.vue.d.ts +4 -4
- package/dist/components/VvDropdown/VvDropdown.es.js +87 -46
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +203 -189
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +12 -0
- package/dist/components/VvDropdown/index.d.ts +32 -32
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +46 -12
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +13 -7
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +28 -1
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +40 -8
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.es.js +1 -1
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvInputText/VvInputClearAction.d.ts +1 -1
- package/dist/components/VvInputText/VvInputText.es.js +149 -99
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +10 -10
- package/dist/components/VvInputText/index.d.ts +8 -2
- package/dist/components/VvNav/VvNav.es.js +115 -63
- package/dist/components/VvNav/VvNav.umd.js +1 -1
- package/dist/components/VvNav/VvNav.vue.d.ts +31 -12
- package/dist/components/VvNav/VvNavItem.vue.d.ts +9 -0
- package/dist/components/VvNav/index.d.ts +1 -12
- package/dist/components/VvNavItem/VvNavItem.es.js +413 -0
- package/dist/components/VvNavItem/VvNavItem.umd.js +1 -0
- package/dist/components/VvNavSeparator/VvNavSeparator.es.js +24 -0
- package/dist/components/VvNavSeparator/VvNavSeparator.umd.js +1 -0
- package/dist/components/VvProgress/VvProgress.es.js +33 -6
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +35 -7
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +8 -8
- package/dist/components/VvRadio/index.d.ts +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +106 -51
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +7 -7
- package/dist/components/VvRadioGroup/index.d.ts +1 -1
- package/dist/components/VvSelect/VvSelect.es.js +159 -99
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +13 -13
- package/dist/components/VvSelect/index.d.ts +1 -1
- package/dist/components/VvTab/VvTab.es.js +214 -99
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/VvTab/VvTab.vue.d.ts +40 -11
- package/dist/components/VvTab/index.d.ts +9 -3
- package/dist/components/VvTextarea/VvTextarea.es.js +123 -77
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +10 -10
- package/dist/components/VvTooltip/VvTooltip.es.js +40 -9
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/index.es.js +1593 -1012
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/group/useInjectedGroupState.d.ts +1 -1
- package/dist/composables/useOptions.d.ts +1 -1
- package/dist/composables/useVolver.d.ts +1 -1
- package/dist/directives/index.d.ts +3 -5
- package/dist/directives/index.es.js +60 -23
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-tooltip.es.js +58 -18
- package/dist/directives/v-tooltip.umd.js +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.es.js +19 -16
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +58 -34
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +50 -15
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +332 -83
- package/dist/stories/Combobox/Combobox.settings.d.ts +8 -0
- package/dist/stories/Combobox/ComboboxOptions.stories.d.ts +1 -0
- package/dist/stories/InputText/InputTextMask.stories.d.ts +1 -1
- package/dist/stories/Tab/Tab.settings.d.ts +4 -37
- package/dist/types/alert.d.ts +13 -0
- package/dist/types/floating-ui.d.ts +6 -0
- package/dist/types/generic.d.ts +4 -0
- package/dist/types/group.d.ts +37 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/nav.d.ts +17 -0
- package/package.json +61 -52
- package/src/Volver.ts +22 -16
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvAccordion/VvAccordion.vue +2 -2
- package/src/components/VvAction/VvAction.vue +5 -2
- package/src/components/VvBreadcrumb/VvBreadcrumb.vue +20 -19
- package/src/components/VvBreadcrumb/index.ts +2 -8
- package/src/components/VvCombobox/VvCombobox.vue +32 -33
- package/src/components/VvCombobox/index.ts +4 -0
- package/src/components/VvInputText/VvInputText.vue +2 -2
- package/src/components/VvNav/VvNav.vue +30 -50
- package/src/components/VvNav/VvNavItem.vue +18 -0
- package/src/components/VvNav/VvNavSeparator.vue +11 -0
- package/src/components/VvNav/index.ts +2 -15
- package/src/components/VvSelect/VvSelect.vue +4 -4
- package/src/components/VvTab/VvTab.vue +63 -35
- package/src/components/VvTab/index.ts +10 -4
- package/src/components/VvTextarea/VvTextarea.vue +1 -1
- package/src/composables/useOptions.ts +2 -2
- package/src/composables/useUniqueId.ts +2 -2
- package/src/directives/index.ts +1 -4
- package/src/directives/v-tooltip.ts +19 -10
- package/src/index.ts +3 -1
- package/src/props/index.ts +27 -3
- package/src/stories/Button/ButtonModifiers.stories.ts +4 -14
- package/src/stories/Combobox/Combobox.settings.ts +8 -0
- package/src/stories/Combobox/ComboboxOptions.stories.ts +18 -0
- package/src/stories/InputText/InputTextMask.stories.ts +1 -1
- package/src/stories/Nav/Nav.settings.ts +3 -4
- package/src/stories/Nav/Nav.test.ts +4 -15
- package/src/stories/Tab/Tab.settings.ts +9 -9
- package/src/stories/Tab/Tab.stories.ts +2 -2
- package/src/stories/Tab/Tab.test.ts +6 -14
- package/src/stories/argTypes.ts +1 -1
- package/src/types/generic.ts +6 -0
- package/src/types/index.ts +5 -0
- package/src/types/nav.ts +19 -0
- package/src/utils/ObjectUtilities.ts +3 -2
- package/dist/components/VvNav/VvNavItemTitle.vue.d.ts +0 -6
- package/dist/components/VvNavItemTitle/VvNavItemTitle.es.js +0 -19
- package/dist/components/VvNavItemTitle/VvNavItemTitle.umd.js +0 -1
- package/src/components/VvNav/VvNavItemTitle.vue +0 -11
- package/src/components/VvNav/VvNavSeparator.ts +0 -8
- package/src/types/generic.d.ts +0 -6
- /package/dist/components/VvNav/{VvNavSeparator.d.ts → VvNavSeparator.vue.d.ts} +0 -0
- /package/src/types/{alert.d.ts → alert.ts} +0 -0
- /package/src/types/{floating-ui.d.ts → floating-ui.ts} +0 -0
- /package/src/types/{group.d.ts → group.ts} +0 -0
package/README.md
CHANGED
|
@@ -68,7 +68,7 @@ app.use(VolverPlugin, {
|
|
|
68
68
|
* if you want can import components globally
|
|
69
69
|
* components: { VvButton, VvInputText }
|
|
70
70
|
*/
|
|
71
|
-
|
|
71
|
+
components: undefined,
|
|
72
72
|
/*
|
|
73
73
|
* if you want can import directives globally
|
|
74
74
|
* directives: { toolip: VTooltip }
|
|
@@ -158,6 +158,69 @@ export default defineConfig({
|
|
|
158
158
|
})
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
+
## Composables
|
|
162
|
+
|
|
163
|
+
`@volverjs/ui-vue`utility composables
|
|
164
|
+
|
|
165
|
+
### useAlert
|
|
166
|
+
|
|
167
|
+
Used to show alert messages and notifications
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
export type AlertModifiers =
|
|
171
|
+
| 'success'
|
|
172
|
+
| 'info'
|
|
173
|
+
| 'warning'
|
|
174
|
+
| 'danger'
|
|
175
|
+
| 'brand'
|
|
176
|
+
| 'accent'
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
export type Alert = {
|
|
181
|
+
id: string | number
|
|
182
|
+
group: string
|
|
183
|
+
title?: string
|
|
184
|
+
icon: string | Record<string, unknown>
|
|
185
|
+
content?: string
|
|
186
|
+
footer?: string
|
|
187
|
+
modifiers: AlertModifiers
|
|
188
|
+
dismissable: boolean
|
|
189
|
+
autoClose: number
|
|
190
|
+
timestamp: number
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
##### Usage
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
import { useAlert } from '@volverjs/ui-vue/composables'
|
|
198
|
+
|
|
199
|
+
const { addAlert, removeAlert, alerts } = useAlert()
|
|
200
|
+
|
|
201
|
+
function showSuccess() {
|
|
202
|
+
addAlert({
|
|
203
|
+
title: 'Success!',
|
|
204
|
+
modifiers: 'success'
|
|
205
|
+
})
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
```html
|
|
210
|
+
<vv-alert-group name="alert-group" :items="alerts" @close="removeAlert" />
|
|
211
|
+
|
|
212
|
+
<div class="flex gap-md">
|
|
213
|
+
<vv-button
|
|
214
|
+
label="Show success"
|
|
215
|
+
modifiers="secondary"
|
|
216
|
+
@click="showSuccess"
|
|
217
|
+
class="mb-lg"
|
|
218
|
+
/>
|
|
219
|
+
</div>
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
###
|
|
223
|
+
|
|
161
224
|
## Roadmap
|
|
162
225
|
|
|
163
226
|
The following features are planned for the next releases:
|
package/auto-imports.d.ts
CHANGED
|
@@ -312,5 +312,5 @@ declare global {
|
|
|
312
312
|
// for type re-export
|
|
313
313
|
declare global {
|
|
314
314
|
// @ts-ignore
|
|
315
|
-
export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode } from 'vue'
|
|
315
|
+
export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
|
|
316
316
|
}
|
package/bin/icons.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,
|
|
1
|
+
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("fs"),require("yargs"),require("yargs/helpers"),require("@iconify/tools"),require("path"),require("@iconify/utils"),require("chokidar")):"function"==typeof define&&define.amd?define(["exports","fs","yargs","yargs/helpers","@iconify/tools","path","@iconify/utils","chokidar"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self)["generate-icons"]={},e.fileSystem,e.yargs,e.helpers,e.tools,e.path,e.utils,e.chokidar)}(this,(function(e,r,o,i,t,n,s,c){"use strict";function a(e,o="iconify",i={}){return r.readdirSync(e).forEach((function(t){r.statSync(e+"/"+t).isDirectory()?i=a(e+"/"+t,t,i):t.includes(".svg")&&(i[o]?i[o].push(n.join(e,"/",t)):i[o]=[n.join(e,"/",t)])})),i}function l(e,o,i){const c=a(e,i);Object.keys(c).length?Object.keys(c).forEach((e=>{!async function(e,o,i){const c=t.blankIconSet(e);for(const n of o)try{const e=await r.promises.readFile(n,{encoding:"utf-8"}),o=new t.SVG(e);await t.cleanupSVG(o),await t.parseColors(o,{defaultColor:"currentColor",callback:(e,r,o)=>!o||t.isEmptyColor(o)?r:"currentColor"}),await t.runSVGO(o);const i=n.replace(/^.*[\\/]/,"").split(".")[0].replace(/ /g,"-").replace(/[^a-z0-9-]/gi,"");c.fromSVG(i,o)}catch(f){console.error(f)}const a=c.export();try{s.validateIconSet(a)}catch(f){throw new Error(`Icon set is not valid: ${null==f?void 0:f.message}`)}const l=`${i}/${a.prefix}.json`;r.mkdirSync(n.dirname(l),{recursive:!0}),r.writeFileSync(l,JSON.stringify(a))}(e,c[e],o),console.info(`Icons generated in: ${o}/${e}.json\n`)})):console.error(`There are no files in ${e}`)}const f=o(i.hideBin(process.argv)).argv,d=f.srcPath,u=f.destPath||d;d&&u||(console.error("Please specify the srcPath and destPath with --srcPath and --destPath"),process.exit()),f.watch?(l(d,u,f.prefix),c.watch(d,{ignoreInitial:!0}).on("add",(()=>{l(d,u,f.prefix)})).on("change",(()=>{l(d,u,f.prefix)}))):l(d,u,f.prefix),e.createIconifyJsonFiles=l,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|
package/bin/icons.js
CHANGED
|
@@ -4,6 +4,7 @@ import { hideBin } from "yargs/helpers";
|
|
|
4
4
|
import { blankIconSet, SVG, cleanupSVG, parseColors, isEmptyColor, runSVGO } from "@iconify/tools";
|
|
5
5
|
import path from "path";
|
|
6
6
|
import { validateIconSet } from "@iconify/utils";
|
|
7
|
+
import chokidar from "chokidar";
|
|
7
8
|
function getAllFiles(dirPath, prefix = "iconify", objectFiles = {}) {
|
|
8
9
|
const files = fileSystem.readdirSync(dirPath);
|
|
9
10
|
files.forEach(function(file) {
|
|
@@ -20,20 +21,24 @@ function getAllFiles(dirPath, prefix = "iconify", objectFiles = {}) {
|
|
|
20
21
|
async function generateIcons(prefix, files, destPath2) {
|
|
21
22
|
const iconSet = blankIconSet(prefix);
|
|
22
23
|
for (const file of files) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
try {
|
|
25
|
+
const content = await fileSystem.promises.readFile(file, {
|
|
26
|
+
encoding: "utf-8"
|
|
27
|
+
});
|
|
28
|
+
const svg = new SVG(content);
|
|
29
|
+
await cleanupSVG(svg);
|
|
30
|
+
await parseColors(svg, {
|
|
31
|
+
defaultColor: "currentColor",
|
|
32
|
+
callback: (attr, colorStr, color) => {
|
|
33
|
+
return !color || isEmptyColor(color) ? colorStr : "currentColor";
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
await runSVGO(svg);
|
|
37
|
+
const fileName = file.replace(/^.*[\\/]/, "").split(".")[0].replace(/ /g, "-").replace(/[^a-z0-9-]/gi, "");
|
|
38
|
+
iconSet.fromSVG(fileName, svg);
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.error(error);
|
|
41
|
+
}
|
|
37
42
|
}
|
|
38
43
|
const iconifyJson = iconSet.export();
|
|
39
44
|
try {
|
|
@@ -43,10 +48,9 @@ async function generateIcons(prefix, files, destPath2) {
|
|
|
43
48
|
`Icon set is not valid: ${error == null ? void 0 : error.message}`
|
|
44
49
|
);
|
|
45
50
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
);
|
|
51
|
+
const filename = `${destPath2}/${iconifyJson.prefix}.json`;
|
|
52
|
+
fileSystem.mkdirSync(path.dirname(filename), { recursive: true });
|
|
53
|
+
fileSystem.writeFileSync(filename, JSON.stringify(iconifyJson));
|
|
50
54
|
}
|
|
51
55
|
function createIconifyJsonFiles(srcPath2, destPath2, prefix) {
|
|
52
56
|
const objectFiles = getAllFiles(srcPath2, prefix);
|
|
@@ -69,7 +73,18 @@ if (!srcPath || !destPath) {
|
|
|
69
73
|
);
|
|
70
74
|
process.exit();
|
|
71
75
|
}
|
|
72
|
-
|
|
76
|
+
if (argv.watch) {
|
|
77
|
+
createIconifyJsonFiles(srcPath, destPath, argv.prefix);
|
|
78
|
+
chokidar.watch(srcPath, {
|
|
79
|
+
ignoreInitial: true
|
|
80
|
+
}).on("add", () => {
|
|
81
|
+
createIconifyJsonFiles(srcPath, destPath, argv.prefix);
|
|
82
|
+
}).on("change", () => {
|
|
83
|
+
createIconifyJsonFiles(srcPath, destPath, argv.prefix);
|
|
84
|
+
});
|
|
85
|
+
} else {
|
|
86
|
+
createIconifyJsonFiles(srcPath, destPath, argv.prefix);
|
|
87
|
+
}
|
|
73
88
|
export {
|
|
74
89
|
createIconifyJsonFiles
|
|
75
90
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { unref, inject, computed, toRef, toRefs, defineComponent, useAttrs, ref, openBlock, createElementBlock, normalizeClass, createElementVNode, withModifiers, renderSlot, normalizeProps, guardReactiveProps, createTextVNode, toDisplayString } from "vue";
|
|
2
|
-
import {
|
|
2
|
+
import { uid } from "uid";
|
|
3
3
|
import { useToggle } from "@vueuse/core";
|
|
4
4
|
var Strategy = /* @__PURE__ */ ((Strategy2) => {
|
|
5
5
|
Strategy2["absolute"] = "absolute";
|
|
@@ -35,6 +35,13 @@ var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
|
35
35
|
ButtonType2["reset"] = "reset";
|
|
36
36
|
return ButtonType2;
|
|
37
37
|
})(ButtonType || {});
|
|
38
|
+
var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
|
|
39
|
+
ActionTag2["nuxtLink"] = "nuxt-link";
|
|
40
|
+
ActionTag2["routerLink"] = "router-link";
|
|
41
|
+
ActionTag2["a"] = "a";
|
|
42
|
+
ActionTag2["button"] = "button";
|
|
43
|
+
return ActionTag2;
|
|
44
|
+
})(ActionTag || {});
|
|
38
45
|
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
39
46
|
AnchorTarget2["_blank"] = "_blank";
|
|
40
47
|
AnchorTarget2["_self"] = "_self";
|
|
@@ -82,6 +89,12 @@ const ActiveProps = {
|
|
|
82
89
|
*/
|
|
83
90
|
active: Boolean
|
|
84
91
|
};
|
|
92
|
+
const CurrentProps = {
|
|
93
|
+
/**
|
|
94
|
+
* Whether the item is current
|
|
95
|
+
*/
|
|
96
|
+
current: Boolean
|
|
97
|
+
};
|
|
85
98
|
const PressedProps = {
|
|
86
99
|
/**
|
|
87
100
|
* Whether the item is pressed
|
|
@@ -212,6 +225,7 @@ const ModifiersProps = {
|
|
|
212
225
|
...LabelProps,
|
|
213
226
|
...PressedProps,
|
|
214
227
|
...ActiveProps,
|
|
228
|
+
...CurrentProps,
|
|
215
229
|
...LinkProps,
|
|
216
230
|
/**
|
|
217
231
|
* Button type
|
|
@@ -227,6 +241,13 @@ const ModifiersProps = {
|
|
|
227
241
|
ariaLabel: {
|
|
228
242
|
type: String,
|
|
229
243
|
default: void 0
|
|
244
|
+
},
|
|
245
|
+
/**
|
|
246
|
+
* Default tag for the action
|
|
247
|
+
*/
|
|
248
|
+
defaultTag: {
|
|
249
|
+
type: String,
|
|
250
|
+
default: ActionTag.button
|
|
230
251
|
}
|
|
231
252
|
});
|
|
232
253
|
function isEmpty(value) {
|
|
@@ -378,7 +399,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
378
399
|
const props = __props;
|
|
379
400
|
const attrs = useAttrs();
|
|
380
401
|
const accordionName = computed(
|
|
381
|
-
() => props.name || (attrs == null ? void 0 : attrs.id) ||
|
|
402
|
+
() => props.name || (attrs == null ? void 0 : attrs.id) || uid()
|
|
382
403
|
);
|
|
383
404
|
const {
|
|
384
405
|
modifiers,
|
|
@@ -451,7 +472,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
451
472
|
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => unref(onClick)(), ["prevent"]))
|
|
452
473
|
}, [
|
|
453
474
|
renderSlot(_ctx.$slots, "summary", normalizeProps(guardReactiveProps({ open: unref(isOpen) })), () => [
|
|
454
|
-
createTextVNode(
|
|
475
|
+
createTextVNode(
|
|
476
|
+
toDisplayString(unref(title)),
|
|
477
|
+
1
|
|
478
|
+
/* TEXT */
|
|
479
|
+
)
|
|
455
480
|
])
|
|
456
481
|
], 8, _hoisted_2),
|
|
457
482
|
createElementVNode("div", {
|
|
@@ -459,7 +484,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
459
484
|
class: "vv-accordion__content"
|
|
460
485
|
}, [
|
|
461
486
|
renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({ open: unref(isOpen) })), () => [
|
|
462
|
-
createTextVNode(
|
|
487
|
+
createTextVNode(
|
|
488
|
+
toDisplayString(unref(content)),
|
|
489
|
+
1
|
|
490
|
+
/* TEXT */
|
|
491
|
+
)
|
|
463
492
|
])
|
|
464
493
|
], 8, _hoisted_3)
|
|
465
494
|
], 10, _hoisted_1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("uid"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","uid","@vueuse/core"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvAccordion=o(e.vue,e.uid,e.core)}(this,(function(e,o,t){"use strict";var r=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(r||{}),n=(e=>(e.before="before",e.after="after",e))(n||{}),u=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(u||{}),a=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(a||{});const l=Symbol.for("accordionGroup"),i=(Boolean,Boolean,Boolean,Boolean,{modifiers:[String,Array]});function d(o){const t=e.inject(o,void 0),r=e.computed((()=>{return o=t,!(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:t,isInGroup:r,getGroupOrLocalRef:function(o,r,n){if(null==t?void 0:t.value){const r=e.unref(t.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){n&&n(`update:${o}`,e)}})}}}n.before,r.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,u.button,a.button;const s={...i,name:String,title:String,content:String,modelValue:{type:Boolean,default:void 0},disabled:Boolean,not:Boolean};const c=["id","open"],v=["aria-controls","aria-expanded"],f=["aria-hidden"];return e.defineComponent({name:"VvAccordion",props:s,emits:["update:modelValue"],setup(r,{emit:n}){const u=r,a=e.useAttrs(),i=e.computed((()=>u.name||(null==a?void 0:a.id)||o.uid())),{modifiers:s,title:p,content:m,disabled:y,collapse:b,modelValue:g,isInGroup:B,not:A}=function(o,t){const{group:r,isInGroup:n,getGroupOrLocalRef:u}=d(l),{title:a,content:i}=e.toRefs(o),s=u("modelValue",o,t),c=u("not",o),v=u("collapse",o),f=e.computed((()=>{var e;return Boolean(o.disabled||(null==(e=null==r?void 0:r.value)?void 0:e.disabled.value))})),p=e.computed((()=>{let e=o.modifiers,t=null==r?void 0:r.value.modifiers.value;const n=new Set;return e&&(Array.isArray(e)||(e=e.split(" ")),e.forEach((e=>n.add(e)))),t&&(Array.isArray(t)||(t=t.split(" ")),t.forEach((e=>n.add(e)))),Array.from(n)}));return{modelValue:s,not:c,isInGroup:n,group:r,collapse:v,modifiers:p,disabled:f,title:a,content:i}}(u,n),h=e.ref(!1),V=e.computed({get:()=>{let e=g.value;return B.value?e=b.value&&Array.isArray(g.value)?g.value.includes(i.value):g.value===i.value:void 0===g.value&&(e=h.value),A.value?!e:e},set:e=>{if(A.value&&(e=!e),B.value)return b.value&&Array.isArray(g.value)?e?void g.value.push(i.value):void(g.value=g.value.filter((e=>e!==i.value))):void(g.value=e?i.value:null);void 0!==g.value||"boolean"!=typeof e?g.value=e:h.value=e}}),S=function(o,t,r){return e.computed((()=>{const n={[o]:!0},u="string"==typeof(null==t?void 0:t.value)?t.value.split(" "):null==t?void 0:t.value;return u&&Array.isArray(u)&&u.forEach((e=>{e&&(n[`${o}--${e}`]=!0)})),r&&Object.keys(r.value).forEach((t=>{n[`${o}--${t}`]=e.unref(r.value[t])})),n}))}("vv-accordion",s,e.computed((()=>({disabled:y.value})))),k=t.useToggle(V);return(o,t)=>(e.openBlock(),e.createElementBlock("details",{id:e.unref(i),class:e.normalizeClass(e.unref(S)),open:e.unref(V)},[e.createElementVNode("summary",{"aria-controls":e.unref(i),"aria-expanded":e.unref(V),class:"vv-accordion__summary",onClick:t[0]||(t[0]=e.withModifiers((o=>e.unref(k)()),["prevent"]))},[e.renderSlot(o.$slots,"summary",e.normalizeProps(e.guardReactiveProps({open:e.unref(V)})),(()=>[e.createTextVNode(e.toDisplayString(e.unref(p)),1)]))],8,v),e.createElementVNode("div",{"aria-hidden":!e.unref(V),class:"vv-accordion__content"},[e.renderSlot(o.$slots,"default",e.normalizeProps(e.guardReactiveProps({open:e.unref(V)})),(()=>[e.createTextVNode(e.toDisplayString(e.unref(m)),1)]))],8,f)],10,c))}})}));
|
|
@@ -9,7 +9,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
9
9
|
disabled: BooleanConstructor;
|
|
10
10
|
not: BooleanConstructor;
|
|
11
11
|
modifiers: globalThis.PropType<string | string[]>;
|
|
12
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
12
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
[x: string]: (...args: any[]) => void;
|
|
14
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
15
|
name: StringConstructor;
|
|
14
16
|
title: StringConstructor;
|
|
15
17
|
content: StringConstructor;
|
|
@@ -20,9 +22,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
20
22
|
disabled: BooleanConstructor;
|
|
21
23
|
not: BooleanConstructor;
|
|
22
24
|
modifiers: globalThis.PropType<string | string[]>;
|
|
23
|
-
}
|
|
24
|
-
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
25
|
-
}, {
|
|
25
|
+
}>>, {
|
|
26
26
|
disabled: boolean;
|
|
27
27
|
modelValue: boolean;
|
|
28
28
|
not: boolean;
|
|
@@ -36,7 +36,7 @@ export type VvAccordionPropsTypes = ExtractPropTypes<typeof VvAccordionProps>;
|
|
|
36
36
|
* Merges local and group props
|
|
37
37
|
*/
|
|
38
38
|
export declare function useGroupProps(props: VvAccordionPropsTypes, emit: (event: string, value: unknown) => void): {
|
|
39
|
-
modelValue:
|
|
39
|
+
modelValue: globalThis.WritableComputedRef<any>;
|
|
40
40
|
not: Ref<boolean>;
|
|
41
41
|
isInGroup: globalThis.ComputedRef<boolean>;
|
|
42
42
|
group: Ref<AccordionGroupState> | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { unref, inject, computed, toRef, toRefs, defineComponent, useAttrs, ref, openBlock, createElementBlock, normalizeClass, createElementVNode, withModifiers, renderSlot, normalizeProps, guardReactiveProps, createTextVNode, toDisplayString, isRef, provide, watchEffect, watch, Fragment, renderList, createBlock, mergeProps, withCtx } from "vue";
|
|
2
|
-
import {
|
|
2
|
+
import { uid } from "uid";
|
|
3
3
|
import { useToggle, useStorage } from "@vueuse/core";
|
|
4
4
|
var Strategy = /* @__PURE__ */ ((Strategy2) => {
|
|
5
5
|
Strategy2["absolute"] = "absolute";
|
|
@@ -35,6 +35,13 @@ var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
|
35
35
|
ButtonType2["reset"] = "reset";
|
|
36
36
|
return ButtonType2;
|
|
37
37
|
})(ButtonType || {});
|
|
38
|
+
var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
|
|
39
|
+
ActionTag2["nuxtLink"] = "nuxt-link";
|
|
40
|
+
ActionTag2["routerLink"] = "router-link";
|
|
41
|
+
ActionTag2["a"] = "a";
|
|
42
|
+
ActionTag2["button"] = "button";
|
|
43
|
+
return ActionTag2;
|
|
44
|
+
})(ActionTag || {});
|
|
38
45
|
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
39
46
|
AnchorTarget2["_blank"] = "_blank";
|
|
40
47
|
AnchorTarget2["_self"] = "_self";
|
|
@@ -82,6 +89,12 @@ const ActiveProps = {
|
|
|
82
89
|
*/
|
|
83
90
|
active: Boolean
|
|
84
91
|
};
|
|
92
|
+
const CurrentProps = {
|
|
93
|
+
/**
|
|
94
|
+
* Whether the item is current
|
|
95
|
+
*/
|
|
96
|
+
current: Boolean
|
|
97
|
+
};
|
|
85
98
|
const PressedProps = {
|
|
86
99
|
/**
|
|
87
100
|
* Whether the item is pressed
|
|
@@ -212,6 +225,7 @@ const ModifiersProps = {
|
|
|
212
225
|
...LabelProps,
|
|
213
226
|
...PressedProps,
|
|
214
227
|
...ActiveProps,
|
|
228
|
+
...CurrentProps,
|
|
215
229
|
...LinkProps,
|
|
216
230
|
/**
|
|
217
231
|
* Button type
|
|
@@ -227,6 +241,13 @@ const ModifiersProps = {
|
|
|
227
241
|
ariaLabel: {
|
|
228
242
|
type: String,
|
|
229
243
|
default: void 0
|
|
244
|
+
},
|
|
245
|
+
/**
|
|
246
|
+
* Default tag for the action
|
|
247
|
+
*/
|
|
248
|
+
defaultTag: {
|
|
249
|
+
type: String,
|
|
250
|
+
default: ActionTag.button
|
|
230
251
|
}
|
|
231
252
|
});
|
|
232
253
|
function isEmpty(value) {
|
|
@@ -378,7 +399,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
378
399
|
const props = __props;
|
|
379
400
|
const attrs = useAttrs();
|
|
380
401
|
const accordionName = computed(
|
|
381
|
-
() => props.name || (attrs == null ? void 0 : attrs.id) ||
|
|
402
|
+
() => props.name || (attrs == null ? void 0 : attrs.id) || uid()
|
|
382
403
|
);
|
|
383
404
|
const {
|
|
384
405
|
modifiers,
|
|
@@ -451,7 +472,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
451
472
|
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => unref(onClick)(), ["prevent"]))
|
|
452
473
|
}, [
|
|
453
474
|
renderSlot(_ctx.$slots, "summary", normalizeProps(guardReactiveProps({ open: unref(isOpen) })), () => [
|
|
454
|
-
createTextVNode(
|
|
475
|
+
createTextVNode(
|
|
476
|
+
toDisplayString(unref(title)),
|
|
477
|
+
1
|
|
478
|
+
/* TEXT */
|
|
479
|
+
)
|
|
455
480
|
])
|
|
456
481
|
], 8, _hoisted_2),
|
|
457
482
|
createElementVNode("div", {
|
|
@@ -459,7 +484,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
459
484
|
class: "vv-accordion__content"
|
|
460
485
|
}, [
|
|
461
486
|
renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({ open: unref(isOpen) })), () => [
|
|
462
|
-
createTextVNode(
|
|
487
|
+
createTextVNode(
|
|
488
|
+
toDisplayString(unref(content)),
|
|
489
|
+
1
|
|
490
|
+
/* TEXT */
|
|
491
|
+
)
|
|
463
492
|
])
|
|
464
493
|
], 8, _hoisted_3)
|
|
465
494
|
], 10, _hoisted_1);
|
|
@@ -581,29 +610,48 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
581
610
|
}))
|
|
582
611
|
);
|
|
583
612
|
return (_ctx, _cache) => {
|
|
584
|
-
return openBlock(), createElementBlock(
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
613
|
+
return openBlock(), createElementBlock(
|
|
614
|
+
"div",
|
|
615
|
+
{
|
|
616
|
+
class: normalizeClass(unref(bemCssClasses))
|
|
617
|
+
},
|
|
618
|
+
[
|
|
619
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
620
|
+
(openBlock(true), createElementBlock(
|
|
621
|
+
Fragment,
|
|
622
|
+
null,
|
|
623
|
+
renderList(unref(items), (item) => {
|
|
624
|
+
return openBlock(), createBlock(
|
|
625
|
+
_sfc_main$1,
|
|
626
|
+
mergeProps({
|
|
627
|
+
key: item.title
|
|
628
|
+
}, {
|
|
629
|
+
name: item.name,
|
|
630
|
+
title: item.title,
|
|
631
|
+
content: item.content
|
|
632
|
+
}),
|
|
633
|
+
{
|
|
634
|
+
header: withCtx((data) => [
|
|
635
|
+
renderSlot(_ctx.$slots, `header::${item.name}`, normalizeProps(guardReactiveProps(data)))
|
|
636
|
+
]),
|
|
637
|
+
details: withCtx((data) => [
|
|
638
|
+
renderSlot(_ctx.$slots, `details::${item.name}`, normalizeProps(guardReactiveProps(data)))
|
|
639
|
+
]),
|
|
640
|
+
_: 2
|
|
641
|
+
/* DYNAMIC */
|
|
642
|
+
},
|
|
643
|
+
1040
|
|
644
|
+
/* FULL_PROPS, DYNAMIC_SLOTS */
|
|
645
|
+
);
|
|
646
|
+
}),
|
|
647
|
+
128
|
|
648
|
+
/* KEYED_FRAGMENT */
|
|
649
|
+
))
|
|
650
|
+
])
|
|
651
|
+
],
|
|
652
|
+
2
|
|
653
|
+
/* CLASS */
|
|
654
|
+
);
|
|
607
655
|
};
|
|
608
656
|
}
|
|
609
657
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("uid"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","uid","@vueuse/core"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvAccordionGroup=o(e.vue,e.uid,e.core)}(this,(function(e,o,r){"use strict";var t=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(t||{}),l=(e=>(e.before="before",e.after="after",e))(l||{}),a=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(a||{}),n=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(n||{});const u=Symbol.for("accordionGroup"),i=(Boolean,Boolean,Boolean,Boolean,{modifiers:[String,Array]});function d(o){const r=e.inject(o,void 0),t=e.computed((()=>{return o=r,!(null==(t=e.unref(o))||""===t||Array.isArray(t)&&0===t.length||!(t instanceof Date)&&"object"==typeof t&&0===Object.keys(t).length);var o,t}));return{group:r,isInGroup:t,getGroupOrLocalRef:function(o,t,l){if(null==r?void 0:r.value){const t=e.unref(r.value)[o];return e.computed({get:()=>null==t?void 0:t.value,set(e){t.value=e}})}const a=e.toRef(t,o);return e.computed({get:()=>a.value,set(e){l&&l(`update:${o}`,e)}})}}}l.before,t.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,a.button,n.button;const s={...i,name:String,title:String,content:String,modelValue:{type:Boolean,default:void 0},disabled:Boolean,not:Boolean};function c(o,r,t){return e.computed((()=>{const l={[o]:!0},a="string"==typeof(null==r?void 0:r.value)?r.value.split(" "):null==r?void 0:r.value;return a&&Array.isArray(a)&&a.forEach((e=>{e&&(l[`${o}--${e}`]=!0)})),t&&Object.keys(t.value).forEach((r=>{l[`${o}--${r}`]=e.unref(t.value[r])})),l}))}const v=["id","open"],p=["aria-controls","aria-expanded"],m=["aria-hidden"],f=e.defineComponent({name:"VvAccordion",props:s,emits:["update:modelValue"],setup(t,{emit:l}){const a=t,n=e.useAttrs(),i=e.computed((()=>a.name||(null==n?void 0:n.id)||o.uid())),{modifiers:s,title:f,content:y,disabled:g,collapse:b,modelValue:A,isInGroup:B,not:V}=function(o,r){const{group:t,isInGroup:l,getGroupOrLocalRef:a}=d(u),{title:n,content:i}=e.toRefs(o),s=a("modelValue",o,r),c=a("not",o),v=a("collapse",o),p=e.computed((()=>{var e;return Boolean(o.disabled||(null==(e=null==t?void 0:t.value)?void 0:e.disabled.value))})),m=e.computed((()=>{let e=o.modifiers,r=null==t?void 0:t.value.modifiers.value;const l=new Set;return e&&(Array.isArray(e)||(e=e.split(" ")),e.forEach((e=>l.add(e)))),r&&(Array.isArray(r)||(r=r.split(" ")),r.forEach((e=>l.add(e)))),Array.from(l)}));return{modelValue:s,not:c,isInGroup:l,group:t,collapse:v,modifiers:m,disabled:p,title:n,content:i}}(a,l),h=e.ref(!1),k=e.computed({get:()=>{let e=A.value;return B.value?e=b.value&&Array.isArray(A.value)?A.value.includes(i.value):A.value===i.value:void 0===A.value&&(e=h.value),V.value?!e:e},set:e=>{if(V.value&&(e=!e),B.value)return b.value&&Array.isArray(A.value)?e?void A.value.push(i.value):void(A.value=A.value.filter((e=>e!==i.value))):void(A.value=e?i.value:null);void 0!==A.value||"boolean"!=typeof e?A.value=e:h.value=e}}),S=c("vv-accordion",s,e.computed((()=>({disabled:g.value})))),$=r.useToggle(k);return(o,r)=>(e.openBlock(),e.createElementBlock("details",{id:e.unref(i),class:e.normalizeClass(e.unref(S)),open:e.unref(k)},[e.createElementVNode("summary",{"aria-controls":e.unref(i),"aria-expanded":e.unref(k),class:"vv-accordion__summary",onClick:r[0]||(r[0]=e.withModifiers((o=>e.unref($)()),["prevent"]))},[e.renderSlot(o.$slots,"summary",e.normalizeProps(e.guardReactiveProps({open:e.unref(k)})),(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)),1)]))],8,p),e.createElementVNode("div",{"aria-hidden":!e.unref(k),class:"vv-accordion__content"},[e.renderSlot(o.$slots,"default",e.normalizeProps(e.guardReactiveProps({open:e.unref(k)})),(()=>[e.createTextVNode(e.toDisplayString(e.unref(y)),1)]))],8,m)],10,v))}}),y={...i,modelValue:[String,Array],items:{type:Array,default:()=>[]},collapse:Boolean,itemModifiers:{type:[String,Array],default:""},disabled:Boolean,not:Boolean,storeKey:String};return e.defineComponent({name:"VvAccordionGroup",props:y,emits:["update:modelValue"],setup(o,{emit:t}){const l=o,{disabled:a,collapse:n,modifiers:i,itemModifiers:d,items:s,not:v}=e.toRefs(l);e.watchEffect((()=>{"string"==typeof l.modelValue&&n.value&&console.warn("[VvAccordionGroup]: modelValue is a string but collapse is true.")}));let p=e.ref([]);e.watch((()=>l.storeKey),(o=>{p=o?r.useStorage(o,p.value):e.ref([])}),{immediate:!0});const m=e.computed({get:()=>{var e;return void 0!==l.modelValue?n.value?l.modelValue:Array.isArray(l.modelValue)?l.modelValue[0]:l.modelValue:n.value?p.value:null==(e=p.value)?void 0:e[0]},set:e=>{if(void 0!==l.modelValue)return!Array.isArray(l.modelValue)&&!n.value||Array.isArray(e)||(e=[e]),t("update:modelValue",e);p.value=Array.isArray(e)?e:[e]}});!function(o){if(Object.keys(o).some((r=>"key"!==r&&!e.isRef(o[r]))))throw Error("One or more groupState props aren't ref.");e.provide(o.key,e.computed((()=>o)))}({key:u,modelValue:m,disabled:a,collapse:n,modifiers:d,not:v});const y=c("vv-accordion-group",i,e.computed((()=>({disabled:a.value}))));return(o,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(y))},[e.renderSlot(o.$slots,"default",{},(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),(r=>(e.openBlock(),e.createBlock(f,e.mergeProps({key:r.title},{name:r.name,title:r.title,content:r.content}),{header:e.withCtx((t=>[e.renderSlot(o.$slots,`header::${r.name}`,e.normalizeProps(e.guardReactiveProps(t)))])),details:e.withCtx((t=>[e.renderSlot(o.$slots,`details::${r.name}`,e.normalizeProps(e.guardReactiveProps(t)))])),_:2},1040)))),128))]))],2))}})}));
|
|
@@ -13,7 +13,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
13
13
|
not: BooleanConstructor;
|
|
14
14
|
storeKey: StringConstructor;
|
|
15
15
|
modifiers: globalThis.PropType<string | string[]>;
|
|
16
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
16
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
17
|
+
[x: string]: (...args: any[]) => void;
|
|
18
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
17
19
|
modelValue: (ArrayConstructor | StringConstructor)[];
|
|
18
20
|
items: {
|
|
19
21
|
type: globalThis.PropType<import(".").VvAccordionGroupItem[]>;
|
|
@@ -28,12 +30,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
28
30
|
not: BooleanConstructor;
|
|
29
31
|
storeKey: StringConstructor;
|
|
30
32
|
modifiers: globalThis.PropType<string | string[]>;
|
|
31
|
-
}
|
|
32
|
-
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
33
|
-
}, {
|
|
33
|
+
}>>, {
|
|
34
34
|
disabled: boolean;
|
|
35
|
-
not: boolean;
|
|
36
35
|
collapse: boolean;
|
|
36
|
+
not: boolean;
|
|
37
37
|
items: import(".").VvAccordionGroupItem[];
|
|
38
38
|
itemModifiers: string | string[];
|
|
39
39
|
}, {}>, Partial<Record<string, (_: any) => any>> & Partial<Record<string, (_: any) => any>> & {
|
|
@@ -93,6 +93,12 @@ const ActiveProps = {
|
|
|
93
93
|
*/
|
|
94
94
|
active: Boolean
|
|
95
95
|
};
|
|
96
|
+
const CurrentProps = {
|
|
97
|
+
/**
|
|
98
|
+
* Whether the item is current
|
|
99
|
+
*/
|
|
100
|
+
current: Boolean
|
|
101
|
+
};
|
|
96
102
|
const PressedProps = {
|
|
97
103
|
/**
|
|
98
104
|
* Whether the item is pressed
|
|
@@ -217,6 +223,7 @@ const ActionProps = {
|
|
|
217
223
|
...LabelProps,
|
|
218
224
|
...PressedProps,
|
|
219
225
|
...ActiveProps,
|
|
226
|
+
...CurrentProps,
|
|
220
227
|
...LinkProps,
|
|
221
228
|
/**
|
|
222
229
|
* Button type
|
|
@@ -232,6 +239,13 @@ const ActionProps = {
|
|
|
232
239
|
ariaLabel: {
|
|
233
240
|
type: String,
|
|
234
241
|
default: void 0
|
|
242
|
+
},
|
|
243
|
+
/**
|
|
244
|
+
* Default tag for the action
|
|
245
|
+
*/
|
|
246
|
+
defaultTag: {
|
|
247
|
+
type: String,
|
|
248
|
+
default: ActionTag.button
|
|
235
249
|
}
|
|
236
250
|
};
|
|
237
251
|
const VvActionEvents = ["click", "mouseover", "mouseleave"];
|
|
@@ -284,7 +298,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
284
298
|
case props.href !== void 0:
|
|
285
299
|
return ActionTag.a;
|
|
286
300
|
default:
|
|
287
|
-
return
|
|
301
|
+
return props.defaultTag;
|
|
288
302
|
}
|
|
289
303
|
});
|
|
290
304
|
const hasProps = computed(() => {
|
|
@@ -309,12 +323,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
309
323
|
to: props.to,
|
|
310
324
|
target: props.target
|
|
311
325
|
};
|
|
312
|
-
|
|
326
|
+
case ActionTag.button:
|
|
313
327
|
return {
|
|
314
328
|
...toReturn,
|
|
315
329
|
type: props.type,
|
|
316
330
|
disabled: props.disabled
|
|
317
331
|
};
|
|
332
|
+
default:
|
|
333
|
+
return toReturn;
|
|
318
334
|
}
|
|
319
335
|
});
|
|
320
336
|
const onClick = (e) => {
|
|
@@ -340,7 +356,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
340
356
|
class: {
|
|
341
357
|
active: _ctx.active,
|
|
342
358
|
pressed: unref(pressed),
|
|
343
|
-
disabled: _ctx.disabled
|
|
359
|
+
disabled: _ctx.disabled,
|
|
360
|
+
current: _ctx.current
|
|
344
361
|
},
|
|
345
362
|
onClickPassive: onClick,
|
|
346
363
|
onMouseoverPassive: onMouseover,
|
|
@@ -348,10 +365,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
348
365
|
}), {
|
|
349
366
|
default: withCtx(() => [
|
|
350
367
|
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
351
|
-
createTextVNode(
|
|
368
|
+
createTextVNode(
|
|
369
|
+
toDisplayString(_ctx.label),
|
|
370
|
+
1
|
|
371
|
+
/* TEXT */
|
|
372
|
+
)
|
|
352
373
|
])
|
|
353
374
|
]),
|
|
354
375
|
_: 3
|
|
376
|
+
/* FORWARDED */
|
|
355
377
|
}, 16, ["class"]);
|
|
356
378
|
};
|
|
357
379
|
}
|