Repository navigation
feat(label): convert to shadow DOM #31657
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
base: next
Are you sure you want to change the base?
Changes from all commits
26c5db5
da74a93
3cb06de
5d0af24
dcda627
f460105
6dd3db4
f08d6a1
bcde708
1cfcbd7
84f5bf3
daf517b
a8f0607
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -213,6 +213,16 @@ | |
| // Material Design Floating/Stacked Label | ||
| // -------------------------------------------------- | ||
|
|
||
| ::slotted(ion-label.label-stacked), | ||
| ::slotted(ion-label.label-floating) { | ||
| @include margin(0, 0, 0, 0); | ||
| } | ||
|
|
||
| :host(.ion-focused) ::slotted(ion-label.label-floating), | ||
| :host(.item-has-value) ::slotted(ion-label.label-floating) { | ||
| @include transform(translateY(50%), scale(0.75)); | ||
| } | ||
|
|
||
| :host(.item-label-stacked) ::slotted([slot="end"]), | ||
| :host(.item-label-floating) ::slotted([slot="end"]) { | ||
| @include margin( | ||
|
|
@@ -253,9 +263,7 @@ | |
| --min-height: 55px; | ||
| } | ||
|
|
||
| :host(.ion-focused:not(.ion-color)) ::slotted(.label-stacked), | ||
| :host(.ion-focused:not(.ion-color)) ::slotted(.label-floating), | ||
| :host(.item-has-focus:not(.ion-color)) ::slotted(.label-stacked), | ||
| :host(.item-has-focus:not(.ion-color)) ::slotted(.label-floating) { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| :host(.ion-focused:not(.ion-color)) ::slotted(.label-stacked:not(.ion-color)), | ||
| :host(.ion-focused:not(.ion-color)) ::slotted(.label-floating:not(.ion-color)) { | ||
| color: $label-md-text-color-focused; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -74,13 +74,9 @@ <h2>H2 Title Text</h2> | |
|
|
||
| <ion-item> | ||
| <ion-label> | ||
| <ion-text color="primary"> | ||
| <h3>H3 Title Text</h3> | ||
| </ion-text> | ||
| <h3><ion-text color="primary">H3 Title Text</ion-text></h3> | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In shadow DOM, label's |
||
| <p>Paragraph line 1</p> | ||
| <ion-text color="secondary"> | ||
| <p>Paragraph line 2 secondary</p> | ||
| </ion-text> | ||
| <p><ion-text color="secondary">Paragraph line 2 secondary</ion-text></p> | ||
| </ion-label> | ||
| </ion-item> | ||
|
|
||
|
|
||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The 3px comes from the markup change, not the shadow conversion. The |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,85 +22,52 @@ | |
| :host(.label-floating) { | ||
| @include margin(null, null, 0, null); | ||
| @include transform(translate(0, 29px)); | ||
| @include transform-origin(start, top); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was moved to |
||
|
|
||
| transition: transform 150ms ease-in-out; | ||
| } | ||
|
|
||
| :host-context(.item-textarea).label-floating { | ||
| @include transform(translate(0, 28px)); | ||
| } | ||
|
|
||
| :host-context(.item-has-focus).label-stacked, | ||
| :host-context(.item-has-focus).label-floating { | ||
| color: $label-ios-text-color-focused; | ||
| } | ||
|
|
||
| :host-context(.item-has-focus).label-floating, | ||
| :host-context(.item-has-placeholder:not(.item-input)).label-floating, | ||
| :host-context(.item-has-value).label-floating { | ||
| @include transform(scale(0.82)); | ||
| } | ||
|
|
||
| // iOS Typography | ||
| // -------------------------------------------------- | ||
|
|
||
| ::slotted(*) h1 { | ||
| ::slotted(h1) { | ||
| @include margin(3px, 0, 2px); | ||
|
|
||
| font-size: dynamic-font(22px); | ||
| font-weight: normal; | ||
| } | ||
|
|
||
| ::slotted(*) h2 { | ||
| ::slotted(h2) { | ||
| @include margin(0, 0, 2px); | ||
|
|
||
| font-size: dynamic-font(17px); | ||
| font-weight: normal; | ||
| } | ||
|
|
||
| ::slotted(*) h3, | ||
| ::slotted(*) h4, | ||
| ::slotted(*) h5, | ||
| ::slotted(*) h6 { | ||
| ::slotted(h3), | ||
| ::slotted(h4), | ||
| ::slotted(h5), | ||
| ::slotted(h6) { | ||
| @include margin(0, 0, 3px); | ||
|
|
||
| font-size: dynamic-font(14px); | ||
| font-weight: normal; | ||
|
|
||
| line-height: normal; | ||
| } | ||
|
|
||
| ::slotted(*) p { | ||
| ::slotted(p) { | ||
| @include margin( | ||
| $item-ios-paragraph-margin-top, | ||
| $item-ios-paragraph-margin-end, | ||
| $item-ios-paragraph-margin-bottom, | ||
| $item-ios-paragraph-margin-start | ||
| ); | ||
|
|
||
| color: #{$item-ios-paragraph-text-color}; | ||
|
|
||
| font-size: $item-ios-paragraph-font-size; | ||
|
|
||
| line-height: normal; | ||
|
|
||
| text-overflow: inherit; | ||
|
|
||
| overflow: inherit; | ||
| } | ||
|
|
||
| ::slotted(p) { | ||
| color: #{$item-ios-paragraph-text-color}; | ||
| } | ||
|
|
||
| :host(.in-item-color)::slotted(p) { | ||
| color: inherit; | ||
| } | ||
|
|
||
| ::slotted(*) h2:last-child, | ||
| ::slotted(*) h3:last-child, | ||
| ::slotted(*) h4:last-child, | ||
| ::slotted(*) h5:last-child, | ||
| ::slotted(*) h6:last-child, | ||
| ::slotted(*) p:last-child { | ||
| ::slotted(h2:last-child), | ||
| ::slotted(h3:last-child), | ||
| ::slotted(h4:last-child), | ||
| ::slotted(h5:last-child), | ||
| ::slotted(h6:last-child), | ||
| ::slotted(p:last-child) { | ||
| @include margin(null, null, 0, null); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Floating labels don't float anymore when the item has
item-has-value, which the Angular value accessor still adds, or when it's focused in md and ionic. Onnextthe label scales up in both cases, and on this branch it stays in its resting position.Should we add
:host(.item-has-value)rules for::slotted(ion-label.label-floating)to item's ios, md and ionic styles, plus:host(.ion-focused)for md and ionic? I checked that those matchnext. Or if we're dropping this along with the legacy sibling-label pattern, I think it should go inBREAKING.md.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cb68747