@apolitical/component-library 5.0.0-4749.1 → 5.0.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 (62) hide show
  1. package/cards/card-block/card-block.d.ts +2 -2
  2. package/cards/card-block/index.d.ts +1 -0
  3. package/communities/members-list/members-list.d.ts +2 -1
  4. package/communities/members-list/members-list.mock.d.ts +21 -0
  5. package/context/badges/badges.context.d.ts +13 -0
  6. package/context/badges/badges.hook.d.ts +1 -0
  7. package/context/badges/badges.provider.d.ts +8 -0
  8. package/context/badges/index.d.ts +4 -0
  9. package/context/global/global.providers.d.ts +1 -1
  10. package/context/index.d.ts +1 -0
  11. package/discussion/components/add-post/add-post.d.ts +2 -0
  12. package/discussion/components/form/form.d.ts +1 -1
  13. package/discussion/components/form/form.type.d.ts +2 -0
  14. package/discussion/components/post/post.d.ts +4 -1
  15. package/discussion/discussion.helpers.d.ts +1 -0
  16. package/discussion/feeds/activities-feed/mocks/activities-feed.mock.d.ts +42 -0
  17. package/discussion/feeds/replies-feed/mocks/replies-feed.mock.d.ts +33 -0
  18. package/discussion/feeds/replies-feed/nested-replies-feed/mocks/nested-replies-feed.mock.d.ts +29 -2
  19. package/discussion/sections/activity-section/activity-section.d.ts +2 -2
  20. package/discussion/sections/activity-section/index.d.ts +1 -0
  21. package/discussion/sections/activity-section/mocks/activity-section.mock.d.ts +5 -0
  22. package/discussion/shared/interfaces/user.interface.d.ts +2 -0
  23. package/form/components/form/index.d.ts +1 -1
  24. package/form/components/rich-text-editor/helpers/transform/transform.d.ts +1 -1
  25. package/form/types/profile-form/profile-form.d.ts +3 -3
  26. package/general/tooltip/tooltip.d.ts +7 -2
  27. package/helpers/intl.d.ts +6 -2
  28. package/index.js +61 -61
  29. package/index.mjs +7281 -7020
  30. package/layout/content-layout/columns/columns.d.ts +2 -2
  31. package/layout/content-layout/columns/index.d.ts +1 -0
  32. package/navigation/load-more/index.d.ts +1 -1
  33. package/navigation/load-more/load-more.d.ts +3 -3
  34. package/navigation/tabs/index.d.ts +1 -0
  35. package/navigation/tabs/tabs.d.ts +6 -6
  36. package/package.json +1 -1
  37. package/sections/edit-section/edit-section.d.ts +2 -2
  38. package/sections/edit-section/index.d.ts +1 -0
  39. package/style.css +1 -1
  40. package/styles/variables/colors/_colors.scss +1 -0
  41. package/styles/variables/colors/theme/_base.scss +1 -0
  42. package/styles/variables/colors/theme/_user.scss +6 -0
  43. package/text/empty-state-box/empty-state-box.d.ts +2 -2
  44. package/text/empty-state-box/index.d.ts +1 -0
  45. package/text/helper-text-box/helper-text-box.d.ts +2 -0
  46. package/text/hide-show-text-box/hide-show-text-box.d.ts +2 -2
  47. package/text/hide-show-text-box/index.d.ts +1 -0
  48. package/text/highlighted-text-box/highlighted-text-box.d.ts +2 -2
  49. package/text/highlighted-text-box/index.d.ts +1 -0
  50. package/text/pill/pill.d.ts +2 -1
  51. package/user/badge/badge.d.ts +7 -0
  52. package/user/badge/icon-mapping.d.ts +11 -0
  53. package/user/badge/index.d.ts +2 -0
  54. package/user/badge/interface/badge.interfaces.d.ts +9 -0
  55. package/user/badges/badges.d.ts +12 -0
  56. package/user/badges/badges.interface.d.ts +8 -0
  57. package/user/badges/index.d.ts +2 -0
  58. package/user/member/member.d.ts +7 -1
  59. package/user/member/member.helpers.d.ts +2 -0
  60. package/user/member/member.mock.d.ts +8 -0
  61. package/user/profile-picture/index.d.ts +1 -0
  62. package/user/profile-picture/profile-picture.d.ts +2 -2
@@ -1,5 +1,5 @@
1
1
  import { CardType, CardContentType, BuildCardDataType } from '../../cards/cards.types';
