@code-coaching/vuetiful 0.25.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/README.md +47 -55
  2. package/dist/css/animations.css +2 -0
  3. package/{src → dist}/css/overrides/quasar.css +73 -58
  4. package/{src/styles → dist/css}/transitions/slide.css +6 -0
  5. package/dist/favicon.ico +0 -0
  6. package/dist/types/components/atoms/VAvatar.vue.d.ts +39 -90
  7. package/dist/types/components/atoms/VBadge.vue.d.ts +34 -21
  8. package/dist/types/components/atoms/VButton.vue.d.ts +42 -48
  9. package/dist/types/components/atoms/VChip.vue.d.ts +33 -21
  10. package/dist/types/components/atoms/VLightSwitch.vue.d.ts +5 -5
  11. package/dist/types/components/atoms/VRadio/VRadioDescription.vue.d.ts +7 -12
  12. package/dist/types/components/atoms/VRadio/VRadioGroup.vue.d.ts +53 -83
  13. package/dist/types/components/atoms/VRadio/VRadioItem.vue.d.ts +46 -12
  14. package/dist/types/components/atoms/VRadio/VRadioLabel.vue.d.ts +7 -12
  15. package/dist/types/components/atoms/VSwitch/VSwitch.vue.d.ts +51 -72
  16. package/dist/types/components/atoms/VSwitch/VSwitchDescription.vue.d.ts +32 -11
  17. package/dist/types/components/atoms/VSwitch/VSwitchGroup.vue.d.ts +32 -11
  18. package/dist/types/components/atoms/VSwitch/VSwitchLabel.vue.d.ts +33 -20
  19. package/dist/types/components/molecules/VAccordion/VAccordion.vue.d.ts +39 -28
  20. package/dist/types/components/molecules/VAccordion/VAccordionItem.vue.d.ts +35 -19
  21. package/dist/types/components/molecules/VAlert.vue.d.ts +50 -73
  22. package/dist/types/components/molecules/VCard/VCard.vue.d.ts +37 -48
  23. package/dist/types/components/molecules/VCard/VCardBody.vue.d.ts +33 -12
  24. package/dist/types/components/molecules/VCard/VCardFooter.vue.d.ts +36 -20
  25. package/dist/types/components/molecules/VCard/VCardHeader.vue.d.ts +36 -20
  26. package/dist/types/components/molecules/VCodeBlock.vue.d.ts +15 -16
  27. package/dist/types/components/molecules/VDrawer.vue.d.ts +13 -7
  28. package/dist/types/components/molecules/VListbox/VListbox.vue.d.ts +54 -132
  29. package/dist/types/components/molecules/VListbox/VListboxButton.vue.d.ts +22 -21
  30. package/dist/types/components/molecules/VListbox/VListboxItem.vue.d.ts +22 -19
  31. package/dist/types/components/molecules/VListbox/VListboxItems.vue.d.ts +19 -30
  32. package/dist/types/components/molecules/VListbox/VListboxLabel.vue.d.ts +7 -12
  33. package/dist/types/components/molecules/VPreview.vue.d.ts +57 -74
  34. package/dist/types/components/molecules/VRail/VRail.vue.d.ts +28 -13
  35. package/dist/types/components/molecules/VRail/VRailTile.vue.d.ts +49 -16
  36. package/dist/types/components/molecules/VShell.vue.d.ts +76 -44
  37. package/dist/types/components/molecules/VShellConfigurator.vue.d.ts +99 -0
  38. package/dist/types/components/molecules/VTabs/VTab.vue.d.ts +52 -20
  39. package/dist/types/components/molecules/VTabs/VTabPanel.vue.d.ts +8 -1
  40. package/dist/types/components/molecules/VTabs/VTabs.vue.d.ts +43 -101
  41. package/dist/types/components/molecules/Vuetiful.vue.d.ts +22 -0
  42. package/dist/types/components/molecules/index.d.ts +3 -4
  43. package/dist/types/directives/click-outside-group.d.ts +9 -0
  44. package/dist/types/directives/click-outside.d.ts +9 -0
  45. package/dist/types/directives/clipboard.d.ts +1 -1
  46. package/dist/types/directives/index.d.ts +3 -1
  47. package/dist/types/index.d.ts +1 -8
  48. package/dist/types/props/props.d.ts +1 -14
  49. package/dist/types/services/dark-mode.service.d.ts +1 -1
  50. package/dist/types/services/drawer.service.d.ts +3 -3
  51. package/dist/types/services/index.d.ts +2 -2
  52. package/dist/types/utils/id-generator.d.ts +1 -0
  53. package/dist/types/utils/index.d.ts +3 -4
  54. package/dist/types/utils/tailwind-merge.d.ts +1 -0
  55. package/dist/types/utils/theme/rocket.theme.d.ts +223 -0
  56. package/dist/types/utils/theme/theme-switcher.vue.d.ts +14 -5
  57. package/dist/types/utils/theme/theme.service.d.ts +6 -9
  58. package/dist/types/utils/theme/themes.d.ts +3 -39
  59. package/dist/types/utils/theme/vuetiful.theme.d.ts +224 -0
  60. package/dist/vuetiful.es.mjs +54837 -49494
  61. package/dist/vuetiful.umd.cjs +189 -0
  62. package/package.json +53 -37
  63. package/dist/style.css +0 -10
  64. package/dist/types/components/VBootstrap.vue.d.ts +0 -15
  65. package/dist/types/components/atoms/VAvatar.test.d.ts +0 -1
  66. package/dist/types/components/atoms/VBadge.test.d.ts +0 -1
  67. package/dist/types/components/atoms/VButton.test.d.ts +0 -1
  68. package/dist/types/components/atoms/VChip.test.d.ts +0 -1
  69. package/dist/types/components/atoms/VLightSwitch.test.d.ts +0 -1
  70. package/dist/types/components/atoms/VRadio/VRadioDescription.test.d.ts +0 -1
  71. package/dist/types/components/atoms/VRadio/VRadioGroup.test.d.ts +0 -1
  72. package/dist/types/components/atoms/VRadio/VRadioItem.test.d.ts +0 -1
  73. package/dist/types/components/atoms/VRadio/VRadioLabel.test.d.ts +0 -1
  74. package/dist/types/components/atoms/VSwitch/VSwitch.test.d.ts +0 -1
  75. package/dist/types/components/atoms/VSwitch/VSwitchDescription.test.d.ts +0 -1
  76. package/dist/types/components/atoms/VSwitch/VSwitchGroup.test.d.ts +0 -1
  77. package/dist/types/components/atoms/VSwitch/VSwitchLabel.test.d.ts +0 -1
  78. package/dist/types/components/molecules/VAccordion/VAccordion.test.d.ts +0 -1
  79. package/dist/types/components/molecules/VAccordion/VAccordionItem.test.d.ts +0 -1
  80. package/dist/types/components/molecules/VAlert.test.d.ts +0 -1
  81. package/dist/types/components/molecules/VCard/VCard.test.d.ts +0 -1
  82. package/dist/types/components/molecules/VCard/VCardBody.test.d.ts +0 -1
  83. package/dist/types/components/molecules/VCard/VCardFooter.test.d.ts +0 -1
  84. package/dist/types/components/molecules/VCard/VCardHeader.test.d.ts +0 -1
  85. package/dist/types/components/molecules/VCodeBlock.test.d.ts +0 -1
  86. package/dist/types/components/molecules/VDrawer.test.d.ts +0 -1
  87. package/dist/types/components/molecules/VListbox/VListbox.test.d.ts +0 -1
  88. package/dist/types/components/molecules/VListbox/VListboxButton.test.d.ts +0 -1
  89. package/dist/types/components/molecules/VListbox/VListboxItem.test.d.ts +0 -1
  90. package/dist/types/components/molecules/VListbox/VListboxItems.test.d.ts +0 -1
  91. package/dist/types/components/molecules/VListbox/VListboxLabel.test.d.ts +0 -1
  92. package/dist/types/components/molecules/VPreview.test.d.ts +0 -1
  93. package/dist/types/components/molecules/VRail/VRail.test.d.ts +0 -1
  94. package/dist/types/components/molecules/VRail/VRailTile.test.d.ts +0 -1
  95. package/dist/types/components/molecules/VShell.test.d.ts +0 -1
  96. package/dist/types/components/molecules/VTabs/VTab.test.d.ts +0 -1
  97. package/dist/types/components/molecules/VTabs/VTabPanel.test.d.ts +0 -1
  98. package/dist/types/components/molecules/VTabs/VTabs.test.d.ts +0 -1
  99. package/dist/types/directives/clipboard.test.d.ts +0 -1
  100. package/dist/types/services/dark-mode.service.test.d.ts +0 -1
  101. package/dist/types/services/drawer.service.test.d.ts +0 -1
  102. package/dist/types/services/highlight.service.test.d.ts +0 -1
  103. package/dist/types/services/rail.service.test.d.ts +0 -1
  104. package/dist/types/services/settings.service.test.d.ts +0 -1
  105. package/dist/types/types/index.d.ts +0 -54
  106. package/dist/types/types/tailwind.d.ts +0 -4
  107. package/dist/types/utils/colors/colors.service.d.ts +0 -69
  108. package/dist/types/utils/platform/platform.service.test.d.ts +0 -1
  109. package/dist/types/utils/theme/callback.test.d.ts +0 -1
  110. package/dist/types/utils/theme/remove.test.d.ts +0 -1
  111. package/dist/types/utils/theme/theme.service.test.d.ts +0 -1
  112. package/dist/vuetiful.umd.js +0 -99
  113. package/src/assets/fonts/myfont.woff +0 -0
  114. package/src/assets/main.css +0 -17
  115. package/src/components/VBootstrap.vue +0 -62
  116. package/src/components/atoms/VAvatar.test.ts +0 -175
  117. package/src/components/atoms/VAvatar.vue +0 -89
  118. package/src/components/atoms/VBadge.test.ts +0 -28
  119. package/src/components/atoms/VBadge.vue +0 -17
  120. package/src/components/atoms/VButton.test.ts +0 -180
  121. package/src/components/atoms/VButton.vue +0 -76
  122. package/src/components/atoms/VChip.test.ts +0 -33
  123. package/src/components/atoms/VChip.vue +0 -17
  124. package/src/components/atoms/VLightSwitch.test.ts +0 -69
  125. package/src/components/atoms/VLightSwitch.vue +0 -121
  126. package/src/components/atoms/VRadio/VRadioDescription.test.ts +0 -55
  127. package/src/components/atoms/VRadio/VRadioDescription.vue +0 -14
  128. package/src/components/atoms/VRadio/VRadioGroup.test.ts +0 -81
  129. package/src/components/atoms/VRadio/VRadioGroup.vue +0 -88
  130. package/src/components/atoms/VRadio/VRadioItem.test.ts +0 -183
  131. package/src/components/atoms/VRadio/VRadioItem.vue +0 -36
  132. package/src/components/atoms/VRadio/VRadioLabel.test.ts +0 -55
  133. package/src/components/atoms/VRadio/VRadioLabel.vue +0 -16
  134. package/src/components/atoms/VSwitch/VSwitch.test.ts +0 -100
  135. package/src/components/atoms/VSwitch/VSwitch.vue +0 -106
  136. package/src/components/atoms/VSwitch/VSwitchDescription.test.ts +0 -55
  137. package/src/components/atoms/VSwitch/VSwitchDescription.vue +0 -16
  138. package/src/components/atoms/VSwitch/VSwitchGroup.test.ts +0 -26
  139. package/src/components/atoms/VSwitch/VSwitchGroup.vue +0 -16
  140. package/src/components/atoms/VSwitch/VSwitchLabel.test.ts +0 -89
  141. package/src/components/atoms/VSwitch/VSwitchLabel.vue +0 -20
  142. package/src/components/atoms/index.ts +0 -31
  143. package/src/components/index.ts +0 -2
  144. package/src/components/molecules/VAccordion/VAccordion.test.ts +0 -27
  145. package/src/components/molecules/VAccordion/VAccordion.vue +0 -32
  146. package/src/components/molecules/VAccordion/VAccordionItem.test.ts +0 -134
  147. package/src/components/molecules/VAccordion/VAccordionItem.vue +0 -68
  148. package/src/components/molecules/VAlert.test.ts +0 -100
  149. package/src/components/molecules/VAlert.vue +0 -137
  150. package/src/components/molecules/VCard/VCard.test.ts +0 -47
  151. package/src/components/molecules/VCard/VCard.vue +0 -74
  152. package/src/components/molecules/VCard/VCardBody.test.ts +0 -39
  153. package/src/components/molecules/VCard/VCardBody.vue +0 -16
  154. package/src/components/molecules/VCard/VCardFooter.test.ts +0 -63
  155. package/src/components/molecules/VCard/VCardFooter.vue +0 -31
  156. package/src/components/molecules/VCard/VCardHeader.test.ts +0 -86
  157. package/src/components/molecules/VCard/VCardHeader.vue +0 -53
  158. package/src/components/molecules/VCodeBlock.test.ts +0 -133
  159. package/src/components/molecules/VCodeBlock.vue +0 -113
  160. package/src/components/molecules/VDrawer.test.ts +0 -14
  161. package/src/components/molecules/VDrawer.vue +0 -87
  162. package/src/components/molecules/VListbox/VListbox.test.ts +0 -146
  163. package/src/components/molecules/VListbox/VListbox.vue +0 -149
  164. package/src/components/molecules/VListbox/VListboxButton.test.ts +0 -66
  165. package/src/components/molecules/VListbox/VListboxButton.vue +0 -57
  166. package/src/components/molecules/VListbox/VListboxItem.test.ts +0 -51
  167. package/src/components/molecules/VListbox/VListboxItem.vue +0 -39
  168. package/src/components/molecules/VListbox/VListboxItems.test.ts +0 -44
  169. package/src/components/molecules/VListbox/VListboxItems.vue +0 -42
  170. package/src/components/molecules/VListbox/VListboxLabel.test.ts +0 -30
  171. package/src/components/molecules/VListbox/VListboxLabel.vue +0 -14
  172. package/src/components/molecules/VPreview.test.ts +0 -73
  173. package/src/components/molecules/VPreview.vue +0 -230
  174. package/src/components/molecules/VRail/VRail.test.ts +0 -14
  175. package/src/components/molecules/VRail/VRail.vue +0 -33
  176. package/src/components/molecules/VRail/VRailTile.test.ts +0 -97
  177. package/src/components/molecules/VRail/VRailTile.vue +0 -49
  178. package/src/components/molecules/VShell.test.ts +0 -14
  179. package/src/components/molecules/VShell.vue +0 -63
  180. package/src/components/molecules/VTabs/VTab.test.ts +0 -143
  181. package/src/components/molecules/VTabs/VTab.vue +0 -50
  182. package/src/components/molecules/VTabs/VTabPanel.test.ts +0 -24
  183. package/src/components/molecules/VTabs/VTabPanel.vue +0 -9
  184. package/src/components/molecules/VTabs/VTabs.test.ts +0 -92
  185. package/src/components/molecules/VTabs/VTabs.vue +0 -104
  186. package/src/components/molecules/index.ts +0 -51
  187. package/src/directives/clipboard.test.ts +0 -26
  188. package/src/directives/clipboard.ts +0 -9
  189. package/src/directives/index.ts +0 -3
  190. package/src/env.d.ts +0 -8
  191. package/src/index.ts +0 -21
  192. package/src/props/index.ts +0 -1
  193. package/src/props/props.ts +0 -62
  194. package/src/services/dark-mode.service.test.ts +0 -104
  195. package/src/services/dark-mode.service.ts +0 -75
  196. package/src/services/drawer.service.test.ts +0 -45
  197. package/src/services/drawer.service.ts +0 -46
  198. package/src/services/highlight.service.test.ts +0 -24
  199. package/src/services/highlight.service.ts +0 -19
  200. package/src/services/index.ts +0 -8
  201. package/src/services/rail.service.test.ts +0 -13
  202. package/src/services/rail.service.ts +0 -11
  203. package/src/services/settings.service.test.ts +0 -17
  204. package/src/services/settings.service.ts +0 -136
  205. package/src/styles/all.css +0 -24
  206. package/src/styles/core.css +0 -66
  207. package/src/styles/elements/alerts.css +0 -17
  208. package/src/styles/elements/badges.css +0 -31
  209. package/src/styles/elements/breadcrumbs.css +0 -26
  210. package/src/styles/elements/buttons.css +0 -103
  211. package/src/styles/elements/cards.css +0 -32
  212. package/src/styles/elements/chips.css +0 -22
  213. package/src/styles/elements/forms.css +0 -269
  214. package/src/styles/elements/lists.css +0 -48
  215. package/src/styles/elements/logo-clouds.css +0 -29
  216. package/src/styles/elements/modals.css +0 -15
  217. package/src/styles/elements/placeholders.css +0 -17
  218. package/src/styles/elements/popups.css +0 -16
  219. package/src/styles/elements/tables.css +0 -102
  220. package/src/styles/elements.css +0 -19
  221. package/src/styles/highlight-js.css +0 -116
  222. package/src/styles/tailwind.css +0 -16
  223. package/src/styles/transitions.css +0 -2
  224. package/src/styles/typography.css +0 -101
  225. package/src/styles/variants.css +0 -156
  226. package/src/tailwind/core.cjs +0 -37
  227. package/src/tailwind/generated/intellisense-classes.cjs +0 -558
  228. package/src/tailwind/intellisense.cjs +0 -21
  229. package/src/tailwind/settings.cjs +0 -20
  230. package/src/tailwind/theme/colors.cjs +0 -20
  231. package/src/tailwind/tokens/backgrounds.cjs +0 -48
  232. package/src/tailwind/tokens/border-radius.cjs +0 -21
  233. package/src/tailwind/tokens/borders.cjs +0 -24
  234. package/src/tailwind/tokens/fills.cjs +0 -20
  235. package/src/tailwind/tokens/rings.cjs +0 -50
  236. package/src/tailwind/tokens/text.cjs +0 -35
  237. package/src/tailwind/vuetiful.cjs +0 -19
  238. package/src/themes/theme-rocket.css +0 -119
  239. package/src/themes/theme-sahara.css +0 -128
  240. package/src/themes/theme-seafoam.css +0 -120
  241. package/src/themes/theme-seasonal.css +0 -115
  242. package/src/themes/theme-skeleton.css +0 -115
  243. package/src/themes/theme-vintage.css +0 -125
  244. package/src/themes/theme-vuetiful.css +0 -136
  245. package/src/types/index.ts +0 -59
  246. package/src/types/tailwind.ts +0 -7
  247. package/src/utils/colors/colors.service.ts +0 -293
  248. package/src/utils/index.ts +0 -8
  249. package/src/utils/platform/platform.service.test.ts +0 -19
  250. package/src/utils/platform/platform.service.ts +0 -8
  251. package/src/utils/theme/callback.test.ts +0 -28
  252. package/src/utils/theme/remove.test.ts +0 -27
  253. package/src/utils/theme/theme-switcher.vue +0 -74
  254. package/src/utils/theme/theme.service.test.ts +0 -269
  255. package/src/utils/theme/theme.service.ts +0 -173
  256. package/src/utils/theme/themes.ts +0 -282
  257. /package/{src/styles → dist/css}/transitions/fade.css +0 -0
