-
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): introduce new version of
InputNumber
- Loading branch information
1 parent
8feb7ed
commit 995b774
Showing
22 changed files
with
403 additions
and
19 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
17 changes: 17 additions & 0 deletions
17
projects/demo/src/modules/components/input-number/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,17 @@ | ||
<tui-textfield> | ||
<label tuiLabel>Enter a number</label> | ||
|
||
<input | ||
inputmode="decimal" | ||
tuiInputNumber | ||
[formControl]="control" | ||
/> | ||
</tui-textfield> | ||
|
||
<tui-error | ||
[error]="[] | tuiFieldError | async" | ||
[formControl]="control" | ||
/> | ||
|
||
<p><strong>Control value:</strong></p> | ||
<code>{{ control.value | json }}</code> |
38 changes: 38 additions & 0 deletions
38
projects/demo/src/modules/components/input-number/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,38 @@ | ||
import {AsyncPipe, JsonPipe} from '@angular/common'; | ||
import {Component} from '@angular/core'; | ||
import {FormControl, ReactiveFormsModule, Validators} from '@angular/forms'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {encapsulation} from '@demo/emulate/encapsulation'; | ||
import {TuiError, TuiTextfield} from '@taiga-ui/core'; | ||
import { | ||
TuiFieldErrorPipe, | ||
TuiInputNumber, | ||
tuiValidationErrorsProvider, | ||
} from '@taiga-ui/kit'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [ | ||
AsyncPipe, | ||
JsonPipe, | ||
ReactiveFormsModule, | ||
TuiError, | ||
TuiFieldErrorPipe, | ||
TuiInputNumber, | ||
TuiTextfield, | ||
], | ||
templateUrl: './index.html', | ||
encapsulation, | ||
changeDetection, | ||
providers: [ | ||
tuiValidationErrorsProvider({ | ||
required: 'Required field', | ||
}), | ||
], | ||
}) | ||
export default class Example { | ||
protected readonly control = new FormControl<number | null>( | ||
null, | ||
Validators.required, | ||
); | ||
} |
20 changes: 20 additions & 0 deletions
20
projects/demo/src/modules/components/input-number/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,20 @@ | ||
<tui-textfield | ||
iconStart="@tui.euro" | ||
tuiTextfieldSize="m" | ||
> | ||
<label tuiLabel>I am a label</label> | ||
|
||
<input | ||
inputmode="decimal" | ||
placeholder="I am placeholder" | ||
tuiInputNumber | ||
[(ngModel)]="value" | ||
/> | ||
|
||
<tui-icon | ||
icon="@tui.circle-alert" | ||
style="color: var(--tui-status-negative)" | ||
/> | ||
|
||
<tui-icon tuiTooltip="I am a hint" /> | ||
</tui-textfield> |
17 changes: 17 additions & 0 deletions
17
projects/demo/src/modules/components/input-number/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,17 @@ | ||
import {Component} from '@angular/core'; | ||
import {FormsModule} from '@angular/forms'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {encapsulation} from '@demo/emulate/encapsulation'; | ||
import {TuiIcon, TuiTextfield} from '@taiga-ui/core'; | ||
import {TuiInputNumber, TuiTooltip} from '@taiga-ui/kit'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [FormsModule, TuiIcon, TuiInputNumber, TuiTextfield, TuiTooltip], | ||
templateUrl: './index.html', | ||
encapsulation, | ||
changeDetection, | ||
}) | ||
export default class Example { | ||
protected value: number | null = null; | ||
} |
15 changes: 15 additions & 0 deletions
15
projects/demo/src/modules/components/input-number/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,15 @@ | ||
<tui-textfield> | ||
<label tuiLabel>Type number like a German</label> | ||
|
||
<input | ||
inputmode="decimal" | ||
tuiInputNumber | ||
[tuiNumberFormat]="numberFormat" | ||
[(ngModel)]="value" | ||
/> | ||
|
||
<tui-icon | ||
tuiHintDirection="right" | ||
tuiTooltip="In Germany people use comma as decimal separator and point for thousands" | ||
/> | ||
</tui-textfield> |
29 changes: 29 additions & 0 deletions
29
projects/demo/src/modules/components/input-number/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,29 @@ | ||
import {Component} from '@angular/core'; | ||
import {FormsModule} from '@angular/forms'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {encapsulation} from '@demo/emulate/encapsulation'; | ||
import type {TuiNumberFormatSettings} from '@taiga-ui/core'; | ||
import {TuiIcon, TuiNumberFormat, TuiTextfield} from '@taiga-ui/core'; | ||
import {TuiInputNumber, TuiTooltip} from '@taiga-ui/kit'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [ | ||
FormsModule, | ||
TuiIcon, | ||
TuiInputNumber, | ||
TuiNumberFormat, | ||
TuiTextfield, | ||
TuiTooltip, | ||
], | ||
templateUrl: './index.html', | ||
encapsulation, | ||
changeDetection, | ||
}) | ||
export default class Example { | ||
protected value: number | null = 1_234_567.89; | ||
protected numberFormat: Partial<TuiNumberFormatSettings> = { | ||
decimalSeparator: ',', | ||
thousandSeparator: '.', | ||
}; | ||
} |
11 changes: 11 additions & 0 deletions
11
projects/demo/src/modules/components/input-number/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,11 @@ | ||
<tui-textfield> | ||
<label tuiLabel>Price</label> | ||
|
||
<input | ||
inputmode="decimal" | ||
tuiInputNumber | ||
[min]="0" | ||
[prefix]="'USD' | tuiCurrency" | ||
[(ngModel)]="value" | ||
/> | ||
</tui-textfield> |
18 changes: 18 additions & 0 deletions
18
projects/demo/src/modules/components/input-number/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 {FormsModule} from '@angular/forms'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {encapsulation} from '@demo/emulate/encapsulation'; | ||
import {TuiCurrencyPipe} from '@taiga-ui/addon-commerce'; | ||
import {TuiTextfield} from '@taiga-ui/core'; | ||
import {TuiInputNumber} from '@taiga-ui/kit'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [FormsModule, TuiCurrencyPipe, TuiInputNumber, TuiTextfield], | ||
templateUrl: './index.html', | ||
encapsulation, | ||
changeDetection, | ||
}) | ||
export default class Example { | ||
protected value: number | null = null; | ||
} |
13 changes: 13 additions & 0 deletions
13
projects/demo/src/modules/components/input-number/examples/5/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-textfield> | ||
<label tuiLabel>Percentage</label> | ||
|
||
<input | ||
inputmode="decimal" | ||
postfix="%" | ||
tuiInputNumber | ||
[max]="100" | ||
[min]="0" | ||
[step]="1" | ||
[(ngModel)]="value" | ||
/> | ||
</tui-textfield> |
17 changes: 17 additions & 0 deletions
17
projects/demo/src/modules/components/input-number/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import {Component} from '@angular/core'; | ||
import {FormsModule} from '@angular/forms'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {encapsulation} from '@demo/emulate/encapsulation'; | ||
import {TuiTextfield} from '@taiga-ui/core'; | ||
import {TuiInputNumber} from '@taiga-ui/kit'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [FormsModule, TuiInputNumber, TuiTextfield], | ||
templateUrl: './index.html', | ||
encapsulation, | ||
changeDetection, | ||
}) | ||
export default class Example { | ||
protected value: number | null = null; | ||
} |
Oops, something went wrong.