Skip to content

Commit

Permalink
chore(demo): use new version of InputNumber for all documentation e…
Browse files Browse the repository at this point in the history
…xamples (#10280)
  • Loading branch information
nsbarsukov authored Jan 29, 2025
1 parent ede4715 commit eac19f7
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 76 deletions.
39 changes: 25 additions & 14 deletions projects/demo/src/modules/components/form/examples/2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ <h3 tuiTitle>
</h3>
</header>

<tui-input
formControlName="nameValue"
tuiHintContent="A tooltip"
>
Textfield
<tui-textfield>
<label tuiLabel>Textfield</label>
<input
formControlName="nameValue"
placeholder="Field placeholder"
tuiTextfieldLegacy
tuiTextfield
/>
</tui-input>
<tui-icon tuiTooltip="A tooltip" />
</tui-textfield>

<tui-error
formControlName="nameValue"
[error]="[] | tuiFieldError | async"
Expand All @@ -72,19 +72,30 @@ <h3 tuiTitle>

<div class="grid">
<div class="stack">
<tui-input-password formControlName="passwordValue">Input password</tui-input-password>
<tui-textfield>
<label tuiLabel>Input password</label>
<input
formControlName="passwordValue"
tuiTextfield
type="password"
/>
<tui-icon tuiPassword />
</tui-textfield>

<tui-error
formControlName="passwordValue"
[error]="[] | tuiFieldError | async"
/>
</div>
<div class="stack">
<tui-input-number
formControlName="moneyValue"
[tuiTextfieldPostfix]="'RUB' | tuiCurrency"
>
Input money
</tui-input-number>
<tui-textfield>
<label tuiLabel>Input money</label>
<input
formControlName="moneyValue"
tuiInputNumber
[postfix]="' ' + 'RUB' | tuiCurrency"
/>
</tui-textfield>
<tui-error
formControlName="moneyValue"
[error]="[] | tuiFieldError | async"
Expand Down
17 changes: 9 additions & 8 deletions projects/demo/src/modules/components/form/examples/2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import {AsyncPipe} from '@angular/common';
import {Component} from '@angular/core';
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms';
import {changeDetection} from '@demo/emulate/change-detection';
import {TuiAmountPipe, TuiCurrency, TuiCurrencyPipe} from '@taiga-ui/addon-commerce';
import {TuiCurrency, TuiCurrencyPipe} from '@taiga-ui/addon-commerce';
import {TuiDay, TuiTime} from '@taiga-ui/cdk';
import {
TuiAppearance,
TuiButton,
TuiError,
TuiGroup,
TuiIcon,
TuiLabel,
TuiTextfield,
TuiTitle,
Expand All @@ -18,15 +18,16 @@ import {
TuiCheckbox,
TuiDataListWrapper,
TuiFieldErrorPipe,
TuiInputNumber,
TuiPassword,
TuiRadio,
TuiStepper,
TuiTooltip,
} from '@taiga-ui/kit';
import {TuiForm, TuiHeader} from '@taiga-ui/layout';
import {
TuiInputDateModule,
TuiInputModule,
TuiInputNumberModule,
TuiInputPasswordModule,
TuiInputPhoneModule,
TuiInputSliderModule,
TuiInputTimeModule,
Expand Down Expand Up @@ -60,8 +61,6 @@ class Account {
imports: [
AsyncPipe,
ReactiveFormsModule,
TuiAmountPipe,
TuiAppearance,
TuiBlock,
TuiButton,
TuiCheckbox,
Expand All @@ -72,20 +71,22 @@ class Account {
TuiForm,
TuiGroup,
TuiHeader,
TuiIcon,
TuiInputDateModule,
TuiInputModule,
TuiInputNumberModule,
TuiInputPasswordModule,
TuiInputNumber,
TuiInputPhoneModule,
TuiInputSliderModule,
TuiInputTimeModule,
TuiLabel,
TuiPassword,
TuiRadio,
TuiSelectModule,
TuiStepper,
TuiTextfield,
TuiTextfieldControllerModule,
TuiTitle,
TuiTooltip,
],
templateUrl: './index.html',
styleUrls: ['./index.less'],
Expand Down
29 changes: 16 additions & 13 deletions projects/demo/src/modules/components/table/examples/4/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@
tuiTextfieldSize="m"
class="filters"
>
<tui-input
class="input"
[tuiTextfieldCleaner]="true"
[(ngModel)]="search"
>
Find on page
</tui-input>
<tui-input-number
[formControl]="minAge"
[tuiNumberFormat]="{precision: 0}"
>
Minimum age
</tui-input-number>
<tui-textfield class="input">
<label tuiLabel>Find on page</label>
<input
tuiTextfield
[(ngModel)]="search"
/>
</tui-textfield>

<tui-textfield>
<label tuiLabel>Minimum age</label>
<input
tuiInputNumber
[formControl]="minAge"
[tuiNumberFormat]="{precision: 0}"
/>
</tui-textfield>
</p>
<p class="filters">
<label tuiLabel>
Expand Down
13 changes: 4 additions & 9 deletions projects/demo/src/modules/components/table/examples/4/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,9 @@ import {
TuiLabel,
TuiLoader,
TuiNumberFormat,
TuiTextfield,
} from '@taiga-ui/core';
import {TuiCheckbox, TuiChevron} from '@taiga-ui/kit';
import {
TuiInputModule,
TuiInputNumberModule,
TuiTextfieldControllerModule,
} from '@taiga-ui/legacy';
import {TuiCheckbox, TuiChevron, TuiInputNumber} from '@taiga-ui/kit';
import type {Observable} from 'rxjs';
import {
BehaviorSubject,
Expand Down Expand Up @@ -118,16 +114,15 @@ function getAge({dob}: User): number {
TuiCheckbox,
TuiChevron,
TuiDropdown,
TuiInputModule,
TuiInputNumberModule,
TuiInputNumber,
TuiLabel,
TuiLet,
TuiLoader,
TuiNumberFormat,
TuiReorder,
TuiTable,
TuiTablePagination,
TuiTextfieldControllerModule,
TuiTextfield,
],
templateUrl: './index.html',
styleUrls: ['./index.less'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
```html
<tui-input-number
[tuiNumberFormat]="{decimal, precision, zeroPadding, rounding, thousandSeparator, decimalSeparator}"
></tui-input-number>
<tui-textfield>
<input
tuiInputNumber
[tuiNumberFormat]="{decimal, precision, zeroPadding, rounding, thousandSeparator, decimalSeparator}"
/>
</tui-textfield>
```
49 changes: 28 additions & 21 deletions projects/demo/src/modules/pipes/field-error/examples/2/index.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
<form [formGroup]="testForm">
<form
tuiTextfieldSize="m"
[formGroup]="testForm"
>
<label
tuiLabel
class="tui-space_bottom-4"
>
Enter an email
<tui-input
formControlName="testValue2"
tuiTextfieldSize="m"
[tuiTextfieldLabelOutside]="true"
>
Required
</tui-input>

<tui-textfield>
<input
formControlName="testValue2"
placeholder="Required"
tuiTextfield
/>
</tui-textfield>

<tui-error
formControlName="testValue2"
Expand All @@ -23,12 +27,13 @@
class="tui-space_bottom-4"
>
Minimum and maximum length
<tui-input
formControlName="testValue1"
tuiTextfieldSize="m"
>
4 letters word...
</tui-input>
<tui-textfield>
<label tuiLabel>4 letters word...</label>
<input
formControlName="testValue1"
tuiTextfield
/>
</tui-textfield>

<tui-error
formControlName="testValue1"
Expand All @@ -38,13 +43,15 @@

<label tuiLabel>
Minimum number
<tui-input-number
formControlName="testValue3"
tuiTextfieldSize="m"
[step]="1"
>
number
</tui-input-number>
<tui-textfield>
<label tuiLabel>number</label>

<input
formControlName="testValue3"
tuiInputNumber
[step]="1"
/>
</tui-textfield>

<tui-error
formControlName="testValue3"
Expand Down
13 changes: 5 additions & 8 deletions projects/demo/src/modules/pipes/field-error/examples/2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {tuiIsFalsy} from '@taiga-ui/cdk';
import {TuiError, TuiTextfield} from '@taiga-ui/core';
import {TuiFieldErrorPipe, tuiValidationErrorsProvider} from '@taiga-ui/kit';
import {
TuiInputModule,
TuiInputNumberModule,
TuiTextfieldControllerModule,
} from '@taiga-ui/legacy';
TuiFieldErrorPipe,
TuiInputNumber,
tuiValidationErrorsProvider,
} from '@taiga-ui/kit';
import {interval, map, of, scan, startWith} from 'rxjs';

@Component({
Expand All @@ -20,10 +19,8 @@ import {interval, map, of, scan, startWith} from 'rxjs';
ReactiveFormsModule,
TuiError,
TuiFieldErrorPipe,
TuiInputModule,
TuiInputNumberModule,
TuiInputNumber,
TuiTextfield,
TuiTextfieldControllerModule,
],
templateUrl: './index.html',
encapsulation,
Expand Down

0 comments on commit eac19f7

Please sign in to comment.