@ilo-org/styles 0.7.0 → 0.7.2

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ilo-org/styles",
3
3
  "description": "Styles for products using ILO's Design System",
4
- "version": "0.7.0",
4
+ "version": "0.7.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/international-labour-organization/designsystem.git",
package/scss/_mixins.scss CHANGED
@@ -334,7 +334,11 @@
334
334
  // Cornercut
335
335
  // ======================================
336
336
 
337
- @mixin cornercut($width: $spacing-padding-8, $height: $spacing-padding-5) {
337
+ @mixin cornercut(
338
+ $width: $spacing-padding-8,
339
+ $height: $spacing-padding-5,
340
+ $dir: "right"
341
+ ) {
338
342
  clip-path: polygon(
339
343
  0 0,
340
344
  calc(100% - $width) 0,
@@ -342,6 +346,10 @@
342
346
  100% 100%,
343
347
  0 100%
344
348
  );
349
+
350
+ @if ($dir == "left") {
351
+ clip-path: polygon($width 0, 100% 0, 100% 100%, 0 100%, 0 $height);
352
+ }
345
353
  }
346
354
 
347
355
  // ======================================
@@ -354,3 +362,44 @@
354
362
  drop-shadow(0px 10px 20px rgba(30, 45, 190, 0.08))
355
363
  drop-shadow(0px -4px 16px rgba(30, 45, 190, 0.054));
356
364
  }
365
+
366
+ // ======================================
367
+ // Background box for a caption icon tooltip (see Hero)
368
+ // ======================================
369
+
370
+ @mixin caption-icon-wrapper($dir: "right", $width, $height) {
371
+ background: map-get($color, "tooltip", "dark", "background");
372
+ height: $height;
373
+ width: $width;
374
+
375
+ display: flex;
376
+ justify-content: center;
377
+ align-items: center;
378
+ position: relative;
379
+
380
+ &::after {
381
+ content: "";
382
+ position: absolute;
383
+ top: 0;
384
+ width: 0;
385
+ height: 0;
386
+ border-top: #{$height} solid transparent;
387
+
388
+ @if ($dir == "right") {
389
+ left: 100%;
390
+ border-right: none;
391
+ border-left: calc(#{$height} - 4px)
392
+ solid
393
+ map-get($color, "tooltip", "dark", "background");
394
+ }
395
+
396
+ @if ($dir == "left") {
397
+ left: auto;
398
+ right: 100%;
399
+ border-left: none;
400
+ border-right: calc(#{$height} - 4px)
401
+ solid
402
+ map-get($color, "tooltip", "dark", "background");
403
+ }
404
+ }
405
+ }
@@ -4,11 +4,10 @@
4
4
 
5
5
  .ilo--cardgroup {
6
6
  $c: &;
7
- $card: ".ilo--card";
8
7
 
9
8
  &__collapsed {
10
9
  #{$c}--inner {
11
- gap: 0;
10
+ gap: 0 !important;
12
11
  }
13
12
  }
14
13
 
@@ -32,12 +31,55 @@
32
31
  }
33
32
  }
34
33
 
