@ionic/core
Version:
Base components for Ionic
751 lines (692 loc) • 21.6 kB
CSS
/**
* Convert a font size to a dynamic font size.
* Fonts that participate in Dynamic Type should use
* dynamic font sizes.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param unit (optional) - The unit to convert to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* Convert a font size to a dynamic font size but impose
* a maximum font size.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param maxScale - The maximum scale of the font (i.e. 2.5 for a maximum 250% scale).
* @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* Convert a font size to a dynamic font size but impose
* a minimum font size.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param minScale - The minimum scale of the font (i.e. 0.8 for a minimum 80% scale).
* @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* Convert a font size to a dynamic font size but impose
* maximum and minimum font sizes.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param minScale - The minimum scale of the font (i.e. 0.8 for a minimum 80% scale).
* @param maxScale - The maximum scale of the font (i.e. 2.5 for a maximum 250% scale).
* @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* A heuristic that applies CSS to tablet
* viewports.
*
* Usage:
* @include tablet-viewport() {
* :host {
* background-color: green;
* }
* }
*/
/**
* A heuristic that applies CSS to mobile
* viewports (i.e. phones, not tablets).
*
* Usage:
* @include mobile-viewport() {
* :host {
* background-color: blue;
* }
* }
*/
:host {
/**
* @prop --background: Background of the item
* @prop --background-activated: Background of the item when pressed. Note: setting this will interfere with the Material Design ripple.
* @prop --background-activated-opacity: Opacity of the item background when pressed
* @prop --background-focused: Background of the item when focused with the tab key
* @prop --background-focused-opacity: Opacity of the item background when focused with the tab key
* @prop --background-hover: Background of the item on hover
* @prop --background-hover-opacity: Opacity of the background of the item on hover
*
* @prop --border-color: Color of the item border
* @prop --border-radius: Radius of the item border
* @prop --border-style: Style of the item border
* @prop --border-width: Width of the item border
*
* @prop --color: Color of the item
* @prop --color-activated: Color of the item when pressed
* @prop --color-focused: Color of the item when focused with the tab key
* @prop --color-hover: Color of the item on hover
*
* @prop --detail-icon-color: Color of the item detail icon
* @prop --detail-icon-opacity: Opacity of the item detail icon
* @prop --detail-icon-font-size: Font size of the item detail icon
*
* @prop --inner-border-width: Width of the item inner border
* @prop --inner-box-shadow: Box shadow of the item inner
* @prop --inner-padding-top: Top padding of the item inner
* @prop --inner-padding-end: Right padding if direction is left-to-right, and left padding if direction is right-to-left of the item inner
* @prop --inner-padding-bottom: Bottom padding of the item inner
* @prop --inner-padding-start: Left padding if direction is left-to-right, and right padding if direction is right-to-left of the item inner
*
* @prop --min-height: Minimum height of the item
*
* @prop --padding-bottom: Bottom padding of the item
* @prop --padding-end: Right padding if direction is left-to-right, and left padding if direction is right-to-left of the item
* @prop --padding-start: Left padding if direction is left-to-right, and right padding if direction is right-to-left of the item
* @prop --padding-top: Top padding of the item
*
* @prop --transition: Transition of the item
*
* @prop --ripple-color: Color of the item ripple effect
*
*/
--border-radius: 0px;
--border-width: 0px;
--border-style: solid;
--padding-top: 0px;
--padding-bottom: 0px;
--padding-end: 0px;
--padding-start: 0px;
--inner-border-width: 0px;
--inner-padding-top: 0px;
--inner-padding-bottom: 0px;
--inner-padding-start: 0px;
--inner-padding-end: 0px;
--inner-box-shadow: none;
--detail-icon-color: initial;
--detail-icon-font-size: 1.25em;
--detail-icon-opacity: 0.25;
--color-activated: var(--color);
--color-focused: var(--color);
--color-hover: var(--color);
--ripple-color: currentColor;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
display: block;
position: relative;
align-items: center;
justify-content: space-between;
outline: none;
color: var(--color);
font-family: var(--ion-font-family, inherit);
text-align: initial;
text-decoration: none;
overflow: hidden;
box-sizing: border-box;
}
:host(.ion-color) .item-native {
background: var(--ion-color-base);
color: var(--ion-color-contrast);
}
:host(.ion-color) .item-native,
:host(.ion-color) .item-inner {
border-color: var(--ion-color-shade);
}
:host(.ion-activated) .item-native {
color: var(--color-activated);
}
:host(.ion-activated) .item-native::after {
background: var(--background-activated);
opacity: var(--background-activated-opacity);
}
:host(.ion-color.ion-activated) .item-native {
color: var(--ion-color-contrast);
}
:host(.ion-focused) .item-native {
color: var(--color-focused);
}
:host(.ion-focused) .item-native::after {
background: var(--background-focused);
opacity: var(--background-focused-opacity);
}
:host(.ion-color.ion-focused) .item-native {
color: var(--ion-color-contrast);
}
:host(.ion-color.ion-focused) .item-native::after {
background: var(--ion-color-contrast);
}
@media (any-hover: hover) {
:host(.ion-activatable:not(.ion-focused):hover) .item-native {
color: var(--color-hover);
}
:host(.ion-activatable:not(.ion-focused):hover) .item-native::after {
background: var(--background-hover);
opacity: var(--background-hover-opacity);
}
:host(.ion-color.ion-activatable:not(.ion-focused):hover) .item-native {
color: var(--ion-color-contrast);
}
:host(.ion-color.ion-activatable:not(.ion-focused):hover) .item-native::after {
background: var(--ion-color-contrast);
}
}
:host(.item-control-needs-pointer-cursor) {
cursor: pointer;
}
:host(.item-interactive-disabled:not(.item-multiple-inputs)) {
cursor: default;
pointer-events: none;
}
:host(.item-disabled) {
cursor: default;
opacity: 0.3;
pointer-events: none;
}
.item-native {
border-radius: var(--border-radius);
margin-left: 0;
margin-right: 0;
margin-top: 0;
margin-bottom: 0;
padding-top: var(--padding-top);
padding-bottom: var(--padding-bottom);
font-family: inherit;
font-size: inherit;
font-style: inherit;
font-weight: inherit;
letter-spacing: inherit;
text-decoration: inherit;
text-indent: inherit;
text-overflow: inherit;
text-transform: inherit;
text-align: inherit;
white-space: inherit;
color: inherit;
/* stylelint-disable */
padding-right: var(--padding-end);
padding-left: calc(var(--padding-start) + var(--ion-safe-area-left, 0px));
/* stylelint-enable */
display: flex;
position: relative;
align-items: inherit;
justify-content: inherit;
width: 100%;
min-height: var(--min-height);
transition: var(--transition);
border-width: var(--border-width);
border-style: var(--border-style);
border-color: var(--border-color);
outline: none;
background: var(--background);
overflow: inherit;
z-index: 1;
box-sizing: border-box;
}
:host-context([dir=rtl]) .item-native {
padding-right: calc(var(--padding-start) + var(--ion-safe-area-right, 0px));
padding-left: var(--padding-end);
}
[dir=rtl] .item-native {
padding-right: calc(var(--padding-start) + var(--ion-safe-area-right, 0px));
padding-left: var(--padding-end);
}
@supports selector(:dir(rtl)) {
.item-native:dir(rtl) {
padding-right: calc(var(--padding-start) + var(--ion-safe-area-right, 0px));
padding-left: var(--padding-end);
}
}
.item-native::-moz-focus-inner {
border: 0;
}
.item-native::after {
left: 0;
right: 0;
top: 0;
bottom: 0;
position: absolute;
content: "";
opacity: 0;
transition: var(--transition);
z-index: -1;
}
button,
a {
cursor: pointer;
user-select: none;
-webkit-user-drag: none;
}
.item-inner {
margin-left: 0;
margin-right: 0;
margin-top: 0;
margin-bottom: 0;
padding-top: var(--inner-padding-top);
padding-bottom: var(--inner-padding-bottom);
/* stylelint-disable */
padding-right: calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));
padding-left: var(--inner-padding-start);
/* stylelint-enable */
display: flex;
position: relative;
flex: 1;
flex-direction: inherit;
align-items: inherit;
align-self: stretch;
min-height: inherit;
border-width: var(--inner-border-width);
border-style: var(--border-style);
border-color: var(--border-color);
box-shadow: var(--inner-box-shadow);
overflow: inherit;
box-sizing: border-box;
}
:host-context([dir=rtl]) .item-inner {
padding-right: var(--inner-padding-start);
padding-left: calc(var(--ion-safe-area-left, 0px) + var(--inner-padding-end));
}
[dir=rtl] .item-inner {
padding-right: var(--inner-padding-start);
padding-left: calc(var(--ion-safe-area-left, 0px) + var(--inner-padding-end));
}
@supports selector(:dir(rtl)) {
.item-inner:dir(rtl) {
padding-right: var(--inner-padding-start);
padding-left: calc(var(--ion-safe-area-left, 0px) + var(--inner-padding-end));
}
}
.item-detail-icon {
/**
* IonItem applies its own end padding. However,
* all IonIcons have the same bounding box meaning
* there may be white space for narrow icons. As
* a result, the white space gives the appearance
* that there is too much end margin. We move the default
* chevron icon over to account for this extra whitespace.
*/
-webkit-margin-start: calc(var(--inner-padding-end) / 2);
margin-inline-start: calc(var(--inner-padding-end) / 2);
-webkit-margin-end: -6px;
margin-inline-end: -6px;
color: var(--detail-icon-color);
font-size: var(--detail-icon-font-size);
opacity: var(--detail-icon-opacity);
}
::slotted(ion-icon) {
font-size: 1.6em;
}
::slotted(ion-button) {
--margin-top: 0;
--margin-bottom: 0;
--margin-start: 0;
--margin-end: 0;
z-index: 1;
}
::slotted(ion-label:not([slot=end])) {
flex: 1;
width: min-content;
/**
* We allow labels in the default
* slot to grow. However, we do not
* want them to grow indefinitely.
*/
max-width: 100%;
}
:host(.item-input) {
align-items: center;
}
.input-wrapper {
display: flex;
flex: 1;
flex-direction: inherit;
align-items: inherit;
align-self: stretch;
text-overflow: ellipsis;
overflow: inherit;
box-sizing: border-box;
}
:host(.item-label-stacked),
:host(.item-label-floating) {
align-items: start;
}
:host(.item-label-stacked) .input-wrapper,
:host(.item-label-floating) .input-wrapper {
flex: 1;
flex-direction: column;
}
:host(.item-multiple-inputs) ::slotted(ion-checkbox),
:host(.item-multiple-inputs) ::slotted(ion-datetime),
:host(.item-multiple-inputs) ::slotted(ion-radio) {
position: relative;
}
:host(.item-textarea) {
align-items: stretch;
}
::slotted(ion-reorder[slot]) {
margin-top: 0;
margin-bottom: 0;
}
ion-ripple-effect {
color: var(--ripple-color);
}
/**
* Convert a font size to a dynamic font size.
* Fonts that participate in Dynamic Type should use
* dynamic font sizes.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param unit (optional) - The unit to convert to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* Convert a font size to a dynamic font size but impose
* a maximum font size.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param maxScale - The maximum scale of the font (i.e. 2.5 for a maximum 250% scale).
* @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* Convert a font size to a dynamic font size but impose
* a minimum font size.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param minScale - The minimum scale of the font (i.e. 0.8 for a minimum 80% scale).
* @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* Convert a font size to a dynamic font size but impose
* maximum and minimum font sizes.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param minScale - The minimum scale of the font (i.e. 0.8 for a minimum 80% scale).
* @param maxScale - The maximum scale of the font (i.e. 2.5 for a maximum 250% scale).
* @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* A heuristic that applies CSS to tablet
* viewports.
*
* Usage:
* @include tablet-viewport() {
* :host {
* background-color: green;
* }
* }
*/
/**
* A heuristic that applies CSS to mobile
* viewports (i.e. phones, not tablets).
*
* Usage:
* @include mobile-viewport() {
* :host {
* background-color: blue;
* }
* }
*/
/**
* Convert a font size to a dynamic font size.
* Fonts that participate in Dynamic Type should use
* dynamic font sizes.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param unit (optional) - The unit to convert to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* Convert a font size to a dynamic font size but impose
* a maximum font size.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param maxScale - The maximum scale of the font (i.e. 2.5 for a maximum 250% scale).
* @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* Convert a font size to a dynamic font size but impose
* a minimum font size.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param minScale - The minimum scale of the font (i.e. 0.8 for a minimum 80% scale).
* @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* Convert a font size to a dynamic font size but impose
* maximum and minimum font sizes.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param minScale - The minimum scale of the font (i.e. 0.8 for a minimum 80% scale).
* @param maxScale - The maximum scale of the font (i.e. 2.5 for a maximum 250% scale).
* @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* A heuristic that applies CSS to tablet
* viewports.
*
* Usage:
* @include tablet-viewport() {
* :host {
* background-color: green;
* }
* }
*/
/**
* A heuristic that applies CSS to mobile
* viewports (i.e. phones, not tablets).
*
* Usage:
* @include mobile-viewport() {
* :host {
* background-color: blue;
* }
* }
*/
/**
* Convert a font size to a dynamic font size.
* Fonts that participate in Dynamic Type should use
* dynamic font sizes.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param unit (optional) - The unit to convert to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* Convert a font size to a dynamic font size but impose
* a maximum font size.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param maxScale - The maximum scale of the font (i.e. 2.5 for a maximum 250% scale).
* @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* Convert a font size to a dynamic font size but impose
* a minimum font size.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param minScale - The minimum scale of the font (i.e. 0.8 for a minimum 80% scale).
* @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* Convert a font size to a dynamic font size but impose
* maximum and minimum font sizes.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param minScale - The minimum scale of the font (i.e. 0.8 for a minimum 80% scale).
* @param maxScale - The maximum scale of the font (i.e. 2.5 for a maximum 250% scale).
* @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* A heuristic that applies CSS to tablet
* viewports.
*
* Usage:
* @include tablet-viewport() {
* :host {
* background-color: green;
* }
* }
*/
/**
* A heuristic that applies CSS to mobile
* viewports (i.e. phones, not tablets).
*
* Usage:
* @include mobile-viewport() {
* :host {
* background-color: blue;
* }
* }
*/
:host {
--min-height: 48px;
--background: var(--ion-item-background, var(--ion-background-color, #fff));
--background-activated: transparent;
--background-focused: currentColor;
--background-hover: currentColor;
--background-activated-opacity: 0;
--background-focused-opacity: .12;
--background-hover-opacity: .04;
--border-color: var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, var(--ion-background-color-step-150, rgba(0, 0, 0, 0.13)))));
--color: var(--ion-item-color, var(--ion-text-color, #000));
--transition: opacity 15ms linear, background-color 15ms linear;
--padding-start: 16px;
--inner-padding-end: 16px;
--inner-border-width: 0 0 1px 0;
font-size: 1rem;
font-weight: normal;
text-transform: none;
}
:host(.ion-color.ion-activated) .item-native::after {
background: transparent;
}
:host(.item-interactive) {
--border-width: 0 0 1px 0;
--inner-border-width: 0;
}
:host(.item-lines-full) {
--border-width: 0 0 1px 0;
}
:host(.item-lines-inset) {
--inner-border-width: 0 0 1px 0;
}
:host(.item-lines-inset),
:host(.item-lines-none) {
--border-width: 0;
}
:host(.item-lines-full),
:host(.item-lines-none) {
--inner-border-width: 0;
}
:host(.item-multi-line) ::slotted([slot=start]),
:host(.item-multi-line) ::slotted([slot=end]) {
margin-top: 16px;
margin-bottom: 16px;
align-self: flex-start;
}
::slotted([slot=start]) {
-webkit-margin-end: 16px;
margin-inline-end: 16px;
}
::slotted([slot=end]) {
-webkit-margin-start: 16px;
margin-inline-start: 16px;
}
::slotted(ion-icon) {
color: rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.54);
font-size: 1.5em;
}
:host(.ion-color) ::slotted(ion-icon) {
color: var(--ion-color-contrast);
}
::slotted(ion-icon[slot]) {
margin-top: 12px;
margin-bottom: 12px;
}
::slotted(ion-icon[slot=start]) {
-webkit-margin-end: 32px;
margin-inline-end: 32px;
}
::slotted(ion-icon[slot=end]) {
-webkit-margin-start: 16px;
margin-inline-start: 16px;
}
::slotted(ion-toggle[slot=start]),
::slotted(ion-toggle[slot=end]) {
margin-left: 0;
margin-right: 0;
margin-top: 0;
margin-bottom: 0;
}
::slotted(ion-note) {
margin-left: 0;
margin-right: 0;
margin-top: 0;
margin-bottom: 0;
align-self: flex-start;
font-size: 0.6875rem;
}
::slotted(ion-note[slot]) {
padding-left: 0;
padding-right: 0;
padding-top: 18px;
padding-bottom: 10px;
}
::slotted(ion-avatar) {
width: 40px;
height: 40px;
}
::slotted(ion-thumbnail) {
--size: 56px;
}
::slotted(ion-avatar),
::slotted(ion-thumbnail) {
margin-top: 8px;
margin-bottom: 8px;
}
::slotted(ion-avatar[slot=start]),
::slotted(ion-thumbnail[slot=start]) {
-webkit-margin-end: 16px;
margin-inline-end: 16px;
}
::slotted(ion-avatar[slot=end]),
::slotted(ion-thumbnail[slot=end]) {
-webkit-margin-start: 16px;
margin-inline-start: 16px;
}
::slotted(ion-label) {
margin-left: 0;
margin-right: 0;
margin-top: 10px;
margin-bottom: 10px;
}
:host(.item-label-stacked) ::slotted([slot=end]),
:host(.item-label-floating) ::slotted([slot=end]) {
margin-top: 7px;
margin-bottom: 7px;
}
:host(.item-toggle) ::slotted(ion-label),
:host(.item-radio) ::slotted(ion-label) {
-webkit-margin-start: 0;
margin-inline-start: 0;
}
::slotted(.button-small) {
--padding-top: 2px;
--padding-bottom: 2px;
--padding-start: .6em;
--padding-end: .6em;
min-height: 25px;
font-size: 0.75rem;
}
:host(.item-label-floating),
:host(.item-label-stacked) {
--min-height: 55px;
}
:host(.ion-focused:not(.ion-color)) ::slotted(.label-stacked),
:host(.ion-focused:not(.ion-color)) ::slotted(.label-floating),
:host(.item-has-focus:not(.ion-color)) ::slotted(.label-stacked),
:host(.item-has-focus:not(.ion-color)) ::slotted(.label-floating) {
color: var(--ion-color-primary, #0054e9);
}