Skip to content

Commit cdbfe48

Browse files
authored
chore: fixing defaultSelectedKey type consistency and removing unneeded import (adobe#9725)
* chore: make defaultSelectedKey consistent with selectedKey * chore: dont import isLocalTimeZoneOverridden * omit onKeydown/up from combobox item since virtual focus
1 parent 7b9da59 commit cdbfe48

File tree

7 files changed

+12
-8
lines changed

7 files changed

+12
-8
lines changed

packages/@internationalized/date/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ export {
6666
getLocalTimeZone,
6767
setLocalTimeZone,
6868
resetLocalTimeZone,
69-
isLocalTimeZoneOverridden,
7069
startOfMonth,
7170
startOfWeek,
7271
startOfYear,

packages/@internationalized/date/tests/queries.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import {
2525
isEqualMonth,
2626
isEqualYear,
2727
IslamicUmalquraCalendar,
28-
isLocalTimeZoneOverridden,
2928
isSameDay,
3029
isSameMonth,
3130
isSameYear,
@@ -40,6 +39,8 @@ import {
4039
startOfYear,
4140
ZonedDateTime
4241
} from '..';
42+
import {isLocalTimeZoneOverridden} from '../src/queries';
43+
4344

4445
describe('queries', function () {
4546
describe('isSameDay', function () {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ export const ComboBox = /*#__PURE__*/ (forwardRef as forwardRefType)(function Co
369369
);
370370
});
371371

372-
export interface ComboBoxItemProps extends Omit<ListBoxItemProps, 'children' | 'style' | 'className' | 'render' | 'onClick' | keyof GlobalDOMAttributes>, StyleProps {
372+
export interface ComboBoxItemProps extends Omit<ListBoxItemProps, 'children' | 'style' | 'className' | 'render' | 'onClick' | 'onKeyDown' | 'onKeyUp' | keyof GlobalDOMAttributes>, StyleProps {
373373
children: ReactNode
374374
}
375375

packages/@react-types/combobox/src/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export interface ComboBoxProps<T, M extends SelectionMode = 'single'> extends Co
7171
* The initial selected key in the collection (uncontrolled).
7272
* @deprecated
7373
*/
74-
defaultSelectedKey?: Key,
74+
defaultSelectedKey?: Key | null,
7575
/**
7676
* Handler that is called when the selection changes.
7777
* @deprecated

packages/@react-types/select/src/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export interface SelectProps<T, M extends SelectionMode = 'single'> extends Coll
5151
* The initial selected key in the collection (uncontrolled).
5252
* @deprecated
5353
*/
54-
defaultSelectedKey?: Key,
54+
defaultSelectedKey?: Key | null,
5555
/**
5656
* Handler that is called when the selection changes.
5757
* @deprecated

packages/@react-types/shared/src/selection.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export interface SingleSelection {
1818
/** The currently selected key in the collection (controlled). */
1919
selectedKey?: Key | null,
2020
/** The initial selected key in the collection (uncontrolled). */
21-
defaultSelectedKey?: Key,
21+
defaultSelectedKey?: Key | null,
2222
/** Handler that is called when the selection changes. */
2323
onSelectionChange?: (key: Key | null) => void
2424
}

packages/@react-types/tabs/src/index.d.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@ export interface AriaTabProps extends AriaLabelingProps {
3030
shouldSelectOnPressUp?: boolean
3131
}
3232

33-
export interface TabListProps<T> extends CollectionBase<T>, Omit<SingleSelection, 'disallowEmptySelection' | 'selectedKey' | 'onSelectionChange'> {
33+
export interface TabListProps<T> extends CollectionBase<T>, Omit<SingleSelection, 'disallowEmptySelection' | 'selectedKey' | 'defaultSelectedKeys' | 'onSelectionChange'> {
3434
/**
3535
* Whether the TabList is disabled.
3636
* Shows that a selection exists, but is not available in that circumstance.
3737
*/
3838
isDisabled?: boolean,
3939
/** The currently selected key in the collection (controlled). */
4040
selectedKey?: Key,
41+
/** The initial selected keys in the collection (uncontrolled). */
42+
defaultSelectedKey?: Key,
4143
/** Handler that is called when the selection changes. */
4244
onSelectionChange?: (key: Key) => void
4345
}
@@ -62,7 +64,7 @@ export interface AriaTabPanelProps extends Omit<DOMProps, 'id'>, AriaLabelingPro
6264
id?: Key
6365
}
6466

65-
export interface SpectrumTabsProps<T> extends AriaTabListBase, Omit<SingleSelection, 'disallowEmptySelection' | 'selectedKey' | 'onSelectionChange'>, DOMProps, StyleProps {
67+
export interface SpectrumTabsProps<T> extends AriaTabListBase, Omit<SingleSelection, 'disallowEmptySelection' | 'selectedKey' | 'defaultSelectedKey' | 'onSelectionChange'>, DOMProps, StyleProps {
6668
/** The children of the `<Tabs>` element. Should include `<TabList>` and `<TabPanels>` elements. */
6769
children: ReactNode,
6870
/** The item objects for each tab, for dynamic collections. */
@@ -79,6 +81,8 @@ export interface SpectrumTabsProps<T> extends AriaTabListBase, Omit<SingleSelect
7981
density?: 'compact' | 'regular',
8082
/** The currently selected key in the collection (controlled). */
8183
selectedKey?: Key,
84+
/** The initial selected keys in the collection (uncontrolled). */
85+
defaultSelectedKey?: Key,
8286
/** Handler that is called when the selection changes. */
8387
onSelectionChange?: (key: Key) => void
8488
}

0 commit comments

Comments
 (0)