-
Notifications
You must be signed in to change notification settings - Fork 159
feat(tooltip): align with WC tooltip #15791
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
Changes from 50 commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
04d3a1b
refactor(tooltip): change delay props; change methods to not respect …
RivaIvanova 61e7f2f
docs(tooltip-target): update methods in readme
RivaIvanova 07eefb7
feat(tooltip): hover on tooltip does not close it
RivaIvanova aad5727
feat(tooltip): Add custom close button and disable arrow functionality
Zneeky 9e27017
Merge branch 'feature/align-tooltip' of https://github.com/IgniteUI/i…
Zneeky a0434de
fix(tooltip): set initially arrow to display none
Zneeky e647bf8
fix(tooltip): add check for multiple targets
RivaIvanova d42cbd6
test(tooltip): update tests with auto hide delay
RivaIvanova 39bb9e2
fix(tooltip-close-icon): resolve circular dependency
RivaIvanova 4923baa
feat(tooltip): add custom close button template
Zneeky c5ff1bd
fix(tooltip-target): fix animation duration mistake
Zneeky f6bc028
feat(tooltip): add arrow, placement, offset
RivaIvanova ff9aaa5
feat(tooltip): add arrow and close btn styles
didimmova f15008d
feat(tooltip): tooltip sticky functionality for multiple targets
Zneeky 16fa3f3
Merge branch 'feature/align-tooltip' of https://github.com/IgniteUI/i…
Zneeky 45a0570
test(tooltip): fixed minor mistake in tests
Zneeky ad586fa
feat(tooltip): update displays
didimmova d312fcc
style(tooltip): add width to fit content
didimmova f6864c9
test(tooltip): added tests for placement and offset
Zneeky b7ed915
feat(tooltip): adjust arrow position
RivaIvanova 8d721be
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
RivaIvanova 9f59e70
Merge branch 'feature/align-tooltip' of https://github.com/IgniteUI/i…
Zneeky 5f17cec
test(tooltip): add tests for arrow
Zneeky 4867e8a
refactor(tooltip): update sticky logic and add additional tests
Zneeky 1a7d51a
fix(tooltip): placement to bottom, no arrow by default, arrow multi t…
RivaIvanova c0cffab
fix(tooltip-sample): rename disableArrow prop
RivaIvanova 8f6fc7a
fix(tooltip): consolidate tooltip show checks into a single method
Zneeky 44270f8
Merge branch 'feature/align-tooltip' of https://github.com/IgniteUI/i…
Zneeky e4d3022
docs(tooltip): update changelog and hasArrow description
RivaIvanova aca241e
Merge branch 'master' into feature/align-tooltip
RivaIvanova 46aefa7
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
RivaIvanova 200e46b
test(tooltip): update touch tests
RivaIvanova ce01163
feat(overlay): add placement and offset
RivaIvanova 49a2445
feat(tooltip): allow using custom strategies with arrow
RivaIvanova 4dcc5b2
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
RivaIvanova 76cbbe2
fix(tooltip): use default pos settings and expose tooltip pos strategy
RivaIvanova 47cc6f7
fix(tooltip-position-strategy): resolve circular dependency
RivaIvanova c386bdf
fix(position-strategies): check for defined offset
RivaIvanova 028ea97
fix(tooltip): remove placement property
RivaIvanova 0c00ba5
refactor(tooltip): use tooltipTarget mouse handlers
RivaIvanova 3f2dfc3
refactor(position-strategies): add base getElementOffsets
RivaIvanova 45d9a02
fix(tooltip): create arrow as span
RivaIvanova 73286ac
Merge branch 'master' into feature/align-tooltip
RivaIvanova c154487
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
RivaIvanova 880f9a8
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
RivaIvanova dae25d8
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
RivaIvanova 5211828
Merge branch 'master' into feature/align-tooltip
RivaIvanova 94ec8b8
test(grid-validation): fix failing test
RivaIvanova 4732d61
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
RivaIvanova 026d957
Merge branch 'master' into feature/align-tooltip
RivaIvanova 7e3ecf0
Merge branch 'master' into feature/align-tooltip
RivaIvanova 7301b0e
docs(tooltip): add changes to tooltip readme
RivaIvanova d805b06
Merge branch 'master' into feature/align-tooltip
RivaIvanova 531fa89
fix(tooltip-theme): add default cursor to igx-tooltip-close-button
Zneeky da3b479
Merge branch 'master' into feature/align-tooltip
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,9 +10,89 @@ All notable changes for each version of this project will be documented in this | |
this.carousel.select(2, Direction.NEXT); | ||
``` | ||
|
||
- `IgxOverlay` | ||
- Position Settings now accept a new optional `offset` input property of type `number`. Used to set the offset of the element from the target in pixels. | ||
|
||
- `IgxTooltip` | ||
- The tooltip now remains open while interacting with it. | ||
- `IgxTooltipTarget` | ||
- Introduced a new `positionSettings` input property. Controls the position and animation settings used by the tooltip. | ||
- Introduced a new `sticky` input property. When set to `true`, the tooltip renders a default close icon `x`. The tooltip remains visible until the user closes it via the close icon `x` or `Esc` key. Defaults to `false`. | ||
- Introduced a new `closeButtonTemplate` input property that allows templating the default close icon `x`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would avoid explaining this in such detail in the changelog. There are component READMEs for this purpose and the Changelog can link to them. Please trim this substantially in favor of a robust tooltip README of how everything works now |
||
```html | ||
<igx-icon [igxTooltipTarget]="tooltipRef" [closeButtonTemplate]="customClose">info</igx-icon> | ||
<span #tooltipRef="tooltip" igxTooltip>Hello there, I am a tooltip!</span> | ||
|
||
<ng-template #customClose> | ||
<button igxButton>Close</button> | ||
</ng-template> | ||
``` | ||
|
||
- Introduced a new `hasArrow` input property. Controls whether to display an arrow indicator for the tooltip. Defaults to `false`. | ||
|
||
_Note:_ The tooltip uses the `TooltipPositionStrategy` to position the tooltip and arrow element. If a custom position strategy is used (`overlaySettings.positionStrategy`) and `hasArrow` is set to `true`, the custom strategy should extend the `TooltipPositionStrategy`. Otherwise, the arrow will not be displayed. | ||
|
||
_Note:_ The arrow element is positioned based on the provided position settings. If the directions and starting points do not correspond to any of the predefined position values, the arrow is positioned in the top middle side of the tooltip (default tooltip position `bottom`). | ||
|
||
|
||
| Position | Horizontal Direction | Horizontal Start Point | Vertical Direction | Vertical Start Point | | ||
|--------------|-------------------------------|--------------------------------|-------------------------------|--------------------------------| | ||
| top | HorizontalAlignment.Center | HorizontalAlignment.Center | VerticalAlignment.Top | VerticalAlignment.Top | | ||
| top-start | HorizontalAlignment.Right | HorizontalAlignment.Left | VerticalAlignment.Top | VerticalAlignment.Top | | ||
| top-end | HorizontalAlignment.Left | HorizontalAlignment.Right | VerticalAlignment.Top | VerticalAlignment.Top | | ||
| bottom | HorizontalAlignment.Center | HorizontalAlignment.Center | VerticalAlignment.Bottom | VerticalAlignment.Bottom | | ||
| bottom-start | HorizontalAlignment.Right | HorizontalAlignment.Left | VerticalAlignment.Bottom | VerticalAlignment.Bottom | | ||
| bottom-end | HorizontalAlignment.Left | HorizontalAlignment.Right | VerticalAlignment.Bottom | VerticalAlignment.Bottom | | ||
| right | HorizontalAlignment.Right | HorizontalAlignment.Right | VerticalAlignment.Middle | VerticalAlignment.Middle | | ||
| right-start | HorizontalAlignment.Right | HorizontalAlignment.Right | VerticalAlignment.Bottom | VerticalAlignment.Top | | ||
| right-end | HorizontalAlignment.Right | HorizontalAlignment.Right | VerticalAlignment.Top | VerticalAlignment.Bottom | | ||
| left | HorizontalAlignment.Left | HorizontalAlignment.Left | VerticalAlignment.Middle | VerticalAlignment.Middle | | ||
| left-start | HorizontalAlignment.Left | HorizontalAlignment.Left | VerticalAlignment.Bottom | VerticalAlignment.Top | | ||
| left-end | HorizontalAlignment.Left | HorizontalAlignment.Left | VerticalAlignment.Top | VerticalAlignment.Bottom | | ||
|
||
|
||
The arrow's position can be customized by overriding the `positionArrow(arrow: HTMLElement, arrowFit: ArrowFit)` method. | ||
|
||
For example: | ||
|
||
```ts | ||
export class CustomStrategy extends TooltipPositioningStrategy { | ||
constructor(settings?: PositionSettings) { | ||
super(settings); | ||
} | ||
|
||
public override positionArrow(arrow: HTMLElement, arrowFit: ArrowFit): void { | ||
Object.assign(arrow.style, { | ||
left: '-0.25rem', | ||
transform: 'rotate(-45deg)', | ||
[arrowFit.direction]: '-0.25rem', | ||
}); | ||
} | ||
} | ||
|
||
public overlaySettings: OverlaySettings = { | ||
positionStrategy: new CustomStrategy({ | ||
horizontalDirection: HorizontalAlignment.Right, | ||
horizontalStartPoint: HorizontalAlignment.Right, | ||
verticalDirection: VerticalAlignment.Bottom, | ||
verticalStartPoint: VerticalAlignment.Bottom, | ||
}) | ||
}; | ||
``` | ||
|
||
```html | ||
<igx-icon [igxTooltipTarget]="tooltipRef" [hasArrow]="true" [overlaySettings]="overlaySettings">info</igx-icon> | ||
<span #tooltipRef="tooltip" igxTooltip>Hello there, I am a tooltip!</span> | ||
``` | ||
|
||
### General | ||
- `IgxDropDown` now exposes a `role` input property, allowing users to customize the role attribute based on the use case. The default is `listbox`. | ||
|
||
- `IgxTooltipTarget` | ||
- **Behavioral Changes** | ||
- The `showDelay` input property now defaults to `200`. | ||
- The `hideDelay` input property now defaults to `300`. | ||
- The `showTooltip` and `hideTooltip` methods do not take `showDelay`/`hideDelay` into account. | ||
|
||
## 20.0.6 | ||
### General | ||
|
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
28 changes: 28 additions & 0 deletions
28
projects/igniteui-angular/src/lib/directives/tooltip/tooltip-close-button.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,28 @@ | ||
import { Component, Output, EventEmitter, HostListener, Input, TemplateRef } from '@angular/core'; | ||
import { IgxIconComponent } from '../../icon/icon.component'; | ||
import { CommonModule } from '@angular/common'; | ||
|
||
@Component({ | ||
selector: 'igx-tooltip-close-button', | ||
template: ` | ||
<ng-container *ngIf="customTemplate; else defaultTemplate"> | ||
<ng-container *ngTemplateOutlet="customTemplate"></ng-container> | ||
</ng-container> | ||
<ng-template #defaultTemplate> | ||
<igx-icon aria-hidden="true" family="default" name="close"></igx-icon> | ||
</ng-template> | ||
`, | ||
imports: [IgxIconComponent, CommonModule], | ||
}) | ||
export class IgxTooltipCloseButtonComponent { | ||
@Input() | ||
public customTemplate: TemplateRef<any>; | ||
|
||
@Output() | ||
public clicked = new EventEmitter<void>(); | ||
|
||
@HostListener('click') | ||
public handleClick() { | ||
this.clicked.emit(); | ||
} | ||
} |
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.
Because there's already hide delay, wouldn't this be equivalent of hideDelay = null or -1 for example. I don't mind the explicit option though.