FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat(form): Add validated variant to form inputs by jeff-phillips-18 · Pull Request #3220 · patternfly/patternfly-react · GitHub

feat(form): Add validated variant to form inputs - #3220

Merged
dlabaj merged 7 commits into
patternfly:masterfrom
jeff-phillips-18:validated-input
Nov 19, 2019
Merged

feat(form): Add validated variant to form inputs#3220
dlabaj merged 7 commits into
patternfly:masterfrom
jeff-phillips-18:validated-input

Conversation

jeff-phillips-18 commented Oct 28, 2019
edited by tlabaj
Loading

Copy link
Copy Markdown
Member

What:
Add validated variant to form inputs

Additional issues:
React follow on to: patternfly/patternfly#2338

closes #3091

codecov-io commented Oct 28, 2019
edited
Loading

Copy link
Copy Markdown

Codecov Report

Merging #3220 into master will increase coverage by 0.02%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #3220      +/-   ##
==========================================
+ Coverage   67.44%   67.46%   +0.02%     
==========================================
  Files         892      892              
  Lines       24872    24906      +34     
  Branches     2142     2151       +9     
==========================================
+ Hits        16774    16804      +30     
- Misses       7093     7097       +4     
  Partials     1005     1005
Flag Coverage Δ
#misc 95.45% <ø> (ø) ⬆️
#patternfly3 69.3% <ø> (ø) ⬆️
#patternfly4 64.84% <100%> (+0.06%) ⬆️
Impacted Files Coverage Δ
...-4/react-core/src/components/TextArea/TextArea.tsx 96% <100%> (+0.54%) ⬆️
...s/patternfly-4/react-core/src/helpers/constants.ts 100% <100%> (ø) ⬆️
.../react-core/src/components/TextInput/TextInput.tsx 95.12% <100%> (+2.26%) ⬆️
...fly-4/react-core/src/components/Form/FormGroup.tsx 93.54% <100%> (+1.54%) ⬆️
...eact-core/src/components/FormSelect/FormSelect.tsx 85% <100%> (+2.64%) ⬆️
.../patternfly-react/src/components/Form/FormGroup.js 43.18% <0%> (-2.98%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 377ac47...3762929. Read the comment docs.

Copy link
Copy Markdown
Collaborator

PatternFly-React preview: https://patternfly-react-pr-3220.surge.sh

1 similar comment

Copy link
Copy Markdown
Collaborator

PatternFly-React preview: https://patternfly-react-pr-3220.surge.sh

rebeccaalpert previously approved these changes Oct 28, 2019

rebeccaalpert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks good to me.

tlabaj commented Oct 28, 2019

Copy link
Copy Markdown
Contributor

We should add new props to demo app to verify them in integration environment.

/** Sets the FormGroup isValid. */
isValid?: boolean;
/** Sets the FormGroup validated. */
validated?: boolean;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

should we call this isValidated to match our other boolean modifier props?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I was looking at this again. I think having the 2 props isValid and validated may be a little confusing. I know to make them one prop would be a breaking change. Could we maybe make validated into an enum? If the enum is used, isValid can be ignored. We can then deprecate isValid when we have a breaking change release.
ValidatedOptions { success = 'success', error = 'error', default = 'default' }
the modifiers would be applied if not default validated !== ValidatedOptions.default

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@tlabaj is this something that could be done all together for the next breaking change release? That is, leave it this way for now and change both isValid and validated to an enum value as a follow-on?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

It could. I just worry that the two props could be confusing. I wonder if we should at least make the comments more clear as to what the prop actually does. To me isValid could implies that it was validated and it might not be clear you need to also apply validated.

/** Flag to show if the TextArea is valid or invalid. */
isValid?: boolean;
/** Flag to show if the TextArea has been validated. */
validated?: boolean;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

same question as above.

mcoker commented Oct 28, 2019

Copy link
Copy Markdown
Contributor

In the <FormSelect> example, if you choose an invalid option, then choose the valid option before the validation finishes, you'll end up with this:

And I don't see a validated example for <TextInput>, even though validated works fine.

Copy link
Copy Markdown
Collaborator

PatternFly-React preview: https://patternfly-react-pr-3220.surge.sh

1 similar comment

Copy link
Copy Markdown
Collaborator

PatternFly-React preview: https://patternfly-react-pr-3220.surge.sh

/** Sets the FormGroup isValid. This prop will be deprecated you should use validated instead. */
isValid?: boolean;
/** Sets the FormGroup validated. */
validated?: 'success' | 'error' | 'default';

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Maybe some explanation that success is going to add the treatments (typically not wanted).

Copy link
Copy Markdown
Collaborator

PatternFly-React preview: https://patternfly-react-pr-3220.surge.sh

/** Sets the FormGroup required. */
isRequired?: boolean;
/** Sets the FormGroup isValid. */
/** Sets the FormGroup isValid. This prop will be deprecated you should use validated instead. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
/** Sets the FormGroup isValid. This prop will be deprecated you should use validated instead. */
/** Sets the FormGroup isValid. This prop will be deprecated. You should use validated instead. */

/** value of selected option */
value?: any;
/** Flag indicating selection is valid */
/** Flag indicating selection is valid. This prop will be deprecated you should use validated instead. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
/** Flag indicating selection is valid. This prop will be deprecated you should use validated instead. */
/** Flag indicating selection is valid. This prop will be deprecated. You should use validated instead. */

/** Flag to show if the TextArea is required. */
isRequired?: boolean;
/** Flag to show if the TextArea is valid or invalid. */
/** Flag to show if the TextArea is valid or invalid. This prop will be deprecated you should use validated instead. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
/** Flag to show if the TextArea is valid or invalid. This prop will be deprecated you should use validated instead. */
/** Flag to show if the TextArea is valid or invalid. This prop will be deprecated. You should use validated instead. */

* If set to success, input will be modified to indicate valid state. If set to success, input will be modified to indicate valid state.
* If set to error, text color of helper text will be modified to indicate error state.
*/
validated?: 'success' | 'error' | 'default' | ValidatedOptions;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

What is ValidatedOptions? It isn't in the docs for TextInput or Select.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nice catch!

/** Flag to show if the TextArea is valid or invalid. This prop will be deprecated you should use validated instead. */
isValid?: boolean;
/** Value to indicate if the input is modified to show that validation state.
* If set to success, input will be modified to indicate valid state. If set to success, input will be modified to indicate valid state.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
* If set to success, input will be modified to indicate valid state. If set to success, input will be modified to indicate valid state.
* If set to success, textarea will be modified to indicate valid state.

isValid?: boolean;
/** Value to indicate if the input is modified to show that validation state.
* If set to success, input will be modified to indicate valid state. If set to success, input will be modified to indicate valid state.
* If set to error, text color of helper text will be modified to indicate error state.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
* If set to error, text color of helper text will be modified to indicate error state.
* If set to error, textarea will be modified to indicate error state.

mcoker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks good, functions as I would expect. Left some comments about the docs.

dlabaj requested review from christiemolloy and removed request for christiemolloy November 18, 2019 20:56
dlabaj previously approved these changes Nov 18, 2019

Copy link
Copy Markdown
Collaborator

PatternFly-React preview: https://patternfly-react-pr-3220.surge.sh

Copy link
Copy Markdown
Collaborator

PatternFly-React preview: https://patternfly-react-pr-3220.surge.sh

/** Flag to show if the input is required. */
isRequired?: boolean;
/** Flag to show if the input is valid or invalid. */
/** Flag to show if the input is valid or invalid. This prop will be deprecated you should use validated instead. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
/** Flag to show if the input is valid or invalid. This prop will be deprecated you should use validated instead. */
/** Flag to show if the input is valid or invalid. This prop will be deprecated. You should use validated instead. */

/** Flag indicating selection is valid */
/** Flag indicating selection is valid. This prop will be deprecated. You should use validated instead. */
isValid?: boolean;
/* Value to indicate if the input is modified to shoe that validation state.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
/* Value to indicate if the input is modified to shoe that validation state.
/* Value to indicate if the select is modified to show that validation state.

/** Flag indicating selection is valid. This prop will be deprecated. You should use validated instead. */
isValid?: boolean;
/* Value to indicate if the input is modified to shoe that validation state.
* If set to success, input will be modified to indicate valid state. If set to success, input will be modified to indicate valid state.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
* If set to success, input will be modified to indicate valid state. If set to success, input will be modified to indicate valid state.
* If set to success, select will be modified to indicate valid state.

isValid?: boolean;
/* Value to indicate if the input is modified to shoe that validation state.
* If set to success, input will be modified to indicate valid state. If set to success, input will be modified to indicate valid state.
* If set to error, text color of helper text will be modified to indicate error state.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
* If set to error, text color of helper text will be modified to indicate error state.
* If set to error, select will be modified to indicate error state.

/** Flag to show if the TextArea is valid or invalid. */
/** Flag to show if the TextArea is valid or invalid. This prop will be deprecated. You should use validated instead. */
isValid?: boolean;
/** Value to indicate if the input is modified to show that validation state.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
/** Value to indicate if the input is modified to show that validation state.
/** Value to indicate if the textarea is modified to show that validation state.

/** Flag to show if the input is valid or invalid. */
/** Flag to show if the input is valid or invalid. This prop will be deprecated. You should use validated instead. */
isValid?: boolean;
/* Value to indicate if the selection is modified to shoe that validation state.

mcoker Nov 19, 2019
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
/* Value to indicate if the selection is modified to shoe that validation state.
/* Value to indicate if the input is modified to show that validation state.

/** Flag to show if the input is valid or invalid. This prop will be deprecated. You should use validated instead. */
isValid?: boolean;
/* Value to indicate if the selection is modified to shoe that validation state.
* If set to success, input will be modified to indicate valid state. If set to success, input will be modified to indicate valid state.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
* If set to success, input will be modified to indicate valid state. If set to success, input will be modified to indicate valid state.
* If set to success, input will be modified to indicate valid state.

isValid?: boolean;
/* Value to indicate if the selection is modified to shoe that validation state.
* If set to success, input will be modified to indicate valid state. If set to success, input will be modified to indicate valid state.
* If set to error, text color of helper text will be modified to indicate error state.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
* If set to error, text color of helper text will be modified to indicate error state.
* If set to success, input will be modified to indicate valid state.

mcoker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

⭐️LGTM! ⭐️

Copy link
Copy Markdown
Collaborator

PatternFly-React preview: https://patternfly-react-pr-3220.surge.sh

1 similar comment

Copy link
Copy Markdown
Collaborator

PatternFly-React preview: https://patternfly-react-pr-3220.surge.sh

dlabaj merged commit 52b17e9 into patternfly:master Nov 19, 2019
jeff-phillips-18 deleted the validated-input branch November 11, 2021 14:02
This file contains hidden or 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validated text input

7 participants


Back | FazBrowse Home | New Git URL