Skip to content

Commit cd4da2b

Browse files
authored
feat: Tabs collapse behaviour (#7202)
* feat: Tabs collapse behaviour * Get picker menu working * fix all the lint * Support orientation changes, fix sizing * fix lint * reduce renders, tix ts * support iconOnly with collapsing * fix frickin lint * fix TS * remove unused context * pass along disabled keys * Some style cleanup * fix lint * truly fix lint * fix lint * review comments * more review comments * Fix restore focus
1 parent 99d073a commit cd4da2b

File tree

11 files changed

+832
-219
lines changed

11 files changed

+832
-219
lines changed

packages/@react-spectrum/s2/chromatic/Tabs.stories.tsx

+7-6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import Heart from '../s2wf-icons/S2_Icon_Heart_20_N.svg';
1616
import type {Meta} from '@storybook/react';
1717
import {style} from '../style/spectrum-theme' with { type: 'macro' };
1818
import {Tab, TabList, TabPanel, Tabs} from '../src/Tabs';
19+
import {Text} from '@react-spectrum/s2';
1920

2021
const meta: Meta<typeof Tabs> = {
2122
component: Tabs,
@@ -30,7 +31,7 @@ export default meta;
3031
export const Example = (args: any) => (
3132
<Tabs {...args} styles={style({width: 450, height: 256})}>
3233
<TabList aria-label="History of Ancient Rome">
33-
<Tab id="FoR"><Edit />Founding of Rome</Tab>
34+
<Tab id="FoR"><Edit /><Text>Founding of Rome</Text></Tab>
3435
<Tab id="MaR">Monarchy and Republic</Tab>
3536
<Tab id="Emp">Empire</Tab>
3637
</TabList>
@@ -56,7 +57,7 @@ export const Example = (args: any) => (
5657
export const Disabled = (args: any) => (
5758
<Tabs {...args} styles={style({width: 450, height: 144})} disabledKeys={['FoR', 'MaR', 'Emp']}>
5859
<TabList aria-label="History of Ancient Rome">
59-
<Tab id="FoR"><Edit />Founding of Rome</Tab>
60+
<Tab id="FoR"><Edit /><Text>Founding of Rome</Text></Tab>
6061
<Tab id="MaR">Monarchy and Republic</Tab>
6162
<Tab id="Emp">Empire</Tab>
6263
</TabList>
@@ -73,11 +74,11 @@ export const Disabled = (args: any) => (
7374
);
7475

7576
export const Icons = (args: any) => (
76-
<Tabs {...args} styles={style({width: 208, height: 144})}>
77+
<Tabs {...args} styles={style({width: 208, height: 144})} iconOnly>
7778
<TabList aria-label="History of Ancient Rome">
78-
<Tab id="FoR" aria-label="Edit"><Edit /></Tab>
79-
<Tab id="MaR" aria-label="Notifications"><Bell /></Tab>
80-
<Tab id="Emp" aria-label="Likes"><Heart /></Tab>
79+
<Tab id="FoR" aria-label="Edit"><Edit /><Text>Edit</Text></Tab>
80+
<Tab id="MaR" aria-label="Notifications"><Bell /><Text>Notifications</Text></Tab>
81+
<Tab id="Emp" aria-label="Likes"><Heart /><Text>Likes</Text></Tab>
8182
</TabList>
8283
<TabPanel id="FoR">
8384
Arma virumque cano, Troiae qui primus ab oris.

packages/@react-spectrum/s2/intl/en-US.json

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"table.sortAscending": "Sort Ascending",
2121
"table.sortDescending": "Sort Descending",
2222
"table.resizeColumn": "Resize column",
23+
"tabs.selectorLabel": "Tab selector",
2324
"tag.showAllButtonLabel": "Show all ({tagCount, number})",
2425
"tag.hideButtonLabel": "Show less",
2526
"tag.actions": "Actions",

packages/@react-spectrum/s2/intl/he-IL.json

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"table.resizeColumn": "שנה את גודל העמודה",
2222
"table.sortAscending": "מיין בסדר עולה",
2323
"table.sortDescending": "מיין בסדר יורד",
24+
"tabs.selectorLabel": "Tab selector",
2425
"tag.actions": "פעולות",
2526
"tag.hideButtonLabel": "הצג פחות",
2627
"tag.noTags": "ללא",

packages/@react-spectrum/s2/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
"@react-aria/utils": "^3.26.0",
132132
"@react-spectrum/utils": "^3.12.0",
133133
"@react-stately/layout": "^4.1.0",
134+
"@react-stately/utils": "^3.10.5",
134135
"@react-stately/virtualizer": "^4.2.0",
135136
"@react-types/color": "^3.0.1",
136137
"@react-types/dialog": "^3.5.14",

0 commit comments

Comments
 (0)