UNPKG

@limetech/lime-elements

Version:
373 lines (355 loc) 12.4 kB
@charset "UTF-8"; /** * Note! This file is exported to `dist/scss/` in the published * node module, for consumer projects to import. * That means this file cannot import from any file that isn't * also exported, keeping the same relative path. * * Or, just don't import anything, that works too. */ /** * 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. */ /** * 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! */ /* * This file is imported into every component! * * Nothing in this file may output any CSS * without being explicitly called by outside code. */ /** * @prop --closed-header-background-color: background color for header when closed * @prop --open-header-background-color: background color for header when open * @prop --header-stroke-color: color of the animated icons that visualize collapsed or normal states of the headers, as well as the divider line on headers * @prop --body-background-color: background color for body * @prop --body-padding: space around content of the body */ :host(limel-collapsible-section) { --border-radius-of-header: 0.75rem; display: block; } :host([hidden]) { display: none; } .open-close-toggle { all: unset; position: absolute; inset: 0; width: 100%; transition: background-color 0.4s ease, border-radius 0.1s ease; cursor: pointer; z-index: -1; background-color: var(--closed-header-background-color, rgb(var(--contrast-200))); border-radius: var(--border-radius-of-header); } .open-close-toggle:focus { outline: none; } .open-close-toggle:focus-visible { outline: none; box-shadow: var(--shadow-depth-8-focused); } .open-close-toggle:hover, .open-close-toggle:focus-visible { background-color: var(--open-header-background-color, rgb(var(--contrast-300))); } section.open .open-close-toggle { background-color: var(--open-header-background-color, rgb(var(--contrast-100))); border-radius: var(--border-radius-of-header) var(--border-radius-of-header) 0 0; } section.open .open-close-toggle:hover, section.open .open-close-toggle:focus-visible { background-color: var(--open-header-background-color, rgb(var(--contrast-300))); } .title, .divider-line, .expand-icon { pointer-events: none; } section { transition: box-shadow 0.4s ease; border-radius: var(--border-radius-of-header); } section[aria-invalid]:not([aria-invalid=false]) { --header-stroke-color: rgb(var(--color-red-default)) !important; } section[aria-invalid]:not([aria-invalid=false]):not(.open) { box-shadow: 0 0 0 1px rgb(var(--color-red-default)); } header { isolation: isolate; position: relative; align-items: center; display: flex; justify-content: space-between; gap: 0.5rem; padding-left: 0.5rem; height: 2.5rem; } limel-icon { width: 1.5rem; } .title { font-size: 1rem; font-weight: 300; color: var(--limel-theme-on-surface-color); justify-self: flex-start; user-select: none; height: auto; max-height: 3rem; line-height: 1.2rem; display: -webkit-box; overflow: hidden; white-space: normal; -webkit-box-orient: vertical; -webkit-line-clamp: 2; } .divider-line { transition: opacity 0.3s ease 0.3s; flex-grow: 1; height: 0.125rem; border-radius: 1rem; background-color: var(--header-stroke-color, rgb(var(--contrast-900))); opacity: 0; margin-right: 0.5rem; } section.open .divider-line { opacity: 0.16; } .actions { justify-self: flex-end; flex-shrink: 0; } ::slotted([slot=header]) { margin-right: 0.5rem; } .body { background-color: var(--body-background-color, var(--contrast-100)); padding-left: var(--body-padding, 1.25rem); padding-right: var(--body-padding, 1.25rem); border-radius: 0 0 var(--border-radius-of-header) var(--border-radius-of-header); } .body { --limel-cs-opacity-transition-speed: 0.1s; --limel-cs-opacity-transition-delay: 0s; --limel-cs-grid-template-rows-transition-speed: 0.3s; transition: grid-template-rows var(--limel-cs-grid-template-rows-transition-speed) cubic-bezier(1, 0.09, 0, 0.89); display: grid; grid-template-rows: 0fr; } .body slot { transition: opacity var(--limel-cs-opacity-transition-speed) ease var(--limel-cs-opacity-transition-delay); display: block; overflow: hidden; opacity: 0; } section.open .body { --limel-cs-opacity-transition-speed: 0.4s; --limel-cs-opacity-transition-delay: 0.3s; --limel-cs-grid-template-rows-transition-speed: 0.46s; grid-template-rows: 1fr; } section.open .body slot { opacity: 1; } header:hover + .body, header:has(.open-close-toggle:hover) + .body, header:has(.open-close-toggle:focus-visible) + .body { will-change: grid-template-rows; } header:hover + .body slot, header:has(.open-close-toggle:hover) + .body slot, header:has(.open-close-toggle:focus-visible) + .body slot { will-change: opacity; } .expand-icon { position: relative; display: flex; align-items: center; justify-content: center; height: 1.875rem; margin: 0 0 0 0.5rem; width: 0.75rem; flex-shrink: 0; } .line { position: absolute; inset: auto; margin: auto; width: 100%; border-radius: 1rem; height: 0.125rem; } .line:first-of-type, .line:last-of-type { transition: opacity 0.2s ease 0.1s, transform 0.4s ease 0.3s; opacity: 0; background-color: var(--header-stroke-color, rgb(var(--contrast-900))); } .line:nth-of-type(2) { transform: translate3d(0, 0.25rem, 0) rotate(90deg); } .line:nth-of-type(3) { transform: translate3d(0, -0.25rem, 0) rotate(-90deg); } .line:nth-of-type(2), .line:nth-of-type(3) { transition: opacity 0.2s ease, transform 0.18s ease; } .line:nth-of-type(2):before, .line:nth-of-type(2):after, .line:nth-of-type(3):before, .line:nth-of-type(3):after { content: ""; position: absolute; inset: 0; margin: auto; width: 50%; height: 100%; border-radius: inherit; background-color: var(--header-stroke-color, rgb(var(--contrast-900))); } .line:nth-of-type(2):before, .line:nth-of-type(3):before { transform: translate3d(0, -0.1rem, 0) rotate(45deg); } .line:nth-of-type(2):after, .line:nth-of-type(3):after { transform: translate3d(0, 0.1rem, 0) rotate(-45deg); } .open-close-toggle:hover + .expand-icon .line:first-of-type, .open-close-toggle:hover + .expand-icon .line:last-of-type, .open-close-toggle:focus-visible + .expand-icon .line:first-of-type, .open-close-toggle:focus-visible + .expand-icon .line:last-of-type { transition: opacity 0.8s ease 0.4s, transform 0.4s ease 0.3s; opacity: 1; } .open-close-toggle:hover + .expand-icon .line:first-of-type, .open-close-toggle:focus-visible + .expand-icon .line:first-of-type { transform: rotate3d(0, 0, 1, 0deg); } .open-close-toggle:hover + .expand-icon .line:last-of-type, .open-close-toggle:focus-visible + .expand-icon .line:last-of-type { transform: rotate3d(0, 0, 1, 0deg); } .open-close-toggle:hover + .expand-icon .line:nth-of-type(2), .open-close-toggle:hover + .expand-icon .line:nth-of-type(3), .open-close-toggle:focus-visible + .expand-icon .line:nth-of-type(2), .open-close-toggle:focus-visible + .expand-icon .line:nth-of-type(3) { transition: opacity 0.5s ease 0.4s, transform 0.7s cubic-bezier(0.85, 0.11, 0.14, 1.35) 0.2s; } .open-close-toggle:hover + .expand-icon .line:nth-of-type(2), .open-close-toggle:focus-visible + .expand-icon .line:nth-of-type(2) { transform: translate3d(0, 0.5rem, 0) rotate(90deg); opacity: 0.4; } .open-close-toggle:hover + .expand-icon .line:nth-of-type(3), .open-close-toggle:focus-visible + .expand-icon .line:nth-of-type(3) { transform: translate3d(0, -0.5rem, 0) rotate(-90deg); opacity: 0.4; } section.open .line:first-of-type, section.open .line:last-of-type { transition: opacity 0.2s ease 0.1s, transform 0.4s ease 0.3s; opacity: 1; } section.open .line:first-of-type { transform: rotate3d(0, 0, 1, 0deg); } section.open .line:last-of-type { transform: rotate3d(0, 0, 1, 0deg); } section.open .line:nth-of-type(2), section.open .line:nth-of-type(3) { transition: opacity 1s ease, transform 0.4s ease; } section.open .line:nth-of-type(2) { transform: translate3d(0, 1rem, 0) rotate(90deg); opacity: 0; } section.open .line:nth-of-type(3) { transform: translate3d(0, -1rem, 0) rotate(-90deg); opacity: 0; } section.open .open-close-toggle:hover + .expand-icon .line:first-of-type, section.open .open-close-toggle:hover + .expand-icon .line:last-of-type, section.open .open-close-toggle:focus-visible + .expand-icon .line:first-of-type, section.open .open-close-toggle:focus-visible + .expand-icon .line:last-of-type { transition: opacity 0.2s ease 0.4s, transform 0.4s cubic-bezier(0.85, 0.11, 0.14, 1.35) 0.2s; } section.open .open-close-toggle:hover + .expand-icon .line:first-of-type, section.open .open-close-toggle:focus-visible + .expand-icon .line:first-of-type { transform: rotate3d(0, 0, 1, 45deg); } section.open .open-close-toggle:hover + .expand-icon .line:last-of-type, section.open .open-close-toggle:focus-visible + .expand-icon .line:last-of-type { transform: rotate3d(0, 0, 1, -45deg); } section.open .open-close-toggle:hover + .expand-icon .line:nth-of-type(2), section.open .open-close-toggle:focus-visible + .expand-icon .line:nth-of-type(2) { transform: translate3d(0, 1rem, 0) rotate(90deg); opacity: 0; } section.open .open-close-toggle:hover + .expand-icon .line:nth-of-type(3), section.open .open-close-toggle:focus-visible + .expand-icon .line:nth-of-type(3) { transform: translate3d(0, -1rem, 0) rotate(-90deg); opacity: 0; }