@limetech/lime-elements
Version:
409 lines (388 loc) • 13.3 kB
CSS
@charset "UTF-8";
.text {
transition: padding-left 0.4s ease;
}
limel-linear-progress {
position: absolute;
z-index: 1;
margin: auto;
left: 0.25rem;
width: 1.25rem;
}
:host(limel-chip[loading]) .chip:before {
content: "";
position: absolute;
left: 0;
width: var(--limel-chip-height);
height: var(--limel-chip-height);
border-radius: 50%;
scale: 0.9;
background-color: rgba(var(--contrast-600), 0.8);
}
:host(limel-chip[loading]) .chip:not(:has(limel-icon)) .text {
padding-left: calc(var(--limel-chip-height) + 0.25rem);
}
div[role=progressbar] {
--limel-chip-progressbar-offset: 0.1875rem;
--limel-chip-progressbar-stripe-color: rgb(var(--contrast-100), 0.3);
--limel-chip-progressbar-stripe-size: 1.5rem;
pointer-events: none;
position: absolute;
display: flex;
align-items: center;
justify-content: end;
inset: var(--limel-chip-progressbar-offset);
max-width: calc(100% - var(--limel-chip-progressbar-offset) * 2);
border-radius: inherit;
background-color: var(--chip-progress-color, rgb(var(--contrast-700)));
width: var(--limel-chip-progress-percentage);
opacity: 0.8;
mix-blend-mode: var(--limel-chip-progress-mix-blend-mode);
}
div[role=progressbar]:after {
content: "";
transform: translate3d(0, 0, 0);
position: absolute;
inset: 1px;
background-image: linear-gradient(-45deg, var(--limel-chip-progressbar-stripe-color) 25%, transparent 25%, transparent 50%, var(--limel-chip-progressbar-stripe-color) 50%, var(--limel-chip-progressbar-stripe-color) 75%, transparent 75%, transparent);
z-index: 1;
background-size: var(--limel-chip-progressbar-stripe-size) var(--limel-chip-progressbar-stripe-size);
animation: move 2.5s linear infinite;
border-radius: inherit;
}
@media (prefers-reduced-motion) {
div[role=progressbar]:after {
animation: none;
}
}
@keyframes move {
0% {
background-position: 0 0;
}
100% {
background-position: calc(var(--limel-chip-progressbar-stripe-size) * -1) calc(var(--limel-chip-progressbar-stripe-size) * -1);
}
}
/**
* Note! This file is forwarded via `src/style/exports.scss`
* and exposed to consumers through the root `index.scss`.
*
* Consumers import it using:
* `@use '@limetech/lime-elements' as lime-elements;`
*
* Legacy import paths (`dist/scss/mixins`) are maintained
* for backward compatibility via copy rules in the Stencil config.
*/
/**
* This can be used on a trigger element that opens a dropdown menu or a popover.
*/
/**
* This mixin will mask out the content that is close to
* the edges of a scrollable area.
* - If the scrollable content has `overflow-y`, use `vertically`
* as an argument for `$direction`.
- If the scrollable content has `overflow-x`, use `horizontally`
* as an argument for `$direction`.
*
* For the visual effect to work smoothly, we need to make sure that
* the size of the fade-out edge effect is the same as the
* internal paddings of the scrollable area. Otherwise, content of a
* scrollable area that does not have a padding will fade out before
* any scrolling has been done.
* This is why this mixin already adds paddings, which automatically
* default to the size of the fade-out effect.
* This size defaults to `1rem`, but to override the size use
* `--limel-top-edge-fade-height` & `--limel-bottom-edge-fade-height`
* when `vertically` argument is set, and use
* `--limel-left-edge-fade-width` & `--limel-right-edge-fade-width`
* when `horizontally` argument is set.
* Of course you can also programmatically increase and decrease the
* size of these variables for each edge, based on the amount of
* scrolling that has been done by the user. In this case, make sure
* to add a custom padding where the mixin is used, to override
* the paddings that are automatically added by the mixin in the
* compiled CSS code.
*/
/**
* This mixin will add an animated underline to the bottom of an `a` elements.
* Note that you may need to add `all: unset;` –depending on your use case–
* before using this mixin.
*/
/**
* This mixin creates a cross-browser font stack.
* - `sans-serif` can be used for the UI of the components.
* - `monospace` can be used for code.
*
* ⚠️ If we change the font stacks, we need to update
* 1. the consumer documentation in `README.md`, and
* 2. the CSS variables of `--kompendium-example-font-family`
* in the `<style>` tag of `index.html`.
*/
/**
* This mixin is a hack, using old CSS syntax
* to enable you to truncate a piece of text,
* after a certain number of lines.
*/
/**
* This mixin will add a chessboard background pattern,
* typically used to visualize transparency.
*/
/**
* Make a container resizable by the user.
* This is used in the documentations and examples
* of some components, to demonstrate how the component
* behaves in a resizable container.
*/
/**
* Drag to reorder mixins
*/
/**
* The breakpoints below are used to create responsive designs
* in Lime's products. Therefore, they are here to get distributed
* to all components in other private repos, which rely on this `mixins`
* file, to create consistent styles.
*
* :::important
* In very rare cases you should used media queries!
* Nowadays, there are many better ways of achieving responsive design
* without media queries. For example, using CSS Grid, Flexbox, and their features.
* :::
*/
/**
* Media query mixins for responsive design based on screen width.
* Note that these mixins do not detect the device type!
*/
/**
* @prop --chip-max-width: Maximum width of the chip. Defaults to `10rem`. Keep in mind that the chips should not appear too big.
* @prop --chip-progress-color: Color of the progress bar. Defaults to `rgb(var(--contrast-700))`.
* @prop --chip-readonly-border-color: Color of the border in readonly state. Defaults to `rgb(var(--contrast-800), 0.5)`.
*/
:host(limel-chip) {
--limel-chip-height: var(--limel-chip-size, 1.75rem);
--limel-chip-gap: 0.5rem;
isolation: isolate;
display: inline-flex;
align-items: center;
min-width: 0;
max-width: min(var(--chip-max-width, 100%), 25rem);
}
:host(limel-chip[size=small]) {
--limel-chip-height: 1.5rem;
--limel-chip-gap: 0.25rem;
}
* {
box-sizing: border-box;
}
.chip {
all: unset;
position: relative;
min-width: 0;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.25rem;
max-width: 100%;
height: var(--limel-chip-height);
border-radius: var(--limel-chip-height);
font-size: clamp(0.8125rem, var(--limel-chip-height) - 0.875rem, 1rem);
padding: 0 0.125rem;
}
.chip:has(limel-icon) .text, .chip:has(img) .text {
padding-left: 0;
}
.chip:not([disabled]):focus {
outline: none;
}
.chip:not([disabled]):focus-visible {
outline: none;
box-shadow: var(--shadow-depth-8-focused);
}
.chip:not([disabled]) {
transition: color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);
cursor: pointer;
color: var(--limel-theme-on-surface-color);
background-color: var(--lime-elevated-surface-background-color);
box-shadow: var(--button-shadow-normal);
}
.chip:not([disabled]):hover, .chip:not([disabled]):focus, .chip:not([disabled]):focus-visible {
will-change: color, background-color, box-shadow, transform;
}
.chip:not([disabled]):hover, .chip:not([disabled]):focus-visible {
transform: translate3d(0, 0.01rem, 0);
color: var(--limel-theme-on-surface-color);
background-color: var(--lime-elevated-surface-background-color);
}
.chip:not([disabled]):hover {
box-shadow: var(--button-shadow-hovered);
}
.chip:not([disabled]):active {
--limel-clickable-transform-timing-function: cubic-bezier(
0.83,
-0.15,
0.49,
1.16
);
transform: translate3d(0, 0.05rem, 0);
background-color: var(--limel-theme-surface-background-color);
box-shadow: var(--button-shadow-inset-pressed);
}
.chip:not([disabled]):hover, .chip:not([disabled]):active {
--limel-clickable-transition-speed: 0.2s;
--limel-clickable-transform-speed: 0.16s;
}
.chip:has(limel-badge) {
padding-right: 0.375rem;
}
.chip:has(limel-badge) .text {
padding-right: 0;
}
.chip:has(+ .remove-button:hover) {
box-shadow: var(--shadow-depth-8-error);
}
.chip:has(+ limel-menu), .chip:has(+ .trailing-button) {
padding-right: calc(var(--limel-chip-height) + 0.125rem);
}
.chip:has(+ limel-menu) .text, .chip:has(+ .trailing-button) .text {
padding-right: 0;
}
:host(limel-chip[disabled]:not([disabled=false])) .chip {
color: rgba(var(--contrast-1600), 0.37);
background-color: rgba(var(--contrast-1600), 0.1);
box-shadow: none;
}
:host(limel-chip[readonly]:not([readonly=false])) .chip {
box-shadow: 0 0 0 1px var(--chip-readonly-border-color, rgb(var(--contrast-800), 0.5));
}
:host(limel-chip[selected]:not([selected=false])) .chip {
box-shadow: var(--button-shadow-inset);
}
:host(limel-chip[selected]:not([selected=false])) .chip:focus-visible {
box-shadow: var(--button-shadow-inset), var(--shadow-depth-8-focused);
}
:host(limel-chip[selected]:not([selected=false])) .chip:active {
box-shadow: var(--button-shadow-inset-pressed);
}
:host(limel-chip[selected]:not([selected=false])) .text {
color: var(--lime-primary-color, var(--limel-theme-primary-color));
}
:host([aria-expanded=true]) .chip,
:host([aria-expanded]:not([aria-expanded=false])) .chip {
box-shadow: var(--button-shadow-inset-pressed) ;
}
:host(limel-chip[type=filter]) .chip {
border-top-left-radius: 0.5rem;
border-bottom-left-radius: 0.5rem;
}
:host(limel-chip[type=filter]) .chip:after {
content: "";
transition: background-color 0.4s ease 0.2s, box-shadow 0.6s ease 0.2s;
box-sizing: border-box;
position: absolute;
bottom: 0.125rem;
left: 0.125rem;
width: 0.5rem;
height: 0.5rem;
border-radius: 50%;
background-color: rgb(var(--contrast-800), 0.8);
box-shadow: 0 0 0 1px rgb(var(--color-white)) inset;
}
:host(limel-chip[type=filter][selected]) .chip:after {
background-color: rgb(var(--color-green-default));
box-shadow: 0 0 0.375rem 0 rgb(var(--color-green-light)), 0 0 0 1px rgb(var(--color-white)) inset;
}
:host(limel-chip[invalid]) .chip {
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%208%208'%20style='fill-rule:evenodd;'%3E%3Cpath%20fill='rgba(186,186,192,0.16)'%20d='M0%200h4v4H0zM4%204h4v4H4z'/%3E%3C/svg%3E");
background-size: 0.5rem;
background-color: rgb(var(--color-red-default));
}
:host(limel-chip[invalid]) .text {
color: rgb(var(--color-white));
}
img,
limel-icon {
flex-shrink: 0;
width: calc(var(--limel-chip-height) - 0.25rem);
height: calc(var(--limel-chip-height) - 0.25rem);
}
img {
object-fit: cover;
border-radius: 50%;
}
limel-icon {
padding: 0.0625rem;
}
limel-badge {
pointer-events: none;
}
.text {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
line-height: 1.2;
padding: 0 0.5rem;
font-size: var(--limel-theme-default-font-size);
}
.trailing-button {
all: unset;
transition: color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);
cursor: pointer;
color: var(--limel-theme-on-surface-color);
background-color: transparent;
}
.trailing-button:hover, .trailing-button:focus, .trailing-button:focus-visible {
will-change: color, background-color, box-shadow, transform;
}
.trailing-button:hover, .trailing-button:focus-visible {
transform: translate3d(0, 0.01rem, 0);
color: var(--limel-theme-on-surface-color);
background-color: var(--lime-elevated-surface-background-color);
}
.trailing-button:hover {
box-shadow: var(--button-shadow-hovered);
}
.trailing-button:active {
--limel-clickable-transform-timing-function: cubic-bezier(
0.83,
-0.15,
0.49,
1.16
);
transform: translate3d(0, 0.05rem, 0);
box-shadow: var(--button-shadow-pressed);
}
.trailing-button:hover, .trailing-button:active {
--limel-clickable-transition-speed: 0.2s;
--limel-clickable-transform-speed: 0.16s;
}
.trailing-button {
z-index: 1;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
margin-left: calc(var(--limel-chip-height) * -1 + 0.125rem);
margin-right: 0.125rem;
width: calc(var(--limel-chip-height) - 0.25rem);
height: calc(var(--limel-chip-height) - 0.25rem);
border-radius: 50%;
}
.trailing-button svg {
transition: color 0.2s ease, transform 0.2s ease;
width: 1.25rem;
}
.trailing-button.remove-button:hover {
color: rgb(var(--color-red-dark));
}
.trailing-button.remove-button:hover svg {
transform: scale(0.8);
}
limel-menu button[slot=trigger]:focus {
outline: none;
}
limel-menu button[slot=trigger]:focus-visible {
outline: none;
box-shadow: var(--shadow-depth-8-focused);
}
limel-menu[open] button[slot=trigger] {
box-shadow: var(--button-shadow-inset);
}