@code-coaching/vuetiful 0.23.1 → 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 +1 -1
  24. package/dist/types/utils/theme/theme.service.d.ts +1 -1
  25. package/dist/vuetiful.es.mjs +12 -18
  26. package/dist/vuetiful.umd.js +3 -3
  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 +10 -13
  143. package/src/utils/theme/theme.service.test.ts +69 -61
  144. package/src/utils/theme/theme.service.ts +19 -20
@@ -1,20 +1,20 @@
1
1
  <script setup lang="ts">
2
- import { CssClasses, VButton, useSettings, vClipboard } from "@/index";
3
- import { unstyledProp } from "@/props";
4
- import { useHighlight } from "@/services/highlight.service";
5
- import "highlight.js/styles/github-dark.css";
6
- import { ref } from "vue";
2
+ import { CssClasses, VButton, useSettings, vClipboard } from '@/index';
3
+ import { unstyledProp } from '@/props';
4
+ import { useHighlight } from '@/services/highlight.service';
5
+ import 'highlight.js/styles/github-dark.css';
6
+ import { ref } from 'vue';
7
7
 
8
8
  const { highlight } = useHighlight();
9
9
 
10
10
  const props = defineProps({
11
11
  language: {
12
12
  type: String,
13
- default: "plaintext",
13
+ default: 'plaintext',
14
14
  },
15
15
  code: {
16
16
  type: String,
17
- default: "",
17
+ default: '',
18
18
  },
19
19
 
20
20
  preventOverflow: {
@@ -24,48 +24,48 @@ const props = defineProps({
24
24
 
25
25
  classHeader: {
26
26
  type: String as () => CssClasses,
27
- default: "",
27
+ default: '',
28
28
  },
29
29
  classLanguage: {
30
30
  type: String as () => CssClasses,
31
- default: "",
31
+ default: '',
32
32
  },
33
33
  classPre: {
34
34
  type: String as () => CssClasses,
35
- default: "",
35
+ default: '',
36
36
  },
37
37
  classCode: {
38
38
  type: String as () => CssClasses,
39
- default: "",
39
+ default: '',
40
40
  },
41
41
 
42
42
  classButton: {
43
43
  type: String as () => CssClasses,
44
- default: "",
44
+ default: '',
45
45
  },
46
46
  buttonText: {
47
47
  type: String,
48
- default: "Copy",
48
+ default: 'Copy',
49
49
  },
50
50
  buttonCopiedText: {
51
51
  type: String,
52
- default: "👍",
52
+ default: '👍',
53
53
  },
54
54
 
55
55
  unstyled: unstyledProp,
56
56
  });
57
57
 
58
58
  const emit = defineEmits<{
59
- (event: "copy"): void;
59
+ (event: 'copy'): void;
60
60
  }>();
61
61
 
62
62
  const copyState = ref(false);
63
63
 
64
64
  // Allow shorthand alias, but show full text in UI
65
65
  function languageFormatter(lang: string): string {
66
- if (lang === "js") return "javascript";
67
- if (lang === "ts") return "typescript";
68
- if (["sh", "bash", "zsh", "shell"].includes(lang)) return "console";
66
+ if (lang === 'js') return 'javascript';
67
+ if (lang === 'ts') return 'typescript';
68
+ if (['sh', 'bash', 'zsh', 'shell'].includes(lang)) return 'console';
69
69
  return lang;
70
70
  }
71
71
 
@@ -74,36 +74,29 @@ function onCopyClick() {
74
74
  setTimeout(() => {
75
75
  copyState.value = false;
76
76
  }, 2000);
77
- emit("copy");
77
+ emit('copy');
78
78
  }
79
79
 
80
80
  const { settings } = useSettings();
81
- const isUnstyled =
82
- settings.global.unstyled || settings.components.codeBlock.unstyled || props.unstyled;
81
+ const isUnstyled = settings.global.unstyled || settings.components.codeBlock.unstyled || props.unstyled;
83
82
  </script>
84
83
 
85
84
  <template v-if="language && code">
86
85
  <div
87
86
  :class="`vuetiful-code-block code-block ${
88
- isUnstyled
89
- ? ''
90
- : 'max-w-full bg-[#171717] text-sm text-white shadow rounded-container-token'
87
+ isUnstyled ? '' : 'max-w-full bg-[#171717] text-sm text-white shadow rounded-container-token'
91
88
  }`"
92
89
  >
93
90
  <header
94
91
  :class="`vuetiful-code-block-header ${
95
- isUnstyled
96
- ? ''
97
- : 'flex items-center justify-between p-2 pb-0 pl-4 text-xs uppercase text-[#a4a4a4]'
92
+ isUnstyled ? '' : 'flex items-center justify-between p-2 pb-0 pl-4 text-xs uppercase text-[#a4a4a4]'
98
93
  } ${classHeader}`"
99
94
  >
100
- <span :class="`vuetiful-code-block-language ${classLanguage}`">{{
101
- languageFormatter(language)
102
- }}</span>
95
+ <span :class="`vuetiful-code-block-language ${classLanguage}`">{{ languageFormatter(language) }}</span>
103
96
  <v-button
104
97
  size="sm"
105
98
  :class="`vuetiful-code-block-button ${
106
- classButton ? classButton : 'bg-[#171717] dark:bg-[#171717] text-[#a4a4a4] dark:text-[#a4a4a4]'
99
+ classButton ? classButton : 'bg-[#171717] text-[#a4a4a4] dark:bg-[#171717] dark:text-[#a4a4a4]'
107
100
  }`"
108
101
  @click="onCopyClick()"
109
102
  v-clipboard="code"
@@ -112,9 +105,9 @@ const isUnstyled =
112
105
  </v-button>
113
106
  </header>
114
107
  <pre
115
- :class="`vuetiful-code-block-pre ${
116
- isUnstyled ? '' : '!rounded-t-none bg-transparent p-4 !pt-0'
117
- } ${preventOverflow ? 'whitespace-pre-wrap break-all' : 'overflow-auto'} ${classPre}`"
108
+ :class="`vuetiful-code-block-pre ${isUnstyled ? '' : '!rounded-t-none bg-transparent p-4 !pt-0'} ${
109
+ preventOverflow ? 'whitespace-pre-wrap break-all' : 'overflow-auto'
110
+ } ${classPre}`"
118
111
  ><code :class="`vuetiful-code-block-code language-${language} ${classCode}`" v-html="highlight(code, language)"></code></pre>
119
112
  </div>
120
113
  </template>
@@ -1,13 +1,13 @@
1
- import { mount } from "@vue/test-utils";
2
- import { expect, test } from "vitest";
3
- import { VDrawer } from ".";
1
+ import { mount } from '@vue/test-utils';
2
+ import { expect, test } from 'vitest';
3
+ import { VDrawer } from '.';
4
4
 
5
- test("VDrawer", () => {
5
+ test('VDrawer', () => {
6
6
  expect(VDrawer).toBeTruthy();
7
7
  });
8
8
 
9
9
  // TODO: add tests
10
- test("VDrawer using slot", () => {
10
+ test('VDrawer using slot', () => {
11
11
  const wrapper = mount(VDrawer);
12
12
 
13
13
  expect(wrapper).toBeTruthy();
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
- import type { CssClasses } from "@/index";
3
- import { useDrawer } from "@/services";
4
- import { Ref, computed, onMounted, ref, toRefs } from "vue";
2
+ import type { CssClasses } from '@/index';
3
+ import { useDrawer } from '@/services';
4
+ import { Ref, computed, onMounted, ref, toRefs } from 'vue';
5
5
 
6
6
  const { drawer, close } = useDrawer();
7
7
 
@@ -10,21 +10,21 @@ const props = defineProps({
10
10
  // Regions
11
11
  regionBackdrop: {
12
12
  type: String as () => CssClasses,
13
- default: "",
13
+ default: '',
14
14
  },
15
15
  regionDrawer: {
16
16
  type: String as () => CssClasses,
17
- default: "",
17
+ default: '',
18
18
  },
19
19
 
20
20
  // a11y
21
21
  labelledby: {
22
22
  type: String,
23
- default: "",
23
+ default: '',
24
24
  },
25
25
  describedby: {
26
26
  type: String,
27
- default: "",
27
+ default: '',
28
28
  },
29
29
  });
30
30
 
@@ -37,7 +37,7 @@ const presets = {
37
37
  right: { alignment: 'right-0', width: 'w-[90%]', height: 'h-full', rounded: 'rounded-tl-container-token rounded-bl-container-token' }
38
38
  };
39
39
  const preset = computed(() => {
40
- const position = drawer.position || "left";
40
+ const position = drawer.position || 'left';
41
41
  return presets[position];
42
42
  });
43
43
  // #endregion
@@ -53,10 +53,10 @@ const onBackdropInteraction = (event: Event) => {
53
53
  };
54
54
 
55
55
  const onKeydownWindow = (event: KeyboardEvent) => {
56
- if (event.code === "Escape") close();
56
+ if (event.code === 'Escape') close();
57
57
  };
58
58
  onMounted(() => {
59
- window.addEventListener("keydown", onKeydownWindow);
59
+ window.addEventListener('keydown', onKeydownWindow);
60
60
  });
61
61
  // #endregion
62
62
  </script>
@@ -1,26 +1,26 @@
1
- import { mount } from "@vue/test-utils";
2
- import { describe, expect, test } from "vitest";
3
- import { ref } from "vue";
4
- import { VListboxItem } from "..";
5
- import VListbox from "./VListbox.vue";
1
+ import { mount } from '@vue/test-utils';
2
+ import { describe, expect, test } from 'vitest';
3
+ import { ref } from 'vue';
4
+ import { VListboxItem } from '..';
5
+ import VListbox from './VListbox.vue';
6
6
 
7
- describe("VListbox", () => {
8
- test("default props", () => {
7
+ describe('VListbox', () => {
8
+ test('default props', () => {
9
9
  const wrapper = mount(VListbox);
10
10
 
11
11
  expect(wrapper.props()).toEqual({
12
12
  modelValue: undefined,
13
- classLabel: "",
14
- textButton: "Select an option",
15
- classButton: "",
16
- classItem: "",
17
- classItems: "",
13
+ classLabel: '',
14
+ textButton: 'Select an option',
15
+ classButton: '',
16
+ classItem: '',
17
+ classItems: '',
18
18
  horizontal: false,
19
19
  multiple: false,
20
- active: "variant-filled",
21
- hover: "hover:variant-ghost",
22
- background: "bg-surface-200-700-token",
23
- text: "text-surface-900 dark:text-surface-50",
20
+ active: 'variant-filled',
21
+ hover: 'hover:variant-ghost',
22
+ background: 'bg-surface-200-700-token',
23
+ text: 'text-surface-900 dark:text-surface-50',
24
24
  unstyled: false,
25
25
  by: undefined,
26
26
  display: undefined,
@@ -28,8 +28,8 @@ describe("VListbox", () => {
28
28
  });
29
29
  });
30
30
 
31
- describe("modelValue", () => {
32
- test("should update modelValue", async () => {
31
+ describe('modelValue', () => {
32
+ test('should update modelValue', async () => {
33
33
  const choice = ref();
34
34
  const wrapper = mount({
35
35
  setup() {
@@ -43,20 +43,20 @@ describe("VListbox", () => {
43
43
  </v-listbox>
44
44
  `,
45
45
  components: {
46
- "v-listbox": VListbox,
47
- "v-listbox-item": VListboxItem,
46
+ 'v-listbox': VListbox,
47
+ 'v-listbox-item': VListboxItem,
48
48
  },
49
49
  });
