Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions demo/e2e/md3-color-roles.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ for (const mode of ['light', 'dark'] as const) {
'disabled',
'toolbar-action',
];
// Read native colors only after every sampled component has hydrated.
await Promise.all(ids.map((id) => expect(page.getByTestId(`palette-${id}`)).toHaveClass(/hydrated/)));
const before = Object.fromEntries(await Promise.all(ids.map(async (id) => [id, await colors(page.getByTestId(`palette-${id}`))])));
expect(before['toolbar-action'].foreground).toEqual(before['filled'].foreground);
expect(before['tonal'].background).not.toEqual(before['filled'].background);
Expand Down
Binary file modified demo/e2e/screenshot.spec.ts-snapshots/alert-all-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demo/e2e/screenshot.spec.ts-snapshots/alert-all.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demo/e2e/screenshot.spec.ts-snapshots/alert-button-only-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demo/e2e/screenshot.spec.ts-snapshots/alert-button-only.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demo/e2e/screenshot.spec.ts-snapshots/alert-no-cancel-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demo/e2e/screenshot.spec.ts-snapshots/alert-no-cancel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demo/e2e/screenshot.spec.ts-snapshots/alert-preferred-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demo/e2e/screenshot.spec.ts-snapshots/alert-preferred.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demo/e2e/screenshot.spec.ts-snapshots/alert-remove-app-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demo/e2e/screenshot.spec.ts-snapshots/alert-remove-app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demo/e2e/screenshot.spec.ts-snapshots/device-alert-all-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demo/e2e/screenshot.spec.ts-snapshots/device-alert-all-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demo/e2e/screenshot.spec.ts-snapshots/device-select-alert-dark.png
Binary file modified demo/e2e/screenshot.spec.ts-snapshots/select-alert-dark.png
Binary file modified demo/e2e/screenshot.spec.ts-snapshots/select-alert.png
4 changes: 4 additions & 0 deletions demo/src/app/index/pages/alert/alert.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ <h2>alert</h2>
<ion-item (click)="present('button-only')" [button]="true">present:button-only</ion-item>
<ion-item (click)="present('no-cancel')" [button]="true">present:no-cancel</ion-item>
<ion-item (click)="present('preferred')" [button]="true">present:preferred</ion-item>
<ion-item (click)="present('checkbox')" [button]="true">present:checkbox</ion-item>
<ion-item (click)="present('radio')" [button]="true">present:radio</ion-item>
<ion-item (click)="present('input')" [button]="true">present:input</ion-item>
<ion-item (click)="present('textarea')" [button]="true">present:textarea</ion-item>
<ion-item (click)="present('remove-app')" [button]="true">present:remove-app</ion-item>
</ion-item-group>
</ion-list>
Expand Down
28 changes: 27 additions & 1 deletion demo/src/app/index/pages/alert/alert.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Component, effect, inject, OnInit } from '@angular/core';
import { FormsModule } from '@angular/forms';
import {
AlertController,
type AlertOptions,
IonBackButton,
IonContent,
IonHeader,
Expand Down Expand Up @@ -56,7 +57,32 @@ export class AlertPage implements OnInit {
ngOnInit() {}

async present(type: (typeof alertTypes)[number]) {
const applyConfig = ((type) => {
const applyConfig = ((type): AlertOptions => {
if (type === 'checkbox' || type === 'radio') {
return {
header: 'Choose options',
inputs: [
{ type, label: 'Apple', value: 'apple', checked: true },
{ type, label: 'Banana', value: 'banana' },
{ type, label: 'A longer option that wraps onto another line', value: 'orange' },
{ type, label: 'Unavailable', value: 'disabled', disabled: true },
],
buttons: [
{ text: 'Cancel', role: 'cancel' },
{ text: 'OK', role: 'preferred' },
],
};
}
if (type === 'input' || type === 'textarea') {
return {
header: type === 'input' ? 'Device name' : 'Description',
inputs: [{ type: type === 'input' ? 'text' : 'textarea', value: type === 'input' ? 'Pixel 8a' : '', placeholder: 'Enter text' }],
buttons: [
{ text: 'Cancel', role: 'cancel' },
{ text: 'OK', role: 'preferred' },
],
};
}
if (type === 'preferred') {
return {
...alertUtil(),
Expand Down
2 changes: 1 addition & 1 deletion demo/src/app/overlay-types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const alertTypes = ['all', 'button-only', 'no-cancel', 'remove-app', 'preferred'];
export const alertTypes = ['all', 'button-only', 'no-cancel', 'remove-app', 'preferred', 'checkbox', 'radio', 'input', 'textarea'];
export const actionSheetTypes = ['all', 'button-only', 'no-cancel', 'preferred'];
export const toastTypes = ['top', 'middle', 'bottom', 'anchor'];
export const modalTypes = ['normal', 'card', 'sheet'];
Expand Down
46 changes: 46 additions & 0 deletions src/styles/components/_colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,52 @@ ion-alert.md:where(:not(.md3-disabled)) .alert-message {
color: var(--md-sys-color-on-surface-variant, var(--ion-color-step-550, var(--ion-text-color-step-450, #737373)));
}

// Alert inputs are native elements, not ion-checkbox / ion-radio / ion-input.
// Map state colors explicitly so Material roles reach the embedded controls.
// Beat Ionic’s scoped checked-state selectors, including its extra scope classes.
ion-alert.md:not(.md3-disabled) {
.alert-checkbox-icon,
.alert-radio-icon {
border-color: #{md3.color(on-surface-variant)};
}

.alert-checkbox-label,
.alert-radio-label,
.alert-input {
color: #{md3.color(on-surface)};
}

[aria-checked='true'] .alert-checkbox-icon {
background: #{md3.color(primary)};
border-color: #{md3.color(primary)};
}

[aria-checked='true'] .alert-checkbox-inner {
border-color: #{md3.color(on-primary)};
}

[aria-checked='true'] .alert-radio-icon {
border-color: #{md3.color(primary)};
}

.alert-radio-inner {
background: #{md3.color(primary)};
}

.alert-input {
border-bottom-color: #{md3.color(on-surface-variant)};
caret-color: #{md3.color(primary)};
}

.alert-input::placeholder {
color: #{md3.color(on-surface-variant)};
}

.alert-input:focus {
border-bottom-color: #{md3.color(primary)};
}
}

ion-alert.md:where(:not(.md3-disabled)) .alert-button {
background: transparent;
color: var(--md-sys-color-on-surface, var(--ion-color-primary, #0054e9));
Expand Down
51 changes: 51 additions & 0 deletions src/styles/components/ion-alert.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,57 @@ ion-alert.md:not(.md3-disabled) {
padding-bottom: 16px;
}

// Android 17 Settings choice dialogs have no persistent list dividers.
// Keep space between the last option and the rounded action buttons;
// action-only and text-input alerts already supply their own content gap.
.alert-radio-group,
.alert-checkbox-group {
border: 0;
padding-bottom: 24px;
}

// Settings uses an 18dp checkbox. Keep the rotated check inside Ionic's
// strictly contained icon; Ionic retains option placement and RTL ordering.
.alert-checkbox-icon {
flex-shrink: 0;
width: 18px;
height: 18px;
}

// Ionic 8 has no placement classes and uses different checkbox column
// offsets. Bring that legacy markup to the same columns as Ionic 9 while
// retaining Ionic 9's explicit placement/justification options.
.alert-checkbox-button > .alert-button-inner:not(.checkbox-label-placement-start):not(.checkbox-label-placement-end) {
justify-content: flex-start;

.alert-checkbox-icon {
inset-inline-start: 24px;
}

.alert-checkbox-label {
flex: 0 1 auto;
width: auto;
max-width: calc(100% - 16px);
padding-inline: 56px 24px;
}
}

[aria-checked='true'] .alert-checkbox-inner {
top: 1px;
inset-inline-start: 4px;
}

// The header already supplies spacing. Ionic adds another 20px above
// inputs even when the intervening message is empty.
.alert-head:not(:empty) + .alert-message:empty + .alert-input-group {
padding-top: 0;
}

.alert-input {
font-size: 1.125rem;
line-height: 1.5;
}

.alert-button-group {
padding: 0 24px 24px;
column-gap: 8px;
Expand Down
Loading