Skip to content

Commit 8abe203

Browse files
bsunderhusmainframev
authored andcommitted
chore: modifications to support motion
1 parent 808aaed commit 8abe203

File tree

10 files changed

+23
-19
lines changed

10 files changed

+23
-19
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "\u0002chore: slot API react v17/18 support",
4+
"packageName": "@fluentui/react-dialog",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "chore: slot API react v17/18 support",
4+
"packageName": "@fluentui/react-motion",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

packages/react-components/react-dialog/library/src/components/Dialog/useDialog.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useHasParentContext } from '@fluentui/react-context-selector';
22
import { useModalAttributes } from '@fluentui/react-tabster';
3-
import { presenceMotionSlot, type PresenceMotionSlotProps } from '@fluentui/react-motion';
3+
import { presenceMotionSlot } from '@fluentui/react-motion';
44
import { useControllableState, useEventCallback, useId } from '@fluentui/react-utilities';
55
import * as React from 'react';
66

@@ -48,11 +48,7 @@ export const useDialog_unstable = (props: DialogProps): DialogState => {
4848

4949
return {
5050
components: {
51-
// TODO: remove once React v18 slot API is modified
52-
// This is a problem at the moment due to UnknownSlotProps assumption
53-
// that `children` property is `ReactNode`, which in this case is not valid
54-
// as PresenceComponentProps['children'] is `ReactElement`
55-
surfaceMotion: DialogSurfaceMotion as React.FC<PresenceMotionSlotProps>,
51+
surfaceMotion: DialogSurfaceMotion,
5652
},
5753
inertTrapFocus,
5854
open,

packages/react-components/react-dialog/library/src/components/DialogSurface/useDialogSurface.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Escape } from '@fluentui/keyboard-keys';
2-
import { presenceMotionSlot, type PresenceMotionSlotProps } from '@fluentui/react-motion';
2+
import { presenceMotionSlot } from '@fluentui/react-motion';
33
import {
44
useEventCallback,
55
useMergedRefs,
@@ -97,11 +97,7 @@ export const useDialogSurface_unstable = (
9797
components: {
9898
backdrop: 'div',
9999
root: 'div',
100-
// TODO: remove once React v18 slot API is modified
101-
// This is a problem at the moment due to UnknownSlotProps assumption
102-
// that `children` property is `ReactNode`, which in this case is not valid
103-
// as PresenceComponentProps['children'] is `ReactElement`
104-
backdropMotion: DialogBackdropMotion as React.FC<PresenceMotionSlotProps>,
100+
backdropMotion: DialogBackdropMotion,
105101
},
106102
open,
107103
backdrop,

packages/react-components/react-motion/library/src/slots/presenceMotionSlot.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ export type PresenceMotionSlotProps<MotionParams extends Record<string, MotionPa
3030
*/
3131
as?: keyof JSX.IntrinsicElements;
3232

33-
// TODO: remove once React v18 slot API is modified ComponentProps is not properly adding render function as a
34-
// possible value for children
3533
children?: SlotRenderFunction<PresenceMotionSlotRenderProps & MotionParams & { children: React.ReactElement }>;
3634
};
3735

packages/react-components/react-table/library/etc/react-table.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ export interface TableFeaturesState<TItem> extends Pick<UseTableFeaturesOptions<
405405
getRows: <TRowState extends TableRowData<TItem> = TableRowData<TItem>>(rowEnhancer?: RowEnhancer<TItem, TRowState>) => TRowState[];
406406
selection: TableSelectionState;
407407
sort: TableSortState<TItem>;
408-
tableRef: React_2.Ref<HTMLDivElement>;
408+
tableRef: React_2.Ref<HTMLDivElement & HTMLTableElement>;
409409
}
410410

411411
// @public

packages/react-components/react-table/library/src/hooks/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export interface TableFeaturesState<TItem> extends Pick<UseTableFeaturesOptions<
142142
* A React.Ref object to be set as a ref for the table.
143143
* Used with column resizing.
144144
*/
145-
tableRef: React.Ref<HTMLDivElement>;
145+
tableRef: React.Ref<HTMLDivElement & HTMLTableElement>;
146146
}
147147

148148
export interface UseTableSortOptions {

packages/react-components/react-table/library/src/hooks/useTableFeatures.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const defaultTableState: TableFeaturesState<unknown> = {
2222
columns: [],
2323
// eslint-disable-next-line @typescript-eslint/naming-convention
2424
columnSizing_unstable: defaultColumnSizingState,
25-
tableRef: React.createRef<HTMLDivElement>(),
25+
tableRef: React.createRef<HTMLDivElement & HTMLTableElement>(),
2626
};
2727

2828
export function useTableFeatures<TItem>(

packages/react-components/react-utilities/etc/react-utilities.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ export type SlotClassNames<Slots> = {
277277
};
278278

279279
// @public
280-
export type SlotComponentType<Props extends SlotPropsDataType> = WithoutSlotRenderFunction<Props> & FunctionComponent<{
280+
export type SlotComponentType<Props> = WithoutSlotRenderFunction<Props> & FunctionComponent<{
281281
children?: ReactNode;
282282
}> & {
283283
[SLOT_RENDER_FUNCTION_SYMBOL]?: SlotRenderFunction<Props>;

packages/react-components/react-utilities/src/compose/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ export type SlotClassNames<Slots> = {
263263
* A definition of a slot, as a component, very similar to how a React component is declared,
264264
* but with some additional metadata that is used to determine how to render the slot.
265265
*/
266-
export type SlotComponentType<Props extends SlotPropsDataType> = WithoutSlotRenderFunction<Props> &
266+
export type SlotComponentType<Props> = WithoutSlotRenderFunction<Props> &
267267
FunctionComponent<{ children?: ReactNode }> & {
268268
/**
269269
* @internal

0 commit comments

Comments
 (0)