This repository was archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
feat(Dropdown): Single selection #584
Merged
Merged
Changes from all commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
431268c
crude implementation
2ee1b5e
fixed the toggle and added/refactored styles
b959dd9
fixed the filtering to work for all variants
c0482c5
made the toggleButton tabbable by default
5fe6ed7
fixed style case active+focus
8a8882d
fixed wrong import
92ad9c0
fixed ariaLabel for trigger button
55e9807
added list focus and accessibility handling for it
0f294b2
fixed toggle button bug that appeared after trigger fix
27396f1
reverted change for filteredItems
35d7e53
refactored the renderComponent to pass conformance
fc64c6d
fixed button focus at selection
8b24b0c
merged ref code review improvement
a2b3424
removed unneeded code
bc88b89
removed ternary condition
eabbbe1
replaced some heights to make toggle button appear centered
50700a4
improvements on styles from code review
0d7a892
replaced Icon with unicode char for theme consistency
1bdf704
some more review comments handled
518dad5
some more code improvements in Dropdown
3cdc8d8
replaced right margin with padding for combobox
bb670f9
used functional components in the examples
c851c13
overriding downshift aria label for the toggle button
58c41a8
made the toggle button arrow non-selectable
96a61ab
used a lodash util instead of filter
97758c2
used buttonNode for consistency
c28f7c5
apply tabIndex only if dropdown is non-search
1563a65
Revert "used buttonNode for consistency"
5e4dc81
refactored the Refs use in Dropdown
14532ef
crude implementation
7e870fe
fixed the toggle and added/refactored styles
ee95d06
fixed the filtering to work for all variants
bcd061a
made the toggleButton tabbable by default
7d69d08
fixed style case active+focus
75ee900
fixed wrong import
8684525
fixed ariaLabel for trigger button
8a60271
added list focus and accessibility handling for it
5aa379e
fixed toggle button bug that appeared after trigger fix
eeaf144
reverted change for filteredItems
c286133
refactored the renderComponent to pass conformance
1ec2028
fixed button focus at selection
c19c12f
merged ref code review improvement
862c4bd
removed unneeded code
945bb95
removed ternary condition
0675513
replaced some heights to make toggle button appear centered
c571d92
improvements on styles from code review
277175e
replaced Icon with unicode char for theme consistency
83fc34d
some more review comments handled
cf48f4b
some more code improvements in Dropdown
b9d5412
replaced right margin with padding for combobox
d2ae9e1
used functional components in the examples
5882ab8
overriding downshift aria label for the toggle button
0350af6
made the toggle button arrow non-selectable
d13c089
used a lodash util instead of filter
40744a7
used buttonNode for consistency
390999a
apply tabIndex only if dropdown is non-search
6c54706
Revert "used buttonNode for consistency"
0c97678
refactored the Refs use in Dropdown
4996260
updated changelog
afeefa0
Merge branch 'feat/selection-dropdown' of https://github.com/stardust…
2b7f913
-added white background on the list in the Dropdown for fixing transp…
8244c86
Merge branch 'master' into feat/selection-dropdown
5d49229
-fixed changelog
f17b5b1
removed '.shorthand' from examplePath
36a34f7
Merge branch 'master' into feat/selection-dropdown
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
48 changes: 48 additions & 0 deletions
48
docs/src/examples/components/Dropdown/Types/DropdownExampleSingleSelection.shorthand.tsx
This file contains hidden or 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,48 @@ | ||
import * as React from 'react' | ||
import { Dropdown } from '@stardust-ui/react' | ||
|
||
const inputItems = [ | ||
'Bruce Wayne', | ||
'Natasha Romanoff', | ||
'Steven Strange', | ||
'Alfred Pennyworth', | ||
`Scarlett O'Hara`, | ||
'Imperator Furiosa', | ||
'Bruce Banner', | ||
'Peter Parker', | ||
'Selina Kyle', | ||
] | ||
|
||
const DropdownExample = () => ( | ||
<Dropdown | ||
getA11yStatusMessage={getA11yStatusMessage} | ||
getA11ySelectionMessage={{ | ||
onAdd: item => `${item} has been selected.`, | ||
}} | ||
placeholder="Select your hero" | ||
items={inputItems} | ||
/> | ||
) | ||
|
||
const getA11yStatusMessage = ({ | ||
isOpen, | ||
itemToString, | ||
previousResultCount, | ||
resultCount, | ||
selectedItem, | ||
}) => { | ||
if (!isOpen) { | ||
return selectedItem ? itemToString(selectedItem) : '' | ||
} | ||
if (!resultCount) { | ||
return 'No results are available.' | ||
} | ||
if (resultCount !== previousResultCount) { | ||
return `${resultCount} result${ | ||
resultCount === 1 ? ' is' : 's are' | ||
} available, use up and down arrow keys to navigate. Press Enter key to select.` | ||
} | ||
return '' | ||
} | ||
|
||
export default DropdownExample |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.