@aarhus-university/au-lib-react-components 10.19.0 → 10.19.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.
- package/package.json +3 -3
- package/src/components/AUButtonComponent.tsx +3 -1
- package/src/components/AUSubmitButtonContainerComponent.tsx +12 -14
- package/src/components/AUToastComponent.tsx +8 -7
- package/src/lib/helpers.ts +1 -1
- package/src/components/profile/AUProfileActions.js +0 -128
- package/src/components/profile/AUProfileAvatarComponent.js +0 -83
- package/src/components/profile/AUProfileAvatarV2Component.js +0 -91
- package/src/components/profile/AUProfileAvatarV3Component.tsx +0 -42
- package/src/components/profile/AUProfileContainerComponent.js +0 -283
- package/src/components/profile/AUProfileHooks.js +0 -30
- package/src/components/profile/AUProfileItemComponent.js +0 -54
- package/src/components/profile/AUProfileLanguageComponent.js +0 -131
- package/src/components/profile/AUProfileLoginComponent.tsx +0 -26
- package/src/components/profile/AUProfileMailComponent.js +0 -307
- package/src/components/profile/AUProfileMobileComponent.js +0 -164
- package/src/components/profile/AUProfileNameComponent.js +0 -253
- package/src/components/profile/AUProfileNextOfKinComponent.js +0 -216
- package/src/components/profile/AUProfileReducer.js +0 -230
- package/src/components/profile/AUProfileWidgetComponent.js +0 -95
- package/src/components/profile/AUProfileWidgetV2Component.js +0 -116
- package/src/components/profile/AUProfileWidgetV3Component.tsx +0 -122
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/* eslint-env browser */
|
|
2
|
-
import React, { useEffect, useState } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { setCopyToClipboard } from '@aarhus-university/au-designsystem-delphinus/source/js/components/nav';
|
|
5
|
-
|
|
6
|
-
const AUProfileWidgetComponent = React.memo(({
|
|
7
|
-
lang,
|
|
8
|
-
name,
|
|
9
|
-
auid,
|
|
10
|
-
studentNumber,
|
|
11
|
-
settings,
|
|
12
|
-
changeLanguageUrl,
|
|
13
|
-
logoutUri,
|
|
14
|
-
profileLabels,
|
|
15
|
-
}) => {
|
|
16
|
-
const [ctcSet, setCtcSet] = useState(false);
|
|
17
|
-
const renderSettings = settings.map((s) => <a key={s.url} className="sub-nav__item" href={s.url}>{s.text}</a>);
|
|
18
|
-
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
if (auid > 0 && !ctcSet) {
|
|
21
|
-
setCopyToClipboard(lang);
|
|
22
|
-
setCtcSet(true);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<div className="sub-nav__content theme--normal" aria-labelledby="profile-menu-toggle">
|
|
28
|
-
<div className="sub-nav__user">
|
|
29
|
-
<h2 className="sub-nav__user-name">{name}</h2>
|
|
30
|
-
<button
|
|
31
|
-
type="button"
|
|
32
|
-
className="copy-to-clipboard"
|
|
33
|
-
title={profileLabels[lang].copyAuid}
|
|
34
|
-
aria-label={`${profileLabels[lang].auId}: AU${auid}`}
|
|
35
|
-
>
|
|
36
|
-
{`${profileLabels[lang].auId}: `}
|
|
37
|
-
<span className="copy-to-clipboard__this">{`AU${auid}`}</span>
|
|
38
|
-
</button>
|
|
39
|
-
{
|
|
40
|
-
studentNumber && (
|
|
41
|
-
<button
|
|
42
|
-
type="button"
|
|
43
|
-
className="copy-to-clipboard"
|
|
44
|
-
title={profileLabels[lang].copyStudentNumber}
|
|
45
|
-
aria-label={`${profileLabels[lang].studentNumber}: ${studentNumber}`}
|
|
46
|
-
>
|
|
47
|
-
{`${profileLabels[lang].studentNumber}: `}
|
|
48
|
-
<span className="copy-to-clipboard__this">{studentNumber}</span>
|
|
49
|
-
</button>
|
|
50
|
-
)
|
|
51
|
-
}
|
|
52
|
-
</div>
|
|
53
|
-
<hr />
|
|
54
|
-
{renderSettings}
|
|
55
|
-
<hr />
|
|
56
|
-
{
|
|
57
|
-
changeLanguageUrl && (
|
|
58
|
-
<>
|
|
59
|
-
<a className="sub-nav__item sub-nav__item--icon" href={changeLanguageUrl} data-icon="">{profileLabels[lang].changeLanguage}</a>
|
|
60
|
-
<hr />
|
|
61
|
-
</>
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
<a
|
|
65
|
-
className="sub-nav__item sub-nav__item--icon"
|
|
66
|
-
data-icon=""
|
|
67
|
-
href={logoutUri}
|
|
68
|
-
>
|
|
69
|
-
{profileLabels[lang].logout}
|
|
70
|
-
</a>
|
|
71
|
-
</div>
|
|
72
|
-
);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
AUProfileWidgetComponent.defaultProps = {
|
|
76
|
-
studentNumber: null,
|
|
77
|
-
changeLanguageUrl: null,
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
AUProfileWidgetComponent.propTypes = {
|
|
81
|
-
lang: PropTypes.string.isRequired,
|
|
82
|
-
name: PropTypes.string.isRequired,
|
|
83
|
-
auid: PropTypes.number.isRequired,
|
|
84
|
-
studentNumber: PropTypes.string,
|
|
85
|
-
settings: PropTypes.arrayOf(PropTypes.shape({
|
|
86
|
-
url: PropTypes.string.isRequired,
|
|
87
|
-
text: PropTypes.string.isRequired,
|
|
88
|
-
})).isRequired,
|
|
89
|
-
profileLabels: PropTypes.shape({}).isRequired,
|
|
90
|
-
changeLanguageUrl: PropTypes.string,
|
|
91
|
-
logoutUri: PropTypes.string.isRequired,
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
AUProfileWidgetComponent.displayName = 'AUProfileWidgetComponent';
|
|
95
|
-
export default AUProfileWidgetComponent;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/* eslint-env browser */
|
|
2
|
-
import React, { useEffect, useState, useRef } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { setCopyToClipboard } from '@aarhus-university/au-designsystem-delphinus/source/js/components/nav';
|
|
5
|
-
|
|
6
|
-
const AUProfileWidgetComponent = React.memo(({
|
|
7
|
-
lang,
|
|
8
|
-
name,
|
|
9
|
-
auid,
|
|
10
|
-
studentNumber,
|
|
11
|
-
settings,
|
|
12
|
-
changeLanguageUrl,
|
|
13
|
-
logoutUri,
|
|
14
|
-
profileLabels,
|
|
15
|
-
}) => {
|
|
16
|
-
const [ctcSet, setCtcSet] = useState(false);
|
|
17
|
-
const renderSettings = settings.map((s) => {
|
|
18
|
-
const btnRef = useRef();
|
|
19
|
-
if (s.type === 'anchor') {
|
|
20
|
-
return <a key={s.url} className="sub-nav__item" href={s.url}>{s.text}</a>;
|
|
21
|
-
}
|
|
22
|
-
return (
|
|
23
|
-
<button
|
|
24
|
-
key={s.text}
|
|
25
|
-
ref={btnRef}
|
|
26
|
-
type="button"
|
|
27
|
-
className={`sub-nav__item ${s.classNames}`}
|
|
28
|
-
onClick={() => s.onClick(btnRef.current)}
|
|
29
|
-
data-icon={s.icon}
|
|
30
|
-
>
|
|
31
|
-
{s.text}
|
|
32
|
-
</button>
|
|
33
|
-
);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
if (auid > 0 && !ctcSet) {
|
|
38
|
-
setCopyToClipboard(lang);
|
|
39
|
-
setCtcSet(true);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<div className="sub-nav__content theme--normal" aria-labelledby="profile-menu-toggle">
|
|
45
|
-
<div className="sub-nav__user">
|
|
46
|
-
<h2 className="sub-nav__user-name">{name}</h2>
|
|
47
|
-
<button
|
|
48
|
-
type="button"
|
|
49
|
-
className="copy-to-clipboard"
|
|
50
|
-
title={profileLabels[lang].copyAuid}
|
|
51
|
-
aria-label={`${profileLabels[lang].auId}: AU${auid}`}
|
|
52
|
-
>
|
|
53
|
-
{`${profileLabels[lang].auId}: `}
|
|
54
|
-
<span className="copy-to-clipboard__this">{`AU${auid}`}</span>
|
|
55
|
-
</button>
|
|
56
|
-
{
|
|
57
|
-
studentNumber && (
|
|
58
|
-
<button
|
|
59
|
-
type="button"
|
|
60
|
-
className="copy-to-clipboard"
|
|
61
|
-
title={profileLabels[lang].copyStudentNumber}
|
|
62
|
-
aria-label={`${profileLabels[lang].studentNumber}: ${studentNumber}`}
|
|
63
|
-
>
|
|
64
|
-
{`${profileLabels[lang].studentNumber}: `}
|
|
65
|
-
<span className="copy-to-clipboard__this">{studentNumber}</span>
|
|
66
|
-
</button>
|
|
67
|
-
)
|
|
68
|
-
}
|
|
69
|
-
</div>
|
|
70
|
-
<hr />
|
|
71
|
-
{renderSettings}
|
|
72
|
-
<hr />
|
|
73
|
-
{
|
|
74
|
-
changeLanguageUrl && (
|
|
75
|
-
<>
|
|
76
|
-
<a className="sub-nav__item sub-nav__item--icon" href={changeLanguageUrl} data-icon="">{profileLabels[lang].changeLanguage}</a>
|
|
77
|
-
<hr />
|
|
78
|
-
</>
|
|
79
|
-
)
|
|
80
|
-
}
|
|
81
|
-
<a
|
|
82
|
-
className="sub-nav__item sub-nav__item--icon"
|
|
83
|
-
data-icon=""
|
|
84
|
-
href={logoutUri}
|
|
85
|
-
>
|
|
86
|
-
{profileLabels[lang].logout}
|
|
87
|
-
</a>
|
|
88
|
-
</div>
|
|
89
|
-
);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
AUProfileWidgetComponent.defaultProps = {
|
|
93
|
-
studentNumber: null,
|
|
94
|
-
changeLanguageUrl: '',
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
AUProfileWidgetComponent.propTypes = {
|
|
98
|
-
lang: PropTypes.string.isRequired,
|
|
99
|
-
name: PropTypes.string.isRequired,
|
|
100
|
-
auid: PropTypes.number.isRequired,
|
|
101
|
-
studentNumber: PropTypes.string,
|
|
102
|
-
settings: PropTypes.arrayOf(PropTypes.shape({
|
|
103
|
-
type: PropTypes.string.isRequired,
|
|
104
|
-
url: PropTypes.string,
|
|
105
|
-
text: PropTypes.string.isRequired,
|
|
106
|
-
onClick: PropTypes.func,
|
|
107
|
-
classNames: PropTypes.string,
|
|
108
|
-
icon: PropTypes.string,
|
|
109
|
-
})).isRequired,
|
|
110
|
-
profileLabels: PropTypes.shape({}).isRequired,
|
|
111
|
-
changeLanguageUrl: PropTypes.string,
|
|
112
|
-
logoutUri: PropTypes.string.isRequired,
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
AUProfileWidgetComponent.displayName = 'AUProfileWidgetComponent';
|
|
116
|
-
export default AUProfileWidgetComponent;
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/* eslint-env browser */
|
|
2
|
-
import React, {
|
|
3
|
-
FC, useEffect, useState, useRef, memo,
|
|
4
|
-
} from 'react';
|
|
5
|
-
import { setCopyToClipboard } from '@aarhus-university/au-designsystem-delphinus/source/js/components/nav';
|
|
6
|
-
|
|
7
|
-
const AUProfileWidgetComponent: FC<AUProfileWidgetComponentProps> = memo(({
|
|
8
|
-
lang,
|
|
9
|
-
name,
|
|
10
|
-
auId,
|
|
11
|
-
studentNumber,
|
|
12
|
-
settings,
|
|
13
|
-
changeLanguageUri,
|
|
14
|
-
logoutUri,
|
|
15
|
-
profileLabels,
|
|
16
|
-
}: AUProfileWidgetComponentProps) => {
|
|
17
|
-
const [ctcSet, setCtcSet] = useState<boolean>(false);
|
|
18
|
-
const btnRefs = useRef<HTMLButtonElement[]>([]);
|
|
19
|
-
btnRefs.current = [];
|
|
20
|
-
const addToRefs = (el: HTMLButtonElement) => {
|
|
21
|
-
if (el && !btnRefs.current.includes(el)) {
|
|
22
|
-
btnRefs.current.push(el);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
const renderSettings = settings.map((s, i) => {
|
|
26
|
-
if (s.type === 'anchor') {
|
|
27
|
-
return (
|
|
28
|
-
<a
|
|
29
|
-
key={s.url}
|
|
30
|
-
className={`sub-nav__item ${s.classNames}`}
|
|
31
|
-
href={s.url}
|
|
32
|
-
data-icon={s.icon}
|
|
33
|
-
data-gtm={s.dataGtm}
|
|
34
|
-
>
|
|
35
|
-
{s.text}
|
|
36
|
-
</a>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
return (
|
|
40
|
-
<button
|
|
41
|
-
key={s.text}
|
|
42
|
-
ref={addToRefs}
|
|
43
|
-
type="button"
|
|
44
|
-
disabled={s.disabled}
|
|
45
|
-
className={`sub-nav__item ${s.classNames}`}
|
|
46
|
-
onClick={() => {
|
|
47
|
-
if (typeof s.onClick === 'function') {
|
|
48
|
-
s.onClick(btnRefs.current[i]);
|
|
49
|
-
}
|
|
50
|
-
}}
|
|
51
|
-
data-icon={s.icon}
|
|
52
|
-
data-gtm={s.dataGtm}
|
|
53
|
-
>
|
|
54
|
-
{s.text}
|
|
55
|
-
</button>
|
|
56
|
-
);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
useEffect(() => {
|
|
60
|
-
if (auId > 0 && !ctcSet) {
|
|
61
|
-
setCopyToClipboard(lang);
|
|
62
|
-
setCtcSet(true);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<div className="sub-nav__content theme--normal" aria-labelledby="profile-menu-toggle">
|
|
68
|
-
<div className="sub-nav__user">
|
|
69
|
-
<h2 className="sub-nav__user-name">{name}</h2>
|
|
70
|
-
<button
|
|
71
|
-
type="button"
|
|
72
|
-
className="copy-to-clipboard"
|
|
73
|
-
title={profileLabels[lang].copyAuid}
|
|
74
|
-
aria-label={`${profileLabels[lang].auId}: AU${auId}`}
|
|
75
|
-
data-gtm="au-btn-header-copy-auid"
|
|
76
|
-
>
|
|
77
|
-
{`${profileLabels[lang].auId}: `}
|
|
78
|
-
<span className="copy-to-clipboard__this">{`AU${auId}`}</span>
|
|
79
|
-
</button>
|
|
80
|
-
{
|
|
81
|
-
studentNumber && (
|
|
82
|
-
<button
|
|
83
|
-
type="button"
|
|
84
|
-
className="copy-to-clipboard"
|
|
85
|
-
title={profileLabels[lang].copyStudentNumber}
|
|
86
|
-
aria-label={`${profileLabels[lang].studentNumber}: ${studentNumber}`}
|
|
87
|
-
>
|
|
88
|
-
{`${profileLabels[lang].studentNumber}: `}
|
|
89
|
-
<span className="copy-to-clipboard__this">{studentNumber}</span>
|
|
90
|
-
</button>
|
|
91
|
-
)
|
|
92
|
-
}
|
|
93
|
-
</div>
|
|
94
|
-
<hr />
|
|
95
|
-
{renderSettings}
|
|
96
|
-
<hr />
|
|
97
|
-
{
|
|
98
|
-
changeLanguageUri && (
|
|
99
|
-
<>
|
|
100
|
-
<a className="sub-nav__item sub-nav__item--icon" href={changeLanguageUri} data-icon="" data-gtm="au-btn-header-profile-changelanguage">{profileLabels[lang].changeLanguage}</a>
|
|
101
|
-
<hr />
|
|
102
|
-
</>
|
|
103
|
-
)
|
|
104
|
-
}
|
|
105
|
-
<a
|
|
106
|
-
className="sub-nav__item sub-nav__item--icon"
|
|
107
|
-
data-icon=""
|
|
108
|
-
data-gtm="au-a-header-signout"
|
|
109
|
-
href={logoutUri}
|
|
110
|
-
>
|
|
111
|
-
{profileLabels[lang].logout}
|
|
112
|
-
</a>
|
|
113
|
-
</div>
|
|
114
|
-
);
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
AUProfileWidgetComponent.defaultProps = {
|
|
118
|
-
studentNumber: '',
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
AUProfileWidgetComponent.displayName = 'AUProfileWidgetComponent';
|
|
122
|
-
export default AUProfileWidgetComponent;
|