-
Notifications
You must be signed in to change notification settings - Fork 13.4k
feat(select): add labelPlacement prop, justify prop, and 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?
feat(select): add labelPlacement prop, justify prop, and rich content styles for select options #31138
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
8914cc3
54d2c0c
6a5517d
c6d6b5e
645214a
b89f9ac
ae8d923
bfaf49e
26c24ea
138ddec
e2d8d15
bcbf6e1
3db9b9a
8cfef6b
ea99611
2635dc7
38dd874
bd39bda
43817c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
brandyscarney marked this conversation as resolved.
|
| 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.overlay"; | ||
|
|
||
| // 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 | ||
|
|
@@ -233,20 +240,3 @@ | |
| } | ||
| } | ||
| } | ||
|
|
||
| // Action Sheet: Select Option | ||
| // -------------------------------------------------- | ||
|
|
||
| .action-sheet-button-label { | ||
| display: flex; | ||
|
|
||
| align-items: center; | ||
| } | ||
|
|
||
| .select-option-content { | ||
| flex: 1; | ||
| } | ||
|
|
||
| .select-option-description { | ||
| display: block; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,110 @@ | ||
| @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 | ||
| // -------------------------------------------------- | ||
|
|
||
| // Action Sheet: Select Option | ||
| // -------------------------------------------------- | ||
| :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-button-label { | ||
| gap: globals.$ion-space-300; | ||
| .action-sheet-wrapper { | ||
| @include mixins.margin(var(--ion-safe-area-top, 0), auto, 0, auto); | ||
| } | ||
|
|
||
| .select-option-description { | ||
| .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); | ||
| @include globals.padding(0); | ||
|
|
||
| color: globals.$ion-text-subtle; | ||
| 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-200, | ||
| globals.$ion-space-400, | ||
| globals.$ion-space-200, | ||
| 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 { | ||
|
brandyscarney marked this conversation as resolved.
|
||
| @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; | ||
| } | ||
|
|
||
| font-size: globals.$ion-font-size-350; | ||
| .action-sheet-selected { | ||
| font-weight: bold; | ||
| } | ||
|
brandyscarney marked this conversation as resolved.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,15 @@ | ||
| @use "../../themes/native/native.theme.default" as native; | ||
| @use "../../themes/mixins" as mixins; | ||
| @use "../../themes/functions.font" as font; | ||
| @use "../../themes/native/native.globals" as native; | ||
| @use "./action-sheet.common"; | ||
|
|
||
| // Action Sheet: Native | ||
| // -------------------------------------------------- | ||
|
|
||
| .action-sheet-button-label { | ||
| gap: 12px; | ||
| } | ||
|
|
||
| .select-option-description { | ||
| @include mixins.padding(5px, 0, 0, 0); | ||
| :host { | ||
| font-family: native.$font-family-base; | ||
|
|
||
| color: native.$text-color-step-300; | ||
| z-index: native.$z-index-overlay; | ||
| } | ||
|
|
||
| font-size: font.dynamic-font(12px); | ||
| .action-sheet-wrapper { | ||
| z-index: native.$z-index-overlay-wrapper; | ||
| } |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import { configs, test } from '@utils/test/playwright'; | ||
|
|
||
| import { ActionSheetFixture } from '../basic/fixture'; | ||
|
|
||
| /** | ||
| * This behavior does not vary across directions. | ||
| */ | ||
| configs({ directions: ['ltr'], modes: ['ios', 'md', 'ionic-md'] }).forEach(({ config, screenshot, title }) => { | ||
| test.describe(title('action sheet: states'), () => { | ||
| /** | ||
| * `(any-hover: hover)` evaluates to "none" in all three mobile-emulated | ||
| * projects, suppressing the hover rules: | ||
| * | ||
| * - Chromium and WebKit suppress it because of hasTouch and isMobile. | ||
| * - Headless Firefox doesn't detect input devices and reports no hover | ||
| * capability regardless of context options, so override it via | ||
| * launchOptions.firefoxUserPrefs. Bit values: 4 = FINE (mouse), | ||
|
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. Overriding it would lead to a global change so I didn't want to attempt that in this PR. |
||
| * 8 = HOVER, 12 = FINE | HOVER. | ||
| * | ||
| * Viewport, userAgent, and scale factor remain mobile-sized. | ||
| */ | ||
| test.use({ | ||
| hasTouch: false, | ||
| isMobile: false, | ||
| }); | ||
|
|
||
| test('should render all button states', async ({ page }) => { | ||
| await page.goto(`/src/components/action-sheet/test/states`, config); | ||
|
|
||
| const actionSheetFixture = new ActionSheetFixture(page, screenshot); | ||
|
|
||
| await actionSheetFixture.open('#basic'); | ||
|
|
||
| const defaultButton = page.locator('ion-action-sheet button.action-sheet-button').first(); | ||
| await defaultButton.hover(); | ||
|
|
||
| await actionSheetFixture.screenshot('states'); | ||
| }); | ||
| }); | ||
| }); | ||
|
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. Hovered styles in Playwright Firefox do not display because we aren't truly mimicking a supported device. |
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?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.
Good point!
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.
Can we update the title to mention support for the new properties too?
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.
How does it sound now?
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.
I think it would be better to target
select: