@code-coaching/vuetiful 0.26.0 → 0.28.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 (266) 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/dist/css/transitions/fade.css +9 -0
  5. package/{src/styles → dist/css}/transitions/slide.css +0 -24
  6. package/dist/favicon.ico +0 -0
  7. package/dist/types/components/atoms/VAvatar.vue.d.ts +39 -90
  8. package/dist/types/components/atoms/VBadge.vue.d.ts +34 -21
  9. package/dist/types/components/atoms/VButton.vue.d.ts +42 -48
  10. package/dist/types/components/atoms/VChip.vue.d.ts +33 -21
  11. package/dist/types/components/atoms/VRadio/VRadioDescription.vue.d.ts +7 -12
  12. package/dist/types/components/atoms/VRadio/VRadioGroup.vue.d.ts +54 -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 +52 -73
  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/atoms/index.d.ts +1 -2
  20. package/dist/types/components/molecules/VAccordion/VAccordion.vue.d.ts +39 -28
  21. package/dist/types/components/molecules/VAccordion/VAccordionItem.vue.d.ts +35 -19
  22. package/dist/types/components/molecules/VAlert.vue.d.ts +50 -73
  23. package/dist/types/components/molecules/VCard/VCard.vue.d.ts +37 -48
  24. package/dist/types/components/molecules/VCard/VCardBody.vue.d.ts +33 -12
  25. package/dist/types/components/molecules/VCard/VCardFooter.vue.d.ts +36 -20
  26. package/dist/types/components/molecules/VCard/VCardHeader.vue.d.ts +36 -20
  27. package/dist/types/components/molecules/VCodeBlock.vue.d.ts +15 -16
  28. package/dist/types/components/molecules/VDrawer.vue.d.ts +13 -7
  29. package/dist/types/components/molecules/VListbox/VListbox.vue.d.ts +54 -132
  30. package/dist/types/components/molecules/VListbox/VListboxButton.vue.d.ts +22 -21
  31. package/dist/types/components/molecules/VListbox/VListboxItem.vue.d.ts +22 -19
  32. package/dist/types/components/molecules/VListbox/VListboxItems.vue.d.ts +19 -30
  33. package/dist/types/components/molecules/VListbox/VListboxLabel.vue.d.ts +7 -12
  34. package/dist/types/components/molecules/VPreview.vue.d.ts +57 -74
  35. package/dist/types/components/molecules/VRail/VRail.vue.d.ts +28 -13
  36. package/dist/types/components/molecules/VRail/VRailTile.vue.d.ts +49 -16
  37. package/dist/types/components/molecules/VShell.vue.d.ts +76 -44
  38. package/dist/types/components/molecules/VShellConfigurator.vue.d.ts +99 -0
  39. package/dist/types/components/molecules/VTabs/VTab.vue.d.ts +52 -20
  40. package/dist/types/components/molecules/VTabs/VTabPanel.vue.d.ts +8 -1
  41. package/dist/types/components/molecules/VTabs/VTabs.vue.d.ts +43 -101
  42. package/dist/types/components/molecules/Vuetiful.vue.d.ts +22 -0
  43. package/dist/types/components/molecules/index.d.ts +3 -4
  44. package/dist/types/directives/click-outside-group.d.ts +1 -1
  45. package/dist/types/directives/click-outside.d.ts +1 -1
  46. package/dist/types/directives/clipboard.d.ts +1 -1
  47. package/dist/types/index.d.ts +1 -8
  48. package/dist/types/props/props.d.ts +1 -14
  49. package/dist/types/services/drawer.service.d.ts +2 -2
  50. package/dist/types/services/index.d.ts +3 -4
  51. package/dist/types/utils/id-generator.d.ts +1 -0
  52. package/dist/types/utils/index.d.ts +7 -5
  53. package/dist/types/utils/tailwind-merge.d.ts +1 -0
  54. package/dist/types/utils/theme/VLightSwitch.vue.d.ts +16 -0
  55. package/dist/types/utils/theme/VThemeSwitch.vue.d.ts +41 -0
  56. package/dist/types/{services → utils/theme}/dark-mode.service.d.ts +1 -1
  57. package/dist/types/utils/theme/rocket.theme.d.ts +223 -0
  58. package/dist/types/utils/theme/theme.service.d.ts +6 -9
  59. package/dist/types/utils/theme/themes.d.ts +3 -39
  60. package/dist/types/utils/theme/vuetiful.theme.d.ts +224 -0
  61. package/dist/vuetiful.es.mjs +54782 -49507
  62. package/dist/vuetiful.umd.cjs +189 -0
  63. package/package.json +53 -37
  64. package/dist/style.css +0 -10
  65. package/dist/types/components/VBootstrap.vue.d.ts +0 -15
  66. package/dist/types/components/atoms/VAvatar.test.d.ts +0 -1
  67. package/dist/types/components/atoms/VBadge.test.d.ts +0 -1
  68. package/dist/types/components/atoms/VButton.test.d.ts +0 -1
  69. package/dist/types/components/atoms/VChip.test.d.ts +0 -1
  70. package/dist/types/components/atoms/VLightSwitch.test.d.ts +0 -1
  71. package/dist/types/components/atoms/VLightSwitch.vue.d.ts +0 -95
  72. package/dist/types/components/atoms/VRadio/VRadioDescription.test.d.ts +0 -1
  73. package/dist/types/components/atoms/VRadio/VRadioGroup.test.d.ts +0 -1
  74. package/dist/types/components/atoms/VRadio/VRadioItem.test.d.ts +0 -1
  75. package/dist/types/components/atoms/VRadio/VRadioLabel.test.d.ts +0 -1
  76. package/dist/types/components/atoms/VSwitch/VSwitch.test.d.ts +0 -1
  77. package/dist/types/components/atoms/VSwitch/VSwitchDescription.test.d.ts +0 -1
  78. package/dist/types/components/atoms/VSwitch/VSwitchGroup.test.d.ts +0 -1
  79. package/dist/types/components/atoms/VSwitch/VSwitchLabel.test.d.ts +0 -1
  80. package/dist/types/components/molecules/VAccordion/VAccordion.test.d.ts +0 -1
  81. package/dist/types/components/molecules/VAccordion/VAccordionItem.test.d.ts +0 -1
  82. package/dist/types/components/molecules/VAlert.test.d.ts +0 -1
  83. package/dist/types/components/molecules/VCard/VCard.test.d.ts +0 -1
  84. package/dist/types/components/molecules/VCard/VCardBody.test.d.ts +0 -1
  85. package/dist/types/components/molecules/VCard/VCardFooter.test.d.ts +0 -1
  86. package/dist/types/components/molecules/VCard/VCardHeader.test.d.ts +0 -1
  87. package/dist/types/components/molecules/VCodeBlock.test.d.ts +0 -1
  88. package/dist/types/components/molecules/VDrawer.test.d.ts +0 -1
  89. package/dist/types/components/molecules/VListbox/VListbox.test.d.ts +0 -1
  90. package/dist/types/components/molecules/VListbox/VListboxButton.test.d.ts +0 -1
  91. package/dist/types/components/molecules/VListbox/VListboxItem.test.d.ts +0 -1
  92. package/dist/types/components/molecules/VListbox/VListboxItems.test.d.ts +0 -1
  93. package/dist/types/components/molecules/VListbox/VListboxLabel.test.d.ts +0 -1
  94. package/dist/types/components/molecules/VPreview.test.d.ts +0 -1
  95. package/dist/types/components/molecules/VRail/VRail.test.d.ts +0 -1
  96. package/dist/types/components/molecules/VRail/VRailTile.test.d.ts +0 -1
  97. package/dist/types/components/molecules/VShell.test.d.ts +0 -1
  98. package/dist/types/components/molecules/VTabs/VTab.test.d.ts +0 -1
  99. package/dist/types/components/molecules/VTabs/VTabPanel.test.d.ts +0 -1
  100. package/dist/types/components/molecules/VTabs/VTabs.test.d.ts +0 -1
  101. package/dist/types/directives/click-outside-group.test.d.ts +0 -1
  102. package/dist/types/directives/click-outside.test.d.ts +0 -1
  103. package/dist/types/directives/clipboard.test.d.ts +0 -1
  104. package/dist/types/services/dark-mode.service.test.d.ts +0 -1
  105. package/dist/types/services/drawer.service.test.d.ts +0 -1
  106. package/dist/types/services/highlight.service.test.d.ts +0 -1
  107. package/dist/types/services/rail.service.test.d.ts +0 -1
  108. package/dist/types/services/settings.service.test.d.ts +0 -1
  109. package/dist/types/types/index.d.ts +0 -54
  110. package/dist/types/types/tailwind.d.ts +0 -4
  111. package/dist/types/utils/colors/colors.service.d.ts +0 -69
  112. package/dist/types/utils/platform/platform.service.test.d.ts +0 -1
  113. package/dist/types/utils/theme/callback.test.d.ts +0 -1
  114. package/dist/types/utils/theme/remove.test.d.ts +0 -1
  115. package/dist/types/utils/theme/theme-switcher.vue.d.ts +0 -69
  116. package/dist/types/utils/theme/theme.service.test.d.ts +0 -1
  117. package/dist/vuetiful.umd.js +0 -99
  118. package/src/assets/fonts/myfont.woff +0 -0
  119. package/src/assets/main.css +0 -17
  120. package/src/components/VBootstrap.vue +0 -62
  121. package/src/components/atoms/VAvatar.test.ts +0 -175
  122. package/src/components/atoms/VAvatar.vue +0 -89
  123. package/src/components/atoms/VBadge.test.ts +0 -28
  124. package/src/components/atoms/VBadge.vue +0 -17
  125. package/src/components/atoms/VButton.test.ts +0 -180
  126. package/src/components/atoms/VButton.vue +0 -76
  127. package/src/components/atoms/VChip.test.ts +0 -33
  128. package/src/components/atoms/VChip.vue +0 -17
  129. package/src/components/atoms/VLightSwitch.test.ts +0 -69
  130. package/src/components/atoms/VLightSwitch.vue +0 -121
  131. package/src/components/atoms/VRadio/VRadioDescription.test.ts +0 -55
  132. package/src/components/atoms/VRadio/VRadioDescription.vue +0 -14
  133. package/src/components/atoms/VRadio/VRadioGroup.test.ts +0 -81
  134. package/src/components/atoms/VRadio/VRadioGroup.vue +0 -88
  135. package/src/components/atoms/VRadio/VRadioItem.test.ts +0 -183
  136. package/src/components/atoms/VRadio/VRadioItem.vue +0 -36
  137. package/src/components/atoms/VRadio/VRadioLabel.test.ts +0 -55
  138. package/src/components/atoms/VRadio/VRadioLabel.vue +0 -16
  139. package/src/components/atoms/VSwitch/VSwitch.test.ts +0 -100
  140. package/src/components/atoms/VSwitch/VSwitch.vue +0 -106
  141. package/src/components/atoms/VSwitch/VSwitchDescription.test.ts +0 -55
  142. package/src/components/atoms/VSwitch/VSwitchDescription.vue +0 -16
  143. package/src/components/atoms/VSwitch/VSwitchGroup.test.ts +0 -26
  144. package/src/components/atoms/VSwitch/VSwitchGroup.vue +0 -16
  145. package/src/components/atoms/VSwitch/VSwitchLabel.test.ts +0 -89
  146. package/src/components/atoms/VSwitch/VSwitchLabel.vue +0 -20
  147. package/src/components/atoms/index.ts +0 -31
  148. package/src/components/index.ts +0 -2
  149. package/src/components/molecules/VAccordion/VAccordion.test.ts +0 -27
  150. package/src/components/molecules/VAccordion/VAccordion.vue +0 -32
  151. package/src/components/molecules/VAccordion/VAccordionItem.test.ts +0 -134
  152. package/src/components/molecules/VAccordion/VAccordionItem.vue +0 -68
  153. package/src/components/molecules/VAlert.test.ts +0 -100
  154. package/src/components/molecules/VAlert.vue +0 -137
  155. package/src/components/molecules/VCard/VCard.test.ts +0 -47
  156. package/src/components/molecules/VCard/VCard.vue +0 -74
  157. package/src/components/molecules/VCard/VCardBody.test.ts +0 -39
  158. package/src/components/molecules/VCard/VCardBody.vue +0 -16
  159. package/src/components/molecules/VCard/VCardFooter.test.ts +0 -63
  160. package/src/components/molecules/VCard/VCardFooter.vue +0 -31
  161. package/src/components/molecules/VCard/VCardHeader.test.ts +0 -86
  162. package/src/components/molecules/VCard/VCardHeader.vue +0 -53
  163. package/src/components/molecules/VCodeBlock.test.ts +0 -133
  164. package/src/components/molecules/VCodeBlock.vue +0 -113
  165. package/src/components/molecules/VDrawer.test.ts +0 -14
  166. package/src/components/molecules/VDrawer.vue +0 -87
  167. package/src/components/molecules/VListbox/VListbox.test.ts +0 -146
  168. package/src/components/molecules/VListbox/VListbox.vue +0 -149
  169. package/src/components/molecules/VListbox/VListboxButton.test.ts +0 -66
  170. package/src/components/molecules/VListbox/VListboxButton.vue +0 -57
  171. package/src/components/molecules/VListbox/VListboxItem.test.ts +0 -51
  172. package/src/components/molecules/VListbox/VListboxItem.vue +0 -39
  173. package/src/components/molecules/VListbox/VListboxItems.test.ts +0 -44
  174. package/src/components/molecules/VListbox/VListboxItems.vue +0 -42
  175. package/src/components/molecules/VListbox/VListboxLabel.test.ts +0 -30
  176. package/src/components/molecules/VListbox/VListboxLabel.vue +0 -14
  177. package/src/components/molecules/VPreview.test.ts +0 -73
  178. package/src/components/molecules/VPreview.vue +0 -230
  179. package/src/components/molecules/VRail/VRail.test.ts +0 -14
  180. package/src/components/molecules/VRail/VRail.vue +0 -33
  181. package/src/components/molecules/VRail/VRailTile.test.ts +0 -97
  182. package/src/components/molecules/VRail/VRailTile.vue +0 -49
  183. package/src/components/molecules/VShell.test.ts +0 -14
  184. package/src/components/molecules/VShell.vue +0 -63
  185. package/src/components/molecules/VTabs/VTab.test.ts +0 -143
  186. package/src/components/molecules/VTabs/VTab.vue +0 -50
  187. package/src/components/molecules/VTabs/VTabPanel.test.ts +0 -24
  188. package/src/components/molecules/VTabs/VTabPanel.vue +0 -9
  189. package/src/components/molecules/VTabs/VTabs.test.ts +0 -92
  190. package/src/components/molecules/VTabs/VTabs.vue +0 -104
  191. package/src/components/molecules/index.ts +0 -51
  192. package/src/directives/click-outside-group.test.ts +0 -44
  193. package/src/directives/click-outside-group.ts +0 -39
  194. package/src/directives/click-outside.test.ts +0 -38
  195. package/src/directives/click-outside.ts +0 -28
  196. package/src/directives/clipboard.test.ts +0 -26
  197. package/src/directives/clipboard.ts +0 -9
  198. package/src/directives/index.ts +0 -5
  199. package/src/env.d.ts +0 -8
  200. package/src/index.ts +0 -21
  201. package/src/props/index.ts +0 -1
  202. package/src/props/props.ts +0 -62
  203. package/src/services/dark-mode.service.test.ts +0 -104
  204. package/src/services/dark-mode.service.ts +0 -75
  205. package/src/services/drawer.service.test.ts +0 -45
  206. package/src/services/drawer.service.ts +0 -46
  207. package/src/services/highlight.service.test.ts +0 -24
  208. package/src/services/highlight.service.ts +0 -19
  209. package/src/services/index.ts +0 -8
  210. package/src/services/rail.service.test.ts +0 -13
  211. package/src/services/rail.service.ts +0 -11
  212. package/src/services/settings.service.test.ts +0 -17
  213. package/src/services/settings.service.ts +0 -136
  214. package/src/styles/all.css +0 -24
  215. package/src/styles/core.css +0 -66
  216. package/src/styles/elements/alerts.css +0 -17
  217. package/src/styles/elements/badges.css +0 -31
  218. package/src/styles/elements/breadcrumbs.css +0 -26
  219. package/src/styles/elements/buttons.css +0 -103
  220. package/src/styles/elements/cards.css +0 -32
  221. package/src/styles/elements/chips.css +0 -22
  222. package/src/styles/elements/forms.css +0 -269
  223. package/src/styles/elements/lists.css +0 -48
  224. package/src/styles/elements/logo-clouds.css +0 -29
  225. package/src/styles/elements/modals.css +0 -15
  226. package/src/styles/elements/placeholders.css +0 -17
  227. package/src/styles/elements/popups.css +0 -16
  228. package/src/styles/elements/tables.css +0 -102
  229. package/src/styles/elements.css +0 -19
  230. package/src/styles/highlight-js.css +0 -116
  231. package/src/styles/tailwind.css +0 -16
  232. package/src/styles/transitions/fade.css +0 -14
  233. package/src/styles/transitions.css +0 -2
  234. package/src/styles/typography.css +0 -101
  235. package/src/styles/variants.css +0 -156
  236. package/src/tailwind/core.cjs +0 -37
  237. package/src/tailwind/generated/intellisense-classes.cjs +0 -558
  238. package/src/tailwind/intellisense.cjs +0 -21
  239. package/src/tailwind/settings.cjs +0 -20
  240. package/src/tailwind/theme/colors.cjs +0 -20
  241. package/src/tailwind/tokens/backgrounds.cjs +0 -48
  242. package/src/tailwind/tokens/border-radius.cjs +0 -21
  243. package/src/tailwind/tokens/borders.cjs +0 -24
  244. package/src/tailwind/tokens/fills.cjs +0 -20
  245. package/src/tailwind/tokens/rings.cjs +0 -50
  246. package/src/tailwind/tokens/text.cjs +0 -35
  247. package/src/tailwind/vuetiful.cjs +0 -19
  248. package/src/themes/theme-rocket.css +0 -119
  249. package/src/themes/theme-sahara.css +0 -128
  250. package/src/themes/theme-seafoam.css +0 -120
  251. package/src/themes/theme-seasonal.css +0 -115
  252. package/src/themes/theme-skeleton.css +0 -115
  253. package/src/themes/theme-vintage.css +0 -125
  254. package/src/themes/theme-vuetiful.css +0 -136
  255. package/src/types/index.ts +0 -59
  256. package/src/types/tailwind.ts +0 -7
  257. package/src/utils/colors/colors.service.ts +0 -293
  258. package/src/utils/index.ts +0 -8
  259. package/src/utils/platform/platform.service.test.ts +0 -19
  260. package/src/utils/platform/platform.service.ts +0 -8
  261. package/src/utils/theme/callback.test.ts +0 -28
  262. package/src/utils/theme/remove.test.ts +0 -27
  263. package/src/utils/theme/theme-switcher.vue +0 -78
  264. package/src/utils/theme/theme.service.test.ts +0 -269
  265. package/src/utils/theme/theme.service.ts +0 -173
  266. package/src/utils/theme/themes.ts +0 -282
