@code-coaching/vuetiful 0.23.0 → 0.23.2
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/dist/style.css +1 -1
- package/dist/types/components/VBootstrap.vue.d.ts +1 -1
- package/dist/types/components/atoms/VAvatar.vue.d.ts +1 -1
- package/dist/types/components/atoms/VLightSwitch.vue.d.ts +2 -2
- package/dist/types/components/atoms/index.d.ts +13 -13
- package/dist/types/components/index.d.ts +2 -2
- package/dist/types/components/molecules/VAlert.vue.d.ts +1 -1
- package/dist/types/components/molecules/VCodeBlock.vue.d.ts +2 -2
- package/dist/types/components/molecules/VDrawer.vue.d.ts +1 -1
- package/dist/types/components/molecules/VListbox/VListbox.vue.d.ts +1 -1
- package/dist/types/components/molecules/VRail/VRail.vue.d.ts +1 -1
- package/dist/types/components/molecules/VRail/VRailTile.vue.d.ts +1 -1
- package/dist/types/components/molecules/index.d.ts +21 -21
- package/dist/types/directives/clipboard.d.ts +1 -1
- package/dist/types/directives/index.d.ts +1 -1
- package/dist/types/index.d.ts +6 -6
- package/dist/types/props/props.d.ts +1 -1
- package/dist/types/services/dark-mode.service.d.ts +1 -1
- package/dist/types/services/drawer.service.d.ts +1 -1
- package/dist/types/services/index.d.ts +5 -5
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/utils/index.d.ts +2 -2
- package/dist/types/utils/theme/theme-switcher.vue.d.ts +23 -63
- package/dist/types/utils/theme/theme.service.d.ts +1 -1
- package/dist/vuetiful.es.mjs +82 -150
- package/dist/vuetiful.umd.js +7 -15
- package/package.json +1 -1
- package/src/assets/main.css +6 -6
- package/src/components/VBootstrap.vue +43 -43
- package/src/components/atoms/VAvatar.test.ts +71 -71
- package/src/components/atoms/VAvatar.vue +22 -23
- package/src/components/atoms/VBadge.test.ts +11 -11
- package/src/components/atoms/VBadge.vue +2 -2
- package/src/components/atoms/VButton.test.ts +82 -82
- package/src/components/atoms/VButton.vue +20 -21
- package/src/components/atoms/VChip.test.ts +11 -11
- package/src/components/atoms/VChip.vue +3 -3
- package/src/components/atoms/VLightSwitch.test.ts +6 -6
- package/src/components/atoms/VLightSwitch.vue +26 -31
- package/src/components/atoms/VRadio/VRadioDescription.test.ts +13 -13
- package/src/components/atoms/VRadio/VRadioDescription.vue +2 -2
- package/src/components/atoms/VRadio/VRadioGroup.test.ts +40 -40
- package/src/components/atoms/VRadio/VRadioGroup.vue +19 -22
- package/src/components/atoms/VRadio/VRadioItem.test.ts +67 -67
- package/src/components/atoms/VRadio/VRadioItem.vue +10 -13
- package/src/components/atoms/VRadio/VRadioLabel.test.ts +13 -13
- package/src/components/atoms/VRadio/VRadioLabel.vue +5 -3
- package/src/components/atoms/VSwitch/VSwitch.test.ts +33 -33
- package/src/components/atoms/VSwitch/VSwitch.vue +24 -27
- package/src/components/atoms/VSwitch/VSwitchDescription.test.ts +13 -13
- package/src/components/atoms/VSwitch/VSwitchDescription.vue +2 -2
- package/src/components/atoms/VSwitch/VSwitchGroup.test.ts +9 -9
- package/src/components/atoms/VSwitch/VSwitchGroup.vue +2 -2
- package/src/components/atoms/VSwitch/VSwitchLabel.test.ts +19 -19
- package/src/components/atoms/VSwitch/VSwitchLabel.vue +2 -2
- package/src/components/atoms/index.ts +13 -13
- package/src/components/index.test.ts +3 -3
- package/src/components/index.ts +2 -2
- package/src/components/molecules/VAccordion/VAccordion.test.ts +11 -17
- package/src/components/molecules/VAccordion/VAccordion.vue +3 -3
- package/src/components/molecules/VAccordion/VAccordionItem.test.ts +55 -55
- package/src/components/molecules/VAccordion/VAccordionItem.vue +9 -22
- package/src/components/molecules/VAlert.test.ts +38 -38
- package/src/components/molecules/VAlert.vue +25 -47
- package/src/components/molecules/VCard/VCard.test.ts +25 -25
- package/src/components/molecules/VCard/VCard.vue +13 -15
- package/src/components/molecules/VCard/VCardBody.test.ts +14 -14
- package/src/components/molecules/VCard/VCardBody.vue +4 -8
- package/src/components/molecules/VCard/VCardFooter.test.ts +22 -22
- package/src/components/molecules/VCard/VCardFooter.vue +10 -8
- package/src/components/molecules/VCard/VCardHeader.test.ts +25 -25
- package/src/components/molecules/VCard/VCardHeader.vue +7 -8
- package/src/components/molecules/VCodeBlock.test.ts +63 -63
- package/src/components/molecules/VCodeBlock.vue +27 -34
- package/src/components/molecules/VDrawer.test.ts +5 -5
- package/src/components/molecules/VDrawer.vue +10 -10
- package/src/components/molecules/VListbox/VListbox.test.ts +53 -53
- package/src/components/molecules/VListbox/VListbox.vue +31 -32
- package/src/components/molecules/VListbox/VListboxButton.test.ts +13 -13
- package/src/components/molecules/VListbox/VListboxButton.vue +5 -5
- package/src/components/molecules/VListbox/VListboxItem.test.ts +25 -25
- package/src/components/molecules/VListbox/VListboxItem.vue +7 -8
- package/src/components/molecules/VListbox/VListboxItems.test.ts +14 -14
- package/src/components/molecules/VListbox/VListboxItems.vue +9 -11
- package/src/components/molecules/VListbox/VListboxLabel.test.ts +10 -10
- package/src/components/molecules/VListbox/VListboxLabel.vue +2 -2
- package/src/components/molecules/VPreview.test.ts +26 -26
- package/src/components/molecules/VPreview.vue +22 -27
- package/src/components/molecules/VRail/VRail.test.ts +5 -5
- package/src/components/molecules/VRail/VRail.vue +7 -7
- package/src/components/molecules/VRail/VRailTile.test.ts +26 -28
- package/src/components/molecules/VRail/VRailTile.vue +13 -11
- package/src/components/molecules/VShell.test.ts +5 -5
- package/src/components/molecules/VShell.vue +11 -20
- package/src/components/molecules/VTabs/VTab.test.ts +48 -52
- package/src/components/molecules/VTabs/VTab.vue +13 -17
- package/src/components/molecules/VTabs/VTabPanel.test.ts +8 -8
- package/src/components/molecules/VTabs/VTabPanel.vue +1 -1
- package/src/components/molecules/VTabs/VTabs.test.ts +36 -36
- package/src/components/molecules/VTabs/VTabs.vue +18 -22
- package/src/components/molecules/index.ts +21 -21
- package/src/directives/clipboard.test.ts +9 -9
- package/src/directives/clipboard.ts +2 -2
- package/src/directives/index.ts +1 -1
- package/src/env.d.ts +2 -2
- package/src/index.test.ts +6 -6
- package/src/index.ts +7 -7
- package/src/props/index.ts +1 -1
- package/src/props/props.ts +44 -44
- package/src/services/dark-mode.service.test.ts +115 -93
- package/src/services/dark-mode.service.ts +9 -9
- package/src/services/drawer.service.test.ts +21 -21
- package/src/services/drawer.service.ts +10 -10
- package/src/services/highlight.service.test.ts +12 -12
- package/src/services/highlight.service.ts +1 -1
- package/src/services/index.ts +5 -5
- package/src/services/rail.service.test.ts +7 -7
- package/src/services/rail.service.ts +2 -2
- package/src/services/settings.service.test.ts +5 -5
- package/src/services/settings.service.ts +1 -1
- package/src/styles/all.css +7 -7
- package/src/styles/elements/buttons.css +1 -1
- package/src/styles/elements/forms.css +7 -7
- package/src/styles/elements.css +13 -13
- package/src/styles/transitions.css +2 -2
- package/src/styles/typography.css +5 -5
- package/src/themes/theme-rocket.css +10 -10
- package/src/themes/theme-sahara.css +13 -13
- package/src/themes/theme-seafoam.css +13 -13
- package/src/themes/theme-seasonal.css +4 -4
- package/src/themes/theme-skeleton.css +7 -7
- package/src/themes/theme-vintage.css +12 -12
- package/src/themes/theme-vuetiful-0.0.1.css +13 -13
- package/src/types/index.ts +46 -46
- package/src/types/tailwind.ts +2 -21
- package/src/utils/index.test.ts +3 -3
- package/src/utils/index.ts +2 -2
- package/src/utils/platform/platform.service.test.ts +6 -6
- package/src/utils/platform/platform.service.ts +1 -1
- package/src/utils/theme/callback.test.ts +6 -6
- package/src/utils/theme/remove.test.ts +8 -8
- package/src/utils/theme/theme-switcher.vue +58 -131
- package/src/utils/theme/theme.service.test.ts +69 -61
- package/src/utils/theme/theme.service.ts +19 -20
|
@@ -1,39 +1,41 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { CssClasses } from
|
|
3
|
-
import { VRadioItem } from
|
|
4
|
-
import { useRail } from
|
|
5
|
-
import { inject } from
|
|
2
|
+
import type { CssClasses } from '@/index';
|
|
3
|
+
import { VRadioItem } from '@/index';
|
|
4
|
+
import { useRail } from '@/services';
|
|
5
|
+
import { inject } from 'vue';
|
|
6
6
|
|
|
7
7
|
defineProps({
|
|
8
8
|
value: {
|
|
9
9
|
type: String,
|
|
10
|
-
default:
|
|
10
|
+
default: '',
|
|
11
11
|
},
|
|
12
12
|
label: {
|
|
13
13
|
type: String as () => string,
|
|
14
|
-
default:
|
|
14
|
+
default: '',
|
|
15
15
|
},
|
|
16
16
|
|
|
17
17
|
regionIcon: {
|
|
18
18
|
type: String as () => CssClasses,
|
|
19
|
-
default:
|
|
19
|
+
default: '',
|
|
20
20
|
},
|
|
21
21
|
regionLabel: {
|
|
22
22
|
type: String as () => CssClasses,
|
|
23
|
-
default:
|
|
23
|
+
default: '',
|
|
24
24
|
},
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
const { selectedRailTile } = useRail();
|
|
28
|
-
const activeRail = inject(
|
|
29
|
-
const hoverRail = inject(
|
|
28
|
+
const activeRail = inject('activeRail');
|
|
29
|
+
const hoverRail = inject('hoverRail');
|
|
30
30
|
</script>
|
|
31
31
|
|
|
32
32
|
<template>
|
|
33
33
|
<v-radio-item
|
|
34
34
|
unstyled
|
|
35
35
|
:value="value"
|
|
36
|
-
:class="`vuetiful-rail-tile grid aspect-square w-full cursor-pointer place-content-center place-items-center ${
|
|
36
|
+
:class="`vuetiful-rail-tile grid aspect-square w-full cursor-pointer place-content-center place-items-center ${
|
|
37
|
+
selectedRailTile === value ? `${activeRail}` : `${hoverRail}`
|
|
38
|
+
}`"
|
|
37
39
|
>
|
|
38
40
|
<template v-if="$slots.default">
|
|
39
41
|
<div :class="`vuetiful-rail-tile-icon ${regionIcon}`"><slot /></div>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { mount } from
|
|
2
|
-
import { expect, test } from
|
|
3
|
-
import { VShell } from
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import { expect, test } from 'vitest';
|
|
3
|
+
import { VShell } from '.';
|
|
4
4
|
|
|
5
|
-
test(
|
|
5
|
+
test('VShell', () => {
|
|
6
6
|
expect(VShell).toBeTruthy();
|
|
7
7
|
});
|
|
8
8
|
|
|
9
9
|
// TODO: add tests
|
|
10
|
-
test(
|
|
10
|
+
test('VShell using slot', () => {
|
|
11
11
|
const wrapper = mount(VShell);
|
|
12
12
|
|
|
13
13
|
expect(wrapper).toBeTruthy();
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export type CssClasses = string;
|
|
11
11
|
defineProps({
|
|
12
|
-
regionPage: { type: String as () => CssClasses, default:
|
|
13
|
-
slotFixedHeader: { type: String as () => CssClasses, default:
|
|
14
|
-
slotSidebarLeft: { type: String as () => CssClasses, default:
|
|
15
|
-
slotSidebarRight: { type: String as () => CssClasses, default:
|
|
16
|
-
slotPageHeader: { type: String as () => CssClasses, default:
|
|
17
|
-
slotPageContent: { type: String as () => CssClasses, default:
|
|
18
|
-
slotPageFooter: { type: String as () => CssClasses, default:
|
|
19
|
-
slotFixedFooter: { type: String as () => CssClasses, default:
|
|
12
|
+
regionPage: { type: String as () => CssClasses, default: '' },
|
|
13
|
+
slotFixedHeader: { type: String as () => CssClasses, default: 'z-10' },
|
|
14
|
+
slotSidebarLeft: { type: String as () => CssClasses, default: 'w-auto' },
|
|
15
|
+
slotSidebarRight: { type: String as () => CssClasses, default: 'w-auto' },
|
|
16
|
+
slotPageHeader: { type: String as () => CssClasses, default: '' },
|
|
17
|
+
slotPageContent: { type: String as () => CssClasses, default: '' },
|
|
18
|
+
slotPageFooter: { type: String as () => CssClasses, default: '' },
|
|
19
|
+
slotFixedFooter: { type: String as () => CssClasses, default: '' },
|
|
20
20
|
});
|
|
21
21
|
</script>
|
|
22
22
|
|
|
@@ -34,14 +34,8 @@ defineProps({
|
|
|
34
34
|
<slot name="sidebarLeft" />
|
|
35
35
|
</aside>
|
|
36
36
|
|
|
37
|
-
<div
|
|
38
|
-
|
|
39
|
-
:class="`vuetiful-page flex flex-1 flex-col overflow-x-hidden ${regionPage ?? ''}`"
|
|
40
|
-
>
|
|
41
|
-
<header
|
|
42
|
-
v-if="$slots.pageHeader"
|
|
43
|
-
:class="`vuetiful-page-header flex-none ${slotPageHeader}`"
|
|
44
|
-
>
|
|
37
|
+
<div tabindex="-1" :class="`vuetiful-page flex flex-1 flex-col overflow-x-hidden ${regionPage ?? ''}`">
|
|
38
|
+
<header v-if="$slots.pageHeader" :class="`vuetiful-page-header flex-none ${slotPageHeader}`">
|
|
45
39
|
<slot name="pageHeader" />
|
|
46
40
|
</header>
|
|
47
41
|
|
|
@@ -49,10 +43,7 @@ defineProps({
|
|
|
49
43
|
<slot />
|
|
50
44
|
</main>
|
|
51
45
|
|
|
52
|
-
<footer
|
|
53
|
-
v-if="$slots.pageFooter"
|
|
54
|
-
:class="`vuetiful-page-footer flex-none ${slotPageFooter}`"
|
|
55
|
-
>
|
|
46
|
+
<footer v-if="$slots.pageFooter" :class="`vuetiful-page-footer flex-none ${slotPageFooter}`">
|
|
56
47
|
<slot name="pageFooter" />
|
|
57
48
|
</footer>
|
|
58
49
|
</div>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { mount } from
|
|
2
|
-
import { describe, expect, test } from
|
|
3
|
-
import { VTab, VTabs } from
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
3
|
+
import { VTab, VTabs } from '..';
|
|
4
4
|
|
|
5
|
-
describe(
|
|
6
|
-
test(
|
|
5
|
+
describe('VTab', () => {
|
|
6
|
+
test('defaults', async () => {
|
|
7
7
|
const wrapper = mount({
|
|
8
8
|
template: /*html*/ `
|
|
9
9
|
<v-tabs>
|
|
@@ -13,25 +13,25 @@ describe("VTab", () => {
|
|
|
13
13
|
</v-tabs>
|
|
14
14
|
`,
|
|
15
15
|
components: {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
'v-tabs': VTabs,
|
|
17
|
+
'v-tab': VTab,
|
|
18
18
|
},
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
const vuetiful = wrapper.find("[data-test='vuetiful']");
|
|
22
22
|
const slotContainer = vuetiful.find("[data-test='slot-container']");
|
|
23
|
-
expect(vuetiful.classes()).toEqual([
|
|
23
|
+
expect(vuetiful.classes()).toEqual(['vuetiful-tab', 'flex', 'flex-col']);
|
|
24
24
|
expect(slotContainer.classes()).toEqual([
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
'vuetiful-tab-content',
|
|
26
|
+
'text-base',
|
|
27
|
+
'rounded-token',
|
|
28
|
+
'w-full',
|
|
29
|
+
'px-4',
|
|
30
|
+
'py-2',
|
|
31
31
|
]);
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
test(
|
|
34
|
+
test('vertical', async () => {
|
|
35
35
|
const wrapper = mount({
|
|
36
36
|
template: /*html*/ `
|
|
37
37
|
<v-tabs vertical>
|
|
@@ -41,16 +41,16 @@ describe("VTab", () => {
|
|
|
41
41
|
</v-tabs>
|
|
42
42
|
`,
|
|
43
43
|
components: {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
'v-tabs': VTabs,
|
|
45
|
+
'v-tab': VTab,
|
|
46
46
|
},
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
const vuetiful = wrapper.find("[data-test='vuetiful']");
|
|
50
|
-
expect(vuetiful.classes()).toEqual([
|
|
50
|
+
expect(vuetiful.classes()).toEqual(['vuetiful-tab', 'flex', 'flex-row', 'justify-between']);
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
-
test(
|
|
53
|
+
test('class-tab', async () => {
|
|
54
54
|
const wrapper = mount({
|
|
55
55
|
template: /*html*/ `
|
|
56
56
|
<v-tabs class-tab="my-custom-class">
|
|
@@ -60,17 +60,17 @@ describe("VTab", () => {
|
|
|
60
60
|
</v-tabs>
|
|
61
61
|
`,
|
|
62
62
|
components: {
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
'v-tabs': VTabs,
|
|
64
|
+
'v-tab': VTab,
|
|
65
65
|
},
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
const vuetiful = wrapper.find("[data-test='vuetiful']");
|
|
69
69
|
const slotContainer = vuetiful.find("[data-test='slot-container']");
|
|
70
|
-
expect(slotContainer.classes()).toEqual([
|
|
70
|
+
expect(slotContainer.classes()).toEqual(['vuetiful-tab-content', 'text-base', 'rounded-token', 'my-custom-class']);
|
|
71
71
|
});
|
|
72
72
|
|
|
73
|
-
test(
|
|
73
|
+
test('hover/active', async () => {
|
|
74
74
|
const wrapper = mount({
|
|
75
75
|
template: /*html*/ `
|
|
76
76
|
<v-tabs active="my-custom-active-class">
|
|
@@ -82,45 +82,41 @@ describe("VTab", () => {
|
|
|
82
82
|
</v-tabs>
|
|
83
83
|
`,
|
|
84
84
|
components: {
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
'v-tabs': VTabs,
|
|
86
|
+
'v-tab': VTab,
|
|
87
87
|
},
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
-
const vuetifulSlotContainer = wrapper
|
|
91
|
-
.find("[data-test='vuetiful']")
|
|
92
|
-
.find("[data-test='slot-container']");
|
|
90
|
+
const vuetifulSlotContainer = wrapper.find("[data-test='vuetiful']").find("[data-test='slot-container']");
|
|
93
91
|
const isSlotContainer = wrapper.find("[data-test='is']").find("[data-test='slot-container']");
|
|
94
|
-
const beautifulSlotContainer = wrapper
|
|
95
|
-
.find("[data-test='beautiful']")
|
|
96
|
-
.find("[data-test='slot-container']");
|
|
92
|
+
const beautifulSlotContainer = wrapper.find("[data-test='beautiful']").find("[data-test='slot-container']");
|
|
97
93
|
|
|
98
94
|
expect(vuetifulSlotContainer.classes()).toEqual([
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
95
|
+
'vuetiful-tab-content',
|
|
96
|
+
'text-base',
|
|
97
|
+
'rounded-token',
|
|
98
|
+
'my-custom-active-class',
|
|
99
|
+
'w-full',
|
|
100
|
+
'px-4',
|
|
101
|
+
'py-2',
|
|
106
102
|
]);
|
|
107
103
|
expect(isSlotContainer.classes()).toEqual([
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
104
|
+
'vuetiful-tab-content',
|
|
105
|
+
'text-base',
|
|
106
|
+
'rounded-token',
|
|
107
|
+
'hover:variant-ghost',
|
|
108
|
+
'w-full',
|
|
109
|
+
'px-4',
|
|
110
|
+
'py-2',
|
|
115
111
|
]);
|
|
116
112
|
expect(beautifulSlotContainer.classes()).toEqual([
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
113
|
+
'vuetiful-tab-content',
|
|
114
|
+
'text-base',
|
|
115
|
+
'rounded-token',
|
|
116
|
+
'hover:variant-ghost',
|
|
117
|
+
'w-full',
|
|
118
|
+
'px-4',
|
|
119
|
+
'py-2',
|
|
124
120
|
]);
|
|
125
121
|
});
|
|
126
122
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { unstyledProp } from
|
|
3
|
-
import { useSettings } from
|
|
4
|
-
import { Tab } from
|
|
5
|
-
import { computed, inject } from
|
|
2
|
+
import { unstyledProp } from '@/props';
|
|
3
|
+
import { useSettings } from '@/services';
|
|
4
|
+
import { Tab } from '@headlessui/vue';
|
|
5
|
+
import { computed, inject } from 'vue';
|
|
6
6
|
|
|
7
7
|
const props = defineProps({
|
|
8
8
|
disabled: {
|
|
@@ -12,15 +12,15 @@ const props = defineProps({
|
|
|
12
12
|
unstyled: unstyledProp,
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
-
const activeClass = inject(
|
|
16
|
-
const hoverClass = inject(
|
|
17
|
-
const vertical = inject(
|
|
18
|
-
const classTab = inject(
|
|
19
|
-
const hideSeparator = inject(
|
|
20
|
-
const classTabSeparator = inject(
|
|
15
|
+
const activeClass = inject('active') as string;
|
|
16
|
+
const hoverClass = inject('hover') as string;
|
|
17
|
+
const vertical = inject('vertical') as boolean;
|
|
18
|
+
const classTab = inject('classTab') as string;
|
|
19
|
+
const hideSeparator = inject('hideSeparator') as boolean;
|
|
20
|
+
const classTabSeparator = inject('classTabSeparator') as string;
|
|
21
21
|
|
|
22
22
|
const tabClass = computed(() => {
|
|
23
|
-
return classTab ? classTab :
|
|
23
|
+
return classTab ? classTab : 'w-full px-4 py-2';
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
const { settings } = useSettings();
|
|
@@ -37,18 +37,14 @@ const isUnstyled = settings.global.unstyled || settings.components.tab.unstyled
|
|
|
37
37
|
<div
|
|
38
38
|
data-test="slot-container"
|
|
39
39
|
class="vuetiful-tab-content"
|
|
40
|
-
:class="`text-base ${isUnstyled ? '' : 'rounded-token'} ${
|
|
41
|
-
selected ? activeClass : hoverClass
|
|
42
|
-
} ${tabClass}`"
|
|
40
|
+
:class="`text-base ${isUnstyled ? '' : 'rounded-token'} ${selected ? activeClass : hoverClass} ${tabClass}`"
|
|
43
41
|
>
|
|
44
42
|
<slot />
|
|
45
43
|
</div>
|
|
46
44
|
<div
|
|
47
45
|
v-show="selected && !hideSeparator"
|
|
48
46
|
class="vuetiful-tab-separator"
|
|
49
|
-
:class="`z-10 ${
|
|
50
|
-
vertical ? 'mr-[-2px] h-full border-r-2' : 'mb-[-2px] w-full border-b-2'
|
|
51
|
-
} ${classTabSeparator}`"
|
|
47
|
+
:class="`z-10 ${vertical ? 'mr-[-2px] h-full border-r-2' : 'mb-[-2px] w-full border-b-2'} ${classTabSeparator}`"
|
|
52
48
|
></div>
|
|
53
49
|
</Tab>
|
|
54
50
|
</template>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { TabGroup } from
|
|
2
|
-
import { mount } from
|
|
3
|
-
import { describe, expect, test } from
|
|
4
|
-
import { VTabPanel } from
|
|
1
|
+
import { TabGroup } from '@headlessui/vue';
|
|
2
|
+
import { mount } from '@vue/test-utils';
|
|
3
|
+
import { describe, expect, test } from 'vitest';
|
|
4
|
+
import { VTabPanel } from '..';
|
|
5
5
|
|
|
6
|
-
describe(
|
|
7
|
-
test(
|
|
6
|
+
describe('VTabs', () => {
|
|
7
|
+
test('default props', () => {
|
|
8
8
|
const wrapper = mount({
|
|
9
9
|
template: /*html*/ `
|
|
10
10
|
<TabGroup>
|
|
@@ -13,11 +13,11 @@ describe("VTabs", () => {
|
|
|
13
13
|
`,
|
|
14
14
|
components: {
|
|
15
15
|
TabGroup: TabGroup,
|
|
16
|
-
|
|
16
|
+
'v-tab-panel': VTabPanel,
|
|
17
17
|
},
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
const tabPanel = wrapper.find("[data-test='tab-panel']");
|
|
21
|
-
expect(tabPanel.text()).toEqual(
|
|
21
|
+
expect(tabPanel.text()).toEqual('John Duck');
|
|
22
22
|
});
|
|
23
23
|
});
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { mount } from
|
|
2
|
-
import { describe, expect, test } from
|
|
3
|
-
import { VTab, VTabPanel, VTabs } from
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
3
|
+
import { VTab, VTabPanel, VTabs } from '..';
|
|
4
4
|
|
|
5
|
-
describe(
|
|
6
|
-
test(
|
|
5
|
+
describe('VTabs', () => {
|
|
6
|
+
test('hide separator', () => {
|
|
7
7
|
const wrapper = mount({
|
|
8
8
|
template: /*html*/ `
|
|
9
9
|
<v-tabs hide-separator></v-tabs>
|
|
10
10
|
`,
|
|
11
11
|
components: {
|
|
12
|
-
|
|
12
|
+
'v-tabs': VTabs,
|
|
13
13
|
},
|
|
14
14
|
});
|
|
15
15
|
|
|
@@ -17,7 +17,7 @@ describe("VTabs", () => {
|
|
|
17
17
|
expect(separator.exists()).toBeFalsy();
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
test(
|
|
20
|
+
test('default props', () => {
|
|
21
21
|
const wrapper = mount({
|
|
22
22
|
template: /*html*/ `
|
|
23
23
|
<v-tabs>
|
|
@@ -28,33 +28,33 @@ describe("VTabs", () => {
|
|
|
28
28
|
</v-tabs>
|
|
29
29
|
`,
|
|
30
30
|
components: {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
'v-tabs': VTabs,
|
|
32
|
+
'v-tab': VTab,
|
|
33
|
+
'v-tab-panel': VTabPanel,
|
|
34
34
|
},
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
const tabList = wrapper.find("[data-test='vuetiful-tab-list']");
|
|
38
38
|
expect(tabList.classes()).toEqual([
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
'vuetiful-tab-list',
|
|
40
|
+
'flex',
|
|
41
|
+
'!rounded-bl-none',
|
|
42
|
+
'!rounded-br-none',
|
|
43
|
+
'rounded-container-token',
|
|
44
44
|
]);
|
|
45
|
-
expect(tabList.classes()).not.toContain(
|
|
45
|
+
expect(tabList.classes()).not.toContain('flex-col');
|
|
46
46
|
|
|
47
47
|
const tabPanels = wrapper.find("[data-test='vuetiful-tab-panels']");
|
|
48
48
|
expect(tabPanels.classes()).toEqual([
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
'vuetiful-tab-panels',
|
|
50
|
+
'p-4',
|
|
51
|
+
'!rounded-tl-none',
|
|
52
|
+
'!rounded-tr-none',
|
|
53
|
+
'rounded-container-token',
|
|
54
54
|
]);
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
-
test(
|
|
57
|
+
test('vertical', () => {
|
|
58
58
|
const wrapper = mount({
|
|
59
59
|
template: /*html*/ `
|
|
60
60
|
<v-tabs vertical>
|
|
@@ -65,28 +65,28 @@ describe("VTabs", () => {
|
|
|
65
65
|
</v-tabs>
|
|
66
66
|
`,
|
|
67
67
|
components: {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
'v-tabs': VTabs,
|
|
69
|
+
'v-tab': VTab,
|
|
70
|
+
'v-tab-panel': VTabPanel,
|
|
71
71
|
},
|
|
72
72
|
});
|
|
73
73
|
const tabList = wrapper.find("[data-test='vuetiful-tab-list']");
|
|
74
74
|
expect(tabList.classes()).toEqual([
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
'vuetiful-tab-list',
|
|
76
|
+
'flex',
|
|
77
|
+
'flex-col',
|
|
78
|
+
'!rounded-br-none',
|
|
79
|
+
'!rounded-tr-none',
|
|
80
|
+
'rounded-container-token',
|
|
81
81
|
]);
|
|
82
82
|
|
|
83
83
|
const tabPanels = wrapper.find("[data-test='vuetiful-tab-panels']");
|
|
84
84
|
expect(tabPanels.classes()).toEqual([
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
'vuetiful-tab-panels',
|
|
86
|
+
'p-4',
|
|
87
|
+
'!rounded-bl-none',
|
|
88
|
+
'!rounded-tl-none',
|
|
89
|
+
'rounded-container-token',
|
|
90
90
|
]);
|
|
91
91
|
});
|
|
92
92
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { unstyledProp } from
|
|
3
|
-
import { useSettings } from
|
|
4
|
-
import { TabGroup, TabList, TabPanels } from
|
|
5
|
-
import { provide } from
|
|
2
|
+
import { unstyledProp } from '@/props';
|
|
3
|
+
import { useSettings } from '@/services';
|
|
4
|
+
import { TabGroup, TabList, TabPanels } from '@headlessui/vue';
|
|
5
|
+
import { provide } from 'vue';
|
|
6
6
|
|
|
7
7
|
const props = defineProps({
|
|
8
8
|
hideSeparator: {
|
|
@@ -17,32 +17,32 @@ const props = defineProps({
|
|
|
17
17
|
|
|
18
18
|
active: {
|
|
19
19
|
type: String,
|
|
20
|
-
default:
|
|
20
|
+
default: '',
|
|
21
21
|
},
|
|
22
22
|
hover: {
|
|
23
23
|
type: String,
|
|
24
|
-
default:
|
|
24
|
+
default: 'hover:variant-ghost',
|
|
25
25
|
},
|
|
26
26
|
|
|
27
27
|
classPanels: {
|
|
28
28
|
type: String,
|
|
29
|
-
default:
|
|
29
|
+
default: '',
|
|
30
30
|
},
|
|
31
31
|
classTabs: {
|
|
32
32
|
type: String,
|
|
33
|
-
default:
|
|
33
|
+
default: '',
|
|
34
34
|
},
|
|
35
35
|
classTab: {
|
|
36
36
|
type: String,
|
|
37
|
-
default:
|
|
37
|
+
default: '',
|
|
38
38
|
},
|
|
39
39
|
classSeparator: {
|
|
40
40
|
type: String,
|
|
41
|
-
default:
|
|
41
|
+
default: 'border-surface-400-500-token',
|
|
42
42
|
},
|
|
43
43
|
classTabSeparator: {
|
|
44
44
|
type: String,
|
|
45
|
-
default:
|
|
45
|
+
default: 'border-surface-900-50-token',
|
|
46
46
|
},
|
|
47
47
|
|
|
48
48
|
defaultIndex: {
|
|
@@ -53,12 +53,12 @@ const props = defineProps({
|
|
|
53
53
|
unstyled: unstyledProp,
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
-
provide(
|
|
57
|
-
provide(
|
|
58
|
-
provide(
|
|
59
|
-
provide(
|
|
60
|
-
provide(
|
|
61
|
-
provide(
|
|
56
|
+
provide('active', props.active);
|
|
57
|
+
provide('hover', props.hover);
|
|
58
|
+
provide('vertical', props.vertical);
|
|
59
|
+
provide('classTab', props.classTab);
|
|
60
|
+
provide('hideSeparator', props.hideSeparator);
|
|
61
|
+
provide('classTabSeparator', props.classTabSeparator);
|
|
62
62
|
|
|
63
63
|
const { settings } = useSettings();
|
|
64
64
|
const isUnstyled = settings.global.unstyled || settings.components.tabs.unstyled || props.unstyled;
|
|
@@ -86,11 +86,7 @@ const isUnstyled = settings.global.unstyled || settings.components.tabs.unstyled
|
|
|
86
86
|
>
|
|
87
87
|
<slot name="tabs" />
|
|
88
88
|
</TabList>
|
|
89
|
-
<div
|
|
90
|
-
data-test="vuetiful-tab-separator"
|
|
91
|
-
v-if="!hideSeparator"
|
|
92
|
-
:class="`border ${classSeparator}`"
|
|
93
|
-
></div>
|
|
89
|
+
<div data-test="vuetiful-tab-separator" v-if="!hideSeparator" :class="`border ${classSeparator}`"></div>
|
|
94
90
|
<TabPanels
|
|
95
91
|
data-test="vuetiful-tab-panels"
|
|
96
92
|
:class="`vuetiful-tab-panels
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import VDrawer from
|
|
2
|
-
import VPreview from
|
|
3
|
-
import VRail from
|
|
4
|
-
import VRailTile from
|
|
5
|
-
import VShell from
|
|
1
|
+
import VDrawer from './VDrawer.vue';
|
|
2
|
+
import VPreview from './VPreview.vue';
|
|
3
|
+
import VRail from './VRail/VRail.vue';
|
|
4
|
+
import VRailTile from './VRail/VRailTile.vue';
|
|
5
|
+
import VShell from './VShell.vue';
|
|
6
6
|
|
|
7
|
-
import VListbox from
|
|
8
|
-
import VListboxButton from
|
|
9
|
-
import VListboxItem from
|
|
10
|
-
import VListboxItems from
|
|
11
|
-
import VListboxLabel from
|
|
7
|
+
import VListbox from './VListbox/VListbox.vue';
|
|
8
|
+
import VListboxButton from './VListbox/VListboxButton.vue';
|
|
9
|
+
import VListboxItem from './VListbox/VListboxItem.vue';
|
|
10
|
+
import VListboxItems from './VListbox/VListboxItems.vue';
|
|
11
|
+
import VListboxLabel from './VListbox/VListboxLabel.vue';
|
|
12
12
|
|
|
13
|
-
import VTab from
|
|
14
|
-
import VTabPanel from
|
|
15
|
-
import VTabs from
|
|
13
|
+
import VTab from './VTabs/VTab.vue';
|
|
14
|
+
import VTabPanel from './VTabs/VTabPanel.vue';
|
|
15
|
+
import VTabs from './VTabs/VTabs.vue';
|
|
16
16
|
|
|
17
|
-
import VAccordion from
|
|
18
|
-
import VAccordionItem from
|
|
17
|
+
import VAccordion from './VAccordion/VAccordion.vue';
|
|
18
|
+
import VAccordionItem from './VAccordion/VAccordionItem.vue';
|
|
19
19
|
|
|
20
|
-
import VAlert from
|
|
20
|
+
import VAlert from './VAlert.vue';
|
|
21
21
|
|
|
22
|
-
import VCard from
|
|
23
|
-
import VCardBody from
|
|
24
|
-
import VCardFooter from
|
|
25
|
-
import VCardHeader from
|
|
22
|
+
import VCard from './VCard/VCard.vue';
|
|
23
|
+
import VCardBody from './VCard/VCardBody.vue';
|
|
24
|
+
import VCardFooter from './VCard/VCardFooter.vue';
|
|
25
|
+
import VCardHeader from './VCard/VCardHeader.vue';
|
|
26
26
|
|
|
27
|
-
import VCodeBlock from
|
|
27
|
+
import VCodeBlock from './VCodeBlock.vue';
|
|
28
28
|
|
|
29
29
|
export {
|
|
30
30
|
VAccordion,
|