@ilo-org/twig 0.2.2 → 0.2.3
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.log +14249 -14249
- package/CHANGELOG.md +15 -0
- package/package.json +5 -5
- package/src/patterns/components/callout/callout.twig +3 -3
- package/src/patterns/components/callout/callout.wingsuit.yml +18 -18
- package/src/patterns/components/card/card.twig +2 -2
- package/src/patterns/components/card/card.wingsuit.yml +11 -66
- package/src/patterns/components/navigation/navigation.js +193 -16
- package/src/patterns/components/tags/tag.twig +6 -0
- package/src/patterns/components/tags/tags.wingsuit.yml +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @ilo-org/twig
|
|
2
2
|
|
|
3
|
+
## 0.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 069cd8eaf: FIxes to cards
|
|
8
|
+
- a76395618: ESC exits out of toggle menus in the nav
|
|
9
|
+
- 8cd74234c: Bugfixes to Tag, Tooltip, Callout, Checkbox, LinkList
|
|
10
|
+
- Updated dependencies [069cd8eaf]
|
|
11
|
+
- Updated dependencies [a76395618]
|
|
12
|
+
- Updated dependencies [8cd74234c]
|
|
13
|
+
- @ilo-org/styles@0.1.8
|
|
14
|
+
- @ilo-org/themes@0.1.8
|
|
15
|
+
- @ilo-org/icons@0.1.8
|
|
16
|
+
- @ilo-org/utils@0.0.4
|
|
17
|
+
|
|
3
18
|
## 0.2.2
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ilo-org/twig",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Twig components for the ILO's Design System",
|
|
6
6
|
"main": "",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@ilo-org/fonts": "0.0.2",
|
|
24
|
-
"@ilo-org/icons": "0.1.
|
|
25
|
-
"@ilo-org/styles": "0.1.
|
|
26
|
-
"@ilo-org/themes": "0.1.
|
|
27
|
-
"@ilo-org/utils": "0.0.
|
|
24
|
+
"@ilo-org/icons": "0.1.8",
|
|
25
|
+
"@ilo-org/styles": "0.1.8",
|
|
26
|
+
"@ilo-org/themes": "0.1.8",
|
|
27
|
+
"@ilo-org/utils": "0.0.4",
|
|
28
28
|
"@wingsuit-designsystem/preset-scss": "^1.2.3",
|
|
29
29
|
"video.js": "^7.19.2"
|
|
30
30
|
},
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{#
|
|
2
2
|
CALLOUT COMPONENT
|
|
3
3
|
#}
|
|
4
|
-
<div class="{{prefix}}--callout {{prefix}}--callout--{{alert}} {% if isOpen %} {{prefix}}--callout--open {% endif %} {% if isCollapsible %} {{prefix}}--callout--collapse {% endif %}" data-loadcomponent="Callout" >
|
|
4
|
+
<div class="{{prefix}}--callout {{prefix}}--callout--{{alert}} {% if isCollapsible == "true" and isOpen == "true" %} {{prefix}}--callout--open {% endif %} {% if isCollapsible == "true" %} {{prefix}}--callout--collapse {% endif %}" data-loadcomponent="Callout" >
|
|
5
5
|
<div class="{{prefix}}--callout--sidebar">
|
|
6
6
|
<span class="{{prefix}}--callout--icon icon icon--{{alert}}"></span>
|
|
7
7
|
</div>
|
|
8
8
|
<div class="{{prefix}}--callout--content">
|
|
9
9
|
<div class="{{prefix}}--callout--header">
|
|
10
10
|
<h5 class="{{prefix}}--callout--title">{{ title }}</h5>
|
|
11
|
-
{% if isCollapsible %}
|
|
11
|
+
{% if isCollapsible == "true" %}
|
|
12
12
|
<button class="{{prefix}}--callout--toggle" type="button" data-open="{{ toggleOpenLabel }}" data-closed="{{ toggleClosedLabel }}">
|
|
13
13
|
<span class="{{prefix}}--callout--button-text">{% if isOpen %}{{ toggleOpenLabel }}{% else %}{{ toggleClosedLabel }}{% endif %}</span>
|
|
14
14
|
<span class="{{prefix}}--callout--toggle--icon" role="presentation"></span>
|
|
@@ -27,4 +27,4 @@
|
|
|
27
27
|
</div>
|
|
28
28
|
{% endif %}
|
|
29
29
|
</div>
|
|
30
|
-
</div>
|
|
30
|
+
</div>
|
|
@@ -15,24 +15,6 @@ callout:
|
|
|
15
15
|
description: The callout's content
|
|
16
16
|
preview:
|
|
17
17
|
faker: lorem.word
|
|
18
|
-
isCollapsible:
|
|
19
|
-
type: select
|
|
20
|
-
label: Is Collapsible
|
|
21
|
-
description: Whether or not the callout is collapsible
|
|
22
|
-
required: false
|
|
23
|
-
options:
|
|
24
|
-
true: True
|
|
25
|
-
false: False
|
|
26
|
-
preview: false
|
|
27
|
-
isOpen:
|
|
28
|
-
type: select
|
|
29
|
-
label: Is Open
|
|
30
|
-
description: Whether or not a collapsible callout is open
|
|
31
|
-
required: false
|
|
32
|
-
options:
|
|
33
|
-
true: True
|
|
34
|
-
false: False
|
|
35
|
-
preview: true
|
|
36
18
|
title:
|
|
37
19
|
type: string
|
|
38
20
|
label: Notification Title
|
|
@@ -63,4 +45,22 @@ callout:
|
|
|
63
45
|
success: Success
|
|
64
46
|
warning: Warning
|
|
65
47
|
preview: 'info'
|
|
48
|
+
isCollapsible:
|
|
49
|
+
type: select
|
|
50
|
+
label: Is Collapsible?
|
|
51
|
+
description: Whether or not the callout is collapsible
|
|
52
|
+
required: true
|
|
53
|
+
options:
|
|
54
|
+
true: True
|
|
55
|
+
false: False
|
|
56
|
+
preview: false
|
|
57
|
+
isOpen:
|
|
58
|
+
type: select
|
|
59
|
+
label: Is Open
|
|
60
|
+
description: Whether or not a collapsible callout is open on page load
|
|
61
|
+
required: false
|
|
62
|
+
options:
|
|
63
|
+
true: True
|
|
64
|
+
false: False
|
|
65
|
+
preview: true
|
|
66
66
|
visibility: storybook
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
{% if type == "" %}
|
|
6
6
|
{% set type = variant %}
|
|
7
7
|
{% endif %}
|
|
8
|
-
{% if link %}
|
|
8
|
+
{% if link and type != 'data' and type != 'factlist' and type != 'stat' %}
|
|
9
9
|
<a class="{{prefix}}--card--link" href="{{link}}" title="{{title}}"><span class="{{prefix}}--card--link--text">{{title}}</span></a>
|
|
10
10
|
{% endif %}
|
|
11
11
|
<div class="{{prefix}}--card--wrap">
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
{% if intro %}
|
|
26
26
|
<p class="{{prefix}}--card--intro">{{intro}}</p>
|
|
27
27
|
{% endif %}
|
|
28
|
-
{% if date %}
|
|
28
|
+
{% if date and type != "stat" and type != "data" and type != "graphicpromo" and type != "stat" and type != "factlist" %}
|
|
29
29
|
<time class="{{prefix}}--card--date" datetime="{{date.unix}}">{{date.human}}</time>
|
|
30
30
|
{% endif %}
|
|
31
31
|
{% if eventdetails %}
|
|
@@ -119,7 +119,6 @@ card:
|
|
|
119
119
|
description: The graphic Card
|
|
120
120
|
fields:
|
|
121
121
|
title: "Brief title text - ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod"
|
|
122
|
-
intro: ""
|
|
123
122
|
eyebrow: Eyebrow title
|
|
124
123
|
date:
|
|
125
124
|
human: 20 September 2022
|
|
@@ -128,13 +127,11 @@ card:
|
|
|
128
127
|
profile:
|
|
129
128
|
avatar: "https://placekitten.com/128/128"
|
|
130
129
|
description: "Firstname Lastname is the Senior Media Strategist. He has been with ILO for eight years."
|
|
131
|
-
link:
|
|
130
|
+
link:
|
|
132
131
|
- label: "Optional Link"
|
|
133
132
|
url: "https://www.google.com"
|
|
134
133
|
name: "Firstname Lastname"
|
|
135
134
|
role: "Senior Media Strategist"
|
|
136
|
-
cta: ""
|
|
137
|
-
eventdetails: ""
|
|
138
135
|
stat:
|
|
139
136
|
label: Stat Card
|
|
140
137
|
description: The stat Card
|
|
@@ -143,17 +140,8 @@ card:
|
|
|
143
140
|
cornercut: cornercut
|
|
144
141
|
fields:
|
|
145
142
|
title: "Date headline"
|
|
146
|
-
image: ""
|
|
147
143
|
intro: "Data title - Lorem ipsum dolor sit amet consectetur"
|
|
148
|
-
|
|
149
|
-
date:
|
|
150
|
-
human: ""
|
|
151
|
-
unix: 1670389200
|
|
152
|
-
link: ""
|
|
153
|
-
profile: ""
|
|
154
|
-
eventdetails: ""
|
|
155
|
-
cta: ""
|
|
156
|
-
source:
|
|
144
|
+
source:
|
|
157
145
|
label: "Source: lorem ipsum dolor sit amet, 2020"
|
|
158
146
|
url: "https://www.google.com/search?q=stat"
|
|
159
147
|
multilink:
|
|
@@ -165,21 +153,9 @@ card:
|
|
|
165
153
|
title: "Multi-link card - right aligned image, wide option"
|
|
166
154
|
image: "https://placekitten.com/475/267"
|
|
167
155
|
intro: "Lorem ipsum dolor sit amet consectetur adipiscing elit. Lobortis egestas ipsum dolor sit amet consectetur adipiscing elit. Lobortis egestas ipsum dolor sit amet consectetur adipiscing elit. Lobortis egestas lacus."
|
|
168
|
-
eyebrow: ""
|
|
169
|
-
date:
|
|
170
|
-
human: ""
|
|
171
|
-
unix: 1670389200
|
|
172
|
-
link: ""
|
|
173
|
-
profile: ""
|
|
174
|
-
eventdetails: ""
|
|
175
|
-
cta: ""
|
|
176
|
-
source: ""
|
|
177
|
-
dataset: ""
|
|
178
156
|
linklist:
|
|
179
|
-
headline: ""
|
|
180
157
|
linkgroup:
|
|
181
|
-
-
|
|
182
|
-
links:
|
|
158
|
+
- links:
|
|
183
159
|
- label: Link One
|
|
184
160
|
url: 'http://www.google.com'
|
|
185
161
|
- label: Link Two
|
|
@@ -191,16 +167,9 @@ card:
|
|
|
191
167
|
description: The graphic promo Card
|
|
192
168
|
fields:
|
|
193
169
|
title: "Brief title text - ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod"
|
|
194
|
-
image: ""
|
|
195
170
|
intro: "We advance social justice and promote decent work by setting labour standards, developing policies and devising programmes."
|
|
196
|
-
eyebrow: ""
|
|
197
|
-
date:
|
|
198
|
-
human: ""
|
|
199
|
-
unix: 1670389200
|
|
200
171
|
link: "https://www.google.com/search?q=graphic-promo"
|
|
201
|
-
|
|
202
|
-
eventdetails: ""
|
|
203
|
-
cta:
|
|
172
|
+
cta:
|
|
204
173
|
label: "Discover our unique mission"
|
|
205
174
|
url: "https://www.google.com/search?q=button"
|
|
206
175
|
feature:
|
|
@@ -208,15 +177,12 @@ card:
|
|
|
208
177
|
description: The Feature Card
|
|
209
178
|
fields:
|
|
210
179
|
title: "Vertical info card descriptive headline text"
|
|
211
|
-
intro: ""
|
|
212
180
|
eyebrow: Eyebrow title
|
|
213
181
|
date:
|
|
214
182
|
human: Date
|
|
215
183
|
unix: 1670389200
|
|
216
184
|
link: "https://www.google.com/search?q=graphic"
|
|
217
185
|
image: "https://placekitten.com/412/232"
|
|
218
|
-
profile:
|
|
219
|
-
eventdetails: ""
|
|
220
186
|
detail:
|
|
221
187
|
label: Detail Card
|
|
222
188
|
description: The Detail Card
|
|
@@ -237,22 +203,11 @@ card:
|
|
|
237
203
|
description: The Fact List Card
|
|
238
204
|
fields:
|
|
239
205
|
title: "Title of fast fact list"
|
|
240
|
-
|
|
241
|
-
eyebrow: ""
|
|
242
|
-
date:
|
|
243
|
-
human: ""
|
|
244
|
-
unix: 1670389200
|
|
245
|
-
link: ""
|
|
246
|
-
image: ""
|
|
247
|
-
profile: ""
|
|
248
|
-
eventdetails: ""
|
|
249
|
-
cta: ""
|
|
250
|
-
list:
|
|
251
|
-
title: ""
|
|
206
|
+
list:
|
|
252
207
|
settings:
|
|
253
208
|
- ordered: unordered
|
|
254
209
|
- alignment: default
|
|
255
|
-
items:
|
|
210
|
+
items:
|
|
256
211
|
- content: "Wipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor."
|
|
257
212
|
id: "list1"
|
|
258
213
|
- content: "Nut labore et dolore magna sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
|
|
@@ -261,27 +216,17 @@ card:
|
|
|
261
216
|
label: Data Card
|
|
262
217
|
description: The Data Card
|
|
263
218
|
fields:
|
|
264
|
-
title: ""
|
|
265
|
-
image: "https://placekitten.com/205/179"
|
|
266
|
-
intro: ""
|
|
267
219
|
eyebrow: "Event details"
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
link: ""
|
|
272
|
-
profile: ""
|
|
273
|
-
eventdetails: ""
|
|
274
|
-
cta: ""
|
|
275
|
-
dataset:
|
|
276
|
-
content:
|
|
277
|
-
items:
|
|
220
|
+
dataset:
|
|
221
|
+
content:
|
|
222
|
+
items:
|
|
278
223
|
- label: Date
|
|
279
224
|
copy: Publication date
|
|
280
225
|
- label: Event type
|
|
281
226
|
copy: Event location
|
|
282
227
|
files:
|
|
283
228
|
headline: Files
|
|
284
|
-
items:
|
|
229
|
+
items:
|
|
285
230
|
- label: File/size MB 1
|
|
286
231
|
url: "https://www.google.com/search?q=file1"
|
|
287
232
|
- label: File/size MB 2
|
|
@@ -290,7 +235,7 @@ card:
|
|
|
290
235
|
url: "https://www.google.com/search?q=file3"
|
|
291
236
|
links:
|
|
292
237
|
headline: Languages
|
|
293
|
-
items:
|
|
238
|
+
items:
|
|
294
239
|
- label: Language link 1
|
|
295
240
|
url: "https://www.google.com/search?q=link"
|
|
296
241
|
- label: Language link 2
|
|
@@ -63,6 +63,7 @@ export default class Navigation {
|
|
|
63
63
|
);
|
|
64
64
|
this.contextLinks = this.element.querySelectorAll(`.${this.prefix}--context-menu--link`);
|
|
65
65
|
this.languageLinks = this.element.querySelectorAll(`.${this.prefix}--nav--language`);
|
|
66
|
+
this.body = document.body;
|
|
66
67
|
|
|
67
68
|
return this;
|
|
68
69
|
}
|
|
@@ -74,15 +75,23 @@ export default class Navigation {
|
|
|
74
75
|
* @chainable
|
|
75
76
|
*/
|
|
76
77
|
setupHandlers() {
|
|
77
|
-
this.
|
|
78
|
+
this.subnavClick = this.handleSubnavClick.bind(this);
|
|
79
|
+
this.subnavClickOff = this.handleSubnavClickOff.bind(this);
|
|
80
|
+
this.subnavClickOn = this.handleSubnavClickOn.bind(this);
|
|
78
81
|
this.subnavBackClick = this.handleSubnavBackClick.bind(this);
|
|
79
82
|
this.menuCloseClick = this.handleMenuCloseClick.bind(this);
|
|
80
83
|
this.menuOpenClick = this.handleMenuOpenClick.bind(this);
|
|
81
|
-
this.searchButtonClick = this.handleSearchButtonClick.bind(this);
|
|
82
|
-
this.contextButtonClick = this.handleContextButtonClick.bind(this);
|
|
83
84
|
this.languageButtonClick = this.handleLanguageButtonClick.bind(this);
|
|
84
85
|
this.contextLinkClick = this.handleContextLinkClick.bind(this);
|
|
85
86
|
this.onResize = this.handleResize.bind(this);
|
|
87
|
+
this.keyPress = this.handleKeyPress.bind(this);
|
|
88
|
+
this.bodyClick = this.removeClass.bind(this);
|
|
89
|
+
this.contextButtonClick = this.handleContextButtonClick.bind(this);
|
|
90
|
+
this.contextButtonClickOff = this.handleContextButtonClickOff.bind(this);
|
|
91
|
+
this.contextButtonClickOn = this.handleContextButtonClickOn.bind(this);
|
|
92
|
+
this.searchButtonClick = this.handleSearchButtonClick.bind(this);
|
|
93
|
+
this.searchButtonClickOff = this.handleSearchButtonClickOff.bind(this);
|
|
94
|
+
this.searchButtonClickOn = this.handleSearchButtonClickOn.bind(this);
|
|
86
95
|
|
|
87
96
|
return this;
|
|
88
97
|
}
|
|
@@ -96,8 +105,8 @@ export default class Navigation {
|
|
|
96
105
|
enable() {
|
|
97
106
|
// subnavButton
|
|
98
107
|
if (this.subnavButton) {
|
|
99
|
-
this.subnavButton.addEventListener(EVENTS.CLICK, () => this.
|
|
100
|
-
this.subnavButton.addEventListener(EVENTS.TOUCH_START, () => this.
|
|
108
|
+
this.subnavButton.addEventListener(EVENTS.CLICK, (e) => this.subnavClick(e));
|
|
109
|
+
this.subnavButton.addEventListener(EVENTS.TOUCH_START, (e) => this.subnavClick(e));
|
|
101
110
|
}
|
|
102
111
|
|
|
103
112
|
// subnavBack
|
|
@@ -110,8 +119,8 @@ export default class Navigation {
|
|
|
110
119
|
|
|
111
120
|
// searchButton
|
|
112
121
|
if (this.searchButton) {
|
|
113
|
-
this.searchButton.addEventListener(EVENTS.CLICK, () => this.searchButtonClick());
|
|
114
|
-
this.searchButton.addEventListener(EVENTS.TOUCH_START, () => this.searchButtonClick());
|
|
122
|
+
this.searchButton.addEventListener(EVENTS.CLICK, (e) => this.searchButtonClick(e));
|
|
123
|
+
this.searchButton.addEventListener(EVENTS.TOUCH_START, (e) => this.searchButtonClick(e));
|
|
115
124
|
}
|
|
116
125
|
// menuCloseSet
|
|
117
126
|
if (this.menuCloseSet.length > 0) {
|
|
@@ -129,8 +138,8 @@ export default class Navigation {
|
|
|
129
138
|
|
|
130
139
|
// contextButton
|
|
131
140
|
if (this.contextButton) {
|
|
132
|
-
this.contextButton.addEventListener(EVENTS.CLICK, () => this.contextButtonClick());
|
|
133
|
-
this.contextButton.addEventListener(EVENTS.TOUCH_START, () => this.contextButtonClick());
|
|
141
|
+
this.contextButton.addEventListener(EVENTS.CLICK, (e) => this.contextButtonClick(e));
|
|
142
|
+
this.contextButton.addEventListener(EVENTS.TOUCH_START, (e) => this.contextButtonClick(e));
|
|
134
143
|
}
|
|
135
144
|
|
|
136
145
|
// languageButton
|
|
@@ -160,6 +169,22 @@ export default class Navigation {
|
|
|
160
169
|
return this;
|
|
161
170
|
}
|
|
162
171
|
|
|
172
|
+
/**
|
|
173
|
+
* Onclick interaction with the body element
|
|
174
|
+
*
|
|
175
|
+
* @param {String} classText - Class name to remove from the element on body click
|
|
176
|
+
* @return {Object} Navigation A reference to the instance of the class
|
|
177
|
+
* @chainable
|
|
178
|
+
*/
|
|
179
|
+
removeClass(e, classText) {
|
|
180
|
+
e.stopImmediatePropagation();
|
|
181
|
+
e.stopPropagation();
|
|
182
|
+
|
|
183
|
+
this.element.classList.remove(classText);
|
|
184
|
+
|
|
185
|
+
return this;
|
|
186
|
+
}
|
|
187
|
+
|
|
163
188
|
/**
|
|
164
189
|
* Onclick interaction with the context links
|
|
165
190
|
*
|
|
@@ -173,6 +198,26 @@ export default class Navigation {
|
|
|
173
198
|
return this;
|
|
174
199
|
}
|
|
175
200
|
|
|
201
|
+
/**
|
|
202
|
+
* Actions performed on key press
|
|
203
|
+
*
|
|
204
|
+
* @param {Event} e - event object
|
|
205
|
+
* @param {Function} callback - function to call if the escape key is pressed
|
|
206
|
+
*
|
|
207
|
+
* @return {Object} Nav A reference to the instance of the class
|
|
208
|
+
* @chainable
|
|
209
|
+
*/
|
|
210
|
+
handleKeyPress(e, callback) {
|
|
211
|
+
if (e.key === 'Escape') {
|
|
212
|
+
// this.element.classList.remove(`${this.prefix}--context--open`);
|
|
213
|
+
// this.element.classList.remove(`${this.prefix}--subnav--open`);
|
|
214
|
+
// this.element.classList.remove(`${this.prefix}--search--open`);
|
|
215
|
+
callback(e);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return this;
|
|
219
|
+
}
|
|
220
|
+
|
|
176
221
|
/**
|
|
177
222
|
* Onclick interaction with the language menu button
|
|
178
223
|
*
|
|
@@ -191,8 +236,56 @@ export default class Navigation {
|
|
|
191
236
|
* @return {Object} Navigation A reference to the instance of the class
|
|
192
237
|
* @chainable
|
|
193
238
|
*/
|
|
194
|
-
|
|
195
|
-
|
|
239
|
+
handleContextButtonClickOn(e) {
|
|
240
|
+
e.stopImmediatePropagation();
|
|
241
|
+
// e.stopPropagation();
|
|
242
|
+
this.element.classList.add(`${this.prefix}--context--open`);
|
|
243
|
+
window.addEventListener(
|
|
244
|
+
EVENTS.KEY_DOWN,
|
|
245
|
+
(ev) => this.keyPress(ev, this.contextButtonClickOff),
|
|
246
|
+
false
|
|
247
|
+
);
|
|
248
|
+
this.body.addEventListener(EVENTS.CLICK, (ev) => this.handleContextButtonClickOff(ev), false);
|
|
249
|
+
|
|
250
|
+
return this;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Onclick interaction with the context menu button
|
|
255
|
+
*
|
|
256
|
+
* @return {Object} Navigation A reference to the instance of the class
|
|
257
|
+
* @chainable
|
|
258
|
+
*/
|
|
259
|
+
handleContextButtonClickOff(e) {
|
|
260
|
+
e.stopImmediatePropagation();
|
|
261
|
+
// e.stopPropagation();
|
|
262
|
+
this.element.classList.remove(`${this.prefix}--context--open`);
|
|
263
|
+
window.removeEventListener(
|
|
264
|
+
EVENTS.KEY_DOWN,
|
|
265
|
+
(ev) => this.keyPress(ev, this.contextButtonClickOff),
|
|
266
|
+
false
|
|
267
|
+
);
|
|
268
|
+
this.body.removeEventListener(
|
|
269
|
+
EVENTS.CLICK,
|
|
270
|
+
(ev) => this.handleContextButtonClickoff(ev, `${this.prefix}--context--open`),
|
|
271
|
+
false
|
|
272
|
+
);
|
|
273
|
+
|
|
274
|
+
return this;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Onclick interaction with the context menu button
|
|
279
|
+
*
|
|
280
|
+
* @return {Object} Navigation A reference to the instance of the class
|
|
281
|
+
* @chainable
|
|
282
|
+
*/
|
|
283
|
+
handleContextButtonClick(e) {
|
|
284
|
+
if (this.element.classList.contains(`${this.prefix}--context--open`)) {
|
|
285
|
+
this.contextButtonClickOff(e);
|
|
286
|
+
} else {
|
|
287
|
+
this.contextButtonClickOn(e);
|
|
288
|
+
}
|
|
196
289
|
|
|
197
290
|
return this;
|
|
198
291
|
}
|
|
@@ -203,10 +296,54 @@ export default class Navigation {
|
|
|
203
296
|
* @return {Object} Navigation A reference to the instance of the class
|
|
204
297
|
* @chainable
|
|
205
298
|
*/
|
|
206
|
-
|
|
207
|
-
|
|
299
|
+
handleSearchButtonClickOn(e) {
|
|
300
|
+
e.stopImmediatePropagation();
|
|
301
|
+
// e.stopPropagation();
|
|
302
|
+
this.element.classList.add(`${this.prefix}--search--open`);
|
|
303
|
+
window.addEventListener(
|
|
304
|
+
EVENTS.KEY_DOWN,
|
|
305
|
+
(ev) => this.keyPress(ev, this.searchButtonClickOff),
|
|
306
|
+
false
|
|
307
|
+
);
|
|
308
|
+
|
|
309
|
+
return this;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Onclick interaction with the search button
|
|
314
|
+
*
|
|
315
|
+
* @return {Object} Navigation A reference to the instance of the class
|
|
316
|
+
* @chainable
|
|
317
|
+
*/
|
|
318
|
+
handleSearchButtonClickOff(e) {
|
|
319
|
+
e.stopImmediatePropagation();
|
|
320
|
+
// e.stopPropagation();
|
|
321
|
+
this.element.classList.remove(`${this.prefix}--search--open`);
|
|
322
|
+
window.removeEventListener(
|
|
323
|
+
EVENTS.KEY_DOWN,
|
|
324
|
+
(ev) => this.keyPress(ev, this.searchButtonClickOff),
|
|
325
|
+
false
|
|
326
|
+
);
|
|
327
|
+
|
|
328
|
+
return this;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Onclick interaction with the search button
|
|
333
|
+
*
|
|
334
|
+
* @return {Object} Navigation A reference to the instance of the class
|
|
335
|
+
* @chainable
|
|
336
|
+
*/
|
|
337
|
+
handleSearchButtonClick(e) {
|
|
338
|
+
// this.element.classList.toggle(`${this.prefix}--search--open`);
|
|
208
339
|
this.element.classList.remove(`${this.prefix}--subnav--open`);
|
|
209
340
|
|
|
341
|
+
if (this.element.classList.contains(`${this.prefix}--search--open`)) {
|
|
342
|
+
this.searchButtonClickOff(e);
|
|
343
|
+
} else {
|
|
344
|
+
this.searchButtonClickOn(e);
|
|
345
|
+
}
|
|
346
|
+
|
|
210
347
|
return this;
|
|
211
348
|
}
|
|
212
349
|
|
|
@@ -222,16 +359,55 @@ export default class Navigation {
|
|
|
222
359
|
return this;
|
|
223
360
|
}
|
|
224
361
|
|
|
362
|
+
/**
|
|
363
|
+
* Onclick interaction with the subnav button
|
|
364
|
+
*
|
|
365
|
+
* @return {Object} Navigation A reference to the instance of the class
|
|
366
|
+
* @chainable
|
|
367
|
+
*/
|
|
368
|
+
handleSubnavClickOn(e) {
|
|
369
|
+
e.stopImmediatePropagation();
|
|
370
|
+
// e.stopPropagation();
|
|
371
|
+
this.element.classList.add(`${this.prefix}--subnav--open`);
|
|
372
|
+
window.addEventListener(EVENTS.KEY_DOWN, (ev) => this.keyPress(ev, this.subnavClickOff), false);
|
|
373
|
+
|
|
374
|
+
return this;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Onclick interaction with the subnav button
|
|
379
|
+
*
|
|
380
|
+
* @return {Object} Navigation A reference to the instance of the class
|
|
381
|
+
* @chainable
|
|
382
|
+
*/
|
|
383
|
+
handleSubnavClickOff(e) {
|
|
384
|
+
e.stopImmediatePropagation();
|
|
385
|
+
// e.stopPropagation();
|
|
386
|
+
this.element.classList.remove(`${this.prefix}--subnav--open`);
|
|
387
|
+
window.removeEventListener(
|
|
388
|
+
EVENTS.KEY_DOWN,
|
|
389
|
+
(ev) => this.keyPress(ev, this.subnavClickOff),
|
|
390
|
+
false
|
|
391
|
+
);
|
|
392
|
+
|
|
393
|
+
return this;
|
|
394
|
+
}
|
|
395
|
+
|
|
225
396
|
/**
|
|
226
397
|
* Onclick interaction with the Subnav button
|
|
227
398
|
*
|
|
228
399
|
* @return {Object} Navigation A reference to the instance of the class
|
|
229
400
|
* @chainable
|
|
230
401
|
*/
|
|
231
|
-
|
|
232
|
-
this.element.classList.toggle(`${this.prefix}--subnav--open`);
|
|
402
|
+
handleSubnavClick(e) {
|
|
233
403
|
this.element.classList.remove(`${this.prefix}--search--open`);
|
|
234
404
|
|
|
405
|
+
if (this.element.classList.contains(`${this.prefix}--subnav--open`)) {
|
|
406
|
+
this.subnavClickOff(e);
|
|
407
|
+
} else {
|
|
408
|
+
this.subnavClickOn(e);
|
|
409
|
+
}
|
|
410
|
+
|
|
235
411
|
return this;
|
|
236
412
|
}
|
|
237
413
|
|
|
@@ -242,7 +418,8 @@ export default class Navigation {
|
|
|
242
418
|
* @chainable
|
|
243
419
|
*/
|
|
244
420
|
handleSubnavBackClick() {
|
|
245
|
-
this.element.classList.remove(`${this.prefix}--subnav--open`);
|
|
421
|
+
// this.element.classList.remove(`${this.prefix}--subnav--open`);
|
|
422
|
+
this.subnavClickOff(e);
|
|
246
423
|
this.element.classList.remove(`${this.prefix}--select--open`);
|
|
247
424
|
|
|
248
425
|
return this;
|
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
<span class="ilo--icon" title="Remove"></span>
|
|
9
9
|
</button>
|
|
10
10
|
</li>
|
|
11
|
+
{% elseif tagType == "reset" %}
|
|
12
|
+
<li class="{{prefix}}--tags__item">
|
|
13
|
+
<button class="{{prefix}}--tag {{prefix}}--tag--reset {{prefix}}--tag--active" id="{{ id }}" data-active={{ defaultActive }} type="button">
|
|
14
|
+
{{content}}
|
|
15
|
+
</button>
|
|
16
|
+
</li>
|
|
11
17
|
{% elseif tagType == "anchor" %}
|
|
12
18
|
<li class="{{prefix}}--tags__item">
|
|
13
19
|
<a class="{{prefix}}--tag {{prefix}}--tag--anchor {% if defaultActive %} {{prefix}}--tag--active{% endif %}" href="{{ url }}" id="{{ id }}" data-active={{ defaultActive }}>
|
|
@@ -20,7 +20,7 @@ tags:
|
|
|
20
20
|
- content: content 3
|
|
21
21
|
id: tag3
|
|
22
22
|
defaultActive: false
|
|
23
|
-
settings:
|
|
23
|
+
settings:
|
|
24
24
|
allowMultipleActive:
|
|
25
25
|
type: select
|
|
26
26
|
label: Allow Multiple Active
|
|
@@ -38,6 +38,7 @@ tags:
|
|
|
38
38
|
anchor: Anchor
|
|
39
39
|
button: Button
|
|
40
40
|
display: Display
|
|
41
|
+
reset: Reset
|
|
41
42
|
preview: display
|
|
42
43
|
required: true
|
|
43
44
|
visibility: storybook
|