@code-coaching/vuetiful 0.23.0 → 0.23.2

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 (144) hide show
  1. package/dist/style.css +1 -1
  2. package/dist/types/components/VBootstrap.vue.d.ts +1 -1
  3. package/dist/types/components/atoms/VAvatar.vue.d.ts +1 -1
  4. package/dist/types/components/atoms/VLightSwitch.vue.d.ts +2 -2
  5. package/dist/types/components/atoms/index.d.ts +13 -13
  6. package/dist/types/components/index.d.ts +2 -2
  7. package/dist/types/components/molecules/VAlert.vue.d.ts +1 -1
  8. package/dist/types/components/molecules/VCodeBlock.vue.d.ts +2 -2
  9. package/dist/types/components/molecules/VDrawer.vue.d.ts +1 -1
  10. package/dist/types/components/molecules/VListbox/VListbox.vue.d.ts +1 -1
  11. package/dist/types/components/molecules/VRail/VRail.vue.d.ts +1 -1
  12. package/dist/types/components/molecules/VRail/VRailTile.vue.d.ts +1 -1
  13. package/dist/types/components/molecules/index.d.ts +21 -21
  14. package/dist/types/directives/clipboard.d.ts +1 -1
  15. package/dist/types/directives/index.d.ts +1 -1
  16. package/dist/types/index.d.ts +6 -6
  17. package/dist/types/props/props.d.ts +1 -1
  18. package/dist/types/services/dark-mode.service.d.ts +1 -1
  19. package/dist/types/services/drawer.service.d.ts +1 -1
  20. package/dist/types/services/index.d.ts +5 -5
  21. package/dist/types/types/index.d.ts +1 -1
  22. package/dist/types/utils/index.d.ts +2 -2
  23. package/dist/types/utils/theme/theme-switcher.vue.d.ts +23 -63
  24. package/dist/types/utils/theme/theme.service.d.ts +1 -1
  25. package/dist/vuetiful.es.mjs +82 -150
  26. package/dist/vuetiful.umd.js +7 -15
  27. package/package.json +1 -1
  28. package/src/assets/main.css +6 -6
  29. package/src/components/VBootstrap.vue +43 -43
  30. package/src/components/atoms/VAvatar.test.ts +71 -71
  31. package/src/components/atoms/VAvatar.vue +22 -23
  32. package/src/components/atoms/VBadge.test.ts +11 -11
  33. package/src/components/atoms/VBadge.vue +2 -2
  34. package/src/components/atoms/VButton.test.ts +82 -82
  35. package/src/components/atoms/VButton.vue +20 -21
  36. package/src/components/atoms/VChip.test.ts +11 -11
  37. package/src/components/atoms/VChip.vue +3 -3
  38. package/src/components/atoms/VLightSwitch.test.ts +6 -6
  39. package/src/components/atoms/VLightSwitch.vue +26 -31
  40. package/src/components/atoms/VRadio/VRadioDescription.test.ts +13 -13
  41. package/src/components/atoms/VRadio/VRadioDescription.vue +2 -2
  42. package/src/components/atoms/VRadio/VRadioGroup.test.ts +40 -40
  43. package/src/components/atoms/VRadio/VRadioGroup.vue +19 -22
  44. package/src/components/atoms/VRadio/VRadioItem.test.ts +67 -67
  45. package/src/components/atoms/VRadio/VRadioItem.vue +10 -13
  46. package/src/components/atoms/VRadio/VRadioLabel.test.ts +13 -13
  47. package/src/components/atoms/VRadio/VRadioLabel.vue +5 -3
  48. package/src/components/atoms/VSwitch/VSwitch.test.ts +33 -33
  49. package/src/components/atoms/VSwitch/VSwitch.vue +24 -27
  50. package/src/components/atoms/VSwitch/VSwitchDescription.test.ts +13 -13
  51. package/src/components/atoms/VSwitch/VSwitchDescription.vue +2 -2
  52. package/src/components/atoms/VSwitch/VSwitchGroup.test.ts +9 -9
  53. package/src/components/atoms/VSwitch/VSwitchGroup.vue +2 -2
  54. package/src/components/atoms/VSwitch/VSwitchLabel.test.ts +19 -19
  55. package/src/components/atoms/VSwitch/VSwitchLabel.vue +2 -2
  56. package/src/components/atoms/index.ts +13 -13
  57. package/src/components/index.test.ts +3 -3
  58. package/src/components/index.ts +2 -2
  59. package/src/components/molecules/VAccordion/VAccordion.test.ts +11 -17
  60. package/src/components/molecules/VAccordion/VAccordion.vue +3 -3
  61. package/src/components/molecules/VAccordion/VAccordionItem.test.ts +55 -55
  62. package/src/components/molecules/VAccordion/VAccordionItem.vue +9 -22
  63. package/src/components/molecules/VAlert.test.ts +38 -38
  64. package/src/components/molecules/VAlert.vue +25 -47
  65. package/src/components/molecules/VCard/VCard.test.ts +25 -25
  66. package/src/components/molecules/VCard/VCard.vue +13 -15
  67. package/src/components/molecules/VCard/VCardBody.test.ts +14 -14
  68. package/src/components/molecules/VCard/VCardBody.vue +4 -8
  69. package/src/components/molecules/VCard/VCardFooter.test.ts +22 -22
  70. package/src/components/molecules/VCard/VCardFooter.vue +10 -8
  71. package/src/components/molecules/VCard/VCardHeader.test.ts +25 -25
  72. package/src/components/molecules/VCard/VCardHeader.vue +7 -8
  73. package/src/components/molecules/VCodeBlock.test.ts +63 -63
  74. package/src/components/molecules/VCodeBlock.vue +27 -34
  75. package/src/components/molecules/VDrawer.test.ts +5 -5
  76. package/src/components/molecules/VDrawer.vue +10 -10
  77. package/src/components/molecules/VListbox/VListbox.test.ts +53 -53
  78. package/src/components/molecules/VListbox/VListbox.vue +31 -32
  79. package/src/components/molecules/VListbox/VListboxButton.test.ts +13 -13
  80. package/src/components/molecules/VListbox/VListboxButton.vue +5 -5
  81. package/src/components/molecules/VListbox/VListboxItem.test.ts +25 -25
  82. package/src/components/molecules/VListbox/VListboxItem.vue +7 -8
  83. package/src/components/molecules/VListbox/VListboxItems.test.ts +14 -14
  84. package/src/components/molecules/VListbox/VListboxItems.vue +9 -11
  85. package/src/components/molecules/VListbox/VListboxLabel.test.ts +10 -10
  86. package/src/components/molecules/VListbox/VListboxLabel.vue +2 -2
  87. package/src/components/molecules/VPreview.test.ts +26 -26
  88. package/src/components/molecules/VPreview.vue +22 -27
  89. package/src/components/molecules/VRail/VRail.test.ts +5 -5
  90. package/src/components/molecules/VRail/VRail.vue +7 -7
  91. package/src/components/molecules/VRail/VRailTile.test.ts +26 -28
  92. package/src/components/molecules/VRail/VRailTile.vue +13 -11
  93. package/src/components/molecules/VShell.test.ts +5 -5
  94. package/src/components/molecules/VShell.vue +11 -20
  95. package/src/components/molecules/VTabs/VTab.test.ts +48 -52
  96. package/src/components/molecules/VTabs/VTab.vue +13 -17
  97. package/src/components/molecules/VTabs/VTabPanel.test.ts +8 -8
  98. package/src/components/molecules/VTabs/VTabPanel.vue +1 -1
  99. package/src/components/molecules/VTabs/VTabs.test.ts +36 -36
  100. package/src/components/molecules/VTabs/VTabs.vue +18 -22
  101. package/src/components/molecules/index.ts +21 -21
  102. package/src/directives/clipboard.test.ts +9 -9
  103. package/src/directives/clipboard.ts +2 -2
  104. package/src/directives/index.ts +1 -1
  105. package/src/env.d.ts +2 -2
  106. package/src/index.test.ts +6 -6
  107. package/src/index.ts +7 -7
  108. package/src/props/index.ts +1 -1
  109. package/src/props/props.ts +44 -44
  110. package/src/services/dark-mode.service.test.ts +115 -93
  111. package/src/services/dark-mode.service.ts +9 -9
  112. package/src/services/drawer.service.test.ts +21 -21
  113. package/src/services/drawer.service.ts +10 -10
  114. package/src/services/highlight.service.test.ts +12 -12
  115. package/src/services/highlight.service.ts +1 -1
  116. package/src/services/index.ts +5 -5
  117. package/src/services/rail.service.test.ts +7 -7
  118. package/src/services/rail.service.ts +2 -2
  119. package/src/services/settings.service.test.ts +5 -5
  120. package/src/services/settings.service.ts +1 -1
  121. package/src/styles/all.css +7 -7
  122. package/src/styles/elements/buttons.css +1 -1
  123. package/src/styles/elements/forms.css +7 -7
  124. package/src/styles/elements.css +13 -13
  125. package/src/styles/transitions.css +2 -2
  126. package/src/styles/typography.css +5 -5
  127. package/src/themes/theme-rocket.css +10 -10
  128. package/src/themes/theme-sahara.css +13 -13
  129. package/src/themes/theme-seafoam.css +13 -13
  130. package/src/themes/theme-seasonal.css +4 -4
  131. package/src/themes/theme-skeleton.css +7 -7
  132. package/src/themes/theme-vintage.css +12 -12
  133. package/src/themes/theme-vuetiful-0.0.1.css +13 -13
  134. package/src/types/index.ts +46 -46
  135. package/src/types/tailwind.ts +2 -21
  136. package/src/utils/index.test.ts +3 -3
  137. package/src/utils/index.ts +2 -2
  138. package/src/utils/platform/platform.service.test.ts +6 -6
  139. package/src/utils/platform/platform.service.ts +1 -1
  140. package/src/utils/theme/callback.test.ts +6 -6
  141. package/src/utils/theme/remove.test.ts +8 -8
  142. package/src/utils/theme/theme-switcher.vue +58 -131
  143. package/src/utils/theme/theme.service.test.ts +69 -61
  144. package/src/utils/theme/theme.service.ts +19 -20
