@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.
Files changed (162) hide show
  1. package/.eslintrc.js +37 -49
  2. package/.stylelintrc +2 -6
  3. package/.turbo/turbo-build:lib.log +2 -2
  4. package/CHANGELOG.md +20 -0
  5. package/apps/storybook/assets.js +5 -0
  6. package/apps/storybook/main.js +17 -8
  7. package/apps/storybook/manager-head.html +1 -1
  8. package/apps/storybook/manager.js +2 -2
  9. package/apps/storybook/patterns/colors.stories.mdx +9 -4
  10. package/apps/storybook/patterns/intro.stories.mdx +47 -42
  11. package/apps/storybook/patterns/typeset.stories.mdx +10 -6
  12. package/apps/storybook/patterns/welcome.stories.mdx +21 -16
  13. package/apps/storybook/preview-body.html +1 -1
  14. package/apps/storybook/preview.js +16 -16
  15. package/apps/storybook/styles.scss +1 -1
  16. package/apps/storybook/theme.js +5 -5
  17. package/babel.config.js +3 -3
  18. package/importprefix.js +5 -5
  19. package/importsvgs.js +3 -3
  20. package/jest.config.js +8 -8
  21. package/outputtwigs.js +16 -13
  22. package/package.json +47 -56
  23. package/postcss.config.js +2 -2
  24. package/src/namespaces.js +5 -5
  25. package/src/patterns/components/accordion/accordion-item.wingsuit.yml +1 -1
  26. package/src/patterns/components/accordion/accordion.behavior.js +2 -2
  27. package/src/patterns/components/accordion/accordion.js +31 -21
  28. package/src/patterns/components/accordion/accordion.stories.jsx +4 -2
  29. package/src/patterns/components/accordion/accordion.wingsuit.yml +4 -3
  30. package/src/patterns/components/accordion/index.js +3 -3
  31. package/src/patterns/components/breadcrumb/breadcrumb.behavior.js +2 -2
  32. package/src/patterns/components/breadcrumb/breadcrumb.js +14 -12
  33. package/src/patterns/components/breadcrumb/breadcrumb.stories.jsx +4 -2
  34. package/src/patterns/components/breadcrumb/breadcrumb.wingsuit.yml +1 -1
  35. package/src/patterns/components/breadcrumb/index.js +3 -3
  36. package/src/patterns/components/button/button.stories.jsx +4 -2
  37. package/src/patterns/components/button/button.wingsuit.yml +12 -12
  38. package/src/patterns/components/button/index.js +2 -2
  39. package/src/patterns/components/callout/callout.behavior.js +2 -2
  40. package/src/patterns/components/callout/callout.js +18 -13
  41. package/src/patterns/components/callout/callout.stories.jsx +4 -2
  42. package/src/patterns/components/callout/callout.wingsuit.yml +2 -2
  43. package/src/patterns/components/callout/index.js +3 -3
  44. package/src/patterns/components/card/card.stories.jsx +4 -2
  45. package/src/patterns/components/card/card.wingsuit.yml +8 -8
  46. package/src/patterns/components/card/index.js +2 -2
  47. package/src/patterns/components/cardgroup/cardgroup.stories.jsx +4 -2
  48. package/src/patterns/components/cardgroup/cardgroup.wingsuit.yml +31 -31
  49. package/src/patterns/components/cardgroup/index.js +2 -2
  50. package/src/patterns/components/contextmenu/contextmenu.stories.jsx +4 -2
  51. package/src/patterns/components/contextmenu/contextmenu.wingsuit.yml +7 -7
  52. package/src/patterns/components/contextmenu/index.js +2 -2
  53. package/src/patterns/components/dropdown/dropdown.stories.jsx +4 -2
  54. package/src/patterns/components/dropdown/dropdown.wingsuit.yml +4 -4
  55. package/src/patterns/components/dropdown/index.js +2 -2
  56. package/src/patterns/components/footer/footer.stories.jsx +4 -2
  57. package/src/patterns/components/footer/footer.wingsuit.yml +1 -1
  58. package/src/patterns/components/footer/index.js +2 -2
  59. package/src/patterns/components/form/fileupload.behavior.js +2 -2
  60. package/src/patterns/components/form/fileupload.js +6 -5
  61. package/src/patterns/components/form/form.stories.jsx +4 -2
  62. package/src/patterns/components/form/form.wingsuit.yml +92 -92
  63. package/src/patterns/components/form/index.js +3 -3
  64. package/src/patterns/components/hero/hero.stories.jsx +4 -2
  65. package/src/patterns/components/hero/hero.wingsuit.yml +4 -4
  66. package/src/patterns/components/hero/index.js +2 -2
  67. package/src/patterns/components/herocard/herocard.stories.jsx +4 -2
  68. package/src/patterns/components/herocard/herocard.wingsuit.yml +5 -5
  69. package/src/patterns/components/herocard/index.js +2 -2
  70. package/src/patterns/components/icon/index.js +2 -2
  71. package/src/patterns/components/image/image.stories.jsx +4 -2
  72. package/src/patterns/components/image/image.wingsuit.yml +9 -9
  73. package/src/patterns/components/image/index.js +2 -2
  74. package/src/patterns/components/link/index.js +2 -2
  75. package/src/patterns/components/link/link.stories.jsx +4 -2
  76. package/src/patterns/components/link/link.wingsuit.yml +3 -3
  77. package/src/patterns/components/linklist/index.js +2 -2
  78. package/src/patterns/components/linklist/linklist.stories.jsx +4 -2
  79. package/src/patterns/components/linklist/linklist.wingsuit.yml +15 -15
  80. package/src/patterns/components/list/index.js +2 -2
  81. package/src/patterns/components/list/list-item.wingsuit.yml +1 -1
  82. package/src/patterns/components/list/list.stories.jsx +4 -2
  83. package/src/patterns/components/list/list.wingsuit.yml +4 -4
  84. package/src/patterns/components/loading/index.js +3 -3
  85. package/src/patterns/components/loading/loading.behavior.js +2 -2
  86. package/src/patterns/components/loading/loading.js +2 -2
  87. package/src/patterns/components/loading/loading.stories.jsx +4 -2
  88. package/src/patterns/components/loading/loading.wingsuit.yml +5 -5
  89. package/src/patterns/components/localnav/index.js +3 -3
  90. package/src/patterns/components/localnav/localnav.stories.jsx +4 -2
  91. package/src/patterns/components/localnav/localnav.twig +3 -1
  92. package/src/patterns/components/localnav/localnav.wingsuit.yml +17 -19
  93. package/src/patterns/components/modal/index.js +3 -3
  94. package/src/patterns/components/modal/modal.behavior.js +2 -2
  95. package/src/patterns/components/modal/modal.js +9 -7
  96. package/src/patterns/components/modal/modal.stories.jsx +5 -2
  97. package/src/patterns/components/modal/modal.wingsuit.yml +20 -20
  98. package/src/patterns/components/navigation/index.js +3 -3
  99. package/src/patterns/components/navigation/navigation.behavior.js +2 -2
  100. package/src/patterns/components/navigation/navigation.js +110 -37
  101. package/src/patterns/components/navigation/navigation.stories.jsx +5 -2
  102. package/src/patterns/components/navigation/navigation.wingsuit.yml +7 -7
  103. package/src/patterns/components/notification/index.js +3 -3
  104. package/src/patterns/components/notification/notification.behavior.js +3 -3
  105. package/src/patterns/components/notification/notification.js +4 -2
  106. package/src/patterns/components/notification/notification.stories.jsx +5 -2
  107. package/src/patterns/components/notification/notification.wingsuit.yml +7 -7
  108. package/src/patterns/components/pagination/Pagination.stories.jsx +4 -2
  109. package/src/patterns/components/pagination/index.js +2 -2
  110. package/src/patterns/components/pagination/pagination.wingsuit.yml +12 -12
  111. package/src/patterns/components/polyfill/index.js +2 -2
  112. package/src/patterns/components/profile/index.js +2 -2
  113. package/src/patterns/components/profile/profile.stories.jsx +5 -2
  114. package/src/patterns/components/profile/profile.wingsuit.yml +3 -3
  115. package/src/patterns/components/readmore/index.js +3 -3
  116. package/src/patterns/components/readmore/readmore.behavior.js +2 -2
  117. package/src/patterns/components/readmore/readmore.js +4 -2
  118. package/src/patterns/components/readmore/readmore.stories.jsx +5 -2
  119. package/src/patterns/components/readmore/readmore.wingsuit.yml +4 -4
  120. package/src/patterns/components/richtext/index.js +2 -2
  121. package/src/patterns/components/richtext/richtext.stories.jsx +5 -2
  122. package/src/patterns/components/richtext/richtext.wingsuit.yml +1 -1
  123. package/src/patterns/components/searchfield/index.js +2 -2
  124. package/src/patterns/components/searchfield/searchfield.stories.jsx +5 -2
  125. package/src/patterns/components/searchfield/searchfield.wingsuit.yml +1 -1
  126. package/src/patterns/components/table/index.js +3 -3
  127. package/src/patterns/components/table/table.behavior.js +2 -2
  128. package/src/patterns/components/table/table.js +66 -44
  129. package/src/patterns/components/table/table.stories.jsx +5 -2
  130. package/src/patterns/components/table/table.wingsuit.yml +11 -21
  131. package/src/patterns/components/tableofcontents/index.js +3 -3
  132. package/src/patterns/components/tableofcontents/tableofcontents.behavior.js +2 -2
  133. package/src/patterns/components/tableofcontents/tableofcontents.js +27 -19
  134. package/src/patterns/components/tableofcontents/tableofcontents.stories.jsx +5 -2
  135. package/src/patterns/components/tableofcontents/tableofcontents.wingsuit.yml +14 -14
  136. package/src/patterns/components/tabs/index.js +3 -3
  137. package/src/patterns/components/tabs/tabs.behavior.js +4 -4
  138. package/src/patterns/components/tabs/tabs.js +12 -8
  139. package/src/patterns/components/tabs/tabs.stories.jsx +5 -2
  140. package/src/patterns/components/tabs/tabs.wingsuit.yml +120 -120
  141. package/src/patterns/components/tags/index.js +3 -3
  142. package/src/patterns/components/tags/tag.behavior.js +2 -2
  143. package/src/patterns/components/tags/tag.js +12 -12
  144. package/src/patterns/components/tags/tag.stories.jsx +5 -2
  145. package/src/patterns/components/tags/tag.wingsuit.yml +3 -3
  146. package/src/patterns/components/tags/tags.wingsuit.yml +1 -1
  147. package/src/patterns/components/tooltip/index.js +3 -3
  148. package/src/patterns/components/tooltip/tooltip.behavior.js +2 -2
  149. package/src/patterns/components/tooltip/tooltip.js +35 -25
  150. package/src/patterns/components/tooltip/tooltip.stories.jsx +5 -2
  151. package/src/patterns/components/tooltip/tooltip.wingsuit.yml +4 -4
  152. package/src/patterns/components/video/index.js +3 -3
  153. package/src/patterns/components/video/video.behavior.js +2 -2
  154. package/src/patterns/components/video/video.js +6 -5
  155. package/src/patterns/components/video/video.stories.jsx +5 -2
  156. package/src/patterns/components/video/video.wingsuit.yml +11 -11
  157. package/src/vendorjs/lib.vendor.js +1 -1
  158. package/wingsuit.config.js +14 -13
  159. package/.editorconfig +0 -12
  160. package/.eslintignore +0 -11
  161. package/.prettierignore +0 -16
  162. package/.prettierrc.js +0 -13
