@ilo-org/twig 0.2.12 → 0.2.14
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/.eslintrc.js +37 -49
- package/.stylelintrc +2 -6
- package/.turbo/turbo-build:lib.log +4 -3
- package/CHANGELOG.md +19 -0
- package/apps/storybook/assets.js +5 -0
- package/apps/storybook/config/prefix.yml +1 -0
- package/apps/storybook/main.js +18 -8
- package/apps/storybook/manager-head.html +63 -1
- package/apps/storybook/manager.js +2 -2
- package/apps/storybook/patterns/colors.stories.mdx +9 -4
- package/apps/storybook/patterns/intro.stories.mdx +47 -42
- package/apps/storybook/patterns/typeset.stories.mdx +10 -6
- package/apps/storybook/patterns/welcome.stories.mdx +21 -37
- package/apps/storybook/preview-body.html +1 -1
- package/apps/storybook/preview.js +16 -16
- package/apps/storybook/styles.scss +25 -1
- package/apps/storybook/theme.js +41 -6
- package/babel.config.js +3 -3
- package/images/hero.jpg +0 -0
- package/images/ilo-dg.jpg +0 -0
- package/images/ilo-headquarters.jpg +0 -0
- package/images/large.jpg +0 -0
- package/images/media-file-poster.jpg +0 -0
- package/images/medium.jpg +0 -0
- package/images/small.jpg +0 -0
- package/images/video-example.mp4 +0 -0
- package/images/youtube-video-poster.avif +0 -0
- package/importprefix.js +5 -5
- package/importsvgs.js +3 -3
- package/jest.config.js +8 -8
- package/outputtwigs.js +16 -13
- package/package.json +47 -56
- package/postcss.config.js +2 -2
- package/src/namespaces.js +5 -5
- package/src/patterns/components/accordion/accordion-item.wingsuit.yml +1 -1
- package/src/patterns/components/accordion/accordion.behavior.js +2 -2
- package/src/patterns/components/accordion/accordion.js +31 -21
- package/src/patterns/components/accordion/accordion.stories.jsx +4 -2
- package/src/patterns/components/accordion/accordion.wingsuit.yml +4 -3
- package/src/patterns/components/accordion/index.js +3 -3
- package/src/patterns/components/breadcrumb/breadcrumb.behavior.js +2 -2
- package/src/patterns/components/breadcrumb/breadcrumb.js +14 -12
- package/src/patterns/components/breadcrumb/breadcrumb.stories.jsx +4 -2
- package/src/patterns/components/breadcrumb/breadcrumb.wingsuit.yml +1 -1
- package/src/patterns/components/breadcrumb/index.js +3 -3
- package/src/patterns/components/button/button.stories.jsx +4 -2
- package/src/patterns/components/button/button.wingsuit.yml +12 -12
- package/src/patterns/components/button/index.js +2 -2
- package/src/patterns/components/callout/callout.behavior.js +2 -2
- package/src/patterns/components/callout/callout.js +18 -13
- package/src/patterns/components/callout/callout.stories.jsx +4 -2
- package/src/patterns/components/callout/callout.wingsuit.yml +2 -2
- package/src/patterns/components/callout/index.js +3 -3
- package/src/patterns/components/card/card.stories.jsx +4 -2
- package/src/patterns/components/card/card.wingsuit.yml +73 -65
- package/src/patterns/components/card/index.js +2 -2
- package/src/patterns/components/cardgroup/cardgroup.stories.jsx +4 -2
- package/src/patterns/components/cardgroup/cardgroup.wingsuit.yml +61 -61
- package/src/patterns/components/cardgroup/index.js +2 -2
- package/src/patterns/components/contextmenu/contextmenu.stories.jsx +4 -2
- package/src/patterns/components/contextmenu/contextmenu.wingsuit.yml +7 -7
- package/src/patterns/components/contextmenu/index.js +2 -2
- package/src/patterns/components/dropdown/dropdown.stories.jsx +4 -2
- package/src/patterns/components/dropdown/dropdown.wingsuit.yml +4 -4
- package/src/patterns/components/dropdown/index.js +2 -2
- package/src/patterns/components/footer/footer.stories.jsx +4 -2
- package/src/patterns/components/footer/footer.wingsuit.yml +1 -1
- package/src/patterns/components/footer/index.js +2 -2
- package/src/patterns/components/form/fileupload.behavior.js +2 -2
- package/src/patterns/components/form/fileupload.js +6 -5
- package/src/patterns/components/form/form.stories.jsx +4 -2
- package/src/patterns/components/form/form.wingsuit.yml +92 -92
- package/src/patterns/components/form/index.js +3 -3
- package/src/patterns/components/hero/hero.stories.jsx +4 -2
- package/src/patterns/components/hero/hero.wingsuit.yml +8 -8
- package/src/patterns/components/hero/index.js +2 -2
- package/src/patterns/components/herocard/herocard.stories.jsx +4 -2
- package/src/patterns/components/herocard/herocard.wingsuit.yml +5 -5
- package/src/patterns/components/herocard/index.js +2 -2
- package/src/patterns/components/icon/index.js +2 -2
- package/src/patterns/components/image/image.stories.jsx +4 -2
- package/src/patterns/components/image/image.wingsuit.yml +9 -9
- package/src/patterns/components/image/index.js +2 -2
- package/src/patterns/components/link/index.js +2 -2
- package/src/patterns/components/link/link.stories.jsx +4 -2
- package/src/patterns/components/link/link.wingsuit.yml +3 -3
- package/src/patterns/components/linklist/index.js +2 -2
- package/src/patterns/components/linklist/linklist.stories.jsx +4 -2
- package/src/patterns/components/linklist/linklist.wingsuit.yml +15 -15
- package/src/patterns/components/list/index.js +2 -2
- package/src/patterns/components/list/list-item.wingsuit.yml +1 -1
- package/src/patterns/components/list/list.stories.jsx +4 -2
- package/src/patterns/components/list/list.wingsuit.yml +4 -4
- package/src/patterns/components/loading/index.js +3 -3
- package/src/patterns/components/loading/loading.behavior.js +2 -2
- package/src/patterns/components/loading/loading.js +2 -2
- package/src/patterns/components/loading/loading.stories.jsx +4 -2
- package/src/patterns/components/loading/loading.wingsuit.yml +5 -5
- package/src/patterns/components/localnav/index.js +3 -3
- package/src/patterns/components/localnav/localnav.stories.jsx +4 -2
- package/src/patterns/components/localnav/localnav.twig +3 -1
- package/src/patterns/components/localnav/localnav.wingsuit.yml +17 -19
- package/src/patterns/components/modal/index.js +3 -3
- package/src/patterns/components/modal/modal.behavior.js +2 -2
- package/src/patterns/components/modal/modal.js +9 -7
- package/src/patterns/components/modal/modal.stories.jsx +5 -2
- package/src/patterns/components/modal/modal.wingsuit.yml +20 -20
- package/src/patterns/components/navigation/index.js +3 -3
- package/src/patterns/components/navigation/navigation.behavior.js +2 -2
- package/src/patterns/components/navigation/navigation.js +110 -37
- package/src/patterns/components/navigation/navigation.stories.jsx +5 -2
- package/src/patterns/components/navigation/navigation.wingsuit.yml +21 -21
- package/src/patterns/components/notification/index.js +3 -3
- package/src/patterns/components/notification/notification.behavior.js +3 -3
- package/src/patterns/components/notification/notification.js +4 -2
- package/src/patterns/components/notification/notification.stories.jsx +5 -2
- package/src/patterns/components/notification/notification.wingsuit.yml +7 -7
- package/src/patterns/components/pagination/Pagination.stories.jsx +4 -2
- package/src/patterns/components/pagination/index.js +2 -2
- package/src/patterns/components/pagination/pagination.wingsuit.yml +12 -12
- package/src/patterns/components/polyfill/index.js +2 -2
- package/src/patterns/components/profile/index.js +2 -2
- package/src/patterns/components/profile/profile.stories.jsx +5 -2
- package/src/patterns/components/profile/profile.wingsuit.yml +7 -7
- package/src/patterns/components/readmore/index.js +3 -3
- package/src/patterns/components/readmore/readmore.behavior.js +2 -2
- package/src/patterns/components/readmore/readmore.js +4 -2
- package/src/patterns/components/readmore/readmore.stories.jsx +5 -2
- package/src/patterns/components/readmore/readmore.wingsuit.yml +4 -4
- package/src/patterns/components/richtext/index.js +2 -2
- package/src/patterns/components/richtext/richtext.stories.jsx +5 -2
- package/src/patterns/components/richtext/richtext.wingsuit.yml +2 -2
- package/src/patterns/components/searchfield/index.js +2 -2
- package/src/patterns/components/searchfield/searchfield.stories.jsx +5 -2
- package/src/patterns/components/searchfield/searchfield.wingsuit.yml +1 -1
- package/src/patterns/components/table/index.js +3 -3
- package/src/patterns/components/table/table.behavior.js +2 -2
- package/src/patterns/components/table/table.js +66 -44
- package/src/patterns/components/table/table.stories.jsx +5 -2
- package/src/patterns/components/table/table.wingsuit.yml +11 -21
- package/src/patterns/components/tableofcontents/index.js +3 -3
- package/src/patterns/components/tableofcontents/tableofcontents.behavior.js +2 -2
- package/src/patterns/components/tableofcontents/tableofcontents.js +27 -19
- package/src/patterns/components/tableofcontents/tableofcontents.stories.jsx +5 -2
- package/src/patterns/components/tableofcontents/tableofcontents.wingsuit.yml +14 -14
- package/src/patterns/components/tabs/index.js +3 -3
- package/src/patterns/components/tabs/tabs.behavior.js +4 -4
- package/src/patterns/components/tabs/tabs.js +12 -8
- package/src/patterns/components/tabs/tabs.stories.jsx +5 -2
- package/src/patterns/components/tabs/tabs.wingsuit.yml +121 -121
- package/src/patterns/components/tags/index.js +3 -3
- package/src/patterns/components/tags/tag.behavior.js +2 -2
- package/src/patterns/components/tags/tag.js +12 -12
- package/src/patterns/components/tags/tag.stories.jsx +5 -2
- package/src/patterns/components/tags/tag.wingsuit.yml +3 -3
- package/src/patterns/components/tags/tags.wingsuit.yml +1 -1
- package/src/patterns/components/tooltip/index.js +3 -3
- package/src/patterns/components/tooltip/tooltip.behavior.js +2 -2
- package/src/patterns/components/tooltip/tooltip.js +35 -25
- package/src/patterns/components/tooltip/tooltip.stories.jsx +5 -2
- package/src/patterns/components/tooltip/tooltip.wingsuit.yml +4 -4
- package/src/patterns/components/video/index.js +3 -3
- package/src/patterns/components/video/video.behavior.js +2 -2
- package/src/patterns/components/video/video.js +6 -5
- package/src/patterns/components/video/video.stories.jsx +5 -2
- package/src/patterns/components/video/video.wingsuit.yml +12 -12
- package/src/vendorjs/lib.vendor.js +1 -1
- package/wingsuit.config.js +14 -13
- package/.editorconfig +0 -12
- package/.eslintignore +0 -11
- package/.prettierignore +0 -16
- package/.prettierrc.js +0 -13
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
tableofcontents:
|
|
2
|
-
use:
|
|
2
|
+
use: "@components/tableofcontents/tableofcontents.twig"
|
|
3
3
|
label: Table Of Contents
|
|
4
4
|
description: A component for displaying links internal to a page
|
|
5
5
|
fields:
|
|
@@ -8,10 +8,10 @@ tableofcontents:
|
|
|
8
8
|
label: Open Button
|
|
9
9
|
description: The label and settings for the button that will show the table of contents at small breakpoints
|
|
10
10
|
preview:
|
|
11
|
-
size:
|
|
12
|
-
type:
|
|
13
|
-
label:
|
|
14
|
-
className:
|
|
11
|
+
size: "medium"
|
|
12
|
+
type: "secondary"
|
|
13
|
+
label: "Open Button"
|
|
14
|
+
className: "toc--modal--open"
|
|
15
15
|
opensmodal: true
|
|
16
16
|
required: true
|
|
17
17
|
closebutton:
|
|
@@ -19,13 +19,13 @@ tableofcontents:
|
|
|
19
19
|
label: Close Button
|
|
20
20
|
description: Label and settings for the "close" button
|
|
21
21
|
preview:
|
|
22
|
-
size:
|
|
23
|
-
type:
|
|
24
|
-
label:
|
|
22
|
+
size: "large"
|
|
23
|
+
type: "tertiary"
|
|
24
|
+
label: "Close Button"
|
|
25
25
|
icon: close
|
|
26
26
|
iconPos: center
|
|
27
27
|
icononly: true
|
|
28
|
-
className:
|
|
28
|
+
className: "toc--modal--close"
|
|
29
29
|
headline:
|
|
30
30
|
type: string
|
|
31
31
|
label: Headline
|
|
@@ -39,13 +39,13 @@ tableofcontents:
|
|
|
39
39
|
required: true
|
|
40
40
|
preview:
|
|
41
41
|
- label: "Item One"
|
|
42
|
-
href:
|
|
42
|
+
href: "#example"
|
|
43
43
|
- label: "Item Two"
|
|
44
|
-
href:
|
|
44
|
+
href: "#example"
|
|
45
45
|
- label: "Item Three"
|
|
46
|
-
href:
|
|
46
|
+
href: "#example"
|
|
47
47
|
- label: "Item Four"
|
|
48
|
-
href:
|
|
48
|
+
href: "#example"
|
|
49
49
|
- label: "Item Five"
|
|
50
|
-
href:
|
|
50
|
+
href: "#example"
|
|
51
51
|
visibility: storybook
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Tabs from
|
|
2
|
-
import Tooltip from
|
|
1
|
+
import Tabs from "./tabs";
|
|
2
|
+
import Tooltip from "../tooltip/tooltip";
|
|
3
3
|
|
|
4
4
|
Drupal.behaviors.tabs = {
|
|
5
5
|
attach() {
|
|
@@ -7,7 +7,7 @@ Drupal.behaviors.tabs = {
|
|
|
7
7
|
document.querySelectorAll(`[data-loadcomponent="Tabs"]`),
|
|
8
8
|
(element) => {
|
|
9
9
|
// eslint-disable-next-line no-console
|
|
10
|
-
console.log(
|
|
10
|
+
console.log("loading Tabs component....");
|
|
11
11
|
new Tabs(element);
|
|
12
12
|
}
|
|
13
13
|
);
|
|
@@ -15,7 +15,7 @@ Drupal.behaviors.tabs = {
|
|
|
15
15
|
document.querySelectorAll(`[data-loadcomponent="Tooltip"]`),
|
|
16
16
|
(element) => {
|
|
17
17
|
// eslint-disable-next-line no-console
|
|
18
|
-
console.log(
|
|
18
|
+
console.log("loading Tooltip component....");
|
|
19
19
|
new Tooltip(element);
|
|
20
20
|
}
|
|
21
21
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EVENTS, ARIA } from
|
|
1
|
+
import { EVENTS, ARIA } from "@ilo-org/utils";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The Tabs module which handles rendering field labels inline on a form.
|
|
@@ -52,7 +52,9 @@ export default class Tabs {
|
|
|
52
52
|
* The button for toggling Read More state
|
|
53
53
|
* @type {Object}
|
|
54
54
|
*/
|
|
55
|
-
this.tabButtons = this.element.querySelectorAll(
|
|
55
|
+
this.tabButtons = this.element.querySelectorAll(
|
|
56
|
+
`.${this.prefix}--tabs--selection--button`
|
|
57
|
+
);
|
|
56
58
|
this.tabPanels = this.element.querySelectorAll('[role="tabpanel"]');
|
|
57
59
|
this.firstTab;
|
|
58
60
|
|
|
@@ -81,7 +83,7 @@ export default class Tabs {
|
|
|
81
83
|
* @chainable
|
|
82
84
|
*/
|
|
83
85
|
enable() {
|
|
84
|
-
this.element.classList.add(
|
|
86
|
+
this.element.classList.add("tabs--js");
|
|
85
87
|
|
|
86
88
|
Array.from(this.tabButtons).forEach((button) => {
|
|
87
89
|
button.addEventListener(EVENTS.CLICK, (e) => this.OnClickHandler(e));
|
|
@@ -122,22 +124,22 @@ export default class Tabs {
|
|
|
122
124
|
console.log(e.key);
|
|
123
125
|
|
|
124
126
|
switch (e.key) {
|
|
125
|
-
case
|
|
127
|
+
case "ArrowLeft":
|
|
126
128
|
this.setSelectedToPreviousTab(tabid);
|
|
127
129
|
flag = true;
|
|
128
130
|
break;
|
|
129
131
|
|
|
130
|
-
case
|
|
132
|
+
case "ArrowRight":
|
|
131
133
|
this.setSelectedToNextTab(tabid);
|
|
132
134
|
flag = true;
|
|
133
135
|
break;
|
|
134
136
|
|
|
135
|
-
case
|
|
137
|
+
case "Home":
|
|
136
138
|
this.selectTab(this.firstTab.id);
|
|
137
139
|
flag = true;
|
|
138
140
|
break;
|
|
139
141
|
|
|
140
|
-
case
|
|
142
|
+
case "End":
|
|
141
143
|
this.selectTab(this.lastTab.id);
|
|
142
144
|
flag = true;
|
|
143
145
|
break;
|
|
@@ -161,7 +163,9 @@ export default class Tabs {
|
|
|
161
163
|
* @chainable
|
|
162
164
|
*/
|
|
163
165
|
selectTab(tabid) {
|
|
164
|
-
const selectedTab = this.element.querySelector(
|
|
166
|
+
const selectedTab = this.element.querySelector(
|
|
167
|
+
`[${ARIA.CONTROLS}="${tabid}"]`
|
|
168
|
+
);
|
|
165
169
|
Array.from(this.tabPanels).forEach((panel) => {
|
|
166
170
|
panel.setAttribute(ARIA.EXPANDED, false);
|
|
167
171
|
});
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./index";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default {};
|
|
4
|
+
const patternDefinition = require("./tabs.wingsuit.yml");
|
|
4
5
|
|
|
6
|
+
/* eslint-disable-next-line */
|
|
7
|
+
/* eslint-disable-next-line */
|
|
5
8
|
export const wingsuit = {
|
|
6
9
|
patternDefinition,
|
|
7
10
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
tabs:
|
|
2
|
-
use:
|
|
2
|
+
use: "@components/tabs/tabs.twig"
|
|
3
3
|
label: Tabs
|
|
4
4
|
description: The Tabs component displays content that is subdivided into sections, providing an interface for toggling visually between sections
|
|
5
5
|
fields:
|
|
@@ -8,25 +8,25 @@ tabs:
|
|
|
8
8
|
label: Items
|
|
9
9
|
description: The items and labels for each tab
|
|
10
10
|
preview:
|
|
11
|
-
- label:
|
|
12
|
-
component:
|
|
11
|
+
- label: "Tab Label With A Really Really Lenghty Title Even Though We Do Not Recommend Such A Lengthy Title"
|
|
12
|
+
component: "image"
|
|
13
13
|
componentdata:
|
|
14
|
-
alt:
|
|
15
|
-
caption:
|
|
16
|
-
credit:
|
|
14
|
+
alt: "My alt text"
|
|
15
|
+
caption: "Women construction workers in Nepal build roads and bridges as part of a National Rural Transport Programme co-sponsored by the ILO."
|
|
16
|
+
credit: "© Marcel Crozet/ILO"
|
|
17
17
|
url:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- label:
|
|
27
|
-
component:
|
|
18
|
+
- breakpoint: 0
|
|
19
|
+
src: "/images/small.jpg"
|
|
20
|
+
- breakpoint: 800
|
|
21
|
+
src: "/images/medium.jpg"
|
|
22
|
+
- breakpoint: 1200
|
|
23
|
+
src: "/images/large.jpg"
|
|
24
|
+
- breakpoint: 1440
|
|
25
|
+
src: "/images/large.jpg"
|
|
26
|
+
- label: "Tab Label 2"
|
|
27
|
+
component: "richtext"
|
|
28
28
|
componentdata:
|
|
29
|
-
content: "<
|
|
29
|
+
content: "<h2>International Labour Organization</h2> <p>The <b>International Labour Organization</b> (<b>ILO</b>) is a <a href='https://www.un.org'>United Nations</a> agency whose mandate is to advance social and economic justice by setting international labour standards. Founded in October 1919 under the League of Nations, it is the first and oldest specialised agency of the UN. The ILO has 187 member states: 186 out of 193 UN member states plus the Cook Islands.</p> <p>Whereas also the failure of any nation to adopt humane conditions of labour is an obstacle in the way of other nations which desire to improve the conditions in their own countries.</p> <figure><img alt='placeholder image' class='right' src='/images/ilo-headquarters.jpg'><figcaption>The ILO's headquarters in Geneva, Switzerland. ©Steiner SA</figcaption></figure> <h3>ILO Constitution</h3> <p>The driving forces for the ILO's creation arose from security, humanitarian, political and economic considerations.</p> <blockquote> <p>The fundamental ideas that forged the ILO one hundred and three years ago still underpin the global pledge to leave no one behind.</p> <cite>ILO Director-General Gilbert F. Houngbo</cite> </blockquote> Reflecting these ideas, the Preamble of the ILO Constitution states:</p> <ol> <li>Whereas universal and lasting peace can be established only if it is based upon social justice;</li> <li>And whereas conditions of labour exist involving such injustice, hardship and privation to large numbers of people as to produce unrest so great that the peace and harmony of the world are imperilled; and an improvement of those conditions is urgently required;</li> <li>Whereas also the failure of any nation to adopt humane conditions of labour is an obstacle in the way of other nations which desire to improve the conditions in their own countries.</li> </ol>"
|
|
30
30
|
required: true
|
|
31
31
|
variants:
|
|
32
32
|
default:
|
|
@@ -37,132 +37,132 @@ tabs:
|
|
|
37
37
|
description: Tabs with Icons
|
|
38
38
|
fields:
|
|
39
39
|
items:
|
|
40
|
-
- label:
|
|
41
|
-
component:
|
|
40
|
+
- label: "Tab One"
|
|
41
|
+
component: "image"
|
|
42
42
|
componentdata:
|
|
43
|
-
alt:
|
|
44
|
-
caption:
|
|
45
|
-
credit:
|
|
43
|
+
alt: "My alt text"
|
|
44
|
+
caption: "my image caption"
|
|
45
|
+
credit: "Photo: copyright 2022 Person S. Name"
|
|
46
46
|
url:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
- breakpoint: 0
|
|
48
|
+
src: "https://place-hold.it/400x300?text=Tab One Image"
|
|
49
|
+
- breakpoint: 800
|
|
50
|
+
src: "https://place-hold.it/800x600?text=Tab One tImage"
|
|
51
|
+
- breakpoint: 1200
|
|
52
|
+
src: "https://place-hold.it/1200x900?text=Tab One Image"
|
|
53
|
+
- breakpoint: 1440
|
|
54
|
+
src: "https://place-hold.it/1600x1200?text=Tab One Image"
|
|
55
55
|
icon: error
|
|
56
|
-
- label:
|
|
57
|
-
component:
|
|
56
|
+
- label: "Tab Two"
|
|
57
|
+
component: "image"
|
|
58
58
|
componentdata:
|
|
59
|
-
alt:
|
|
60
|
-
caption:
|
|
61
|
-
credit:
|
|
59
|
+
alt: "My alt text"
|
|
60
|
+
caption: "my image caption"
|
|
61
|
+
credit: "Photo: copyright 2022 Person S. Name"
|
|
62
62
|
url:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
- breakpoint: 0
|
|
64
|
+
src: "https://place-hold.it/400x300?text=Tab Two Image"
|
|
65
|
+
- breakpoint: 800
|
|
66
|
+
src: "https://place-hold.it/800x600?text=Tab Two Image"
|
|
67
|
+
- breakpoint: 1200
|
|
68
|
+
src: "https://place-hold.it/1200x900?text=Tab Two Image"
|
|
69
|
+
- breakpoint: 1440
|
|
70
|
+
src: "https://place-hold.it/1600x1200?text=Tab Two Image"
|
|
71
71
|
icon: error
|
|
72
|
-
- label:
|
|
73
|
-
component:
|
|
72
|
+
- label: "Tab Three"
|
|
73
|
+
component: "image"
|
|
74
74
|
componentdata:
|
|
75
|
-
alt:
|
|
76
|
-
caption:
|
|
77
|
-
credit:
|
|
75
|
+
alt: "My alt text"
|
|
76
|
+
caption: "my image caption"
|
|
77
|
+
credit: "Photo: copyright 2022 Person S. Name"
|
|
78
78
|
url:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
- breakpoint: 0
|
|
80
|
+
src: "https://place-hold.it/400x300?text=Tab Three Image"
|
|
81
|
+
- breakpoint: 800
|
|
82
|
+
src: "https://place-hold.it/800x600?text=Tab Three Image"
|
|
83
|
+
- breakpoint: 1200
|
|
84
|
+
src: "https://place-hold.it/1200x900?text=Tab Three Image"
|
|
85
|
+
- breakpoint: 1440
|
|
86
|
+
src: "https://place-hold.it/1600x1200?text=Tab Three Image"
|
|
87
87
|
icon: error
|
|
88
88
|
fiveitems:
|
|
89
89
|
label: Five Items
|
|
90
90
|
description: Tab component with five items
|
|
91
91
|
fields:
|
|
92
92
|
items:
|
|
93
|
-
- label:
|
|
94
|
-
component:
|
|
93
|
+
- label: "Tab One"
|
|
94
|
+
component: "image"
|
|
95
95
|
componentdata:
|
|
96
|
-
alt:
|
|
97
|
-
caption:
|
|
98
|
-
credit:
|
|
96
|
+
alt: "My alt text"
|
|
97
|
+
caption: "my image caption"
|
|
98
|
+
credit: "Photo: copyright 2022 Person S. Name"
|
|
99
99
|
url:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
- label:
|
|
109
|
-
component:
|
|
100
|
+
- breakpoint: 0
|
|
101
|
+
src: "https://place-hold.it/400x300?text=Tab One Image"
|
|
102
|
+
- breakpoint: 800
|
|
103
|
+
src: "https://place-hold.it/800x600?text=Tab One tImage"
|
|
104
|
+
- breakpoint: 1200
|
|
105
|
+
src: "https://place-hold.it/1200x900?text=Tab One Image"
|
|
106
|
+
- breakpoint: 1440
|
|
107
|
+
src: "https://place-hold.it/1600x1200?text=Tab One Image"
|
|
108
|
+
- label: "Tab Two"
|
|
109
|
+
component: "image"
|
|
110
110
|
componentdata:
|
|
111
|
-
alt:
|
|
112
|
-
caption:
|
|
113
|
-
credit:
|
|
111
|
+
alt: "My alt text"
|
|
112
|
+
caption: "my image caption"
|
|
113
|
+
credit: "Photo: copyright 2022 Person S. Name"
|
|
114
114
|
url:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
- label:
|
|
124
|
-
component:
|
|
115
|
+
- breakpoint: 0
|
|
116
|
+
src: "https://place-hold.it/400x300?text=Tab Two Image"
|
|
117
|
+
- breakpoint: 800
|
|
118
|
+
src: "https://place-hold.it/800x600?text=Tab Two Image"
|
|
119
|
+
- breakpoint: 1200
|
|
120
|
+
src: "https://place-hold.it/1200x900?text=Tab Two Image"
|
|
121
|
+
- breakpoint: 1440
|
|
122
|
+
src: "https://place-hold.it/1600x1200?text=Tab Two Image"
|
|
123
|
+
- label: "Tab Three"
|
|
124
|
+
component: "image"
|
|
125
125
|
componentdata:
|
|
126
|
-
alt:
|
|
127
|
-
caption:
|
|
128
|
-
credit:
|
|
126
|
+
alt: "My alt text"
|
|
127
|
+
caption: "my image caption"
|
|
128
|
+
credit: "Photo: copyright 2022 Person S. Name"
|
|
129
129
|
url:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
- label:
|
|
139
|
-
component:
|
|
130
|
+
- breakpoint: 0
|
|
131
|
+
src: "https://place-hold.it/400x300?text=Tab Three Image"
|
|
132
|
+
- breakpoint: 800
|
|
133
|
+
src: "https://place-hold.it/800x600?text=Tab Three Image"
|
|
134
|
+
- breakpoint: 1200
|
|
135
|
+
src: "https://place-hold.it/1200x900?text=Tab Three Image"
|
|
136
|
+
- breakpoint: 1440
|
|
137
|
+
src: "https://place-hold.it/1600x1200?text=Tab Three Image"
|
|
138
|
+
- label: "Tab Four Has A Really Lenghthy Title Which Might Get Truncated"
|
|
139
|
+
component: "image"
|
|
140
140
|
componentdata:
|
|
141
|
-
alt:
|
|
142
|
-
caption:
|
|
143
|
-
credit:
|
|
141
|
+
alt: "My alt text"
|
|
142
|
+
caption: "my image caption"
|
|
143
|
+
credit: "Photo: copyright 2022 Person S. Name"
|
|
144
144
|
url:
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
- label:
|
|
154
|
-
component:
|
|
145
|
+
- breakpoint: 0
|
|
146
|
+
src: "https://place-hold.it/400x300?text=Tab Four Image"
|
|
147
|
+
- breakpoint: 800
|
|
148
|
+
src: "https://place-hold.it/800x600?text=Tab Four Image"
|
|
149
|
+
- breakpoint: 1200
|
|
150
|
+
src: "https://place-hold.it/1200x900?text=Tab Four Image"
|
|
151
|
+
- breakpoint: 1440
|
|
152
|
+
src: "https://place-hold.it/1600x1200?text=Tab Four Image"
|
|
153
|
+
- label: "Tab Five"
|
|
154
|
+
component: "image"
|
|
155
155
|
componentdata:
|
|
156
|
-
alt:
|
|
157
|
-
caption:
|
|
158
|
-
credit:
|
|
156
|
+
alt: "My alt text"
|
|
157
|
+
caption: "my image caption"
|
|
158
|
+
credit: "Photo: copyright 2022 Person S. Name"
|
|
159
159
|
url:
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
160
|
+
- breakpoint: 0
|
|
161
|
+
src: "https://place-hold.it/400x300?text=Tab Five Image"
|
|
162
|
+
- breakpoint: 800
|
|
163
|
+
src: "https://place-hold.it/800x600?text=Tab Five Image"
|
|
164
|
+
- breakpoint: 1200
|
|
165
|
+
src: "https://place-hold.it/1200x900?text=Tab Five Image"
|
|
166
|
+
- breakpoint: 1440
|
|
167
|
+
src: "https://place-hold.it/1600x1200?text=Tab Five Image"
|
|
168
168
|
visibility: storybook
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Tag from
|
|
1
|
+
import Tag from "./tag";
|
|
2
2
|
|
|
3
3
|
Drupal.behaviors.tag = {
|
|
4
4
|
attach() {
|
|
@@ -6,7 +6,7 @@ Drupal.behaviors.tag = {
|
|
|
6
6
|
document.querySelectorAll(`[data-loadcomponent="Tag"]`),
|
|
7
7
|
(element) => {
|
|
8
8
|
// eslint-disable-next-line no-console
|
|
9
|
-
console.log(
|
|
9
|
+
console.log("loading Tag component....");
|
|
10
10
|
new Tag(element);
|
|
11
11
|
}
|
|
12
12
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getUpdatedItems, EVENTS
|
|
1
|
+
import { getUpdatedItems, EVENTS } from "@ilo-org/utils";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The Tag module which handles rendering field labels inline on a form.
|
|
@@ -50,13 +50,13 @@ export default class Tag {
|
|
|
50
50
|
* The field that a user interacts with on a form
|
|
51
51
|
* @type {Object}
|
|
52
52
|
*/
|
|
53
|
-
this.buttonTags = this.element.querySelectorAll(
|
|
54
|
-
this.multipleActive = this.element.getAttribute(
|
|
53
|
+
this.buttonTags = this.element.querySelectorAll(".ilo--tag--button");
|
|
54
|
+
this.multipleActive = this.element.getAttribute("data-multipleactive");
|
|
55
55
|
|
|
56
56
|
this.buttonTags.forEach((button, i) => {
|
|
57
|
-
const expanded = button.dataset[
|
|
58
|
-
const id = this.buttonTags[i].getAttribute(
|
|
59
|
-
if (expanded ===
|
|
57
|
+
const expanded = button.dataset["active"];
|
|
58
|
+
const id = this.buttonTags[i].getAttribute("id");
|
|
59
|
+
if (expanded === "true") {
|
|
60
60
|
this.itemStatuses = getUpdatedItems({
|
|
61
61
|
id,
|
|
62
62
|
itemStatuses: this.itemStatuses,
|
|
@@ -104,7 +104,7 @@ export default class Tag {
|
|
|
104
104
|
* @chainable
|
|
105
105
|
*/
|
|
106
106
|
onClick(i) {
|
|
107
|
-
const id = this.buttonTags[i].getAttribute(
|
|
107
|
+
const id = this.buttonTags[i].getAttribute("id");
|
|
108
108
|
|
|
109
109
|
this.itemStatuses = getUpdatedItems({
|
|
110
110
|
id,
|
|
@@ -144,14 +144,14 @@ export default class Tag {
|
|
|
144
144
|
*/
|
|
145
145
|
updateTagItems() {
|
|
146
146
|
this.tags.forEach((item, i) => {
|
|
147
|
-
const id = item.getAttribute(
|
|
147
|
+
const id = item.getAttribute("id");
|
|
148
148
|
const open = this.itemStatuses.indexOf(id) > -1;
|
|
149
149
|
if (open) {
|
|
150
|
-
this.tags[i].classList.add(
|
|
151
|
-
this.tags[i].setAttribute(
|
|
150
|
+
this.tags[i].classList.add("ilo--tag--active");
|
|
151
|
+
this.tags[i].setAttribute("data-active", "true");
|
|
152
152
|
} else {
|
|
153
|
-
this.tags[i].classList.remove(
|
|
154
|
-
this.tags[i].setAttribute(
|
|
153
|
+
this.tags[i].classList.remove("ilo--tag--active");
|
|
154
|
+
this.tags[i].setAttribute("data-active", "true");
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
157
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./index";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default {};
|
|
4
|
+
const patternDefinition = require("./tags.wingsuit.yml");
|
|
4
5
|
|
|
6
|
+
/* eslint-disable-next-line */
|
|
7
|
+
/* eslint-disable-next-line */
|
|
5
8
|
export const wingsuit = {
|
|
6
9
|
patternDefinition,
|
|
7
10
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
tag:
|
|
2
|
-
use:
|
|
2
|
+
use: "@components/tags/tag.twig"
|
|
3
3
|
label: Tag
|
|
4
4
|
description: A display or interactable tag
|
|
5
5
|
fields:
|
|
@@ -18,10 +18,10 @@ tag:
|
|
|
18
18
|
url:
|
|
19
19
|
type: text
|
|
20
20
|
label: URL
|
|
21
|
-
description: The tag's url reference
|
|
21
|
+
description: The tag's url reference
|
|
22
22
|
preview:
|
|
23
23
|
faker: https://www.google.com/
|
|
24
|
-
settings:
|
|
24
|
+
settings:
|
|
25
25
|
defaultActive:
|
|
26
26
|
type: select
|
|
27
27
|
label: Default Active
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Tooltip from
|
|
1
|
+
import Tooltip from "./tooltip";
|
|
2
2
|
|
|
3
3
|
Drupal.behaviors.tooltip = {
|
|
4
4
|
attach() {
|
|
@@ -6,7 +6,7 @@ Drupal.behaviors.tooltip = {
|
|
|
6
6
|
document.querySelectorAll(`[data-loadcomponent="Tooltip"]`),
|
|
7
7
|
(element) => {
|
|
8
8
|
// eslint-disable-next-line no-console
|
|
9
|
-
console.log(
|
|
9
|
+
console.log("loading Tooltip component....");
|
|
10
10
|
new Tooltip(element);
|
|
11
11
|
}
|
|
12
12
|
);
|