@aarhus-university/au-lib-react-components 10.6.0 → 10.9.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/AUErrorComponent.test.tsx +142 -0
  7. package/__tests__/jest/AUModalComponent.test.tsx +186 -0
  8. package/__tests__/jest/AUNotificationComponent.test.tsx +115 -0
  9. package/__tests__/jest/AUSpinnerComponent.test.tsx +57 -57
  10. package/__tests__/jest/AUToolbarComponent.test.tsx +46 -0
  11. package/__tests__/jest/helpers.test.ts +15 -15
  12. package/__tests__/jest/setupTests.ts +2 -2
  13. package/babel.config.js +8 -8
  14. package/build/umd/universe.js.map +1 -1
  15. package/package.json +108 -107
  16. package/src/components/AUAlertComponent.tsx +70 -70
  17. package/src/components/AUAutoSuggestComponent.js +158 -158
  18. package/src/components/AUButtonComponent.tsx +83 -77
  19. package/src/components/AUCalendarComponent.tsx +493 -493
  20. package/src/components/AUContentToggleComponent.tsx +33 -33
  21. package/src/components/AUDatepickerComponent.tsx +117 -117
  22. package/src/components/AUErrorComponent.tsx +78 -0
  23. package/src/components/AUMobilePrefixComponent.tsx +15 -15
  24. package/src/components/AUModalComponent.tsx +64 -80
  25. package/src/components/AUNotificationComponent.tsx +42 -0
  26. package/src/components/AUReceiptComponent.tsx +33 -33
  27. package/src/components/AUSpinnerComponent.tsx +33 -33
  28. package/src/components/AUSubNavComponent.tsx +48 -48
  29. package/src/components/AUSubmitButtonContainerComponent.tsx +31 -31
  30. package/src/components/AUTabbedContentComponent.tsx +145 -145
  31. package/src/components/AUTableComponent.tsx +24 -24
  32. package/src/components/AUToastComponent.tsx +103 -103
  33. package/src/components/AUToolbarComponent.tsx +52 -45
  34. package/src/components/profile/AUProfileActions.js +128 -128
  35. package/src/components/profile/AUProfileAvatarComponent.js +83 -83
  36. package/src/components/profile/AUProfileAvatarV2Component.js +91 -91
  37. package/src/components/profile/AUProfileAvatarV3Component.tsx +42 -42
  38. package/src/components/profile/AUProfileContainerComponent.js +283 -283
  39. package/src/components/profile/AUProfileHooks.js +30 -30
  40. package/src/components/profile/AUProfileItemComponent.js +54 -54
  41. package/src/components/profile/AUProfileLanguageComponent.js +131 -131
  42. package/src/components/profile/AUProfileLoginComponent.tsx +26 -26
  43. package/src/components/profile/AUProfileMailComponent.js +307 -307
  44. package/src/components/profile/AUProfileMobileComponent.js +164 -164
  45. package/src/components/profile/AUProfileNameComponent.js +253 -253
  46. package/src/components/profile/AUProfileNextOfKinComponent.js +216 -216
  47. package/src/components/profile/AUProfileReducer.js +230 -230
  48. package/src/components/profile/AUProfileWidgetComponent.js +95 -95
  49. package/src/components/profile/AUProfileWidgetV2Component.js +116 -116
  50. package/src/components/profile/AUProfileWidgetV3Component.tsx +122 -122
  51. package/src/components/wrapping/AUEmbedComponent.js +47 -47
  52. package/src/layout-2016/components/alphabox/AlphaBoxComponent.js +143 -143
  53. package/src/layout-2016/components/alphabox/AlphaBoxContentComponent.js +136 -136
  54. package/src/layout-2016/components/common/AUCollapsibleComponent.js +152 -152
  55. package/src/layout-2016/components/common/AUSpinnerComponent.js +103 -103
  56. package/src/layout-2016/components/databox/DataBoxAlphabetComponent.js +144 -144
  57. package/src/layout-2016/components/databox/DataBoxAssociationComponent.js +122 -122
  58. package/src/layout-2016/components/databox/DataBoxButtonComponent.js +157 -157
  59. package/src/layout-2016/components/databox/DataBoxComponent.js +297 -297
  60. package/src/layout-2016/components/databox/DataBoxGroupingComponent.js +64 -64
  61. package/src/layout-2016/components/databox/DataBoxSearchResultComponent.js +36 -36
  62. package/src/layout-2016/components/databox/DataBoxStackedAssociationComponent.js +54 -54
  63. package/src/layout-2016/components/databox/DataBoxSuggestionComponent.js +39 -39
  64. package/src/layout-2016/components/diagramme/AUDiagrammeComponent.js +309 -309
  65. package/src/layout-2016/components/flowbox/FlowBoxComponent.js +126 -126
  66. package/src/layout-2016/components/flowbox/FlowBoxPhoneComponent.js +104 -104
  67. package/src/layout-2016/components/profile/AUProfileAvatar2016Component.js +103 -103
  68. package/src/layout-2016/components/universe/StaffTopComponent.js +363 -363
  69. package/src/layout-2016/components/universe/StudentTopComponent.js +137 -137
  70. package/src/layout-2016/components/universe/UniverseContainerComponent.js +65 -65
  71. package/src/layout-2016/lib/all.js +3 -3
  72. package/src/layout-2016/lib/au-alphabox.js +100 -100
  73. package/src/layout-2016/lib/au-databox.js +400 -400
  74. package/src/layout-2016/lib/au-diagramme.js +85 -85
  75. package/src/layout-2016/lib/au-flowbox.js +93 -93
  76. package/src/layout-2016/lib/universe.js +9 -9
  77. package/src/lib/helpers.ts +194 -194
  78. package/src/lib/hooks.ts +37 -33
  79. package/src/lib/i18n.ts +600 -600
  80. package/src/lib/tracking.ts +69 -69
  81. package/src/lib/wrapping.ts +21 -21
  82. package/src/styles/_settings.scss +10 -10
  83. package/src/styles/alphabox.scss +222 -222
  84. package/src/styles/app.scss +7 -7
  85. package/src/styles/autosuggest.scss +57 -57
  86. package/src/styles/databox.scss +563 -563
  87. package/src/styles/diagramme.scss +119 -119
  88. package/src/styles/flowbox.scss +72 -72
  89. package/src/styles/maps.scss +395 -395
  90. package/stories/AUButtonComponent.stories.tsx +85 -85
  91. package/stories/AUErrorComponent.stories.tsx +117 -0
  92. package/stories/AUModalComponent.stories.tsx +92 -0
  93. package/stories/AUNotificationComponent.stories.tsx +116 -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,33 +1,33 @@
