@apolitical/component-library 4.8.4-SW.0 → 4.8.4

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 (55) hide show
  1. package/cards/card-block/card-block.d.ts +2 -2
  2. package/cards/card-block/index.d.ts +0 -1
  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 +0 -1
  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/types/profile-form/profile-form.d.ts +3 -3
  25. package/index.js +61 -61
  26. package/index.mjs +7028 -6866
  27. package/layout/content-layout/columns/columns.d.ts +2 -2
  28. package/layout/content-layout/columns/index.d.ts +0 -1
  29. package/navigation/load-more/index.d.ts +1 -1
  30. package/navigation/load-more/load-more.d.ts +3 -3
  31. package/navigation/tabs/index.d.ts +0 -1
  32. package/navigation/tabs/tabs.d.ts +6 -6
  33. package/package.json +1 -1
  34. package/sections/edit-section/edit-section.d.ts +2 -2
  35. package/sections/edit-section/index.d.ts +0 -1
  36. package/style.css +1 -1
  37. package/styles/variables/colors/theme/_user.scss +6 -0
  38. package/text/empty-state-box/empty-state-box.d.ts +2 -2
  39. package/text/empty-state-box/index.d.ts +0 -1
  40. package/text/hide-show-text-box/hide-show-text-box.d.ts +2 -2
  41. package/text/hide-show-text-box/index.d.ts +0 -1
  42. package/text/highlighted-text-box/highlighted-text-box.d.ts +2 -2
  43. package/text/highlighted-text-box/index.d.ts +0 -1
  44. package/user/badge/badge.d.ts +7 -0
  45. package/user/badge/icon-mapping.d.ts +11 -0
  46. package/user/badge/index.d.ts +2 -0
  47. package/user/badge/interface/badge.interfaces.d.ts +9 -0
  48. package/user/badges/badges.d.ts +12 -0
  49. package/user/badges/badges.interface.d.ts +10 -0
  50. package/user/badges/index.d.ts +2 -0
  51. package/user/member/member.d.ts +7 -1
  52. package/user/member/member.helpers.d.ts +2 -0
  53. package/user/member/member.mock.d.ts +8 -0
  54. package/user/profile-picture/index.d.ts +0 -1
  55. package/user/profile-picture/profile-picture.d.ts +2 -2
@@ -3,6 +3,12 @@
3
3
 
4
4
  $c: $default-colors;
5
5
  $user: (
6
+ badge_bg: get-map($c, 'n200'),
7
+ badge_bg_blue: #a2daf9,
8
+ badge_bg_green: #a4f9a2,
9
+ badge_bg_pink: #fae1f5,
10
+ badge_bg_purple: #e2e1fa,
11
+ badge_bg_orange: #f9dba2,
6
12
  contributor: get-map($c, 'n700'),
7
13
  contributor_bg: get-map($c, 'white'),
8
14
  contributor_medium_bg: get-map($c, 'n200'),
@@ -7,7 +7,7 @@ interface ButtonType extends ButtonPropsType {
7
7
  };
8
8
  component?: React.ReactNode;
9
9
  }
