@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.
Files changed (204) hide show
  1. package/.browserslistrc +4 -0
  2. package/.editorconfig +12 -0
  3. package/.eslintignore +11 -0
  4. package/.eslintrc.js +66 -0
  5. package/.prettierignore +16 -0
  6. package/.prettierrc.js +13 -0
  7. package/.stylelintignore +9 -0
  8. package/.stylelintrc +23 -0
  9. package/.turbo/turbo-build.log +15313 -0
  10. package/LICENSE +201 -0
  11. package/README.md +23 -0
  12. package/apps/storybook/assets.js +5 -0
  13. package/apps/storybook/config/prefix.yml +1 -0
  14. package/apps/storybook/main.js +16 -0
  15. package/apps/storybook/manager.js +7 -0
  16. package/apps/storybook/patterns/colors.stories.mdx +18 -0
  17. package/apps/storybook/patterns/typeset.stories.mdx +28 -0
  18. package/apps/storybook/patterns/welcome.stories.mdx +24 -0
  19. package/apps/storybook/preview-body.html +4 -0
  20. package/apps/storybook/preview-head.html +11 -0
  21. package/apps/storybook/preview.js +38 -0
  22. package/apps/storybook/styles.scss +2 -0
  23. package/apps/storybook/theme.js +11 -0
  24. package/babel.config.js +16 -0
  25. package/contributing.md +5 -0
  26. package/importprefix.js +18 -0
  27. package/importsvgs.js +5 -0
  28. package/jest.config.js +18 -0
  29. package/outputtwigs.js +54 -0
  30. package/package.json +108 -0
  31. package/postcss.config.js +6 -0
  32. package/src/namespaces.js +14 -0
  33. package/src/patterns/components/accordion/accordion-item.twig +16 -0
  34. package/src/patterns/components/accordion/accordion-item.wingsuit.yml +30 -0
  35. package/src/patterns/components/accordion/accordion.behavior.js +14 -0
  36. package/src/patterns/components/accordion/accordion.js +178 -0
  37. package/src/patterns/components/accordion/accordion.stories.jsx +7 -0
  38. package/src/patterns/components/accordion/accordion.twig +17 -0
  39. package/src/patterns/components/accordion/accordion.wingsuit.yml +59 -0
  40. package/src/patterns/components/accordion/index.js +7 -0
  41. package/src/patterns/components/breadcrumb/breadcrumb.behavior.js +14 -0
  42. package/src/patterns/components/breadcrumb/breadcrumb.js +93 -0
  43. package/src/patterns/components/breadcrumb/breadcrumb.stories.jsx +7 -0
  44. package/src/patterns/components/breadcrumb/breadcrumb.twig +32 -0
  45. package/src/patterns/components/breadcrumb/breadcrumb.wingsuit.yml +35 -0
  46. package/src/patterns/components/breadcrumb/index.js +7 -0
  47. package/src/patterns/components/button/button.stories.jsx +7 -0
  48. package/src/patterns/components/button/button.twig +18 -0
  49. package/src/patterns/components/button/button.wingsuit.yml +104 -0
  50. package/src/patterns/components/button/index.js +6 -0
  51. package/src/patterns/components/callout/callout.behaviors.js +14 -0
  52. package/src/patterns/components/callout/callout.js +121 -0
  53. package/src/patterns/components/callout/callout.stories.jsx +7 -0
  54. package/src/patterns/components/callout/callout.twig +30 -0
  55. package/src/patterns/components/callout/callout.wingsuit.yml +66 -0
  56. package/src/patterns/components/callout/index.js +6 -0
  57. package/src/patterns/components/card/card.stories.jsx +7 -0
  58. package/src/patterns/components/card/card.twig +98 -0
  59. package/src/patterns/components/card/card.wingsuit.yml +300 -0
  60. package/src/patterns/components/card/index.js +6 -0
  61. package/src/patterns/components/cardgroup/cardgroup.stories.jsx +7 -0
  62. package/src/patterns/components/cardgroup/cardgroup.twig +30 -0
  63. package/src/patterns/components/cardgroup/cardgroup.wingsuit.yml +419 -0
  64. package/src/patterns/components/cardgroup/index.js +6 -0
  65. package/src/patterns/components/contextmenu/contextmenu.stories.jsx +7 -0
  66. package/src/patterns/components/contextmenu/contextmenu.twig +12 -0
  67. package/src/patterns/components/contextmenu/contextmenu.wingsuit.yml +23 -0
  68. package/src/patterns/components/contextmenu/index.js +6 -0
  69. package/src/patterns/components/dropdown/dropdown.stories.jsx +7 -0
  70. package/src/patterns/components/dropdown/dropdown.twig +20 -0
  71. package/src/patterns/components/dropdown/dropdown.wingsuit.yml +71 -0
  72. package/src/patterns/components/dropdown/index.js +6 -0
  73. package/src/patterns/components/fieldset/fieldset.twig +43 -0
  74. package/src/patterns/components/footer/footer.stories.jsx +7 -0
  75. package/src/patterns/components/footer/footer.twig +62 -0
  76. package/src/patterns/components/footer/footer.wingsuit.yml +104 -0
  77. package/src/patterns/components/footer/index.js +6 -0
  78. package/src/patterns/components/form/checkbox.twig +13 -0
  79. package/src/patterns/components/form/checkboxgroup.twig +5 -0
  80. package/src/patterns/components/form/datepicker.twig +32 -0
  81. package/src/patterns/components/form/file.twig +14 -0
  82. package/src/patterns/components/form/fileupload.behavior.js +14 -0
  83. package/src/patterns/components/form/fileupload.js +118 -0
  84. package/src/patterns/components/form/form.stories.jsx +7 -0
  85. package/src/patterns/components/form/form.twig +94 -0
  86. package/src/patterns/components/form/form.wingsuit.yml +973 -0
  87. package/src/patterns/components/form/index.js +7 -0
  88. package/src/patterns/components/form/input.twig +13 -0
  89. package/src/patterns/components/form/number.twig +13 -0
  90. package/src/patterns/components/form/radio.twig +4 -0
  91. package/src/patterns/components/form/textarea.twig +13 -0
  92. package/src/patterns/components/hero/hero.stories.jsx +7 -0
  93. package/src/patterns/components/hero/hero.twig +24 -0
  94. package/src/patterns/components/hero/hero.wingsuit.yml +56 -0
  95. package/src/patterns/components/hero/index.js +6 -0
  96. package/src/patterns/components/herocard/herocard.stories.jsx +7 -0
  97. package/src/patterns/components/herocard/herocard.twig +31 -0
  98. package/src/patterns/components/herocard/herocard.wingsuit.yml +43 -0
  99. package/src/patterns/components/herocard/index.js +6 -0
  100. package/src/patterns/components/icon/icon.twig +4 -0
  101. package/src/patterns/components/icon/index.js +6 -0
  102. package/src/patterns/components/image/image.stories.jsx +7 -0
  103. package/src/patterns/components/image/image.twig +19 -0
  104. package/src/patterns/components/image/image.wingsuit.yml +37 -0
  105. package/src/patterns/components/image/index.js +6 -0
  106. package/src/patterns/components/link/index.js +6 -0
  107. package/src/patterns/components/link/link.stories.jsx +7 -0
  108. package/src/patterns/components/link/link.twig +8 -0
  109. package/src/patterns/components/link/link.wingsuit.yml +35 -0
  110. package/src/patterns/components/linklist/index.js +6 -0
  111. package/src/patterns/components/linklist/linklist.stories.jsx +7 -0
  112. package/src/patterns/components/linklist/linklist.twig +26 -0
  113. package/src/patterns/components/linklist/linklist.wingsuit.yml +53 -0
  114. package/src/patterns/components/list/index.js +6 -0
  115. package/src/patterns/components/list/list-item.twig +6 -0
  116. package/src/patterns/components/list/list-item.wingsuit.yml +18 -0
  117. package/src/patterns/components/list/list.stories.jsx +7 -0
  118. package/src/patterns/components/list/list.twig +30 -0
  119. package/src/patterns/components/list/list.wingsuit.yml +48 -0
  120. package/src/patterns/components/loading/index.js +7 -0
  121. package/src/patterns/components/loading/loading.behavior.js +14 -0
  122. package/src/patterns/components/loading/loading.js +102 -0
  123. package/src/patterns/components/loading/loading.stories.jsx +7 -0
  124. package/src/patterns/components/loading/loading.twig +8 -0
  125. package/src/patterns/components/loading/loading.wingsuit.yml +37 -0
  126. package/src/patterns/components/modal/index.js +7 -0
  127. package/src/patterns/components/modal/modal.behavior.js +14 -0
  128. package/src/patterns/components/modal/modal.js +130 -0
  129. package/src/patterns/components/modal/modal.stories.jsx +7 -0
  130. package/src/patterns/components/modal/modal.twig +18 -0
  131. package/src/patterns/components/modal/modal.wingsuit.yml +54 -0
  132. package/src/patterns/components/notification/index.js +7 -0
  133. package/src/patterns/components/notification/notification.behavior.js +15 -0
  134. package/src/patterns/components/notification/notification.js +95 -0
  135. package/src/patterns/components/notification/notification.stories.jsx +7 -0
  136. package/src/patterns/components/notification/notification.twig +18 -0
  137. package/src/patterns/components/notification/notification.wingsuit.yml +58 -0
  138. package/src/patterns/components/pagination/Pagination.stories.jsx +7 -0
  139. package/src/patterns/components/pagination/index.js +6 -0
  140. package/src/patterns/components/pagination/pagination.twig +48 -0
  141. package/src/patterns/components/pagination/pagination.wingsuit.yml +72 -0
  142. package/src/patterns/components/polyfill/index.js +6 -0
  143. package/src/patterns/components/polyfill/polyfill.twig +10 -0
  144. package/src/patterns/components/profile/index.js +6 -0
  145. package/src/patterns/components/profile/profile.stories.jsx +7 -0
  146. package/src/patterns/components/profile/profile.twig +18 -0
  147. package/src/patterns/components/profile/profile.wingsuit.yml +35 -0
  148. package/src/patterns/components/readmore/index.js +7 -0
  149. package/src/patterns/components/readmore/readmore.behavior.js +14 -0
  150. package/src/patterns/components/readmore/readmore.js +119 -0
  151. package/src/patterns/components/readmore/readmore.stories.jsx +7 -0
  152. package/src/patterns/components/readmore/readmore.twig +16 -0
  153. package/src/patterns/components/readmore/readmore.wingsuit.yml +32 -0
  154. package/src/patterns/components/richtext/index.js +6 -0
  155. package/src/patterns/components/richtext/richtext.stories.jsx +7 -0
  156. package/src/patterns/components/richtext/richtext.twig +6 -0
  157. package/src/patterns/components/richtext/richtext.wingsuit.yml +12 -0
  158. package/src/patterns/components/searchfield/index.js +6 -0
  159. package/src/patterns/components/searchfield/searchfield.stories.jsx +7 -0
  160. package/src/patterns/components/searchfield/searchfield.twig +7 -0
  161. package/src/patterns/components/searchfield/searchfield.wingsuit.yml +22 -0
  162. package/src/patterns/components/table/index.js +7 -0
  163. package/src/patterns/components/table/table.behavior.js +14 -0
  164. package/src/patterns/components/table/table.js +279 -0
  165. package/src/patterns/components/table/table.stories.jsx +7 -0
  166. package/src/patterns/components/table/table.twig +36 -0
  167. package/src/patterns/components/table/table.wingsuit.yml +112 -0
  168. package/src/patterns/components/tableofcontents/index.js +6 -0
  169. package/src/patterns/components/tableofcontents/tableofcontents.stories.jsx +7 -0
  170. package/src/patterns/components/tableofcontents/tableofcontents.twig +14 -0
  171. package/src/patterns/components/tableofcontents/tableofcontents.wingsuit.yml +22 -0
  172. package/src/patterns/components/tabs/index.js +7 -0
  173. package/src/patterns/components/tabs/tabs.behavior.js +23 -0
  174. package/src/patterns/components/tabs/tabs.js +209 -0
  175. package/src/patterns/components/tabs/tabs.stories.jsx +7 -0
  176. package/src/patterns/components/tabs/tabs.twig +30 -0
  177. package/src/patterns/components/tabs/tabs.wingsuit.yml +168 -0
  178. package/src/patterns/components/tag/index.js +7 -0
  179. package/src/patterns/components/tag/tag-set.twig +15 -0
  180. package/src/patterns/components/tag/tag.behavior.js +14 -0
  181. package/src/patterns/components/tag/tag.stories.jsx +7 -0
  182. package/src/patterns/components/tag/tag.twig +24 -0
  183. package/src/patterns/components/tag/tag.wingsuit.yml +43 -0
  184. package/src/patterns/components/tag/tagset.js +160 -0
  185. package/src/patterns/components/tag/tagset.wingsuit.yml +43 -0
  186. package/src/patterns/components/tooltip/index.js +7 -0
  187. package/src/patterns/components/tooltip/tooltip.behavior.js +14 -0
  188. package/src/patterns/components/tooltip/tooltip.js +184 -0
  189. package/src/patterns/components/tooltip/tooltip.stories.jsx +7 -0
  190. package/src/patterns/components/tooltip/tooltip.twig +11 -0
  191. package/src/patterns/components/tooltip/tooltip.wingsuit.yml +30 -0
  192. package/src/patterns/components/video/index.js +7 -0
  193. package/src/patterns/components/video/video.behavior.js +14 -0
  194. package/src/patterns/components/video/video.js +114 -0
  195. package/src/patterns/components/video/video.stories.jsx +7 -0
  196. package/src/patterns/components/video/video.twig +17 -0
  197. package/src/patterns/components/video/video.wingsuit.yml +44 -0
  198. package/src/patterns/components/video/videoplayer.twig +10 -0
  199. package/src/tokens/exports/_colors.scss +7 -0
  200. package/src/tokens/exports/_font-families.scss +6 -0
  201. package/src/tokens/exports/_font-sizes-heading.scss +10 -0
  202. package/src/tokens/index.scss +7 -0
  203. package/src/vendorjs/lib.vendor.js +1 -0
  204. package/wingsuit.config.js +27 -0
