-
Notifications
You must be signed in to change notification settings - Fork 564
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
SelectPanel: Update SelectPanel to use modern ActionList #4794
Merged
Merged
Changes from all commits
Commits
Show all changes
68 commits
Select commit
Hold shift + click to select a range
9cee0a4
super wip
broccolinisoup c7aa5de
just use the actionlist component and revert the type updates
broccolinisoup 40a0c45
Update packages/react/src/FilteredActionList/FilteredActionList.tsx
broccolinisoup 344f6ce
Some more progress
broccolinisoup fa5f5a6
revert the type changes and cast it :/
broccolinisoup 3cd9ecc
clean
broccolinisoup 0003e59
wip
broccolinisoup 713b5ad
wip wip
broccolinisoup 6fc7f2b
add stories
broccolinisoup a246981
fix linting
broccolinisoup e209f47
add tests for groups
broccolinisoup 26cddc1
Merge branch 'main' into select-panel-action-list
broccolinisoup b1199fb
Merge branch 'select-panel-story-and-tests' into select-panel-action-…
broccolinisoup b669cff
Map groups
broccolinisoup 1012662
Merge branch 'main' into select-panel-story-and-tests
broccolinisoup 67dc5c9
Update story names for e2e tests
broccolinisoup c66feb5
oops remove unintended file
broccolinisoup 4fbb3c5
update story name
broccolinisoup 2d5e2b2
same - update story name
broccolinisoup cee7737
disable animations
broccolinisoup 9c972c3
test(vrt): update snapshots
broccolinisoup 17e4ca8
Merge branch 'select-panel-story-and-tests' into select-panel-action-…
broccolinisoup 26b6fe6
Update tests since new action list has different semantics for group …
broccolinisoup 42c50c0
Merge branch 'main' into select-panel-action-list
broccolinisoup 0d0004f
logging
broccolinisoup 3ba9bc7
pass the rest
broccolinisoup 92ab9c2
extract children and use before text
broccolinisoup 7b3d5e6
remove logging
broccolinisoup 1cf1e09
Merge branch 'main' into select-panel-action-list
siddharthkp 92303d0
test(vrt): update snapshots
siddharthkp 4dc3b41
add active styles to ActionList
siddharthkp f673034
rename component name to be clearer
siddharthkp 3a7d490
remove variant full from examples
siddharthkp ab3ea9c
tiny clean up
siddharthkp 44ff862
fix showItemDividers
siddharthkp 46c94e6
another tiny cleanup
siddharthkp ff8379b
pull MappedActionListItem to make it stable
siddharthkp 9353d71
Merge branch 'main' into select-panel-action-list
siddharthkp 0a126ad
test(vrt): update snapshots
siddharthkp 91cd5a3
show active styles only when used with keyboard
siddharthkp 40322c5
backward compat: expose id as data-id
siddharthkp f0150e4
Merge branch 'select-panel-action-list' of github.com:primer/react in…
siddharthkp f72b9d4
update snapshots
siddharthkp 85d0237
add story for long strings
siddharthkp 2eca9fa
fishing for errors
siddharthkp c875223
backward compatibility for renderItem
siddharthkp 02a6dc9
remove todo now
siddharthkp 25c574a
add a feature flag
siddharthkp 5dc6adb
clean up dual filter list setup
siddharthkp 85e0bb4
run jests test with both states of feature flags
siddharthkp 0ee74e1
refactor snapshot tests with scenarios
siddharthkp 798008e
remove feature flag for main
siddharthkp beca8db
Merge branch 'main' into select-panel-action-list
siddharthkp 14fd206
Merge branch 'selectpanel-prepare-scenarios' into select-panel-action…
siddharthkp 185eb17
test(vrt): update snapshots
siddharthkp 318aa99
add feature flag to e2e matrix
siddharthkp e9c523c
test(vrt): update snapshots
siddharthkp efd1216
backward compat: allow groupMetadata to be empty array
siddharthkp cd9a931
Merge branch 'select-panel-action-list' of github.com:primer/react in…
siddharthkp 619ff96
Merge branch 'main' into select-panel-action-list
siddharthkp e3fe7b8
sigh newline
siddharthkp ebac341
Create sour-cooks-dress.md
siddharthkp 0513474
Merge branch 'main' into select-panel-action-list
siddharthkp 2afa236
copy SelectPanel snapshots from main
siddharthkp 0f38bf4
remove unrelated changes in this PR
siddharthkp f72aa55
test(vrt): update snapshots
siddharthkp 6e9d706
set active styles for both active-descendant types
siddharthkp 0b57206
test(vrt): update snapshots
siddharthkp 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 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,5 @@ | ||
--- | ||
"@primer/react": patch | ||
--- | ||
|
||
SelectPanel: Update SelectPanel to use modern ActionList behind a feature flag `primer_react_select_panel_with_modern_action_list` |
Binary file added
BIN
+38.3 KB
.../SelectPanel-Above-Tall-Body-dark-colorblind-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+39.2 KB
...hots/SelectPanel-Above-Tall-Body-dark-dimmed-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+37.8 KB
...lectPanel-Above-Tall-Body-dark-high-contrast-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+38.3 KB
...s-snapshots/SelectPanel-Above-Tall-Body-dark-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+38.3 KB
.../SelectPanel-Above-Tall-Body-dark-tritanopia-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+37.5 KB
...SelectPanel-Above-Tall-Body-light-colorblind-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+37.5 KB
...ectPanel-Above-Tall-Body-light-high-contrast-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+37.5 KB
...-snapshots/SelectPanel-Above-Tall-Body-light-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+37.5 KB
...SelectPanel-Above-Tall-Body-light-tritanopia-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+35.6 KB
...napshots/SelectPanel-Default-dark-colorblind-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+36.7 KB
...ts-snapshots/SelectPanel-Default-dark-dimmed-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+34.6 KB
...shots/SelectPanel-Default-dark-high-contrast-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+35.6 KB
...l.test.ts-snapshots/SelectPanel-Default-dark-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+35.6 KB
...napshots/SelectPanel-Default-dark-tritanopia-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+35.6 KB
...apshots/SelectPanel-Default-light-colorblind-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+35.7 KB
...hots/SelectPanel-Default-light-high-contrast-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+35.6 KB
....test.ts-snapshots/SelectPanel-Default-light-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+35.6 KB
...apshots/SelectPanel-Default-light-tritanopia-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+29.7 KB
.../SelectPanel-External-Anchor-dark-colorblind-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+31.2 KB
...hots/SelectPanel-External-Anchor-dark-dimmed-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+28.8 KB
...lectPanel-External-Anchor-dark-high-contrast-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+29.7 KB
...s-snapshots/SelectPanel-External-Anchor-dark-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+29.7 KB
.../SelectPanel-External-Anchor-dark-tritanopia-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+30 KB
...SelectPanel-External-Anchor-light-colorblind-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+29.4 KB
...ectPanel-External-Anchor-light-high-contrast-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+30 KB
...-snapshots/SelectPanel-External-Anchor-light-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30 KB
...SelectPanel-External-Anchor-light-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+29.5 KB
...itial-with-Overflowing-Items-dark-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.9 KB
...t-Initial-with-Overflowing-Items-dark-dimmed-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+28.8 KB
...al-with-Overflowing-Items-dark-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+29.5 KB
...l-Height-Initial-with-Overflowing-Items-dark-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+29.5 KB
...itial-with-Overflowing-Items-dark-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+29.8 KB
...tial-with-Overflowing-Items-light-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+29.7 KB
...l-with-Overflowing-Items-light-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+29.8 KB
...-Height-Initial-with-Overflowing-Items-light-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+29.8 KB
...tial-with-Overflowing-Items-light-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+25 KB
...derflowing-Items-After-Fetch-dark-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+26.3 KB
...h-Underflowing-Items-After-Fetch-dark-dimmed-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+24.2 KB
...flowing-Items-After-Fetch-dark-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+25 KB
...ial-with-Underflowing-Items-After-Fetch-dark-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+25 KB
...derflowing-Items-After-Fetch-dark-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+25.2 KB
...erflowing-Items-After-Fetch-light-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+25.1 KB
...lowing-Items-After-Fetch-light-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+25.2 KB
...al-with-Underflowing-Items-After-Fetch-light-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+25.2 KB
...erflowing-Items-After-Fetch-light-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+27.1 KB
...tial-with-Underflowing-Items-dark-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+28.4 KB
...-Initial-with-Underflowing-Items-dark-dimmed-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+26.4 KB
...l-with-Underflowing-Items-dark-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+27.1 KB
...-Height-Initial-with-Underflowing-Items-dark-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+27.1 KB
...tial-with-Underflowing-Items-dark-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+27.4 KB
...ial-with-Underflowing-Items-light-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+27.3 KB
...-with-Underflowing-Items-light-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+27.4 KB
...Height-Initial-with-Underflowing-Items-light-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+27.4 KB
...ial-with-Underflowing-Items-light-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+33 KB
...eight-Variantions-and-Scroll-dark-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+34.5 KB
...el-Height-Variantions-and-Scroll-dark-dimmed-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+32.3 KB
...ht-Variantions-and-Scroll-dark-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+33 KB
...lectPanel-Height-Variantions-and-Scroll-dark-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+33 KB
...eight-Variantions-and-Scroll-dark-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+33 KB
...ight-Variantions-and-Scroll-light-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+33.1 KB
...t-Variantions-and-Scroll-light-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+33 KB
...ectPanel-Height-Variantions-and-Scroll-light-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+33 KB
...ight-Variantions-and-Scroll-light-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+29.5 KB
...ts/SelectPanel-Single-Select-dark-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.9 KB
...pshots/SelectPanel-Single-Select-dark-dimmed-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+28.8 KB
...SelectPanel-Single-Select-dark-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+29.5 KB
....ts-snapshots/SelectPanel-Single-Select-dark-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+29.5 KB
...ts/SelectPanel-Single-Select-dark-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+29.8 KB
...s/SelectPanel-Single-Select-light-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+29.7 KB
...electPanel-Single-Select-light-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+29.8 KB
...ts-snapshots/SelectPanel-Single-Select-light-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+29.8 KB
...s/SelectPanel-Single-Select-light-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+32.3 KB
...hots/SelectPanel-With-Footer-dark-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+33.5 KB
...napshots/SelectPanel-With-Footer-dark-dimmed-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+31.6 KB
...s/SelectPanel-With-Footer-dark-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+32.3 KB
...st.ts-snapshots/SelectPanel-With-Footer-dark-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+32.3 KB
...hots/SelectPanel-With-Footer-dark-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+32.5 KB
...ots/SelectPanel-With-Footer-light-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+32.4 KB
.../SelectPanel-With-Footer-light-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+32.5 KB
...t.ts-snapshots/SelectPanel-With-Footer-light-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+32.5 KB
...ots/SelectPanel-With-Footer-light-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+44.9 KB
...hots/SelectPanel-With-Groups-dark-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+45.7 KB
...napshots/SelectPanel-With-Groups-dark-dimmed-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+44.4 KB
...s/SelectPanel-With-Groups-dark-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+44.9 KB
...st.ts-snapshots/SelectPanel-With-Groups-dark-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+44.9 KB
...hots/SelectPanel-With-Groups-dark-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+45.6 KB
...ots/SelectPanel-With-Groups-light-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+45.8 KB
.../SelectPanel-With-Groups-light-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+45.6 KB
...t.ts-snapshots/SelectPanel-With-Groups-light-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+45.6 KB
...ots/SelectPanel-With-Groups-light-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.8 KB
...lectPanel-With-Item-Dividers-dark-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+31.6 KB
...s/SelectPanel-With-Item-Dividers-dark-dimmed-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30 KB
...tPanel-With-Item-Dividers-dark-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.8 KB
...napshots/SelectPanel-With-Item-Dividers-dark-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.8 KB
...lectPanel-With-Item-Dividers-dark-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.8 KB
...ectPanel-With-Item-Dividers-light-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.9 KB
...Panel-With-Item-Dividers-light-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.8 KB
...apshots/SelectPanel-With-Item-Dividers-light-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.8 KB
...ectPanel-With-Item-Dividers-light-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.5 KB
...anel-With-Placeholder-Select-dark-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+31.5 KB
...ectPanel-With-Placeholder-Select-dark-dimmed-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+29.8 KB
...l-With-Placeholder-Select-dark-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.5 KB
...ots/SelectPanel-With-Placeholder-Select-dark-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.5 KB
...anel-With-Placeholder-Select-dark-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.6 KB
...nel-With-Placeholder-Select-light-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.7 KB
...-With-Placeholder-Select-light-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.6 KB
...ts/SelectPanel-With-Placeholder-Select-light-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.6 KB
...nel-With-Placeholder-Select-light-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.7 KB
...Placeholder-for-Search-Input-dark-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+31.5 KB
...ith-Placeholder-for-Search-Input-dark-dimmed-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+29.9 KB
...ceholder-for-Search-Input-dark-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.7 KB
...Panel-With-Placeholder-for-Search-Input-dark-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.7 KB
...Placeholder-for-Search-Input-dark-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.7 KB
...laceholder-for-Search-Input-light-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.8 KB
...eholder-for-Search-Input-light-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.7 KB
...anel-With-Placeholder-for-Search-Input-light-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.7 KB
...laceholder-for-Search-Input-light-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
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
16 changes: 16 additions & 0 deletions
16
packages/react/src/FilteredActionList/FilteredActionListEntry.tsx
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,16 @@ | ||
import React from 'react' | ||
import type {FilteredActionListProps} from './FilteredActionListWithDeprecatedActionList' | ||
import {FilteredActionList as WithDeprecatedActionList} from './FilteredActionListWithDeprecatedActionList' | ||
import {FilteredActionList as WithStableActionList} from './FilteredActionListWithModernActionList' | ||
import {useFeatureFlag} from '../FeatureFlags' | ||
|
||
export function FilteredActionList(props: FilteredActionListProps): JSX.Element { | ||
const enabled = useFeatureFlag('primer_react_select_panel_with_modern_action_list') | ||
|
||
if (enabled) return <WithStableActionList {...props} /> | ||
else return <WithDeprecatedActionList {...props} /> | ||
} | ||
|
||
FilteredActionList.displayName = 'FilteredActionList' | ||
|
||
export type {FilteredActionListProps} |
File renamed without changes.
233 changes: 233 additions & 0 deletions
233
packages/react/src/FilteredActionList/FilteredActionListWithModernActionList.tsx
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,233 @@ | ||
import type {ScrollIntoViewOptions} from '@primer/behaviors' | ||
import {scrollIntoView} from '@primer/behaviors' | ||
import type {KeyboardEventHandler} from 'react' | ||
import React, {useCallback, useEffect, useRef} from 'react' | ||
import styled from 'styled-components' | ||
import Box from '../Box' | ||
import Spinner from '../Spinner' | ||
import type {TextInputProps} from '../TextInput' | ||
import TextInput from '../TextInput' | ||
import {get} from '../constants' | ||
import {ActionList} from '../ActionList' | ||
import type {GroupedListProps, ListPropsBase, ItemInput} from '../SelectPanel/types' | ||
import {useFocusZone} from '../hooks/useFocusZone' | ||
import {useId} from '../hooks/useId' | ||
import {useProvidedRefOrCreate} from '../hooks/useProvidedRefOrCreate' | ||
import {useProvidedStateOrCreate} from '../hooks/useProvidedStateOrCreate' | ||
import useScrollFlash from '../hooks/useScrollFlash' | ||
import {VisuallyHidden} from '../internal/components/VisuallyHidden' | ||
import type {SxProp} from '../sx' | ||
|
||
import {isValidElementType} from 'react-is' | ||
import type {RenderItemFn} from '../deprecated/ActionList/List' | ||
|
||
const menuScrollMargins: ScrollIntoViewOptions = {startMargin: 0, endMargin: 8} | ||
|
||
export interface FilteredActionListProps | ||
extends Partial<Omit<GroupedListProps, keyof ListPropsBase>>, | ||
ListPropsBase, | ||
SxProp { | ||
loading?: boolean | ||
placeholderText?: string | ||
filterValue?: string | ||
onFilterChange: (value: string, e: React.ChangeEvent<HTMLInputElement>) => void | ||
textInputProps?: Partial<Omit<TextInputProps, 'onChange'>> | ||
inputRef?: React.RefObject<HTMLInputElement> | ||
} | ||
|
||
const StyledHeader = styled.div` | ||
box-shadow: 0 1px 0 ${get('colors.border.default')}; | ||
z-index: 1; | ||
` | ||
|
||
export function FilteredActionList({ | ||
loading = false, | ||
placeholderText, | ||
filterValue: externalFilterValue, | ||
onFilterChange, | ||
items, | ||
textInputProps, | ||
inputRef: providedInputRef, | ||
sx, | ||
groupMetadata, | ||
showItemDividers, | ||
...listProps | ||
}: FilteredActionListProps): JSX.Element { | ||
const [filterValue, setInternalFilterValue] = useProvidedStateOrCreate(externalFilterValue, undefined, '') | ||
const onInputChange = useCallback( | ||
(e: React.ChangeEvent<HTMLInputElement>) => { | ||
const value = e.target.value | ||
onFilterChange(value, e) | ||
setInternalFilterValue(value) | ||
}, | ||
[onFilterChange, setInternalFilterValue], | ||
) | ||
|
||
const scrollContainerRef = useRef<HTMLDivElement>(null) | ||
const listContainerRef = useRef<HTMLUListElement>(null) | ||
const inputRef = useProvidedRefOrCreate<HTMLInputElement>(providedInputRef) | ||
const activeDescendantRef = useRef<HTMLElement>() | ||
const listId = useId() | ||
const inputDescriptionTextId = useId() | ||
const onInputKeyPress: KeyboardEventHandler = useCallback( | ||
event => { | ||
if (event.key === 'Enter' && activeDescendantRef.current) { | ||
event.preventDefault() | ||
event.nativeEvent.stopImmediatePropagation() | ||
|
||
// Forward Enter key press to active descendant so that item gets activated | ||
const activeDescendantEvent = new KeyboardEvent(event.type, event.nativeEvent) | ||
activeDescendantRef.current.dispatchEvent(activeDescendantEvent) | ||
} | ||
}, | ||
[activeDescendantRef], | ||
) | ||
|
||
useFocusZone( | ||
{ | ||
containerRef: listContainerRef, | ||
focusOutBehavior: 'wrap', | ||
focusableElementFilter: element => { | ||
return !(element instanceof HTMLInputElement) | ||
}, | ||
activeDescendantFocus: inputRef, | ||
onActiveDescendantChanged: (current, previous, directlyActivated) => { | ||
activeDescendantRef.current = current | ||
|
||
if (current && scrollContainerRef.current && directlyActivated) { | ||
scrollIntoView(current, scrollContainerRef.current, menuScrollMargins) | ||
} | ||
}, | ||
}, | ||
[ | ||
// List ref isn't set while loading. Need to re-bind focus zone when it changes | ||
loading, | ||
], | ||
) | ||
|
||
useEffect(() => { | ||
// if items changed, we want to instantly move active descendant into view | ||
if (activeDescendantRef.current && scrollContainerRef.current) { | ||
scrollIntoView(activeDescendantRef.current, scrollContainerRef.current, {...menuScrollMargins, behavior: 'auto'}) | ||
} | ||
}, [items]) | ||
|
||
useScrollFlash(scrollContainerRef) | ||
|
||
function getItemListForEachGroup(groupId: string) { | ||
const itemsInGroup = [] | ||
for (const item of items) { | ||
// Look up the group associated with the current item. | ||
if (item.groupId === groupId) { | ||
itemsInGroup.push(item) | ||
} | ||
} | ||
return itemsInGroup | ||
} | ||
|
||
return ( | ||
<Box display="flex" flexDirection="column" overflow="hidden" sx={sx}> | ||
<StyledHeader> | ||
<TextInput | ||
ref={inputRef} | ||
block | ||
width="auto" | ||
color="fg.default" | ||
value={filterValue} | ||
onChange={onInputChange} | ||
onKeyPress={onInputKeyPress} | ||
placeholder={placeholderText} | ||
aria-label={placeholderText} | ||
aria-controls={listId} | ||
aria-describedby={inputDescriptionTextId} | ||
{...textInputProps} | ||
/> | ||
</StyledHeader> | ||
<VisuallyHidden id={inputDescriptionTextId}>Items will be filtered as you type</VisuallyHidden> | ||
<Box ref={scrollContainerRef} overflow="auto"> | ||
{loading ? ( | ||
<Box width="100%" display="flex" flexDirection="row" justifyContent="center" pt={6} pb={7}> | ||
<Spinner /> | ||
</Box> | ||
) : ( | ||
<ActionList ref={listContainerRef} showDividers={showItemDividers} {...listProps} role="listbox" id={listId}> | ||
{groupMetadata?.length | ||
? groupMetadata.map((group, index) => { | ||
return ( | ||
<ActionList.Group key={index}> | ||
<ActionList.GroupHeading variant={group.header?.variant ? group.header.variant : undefined}> | ||
{group.header?.title ? group.header.title : `Group ${group.groupId}`} | ||
</ActionList.GroupHeading> | ||
{getItemListForEachGroup(group.groupId).map((item, index) => { | ||
return <MappedActionListItem key={index} {...item} renderItem={listProps.renderItem} /> | ||
})} | ||
</ActionList.Group> | ||
) | ||
}) | ||
: items.map((item, index) => { | ||
return <MappedActionListItem key={index} {...item} renderItem={listProps.renderItem} /> | ||
})} | ||
</ActionList> | ||
)} | ||
</Box> | ||
</Box> | ||
) | ||
} | ||
|
||
function MappedActionListItem(item: ItemInput & {renderItem?: RenderItemFn}) { | ||
// keep backward compatibility for renderItem | ||
// escape hatch for custom Item rendering | ||
if (typeof item.renderItem === 'function') return item.renderItem(item) | ||
|
||
const { | ||
id, | ||
description, | ||
descriptionVariant, | ||
text, | ||
trailingVisual: TrailingVisual, | ||
leadingVisual: LeadingVisual, | ||
trailingText, | ||
trailingIcon: TrailingIcon, | ||
onAction, | ||
children, | ||
...rest | ||
} = item | ||
|
||
return ( | ||
<ActionList.Item | ||
role="option" | ||
// @ts-ignore - for now | ||
onSelect={(e: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>) => { | ||
if (typeof onAction === 'function') | ||
onAction(item, e as React.MouseEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement>) | ||
}} | ||
data-id={id} | ||
{...rest} | ||
> | ||
{LeadingVisual ? ( | ||
<ActionList.LeadingVisual> | ||
<LeadingVisual /> | ||
</ActionList.LeadingVisual> | ||
) : null} | ||
{children} | ||
{text} | ||
{description ? <ActionList.Description variant={descriptionVariant}>{description}</ActionList.Description> : null} | ||
{TrailingVisual ? ( | ||
<ActionList.TrailingVisual> | ||
{typeof TrailingVisual !== 'string' && isValidElementType(TrailingVisual) ? ( | ||
<TrailingVisual /> | ||
) : ( | ||
TrailingVisual | ||
)} | ||
</ActionList.TrailingVisual> | ||
) : TrailingIcon || trailingText ? ( | ||
<ActionList.TrailingVisual> | ||
{trailingText} | ||
{TrailingIcon && <TrailingIcon />} | ||
</ActionList.TrailingVisual> | ||
) : null} | ||
</ActionList.Item> | ||
) | ||
} | ||
|
||
FilteredActionList.displayName = 'FilteredActionList' |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export {FilteredActionList} from './FilteredActionList' | ||
export type {FilteredActionListProps} from './FilteredActionList' | ||
export {FilteredActionList} from './FilteredActionListEntry' | ||
export type {FilteredActionListProps} from './FilteredActionListEntry' |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is
items
a memoized value or is a plain value typically?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are memoized in SelectPanel before passing to FilteredActionList. Tell me more?