@ilo-org/styles 1.0.1 → 1.0.3

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": "1.0.1",
4
+ "version": "1.0.3",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/international-labour-organization/designsystem.git",
@@ -38,9 +38,9 @@
38
38
  "author": "@justintemps, @johnpauldavis, @avrilpearl, @ghlost",
39
39
  "license": "Apache-2.0",
40
40
  "dependencies": {
41
- "@ilo-org/fonts": "0.2.1",
41
+ "@ilo-org/fonts": "0.2.2",
42
42
  "@ilo-org/icons": "0.3.1",
43
- "@ilo-org/themes": "0.8.1"
43
+ "@ilo-org/themes": "0.9.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "del": "^7.0.0",
package/scss/_mixins.scss CHANGED
@@ -339,18 +339,33 @@
339
339
  @mixin cornercut(
340
340
  $width: $spacing-padding-8,
341
341
  $height: $spacing-padding-5,
342
- $dir: "right"
342
+ $dir: "right",
343
+ $side: "top"
343
344
  ) {
344
- clip-path: polygon(
345
- 0 0,
346
- calc(100% - $width) 0,
347
- 100% $height,
348
- 100% 100%,
349
- 0 100%
350
- );
351
-
352
- @if ($dir == "left") {
353
- clip-path: polygon($width 0, 100% 0, 100% 100%, 0 100%, 0 $height);
345
+ @if ($side == "top") {
346
+ @if ($dir == "right") {
347
+ clip-path: polygon(
348
+ 0 0,
349
+ calc(100% - $width) 0,
350
+ 100% $height,
351
+ 100% 100%,
352
+ 0 100%
353
+ );
354
+ }
355
+
356
+ @if ($dir == "left") {
357
+ clip-path: polygon($width 0, 100% 0, 100% 100%, 0 100%, 0 $height);
358
+ }
359
+ }
360
+
361
+ @if ($side == "bottom") {
362
+ @if ($dir == "right") {
363
+ clip-path: polygon(0 0, 100% 0, calc(100% - $width) $height, 0 100%);
364
+ }
365
+
366
+ @if ($dir == "left") {
367
+ clip-path: polygon(0 0, 100% 0, 100% $height, $width 100%);
368
+ }
354
369
  }
355
370
  }
356
371
 
@@ -1,43 +1,44 @@
1
1
  @use "../tokens" as *;
2
2
  @use "../functions" as *;
3
3
  @import "../mixins";
4
+ @import "../config";
4
5
 
5
- .ilo--accordion {
6
+ .#{$prefix}--accordion {
7
+ // This provides a reference to the outerclass within nested declarations
8
+ $accordion: &;
9
+
10
+ // Accordion contents can add lots of height so the transition timing can't
11
+ // be too fast which is why we're using a custom value here.
6
12
  $transition-timing: 500ms;
13
+
14
+ // If the accordion item is scrollable, then this is its max-height
7
15
  $scroll-max-height: 300px;
8
- margin-right: spacing(1);
9
16
 
10
17
  &--button {
11
18
  display: flex;
12
- align-items: center;
13
19
  flex-direction: row;
14
20
  justify-content: space-between;
15
- text-align: start;
16
21
  width: 100%;
17
22
  margin: 0;
18
- padding: spacing(4) 0;
23
+ padding-block: spacing(4);
19
24
  padding-inline-end: spacing(11);
20
-
21
25
  background-color: $color-ux-background-default;
22
26
  background-position: calc(100% - px-to-rem(6px)) center;
23
27
  background-repeat: no-repeat;
24
28
  background-size: px-to-rem(24px) px-to-rem(24px);
25
-
26
29
  border: none;
27
- border-top: 2px solid map-get($color, "accordion", "border");
28
-
30
+ border-top: 2px solid $color-base-neutrals-lighter;
29
31
  fill: $color-ux-labels-actionable;
30
32
  font-family: $fonts-display;
31
33
  color: $color-ux-labels-actionable;
32
- font-weight: map-get($type, "weights", "section");
33
- @include font-styles("label-medium");
34
-
34
+ font-weight: $type-weights-section;
35
35
  transition: all $transition-timing ease-in-out;
36
+ @include font-styles("label-medium");
36
37
  @include dataurlicon("add", $color-ux-labels-actionable);
37
38
 
38
- &--large {
39
+ &__large {
39
40
  @include font-styles("headline-6");
40
- padding: spacing(5) 0;
41
+ padding-block: spacing(5);
41
42
  padding-inline-end: spacing(11);
42
43
  }
43
44
 
@@ -46,8 +47,8 @@
46
47
  background-color: $color-ux-background-hover;
47
48
  border-top-color: $color-ux-borders-hover;
48
49
  color: $color-ux-labels-hover;
49
- cursor: pointer;
50
50
  fill: $color-ux-labels-hover;
51
+ cursor: pointer;
51
52
 
52
53
  &[aria-expanded="true"] {
53
54
  @include dataurlicon("minus", $color-ux-labels-hover);
@@ -60,8 +61,7 @@
60
61
 
61
62
  @include breakpoint("medium") {
62
63
  @include font-styles("label-medium");
63
-
64
- &--large {
64
+ &__large {
65
65
  @include font-styles("headline-6");
66
66
  padding: spacing(5) 0;
67
67
  padding-inline-end: spacing(11);
@@ -88,12 +88,12 @@
88
88
  transition: all $transition-timing cubic-bezier(0, 1, 0, 1);
89
89
  overflow: hidden;
90
90
 
91
- .ilo--accordion--innerpanel {
91
+ #{$accordion}--innerpanel {
92
92
  padding-bottom: spacing(9);
93
93
  padding-top: spacing(2);
94
94
  }
95
95
 
96
- &--open {
96
+ &__open {
97
97
  max-height: 100vh;
98
98
  transition: all $transition-timing ease-in-out;
99
99
 
@@ -2,67 +2,94 @@
2
2
  @use "../functions" as *;
3
3
  @use "../animations" as *;
4
4
  @import "../mixins";
5
+ @import "../config";
6
+
7
+ .#{$prefix}--breadcrumb {
8
+ $breadcrumb: &;
5
9
 
6
- .ilo--breadcrumb {
7
10
  position: relative;
11
+ display: inline-block;
8
12
  z-index: 10;
9
13
 
10
- &--items {
11
- align-items: center;
12
- background-color: $color-base-neutrals-white;
14
+ &--inner {
13
15
  display: inline-flex;
14
- justify-content: flex-start;
15
- padding-block: spacing(4);
16
- padding-inline-end: 0;
16
+ // Local variable set in the Hero for alignment
17
17
  padding-inline-start: var(--breadcrumb-padding);
18
- position: relative;
19
- &.context--menu {
20
- padding: 0;
18
+ padding-inline-end: spacing(12);
19
+ padding-block: spacing(4);
20
+ background-color: $color-base-neutrals-white;
21
+ @include cornercut(spacing(12), 100%, "right", "bottom");
22
+
23
+ [dir="rtl"] & {
24
+ @include cornercut(spacing(12), 100%, "left", "bottom");
21
25
  }
22
26
  }
23
27
 
24
- &--link {
28
+ &--items,
29
+ &--context {
25
30
  align-items: center;
26
- background-position: right;
27
- background-repeat: no-repeat;
28
- color: map-get($color, "link", "text", "default");
29
31
  display: inline-flex;
30
- height: px-to-rem(16px);
31
- padding-block: 0;
32
- padding-inline-start: spacing(4);
33
- padding-inline-end: spacing(6);
34
- text-decoration: none;
35
- text-decoration-thickness: px-to-rem($borders-base);
32
+ justify-content: flex-start;
33
+ list-style: none;
34
+ }
35
+
36
+ &--item,
37
+ &--context__collapse {
38
+ background-repeat: no-repeat;
36
39
  @include dataurlicon("breadcrumbdivider", $color-link-text-default);
40
+ background-position: left;
41
+ padding-inline: spacing(6) spacing(4);
37
42
 
38
43
  [dir="rtl"] & {
39
- background-position: left;
44
+ background-position: right;
45
+ background-repeat: no-repeat;
40
46
  @include dataurlicon("breadcrumbdividerrtl", $color-link-text-default);
41
47
  }
48
+ }
42
49
 
43
- &--label {
44
- white-space: nowrap;
45
- overflow: hidden;
46
- text-overflow: ellipsis;
47
- max-width: 40ch;
48
- font-family: $fonts-copy;
49
- font-weight: 400;
50
- @include font-styles("body-xxs");
50
+ &--context {
51
+ $context: &;
52
+ position: relative;
53
+
54
+ &--button {
55
+ display: none;
56
+ padding: 0;
57
+ margin: 0;
58
+ border: none;
59
+ background-position: center center;
60
+ background-repeat: no-repeat;
61
+ background-size: 16px 4px;
62
+ position: relative;
63
+ width: px-to-rem(42px);
64
+ height: px-to-rem(16px);
65
+ @include dataurlicon("elipsis", $color-link-text-default);
66
+
67
+ &:hover {
68
+ cursor: pointer;
69
+ @include dataurlicon("elipsis", $color-base-blue-medium);
70
+ }
71
+ }
72
+
73
+ &--menu {
74
+ display: none;
75
+ position: fixed;
76
+ width: px-to-rem(120px);
77
+ z-index: 10;
51
78
 
52
- &--dropdown {
53
- font-family: $fonts-copy;
79
+ &__visible {
80
+ display: inline-block;
54
81
  }
55
82
  }
56
83
 
57
- &:hover,
58
- &:focus {
59
- color: map-get($color, "link", "text", "hover");
60
- text-decoration: underline;
61
- text-decoration-thickness: px-to-rem($borders-base);
62
- @include dataurlicon("breadcrumbdivider", $color-link-text-hover);
84
+ &__collapse {
85
+ padding-inline: spacing(3) spacing(1);
63
86
 
64
- [dir="rtl"] & {
65
- @include dataurlicon("breadcrumbdividerrtl", $color-link-text-hover);
87
+ #{$breadcrumb}--items {
88
+ display: none;
89
+ }
90
+
91
+ #{$context}--button {
92
+ display: inline-block;
66
93
  }
67
94
  }
68
95
  }
@@ -70,19 +97,32 @@
70
97
  &--item {
71
98
  align-items: center;
72
99
  display: flex;
73
- height: px-to-rem(16px);
74
100
 
75
- &.home {
101
+ &__first {
76
102
  align-items: center;
77
103
  display: flex;
78
104
  position: relative;
105
+ // Make sure arrow doesn't appear before house even in RTL
106
+ background: none !important;
107
+ // Make sure the outline is visible when focused
108
+ padding-inline-start: 2px;
79
109
 
80
- .ilo--breadcrumb--link {
81
- &--label {
82
- @include isVisuallyHidden();
110
+ &:hover,
111
+ &:focus {
112
+ #{$breadcrumb}--link {
113
+ &:after {
114
+ @include dataurlicon("home", $color-link-text-hover);
115
+ }
83
116
  }
117
+ }
84
118
 
85
- &:before {
119
+ #{$breadcrumb}--link {
120
+ background: none;
121
+ width: px-to-rem(16px);
122
+ height: px-to-rem(16px);
123
+ position: relative;
124
+
125
+ &:after {
86
126
  background-position: center center;
87
127
  background-repeat: no-repeat;
88
128
  content: "";
@@ -94,207 +134,34 @@
94
134
  width: px-to-rem(16px);
95
135
  @include dataurlicon("home", $color-link-text-default);
96
136
  }
97
-
98
- [dir="rtl"] & {
99
- &:before {
100
- left: initial;
101
- right: 0;
102
- }
103
- }
104
- }
105
-
106
- &:hover,
107
- &:focus {
108
- .ilo--breadcrumb--link {
109
- &:before {
110
- @include dataurlicon("home", $color-link-text-hover);
111
- }
112
- }
113
- }
114
- }
115
-
116
- &.final {
117
- .ilo--breadcrumb--link {
118
- background-image: none;
119
137
  }
120
138
  }
121
139
  }
122
140
 
123
- .ilo--breadcrumb--item--context {
124
- align-items: flex-start;
125
- display: flex;
141
+ &--link {
142
+ display: inline-flex;
143
+ align-items: center;
144
+ color: $color-link-text-default;
126
145
  height: px-to-rem(16px);
127
- }
128
-
129
- &.contextmenu {
130
- .ilo--breadcrumb--item--context {
131
- background-position: center center;
132
- background-repeat: no-repeat;
133
- background-size: 16px 4px;
134
- position: relative;
135
- width: px-to-rem(42px);
136
- @include dataurlicon("elipsis", $color-link-text-default);
137
-
138
- &:hover {
139
- cursor: pointer;
140
- @include dataurlicon("elipsis", $color-base-blue-medium);
141
- }
142
-
143
- &:after {
144
- background-position: center center;
145
- background-repeat: no-repeat;
146
- content: "";
147
- display: block;
148
- height: px-to-rem(16px);
149
- right: -7px;
150
- position: absolute;
151
- top: 0;
152
- width: px-to-rem(16px);
153
- @include dataurlicon("breadcrumbdivider", $color-link-text-default);
154
-
155
- [dir="rtl"] & {
156
- right: auto;
157
- left: -7px;
158
- @include dataurlicon(
159
- "breadcrumbdividerrtl",
160
- $color-link-text-default
161
- );
162
- }
163
- }
164
-
165
- .context--menu {
166
- border-radius: px-to-rem(2px);
167
- background-color: $color-ux-background-highlight;
168
- display: inline-block;
169
- left: px-to-rem(-40px);
170
- opacity: 0;
171
- position: absolute;
172
- top: calc(100% + 24px);
173
- width: px-to-rem(120px);
174
- z-index: 10;
175
- @include globaltransition("opacity");
176
-
177
- &.open {
178
- opacity: 1;
179
- @include globaltransition("opacity");
180
- }
181
-
182
- &:before {
183
- background-position: top center;
184
- background-repeat: no-repeat;
185
- background-size: contain;
186
- @include dataurlicon(
187
- "halfsquaretriangle",
188
- $color-ux-background-highlight
189
- );
190
- content: "";
191
- height: px-to-rem(12px);
192
- position: absolute;
193
- left: 50%;
194
- top: -#{px-to-rem(6px)};
195
- transform: translateX(-50%) rotate(135deg);
196
- width: px-to-rem(12px);
197
- }
198
-
199
- &:hover {
200
- cursor: pointer;
201
- }
202
-
203
- .ilo--breadcrumb--item {
204
- display: inline-block;
205
- height: auto;
206
- padding: 0 spacing(2);
207
- position: relative;
208
- width: 100%;
209
-
210
- &:last-of-type a {
211
- border-bottom: none;
212
- }
213
-
214
- &:hover,
215
- &:focus {
216
- background-color: $color-base-blue-light;
217
- text-decoration: none;
218
-
219
- .ilo--breadcrumb--link {
220
- text-decoration: underline;
221
- text-decoration-thickness: px-to-rem($borders-base);
222
- }
223
- }
224
-
225
- &.endsection {
226
- border-bottom: px-to-rem($borders-base) solid
227
- $color-base-neutrals-white;
228
-
229
- .ilo--context-menu--link {
230
- border-bottom: none;
231
- }
232
- }
233
- }
234
-
235
- .ilo--breadcrumb--link {
236
- background: none;
237
- border-bottom: px-to-rem($borders-base) solid
238
- $color-base-neutrals-white;
239
- color: map-get($color, "link", "text", "default");
240
- display: inline-block;
241
- font-family: $fonts-copy;
242
- font-weight: map-get($type, "weights", "section");
243
- height: auto;
244
- padding: spacing(4) 0;
245
- text-decoration: none;
246
- width: 100%;
247
- @include font-styles("body-xxs");
248
-
249
- &:visited {
250
- color: map-get($color, "link", "text", "default");
251
- }
252
-
253
- &:active {
254
- color: map-get($color, "link", "text", "active");
255
- outline: none;
256
- }
257
-
258
- &:hover,
259
- &:focus {
260
- color: map-get($color, "link", "text", "hover");
261
- outline: none;
262
- text-decoration: underline;
263
- text-decoration-thickness: px-to-rem($borders-base);
264
- }
265
- }
266
- }
267
- }
268
- }
269
-
270
- &--items {
271
- &:after {
272
- background: linear-gradient(to bottom right, white 50%, transparent 50%);
273
- content: "";
274
- display: inline-block;
275
- height: 47px;
276
- position: absolute;
277
- right: -47px;
278
- top: 0;
279
- width: 47px;
146
+ padding-block: 0;
147
+ text-decoration: none;
280
148
 
281
- [dir="rtl"] & {
282
- right: auto;
283
- left: -47px;
284
- transform: scaleX(-1);
285
- }
286
- }
149
+ &--label {
150
+ white-space: nowrap;
151
+ overflow-x: clip;
152
+ text-overflow: ellipsis;
153
+ max-width: 30ch;
154
+ font-family: $fonts-copy;
155
+ font-weight: 400;
156
+ @include font-styles("body-xxs");
287
157
 
288
- &.context--menu {
289
- &:after {
290
- content: none;
158
+ &:hover,
159
+ &:focus {
160
+ color: $color-link-text-hover;
161
+ text-decoration: underline;
162
+ text-underline-offset: px-to-rem(4px);
163
+ text-decoration-thickness: px-to-rem(2px);
291
164
  }
292
165
  }
293
166
  }
294
-
295
- // @TODO: This shouldn't be here, we should handle this through Storybook configuation
296
- &.storybook {
297
- background-color: $brand-ilo-grey-ui;
298
- height: 100vh;
299
- }
300
167
  }
@@ -8,6 +8,7 @@
8
8
  display: inline-block;
9
9
  position: relative;
10
10
  width: auto;
11
+ list-style: none;
11
12
 
12
13
  &:before {
13
14
  background-position: top center;
@@ -595,7 +595,7 @@
595
595
 
596
596
  &::before {
597
597
  background: $brand-ilo-dark-blue;
598
- clip-path: polygon(0 0, 100% 0, 100% 100%);
598
+ clip-path: polygon(0 0, 100% 0, 97% 100%);
599
599
  content: "";
600
600
  display: block;
601
601
  height: 100%;
@@ -605,7 +605,7 @@
605
605
  width: 32px;
606
606
 
607
607
  [dir="rtl"] & {
608
- clip-path: polygon(0 0, 0 100%, 100% 0);
608
+ clip-path: polygon(0 0, 0 100%, 97% 0);
609
609
  left: auto;
610
610
  right: -31px;
611
611
  }
@@ -71,6 +71,7 @@
71
71
  font-family: $fonts-display;
72
72
  font-weight: 600;
73
73
  display: flex;
74
+ gap: spacing(1);
74
75
  height: px-to-rem(60px);
75
76
  justify-content: flex-start;
76
77
  padding-left: spacing(2);
@@ -88,13 +89,13 @@
88
89
  &.icon {
89
90
  .ilo--icon {
90
91
  height: px-to-rem(16px);
91
- margin-right: px-to-rem(5px);
92
92
  order: 1;
93
93
  width: px-to-rem(16px);
94
94
  }
95
95
 
96
96
  .ilo--tabs--selection--label {
97
97
  order: 2;
98
+ flex: 1 1;
98
99
  }
99
100
  }
100
101
 
@@ -115,14 +116,14 @@
115
116
  }
116
117
 
117
118
  &--label {
118
- display: -webkit-box;
119
- -webkit-line-clamp: 1;
120
- -webkit-box-orient: vertical;
121
119
  overflow: hidden;
122
120
  padding-top: spacing(1);
121
+ white-space: nowrap;
122
+ text-overflow: ellipsis;
123
123
  }
124
124
 
125
125
  &--item {
126
+ overflow: hidden;
126
127
  display: block;
127
128
  width: 100%;
128
129