Rename `RcDropdown.d.ts` to `types.ts`

Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
This commit is contained in:
Phillip Rak 2025-01-24 14:01:16 -07:00
parent 2445fb52b5
commit 8a173db084
6 changed files with 16 additions and 13 deletions

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { inject } from 'vue';
import { DropdownCollection, defaultCollection, DropdownContext, defaultContext } from './RcDropdown'
import { DropdownCollection, defaultCollection, DropdownContext, defaultContext } from './types';
const props = defineProps({ disabled: Boolean });
const emits = defineEmits(['click']);

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import { inject, onMounted, useTemplateRef } from 'vue';
import { RcButton } from '@components/RcButton';
import { DropdownContext, defaultContext } from './RcDropdown'
import { DropdownContext, defaultContext } from './types';
const {
handleKeydown,

View File

@ -1,9 +1,13 @@
import { Ref, ref } from 'vue';
import type { RcButtonType } from '@components/RcButton';
export type DropdownContext = {
handleKeydown: () => void;
showMenu: (show: boolean) => void;
registerTrigger: (triggerRef: RcButtonType | null) => void;
focusFirstElement: () => void;
isMenuOpen: Ref<boolean>;
close: () => void;
}
export const defaultContext: DropdownContext = {
@ -12,7 +16,7 @@ export const defaultContext: DropdownContext = {
registerTrigger: (_triggerRef: RcButtonType | null) => null,
focusFirstElement: () => null,
isMenuOpen: ref(false),
close: () => null,
close: () => null,
};
export type DropdownCollection = {
@ -20,4 +24,3 @@ export type DropdownCollection = {
};
export const defaultCollection: DropdownCollection = { dropdownItems: ref([]) };

View File

@ -1,4 +1,4 @@
import { provide, ref } from 'vue'
import { provide, ref } from 'vue';
export const useDropdownCollection = () => {
const dropdownItems = ref<Element[]>([]);
@ -26,11 +26,11 @@ export const useDropdownCollection = () => {
const provideDropdownCollection = () => {
provide('dropdownCollection', { dropdownItems });
}
};
return {
firstDropdownItem,
provideDropdownCollection,
registerDropdownCollection,
}
}
};
};

View File

@ -39,7 +39,7 @@ export const useDropdownContext = (firstDropdownItem: Ref<HTMLElement | null>) =
const provideDropdownContext = () => {
provide('dropdownContext', {
close: () => returnFocus,
close: () => returnFocus,
handleKeydown,
showMenu,
registerTrigger,
@ -49,7 +49,7 @@ export const useDropdownContext = (firstDropdownItem: Ref<HTMLElement | null>) =
},
isMenuOpen,
});
}
};
return {
didKeydown,
@ -58,5 +58,5 @@ export const useDropdownContext = (firstDropdownItem: Ref<HTMLElement | null>) =
returnFocus,
setFocus,
provideDropdownContext,
}
}
};
};

View File

@ -653,7 +653,7 @@ export default {
<div class="center-self">
<header-page-action-menu v-if="showPageActions" />
<rc-dropdown
<rc-dropdown
v-if="showUserMenu"
:aria-label="t('nav.userMenu.label')"
>