-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(kit):
InputPassword
add new version, deprecate legacy (#8786)
Co-authored-by: taiga-family-bot <taiga-family-bot@users.noreply.github.com>
- Loading branch information
1 parent
464dee4
commit 7a655de
Showing
19 changed files
with
200 additions
and
170 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
63 changes: 29 additions & 34 deletions
63
projects/demo/src/modules/components/input-password/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 |
---|---|---|
@@ -1,34 +1,29 @@ | ||
<form [formGroup]="testForm"> | ||
<tui-input-password | ||
formControlName="testValue" | ||
tuiTextfieldSize="s" | ||
> | ||
Type a password | ||
<input | ||
placeholder="Make it secure!" | ||
tuiTextfieldLegacy | ||
/> | ||
</tui-input-password> | ||
<tui-input-password | ||
formControlName="testValue" | ||
tuiTextfieldSize="m" | ||
class="tui-space_top-2" | ||
[tuiTextfieldLabelOutside]="true" | ||
> | ||
Type a password | ||
<input | ||
placeholder="Make it secure!" | ||
tuiTextfieldLegacy | ||
/> | ||
</tui-input-password> | ||
<tui-input-password | ||
formControlName="testValue" | ||
class="tui-space_top-2" | ||
> | ||
Type a password | ||
<input | ||
placeholder="Make it secure!" | ||
tuiTextfieldLegacy | ||
/> | ||
</tui-input-password> | ||
</form> | ||
<tui-textfield | ||
#textfield | ||
tuiTextfieldSize="s" | ||
> | ||
<input | ||
tuiInputPassword | ||
[placeholder]="textfield.focused() ? 'Make it secure!' : 'Type a password'" | ||
[(ngModel)]="password" | ||
/> | ||
</tui-textfield> | ||
<tui-textfield | ||
tuiTextfieldSize="m" | ||
class="tui-space_vertical-4" | ||
> | ||
<label tuiLabel>Type a password</label> | ||
<input | ||
placeholder="Make it secure!" | ||
tuiInputPassword | ||
[(ngModel)]="password" | ||
/> | ||
</tui-textfield> | ||
<tui-textfield> | ||
<label tuiLabel>Type a password</label> | ||
<input | ||
placeholder="Make it secure!" | ||
tuiInputPassword | ||
[(ngModel)]="password" | ||
/> | ||
</tui-textfield> |
11 changes: 5 additions & 6 deletions
11
projects/demo/src/modules/components/input-password/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 |
---|---|---|
@@ -1,18 +1,17 @@ | ||
import {Component} from '@angular/core'; | ||
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms'; | ||
import {FormsModule} from '@angular/forms'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {encapsulation} from '@demo/emulate/encapsulation'; | ||
import {TuiInputPasswordModule, TuiTextfieldControllerModule} from '@taiga-ui/legacy'; | ||
import {TuiTextfield} from '@taiga-ui/core'; | ||
import {TuiInputPassword} from '@taiga-ui/kit'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [ReactiveFormsModule, TuiInputPasswordModule, TuiTextfieldControllerModule], | ||
imports: [FormsModule, TuiInputPassword, TuiTextfield], | ||
templateUrl: './index.html', | ||
encapsulation, | ||
changeDetection, | ||
}) | ||
export default class Example { | ||
protected testForm = new FormGroup({ | ||
testValue: new FormControl('password', Validators.required), | ||
}); | ||
protected password = ''; | ||
} |
15 changes: 7 additions & 8 deletions
15
projects/demo/src/modules/components/input-password/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 |
---|---|---|
@@ -1,10 +1,9 @@ | ||
<form [formGroup]="testForm"> | ||
<tui-input-password | ||
formControlName="testValue" | ||
tuiHintAppearance="dark" | ||
tuiHintContent | ||
tuiHintDirection="right" | ||
> | ||
Type a password | ||
</tui-input-password> | ||
<tui-textfield> | ||
<label tuiLabel>Type a password</label> | ||
<input | ||
formControlName="testValue" | ||
tuiInputPassword | ||
/> | ||
</tui-textfield> | ||
</form> |
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
23 changes: 5 additions & 18 deletions
23
projects/demo/src/modules/components/input-password/examples/import/import.md
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,33 +1,20 @@ | ||
```ts | ||
import {FormsModule, ReactiveFormsModule} from '@angular/forms'; | ||
import {TuiInputPasswordModule} from '@taiga-ui/legacy'; | ||
import {ReactiveFormsModule} from '@angular/forms'; | ||
import {TuiInputPassword} from '@taiga-ui/kit'; | ||
|
||
// ... | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [ | ||
// ... | ||
FormsModule, | ||
ReactiveFormsModule, | ||
TuiInputPasswordModule, | ||
], | ||
providers: [ | ||
{ | ||
provide: TUI_INPUT_PASSWORD_OPTIONS, | ||
useValue: { | ||
...TUI_INPUT_PASSWORD_DEFAULT_OPTIONS, | ||
icons: { | ||
hide: '@tui.eye-off', | ||
show: '@tui.eye', | ||
}, | ||
}, | ||
}, | ||
TuiInputPassword, | ||
], | ||
}) | ||
export class Example { | ||
testForm = new FormGroup({ | ||
testValue: new FormControl(''), | ||
readonly form = new FormGroup({ | ||
value: new FormControl(''), | ||
}); | ||
} | ||
``` |
10 changes: 8 additions & 2 deletions
10
projects/demo/src/modules/components/input-password/examples/import/template.md
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,5 +1,11 @@ | ||
```html | ||
<form [formGroup]="testForm"> | ||
<tui-input-password formControlName="testValue">Type a password</tui-input-password> | ||
<form [formGroup]="form"> | ||
<tui-textfield> | ||
<label tuiLabel>Type a password</label> | ||
<input | ||
formControlName="value" | ||
tuiInputPassword | ||
/> | ||
</tui-textfield> | ||
</form> | ||
``` |
77 changes: 7 additions & 70 deletions
77
projects/demo/src/modules/components/input-password/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 |
---|---|---|
@@ -1,80 +1,17 @@ | ||
<tui-doc-page | ||
header="InputPassword" | ||
package="LEGACY" | ||
package="KIT" | ||
type="components" | ||
> | ||
<ng-template pageTab> | ||
<tui-doc-example | ||
id="sizes" | ||
heading="sizes" | ||
[component]="1 | tuiComponent" | ||
[content]="1 | tuiExample: 'html,ts'" | ||
> | ||
<tui-notification class="tui-space_bottom-4"> | ||
<div> | ||
If you need to set some attributes or listen to events on native | ||
<code>input</code> | ||
, you can put it inside with | ||
<code>Textfield</code> | ||
directive as shown below | ||
</div> | ||
</tui-notification> | ||
</tui-doc-example> | ||
<tui-doc-example | ||
id="options" | ||
heading="options" | ||
[component]="2 | tuiComponent" | ||
[content]="2 | tuiExample: 'html,ts'" | ||
*ngFor="let example of examples; let index = index" | ||
[component]="index + 1 | tuiComponent" | ||
[content]="index + 1 | tuiExample: 'html,ts'" | ||
[heading]="example" | ||
[id]="example | tuiKebab" | ||
/> | ||
</ng-template> | ||
|
||
<ng-template pageTab> | ||
<tui-doc-demo [control]="control"> | ||
<ng-template> | ||
<tui-input-password | ||
[focusable]="focusable" | ||
[formControl]="control" | ||
[pseudoFocus]="pseudoFocused" | ||
[pseudoHover]="pseudoHovered" | ||
[pseudoInvalid]="pseudoInvalid" | ||
[readOnly]="readOnly" | ||
[style.text-align]="textAlign" | ||
[tuiHintAppearance]="hintAppearance" | ||
[tuiHintContent]="hintContent" | ||
[tuiHintDirection]="hintDirection" | ||
[tuiTextfieldCleaner]="cleaner" | ||
[tuiTextfieldIconLeft]="iconStart" | ||
[tuiTextfieldLabelOutside]="labelOutside" | ||
[tuiTextfieldSize]="size" | ||
> | ||
Type a password | ||
</tui-input-password> | ||
</ng-template> | ||
</tui-doc-demo> | ||
<tui-doc-documentation> | ||
<ng-template | ||
documentationPropertyName="disabled" | ||
documentationPropertyType="boolean" | ||
[(documentationPropertyValue)]="disabled" | ||
> | ||
Disabled state (use | ||
<code>formControl.disable()</code> | ||
) | ||
</ng-template> | ||
</tui-doc-documentation> | ||
<inherited-documentation /> | ||
<tui-doc-documentation heading="CSS customization"> | ||
<ng-template | ||
documentationPropertyMode="input" | ||
documentationPropertyName="style.text-align" | ||
documentationPropertyType="string" | ||
[documentationPropertyValues]="textAlignVariants" | ||
[(documentationPropertyValue)]="textAlign" | ||
> | ||
Custom align content by text-align | ||
</ng-template> | ||
</tui-doc-documentation> | ||
</ng-template> | ||
|
||
<tui-setup *pageTab /> | ||
<tui-setup *pageTab="'Setup'" /> | ||
</tui-doc-page> |
26 changes: 3 additions & 23 deletions
26
projects/demo/src/modules/components/input-password/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 |
---|---|---|
@@ -1,33 +1,13 @@ | ||
import {Component} from '@angular/core'; | ||
import {FormControl, ReactiveFormsModule, Validators} from '@angular/forms'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {TuiDemo} from '@demo/utils'; | ||
import {tuiProvide} from '@taiga-ui/cdk'; | ||
import {TuiHint} from '@taiga-ui/core'; | ||
import {TuiInputPasswordModule, TuiTextfieldControllerModule} from '@taiga-ui/legacy'; | ||
|
||
import {ABSTRACT_PROPS_ACCESSOR} from '../abstract/abstract-props-accessor'; | ||
import {AbstractExampleTuiControl} from '../abstract/control'; | ||
import {InheritedDocumentation} from '../abstract/inherited-documentation'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [ | ||
TuiDemo, | ||
TuiInputPasswordModule, | ||
ReactiveFormsModule, | ||
TuiHint, | ||
TuiTextfieldControllerModule, | ||
InheritedDocumentation, | ||
], | ||
imports: [TuiDemo], | ||
templateUrl: './index.html', | ||
changeDetection, | ||
providers: [tuiProvide(ABSTRACT_PROPS_ACCESSOR, PageComponent)], | ||
}) | ||
export default class PageComponent extends AbstractExampleTuiControl { | ||
public override readonly maxLengthVariants: readonly number[] = [10]; | ||
|
||
public override maxLength = null; | ||
|
||
public control = new FormControl('', Validators.required); | ||
export default class PageComponent { | ||
protected readonly examples = ['Sizes', 'Options']; | ||
} |
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 './input-password.component'; | ||
export * from './input-password.options'; |
Oops, something went wrong.