-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
tabs.tsx
725 lines (610 loc) · 20.6 KB
/
tabs.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
'use client'
import { useFocusRing } from '@react-aria/focus'
import { useHover } from '@react-aria/interactions'
import React, {
createContext,
useContext,
useMemo,
useReducer,
useRef,
useState,
type ElementType,
type MutableRefObject,
type KeyboardEvent as ReactKeyboardEvent,
type MouseEvent as ReactMouseEvent,
type Ref,
} from 'react'
import { useActivePress } from '../../hooks/use-active-press'
import { useEvent } from '../../hooks/use-event'
import { useId } from '../../hooks/use-id'
import { useIsoMorphicEffect } from '../../hooks/use-iso-morphic-effect'
import { useLatestValue } from '../../hooks/use-latest-value'
import { useResolveButtonType } from '../../hooks/use-resolve-button-type'
import { useSyncRefs } from '../../hooks/use-sync-refs'
import { FocusSentinel } from '../../internal/focus-sentinel'
import { Hidden } from '../../internal/hidden'
import type { Props } from '../../types'
import { Focus, FocusResult, focusIn, sortByDomNode } from '../../utils/focus-management'
import { match } from '../../utils/match'
import { microTask } from '../../utils/micro-task'
import { getOwnerDocument } from '../../utils/owner'
import {
RenderFeatures,
forwardRefWithAs,
mergeProps,
useRender,
type HasDisplayName,
type PropsForFeatures,
type RefProp,
} from '../../utils/render'
import { StableCollection, useStableCollectionIndex } from '../../utils/stable-collection'
import { Keys } from '../keyboard'
enum Direction {
Forwards,
Backwards,
}
enum Ordering {
Less = -1,
Equal = 0,
Greater = 1,
}
interface StateDefinition {
info: MutableRefObject<{ isControlled: boolean }>
selectedIndex: number
tabs: MutableRefObject<HTMLElement | null>[]
panels: MutableRefObject<HTMLElement | null>[]
}
enum ActionTypes {
SetSelectedIndex,
RegisterTab,
UnregisterTab,
RegisterPanel,
UnregisterPanel,
}
type Actions =
| { type: ActionTypes.SetSelectedIndex; index: number }
| { type: ActionTypes.RegisterTab; tab: MutableRefObject<HTMLElement | null> }
| { type: ActionTypes.UnregisterTab; tab: MutableRefObject<HTMLElement | null> }
| { type: ActionTypes.RegisterPanel; panel: MutableRefObject<HTMLElement | null> }
| { type: ActionTypes.UnregisterPanel; panel: MutableRefObject<HTMLElement | null> }
let reducers: {
[P in ActionTypes]: (
state: StateDefinition,
action: Extract<Actions, { type: P }>
) => StateDefinition
} = {
[ActionTypes.SetSelectedIndex](state, action) {
let tabs = sortByDomNode(state.tabs, (tab) => tab.current)
let panels = sortByDomNode(state.panels, (panel) => panel.current)
let focusableTabs = tabs.filter((tab) => !tab.current?.hasAttribute('disabled'))
let nextState = { ...state, tabs, panels }
if (
// Underflow
action.index < 0 ||
// Overflow
action.index > tabs.length - 1
) {
let direction = match(Math.sign(action.index - state.selectedIndex), {
[Ordering.Less]: () => Direction.Backwards,
[Ordering.Equal]: () => {
return match(Math.sign(action.index), {
[Ordering.Less]: () => Direction.Forwards,
[Ordering.Equal]: () => Direction.Forwards,
[Ordering.Greater]: () => Direction.Backwards,
})
},
[Ordering.Greater]: () => Direction.Forwards,
})
// If there are no focusable tabs then.
// We won't change the selected index
// because it's likely the user is
// lazy loading tabs and there's
// nothing to focus on yet
if (focusableTabs.length === 0) {
return nextState
}
let nextSelectedIndex = match(direction, {
[Direction.Forwards]: () => tabs.indexOf(focusableTabs[0]),
[Direction.Backwards]: () => tabs.indexOf(focusableTabs[focusableTabs.length - 1]),
})
return {
...nextState,
selectedIndex: nextSelectedIndex === -1 ? state.selectedIndex : nextSelectedIndex,
}
}
// Middle
let before = tabs.slice(0, action.index)
let after = tabs.slice(action.index)
let next = [...after, ...before].find((tab) => focusableTabs.includes(tab))
if (!next) return nextState
let selectedIndex = tabs.indexOf(next) ?? state.selectedIndex
if (selectedIndex === -1) selectedIndex = state.selectedIndex
return { ...nextState, selectedIndex }
},
[ActionTypes.RegisterTab](state, action) {
if (state.tabs.includes(action.tab)) return state
let activeTab = state.tabs[state.selectedIndex]
let adjustedTabs = sortByDomNode([...state.tabs, action.tab], (tab) => tab.current)
let selectedIndex = state.selectedIndex
// When the component is uncontrolled, then we want to maintain the actively
// selected tab even if new tabs are inserted or removed before the active
// tab.
//
// When the component is controlled, then we don't want to do this and
// instead we want to select the tab based on the `selectedIndex` prop.
if (!state.info.current.isControlled) {
selectedIndex = adjustedTabs.indexOf(activeTab)
if (selectedIndex === -1) selectedIndex = state.selectedIndex
}
return { ...state, tabs: adjustedTabs, selectedIndex }
},
[ActionTypes.UnregisterTab](state, action) {
return { ...state, tabs: state.tabs.filter((tab) => tab !== action.tab) }
},
[ActionTypes.RegisterPanel](state, action) {
if (state.panels.includes(action.panel)) return state
return {
...state,
panels: sortByDomNode([...state.panels, action.panel], (panel) => panel.current),
}
},
[ActionTypes.UnregisterPanel](state, action) {
return { ...state, panels: state.panels.filter((panel) => panel !== action.panel) }
},
}
let TabsDataContext = createContext<
| ({
orientation: 'horizontal' | 'vertical'
activation: 'auto' | 'manual'
} & StateDefinition)
| null
>(null)
TabsDataContext.displayName = 'TabsDataContext'
function useData(component: string) {
let context = useContext(TabsDataContext)
if (context === null) {
let err = new Error(`<${component} /> is missing a parent <Tab.Group /> component.`)
if (Error.captureStackTrace) Error.captureStackTrace(err, useData)
throw err
}
return context
}
type _Data = ReturnType<typeof useData>
let TabsActionsContext = createContext<{
registerTab(tab: MutableRefObject<HTMLElement | null>): () => void
registerPanel(panel: MutableRefObject<HTMLElement | null>): () => void
change(index: number): void
} | null>(null)
TabsActionsContext.displayName = 'TabsActionsContext'
function useActions(component: string) {
let context = useContext(TabsActionsContext)
if (context === null) {
let err = new Error(`<${component} /> is missing a parent <Tab.Group /> component.`)
if (Error.captureStackTrace) Error.captureStackTrace(err, useActions)
throw err
}
return context
}
type _Actions = ReturnType<typeof useActions>
function stateReducer(state: StateDefinition, action: Actions) {
return match(action.type, reducers, state, action)
}
// ---
let DEFAULT_TABS_TAG = 'div' as const
type TabsRenderPropArg = {
selectedIndex: number
}
type TabsPropsWeControl = never
export type TabGroupProps<TTag extends ElementType = typeof DEFAULT_TABS_TAG> = Props<
TTag,
TabsRenderPropArg,
TabsPropsWeControl,
{
defaultIndex?: number
onChange?: (index: number) => void
selectedIndex?: number
vertical?: boolean
manual?: boolean
}
>
function GroupFn<TTag extends ElementType = typeof DEFAULT_TABS_TAG>(
props: TabGroupProps<TTag>,
ref: Ref<HTMLElement>
) {
let {
defaultIndex = 0,
vertical = false,
manual = false,
onChange,
selectedIndex = null,
...theirProps
} = props
const orientation = vertical ? 'vertical' : 'horizontal'
const activation = manual ? 'manual' : 'auto'
let isControlled = selectedIndex !== null
let info = useLatestValue({ isControlled })
let tabsRef = useSyncRefs(ref)
let [state, dispatch] = useReducer(stateReducer, {
info,
selectedIndex: selectedIndex ?? defaultIndex,
tabs: [],
panels: [],
})
let slot = useMemo(
() => ({ selectedIndex: state.selectedIndex }) satisfies TabsRenderPropArg,
[state.selectedIndex]
)
let onChangeRef = useLatestValue(onChange || (() => {}))
let stableTabsRef = useLatestValue(state.tabs)
let tabsData = useMemo<_Data>(
() => ({ orientation, activation, ...state }),
[orientation, activation, state]
)
let registerTab = useEvent((tab) => {
dispatch({ type: ActionTypes.RegisterTab, tab })
return () => dispatch({ type: ActionTypes.UnregisterTab, tab })
})
let registerPanel = useEvent((panel) => {
dispatch({ type: ActionTypes.RegisterPanel, panel })
return () => dispatch({ type: ActionTypes.UnregisterPanel, panel })
})
let change = useEvent((index: number) => {
if (realSelectedIndex.current !== index) {
onChangeRef.current(index)
}
if (!isControlled) {
dispatch({ type: ActionTypes.SetSelectedIndex, index })
}
})
let realSelectedIndex = useLatestValue(isControlled ? props.selectedIndex : state.selectedIndex)
let tabsActions = useMemo<_Actions>(() => ({ registerTab, registerPanel, change }), [])
useIsoMorphicEffect(() => {
dispatch({ type: ActionTypes.SetSelectedIndex, index: selectedIndex ?? defaultIndex })
}, [selectedIndex /* Deliberately skipping defaultIndex */])
useIsoMorphicEffect(() => {
if (realSelectedIndex.current === undefined) return
if (state.tabs.length <= 0) return
// TODO: Figure out a way to detect this without the slow sort on every render. Might be fine
// unless you have a lot of tabs.
let sorted = sortByDomNode(state.tabs, (tab) => tab.current)
let didOrderChange = sorted.some((tab, i) => state.tabs[i] !== tab)
if (didOrderChange) {
change(sorted.indexOf(state.tabs[realSelectedIndex.current]))
}
})
let ourProps = { ref: tabsRef }
let render = useRender()
return (
<StableCollection>
<TabsActionsContext.Provider value={tabsActions}>
<TabsDataContext.Provider value={tabsData}>
{tabsData.tabs.length <= 0 && (
<FocusSentinel
onFocus={() => {
for (let tab of stableTabsRef.current) {
if (tab.current?.tabIndex === 0) {
tab.current?.focus()
return true
}
}
return false
}}
/>
)}
{render({
ourProps,
theirProps,
slot,
defaultTag: DEFAULT_TABS_TAG,
name: 'Tabs',
})}
</TabsDataContext.Provider>
</TabsActionsContext.Provider>
</StableCollection>
)
}
// ---
let DEFAULT_LIST_TAG = 'div' as const
type ListRenderPropArg = {
selectedIndex: number
}
type ListPropsWeControl = 'aria-orientation' | 'role'
export type TabListProps<TTag extends ElementType = typeof DEFAULT_LIST_TAG> = Props<
TTag,
ListRenderPropArg,
ListPropsWeControl,
{
//
}
>
function ListFn<TTag extends ElementType = typeof DEFAULT_LIST_TAG>(
props: TabListProps<TTag>,
ref: Ref<HTMLElement>
) {
let { orientation, selectedIndex } = useData('Tab.List')
let listRef = useSyncRefs(ref)
let slot = useMemo(() => ({ selectedIndex }) satisfies ListRenderPropArg, [selectedIndex])
let theirProps = props
let ourProps = {
ref: listRef,
role: 'tablist',
'aria-orientation': orientation,
}
let render = useRender()
return render({
ourProps,
theirProps,
slot,
defaultTag: DEFAULT_LIST_TAG,
name: 'Tabs.List',
})
}
// ---
let DEFAULT_TAB_TAG = 'button' as const
type TabRenderPropArg = {
hover: boolean
focus: boolean
active: boolean
autofocus: boolean
selected: boolean
disabled: boolean
}
type TabPropsWeControl = 'aria-controls' | 'aria-selected' | 'role' | 'tabIndex'
export type TabProps<TTag extends ElementType = typeof DEFAULT_TAB_TAG> = Props<
TTag,
TabRenderPropArg,
TabPropsWeControl,
{
autoFocus?: boolean
disabled?: boolean
}
>
function TabFn<TTag extends ElementType = typeof DEFAULT_TAB_TAG>(
props: TabProps<TTag>,
ref: Ref<HTMLElement>
) {
let internalId = useId()
let {
id = `headlessui-tabs-tab-${internalId}`,
disabled = false,
autoFocus = false,
...theirProps
} = props
let { orientation, activation, selectedIndex, tabs, panels } = useData('Tab')
let actions = useActions('Tab')
let data = useData('Tab')
let [tabElement, setTabElement] = useState<HTMLElement | null>(null)
let internalTabRef = useRef<HTMLElement | null>(null)
let tabRef = useSyncRefs(internalTabRef, ref, setTabElement)
useIsoMorphicEffect(() => actions.registerTab(internalTabRef), [actions, internalTabRef])
let mySSRIndex = useStableCollectionIndex('tabs')
let myIndex = tabs.indexOf(internalTabRef)
if (myIndex === -1) myIndex = mySSRIndex
let selected = myIndex === selectedIndex
let activateUsing = useEvent((cb: () => FocusResult) => {
let result = cb()
if (result === FocusResult.Success && activation === 'auto') {
let newTab = getOwnerDocument(internalTabRef)?.activeElement
let idx = data.tabs.findIndex((tab) => tab.current === newTab)
if (idx !== -1) actions.change(idx)
}
return result
})
let handleKeyDown = useEvent((event: ReactKeyboardEvent<HTMLElement>) => {
let list = tabs.map((tab) => tab.current).filter(Boolean) as HTMLElement[]
if (event.key === Keys.Space || event.key === Keys.Enter) {
event.preventDefault()
event.stopPropagation()
actions.change(myIndex)
return
}
switch (event.key) {
case Keys.Home:
case Keys.PageUp:
event.preventDefault()
event.stopPropagation()
return activateUsing(() => focusIn(list, Focus.First))
case Keys.End:
case Keys.PageDown:
event.preventDefault()
event.stopPropagation()
return activateUsing(() => focusIn(list, Focus.Last))
}
let result = activateUsing(() => {
return match(orientation, {
vertical() {
if (event.key === Keys.ArrowUp) return focusIn(list, Focus.Previous | Focus.WrapAround)
if (event.key === Keys.ArrowDown) return focusIn(list, Focus.Next | Focus.WrapAround)
return FocusResult.Error
},
horizontal() {
if (event.key === Keys.ArrowLeft) return focusIn(list, Focus.Previous | Focus.WrapAround)
if (event.key === Keys.ArrowRight) return focusIn(list, Focus.Next | Focus.WrapAround)
return FocusResult.Error
},
})
})
if (result === FocusResult.Success) {
return event.preventDefault()
}
})
let ready = useRef(false)
let handleSelection = useEvent(() => {
if (ready.current) return
ready.current = true
internalTabRef.current?.focus({ preventScroll: true })
actions.change(myIndex)
microTask(() => {
ready.current = false
})
})
// This is important because we want to only focus the tab when it gets focus
// OR it finished the click event (mouseup). However, if you perform a `click`,
// then you will first get the `focus` and then get the `click` event.
let handleMouseDown = useEvent((event: ReactMouseEvent<HTMLElement>) => {
event.preventDefault()
})
let { isFocusVisible: focus, focusProps } = useFocusRing({ autoFocus })
let { isHovered: hover, hoverProps } = useHover({ isDisabled: disabled })
let { pressed: active, pressProps } = useActivePress({ disabled })
let slot = useMemo(() => {
return {
selected,
hover,
active,
focus,
autofocus: autoFocus,
disabled,
} satisfies TabRenderPropArg
}, [selected, hover, focus, active, autoFocus, disabled])
let ourProps = mergeProps(
{
ref: tabRef,
onKeyDown: handleKeyDown,
onMouseDown: handleMouseDown,
onClick: handleSelection,
id,
role: 'tab',
type: useResolveButtonType(props, tabElement),
'aria-controls': panels[myIndex]?.current?.id,
'aria-selected': selected,
tabIndex: selected ? 0 : -1,
disabled: disabled || undefined,
autoFocus,
},
focusProps,
hoverProps,
pressProps
)
let render = useRender()
return render({
ourProps,
theirProps,
slot,
defaultTag: DEFAULT_TAB_TAG,
name: 'Tabs.Tab',
})
}
// ---
let DEFAULT_PANELS_TAG = 'div' as const
type PanelsRenderPropArg = {
selectedIndex: number
}
export type TabPanelsProps<TTag extends ElementType = typeof DEFAULT_PANELS_TAG> = Props<
TTag,
PanelsRenderPropArg
>
function PanelsFn<TTag extends ElementType = typeof DEFAULT_PANELS_TAG>(
props: TabPanelsProps<TTag>,
ref: Ref<HTMLElement>
) {
let { selectedIndex } = useData('Tab.Panels')
let panelsRef = useSyncRefs(ref)
let slot = useMemo(() => ({ selectedIndex }) satisfies PanelsRenderPropArg, [selectedIndex])
let theirProps = props
let ourProps = { ref: panelsRef }
let render = useRender()
return render({
ourProps,
theirProps,
slot,
defaultTag: DEFAULT_PANELS_TAG,
name: 'Tabs.Panels',
})
}
// ---
let DEFAULT_PANEL_TAG = 'div' as const
type PanelRenderPropArg = {
selected: boolean
focus: boolean
}
type PanelPropsWeControl = 'role' | 'aria-labelledby'
let PanelRenderFeatures = RenderFeatures.RenderStrategy | RenderFeatures.Static
export type TabPanelProps<TTag extends ElementType = typeof DEFAULT_PANEL_TAG> = Props<
TTag,
PanelRenderPropArg,
PanelPropsWeControl,
PropsForFeatures<typeof PanelRenderFeatures> & { id?: string; tabIndex?: number }
>
function PanelFn<TTag extends ElementType = typeof DEFAULT_PANEL_TAG>(
props: TabPanelProps<TTag>,
ref: Ref<HTMLElement>
) {
let internalId = useId()
let { id = `headlessui-tabs-panel-${internalId}`, tabIndex = 0, ...theirProps } = props
let { selectedIndex, tabs, panels } = useData('Tab.Panel')
let actions = useActions('Tab.Panel')
let internalPanelRef = useRef<HTMLElement | null>(null)
let panelRef = useSyncRefs(internalPanelRef, ref)
useIsoMorphicEffect(() => actions.registerPanel(internalPanelRef), [actions, internalPanelRef])
let mySSRIndex = useStableCollectionIndex('panels')
let myIndex = panels.indexOf(internalPanelRef)
if (myIndex === -1) myIndex = mySSRIndex
let selected = myIndex === selectedIndex
let { isFocusVisible: focus, focusProps } = useFocusRing()
let slot = useMemo(() => ({ selected, focus }) satisfies PanelRenderPropArg, [selected, focus])
let ourProps = mergeProps(
{
ref: panelRef,
id,
role: 'tabpanel',
'aria-labelledby': tabs[myIndex]?.current?.id,
tabIndex: selected ? tabIndex : -1,
},
focusProps
)
let render = useRender()
if (!selected && (theirProps.unmount ?? true) && !(theirProps.static ?? false)) {
return <Hidden aria-hidden="true" {...ourProps} />
}
return render({
ourProps,
theirProps,
slot,
defaultTag: DEFAULT_PANEL_TAG,
features: PanelRenderFeatures,
visible: selected,
name: 'Tabs.Panel',
})
}
// ---
export interface _internal_ComponentTab extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_TAB_TAG>(
props: TabProps<TTag> & RefProp<typeof TabFn>
): React.JSX.Element
}
export interface _internal_ComponentTabGroup extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_TABS_TAG>(
props: TabGroupProps<TTag> & RefProp<typeof GroupFn>
): React.JSX.Element
}
export interface _internal_ComponentTabList extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_LIST_TAG>(
props: TabListProps<TTag> & RefProp<typeof ListFn>
): React.JSX.Element
}
export interface _internal_ComponentTabPanels extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_PANELS_TAG>(
props: TabPanelsProps<TTag> & RefProp<typeof PanelsFn>
): React.JSX.Element
}
export interface _internal_ComponentTabPanel extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_PANEL_TAG>(
props: TabPanelProps<TTag> & RefProp<typeof PanelFn>
): React.JSX.Element
}
let TabRoot = forwardRefWithAs(TabFn) as _internal_ComponentTab
export let TabGroup = forwardRefWithAs(GroupFn) as _internal_ComponentTabGroup
export let TabList = forwardRefWithAs(ListFn) as _internal_ComponentTabList
export let TabPanels = forwardRefWithAs(PanelsFn) as _internal_ComponentTabPanels
export let TabPanel = forwardRefWithAs(PanelFn) as _internal_ComponentTabPanel
export let Tab = Object.assign(TabRoot, {
/** @deprecated use `<TabGroup>` instead of `<Tab.Group>` */
Group: TabGroup,
/** @deprecated use `<TabList>` instead of `<Tab.List>` */
List: TabList,
/** @deprecated use `<TabPanels>` instead of `<Tab.Panels>` */
Panels: TabPanels,
/** @deprecated use `<TabPanel>` instead of `<Tab.Panel>` */
Panel: TabPanel,
})