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, textarea, select): add start and end slots #28583

Merged
merged 11 commits into from
Dec 1, 2023

Conversation

averyjohnston
Copy link
Contributor

@averyjohnston averyjohnston commented Nov 27, 2023

Issue number: Resolves #26297


What is the current behavior?

With the modern form control syntax, it is not possible to add icon buttons or other decorators to the sides of ion-input, ion-textarea, or ion-select, as you can with ion-item.

What is the new behavior?

start and end slots added to each component.

This PR is a combination of several others that were already approved. If needed, it might be easiest to review the PRs individually by looking at the commit history here.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Docs PR: ionic-team/ionic-docs#3271

Dev build: 7.5.4-dev.11701112913.1ea61220

averyjohnston and others added 4 commits November 27, 2023 09:44
… names (#28396)

Issue number: Internal

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

The internal `slotMutationController` utility can only watch one slot
name at a time.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

Added the option to specify multiple slot names, any of which will
trigger the callback. This change is made in preparation for upcoming
`start` and `end` slots for several form control components; it boosts
performance by preventing us from needing to add multiple
`createSlotMutationController` calls to each component.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
Issue number: Part of #26297

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

With the modern form control syntax, it is not possible to add icon
buttons or other decorators to the sides of `ion-input`, as you can with
`ion-item`.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

`start` and `end` slots added. While making this change, I also tweaked
the CSS selectors responsible for translating the label above the input
with `"stacked"` and `"floating"` placements, merging this logic into a
single class managed by the TSX. I needed to add a new class for whether
slot content is present, so the selectors were getting unwieldy
otherwise.

Docs PR TBA; I plan on knocking out all three components at once when
the features are all complete, to make dev builds easier to manage.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

---------

Co-authored-by: ionitron <[email protected]>
Issue number: Part of #26297

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

With the modern form control syntax, it is not possible to add icon
buttons or other decorators to the sides of `ion-textarea`, as you can
with `ion-item`.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

`start` and `end` slots added. While making this change, I also tweaked
the CSS selectors responsible for translating the label above the input
with `"stacked"` and `"floating"` placements, merging this logic into a
single class managed by the TSX. I needed to add a new class for whether
slot content is present, so the selectors were getting unwieldy
otherwise.

Docs PR TBA; I plan on knocking out all three components at once when
the features are all complete, to make dev builds easier to manage.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

---------

Co-authored-by: ionitron <[email protected]>
Co-authored-by: Maria Hutt <[email protected]>
Issue number: Part of #26297

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

With the modern form control syntax, it is not possible to add icon
buttons or other decorators to the sides of `ion-select`, as you can
with `ion-item`.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

`start` and `end` slots added. While making this change, I also tweaked
the CSS selectors responsible for translating the label above the input
with `"stacked"` and `"floating"` placements, merging this logic into a
single class managed by the TSX. I needed to add a new class for whether
slot content is present, so the selectors were getting unwieldy
otherwise.

Docs PR TBA; I plan on knocking out all three components at once when
the features are all complete, to make dev builds easier to manage.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

---------

Co-authored-by: ionitron <[email protected]>
@github-actions github-actions bot added the package: core @ionic/core package label Nov 27, 2023
@averyjohnston averyjohnston marked this pull request as ready for review November 28, 2023 19:10
@averyjohnston averyjohnston requested review from a team and liamdebeasi and removed request for a team November 28, 2023 19:11
@averyjohnston averyjohnston requested a review from a team as a code owner November 29, 2023 16:01
Copy link
Contributor

@liamdebeasi liamdebeasi left a comment

Choose a reason for hiding this comment

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

One template change in the tests, but otherwise looks good. I'm also fine with the API naming -- start/end seems to make the most sense here. Great work!

@liamdebeasi liamdebeasi requested a review from a team November 30, 2023 18:57
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.

Thank you for the clear comments! Made it easier to review.

core/src/components/input/input.scss Outdated Show resolved Hide resolved
core/src/components/select/select.scss Outdated Show resolved Hide resolved
@thetaPC thetaPC requested a review from a team December 1, 2023 17:59
@averyjohnston averyjohnston requested a review from thetaPC December 1, 2023 18:05
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

@averyjohnston averyjohnston merged commit 357b8b2 into feature-7.6 Dec 1, 2023
44 checks passed
@averyjohnston averyjohnston deleted the FW-2853 branch December 1, 2023 20:54
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.

3 participants