@aarhus-university/au-lib-react-components 8.84.0 → 8.85.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/package.json +1 -1
- package/src/components/AUMobilePrefixComponent.tsx +1 -1
- package/src/lib/helpers.ts +5 -2
- package/src/lib/i18n.ts +1 -1
- package/types/common/{interfaces.d.ts → interfaces/gui.d.ts} +0 -28
- package/types/common/interfaces/model.d.ts +29 -0
- package/types/common/main.d.ts +2 -1
- package/types/common/props.d.ts +2 -2
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": "8.
|
|
4
|
+
"version": "8.85.0",
|
|
5
5
|
"description": "Library for shared React components for various applications on au.dk",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "webpack --config ./webpack.config.js"
|
|
@@ -4,7 +4,7 @@ const AUMobilePrefixComponent: FC<AUMobilePrefixComponentProps> = ({
|
|
|
4
4
|
countryCodes,
|
|
5
5
|
important,
|
|
6
6
|
}: AUMobilePrefixComponentProps) => {
|
|
7
|
-
const renderCountryCodes = (codes:
|
|
7
|
+
const renderCountryCodes = (codes:AU.ICountryCode[]) => codes.map(c => <option key={c.da} value={`+${c.code}`}>{`${c.da} (+${c.code})`}</option>);
|
|
8
8
|
if (important) {
|
|
9
9
|
return <>{renderCountryCodes(countryCodes.filter(c => c.important))}</>;
|
|
10
10
|
}
|
package/src/lib/helpers.ts
CHANGED
|
@@ -131,7 +131,10 @@ const setCaretPosition = (element: HTMLInputElement, pos: number): void => {
|
|
|
131
131
|
}
|
|
132
132
|
};
|
|
133
133
|
|
|
134
|
-
const splitPhoneNumber = (
|
|
134
|
+
const splitPhoneNumber = (
|
|
135
|
+
countryCodes: AU.ICountryCode[],
|
|
136
|
+
phoneNumber: string,
|
|
137
|
+
): AU.IPhoneNumber => {
|
|
135
138
|
const countryCodeFound = (code: string) => countryCodes.filter(
|
|
136
139
|
(x) => x.code === parseInt(code, 10),
|
|
137
140
|
).length > 0;
|
|
@@ -160,7 +163,7 @@ const splitPhoneNumber = (countryCodes: ICountryCode[], phoneNumber: string): IP
|
|
|
160
163
|
};
|
|
161
164
|
};
|
|
162
165
|
|
|
163
|
-
const prettyPrintPhone = (countryCodes: ICountryCode[], phone: string) => {
|
|
166
|
+
const prettyPrintPhone = (countryCodes: AU.ICountryCode[], phone: string) => {
|
|
164
167
|
if (phone) {
|
|
165
168
|
const { prefix, number } = splitPhoneNumber(countryCodes, phone);
|
|
166
169
|
if (prefix) {
|
package/src/lib/i18n.ts
CHANGED
|
@@ -355,7 +355,7 @@ const passwordLabels = {
|
|
|
355
355
|
},
|
|
356
356
|
};
|
|
357
357
|
|
|
358
|
-
const countryCodes:
|
|
358
|
+
const countryCodes:AU.ICountryCode[] = [
|
|
359
359
|
{ da: 'Afghanistan', en: 'Afghanistan', code: 93 },
|
|
360
360
|
{ da: 'Albanien', en: 'Albania', code: 355 },
|
|
361
361
|
{ da: 'Algeriet', en: 'Algeria', code: 213 },
|
|
@@ -41,23 +41,11 @@ interface IProgressable {
|
|
|
41
41
|
progressed: boolean,
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
interface ICountryCode {
|
|
45
|
-
da: string,
|
|
46
|
-
en: string,
|
|
47
|
-
code: number,
|
|
48
|
-
important?: boolean | undefined,
|
|
49
|
-
}
|
|
50
|
-
|
|
51
44
|
interface IReceiptButton {
|
|
52
45
|
gotoLink: string,
|
|
53
46
|
gotoText: string,
|
|
54
47
|
}
|
|
55
48
|
|
|
56
|
-
interface IPhoneNumber {
|
|
57
|
-
prefix: string,
|
|
58
|
-
number: string,
|
|
59
|
-
}
|
|
60
|
-
|
|
61
49
|
interface ITrackers {
|
|
62
50
|
account: string,
|
|
63
51
|
name: string,
|
|
@@ -73,19 +61,3 @@ interface IProfileSettings {
|
|
|
73
61
|
disabled?: boolean,
|
|
74
62
|
onClick?: (el: Element) => void,
|
|
75
63
|
}
|
|
76
|
-
|
|
77
|
-
interface IUserContext {
|
|
78
|
-
auId: number,
|
|
79
|
-
firstNames: string,
|
|
80
|
-
lastName: string,
|
|
81
|
-
name: string,
|
|
82
|
-
preferredLanguage: string,
|
|
83
|
-
userName: string,
|
|
84
|
-
memberOfGroups: IAdGroup[],
|
|
85
|
-
impersonatingUser: IUserContext | null,
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
interface IAdGroup {
|
|
89
|
-
id: string,
|
|
90
|
-
name: string,
|
|
91
|
-
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare namespace AU {
|
|
2
|
+
export interface IUserContext {
|
|
3
|
+
auId: number,
|
|
4
|
+
firstNames: string,
|
|
5
|
+
lastName: string,
|
|
6
|
+
name: string,
|
|
7
|
+
preferredLanguage: string,
|
|
8
|
+
userName: string,
|
|
9
|
+
memberOfGroups: IAdGroup[],
|
|
10
|
+
impersonatingUser: IUserContext | null,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface IAdGroup {
|
|
14
|
+
id: string,
|
|
15
|
+
name: string,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface ICountryCode {
|
|
19
|
+
da: string,
|
|
20
|
+
en: string,
|
|
21
|
+
code: number,
|
|
22
|
+
important?: boolean | undefined,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface IPhoneNumber {
|
|
26
|
+
prefix: string,
|
|
27
|
+
number: string,
|
|
28
|
+
}
|
|
29
|
+
}
|
package/types/common/main.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/triple-slash-reference */
|
|
2
|
-
/// <reference path="./interfaces.d.ts" />
|
|
2
|
+
/// <reference path="./interfaces/gui.d.ts" />
|
|
3
|
+
/// <reference path="./interfaces/model.d.ts" />
|
|
3
4
|
/// <reference path="./payloads.d.ts" />
|
|
4
5
|
/// <reference path="./props.d.ts" />
|
package/types/common/props.d.ts
CHANGED
|
@@ -126,7 +126,7 @@ interface AUSubmitButtonContainerComponentProps {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
interface AUMobilePrefixComponentProps {
|
|
129
|
-
countryCodes: ICountryCode[],
|
|
129
|
+
countryCodes: AU.ICountryCode[],
|
|
130
130
|
important: boolean,
|
|
131
131
|
}
|
|
132
132
|
|
|
@@ -149,7 +149,7 @@ interface AUProfileWidgetComponentProps {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
interface AUProfileAvatarComponentProps {
|
|
152
|
-
user: IUserContext,
|
|
152
|
+
user: AU.IUserContext,
|
|
153
153
|
settings: IProfileSettings[],
|
|
154
154
|
profileLabels: any, // Noget med labels her?
|
|
155
155
|
logoutUri: string,
|