@aarhus-university/au-lib-react-components 8.20.2 → 8.82.0

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 (167) hide show
  1. package/.eslintrc.js +44 -0
  2. package/README.md +19 -20
  3. package/babel.config.js +7 -0
  4. package/build/umd/all.css +1 -2
  5. package/build/umd/all.css.map +1 -1
  6. package/build/umd/all.js +1 -1
  7. package/build/umd/all.js.map +1 -1
  8. package/build/umd/alphabox.js +1 -1
  9. package/build/umd/alphabox.js.map +1 -1
  10. package/build/umd/databox.js +1 -6
  11. package/build/umd/databox.js.map +1 -1
  12. package/build/umd/diagramme.js +1 -1
  13. package/build/umd/diagramme.js.map +1 -1
  14. package/build/umd/flowbox.js +1 -1
  15. package/build/umd/flowbox.js.map +1 -1
  16. package/build/umd/universe.js +1 -1
  17. package/build/umd/universe.js.map +1 -1
  18. package/package.json +66 -65
  19. package/src/components/AUAlertComponent.tsx +70 -0
  20. package/src/components/{AutoSuggestComponent.js → AUAutoSuggestComponent.js} +45 -19
  21. package/src/components/AUCalendarComponent.tsx +493 -0
  22. package/src/components/AUContentToggleComponent.tsx +33 -0
  23. package/src/components/AUDatepickerComponent.tsx +117 -0
  24. package/src/components/AUMobilePrefixComponent.tsx +15 -0
  25. package/src/components/{delphinus/AUModalComponent.js → AUModalComponent.tsx} +78 -76
  26. package/src/components/{form/AUReceiptComponent.js → AUReceiptComponent.tsx} +33 -40
  27. package/src/components/AUSpinnerComponent.tsx +64 -0
  28. package/src/components/{delphinus/AUSubNavComponent.js → AUSubNavComponent.tsx} +38 -53
  29. package/src/components/{form/AUSubmitButtonContainerComponent.js → AUSubmitButtonContainerComponent.tsx} +31 -39
  30. package/src/components/AUTabbedContentComponent.tsx +145 -0
  31. package/src/components/{delphinus/AUTableComponent.js → AUTableComponent.tsx} +24 -28
  32. package/src/components/{delphinus/AUToastComponent.js → AUToastComponent.tsx} +104 -91
  33. package/src/components/{delphinus/AUToolbarComponent.js → AUToolbarComponent.tsx} +45 -48
  34. package/src/components/profile/AUProfileActions.js +128 -113
  35. package/src/components/profile/AUProfileAvatarComponent.js +83 -83
  36. package/src/components/profile/AUProfileAvatarV2Component.js +91 -0
  37. package/src/components/profile/AUProfileAvatarV3Component.tsx +42 -0
  38. package/src/components/profile/AUProfileContainerComponent.js +283 -285
  39. package/src/components/profile/AUProfileHooks.js +30 -30
  40. package/src/components/profile/AUProfileItemComponent.js +54 -54
  41. package/src/components/profile/AUProfileLanguageComponent.js +131 -131
  42. package/src/components/profile/{AUProfileLoginComponent.js → AUProfileLoginComponent.tsx} +3 -18
  43. package/src/components/profile/AUProfileMailComponent.js +307 -299
  44. package/src/components/profile/AUProfileMobileComponent.js +164 -164
  45. package/src/components/profile/AUProfileNameComponent.js +253 -253
  46. package/src/components/profile/AUProfileNextOfKinComponent.js +216 -216
  47. package/src/components/profile/AUProfileReducer.js +230 -210
  48. package/src/components/profile/AUProfileWidgetComponent.js +95 -95
  49. package/src/components/profile/AUProfileWidgetV2Component.js +116 -0
  50. package/src/components/profile/AUProfileWidgetV3Component.tsx +122 -0
  51. package/src/components/wrapping/AUEmbedComponent.js +47 -47
  52. package/src/{components → layout-2016/components}/alphabox/AlphaBoxComponent.js +29 -28
  53. package/src/{components → layout-2016/components}/alphabox/AlphaBoxContentComponent.js +25 -14
  54. package/src/{components → layout-2016/components/common}/AUCollapsibleComponent.js +1 -22
  55. package/src/{components → layout-2016/components/common}/AUSpinnerComponent.js +2 -24
  56. package/src/{components → layout-2016/components}/databox/DataBoxAlphabetComponent.js +1 -1
  57. package/src/{components → layout-2016/components}/databox/DataBoxAssociationComponent.js +2 -2
  58. package/src/{components → layout-2016/components}/databox/DataBoxButtonComponent.js +7 -3
  59. package/src/{components → layout-2016/components}/databox/DataBoxComponent.js +2 -2
  60. package/src/{components → layout-2016/components}/databox/DataBoxGroupingComponent.js +2 -0
  61. package/src/{components → layout-2016/components}/databox/DataBoxSearchResultComponent.js +1 -5
  62. package/src/{components → layout-2016/components}/databox/DataBoxStackedAssociationComponent.js +1 -5
  63. package/src/{components → layout-2016/components}/databox/DataBoxSuggestionComponent.js +0 -0
  64. package/src/{components → layout-2016/components/diagramme}/AUDiagrammeComponent.js +5 -6
  65. package/src/{components → layout-2016/components}/flowbox/FlowBoxComponent.js +8 -8
  66. package/src/{components → layout-2016/components}/flowbox/FlowBoxPhoneComponent.js +3 -5
  67. package/src/{components → layout-2016/components}/profile/AUProfileAvatar2016Component.js +6 -2
  68. package/src/{components → layout-2016/components}/universe/StaffTopComponent.js +4 -3
  69. package/src/{components → layout-2016/components}/universe/StudentTopComponent.js +0 -0
  70. package/src/{components → layout-2016/components}/universe/UniverseContainerComponent.js +11 -8
  71. package/src/layout-2016/lib/all.js +3 -0
  72. package/src/{lib → layout-2016/lib}/au-alphabox.js +1 -3
  73. package/src/{lib → layout-2016/lib}/au-databox.js +6 -9
  74. package/src/{lib → layout-2016/lib}/au-diagramme.js +2 -4
  75. package/src/{lib → layout-2016/lib}/au-flowbox.js +1 -3
  76. package/src/{lib → layout-2016/lib}/universe.js +0 -0
  77. package/src/lib/{helpers.js → helpers.ts} +41 -66
  78. package/src/{components/delphinus/hooks.js → lib/hooks.ts} +33 -26
  79. package/src/lib/{i18n.js → i18n.ts} +600 -595
  80. package/src/lib/tracking.ts +69 -0
  81. package/src/lib/{wrapping.js → wrapping.ts} +21 -16
  82. package/src/styles/_settings.scss +11 -11
  83. package/src/styles/alphabox.scss +222 -209
  84. package/src/styles/app.scss +7 -12
  85. package/src/styles/autosuggest.scss +57 -57
  86. package/src/styles/databox.scss +563 -563
  87. package/src/styles/diagramme.scss +119 -119
  88. package/src/styles/flowbox.scss +72 -72
  89. package/src/styles/maps.scss +396 -0
  90. package/tsconfig.json +47 -0
  91. package/types/common/interfaces.d.ts +91 -0
  92. package/types/common/main.d.ts +4 -0
  93. package/types/common/package.json +5 -0
  94. package/types/common/payloads.d.ts +0 -0
  95. package/types/common/props.d.ts +165 -0
  96. package/webpack.config.js +89 -0
  97. package/.eslintrc +0 -19
  98. package/DOCUMENTATION.md +0 -369
  99. package/build/cjs/auAuth.js +0 -2
  100. package/build/cjs/auAuth.js.map +0 -1
  101. package/build/dev.html +0 -329
  102. package/build/umd/auAuth.js +0 -2
  103. package/build/umd/auAuth.js.map +0 -1
  104. package/build/umd/news.js +0 -2
  105. package/build/umd/news.js.map +0 -1
  106. package/src/all.js +0 -3
  107. package/src/app.js +0 -263
  108. package/src/components/AUAlertComponent.js +0 -158
  109. package/src/components/AUAmountComponent.js +0 -84
  110. package/src/components/AUBannerComponent.js +0 -99
  111. package/src/components/AUCalendarComponent.js +0 -393
  112. package/src/components/AUDatepickerComponent.js +0 -105
  113. package/src/components/AUFilterCheckboxComponent.js +0 -122
  114. package/src/components/AUFocusComponent.js +0 -55
  115. package/src/components/AUModalComponent.js +0 -94
  116. package/src/components/AUPaginationComponent.js +0 -103
  117. package/src/components/context/AUUserContextComponent.js +0 -91
  118. package/src/components/context/ImpersonateComponent.js +0 -54
  119. package/src/components/delphinus/AUCalendarComponent.js +0 -422
  120. package/src/components/delphinus/AUContentToggleComponent.js +0 -32
  121. package/src/components/delphinus/AUDatepickerComponent.js +0 -113
  122. package/src/components/delphinus/AULoginComponent.js +0 -65
  123. package/src/components/delphinus/AUSpinnerComponent.js +0 -114
  124. package/src/components/delphinus/AUTabbedContentComponent.js +0 -53
  125. package/src/components/form/AUMobilePrefixComponent.js +0 -18
  126. package/src/components/news/EventLayout1Component.js +0 -94
  127. package/src/components/news/EventLayout2Component.js +0 -90
  128. package/src/components/news/EventLayout3Component.js +0 -68
  129. package/src/components/news/NewsCategoriesComponent.js +0 -21
  130. package/src/components/news/NewsCollageBannerComponent.js +0 -71
  131. package/src/components/news/NewsColumnsComponent.js +0 -125
  132. package/src/components/news/NewsLanguageChangeComponent.js +0 -74
  133. package/src/components/news/NewsLayout1Component.js +0 -80
  134. package/src/components/news/NewsLayout2Component.js +0 -80
  135. package/src/components/news/NewsLayout3Component.js +0 -81
  136. package/src/components/news/NewsLayout4Component.js +0 -80
  137. package/src/components/news/NewsLayout5Component.js +0 -61
  138. package/src/components/news/NewsLayout6Component.js +0 -55
  139. package/src/components/news/NewsLayout7Component.js +0 -58
  140. package/src/components/news/NewsLayout8Component.js +0 -57
  141. package/src/components/news/NewsListComponent.js +0 -291
  142. package/src/components/news/NewsPopUpComponent.js +0 -591
  143. package/src/components/news/NewsRSSComponent.js +0 -74
  144. package/src/components/news/NewsSocialComponent.js +0 -104
  145. package/src/components/news/NewsSubHeaderComponent.js +0 -19
  146. package/src/components/password/AUChangePasswordComponent.js +0 -177
  147. package/src/components/password/AUCurrentPasswordComponent.js +0 -72
  148. package/src/components/password/AUNewPasswordComponent.js +0 -143
  149. package/src/components/password/AUPasswordActions.js +0 -101
  150. package/src/components/password/AUPasswordHooks.js +0 -47
  151. package/src/components/password/AUPasswordReducer.js +0 -78
  152. package/src/components/password/AUPasswordRequirementsComponent.js +0 -29
  153. package/src/config/webpack.cjs.config.js +0 -75
  154. package/src/config/webpack.dev.config.js +0 -61
  155. package/src/config/webpack.umd.config.js +0 -107
  156. package/src/index.js +0 -6
  157. package/src/lib/au-auth.js +0 -221
  158. package/src/lib/au-news.js +0 -306
  159. package/src/lib/menu.js +0 -10
  160. package/src/lib/urlHandler.js +0 -63
  161. package/src/lib/validation.js +0 -181
  162. package/src/styles/alert.scss +0 -39
  163. package/src/styles/calendar.scss +0 -112
  164. package/src/styles/filtercheckbox.scss +0 -5
  165. package/src/styles/modal.scss +0 -35
  166. package/src/styles/pagination.scss +0 -11
  167. package/src/styles/spinner.scss +0 -30
