Skip to content

Commit

Permalink
temporary TS fixed to get a build
Browse files Browse the repository at this point in the history
  • Loading branch information
ktabors committed Nov 25, 2024
1 parent b1a10d5 commit bf9bc3d
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions packages/react-aria-components/src/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,39 @@ import {Orientation} from 'react-aria';
import React, {createContext, ForwardedRef, forwardRef, ReactElement, ReactNode} from 'react';

// TODO: Replace NavigationRenderProps with AriaNavigationProps, once it exists
export interface NavigationProps extends NavigationRenderProps, /* RenderProps<NavigationRenderProps>, */ DOMProps, SlotProps {
export interface NavigationProps extends NavigationRenderProps, RenderProps<NavigationRenderProps>, DOMProps, SlotProps {
/** Whether the navigation is disabled. */
isDisabled?: boolean,
/** Handler that is called when a navigation item is clicked. */
onAction?: (key: Key) => void
}

export interface NavigationRenderProps {
/**
* Whether the navigation is disabled.
* @selector [data-disabled]
*/
isDisabled?: boolean,
/**
* The orientation of the navigation.
* @selector [data-orientation="horizontal | vertical"]
*/
orientation: Orientation
}

export const NavigationContext = createContext<ContextValue<NavigationProps, HTMLUListElement>>(null);
// TODO: HTMLDivElement is the wrong type
export const NavigationContext = createContext<ContextValue<NavigationProps, HTMLDivElement>>(null);

function Navigation(props: NavigationProps, ref: ForwardedRef<HTMLDivElement>) {
[props, ref] = useContextProps(props, ref, NavigationContext);

let renderProps = useRenderProps({
...props,
defaultClassName: 'react-aria-Navigation',
values: {isDisabled: props.isDisabled}
values: {
isDisabled: props.isDisabled,
orientation: props.orientation || 'horizontal'
}
});

let domProps = filterDOMProps(props);
Expand All @@ -56,11 +65,11 @@ function Navigation(props: NavigationProps, ref: ForwardedRef<HTMLDivElement>) {
ref={ref}
data-disabled={props.isDisabled || undefined}>
<NavigationContext.Provider value={props}>
<ul
<ol
className="react-aria-NavigationList"
data-orientation={props.orientation || 'horizontal'}>
{renderProps.children}
</ul>
</ol>
</NavigationContext.Provider>
</nav>
);
Expand Down

0 comments on commit bf9bc3d

Please sign in to comment.