@lumx/core 2.1.8-alpha.0 → 2.1.9-alpha-thumbnail3

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,10 @@
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
- }
25
-
26
- &--variant-rounded {
27
- border-radius: var(--lumx-border-radius);
28
- }
29
-
30
- &__background {
31
- position: relative;
32
- width: 100%;
33
- background-position: center;
34
- background-repeat: no-repeat;
35
- background-size: cover;
36
-
37
- #{$self}--variant-rounded & {
38
- border-radius: var(--lumx-border-radius);
39
- }
40
- }
41
-
42
- &__focused-image {
43
- max-width: none;
44
- }
45
-
46
15
  &__background,
47
16
  &__image {
48
17
  display: block;
49
- max-width: 100%;
50
- /* IE11 hack related to a bug with IE flexbox implementation (cf. https://stackoverflow.com/a/54054592) */
51
- min-height: 1px;
52
- max-height: 100%;
18
+ overflow: hidden;
53
19
 
54
20
  #{$self}--align-left & {
55
21
  margin-right: auto;
@@ -62,16 +28,6 @@
62
28
  #{$self}--align-right & {
63
29
  margin-left: auto;
64
30
  }
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
31
  }
76
32
 
77
33
  &__badge {
@@ -79,6 +35,70 @@
79
35
  right: -$lumx-spacing-unit / 2;
80
36
  bottom: -$lumx-spacing-unit / 2;
81
37
  }
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
+
82
102
  }
83
103
 
84
104
  /* Thumbnail sizes
@@ -86,17 +106,40 @@
86
106
 
87
107
  @each $key, $size in $lumx-sizes {
88
108
  .#{$lumx-base-prefix}-thumbnail--size-#{$key} {
89
- width: $size;
109
+ max-width: $size;
110
+ width: 100%;
111
+
112
+ .#{$lumx-base-prefix}-thumbnail__background,
113
+ .#{$lumx-base-prefix}-thumbnail__image {
114
+ width: 100%;
115
+ }
90
116
  }
91
117
  }
92
118
 
93
119
  /* Thumbnail aspect ratio
94
120
  ========================================================================== */
95
121
 
122
+ .#{$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
+ .#{$lumx-base-prefix}-thumbnail__image {
129
+ position: absolute;
130
+ inset: 0;
131
+ width: 100%;
132
+ height: 100%;
133
+ object-fit: cover;
134
+ object-position: center;
135
+ }
136
+ }
137
+
96
138
  @each $key, $aspect-ratio in $lumx-thumbnail-aspect-ratio {
97
- .#{$lumx-base-prefix}-thumbnail--aspect-ratio-#{$key}:not(.#{$lumx-base-prefix}-thumbnail--fill-height)
139
+ .#{$lumx-base-prefix}-thumbnail--aspect-ratio-#{$key} {
98
140
  .#{$lumx-base-prefix}-thumbnail__background {
99
- padding-top: $aspect-ratio;
141
+ padding-top: $aspect-ratio;
142
+ }
100
143
  }
101
144
  }
102
145
 
@@ -120,34 +163,49 @@
120
163
  pointer-events: none;
121
164
  }
122
165
 
166
+ /* Hover */
123
167
  &:hover::after,
124
168
  &:focus::after {
125
169
  @include lumx-state(lumx-base-const('state', 'HOVER'), lumx-base-const('emphasis', 'LOW'), 'dark');
126
170
  }
127
171
 
172
+ /* Active */
128
173
  &:active::after {
129
174
  @include lumx-state(lumx-base-const('state', 'ACTIVE'), lumx-base-const('emphasis', 'LOW'), 'dark');
130
175
  }
131
176
  }
132
177
 
178
+ /* Focused (variant rounded) */
133
179
  .#{$lumx-base-prefix}-thumbnail--variant-rounded.#{$lumx-base-prefix}-thumbnail--is-clickable {
134
180
  &[data-focus-visible-added]::after {
135
181
  border-radius: var(--lumx-border-radius);
136
182
  }
137
183
  }
138
184
 
185
+ /* Focused (light theme) */
139
186
  .#{$lumx-base-prefix}-thumbnail--theme-light.#{$lumx-base-prefix}-thumbnail--is-clickable {
140
187
  &[data-focus-visible-added]::after {
141
188
  @include lumx-state(lumx-base-const('state', 'FOCUS'), lumx-base-const('emphasis', 'LOW'), 'dark');
142
189
  }
143
190
  }
144
191
 
192
+ /* Focused (dark theme) */
145
193
  .#{$lumx-base-prefix}-thumbnail--theme-dark.#{$lumx-base-prefix}-thumbnail--is-clickable {
146
194
  &[data-focus-visible-added]::after {
147
195
  @include lumx-state(lumx-base-const('state', 'FOCUS'), lumx-base-const('emphasis', 'LOW'), 'light');
148
196
  }
149
197
  }
150
198
 
