@lumx/core 2.1.9-alpha-thumbnail2 → 2.1.9-alpha-thumbnail7

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.
@@ -82,6 +82,12 @@
82
82
  &.#{$lumx-base-prefix}-chip--is-highlighted {
83
83
  @include lumx-state(lumx-base-const('state', 'FOCUS'), lumx-base-const('emphasis', 'MEDIUM'), $key);
84
84
  }
85
+
86
+ @if $key == 'dark' {
87
+ .#{$lumx-base-prefix}-chip__label {
88
+ color: lumx-color-variant('dark', 'L1');
89
+ }
90
+ }
85
91
  }
86
92
  }
87
93
 
@@ -25,9 +25,14 @@
25
25
  @each $key, $color in $lumx-color-palette {
26
26
  .#{$lumx-base-prefix}-flag--color-#{$key} {
27
27
  border: 2px solid lumx-color-variant($key, 'L4');
28
- }
29
28
 
30
- .#{$lumx-base-prefix}-flag--color-#{$key} .#{$lumx-base-prefix}-flag__label {
31
- color: lumx-color-variant($key, 'D2');
29
+ .#{$lumx-base-prefix}-flag__label,
30
+ .#{$lumx-base-prefix}-flag__icon {
31
+ @if $key == 'dark' {
32
+ color: lumx-color-variant($key, 'L1');
33
+ } @else {
34
+ color: lumx-color-variant($key, 'D2');
35
+ }
36
+ }
32
37
  }
33
38
  }
@@ -16,6 +16,10 @@
16
16
  background-color: lumx-color-variant($color, 'L5');
17
17
  color: lumx-color-variant($color, 'L2');
18
18
  } @else if $has-shape == false {
19
- color: lumx-color-variant($color, 'N');
19
+ @if $color == 'dark' {
20
+ color: lumx-color-variant('dark', 'L1');
21
+ } @else {
22
+ color: lumx-color-variant($color, 'N');
23
+ }
20
24
  }
21
25
  }
@@ -11,6 +11,8 @@
11
11
  display: flex;
12
12
  flex: 1 1 auto;
13
13
  flex-direction: column;
14
+ justify-content: center;
15
+ align-items: center;
14
16
  }
15
17
 
16
18
  &__wrapper {
@@ -23,7 +23,8 @@
23
23
  }
24
24
 
25
25
  @mixin lumx-list-item-clickable() {
26
- color: lumx-color-variant('dark', 'N');
26
+ @include lumx-state(lumx-base-const('state', 'DEFAULT'), lumx-base-const('emphasis', 'LOW'), 'dark');
27
+
27
28
  cursor: pointer;
28
29
 
29
30
  &:hover,
@@ -21,7 +21,6 @@
21
21
  align-items: center;
22
22
  padding: 0 $lumx-spacing-unit;
23
23
  border-radius: var(--lumx-border-radius);
24
- color: lumx-color-variant('dark', 'N');
25
24
  outline: none;
26
25
  text-decoration: none;
27
26
  }
@@ -12,21 +12,38 @@
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
+
15
25
  &__background {
16
- overflow: hidden;
17
- background-position: center;
18
- background-repeat: no-repeat;
19
- background-size: cover;
26
+ position: relative;
27
+ width: 100%;
28
+
29
+ #{$self}--variant-rounded & {
30
+ border-radius: var(--lumx-border-radius);
31
+ }
20
32
  }
21
33
 
22
34
  &__image {
23
- display: block;
24
- // Make sure
25
- overflow: hidden;
35
+ font-size: 0;
36
+ width: fit-content;
37
+ max-width: 100%;
38
+ height: fit-content;
39
+ max-height: 100%;
26
40
  }
27
41
 
28
42
  &__background,
29
43
  &__image {
44
+ display: block;
45
+ overflow: hidden;
46
+
30
47
  #{$self}--align-left & {
31
48
  margin-right: auto;
32
49
  }
@@ -45,76 +62,21 @@
45
62
  right: -$lumx-spacing-unit / 2;
46
63
  bottom: -$lumx-spacing-unit / 2;
47
64
  }