2
- interface Props {
2
+ export interface ICardBlockProps {
3
3
  /** The card data, from Contentful */
4
4
  cards: CardType[];
5
5
  /** The types for each card, from Contentful */
@@ -12,5 +12,5 @@ interface Props {
12
12
  className?: string;
13
13
  focusCardIndex?: number;
14
14
  }
15
- declare const CardBlock: ({ cards, cardTypes, className, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
15
+ declare const CardBlock: ({ cards, cardTypes, className, ...props }: ICardBlockProps) => import("react/jsx-runtime").JSX.Element;
16
16
  export default CardBlock;
@@ -1 +1,2 @@
1
+ export type { ICardBlockProps } from './card-block';
1
2
  export { default as CardBlock } from './card-block';
@@ -10,6 +10,7 @@ interface Props {
10
10
  data: CommunityMemberProps[];
11
11
  total?: number;
12
12
  };
13
+ communitySlug?: string;
13
14
  /** Whether the user is a member of the community */
14
15
  isMember?: boolean;
15
16
  /** Whether there is another page of members to load */
@@ -25,5 +26,5 @@ interface Props {
25
26
  /** Additional classes */
26
27
  className?: string;
27
28
  }
28
- declare const MembersList: ({ members: { data, total }, isMember, hasNextPage, loadNextPage, profile, gtmContext, gtmType, className, }: Props) => import("react/jsx-runtime").JSX.Element | null;
29
+ declare const MembersList: ({ members: { data, total }, communitySlug, isMember, hasNextPage, loadNextPage, profile, gtmContext, gtmType, className, }: Props) => import("react/jsx-runtime").JSX.Element | null;
29
30
  export default MembersList;
@@ -1,6 +1,23 @@
1
1
  declare const _default: {
2
2
  members: {
3
3
  data: ({
4
+ id: string;
5
+ name: string;
6
+ jobTitle: string;
7
+ organization: string;
8
+ badges: {
9
+ communities: {
10
+ playground: string[];
11
+ };
12
+ };
13
+ location: {
14
+ country: string;
15
+ };
16
+ image: {
17
+ thumbnail: string;
18
+ };
19
+ isAdmin: boolean;
20
+ } | {
4
21
  id: string;
5
22
  name: string;
6
23
  jobTitle: string;
@@ -12,6 +29,7 @@ declare const _default: {
12
29
  thumbnail: string;
13
30
  };
14
31
  isAdmin: boolean;
32
+ badges?: undefined;
15
33
  } | {
16
34
  id: string;
17
35
  name: string;
@@ -23,6 +41,7 @@ declare const _default: {
23
41
  image: {
24
42
  thumbnail: string;
25
43
  };
44
+ badges?: undefined;
26
45
  isAdmin?: undefined;
27
46
  } | {
28
47
  id: string;
@@ -32,6 +51,7 @@ declare const _default: {
32
51
  location: {
33
52
  country: string;
34
53
  };
54
+ badges?: undefined;
35
55
  image?: undefined;
36
56
  isAdmin?: undefined;
37
57
  })[];
@@ -41,6 +61,7 @@ declare const _default: {
41
61
  length: number;
42
62
  limit: number;
43
63
  };
64
+ communitySlug: string;
44
65
  profile: {
45
66
  hooks: {
46
67
  useMaps: () => {
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ export interface IBadge {
3
+ name: string;
4
+ slug: string;
5
+ description?: string;
6
+ icon?: string;
7
+ colour?: 'Grey' | 'Blue' | 'Green' | 'Pink' | 'Purple' | 'Orange';
8
+ }
9
+ export interface IBadgesContext {
10
+ badges: IBadge[];
11
+ isLoading: boolean;
12
+ }
13
+ export declare const BadgesContext: import("react").Context<IBadgesContext>;
@@ -0,0 +1 @@
1
+ export declare function useBadges(): import("./badges.context").IBadgesContext;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { IBadgesContext } from './badges.context';
3
+ interface Props {
4
+ children: React.ReactNode;
5
+ badges: IBadgesContext;
6
+ }
7
+ export declare const BadgesProvider: ({ children, badges }: Props) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,4 @@
1
+ export type { IBadge, IBadgesContext } from './badges.context';
2
+ export * from './badges.context';
3
+ export * from './badges.hook';
4
+ export * from './badges.provider';
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { type IIntlContext } from '../intl';
3
3
  import { type IUserContext } from '../user';
4
4
  interface Props {
5
- bootstrap: () => Promise<IUserContext>;
5
+ bootstrap: () => Promise<IUserContext | any[]>;
6
6
  children: React.ReactNode;
7
7
  intl?: IIntlContext;
8
8
  showDevTools?: boolean;
@@ -1,3 +1,4 @@
1
+ export * from './badges';
1
2
  export * from './cache';
2
3
  export * from './flags';
3
4
  export * from './global';
@@ -3,6 +3,8 @@ import type { IDiscussionForm } from '../../../discussion/components/form';
3
3
  interface Props {
4
4
  /** Whether the form should be displayed as a card */
5
5
  isCard?: boolean;
6
+ /** The ID of the parent, used for slugs */
7
+ parentId?: string;
6
8
  /** Props for the form - this uses everything the `DiscussionForm` component does */
7
9
  form: IDiscussionForm;
8
10
  /** Details about what a user needs to have to be able to access the form */
@@ -1,3 +1,3 @@
1
1
  import { IDiscussionForm } from './form.type';
2
- declare const DiscussionForm: ({ id, content, userHasPermissions, meta, placeholder, maxLength, buttons, forceShow, isCommunity, functions, data, gtmContext, }: IDiscussionForm) => import("react/jsx-runtime").JSX.Element;
2
+ declare const DiscussionForm: ({ id, parentId, content, userHasPermissions, meta, placeholder, maxLength, buttons, forceShow, isCommunity, functions, data, gtmContext, }: IDiscussionForm) => import("react/jsx-runtime").JSX.Element;
3
3
  export default DiscussionForm;
@@ -33,6 +33,8 @@ export interface IDiscussionFormMeta {
33
33
  export interface IDiscussionForm {
34
34
  /** A unique ID for the form */
35
35
  id?: string;
36
+ /** The ID of the parent, used for slugs */
37
+ parentId?: string;
36
38
  /** Information about the content being created/edited */
37
39
  content: IDiscussionContent;
38
40
  /** If the user has permission to interact with the form, e.g. if they're a member of the community */
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { type ListMembers, ClickMentionFallback } from '../../../form';
3
3
  import { DiscussionCreateContentFunction, DiscussionCreateLikeFunction, DiscussionDeleteLikeFunction, IForceHide, IFullDiscussionContent } from '../../discussion';
4
+ import { IBadgesOption } from '../../../user/badges';
4
5
  interface PostContent extends IFullDiscussionContent {
5
6
  /** The post body */
6
7
  postBody?: string;
@@ -77,6 +78,8 @@ interface Props {
77
78
  setFocus?: boolean;
78
79
  /** If the post is used within a community */
79
80
  isCommunity?: boolean;
81
+ /** Whether to show badges and the scope of the badge */
82
+ badges?: IBadgesOption;
80
83
  }
81
- declare const Post: ({ element, content, userHasPermissions, userHasOwnerPermissions, isLoading, originalAuthorId, forceHide, functions, links, className, gtmContext, children, isTruncated, styling: { showShareLinkButton }, setFocus, isCommunity, }: Props) => import("react/jsx-runtime").JSX.Element;
84
+ declare const Post: ({ element, content, userHasPermissions, userHasOwnerPermissions, isLoading, originalAuthorId, forceHide, functions, links, className, gtmContext, children, isTruncated, styling: { showShareLinkButton }, setFocus, isCommunity, badges, }: Props) => import("react/jsx-runtime").JSX.Element;
82
85
  export default Post;
@@ -15,4 +15,5 @@ export declare const getAuthorData: (author: IUser) => "deleted" | {
15
15
  image: {
16
16
  thumbnail: string | undefined;
17
17
  };
18
+ badges: import("../user/badge").IBadgesObject | undefined;
18
19
  };
@@ -8,6 +8,11 @@ export declare const activitiesFeedMock: {
8
8
  jobTitle: string;
9
9
  name: string;
10
10
  organization: string;
11
+ badges: {
12
+ communities: {
13
+ 'community-slug': string[];
14
+ };
15
+ };
11
16
  };
12
17
  };
13
18
  title: string;
@@ -62,6 +67,11 @@ export declare const activitiesFeedMock: {
62
67
  jobTitle: string;
63
68
  name: string;
64
69
  organization: string;
70
+ badges: {
71
+ communities: {
72
+ 'community-slug': string[];
73
+ };
74
+ };
65
75
  };
66
76
  };
67
77
  title: string;
@@ -92,6 +102,7 @@ export declare const activitiesFeedMock: {
92
102
  jobTitle: string;
93
103
  name: string;
94
104
  organization: string;
105
+ badges?: undefined;
95
106
  };
96
107
  };
97
108
  content: string;
@@ -113,6 +124,37 @@ export declare const activitiesFeedMock: {
113
124
  time: string;
114
125
  verb: string;
115
126
  title?: undefined;
127
+ } | {
128
+ actor: {
129
+ created_at: string;
130
+ updated_at: string;
131
+ id: string;
132
+ data: {
133
+ jobTitle: string;
134
+ name: string;
135
+ organization: string;
136
+ badges?: undefined;
137
+ };
138
+ };
139
+ title: string;
140
+ content: string;
141
+ feed_id: string;
142
+ foreign_id: string;
143
+ id: string;
144
+ latest_reactions: {
145
+ pin?: undefined;
146
+ };
147
+ latest_reactions_extra: {};
148
+ object: string;
149
+ origin: null;
150
+ own_reactions: {};
151
+ reaction_counts: {
152
+ like?: undefined;
153
+ pin?: undefined;
154
+ };
155
+ target: string;
156
+ time: string;
157
+ verb: string;
116
158
  })[];
117
159
  next: string;
118
160
  duration: string;
@@ -11,6 +11,11 @@ export declare const repliesFeedMock: {
11
11
  id: string;
12
12
  data: {
13
13
  name: string;
14
+ badges: {
15
+ communities: {
16
+ 'community-slug': string[];
17
+ };
18
+ };
14
19
  };
15
20
  };
16
21
  kind: string;
@@ -37,6 +42,7 @@ export declare const repliesFeedMock: {
37
42
  id: string;
38
43
  data: {
39
44
  name: string;
45
+ badges?: undefined;
40
46
  };
41
47
  };
42
48
  kind: string;
@@ -96,6 +102,33 @@ export declare const repliesFeedMock: {
96
102
  children_counts: {
97
103
  reply: number;
98
104
  };
105
+ } | {
106
+ created_at: string;
107
+ updated_at: string;
108
+ id: string;
109
+ user_id: string;
110
+ user: {
111
+ created_at: string;
112
+ updated_at: string;
113
+ id: string;
114
+ data: {
115
+ name: string;
116
+ badges?: undefined;
117
+ };
118
+ };
119
+ kind: string;
120
+ activity_id: string;
121
+ data: {
122
+ content: string;
123
+ };
124
+ parent: string;
125
+ latest_children: {
126
+ reply?: undefined;
127
+ };
128
+ children_counts: {
129
+ reply?: undefined;
130
+ };
131
+ own_children?: undefined;
99
132
  })[];
100
133
  duration: string;
101
134
  };
@@ -1,6 +1,6 @@
1
1
  export declare const nestedRepliesFeedMock: {
2
2
  next: string;
3
- results: {
3
+ results: ({
4
4
  created_at: string;
5
5
  updated_at: string;
6
6
  id: string;
@@ -11,6 +11,11 @@ export declare const nestedRepliesFeedMock: {
11
11
  id: string;
12
12
  data: {
13
13
  name: string;
14
+ badges: {
15
+ communities: {
16
+ 'community-slug': string[];
17
+ };
18
+ };
14
19
  };
15
20
  };
16
21
  kind: string;
@@ -21,6 +26,28 @@ export declare const nestedRepliesFeedMock: {
21
26
  parent: string;
22
27
  latest_children: {};
23
28
  children_counts: {};
24
- }[];
29
+ } | {
30
+ created_at: string;
31
+ updated_at: string;
32
+ id: string;
33
+ user_id: string;
34
+ user: {
35
+ created_at: string;
36
+ updated_at: string;
37
+ id: string;
38
+ data: {
39
+ name: string;
40
+ badges?: undefined;
41
+ };
42
+ };
43
+ kind: string;
44
+ activity_id: string;
45
+ data: {
46
+ content: string;
47
+ };
48
+ parent: string;
49
+ latest_children: {};
50
+ children_counts: {};
51
+ })[];
25
52
  duration: string;
26
53
  };
@@ -6,7 +6,7 @@ import { type IQueryFns } from './cache';
6
6
  interface IActivitySectionQueryFns extends IQueryFns {
7
7
  remove: () => Promise<void>;
8
8
  }
9
- interface Props {
9
+ export interface IActivitySectionProps {
10
10
  basePath: string;
11
11
  parentId: string;
12
12
  activityId: string;
@@ -21,5 +21,5 @@ interface Props {
21
21
  };
22
22
  profile: IProfileFormProps;
23
23
  }
24
- declare const ActivitySection: React.FC<Props>;
24
+ declare const ActivitySection: React.FC<IActivitySectionProps>;
25
25
  export default ActivitySection;
@@ -1 +1,2 @@
1
+ export type { IActivitySectionProps } from './activity-section';
1
2
  export { default as ActivitySection } from './activity-section';
@@ -10,6 +10,11 @@ export declare const activitySectionMock: {
10
10
  location: {
11
11
  country: string;
12
12
  };
13
+ badges: {
14
+ communities: {
15
+ 'community-slug': string[];
16
+ };
17
+ };
13
18
  };
14
19
  };
15
20
  content: string;
@@ -1,3 +1,4 @@
1
+ import { IBadgesObject } from '../../../user/badge';
1
2
  import type { EnrichedUser } from 'getstream';
2
3
  export interface IUser extends EnrichedUser {
3
4
  error?: string;
@@ -9,5 +10,6 @@ export interface IUser extends EnrichedUser {
9
10
  country?: string;
10
11
  };
11
12
  thumbnail?: string;
13
+ badges?: IBadgesObject;
12
14
  };
13
15
  }
@@ -1,2 +1,2 @@
1
1
  export { default as Form } from './form';
2
- export type { IField, FormValues, IFormMeta } from './form.types';
2
+ export type { IField, FormValues, IFormMeta, IFormProps } from './form.types';
@@ -12,7 +12,7 @@ export default function transform<T extends InputNodeTypes>(node: MdastNode, opt
12
12
  position?: any;
13
13
  ordered?: boolean | undefined;
14
14
  checked?: any;
15
- depth?: 1 | 2 | 3 | 4 | 6 | 5 | undefined;
15
+ depth?: 1 | 2 | 3 | 4 | 5 | 6 | undefined;
16
16
  lang?: string | undefined;
17
17
  spread?: any;
18
18
  indent?: any;
@@ -1,5 +1,5 @@
1
1
  import type { IFormValues, IFormMeta } from './../../components/form/form.types';
2
- export interface IProfileFormProps {
2
+ export interface IProfileFormProps<OnSuccessArgs = IFormValues> {
3
3
  /** The hooks used in the form */
4
4
  hooks: {
5
5
  /** The hook to predict the user's location */
@@ -16,9 +16,9 @@ export interface IProfileFormProps {
16
16
  /** The functions to call */
17
17
  functions: {
18
18
  /** The function to upload the user's profile image */
19
- uploadImage: () => Promise<void>;
19
+ uploadImage: () => Promise<unknown>;
20
20
  /** The function to call on success */
21
- onSuccess?: (data: IFormValues) => Promise<void>;
21
+ onSuccess?: (data: OnSuccessArgs) => Promise<void>;
22
22
  /** The function to call when the form is cancelled, e.g. the user presses a cancel button */
23
23
  onCancel?: () => void;
24
24
  /** The function to call on failure */
@@ -28,8 +28,13 @@ interface Props {
28
28
  /** The callback to fire when the tooltip is closed */
29
29
  onClose?: () => void;
30
30
  };
31
- /** Whether the tooltip is hidden from screen readers or not */
32
- 'aria-hidden'?: boolean;
31
+ /** Optional props for accessibility */
32
+ accessibility?: {
33
+ /** Whether this should use `hidden` on content, or if screenreaders should be able to access the full text, even when the tooltip is closed, e.g. for tooltips on buttons and pills */
34
+ readToScreenreadersWhenClosed?: boolean;
35
+ /** Whether the tooltip is hidden from screen readers or not */
36
+ 'aria-hidden'?: boolean;
37
+ };
33
38
  /** The id of the tooltip */
34
39
  id?: string;
35
40
  }
package/helpers/intl.d.ts CHANGED
@@ -38,9 +38,12 @@ export declare const checkIntlPathExists: (path: string, language?: {
38
38
  card_cta_event_done: string;
39
39
  card_cta_microcourse_done: string;
40
40
  carousel_pagination_previous: string;
41
+ carousel_pagination_previousSlide: string;
41
42
  carousel_pagination_next: string;
42
- carousel_pagination_page: string;
43
- carousel_pagination_aria_live: string;
43
+ carousel_pagination_nextSlide: string;
44
+ carousel_pagination_slide: string;
45
+ carousel_pagination_ariaLive: string;
46
+ carousel_pagination_ariaLive_slide: string;
44
47
  activitySection_notFoundError: string;
45
48
  activitiesFeed_sorting_label: string;
46
49
  activitiesFeed_rankingMethod_recent: string;
@@ -50,6 +53,7 @@ export declare const checkIntlPathExists: (path: string, language?: {
50
53
  communityDetails_viewAll: string;
51
54
  communityDetails_invite: string;
52
55
  community_joinToPost: string;
56
+ community_sortSuccess: string;
53
57
  joinCommunityButton: string;
54
58
  joinCommunityButton_short: string;
55
59
  joinCommunityButton_joining: string;