@volverjs/ui-vue 0.0.9 → 0.0.10-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 +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 +14 -3
- package/dist/components/VvBreadcrumb/index.d.ts +2 -9
- package/dist/components/VvButton/VvButton.es.js +70 -25
- 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 +35 -7
- 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 +106 -51
- 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 +635 -400
- 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 +31 -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 +35 -7
- 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 +106 -51
- 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 +159 -99
- 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.es.js +1593 -1012
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/group/useInjectedGroupState.d.ts +1 -1
- package/dist/composables/useOptions.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/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/Combobox/ComboboxOptions.stories.d.ts +1 -0
- package/dist/stories/InputText/InputTextMask.stories.d.ts +1 -1
- 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 +17 -0
- package/package.json +61 -52
- 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 +32 -33
- 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/VvSelect/VvSelect.vue +4 -4
- 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/composables/useOptions.ts +2 -2
- 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/stories/Button/ButtonModifiers.stories.ts +4 -14
- package/src/stories/Combobox/Combobox.settings.ts +8 -0
- package/src/stories/Combobox/ComboboxOptions.stories.ts +18 -0
- package/src/stories/InputText/InputTextMask.stories.ts +1 -1
- 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 +19 -0
- package/src/utils/ObjectUtilities.ts +3 -2
- 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
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
|
package/src/props/index.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { PropType } from 'vue'
|
|
2
|
-
import type { Option } from '
|
|
2
|
+
import type { Option } from '@/types/generic'
|
|
3
|
+
import type { NavItem } from '@/types/nav'
|
|
3
4
|
import type {
|
|
4
5
|
AutoPlacementOptions,
|
|
5
6
|
FlipOptions,
|
|
6
7
|
OffsetOptions,
|
|
7
8
|
ShiftOptions,
|
|
8
9
|
SizeOptions,
|
|
9
|
-
} from '
|
|
10
|
+
} from '@/types/floating-ui'
|
|
10
11
|
import {
|
|
11
12
|
Placement,
|
|
12
13
|
Strategy,
|
|
@@ -14,7 +15,8 @@ import {
|
|
|
14
15
|
Side,
|
|
15
16
|
AnchorTarget,
|
|
16
17
|
ButtonType,
|
|
17
|
-
|
|
18
|
+
ActionTag,
|
|
19
|
+
} from '@/constants'
|
|
18
20
|
|
|
19
21
|
export const LinkProps = {
|
|
20
22
|
/**
|
|
@@ -102,6 +104,13 @@ export const ActiveProps = {
|
|
|
102
104
|
active: Boolean,
|
|
103
105
|
}
|
|
104
106
|
|
|
107
|
+
export const CurrentProps = {
|
|
108
|
+
/**
|
|
109
|
+
* Whether the item is current
|
|
110
|
+
*/
|
|
111
|
+
current: Boolean,
|
|
112
|
+
}
|
|
113
|
+
|
|
105
114
|
export const PressedProps = {
|
|
106
115
|
/**
|
|
107
116
|
* Whether the item is pressed
|
|
@@ -443,6 +452,7 @@ export const ActionProps = {
|
|
|
443
452
|
...LabelProps,
|
|
444
453
|
...PressedProps,
|
|
445
454
|
...ActiveProps,
|
|
455
|
+
...CurrentProps,
|
|
446
456
|
...LinkProps,
|
|
447
457
|
/**
|
|
448
458
|
* Button type
|
|
@@ -460,4 +470,18 @@ export const ActionProps = {
|
|
|
460
470
|
type: String,
|
|
461
471
|
default: undefined,
|
|
462
472
|
},
|
|
473
|
+
/**
|
|
474
|
+
* Default tag for the action
|
|
475
|
+
*/
|
|
476
|
+
defaultTag: {
|
|
477
|
+
type: String,
|
|
478
|
+
default: ActionTag.button,
|
|
479
|
+
},
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
export const NavProps = {
|
|
483
|
+
items: {
|
|
484
|
+
type: Array as PropType<NavItem[]>,
|
|
485
|
+
default: () => [],
|
|
486
|
+
},
|
|
463
487
|
}
|
|
@@ -3,7 +3,6 @@ import VvButton from '@/components/VvButton/VvButton.vue'
|
|
|
3
3
|
import { Default } from './Button.stories'
|
|
4
4
|
import { argTypes, defaultArgs } from './Button.settings'
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
const meta: Meta<typeof VvButton> = {
|
|
8
7
|
title: 'Components/Button/Modifiers',
|
|
9
8
|
component: VvButton,
|
|
@@ -70,9 +69,6 @@ export const StaticLight: Story = {
|
|
|
70
69
|
},
|
|
71
70
|
render: (args) => ({
|
|
72
71
|
components: { VvButton },
|
|
73
|
-
backgrounds: {
|
|
74
|
-
default: 'dark',
|
|
75
|
-
},
|
|
76
72
|
setup() {
|
|
77
73
|
return { args }
|
|
78
74
|
},
|
|
@@ -81,23 +77,18 @@ export const StaticLight: Story = {
|
|
|
81
77
|
<vv-button v-bind="args" data-testId="element" />
|
|
82
78
|
</div>
|
|
83
79
|
`,
|
|
84
|
-
})
|
|
85
|
-
|
|
80
|
+
}),
|
|
86
81
|
}
|
|
87
82
|
|
|
88
|
-
|
|
89
83
|
export const StaticDark: Story = {
|
|
90
84
|
...Default,
|
|
91
85
|
args: {
|
|
92
86
|
...Default.args,
|
|
93
|
-
label: 'Static
|
|
94
|
-
modifiers: 'static-
|
|
87
|
+
label: 'Static dark',
|
|
88
|
+
modifiers: 'static-dark',
|
|
95
89
|
},
|
|
96
90
|
render: (args) => ({
|
|
97
91
|
components: { VvButton },
|
|
98
|
-
backgrounds: {
|
|
99
|
-
default: 'dark',
|
|
100
|
-
},
|
|
101
92
|
setup() {
|
|
102
93
|
return { args }
|
|
103
94
|
},
|
|
@@ -106,7 +97,7 @@ export const StaticDark: Story = {
|
|
|
106
97
|
<vv-button v-bind="args" data-testId="element" />
|
|
107
98
|
</div>
|
|
108
99
|
`,
|
|
109
|
-
})
|
|
100
|
+
}),
|
|
110
101
|
}
|
|
111
102
|
|
|
112
103
|
export const Block: Story = {
|
|
@@ -137,7 +128,6 @@ export const FullBleed: Story = {
|
|
|
137
128
|
},
|
|
138
129
|
}
|
|
139
130
|
|
|
140
|
-
|
|
141
131
|
export const Action: Story = {
|
|
142
132
|
...Default,
|
|
143
133
|
args: {
|
|
@@ -94,3 +94,21 @@ export const DotPathOptions: Story = {
|
|
|
94
94
|
],
|
|
95
95
|
},
|
|
96
96
|
}
|
|
97
|
+
|
|
98
|
+
export const ObjectValue: Story = {
|
|
99
|
+
...Default,
|
|
100
|
+
args: {
|
|
101
|
+
...Default.args,
|
|
102
|
+
multiple: true,
|
|
103
|
+
options: [
|
|
104
|
+
{
|
|
105
|
+
value: { name: 'John Doe', email: 'john.doe@test.com' },
|
|
106
|
+
label: 'John Doe',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
value: { name: 'Jane Doe', email: 'jane.doe@test.com' },
|
|
110
|
+
label: 'Jane Doe',
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
}
|
|
@@ -7,16 +7,15 @@ export const defaultArgs: Meta<typeof VvNav>['args'] = {
|
|
|
7
7
|
...propsToObject(VvNavProps),
|
|
8
8
|
items: [
|
|
9
9
|
{
|
|
10
|
-
|
|
10
|
+
label: 'Item 1',
|
|
11
11
|
href: 'javascript:void(0)',
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
|
-
|
|
14
|
+
label: 'Item 2',
|
|
15
15
|
to: 'about',
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
|
|
19
|
-
to: 'contacts',
|
|
18
|
+
label: 'Item 3',
|
|
20
19
|
on: {
|
|
21
20
|
click: () => {
|
|
22
21
|
// eslint-disable-next-line no-console
|
|
@@ -1,31 +1,20 @@
|
|
|
1
1
|
import type { PlayAttributes } from '@/test/types'
|
|
2
2
|
import { expect } from '@/test/expect'
|
|
3
|
-
import { within
|
|
3
|
+
import { within } from '@storybook/testing-library'
|
|
4
4
|
|
|
5
5
|
export async function defaultTest({ canvasElement, args }: PlayAttributes) {
|
|
6
6
|
const element = (await within(canvasElement).findByTestId(
|
|
7
7
|
'element',
|
|
8
8
|
)) as HTMLElement
|
|
9
9
|
|
|
10
|
+
const menuEl = element.getElementsByClassName('vv-nav__menu')[0]
|
|
11
|
+
|
|
10
12
|
if (!args.items || !args.items?.length) {
|
|
11
13
|
throw new Error('No items passed')
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
// check children number the same of items prop
|
|
15
|
-
expect(
|
|
16
|
-
|
|
17
|
-
// take firse and second elements
|
|
18
|
-
const firstEl = await element.getElementsByTagName('a')?.[0]
|
|
19
|
-
const secondEl = await element.getElementsByTagName('router-link')?.[1]
|
|
20
|
-
// check they have not current class
|
|
21
|
-
const secondElHasCurrentClass = secondEl.classList.contains('current')
|
|
22
|
-
const firstElHasCurrentClass = firstEl.classList.contains('current')
|
|
23
|
-
|
|
24
|
-
await expect(firstElHasCurrentClass).toBe(false)
|
|
25
|
-
await expect(secondElHasCurrentClass).toBe(false)
|
|
26
|
-
// click first item and check "current" css class
|
|
27
|
-
await userEvent.click(firstEl)
|
|
28
|
-
await expect(firstEl).toHaveClass('current')
|
|
17
|
+
expect(menuEl.children.length).toEqual(args.items?.length)
|
|
29
18
|
|
|
30
19
|
// check accessibility
|
|
31
20
|
await expect(element).toHaveNoViolations()
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
+
import type { ArgTypes, Meta } from '@storybook/vue3'
|
|
2
|
+
import type { VvTab } from '@/components'
|
|
1
3
|
import { VvTabProps } from '@/components/VvTab'
|
|
2
4
|
|
|
3
|
-
export const defaultArgs = {
|
|
5
|
+
export const defaultArgs: Meta<typeof VvTab>['args'] = {
|
|
4
6
|
...propsToObject(VvTabProps),
|
|
5
7
|
items: [
|
|
6
8
|
{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
tab: 'tab-1',
|
|
10
|
+
label: 'Item 1',
|
|
9
11
|
},
|
|
10
12
|
{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
tab: 'tab-2',
|
|
14
|
+
label: 'Item 2',
|
|
13
15
|
},
|
|
14
16
|
{
|
|
15
|
-
|
|
16
|
-
title: 'Item 3',
|
|
17
|
-
to: 'contacts',
|
|
17
|
+
label: 'Item 3',
|
|
18
18
|
on: {
|
|
19
19
|
click: () => {
|
|
20
20
|
// eslint-disable-next-line no-console
|
|
@@ -25,7 +25,7 @@ export const defaultArgs = {
|
|
|
25
25
|
],
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export const defaultArgTypes = {
|
|
28
|
+
export const defaultArgTypes: ArgTypes = {
|
|
29
29
|
tabId: {
|
|
30
30
|
description: 'Slot by tab-id',
|
|
31
31
|
control: {
|
|
@@ -27,7 +27,7 @@ export const Default: Story = {
|
|
|
27
27
|
template: /* html */ `
|
|
28
28
|
<div class="m-md w-1/2">
|
|
29
29
|
<vv-tab v-bind="args" data-testId="element">
|
|
30
|
-
<template #tab-
|
|
30
|
+
<template #panel::tab-1>
|
|
31
31
|
<span class="text-20 font-semibold">Tab 1</span>
|
|
32
32
|
<p>
|
|
33
33
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla
|
|
@@ -39,7 +39,7 @@ export const Default: Story = {
|
|
|
39
39
|
elit libero, a pharetra augue.
|
|
40
40
|
</p>
|
|
41
41
|
</template>
|
|
42
|
-
<template #tab-
|
|
42
|
+
<template #panel::tab-2>
|
|
43
43
|
<span class="text-20 font-semibold">Tab 2</span>
|
|
44
44
|
<p>
|
|
45
45
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PlayAttributes } from '@/test/types'
|
|
2
2
|
import { expect } from '@/test/expect'
|
|
3
|
-
import { within
|
|
3
|
+
import { within } from '@storybook/testing-library'
|
|
4
4
|
|
|
5
5
|
export async function defaultTest({ canvasElement, args }: PlayAttributes) {
|
|
6
6
|
const element = (await within(canvasElement).findByTestId(
|
|
@@ -16,21 +16,13 @@ export async function defaultTest({ canvasElement, args }: PlayAttributes) {
|
|
|
16
16
|
expect(childrenEls?.children[0].children.length).toEqual(args.items?.length)
|
|
17
17
|
|
|
18
18
|
// take firse and second elements
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const secondElHasCurrentClass = secondEl.classList.contains('current')
|
|
23
|
-
const firstElHasCurrentClass = firstEl.classList.contains('current')
|
|
24
|
-
|
|
25
|
-
await expect(firstElHasCurrentClass).toBe(false)
|
|
26
|
-
await expect(secondElHasCurrentClass).toBe(false)
|
|
27
|
-
// click first item and check "current" css class
|
|
28
|
-
await userEvent.click(firstEl)
|
|
29
|
-
await expect(firstEl).toHaveClass('current')
|
|
19
|
+
const firstNavItemLabelEl =
|
|
20
|
+
await element.getElementsByClassName('vv-nav__item-label')?.[0]
|
|
21
|
+
await expect(firstNavItemLabelEl.classList.contains('current')).toBe(true)
|
|
30
22
|
|
|
31
23
|
// check tab content to include "Tab 1"
|
|
32
|
-
const
|
|
33
|
-
await expect(
|
|
24
|
+
const firstTabPanelEl = element.getElementsByClassName('vv-tab__panel')?.[0]
|
|
25
|
+
await expect(firstTabPanelEl.classList.contains('target')).toBe(true)
|
|
34
26
|
|
|
35
27
|
// check accessibility
|
|
36
28
|
await expect(element).toHaveNoViolations()
|
package/src/stories/argTypes.ts
CHANGED
package/src/types/nav.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AnchorTarget } from '@/constants'
|
|
2
|
+
|
|
3
|
+
export type NavItem = {
|
|
4
|
+
label: string
|
|
5
|
+
ariaLabel?: string
|
|
6
|
+
title?: string
|
|
7
|
+
to?: string | Record<string, unknown>
|
|
8
|
+
href?: string
|
|
9
|
+
target?: `${AnchorTarget}`
|
|
10
|
+
rel?: string
|
|
11
|
+
disabled?: boolean
|
|
12
|
+
current?: boolean
|
|
13
|
+
class?: string | string[]
|
|
14
|
+
on?: Record<'click' | string, () => void>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type NavItemTab = NavItem & {
|
|
18
|
+
tab?: string
|
|
19
|
+
}
|
|
@@ -9,9 +9,10 @@ import type { Ref } from 'vue'
|
|
|
9
9
|
*/
|
|
10
10
|
// eslint-disable-next-line
|
|
11
11
|
export function equals(obj1: any, obj2: any, field?: string) {
|
|
12
|
-
if (field)
|
|
12
|
+
if (field) {
|
|
13
13
|
return resolveFieldData(obj1, field) === resolveFieldData(obj2, field)
|
|
14
|
-
|
|
14
|
+
}
|
|
15
|
+
return deepEquals(obj1, obj2)
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
/**
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{
|
|
2
|
-
title: StringConstructor;
|
|
3
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
4
|
-
title: StringConstructor;
|
|
5
|
-
}>>, {}, {}>;
|
|
6
|
-
export default _default;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { defineComponent, openBlock, createElementBlock, toDisplayString } from "vue";
|
|
2
|
-
const _hoisted_1 = {
|
|
3
|
-
class: "vv-nav__heading-label",
|
|
4
|
-
"aria-hidden": "true"
|
|
5
|
-
};
|
|
6
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
-
__name: "VvNavItemTitle",
|
|
8
|
-
props: {
|
|
9
|
-
title: String
|
|
10
|
-
},
|
|
11
|
-
setup(__props) {
|
|
12
|
-
return (_ctx, _cache) => {
|
|
13
|
-
return openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(__props.title), 1);
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
export {
|
|
18
|
-
_sfc_main as default
|
|
19
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue")):"function"==typeof define&&define.amd?define(["vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvNavItemTitle=t(e.vue)}(this,(function(e){"use strict";const t={class:"vv-nav__heading-label","aria-hidden":"true"};return e.defineComponent({__name:"VvNavItemTitle",props:{title:String},setup:n=>(i,o)=>(e.openBlock(),e.createElementBlock("span",t,e.toDisplayString(n.title),1))})}));
|
package/src/types/generic.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|