-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(kit):
Drawer
add new component (#9614)
Co-authored-by: taiga-family-bot <[email protected]>
- Loading branch information
1 parent
38b2568
commit 5b43400
Showing
34 changed files
with
598 additions
and
9 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './popup.directive'; | ||
export * from './popup.service'; |
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,28 @@ | ||
import type {EmbeddedViewRef, OnDestroy} from '@angular/core'; | ||
import {Directive, inject, Input, TemplateRef} from '@angular/core'; | ||
|
||
import {TuiPopupService} from './popup.service'; | ||
|
||
@Directive({ | ||
standalone: true, | ||
selector: 'ng-template[tuiPopup]', | ||
}) | ||
export class TuiPopup implements OnDestroy { | ||
private readonly template = inject(TemplateRef); | ||
private readonly service = inject(TuiPopupService); | ||
|
||
private viewRef?: EmbeddedViewRef<unknown>; | ||
|
||
@Input() | ||
public set tuiPopup(show: boolean) { | ||
this.viewRef?.destroy(); | ||
|
||
if (show) { | ||
this.viewRef = this.service.addTemplate(this.template); | ||
} | ||
} | ||
|
||
public ngOnDestroy(): void { | ||
this.viewRef?.destroy(); | ||
} | ||
} |
File renamed without changes.
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,6 +1,5 @@ | ||
export * from './breakpoint.service'; | ||
export * from './dark-theme.service'; | ||
export * from './format-date.service'; | ||
export * from './popup.service'; | ||
export * from './position.service'; | ||
export * from './visual-viewport.service'; |
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
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
136 changes: 136 additions & 0 deletions
136
projects/demo/src/modules/components/drawer/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,136 @@ | ||
<button | ||
tuiButton | ||
type="button" | ||
(click)="open.set(!open())" | ||
> | ||
Toggle | ||
</button> | ||
|
||
<tui-drawer *tuiPopup="open()"> | ||
<header> | ||
<h2 tuiHeader> | ||
<div tuiTitle> | ||
<span tuiCaption>Caption・caption</span> | ||
<span> | ||
Drawer title | ||
<tui-badge>Label</tui-badge> | ||
</span> | ||
<span tuiSubtitle> | ||
In publishing and graphic design, Lorem ipsum is a placeholder text commonly used. | ||
</span> | ||
</div> | ||
|
||
<div tuiAccessories> | ||
<button | ||
iconStart="@tui.search" | ||
tuiButton | ||
type="button" | ||
> | ||
More info | ||
</button> | ||
<button | ||
iconStart="@tui.ellipsis" | ||
tuiIconButton | ||
type="button" | ||
> | ||
Actions | ||
</button> | ||
<button | ||
appearance="icon" | ||
iconStart="@tui.x" | ||
tuiIconButton | ||
type="button" | ||
(click)="open.set(false)" | ||
> | ||
Close | ||
</button> | ||
</div> | ||
</h2> | ||
<div> | ||
<button | ||
tuiButton | ||
type="button" | ||
> | ||
Action 1 | ||
</button> | ||
<a | ||
appearance="action" | ||
href="#" | ||
tuiButton | ||
> | ||
Action 2 | ||
</a> | ||
<button | ||
tuiLink | ||
type="button" | ||
> | ||
Action 3 | ||
</button> | ||
</div> | ||
<nav tuiNavigationNav> | ||
<tui-tabs> | ||
<button | ||
tuiTab | ||
type="button" | ||
> | ||
Default view | ||
</button> | ||
<button | ||
tuiTab | ||
type="button" | ||
> | ||
Details | ||
</button> | ||
<button | ||
tuiTab | ||
type="button" | ||
> | ||
Followers | ||
</button> | ||
</tui-tabs> | ||
<hr /> | ||
<button | ||
size="xs" | ||
tuiButton | ||
type="button" | ||
> | ||
Primary | ||
</button> | ||
<button | ||
appearance="secondary" | ||
iconStart="@tui.ellipsis" | ||
size="xs" | ||
tuiIconButton | ||
type="button" | ||
> | ||
More | ||
</button> | ||
</nav> | ||
</header> | ||
<p *tuiRepeatTimes="let index of 15">Content</p> | ||
<footer> | ||
<button | ||
size="m" | ||
tuiButton | ||
type="button" | ||
[style.margin-inline-end]="'auto'" | ||
> | ||
Tertiary action | ||
</button> | ||
<button | ||
size="m" | ||
tuiButton | ||
type="button" | ||
> | ||
Secondary action | ||
</button> | ||
<button | ||
appearance="primary" | ||
size="m" | ||
tuiButton | ||
type="button" | ||
> | ||
Primary action | ||
</button> | ||
</footer> | ||
</tui-drawer> |
30 changes: 30 additions & 0 deletions
30
projects/demo/src/modules/components/drawer/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,30 @@ | ||
import {Component, signal} from '@angular/core'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {encapsulation} from '@demo/emulate/encapsulation'; | ||
import {TuiRepeatTimes} from '@taiga-ui/cdk'; | ||
import {TuiButton, TuiLink, TuiPopup, TuiScrollbar, TuiTitle} from '@taiga-ui/core'; | ||
import {TuiBadge, TuiDrawer, TuiTabs} from '@taiga-ui/kit'; | ||
import {TuiHeader, TuiNavigation} from '@taiga-ui/layout'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [ | ||
TuiBadge, | ||
TuiButton, | ||
TuiDrawer, | ||
TuiHeader, | ||
TuiLink, | ||
TuiNavigation, | ||
TuiPopup, | ||
TuiRepeatTimes, | ||
TuiScrollbar, | ||
TuiTabs, | ||
TuiTitle, | ||
], | ||
templateUrl: './index.html', | ||
encapsulation, | ||
changeDetection, | ||
}) | ||
export default class Example { | ||
protected readonly open = signal(false); | ||
} |
38 changes: 38 additions & 0 deletions
38
projects/demo/src/modules/components/drawer/examples/2/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,38 @@ | ||
<button | ||
tuiButton | ||
type="button" | ||
(click)="open.set(true)" | ||
> | ||
Open | ||
</button> | ||
|
||
<tui-drawer | ||
*tuiPopup="open()" | ||
direction="left" | ||
class="drawer" | ||
[overlay]="true" | ||
(click.self)="onClose()" | ||
> | ||
<header class="header"> | ||
<h2 tuiHeader> | ||
<div tuiTitle>Sticky header</div> | ||
<div tuiAccessories> | ||
<button | ||
tuiButton | ||
type="button" | ||
(click)="onClose()" | ||
> | ||
Close | ||
</button> | ||
</div> | ||
</h2> | ||
</header> | ||
<tui-textfield> | ||
<label tuiLabel>Enter value</label> | ||
<input | ||
tuiTextfield | ||
[formControl]="control" | ||
/> | ||
</tui-textfield> | ||
<p *tuiRepeatTimes="let index of 30">Content</p> | ||
</tui-drawer> |
9 changes: 9 additions & 0 deletions
9
projects/demo/src/modules/components/drawer/examples/2/index.less
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,9 @@ | ||
.drawer { | ||
top: 0; | ||
border-radius: 0; | ||
inline-size: 20rem; | ||
} | ||
|
||
.header { | ||
position: sticky; | ||
} |
Oops, something went wrong.