@@ -1,5 +1,5 @@
1
1
  readmore:
2
- use: '@components/readmore/readmore.twig'
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: '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.'
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: '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.'
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: 'true'
32
+ true: "true"
33
33
  false: false
34
34
  preview: false
35
35
  required: true
@@ -2,5 +2,5 @@
2
2
  * rich text
3
3
  */
4
4
  // Module template
5
- import './richtext.twig';
6
- import './richtext.wingsuit.yml';
5
+ import "./richtext.twig";
6
+ import "./richtext.wingsuit.yml";
@@ -1,7 +1,10 @@
1
- import './index';
1
+ import "./index";
2
2
 
3
- const patternDefinition = require('./richtext.wingsuit.yml');
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,5 +1,5 @@
1
1
  richtext:
2
- use: '@components/richtext/richtext.twig'
2
+ use: "@components/richtext/richtext.twig"
3
3
  label: Rich Text
4
4
  description: A component for displaying rich text as entered in a WYSIWYG editor.
5
5
  fields:
@@ -2,5 +2,5 @@
2
2
  * Search Field
3
3
  */
4
4
  // Module template
5
- import './searchfield.twig';
6
- import './searchfield.wingsuit.yml';
5
+ import "./searchfield.twig";
6
+ import "./searchfield.wingsuit.yml";
@@ -1,7 +1,10 @@
1
- import './index';
1
+ import "./index";
2
2
 
