@code-coaching/vuetiful 0.26.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 (262) 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 +1 -1
  44. package/dist/types/directives/click-outside.d.ts +1 -1
  45. package/dist/types/directives/clipboard.d.ts +1 -1
  46. package/dist/types/index.d.ts +1 -8
  47. package/dist/types/props/props.d.ts +1 -14
  48. package/dist/types/services/dark-mode.service.d.ts +1 -1
  49. package/dist/types/services/drawer.service.d.ts +3 -3
  50. package/dist/types/services/index.d.ts +2 -2
  51. package/dist/types/utils/id-generator.d.ts +1 -0
  52. package/dist/types/utils/index.d.ts +3 -4
  53. package/dist/types/utils/tailwind-merge.d.ts +1 -0
  54. package/dist/types/utils/theme/rocket.theme.d.ts +223 -0
  55. package/dist/types/utils/theme/theme-switcher.vue.d.ts +14 -5
  56. package/dist/types/utils/theme/theme.service.d.ts +6 -9
  57. package/dist/types/utils/theme/themes.d.ts +3 -39
  58. package/dist/types/utils/theme/vuetiful.theme.d.ts +224 -0
  59. package/dist/vuetiful.es.mjs +54831 -49535
  60. package/dist/vuetiful.umd.cjs +189 -0
  61. package/package.json +53 -37
  62. package/dist/style.css +0 -10
  63. package/dist/types/components/VBootstrap.vue.d.ts +0 -15
  64. package/dist/types/components/atoms/VAvatar.test.d.ts +0 -1
  65. package/dist/types/components/atoms/VBadge.test.d.ts +0 -1
  66. package/dist/types/components/atoms/VButton.test.d.ts +0 -1
  67. package/dist/types/components/atoms/VChip.test.d.ts +0 -1
  68. package/dist/types/components/atoms/VLightSwitch.test.d.ts +0 -1
  69. package/dist/types/components/atoms/VRadio/VRadioDescription.test.d.ts +0 -1
  70. package/dist/types/components/atoms/VRadio/VRadioGroup.test.d.ts +0 -1
  71. package/dist/types/components/atoms/VRadio/VRadioItem.test.d.ts +0 -1
  72. package/dist/types/components/atoms/VRadio/VRadioLabel.test.d.ts +0 -1
  73. package/dist/types/components/atoms/VSwitch/VSwitch.test.d.ts +0 -1
  74. package/dist/types/components/atoms/VSwitch/VSwitchDescription.test.d.ts +0 -1
  75. package/dist/types/components/atoms/VSwitch/VSwitchGroup.test.d.ts +0 -1
  76. package/dist/types/components/atoms/VSwitch/VSwitchLabel.test.d.ts +0 -1
  77. package/dist/types/components/molecules/VAccordion/VAccordion.test.d.ts +0 -1
  78. package/dist/types/components/molecules/VAccordion/VAccordionItem.test.d.ts +0 -1
  79. package/dist/types/components/molecules/VAlert.test.d.ts +0 -1
  80. package/dist/types/components/molecules/VCard/VCard.test.d.ts +0 -1
  81. package/dist/types/components/molecules/VCard/VCardBody.test.d.ts +0 -1
  82. package/dist/types/components/molecules/VCard/VCardFooter.test.d.ts +0 -1
  83. package/dist/types/components/molecules/VCard/VCardHeader.test.d.ts +0 -1
  84. package/dist/types/components/molecules/VCodeBlock.test.d.ts +0 -1
  85. package/dist/types/components/molecules/VDrawer.test.d.ts +0 -1
  86. package/dist/types/components/molecules/VListbox/VListbox.test.d.ts +0 -1
  87. package/dist/types/components/molecules/VListbox/VListboxButton.test.d.ts +0 -1
  88. package/dist/types/components/molecules/VListbox/VListboxItem.test.d.ts +0 -1
  89. package/dist/types/components/molecules/VListbox/VListboxItems.test.d.ts +0 -1
  90. package/dist/types/components/molecules/VListbox/VListboxLabel.test.d.ts +0 -1
  91. package/dist/types/components/molecules/VPreview.test.d.ts +0 -1
  92. package/dist/types/components/molecules/VRail/VRail.test.d.ts +0 -1
  93. package/dist/types/components/molecules/VRail/VRailTile.test.d.ts +0 -1
  94. package/dist/types/components/molecules/VShell.test.d.ts +0 -1
  95. package/dist/types/components/molecules/VTabs/VTab.test.d.ts +0 -1
  96. package/dist/types/components/molecules/VTabs/VTabPanel.test.d.ts +0 -1
  97. package/dist/types/components/molecules/VTabs/VTabs.test.d.ts +0 -1
  98. package/dist/types/directives/click-outside-group.test.d.ts +0 -1
  99. package/dist/types/directives/click-outside.test.d.ts +0 -1
  100. package/dist/types/directives/clipboard.test.d.ts +0 -1
  101. package/dist/types/services/dark-mode.service.test.d.ts +0 -1
  102. package/dist/types/services/drawer.service.test.d.ts +0 -1
  103. package/dist/types/services/highlight.service.test.d.ts +0 -1
  104. package/dist/types/services/rail.service.test.d.ts +0 -1
  105. package/dist/types/services/settings.service.test.d.ts +0 -1
  106. package/dist/types/types/index.d.ts +0 -54
  107. package/dist/types/types/tailwind.d.ts +0 -4
  108. package/dist/types/utils/colors/colors.service.d.ts +0 -69
  109. package/dist/types/utils/platform/platform.service.test.d.ts +0 -1
  110. package/dist/types/utils/theme/callback.test.d.ts +0 -1
  111. package/dist/types/utils/theme/remove.test.d.ts +0 -1
  112. package/dist/types/utils/theme/theme.service.test.d.ts +0 -1
  113. package/dist/vuetiful.umd.js +0 -99
  114. package/src/assets/fonts/myfont.woff +0 -0
  115. package/src/assets/main.css +0 -17
  116. package/src/components/VBootstrap.vue +0 -62
  117. package/src/components/atoms/VAvatar.test.ts +0 -175
  118. package/src/components/atoms/VAvatar.vue +0 -89
  119. package/src/components/atoms/VBadge.test.ts +0 -28
  120. package/src/components/atoms/VBadge.vue +0 -17
  121. package/src/components/atoms/VButton.test.ts +0 -180
  122. package/src/components/atoms/VButton.vue +0 -76
  123. package/src/components/atoms/VChip.test.ts +0 -33
  124. package/src/components/atoms/VChip.vue +0 -17
  125. package/src/components/atoms/VLightSwitch.test.ts +0 -69
  126. package/src/components/atoms/VLightSwitch.vue +0 -121
  127. package/src/components/atoms/VRadio/VRadioDescription.test.ts +0 -55
  128. package/src/components/atoms/VRadio/VRadioDescription.vue +0 -14
  129. package/src/components/atoms/VRadio/VRadioGroup.test.ts +0 -81
  130. package/src/components/atoms/VRadio/VRadioGroup.vue +0 -88
  131. package/src/components/atoms/VRadio/VRadioItem.test.ts +0 -183
  132. package/src/components/atoms/VRadio/VRadioItem.vue +0 -36
  133. package/src/components/atoms/VRadio/VRadioLabel.test.ts +0 -55
  134. package/src/components/atoms/VRadio/VRadioLabel.vue +0 -16
  135. package/src/components/atoms/VSwitch/VSwitch.test.ts +0 -100
  136. package/src/components/atoms/VSwitch/VSwitch.vue +0 -106
  137. package/src/components/atoms/VSwitch/VSwitchDescription.test.ts +0 -55
  138. package/src/components/atoms/VSwitch/VSwitchDescription.vue +0 -16
  139. package/src/components/atoms/VSwitch/VSwitchGroup.test.ts +0 -26
  140. package/src/components/atoms/VSwitch/VSwitchGroup.vue +0 -16
  141. package/src/components/atoms/VSwitch/VSwitchLabel.test.ts +0 -89
  142. package/src/components/atoms/VSwitch/VSwitchLabel.vue +0 -20
  143. package/src/components/atoms/index.ts +0 -31
  144. package/src/components/index.ts +0 -2
  145. package/src/components/molecules/VAccordion/VAccordion.test.ts +0 -27
  146. package/src/components/molecules/VAccordion/VAccordion.vue +0 -32
  147. package/src/components/molecules/VAccordion/VAccordionItem.test.ts +0 -134
  148. package/src/components/molecules/VAccordion/VAccordionItem.vue +0 -68
  149. package/src/components/molecules/VAlert.test.ts +0 -100
  150. package/src/components/molecules/VAlert.vue +0 -137
  151. package/src/components/molecules/VCard/VCard.test.ts +0 -47
  152. package/src/components/molecules/VCard/VCard.vue +0 -74
  153. package/src/components/molecules/VCard/VCardBody.test.ts +0 -39
  154. package/src/components/molecules/VCard/VCardBody.vue +0 -16
  155. package/src/components/molecules/VCard/VCardFooter.test.ts +0 -63
  156. package/src/components/molecules/VCard/VCardFooter.vue +0 -31
  157. package/src/components/molecules/VCard/VCardHeader.test.ts +0 -86
  158. package/src/components/molecules/VCard/VCardHeader.vue +0 -53
  159. package/src/components/molecules/VCodeBlock.test.ts +0 -133
  160. package/src/components/molecules/VCodeBlock.vue +0 -113
  161. package/src/components/molecules/VDrawer.test.ts +0 -14
  162. package/src/components/molecules/VDrawer.vue +0 -87
  163. package/src/components/molecules/VListbox/VListbox.test.ts +0 -146
  164. package/src/components/molecules/VListbox/VListbox.vue +0 -149
  165. package/src/components/molecules/VListbox/VListboxButton.test.ts +0 -66
  166. package/src/components/molecules/VListbox/VListboxButton.vue +0 -57
  167. package/src/components/molecules/VListbox/VListboxItem.test.ts +0 -51
  168. package/src/components/molecules/VListbox/VListboxItem.vue +0 -39
  169. package/src/components/molecules/VListbox/VListboxItems.test.ts +0 -44
  170. package/src/components/molecules/VListbox/VListboxItems.vue +0 -42
  171. package/src/components/molecules/VListbox/VListboxLabel.test.ts +0 -30
  172. package/src/components/molecules/VListbox/VListboxLabel.vue +0 -14
  173. package/src/components/molecules/VPreview.test.ts +0 -73
  174. package/src/components/molecules/VPreview.vue +0 -230
  175. package/src/components/molecules/VRail/VRail.test.ts +0 -14
  176. package/src/components/molecules/VRail/VRail.vue +0 -33
  177. package/src/components/molecules/VRail/VRailTile.test.ts +0 -97
  178. package/src/components/molecules/VRail/VRailTile.vue +0 -49
  179. package/src/components/molecules/VShell.test.ts +0 -14
  180. package/src/components/molecules/VShell.vue +0 -63
  181. package/src/components/molecules/VTabs/VTab.test.ts +0 -143
  182. package/src/components/molecules/VTabs/VTab.vue +0 -50
  183. package/src/components/molecules/VTabs/VTabPanel.test.ts +0 -24
  184. package/src/components/molecules/VTabs/VTabPanel.vue +0 -9
  185. package/src/components/molecules/VTabs/VTabs.test.ts +0 -92
  186. package/src/components/molecules/VTabs/VTabs.vue +0 -104
  187. package/src/components/molecules/index.ts +0 -51
  188. package/src/directives/click-outside-group.test.ts +0 -44
  189. package/src/directives/click-outside-group.ts +0 -39
  190. package/src/directives/click-outside.test.ts +0 -38
  191. package/src/directives/click-outside.ts +0 -28
  192. package/src/directives/clipboard.test.ts +0 -26
  193. package/src/directives/clipboard.ts +0 -9
  194. package/src/directives/index.ts +0 -5
  195. package/src/env.d.ts +0 -8
  196. package/src/index.ts +0 -21
  197. package/src/props/index.ts +0 -1
  198. package/src/props/props.ts +0 -62
  199. package/src/services/dark-mode.service.test.ts +0 -104
  200. package/src/services/dark-mode.service.ts +0 -75
  201. package/src/services/drawer.service.test.ts +0 -45
  202. package/src/services/drawer.service.ts +0 -46
  203. package/src/services/highlight.service.test.ts +0 -24
  204. package/src/services/highlight.service.ts +0 -19
  205. package/src/services/index.ts +0 -8
  206. package/src/services/rail.service.test.ts +0 -13
  207. package/src/services/rail.service.ts +0 -11
  208. package/src/services/settings.service.test.ts +0 -17
  209. package/src/services/settings.service.ts +0 -136
  210. package/src/styles/all.css +0 -24
  211. package/src/styles/core.css +0 -66
  212. package/src/styles/elements/alerts.css +0 -17
  213. package/src/styles/elements/badges.css +0 -31
  214. package/src/styles/elements/breadcrumbs.css +0 -26
  215. package/src/styles/elements/buttons.css +0 -103
  216. package/src/styles/elements/cards.css +0 -32
  217. package/src/styles/elements/chips.css +0 -22
  218. package/src/styles/elements/forms.css +0 -269
  219. package/src/styles/elements/lists.css +0 -48
  220. package/src/styles/elements/logo-clouds.css +0 -29
  221. package/src/styles/elements/modals.css +0 -15
  222. package/src/styles/elements/placeholders.css +0 -17
  223. package/src/styles/elements/popups.css +0 -16
  224. package/src/styles/elements/tables.css +0 -102
  225. package/src/styles/elements.css +0 -19
  226. package/src/styles/highlight-js.css +0 -116
  227. package/src/styles/tailwind.css +0 -16
  228. package/src/styles/transitions.css +0 -2
  229. package/src/styles/typography.css +0 -101
  230. package/src/styles/variants.css +0 -156
  231. package/src/tailwind/core.cjs +0 -37
  232. package/src/tailwind/generated/intellisense-classes.cjs +0 -558
  233. package/src/tailwind/intellisense.cjs +0 -21
  234. package/src/tailwind/settings.cjs +0 -20
  235. package/src/tailwind/theme/colors.cjs +0 -20
  236. package/src/tailwind/tokens/backgrounds.cjs +0 -48
  237. package/src/tailwind/tokens/border-radius.cjs +0 -21
  238. package/src/tailwind/tokens/borders.cjs +0 -24
  239. package/src/tailwind/tokens/fills.cjs +0 -20
  240. package/src/tailwind/tokens/rings.cjs +0 -50
  241. package/src/tailwind/tokens/text.cjs +0 -35
  242. package/src/tailwind/vuetiful.cjs +0 -19
  243. package/src/themes/theme-rocket.css +0 -119
  244. package/src/themes/theme-sahara.css +0 -128
  245. package/src/themes/theme-seafoam.css +0 -120
  246. package/src/themes/theme-seasonal.css +0 -115
  247. package/src/themes/theme-skeleton.css +0 -115
  248. package/src/themes/theme-vintage.css +0 -125
  249. package/src/themes/theme-vuetiful.css +0 -136
  250. package/src/types/index.ts +0 -59
  251. package/src/types/tailwind.ts +0 -7
  252. package/src/utils/colors/colors.service.ts +0 -293
  253. package/src/utils/index.ts +0 -8
  254. package/src/utils/platform/platform.service.test.ts +0 -19
  255. package/src/utils/platform/platform.service.ts +0 -8
  256. package/src/utils/theme/callback.test.ts +0 -28
  257. package/src/utils/theme/remove.test.ts +0 -27
  258. package/src/utils/theme/theme-switcher.vue +0 -78
  259. package/src/utils/theme/theme.service.test.ts +0 -269
  260. package/src/utils/theme/theme.service.ts +0 -173
  261. package/src/utils/theme/themes.ts +0 -282
  262. /package/{src/styles → dist/css}/transitions/fade.css +0 -0
