@ilo-org/twig 0.0.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.
- package/.browserslistrc +4 -0
- package/.editorconfig +12 -0
- package/.eslintignore +11 -0
- package/.eslintrc.js +66 -0
- package/.prettierignore +16 -0
- package/.prettierrc.js +13 -0
- package/.stylelintignore +9 -0
- package/.stylelintrc +23 -0
- package/.turbo/turbo-build.log +15313 -0
- package/LICENSE +201 -0
- package/README.md +23 -0
- package/apps/storybook/assets.js +5 -0
- package/apps/storybook/config/prefix.yml +1 -0
- package/apps/storybook/main.js +16 -0
- package/apps/storybook/manager.js +7 -0
- package/apps/storybook/patterns/colors.stories.mdx +18 -0
- package/apps/storybook/patterns/typeset.stories.mdx +28 -0
- package/apps/storybook/patterns/welcome.stories.mdx +24 -0
- package/apps/storybook/preview-body.html +4 -0
- package/apps/storybook/preview-head.html +11 -0
- package/apps/storybook/preview.js +38 -0
- package/apps/storybook/styles.scss +2 -0
- package/apps/storybook/theme.js +11 -0
- package/babel.config.js +16 -0
- package/contributing.md +5 -0
- package/importprefix.js +18 -0
- package/importsvgs.js +5 -0
- package/jest.config.js +18 -0
- package/outputtwigs.js +54 -0
- package/package.json +108 -0
- package/postcss.config.js +6 -0
- package/src/namespaces.js +14 -0
- package/src/patterns/components/accordion/accordion-item.twig +16 -0
- package/src/patterns/components/accordion/accordion-item.wingsuit.yml +30 -0
- package/src/patterns/components/accordion/accordion.behavior.js +14 -0
- package/src/patterns/components/accordion/accordion.js +178 -0
- package/src/patterns/components/accordion/accordion.stories.jsx +7 -0
- package/src/patterns/components/accordion/accordion.twig +17 -0
- package/src/patterns/components/accordion/accordion.wingsuit.yml +59 -0
- package/src/patterns/components/accordion/index.js +7 -0
- package/src/patterns/components/breadcrumb/breadcrumb.behavior.js +14 -0
- package/src/patterns/components/breadcrumb/breadcrumb.js +93 -0
- package/src/patterns/components/breadcrumb/breadcrumb.stories.jsx +7 -0
- package/src/patterns/components/breadcrumb/breadcrumb.twig +32 -0
- package/src/patterns/components/breadcrumb/breadcrumb.wingsuit.yml +35 -0
- package/src/patterns/components/breadcrumb/index.js +7 -0
- package/src/patterns/components/button/button.stories.jsx +7 -0
- package/src/patterns/components/button/button.twig +18 -0
- package/src/patterns/components/button/button.wingsuit.yml +104 -0
- package/src/patterns/components/button/index.js +6 -0
- package/src/patterns/components/callout/callout.behaviors.js +14 -0
- package/src/patterns/components/callout/callout.js +121 -0
- package/src/patterns/components/callout/callout.stories.jsx +7 -0
- package/src/patterns/components/callout/callout.twig +30 -0
- package/src/patterns/components/callout/callout.wingsuit.yml +66 -0
- package/src/patterns/components/callout/index.js +6 -0
- package/src/patterns/components/card/card.stories.jsx +7 -0
- package/src/patterns/components/card/card.twig +98 -0
- package/src/patterns/components/card/card.wingsuit.yml +300 -0
- package/src/patterns/components/card/index.js +6 -0
- package/src/patterns/components/cardgroup/cardgroup.stories.jsx +7 -0
- package/src/patterns/components/cardgroup/cardgroup.twig +30 -0
- package/src/patterns/components/cardgroup/cardgroup.wingsuit.yml +419 -0
- package/src/patterns/components/cardgroup/index.js +6 -0
- package/src/patterns/components/contextmenu/contextmenu.stories.jsx +7 -0
- package/src/patterns/components/contextmenu/contextmenu.twig +12 -0
- package/src/patterns/components/contextmenu/contextmenu.wingsuit.yml +23 -0
- package/src/patterns/components/contextmenu/index.js +6 -0
- package/src/patterns/components/dropdown/dropdown.stories.jsx +7 -0
- package/src/patterns/components/dropdown/dropdown.twig +20 -0
- package/src/patterns/components/dropdown/dropdown.wingsuit.yml +71 -0
- package/src/patterns/components/dropdown/index.js +6 -0
- package/src/patterns/components/fieldset/fieldset.twig +43 -0
- package/src/patterns/components/footer/footer.stories.jsx +7 -0
- package/src/patterns/components/footer/footer.twig +62 -0
- package/src/patterns/components/footer/footer.wingsuit.yml +104 -0
- package/src/patterns/components/footer/index.js +6 -0
- package/src/patterns/components/form/checkbox.twig +13 -0
- package/src/patterns/components/form/checkboxgroup.twig +5 -0
- package/src/patterns/components/form/datepicker.twig +32 -0
- package/src/patterns/components/form/file.twig +14 -0
- package/src/patterns/components/form/fileupload.behavior.js +14 -0
- package/src/patterns/components/form/fileupload.js +118 -0
- package/src/patterns/components/form/form.stories.jsx +7 -0
- package/src/patterns/components/form/form.twig +94 -0
- package/src/patterns/components/form/form.wingsuit.yml +973 -0
- package/src/patterns/components/form/index.js +7 -0
- package/src/patterns/components/form/input.twig +13 -0
- package/src/patterns/components/form/number.twig +13 -0
- package/src/patterns/components/form/radio.twig +4 -0
- package/src/patterns/components/form/textarea.twig +13 -0
- package/src/patterns/components/hero/hero.stories.jsx +7 -0
- package/src/patterns/components/hero/hero.twig +24 -0
- package/src/patterns/components/hero/hero.wingsuit.yml +56 -0
- package/src/patterns/components/hero/index.js +6 -0
- package/src/patterns/components/herocard/herocard.stories.jsx +7 -0
- package/src/patterns/components/herocard/herocard.twig +31 -0
- package/src/patterns/components/herocard/herocard.wingsuit.yml +43 -0
- package/src/patterns/components/herocard/index.js +6 -0
- package/src/patterns/components/icon/icon.twig +4 -0
- package/src/patterns/components/icon/index.js +6 -0
- package/src/patterns/components/image/image.stories.jsx +7 -0
- package/src/patterns/components/image/image.twig +19 -0
- package/src/patterns/components/image/image.wingsuit.yml +37 -0
- package/src/patterns/components/image/index.js +6 -0
- package/src/patterns/components/link/index.js +6 -0
- package/src/patterns/components/link/link.stories.jsx +7 -0
- package/src/patterns/components/link/link.twig +8 -0
- package/src/patterns/components/link/link.wingsuit.yml +35 -0
- package/src/patterns/components/linklist/index.js +6 -0
- package/src/patterns/components/linklist/linklist.stories.jsx +7 -0
- package/src/patterns/components/linklist/linklist.twig +26 -0
- package/src/patterns/components/linklist/linklist.wingsuit.yml +53 -0
- package/src/patterns/components/list/index.js +6 -0
- package/src/patterns/components/list/list-item.twig +6 -0
- package/src/patterns/components/list/list-item.wingsuit.yml +18 -0
- package/src/patterns/components/list/list.stories.jsx +7 -0
- package/src/patterns/components/list/list.twig +30 -0
- package/src/patterns/components/list/list.wingsuit.yml +48 -0
- package/src/patterns/components/loading/index.js +7 -0
- package/src/patterns/components/loading/loading.behavior.js +14 -0
- package/src/patterns/components/loading/loading.js +102 -0
- package/src/patterns/components/loading/loading.stories.jsx +7 -0
- package/src/patterns/components/loading/loading.twig +8 -0
- package/src/patterns/components/loading/loading.wingsuit.yml +37 -0
- package/src/patterns/components/modal/index.js +7 -0
- package/src/patterns/components/modal/modal.behavior.js +14 -0
- package/src/patterns/components/modal/modal.js +130 -0
- package/src/patterns/components/modal/modal.stories.jsx +7 -0
- package/src/patterns/components/modal/modal.twig +18 -0
- package/src/patterns/components/modal/modal.wingsuit.yml +54 -0
- package/src/patterns/components/notification/index.js +7 -0
- package/src/patterns/components/notification/notification.behavior.js +15 -0
- package/src/patterns/components/notification/notification.js +95 -0
- package/src/patterns/components/notification/notification.stories.jsx +7 -0
- package/src/patterns/components/notification/notification.twig +18 -0
- package/src/patterns/components/notification/notification.wingsuit.yml +58 -0
- package/src/patterns/components/pagination/Pagination.stories.jsx +7 -0
- package/src/patterns/components/pagination/index.js +6 -0
- package/src/patterns/components/pagination/pagination.twig +48 -0
- package/src/patterns/components/pagination/pagination.wingsuit.yml +72 -0
- package/src/patterns/components/polyfill/index.js +6 -0
- package/src/patterns/components/polyfill/polyfill.twig +10 -0
- package/src/patterns/components/profile/index.js +6 -0
- package/src/patterns/components/profile/profile.stories.jsx +7 -0
- package/src/patterns/components/profile/profile.twig +18 -0
- package/src/patterns/components/profile/profile.wingsuit.yml +35 -0
- package/src/patterns/components/readmore/index.js +7 -0
- package/src/patterns/components/readmore/readmore.behavior.js +14 -0
- package/src/patterns/components/readmore/readmore.js +119 -0
- package/src/patterns/components/readmore/readmore.stories.jsx +7 -0
- package/src/patterns/components/readmore/readmore.twig +16 -0
- package/src/patterns/components/readmore/readmore.wingsuit.yml +32 -0
- package/src/patterns/components/richtext/index.js +6 -0
- package/src/patterns/components/richtext/richtext.stories.jsx +7 -0
- package/src/patterns/components/richtext/richtext.twig +6 -0
- package/src/patterns/components/richtext/richtext.wingsuit.yml +12 -0
- package/src/patterns/components/searchfield/index.js +6 -0
- package/src/patterns/components/searchfield/searchfield.stories.jsx +7 -0
- package/src/patterns/components/searchfield/searchfield.twig +7 -0
- package/src/patterns/components/searchfield/searchfield.wingsuit.yml +22 -0
- package/src/patterns/components/table/index.js +7 -0
- package/src/patterns/components/table/table.behavior.js +14 -0
- package/src/patterns/components/table/table.js +279 -0
- package/src/patterns/components/table/table.stories.jsx +7 -0
- package/src/patterns/components/table/table.twig +36 -0
- package/src/patterns/components/table/table.wingsuit.yml +112 -0
- package/src/patterns/components/tableofcontents/index.js +6 -0
- package/src/patterns/components/tableofcontents/tableofcontents.stories.jsx +7 -0
- package/src/patterns/components/tableofcontents/tableofcontents.twig +14 -0
- package/src/patterns/components/tableofcontents/tableofcontents.wingsuit.yml +22 -0
- package/src/patterns/components/tabs/index.js +7 -0
- package/src/patterns/components/tabs/tabs.behavior.js +23 -0
- package/src/patterns/components/tabs/tabs.js +209 -0
- package/src/patterns/components/tabs/tabs.stories.jsx +7 -0
- package/src/patterns/components/tabs/tabs.twig +30 -0
- package/src/patterns/components/tabs/tabs.wingsuit.yml +168 -0
- package/src/patterns/components/tag/index.js +7 -0
- package/src/patterns/components/tag/tag-set.twig +15 -0
- package/src/patterns/components/tag/tag.behavior.js +14 -0
- package/src/patterns/components/tag/tag.stories.jsx +7 -0
- package/src/patterns/components/tag/tag.twig +24 -0
- package/src/patterns/components/tag/tag.wingsuit.yml +43 -0
- package/src/patterns/components/tag/tagset.js +160 -0
- package/src/patterns/components/tag/tagset.wingsuit.yml +43 -0
- package/src/patterns/components/tooltip/index.js +7 -0
- package/src/patterns/components/tooltip/tooltip.behavior.js +14 -0
- package/src/patterns/components/tooltip/tooltip.js +184 -0
- package/src/patterns/components/tooltip/tooltip.stories.jsx +7 -0
- package/src/patterns/components/tooltip/tooltip.twig +11 -0
- package/src/patterns/components/tooltip/tooltip.wingsuit.yml +30 -0
- package/src/patterns/components/video/index.js +7 -0
- package/src/patterns/components/video/video.behavior.js +14 -0
- package/src/patterns/components/video/video.js +114 -0
- package/src/patterns/components/video/video.stories.jsx +7 -0
- package/src/patterns/components/video/video.twig +17 -0
- package/src/patterns/components/video/video.wingsuit.yml +44 -0
- package/src/patterns/components/video/videoplayer.twig +10 -0
- package/src/tokens/exports/_colors.scss +7 -0
- package/src/tokens/exports/_font-families.scss +6 -0
- package/src/tokens/exports/_font-sizes-heading.scss +10 -0
- package/src/tokens/index.scss +7 -0
- package/src/vendorjs/lib.vendor.js +1 -0
- package/wingsuit.config.js +27 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { EVENTS, ARIA } from '@ilo-org/utils';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The Tabs module which handles rendering field labels inline on a form.
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* @class Tabs
|
|
8
|
+
*/
|
|
9
|
+
export default class Tabs {
|
|
10
|
+
/**
|
|
11
|
+
* Tabs constructor which assigns the element passed into the constructor
|
|
12
|
+
* to the `this.element` property for later reference
|
|
13
|
+
*
|
|
14
|
+
* @param {HTMLElement} element - REQUIRED - the module's container
|
|
15
|
+
*/
|
|
16
|
+
constructor(element) {
|
|
17
|
+
/**
|
|
18
|
+
* Reference to the DOM element that is the root of the component
|
|
19
|
+
* @property {Object}
|
|
20
|
+
*/
|
|
21
|
+
this.element = element;
|
|
22
|
+
|
|
23
|
+
// get the theme prefix
|
|
24
|
+
this.prefix = this.element.dataset.prefix;
|
|
25
|
+
|
|
26
|
+
// Initialize the view
|
|
27
|
+
this.init();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Initializes the view by calling the functions to
|
|
32
|
+
* create DOM references, setup event handlers and
|
|
33
|
+
* then create the event listeners
|
|
34
|
+
*
|
|
35
|
+
* @return {Object} Tabs A reference to the instance of the class
|
|
36
|
+
* @chainable
|
|
37
|
+
*/
|
|
38
|
+
init() {
|
|
39
|
+
this.cacheDomReferences().setupHandlers().enable();
|
|
40
|
+
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Find all necessary DOM elements used in the view and cache them
|
|
46
|
+
*
|
|
47
|
+
* @return {Object} ReadMore A reference to the instance of the class
|
|
48
|
+
* @chainable
|
|
49
|
+
*/
|
|
50
|
+
cacheDomReferences() {
|
|
51
|
+
/**
|
|
52
|
+
* The button for toggling Read More state
|
|
53
|
+
* @type {Object}
|
|
54
|
+
*/
|
|
55
|
+
this.tabButtons = this.element.querySelectorAll(`.${this.prefix}--tabs--selection--button`);
|
|
56
|
+
this.tabPanels = this.element.querySelectorAll('[role="tabpanel"]');
|
|
57
|
+
this.firstTab;
|
|
58
|
+
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Bind event handlers with the proper context of `this`.
|
|
64
|
+
*
|
|
65
|
+
* @return {Object} Tabs A reference to the current instance of the class
|
|
66
|
+
* @chainable
|
|
67
|
+
*/
|
|
68
|
+
setupHandlers() {
|
|
69
|
+
this.OnClickHandler = this.onClick.bind(this);
|
|
70
|
+
this.KeyPressHandler = this.onKeyPress.bind(this);
|
|
71
|
+
this.OnPrevHandler = this.setSelectedToPreviousTab.bind(this);
|
|
72
|
+
this.OnNextHandler = this.setSelectedToNextTab.bind(this);
|
|
73
|
+
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Creates event listeners to enable interaction with view
|
|
79
|
+
*
|
|
80
|
+
* @return {Object} Tabs A reference to the instance of the class
|
|
81
|
+
* @chainable
|
|
82
|
+
*/
|
|
83
|
+
enable() {
|
|
84
|
+
this.element.classList.add('tabs--js');
|
|
85
|
+
|
|
86
|
+
Array.from(this.tabButtons).forEach((button) => {
|
|
87
|
+
button.addEventListener(EVENTS.CLICK, (e) => this.OnClickHandler(e));
|
|
88
|
+
button.addEventListener(EVENTS.KEY_DOWN, (e) => this.KeyPressHandler(e));
|
|
89
|
+
|
|
90
|
+
if (!this.firstTab) {
|
|
91
|
+
this.firstTab = button.getAttribute(ARIA.CONTROLS);
|
|
92
|
+
}
|
|
93
|
+
this.lastTab = button.getAttribute(ARIA.CONTROLS);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
return this;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Actions performed on click of a tab
|
|
101
|
+
*
|
|
102
|
+
* @return {Object} Modal A reference to the instance of the class
|
|
103
|
+
* @chainable
|
|
104
|
+
*/
|
|
105
|
+
onClick(e) {
|
|
106
|
+
e.preventDefault();
|
|
107
|
+
const tabid = e.currentTarget.getAttribute(ARIA.CONTROLS);
|
|
108
|
+
this.selectTab(tabid);
|
|
109
|
+
|
|
110
|
+
return this;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Actions performed on key press
|
|
115
|
+
*
|
|
116
|
+
* @return {Object} Modal A reference to the instance of the class
|
|
117
|
+
* @chainable
|
|
118
|
+
*/
|
|
119
|
+
onKeyPress(e) {
|
|
120
|
+
let flag = false;
|
|
121
|
+
const tabid = e.currentTarget.getAttribute(ARIA.CONTROLS);
|
|
122
|
+
console.log(e.key);
|
|
123
|
+
|
|
124
|
+
switch (e.key) {
|
|
125
|
+
case 'ArrowLeft':
|
|
126
|
+
this.setSelectedToPreviousTab(tabid);
|
|
127
|
+
flag = true;
|
|
128
|
+
break;
|
|
129
|
+
|
|
130
|
+
case 'ArrowRight':
|
|
131
|
+
this.setSelectedToNextTab(tabid);
|
|
132
|
+
flag = true;
|
|
133
|
+
break;
|
|
134
|
+
|
|
135
|
+
case 'Home':
|
|
136
|
+
this.selectTab(this.firstTab.id);
|
|
137
|
+
flag = true;
|
|
138
|
+
break;
|
|
139
|
+
|
|
140
|
+
case 'End':
|
|
141
|
+
this.selectTab(this.lastTab.id);
|
|
142
|
+
flag = true;
|
|
143
|
+
break;
|
|
144
|
+
|
|
145
|
+
default:
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (flag) {
|
|
150
|
+
e.stopPropagation();
|
|
151
|
+
e.preventDefault();
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return this;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Selects the chosen tab
|
|
159
|
+
*
|
|
160
|
+
* @return {Object} Modal A reference to the instance of the class
|
|
161
|
+
* @chainable
|
|
162
|
+
*/
|
|
163
|
+
selectTab(tabid) {
|
|
164
|
+
const selectedTab = this.element.querySelector(`[${ARIA.CONTROLS}="${tabid}"]`);
|
|
165
|
+
Array.from(this.tabPanels).forEach((panel) => {
|
|
166
|
+
panel.setAttribute(ARIA.EXPANDED, false);
|
|
167
|
+
});
|
|
168
|
+
Array.from(this.tabButtons).forEach((button) => {
|
|
169
|
+
button.setAttribute(ARIA.SELECTED, false);
|
|
170
|
+
});
|
|
171
|
+
selectedTab.focus();
|
|
172
|
+
selectedTab.setAttribute(ARIA.SELECTED, true);
|
|
173
|
+
document.getElementById(tabid).setAttribute(ARIA.EXPANDED, true);
|
|
174
|
+
|
|
175
|
+
return this;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Selects the previous tab in the list of tabs
|
|
180
|
+
*
|
|
181
|
+
* @return {Object} Modal A reference to the instance of the class
|
|
182
|
+
* @chainable
|
|
183
|
+
*/
|
|
184
|
+
setSelectedToPreviousTab(tabid) {
|
|
185
|
+
const prevTab =
|
|
186
|
+
document.getElementById(tabid).previousElementSibling !== null
|
|
187
|
+
? document.getElementById(tabid).previousElementSibling
|
|
188
|
+
: document.getElementById(this.lastTab);
|
|
189
|
+
this.selectTab(prevTab.id);
|
|
190
|
+
|
|
191
|
+
return this;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Selects the previous tab in the list of tabs
|
|
196
|
+
*
|
|
197
|
+
* @return {Object} Modal A reference to the instance of the class
|
|
198
|
+
* @chainable
|
|
199
|
+
*/
|
|
200
|
+
setSelectedToNextTab(tabid) {
|
|
201
|
+
const nextTab =
|
|
202
|
+
document.getElementById(tabid).nextElementSibling !== null
|
|
203
|
+
? document.getElementById(tabid).nextElementSibling
|
|
204
|
+
: document.getElementById(this.firstTab);
|
|
205
|
+
this.selectTab(nextTab.id);
|
|
206
|
+
|
|
207
|
+
return this;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{#
|
|
2
|
+
TABS COMPONENT
|
|
3
|
+
#}
|
|
4
|
+
{% set uid = "now"|date('Uv') %}
|
|
5
|
+
{% set tabids = [] %}
|
|
6
|
+
{% for item in items %}
|
|
7
|
+
{% set tabids = tabids|merge([random(100000)]) %}
|
|
8
|
+
{% endfor %}
|
|
9
|
+
|
|
10
|
+
<div class="{{prefix}}--tabs" data-prefix="{{prefix}}" id="tabs--{{uid}}" data-loadcomponent="Tabs">
|
|
11
|
+
<ul class="{{prefix}}--tabs--selection" aria-controls="tabs--{{uid}}" role="tablist" style="--tabscount: {{items|length}};">
|
|
12
|
+
{% for item in items %}
|
|
13
|
+
<li class="{{prefix}}--tabs--selection--item">
|
|
14
|
+
<a href="#tab--{{tabids[loop.index - 1]}}" class="{{prefix}}--tabs--selection--button{% if item.icon is defined %} icon{% endif %}" role="tab" aria-controls="tab--{{tabids[loop.index - 1]}}" tabindex="0" aria-selected="{% if loop.index == 1 %}true{% else %}false{% endif %}" title="{{item.label}}">
|
|
15
|
+
<span class="{{prefix}}--tabs--selection--label">{{item.label}}</span>
|
|
16
|
+
{% if item.icon is defined %}
|
|
17
|
+
{% include '@components/icon/icon.twig' with {icon: item.icon} %}
|
|
18
|
+
{% endif %}
|
|
19
|
+
</a>
|
|
20
|
+
</li>
|
|
21
|
+
{% endfor %}
|
|
22
|
+
</ul>
|
|
23
|
+
<div class="{{prefix}}--tabs--content">
|
|
24
|
+
{% for item in items %}
|
|
25
|
+
<div id="tab--{{tabids[loop.index - 1]}}" role="tabpanel" aria-expanded="{% if loop.index == 1 %}true{% else %}false{% endif %}">
|
|
26
|
+
{% include '@components/' ~ item.component ~ '/' ~ item.component ~ '.twig' with item.componentdata %}
|
|
27
|
+
</div>
|
|
28
|
+
{% endfor %}
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
tabs:
|
|
2
|
+
use: '@components/tabs/tabs.twig'
|
|
3
|
+
label: Tabs
|
|
4
|
+
description: The Tabs component displays content that is subdivided into sections, providing an interface for toggling visually between sections
|
|
5
|
+
fields:
|
|
6
|
+
items:
|
|
7
|
+
type: object
|
|
8
|
+
label: Items
|
|
9
|
+
description: The items and labels for each tab
|
|
10
|
+
preview:
|
|
11
|
+
- label: 'Tab Label With A Really Really Lenghty Title Even Though We Do Not Recommend Such A Lengthy Title'
|
|
12
|
+
component: 'image'
|
|
13
|
+
componentdata:
|
|
14
|
+
alt: 'My alt text'
|
|
15
|
+
caption: 'my image caption'
|
|
16
|
+
credit: 'Photo: copyright 2022 Person S. Name'
|
|
17
|
+
url:
|
|
18
|
+
- breakpoint: 0
|
|
19
|
+
src: 'https://place-hold.it/400x300?text=SmallBreakpointImage'
|
|
20
|
+
- breakpoint: 800
|
|
21
|
+
src: 'https://place-hold.it/800x600?text=MediumBreakpointImage'
|
|
22
|
+
- breakpoint: 1200
|
|
23
|
+
src: 'https://place-hold.it/1200x900?text=LargeBreakpointImage'
|
|
24
|
+
- breakpoint: 1440
|
|
25
|
+
src: 'https://place-hold.it/1600x1200?text=LargestBreakpointImage'
|
|
26
|
+
- label: 'Tab Label 2'
|
|
27
|
+
component: 'richtext'
|
|
28
|
+
componentdata:
|
|
29
|
+
content: "<h1>Apollo 11</h1><p><strong>Apollo 11</strong> was the spaceflight that landed the first humans, Americans <a href='http://en.wikipedia.org/wiki/Neil_Armstrong'>Neil Armstrong</a> and <a href='http://en.wikipedia.org/wiki/Buzz_Aldrin'>Buzz Aldrin</a>, on the Moon on July 20, 1969, at 20:18 UTC. Armstrong became the first to step onto the lunar surface 6 hours later on July 21 at 02:56 UTC.</p><p>Armstrong spent about <s>three and a half</s> two and a half hours outside the spacecraft, Aldrin slightly less; and together they collected 47.5 pounds (21.5 kg) of lunar material for return to Earth. A third member of the mission, <a href='http://en.wikipedia.org/wiki/Michael_Collins_(astronaut)'>Michael Collins</a>, piloted the <a href='http://en.wikipedia.org/wiki/Apollo_Command/Service_Module'>command</a> spacecraft alone in lunar orbit until Armstrong and Aldrin returned to it for the trip back to Earth. <figure><img alt='placeholder image' class='right' src='https://place-hold.it/400x300?text=Placeholder Image'><figcaption>The caption for this image</figcaption></figure></p><h2>Broadcasting and <em>quotes</em> <a id='quotes' name='quotes'></a></h2><p>Broadcast on live TV to a world-wide audience, Armstrong stepped onto the lunar surface and described the event as:</p><blockquote><p>One small step for [a] man, one giant leap for mankind</p><cite>Neil Armstrong</cite></blockquote><h2>Technical details <a id='tech-details' name='tech-details'></a></h2><p>Launched by a <strong>Saturn V</strong> rocket from <a href='http://en.wikipedia.org/wiki/Kennedy_Space_Center'>Kennedy Space Center</a> in Merritt Island, Florida on July 16, Apollo 11 was the fifth manned mission of <a href='http://en.wikipedia.org/wiki/NASA'>NASA</a>'s Apollo program. The Apollo spacecraft had three parts:</p><ol><li><strong>Command Module</strong> with a cabin for the three astronauts which was the only part which landed back on Earth</li><li><strong>Service Module</strong> which supported the Command Module with propulsion, electrical power, oxygen and water</li><li><strong>Lunar Module</strong> for landing on the Moon.</li></ol><p>After being sent to the Moon by the Saturn V's upper stage, the astronauts separated the spacecraft from it and travelled for three days until they entered into lunar orbit. Armstrong and Aldrin then moved into the Lunar Module and landed in the <a href='http://en.wikipedia.org/wiki/Mare_Tranquillitatis'>Sea of Tranquility</a>. They stayed a total of about 21 and a half hours on the lunar surface. After lifting off in the upper part of the Lunar Module and rejoining Collins in the Command Module, they returned to Earth and landed in the <a href='http://en.wikipedia.org/wiki/Pacific_Ocean'>Pacific Ocean</a> on July 24.</p><hr><p><small>Source: <a href='http://en.wikipedia.org/wiki/Apollo_11'>Wikipedia.org</a></small></p>"
|
|
30
|
+
required: true
|
|
31
|
+
variants:
|
|
32
|
+
default:
|
|
33
|
+
label: Default
|
|
34
|
+
description: the default settings for the Tabs
|
|
35
|
+
withicon:
|
|
36
|
+
label: With Icon
|
|
37
|
+
description: Tabs with Icons
|
|
38
|
+
fields:
|
|
39
|
+
items:
|
|
40
|
+
- label: 'Tab One'
|
|
41
|
+
component: 'image'
|
|
42
|
+
componentdata:
|
|
43
|
+
alt: 'My alt text'
|
|
44
|
+
caption: 'my image caption'
|
|
45
|
+
credit: 'Photo: copyright 2022 Person S. Name'
|
|
46
|
+
url:
|
|
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
|
+
icon: error
|
|
56
|
+
- label: 'Tab Two'
|
|
57
|
+
component: 'image'
|
|
58
|
+
componentdata:
|
|
59
|
+
alt: 'My alt text'
|
|
60
|
+
caption: 'my image caption'
|
|
61
|
+
credit: 'Photo: copyright 2022 Person S. Name'
|
|
62
|
+
url:
|
|
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
|
+
icon: error
|
|
72
|
+
- label: 'Tab Three'
|
|
73
|
+
component: 'image'
|
|
74
|
+
componentdata:
|
|
75
|
+
alt: 'My alt text'
|
|
76
|
+
caption: 'my image caption'
|
|
77
|
+
credit: 'Photo: copyright 2022 Person S. Name'
|
|
78
|
+
url:
|
|
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
|
+
icon: error
|
|
88
|
+
fiveitems:
|
|
89
|
+
label: Five Items
|
|
90
|
+
description: Tab component with five items
|
|
91
|
+
fields:
|
|
92
|
+
items:
|
|
93
|
+
- label: 'Tab One'
|
|
94
|
+
component: 'image'
|
|
95
|
+
componentdata:
|
|
96
|
+
alt: 'My alt text'
|
|
97
|
+
caption: 'my image caption'
|
|
98
|
+
credit: 'Photo: copyright 2022 Person S. Name'
|
|
99
|
+
url:
|
|
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
|
+
componentdata:
|
|
111
|
+
alt: 'My alt text'
|
|
112
|
+
caption: 'my image caption'
|
|
113
|
+
credit: 'Photo: copyright 2022 Person S. Name'
|
|
114
|
+
url:
|
|
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
|
+
componentdata:
|
|
126
|
+
alt: 'My alt text'
|
|
127
|
+
caption: 'my image caption'
|
|
128
|
+
credit: 'Photo: copyright 2022 Person S. Name'
|
|
129
|
+
url:
|
|
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
|
+
componentdata:
|
|
141
|
+
alt: 'My alt text'
|
|
142
|
+
caption: 'my image caption'
|
|
143
|
+
credit: 'Photo: copyright 2022 Person S. Name'
|
|
144
|
+
url:
|
|
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
|
+
componentdata:
|
|
156
|
+
alt: 'My alt text'
|
|
157
|
+
caption: 'my image caption'
|
|
158
|
+
credit: 'Photo: copyright 2022 Person S. Name'
|
|
159
|
+
url:
|
|
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
|
+
visibility: storybook
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{#
|
|
2
|
+
TAG SET COMPONENT
|
|
3
|
+
#}
|
|
4
|
+
<ul class="ilo--tag-set" data-loadcomponent="Tag" data-multipleactive="{{ allowMultipleActive|default(true) }}">
|
|
5
|
+
{% for item in items %}
|
|
6
|
+
{% include "@components/tag/tag.twig" with {
|
|
7
|
+
content: item.content,
|
|
8
|
+
defaultActive: item.defaultActive,
|
|
9
|
+
id: item.id,
|
|
10
|
+
prefix: prefix,
|
|
11
|
+
tagType: tagType,
|
|
12
|
+
url: item.url|default(null),
|
|
13
|
+
} only %}
|
|
14
|
+
{% endfor %}
|
|
15
|
+
</ul>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Tag from './tagset';
|
|
2
|
+
|
|
3
|
+
Drupal.behaviors.tag = {
|
|
4
|
+
attach() {
|
|
5
|
+
Array.prototype.forEach.call(
|
|
6
|
+
document.querySelectorAll(`[data-loadcomponent="Tag"]`),
|
|
7
|
+
(element) => {
|
|
8
|
+
// eslint-disable-next-line no-console
|
|
9
|
+
console.log('loading Tag component....');
|
|
10
|
+
new Tag(element);
|
|
11
|
+
}
|
|
12
|
+
);
|
|
13
|
+
},
|
|
14
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{#
|
|
2
|
+
TAG COMPONENT
|
|
3
|
+
#}
|
|
4
|
+
{% if tagType == "button" and defaultActive %}
|
|
5
|
+
<li class="{{prefix}}--tag-set__item">
|
|
6
|
+
<button class="{{prefix}}--tag {{prefix}}--tag--button {{prefix}}--tag--active icon__position--right" id="{{ id }}" data-active={{ defaultActive }} type="button">
|
|
7
|
+
{{content}}
|
|
8
|
+
<span class="ilo--icon" title="Remove"></span>
|
|
9
|
+
</button>
|
|
10
|
+
</li>
|
|
11
|
+
{% elseif tagType == "anchor" %}
|
|
12
|
+
<li class="{{prefix}}--tag-set__item">
|
|
13
|
+
<a class="{{prefix}}--tag {{prefix}}--tag--anchor {% if defaultActive %} {{prefix}}--tag--active{% endif %}" href="{{ url }}" id="{{ id }}" data-active={{ defaultActive }}>
|
|
14
|
+
{{content}}
|
|
15
|
+
</a>
|
|
16
|
+
</li>
|
|
17
|
+
{% elseif tagType == "display" %}
|
|
18
|
+
<li class="{{prefix}}--tag-set__item">
|
|
19
|
+
<span class="{{prefix}}--tag {% if defaultActive %} {{prefix}}--tag--active{% endif %}" id="{{ id }}" data-active={{ defaultActive }}>
|
|
20
|
+
{{content}}
|
|
21
|
+
</span>
|
|
22
|
+
</li>
|
|
23
|
+
{% else %}
|
|
24
|
+
{% endif %}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
tag:
|
|
2
|
+
use: '@components/tag/tag.twig'
|
|
3
|
+
label: Tag
|
|
4
|
+
description: A clickable tag
|
|
5
|
+
fields:
|
|
6
|
+
content:
|
|
7
|
+
type: text
|
|
8
|
+
label: Content
|
|
9
|
+
description: The tag item's collapsed content.
|
|
10
|
+
preview:
|
|
11
|
+
faker: lorem.word
|
|
12
|
+
id:
|
|
13
|
+
type: text
|
|
14
|
+
label: ID
|
|
15
|
+
description: The tag item's id.
|
|
16
|
+
preview:
|
|
17
|
+
faker: lorem.word
|
|
18
|
+
url:
|
|
19
|
+
type: text
|
|
20
|
+
label: URL
|
|
21
|
+
description: The tag's url reference
|
|
22
|
+
preview:
|
|
23
|
+
faker: https://www.google.com/
|
|
24
|
+
settings:
|
|
25
|
+
defaultActive:
|
|
26
|
+
type: select
|
|
27
|
+
label: Default Active
|
|
28
|
+
description: The tag loads in an active state
|
|
29
|
+
options:
|
|
30
|
+
true: True
|
|
31
|
+
false: False
|
|
32
|
+
preview: false
|
|
33
|
+
required: false
|
|
34
|
+
tagType:
|
|
35
|
+
type: type
|
|
36
|
+
label: Tag Type
|
|
37
|
+
description: The type of tag
|
|
38
|
+
options:
|
|
39
|
+
anchor: Anchor
|
|
40
|
+
button: Button
|
|
41
|
+
display: Display
|
|
42
|
+
preview: display
|
|
43
|
+
visibility: storybook
|