@code-coaching/vuetiful 0.25.0 → 0.27.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.
Files changed (257) hide show
  1. package/README.md +47 -55
  2. package/dist/css/animations.css +2 -0
  3. package/{src → dist}/css/overrides/quasar.css +73 -58
  4. package/{src/styles → dist/css}/transitions/slide.css +6 -0
  5. package/dist/favicon.ico +0 -0
  6. package/dist/types/components/atoms/VAvatar.vue.d.ts +39 -90
  7. package/dist/types/components/atoms/VBadge.vue.d.ts +34 -21
  8. package/dist/types/components/atoms/VButton.vue.d.ts +42 -48
  9. package/dist/types/components/atoms/VChip.vue.d.ts +33 -21
  10. package/dist/types/components/atoms/VLightSwitch.vue.d.ts +5 -5
  11. package/dist/types/components/atoms/VRadio/VRadioDescription.vue.d.ts +7 -12
  12. package/dist/types/components/atoms/VRadio/VRadioGroup.vue.d.ts +53 -83
  13. package/dist/types/components/atoms/VRadio/VRadioItem.vue.d.ts +46 -12
  14. package/dist/types/components/atoms/VRadio/VRadioLabel.vue.d.ts +7 -12
  15. package/dist/types/components/atoms/VSwitch/VSwitch.vue.d.ts +51 -72
  16. package/dist/types/components/atoms/VSwitch/VSwitchDescription.vue.d.ts +32 -11
  17. package/dist/types/components/atoms/VSwitch/VSwitchGroup.vue.d.ts +32 -11
  18. package/dist/types/components/atoms/VSwitch/VSwitchLabel.vue.d.ts +33 -20
  19. package/dist/types/components/molecules/VAccordion/VAccordion.vue.d.ts +39 -28
  20. package/dist/types/components/molecules/VAccordion/VAccordionItem.vue.d.ts +35 -19
  21. package/dist/types/components/molecules/VAlert.vue.d.ts +50 -73
  22. package/dist/types/components/molecules/VCard/VCard.vue.d.ts +37 -48
  23. package/dist/types/components/molecules/VCard/VCardBody.vue.d.ts +33 -12
  24. package/dist/types/components/molecules/VCard/VCardFooter.vue.d.ts +36 -20
  25. package/dist/types/components/molecules/VCard/VCardHeader.vue.d.ts +36 -20
  26. package/dist/types/components/molecules/VCodeBlock.vue.d.ts +15 -16
  27. package/dist/types/components/molecules/VDrawer.vue.d.ts +13 -7
  28. package/dist/types/components/molecules/VListbox/VListbox.vue.d.ts +54 -132
  29. package/dist/types/components/molecules/VListbox/VListboxButton.vue.d.ts +22 -21
  30. package/dist/types/components/molecules/VListbox/VListboxItem.vue.d.ts +22 -19
  31. package/dist/types/components/molecules/VListbox/VListboxItems.vue.d.ts +19 -30
  32. package/dist/types/components/molecules/VListbox/VListboxLabel.vue.d.ts +7 -12
  33. package/dist/types/components/molecules/VPreview.vue.d.ts +57 -74
  34. package/dist/types/components/molecules/VRail/VRail.vue.d.ts +28 -13
  35. package/dist/types/components/molecules/VRail/VRailTile.vue.d.ts +49 -16
  36. package/dist/types/components/molecules/VShell.vue.d.ts +76 -44
  37. package/dist/types/components/molecules/VShellConfigurator.vue.d.ts +99 -0
  38. package/dist/types/components/molecules/VTabs/VTab.vue.d.ts +52 -20
  39. package/dist/types/components/molecules/VTabs/VTabPanel.vue.d.ts +8 -1
  40. package/dist/types/components/molecules/VTabs/VTabs.vue.d.ts +43 -101
  41. package/dist/types/components/molecules/Vuetiful.vue.d.ts +22 -0
  42. package/dist/types/components/molecules/index.d.ts +3 -4
  43. package/dist/types/directives/click-outside-group.d.ts +9 -0
  44. package/dist/types/directives/click-outside.d.ts +9 -0
  45. package/dist/types/directives/clipboard.d.ts +1 -1
  46. package/dist/types/directives/index.d.ts +3 -1
  47. package/dist/types/index.d.ts +1 -8
  48. package/dist/types/props/props.d.ts +1 -14
  49. package/dist/types/services/dark-mode.service.d.ts +1 -1
  50. package/dist/types/services/drawer.service.d.ts +3 -3
  51. package/dist/types/services/index.d.ts +2 -2
  52. package/dist/types/utils/id-generator.d.ts +1 -0
  53. package/dist/types/utils/index.d.ts +3 -4
  54. package/dist/types/utils/tailwind-merge.d.ts +1 -0
  55. package/dist/types/utils/theme/rocket.theme.d.ts +223 -0
  56. package/dist/types/utils/theme/theme-switcher.vue.d.ts +14 -5
  57. package/dist/types/utils/theme/theme.service.d.ts +6 -9
  58. package/dist/types/utils/theme/themes.d.ts +3 -39
  59. package/dist/types/utils/theme/vuetiful.theme.d.ts +224 -0
  60. package/dist/vuetiful.es.mjs +54837 -49494
  61. package/dist/vuetiful.umd.cjs +189 -0
  62. package/package.json +53 -37
  63. package/dist/style.css +0 -10
  64. package/dist/types/components/VBootstrap.vue.d.ts +0 -15
  65. package/dist/types/components/atoms/VAvatar.test.d.ts +0 -1
  66. package/dist/types/components/atoms/VBadge.test.d.ts +0 -1
  67. package/dist/types/components/atoms/VButton.test.d.ts +0 -1
  68. package/dist/types/components/atoms/VChip.test.d.ts +0 -1
  69. package/dist/types/components/atoms/VLightSwitch.test.d.ts +0 -1
  70. package/dist/types/components/atoms/VRadio/VRadioDescription.test.d.ts +0 -1
  71. package/dist/types/components/atoms/VRadio/VRadioGroup.test.d.ts +0 -1
  72. package/dist/types/components/atoms/VRadio/VRadioItem.test.d.ts +0 -1
  73. package/dist/types/components/atoms/VRadio/VRadioLabel.test.d.ts +0 -1
  74. package/dist/types/components/atoms/VSwitch/VSwitch.test.d.ts +0 -1
  75. package/dist/types/components/atoms/VSwitch/VSwitchDescription.test.d.ts +0 -1
  76. package/dist/types/components/atoms/VSwitch/VSwitchGroup.test.d.ts +0 -1
  77. package/dist/types/components/atoms/VSwitch/VSwitchLabel.test.d.ts +0 -1
  78. package/dist/types/components/molecules/VAccordion/VAccordion.test.d.ts +0 -1
  79. package/dist/types/components/molecules/VAccordion/VAccordionItem.test.d.ts +0 -1
  80. package/dist/types/components/molecules/VAlert.test.d.ts +0 -1
  81. package/dist/types/components/molecules/VCard/VCard.test.d.ts +0 -1
  82. package/dist/types/components/molecules/VCard/VCardBody.test.d.ts +0 -1
  83. package/dist/types/components/molecules/VCard/VCardFooter.test.d.ts +0 -1
  84. package/dist/types/components/molecules/VCard/VCardHeader.test.d.ts +0 -1
  85. package/dist/types/components/molecules/VCodeBlock.test.d.ts +0 -1
  86. package/dist/types/components/molecules/VDrawer.test.d.ts +0 -1
  87. package/dist/types/components/molecules/VListbox/VListbox.test.d.ts +0 -1
  88. package/dist/types/components/molecules/VListbox/VListboxButton.test.d.ts +0 -1
  89. package/dist/types/components/molecules/VListbox/VListboxItem.test.d.ts +0 -1
  90. package/dist/types/components/molecules/VListbox/VListboxItems.test.d.ts +0 -1
  91. package/dist/types/components/molecules/VListbox/VListboxLabel.test.d.ts +0 -1
  92. package/dist/types/components/molecules/VPreview.test.d.ts +0 -1
  93. package/dist/types/components/molecules/VRail/VRail.test.d.ts +0 -1
  94. package/dist/types/components/molecules/VRail/VRailTile.test.d.ts +0 -1
  95. package/dist/types/components/molecules/VShell.test.d.ts +0 -1
  96. package/dist/types/components/molecules/VTabs/VTab.test.d.ts +0 -1
  97. package/dist/types/components/molecules/VTabs/VTabPanel.test.d.ts +0 -1
  98. package/dist/types/components/molecules/VTabs/VTabs.test.d.ts +0 -1
  99. package/dist/types/directives/clipboard.test.d.ts +0 -1
  100. package/dist/types/services/dark-mode.service.test.d.ts +0 -1
  101. package/dist/types/services/drawer.service.test.d.ts +0 -1
  102. package/dist/types/services/highlight.service.test.d.ts +0 -1
  103. package/dist/types/services/rail.service.test.d.ts +0 -1
  104. package/dist/types/services/settings.service.test.d.ts +0 -1
  105. package/dist/types/types/index.d.ts +0 -54
  106. package/dist/types/types/tailwind.d.ts +0 -4
  107. package/dist/types/utils/colors/colors.service.d.ts +0 -69
  108. package/dist/types/utils/platform/platform.service.test.d.ts +0 -1
  109. package/dist/types/utils/theme/callback.test.d.ts +0 -1
  110. package/dist/types/utils/theme/remove.test.d.ts +0 -1
  111. package/dist/types/utils/theme/theme.service.test.d.ts +0 -1
  112. package/dist/vuetiful.umd.js +0 -99
  113. package/src/assets/fonts/myfont.woff +0 -0
  114. package/src/assets/main.css +0 -17
  115. package/src/components/VBootstrap.vue +0 -62
  116. package/src/components/atoms/VAvatar.test.ts +0 -175
  117. package/src/components/atoms/VAvatar.vue +0 -89
  118. package/src/components/atoms/VBadge.test.ts +0 -28
  119. package/src/components/atoms/VBadge.vue +0 -17
  120. package/src/components/atoms/VButton.test.ts +0 -180
  121. package/src/components/atoms/VButton.vue +0 -76
  122. package/src/components/atoms/VChip.test.ts +0 -33
  123. package/src/components/atoms/VChip.vue +0 -17
  124. package/src/components/atoms/VLightSwitch.test.ts +0 -69
  125. package/src/components/atoms/VLightSwitch.vue +0 -121
  126. package/src/components/atoms/VRadio/VRadioDescription.test.ts +0 -55
  127. package/src/components/atoms/VRadio/VRadioDescription.vue +0 -14
  128. package/src/components/atoms/VRadio/VRadioGroup.test.ts +0 -81
  129. package/src/components/atoms/VRadio/VRadioGroup.vue +0 -88
  130. package/src/components/atoms/VRadio/VRadioItem.test.ts +0 -183
  131. package/src/components/atoms/VRadio/VRadioItem.vue +0 -36
  132. package/src/components/atoms/VRadio/VRadioLabel.test.ts +0 -55
  133. package/src/components/atoms/VRadio/VRadioLabel.vue +0 -16
  134. package/src/components/atoms/VSwitch/VSwitch.test.ts +0 -100
  135. package/src/components/atoms/VSwitch/VSwitch.vue +0 -106
  136. package/src/components/atoms/VSwitch/VSwitchDescription.test.ts +0 -55
  137. package/src/components/atoms/VSwitch/VSwitchDescription.vue +0 -16
  138. package/src/components/atoms/VSwitch/VSwitchGroup.test.ts +0 -26
  139. package/src/components/atoms/VSwitch/VSwitchGroup.vue +0 -16
  140. package/src/components/atoms/VSwitch/VSwitchLabel.test.ts +0 -89
  141. package/src/components/atoms/VSwitch/VSwitchLabel.vue +0 -20
  142. package/src/components/atoms/index.ts +0 -31
  143. package/src/components/index.ts +0 -2
  144. package/src/components/molecules/VAccordion/VAccordion.test.ts +0 -27
  145. package/src/components/molecules/VAccordion/VAccordion.vue +0 -32
  146. package/src/components/molecules/VAccordion/VAccordionItem.test.ts +0 -134
  147. package/src/components/molecules/VAccordion/VAccordionItem.vue +0 -68
  148. package/src/components/molecules/VAlert.test.ts +0 -100
  149. package/src/components/molecules/VAlert.vue +0 -137
  150. package/src/components/molecules/VCard/VCard.test.ts +0 -47
  151. package/src/components/molecules/VCard/VCard.vue +0 -74
  152. package/src/components/molecules/VCard/VCardBody.test.ts +0 -39
  153. package/src/components/molecules/VCard/VCardBody.vue +0 -16
  154. package/src/components/molecules/VCard/VCardFooter.test.ts +0 -63
  155. package/src/components/molecules/VCard/VCardFooter.vue +0 -31
  156. package/src/components/molecules/VCard/VCardHeader.test.ts +0 -86
  157. package/src/components/molecules/VCard/VCardHeader.vue +0 -53
  158. package/src/components/molecules/VCodeBlock.test.ts +0 -133
  159. package/src/components/molecules/VCodeBlock.vue +0 -113
  160. package/src/components/molecules/VDrawer.test.ts +0 -14
  161. package/src/components/molecules/VDrawer.vue +0 -87
  162. package/src/components/molecules/VListbox/VListbox.test.ts +0 -146
  163. package/src/components/molecules/VListbox/VListbox.vue +0 -149
  164. package/src/components/molecules/VListbox/VListboxButton.test.ts +0 -66
  165. package/src/components/molecules/VListbox/VListboxButton.vue +0 -57
  166. package/src/components/molecules/VListbox/VListboxItem.test.ts +0 -51
  167. package/src/components/molecules/VListbox/VListboxItem.vue +0 -39
  168. package/src/components/molecules/VListbox/VListboxItems.test.ts +0 -44
  169. package/src/components/molecules/VListbox/VListboxItems.vue +0 -42
  170. package/src/components/molecules/VListbox/VListboxLabel.test.ts +0 -30
  171. package/src/components/molecules/VListbox/VListboxLabel.vue +0 -14
  172. package/src/components/molecules/VPreview.test.ts +0 -73
  173. package/src/components/molecules/VPreview.vue +0 -230
  174. package/src/components/molecules/VRail/VRail.test.ts +0 -14
  175. package/src/components/molecules/VRail/VRail.vue +0 -33
  176. package/src/components/molecules/VRail/VRailTile.test.ts +0 -97
  177. package/src/components/molecules/VRail/VRailTile.vue +0 -49
  178. package/src/components/molecules/VShell.test.ts +0 -14
  179. package/src/components/molecules/VShell.vue +0 -63
  180. package/src/components/molecules/VTabs/VTab.test.ts +0 -143
  181. package/src/components/molecules/VTabs/VTab.vue +0 -50
  182. package/src/components/molecules/VTabs/VTabPanel.test.ts +0 -24
  183. package/src/components/molecules/VTabs/VTabPanel.vue +0 -9
  184. package/src/components/molecules/VTabs/VTabs.test.ts +0 -92
  185. package/src/components/molecules/VTabs/VTabs.vue +0 -104
  186. package/src/components/molecules/index.ts +0 -51
  187. package/src/directives/clipboard.test.ts +0 -26
  188. package/src/directives/clipboard.ts +0 -9
  189. package/src/directives/index.ts +0 -3
  190. package/src/env.d.ts +0 -8
  191. package/src/index.ts +0 -21
  192. package/src/props/index.ts +0 -1
  193. package/src/props/props.ts +0 -62
  194. package/src/services/dark-mode.service.test.ts +0 -104
  195. package/src/services/dark-mode.service.ts +0 -75
  196. package/src/services/drawer.service.test.ts +0 -45
  197. package/src/services/drawer.service.ts +0 -46
  198. package/src/services/highlight.service.test.ts +0 -24
  199. package/src/services/highlight.service.ts +0 -19
  200. package/src/services/index.ts +0 -8
  201. package/src/services/rail.service.test.ts +0 -13
  202. package/src/services/rail.service.ts +0 -11
  203. package/src/services/settings.service.test.ts +0 -17
  204. package/src/services/settings.service.ts +0 -136
  205. package/src/styles/all.css +0 -24
  206. package/src/styles/core.css +0 -66
  207. package/src/styles/elements/alerts.css +0 -17
  208. package/src/styles/elements/badges.css +0 -31
  209. package/src/styles/elements/breadcrumbs.css +0 -26
  210. package/src/styles/elements/buttons.css +0 -103
  211. package/src/styles/elements/cards.css +0 -32
  212. package/src/styles/elements/chips.css +0 -22
  213. package/src/styles/elements/forms.css +0 -269
  214. package/src/styles/elements/lists.css +0 -48
  215. package/src/styles/elements/logo-clouds.css +0 -29
  216. package/src/styles/elements/modals.css +0 -15
  217. package/src/styles/elements/placeholders.css +0 -17
  218. package/src/styles/elements/popups.css +0 -16
  219. package/src/styles/elements/tables.css +0 -102
  220. package/src/styles/elements.css +0 -19
  221. package/src/styles/highlight-js.css +0 -116
  222. package/src/styles/tailwind.css +0 -16
  223. package/src/styles/transitions.css +0 -2
  224. package/src/styles/typography.css +0 -101
  225. package/src/styles/variants.css +0 -156
  226. package/src/tailwind/core.cjs +0 -37
  227. package/src/tailwind/generated/intellisense-classes.cjs +0 -558
  228. package/src/tailwind/intellisense.cjs +0 -21
  229. package/src/tailwind/settings.cjs +0 -20
  230. package/src/tailwind/theme/colors.cjs +0 -20
  231. package/src/tailwind/tokens/backgrounds.cjs +0 -48
  232. package/src/tailwind/tokens/border-radius.cjs +0 -21
  233. package/src/tailwind/tokens/borders.cjs +0 -24
  234. package/src/tailwind/tokens/fills.cjs +0 -20
  235. package/src/tailwind/tokens/rings.cjs +0 -50
  236. package/src/tailwind/tokens/text.cjs +0 -35
  237. package/src/tailwind/vuetiful.cjs +0 -19
  238. package/src/themes/theme-rocket.css +0 -119
  239. package/src/themes/theme-sahara.css +0 -128
  240. package/src/themes/theme-seafoam.css +0 -120
  241. package/src/themes/theme-seasonal.css +0 -115
  242. package/src/themes/theme-skeleton.css +0 -115
  243. package/src/themes/theme-vintage.css +0 -125
  244. package/src/themes/theme-vuetiful.css +0 -136
  245. package/src/types/index.ts +0 -59
  246. package/src/types/tailwind.ts +0 -7
  247. package/src/utils/colors/colors.service.ts +0 -293
  248. package/src/utils/index.ts +0 -8
  249. package/src/utils/platform/platform.service.test.ts +0 -19
  250. package/src/utils/platform/platform.service.ts +0 -8
  251. package/src/utils/theme/callback.test.ts +0 -28
  252. package/src/utils/theme/remove.test.ts +0 -27
  253. package/src/utils/theme/theme-switcher.vue +0 -74
  254. package/src/utils/theme/theme.service.test.ts +0 -269
  255. package/src/utils/theme/theme.service.ts +0 -173
  256. package/src/utils/theme/themes.ts +0 -282
  257. /package/{src/styles → dist/css}/transitions/fade.css +0 -0