48
-
49
- /* Rounded variant */
50
- &--variant-rounded &__background {
51
- border-radius: var(--lumx-border-radius);
52
- }
53
-
54
- &--fill-height,
55
- &--fill-height &__background,
56
- &--fill-height &__image {
57
- flex: 1 1 auto;
58
- height: 100%;
59
- }
60
-
61
- /* Thumbnail original ratio */
62
- &--aspect-ratio-original {
63
- &:not(#{$self}--fill-height) {
64
- width: fit-content;
65
- height: fit-content;
66
-
67
- #{$self}__image:not(#{$self}__image--is-loading)
68
- {
69
- width: fit-content;
70
- height: fit-content;
71
- max-width: 100%;
72
- max-height: 100%;
73
- }
74
- }
75
-
76
- &#{$self}--fill-height {
77
- #{$self}__background,
78
- #{$self}__image
79
- {
80
- max-height: unset;
81
- max-width: unset;
82
- }
83
- }
84
- }
85
-
86
- /* Thumbnail error fallback */
87
- &--has-error {
88
- #{$self}__background {
89
- display: grid;
90
-
91
- // Stack image and fallback on top of each other
92
- & > * {
93
- grid-column: 1;
94
- grid-row: 1;
95
- }
96
- }
97
-
98
- #{$self}__fallback {
99
- display: flex;
100
- align-items: center;
101
- justify-content: center;
102
- background-color: lumx-color-variant('dark', 'L6');
103
- }
104
- }
105
-
106
65
  }
107
66
 
108
67
  /* Thumbnail sizes
109
68
  ========================================================================== */
110
69
 
111
70
  @each $key, $size in $lumx-sizes {
112
- .#{$lumx-base-prefix}-thumbnail--size-#{$key}:not(.#{$lumx-base-prefix}-thumbnail--fill-height) {
71
+ .#{$lumx-base-prefix}-thumbnail--size-#{$key} {
113
72
  width: $size;
73
+ }
74
+ }
114
75
 
115
- .#{$lumx-base-prefix}-thumbnail__image {
116
- width: 100%;
117
- }
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%;
118
80
  }
119
81
  }
120
82
 
@@ -122,25 +84,12 @@
122
84
  ========================================================================== */
123
85
 
124
86
  .#{$lumx-base-prefix}-thumbnail:not(.#{$lumx-base-prefix}-thumbnail--aspect-ratio-original) {
125
- &::before {
126
- display: block;
127
- content: "";
128
- //width: 100%;
129
- //float: left;
130
- }
131
-
132
- /*&::after {
133
- display: block;
134
- content: "";
135
- clear: both;
136
- }*/
137
-
138
- .#{$lumx-base-prefix}-thumbnail__background {
139
- position: absolute;
140
- inset: 0;
141
- }
142
-
143
87
  .#{$lumx-base-prefix}-thumbnail__image {
88
+ position: absolute;
89
+ top: 0;
90
+ right: 0;
91
+ bottom: 0;
92
+ left: 0;
144
93
  width: 100%;
145
94
  height: 100%;
146
95
  object-fit: cover;
@@ -149,10 +98,8 @@
149
98
  }
150
99
 
151
100
  @each $key, $aspect-ratio in $lumx-thumbnail-aspect-ratio {
152
- .#{$lumx-base-prefix}-thumbnail--aspect-ratio-#{$key} {
153
- &::before {
154
- padding-top: $aspect-ratio;
155
- }
101
+ .#{$lumx-base-prefix}-thumbnail--aspect-ratio-#{$key} .#{$lumx-base-prefix}-thumbnail__background {
102
+ padding-top: $aspect-ratio;
156
103
  }
157
104
  }
158
105
 
@@ -209,31 +156,62 @@
209
156
  }
210
157
  }
211
158
 
212
- /* Loading */
213
- .#{$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
+
214
165
  &.#{$lumx-base-prefix}-thumbnail--theme-dark .#{$lumx-base-prefix}-thumbnail__background {
215
166
  @include lumx-skeleton('dark');
216
167
  }
217
- &.#{$lumx-base-prefix}-thumbnail--theme-light .#{$lumx-base-prefix}-thumbnail__background {
218
- @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
+ }
219
200
  }
220
201
  }
221
202
 
222
203
  /* Thumbnail badge mask
223
204
  ========================================================================== */
224
205
 