@@ -1,9 +1,9 @@
1
- import { mount } from "@vue/test-utils";
2
- import { describe, expect, test } from "vitest";
3
- import { VAccordion, VAccordionItem } from "..";
1
+ import { mount } from '@vue/test-utils';
2
+ import { describe, expect, test } from 'vitest';
3
+ import { VAccordion, VAccordionItem } from '..';
4
4
 
5
- describe("VAccordionItem", () => {
6
- test("defaults", async () => {
5
+ describe('VAccordionItem', () => {
6
+ test('defaults', async () => {
7
7
  const wrapper = mount({
8
8
  template: /*html*/ `
9
9
  <v-accordion>
@@ -11,36 +11,36 @@ describe("VAccordionItem", () => {
11
11
  <v-accordion-item title="Is">Janine Duck</v-accordion-item>
12
12
  </v-accordion>`,
13
13
  components: {
14
- "v-accordion": VAccordion,
15
- "v-accordion-item": VAccordionItem,
14
+ 'v-accordion': VAccordion,
15
+ 'v-accordion-item': VAccordionItem,
16
16
  },
17
17
  });
18
18
 
19
19
  const accordionItems = wrapper.findAllComponents(VAccordionItem);
20
20
  accordionItems.forEach((accordionItem) => {
21
- expect(accordionItem.classes()).toEqual(["vuetiful-accordion-item"]);
21
+ expect(accordionItem.classes()).toEqual(['vuetiful-accordion-item']);
22
22
 
23
- const accordionItemButton = accordionItem.find(".vuetiful-accordion-item-button");
23
+ const accordionItemButton = accordionItem.find('.vuetiful-accordion-item-button');
24
24
  expect(accordionItemButton.classes()).toEqual([
25
- "items-center",
26
- "justify-between",
27
- "p-4",
28
- "py-2",
29
- "rounded-container-token",
30
- "hover:cursor-pointer",
31
- "bg-surface-200-700-token",
32
- "hover:variant-soft",
33
- "vuetiful-accordion-item-button",
34
- "flex",
35
- "w-full",
25
+ 'items-center',
26
+ 'justify-between',
27
+ 'p-4',
28
+ 'py-2',
29
+ 'rounded-container-token',
30
+ 'hover:cursor-pointer',
31
+ 'bg-surface-200-700-token',
32
+ 'hover:variant-soft',
33
+ 'vuetiful-accordion-item-button',
34
+ 'flex',
35
+ 'w-full',
36
36
  ]);
37
37
 
38
- const accordionItemTitle = accordionItem.find(".vuetiful-accordion-title");
38
+ const accordionItemTitle = accordionItem.find('.vuetiful-accordion-title');
39
39
  expect(accordionItemTitle.text()).toEqual(accordionItem.props().title);
40
40
  });
41
41
  });
42
42
 
43
- test("unstyled", async () => {
43
+ test('unstyled', async () => {
44
44
  const wrapper = mount({
45
45
  template: /*html*/ `
46
46
  <v-accordion>
@@ -48,30 +48,30 @@ describe("VAccordionItem", () => {
48
48
  <v-accordion-item title="Is" unstyled>Janine Duck</v-accordion-item>
49
49
  </v-accordion>`,
50
50
  components: {
51
- "v-accordion": VAccordion,
52
- "v-accordion-item": VAccordionItem,
51
+ 'v-accordion': VAccordion,
52
+ 'v-accordion-item': VAccordionItem,
53
53
  },
54
54
  });
55
55
 
56
56
  const accordionItems = wrapper.findAllComponents(VAccordionItem);
57
57
  accordionItems.forEach((accordionItem) => {
58
- expect(accordionItem.classes()).toEqual(["vuetiful-accordion-item"]);
58
+ expect(accordionItem.classes()).toEqual(['vuetiful-accordion-item']);
59
59
 
60
- const accordionItemButton = accordionItem.find(".vuetiful-accordion-item-button");
60
+ const accordionItemButton = accordionItem.find('.vuetiful-accordion-item-button');
61
61
  expect(accordionItemButton.classes()).toEqual([
62
- "bg-surface-200-700-token",
63
- "hover:variant-soft",
64
- "vuetiful-accordion-item-button",
65
- "flex",
66
- "w-full",
62
+ 'bg-surface-200-700-token',
63
+ 'hover:variant-soft',
64
+ 'vuetiful-accordion-item-button',
65
+ 'flex',
66
+ 'w-full',
67
67
  ]);
68
68
 
69
- const accordionItemTitle = accordionItem.find(".vuetiful-accordion-title");
69
+ const accordionItemTitle = accordionItem.find('.vuetiful-accordion-title');
70
70
  expect(accordionItemTitle.text()).toEqual(accordionItem.props().title);
71
71
  });
72
72
  });
73
73
 
74
- test("open", async () => {
74
+ test('open', async () => {
75
75
  const wrapper = mount({
76
76
  template: /*html*/ `
77
77
  <v-accordion>
@@ -79,31 +79,31 @@ describe("VAccordionItem", () => {
79
79
  <v-accordion-item title="Is">Janine Duck</v-accordion-item>
80
80
  </v-accordion>`,
81
81
  components: {
82
- "v-accordion": VAccordion,
83
- "v-accordion-item": VAccordionItem,
82
+ 'v-accordion': VAccordion,
83
+ 'v-accordion-item': VAccordionItem,
84
84
  },
85
85
  });
86
86
 
87
87
  const accordionItems = wrapper.findAllComponents(VAccordionItem);
88
- const accordionItemButtonOne = accordionItems[0].find(".vuetiful-accordion-item-button");
89
- const accordionItemButtonTwo = accordionItems[1].find(".vuetiful-accordion-item-button");
88
+ const accordionItemButtonOne = accordionItems[0].find('.vuetiful-accordion-item-button');
89
+ const accordionItemButtonTwo = accordionItems[1].find('.vuetiful-accordion-item-button');
90
90
 
91
- await accordionItemButtonOne.trigger("click");
91
+ await accordionItemButtonOne.trigger('click');
92
92
 
93
93
  expect(accordionItemButtonOne.classes()).toEqual([
94
- "!rounded-bl-none",
95
- "!rounded-br-none",
96
- "items-center",
97
- "justify-between",
98
- "p-4",
99
- "py-2",
100
- "rounded-container-token",
101
- "hover:cursor-pointer",
102
- "bg-surface-200-700-token",
103
- "hover:variant-soft",
104
- "vuetiful-accordion-item-button",
105
- "flex",
106
- "w-full",
94
+ '!rounded-bl-none',
95
+ '!rounded-br-none',
96
+ 'items-center',
97
+ 'justify-between',
98
+ 'p-4',
99
+ 'py-2',
100
+ 'rounded-container-token',
101
+ 'hover:cursor-pointer',
102
+ 'bg-surface-200-700-token',
103
+ 'hover:variant-soft',
104
+ 'vuetiful-accordion-item-button',
105
+ 'flex',
106
+ 'w-full',
107
107
  ]);
108
108
  expect(accordionItemButtonTwo.classes()).toEqual([
109
109
  'items-center',
@@ -116,10 +116,10 @@ describe("VAccordionItem", () => {
116
116
  'hover:variant-soft',
117
117
  'vuetiful-accordion-item-button',
118
118
  'flex',
119
- 'w-full'
119
+ 'w-full',
120
120
  ]);
121
-
122
- const accordionItemPanelOne = accordionItems[0].find(".vuetiful-accordion-item-panel");
121
+
122
+ const accordionItemPanelOne = accordionItems[0].find('.vuetiful-accordion-item-panel');
123
123
 
124
124
  expect(accordionItemPanelOne.classes()).toEqual([
125
125
  'vuetiful-accordion-item-panel',
@@ -128,7 +128,7 @@ describe("VAccordionItem", () => {
128
128
  'p-4',
129
129
  'py-2',
130
130
  'rounded-container-token',
131
- 'bg-surface-200-700-token'
131
+ 'bg-surface-200-700-token',
132
132
  ]);
133
133
  });
134
134
  });
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
- import { useSettings } from "@/services";
3
- import { Disclosure, DisclosureButton, DisclosurePanel } from "@headlessui/vue";
4
- import { inject } from "vue";
2
+ import { useSettings } from '@/services';
3
+ import { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue';
4
+ import { inject } from 'vue';
5
5
 
6
6
  const props = defineProps({
7
7
  title: {
@@ -15,34 +15,25 @@ const props = defineProps({
15
15
  },
16
16
  });
17
17
 
18
- const classQuestion = inject("classQuestion");
19
- const classAnswer = inject("classAnswer");
18
+ const classQuestion = inject('classQuestion');
19
+ const classAnswer = inject('classAnswer');
20
20
 
21
21
  const { settings } = useSettings();
22
- const isUnstyled =
23
- settings.global.unstyled || settings.components.accordionItem.unstyled || props.unstyled;
22
+ const isUnstyled = settings.global.unstyled || settings.components.accordionItem.unstyled || props.unstyled;
24
23
  </script>
25
24
 
26
25
  <template>
27
26
  <Disclosure class="vuetiful-accordion-item" as="div" v-slot="{ open }">
28
27
  <DisclosureButton
29
28
  :class="`${isUnstyled ? '' : `${open ? '!rounded-bl-none !rounded-br-none' : ''}`}
30
- ${
31
- isUnstyled
32
- ? ''
33
- : 'items-center justify-between p-4 py-2 rounded-container-token hover:cursor-pointer'
34
- }
29
+ ${isUnstyled ? '' : 'items-center justify-between p-4 py-2 rounded-container-token hover:cursor-pointer'}
35
30
  ${classQuestion}`"
36
31
  class="vuetiful-accordion-item-button flex w-full"
37
32
  >
38
33
  <span class="vuetiful-accordion-title">{{ title }}</span>
39
34
  <slot v-if="!open" name="open-item">
40
35
  <!-- https://fontawesome.com/icons/plus?f=classic&s=solid -->
41
- <svg
42
- class="vuetiful-accordion-item-icon-plus icon"
43
- xmlns="http://www.w3.org/2000/svg"
44
- viewBox="0 0 448 512"
45
- >
36
+ <svg class="vuetiful-accordion-item-icon-plus icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
46
37
  <!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. -->
47
38
  <path
48
39
  d="M256 80c0-17.7-14.3-32-32-32s-32 14.3-32 32V224H48c-17.7 0-32 14.3-32 32s14.3 32 32 32H192V432c0 17.7 14.3 32 32 32s32-14.3 32-32V288H400c17.7 0 32-14.3 32-32s-14.3-32-32-32H256V80z"
@@ -51,11 +42,7 @@ const isUnstyled =
51
42
  </slot>
52
43
  <slot v-if="open" name="close-item">
53
44
  <!-- https://fontawesome.com/icons/minus?f=classic&s=solid -->
54
- <svg
55
- class="vuetiful-accordion-item-icon-minus icon"
56
- xmlns="http://www.w3.org/2000/svg"
57
- viewBox="0 0 448 512"
58
- >
45
+ <svg class="vuetiful-accordion-item-icon-minus icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
59
46
  <!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. -->
60
47
  <path
61
48
  d="M432 256c0 17.7-14.3 32-32 32L48 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l352 0c17.7 0 32 14.3 32 32z"
@@ -1,9 +1,9 @@
1
- import { mount } from "@vue/test-utils";
2
- import { describe, expect, test } from "vitest";
3
- import { VAlert } from "..";
1
+ import { mount } from '@vue/test-utils';
2
+ import { describe, expect, test } from 'vitest';
3
+ import { VAlert } from '..';
4
4
 
5
- describe("VAlert", () => {
6
- test("types", () => {
5
+ describe('VAlert', () => {
6
+ test('types', () => {
7
7
  const wrapper = mount({
8
8
  template: /*html*/ `
9
9
  <v-alert data-test="default"></v-alert>
@@ -13,88 +13,88 @@ describe("VAlert", () => {
13
13
  <v-alert data-test="error" type="error"></v-alert>
14
14
  `,
15
15
  components: {
16
- "v-alert": VAlert,
16
+ 'v-alert': VAlert,
17
17
  },
18
18
  });
19
19
 
20
- const defaultAlert = wrapper.find("[data-test=default]");
21
- expect(defaultAlert.classes()).not.toContain("variant-filled-primary");
20
+ const defaultAlert = wrapper.find('[data-test=default]');
21
+ expect(defaultAlert.classes()).not.toContain('variant-filled-primary');
22
22
 
23
- const infoAlert = wrapper.find("[data-test=info]");
24
- expect(infoAlert.classes()).toContain("variant-filled");
23
+ const infoAlert = wrapper.find('[data-test=info]');
24
+ expect(infoAlert.classes()).toContain('variant-filled');
25
25
 
26
- const successAlert = wrapper.find("[data-test=success]");
27
- expect(successAlert.classes()).toContain("variant-filled-success");
26
+ const successAlert = wrapper.find('[data-test=success]');
27
+ expect(successAlert.classes()).toContain('variant-filled-success');
28
28
 
29
- const warningAlert = wrapper.find("[data-test=warning]");
30
- expect(warningAlert.classes()).toContain("variant-filled-warning");
29
+ const warningAlert = wrapper.find('[data-test=warning]');
30
+ expect(warningAlert.classes()).toContain('variant-filled-warning');
31
31
  });
32
32
 
33
- test("unstyled", () => {
33
+ test('unstyled', () => {
34
34
  const wrapper = mount(VAlert, {
35
35
  props: {
36
36
  unstyled: true,
37
37
  },
38
38
  });
39
39
 
40
- expect(wrapper.classes()).toEqual(["vuetiful-alert", "flex"]);
40
+ expect(wrapper.classes()).toEqual(['vuetiful-alert', 'flex']);
41
41
  });
42
42
 
43
- describe("given close icon is clicked", () => {
44
- test("should emit close", async () => {
43
+ describe('given close icon is clicked', () => {
44
+ test('should emit close', async () => {
45
45
  const wrapper = mount(VAlert, { props: { showClose: true } });
46
- await wrapper.find("[data-test=close]").trigger("click");
47
- expect(wrapper.emitted()["close"][0]).toEqual([]);
46
+ await wrapper.find('[data-test=close]').trigger('click');
47
+ expect(wrapper.emitted()['close'][0]).toEqual([]);
48
48
 
49
- await wrapper.find("[data-test=close]").trigger("keydown", { key: "Enter" });
50
- expect(wrapper.emitted()["close"][0]).toEqual([]);
49
+ await wrapper.find('[data-test=close]').trigger('keydown', { key: 'Enter' });
50
+ expect(wrapper.emitted()['close'][0]).toEqual([]);
51
51
 
52
- await wrapper.find("[data-test=close]").trigger("keydown", { key: " " });
53
- expect(wrapper.emitted()["close"][0]).toEqual([]);
52
+ await wrapper.find('[data-test=close]').trigger('keydown', { key: ' ' });
53
+ expect(wrapper.emitted()['close'][0]).toEqual([]);
54
54
  });
55
55
  });
56
56
 
57
- describe("given a pre slot is provided", () => {
58
- test("should render the pre slot", () => {
57
+ describe('given a pre slot is provided', () => {
58
+ test('should render the pre slot', () => {
59
59
  const wrapper = mount(VAlert, {
60
60
  slots: {
61
- pre: "John Duck",
61
+ pre: 'John Duck',
62
62
  },
63
63
  });
64
- expect(wrapper.text()).toContain("John Duck");
64
+ expect(wrapper.text()).toContain('John Duck');
65
65
  });
66
66
  });
67
67
 
68
- describe("given a actions slot is provided", () => {
69
- test("should render the actions slot", () => {
68
+ describe('given a actions slot is provided', () => {
69
+ test('should render the actions slot', () => {
70
70
  const wrapper = mount(VAlert, {
71
71
  slots: {
72
- actions: "John Duck",
72
+ actions: 'John Duck',
73
73
  },
74
74
  });
75
- expect(wrapper.text()).toContain("John Duck");
75
+ expect(wrapper.text()).toContain('John Duck');
76
76
  });
77
77
  });
78
78
 
79
- describe("given hide-icon prop is present", () => {
80
- test("should not render an icon", () => {
79
+ describe('given hide-icon prop is present', () => {
80
+ test('should not render an icon', () => {
81
81
  const wrapper = mount(VAlert, {
82
82
  props: {
83
83
  hideIcon: true,
84
84
  },
85
85
  });
86
- expect(wrapper.findAll(".icon").length).toBe(0);
86
+ expect(wrapper.findAll('.icon').length).toBe(0);
87
87
  });
88
88
  });
89
89
 
90
- describe("given show-close prop is present", () => {
91
- test("should render a close icon", () => {
90
+ describe('given show-close prop is present', () => {
91
+ test('should render a close icon', () => {
92
92
  const wrapper = mount(VAlert, {
93
93
  props: {
94
94
  showClose: true,
95
95
  },
96
96
  });
97
- expect(wrapper.find("[data-test=close]").exists()).toBe(true);
97
+ expect(wrapper.find('[data-test=close]').exists()).toBe(true);
98
98
  });
99
99
  });
100
100
  });
@@ -1,8 +1,8 @@
1
1
  <script setup lang="ts">
2
- import { useSettings } from "@/services";
3
- import { PropType, computed } from "vue";
2
+ import { useSettings } from '@/services';
3
+ import { PropType, computed } from 'vue';
4
4
 
5
- const emit = defineEmits(["close"]);
5
+ const emit = defineEmits(['close']);
6
6
  const props = defineProps({
7
7
  hideIcon: {
8
8
  type: Boolean,
@@ -18,21 +18,21 @@ const props = defineProps({
18
18
  default: true,
19
19
  },
20
20
  type: {
21
- type: String as PropType<"info" | "success" | "warning" | "error" | "">,
22
- default: "",
21
+ type: String as PropType<'info' | 'success' | 'warning' | 'error' | ''>,
22
+ default: '',
23
23
  },
24
24
 
25
25
  classPre: {
26
26
  type: String,
27
- default: "",
27
+ default: '',
28
28
  },
29
29
  classMessage: {
30
30
  type: String,
31
- default: "",
31
+ default: '',
32
32
  },
33
33
  classClose: {
34
34
  type: String,
35
- default: "",
35
+ default: '',
36
36
  },
37
37
 
38
38
  unstyled: {
@@ -43,22 +43,22 @@ const props = defineProps({
43
43
 
44
44
  const typeBackground = computed(() => {
45
45
  switch (props.type) {
46
- case "info":
47
- return "variant-filled";
48
- case "success":
49
- return "variant-filled-success";
50
- case "warning":
51
- return "variant-filled-warning";
52
- case "error":
53
- return "variant-filled-error";
54
- case "":
55
- return "";
46
+ case 'info':
47
+ return 'variant-filled';
48
+ case 'success':
49
+ return 'variant-filled-success';
50
+ case 'warning':
51
+ return 'variant-filled-warning';
52
+ case 'error':
53
+ return 'variant-filled-error';
54
+ case '':
55
+ return '';
56
56
  }
57
57
  });
58
58
 
59
- const close = () => emit("close");
59
+ const close = () => emit('close');
60
60
  const handleKeydown = (event: KeyboardEvent) => {
61
- if (event.key === "Enter" || event.key === " ") {
61
+ if (event.key === 'Enter' || event.key === ' ') {
62
62
  close();
63
63
  }
64
64
  };
@@ -71,57 +71,35 @@ const isUnstyled = settings.global.unstyled || settings.components.alert.unstyle
71
71
  <aside
72
72
  v-if="show"
73
73
  :class="`vuetiful-alert flex ${
74
- isUnstyled
75
- ? ''
76
- : 'w-full items-center gap-4 p-4 border-token rounded-container-token'
74
+ isUnstyled ? '' : 'w-full items-center gap-4 p-4 border-token rounded-container-token'
77
75
  } ${typeBackground}`"
78
76
  >
79
77
  <div v-if="!hideIcon" :class="`vuetiful-alert-pre ${classPre}`">
80
78
  <slot v-if="$slots.pre" name="pre" />
81
79
  <template v-if="!$slots.pre">
82
80
  <!-- https://fontawesome.com/icons/circle-info?f=classic&s=solid -->
83
- <svg
84
- v-if="type === 'info'"
85
- class="icon"
86
- xmlns="http://www.w3.org/2000/svg"
87
- viewBox="0 0 512 512"
88
- >
81
+ <svg v-if="type === 'info'" class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
89
82
  <path
90
83
  d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"
91
84
  />
92
85
  </svg>
93
86
 
94
87
  <!-- https://fontawesome.com/icons/circle-check?f=classic&s=solid -->
95
- <svg
96
- v-if="type === 'success'"
97
- class="icon"
98
- xmlns="http://www.w3.org/2000/svg"
99
- viewBox="0 0 512 512"
100
- >
88
+ <svg v-if="type === 'success'" class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
101
89
  <path
102
90
  d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"
103
91
  />
104
92
  </svg>
105
93
 
106
94
  <!-- https://fontawesome.com/icons/circle-exclamation?f=classic&s=solid -->
107
- <svg
108
- v-if="type === 'warning'"
109
- class="icon"
110
- xmlns="http://www.w3.org/2000/svg"
111
- viewBox="0 0 512 512"
112
- >
95
+ <svg v-if="type === 'warning'" class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
113
96
  <path
114
97
  d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"
115
98
  />
116
99
  </svg>
117
100
 
118
101
  <!-- https://fontawesome.com/icons/triangle-exclamation?f=classic&s=solid -->
119
- <svg
120
- v-if="type === 'error'"
121
- class="icon"
122
- xmlns="http://www.w3.org/2000/svg"
123
- viewBox="0 0 512 512"
124
- >
102
+ <svg v-if="type === 'error'" class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
125
103
  <path
126
104
  d="M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"
127
105
  />
@@ -1,46 +1,46 @@
1
- import { mount } from "@vue/test-utils";
2
- import { describe, expect, test } from "vitest";
3
- import { VCard } from "..";
1
+ import { mount } from '@vue/test-utils';
2
+ import { describe, expect, test } from 'vitest';
3
+ import { VCard } from '..';
4
4
 
5
- describe("VCard", () => {
6
- test("defaults", async () => {
5
+ describe('VCard', () => {
6
+ test('defaults', async () => {
7
7
  const wrapper = mount(VCard);
8
8
  expect(wrapper.props()).toEqual({
9
- background: "bg-surface-200-700-token",
9
+ background: 'bg-surface-200-700-token',
10
10
  clickable: false,
11
11
  hideSeparator: false,
12
- text: "text-surface-900-50-token",
12
+ text: 'text-surface-900-50-token',
13
13
  unstyled: false,
14
14
  });
15
15
  });
16
16
 
17
- describe("given the card is clicked", () => {
18
- describe("given the card is not clickable", () => {
19
- test("should not emit click", async () => {
17
+ describe('given the card is clicked', () => {
18
+ describe('given the card is not clickable', () => {
19
+ test('should not emit click', async () => {
20
20
  const wrapper = mount(VCard, { props: { clickable: false } });
21
21
  expect(wrapper.attributes()['tabindex']).toBeUndefined();
22
- await wrapper.trigger("click");
23
- expect(wrapper.emitted()["click"]).toBeUndefined();
22
+ await wrapper.trigger('click');
23
+ expect(wrapper.emitted()['click']).toBeUndefined();
24
24
 
25
- await wrapper.trigger("keydown", { key: "Enter" });
26
- expect(wrapper.emitted()["click"]).toBeUndefined();
25
+ await wrapper.trigger('keydown', { key: 'Enter' });
26
+ expect(wrapper.emitted()['click']).toBeUndefined();
27
27
 
28
- await wrapper.trigger("keydown", { key: " " });
29
- expect(wrapper.emitted()["click"]).toBeUndefined();
28
+ await wrapper.trigger('keydown', { key: ' ' });
29
+ expect(wrapper.emitted()['click']).toBeUndefined();
30
30
  });
31
31
  });
32
- describe("given the card is clickable", () => {
33
- test("should emit click", async () => {
32
+ describe('given the card is clickable', () => {
33
+ test('should emit click', async () => {
34
34
  const wrapper = mount(VCard, { props: { clickable: true } });
35
- expect(wrapper.attributes()['tabindex']).toEqual("0");
36
- await wrapper.trigger("click");
37
- expect(wrapper.emitted()["click"].length).toEqual(1);
35
+ expect(wrapper.attributes()['tabindex']).toEqual('0');
36
+ await wrapper.trigger('click');
37
+ expect(wrapper.emitted()['click'].length).toEqual(1);
38
38
 
39
- await wrapper.trigger("keydown", { key: "Enter" });
40
- expect(wrapper.emitted()["click"].length).toEqual(2);
39
+ await wrapper.trigger('keydown', { key: 'Enter' });
40
+ expect(wrapper.emitted()['click'].length).toEqual(2);
41
41
 
42
- await wrapper.trigger("keydown", { key: " " });
43
- expect(wrapper.emitted()["click"].length).toEqual(3);
42
+ await wrapper.trigger('keydown', { key: ' ' });
43
+ expect(wrapper.emitted()['click'].length).toEqual(3);
44
44
  });
45
45
  });
46
46
  });