-
Notifications
You must be signed in to change notification settings - Fork 35
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
Replace kolSelect with split button in pagination #6721
Closed
Closed
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
785bee7
Replace select menu with split button
anicyne 4f298b2
add keyboard navigation
anicyne 1f618b0
initial intern menu component
Makko74 bfd933d
Revert "initial intern menu component"
Makko74 bbfe41d
add KolMenu component
anicyne be54d70
Keyboard navigation
Makko74 a9cae07
fix format
Makko74 21d8855
Merge branch 'develop' of https://github.com/public-ui/kolibri into 4…
anicyne 903292d
Refactor dropdown list
anicyne c2991a2
Add menu css for ecl and itzbund Themes
anicyne 1792df3
Update all snapshots$
anicyne 5c00bcd
Undo combobox css modification
anicyne 7b71ffb
Merge branch 'develop' of https://github.com/public-ui/kolibri into 4…
anicyne 6b7ae2a
Replace kol-menu with internal-menu and implement KolButtonWc in inte…
anicyne 93140a4
Fix internal-menu css
anicyne 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,16 @@ | ||
@mixin kol-menu-styles { | ||
.menu { | ||
&__listbox { | ||
width: 100%; | ||
padding: 0; | ||
box-sizing: border-box; | ||
display: grid; | ||
list-style: none; | ||
margin: 0; | ||
overflow-y: auto; | ||
overflow-x: hidden; | ||
background-color: white; | ||
max-height: rem(250); | ||
} | ||
} | ||
} |
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,60 @@ | ||
import type { FunctionalComponent } from '@stencil/core'; | ||
import { h } from '@stencil/core'; | ||
import type { JSX } from '@stencil/core/internal'; | ||
import type { Option } from '../../schema'; | ||
import clsx from 'clsx'; | ||
// import { KolButtonTag } from '../../core/component-names'; | ||
|
||
type KolMenuProps = { | ||
options: Option<number>[]; | ||
focusedOptionIndex: number; | ||
onItemClick: (event: Event, option: unknown) => void; | ||
renderOption?: (option: Option<number>) => JSX.Element; | ||
selectedValue?: number | string; | ||
}; | ||
export const KolMenu: FunctionalComponent<KolMenuProps> = ({ options, onItemClick, renderOption, selectedValue }) => { | ||
const listItems: (HTMLElement | undefined)[] = []; | ||
|
||
function handleKeyDown(event: KeyboardEvent, index: number, option: unknown): void { | ||
if (event.key === 'ArrowDown') { | ||
const nextIndex = index + 1 < listItems.length ? index + 1 : 0; | ||
listItems[nextIndex]?.focus(); | ||
event.preventDefault(); | ||
} else if (event.key === 'ArrowUp') { | ||
const prevIndex = index - 1 >= 0 ? index - 1 : listItems.length - 1; | ||
listItems[prevIndex]?.focus(); | ||
event.preventDefault(); | ||
} else if (event.key === 'Enter' || event.key === ' ') { | ||
onItemClick(event, option); | ||
event.preventDefault(); | ||
} | ||
} | ||
return ( | ||
<div class="menu"> | ||
<ul role="listbox" class={clsx('menu__listbox')}> | ||
{options.length > 0 && | ||
options.map((option, index) => ( | ||
<li | ||
ref={(el) => (listItems[index] = el)} | ||
id={`option-${index}`} | ||
key={index} | ||
tabIndex={-1} | ||
role="option" | ||
class="menu__item" | ||
aria-selected={selectedValue === option.value} | ||
onKeyDown={(event) => handleKeyDown(event, index, option)} | ||
onClick={(event) => onItemClick(event, option)} | ||
onMouseOver={() => { | ||
listItems[index]?.focus(); | ||
}} | ||
onFocus={() => { | ||
listItems[index]?.focus(); | ||
}} | ||
> | ||
{renderOption && renderOption(option)} | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
); | ||
}; |
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
Binary file modified
BIN
-68 Bytes
(100%)
...sformer/snapshots/theme-default/snapshot-for-pagination-basic-firefox-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 modified
BIN
-1.97 KB
(99%)
...napshots/theme-default/snapshot-for-table-pagination-position-firefox-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 modified
BIN
-555 Bytes
(99%)
...er/snapshots/theme-default/snapshot-for-table-with-pagination-firefox-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 modified
BIN
+1.87 KB
(110%)
.../themes/bmf/snapshots/theme-bmf/snapshot-for-pagination-basic-firefox-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 modified
BIN
+7.22 KB
(100%)
...mf/snapshots/theme-bmf/snapshot-for-table-pagination-position-firefox-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 modified
BIN
+1.82 KB
(100%)
...es/bmf/snapshots/theme-bmf/snapshot-for-table-with-pagination-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Binary file modified
BIN
+469 Bytes
(100%)
...default/snapshots/theme-default/snapshot-for-pagination-basic-firefox-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 modified
BIN
+1.03 KB
(100%)
...napshots/theme-default/snapshot-for-table-pagination-position-firefox-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 modified
BIN
+261 Bytes
(100%)
...lt/snapshots/theme-default/snapshot-for-table-with-pagination-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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.
Martin und ich haben das Feature einmal zusammen durchgeschaut. Sieht schon vielversprechend aus, folgende Punkte wollten wir vor einem detaillierten Review schon einmal weiter geben:
InternalMenu
(ohne Kol) heißen, um Verwechslungen mit Stencil-Komponenten auszuschließen und der bestehenden Konvention zu folgen.ul > li
außenherum soll bleiben.)