@lumx/core 2.1.9-alpha-thumbnail4 → 2.1.9-alpha-thumbnail9

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.
@@ -12,6 +12,33 @@
12
12
  background: none;
13
13
  outline: none;
14
14
 
15
+ &--fill-height,
16
+ &--fill-height &__background,
17
+ &--fill-height &__image {
18
+ width: unset;
19
+ max-width: unset;
20
+ height: 100%;
21
+ max-height: unset;
22
+ flex: 1 1 auto;
23
+ }
24
+
25
+ &__background {
26
+ position: relative;
27
+ width: 100%;
28
+
29
+ #{$self}--variant-rounded & {
30
+ border-radius: var(--lumx-border-radius);
31
+ }
32
+ }
33
+
34
+ &__image {
35
+ font-size: 0;
36
+ width: fit-content;
37
+ max-width: 100%;
38
+ height: fit-content;
39
+ max-height: 100%;
40
+ }
41
+
15
42
  &__background,
16
43
  &__image {
17
44
  display: block;
@@ -35,54 +62,6 @@
35
62
  right: -$lumx-spacing-unit / 2;
36
63
  bottom: -$lumx-spacing-unit / 2;
37
64
  }
38
-
39
- /* Rounded variant */
40
- &--variant-rounded &__background {
41
- border-radius: var(--lumx-border-radius);
42
- }
43
-
44
- &--fill-height,
45
- &--fill-height &__background,
46
- &--fill-height &__image {
47
- flex: 1 1 auto;
48
- height: 100%;
49
- }
50
-
51
- /* Thumbnail original ratio */
52
- &--aspect-ratio-original {
53
- &:not(#{$self}--fill-height) {
54
- width: fit-content;
55
- height: fit-content;
56
-
57
- #{$self}__image:not(#{$self}__image--is-loading)
58
- {
59
- width: fit-content;
60
- height: fit-content;
61
- max-width: 100%;
62
- max-height: 100%;
63
- }
64
- }
65
-
66
- &#{$self}--fill-height {
67
- #{$self}__background,
68
- #{$self}__image
69
- {
70
- max-height: unset;
71
- max-width: unset;
72
- }
73
- }
74
- }
75
-
76
- /* Thumbnail error fallback */
77
- &--has-error &__fallback {
78
- position: absolute;
79
- inset: 0;
80
- display: flex;
81
- align-items: center;
82
- justify-content: center;
83
- background-color: lumx-color-variant('dark', 'L6');
84
- }
85
-
86
65
  }
87
66
 
88
67
  /* Thumbnail sizes
@@ -90,13 +69,14 @@
90
69
 
91
70
  @each $key, $size in $lumx-sizes {
92
71
  .#{$lumx-base-prefix}-thumbnail--size-#{$key} {
93
- max-width: $size;
94
- width: 100%;
72
+ width: $size;
73
+ }
74
+ }
95
75
 
96
- .#{$lumx-base-prefix}-thumbnail__background,
97
- .#{$lumx-base-prefix}-thumbnail__image {
98
- width: 100%;
99
- }
76
+ .#{$lumx-base-prefix}-thumbnail[class*="#{$lumx-base-prefix}-thumbnail--size-"] {
77
+ .#{$lumx-base-prefix}-thumbnail__background,
78
+ .#{$lumx-base-prefix}-thumbnail__image {
79
+ width: 100%;
100
80
  }
101
81
  }
102
82
 
@@ -104,15 +84,12 @@
104
84
  ========================================================================== */
105
85
 
106
86
  .#{$lumx-base-prefix}-thumbnail:not(.#{$lumx-base-prefix}-thumbnail--aspect-ratio-original) {
107
-
108
- .#{$lumx-base-prefix}-thumbnail__background {
109
- width: 100%;
110
- position: relative;
111
- }
112
-
113
87
  .#{$lumx-base-prefix}-thumbnail__image {
