@ilo-org/styles 1.0.2 → 1.0.4

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.4",
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,93 @@
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;
8
11
  z-index: 10;
9
12
 
10
- &--items {
11
- align-items: center;
12
- background-color: $color-base-neutrals-white;
13
+ &--inner {
13
14
  display: inline-flex;
14
- justify-content: flex-start;
15
- padding-block: spacing(4);
16
- padding-inline-end: 0;
15
+ // Local variable set in the Hero for alignment
17
16
  padding-inline-start: var(--breadcrumb-padding);
18
- position: relative;
19
- &.context--menu {
20
- padding: 0;
17
+ padding-inline-end: spacing(12);
18
+ padding-block: spacing(4);
19
+ background-color: $color-base-neutrals-white;
20
+ @include cornercut(spacing(12), 100%, "right", "bottom");
21
+
22
+ [dir="rtl"] & {
23
+ @include cornercut(spacing(12), 100%, "left", "bottom");
21
24
  }
22
25
  }
23
26
 
24
- &--link {
27
+ &--items,
28
+ &--context {
25
29
  align-items: center;
26
- background-position: right;
27
- background-repeat: no-repeat;
28
- color: map-get($color, "link", "text", "default");
29
30
  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);
31
+ justify-content: flex-start;
32
+ list-style: none;
33
+ }
34
+
35
+ &--item,
36
+ &--context__collapse {
37
+ background-repeat: no-repeat;
36
38
  @include dataurlicon("breadcrumbdivider", $color-link-text-default);
39
+ background-position: left;
40
+ padding-inline: spacing(6) spacing(4);
37
41
 
38
42
  [dir="rtl"] & {
39
- background-position: left;
43
+ background-position: right;
44
+ background-repeat: no-repeat;
40
45
  @include dataurlicon("breadcrumbdividerrtl", $color-link-text-default);
41
46
  }
47
+ }
42
48
 
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");
49
+ &--context {
50
+ $context: &;
51
+ position: relative;
52
+
53
+ &--button {
54
+ display: none;
55
+ padding: 0;
56
+ margin: 0;
57
+ border: none;
58
+ background-position: center center;
59
+ background-repeat: no-repeat;
60
+ background-size: 16px 4px;
61
+ position: relative;
62
+ width: px-to-rem(42px);
63
+ height: px-to-rem(16px);
64
+ @include dataurlicon("elipsis", $color-link-text-default);
65
+
66
+ &:hover {
67
+ cursor: pointer;
68
+ @include dataurlicon("elipsis", $color-base-blue-medium);
69
+ }
70
+ }
71
+
72
+ &--menu {
73
+ display: none;
74
+ position: fixed;
75
+ width: px-to-rem(120px);
76
+ z-index: 10;
51
77
 
52
- &--dropdown {
53
- font-family: $fonts-copy;
54
- @include font-styles("body-xxs");
78
+ &__visible {
79
+ display: inline-block;
55
80
  }
56
81
  }
57
82
 
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);
83
+ &__collapse {
84
+ padding-inline: spacing(3) spacing(1);
64
85
 
65
- [dir="rtl"] & {
66
- @include dataurlicon("breadcrumbdividerrtl", $color-link-text-hover);
86
+ #{$breadcrumb}--items {
87
+ display: none;
88
+ }
89
+
90
+ #{$context}--button {
91
+ display: inline-block;
67
92
  }
68
93
  }
69
94
  }
@@ -71,19 +96,32 @@
71
96
  &--item {
72
97
  align-items: center;
73
98
  display: flex;
74
- height: px-to-rem(16px);
75
99
 
76
- &.home {
100
+ &__first {
77
101
  align-items: center;
78
102
  display: flex;
79
103
  position: relative;
104
+ // Make sure arrow doesn't appear before house even in RTL
105
+ background: none !important;
106
+ // Make sure the outline is visible when focused
107
+ padding-inline-start: 2px;
80
108
 
81
- .ilo--breadcrumb--link {
82
- &--label {
83
- @include isVisuallyHidden();
109
+ &:hover,
110
+ &:focus {
111
+ #{$breadcrumb}--link {
112
+ &:after {
113
+ @include dataurlicon("home", $color-link-text-hover);
114
+ }
84
115
  }
116
+ }
85
117
 
86
- &:before {
118
+ #{$breadcrumb}--link {
119
+ background: none;
120
+ width: px-to-rem(16px);
121
+ height: px-to-rem(16px);
122
+ position: relative;
123
+
124
+ &:after {
87
125
  background-position: center center;
88
126
  background-repeat: no-repeat;
89
127
  content: "";
@@ -95,207 +133,34 @@
95
133
  width: px-to-rem(16px);
96
134
  @include dataurlicon("home", $color-link-text-default);
97
135
  }
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
136
  }
121
137
  }
122
138
  }
123
139
 
124
- .ilo--breadcrumb--item--context {
125
- align-items: flex-start;
126
- display: flex;
140
+ &--link {
141
+ display: inline-flex;
142
+ align-items: center;
143
+ color: $color-link-text-default;
127
144
  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;
145
+ padding-block: 0;
146
+ text-decoration: none;
281
147
 
282
- [dir="rtl"] & {
283
- right: auto;
284
- left: -47px;
285
- transform: scaleX(-1);
286
- }
287
- }
148
+ &--label {
149
+ white-space: nowrap;
150
+ overflow-x: clip;
151
+ text-overflow: ellipsis;
152
+ max-width: 30ch;
153
+ font-family: $fonts-copy;
154
+ font-weight: 400;
155
+ @include font-styles("body-xxs");
288
156
 
289
- &.context--menu {
290
- &:after {
291
- content: none;
157
+ &:hover,
158
+ &:focus {
159
+ color: $color-link-text-hover;
160
+ text-decoration: underline;
161
+ text-underline-offset: px-to-rem(4px);
162
+ text-decoration-thickness: px-to-rem(2px);
292
163
  }
293
164
  }
294
165
  }
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
166
  }
@@ -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;