@apolitical/component-library 4.5.10 → 4.5.11-beta.2
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/context/user/user.context.d.ts +13 -5
- package/context/user/user.provider.d.ts +2 -1
- package/form/components/form/form.types.d.ts +13 -12
- package/form/components/form/index.d.ts +1 -1
- package/form/components/profile-image-change/profile-image-change.d.ts +20 -7
- package/form/types/index.d.ts +1 -0
- package/form/types/profile-form/index.d.ts +1 -0
- package/form/types/profile-form/profile-form.d.ts +25 -0
- package/helpers/intl.d.ts +20 -6
- package/index.js +63 -63
- package/index.mjs +23115 -22874
- package/modals/components/index.d.ts +2 -0
- package/modals/{overlay → components/overlay}/overlay.d.ts +1 -1
- package/modals/index.d.ts +2 -4
- package/modals/{discussion-form-modal → types/discussion-form-modal}/discussion-form-modal.d.ts +1 -1
- package/modals/types/index.d.ts +3 -0
- package/modals/types/profile-modal/index.d.ts +1 -0
- package/modals/types/profile-modal/profile-modal.d.ts +25 -0
- package/package.json +1 -1
- package/sections/edit-section/edit-section.d.ts +4 -2
- package/style.css +1 -1
- package/user/profile-picture/profile-picture.d.ts +3 -1
- /package/modals/{modal → components/modal}/index.d.ts +0 -0
- /package/modals/{modal → components/modal}/modal.d.ts +0 -0
- /package/modals/{overlay → components/overlay}/index.d.ts +0 -0
- /package/modals/{overlay → components/overlay}/overlay.helpers.d.ts +0 -0
- /package/modals/{discussion-form-modal → types/discussion-form-modal}/index.d.ts +0 -0
- /package/modals/{invite-modal → types/invite-modal}/index.d.ts +0 -0
- /package/modals/{invite-modal → types/invite-modal}/invite-modal.d.ts +0 -0
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface IUserDetailsImage {
|
|
3
|
+
thumbnail?: string;
|
|
4
|
+
full?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IUserDetailsLocation {
|
|
7
|
+
country?: string;
|
|
8
|
+
}
|
|
2
9
|
export interface IUserDetails {
|
|
3
10
|
id?: string;
|
|
4
11
|
name?: string;
|
|
5
|
-
image?:
|
|
6
|
-
thumbnail?: string;
|
|
7
|
-
};
|
|
12
|
+
image?: IUserDetailsImage;
|
|
8
13
|
organization?: string;
|
|
9
14
|
jobTitle?: string;
|
|
15
|
+
location?: IUserDetailsLocation;
|
|
16
|
+
biography?: string;
|
|
10
17
|
}
|
|
11
18
|
export interface IUserContext extends IUserDetails {
|
|
12
19
|
isLoading: boolean;
|
|
20
|
+
updateDetails?: React.Dispatch<React.SetStateAction<IUserContext>>;
|
|
13
21
|
}
|
|
14
|
-
export declare const UserContext:
|
|
22
|
+
export declare const UserContext: React.Context<IUserContext>;
|
|
@@ -3,6 +3,7 @@ import type { IUserContext } from './user.context';
|
|
|
3
3
|
interface Props {
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
user: IUserContext;
|
|
6
|
+
updateDetails?: React.Dispatch<React.SetStateAction<IUserContext>>;
|
|
6
7
|
}
|
|
7
|
-
export declare const UserProvider: ({ children, user }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const UserProvider: ({ children, user, updateDetails }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
export {};
|
|
@@ -173,6 +173,18 @@ export interface FormButtonPropsType extends ButtonPropsType {
|
|
|
173
173
|
/** The option to not have the submit button at all */
|
|
174
174
|
hideButton?: boolean;
|
|
175
175
|
}
|
|
176
|
+
export interface IFormMeta {
|
|
177
|
+
/** Whether the form should reset after submission */
|
|
178
|
+
shouldReset?: boolean;
|
|
179
|
+
/** Whether the form should hide after submission */
|
|
180
|
+
shouldHide?: boolean;
|
|
181
|
+
/** Whether the form should show required labels */
|
|
182
|
+
showRequiredLabels?: boolean;
|
|
183
|
+
/** Whether the form should show success message*/
|
|
184
|
+
showSuccessMessage?: boolean | string;
|
|
185
|
+
/** Whether the form should show cancel button */
|
|
186
|
+
shouldShowCancelButton?: boolean;
|
|
187
|
+
}
|
|
176
188
|
export interface IFormProps {
|
|
177
189
|
/** The form submit button */
|
|
178
190
|
button?: FormButtonPropsType;
|
|
@@ -209,18 +221,7 @@ export interface IFormProps {
|
|
|
209
221
|
/** The internationalisation path for text in the form */
|
|
210
222
|
intlPath?: string | false;
|
|
211
223
|
/** Data about the form */
|
|
212
|
-
meta?:
|
|
213
|
-
/** Whether the form should reset after submission */
|
|
214
|
-
shouldReset?: boolean;
|
|
215
|
-
/** Whether the form should hide after submission */
|
|
216
|
-
shouldHide?: boolean;
|
|
217
|
-
/** Whether the form should show required labels */
|
|
218
|
-
showRequiredLabels?: boolean;
|
|
219
|
-
/** Whether the form should show success message*/
|
|
220
|
-
showSuccessMessage?: boolean | string;
|
|
221
|
-
/** Whether the form should show cancel button */
|
|
222
|
-
shouldShowCancelButton?: boolean;
|
|
223
|
-
};
|
|
224
|
+
meta?: IFormMeta;
|
|
224
225
|
/** Optional children */
|
|
225
226
|
children?: React.ReactNode;
|
|
226
227
|
/** An ID for jest tests */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as Form } from './form';
|
|
2
|
-
export type { IField, FormValues } from './form.types';
|
|
2
|
+
export type { IField, FormValues, IFormMeta } from './form.types';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { IUserDetailsImage } from '../../../context';
|
|
2
3
|
interface IUploadImageResponse {
|
|
3
4
|
thumbnailURL: string;
|
|
4
5
|
originalURL: string;
|
|
5
6
|
}
|
|
6
|
-
type TSetUserImage = (value: React.SetStateAction<
|
|
7
|
+
type TSetUserImage = (value: React.SetStateAction<IUserDetailsImage>) => void;
|
|
7
8
|
interface IUploadImageProps {
|
|
8
9
|
fileObject: File;
|
|
9
10
|
userId: string;
|
|
@@ -15,12 +16,24 @@ interface Props {
|
|
|
15
16
|
userId: string;
|
|
16
17
|
/** User name */
|
|
17
18
|
userName: string;
|
|
18
|
-
/**
|
|
19
|
-
src?:
|
|
19
|
+
/** Image data */
|
|
20
|
+
src?: IUserDetailsImage;
|
|
20
21
|
/** Function to upload the image */
|
|
21
|
-
uploadImage: ({ fileObject, userId }: IUploadImageProps) => Promise<IUploadImageResponse>;
|
|
22
|
-
/**
|
|
23
|
-
|
|
22
|
+
uploadImage: ({ fileObject, userId, }: IUploadImageProps) => Promise<IUploadImageResponse>;
|
|
23
|
+
/** Button props */
|
|
24
|
+
button?: {
|
|
25
|
+
/** Text for the button */
|
|
26
|
+
text?: {
|
|
27
|
+
/** Text to upload an image for the first time */
|
|
28
|
+
upload?: string;
|
|
29
|
+
/** Text to change the image */
|
|
30
|
+
change?: string;
|
|
31
|
+
/** Text to show while the image is being uploaded */
|
|
32
|
+
uploading?: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
/** Callback function to update state in the parent file */
|
|
36
|
+
callback: TSetUserImage;
|
|
24
37
|
}
|
|
25
|
-
declare function ProfileImageChange({ className, userId, userName, src,
|
|
38
|
+
declare function ProfileImageChange({ className, userId, userName, src, uploadImage, button, callback, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
26
39
|
export default ProfileImageChange;
|
package/form/types/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ProfileForm, type IProfileFormProps } from './profile-form';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { IFormValues, IFormMeta } from './../../components/form/form.types';
|
|
2
|
+
export interface IProfileFormProps {
|
|
3
|
+
/** The functions to call */
|
|
4
|
+
functions: {
|
|
5
|
+
/** The function to upload the user's profile image */
|
|
6
|
+
uploadImage: () => void;
|
|
7
|
+
/** The function to handle getting the location predictions */
|
|
8
|
+
predictPlace: (arg: object) => {
|
|
9
|
+
city: Promise<any[]>;
|
|
10
|
+
};
|
|
11
|
+
/** The function to call on success */
|
|
12
|
+
onSuccess?: (data: IFormValues) => Promise<void>;
|
|
13
|
+
/** The function to call on failure */
|
|
14
|
+
onFailure?: () => void;
|
|
15
|
+
};
|
|
16
|
+
/** Meta for the form */
|
|
17
|
+
meta?: IFormMeta;
|
|
18
|
+
/** The Google Tag Manager data */
|
|
19
|
+
gtm?: {
|
|
20
|
+
context?: string;
|
|
21
|
+
event?: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
declare const ProfileForm: ({ functions, meta, gtm }: IProfileFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export default ProfileForm;
|
package/helpers/intl.d.ts
CHANGED
|
@@ -233,10 +233,22 @@ export declare const checkIntlPathExists: (path: string, language?: {
|
|
|
233
233
|
passwordRules_currentPassword_label: string;
|
|
234
234
|
passwordRules_newPassword_label: string;
|
|
235
235
|
passwordRules_confirmPassword_label: string;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
236
|
+
profileForm_image: string;
|
|
237
|
+
profileForm_name: string;
|
|
238
|
+
profileForm_name_placeholder: string;
|
|
239
|
+
profileForm_jobTitle: string;
|
|
240
|
+
profileForm_jobTitle_placeholder: string;
|
|
241
|
+
profileForm_organization: string;
|
|
242
|
+
profileForm_organization_placeholder: string;
|
|
243
|
+
profileForm_location: string;
|
|
244
|
+
profileForm_location_placeholder: string;
|
|
245
|
+
profileForm_bio: string;
|
|
246
|
+
profileForm_bio_placeholder: string;
|
|
247
|
+
profileForm_cta: string;
|
|
248
|
+
profileImageChange_cta_uploading: string;
|
|
249
|
+
profileImageChange_cta_change: string;
|
|
250
|
+
profileImageChange_cta_upload: string;
|
|
251
|
+
profileImageChange_error: string;
|
|
240
252
|
ratings_text: string;
|
|
241
253
|
ratings_stars: string;
|
|
242
254
|
ratings_low: string;
|
|
@@ -393,6 +405,7 @@ export declare const checkIntlPathExists: (path: string, language?: {
|
|
|
393
405
|
inviteModal_formLabel: string;
|
|
394
406
|
inviteModal_cta: string;
|
|
395
407
|
overlay_close: string;
|
|
408
|
+
profileModal_title: string;
|
|
396
409
|
breadcrumbs_label: string;
|
|
397
410
|
breadcrumbs_currentPage: string;
|
|
398
411
|
filters_all: string;
|
|
@@ -421,8 +434,9 @@ export declare const checkIntlPathExists: (path: string, language?: {
|
|
|
421
434
|
shareLinks_link_email: string;
|
|
422
435
|
'shareLinks_link_clipboard-copy': string;
|
|
423
436
|
tags_community: string;
|
|
424
|
-
|
|
425
|
-
|
|
437
|
+
editSection_placeholder_description: string;
|
|
438
|
+
editSection_placeholder_cta: string;
|
|
439
|
+
editSection_edit: string;
|
|
426
440
|
notFoundError_title: string;
|
|
427
441
|
notFoundError_text: string;
|
|
428
442
|
notFoundError_post_1: string;
|