@ilo-org/styles 1.0.2 → 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.2",
4
+ "version": "1.0.3",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/international-labour-organization/designsystem.git",
@@ -40,7 +40,7 @@
40
40
  "dependencies": {
41
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,68 +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;
54
- @include font-styles("body-xxs");
79
+ &__visible {
80
+ display: inline-block;
55
81
  }
56
82
  }
57
83
 
58
- &:hover,
59
- &:focus {
60
- color: map-get($color, "link", "text", "hover");
61
- text-decoration: underline;
62
- text-decoration-thickness: px-to-rem($borders-base);
63
- @include dataurlicon("breadcrumbdivider", $color-link-text-hover);
84
+ &__collapse {
85
+ padding-inline: spacing(3) spacing(1);
64
86
 
65
- [dir="rtl"] & {
66
- @include dataurlicon("breadcrumbdividerrtl", $color-link-text-hover);
87
+ #{$breadcrumb}--items {
88
+ display: none;
89
+ }
90
+
91
+ #{$context}--button {
92
+ display: inline-block;
67
93
  }
68
94
  }
69
95
  }
@@ -71,19 +97,32 @@
71
97
  &--item {
72
98
  align-items: center;
73
99
  display: flex;
74
- height: px-to-rem(16px);
75
100
 
76
- &.home {
101
+ &__first {
77
102
  align-items: center;
78
103
  display: flex;
79
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;
80
109
 
81
- .ilo--breadcrumb--link {
82
- &--label {
83
- @include isVisuallyHidden();
110
+ &:hover,
111
+ &:focus {
112
+ #{$breadcrumb}--link {
113
+ &:after {
114
+ @include dataurlicon("home", $color-link-text-hover);
115
+ }
84
116
  }
117
+ }
85
118
 
86
- &: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 {
87
126
  background-position: center center;
88
127
  background-repeat: no-repeat;
89
128
  content: "";
@@ -95,207 +134,34 @@
95
134
  width: px-to-rem(16px);
96
135
  @include dataurlicon("home", $color-link-text-default);
97
136
  }
98
-
99
- [dir="rtl"] & {
100
- &:before {
101
- left: initial;
102
- right: 0;
103
- }
104
- }
105
- }
106
-
107
- &:hover,
108
- &:focus {
109
- .ilo--breadcrumb--link {
110
- &:before {
111
- @include dataurlicon("home", $color-link-text-hover);
112
- }
113
- }
114
- }
115
- }
116
-
117
- &.final {
118
- .ilo--breadcrumb--link {
119
- background-image: none;
120
137
  }
121
138
  }
122
139
  }
123
140
 
124
- .ilo--breadcrumb--item--context {
125
- align-items: flex-start;
126
- display: flex;
141
+ &--link {
142
+ display: inline-flex;
143
+ align-items: center;
144
+ color: $color-link-text-default;
127
145
  height: px-to-rem(16px);
128
- }
129
-
130
- &.contextmenu {
131
- .ilo--breadcrumb--item--context {
132
- background-position: center center;
133
- background-repeat: no-repeat;
134
- background-size: 16px 4px;
135
- position: relative;
136
- width: px-to-rem(42px);
137
- @include dataurlicon("elipsis", $color-link-text-default);
138
-
139
- &:hover {
140
- cursor: pointer;
141
- @include dataurlicon("elipsis", $color-base-blue-medium);
142
- }
143
-
144
- &:after {
145
- background-position: center center;
146
- background-repeat: no-repeat;
147
- content: "";
148
- display: block;
149
- height: px-to-rem(16px);
150
- right: -7px;
151
- position: absolute;
152
- top: 0;
153
- width: px-to-rem(16px);
154
- @include dataurlicon("breadcrumbdivider", $color-link-text-default);
155
-
156
- [dir="rtl"] & {
157
- right: auto;
158
- left: -7px;
159
- @include dataurlicon(
160
- "breadcrumbdividerrtl",
161
- $color-link-text-default
162
- );
163
- }
164
- }
165
-
166
- .context--menu {
167
- border-radius: px-to-rem(2px);
168
- background-color: $color-ux-background-highlight;
169
- display: inline-block;
170
- left: px-to-rem(-40px);
171
- opacity: 0;
172
- position: absolute;
173
- top: calc(100% + 24px);
174
- width: px-to-rem(120px);
175
- z-index: 10;
176
- @include globaltransition("opacity");
177
-
178
- &.open {
179
- opacity: 1;
180
- @include globaltransition("opacity");
181
- }
182
-
183
- &:before {
184
- background-position: top center;
185
- background-repeat: no-repeat;
186
- background-size: contain;
187
- @include dataurlicon(
188
- "halfsquaretriangle",
189
- $color-ux-background-highlight
190
- );
191
- content: "";
192
- height: px-to-rem(12px);
193
- position: absolute;
194
- left: 50%;
195
- top: -#{px-to-rem(6px)};
196
- transform: translateX(-50%) rotate(135deg);
197
- width: px-to-rem(12px);
198
- }
199
-
200
- &:hover {
201
- cursor: pointer;
202
- }
203
-
204
- .ilo--breadcrumb--item {
205
- display: inline-block;
206
- height: auto;
207
- padding: 0 spacing(2);
208
- position: relative;
209
- width: 100%;
210
-
211
- &:last-of-type a {
212
- border-bottom: none;
213
- }
214
-
215
- &:hover,
216
- &:focus {
217
- background-color: $color-base-blue-light;
218
- text-decoration: none;
219
-
220
- .ilo--breadcrumb--link {
221
- text-decoration: underline;
222
- text-decoration-thickness: px-to-rem($borders-base);
223
- }
224
- }
225
-
226
- &.endsection {
227
- border-bottom: px-to-rem($borders-base) solid
228
- $color-base-neutrals-white;
229
-
230
- .ilo--context-menu--link {
231
- border-bottom: none;
232
- }
233
- }
234
- }
235
-
236
- .ilo--breadcrumb--link {
237
- background: none;
238
- border-bottom: px-to-rem($borders-base) solid
239
- $color-base-neutrals-white;
240
- color: map-get($color, "link", "text", "default");
241
- display: inline-block;
242
- font-family: $fonts-copy;
243
- font-weight: map-get($type, "weights", "section");
244
- height: auto;
245
- padding: spacing(4) 0;
246
- text-decoration: none;
247
- width: 100%;
248
- @include font-styles("body-xxs");
249
-
250
- &:visited {
251
- color: map-get($color, "link", "text", "default");
252
- }
253
-
254
- &:active {
255
- color: map-get($color, "link", "text", "active");
256
- outline: none;
257
- }
258
-
259
- &:hover,
260
- &:focus {
261
- color: map-get($color, "link", "text", "hover");
262
- outline: none;
263
- text-decoration: underline;
264
- text-decoration-thickness: px-to-rem($borders-base);
265
- }
266
- }
267
- }
268
- }
269
- }
270
-
271
- &--items {
272
- &:after {
273
- background: linear-gradient(to bottom right, white 50%, transparent 50%);
274
- content: "";
275
- display: inline-block;
276
- height: 47px;
277
- position: absolute;
278
- right: -47px;
279
- top: 0;
280
- width: 47px;
146
+ padding-block: 0;
147
+ text-decoration: none;
281
148
 
282
- [dir="rtl"] & {
283
- right: auto;
284
- left: -47px;
285
- transform: scaleX(-1);
286
- }
287
- }
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");
288
157
 
289
- &.context--menu {
290
- &:after {
291
- 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);
292
164
  }
293
165
  }
294
166
  }
295
-
296
- // @TODO: This shouldn't be here, we should handle this through Storybook configuation
297
- &.storybook {
298
- background-color: $brand-ilo-grey-ui;
299
- height: 100vh;
300
- }
301
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;