-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:adobe/react-spectrum into usepress-…
…refactor # Conflicts: # packages/@react-aria/focus/src/FocusScope.tsx # packages/@react-aria/test-utils/src/table.ts
- Loading branch information
Showing
426 changed files
with
10,010 additions
and
5,480 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import {UNSTABLE_Autocomplete as Autocomplete, Input, Label, Menu, MenuItem, SearchField, Text, useFilter} from 'react-aria-components' | ||
import {classNames} from '@react-spectrum/utils'; | ||
import styles from './autocomplete.css'; | ||
|
||
interface AutocompleteItem { | ||
id: string, | ||
name: string | ||
} | ||
|
||
let items: AutocompleteItem[] = [{id: '1', name: 'Foo'}, {id: '2', name: 'Bar'}, {id: '3', name: 'Baz'}]; | ||
|
||
export function AutocompleteExample() { | ||
let {contains} = useFilter({sensitivity: 'base'}); | ||
|
||
return ( | ||
<Autocomplete filter={contains}> | ||
<div> | ||
<SearchField autoFocus> | ||
<Label style={{display: 'block'}}>Test</Label> | ||
<Input /> | ||
<Text style={{display: 'block'}} slot="description">Please select an option below.</Text> | ||
</SearchField> | ||
<Menu items={items} selectionMode="single"> | ||
{item => ( | ||
<MenuItem | ||
id={item.id} | ||
className={({isFocused, isSelected, isOpen}) => classNames(styles, 'item', { | ||
focused: isFocused, | ||
selected: isSelected, | ||
open: isOpen | ||
})}> | ||
{item.name} | ||
</MenuItem> | ||
)} | ||
</Menu> | ||
</div> | ||
</Autocomplete> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
.react-aria-Menu { | ||
display: block; | ||
min-width: 150px; | ||
width: fit-content; | ||
margin: 4px 0 0 0; | ||
border: 1px solid gray; | ||
background: lightgray; | ||
padding: 0; | ||
list-style: none; | ||
overflow-y: auto; | ||
height: 100px; | ||
} | ||
|
||
.item { | ||
padding: 2px 5px; | ||
outline: none; | ||
cursor: default; | ||
color: black; | ||
background: transparent; | ||
} | ||
|
||
.item[data-disabled] { | ||
opacity: 0.4; | ||
} | ||
|
||
.item.focused { | ||
background: gray; | ||
color: white; | ||
} | ||
|
||
.item.open:not(.focused) { | ||
background: lightslategray; | ||
color: white; | ||
} | ||
|
||
.item.item.hovered { | ||
background: lightsalmon; | ||
color: white; | ||
} | ||
|
||
.item.selected { | ||
background: purple; | ||
color: white; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
"jsx": "react-jsx" | ||
}, | ||
"include": [ | ||
"src" | ||
"src", | ||
"typings.d.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
declare module "*.css"; |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import {UNSTABLE_Autocomplete as Autocomplete, Input, Label, Menu, MenuItem, SearchField, Text, useFilter} from 'react-aria-components' | ||
import {classNames} from '@react-spectrum/utils'; | ||
import React from 'react'; | ||
import styles from './autocomplete.module.css'; | ||
|
||
interface AutocompleteItem { | ||
id: string, | ||
name: string | ||
} | ||
|
||
let items: AutocompleteItem[] = [{id: '1', name: 'Foo'}, {id: '2', name: 'Bar'}, {id: '3', name: 'Baz'}]; | ||
|
||
export function AutocompleteExample() { | ||
let {contains} = useFilter({sensitivity: 'base'}); | ||
|
||
return ( | ||
<Autocomplete filter={contains}> | ||
<div> | ||
<SearchField autoFocus> | ||
<Label style={{display: 'block'}}>Test</Label> | ||
<Input /> | ||
<Text style={{display: 'block'}} slot="description">Please select an option below.</Text> | ||
</SearchField> | ||
<Menu items={items} className={styles.menu} selectionMode="single"> | ||
{item => ( | ||
<MenuItem | ||
id={item.id} | ||
className={({isFocused, isSelected, isOpen}) => classNames(styles, 'item', { | ||
focused: isFocused, | ||
selected: isSelected, | ||
open: isOpen | ||
})}> | ||
{item.name} | ||
</MenuItem> | ||
)} | ||
</Menu> | ||
</div> | ||
</Autocomplete> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
.menu { | ||
display: block; | ||
min-width: 150px; | ||
width: fit-content; | ||
margin: 4px 0 0 0; | ||
border: 1px solid gray; | ||
background: lightgray; | ||
padding: 0; | ||
list-style: none; | ||
overflow-y: auto; | ||
height: 100px; | ||
} | ||
|
||
.item { | ||
padding: 2px 5px; | ||
outline: none; | ||
cursor: default; | ||
color: black; | ||
background: transparent; | ||
} | ||
|
||
.item[data-disabled] { | ||
opacity: 0.4; | ||
} | ||
|
||
.item.focused { | ||
background: gray; | ||
color: white; | ||
} | ||
|
||
.item.open:not(.focused) { | ||
background: lightslategray; | ||
color: white; | ||
} | ||
|
||
.item.item.hovered { | ||
background: lightsalmon; | ||
color: white; | ||
} | ||
|
||
.item.selected { | ||
background: purple; | ||
color: white; | ||
} |
Oops, something went wrong.