@aarhus-university/au-lib-react-components 10.6.0 → 10.7.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 (97) hide show
  1. package/.eslintrc.js +34 -34
  2. package/.storybook/main.js +20 -7
  3. package/.storybook/preview.js +10 -10
  4. package/README.md +19 -19
  5. package/__tests__/jest/AUButtonComponent.test.tsx +165 -163
  6. package/__tests__/jest/AUModalComponent.test.tsx +116 -0
  7. package/__tests__/jest/AUSpinnerComponent.test.tsx +57 -57
  8. package/__tests__/jest/AUToolbarComponent.test.tsx +46 -0
  9. package/__tests__/jest/helpers.test.ts +15 -15
  10. package/__tests__/jest/setupTests.ts +2 -2
  11. package/babel.config.js +8 -8
  12. package/build/umd/all.css +2 -2
  13. package/build/umd/all.js +1 -1
  14. package/build/umd/alphabox.js +1 -1
  15. package/build/umd/databox.js +1 -1
  16. package/build/umd/diagramme.js +1 -1
  17. package/build/umd/flowbox.js +1 -1
  18. package/build/umd/universe.js +1 -1
  19. package/package.json +107 -107
  20. package/src/components/AUAlertComponent.tsx +70 -70
  21. package/src/components/AUAutoSuggestComponent.js +158 -158
  22. package/src/components/AUButtonComponent.tsx +83 -77
  23. package/src/components/AUCalendarComponent.tsx +493 -493
  24. package/src/components/AUContentToggleComponent.tsx +33 -33
  25. package/src/components/AUDatepickerComponent.tsx +117 -117
  26. package/src/components/AUMobilePrefixComponent.tsx +15 -15
  27. package/src/components/AUModalComponent.tsx +64 -80
  28. package/src/components/AUReceiptComponent.tsx +33 -33
  29. package/src/components/AUSpinnerComponent.tsx +33 -33
  30. package/src/components/AUSubNavComponent.tsx +48 -48
  31. package/src/components/AUSubmitButtonContainerComponent.tsx +31 -31
  32. package/src/components/AUTabbedContentComponent.tsx +145 -145
  33. package/src/components/AUTableComponent.tsx +24 -24
  34. package/src/components/AUToastComponent.tsx +103 -103
  35. package/src/components/AUToolbarComponent.tsx +52 -45
  36. package/src/components/profile/AUProfileActions.js +128 -128
  37. package/src/components/profile/AUProfileAvatarComponent.js +83 -83
  38. package/src/components/profile/AUProfileAvatarV2Component.js +91 -91
  39. package/src/components/profile/AUProfileAvatarV3Component.tsx +42 -42
  40. package/src/components/profile/AUProfileContainerComponent.js +283 -283
  41. package/src/components/profile/AUProfileHooks.js +30 -30
  42. package/src/components/profile/AUProfileItemComponent.js +54 -54
  43. package/src/components/profile/AUProfileLanguageComponent.js +131 -131
  44. package/src/components/profile/AUProfileLoginComponent.tsx +26 -26
  45. package/src/components/profile/AUProfileMailComponent.js +307 -307
  46. package/src/components/profile/AUProfileMobileComponent.js +164 -164
  47. package/src/components/profile/AUProfileNameComponent.js +253 -253
  48. package/src/components/profile/AUProfileNextOfKinComponent.js +216 -216
  49. package/src/components/profile/AUProfileReducer.js +230 -230
  50. package/src/components/profile/AUProfileWidgetComponent.js +95 -95
  51. package/src/components/profile/AUProfileWidgetV2Component.js +116 -116
  52. package/src/components/profile/AUProfileWidgetV3Component.tsx +122 -122
  53. package/src/components/wrapping/AUEmbedComponent.js +47 -47
  54. package/src/layout-2016/components/alphabox/AlphaBoxComponent.js +143 -143
  55. package/src/layout-2016/components/alphabox/AlphaBoxContentComponent.js +136 -136
  56. package/src/layout-2016/components/common/AUCollapsibleComponent.js +152 -152
  57. package/src/layout-2016/components/common/AUSpinnerComponent.js +103 -103
  58. package/src/layout-2016/components/databox/DataBoxAlphabetComponent.js +144 -144
  59. package/src/layout-2016/components/databox/DataBoxAssociationComponent.js +122 -122
  60. package/src/layout-2016/components/databox/DataBoxButtonComponent.js +157 -157
  61. package/src/layout-2016/components/databox/DataBoxComponent.js +297 -297
  62. package/src/layout-2016/components/databox/DataBoxGroupingComponent.js +64 -64
  63. package/src/layout-2016/components/databox/DataBoxSearchResultComponent.js +36 -36
  64. package/src/layout-2016/components/databox/DataBoxStackedAssociationComponent.js +54 -54
  65. package/src/layout-2016/components/databox/DataBoxSuggestionComponent.js +39 -39
  66. package/src/layout-2016/components/diagramme/AUDiagrammeComponent.js +309 -309
  67. package/src/layout-2016/components/flowbox/FlowBoxComponent.js +126 -126
  68. package/src/layout-2016/components/flowbox/FlowBoxPhoneComponent.js +104 -104
  69. package/src/layout-2016/components/profile/AUProfileAvatar2016Component.js +103 -103
  70. package/src/layout-2016/components/universe/StaffTopComponent.js +363 -363
  71. package/src/layout-2016/components/universe/StudentTopComponent.js +137 -137
  72. package/src/layout-2016/components/universe/UniverseContainerComponent.js +65 -65
  73. package/src/layout-2016/lib/all.js +3 -3
  74. package/src/layout-2016/lib/au-alphabox.js +100 -100
  75. package/src/layout-2016/lib/au-databox.js +400 -400
  76. package/src/layout-2016/lib/au-diagramme.js +85 -85
  77. package/src/layout-2016/lib/au-flowbox.js +93 -93
  78. package/src/layout-2016/lib/universe.js +9 -9
  79. package/src/lib/helpers.ts +194 -194
  80. package/src/lib/hooks.ts +37 -33
  81. package/src/lib/i18n.ts +600 -600
  82. package/src/lib/tracking.ts +69 -69
  83. package/src/lib/wrapping.ts +21 -21
  84. package/src/styles/_settings.scss +10 -10
  85. package/src/styles/alphabox.scss +222 -222
  86. package/src/styles/app.scss +7 -7
  87. package/src/styles/autosuggest.scss +57 -57
  88. package/src/styles/databox.scss +563 -563
  89. package/src/styles/diagramme.scss +119 -119
  90. package/src/styles/flowbox.scss +72 -72
  91. package/src/styles/maps.scss +395 -395
  92. package/stories/AUButtonComponent.stories.tsx +85 -85
  93. package/stories/AUModalComponent.stories.tsx +92 -0
  94. package/stories/AUSpinnerComponent.stories.tsx +41 -41
  95. package/stories/AUToolbarComponent.stories.tsx +96 -0
  96. package/tsconfig.json +46 -46
  97. package/webpack.config.js +89 -89
