From f32e1d0e954ebfdaf6d4a9b17fe51cbe7198a723 Mon Sep 17 00:00:00 2001 From: YuanboXue-Amber Date: Wed, 27 Sep 2023 15:31:16 +0200 Subject: [PATCH 1/2] upd --- .../react-tags-preview/etc/react-tags-preview.api.md | 10 +++++----- .../components/InteractionTag/useInteractionTag.tsx | 4 ++-- .../InteractionTagPrimary/useInteractionTagPrimary.ts | 4 ++-- .../useInteractionTagSecondary.tsx | 4 ++-- .../react-tags-preview/src/components/Tag/useTag.tsx | 4 ++-- .../src/components/TagGroup/useTagGroup.ts | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/react-components/react-tags-preview/etc/react-tags-preview.api.md b/packages/react-components/react-tags-preview/etc/react-tags-preview.api.md index 382d027edf5471..b454d8ce58b74a 100644 --- a/packages/react-components/react-tags-preview/etc/react-tags-preview.api.md +++ b/packages/react-components/react-tags-preview/etc/react-tags-preview.api.md @@ -174,19 +174,19 @@ export type TagState = ComponentState & Required) => InteractionTagState; +export const useInteractionTag_unstable: (props: InteractionTagProps, ref: React_2.Ref) => InteractionTagState; // @public (undocumented) export function useInteractionTagContextValues_unstable(state: InteractionTagState): InteractionTagContextValues; // @public -export const useInteractionTagPrimary_unstable: (props: InteractionTagPrimaryProps, ref: React_2.Ref) => InteractionTagPrimaryState; +export const useInteractionTagPrimary_unstable: (props: InteractionTagPrimaryProps, ref: React_2.Ref) => InteractionTagPrimaryState; // @public (undocumented) export const useInteractionTagPrimaryStyles_unstable: (state: InteractionTagPrimaryState) => InteractionTagPrimaryState; // @public -export const useInteractionTagSecondary_unstable: (props: InteractionTagSecondaryProps, ref: React_2.Ref) => InteractionTagSecondaryState; +export const useInteractionTagSecondary_unstable: (props: InteractionTagSecondaryProps, ref: React_2.Ref) => InteractionTagSecondaryState; // @public (undocumented) export const useInteractionTagSecondaryStyles_unstable: (state: InteractionTagSecondaryState) => InteractionTagSecondaryState; @@ -195,13 +195,13 @@ export const useInteractionTagSecondaryStyles_unstable: (state: InteractionTagSe export const useInteractionTagStyles_unstable: (state: InteractionTagState) => InteractionTagState; // @public -export const useTag_unstable: (props: TagProps, ref: React_2.Ref) => TagState; +export const useTag_unstable: (props: TagProps, ref: React_2.Ref) => TagState; // @public (undocumented) export function useTagAvatarContextValues_unstable(state: UseTagAvatarContextValuesOptions): TagAvatarContextValues; // @public -export const useTagGroup_unstable: (props: TagGroupProps, ref: React_2.Ref) => TagGroupState; +export const useTagGroup_unstable: (props: TagGroupProps, ref: React_2.Ref) => TagGroupState; // @public (undocumented) export function useTagGroupContextValues_unstable(state: TagGroupState): TagGroupContextValues; diff --git a/packages/react-components/react-tags-preview/src/components/InteractionTag/useInteractionTag.tsx b/packages/react-components/react-tags-preview/src/components/InteractionTag/useInteractionTag.tsx index 8bd4d7e0ef75fa..28737db8e67b0e 100644 --- a/packages/react-components/react-tags-preview/src/components/InteractionTag/useInteractionTag.tsx +++ b/packages/react-components/react-tags-preview/src/components/InteractionTag/useInteractionTag.tsx @@ -10,11 +10,11 @@ import { useTagGroupContext_unstable } from '../../contexts/tagGroupContext'; * before being passed to renderInteractionTag_unstable. * * @param props - props from this instance of InteractionTag - * @param ref - reference to root HTMLElement of InteractionTag + * @param ref - reference to root HTMLDivElement of InteractionTag */ export const useInteractionTag_unstable = ( props: InteractionTagProps, - ref: React.Ref, + ref: React.Ref, ): InteractionTagState => { const { handleTagDismiss, size: contextSize } = useTagGroupContext_unstable(); diff --git a/packages/react-components/react-tags-preview/src/components/InteractionTagPrimary/useInteractionTagPrimary.ts b/packages/react-components/react-tags-preview/src/components/InteractionTagPrimary/useInteractionTagPrimary.ts index 09aebe9d013eb0..71aa1aab5f4809 100644 --- a/packages/react-components/react-tags-preview/src/components/InteractionTagPrimary/useInteractionTagPrimary.ts +++ b/packages/react-components/react-tags-preview/src/components/InteractionTagPrimary/useInteractionTagPrimary.ts @@ -21,11 +21,11 @@ const avatarShapeMap = { * before being passed to renderInteractionTagPrimary_unstable. * * @param props - props from this instance of InteractionTagPrimary - * @param ref - reference to root HTMLElement of InteractionTagPrimary + * @param ref - reference to root HTMLButtonElement of InteractionTagPrimary */ export const useInteractionTagPrimary_unstable = ( props: InteractionTagPrimaryProps, - ref: React.Ref, + ref: React.Ref, ): InteractionTagPrimaryState => { const { appearance, disabled, interactionTagPrimaryId, shape, size } = useInteractionTagContext_unstable(); const { hasSecondaryAction = false } = props; diff --git a/packages/react-components/react-tags-preview/src/components/InteractionTagSecondary/useInteractionTagSecondary.tsx b/packages/react-components/react-tags-preview/src/components/InteractionTagSecondary/useInteractionTagSecondary.tsx index e620dd9b5fc3a9..25472a0e833148 100644 --- a/packages/react-components/react-tags-preview/src/components/InteractionTagSecondary/useInteractionTagSecondary.tsx +++ b/packages/react-components/react-tags-preview/src/components/InteractionTagSecondary/useInteractionTagSecondary.tsx @@ -12,11 +12,11 @@ import { useInteractionTagContext_unstable } from '../../contexts/interactionTag * before being passed to renderInteractionTagSecondary_unstable. * * @param props - props from this instance of InteractionTagSecondary - * @param ref - reference to root HTMLElement of InteractionTagSecondary + * @param ref - reference to root HTMLButtonElement of InteractionTagSecondary */ export const useInteractionTagSecondary_unstable = ( props: InteractionTagSecondaryProps, - ref: React.Ref, + ref: React.Ref, ): InteractionTagSecondaryState => { const { appearance, disabled, handleTagDismiss, interactionTagPrimaryId, shape, size, value } = useInteractionTagContext_unstable(); diff --git a/packages/react-components/react-tags-preview/src/components/Tag/useTag.tsx b/packages/react-components/react-tags-preview/src/components/Tag/useTag.tsx index 6a94dc172eba2a..52ae8a622532b2 100644 --- a/packages/react-components/react-tags-preview/src/components/Tag/useTag.tsx +++ b/packages/react-components/react-tags-preview/src/components/Tag/useTag.tsx @@ -23,9 +23,9 @@ const tagAvatarShapeMap = { * before being passed to renderTag_unstable. * * @param props - props from this instance of Tag - * @param ref - reference to root HTMLElement of Tag + * @param ref - reference to root HTMLSpanElement or HTMLButtonElement of Tag */ -export const useTag_unstable = (props: TagProps, ref: React.Ref): TagState => { +export const useTag_unstable = (props: TagProps, ref: React.Ref): TagState => { const { handleTagDismiss, size: contextSize } = useTagGroupContext_unstable(); const id = useId('fui-Tag', props.id); diff --git a/packages/react-components/react-tags-preview/src/components/TagGroup/useTagGroup.ts b/packages/react-components/react-tags-preview/src/components/TagGroup/useTagGroup.ts index 38ad65edb0591d..6c15ba61dfea3f 100644 --- a/packages/react-components/react-tags-preview/src/components/TagGroup/useTagGroup.ts +++ b/packages/react-components/react-tags-preview/src/components/TagGroup/useTagGroup.ts @@ -12,9 +12,9 @@ import { interactionTagSecondaryClassNames } from '../InteractionTagSecondary/us * before being passed to renderTagGroup_unstable. * * @param props - props from this instance of TagGroup - * @param ref - reference to root HTMLElement of TagGroup + * @param ref - reference to root HTMLDivElement of TagGroup */ -export const useTagGroup_unstable = (props: TagGroupProps, ref: React.Ref): TagGroupState => { +export const useTagGroup_unstable = (props: TagGroupProps, ref: React.Ref): TagGroupState => { const { onDismiss, size = 'medium' } = props; const innerRef = React.useRef(); From 378df4fe43a541541cb5240e367dc05db039499c Mon Sep 17 00:00:00 2001 From: YuanboXue-Amber Date: Wed, 27 Sep 2023 15:32:38 +0200 Subject: [PATCH 2/2] chg --- ...-tags-preview-08da3434-ae29-4b7c-b48e-6fa0cf8a4637.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/@fluentui-react-tags-preview-08da3434-ae29-4b7c-b48e-6fa0cf8a4637.json diff --git a/change/@fluentui-react-tags-preview-08da3434-ae29-4b7c-b48e-6fa0cf8a4637.json b/change/@fluentui-react-tags-preview-08da3434-ae29-4b7c-b48e-6fa0cf8a4637.json new file mode 100644 index 00000000000000..6f5b33aaabdf3d --- /dev/null +++ b/change/@fluentui-react-tags-preview-08da3434-ae29-4b7c-b48e-6fa0cf8a4637.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "chore: properly type ref in state hook", + "packageName": "@fluentui/react-tags-preview", + "email": "yuanboxue@microsoft.com", + "dependentChangeType": "patch" +}