Skip to content

feat(TextInputGroup): added validation#6802

Merged
mcoker merged 5 commits intopatternfly:v6from
thatblindgeye:iss6654_tigValidation
Jul 9, 2024
Merged

feat(TextInputGroup): added validation#6802
mcoker merged 5 commits intopatternfly:v6from
thatblindgeye:iss6654_tigValidation

Conversation

@thatblindgeye
Copy link
Contributor

@thatblindgeye thatblindgeye commented Jun 17, 2024

Closes #6654 , closes #6796

@patternfly-build
Copy link
Collaborator

patternfly-build commented Jun 17, 2024

@thatblindgeye thatblindgeye linked an issue Jun 17, 2024 that may be closed by this pull request
Copy link
Collaborator

@andrew-ronaldson andrew-ronaldson left a comment

Choose a reason for hiding this comment

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

This looks good to me. One unrelated nit is that we talked about moving the X button to flex-start instead of center. Could we squeeze that in or make its own issue

Screenshot 2024-06-26 at 9 25 24 AM

@thatblindgeye
Copy link
Contributor Author

thatblindgeye commented Jun 26, 2024

@mcoker do you think this would suffice for the above?

// starting at line 215
.#{$text-input-group}__utilities {
  ...existing styles
  > button {
    align-self: flex-start;
  }
}

(or the inverse, update align-items to flex-start then in a badge selector make align-self center)

We can't apply the flex-start to the utilities wrapper since that may contain badges/other things which should remain centered. Unless we want to add some modifier class on the outermost text-input-group class that will determine the align-items value on .#{$text-input-group}__utilities (in possibly the edge case where a filter expanded text input group may contain a "clear" button and a result count?)

If there's more to consider then I can make a followup issue, but could possibly be a quick enough addition for this PR

@mcoker
Copy link
Contributor

mcoker commented Jun 26, 2024

@thatblindgeye if you rebase this PR, the a11y errors should go away since we removed the context selector component.

@thatblindgeye thatblindgeye force-pushed the iss6654_tigValidation branch from 9c50832 to 0f01d3e Compare June 26, 2024 17:31
@mcoker
Copy link
Contributor

mcoker commented Jun 26, 2024

@thatblindgeye @andrew-ronaldson do we want badges and other actions in the utilities element to be centered vertically all the time for both single-line and multi-line text input group layouts? Or should everything be vertically centered in a single-line text input group, but be start aligned (vertically centered with the first line of content) in a mult-line text input group?

@andrew-ronaldson
Copy link
Collaborator

If the children of the utilities container were aligned to top would we need extra margin around the badge to make it visually centered with the X button.
Screenshot 2024-06-27 at 11 14 54 AM

Copy link
Collaborator

@mattnolting mattnolting left a comment

Choose a reason for hiding this comment

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

Great work @thatblindgeye! Only thing I'm noticing is icon positioning. Following comments will address.

Before:

Screenshot 2024-07-02 at 3 31 06 PM

Update:

Screenshot 2024-07-02 at 3 30 50 PM


&.pf-m-icon {
--#{$text-input-group}__text-input--PaddingInlineStart: var(--#{$text-input-group}__main--m-icon__text-input--PaddingInlineStart);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
}
display: inline-flex;
align-items: center;
justify-content: center;
min-width: calc(var(--#{$text-input-group}__LineHeight) * --#{$text-input-group}__FontSize));
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Add these to :where(:root)

  --#{$text-input-group}__LineHeight): var(--pf-t--global--font--line-height--body);
  --#{$text-input-group}__FontSize: var(--pf-t--global--font--size--body--default);

Copy link
Collaborator

Choose a reason for hiding this comment

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

Add these to .#{$text-input-group}

  line-height: var(--#{$text-input-group}__LineHeight);
  font-size: var(--#{$text-input-group}__FontSize);

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.

Looks fantastic. I left some comments and am also curious about a couple of things:

  • We're drawing the border on the outer text input group wrapper from the child __main element. That works now, but if we need to add position: relative to __main, we'll no longer be able to create the border from __main. Can we move both the status modifiers and the visible border to the outer .pf-v6-c-text-input-group element?
  • What's the role of .pf-m-status? One thing is I see we're adding selectors like .thing:where(.pf-m-success, .pf-m-error, ...)... we could require .pf-m-status to be used with any kind of status on an element like class="pf-m-status pf-m-error", and then instead of listing all of the classes in our selector, we could just target .pf-m-status.

--#{$text-input-group}__text--BorderStartEndRadius: var(--#{$text-input-group}__text--BorderRadius--base);
--#{$text-input-group}__text--BorderEndEndRadius: var(--#{$text-input-group}__text--BorderRadius--base);
--#{$text-input-group}__text--BorderEndStartRadius: var(--#{$text-input-group}__text--BorderRadius--base);
--#{$text-input-group}__text--Position: initial;
Copy link
Contributor

Choose a reason for hiding this comment

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

This probably isn't doing what you intend? Using initial as the value for a css custom property will force the fallback to be triggered in any var() function where it's used.

For example, this will make .thing have a background color of "red"

--background: initial;

.thing {
  background: var(--background, red);
}

If you wanted "initial" as the default value for the position prop where this is used, you'd just leave --#{$text-input-group}__text--Position undefined by default, and use "initial" as the fallback directly in the property declaration:

.#{$text-input-group}__text {
  position: var(--#{$text-input-group}__text--Position, initial);

Though I'd recommend using "revert" instead of "initial" - it's fine here, but "initial" doesn't always return what you're looking for. For example, if you had like div { display: initial; } it would change div to have display: inline since "inline" is the initial value for display

@thatblindgeye thatblindgeye force-pushed the iss6654_tigValidation branch from 0f01d3e to b64c26b Compare July 3, 2024 12:30
@thatblindgeye thatblindgeye force-pushed the iss6654_tigValidation branch from b64c26b to a33ec31 Compare July 9, 2024 13:50
@thatblindgeye thatblindgeye linked an issue Jul 9, 2024 that may be closed by this pull request
@andrew-ronaldson
Copy link
Collaborator

Changes look good Eric! I will close the related issue for the border-radius

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.

🐳

@patternfly-build
Copy link
Collaborator

🎉 This PR is included in version 6.0.0-alpha.184 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Text input group - disabled lost border-radius Text input group - support for validation

5 participants