@aarhus-university/au-lib-react-components 11.3.2 → 11.4.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.
- package/.eslintrc.js +34 -34
- package/.storybook/main.js +20 -20
- package/.storybook/preview.js +17 -17
- package/README.md +19 -19
- package/__tests__/jest/AUButtonComponent.test.tsx +165 -165
- package/__tests__/jest/AUErrorComponent.test.tsx +142 -142
- package/__tests__/jest/AUModalComponent.test.tsx +186 -186
- package/__tests__/jest/AUNotificationComponent.test.tsx +115 -115
- package/__tests__/jest/AUSpinnerComponent.test.tsx +57 -57
- package/__tests__/jest/AUToolbarComponent.test.tsx +46 -46
- package/__tests__/jest/context.test.ts +25 -25
- package/__tests__/jest/helpers.test.ts +15 -15
- package/__tests__/jest/setupTests.ts +2 -2
- package/babel.config.js +8 -8
- package/build/umd/all.css +2 -2
- package/build/umd/all.js +1 -1
- package/build/umd/alphabox.js +1 -1
- package/build/umd/databox.js +1 -1
- package/build/umd/diagramme.js +1 -1
- package/build/umd/flowbox.js +1 -1
- package/build/umd/universe.js +1 -1
- package/build-storybook.log +367 -367
- package/package.json +114 -114
- package/src/components/AUAlertComponent.tsx +70 -70
- package/src/components/AUAutoSuggestComponent.js +158 -158
- package/src/components/AUButtonComponent.tsx +84 -84
- package/src/components/AUCalendarComponent.tsx +493 -493
- package/src/components/AUContentToggleComponent.tsx +47 -47
- package/src/components/AUDatepickerComponent.tsx +121 -121
- package/src/components/AUErrorComponent.tsx +78 -78
- package/src/components/AUMobilePrefixComponent.tsx +15 -15
- package/src/components/AUModalComponent.tsx +68 -68
- package/src/components/AUNotificationComponent.tsx +43 -43
- package/src/components/AUReceiptComponent.tsx +33 -33
- package/src/components/AUSpinnerComponent.tsx +36 -36
- package/src/components/AUStepComponent.tsx +47 -41
- package/src/components/AUSubNavComponent.tsx +48 -48
- package/src/components/AUSubmitButtonContainerComponent.tsx +29 -29
- package/src/components/AUTabbedContentComponent.tsx +145 -145
- package/src/components/AUTableComponent.tsx +24 -24
- package/src/components/AUToastComponent.tsx +104 -104
- package/src/components/AUToolbarComponent.tsx +101 -101
- package/src/components/AUTruncatorComponent.tsx +124 -129
- package/src/components/wrapping/AUEmbedComponent.js +47 -47
- package/src/layout-2016/components/alphabox/AlphaBoxComponent.js +143 -143
- package/src/layout-2016/components/alphabox/AlphaBoxContentComponent.js +136 -136
- package/src/layout-2016/components/common/AUCollapsibleComponent.js +152 -152
- package/src/layout-2016/components/common/AUSpinnerComponent.js +103 -103
- package/src/layout-2016/components/databox/DataBoxAlphabetComponent.js +144 -144
- package/src/layout-2016/components/databox/DataBoxAssociationComponent.js +122 -122
- package/src/layout-2016/components/databox/DataBoxButtonComponent.js +157 -157
- package/src/layout-2016/components/databox/DataBoxComponent.js +297 -297
- package/src/layout-2016/components/databox/DataBoxGroupingComponent.js +64 -64
- package/src/layout-2016/components/databox/DataBoxSearchResultComponent.js +36 -36
- package/src/layout-2016/components/databox/DataBoxStackedAssociationComponent.js +54 -54
- package/src/layout-2016/components/databox/DataBoxSuggestionComponent.js +39 -39
- package/src/layout-2016/components/diagramme/AUDiagrammeComponent.js +309 -309
- package/src/layout-2016/components/flowbox/FlowBoxComponent.js +126 -126
- package/src/layout-2016/components/flowbox/FlowBoxPhoneComponent.js +104 -104
- package/src/layout-2016/components/profile/AUProfileAvatar2016Component.js +103 -103
- package/src/layout-2016/components/universe/StaffTopComponent.js +363 -363
- package/src/layout-2016/components/universe/StudentTopComponent.js +137 -137
- package/src/layout-2016/components/universe/UniverseContainerComponent.js +65 -65
- package/src/layout-2016/lib/all.js +3 -3
- package/src/layout-2016/lib/au-alphabox.js +100 -100
- package/src/layout-2016/lib/au-databox.js +400 -400
- package/src/layout-2016/lib/au-diagramme.js +85 -85
- package/src/layout-2016/lib/au-flowbox.js +93 -93
- package/src/layout-2016/lib/universe.js +9 -9
- package/src/lib/context.tsx +51 -51
- package/src/lib/dates.ts +50 -50
- package/src/lib/helpers.ts +208 -208
- package/src/lib/hooks.ts +75 -75
- package/src/lib/i18n.ts +600 -600
- package/src/lib/portals.tsx +119 -119
- package/src/lib/tracking.ts +69 -69
- package/src/lib/wrapping.ts +21 -21
- package/src/styles/_settings.scss +10 -10
- package/src/styles/alphabox.scss +222 -222
- package/src/styles/app.scss +7 -7
- package/src/styles/autosuggest.scss +57 -57
- package/src/styles/databox.scss +563 -563
- package/src/styles/diagramme.scss +119 -119
- package/src/styles/flowbox.scss +72 -72
- package/src/styles/maps.scss +395 -395
- package/stories/AUButtonComponent.stories.tsx +127 -127
- package/stories/AUContentToggleComponent.stories.tsx +63 -63
- package/stories/AUErrorComponent.stories.tsx +98 -98
- package/stories/AUModalComponent.stories.tsx +83 -83
- package/stories/AUNotificationComponent.stories.tsx +116 -116
- package/stories/AUSpinnerComponent.stories.tsx +41 -41
- package/stories/AUStepComponent.stories.tsx +40 -40
- package/stories/AUToolbarComponent.stories.tsx +326 -326
- package/stories/AUTruncatorComponent.stories.tsx +102 -0
- package/stories/lib/helpers.tsx +128 -128
- package/tsconfig.json +46 -46
- package/webpack.config.js +89 -89
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
/* eslint-disable react/no-array-index-key */
|
|
2
|
-
/* eslint-env browser */
|
|
3
|
-
import React, { useEffect, FC, useRef } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
setToolbar, closeAllContentTogglesInToolbar, ExtendedCleanUpPair, setOverflow,
|
|
6
|
-
} from '@aarhus-university/au-designsystem-delphinus/source/js/components/toolbar';
|
|
7
|
-
|
|
8
|
-
const AUToolbarComponent: FC<AUToolbarComponentProps> = ({
|
|
9
|
-
lang,
|
|
10
|
-
elements,
|
|
11
|
-
noCollapse,
|
|
12
|
-
center,
|
|
13
|
-
title,
|
|
14
|
-
buttonClass,
|
|
15
|
-
buttonElements,
|
|
16
|
-
}: AUToolbarComponentProps) => {
|
|
17
|
-
const toolbarRef = useRef<HTMLDivElement>(null);
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
const onResize = () => {
|
|
20
|
-
if (toolbarRef.current?.querySelector('.toolbar__items')) {
|
|
21
|
-
closeAllContentTogglesInToolbar(toolbarRef.current);
|
|
22
|
-
setOverflow(toolbarRef.current);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
let toolbarCleanUp: ExtendedCleanUpPair[];
|
|
27
|
-
if (toolbarRef.current) {
|
|
28
|
-
// eslint-disable-next-line max-len
|
|
29
|
-
toolbarCleanUp = setToolbar(toolbarRef.current, (toolbar: HTMLElement) => {
|
|
30
|
-
closeAllContentTogglesInToolbar(toolbar);
|
|
31
|
-
}, false);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
window.addEventListener('resize', onResize);
|
|
35
|
-
|
|
36
|
-
// Runs on unmounting
|
|
37
|
-
return () => {
|
|
38
|
-
toolbarCleanUp.forEach((pair: ExtendedCleanUpPair) => {
|
|
39
|
-
if (typeof pair.clickEvent === 'function') {
|
|
40
|
-
pair.element.removeEventListener('click', pair.clickEvent);
|
|
41
|
-
}
|
|
42
|
-
if (typeof pair.keyUpEvent === 'function') {
|
|
43
|
-
pair.element.removeEventListener('keyup', pair.keyUpEvent);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
window.removeEventListener('resize', onResize);
|
|
48
|
-
};
|
|
49
|
-
}, []);
|
|
50
|
-
|
|
51
|
-
const renderElements = elements.map((e, i) => <React.Fragment key={i}>{e}</React.Fragment>);
|
|
52
|
-
const label = lang === 'da' ? 'Muligheder' : 'Options';
|
|
53
|
-
|
|
54
|
-
let toolbarClass = 'toolbar';
|
|
55
|
-
if (noCollapse) {
|
|
56
|
-
toolbarClass = `${toolbarClass} toolbar--no-collapse`;
|
|
57
|
-
}
|
|
58
|
-
if (center) {
|
|
59
|
-
toolbarClass = `${toolbarClass} toolbar--center-align-items`;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return (
|
|
63
|
-
<div
|
|
64
|
-
ref={toolbarRef}
|
|
65
|
-
className={toolbarClass}
|
|
66
|
-
>
|
|
67
|
-
<div className="toolbar__items">
|
|
68
|
-
{renderElements}
|
|
69
|
-
</div>
|
|
70
|
-
<button
|
|
71
|
-
type="button"
|
|
72
|
-
className={buttonClass}
|
|
73
|
-
title={title || label}
|
|
74
|
-
aria-label={title}
|
|
75
|
-
aria-haspopup="true"
|
|
76
|
-
>
|
|
77
|
-
{
|
|
78
|
-
buttonElements?.length === 0 && (title || label)
|
|
79
|
-
}
|
|
80
|
-
{
|
|
81
|
-
(buttonElements || []).map((element, index) => (
|
|
82
|
-
<React.Fragment key={index}>
|
|
83
|
-
{element}
|
|
84
|
-
</React.Fragment>
|
|
85
|
-
))
|
|
86
|
-
}
|
|
87
|
-
</button>
|
|
88
|
-
</div>
|
|
89
|
-
);
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
AUToolbarComponent.defaultProps = {
|
|
93
|
-
noCollapse: false,
|
|
94
|
-
center: false,
|
|
95
|
-
title: undefined,
|
|
96
|
-
buttonClass: 'toolbar__toggle',
|
|
97
|
-
buttonElements: [],
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
AUToolbarComponent.displayName = 'AUToolbarComponent';
|
|
101
|
-
export default AUToolbarComponent;
|
|
1
|
+
/* eslint-disable react/no-array-index-key */
|
|
2
|
+
/* eslint-env browser */
|
|
3
|
+
import React, { useEffect, FC, useRef } from 'react';
|
|
4
|
+
import {
|
|
5
|
+
setToolbar, closeAllContentTogglesInToolbar, ExtendedCleanUpPair, setOverflow,
|
|
6
|
+
} from '@aarhus-university/au-designsystem-delphinus/source/js/components/toolbar';
|
|
7
|
+
|
|
8
|
+
const AUToolbarComponent: FC<AUToolbarComponentProps> = ({
|
|
9
|
+
lang,
|
|
10
|
+
elements,
|
|
11
|
+
noCollapse,
|
|
12
|
+
center,
|
|
13
|
+
title,
|
|
14
|
+
buttonClass,
|
|
15
|
+
buttonElements,
|
|
16
|
+
}: AUToolbarComponentProps) => {
|
|
17
|
+
const toolbarRef = useRef<HTMLDivElement>(null);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const onResize = () => {
|
|
20
|
+
if (toolbarRef.current?.querySelector('.toolbar__items')) {
|
|
21
|
+
closeAllContentTogglesInToolbar(toolbarRef.current);
|
|
22
|
+
setOverflow(toolbarRef.current);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
let toolbarCleanUp: ExtendedCleanUpPair[];
|
|
27
|
+
if (toolbarRef.current) {
|
|
28
|
+
// eslint-disable-next-line max-len
|
|
29
|
+
toolbarCleanUp = setToolbar(toolbarRef.current, (toolbar: HTMLElement) => {
|
|
30
|
+
closeAllContentTogglesInToolbar(toolbar);
|
|
31
|
+
}, false);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
window.addEventListener('resize', onResize);
|
|
35
|
+
|
|
36
|
+
// Runs on unmounting
|
|
37
|
+
return () => {
|
|
38
|
+
toolbarCleanUp.forEach((pair: ExtendedCleanUpPair) => {
|
|
39
|
+
if (typeof pair.clickEvent === 'function') {
|
|
40
|
+
pair.element.removeEventListener('click', pair.clickEvent);
|
|
41
|
+
}
|
|
42
|
+
if (typeof pair.keyUpEvent === 'function') {
|
|
43
|
+
pair.element.removeEventListener('keyup', pair.keyUpEvent);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
window.removeEventListener('resize', onResize);
|
|
48
|
+
};
|
|
49
|
+
}, []);
|
|
50
|
+
|
|
51
|
+
const renderElements = elements.map((e, i) => <React.Fragment key={i}>{e}</React.Fragment>);
|
|
52
|
+
const label = lang === 'da' ? 'Muligheder' : 'Options';
|
|
53
|
+
|
|
54
|
+
let toolbarClass = 'toolbar';
|
|
55
|
+
if (noCollapse) {
|
|
56
|
+
toolbarClass = `${toolbarClass} toolbar--no-collapse`;
|
|
57
|
+
}
|
|
58
|
+
if (center) {
|
|
59
|
+
toolbarClass = `${toolbarClass} toolbar--center-align-items`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<div
|
|
64
|
+
ref={toolbarRef}
|
|
65
|
+
className={toolbarClass}
|
|
66
|
+
>
|
|
67
|
+
<div className="toolbar__items">
|
|
68
|
+
{renderElements}
|
|
69
|
+
</div>
|
|
70
|
+
<button
|
|
71
|
+
type="button"
|
|
72
|
+
className={buttonClass}
|
|
73
|
+
title={title || label}
|
|
74
|
+
aria-label={title}
|
|
75
|
+
aria-haspopup="true"
|
|
76
|
+
>
|
|
77
|
+
{
|
|
78
|
+
buttonElements?.length === 0 && (title || label)
|
|
79
|
+
}
|
|
80
|
+
{
|
|
81
|
+
(buttonElements || []).map((element, index) => (
|
|
82
|
+
<React.Fragment key={index}>
|
|
83
|
+
{element}
|
|
84
|
+
</React.Fragment>
|
|
85
|
+
))
|
|
86
|
+
}
|
|
87
|
+
</button>
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
AUToolbarComponent.defaultProps = {
|
|
93
|
+
noCollapse: false,
|
|
94
|
+
center: false,
|
|
95
|
+
title: undefined,
|
|
96
|
+
buttonClass: 'toolbar__toggle',
|
|
97
|
+
buttonElements: [],
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
AUToolbarComponent.displayName = 'AUToolbarComponent';
|
|
101
|
+
export default AUToolbarComponent;
|
|
@@ -1,129 +1,124 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
FC, useEffect, useRef, useState,
|
|
3
|
-
} from 'react';
|
|
4
|
-
import { overflowsY } from '@aarhus-university/au-designsystem-delphinus/source/js/components/helpers';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const getMaxLinesStyle = (maxLines: number): React.CSSProperties => ({ '--max-lines': maxLines } as React.CSSProperties);
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
{
|
|
70
|
-
headerLevel ===
|
|
71
|
-
<
|
|
72
|
-
)
|
|
73
|
-
}
|
|
74
|
-
{
|
|
75
|
-
headerLevel ===
|
|
76
|
-
<
|
|
77
|
-
)
|
|
78
|
-
}
|
|
79
|
-
{
|
|
80
|
-
headerLevel ===
|
|
81
|
-
<
|
|
82
|
-
)
|
|
83
|
-
}
|
|
84
|
-
{
|
|
85
|
-
headerLevel ===
|
|
86
|
-
<
|
|
87
|
-
)
|
|
88
|
-
}
|
|
89
|
-
{
|
|
90
|
-
headerLevel ===
|
|
91
|
-
<
|
|
92
|
-
)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
classNames: 'truncator',
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
AUTruncatorComponent.displayName = 'AUTruncatorComponent';
|
|
129
|
-
export default AUTruncatorComponent;
|
|
1
|
+
import React, {
|
|
2
|
+
FC, useEffect, useRef, useState,
|
|
3
|
+
} from 'react';
|
|
4
|
+
import { overflowsY, focusableSelector } from '@aarhus-university/au-designsystem-delphinus/source/js/components/helpers';
|
|
5
|
+
import { truncate } from '@aarhus-university/au-designsystem-delphinus/source/js/components/truncator';
|
|
6
|
+
|
|
7
|
+
const getMaxLinesStyle = (maxLines: number): React.CSSProperties => ({ '--max-lines': maxLines } as React.CSSProperties);
|
|
8
|
+
|
|
9
|
+
const AUTruncatorComponent: FC<AUTruncatorComponentProps> = ({
|
|
10
|
+
maxLines,
|
|
11
|
+
header,
|
|
12
|
+
headerLevel,
|
|
13
|
+
children,
|
|
14
|
+
classNames,
|
|
15
|
+
buttonChild,
|
|
16
|
+
}: AUTruncatorComponentProps) => {
|
|
17
|
+
const expandRef = useRef<HTMLButtonElement>(null);
|
|
18
|
+
const contentRef = useRef<HTMLDivElement>(null);
|
|
19
|
+
const [expanded, setExpanded] = useState<boolean>(false);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (expanded) {
|
|
22
|
+
(expandRef.current as HTMLElement).removeAttribute('hidden');
|
|
23
|
+
expandRef.current?.parentElement?.classList.add('truncator--no-truncation');
|
|
24
|
+
}
|
|
25
|
+
truncate(expandRef.current as HTMLElement, contentRef.current as HTMLElement);
|
|
26
|
+
|
|
27
|
+
const onResize = () => {
|
|
28
|
+
expandRef.current?.setAttribute('hidden', 'hidden');
|
|
29
|
+
expandRef.current?.parentElement?.classList.remove('truncator--no-truncation');
|
|
30
|
+
truncate(expandRef.current as HTMLElement, contentRef.current as HTMLElement);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
window.addEventListener('resize', onResize);
|
|
34
|
+
|
|
35
|
+
const focusElements = contentRef.current?.querySelectorAll(focusableSelector);
|
|
36
|
+
|
|
37
|
+
const onFocus = (event: Event) => {
|
|
38
|
+
if (overflowsY(event.target as HTMLElement)) {
|
|
39
|
+
setExpanded(true);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
if (focusElements) {
|
|
44
|
+
focusElements.forEach((f) => {
|
|
45
|
+
f.addEventListener('focus', onFocus);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return () => {
|
|
50
|
+
if (focusElements) {
|
|
51
|
+
focusElements.forEach((f) => {
|
|
52
|
+
f.removeEventListener('focus', onFocus);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
window.removeEventListener('resize', onResize);
|
|
56
|
+
};
|
|
57
|
+
}, [expanded]);
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<div className={`${classNames}${expanded ? ' truncator--no-truncation' : ''}`} style={getMaxLinesStyle(maxLines)}>
|
|
61
|
+
{
|
|
62
|
+
header && (
|
|
63
|
+
<>
|
|
64
|
+
{
|
|
65
|
+
headerLevel === 1 && (
|
|
66
|
+
<h1 className="truncator__header">{header}</h1>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
{
|
|
70
|
+
headerLevel === 2 && (
|
|
71
|
+
<h2 className="truncator__header">{header}</h2>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
{
|
|
75
|
+
headerLevel === 3 && (
|
|
76
|
+
<h3 className="truncator__header">{header}</h3>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
{
|
|
80
|
+
headerLevel === 4 && (
|
|
81
|
+
<h4 className="truncator__header">{header}</h4>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
{
|
|
85
|
+
headerLevel === 5 && (
|
|
86
|
+
<h5 className="truncator__header">{header}</h5>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
{
|
|
90
|
+
headerLevel === 6 && (
|
|
91
|
+
<h6 className="truncator__header">{header}</h6>
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
</>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
<button
|
|
98
|
+
ref={expandRef}
|
|
99
|
+
type="button"
|
|
100
|
+
className="truncator__expand"
|
|
101
|
+
hidden
|
|
102
|
+
aria-expanded={expanded}
|
|
103
|
+
onClick={() => setExpanded(true)}
|
|
104
|
+
>
|
|
105
|
+
{buttonChild}
|
|
106
|
+
</button>
|
|
107
|
+
<div
|
|
108
|
+
ref={contentRef}
|
|
109
|
+
className="truncator__content"
|
|
110
|
+
>
|
|
111
|
+
{children}
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
AUTruncatorComponent.defaultProps = {
|
|
118
|
+
header: undefined,
|
|
119
|
+
headerLevel: 2,
|
|
120
|
+
classNames: 'truncator',
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
AUTruncatorComponent.displayName = 'AUTruncatorComponent';
|
|
124
|
+
export default AUTruncatorComponent;
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
/* eslint-env browser */
|
|
2
|
-
import React, { useState } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import AUSpinnerComponent from '../delphinus/AUSpinnerComponent';
|
|
5
|
-
import getSourceForFrame from '../../lib/wrapping';
|
|
6
|
-
|
|
7
|
-
const AUEmbedComponent = ({
|
|
8
|
-
api,
|
|
9
|
-
path,
|
|
10
|
-
referrer,
|
|
11
|
-
}) => {
|
|
12
|
-
const [source, setSource] = useState(null);
|
|
13
|
-
const [frameLoaded, setFrameLoaded] = useState(false);
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<AUSpinnerComponent
|
|
17
|
-
loaded={frameLoaded}
|
|
18
|
-
loadingCondition={!frameLoaded}
|
|
19
|
-
onLoad={() => {
|
|
20
|
-
getSourceForFrame(api, path, referrer, (frameSrc) => {
|
|
21
|
-
setSource(frameSrc.url);
|
|
22
|
-
setFrameLoaded(true);
|
|
23
|
-
});
|
|
24
|
-
}}
|
|
25
|
-
>
|
|
26
|
-
<iframe
|
|
27
|
-
id="AUEmbedIframe"
|
|
28
|
-
title="AUEmbed"
|
|
29
|
-
src={source}
|
|
30
|
-
onLoad={() => {
|
|
31
|
-
if (window.iFrameResize) {
|
|
32
|
-
window.iFrameResize({ heightCalculationMethods: 'taggedElement', log: false }, '#AUEmbedIframe');
|
|
33
|
-
}
|
|
34
|
-
}}
|
|
35
|
-
/>
|
|
36
|
-
</AUSpinnerComponent>
|
|
37
|
-
);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
AUEmbedComponent.propTypes = {
|
|
41
|
-
path: PropTypes.string.isRequired,
|
|
42
|
-
api: PropTypes.string.isRequired,
|
|
43
|
-
referrer: PropTypes.string.isRequired,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
AUEmbedComponent.displayName = 'AUEmbedComponent';
|
|
47
|
-
export default AUEmbedComponent;
|
|
1
|
+
/* eslint-env browser */
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import AUSpinnerComponent from '../delphinus/AUSpinnerComponent';
|
|
5
|
+
import getSourceForFrame from '../../lib/wrapping';
|
|
6
|
+
|
|
7
|
+
const AUEmbedComponent = ({
|
|
8
|
+
api,
|
|
9
|
+
path,
|
|
10
|
+
referrer,
|
|
11
|
+
}) => {
|
|
12
|
+
const [source, setSource] = useState(null);
|
|
13
|
+
const [frameLoaded, setFrameLoaded] = useState(false);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<AUSpinnerComponent
|
|
17
|
+
loaded={frameLoaded}
|
|
18
|
+
loadingCondition={!frameLoaded}
|
|
19
|
+
onLoad={() => {
|
|
20
|
+
getSourceForFrame(api, path, referrer, (frameSrc) => {
|
|
21
|
+
setSource(frameSrc.url);
|
|
22
|
+
setFrameLoaded(true);
|
|
23
|
+
});
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
<iframe
|
|
27
|
+
id="AUEmbedIframe"
|
|
28
|
+
title="AUEmbed"
|
|
29
|
+
src={source}
|
|
30
|
+
onLoad={() => {
|
|
31
|
+
if (window.iFrameResize) {
|
|
32
|
+
window.iFrameResize({ heightCalculationMethods: 'taggedElement', log: false }, '#AUEmbedIframe');
|
|
33
|
+
}
|
|
34
|
+
}}
|
|
35
|
+
/>
|
|
36
|
+
</AUSpinnerComponent>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
AUEmbedComponent.propTypes = {
|
|
41
|
+
path: PropTypes.string.isRequired,
|
|
42
|
+
api: PropTypes.string.isRequired,
|
|
43
|
+
referrer: PropTypes.string.isRequired,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
AUEmbedComponent.displayName = 'AUEmbedComponent';
|
|
47
|
+
export default AUEmbedComponent;
|