Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Ts strict remaining #7368

Merged
merged 78 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
3fb5134
TS Strict Collections
snowystinger Jun 18, 2024
22be104
fix rebase
snowystinger Oct 14, 2024
076a444
Start ts strict remaining
snowystinger Nov 13, 2024
a93d832
GridKeyboardDelegate and review
snowystinger Nov 13, 2024
74da9e1
fix some calculateposition tests
snowystinger Nov 13, 2024
d5cddec
fix calculate tests
snowystinger Nov 13, 2024
bdd0d56
fix listkeyboarddelegate
snowystinger Nov 13, 2024
7fd3794
fix more tests
snowystinger Nov 13, 2024
d01db08
fix calculate position
snowystinger Nov 13, 2024
3082d45
changes to calculate position
snowystinger Nov 13, 2024
40280db
grid aria hooks
snowystinger Nov 14, 2024
437e149
aria menu
snowystinger Nov 14, 2024
b2d1dab
Virtualizer stuff
devongovett Nov 14, 2024
d044ab6
aria menus more
snowystinger Nov 14, 2024
1426b32
last of aria menu and overlay
snowystinger Nov 14, 2024
23c5d69
Stately table
devongovett Nov 14, 2024
4869010
More table
devongovett Nov 14, 2024
fe6085d
delete pagination, aria select
snowystinger Nov 14, 2024
94aaed3
Merge branch 'ts-strict-remaining' of github.com:adobe/react-spectrum…
snowystinger Nov 14, 2024
eb72f15
Merge remote-tracking branch 'origin/ts-strict-collections' into ts-s…
devongovett Nov 14, 2024
16b5222
Merge branch 'ts-strict-remaining' of github.com:adobe/react-spectrum…
devongovett Nov 14, 2024
4e74ee5
aria slider and textfield
snowystinger Nov 14, 2024
71d64f1
Merge branch 'ts-strict-remaining' of github.com:adobe/react-spectrum…
snowystinger Nov 14, 2024
5358fba
aria toast
snowystinger Nov 14, 2024
263f82e
fix extra toast
snowystinger Nov 14, 2024
888831c
aria table
devongovett Nov 14, 2024
63c0810
remove log
devongovett Nov 14, 2024
09b1fe9
ignore s1 cards
snowystinger Nov 14, 2024
cf38578
More table and aria virtualizer
devongovett Nov 14, 2024
a1e9813
Merge branch 'ts-strict-remaining' of github.com:adobe/react-spectrum…
devongovett Nov 14, 2024
56e546c
more
devongovett Nov 14, 2024
d7337b5
stately data
snowystinger Nov 14, 2024
237335c
Merge branch 'ts-strict-remaining' of github.com:adobe/react-spectrum…
snowystinger Nov 14, 2024
00c783f
more
devongovett Nov 14, 2024
41b7baa
Merge branch 'ts-strict-remaining' of github.com:adobe/react-spectrum…
devongovett Nov 14, 2024
fc7b4b8
fix stories
snowystinger Nov 14, 2024
edade00
fix tree data
snowystinger Nov 14, 2024
f8338fb
more fixes
devongovett Nov 14, 2024
7ce464f
RSP slider
devongovett Nov 14, 2024
6d57e1c
more stories
devongovett Nov 14, 2024
bca4ce2
spectrum and aria combobox
snowystinger Nov 14, 2024
538101f
Make useAsyncList sort function have a required sortDescriptor
devongovett Nov 14, 2024
260224c
stately fixes
snowystinger Nov 14, 2024
075abbb
Merge branch 'ts-strict-remaining' of github.com:adobe/react-spectrum…
snowystinger Nov 14, 2024
4aeb49d
fix toast test
snowystinger Nov 14, 2024
b5b5386
rsp layout and stately tree
snowystinger Nov 14, 2024
5a52728
rsp menu
snowystinger Nov 14, 2024
8a560f7
rsp overlays
snowystinger Nov 14, 2024
ea62db8
rsp picker
snowystinger Nov 14, 2024
fe0874d
more rsp
snowystinger Nov 14, 2024
e33a452
remaining rsp and dev
snowystinger Nov 14, 2024
ce380e7
fix lint
snowystinger Nov 14, 2024
a1d8374
update yarnlock
snowystinger Nov 14, 2024
438b2a9
remove ts-ignores
snowystinger Nov 14, 2024
ef751c0
a few more removed ts ignores
snowystinger Nov 14, 2024
5b4526a
fix provider usage
snowystinger Nov 14, 2024
84b1b77
DatePicker
devongovett Nov 14, 2024
9891c84
fix tsconfig
snowystinger Nov 14, 2024
6fe9e20
remove plugin no longer needed
snowystinger Nov 15, 2024
5b44ff4
fix check-examples
devongovett Nov 15, 2024
384b69b
Fix some ts-ignores
devongovett Nov 15, 2024
52d1c45
Fix docs build
devongovett Nov 15, 2024
3157bf1
turn on verdaccio build
snowystinger Nov 15, 2024
9495780
fix accidental defaultkey of null
snowystinger Nov 15, 2024
c187bca
Toast noop
devongovett Nov 15, 2024
44c475d
Merge branch 'ts-strict-remaining' of github.com:adobe/react-spectrum…
devongovett Nov 15, 2024
9617eff
Make focusStrategy match
devongovett Nov 15, 2024
35d3950
fix types for tailwind
snowystinger Nov 15, 2024
e255e85
Merge branch 'ts-strict-remaining' of github.com:adobe/react-spectrum…
snowystinger Nov 15, 2024
523f653
Try fixing cra app
snowystinger Nov 15, 2024
edf8774
fix example apps
snowystinger Nov 15, 2024
dc60cbd
Revert "turn on verdaccio build"
snowystinger Nov 15, 2024
50e51b7
fix tooltip for chromatic
snowystinger Nov 15, 2024
b2d482e
fix for all cases
snowystinger Nov 15, 2024
c04133a
Merge branch 'main' of github.com:adobe/react-spectrum into ts-strict…
LFDanLu Nov 18, 2024
6aea7fd
Merge branch 'main' into ts-strict-remaining
snowystinger Nov 18, 2024
9f7b4f5
delete pagination files again
snowystinger Nov 18, 2024
f7422ee
fix lock file
snowystinger Nov 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
*/

