@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,55 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { describe, expect, test } from 'vitest';
3
- import VRadioGroup from './VRadioGroup.vue';
4
- import VRadioLabel from './VRadioLabel.vue';
5
-
6
- test('VRadioLabel using slot', () => {
7
- const wrapper = mount({
8
- template: `
9
- <v-radio-group>
10
- <v-radio-label>John Duck</v-radio-label>
11
- </v-radio-group>
12
- `,
13
- components: {
14
- 'v-radio-label': VRadioLabel,
15
- 'v-radio-group': VRadioGroup,
16
- },
17
- });
18
-
19
- expect(wrapper.text()).toContain('John Duck');
20
- });
21
-
22
- describe('VRadioLabel props', () => {
23
- test("default 'as' prop", () => {
24
- const wrapper = mount({
25
- template: `
26
- <v-radio-group>
27
- <v-radio-label data-test="label">John Duck</v-radio-label>
28
- </v-radio-group>
29
- `,
30
- components: {
31
- 'v-radio-label': VRadioLabel,
32
- 'v-radio-group': VRadioGroup,
33
- },
34
- });
35
-
36
- const label = wrapper.find("[data-test='label']");
37
- expect(label.element).toBeInstanceOf(HTMLParagraphElement);
38
- });
39
- test("custom 'as' prop", () => {
40
- const wrapper = mount({
41
- template: `
42
- <v-radio-group>
43
- <v-radio-label as="div" data-test="label">John Duck</v-radio-label>
44
- </v-radio-group>
45
- `,
46
- components: {
47
- 'v-radio-label': VRadioLabel,
48
- 'v-radio-group': VRadioGroup,
49
- },
50
- });
51
-
52
- const label = wrapper.find("[data-test='label']");
53
- expect(label.element).toBeInstanceOf(HTMLDivElement);
54
- });
55
- });
@@ -1,16 +0,0 @@
1
- <script setup lang="ts">
2
- import { RadioGroupLabel } from '@headlessui/vue';
3
-
4
- defineProps({
5
- as: {
6
- type: String,
7
- default: 'p',
8
- },
9
- });
10
- </script>
11
-
12
- <template>
13
- <RadioGroupLabel :as="as" class="vuetiful-radio-label">
14
- <slot />
15
- </RadioGroupLabel>
16
- </template>
@@ -1,100 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { describe, expect, test } from 'vitest';
3
- import VSwitch from './VSwitch.vue';
4
-
5
- describe('VSwitch props', () => {
6
- test('defaults', () => {
7
- const wrapper = mount(VSwitch);
8
-
9
- expect(wrapper.props()).toEqual({
10
- modelValue: false,
11
- disabled: false,
12
- size: 'md',
13
- classTrack: 'variant-filled',
14
- classThumb: 'bg-surface-100-800-token',
15
- as: 'button',
16
- name: '',
17
- unstyled: false,
18
- });
19
- });
20
-
21
- test('size xs', () => {
22
- const wrapper = mount(VSwitch, {
23
- props: {
24
- size: 'xs',
25
- },
26
- });
27
-
28
- const track = wrapper.find("[data-test='switch-track']");
29
- expect(track.attributes('class')).toContain('w-8 h-4');
30
- });
31
-
32
- test('size sm', () => {
33
- const wrapper = mount(VSwitch, {
34
- props: {
35
- size: 'sm',
36
- },
37
- });
38
-
39
- const track = wrapper.find("[data-test='switch-track']");
40
- expect(track.attributes('class')).toContain('w-12 h-6');
41
- });
42
-
43
- test('size md', () => {
44
- const wrapper = mount(VSwitch, {
45
- props: {
46
- size: 'md',
47
- },
48
- });
49
-
50
- const track = wrapper.find("[data-test='switch-track']");
51
- expect(track.attributes('class')).toContain('w-16 h-8');
52
- });
53
-
54
- test('size lg', () => {
55
- const wrapper = mount(VSwitch, {
56
- props: {
57
- size: 'lg',
58
- },
59
- });
60
-
61
- const track = wrapper.find("[data-test='switch-track']");
62
- expect(track.attributes('class')).toContain('w-20 h-10');
63
- });
64
-
65
- test('size xl', () => {
66
- const wrapper = mount(VSwitch, {
67
- props: {
68
- size: 'xl',
69
- },
70
- });
71
-
72
- const track = wrapper.find("[data-test='switch-track']");
73
- expect(track.attributes('class')).toContain('w-24 h-12');
74
- });
75
- });
76
-
77
- describe('VSwitch events', () => {
78
- test('update:modelValue', async () => {
79
- const wrapper = mount(VSwitch, {
80
- props: {
81
- modelValue: false,
82
- },
83
- });
84
-
85
- await wrapper.setProps({ modelValue: true });
86
- expect(wrapper.emitted()).toHaveProperty('update:modelValue');
87
- });
88
- });
89
-
90
- describe('VSwitch default slot', () => {
91
- test('default slot', () => {
92
- const wrapper = mount(VSwitch, {
93
- slots: {
94
- default: 'John Duck',
95
- },
96
- });
97
-
98
- expect(wrapper.text()).toContain('John Duck');
99
- });
100
- });
@@ -1,106 +0,0 @@
1
- <script setup lang="ts">
2
- import { useSettings } from '@/index';
3
- import { sizeProp, unstyledProp } from '@/props';
4
- import { Switch } from '@headlessui/vue';
5
- import { computed, ref, watch } from 'vue';
6
-
7
- const emit = defineEmits(['update:modelValue']);
8
- const props = defineProps({
9
- modelValue: {
10
- type: Boolean,
11
- default: false,
12
- },
13
- disabled: {
14
- type: Boolean,
15
- default: false,
16
- },
17
-
18
- classTrack: {
19
- type: String,
20
- default: 'variant-filled',
21
- },
22
- classThumb: {
23
- type: String,
24
- default: 'bg-surface-100-800-token',
25
- },
26
-
27
- as: {
28
- type: String,
29
- default: 'button',
30
- },
31
- name: {
32
- type: String,
33
- default: '',
34
- },
35
-
36
- size: sizeProp,
37
- unstyled: unstyledProp,
38
- });
39
-
40
- const parentModelValue = ref(props.modelValue);
41
- watch(
42
- () => props.modelValue,
43
- (newValue) => {
44
- parentModelValue.value = newValue;
45
- },
46
- );
47
- watch(
48
- () => parentModelValue.value,
49
- (newValue) => {
50
- emit('update:modelValue', newValue);
51
- },
52
- );
53
-
54
- const trackSize = computed(() => {
55
- switch (props.size) {
56
- case 'xs':
57
- return 'w-8 h-4';
58
- case 'sm':
59
- return 'w-12 h-6';
60
- case 'md':
61
- return 'w-16 h-8';
62
- case 'lg':
63
- return 'w-20 h-10';
64
- case 'xl':
65
- return 'w-24 h-12';
66
- }
67
- });
68
-
69
- const { settings } = useSettings();
70
- const isUnstyled = settings.global.unstyled || settings.components.switch.unstyled || props.unstyled;
71
- </script>
72
-
73
- <template>
74
- <!-- There is some odd behavior with test coverage, v-model must be the last property in this component -->
75
- <Switch
76
- data-test="switch"
77
- :class="`vuetiful-slide-toggle ${
78
- isUnstyled ? '' : `rounded-container-token ${disabled ? 'cursor-not-allowed opacity-50' : 'cursor-pointer'}`
79
- }`"
80
- :name="name"
81
- :as="as"
82
- v-slot="{ checked }"
83
- v-model="parentModelValue"
84
- >
85
- <div
86
- data-test="switch-track"
87
- :class="`vuetiful-slide-toggle-track flex ${
88
- isUnstyled ? '' : `transition-all duration-[150ms] border-token rounded-token`
89
- }
90
- ${disabled ? 'cursor-not-allowed' : 'cursor-pointer'}
91
- ${trackSize} ${classTrack}`"
92
- >
93
- <template v-if="$slots.default">
94
- <span class="sr-only"><slot /></span>
95
- </template>
96
- <div
97
- data-test="switch-thumb"
98
- :class="`vuetiful-slide-toggle-thumb w-[50%] scale-[0.8] ${
99
- isUnstyled ? '' : `bg-opactiy-90 shadow transition-all duration-[150ms] rounded-token `
100
- }
101
- ${disabled ? 'cursor-not-allowed' : 'cursor-pointer'}
102
- ${checked ? 'translate-x-full' : `${isUnstyled ? '' : 'opacity-90'}`} ${classThumb}`"
103
- ></div>
104
- </div>
105
- </Switch>
106
- </template>
@@ -1,55 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { describe, expect, test } from 'vitest';
3
- import VSwitchDescription from './VSwitchDescription.vue';
4
- import VSwitchGroup from './VSwitchGroup.vue';
5
-
6
- test('VSwitchDescription using slot', () => {
7
- const wrapper = mount({
8
- template: `
9
- <v-switch-group>
10
- <v-switch-label>John Duck</v-switch-label>
11
- </v-switch-group>
12
- `,
13
- components: {
14
- 'v-switch-label': VSwitchDescription,
15
- 'v-switch-group': VSwitchGroup,
16
- },
17
- });
18
-
19
- expect(wrapper.text()).toContain('John Duck');
20
- });
21
-
22
- describe('VSwitchDescription props', () => {
23
- test("default 'as' prop", () => {
24
- const wrapper = mount({
25
- template: `
26
- <v-switch-group>
27
- <v-switch-label data-test="label">John Duck</v-switch-label>
28
- </v-switch-group>
29
- `,
30
- components: {
31
- 'v-switch-label': VSwitchDescription,
32
- 'v-switch-group': VSwitchGroup,
33
- },
34
- });
35
-
36
- const label = wrapper.find("[data-test='label']");
37
- expect(label.element).toBeInstanceOf(HTMLParagraphElement);
38
- });
39
- test("custom 'as' prop", () => {
40
- const wrapper = mount({
41
- template: `
42
- <v-switch-group>
43
- <v-switch-label as="div" data-test="label">John Duck</v-switch-label>
44
- </v-switch-group>
45
- `,
46
- components: {
47
- 'v-switch-label': VSwitchDescription,
48
- 'v-switch-group': VSwitchGroup,
49
- },
50
- });
51
-
52
- const label = wrapper.find("[data-test='label']");
53
- expect(label.element).toBeInstanceOf(HTMLDivElement);
54
- });
55
- });
@@ -1,16 +0,0 @@
1
- <script setup lang="ts">
2
- import { SwitchDescription } from '@headlessui/vue';
3
-
4
- defineProps({
5
- as: {
6
- type: String,
7
- default: 'p',
8
- },
9
- });
10
- </script>
11
-
12
- <template>
13
- <SwitchDescription class="vuetiful-switch-description" :as="as">
14
- <slot />
15
- </SwitchDescription>
16
- </template>
@@ -1,26 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { describe, expect, test } from 'vitest';
3
- import VSwitchGroup from './VSwitchGroup.vue';
4
-
5
- test('VSwitchGroup using slot', () => {
6
- const wrapper = mount(VSwitchGroup as any, {
7
- slots: {
8
- default: 'John Duck',
9
- },
10
- });
11
-
12
- expect(wrapper.text()).toContain('John Duck');
13
- });
14
-
15
- describe('VSwitchGroup props', () => {
16
- test("custom 'as' prop", () => {
17
- const wrapper = mount(VSwitchGroup as any, {
18
- props: {
19
- as: 'div',
20
- },
21
- });
22
-
23
- const divEl = wrapper.find('div');
24
- expect(divEl).not.toBeUndefined();
25
- });
26
- });
@@ -1,16 +0,0 @@
1
- <script setup lang="ts">
2
- import { SwitchGroup } from '@headlessui/vue';
3
-
4
- defineProps({
5
- as: {
6
- type: String,
7
- default: 'div',
8
- },
9
- });
10
- </script>
11
-
12
- <template>
13
- <SwitchGroup class="vuetiful-switch-group" :as="as">
14
- <slot />
15
- </SwitchGroup>
16
- </template>
@@ -1,89 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { describe, expect, test } from 'vitest';
3
- import VSwitchGroup from './VSwitchGroup.vue';
4
- import VSwitchLabel from './VSwitchLabel.vue';
5
-
6
- test('VSwitchLabel using slot', () => {
7
- const wrapper = mount({
8
- template: `
9
- <v-switch-group>
10
- <v-switch-label>John Duck</v-switch-label>
11
- </v-switch-group>
12
- `,
13
- components: {
14
- 'v-switch-label': VSwitchLabel,
15
- 'v-switch-group': VSwitchGroup,
16
- },
17
- });
18
-
19
- expect(wrapper.text()).toContain('John Duck');
20
- });
21
-
22
- describe('VSwitchLabel props', () => {
23
- test("default 'as' prop", () => {
24
- const wrapper = mount({
25
- template: `
26
- <v-switch-group>
27
- <v-switch-label data-test="label">John Duck</v-switch-label>
28
- </v-switch-group>
29
- `,
30
- components: {
31
- 'v-switch-label': VSwitchLabel,
32
- 'v-switch-group': VSwitchGroup,
33
- },
34
- });
35
-
36
- const label = wrapper.find("[data-test='label']");
37
- expect(label.element).toBeInstanceOf(HTMLParagraphElement);
38
- });
39
- test("custom 'as' prop", () => {
40
- const wrapper = mount({
41
- template: `
42
- <v-switch-group>
43
- <v-switch-label as="div" data-test="label">John Duck</v-switch-label>
44
- </v-switch-group>
45
- `,
46
- components: {
47
- 'v-switch-label': VSwitchLabel,
48
- 'v-switch-group': VSwitchGroup,
49
- },
50
- });
51
-
52
- const label = wrapper.find("[data-test='label']");
53
- expect(label.element).toBeInstanceOf(HTMLDivElement);
54
- });
55
-
56
- test("default 'passive' prop'", () => {
57
- const wrapper = mount({
58
- template: `
59
- <v-switch-group>
60
- <v-switch-label>John Duck</v-switch-label>
61
- </v-switch-group>
62
- `,
63
- components: {
64
- 'v-switch-label': VSwitchLabel,
65
- 'v-switch-group': VSwitchGroup,
66
- },
67
- });
68
-
69
- const label = wrapper.findComponent(VSwitchLabel);
70
- expect(label.props('passive')).toBe(false);
71
- });
72
-
73
- test("custom 'passive' prop'", () => {
74
- const wrapper = mount({
75
- template: `
76
- <v-switch-group>
77
- <v-switch-label passive>John Duck</v-switch-label>
78
- </v-switch-group>
79
- `,
80
- components: {
81
- 'v-switch-label': VSwitchLabel,
82
- 'v-switch-group': VSwitchGroup,
83
- },
84
- });
85
-
86
- const label = wrapper.findComponent(VSwitchLabel);
87
- expect(label.props('passive')).toBe(true);
88
- });
89
- });
@@ -1,20 +0,0 @@
1
- <script setup lang="ts">
2
- import { SwitchLabel } from '@headlessui/vue';
3
-
4
- defineProps({
5
- as: {
6
- type: String,
7
- default: 'p',
8
- },
9
- passive: {
10
- type: Boolean,
11
- default: false,
12
- },
13
- });
14
- </script>
15
-
16
- <template>
17
- <SwitchLabel class="vuetiful-switch-label" :as="as" :passive="passive">
18
- <slot />
19
- </SwitchLabel>
20
- </template>
@@ -1,31 +0,0 @@
1
- import VAvatar from './VAvatar.vue';
2
- import VBadge from './VBadge.vue';
3
- import VButton from './VButton.vue';
4
- import VChip from './VChip.vue';
5
- import VLightSwitch from './VLightSwitch.vue';
6
-
7
- import VRadioDescription from './VRadio/VRadioDescription.vue';
8
- import VRadioGroup from './VRadio/VRadioGroup.vue';
9
- import VRadioItem from './VRadio/VRadioItem.vue';
10
- import VRadioLabel from './VRadio/VRadioLabel.vue';
11
-
12
- import VSwitch from './VSwitch/VSwitch.vue';
13
- import VSwitchDescription from './VSwitch/VSwitchDescription.vue';
14
- import VSwitchGroup from './VSwitch/VSwitchGroup.vue';
15
- import VSwitchLabel from './VSwitch/VSwitchLabel.vue';
16
-
17
- export {
18
- VAvatar,
19
- VButton,
20
- VBadge,
21
- VChip,
22
- VLightSwitch,
23
- VRadioGroup,
24
- VRadioItem,
25
- VRadioLabel,
26
- VRadioDescription,
27
- VSwitchGroup,
28
- VSwitchLabel,
29
- VSwitchDescription,
30
- VSwitch,
31
- };
@@ -1,2 +0,0 @@
1
- export * from './atoms';
2
- export * from './molecules';
@@ -1,27 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { describe, expect, test } from 'vitest';
3
- import { VAccordion } from '..';
4
-
5
- describe('VAccordion', () => {
6
- test('defaults', async () => {
7
- const wrapper = mount({
8
- template: /*html*/ `<v-accordion></v-accordion>`,
9
- components: {
10
- 'v-accordion': VAccordion,
11
- },
12
- });
13
-
14
- expect(wrapper.classes()).toEqual(['vuetiful-accordion', 'flex', 'w-full', 'flex-col', 'gap-1']);
15
- });
16
-
17
- test('unstyled', async () => {
18
- const wrapper = mount({
19
- template: /*html*/ `<v-accordion unstyled></v-accordion>`,
20
- components: {
21
- 'v-accordion': VAccordion,
22
- },
23
- });
24
-
25
- expect(wrapper.classes()).toEqual(['vuetiful-accordion']);
26
- });
27
- });
@@ -1,32 +0,0 @@
1
- <script setup lang="ts">
2
- import { useSettings } from '@/services';
3
- import { provide } from 'vue';
4
-
5
- const props = defineProps({
6
- classQuestion: {
7
- type: String,
8
- default: 'bg-surface-200-700-token hover:variant-soft',
9
- },
10
- classAnswer: {
11
- type: String,
12
- default: 'bg-surface-200-700-token',
13
- },
14
-
15
- unstyled: {
16
- type: Boolean,
17
- default: false,
18
- },
19
- });
20
-
21
- provide('classQuestion', props.classQuestion);
22
- provide('classAnswer', props.classAnswer);
23
-
24
- const { settings } = useSettings();
25
- const isUnstyled = settings.global.unstyled || settings.components.accordion.unstyled || props.unstyled;
26
- </script>
27
-
28
- <template>
29
- <div :class="`vuetiful-accordion ${isUnstyled ? '' : 'flex w-full flex-col gap-1'}`">
30
- <slot></slot>
31
- </div>
32
- </template>