UNPKG

@limetech/lime-elements

Version:
394 lines (364 loc) 11.2 kB
@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([displays-percentage-colors].percent-0) { --lime-primary-color: var(--color-percent--0); } :host([displays-percentage-colors].percent-0-10) { --lime-primary-color: var(--color-percent--0to10); } :host([displays-percentage-colors].percent-10-20) { --lime-primary-color: var(--color-percent--10to20); } :host([displays-percentage-colors].percent-20-30) { --lime-primary-color: var(--color-percent--20to30); } :host([displays-percentage-colors].percent-30-40) { --lime-primary-color: var(--color-percent--30to40); } :host([displays-percentage-colors].percent-40-50) { --lime-primary-color: var(--color-percent--40to50); } :host([displays-percentage-colors].percent-50-60) { --lime-primary-color: var(--color-percent--50to60); } :host([displays-percentage-colors].percent-60-70) { --lime-primary-color: var(--color-percent--60to70); } :host([displays-percentage-colors].percent-70-80) { --lime-primary-color: var(--color-percent--70to80); } :host([displays-percentage-colors].percent-80-90) { --lime-primary-color: var(--color-percent--80to90); } :host([displays-percentage-colors].percent-90-100) { --lime-primary-color: var(--color-percent--90to100); } :host([displays-percentage-colors].percent-30-40) .indicator, :host([displays-percentage-colors].percent-40-50) .indicator, :host([displays-percentage-colors].percent-70-80) .indicator { color: rgb(var(--color-gray-darker)); } :host([displays-percentage-colors].percent-50-60) .indicator, :host([displays-percentage-colors].percent-60-70) .indicator { color: rgb(var(--color-gray-dark)); } :host([readonly]:not([readonly=false])) input[type=range] { cursor: default; } :host([readonly]:not([readonly=false])) .track, :host([readonly]:not([readonly=false])) .active, :host([readonly]:not([readonly=false])) .indicator { height: 0.75rem; } :host([readonly]:not([readonly=false])) .indicator { box-shadow: none; } :host([readonly]:not([readonly=false])) .knob { opacity: 0; } :host([readonly]:not([readonly=false])) .active { background-color: var(--lime-primary-color, var(--limel-theme-primary-color)); } .thumb { position: absolute; left: calc(var(--slider-fraction) * 100%); top: 0; bottom: 0; width: 0; z-index: 1; } .knob { transition: border-color 0.5s ease; position: absolute; top: 50%; left: 0; transform: translate3d(-50%, -50%, 0); width: 1.25rem; height: 1.25rem; border-radius: 50%; border: 0.5rem solid; border-color: var(--lime-primary-color, var(--limel-theme-primary-color)); background-color: rgb(var(--contrast-100)); } .knob:before, .knob:after { transition: all 0.2s ease 0.2s; content: ""; display: block; position: absolute; top: 0; bottom: 0; margin: auto; width: 0; height: 0; border: 0.375rem solid transparent; } :host([disabled]:not([disabled=false])) .knob:before, :host([disabled]:not([disabled=false])) .knob:after { content: none; } .knob:before { opacity: calc(var(--slider-fraction) * 100); left: -1rem; transform: rotate(90deg); } .knob:after { opacity: calc((1 - var(--slider-fraction)) * 100); right: -1rem; transform: rotate(-90deg); } .slider:hover .knob, .slider:has(input[type=range]:active) .knob, .slider:has(input[type=range]:focus) .knob { box-shadow: var(--button-shadow-normal); } .slider:hover .knob:before, .slider:has(input[type=range]:active) .knob:before, .slider:has(input[type=range]:focus) .knob:before { left: -1.5rem; border-top-color: rgb(var(--contrast-1400), 0.5); } .slider:hover .knob:after, .slider:has(input[type=range]:active) .knob:after, .slider:has(input[type=range]:focus) .knob:after { right: -1.5rem; border-top-color: rgb(var(--contrast-1400), 0.5); } .indicator { user-select: none; position: absolute; left: 0; top: 50%; z-index: 1; transform: translate3d(-50%, -50%, 0); transform-origin: bottom center; transition: transform 0.2s ease-out, box-shadow 0.2s ease-out, background-color 0.5s ease; border-radius: 1.25rem; padding: 0 0.375rem; height: 1.25rem; display: flex; align-items: center; white-space: nowrap; color: rgb(var(--color-white)); font-size: 0.6875rem; background-color: var(--lime-primary-color, var(--limel-theme-primary-color)); box-shadow: var(--button-shadow-normal); } :host(:not([disabled]):not([readonly])) input[type=range]:active ~ .thumb .indicator, :host(:not([disabled]):not([readonly])) input[type=range]:focus ~ .thumb .indicator { transform: translate3d(-50%, calc(-100% - 0.75rem), 0) scale(1.25); box-shadow: var(--shadow-depth-16); } /* * This file is imported into every component! * * Nothing in this file may output any CSS * without being explicitly called by outside code. */ *, *:before, *:after { box-sizing: border-box; min-width: 0; min-height: 0; } :host(limel-slider) { box-sizing: border-box; isolation: isolate; position: relative; display: flex; flex-direction: column; } :host(limel-slider:not([invalid]):not([invalid=true])) .limel-notched-outline, :host(limel-slider[disabled]:not([disabled=false])) .limel-notched-outline { --limel-notched-outline-border-color: transparent; --limel-notched-outline-background-color: transparent; } div[slot=content] { display: flex; flex-direction: column; width: 100%; padding: 0 0.25rem; } .slider { position: relative; height: 2.5rem; margin: 0 0.75rem; } input[type=range] { position: absolute; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; margin: 0; appearance: none; } :host([disabled]:not([disabled=false])) input[type=range] { cursor: not-allowed; } :host([disabled]:not([disabled=false])) .track .active { opacity: 0.5; } :host([disabled]:not([disabled=false])) .indicator { border-radius: 0.125rem; box-shadow: var(--button-shadow-pressed); } .track { transition: background-color 0.5s ease; display: flex; align-items: center; justify-content: space-between; position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); height: 0.5rem; border-radius: 1rem; background-color: rgba(var(--contrast-700), 0.6); } .track:before, .track:after { content: ""; display: inline-block; position: absolute; top: 0; bottom: 0; margin: auto; width: 0.375rem; height: 0.375rem; border-radius: 50%; background-color: rgba(var(--contrast-700), 0.6); } .track:before { left: -0.75rem; } .track:after { right: -0.75rem; } .track .active { transition: background-color 0.5s ease; position: absolute; height: 100%; width: calc(var(--slider-fraction) * 100%); border-radius: inherit; background-color: var(--lime-primary-color, var(--limel-theme-primary-color)); } .step-dot { transform: translateX(-50%); border-radius: 50%; height: 0.25rem; width: 0.25rem; background-color: rgb(var(--contrast-100), 0.6); } .step-dot:first-of-type, .step-dot:last-of-type { opacity: 0; } .range-labels { display: flex; justify-content: space-between; margin-top: -0.75rem; width: 100%; } .range-labels .min, .range-labels .max { line-height: 1; font-size: 0.75rem; color: var(--limel-notched-outline-label-color, rgb(var(--contrast-1200))); } :host(limel-slider:focus), :host(limel-slider:focus-visible), :host(limel-slider:focus-within) { --limel-h-l-grid-template-rows-transition-speed: 0.46s; --limel-h-l-grid-template-rows: 1fr; } :host(limel-slider) { --limel-h-l-grid-template-rows-transition-speed: 0.3s; --limel-h-l-grid-template-rows: 0fr; } :host(limel-slider:focus) limel-helper-line, :host(limel-slider:focus-visible) limel-helper-line, :host(limel-slider:focus-within) limel-helper-line, :host(limel-slider:hover) limel-helper-line { will-change: grid-template-rows; }