@ilo-org/twig 0.2.26 → 0.3.0
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/.turbo/turbo-build:lib.log +2 -2
- package/CHANGELOG.md +14 -0
- package/package.json +2 -2
- package/src/patterns/components/card/card.twig +19 -24
- package/src/patterns/components/card/card.wingsuit.yml +19 -9
- package/src/patterns/components/navigation/navigation.behavior.js +5 -5
- package/src/patterns/components/navigation/navigation.js +10 -5
- package/src/patterns/components/navigation/navigation.wingsuit.yml +2 -2
- package/src/patterns/components/notification/notification.behavior.js +5 -6
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @ilo-org/twig@0.
|
|
2
|
+
> @ilo-org/twig@0.3.0 build:lib /home/runner/work/designsystem/designsystem/packages/twig
|
|
3
3
|
> node importprefix.js && node importsvgs.js && pnpm output
|
|
4
4
|
|
|
5
5
|
theme prefix added
|
|
6
6
|
|
|
7
|
-
> @ilo-org/twig@0.
|
|
7
|
+
> @ilo-org/twig@0.3.0 output /home/runner/work/designsystem/designsystem/packages/twig
|
|
8
8
|
> node outputtwigs.js
|
|
9
9
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @ilo-org/twig
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ee859111c: Add support for reponsive images in the Card component. The `image` field can take either a string (for a non-responsive image) or an array of objects with an `src` and `breakpoint` property. The `image` field of the card now works the same way as the `url` field of the Image component. This also adds an `imageAlt` field that applies a describe alt tag to the image.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- ee859111c: Fixes bug where touch events on the mobile open/close buttons inadvertantly activated the logo link. Also correctly hides the mobile nav when it's closed so it doesn't show up in the tab order and can't be clicked.
|
|
12
|
+
- Updated dependencies [ee859111c]
|
|
13
|
+
- Updated dependencies [ee859111c]
|
|
14
|
+
- Updated dependencies [ee859111c]
|
|
15
|
+
- @ilo-org/styles@0.3.3
|
|
16
|
+
|
|
3
17
|
## 0.2.26
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ilo-org/twig",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Twig components for the ILO's Design System",
|
|
6
6
|
"main": "",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@ilo-org/brand-assets": "0.1.0",
|
|
26
26
|
"@ilo-org/fonts": "0.1.0",
|
|
27
27
|
"@ilo-org/icons": "0.1.17",
|
|
28
|
-
"@ilo-org/styles": "0.3.
|
|
28
|
+
"@ilo-org/styles": "0.3.3",
|
|
29
29
|
"@ilo-org/themes": "0.1.15",
|
|
30
30
|
"@ilo-org/utils": "0.0.11"
|
|
31
31
|
},
|
|
@@ -10,18 +10,24 @@
|
|
|
10
10
|
{% endif %}
|
|
11
11
|
<div class="{{prefix}}--card--wrap">
|
|
12
12
|
{% if image %}
|
|
13
|
-
|
|
14
|
-
{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
{%
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
{% block card_image %}
|
|
14
|
+
<div class="{{prefix}}--card--image--wrapper">
|
|
15
|
+
{% if image is iterable %}
|
|
16
|
+
<picture>
|
|
17
|
+
{% for img in image|reverse %}
|
|
18
|
+
{% if loop.last == false %}
|
|
19
|
+
<source srcset="{{img.src}}" media="(min-width: {{img.breakpoint}}px)">
|
|
20
|
+
{% endif %}
|
|
21
|
+
{% endfor %}
|
|
22
|
+
<img class="{{prefix}}--card--image" src="{{image|reverse|last.src}}" alt="{{imageAlt}}" {% if loading %} loading="{{ loading }}"{% endif %}>
|
|
23
|
+
</picture>
|
|
24
|
+
{% else %}
|
|
25
|
+
<picture>
|
|
26
|
+
<img class="{{prefix}}--card--image" src="{{image}}" alt="{{imageAlt}}">
|
|
27
|
+
</picture>
|
|
28
|
+
{% endif %}
|
|
29
|
+
</div>
|
|
30
|
+
{% endblock %}
|
|
25
31
|
{% endif %}
|
|
26
32
|
<div class="{{prefix}}--card--content">
|
|
27
33
|
{% if eyebrow %}
|
|
@@ -31,18 +37,7 @@
|
|
|
31
37
|
<h5 class="{{prefix}}--card--title">{{title}}</h5>
|
|
32
38
|
{% endif %}
|
|
33
39
|
{% if type == "multilink" or type == "data" and image %}
|
|
34
|
-
|
|
35
|
-
{% block card_image_multilink_or_data %}
|
|
36
|
-
<picture>
|
|
37
|
-
{% for img in url|reverse %}
|
|
38
|
-
{% if loop.last == false %}
|
|
39
|
-
<source srcset="{{img.src}}" media="(min-width: {{img.breakpoint}}px)">
|
|
40
|
-
{% endif %}
|
|
41
|
-
{% endfor %}
|
|
42
|
-
<img class="{{prefix}}--card--image" src="{{url|reverse|last.src}}" alt="{{alt}}" {% if loading %}loading="{{ loading }}"{% endif %}>
|
|
43
|
-
</picture>
|
|
44
|
-
{% endblock %}
|
|
45
|
-
</div>
|
|
40
|
+
{{ block("card_image") }}
|
|
46
41
|
{% endif %}
|
|
47
42
|
{% if intro %}
|
|
48
43
|
<p class="{{prefix}}--card--intro">{{intro}}</p>
|
|
@@ -30,6 +30,16 @@ card:
|
|
|
30
30
|
label: Eyebrow
|
|
31
31
|
description: Event details for `Detail` card
|
|
32
32
|
preview: ""
|
|
33
|
+
image:
|
|
34
|
+
type: object
|
|
35
|
+
label: Image
|
|
36
|
+
description: Image settings for the card. Only applies to `Graphic Promo` and `Graphic Text` cards. Image can be a string consisting of an image src or an array of objects with `src` and `breakpoint` properties for responsive images.
|
|
37
|
+
preview: ""
|
|
38
|
+
imageAlt:
|
|
39
|
+
type: string
|
|
40
|
+
label: Image Alt
|
|
41
|
+
description: Alt text for the image
|
|
42
|
+
preview: "This is the alt text for the image"
|
|
33
43
|
profile:
|
|
34
44
|
type: object
|
|
35
45
|
label: Profile
|
|
@@ -49,22 +59,14 @@ card:
|
|
|
49
59
|
type: object
|
|
50
60
|
label: CTA
|
|
51
61
|
description: Items for clickable CTA button. Button used for `Graphic Promo` card.
|
|
52
|
-
preview:
|
|
53
|
-
image:
|
|
54
|
-
type: string
|
|
55
|
-
label: Image
|
|
56
|
-
description: The image for the card. Images should be avoided on `Graphic Promo`, `Graphic Text`, `Factlist`, and `Stat` card.
|
|
57
|
-
preview: ""
|
|
58
62
|
source:
|
|
59
63
|
type: object
|
|
60
64
|
label: Source
|
|
61
65
|
description: Source link for `Stat` cards
|
|
62
|
-
preview:
|
|
63
66
|
linklist:
|
|
64
67
|
type: object
|
|
65
68
|
label: Link List
|
|
66
69
|
description: Implementation of the LinkList component. Appears at the bottom of `Multilink` or `Feature` card.
|
|
67
|
-
preview:
|
|
68
70
|
dataset:
|
|
69
71
|
type: object
|
|
70
72
|
label: Dataset object
|
|
@@ -164,7 +166,15 @@ card:
|
|
|
164
166
|
fields:
|
|
165
167
|
eyebrow: High-level meeting
|
|
166
168
|
title: "ILO welcomes G7 call to make a just transition to a green economy happen"
|
|
167
|
-
image:
|
|
169
|
+
image:
|
|
170
|
+
- breakpoint: 0
|
|
171
|
+
src: "/images/small.jpg"
|
|
172
|
+
- breakpoint: 800
|
|
173
|
+
src: "/images/medium.jpg"
|
|
174
|
+
- breakpoint: 1200
|
|
175
|
+
src: "/images/large.jpg"
|
|
176
|
+
- breakpoint: 1440
|
|
177
|
+
src: "/images/large.jpg"
|
|
168
178
|
intro: "At the end of their meeting the G7 Labour Ministers highlighted the urgent need to greater focus on rights and occupational safety and health."
|
|
169
179
|
linklist:
|
|
170
180
|
linkgroup:
|
|
@@ -5,11 +5,11 @@ Drupal.behaviors.navigation = {
|
|
|
5
5
|
Array.prototype.forEach.call(
|
|
6
6
|
document.querySelectorAll(`[data-loadcomponent="Navigation"]`),
|
|
7
7
|
(element) => {
|
|
8
|
-
if(!element.dataset.jsProcessed) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
if (!element.dataset.jsProcessed) {
|
|
9
|
+
// eslint-disable-next-line no-console
|
|
10
|
+
console.log("loading Navigation component....");
|
|
11
|
+
new Navigation(element);
|
|
12
|
+
element.dataset.jsProcessed = true;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
);
|
|
@@ -149,11 +149,11 @@ export default class Navigation {
|
|
|
149
149
|
// menuCloseSet
|
|
150
150
|
if (this.menuCloseSet.length > 0) {
|
|
151
151
|
this.menuCloseSet.forEach((closeButton, i) => {
|
|
152
|
-
closeButton.addEventListener(EVENTS.CLICK, () =>
|
|
153
|
-
this.menuCloseClick(i)
|
|
152
|
+
closeButton.addEventListener(EVENTS.CLICK, (e) =>
|
|
153
|
+
this.menuCloseClick(i, e)
|
|
154
154
|
);
|
|
155
|
-
closeButton.addEventListener(EVENTS.TOUCH_START, () =>
|
|
156
|
-
this.menuCloseClick(i)
|
|
155
|
+
closeButton.addEventListener(EVENTS.TOUCH_START, (e) =>
|
|
156
|
+
this.menuCloseClick(i, e)
|
|
157
157
|
);
|
|
158
158
|
});
|
|
159
159
|
}
|
|
@@ -418,6 +418,7 @@ export default class Navigation {
|
|
|
418
418
|
* @chainable
|
|
419
419
|
*/
|
|
420
420
|
handleMenuOpenClick(e) {
|
|
421
|
+
e.preventDefault();
|
|
421
422
|
e.stopImmediatePropagation();
|
|
422
423
|
this.element.classList.add(`${this.prefix}--mobile--open`);
|
|
423
424
|
this.body.classList.add(`${this.prefix}--menu--open`);
|
|
@@ -499,6 +500,8 @@ export default class Navigation {
|
|
|
499
500
|
* @chainable
|
|
500
501
|
*/
|
|
501
502
|
handleSubnavBackClick(e) {
|
|
503
|
+
e.stopImmediatePropagation();
|
|
504
|
+
e.preventDefault();
|
|
502
505
|
// this.element.classList.remove(`${this.prefix}--subnav--open`);
|
|
503
506
|
this.subnavClickOff(e);
|
|
504
507
|
this.element.classList.remove(`${this.prefix}--select--open`);
|
|
@@ -512,7 +515,9 @@ export default class Navigation {
|
|
|
512
515
|
* @return {Object} Navigation A reference to the instance of the class
|
|
513
516
|
* @chainable
|
|
514
517
|
*/
|
|
515
|
-
handleMenuCloseClick() {
|
|
518
|
+
handleMenuCloseClick(i, e) {
|
|
519
|
+
e.preventDefault();
|
|
520
|
+
e.stopImmediatePropagation();
|
|
516
521
|
this.element.classList.remove(`${this.prefix}--mobile--open`);
|
|
517
522
|
this.element.classList.remove(`${this.prefix}--subnav--open`);
|
|
518
523
|
|
|
@@ -17,14 +17,14 @@ navigation:
|
|
|
17
17
|
description: Logo for the nav
|
|
18
18
|
required: true
|
|
19
19
|
preview:
|
|
20
|
-
image: "/brand-assets/
|
|
20
|
+
image: "/brand-assets/logo_en_horizontal_blue.svg"
|
|
21
21
|
alt: Logo
|
|
22
22
|
siteurl:
|
|
23
23
|
type: string
|
|
24
24
|
label: Site url
|
|
25
25
|
description: home url for the website
|
|
26
26
|
required: true
|
|
27
|
-
preview: "https://www.
|
|
27
|
+
preview: "https://www.ilo.org/"
|
|
28
28
|
tagline:
|
|
29
29
|
type: object
|
|
30
30
|
label: Site tagline
|
|
@@ -2,15 +2,14 @@ import Notification from "./notification";
|
|
|
2
2
|
|
|
3
3
|
Drupal.behaviors.notification = {
|
|
4
4
|
attach() {
|
|
5
|
-
console.log("got here....");
|
|
6
5
|
Array.prototype.forEach.call(
|
|
7
6
|
document.querySelectorAll(`[data-loadcomponent="Notification"]`),
|
|
8
7
|
(element) => {
|
|
9
|
-
if(!element.dataset.jsProcessed) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
if (!element.dataset.jsProcessed) {
|
|
9
|
+
// eslint-disable-next-line no-console
|
|
10
|
+
console.log("loading Notification component....");
|
|
11
|
+
new Notification(element);
|
|
12
|
+
element.dataset.jsProcessed = true;
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
15
|
);
|