@aarhus-university/au-lib-react-components 11.0.0 → 11.1.1

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 (96) hide show
  1. package/.eslintrc.js +34 -34
  2. package/.storybook/main.js +20 -20
  3. package/.storybook/preview.js +17 -17
  4. package/README.md +19 -19
  5. package/__tests__/jest/AUButtonComponent.test.tsx +165 -165
  6. package/__tests__/jest/AUErrorComponent.test.tsx +142 -142
  7. package/__tests__/jest/AUModalComponent.test.tsx +186 -186
  8. package/__tests__/jest/AUNotificationComponent.test.tsx +115 -115
  9. package/__tests__/jest/AUSpinnerComponent.test.tsx +57 -57
  10. package/__tests__/jest/AUToolbarComponent.test.tsx +46 -46
  11. package/__tests__/jest/context.test.ts +25 -25
  12. package/__tests__/jest/helpers.test.ts +15 -15
  13. package/__tests__/jest/setupTests.ts +2 -2
  14. package/babel.config.js +8 -8
  15. package/build/umd/all.css +2 -2
  16. package/build/umd/all.js +1 -1
  17. package/build/umd/alphabox.js +1 -1
  18. package/build/umd/databox.js +1 -1
  19. package/build/umd/diagramme.js +1 -1
  20. package/build/umd/flowbox.js +1 -1
  21. package/build/umd/universe.js +1 -1
  22. package/build-storybook.log +367 -367
  23. package/package.json +114 -114
  24. package/src/components/AUAlertComponent.tsx +70 -70
  25. package/src/components/AUAutoSuggestComponent.js +158 -158
  26. package/src/components/AUButtonComponent.tsx +84 -84
  27. package/src/components/AUCalendarComponent.tsx +493 -493
  28. package/src/components/AUContentToggleComponent.tsx +47 -49
  29. package/src/components/AUDatepickerComponent.tsx +121 -121
  30. package/src/components/AUErrorComponent.tsx +78 -78
  31. package/src/components/AUMobilePrefixComponent.tsx +15 -15
  32. package/src/components/AUModalComponent.tsx +68 -64
  33. package/src/components/AUNotificationComponent.tsx +43 -43
  34. package/src/components/AUReceiptComponent.tsx +33 -33
  35. package/src/components/AUSpinnerComponent.tsx +33 -33
  36. package/src/components/AUStepComponent.tsx +41 -0
  37. package/src/components/AUSubNavComponent.tsx +48 -48
  38. package/src/components/AUSubmitButtonContainerComponent.tsx +29 -29
  39. package/src/components/AUTabbedContentComponent.tsx +145 -145
  40. package/src/components/AUTableComponent.tsx +24 -24
  41. package/src/components/AUToastComponent.tsx +104 -104
  42. package/src/components/AUToolbarComponent.tsx +101 -101
  43. package/src/components/AUTruncatorComponent.tsx +129 -129
  44. package/src/components/wrapping/AUEmbedComponent.js +47 -47
  45. package/src/layout-2016/components/alphabox/AlphaBoxComponent.js +143 -143
  46. package/src/layout-2016/components/alphabox/AlphaBoxContentComponent.js +136 -136
  47. package/src/layout-2016/components/common/AUCollapsibleComponent.js +152 -152
  48. package/src/layout-2016/components/common/AUSpinnerComponent.js +103 -103
  49. package/src/layout-2016/components/databox/DataBoxAlphabetComponent.js +144 -144
  50. package/src/layout-2016/components/databox/DataBoxAssociationComponent.js +122 -122
  51. package/src/layout-2016/components/databox/DataBoxButtonComponent.js +157 -157
  52. package/src/layout-2016/components/databox/DataBoxComponent.js +297 -297
  53. package/src/layout-2016/components/databox/DataBoxGroupingComponent.js +64 -64
  54. package/src/layout-2016/components/databox/DataBoxSearchResultComponent.js +36 -36
  55. package/src/layout-2016/components/databox/DataBoxStackedAssociationComponent.js +54 -54
  56. package/src/layout-2016/components/databox/DataBoxSuggestionComponent.js +39 -39
  57. package/src/layout-2016/components/diagramme/AUDiagrammeComponent.js +309 -309
  58. package/src/layout-2016/components/flowbox/FlowBoxComponent.js +126 -126
  59. package/src/layout-2016/components/flowbox/FlowBoxPhoneComponent.js +104 -104
  60. package/src/layout-2016/components/profile/AUProfileAvatar2016Component.js +103 -103
  61. package/src/layout-2016/components/universe/StaffTopComponent.js +363 -363
  62. package/src/layout-2016/components/universe/StudentTopComponent.js +137 -137
  63. package/src/layout-2016/components/universe/UniverseContainerComponent.js +65 -65
  64. package/src/layout-2016/lib/all.js +3 -3
  65. package/src/layout-2016/lib/au-alphabox.js +100 -100
  66. package/src/layout-2016/lib/au-databox.js +400 -400
  67. package/src/layout-2016/lib/au-diagramme.js +85 -85
  68. package/src/layout-2016/lib/au-flowbox.js +93 -93
  69. package/src/layout-2016/lib/universe.js +9 -9
  70. package/src/lib/context.tsx +43 -43
  71. package/src/lib/dates.ts +50 -50
  72. package/src/lib/helpers.ts +208 -208
  73. package/src/lib/hooks.ts +63 -63
  74. package/src/lib/i18n.ts +600 -600
  75. package/src/lib/portals.ts +37 -37
  76. package/src/lib/tracking.ts +69 -69
  77. package/src/lib/wrapping.ts +21 -21
  78. package/src/styles/_settings.scss +10 -10
  79. package/src/styles/alphabox.scss +222 -222
  80. package/src/styles/app.scss +7 -7
  81. package/src/styles/autosuggest.scss +57 -57
  82. package/src/styles/databox.scss +563 -563
  83. package/src/styles/diagramme.scss +119 -119
  84. package/src/styles/flowbox.scss +72 -72
  85. package/src/styles/maps.scss +395 -395
  86. package/stories/AUButtonComponent.stories.tsx +127 -127
  87. package/stories/AUContentToggleComponent.stories.tsx +63 -63
  88. package/stories/AUErrorComponent.stories.tsx +98 -98
  89. package/stories/AUModalComponent.stories.tsx +83 -83
  90. package/stories/AUNotificationComponent.stories.tsx +116 -116
  91. package/stories/AUSpinnerComponent.stories.tsx +41 -41
  92. package/stories/AUStepComponent.stories.tsx +40 -0
  93. package/stories/AUToolbarComponent.stories.tsx +326 -218
  94. package/stories/lib/helpers.tsx +128 -128
  95. package/tsconfig.json +46 -46
  96. package/webpack.config.js +89 -89
