@code-coaching/vuetiful 0.23.1 → 0.24.0
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 +7 -3
- 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 +13 -13
- package/dist/types/services/drawer.service.d.ts +1 -1
- package/dist/types/services/index.d.ts +6 -6
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/utils/colors/colors.service.d.ts +69 -0
- package/dist/types/utils/index.d.ts +7 -3
- package/dist/types/utils/theme/theme-switcher.vue.d.ts +1 -1
- package/dist/types/utils/theme/theme.service.d.ts +9 -24
- package/dist/types/utils/theme/themes.d.ts +35 -0
- package/dist/vuetiful.es.mjs +456 -161
- package/dist/vuetiful.umd.js +71 -16
- 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 +63 -14
- package/src/components/atoms/VLightSwitch.vue +35 -46
- 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.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 +69 -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.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 +64 -194
- package/src/services/dark-mode.service.ts +35 -54
- 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 +6 -6
- 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/colors/colors.service.ts +293 -0
- package/src/utils/index.ts +7 -3
- 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 +11 -7
- package/src/utils/theme/remove.test.ts +11 -9
- package/src/utils/theme/theme-switcher.vue +43 -49
- package/src/utils/theme/theme.service.test.ts +194 -84
- package/src/utils/theme/theme.service.ts +141 -81
- package/src/utils/theme/themes.ts +122 -0
- package/dist/types/components/index.test.d.ts +0 -1
- package/dist/types/index.test.d.ts +0 -1
- package/dist/types/utils/index.test.d.ts +0 -1
- package/src/components/index.test.ts +0 -10
- package/src/index.test.ts +0 -26
- package/src/utils/index.test.ts +0 -11
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { mount } from
|
|
2
|
-
import { describe, expect, test } from
|
|
3
|
-
import { ref } from
|
|
4
|
-
import VListbox from
|
|
5
|
-
import VListboxItem from
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
3
|
+
import { ref } from 'vue';
|
|
4
|
+
import VListbox from './VListbox.vue';
|
|
5
|
+
import VListboxItem from './VListboxItem.vue';
|
|
6
6
|
|
|
7
|
-
describe(
|
|
8
|
-
test(
|
|
9
|
-
const listboxValue = ref(
|
|
7
|
+
describe('VListboxItem props', () => {
|
|
8
|
+
test('defaults', async () => {
|
|
9
|
+
const listboxValue = ref('John');
|
|
10
10
|
const wrapper = mount({
|
|
11
11
|
setup() {
|
|
12
12
|
return { listboxValue };
|
|
@@ -18,34 +18,34 @@ describe("VListboxItem props", () => {
|
|
|
18
18
|
</v-listbox>
|
|
19
19
|
`,
|
|
20
20
|
components: {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
'v-listbox': VListbox,
|
|
22
|
+
'v-listbox-item': VListboxItem,
|
|
23
23
|
},
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
const listbox = wrapper.find("[data-test='listbox']");
|
|
27
|
-
await listbox.find(
|
|
27
|
+
await listbox.find('button').trigger('click');
|
|
28
28
|
|
|
29
29
|
const listboxItems = listbox.findAll("[data-test='listbox-item']");
|
|
30
30
|
const selectedItem = listboxItems[0];
|
|
31
31
|
const normalItem = listboxItems[1];
|
|
32
32
|
expect(selectedItem.classes()).toEqual([
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
'vuetiful-listbox-item',
|
|
34
|
+
'px-4',
|
|
35
|
+
'py-1',
|
|
36
|
+
'text-base',
|
|
37
|
+
'rounded-token',
|
|
38
|
+
'variant-filled',
|
|
39
|
+
'cursor-pointer',
|
|
40
40
|
]);
|
|
41
41
|
expect(normalItem.classes()).toEqual([
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
'vuetiful-listbox-item',
|
|
43
|
+
'px-4',
|
|
44
|
+
'py-1',
|
|
45
|
+
'text-base',
|
|
46
|
+
'rounded-token',
|
|
47
|
+
'hover:variant-ghost',
|
|
48
|
+
'cursor-pointer',
|
|
49
49
|
]);
|
|
50
50
|
});
|
|
51
51
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { useSettings } from
|
|
3
|
-
import { ListboxOption } from
|
|
4
|
-
import { inject } from
|
|
2
|
+
import { useSettings } from '@/services';
|
|
3
|
+
import { ListboxOption } from '@headlessui/vue';
|
|
4
|
+
import { inject } from 'vue';
|
|
5
5
|
|
|
6
6
|
const props = defineProps({
|
|
7
7
|
value: {
|
|
@@ -15,13 +15,12 @@ const props = defineProps({
|
|
|
15
15
|
},
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
const activeClass = inject(
|
|
19
|
-
const hoverClass = inject(
|
|
20
|
-
const classItem = inject(
|
|
18
|
+
const activeClass = inject('active') as string;
|
|
19
|
+
const hoverClass = inject('hover') as string;
|
|
20
|
+
const classItem = inject('classItem') as string;
|
|
21
21
|
|
|
22
22
|
const { settings } = useSettings();
|
|
23
|
-
const isUnstyled =
|
|
24
|
-
settings.global.unstyled || settings.components.listboxItem.unstyled || props.unstyled;
|
|
23
|
+
const isUnstyled = settings.global.unstyled || settings.components.listboxItem.unstyled || props.unstyled;
|
|
25
24
|
</script>
|
|
26
25
|
|
|
27
26
|
<template>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { mount } from
|
|
2
|
-
import { expect, test } from
|
|
3
|
-
import VListbox from
|
|
4
|
-
import VListboxItem from
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import { expect, test } from 'vitest';
|
|
3
|
+
import VListbox from './VListbox.vue';
|
|
4
|
+
import VListboxItem from './VListboxItem.vue';
|
|
5
5
|
|
|
6
|
-
test(
|
|
6
|
+
test('VListboxItems defaults', async () => {
|
|
7
7
|
const wrapper = mount({
|
|
8
8
|
template: /*html*/ `
|
|
9
9
|
<v-listbox>
|
|
@@ -11,19 +11,19 @@ test("VListboxItems defaults", async () => {
|
|
|
11
11
|
</v-listbox>
|
|
12
12
|
`,
|
|
13
13
|
components: {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
'v-listbox': VListbox,
|
|
15
|
+
'v-listbox-item': VListboxItem,
|
|
16
16
|
},
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
const listbox = wrapper.find("[data-test='listbox']");
|
|
20
|
-
await listbox.find(
|
|
20
|
+
await listbox.find('button').trigger('click');
|
|
21
21
|
|
|
22
22
|
const listboxItems = listbox.find("[data-test='listbox-items']");
|
|
23
|
-
expect(listboxItems.classes()).toContain(
|
|
23
|
+
expect(listboxItems.classes()).toContain('flex-col');
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
test(
|
|
26
|
+
test('VListboxItems horizontal', async () => {
|
|
27
27
|
const wrapper = mount({
|
|
28
28
|
template: /*html*/ `
|
|
29
29
|
<v-listbox horizontal>
|
|
@@ -31,14 +31,14 @@ test("VListboxItems horizontal", async () => {
|
|
|
31
31
|
</v-listbox>
|
|
32
32
|
`,
|
|
33
33
|
components: {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
'v-listbox': VListbox,
|
|
35
|
+
'v-listbox-item': VListboxItem,
|
|
36
36
|
},
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
const listbox = wrapper.find("[data-test='listbox']");
|
|
40
|
-
await listbox.find(
|
|
40
|
+
await listbox.find('button').trigger('click');
|
|
41
41
|
|
|
42
42
|
const listboxItems = listbox.find("[data-test='listbox-items']");
|
|
43
|
-
expect(listboxItems.classes()).not.toContain(
|
|
43
|
+
expect(listboxItems.classes()).not.toContain('flex-col');
|
|
44
44
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { useSettings } from
|
|
3
|
-
import { ListboxOptions } from
|
|
4
|
-
import { inject } from
|
|
2
|
+
import { useSettings } from '@/index';
|
|
3
|
+
import { ListboxOptions } from '@headlessui/vue';
|
|
4
|
+
import { inject } from 'vue';
|
|
5
5
|
|
|
6
6
|
const props = defineProps({
|
|
7
7
|
as: {
|
|
8
8
|
type: String,
|
|
9
|
-
default:
|
|
9
|
+
default: 'ul',
|
|
10
10
|
},
|
|
11
11
|
static: {
|
|
12
12
|
type: Boolean,
|
|
@@ -19,10 +19,10 @@ const props = defineProps({
|
|
|
19
19
|
},
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
const background = inject(
|
|
23
|
-
const text = inject(
|
|
24
|
-
const horizontal = inject(
|
|
25
|
-
const classItems = inject(
|
|
22
|
+
const background = inject('background') as string;
|
|
23
|
+
const text = inject('text') as string;
|
|
24
|
+
const horizontal = inject('horizontal') as boolean;
|
|
25
|
+
const classItems = inject('classItems') as string;
|
|
26
26
|
|
|
27
27
|
const { settings } = useSettings();
|
|
28
28
|
const isUnstyled = settings.global.unstyled || settings.components.listbox.unstyled || props.unstyled;
|
|
@@ -33,9 +33,7 @@ const isUnstyled = settings.global.unstyled || settings.components.listbox.unsty
|
|
|
33
33
|
:as="as"
|
|
34
34
|
:static="static"
|
|
35
35
|
:class="`z-10 ${
|
|
36
|
-
isUnstyled
|
|
37
|
-
? ''
|
|
38
|
-
: `rounded-container-token' gap-1 p-4 border-token border-surface-400-500-token`
|
|
36
|
+
isUnstyled ? '' : `rounded-container-token' gap-1 p-4 border-token border-surface-400-500-token`
|
|
39
37
|
} ${background} ${text} ${horizontal ? 'flex' : 'flex-col'} ${classItems}`"
|
|
40
38
|
data-test="listbox-items"
|
|
41
39
|
>
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { mount } from
|
|
2
|
-
import { expect, test } from
|
|
3
|
-
import VListbox from
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import { expect, test } from 'vitest';
|
|
3
|
+
import VListbox from './VListbox.vue';
|
|
4
4
|
|
|
5
|
-
test(
|
|
5
|
+
test('VListboxLabel using slot', () => {
|
|
6
6
|
const wrapper = mount({
|
|
7
7
|
template: `
|
|
8
8
|
<v-listbox></v-listbox>
|
|
9
9
|
`,
|
|
10
10
|
components: {
|
|
11
|
-
|
|
11
|
+
'v-listbox': VListbox,
|
|
12
12
|
},
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
-
expect(wrapper.text()).toBe(
|
|
15
|
+
expect(wrapper.text()).toBe('Select an option');
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
test(
|
|
18
|
+
test('VListboxLabel custom label', () => {
|
|
19
19
|
const wrapper = mount({
|
|
20
20
|
template: `
|
|
21
21
|
<v-listbox text-label="John Duck"></v-listbox>
|
|
22
22
|
`,
|
|
23
23
|
components: {
|
|
24
|
-
|
|
24
|
+
'v-listbox': VListbox,
|
|
25
25
|
},
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
const label = wrapper.find(
|
|
29
|
-
expect(label.text()).toBe(
|
|
28
|
+
const label = wrapper.find('label');
|
|
29
|
+
expect(label.text()).toBe('John Duck');
|
|
30
30
|
});
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { mount } from
|
|
2
|
-
import { describe, expect, test } from
|
|
3
|
-
import { VPreview } from
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
3
|
+
import { VPreview } from '.';
|
|
4
4
|
|
|
5
|
-
test(
|
|
5
|
+
test('VPreview', () => {
|
|
6
6
|
expect(VPreview).toBeTruthy();
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
-
describe(
|
|
10
|
-
test(
|
|
9
|
+
describe('VPreview', () => {
|
|
10
|
+
test('defaults', () => {
|
|
11
11
|
const wrapper = mount(VPreview);
|
|
12
12
|
|
|
13
13
|
expect(wrapper.props()).toEqual({
|
|
14
|
-
background:
|
|
14
|
+
background: 'neutral',
|
|
15
15
|
hideSwatches: false,
|
|
16
|
-
regionFooter:
|
|
17
|
-
regionHeader:
|
|
18
|
-
regionPreview:
|
|
19
|
-
regionSource:
|
|
20
|
-
regionViewport:
|
|
16
|
+
regionFooter: '',
|
|
17
|
+
regionHeader: '',
|
|
18
|
+
regionPreview: '',
|
|
19
|
+
regionSource: '',
|
|
20
|
+
regionViewport: '',
|
|
21
21
|
hideMobileToggle: false,
|
|
22
22
|
});
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
describe(
|
|
26
|
-
test(
|
|
25
|
+
describe('given code radio item is selected', () => {
|
|
26
|
+
test('renders source code', async () => {
|
|
27
27
|
const wrapper = mount(VPreview, {
|
|
28
28
|
props: {
|
|
29
|
-
regionSource:
|
|
29
|
+
regionSource: 'source',
|
|
30
30
|
},
|
|
31
31
|
});
|
|
32
32
|
|
|
@@ -34,40 +34,40 @@ describe("VPreview", () => {
|
|
|
34
34
|
expect(wrapper.find("[data-test='previewer-preview']").exists()).toBe(true);
|
|
35
35
|
|
|
36
36
|
const radioItemCode = wrapper.find("[data-test='radio-item-code']");
|
|
37
|
-
await radioItemCode.trigger(
|
|
37
|
+
await radioItemCode.trigger('click');
|
|
38
38
|
|
|
39
39
|
expect(wrapper.find("[data-test='previewer-source']").exists()).toBe(true);
|
|
40
40
|
expect(wrapper.find("[data-test='previewer-preview']").exists()).toBe(false);
|
|
41
41
|
});
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
describe(
|
|
45
|
-
test(
|
|
44
|
+
describe('given the swatch button is clicked', () => {
|
|
45
|
+
test('renders swatches', async () => {
|
|
46
46
|
const wrapper = mount(VPreview);
|
|
47
47
|
|
|
48
48
|
expect(wrapper.find("[data-test='swatches']").exists()).toBe(false);
|
|
49
49
|
|
|
50
50
|
const swatchButton = wrapper.find("[data-test='swatch-button']");
|
|
51
|
-
await swatchButton.trigger(
|
|
51
|
+
await swatchButton.trigger('click');
|
|
52
52
|
|
|
53
53
|
expect(wrapper.find("[data-test='swatches']").exists()).toBe(true);
|
|
54
54
|
});
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
-
describe(
|
|
58
|
-
test(
|
|
57
|
+
describe('given the mobile toggle button is clicked', () => {
|
|
58
|
+
test('renders mobile preview', async () => {
|
|
59
59
|
const wrapper = mount(VPreview);
|
|
60
60
|
|
|
61
61
|
const before = wrapper.find("[data-test='previewer-preview']");
|
|
62
|
-
expect(before.classes()).not.toContain(
|
|
63
|
-
expect(before.classes()).toContain(
|
|
62
|
+
expect(before.classes()).not.toContain('mobile-screen');
|
|
63
|
+
expect(before.classes()).toContain('w-full');
|
|
64
64
|
|
|
65
65
|
const radioItemMobile = wrapper.find("[data-test='radio-item-mobile']");
|
|
66
|
-
await radioItemMobile.trigger(
|
|
66
|
+
await radioItemMobile.trigger('click');
|
|
67
67
|
|
|
68
68
|
const after = wrapper.find("[data-test='previewer-preview']");
|
|
69
|
-
expect(after.classes()).toContain(
|
|
70
|
-
expect(after.classes()).not.toContain(
|
|
69
|
+
expect(after.classes()).toContain('mobile-screen');
|
|
70
|
+
expect(after.classes()).not.toContain('w-full');
|
|
71
71
|
});
|
|
72
72
|
});
|
|
73
73
|
});
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { VButton, VRadioGroup, VRadioItem } from
|
|
3
|
-
import { ref } from
|
|
2
|
+
import { VButton, VRadioGroup, VRadioItem } from '@/index';
|
|
3
|
+
import { ref } from 'vue';
|
|
4
4
|
|
|
5
5
|
const backgrounds: Record<string, string> = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
neutral:
|
|
6
|
+
'bg-transparent': 'bg-transparent',
|
|
7
|
+
'neutral-opaque': 'bg-white/50 dark:bg-black/50',
|
|
8
|
+
neutral: 'bg-surface-100-800-token',
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
'variant-filled-surface': 'variant-filled-surface',
|
|
11
|
+
'variant-filled-primary': 'variant-filled-primary',
|
|
12
|
+
'variant-filled-secondary': 'variant-filled-secondary',
|
|
13
|
+
'variant-filled-tertiary': 'variant-filled-tertiary',
|
|
14
|
+
'variant-filled-success': 'variant-filled-success',
|
|
15
|
+
'variant-filled-warning': 'variant-filled-warning',
|
|
16
|
+
'variant-filled-error': 'variant-filled-error',
|
|
17
17
|
|
|
18
18
|
// TODO: implement gradient backgrounds
|
|
19
19
|
// 'primary-to-secondary': 'bg-gradient-to-br variant-gradient-primary-secondary',
|
|
@@ -41,35 +41,35 @@ const props = defineProps({
|
|
|
41
41
|
},
|
|
42
42
|
background: {
|
|
43
43
|
type: String,
|
|
44
|
-
default:
|
|
44
|
+
default: 'neutral',
|
|
45
45
|
},
|
|
46
46
|
|
|
47
47
|
// Props (regions)
|
|
48
48
|
regionHeader: {
|
|
49
49
|
type: String,
|
|
50
|
-
default:
|
|
50
|
+
default: '',
|
|
51
51
|
},
|
|
52
52
|
regionViewport: {
|
|
53
53
|
type: String,
|
|
54
|
-
default:
|
|
54
|
+
default: '',
|
|
55
55
|
},
|
|
56
56
|
regionPreview: {
|
|
57
57
|
type: String,
|
|
58
|
-
default:
|
|
58
|
+
default: '',
|
|
59
59
|
},
|
|
60
60
|
regionFooter: {
|
|
61
61
|
type: String,
|
|
62
|
-
default:
|
|
62
|
+
default: '',
|
|
63
63
|
},
|
|
64
64
|
regionSource: {
|
|
65
65
|
type: String,
|
|
66
|
-
default:
|
|
66
|
+
default: '',
|
|
67
67
|
},
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
const chosenBackground = ref(props.background);
|
|
71
|
-
const tabView = ref(
|
|
72
|
-
const radioSize = ref(
|
|
71
|
+
const tabView = ref('preview');
|
|
72
|
+
const radioSize = ref('full');
|
|
73
73
|
const swatches = ref(false);
|
|
74
74
|
|
|
75
75
|
const toggleSwatches = () => (swatches.value = !swatches.value);
|
|
@@ -193,9 +193,7 @@ const toggleSwatches = () => (swatches.value = !swatches.value);
|
|
|
193
193
|
</v-radio-group>
|
|
194
194
|
|
|
195
195
|
<template v-if="tabView === 'preview'">
|
|
196
|
-
<div
|
|
197
|
-
:class="`vuetiful-previewer-viewport p-4 md:p-10 ${backgrounds[chosenBackground]} ${regionViewport}`"
|
|
198
|
-
>
|
|
196
|
+
<div :class="`vuetiful-previewer-viewport p-4 md:p-10 ${backgrounds[chosenBackground]} ${regionViewport}`">
|
|
199
197
|
<!-- <div v-if="$slots.lead" class="vuetiful-previewer-lead"><slot name="lead" /></div> -->
|
|
200
198
|
<div
|
|
201
199
|
data-test="previewer-preview"
|
|
@@ -209,10 +207,7 @@ const toggleSwatches = () => (swatches.value = !swatches.value);
|
|
|
209
207
|
</div>
|
|
210
208
|
<!-- <div v-if="$slots.trail" class="vuetiful-previewer-trail"><slot name="trail" /></div> -->
|
|
211
209
|
</div>
|
|
212
|
-
<footer
|
|
213
|
-
v-if="$slots.footer"
|
|
214
|
-
:class="`vuetiful-previewer-footer variant-soft p-4 ${regionFooter}`"
|
|
215
|
-
>
|
|
210
|
+
<footer v-if="$slots.footer" :class="`vuetiful-previewer-footer variant-soft p-4 ${regionFooter}`">
|
|
216
211
|
<slot name="footer" />
|
|
217
212
|
</footer>
|
|
218
213
|
</template>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { VRail } from
|
|
2
|
-
import { mount } from
|
|
3
|
-
import { expect, test } from
|
|
1
|
+
import { VRail } from '@/index';
|
|
2
|
+
import { mount } from '@vue/test-utils';
|
|
3
|
+
import { expect, test } from 'vitest';
|
|
4
4
|
|
|
5
|
-
test(
|
|
5
|
+
test('VRail', () => {
|
|
6
6
|
expect(VRail).toBeTruthy();
|
|
7
7
|
});
|
|
8
8
|
|
|
9
9
|
// TODO: add tests
|
|
10
|
-
test(
|
|
10
|
+
test('VRail using slot', () => {
|
|
11
11
|
const wrapper = mount(VRail);
|
|
12
12
|
|
|
13
13
|
expect(wrapper).toBeTruthy();
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { CssClasses } from
|
|
3
|
-
import { VRadioGroup, useRail } from
|
|
4
|
-
import { provide } from
|
|
2
|
+
import type { CssClasses } from '@/index';
|
|
3
|
+
import { VRadioGroup, useRail } from '@/index';
|
|
4
|
+
import { provide } from 'vue';
|
|
5
5
|
|
|
6
6
|
const { selectedRailTile } = useRail();
|
|
7
7
|
|
|
8
8
|
const props = defineProps({
|
|
9
9
|
active: {
|
|
10
10
|
type: String as () => CssClasses,
|
|
11
|
-
default:
|
|
11
|
+
default: 'variant-filled',
|
|
12
12
|
},
|
|
13
13
|
hover: {
|
|
14
14
|
type: String as () => CssClasses,
|
|
15
|
-
default:
|
|
15
|
+
default: 'hover:variant-ghost hover:text-surface-900 dark:hover:text-surface-50',
|
|
16
16
|
},
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
provide(
|
|
20
|
-
provide(
|
|
19
|
+
provide('activeRail', props.active);
|
|
20
|
+
provide('hoverRail', props.hover);
|
|
21
21
|
</script>
|
|
22
22
|
|
|
23
23
|
<template>
|
|
@@ -1,37 +1,36 @@
|
|
|
1
|
-
import { mount } from
|
|
2
|
-
import { expect, test, describe } from
|
|
3
|
-
import { VRadioGroup, VRail, VRailTile, useRail } from
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import { expect, test, describe } from 'vitest';
|
|
3
|
+
import { VRadioGroup, VRail, VRailTile, useRail } from '@/index';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
describe("VRailTile", () => {
|
|
5
|
+
describe('VRailTile', () => {
|
|
7
6
|
// TODO: add tests
|
|
8
|
-
test(
|
|
7
|
+
test('default slot', () => {
|
|
9
8
|
const wrapper = mount({
|
|
10
9
|
provide: {
|
|
11
10
|
activeRail: null,
|
|
12
11
|
hoverRail: null,
|
|
13
12
|
},
|
|
14
|
-
template: /*html
|
|
13
|
+
template: /*html*/ `
|
|
15
14
|
<v-radio-group>
|
|
16
15
|
<v-rail-tile>John Duck</v-rail-tile>
|
|
17
16
|
</v-radio-group>
|
|
18
17
|
`,
|
|
19
18
|
components: {
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
'v-rail-tile': VRailTile,
|
|
20
|
+
'v-radio-group': VRadioGroup,
|
|
22
21
|
},
|
|
23
22
|
});
|
|
24
|
-
|
|
23
|
+
|
|
25
24
|
expect(wrapper).toBeTruthy();
|
|
26
25
|
});
|
|
27
26
|
|
|
28
|
-
test(
|
|
27
|
+
test('label prop', () => {
|
|
29
28
|
const wrapper = mount({
|
|
30
29
|
provide: {
|
|
31
30
|
activeRail: null,
|
|
32
31
|
hoverRail: null,
|
|
33
32
|
},
|
|
34
|
-
template: /*html
|
|
33
|
+
template: /*html*/ `
|
|
35
34
|
<v-radio-group>
|
|
36
35
|
<v-rail-tile label="John Duck label">
|
|
37
36
|
John Duck
|
|
@@ -39,44 +38,44 @@ describe("VRailTile", () => {
|
|
|
39
38
|
</v-radio-group>
|
|
40
39
|
`,
|
|
41
40
|
components: {
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
'v-rail-tile': VRailTile,
|
|
42
|
+
'v-radio-group': VRadioGroup,
|
|
44
43
|
},
|
|
45
44
|
});
|
|
46
45
|
|
|
47
46
|
const label = wrapper.find('.vuetiful-rail-tile-label');
|
|
48
47
|
expect(label.text()).toContain('John Duck label');
|
|
49
|
-
})
|
|
48
|
+
});
|
|
50
49
|
|
|
51
|
-
test(
|
|
50
|
+
test('no default slot', () => {
|
|
52
51
|
const wrapper = mount({
|
|
53
52
|
provide: {
|
|
54
53
|
activeRail: null,
|
|
55
54
|
hoverRail: null,
|
|
56
55
|
},
|
|
57
|
-
template: /*html
|
|
56
|
+
template: /*html*/ `
|
|
58
57
|
<v-radio-group>
|
|
59
58
|
<v-rail-tile label="John Duck label">
|
|
60
59
|
</v-rail-tile>
|
|
61
60
|
</v-radio-group>
|
|
62
61
|
`,
|
|
63
62
|
components: {
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
'v-rail-tile': VRailTile,
|
|
64
|
+
'v-radio-group': VRadioGroup,
|
|
66
65
|
},
|
|
67
66
|
});
|
|
68
67
|
|
|
69
68
|
const icon = wrapper.find('.vuetiful-rail-tile-icon');
|
|
70
69
|
expect(icon.exists()).toBeFalsy();
|
|
71
|
-
})
|
|
70
|
+
});
|
|
72
71
|
|
|
73
|
-
test(
|
|
72
|
+
test('selected rail tile', async () => {
|
|
74
73
|
const wrapper = mount({
|
|
75
74
|
provide: {
|
|
76
75
|
activeRail: 'fake-active-class',
|
|
77
76
|
hoverRail: null,
|
|
78
77
|
},
|
|
79
|
-
template: /*html
|
|
78
|
+
template: /*html*/ `
|
|
80
79
|
<v-rail data-test="rail">
|
|
81
80
|
<v-rail-tile data-test='rail-tile' label="John Duck label" value="John Duck">
|
|
82
81
|
John Duck
|
|
@@ -84,16 +83,15 @@ describe("VRailTile", () => {
|
|
|
84
83
|
</v-rail>
|
|
85
84
|
`,
|
|
86
85
|
components: {
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
'v-rail-tile': VRailTile,
|
|
87
|
+
'v-rail': VRail,
|
|
89
88
|
},
|
|
90
89
|
});
|
|
91
90
|
|
|
92
91
|
const { selectedRailTile } = useRail();
|
|
93
|
-
expect(selectedRailTile.value).toBe(
|
|
92
|
+
expect(selectedRailTile.value).toBe('');
|
|
94
93
|
const railTile = wrapper.find('.vuetiful-rail-tile');
|
|
95
94
|
await railTile.trigger('click');
|
|
96
95
|
expect(selectedRailTile.value).toBe('John Duck');
|
|
97
|
-
})
|
|
98
|
-
})
|
|
99
|
-
|
|
96
|
+
});
|
|
97
|
+
});
|