import {Item} from '@react-stately/collections';
import {ListLayout} from '@react-stately/layout';
import React from 'react';
import {renderHook} from '@react-spectrum/test-utils-internal';
import {useComboBoxState} from '@react-stately/combobox';
Expand All @@ -30,11 +29,6 @@ describe('useSearchAutocomplete', function () {
});

let defaultProps = {items: [{id: 1, name: 'one'}], children: (props) => <Item>{props.name}</Item>};
let {result} = renderHook(() => useComboBoxState(defaultProps));
let mockLayout = new ListLayout({
rowHeight: 40
});
mockLayout.collection = result.current.collection;

afterEach(() => {
jest.clearAllMocks();
Expand All @@ -45,8 +39,7 @@ describe('useSearchAutocomplete', function () {
label: 'test label',
popoverRef: React.createRef(),
inputRef: React.createRef(),
listBoxRef: React.createRef(),
layout: mockLayout
listBoxRef: React.createRef()
};

let {result} = renderHook(() => useSearchAutocomplete(props, useComboBoxState(defaultProps)));
Expand All @@ -73,8 +66,7 @@ describe('useSearchAutocomplete', function () {
inputRef: {
current: document.createElement('input')
},
listBoxRef: React.createRef(),
layout: mockLayout
listBoxRef: React.createRef()
};

let {result: state} = renderHook((props) => useComboBoxState(props), {initialProps: props});
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/combobox/src/useComboBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export function useComboBox<T>(props: AriaComboBoxOptions<T>, state: ComboBoxSta
let lastSection = useRef(sectionKey);
let lastItem = useRef(itemKey);
useEffect(() => {
if (isAppleDevice() && focusedItem != null && itemKey !== lastItem.current) {
if (isAppleDevice() && focusedItem != null && itemKey != null && itemKey !== lastItem.current) {
let isSelected = state.selectionManager.isSelected(itemKey);
let section = sectionKey != null ? state.collection.getItem(sectionKey) : null;
let sectionTitle = section?.['aria-label'] || (typeof section?.rendered === 'string' ? section.rendered : '') || '';
Expand Down
9 changes: 1 addition & 8 deletions packages/@react-aria/combobox/test/useComboBox.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import {actHook as act, renderHook} from '@react-spectrum/test-utils-internal';
import {Item} from '@react-stately/collections';
import {ListLayout} from '@react-stately/layout';
import React from 'react';
import {useComboBox} from '../';
import {useComboBoxState} from '@react-stately/combobox';
Expand All @@ -32,11 +31,6 @@ describe('useComboBox', function () {
});

let defaultProps = {items: [{id: 1, name: 'one'}], children: (props) => <Item>{props.name}</Item>};
let {result} = renderHook(() => useComboBoxState(defaultProps));
let mockLayout = new ListLayout({
rowHeight: 40
});
mockLayout.collection = result.current.collection;

let props = {
label: 'test label',
Expand All @@ -51,8 +45,7 @@ describe('useComboBox', function () {
},
listBoxRef: {
current: document.createElement('div')
},
layout: mockLayout
}
};

afterEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/dnd/src/DragPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {flushSync} from 'react-dom';
import React, {ForwardedRef, JSX, useEffect, useImperativeHandle, useRef, useState} from 'react';

export interface DragPreviewProps {
children: (items: DragItem[]) => JSX.Element
children: (items: DragItem[]) => JSX.Element | null
}

function DragPreview(props: DragPreviewProps, ref: ForwardedRef<DragPreviewRenderer | null>) {
Expand Down
7 changes: 4 additions & 3 deletions packages/@react-aria/dnd/src/useDroppableCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export interface DroppableCollectionResult {

interface DroppingState {
collection: Collection<Node<unknown>>,
focusedKey: Key,
focusedKey: Key | null,
selectedKeys: Set<Key>,
target: DropTarget,
draggingKeys: Set<Key | null | undefined>,
Expand Down Expand Up @@ -273,6 +273,7 @@ export function useDroppableCollection(props: DroppableCollectionOptions, state:
}
}
} else if (
prevFocusedKey != null &&
state.selectionManager.focusedKey === prevFocusedKey &&
isInternal &&
target.type === 'item' &&
Expand All @@ -293,7 +294,7 @@ export function useDroppableCollection(props: DroppableCollectionOptions, state:
// Also show the focus ring if the focused key is not selected, e.g. in case of a reorder.
state.selectionManager.setFocusedKey(target.key);
setInteractionModality('keyboard');
} else if (!state.selectionManager.isSelected(state.selectionManager.focusedKey)) {
} else if (state.selectionManager.focusedKey != null && !state.selectionManager.isSelected(state.selectionManager.focusedKey)) {
setInteractionModality('keyboard');
}

Expand Down Expand Up @@ -533,7 +534,7 @@ export function useDroppableCollection(props: DroppableCollectionOptions, state:

// If the focused key is a cell, get the parent item instead.
// For now, we assume that individual cells cannot be dropped on.
let item = localState.state.collection.getItem(key);
let item = key != null ? localState.state.collection.getItem(key) : null;
if (item?.type === 'cell') {
key = item.parentKey;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/dnd/stories/DraggableCollection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function DraggableCollectionExample(props) {

function DraggableCollection(props) {
let ref = React.useRef<HTMLDivElement>(null);
let state = useListState(props);
let state = useListState<ItemValue>(props);
let gridState = useGridState({
selectionMode: 'multiple',
collection: React.useMemo(() => new GridCollection<ItemValue>({
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/dnd/stories/dnd.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ function DraggableCollectionExample(props) {
function DraggableCollection(props) {
let {isDisabled} = props;
let ref = React.useRef<HTMLDivElement>(null);
let state = useListState(props);
let state = useListState<ItemValue>(props);
let gridState = useGridState({
...props,
selectionMode: 'multiple',
Expand Down
Loading
Loading