-
Notifications
You must be signed in to change notification settings - Fork 13.4k
fix(many): add rich content styles for select options #31138
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
df394f2
ce322f5
db262b5
c4aff48
01cbf63
d4680c5
bf4bc97
b3bd9ec
2d7c760
03eb8d2
efc38be
6d01165
2305fc4
dce202e
865d9af
5fa29e5
73f270d
c7e177d
360a911
5fda2dd
634408c
e26824c
9c534e6
9b0e9f0
b93a4cc
c9e6444
f968c7b
7a4b385
666a9a4
cfc9b48
c1c46cb
3ea2a08
a483e09
8bcf91b
286ab81
e897877
ccdd136
d475f86
3c32066
fdf9226
e669e54
863ca6c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Member
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.
Contributor
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. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| @import "./action-sheet.vars"; | ||
| @use "../../themes/mixins" as mixins; | ||
| @use "../select-option/select-option.common.interface"; | ||
|
|
||
| // Action Sheet | ||
| // -------------------------------------------------- | ||
|
|
@@ -41,34 +42,31 @@ | |
| --button-color-hover: var(--button-color); | ||
| --button-color-selected: var(--button-color); | ||
| --min-width: auto; | ||
| --width: #{$action-sheet-width}; | ||
| --max-width: #{$action-sheet-max-width}; | ||
| --width: 100%; | ||
| --max-width: 500px; | ||
| --min-height: auto; | ||
| --height: auto; | ||
| --max-height: calc(100% - (var(--ion-safe-area-top) + var(--ion-safe-area-bottom))); | ||
|
|
||
| @include font-smoothing(); | ||
| @include position(0, 0, 0, 0); | ||
| @include mixins.font-smoothing(); | ||
| @include mixins.position(0, 0, 0, 0); | ||
|
|
||
| display: block; | ||
| position: fixed; | ||
|
|
||
| outline: none; | ||
|
|
||
| font-family: $font-family-base; | ||
|
|
||
| touch-action: none; | ||
| user-select: none; | ||
| z-index: $z-index-overlay; | ||
| } | ||
|
|
||
| :host(.overlay-hidden) { | ||
| display: none; | ||
| } | ||
|
|
||
| .action-sheet-wrapper { | ||
| @include position(null, 0, 0, 0); | ||
| @include transform(translate3d(0, 100%, 0)); | ||
| @include mixins.position(null, 0, 0, 0); | ||
| @include mixins.transform(translate3d(0, 100%, 0)); | ||
|
|
||
| display: block; | ||
| position: absolute; | ||
|
|
@@ -81,7 +79,6 @@ | |
| min-height: var(--min-height); | ||
| max-height: var(--max-height); | ||
|
|
||
| z-index: $z-index-overlay-wrapper; | ||
| pointer-events: none; | ||
| } | ||
|
|
||
|
|
@@ -109,6 +106,10 @@ | |
| opacity: 0.4; | ||
| } | ||
|
|
||
| .action-sheet-button:disabled ion-icon { | ||
| color: currentColor; | ||
| } | ||
|
|
||
| .action-sheet-button-inner { | ||
| display: flex; | ||
|
|
||
|
|
@@ -177,7 +178,7 @@ | |
| // -------------------------------------------------- | ||
|
|
||
| .action-sheet-button::after { | ||
| @include button-state(); | ||
| @include mixins.button-state(); | ||
| } | ||
|
|
||
| // Action Sheet: Selected | ||
|
|
@@ -209,14 +210,20 @@ | |
| // Action Sheet: Focused | ||
| // -------------------------------------------------- | ||
|
|
||
| .action-sheet-button.ion-focused { | ||
| .action-sheet-button.ion-focused:not(.ion-activated) { | ||
| color: var(--button-color-focused); | ||
|
|
||
| &::after { | ||
| background: var(--button-background-focused); | ||
|
|
||
| opacity: var(--button-background-focused-opacity); | ||
| } | ||
|
|
||
| &.action-sheet-selected::after { | ||
| background: var(--button-background-focused, var(--button-background-selected)); | ||
|
|
||
| opacity: var(--button-background-focused-opacity, var(--button-background-selected-opacity)); | ||
| } | ||
|
Comment on lines
+213
to
+226
Contributor
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. By restructuring it this way, we are making sure that this style will be just a copy and paste for the Modular Ionic migration. |
||
| } | ||
|
|
||
| // Action Sheet: Hover | ||
|
|
@@ -243,10 +250,30 @@ | |
| align-items: center; | ||
| } | ||
|
|
||
| .action-sheet-button-label-has-rich-content, | ||
| .select-option-content { | ||
| flex: 1; | ||
| } | ||
|
|
||
| .select-option-start, | ||
| .select-option-end { | ||
| display: flex; | ||
|
|
||
| align-items: center; | ||
| } | ||
|
|
||
| /** | ||
| * Cap slotted children so they can't stretch the option | ||
| * row out of proportion, keeping rows visually uniform | ||
| * regardless of the content. ion-icon is excluded because | ||
| * its `contain: strict` makes intrinsic sizes resolve to 0, | ||
| * which would collapse the icon to zero width. | ||
| */ | ||
| .select-option-start > *:not(ion-icon), | ||
| .select-option-end > *:not(ion-icon) { | ||
| max-width: fit-content; | ||
| } | ||
|
|
||
| .select-option-description { | ||
| display: block; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,139 @@ | ||
| @use "../../themes/ionic/ionic.globals.scss" as globals; | ||
| @use "../../themes/mixins" as mixins; | ||
| @use "../select-option/select-option.ionic.interface"; | ||
| @use "./action-sheet.common"; | ||
| @use "./action-sheet.md" as action-sheet-md; | ||
|
|
||
| // Ionic Action Sheet | ||
| // -------------------------------------------------- | ||
|
|
||
| :host { | ||
| --background: #{globals.$ion-bg-surface-default}; | ||
| --backdrop-opacity: 0.7; | ||
| --button-background: transparent; | ||
| --button-background-selected: #{globals.$ion-bg-primary-subtle-default}; | ||
| --button-background-selected-opacity: 1; | ||
| --button-background-activated: #{globals.$ion-bg-neutral-subtlest-press}; | ||
| --button-background-activated-opacity: 1; | ||
| --button-background-hover: #{globals.$ion-bg-neutral-subtlest-press}; | ||
| --button-background-hover-opacity: 1; | ||
| --button-color: #{globals.$ion-text-default}; | ||
| --button-color-disabled: #{globals.$ion-text-disabled}; | ||
| --color: #{globals.$ion-text-default}; | ||
|
|
||
| z-index: 1001; | ||
| } | ||
|
|
||
| .action-sheet-wrapper { | ||
| z-index: 10; | ||
| } | ||
|
|
||
| .action-sheet-button.ion-focused::after { | ||
| @include globals.focused-state( | ||
| globals.$ion-border-size-050, | ||
| globals.$ion-border-style-solid, | ||
| globals.$ion-border-focus-default | ||
| ); | ||
|
|
||
| outline-offset: calc(globals.$ion-border-size-050 * -1); | ||
| } | ||
|
|
||
| // Action Sheet Wrapper | ||
| // ----------------------------------------- | ||
|
|
||
| .action-sheet-wrapper { | ||
| @include mixins.margin(var(--ion-safe-area-top, 0), auto, 0, auto); | ||
| } | ||
|
|
||
| .action-sheet-title { | ||
| @include mixins.padding(globals.$ion-space-400); | ||
| @include globals.typography(globals.$ion-heading-h6-medium); | ||
|
|
||
| color: var(--color); | ||
|
|
||
| text-align: start; | ||
| } | ||
|
|
||
| .action-sheet-sub-title { | ||
| @include globals.typography(globals.$ion-body-md-regular); | ||
|
|
||
| color: globals.$ion-text-subtlest; | ||
| } | ||
|
|
||
| // Action Sheet Group | ||
| // ----------------------------------------- | ||
|
|
||
| .action-sheet-group:first-child { | ||
| @include mixins.padding(globals.$ion-space-400, null, null, null); | ||
| } | ||
|
|
||
| .action-sheet-group:last-child { | ||
| @include mixins.padding(null, null, globals.$ion-space-400, null); | ||
| } | ||
|
|
||
| // Action Sheet Buttons | ||
| // ----------------------------------------- | ||
|
|
||
| .action-sheet-button { | ||
| @include mixins.padding( | ||
| globals.$ion-space-300, | ||
| globals.$ion-space-400, | ||
| globals.$ion-space-300, | ||
| globals.$ion-space-400 | ||
| ); | ||
| @include globals.typography(globals.$ion-body-md-regular); | ||
|
|
||
| position: relative; | ||
|
|
||
| min-height: 52px; | ||
|
|
||
| text-align: start; | ||
|
|
||
| contain: content; | ||
| overflow: hidden; | ||
| } | ||
|
|
||
| .action-sheet-icon { | ||
|
Member
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.
Contributor
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. I'm basing it off the tab button icon size and the radio box size as it seems that 24px is the consistent size for elements like this: ccdd136 |
||
| @include mixins.margin(globals.$ion-space-0, globals.$ion-space-600, globals.$ion-space-0, globals.$ion-space-0); | ||
|
|
||
| width: globals.$ion-scale-600; | ||
| height: globals.$ion-scale-600; | ||
|
|
||
| color: var(--color, globals.$ion-text-default); | ||
| } | ||
|
|
||
| .action-sheet-button-inner { | ||
| justify-content: flex-start; | ||
| } | ||
|
|
||
| .action-sheet-selected { | ||
| font-weight: bold; | ||
| } | ||
|
|
||
| // Action Sheet: Select Option | ||
| // -------------------------------------------------- | ||
|
|
||
| .action-sheet-button-label { | ||
| gap: globals.$ion-space-300; | ||
| } | ||
|
|
||
| .select-option-start, | ||
| .select-option-end { | ||
| gap: globals.$ion-space-200; | ||
| } | ||
|
|
||
| /** | ||
| * Cap slotted children so they can't stretch the option | ||
| * row out of proportion, keeping rows visually uniform | ||
| * regardless of the content. | ||
| */ | ||
| .select-option-start > *, | ||
| .select-option-end > * { | ||
| max-height: globals.$ion-scale-1200; | ||
| } | ||
|
|
||
| .select-option-description { | ||
| @include globals.typography(globals.$ion-body-md-regular); | ||
| @include globals.padding(0); | ||
| @include globals.padding(globals.$ion-space-0); | ||
|
|
||
| color: globals.$ion-text-subtle; | ||
|
|
||
| font-size: globals.$ion-font-size-350; | ||
| } | ||
|
Member
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. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -161,3 +161,6 @@ $action-sheet-ios-group-translucent-filter: saturate(280%) blur(20px); | |
|
|
||
| /// @prop - Filter of the translucent action-sheet button | ||
| $action-sheet-ios-button-translucent-filter: saturate(120%); | ||
|
|
||
| /// @prop - Maximum size of slotted children rendered in a select option's start/end slot | ||
| $action-sheet-ios-select-option-slot-size: dynamic-font-max(24px, 2); | ||
|
Contributor
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. Based on what I found through iOS code and that it scales up.
Member
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. |
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,7 +1,7 @@ | ||||||
| @import "./action-sheet.native"; | ||||||
| @import "./action-sheet.md.vars"; | ||||||
|
|
||||||
| // Material Design Action Sheet Title | ||||||
| // Material Design Action Sheet | ||||||
| // ----------------------------------------- | ||||||
|
|
||||||
| :host { | ||||||
|
|
@@ -110,3 +110,16 @@ | |||||
| .action-sheet-selected { | ||||||
| font-weight: bold; | ||||||
| } | ||||||
|
|
||||||
| // Action Sheet: Select Option | ||||||
| // -------------------------------------------------- | ||||||
|
|
||||||
| /** | ||||||
| * Cap slotted children so they can't stretch the option | ||||||
| * row out of proportion, keeping rows visually uniform | ||||||
| * regardless of the content. | ||||||
| */ | ||||||
| .select-option-start > *, | ||||||
| .select-option-end > * { | ||||||
| max-height: 24px; | ||||||
|
Contributor
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. Based on MD3
Member
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 avatar looks pretty small compared to md3:
MD2 is also a bit bigger:
but maybe because they don't show it by checkboxes?
Contributor
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. I used the designs from |
||||||
| } | ||||||








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.
Shouldn't this be a
featsince it adds new properties to the api?