-
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(experimental):
Segmented
add new component (#6511)
Co-authored-by: taiga-family-bot <[email protected]>
- Loading branch information
1 parent
eef8e7d
commit f982f5d
Showing
33 changed files
with
744 additions
and
52 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
13 changes: 13 additions & 0 deletions
13
projects/demo/src/modules/experimental/segmented/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,13 @@ | ||
<tui-segmented | ||
*ngFor="let size of sizes" | ||
[size]="size" | ||
> | ||
<button> | ||
<tui-icon icon="tuiIconSun"></tui-icon> | ||
All | ||
<tui-badge-notification [size]="size">3</tui-badge-notification> | ||
<tui-icon icon="tuiIconMoon"></tui-icon> | ||
</button> | ||
<button>Incoming</button> | ||
<button>Outgoing</button> | ||
</tui-segmented> |
6 changes: 6 additions & 0 deletions
6
projects/demo/src/modules/experimental/segmented/examples/1/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,6 @@ | ||
:host { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
gap: 1rem; | ||
} |
14 changes: 14 additions & 0 deletions
14
projects/demo/src/modules/experimental/segmented/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'; | ||
|
||
@Component({ | ||
selector: 'tui-segmented-example-1', | ||
templateUrl: './index.html', | ||
styleUrls: ['./index.less'], | ||
encapsulation, | ||
changeDetection, | ||
}) | ||
export class TuiSegmentedExample1 { | ||
readonly sizes = ['s', 'm', 'l'] as const; | ||
} |
9 changes: 9 additions & 0 deletions
9
projects/demo/src/modules/experimental/segmented/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,9 @@ | ||
<tui-segmented> | ||
<button>Dynamic width</button> | ||
<button>Items</button> | ||
</tui-segmented> | ||
|
||
<tui-segmented class="full"> | ||
<button>Fixed width</button> | ||
<button tuiFade>with fadeout effect</button> | ||
</tui-segmented> |
14 changes: 14 additions & 0 deletions
14
projects/demo/src/modules/experimental/segmented/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,14 @@ | ||
:host { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
gap: 1rem; | ||
} | ||
|
||
.full { | ||
width: 100%; | ||
|
||
& > * { | ||
flex: 1; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
projects/demo/src/modules/experimental/segmented/examples/2/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,12 @@ | ||
import {Component} from '@angular/core'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {encapsulation} from '@demo/emulate/encapsulation'; | ||
|
||
@Component({ | ||
selector: 'tui-segmented-example-2', | ||
templateUrl: './index.html', | ||
styleUrls: ['./index.less'], | ||
encapsulation, | ||
changeDetection, | ||
}) | ||
export class TuiSegmentedExample2 {} |
25 changes: 25 additions & 0 deletions
25
projects/demo/src/modules/experimental/segmented/examples/3/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,25 @@ | ||
<header> | ||
<tui-segmented | ||
class="colors" | ||
[(activeItemIndex)]="active" | ||
> | ||
<button | ||
*ngFor="let button of buttons; let index = index" | ||
[class.active]="index === active" | ||
> | ||
{{ button }} | ||
</button> | ||
</tui-segmented> | ||
</header> | ||
|
||
<tui-segmented [style.border-radius.rem]="10"> | ||
<button>Border radius</button> | ||
<button>Can be</button> | ||
<button>Customized</button> | ||
</tui-segmented> | ||
|
||
<tui-segmented [style.font-weight]="'bold'"> | ||
<button>Fonts</button> | ||
<button>Can also be</button> | ||
<button>Overridden</button> | ||
</tui-segmented> |
24 changes: 24 additions & 0 deletions
24
projects/demo/src/modules/experimental/segmented/examples/3/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,24 @@ | ||
:host { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
gap: 1rem; | ||
} | ||
|
||
header { | ||
background: var(--tui-clear); | ||
box-shadow: 0 -10rem 0 10.5rem var(--tui-clear); | ||
} | ||
|
||
.colors { | ||
color: var(--tui-base-01); | ||
|
||
&:before { | ||
color: var(--tui-link); | ||
box-shadow: none; | ||
} | ||
|
||
.active { | ||
color: var(--tui-text-01-night); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
projects/demo/src/modules/experimental/segmented/examples/3/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,15 @@ | ||
import {Component} from '@angular/core'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {encapsulation} from '@demo/emulate/encapsulation'; | ||
|
||
@Component({ | ||
selector: 'tui-segmented-example-3', | ||
templateUrl: './index.html', | ||
styleUrls: ['./index.less'], | ||
encapsulation, | ||
changeDetection, | ||
}) | ||
export class TuiSegmentedExample3 { | ||
readonly buttons = ['Track active index', 'To color tabs', 'Differently']; | ||
active = 0; | ||
} |
80 changes: 80 additions & 0 deletions
80
projects/demo/src/modules/experimental/segmented/examples/4/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,80 @@ | ||
<strong>Buttons</strong> | ||
<tui-segmented> | ||
<button>Buttons</button> | ||
<button>Can be</button> | ||
<button>Used</button> | ||
</tui-segmented> | ||
<hr /> | ||
<strong>Links</strong> | ||
<tui-segmented> | ||
<a | ||
routerLink="/components/link" | ||
routerLinkActive | ||
> | ||
Use routerLink | ||
</a> | ||
<a | ||
routerLink="/experimental/segmented" | ||
routerLinkActive | ||
[routerLinkActiveOptions]="options" | ||
> | ||
And routerLinkActive | ||
</a> | ||
<a | ||
fragment="content" | ||
routerLink="/experimental/segmented" | ||
routerLinkActive | ||
[routerLinkActiveOptions]="options" | ||
> | ||
To work with links | ||
</a> | ||
</tui-segmented> | ||
<hr /> | ||
<strong>Icons</strong> | ||
<tui-segmented> | ||
<button> | ||
<tui-icon icon="tuiIconSun"></tui-icon> | ||
</button> | ||
<button> | ||
<tui-icon icon="tuiIconMoon"></tui-icon> | ||
</button> | ||
</tui-segmented> | ||
<hr /> | ||
<strong>Control</strong> | ||
<tui-segmented> | ||
<label> | ||
<input | ||
name="radio" | ||
type="radio" | ||
value="a" | ||
[(ngModel)]="selected" | ||
/> | ||
Use radio inside | ||
</label> | ||
<label> | ||
<input | ||
name="radio" | ||
type="radio" | ||
value="b" | ||
[(ngModel)]="selected" | ||
/> | ||
It would be hidden | ||
</label> | ||
<label> | ||
<input | ||
name="radio" | ||
type="radio" | ||
value="c" | ||
[(ngModel)]="selected" | ||
/> | ||
Automatically | ||
</label> | ||
</tui-segmented> | ||
<button | ||
appearance="floating" | ||
size="s" | ||
tuiButton | ||
(click)="selected = 'b'" | ||
> | ||
Select second option | ||
</button> |
10 changes: 10 additions & 0 deletions
10
projects/demo/src/modules/experimental/segmented/examples/4/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,10 @@ | ||
:host { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
gap: 1rem; | ||
} | ||
|
||
hr { | ||
width: 100%; | ||
} |
Oops, something went wrong.