Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.

Commit be0891f

Browse files
committed
feat: Use VButton as default of "as" prop instead "button"
1 parent c06206e commit be0891f

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

packages/vue/src/components/accordion/VAccordionTrigger.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<script setup lang="ts">
22
import { computed } from "vue";
3+
import { VButton } from "~/components";
34
import type { ComponentAs, VBindAttributes } from "~/types";
45
import type { VAccordionTriggerProps } from "./types";
56
import { useVAccordionContext, useVAccordionItemContext } from "./context";
67
78
withDefaults(defineProps<VAccordionTriggerProps>(), {
8-
as: (): ComponentAs => "button",
9+
as: (): ComponentAs => VButton,
910
});
1011
1112
const { id, renderedItems, toggleItem } = useVAccordionContext(

packages/vue/src/components/dropdown/VDropdownTrigger.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<script setup lang="ts">
22
import { computed } from "vue";
3+
import { VButton } from "~/components";
34
import type { ComponentAs, VBindAttributes } from "~/types";
45
import { useVDropdownContext } from "./context";
56
import type { VDropdownTriggerProps } from "./types";
67
78
withDefaults(defineProps<VDropdownTriggerProps>(), {
8-
as: (): ComponentAs => "button",
9+
as: (): ComponentAs => VButton,
910
});
1011
1112
const {

packages/vue/src/components/popover/VPopoverTrigger.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<script setup lang="ts">
22
import { ref } from "vue";
3+
import { VButton } from "~/components";
34
import type { ComponentAs } from "~/types";
45
import { useVPopoverContext } from "./context";
56
import type { VPopoverTriggerProps } from "./types";
67
78
withDefaults(defineProps<VPopoverTriggerProps>(), {
8-
as: (): ComponentAs => "button",
9+
as: (): ComponentAs => VButton,
910
});
1011
1112
const { hooks, id, trigger } = useVPopoverContext("<VPopoverTrigger>");

packages/vue/src/components/roving-tabindex/VRovingTabindexItem.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<script setup lang="ts">
22
import { unrefElement } from "@vueuse/core";
33
import { type ComponentPublicInstance, computed, ref, toRefs } from "vue";
4+
import { VButton } from "~/components";
45
import type { ComponentAs, VBindAttributes } from "~/types";
56
import type { VRovingTabindexItemProps } from "./types";
67
import { useVRovingTabindexContext } from "./context";
78
89
const props = withDefaults(defineProps<VRovingTabindexItemProps>(), {
9-
as: (): ComponentAs => "button",
10+
as: (): ComponentAs => VButton,
1011
disabled: false,
1112
});
1213
@@ -27,7 +28,7 @@ const bind = computed(() => {
2728
if (disabled.value || !nodeElement.value) return;
2829
setActiveItem(nodeElement.value as HTMLElement);
2930
},
30-
} satisfies VBindAttributes;
31+
} satisfies VBindAttributes<"button">;
3132
});
3233
</script>
3334

packages/vue/src/components/tabs/VTabsTrigger.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { unrefElement } from "@vueuse/core";
33
import { omit } from "lodash-es";
44
import { type ComponentPublicInstance, computed, ref, toRefs } from "vue";
5-
import { VRovingTabindexItem } from "~/components";
5+
import { VButton, VRovingTabindexItem } from "~/components";
66
import type { ComponentAs, VBindAttributes } from "~/types";
77
import { useVTabsContext } from "./context";
88
import type { VTabsTriggerProps } from "./types";
@@ -12,7 +12,7 @@ defineOptions({
1212
});
1313
1414
const props = withDefaults(defineProps<VTabsTriggerProps>(), {
15-
as: (): ComponentAs => "button",
15+
as: (): ComponentAs => VButton,
1616
disabled: false,
1717
});
1818
@@ -29,8 +29,8 @@ const controls = computed(() => {
2929
3030
const bind = computed(() => {
3131
return {
32-
"id": `${id.value}-${value.value}-trigger`,
3332
"disabled": disabled.value,
33+
"id": `${id.value}-${value.value}-trigger`,
3434
"role": "tab",
3535
"aria-selected": selected.value,
3636
"aria-controls": controls.value,

packages/vue/src/components/tooltip/VTooltipTrigger.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<script setup lang="ts">
22
import { computed } from "vue";
3+
import { VButton } from "~/components";
34
import { useGlobalEscapeStack } from "~/composables";
45
import type { ComponentAs } from "~/types";
56
import { useVTooltipContext } from "./context";
67
import type { VTooltipTriggerProps } from "./types";
78
89
withDefaults(defineProps<VTooltipTriggerProps>(), {
9-
as: (): ComponentAs => "button",
10+
as: (): ComponentAs => VButton,
1011
});
1112
1213
const { enterDelay, leaveDelay, id, trigger, visible, hooks } =

0 commit comments

Comments
 (0)