-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(autocomplete): implement autocomplete hint (#158)
Closes #154
- Loading branch information
1 parent
fd225f3
commit df5f9d2
Showing
8 changed files
with
102 additions
and
5 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
1 change: 1 addition & 0 deletions
1
...b-esta/angular-public/autocomplete/src/autocomplete-hint/autocomplete-hint.component.html
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 @@ | ||
<ng-content></ng-content> |
23 changes: 23 additions & 0 deletions
23
...b-esta/angular-public/autocomplete/src/autocomplete-hint/autocomplete-hint.component.scss
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,23 @@ | ||
@import '../styles/autocomplete'; | ||
|
||
:host { | ||
padding-left: $autocompletePaddingX; | ||
padding-right: $autocompletePaddingX; | ||
padding-bottom: $autocompletePaddingTop; | ||
|
||
@include publicOnly() { | ||
@include mq($from: desktop4k) { | ||
font-size: toPx(10 * $scalingFactor4k); | ||
padding-top: toPx($autocompletePaddingTop * $scalingFactor4k); | ||
padding-bottom: toPx($autocompletePaddingTop * $scalingFactor4k); | ||
} | ||
|
||
@include mq($from: desktop5k) { | ||
font-size: toPx(10 * $scalingFactor5k); | ||
padding-top: toPx($autocompletePaddingTop * $scalingFactor5k); | ||
padding-bottom: toPx($autocompletePaddingTop * $scalingFactor5k); | ||
} | ||
} | ||
|
||
@include label; | ||
} |
18 changes: 18 additions & 0 deletions
18
...sbb-esta/angular-public/autocomplete/src/autocomplete-hint/autocomplete-hint.component.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,18 @@ | ||
import { Component, HostBinding } from '@angular/core'; | ||
|
||
/** | ||
* Autocomplete-hint IDs need to be unique across components, so this counter exists outside of | ||
* the component definition. | ||
*/ | ||
let nextId = 0; | ||
|
||
@Component({ | ||
selector: 'sbb-autocomplete-hint', | ||
templateUrl: './autocomplete-hint.component.html', | ||
styleUrls: ['./autocomplete-hint.component.scss'] | ||
}) | ||
export class AutocompleteHintComponent { | ||
/** Unique ID to be used by autocomplete trigger's "aria-owns" property. */ | ||
@HostBinding('attr.id') | ||
id = `sbb-autocomplete-hint-${nextId++}`; | ||
} |
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
1 change: 1 addition & 0 deletions
1
projects/sbb-esta/angular-public/autocomplete/src/public_api.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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from './autocomplete.module'; | ||
export * from './autocomplete/autocomplete.component'; | ||
export * from './autocomplete-hint/autocomplete-hint.component'; | ||
export * from './autocomplete/autocomplete-origin.directive'; | ||
export * from './autocomplete/autocomplete-trigger.directive'; |