@ionic/core
Version:
Base components for Ionic
207 lines (187 loc) • 5.36 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 chip
* @prop --color: Color of the chip
*/
--background: rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.12);
--color: rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.87);
border-radius: 16px;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
-webkit-margin-start: 4px;
margin-inline-start: 4px;
-webkit-margin-end: 4px;
margin-inline-end: 4px;
margin-top: 4px;
margin-bottom: 4px;
-webkit-padding-start: 12px;
padding-inline-start: 12px;
-webkit-padding-end: 12px;
padding-inline-end: 12px;
padding-top: 6px;
padding-bottom: 6px;
display: inline-flex;
position: relative;
align-items: center;
min-height: 32px;
background: var(--background);
color: var(--color);
font-family: var(--ion-font-family, inherit);
cursor: pointer;
overflow: hidden;
vertical-align: middle;
box-sizing: border-box;
}
:host(.chip-disabled) {
cursor: default;
opacity: 0.4;
pointer-events: none;
}
:host(.ion-color) {
background: rgba(var(--ion-color-base-rgb), 0.08);
color: var(--ion-color-shade);
}
:host(.ion-color:focus) {
background: rgba(var(--ion-color-base-rgb), 0.12);
}
:host(.ion-color.ion-activated) {
background: rgba(var(--ion-color-base-rgb), 0.16);
}
:host(.chip-outline) {
border-width: 1px;
border-style: solid;
}
:host(.chip-outline) {
border-color: rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.32);
background: transparent;
}
:host(.chip-outline.ion-color) {
border-color: rgba(var(--ion-color-base-rgb), 0.32);
}
:host(.chip-outline:not(.ion-color):focus) {
background: rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.04);
}
:host(.chip-outline.ion-activated:not(.ion-color)) {
background: rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.08);
}
::slotted(ion-icon) {
font-size: 1.4285714286em;
}
:host(:not(.ion-color)) ::slotted(ion-icon) {
color: rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.54);
}
::slotted(ion-icon:first-child) {
-webkit-margin-start: -4px;
margin-inline-start: -4px;
-webkit-margin-end: 8px;
margin-inline-end: 8px;
margin-top: -4px;
margin-bottom: -4px;
}
::slotted(ion-icon:last-child) {
-webkit-margin-start: 8px;
margin-inline-start: 8px;
-webkit-margin-end: -4px;
margin-inline-end: -4px;
margin-top: -4px;
margin-bottom: -4px;
}
::slotted(ion-avatar) {
flex-shrink: 0;
width: 1.7142857143em;
height: 1.7142857143em;
}
::slotted(ion-avatar:first-child) {
-webkit-margin-start: -8px;
margin-inline-start: -8px;
-webkit-margin-end: 8px;
margin-inline-end: 8px;
margin-top: -4px;
margin-bottom: -4px;
}
::slotted(ion-avatar:last-child) {
-webkit-margin-start: 8px;
margin-inline-start: 8px;
-webkit-margin-end: -8px;
margin-inline-end: -8px;
margin-top: -4px;
margin-bottom: -4px;
}
:host(:focus) {
outline: none;
}
:host(:focus) {
--background: rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.16);
}
:host(.ion-activated) {
--background: rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.2);
}
@media (any-hover: hover) {
:host(:hover) {
--background: rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.16);
}
:host(.ion-color:hover) {
background: rgba(var(--ion-color-base-rgb), 0.12);
}
:host(.chip-outline:not(.ion-color):hover) {
background: rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.04);
}
}
:host {
font-size: 0.875rem;
}