Binary file
@@ -1,17 +0,0 @@
1
- @font-face {
2
- font-family: 'myfont';
3
- src: url('fonts/myfont.woff');
4
- }
5
-
6
- [class^='icon-'],
7
- [class*=' icon-'] {
8
- font-family: 'myfont' !important;
9
- }
10
-
11
- .icon-heart:before {
12
- content: '\e9da';
13
- }
14
-
15
- .global-example {
16
- color: red;
17
- }
@@ -1,62 +0,0 @@
1
- <script setup lang="ts">
2
- import { Variant } from '@/types';
3
- import { PropType } from 'vue';
4
-
5
- /**
6
- * VBoostrap is a component that should not be used directly.
7
- * It is used to make sure that the variant-classes are bundled with the application.
8
- * This allows us to use `variant-${variant}` in the template.
9
- *
10
- * In the future it might be a good idea to just add .filled, .ringed, etc. as alternatives for .variant-filled, .variant-ringed, etc. and remove this component.
11
- */
12
-
13
- defineProps({
14
- variant: {
15
- // explicit string union because TypeScript type won't throw error if invalid value is passed
16
- type: String as PropType<
17
- | ''
18
- | 'variant-filled'
19
- | 'variant-filled-primary'
20
- | 'variant-filled-secondary'
21
- | 'variant-filled-tertiary'
22
- | 'variant-filled-success'
23
- | 'variant-filled-warning'
24
- | 'variant-filled-error'
25
- | 'variant-filled-surface'
26
- | 'variant-ringed'
27
- | 'variant-ringed-primary'
28
- | 'variant-ringed-secondary'
29
- | 'variant-ringed-tertiary'
30
- | 'variant-ringed-success'
31
- | 'variant-ringed-warning'
32
- | 'variant-ringed-error'
33
- | 'variant-ringed-surface'
34
- | 'variant-ghost'
35
- | 'variant-ghost-primary'
36
- | 'variant-ghost-secondary'
37
- | 'variant-ghost-tertiary'
38
- | 'variant-ghost-success'
39
- | 'variant-ghost-warning'
40
- | 'variant-ghost-error'
41
- | 'variant-ghost-surface'
42
- | 'variant-soft'
43
- | 'variant-soft-primary'
44
- | 'variant-soft-secondary'
45
- | 'variant-soft-tertiary'
46
- | 'variant-soft-success'
47
- | 'variant-soft-warning'
48
- | 'variant-soft-error'
49
- | 'variant-soft-surface'
50
- | 'variant-glass'
51
- | 'variant-glass-primary'
52
- | 'variant-glass-secondary'
53
- | 'variant-glass-tertiary'
54
- | 'variant-glass-success'
55
- | 'variant-glass-warning'
56
- | 'variant-glass-error'
57
- | 'variant-glass-surface'
58
- >,
59
- default: Variant.Filled,
60
- },
61
- });
62
- </script>
@@ -1,175 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { describe, expect, test } from 'vitest';
3
- import { VAvatar } from '.';
4
-
5
- describe('VAvatar', () => {
6
- test('defaults', () => {
7
- const wrapper = mount(VAvatar);
8
-
9
- expect(wrapper.classes()).toContain('vuetiful-avatar');
10
- expect(wrapper.classes()).toContain('w-16');
11
- expect(wrapper.classes()).toContain('rounded-token');
12
-
13
- const avatarText = wrapper.find('.vuetiful-avatar-text');
14
- expect(avatarText.exists()).toBe(true);
15
- expect(avatarText.text()).toBe('');
16
- expect(avatarText.classes()).toEqual(['vuetiful-avatar-text', 'fill-white', 'dark:fill-black']);
17
- });
18
-
19
- test('custom variant', () => {
20
- const wrapper = mount(VAvatar, {
21
- props: {
22
- variant: 'ghost',
23
- },
24
- });
25
-
26
- const avatarText = wrapper.find('.vuetiful-avatar-text');
27
- expect(avatarText.classes()).toEqual(['vuetiful-avatar-text', 'fill-black', 'dark:fill-white']);
28
- });
29
-
30
- test('variant with hyphen', () => {
31
- const wrapper = mount(VAvatar, {
32
- props: {
33
- variant: 'filled-primary',
34
- },
35
- });
36
-
37
- expect(wrapper.classes()).toContain('variant-filled-primary');
38
- });
39
-
40
- test('initials', () => {
41
- const wrapper = mount(VAvatar, {
42
- props: {
43
- initials: 'JD',
44
- variant: 'filled',
45
- },
46
- });
47
-
48
- expect(wrapper.classes()).toContain('vuetiful-avatar');
49
- expect(wrapper.classes()).toContain('w-16');
50
- expect(wrapper.classes()).toContain('rounded-token');
51
-
52
- const avatarText = wrapper.find('.vuetiful-avatar-text');
53
- expect(avatarText.exists()).toBe(true);
54
- expect(avatarText.text()).toBe('JD');
55
- expect(avatarText.classes()).toEqual(['vuetiful-avatar-text', 'fill-white', 'dark:fill-black']);
56
-
57
- const avatarImage = wrapper.find('.vuetiful-avatar-image');
58
- expect(avatarImage.exists()).toBe(false);
59
- });
60
-
61
- test('initials fill', () => {
62
- const wrapper = mount(VAvatar, {
63
- props: {
64
- initials: 'JD',
65
- fill: 'custom-fill-class',
66
- },
67
- });
68
-
69
- expect(wrapper.classes()).toContain('vuetiful-avatar');
70
- expect(wrapper.classes()).toContain('w-16');
71
- expect(wrapper.classes()).toContain('rounded-token');
72
-
73
- const avatarText = wrapper.find('.vuetiful-avatar-text');
74
- expect(avatarText.exists()).toBe(true);
75
- expect(avatarText.text()).toBe('JD');
76
- expect(avatarText.classes()).toContain('custom-fill-class');
77
- });
78
-
79
- test('image', () => {
80
- const wrapper = mount(VAvatar, {
81
- props: {
82
- src: 'https://via.placeholder.com/150',
83
- },
84
- });
85
-
86
- expect(wrapper.classes()).toContain('vuetiful-avatar');
87
- expect(wrapper.classes()).toContain('w-16');
88
- expect(wrapper.classes()).toContain('rounded-token');
89
-
90
- const avatarText = wrapper.find('.vuetiful-avatar-text');
91
- expect(avatarText.exists()).toBe(false);
92
-
93
- const avatarImage = wrapper.find('.vuetiful-avatar-image');
94
- expect(avatarImage.exists()).toBe(true);
95
- expect(avatarImage.attributes('src')).toBe('https://via.placeholder.com/150');
96
- });
97
-
98
- test('image fallback', async () => {
99
- const wrapper = mount(VAvatar, {
100
- props: {
101
- src: 'https://via.placeholder.com/150',
102
- fallback: '/image/john-duck.png',
103
- },
104
- });
105
-
106
- expect(wrapper.classes()).toContain('vuetiful-avatar');
107
- expect(wrapper.classes()).toContain('w-16');
108
- expect(wrapper.classes()).toContain('rounded-token');
109
-
110
- const avatarText = wrapper.find('.vuetiful-avatar-text');
111
- expect(avatarText.exists()).toBe(false);
112
-
113
- const avatarImage = wrapper.find('.vuetiful-avatar-image');
114
- avatarImage.trigger('error');
115
- await wrapper.vm.$nextTick();
116
-
117
- expect(avatarImage.exists()).toBe(true);
118
- expect(avatarImage.attributes('src')).toBe('/image/john-duck.png');
119
- });
120
-
121
- test('size xs', () => {
122
- const wrapper = mount(VAvatar, {
123
- props: {
124
- size: 'xs',
125
- },
126
- });
127
-
128
- const avatar = wrapper.find("[data-test='avatar']");
129
- expect(avatar.attributes('class')).toContain('w-8');
130
- });
131
-
132
- test('size sm', () => {
133
- const wrapper = mount(VAvatar, {
134
- props: {
135
- size: 'sm',
136
- },
137
- });
138
-
139
- const avatar = wrapper.find("[data-test='avatar']");
140
- expect(avatar.attributes('class')).toContain('w-12');
141
- });
142
-
143
- test('size md', () => {
144
- const wrapper = mount(VAvatar, {
145
- props: {
146
- size: 'md',
147
- },
148
- });
149
-
150
- const avatar = wrapper.find("[data-test='avatar']");
151
- expect(avatar.attributes('class')).toContain('w-16');
152
- });
153
-
154
- test('size lg', () => {
155
- const wrapper = mount(VAvatar, {
156
- props: {
157
- size: 'lg',
158
- },
159
- });
160
-
161
- const avatar = wrapper.find("[data-test='avatar']");
162
- expect(avatar.attributes('class')).toContain('w-20');
163
- });
164
-
165
- test('size xl', () => {
166
- const wrapper = mount(VAvatar, {
167
- props: {
168
- size: 'xl',
169
- },
170
- });
171
-
172
- const avatar = wrapper.find("[data-test='avatar']");
173
- expect(avatar.attributes('class')).toContain('w-24');
174
- });
175
- });
@@ -1,89 +0,0 @@
1
- <script setup lang="ts">
2
- import { CssClasses, useSettings } from '@/index';
3
- import { sizeProp, unstyledProp, variantProp } from '@/props';
4
- import { Size } from '@/types';
5
- import { computed, ref } from 'vue';
6
-
7
- const props = defineProps({
8
- // Initials
9
- initials: { type: String, default: '' },
10
- fill: { type: String as () => CssClasses, default: '' },
11
- classInitials: { type: String, default: '' },
12
-
13
- // Image
14
- src: { type: String, default: '' },
15
- alt: { type: String, default: '' },
16
- fallback: { type: String, default: '' },
17
- classImage: { type: String, default: '' },
18
-
19
- size: sizeProp,
20
- variant: variantProp,
21
- unstyled: unstyledProp,
22
- });
23
-
24
- const imgSrc = ref(props.src);
25
- const fillInitials = computed(() => {
26
- if (props.fill) return props.fill;
27
-
28
- const variantString = props.variant as string | undefined;
29
- const type = variantString?.split('-')[1];
30
- if (variantString?.includes('filled')) {
31
- if (!type) return 'fill-white dark:fill-black';
32
- return 'fill-white';
33
- }
34
- return 'fill-black dark:fill-white';
35
- });
36
-
37
- const avatarSize = computed(() => {
38
- switch (props.size) {
39
- case Size.XS:
40
- return 'w-8';
41
- case Size.SM:
42
- return 'w-12';
43
- case Size.MD:
44
- return 'w-16';
45
- case Size.LG:
46
- return 'w-20';
47
- case Size.XL:
48
- return 'w-24';
49
- }
50
- });
51
-
52
- const { settings } = useSettings();
53
- const isUnstyled = settings.global.unstyled || settings.components.avatar.unstyled || props.unstyled;
54
- </script>
55
- <template>
56
- <figure
57
- data-test="avatar"
58
- :class="`vuetiful-avatar ${
59
- isUnstyled
60
- ? ''
61
- : 'isolate flex aspect-square items-center justify-center overflow-hidden font-semibold rounded-token'
62
- } ${avatarSize} variant-${variant}`"
63
- >
64
- <img
65
- :class="`vuetiful-avatar-image ${classImage}`"
66
- v-if="src"
67
- :src="imgSrc"
68
- :alt="alt"
69
- @error="() => (imgSrc = fallback)"
70
- />
71
- <svg
72
- v-else
73
- :class="`vuetiful-avatar-initials ${isUnstyled ? '' : 'h-full w-full'} ${classInitials}`"
74
- viewBox="0 0 512 512"
75
- >
76
- <text
77
- x="50%"
78
- y="50%"
79
- dominant-baseline="central"
80
- text-anchor="middle"
81
- font-weight="bold"
82
- :font-size="150"
83
- :class="`vuetiful-avatar-text ${fillInitials}`"
84
- >
85
- {{ String(initials).substring(0, 2).toUpperCase() }}
86
- </text>
87
- </svg>
88
- </figure>
89
- </template>
@@ -1,28 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { expect, test } from 'vitest';
3
- import { VBadge } from '.';
4
-
5
- test('VBadge', () => {
6
- expect(VBadge).toBeTruthy();
7
- });
8
-
9
- test('VBadge using slot', () => {
10
- const wrapper = mount(VBadge, {
11
- slots: {
12
- default: 'John Duck',
13
- },
14
- });
15
-
16
- expect(wrapper.text()).toContain('John Duck');
17
- expect(wrapper.classes()).toContain('badge');
18
- });
19
-
20
- test('VBadge unstyled', () => {
21
- const wrapper = mount(VBadge, {
22
- props: {
23
- unstyled: true,
24
- },
25
- });
26
-
27
- expect(wrapper.classes()).not.toContain('badge');
28
- });
@@ -1,17 +0,0 @@
1
- <script setup lang="ts">
2
- import { unstyledProp, variantProp } from '@/props';
3
- import { useSettings } from '@/services';
4
-
5
- const props = defineProps({
6
- variant: variantProp,
7
- unstyled: unstyledProp,
8
- });
9
-
10
- const { settings } = useSettings();
11
- const isUnstyled = settings.global.unstyled || settings.components.badge.unstyled || props.unstyled;
12
- </script>
13
- <template>
14
- <div :class="`vuetiful-badge ${isUnstyled ? '' : 'badge'} variant-${variant}`">
15
- <slot />
16
- </div>
17
- </template>
@@ -1,180 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { describe, expect, test, vi } from 'vitest';
3
- import { VButton } from '.';
4
-
5
- test('VButton', () => {
6
- expect(VButton).toBeTruthy();
7
- });
8
-
9
- test('VButton using slot', () => {
10
- const wrapper = mount(VButton, {
11
- slots: {
12
- default: 'John Duck',
13
- },
14
- });
15
-
16
- expect(wrapper.text()).toContain('John Duck');
17
- });
18
-
19
- describe('VButton props', () => {
20
- describe('size', () => {
21
- test('xs', () => {
22
- const wrapper = mount(VButton, {
23
- props: {
24
- size: 'xs',
25
- },
26
- });
27
- expect(wrapper.classes()).toContain('px-2.5');
28
- expect(wrapper.classes()).toContain('py-1.5');
29
- expect(wrapper.classes()).toContain('text-xs');
30
- });
31
-
32
- test('sm', () => {
33
- const wrapper = mount(VButton, {
34
- props: {
35
- size: 'sm',
36
- },
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');
42
- });
43
-
44
- test('md', () => {
45
- const wrapper = mount(VButton, {
46
- props: {
47
- size: 'md',
48
- },
49
- });
50
- expect(wrapper.classes()).toContain('px-4');
51
- expect(wrapper.classes()).toContain('py-2');
52
- expect(wrapper.classes()).toContain('text-sm');
53
- });
54
-
55
- test('lg', () => {
56
- const wrapper = mount(VButton, {
57
- props: {
58
- size: 'lg',
59
- },
60
- });
61
- expect(wrapper.classes()).toContain('px-4');
62
- expect(wrapper.classes()).toContain('py-2');
63
- expect(wrapper.classes()).toContain('text-base');
64
- });
65
-
66
- test('xl', () => {
67
- const wrapper = mount(VButton, {
68
- props: {
69
- size: 'xl',
70
- },
71
- });
72
- expect(wrapper.classes()).toContain('px-6');
73
- expect(wrapper.classes()).toContain('py-3');
74
- expect(wrapper.classes()).toContain('text-base');
75
- });
76
- });
77
-
78
- describe('given icon is true', () => {
79
- test('should have btn-icon class, not have btn class', () => {
80
- const wrapper = mount(VButton, {
81
- props: {
82
- icon: true,
83
- },
84
- });
85
- expect(wrapper.classes()).toContain('btn-icon');
86
- expect(wrapper.classes()).not.toContain('btn');
87
- });
88
- });
89
- describe('given icon is false', () => {
90
- test('should have btn class, not have btn-icon class', () => {
91
- const wrapper = mount(VButton, {
92
- props: {
93
- icon: false,
94
- },
95
- });
96
- expect(wrapper.classes()).not.toContain('btn-icon');
97
- expect(wrapper.classes()).toContain('btn');
98
- });
99
- });
100
- });
101
-
102
- describe('VButton events', () => {
103
- describe('given click event', () => {
104
- test('should preventDefault and emit click event', async () => {
105
- const wrapper = mount(VButton);
106
- const clickEvent = { preventDefault: () => {} };
107
- const preventDefaultSpy = vi.spyOn(clickEvent, 'preventDefault');
108
- wrapper.trigger('click', clickEvent);
109
- await wrapper.vm.$nextTick();
110
- expect(preventDefaultSpy).toHaveBeenCalled();
111
- expect(wrapper.emitted('click')).toBeTruthy();
112
- });
113
- });
114
- });
115
-
116
- describe('VButton a11y', () => {
117
- describe('a11y role', () => {
118
- test('should have role button', () => {
119
- const wrapper = mount(VButton);
120
- expect(wrapper.attributes('role')).toBe('button');
121
- });
122
- });
123
- describe('a11y tabindex', () => {
124
- test('should have tabindex 0', () => {
125
- const wrapper = mount(VButton);
126
- expect(wrapper.attributes('tabindex')).toBe('0');
127
- });
128
- });
129
- describe('given keydown event', () => {
130
- describe('given key is Enter', () => {
131
- test('should preventDefault and emit click event', async () => {
132
- const wrapper = mount(VButton);
133
- const keydownEvent = { key: 'Enter', preventDefault: () => {} };
134
- const preventDefaultSpy = vi.spyOn(keydownEvent, 'preventDefault');
135
- wrapper.trigger('keydown', keydownEvent);
136
- await wrapper.vm.$nextTick();
137
- expect(preventDefaultSpy).toHaveBeenCalled();
138
- expect(wrapper.emitted('click')).toBeTruthy();
139
- });
140
- });
141
-
142
- describe('given key is Space', () => {
143
- test('should preventDefault and not emit click event', async () => {
144
- const wrapper = mount(VButton);
145
- const keydownEvent = { key: ' ', preventDefault: () => {} };
146
- const preventDefaultSpy = vi.spyOn(keydownEvent, 'preventDefault');
147
- wrapper.trigger('keydown', keydownEvent);
148
- await wrapper.vm.$nextTick();
149
- expect(preventDefaultSpy).toHaveBeenCalled();
150
- expect(wrapper.emitted('click')).toBeFalsy();
151
- });
152
- });
153
-
154
- describe('given key is not Enter or Space', () => {
155
- test('should not preventDefault and not emit click event', async () => {
156
- const wrapper = mount(VButton);
157
- const keydownEvent = { key: 'a', preventDefault: () => {} };
158
- const preventDefaultSpy = vi.spyOn(keydownEvent, 'preventDefault');
159
- wrapper.trigger('keydown', keydownEvent);
160
- await wrapper.vm.$nextTick();
161
- expect(preventDefaultSpy).not.toHaveBeenCalled();
162
- expect(wrapper.emitted('click')).toBeFalsy();
163
- });
164
- });
165
- });
166
-
167
- describe('given keyup event', () => {
168
- describe('given key is Space', () => {
169
- test('should preventDefault and emit click event', async () => {
170
- const wrapper = mount(VButton);
171
- const keyupEvent = { key: ' ', preventDefault: () => {} };
172
- const preventDefaultSpy = vi.spyOn(keyupEvent, 'preventDefault');
173
- wrapper.trigger('keyup', keyupEvent);
174
- await wrapper.vm.$nextTick();
175
- expect(preventDefaultSpy).toHaveBeenCalled();
176
- expect(wrapper.emitted('click')).toBeTruthy();
177
- });
178
- });
179
- });
180
- });
@@ -1,76 +0,0 @@
1
- <script setup lang="ts">
2
- import { sizeProp, unstyledProp, variantProp } from '@/props';
3
- import { useSettings } from '@/services';
4
- import { computed } from 'vue';
5
-
6
- const props = defineProps({
7
- icon: {
8
- type: Boolean as () => boolean,
9
- default: false,
10
- },
11
- tag: {
12
- type: String as () => string,
13
- default: 'button',
14
- },
15
-
16
- size: sizeProp,
17
- variant: variantProp,
18
- unstyled: unstyledProp,
19
- });
20
- const emit = defineEmits<{ (event: 'click'): void }>();
21
-
22
- const activate = () => {
23
- emit('click');
24
- };
25
-
26
- const clickHandler = (event: MouseEvent) => {
27
- event.preventDefault();
28
- activate();
29
- };
30
-
31
- const keydownHandler = (event: KeyboardEvent) => {
32
- if (['Enter', ' '].includes(event.key)) event.preventDefault();
33
- if (event.key === 'Enter') activate();
34
- };
35
-
36
- const keyupHandler = (event: KeyboardEvent) => {
37
- if (event.key === ' ') {
38
- event.preventDefault();
39
- activate();
40
- }
41
- };
42
-
43
- const btnSize = computed(() => {
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';
55
- }
56
- });
57
-
58
- const { settings } = useSettings();
59
- const isUnstyled = settings.global.unstyled || settings.components.button.unstyled || props.unstyled;
60
- </script>
61
-
62
- <template>
63
- <component
64
- tabindex="0"
65
- role="button"
66
- :is="tag"
67
- :class="`vuetiful-button ${
68
- isUnstyled ? '' : `${icon ? 'btn-icon' : 'btn'} border-token hover:cursor-pointer`
69
- } ${btnSize} variant-${variant}`"
70
- @click="clickHandler"
71
- @keydown="keydownHandler"
72
- @keyup="keyupHandler"
73
- >
74
- <slot />
75
- </component>
76
- </template>
@@ -1,33 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { describe, expect, test } from 'vitest';
3
- import { VChip } from '.';
4
-
5
- describe('VChip', () => {
6
- test('default slot', () => {
7
- const wrapper = mount({
8
- template: `<v-chip>John Duck</v-chip>`,
9
- components: { VChip },
10
- });
11
-
12
- expect(wrapper.text()).toContain('John Duck');
13
- expect(wrapper.classes()).toContain('chip');
14
- });
15
-
16
- test('unstyled', () => {
17
- const wrapper = mount({
18
- template: `<v-chip unstyled>John Duck</v-chip>`,
19
- components: { VChip },
20
- });
21
-
22
- expect(wrapper.classes()).not.toContain('chip');
23
- });
24
-
25
- test('variant', () => {
26
- const wrapper = mount({
27
- template: `<v-chip variant="primary">John Duck</v-chip>`,
28
- components: { VChip },
29
- });
30
-
31
- expect(wrapper.classes()).toContain('variant-primary');
32
- });
33
- });