|
1 |
| -.offcanvas { |
2 |
| - position: fixed; |
3 |
| - bottom: 0; |
4 |
| - z-index: $zindex-offcanvas; |
5 |
| - display: flex; |
6 |
| - flex-direction: column; |
7 |
| - max-width: 100%; |
8 |
| - color: $offcanvas-color; |
9 |
| - visibility: hidden; |
10 |
| - background-color: $offcanvas-bg-color; |
11 |
| - background-clip: padding-box; |
12 |
| - outline: 0; |
13 |
| - @include box-shadow($offcanvas-box-shadow); |
14 |
| - @include transition(transform $offcanvas-transition-duration ease-in-out); |
15 |
| - |
16 |
| - &.showing, |
17 |
| - &.show:not(.hiding) { |
18 |
| - transform: none; |
| 1 | +// stylelint-disable function-disallowed-list |
| 2 | + |
| 3 | +%offcanvas-css-vars { |
| 4 | + // scss-docs-start offcanvas-css-vars |
| 5 | + --#{$prefix}offcanvas-width: #{$offcanvas-horizontal-width}; |
| 6 | + --#{$prefix}offcanvas-height: #{$offcanvas-vertical-height}; |
| 7 | + --#{$prefix}offcanvas-padding-x: #{$offcanvas-padding-x}; |
| 8 | + --#{$prefix}offcanvas-padding-y: #{$offcanvas-padding-y}; |
| 9 | + --#{$prefix}offcanvas-color: #{$offcanvas-color}; |
| 10 | + --#{$prefix}offcanvas-bg: #{$offcanvas-bg-color}; |
| 11 | + --#{$prefix}offcanvas-border-width: #{$offcanvas-border-width}; |
| 12 | + --#{$prefix}offcanvas-border-color: #{$offcanvas-border-color}; |
| 13 | + --#{$prefix}offcanvas-box-shadow: #{$offcanvas-box-shadow}; |
| 14 | + // scss-docs-end offcanvas-css-vars |
| 15 | +} |
| 16 | + |
| 17 | +@each $breakpoint in map-keys($grid-breakpoints) { |
| 18 | + $next: breakpoint-next($breakpoint, $grid-breakpoints); |
| 19 | + $infix: breakpoint-infix($next, $grid-breakpoints); |
| 20 | + |
| 21 | + .offcanvas#{$infix} { |
| 22 | + @extend %offcanvas-css-vars; |
19 | 23 | }
|
| 24 | +} |
| 25 | + |
| 26 | +@each $breakpoint in map-keys($grid-breakpoints) { |
| 27 | + $next: breakpoint-next($breakpoint, $grid-breakpoints); |
| 28 | + $infix: breakpoint-infix($next, $grid-breakpoints); |
| 29 | + |
| 30 | + .offcanvas#{$infix} { |
| 31 | + @include media-breakpoint-down($next) { |
| 32 | + position: fixed; |
| 33 | + bottom: 0; |
| 34 | + z-index: $zindex-offcanvas; |
| 35 | + display: flex; |
| 36 | + flex-direction: column; |
| 37 | + max-width: 100%; |
| 38 | + color: var(--#{$prefix}offcanvas-color); |
| 39 | + visibility: hidden; |
| 40 | + background-color: var(--#{$prefix}offcanvas-bg); |
| 41 | + background-clip: padding-box; |
| 42 | + outline: 0; |
| 43 | + @include box-shadow(var(--#{$prefix}offcanvas-box-shadow)); |
| 44 | + @include transition(transform $offcanvas-transition-duration ease-in-out); |
| 45 | + |
| 46 | + &.showing, |
| 47 | + &.show:not(.hiding) { |
| 48 | + transform: none; |
| 49 | + } |
| 50 | + |
| 51 | + &.showing, |
| 52 | + &.hiding, |
| 53 | + &.show { |
| 54 | + visibility: visible; |
| 55 | + } |
| 56 | + |
| 57 | + &.offcanvas-start { |
| 58 | + top: 0; |
| 59 | + left: 0; |
| 60 | + width: var(--#{$prefix}offcanvas-width); |
| 61 | + border-right: var(--#{$prefix}offcanvas-border-width) solid var(--#{$prefix}offcanvas-border-color); |
| 62 | + transform: translateX(-100%); |
| 63 | + } |
| 64 | + |
| 65 | + &.offcanvas-end { |
| 66 | + top: 0; |
| 67 | + right: 0; |
| 68 | + width: var(--#{$prefix}offcanvas-width); |
| 69 | + border-left: var(--#{$prefix}offcanvas-border-width) solid var(--#{$prefix}offcanvas-border-color); |
| 70 | + transform: translateX(100%); |
| 71 | + } |
20 | 72 |
|
21 |
| - &.showing, |
22 |
| - &.hiding, |
23 |
| - &.show { |
24 |
| - visibility: visible; |
| 73 | + &.offcanvas-top { |
| 74 | + top: 0; |
| 75 | + right: 0; |
| 76 | + left: 0; |
| 77 | + height: var(--#{$prefix}offcanvas-height); |
| 78 | + max-height: 100%; |
| 79 | + border-bottom: var(--#{$prefix}offcanvas-border-width) solid var(--#{$prefix}offcanvas-border-color); |
| 80 | + transform: translateY(-100%); |
| 81 | + } |
| 82 | + |
| 83 | + &.offcanvas-bottom { |
| 84 | + right: 0; |
| 85 | + left: 0; |
| 86 | + height: var(--#{$prefix}offcanvas-height); |
| 87 | + max-height: 100%; |
| 88 | + border-top: var(--#{$prefix}offcanvas-border-width) solid var(--#{$prefix}offcanvas-border-color); |
| 89 | + transform: translateY(100%); |
| 90 | + } |
| 91 | + } |
| 92 | + |
| 93 | + @if not ($infix == "") { |
| 94 | + @include media-breakpoint-up($next) { |
| 95 | + --#{$prefix}offcanvas-height: auto; |
| 96 | + --#{$prefix}offcanvas-border-width: 0; |
| 97 | + background-color: transparent !important; // stylelint-disable-line declaration-no-important |
| 98 | + |
| 99 | + .offcanvas-header { |
| 100 | + display: none; |
| 101 | + } |
| 102 | + |
| 103 | + .offcanvas-body { |
| 104 | + display: flex; |
| 105 | + flex-grow: 0; |
| 106 | + padding: 0; |
| 107 | + overflow-y: visible; |
| 108 | + // Reset `background-color` in case `.bg-*` classes are used in offcanvas |
| 109 | + background-color: transparent !important; // stylelint-disable-line declaration-no-important |
| 110 | + } |
| 111 | + } |
| 112 | + } |
25 | 113 | }
|
26 | 114 | }
|
27 | 115 |
|
|
33 | 121 | display: flex;
|
34 | 122 | align-items: center;
|
35 | 123 | justify-content: space-between;
|
36 |
| - padding: $offcanvas-padding-y $offcanvas-padding-x; |
| 124 | + padding: var(--#{$prefix}offcanvas-padding-y) var(--#{$prefix}offcanvas-padding-x); |
37 | 125 |
|
38 | 126 | .btn-close {
|
39 |
| - padding: ($offcanvas-padding-y * .5) ($offcanvas-padding-x * .5); |
40 |
| - margin-top: $offcanvas-padding-y * -.5; |
41 |
| - margin-right: $offcanvas-padding-x * -.5; |
42 |
| - margin-bottom: $offcanvas-padding-y * -.5; |
| 127 | + padding: calc(var(--#{$prefix}offcanvas-padding-y) * .5) calc(var(--#{$prefix}offcanvas-padding-x) * .5); |
| 128 | + margin-top: calc(var(--#{$prefix}offcanvas-padding-y) * -.5); |
| 129 | + margin-right: calc(var(--#{$prefix}offcanvas-padding-x) * -.5); |
| 130 | + margin-bottom: calc(var(--#{$prefix}offcanvas-padding-y) * -.5); |
43 | 131 | }
|
44 | 132 | }
|
45 | 133 |
|
|
50 | 138 |
|
51 | 139 | .offcanvas-body {
|
52 | 140 | flex-grow: 1;
|
53 |
| - padding: $offcanvas-padding-y $offcanvas-padding-x; |
| 141 | + padding: var(--#{$prefix}offcanvas-padding-y) var(--#{$prefix}offcanvas-padding-x); |
54 | 142 | overflow-y: auto;
|
55 | 143 | }
|
56 |
| - |
57 |
| -.offcanvas-start { |
58 |
| - top: 0; |
59 |
| - left: 0; |
60 |
| - width: $offcanvas-horizontal-width; |
61 |
| - border-right: $offcanvas-border-width solid $offcanvas-border-color; |
62 |
| - transform: translateX(-100%); |
63 |
| -} |
64 |
| - |
65 |
| -.offcanvas-end { |
66 |
| - top: 0; |
67 |
| - right: 0; |
68 |
| - width: $offcanvas-horizontal-width; |
69 |
| - border-left: $offcanvas-border-width solid $offcanvas-border-color; |
70 |
| - transform: translateX(100%); |
71 |
| -} |
72 |
| - |
73 |
| -.offcanvas-top { |
74 |
| - top: 0; |
75 |
| - right: 0; |
76 |
| - left: 0; |
77 |
| - height: $offcanvas-vertical-height; |
78 |
| - max-height: 100%; |
79 |
| - border-bottom: $offcanvas-border-width solid $offcanvas-border-color; |
80 |
| - transform: translateY(-100%); |
81 |
| -} |
82 |
| - |
83 |
| -.offcanvas-bottom { |
84 |
| - right: 0; |
85 |
| - left: 0; |
86 |
| - height: $offcanvas-vertical-height; |
87 |
| - max-height: 100%; |
88 |
| - border-top: $offcanvas-border-width solid $offcanvas-border-color; |
89 |
| - transform: translateY(100%); |
90 |
| -} |
|
0 commit comments