@volverjs/ui-vue 0.0.10-beta.1 → 0.0.10-beta.11
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 +15 -3
- package/dist/components/VvBreadcrumb/index.d.ts +2 -9
- package/dist/components/VvButton/VvButton.es.js +67 -22
- 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 +32 -4
- 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 +101 -46
- 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 +625 -379
- 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 +32 -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 +32 -4
- 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 +101 -46
- 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 +156 -96
- 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.d.ts +9 -0
- package/dist/components/index.es.js +2015 -1012
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/group/useInjectedGroupState.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/resolvers/unplugin.d.ts +6 -1
- package/dist/resolvers/unplugin.es.js +20 -5
- package/dist/resolvers/unplugin.umd.js +1 -1
- 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/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 +18 -0
- package/package.json +60 -51
- 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 +19 -8
- 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/VvTab/VvTab.vue +63 -35
- package/src/components/VvTab/index.ts +10 -4
- package/src/components/VvTextarea/VvTextarea.vue +1 -1
- package/src/components/index.ts +9 -0
- 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/resolvers/unplugin.ts +22 -2
- package/src/stories/Button/ButtonModifiers.stories.ts +4 -14
- package/src/stories/Combobox/Combobox.settings.ts +8 -0
- 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 +20 -0
- 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
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import {
|
|
8
|
+
import { uid } from 'uid'
|
|
9
9
|
import { VvAccordionEvents, VvAccordionProps, useGroupProps } from '.'
|
|
10
10
|
|
|
11
11
|
// props, attrs and emit
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
// data
|
|
17
17
|
const accordionName = computed(
|
|
18
|
-
() => props.name || (attrs?.id as string) ||
|
|
18
|
+
() => props.name || (attrs?.id as string) || uid(),
|
|
19
19
|
)
|
|
20
20
|
const {
|
|
21
21
|
modifiers,
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
case props.href !== undefined:
|
|
56
56
|
return ActionTag.a
|
|
57
57
|
default:
|
|
58
|
-
return
|
|
58
|
+
return props.defaultTag // button
|
|
59
59
|
}
|
|
60
60
|
})
|
|
61
61
|
|
|
@@ -85,12 +85,14 @@
|
|
|
85
85
|
to: props.to,
|
|
86
86
|
target: props.target,
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
case ActionTag.button:
|
|
89
89
|
return {
|
|
90
90
|
...toReturn,
|
|
91
91
|
type: props.type,
|
|
92
92
|
disabled: props.disabled,
|
|
93
93
|
}
|
|
94
|
+
default:
|
|
95
|
+
return toReturn
|
|
94
96
|
}
|
|
95
97
|
})
|
|
96
98
|
|
|
@@ -132,6 +134,7 @@
|
|
|
132
134
|
active,
|
|
133
135
|
pressed,
|
|
134
136
|
disabled,
|
|
137
|
+
current,
|
|
135
138
|
}"
|
|
136
139
|
@click.passive="onClick"
|
|
137
140
|
@mouseover.passive="onMouseover"
|
|
@@ -7,46 +7,47 @@
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
8
|
import { useModifiers } from '../../composables/useModifiers'
|
|
9
9
|
import { VvBreadcrumbProps } from '.'
|
|
10
|
+
import VvAction from '../VvAction/VvAction.vue'
|
|
10
11
|
|
|
11
12
|
const props = defineProps(VvBreadcrumbProps)
|
|
12
13
|
const { modifiers } = toRefs(props)
|
|
13
14
|
const bemCssClasses = useModifiers('vv-breadcrumb', modifiers)
|
|
15
|
+
const length = computed(() => props.routes?.length ?? 0)
|
|
16
|
+
|
|
17
|
+
const isLast = (index: number) => index === length.value - 1
|
|
14
18
|
</script>
|
|
15
19
|
|
|
16
20
|
<template>
|
|
17
21
|
<nav :class="bemCssClasses" aria-label="breadcrumbs">
|
|
18
22
|
<ol class="vv-breadcrumb__list">
|
|
19
23
|
<li
|
|
20
|
-
v-for="(route, index) in routes"
|
|
21
|
-
:key="`${
|
|
22
|
-
:class="
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
v-for="({ label, ...route }, index) in routes"
|
|
25
|
+
:key="`${label}-${index}`"
|
|
26
|
+
:class="
|
|
27
|
+
!isLast(index)
|
|
28
|
+
? 'vv-breadcrumb__item'
|
|
29
|
+
: 'vv-breadcrumb__item-active'
|
|
30
|
+
"
|
|
27
31
|
itemprop="itemListElement"
|
|
28
32
|
itemtype="https://schema.org/ListItem"
|
|
29
33
|
itemscope
|
|
30
34
|
>
|
|
31
|
-
<
|
|
32
|
-
:is="route.to ? 'router-link' : route.href ? 'a' : 'span'"
|
|
35
|
+
<VvAction
|
|
33
36
|
v-bind="route"
|
|
34
|
-
:class="
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
:aria-current="
|
|
39
|
-
index === Number(routes?.length) - 1
|
|
40
|
-
? 'page'
|
|
41
|
-
: undefined
|
|
37
|
+
:class="
|
|
38
|
+
!isLast(index)
|
|
39
|
+
? 'vv-breadcrumb__link'
|
|
40
|
+
: 'vv-breadcrumb__label'
|
|
42
41
|
"
|
|
42
|
+
:aria-current="isLast(index) ? 'page' : undefined"
|
|
43
43
|
itemprop="item"
|
|
44
|
+
default-tag="span"
|
|
44
45
|
>
|
|
45
46
|
<!-- @slot Slot for label -->
|
|
46
47
|
<slot name="label" v-bind="{ route, index }">
|
|
47
|
-
{{
|
|
48
|
+
{{ label }}
|
|
48
49
|
</slot>
|
|
49
|
-
</
|
|
50
|
+
</VvAction>
|
|
50
51
|
<meta itemprop="position" :content="`${index + 1}`" />
|
|
51
52
|
</li>
|
|
52
53
|
</ol>
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { ModifiersProps } from '../../props'
|
|
2
|
-
|
|
3
|
-
export interface Route {
|
|
4
|
-
label: string
|
|
5
|
-
to?: string | { [key: string]: unknown }
|
|
6
|
-
title?: string
|
|
7
|
-
href?: string
|
|
8
|
-
}
|
|
2
|
+
import type { NavItem } from '../../types'
|
|
9
3
|
|
|
10
4
|
export const VvBreadcrumbProps = {
|
|
11
5
|
...ModifiersProps,
|
|
12
|
-
routes: Array as PropType<
|
|
6
|
+
routes: Array as PropType<NavItem[]>,
|
|
13
7
|
}
|
|
@@ -87,9 +87,13 @@
|
|
|
87
87
|
searchText,
|
|
88
88
|
computed(() => Number(props.debounceSearch)),
|
|
89
89
|
)
|
|
90
|
-
watch(debouncedSearchText, () =>
|
|
91
|
-
emit('
|
|
92
|
-
|
|
90
|
+
watch(debouncedSearchText, () => {
|
|
91
|
+
emit('update:search', debouncedSearchText.value)
|
|
92
|
+
/**
|
|
93
|
+
* @deprecated change:search should not be used, use update:search instead
|
|
94
|
+
*/
|
|
95
|
+
emit('change:search', debouncedSearchText.value)
|
|
96
|
+
})
|
|
93
97
|
|
|
94
98
|
// expanded
|
|
95
99
|
const expanded = ref(false)
|
|
@@ -173,7 +177,7 @@
|
|
|
173
177
|
valid: valid.value,
|
|
174
178
|
invalid: invalid.value,
|
|
175
179
|
dirty: isDirty.value,
|
|
176
|
-
focus: focused.value,
|
|
180
|
+
focus: focused.value || focusedWithin.value || expanded.value,
|
|
177
181
|
floating: floating.value,
|
|
178
182
|
badges: props.badges,
|
|
179
183
|
})),
|
|
@@ -266,12 +270,13 @@
|
|
|
266
270
|
return
|
|
267
271
|
}
|
|
268
272
|
|
|
273
|
+
// get option value
|
|
269
274
|
const value = getOptionValue(option)
|
|
270
|
-
|
|
271
275
|
let toReturn: string | string[] | Option | Option[] | undefined = value
|
|
272
|
-
|
|
276
|
+
|
|
277
|
+
// check multiple prop, override value with array and remove or add the value
|
|
273
278
|
if (props.multiple) {
|
|
274
|
-
// check
|
|
279
|
+
// check max-values prop and block check new values
|
|
275
280
|
if (Array.isArray(props.modelValue)) {
|
|
276
281
|
const maxValues = Number(props.maxValues)
|
|
277
282
|
if (
|
|
@@ -294,7 +299,13 @@
|
|
|
294
299
|
if (!props.keepOpen) {
|
|
295
300
|
collapse()
|
|
296
301
|
}
|
|
297
|
-
if (
|
|
302
|
+
if (Array.isArray(props.modelValue)) {
|
|
303
|
+
if (props.unselectable && props.modelValue.includes(value)) {
|
|
304
|
+
toReturn = []
|
|
305
|
+
} else {
|
|
306
|
+
toReturn = [value]
|
|
307
|
+
}
|
|
308
|
+
} else if (props.unselectable && value === props.modelValue) {
|
|
298
309
|
toReturn = undefined
|
|
299
310
|
}
|
|
300
311
|
}
|
|
@@ -20,6 +20,10 @@ import type { Option } from '../../types/generic'
|
|
|
20
20
|
|
|
21
21
|
export const VvComboboxEvents = [
|
|
22
22
|
'update:modelValue',
|
|
23
|
+
'update:search',
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated change:search should not be used, use update:search instead
|
|
26
|
+
*/
|
|
23
27
|
'change:search',
|
|
24
28
|
'focus',
|
|
25
29
|
'blur',
|
|
@@ -227,7 +227,7 @@
|
|
|
227
227
|
return
|
|
228
228
|
}
|
|
229
229
|
inputEl.value.stepUp()
|
|
230
|
-
localModelValue.value = unref(inputEl).value
|
|
230
|
+
localModelValue.value = Number(unref(inputEl).value)
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
const onStepDown = () => {
|
|
@@ -238,7 +238,7 @@
|
|
|
238
238
|
return
|
|
239
239
|
}
|
|
240
240
|
inputEl.value.stepDown()
|
|
241
|
-
localModelValue.value = unref(inputEl).value
|
|
241
|
+
localModelValue.value = Number(unref(inputEl).value)
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
|
|
@@ -1,66 +1,46 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { VvNavProps, VvNavEvents
|
|
3
|
-
import
|
|
2
|
+
import { VvNavProps, VvNavEvents } from '@/components/VvNav'
|
|
3
|
+
import VvNavItem from './VvNavItem.vue'
|
|
4
4
|
|
|
5
5
|
const props = defineProps(VvNavProps)
|
|
6
|
-
const
|
|
7
|
-
const { modifiers, items } = toRefs(props)
|
|
8
|
-
const activeItem: Ref<string | null> = ref(null)
|
|
6
|
+
const { modifiers } = toRefs(props)
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
const emit = defineEmits(VvNavEvents)
|
|
9
|
+
const onClick = (event: Event) => {
|
|
10
|
+
const target = event.target as HTMLElement
|
|
11
|
+
if (target?.dataset.index) {
|
|
12
|
+
const index = parseInt(target.dataset.index)
|
|
13
|
+
const item = props.items?.[index]
|
|
14
|
+
if (!item || item?.disabled) {
|
|
15
|
+
return
|
|
18
16
|
}
|
|
19
|
-
})
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Triggers when the item is clicked.
|
|
24
|
-
* @private
|
|
25
|
-
* @event click
|
|
26
|
-
* @param [NavItem, string] item - the clicked item
|
|
27
|
-
*/
|
|
28
|
-
function onClick(item: NavItem) {
|
|
29
|
-
if (!item.disabled) {
|
|
30
17
|
emit('click', item)
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
32
|
-
activeItem.value = item.id!
|
|
33
18
|
}
|
|
34
19
|
}
|
|
20
|
+
|
|
21
|
+
// bem css classes
|
|
22
|
+
const bemCssClasses = useModifiers('vv-nav', modifiers)
|
|
35
23
|
</script>
|
|
36
24
|
|
|
37
25
|
<template>
|
|
38
26
|
<nav :class="bemCssClasses">
|
|
39
|
-
<ul
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
>
|
|
46
|
-
<
|
|
47
|
-
v-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}"
|
|
53
|
-
:class="{
|
|
54
|
-
current: activeItem == navItem.id,
|
|
55
|
-
disabled: navItem.disabled,
|
|
56
|
-
}"
|
|
57
|
-
class="vv-nav__item-label"
|
|
58
|
-
v-on="navItem.on"
|
|
59
|
-
@click="onClick(navItem)"
|
|
27
|
+
<ul
|
|
28
|
+
class="vv-nav__menu"
|
|
29
|
+
role="menu"
|
|
30
|
+
aria-busy="true"
|
|
31
|
+
@click.stop="onClick"
|
|
32
|
+
>
|
|
33
|
+
<slot>
|
|
34
|
+
<VvNavItem
|
|
35
|
+
v-for="({ on = {}, data, ...item }, index) in items"
|
|
36
|
+
:key="index"
|
|
37
|
+
:data-index="index"
|
|
38
|
+
v-bind="item"
|
|
39
|
+
v-on="on"
|
|
60
40
|
>
|
|
61
|
-
{
|
|
62
|
-
</
|
|
63
|
-
</
|
|
41
|
+
<slot name="item" v-bind="{ item, data, index }" />
|
|
42
|
+
</VvNavItem>
|
|
43
|
+
</slot>
|
|
64
44
|
</ul>
|
|
65
45
|
</nav>
|
|
66
46
|
</template>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export default {
|
|
3
|
+
name: 'VvNavItem',
|
|
4
|
+
inheritAttrs: false,
|
|
5
|
+
}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
import VvAction from '@/components/VvAction/VvAction.vue'
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<li class="vv-nav__item" role="presentation">
|
|
14
|
+
<VvAction v-bind="$attrs" class="vv-nav__item-label">
|
|
15
|
+
<slot />
|
|
16
|
+
</VvAction>
|
|
17
|
+
</li>
|
|
18
|
+
</template>
|
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
import { ModifiersProps } from '@/props'
|
|
2
|
-
|
|
3
|
-
export type NavItem = {
|
|
4
|
-
id?: string
|
|
5
|
-
title: string
|
|
6
|
-
to?: string | { [key: string]: unknown }
|
|
7
|
-
href?: string
|
|
8
|
-
disabled?: boolean
|
|
9
|
-
on?: Record<string, () => void>
|
|
10
|
-
}
|
|
1
|
+
import { ModifiersProps, NavProps } from '@/props'
|
|
11
2
|
|
|
12
3
|
export const VvNavProps = {
|
|
13
4
|
...ModifiersProps,
|
|
14
|
-
|
|
15
|
-
type: Array as PropType<NavItem[]>,
|
|
16
|
-
required: true,
|
|
17
|
-
default: () => [],
|
|
18
|
-
},
|
|
5
|
+
...NavProps,
|
|
19
6
|
}
|
|
20
7
|
|
|
21
8
|
export const VvNavEvents = ['click']
|
|
@@ -1,53 +1,81 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { VvTabProps, VvTabEvents } from '@/components/VvTab'
|
|
3
|
-
import type { NavItem } from '@/components/VvNav'
|
|
4
3
|
import VvNav from '@/components/VvNav/VvNav.vue'
|
|
4
|
+
import type { NavItemTab } from '@/types/nav'
|
|
5
5
|
|
|
6
6
|
const props = defineProps(VvTabProps)
|
|
7
7
|
const emit = defineEmits(VvTabEvents)
|
|
8
8
|
const { modifiers, items } = toRefs(props)
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const localItems = computed(() => {
|
|
15
|
-
return items.value.map((item, index) => {
|
|
16
|
-
return {
|
|
17
|
-
...item,
|
|
18
|
-
id: item.id || `tab-item_${index}`,
|
|
9
|
+
const tabKeys = computed(() => {
|
|
10
|
+
return items.value.reduce<string[]>((acc, item) => {
|
|
11
|
+
if (item.tab) {
|
|
12
|
+
acc.push(item.tab)
|
|
19
13
|
}
|
|
20
|
-
|
|
14
|
+
return acc
|
|
15
|
+
}, [])
|
|
21
16
|
})
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
emit('
|
|
32
|
-
|
|
33
|
-
|
|
17
|
+
const localModelValue = ref<string | undefined>()
|
|
18
|
+
const activeTabKey = computed({
|
|
19
|
+
get: () => {
|
|
20
|
+
return (
|
|
21
|
+
props.modelValue || localModelValue.value || tabKeys.value?.[0]
|
|
22
|
+
)
|
|
23
|
+
},
|
|
24
|
+
set: (newValue) => {
|
|
25
|
+
localModelValue.value = newValue
|
|
26
|
+
emit('update:modelValue', newValue)
|
|
27
|
+
},
|
|
28
|
+
})
|
|
29
|
+
const hasNavModifiers = computed(() => {
|
|
30
|
+
return [
|
|
31
|
+
'tabs',
|
|
32
|
+
...(Array.isArray(props.navModifiers)
|
|
33
|
+
? props.navModifiers
|
|
34
|
+
: props.navModifiers?.split(' ') ?? []),
|
|
35
|
+
]
|
|
36
|
+
})
|
|
37
|
+
const onNavClick = (item: NavItemTab) => {
|
|
38
|
+
if (item.tab) {
|
|
39
|
+
activeTabKey.value = item.tab
|
|
34
40
|
}
|
|
35
41
|
}
|
|
42
|
+
const navItems = computed(() =>
|
|
43
|
+
props.items.map((item) => ({
|
|
44
|
+
current: item.tab === activeTabKey.value,
|
|
45
|
+
...item,
|
|
46
|
+
})),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
// bem css classes
|
|
50
|
+
const bemCssClasses = useModifiers('vv-tab', modifiers)
|
|
36
51
|
</script>
|
|
37
52
|
|
|
38
53
|
<template>
|
|
39
54
|
<div :class="bemCssClasses">
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
class="vv-tab__panel"
|
|
55
|
+
<!-- #region nav -->
|
|
56
|
+
<VvNav
|
|
57
|
+
v-bind="{
|
|
58
|
+
items: navItems,
|
|
59
|
+
modifiers: hasNavModifiers,
|
|
60
|
+
}"
|
|
61
|
+
@click="onNavClick"
|
|
48
62
|
>
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
63
|
+
<template #item="{ item, index }">
|
|
64
|
+
<slot name="nav-item" v-bind="{ item, index }" />
|
|
65
|
+
</template>
|
|
66
|
+
</VvNav>
|
|
67
|
+
<!-- #endregion -->
|
|
68
|
+
|
|
69
|
+
<!-- #region panels -->
|
|
70
|
+
<template v-for="(item, index) in items" :key="index">
|
|
71
|
+
<article
|
|
72
|
+
v-if="item.tab"
|
|
73
|
+
:class="{ target: activeTabKey === item.tab }"
|
|
74
|
+
class="vv-tab__panel"
|
|
75
|
+
>
|
|
76
|
+
<slot :name="`panel::${item.tab}`" />
|
|
77
|
+
</article>
|
|
78
|
+
</template>
|
|
79
|
+
<!-- #endregion -->
|
|
52
80
|
</div>
|
|
53
81
|
</template>
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { ModifiersProps } from '@/props'
|
|
2
|
-
import type {
|
|
2
|
+
import type { NavItemTab } from '@/types/nav'
|
|
3
3
|
|
|
4
4
|
export const VvTabProps = {
|
|
5
5
|
...ModifiersProps,
|
|
6
|
+
navModifiers: {
|
|
7
|
+
type: [String, Array] as PropType<string | string[]>,
|
|
8
|
+
},
|
|
9
|
+
modelValue: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: '',
|
|
12
|
+
},
|
|
6
13
|
items: {
|
|
7
|
-
type: Array as PropType<
|
|
8
|
-
required: true,
|
|
14
|
+
type: Array as PropType<NavItemTab[]>,
|
|
9
15
|
default: () => [],
|
|
10
16
|
},
|
|
11
17
|
}
|
|
12
18
|
|
|
13
|
-
export const VvTabEvents = ['
|
|
19
|
+
export const VvTabEvents = ['update:modelValue']
|
package/src/components/index.ts
CHANGED
|
@@ -2,6 +2,9 @@ export { default as VvAccordion } from './VvAccordion/VvAccordion.vue'
|
|
|
2
2
|
export { default as VvAccordionGroup } from './VvAccordionGroup/VvAccordionGroup.vue'
|
|
3
3
|
export { default as VvAction } from './VvAction/VvAction.vue'
|
|
4
4
|
export { default as VvAlert } from './VvAlert/VvAlert.vue'
|
|
5
|
+
export { default as VvAlertGroup } from './VvAlertGroup/VvAlertGroup.vue'
|
|
6
|
+
export { default as VvAvatar } from './VvAvatar/VvAvatar.vue'
|
|
7
|
+
export { default as VvAvatarGroup } from './VvAvatarGroup/VvAvatarGroup.vue'
|
|
5
8
|
export { default as VvBadge } from './VvBadge/VvBadge.vue'
|
|
6
9
|
export { default as VvBreadcrumb } from './VvBreadcrumb/VvBreadcrumb.vue'
|
|
7
10
|
export { default as VvButton } from './VvButton/VvButton.vue'
|
|
@@ -12,9 +15,15 @@ export { default as VvCheckboxGroup } from './VvCheckboxGroup/VvCheckboxGroup.vu
|
|
|
12
15
|
export { default as VvCombobox } from './VvCombobox/VvCombobox.vue'
|
|
13
16
|
export { default as VvDialog } from './VvDialog/VvDialog.vue'
|
|
14
17
|
export { default as VvDropdown } from './VvDropdown/VvDropdown.vue'
|
|
18
|
+
export { default as VvDropdownAction } from './VvDropdown/VvDropdownAction.vue'
|
|
19
|
+
export { default as VvDropdownItem } from './VvDropdown/VvDropdownItem.vue'
|
|
20
|
+
export { default as VvDropdownOptgroup } from './VvDropdown/VvDropdownOptgroup.vue'
|
|
21
|
+
export { default as VvDropdownOption } from './VvDropdown/VvDropdownOption.vue'
|
|
15
22
|
export { default as VvIcon } from './VvIcon/VvIcon.vue'
|
|
16
23
|
export { default as VvInputText } from './VvInputText/VvInputText.vue'
|
|
17
24
|
export { default as VvNav } from './VvNav/VvNav.vue'
|
|
25
|
+
export { default as VvNavItem } from './VvNav/VvNavItem.vue'
|
|
26
|
+
export { default as VvNavSeparator } from './VvNav/VvNavSeparator.vue'
|
|
18
27
|
export { default as VvProgress } from './VvProgress/VvProgress.vue'
|
|
19
28
|
export { default as VvRadio } from './VvRadio/VvRadio.vue'
|
|
20
29
|
export { default as VvRadioGroup } from './VvRadioGroup/VvRadioGroup.vue'
|
package/src/directives/index.ts
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
import { render, type Directive, type DirectiveBinding } from 'vue'
|
|
2
2
|
import VvTooltip from '../components/VvTooltip/VvTooltip.vue'
|
|
3
|
-
import
|
|
3
|
+
import { Side } from '../constants'
|
|
4
4
|
|
|
5
|
-
const tooltip: Directive = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
5
|
+
const tooltip: Directive = (() => {
|
|
6
|
+
return {
|
|
7
|
+
beforeMount(el: HTMLElement, binding: DirectiveBinding) {
|
|
8
|
+
const tooltip = h(VvTooltip, {
|
|
9
|
+
value: binding.value,
|
|
10
|
+
position: binding.arg as Side,
|
|
11
|
+
})
|
|
12
|
+
render(tooltip, el)
|
|
13
|
+
},
|
|
14
|
+
updated(el: HTMLElement, binding: DirectiveBinding) {
|
|
15
|
+
const tooltip = h(VvTooltip, {
|
|
16
|
+
value: binding.value,
|
|
17
|
+
position: binding.arg as Side,
|
|
18
|
+
})
|
|
19
|
+
render(tooltip, el)
|
|
20
|
+
},
|
|
21
|
+
}
|
|
22
|
+
})()
|
|
14
23
|
|
|
15
24
|
export default tooltip
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import VolverPlugin from './Volver'
|
|
2
|
-
import type { Volver } from './Volver'
|
|
2
|
+
import type { Volver, VolverOptions } from './Volver'
|
|
3
3
|
|
|
4
4
|
export { VolverPlugin }
|
|
5
|
+
export * from './types'
|
|
6
|
+
export type { Volver, VolverOptions }
|
|
5
7
|
|
|
6
8
|
// https://vuejs.org/guide/typescript/options-api.html#augmenting-global-properties
|
|
7
9
|
// Add custom property and extend vue type definition
|