@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
package/package.json CHANGED
@@ -1,107 +1,108 @@
1
- {
2
- "sideEffects": false,
3
- "name": "@aarhus-university/au-lib-react-components",
4
- "version": "10.6.0",
5
- "description": "Library for shared React components for various applications on au.dk",
6
- "scripts": {
7
- "test": "jest",
8
- "build": "jest && webpack --config ./webpack.config.js",
9
- "storybook": "start-storybook -p 6006",
10
- "build-storybook": "build-storybook"
11
- },
12
- "repository": {
13
- "type": "git",
14
- "url": "https://gitlab.au.dk/au-web-og-digital/au-lib-react-components"
15
- },
16
- "author": {
17
- "name": "Thomas Riis Hansen",
18
- "email": "trh@au.dk"
19
- },
20
- "devDependencies": {
21
- "@babel/core": "^7.17.0",
22
- "@babel/plugin-proposal-class-properties": "^7.16.7",
23
- "@babel/plugin-proposal-object-rest-spread": "^7.16.7",
24
- "@babel/plugin-proposal-optional-chaining": "^7.16.7",
25
- "@babel/preset-env": "^7.16.11",
26
- "@babel/preset-react": "^7.16.7",
27
- "@babel/preset-typescript": "^7.16.7",
28
- "@mdx-js/react": "^2.1.2",
29
- "@storybook/addon-actions": "^6.5.4",
30
- "@storybook/addon-essentials": "^6.5.4",
31
- "@storybook/addon-interactions": "^6.5.4",
32
- "@storybook/addon-links": "^6.5.4",
33
- "@storybook/builder-webpack4": "^6.5.4",
34
- "@storybook/builder-webpack5": "^6.5.4",
35
- "@storybook/manager-webpack4": "^6.5.4",
36
- "@storybook/manager-webpack5": "^6.5.4",
37
- "@storybook/react": "^6.5.4",
38
- "@storybook/testing-library": "^0.0.11",
39
- "@testing-library/jest-dom": "5.0.0",
40
- "@testing-library/react": "13.0.0",
41
- "@testing-library/user-event": "14.0.0",
42
- "@types/jest": "^27.4.0",
43
- "@types/testing-library__jest-dom": "5.0.0",
44
- "@typescript-eslint/eslint-plugin": "^5.10.2",
45
- "@typescript-eslint/parser": "^5.10.2",
46
- "babel-eslint": "^10.1.0",
47
- "babel-jest": "^27.5.1",
48
- "babel-loader": "^8.2.3",
49
- "css-loader": "^6.6.0",
50
- "eslint": "^8.8.0",
51
- "eslint-config-airbnb": "^19.0.4",
52
- "eslint-import-resolver-typescript": "^2.5.0",
53
- "eslint-plugin-import": "^2.25.4",
54
- "eslint-plugin-jsx-a11y": "^6.5.1",
55
- "eslint-plugin-react": "^7.28.0",
56
- "eslint-plugin-react-hooks": "^4.3.0",
57
- "eslint-plugin-storybook": "^0.5.12",
58
- "eslint-webpack-plugin": "^3.1.1",
59
- "fork-ts-checker-webpack-plugin": "^7.0.0",
60
- "jest": "^27.5.1",
61
- "mini-css-extract-plugin": "^2.5.3",
62
- "react-test-renderer": "18.1.0",
63
- "sass": "^1.49.7",
64
- "sass-loader": "^12.4.0",
65
- "style-loader": "^3.3.1",
66
- "ts-loader": "^9.2.6",
67
- "typescript": "^4.5.5",
68
- "webpack-cli": "^4.9.2"
69
- },
70
- "dependencies": {
71
- "@aarhus-university/au-designsystem-delphinus": "0.28.0",
72
- "@aarhus-university/types": "^0.2.0",
73
- "@types/google.analytics": "^0.0.42",
74
- "@types/history": "^5.0.0",
75
- "@types/react": "^18.0.14",
76
- "@types/react-dom": "^18.0.5",
77
- "@types/react-router-dom": "^5.3.3",
78
- "dayjs": "^1.10.7",
79
- "lodash.debounce": "^4.0.8",
80
- "prop-types": "^15.8.1",
81
- "query-string": "^7.1.0",
82
- "react": "18.2.0",
83
- "react-autosuggest": "^10.1.0",
84
- "react-router-dom": "^6.2.1",
85
- "regenerator-runtime": "^0.13.9",
86
- "webpack": "^5.68.0",
87
- "whatwg-fetch": "^3.6.2"
88
- },
89
- "peerDependencies": {
90
- "react": "18.2.0",
91
- "react-dom": "^18.2.0"
92
- },
93
- "jest": {
94
- "rootDir": "__tests__/jest",
95
- "setupFilesAfterEnv": [
96
- "./setupTests.ts"
97
- ],
98
- "testEnvironment": "jsdom",
99
- "transformIgnorePatterns": [
100
- "node_modules/(?!(@aarhus-university/au-lib-react-components|@aarhus-university/au-designsystem-delphinus|node-fetch|data-uri-to-buffer|fetch-blob|formdata-polyfill)/)"
101
- ],
102
- "testPathIgnorePatterns": [
103
- "factory.ts",
104
- "setupTests.ts"
105
- ]
106
- }
107
- }
1
+ {
2
+ "sideEffects": false,
3
+ "name": "@aarhus-university/au-lib-react-components",
4
+ "version": "10.9.0",
5
+ "description": "Library for shared React components for various applications on au.dk",
6
+ "scripts": {
7
+ "test": "jest",
8
+ "build": "jest && webpack --config ./webpack.config.js",
9
+ "storybook": "start-storybook -p 6006",
10
+ "build-storybook": "build-storybook"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://gitlab.au.dk/au-web-og-digital/au-lib-react-components"
15
+ },
16
+ "author": {
17
+ "name": "Thomas Riis Hansen",
18
+ "email": "trh@au.dk"
19
+ },
20
+ "devDependencies": {
21
+ "@babel/core": "^7.17.0",
22
+ "@babel/plugin-proposal-class-properties": "^7.16.7",
23
+ "@babel/plugin-proposal-object-rest-spread": "^7.16.7",
24
+ "@babel/plugin-proposal-optional-chaining": "^7.16.7",
25
+ "@babel/preset-env": "^7.16.11",
26
+ "@babel/preset-react": "^7.16.7",
27
+ "@babel/preset-typescript": "^7.16.7",
28
+ "@mdx-js/react": "^2.1.2",
29
+ "@storybook/addon-actions": "^6.5.4",
30
+ "@storybook/addon-essentials": "^6.5.4",
31
+ "@storybook/addon-interactions": "^6.5.4",
32
+ "@storybook/addon-links": "^6.5.4",
33
+ "@storybook/builder-webpack4": "^6.5.4",
34
+ "@storybook/builder-webpack5": "^6.5.4",
35
+ "@storybook/manager-webpack4": "^6.5.4",
36
+ "@storybook/manager-webpack5": "^6.5.4",
37
+ "@storybook/react": "^6.5.4",
38
+ "@storybook/testing-library": "^0.0.11",
39
+ "@testing-library/jest-dom": "5.0.0",
40
+ "@testing-library/react": "13.0.0",
41
+ "@testing-library/user-event": "14.0.0",
42
+ "@types/jest": "^27.4.0",
43
+ "@types/testing-library__jest-dom": "5.0.0",
44
+ "@typescript-eslint/eslint-plugin": "^5.10.2",
45
+ "@typescript-eslint/parser": "^5.10.2",
46
+ "babel-eslint": "^10.1.0",
47
+ "babel-jest": "^27.5.1",
48
+ "babel-loader": "^8.2.3",
49
+ "css-loader": "^6.6.0",
50
+ "eslint": "^8.8.0",
51
+ "eslint-config-airbnb": "^19.0.4",
52
+ "eslint-import-resolver-typescript": "^2.5.0",
53
+ "eslint-plugin-import": "^2.25.4",
54
+ "eslint-plugin-jsx-a11y": "^6.5.1",
55
+ "eslint-plugin-react": "^7.28.0",
56
+ "eslint-plugin-react-hooks": "^4.3.0",
57
+ "eslint-plugin-storybook": "^0.5.12",
58
+ "eslint-webpack-plugin": "^3.1.1",
59
+ "fork-ts-checker-webpack-plugin": "^7.0.0",
60
+ "jest": "^27.5.1",
61
+ "mini-css-extract-plugin": "^2.5.3",
62
+ "react-test-renderer": "18.1.0",
63
+ "sass": "^1.49.7",
64
+ "sass-loader": "^12.4.0",
65
+ "style-loader": "^3.3.1",
66
+ "ts-loader": "^9.2.6",
67
+ "typescript": "^4.5.5",
68
+ "webpack-cli": "^4.9.2"
69
+ },
70
+ "dependencies": {
71
+ "@aarhus-university/au-designsystem-delphinus": "0.29.0",
72
+ "@aarhus-university/types": "^0.5.0",
73
+ "@reduxjs/toolkit": "^1.8.3",
74
+ "@types/google.analytics": "^0.0.42",
75
+ "@types/history": "^5.0.0",
76
+ "@types/react": "^18.0.14",
77
+ "@types/react-dom": "^18.0.5",
78
+ "@types/react-router-dom": "^5.3.3",
79
+ "dayjs": "^1.10.7",
80
+ "lodash.debounce": "^4.0.8",
81
+ "prop-types": "^15.8.1",
82
+ "query-string": "^7.1.0",
83
+ "react": "18.2.0",
84
+ "react-autosuggest": "^10.1.0",
85
+ "react-router-dom": "^6.2.1",
86
+ "regenerator-runtime": "^0.13.9",
87
+ "webpack": "^5.68.0",
88
+ "whatwg-fetch": "^3.6.2"
89
+ },
90
+ "peerDependencies": {
91
+ "react": "18.2.0",
92
+ "react-dom": "^18.2.0"
93
+ },
94
+ "jest": {
95
+ "rootDir": "__tests__/jest",
96
+ "setupFilesAfterEnv": [
97
+ "./setupTests.ts"
98
+ ],
99
+ "testEnvironment": "jsdom",
100
+ "transformIgnorePatterns": [
101
+ "node_modules/(?!(@aarhus-university/au-lib-react-components|@aarhus-university/au-designsystem-delphinus|node-fetch|data-uri-to-buffer|fetch-blob|formdata-polyfill)/)"
102
+ ],
103
+ "testPathIgnorePatterns": [
104
+ "factory.ts",
105
+ "setupTests.ts"
106
+ ]
107
+ }
108
+ }
@@ -1,70 +1,70 @@
1
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
2
- /* eslint-env browser */
3
- import React, { FC } from 'react';
4
- import ReactDOM from 'react-dom';
5
-
6
- const AUAlertComponent: FC<AUAlertComponentProps> = ({
7
- message,
8
- children,
9
- alert,
10
- buttons,
11
- }: AUAlertComponentProps) => {
12
- const renderButtons = (buttons || []).map((button) => (
13
- <button
14
- key={button.text}
15
- type="button"
16
- className={button.className}
17
- data-icon={button.dataIcon}
18
- onClick={() => {
19
- button.onClick();
20
- }}
21
- >
22
- {button.text}
23
- </button>
24
- ));
25
-
26
- if (alert) {
27
- return (
28
- <>
29
- {
30
- ReactDOM.createPortal(
31
- <div key="0" className="theme--normal toast-notification toast-notification--attention toast-notification--persistent">
32
- <div className="toast-notification__content">
33
- <p dangerouslySetInnerHTML={{ __html: message }} />
34
- </div>
35
- {renderButtons}
36
- </div>,
37
- document.querySelector('body')!,
38
- )
39
- }
40
- {children}
41
- </>
42
- );
43
- }
44
-
45
- if (!children) {
46
- return null;
47
- }
48
-
49
- return children;
50
- };
51
-
52
- AUAlertComponent.defaultProps = {
53
- buttons: [{
54
- className: 'button',
55
- text: 'OK',
56
- dataIcon: null,
57
- // eslint-disable-next-line no-console
58
- onClick: () => console.log('clicked on OK'),
59
- }, {
60
- className: 'button',
61
- text: 'Annuller',
62
- dataIcon: null,
63
- // eslint-disable-next-line no-console
64
- onClick: () => console.log('clicked on cancel'),
65
- },
66
- ],
67
- };
68
-
69
- AUAlertComponent.displayName = 'AUAlertComponent';
70
- export default AUAlertComponent;
1
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
2
+ /* eslint-env browser */
3
+ import React, { FC } from 'react';
4
+ import ReactDOM from 'react-dom';
5
+
6
+ const AUAlertComponent: FC<AUAlertComponentProps> = ({
7
+ message,
8
+ children,
9
+ alert,
10
+ buttons,
11
+ }: AUAlertComponentProps) => {
12
+ const renderButtons = (buttons || []).map((button) => (
13
+ <button
14
+ key={button.text}
15
+ type="button"
16
+ className={button.className}
17
+ data-icon={button.dataIcon}
18
+ onClick={() => {
19
+ button.onClick();
20
+ }}
21
+ >
22
+ {button.text}
23
+ </button>
24
+ ));
25
+
26
+ if (alert) {
27
+ return (
28
+ <>
29
+ {
30
+ ReactDOM.createPortal(
31
+ <div key="0" className="theme--normal toast-notification toast-notification--attention toast-notification--persistent">
32
+ <div className="toast-notification__content">
33
+ <p dangerouslySetInnerHTML={{ __html: message }} />
34
+ </div>
35
+ {renderButtons}
36
+ </div>,
37
+ document.querySelector('body')!,
38
+ )
39
+ }
40
+ {children}
41
+ </>
42
+ );
43
+ }
44
+
45
+ if (!children) {
46
+ return null;
47
+ }
48
+
49
+ return children;
50
+ };
51
+
52
+ AUAlertComponent.defaultProps = {
53
+ buttons: [{
54
+ className: 'button',
55
+ text: 'OK',
56
+ dataIcon: null,
57
+ // eslint-disable-next-line no-console
58
+ onClick: () => console.log('clicked on OK'),
59
+ }, {
60
+ className: 'button',
61
+ text: 'Annuller',
62
+ dataIcon: null,
63
+ // eslint-disable-next-line no-console
64
+ onClick: () => console.log('clicked on cancel'),
65
+ },
66
+ ],
67
+ };
68
+
69
+ AUAlertComponent.displayName = 'AUAlertComponent';
70
+ export default AUAlertComponent;