3
- const patternDefinition = require('./searchfield.wingsuit.yml');
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,5 +1,5 @@
1
1
  searchfield:
2
- use: '@components/searchfield/searchfield.twig'
2
+ use: "@components/searchfield/searchfield.twig"
3
3
  label: Search Field
4
4
  description: A component for displaying a search field.
5
5
  fields:
@@ -2,6 +2,6 @@
2
2
  * Table
3
3
  */
4
4
  // Module template
5
- import './table.twig';
6
- import './table.wingsuit.yml';
7
- import './table.behavior.js';
5
+ import "./table.twig";
6
+ import "./table.wingsuit.yml";
7
+ import "./table.behavior.js";
@@ -1,4 +1,4 @@
1
- import Table from './table';
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('loading Table component....');
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 '@ilo-org/utils';
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(`.${this.prefix}--table--head--cell`);
58
- this.tdCells = this.element.querySelectorAll(`.${this.prefix}--table--body--cell`);
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(`.${this.prefix}--table--head--row`);
61
- this.tdRows = this.element.querySelectorAll(`.${this.prefix}--table--body--row`);
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(tdrow.querySelectorAll(`.${this.prefix}--table--body--cell`)).forEach(
89
- (cell, index) => {
90
- const sortablecontent = cell.textContent.toLowerCase();
91
- if (typeof this.sortlist[index] === 'undefined') {
92
- this.sortlist[index] = [];
93
- }
94
- if (cell.classList.contains('numeric')) {
95
- if (this.isDate(sortablecontent)) {
96
- this.sortlist[index].push({ value: sortablecontent, node: tdrow, type: 'date' });
97
- } else {
98
- this.sortlist[index].push({ value: sortablecontent, node: tdrow, type: 'numeric' });
99
- }
100
- } else if (cell.innerHTML.match(/^([^0-9]*)$/)) {
101
- this.sortlist[index].push({ value: sortablecontent, node: tdrow, type: 'string' });
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('sortable');
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('table--js');
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) === 'undefined' ||
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('selected');
195
+ tdrow.classList.remove("selected");
176
196
  });
