Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(input): add outline appearance for stacked label to ionic theme #29268

Merged
merged 34 commits into from Apr 9, 2024

Conversation

amandaejohnston
Copy link
Contributor

@amandaejohnston amandaejohnston commented Apr 3, 2024

Issue number: Internal


What is the new behavior?

All changes are specific to the ionic theme.

  • Styles added for fill="outline" plus labelPlacement="stacked".
  • Markup rearranged slightly to ensure label sits above outline while still being clickable to focus the input. See code comments for details.
  • The default labelPlacement is now "stacked".
  • Values for labelPlacement besides "stacked" and "floating" cannot be used.

Note that per the ticket, I did not account for any other scope, including styles for helper text, labelPlacement="floating", shape="round", etc. This means that some states will look broken for now, and will be addressed in future tickets.

Does this introduce a breaking change?

  • Yes
  • No

Other information

@github-actions github-actions bot added the package: core @ionic/core package label Apr 3, 2024
@amandaejohnston amandaejohnston changed the title Fw 6082 feat(input): add outline appearance for stacked label to ionic theme Apr 3, 2024
Comment on lines 8 to 11
:host {
--border-width: 1px;
--border-color: #B8B8B8;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went ahead and put these styles here instead of the outline-specific file since they'll be needed for the underline appearance as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change is due to the default label placement changing to stacked for this theme.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

While this looks broken currently, I intentionally left it as-is because the test uses a floating label placement, which this ticket explicitly doesn't cover. When floating labels are implemented later, these screenshots will be fixed. LMK if you'd like me to change the relevant size="large" tests to use stacked instead.

@amandaejohnston amandaejohnston marked this pull request as ready for review April 3, 2024 18:54
@amandaejohnston amandaejohnston requested a review from a team as a code owner April 3, 2024 18:55
@amandaejohnston amandaejohnston requested review from sean-perkins and removed request for a team April 3, 2024 18:55
Copy link
Contributor

@sean-perkins sean-perkins left a comment

Choose a reason for hiding this comment

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

I think the implementation should adjust the rendering of the outline container to not include MD specific elements for the ionic theme.

This would simplify the styling and the cognitive load of trying to understand why we are rendering an element and then visually hiding it for a theme.

core/src/components/input/input.tsx Outdated Show resolved Hide resolved
const theme = getIonTheme(this);
const { el, labelPlacement } = this;

if (theme === 'ionic' && labelPlacement !== 'stacked' && labelPlacement !== 'floating') {
Copy link
Contributor

Choose a reason for hiding this comment

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

~ I don't know if we need the overhead for runtime checks for every unsupported prop/prop option for a given theme.

Open to team feedback on this, but this feels like a problem to solve closer to beta/rc/ga. We may fill these feature gaps in that time and the documentation may be clear enough for developers to navigate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm open to removing the check and/or warning, but it was included in the design doc and is a pattern we're already using for other features. The size prop on ion-input is already implemented this way, for example.

core/src/components/input/input.tsx Show resolved Hide resolved
position: absolute;

/**
* Label text should not extend
Copy link
Contributor

Choose a reason for hiding this comment

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

~ this looks to be copy and paste, we could probably remove the 40 character line wrapping since the file already extends wider than this line would be.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True that this was copy-pasted, but it's just Liam's commenting style; this sort of thing is all over our codebase right now 😄

core/src/components/input/input.ionic.outline.scss Outdated Show resolved Hide resolved
core/src/components/input/input.ionic.outline.scss Outdated Show resolved Hide resolved
core/src/components/input/input.ionic.outline.scss Outdated Show resolved Hide resolved
Copy link
Contributor

@thetaPC thetaPC left a comment

Choose a reason for hiding this comment

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

We should probably get clarification on implementing the start/end slots. I don't think we have a separate ticket for that. I would have assumed that it would be part of this.

Copy link
Contributor

Choose a reason for hiding this comment

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

  • The label doesn't have the correct font color (#373737).
  • The placeholder color is not correct. (#535353).
  • The font size for input is 14px instead of 16px. Also can't tell if label needs adjusting too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Colors updated in 1f0a574. Font size seems like more of a global typography thing? The default font size for the ionic theme is 14px, and ion-input's font size is currently set to inherit, so that should just work once everything is put together. At least, as far as I understand it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I wonder who we should check in to verify this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I checked with Sean in Slack. The font used in the screenshots is hardcoded in a separate file and affects all ionic theme screenshots, so changing it should be out of scope for this PR. I made a ticket to track this: https://outsystemsrd.atlassian.net/browse/FW-6116

core/src/components/input/test/fill/input.e2e.ts Outdated Show resolved Hide resolved
@amandaejohnston
Copy link
Contributor Author

We should probably get clarification on implementing the start/end slots. I don't think we have a separate ticket for that. I would have assumed that it would be part of this.

Added some styles in d17c865, screenshots incoming once I fix up everything else. It looks like the default ion-icon size is already 16px as prescribed, so I only touched the margins; I figure any further sizing details should be up to the app since slots are designed for more flexibility.

core/src/components/input/input.ionic.outline.scss Outdated Show resolved Hide resolved
core/src/components/input/input.ionic.outline.scss Outdated Show resolved Hide resolved
core/src/components/input/input.ionic.outline.scss Outdated Show resolved Hide resolved
core/src/components/input/input.tsx Show resolved Hide resolved
@amandaejohnston
Copy link
Contributor Author

There are some build differences from ion-chip due to an unrelated issue that's being discussed in Slack; re-requesting review anyway since I don't think that's a blocker to at least getting the code looked at.

Co-authored-by: Maria Hutt <thetaPC@users.noreply.github.com>
Copy link
Contributor

@thetaPC thetaPC left a comment

Choose a reason for hiding this comment

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

LGTM

@amandaejohnston amandaejohnston merged commit bb516f0 into ROU-4848 Apr 9, 2024
42 checks passed
@amandaejohnston amandaejohnston deleted the FW-6082 branch April 9, 2024 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants