@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.
Files changed (144) hide show
  1. package/dist/style.css +1 -1
  2. package/dist/types/components/VBootstrap.vue.d.ts +1 -1
  3. package/dist/types/components/atoms/VAvatar.vue.d.ts +1 -1
  4. package/dist/types/components/atoms/VLightSwitch.vue.d.ts +2 -2
  5. package/dist/types/components/atoms/index.d.ts +13 -13
  6. package/dist/types/components/index.d.ts +2 -2
  7. package/dist/types/components/molecules/VAlert.vue.d.ts +1 -1
  8. package/dist/types/components/molecules/VCodeBlock.vue.d.ts +2 -2
  9. package/dist/types/components/molecules/VDrawer.vue.d.ts +1 -1
  10. package/dist/types/components/molecules/VListbox/VListbox.vue.d.ts +1 -1
  11. package/dist/types/components/molecules/VRail/VRail.vue.d.ts +1 -1
  12. package/dist/types/components/molecules/VRail/VRailTile.vue.d.ts +1 -1
  13. package/dist/types/components/molecules/index.d.ts +21 -21
  14. package/dist/types/directives/clipboard.d.ts +1 -1
  15. package/dist/types/directives/index.d.ts +1 -1
  16. package/dist/types/index.d.ts +6 -6
  17. package/dist/types/props/props.d.ts +1 -1
  18. package/dist/types/services/dark-mode.service.d.ts +1 -1
  19. package/dist/types/services/drawer.service.d.ts +1 -1
  20. package/dist/types/services/index.d.ts +5 -5
  21. package/dist/types/types/index.d.ts +1 -1
  22. package/dist/types/utils/index.d.ts +2 -2
  23. package/dist/types/utils/theme/theme-switcher.vue.d.ts +23 -63
  24. package/dist/types/utils/theme/theme.service.d.ts +1 -1
  25. package/dist/vuetiful.es.mjs +82 -150
  26. package/dist/vuetiful.umd.js +7 -15
  27. package/package.json +1 -1
  28. package/src/assets/main.css +6 -6
  29. package/src/components/VBootstrap.vue +43 -43
  30. package/src/components/atoms/VAvatar.test.ts +71 -71
  31. package/src/components/atoms/VAvatar.vue +22 -23
  32. package/src/components/atoms/VBadge.test.ts +11 -11
  33. package/src/components/atoms/VBadge.vue +2 -2
  34. package/src/components/atoms/VButton.test.ts +82 -82
  35. package/src/components/atoms/VButton.vue +20 -21
  36. package/src/components/atoms/VChip.test.ts +11 -11
  37. package/src/components/atoms/VChip.vue +3 -3
  38. package/src/components/atoms/VLightSwitch.test.ts +6 -6
  39. package/src/components/atoms/VLightSwitch.vue +26 -31
  40. package/src/components/atoms/VRadio/VRadioDescription.test.ts +13 -13
  41. package/src/components/atoms/VRadio/VRadioDescription.vue +2 -2
  42. package/src/components/atoms/VRadio/VRadioGroup.test.ts +40 -40
  43. package/src/components/atoms/VRadio/VRadioGroup.vue +19 -22
  44. package/src/components/atoms/VRadio/VRadioItem.test.ts +67 -67
  45. package/src/components/atoms/VRadio/VRadioItem.vue +10 -13
  46. package/src/components/atoms/VRadio/VRadioLabel.test.ts +13 -13
  47. package/src/components/atoms/VRadio/VRadioLabel.vue +5 -3
  48. package/src/components/atoms/VSwitch/VSwitch.test.ts +33 -33
  49. package/src/components/atoms/VSwitch/VSwitch.vue +24 -27
  50. package/src/components/atoms/VSwitch/VSwitchDescription.test.ts +13 -13
  51. package/src/components/atoms/VSwitch/VSwitchDescription.vue +2 -2
  52. package/src/components/atoms/VSwitch/VSwitchGroup.test.ts +9 -9
  53. package/src/components/atoms/VSwitch/VSwitchGroup.vue +2 -2
  54. package/src/components/atoms/VSwitch/VSwitchLabel.test.ts +19 -19
  55. package/src/components/atoms/VSwitch/VSwitchLabel.vue +2 -2
  56. package/src/components/atoms/index.ts +13 -13
  57. package/src/components/index.test.ts +3 -3
  58. package/src/components/index.ts +2 -2
  59. package/src/components/molecules/VAccordion/VAccordion.test.ts +11 -17
  60. package/src/components/molecules/VAccordion/VAccordion.vue +3 -3
  61. package/src/components/molecules/VAccordion/VAccordionItem.test.ts +55 -55
  62. package/src/components/molecules/VAccordion/VAccordionItem.vue +9 -22
  63. package/src/components/molecules/VAlert.test.ts +38 -38
  64. package/src/components/molecules/VAlert.vue +25 -47
  65. package/src/components/molecules/VCard/VCard.test.ts +25 -25
  66. package/src/components/molecules/VCard/VCard.vue +13 -15
  67. package/src/components/molecules/VCard/VCardBody.test.ts +14 -14
  68. package/src/components/molecules/VCard/VCardBody.vue +4 -8
  69. package/src/components/molecules/VCard/VCardFooter.test.ts +22 -22
  70. package/src/components/molecules/VCard/VCardFooter.vue +10 -8
  71. package/src/components/molecules/VCard/VCardHeader.test.ts +25 -25
  72. package/src/components/molecules/VCard/VCardHeader.vue +7 -8
  73. package/src/components/molecules/VCodeBlock.test.ts +63 -63
  74. package/src/components/molecules/VCodeBlock.vue +27 -34
  75. package/src/components/molecules/VDrawer.test.ts +5 -5
  76. package/src/components/molecules/VDrawer.vue +10 -10
  77. package/src/components/molecules/VListbox/VListbox.test.ts +53 -53
  78. package/src/components/molecules/VListbox/VListbox.vue +31 -32
  79. package/src/components/molecules/VListbox/VListboxButton.test.ts +13 -13
  80. package/src/components/molecules/VListbox/VListboxButton.vue +5 -5
  81. package/src/components/molecules/VListbox/VListboxItem.test.ts +25 -25
  82. package/src/components/molecules/VListbox/VListboxItem.vue +7 -8
  83. package/src/components/molecules/VListbox/VListboxItems.test.ts +14 -14
  84. package/src/components/molecules/VListbox/VListboxItems.vue +9 -11
  85. package/src/components/molecules/VListbox/VListboxLabel.test.ts +10 -10
  86. package/src/components/molecules/VListbox/VListboxLabel.vue +2 -2
  87. package/src/components/molecules/VPreview.test.ts +26 -26
  88. package/src/components/molecules/VPreview.vue +22 -27
  89. package/src/components/molecules/VRail/VRail.test.ts +5 -5
  90. package/src/components/molecules/VRail/VRail.vue +7 -7
  91. package/src/components/molecules/VRail/VRailTile.test.ts +26 -28
  92. package/src/components/molecules/VRail/VRailTile.vue +13 -11
  93. package/src/components/molecules/VShell.test.ts +5 -5
  94. package/src/components/molecules/VShell.vue +11 -20
  95. package/src/components/molecules/VTabs/VTab.test.ts +48 -52
  96. package/src/components/molecules/VTabs/VTab.vue +13 -17
  97. package/src/components/molecules/VTabs/VTabPanel.test.ts +8 -8
  98. package/src/components/molecules/VTabs/VTabPanel.vue +1 -1
  99. package/src/components/molecules/VTabs/VTabs.test.ts +36 -36
  100. package/src/components/molecules/VTabs/VTabs.vue +18 -22
  101. package/src/components/molecules/index.ts +21 -21
  102. package/src/directives/clipboard.test.ts +9 -9
  103. package/src/directives/clipboard.ts +2 -2
  104. package/src/directives/index.ts +1 -1
  105. package/src/env.d.ts +2 -2
  106. package/src/index.test.ts +6 -6
  107. package/src/index.ts +7 -7
  108. package/src/props/index.ts +1 -1
  109. package/src/props/props.ts +44 -44
  110. package/src/services/dark-mode.service.test.ts +115 -93
  111. package/src/services/dark-mode.service.ts +9 -9
  112. package/src/services/drawer.service.test.ts +21 -21
  113. package/src/services/drawer.service.ts +10 -10
  114. package/src/services/highlight.service.test.ts +12 -12
  115. package/src/services/highlight.service.ts +1 -1
  116. package/src/services/index.ts +5 -5
  117. package/src/services/rail.service.test.ts +7 -7
  118. package/src/services/rail.service.ts +2 -2
  119. package/src/services/settings.service.test.ts +5 -5
  120. package/src/services/settings.service.ts +1 -1
  121. package/src/styles/all.css +7 -7
  122. package/src/styles/elements/buttons.css +1 -1
  123. package/src/styles/elements/forms.css +7 -7
  124. package/src/styles/elements.css +13 -13
  125. package/src/styles/transitions.css +2 -2
  126. package/src/styles/typography.css +5 -5
  127. package/src/themes/theme-rocket.css +10 -10
  128. package/src/themes/theme-sahara.css +13 -13
  129. package/src/themes/theme-seafoam.css +13 -13
  130. package/src/themes/theme-seasonal.css +4 -4
  131. package/src/themes/theme-skeleton.css +7 -7
  132. package/src/themes/theme-vintage.css +12 -12
  133. package/src/themes/theme-vuetiful-0.0.1.css +13 -13
  134. package/src/types/index.ts +46 -46
  135. package/src/types/tailwind.ts +2 -21
  136. package/src/utils/index.test.ts +3 -3
  137. package/src/utils/index.ts +2 -2
  138. package/src/utils/platform/platform.service.test.ts +6 -6
  139. package/src/utils/platform/platform.service.ts +1 -1
  140. package/src/utils/theme/callback.test.ts +6 -6
  141. package/src/utils/theme/remove.test.ts +8 -8
  142. package/src/utils/theme/theme-switcher.vue +58 -131
  143. package/src/utils/theme/theme.service.test.ts +69 -61
  144. package/src/utils/theme/theme.service.ts +19 -20