225
- @each $key, $size in $lumx-sizes {
226
- $mask-size: map-get($lumx-sizes, lumx-base-const('size', 'XS')) - $lumx-spacing-unit;
227
- $mask-offset: $size - 6;
206
+ $badge-radius-size: map-get($lumx-sizes, lumx-base-const('size', 'XS')) / 2 + 2;
228
207
 
229
- .#{$lumx-base-prefix}-thumbnail--has-badge.#{$lumx-base-prefix}-thumbnail--size-#{$key} {
230
- .#{$lumx-base-prefix}-thumbnail__background,
231
- .#{$lumx-base-prefix}-thumbnail__fallback {
232
- mask-image: radial-gradient(
233
- circle at $mask-offset $mask-offset,
234
- transparent $mask-size,
235
- /* offset circle size (+1) to soften the edge */ black $mask-size + 1
236
- );
237
- }
208
+ .#{$lumx-base-prefix}-thumbnail--has-badge {
209
+ .#{$lumx-base-prefix}-thumbnail__background,
210
+ .#{$lumx-base-prefix}-thumbnail__fallback {
211
+ mask-image: radial-gradient(
212
+ circle at calc(100% - #{$badge-radius-size - 6}) calc(100% - #{$badge-radius-size - 6}),
213
+ transparent $badge-radius-size,
214
+ /* offset circle size (+1) to soften the edge */ black $badge-radius-size + 1
215
+ );
238
216
  }
239
217
  }
@@ -6,5 +6,5 @@ $lumx-thumbnail-aspect-ratio: (
6
6
  // Ratio 1:1
7
7
  'square': 100%,
8
8
  // Ratio 2:3
9
- 'vertical': 150%,
9
+ 'vertical': 150%
10
10
  );
@@ -73,7 +73,7 @@
73
73
  margin-bottom: $lumx-spacing-unit;
74
74
 
75
75
  #{$self}--theme-light & {
76
- color: lumx-color-variant('dark', 'N');
76
+ color: lumx-color-variant('dark', 'L1');
77
77
  }
78
78
 
79
79
  #{$self}--theme-dark & {
@@ -87,7 +87,7 @@
87
87
  text-align: center;
88
88
 
89
89
  #{$self}--theme-light & {
90
- color: lumx-color-variant('dark', 'N');
90
+ color: lumx-color-variant('dark', 'L1');
91
91
  }
92
92
 
93
93
  #{$self}--theme-dark & {
@@ -49,7 +49,7 @@
49
49
  color: lumx-color-variant('light', 'N');
50
50
  }
51
51
 
52
- &--is-clickable {
52
+ &[tabindex='0'] {
53
53
  #{$self}--theme-light & {
54
54
  @include lumx-link('dark');
55
55
  }
@@ -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
  }
@@ -52,10 +52,8 @@
52
52
  color: lumx-color-variant('primary', 'D2');
53
53
  } @else if $state == lumx-base-const('state', 'HOVER') {
54
54
  background-color: lumx-color-variant('primary', 'L4');
55
- color: lumx-color-variant('primary', 'D2');
56
55
  } @else if $state == lumx-base-const('state', 'ACTIVE') {
57
56
  background-color: lumx-color-variant('primary', 'L3');
58
- color: lumx-color-variant('primary', 'D2');
59
57
  } @else if $state == lumx-base-const('state', 'FOCUS') {
60
58
  @if $has-focus-inset == true {
61
59
  box-shadow: inset 0 0 0 2px lumx-color-variant('primary', 'L3');
@@ -69,10 +67,8 @@
69
67
  color: lumx-color-variant('light', 'N');
70
68
  } @else if $state == lumx-base-const('state', 'HOVER') {
71
69
  background-color: lumx-color-variant('light', 'L4');
72
- color: lumx-color-variant('light', 'N');
73
70
  } @else if $state == lumx-base-const('state', 'ACTIVE') {
74
71
  background-color: lumx-color-variant('light', 'L5');
75
- color: lumx-color-variant('light', 'N');
76
72
  } @else if $state == lumx-base-const('state', 'FOCUS') {
77
73
  @if $has-focus-inset == true {
78
74
  box-shadow: inset 0 0 0 2px lumx-color-variant('light', 'L3');