@aarhus-university/au-lib-react-components 9.11.0 → 9.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint jsx-a11y/click-events-have-key-events: 0 */
|
|
3
3
|
/* eslint jsx-a11y/no-noninteractive-element-interactions: 0 */
|
|
4
4
|
/* eslint jsx-a11y/no-static-element-interactions: 0 */
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { useLayoutEffect } from 'react';
|
|
6
6
|
import ReactDOM from 'react-dom';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { hideModal } from '@aarhus-university/au-designsystem-delphinus/source/js/components/modal-view';
|
|
@@ -19,6 +19,17 @@ const AUModalComponent = (props) => {
|
|
|
19
19
|
className,
|
|
20
20
|
} = props;
|
|
21
21
|
|
|
22
|
+
useLayoutEffect(() => {
|
|
23
|
+
const modalView = document.getElementById(domId);
|
|
24
|
+
if (modalView) {
|
|
25
|
+
const header = modalView.querySelector('.modal-view__header');
|
|
26
|
+
if (header && !header.getAttribute('id')) {
|
|
27
|
+
header.setAttribute('id', `${domId}-header`);
|
|
28
|
+
modalView.setAttribute('aria-labelledby', `${domId}-header`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
22
33
|
return [
|
|
23
34
|
ReactDOM.createPortal(
|
|
24
35
|
<div
|
|
@@ -33,6 +44,7 @@ const AUModalComponent = (props) => {
|
|
|
33
44
|
type="button"
|
|
34
45
|
className="modal-view__close button button--icon button--icon--hide-label"
|
|
35
46
|
data-icon=""
|
|
47
|
+
data-gtm="au-btn-modal-close"
|
|
36
48
|
onClick={() => {
|
|
37
49
|
if (typeof onClose === 'function') {
|
|
38
50
|
onClose();
|
|
@@ -103,7 +103,7 @@ const AUTabbedContentComponent = ({
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
// eslint-disable-next-line jsx-a11y/control-has-associated-label
|
|
106
|
-
const renderTabs = tabs.map((tab) => <a key={tab.href} href={tab.href} className="nav__item" dangerouslySetInnerHTML={{ __html: tab.text }} />);
|
|
106
|
+
const renderTabs = tabs.map((tab) => <a key={tab.href} href={tab.href} className="nav__item" data-gtm={tab.dataGtm} dangerouslySetInnerHTML={{ __html: tab.text }} />);
|
|
107
107
|
|
|
108
108
|
return (
|
|
109
109
|
<div ref={tabsElement} className={classNames}>
|
|
@@ -17,16 +17,18 @@ const AUProfileWidgetComponent = React.memo(({
|
|
|
17
17
|
const renderSettings = settings.map((s) => {
|
|
18
18
|
const btnRef = useRef();
|
|
19
19
|
if (s.type === 'anchor') {
|
|
20
|
-
return <a key={s.url} className="sub-nav__item" href={s.url}>{s.text}</a>;
|
|
20
|
+
return <a key={s.url} className="sub-nav__item" href={s.url} data-gtm={s.dataGtm}>{s.text}</a>;
|
|
21
21
|
}
|
|
22
22
|
return (
|
|
23
23
|
<button
|
|
24
24
|
key={s.text}
|
|
25
25
|
ref={btnRef}
|
|
26
26
|
type="button"
|
|
27
|
+
disabled={s.disabled}
|
|
27
28
|
className={`sub-nav__item ${s.classNames}`}
|
|
28
29
|
onClick={() => s.onClick(btnRef.current)}
|
|
29
30
|
data-icon={s.icon}
|
|
31
|
+
data-gtm={s.dataGtm}
|
|
30
32
|
>
|
|
31
33
|
{s.text}
|
|
32
34
|
</button>
|
|
@@ -49,6 +51,7 @@ const AUProfileWidgetComponent = React.memo(({
|
|
|
49
51
|
className="copy-to-clipboard"
|
|
50
52
|
title={profileLabels[lang].copyAuid}
|
|
51
53
|
aria-label={`${profileLabels[lang].auId}: AU${auid}`}
|
|
54
|
+
data-gtm="au-btn-header-copy-auid"
|
|
52
55
|
>
|
|
53
56
|
{`${profileLabels[lang].auId}: `}
|
|
54
57
|
<span className="copy-to-clipboard__this">{`AU${auid}`}</span>
|
|
@@ -73,7 +76,7 @@ const AUProfileWidgetComponent = React.memo(({
|
|
|
73
76
|
{
|
|
74
77
|
changeLanguageUrl && (
|
|
75
78
|
<>
|
|
76
|
-
<a className="sub-nav__item sub-nav__item--icon" href={changeLanguageUrl} data-icon="">{profileLabels[lang].changeLanguage}</a>
|
|
79
|
+
<a className="sub-nav__item sub-nav__item--icon" href={changeLanguageUrl} data-icon="" data-gtm="au-btn-header-profile-changelanguage">{profileLabels[lang].changeLanguage}</a>
|
|
77
80
|
<hr />
|
|
78
81
|
</>
|
|
79
82
|
)
|
|
@@ -81,6 +84,7 @@ const AUProfileWidgetComponent = React.memo(({
|
|
|
81
84
|
<a
|
|
82
85
|
className="sub-nav__item sub-nav__item--icon"
|
|
83
86
|
data-icon=""
|
|
87
|
+
data-gtm="au-a-header-signout"
|
|
84
88
|
href={logoutUri}
|
|
85
89
|
>
|
|
86
90
|
{profileLabels[lang].logout}
|