@lumx/core 2.1.8 → 2.1.9-alpha-thumbnail

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.
package/package.json CHANGED
@@ -42,7 +42,7 @@
42
42
  "version": "yarn version-changelog ../../CHANGELOG.md && yarn changelog-verify ../../CHANGELOG.md && git add ../../CHANGELOG.md"
43
43
  },
44
44
  "sideEffects": false,
45
- "version": "2.1.8",
45
+ "version": "2.1.9-alpha-thumbnail",
46
46
  "devDependencies": {
47
47
  "@babel/core": "^7.8.3",
48
48
  "@babel/plugin-proposal-class-properties": "^7.8.3",
@@ -82,5 +82,5 @@
82
82
  "moment": "^2.24.0",
83
83
  "moment-range": "^4.0.2"
84
84
  },
85
- "gitHead": "e4e589f8924784b34e3a0dcdbbb71f0ed0ae82b8"
85
+ "gitHead": "e89e3ca2d44ff4b4aeb73af5662aea190d93f8a3"
86
86
  }
@@ -23,6 +23,7 @@
23
23
  @import './components/radio-button/mixins';
24
24
  @import './components/select/mixins';
25
25
  @import './components/side-navigation/mixins';
26
+ @import './components/skeleton/mixins';
26
27
  @import './components/slideshow/variables';
27
28
  @import './components/switch/mixins';
28
29
  @import './components/table/mixins';
@@ -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,45 +12,19 @@
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
15
  &__background {
31
- position: relative;
32
- width: 100%;
16
+ overflow: hidden;
33
17
  background-position: center;
34
18
  background-repeat: no-repeat;
35
19
  background-size: cover;
36
-
37
- #{$self}--variant-rounded & {
38
- border-radius: var(--lumx-border-radius);
39
- }
40
20
  }
41
21
 
42
- &__focused-image {
43
- max-width: none;
22
+ &__image {
23
+ display: block;
44
24
  }
45
25
 
46
26
  &__background,
47
27
  &__image {
48
- 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%;
53
-
54
28
  #{$self}--align-left & {
55
29
  margin-right: auto;
56
30
  }
@@ -62,16 +36,6 @@
62
36
  #{$self}--align-right & {
63
37
  margin-left: auto;
64
38
  }
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
39
  }
76
40
 
77
41
  &__badge {
@@ -79,24 +43,114 @@
79
43
  right: -$lumx-spacing-unit / 2;
80
44
  bottom: -$lumx-spacing-unit / 2;
81
45
  }
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
+
82
104
  }
83
105
 
84
106
  /* Thumbnail sizes
85
107
  ========================================================================== */
86
108
 
87
109
  @each $key, $size in $lumx-sizes {
88
- .#{$lumx-base-prefix}-thumbnail--size-#{$key} {
110
+ .#{$lumx-base-prefix}-thumbnail--size-#{$key}:not(.#{$lumx-base-prefix}-thumbnail--fill-height) {
89
111
  width: $size;
112
+
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
+ &::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
+ .#{$lumx-base-prefix}-thumbnail__image {
142
+ width: 100%;
143
+ height: 100%;
144
+ object-fit: cover;
145
+ object-position: center;
146
+ }
147
+ }
148
+
96
149
  @each $key, $aspect-ratio in $lumx-thumbnail-aspect-ratio {
97
- .#{$lumx-base-prefix}-thumbnail--aspect-ratio-#{$key}:not(.#{$lumx-base-prefix}-thumbnail--fill-height)
98
- .#{$lumx-base-prefix}-thumbnail__background {
99
- padding-top: $aspect-ratio;
150
+ .#{$lumx-base-prefix}-thumbnail--aspect-ratio-#{$key} {
151
+ &::before {
152
+ padding-top: $aspect-ratio;
153
+ }
100
154
  }
101
155
  }
102
156
 
@@ -120,34 +174,49 @@
120
174
  pointer-events: none;
121
175
  }
122
176
 
177
+ /* Hover */
123
178
  &:hover::after,
124
179
  &:focus::after {
125
180
  @include lumx-state(lumx-base-const('state', 'HOVER'), lumx-base-const('emphasis', 'LOW'), 'dark');
126
181
  }
127
182
 
183
+ /* Active */
128
184
  &:active::after {
129
185
  @include lumx-state(lumx-base-const('state', 'ACTIVE'), lumx-base-const('emphasis', 'LOW'), 'dark');
130
186
  }
131
187
  }
132
188
 
189
+ /* Focused (variant rounded) */
133
190
  .#{$lumx-base-prefix}-thumbnail--variant-rounded.#{$lumx-base-prefix}-thumbnail--is-clickable {
134
191
  &[data-focus-visible-added]::after {
135
192
  border-radius: var(--lumx-border-radius);
136
193
  }
137
194
  }
138
195
 
196
+ /* Focused (light theme) */
139
197
  .#{$lumx-base-prefix}-thumbnail--theme-light.#{$lumx-base-prefix}-thumbnail--is-clickable {
140
198
  &[data-focus-visible-added]::after {
141
199
  @include lumx-state(lumx-base-const('state', 'FOCUS'), lumx-base-const('emphasis', 'LOW'), 'dark');
142
200
  }
143
201
  }
144
202
 
203
+ /* Focused (dark theme) */
145
204
  .#{$lumx-base-prefix}-thumbnail--theme-dark.#{$lumx-base-prefix}-thumbnail--is-clickable {
146
205
  &[data-focus-visible-added]::after {
147
206
  @include lumx-state(lumx-base-const('state', 'FOCUS'), lumx-base-const('emphasis', 'LOW'), 'light');
148
207
  }
149
208
  }
150
209
 
210
+ /* Loading */
211
+ .#{$lumx-base-prefix}-thumbnail--is-loading {
212
+ &.#{$lumx-base-prefix}-thumbnail--theme-dark .#{$lumx-base-prefix}-thumbnail__background {
213
+ @include lumx-skeleton('dark');
214
+ }
215
+ &.#{$lumx-base-prefix}-thumbnail--theme-light .#{$lumx-base-prefix}-thumbnail__background {
216
+ @include lumx-skeleton('light');
217
+ }
218
+ }
219
+
151
220
  /* Thumbnail badge mask
152
221
  ========================================================================== */
153
222