@lumx/core 2.1.9 → 2.2.0

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 {
@@ -90,9 +79,30 @@
90
79
  }
91
80
  }
92
81
 
82
+ .#{$lumx-base-prefix}-thumbnail[class*='#{$lumx-base-prefix}-thumbnail--size-'] {
83
+ .#{$lumx-base-prefix}-thumbnail__background,
84
+ .#{$lumx-base-prefix}-thumbnail__image {
85
+ width: 100%;
86
+ }
87
+ }
88
+
93
89
  /* Thumbnail aspect ratio
94
90
  ========================================================================== */
95
91
 
92
+ .#{$lumx-base-prefix}-thumbnail:not(.#{$lumx-base-prefix}-thumbnail--aspect-ratio-original) {
93
+ .#{$lumx-base-prefix}-thumbnail__image {
94
+ position: absolute;
95
+ top: 0;
96
+ right: 0;
97
+ bottom: 0;
98
+ left: 0;
99
+ width: 100%;
100
+ height: 100%;
101
+ object-fit: cover;
102
+ object-position: center;
103
+ }
104
+ }
105
+
96
106
  @each $key, $aspect-ratio in $lumx-thumbnail-aspect-ratio {
97
107
  .#{$lumx-base-prefix}-thumbnail--aspect-ratio-#{$key}:not(.#{$lumx-base-prefix}-thumbnail--fill-height)
98
108
  .#{$lumx-base-prefix}-thumbnail__background {
@@ -103,8 +113,9 @@
103
113
  /* Thumbnail states
104
114
  ========================================================================== */
105
115
 
106
- .#{$lumx-base-prefix}-thumbnail[tabindex='0'] {
116
+ .#{$lumx-base-prefix}-thumbnail--is-clickable {
107
117
  position: relative;
118
+ display: block;
108
119
  cursor: pointer;
109
120
 
110
121
  &::after {
@@ -119,48 +130,95 @@
119
130
  pointer-events: none;
120
131
  }
121
132
 
122
- &:hover::after {
133
+ /* Hover */
134
+ &:hover::after,
135
+ &:focus::after {
123
136
  @include lumx-state(lumx-base-const('state', 'HOVER'), lumx-base-const('emphasis', 'LOW'), 'dark');
124
137
  }
125
138
 
139
+ /* Active */
126
140
  &:active::after {
127
141
  @include lumx-state(lumx-base-const('state', 'ACTIVE'), lumx-base-const('emphasis', 'LOW'), 'dark');
128
142
  }
129
143
  }
130
144
 
131
- .#{$lumx-base-prefix}-thumbnail--variant-rounded.#{$lumx-base-prefix}-thumbnail[tabindex='0'] {
145
+ /* Focused (variant rounded) */
146
+ .#{$lumx-base-prefix}-thumbnail--variant-rounded.#{$lumx-base-prefix}-thumbnail--is-clickable {
132
147
  &[data-focus-visible-added]::after {
133
148
  border-radius: var(--lumx-border-radius);
134
149
  }
135
150
  }
136
151
 
137
- .#{$lumx-base-prefix}-thumbnail--theme-light.#{$lumx-base-prefix}-thumbnail[tabindex='0'] {
152
+ /* Focused (light theme) */
153
+ .#{$lumx-base-prefix}-thumbnail--theme-light.#{$lumx-base-prefix}-thumbnail--is-clickable {
138
154
  &[data-focus-visible-added]::after {
139
155
  @include lumx-state(lumx-base-const('state', 'FOCUS'), lumx-base-const('emphasis', 'LOW'), 'dark');
140
156
  }
141
157
  }
142
158
 
143
- .#{$lumx-base-prefix}-thumbnail--theme-dark.#{$lumx-base-prefix}-thumbnail[tabindex='0'] {
159
+ /* Focused (dark theme) */
160
+ .#{$lumx-base-prefix}-thumbnail--theme-dark.#{$lumx-base-prefix}-thumbnail--is-clickable {
144
161
  &[data-focus-visible-added]::after {
145
162
  @include lumx-state(lumx-base-const('state', 'FOCUS'), lumx-base-const('emphasis', 'LOW'), 'light');
146
163
  }
147
164
  }
148
165
 
149
- /* Thumbnail badge mask
150
- ========================================================================== */
166
+ /* Loading state */
167
+ .#{$lumx-base-prefix}-thumbnail--is-loading {
168
+ &.#{$lumx-base-prefix}-thumbnail--theme-light .#{$lumx-base-prefix}-thumbnail__background {
169
+ @include lumx-skeleton('light');
170
+ }
151
171
 
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;
172
+ &.#{$lumx-base-prefix}-thumbnail--theme-dark .#{$lumx-base-prefix}-thumbnail__background {
173
+ @include lumx-skeleton('dark');
174
+ }
175
+ }
155
176
 
156
- .#{$lumx-base-prefix}-thumbnail--has-badge.#{$lumx-base-prefix}-thumbnail--size-#{$key} {
157
- .#{$lumx-base-prefix}-thumbnail__background,
177
+ /* Error state */
178
+ .#{$lumx-base-prefix}-thumbnail--has-error {
179
+ /** Icon fallback */
180
+ &.#{$lumx-base-prefix}-thumbnail--has-icon-error-fallback {
158
181
  .#{$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
- );
182
+ position: absolute;
183
+ top: 0;
184
+ right: 0;
185
+ bottom: 0;
186
+ left: 0;
187
+ display: flex;
188
+ align-items: center;
189
+ justify-content: center;
190
+ }
191
+
192
+ &.#{$lumx-base-prefix}-thumbnail--theme-light .#{$lumx-base-prefix}-thumbnail__fallback {
193
+ background-color: lumx-color-variant('dark', 'L6');
164
194
  }
195
+
196
+ &.#{$lumx-base-prefix}-thumbnail--theme-dark .#{$lumx-base-prefix}-thumbnail__fallback {
197
+ background-color: lumx-color-variant('light', 'L6');
198
+ }
199
+ }
200
+
201
+ /* Custom fallback */
202
+ &.#{$lumx-base-prefix}-thumbnail--has-custom-error-fallback {
203
+ /* Disable aspect ratio */
204
+ .#{$lumx-base-prefix}-thumbnail__background {
205
+ padding-top: 0;
206
+ }
207
+ }
208
+ }
209
+
210
+ /* Thumbnail badge mask
211
+ ========================================================================== */
212
+
213
+ $badge-radius-size: map-get($lumx-sizes, lumx-base-const('size', 'XS')) / 2 + 2;
214
+
215
+ .#{$lumx-base-prefix}-thumbnail--has-badge {
216
+ .#{$lumx-base-prefix}-thumbnail__background,
217
+ .#{$lumx-base-prefix}-thumbnail__fallback {
218
+ mask-image: radial-gradient(
219
+ circle at calc(100% - #{$badge-radius-size - 6}) calc(100% - #{$badge-radius-size - 6}),
220
+ transparent $badge-radius-size,
221
+ /* offset circle size (+1) to soften the edge */ black $badge-radius-size + 1
222
+ );
165
223
  }
166
224
  }
@@ -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
  }