@ilo-org/twig 0.2.11 → 0.2.13
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 +2 -2
- package/CHANGELOG.md +20 -0
- package/apps/storybook/assets.js +5 -0
- package/apps/storybook/main.js +17 -8
- package/apps/storybook/manager-head.html +1 -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 -16
- package/apps/storybook/preview-body.html +1 -1
- package/apps/storybook/preview.js +16 -16
- package/apps/storybook/styles.scss +1 -1
- package/apps/storybook/theme.js +5 -5
- package/babel.config.js +3 -3
- 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 +8 -8
- 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 +31 -31
- 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 +4 -4
- 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 +7 -7
- 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 +3 -3
- 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 +1 -1
- 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 +120 -120
- 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 +11 -11
- 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
|
readmore:
|
|
2
|
-
use:
|
|
2
|
+
use: "@components/readmore/readmore.twig"
|
|
3
3
|
label: Read More
|
|
4
4
|
description: A component for displaying rich text as entered in a WYSIWYG editor.
|
|
5
5
|
fields:
|
|
@@ -15,13 +15,13 @@ readmore:
|
|
|
15
15
|
type: string
|
|
16
16
|
label: Excerpt
|
|
17
17
|
description: HTML content
|
|
18
|
-
preview:
|
|
18
|
+
preview: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
|
|
19
19
|
required: true
|
|
20
20
|
fulltext:
|
|
21
21
|
type: string
|
|
22
22
|
label: Full Text
|
|
23
23
|
description: HTML content
|
|
24
|
-
preview:
|
|
24
|
+
preview: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
|
|
25
25
|
required: true
|
|
26
26
|
settings:
|
|
27
27
|
openatstart:
|
|
@@ -29,7 +29,7 @@ readmore:
|
|
|
29
29
|
label: Open At Start
|
|
30
30
|
description: should the read more be open at page load?
|
|
31
31
|
options:
|
|
32
|
-
true:
|
|
32
|
+
true: "true"
|
|
33
33
|
false: false
|
|
34
34
|
preview: false
|
|
35
35
|
required: true
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./index";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default {};
|
|
4
|
+
const patternDefinition = require("./richtext.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,7 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./index";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default {};
|
|
4
|
+
const patternDefinition = require("./searchfield.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,4 +1,4 @@
|
|
|
1
|
-
import Table from
|
|
1
|
+
import Table from "./table";
|
|
2
2
|
|
|
3
3
|
Drupal.behaviors.table = {
|
|
4
4
|
attach() {
|
|
@@ -6,7 +6,7 @@ Drupal.behaviors.table = {
|
|
|
6
6
|
document.querySelectorAll(`[data-loadcomponent="Table"]`),
|
|
7
7
|
(element) => {
|
|
8
8
|
// eslint-disable-next-line no-console
|
|
9
|
-
console.log(
|
|
9
|
+
console.log("loading Table component....");
|
|
10
10
|
new Table(element);
|
|
11
11
|
}
|
|
12
12
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EVENTS, ARIA, MISC } from
|
|
1
|
+
import { EVENTS, ARIA, MISC } from "@ilo-org/utils";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The Table module which handles rendering field labels inline on a form.
|
|
@@ -54,11 +54,19 @@ export default class Table {
|
|
|
54
54
|
* The button for toggling Read More state
|
|
55
55
|
* @type {Object}
|
|
56
56
|
*/
|
|
57
|
-
this.thCells = this.element.querySelectorAll(
|
|
58
|
-
|
|
57
|
+
this.thCells = this.element.querySelectorAll(
|
|
58
|
+
`.${this.prefix}--table--head--cell`
|
|
59
|
+
);
|
|
60
|
+
this.tdCells = this.element.querySelectorAll(
|
|
61
|
+
`.${this.prefix}--table--body--cell`
|
|
62
|
+
);
|
|
59
63
|
this.rows = this.element.querySelectorAll(`[class~="--row"]`);
|
|
60
|
-
this.thRows = this.element.querySelectorAll(
|
|
61
|
-
|
|
64
|
+
this.thRows = this.element.querySelectorAll(
|
|
65
|
+
`.${this.prefix}--table--head--row`
|
|
66
|
+
);
|
|
67
|
+
this.tdRows = this.element.querySelectorAll(
|
|
68
|
+
`.${this.prefix}--table--body--row`
|
|
69
|
+
);
|
|
62
70
|
this.tBody = this.element.querySelector(`.${this.prefix}--table--body`);
|
|
63
71
|
|
|
64
72
|
return this;
|
|
@@ -85,27 +93,39 @@ export default class Table {
|
|
|
85
93
|
*/
|
|
86
94
|
setUpSorting() {
|
|
87
95
|
Array.from(this.tdRows).forEach((tdrow) => {
|
|
88
|
-
Array.from(
|
|
89
|
-
(cell
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
Array.from(
|
|
97
|
+
tdrow.querySelectorAll(`.${this.prefix}--table--body--cell`)
|
|
98
|
+
).forEach((cell, index) => {
|
|
99
|
+
const sortablecontent = cell.textContent.toLowerCase();
|
|
100
|
+
if (typeof this.sortlist[index] === "undefined") {
|
|
101
|
+
this.sortlist[index] = [];
|
|
102
|
+
}
|
|
103
|
+
if (cell.classList.contains("numeric")) {
|
|
104
|
+
if (this.isDate(sortablecontent)) {
|
|
105
|
+
this.sortlist[index].push({
|
|
106
|
+
value: sortablecontent,
|
|
107
|
+
node: tdrow,
|
|
108
|
+
type: "date",
|
|
109
|
+
});
|
|
110
|
+
} else {
|
|
111
|
+
this.sortlist[index].push({
|
|
112
|
+
value: sortablecontent,
|
|
113
|
+
node: tdrow,
|
|
114
|
+
type: "numeric",
|
|
115
|
+
});
|
|
102
116
|
}
|
|
117
|
+
} else if (cell.innerHTML.match(/^([^0-9]*)$/)) {
|
|
118
|
+
this.sortlist[index].push({
|
|
119
|
+
value: sortablecontent,
|
|
120
|
+
node: tdrow,
|
|
121
|
+
type: "string",
|
|
122
|
+
});
|
|
103
123
|
}
|
|
104
|
-
);
|
|
124
|
+
});
|
|
105
125
|
});
|
|
106
126
|
this.sortlist.forEach((column, index) => {
|
|
107
127
|
if (this.sortlist[index].length === this.tdRows.length) {
|
|
108
|
-
this.thCells[index].classList.add(
|
|
128
|
+
this.thCells[index].classList.add("sortable");
|
|
109
129
|
}
|
|
110
130
|
});
|
|
111
131
|
|
|
@@ -119,7 +139,7 @@ export default class Table {
|
|
|
119
139
|
* @chainable
|
|
120
140
|
*/
|
|
121
141
|
enable() {
|
|
122
|
-
this.element.classList.add(
|
|
142
|
+
this.element.classList.add("table--js");
|
|
123
143
|
|
|
124
144
|
Array.from(this.thCells).forEach((thcell) => {
|
|
125
145
|
thcell.addEventListener(EVENTS.CLICK, (e) => this.ClickThHandler(e));
|
|
@@ -144,7 +164,7 @@ export default class Table {
|
|
|
144
164
|
// set/remove aria-sort attribute
|
|
145
165
|
if (thcell === e.target) {
|
|
146
166
|
if (
|
|
147
|
-
typeof thcell.getAttribute(ARIA.SORT) ===
|
|
167
|
+
typeof thcell.getAttribute(ARIA.SORT) === "undefined" ||
|
|
148
168
|
thcell.getAttribute(ARIA.SORT) === MISC.DESCENDING
|
|
149
169
|
) {
|
|
150
170
|
thcell.setAttribute(ARIA.SORT, MISC.ASCENDING);
|
|
@@ -172,37 +192,39 @@ export default class Table {
|
|
|
172
192
|
let currentindex = null;
|
|
173
193
|
|
|
174
194
|
Array.from(this.tdRows).forEach((tdrow) => {
|
|
175
|
-
tdrow.classList.remove(
|
|
195
|
+
tdrow.classList.remove("selected");
|
|
176
196
|
});
|
|
177
197
|
|
|
178
|
-
e.target.parentElement.classList.add(
|
|
198
|
+
e.target.parentElement.classList.add("selected");
|
|
179
199
|
|
|
180
200
|
Array.from(this.tdCells).forEach((tdcell) => {
|
|
181
|
-
tdcell.classList.remove(
|
|
182
|
-
tdcell.classList.remove(
|
|
201
|
+
tdcell.classList.remove("selected");
|
|
202
|
+
tdcell.classList.remove("column--selected");
|
|
183
203
|
});
|
|
184
204
|
|
|
185
205
|
Array.from(
|
|
186
|
-
e.target.parentElement.querySelectorAll(
|
|
206
|
+
e.target.parentElement.querySelectorAll(
|
|
207
|
+
`.${this.prefix}--table--body--cell`
|
|
208
|
+
)
|
|
187
209
|
).forEach((tdcell, index) => {
|
|
188
210
|
if (tdcell === e.target) {
|
|
189
|
-
tdcell.classList.add(
|
|
211
|
+
tdcell.classList.add("selected");
|
|
190
212
|
currentindex = index;
|
|
191
213
|
}
|
|
192
214
|
});
|
|
193
215
|
|
|
194
216
|
Array.from(this.tdRows).forEach((tdrow) => {
|
|
195
|
-
Array.from(
|
|
196
|
-
(
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
217
|
+
Array.from(
|
|
218
|
+
tdrow.querySelectorAll(`.${this.prefix}--table--body--cell`)
|
|
219
|
+
).forEach((tdcell, index) => {
|
|
220
|
+
if (index === currentindex && tdcell !== e.target) {
|
|
221
|
+
tdcell.classList.add("column--selected");
|
|
200
222
|
}
|
|
201
|
-
);
|
|
223
|
+
});
|
|
202
224
|
});
|
|
203
225
|
|
|
204
|
-
if (e.target.hasAttribute(
|
|
205
|
-
window.location.href = e.target.getAttribute(
|
|
226
|
+
if (e.target.hasAttribute("href")) {
|
|
227
|
+
window.location.href = e.target.getAttribute("href");
|
|
206
228
|
}
|
|
207
229
|
|
|
208
230
|
return this;
|
|
@@ -239,9 +261,9 @@ export default class Table {
|
|
|
239
261
|
if (a.value === b.value) {
|
|
240
262
|
return 0;
|
|
241
263
|
} else {
|
|
242
|
-
if (a.type ===
|
|
264
|
+
if (a.type === "numeric") {
|
|
243
265
|
return a.value - b.value;
|
|
244
|
-
} else if (a.type ===
|
|
266
|
+
} else if (a.type === "date") {
|
|
245
267
|
return new Date(a.value) - new Date(b.value);
|
|
246
268
|
} else {
|
|
247
269
|
return a.value < b.value ? -1 : 1;
|
|
@@ -251,9 +273,9 @@ export default class Table {
|
|
|
251
273
|
if (a.value === b.value) {
|
|
252
274
|
return 0;
|
|
253
275
|
} else {
|
|
254
|
-
if (a.type ===
|
|
276
|
+
if (a.type === "numeric") {
|
|
255
277
|
return b.value - a.value;
|
|
256
|
-
} else if (a.type ===
|
|
278
|
+
} else if (a.type === "date") {
|
|
257
279
|
return new Date(b.value) - new Date(a.value);
|
|
258
280
|
} else {
|
|
259
281
|
return a.value > b.value ? -1 : 1;
|
|
@@ -269,15 +291,15 @@ export default class Table {
|
|
|
269
291
|
*
|
|
270
292
|
* @return {Boolean} is it a date?
|
|
271
293
|
*/
|
|
272
|
-
isDate
|
|
294
|
+
isDate(date) {
|
|
273
295
|
let isdate = false;
|
|
274
296
|
if (date.match(/^[0-3]?[0-9]\/[0-3]?[0-9]\/(?:[0-9]{2})?[0-9]{2}$/)) {
|
|
275
297
|
isdate = true;
|
|
276
298
|
}
|
|
277
|
-
if (date.match(/^[0-3]?[0-9]
|
|
299
|
+
if (date.match(/^[0-3]?[0-9]-[0-3]?[0-9]-(?:[0-9]{2})?[0-9]{2}$/)) {
|
|
278
300
|
isdate = true;
|
|
279
301
|
}
|
|
280
302
|
|
|
281
303
|
return isdate;
|
|
282
|
-
}
|
|
304
|
+
}
|
|
283
305
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./index";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default {};
|
|
4
|
+
const patternDefinition = require("./table.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
|
table:
|
|
2
|
-
use:
|
|
2
|
+
use: "@components/table/table.twig"
|
|
3
3
|
label: Table
|
|
4
4
|
description: A component for displaying data in a table
|
|
5
5
|
fields:
|
|
@@ -39,62 +39,52 @@ table:
|
|
|
39
39
|
label: Table Data
|
|
40
40
|
description: The data of the table proper. Cells can include plain text or plain text with anchor tags.
|
|
41
41
|
preview:
|
|
42
|
-
-
|
|
43
|
-
- "table cell text one"
|
|
42
|
+
- - "table cell text one"
|
|
44
43
|
- "table cell text 1"
|
|
45
44
|
- "table cell <a href='http://www.ilo.org'>text one</a>"
|
|
46
45
|
- "1-20"
|
|
47
46
|
- "11/05/2022"
|
|
48
|
-
-
|
|
49
|
-
- "table cell text two"
|
|
47
|
+
- - "table cell text two"
|
|
50
48
|
- "table cell text 2"
|
|
51
49
|
- "table cell <a href='http://www.ilo.org'>text two<a>"
|
|
52
50
|
- "3"
|
|
53
51
|
- "7/19/2022"
|
|
54
|
-
-
|
|
55
|
-
- "table cell text three"
|
|
52
|
+
- - "table cell text three"
|
|
56
53
|
- "table cell text 3"
|
|
57
54
|
- "table cell <a href='http://www.ilo.org'>text three</a>"
|
|
58
55
|
- "75"
|
|
59
56
|
- "01/01/1975"
|
|
60
|
-
-
|
|
61
|
-
- "table cell text four"
|
|
57
|
+
- - "table cell text four"
|
|
62
58
|
- "table cell text 4"
|
|
63
59
|
- "table cell <a href='http://www.ilo.org'>text four</a>"
|
|
64
60
|
- "10-15"
|
|
65
61
|
- "01/01/2022"
|
|
66
|
-
-
|
|
67
|
-
- "table cell text five"
|
|
62
|
+
- - "table cell text five"
|
|
68
63
|
- "table cell text 5"
|
|
69
64
|
- "table cell <a href='http://www.ilo.org'>text five</a>"
|
|
70
65
|
- "5"
|
|
71
66
|
- "10/31/2022"
|
|
72
|
-
-
|
|
73
|
-
- "table cell text six"
|
|
67
|
+
- - "table cell text six"
|
|
74
68
|
- "table cell text 6"
|
|
75
69
|
- "table cell <a href='http://www.ilo.org'>text six</a>"
|
|
76
70
|
- "6"
|
|
77
71
|
- "08/13/2016"
|
|
78
|
-
-
|
|
79
|
-
- "table cell text seven"
|
|
72
|
+
- - "table cell text seven"
|
|
80
73
|
- "table cell text 7"
|
|
81
74
|
- "table cell <a href='http://www.ilo.org'>text seven</a>"
|
|
82
75
|
- "7"
|
|
83
76
|
- "11/18/2013"
|
|
84
|
-
-
|
|
85
|
-
- "table cell text eight"
|
|
77
|
+
- - "table cell text eight"
|
|
86
78
|
- "table cell text 8"
|
|
87
79
|
- "table cell <a href='http://www.ilo.org'>text eight</a>"
|
|
88
80
|
- "8"
|
|
89
81
|
- "12/31/1"
|
|
90
|
-
-
|
|
91
|
-
- "table cell text nine"
|
|
82
|
+
- - "table cell text nine"
|
|
92
83
|
- "table cell text 9"
|
|
93
84
|
- "table cell <a href='http://www.ilo.org'>text nine</a>"
|
|
94
85
|
- "9"
|
|
95
86
|
- "01/01/1970"
|
|
96
|
-
-
|
|
97
|
-
- "table cell text ten"
|
|
87
|
+
- - "table cell text ten"
|
|
98
88
|
- "table cell text 10"
|
|
99
89
|
- "table cell <a href='http://www.ilo.org'>text ten</a>"
|
|
100
90
|
- "10"
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* table of contents
|
|
3
3
|
*/
|
|
4
4
|
// Module template
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
5
|
+
import "./tableofcontents.twig";
|
|
6
|
+
import "./tableofcontents.wingsuit.yml";
|
|
7
|
+
import "./tableofcontents.behavior";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import TableOfContents from
|
|
1
|
+
import TableOfContents from "./tableofcontents";
|
|
2
2
|
|
|
3
3
|
Drupal.behaviors.tableofcontents = {
|
|
4
4
|
attach() {
|
|
@@ -6,7 +6,7 @@ Drupal.behaviors.tableofcontents = {
|
|
|
6
6
|
document.querySelectorAll(`[data-loadcomponent="TableOfContents"]`),
|
|
7
7
|
(element) => {
|
|
8
8
|
// eslint-disable-next-line no-console
|
|
9
|
-
console.log(
|
|
9
|
+
console.log("loading TableOfContents component....");
|
|
10
10
|
new TableOfContents(element);
|
|
11
11
|
}
|
|
12
12
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EVENTS } from
|
|
1
|
+
import { EVENTS } from "@ilo-org/utils";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The TableOfContents module which handles control and display of a TableOfContents dialog
|
|
@@ -54,10 +54,16 @@ export default class TableOfContents {
|
|
|
54
54
|
*/
|
|
55
55
|
this.OpenButton = this.element.querySelector(`.toc--modal--open`);
|
|
56
56
|
this.CloseButton = this.element.querySelector(`.toc--modal--close`);
|
|
57
|
-
this.trigger = this.element.querySelector(
|
|
58
|
-
|
|
57
|
+
this.trigger = this.element.querySelector(
|
|
58
|
+
`.${this.prefix}--table-of-contents--trigger`
|
|
59
|
+
);
|
|
60
|
+
this.modalUx = this.element.querySelector(
|
|
61
|
+
`.${this.prefix}--table-of-contents--modal`
|
|
62
|
+
);
|
|
59
63
|
this.toc = this.element.querySelector(`.${this.prefix}--table-of-contents`);
|
|
60
|
-
this.tocItems = this.element.querySelectorAll(
|
|
64
|
+
this.tocItems = this.element.querySelectorAll(
|
|
65
|
+
`.${this.prefix}--table-of-contents--link`
|
|
66
|
+
);
|
|
61
67
|
|
|
62
68
|
return this;
|
|
63
69
|
}
|
|
@@ -84,11 +90,13 @@ export default class TableOfContents {
|
|
|
84
90
|
* @chainable
|
|
85
91
|
*/
|
|
86
92
|
enable() {
|
|
87
|
-
this.OpenButton.addEventListener(EVENTS.CLICK, () =>
|
|
93
|
+
this.OpenButton.addEventListener(EVENTS.CLICK, () =>
|
|
94
|
+
this.OpenButtonHandler()
|
|
95
|
+
);
|
|
88
96
|
this.CloseButton.addEventListener(EVENTS.CLICK, () => this.CloseHandler());
|
|
89
97
|
|
|
90
98
|
if (this.tocItems.length > 0) {
|
|
91
|
-
this.tocItems.forEach((link
|
|
99
|
+
this.tocItems.forEach((link) => {
|
|
92
100
|
link.addEventListener(EVENTS.CLICK, () => this.linkClickHandler());
|
|
93
101
|
});
|
|
94
102
|
}
|
|
@@ -103,13 +111,13 @@ export default class TableOfContents {
|
|
|
103
111
|
* @chainable
|
|
104
112
|
*/
|
|
105
113
|
openButtonClick() {
|
|
106
|
-
this.trigger.classList.add(
|
|
107
|
-
this.element.classList.add(
|
|
108
|
-
this.modalUx.classList.add(
|
|
109
|
-
this.toc.classList.add(
|
|
114
|
+
this.trigger.classList.add("hide");
|
|
115
|
+
this.element.classList.add("show");
|
|
116
|
+
this.modalUx.classList.add("show");
|
|
117
|
+
this.toc.classList.add("show");
|
|
110
118
|
setTimeout(() => {
|
|
111
|
-
this.modalUx.classList.add(
|
|
112
|
-
this.toc.classList.add(
|
|
119
|
+
this.modalUx.classList.add("fadein");
|
|
120
|
+
this.toc.classList.add("fadein");
|
|
113
121
|
}, 125);
|
|
114
122
|
window.addEventListener(EVENTS.KEY_DOWN, (e) => this.KeyPressHandler(e));
|
|
115
123
|
|
|
@@ -123,13 +131,13 @@ export default class TableOfContents {
|
|
|
123
131
|
* @chainable
|
|
124
132
|
*/
|
|
125
133
|
closeButtonClick() {
|
|
126
|
-
this.modalUx.classList.remove(
|
|
127
|
-
this.toc.classList.remove(
|
|
134
|
+
this.modalUx.classList.remove("fadein");
|
|
135
|
+
this.toc.classList.remove("fadein");
|
|
128
136
|
setTimeout(() => {
|
|
129
|
-
this.modalUx.classList.remove(
|
|
130
|
-
this.toc.classList.remove(
|
|
131
|
-
this.element.classList.remove(
|
|
132
|
-
this.trigger.classList.remove(
|
|
137
|
+
this.modalUx.classList.remove("show");
|
|
138
|
+
this.toc.classList.remove("show");
|
|
139
|
+
this.element.classList.remove("show");
|
|
140
|
+
this.trigger.classList.remove("hide");
|
|
133
141
|
}, 125);
|
|
134
142
|
window.removeEventListener(EVENTS.KEY_DOWN, (e) => this.KeyPressHandler(e));
|
|
135
143
|
|
|
@@ -155,7 +163,7 @@ export default class TableOfContents {
|
|
|
155
163
|
* @chainable
|
|
156
164
|
*/
|
|
157
165
|
keyPress(e) {
|
|
158
|
-
if (e.key ===
|
|
166
|
+
if (e.key === "Escape") {
|
|
159
167
|
this.closeButtonClick();
|
|
160
168
|
}
|
|
161
169
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./index";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default {};
|
|
4
|
+
const patternDefinition = require("./tableofcontents.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
|
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
|
);
|