1
- import React, {
2
- useEffect,
3
- useRef,
4
- FC,
5
- } from 'react';
6
- import { setContentToggle } from '@aarhus-university/au-designsystem-delphinus/source/js/components/content-toggle';
7
-
8
- const AUContentToggleComponent: FC<AUContentToggleComponentProps> = ({
9
- toggled,
10
- classNames,
11
- children,
12
- }: AUContentToggleComponentProps) => {
13
- const toggleContainer = useRef<HTMLDivElement>(null);
14
- useEffect(() => {
15
- const toggle = toggleContainer?.current?.querySelector('.content-toggle__content');
16
- if (toggle) {
17
- const button = setContentToggle(toggle);
18
- button?.setAttribute('aria-expanded', toggled ? 'true' : 'false');
19
- }
20
- }, []);
21
- return (
22
- <div ref={toggleContainer} className={classNames}>
23
- {children}
24
- </div>
25
- );
26
- };
27
-
28
- AUContentToggleComponent.defaultProps = {
29
- classNames: undefined,
30
- };
31
-
32
- AUContentToggleComponent.displayName = 'AUContentToggleComponent';
33
- export default AUContentToggleComponent;
1
+ import React, {
2
+ useEffect,
3
+ useRef,
4
+ FC,
5
+ } from 'react';
6
+ import { setContentToggle } from '@aarhus-university/au-designsystem-delphinus/source/js/components/content-toggle';
7
+
8
+ const AUContentToggleComponent: FC<AUContentToggleComponentProps> = ({
9
+ toggled,
10
+ classNames,
11
+ children,
12
+ }: AUContentToggleComponentProps) => {
13
+ const toggleContainer = useRef<HTMLDivElement>(null);
14
+ useEffect(() => {
15
+ const toggle = toggleContainer?.current?.querySelector('.content-toggle__content');
16
+ if (toggle) {
17
+ const button = setContentToggle(toggle);
18
+ button?.setAttribute('aria-expanded', toggled ? 'true' : 'false');
19
+ }
20
+ }, []);
21
+ return (
22
+ <div ref={toggleContainer} className={classNames}>
23
+ {children}
24
+ </div>
25
+ );
26
+ };
27
+
28
+ AUContentToggleComponent.defaultProps = {
29
+ classNames: undefined,
30
+ };
31
+
32
+ AUContentToggleComponent.displayName = 'AUContentToggleComponent';
33
+ export default AUContentToggleComponent;
@@ -1,117 +1,117 @@
1
- /* eslint-env browser */
2
- import React, { FC, useState } from 'react';
3
- import dayjs from 'dayjs';
4
- import AUCalendarComponent from './AUCalendarComponent';
5
-
6
- const AUDatepickerComponent: FC<AUDatepickerComponentProps> = ({
7
- id,
8
- lang,
9
- date,
10
- onDateChange,
11
- onHide,
12
- format,
13
- showTime,
14
- showLabel,
15
- labelInline,
16
- labelText,
17
- fullWidth,
18
- yearSpanMinus,
19
- yearSpanPlus,
20
- limitStart,
21
- limitEnd,
22
- disabled,
23
- }: AUDatepickerComponentProps) => {
24
- const [showCalendar, setShowCalendar] = useState(false);
25
- const [sDate, setDate] = useState<Date>(date as Date);
26
- const dateFormatted = dayjs(sDate).format(format);
27
-
28
- const hideDatePicker = () => {
29
- setShowCalendar(false);
30
- onHide(sDate, dateFormatted);
31
- };
32
-
33
- let className = 'form__field';
34
- if (fullWidth) {
35
- className = `${className} form__field--full-width`;
36
- }
37
-
38
- if (labelInline) {
39
- className = `${className} form__field--inline-label`;
40
- }
41
-
42
- if (disabled) {
43
- className = `${className} visually-disabled`;
44
- }
45
-
46
- return (
47
- <div
48
- className="datepicker"
49
- aria-owns={`${id}-calendar`}
50
- aria-haspopup="true"
51
- aria-expanded={showCalendar}
52
- >
53
- <div className={className}>
54
- {showLabel && <label htmlFor={id}>{labelText}</label>}
55
- <input
56
- id={id}
57
- type="text"
58
- value={dateFormatted}
59
- title={
60
- lang === 'da'
61
- ? 'Klik for at åbne datovælger'
62
- : 'Click to open datepicker'
63
- }
64
- readOnly
65
- disabled={disabled}
66
- onClick={() => setShowCalendar(!showCalendar)}
67
- />
68
- </div>
69
- {showCalendar && (
70
- <div className="datepicker__calendar-container">
71
- <AUCalendarComponent
72
- key={`${showCalendar}`}
73
- minuteInterval={1}
74
- selected={date}
75
- day={(date as Date).getDate()}
76
- month={(date as Date).getMonth() + 1}
77
- year={(date as Date).getFullYear()}
78
- hour={(date as Date).getHours()}
79
- minute={(date as Date).getMinutes()}
80
- onSelected={(selected) => {
81
- const formatted = dayjs(selected).format(format);
82
- setDate(selected);
83
- onDateChange(selected, formatted);
84
- }}
85
- showTime={showTime}
86
- yearSpanMinus={yearSpanMinus}
87
- yearSpanPlus={yearSpanPlus}
88
- closeable
89
- onClose={hideDatePicker}
90
- controls={id}
91
- limitStart={limitStart}
92
- limitEnd={limitEnd}
93
- />
94
- </div>
95
- )}
96
- </div>
97
- );
98
- };
99
-
100
- AUDatepickerComponent.defaultProps = {
101
- date: new Date(),
102
- format: 'YYYY-MM-DD HH:mm',
103
- showTime: true,
104
- lang: 'da',
105
- showLabel: false,
106
- labelInline: false,
107
- labelText: 'Vælg dato:',
108
- fullWidth: true,
109
- yearSpanMinus: 5,
110
- yearSpanPlus: 5,
111
- limitStart: null,
112
- limitEnd: null,
113
- disabled: false,
114
- };
115
-
116
- AUDatepickerComponent.displayName = 'AUDatepickerComponent';
117
- export default AUDatepickerComponent;
1
+ /* eslint-env browser */
2
+ import React, { FC, useState } from 'react';
3
+ import dayjs from 'dayjs';
4
+ import AUCalendarComponent from './AUCalendarComponent';
5
+
6
+ const AUDatepickerComponent: FC<AUDatepickerComponentProps> = ({
7
+ id,
8
+ lang,
9
+ date,
10
+ onDateChange,
11
+ onHide,
12
+ format,
13
+ showTime,
14
+ showLabel,
15
+ labelInline,
16
+ labelText,
17
+ fullWidth,
18
+ yearSpanMinus,
19
+ yearSpanPlus,
20
+ limitStart,
21
+ limitEnd,
22
+ disabled,
23
+ }: AUDatepickerComponentProps) => {
24
+ const [showCalendar, setShowCalendar] = useState(false);
25
+ const [sDate, setDate] = useState<Date>(date as Date);
26
+ const dateFormatted = dayjs(sDate).format(format);
27
+
28
+ const hideDatePicker = () => {
29
+ setShowCalendar(false);
30
+ onHide(sDate, dateFormatted);
31
+ };
32
+
33
+ let className = 'form__field';
34
+ if (fullWidth) {
35
+ className = `${className} form__field--full-width`;
36
+ }
37
+
38
+ if (labelInline) {
39
+ className = `${className} form__field--inline-label`;
40
+ }
41
+
42
+ if (disabled) {
43
+ className = `${className} visually-disabled`;
44
+ }
45
+
46
+ return (
47
+ <div
48
+ className="datepicker"
49
+ aria-owns={`${id}-calendar`}
50
+ aria-haspopup="true"
51
+ aria-expanded={showCalendar}
52
+ >
53
+ <div className={className}>
54
+ {showLabel && <label htmlFor={id}>{labelText}</label>}
55
+ <input
56
+ id={id}
57
+ type="text"
58
+ value={dateFormatted}
59
+ title={
60
+ lang === 'da'
61
+ ? 'Klik for at åbne datovælger'
62
+ : 'Click to open datepicker'
63
+ }
64
+ readOnly
65
+ disabled={disabled}
66
+ onClick={() => setShowCalendar(!showCalendar)}
67
+ />
68
+ </div>
69
+ {showCalendar && (
70
+ <div className="datepicker__calendar-container">
71
+ <AUCalendarComponent
72
+ key={`${showCalendar}`}
73
+ minuteInterval={1}
74
+ selected={date}
75
+ day={(date as Date).getDate()}
76
+ month={(date as Date).getMonth() + 1}
77
+ year={(date as Date).getFullYear()}
78
+ hour={(date as Date).getHours()}
79
+ minute={(date as Date).getMinutes()}
80
+ onSelected={(selected) => {
81
+ const formatted = dayjs(selected).format(format);
82
+ setDate(selected);
83
+ onDateChange(selected, formatted);
84
+ }}
85
+ showTime={showTime}
86
+ yearSpanMinus={yearSpanMinus}
87
+ yearSpanPlus={yearSpanPlus}
88
+ closeable
89
+ onClose={hideDatePicker}
90
+ controls={id}
91
+ limitStart={limitStart}
92
+ limitEnd={limitEnd}
93
+ />
94
+ </div>
95
+ )}
96
+ </div>
97
+ );
98
+ };
99
+
100
+ AUDatepickerComponent.defaultProps = {
101
+ date: new Date(),
102
+ format: 'YYYY-MM-DD HH:mm',
103
+ showTime: true,
104
+ lang: 'da',
105
+ showLabel: false,
106
+ labelInline: false,
107
+ labelText: 'Vælg dato:',
108
+ fullWidth: true,
109
+ yearSpanMinus: 5,
110
+ yearSpanPlus: 5,
111
+ limitStart: null,
112
+ limitEnd: null,
113
+ disabled: false,
114
+ };
115
+
116
+ AUDatepickerComponent.displayName = 'AUDatepickerComponent';
117
+ export default AUDatepickerComponent;
@@ -0,0 +1,78 @@
1
+ import React, { FC } from 'react';
2
+ import { SerializedError } from '@reduxjs/toolkit';
3
+ import { FetchBaseQueryError } from '@reduxjs/toolkit/query';
4
+ import AUNotificationComponent from './AUNotificationComponent';
5
+
6
+ interface AUErrorComponentProps {
7
+ error?: AU.IError,
8
+ fetchError?: FetchBaseQueryError,
9
+ serializedError?: SerializedError,
10
+ withStatus?: boolean,
11
+ }
12
+
13
+ const AUErrorComponent: FC<AUErrorComponentProps> = ({
14
+ error: auError,
15
+ fetchError,
16
+ serializedError,
17
+ withStatus,
18
+ }: AUErrorComponentProps) => {
19
+ if (auError) {
20
+ const { status, header, message } = auError;
21
+ return (
22
+ <AUNotificationComponent
23
+ type="warning"
24
+ header={`${withStatus ? `${status}: ` : ''}${header}`}
25
+ content={[
26
+ <p>{message}</p>,
27
+ ]}
28
+ />
29
+ );
30
+ }
31
+ if (fetchError && 'error' in fetchError) {
32
+ const { status, error } = fetchError;
33
+ return (
34
+ <AUNotificationComponent
35
+ type="warning"
36
+ header={withStatus ? status : undefined}
37
+ content={[
38
+ <p>{error}</p>,
39
+ ]}
40
+ />
41
+ );
42
+ }
43
+ if (fetchError && 'data' in fetchError) {
44
+ const { status, data } = fetchError;
45
+ return (
46
+ <AUNotificationComponent
47
+ type="warning"
48
+ header={withStatus ? `${status}` : undefined}
49
+ content={[
50
+ <p>{JSON.stringify(data)}</p>,
51
+ ]}
52
+ />
53
+ );
54
+ }
55
+ if (serializedError && 'message' in serializedError) {
56
+ const { code, message } = serializedError;
57
+ return (
58
+ <AUNotificationComponent
59
+ type="warning"
60
+ header={withStatus ? code : undefined}
61
+ content={[
62
+ <p>{message}</p>,
63
+ ]}
64
+ />
65
+ );
66
+ }
67
+ return null;
68
+ };
69
+
70
+ AUErrorComponent.defaultProps = {
71
+ error: undefined,
72
+ fetchError: undefined,
73
+ serializedError: undefined,
74
+ withStatus: false,
75
+ };
76
+
77
+ AUErrorComponent.displayName = 'AUErrorComponent';
78
+ export default AUErrorComponent;
@@ -1,15 +1,15 @@
1
- import React, { FC } from 'react';
2
-
3
- const AUMobilePrefixComponent: FC<AUMobilePrefixComponentProps> = ({
4
- countryCodes,
5
- important,
6
- }: AUMobilePrefixComponentProps) => {
7
- const renderCountryCodes = (codes:AU.ICountryCode[]) => codes.map(c => <option key={c.da} value={`+${c.code}`}>{`${c.da} (+${c.code})`}</option>);
8
- if (important) {
9
- return <>{renderCountryCodes(countryCodes.filter(c => c.important))}</>;
10
- }
11
- return <>{renderCountryCodes(countryCodes)}</>;
12
- };
13
-
14
- AUMobilePrefixComponent.displayName = 'AUMobilePrefixComponent';
15
- export default AUMobilePrefixComponent;
1
+ import React, { FC } from 'react';
2
+
3
+ const AUMobilePrefixComponent: FC<AUMobilePrefixComponentProps> = ({
4
+ countryCodes,
5
+ important,
6
+ }: AUMobilePrefixComponentProps) => {
7
+ const renderCountryCodes = (codes:AU.ICountryCode[]) => codes.map(c => <option key={c.da} value={`+${c.code}`}>{`${c.da} (+${c.code})`}</option>);
8
+ if (important) {
9
+ return <>{renderCountryCodes(countryCodes.filter(c => c.important))}</>;
10
+ }
11
+ return <>{renderCountryCodes(countryCodes)}</>;
12
+ };
13
+
14
+ AUMobilePrefixComponent.displayName = 'AUMobilePrefixComponent';
15
+ export default AUMobilePrefixComponent;
@@ -1,80 +1,64 @@
1
- /* eslint-env browser */
2
- /* eslint jsx-a11y/click-events-have-key-events: 0 */
3
- /* eslint jsx-a11y/no-noninteractive-element-interactions: 0 */
4
- /* eslint jsx-a11y/no-static-element-interactions: 0 */
5
- import React, { FC, useLayoutEffect } from 'react';
6
- import ReactDOM from 'react-dom';
7
- import { hideModal } from '@aarhus-university/au-designsystem-delphinus/source/js/components/modal-view';
8
-
9
- export {
10
- hideModal,
11
- };
12
-
13
- const AUModalComponent: FC<AUModalComponentProps> = ({
14
- domId,
15
- children,
16
- onClose,
17
- closeButton,
18
- closeButtonDisabled,
19
- lang,
20
- sender,
21
- className,
22
- }: AUModalComponentProps) => {
23
- useLayoutEffect(() => {
24
- const modalView = document.getElementById(domId);
25
- if (modalView) {
26
- const header = modalView.querySelector('.modal-view__header');
27
- if (header && !header.getAttribute('id')) {
28
- header.setAttribute('id', `${domId}-header`);
29
- modalView.setAttribute('aria-labelledby', `${domId}-header`);
30
- }
31
- }
32
- });
33
-
34
- return (
35
- ReactDOM.createPortal(
36
- <div
37
- key={0}
38
- id={domId}
39
- className={className}
40
- >
41
- <div className="modal-view__wrapper theme--normal">
42
- {
43
- closeButton && (
44
- <button
45
- type="button"
46
- disabled={closeButtonDisabled}
47
- className="modal-view__close button button--icon button--icon--hide-label"
48
- data-icon=""
49
- data-gtm="au-btn-modal-close"
50
- title={lang === 'da' ? 'Luk' : 'Close'}
51
- onClick={() => {
52
- if (typeof onClose === 'function') {
53
- onClose();
54
- }
55
- if (sender) {
56
- hideModal(domId, sender);
57
- }
58
- }}
59
- >
60
- {lang === 'da' ? 'Luk' : 'Close'}
61
- </button>
62
- )
63
- }
64
- {children}
65
- </div>
66
- </div>,
67
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
68
- document.querySelector('body')!,
69
- )
70
- );
71
- };
72
-
73
- AUModalComponent.defaultProps = {
74
- closeButton: true,
75
- lang: 'da',
76
- className: 'modal-view',
77
- };
78
-
79
- AUModalComponent.displayName = 'AUModalComponent';
80
- export default AUModalComponent;
1
+ /* eslint-env browser */
2
+ /* eslint jsx-a11y/click-events-have-key-events: 0 */
3
+ /* eslint jsx-a11y/no-noninteractive-element-interactions: 0 */
4
+ /* eslint jsx-a11y/no-static-element-interactions: 0 */
5
+ import React, { FC } from 'react';
6
+ import ReactDOM from 'react-dom';
7
+ import AUButtonComponent from './AUButtonComponent';
8
+ import { useModal } from '../lib/hooks';
9
+
10
+ const AUModalComponent: FC<AUModalComponentProps> = ({
11
+ lang,
12
+ domId,
13
+ className,
14
+ children,
15
+ closeButton,
16
+ closeButtonDisabled,
17
+ sender,
18
+ show,
19
+ onClose,
20
+ }: AUModalComponentProps) => {
21
+ useModal(domId, sender, show, !closeButtonDisabled, onClose);
22
+
23
+ return (
24
+ ReactDOM.createPortal(
25
+ <div
26
+ id={domId}
27
+ className={className}
28
+ >
29
+ <div className="modal-view__wrapper theme--normal">
30
+ {
31
+ closeButton && (
32
+ <AUButtonComponent
33
+ label={lang === 'da' ? 'Luk' : 'Close'}
34
+ disabled={closeButtonDisabled}
35
+ icon=""
36
+ hideLabel
37
+ classNames={['modal-view__close']}
38
+ dataGtm="au-btn-modal-close"
39
+ onClick={() => {
40
+ if (typeof onClose === 'function') {
41
+ onClose();
42
+ }
43
+ }}
44
+ />
45
+ )
46
+ }
47
+ {children}
48
+ </div>
49
+ </div>,
50
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
51
+ document.querySelector('body')!,
52
+ )
53
+ );
54
+ };
55
+
56
+ AUModalComponent.defaultProps = {
57
+ domId: 'modal-view1',
58
+ closeButton: true,
59
+ lang: 'da',
60
+ className: 'modal-view',
61
+ };
62
+
63
+ AUModalComponent.displayName = 'AUModalComponent';
64
+ export default AUModalComponent;
@@ -0,0 +1,42 @@
1
+ import React, { FC } from 'react';
2
+
3
+ const AUNotificationComponent: FC<AUNotificationComponentProps> = ({
4
+ header,
5
+ content,
6
+ actions,
7
+ type,
8
+ classNames,
9
+ }: AUNotificationComponentProps) => {
10
+ const typeClass = type === 'default' ? '' : `notification--${type}`;
11
+ return (
12
+ <div className={[
13
+ 'notification',
14
+ typeClass,
15
+ ].concat(classNames || []).join(' ').replace(/\s+/g, ' ').trim()}
16
+ >
17
+ <div className="notification__content">
18
+ {
19
+ header && <h2 className="notification__header">{header}</h2>
20
+ }
21
+ {content.map((c) => c)}
22
+ </div>
23
+ {
24
+ (actions || []).length > 0 && (
25
+ <div className="notification__actions">
26
+ {(actions || []).map((a) => a)}
27
+ </div>
28
+ )
29
+ }
30
+ </div>
31
+ );
32
+ };
33
+
34
+ AUNotificationComponent.defaultProps = {
35
+ header: null,
36
+ actions: [],
37
+ type: 'default',
38
+ classNames: [],
39
+ };
40
+
41
+ AUNotificationComponent.displayName = 'AUNotificationComponent';
42
+ export default AUNotificationComponent;
@@ -1,33 +1,33 @@
1
- import React, { FC } from 'react';
2
-
3
- const AUReceiptComponent: FC<AUReceiptComponentProps> = ({
4
- receiptText,
5
- helpText,
6
- showGoTo,
7
- buttons,
8
- }: AUReceiptComponentProps) => {
9
- const renderButtons = buttons.map((btn) => <a key={btn.gotoLink} href={btn.gotoLink} className="button">{btn.gotoText}</a>);
10
- return (
11
- <div className="receipt">
12
- <div className="receipt__icon" data-icon="" />
13
- <h1 className="receipt__header" dangerouslySetInnerHTML={{ __html: receiptText }} />
14
- {helpText}
15
- {
16
- showGoTo && (
17
- <div className="receipt__post-action">
18
- {renderButtons}
19
- </div>
20
- )
21
- }
22
- </div>
23
- );
24
- };
25
-
26
- AUReceiptComponent.defaultProps = {
27
- showGoTo: true,
28
- helpText: null,
29
- buttons: [],
30
- };
31
-
32
- AUReceiptComponent.displayName = 'AUReceiptComponent';
33
- export default AUReceiptComponent;
1
+ import React, { FC } from 'react';
2
+
3
+ const AUReceiptComponent: FC<AUReceiptComponentProps> = ({
4
+ receiptText,
5
+ helpText,
6
+ showGoTo,
7
+ buttons,
8
+ }: AUReceiptComponentProps) => {
9
+ const renderButtons = buttons.map((btn) => <a key={btn.gotoLink} href={btn.gotoLink} className="button">{btn.gotoText}</a>);
10
+ return (
11
+ <div className="receipt">
12
+ <div className="receipt__icon" data-icon="" />
13
+ <h1 className="receipt__header" dangerouslySetInnerHTML={{ __html: receiptText }} />
14
+ {helpText}
15
+ {
16
+ showGoTo && (
17
+ <div className="receipt__post-action">
18
+ {renderButtons}
19
+ </div>
20
+ )
21
+ }
22
+ </div>
23
+ );
24
+ };
25
+
26
+ AUReceiptComponent.defaultProps = {
27
+ showGoTo: true,
28
+ helpText: null,
29
+ buttons: [],
30
+ };
31
+
32
+ AUReceiptComponent.displayName = 'AUReceiptComponent';
33
+ export default AUReceiptComponent;