@ilo-org/twig 0.2.26 → 0.3.1

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.
@@ -1,9 +1,9 @@
1
1
 
2
- > @ilo-org/twig@0.2.26 build:lib /home/runner/work/designsystem/designsystem/packages/twig
2
+ > @ilo-org/twig@0.3.1 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.2.26 output /home/runner/work/designsystem/designsystem/packages/twig
7
+ > @ilo-org/twig@0.3.1 output /home/runner/work/designsystem/designsystem/packages/twig
8
8
  > node outputtwigs.js
9
9
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @ilo-org/twig
2
2
 
3
+ ## 0.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [ee2e53f51]
8
+ - @ilo-org/styles@0.3.4
9
+
10
+ ## 0.3.0
11
+
12
+ ### Minor Changes
13
+
14
+ - 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.
15
+
16
+ ### Patch Changes
17
+
18
+ - 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.
19
+ - Updated dependencies [ee859111c]
20
+ - Updated dependencies [ee859111c]
21
+ - Updated dependencies [ee859111c]
22
+ - @ilo-org/styles@0.3.3
23
+
3
24
  ## 0.2.26
4
25
 
5
26
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ilo-org/twig",
3
- "version": "0.2.26",
3
+ "version": "0.3.1",
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.2",
28
+ "@ilo-org/styles": "0.3.4",
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
- <div class="{{prefix}}--card--image--wrapper">
14
- {% block card_image %}
15
- <picture>
16
- {% for img in url|reverse %}
17
- {% if loop.last == false %}
18
- <source srcset="{{img.src}}" media="(min-width: {{img.breakpoint}}px)">
19
- {% endif %}
20
- {% endfor %}
21
- <img class="{{prefix}}--card--image" src="{{url|reverse|last.src}}" alt="{{alt}}" {% if loading %}loading="{{ loading }}"{% endif %}>
22
- </picture>
23
- {% endblock %}
24
- </div>
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
- <div class="{{prefix}}--card--image--wrapper">
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,24 @@ 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. For responsive images, this can be an array of objects with an `src` property pointing to the image file and a `breakpoint` property indicating the minimum viewport width at which the image should be displayed. For static images, this can be a string pointing to the image file.
37
+ preview:
38
+ - breakpoint: 0
39
+ src: "/images/small.jpg"
40
+ - breakpoint: 800
41
+ src: "/images/medium.jpg"
42
+ - breakpoint: 1200
43
+ src: "/images/large.jpg"
44
+ - breakpoint: 1440
45
+ src: "/images/large.jpg"
46
+ imageAlt:
47
+ type: string
48
+ label: Image Alt
49
+ description: Alt text for the image
50
+ preview: "This is the alt text for the image"
33
51
  profile:
34
52
  type: object
35
53
  label: Profile
@@ -49,22 +67,14 @@ card:
49
67
  type: object
50
68
  label: CTA
51
69
  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
70
  source:
59
71
  type: object
60
72
  label: Source
61
73
  description: Source link for `Stat` cards
62
- preview:
63
74
  linklist:
64
75
  type: object
65
76
  label: Link List
66
77
  description: Implementation of the LinkList component. Appears at the bottom of `Multilink` or `Feature` card.
67
- preview:
68
78
  dataset:
69
79
  type: object
70
80
  label: Dataset object
@@ -133,7 +143,6 @@ card:
133
143
  date:
134
144
  human: 20 September 2022
135
145
  unix: 1670389200
136
- image: ""
137
146
  link: "https:/www.ilo.org"
138
147
  profile:
139
148
  avatar: "/images/ilo-dg.jpg"
@@ -164,7 +173,6 @@ card:
164
173
  fields:
165
174
  eyebrow: High-level meeting
166
175
  title: "ILO welcomes G7 call to make a just transition to a green economy happen"
167
- image: "/images/hero.jpg"
168
176
  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
177
  linklist:
170
178
  linkgroup:
@@ -196,7 +204,6 @@ card:
196
204
  human: 17 March 2022
197
205
  unix: 1670389200
198
206
  link: "https://www.ilo.org/search?q=graphic"
199
- image: "/images/hero.jpg"
200
207
  linklist:
201
208
  headline: ""
202
209
  linkgroup:
@@ -215,7 +222,6 @@ card:
215
222
  human: 17 March 2022
216
223
  unix: 1670389200
217
224
  link: "https://www.ilo.org"
218
- image: "/images/medium.jpg"
219
225
  profile:
220
226
  eventdetails: "8:30 - 12:00 CET | Geneva"
221
227
  factlist:
@@ -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
- // eslint-disable-next-line no-console
10
- console.log("loading Navigation component....");
11
- new Navigation(element);
12
- element.dataset.jsProcessed = true;
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/logo_en_horizontal_white.svg"
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.google.com/"
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
- // eslint-disable-next-line no-console
11
- console.log("loading Notification component....");
12
- new Notification(element);
13
- element.dataset.jsProcessed = true;
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
  );