@@ -1,50 +0,0 @@
1
- <script setup lang="ts">
2
- import { unstyledProp } from '@/props';
3
- import { useSettings } from '@/services';
4
- import { Tab } from '@headlessui/vue';
5
- import { computed, inject } from 'vue';
6
-
7
- const props = defineProps({
8
- disabled: {
9
- type: Boolean,
10
- default: false,
11
- },
12
- unstyled: unstyledProp,
13
- });
14
-
15
- const activeClass = inject('active') as string;
16
- const hoverClass = inject('hover') as string;
17
- const vertical = inject('vertical') as boolean;
18
- const classTab = inject('classTab') as string;
19
- const hideSeparator = inject('hideSeparator') as boolean;
20
- const classTabSeparator = inject('classTabSeparator') as string;
21
-
22
- const tabClass = computed(() => {
23
- return classTab ? classTab : 'w-full px-4 py-2';
24
- });
25
-
26
- const { settings } = useSettings();
27
- const isUnstyled = settings.global.unstyled || settings.components.tab.unstyled || props.unstyled;
28
- </script>
29
-
30
- <template>
31
- <Tab
32
- :disabled="disabled"
33
- v-slot="{ selected }"
34
- class="vuetiful-tab"
35
- :class="`flex ${vertical ? 'flex-row justify-between' : 'flex-col'}`"
36
- >
37
- <div
38
- data-test="slot-container"
39
- class="vuetiful-tab-content"
40
- :class="`text-base ${isUnstyled ? '' : 'rounded-token'} ${selected ? activeClass : hoverClass} ${tabClass}`"
41
- >
42
- <slot />
43
- </div>
44
- <div
45
- v-show="selected && !hideSeparator"
46
- class="vuetiful-tab-separator"
47
- :class="`z-10 ${vertical ? 'mr-[-2px] h-full border-r-2' : 'mb-[-2px] w-full border-b-2'} ${classTabSeparator}`"
48
- ></div>
49
- </Tab>
50
- </template>
@@ -1,24 +0,0 @@
1
- import { TabGroup } from '@headlessui/vue';
2
- import { mount } from '@vue/test-utils';
3
- import { describe, expect, test } from 'vitest';
4
- import { VTabPanel } from '..';
5
-
6
- describe('VTabs', () => {
7
- test('default props', () => {
8
- const wrapper = mount({
9
- template: /*html*/ `
10
- <TabGroup>
11
- <v-tab-panel data-test='tab-panel'>John Duck</v-tab-panel>
12
- </TabGroup>
13
- `,
14
- components: {
15
- TabGroup: TabGroup,
16
- 'v-tab-panel': VTabPanel,
17
- },
18
- });
19
-
20
- const tabPanel = wrapper.find("[data-test='tab-panel']");
21
- expect(tabPanel.text()).toEqual('John Duck');
22
- expect(tabPanel.attributes('tabindex')).toEqual('-1');
23
- });
24
- });
@@ -1,9 +0,0 @@
1
- <script setup lang="ts">
2
- import { TabPanel } from '@headlessui/vue';
3
- </script>
4
-
5
- <template>
6
- <TabPanel tabindex="-1" class="vuetiful-tab-panel">
7
- <slot />
8
- </TabPanel>
9
- </template>
@@ -1,92 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { describe, expect, test } from 'vitest';
3
- import { VTab, VTabPanel, VTabs } from '..';
4
-
5
- describe('VTabs', () => {
6
- test('hide separator', () => {
7
- const wrapper = mount({
8
- template: /*html*/ `
9
- <v-tabs hide-separator></v-tabs>
10
- `,
11
- components: {
12
- 'v-tabs': VTabs,
13
- },
14
- });
15
-
16
- const separator = wrapper.find("[data-test='vuetiful-separator']");
17
- expect(separator.exists()).toBeFalsy();
18
- });
19
-
20
- test('default props', () => {
21
- const wrapper = mount({
22
- template: /*html*/ `
23
- <v-tabs>
24
- <template v-slot:tabs>
25
- <v-tab>John Duck</v-tab>
26
- </template>
27
- <v-tab-panel>John Duck Panel</v-tab-panel>
28
- </v-tabs>
29
- `,
30
- components: {
31
- 'v-tabs': VTabs,
32
- 'v-tab': VTab,
33
- 'v-tab-panel': VTabPanel,
34
- },
35
- });
36
-
37
- const tabList = wrapper.find("[data-test='vuetiful-tab-list']");
38
- expect(tabList.classes()).toEqual([
39
- 'vuetiful-tab-list',
40
- 'flex',
41
- '!rounded-bl-none',
42
- '!rounded-br-none',
43
- 'rounded-container-token',
44
- ]);
45
- expect(tabList.classes()).not.toContain('flex-col');
46
-
47
- const tabPanels = wrapper.find("[data-test='vuetiful-tab-panels']");
48
- expect(tabPanels.classes()).toEqual([
49
- 'vuetiful-tab-panels',
50
- 'p-4',
51
- '!rounded-tl-none',
52
- '!rounded-tr-none',
53
- 'rounded-container-token',
54
- ]);
55
- });
56
-
57
- test('vertical', () => {
58
- const wrapper = mount({
59
- template: /*html*/ `
60
- <v-tabs vertical>
61
- <template v-slot:tabs>
62
- <v-tab>Tab 1</v-tab>
63
- </template>
64
- <v-tab-panel>Panel 1</v-tab-panel>
65
- </v-tabs>
66
- `,
67
- components: {
68
- 'v-tabs': VTabs,
69
- 'v-tab': VTab,
70
- 'v-tab-panel': VTabPanel,
71
- },
72
- });
73
- const tabList = wrapper.find("[data-test='vuetiful-tab-list']");
74
- expect(tabList.classes()).toEqual([
75
- 'vuetiful-tab-list',
76
- 'flex',
77
- 'flex-col',
78
- '!rounded-br-none',
79
- '!rounded-tr-none',
80
- 'rounded-container-token',
81
- ]);
82
-
83
- const tabPanels = wrapper.find("[data-test='vuetiful-tab-panels']");
84
- expect(tabPanels.classes()).toEqual([
85
- 'vuetiful-tab-panels',
86
- 'p-4',
87
- '!rounded-bl-none',
88
- '!rounded-tl-none',
89
- 'rounded-container-token',
90
- ]);
91
- });
92
- });
@@ -1,104 +0,0 @@
1
- <script setup lang="ts">
2
- import { unstyledProp } from '@/props';
3
- import { useSettings } from '@/services';
4
- import { TabGroup, TabList, TabPanels } from '@headlessui/vue';
5
- import { provide } from 'vue';
6
-
7
- const props = defineProps({
8
- hideSeparator: {
9
- type: Boolean,
10
- default: false,
11
- },
12
-
13
- vertical: {
14
- type: Boolean,
15
- default: false,
16
- },
17
-
18
- active: {
19
- type: String,
20
- default: '',
21
- },
22
- hover: {
23
- type: String,
24
- default: 'hover:variant-ghost',
25
- },
26
-
27
- classPanels: {
28
- type: String,
29
- default: '',
30
- },
31
- classTabs: {
32
- type: String,
33
- default: '',
34
- },
35
- classTab: {
36
- type: String,
37
- default: '',
38
- },
39
- classSeparator: {
40
- type: String,
41
- default: 'border-surface-400-500-token',
42
- },
43
- classTabSeparator: {
44
- type: String,
45
- default: 'border-surface-900-50-token',
46
- },
47
-
48
- defaultIndex: {
49
- type: Number,
50
- default: 0,
51
- },
52
-
53
- unstyled: unstyledProp,
54
- });
55
-
56
- provide('active', props.active);
57
- provide('hover', props.hover);
58
- provide('vertical', props.vertical);
59
- provide('classTab', props.classTab);
60
- provide('hideSeparator', props.hideSeparator);
61
- provide('classTabSeparator', props.classTabSeparator);
62
-
63
- const { settings } = useSettings();
64
- const isUnstyled = settings.global.unstyled || settings.components.tabs.unstyled || props.unstyled;
65
- </script>
66
-
67
- <template>
68
- <TabGroup
69
- as="div"
70
- :vertical="vertical"
71
- :defaultIndex="defaultIndex"
72
- class="vuetiful-tab-group"
73
- :class="`${vertical ? 'flex' : ''}`"
74
- >
75
- <TabList
76
- data-test="vuetiful-tab-list"
77
- :class="`vuetiful-tab-list flex ${vertical ? 'flex-col' : ''}
78
- ${
79
- isUnstyled
80
- ? ''
81
- : `${
82
- vertical ? '!rounded-br-none !rounded-tr-none' : '!rounded-bl-none !rounded-br-none'
83
- } rounded-container-token `
84
- }
85
- ${classTabs}`"
86
- >
87
- <slot name="tabs" />
88
- </TabList>
89
- <div data-test="vuetiful-tab-separator" v-if="!hideSeparator" :class="`border ${classSeparator}`"></div>
90
- <TabPanels
91
- data-test="vuetiful-tab-panels"
92
- :class="`vuetiful-tab-panels
93
- ${
94
- isUnstyled
95
- ? ''
96
- : `p-4 ${
97
- vertical ? '!rounded-bl-none !rounded-tl-none' : '!rounded-tl-none !rounded-tr-none'
98
- } rounded-container-token`
99
- } ${classPanels}`"
100
- >
101
- <slot />
102
- </TabPanels>
103
- </TabGroup>
104
- </template>
@@ -1,51 +0,0 @@
1
- import VDrawer from './VDrawer.vue';
2
- import VPreview from './VPreview.vue';
3
- import VRail from './VRail/VRail.vue';
4
- import VRailTile from './VRail/VRailTile.vue';
5
- import VShell from './VShell.vue';
6
-
7
- import VListbox from './VListbox/VListbox.vue';
8
- import VListboxButton from './VListbox/VListboxButton.vue';
9
- import VListboxItem from './VListbox/VListboxItem.vue';
10
- import VListboxItems from './VListbox/VListboxItems.vue';
11
- import VListboxLabel from './VListbox/VListboxLabel.vue';
12
-
13
- import VTab from './VTabs/VTab.vue';
14
- import VTabPanel from './VTabs/VTabPanel.vue';
15
- import VTabs from './VTabs/VTabs.vue';
16
-
17
- import VAccordion from './VAccordion/VAccordion.vue';
18
- import VAccordionItem from './VAccordion/VAccordionItem.vue';
19
-
20
- import VAlert from './VAlert.vue';
21
-
22
- import VCard from './VCard/VCard.vue';
23
- import VCardBody from './VCard/VCardBody.vue';
24
- import VCardFooter from './VCard/VCardFooter.vue';
25
- import VCardHeader from './VCard/VCardHeader.vue';
26
-
27
- import VCodeBlock from './VCodeBlock.vue';
28
-
29
- export {
30
- VAccordion,
31
- VAccordionItem,
32
- VAlert,
33
- VCard,
34
- VCardBody,
35
- VCardFooter,
36
- VCardHeader,
37
- VCodeBlock,
38
- VDrawer,
39
- VListbox,
40
- VListboxButton,
41
- VListboxItem,
42
- VListboxItems,
43
- VListboxLabel,
44
- VPreview,
45
- VRail,
46
- VRailTile,
47
- VShell,
48
- VTab,
49
- VTabPanel,
50
- VTabs,
51
- };
@@ -1,26 +0,0 @@
1
- import { afterEach, describe, expect, vi, test } from 'vitest';
2
- import { DirectiveBinding } from 'vue';
3
- import { vClipboard } from '.';
4
-
5
- const navigatorMock = {
6
- clipboard: {
7
- writeText: vi.fn(),
8
- } as any,
9
- } as any;
10
-
11
- describe('clipboard', () => {
12
- afterEach(() => {
13
- vi.resetAllMocks();
14
- });
15
- describe('given the v-clipboard directive is used', () => {
16
- test('should copy text to the clipboard on click', () => {
17
- window.navigator = navigatorMock;
18
-
19
- const el = document.createElement('div');
20
- vClipboard(el, { value: 'John Duck' } as DirectiveBinding);
21
- el.click();
22
-
23
- expect(navigator.clipboard.writeText).toHaveBeenCalledWith('John Duck');
24
- });
25
- });
26
- });
@@ -1,9 +0,0 @@
1
- import { DirectiveBinding } from 'vue';
2
-
3
- const clipboard = (el: HTMLElement, binding: DirectiveBinding) => {
4
- el.addEventListener('click', () => {
5
- navigator.clipboard.writeText(binding.value);
6
- });
7
- };
8
-
9
- export default clipboard;
@@ -1,3 +0,0 @@
1
- import vClipboard from './clipboard';
2
-
3
- export { vClipboard };
package/src/env.d.ts DELETED
@@ -1,8 +0,0 @@
1
- /// <reference types="vite/client" />
2
-
3
- declare module '*.vue' {
4
- import { DefineComponent } from 'vue';
5
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
6
- const component: DefineComponent<{}, {}, any>;
7
- export default component;
8
- }
package/src/index.ts DELETED
@@ -1,21 +0,0 @@
1
- import * as components from './components';
2
-
3
- function install(app: any) {
4
- for (const key in components) {
5
- // @ts-expect-error
6
- app.component(key, components[key]);
7
- }
8
- }
9
-
10
- import './assets/main.css';
11
- import './styles/tailwind.css';
12
-
13
- export default { install };
14
-
15
- export * from './components';
16
- export * from './utils';
17
- export * from './directives';
18
- export * from './services';
19
-
20
- // This type alias is to identify CSS classes within component props, which enables Tailwind IntelliSense
21
- export type CssClasses = string;
@@ -1 +0,0 @@
1
- export * from './props';
@@ -1,62 +0,0 @@
1
- import { Size, Variant } from '@/types';
2
- import { PropType } from 'vue';
3
-
4
- const sizeProp = {
5
- type: String as PropType<'xs' | 'sm' | 'md' | 'lg' | 'xl'>,
6
- default: Size.MD,
7
- };
8
-
9
- const unstyledProp = {
10
- type: Boolean,
11
- default: false,
12
- };
13
-
14
- const variantProp = {
15
- // explicit string union because TypeScript type won't throw error if invalid value is passed
16
- type: String as PropType<
17
- | ''
18
- | 'filled'
19
- | 'filled-primary'
20
- | 'filled-secondary'
21
- | 'filled-tertiary'
22
- | 'filled-success'
23
- | 'filled-warning'
24
- | 'filled-error'
25
- | 'filled-surface'
26
- | 'ringed'
27
- | 'ringed-primary'
28
- | 'ringed-secondary'
29
- | 'ringed-tertiary'
30
- | 'ringed-success'
31
- | 'ringed-warning'
32
- | 'ringed-error'
33
- | 'ringed-surface'
34
- | 'ghost'
35
- | 'ghost-primary'
36
- | 'ghost-secondary'
37
- | 'ghost-tertiary'
38
- | 'ghost-success'
39
- | 'ghost-warning'
40
- | 'ghost-error'
41
- | 'ghost-surface'
42
- | 'soft'
43
- | 'soft-primary'
44
- | 'soft-secondary'
45
- | 'soft-tertiary'
46
- | 'soft-success'
47
- | 'soft-warning'
48
- | 'soft-error'
49
- | 'soft-surface'
50
- | 'glass'
51
- | 'glass-primary'
52
- | 'glass-secondary'
53
- | 'glass-tertiary'
54
- | 'glass-success'
55
- | 'glass-warning'
56
- | 'glass-error'
57
- | 'glass-surface'
58
- >,
59
- default: Variant.Filled,
60
- };
61
-
62
- export { sizeProp, unstyledProp, variantProp };
@@ -1,104 +0,0 @@
1
- import { afterEach, describe, expect, vi, test } from 'vitest';
2
-
3
- const localStorageMock = {
4
- getItem: vi.fn(),
5
- setItem: vi.fn(),
6
- };
7
- const matchMediaMock = (matches: boolean) => vi.fn(() => ({ matches, onchange: vi.fn() }));
8
-
9
- describe('useDarkMode', () => {
10
- afterEach(() => {
11
- vi.resetModules();
12
- });
13
-
14
- describe('applyMode', () => {
15
- test('light mode set', async () => {
16
- const { useDarkMode } = await import('./dark-mode.service');
17
- const { applyMode, chosenMode, MODE } = useDarkMode();
18
-
19
- applyMode(MODE.LIGHT);
20
- expect(chosenMode.value).toBe(MODE.LIGHT);
21
- expect(document.documentElement.classList.contains('dark')).toBe(false);
22
- });
23
- test('dark mode set', async () => {
24
- const { useDarkMode } = await import('./dark-mode.service');
25
- const { applyMode, chosenMode, MODE } = useDarkMode();
26
-
27
- applyMode(MODE.DARK);
28
- expect(chosenMode.value).toBe(MODE.DARK);
29
- expect(document.documentElement.classList.contains('dark')).toBe(true);
30
- });
31
- });
32
-
33
- describe('autoModeWatcher', () => {
34
- describe('given mode changes', () => {
35
- test('should set modeCurrent', async () => {
36
- const { useDarkMode } = await import('./dark-mode.service');
37
- const darkMode = useDarkMode();
38
-
39
- const mql = {
40
- matches: true,
41
- onchange: () => {
42
- const mode = mql.matches ? darkMode.MODE.LIGHT : darkMode.MODE.DARK;
43
- darkMode.applyMode(mode);
44
- },
45
- };
46
- vi.spyOn(window, 'matchMedia').mockReturnValueOnce(mql as any);
47
-
48
- darkMode.autoModeWatcher();
49
-
50
- mql.matches = false;
51
- mql.onchange?.();
52
- expect(darkMode.chosenMode.value).toBe('dark');
53
-
54
- mql.matches = true;
55
- mql.onchange?.();
56
- expect(darkMode.chosenMode.value).toBe('light');
57
- });
58
- });
59
- });
60
-
61
- describe('applyModeSSR', () => {
62
- test('should add dark class to html tag', async () => {
63
- const { useDarkMode } = await import('./dark-mode.service');
64
- const darkMode = useDarkMode();
65
-
66
- const html = '<html>';
67
- const mode = darkMode.MODE.DARK;
68
- const result = darkMode.applyModeSSR(html, mode);
69
- expect(result).toBe('<html class="dark">');
70
- });
71
- });
72
-
73
- describe('getModeFromCookie', () => {
74
- test('should return default mode if cookie is not set', async () => {
75
- const { useDarkMode } = await import('./dark-mode.service');
76
- const darkMode = useDarkMode();
77
-
78
- const cookies = '';
79
- const result = darkMode.getModeFromCookie(cookies);
80
- expect(result).toBe('dark');
81
- });
82
- test('should return mode from cookie', async () => {
83
- const { useDarkMode } = await import('./dark-mode.service');
84
- const darkMode = useDarkMode();
85
-
86
- const cookies = 'vuetiful-mode=light';
87
- const result = darkMode.getModeFromCookie(cookies);
88
- expect(result).toBe('light');
89
- });
90
- });
91
-
92
- describe('initializeMode', () => {
93
- test('should set mode from cookie', async () => {
94
- const { useDarkMode } = await import('./dark-mode.service');
95
- const darkMode = useDarkMode();
96
-
97
- const cookies = 'vuetiful-mode=dark';
98
- vi.spyOn(document, 'cookie', 'get').mockReturnValueOnce(cookies);
99
-
100
- darkMode.initializeMode();
101
- expect(darkMode.chosenMode.value).toBe('dark');
102
- });
103
- });
104
- });
@@ -1,75 +0,0 @@
1
- import { computed, readonly, ref } from 'vue';
2
- import { usePlatform } from '../utils/platform/platform.service';
3
-
4
- const { isBrowser } = usePlatform();
5
-
6
- const MODE = {
7
- LIGHT: 'light',
8
- DARK: 'dark',
9
- };
10
- export type Mode = (typeof MODE)[keyof typeof MODE];
11
-
12
- const defaultMode = MODE.DARK;
13
- const chosenMode = ref(defaultMode);
14
- const isDark = computed(() => chosenMode.value === MODE.DARK);
15
-
16
- const useDarkMode = () => {
17
- const getModeFromCookie = (cookies: string) => {
18
- const cookie = cookies.split(';').find((c) => c.trim().startsWith('vuetiful-mode='));
19
- if (cookie) {
20
- const value = cookie.split('=')[1];
21
- return value;
22
- }
23
- return defaultMode;
24
- };
25
-
26
- const applyModeSSR = (html: string, mode: Mode): string => {
27
- if (mode === MODE.DARK) html = html.replace('<html', '<html class="dark"');
28
- return html;
29
- };
30
-
31
- const initializeMode = () => {
32
- if (isBrowser) {
33
- const mode = getModeFromCookie(document.cookie);
34
- applyMode(mode);
35
- }
36
- };
37
-
38
- const applyMode = (value: Mode) => {
39
- const elemHtmlClasses = document.documentElement.classList;
40
- const classDark = 'dark';
41
- value === MODE.LIGHT ? elemHtmlClasses.remove(classDark) : elemHtmlClasses.add(classDark);
42
- if (isBrowser) {
43
- document.cookie = `vuetiful-mode=${value};path=/;max-age=31536000;SameSite=Lax`;
44
- }
45
- chosenMode.value = value;
46
- };
47
-
48
- const autoModeWatcher = (): void => {
49
- const mql = window.matchMedia('(prefers-color-scheme: light)');
50
- const setMode = (value: boolean) => {
51
- const elemHtmlClasses = document.documentElement.classList;
52
- const classDark = `dark`;
53
- const mode = value ? MODE.LIGHT : MODE.DARK;
54
- mode === MODE.LIGHT ? elemHtmlClasses.remove(classDark) : elemHtmlClasses.add(classDark);
55
- applyMode(mode);
56
- };
57
- setMode(mql.matches);
58
- mql.onchange = () => {
59
- setMode(mql.matches);
60
- };
61
- };
62
-
63
- return {
64
- chosenMode,
65
- isDark: readonly(isDark),
66
- initializeMode,
67
- applyMode,
68
- autoModeWatcher,
69
- applyModeSSR,
70
- getModeFromCookie,
71
- MODE,
72
- };
73
- };
74
-
75
- export { useDarkMode };