@aarhus-university/au-lib-react-components 10.0.2 → 10.0.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.
Files changed (44) hide show
  1. package/build/umd/all.css +2 -2
  2. package/build/umd/all.js +1 -1
  3. package/build/umd/alphabox.js +1 -1
  4. package/build/umd/databox.js +1 -1
  5. package/build/umd/diagramme.js +1 -1
  6. package/build/umd/flowbox.js +1 -1
  7. package/build/umd/universe.js +1 -1
  8. package/package.json +1 -1
  9. package/src/components/AUAutoSuggestComponent.js +158 -158
  10. package/src/components/AUSpinnerComponent.tsx +91 -67
  11. package/src/components/AUTabbedContentComponent.tsx +1 -1
  12. package/src/components/AUToastComponent.tsx +12 -13
  13. package/src/components/profile/AUProfileLoginComponent.tsx +26 -26
  14. package/src/layout-2016/components/alphabox/AlphaBoxComponent.js +143 -143
  15. package/src/layout-2016/components/alphabox/AlphaBoxContentComponent.js +136 -136
  16. package/src/layout-2016/components/common/AUCollapsibleComponent.js +152 -152
  17. package/src/layout-2016/components/common/AUSpinnerComponent.js +103 -103
  18. package/src/layout-2016/components/databox/DataBoxAlphabetComponent.js +144 -144
  19. package/src/layout-2016/components/databox/DataBoxAssociationComponent.js +122 -122
  20. package/src/layout-2016/components/databox/DataBoxButtonComponent.js +157 -157
  21. package/src/layout-2016/components/databox/DataBoxComponent.js +297 -297
  22. package/src/layout-2016/components/databox/DataBoxGroupingComponent.js +64 -64
  23. package/src/layout-2016/components/databox/DataBoxSearchResultComponent.js +36 -36
  24. package/src/layout-2016/components/databox/DataBoxStackedAssociationComponent.js +54 -54
  25. package/src/layout-2016/components/databox/DataBoxSuggestionComponent.js +39 -39
  26. package/src/layout-2016/components/diagramme/AUDiagrammeComponent.js +309 -309
  27. package/src/layout-2016/components/flowbox/FlowBoxComponent.js +126 -126
  28. package/src/layout-2016/components/flowbox/FlowBoxPhoneComponent.js +104 -104
  29. package/src/layout-2016/components/profile/AUProfileAvatar2016Component.js +103 -103
  30. package/src/layout-2016/components/universe/StaffTopComponent.js +363 -363
  31. package/src/layout-2016/components/universe/StudentTopComponent.js +137 -137
  32. package/src/layout-2016/components/universe/UniverseContainerComponent.js +65 -65
  33. package/src/layout-2016/lib/all.js +3 -3
  34. package/src/layout-2016/lib/au-alphabox.js +100 -100
  35. package/src/layout-2016/lib/au-databox.js +400 -400
  36. package/src/layout-2016/lib/au-diagramme.js +85 -85
  37. package/src/layout-2016/lib/au-flowbox.js +93 -93
  38. package/src/layout-2016/lib/universe.js +9 -9
  39. package/src/lib/helpers.ts +194 -194
  40. package/tsconfig.json +46 -46
  41. package/types/common/interfaces/gui.d.ts +2 -1
  42. package/types/common/interfaces/model.d.ts +29 -29
  43. package/types/common/props.d.ts +166 -165
  44. package/webpack.config.js +89 -89
