-
Notifications
You must be signed in to change notification settings - Fork 475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(kit): add pulse component (#7544)
- Loading branch information
Showing
14 changed files
with
185 additions
and
0 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
7 changes: 7 additions & 0 deletions
7
projects/demo/src/modules/components/pulse/examples/1/index.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,7 @@ | ||
<button | ||
appearance="outline" | ||
tuiButton | ||
> | ||
Pulse | ||
<tui-pulse /> | ||
</button> |
14 changes: 14 additions & 0 deletions
14
projects/demo/src/modules/components/pulse/examples/1/index.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,14 @@ | ||
import {Component} from '@angular/core'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {encapsulation} from '@demo/emulate/encapsulation'; | ||
import {TuiButtonDirective} from '@taiga-ui/core'; | ||
import {TuiPulseComponent} from '@taiga-ui/kit'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [TuiPulseComponent, TuiButtonDirective], | ||
templateUrl: './index.html', | ||
encapsulation, | ||
changeDetection, | ||
}) | ||
export default class ExampleComponent {} |
13 changes: 13 additions & 0 deletions
13
projects/demo/src/modules/components/pulse/examples/import/import.md
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,13 @@ | ||
```ts | ||
import {TuiPulseComponent} from '@taiga-ui/kit'; | ||
// ... | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [ | ||
// ... | ||
TuiPulseComponent, | ||
], | ||
}) | ||
export class MyComponent {} | ||
``` |
3 changes: 3 additions & 0 deletions
3
projects/demo/src/modules/components/pulse/examples/import/template.md
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,3 @@ | ||
```html | ||
<tui-pulse [playing]="value"></tui-pulse> | ||
``` |
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,16 @@ | ||
<tui-doc-page | ||
header="Pulse" | ||
package="KIT" | ||
type="components" | ||
> | ||
<ng-template pageTab> | ||
<tui-doc-example | ||
id="pulse" | ||
heading="Pulse" | ||
[component]="1 | tuiComponent" | ||
[content]="1 | tuiExample: 'html,ts'" | ||
/> | ||
</ng-template> | ||
|
||
<tui-setup *pageTab="'Setup'" /> | ||
</tui-doc-page> |
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,11 @@ | ||
import {Component} from '@angular/core'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {TuiDemo} from '@demo/utils'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [TuiDemo], | ||
templateUrl: './index.html', | ||
changeDetection, | ||
}) | ||
export default class PageComponent {} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './pulse.component'; |
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,5 @@ | ||
{ | ||
"lib": { | ||
"entryFile": "index.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,27 @@ | ||
import {ChangeDetectionStrategy, Component, inject, Input} from '@angular/core'; | ||
import { | ||
TUI_ANIMATIONS_SPEED, | ||
tuiFadeIn, | ||
tuiScaleIn, | ||
tuiToAnimationOptions, | ||
} from '@taiga-ui/core'; | ||
|
||
@Component({ | ||
standalone: true, | ||
selector: 'tui-pulse', | ||
template: '', | ||
styleUrls: ['./pulse.style.less'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
animations: [tuiFadeIn, tuiScaleIn], | ||
host: { | ||
'[@tuiFadeIn]': 'animation', | ||
'[@tuiScaleIn]': 'animation', | ||
'[style.--t-animation-state]': "playing ? 'running' : 'paused'", | ||
}, | ||
}) | ||
export class TuiPulseComponent { | ||
@Input() | ||
public playing = true; | ||
|
||
protected readonly animation = tuiToAnimationOptions(inject(TUI_ANIMATIONS_SPEED)); | ||
} |
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,75 @@ | ||
@keyframes tuiPulse { | ||
0% { | ||
opacity: 0.3; | ||
transform: scale(1); | ||
} | ||
|
||
20% { | ||
opacity: 0; | ||
transform: scale(0.5); | ||
} | ||
|
||
25% { | ||
opacity: 0.3; | ||
transform: scale(1); | ||
} | ||
|
||
45% { | ||
opacity: 0; | ||
transform: scale(0.5); | ||
} | ||
|
||
50% { | ||
opacity: 0.3; | ||
transform: scale(1); | ||
} | ||
|
||
70% { | ||
opacity: 0; | ||
transform: scale(0.5); | ||
} | ||
|
||
75% { | ||
opacity: 0.3; | ||
transform: scale(1); | ||
} | ||
|
||
95% { | ||
opacity: 0; | ||
transform: scale(0.5); | ||
} | ||
|
||
100% { | ||
opacity: 0.3; | ||
transform: scale(1); | ||
} | ||
} | ||
|
||
:host { | ||
position: relative; | ||
color: var(--tui-primary); | ||
|
||
&:before { | ||
content: ''; | ||
position: absolute; | ||
top: -0.5rem; | ||
left: -0.5rem; | ||
width: 1rem; | ||
height: 1rem; | ||
border-radius: 100%; | ||
background: currentColor; | ||
opacity: 0.3; | ||
animation: tuiPulse 3s ease-in-out infinite; | ||
animation-play-state: var(--t-animation-state); | ||
} | ||
|
||
&:after { | ||
content: ''; | ||
position: absolute; | ||
width: 0.5rem; | ||
height: 0.5rem; | ||
border-radius: 100%; | ||
transform: translate(-50%, -50%); | ||
background: currentColor; | ||
} | ||
} |