-
Notifications
You must be signed in to change notification settings - Fork 22
feat(tooltip): add show/hide triggers sample #3774
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
Open
RivaIvanova
wants to merge
5
commits into
vnext
Choose a base branch
from
rivanova/add-show-hide-triggers-sample
base: vnext
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2df5a39
feat(tooltip): add show/hide triggers sample
RivaIvanova 6d0cc71
Merge branch 'vnext' into rivanova/add-show-hide-triggers-sample
RivaIvanova 68474ec
Merge branch 'vnext' into rivanova/add-show-hide-triggers-sample
RivaIvanova b9cfac3
chore(*): bump ig packages
RivaIvanova 2527186
fix(tooltip-triggers): add wc as additional dependency
RivaIvanova 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
Some comments aren't visible on the classic Files Changed page.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
84 changes: 84 additions & 0 deletions
84
src/app/interactions/tooltip/tooltip-triggers/tooltip-triggers.component.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,84 @@ | ||
| <div class="triggers-container"> | ||
| <igx-card> | ||
| <igx-card-header> | ||
| <h4 igxCardHeaderTitle>Default triggers</h4> | ||
| </igx-card-header> | ||
| <igx-card-content> | ||
| <p> | ||
| Hovering over the button below will display the tooltip using its default configuration: it appears on <strong>pointer enter</strong> and hides on <strong>pointer leave</strong> or <strong>click</strong>. | ||
| </p> | ||
| <button igxButton="outlined" [igxTooltipTarget]="triggersDefault">Hover over me</button> | ||
| </igx-card-content> | ||
| </igx-card> | ||
| <div #triggersDefault="tooltip" igxTooltip> | ||
| I am shown on pointer enter and hidden on pointer leave and/or click. | ||
| </div> | ||
|
|
||
| <igx-card> | ||
| <igx-card-header> | ||
| <h4 igxCardHeaderTitle>Focus based</h4> | ||
| </igx-card-header> | ||
| <igx-card-content> | ||
| <p> | ||
| In this instance, the tooltip is bound to show on its anchor | ||
| <strong>focus</strong> and will hide when its anchor is | ||
| <strong>blurred</strong>. | ||
| </p> | ||
| <p>Try to navigate with a Tab key to the anchor to see the effect.</p> | ||
| <button igxButton="outlined" [igxTooltipTarget]="triggersFocusBlur" [showDelay]="0" [hideDelay]="0" [showTriggers]="'focus'" [hideTriggers]="'blur'">Focus me</button> | ||
| </igx-card-content> | ||
| </igx-card> | ||
| <div #triggersFocusBlur="tooltip" igxTooltip> | ||
| I am shown on focus and hidden on blur. | ||
| </div> | ||
|
|
||
| <igx-card> | ||
| <igx-card-header> | ||
| <h4 igxCardHeaderTitle>Same trigger(s) for showing and hiding</h4> | ||
| </igx-card-header> | ||
| <igx-card-content> | ||
| <p> | ||
| The same trigger can be bound to both show and hide the tooltip. The | ||
| button below has its tooltip bound to show/hide on | ||
| <strong>click</strong>. | ||
| </p> | ||
| <button igxButton="outlined" [igxTooltipTarget]="triggersClick" [showDelay]="0" [hideDelay]="0" [showTriggers]="'click'" [hideTriggers]="'click'">Click</button> | ||
| </igx-card-content> | ||
| </igx-card> | ||
| <div #triggersClick="tooltip" igxTooltip> | ||
| I am shown on click and will hide on anchor click. | ||
| </div> | ||
|
|
||
| <igx-card> | ||
| <igx-card-header> | ||
| <h4 igxCardHeaderTitle>Keyboard interactions</h4> | ||
| </igx-card-header> | ||
| <igx-card-content> | ||
| <p> | ||
| Keyboard interactions are also supported. The button below has its | ||
| tooltip bound to show on a <strong>keypress</strong> and hide on a | ||
| <strong>keypress</strong> or <strong>blur</strong>. | ||
| </p> | ||
| <p>Try it out by focusing the button and pressing a key.</p> | ||
| <button igxButton="outlined" [igxTooltipTarget]="triggersKeypress" [showTriggers]="'keypress'" [hideTriggers]="'keypress,blur'">Press a key</button> | ||
| </igx-card-content> | ||
| </igx-card> | ||
| <div #triggersKeypress="tooltip" igxTooltip> | ||
| I am shown on a keypress and will hide on a keypress or blur. | ||
| </div> | ||
|
|
||
| <igx-card> | ||
| <igx-card-header> | ||
| <h4 igxCardHeaderTitle>Custom events</h4> | ||
| </igx-card-header> | ||
| <igx-card-content> | ||
| <p> | ||
| The tooltip supports any DOM event, including custom events. Try entering a value in the input below, then "commit" it by either <strong>blurring</strong> the input or pressing <strong>Enter</strong>. | ||
| </p> | ||
| <igc-input outlined label="Username" [igxTooltipTarget]="triggersCustom" [showTriggers]="'igcChange'"></igc-input> | ||
| </igx-card-content> | ||
| </igx-card> | ||
| <div #triggersCustom="tooltip" igxTooltip> | ||
| Value changed! | ||
| </div> | ||
| </div> |
31 changes: 31 additions & 0 deletions
31
src/app/interactions/tooltip/tooltip-triggers/tooltip-triggers.component.scss
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,31 @@ | ||
| .triggers-container { | ||
| display: flex; | ||
| flex-wrap: wrap; | ||
| align-content: space-between; | ||
| gap: 0.6rem; | ||
| padding: 0.5rem 0rem 0rem 0.5rem; | ||
|
|
||
| & igx-card { | ||
| max-width: 320px; | ||
| } | ||
|
|
||
| & igx-card-header { | ||
| min-height: 3rem; | ||
| } | ||
|
|
||
| & igx-card-content { | ||
| display: flex; | ||
| height: 100%; | ||
| flex-direction: column; | ||
| gap: 0.5rem; | ||
| justify-content: space-between; | ||
| } | ||
|
|
||
| & igc-input { | ||
| --size: 36px; | ||
| } | ||
| } | ||
|
|
||
| .igx-tooltip { | ||
| max-width: 200px; | ||
| } |
30 changes: 30 additions & 0 deletions
30
src/app/interactions/tooltip/tooltip-triggers/tooltip-triggers.component.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,30 @@ | ||
| import { Component, CUSTOM_ELEMENTS_SCHEMA } from "@angular/core"; | ||
| import { | ||
| IgxTooltipTargetDirective, | ||
| IgxTooltipDirective, | ||
| IgxButtonDirective, | ||
| IgxCardComponent, | ||
| IgxCardHeaderComponent, | ||
| IgxCardHeaderTitleDirective, | ||
| IgxCardContentDirective | ||
| } from "igniteui-angular"; | ||
| import { defineComponents, IgcInputComponent } from 'igniteui-webcomponents'; | ||
|
|
||
| defineComponents(IgcInputComponent); | ||
|
|
||
| @Component({ | ||
| selector: "app-tooltip-triggers", | ||
| styleUrls: ["./tooltip-triggers.component.scss"], | ||
| templateUrl: "./tooltip-triggers.component.html", | ||
| schemas: [CUSTOM_ELEMENTS_SCHEMA], | ||
| imports: [ | ||
| IgxTooltipTargetDirective, | ||
| IgxTooltipDirective, | ||
| IgxButtonDirective, | ||
| IgxCardComponent, | ||
| IgxCardHeaderComponent, | ||
| IgxCardHeaderTitleDirective, | ||
| IgxCardContentDirective | ||
| ] | ||
| }) | ||
| export class TooltipTriggersComponent { } | ||
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.