@aarhus-university/au-lib-react-components 10.3.3 → 10.6.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 (113) hide show
  1. package/.eslintrc.js +34 -44
  2. package/.storybook/main.js +8 -0
  3. package/{types/common/payloads.d.ts → .storybook/preview-head.html} +0 -0
  4. package/.storybook/preview.js +11 -0
  5. package/README.md +19 -19
  6. package/__tests__/jest/AUButtonComponent.test.tsx +163 -0
  7. package/__tests__/jest/AUSpinnerComponent.test.tsx +57 -0
  8. package/__tests__/jest/helpers.test.ts +15 -0
  9. package/__tests__/jest/setupTests.ts +2 -0
  10. package/babel.config.js +8 -7
  11. package/build/umd/all.css +2 -2
  12. package/build/umd/all.js +1 -1
  13. package/build/umd/alphabox.js +1 -1
  14. package/build/umd/alphabox.js.map +1 -1
  15. package/build/umd/databox.js +1 -1
  16. package/build/umd/databox.js.map +1 -1
  17. package/build/umd/diagramme.js +1 -1
  18. package/build/umd/diagramme.js.map +1 -1
  19. package/build/umd/flowbox.js +1 -1
  20. package/build/umd/flowbox.js.map +1 -1
  21. package/build/umd/universe.js +1 -1
  22. package/build/umd/universe.js.map +1 -1
  23. package/package.json +107 -66
  24. package/src/components/AUAlertComponent.tsx +70 -70
  25. package/src/components/AUAutoSuggestComponent.js +158 -158
  26. package/src/components/AUButtonComponent.tsx +77 -0
  27. package/src/components/AUCalendarComponent.tsx +493 -493
  28. package/src/components/AUContentToggleComponent.tsx +33 -33
  29. package/src/components/AUDatepickerComponent.tsx +117 -117
  30. package/src/components/AUMobilePrefixComponent.tsx +15 -15
  31. package/src/components/AUModalComponent.tsx +80 -80
  32. package/src/components/AUReceiptComponent.tsx +33 -33
  33. package/src/components/AUSpinnerComponent.tsx +33 -91
  34. package/src/components/AUSubNavComponent.tsx +48 -48
  35. package/src/components/AUSubmitButtonContainerComponent.tsx +31 -31
  36. package/src/components/AUTabbedContentComponent.tsx +145 -145
  37. package/src/components/AUTableComponent.tsx +24 -24
  38. package/src/components/AUToastComponent.tsx +103 -103
  39. package/src/components/AUToolbarComponent.tsx +45 -45
  40. package/src/components/profile/AUProfileActions.js +128 -128
  41. package/src/components/profile/AUProfileAvatarComponent.js +83 -83
  42. package/src/components/profile/AUProfileAvatarV2Component.js +91 -91
  43. package/src/components/profile/AUProfileAvatarV3Component.tsx +42 -42
  44. package/src/components/profile/AUProfileContainerComponent.js +283 -283
  45. package/src/components/profile/AUProfileHooks.js +30 -30
  46. package/src/components/profile/AUProfileItemComponent.js +54 -54
  47. package/src/components/profile/AUProfileLanguageComponent.js +131 -131
  48. package/src/components/profile/AUProfileLoginComponent.tsx +26 -26
  49. package/src/components/profile/AUProfileMailComponent.js +307 -307
  50. package/src/components/profile/AUProfileMobileComponent.js +164 -164
  51. package/src/components/profile/AUProfileNameComponent.js +253 -253
  52. package/src/components/profile/AUProfileNextOfKinComponent.js +216 -216
  53. package/src/components/profile/AUProfileReducer.js +230 -230
  54. package/src/components/profile/AUProfileWidgetComponent.js +95 -95
  55. package/src/components/profile/AUProfileWidgetV2Component.js +116 -116
  56. package/src/components/profile/AUProfileWidgetV3Component.tsx +122 -122
  57. package/src/components/wrapping/AUEmbedComponent.js +47 -47
  58. package/src/layout-2016/components/alphabox/AlphaBoxComponent.js +143 -143
  59. package/src/layout-2016/components/alphabox/AlphaBoxContentComponent.js +136 -136
  60. package/src/layout-2016/components/common/AUCollapsibleComponent.js +152 -152
  61. package/src/layout-2016/components/common/AUSpinnerComponent.js +103 -103
  62. package/src/layout-2016/components/databox/DataBoxAlphabetComponent.js +144 -144
  63. package/src/layout-2016/components/databox/DataBoxAssociationComponent.js +122 -122
  64. package/src/layout-2016/components/databox/DataBoxButtonComponent.js +157 -157
  65. package/src/layout-2016/components/databox/DataBoxComponent.js +297 -297
  66. package/src/layout-2016/components/databox/DataBoxGroupingComponent.js +64 -64
  67. package/src/layout-2016/components/databox/DataBoxSearchResultComponent.js +36 -36
  68. package/src/layout-2016/components/databox/DataBoxStackedAssociationComponent.js +54 -54
  69. package/src/layout-2016/components/databox/DataBoxSuggestionComponent.js +39 -39
  70. package/src/layout-2016/components/diagramme/AUDiagrammeComponent.js +309 -309
  71. package/src/layout-2016/components/flowbox/FlowBoxComponent.js +126 -126
  72. package/src/layout-2016/components/flowbox/FlowBoxPhoneComponent.js +104 -104
  73. package/src/layout-2016/components/profile/AUProfileAvatar2016Component.js +103 -103
  74. package/src/layout-2016/components/universe/StaffTopComponent.js +363 -363
  75. package/src/layout-2016/components/universe/StudentTopComponent.js +137 -137
  76. package/src/layout-2016/components/universe/UniverseContainerComponent.js +65 -65
  77. package/src/layout-2016/lib/all.js +3 -3
  78. package/src/layout-2016/lib/au-alphabox.js +100 -100
  79. package/src/layout-2016/lib/au-databox.js +400 -400
  80. package/src/layout-2016/lib/au-diagramme.js +85 -85
  81. package/src/layout-2016/lib/au-flowbox.js +93 -93
  82. package/src/layout-2016/lib/universe.js +9 -9
  83. package/src/lib/helpers.ts +194 -194
  84. package/src/lib/hooks.ts +33 -33
  85. package/src/lib/i18n.ts +600 -600
  86. package/src/lib/tracking.ts +69 -69
  87. package/src/lib/wrapping.ts +21 -21
  88. package/src/styles/_settings.scss +10 -10
  89. package/src/styles/alphabox.scss +222 -222
  90. package/src/styles/app.scss +7 -7
  91. package/src/styles/autosuggest.scss +57 -57
  92. package/src/styles/databox.scss +563 -563
  93. package/src/styles/diagramme.scss +119 -119
  94. package/src/styles/flowbox.scss +72 -72
  95. package/src/styles/maps.scss +395 -395
  96. package/stories/AUButtonComponent.stories.tsx +86 -0
  97. package/stories/AUSpinnerComponent.stories.tsx +41 -0
  98. package/stories/assets/code-brackets.svg +1 -0
  99. package/stories/assets/colors.svg +1 -0
  100. package/stories/assets/comments.svg +1 -0
  101. package/stories/assets/direction.svg +1 -0
  102. package/stories/assets/flow.svg +1 -0
  103. package/stories/assets/plugin.svg +1 -0
  104. package/stories/assets/repo.svg +1 -0
  105. package/stories/assets/stackalt.svg +1 -0
  106. package/tsconfig.json +46 -46
  107. package/webpack.config.js +89 -89
  108. package/types/common/delphinus-duplicates.d.ts +0 -40
  109. package/types/common/interfaces/gui.d.ts +0 -52
  110. package/types/common/interfaces/model.d.ts +0 -29
  111. package/types/common/main.d.ts +0 -6
  112. package/types/common/package.json +0 -5
  113. package/types/common/props.d.ts +0 -166
