Skip to content

Commit

Permalink
fix(types): revert React.JSX.Element back to JSX.Element (#2871)
Browse files Browse the repository at this point in the history
  • Loading branch information
atomiks committed Apr 20, 2024
1 parent 6a3b237 commit 406daa0
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/olive-bananas-run.md
@@ -0,0 +1,5 @@
---
"@floating-ui/react": patch
---

fix(types): revert `React.JSX.Element` back to `JSX.Element`
4 changes: 2 additions & 2 deletions packages/react/src/components/Composite.tsx
Expand Up @@ -42,8 +42,8 @@ const CompositeContext = React.createContext<{
});

type RenderProp =
| React.JSX.Element
| ((props: React.HTMLAttributes<HTMLElement>) => React.JSX.Element);
| JSX.Element
| ((props: React.HTMLAttributes<HTMLElement>) => JSX.Element);

interface CompositeProps {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/FloatingArrow.tsx
Expand Up @@ -52,7 +52,7 @@ export interface FloatingArrowProps extends React.ComponentPropsWithRef<'svg'> {
export const FloatingArrow = React.forwardRef(function FloatingArrow(
props: FloatingArrowProps,
ref: React.ForwardedRef<SVGSVGElement>,
): React.JSX.Element | null {
): JSX.Element | null {
const {
context: {
placement,
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/components/FloatingDelayGroup.tsx
Expand Up @@ -63,9 +63,9 @@ interface FloatingDelayGroupProps {
* `delay`.
* @see https://floating-ui.com/docs/FloatingDelayGroup
*/
export const FloatingDelayGroup = (
export function FloatingDelayGroup(
props: FloatingDelayGroupProps,
): React.JSX.Element => {
): JSX.Element {
const {children, delay, timeoutMs = 0} = props;

const [state, setState] = React.useReducer(
Expand Down Expand Up @@ -111,7 +111,7 @@ export const FloatingDelayGroup = (
{children}
</FloatingDelayGroupContext.Provider>
);
};
}

interface UseGroupOptions {
id?: any;
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/FloatingFocusManager.tsx
Expand Up @@ -76,7 +76,7 @@ const VisuallyHiddenDismiss = React.forwardRef(function VisuallyHiddenDismiss(
export interface FloatingFocusManagerProps<
RT extends ReferenceType = ReferenceType,
> {
children: React.JSX.Element;
children: JSX.Element;
/**
* The floating context returned from `useFloating`.
*/
Expand Down Expand Up @@ -145,7 +145,7 @@ export interface FloatingFocusManagerProps<
*/
export function FloatingFocusManager<RT extends ReferenceType = ReferenceType>(
props: FloatingFocusManagerProps<RT>,
): React.JSX.Element {
): JSX.Element {
const {
context,
children,
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/FloatingList.tsx
Expand Up @@ -67,7 +67,7 @@ interface FloatingListProps {
* Provides context for a list of items within the floating element.
* @see https://floating-ui.com/docs/FloatingList
*/
export function FloatingList(props: FloatingListProps): React.JSX.Element {
export function FloatingList(props: FloatingListProps): JSX.Element {
const {children, elementsRef, labelsRef} = props;

const [map, setMap] = React.useState(() => new Map<Node, number | null>());
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/FloatingPortal.tsx
Expand Up @@ -134,7 +134,7 @@ interface FloatingPortalProps {
* while retaining its location in the React tree.
* @see https://floating-ui.com/docs/FloatingPortal
*/
export function FloatingPortal(props: FloatingPortalProps): React.JSX.Element {
export function FloatingPortal(props: FloatingPortalProps): JSX.Element {
const {children, id, root = null, preserveTabOrder = true} = props;

const portalNode = useFloatingPortalNode({id, root});
Expand Down
6 changes: 2 additions & 4 deletions packages/react/src/components/FloatingTree.tsx
Expand Up @@ -51,7 +51,7 @@ export function useFloatingNodeId(customParentId?: string): string {
export function FloatingNode(props: {
children?: React.ReactNode;
id: string;
}): React.JSX.Element {
}): JSX.Element {
const {children, id} = props;

const parentId = useFloatingParentNodeId();
Expand All @@ -75,9 +75,7 @@ export function FloatingNode(props: {
* - Custom communication between parent and child floating elements
* @see https://floating-ui.com/docs/FloatingTree
*/
export function FloatingTree(props: {
children?: React.ReactNode;
}): React.JSX.Element {
export function FloatingTree(props: {children?: React.ReactNode}): JSX.Element {
const {children} = props;

const nodesRef = React.useRef<Array<FloatingNodeType>>([]);
Expand Down

0 comments on commit 406daa0

Please sign in to comment.