@volverjs/ui-vue 0.0.8 → 0.0.9-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 +4 -4
- package/auto-imports.d.ts +2 -0
- package/dist/components/VvAccordion/VvAccordion.es.js +7 -0
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +7 -0
- package/dist/components/VvAction/VvAction.es.js +9 -1
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +9 -0
- package/dist/components/VvAction/index.d.ts +4 -0
- package/dist/components/VvAlert/VvAlert.es.js +14 -6
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +6 -6
- package/dist/components/VvAlert/index.d.ts +3 -3
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +54 -10
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAvatar/VvAvatar.es.js +7 -0
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +7 -0
- package/dist/components/VvBadge/VvBadge.es.js +7 -0
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +7 -0
- package/dist/components/VvButton/VvButton.es.js +11 -2
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +9 -0
- package/dist/components/VvButton/index.d.ts +4 -0
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +7 -0
- package/dist/components/VvCard/VvCard.es.js +7 -0
- package/dist/components/VvCheckbox/VvCheckbox.es.js +91 -14
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +4 -4
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +97 -15
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +4 -4
- package/dist/components/VvCombobox/VvCombobox.es.js +164 -94
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +35 -14
- package/dist/components/VvCombobox/index.d.ts +24 -7
- package/dist/components/VvDialog/VvDialog.es.js +67 -27
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +58 -20
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +13 -12
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +9 -0
- package/dist/components/VvDropdown/index.d.ts +1 -7
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +9 -1
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +7 -0
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +7 -0
- package/dist/components/VvInputText/VvInputText.es.js +87 -14
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +4 -4
- package/dist/components/VvNav/VvNav.es.js +10 -2
- package/dist/components/VvNav/VvNav.umd.js +1 -1
- package/dist/components/VvNav/index.d.ts +1 -1
- package/dist/components/VvProgress/VvProgress.es.js +7 -0
- package/dist/components/VvRadio/VvRadio.es.js +91 -14
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +4 -4
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +97 -15
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +4 -4
- package/dist/components/VvSelect/VvSelect.es.js +87 -14
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +4 -4
- package/dist/components/VvTab/VvTab.es.js +10 -2
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.es.js +87 -14
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +4 -4
- package/dist/components/VvTooltip/VvTooltip.es.js +7 -0
- package/dist/components/common/HintSlot.d.ts +4 -3
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.es.js +958 -431
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/alert/useAlert.d.ts +27 -0
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/index.es.js +81 -0
- package/dist/composables/index.umd.js +1 -0
- package/dist/constants.d.ts +10 -0
- package/dist/directives/index.es.js +7 -0
- package/dist/directives/v-tooltip.es.js +7 -0
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/props/index.d.ts +7 -0
- package/dist/resolvers/unplugin.es.js +3 -0
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +43 -258
- package/dist/stories/Alert/Alert.settings.d.ts +3 -7
- package/dist/stories/AlertGroup/AlertGroupSlots.stories.d.ts +2 -2
- package/dist/stories/AlertGroup/AlertGroupWithComposable.stories.d.ts +6 -0
- package/dist/stories/Button/Button.settings.d.ts +3 -13
- package/dist/stories/Combobox/Combobox.settings.d.ts +117 -19
- package/dist/stories/Nav/Nav.settings.d.ts +3 -21
- package/package.json +54 -46
- 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 +2 -1
- package/src/components/VvAlert/VvAlert.vue +5 -1
- package/src/components/VvAlert/index.ts +3 -3
- package/src/components/VvAlertGroup/VvAlertGroup.vue +30 -0
- package/src/components/VvAlertGroup/index.ts +11 -1
- package/src/components/VvButton/VvButton.vue +1 -0
- package/src/components/VvCheckbox/VvCheckbox.vue +8 -1
- package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +8 -1
- package/src/components/VvCombobox/VvCombobox.vue +9 -4
- package/src/components/VvCombobox/index.ts +24 -0
- package/src/components/VvDialog/VvDialog.vue +36 -17
- package/src/components/VvDialog/index.ts +13 -1
- package/src/components/VvDropdown/VvDropdown.vue +44 -15
- package/src/components/VvDropdown/index.ts +2 -8
- package/src/components/VvInputText/VvInputText.vue +8 -1
- package/src/components/VvNav/VvNav.vue +1 -1
- package/src/components/VvNav/index.ts +1 -1
- package/src/components/VvRadio/VvRadio.vue +8 -1
- package/src/components/VvRadioGroup/VvRadioGroup.vue +8 -1
- package/src/components/VvSelect/VvSelect.vue +8 -1
- package/src/components/VvTextarea/VvTextarea.vue +8 -1
- package/src/components/common/HintSlot.ts +26 -13
- package/src/components/index.ts +5 -0
- package/src/composables/alert/useAlert.ts +103 -0
- package/src/composables/index.ts +1 -0
- package/src/constants.ts +21 -0
- package/src/props/index.ts +7 -0
- package/src/resolvers/unplugin.ts +3 -0
- package/src/stories/Alert/Alert.settings.ts +3 -1
- package/src/stories/AlertGroup/AlertGroup.test.ts +13 -0
- package/src/stories/AlertGroup/AlertGroupSlots.stories.ts +3 -3
- package/src/stories/AlertGroup/AlertGroupWithComposable.stories.ts +118 -0
- package/src/stories/Button/Button.settings.ts +5 -3
- package/src/stories/Combobox/Combobox.settings.ts +119 -2
- package/src/stories/Nav/Nav.settings.ts +3 -1
- package/src/stories/Tab/Tab.stories.ts +3 -3
- package/src/stories/Textarea/TextareaLength.stories.ts +1 -1
- package/src/types/alert.d.ts +20 -0
- /package/dist/components/{VvNavItemTitle → VvNav}/VvNavItemTitle.vue.d.ts +0 -0
- /package/dist/components/{VvNavSeparator → VvNav}/VvNavSeparator.d.ts +0 -0
- /package/src/components/{VvNavItemTitle → VvNav}/VvNavItemTitle.vue +0 -0
- /package/src/components/{VvNavSeparator → VvNav}/VvNavSeparator.ts +0 -0
|
@@ -66,7 +66,8 @@
|
|
|
66
66
|
const hasProps = computed(() => {
|
|
67
67
|
const toReturn = {
|
|
68
68
|
...dropdownAria?.value,
|
|
69
|
-
|
|
69
|
+
ariaPressed: pressed.value ? true : undefined,
|
|
70
|
+
ariaLabel: props.ariaLabel,
|
|
70
71
|
role: role?.value,
|
|
71
72
|
}
|
|
72
73
|
switch (hasTag.value) {
|
|
@@ -34,7 +34,11 @@
|
|
|
34
34
|
<slot name="header">
|
|
35
35
|
<!-- @slot Before title slot -->
|
|
36
36
|
<slot name="title::before" />
|
|
37
|
-
<strong
|
|
37
|
+
<strong
|
|
38
|
+
v-if="$slots.title || title"
|
|
39
|
+
:id="hasTitleId"
|
|
40
|
+
class="vv-alert__title"
|
|
41
|
+
>
|
|
38
42
|
<!-- @slot Title slot -->
|
|
39
43
|
<slot name="title">
|
|
40
44
|
{{ title }}
|
|
@@ -40,7 +40,7 @@ export const VvAlertProps = {
|
|
|
40
40
|
*/
|
|
41
41
|
title: {
|
|
42
42
|
type: String,
|
|
43
|
-
default:
|
|
43
|
+
default: undefined,
|
|
44
44
|
},
|
|
45
45
|
/**
|
|
46
46
|
* The alert content
|
|
@@ -49,7 +49,7 @@ export const VvAlertProps = {
|
|
|
49
49
|
*/
|
|
50
50
|
content: {
|
|
51
51
|
type: String,
|
|
52
|
-
default:
|
|
52
|
+
default: undefined,
|
|
53
53
|
},
|
|
54
54
|
/**
|
|
55
55
|
* The alert footer
|
|
@@ -58,7 +58,7 @@ export const VvAlertProps = {
|
|
|
58
58
|
*/
|
|
59
59
|
footer: {
|
|
60
60
|
type: String,
|
|
61
|
-
default:
|
|
61
|
+
default: undefined,
|
|
62
62
|
},
|
|
63
63
|
/**
|
|
64
64
|
* The alert role
|
|
@@ -8,9 +8,38 @@
|
|
|
8
8
|
import { useVvAlertGroup, VvAlertGroupEvents, VvAlertGroupProps } from '.'
|
|
9
9
|
import VvAlert from '../VvAlert/VvAlert.vue'
|
|
10
10
|
|
|
11
|
+
// props and emit
|
|
11
12
|
const props = defineProps(VvAlertGroupProps)
|
|
12
13
|
const emit = defineEmits(VvAlertGroupEvents)
|
|
14
|
+
|
|
13
15
|
const { hasProps, hasTransition } = useVvAlertGroup(props, emit)
|
|
16
|
+
|
|
17
|
+
const alertGroupTransitionHandlers = {
|
|
18
|
+
'before-enter': () => {
|
|
19
|
+
emit('before-enter')
|
|
20
|
+
},
|
|
21
|
+
'after-leave': () => {
|
|
22
|
+
emit('after-leave')
|
|
23
|
+
},
|
|
24
|
+
enter: () => {
|
|
25
|
+
emit('enter')
|
|
26
|
+
},
|
|
27
|
+
'after-enter': () => {
|
|
28
|
+
emit('after-enter')
|
|
29
|
+
},
|
|
30
|
+
'enter-cancelled': () => {
|
|
31
|
+
emit('enter-cancelled')
|
|
32
|
+
},
|
|
33
|
+
'before-leave': () => {
|
|
34
|
+
emit('before-leave')
|
|
35
|
+
},
|
|
36
|
+
leave: () => {
|
|
37
|
+
emit('leave')
|
|
38
|
+
},
|
|
39
|
+
'leave-cancelled': () => {
|
|
40
|
+
emit('leave-cancelled')
|
|
41
|
+
},
|
|
42
|
+
}
|
|
14
43
|
</script>
|
|
15
44
|
|
|
16
45
|
<template>
|
|
@@ -22,6 +51,7 @@
|
|
|
22
51
|
role="group"
|
|
23
52
|
:name="hasTransition"
|
|
24
53
|
class="vv-alert-group__list"
|
|
54
|
+
v-on="alertGroupTransitionHandlers"
|
|
25
55
|
>
|
|
26
56
|
<!-- @slot The slot for alert list -->
|
|
27
57
|
<slot>
|
|
@@ -50,7 +50,17 @@ export const VvAlertGroupProps = {
|
|
|
50
50
|
},
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
export const VvAlertGroupEvents = [
|
|
53
|
+
export const VvAlertGroupEvents = [
|
|
54
|
+
'close',
|
|
55
|
+
'before-enter',
|
|
56
|
+
'after-leave',
|
|
57
|
+
'enter',
|
|
58
|
+
'after-enter',
|
|
59
|
+
'enter-cancelled',
|
|
60
|
+
'before-leave',
|
|
61
|
+
'leave',
|
|
62
|
+
'leave-cancelled',
|
|
63
|
+
]
|
|
54
64
|
|
|
55
65
|
export const useVvAlertGroup = (
|
|
56
66
|
props: Readonly<ExtractPropTypes<typeof VvAlertGroupProps>>,
|
|
@@ -13,6 +13,13 @@
|
|
|
13
13
|
const emit = defineEmits(VvCheckboxEvents)
|
|
14
14
|
const slots = useSlots()
|
|
15
15
|
|
|
16
|
+
// props merged with volver defaults (now only for labels)
|
|
17
|
+
const propsDefaults = useDefaults<typeof VvCheckboxProps>(
|
|
18
|
+
'VvCheckbox',
|
|
19
|
+
VvCheckboxProps,
|
|
20
|
+
props,
|
|
21
|
+
)
|
|
22
|
+
|
|
16
23
|
// data
|
|
17
24
|
const {
|
|
18
25
|
id,
|
|
@@ -150,7 +157,7 @@
|
|
|
150
157
|
hasHintLabelOrSlot,
|
|
151
158
|
hasInvalidLabelOrSlot,
|
|
152
159
|
hintSlotScope,
|
|
153
|
-
} = HintSlotFactory(
|
|
160
|
+
} = HintSlotFactory(propsDefaults, slots)
|
|
154
161
|
</script>
|
|
155
162
|
|
|
156
163
|
<template>
|
|
@@ -17,6 +17,13 @@
|
|
|
17
17
|
const emit = defineEmits(VvCheckboxGroupEvents)
|
|
18
18
|
const slots = useSlots()
|
|
19
19
|
|
|
20
|
+
// props merged with volver defaults (now only for labels)
|
|
21
|
+
const propsDefaults = useDefaults<typeof VvCheckboxGroupProps>(
|
|
22
|
+
'VvCheckboxGroup',
|
|
23
|
+
VvCheckboxGroupProps,
|
|
24
|
+
props,
|
|
25
|
+
)
|
|
26
|
+
|
|
20
27
|
// data
|
|
21
28
|
const modelValue = useVModel(props, 'modelValue', emit)
|
|
22
29
|
const { disabled, readonly, vertical, valid, invalid, modifiers } =
|
|
@@ -56,7 +63,7 @@
|
|
|
56
63
|
value: getOptionValue(option),
|
|
57
64
|
}
|
|
58
65
|
}
|
|
59
|
-
const { HintSlot, hintSlotScope } = HintSlotFactory(
|
|
66
|
+
const { HintSlot, hintSlotScope } = HintSlotFactory(propsDefaults, slots)
|
|
60
67
|
</script>
|
|
61
68
|
|
|
62
69
|
<template>
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
hasHintLabelOrSlot,
|
|
51
51
|
hasInvalidLabelOrSlot,
|
|
52
52
|
hintSlotScope,
|
|
53
|
-
} = HintSlotFactory(
|
|
53
|
+
} = HintSlotFactory(propsDefaults, slots)
|
|
54
54
|
|
|
55
55
|
// template ref
|
|
56
56
|
const inputEl: Ref<HTMLElement | null> = ref(null)
|
|
@@ -184,6 +184,12 @@
|
|
|
184
184
|
|
|
185
185
|
// options filtered by search text
|
|
186
186
|
const filteredOptions = computed(() => {
|
|
187
|
+
if (propsDefaults.value.searchFunction) {
|
|
188
|
+
return propsDefaults.value.searchFunction(
|
|
189
|
+
debouncedSearchText.value,
|
|
190
|
+
props.options,
|
|
191
|
+
)
|
|
192
|
+
}
|
|
187
193
|
return props.options?.filter((option) => {
|
|
188
194
|
return getOptionLabel(option)
|
|
189
195
|
.toLowerCase()
|
|
@@ -334,7 +340,7 @@
|
|
|
334
340
|
autoPlacement: propsDefaults.value.autoPlacement,
|
|
335
341
|
arrow: propsDefaults.value.arrow,
|
|
336
342
|
autofocusFirst: searchable.value
|
|
337
|
-
?
|
|
343
|
+
? true
|
|
338
344
|
: propsDefaults.value.autofocusFirst,
|
|
339
345
|
triggerWidth: propsDefaults.value.triggerWidth,
|
|
340
346
|
modifiers: propsDefaults.value.dropdownModifiers,
|
|
@@ -390,7 +396,6 @@
|
|
|
390
396
|
<slot name="dropdown::before" />
|
|
391
397
|
<input
|
|
392
398
|
v-if="searchable"
|
|
393
|
-
v-show="expanded"
|
|
394
399
|
:id="hasSearchId"
|
|
395
400
|
ref="inputSearchEl"
|
|
396
401
|
v-model="searchText"
|
|
@@ -579,7 +584,7 @@
|
|
|
579
584
|
<!-- Close button if dropdown custom position is enabled and floating-ui disabled -->
|
|
580
585
|
<VvButton
|
|
581
586
|
v-if="dropdownEl?.customPosition"
|
|
582
|
-
label="
|
|
587
|
+
:label="propsDefaults.closeLabel"
|
|
583
588
|
modifiers="secondary"
|
|
584
589
|
@click="dropdownEl.hide()"
|
|
585
590
|
/>
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
DropdownProps,
|
|
17
17
|
LabelProps,
|
|
18
18
|
} from '../../props'
|
|
19
|
+
import type { Option } from '../../types/generic'
|
|
19
20
|
|
|
20
21
|
export const VvComboboxEvents = [
|
|
21
22
|
'update:modelValue',
|
|
@@ -40,6 +41,13 @@ export const VvComboboxProps = {
|
|
|
40
41
|
...UnselectableProps,
|
|
41
42
|
...DropdownProps,
|
|
42
43
|
...LabelProps,
|
|
44
|
+
/**
|
|
45
|
+
* Dropdown show / hide transition name
|
|
46
|
+
*/
|
|
47
|
+
transitionName: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: 'vv-dropdown--mobile-fade-block',
|
|
50
|
+
},
|
|
43
51
|
/**
|
|
44
52
|
* modelValue can be a string, number, boolean, object or array of string, number, boolean, object
|
|
45
53
|
*/
|
|
@@ -71,6 +79,10 @@ export const VvComboboxProps = {
|
|
|
71
79
|
* Label for deselected option hint
|
|
72
80
|
*/
|
|
73
81
|
deselectHintLabel: { type: String, default: 'Press enter to remove' },
|
|
82
|
+
/**
|
|
83
|
+
* Label close button
|
|
84
|
+
*/
|
|
85
|
+
closeLabel: { type: String, default: 'Close' },
|
|
74
86
|
/**
|
|
75
87
|
* Select input placeholder
|
|
76
88
|
*/
|
|
@@ -79,6 +91,18 @@ export const VvComboboxProps = {
|
|
|
79
91
|
* Use input text to search on options
|
|
80
92
|
*/
|
|
81
93
|
searchable: Boolean,
|
|
94
|
+
/**
|
|
95
|
+
* Search function to filter options
|
|
96
|
+
*/
|
|
97
|
+
searchFunction: {
|
|
98
|
+
type: Function as PropType<
|
|
99
|
+
(
|
|
100
|
+
search: string,
|
|
101
|
+
options?: (Option | string)[],
|
|
102
|
+
) => (Option | string)[]
|
|
103
|
+
>,
|
|
104
|
+
default: undefined,
|
|
105
|
+
},
|
|
82
106
|
/**
|
|
83
107
|
* On searchable select is the input search placeholder
|
|
84
108
|
*/
|
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
const dialogEl: Ref<HTMLDialogElement | undefined> = ref()
|
|
16
16
|
|
|
17
17
|
// data
|
|
18
|
+
const modelValue = useVModel(props, 'modelValue', emit)
|
|
18
19
|
const localModelValue = ref(false)
|
|
19
|
-
const
|
|
20
|
-
get()
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
localModelValue.value = value
|
|
20
|
+
const isOpened = computed({
|
|
21
|
+
get: () => modelValue.value ?? localModelValue.value,
|
|
22
|
+
set: (newValue) => {
|
|
23
|
+
if (modelValue.value === undefined) {
|
|
24
|
+
localModelValue.value = newValue
|
|
25
|
+
return
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
modelValue.value = newValue
|
|
28
28
|
},
|
|
29
29
|
})
|
|
30
30
|
|
|
@@ -51,46 +51,65 @@
|
|
|
51
51
|
'before-enter': () => {
|
|
52
52
|
dialogEl.value?.showModal()
|
|
53
53
|
emit('open')
|
|
54
|
+
emit('before-enter')
|
|
54
55
|
},
|
|
55
56
|
'after-leave': () => {
|
|
56
57
|
dialogEl.value?.close()
|
|
57
58
|
emit('close')
|
|
59
|
+
emit('after-leave')
|
|
60
|
+
},
|
|
61
|
+
enter: () => {
|
|
62
|
+
emit('enter')
|
|
63
|
+
},
|
|
64
|
+
'after-enter': () => {
|
|
65
|
+
emit('after-enter')
|
|
66
|
+
},
|
|
67
|
+
'enter-cancelled': () => {
|
|
68
|
+
emit('enter-cancelled')
|
|
69
|
+
},
|
|
70
|
+
'before-leave': () => {
|
|
71
|
+
emit('before-leave')
|
|
72
|
+
},
|
|
73
|
+
leave: () => {
|
|
74
|
+
emit('leave')
|
|
75
|
+
},
|
|
76
|
+
'leave-cancelled': () => {
|
|
77
|
+
emit('leave-cancelled')
|
|
58
78
|
},
|
|
59
79
|
}
|
|
60
80
|
|
|
61
81
|
// methods
|
|
62
82
|
onClickOutside(modalWrapper, () => {
|
|
63
83
|
if (!props.keepOpen) {
|
|
64
|
-
|
|
84
|
+
close()
|
|
65
85
|
}
|
|
66
86
|
})
|
|
67
87
|
|
|
68
88
|
function close() {
|
|
69
|
-
|
|
89
|
+
isOpened.value = false
|
|
70
90
|
}
|
|
71
91
|
|
|
72
92
|
function open() {
|
|
73
|
-
|
|
93
|
+
isOpened.value = true
|
|
74
94
|
}
|
|
75
95
|
|
|
76
96
|
defineExpose({ close, open })
|
|
77
97
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (modelValue.value) {
|
|
81
|
-
e.preventDefault()
|
|
98
|
+
const onCancel = () => {
|
|
99
|
+
if (!props.keepOpen) {
|
|
82
100
|
close()
|
|
83
101
|
}
|
|
84
|
-
}
|
|
102
|
+
}
|
|
85
103
|
</script>
|
|
86
104
|
|
|
87
105
|
<template>
|
|
88
106
|
<Transition :name="transitioName" v-on="dialogTransitionHandlers">
|
|
89
107
|
<dialog
|
|
90
|
-
v-show="
|
|
108
|
+
v-show="isOpened"
|
|
91
109
|
v-bind="dialogAttrs"
|
|
92
110
|
ref="dialogEl"
|
|
93
111
|
:class="dialogClass"
|
|
112
|
+
@cancel.stop.prevent="onCancel"
|
|
94
113
|
>
|
|
95
114
|
<article ref="modalWrapper" class="vv-dialog__wrapper">
|
|
96
115
|
<header v-if="$slots.header || title" class="vv-dialog__header">
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { IdProps } from '../../props'
|
|
2
2
|
|
|
3
|
-
export const VvDialogEvents = [
|
|
3
|
+
export const VvDialogEvents = [
|
|
4
|
+
'open',
|
|
5
|
+
'close',
|
|
6
|
+
'update:modelValue',
|
|
7
|
+
'before-enter',
|
|
8
|
+
'after-leave',
|
|
9
|
+
'enter',
|
|
10
|
+
'after-enter',
|
|
11
|
+
'enter-cancelled',
|
|
12
|
+
'before-leave',
|
|
13
|
+
'leave',
|
|
14
|
+
'leave-cancelled',
|
|
15
|
+
]
|
|
4
16
|
|
|
5
17
|
export const VvDialogProps = {
|
|
6
18
|
...IdProps,
|
|
@@ -34,6 +34,14 @@
|
|
|
34
34
|
'beforeCollapse',
|
|
35
35
|
'afterExpand',
|
|
36
36
|
'afterCollapse',
|
|
37
|
+
'before-enter',
|
|
38
|
+
'after-leave',
|
|
39
|
+
'enter',
|
|
40
|
+
'after-enter',
|
|
41
|
+
'enter-cancelled',
|
|
42
|
+
'before-leave',
|
|
43
|
+
'leave',
|
|
44
|
+
'leave-cancelled',
|
|
37
45
|
])
|
|
38
46
|
const { id } = toRefs(props)
|
|
39
47
|
const hasId = useUniqueId(id)
|
|
@@ -153,7 +161,11 @@
|
|
|
153
161
|
referenceEl,
|
|
154
162
|
floatingEl,
|
|
155
163
|
{
|
|
156
|
-
whileElementsMounted:
|
|
164
|
+
whileElementsMounted: (...args) => {
|
|
165
|
+
return autoUpdate(...args, {
|
|
166
|
+
animationFrame: props.strategy === 'fixed',
|
|
167
|
+
})
|
|
168
|
+
},
|
|
157
169
|
placement: computed(() => props.placement),
|
|
158
170
|
strategy: computed(() => props.strategy),
|
|
159
171
|
middleware,
|
|
@@ -258,7 +270,7 @@
|
|
|
258
270
|
onClickOutside(
|
|
259
271
|
floatingEl,
|
|
260
272
|
() => {
|
|
261
|
-
if (!props.keepOpen) {
|
|
273
|
+
if (!props.keepOpen && expanded.value) {
|
|
262
274
|
expanded.value = false
|
|
263
275
|
}
|
|
264
276
|
},
|
|
@@ -306,7 +318,7 @@
|
|
|
306
318
|
}
|
|
307
319
|
return [
|
|
308
320
|
...element.querySelectorAll(
|
|
309
|
-
'a[href], button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])',
|
|
321
|
+
'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])',
|
|
310
322
|
),
|
|
311
323
|
].filter(
|
|
312
324
|
(el) =>
|
|
@@ -388,11 +400,34 @@
|
|
|
388
400
|
htmlEl?.click()
|
|
389
401
|
}
|
|
390
402
|
})
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
403
|
+
|
|
404
|
+
const dropdownTransitionHandlers = {
|
|
405
|
+
'before-enter': () => {
|
|
406
|
+
emit(expanded.value ? 'beforeExpand' : 'beforeCollapse')
|
|
407
|
+
emit('before-enter')
|
|
408
|
+
},
|
|
409
|
+
'after-leave': () => {
|
|
410
|
+
emit(expanded.value ? 'afterExpand' : 'afterCollapse')
|
|
411
|
+
emit('after-leave')
|
|
412
|
+
},
|
|
413
|
+
enter: () => {
|
|
414
|
+
emit('enter')
|
|
415
|
+
},
|
|
416
|
+
'after-enter': () => {
|
|
417
|
+
emit('after-enter')
|
|
418
|
+
},
|
|
419
|
+
'enter-cancelled': () => {
|
|
420
|
+
emit('enter-cancelled')
|
|
421
|
+
},
|
|
422
|
+
'before-leave': () => {
|
|
423
|
+
emit('before-leave')
|
|
424
|
+
},
|
|
425
|
+
leave: () => {
|
|
426
|
+
emit('leave')
|
|
427
|
+
},
|
|
428
|
+
'leave-cancelled': () => {
|
|
429
|
+
emit('leave-cancelled')
|
|
430
|
+
},
|
|
396
431
|
}
|
|
397
432
|
</script>
|
|
398
433
|
|
|
@@ -402,13 +437,7 @@
|
|
|
402
437
|
v-bind="{ init, show, hide, toggle, expanded, aria: referenceAria }"
|
|
403
438
|
/>
|
|
404
439
|
</VvDropdownTriggerProvider>
|
|
405
|
-
<Transition
|
|
406
|
-
:name="transitionName"
|
|
407
|
-
v-on="{
|
|
408
|
-
beforeEnter: onTransitionBeforeEnter,
|
|
409
|
-
onAfterLeave: onTransitionAfterLeave,
|
|
410
|
-
}"
|
|
411
|
-
>
|
|
440
|
+
<Transition :name="transitionName" v-on="dropdownTransitionHandlers">
|
|
412
441
|
<div
|
|
413
442
|
v-show="expanded"
|
|
414
443
|
ref="floatingEl"
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import type { PropType } from 'vue'
|
|
2
|
-
import { DropdownProps, IdProps } from '../../props'
|
|
2
|
+
import { DropdownProps, IdProps, ModifiersProps } from '../../props'
|
|
3
3
|
import { DropdownRole } from '../../constants'
|
|
4
4
|
|
|
5
5
|
export const VvDropdownProps = {
|
|
6
6
|
...IdProps,
|
|
7
7
|
...DropdownProps,
|
|
8
|
-
|
|
9
|
-
* Component BEM modifiers
|
|
10
|
-
*/
|
|
11
|
-
modifiers: {
|
|
12
|
-
type: [String, Array] as PropType<string | string[]>,
|
|
13
|
-
default: 'mobile',
|
|
14
|
-
},
|
|
8
|
+
...ModifiersProps,
|
|
15
9
|
/**
|
|
16
10
|
* Show / hide dropdown programmatically
|
|
17
11
|
*/
|
|
@@ -22,6 +22,13 @@
|
|
|
22
22
|
const emit = defineEmits(VvInputTextEvents)
|
|
23
23
|
const slots = useSlots()
|
|
24
24
|
|
|
25
|
+
// props merged with volver defaults (now only for labels)
|
|
26
|
+
const propsDefaults = useDefaults<typeof VvInputTextProps>(
|
|
27
|
+
'VvInputText',
|
|
28
|
+
VvInputTextProps,
|
|
29
|
+
props,
|
|
30
|
+
)
|
|
31
|
+
|
|
25
32
|
// template refs
|
|
26
33
|
const inputEl = ref()
|
|
27
34
|
const innerEl = ref()
|
|
@@ -278,7 +285,7 @@
|
|
|
278
285
|
hasHintLabelOrSlot,
|
|
279
286
|
hasInvalidLabelOrSlot,
|
|
280
287
|
hintSlotScope,
|
|
281
|
-
} = HintSlotFactory(
|
|
288
|
+
} = HintSlotFactory(propsDefaults, slots)
|
|
282
289
|
const PasswordInputActions = VvInputTextActionsFactory(
|
|
283
290
|
INPUT_TYPES.PASSWORD,
|
|
284
291
|
props,
|
|
@@ -13,6 +13,13 @@
|
|
|
13
13
|
const emit = defineEmits(VvRadioEvents)
|
|
14
14
|
const slots = useSlots()
|
|
15
15
|
|
|
16
|
+
// props merged with volver defaults (now only for labels)
|
|
17
|
+
const propsDefaults = useDefaults<typeof VvRadioProps>(
|
|
18
|
+
'VvRadio',
|
|
19
|
+
VvRadioProps,
|
|
20
|
+
props,
|
|
21
|
+
)
|
|
22
|
+
|
|
16
23
|
// data
|
|
17
24
|
const { id, disabled, readonly, modelValue, valid, invalid } =
|
|
18
25
|
useGroupProps(props, emit)
|
|
@@ -77,7 +84,7 @@
|
|
|
77
84
|
hasHintLabelOrSlot,
|
|
78
85
|
hasInvalidLabelOrSlot,
|
|
79
86
|
hintSlotScope,
|
|
80
|
-
} = HintSlotFactory(
|
|
87
|
+
} = HintSlotFactory(propsDefaults, slots)
|
|
81
88
|
</script>
|
|
82
89
|
|
|
83
90
|
<template>
|
|
@@ -17,6 +17,13 @@
|
|
|
17
17
|
const emit = defineEmits(VvRadioGroupEvents)
|
|
18
18
|
const slots = useSlots()
|
|
19
19
|
|
|
20
|
+
// props merged with volver defaults (now only for labels)
|
|
21
|
+
const propsDefaults = useDefaults<typeof VvRadioGroupProps>(
|
|
22
|
+
'VvRadioGroup',
|
|
23
|
+
VvRadioGroupProps,
|
|
24
|
+
props,
|
|
25
|
+
)
|
|
26
|
+
|
|
20
27
|
// data
|
|
21
28
|
const modelValue = useVModel(props, 'modelValue', emit)
|
|
22
29
|
const { disabled, readonly, vertical, valid, invalid, modifiers } =
|
|
@@ -58,7 +65,7 @@
|
|
|
58
65
|
}
|
|
59
66
|
|
|
60
67
|
// hint
|
|
61
|
-
const { HintSlot, hintSlotScope } = HintSlotFactory(
|
|
68
|
+
const { HintSlot, hintSlotScope } = HintSlotFactory(propsDefaults, slots)
|
|
62
69
|
</script>
|
|
63
70
|
|
|
64
71
|
<template>
|
|
@@ -16,6 +16,13 @@
|
|
|
16
16
|
const emit = defineEmits(VvSelectEmits)
|
|
17
17
|
const slots = useSlots()
|
|
18
18
|
|
|
19
|
+
// props merged with volver defaults (now only for labels)
|
|
20
|
+
const propsDefaults = useDefaults<typeof VvSelectProps>(
|
|
21
|
+
'VvSelect',
|
|
22
|
+
VvSelectProps,
|
|
23
|
+
props,
|
|
24
|
+
)
|
|
25
|
+
|
|
19
26
|
// template refs
|
|
20
27
|
const select = ref()
|
|
21
28
|
|
|
@@ -25,7 +32,7 @@
|
|
|
25
32
|
hasHintLabelOrSlot,
|
|
26
33
|
hasInvalidLabelOrSlot,
|
|
27
34
|
hintSlotScope,
|
|
28
|
-
} = HintSlotFactory(
|
|
35
|
+
} = HintSlotFactory(propsDefaults, slots)
|
|
29
36
|
|
|
30
37
|
// data
|
|
31
38
|
const {
|
|
@@ -15,6 +15,13 @@
|
|
|
15
15
|
const emit = defineEmits(VvTextareaEvents)
|
|
16
16
|
const slots = useSlots()
|
|
17
17
|
|
|
18
|
+
// props merged with volver defaults (now only for labels)
|
|
19
|
+
const propsDefaults = useDefaults<typeof VvTextareaProps>(
|
|
20
|
+
'VvTextarea',
|
|
21
|
+
VvTextareaProps,
|
|
22
|
+
props,
|
|
23
|
+
)
|
|
24
|
+
|
|
18
25
|
// template refs
|
|
19
26
|
const textarea = ref()
|
|
20
27
|
|
|
@@ -91,7 +98,7 @@
|
|
|
91
98
|
hasHintLabelOrSlot,
|
|
92
99
|
hasInvalidLabelOrSlot,
|
|
93
100
|
hintSlotScope,
|
|
94
|
-
} = HintSlotFactory(
|
|
101
|
+
} = HintSlotFactory(propsDefaults, slots)
|
|
95
102
|
|
|
96
103
|
// styles
|
|
97
104
|
const bemCssClasses = useModifiers(
|