@@ -15,14 +15,15 @@ import {
15
15
TabPanel as AriaTabPanel ,
16
16
TabPanelProps as AriaTabPanelProps ,
17
17
TabProps as AriaTabProps ,
18
- TabsProps as AriaTabsProps ,
18
+ TabsProps as AriaTabsProps ,
19
19
ContextValue ,
20
20
Provider ,
21
21
Tab as RACTab ,
22
22
TabList as RACTabList ,
23
23
Tabs as RACTabs ,
24
24
TabListStateContext ,
25
- useSlottedContext } from 'react-aria-components' ;
25
+ useSlottedContext
26
+ } from 'react-aria-components' ;
26
27
import { centerBaseline } from './CenterBaseline' ;
27
28
import { Collection , DOMRef , DOMRefValue , Key , Node , Orientation } from '@react-types/shared' ;
28
29
import { createContext , forwardRef , ReactNode , useCallback , useContext , useEffect , useRef , useState } from 'react' ;
@@ -57,7 +58,7 @@ export interface TabListProps<T> extends Omit<AriaTabListProps<T>, 'children' |
57
58
children ?: ReactNode
58
59
}
59
60
60
- export interface TabPanelProps extends Omit < AriaTabPanelProps , 'children' | 'style' | 'className' > , UnsafeStyles {
61
+ export interface TabPanelProps extends Omit < AriaTabPanelProps , 'children' | 'style' | 'className' > , UnsafeStyles {
61
62
/** Spectrum-defined styles, returned by the `style()` macro. */
62
63
styles ?: StylesPropWithHeight ,
63
64
/** The content to display in the tab panels. */
@@ -121,7 +122,7 @@ const icon = style({
121
122
} ) ;
122
123
123
124
export function Tab ( props : TabProps ) {
124
- let { density} = useSlottedContext ( TabsContext ) ;
125
+ let { density} = useSlottedContext ( TabsContext ) ?? { } ;
125
126
126
127
return (
127
128
< RACTab
@@ -174,7 +175,7 @@ const tablist = style({
174
175
} ) ;
175
176
176
177
export function TabList < T extends object > ( props : TabListProps < T > ) {
177
- let { density, isDisabled, disabledKeys, orientation} = useSlottedContext ( TabsContext ) ;
178
+ let { density, isDisabled, disabledKeys, orientation} = useSlottedContext ( TabsContext ) ?? { } ;
178
179
let state = useContext ( TabListStateContext ) ;
179
180
let [ selectedTab , setSelectedTab ] = useState < HTMLElement | undefined > ( undefined ) ;
180
181
let tablistRef = useRef < HTMLDivElement > ( null ) ;
0 commit comments