@apolitical/component-library 1.5.0 → 1.6.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.
Files changed (37) hide show
  1. package/communities/community-details/community-details.d.ts +11 -1
  2. package/communities/index.d.ts +1 -0
  3. package/communities/join-button/join-button.d.ts +3 -1
  4. package/communities/members-list/index.d.ts +1 -0
  5. package/communities/members-list/members-list.d.ts +23 -0
  6. package/discussion/likes/likes.d.ts +16 -6
  7. package/discussion/likes/likes.helpers.d.ts +2 -0
  8. package/discussion/post/post.d.ts +6 -3
  9. package/general/index.d.ts +1 -0
  10. package/general/link/link.d.ts +1 -1
  11. package/general/tooltip/index.d.ts +1 -0
  12. package/general/tooltip/tooltip.d.ts +11 -0
  13. package/helpers/index.d.ts +1 -0
  14. package/helpers/numbers.d.ts +1 -0
  15. package/hooks/index.d.ts +1 -0
  16. package/hooks/use-scroll-to-hash.d.ts +2 -0
  17. package/index.js +48 -48
  18. package/index.mjs +6885 -6734
  19. package/navigation/breadcrumbs/breadcrumbs.d.ts +16 -0
  20. package/navigation/breadcrumbs/index.d.ts +1 -0
  21. package/navigation/index.d.ts +1 -0
  22. package/navigation/load-more/index.d.ts +1 -0
  23. package/navigation/load-more/load-more.d.ts +7 -5
  24. package/package.json +1 -1
  25. package/style.css +1 -1
  26. package/styles/base/_links.scss +4 -1
  27. package/styles/base/_titles.scss +16 -0
  28. package/styles/base/buttons/_buttons.scss +52 -1
  29. package/styles/base/buttons/_icons.scss +1 -0
  30. package/styles/base/buttons/_sizes.scss +1 -0
  31. package/styles/variables/colors/_theme.scss +18 -2
  32. package/text/empty-state-box/empty-state-box.d.ts +3 -1
  33. package/text/pill/pill.d.ts +5 -1
  34. package/user/contributors/contributors.d.ts +5 -2
  35. package/user/contributors/contributors.mock.d.ts +8 -5
  36. package/user/member/index.d.ts +1 -1
  37. package/user/member/member.d.ts +15 -3
@@ -1,7 +1,17 @@
1
+ import { MemberProps } from '../../user';
1
2
  import { IJoinButtonProps } from './../join-button';
2
3
  interface Props extends IJoinButtonProps {
4
+ /** If the user is a member of the community */
5
+ isMember?: boolean;
6
+ /** The slug for the community */
7
+ slug: string;
8
+ /** Details about members in the community */
9
+ members?: {
10
+ number?: number | undefined;
11
+ data?: MemberProps[];
12
+ };
3
13
  /** Additional classes */
4
14
  className?: string;
5
15
  }