@@ -1,149 +0,0 @@
1
- <script setup lang="ts">
2
- import { CssClasses, useSettings } from '@/index';
3
- import { Listbox } from '@headlessui/vue';
4
- import { computed, provide, ref, watch } from 'vue';
5
- import VListboxButton from './VListboxButton.vue';
6
- import VListboxItems from './VListboxItems.vue';
7
- import VListboxLabel from './VListboxLabel.vue';
8
- import { unstyledProp } from '@/props';
9
-
10
- const emit = defineEmits(['update:modelValue']);
11
- const props = defineProps({
12
- modelValue: Listbox.props['modelValue'],
13
-
14
- by: {
15
- type: String,
16
- },
17
- display: {
18
- type: String,
19
- },
20
-
21
- textLabel: {
22
- type: String,
23
- },
24
- classLabel: {
25
- type: String as () => CssClasses,
26
- default: '',
27
- },
28
-
29
- textButton: {
30
- type: String,
31
- default: 'Select an option',
32
- },
33
- classButton: {
34
- type: String as () => CssClasses,
35
- default: '',
36
- },
37
-
38
- classItem: {
39
- type: String as () => CssClasses,
40
- default: '',
41
- },
42
- classItems: {
43
- type: String as () => CssClasses,
44
- default: '',
45
- },
46
-
47
- horizontal: {
48
- type: Boolean,
49
- default: false,
50
- },
51
- multiple: {
52
- type: Boolean,
53
- default: false,
54
- },
55
-
56
- active: {
57
- type: String,
58
- default: 'variant-filled',
59
- },
60
- hover: {
61
- type: String,
62
- default: 'hover:variant-ghost',
63
- },
64
-
65
- background: {
66
- type: String,
67
- default: 'bg-surface-200-700-token',
68
- },
69
- text: {
70
- type: String,
71
- default: 'text-surface-900 dark:text-surface-50',
72
- },
73
-
74
- unstyled: unstyledProp,
75
- });
76
-
77
- const parentModelValue = ref(props.modelValue);
78
- watch(
79
- () => props.modelValue,
80
- (newValue) => {
81
- parentModelValue.value = newValue;
82
- },
83
- );
84
- watch(
85
- () => parentModelValue.value,
86
- (newValue) => {
87
- emit('update:modelValue', newValue);
88
- },
89
- );
90
-
91
- provide('active', props.active);
92
- provide('hover', props.hover);
93
- provide('background', props.background);
94
- provide('text', props.text);
95
- provide('horizontal', props.horizontal);
96
- provide('unstyled', props.unstyled);
97
- provide('classItem', props.classItem);
98
- provide('classItems', props.classItems);
99
-
100
- const showText = computed(() => {
101
- if (props.display && parentModelValue.value) return parentModelValue.value[props.display];
102
-
103
- const length = parentModelValue.value?.length;
104
- if (props.multiple && length === 0) return props.textButton;
105
- if (props.multiple && length === 1) return parentModelValue.value[0];
106
- if (props.multiple && length > 1) return `${length} options selected`; // TODO: i18n
107
-
108
- if (parentModelValue.value) return parentModelValue.value;
109
-
110
- return props.textButton;
111
- });
112
-
113
- const { settings } = useSettings();
114
- const isUnstyled = settings.global.unstyled || settings.components.listbox.unstyled || props.unstyled;
115
- </script>
116
-
117
- <template>
118
- <!-- There is some odd behavior with test coverage, v-model must be the last property in this component -->
119
- <Listbox
120
- data-test="listbox"
121
- as="div"
122
- :by="by"
123
- :multiple="multiple"
124
- :class="`vuetiful-listbox ${isUnstyled ? '' : 'relative rounded-container-token'}`"
125
- v-model="parentModelValue"
126
- >
127
- <v-listbox-label v-if="textLabel" :class="classLabel">{{ textLabel }}</v-listbox-label>
128
- <v-listbox-button data-test="listbox-button" :class="`${background} ${text} ${classButton}`">
129
- {{ showText }}
130
- </v-listbox-button>
131
- <!-- TODO: Add configurable transition -->
132
- <transition
133
- enter-active-class="transition duration-150 ease-in-out"
134
- enter-from-class="opacity-0"
135
- enter-to-class="opacity-100"
136
- leave-active-class="transition duration-150 ease-in-out"
137
- leave-from-class="opacity-100"
138
- leave-to-class="opacity-0"
139
- >
140
- <v-listbox-items
141
- data-test="listbox-items"
142
- :unstyled="unstyled"
143
- :class="`${isUnstyled ? '' : 'absolute mt-1 min-w-full'}`"
144
- >
145
- <slot />
146
- </v-listbox-items>
147
- </transition>
148
- </Listbox>
149
- </template>
@@ -1,66 +0,0 @@
1
- import { Listbox } from '@headlessui/vue';
2
- import { mount } from '@vue/test-utils';
3
- import { describe, expect, test } from 'vitest';
4
- import VListboxButton from './VListboxButton.vue';
5
-
6
- describe('VListboxButton props', () => {
7
- test('defaults', () => {
8
- const wrapper = mount({
9
- provide: {
10
- unstyled: false,
11
- },
12
- template: /* html */ `
13
- <Listbox>
14
- <v-listbox-button data-test="listbox-button">John Duck</v-listbox-button>
15
- </Listbox>
16
- `,
17
- components: {
18
- 'v-listbox-button': VListboxButton,
19
- Listbox: Listbox,
20
- },
21
- });
22
-
23
- const listboxButton = wrapper.find("[data-test='listbox-button']");
24
- expect(listboxButton.element.tagName).toBe('BUTTON');
25
- });
26
-
27
- test("custom 'as' prop", () => {
28
- const wrapper = mount({
29
- provide: {
30
- unstyled: false,
31
- },
32
- template: /* html */ `
33
- <Listbox>
34
- <v-listbox-button as="div" data-test="listbox-button">John Duck</v-listbox-button>
35
- </Listbox>
36
- `,
37
- components: {
38
- 'v-listbox-button': VListboxButton,
39
- Listbox: Listbox,
40
- },
41
- });
42
-
43
- const listboxButton = wrapper.find("[data-test='listbox-button']");
44
- expect(listboxButton.element.tagName).toBe('DIV');
45
- });
46
-
47
- test('should hide icon', () => {
48
- const wrapper = mount({
49
- provide: {
50
- unstyled: false,
51
- },
52
- template: /* html */ `
53
- <Listbox>
54
- <v-listbox-button hide-icon data-test="listbox-button">John Duck</v-listbox-button>
55
- </Listbox>
56
- `,
57
- components: {
58
- 'v-listbox-button': VListboxButton,
59
- Listbox: Listbox,
60
- },
61
- });
62
-
63
- const listboxButton = wrapper.find("[data-test='listbox-button']");
64
- expect(listboxButton.find('svg').exists()).toBe(false);
65
- });
66
- });
@@ -1,57 +0,0 @@
1
- <script setup lang="ts">
2
- import { useSettings } from '@/index';
3
- import { ListboxButton } from '@headlessui/vue';
4
- import { inject } from 'vue';
5
-
6
- defineProps({
7
- as: {
8
- type: String,
9
- default: 'button',
10
- },
11
- hideIcon: {
12
- type: Boolean,
13
- default: false,
14
- },
15
- });
16
-
17
- const unstyled = inject('unstyled') as boolean;
18
-
19
- const { settings } = useSettings();
20
- const isUnstyled = settings.global.unstyled || settings.components.listbox.unstyled || unstyled;
21
- </script>
22
-
23
- <template>
24
- <ListboxButton
25
- v-slot="{ open }"
26
- :as="as"
27
- :class="`vuetiful-listbox-button ${
28
- isUnstyled ? 'flex' : 'variant-filled btn flex w-full justify-between active:scale-[100%]'
29
- }`"
30
- >
31
- <slot />
32
- <span v-if="!hideIcon">
33
- <slot v-if="!open" name="open-icon">
34
- <!-- https://fontawesome.com/icons/chevron-down?f=classic&s=solid -->
35
- <svg class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
36
- <path
37
- d="M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"
38
- />
39
- </svg>
40
- </slot>
41
- <slot v-if="open" name="close-icon">
42
- <!-- https://fontawesome.com/icons/chevron-up?f=classic&s=solid -->
43
- <svg class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
44
- <path
45
- d="M233.4 105.4c12.5-12.5 32.8-12.5 45.3 0l192 192c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L256 173.3 86.6 342.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l192-192z"
46
- />
47
- </svg>
48
- </slot>
49
- </span>
50
- </ListboxButton>
51
- </template>
52
-
53
- <style scoped>
54
- .icon {
55
- @apply my-1 h-4 w-4 fill-current;
56
- }
57
- </style>
@@ -1,51 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { describe, expect, test } from 'vitest';
3
- import { ref } from 'vue';
4
- import VListbox from './VListbox.vue';
5
- import VListboxItem from './VListboxItem.vue';
6
-
7
- describe('VListboxItem props', () => {
8
- test('defaults', async () => {
9
- const listboxValue = ref('John');
10
- const wrapper = mount({
11
- setup() {
12
- return { listboxValue };
13
- },
14
- template: /* html */ `
15
- <v-listbox v-model="listboxValue">
16
- <v-listbox-item value="John">John Duck</v-listbox-item>
17
- <v-listbox-item value="Jane">Jane Duck</v-listbox-item>
18
- </v-listbox>
19
- `,
20
- components: {
21
- 'v-listbox': VListbox,
22
- 'v-listbox-item': VListboxItem,
23
- },
24
- });
25
-
26
- const listbox = wrapper.find("[data-test='listbox']");
27
- await listbox.find('button').trigger('click');
28
-
29
- const listboxItems = listbox.findAll("[data-test='listbox-item']");
30
- const selectedItem = listboxItems[0];
31
- const normalItem = listboxItems[1];
32
- expect(selectedItem.classes()).toEqual([
33
- 'vuetiful-listbox-item',
34
- 'px-4',
35
- 'py-1',
36
- 'text-base',
37
- 'rounded-token',
38
- 'variant-filled',
39
- 'cursor-pointer',
40
- ]);
41
- expect(normalItem.classes()).toEqual([
42
- 'vuetiful-listbox-item',
43
- 'px-4',
44
- 'py-1',
45
- 'text-base',
46
- 'rounded-token',
47
- 'hover:variant-ghost',
48
- 'cursor-pointer',
49
- ]);
50
- });
51
- });
@@ -1,39 +0,0 @@
1
- <script setup lang="ts">
2
- import { useSettings } from '@/services';
3
- import { ListboxOption } from '@headlessui/vue';
4
- import { inject } from 'vue';
5
-
6
- const props = defineProps({
7
- value: {
8
- type: [String, Number, Boolean, Object],
9
- required: true,
10
- },
11
-
12
- unstyled: {
13
- type: Boolean,
14
- default: false,
15
- },
16
- });
17
-
18
- const activeClass = inject('active') as string;
19
- const hoverClass = inject('hover') as string;
20
- const classItem = inject('classItem') as string;
21
-
22
- const { settings } = useSettings();
23
- const isUnstyled = settings.global.unstyled || settings.components.listboxItem.unstyled || props.unstyled;
24
- </script>
25
-
26
- <template>
27
- <ListboxOption v-slot="{ selected, disabled, active }" :value="value">
28
- <div
29
- data-test="listbox-item"
30
- :class="`vuetiful-listbox-item ${isUnstyled ? '' : 'px-4 py-1 text-base rounded-token'}
31
- ${selected ? activeClass : hoverClass}
32
- ${disabled ? 'cursor-not-allowed opacity-50' : 'cursor-pointer'}
33
- ${active && !selected ? hoverClass : ''}
34
- ${classItem}`"
35
- >
36
- <slot />
37
- </div>
38
- </ListboxOption>
39
- </template>
@@ -1,44 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { expect, test } from 'vitest';
3
- import VListbox from './VListbox.vue';
4
- import VListboxItem from './VListboxItem.vue';
5
-
6
- test('VListboxItems defaults', async () => {
7
- const wrapper = mount({
8
- template: /*html*/ `
9
- <v-listbox>
10
- <v-listbox-item value="John">John Duck</v-listbox-item>
11
- </v-listbox>
12
- `,
13
- components: {
14
- 'v-listbox': VListbox,
15
- 'v-listbox-item': VListboxItem,
16
- },
17
- });
18
-
19
- const listbox = wrapper.find("[data-test='listbox']");
20
- await listbox.find('button').trigger('click');
21
-
22
- const listboxItems = listbox.find("[data-test='listbox-items']");
23
- expect(listboxItems.classes()).toContain('flex-col');
24
- });
25
-
26
- test('VListboxItems horizontal', async () => {
27
- const wrapper = mount({
28
- template: /*html*/ `
29
- <v-listbox horizontal>
30
- <v-listbox-item value="John">John Duck</v-listbox-item>
31
- </v-listbox>
32
- `,
33
- components: {
34
- 'v-listbox': VListbox,
35
- 'v-listbox-item': VListboxItem,
36
- },
37
- });
38
-
39
- const listbox = wrapper.find("[data-test='listbox']");
40
- await listbox.find('button').trigger('click');
41
-
42
- const listboxItems = listbox.find("[data-test='listbox-items']");
43
- expect(listboxItems.classes()).not.toContain('flex-col');
44
- });
@@ -1,42 +0,0 @@
1
- <script setup lang="ts">
2
- import { useSettings } from '@/index';
3
- import { ListboxOptions } from '@headlessui/vue';
4
- import { inject } from 'vue';
5
-
6
- const props = defineProps({
7
- as: {
8
- type: String,
9
- default: 'ul',
10
- },
11
- static: {
12
- type: Boolean,
13
- default: false,
14
- },
15
-
16
- unstyled: {
17
- type: Boolean,
18
- default: false,
19
- },
20
- });
21
-
22
- const background = inject('background') as string;
23
- const text = inject('text') as string;
24
- const horizontal = inject('horizontal') as boolean;
25
- const classItems = inject('classItems') as string;
26
-
27
- const { settings } = useSettings();
28
- const isUnstyled = settings.global.unstyled || settings.components.listbox.unstyled || props.unstyled;
29
- </script>
30
-
31
- <template>
32
- <ListboxOptions
33
- :as="as"
34
- :static="static"
35
- :class="`z-10 ${
36
- isUnstyled ? '' : `rounded-container-token' gap-1 p-4 border-token border-surface-400-500-token`
37
- } ${background} ${text} ${horizontal ? 'flex' : 'flex-col'} ${classItems}`"
38
- data-test="listbox-items"
39
- >
40
- <slot />
41
- </ListboxOptions>
42
- </template>
@@ -1,30 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { expect, test } from 'vitest';
3
- import VListbox from './VListbox.vue';
4
-
5
- test('VListboxLabel using slot', () => {
6
- const wrapper = mount({
7
- template: `
8
- <v-listbox></v-listbox>
9
- `,
10
- components: {
11
- 'v-listbox': VListbox,
12
- },
13
- });
14
-
15
- expect(wrapper.text()).toBe('Select an option');
16
- });
17
-
18
- test('VListboxLabel custom label', () => {
19
- const wrapper = mount({
20
- template: `
21
- <v-listbox text-label="John Duck"></v-listbox>
22
- `,
23
- components: {
24
- 'v-listbox': VListbox,
25
- },
26
- });
27
-
28
- const label = wrapper.find('label');
29
- expect(label.text()).toBe('John Duck');
30
- });
@@ -1,14 +0,0 @@
1
- <script setup lang="ts">
2
- import { ListboxLabel } from '@headlessui/vue';
3
-
4
- defineProps({
5
- as: {
6
- type: String,
7
- default: 'label',
8
- },
9
- });
10
- </script>
11
-
12
- <template>
13
- <ListboxLabel class="vuetiful-listbox-label" :as="as"><slot /></ListboxLabel>
14
- </template>
@@ -1,73 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { describe, expect, test } from 'vitest';
3
- import { VPreview } from '.';
4
-
5
- test('VPreview', () => {
6
- expect(VPreview).toBeTruthy();
7
- });
8
-
9
- describe('VPreview', () => {
10
- test('defaults', () => {
11
- const wrapper = mount(VPreview);
12
-
13
- expect(wrapper.props()).toEqual({
14
- background: 'neutral',
15
- hideSwatches: false,
16
- regionFooter: '',
17
- regionHeader: '',
18
- regionPreview: '',
19
- regionSource: '',
20
- regionViewport: '',
21
- hideMobileToggle: false,
22
- });
23
- });
24
-
25
- describe('given code radio item is selected', () => {
26
- test('renders source code', async () => {
27
- const wrapper = mount(VPreview, {
28
- props: {
29
- regionSource: 'source',
30
- },
31
- });
32
-
33
- expect(wrapper.find("[data-test='previewer-source']").exists()).toBe(false);
34
- expect(wrapper.find("[data-test='previewer-preview']").exists()).toBe(true);
35
-
36
- const radioItemCode = wrapper.find("[data-test='radio-item-code']");
37
- await radioItemCode.trigger('click');
38
-
39
- expect(wrapper.find("[data-test='previewer-source']").exists()).toBe(true);
40
- expect(wrapper.find("[data-test='previewer-preview']").exists()).toBe(false);
41
- });
42
- });
43
-
44
- describe('given the swatch button is clicked', () => {
45
- test('renders swatches', async () => {
46
- const wrapper = mount(VPreview);
47
-
48
- expect(wrapper.find("[data-test='swatches']").exists()).toBe(false);
49
-
50
- const swatchButton = wrapper.find("[data-test='swatch-button']");
51
- await swatchButton.trigger('click');
52
-
53
- expect(wrapper.find("[data-test='swatches']").exists()).toBe(true);
54
- });
55
- });
56
-
57
- describe('given the mobile toggle button is clicked', () => {
58
- test('renders mobile preview', async () => {
59
- const wrapper = mount(VPreview);
60
-
61
- const before = wrapper.find("[data-test='previewer-preview']");
62
- expect(before.classes()).not.toContain('mobile-screen');
63
- expect(before.classes()).toContain('w-full');
64
-
65
- const radioItemMobile = wrapper.find("[data-test='radio-item-mobile']");
66
- await radioItemMobile.trigger('click');
67
-
68
- const after = wrapper.find("[data-test='previewer-preview']");
69
- expect(after.classes()).toContain('mobile-screen');
70
- expect(after.classes()).not.toContain('w-full');
71
- });
72
- });
73
- });