-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Cdk listbox dev app #20010
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
Merged
Merged
Cdk listbox dev app #20010
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
d3fbbfc
build: Added required files to listbox directory.
nielsr98 5066335
build: added listbox option directive and renamed listbox directive f…
nielsr98 d0133cd
build: Added required files to listbox directory.
nielsr98 1e84c2d
build: added listbox option directive and renamed listbox directive f…
nielsr98 e22b3f2
build: Added required files to listbox directory.
nielsr98 a9b2519
build: added listbox option directive and renamed listbox directive f…
nielsr98 b1da11c
build: Added required files to listbox directory.
nielsr98 0af787c
build: added listbox option directive and renamed listbox directive f…
nielsr98 7ad3615
feat(listbox): added support for non-multiple listbox and aria active…
nielsr98 86510e4
fix(listbox): formatted BUILD.bazel.
nielsr98 41b62da
feat(dev-app/listbox): added cdk listbox example to the dev-app.
nielsr98 83db6b5
feat(listbox): added shift key selection.
nielsr98 71d9806
test(listbox): added test for selection via shift key.
nielsr98 e30d8e5
fix(listbox): formatted dev app build file.
nielsr98 169ee9c
fix(listbox): added codeowners for dev-app listbox example.
nielsr98 817c6df
fix(listbox): removed width css property.
nielsr98 f7454da
fix(listbox): removed private properties from host bindings to fix vi…
nielsr98 127355d
nit(listbox): changed double quote to single quote.
nielsr98 72287d4
refactor(listbox): fixed some styling errors and added modifier key t…
nielsr98 1b24b51
nit(listbox): changed spacing.
nielsr98 5278f78
nit(listbox): spacing.:
nielsr98 d765094
nit(listbox): removed extra blank line.
nielsr98 033f30a
refactor(listbox): changed test to have a stronger check on selected.
nielsr98 02dc398
refactor(listbox): changed css classes to use demo- prefix.
nielsr98 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
load("//tools:defaults.bzl", "ng_module") | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
ng_module( | ||
name = "cdk-experimental-listbox", | ||
srcs = glob(["**/*.ts"]), | ||
assets = [ | ||
"cdk-listbox-demo.html", | ||
"cdk-listbox-demo.css", | ||
], | ||
deps = [ | ||
"//src/cdk-experimental/listbox", | ||
"@npm//@angular/router", | ||
], | ||
) |
24 changes: 24 additions & 0 deletions
24
src/dev-app/cdk-experimental-listbox/cdk-listbox-demo-module.ts
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,24 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {NgModule} from '@angular/core'; | ||
import {CommonModule} from '@angular/common'; | ||
import {RouterModule} from '@angular/router'; | ||
import {CdkListboxModule} from '@angular/cdk-experimental/listbox'; | ||
|
||
import {CdkListboxDemo} from './cdk-listbox-demo'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
CdkListboxModule, | ||
CommonModule, | ||
RouterModule.forChild([{path: '', component: CdkListboxDemo}]), | ||
], | ||
declarations: [CdkListboxDemo], | ||
}) | ||
export class CdkListboxDemoModule {} |
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,14 @@ | ||
.demo-listbox { | ||
list-style-type: none; | ||
border: 1px solid black; | ||
cursor: default; | ||
padding: 0; | ||
} | ||
|
||
.demo-listbox .cdk-option-active { | ||
background: lightgrey; | ||
} | ||
|
||
.demo-listbox .cdk-option-selected { | ||
background: cornflowerblue; | ||
} |
10 changes: 10 additions & 0 deletions
10
src/dev-app/cdk-experimental-listbox/cdk-listbox-demo.html
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,10 @@ | ||
<ul cdkListbox class="demo-listbox" [multiple]="multiSelectable" [useActiveDescendant]="activeDescendant"> | ||
<li cdkOption>Apple</li> | ||
<li cdkOption>Orange</li> | ||
<li cdkOption>Grapefruit</li> | ||
<li cdkOption>Peach</li> | ||
</ul> | ||
|
||
<button (click)="toggleMultiple()">Toggle Multiple</button> | ||
<br> | ||
<button (click)="toggleActiveDescendant()">Toggle Active Descendant</button> |
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,26 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {Component} from '@angular/core'; | ||
|
||
@Component({ | ||
templateUrl: 'cdk-listbox-demo.html', | ||
styleUrls: ['cdk-listbox-demo.css'], | ||
}) | ||
export class CdkListboxDemo { | ||
multiSelectable = false; | ||
activeDescendant = true; | ||
|
||
toggleMultiple() { | ||
this.multiSelectable = !this.multiSelectable; | ||
} | ||
|
||
toggleActiveDescendant() { | ||
this.activeDescendant = !this.activeDescendant; | ||
} | ||
} |
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
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.
What's the thinking behind toggling options based on arrow keys with shift rather than requiring a separate space/enter keypress? Was this from the aria authoring practices?
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.
So it would work with a separate space/enter keypress. In the authoring practices it says that selection via SHIFT + arrow key is an optional way to do selection.