-
Notifications
You must be signed in to change notification settings - Fork 477
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core):
Button
add padding customization (#2932)
- Loading branch information
Showing
19 changed files
with
253 additions
and
6 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
2 changes: 2 additions & 0 deletions
2
projects/demo/src/modules/components/button/examples/5/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
30 changes: 30 additions & 0 deletions
30
projects/demo/src/modules/components/button/examples/6/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,30 @@ | ||
<button | ||
tuiButton | ||
appearance="whiteblock-active" | ||
class="tui-space_right-4" | ||
> | ||
Padding | ||
</button> | ||
<button | ||
tuiButton | ||
size="m" | ||
appearance="whiteblock-active" | ||
class="tui-space_right-4" | ||
> | ||
Padding | ||
</button> | ||
<button | ||
tuiButton | ||
size="s" | ||
appearance="whiteblock-active" | ||
class="tui-space_right-4" | ||
> | ||
Padding | ||
</button> | ||
<button | ||
tuiButton | ||
size="xs" | ||
appearance="whiteblock-active" | ||
> | ||
Padding | ||
</button> |
15 changes: 15 additions & 0 deletions
15
projects/demo/src/modules/components/button/examples/6/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,15 @@ | ||
:host { | ||
--tui-padding: 1.25rem; | ||
} | ||
|
||
[tuiButton][data-size='m'] { | ||
--tui-padding: 1rem; | ||
} | ||
|
||
[tuiButton][data-size='s'] { | ||
--tui-padding: 0.75rem; | ||
} | ||
|
||
[tuiButton][data-size='xs'] { | ||
--tui-padding: 0.5rem; | ||
} |
12 changes: 12 additions & 0 deletions
12
projects/demo/src/modules/components/button/examples/6/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-button-example-6`, | ||
templateUrl: `./index.html`, | ||
styleUrls: [`./index.less`], | ||
changeDetection, | ||
encapsulation, | ||
}) | ||
export class TuiButtonExample6 {} |
33 changes: 33 additions & 0 deletions
33
projects/demo/src/modules/components/hosted-dropdown/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,33 @@ | ||
<form [formGroup]="form"> | ||
<tui-hosted-dropdown | ||
[content]="dropdown" | ||
[(open)]="open" | ||
> | ||
<button | ||
tuiButton | ||
[appearance]="appearance" | ||
[iconRight]="length ? cleaner : arrow" | ||
[style.--tui-padding.rem]="1.25" | ||
(keydown.delete)="form.reset()" | ||
> | ||
{{ text }} | ||
</button> | ||
<ng-template #dropdown> | ||
<tui-data-list-wrapper | ||
tuiMultiSelectGroup | ||
formControlName="control" | ||
[items]="items" | ||
></tui-data-list-wrapper> | ||
</ng-template> | ||
<ng-template #cleaner> | ||
<button | ||
tuiIconButton | ||
appearance="icon" | ||
size="xs" | ||
icon="tuiIconCloseLarge" | ||
type="reset" | ||
tuiPreventDefault="mousedown" | ||
></button> | ||
</ng-template> | ||
</tui-hosted-dropdown> | ||
</form> |
46 changes: 46 additions & 0 deletions
46
projects/demo/src/modules/components/hosted-dropdown/examples/4/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,46 @@ | ||
import {Component} from '@angular/core'; | ||
import {FormControl, FormGroup} from '@angular/forms'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {encapsulation} from '@demo/emulate/encapsulation'; | ||
import {TUI_ARROW} from '@taiga-ui/kit'; | ||
|
||
@Component({ | ||
selector: `tui-hosted-dropdown-example-4`, | ||
templateUrl: `./index.html`, | ||
changeDetection, | ||
encapsulation, | ||
}) | ||
export class TuiHostedDropdownExample4 { | ||
readonly form = new FormGroup({ | ||
control: new FormControl([]), | ||
}); | ||
|
||
open = false; | ||
|
||
readonly items = [`Drafts`, `In Progress`, `Completed`]; | ||
|
||
readonly arrow = TUI_ARROW; | ||
|
||
private get value(): readonly string[] { | ||
return this.form.get(`control`)?.value || []; | ||
} | ||
|
||
get appearance(): string { | ||
return this.length ? `whiteblock-active` : `whiteblock`; | ||
} | ||
|
||
get length(): number { | ||
return this.value.length || 0; | ||
} | ||
|
||
get text(): string { | ||
switch (this.length) { | ||
case 0: | ||
return `Select`; | ||
case 1: | ||
return this.value[0]; | ||
default: | ||
return `${this.length} selected`; | ||
} | ||
} | ||
} |
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
24 changes: 24 additions & 0 deletions
24
projects/demo/src/modules/components/radio-block/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,24 @@ | ||
<form | ||
tuiGroup | ||
[collapsed]="true" | ||
[formGroup]="form" | ||
> | ||
<tui-radio-block | ||
*ngFor="let item of items" | ||
formControlName="control" | ||
class="control" | ||
[item]="item" | ||
[hideRadio]="true" | ||
> | ||
{{ item }} | ||
<button | ||
tuiIconButton | ||
appearance="icon" | ||
size="xs" | ||
icon="tuiIconCloseLarge" | ||
type="reset" | ||
class="button" | ||
></button> | ||
</tui-radio-block> | ||
</form> | ||
<pre>{{ form.value | json }}</pre> |
11 changes: 11 additions & 0 deletions
11
projects/demo/src/modules/components/radio-block/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,11 @@ | ||
.control { | ||
flex: initial; | ||
|
||
&._active .button { | ||
display: inline-block; | ||
} | ||
} | ||
|
||
.button { | ||
display: none; | ||
} |
18 changes: 18 additions & 0 deletions
18
projects/demo/src/modules/components/radio-block/examples/4/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,18 @@ | ||
import {Component} from '@angular/core'; | ||
import {FormControl, FormGroup} from '@angular/forms'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {encapsulation} from '@demo/emulate/encapsulation'; | ||
|
||
@Component({ | ||
selector: `tui-radio-block-example-4`, | ||
templateUrl: `./index.html`, | ||
styleUrls: [`./index.less`], | ||
changeDetection, | ||
encapsulation, | ||
}) | ||
export class TuiRadioBlockExample4 { | ||
readonly items = [`Kiwi`, `Orange`, `Apple`]; | ||
readonly form = new FormGroup({ | ||
control: new FormControl(this.items[1]), | ||
}); | ||
} |
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
Oops, something went wrong.