@ilo-org/twig 0.12.2 → 0.13.0-next.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 +20 -0
- package/package.json +3 -3
- package/src/patterns/components/linklist/index.js +1 -0
- package/src/patterns/components/linklist/linklist.behavior.js +15 -0
- package/src/patterns/components/linklist/linklist.js +55 -0
- package/src/patterns/components/linklist/linklist.twig +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @ilo-org/twig@0.
|
|
2
|
+
> @ilo-org/twig@0.13.0-next.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.13.0-next.0 output /home/runner/work/designsystem/designsystem/packages/twig
|
|
8
8
|
> node outputtwigs.js
|
|
9
9
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @ilo-org/twig
|
|
2
2
|
|
|
3
|
+
## 0.13.0-next.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 39e6bab1f: Implemented functionality for external links to open in new browser tab
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- cf4d43446: added hover effect for anchor item inside indented linked list
|
|
12
|
+
- 3be0a12ac: reduced padding for accordion inner panel
|
|
13
|
+
- Updated dependencies [ed548bcfc]
|
|
14
|
+
- Updated dependencies [bf1ec0843]
|
|
15
|
+
- Updated dependencies [ccdb35c99]
|
|
16
|
+
- Updated dependencies [cf4d43446]
|
|
17
|
+
- Updated dependencies [1794fc434]
|
|
18
|
+
- Updated dependencies [3be0a12ac]
|
|
19
|
+
- Updated dependencies [1e58f9c7d]
|
|
20
|
+
- @ilo-org/styles@0.11.3-next.0
|
|
21
|
+
- @ilo-org/themes@0.7.0-next.0
|
|
22
|
+
|
|
3
23
|
## 0.12.2
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ilo-org/twig",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0-next.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Twig components for the ILO's Design System",
|
|
6
6
|
"main": "",
|
|
@@ -25,8 +25,8 @@
|
|
|
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.11.
|
|
29
|
-
"@ilo-org/themes": "0.
|
|
28
|
+
"@ilo-org/styles": "0.11.3-next.0",
|
|
29
|
+
"@ilo-org/themes": "0.7.0-next.0",
|
|
30
30
|
"@ilo-org/utils": "0.0.11"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import LinkList from "./linklist";
|
|
2
|
+
|
|
3
|
+
Drupal.behaviors.link = {
|
|
4
|
+
attach() {
|
|
5
|
+
Array.prototype.forEach.call(
|
|
6
|
+
document.querySelectorAll(`[data-loadcomponent="LinkList"]`),
|
|
7
|
+
(element) => {
|
|
8
|
+
if (!element.dataset.jsProcessed) {
|
|
9
|
+
new LinkList(element);
|
|
10
|
+
element.dataset.jsProcessed = true;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
},
|
|
15
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export default class LinkList {
|
|
2
|
+
/**
|
|
3
|
+
* LinkList constructor which assigns the element passed into the constructor
|
|
4
|
+
* to the `this.element` property for later reference
|
|
5
|
+
*
|
|
6
|
+
* @param {HTMLElement} element - REQUIRED - the module's container
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
constructor(element) {
|
|
10
|
+
/**
|
|
11
|
+
* Reference to the DOM element that is the root of the component
|
|
12
|
+
* @property {Object}
|
|
13
|
+
*/
|
|
14
|
+
this.element = element;
|
|
15
|
+
|
|
16
|
+
/** element prefix */
|
|
17
|
+
this.prefix = `${this.element.dataset.prefix}--link-list`;
|
|
18
|
+
|
|
19
|
+
this.init();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Initializes the view by calling the functions to
|
|
24
|
+
* create DOM references, setup event handlers and
|
|
25
|
+
* then create the event listeners
|
|
26
|
+
*
|
|
27
|
+
* @return {Object} LinkList A reference to the instance of the class
|
|
28
|
+
* @chainable
|
|
29
|
+
*/
|
|
30
|
+
init() {
|
|
31
|
+
this.append();
|
|
32
|
+
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Appends target="_blank" to all external links in the list
|
|
38
|
+
*
|
|
39
|
+
* @return {Object} LinkList A reference to the current instance of the class
|
|
40
|
+
* @chainable
|
|
41
|
+
*/
|
|
42
|
+
append() {
|
|
43
|
+
const selector = `a:not([target=_blank]).${this.prefix}--link`;
|
|
44
|
+
const links = this.element.querySelectorAll(selector);
|
|
45
|
+
const origin = window.location.origin;
|
|
46
|
+
|
|
47
|
+
for (const link of links) {
|
|
48
|
+
if (new URL(link.href).origin !== origin) {
|
|
49
|
+
link.setAttribute("target", "_blank");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{#
|
|
2
2
|
LINK LIST COMPONENT
|
|
3
3
|
#}
|
|
4
|
-
<div class="{{prefix}}--link-list {{prefix}}--link-list--{{theme}}">
|
|
4
|
+
<div class="{{prefix}}--link-list {{prefix}}--link-list--{{theme}}" data-loadcomponent="LinkList" data-prefix="{{prefix}}">
|
|
5
5
|
{% if headline %}
|
|
6
6
|
<h3 class="{{prefix}}--link-list--headline">{{headline}}</h3>
|
|
7
7
|
{% endif %}
|