@@ -0,0 +1,279 @@
1
+ import { EVENTS, ARIA, MISC } from '@ilo-org/utils';
2
+
3
+ /**
4
+ * The Table module which handles rendering field labels inline on a form.
5
+ *
6
+ *
7
+ * @class Table
8
+ */
9
+ export default class Table {
10
+ /**
11
+ * Table 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
+ this.sortlist = [];
27
+
28
+ // Initialize the view
29
+ this.init();
30
+ }
31
+
32
+ /**
33
+ * Initializes the view by calling the functions to
34
+ * create DOM references, setup event handlers and
35
+ * then create the event listeners
36
+ *
37
+ * @return {Object} Table A reference to the instance of the class
38
+ * @chainable
39
+ */
40
+ init() {
41
+ this.cacheDomReferences().setupHandlers().setUpSorting().enable();
42
+
43
+ return this;
44
+ }
45
+
46
+ /**
47
+ * Find all necessary DOM elements used in the view and cache them
48
+ *
49
+ * @return {Object} ReadMore A reference to the instance of the class
50
+ * @chainable
51
+ */
52
+ cacheDomReferences() {
53
+ /**
54
+ * The button for toggling Read More state
55
+ * @type {Object}
56
+ */
57
+ this.thCells = this.element.querySelectorAll(`.${this.prefix}--table--head--cell`);
58
+ this.tdCells = this.element.querySelectorAll(`.${this.prefix}--table--body--cell`);
59
+ 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`);
62
+ this.tBody = this.element.querySelector(`.${this.prefix}--table--body`);
63
+
64
+ return this;
65
+ }
66
+
67
+ /**
68
+ * Bind event handlers with the proper context of `this`.
69
+ *
70
+ * @return {Object} Table A reference to the current instance of the class
71
+ * @chainable
72
+ */
73
+ setupHandlers() {
74
+ this.ClickThHandler = this.onClickTh.bind(this);
75
+ this.ClickTdHandler = this.onClickTd.bind(this);
76
+
77
+ return this;
78
+ }
79
+
80
+ /**
81
+ * Evaluates which columns are sortable and adds class to th of sortable columns
82
+ *
83
+ * @return {Object} Table A reference to the current instance of the class
84
+ * @chainable
85
+ */
86
+ setUpSorting() {
87
+ 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' });
102
+ }
103
+ }
104
+ );
105
+ });
106
+ this.sortlist.forEach((column, index) => {
107
+ if (this.sortlist[index].length === this.tdRows.length) {
108
+ this.thCells[index].classList.add('sortable');
109
+ }
110
+ });
111
+
112
+ return this;
113
+ }
114
+
115
+ /**
116
+ * Creates event listeners to enable interaction with view
117
+ *
118
+ * @return {Object} Table A reference to the instance of the class
119
+ * @chainable
120
+ */
121
+ enable() {
122
+ this.element.classList.add('table--js');
123
+
124
+ Array.from(this.thCells).forEach((thcell) => {
125
+ thcell.addEventListener(EVENTS.CLICK, (e) => this.ClickThHandler(e));
126
+ });
127
+
128
+ Array.from(this.tdCells).forEach((tdcell) => {
129
+ tdcell.addEventListener(EVENTS.CLICK, (e) => this.ClickTdHandler(e));
130
+ });
131
+
132
+ return this;
133
+ }
134
+
135
+ /**
136
+ * Actions performed on click of a tab
137
+ *
138
+ * @return {Object} Modal A reference to the instance of the class
139
+ * @chainable
140
+ */
141
+ onClickTh(e) {
142
+ e.preventDefault();
143
+ Array.from(this.thCells).forEach((thcell, index) => {
144
+ // set/remove aria-sort attribute
145
+ if (thcell === e.target) {
146
+ if (
147
+ typeof thcell.getAttribute(ARIA.SORT) === 'undefined' ||
148
+ thcell.getAttribute(ARIA.SORT) === MISC.DESCENDING
149
+ ) {
150
+ thcell.setAttribute(ARIA.SORT, MISC.ASCENDING);
151
+ this.sortColumn(index, MISC.ASCENDING);
152
+ } else {
153
+ thcell.setAttribute(ARIA.SORT, MISC.DESCENDING);
154
+ this.sortColumn(index, MISC.DESCENDING);
155
+ }
156
+ } else {
157
+ thcell.removeAttribute(ARIA.SORT);
158
+ }
159
+ });
160
+
161
+ return this;
162
+ }
163
+
164
+ /**
165
+ * Actions performed on click of a tab
166
+ *
167
+ * @return {Object} Modal A reference to the instance of the class
168
+ * @chainable
169
+ */
170
+ onClickTd(e) {
171
+ e.preventDefault();
172
+ let currentindex = null;
173
+
174
+ Array.from(this.tdRows).forEach((tdrow) => {
175
+ tdrow.classList.remove('selected');
176
+ });
177
+
178
+ e.target.parentElement.classList.add('selected');
179
+
180
+ Array.from(this.tdCells).forEach((tdcell) => {
181
+ tdcell.classList.remove('selected');
182
+ tdcell.classList.remove('column--selected');
183
+ });
184
+
185
+ Array.from(
186
+ e.target.parentElement.querySelectorAll(`.${this.prefix}--table--body--cell`)
187
+ ).forEach((tdcell, index) => {
188
+ if (tdcell === e.target) {
189
+ tdcell.classList.add('selected');
190
+ currentindex = index;
191
+ }
192
+ });
193
+
194
+ 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
+ }
200
+ }
201
+ );
202
+ });
203
+
204
+ return this;
205
+ }
206
+
207
+ /**
208
+ * Sort a column
209
+ *
210
+ * @return {Object} Modal A reference to the instance of the class
211
+ * @chainable
212
+ */
213
+ sortColumn(column, sortdirection) {
214
+ const sorted = this.sortlist[column].sort(this.compare(sortdirection));
215
+
216
+ while (this.tBody.firstChild) {
217
+ this.tBody.removeChild(this.tBody.lastChild);
218
+ }
219
+
220
+ sorted.forEach((row) => {
221
+ this.tBody.appendChild(row.node);
222
+ });
223
+
224
+ return this;
225
+ }
226
+
227
+ /**
228
+ * compare
229
+ *
230
+ * @return {Function} a compare function
231
+ */
232
+ compare(sortdirection) {
233
+ return function (a, b) {
234
+ if (sortdirection === MISC.ASCENDING) {
235
+ if (a.value === b.value) {
236
+ return 0;
237
+ } else {
238
+ if (a.type === 'numeric') {
239
+ return a.value - b.value;
240
+ } else if (a.type === 'date') {
241
+ return new Date(a.value) - new Date(b.value);
242
+ } else {
243
+ return a.value < b.value ? -1 : 1;
244
+ }
245
+ }
246
+ } else {
247
+ if (a.value === b.value) {
248
+ return 0;
249
+ } else {
250
+ if (a.type === 'numeric') {
251
+ return b.value - a.value;
252
+ } else if (a.type === 'date') {
253
+ return new Date(b.value) - new Date(a.value);
254
+ } else {
255
+ return a.value > b.value ? -1 : 1;
256
+ }
257
+ }
258
+ }
259
+ };
260
+ }
261
+
262
+ /**
263
+ * isDate
264
+ * tests is the passed string is a date
265
+ *
266
+ * @return {Boolean} is it a date?
267
+ */
268
+ isDate = function (date) {
269
+ let isdate = false;
270
+ if (date.match(/^[0-3]?[0-9]\/[0-3]?[0-9]\/(?:[0-9]{2})?[0-9]{2}$/)) {
271
+ isdate = true;
272
+ }
273
+ if (date.match(/^[0-3]?[0-9]\-[0-3]?[0-9]\-(?:[0-9]{2})?[0-9]{2}$/)) {
274
+ isdate = true;
275
+ }
276
+
277
+ return isdate;
278
+ };
279
+ }
@@ -0,0 +1,7 @@
1
+ import './index';
2
+
3
+ const patternDefinition = require('./table.wingsuit.yml');
4
+
5
+ export const wingsuit = {
6
+ patternDefinition,
7
+ };
@@ -0,0 +1,36 @@
1
+ {#
2
+ TABLE COMPONENT
3
+ #}
4
+ <div class="{{prefix}}--table{% if zebra is defined and zebra == 'true' %} {{prefix}}--table--zebra{% endif %}" data-prefix="{{prefix}}" data-loadcomponent="Table">
5
+ <header class="{{prefix}}--table--header">
6
+ <h3 class="{{prefix}}--table--headline">
7
+ {{headline}}
8
+ </h3>
9
+ {% if description is defined %}
10
+ <p class="{{prefix}}--table--description">
11
+ {{description|raw}}
12
+ </p>
13
+ {% endif %}
14
+ </header>
15
+ <div class="{{prefix}}--table--wrapper">
16
+ <table class="{{prefix}}--table--content">
17
+ <thead class="{{prefix}}--table--head">
18
+ <tr class="{{prefix}}--table--head--row">
19
+ {% for column in tableheadings %}
20
+ <th class="{{prefix}}--table--head--cell">{{column}}</th>
21
+ {% endfor %}
22
+ </tr>
23
+ </thead>
24
+ <tbody class="{{prefix}}--table--body">
25
+ {% for row in tabledata %}
26
+ <tr class="{{prefix}}--table--body--row">
27
+ {% for cell in row %}
28
+ {% set evaluate = cell|striptags|replace({'/': '', '-':'','_':'','.':'',}) %}
29
+ <td class="{{prefix}}--table--body--cell{% if evaluate matches '/^[0-9]+$/' %} numeric{% endif %}">{{cell|raw}}</td>
30
+ {% endfor %}
31
+ </tr>
32
+ {% endfor %}
33
+ </tbody>
34
+ </table>
35
+ </div>
36
+ </div>
@@ -0,0 +1,112 @@
1
+ table:
2
+ use: '@components/table/table.twig'
3
+ label: Table
4
+ description: A component for displaying data in a table
5
+ fields:
6
+ headline:
7
+ type: string
8
+ label: Headline
9
+ description: The table's headline
10
+ preview: "Headline"
11
+ required: true
12
+ toolip:
13
+ type: object
14
+ label: Tooltip
15
+ description: If there is a tooltip next to the headline, the tooltip's data
16
+ preview:
17
+ label: "tooltip"
18
+ icon: true
19
+ theme: "dark"
20
+ required: false
21
+ description:
22
+ type: string
23
+ label: Description
24
+ description: Descriptive copy to augment the table's headline
25
+ preview: "This is my descriptive copy.<br />It can contain some html: br, a, strong, em tags."
26
+ required: false
27
+ tableheadings:
28
+ type: object
29
+ label: Table Headings
30
+ description: The heading labels for the table's columns
31
+ preview:
32
+ - "Plain Text One"
33
+ - "Plain Text Two"
34
+ - "Plain Text With Links"
35
+ - "Numbers & Number Ranges"
36
+ - "Dates"
37
+ tabledata:
38
+ type: object
39
+ label: Table Data
40
+ description: The data of the table proper. Cells can include plain text or plain text with anchor tags.
41
+ preview:
42
+ -
43
+ - "table cell text one"
44
+ - "table cell text 1"
45
+ - "table cell <a href='http://www.ilo.org'>text one</a>"
46
+ - "1-20"
47
+ - "11/05/2022"
48
+ -
49
+ - "table cell text two"
50
+ - "table cell text 2"
51
+ - "table cell <a href='http://www.ilo.org'>text two<a>"
52
+ - "3"
53
+ - "7/19/2022"
54
+ -
55
+ - "table cell text three"
56
+ - "table cell text 3"
57
+ - "table cell <a href='http://www.ilo.org'>text three</a>"
58
+ - "75"
59
+ - "01/01/1975"
60
+ -
61
+ - "table cell text four"
62
+ - "table cell text 4"
63
+ - "table cell <a href='http://www.ilo.org'>text four</a>"
64
+ - "10-15"
65
+ - "01/01/2022"
66
+ -
67
+ - "table cell text five"
68
+ - "table cell text 5"
69
+ - "table cell <a href='http://www.ilo.org'>text five</a>"
70
+ - "5"
71
+ - "10/31/2022"
72
+ -
73
+ - "table cell text six"
74
+ - "table cell text 6"
75
+ - "table cell <a href='http://www.ilo.org'>text six</a>"
76
+ - "6"
77
+ - "08/13/2016"
78
+ -
79
+ - "table cell text seven"
80
+ - "table cell text 7"
81
+ - "table cell <a href='http://www.ilo.org'>text seven</a>"
82
+ - "7"
83
+ - "11/18/2013"
84
+ -
85
+ - "table cell text eight"
86
+ - "table cell text 8"
87
+ - "table cell <a href='http://www.ilo.org'>text eight</a>"
88
+ - "8"
89
+ - "12/31/1"
90
+ -
91
+ - "table cell text nine"
92
+ - "table cell text 9"
93
+ - "table cell <a href='http://www.ilo.org'>text nine</a>"
94
+ - "9"
95
+ - "01/01/1970"
96
+ -
97
+ - "table cell text ten"
98
+ - "table cell text 10"
99
+ - "table cell <a href='http://www.ilo.org'>text ten</a>"
100
+ - "10"
101
+ - "01/01/2023"
102
+ settings:
103
+ zebra:
104
+ type: select
105
+ label: Zebra Striping
106
+ description: Should the table display zebra striping?
107
+ options:
108
+ true: True
109
+ false: False
110
+ preview: false
111
+ required: false
112
+ visibility: storybook
@@ -0,0 +1,6 @@
1
+ /**
2
+ * table of contents
3
+ */
4
+ // Module template
5
+ import './tableofcontents.twig';
6
+ import './tableofcontents.wingsuit.yml';
@@ -0,0 +1,7 @@
1
+ import './index';
2
+
3
+ const patternDefinition = require('./tableofcontents.wingsuit.yml');
4
+
5
+ export const wingsuit = {
6
+ patternDefinition,
7
+ };
@@ -0,0 +1,14 @@
1
+ {#
2
+ TABLE OF CONTENTS COMPONENT
3
+ #}
4
+ {% if items %}
5
+ <nav class="{{prefix}}--table-of-contents">
6
+ <ul class="{{prefix}}--table-of-contents--list">
7
+ {% for item in items %}
8
+ <li class="{{prefix}}--table-of-contents--list--item">
9
+ <a class="{{prefix}}--table-of-contents--link" href="{{item.href}}">{{item.label}}</a>
10
+ </li>
11
+ {% endfor %}
12
+ </ul>
13
+ </nav>
14
+ {% endif %}
@@ -0,0 +1,22 @@
1
+ tableofcontents:
2
+ use: '@components/tableofcontents/tableofcontents.twig'
3
+ label: Table Of Contents
4
+ description: A component for displaying links internal to a page
5
+ fields:
6
+ items:
7
+ type: object
8
+ label: Items
9
+ description: The items in the table of contents.
10
+ required: true
11
+ preview:
12
+ - label: "Item One"
13
+ href: '#example'
14
+ - label: "Item Two"
15
+ href: '#example'
16
+ - label: "Item Three"
17
+ href: '#example'
18
+ - label: "Item Four"
19
+ href: '#example'
20
+ - label: "Item Five"
21
+ href: '#example'
22
+ visibility: storybook
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Tabs
3
+ */
4
+ // Module template
5
+ import './tabs.twig';
6
+ import './tabs.wingsuit.yml';
7
+ import './tabs.behavior.js';
@@ -0,0 +1,23 @@
1
+ import Tabs from './tabs';
2
+ import Tooltip from '../tooltip/tooltip';
3
+
4
+ Drupal.behaviors.tabs = {
5
+ attach() {
6
+ Array.prototype.forEach.call(
7
+ document.querySelectorAll(`[data-loadcomponent="Tabs"]`),
8
+ (element) => {
9
+ // eslint-disable-next-line no-console
10
+ console.log('loading Tabs component....');
11
+ new Tabs(element);
12
+ }
13
+ );
14
+ Array.prototype.forEach.call(
15
+ document.querySelectorAll(`[data-loadcomponent="Tooltip"]`),
16
+ (element) => {
17
+ // eslint-disable-next-line no-console
18
+ console.log('loading Tooltip component....');
19
+ new Tooltip(element);
20
+ }
21
+ );
22
+ },
23
+ };