@@ -1,179 +1,179 @@
1
- import { mount } from "@vue/test-utils";
2
- import { describe, expect, test, vi } from "vitest";
3
- import { VButton } from ".";
1
+ import { mount } from '@vue/test-utils';
2
+ import { describe, expect, test, vi } from 'vitest';
3
+ import { VButton } from '.';
4
4
 
5
- test("VButton", () => {
5
+ test('VButton', () => {
6
6
  expect(VButton).toBeTruthy();
7
7
  });
8
8
 
9
- test("VButton using slot", () => {
9
+ test('VButton using slot', () => {
10
10
  const wrapper = mount(VButton, {
11
11
  slots: {
12
- default: "John Duck",
12
+ default: 'John Duck',
13
13
  },
14
14
  });
15
15
 
16
- expect(wrapper.text()).toContain("John Duck");
16
+ expect(wrapper.text()).toContain('John Duck');
17
17
  });
18
18
 
19
- describe("VButton props", () => {
20
- describe("size", () => {
21
- test("xs", () => {
19
+ describe('VButton props', () => {
20
+ describe('size', () => {
21
+ test('xs', () => {
22
22
  const wrapper = mount(VButton, {
23
23
  props: {
24
- size: "xs",
24
+ size: 'xs',
25
25
  },
26
26
  });
27
- expect(wrapper.classes()).toContain("px-2.5");
28
- expect(wrapper.classes()).toContain("py-1.5");
29
- expect(wrapper.classes()).toContain("text-xs");
27
+ expect(wrapper.classes()).toContain('px-2.5');
28
+ expect(wrapper.classes()).toContain('py-1.5');
29
+ expect(wrapper.classes()).toContain('text-xs');
30
30
  });
31
31
 
32
- test("sm", () => {
32
+ test('sm', () => {
33
33
  const wrapper = mount(VButton, {
34
34
  props: {
35
- size: "sm",
35
+ size: 'sm',
36
36
  },
37
37
  });
38
- expect(wrapper.classes()).toContain("px-3");
39
- expect(wrapper.classes()).toContain("py-2");
40
- expect(wrapper.classes()).toContain("text-sm");
41
- expect(wrapper.classes()).toContain("leading-4");
38
+ expect(wrapper.classes()).toContain('px-3');
39
+ expect(wrapper.classes()).toContain('py-2');
40
+ expect(wrapper.classes()).toContain('text-sm');
41
+ expect(wrapper.classes()).toContain('leading-4');
42
42
  });
43
43
 
44
- test("md", () => {
44
+ test('md', () => {
45
45
  const wrapper = mount(VButton, {
46
46
  props: {
47
- size: "md",
47
+ size: 'md',
48
48
  },
49
49
  });
50
- expect(wrapper.classes()).toContain("px-4");
51
- expect(wrapper.classes()).toContain("py-2");
52
- expect(wrapper.classes()).toContain("text-sm");
50
+ expect(wrapper.classes()).toContain('px-4');
51
+ expect(wrapper.classes()).toContain('py-2');
52
+ expect(wrapper.classes()).toContain('text-sm');
53
53
  });
54
54
 
55
- test("lg", () => {
55
+ test('lg', () => {
56
56
  const wrapper = mount(VButton, {
57
57
  props: {
58
- size: "lg",
58
+ size: 'lg',
59
59
  },
60
60
  });
61
- expect(wrapper.classes()).toContain("px-4");
62
- expect(wrapper.classes()).toContain("py-2");
63
- expect(wrapper.classes()).toContain("text-base");
61
+ expect(wrapper.classes()).toContain('px-4');
62
+ expect(wrapper.classes()).toContain('py-2');
63
+ expect(wrapper.classes()).toContain('text-base');
64
64
  });
65
65
 
66
- test("xl", () => {
66
+ test('xl', () => {
67
67
  const wrapper = mount(VButton, {
68
68
  props: {
69
- size: "xl",
69
+ size: 'xl',
70
70
  },
71
71
  });
72
- expect(wrapper.classes()).toContain("px-6");
73
- expect(wrapper.classes()).toContain("py-3");
74
- expect(wrapper.classes()).toContain("text-base");
72
+ expect(wrapper.classes()).toContain('px-6');
73
+ expect(wrapper.classes()).toContain('py-3');
74
+ expect(wrapper.classes()).toContain('text-base');
75
75
  });
76
76
  });
77
77
 
78
- describe("given icon is true", () => {
79
- test("should have btn-icon class, not have btn class", () => {
78
+ describe('given icon is true', () => {
79
+ test('should have btn-icon class, not have btn class', () => {
80
80
  const wrapper = mount(VButton, {
81
81
  props: {
82
82
  icon: true,
83
83
  },
84
84
  });
85
- expect(wrapper.classes()).toContain("btn-icon");
86
- expect(wrapper.classes()).not.toContain("btn");
85
+ expect(wrapper.classes()).toContain('btn-icon');
86
+ expect(wrapper.classes()).not.toContain('btn');
87
87
  });
88
88
  });
89
- describe("given icon is false", () => {
90
- test("should have btn class, not have btn-icon class", () => {
89
+ describe('given icon is false', () => {
90
+ test('should have btn class, not have btn-icon class', () => {
91
91
  const wrapper = mount(VButton, {
92
92
  props: {
93
93
  icon: false,
94
94
  },
95
95
  });
96
- expect(wrapper.classes()).not.toContain("btn-icon");
97
- expect(wrapper.classes()).toContain("btn");
96
+ expect(wrapper.classes()).not.toContain('btn-icon');
97
+ expect(wrapper.classes()).toContain('btn');
98
98
  });
99
99
  });
100
100
  });
101
101
 
102
- describe("VButton events", () => {
103
- describe("given click event", () => {
104
- test("should preventDefault and emit click event", async () => {
102
+ describe('VButton events', () => {
103
+ describe('given click event', () => {
104
+ test('should preventDefault and emit click event', async () => {
105
105
  const wrapper = mount(VButton);
106
106
  const clickEvent = { preventDefault: () => {} };
107
- const preventDefaultSpy = vi.spyOn(clickEvent, "preventDefault");
108
- wrapper.trigger("click", clickEvent);
107
+ const preventDefaultSpy = vi.spyOn(clickEvent, 'preventDefault');
108
+ wrapper.trigger('click', clickEvent);
109
109
  await wrapper.vm.$nextTick();
110
110
  expect(preventDefaultSpy).toHaveBeenCalled();
111
- expect(wrapper.emitted("click")).toBeTruthy();
111
+ expect(wrapper.emitted('click')).toBeTruthy();
112
112
  });
113
113
  });
114
114
  });
115
115
 
116
- describe("VButton a11y", () => {
117
- describe("a11y role", () => {
118
- test("should have role button", () => {
116
+ describe('VButton a11y', () => {
117
+ describe('a11y role', () => {
118
+ test('should have role button', () => {
119
119
  const wrapper = mount(VButton);
120
- expect(wrapper.attributes("role")).toBe("button");
120
+ expect(wrapper.attributes('role')).toBe('button');
121
121
  });
122
122
  });
123
- describe("a11y tabindex", () => {
124
- test("should have tabindex 0", () => {
123
+ describe('a11y tabindex', () => {
124
+ test('should have tabindex 0', () => {
125
125
  const wrapper = mount(VButton);
126
- expect(wrapper.attributes("tabindex")).toBe("0");
126
+ expect(wrapper.attributes('tabindex')).toBe('0');
127
127
  });
128
128
  });
129
- describe("given keydown event", () => {
130
- describe("given key is Enter", () => {
131
- test("should preventDefault and emit click event", async () => {
129
+ describe('given keydown event', () => {
130
+ describe('given key is Enter', () => {
131
+ test('should preventDefault and emit click event', async () => {
132
132
  const wrapper = mount(VButton);
133
- const keydownEvent = { key: "Enter", preventDefault: () => {} };
134
- const preventDefaultSpy = vi.spyOn(keydownEvent, "preventDefault");
135
- wrapper.trigger("keydown", keydownEvent);
133
+ const keydownEvent = { key: 'Enter', preventDefault: () => {} };
134
+ const preventDefaultSpy = vi.spyOn(keydownEvent, 'preventDefault');
135
+ wrapper.trigger('keydown', keydownEvent);
136
136
  await wrapper.vm.$nextTick();
137
137
  expect(preventDefaultSpy).toHaveBeenCalled();
138
- expect(wrapper.emitted("click")).toBeTruthy();
138
+ expect(wrapper.emitted('click')).toBeTruthy();
139
139
  });
140
140
  });
141
141
 
142
- describe("given key is Space", () => {
143
- test("should preventDefault and not emit click event", async () => {
142
+ describe('given key is Space', () => {
143
+ test('should preventDefault and not emit click event', async () => {
144
144
  const wrapper = mount(VButton);
145
- const keydownEvent = { key: " ", preventDefault: () => {} };
146
- const preventDefaultSpy = vi.spyOn(keydownEvent, "preventDefault");
147
- wrapper.trigger("keydown", keydownEvent);
145
+ const keydownEvent = { key: ' ', preventDefault: () => {} };
146
+ const preventDefaultSpy = vi.spyOn(keydownEvent, 'preventDefault');
147
+ wrapper.trigger('keydown', keydownEvent);
148
148
  await wrapper.vm.$nextTick();
149
149
  expect(preventDefaultSpy).toHaveBeenCalled();
150
- expect(wrapper.emitted("click")).toBeFalsy();
150
+ expect(wrapper.emitted('click')).toBeFalsy();
151
151
  });
152
152
  });
153
153
 
154
- describe("given key is not Enter or Space", () => {
155
- test("should not preventDefault and not emit click event", async () => {
154
+ describe('given key is not Enter or Space', () => {
155
+ test('should not preventDefault and not emit click event', async () => {
156
156
  const wrapper = mount(VButton);
157
- const keydownEvent = { key: "a", preventDefault: () => {} };
158
- const preventDefaultSpy = vi.spyOn(keydownEvent, "preventDefault");
159
- wrapper.trigger("keydown", keydownEvent);
157
+ const keydownEvent = { key: 'a', preventDefault: () => {} };
158
+ const preventDefaultSpy = vi.spyOn(keydownEvent, 'preventDefault');
159
+ wrapper.trigger('keydown', keydownEvent);
160
160
  await wrapper.vm.$nextTick();
161
161
  expect(preventDefaultSpy).not.toHaveBeenCalled();
162
- expect(wrapper.emitted("click")).toBeFalsy();
162
+ expect(wrapper.emitted('click')).toBeFalsy();
163
163
  });
164
164
  });
165
165
  });
166
166
 
167
- describe("given keyup event", () => {
168
- describe("given key is Space", () => {
169
- test("should preventDefault and emit click event", async () => {
167
+ describe('given keyup event', () => {
168
+ describe('given key is Space', () => {
169
+ test('should preventDefault and emit click event', async () => {
170
170
  const wrapper = mount(VButton);
171
- const keyupEvent = { key: " ", preventDefault: () => {} };
172
- const preventDefaultSpy = vi.spyOn(keyupEvent, "preventDefault");
173
- wrapper.trigger("keyup", keyupEvent);
171
+ const keyupEvent = { key: ' ', preventDefault: () => {} };
172
+ const preventDefaultSpy = vi.spyOn(keyupEvent, 'preventDefault');
173
+ wrapper.trigger('keyup', keyupEvent);
174
174
  await wrapper.vm.$nextTick();
175
175
  expect(preventDefaultSpy).toHaveBeenCalled();
176
- expect(wrapper.emitted("click")).toBeTruthy();
176
+ expect(wrapper.emitted('click')).toBeTruthy();
177
177
  });
178
178
  });
179
179
  });
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
- import { sizeProp, unstyledProp, variantProp } from "@/props";
3
- import { useSettings } from "@/services";
4
- import { computed } from "vue";
2
+ import { sizeProp, unstyledProp, variantProp } from '@/props';
3
+ import { useSettings } from '@/services';
4
+ import { computed } from 'vue';
5
5
 
6
6
  const props = defineProps({
7
7
  icon: {
@@ -10,17 +10,17 @@ const props = defineProps({
10
10
  },
11
11
  tag: {
12
12
  type: String as () => string,
13
- default: "button",
13
+ default: 'button',
14
14
  },
15
15
 
16
16
  size: sizeProp,
17
17
  variant: variantProp,
18
18
  unstyled: unstyledProp,
19
19
  });
20
- const emit = defineEmits<{ (event: "click"): void }>();
20
+ const emit = defineEmits<{ (event: 'click'): void }>();
21
21
 
22
22
  const activate = () => {
23
- emit("click");
23
+ emit('click');
24
24
  };
25
25
 
26
26
  const clickHandler = (event: MouseEvent) => {
@@ -29,12 +29,12 @@ const clickHandler = (event: MouseEvent) => {
29
29
  };
30
30
 
31
31
  const keydownHandler = (event: KeyboardEvent) => {
32
- if (["Enter", " "].includes(event.key)) event.preventDefault();
33
- if (event.key === "Enter") activate();
32
+ if (['Enter', ' '].includes(event.key)) event.preventDefault();
33
+ if (event.key === 'Enter') activate();
34
34
  };
35
35
 
36
36
  const keyupHandler = (event: KeyboardEvent) => {
37
- if (event.key === " ") {
37
+ if (event.key === ' ') {
38
38
  event.preventDefault();
39
39
  activate();
40
40
  }
@@ -42,22 +42,21 @@ const keyupHandler = (event: KeyboardEvent) => {
42
42
 
43
43
  const btnSize = computed(() => {
44
44
  switch (props.size) {
45
- case "xs":
46
- return "px-2.5 py-1.5 text-xs";
47
- case "sm":
48
- return "px-3 py-2 text-sm leading-4";
49
- case "md":
50
- return "px-4 py-2 text-sm";
51
- case "lg":
52
- return "px-4 py-2 text-base";
53
- case "xl":
54
- return "px-6 py-3 text-base";
45
+ case 'xs':
46
+ return 'px-2.5 py-1.5 text-xs';
47
+ case 'sm':
48
+ return 'px-3 py-2 text-sm leading-4';
49
+ case 'md':
50
+ return 'px-4 py-2 text-sm';
51
+ case 'lg':
52
+ return 'px-4 py-2 text-base';
53
+ case 'xl':
54
+ return 'px-6 py-3 text-base';
55
55
  }
56
56
  });
57
57
 
58
58
  const { settings } = useSettings();
59
- const isUnstyled =
60
- settings.global.unstyled || settings.components.button.unstyled || props.unstyled;
59
+ const isUnstyled = settings.global.unstyled || settings.components.button.unstyled || props.unstyled;
61
60
  </script>
62
61
 
63
62
  <template>
@@ -1,33 +1,33 @@
1
- import { mount } from "@vue/test-utils";
2
- import { describe, expect, test } from "vitest";
3
- import { VChip } from ".";
1
+ import { mount } from '@vue/test-utils';
2
+ import { describe, expect, test } from 'vitest';
3
+ import { VChip } from '.';
4
4
 
5
- describe("VChip", () => {
6
- test("default slot", () => {
5
+ describe('VChip', () => {
6
+ test('default slot', () => {
7
7
  const wrapper = mount({
8
8
  template: `<v-chip>John Duck</v-chip>`,
9
9
  components: { VChip },
10
10
  });
11
11
 
12
- expect(wrapper.text()).toContain("John Duck");
13
- expect(wrapper.classes()).toContain("chip");
12
+ expect(wrapper.text()).toContain('John Duck');
13
+ expect(wrapper.classes()).toContain('chip');
14
14
  });
15
15
 
16
- test("unstyled", () => {
16
+ test('unstyled', () => {
17
17
  const wrapper = mount({
18
18
  template: `<v-chip unstyled>John Duck</v-chip>`,
19
19
  components: { VChip },
20
20
  });
21
21
 
22
- expect(wrapper.classes()).not.toContain("chip");
22
+ expect(wrapper.classes()).not.toContain('chip');
23
23
  });
24
24
 
25
- test("variant", () => {
25
+ test('variant', () => {
26
26
  const wrapper = mount({
27
27
  template: `<v-chip variant="primary">John Duck</v-chip>`,
28
28
  components: { VChip },
29
29
  });
30
30
 
31
- expect(wrapper.classes()).toContain("variant-primary");
31
+ expect(wrapper.classes()).toContain('variant-primary');
32
32
  });
33
33
  });
@@ -1,9 +1,9 @@
1
1
  <script setup lang="ts">
2
- import { unstyledProp, variantProp } from "@/props";
3
- import { useSettings } from "@/services";
2
+ import { unstyledProp, variantProp } from '@/props';
3
+ import { useSettings } from '@/services';
4
4
 
5
5
  const props = defineProps({
6
- unstyled: unstyledProp,
6
+ unstyled: unstyledProp,
7
7
  variant: variantProp,
8
8
  });
9
9
 
@@ -1,18 +1,18 @@
1
- import { mount } from "@vue/test-utils";
2
- import { expect, test, vi } from "vitest";
3
- import { VLightSwitch } from ".";
4
- import { useDarkMode } from "@/services";
1
+ import { mount } from '@vue/test-utils';
2
+ import { expect, test, vi } from 'vitest';
3
+ import { VLightSwitch } from '.';
4
+ import { useDarkMode } from '@/services';
5
5
 
6
6
  const { MODE } = useDarkMode();
7
7
 
8
8
  const matchMediaMock = (matches: boolean) => vi.fn(() => ({ matches, onchange: vi.fn() }));
9
9
 
10
- test("VLightSwitch", () => {
10
+ test('VLightSwitch', () => {
11
11
  expect(VLightSwitch).toBeTruthy();
12
12
  });
13
13
 
14
14
  // TODO: add tests
15
- test("VLightSwitch using slot", () => {
15
+ test('VLightSwitch using slot', () => {
16
16
  window.matchMedia = matchMediaMock(MODE.LIGHT) as any;
17
17
  const wrapper = mount(VLightSwitch);
18
18
 
@@ -24,42 +24,42 @@
24
24
  </template>
25
25
 
26
26
  <script lang="ts">
27
- import { CssClasses, useDarkMode } from "@/index";
28
- import { computed, ComputedRef, defineComponent, onMounted } from "vue";
27
+ import { CssClasses, useDarkMode } from '@/index';
28
+ import { computed, ComputedRef, defineComponent, onMounted } from 'vue';
29
29
 
30
30
  export default defineComponent({
31
31
  props: {
32
32
  bgLight: {
33
33
  type: String as () => CssClasses,
34
- default: "bg-surface-50",
34
+ default: 'bg-surface-50',
35
35
  },
36
36
  bgDark: {
37
37
  type: String as () => CssClasses,
38
- default: "bg-surface-900",
38
+ default: 'bg-surface-900',
39
39
  },
40
40
  textLight: {
41
41
  type: String as () => CssClasses,
42
- default: "text-surface-50",
42
+ default: 'text-surface-50',
43
43
  },
44
44
  textDark: {
45
45
  type: String as () => CssClasses,
46
- default: "text-surface-900",
46
+ default: 'text-surface-900',
47
47
  },
48
48
  width: {
49
49
  type: String as () => CssClasses,
50
- default: "w-12",
50
+ default: 'w-12',
51
51
  },
52
52
  height: {
53
53
  type: String as () => CssClasses,
54
- default: "h-6",
54
+ default: 'h-6',
55
55
  },
56
56
  ring: {
57
57
  type: String as () => CssClasses,
58
- default: "ring-[1px] ring-surface-500/30",
58
+ default: 'ring-[1px] ring-surface-500/30',
59
59
  },
60
60
  rounded: {
61
61
  type: String as () => CssClasses,
62
- default: "rounded-token",
62
+ default: 'rounded-token',
63
63
  },
64
64
  },
65
65
  setup(props, { attrs }) {
@@ -70,13 +70,13 @@ export default defineComponent({
70
70
  });
71
71
 
72
72
  const cTransition = `transition-all duration-[200ms]`;
73
- const cTrack = "cursor-pointer";
74
- const cThumb = "aspect-square scale-[0.8] flex justify-center items-center";
75
- const cIcon = "w-[70%] aspect-square";
73
+ const cTrack = 'cursor-pointer';
74
+ const cThumb = 'aspect-square scale-[0.8] flex justify-center items-center';
75
+ const cIcon = 'w-[70%] aspect-square';
76
76
 
77
77
  const svgPath = {
78
- sun: "M361.5 1.2c5 2.1 8.6 6.6 9.6 11.9L391 121l107.9 19.8c5.3 1 9.8 4.6 11.9 9.6s1.5 10.7-1.6 15.2L446.9 256l62.3 90.3c3.1 4.5 3.7 10.2 1.6 15.2s-6.6 8.6-11.9 9.6L391 391 371.1 498.9c-1 5.3-4.6 9.8-9.6 11.9s-10.7 1.5-15.2-1.6L256 446.9l-90.3 62.3c-4.5 3.1-10.2 3.7-15.2 1.6s-8.6-6.6-9.6-11.9L121 391 13.1 371.1c-5.3-1-9.8-4.6-11.9-9.6s-1.5-10.7 1.6-15.2L65.1 256 2.8 165.7c-3.1-4.5-3.7-10.2-1.6-15.2s6.6-8.6 11.9-9.6L121 121 140.9 13.1c1-5.3 4.6-9.8 9.6-11.9s10.7-1.5 15.2 1.6L256 65.1 346.3 2.8c4.5-3.1 10.2-3.7 15.2-1.6zM352 256c0 53-43 96-96 96s-96-43-96-96s43-96 96-96s96 43 96 96zm32 0c0-70.7-57.3-128-128-128s-128 57.3-128 128s57.3 128 128 128s128-57.3 128-128z",
79
- moon: "M223.5 32C100 32 0 132.3 0 256S100 480 223.5 480c60.6 0 115.5-24.2 155.8-63.4c5-4.9 6.3-12.5 3.1-18.7s-10.1-9.7-17-8.5c-9.8 1.7-19.8 2.6-30.1 2.6c-96.9 0-175.5-78.8-175.5-176c0-65.8 36-123.1 89.3-153.3c6.1-3.5 9.2-10.5 7.7-17.3s-7.3-11.9-14.3-12.5c-6.3-.5-12.6-.8-19-.8z",
78
+ sun: 'M361.5 1.2c5 2.1 8.6 6.6 9.6 11.9L391 121l107.9 19.8c5.3 1 9.8 4.6 11.9 9.6s1.5 10.7-1.6 15.2L446.9 256l62.3 90.3c3.1 4.5 3.7 10.2 1.6 15.2s-6.6 8.6-11.9 9.6L391 391 371.1 498.9c-1 5.3-4.6 9.8-9.6 11.9s-10.7 1.5-15.2-1.6L256 446.9l-90.3 62.3c-4.5 3.1-10.2 3.7-15.2 1.6s-8.6-6.6-9.6-11.9L121 391 13.1 371.1c-5.3-1-9.8-4.6-11.9-9.6s-1.5-10.7 1.6-15.2L65.1 256 2.8 165.7c-3.1-4.5-3.7-10.2-1.6-15.2s6.6-8.6 11.9-9.6L121 121 140.9 13.1c1-5.3 4.6-9.8 9.6-11.9s10.7-1.5 15.2 1.6L256 65.1 346.3 2.8c4.5-3.1 10.2-3.7 15.2-1.6zM352 256c0 53-43 96-96 96s-96-43-96-96s43-96 96-96s96 43 96 96zm32 0c0-70.7-57.3-128-128-128s-128 57.3-128 128s57.3 128 128 128s128-57.3 128-128z',
79
+ moon: 'M223.5 32C100 32 0 132.3 0 256S100 480 223.5 480c60.6 0 115.5-24.2 155.8-63.4c5-4.9 6.3-12.5 3.1-18.7s-10.1-9.7-17-8.5c-9.8 1.7-19.8 2.6-30.1 2.6c-96.9 0-175.5-78.8-175.5-176c0-65.8 36-123.1 89.3-153.3c6.1-3.5 9.2-10.5 7.7-17.3s-7.3-11.9-14.3-12.5c-6.3-.5-12.6-.8-19-.8z',
80
80
  };
81
81
 
82
82
  const onToggleHandler = () => {
@@ -85,35 +85,30 @@ export default defineComponent({
85
85
  setModeCurrent(toggle);
86
86
  };
87
87
 
88
- type OnKeyDownEvent = KeyboardEvent & { currentTarget: EventTarget & HTMLDivElement };
88
+ type OnKeyDownEvent = KeyboardEvent & {
89
+ currentTarget: EventTarget & HTMLDivElement;
90
+ };
89
91
  const onKeyDown = (event: KeyboardEvent) => {
90
- if (["Enter", "Space"].includes(event.code)) {
92
+ if (['Enter', 'Space'].includes(event.code)) {
91
93
  event.preventDefault();
92
94
  (event as OnKeyDownEvent).currentTarget.click();
93
95
  }
94
96
  };
95
97
 
96
- const trackBg = computed(() =>
97
- currentMode.value === MODE.LIGHT ? props.bgLight : props.bgDark
98
- );
99
- const thumbBg = computed(() =>
100
- currentMode.value === MODE.LIGHT ? props.bgDark : props.bgLight
101
- );
102
- const thumbPosition = computed(() =>
103
- currentMode.value === MODE.LIGHT ? "translate-x-[100%]" : ""
104
- );
98
+ const trackBg = computed(() => (currentMode.value === MODE.LIGHT ? props.bgLight : props.bgDark));
99
+ const thumbBg = computed(() => (currentMode.value === MODE.LIGHT ? props.bgDark : props.bgLight));
100
+ const thumbPosition = computed(() => (currentMode.value === MODE.LIGHT ? 'translate-x-[100%]' : ''));
105
101
  const iconFill = computed(() => {
106
102
  return currentMode.value === MODE.LIGHT ? props.textLight : props.textDark;
107
103
  });
108
104
 
109
105
  const classesTrack: ComputedRef<string> = computed(() => {
110
- return `${cTrack} ${cTransition} ${props.width} ${props.height} ${props.ring} ${
111
- props.rounded
112
- } ${trackBg.value} ${attrs.class ?? ""}`;
106
+ return `${cTrack} ${cTransition} ${props.width} ${props.height} ${props.ring} ${props.rounded} ${trackBg.value} ${
107
+ attrs.class ?? ''
108
+ }`;
113
109
  });
114
110
  const classesThumb: ComputedRef<string> = computed(
115
- () =>
116
- `${cThumb} ${cTransition} ${props.height} ${props.rounded} ${thumbBg.value} ${thumbPosition.value}`
111
+ () => `${cThumb} ${cTransition} ${props.height} ${props.rounded} ${thumbBg.value} ${thumbPosition.value}`,
117
112
  );
118
113
  const classesIcon: ComputedRef<string> = computed(() => `${cIcon}`);
119
114
 
@@ -1,9 +1,9 @@
1
- import { mount } from "@vue/test-utils";
2
- import { describe, expect, test } from "vitest";
3
- import VRadioGroup from "./VRadioGroup.vue";
4
- import VRadioDescription from "./VRadioDescription.vue";
1
+ import { mount } from '@vue/test-utils';
2
+ import { describe, expect, test } from 'vitest';
3
+ import VRadioGroup from './VRadioGroup.vue';
4
+ import VRadioDescription from './VRadioDescription.vue';
5
5
 
6
- test("VRadioDescription using slot", () => {
6
+ test('VRadioDescription using slot', () => {
7
7
  const wrapper = mount({
8
8
  template: `
9
9
  <v-radio-group>
@@ -11,15 +11,15 @@ test("VRadioDescription using slot", () => {
11
11
  </v-radio-group>
12
12
  `,
13
13
  components: {
14
- "v-radio-description": VRadioDescription,
15
- "v-radio-group": VRadioGroup,
14
+ 'v-radio-description': VRadioDescription,
15
+ 'v-radio-group': VRadioGroup,
16
16
  },
17
17
  });
18
18
 
19
- expect(wrapper.text()).toContain("John Duck");
19
+ expect(wrapper.text()).toContain('John Duck');
20
20
  });
21
21
 
22
- describe("VRadioDescription props", () => {
22
+ describe('VRadioDescription props', () => {
23
23
  test("default 'as' prop", () => {
24
24
  const wrapper = mount({
25
25
  template: `
@@ -28,8 +28,8 @@ describe("VRadioDescription props", () => {
28
28
  </v-radio-group>
29
29
  `,
30
30
  components: {
31
- "v-radio-label": VRadioDescription,
32
- "v-radio-group": VRadioGroup,
31
+ 'v-radio-label': VRadioDescription,
32
+ 'v-radio-group': VRadioGroup,
33
33
  },
34
34
  });
35
35
 
@@ -44,8 +44,8 @@ describe("VRadioDescription props", () => {
44
44
  </v-radio-group>
45
45
  `,
46
46
  components: {
47
- "v-radio-label": VRadioDescription,
48
- "v-radio-group": VRadioGroup,
47
+ 'v-radio-label': VRadioDescription,
48
+ 'v-radio-group': VRadioGroup,
49
49
  },
50
50
  });
51
51
 
@@ -1,10 +1,10 @@
1
1
  <script setup lang="ts">
2
- import { RadioGroupDescription } from "@headlessui/vue";
2
+ import { RadioGroupDescription } from '@headlessui/vue';
3
3
 
4
4
  defineProps({
5
5
  as: {
6
6
  type: String,
7
- default: "p",
7
+ default: 'p',
8
8
  },
9
9
  });
10
10
  </script>