@@ -15,14 +15,15 @@ import {
1515 TabPanel as AriaTabPanel ,
1616 TabPanelProps as AriaTabPanelProps ,
1717 TabProps as AriaTabProps ,
18- TabsProps as AriaTabsProps ,
18+ TabsProps as AriaTabsProps ,
1919 ContextValue ,
2020 Provider ,
2121 Tab as RACTab ,
2222 TabList as RACTabList ,
2323 Tabs as RACTabs ,
2424 TabListStateContext ,
25- useSlottedContext } from 'react-aria-components' ;
25+ useSlottedContext
26+ } from 'react-aria-components' ;
2627import { centerBaseline } from './CenterBaseline' ;
2728import { Collection , DOMRef , DOMRefValue , Key , Node , Orientation } from '@react-types/shared' ;
2829import { createContext , forwardRef , ReactNode , useCallback , useContext , useEffect , useRef , useState } from 'react' ;
@@ -57,7 +58,7 @@ export interface TabListProps<T> extends Omit<AriaTabListProps<T>, 'children' |
5758 children ?: ReactNode
5859}
5960
60- export interface TabPanelProps extends Omit < AriaTabPanelProps , 'children' | 'style' | 'className' > , UnsafeStyles {
61+ export interface TabPanelProps extends Omit < AriaTabPanelProps , 'children' | 'style' | 'className' > , UnsafeStyles {
6162 /** Spectrum-defined styles, returned by the `style()` macro. */
6263 styles ?: StylesPropWithHeight ,
6364 /** The content to display in the tab panels. */
@@ -121,7 +122,7 @@ const icon = style({
121122} ) ;
122123
123124export function Tab ( props : TabProps ) {
124- let { density} = useSlottedContext ( TabsContext ) ;
125+ let { density} = useSlottedContext ( TabsContext ) ?? { } ;
125126
126127 return (
127128 < RACTab
@@ -174,7 +175,7 @@ const tablist = style({
174175} ) ;
175176
176177export function TabList < T extends object > ( props : TabListProps < T > ) {
177- let { density, isDisabled, disabledKeys, orientation} = useSlottedContext ( TabsContext ) ;
178+ let { density, isDisabled, disabledKeys, orientation} = useSlottedContext ( TabsContext ) ?? { } ;
178179 let state = useContext ( TabListStateContext ) ;
179180 let [ selectedTab , setSelectedTab ] = useState < HTMLElement | undefined > ( undefined ) ;
180181 let tablistRef = useRef < HTMLDivElement > ( null ) ;
0 commit comments