@ilo-org/twig 0.13.0 → 0.14.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 +25 -0
- package/package.json +4 -3
- package/src/patterns/components/breadcrumb/breadcrumb.twig +29 -23
- package/src/patterns/components/card_multilink/card_multilink.twig +3 -0
- package/src/patterns/components/card_multilink/card_multilink.wingsuit.yml +5 -0
- package/src/patterns/components/hero/hero.twig +1 -2
- package/src/patterns/components/hero/hero.wingsuit.yml +9 -0
- package/src/patterns/components/tooltip/tooltip.js +38 -77
- package/src/patterns/components/tooltip/tooltip.twig +2 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @ilo-org/twig@0.
|
|
2
|
+
> @ilo-org/twig@0.14.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.14.0 output /home/runner/work/designsystem/designsystem/packages/twig
|
|
8
8
|
> node outputtwigs.js
|
|
9
9
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @ilo-org/twig
|
|
2
2
|
|
|
3
|
+
## 0.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- df7080c80: Used popper library to handle tooltip
|
|
8
|
+
- 6fe60e0d6: Add a `gap` setting to the hero card that allows the developer to set an optional background color on the entire Hero,
|
|
9
|
+
which fills the "gap" between the bottom of the Hero Card and the bottom of the hero image when `align` is set to `bottom` or `baseline`. Options are `transparent`, `white`, `light` and `dark`.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- b014e9af0: Fix Breadcrumb incorrectly assuming there will always be at least two links
|
|
14
|
+
- c54ce9923: Fix Breadcrumb spacing vis-a-vis Hero
|
|
15
|
+
- a78b32be4: Add eyebrow to multilink card
|
|
16
|
+
- 9ed7b873d: build(deps-dev): bump postcss from 8.4.21 to 8.4.31
|
|
17
|
+
- Updated dependencies [df7080c80]
|
|
18
|
+
- Updated dependencies [c5eaabd55]
|
|
19
|
+
- Updated dependencies [720825342]
|
|
20
|
+
- Updated dependencies [6f86e7a94]
|
|
21
|
+
- Updated dependencies [94b03b9be]
|
|
22
|
+
- Updated dependencies [c54ce9923]
|
|
23
|
+
- Updated dependencies [6fe60e0d6]
|
|
24
|
+
- Updated dependencies [9ed7b873d]
|
|
25
|
+
- Updated dependencies [c173ec9f8]
|
|
26
|
+
- @ilo-org/styles@0.13.0
|
|
27
|
+
|
|
3
28
|
## 0.13.0
|
|
4
29
|
|
|
5
30
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ilo-org/twig",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Twig components for the ILO's Design System",
|
|
6
6
|
"main": "",
|
|
@@ -25,13 +25,14 @@
|
|
|
25
25
|
"@ilo-org/brand-assets": "0.2.0",
|
|
26
26
|
"@ilo-org/fonts": "0.1.2",
|
|
27
27
|
"@ilo-org/icons": "0.2.1",
|
|
28
|
-
"@ilo-org/styles": "0.
|
|
28
|
+
"@ilo-org/styles": "0.13.0",
|
|
29
29
|
"@ilo-org/themes": "0.7.0",
|
|
30
30
|
"@ilo-org/utils": "0.0.11"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@babel/core": "^7.20.12",
|
|
34
34
|
"@babel/preset-env": "^7.20.2",
|
|
35
|
+
"@popperjs/core": "^2.11.8",
|
|
35
36
|
"@storybook/addon-actions": "^6.5.16",
|
|
36
37
|
"@storybook/addon-essentials": "^6.5.16",
|
|
37
38
|
"@storybook/addon-links": "^6.5.16",
|
|
@@ -58,7 +59,7 @@
|
|
|
58
59
|
"lodash": "^4.17.21",
|
|
59
60
|
"mini-css-extract-plugin": "^1.6.2",
|
|
60
61
|
"optimize-css-assets-webpack-plugin": "^5.0.8",
|
|
61
|
-
"postcss": "^8.4.
|
|
62
|
+
"postcss": "^8.4.31",
|
|
62
63
|
"postcss-loader": "^4.3.0",
|
|
63
64
|
"postcss-nested": "^4.2.3",
|
|
64
65
|
"postcss-scss": "^4.0.6",
|
|
@@ -10,28 +10,34 @@
|
|
|
10
10
|
<span class="{{prefix}}--breadcrumb--link--label">{{home.label}}</span>
|
|
11
11
|
</a>
|
|
12
12
|
</li>
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
13
|
+
{% if links|length >= 2 %}
|
|
14
|
+
<li class="{{prefix}}--breadcrumb--item first">
|
|
15
|
+
<a class="{{prefix}}--breadcrumb--link" href="{{firstlink.url}}">
|
|
16
|
+
<span class="{{prefix}}--breadcrumb--link--label">{{firstlink.label}}</span>
|
|
17
|
+
</a>
|
|
18
|
+
</li>
|
|
19
|
+
{% endif %}
|
|
20
|
+
{% if links|length >= 3%}
|
|
21
|
+
<li class="{{prefix}}--breadcrumb--item--context">
|
|
22
|
+
<ul class="{{prefix}}--breadcrumb--items context--menu">
|
|
23
|
+
{% for link in links %}
|
|
24
|
+
{% if not loop.first and not loop.last %}
|
|
25
|
+
<li class="{{prefix}}--breadcrumb--item">
|
|
26
|
+
<a href="{{link.url}}" class="{{prefix}}--breadcrumb--link">
|
|
27
|
+
<span class="{{prefix}}--breadcrumb--link--label">{{link.label}}</span>
|
|
28
|
+
</a>
|
|
29
|
+
</li>
|
|
30
|
+
{% endif %}
|
|
31
|
+
{% endfor %}
|
|
32
|
+
</ul>
|
|
33
|
+
</li>
|
|
34
|
+
{% endif %}
|
|
35
|
+
{% if links|length >= 1%}
|
|
36
|
+
<li class="{{prefix}}--breadcrumb--item final">
|
|
37
|
+
<a class="{{prefix}}--breadcrumb--link" href="{{lastlink.url}}">
|
|
38
|
+
<span class="{{prefix}}--breadcrumb--link--label">{{lastlink.label}}</span>
|
|
39
|
+
</a>
|
|
40
|
+
</li>
|
|
41
|
+
{% endif %}
|
|
36
42
|
</ol>
|
|
37
43
|
</nav>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
{% set theme = theme|default(herocard.theme) %}
|
|
4
4
|
{% set background = background|default(herocard.background) %}
|
|
5
5
|
|
|
6
|
-
<div class="hero hero__card-justify__{{ justify }} hero__poster-size__{{ postersize }} hero__card-size__{{ cardsize }} hero__card-align__{{ align }} hero__card-theme__{{ theme }}">
|
|
6
|
+
<div class="hero {% if gap %} hero__gap__{{ gap }} {% endif %} hero__card-justify__{{ justify }} hero__poster-size__{{ postersize }} hero__card-size__{{ cardsize }} hero__card-align__{{ align }} hero__card-theme__{{ theme }} hero__card-background__{{ background }}">
|
|
7
7
|
<figure class="hero--background">
|
|
8
8
|
{% block hero_image %}
|
|
9
9
|
{% if image %}
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
{% endblock %}
|
|
20
20
|
</figure>
|
|
21
21
|
{% if breadcrumb %}
|
|
22
|
-
<div class="hero--breadcrumbs-offset"></div>
|
|
23
22
|
<div class="hero--breadcrumbs">
|
|
24
23
|
<div class="hero--breadcrumbs--wrapper">
|
|
25
24
|
{% include "@components/breadcrumb/breadcrumb.twig" with {
|
|
@@ -65,6 +65,15 @@ hero:
|
|
|
65
65
|
preview:
|
|
66
66
|
label: A metalurgy worker at a manufacturing plant in Viet Nam. © ILO/Minh Quang
|
|
67
67
|
settings:
|
|
68
|
+
gap:
|
|
69
|
+
label: Gap
|
|
70
|
+
description: The color of the gap between the bottom of the hero image and the bottom of the card if there is one. In practice, this is the background color of the entire Hero component which will usually only be visible in that space.
|
|
71
|
+
type: select
|
|
72
|
+
options:
|
|
73
|
+
transparent: transparent
|
|
74
|
+
white: white
|
|
75
|
+
light: light
|
|
76
|
+
dark: dark
|
|
68
77
|
justify:
|
|
69
78
|
label: Justify
|
|
70
79
|
description: Sets the horizontal alignment of the hero card. `start` is on the left in LTR layouts and on the right in RTL layouts.
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @class Tooltip
|
|
5
5
|
*/
|
|
6
|
+
|
|
7
|
+
import { createPopper, right } from "@popperjs/core";
|
|
8
|
+
|
|
6
9
|
export default class Tooltip {
|
|
7
10
|
/**
|
|
8
11
|
* Tooltip constructor which assigns the element passed into the constructor
|
|
@@ -100,96 +103,54 @@ export default class Tooltip {
|
|
|
100
103
|
}
|
|
101
104
|
|
|
102
105
|
handleOnMouseOut() {
|
|
103
|
-
this.tooltip.classList.remove(`${this.prefix}--tooltip--fade`);
|
|
104
106
|
setTimeout(() => {
|
|
107
|
+
this.tooltip.classList.remove(`${this.prefix}--tooltip--fade`);
|
|
105
108
|
this.tooltip.classList.remove(`${this.prefix}--tooltip--visible`);
|
|
106
|
-
},
|
|
109
|
+
}, 200);
|
|
107
110
|
|
|
108
111
|
return this;
|
|
109
112
|
}
|
|
110
113
|
|
|
111
114
|
postMouseOver(hoverRect) {
|
|
112
|
-
// position the tooltip after showing it
|
|
113
|
-
let placement = "center";
|
|
114
|
-
let alignment = "left";
|
|
115
|
-
|
|
116
115
|
const ttNode = this.tooltip;
|
|
116
|
+
this.setMaxWidthAndClass(this.tooltip);
|
|
117
117
|
if (ttNode != null) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
ty + ttRect.height <= window.scrollY + docHeight;
|
|
135
|
-
const bLeft =
|
|
136
|
-
lx - ttRect.width >= 0 &&
|
|
137
|
-
ty + ttRect.height <= window.scrollY + docHeight;
|
|
138
|
-
const bAbove = ty - ttRect.height >= 0;
|
|
139
|
-
const bBellow = by + ttRect.height <= window.scrollY + docHeight;
|
|
140
|
-
|
|
141
|
-
// the tooltip doesn't fit to the left
|
|
142
|
-
if (bRight) {
|
|
143
|
-
x = hoverRect.width + 32;
|
|
144
|
-
y = 0;
|
|
145
|
-
placement = "negative";
|
|
146
|
-
alignment = "right";
|
|
147
|
-
} else if (bBellow) {
|
|
148
|
-
x = 0;
|
|
149
|
-
y = hoverRect.height + 32;
|
|
150
|
-
|
|
151
|
-
placement = "center";
|
|
152
|
-
alignment = "bottom";
|
|
153
|
-
} else if (bLeft) {
|
|
154
|
-
x = -ttRect.width - 32;
|
|
155
|
-
y = 0;
|
|
156
|
-
|
|
157
|
-
placement = "negative";
|
|
158
|
-
alignment = "left";
|
|
159
|
-
} else if (bAbove) {
|
|
160
|
-
x = 0;
|
|
161
|
-
y = -ttRect.height - 32;
|
|
162
|
-
|
|
163
|
-
placement = "center";
|
|
164
|
-
alignment = "top";
|
|
118
|
+
// Create Popper instance if not already existing
|
|
119
|
+
if (!this.popper) {
|
|
120
|
+
this.popper = createPopper(this.element, this.tooltip, {
|
|
121
|
+
// Set tooltip priority to be placed on top first
|
|
122
|
+
placement: "top",
|
|
123
|
+
modifiers: [
|
|
124
|
+
"flip", // Changes the side of the tooltip if there isnt space
|
|
125
|
+
"preventOverflow",
|
|
126
|
+
{
|
|
127
|
+
name: "offset",
|
|
128
|
+
options: {
|
|
129
|
+
offset: [0, 12], // Adjust offset as needed
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
});
|
|
165
134
|
}
|
|
166
135
|
|
|
167
|
-
//
|
|
168
|
-
this.
|
|
169
|
-
this.tooltip.style.left = x;
|
|
170
|
-
|
|
171
|
-
// set class for placement on arrow
|
|
172
|
-
this.arrow.classList.remove(
|
|
173
|
-
`${this.prefix}--tooltip--arrow--placement-${this.placement}`
|
|
174
|
-
);
|
|
175
|
-
this.arrow.classList.add(
|
|
176
|
-
`${this.prefix}--tooltip--arrow--placement-${this.placement}`
|
|
177
|
-
);
|
|
178
|
-
this.placement = placement;
|
|
179
|
-
this.arrow.setAttribute("data-placement", placement);
|
|
180
|
-
|
|
181
|
-
// set class for alignment on tooltip
|
|
182
|
-
this.tooltip.classList.remove(
|
|
183
|
-
`${this.prefix}--tooltip--alignment-${this.alignment}`
|
|
184
|
-
);
|
|
185
|
-
this.tooltip.classList.add(
|
|
186
|
-
`${this.prefix}--tooltip--alignment-${this.alignment}`
|
|
187
|
-
);
|
|
188
|
-
this.alignment = alignment;
|
|
189
|
-
|
|
190
|
-
this.tooltip.setAttribute("data-alignment", alignment);
|
|
136
|
+
// Update Popper position
|
|
137
|
+
this.popper.update();
|
|
191
138
|
}
|
|
192
139
|
|
|
193
140
|
return this;
|
|
194
141
|
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Set max width and add class based on content length
|
|
145
|
+
*
|
|
146
|
+
* @param {string} content - Tooltip content
|
|
147
|
+
*/
|
|
148
|
+
setMaxWidthAndClass(tooltip) {
|
|
149
|
+
const tooltipText = tooltip.textContent || tooltip.innerText;
|
|
150
|
+
const textLength = tooltipText.trim().length;
|
|
151
|
+
|
|
152
|
+
if (textLength > 50) {
|
|
153
|
+
this.tooltip.classList.add(`${this.prefix}--tooltip--long`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
195
156
|
}
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
{% if not icon or icon == "false" %}
|
|
8
8
|
{{ children|raw }}
|
|
9
9
|
{% endif %}
|
|
10
|
-
<span class="{{prefix}}--tooltip {{prefix}}--tooltip--{{theme}}" data-alignment="left"
|
|
11
|
-
<span class="{{prefix}}--tooltip--arrow {{prefix}}--tooltip--arrow--placement-negative" data-placement="negative" role="presentation"></span>
|
|
10
|
+
<span data-id={{tooltipId}} id="tooltip" role="tooltip" class="{{prefix}}--tooltip {{prefix}}--tooltip--{{theme}}" data-alignment="left" >
|
|
11
|
+
<span data-popper-arrow class="{{prefix}}--tooltip--arrow {{prefix}}--tooltip--arrow--placement-negative" data-placement="negative" role="presentation"></span>
|
|
12
12
|
{{label}}
|
|
13
13
|
</span>
|
|
14
14
|
</div>
|