@aarhus-university/au-lib-react-components 10.19.2 → 10.20.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.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"sideEffects": false,
|
|
3
3
|
"name": "@aarhus-university/au-lib-react-components",
|
|
4
|
-
"version": "10.
|
|
4
|
+
"version": "10.20.1",
|
|
5
5
|
"description": "Library for shared React components for various applications on au.dk",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "jest",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@aarhus-university/au-designsystem-delphinus": "0.30.1",
|
|
76
|
-
"@aarhus-university/types": "0.13.
|
|
76
|
+
"@aarhus-university/types": "0.13.6",
|
|
77
77
|
"@reduxjs/toolkit": "^1.8.3",
|
|
78
78
|
"@types/google.analytics": "^0.0.42",
|
|
79
79
|
"@types/history": "^5.0.0",
|
|
@@ -20,6 +20,7 @@ const AUDatepickerComponent: FC<AUDatepickerComponentProps> = ({
|
|
|
20
20
|
limitStart,
|
|
21
21
|
limitEnd,
|
|
22
22
|
disabled,
|
|
23
|
+
sideBySideGrowth,
|
|
23
24
|
}: AUDatepickerComponentProps) => {
|
|
24
25
|
const [showCalendar, setShowCalendar] = useState(false);
|
|
25
26
|
const [sDate, setDate] = useState<Date>(date as Date);
|
|
@@ -43,6 +44,10 @@ const AUDatepickerComponent: FC<AUDatepickerComponentProps> = ({
|
|
|
43
44
|
className = `${className} visually-disabled`;
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
if (typeof sideBySideGrowth !== 'undefined' && sideBySideGrowth > 0) {
|
|
48
|
+
className = `${className} form__field--width-relative-${sideBySideGrowth}`;
|
|
49
|
+
}
|
|
50
|
+
|
|
46
51
|
return (
|
|
47
52
|
<div
|
|
48
53
|
className="datepicker"
|
|
@@ -111,6 +116,7 @@ AUDatepickerComponent.defaultProps = {
|
|
|
111
116
|
limitStart: null,
|
|
112
117
|
limitEnd: null,
|
|
113
118
|
disabled: false,
|
|
119
|
+
sideBySideGrowth: 0,
|
|
114
120
|
};
|
|
115
121
|
|
|
116
122
|
AUDatepickerComponent.displayName = 'AUDatepickerComponent';
|
package/src/lib/hooks.ts
CHANGED
|
@@ -33,7 +33,11 @@ const useModal = (
|
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
const useTranslation = <T>(
|
|
36
|
+
const useTranslation = <T>(
|
|
37
|
+
initialObject: T,
|
|
38
|
+
promises: [Promise<any>, Promise<any> | null],
|
|
39
|
+
lang: string,
|
|
40
|
+
): T => {
|
|
37
41
|
const [translations, setTranslations] = useState<T>(initialObject);
|
|
38
42
|
const loadTranslation = async (): Promise<void> => {
|
|
39
43
|
const translation = await Promise.all(promises);
|
|
@@ -46,7 +50,7 @@ const useTranslation = <T>(initialObject: T, promises: [Promise<any>, Promise<an
|
|
|
46
50
|
|
|
47
51
|
useEffect(() => {
|
|
48
52
|
loadTranslation();
|
|
49
|
-
}, []);
|
|
53
|
+
}, [lang]);
|
|
50
54
|
|
|
51
55
|
return translations;
|
|
52
56
|
};
|
package/stories/lib/helpers.tsx
CHANGED
|
@@ -55,8 +55,9 @@ const ThemeLanguageWrapper = ({
|
|
|
55
55
|
defaultLabels,
|
|
56
56
|
importPromises,
|
|
57
57
|
translationContext,
|
|
58
|
+
lang,
|
|
58
59
|
}) => {
|
|
59
|
-
const translations = useTranslation<typeof defaultLabels>(defaultLabels, importPromises);
|
|
60
|
+
const translations = useTranslation<typeof defaultLabels>(defaultLabels, importPromises, lang);
|
|
60
61
|
useEffect(() => {
|
|
61
62
|
const body = document.querySelector('body');
|
|
62
63
|
if (body) {
|