@lumx/core 2.1.9 → 2.2.1

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.
@@ -18,15 +18,14 @@
18
18
  ========================================================================== */
19
19
 
20
20
  .#{$lumx-base-prefix}-skeleton-circle {
21
- animation: skeleton-loading 1s ease-in-out 0s infinite;
22
21
  border-radius: 50%;
23
22
 
24
23
  &--theme-light {
25
- background-color: lumx-color-variant('dark', 'L5');
24
+ @include lumx-skeleton('light');
26
25
  }
27
26
 
28
27
  &--theme-dark {
29
- background-color: lumx-color-variant('light', 'L5');
28
+ @include lumx-skeleton('dark');
30
29
  }
31
30
  }
32
31
 
@@ -47,18 +46,16 @@
47
46
  ========================================================================== */
48
47
 
49
48
  .#{$lumx-base-prefix}-skeleton-rectangle {
50
- animation: skeleton-loading 1s ease-in-out 0s infinite;
51
-
52
49
  &--variant-rounded {
53
50
  border-radius: var(--lumx-border-radius);
54
51
  }
55
52
 
56
53
  &--theme-light {
57
- background-color: lumx-color-variant('dark', 'L5');
54
+ @include lumx-skeleton('light');
58
55
  }
59
56
 
60
57
  &--theme-dark {
61
- background-color: lumx-color-variant('light', 'L5');
58
+ @include lumx-skeleton('dark');
62
59
  }
63
60
  }
64
61
 
@@ -0,0 +1,10 @@
1
+
2
+ @mixin lumx-skeleton($theme: 'light') {
3
+ animation: skeleton-loading 1s ease-in-out 0s infinite;
4
+
5
+ @if $theme == 'light' {
6
+ background-color: lumx-color-variant('dark', 'L5');
7
+ } @else {
8
+ background-color: lumx-color-variant('light', 'L5');
9
+ }
10
+ }
@@ -12,44 +12,43 @@
12
12
  background: none;
13
13
  outline: none;
14
14
 
15
- &--fill-height,
16
- &--fill-height &__background {
17
- display: flex;
18
- /* Safari hack to force the image ratio */
19
- height: fit-content;
20
- min-height: 100%;
21
- flex: 1 1 auto;
22
- flex-direction: column;
23
- justify-content: center;
24
- }
15
+ &--fill-height {
16
+ &,
17
+ #{$self}__background {
18
+ display: flex;
19
+ height: fit-content;
20
+ min-height: 100%;
21
+ flex: 1 1 auto;
22
+ flex-direction: column;
23
+ justify-content: center;
24
+ }
25
25
 
26
- &--variant-rounded {
27
- border-radius: var(--lumx-border-radius);
26
+ #{$self}__image {
27
+ width: unset;
28
+ }
28
29
  }
29
30
 
30
31
  &__background {
31
32
  position: relative;
32
33
  width: 100%;
33
- background-position: center;
34
- background-repeat: no-repeat;
35
- background-size: cover;
36
34
 
37
35
  #{$self}--variant-rounded & {
38
36
  border-radius: var(--lumx-border-radius);
39
37
  }
40
38
  }
41
39
 
42
- &__focused-image {
43
- max-width: none;
44
- }
45
-
46
- &__background,
47
40
  &__image {
48
41
  display: block;
42
+ width: fit-content;
49
43
  max-width: 100%;
50
- /* IE11 hack related to a bug with IE flexbox implementation (cf. https://stackoverflow.com/a/54054592) */
51
- min-height: 1px;
44
+ height: fit-content;
52
45
  max-height: 100%;
46
+ font-size: 0;
47
+ }
48
+
49
+ &__background,
50
+ &__image {
51
+ overflow: hidden;
53
52
 
54
53
  #{$self}--align-left & {
55
54
  margin-right: auto;
@@ -62,16 +61,6 @@
62
61
  #{$self}--align-right & {
63
62
  margin-left: auto;
64
63
  }
65
-
66
- #{$self}--variant-rounded & {
67
- border-radius: var(--lumx-border-radius);
68
- }
69
- }
70
-
71
- &__fallback {
72
- width: fit-content;
73
- /* Center fallback icon when using fill-height prop */
74
- margin: 0 auto;
75
64
  }
76
65
 
