mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Issue number: resolves #28406 --------- <!-- 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. --> As part of https://github.com/ionic-team/ionic-framework/pull/27898 we updated the radio and checkbox labels to wrap to the next line instead of truncate. However, we did not consider long words. As a result, long words run outside of the container. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - The radio and checkbox labels now break on words too in addition to white space characters. ## 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. --> --------- Co-authored-by: ionitron <hi@ionicframework.com>
243 lines
4.7 KiB
SCSS
243 lines
4.7 KiB
SCSS
@import "./alert.vars";
|
|
|
|
// Alert
|
|
// --------------------------------------------------
|
|
|
|
:host {
|
|
/**
|
|
* @prop --background: Background of the alert
|
|
*
|
|
* @prop --min-width: Minimum width of the alert
|
|
* @prop --width: Width of the alert
|
|
* @prop --max-width: Maximum width of the alert
|
|
*
|
|
* @prop --min-height: Minimum height of the alert
|
|
* @prop --height: Height of the alert
|
|
* @prop --max-height: Maximum height of the alert
|
|
*
|
|
* @prop --backdrop-opacity: Opacity of the backdrop
|
|
*/
|
|
--min-width: #{$alert-min-width};
|
|
--width: auto;
|
|
--min-height: auto;
|
|
--height: auto;
|
|
--max-height: #{$alert-max-height};
|
|
|
|
@include font-smoothing();
|
|
@include position(0, 0, 0, 0);
|
|
|
|
display: flex;
|
|
position: absolute;
|
|
|
|
align-items: center;
|
|
justify-content: center;
|
|
|
|
outline: none;
|
|
|
|
font-family: $font-family-base;
|
|
|
|
contain: strict;
|
|
touch-action: none;
|
|
user-select: none;
|
|
z-index: $z-index-overlay;
|
|
}
|
|
|
|
:host(.overlay-hidden) {
|
|
display: none;
|
|
}
|
|
|
|
:host(.alert-top) {
|
|
@include padding(50px, null, null, null);
|
|
|
|
align-items: flex-start;
|
|
}
|
|
|
|
.alert-wrapper {
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
width: var(--width);
|
|
min-width: var(--min-width);
|
|
max-width: var(--max-width);
|
|
|
|
height: var(--height);
|
|
min-height: var(--min-height);
|
|
max-height: var(--max-height);
|
|
|
|
background: var(--background);
|
|
|
|
contain: content;
|
|
opacity: 0;
|
|
z-index: $z-index-overlay-wrapper;
|
|
}
|
|
|
|
.alert-title {
|
|
@include margin(0);
|
|
@include padding(0);
|
|
}
|
|
|
|
.alert-sub-title {
|
|
@include margin(5px, 0, 0);
|
|
@include padding(0);
|
|
|
|
font-weight: normal;
|
|
}
|
|
|
|
.alert-message {
|
|
box-sizing: border-box;
|
|
-webkit-overflow-scrolling: touch;
|
|
overflow-y: auto;
|
|
overscroll-behavior-y: contain;
|
|
}
|
|
|
|
.alert-checkbox-label,
|
|
.alert-radio-label {
|
|
/**
|
|
* This allows long words to wrap to the next line
|
|
* instead of flowing outside of the container.
|
|
*
|
|
* The "anywhere" keyword should be used instead
|
|
* of the "break-word" keyword since the parent
|
|
* container is using flexbox. Flex relies on min-content and
|
|
* max-content intrinsic sizes to structure the layout. Flex will
|
|
* wrap content only until it reaches its min-content intrinsic size
|
|
* which in this case is equal to the longest word in this container.
|
|
* "break-word" does not shrink the min-content intrinsic size
|
|
* of the flex item which causes the long word to still overflow.
|
|
* "anywhere" on the other hand does shrink the min-content
|
|
* intrinsic size which allows the long word to wrap to the next line.
|
|
*/
|
|
overflow-wrap: anywhere;
|
|
}
|
|
|
|
/**
|
|
* Scrollbars on mobile devices will be hidden.
|
|
* Users can still scroll the content by swiping.
|
|
* If a user has a fine pointing device, such as a
|
|
* mouse or trackpad, then scrollbars will be
|
|
* visible. This allows users to scroll the
|
|
* content with their pointing device.
|
|
* Otherwise, the user would have to use the
|
|
* keyboard to navigate through the options.
|
|
* This may not be intuitive for users who
|
|
* are not familiar with keyboard navigation.
|
|
*/
|
|
@media (any-pointer: coarse) {
|
|
.alert-checkbox-group::-webkit-scrollbar,
|
|
.alert-radio-group::-webkit-scrollbar,
|
|
.alert-message::-webkit-scrollbar {
|
|
display: none;
|
|
}
|
|
}
|
|
|
|
.alert-input {
|
|
@include padding(10px, 0);
|
|
|
|
width: 100%;
|
|
|
|
border: 0;
|
|
|
|
background: inherit;
|
|
|
|
font: inherit;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.alert-button-group {
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
width: 100%;
|
|
}
|
|
|
|
.alert-button-group-vertical {
|
|
flex-direction: column;
|
|
flex-wrap: nowrap;
|
|
}
|
|
|
|
.alert-button {
|
|
@include margin(0);
|
|
|
|
display: block;
|
|
|
|
border: 0;
|
|
|
|
font-size: $alert-button-font-size;
|
|
|
|
line-height: $alert-button-line-height;
|
|
|
|
z-index: 0;
|
|
}
|
|
|
|
.alert-button.ion-focused,
|
|
.alert-tappable.ion-focused {
|
|
background: $background-color-step-100;
|
|
}
|
|
|
|
.alert-button-inner {
|
|
display: flex;
|
|
|
|
flex-flow: row nowrap;
|
|
flex-shrink: 0;
|
|
align-items: center;
|
|
justify-content: center;
|
|
|
|
width: 100%;
|
|
height: 100%;
|
|
|
|
min-height: inherit;
|
|
}
|
|
|
|
|
|
// Alert Button: Disabled
|
|
// --------------------------------------------------
|
|
.alert-input-disabled,
|
|
.alert-checkbox-button-disabled .alert-button-inner,
|
|
.alert-radio-button-disabled .alert-button-inner {
|
|
cursor: default;
|
|
opacity: .5;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.alert-tappable {
|
|
@include margin(0);
|
|
@include padding(0);
|
|
|
|
display: flex;
|
|
|
|
width: 100%;
|
|
|
|
border: 0;
|
|
|
|
background: transparent;
|
|
|
|
font-size: inherit;
|
|
|
|
line-height: initial;
|
|
|
|
text-align: start;
|
|
appearance: none;
|
|
|
|
contain: content;
|
|
}
|
|
|
|
.alert-button,
|
|
.alert-checkbox,
|
|
.alert-input,
|
|
.alert-radio {
|
|
outline: none;
|
|
}
|
|
|
|
.alert-radio-icon,
|
|
.alert-checkbox-icon,
|
|
.alert-checkbox-inner {
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
textarea.alert-input {
|
|
min-height: $alert-input-min-height;
|
|
resize: none;
|
|
}
|