@limetech/lime-elements 39.7.1 → 39.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,722 @@
1
+ /**
2
+ * Note! This file is exported to `dist/scss/` in the published
3
+ * node module, for consumer projects to import.
4
+ * That means this file cannot import from any file that isn't
5
+ * also exported, keeping the same relative path.
6
+ *
7
+ * Or, just don't import anything, that works too.
8
+ */
9
+
10
+ @mixin visualize-keyboard-focus {
11
+ &:focus {
12
+ outline: none;
13
+ }
14
+
15
+ &:focus-visible {
16
+ outline: none;
17
+ box-shadow: var(--shadow-depth-8-focused);
18
+ }
19
+ }
20
+
21
+ /**
22
+ * This can be used on a trigger element that opens a dropdown menu or a popover.
23
+ */
24
+
25
+ @mixin visualize-aria-expanded($trigger-element) {
26
+ :host([aria-expanded='true']),
27
+ :host([aria-expanded]:not([aria-expanded='false'])) {
28
+ #{$trigger-element} {
29
+ box-shadow: var(--button-shadow-inset-pressed) !important;
30
+ }
31
+ }
32
+ }
33
+
34
+ @mixin in($media) {
35
+ // ⛔️ As long as we don't have a script that generates a
36
+ // `.css` files automatically, we cannot use this mixin.
37
+ // we need to manually write the dark-mode CSS variables
38
+ // inside this file: /style/color-palette-extended.css
39
+ //
40
+ // ⚠️ Also note that this mixin only puts styles
41
+ // on the `:root` which means the `<html` level.
42
+ // Therefore, it cannot be used inside components
43
+ // to generate custom dark-mode styles.
44
+
45
+ @if $media == dark-mode {
46
+ @media (prefers-color-scheme: dark) {
47
+ :root:not([data-theme='force-light']) {
48
+ @content;
49
+ }
50
+ }
51
+ :root[data-theme='force-dark'] {
52
+ @content;
53
+ }
54
+
55
+ // @media (prefers-color-scheme: dark) {
56
+ // :host(:not([data-theme='force-light'])) & {
57
+ // @content;
58
+ // }
59
+ // }
60
+ // :host([data-theme='force-dark']) & {
61
+ // @content;
62
+ // }
63
+ }
64
+ }
65
+
66
+ $clickable-normal-state-transitions: (
67
+ color var(--limel-clickable-transition-speed, 0.4s) ease,
68
+ background-color var(--limel-clickable-transition-speed, 0.4s) ease,
69
+ box-shadow var(--limel-clickable-transform-speed, 0.4s) ease,
70
+ transform var(--limel-clickable-transform-speed, 0.4s)
71
+ var(--limel-clickable-transform-timing-function, ease)
72
+ );
73
+
74
+ @mixin is-elevated-clickable(
75
+ $color: var(--limel-theme-on-surface-color),
76
+ $color--hovered: var(--limel-theme-on-surface-color),
77
+ $background-color: var(--lime-elevated-surface-background-color),
78
+ $background-color--hovered: var(--lime-elevated-surface-background-color)
79
+ ) {
80
+ transition: $clickable-normal-state-transitions;
81
+
82
+ cursor: pointer;
83
+ color: $color;
84
+ background-color: $background-color;
85
+ box-shadow: var(--button-shadow-normal);
86
+
87
+ &:hover,
88
+ &:focus,
89
+ &:focus-visible {
90
+ will-change: color, background-color, box-shadow, transform;
91
+ }
92
+
93
+ &:hover,
94
+ &:focus-visible {
95
+ transform: translate3d(0, -0.04rem, 0);
96
+ color: $color--hovered;
97
+ background-color: $background-color--hovered;
98
+ box-shadow: var(--button-shadow-hovered);
99
+ }
100
+
101
+ &:active {
102
+ --limel-clickable-transform-timing-function: cubic-bezier(
103
+ 0.83,
104
+ -0.15,
105
+ 0.49,
106
+ 1.16
107
+ );
108
+ transform: translate3d(0, 0.05rem, 0);
109
+ box-shadow: var(--button-shadow-pressed);
110
+ }
111
+
112
+ &:hover,
113
+ &:active {
114
+ --limel-clickable-transition-speed: 0.2s;
115
+ --limel-clickable-transform-speed: 0.16s;
116
+ }
117
+ }
118
+
119
+ @mixin is-elevated-inset-clickable(
120
+ $color: var(--limel-theme-on-surface-color),
121
+ $color--hovered: var(--limel-theme-on-surface-color),
122
+ $background-color: var(--lime-elevated-surface-background-color),
123
+ $background-color--hovered: var(--lime-elevated-surface-background-color),
124
+ $background-color--inset: var(--limel-theme-surface-background-color)
125
+ ) {
126
+ transition: $clickable-normal-state-transitions;
127
+
128
+ cursor: pointer;
129
+ color: $color;
130
+ background-color: $background-color;
131
+ box-shadow: var(--button-shadow-normal);
132
+
133
+ &:hover,
134
+ &:focus,
135
+ &:focus-visible {
136
+ will-change: color, background-color, box-shadow, transform;
137
+ }
138
+
139
+ &:hover,
140
+ &:focus-visible {
141
+ transform: translate3d(0, 0.01rem, 0);
142
+ color: $color--hovered;
143
+ background-color: $background-color--hovered;
144
+ }
145
+ &:hover {
146
+ box-shadow: var(--button-shadow-hovered);
147
+ }
148
+
149
+ &:active {
150
+ --limel-clickable-transform-timing-function: cubic-bezier(
151
+ 0.83,
152
+ -0.15,
153
+ 0.49,
154
+ 1.16
155
+ );
156
+ transform: translate3d(0, 0.05rem, 0);
157
+ background-color: $background-color--inset;
158
+ box-shadow: var(--button-shadow-inset-pressed);
159
+ }
160
+
161
+ &:hover,
162
+ &:active {
163
+ --limel-clickable-transition-speed: 0.2s;
164
+ --limel-clickable-transform-speed: 0.16s;
165
+ }
166
+ }
167
+
168
+ @mixin is-flat-clickable(
169
+ $color: var(--limel-theme-on-surface-color),
170
+ $background-color: transparent,
171
+ $color--hovered: var(--limel-theme-on-surface-color),
172
+ $background-color--hovered: var(--lime-elevated-surface-background-color)
173
+ ) {
174
+ transition: $clickable-normal-state-transitions;
175
+
176
+ cursor: pointer;
177
+ color: $color;
178
+ background-color: $background-color;
179
+
180
+ &:hover,
181
+ &:focus,
182
+ &:focus-visible {
183
+ will-change: color, background-color, box-shadow, transform;
184
+ }
185
+
186
+ &:hover,
187
+ &:focus-visible {
188
+ transform: translate3d(0, 0.01rem, 0);
189
+ color: $color--hovered;
190
+ background-color: $background-color--hovered;
191
+ }
192
+ &:hover {
193
+ box-shadow: var(--button-shadow-hovered);
194
+ }
195
+
196
+ &:active {
197
+ --limel-clickable-transform-timing-function: cubic-bezier(
198
+ 0.83,
199
+ -0.15,
200
+ 0.49,
201
+ 1.16
202
+ );
203
+ transform: translate3d(0, 0.05rem, 0);
204
+ box-shadow: var(--button-shadow-pressed);
205
+ }
206
+
207
+ &:hover,
208
+ &:active {
209
+ --limel-clickable-transition-speed: 0.2s;
210
+ --limel-clickable-transform-speed: 0.16s;
211
+ }
212
+ }
213
+
214
+ @mixin is-flat-inset-clickable(
215
+ $color: var(--limel-theme-on-surface-color),
216
+ $background-color: transparent,
217
+ $color--hovered: var(--limel-theme-on-surface-color),
218
+ $background-color--hovered: var(--lime-elevated-surface-background-color),
219
+ $background-color--inset: var(--limel-theme-surface-background-color)
220
+ ) {
221
+ transition: $clickable-normal-state-transitions;
222
+
223
+ cursor: pointer;
224
+ color: $color;
225
+ background-color: $background-color;
226
+
227
+ &:hover,
228
+ &:focus,
229
+ &:focus-visible {
230
+ will-change: color, background-color, box-shadow, transform;
231
+ }
232
+
233
+ &:hover,
234
+ &:focus-visible {
235
+ transform: translate3d(0, -0.04rem, 0);
236
+ color: $color--hovered;
237
+ background-color: $background-color--hovered;
238
+ }
239
+ &:hover {
240
+ box-shadow: var(--button-shadow-hovered);
241
+ }
242
+
243
+ &:active {
244
+ --limel-clickable-transform-timing-function: cubic-bezier(
245
+ 0.83,
246
+ -0.15,
247
+ 0.49,
248
+ 1.16
249
+ );
250
+ transform: translate3d(0, 0.05rem, 0);
251
+ background-color: $background-color--inset;
252
+ box-shadow: var(--button-shadow-inset-pressed);
253
+ }
254
+
255
+ &:hover,
256
+ &:active {
257
+ --limel-clickable-transition-speed: 0.2s;
258
+ --limel-clickable-transform-speed: 0.16s;
259
+ }
260
+ }
261
+
262
+ @mixin clear-all-button() {
263
+ // NOTE: you may need to specify "position: absolute" and align the position where you use this mixin
264
+ @include is-flat-clickable(
265
+ $background-color: rgb(var(--contrast-900)),
266
+ $color--hovered: rgb(var(--color-white)),
267
+ $background-color--hovered: rgb(var(--color-red-default))
268
+ );
269
+
270
+ cursor: pointer;
271
+
272
+ height: 1.25rem;
273
+ width: 1.25rem;
274
+ border-radius: 50%;
275
+
276
+ background: {
277
+ repeat: no-repeat;
278
+ position: center;
279
+ size: 0.75rem;
280
+ image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2032%2032'%3E%3Cdefs/%3E%3Cpath%20fill='rgb(255,255,255)'%20d='M7.219%205.781L5.78%207.22%2014.563%2016%205.78%2024.781%207.22%2026.22%2016%2017.437l8.781%208.782%201.438-1.438L17.437%2016l8.782-8.781L24.78%205.78%2016%2014.563z'/%3E%3C/svg%3E");
281
+ }
282
+ }
283
+
284
+ @mixin truncate-text() {
285
+ overflow: hidden;
286
+ white-space: nowrap;
287
+ text-overflow: ellipsis;
288
+ }
289
+
290
+ /**
291
+ * This mixin will mask out the content that is close to
292
+ * the edges of a scrollable area.
293
+ * - If the scrollable content has `overflow-y`, use `vertically`
294
+ * as an argument for `$direction`.
295
+ - If the scrollable content has `overflow-x`, use `horizontally`
296
+ * as an argument for `$direction`.
297
+ *
298
+ * For the visual effect to work smoothly, we need to make sure that
299
+ * the size of the fade-out edge effect is the same as the
300
+ * internal paddings of the scrollable area. Otherwise, content of a
301
+ * scrollable area that does not have a padding will fade out before
302
+ * any scrolling has been done.
303
+ * This is why this mixin already adds paddings, which automatically
304
+ * default to the size of the fade-out effect.
305
+ * This size defaults to `1rem`, but to override the size use
306
+ * `--limel-top-edge-fade-height` & `--limel-bottom-edge-fade-height`
307
+ * when `vertically` argument is set, and use
308
+ * `--limel-left-edge-fade-width` & `--limel-right-edge-fade-width`
309
+ * when `horizontally` argument is set.
310
+ * Of course you can also programmatically increase and decrease the
311
+ * size of these variables for each edge, based on the amount of
312
+ * scrolling that has been done by the user. In this case, make sure
313
+ * to add a custom padding where the mixin is used, to override
314
+ * the paddings that are automatically added by the mixin in the
315
+ * compiled CSS code.
316
+ */
317
+ @mixin fade-out-overflowed-content-on-edges($direction) {
318
+ @if $direction == vertically {
319
+ --limel-overflow-mask-vertical: linear-gradient(
320
+ to bottom,
321
+ transparent 0%,
322
+ black calc(0% + var(--limel-top-edge-fade-height, 1rem)),
323
+ black calc(100% - var(--limel-bottom-edge-fade-height, 1rem)),
324
+ transparent 100%
325
+ );
326
+
327
+ -webkit-mask-image: var(--limel-overflow-mask-vertical);
328
+ mask-image: var(--limel-overflow-mask-vertical);
329
+
330
+ padding-top: var(--limel-top-edge-fade-height, 1rem);
331
+ padding-bottom: var(--limel-bottom-edge-fade-height, 1rem);
332
+ } @else if $direction == horizontally {
333
+ --limel-overflow-mask-horizontal: linear-gradient(
334
+ to right,
335
+ transparent 0%,
336
+ black calc(0% + var(--limel-left-edge-fade-width, 1rem)),
337
+ black calc(100% - var(--limel-right-edge-fade-width, 1rem)),
338
+ transparent 100%
339
+ );
340
+
341
+ -webkit-mask-image: var(--limel-overflow-mask-horizontal);
342
+ mask-image: var(--limel-overflow-mask-horizontal);
343
+
344
+ padding-left: var(--limel-left-edge-fade-width, 1rem);
345
+ padding-right: var(--limel-right-edge-fade-width, 1rem);
346
+ } @else {
347
+ @error "Please specify the direction #{$direction}!";
348
+ }
349
+ }
350
+
351
+ @mixin hide-helper-line-when-not-needed($component-tag) {
352
+ // This is when:
353
+ // - the component is not focused, or
354
+ // - an interactive element within the component is not focused, or
355
+ // - the component is valid
356
+
357
+ :host(#{$component-tag}:focus),
358
+ :host(#{$component-tag}:focus-visible),
359
+ :host(#{$component-tag}:focus-within) {
360
+ --limel-h-l-grid-template-rows-transition-speed: 0.46s;
361
+ --limel-h-l-grid-template-rows: 1fr;
362
+ }
363
+
364
+ :host(#{$component-tag}) {
365
+ --limel-h-l-grid-template-rows-transition-speed: 0.3s;
366
+ --limel-h-l-grid-template-rows: 0fr;
367
+ }
368
+
369
+ :host(#{$component-tag}:focus),
370
+ :host(#{$component-tag}:focus-visible),
371
+ :host(#{$component-tag}:focus-within),
372
+ :host(#{$component-tag}:hover) {
373
+ limel-helper-line {
374
+ will-change: grid-template-rows;
375
+ }
376
+ }
377
+ }
378
+
379
+ /**
380
+ * This mixin will add an animated underline to the bottom of an `a` elements.
381
+ * Note that you may need to add `all: unset;` –depending on your use case–
382
+ * before using this mixin.
383
+ */
384
+ @mixin hyperlink(
385
+ $color: rgb(var(--color-blue-default)),
386
+ $color--hovered: rgb(var(--color-blue-default))
387
+ ) {
388
+ position: relative;
389
+ cursor: pointer;
390
+ transition: color 0.2s ease;
391
+ color: $color;
392
+
393
+ &:before {
394
+ transition:
395
+ opacity 0.2s ease,
396
+ transform 0.3s ease-out;
397
+ content: '';
398
+ position: absolute;
399
+ inset: auto 0 0 0;
400
+ width: calc(100% - 0.5rem);
401
+ margin: auto;
402
+ height: 0.125rem;
403
+ border-radius: 1rem;
404
+
405
+ background-color: currentColor;
406
+ opacity: 0;
407
+ transform: scale(0.6);
408
+ }
409
+
410
+ &:hover {
411
+ color: $color--hovered;
412
+ &:before {
413
+ opacity: 0.3;
414
+ transform: scale(1);
415
+ }
416
+ }
417
+ }
418
+
419
+ /**
420
+ * This mixin creates a cross-browser font stack.
421
+ * - `sans-serif` can be used for the UI of the components.
422
+ * - `monospace` can be used for code.
423
+ *
424
+ * ⚠️ If we change the font stacks, we need to update
425
+ * 1. the consumer documentation in `README.md`, and
426
+ * 2. the CSS variables of `--kompendium-example-font-family`
427
+ * in the `<style>` tag of `index.html`.
428
+ */
429
+ @mixin font-family($letterform) {
430
+ @if $letterform == sans-serif {
431
+ font-family: ui-sans-serif, system-ui, sans-serif;
432
+ } @else if $letterform == monospace {
433
+ font-family:
434
+ ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas,
435
+ 'DejaVu Sans Mono', monospace;
436
+ } @else {
437
+ @error "Please specify the font-family #{$letterform}!";
438
+ }
439
+ }
440
+
441
+ /**
442
+ * This mixin is a hack, using old CSS syntax
443
+ * to enable you to truncate a piece of text,
444
+ * after a certain number of lines.
445
+ */
446
+ @mixin truncate-text-on-line($max-lines) {
447
+ display: -webkit-box;
448
+ overflow: hidden;
449
+ white-space: normal;
450
+ -webkit-box-orient: vertical;
451
+ -webkit-line-clamp: $max-lines;
452
+ }
453
+
454
+ /**
455
+ * This mixin will add a chessboard background pattern,
456
+ * typically used to visualize transparency.
457
+ */
458
+ @mixin add-chessboard-background {
459
+ 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");
460
+ background-size: 0.5rem;
461
+ }
462
+
463
+ /**
464
+ * Make a container resizable by the user.
465
+ * This is used in the documentations and examples
466
+ * of some components, to demonstrate how the component
467
+ * behaves in a resizable container.
468
+ */
469
+ @mixin is-resizable(
470
+ $direction: both,
471
+ // can be `horizontal`, `vertical`, or `both`
472
+ $width: 100%,
473
+ $min-width: 10rem,
474
+ $max-width: 100%,
475
+ $height: 100%,
476
+ $min-height: 5rem,
477
+ $max-height: 50rem
478
+ ) {
479
+ box-sizing: border-box;
480
+ position: relative;
481
+
482
+ border: 1px dashed rgb(var(--contrast-700));
483
+ padding: 0.75rem;
484
+ padding-bottom: 2rem;
485
+
486
+ resize: $direction;
487
+ overflow: auto;
488
+
489
+ min-width: $min-width;
490
+ width: $width;
491
+ max-width: $max-width;
492
+
493
+ min-height: $min-height;
494
+ height: $height;
495
+ max-height: $max-height;
496
+
497
+ border-radius: 0.5rem;
498
+
499
+ &::after {
500
+ content: 'Resize me ⤵';
501
+ font-size: 0.75rem;
502
+ position: absolute;
503
+ right: 0.25rem;
504
+ bottom: 0.25rem;
505
+ }
506
+ }
507
+
508
+ // Hide element visually while keeping it accessible to assistive technologies
509
+ // See: https://www.a11yproject.com/posts/2013-01-11-how-to-hide-content/
510
+ // See: https://hugogiraudel.com/2016/10/13/css-hide-and-seek/
511
+ @mixin visually-hidden {
512
+ position: absolute;
513
+ width: 0;
514
+ height: 0;
515
+ margin: -1px;
516
+ padding: 0;
517
+ border: 0;
518
+ overflow: hidden;
519
+ clip: rect(0, 0, 0, 0);
520
+ clip-path: inset(50%);
521
+ white-space: nowrap;
522
+ }
523
+
524
+ // These mixins below are designed to apply the necessary visual effects,
525
+ // when the `tiltFollowingTheCursor` utility function from `3d-tilt-hover-effect.ts`
526
+ // is implemented in a component.
527
+ @mixin parent-of-the-3d-element {
528
+ isolation: isolate;
529
+ transform-style: preserve-3d;
530
+
531
+ perspective: 1000px;
532
+ @media (prefers-reduced-motion) {
533
+ perspective: 2000px;
534
+ }
535
+ }
536
+
537
+ @mixin the-3d-element {
538
+ position: relative;
539
+
540
+ transition-duration: 0.8s;
541
+ transition-property: transform, box-shadow, background-color;
542
+ transition-timing-function: ease-out;
543
+ transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
544
+
545
+ &:focus {
546
+ outline: none;
547
+ }
548
+
549
+ &:hover,
550
+ &:focus,
551
+ &:focus-visible,
552
+ &:focus-within {
553
+ will-change: background-color, box-shadow, transform;
554
+ }
555
+
556
+ &:hover,
557
+ &:focus,
558
+ &:focus-visible,
559
+ &:active {
560
+ transition-duration: 0.2s;
561
+ }
562
+
563
+ &:hover,
564
+ &:focus-visible {
565
+ box-shadow: var(--button-shadow-hovered), var(--shadow-depth-16);
566
+ }
567
+
568
+ &:hover {
569
+ transform: scale3d(1.01, 1.01, 1.01)
570
+ rotate3d(var(--limel-3d-hover-effect-rotate3d));
571
+ }
572
+ &:focus-visible {
573
+ outline: none;
574
+ transform: scale3d(1.01, 1.01, 1.01);
575
+ }
576
+
577
+ &:hover {
578
+ limel-3d-hover-effect-glow {
579
+ --limel-3d-hover-effect-glow-opacity: 0.5;
580
+ @media (prefers-reduced-motion) {
581
+ --limel-3d-hover-effect-glow-opacity: 0.2;
582
+ }
583
+ }
584
+ }
585
+ }
586
+
587
+ @mixin the-3d-element--clickable {
588
+ cursor: pointer;
589
+ box-shadow: var(--button-shadow-normal);
590
+
591
+ &:hover,
592
+ &:focus-visible {
593
+ // seems repetitive. But it's required for some scenarios, like for info tiles.
594
+ box-shadow: var(--button-shadow-hovered), var(--shadow-depth-16);
595
+ }
596
+
597
+ &:active {
598
+ transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
599
+ box-shadow: var(--button-shadow-pressed);
600
+ }
601
+
602
+ &:focus-visible {
603
+ box-shadow: var(--shadow-depth-8-focused), var(--button-shadow-hovered);
604
+ }
605
+
606
+ &:focus-visible:active {
607
+ box-shadow: var(--shadow-depth-8-focused), var(--button-shadow-pressed);
608
+ }
609
+ }
610
+
611
+ /**
612
+ * Drag to reorder mixins
613
+ */
614
+ @mixin is-draggable-item(
615
+ $border-radius-while-being-dragged: 0.5rem,
616
+ $transform-scale-while-being-dragged: 1.01
617
+ ) {
618
+ // Note: Since SortableJS add `transitions`s in real-time as styles,
619
+ // we cannot define `transition` properties here,
620
+
621
+ &:has(limel-drag-handle:hover),
622
+ &:has(limel-drag-handle:focus-within),
623
+ &.is-elevated,
624
+ &.sortable-chosen // this class is added by SortableJS, when item is being dragged
625
+ {
626
+ will-change: transform, box-shadow, border-radius, background-color;
627
+ }
628
+
629
+ &.sortable-ghost {
630
+ border-radius: $border-radius-while-being-dragged;
631
+ box-shadow:
632
+ var(--shadow-depth-64),
633
+ 0 0.65rem 0.75rem -0.425rem rgb(var(--color-black), 0.3);
634
+ }
635
+
636
+ &.sortable-chosen {
637
+ border-radius: $border-radius-while-being-dragged;
638
+ background-color: var(--lime-elevated-surface-background-color);
639
+ }
640
+
641
+ &.is-elevated[draggable='false'] {
642
+ // Components must add this `is-elevated` class on their own,
643
+ // the moment the item is dropped and keep it around briefly
644
+ // so visual transitions (box-shadow, etc.) can fade
645
+ // out without being clipped by neighboring content.
646
+ animation: sit-here 0.8s forwards;
647
+ }
648
+
649
+ @keyframes sit-here {
650
+ 0% {
651
+ border-radius: $border-radius-while-being-dragged;
652
+ background-color: var(--lime-elevated-surface-background-color);
653
+ box-shadow:
654
+ var(--shadow-depth-64),
655
+ 0 0.65rem 0.75rem -0.425rem rgb(var(--color-black), 0.3);
656
+ }
657
+
658
+ 100% {
659
+ box-shadow: none;
660
+ }
661
+ }
662
+ }
663
+
664
+ /**
665
+ * The breakpoints below are used to create responsive designs
666
+ * in Lime's products. Therefore, they are here to get distributed
667
+ * to all components in other private repos, which rely on this `mixins`
668
+ * file, to create consistent styles.
669
+ *
670
+ * :::important
671
+ * In very rare cases you should used media queries!
672
+ * Nowadays, there are many better ways of achieving responsive design
673
+ * without media queries. For example, using CSS Grid, Flexbox, and their features.
674
+ * :::
675
+ */
676
+ $narrow-viewport-breakpoint: 800px;
677
+ $medium-viewport-breakpoint: 1023px;
678
+ // At this breakpoint, `limel-dialog` switches the layout of `slot="button"`
679
+ // and stretches the buttons to full-width.
680
+ $narrow-dialog-breakpoint: 760px;
681
+
682
+ /**
683
+ * Media query mixins for responsive design based on screen width.
684
+ * Note that these mixins do not detect the device type!
685
+ */
686
+ @mixin when-viewport-width-is-narrow {
687
+ // What our products consider as mobile (held in portrait mode)
688
+ @media (max-width: #{$narrow-viewport-breakpoint}) {
689
+ @content;
690
+ }
691
+ }
692
+
693
+ @mixin when-viewport-width-is-not-narrow {
694
+ // Wider than what our products consider as mobile (held in portrait mode)
695
+ @media (min-width: #{$narrow-viewport-breakpoint + 1px}) {
696
+ @content;
697
+ }
698
+ }
699
+
700
+ @mixin when-viewport-width-is-medium {
701
+ // What our products consider as to be bigger than a phone,
702
+ // but not bigger than a tablet (held in landscape mode)
703
+ // or a small laptop screen.
704
+ @media (min-width: #{$narrow-viewport-breakpoint + 1px}) and (max-width: #{$medium-viewport-breakpoint}) {
705
+ @content;
706
+ }
707
+ }
708
+
709
+ @mixin when-viewport-width-is-not-large {
710
+ // What our products consider as a phone,
711
+ // or a small tablet (held in landscape mode) or a small laptop screen.
712
+ @media (max-width: #{$medium-viewport-breakpoint}) {
713
+ @content;
714
+ }
715
+ }
716
+
717
+ @mixin when-viewport-width-is-large {
718
+ // What our products consider wider than tablet (held in landscape mode)
719
+ @media (min-width: #{$medium-viewport-breakpoint + 1px}) {
720
+ @content;
721
+ }
722
+ }