114
88
  position: absolute;
115
- inset: 0;
89
+ top: 0;
90
+ right: 0;
91
+ bottom: 0;
92
+ left: 0;
116
93
  width: 100%;
117
94
  height: 100%;
118
95
  object-fit: cover;
@@ -121,10 +98,8 @@
121
98
  }
122
99
 
123
100
  @each $key, $aspect-ratio in $lumx-thumbnail-aspect-ratio {
124
- .#{$lumx-base-prefix}-thumbnail--aspect-ratio-#{$key} {
125
- .#{$lumx-base-prefix}-thumbnail__background {
126
- padding-top: $aspect-ratio;
127
- }
101
+ .#{$lumx-base-prefix}-thumbnail--aspect-ratio-#{$key} .#{$lumx-base-prefix}-thumbnail__background {
102
+ padding-top: $aspect-ratio;
128
103
  }
129
104
  }
130
105
 
@@ -181,13 +156,47 @@
181
156
  }
182
157
  }
183
158
 
184
- /* Loading */
185
- .#{$lumx-base-prefix}-thumbnail--is-loading {
159
+ /* Loading state */
160
+ .#{$lumx-base-prefix}-thumbnail--is-loading {
161
+ &.#{$lumx-base-prefix}-thumbnail--theme-light .#{$lumx-base-prefix}-thumbnail__background {
162
+ @include lumx-skeleton('light');
163
+ }
164
+
186
165
  &.#{$lumx-base-prefix}-thumbnail--theme-dark .#{$lumx-base-prefix}-thumbnail__background {
187
166
  @include lumx-skeleton('dark');
188
167
  }
189
- &.#{$lumx-base-prefix}-thumbnail--theme-light .#{$lumx-base-prefix}-thumbnail__background {
190
- @include lumx-skeleton('light');
168
+ }
169
+
170
+ /* Error state */
171
+ .#{$lumx-base-prefix}-thumbnail--has-error {
172
+ /** Icon fallback */
173
+ &.#{$lumx-base-prefix}-thumbnail--has-icon-error-fallback {
174
+ .#{$lumx-base-prefix}-thumbnail__fallback {
175
+ position: absolute;
176
+ top: 0;
177
+ right: 0;
178
+ bottom: 0;
179
+ left: 0;
180
+ display: flex;
181
+ align-items: center;
182
+ justify-content: center;
183
+ }
184
+
185
+ &.#{$lumx-base-prefix}-thumbnail--theme-light .#{$lumx-base-prefix}-thumbnail__fallback {
186
+ background-color: lumx-color-variant('dark', 'L6');
187
+ }
188
+
189
+ &.#{$lumx-base-prefix}-thumbnail--theme-dark .#{$lumx-base-prefix}-thumbnail__fallback {
190
+ background-color: lumx-color-variant('light', 'L6');
191
+ }
192
+ }
193
+
194
+ /* Custom fallback */
195
+ &.#{$lumx-base-prefix}-thumbnail--has-custom-error-fallback {
196
+ /* Disable aspect ratio */
197
+ .#{$lumx-base-prefix}-thumbnail__background {
198
+ padding-top: 0;
199
+ }
191
200
  }
192
201
  }
193
202
 
@@ -1,11 +1,7 @@
1
1
  @function lumx-color-variant($color, $variant) {
2
2
  @if map-has-key($lumx-color-palette, $color) {
3
- @if $color == 'primary' or $color == 'secondary' {
4
- @return var(--lumx-color-#{$color}-#{$variant});
5
- } @else {
6
- @return map-get(map-get($lumx-color-palette, $color), $variant);
7
- }
3
+ @return var(--lumx-color-#{$color}-#{$variant});
8
4
  } @else {
9
- @return map-get(map-get($lumx-color-palette, 'dark'), $variant);
5
+ @return var(--lumx-color-dark-N);
10
6
  }
11
7
  }