@@ -1,306 +0,0 @@
1
- /* eslint-env browser */
2
- /* eslint max-classes-per-file: 0 */
3
- import React from 'react';
4
- import ReactDOM from 'react-dom';
5
- import NewsListComponent from '../components/news/NewsListComponent';
6
- import NewsPopUpComponent from '../components/news/NewsPopUpComponent';
7
- import NewsCollageBannerComponent from '../components/news/NewsCollageBannerComponent';
8
- import { isElementInViewport } from './helpers';
9
-
10
- const AUNewsConfig = {
11
- server: window.newsServer || '//news.au.dk',
12
- newsUrl: `${window.location.href.replace(window.location.hash, '').replace('#', '')}#news-`,
13
- useOverlay: !(typeof window.useOverlay !== 'undefined' && !window.useOverlay),
14
- useSyndication: !(typeof window.useSyndication !== 'undefined' && !window.useSyndication),
15
- tagStrip: new RegExp(/<(?!\/?sub|sup(?=>|\s.*>))\/?.*?>/ig),
16
- };
17
-
18
- class AUNewsHelpers {
19
- static typeIdToText(_id) {
20
- let id = _id;
21
- id = parseInt(id, 10);
22
- if (id === 0 || id === 2) {
23
- return 'news';
24
- }
25
- if (id === 4 || id === 7) {
26
- return 'event';
27
- }
28
- if (id === 9) {
29
- return 'notice';
30
- }
31
- return '';
32
- }
33
-
34
- static getEventDates(item, lang) {
35
- const fromDateSplit = item.event_from.date.split('.');
36
- let fromDate;
37
- if (lang === 'en') {
38
- fromDate = new Date(
39
- parseInt(fromDateSplit[0], 10),
40
- parseInt(fromDateSplit[1], 10) - 1,
41
- parseInt(fromDateSplit[2], 10),
42
- );
43
- } else {
44
- fromDate = new Date(
45
- parseInt(fromDateSplit[2], 10),
46
- parseInt(fromDateSplit[1], 10) - 1,
47
- parseInt(fromDateSplit[0], 10),
48
- );
49
- }
50
-
51
- const toDateSplit = item.event_to.date.split('.');
52
- let toDate;
53
- if (lang === 'en') {
54
- toDate = new Date(
55
- parseInt(toDateSplit[0], 10),
56
- parseInt(toDateSplit[1], 10) - 1,
57
- parseInt(toDateSplit[2], 10),
58
- );
59
- } else {
60
- toDate = new Date(
61
- parseInt(toDateSplit[2], 10),
62
- parseInt(toDateSplit[1], 10) - 1,
63
- parseInt(toDateSplit[0], 10),
64
- );
65
- }
66
-
67
- return {
68
- fromDate,
69
- toDate,
70
- fromDateSplit,
71
- toDateSplit,
72
- };
73
- }
74
-
75
- static setExternal(_item) {
76
- const item = _item;
77
- const ttType = parseInt(item.type, 10);
78
- item.external = ttType !== 0 && ttType !== 4 && ttType !== 9;
79
- // "News" eller "Event" eller "Notice"
80
- item.url = !item.external
81
- && AUNewsConfig.useOverlay ? (AUNewsConfig.newsUrl + item.id) : item.permalink;
82
- return item;
83
- }
84
-
85
- static getNewsID(search) {
86
- const reNewsId = /^#?news-(.*)$/;
87
- const match = search.match(reNewsId);
88
- if (match !== null) {
89
- return match[1];
90
- }
91
-
92
- return -1;
93
- }
94
-
95
- static isiPad() {
96
- return (/iPad/i).test(navigator.userAgent);
97
- }
98
- }
99
-
100
- class AUNews {
101
- constructor(lang, feeds) {
102
- this.lang = lang;
103
- this.feeds = feeds || [];
104
- this.item = null;
105
- this.setItem = this.setItem.bind(this);
106
- }
107
-
108
- setItem(item) {
109
- this.item = item;
110
- }
111
-
112
- setPopUp() {
113
- const qsNewsPrint = AU.helpers.getQuerystring('newsprint');
114
- const print = qsNewsPrint !== '';
115
- const openPopUp = () => {
116
- const newsID = AUNewsHelpers.getNewsID(window.location.hash);
117
- let mountNode = document.getElementById('au_news_popup');
118
- if (print) {
119
- mountNode = document.querySelector('body');
120
- }
121
- if (parseInt(newsID, 10) > -1) {
122
- if (this.item != null) {
123
- const trackerLink = `/virtual/news/${AUNewsHelpers.typeIdToText(this.item.type)}/open-list/id-${this.item.id}/${this.item.permalink}`;
124
- AU.tracking.trackSingle(trackerLink);
125
- }
126
- // Would like to use portal here, but it won't work "standalone"
127
- ReactDOM.render(
128
- <NewsPopUpComponent
129
- id={newsID}
130
- item={this.item}
131
- lang={this.lang}
132
- print={print}
133
- />,
134
- mountNode,
135
- );
136
- } else if (window.location.hash === '' || window.location.hash === '#') { // Thx IE!
137
- ReactDOM.unmountComponentAtNode(mountNode);
138
- }
139
- };
140
-
141
- openPopUp();
142
-
143
- window.addEventListener('hashchange', () => {
144
- openPopUp();
145
- });
146
-
147
- const fade = document.getElementById('fade');
148
- fade.addEventListener('click', () => {
149
- window.location.hash = '';
150
- });
151
- }
152
-
153
- init() {
154
- this.setPopUp();
155
- this.feeds.forEach((f) => {
156
- const list = f;
157
- list.container = document.querySelector(`#au_news-list_${list.id}`);
158
- list.items = [];
159
- list.page = 1;
160
- const elements = AUNews.getElementFormatArray(list);
161
- const mountNode = list.container;
162
- if (mountNode) {
163
- ReactDOM.render(
164
- <NewsListComponent
165
- lang={this.lang}
166
- list={list}
167
- elements={elements}
168
- setItem={this.setItem}
169
- />,
170
- mountNode,
171
- );
172
- }
173
- });
174
- }
175
-
176
- static getElementFormatArray(_list) {
177
- const list = _list;
178
- const elements = [];
179
- const rowSplit = list.format.split(',');
180
- let formatCount = 0;
181
- for (let r = 0; r < rowSplit.length; r += 1) {
182
- const element = rowSplit[r];
183
- if (element !== '|') {
184
- if (element.indexOf('|') > -1) {
185
- const columns = [];
186
- const columnSplit = element.split('|');
187
- for (let c = 0; c < columnSplit.length; c += 1) {
188
- const columnElements = [];
189
- const columnElementsSplit = columnSplit[c].split(';');
190
- for (let e = 0; e < columnElementsSplit.length; e += 1) {
191
- columnElements.push(columnElementsSplit[e]);
192
- list.lastelement = columnElementsSplit[e];
193
- list.lastiscolumn = true;
194
- formatCount += 1;
195
- }
196
- columns.push(columnElements);
197
- }
198
- elements.push(columns);
199
- } else {
200
- elements.push(element);
201
- list.lastiscolumn = false;
202
- list.lastelement = element;
203
- formatCount += 1;
204
- }
205
- }
206
- }
207
-
208
- if (list.page === 1) {
209
- list.amount = formatCount;
210
- }
211
-
212
- return elements;
213
- }
214
- }
215
-
216
- class AUNewsCollage {
217
- constructor(lang, element) {
218
- this.element = element;
219
- this.loaded = false;
220
- this.lang = lang;
221
- window.addEventListener('scroll', () => {
222
- this.init();
223
- });
224
- }
225
-
226
- loadData(key, callback) {
227
- const url = `${AUNewsConfig.server}/index.php?eID=getAuNewsFeed&mode=key&key=${key}&index=0&amount=4&noPageBrowser=1&lang=${this.lang}&callback=?`;
228
- $.ajax({
229
- url,
230
- dataType: 'json',
231
- jsonpCallback: url.hashCode(),
232
- jsonp: true,
233
- cache: true,
234
- success: (data) => {
235
- if (typeof callback === 'function') {
236
- callback(data);
237
- }
238
- },
239
- });
240
- }
241
-
242
- init() {
243
- if (!this.loaded && isElementInViewport(this.element)) {
244
- const newsElements = [
245
- document.querySelector('#news1'),
246
- document.querySelector('#news2'),
247
- document.querySelector('#news3'),
248
- document.querySelector('#news4'),
249
- ];
250
-
251
- const eventElements = [
252
- document.querySelector('#event1'),
253
- document.querySelector('#event2'),
254
- document.querySelector('#event3'),
255
- ];
256
-
257
- // News
258
- const newsFeedKey = this.lang === 'da' ? 'b73f5e9759ac3592043449c02dcffa56' : '400bcbb4807a5a722df5e2045fa7966f';
259
- this.loadData(newsFeedKey, (data) => {
260
- newsElements.forEach((e, i) => {
261
- if (data[i]) {
262
- ReactDOM.render(
263
- <NewsCollageBannerComponent
264
- type="news"
265
- item={AUNewsHelpers.setExternal(data[i])}
266
- title={this.lang === 'da' ? 'Nyhed' : 'News'}
267
- lang={this.lang}
268
- />,
269
- e,
270
- );
271
- } else {
272
- e.style.display = 'none';
273
- }
274
- });
275
- });
276
- // Events
277
- const eventFeedKey = this.lang === 'da' ? '003383f99d8ae70cde9110294ab39727' : '19a8aa9cc30143d2e41cfbdb4123541e';
278
- this.loadData(eventFeedKey, (data) => {
279
- eventElements.forEach((e, i) => {
280
- if (data[i]) {
281
- ReactDOM.render(
282
- <NewsCollageBannerComponent
283
- type="events"
284
- item={AUNewsHelpers.setExternal(data[i])}
285
- title={this.lang === 'da' ? 'Arrangement' : 'Event'}
286
- lang={this.lang}
287
- />,
288
- e,
289
- );
290
- } else {
291
- e.style.display = 'none';
292
- }
293
- });
294
- });
295
-
296
- this.loaded = true;
297
- }
298
- }
299
- }
300
-
301
- window.AUNews = AUNews;
302
- window.AUNewsCollage = AUNewsCollage;
303
- export {
304
- AUNewsConfig,
305
- AUNewsHelpers,
306
- };
package/src/lib/menu.js DELETED
@@ -1,10 +0,0 @@
1
- import axios from 'axios';
2
-
3
- const getSubPages = (url) => {
4
- axios.get(url).then((promise) => {
5
- const { subPages } = promise.data;
6
- return subPages;
7
- });
8
- };
9
-
10
- export default getSubPages;
@@ -1,63 +0,0 @@
1
- /* eslint-env browser */
2
- /* eslint no-restricted-syntax: 0 */
3
- /* eslint no-prototype-builtins: 0 */
4
- class AUUrlHandler {
5
- constructor(onPopState, useHistory = true) {
6
- this.useHistory = useHistory;
7
-
8
- if (typeof onPopState === 'function') {
9
- window.onpopstate = (event) => {
10
- onPopState(event);
11
- };
12
- }
13
- }
14
-
15
- static getQuery(index = 1) {
16
- return window.location.search.substring(index); // 1 = without ?
17
- }
18
-
19
- static parse() {
20
- const query = AUUrlHandler.getQuery();
21
- if (query === '') {
22
- return null;
23
- }
24
- const objString = `{"${query.replace(/&/g, '","').replace(/=/g, '":"')}"}`;
25
- return JSON.parse(objString, (key, value) => (key === '' ? value : decodeURIComponent(value)));
26
- }
27
-
28
- static serialize(obj) {
29
- const str = [];
30
- for (const p in obj) {
31
- if (obj.hasOwnProperty(p) && obj[p] !== '') {
32
- str.push(`${encodeURIComponent(p)}=${encodeURIComponent(obj[p])}`);
33
- }
34
- }
35
- return str.join('&');
36
- }
37
-
38
- set(query, append = true, title = '') {
39
- const { key, value } = query;
40
-
41
- const current = AUUrlHandler.parse() || {};
42
- current[key] = value;
43
-
44
- const { location: { protocol, host, pathname } } = window;
45
- let next = `?${AUUrlHandler.serialize(current)}`;
46
- if (next === '?') {
47
- next = `${protocol}//${host}${pathname}`;
48
- } else {
49
- next = `${pathname}${next}`;
50
- }
51
- if (this.useHistory) {
52
- if (append) {
53
- window.history.pushState('', title, next);
54
- } else {
55
- window.history.replaceState('', title, next);
56
- }
57
- } else {
58
- window.location.search = next;
59
- }
60
- }
61
- }
62
-
63
- export default AUUrlHandler;
@@ -1,181 +0,0 @@
1
- import React from 'react';
2
- import { passwordLabels } from './i18n';
3
-
4
- const emailRegex = /^(?=.{6,320}$)([0-9A-Za-z]([0-9A-Za-z\x21\x23\x24\x25\x26\x27\x2a\x2b\x2f\x3d\x3f\x5e\x5f\x60\x7b\x7c\x7d\x7e\x2d\x2e]{0,62}[0-9A-Za-z])?\x40(?=.{4,255}$)(([0-9A-Za-z]([0-9A-Za-z\x2d]{0,254}[0-9A-Za-z])?\x2e)+[0-9A-Za-z]([0-9A-Za-z\x2d]{0,254}[0-9A-Za-z])?))$/;
5
- const studentRegistrationNumberRegex = /^[a-zA-Z0-9]{3,12}$/;
6
- const auIdRegex = /^au[1-9]([0-9]{0,8})$/;
7
-
8
- const renderValidation = (messages) => messages.map(
9
- (message) => <span key={message} className="form-info__message">{message}</span>,
10
- );
11
-
12
- const validateForm = (lang, fieldValue, rulesAndMessages = []) => {
13
- let valid = true;
14
- const validationMessages = [];
15
- rulesAndMessages.forEach((rm) => {
16
- if (!rm.rule(fieldValue)) {
17
- valid = false;
18
- validationMessages.push(rm.message);
19
- }
20
- });
21
-
22
- if (valid) {
23
- validationMessages.push(passwordLabels[lang].allGood);
24
- }
25
-
26
- return [valid, validationMessages];
27
- };
28
-
29
- const validatePassword = (lang, newPassword, confirmPassword, blur = false, submit = false) => {
30
- const length = 12;
31
- const lowerLetters = /([a-z])/g;
32
- const upperLetters = /([A-Z])/g;
33
- const invalidLetters = /([æøåÆØÅ])/g;
34
- const numbers = /([0-9])/g;
35
- const special = /~|!|@|#|\$|%|\^|&|\*|_|-|\+|=|`|\||\(|\)|{|}|\[|\]|:|;|"|'|<|>|,|\.|\?|\//g;
36
- const spaces = /\s/g;
37
- const all = new RegExp(`${lowerLetters.source}|${upperLetters.source}|${invalidLetters.source}|${numbers.source}|${special.source}|${spaces.source}`);
38
-
39
- let newPasswordValid = false;
40
- const newPasswordMessages = [];
41
- let confirmPasswordValid = false;
42
- const confirmPasswordMessages = [];
43
-
44
- const map = new Map();
45
- Object.entries(passwordLabels[lang].rules).forEach((label) => {
46
- map.set(label[0], label[1].replace('###LENGTH###', length));
47
- });
48
-
49
- let key = '';
50
-
51
- if (newPassword.length > 0) {
52
- if (newPassword.length >= length || blur) {
53
- newPasswordValid = true;
54
- if (newPassword.match(invalidLetters)) {
55
- newPasswordMessages.push(map.get('invalid'));
56
- newPasswordValid = false;
57
- }
58
-
59
- if (newPassword.match(spaces)) {
60
- newPasswordMessages.push(map.get('spaces'));
61
- newPasswordValid = false;
62
- }
63
-
64
- let invalidSpecialFound = false;
65
- newPassword.split('').forEach((char) => {
66
- if (!char.match(all)) {
67
- invalidSpecialFound = true;
68
- }
69
- });
70
-
71
- if (invalidSpecialFound) {
72
- newPasswordMessages.push(map.get('specialchars'));
73
- newPasswordValid = false;
74
- }
75
-
76
- let cases = 0;
77
- if (!newPassword.match(lowerLetters)) {
78
- key = `${key}lower`;
79
- cases += 1;
80
- }
81
-
82
- if (!newPassword.match(upperLetters)) {
83
- key = `${key}upper`;
84
- cases += 1;
85
- }
86
-
87
- if (!newPassword.match(numbers)) {
88
- key = `${key}numbers`;
89
- cases += 1;
90
- }
91
-
92
- if (!newPassword.match(special)) {
93
- key = `${key}special`;
94
- cases += 1;
95
- }
96
-
97
- if (cases > 1) {
98
- newPasswordValid = false;
99
- }
100
-
101
- if (newPassword.length < length) {
102
- newPasswordMessages.push(map.get('length'));
103
- newPasswordValid = false;
104
- }
105
- } else {
106
- if (newPassword.match(invalidLetters)) {
107
- newPasswordMessages.push(map.get('invalid'));
108
- newPasswordValid = false;
109
- }
110
-
111
- if (newPassword.match(spaces)) {
112
- newPasswordMessages.push(map.get('spaces'));
113
- newPasswordValid = false;
114
- }
115
-
116
- let invalidSpecialFound = false;
117
- newPassword.split('').forEach((char) => {
118
- if (!char.match(all)) {
119
- invalidSpecialFound = true;
120
- }
121
- });
122
-
123
- if (invalidSpecialFound) {
124
- newPasswordMessages.push(map.get('specialchars'));
125
- newPasswordValid = false;
126
- }
127
-
128
- if (newPassword.length < length && blur) {
129
- newPasswordMessages.push(map.get('length'));
130
- newPasswordValid = false;
131
- }
132
- }
133
-
134
- console.log(key);
135
-
136
- const mapKey = map.get(key);
137
- if (typeof mapKey !== 'undefined') {
138
- newPasswordMessages.push(mapKey);
139
- }
140
-
141
- if (newPasswordValid) {
142
- newPasswordMessages.push(passwordLabels[lang].allRequirements);
143
- }
144
-
145
- if (confirmPassword.length >= newPassword.length
146
- || ((blur || submit) && confirmPassword.length > 0)) {
147
- if (confirmPassword === newPassword) {
148
- confirmPasswordMessages.push(passwordLabels[lang].passwordsEqual);
149
- confirmPasswordValid = true;
150
- } else {
151
- confirmPasswordMessages.push(passwordLabels[lang].passwordsNotEqual);
152
- }
153
- }
154
- }
155
-
156
- if (submit) {
157
- if (newPassword === '') {
158
- newPasswordValid = false;
159
- newPasswordMessages.push(passwordLabels[lang].typeNew);
160
- } else if (confirmPassword === '') {
161
- confirmPasswordValid = false;
162
- confirmPasswordMessages.push(passwordLabels[lang].repeatNew);
163
- }
164
- }
165
-
166
- return {
167
- newPasswordValid,
168
- newPasswordMessages,
169
- confirmPasswordValid,
170
- confirmPasswordMessages,
171
- };
172
- };
173
-
174
- export {
175
- emailRegex,
176
- studentRegistrationNumberRegex,
177
- auIdRegex,
178
- renderValidation,
179
- validatePassword,
180
- validateForm,
181
- };
@@ -1,39 +0,0 @@
1
- /* alert */
2
- .au-alert {
3
- position: fixed;
4
- z-index: 100;
5
- left: 50%;
6
- top: 50%;
7
- transform: translate(-50%, -50%);
8
- width: 300px;
9
- background-color: #fff;
10
- padding: 1.3636364rem;
11
-
12
- button {
13
- margin-top: 1rem;
14
- margin-bottom: 0;
15
- padding: .65rem 2rem;
16
-
17
- &.confirm {
18
- background-color: $alert-confirm-color;
19
- }
20
-
21
- &.cancel {
22
- background-color: $alert-cancel-color;
23
- }
24
-
25
- &:first-of-type {
26
- margin-right: 1rem;
27
- }
28
- }
29
- }
30
-
31
- .au-alert-overlay, .au-modal-overlay {
32
- position: fixed;
33
- top: 0;
34
- right: 0;
35
- bottom: 0;
36
- left: 0;
37
- background-color: rgba(0, 0, 0, .6);
38
- z-index: 99;
39
- }
@@ -1,112 +0,0 @@
1
- @import "_settings";
2
- $color-selected: #8bad3f;
3
- $color-empty: #f5f5f5;
4
- $color-weekend: #ddd;
5
- $color-border: #ccc;
6
-
7
- .au-calendar {
8
- background-color: #fff;
9
- font-family: $font-passata-regular;
10
- width: 224px;
11
-
12
- .au-calendar-days {
13
- display: flex;
14
- flex-wrap: wrap;
15
- margin-bottom: 1rem;
16
-
17
- > span, > button {
18
- width: 32px;
19
- height: 32px;
20
- text-align: center;
21
- text-transform: uppercase;
22
- line-height: 1;
23
- font-size: 1rem;
24
- }
25
-
26
- > span {
27
- padding-top: 8px;
28
- }
29
-
30
- > button {
31
- font-family: $font-passata-regular;
32
- cursor: pointer;
33
-
34
- &.empty {
35
- background-color: $color-empty;
36
- }
37
-
38
- &.weekend:not(.empty) {
39
- background-color: $color-weekend;
40
- }
41
-
42
- &.selected {
43
- border: 2px solid $color-selected;
44
- }
45
- }
46
- }
47
-
48
- .au-calendar-year-month, .au-calendar-time {
49
- display: flex;
50
- justify-content: space-between;
51
-
52
- > select {
53
- width: 108px;
54
- font-size: 1.090909rem;
55
- margin-bottom: 0;
56
- }
57
- }
58
-
59
- > button {
60
- font-family: $font-passata-regular;
61
- text-align: center;
62
- background-color: $color-selected;
63
- width: 100%;
64
- padding: 1rem;
65
- margin-top: 1rem;
66
- color: #fff;
67
- cursor: pointer;
68
- }
69
- }
70
-
71
- .au-datepicker {
72
- position: relative;
73
-
74
- input[type="text"][readonly] {
75
- background-color: #fff;
76
- cursor: auto;
77
-
78
- ~ div {
79
- position: absolute;
80
- right: 0;
81
- z-index: 1000;
82
- width: 230px;
83
- border-right: 1px solid $color-border;
84
- border-left: 1px solid $color-border;
85
- }
86
- }
87
-
88
- .au-calendar {
89
- border-bottom: 1px solid $color-border;
90
- padding: 2px;
91
- top: 5.54545rem;
92
- }
93
-
94
- .au-calendar-close {
95
- top: 3.54545rem;
96
- height: 2rem;
97
- background-color: #fff;
98
-
99
- button {
100
- position: absolute;
101
- top: 3px;
102
- right: 3px;
103
- font-family: 'au_icons';
104
- font-size: 1.5rem;
105
- margin: 0;
106
- padding: 0;
107
- background: transparent !important;
108
- color: #000;
109
- cursor: pointer;
110
- }
111
- }
112
- }
@@ -1,5 +0,0 @@
1
- .au-filter-checkbox {
2
- li:not(.visible) {
3
- display: none;
4
- }
5
- }