@@ -1,122 +1,122 @@
1
- /* eslint-env browser */
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
- import { sortAlphaObj } from '../../../lib/helpers';
5
- import AUCollapsibleComponent from '../common/AUCollapsibleComponent';
6
-
7
- class DataBoxAssociationComponent extends React.Component {
8
- constructor(props) {
9
- super(props);
10
-
11
- this.state = {
12
- open: props.open,
13
- };
14
-
15
- this.handleClick = this.handleClick.bind(this);
16
- }
17
-
18
- handleClick() {
19
- const {
20
- rememberState,
21
- boxID,
22
- grouping,
23
- index,
24
- } = this.props;
25
- const { open } = this.state;
26
- if (rememberState) {
27
- if (open) {
28
- sessionStorage.removeItem(`box-${boxID}-group-${grouping}-index-${index}`);
29
- } else {
30
- sessionStorage.setItem(`box-${boxID}-group-${grouping}-index-${index}`, true);
31
- }
32
- }
33
- this.setState((prevState) => ({
34
- open: !prevState.open,
35
- }));
36
- }
37
-
38
- render() {
39
- const { open } = this.state;
40
- const { assoc } = this.props;
41
- const { items } = assoc;
42
- const renderItems = items.sort(sortAlphaObj).map((item) => {
43
- if (item.children.length > 0) {
44
- const renderChildren = item.children.sort(sortAlphaObj).map((c) => (
45
- <li key={c.id}>
46
- <a href={c.url}>
47
- {c.name}
48
- </a>
49
- </li>
50
- ));
51
-
52
- return (
53
- <li key={item.id}>
54
- {(() => {
55
- if (!item.url) {
56
- return (
57
- <span>
58
- {item.name}
59
- </span>
60
- );
61
- }
62
- return (
63
- <a href={item.url}>
64
- {item.name}
65
- </a>
66
- );
67
- })()}
68
- <ul>
69
- {renderChildren}
70
- </ul>
71
- </li>
72
- );
73
- }
74
-
75
- return (
76
- <li key={item.id}>
77
- <a href={item.url}>
78
- {item.name}
79
- </a>
80
- </li>
81
- );
82
- });
83
-
84
- const content = (
85
- <ul>
86
- {renderItems}
87
- </ul>
88
- );
89
-
90
- return (
91
- <AUCollapsibleComponent
92
- key={open}
93
- collapsed={!open}
94
- level={3}
95
- header={assoc.name}
96
- content={content}
97
- onClick={this.handleClick}
98
- />
99
- );
100
- }
101
- }
102
-
103
- DataBoxAssociationComponent.defaultProps = {
104
-
105
- };
106
-
107
- DataBoxAssociationComponent.propTypes = {
108
- boxID: PropTypes.number.isRequired,
109
- grouping: PropTypes.number.isRequired,
110
- assoc: PropTypes.shape({
111
- name: PropTypes.string.isRequired,
112
- items: PropTypes.arrayOf(PropTypes.shape({
113
-
114
- })).isRequired,
115
- }).isRequired,
116
- index: PropTypes.number.isRequired,
117
- open: PropTypes.bool.isRequired,
118
- rememberState: PropTypes.bool.isRequired,
119
- };
120
-
121
- DataBoxAssociationComponent.displayName = 'DataBoxAssociationComponent';
122
- export default DataBoxAssociationComponent;
1
+ /* eslint-env browser */
2
+ import React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import { sortAlphaObj } from '../../../lib/helpers';
5
+ import AUCollapsibleComponent from '../common/AUCollapsibleComponent';
6
+
7
+ class DataBoxAssociationComponent extends React.Component {
8
+ constructor(props) {
9
+ super(props);
10
+
11
+ this.state = {
12
+ open: props.open,
13
+ };
14
+
15
+ this.handleClick = this.handleClick.bind(this);
16
+ }
17
+
18
+ handleClick() {
19
+ const {
20
+ rememberState,
21
+ boxID,
22
+ grouping,
23
+ index,
24
+ } = this.props;
25
+ const { open } = this.state;
26
+ if (rememberState) {
27
+ if (open) {
28
+ sessionStorage.removeItem(`box-${boxID}-group-${grouping}-index-${index}`);
29
+ } else {
30
+ sessionStorage.setItem(`box-${boxID}-group-${grouping}-index-${index}`, true);
31
+ }
32
+ }
33
+ this.setState((prevState) => ({
34
+ open: !prevState.open,
35
+ }));
36
+ }
37
+
38
+ render() {
39
+ const { open } = this.state;
40
+ const { assoc } = this.props;
41
+ const { items } = assoc;
42
+ const renderItems = items.sort(sortAlphaObj).map((item) => {
43
+ if (item.children.length > 0) {
44
+ const renderChildren = item.children.sort(sortAlphaObj).map((c) => (
45
+ <li key={c.id}>
46
+ <a href={c.url}>
47
+ {c.name}
48
+ </a>
49
+ </li>
50
+ ));
51
+
52
+ return (
53
+ <li key={item.id}>
54
+ {(() => {
55
+ if (!item.url) {
56
+ return (
57
+ <span>
58
+ {item.name}
59
+ </span>
60
+ );
61
+ }
62
+ return (
63
+ <a href={item.url}>
64
+ {item.name}
65
+ </a>
66
+ );
67
+ })()}
68
+ <ul>
69
+ {renderChildren}
70
+ </ul>
71
+ </li>
72
+ );
73
+ }
74
+
75
+ return (
76
+ <li key={item.id}>
77
+ <a href={item.url}>
78
+ {item.name}
79
+ </a>
80
+ </li>
81
+ );
82
+ });
83
+
84
+ const content = (
85
+ <ul>
86
+ {renderItems}
87
+ </ul>
88
+ );
89
+
90
+ return (
91
+ <AUCollapsibleComponent
92
+ key={open}
93
+ collapsed={!open}
94
+ level={3}
95
+ header={assoc.name}
96
+ content={content}
97
+ onClick={this.handleClick}
98
+ />
99
+ );
100
+ }
101
+ }
102
+
103
+ DataBoxAssociationComponent.defaultProps = {
104
+
105
+ };
106
+
107
+ DataBoxAssociationComponent.propTypes = {
108
+ boxID: PropTypes.number.isRequired,
109
+ grouping: PropTypes.number.isRequired,
110
+ assoc: PropTypes.shape({
111
+ name: PropTypes.string.isRequired,
112
+ items: PropTypes.arrayOf(PropTypes.shape({
113
+
114
+ })).isRequired,
115
+ }).isRequired,
116
+ index: PropTypes.number.isRequired,
117
+ open: PropTypes.bool.isRequired,
118
+ rememberState: PropTypes.bool.isRequired,
119
+ };
120
+
121
+ DataBoxAssociationComponent.displayName = 'DataBoxAssociationComponent';
122
+ export default DataBoxAssociationComponent;
@@ -1,157 +1,157 @@
1
- /* eslint-disable @typescript-eslint/no-empty-function */
2
- /* eslint-env browser */
3
- import React from 'react';
4
- import PropTypes from 'prop-types';
5
- import AUAutoSuggestComponent from '../../../components/AUAutoSuggestComponent';
6
- import DataBoxSuggestionComponent from './DataBoxSuggestionComponent';
7
-
8
- class DataBoxButtonComponent extends React.Component {
9
- constructor(props) {
10
- super(props);
11
-
12
- this.handleClick = this.handleClick.bind(this);
13
- this.handleChange = this.handleChange.bind(this);
14
- }
15
-
16
- handleClick() {
17
- const { setActive, active, index } = this.props;
18
- setActive(active ? 0 : index + 1);
19
- }
20
-
21
- handleChange(e) {
22
- const { value } = e.target;
23
- const { setSearchValue } = this.props;
24
- const newHistory = `${[window.location.protocol, '//', window.location.host, window.location.pathname].join('')}?initval=${value}`;
25
- window.history.replaceState({
26
- initVal: value,
27
- }, document.title, newHistory);
28
- setSearchValue(value);
29
- }
30
-
31
- render() {
32
- const {
33
- button: b,
34
- index, box,
35
- active,
36
- getSuggestions,
37
- searchValue,
38
- } = this.props;
39
- const i = index + 1;
40
- const bg = box.background;
41
-
42
- let classNames = `db-button button-${i}`;
43
- const search = box.search.index === i;
44
-
45
- if (bg.overlay) {
46
- classNames += ' overlay';
47
- }
48
-
49
- if (search) {
50
- classNames += ' db-search';
51
- }
52
-
53
- if (active && !search) {
54
- classNames += ' active';
55
- }
56
-
57
- if (search) {
58
- if (box.search.autocomplete) {
59
- return (
60
- <div className={classNames} key={i}>
61
- <span dangerouslySetInnerHTML={{ __html: b.text }} />
62
- <AUAutoSuggestComponent
63
- placeholder={box.search.placeHolder}
64
- setQuery={() => { }}
65
- setResults={(items) => {
66
- if (items.length === 1 && items[0].url) {
67
- window.location.href = items[0].url;
68
- }
69
- }}
70
- collection={[]}
71
- getSuggestions={getSuggestions}
72
- getSuggestionValue={(suggestion) => suggestion.name}
73
- renderSuggestion={(suggestion) => <DataBoxSuggestionComponent item={suggestion} />}
74
- />
75
- </div>
76
- );
77
- }
78
- return (
79
- <div className={classNames} key={i}>
80
- <span>
81
- {b.text}
82
- </span>
83
- <input type="text" value={searchValue} placeholder={box.search.placeHolder} onChange={this.handleChange} />
84
- </div>
85
- );
86
- }
87
-
88
- if (b.link !== '') {
89
- return (
90
- <div
91
- key={i}
92
- role="button"
93
- tabIndex="0"
94
- onClick={this.handleClick}
95
- onKeyUp={() => { }}
96
- className={classNames}
97
- >
98
- <span>
99
- <a href={b.link}>
100
- {b.text}
101
- </a>
102
- </span>
103
- </div>
104
- );
105
- }
106
-
107
- return (
108
- <div
109
- key={i}
110
- role="button"
111
- tabIndex="0"
112
- onClick={this.handleClick}
113
- onKeyUp={() => { }}
114
- className={classNames}
115
- >
116
- <span>
117
- {b.text}
118
- </span>
119
- </div>
120
- );
121
- }
122
- }
123
-
124
- DataBoxButtonComponent.defaultProps = {
125
- searchValue: '',
126
- };
127
-
128
- DataBoxButtonComponent.propTypes = {
129
- active: PropTypes.bool.isRequired,
130
- index: PropTypes.number.isRequired,
131
- searchValue: PropTypes.string,
132
- setActive: PropTypes.func.isRequired,
133
- setSearchValue: PropTypes.func.isRequired,
134
- button: PropTypes.shape({
135
- text: PropTypes.string.isRequired,
136
- link: PropTypes.string.isRequired,
137
- }).isRequired,
138
- box: PropTypes.shape({
139
- background: PropTypes.shape({
140
- color: PropTypes.string.isRequired,
141
- linkColor: PropTypes.string.isRequired,
142
- src: PropTypes.string.isRequired,
143
- height: PropTypes.number.isRequired,
144
- text: PropTypes.string.isRequired,
145
- overlay: PropTypes.bool.isRequired,
146
- }).isRequired,
147
- search: PropTypes.shape({
148
- index: PropTypes.number.isRequired,
149
- autocomplete: PropTypes.bool.isRequired,
150
- placeHolder: PropTypes.string.isRequired,
151
- }).isRequired,
152
- }).isRequired,
153
- getSuggestions: PropTypes.func.isRequired,
154
- };
155
-
156
- DataBoxButtonComponent.displayName = 'DataBoxButtonComponent';
157
- export default DataBoxButtonComponent;
1
+ /* eslint-disable @typescript-eslint/no-empty-function */
2
+ /* eslint-env browser */
3
+ import React from 'react';
4
+ import PropTypes from 'prop-types';
5
+ import AUAutoSuggestComponent from '../../../components/AUAutoSuggestComponent';
6
+ import DataBoxSuggestionComponent from './DataBoxSuggestionComponent';
7
+
8
+ class DataBoxButtonComponent extends React.Component {
9
+ constructor(props) {
10
+ super(props);
11
+
12
+ this.handleClick = this.handleClick.bind(this);
13
+ this.handleChange = this.handleChange.bind(this);
14
+ }
15
+
16
+ handleClick() {
17
+ const { setActive, active, index } = this.props;
18
+ setActive(active ? 0 : index + 1);
19
+ }
20
+
21
+ handleChange(e) {
22
+ const { value } = e.target;
23
+ const { setSearchValue } = this.props;
24
+ const newHistory = `${[window.location.protocol, '//', window.location.host, window.location.pathname].join('')}?initval=${value}`;
25
+ window.history.replaceState({
26
+ initVal: value,
27
+ }, document.title, newHistory);
28
+ setSearchValue(value);
29
+ }
30
+
31
+ render() {
32
+ const {
33
+ button: b,
34
+ index, box,
35
+ active,
36
+ getSuggestions,
37
+ searchValue,
38
+ } = this.props;
39
+ const i = index + 1;
40
+ const bg = box.background;
41
+
42
+ let classNames = `db-button button-${i}`;
43
+ const search = box.search.index === i;
44
+
45
+ if (bg.overlay) {
46
+ classNames += ' overlay';
47
+ }
48
+
49
+ if (search) {
50
+ classNames += ' db-search';
51
+ }
52
+
53
+ if (active && !search) {
54
+ classNames += ' active';
55
+ }
56
+
57
+ if (search) {
58
+ if (box.search.autocomplete) {
59
+ return (
60
+ <div className={classNames} key={i}>
61
+ <span dangerouslySetInnerHTML={{ __html: b.text }} />
62
+ <AUAutoSuggestComponent
63
+ placeholder={box.search.placeHolder}
64
+ setQuery={() => { }}
65
+ setResults={(items) => {
66
+ if (items.length === 1 && items[0].url) {
67
+ window.location.href = items[0].url;
68
+ }
69
+ }}
70
+ collection={[]}
71
+ getSuggestions={getSuggestions}
72
+ getSuggestionValue={(suggestion) => suggestion.name}
73
+ renderSuggestion={(suggestion) => <DataBoxSuggestionComponent item={suggestion} />}
74
+ />
75
+ </div>
76
+ );
77
+ }
78
+ return (
79
+ <div className={classNames} key={i}>
80
+ <span>
81
+ {b.text}
82
+ </span>
83
+ <input type="text" value={searchValue} placeholder={box.search.placeHolder} onChange={this.handleChange} />
84
+ </div>
85
+ );
86
+ }
87
+
88
+ if (b.link !== '') {
89
+ return (
90
+ <div
91
+ key={i}
92
+ role="button"
93
+ tabIndex="0"
94
+ onClick={this.handleClick}
95
+ onKeyUp={() => { }}
96
+ className={classNames}
97
+ >
98
+ <span>
99
+ <a href={b.link}>
100
+ {b.text}
101
+ </a>
102
+ </span>
103
+ </div>
104
+ );
105
+ }
106
+
107
+ return (
108
+ <div
109
+ key={i}
110
+ role="button"
111
+ tabIndex="0"
112
+ onClick={this.handleClick}
113
+ onKeyUp={() => { }}
114
+ className={classNames}
115
+ >
116
+ <span>
117
+ {b.text}
118
+ </span>
119
+ </div>
120
+ );
121
+ }
122
+ }
123
+
124
+ DataBoxButtonComponent.defaultProps = {
125
+ searchValue: '',
126
+ };
127
+
128
+ DataBoxButtonComponent.propTypes = {
129
+ active: PropTypes.bool.isRequired,
130
+ index: PropTypes.number.isRequired,
131
+ searchValue: PropTypes.string,
132
+ setActive: PropTypes.func.isRequired,
133
+ setSearchValue: PropTypes.func.isRequired,
134
+ button: PropTypes.shape({
135
+ text: PropTypes.string.isRequired,
136
+ link: PropTypes.string.isRequired,
137
+ }).isRequired,
138
+ box: PropTypes.shape({
139
+ background: PropTypes.shape({
140
+ color: PropTypes.string.isRequired,
141
+ linkColor: PropTypes.string.isRequired,
142
+ src: PropTypes.string.isRequired,
143
+ height: PropTypes.number.isRequired,
144
+ text: PropTypes.string.isRequired,
145
+ overlay: PropTypes.bool.isRequired,
146
+ }).isRequired,
147
+ search: PropTypes.shape({
148
+ index: PropTypes.number.isRequired,
149
+ autocomplete: PropTypes.bool.isRequired,
150
+ placeHolder: PropTypes.string.isRequired,
151
+ }).isRequired,
152
+ }).isRequired,
153
+ getSuggestions: PropTypes.func.isRequired,
154
+ };
155
+
156
+ DataBoxButtonComponent.displayName = 'DataBoxButtonComponent';
157
+ export default DataBoxButtonComponent;