50
50
 
51
51
  const listbox = wrapper.find("[data-test='listbox']");
52
- await listbox.find("[data-test='listbox-button']").trigger("click");
53
- await listbox.find("[data-test='vuetiful']").trigger("click");
54
- expect(choice.value).toBe("vuetiful");
52
+ await listbox.find("[data-test='listbox-button']").trigger('click');
53
+ await listbox.find("[data-test='vuetiful']").trigger('click');
54
+ expect(choice.value).toBe('vuetiful');
55
55
  });
56
56
  });
57
57
 
58
- describe("object modelValue", () => {
59
- test("should use display prop", async () => {
58
+ describe('object modelValue', () => {
59
+ test('should use display prop', async () => {
60
60
  const choice = ref();
61
61
  const wrapper = mount({
62
62
  setup() {
@@ -70,24 +70,24 @@ describe("VListbox", () => {
70
70
  </v-listbox>
71
71
  `,
72
72
  components: {
73
- "v-listbox": VListbox,
74
- "v-listbox-item": VListboxItem,
73
+ 'v-listbox': VListbox,
74
+ 'v-listbox-item': VListboxItem,
75
75
  },
76
76
  });
77
77
 
78
78
  const listbox = wrapper.find("[data-test='listbox']");
79
79
  const button = listbox.find("[data-test='listbox-button']");
80
- expect(button.text()).toBe("Select an option");
81
- await button.trigger("click");
82
- await listbox.find("[data-test='vuetiful']").trigger("click");
80
+ expect(button.text()).toBe('Select an option');
81
+ await button.trigger('click');
82
+ await listbox.find("[data-test='vuetiful']").trigger('click');
83
83
 
84
- expect(choice.value).toEqual({ name: "vuetiful", id: 0 });
85
- expect(button.text()).toBe("vuetiful");
84
+ expect(choice.value).toEqual({ name: 'vuetiful', id: 0 });
85
+ expect(button.text()).toBe('vuetiful');
86
86
  });
87
87
  });
88
88
 
89
- describe("multiple", () => {
90
- test("should update modelValue and button text", async () => {
89
+ describe('multiple', () => {
90
+ test('should update modelValue and button text', async () => {
91
91
  const choice = ref([]);
92
92
  const wrapper = mount({
93
93
  setup() {
@@ -101,28 +101,28 @@ describe("VListbox", () => {
101
101
  </v-listbox>
102
102
  `,
103
103
  components: {
104
- "v-listbox": VListbox,
105
- "v-listbox-item": VListboxItem,
104
+ 'v-listbox': VListbox,
105
+ 'v-listbox-item': VListboxItem,
106
106
  },
107
107
  });
108
108
 
109
109
  const listbox = wrapper.find("[data-test='listbox']");
110
110
  const button = listbox.find("[data-test='listbox-button']");
111
- expect(button.text()).toBe("Select an option");
111
+ expect(button.text()).toBe('Select an option');
112
112
 
113
- await button.trigger("click");
114
- await listbox.find("[data-test='vuetiful']").trigger("click");
115
- expect(choice.value).toEqual(["vuetiful"]);
116
- expect(button.text()).toBe("vuetiful");
113
+ await button.trigger('click');
114
+ await listbox.find("[data-test='vuetiful']").trigger('click');
115
+ expect(choice.value).toEqual(['vuetiful']);
116
+ expect(button.text()).toBe('vuetiful');
117
117
 
118
- await listbox.find("[data-test='is']").trigger("click");
119
- expect(choice.value).toEqual(["vuetiful", "is"]);
120
- expect(button.text()).toBe("2 options selected");
118
+ await listbox.find("[data-test='is']").trigger('click');
119
+ expect(choice.value).toEqual(['vuetiful', 'is']);
120
+ expect(button.text()).toBe('2 options selected');
121
121
  });
122
122
  });
123
123
 
124
- describe("unstyled", () => {
125
- test("should only have vuetiful- classes", async () => {
124
+ describe('unstyled', () => {
125
+ test('should only have vuetiful- classes', async () => {
126
126
  const wrapper = mount(VListbox, {
127
127
  props: {
128
128
  unstyled: true,
@@ -130,16 +130,16 @@ describe("VListbox", () => {
130
130
  });
131
131
 
132
132
  const listbox = wrapper.find("[data-test='listbox']");
133
- await listbox.find("[data-test='listbox-button']").trigger("click");
133
+ await listbox.find("[data-test='listbox-button']").trigger('click');
134
134
  const listboxItems = wrapper.find("[data-test='listbox-items']");
135
135
 
136
- expect(listbox.classes()).toEqual(["vuetiful-listbox"]);
136
+ expect(listbox.classes()).toEqual(['vuetiful-listbox']);
137
137
  expect(listboxItems.classes()).toEqual([
138
- "z-10",
139
- "bg-surface-200-700-token",
140
- "text-surface-900",
141
- "dark:text-surface-50",
142
- "flex-col",
138
+ 'z-10',
139
+ 'bg-surface-200-700-token',
140
+ 'text-surface-900',
141
+ 'dark:text-surface-50',
142
+ 'flex-col',
143
143
  ]);
144
144
  });
145
145
  });
@@ -1,15 +1,15 @@
1
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"]);
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
11
  const props = defineProps({
12
- modelValue: Listbox.props["modelValue"],
12
+ modelValue: Listbox.props['modelValue'],
13
13
 
14
14
  by: {
15
15
  type: String,
@@ -23,25 +23,25 @@ const props = defineProps({
23
23
  },
24
24
  classLabel: {
25
25
  type: String as () => CssClasses,
26
- default: "",
26
+ default: '',
27
27
  },
28
28
 
29
29
  textButton: {
30
30
  type: String,
31
- default: "Select an option",
31
+ default: 'Select an option',
32
32
  },
33
33
  classButton: {
34
34
  type: String as () => CssClasses,
35
- default: "",
35
+ default: '',
36
36
  },
37
37
 
38
38
  classItem: {
39
39
  type: String as () => CssClasses,
40
- default: "",
40
+ default: '',
41
41
  },
42
42
  classItems: {
43
43
  type: String as () => CssClasses,
44
- default: "",
44
+ default: '',
45
45
  },
46
46
 
47
47
  horizontal: {
@@ -55,20 +55,20 @@ const props = defineProps({
55
55
 
56
56
  active: {
57
57
  type: String,
58
- default: "variant-filled",
58
+ default: 'variant-filled',
59
59
  },
60
60
  hover: {
61
61
  type: String,
62
- default: "hover:variant-ghost",
62
+ default: 'hover:variant-ghost',
63
63
  },
64
64
 
65
65
  background: {
66
66
  type: String,
67
- default: "bg-surface-200-700-token",
67
+ default: 'bg-surface-200-700-token',
68
68
  },
69
69
  text: {
70
70
  type: String,
71
- default: "text-surface-900 dark:text-surface-50",
71
+ default: 'text-surface-900 dark:text-surface-50',
72
72
  },
73
73
 
74
74
  unstyled: unstyledProp,
@@ -79,23 +79,23 @@ watch(
79
79
  () => props.modelValue,
80
80
  (newValue) => {
81
81
  parentModelValue.value = newValue;
82
- }
82
+ },
83
83
  );
84
84
  watch(
85
85
  () => parentModelValue.value,
86
86
  (newValue) => {
87
- emit("update:modelValue", newValue);
88
- }
87
+ emit('update:modelValue', newValue);
88
+ },
89
89
  );
90
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);
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
99
 
100
100
  const showText = computed(() => {
101
101
  if (props.display && parentModelValue.value) return parentModelValue.value[props.display];
@@ -111,8 +111,7 @@ const showText = computed(() => {
111
111
  });
112
112
 
113
113
  const { settings } = useSettings();
114
- const isUnstyled =
115
- settings.global.unstyled || settings.components.listbox.unstyled || props.unstyled;
114
+ const isUnstyled = settings.global.unstyled || settings.components.listbox.unstyled || props.unstyled;
116
115
  </script>
117
116
 
118
117
  <template>
@@ -1,10 +1,10 @@
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";
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
5
 
6
- describe("VListboxButton props", () => {
7
- test("defaults", () => {
6
+ describe('VListboxButton props', () => {
7
+ test('defaults', () => {
8
8
  const wrapper = mount({
9
9
  provide: {
10
10
  unstyled: false,
@@ -15,13 +15,13 @@ describe("VListboxButton props", () => {
15
15
  </Listbox>
16
16
  `,
17
17
  components: {
18
- "v-listbox-button": VListboxButton,
18
+ 'v-listbox-button': VListboxButton,
19
19
  Listbox: Listbox,
20
20
  },
21
21
  });
22
22
 
23
23
  const listboxButton = wrapper.find("[data-test='listbox-button']");
24
- expect(listboxButton.element.tagName).toBe("BUTTON");
24
+ expect(listboxButton.element.tagName).toBe('BUTTON');
25
25
  });
26
26
 
27
27
  test("custom 'as' prop", () => {
@@ -35,16 +35,16 @@ describe("VListboxButton props", () => {
35
35
  </Listbox>
36
36
  `,
37
37
  components: {
38
- "v-listbox-button": VListboxButton,
38
+ 'v-listbox-button': VListboxButton,
39
39
  Listbox: Listbox,
40
40
  },
41
41
  });
42
42
 
43
43
  const listboxButton = wrapper.find("[data-test='listbox-button']");
44
- expect(listboxButton.element.tagName).toBe("DIV");
44
+ expect(listboxButton.element.tagName).toBe('DIV');
45
45
  });
46
46
 
47
- test("should hide icon", () => {
47
+ test('should hide icon', () => {
48
48
  const wrapper = mount({
49
49
  provide: {
50
50
  unstyled: false,
@@ -55,12 +55,12 @@ describe("VListboxButton props", () => {
55
55
  </Listbox>
56
56
  `,
57
57
  components: {
58
- "v-listbox-button": VListboxButton,
58
+ 'v-listbox-button': VListboxButton,
59
59
  Listbox: Listbox,
60
60
  },
61
61
  });
62
62
 
63
63
  const listboxButton = wrapper.find("[data-test='listbox-button']");
64
- expect(listboxButton.find("svg").exists()).toBe(false);
64
+ expect(listboxButton.find('svg').exists()).toBe(false);
65
65
  });
66
66
  });
@@ -1,12 +1,12 @@
1
1
  <script setup lang="ts">
2
- import { useSettings } from "@/index";
3
- import { ListboxButton } from "@headlessui/vue";
4
- import { inject } from "vue";
2
+ import { useSettings } from '@/index';
3
+ import { ListboxButton } from '@headlessui/vue';
4
+ import { inject } from 'vue';
5
5
 
6
6
  defineProps({
7
7
  as: {
8
8
  type: String,
9
- default: "button",
9
+ default: 'button',
10
10
  },
11
11
  hideIcon: {
12
12
  type: Boolean,
@@ -14,7 +14,7 @@ defineProps({
14
14
  },
15
15
  });
16
16
 
17
- const unstyled = inject("unstyled") as boolean;
17
+ const unstyled = inject('unstyled') as boolean;
18
18
 
19
19
  const { settings } = useSettings();
20
20
  const isUnstyled = settings.global.unstyled || settings.components.listbox.unstyled || unstyled;