Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 13.3k
feat(select): add start and end slots#28563
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
d2bb3e44193ff81921f8ac4eba46527fc706c44b5ee9931256087d1546989f4a02bbaf726b60b086d906d1723ad2ac57093c4bce3ac67043ddc8b515ad99f49e19c1fabb56c5f48e1b28d10b3e91e4b124554b30be7f603ac339f17849d31eaef27189ee1bc55fc37eb2d57574db0ca723cb0f98c0269b600af15ea9f12b97123d868763efFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -21,11 +21,11 @@ | ||
| color: #{$text-color-step-350}; | ||
| } | ||
| // Select Native Wrapper | ||
liamdebeasi marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| // Select Inner Wrapper | ||
| // ---------------------------------------------------------------- | ||
| :host(.select-label-placement-stacked) .native-wrapper, | ||
| :host(.select-label-placement-floating) .native-wrapper { | ||
| :host(.select-label-placement-stacked) .select-wrapper-inner, | ||
| :host(.select-label-placement-floating) .select-wrapper-inner { | ||
| width: calc(100% - $select-ios-icon-size - $select-icon-margin-start); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -157,6 +157,13 @@ button { | ||
| @include margin(0, 0, 0, $select-icon-margin-start); | ||
| position: relative; | ||
| /** | ||
| * Prevent the icon from shrinking when the label and/or | ||
| * selected item text is long enough to fill the rest of | ||
| * the container. | ||
| */ | ||
| flex-shrink: 0; | ||
averyrousseau marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
| /** | ||
| @@ -259,6 +266,25 @@ button { | ||
| transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1); | ||
| } | ||
| .select-wrapper-inner { | ||
| display: flex; | ||
| align-items: center; | ||
| overflow: hidden; | ||
| } | ||
| :host(.select-label-placement-stacked) .select-wrapper-inner, | ||
| :host(.select-label-placement-floating) .select-wrapper-inner { | ||
| /** | ||
| * When using a stacked/floating label, the inner wrapper is | ||
| * stacked vertically under the label container. This line | ||
| * ensures that the inner wrapper fills all the remaining height | ||
| * of the component. | ||
| */ | ||
| flex-grow: 1; | ||
| } | ||
| // Select Highlight | ||
| // ---------------------------------------------------------------- | ||
| @@ -519,11 +545,23 @@ button { | ||
| * The placeholder should be hidden when the label | ||
| * is on top of the select. This prevents the label | ||
| * from overlapping any placeholder value. | ||
| * | ||
| * TODO(FW-5592): Remove :not(.label-floating) piece | ||
| */ | ||
| :host(.select-label-placement-floating) .native-wrapper .select-placeholder { | ||
| :host(.select-label-placement-floating:not(.label-floating)) .native-wrapper .select-placeholder { | ||
averyrousseau marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| opacity: 0; | ||
| } | ||
| /** | ||
| * We don't use .label-floating here because that would | ||
| * also include the case where the label is floating due | ||
| * to content in the start/end slot. We want the opacity | ||
| * to remain at the default in this case, since the select | ||
| * isn't being actively interacted with. | ||
| * | ||
| * TODO(FW-5592): Change entire selector to: | ||
| * :host(.label-floating.select-label-placement-floating) .native-wrapper .select-placeholder | ||
| */ | ||
| :host(.select-expanded.select-label-placement-floating) .native-wrapper .select-placeholder, | ||
| :host(.ion-focused.select-label-placement-floating) .native-wrapper .select-placeholder, | ||
| :host(.has-value.select-label-placement-floating) .native-wrapper .select-placeholder { | ||
| @@ -533,10 +571,7 @@ button { | ||
| /** | ||
| * This makes the label sit above the input. | ||
| */ | ||
| :host(.select-label-placement-stacked) .label-text-wrapper, | ||
| :host(.select-expanded.select-label-placement-floating) .label-text-wrapper, | ||
| :host(.ion-focused.select-label-placement-floating) .label-text-wrapper, | ||
| :host(.has-value.select-label-placement-floating) .label-text-wrapper { | ||
| :host(.label-floating) .label-text-wrapper { | ||
| @include transform(translateY(50%), scale(#{$form-control-label-stacked-scale})); | ||
| /** | ||
| @@ -545,3 +580,23 @@ button { | ||
| */ | ||
| max-width: calc(100% / #{$form-control-label-stacked-scale}); | ||
| } | ||
| // Start/End Slots | ||
| // ---------------------------------------------------------------- | ||
| ::slotted([slot="start"]), ::slotted([slot="end"]) { | ||
| /** | ||
| * Prevent the slots from shrinking when the label and/or | ||
| * selected item text is long enough to fill the rest of | ||
| * the container. | ||
| */ | ||
| flex-shrink: 0; | ||
| } | ||
| ::slotted([slot="start"]) { | ||
| margin-inline-end: $form-control-label-margin; | ||
| } | ||
| ::slotted([slot="end"]) { | ||
| margin-inline-start: $form-control-label-margin; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -171,7 +171,7 @@ configs().forEach(({ title, screenshot, config }) => { | ||
| test('label should appear on top of the select when the select is expanded', async ({ page }) => { | ||
| await page.setContent( | ||
| ` | ||
| <ion-select class="select-expanded" label="Label" label-placement="floating" placeholder="Select a Fruit"> | ||
| <ion-select class="select-expanded label-floating" label="Label" label-placement="floating" placeholder="Select a Fruit"> | ||
liamdebeasi marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| <ion-select-option value="apples">Apples</ion-select-option> | ||
| </ion-select> | ||
| `, | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.