34
+ &__count {
35
+ @include breakpoint("large") {
36
+ &__one {
37
+ #{$c}--inner {
38
+ gap: 0;
39
+ }
40
+
41
+ #{$c}--card {
42
+ flex: 1 1 100%;
43
+ }
44
+ }
45
+
46
+ &__two {
47
+ #{$c}--inner {
48
+ gap: 16px;
49
+ }
50
+
51
+ #{$c}--card {
52
+ flex: 0 1 calc(50% - 16px);
53
+ }
54
+ }
55
+
56
+ &__three {
57
+ #{$c}--inner {
58
+ gap: 21px;
59
+ }
60
+
61
+ #{$c}--card {
62
+ flex: 0 1 calc(33.3333% - 21px);
63
+ }
64
+ }
65
+
66
+ &__four {
67
+ #{$c}--inner {
68
+ gap: 24px;
69
+ }
70
+
71
+ #{$c}--card {
72
+ flex: 0 1 calc(25% - 24px);
73
+ }
74
+ }
75
+ }
76
+ }
77
+
35
78
  &--inner {
36
79
  display: flex;
37
80
  flex-flow: row wrap;
38
81
  justify-content: center;
39
82
  margin: auto;
40
- gap: px-to-rem(32px);
41
83
  width: 100%;
42
84
 
43
85
  .right-to-left & {
@@ -2,21 +2,28 @@
2
2
  @use "../functions" as *;
3
3
  @import "../mixins";
4
4
 
5
+ // @TODO: The grid layout is fairly clean until you get to the placement of the caption which breaks out of it
6
+ // and uses a lot of absolute positioning. This should be cleaned up to use the grid layout more effectively.
7
+
5
8
  .hero {
6
9
  $c: &;
7
10
 
8
- --tooltip-width: 30px;
9
- --tooltip-height: 27px;
10
- --corner-cut-height: 39px;
11
- --image-max-height: 216px;
11
+ // SASS vars are all constants
12
+ $tooltip-width: 30px;
13
+ $tooltip-height: 27px;
14
+ $image-max-height: 216px;
15
+ $corner-cut-sm: 39px;
16
+ $corner-cut-lg: 64px;
17
+
18
+ // CSS vars can be changed
19
+ --corner-cut-height: #{$corner-cut-sm};
12
20
 
13
21
  display: grid;
14
22
  position: relative;
15
-
16
23
  grid-template-rows:
17
- minmax(var(--image-max-height), 1fr)
18
- var(--tooltip-height)
19
- 39px
24
+ minmax($image-max-height, 1fr)
25
+ $tooltip-height
26
+ $corner-cut-sm
20
27
  auto;
21
28
  grid-template-columns: 1fr;
22
29
 
@@ -27,7 +34,6 @@
27
34
  &--figure {
28
35
  background-color: map-get($color, "base", "blue", "light");
29
36
  position: relative;
30
-
31
37
  grid-area: 1 / 1 / 4 / 2;
32
38
 
33
39
  img {
@@ -46,40 +52,13 @@
46
52
  grid-area: 2 / 1 / 3 / 2;
47
53
 
48
54
  &--wrapper {
49
- background: map-get($color, "tooltip", "dark", "background");
50
- height: var(--tooltip-height);
51
- width: var(--tooltip-width);
52
-
53
- display: flex;
54
- justify-content: center;
55
- align-items: center;
56
- position: relative;
57
-
58
- &::after {
59
- content: "";
60
- position: absolute;
61
- top: 0;
62
- left: 100%;
63
- width: 0;
64
- height: 0;
65
- border-top: var(--tooltip-height) solid transparent;
66
- border-left: calc(var(--tooltip-height) - 4px) solid
67
- map-get($color, "tooltip", "dark", "background");
68
-
69
- .right-to-left & {
70
- left: auto;
71
- right: 100%;
72
- border-left: none;
73
- border-right: calc(var(--tooltip-height) - 4px) solid
74
- map-get($color, "tooltip", "dark", "background");
75
- }
76
- }
55
+ @include caption-icon-wrapper("right", $tooltip-width, $tooltip-height);
77
56
  }
78
57
  }
79
58
 
80
59
  @include breakpoint("large") {
81
60
  --card-width: minmax(200px, 625px);
82
- --corner-cut-height: 64px;
61
+ --corner-cut-height: #{$corner-cut-lg};
83
62
  --breadcrumbs-height: 48px;
84
63
  --card-offset: 109px;
85
64
  --image-gap: 240px;
@@ -88,12 +67,12 @@
88
67
  --row-1-lg: var(--breadcrumbs-height);
89
68
  --row-2-lg: calc(var(--image-gap) - var(--breadcrumbs-height));
90
69
  --row-3-lg: auto;
91
- --row-4-lg: var(--tooltip-height);
70
+ --row-4-lg: #{$tooltip-height};
92
71
  --row-5-lg: 72px;
93
72
 
94
73
  --col-1-lg: 0;
95
74
  --col-2-lg: var(--card-width);
96
- --col-3-lg: var(--tooltip-width);
75
+ --col-3-lg: #{$tooltip-width};
97
76
  --col-4-lg: 1fr;
98
77
 
99
78
  grid-template-rows:
@@ -152,41 +131,22 @@
152
131
  &__card-justify {
153
132
  &__start {
154
133
  --col-1-lg: 0;
155
-
156
- .right-to-left & {
157
- --col-1-lg: 1fr;
158
- --col-2-lg: var(--tooltip-width);
159
- --col-3-lg: var(--card-width);
160
- --col-4-lg: 0;
161
- }
162
134
  }
163
135
 
164
136
  &__offset {
165
137
  --col-1-lg: var(--card-offset);
166
-
167
- .right-to-left & {
168
- --col-1-lg: 1fr;
169
- --col-2-lg: var(--tooltip-width);
170
- --col-3-lg: var(--card-width);
171
- --col-4-lg: var(--card-offset);
172
- }
173
138
  }
174
139
 
175
140
  &__center {
176
141
  --col-1-lg: 1fr;
177
142
  --col-4-lg: 1fr;
178
-
179
- .right-to-left & {
180
- --col-2-lg: var(--tooltip-width);
181
- --col-3-lg: var(--card-width);
182
- }
183
143
  }
184
144
  }
185
145
 
186
146
  &__card-align {
187
147
  &__center {
188
- --row-4-lg: calc(72px - var(--tooltip-height));
189
- --row-5-lg: var(--tooltip-height);
148
+ --row-4-lg: calc(72px - #{$tooltip-height});
149
+ --row-5-lg: #{$tooltip-height};
190
150
  }
191
151
 
192
152
  &__bottom {
@@ -202,10 +162,6 @@
202
162
  display: flex;
203
163
  flex-flow: row nowrap;
204
164
 
205
- .right-to-left & {
206
- flex-direction: row-reverse;
207
- }
208
-
209
165
  &--wrapper {
210
166
  max-width: 500px;
211
167
  }
@@ -226,10 +182,6 @@
226
182
  &--card {
227
183
  grid-area: 3 / 2 / 6 / 3;
228
184
 
229
- .right-to-left & {
230
- grid-area: 3 / 3 / 6 / 4;
231
- }
232
-
233
185
  #{$c}__card-align__center & {
234
186
  grid-area: 3 / 2 / 4 / 3;
235
187
  }
@@ -243,10 +195,6 @@
243
195
  grid-area: 4 / 3 / 5 / 4;
244
196
  position: relative;
245
197
 
246
- .right-to-left & {
247
- grid-area: 4 / 2 / 5 / 3;
248
- }
249
-
250
198
  #{$c}__card-align__center & {
251
199
  grid-area: 5 / 1 / 6 / 3;
252
200
  }
@@ -255,21 +203,143 @@
255
203
  grid-area: 4 / 1 / 5 / 2;
256
204
  }
257
205
 
258
- &--wrapper {
259
- left: 2px;
260
-
261
- .right-to-left & {
262
- left: auto;
263
- right: 2px;
206
+ #{$c}__card-align__center &,
207
+ #{$c}__card-align__bottom & {
208
+ &--wrapper {
209
+ position: absolute;
210
+ left: 0;
211
+ bottom: 0;
264
212
  }
213
+ }
214
+
215
+ #{$c}__card-align__bottom#{$c}__card-justify__start & {
216
+ grid-area: 1 / 1 / 3 / 3;
217
+
218
+ #{$c}--caption--wrapper {
219
+ @include caption-icon-wrapper(
220
+ "right",
221
+ $tooltip-width,
222
+ $tooltip-height
223
+ );
265
224
 
266
- #{$c}__card-align__center &,
267
- #{$c}__card-align__bottom & {
268
225
  position: absolute;
269
226
  left: 0;
227
+ right: initial;
270
228
  bottom: 0;
271
229
  }
272
230
  }
231
+
232
+ &--wrapper {
233
+ left: 2px;
234
+ }
235
+ }
236
+ }
237
+
238
+ // Layout for RTL languages
239
+ .right-to-left & {
240
+ &--caption {
241
+ &--wrapper {
242
+ @include caption-icon-wrapper("left", $tooltip-width, $tooltip-height);
243
+ position: absolute;
244
+ right: 0;
245
+ }
246
+ }
247
+
248
+ @include breakpoint("large") {
249
+ &__card-justify {
250
+ &__start {
251
+ --col-1-lg: 1fr;
252
+ --col-2-lg: #{$tooltip-width};
253
+ --col-3-lg: var(--card-width);
254
+ --col-4-lg: 0;
255
+ }
256
+
257
+ &__offset {
258
+ --col-1-lg: 1fr;
259
+ --col-2-lg: #{$tooltip-width};
260
+ --col-3-lg: var(--card-width);
261
+ --col-4-lg: var(--card-offset);
262
+ }
263
+
264
+ &__center {
265
+ --col-1-lg: 1fr;
266
+ --col-2-lg: #{$tooltip-width};
267
+ --col-3-lg: var(--card-width);
268
+ --col-4-lg: 1fr;
269
+ }
270
+ }
271
+
272
+ &__card-align {
273
+ &__center {
274
+ #{$c}--card {
275
+ grid-area: 3 / 3 / 4 / 4;
276
+ }
277
+
278
+ #{$c}--caption {
279
+ grid-area: 5 / 4 / 6 / 5;
280
+
281
+ &--wrapper {
282
+ right: 0;
283
+ left: initial;
284
+ position: absolute;
285
+ }
286
+ }
287
+ }
288
+
289
+ &__bottom {
290
+ #{$c}--caption {
291
+ grid-area: 4 / 4 / 5 / 5;
292
+
293
+ &--wrapper {
294
+ position: absolute;
295
+ right: 0;
296
+ bottom: 0;
297
+ left: initial;
298
+ }
299
+ }
300
+ }
301
+
302
+ &__bottom#{$c}__card-justify__start {
303
+ #{$c}--caption {
304
+ grid-area: 2 / 3 / 3 / 4;
305
+
306
+ &--wrapper {
307
+ @include caption-icon-wrapper(
308
+ "left",
309
+ $tooltip-width,
310
+ $tooltip-height
311
+ );
312
+
313
+ position: absolute;
314
+ left: initial;
315
+ right: 0;
316
+ }
317
+ }
318
+ }
319
+ }
320
+
321
+ &--card {
322
+ grid-area: 3 / 3 / 6 / 4;
323
+ }
324
+
325
+ &--breadcrumbs {
326
+ flex-direction: row-reverse;
327
+ }
328
+
329
+ &--caption {
330
+ grid-area: 4 / 2 / 5 / 3;
331
+
332
+ &--wrapper {
333
+ right: 2px;
334
+ left: initial;
335
+
336
+ @include caption-icon-wrapper(
337
+ "left",
338
+ $tooltip-width,
339
+ $tooltip-height
340
+ );
341
+ }
342
+ }
273
343
  }
274
344
  }
275
345
  }
@@ -74,7 +74,19 @@
74
74
  }
75
75
 
76
76
  &__cornercut {
77
- @include cornercut(116px, 64px);
77
+ @include cornercut(72px, 40px);
78
+
79
+ .right-to-left & {
80
+ @include cornercut(72px, 40px, "left");
81
+ }
82
+
83
+ @include breakpoint("large") {
84
+ @include cornercut(116px, 64px);
85
+
86
+ .right-to-left & {
87
+ @include cornercut(116px, 64px, "left");
88
+ }
89
+ }
78
90
  }
79
91
 
80
92
  &--datecopy {