@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
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export default {
|
|
3
|
+
name: 'VvDropdownAction',
|
|
4
|
+
}
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import VvAction from '@/components/VvAction/VvAction.vue'
|
|
9
|
+
import VvDropdownItem from '@/components/VvDropdown/VvDropdownItem.vue'
|
|
10
|
+
import { ActionProps, ModifiersProps } from '@/props'
|
|
11
|
+
|
|
12
|
+
// props
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
...ActionProps,
|
|
15
|
+
...ModifiersProps,
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @description Define component classes with BEM style.
|
|
20
|
+
* @returns {Array} The component classes.
|
|
21
|
+
*/
|
|
22
|
+
const { modifiers } = toRefs(props)
|
|
23
|
+
const bemCssClasses = useBemModifiers('vv-dropdown-action', modifiers)
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<VvDropdownItem>
|
|
28
|
+
<VvAction
|
|
29
|
+
v-bind="{
|
|
30
|
+
disabled,
|
|
31
|
+
pressed,
|
|
32
|
+
active,
|
|
33
|
+
type,
|
|
34
|
+
to,
|
|
35
|
+
href,
|
|
36
|
+
target,
|
|
37
|
+
rel,
|
|
38
|
+
}"
|
|
39
|
+
:class="bemCssClasses"
|
|
40
|
+
>
|
|
41
|
+
<slot />
|
|
42
|
+
</VvAction>
|
|
43
|
+
</VvDropdownItem>
|
|
44
|
+
</template>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export default {
|
|
3
|
+
name: 'VvDropdownOption',
|
|
4
|
+
}
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import VvDropdownItem from '@/components/VvDropdown/VvDropdownItem.vue'
|
|
9
|
+
import {
|
|
10
|
+
DisabledProps,
|
|
11
|
+
ModifiersProps,
|
|
12
|
+
SelectedProps,
|
|
13
|
+
UnselectableProps,
|
|
14
|
+
} from '@/props'
|
|
15
|
+
|
|
16
|
+
// props
|
|
17
|
+
const props = defineProps({
|
|
18
|
+
...DisabledProps,
|
|
19
|
+
...SelectedProps,
|
|
20
|
+
...UnselectableProps,
|
|
21
|
+
...ModifiersProps,
|
|
22
|
+
deselectHintLabel: {
|
|
23
|
+
type: String,
|
|
24
|
+
},
|
|
25
|
+
selectHintLabel: {
|
|
26
|
+
type: String,
|
|
27
|
+
},
|
|
28
|
+
selectedHintLabel: {
|
|
29
|
+
type: String,
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
// style
|
|
34
|
+
const { modifiers } = toRefs(props)
|
|
35
|
+
const bemCssClasses = useBemModifiers(
|
|
36
|
+
'vv-dropdown-option',
|
|
37
|
+
modifiers,
|
|
38
|
+
computed(() => ({
|
|
39
|
+
disabled: props.disabled,
|
|
40
|
+
selected: props.selected,
|
|
41
|
+
unselectable: props.unselectable && props.selected,
|
|
42
|
+
})),
|
|
43
|
+
)
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<template>
|
|
47
|
+
<VvDropdownItem
|
|
48
|
+
:class="bemCssClasses"
|
|
49
|
+
:tabindex="disabled ? -1 : 0"
|
|
50
|
+
:aria-selected="selected"
|
|
51
|
+
:aria-disabled="disabled"
|
|
52
|
+
>
|
|
53
|
+
<slot />
|
|
54
|
+
<span class="vv-dropdown-option__hint">
|
|
55
|
+
<slot name="hint" v-bind="{ disabled, selected, unselectable }">
|
|
56
|
+
<template v-if="selected">
|
|
57
|
+
{{ unselectable ? deselectHintLabel : selectedHintLabel }}
|
|
58
|
+
</template>
|
|
59
|
+
<template v-else-if="!disabled">
|
|
60
|
+
{{ selectHintLabel }}
|
|
61
|
+
</template>
|
|
62
|
+
</slot>
|
|
63
|
+
</span>
|
|
64
|
+
</VvDropdownItem>
|
|
65
|
+
</template>
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { DropdownProps, IdProps, ModifiersProps } from '@/props'
|
|
2
2
|
import type { PropType } from 'vue'
|
|
3
|
-
|
|
4
|
-
export const DROPDOWN_ROLES = ['listbox', 'menu'] as const
|
|
5
|
-
export const DROPDOWN_ITEM_ROLES = ['option', 'presentation'] as const
|
|
6
|
-
|
|
7
|
-
export type DropdownRole = (typeof DROPDOWN_ROLES)[number]
|
|
8
|
-
export type DropdownItemRole = (typeof DROPDOWN_ITEM_ROLES)[number]
|
|
3
|
+
import { DropdownRole } from '@/constants'
|
|
9
4
|
|
|
10
5
|
export const VvDropdownProps = {
|
|
11
6
|
...IdProps,
|
|
@@ -30,8 +25,8 @@ export const VvDropdownProps = {
|
|
|
30
25
|
*/
|
|
31
26
|
role: {
|
|
32
27
|
type: String as PropType<DropdownRole>,
|
|
33
|
-
default:
|
|
34
|
-
validator: (value:
|
|
35
|
-
(
|
|
28
|
+
default: DropdownRole.menu,
|
|
29
|
+
validator: (value: DropdownRole) =>
|
|
30
|
+
Object.values(DropdownRole).includes(value),
|
|
36
31
|
},
|
|
37
32
|
}
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
UnselectableProps,
|
|
15
15
|
AutofocusProps,
|
|
16
16
|
AutocompleteProps,
|
|
17
|
+
LabelProps,
|
|
17
18
|
} from '@/props'
|
|
18
19
|
|
|
19
20
|
export const VvSelectProps = {
|
|
@@ -32,6 +33,7 @@ export const VvSelectProps = {
|
|
|
32
33
|
...IconProps,
|
|
33
34
|
...FloatingLabelProps,
|
|
34
35
|
...UnselectableProps,
|
|
36
|
+
...LabelProps,
|
|
35
37
|
/**
|
|
36
38
|
* This Boolean attribute indicates that multiple options can be selected in the list.
|
|
37
39
|
* If it is not specified, then only one option can be selected at a time.
|
|
@@ -58,10 +60,6 @@ export const VvSelectProps = {
|
|
|
58
60
|
type: [String, Number, Boolean, Object, Array],
|
|
59
61
|
default: undefined,
|
|
60
62
|
},
|
|
61
|
-
/**
|
|
62
|
-
* <label> value for the select
|
|
63
|
-
*/
|
|
64
|
-
label: String,
|
|
65
63
|
/**
|
|
66
64
|
* Select placeholder
|
|
67
65
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Ref } from 'vue'
|
|
2
2
|
import type { Emitter, EventType } from 'mitt'
|
|
3
|
-
import type { DropdownItemRole } from '@/
|
|
3
|
+
import type { DropdownItemRole } from '@/constants'
|
|
4
4
|
import {
|
|
5
5
|
INJECTION_KEY_DROPDOWN_TRIGGER,
|
|
6
6
|
INJECTION_KEY_DROPDOWN_ACTION,
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { type Ref, Fragment } from 'vue'
|
|
2
2
|
import mitt from 'mitt'
|
|
3
|
-
import {
|
|
4
|
-
type DropdownRole,
|
|
5
|
-
DROPDOWN_ROLES,
|
|
6
|
-
DROPDOWN_ITEM_ROLES,
|
|
7
|
-
} from '@/components/VvDropdown/'
|
|
8
3
|
import {
|
|
9
4
|
INJECTION_KEY_DROPDOWN_TRIGGER,
|
|
10
5
|
INJECTION_KEY_DROPDOWN_ACTION,
|
|
11
6
|
INJECTION_KEY_DROPDOWN_ITEM,
|
|
7
|
+
DropdownRole,
|
|
8
|
+
DropdownItemRole,
|
|
9
|
+
ActionRoles,
|
|
12
10
|
} from '@/constants'
|
|
13
11
|
|
|
14
12
|
/**
|
|
@@ -70,9 +68,9 @@ export function useProvideDropdownItem({
|
|
|
70
68
|
expanded: Ref<boolean>
|
|
71
69
|
}) {
|
|
72
70
|
const itemRole = computed(() =>
|
|
73
|
-
role.value ===
|
|
74
|
-
?
|
|
75
|
-
:
|
|
71
|
+
role.value === DropdownRole.listbox
|
|
72
|
+
? DropdownItemRole.option
|
|
73
|
+
: DropdownItemRole.presentation,
|
|
76
74
|
)
|
|
77
75
|
provide(INJECTION_KEY_DROPDOWN_ITEM, {
|
|
78
76
|
role: itemRole,
|
|
@@ -91,7 +89,7 @@ export function useProvideDropdownAction({
|
|
|
91
89
|
expanded: Ref<boolean>
|
|
92
90
|
}) {
|
|
93
91
|
provide(INJECTION_KEY_DROPDOWN_ACTION, {
|
|
94
|
-
role:
|
|
92
|
+
role: ActionRoles.menuitem,
|
|
95
93
|
expanded,
|
|
96
94
|
})
|
|
97
95
|
}
|
|
@@ -10,14 +10,11 @@ export function useBemModifiers(
|
|
|
10
10
|
[prefix]: true,
|
|
11
11
|
}
|
|
12
12
|
// props modifiers
|
|
13
|
-
|
|
13
|
+
const modifiersArray =
|
|
14
|
+
typeof modifiers?.value === 'string'
|
|
15
|
+
? modifiers.value.split(' ')
|
|
16
|
+
: modifiers?.value
|
|
14
17
|
if (modifiersArray) {
|
|
15
|
-
if (
|
|
16
|
-
!Array.isArray(modifiersArray) &&
|
|
17
|
-
typeof modifiersArray === 'string'
|
|
18
|
-
) {
|
|
19
|
-
modifiersArray = modifiersArray.split(' ')
|
|
20
|
-
}
|
|
21
18
|
if (Array.isArray(modifiersArray)) {
|
|
22
19
|
modifiersArray.forEach((modifier) => {
|
|
23
20
|
toReturn[`${prefix}--${modifier}`] = true
|
package/src/constants.ts
CHANGED
|
@@ -23,6 +23,42 @@ export enum Position {
|
|
|
23
23
|
after = 'after',
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
export enum ButtonType {
|
|
27
|
+
button = 'button',
|
|
28
|
+
submit = 'submit',
|
|
29
|
+
reset = 'reset',
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export enum ActionTag {
|
|
33
|
+
nuxtLink = 'nuxt-link',
|
|
34
|
+
routerLink = 'router-link',
|
|
35
|
+
a = 'a',
|
|
36
|
+
button = 'button',
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export enum ActionRoles {
|
|
40
|
+
button = 'button',
|
|
41
|
+
link = 'link',
|
|
42
|
+
menuitem = 'menuitem',
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export enum DropdownRole {
|
|
46
|
+
listbox = 'listbox',
|
|
47
|
+
menu = 'menu',
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export enum DropdownItemRole {
|
|
51
|
+
option = 'option',
|
|
52
|
+
presentation = 'presentation',
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export enum AnchorTarget {
|
|
56
|
+
_blank = '_blank',
|
|
57
|
+
_self = '_self',
|
|
58
|
+
_parent = '_parent',
|
|
59
|
+
_top = '_top',
|
|
60
|
+
}
|
|
61
|
+
|
|
26
62
|
// volver
|
|
27
63
|
export const INJECTION_KEY_VOLVER = Symbol.for('volver')
|
|
28
64
|
|
package/src/props/index.ts
CHANGED
|
@@ -7,21 +7,77 @@ import type {
|
|
|
7
7
|
ShiftOptions,
|
|
8
8
|
SizeOptions,
|
|
9
9
|
} from '@/types/floating-ui'
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
Placement,
|
|
12
|
+
Position,
|
|
13
|
+
Side,
|
|
14
|
+
AnchorTarget,
|
|
15
|
+
ButtonType,
|
|
16
|
+
} from '@/constants'
|
|
17
|
+
|
|
18
|
+
export const LinkProps = {
|
|
19
|
+
/**
|
|
20
|
+
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
21
|
+
* @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
|
|
22
|
+
*/
|
|
23
|
+
to: {
|
|
24
|
+
type: [String, Object],
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* Anchor href
|
|
28
|
+
*/
|
|
29
|
+
href: String,
|
|
30
|
+
/**
|
|
31
|
+
* Anchor target
|
|
32
|
+
*/
|
|
33
|
+
target: {
|
|
34
|
+
type: String as PropType<AnchorTarget>,
|
|
35
|
+
validator: (value: AnchorTarget) =>
|
|
36
|
+
Object.values(AnchorTarget).includes(value),
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* Anchor rel
|
|
40
|
+
*/
|
|
41
|
+
rel: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: 'noopener noreferrer',
|
|
44
|
+
},
|
|
45
|
+
}
|
|
11
46
|
|
|
12
47
|
export const ValidProps = {
|
|
48
|
+
/**
|
|
49
|
+
* Valid status
|
|
50
|
+
*/
|
|
13
51
|
valid: Boolean,
|
|
52
|
+
/**
|
|
53
|
+
* Valid label
|
|
54
|
+
*/
|
|
14
55
|
validLabel: [String, Array],
|
|
15
56
|
}
|
|
16
57
|
|
|
17
58
|
export const InvalidProps = {
|
|
59
|
+
/**
|
|
60
|
+
* Invalid status
|
|
61
|
+
*/
|
|
18
62
|
invalid: Boolean,
|
|
63
|
+
/**
|
|
64
|
+
* Invalid label
|
|
65
|
+
*/
|
|
19
66
|
invalidLabel: [String, Array],
|
|
20
67
|
}
|
|
21
68
|
|
|
22
69
|
export const LoadingProps = {
|
|
70
|
+
/**
|
|
71
|
+
* Loading status
|
|
72
|
+
*/
|
|
23
73
|
loading: Boolean,
|
|
24
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Loading label
|
|
76
|
+
*/
|
|
77
|
+
loadingLabel: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: 'Loading...',
|
|
80
|
+
},
|
|
25
81
|
}
|
|
26
82
|
|
|
27
83
|
export const DisabledProps = {
|
|
@@ -31,6 +87,34 @@ export const DisabledProps = {
|
|
|
31
87
|
disabled: Boolean,
|
|
32
88
|
}
|
|
33
89
|
|
|
90
|
+
export const SelectedProps = {
|
|
91
|
+
/**
|
|
92
|
+
* Whether the item is selected
|
|
93
|
+
*/
|
|
94
|
+
selected: Boolean,
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export const ActiveProps = {
|
|
98
|
+
/**
|
|
99
|
+
* Whether the item is active
|
|
100
|
+
*/
|
|
101
|
+
active: Boolean,
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export const PressedProps = {
|
|
105
|
+
/**
|
|
106
|
+
* Whether the item is pressed
|
|
107
|
+
*/
|
|
108
|
+
pressed: Boolean,
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export const LabelProps = {
|
|
112
|
+
/**
|
|
113
|
+
* The item label
|
|
114
|
+
*/
|
|
115
|
+
label: [String, Number],
|
|
116
|
+
}
|
|
117
|
+
|
|
34
118
|
export const ReadonlyProps = {
|
|
35
119
|
/**
|
|
36
120
|
* The value is not editable
|
|
@@ -271,6 +355,7 @@ export const InputTextareaProps = {
|
|
|
271
355
|
...DebounceProps,
|
|
272
356
|
...IconProps,
|
|
273
357
|
...FloatingLabelProps,
|
|
358
|
+
...LabelProps,
|
|
274
359
|
/**
|
|
275
360
|
* Input / Textarea minlength
|
|
276
361
|
* Minimum length (number of characters) of value
|
|
@@ -299,10 +384,6 @@ export const InputTextareaProps = {
|
|
|
299
384
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#required
|
|
300
385
|
*/
|
|
301
386
|
required: Boolean,
|
|
302
|
-
/**
|
|
303
|
-
* <label> value for the Input / Textarea
|
|
304
|
-
*/
|
|
305
|
-
label: String,
|
|
306
387
|
}
|
|
307
388
|
|
|
308
389
|
export const CheckboxRadioProps = {
|
|
@@ -314,6 +395,7 @@ export const CheckboxRadioProps = {
|
|
|
314
395
|
...DisabledProps,
|
|
315
396
|
...ReadonlyProps,
|
|
316
397
|
...ModifiersProps,
|
|
398
|
+
...LabelProps,
|
|
317
399
|
/**
|
|
318
400
|
* Input value
|
|
319
401
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#value
|
|
@@ -323,10 +405,6 @@ export const CheckboxRadioProps = {
|
|
|
323
405
|
* Input value
|
|
324
406
|
*/
|
|
325
407
|
modelValue: [Object, Number, Boolean, String],
|
|
326
|
-
/**
|
|
327
|
-
* <label> for input
|
|
328
|
-
*/
|
|
329
|
-
label: String,
|
|
330
408
|
}
|
|
331
409
|
|
|
332
410
|
export const CheckboxRadioGroupProps = {
|
|
@@ -337,14 +415,11 @@ export const CheckboxRadioGroupProps = {
|
|
|
337
415
|
...DisabledProps,
|
|
338
416
|
...ReadonlyProps,
|
|
339
417
|
...ModifiersProps,
|
|
418
|
+
...LabelProps,
|
|
340
419
|
/**
|
|
341
420
|
* Input value
|
|
342
421
|
*/
|
|
343
422
|
modelValue: [String, Array],
|
|
344
|
-
/**
|
|
345
|
-
* Input label
|
|
346
|
-
*/
|
|
347
|
-
label: String,
|
|
348
423
|
/**
|
|
349
424
|
* Input name
|
|
350
425
|
*/
|
|
@@ -354,3 +429,20 @@ export const CheckboxRadioGroupProps = {
|
|
|
354
429
|
*/
|
|
355
430
|
vertical: Boolean,
|
|
356
431
|
}
|
|
432
|
+
|
|
433
|
+
export const ActionProps = {
|
|
434
|
+
...DisabledProps,
|
|
435
|
+
...LabelProps,
|
|
436
|
+
...PressedProps,
|
|
437
|
+
...ActiveProps,
|
|
438
|
+
...LinkProps,
|
|
439
|
+
/**
|
|
440
|
+
* Button type
|
|
441
|
+
*/
|
|
442
|
+
type: {
|
|
443
|
+
type: String,
|
|
444
|
+
default: ButtonType.button,
|
|
445
|
+
validator: (value: ButtonType) =>
|
|
446
|
+
Object.values(ButtonType).includes(value),
|
|
447
|
+
},
|
|
448
|
+
}
|
|
@@ -14,19 +14,19 @@ function kebabCase(str: string, options?: { condense: boolean }) {
|
|
|
14
14
|
.toLowerCase()
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
type ImportStyle = boolean | 'css' | 'scss'
|
|
18
|
+
|
|
17
19
|
export interface VolverResolverOptions {
|
|
18
20
|
/**
|
|
19
21
|
* import style along with components
|
|
20
|
-
*
|
|
21
|
-
* @default 'css'
|
|
22
|
+
* @default undefined
|
|
22
23
|
*/
|
|
23
|
-
importStyle?:
|
|
24
|
+
importStyle?: ImportStyle
|
|
24
25
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* @default ''
|
|
26
|
+
* enable/disable directives
|
|
27
|
+
* @default undefined
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
directives?: boolean
|
|
30
30
|
/**
|
|
31
31
|
* prefix for components (e.g. 'vv' to resolve Button from VvButton)
|
|
32
32
|
*
|
|
@@ -35,18 +35,24 @@ export interface VolverResolverOptions {
|
|
|
35
35
|
prefix?: string
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
const STYLE_EXCLUDE = ['vv-icon']
|
|
38
|
+
const STYLE_EXCLUDE = ['vv-icon', 'vv-action']
|
|
39
39
|
const VOLVER_PREFIX = 'vv'
|
|
40
|
+
const DIRECTIVES = ['v-tooltip']
|
|
40
41
|
|
|
41
42
|
const getStyleNames = function (kebabName: string) {
|
|
42
43
|
if (STYLE_EXCLUDE.includes(kebabName)) {
|
|
43
44
|
return undefined
|
|
44
45
|
}
|
|
45
46
|
if (kebabName === 'vv-dropdown') {
|
|
46
|
-
return ['vv-dropdown', 'vv-dropdown-action']
|
|
47
|
+
return ['vv-dropdown', 'vv-dropdown-option', 'vv-dropdown-action']
|
|
47
48
|
}
|
|
48
49
|
if (kebabName === 'vv-combobox') {
|
|
49
|
-
return [
|
|
50
|
+
return [
|
|
51
|
+
'vv-select',
|
|
52
|
+
'vv-dropdown',
|
|
53
|
+
'vv-dropdown-option',
|
|
54
|
+
'vv-dropdown-action',
|
|
55
|
+
]
|
|
50
56
|
}
|
|
51
57
|
if (kebabName === 'vv-accordion-group') {
|
|
52
58
|
return ['vv-accordion-group', 'vv-accordion']
|
|
@@ -57,9 +63,34 @@ const getStyleNames = function (kebabName: string) {
|
|
|
57
63
|
if (kebabName === 'vv-radio-group') {
|
|
58
64
|
return ['vv-radio-group', 'vv-radio']
|
|
59
65
|
}
|
|
66
|
+
if (kebabName === 'v-tooltip') {
|
|
67
|
+
return ['vv-tooltip']
|
|
68
|
+
}
|
|
60
69
|
return [kebabName]
|
|
61
70
|
}
|
|
62
71
|
|
|
72
|
+
const getSideEffects = function (kebabName: string, importStyle?: ImportStyle) {
|
|
73
|
+
const sideEffects: SideEffectsInfo = []
|
|
74
|
+
|
|
75
|
+
if (!importStyle) {
|
|
76
|
+
return sideEffects
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// import component style
|
|
80
|
+
const styleNames = getStyleNames(kebabName)
|
|
81
|
+
if (styleNames) {
|
|
82
|
+
styleNames.forEach((name) => {
|
|
83
|
+
sideEffects.push(
|
|
84
|
+
`@volverjs/style/${
|
|
85
|
+
importStyle === 'scss' ? 'scss/' : ''
|
|
86
|
+
}components/${name}`,
|
|
87
|
+
)
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return sideEffects
|
|
92
|
+
}
|
|
93
|
+
|
|
63
94
|
/**
|
|
64
95
|
* Resolver for @volverjs/ui-vue
|
|
65
96
|
*
|
|
@@ -68,48 +99,50 @@ const getStyleNames = function (kebabName: string) {
|
|
|
68
99
|
export function VolverResolver({
|
|
69
100
|
prefix = VOLVER_PREFIX,
|
|
70
101
|
importStyle,
|
|
71
|
-
|
|
72
|
-
}: VolverResolverOptions = {}): ComponentResolver {
|
|
73
|
-
return
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
)
|
|
102
|
+
directives,
|
|
103
|
+
}: VolverResolverOptions = {}): ComponentResolver[] {
|
|
104
|
+
return [
|
|
105
|
+
{
|
|
106
|
+
type: 'component',
|
|
107
|
+
resolve: (name: string) => {
|
|
108
|
+
if (
|
|
109
|
+
!prefix ||
|
|
110
|
+
!name.toLowerCase().startsWith(prefix.toLowerCase())
|
|
111
|
+
) {
|
|
112
|
+
return
|
|
113
|
+
}
|
|
114
|
+
const kebabName = kebabCase(name).replace(
|
|
115
|
+
`${prefix}-`,
|
|
116
|
+
`${VOLVER_PREFIX}-`,
|
|
117
|
+
)
|
|
88
118
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
sideEffects
|
|
119
|
+
// import component
|
|
120
|
+
return {
|
|
121
|
+
from: `@volverjs/ui-vue/${kebabName}`,
|
|
122
|
+
sideEffects: getSideEffects(kebabName, importStyle),
|
|
93
123
|
}
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
type: 'directive',
|
|
128
|
+
resolve: (name: string) => {
|
|
129
|
+
if (!directives) {
|
|
130
|
+
return
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const kebabName = `v-${kebabCase(name)}`
|
|
94
134
|
|
|
95
|
-
//
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
styleNames.forEach((name) => {
|
|
99
|
-
sideEffects.push(
|
|
100
|
-
`@volverjs/style/${
|
|
101
|
-
importStyle === 'scss' ? 'scss/' : ''
|
|
102
|
-
}components/${name}`,
|
|
103
|
-
)
|
|
104
|
-
})
|
|
135
|
+
// filter directive
|
|
136
|
+
if (!DIRECTIVES.includes(kebabName)) {
|
|
137
|
+
return
|
|
105
138
|
}
|
|
106
|
-
}
|
|
107
139
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
140
|
+
// import directive
|
|
141
|
+
return {
|
|
142
|
+
from: `@volverjs/ui-vue/${kebabName}`,
|
|
143
|
+
sideEffects: getSideEffects(kebabName, importStyle),
|
|
144
|
+
}
|
|
145
|
+
},
|
|
113
146
|
},
|
|
114
|
-
|
|
147
|
+
]
|
|
115
148
|
}
|
|
@@ -14,7 +14,7 @@ import { defaultArgs, argTypes } from './Accordion.settings'
|
|
|
14
14
|
name="Summary"
|
|
15
15
|
play={defaultTest}
|
|
16
16
|
args={{
|
|
17
|
-
summary: `<strong data-testId="slot" class="font-bold text-brand">Custom Summary</strong>`,
|
|
17
|
+
summary: `<strong data-testId="slot" class="font-bold text-brand-darken-1">Custom Summary</strong>`,
|
|
18
18
|
}}
|
|
19
19
|
argTypes={{
|
|
20
20
|
title: {
|
|
@@ -38,7 +38,7 @@ import { defaultArgs, argTypes } from './Accordion.settings'
|
|
|
38
38
|
name="Details"
|
|
39
39
|
play={defaultTest}
|
|
40
40
|
args={{
|
|
41
|
-
details: `<strong data-testId="slot" class="font-bold text-brand">Custom Details</strong>`,
|
|
41
|
+
details: `<strong data-testId="slot" class="font-bold text-brand-darken-1">Custom Details</strong>`,
|
|
42
42
|
}}
|
|
43
43
|
argTypes={{
|
|
44
44
|
content: {
|
|
@@ -29,8 +29,9 @@ import { defaultArgs, argTypes } from './AccordionGroup.settings'
|
|
|
29
29
|
},
|
|
30
30
|
}}
|
|
31
31
|
>
|
|
32
|
-
{(args) => {
|
|
32
|
+
{(args, { argTypes }) => {
|
|
33
33
|
return {
|
|
34
|
+
props: Object.keys(argTypes),
|
|
34
35
|
components: { VvAccordionGroup, VvAccordion },
|
|
35
36
|
setup() {
|
|
36
37
|
return { args }
|
|
@@ -10,7 +10,8 @@ import { defaultArgs, argTypes } from './Breadcrumb.settings'
|
|
|
10
10
|
argTypes={argTypes}
|
|
11
11
|
/>
|
|
12
12
|
|
|
13
|
-
export const Template = (args) => ({
|
|
13
|
+
export const Template = (args, { argTypes }) => ({
|
|
14
|
+
props: Object.keys(argTypes),
|
|
14
15
|
components: { VvBreadcrumb },
|
|
15
16
|
setup() {
|
|
16
17
|
return { args }
|
|
@@ -10,15 +10,17 @@ import { argTypes, defaultArgs } from './Button.settings'
|
|
|
10
10
|
argTypes={argTypes}
|
|
11
11
|
/>
|
|
12
12
|
|
|
13
|
-
export const Template = (args) => ({
|
|
13
|
+
export const Template = (args, { argTypes }) => ({
|
|
14
|
+
props: Object.keys(argTypes),
|
|
14
15
|
data() {
|
|
15
16
|
return { value: undefined }
|
|
16
17
|
},
|
|
17
18
|
setup() {
|
|
18
19
|
return { args }
|
|
19
20
|
},
|
|
21
|
+
components: { VvButton },
|
|
20
22
|
template: /*html*/ `
|
|
21
|
-
<vv-button v-bind="args" v-model="value" name="my-button">
|
|
23
|
+
<vv-button v-bind="args" v-model="value" name="my-button" data-testId="element">
|
|
22
24
|
<template #before v-if="args.before"><div v-html="args.before"></div></template>
|
|
23
25
|
<template #default v-if="args.default"><div v-html="args.default"></div></template>
|
|
24
26
|
<template #after v-if="args.after"><div v-html="args.after"></div></template>
|