@@ -1,83 +1,83 @@
1
- /* eslint-env browser */
2
- import React, { useEffect } from 'react';
3
- // eslint-disable-next-line import/extensions
4
- // import whyDidYouRender from '@welldone-software/
5
- // why-did-you-render/dist/no-classes-transpile/umd/whyDidYouRender.min.js';
6
- import PropTypes from 'prop-types';
7
- import AUProfileWidgetComponent from './AUProfileWidgetComponent';
8
- import AUSubNavComponent from '../delphinus/AUSubNavComponent';
9
-
10
- // whyDidYouRender(React);
11
-
12
- const AUProfileAvatarComponent = React.memo(({
13
- user,
14
- settings,
15
- onLoad,
16
- onLoadAction,
17
- profileLabels,
18
- logoutUri,
19
- changeLanguageUrl,
20
- }) => {
21
- const {
22
- chosenFirstNames,
23
- chosenLastName,
24
- preferredLanguage,
25
- auId,
26
- studentNumber,
27
- } = user;
28
-
29
- useEffect(() => {
30
- onLoad(onLoadAction);
31
- }, []);
32
-
33
- return (
34
- <AUSubNavComponent
35
- id="profile-menu-toggle"
36
- className="nav__item nav__item--icon nav__item--icon--right"
37
- dataIcon=""
38
- text={chosenFirstNames}
39
- ariaLabel={`${profileLabels[preferredLanguage].profileFor} ${chosenFirstNames} ${chosenLastName}`}
40
- >
41
- <AUProfileWidgetComponent
42
- lang={preferredLanguage}
43
- name={`${chosenFirstNames} ${chosenLastName}`}
44
- auid={auId}
45
- studentNumber={studentNumber}
46
- settings={settings}
47
- profileLabels={profileLabels}
48
- changeLanguageUrl={changeLanguageUrl}
49
- logoutUri={logoutUri}
50
- />
51
- </AUSubNavComponent>
52
- );
53
- });
54
-
55
- // AUProfileAvatarComponent.whyDidYouRender = true;
56
-
57
- AUProfileAvatarComponent.defaultProps = {
58
- onLoadAction: () => {
59
-
60
- },
61
- };
62
-
63
- AUProfileAvatarComponent.propTypes = {
64
- user: PropTypes.shape({
65
- chosenFirstNames: PropTypes.string.isRequired,
66
- chosenLastName: PropTypes.string.isRequired,
67
- preferredLanguage: PropTypes.string.isRequired,
68
- auId: PropTypes.number.isRequired,
69
- studentNumber: PropTypes.string.isRequired,
70
- }).isRequired,
71
- settings: PropTypes.arrayOf(PropTypes.shape({
72
- url: PropTypes.string.isRequired,
73
- text: PropTypes.string.isRequired,
74
- })).isRequired,
75
- onLoad: PropTypes.func.isRequired,
76
- onLoadAction: PropTypes.func,
77
- profileLabels: PropTypes.shape({}).isRequired,
78
- logoutUri: PropTypes.string.isRequired,
79
- changeLanguageUrl: PropTypes.string.isRequired,
80
- };
81
-
82
- AUProfileAvatarComponent.displayName = 'AUProfileAvatarComponent';
83
- export default AUProfileAvatarComponent;
1
+ /* eslint-env browser */
2
+ import React, { useEffect } from 'react';
3
+ // eslint-disable-next-line import/extensions
4
+ // import whyDidYouRender from '@welldone-software/
5
+ // why-did-you-render/dist/no-classes-transpile/umd/whyDidYouRender.min.js';
6
+ import PropTypes from 'prop-types';
7
+ import AUProfileWidgetComponent from './AUProfileWidgetComponent';
8
+ import AUSubNavComponent from '../delphinus/AUSubNavComponent';
9
+
10
+ // whyDidYouRender(React);
11
+
12
+ const AUProfileAvatarComponent = React.memo(({
13
+ user,
14
+ settings,
15
+ onLoad,
16
+ onLoadAction,
17
+ profileLabels,
18
+ logoutUri,
19
+ changeLanguageUrl,
20
+ }) => {
21
+ const {
22
+ chosenFirstNames,
23
+ chosenLastName,
24
+ preferredLanguage,
25
+ auId,
26
+ studentNumber,
27
+ } = user;
28
+
29
+ useEffect(() => {
30
+ onLoad(onLoadAction);
31
+ }, []);
32
+
33
+ return (
34
+ <AUSubNavComponent
35
+ id="profile-menu-toggle"
36
+ className="nav__item nav__item--icon nav__item--icon--right"
37
+ dataIcon=""
38
+ text={chosenFirstNames}
39
+ ariaLabel={`${profileLabels[preferredLanguage].profileFor} ${chosenFirstNames} ${chosenLastName}`}
40
+ >
41
+ <AUProfileWidgetComponent
42
+ lang={preferredLanguage}
43
+ name={`${chosenFirstNames} ${chosenLastName}`}
44
+ auid={auId}
45
+ studentNumber={studentNumber}
46
+ settings={settings}
47
+ profileLabels={profileLabels}
48
+ changeLanguageUrl={changeLanguageUrl}
49
+ logoutUri={logoutUri}
50
+ />
51
+ </AUSubNavComponent>
52
+ );
53
+ });
54
+
55
+ // AUProfileAvatarComponent.whyDidYouRender = true;
56
+
57
+ AUProfileAvatarComponent.defaultProps = {
58
+ onLoadAction: () => {
59
+
60
+ },
61
+ };
62
+
63
+ AUProfileAvatarComponent.propTypes = {
64
+ user: PropTypes.shape({
65
+ chosenFirstNames: PropTypes.string.isRequired,
66
+ chosenLastName: PropTypes.string.isRequired,
67
+ preferredLanguage: PropTypes.string.isRequired,
68
+ auId: PropTypes.number.isRequired,
69
+ studentNumber: PropTypes.string.isRequired,
70
+ }).isRequired,
71
+ settings: PropTypes.arrayOf(PropTypes.shape({
72
+ url: PropTypes.string.isRequired,
73
+ text: PropTypes.string.isRequired,
74
+ })).isRequired,
75
+ onLoad: PropTypes.func.isRequired,
76
+ onLoadAction: PropTypes.func,
77
+ profileLabels: PropTypes.shape({}).isRequired,
78
+ logoutUri: PropTypes.string.isRequired,
79
+ changeLanguageUrl: PropTypes.string.isRequired,
80
+ };
81
+
82
+ AUProfileAvatarComponent.displayName = 'AUProfileAvatarComponent';
83
+ export default AUProfileAvatarComponent;
@@ -1,91 +1,91 @@
1
- /* eslint-env browser */
2
- import React, { useEffect } from 'react';
3
- import PropTypes from 'prop-types';
4
- import AUProfileWidgetComponent from './AUProfileWidgetV2Component';
5
- import AUSubNavComponent from '../delphinus/AUSubNavComponent';
6
-
7
- const AUProfileAvatarComponent = React.memo(({
8
- user,
9
- settings,
10
- onLoad,
11
- onLoadAction,
12
- profileLabels,
13
- logoutUri,
14
- changeLanguageUrl,
15
- }) => {
16
- const {
17
- person: {
18
- auPerson: {
19
- auId, foretrukketSprog, kaldeFornavne, kaldeEfternavn,
20
- },
21
- },
22
- } = user;
23
- const studentNumber = user.studerende?.auUddannelsesidentitet?.studienr;
24
-
25
- useEffect(() => {
26
- if (typeof onLoad === 'function') {
27
- onLoad(onLoadAction);
28
- }
29
- }, []);
30
-
31
- return (
32
- <AUSubNavComponent
33
- id="profile-menu-toggle"
34
- className="nav__item nav__item--icon nav__item--icon--right"
35
- dataIcon=""
36
- text={kaldeFornavne}
37
- ariaLabel={`${profileLabels[foretrukketSprog].profileFor} ${kaldeFornavne} ${kaldeEfternavn}`}
38
- >
39
- <AUProfileWidgetComponent
40
- lang={foretrukketSprog}
41
- name={`${kaldeFornavne} ${kaldeEfternavn}`}
42
- auid={auId}
43
- studentNumber={studentNumber}
44
- settings={settings}
45
- profileLabels={profileLabels}
46
- changeLanguageUrl={changeLanguageUrl}
47
- logoutUri={logoutUri}
48
- />
49
- </AUSubNavComponent>
50
- );
51
- });
52
-
53
- AUProfileAvatarComponent.defaultProps = {
54
- onLoad: null,
55
- onLoadAction: () => {
56
-
57
- },
58
- changeLanguageUrl: '',
59
- };
60
-
61
- AUProfileAvatarComponent.propTypes = {
62
- user: PropTypes.shape({
63
- person: PropTypes.shape({
64
- auPerson: PropTypes.shape({
65
- kaldeFornavne: PropTypes.string.isRequired,
66
- kaldeEfternavn: PropTypes.string.isRequired,
67
- auId: PropTypes.number.isRequired,
68
- foretrukketSprog: PropTypes.string.isRequired,
69
- }).isRequired,
70
- }).isRequired,
71
- studerende: PropTypes.shape({
72
- auUddannelsesidentitet: PropTypes.shape({
73
- studienr: PropTypes.number.isRequired,
74
- }),
75
- }),
76
- }).isRequired,
77
- settings: PropTypes.arrayOf(PropTypes.shape({
78
- type: PropTypes.string.isRequired,
79
- url: PropTypes.string,
80
- text: PropTypes.string.isRequired,
81
- onClick: PropTypes.func,
82
- })).isRequired,
83
- onLoad: PropTypes.func,
84
- onLoadAction: PropTypes.func,
85
- profileLabels: PropTypes.shape({}).isRequired,
86
- logoutUri: PropTypes.string.isRequired,
87
- changeLanguageUrl: PropTypes.string,
88
- };
89
-
90
- AUProfileAvatarComponent.displayName = 'AUProfileAvatarComponent';
91
- export default AUProfileAvatarComponent;
1
+ /* eslint-env browser */
2
+ import React, { useEffect } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import AUProfileWidgetComponent from './AUProfileWidgetV2Component';
5
+ import AUSubNavComponent from '../delphinus/AUSubNavComponent';
6
+
7
+ const AUProfileAvatarComponent = React.memo(({
8
+ user,
9
+ settings,
10
+ onLoad,
11
+ onLoadAction,
12
+ profileLabels,
13
+ logoutUri,
14
+ changeLanguageUrl,
15
+ }) => {
16
+ const {
17
+ person: {
18
+ auPerson: {
19
+ auId, foretrukketSprog, kaldeFornavne, kaldeEfternavn,
20
+ },
21
+ },
22
+ } = user;
23
+ const studentNumber = user.studerende?.auUddannelsesidentitet?.studienr;
24
+
25
+ useEffect(() => {
26
+ if (typeof onLoad === 'function') {
27
+ onLoad(onLoadAction);
28
+ }
29
+ }, []);
30
+
31
+ return (
32
+ <AUSubNavComponent
33
+ id="profile-menu-toggle"
34
+ className="nav__item nav__item--icon nav__item--icon--right"
35
+ dataIcon=""
36
+ text={kaldeFornavne}
37
+ ariaLabel={`${profileLabels[foretrukketSprog].profileFor} ${kaldeFornavne} ${kaldeEfternavn}`}
38
+ >
39
+ <AUProfileWidgetComponent
40
+ lang={foretrukketSprog}
41
+ name={`${kaldeFornavne} ${kaldeEfternavn}`}
42
+ auid={auId}
43
+ studentNumber={studentNumber}
44
+ settings={settings}
45
+ profileLabels={profileLabels}
46
+ changeLanguageUrl={changeLanguageUrl}
47
+ logoutUri={logoutUri}
48
+ />
49
+ </AUSubNavComponent>
50
+ );
51
+ });
52
+
53
+ AUProfileAvatarComponent.defaultProps = {
54
+ onLoad: null,
55
+ onLoadAction: () => {
56
+
57
+ },
58
+ changeLanguageUrl: '',
59
+ };
60
+
61
+ AUProfileAvatarComponent.propTypes = {
62
+ user: PropTypes.shape({
63
+ person: PropTypes.shape({
64
+ auPerson: PropTypes.shape({
65
+ kaldeFornavne: PropTypes.string.isRequired,
66
+ kaldeEfternavn: PropTypes.string.isRequired,
67
+ auId: PropTypes.number.isRequired,
68
+ foretrukketSprog: PropTypes.string.isRequired,
69
+ }).isRequired,
70
+ }).isRequired,
71
+ studerende: PropTypes.shape({
72
+ auUddannelsesidentitet: PropTypes.shape({
73
+ studienr: PropTypes.number.isRequired,
74
+ }),
75
+ }),
76
+ }).isRequired,
77
+ settings: PropTypes.arrayOf(PropTypes.shape({
78
+ type: PropTypes.string.isRequired,
79
+ url: PropTypes.string,
80
+ text: PropTypes.string.isRequired,
81
+ onClick: PropTypes.func,
82
+ })).isRequired,
83
+ onLoad: PropTypes.func,
84
+ onLoadAction: PropTypes.func,
85
+ profileLabels: PropTypes.shape({}).isRequired,
86
+ logoutUri: PropTypes.string.isRequired,
87
+ changeLanguageUrl: PropTypes.string,
88
+ };
89
+
90
+ AUProfileAvatarComponent.displayName = 'AUProfileAvatarComponent';
91
+ export default AUProfileAvatarComponent;
@@ -1,42 +1,42 @@
1
- /* eslint-env browser */
2
- import React, { FC, memo } from 'react';
3
- import AUProfileWidgetComponent from './AUProfileWidgetV3Component';
4
- import AUSubNavComponent from '../AUSubNavComponent';
5
-
6
- const AUProfileAvatarComponent: FC<AUProfileAvatarComponentProps> = memo(({
7
- user,
8
- settings,
9
- profileLabels,
10
- logoutUri,
11
- changeLanguageUri,
12
- lang,
13
- }: AUProfileAvatarComponentProps) => {
14
- const {
15
- auId,
16
- firstNames,
17
- lastName,
18
- } = user;
19
-
20
- return (
21
- <AUSubNavComponent
22
- id="profile-menu-toggle"
23
- className="nav__item nav__item--icon nav__item--icon--right"
24
- dataIcon=""
25
- text={firstNames}
26
- ariaLabel={`${profileLabels[lang].profileFor} ${firstNames} ${lastName}`}
27
- >
28
- <AUProfileWidgetComponent
29
- lang={lang}
30
- name={`${firstNames} ${lastName}`}
31
- auId={auId}
32
- settings={settings}
33
- profileLabels={profileLabels}
34
- changeLanguageUri={changeLanguageUri || ''}
35
- logoutUri={logoutUri}
36
- />
37
- </AUSubNavComponent>
38
- );
39
- });
40
-
41
- AUProfileAvatarComponent.displayName = 'AUProfileAvatarComponent';
42
- export default AUProfileAvatarComponent;
1
+ /* eslint-env browser */
2
+ import React, { FC, memo } from 'react';
3
+ import AUProfileWidgetComponent from './AUProfileWidgetV3Component';
4
+ import AUSubNavComponent from '../AUSubNavComponent';
5
+
6
+ const AUProfileAvatarComponent: FC<AUProfileAvatarComponentProps> = memo(({
7
+ user,
8
+ settings,
9
+ profileLabels,
10
+ logoutUri,
11
+ changeLanguageUri,
12
+ lang,
13
+ }: AUProfileAvatarComponentProps) => {
14
+ const {
15
+ auId,
16
+ firstNames,
17
+ lastName,
18
+ } = user;
19
+
20
+ return (
21
+ <AUSubNavComponent
22
+ id="profile-menu-toggle"
23
+ className="nav__item nav__item--icon nav__item--icon--right"
24
+ dataIcon=""
25
+ text={firstNames}
26
+ ariaLabel={`${profileLabels[lang].profileFor} ${firstNames} ${lastName}`}
27
+ >
28
+ <AUProfileWidgetComponent
29
+ lang={lang}
30
+ name={`${firstNames} ${lastName}`}
31
+ auId={auId}
32
+ settings={settings}
33
+ profileLabels={profileLabels}
34
+ changeLanguageUri={changeLanguageUri || ''}
35
+ logoutUri={logoutUri}
36
+ />
37
+ </AUSubNavComponent>
38
+ );
39
+ });
40
+
41
+ AUProfileAvatarComponent.displayName = 'AUProfileAvatarComponent';
42
+ export default AUProfileAvatarComponent;