Skip to content

Conversation

@thatblindgeye
Copy link
Contributor

What: Closes #10720

Additional issues:

@thatblindgeye thatblindgeye requested review from a team, mcoker, tlabaj and wise-king-sullyman and removed request for a team July 29, 2024 18:20
@thatblindgeye thatblindgeye linked an issue Jul 29, 2024 that may be closed by this pull request
@patternfly-build
Copy link
Collaborator

patternfly-build commented Jul 29, 2024

/** Flag to indicate the toggle has no border or background */
isPlain?: boolean;
/** Status variant of the text input group. */
status?: 'success' | 'warning' | 'error';
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have a 'default' value users can pass similar to <TextInput>?

validated?: 'success' | 'warning' | 'error' | 'default';

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could, though we would need to decide if we really want to include "default" as an option for a status prop; FormControlIcon and MenuToggle only have these 3 (MenuToggle has danger instead of error, which is another thing we need to align on).

Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed we have "default" as a value for <TextInput>

validated?: 'success' | 'warning' | 'error' | 'default';

FWIW I asked about a case for that value at some point, and I think it was to provide an easy value to pass to basically unset the prop (like when the input no longer needs a status because it's good or whatever) instead of having to either conditionally rendering the prop or passing undefined or something.

Copy link
Contributor

Choose a reason for hiding this comment

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

It does introduce a potential namespace conflict if there is a "default" variation of something. Our "custom" status used to be called "default" and one of the reasons we changed it was because of the naming conflict it created.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Might also bring up the question of whether the prop in TIG should be validated to match, or if TextInput should be status.

In either case, a value of "none" might be an alternative to "default", if we wanted a means to 'unset' the prop that wasn't undefined/conditionally rendering it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think status is what we use for stuff like this more often.

One thought, should the example be called with status instead of with validation if we stick with the status name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYI created #10851 as a followup to cover a bulk of this. Did update the example name here, though.

Copy link
Contributor

Choose a reason for hiding this comment

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

hmmm.... should we keep the name same as text input for now and update it with #10851?
Or we could deprecate "validated" prop and add the status prop.

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

LPTM! Left one question, not a blocker or anything.


export const TextInputGroupWithStatus: React.FunctionComponent = () => {
const [successValue, setSuccessValue] = React.useState('Success validation');
const [warningValue, setWarningValue] = React.useState('Warning validation with icon at start');
Copy link
Contributor

Choose a reason for hiding this comment

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

Quick question about "with icon at start", is the icon meant to come before the input? It is currently showing after the input on the right for both the warning and error. It doesn't look like there's support for icon position in the code but the text here kind of implies that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah so the "icon at start:" is in reference to the search icon being at the start. I could update the verbiage to say something like, "...with custom non-status icon at start..." wdyt?

@tlabaj tlabaj merged commit 4e32ef9 into patternfly:main Sep 10, 2024
@patternfly-build
Copy link
Collaborator

Your changes have been released in:

Thanks for your contribution! 🎉

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.

TextInputGroup - support validation

6 participants