Skip to content

Commit 5caf3ea

Browse files
committed
review comments
1 parent 777f4b7 commit 5caf3ea

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

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/src/Tabs.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,15 @@ import {createContext, forwardRef, Fragment, ReactNode, useCallback, useContext,
3232
import {focusRing, style} from '../style' with {type: 'macro'};
3333
import {getAllowedOverrides, StyleProps, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};
3434
import {IconContext} from './Icon';
35+
// @ts-ignore
36+
import intlMessages from '../intl/*.json';
3537
import {Picker, PickerItem} from './TabsPicker';
3638
import {Text, TextContext} from './Content';
3739
import {useControlledState} from '@react-stately/utils';
3840
import {useDOMRef} from '@react-spectrum/utils';
3941
import {useEffectEvent, useLayoutEffect, useResizeObserver} from '@react-aria/utils';
4042
import {useLocale} from '@react-aria/i18n';
43+
import {useLocalizedStringFormatter} from '@react-aria/i18n';
4144
import {useSpectrumContextProps} from './useSpectrumContextProps';
4245

4346
export interface TabsProps extends Omit<AriaTabsProps, 'className' | 'style' | 'children'>, UnsafeStyles {
@@ -454,6 +457,7 @@ let HiddenTabs = function (props: {
454457
};
455458

456459
let TabsMenu = (props: {items: Array<Node<any>>, onSelectionChange: TabsProps['onSelectionChange']}) => {
460+
let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');
457461
let {items} = props;
458462
let {density, onSelectionChange, selectedKey, isDisabled, disabledKeys} = useContext(InternalTabsContext);
459463
let state = useContext(TabListStateContext);
@@ -480,7 +484,7 @@ let TabsMenu = (props: {items: Array<Node<any>>, onSelectionChange: TabsProps['o
480484
disabledKeys={disabledKeys}
481485
selectedKey={selectedKey}
482486
onSelectionChange={onSelectionChange}
483-
aria-label={'Tab selector'}>
487+
aria-label={stringFormatter.format('tabs.selectorLabel')}>
484488
{(item: Node<any>) => {
485489
// need to determine the best way to handle icon only -> icon and text
486490
// good enough to aria-label the picker item?

packages/@react-spectrum/s2/src/TabsPicker.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import {fieldInput, StyleProps} from './style-utils' with {type: 'macro'};
4646
import {
4747
FieldLabel
4848
} from './Field';
49-
import {FocusableRef, FocusableRefValue, HelpTextProps, SpectrumLabelableProps} from '@react-types/shared';
49+
import {FocusableRef, FocusableRefValue, SpectrumLabelableProps} from '@react-types/shared';
5050
import {forwardRefType} from './types';
5151
import {HeaderContext, HeadingContext, Text, TextContext} from './Content';
5252
import {IconContext} from './Icon';
@@ -77,7 +77,6 @@ export interface PickerProps<T extends object> extends
7777
PickerStyleProps,
7878
StyleProps,
7979
SpectrumLabelableProps,
80-
HelpTextProps,
8180
Pick<ListBoxProps<T>, 'items'>,
8281
Pick<AriaPopoverProps, 'shouldFlip'> {
8382
/** The contents of the collection. */
@@ -96,6 +95,7 @@ export interface PickerProps<T extends object> extends
9695
align?: 'start' | 'end',
9796
/** Width of the menu. By default, matches width of the trigger. Note that the minimum width of the dropdown is always equal to the trigger's width. */
9897
menuWidth?: number,
98+
/** Density of the tabs, affects the height of the picker. */
9999
density: 'compact' | 'regular'
100100
}
101101

0 commit comments

Comments
 (0)