Migrate change-password form to HDS input fields. (#1460)

* refactor: 💡 update scope form to use HDS input and textarea

* chore: 🤖 tweak "optional" label text color in dark mode

* fix: 🐛 add HDS field margins and fix form tests

* fix: 🐛 fix acceptance tests and add TextInput event handlers

* refactor: 💡 migrate change-password form to HDS inputs

* fix: 🐛 use input event and fix set-from-event to handle empty

* chore: 🤖 reverse order of isRequired and isOptional

* fix: 🐛 use @type as required by HDS

* chore: 🤖 fix linting
This commit is contained in:
Randall Morey authored and GitHub committed 2022-11-15 09:34:25 -08:00
1 parent b08d3affe4
commit aae85c44d2
2 files changed
+26 -36

No files matched your search

@@ -6,43 +6,33 @@
as |form| as |form|
> >
<form.input <Hds::Form::TextInput::Field
@name='currentPassword' @isRequired={{true}}
@type='password' @isOptional={{false}}
@value={{this.currentPassword}} @value={{this.currentPassword}}
@label={{t 'form.current_password.label'}}
@error={{@model.errors.name}}
readonly={{false}}
autocomplete='current-password'
as |field|
>
{{#if @model.errors.name}}
<field.errors as |errors|>
{{#each @model.errors.name as |error|}}
<errors.message>{{error.message}}</errors.message>
{{/each}}
</field.errors>
{{/if}}
</form.input>
<form.input
@name='newPassword'
@type='password' @type='password'
@value={{this.newPassword}} name='currentPassword'
@label={{t 'form.new_password.label'}} autocomplete='current-password'
@error={{@model.errors.name}} disabled={{form.disabled}}
readonly={{false}} {{on 'input' (set-from-event this 'currentPassword')}}
autocomplete='new-password' as |F|
as |field|
> >
{{#if @model.errors.name}} <F.Label>{{t 'form.current_password.label'}}</F.Label>
<field.errors as |errors|> </Hds::Form::TextInput::Field>
{{#each @model.errors.name as |error|}}
<errors.message>{{error.message}}</errors.message> <Hds::Form::TextInput::Field
{{/each}} @isRequired={{true}}
</field.errors> @isOptional={{false}}
{{/if}} @value={{this.newPassword}}
</form.input> @type='password'
name='newPassword'
autocomplete='new-password'
disabled={{form.disabled}}
{{on 'input' (set-from-event this 'newPassword')}}
as |F|
>
<F.Label>{{t 'form.new_password.label'}}</F.Label>
</Hds::Form::TextInput::Field>
<form.actions <form.actions
@submitDisabled={{this.cannotSave}} @submitDisabled={{this.cannotSave}}
+2 -2
View File
@@ -7,8 +7,8 @@
> >
<Hds::Form::TextInput::Field <Hds::Form::TextInput::Field
@isOptional={{true}}
@isRequired={{false}} @isRequired={{false}}
@isOptional={{true}}
@value={{@model.name}} @value={{@model.name}}
@isInvalid={{@model.errors.name}} @isInvalid={{@model.errors.name}}
@type='text' @type='text'
@@ -29,8 +29,8 @@
</Hds::Form::TextInput::Field> </Hds::Form::TextInput::Field>
<Hds::Form::Textarea::Field <Hds::Form::Textarea::Field
@isOptional={{true}}
@isRequired={{false}} @isRequired={{false}}
@isOptional={{true}}
@value={{@model.description}} @value={{@model.description}}
@isInvalid={{@model.errors.description}} @isInvalid={{@model.errors.description}}
name='description' name='description'