Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: migrate from getNativeElementProps for getIntrinsicElementProps",
"packageName": "@fluentui/react-breadcrumb-preview",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: migrate from getNativeElementProps for getIntrinsicElementProps",
"packageName": "@fluentui/react-card",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "chore: migrate from getNativeElementProps for getIntrinsicElementProps",
"packageName": "@fluentui/react-drawer",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: migrate from getNativeElementProps for getIntrinsicElementProps",
"packageName": "@fluentui/react-image",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: migrate from getNativeElementProps for getIntrinsicElementProps",
"packageName": "@fluentui/react-text",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export const useBreadcrumbDivider_unstable: (props: BreadcrumbDividerProps, ref:
export const useBreadcrumbDividerStyles_unstable: (state: BreadcrumbDividerState) => BreadcrumbDividerState;

// @public
export const useBreadcrumbItem_unstable: (props: BreadcrumbItemProps, ref: React_2.Ref<HTMLElement>) => BreadcrumbItemState;
export const useBreadcrumbItem_unstable: (props: BreadcrumbItemProps, ref: React_2.Ref<HTMLLIElement>) => BreadcrumbItemState;

// @public
export const useBreadcrumbItemStyles_unstable: (state: BreadcrumbItemState) => BreadcrumbItemState;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { getNativeElementProps, slot } from '@fluentui/react-utilities';
import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
import type { BreadcrumbProps, BreadcrumbState } from './Breadcrumb.types';
import { useArrowNavigationGroup } from '@fluentui/react-tabster';

Expand Down Expand Up @@ -34,7 +34,7 @@ export const useBreadcrumb_unstable = (props: BreadcrumbProps, ref: React.Ref<HT
list: 'ol',
},
root: slot.always(
getNativeElementProps('nav', {
getIntrinsicElementProps('nav', {
ref,
'aria-label': props['aria-label'] ?? 'breadcrumb',
...(focusMode === 'arrow' ? focusAttributes : {}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { getNativeElementProps, slot } from '@fluentui/react-utilities';
import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
import type { BreadcrumbDividerProps, BreadcrumbDividerState } from './BreadcrumbDivider.types';
import {
ChevronRight20Regular,
Expand Down Expand Up @@ -35,7 +35,7 @@ export const useBreadcrumbDivider_unstable = (
root: 'li',
},
root: slot.always(
getNativeElementProps('li', {
getIntrinsicElementProps('li', {
ref,
'aria-hidden': true,
children: icon,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { getNativeElementProps, slot } from '@fluentui/react-utilities';
import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
import type { BreadcrumbItemProps, BreadcrumbItemState } from './BreadcrumbItem.types';
import { useBreadcrumbContext_unstable } from '../Breadcrumb/BreadcrumbContext';

Expand All @@ -14,7 +14,7 @@ import { useBreadcrumbContext_unstable } from '../Breadcrumb/BreadcrumbContext';
*/
export const useBreadcrumbItem_unstable = (
props: BreadcrumbItemProps,
ref: React.Ref<HTMLElement>,
ref: React.Ref<HTMLLIElement>,
): BreadcrumbItemState => {
const { size, hasInteractiveItems } = useBreadcrumbContext_unstable();
const { current = false, icon } = props;
Expand All @@ -25,7 +25,7 @@ export const useBreadcrumbItem_unstable = (
return {
components: { root: 'li', icon: 'span' },
root: slot.always(
getNativeElementProps('li', {
getIntrinsicElementProps('li', {
ref,
...props,
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { getNativeElementProps, useMergedRefs, slot } from '@fluentui/react-utilities';
import { getIntrinsicElementProps, useMergedRefs, slot } from '@fluentui/react-utilities';
import { useFocusableGroup, useFocusWithin } from '@fluentui/react-tabster';

import type { CardProps, CardState } from './Card.types';
Expand Down Expand Up @@ -97,7 +97,7 @@ export const useCard_unstable = (props: CardProps, ref: React.Ref<HTMLDivElement
},

root: slot.always(
getNativeElementProps('div', {
getIntrinsicElementProps('div', {
ref: cardRef,
role: 'group',
...focusAttributes,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { getNativeElementProps, slot } from '@fluentui/react-utilities';
import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
import type { CardFooterProps, CardFooterState } from './CardFooter.types';

/**
Expand All @@ -21,8 +21,11 @@ export const useCardFooter_unstable = (props: CardFooterProps, ref: React.Ref<HT
},

root: slot.always(
getNativeElementProps('div', {
ref,
getIntrinsicElementProps('div', {
// FIXME:
// `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`
// but since it would be a breaking change to fix it, we are casting ref to it's proper type
ref: ref as React.Ref<HTMLDivElement>,
...props,
}),
{ elementType: 'div' },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { getNativeElementProps, useId, slot } from '@fluentui/react-utilities';
import { getIntrinsicElementProps, useId, slot } from '@fluentui/react-utilities';
import type { CardHeaderProps, CardHeaderState } from './CardHeader.types';
import { useCardContext_unstable } from '../Card/CardContext';
import { cardHeaderClassNames } from './useCardHeaderStyles.styles';
Expand Down Expand Up @@ -80,8 +80,11 @@ export const useCardHeader_unstable = (props: CardHeaderProps, ref: React.Ref<HT
components: { root: 'div', image: 'div', header: 'div', description: 'div', action: 'div' },

root: slot.always(
getNativeElementProps('div', {
ref,
getIntrinsicElementProps('div', {
// FIXME:
// `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`
// but since it would be a breaking change to fix it, we are casting ref to it's proper type
ref: ref as React.Ref<HTMLDivElement>,
...props,
}),
{ elementType: 'div' },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { getNativeElementProps, useMergedRefs, slot } from '@fluentui/react-utilities';
import { getIntrinsicElementProps, useMergedRefs, slot } from '@fluentui/react-utilities';
import type { CardPreviewProps, CardPreviewState } from './CardPreview.types';
import { useCardContext_unstable } from '../Card/CardContext';
import { cardPreviewClassNames } from './useCardPreviewStyles.styles';
Expand All @@ -19,7 +19,10 @@ export const useCardPreview_unstable = (props: CardPreviewProps, ref: React.Ref<
const {
selectableA11yProps: { referenceLabel, referenceId, setReferenceLabel, setReferenceId },
} = useCardContext_unstable();
const previewRef = useMergedRefs(ref, React.useRef<HTMLDivElement>(null));
// FIXME:
// `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`
// but since it would be a breaking change to fix it, we are casting ref to it's proper type
const previewRef = useMergedRefs(ref as React.Ref<HTMLDivElement>, React.useRef<HTMLDivElement>(null));

React.useEffect(() => {
if (referenceLabel && referenceId) {
Expand Down Expand Up @@ -51,7 +54,7 @@ export const useCardPreview_unstable = (props: CardPreviewProps, ref: React.Ref<
},

root: slot.always(
getNativeElementProps('div', {
getIntrinsicElementProps('div', {
ref: previewRef,
...props,
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { getNativeElementProps, slot } from '@fluentui/react-utilities';
import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';

import type { DrawerBodyProps, DrawerBodyState } from './DrawerBody.types';

Expand All @@ -19,8 +19,11 @@ export const useDrawerBody_unstable = (props: DrawerBodyProps, ref: React.Ref<HT
},

root: slot.always(
getNativeElementProps('div', {
ref,
getIntrinsicElementProps('div', {
// FIXME:
// `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`
// but since it would be a breaking change to fix it, we are casting ref to it's proper type
ref: ref as React.Ref<HTMLDivElement>,
...props,
}),
{ elementType: 'div' },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { getNativeElementProps, slot } from '@fluentui/react-utilities';
import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';

import type { DrawerFooterProps, DrawerFooterState } from './DrawerFooter.types';

Expand All @@ -19,7 +19,7 @@ export const useDrawerFooter_unstable = (props: DrawerFooterProps, ref: React.Re
},

root: slot.always(
getNativeElementProps('footer', {
getIntrinsicElementProps('footer', {
ref,
...props,
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { getNativeElementProps, slot } from '@fluentui/react-utilities';
import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';

import type { DrawerHeaderProps, DrawerHeaderState } from './DrawerHeader.types';

Expand All @@ -19,7 +19,7 @@ export const useDrawerHeader_unstable = (props: DrawerHeaderProps, ref: React.Re
},

root: slot.always(
getNativeElementProps('header', {
getIntrinsicElementProps('header', {
ref,
...props,
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { getNativeElementProps, slot } from '@fluentui/react-utilities';
import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';

import type { DrawerHeaderNavigationProps, DrawerHeaderNavigationState } from './DrawerHeaderNavigation.types';

Expand All @@ -22,7 +22,7 @@ export const useDrawerHeaderNavigation_unstable = (
},

root: slot.always(
getNativeElementProps('nav', {
getIntrinsicElementProps('nav', {
ref,
...props,
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { getNativeElementProps, slot } from '@fluentui/react-utilities';
import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
import { useDialogContext_unstable } from '@fluentui/react-dialog';

import type { DrawerHeaderTitleProps, DrawerHeaderTitleState } from './DrawerHeaderTitle.types';
Expand Down Expand Up @@ -45,7 +45,7 @@ export const useDrawerHeaderTitle_unstable = (
},

root: slot.always(
getNativeElementProps('div', {
getIntrinsicElementProps('div', {
ref,
...props,
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { getNativeElementProps, slot, useMergedRefs } from '@fluentui/react-utilities';
import { getIntrinsicElementProps, slot, useMergedRefs } from '@fluentui/react-utilities';
import { useMotion } from '@fluentui/react-motion-preview';

import type { DrawerInlineProps, DrawerInlineState } from './DrawerInline.types';
Expand Down Expand Up @@ -29,7 +29,7 @@ export const useDrawerInline_unstable = (
},

root: slot.always(
getNativeElementProps('div', {
getIntrinsicElementProps('div', {
...props,
ref: useMergedRefs(ref, motion.ref),
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { getNativeElementProps, slot } from '@fluentui/react-utilities';
import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
import type { ImageProps, ImageState } from './Image.types';

/**
Expand All @@ -18,7 +18,7 @@ export const useImage_unstable = (props: ImageProps, ref: React.Ref<HTMLImageEle
root: 'img',
},
root: slot.always(
getNativeElementProps<ImageProps>('img', {
getIntrinsicElementProps('img', {
ref,
...props,
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { getNativeElementProps, slot } from '@fluentui/react-utilities';
import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
import type { TextProps, TextState } from './Text.types';

/**
Expand All @@ -13,7 +13,6 @@ import type { TextProps, TextState } from './Text.types';
*/
export const useText_unstable = (props: TextProps, ref: React.Ref<HTMLElement>): TextState => {
const { wrap, truncate, block, italic, underline, strikethrough, size, font, weight, align } = props;
const as = props.as ?? 'span';

const state: TextState = {
align: align ?? 'start',
Expand All @@ -30,10 +29,12 @@ export const useText_unstable = (props: TextProps, ref: React.Ref<HTMLElement>):
components: { root: 'span' },

root: slot.always(
getNativeElementProps(as, {
ref,
getIntrinsicElementProps('span', {
// FIXME:
// `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLHeadingElement & HTMLPreElement`
// but since it would be a breaking change to fix it, we are casting ref to it's proper type
ref: ref as React.Ref<HTMLHeadingElement & HTMLPreElement>,
...props,
as,
}),
{ elementType: 'span' },
),
Expand Down