@aarhus-university/au-lib-react-components 9.11.1 → 9.11.5

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "@aarhus-university/au-lib-react-components",
4
- "version": "9.11.1",
4
+ "version": "9.11.5",
5
5
  "description": "Library for shared React components for various applications on au.dk",
6
6
  "main": "build/cjs/index.js",
7
7
  "scripts": {
@@ -44,6 +44,7 @@ const AUModalComponent = (props) => {
44
44
  type="button"
45
45
  className="modal-view__close button button--icon button--icon--hide-label"
46
46
  data-icon=""
47
+ data-gtm="au-btn-modal-close"
47
48
  onClick={() => {
48
49
  if (typeof onClose === 'function') {
49
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}>
@@ -75,6 +75,11 @@ const AUProfileMailComponent = ({
75
75
  rule: (fieldValue) => fieldValue.trim().match(emailRegex),
76
76
  }];
77
77
 
78
+ const validationRulesPrivateMail = [{
79
+ message: profileLabels[lang].validMail,
80
+ rule: (fieldValue) => fieldValue.trim().match(emailRegex) && !fieldValue.trim().endsWith(workMailPostfix),
81
+ }];
82
+
78
83
  const validateWorkMail = (value, alert = true) => {
79
84
  const [valid, messages] = validateForm(lang, value, validationRules);
80
85
  setWorkMail(value);
@@ -90,7 +95,7 @@ const AUProfileMailComponent = ({
90
95
  };
91
96
 
92
97
  const validatePrivateMail = (value, alert = true) => {
93
- const [valid, messages] = validateForm(lang, value, validationRules);
98
+ const [valid, messages] = validateForm(lang, value, validationRulesPrivateMail);
94
99
  setPrivateMail(value);
95
100
  setPrivateMailValidationMessages(alert ? messages : []);
96
101
  setIsPrivateMailValid(valid);
@@ -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}