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

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,32 @@
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
+ width: fit-content;
36
+ max-width: 100%;
37
+ height: fit-content;
38
+ max-height: 100%;
39
+ }
40
+
15
41
  &__background,
16
42
  &__image {
17
43
  display: block;
@@ -35,54 +61,6 @@
35
61
  right: -$lumx-spacing-unit / 2;
36
62
  bottom: -$lumx-spacing-unit / 2;
37
63
  }
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
64
  }
87
65
 
88
66
  /* Thumbnail sizes
@@ -90,8 +68,7 @@
90
68
 
91
69
  @each $key, $size in $lumx-sizes {
92
70
  .#{$lumx-base-prefix}-thumbnail--size-#{$key} {
93
- max-width: $size;
94
- width: 100%;
71
+ width: $size;
95
72
 
96
73
  .#{$lumx-base-prefix}-thumbnail__background,
97
74
  .#{$lumx-base-prefix}-thumbnail__image {
@@ -104,15 +81,12 @@
104
81
  ========================================================================== */
105
82
 
106
83
  .#{$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
84
  .#{$lumx-base-prefix}-thumbnail__image {
114
85
  position: absolute;
115
- inset: 0;
86
+ top: 0;
87
+ right: 0;
88
+ bottom: 0;
89
+ left: 0;
116
90
  width: 100%;
117
91
  height: 100%;
118
92
  object-fit: cover;
@@ -121,10 +95,8 @@
121
95
  }
122
96
 
123
97
  @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
- }
98
+ .#{$lumx-base-prefix}-thumbnail--aspect-ratio-#{$key} .#{$lumx-base-prefix}-thumbnail__background {
99
+ padding-top: $aspect-ratio;
128
100
  }
129
101
  }
130
102
 
@@ -181,13 +153,45 @@
181
153
  }
182
154
  }
183
155
 
184
- /* Loading */
185
- .#{$lumx-base-prefix}-thumbnail--is-loading {
156
+ /* Loading state */
157
+ .#{$lumx-base-prefix}-thumbnail--is-loading {
158
+ &.#{$lumx-base-prefix}-thumbnail--theme-light .#{$lumx-base-prefix}-thumbnail__background {
159
+ @include lumx-skeleton('light');
160
+ }
161
+
186
162
  &.#{$lumx-base-prefix}-thumbnail--theme-dark .#{$lumx-base-prefix}-thumbnail__background {
187
163
  @include lumx-skeleton('dark');
188
164
  }
189
- &.#{$lumx-base-prefix}-thumbnail--theme-light .#{$lumx-base-prefix}-thumbnail__background {
190
- @include lumx-skeleton('light');
165
+ }
166
+
167
+ /* Error state */
168
+ .#{$lumx-base-prefix}-thumbnail--has-error {
169
+ /** Icon fallback */
170
+ &.#{$lumx-base-prefix}-thumbnail--has-icon-error-fallback .#{$lumx-base-prefix}-thumbnail__fallback {
171
+ position: absolute;
172
+ top: 0;
173
+ right: 0;
174
+ bottom: 0;
175
+ left: 0;
176
+ display: flex;
177
+ align-items: center;
178
+ justify-content: center;
179
+
180
+ #{$lumx-base-prefix}-thumbnail--theme-light & {
181
+ background-color: lumx-color-variant('dark', 'L6');
182
+ }
183
+
184
+ #{$lumx-base-prefix}-thumbnail--theme-dark & {
185
+ background-color: lumx-color-variant('light', 'L6');
186
+ }
187
+ }
188
+
189
+ /* Custom fallback */
190
+ &.#{$lumx-base-prefix}-thumbnail--has-custom-error-fallback {
191
+ /* Disable aspect ratio */
192
+ .#{$lumx-base-prefix}-thumbnail__background {
193
+ padding-top: 0;
194
+ }
191
195
  }
192
196
  }
193
197
 
@@ -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
  }