@@ -1,128 +1,128 @@
1
- import { useTranslation } from '../../src/lib/hooks';
2
- import React, { useEffect, StrictMode } from 'react';
3
-
4
- const globalTheme = {
5
- theme: {
6
- name: 'Theme',
7
- description: 'Global theme for components',
8
- defaultValue: 'light',
9
- toolbar: {
10
- icon: 'circlehollow',
11
- items: ['normal', 'dark'],
12
- showName: true,
13
- dynamicTitle: true,
14
- },
15
- },
16
- };
17
-
18
- const globalLang = (items = ['da', 'en'], defaultValue = 'da') => ({
19
- lang: {
20
- name: 'Language',
21
- description: 'Global language for components',
22
- defaultValue,
23
- toolbar: {
24
- icon: 'circlehollow',
25
- items,
26
- showName: true,
27
- dynamicTitle: true,
28
- },
29
- },
30
- });
31
-
32
- const ThemeWrapper = ({ theme, children, withPageContentBlock }) => {
33
- useEffect(() => {
34
- const body = document.querySelector('body');
35
- if (body) {
36
- body.classList.remove('theme--normal');
37
- body.classList.remove('theme--dark');
38
- body.classList.add(`theme--${theme}`);
39
- }
40
- });
41
-
42
- if (withPageContentBlock) {
43
- return (
44
- <StrictMode>
45
- <div className="page">
46
- <main className={`theme--${theme} page__content`}>
47
- <div className="page__content__block">
48
- {children}
49
- </div>
50
- </main>
51
- </div>
52
- </StrictMode>
53
- );
54
- }
55
-
56
- return (
57
- <StrictMode>
58
- <div className="page">
59
- <main className={`theme--${theme} page__content`}>
60
- {children}
61
- </main>
62
- </div>
63
- </StrictMode>
64
- );
65
- }
66
-
67
- ThemeWrapper.defaultProps = {
68
- withPageContentBlock: true,
69
- };
70
-
71
- const ThemeLanguageWrapper = ({
72
- theme,
73
- children,
74
- defaultLabels,
75
- importPromises,
76
- translationContext,
77
- lang,
78
- withPageContentBlock,
79
- }) => {
80
- const translations = useTranslation<typeof defaultLabels>(defaultLabels, importPromises, lang);
81
- useEffect(() => {
82
- const body = document.querySelector('body');
83
- if (body) {
84
- body.classList.remove('theme--normal');
85
- body.classList.remove('theme--dark');
86
- body.classList.add(`theme--${theme}`);
87
- }
88
- });
89
-
90
- if (withPageContentBlock) {
91
- return (
92
- <StrictMode>
93
- <translationContext.Provider value={translations}>
94
- <div className="page">
95
- <main className={`theme--${theme} page__content`}>
96
- <div className="page__content__block">
97
- {children}
98
- </div>
99
- </main>
100
- </div>
101
- </translationContext.Provider>
102
- </StrictMode>
103
- );
104
- }
105
-
106
- return (
107
- <StrictMode>
108
- <translationContext.Provider value={translations}>
109
- <div className="page">
110
- <main className={`theme--${theme} page__content`}>
111
- {children}
112
- </main>
113
- </div>
114
- </translationContext.Provider>
115
- </StrictMode>
116
- );
117
- }
118
-
119
- ThemeLanguageWrapper.defaultProps = {
120
- withPageContentBlock: true,
121
- };
122
-
123
- export {
124
- globalTheme,
125
- globalLang,
126
- ThemeWrapper,
127
- ThemeLanguageWrapper,
128
- };
1
+ import { useTranslation } from '../../src/lib/hooks';
2
+ import React, { useEffect, StrictMode } from 'react';
3
+
4
+ const globalTheme = {
5
+ theme: {
6
+ name: 'Theme',
7
+ description: 'Global theme for components',
8
+ defaultValue: 'light',
9
+ toolbar: {
10
+ icon: 'circlehollow',
11
+ items: ['normal', 'dark'],
12
+ showName: true,
13
+ dynamicTitle: true,
14
+ },
15
+ },
16
+ };
17
+
18
+ const globalLang = (items = ['da', 'en'], defaultValue = 'da') => ({
19
+ lang: {
20
+ name: 'Language',
21
+ description: 'Global language for components',
22
+ defaultValue,
23
+ toolbar: {
24
+ icon: 'circlehollow',
25
+ items,
26
+ showName: true,
27
+ dynamicTitle: true,
28
+ },
29
+ },
30
+ });
31
+
32
+ const ThemeWrapper = ({ theme, children, withPageContentBlock }) => {
33
+ useEffect(() => {
34
+ const body = document.querySelector('body');
35
+ if (body) {
36
+ body.classList.remove('theme--normal');
37
+ body.classList.remove('theme--dark');
38
+ body.classList.add(`theme--${theme}`);
39
+ }
40
+ });
41
+
42
+ if (withPageContentBlock) {
43
+ return (
44
+ <StrictMode>
45
+ <div className="page">
46
+ <main className={`theme--${theme} page__content`}>
47
+ <div className="page__content__block">
48
+ {children}
49
+ </div>
50
+ </main>
51
+ </div>
52
+ </StrictMode>
53
+ );
54
+ }
55
+
56
+ return (
57
+ <StrictMode>
58
+ <div className="page">
59
+ <main className={`theme--${theme} page__content`}>
60
+ {children}
61
+ </main>
62
+ </div>
63
+ </StrictMode>
64
+ );
65
+ }
66
+
67
+ ThemeWrapper.defaultProps = {
68
+ withPageContentBlock: true,
69
+ };
70
+
71
+ const ThemeLanguageWrapper = ({
72
+ theme,
73
+ children,
74
+ defaultLabels,
75
+ importPromises,
76
+ translationContext,
77
+ lang,
78
+ withPageContentBlock,
79
+ }) => {
80
+ const translations = useTranslation<typeof defaultLabels>(defaultLabels, importPromises, lang);
81
+ useEffect(() => {
82
+ const body = document.querySelector('body');
83
+ if (body) {
84
+ body.classList.remove('theme--normal');
85
+ body.classList.remove('theme--dark');
86
+ body.classList.add(`theme--${theme}`);
87
+ }
88
+ });
89
+
90
+ if (withPageContentBlock) {
91
+ return (
92
+ <StrictMode>
93
+ <translationContext.Provider value={translations}>
94
+ <div className="page">
95
+ <main className={`theme--${theme} page__content`}>
96
+ <div className="page__content__block">
97
+ {children}
98
+ </div>
99
+ </main>
100
+ </div>
101
+ </translationContext.Provider>
102
+ </StrictMode>
103
+ );
104
+ }
105
+
106
+ return (
107
+ <StrictMode>
108
+ <translationContext.Provider value={translations}>
109
+ <div className="page">
110
+ <main className={`theme--${theme} page__content`}>
111
+ {children}
112
+ </main>
113
+ </div>
114
+ </translationContext.Provider>
115
+ </StrictMode>
116
+ );
117
+ }
118
+
119
+ ThemeLanguageWrapper.defaultProps = {
120
+ withPageContentBlock: true,
121
+ };
122
+
123
+ export {
124
+ globalTheme,
125
+ globalLang,
126
+ ThemeWrapper,
127
+ ThemeLanguageWrapper,
128
+ };
package/tsconfig.json CHANGED
@@ -1,47 +1,47 @@
1
- {
2
- "compilerOptions": {
3
- // Target latest version of ECMAScript.
4
- "target": "esnext",
5
- // path to output directory
6
- "outDir": "../wwwroot/js",
7
- // enable strict null checks as a best practice
8
- "strictNullChecks": true,
9
- // Search under node_modules for non-relative imports.
10
- "moduleResolution": "node",
11
- // Process & infer types from .js files.
12
- "allowJs": true,
13
- // Don't emit; allow Babel to transform files.
14
- "noEmit": true,
15
- // Enable strictest settings like strictNullChecks & noImplicitAny.
16
- "strict": true,
17
- // Import non-ES modules as default imports.
18
- "esModuleInterop": true,
19
- // use typescript to transpile jsx to js
20
- "jsx": "react",
21
- "baseUrl": "./src",
22
- "lib": [
23
- "es2015",
24
- "dom.iterable",
25
- "es2016.array.include",
26
- "es2017.object",
27
- "dom"
28
- ],
29
- "module": "esnext",
30
- "removeComments": true,
31
- "alwaysStrict": true,
32
- "allowUnreachableCode": false,
33
- "noImplicitAny": false,
34
- "noImplicitThis": true,
35
- "noUnusedLocals": true,
36
- "noUnusedParameters": true,
37
- "noImplicitReturns": true,
38
- "noFallthroughCasesInSwitch": true,
39
- "forceConsistentCasingInFileNames": true,
40
- "importHelpers": true,
41
- "resolveJsonModule": true,
42
- "typeRoots": [
43
- "./node_modules/@types",
44
- "./node_modules/@aarhus-university/types"
45
- ]
46
- },
1
+ {
2
+ "compilerOptions": {
3
+ // Target latest version of ECMAScript.
4
+ "target": "esnext",
5
+ // path to output directory
6
+ "outDir": "../wwwroot/js",
7
+ // enable strict null checks as a best practice
8
+ "strictNullChecks": true,
9
+ // Search under node_modules for non-relative imports.
10
+ "moduleResolution": "node",
11
+ // Process & infer types from .js files.
12
+ "allowJs": true,
13
+ // Don't emit; allow Babel to transform files.
14
+ "noEmit": true,
15
+ // Enable strictest settings like strictNullChecks & noImplicitAny.
16
+ "strict": true,
17
+ // Import non-ES modules as default imports.
18
+ "esModuleInterop": true,
19
+ // use typescript to transpile jsx to js
20
+ "jsx": "react",
21
+ "baseUrl": "./src",
22
+ "lib": [
23
+ "es2015",
24
+ "dom.iterable",
25
+ "es2016.array.include",
26
+ "es2017.object",
27
+ "dom"
28
+ ],
29
+ "module": "esnext",
30
+ "removeComments": true,
31
+ "alwaysStrict": true,
32
+ "allowUnreachableCode": false,
33
+ "noImplicitAny": false,
34
+ "noImplicitThis": true,
35
+ "noUnusedLocals": true,
36
+ "noUnusedParameters": true,
37
+ "noImplicitReturns": true,
38
+ "noFallthroughCasesInSwitch": true,
39
+ "forceConsistentCasingInFileNames": true,
40
+ "importHelpers": true,
41
+ "resolveJsonModule": true,
42
+ "typeRoots": [
43
+ "./node_modules/@types",
44
+ "./node_modules/@aarhus-university/types"
45
+ ]
46
+ },
47
47
  }
package/webpack.config.js CHANGED
@@ -1,89 +1,89 @@
1
- /* eslint-disable @typescript-eslint/no-var-requires */
2
- /* eslint-disable import/no-extraneous-dependencies */
3
- const ESLintPlugin = require('eslint-webpack-plugin');
4
- const MiniCssExtractPlugin = require('mini-css-extract-plugin');
5
- const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
6
- const path = require('path');
7
-
8
- // https://github.com/webpack/webpack/issues/4453
9
-
10
- const entries = {
11
- all: './src/layout-2016/lib/all',
12
- alphabox: './src/layout-2016/lib/au-alphabox',
13
- databox: './src/layout-2016/lib/au-databox',
14
- diagramme: './src/layout-2016/lib/au-diagramme',
15
- flowbox: './src/layout-2016/lib/au-flowbox',
16
- universe: './src/layout-2016/lib/universe',
17
- };
18
-
19
- module.exports = Object.entries(entries).map((entry) => ({
20
- mode: 'production',
21
- devtool: 'source-map',
22
- entry: {
23
- [entry[0]]: entry[1],
24
- },
25
- output: {
26
- path: path.resolve(__dirname, './build/umd'),
27
- filename: '[name].js',
28
- libraryTarget: 'umd', // https://webpack.js.org/configuration/output/#output-librarytarget
29
- },
30
- plugins: [
31
- new ESLintPlugin({
32
- fix: true,
33
- }),
34
- new MiniCssExtractPlugin({
35
- filename: 'all.css',
36
- chunkFilename: '[id].css',
37
- }),
38
- new ForkTsCheckerWebpackPlugin(),
39
- ],
40
- resolve: {
41
- extensions: ['.ts', '.tsx', '.js', '.jsx'],
42
- },
43
- module: {
44
- rules: [
45
- {
46
- test: /\.(ts|js)x?$/,
47
- include: path.resolve(__dirname, '.'),
48
- exclude: /(node_modules)/,
49
- use: {
50
- loader: 'babel-loader',
51
- },
52
- },
53
- {
54
- test: /\.(ts|js)x?$/,
55
- include: path.resolve(__dirname, './node_modules/@aarhus-university/au-designsystem-delphinus/source'),
56
- use: {
57
- loader: 'babel-loader',
58
- },
59
- },
60
- {
61
- test: /\.scss/,
62
- include: path.resolve(__dirname, './src/styles'),
63
- sideEffects: true,
64
- use: [
65
- MiniCssExtractPlugin.loader,
66
- { loader: 'css-loader' },
67
- { loader: 'sass-loader' },
68
- ],
69
- },
70
- ],
71
- },
72
- externals: {
73
- moment: 'moment',
74
- react: {
75
- root: 'React',
76
- commonjs2: 'react',
77
- commonjs: 'react',
78
- amd: 'react',
79
- umd: 'react',
80
- },
81
- 'react-dom': {
82
- root: 'ReactDOM',
83
- commonjs2: 'react-dom',
84
- commonjs: 'react-dom',
85
- amd: 'react-dom',
86
- umd: 'react-dom',
87
- },
88
- },
89
- }));
1
+ /* eslint-disable @typescript-eslint/no-var-requires */
2
+ /* eslint-disable import/no-extraneous-dependencies */
3
+ const ESLintPlugin = require('eslint-webpack-plugin');
4
+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
5
+ const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
6
+ const path = require('path');
7
+
8
+ // https://github.com/webpack/webpack/issues/4453
9
+
10
+ const entries = {
11
+ all: './src/layout-2016/lib/all',
12
+ alphabox: './src/layout-2016/lib/au-alphabox',
13
+ databox: './src/layout-2016/lib/au-databox',
14
+ diagramme: './src/layout-2016/lib/au-diagramme',
15
+ flowbox: './src/layout-2016/lib/au-flowbox',
16
+ universe: './src/layout-2016/lib/universe',
17
+ };
18
+
19
+ module.exports = Object.entries(entries).map((entry) => ({
20
+ mode: 'production',
21
+ devtool: 'source-map',
22
+ entry: {
23
+ [entry[0]]: entry[1],
24
+ },
25
+ output: {
26
+ path: path.resolve(__dirname, './build/umd'),
27
+ filename: '[name].js',
28
+ libraryTarget: 'umd', // https://webpack.js.org/configuration/output/#output-librarytarget
29
+ },
30
+ plugins: [
31
+ new ESLintPlugin({
32
+ fix: true,
33
+ }),
34
+ new MiniCssExtractPlugin({
35
+ filename: 'all.css',
36
+ chunkFilename: '[id].css',
37
+ }),
38
+ new ForkTsCheckerWebpackPlugin(),
39
+ ],
40
+ resolve: {
41
+ extensions: ['.ts', '.tsx', '.js', '.jsx'],
42
+ },
43
+ module: {
44
+ rules: [
45
+ {
46
+ test: /\.(ts|js)x?$/,
47
+ include: path.resolve(__dirname, '.'),
48
+ exclude: /(node_modules)/,
49
+ use: {
50
+ loader: 'babel-loader',
51
+ },
52
+ },
53
+ {
54
+ test: /\.(ts|js)x?$/,
55
+ include: path.resolve(__dirname, './node_modules/@aarhus-university/au-designsystem-delphinus/source'),
56
+ use: {
57
+ loader: 'babel-loader',
58
+ },
59
+ },
60
+ {
61
+ test: /\.scss/,
62
+ include: path.resolve(__dirname, './src/styles'),
63
+ sideEffects: true,
64
+ use: [
65
+ MiniCssExtractPlugin.loader,
66
+ { loader: 'css-loader' },
67
+ { loader: 'sass-loader' },
68
+ ],
69
+ },
70
+ ],
71
+ },
72
+ externals: {
73
+ moment: 'moment',
74
+ react: {
75
+ root: 'React',
76
+ commonjs2: 'react',
77
+ commonjs: 'react',
78
+ amd: 'react',
79
+ umd: 'react',
80
+ },
81
+ 'react-dom': {
82
+ root: 'ReactDOM',
83
+ commonjs2: 'react-dom',
84
+ commonjs: 'react-dom',
85
+ amd: 'react-dom',
86
+ umd: 'react-dom',
87
+ },
88
+ },
89
+ }));