Files
ionic-framework/core/src/components/alert/alert.md.scss
Liam DeBeasi 6a2be9fa3c fix(alert): match MD spec on tablet (#28501)
Issue number: resolves #23977

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

The MD Alert on tablet dimensions does not match the MD spec

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- MD Alert now follows the MD spec for tablet dimensions
- Added tablet and mobile viewport mixins for alert and the card modal.
(There should be no visual diffs for the card modal)

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

This supersedes https://github.com/ionic-team/ionic-framework/pull/27462
since I needed to add new screenshot tests. The author of that PR has
been given co-author credit here.

---------

Co-authored-by: GlenOttley <GlenOttley@users.noreply.github.com>
Co-authored-by: ionitron <hi@ionicframework.com>
Co-authored-by: Brandy Carney <brandyscarney@users.noreply.github.com>
2023-11-16 16:28:36 +00:00

315 lines
8.0 KiB
SCSS

@import "./alert";
@import "./alert.md.vars";
// Material Design Alert
// --------------------------------------------------
:host {
--background: #{$alert-md-background-color};
--max-width: #{$alert-md-max-width};
--backdrop-opacity: var(--ion-backdrop-opacity, 0.32);
font-size: $alert-md-font-size;
}
.alert-wrapper {
@include border-radius($alert-md-border-radius);
box-shadow: $alert-md-box-shadow;
}
// Material Design Alert Header
// --------------------------------------------------
.alert-head {
@include padding($alert-md-head-padding-top, $alert-md-head-padding-end, $alert-md-head-padding-bottom, $alert-md-head-padding-start);
text-align: $alert-md-head-text-align;
}
.alert-title {
color: $alert-md-title-color;
font-size: $alert-md-title-font-size;
font-weight: $alert-md-title-font-weight;
}
.alert-sub-title {
color: $alert-md-sub-title-text-color;
font-size: $alert-md-sub-title-font-size;
}
// Material Design Alert Message
// --------------------------------------------------
.alert-message,
.alert-input-group {
@include padding($alert-md-message-padding-top, $alert-md-message-padding-end, $alert-md-message-padding-bottom, $alert-md-message-padding-start);
color: $alert-md-message-text-color;
}
.alert-message {
font-size: $alert-md-message-font-size;
}
/**
* MD Alerts on tablets can expand vertically up to
* a total maximum height. We only want to set a max-height
* on mobile phones.
*/
@include mobile-viewport() {
.alert-message {
max-height: $alert-md-content-max-height;
}
}
.alert-message:empty {
@include padding($alert-md-message-empty-padding-top, $alert-md-message-empty-padding-end, $alert-md-message-empty-padding-bottom, $alert-md-message-empty-padding-start);
}
.alert-head + .alert-message {
padding-top: 0;
}
// Material Design Alert Input
// --------------------------------------------------
.alert-input {
@include margin($alert-md-input-margin-top, $alert-md-input-margin-end, $alert-md-input-margin-bottom, $alert-md-input-margin-start);
border-bottom: $alert-md-input-border-width $alert-md-input-border-style $alert-md-input-border-color;
color: $alert-md-input-text-color;
&::placeholder {
color: $alert-md-input-placeholder-color;
font-family: inherit;
font-weight: inherit;
}
&::-ms-clear {
display: none;
}
}
.alert-input:focus {
@include margin(null, null, $alert-md-input-margin-bottom - 1, null);
border-bottom: $alert-md-input-border-width-focused $alert-md-input-border-style-focused $alert-md-input-border-color-focused;
}
// Material Design Alert Radio/Checkbox Group
// --------------------------------------------------
.alert-radio-group,
.alert-checkbox-group {
position: relative;
border-top: $alert-md-list-border-top;
border-bottom: $alert-md-list-border-bottom;
overflow: auto;
}
/**
* MD Alerts on tablets can expand vertically up to
* a total maximum height. We only want to set a max-height
* on mobile phones.
*/
@include mobile-viewport() {
.alert-radio-group,
.alert-checkbox-group {
max-height: $alert-md-content-max-height;
}
}
.alert-tappable {
position: relative;
min-height: $alert-md-tappable-height;
}
// Material Design Alert Radio
// --------------------------------------------------
.alert-radio-label {
@include padding($alert-md-radio-label-padding-top, $alert-md-radio-label-padding-end, $alert-md-radio-label-padding-bottom, $alert-md-radio-label-padding-start);
flex: 1;
color: $alert-md-radio-label-text-color;
font-size: $alert-md-radio-label-font-size;
}
// Material Design Alert Radio Unchecked Circle
// ---------------------------------------------------
.alert-radio-icon {
@include position($alert-md-radio-top, null, null, $alert-md-radio-left);
@include border-radius($alert-md-radio-border-radius);
display: block;
position: relative;
width: $alert-md-radio-width;
height: $alert-md-radio-height;
border-width: $alert-md-radio-border-width;
border-style: $alert-md-radio-border-style;
border-color: $alert-md-radio-border-color-off;
}
// Material Design Alert Radio Checked Dot
// ---------------------------------------------------
.alert-radio-inner {
@include position($alert-md-radio-icon-top, null, null, $alert-md-radio-icon-start);
@include border-radius($alert-md-radio-icon-border-radius);
position: absolute;
width: $alert-md-radio-icon-width;
height: $alert-md-radio-icon-height;
transform: $alert-md-radio-icon-transform-off;
transition: $alert-md-radio-icon-transition;
background-color: $alert-md-radio-border-color-on;
}
// Material Design Alert Radio Checked
// ---------------------------------------------------
[aria-checked=true] .alert-radio-label {
color: $alert-md-radio-label-text-color-checked;
}
[aria-checked=true] .alert-radio-icon {
border-color: $alert-md-radio-border-color-on;
}
[aria-checked=true] .alert-radio-inner {
transform: $alert-md-radio-icon-transform-on;
}
// Material Design Alert Checkbox Label
// --------------------------------------------------
.alert-checkbox-label {
@include padding($alert-md-checkbox-label-padding-top, $alert-md-checkbox-label-padding-end, $alert-md-checkbox-label-padding-bottom, $alert-md-checkbox-label-padding-start);
flex: 1;
// Required for the checkbox icon to stay on the screen without
// being squished when the font size scales up.
width: calc(100% - $alert-md-checkbox-label-padding-start);
color: $alert-md-checkbox-label-text-color;
font-size: $alert-md-checkbox-label-font-size;
}
// Material Design Alert Checkbox Outline: Unchecked
// --------------------------------------------------
.alert-checkbox-icon {
@include position($alert-md-checkbox-top, null, null, $alert-md-checkbox-left);
@include border-radius($alert-md-checkbox-border-radius);
position: relative;
width: $alert-md-checkbox-width;
height: $alert-md-checkbox-height;
border-width: $alert-md-checkbox-border-width;
border-style: $alert-md-checkbox-border-style;
border-color: $alert-md-checkbox-border-color-off;
contain: strict;
}
// Material Design Alert Checkbox Checkmark: Checked
// --------------------------------------------------
[aria-checked=true] .alert-checkbox-icon {
border-color: $alert-md-checkbox-border-color-on;
background-color: $alert-md-checkbox-border-color-on;
}
[aria-checked=true] .alert-checkbox-inner {
@include position($alert-md-checkbox-icon-top, null, null, $alert-md-checkbox-icon-start);
position: absolute;
width: $alert-md-checkbox-icon-width;
height: $alert-md-checkbox-icon-height;
transform: $alert-md-checkbox-icon-transform;
border-width: $alert-md-checkbox-icon-border-width;
border-top-width: 0;
border-left-width: 0;
border-style: $alert-md-checkbox-icon-border-style;
border-color: $alert-md-checkbox-icon-border-color;
}
// Material Design Alert Button
// --------------------------------------------------
.alert-button-group {
@include padding(8px);
box-sizing: border-box;
flex-wrap: $alert-md-button-group-flex-wrap;
justify-content: $alert-md-button-group-justify-content;
}
.alert-button {
@include border-radius($alert-md-button-border-radius);
@include margin($alert-md-button-margin-top, $alert-md-button-margin-end, $alert-md-button-margin-bottom, $alert-md-button-margin-start);
@include padding($alert-md-button-padding-top, $alert-md-button-padding-end, $alert-md-button-padding-bottom, $alert-md-button-padding-start);
// necessary for ripple to work properly
position: relative;
background-color: $alert-md-button-background-color;
color: $alert-md-button-text-color;
font-weight: $alert-md-button-font-weight;
text-align: $alert-md-button-text-align;
text-transform: $alert-md-button-text-transform;
overflow: hidden;
}
.alert-button-inner {
justify-content: $alert-md-button-group-justify-content;
}
/**
* MD alerts should scale up to 560px x 560px
* on tablet dimensions.
*/
@include tablet-viewport() {
:host {
--max-width: #{$alert-md-max-width-tablet};
--max-height: #{$alert-md-max-height-tablet};
}
}