@volverjs/ui-vue 0.0.10-beta.24 → 0.0.10-beta.26
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/auto-imports.d.ts +1 -0
- package/dist/components/VvAccordion/VvAccordion.es.js +14 -12
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +169 -89
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +31 -5
- package/dist/components/VvAccordionGroup/index.d.ts +7 -4
- package/dist/components/VvAction/VvAction.es.js +14 -12
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +2 -11
- package/dist/components/VvAction/index.d.ts +1 -5
- package/dist/components/VvAlert/VvAlert.es.js +14 -12
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +14 -12
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAvatar/VvAvatar.es.js +14 -12
- package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +14 -12
- package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.es.js +14 -12
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +14 -12
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +1 -1
- package/dist/components/VvButton/VvButton.es.js +14 -12
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +2 -19
- package/dist/components/VvButton/index.d.ts +1 -5
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +14 -12
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvCard/VvCard.es.js +14 -12
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +14 -12
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +14 -12
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.es.js +58 -34
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +2 -8
- package/dist/components/VvCombobox/index.d.ts +9 -2
- package/dist/components/VvDialog/VvDialog.es.js +14 -12
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +24 -16
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +2 -19
- package/dist/components/VvDropdown/VvDropdownItem.vue.d.ts +13 -1
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +9 -0
- package/dist/components/VvDropdown/index.d.ts +37 -0
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +64 -15
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +322 -1
- package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +14 -12
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +131 -76
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
- package/dist/components/VvInputFile/VvInputFile.es.js +14 -12
- package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
- package/dist/components/VvInputFile/index.d.ts +5 -5
- package/dist/components/VvInputText/VvInputText.es.js +979 -107
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +44 -1
- package/dist/components/VvInputText/index.d.ts +28 -0
- package/dist/components/VvNav/VvNav.es.js +14 -12
- package/dist/components/VvNav/VvNav.umd.js +1 -1
- package/dist/components/VvNav/VvNav.vue.d.ts +1 -1
- package/dist/components/VvNavItem/VvNavItem.es.js +14 -12
- package/dist/components/VvNavItem/VvNavItem.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.es.js +14 -12
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +14 -12
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +14 -12
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.es.js +14 -12
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvTab/VvTab.es.js +14 -12
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/VvTab/VvTab.vue.d.ts +1 -1
- package/dist/components/VvTextarea/VvTextarea.es.js +14 -12
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.es.js +14 -12
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/index.es.js +435 -195
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/dropdown/useInjectDropdown.d.ts +3 -23
- package/dist/composables/dropdown/useProvideDropdown.d.ts +2 -3
- package/dist/composables/usePersistence.d.ts +3 -0
- package/dist/constants.d.ts +24 -21
- package/dist/directives/index.es.js +14 -12
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-tooltip.es.js +14 -12
- 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/props/index.d.ts +11 -11
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +51 -9
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +327 -64
- package/dist/stories/Button/Button.settings.d.ts +0 -1
- package/dist/types/nav.d.ts +1 -2
- package/package.json +1 -1
- 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/VvAccordionGroup/VvAccordionGroup.vue +86 -69
- package/src/components/VvAccordionGroup/index.ts +3 -5
- package/src/components/VvCombobox/VvCombobox.vue +2 -0
- package/src/components/VvDropdown/VvDropdown.vue +11 -2
- package/src/components/VvDropdown/VvDropdownItem.vue +4 -1
- package/src/components/VvDropdown/VvDropdownOption.vue +3 -21
- package/src/components/VvDropdown/index.ts +35 -1
- package/src/components/VvInputText/VvInputText.vue +98 -3
- package/src/components/VvInputText/index.ts +24 -1
- package/src/composables/dropdown/useProvideDropdown.ts +4 -4
- package/src/composables/usePersistence.ts +76 -0
- package/src/constants.ts +23 -18
- package/src/props/index.ts +12 -7
- package/src/stories/AccordionGroup/AccordionGroup.settings.ts +2 -2
- package/src/stories/AccordionGroup/AccordionGroup.test.ts +5 -5
- package/src/stories/Button/Button.settings.ts +1 -4
- package/src/types/nav.ts +1 -3
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { StorageType } from '@/constants'
|
|
2
|
+
|
|
3
|
+
export const usePersistence = <T>(
|
|
4
|
+
storageKey: Ref<string | undefined> | undefined,
|
|
5
|
+
storageType: Ref<`${StorageType}`> | `${StorageType}` = StorageType.local,
|
|
6
|
+
defaultValue?: T,
|
|
7
|
+
) => {
|
|
8
|
+
const localValue: Ref<T | undefined> = ref()
|
|
9
|
+
if (defaultValue) {
|
|
10
|
+
localValue.value = defaultValue
|
|
11
|
+
}
|
|
12
|
+
let storageValue: Ref<T | undefined> | undefined
|
|
13
|
+
if (storageKey) {
|
|
14
|
+
watch(
|
|
15
|
+
storageKey,
|
|
16
|
+
(newKey, oldKey) => {
|
|
17
|
+
const storage =
|
|
18
|
+
unref(storageType) === StorageType.session
|
|
19
|
+
? sessionStorage
|
|
20
|
+
: localStorage
|
|
21
|
+
if (oldKey && oldKey !== newKey) {
|
|
22
|
+
storage.removeItem(oldKey)
|
|
23
|
+
}
|
|
24
|
+
if (newKey) {
|
|
25
|
+
storageValue = useStorage(
|
|
26
|
+
newKey,
|
|
27
|
+
storageValue?.value ?? localValue.value,
|
|
28
|
+
storage,
|
|
29
|
+
)
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
storageValue = undefined
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
immediate: true,
|
|
36
|
+
},
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
if (isRef(storageType)) {
|
|
40
|
+
watch(storageType, (newType, oldType) => {
|
|
41
|
+
if (storageKey?.value) {
|
|
42
|
+
if (newType) {
|
|
43
|
+
const storage =
|
|
44
|
+
newType === StorageType.session
|
|
45
|
+
? sessionStorage
|
|
46
|
+
: localStorage
|
|
47
|
+
storageValue = useStorage(
|
|
48
|
+
storageKey.value,
|
|
49
|
+
storageValue?.value ?? localValue.value,
|
|
50
|
+
storage,
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
if (oldType && oldType !== newType) {
|
|
54
|
+
const oldStorage =
|
|
55
|
+
oldType === StorageType.session
|
|
56
|
+
? sessionStorage
|
|
57
|
+
: localStorage
|
|
58
|
+
oldStorage.removeItem(storageKey.value)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return computed<T | undefined>({
|
|
65
|
+
get: () => {
|
|
66
|
+
return storageValue?.value ?? localValue.value
|
|
67
|
+
},
|
|
68
|
+
set: (value) => {
|
|
69
|
+
if (storageValue) {
|
|
70
|
+
storageValue.value = value
|
|
71
|
+
return
|
|
72
|
+
}
|
|
73
|
+
localValue.value = value
|
|
74
|
+
},
|
|
75
|
+
})
|
|
76
|
+
}
|
package/src/constants.ts
CHANGED
|
@@ -11,6 +11,11 @@ import type {
|
|
|
11
11
|
|
|
12
12
|
export const DEFAULT_ICONIFY_PROVIDER = 'vv'
|
|
13
13
|
|
|
14
|
+
export enum StorageType {
|
|
15
|
+
local = 'local',
|
|
16
|
+
session = 'session',
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
export enum Strategy {
|
|
15
20
|
absolute = 'absolute',
|
|
16
21
|
fixed = 'fixed',
|
|
@@ -68,13 +73,6 @@ export enum DropdownItemRole {
|
|
|
68
73
|
presentation = 'presentation',
|
|
69
74
|
}
|
|
70
75
|
|
|
71
|
-
export enum AnchorTarget {
|
|
72
|
-
_blank = '_blank',
|
|
73
|
-
_self = '_self',
|
|
74
|
-
_parent = '_parent',
|
|
75
|
-
_top = '_top',
|
|
76
|
-
}
|
|
77
|
-
|
|
78
76
|
// volver
|
|
79
77
|
export const INJECTION_KEY_VOLVER = Symbol.for('volver') as InjectionKey<Volver>
|
|
80
78
|
|
|
@@ -93,9 +91,7 @@ export const INJECTION_KEY_ACCORDION_GROUP = Symbol.for(
|
|
|
93
91
|
) as InjectionKey<AccordionGroupState>
|
|
94
92
|
|
|
95
93
|
// dropdown
|
|
96
|
-
export
|
|
97
|
-
'dropdownTrigger',
|
|
98
|
-
) as InjectionKey<{
|
|
94
|
+
export type DropdownTriggerState = {
|
|
99
95
|
id?: Ref<string | number>
|
|
100
96
|
reference?: Ref<HTMLElement | null>
|
|
101
97
|
bus?: Emitter<{
|
|
@@ -109,19 +105,28 @@ export const INJECTION_KEY_DROPDOWN_TRIGGER = Symbol.for(
|
|
|
109
105
|
'aria-haspopup': boolean
|
|
110
106
|
'aria-expanded': boolean
|
|
111
107
|
}>
|
|
112
|
-
}
|
|
108
|
+
}
|
|
109
|
+
export const INJECTION_KEY_DROPDOWN_TRIGGER = Symbol.for(
|
|
110
|
+
'dropdownTrigger',
|
|
111
|
+
) as InjectionKey<DropdownTriggerState>
|
|
112
|
+
|
|
113
|
+
export type DropdownItemState = {
|
|
114
|
+
role?: Ref<`${DropdownItemRole}`>
|
|
115
|
+
expanded?: Ref<boolean>
|
|
116
|
+
focused?: Ref<boolean>
|
|
117
|
+
hovered?: Ref<boolean>
|
|
118
|
+
}
|
|
113
119
|
export const INJECTION_KEY_DROPDOWN_ITEM = Symbol.for(
|
|
114
120
|
'dropdownItem',
|
|
115
|
-
) as InjectionKey<
|
|
116
|
-
|
|
121
|
+
) as InjectionKey<DropdownItemState>
|
|
122
|
+
|
|
123
|
+
export type DropdownActionState = {
|
|
124
|
+
role?: Ref<`${ActionRoles}`>
|
|
117
125
|
expanded?: Ref<boolean>
|
|
118
|
-
}
|
|
126
|
+
}
|
|
119
127
|
export const INJECTION_KEY_DROPDOWN_ACTION = Symbol.for(
|
|
120
128
|
'dropdownAction',
|
|
121
|
-
) as InjectionKey<
|
|
122
|
-
role?: Ref<`${ActionRoles}`>
|
|
123
|
-
expanded?: Ref<boolean>
|
|
124
|
-
}>
|
|
129
|
+
) as InjectionKey<DropdownActionState>
|
|
125
130
|
|
|
126
131
|
// alert
|
|
127
132
|
export const INJECTION_KEY_ALERT_GROUP = Symbol.for(
|
package/src/props/index.ts
CHANGED
|
@@ -13,9 +13,9 @@ import {
|
|
|
13
13
|
Strategy,
|
|
14
14
|
Position,
|
|
15
15
|
Side,
|
|
16
|
-
AnchorTarget,
|
|
17
16
|
ButtonType,
|
|
18
17
|
ActionTag,
|
|
18
|
+
StorageType,
|
|
19
19
|
} from '@/constants'
|
|
20
20
|
import type { VvIconProps } from '@/components/VvIcon'
|
|
21
21
|
|
|
@@ -34,12 +34,7 @@ export const LinkProps = {
|
|
|
34
34
|
/**
|
|
35
35
|
* Anchor target
|
|
36
36
|
*/
|
|
37
|
-
target:
|
|
38
|
-
type: String as PropType<`${AnchorTarget}`>,
|
|
39
|
-
default: undefined,
|
|
40
|
-
validator: (value: AnchorTarget) =>
|
|
41
|
-
Object.values(AnchorTarget).includes(value),
|
|
42
|
-
},
|
|
37
|
+
target: String,
|
|
43
38
|
/**
|
|
44
39
|
* Anchor rel
|
|
45
40
|
*/
|
|
@@ -549,3 +544,13 @@ export const NavProps = {
|
|
|
549
544
|
default: () => [],
|
|
550
545
|
},
|
|
551
546
|
}
|
|
547
|
+
|
|
548
|
+
export const StorageProps = {
|
|
549
|
+
storageType: {
|
|
550
|
+
type: String as PropType<`${StorageType}`>,
|
|
551
|
+
default: StorageType.local,
|
|
552
|
+
validator: (value: StorageType) =>
|
|
553
|
+
Object.values(StorageType).includes(value),
|
|
554
|
+
},
|
|
555
|
+
storageKey: String,
|
|
556
|
+
}
|
|
@@ -65,12 +65,12 @@ export const argTypes = {
|
|
|
65
65
|
},
|
|
66
66
|
modifiers: {
|
|
67
67
|
...ModifiersArgTypes.modifiers,
|
|
68
|
-
options: ['
|
|
68
|
+
options: ['condensed'],
|
|
69
69
|
},
|
|
70
70
|
itemModifiers: {
|
|
71
71
|
description: 'Accordion items BEM modifiers',
|
|
72
72
|
control: 'check',
|
|
73
|
-
options: ['marker-right', 'bordered'],
|
|
73
|
+
options: ['marker-right', 'bordered', 'square'],
|
|
74
74
|
},
|
|
75
75
|
...DisabledArgTypes,
|
|
76
76
|
...DefaultSlotArgTypes,
|
|
@@ -29,10 +29,10 @@ export async function defaultTest({ canvasElement, args }: PlayAttributes) {
|
|
|
29
29
|
|
|
30
30
|
// open
|
|
31
31
|
if (!args.disabled && args.items && args.items.length > 0) {
|
|
32
|
-
expect(firstChild.open).toBe(false)
|
|
32
|
+
expect(firstChild.open).toBe(args.not ?? false)
|
|
33
33
|
expect(firstChildSummary).toBeClicked()
|
|
34
34
|
await sleep()
|
|
35
|
-
expect(firstChild.open).toBe(
|
|
35
|
+
expect(firstChild.open).toBe(!args.not)
|
|
36
36
|
if (firstChild.open) {
|
|
37
37
|
if (args.not) {
|
|
38
38
|
expect(JSON.stringify(JSON.parse(value.innerText))).toBe(
|
|
@@ -51,10 +51,10 @@ export async function defaultTest({ canvasElement, args }: PlayAttributes) {
|
|
|
51
51
|
} else {
|
|
52
52
|
expect(value.innerText).toBe(args.items[0].name)
|
|
53
53
|
}
|
|
54
|
+
expect(firstChildSummary.getAttribute('aria-expanded')).toBe('true')
|
|
55
|
+
const content = firstChild.lastChild as HTMLElement
|
|
56
|
+
expect(content.getAttribute('aria-hidden')).toBe('false')
|
|
54
57
|
}
|
|
55
|
-
expect(firstChildSummary.getAttribute('aria-expanded')).toBe('true')
|
|
56
|
-
const content = firstChild.lastChild as HTMLElement
|
|
57
|
-
expect(content.getAttribute('aria-hidden')).toBe('false')
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
// accessibility
|
|
@@ -121,11 +121,8 @@ export const argTypes = {
|
|
|
121
121
|
control: { type: 'text' },
|
|
122
122
|
},
|
|
123
123
|
target: {
|
|
124
|
-
options: ['', '_blank', '_self', '_parent', '_top'],
|
|
125
124
|
description: 'The target attribute',
|
|
126
|
-
control: {
|
|
127
|
-
type: 'select',
|
|
128
|
-
},
|
|
125
|
+
control: { type: 'text' },
|
|
129
126
|
},
|
|
130
127
|
to: {
|
|
131
128
|
description: 'The router link / nuxt link settings',
|
package/src/types/nav.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import type { AnchorTarget } from '@/constants'
|
|
2
|
-
|
|
3
1
|
export type NavItem = {
|
|
4
2
|
label: string
|
|
5
3
|
ariaLabel?: string
|
|
6
4
|
title?: string
|
|
7
5
|
to?: string | Record<string, unknown>
|
|
8
6
|
href?: string
|
|
9
|
-
target?:
|
|
7
|
+
target?: string
|
|
10
8
|
rel?: string
|
|
11
9
|
disabled?: boolean
|
|
12
10
|
current?: boolean
|