199
+ /* Loading */
200
+ .#{$lumx-base-prefix}-thumbnail--is-loading {
201
+ &.#{$lumx-base-prefix}-thumbnail--theme-dark .#{$lumx-base-prefix}-thumbnail__background {
202
+ @include lumx-skeleton('dark');
203
+ }
204
+ &.#{$lumx-base-prefix}-thumbnail--theme-light .#{$lumx-base-prefix}-thumbnail__background {
205
+ @include lumx-skeleton('light');
206
+ }
207
+ }
208
+
151
209
  /* Thumbnail badge mask
152
210
  ========================================================================== */
153
211
 
@@ -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', 'L1');
76
+ color: lumx-color-variant('dark', 'N');
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', 'L1');
90
+ color: lumx-color-variant('dark', 'N');
91
91
  }
92
92
 
93
93
  #{$self}--theme-dark & {
@@ -2,12 +2,7 @@
2
2
  @if $state == lumx-base-const('state', 'DEFAULT') {
3
3
  @if $theme == lumx-base-const('theme', 'LIGHT') {
4
4
  background-color: lumx-color-variant($color, 'N');
5
-
6
- @if $color == 'yellow' {
7
- color: lumx-color-variant('dark', 'L1');
8
- } @else {
9
- color: lumx-color-variant('light', 'N');
10
- }
5
+ color: lumx-color-variant('light', 'N');
11
6
  } @else if $theme == lumx-base-const('theme', 'DARK') {
12
7
  background-color: lumx-color-variant('light', 'N');
13
8
  color: lumx-color-variant($color, 'N');
@@ -36,18 +31,7 @@
36
31
  @mixin lumx-state-medium($state, $color, $has-focus-inset: false) {
37
32
  @if $state == lumx-base-const('state', 'DEFAULT') {
38
33
  background-color: lumx-color-variant($color, 'L5');
39
-
40
- @if $color == 'yellow' {
41
- color: lumx-color-variant('dark', 'L1');
42
- } @else {
43
- color: lumx-color-variant($color, 'N');
44
- }
45
-
46
- @if $color == 'dark' {
47
- .#{$lumx-base-prefix}-icon {
48
- color: lumx-color-variant('dark', 'L1');
49
- }
50
- }
34
+ color: lumx-color-variant($color, 'N');
51
35
  } @else if $state == lumx-base-const('state', 'HOVER') {
52
36
  background-color: lumx-color-variant($color, 'L4');
53
37
  } @else if $state == lumx-base-const('state', 'ACTIVE') {
@@ -66,14 +50,12 @@
66
50
  @if $state == lumx-base-const('state', 'DEFAULT') {
67
51
  background-color: lumx-color-variant('primary', 'L5');
68
52
  color: lumx-color-variant('primary', 'D2');
69
-
70
- .#{$lumx-base-prefix}-icon {
71
- color: lumx-color-variant('primary', 'D2');
72
- }
73
53
  } @else if $state == lumx-base-const('state', 'HOVER') {
74
54
  background-color: lumx-color-variant('primary', 'L4');
55
+ color: lumx-color-variant('primary', 'D2');
75
56
  } @else if $state == lumx-base-const('state', 'ACTIVE') {
76
57
  background-color: lumx-color-variant('primary', 'L3');
58
+ color: lumx-color-variant('primary', 'D2');
77
59
  } @else if $state == lumx-base-const('state', 'FOCUS') {
78
60
  @if $has-focus-inset == true {
79
61
  box-shadow: inset 0 0 0 2px lumx-color-variant('primary', 'L3');
@@ -85,14 +67,12 @@
85
67
  @if $state == lumx-base-const('state', 'DEFAULT') {
86
68
  background-color: lumx-color-variant('light', 'L3');
87
69
  color: lumx-color-variant('light', 'N');
88
-
89
- .#{$lumx-base-prefix}-icon {
90
- color: lumx-color-variant('light', 'N');
91
- }
92
70
  } @else if $state == lumx-base-const('state', 'HOVER') {
93
71
  background-color: lumx-color-variant('light', 'L4');
72
+ color: lumx-color-variant('light', 'N');
94
73
  } @else if $state == lumx-base-const('state', 'ACTIVE') {
95
74
  background-color: lumx-color-variant('light', 'L5');
75
+ color: lumx-color-variant('light', 'N');
96
76
  } @else if $state == lumx-base-const('state', 'FOCUS') {
97
77
  @if $has-focus-inset == true {
98
78
  box-shadow: inset 0 0 0 2px lumx-color-variant('light', 'L3');
@@ -107,12 +87,6 @@
107
87
  @if $state == lumx-base-const('state', 'DEFAULT') {
108
88
  background-color: transparent;
109
89
  color: lumx-color-variant($color, 'N');
110
-
111
- @if $color == 'dark' {
112
- .#{$lumx-base-prefix}-icon {
113
- color: lumx-color-variant('dark', 'L1');
114
- }
115
- }
116
90
  } @else if $state == lumx-base-const('state', 'HOVER') {
117
91
  background-color: lumx-color-variant($color, 'L5');
118
92
  } @else if $state == lumx-base-const('state', 'ACTIVE') {