@@ -1,64 +1,64 @@
1
- /* eslint-env browser */
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
- import DataBoxStackedAssociationComponent from './DataBoxStackedAssociationComponent';
5
- import DataBoxAssociationComponent from './DataBoxAssociationComponent';
6
-
7
- const DataBoxGroupingComponent = (props) => {
8
- const {
9
- stacked,
10
- grouping,
11
- expand,
12
- rememberState,
13
- boxID,
14
- } = props;
15
- let renderAssociations;
16
- if (stacked && grouping.associations.length === 1) {
17
- // eslint-disable-next-line react/destructuring-assignment
18
- renderAssociations = props.grouping.associations.map(
19
- (a) => <DataBoxStackedAssociationComponent key={a.id} assoc={a} />,
20
- );
21
- } else {
22
- // eslint-disable-next-line react/destructuring-assignment
23
- renderAssociations = props.grouping.associations.map((a, i) => {
24
- const open = expand
25
- || grouping.associations.length === 1
26
- || (rememberState && sessionStorage.getItem(`box-${boxID}-group-${grouping.id}-index-${i}`));
27
- return (
28
- <DataBoxAssociationComponent
29
- key={a.id}
30
- open={open}
31
- boxID={boxID}
32
- rememberState={rememberState}
33
- grouping={grouping.id}
34
- index={i}
35
- assoc={a}
36
- />
37
- );
38
- });
39
- }
40
-
41
- return (
42
- <div id={`box-${boxID}-grouping-${grouping.id}`}>
43
- {renderAssociations}
44
- </div>
45
- );
46
- };
47
-
48
- DataBoxGroupingComponent.defaultProps = {
49
-
50
- };
51
-
52
- DataBoxGroupingComponent.propTypes = {
53
- boxID: PropTypes.number.isRequired,
54
- stacked: PropTypes.bool.isRequired,
55
- expand: PropTypes.bool.isRequired,
56
- rememberState: PropTypes.bool.isRequired,
57
- grouping: PropTypes.shape({
58
- id: PropTypes.number.isRequired,
59
- associations: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
60
- }).isRequired,
61
- };
62
-
63
- DataBoxGroupingComponent.displayName = 'DataBoxGroupingComponent';
64
- export default DataBoxGroupingComponent;
1
+ /* eslint-env browser */
2
+ import React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import DataBoxStackedAssociationComponent from './DataBoxStackedAssociationComponent';
5
+ import DataBoxAssociationComponent from './DataBoxAssociationComponent';
6
+
7
+ const DataBoxGroupingComponent = (props) => {
8
+ const {
9
+ stacked,
10
+ grouping,
11
+ expand,
12
+ rememberState,
13
+ boxID,
14
+ } = props;
15
+ let renderAssociations;
16
+ if (stacked && grouping.associations.length === 1) {
17
+ // eslint-disable-next-line react/destructuring-assignment
18
+ renderAssociations = props.grouping.associations.map(
19
+ (a) => <DataBoxStackedAssociationComponent key={a.id} assoc={a} />,
20
+ );
21
+ } else {
22
+ // eslint-disable-next-line react/destructuring-assignment
23
+ renderAssociations = props.grouping.associations.map((a, i) => {
24
+ const open = expand
25
+ || grouping.associations.length === 1
26
+ || (rememberState && sessionStorage.getItem(`box-${boxID}-group-${grouping.id}-index-${i}`));
27
+ return (
28
+ <DataBoxAssociationComponent
29
+ key={a.id}
30
+ open={open}
31
+ boxID={boxID}
32
+ rememberState={rememberState}
33
+ grouping={grouping.id}
34
+ index={i}
35
+ assoc={a}
36
+ />
37
+ );
38
+ });
39
+ }
40
+
41
+ return (
42
+ <div id={`box-${boxID}-grouping-${grouping.id}`}>
43
+ {renderAssociations}
44
+ </div>
45
+ );
46
+ };
47
+
48
+ DataBoxGroupingComponent.defaultProps = {
49
+
50
+ };
51
+
52
+ DataBoxGroupingComponent.propTypes = {
53
+ boxID: PropTypes.number.isRequired,
54
+ stacked: PropTypes.bool.isRequired,
55
+ expand: PropTypes.bool.isRequired,
56
+ rememberState: PropTypes.bool.isRequired,
57
+ grouping: PropTypes.shape({
58
+ id: PropTypes.number.isRequired,
59
+ associations: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
60
+ }).isRequired,
61
+ };
62
+
63
+ DataBoxGroupingComponent.displayName = 'DataBoxGroupingComponent';
64
+ export default DataBoxGroupingComponent;
@@ -1,36 +1,36 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { sortAlphaObj } from '../../../lib/helpers';
4
-
5
- const DataBoxSearchResultComponent = (props) => {
6
- const { items, searchValue } = props;
7
- const renderItems = items.sort(sortAlphaObj).filter(
8
- (x) => x.name.toLowerCase().indexOf(searchValue.toLowerCase()) > -1,
9
- ).map((item) => (
10
- <li key={item.id}>
11
- <a href={item.url}>
12
- {item.name}
13
- </a>
14
- </li>
15
- ));
16
-
17
- return (
18
- <div>
19
- <ul>
20
- {renderItems}
21
- </ul>
22
- </div>
23
- );
24
- };
25
-
26
- DataBoxSearchResultComponent.propTypes = {
27
- items: PropTypes.arrayOf(PropTypes.shape({
28
- id: PropTypes.number.isRequired,
29
- url: PropTypes.string.isRequired,
30
- name: PropTypes.string.isRequired,
31
- })).isRequired,
32
- searchValue: PropTypes.string.isRequired,
33
- };
34
-
35
- DataBoxSearchResultComponent.displayName = 'DataBoxSearchResultComponent';
36
- export default DataBoxSearchResultComponent;
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { sortAlphaObj } from '../../../lib/helpers';
4
+
5
+ const DataBoxSearchResultComponent = (props) => {
6
+ const { items, searchValue } = props;
7
+ const renderItems = items.sort(sortAlphaObj).filter(
8
+ (x) => x.name.toLowerCase().indexOf(searchValue.toLowerCase()) > -1,
9
+ ).map((item) => (
10
+ <li key={item.id}>
11
+ <a href={item.url}>
12
+ {item.name}
13
+ </a>
14
+ </li>
15
+ ));
16
+
17
+ return (
18
+ <div>
19
+ <ul>
20
+ {renderItems}
21
+ </ul>
22
+ </div>
23
+ );
24
+ };
25
+
26
+ DataBoxSearchResultComponent.propTypes = {
27
+ items: PropTypes.arrayOf(PropTypes.shape({
28
+ id: PropTypes.number.isRequired,
29
+ url: PropTypes.string.isRequired,
30
+ name: PropTypes.string.isRequired,
31
+ })).isRequired,
32
+ searchValue: PropTypes.string.isRequired,
33
+ };
34
+
35
+ DataBoxSearchResultComponent.displayName = 'DataBoxSearchResultComponent';
36
+ export default DataBoxSearchResultComponent;
@@ -1,54 +1,54 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { sortAlphaObj } from '../../../lib/helpers';
4
-
5
- const DataBoxStackedAssociationComponent = (props) => {
6
- const { assoc } = props;
7
- const renderItems = assoc.items.sort(sortAlphaObj).map((item) => {
8
- if (item.children.length > 0) {
9
- const renderChildren = item.children.sort(sortAlphaObj).map((c) => (
10
- <li key={c.id}>
11
- <a href={c.url}>
12
- {c.name}
13
- </a>
14
- </li>
15
- ));
16
-
17
- return (
18
- <li key={item.id}>
19
- <a href={item.url}>
20
- {item.name}
21
- </a>
22
- <ul>
23
- {renderChildren}
24
- </ul>
25
- </li>
26
- );
27
- }
28
-
29
- return (
30
- <li key={item.id}>
31
- <a href={item.url}>
32
- {item.name}
33
- </a>
34
- </li>
35
- );
36
- });
37
-
38
- return (
39
- <div>
40
- <ul>
41
- {renderItems}
42
- </ul>
43
- </div>
44
- );
45
- };
46
-
47
- DataBoxStackedAssociationComponent.propTypes = {
48
- assoc: PropTypes.shape({
49
- items: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
50
- }).isRequired,
51
- };
52
-
53
- DataBoxStackedAssociationComponent.displayName = 'DataBoxStackedAssociationComponent';
54
- export default DataBoxStackedAssociationComponent;
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { sortAlphaObj } from '../../../lib/helpers';
4
+
5
+ const DataBoxStackedAssociationComponent = (props) => {
6
+ const { assoc } = props;
7
+ const renderItems = assoc.items.sort(sortAlphaObj).map((item) => {
8
+ if (item.children.length > 0) {
9
+ const renderChildren = item.children.sort(sortAlphaObj).map((c) => (
10
+ <li key={c.id}>
11
+ <a href={c.url}>
12
+ {c.name}
13
+ </a>
14
+ </li>
15
+ ));
16
+
17
+ return (
18
+ <li key={item.id}>
19
+ <a href={item.url}>
20
+ {item.name}
21
+ </a>
22
+ <ul>
23
+ {renderChildren}
24
+ </ul>
25
+ </li>
26
+ );
27
+ }
28
+
29
+ return (
30
+ <li key={item.id}>
31
+ <a href={item.url}>
32
+ {item.name}
33
+ </a>
34
+ </li>
35
+ );
36
+ });
37
+
38
+ return (
39
+ <div>
40
+ <ul>
41
+ {renderItems}
42
+ </ul>
43
+ </div>
44
+ );
45
+ };
46
+
47
+ DataBoxStackedAssociationComponent.propTypes = {
48
+ assoc: PropTypes.shape({
49
+ items: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
50
+ }).isRequired,
51
+ };
52
+
53
+ DataBoxStackedAssociationComponent.displayName = 'DataBoxStackedAssociationComponent';
54
+ export default DataBoxStackedAssociationComponent;
@@ -1,39 +1,39 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- class DataBoxSuggestionComponent extends React.Component {
5
- constructor(props) {
6
- super(props);
7
-
8
- this.state = {
9
- item: props.item,
10
- };
11
- }
12
-
13
- static getDerivedStateFromProps(nextProps, prevState) {
14
- if (nextProps.item.id !== prevState.item.id) {
15
- return {
16
- item: nextProps.item,
17
- };
18
- }
19
-
20
- return null;
21
- }
22
-
23
- render() {
24
- const { item } = this.state;
25
- return (
26
- <span>
27
- {item.name}
28
- </span>
29
- );
30
- }
31
- }
32
-
33
- DataBoxSuggestionComponent.propTypes = {
34
- item: PropTypes.shape({
35
- id: PropTypes.number.isRequired,
36
- }).isRequired,
37
- };
38
- DataBoxSuggestionComponent.displayName = 'DataBoxSuggestionComponent';
39
- export default DataBoxSuggestionComponent;
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ class DataBoxSuggestionComponent extends React.Component {
5
+ constructor(props) {
6
+ super(props);
7
+
8
+ this.state = {
9
+ item: props.item,
10
+ };
11
+ }
12
+
13
+ static getDerivedStateFromProps(nextProps, prevState) {
14
+ if (nextProps.item.id !== prevState.item.id) {
15
+ return {
16
+ item: nextProps.item,
17
+ };
18
+ }
19
+
20
+ return null;
21
+ }
22
+
23
+ render() {
24
+ const { item } = this.state;
25
+ return (
26
+ <span>
27
+ {item.name}
28
+ </span>
29
+ );
30
+ }
31
+ }
32
+
33
+ DataBoxSuggestionComponent.propTypes = {
34
+ item: PropTypes.shape({
35
+ id: PropTypes.number.isRequired,
36
+ }).isRequired,
37
+ };
38
+ DataBoxSuggestionComponent.displayName = 'DataBoxSuggestionComponent';
39
+ export default DataBoxSuggestionComponent;