@limetech/lime-elements
Version:
193 lines (185 loc) • 6.21 kB
CSS
@charset "UTF-8";
/**
* 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!
*/
:host(limel-switch) {
min-height: 1.75rem;
display: flex;
flex-direction: column;
align-items: flex-start;
}
.switch {
display: grid;
grid-template-columns: auto 1fr;
gap: 0.5rem;
align-items: center;
width: 100%;
min-height: 1.75rem;
}
button {
border: none;
outline: none;
cursor: pointer;
transition: background-color calc(0.2s + 0.2s) ease;
flex-shrink: 0;
display: inline-flex;
align-items: center;
padding: 0;
width: 2.25rem;
height: 1.25rem;
border-radius: 1.25rem;
background-color: rgb(var(--contrast-700));
}
:host([disabled]) button {
opacity: 0.4;
cursor: not-allowed;
}
button[aria-checked=true] {
background-color: var(--lime-primary-color, var(--limel-theme-primary-color));
}
.handle {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 1.25rem;
height: 1.25rem;
border-radius: 50%;
transition: transform 0.2s cubic-bezier(0.46, 0.52, 0.27, 1.55), box-shadow 0.2s ease, background-color 0.2s ease;
transform: translateX(0);
}
button[aria-checked=true] .handle {
transform: translateX(1rem);
}
button:focus-visible .handle {
background-color: rgb(var(--color-white), 0.6);
box-shadow: var(--shadow-depth-8-focused), var(--shadow-brighten-edges-inside);
}
.handle:after {
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);
content: "";
position: absolute;
inset: 0.125rem;
border-radius: 50%;
background-color: var(--lime-elevated-surface-background-color);
box-shadow: var(--button-shadow-normal), var(--button-shadow-normal);
}
button:hover:not(:disabled) .handle:after {
box-shadow: var(--button-shadow-normal), var(--button-shadow-hovered);
}
svg {
width: 0.625rem;
height: 0.625rem;
fill: var(--lime-elevated-surface-background-color);
}
label {
font-size: var(--limel-theme-default-font-size);
cursor: pointer;
width: fit-content;
}
:host([disabled]) label {
cursor: not-allowed;
opacity: 0.4;
}
:host(limel-switch:focus),
:host(limel-switch:focus-visible),
:host(limel-switch:focus-within) {
--limel-h-l-grid-template-rows-transition-speed: 0.46s;
--limel-h-l-grid-template-rows: 1fr;
}
:host(limel-switch) {
--limel-h-l-grid-template-rows-transition-speed: 0.3s;
--limel-h-l-grid-template-rows: 0fr;
}
:host(limel-switch:focus) limel-helper-line,
:host(limel-switch:focus-visible) limel-helper-line,
:host(limel-switch:focus-within) limel-helper-line,
:host(limel-switch:hover) limel-helper-line {
will-change: grid-template-rows;
}