77
66
  &__badge {
@@ -93,6 +82,20 @@
93
82
  /* Thumbnail aspect ratio
94
83
  ========================================================================== */
95
84
 
85
+ .#{$lumx-base-prefix}-thumbnail:not(.#{$lumx-base-prefix}-thumbnail--aspect-ratio-original) {
86
+ .#{$lumx-base-prefix}-thumbnail__image {
87
+ position: absolute;
88
+ top: 0;
89
+ right: 0;
90
+ bottom: 0;
91
+ left: 0;
92
+ width: 100%;
93
+ height: 100%;
94
+ object-fit: cover;
95
+ object-position: center;
96
+ }
97
+ }
98
+
96
99
  @each $key, $aspect-ratio in $lumx-thumbnail-aspect-ratio {
97
100
  .#{$lumx-base-prefix}-thumbnail--aspect-ratio-#{$key}:not(.#{$lumx-base-prefix}-thumbnail--fill-height)
98
101
  .#{$lumx-base-prefix}-thumbnail__background {
@@ -103,8 +106,9 @@
103
106
  /* Thumbnail states
104
107
  ========================================================================== */
105
108
 
106
- .#{$lumx-base-prefix}-thumbnail[tabindex='0'] {
109
+ .#{$lumx-base-prefix}-thumbnail--is-clickable {
107
110
  position: relative;
111
+ display: block;
108
112
  cursor: pointer;
109
113
 
110
114
  &::after {
@@ -119,48 +123,95 @@
119
123
  pointer-events: none;
120
124
  }
121
125
 
122
- &:hover::after {
126
+ /* Hover */
127
+ &:hover::after,
128
+ &:focus::after {
123
129
  @include lumx-state(lumx-base-const('state', 'HOVER'), lumx-base-const('emphasis', 'LOW'), 'dark');
124
130
  }
125
131
 
132
+ /* Active */
126
133
  &:active::after {
127
134
  @include lumx-state(lumx-base-const('state', 'ACTIVE'), lumx-base-const('emphasis', 'LOW'), 'dark');
128
135
  }
129
136
  }
130
137
 
131
- .#{$lumx-base-prefix}-thumbnail--variant-rounded.#{$lumx-base-prefix}-thumbnail[tabindex='0'] {
138
+ /* Focused (variant rounded) */
139
+ .#{$lumx-base-prefix}-thumbnail--variant-rounded.#{$lumx-base-prefix}-thumbnail--is-clickable {
132
140
  &[data-focus-visible-added]::after {
133
141
  border-radius: var(--lumx-border-radius);
134
142
  }
135
143
  }
136
144
 
137
- .#{$lumx-base-prefix}-thumbnail--theme-light.#{$lumx-base-prefix}-thumbnail[tabindex='0'] {
145
+ /* Focused (light theme) */
146
+ .#{$lumx-base-prefix}-thumbnail--theme-light.#{$lumx-base-prefix}-thumbnail--is-clickable {
138
147
  &[data-focus-visible-added]::after {
139
148
  @include lumx-state(lumx-base-const('state', 'FOCUS'), lumx-base-const('emphasis', 'LOW'), 'dark');
140
149
  }
141
150
  }
142
151
 
143
- .#{$lumx-base-prefix}-thumbnail--theme-dark.#{$lumx-base-prefix}-thumbnail[tabindex='0'] {
152
+ /* Focused (dark theme) */
153
+ .#{$lumx-base-prefix}-thumbnail--theme-dark.#{$lumx-base-prefix}-thumbnail--is-clickable {
144
154
  &[data-focus-visible-added]::after {
145
155
  @include lumx-state(lumx-base-const('state', 'FOCUS'), lumx-base-const('emphasis', 'LOW'), 'light');
146
156
  }
147
157
  }
148
158
 
149
- /* Thumbnail badge mask
150
- ========================================================================== */
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
+ }
151
164
 
152
- @each $key, $size in $lumx-sizes {
153
- $mask-size: map-get($lumx-sizes, lumx-base-const('size', 'XS')) - $lumx-spacing-unit;
154
- $mask-offset: $size - 6;
165
+ &.#{$lumx-base-prefix}-thumbnail--theme-dark .#{$lumx-base-prefix}-thumbnail__background {
166
+ @include lumx-skeleton('dark');
167
+ }
168
+ }
155
169
 
156
- .#{$lumx-base-prefix}-thumbnail--has-badge.#{$lumx-base-prefix}-thumbnail--size-#{$key} {
157
- .#{$lumx-base-prefix}-thumbnail__background,
170
+ /* Error state */
171
+ .#{$lumx-base-prefix}-thumbnail--has-error {
172
+ /** Icon fallback */
173
+ &.#{$lumx-base-prefix}-thumbnail--has-icon-error-fallback {
158
174
  .#{$lumx-base-prefix}-thumbnail__fallback {
159
- mask-image: radial-gradient(
160
- circle at $mask-offset $mask-offset,
161
- transparent $mask-size,
162
- /* offset circle size (+1) to soften the edge */ black $mask-size + 1
163
- );
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;
164
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
+ }
200
+ }
201
+ }
202
+
203
+ /* Thumbnail badge mask
204
+ ========================================================================== */
205
+
206
+ $badge-radius-size: map-get($lumx-sizes, lumx-base-const('size', 'XS')) / 2 + 2;
207
+
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
+ );
165
216
  }
166
217
  }
@@ -38,6 +38,7 @@
38
38
 
39
39
  &__name {
40
40
  outline: none;
41
+ width: fit-content;
41
42
 
42
43
  @include lumx-typography('subtitle1');
43
44
 
@@ -48,16 +49,6 @@
48
49
  #{$self}--theme-dark & {
49
50
  color: lumx-color-variant('light', 'N');
50
51
  }
51
-
52
- &[tabindex='0'] {
53
- #{$self}--theme-light & {
54
- @include lumx-link('dark');
55
- }
56
-
57
- #{$self}--theme-dark & {
58
- @include lumx-link('light');
59
- }
60
- }
61
52
  }
62
53
 
63
54
  &__fields {
@@ -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
  }