@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
@@ -1,134 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { describe, expect, test } from 'vitest';
3
- import { VAccordion, VAccordionItem } from '..';
4
-
5
- describe('VAccordionItem', () => {
6
- test('defaults', async () => {
7
- const wrapper = mount({
8
- template: /*html*/ `
9
- <v-accordion>
10
- <v-accordion-item title="Vuetiful">John Duck</v-accordion-item>
11
- <v-accordion-item title="Is">Janine Duck</v-accordion-item>
12
- </v-accordion>`,
13
- components: {
14
- 'v-accordion': VAccordion,
15
- 'v-accordion-item': VAccordionItem,
16
- },
17
- });
18
-
19
- const accordionItems = wrapper.findAllComponents(VAccordionItem);
20
- accordionItems.forEach((accordionItem) => {
21
- expect(accordionItem.classes()).toEqual(['vuetiful-accordion-item']);
22
-
23
- const accordionItemButton = accordionItem.find('.vuetiful-accordion-item-button');
24
- expect(accordionItemButton.classes()).toEqual([
25
- 'items-center',
26
- 'justify-between',
27
- 'p-4',
28
- 'py-2',
29
- 'rounded-container-token',
30
- 'hover:cursor-pointer',
31
- 'bg-surface-200-700-token',
32
- 'hover:variant-soft',
33
- 'vuetiful-accordion-item-button',
34
- 'flex',
35
- 'w-full',
36
- ]);
37
-
38
- const accordionItemTitle = accordionItem.find('.vuetiful-accordion-title');
39
- expect(accordionItemTitle.text()).toEqual(accordionItem.props().title);
40
- });
41
- });
42
-
43
- test('unstyled', async () => {
44
- const wrapper = mount({
45
- template: /*html*/ `
46
- <v-accordion>
47
- <v-accordion-item title="Vuetiful" unstyled>John Duck</v-accordion-item>
48
- <v-accordion-item title="Is" unstyled>Janine Duck</v-accordion-item>
49
- </v-accordion>`,
50
- components: {
51
- 'v-accordion': VAccordion,
52
- 'v-accordion-item': VAccordionItem,
53
- },
54
- });
55
-
56
- const accordionItems = wrapper.findAllComponents(VAccordionItem);
57
- accordionItems.forEach((accordionItem) => {
58
- expect(accordionItem.classes()).toEqual(['vuetiful-accordion-item']);
59
-
60
- const accordionItemButton = accordionItem.find('.vuetiful-accordion-item-button');
61
- expect(accordionItemButton.classes()).toEqual([
62
- 'bg-surface-200-700-token',
63
- 'hover:variant-soft',
64
- 'vuetiful-accordion-item-button',
65
- 'flex',
66
- 'w-full',
67
- ]);
68
-
69
- const accordionItemTitle = accordionItem.find('.vuetiful-accordion-title');
70
- expect(accordionItemTitle.text()).toEqual(accordionItem.props().title);
71
- });
72
- });
73
-
74
- test('open', async () => {
75
- const wrapper = mount({
76
- template: /*html*/ `
77
- <v-accordion>
78
- <v-accordion-item title="Vuetiful" open>John Duck</v-accordion-item>
79
- <v-accordion-item title="Is">Janine Duck</v-accordion-item>
80
- </v-accordion>`,
81
- components: {
82
- 'v-accordion': VAccordion,
83
- 'v-accordion-item': VAccordionItem,
84
- },
85
- });
86
-
87
- const accordionItems = wrapper.findAllComponents(VAccordionItem);
88
- const accordionItemButtonOne = accordionItems[0].find('.vuetiful-accordion-item-button');
89
- const accordionItemButtonTwo = accordionItems[1].find('.vuetiful-accordion-item-button');
90
-
91
- await accordionItemButtonOne.trigger('click');
92
-
93
- expect(accordionItemButtonOne.classes()).toEqual([
94
- '!rounded-bl-none',
95
- '!rounded-br-none',
96
- 'items-center',
97
- 'justify-between',
98
- 'p-4',
99
- 'py-2',
100
- 'rounded-container-token',
101
- 'hover:cursor-pointer',
102
- 'bg-surface-200-700-token',
103
- 'hover:variant-soft',
104
- 'vuetiful-accordion-item-button',
105
- 'flex',
106
- 'w-full',
107
- ]);
108
- expect(accordionItemButtonTwo.classes()).toEqual([
109
- 'items-center',
110
- 'justify-between',
111
- 'p-4',
112
- 'py-2',
113
- 'rounded-container-token',
114
- 'hover:cursor-pointer',
115
- 'bg-surface-200-700-token',
116
- 'hover:variant-soft',
117
- 'vuetiful-accordion-item-button',
118
- 'flex',
119
- 'w-full',
120
- ]);
121
-
122
- const accordionItemPanelOne = accordionItems[0].find('.vuetiful-accordion-item-panel');
123
-
124
- expect(accordionItemPanelOne.classes()).toEqual([
125
- 'vuetiful-accordion-item-panel',
126
- '!rounded-tl-none',
127
- '!rounded-tr-none',
128
- 'p-4',
129
- 'py-2',
130
- 'rounded-container-token',
131
- 'bg-surface-200-700-token',
132
- ]);
133
- });
134
- });
@@ -1,68 +0,0 @@
1
- <script setup lang="ts">
2
- import { useSettings } from '@/services';
3
- import { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue';
4
- import { inject } from 'vue';
5
-
6
- const props = defineProps({
7
- title: {
8
- type: String,
9
- required: true,
10
- },
11
-
12
- unstyled: {
13
- type: Boolean,
14
- default: false,
15
- },
16
- });
17
-
18
- const classQuestion = inject('classQuestion');
19
- const classAnswer = inject('classAnswer');
20
-
21
- const { settings } = useSettings();
22
- const isUnstyled = settings.global.unstyled || settings.components.accordionItem.unstyled || props.unstyled;
23
- </script>
24
-
25
- <template>
26
- <Disclosure class="vuetiful-accordion-item" as="div" v-slot="{ open }">
27
- <DisclosureButton
28
- :class="`${isUnstyled ? '' : `${open ? '!rounded-bl-none !rounded-br-none' : ''}`}
29
- ${isUnstyled ? '' : 'items-center justify-between p-4 py-2 rounded-container-token hover:cursor-pointer'}
30
- ${classQuestion}`"
31
- class="vuetiful-accordion-item-button flex w-full"
32
- >
33
- <span class="vuetiful-accordion-title">{{ title }}</span>
34
- <slot v-if="!open" name="open-item">
35
- <!-- https://fontawesome.com/icons/plus?f=classic&s=solid -->
36
- <svg class="vuetiful-accordion-item-icon-plus icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
37
- <!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. -->
38
- <path
39
- d="M256 80c0-17.7-14.3-32-32-32s-32 14.3-32 32V224H48c-17.7 0-32 14.3-32 32s14.3 32 32 32H192V432c0 17.7 14.3 32 32 32s32-14.3 32-32V288H400c17.7 0 32-14.3 32-32s-14.3-32-32-32H256V80z"
40
- />
41
- </svg>
42
- </slot>
43
- <slot v-if="open" name="close-item">
44
- <!-- https://fontawesome.com/icons/minus?f=classic&s=solid -->
45
- <svg class="vuetiful-accordion-item-icon-minus icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
46
- <!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. -->
47
- <path
48
- d="M432 256c0 17.7-14.3 32-32 32L48 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l352 0c17.7 0 32 14.3 32 32z"
49
- />
50
- </svg>
51
- </slot>
52
- </DisclosureButton>
53
- <DisclosurePanel
54
- class="vuetiful-accordion-item-panel"
55
- :class="`${open ? `${isUnstyled ? '' : '!rounded-tl-none !rounded-tr-none'}` : ''} ${
56
- isUnstyled ? '' : 'p-4 py-2 rounded-container-token'
57
- } ${classAnswer}`"
58
- >
59
- <slot></slot>
60
- </DisclosurePanel>
61
- </Disclosure>
62
- </template>
63
-
64
- <style scoped>
65
- .icon {
66
- @apply my-1 h-4 min-h-[1rem] w-4 min-w-[1rem] fill-current;
67
- }
68
- </style>
@@ -1,100 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { describe, expect, test } from 'vitest';
3
- import { VAlert } from '..';
4
-
5
- describe('VAlert', () => {
6
- test('types', () => {
7
- const wrapper = mount({
8
- template: /*html*/ `
9
- <v-alert data-test="default"></v-alert>
10
- <v-alert data-test="info" type="info"></v-alert>
11
- <v-alert data-test="success" type="success"></v-alert>
12
- <v-alert data-test="warning" type="warning"></v-alert>
13
- <v-alert data-test="error" type="error"></v-alert>
14
- `,
15
- components: {
16
- 'v-alert': VAlert,
17
- },
18
- });
19
-
20
- const defaultAlert = wrapper.find('[data-test=default]');
21
- expect(defaultAlert.classes()).not.toContain('variant-filled-primary');
22
-
23
- const infoAlert = wrapper.find('[data-test=info]');
24
- expect(infoAlert.classes()).toContain('variant-filled');
25
-
26
- const successAlert = wrapper.find('[data-test=success]');
27
- expect(successAlert.classes()).toContain('variant-filled-success');
28
-
29
- const warningAlert = wrapper.find('[data-test=warning]');
30
- expect(warningAlert.classes()).toContain('variant-filled-warning');
31
- });
32
-
33
- test('unstyled', () => {
34
- const wrapper = mount(VAlert, {
35
- props: {
36
- unstyled: true,
37
- },
38
- });
39
-
40
- expect(wrapper.classes()).toEqual(['vuetiful-alert', 'flex']);
41
- });
42
-
43
- describe('given close icon is clicked', () => {
44
- test('should emit close', async () => {
45
- const wrapper = mount(VAlert, { props: { showClose: true } });
46
- await wrapper.find('[data-test=close]').trigger('click');
47
- expect(wrapper.emitted()['close'][0]).toEqual([]);
48
-
49
- await wrapper.find('[data-test=close]').trigger('keydown', { key: 'Enter' });
50
- expect(wrapper.emitted()['close'][0]).toEqual([]);
51
-
52
- await wrapper.find('[data-test=close]').trigger('keydown', { key: ' ' });
53
- expect(wrapper.emitted()['close'][0]).toEqual([]);
54
- });
55
- });
56
-
57
- describe('given a pre slot is provided', () => {
58
- test('should render the pre slot', () => {
59
- const wrapper = mount(VAlert, {
60
- slots: {
61
- pre: 'John Duck',
62
- },
63
- });
64
- expect(wrapper.text()).toContain('John Duck');
65
- });
66
- });
67
-
68
- describe('given a actions slot is provided', () => {
69
- test('should render the actions slot', () => {
70
- const wrapper = mount(VAlert, {
71
- slots: {
72
- actions: 'John Duck',
73
- },
74
- });
75
- expect(wrapper.text()).toContain('John Duck');
76
- });
77
- });
78
-
79
- describe('given hide-icon prop is present', () => {
80
- test('should not render an icon', () => {
81
- const wrapper = mount(VAlert, {
82
- props: {
83
- hideIcon: true,
84
- },
85
- });
86
- expect(wrapper.findAll('.icon').length).toBe(0);
87
- });
88
- });
89
-
90
- describe('given show-close prop is present', () => {
91
- test('should render a close icon', () => {
92
- const wrapper = mount(VAlert, {
93
- props: {
94
- showClose: true,
95
- },
96
- });
97
- expect(wrapper.find('[data-test=close]').exists()).toBe(true);
98
- });
99
- });
100
- });
@@ -1,137 +0,0 @@
1
- <script setup lang="ts">
2
- import { useSettings } from '@/services';
3
- import { PropType, computed } from 'vue';
4
-
5
- const emit = defineEmits(['close']);
6
- const props = defineProps({
7
- hideIcon: {
8
- type: Boolean,
9
- default: false,
10
- },
11
- showClose: {
12
- type: Boolean,
13
- default: false,
14
- },
15
-
16
- show: {
17
- type: Boolean,
18
- default: true,
19
- },
20
- type: {
21
- type: String as PropType<'info' | 'success' | 'warning' | 'error' | ''>,
22
- default: '',
23
- },
24
-
25
- classPre: {
26
- type: String,
27
- default: '',
28
- },
29
- classMessage: {
30
- type: String,
31
- default: '',
32
- },
33
- classClose: {
34
- type: String,
35
- default: '',
36
- },
37
-
38
- unstyled: {
39
- type: Boolean,
40
- default: false,
41
- },
42
- });
43
-
44
- const typeBackground = computed(() => {
45
- switch (props.type) {
46
- case 'info':
47
- return 'variant-filled';
48
- case 'success':
49
- return 'variant-filled-success';
50
- case 'warning':
51
- return 'variant-filled-warning';
52
- case 'error':
53
- return 'variant-filled-error';
54
- case '':
55
- return '';
56
- }
57
- });
58
-
59
- const close = () => emit('close');
60
- const handleKeydown = (event: KeyboardEvent) => {
61
- if (event.key === 'Enter' || event.key === ' ') {
62
- close();
63
- }
64
- };
65
-
66
- const { settings } = useSettings();
67
- const isUnstyled = settings.global.unstyled || settings.components.alert.unstyled || props.unstyled;
68
- </script>
69
-
70
- <template>
71
- <aside
72
- v-if="show"
73
- :class="`vuetiful-alert flex ${
74
- isUnstyled ? '' : 'w-full items-center gap-4 p-4 border-token rounded-container-token'
75
- } ${typeBackground}`"
76
- >
77
- <div v-if="!hideIcon" :class="`vuetiful-alert-pre ${classPre}`">
78
- <slot v-if="$slots.pre" name="pre" />
79
- <template v-if="!$slots.pre">
80
- <!-- https://fontawesome.com/icons/circle-info?f=classic&s=solid -->
81
- <svg v-if="type === 'info'" class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
82
- <path
83
- d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"
84
- />
85
- </svg>
86
-
87
- <!-- https://fontawesome.com/icons/circle-check?f=classic&s=solid -->
88
- <svg v-if="type === 'success'" class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
89
- <path
90
- d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"
91
- />
92
- </svg>
93
-
94
- <!-- https://fontawesome.com/icons/circle-exclamation?f=classic&s=solid -->
95
- <svg v-if="type === 'warning'" class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
96
- <path
97
- d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"
98
- />
99
- </svg>
100
-
101
- <!-- https://fontawesome.com/icons/triangle-exclamation?f=classic&s=solid -->
102
- <svg v-if="type === 'error'" class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
103
- <path
104
- d="M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"
105
- />
106
- </svg>
107
- </template>
108
- </div>
109
-
110
- <div :class="`vuetiful-alert-message ${isUnstyled ? '' : 'flex-auto'} ${classMessage}`">
111
- <slot />
112
- </div>
113
-
114
- <slot name="actions"> </slot>
115
- <!-- https://fontawesome.com/icons/xmark?f=classic&s=solid -->
116
- <svg
117
- data-test="close"
118
- v-if="showClose"
119
- tabindex="0"
120
- @keydown="handleKeydown"
121
- @click="close"
122
- :class="`vuetiful-alert-close-icon icon hover:cursor-pointer ${classClose}`"
123
- xmlns="http://www.w3.org/2000/svg"
124
- viewBox="0 0 384 512"
125
- >
126
- <path
127
- d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"
128
- />
129
- </svg>
130
- </aside>
131
- </template>
132
-
133
- <style scoped>
134
- .icon {
135
- @apply my-1 h-6 min-h-[1.5rem] w-6 min-w-[1.5rem] fill-current;
136
- }
137
- </style>
@@ -1,47 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { describe, expect, test } from 'vitest';
3
- import { VCard } from '..';
4
-
5
- describe('VCard', () => {
6
- test('defaults', async () => {
7
- const wrapper = mount(VCard);
8
- expect(wrapper.props()).toEqual({
9
- background: 'bg-surface-200-700-token',
10
- clickable: false,
11
- hideSeparator: false,
12
- text: 'text-surface-900-50-token',
13
- unstyled: false,
14
- });
15
- });
16
-
17
- describe('given the card is clicked', () => {
18
- describe('given the card is not clickable', () => {
19
- test('should not emit click', async () => {
20
- const wrapper = mount(VCard, { props: { clickable: false } });
21
- expect(wrapper.attributes()['tabindex']).toBeUndefined();
22
- await wrapper.trigger('click');
23
- expect(wrapper.emitted()['click']).toBeUndefined();
24
-
25
- await wrapper.trigger('keydown', { key: 'Enter' });
26
- expect(wrapper.emitted()['click']).toBeUndefined();
27
-
28
- await wrapper.trigger('keydown', { key: ' ' });
29
- expect(wrapper.emitted()['click']).toBeUndefined();
30
- });
31
- });
32
- describe('given the card is clickable', () => {
33
- test('should emit click', async () => {
34
- const wrapper = mount(VCard, { props: { clickable: true } });
35
- expect(wrapper.attributes()['tabindex']).toEqual('0');
36
- await wrapper.trigger('click');
37
- expect(wrapper.emitted()['click'].length).toEqual(1);
38
-
39
- await wrapper.trigger('keydown', { key: 'Enter' });
40
- expect(wrapper.emitted()['click'].length).toEqual(2);
41
-
42
- await wrapper.trigger('keydown', { key: ' ' });
43
- expect(wrapper.emitted()['click'].length).toEqual(3);
44
- });
45
- });
46
- });
47
- });
@@ -1,74 +0,0 @@
1
- <script setup lang="ts">
2
- import { useSettings } from '@/index';
3
- import { unstyledProp } from '@/props';
4
- import { provide } from 'vue';
5
-
6
- const emit = defineEmits(['click']);
7
-
8
- const props = defineProps({
9
- hideSeparator: {
10
- type: Boolean,
11
- default: false,
12
- },
13
- background: {
14
- type: String,
15
- default: 'bg-surface-200-700-token',
16
- },
17
- text: {
18
- type: String,
19
- default: 'text-surface-900-50-token',
20
- },
21
- clickable: {
22
- type: Boolean,
23
- default: false,
24
- },
25
-
26
- unstyled: unstyledProp,
27
- });
28
-
29
- provide('hideSeparator', props.hideSeparator);
30
-
31
- const onClick = () => {
32
- if (!props.clickable) return;
33
- emit('click');
34
- };
35
- const onKeydown = (event: KeyboardEvent) => {
36
- if (!props.clickable) return;
37
- if (event.key === 'Enter') {
38
- event.preventDefault();
39
- emit('click');
40
- }
41
- if (event.key === ' ') {
42
- event.preventDefault();
43
- emit('click');
44
- }
45
- };
46
-
47
- const { settings } = useSettings();
48
- const isUnstyled = settings.global.unstyled || settings.components.card.unstyled || props.unstyled;
49
- </script>
50
-
51
- <template>
52
- <div
53
- @click="onClick"
54
- @keydown="onKeydown"
55
- :tabindex="clickable ? 0 : undefined"
56
- :class="`vuetiful-card flex flex-col ${
57
- isUnstyled ? '' : 'border-token rounded-container-token ring-outline-token'
58
- } ${background} ${text} ${clickable ? `${isUnstyled ? '' : 'card-hover'} hover:cursor-pointer` : ''}`"
59
- >
60
- <slot />
61
- </div>
62
- </template>
63
-
64
- <style>
65
- .vuetiful-card-header {
66
- border-top-left-radius: inherit;
67
- border-top-right-radius: inherit;
68
- }
69
-
70
- .vuetiful-card-header > * {
71
- border-top-left-radius: inherit;
72
- border-top-right-radius: inherit;
73
- }
74
- </style>
@@ -1,39 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { describe, expect, test } from 'vitest';
3
- import { VCard, VCardBody } from '..';
4
-
5
- describe('VCardBody', () => {
6
- test('unstyled', () => {
7
- const wrapper = mount({
8
- template: /*html*/ `
9
- <v-card>
10
- <v-card-body unstyled>John Duck</v-card-body>
11
- </v-card>
12
- `,
13
- components: {
14
- 'v-card': VCard,
15
- 'v-card-body': VCardBody,
16
- },
17
- });
18
-
19
- const content = wrapper.find("[data-test='vuetiful-card-body-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-body>John Duck</v-card-body>
29
- </v-card>
30
- `,
31
- components: {
32
- 'v-card': VCard,
33
- 'v-card-body': VCardBody,
34
- },
35
- });
36
-
37
- expect(wrapper.text()).toEqual('John Duck');
38
- });
39
- });
@@ -1,16 +0,0 @@
1
- <script setup lang="ts">
2
- import { unstyledProp } from '@/props';
3
- import { useSettings } from '@/services';
4
-
5
- const props = defineProps({
6
- unstyled: unstyledProp,
7
- });
8
-
9
- const { settings } = useSettings();
10
- const isUnstyled = settings.global.unstyled || settings.components.cardBody.unstyled || props.unstyled;
11
- </script>
12
- <template>
13
- <div data-test="vuetiful-card-body-content" :class="`vuetiful-card-body ${isUnstyled ? '' : 'p-4'}`">
14
- <slot />
15
- </div>
16
- </template>
@@ -1,63 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { describe, expect, test } from 'vitest';
3
- import { VCard, VCardFooter } from '..';
4
-
5
- describe('VCardFooter', () => {
6
- test('unstyled', () => {
7
- const wrapper = mount({
8
- template: /*html*/ `
9
- <v-card>
10
- <v-card-footer unstyled>John Duck</v-card-footer>
11
- </v-card>
12
- `,
13
- components: {
14
- 'v-card': VCard,
15
- 'v-card-footer': VCardFooter,
16
- },
17
- });
18
-
19
- const content = wrapper.find("[data-test='vuetiful-card-footer-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-footer>John Duck</v-card-footer>
29
- </v-card>
30
- `,
31
- components: {
32
- 'v-card': VCard,
33
- 'v-card-footer': VCardFooter,
34
- },
35
- });
36
-
37
- const separator = wrapper.find("[data-test='vuetiful-card-footer-separator']");
38
- const content = wrapper.find("[data-test='vuetiful-card-footer-content']");
39
- expect(separator.element.tagName).toEqual('HR');
40
- expect(content.text()).toEqual('John Duck');
41
- });
42
-
43
- describe('given hideSeparator is true', () => {
44
- test('should not show separator', async () => {
45
- const wrapper = mount({
46
- template: /*html*/ `
47
- <v-card hide-separator>
48
- <v-card-footer>John Duck</v-card-footer>
49
- </v-card>
50
- `,
51
- components: {
52
- 'v-card': VCard,
53
- 'v-card-footer': VCardFooter,
54
- },
55
- });
56
-
57
- const separator = wrapper.find("[data-test='vuetiful-card-footer-separator']");
58
- const content = wrapper.find("[data-test='vuetiful-card-footer-content']");
59
- expect(separator.exists()).toEqual(false);
60
- expect(content.text()).toEqual('John Duck');
61
- });
62
- });
63
- });