-
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
Changes from 29 commits
04d3a1b
61e7f2f
07eefb7
aad5727
9e27017
a0434de
e647bf8
d42cbd6
39bb9e2
4923baa
c5ff1bd
f6bc028
ff9aaa5
f15008d
16fa3f3
45a0570
ad586fa
d312fcc
f6864c9
b7ed915
8d721be
9f59e70
5f17cec
4867e8a
1a7d51a
c0cffab
8f6fc7a
44270f8
e4d3022
aca241e
46aefa7
200e46b
ce01163
49a2445
4dcc5b2
76cbbe2
47cc6f7
c386bdf
028ea97
0c00ba5
3f2dfc3
45d9a02
73286ac
c154487
880f9a8
dae25d8
5211828
94ec8b8
4732d61
026d957
7e3ecf0
7301b0e
d805b06
531fa89
da3b479
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,41 @@ | |
|
|
||
| All notable changes for each version of this project will be documented in this file. | ||
|
|
||
| ## 20.0.0 | ||
| ### General | ||
| - `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. | ||
|
|
||
| ### New Features | ||
| - `IgxTooltip` | ||
| - The tooltip now remains open while interacting with it. | ||
| - `IgxTooltipTarget` | ||
| - Introduced a new `hasArrow` input property. Controls whether to display an arrow indicator for the tooltip. Defaults to `false`. | ||
| - 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`. | ||
|
||
| ```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 `placement` input property of type `TooltipPlacement`. Controls where to place the tooltip relative to the target element. Default value is `bottom`. Supported values are `top`, `top-start`, `top-end`, `bottom`, `bottom-start`, `bottom-end`, `right`, `right-start`, `right-end`, `left`, `left-start`, `left-end`. | ||
|
|
||
|
||
| _Note:_ Positioning the arrow is based on the `placement` property. If `hasArrow` is set to `true`, changing the `placement` property will change the arrow position as well. | ||
| ```html | ||
| <igx-icon [igxTooltipTarget]="tooltipRef" [placement]="'top-start'">info</igx-icon> | ||
| <span #tooltipRef="tooltip" igxTooltip>Hello there, I am a tooltip!</span> | ||
| ``` | ||
| - Introduced a new `offset` input property. Controls the offset of the tooltip from the target in pixels. Default value is 6. | ||
|
|
||
| _Note:_ If a custom `positionStrategy` is used, the `placement` and `offset` properties (if set) will not be taken into account and the arrow (if enabled) will not be displayed. | ||
|
||
|
|
||
| ## 19.2.0 | ||
|
|
||
| ### General | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { mkenum } from '../../core/utils'; | ||
|
|
||
| export const TooltipPlacement = /*@__PURE__*/mkenum({ | ||
| top: 'top', | ||
| topStart: 'top-start', | ||
| topEnd: 'top-end', | ||
| bottom: 'bottom', | ||
| bottomStart: 'bottom-start', | ||
| bottomEnd: 'bottom-end', | ||
| right: 'right', | ||
| rightStart: 'right-start', | ||
| rightEnd: 'right-end', | ||
| left: 'left', | ||
| leftStart: 'left-start', | ||
| leftEnd: 'left-end' | ||
| }); | ||
| export type TooltipPlacement = (typeof TooltipPlacement)[keyof typeof TooltipPlacement]; |
| 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(); | ||
| } | ||
| } |
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.