@@ -1,31 +0,0 @@
1
- <script setup lang="ts">
2
- import { inject, useAttrs } from 'vue';
3
- import { unstyledProp } from '@/props';
4
- import { useSettings } from '@/services';
5
-
6
- const props = defineProps({
7
- classSeparator: {
8
- type: String as () => string,
9
- default: 'opacity-90',
10
- },
11
- unstyled: unstyledProp,
12
- });
13
-
14
- const hideSeparator = inject('hideSeparator', false);
15
-
16
- const attrs = useAttrs();
17
- const classAttribute = attrs.class as string;
18
-
19
- const { settings } = useSettings();
20
- const isUnstyled = settings.global.unstyled || settings.components.cardBody.unstyled || props.unstyled;
21
- </script>
22
-
23
- <template>
24
- <hr v-if="!hideSeparator" data-test="vuetiful-card-footer-separator" class="divider" :class="classSeparator" />
25
- <div
26
- data-test="vuetiful-card-footer-content"
27
- :class="`vuetiful-card-footer ${isUnstyled ? '' : 'p-4'} ${classAttribute}`"
28
- >
29
- <slot />
30
- </div>
31
- </template>
@@ -1,86 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { describe, expect, test } from 'vitest';
3
- import { VCard, VCardHeader } from '..';
4
-
5
- describe('VCardHeader', () => {
6
- test('unstyled', () => {
7
- const wrapper = mount({
8
- template: /*html*/ `
9
- <v-card>
10
- <v-card-header unstyled>John Duck</v-card-header>
11
- </v-card>
12
- `,
13
- components: {
14
- 'v-card': VCard,
15
- 'v-card-header': VCardHeader,
16
- },
17
- });
18
-
19
- const content = wrapper.find("[data-test='vuetiful-card-header-content']");
20
- expect(content.text()).toEqual('John Duck');
21
- expect(content.classes()).not.toContain('p-4');
22
- });
23
-
24
- test('defaults', async () => {
25
- const wrapper = mount({
26
- template: /*html*/ `
27
- <v-card>
28
- <v-card-header>John Duck</v-card-header>
29
- </v-card>
30
- `,
31
- components: {
32
- 'v-card': VCard,
33
- 'v-card-header': VCardHeader,
34
- },
35
- });
36
-
37
- const separator = wrapper.find("[data-test='vuetiful-card-header-separator']");
38
- const content = wrapper.find("[data-test='vuetiful-card-header-content']");
39
- expect(separator.element.tagName).toEqual('HR');
40
- expect(content.text()).toEqual('John Duck');
41
- expect(content.classes()).toContain('p-4');
42
- });
43
-
44
- describe('given hideSeparator is true', () => {
45
- test('should not show separator', async () => {
46
- const wrapper = mount({
47
- template: /*html*/ `
48
- <v-card hide-separator>
49
- <v-card-header>John Duck</v-card-header>
50
- </v-card>
51
- `,
52
- components: {
53
- 'v-card': VCard,
54
- 'v-card-header': VCardHeader,
55
- },
56
- });
57
-
58
- const separator = wrapper.find("[data-test='vuetiful-card-header-separator']");
59
- const content = wrapper.find("[data-test='vuetiful-card-header-content']");
60
- expect(separator.exists()).toEqual(false);
61
- expect(content.text()).toEqual('John Duck');
62
- });
63
- });
64
-
65
- describe('given an image is present', () => {
66
- test('should not have padding', async () => {
67
- const wrapper = mount({
68
- template: /*html*/ `
69
- <v-card>
70
- <v-card-header>
71
- <img src="fakeUrl" />
72
- </v-card-header>
73
- </v-card>
74
- `,
75
- components: {
76
- 'v-card': VCard,
77
- 'v-card-header': VCardHeader,
78
- },
79
- });
80
- await wrapper.vm.$nextTick();
81
-
82
- const content = wrapper.find("[data-test='vuetiful-card-header-content']");
83
- expect(content.classes()).not.toContain('p-4');
84
- });
85
- });
86
- });
@@ -1,53 +0,0 @@
1
- <script setup lang="ts">
2
- import { unstyledProp } from '@/props';
3
- import { useSettings } from '@/services';
4
- import { Ref, computed, inject, ref, useAttrs } from 'vue';
5
-
6
- const props = defineProps({
7
- classSeparator: {
8
- type: String as () => string,
9
- default: 'opacity-90',
10
- },
11
- unstyled: unstyledProp,
12
- });
13
-
14
- const headerRef = ref() as Ref<HTMLDivElement>;
15
-
16
- const hasImageAsChild = computed(() => {
17
- const children = headerRef.value?.children;
18
- if (!children) return false;
19
- const childrenArray = Array.from(children);
20
- return childrenArray.some((child) => child.tagName === 'IMG');
21
- });
22
-
23
- const hideSeparator = inject('hideSeparator', false);
24
-
25
- const attrs = useAttrs();
26
- const classAttribute = attrs.class as string;
27
-
28
- const { settings } = useSettings();
29
- const isUnstyled = settings.global.unstyled || settings.components.cardHeader.unstyled || props.unstyled;
30
- </script>
31
-
32
- <template>
33
- <div
34
- ref="headerRef"
35
- data-test="vuetiful-card-header-content"
36
- :class="`vuetiful-card-header ${hasImageAsChild ? '' : `${isUnstyled ? '' : 'p-4'}`} ${classAttribute}`"
37
- >
38
- <slot />
39
- </div>
40
- <hr v-if="!hideSeparator" data-test="vuetiful-card-header-separator" class="divider" :class="classSeparator" />
41
- </template>
42
-
43
- <style>
44
- .vuetiful-card-header {
45
- border-top-left-radius: inherit;
46
- border-top-right-radius: inherit;
47
- }
48
-
49
- .vuetiful-card-header > * {
50
- border-top-left-radius: inherit;
51
- border-top-right-radius: inherit;
52
- }
53
- </style>
@@ -1,133 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { describe, expect, test, vi } from 'vitest';
3
- import { VCodeBlock } from '../..';
4
-
5
- const clipboardMock = {
6
- writeText: vi.fn(),
7
- };
8
-
9
- Object.defineProperty(window.navigator, 'clipboard', {
10
- value: clipboardMock,
11
- writable: true,
12
- });
13
-
14
- describe('VCodeBlock', () => {
15
- test('copy button copies code to clipboard', async () => {
16
- const mockClipboardDirective = {
17
- mounted(el: HTMLElement, binding: any) {
18
- el.addEventListener('click', () => {
19
- el.dataset.copied = binding.value;
20
- });
21
- },
22
- };
23
-
24
- const wrapper = mount(VCodeBlock, {
25
- props: {
26
- code: 'John Duck',
27
- },
28
- global: {
29
- directives: {
30
- clipboard: mockClipboardDirective,
31
- },
32
- },
33
- });
34
-
35
- await wrapper.find('.vuetiful-code-block-button').trigger('click');
36
-
37
- expect(clipboardMock.writeText).toHaveBeenCalledWith('John Duck');
38
-
39
- await new Promise((resolve) => setTimeout(resolve, 2000));
40
-
41
- expect(wrapper.emitted('copy')).toBeTruthy();
42
- });
43
-
44
- test('renders the component with default props', () => {
45
- const wrapper = mount(VCodeBlock);
46
- expect(wrapper.exists()).toBe(true);
47
- expect(wrapper.text()).toContain('Copy');
48
- expect(wrapper.find('.vuetiful-code-block-language').text()).toBe('plaintext');
49
- expect(wrapper.find('.vuetiful-code-block-code').classes()).toContain('language-plaintext');
50
- });
51
-
52
- test('renders the component with custom props', () => {
53
- const customProps = {
54
- language: 'javascript',
55
- code: 'const x = 10;',
56
- buttonText: 'Copy Code',
57
- buttonCopiedText: 'Copied!',
58
- classButton: 'custom-button-class',
59
- classLanguage: 'custom-language-class',
60
- classCode: 'custom-code-class',
61
- preventOverflow: true,
62
- };
63
-
64
- const wrapper = mount(VCodeBlock, {
65
- props: customProps,
66
- });
67
-
68
- expect(wrapper.find('.vuetiful-code-block-button').text()).toContain('Copy Code');
69
- expect(wrapper.find('.vuetiful-code-block-language').text()).toBe('javascript');
70
- expect(wrapper.find('.vuetiful-code-block-code').classes()).toContain('language-javascript');
71
- expect(wrapper.find('.vuetiful-code-block-pre').classes()).toContain('whitespace-pre-wrap');
72
- });
73
-
74
- test('renders the component with custom props', () => {
75
- const customProps = {
76
- language: 'js',
77
- code: 'const x = 10;',
78
- buttonText: 'Copy Code',
79
- buttonCopiedText: 'Copied!',
80
- classButton: 'custom-button-class',
81
- classLanguage: 'custom-language-class',
82
- classCode: 'custom-code-class',
83
- preventOverflow: true,
84
- };
85
-
86
- const wrapper = mount(VCodeBlock, { props: customProps });
87
-
88
- expect(wrapper.find('.vuetiful-code-block-button').text()).toContain('Copy Code');
89
- expect(wrapper.find('.vuetiful-code-block-language').text()).toBe('javascript');
90
- expect(wrapper.find('.vuetiful-code-block-code').classes()).toContain('language-js');
91
- expect(wrapper.find('.vuetiful-code-block-pre').classes()).toContain('whitespace-pre-wrap');
92
- });
93
-
94
- test('renders the component with custom props', () => {
95
- const customProps = {
96
- language: 'ts',
97
- code: 'const x = 10;',
98
- buttonText: 'Copy Code',
99
- buttonCopiedText: 'Copied!',
100
- classButton: 'custom-button-class',
101
- classLanguage: 'custom-language-class',
102
- classCode: 'custom-code-class',
103
- preventOverflow: true,
104
- };
105
-
106
- const wrapper = mount(VCodeBlock, { props: customProps });
107
-
108
- expect(wrapper.find('.vuetiful-code-block-button').text()).toContain('Copy Code');
109
- expect(wrapper.find('.vuetiful-code-block-language').text()).toBe('typescript');
110
- expect(wrapper.find('.vuetiful-code-block-code').classes()).toContain('language-ts');
111
- expect(wrapper.find('.vuetiful-code-block-pre').classes()).toContain('whitespace-pre-wrap');
112
- });
113
-
114
- test('renders the component with custom props', () => {
115
- const customProps = {
116
- language: 'sh',
117
- code: 'const x = 10;',
118
- buttonText: 'Copy Code',
119
- buttonCopiedText: 'Copied!',
120
- classButton: 'custom-button-class',
121
- classLanguage: 'custom-language-class',
122
- classCode: 'custom-code-class',
123
- preventOverflow: true,
124
- };
125
-
126
- const wrapper = mount(VCodeBlock, { props: customProps });
127
-
128
- expect(wrapper.find('.vuetiful-code-block-button').text()).toContain('Copy Code');
129
- expect(wrapper.find('.vuetiful-code-block-language').text()).toBe('console');
130
- expect(wrapper.find('.vuetiful-code-block-code').classes()).toContain('language-sh');
131
- expect(wrapper.find('.vuetiful-code-block-pre').classes()).toContain('whitespace-pre-wrap');
132
- });
133
- });
@@ -1,113 +0,0 @@
1
- <script setup lang="ts">
2
- import { CssClasses, VButton, useSettings, vClipboard } from '@/index';
3
- import { unstyledProp } from '@/props';
4
- import { useHighlight } from '@/services/highlight.service';
5
- import 'highlight.js/styles/github-dark.css';
6
- import { ref } from 'vue';
7
-
8
- const { highlight } = useHighlight();
9
-
10
- const props = defineProps({
11
- language: {
12
- type: String,
13
- default: 'plaintext',
14
- },
15
- code: {
16
- type: String,
17
- default: '',
18
- },
19
-
20
- preventOverflow: {
21
- type: Boolean,
22
- default: false,
23
- },
24
-
25
- classHeader: {
26
- type: String as () => CssClasses,
27
- default: '',
28
- },
29
- classLanguage: {
30
- type: String as () => CssClasses,
31
- default: '',
32
- },
33
- classPre: {
34
- type: String as () => CssClasses,
35
- default: '',
36
- },
37
- classCode: {
38
- type: String as () => CssClasses,
39
- default: '',
40
- },
41
-
42
- classButton: {
43
- type: String as () => CssClasses,
44
- default: '',
45
- },
46
- buttonText: {
47
- type: String,
48
- default: 'Copy',
49
- },
50
- buttonCopiedText: {
51
- type: String,
52
- default: '👍',
53
- },
54
-
55
- unstyled: unstyledProp,
56
- });
57
-
58
- const emit = defineEmits<{
59
- (event: 'copy'): void;
60
- }>();
61
-
62
- const copyState = ref(false);
63
-
64
- // Allow shorthand alias, but show full text in UI
65
- function languageFormatter(lang: string): string {
66
- if (lang === 'js') return 'javascript';
67
- if (lang === 'ts') return 'typescript';
68
- if (['sh', 'bash', 'zsh', 'shell'].includes(lang)) return 'console';
69
- return lang;
70
- }
71
-
72
- function onCopyClick() {
73
- copyState.value = true;
74
- setTimeout(() => {
75
- copyState.value = false;
76
- }, 2000);
77
- emit('copy');
78
- }
79
-
80
- const { settings } = useSettings();
81
- const isUnstyled = settings.global.unstyled || settings.components.codeBlock.unstyled || props.unstyled;
82
- </script>
83
-
84
- <template v-if="language && code">
85
- <div
86
- :class="`vuetiful-code-block code-block ${
87
- isUnstyled ? '' : 'max-w-full bg-[#171717] text-sm text-white shadow rounded-container-token'
88
- }`"
89
- >
90
- <header
91
- :class="`vuetiful-code-block-header ${
92
- isUnstyled ? '' : 'flex items-center justify-between p-2 pb-0 pl-4 text-xs uppercase text-[#a4a4a4]'
93
- } ${classHeader}`"
94
- >
95
- <span :class="`vuetiful-code-block-language ${classLanguage}`">{{ languageFormatter(language) }}</span>
96
- <v-button
97
- size="sm"
98
- :class="`vuetiful-code-block-button ${
99
- classButton ? classButton : 'bg-[#171717] text-[#a4a4a4] dark:bg-[#171717] dark:text-[#a4a4a4]'
100
- }`"
101
- @click="onCopyClick()"
102
- v-clipboard="code"
103
- >
104
- {{ !copyState ? buttonText : buttonCopiedText }}
105
- </v-button>
106
- </header>
107
- <pre
108
- :class="`vuetiful-code-block-pre ${isUnstyled ? '' : '!rounded-t-none bg-transparent p-4 !pt-0'} ${
109
- preventOverflow ? 'whitespace-pre-wrap break-all' : 'overflow-auto'
110
- } ${classPre}`"
111
- ><code :class="`vuetiful-code-block-code language-${language} ${classCode}`" v-html="highlight(code, language)"></code></pre>
112
- </div>
113
- </template>
@@ -1,14 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { expect, test } from 'vitest';
3
- import { VDrawer } from '.';
4
-
5
- test('VDrawer', () => {
6
- expect(VDrawer).toBeTruthy();
7
- });
8
-
9
- // TODO: add tests
10
- test('VDrawer using slot', () => {
11
- const wrapper = mount(VDrawer);
12
-
13
- expect(wrapper).toBeTruthy();
14
- });
@@ -1,87 +0,0 @@
1
- <script setup lang="ts">
2
- import type { CssClasses } from '@/index';
3
- import { useDrawer } from '@/services';
4
- import { Ref, computed, onMounted, ref, toRefs } from 'vue';
5
-
6
- const { drawer, close } = useDrawer();
7
-
8
- // #region Props
9
- const props = defineProps({
10
- // Regions
11
- regionBackdrop: {
12
- type: String as () => CssClasses,
13
- default: '',
14
- },
15
- regionDrawer: {
16
- type: String as () => CssClasses,
17
- default: '',
18
- },
19
-
20
- // a11y
21
- labelledby: {
22
- type: String,
23
- default: '',
24
- },
25
- describedby: {
26
- type: String,
27
- default: '',
28
- },
29
- });
30
-
31
- const { regionBackdrop, regionDrawer, labelledby, describedby } = toRefs(props);
32
- // prettier-ignore
33
- const presets = {
34
- top: { alignment: 'top-0', width: 'w-full', height: 'h-[50%]', rounded: 'rounded-bl-container-token rounded-br-container-token' },
35
- bottom: { alignment: 'bottom-0', width: 'w-full', height: ' h-[50%]', rounded: 'rounded-tl-container-token rounded-tr-container-token' },
36
- left: { alignment: 'lef-0', width: 'w-[90%]', height: 'h-full', rounded: 'rounded-tr-container-token rounded-br-container-token' },
37
- right: { alignment: 'right-0', width: 'w-[90%]', height: 'h-full', rounded: 'rounded-tl-container-token rounded-bl-container-token' }
38
- };
39
- const preset = computed(() => {
40
- const position = drawer.position || 'left';
41
- return presets[position];
42
- });
43
- // #endregion
44
-
45
- // #region template refs
46
- const elemBackdrop: Ref<HTMLElement> = ref() as Ref<HTMLElement>;
47
- const elemDrawer: Ref<HTMLElement> = ref() as Ref<HTMLElement>;
48
- // #endregion
49
-
50
- // #region Event Handlers
51
- const onBackdropInteraction = (event: Event) => {
52
- if (event.target === elemBackdrop.value) close();
53
- };
54
-
55
- const onKeydownWindow = (event: KeyboardEvent) => {
56
- if (event.code === 'Escape') close();
57
- };
58
- onMounted(() => {
59
- window.addEventListener('keydown', onKeydownWindow);
60
- });
61
- // #endregion
62
- </script>
63
-
64
- <template>
65
- <transition :name="`slide-${drawer.position}-${drawer.duration}`">
66
- <div
67
- v-if="drawer.open"
68
- ref="elemDrawer"
69
- :class="`drawer absolute overflow-y-auto shadow-xl transition-transform bg-surface-100-800-token ${preset.width} ${preset.height} ${preset.rounded} ${preset.alignment} z-50 ${regionDrawer}`"
70
- role="dialog"
71
- aria-modal="true"
72
- :aria-labelledby="labelledby"
73
- :aria-describedby="describedby"
74
- >
75
- <slot />
76
- </div>
77
- </transition>
78
- <transition :name="`fade-${drawer.duration}`">
79
- <div
80
- v-if="drawer.open"
81
- ref="elemBackdrop"
82
- :class="`drawer-backdrop backdrop-blur-xs fixed bottom-0 left-0 right-0 top-0 z-40 flex bg-surface-backdrop-token ${regionBackdrop}`"
83
- @mousedown="onBackdropInteraction"
84
- @touchstart="onBackdropInteraction"
85
- ></div>
86
- </transition>
87
- </template>
@@ -1,146 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { describe, expect, test } from 'vitest';
3
- import { ref } from 'vue';
4
- import { VListboxItem } from '..';
5
- import VListbox from './VListbox.vue';
6
-
7
- describe('VListbox', () => {
8
- test('default props', () => {
9
- const wrapper = mount(VListbox);
10
-
11
- expect(wrapper.props()).toEqual({
12
- modelValue: undefined,
13
- classLabel: '',
14
- textButton: 'Select an option',
15
- classButton: '',
16
- classItem: '',
17
- classItems: '',
18
- horizontal: false,
19
- multiple: false,
20
- active: 'variant-filled',
21
- hover: 'hover:variant-ghost',
22
- background: 'bg-surface-200-700-token',
23
- text: 'text-surface-900 dark:text-surface-50',
24
- unstyled: false,
25
- by: undefined,
26
- display: undefined,
27
- textLabel: undefined,
28
- });
29
- });
30
-
31
- describe('modelValue', () => {
32
- test('should update modelValue', async () => {
33
- const choice = ref();
34
- const wrapper = mount({
35
- setup() {
36
- return { choice };
37
- },
38
- template: /*html*/ `
39
- <v-listbox class="w-60" v-model="choice">
40
- <v-listbox-item data-test="vuetiful" value="vuetiful">Vuetiful</v-listbox-item>
41
- <v-listbox-item data-test="is" value="is">Is</v-listbox-item>
42
- <v-listbox-item data-test="beautiful" value="beautiful">Beautiful</v-listbox-item>
43
- </v-listbox>
44
- `,
45
- components: {
46
- 'v-listbox': VListbox,
47
- 'v-listbox-item': VListboxItem,
48
- },
49
- });
50
-
51
- const listbox = wrapper.find("[data-test='listbox']");
52
- await listbox.find("[data-test='listbox-button']").trigger('click');
53
- await listbox.find("[data-test='vuetiful']").trigger('click');
54
- expect(choice.value).toBe('vuetiful');
55
- });
56
- });
57
-
58
- describe('object modelValue', () => {
59
- test('should use display prop', async () => {
60
- const choice = ref();
61
- const wrapper = mount({
62
- setup() {
63
- return { choice };
64
- },
65
- template: /*html*/ `
66
- <v-listbox class="w-60" v-model="choice" by="id" display="name">
67
- <v-listbox-item data-test="vuetiful" :value="{ name: 'vuetiful', id: 0 }">Vuetiful</v-listbox-item>
68
- <v-listbox-item data-test="is" :value="{ name: 'is', id: 1 }">Is</v-listbox-item>
69
- <v-listbox-item data-test="beautiful" :value="{ name: 'Beautiful', id: 2 }">Beautiful</v-listbox-item>
70
- </v-listbox>
71
- `,
72
- components: {
73
- 'v-listbox': VListbox,
74
- 'v-listbox-item': VListboxItem,
75
- },
76
- });
77
-
78
- const listbox = wrapper.find("[data-test='listbox']");
79
- const button = listbox.find("[data-test='listbox-button']");
80
- expect(button.text()).toBe('Select an option');
81
- await button.trigger('click');
82
- await listbox.find("[data-test='vuetiful']").trigger('click');
83
-
84
- expect(choice.value).toEqual({ name: 'vuetiful', id: 0 });
85
- expect(button.text()).toBe('vuetiful');
86
- });
87
- });
88
-
89
- describe('multiple', () => {
90
- test('should update modelValue and button text', async () => {
91
- const choice = ref([]);
92
- const wrapper = mount({
93
- setup() {
94
- return { choice };
95
- },
96
- template: /*html*/ `
97
- <v-listbox class="w-60" v-model="choice" multiple>
98
- <v-listbox-item data-test="vuetiful" value="vuetiful">Vuetiful</v-listbox-item>
99
- <v-listbox-item data-test="is" value="is">Is</v-listbox-item>
100
- <v-listbox-item data-test="beautiful" value="beautiful">Beautiful</v-listbox-item>
101
- </v-listbox>
102
- `,
103
- components: {
104
- 'v-listbox': VListbox,
105
- 'v-listbox-item': VListboxItem,
106
- },
107
- });
108
-
109
- const listbox = wrapper.find("[data-test='listbox']");
110
- const button = listbox.find("[data-test='listbox-button']");
111
- expect(button.text()).toBe('Select an option');
112
-
113
- await button.trigger('click');
114
- await listbox.find("[data-test='vuetiful']").trigger('click');
115
- expect(choice.value).toEqual(['vuetiful']);
116
- expect(button.text()).toBe('vuetiful');
117
-
118
- await listbox.find("[data-test='is']").trigger('click');
119
- expect(choice.value).toEqual(['vuetiful', 'is']);
120
- expect(button.text()).toBe('2 options selected');
121
- });
122
- });
123
-
124
- describe('unstyled', () => {
125
- test('should only have vuetiful- classes', async () => {
126
- const wrapper = mount(VListbox, {
127
- props: {
128
- unstyled: true,
129
- },
130
- });
131
-
132
- const listbox = wrapper.find("[data-test='listbox']");
133
- await listbox.find("[data-test='listbox-button']").trigger('click');
134
- const listboxItems = wrapper.find("[data-test='listbox-items']");
135
-
136
- expect(listbox.classes()).toEqual(['vuetiful-listbox']);
137
- expect(listboxItems.classes()).toEqual([
138
- 'z-10',
139
- 'bg-surface-200-700-token',
140
- 'text-surface-900',
141
- 'dark:text-surface-50',
142
- 'flex-col',
143
- ]);
144
- });
145
- });
146
- });