6
- declare const CommunityDetails: ({ className, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
16
+ declare const CommunityDetails: ({ isMember, slug, members: { number, data: members }, className, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
7
17
  export default CommunityDetails;
@@ -1,2 +1,3 @@
1
1
  export * from './community-details';
2
2
  export * from './join-button';
3
+ export * from './members-list';
@@ -1,6 +1,8 @@
1
1
  export interface IJoinButtonProps {
2
2
  /** If the user is a member of the community */
3
3
  isMember?: boolean;
4
+ /** If the button should use the short version of the text */
5
+ isShort?: boolean;
4
6
  /** The function to call when the user clicks the button */
5
7
  functions?: {
6
8
  /** The function to request to join */
@@ -11,5 +13,5 @@ export interface IJoinButtonProps {
11
13
  /** The language to use */
12
14
  locale?: string;
13
15
  }
14
- declare const JoinButton: ({ isMember: userIsMember, functions: { join, leave } }: IJoinButtonProps) => import("react/jsx-runtime").JSX.Element;
16
+ declare const JoinButton: ({ isMember: userIsMember, isShort, functions: { join, leave } }: IJoinButtonProps) => import("react/jsx-runtime").JSX.Element;
15
17
  export default JoinButton;
@@ -0,0 +1 @@
1
+ export { default as MembersList } from './members-list';
@@ -0,0 +1,23 @@
1
+ import { PaginationType } from '../../navigation';
2
+ import { MemberDetailsProps } from '../../user';
3
+ interface CommunityMemberProps extends MemberDetailsProps {
4
+ /** Whether the user is an admin of the community or not */
5
+ isAdmin?: boolean;
6
+ }
7
+ interface Props {
8
+ /** Details about members in the community */
9
+ members: {
10
+ total?: number | undefined;
11
+ data?: CommunityMemberProps[];
12
+ };
13
+ /** Details for the pagination */
14
+ pagination?: PaginationType;
15
+ /** The GTM context to use */
16
+ gtmContext?: string;
17
+ /** The GTM event to use */
18
+ gtmType?: string;
19
+ /** Additional classes */
20
+ className?: string;
21
+ }
22
+ declare const MembersList: ({ members: { total, data: members }, pagination, gtmContext, gtmType, className, }: Props) => import("react/jsx-runtime").JSX.Element | null;
23
+ export default MembersList;
@@ -1,10 +1,13 @@
1
1
  import React from 'react';
2
+ import { MemberProps } from '../../user';
2
3
  import { IDiscussionContent } from './../discussion';
3
4
  interface Props {
4
5
  /** The element to render around the content */
5
- element?: 'span' | 'p' | 'li' | 'div';
6
+ element?: 'li' | 'div';
6
7
  /** The number of likes the content has had */
7
8
  likes?: number;
9
+ /** Information about the people who have liked the content */
10
+ peopleWhoLiked?: false | MemberProps[];
8
11
  /** If we should display the short version */
9
12
  isShort?: boolean;
10
13
  /** Whether the user has liked the content */
@@ -13,16 +16,23 @@ interface Props {
13
16
  content?: IDiscussionContent;
14
17
  /** If the user is able to like the content (e.g. they can't like their own content) */
15
18
  canLike?: boolean;
16
- /** Function to create a like */
17
- createLike?: (args1: object, args2: object) => void;
18
- /** Function to delete a like */
19
- deleteLike?: (args: object) => void;
19
+ /** Functions to handle liking and unliking */
20
+ functions?: {
21
+ /** Function to create a like */
22
+ createLike?: (args1: object, args2: object) => void;
23
+ /** Function to delete a like */
24
+ deleteLike?: (args: object) => void;
25
+ };
20
26
  /** The language to use for the text */
21
27
  locale?: string;
22
28
  }
23
- declare const Likes: ({ element, likes, isShort, userLiked, content, canLike, createLike, deleteLike, }: Props) => React.DetailedReactHTMLElement<{
29
+ declare const Likes: ({ element, likes, peopleWhoLiked, isShort, userLiked, content, canLike, functions: { createLike, deleteLike } }: Props) => React.DetailedReactHTMLElement<{
24
30
  className: string;
25
31
  onClick: (e: React.MouseEvent<HTMLElement>) => false | undefined;
32
+ onMouseEnter: () => void;
33
+ onMouseLeave: () => void;
34
+ onFocus: () => void;
35
+ onBlur: () => void;
26
36
  children: import("react/jsx-runtime").JSX.Element;
27
37
  }, HTMLElement>;
28
38
  export default Likes;
@@ -1,3 +1,4 @@
1
+ import { MemberProps } from '../../user';
1
2
  export declare const createSlugsPayload: ({ question, answer, reply, }: {
2
3
  question?: string | undefined;
3
4
  answer?: string | undefined;
@@ -7,3 +8,4 @@ export declare const createSlugsPayload: ({ question, answer, reply, }: {
7
8
  answerSlug?: string | undefined;
8
9
  questionSlug?: string | undefined;
9
10
  };
11
+ export declare const getTooltipContent: (peopleWhoLiked: false | MemberProps[], cutoff?: number) => MemberProps[];
@@ -30,8 +30,11 @@ interface Props {
30
30
  openComments: () => void;
31
31
  };
32
32
  };
33
- /** Optional `href` for the card to link to */
34
- link?: string;
33
+ /** Optional `href`s for the card to link to */
34
+ links?: {
35
+ post?: string;
36
+ comments?: string;
37
+ };
35
38
  /** Additional classes */
36
39
  className?: string;
37
40
  /** The GTM context */
@@ -41,5 +44,5 @@ interface Props {
41
44
  /** The language for the text */
42
45
  locale?: string;
43
46
  }
44
- declare const Post: ({ element, content, isLoading, originalAuthorId, functions: { content: { createContent, deleteContent, updateContent }, likes: { createLike, deleteLike }, comments: { openComments }, }, link, className, gtmContext, locale, children, }: Props) => import("react/jsx-runtime").JSX.Element;
47
+ declare const Post: ({ element, content, isLoading, originalAuthorId, functions: { content: { createContent, deleteContent, updateContent }, likes: { createLike, deleteLike }, comments: { openComments }, }, links, className, gtmContext, locale, children, }: Props) => import("react/jsx-runtime").JSX.Element;
45
48
  export default Post;
@@ -2,3 +2,4 @@ export * from './buttons';
2
2
  export * from './divider';
3
3
  export * from './link';
4
4
  export * from './responsive-image';
5
+ export * from './tooltip';
@@ -7,7 +7,7 @@ interface Props {
7
7
  /** Additonal classes */
8
8
  className?: string;
9
9
  /** Function to be called when clicked */
10
- onClick?: (e?: React.MouseEvent<HTMLElement>) => void;
10
+ onClick?: ((e?: React.MouseEvent<HTMLElement>) => void) | undefined;
11
11
  /** GTM event context */
12
12
  gtmContext?: string;
13
13
  /** GTM event type */
@@ -0,0 +1 @@
1
+ export { default as Tooltip } from './tooltip';
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ /** If the tooltip is open or not */
4
+ isOpen?: boolean;
5
+ /** If the content is loading or not */
6
+ isLoading?: boolean;
7
+ /** The content to show in the tooltip */
8
+ children?: React.ReactNode | JSX.Element | string;
9
+ }
10
+ declare const Tooltip: ({ isOpen, isLoading, children }: Props) => import("react/jsx-runtime").JSX.Element;
11
+ export default Tooltip;
@@ -3,5 +3,6 @@ export * from './breakpoints';
3
3
  export * from './dates';
4
4
  export { default as delay } from './delay';
5
5
  export * from './intl';
6
+ export * from './numbers';
6
7
  export { default as passPropsToChildren } from './pass-props-to-children';
7
8
  export * from './validation';
@@ -0,0 +1 @@
1
+ export declare const shortenNumber: (number: number, decimalPlaces?: number, abbreviations?: string[]) => string;
package/hooks/index.d.ts CHANGED
@@ -2,3 +2,4 @@ export { default as useEffectAfterMount } from './use-effect-after-mount';
2
2
  export { default as useFeatureFlag } from './use-feature-flag';
3
3
  export { default as useScreenWidth } from './use-screen-width';
4
4
  export { default as useScrollListener } from './use-scroll-listener';
5
+ export { default as useScrollToHash } from './use-scroll-to-hash';
@@ -0,0 +1,2 @@
1
+ declare function _default(dependencies?: any[], isSmooth?: boolean): void;
2
+ export default _default;