Skip to content

Commit 4d4125f

Browse files
committed
fix(types): used ComponentExposed instead of InstanceType
1 parent 24026b4 commit 4d4125f

File tree

13 files changed

+27
-18
lines changed

13 files changed

+27
-18
lines changed

packages/core/src/components/Drawer/DrawerContent.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</template>
1919

2020
<script lang="ts">
21-
export type DrawerContentRef = Readonly<Ref<HTMLDivElement | InstanceType<typeof AutoWrap> | null>>;
21+
export type DrawerContentRef = Readonly<Ref<HTMLDivElement | ComponentExposed<typeof AutoWrap> | null>>;
2222
export const DrawerContentRefKey = Symbol('DrawerContentRefKey') as InjectionKey<DrawerContentRef>;
2323
2424
interface Props extends /* @vue-ignore */ ComponentProps<typeof PfDrawerMain> {
@@ -30,7 +30,7 @@ interface Props extends /* @vue-ignore */ ComponentProps<typeof PfDrawerMain> {
3030
<script lang="ts" setup>
3131
import styles from '@patternfly/react-styles/css/components/Drawer/drawer';
3232
import { type InjectionKey, provide, type Ref, useTemplateRef } from 'vue';
33-
import type { ComponentProps } from 'vue-component-type-helpers';
33+
import type { ComponentExposed, ComponentProps } from 'vue-component-type-helpers';
3434
import AutoWrap from '../../helpers/AutoWrap.vue';
3535
import PfDrawerMain from './DrawerMain.vue';
3636
import PfDrawerPanelContent from './DrawerPanelContent.vue';

packages/core/src/components/FileUpload.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ defineSlots<{
171171
172172
const filenameInput = useTemplateRef('filenameInputRef');
173173
174-
useDropZone(() => filenameInput.value?.$el, {
174+
useDropZone(() => filenameInput.value?.input, {
175175
dataTypes: props.dataTypes,
176176
multiple: false,
177177
async onDrop(files) {

packages/core/src/components/FormSelect/FormSelect.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
</template>
3131

3232
<script lang="ts">
33-
export const FormSelectOptionsKey = Symbol("FormSelectOptionsKey") as ChildrenTrackerInjectionKey<InstanceType<typeof PfFormSelectOption>>;
33+
export const FormSelectOptionsKey = Symbol("FormSelectOptionsKey") as ChildrenTrackerInjectionKey<ComponentExposed<typeof PfFormSelectOption>>;
3434
3535
interface Props<M extends boolean = false> extends OUIAProps, /* @vue-ignore */ Omit<SelectHTMLAttributes, 'value'> {
3636
multiple?: M;
@@ -55,6 +55,7 @@ import CaretDownIcon from '@vue-patternfly/icons/caret-down-icon';
5555
import { computed, type SelectHTMLAttributes, getCurrentInstance, useTemplateRef } from 'vue';
5656
import { useOUIAProps, type OUIAProps } from '../../helpers/ouia';
5757
import { FormInputsKey } from '../Form/common';
58+
import type { ComponentExposed } from 'vue-component-type-helpers';
5859
5960
defineOptions({
6061
name: 'PfFormSelect',

packages/core/src/components/JumpLinks/JumpLinks.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
</template>
4747

4848
<script lang="ts">
49-
export const JumpLinksKey = Symbol("FormSelectOptionsKey") as ChildrenTrackerInjectionKey<InstanceType<typeof PfJumpLinksItem>>;
49+
export const JumpLinksKey = Symbol("FormSelectOptionsKey") as ChildrenTrackerInjectionKey<ComponentExposed<typeof PfJumpLinksItem>>;
5050
export const JumpLinkInjectionKey = Symbol('JumpLinkInjectionKey') as InjectionKey<{
5151
offset: number;
5252
scrollPosition: Ref<number>;
@@ -82,6 +82,7 @@ import AngleRightIcon from '@vue-patternfly/icons/angle-right-icon';
8282
import PfJumpLinksItem from './JumpLinksItem.vue';
8383
import PfButton from '../Button.vue';
8484
import { useOUIAProps, type OUIAProps } from '../../helpers/ouia';
85+
import type { ComponentExposed } from 'vue-component-type-helpers';
8586
8687
defineOptions({
8788
name: 'PfJumpLinks',
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1+
import type { ComponentExposed } from 'vue-component-type-helpers';
12
import type { ChildrenTrackerInjectionKey } from '../../use';
23
import PfLabel from './Label.vue';
34

4-
export const LabelKey = Symbol("LabelKey") as ChildrenTrackerInjectionKey<InstanceType<typeof PfLabel>>;
5+
export const LabelKey = Symbol("LabelKey") as ChildrenTrackerInjectionKey<ComponentExposed<typeof PfLabel>>;

packages/core/src/components/Menu/Menu.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<script lang="ts">
3434
export type MenuProvide = {
3535
parentMenu: MenuProvide | undefined;
36-
favoriteList: Ref<InstanceType<typeof PfMenuList> | null>;
36+
favoriteList: Ref<ComponentExposed<typeof PfMenuList> | null>;
3737
selected?: Ref<MenuItemId | MenuItemId[] | null>;
3838
// drilldownItemPath: MenuItemId[];
3939
activeItemId?: MenuItemId;
@@ -113,6 +113,7 @@ import PfTextInput from '../TextInput.vue';
113113
import PfTextInputGroup from '../TextInputGroup/TextInputGroup.vue';
114114
import PfSearchInput from '../SearchInput/SearchInput.vue';
115115
import { useOUIAProps, type OUIAProps } from '../../helpers/ouia';
116+
import type { ComponentExposed } from 'vue-component-type-helpers';
116117
117118
defineOptions({
118119
name: 'PfMenu',
@@ -142,7 +143,7 @@ const emit = defineEmits<{
142143
143144
const el = useTemplateRef('elRef');
144145
145-
const favoriteList = useTemplateRef<InstanceType<typeof PfMenuList>>('favoriteListRef');
146+
const favoriteList = useTemplateRef<ComponentExposed<typeof PfMenuList>>('favoriteListRef');
146147
const items = provideChildrenTracker(MenuItemsKey);
147148
const favoriteCount = computed(() => items.reduce((c, i) => c + (i.favorited ? 1 : 0), 0));
148149

packages/core/src/components/SearchInput/AdvancedSearchMenu.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ import PfForm from '../Form/Form.vue';
5555
import PfFormGroup from '../Form/FormGroup.vue';
5656
import PfActionGroup from '../Form/ActionGroup.vue';
5757
import { useEventListener } from '@vueuse/core';
58-
import type { ComponentProps } from 'vue-component-type-helpers';
58+
import type { ComponentExposed, ComponentProps } from 'vue-component-type-helpers';
5959
6060
defineOptions({
6161
name: 'PfAdvancedSearchMenu',
@@ -104,7 +104,7 @@ defineSlots<{
104104
'form-additional-items'?: (props?: Record<never, never>) => any;
105105
}>();
106106
107-
const firstAttrRef: Ref<InstanceType<typeof PfTextInput> | null> = ref(null);
107+
const firstAttrRef: Ref<ComponentExposed<typeof PfTextInput> | null> = ref(null);
108108
const searchInput = inject(SearchInputKey);
109109
const hasWordsId = useId();
110110

packages/core/src/components/SearchInput/SearchInput.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export interface SearchAttribute {
129129
130130
export type SearchInputProvide = {
131131
$el: Readonly<Ref<HTMLDivElement | null>>;
132-
input: Ref<InstanceType<typeof PfTextInputGroupMain> | null>;
132+
input: Ref<ComponentExposed<typeof PfTextInputGroupMain> | null>;
133133
}
134134
135135
export const SearchInputKey = Symbol('SearchInputKey') as InjectionKey<SearchInputProvide>;
@@ -234,6 +234,7 @@ import AngleDownIcon from '@vue-patternfly/icons/angle-down-icon';
234234
import CaretDownIcon from '@vue-patternfly/icons/caret-down-icon';
235235
import ArrowRightIcon from '@vue-patternfly/icons/arrow-right-icon';
236236
import { FormInputsKey } from '../Form/common';
237+
import type { ComponentExposed } from 'vue-component-type-helpers';
237238
238239
defineOptions({
239240
name: 'PfSearchInput',

packages/core/src/components/Tabs/Tab.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ import PfTabContent from './TabContent.vue';
6161
import PfMenuItem from '../Menu/MenuItem.vue';
6262
import { useChildrenTracker } from '../../use';
6363
import { useOUIAProps, type OUIAProps } from '../../helpers/ouia';
64-
import type { ComponentProps } from 'vue-component-type-helpers';
64+
import type { ComponentExposed, ComponentProps } from 'vue-component-type-helpers';
6565
6666
defineOptions({
6767
name: 'PfTab',
@@ -79,7 +79,7 @@ interface Props extends OUIAProps, /* @vue-ignore */ Omit<ComponentProps<typeof
7979
disabled?: boolean;
8080
/** Adds disabled styling and communicates that the button is disabled using the aria-disabled html attribute */
8181
ariaDisabled?: boolean;
82-
contentRef?: InstanceType<typeof PfTabContent>;
82+
contentRef?: ComponentExposed<typeof PfTabContent>;
8383
/** Waits until the first "enter" transition to mount tab children (add them to the DOM) */
8484
mountOnEnter?: boolean;
8585
/** Unmounts tab children (removes them from the DOM) when they are no longer visible */

packages/core/src/components/Tabs/Tabs.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ import FloatingUi from '../../helpers/FloatingUi.vue';
146146
import PfMenu from '../Menu/Menu.vue';
147147
import PfMenuContent from '../Menu/MenuContent.vue';
148148
import PfMenuList from '../Menu/MenuList.vue';
149+
import type { ComponentExposed } from 'vue-component-type-helpers';
149150
150151
defineOptions({
151152
name: 'PfTabs',
@@ -176,7 +177,7 @@ defineSlots<{
176177
177178
const tabListRef = useTemplateRef('tabList');
178179
const tabMoreRef = useTemplateRef('tabMore');
179-
const tabOverflowRef: Ref<InstanceType<typeof PfMenuList> | undefined> = ref();
180+
const tabOverflowRef: Ref<ComponentExposed<typeof PfMenuList> | undefined> = ref();
180181
const contentTargetRef: Ref<HTMLElement | undefined> = ref();
181182
const overflowTabRef: Ref<HTMLButtonElement | undefined> = ref();
182183
const tabs = provideChildrenTracker(TabsKey);

0 commit comments

Comments
 (0)