177
197
 
178
- e.target.parentElement.classList.add('selected');
198
+ e.target.parentElement.classList.add("selected");
179
199
 
180
200
  Array.from(this.tdCells).forEach((tdcell) => {
181
- tdcell.classList.remove('selected');
182
- tdcell.classList.remove('column--selected');
201
+ tdcell.classList.remove("selected");
202
+ tdcell.classList.remove("column--selected");
183
203
  });
184
204
 
185
205
  Array.from(
186
- e.target.parentElement.querySelectorAll(`.${this.prefix}--table--body--cell`)
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('selected');
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(tdrow.querySelectorAll(`.${this.prefix}--table--body--cell`)).forEach(
196
- (tdcell, index) => {
197
- if (index === currentindex && tdcell !== e.target) {
198
- tdcell.classList.add('column--selected');
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('href')) {
205
- window.location.href = e.target.getAttribute('href');
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 === 'numeric') {
264
+ if (a.type === "numeric") {
243
265
  return a.value - b.value;
244
- } else if (a.type === 'date') {
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 === 'numeric') {
276
+ if (a.type === "numeric") {
255
277
  return b.value - a.value;
256
- } else if (a.type === 'date') {
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 = function (date) {
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]\-[0-3]?[0-9]\-(?:[0-9]{2})?[0-9]{2}$/)) {
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 './index';
1
+ import "./index";
2
2
 
3
- const patternDefinition = require('./table.wingsuit.yml');
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: '@components/table/table.twig'
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 './tableofcontents.twig';
6
- import './tableofcontents.wingsuit.yml';
7
- import './tableofcontents.behavior';
5
+ import "./tableofcontents.twig";
6
+ import "./tableofcontents.wingsuit.yml";
7
+ import "./tableofcontents.behavior";
@@ -1,4 +1,4 @@
1
- import TableOfContents from './tableofcontents';
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('loading TableOfContents component....');
9
+ console.log("loading TableOfContents component....");
10
10
  new TableOfContents(element);
11
11
  }
12
12
  );
@@ -1,4 +1,4 @@
1
- import { EVENTS } from '@ilo-org/utils';
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(`.${this.prefix}--table-of-contents--trigger`);
58
- this.modalUx = this.element.querySelector(`.${this.prefix}--table-of-contents--modal`);
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(`.${this.prefix}--table-of-contents--link`);
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, () => this.OpenButtonHandler());
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, i) => {
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('hide');
107
- this.element.classList.add('show');
108
- this.modalUx.classList.add('show');
109
- this.toc.classList.add('show');
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('fadein');
112
- this.toc.classList.add('fadein');
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('fadein');
127
- this.toc.classList.remove('fadein');
134
+ this.modalUx.classList.remove("fadein");
135
+ this.toc.classList.remove("fadein");
128
136
  setTimeout(() => {
129
- this.modalUx.classList.remove('show');
130
- this.toc.classList.remove('show');
131
- this.element.classList.remove('show');
132
- this.trigger.classList.remove('hide');
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 === 'Escape') {
166
+ if (e.key === "Escape") {
159
167
  this.closeButtonClick();
160
168
  }
161
169
 
@@ -1,7 +1,10 @@
1
- import './index';
1
+ import "./index";
2
2
 
3
- const patternDefinition = require('./tableofcontents.wingsuit.yml');
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: '@components/tableofcontents/tableofcontents.twig'
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: 'medium'
12
- type: 'secondary'
13
- label: 'Open Button'
14
- className: 'toc--modal--open'
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: 'large'
23
- type: 'tertiary'
24
- label: 'Close Button'
22
+ size: "large"
23
+ type: "tertiary"
24
+ label: "Close Button"
25
25
  icon: close
26
26
  iconPos: center
27
27
  icononly: true
28
- className: 'toc--modal--close'
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: '#example'
42
+ href: "#example"
43
43
  - label: "Item Two"
44
- href: '#example'
44
+ href: "#example"
45
45
  - label: "Item Three"
46
- href: '#example'
46
+ href: "#example"
47
47
  - label: "Item Four"
48
- href: '#example'
48
+ href: "#example"
49
49
  - label: "Item Five"
50
- href: '#example'
50
+ href: "#example"
51
51
  visibility: storybook
@@ -2,6 +2,6 @@
2
2
  * Tabs
3
3
  */
4
4
  // Module template
5
- import './tabs.twig';
6
- import './tabs.wingsuit.yml';
7
- import './tabs.behavior.js';
5
+ import "./tabs.twig";
6
+ import "./tabs.wingsuit.yml";
7
+ import "./tabs.behavior.js";
@@ -1,5 +1,5 @@
1
- import Tabs from './tabs';
2
- import Tooltip from '../tooltip/tooltip';
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('loading Tabs component....');
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('loading Tooltip component....');
18
+ console.log("loading Tooltip component....");
19
19
  new Tooltip(element);
20
20
  }
21
21
  );