@lumx/core 2.1.9-alpha-thumbnail3 → 2.1.9-alpha-thumbnail8

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
  }
@@ -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,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,70 +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 {
78
- /* #{$self}__background {
79
- display: grid;
80
-
81
- // Stack image and fallback on top of each other
82
- #{$self}__image,
83
- #{$self}__fallback,
84
- {
85
- position: initial;
86
- grid-column: 1;
87
- grid-row: 1;
88
- }
89
- }
90
- */
91
-
92
- #{$self}__fallback {
93
- position: absolute;
94
- inset: 0;
95
- display: flex;
96
- align-items: center;
97
- justify-content: center;
98
- background-color: lumx-color-variant('dark', 'L6');
99
- }
100
- }
101
-
102
65
  }
103
66
 
104
67
  /* Thumbnail sizes
@@ -106,13 +69,14 @@
106
69
 
107
70
  @each $key, $size in $lumx-sizes {
108
71
  .#{$lumx-base-prefix}-thumbnail--size-#{$key} {
109
- max-width: $size;
110
- width: 100%;
72
+ width: $size;
73
+ }
74
+ }
111
75
 
112
- .#{$lumx-base-prefix}-thumbnail__background,
113
- .#{$lumx-base-prefix}-thumbnail__image {
114
- width: 100%;
115
- }
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%;
116
80
  }
117
81
  }
118
82
 
@@ -120,14 +84,12 @@
120
84
  ========================================================================== */
121
85
 
122
86
  .#{$lumx-base-prefix}-thumbnail:not(.#{$lumx-base-prefix}-thumbnail--aspect-ratio-original) {
123
-
124
- .#{$lumx-base-prefix}-thumbnail__background {
125
- position: relative;
126
- }
127
-
128
87
  .#{$lumx-base-prefix}-thumbnail__image {
129
88
  position: absolute;
130
- inset: 0;
89
+ top: 0;
90
+ right: 0;
91
+ bottom: 0;
92
+ left: 0;
131
93
  width: 100%;
132
94
  height: 100%;
133
95
  object-fit: cover;
@@ -136,10 +98,8 @@
136
98
  }
137
99
 
138
100
  @each $key, $aspect-ratio in $lumx-thumbnail-aspect-ratio {
139
- .#{$lumx-base-prefix}-thumbnail--aspect-ratio-#{$key} {
140
- .#{$lumx-base-prefix}-thumbnail__background {
141
- padding-top: $aspect-ratio;
142
- }
101
+ .#{$lumx-base-prefix}-thumbnail--aspect-ratio-#{$key} .#{$lumx-base-prefix}-thumbnail__background {
102
+ padding-top: $aspect-ratio;
143
103
  }
144
104
  }
145
105
 
@@ -196,31 +156,62 @@
196
156
  }
197
157
  }
198
158
 
199
- /* Loading */
200
- .#{$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
+
201
165
  &.#{$lumx-base-prefix}-thumbnail--theme-dark .#{$lumx-base-prefix}-thumbnail__background {
202
166
  @include lumx-skeleton('dark');
203
167
  }
204
- &.#{$lumx-base-prefix}-thumbnail--theme-light .#{$lumx-base-prefix}-thumbnail__background {
205
- @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
+ }
206
200
  }
207
201
  }
208
202
 
209
203
  /* Thumbnail badge mask
210
204
  ========================================================================== */
211
205
 
212
- @each $key, $size in $lumx-sizes {
213
- $mask-size: map-get($lumx-sizes, lumx-base-const('size', 'XS')) - $lumx-spacing-unit;
214
- $mask-offset: $size - 6;
206
+ $badge-radius-size: map-get($lumx-sizes, lumx-base-const('size', 'XS')) / 2 + 2;
215
207
 
216
- .#{$lumx-base-prefix}-thumbnail--has-badge.#{$lumx-base-prefix}-thumbnail--size-#{$key} {
217
- .#{$lumx-base-prefix}-thumbnail__background,
218
- .#{$lumx-base-prefix}-thumbnail__fallback {
219
- mask-image: radial-gradient(
220
- circle at $mask-offset $mask-offset,
221
- transparent $mask-size,
222
- /* offset circle size (+1) to soften the edge */ black $mask-size + 1
223
- );
224
- }
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
+ );
225
216
  }
226
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');