10
- export interface IEmptyStateBoxProps {
10
+ interface Props {
11
11
  /** Box styling */
12
12
  variant?: 'empty' | 'error';
13
13
  /** Optional text */
@@ -17,5 +17,5 @@ export interface IEmptyStateBoxProps {
17
17
  /** Additional classes */
18
18
  className?: string;
19
19
  }
20
- declare const EmptyStateBox: ({ variant, text, button, className, }: IEmptyStateBoxProps) => import("react/jsx-runtime").JSX.Element;
20
+ declare const EmptyStateBox: ({ variant, text, button, className, }: Props) => import("react/jsx-runtime").JSX.Element;
21
21
  export default EmptyStateBox;
@@ -1,2 +1 @@
1
- export type { IEmptyStateBoxProps } from './empty-state-box';
2
1
  export { default as EmptyStateBox } from './empty-state-box';
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { MarkdownToJSX } from 'markdown-to-jsx';
3
- export interface IHideShowTextBoxProps {
3
+ interface Props {
4
4
  /** The language for the box text */
5
5
  locale?: string;
6
6
  /** An optional id for the box */
@@ -18,5 +18,5 @@ export interface IHideShowTextBoxProps {
18
18
  markdownOptions?: MarkdownToJSX.Options;
19
19
  children?: React.ReactNode;
20
20
  }
21
- declare const HideShowTextBox: ({ id, className, show, hide, text, markdownOptions, fadeStyle, children, }: IHideShowTextBoxProps) => import("react/jsx-runtime").JSX.Element;
21
+ declare const HideShowTextBox: ({ id, className, show, hide, text, markdownOptions, fadeStyle, children, }: Props) => import("react/jsx-runtime").JSX.Element;
22
22
  export default HideShowTextBox;
@@ -1,2 +1 @@
1
- export type { IHideShowTextBoxProps } from './hide-show-text-box';
2
1
  export { default as HideShowTextBox } from './hide-show-text-box';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export interface IHighlightedTextBoxProps {
2
+ interface Props {
3
3
  /** The style of box being rendered */
4
4
  variant?: 'primary' | 'secondary' | 'tertiary' | 'quaternary' | 'subtle' | 'subtle-alt' | 'bold' | 'muted';
5
5
  /** The name of an icon file to display at the top */
@@ -18,5 +18,5 @@ export interface IHighlightedTextBoxProps {
18
18
  /** Additional props to pass to the box */
19
19
  style?: React.CSSProperties;
20
20
  }
21
- declare const HighlightedTextBoxWrapper: ({ variant, icon, styling, className, children, ...props }: IHighlightedTextBoxProps) => import("react/jsx-runtime").JSX.Element;
21
+ declare const HighlightedTextBoxWrapper: ({ variant, icon, styling, className, children, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
22
22
  export default HighlightedTextBoxWrapper;
@@ -1,2 +1 @@
1
- export type { IHighlightedTextBoxProps } from './highlighted-text-box';
2
1
  export { default as HighlightedTextBox } from './highlighted-text-box';
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ /** The slug of the badge */
4
+ slug: string;
5
+ }
6
+ declare const Badge: React.FC<Props>;
7
+ export default Badge;
@@ -0,0 +1,11 @@
1
+ export interface IconMapping {
2
+ [key: string]: string;
3
+ }
4
+ declare const iconMapping: {
5
+ globe: string;
6
+ heart: string;
7
+ pencil: string;
8
+ star: string;
9
+ 'speech-bubble': string;
10
+ };
11
+ export default iconMapping;
@@ -0,0 +1,2 @@
1
+ export { default as Badge } from './badge';
2
+ export { BadgeScope, type IBadgesObject } from './interface/badge.interfaces';
@@ -0,0 +1,9 @@
1
+ export declare enum BadgeScope {
2
+ COMMUNITIES = "communities",
3
+ PLATFORM = "platform"
4
+ }
5
+ export type IBadgesObject = {
6
+ [key in BadgeScope.PLATFORM | BadgeScope.COMMUNITIES]: {
7
+ [key: string]: string[];
8
+ };
9
+ };
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { IBadgesOption } from './badges.interface';
3
+ import { IBadgesObject } from '../badge/interface/badge.interfaces';
4
+ interface Props {
5
+ element?: 'span' | 'div';
6
+ /** The user badges */
7
+ userBadges: IBadgesObject;
8
+ /** The badge options */
9
+ badgeOptions: IBadgesOption;
10
+ }
11
+ declare const Badges: React.FC<Props>;
12
+ export default Badges;
@@ -0,0 +1,10 @@
1
+ import { BadgeScope } from '../badge/interface/badge.interfaces';
2
+ export interface IBadgesOption {
3
+ showBadges?: boolean;
4
+ scope?: BadgeScope.PLATFORM | BadgeScope.COMMUNITIES;
5
+ area?: string;
6
+ scopes?: {
7
+ scope: BadgeScope.PLATFORM | BadgeScope.COMMUNITIES;
8
+ area: string;
9
+ }[];
10
+ }
@@ -0,0 +1,2 @@
1
+ export { default as Badges } from './badges';
2
+ export type { IBadgesOption } from './badges.interface';
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
2
  import { type IProfileFormProps } from '../../form';
3
+ import { IBadgesObject } from '../badge';
4
+ import { IBadgesOption } from '../badges';
3
5
  export type MemberDetailsProps = {
4
6
  /** The user's unique ID */
5
7
  id?: string;
@@ -22,6 +24,8 @@ export type MemberDetailsProps = {
22
24
  };
23
25
  /** An error, shown if the user doesn't exist */
24
26
  error?: string;
27
+ /** The user's badges */
28
+ badges?: IBadgesObject;
25
29
  };
26
30
  export type MemberProps = 'apolitical' | 'community' | 'deleted' | MemberDetailsProps;
27
31
  interface Props {
@@ -36,6 +40,8 @@ interface Props {
36
40
  createdAt?: Date | string;
37
41
  didEdit?: boolean;
38
42
  };
43
+ /** Whether to show badges and the scope of the badge */
44
+ badges?: IBadgesOption;
39
45
  /** Optional styling */
40
46
  styling?: {
41
47
  /** The size of the component */
@@ -61,7 +67,7 @@ interface Props {
61
67
  /** Additional classes */
62
68
  className?: string;
63
69
  }
64
- declare const Member: ({ element, member: memberDetails, alt, additionalContent, styling, functions, gtmContext, gtmType, className, ...props }: Props) => React.DetailedReactHTMLElement<{
70
+ declare const Member: ({ element, member: memberDetails, alt, additionalContent, styling, functions, gtmContext, gtmType, className, badges, ...props }: Props) => React.DetailedReactHTMLElement<{
65
71
  children: import("react/jsx-runtime").JSX.Element;
66
72
  /** Optional onclick function */
67
73
  onClick?: ((e: React.MouseEvent) => void) | undefined;
@@ -6,6 +6,7 @@ export declare const getMember: (member: MemberProps) => {
6
6
  organisation?: undefined;
7
7
  country?: undefined;
8
8
  url?: undefined;
9
+ badges?: undefined;
9
10
  } | {
10
11
  name: string | undefined;
11
12
  role: string;
@@ -13,6 +14,7 @@ export declare const getMember: (member: MemberProps) => {
13
14
  country: string;
14
15
  url: string;
15
16
  image: string | undefined;
17
+ badges: import("../badge").IBadgesObject | undefined;
16
18
  };
17
19
  export declare const getUserDetails: ({ role, organisation, country, maximumCharacters, }: {
18
20
  role?: string | undefined;
@@ -9,5 +9,13 @@ declare const _default: {
9
9
  image: {
10
10
  thumbnail: string;
11
11
  };
12
+ badges: {
13
+ platform: {
14
+ all: string[];
15
+ };
16
+ communities: {
17
+ 'community-slug': string[];
18
+ };
19
+ };
12
20
  };
13
21
  export default _default;
@@ -1,2 +1 @@
1
- export type { IProfilePictureProps } from './profile-picture';
2
1
  export { default as ProfilePicture } from './profile-picture';
@@ -1,4 +1,4 @@
1
- export interface IProfilePictureProps {
1
+ interface Props {
2
2
  /** The user's name, to create initials */
3
3
  name: string;
4
4
  /** The user's image */
@@ -16,5 +16,5 @@ export interface IProfilePictureProps {
16
16
  /** Optional test ID */
17
17
  'data-testid'?: string;
18
18
  }
19
- declare const ProfilePicture: ({ className, src, name, alt, width, height, showInitials, ...props }: IProfilePictureProps) => import("react/jsx-runtime").JSX.Element;
19
+ declare const ProfilePicture: ({ className, src, name, alt, width, height, showInitials, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
20
20
  export default ProfilePicture;