@lumx/core 2.1.9-alpha-thumbnail → 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.
@@ -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,19 +12,37 @@
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;
35
+ width: fit-content;
36
+ max-width: 100%;
37
+ height: fit-content;
38
+ max-height: 100%;
24
39
  }
25
40
 
26
41
  &__background,
27
42
  &__image {
43
+ display: block;
44
+ overflow: hidden;
45
+
28
46
  #{$self}--align-left & {
29
47
  margin-right: auto;
30
48
  }
@@ -43,73 +61,16 @@
43
61
  right: -$lumx-spacing-unit / 2;
44
62
  bottom: -$lumx-spacing-unit / 2;
45
63
  }
46
-
47
- /* Rounded variant */
48
- &--variant-rounded &__background {
49
- border-radius: var(--lumx-border-radius);
50
- }
51
-
52
- &--fill-height,
53
- &--fill-height &__background,
54
- &--fill-height &__image {
55
- flex: 1 1 auto;
56
- height: 100%;
57
- }
58
-
59
- /* Thumbnail original ratio */
60
- &--aspect-ratio-original {
61
- &:not(#{$self}--fill-height) {
62
- width: fit-content;
63
- height: fit-content;
64
-
65
- #{$self}__image:not(#{$self}__image--is-loading)
66
- {
67
- width: fit-content;
68
- height: fit-content;
69
- max-width: 100%;
70
- max-height: 100%;
71
- }
72
- }
73
-
74
- &#{$self}--fill-height {
75
- #{$self}__background,
76
- #{$self}__image
77
- {
78
- max-height: unset;
79
- max-width: unset;
80
- }
81
- }
82
- }
83
-
84
- /* Thumbnail error fallback */
85
- &--has-error {
86
- #{$self}__background {
87
- display: grid;
88
-
89
- // Stack image and fallback on top of each other
90
- & > * {
91
- grid-column: 1;
92
- grid-row: 1;
93
- }
94
- }
95
-
96
- #{$self}__fallback {
97
- display: flex;
98
- align-items: center;
99
- justify-content: center;
100
- background-color: lumx-color-variant('dark', 'L6');
101
- }
102
- }
103
-
104
64
  }
105
65
 
106
66
  /* Thumbnail sizes
107
67
  ========================================================================== */
108
68
 
109
69
  @each $key, $size in $lumx-sizes {
110
- .#{$lumx-base-prefix}-thumbnail--size-#{$key}:not(.#{$lumx-base-prefix}-thumbnail--fill-height) {
70
+ .#{$lumx-base-prefix}-thumbnail--size-#{$key} {
111
71
  width: $size;
112
72
 
73
+ .#{$lumx-base-prefix}-thumbnail__background,
113
74
  .#{$lumx-base-prefix}-thumbnail__image {
114
75
  width: 100%;
115
76
  }
@@ -120,25 +81,12 @@
120
81
  ========================================================================== */
121
82
 
122
83
  .#{$lumx-base-prefix}-thumbnail:not(.#{$lumx-base-prefix}-thumbnail--aspect-ratio-original) {
123
- &::before {
124
- display: block;
125
- content: "";
126
- //width: 100%;
127
- //float: left;
128
- }
129
-
130
- /*&::after {
131
- display: block;
132
- content: "";
133
- clear: both;
134
- }*/
135
-
136
- .#{$lumx-base-prefix}-thumbnail__background {
137
- position: absolute;
138
- inset: 0;
139
- }
140
-
141
84
  .#{$lumx-base-prefix}-thumbnail__image {
85
+ position: absolute;
86
+ top: 0;
87
+ right: 0;
88
+ bottom: 0;
89
+ left: 0;
142
90
  width: 100%;
143
91
  height: 100%;
144
92
  object-fit: cover;
@@ -147,10 +95,8 @@
147
95
  }
148
96
 
149
97
  @each $key, $aspect-ratio in $lumx-thumbnail-aspect-ratio {
150
- .#{$lumx-base-prefix}-thumbnail--aspect-ratio-#{$key} {
151
- &::before {
152
- padding-top: $aspect-ratio;
153
- }
98
+ .#{$lumx-base-prefix}-thumbnail--aspect-ratio-#{$key} .#{$lumx-base-prefix}-thumbnail__background {
99
+ padding-top: $aspect-ratio;
154
100
  }
155
101
  }
156
102
 
@@ -207,31 +153,60 @@
207
153
  }
208
154
  }
209
155
 
210
- /* Loading */
211
- .#{$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
+
212
162
  &.#{$lumx-base-prefix}-thumbnail--theme-dark .#{$lumx-base-prefix}-thumbnail__background {
213
163
  @include lumx-skeleton('dark');
214
164
  }
215
- &.#{$lumx-base-prefix}-thumbnail--theme-light .#{$lumx-base-prefix}-thumbnail__background {
216
- @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
+ }
217
195
  }
218
196
  }
219
197
 
220
198
  /* Thumbnail badge mask
221
199
  ========================================================================== */
222
200
 
223
- @each $key, $size in $lumx-sizes {
224
- $mask-size: map-get($lumx-sizes, lumx-base-const('size', 'XS')) - $lumx-spacing-unit;
225
- $mask-offset: $size - 6;
201
+ $badge-radius-size: map-get($lumx-sizes, lumx-base-const('size', 'XS')) / 2 + 2;
226
202
 
227
- .#{$lumx-base-prefix}-thumbnail--has-badge.#{$lumx-base-prefix}-thumbnail--size-#{$key} {
228
- .#{$lumx-base-prefix}-thumbnail__background,
229
- .#{$lumx-base-prefix}-thumbnail__fallback {
230
- mask-image: radial-gradient(
231
- circle at $mask-offset $mask-offset,
232
- transparent $mask-size,
233
- /* offset circle size (+1) to soften the edge */ black $mask-size + 1
234
- );
235
- }
203
+ .#{$lumx-base-prefix}-thumbnail--has-badge {
204
+ .#{$lumx-base-prefix}-thumbnail__background,
205
+ .#{$lumx-base-prefix}-thumbnail__fallback {
206
+ mask-image: radial-gradient(
207
+ circle at calc(100% - #{$badge-radius-size - 6}) calc(100% - #{$badge-radius-size - 6}),
208
+ transparent $badge-radius-size,
209
+ /* offset circle size (+1) to soften the edge */ black $badge-radius-size + 1
210
+ );
236
211
  }
237
212
  }
@@ -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');