@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.
- package/LICENSE +1 -1
- package/README.md +52 -13
- package/dist/Volver.d.ts +5 -1
- package/dist/components/VvAccordion/VvAccordion.es.js +113 -66
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +159 -101
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAction/VvAction.es.js +170 -0
- package/dist/components/VvAction/VvAction.umd.js +1 -0
- package/dist/components/VvAction/VvAction.vue.d.ts +63 -0
- package/dist/components/VvAction/index.d.ts +24 -0
- package/dist/components/VvBadge/VvBadge.es.js +86 -16
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +97 -41
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvButton/VvButton.es.js +434 -251
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +50 -50
- package/dist/components/VvButton/index.d.ts +22 -67
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +118 -43
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvCard/VvCard.es.js +38 -25
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +334 -154
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +2 -2
- package/dist/components/VvCheckbox/index.d.ts +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +401 -204
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +2 -2
- package/dist/components/VvCheckboxGroup/index.d.ts +1 -1
- package/dist/components/VvCombobox/VvCombobox.es.js +950 -594
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +54 -30
- package/dist/components/VvCombobox/index.d.ts +18 -13
- package/dist/components/VvDialog/VvDialog.es.js +139 -64
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +276 -158
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +9 -9
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +61 -0
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +52 -0
- package/dist/components/VvDropdown/index.d.ts +6 -9
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +251 -0
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -0
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +30 -15
- package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +176 -0
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -0
- package/dist/components/VvIcon/VvIcon.es.js +48 -32
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.es.js +508 -344
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +11 -4
- package/dist/components/VvInputText/index.d.ts +13 -2
- package/dist/components/VvProgress/VvProgress.es.js +90 -20
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +305 -125
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +2 -2
- package/dist/components/VvRadio/index.d.ts +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +372 -175
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +2 -2
- package/dist/components/VvRadioGroup/index.d.ts +1 -1
- package/dist/components/VvSelect/VvSelect.es.js +371 -216
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +11 -4
- package/dist/components/VvSelect/index.d.ts +5 -5
- package/dist/components/VvTextarea/VvTextarea.es.js +408 -244
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +11 -4
- package/dist/components/VvTextarea/index.d.ts +5 -5
- package/dist/components/VvTooltip/VvTooltip.es.js +88 -18
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/index.es.js +1913 -1521
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
- package/dist/composables/dropdown/useProvideDropdown.d.ts +2 -2
- package/dist/constants.d.ts +30 -0
- package/dist/directives/index.es.js +128 -0
- package/dist/directives/index.umd.js +1 -0
- package/dist/directives/v-tooltip.es.js +126 -0
- package/dist/directives/v-tooltip.umd.js +1 -0
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/index.es.js +2102 -1761
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +179 -11
- package/dist/resolvers/unplugin.d.ts +8 -8
- package/dist/resolvers/unplugin.es.js +51 -30
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/Combobox/Combobox.settings.d.ts +44 -0
- package/dist/stories/Dropdown/Dropdown.settings.d.ts +3 -2
- package/package.json +60 -34
- package/src/Volver.ts +12 -5
- 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/VvAction/VvAction.vue +144 -0
- package/src/components/VvAction/index.ts +5 -0
- package/src/components/VvButton/VvButton.vue +31 -114
- package/src/components/VvButton/index.ts +6 -79
- package/src/components/VvCombobox/VvCombobox.vue +54 -42
- package/src/components/VvCombobox/index.ts +11 -9
- package/src/components/VvDropdown/VvDropdownAction.vue +44 -0
- package/src/components/VvDropdown/VvDropdownOption.vue +65 -0
- package/src/components/VvDropdown/index.ts +4 -9
- package/src/components/VvSelect/index.ts +2 -4
- package/src/composables/dropdown/useInjectDropdown.ts +1 -1
- package/src/composables/dropdown/useProvideDropdown.ts +7 -9
- package/src/composables/useModifiers.ts +4 -7
- package/src/constants.ts +36 -0
- package/src/props/index.ts +106 -14
- package/src/resolvers/unplugin.ts +81 -48
- package/src/stories/Accordion/AccordionSlots.stories.mdx +2 -2
- package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +2 -1
- package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +2 -1
- package/src/stories/Button/Button.stories.mdx +4 -2
- package/src/stories/Button/Button.test.ts +3 -1
- package/src/stories/Button/ButtonModifiers.stories.mdx +2 -2
- package/src/stories/Button/ButtonSlots.stories.mdx +8 -7
- package/src/stories/Button/ButtonState.stories.mdx +2 -11
- package/src/stories/Card/Card.stories.mdx +2 -1
- package/src/stories/Checkbox/Checkbox.stories.mdx +2 -1
- package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +2 -1
- package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +2 -1
- package/src/stories/Combobox/Combobox.settings.ts +44 -0
- package/src/stories/Combobox/Combobox.stories.mdx +40 -1
- package/src/stories/Dialog/Dialog.stories.mdx +2 -1
- package/src/stories/Dropdown/Dropdown.settings.ts +3 -2
- package/src/stories/Dropdown/Dropdown.stories.mdx +14 -12
- package/src/stories/Dropdown/DropdownMultilevel.stories.mdx +56 -0
- package/src/stories/Dropdown/DropdownSlots.stories.mdx +14 -13
- package/src/stories/Icon/Icon.stories.mdx +2 -1
- package/src/stories/Icon/IconsCollection.stories.mdx +2 -1
- package/src/stories/InputText/InputText.stories.mdx +2 -1
- package/src/stories/Progress/Progress.stories.mdx +2 -1
- package/src/stories/Radio/Radio.stories.mdx +2 -1
- package/src/stories/RadioGroup/RadioGroup.stories.mdx +2 -1
- package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +2 -1
- package/src/stories/Select/Select.stories.mdx +2 -1
- package/src/stories/Textarea/Textarea.stories.mdx +2 -1
- package/src/stories/Tooltip/Tooltip.stories.mdx +2 -1
- package/src/stories/Tooltip/TooltipDirective.stories.mdx +2 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
28
|
# pnpm
|
|
29
|
-
pnpm add @volverjs/
|
|
29
|
+
pnpm add @volverjs/ui-vue
|
|
30
30
|
|
|
31
31
|
# yarn
|
|
32
|
-
yarn add @volverjs/
|
|
32
|
+
yarn add @volverjs/ui-vue
|
|
33
33
|
|
|
34
34
|
# npm
|
|
35
|
-
npm install @volverjs/
|
|
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
|
|
55
|
-
* import '@volverjs/style/scss/
|
|
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/
|
|
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
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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 {
|
|
2
|
-
import { nanoid as
|
|
3
|
-
|
|
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
|
-
},
|
|
32
|
-
function
|
|
33
|
-
const { group: l, isInGroup:
|
|
34
|
-
|
|
35
|
-
), { title:
|
|
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:
|
|
39
|
-
disabled:
|
|
40
|
-
isInGroup:
|
|
73
|
+
modelValue: p,
|
|
74
|
+
disabled: u,
|
|
75
|
+
isInGroup: a,
|
|
41
76
|
group: l,
|
|
42
|
-
collapse:
|
|
43
|
-
modifiers:
|
|
77
|
+
collapse: v,
|
|
78
|
+
modifiers: n,
|
|
44
79
|
// local props
|
|
45
|
-
title:
|
|
46
|
-
content:
|
|
80
|
+
title: s,
|
|
81
|
+
content: d
|
|
47
82
|
};
|
|
48
83
|
}
|
|
49
|
-
|
|
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
|
-
},
|
|
52
|
-
...
|
|
53
|
-
props:
|
|
54
|
-
emits:
|
|
55
|
-
setup(
|
|
56
|
-
const l =
|
|
57
|
-
() => l.name || (
|
|
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:
|
|
60
|
-
title:
|
|
61
|
-
content:
|
|
62
|
-
disabled:
|
|
63
|
-
collapse:
|
|
64
|
-
modelValue:
|
|
65
|
-
isInGroup:
|
|
66
|
-
} =
|
|
67
|
-
get: () =>
|
|
68
|
-
set: (
|
|
69
|
-
if (
|
|
70
|
-
if (
|
|
71
|
-
if (
|
|
72
|
-
|
|
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
|
-
|
|
76
|
-
(
|
|
122
|
+
n.value = n.value.filter(
|
|
123
|
+
(m) => m !== t.value
|
|
77
124
|
);
|
|
78
125
|
return;
|
|
79
126
|
}
|
|
80
|
-
|
|
127
|
+
n.value = c ? t.value : null;
|
|
81
128
|
return;
|
|
82
129
|
}
|
|
83
|
-
if (
|
|
84
|
-
_.value =
|
|
130
|
+
if (n.value === void 0 && typeof c == "boolean") {
|
|
131
|
+
_.value = c;
|
|
85
132
|
return;
|
|
86
133
|
}
|
|
87
|
-
|
|
134
|
+
n.value = c;
|
|
88
135
|
}
|
|
89
|
-
}),
|
|
136
|
+
}), R = U(
|
|
90
137
|
"vv-accordion",
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
disabled:
|
|
138
|
+
s,
|
|
139
|
+
i(() => ({
|
|
140
|
+
disabled: u.value
|
|
94
141
|
}))
|
|
95
|
-
),
|
|
96
|
-
return (
|
|
97
|
-
id: t
|
|
98
|
-
class:
|
|
99
|
-
open:
|
|
100
|
-
onClick:
|
|
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
|
-
|
|
103
|
-
"aria-controls": t
|
|
104
|
-
"aria-expanded":
|
|
149
|
+
g("summary", {
|
|
150
|
+
"aria-controls": r(t),
|
|
151
|
+
"aria-expanded": r(f),
|
|
105
152
|
class: "vv-collapse__summary"
|
|
106
153
|
}, [
|
|
107
|
-
|
|
108
|
-
|
|
154
|
+
A(c.$slots, "summary", b(C({ open: r(f) })), () => [
|
|
155
|
+
G(O(r(d)), 1)
|
|
109
156
|
])
|
|
110
|
-
], 8,
|
|
111
|
-
|
|
112
|
-
"aria-hidden": !
|
|
157
|
+
], 8, q),
|
|
158
|
+
g("div", {
|
|
159
|
+
"aria-hidden": !r(f),
|
|
113
160
|
class: "vv-collapse__content"
|
|
114
161
|
}, [
|
|
115
|
-
|
|
116
|
-
|
|
162
|
+
A(c.$slots, "details", b(C({ open: r(f) })), () => [
|
|
163
|
+
G(O(r(p)), 1)
|
|
117
164
|
])
|
|
118
|
-
], 8,
|
|
119
|
-
], 10,
|
|
165
|
+
], 8, F)
|
|
166
|
+
], 10, Y));
|
|
120
167
|
}
|
|
121
168
|
});
|
|
122
169
|
export {
|
|
123
|
-
|
|
170
|
+
w as default
|
|
124
171
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,
|
|
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))}})});
|