@apolitical/component-library 4.1.12-beta.4 → 4.1.12

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 (50) hide show
  1. package/accessibility/visually-hidden/visually-hidden.d.ts +0 -2
  2. package/constants/index.d.ts +0 -2
  3. package/discussion/components/form/form.d.ts +2 -9
  4. package/discussion/components/post/components/share-link/index.d.ts +1 -0
  5. package/discussion/components/post/components/share-link/share-link.d.ts +6 -0
  6. package/discussion/components/post/post.d.ts +2 -11
  7. package/discussion/components/post/post.helpers.d.ts +1 -2
  8. package/discussion/components/post/post.mock.d.ts +0 -3
  9. package/discussion/feeds/activities-feed/activities-feed.d.ts +0 -3
  10. package/discussion/feeds/replies-feed/index.d.ts +1 -1
  11. package/discussion/feeds/replies-feed/nested-replies-feed/nested-replies-feed.d.ts +2 -4
  12. package/discussion/feeds/replies-feed/replies-feed.d.ts +1 -3
  13. package/discussion/index.d.ts +0 -1
  14. package/discussion/sections/activity-section/activity-section.d.ts +1 -2
  15. package/form/components/rich-text-editor/components/context/context.d.ts +1 -3
  16. package/form/components/rich-text-editor/components/editor/index.d.ts +0 -1
  17. package/form/components/rich-text-editor/helpers/ast-types/ast-types.d.ts +1 -4
  18. package/form/components/rich-text-editor/helpers/index.d.ts +0 -1
  19. package/form/components/rich-text-editor/helpers/transform/transform.d.ts +3 -3
  20. package/form/components/rich-text-editor/index.d.ts +0 -1
  21. package/form/components/rich-text-editor/plugins/index.d.ts +0 -1
  22. package/form/components/rich-text-editor/rich-text-editor.d.ts +2 -10
  23. package/form/components/rich-text-editor/rich-text-editor.types.d.ts +2 -28
  24. package/general/buttons/button/button.d.ts +4 -0
  25. package/general/index.d.ts +0 -1
  26. package/helpers/cases.d.ts +0 -1
  27. package/helpers/index.d.ts +0 -1
  28. package/helpers/intl.d.ts +2 -1
  29. package/index.js +60 -60
  30. package/index.mjs +7492 -7765
  31. package/package.json +1 -1
  32. package/style.css +1 -1
  33. package/styles/base/buttons/_icons.scss +1 -0
  34. package/styles/variables/colors/theme/_discussion.scss +0 -1
  35. package/styles/variables/colors/theme/_form.scss +0 -1
  36. package/styles/variables/colors/theme/_general.scss +0 -3
  37. package/user/member/member.d.ts +2 -9
  38. package/constants/discussion.d.ts +0 -1
  39. package/constants/regex.d.ts +0 -1
  40. package/form/components/rich-text-editor/components/editor/mention-popover/index.d.ts +0 -1
  41. package/form/components/rich-text-editor/components/editor/mention-popover/mention-popover.d.ts +0 -2
  42. package/form/components/rich-text-editor/helpers/mentions/index.d.ts +0 -2
  43. package/form/components/rich-text-editor/helpers/mentions/insert-mention.d.ts +0 -5
  44. package/form/components/rich-text-editor/helpers/mentions/should-show-mentions-popover.d.ts +0 -5
  45. package/form/components/rich-text-editor/plugins/with-mentions/index.d.ts +0 -1
  46. package/form/components/rich-text-editor/plugins/with-mentions/with-mentions.d.ts +0 -6
  47. package/form/components/rich-text-editor/rich-text-editor.const.d.ts +0 -11
  48. package/general/popover/index.d.ts +0 -1
  49. package/general/popover/popover.d.ts +0 -11
  50. package/helpers/discussion.d.ts +0 -8
@@ -23,7 +23,6 @@ interface Props {
23
23
  /** Additional aria props */
24
24
  'aria-expanded'?: boolean;
25
25
  'aria-controls'?: string;
26
- 'aria-live'?: 'off' | 'polite' | 'assertive';
27
26
  }
28
27
  declare const _default: React.MemoExoticComponent<({ element, showOnFocus, children, className, ...props }: Props) => React.DetailedReactHTMLElement<{
29
28
  className: string;
@@ -43,6 +42,5 @@ declare const _default: React.MemoExoticComponent<({ element, showOnFocus, child
43
42
  /** Additional aria props */
44
43
  'aria-expanded'?: boolean | undefined;
45
44
  'aria-controls'?: string | undefined;
46
- 'aria-live'?: "off" | "polite" | "assertive" | undefined;
47
45
  }, HTMLElement>>;
48
46
  export default _default;
@@ -1,7 +1,5 @@
1
1
  export * from './assets';
2
2
  export * from './contact-details';
3
3
  export * from './courses';
4
- export * from './discussion';
5
4
  export * from './error-messages';
6
- export * from './regex';
7
5
  export * from './stats';
@@ -1,5 +1,4 @@
1
- import { type GetUsers } from '../../../form';
2
- import { DiscussionCreateContentFunction, IDiscussionContent, IMentions } from './../../discussion';
1
+ import { DiscussionCreateContentFunction, IDiscussionContent } from './../../discussion';
3
2
  export interface IDiscussionForm {
4
3
  /** A unique ID for the form */
5
4
  id?: string;
@@ -39,22 +38,16 @@ export interface IDiscussionForm {
39
38
  handleSaveEdit?: ((arg?: string) => Promise<void>) | (() => void);
40
39
  handleCancel?: () => void;
41
40
  callback?: (args: void) => void;
42
- getUsers?: GetUsers;
43
41
  props?: {
44
42
  create: {
45
43
  projectNames: ['questions-answers'];
46
44
  };
47
45
  };
48
46
  };
49
- /** Data to be passed into the rich text editor */
50
- data?: {
51
- /** Mentions data */
52
- mentions?: IMentions;
53
- };
54
47
  /** The context for GTM */
55
48
  gtmContext?: string;
56
49
  /** The language to use for the text */
57
50
  locale?: string;
58
51
  }
59
- declare const Form: ({ id, content, userHasPermissions, meta, placeholder, maxLength, forceShow, functions, data, gtmContext, }: IDiscussionForm) => import("react/jsx-runtime").JSX.Element;
52
+ declare const Form: ({ id, content, userHasPermissions, meta, placeholder, maxLength, forceShow, functions, gtmContext, }: IDiscussionForm) => import("react/jsx-runtime").JSX.Element;
60
53
  export default Form;
@@ -0,0 +1 @@
1
+ export { default as ShareLink } from './share-link';
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ url: string;
4
+ }
5
+ declare const ShareLink: React.FC<Props>;
6
+ export default ShareLink;
@@ -1,15 +1,10 @@
1
1
  import React from 'react';
2
- import { type GetUsers } from '../../../form';
3
2
  import { DiscussionCreateContentFunction, DiscussionCreateLikeFunction, DiscussionDeleteLikeFunction, IForceHide, IFullDiscussionContent } from '../../discussion';
4
- interface PostContent extends IFullDiscussionContent {
5
- /** The post body */
6
- postBody?: string;
7
- }
8
3
  interface Props {
9
4
  /** The element that will render around the content */
10
5
  element?: 'li' | 'div' | 'section' | 'article';
11
6
  /** Information about the content being posted */
12
- content: PostContent;
7
+ content: IFullDiscussionContent;
13
8
  /** If the user has permission to interact with the post box and content, e.g. if they're a member of the community */
14
9
  userHasPermissions?: boolean;
15
10
  /** If the post is still loading */
@@ -38,10 +33,6 @@ interface Props {
38
33
  /** Open comments on a post */
39
34
  openComments?: () => void;
40
35
  };
41
- mentions: {
42
- /** Get data to hydrate mentions */
43
- getUsers: GetUsers;
44
- };
45
36
  };
46
37
  /** Optional `href`s for the card to link to */
47
38
  links?: {
@@ -59,5 +50,5 @@ interface Props {
59
50
  /** If the post content is truncated */
60
51
  isTruncated?: boolean;
61
52
  }
62
- declare const Post: ({ element, content, userHasPermissions, isLoading, originalAuthorId, forceHide, functions: { content: { createContent, deleteContent, updateContent }, likes: { createLike, deleteLike }, comments: { openComments }, mentions: { getUsers }, }, links, className, gtmContext, children, isTruncated, }: Props) => import("react/jsx-runtime").JSX.Element;
53
+ declare const Post: ({ element, content, userHasPermissions, isLoading, originalAuthorId, forceHide, functions: { content: { createContent, deleteContent, updateContent }, likes: { createLike, deleteLike }, comments: { openComments }, }, links, className, gtmContext, children, isTruncated, }: Props) => import("react/jsx-runtime").JSX.Element;
63
54
  export default Post;
@@ -1,3 +1,2 @@
1
1
  import { IMentions } from './../../discussion';
2
- import { GetUsers } from '../../../form';
3
- export declare const getPostBody: (body: string, isTruncated: boolean, mentions?: IMentions, getUsers?: GetUsers) => Promise<string>;
2
+ export declare const getPostBody: (body: string, isTruncated: boolean, mentions?: IMentions) => string;
@@ -13,9 +13,6 @@ declare namespace _default {
13
13
  namespace comments {
14
14
  function openComments(): void;
15
15
  }
16
- namespace mentions {
17
- function getUsers(): Promise<never[]>;
18
- }
19
16
  }
20
17
  }
21
18
  export default _default;
@@ -1,6 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import type { IQueryFns } from './cache';
3
- import type { IMentionsFns } from './../replies-feed';
4
3
  interface Props {
5
4
  /** The base path, used for slugs */
6
5
  basePath: string;
@@ -12,8 +11,6 @@ interface Props {
12
11
  functions: {
13
12
  /** Query functions for the activities */
14
13
  activities: IQueryFns;
15
- /** Query functions for the mentions */
16
- mentions: IMentionsFns;
17
14
  /** Function to join the community */
18
15
  join: () => Promise<void>;
19
16
  /** Function to leave the community */
@@ -1,3 +1,3 @@
1
- export type { IQueryFns as IRepliesFeedQueryFns, IMentionsFns } from './cache';
1
+ export type { IQueryFns as IRepliesFeedQueryFns } from './cache';
2
2
  export { repliesFeedMock } from './mocks';
3
3
  export { default as RepliesFeed } from './replies-feed';
@@ -1,7 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { IQueryFns, IMentionsFns } from './../cache';
3
- interface NestedRepliesFunctions extends IQueryFns, IMentionsFns {
4
- }
2
+ import type { IQueryFns } from './../cache';
5
3
  interface Props {
6
4
  /** The base path, used for slugs */
7
5
  basePath: string;
@@ -14,7 +12,7 @@ interface Props {
14
12
  /** Whether the user is a member of the community */
15
13
  isMember: boolean;
16
14
  /** Functions for the replies query */
17
- functions: NestedRepliesFunctions;
15
+ functions: IQueryFns;
18
16
  }
19
17
  declare const NestedRepliesFeed: React.FC<Props>;
20
18
  export default NestedRepliesFeed;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { IQueryFns, IMentionsFns } from './cache';
2
+ import type { IQueryFns } from './cache';
3
3
  interface Props {
4
4
  /** The base path, used for slugs */
5
5
  basePath: string;
@@ -13,8 +13,6 @@ interface Props {
13
13
  functions: {
14
14
  /** Query functions for the replies */
15
15
  reactions: IQueryFns;
16
- /** Query functions for the mentions */
17
- mentions: IMentionsFns;
18
16
  /** Function to join the community */
19
17
  join: () => Promise<void>;
20
18
  /** Function to leave the community */
@@ -1,4 +1,3 @@
1
1
  export * from './components';
2
2
  export * from './feeds';
3
3
  export * from './sections';
4
- export type { IMentionData, IMentions } from './discussion.d';
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { IRepliesFeedQueryFns, IMentionsFns } from '../../../discussion/feeds';
2
+ import type { IRepliesFeedQueryFns } from '../../../discussion/feeds';
3
3
  import type { IQueryFns } from './cache';
4
4
  interface IActivitySectionQueryFns extends IQueryFns {
5
5
  remove: () => Promise<void>;
@@ -12,7 +12,6 @@ interface Props {
12
12
  functions: {
13
13
  activities: IActivitySectionQueryFns;
14
14
  reactions: IRepliesFeedQueryFns;
15
- mentions: IMentionsFns;
16
15
  join: () => Promise<void>;
17
16
  leave: () => Promise<void>;
18
17
  };
@@ -1,6 +1,6 @@
1
1
  import { Dispatch } from 'react';
2
2
  import { Point } from 'slate';
3
- import { ReportError, IMentionPopOver } from './../../rich-text-editor.types';
3
+ import { ReportError } from './../../rich-text-editor.types';
4
4
  declare const RichTextEditorContext: import("react").Context<{
5
5
  /** The id of the editor */
6
6
  id: string;
@@ -12,8 +12,6 @@ declare const RichTextEditorContext: import("react").Context<{
12
12
  openTooltip: string | null;
13
13
  /** Whether the link editor is open */
14
14
  showLinkEditor: boolean;
15
- /** The data for the mention popover, including if it's showing, the selected user for the popover, and the possible users */
16
- mentionPopover: IMentionPopOver;
17
15
  /** The last anchor point (used for Slate to know where the cursor is) */
18
16
  lastAnchor: Point | null;
19
17
  /** The function to update the state */
@@ -1,3 +1,2 @@
1
1
  export * from './element';
2
2
  export * from './leaf';
3
- export * from './mention-popover';
@@ -7,7 +7,6 @@ export interface NodeTypes {
7
7
  [Formatting.ul]: string;
8
8
  [Formatting.ol]: string;
9
9
  [Formatting.li]: string;
10
- [Formatting.mention]: string;
11
10
  [Formatting.heading]: {
12
11
  1: string;
13
12
  2: string;
@@ -29,7 +28,6 @@ export declare enum MdastNodes {
29
28
  list = "list",
30
29
  listItem = "listItem",
31
30
  link = "link",
32
- mention = "mention",
33
31
  image = "image",
34
32
  blockquote = "blockquote",
35
33
  code = "code",
@@ -41,7 +39,7 @@ export declare enum MdastNodes {
41
39
  thematicBreak = "thematicBreak",
42
40
  text = "text"
43
41
  }
44
- export type MdastNodeType = MdastNodes.paragraph | MdastNodes.heading | MdastNodes.list | MdastNodes.listItem | MdastNodes.link | MdastNodes.mention | MdastNodes.image | MdastNodes.blockquote | MdastNodes.code | MdastNodes.html | MdastNodes.emphasis | MdastNodes.strong | MdastNodes.delete | MdastNodes.inlineCode | MdastNodes.thematicBreak | MdastNodes.text;
42
+ export type MdastNodeType = MdastNodes.paragraph | MdastNodes.heading | MdastNodes.list | MdastNodes.listItem | MdastNodes.link | MdastNodes.image | MdastNodes.blockquote | MdastNodes.code | MdastNodes.html | MdastNodes.emphasis | MdastNodes.strong | MdastNodes.delete | MdastNodes.inlineCode | MdastNodes.thematicBreak | MdastNodes.text;
45
43
  export declare const defaultNodeTypes: NodeTypes;
46
44
  export interface LeafType {
47
45
  text: string;
@@ -55,7 +53,6 @@ export interface BlockType {
55
53
  type: string;
56
54
  parentType?: string;
57
55
  link?: string;
58
- mention?: string;
59
56
  caption?: string;
60
57
  language?: string;
61
58
  break?: boolean;
@@ -2,6 +2,5 @@ export * from './ast-types';
2
2
  export * from './deserialize';
3
3
  export * from './handle-text';
4
4
  export * from './hot-keys';
5
- export * from './mentions';
6
5
  export * from './serialize';
7
6
  export * from './transform';
@@ -7,12 +7,12 @@ export default function transform<T extends InputNodeTypes>(node: MdastNode, opt
7
7
  }[];
8
8
  } | {
9
9
  value?: string | undefined;
10
- alt?: string | undefined;
11
- url?: string | undefined;
12
10
  position?: any;
11
+ url?: string | undefined;
12
+ alt?: string | undefined;
13
13
  checked?: any;
14
14
  ordered?: boolean | undefined;
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,2 +1 @@
1
1
  export { default as RichTextEditor } from './rich-text-editor';
2
- export * from './rich-text-editor.types';
@@ -1,3 +1,2 @@
1
1
  export * from './with-linlines';
2
- export * from './with-mentions';
3
2
  export * from './without-empty-links';
@@ -1,5 +1,4 @@
1
- import type { IMentions } from '../../../discussion/discussion';
2
- import { GetUsers, ReportError } from './rich-text-editor.types';
1
+ import { ReportError } from './rich-text-editor.types';
3
2
  interface Props {
4
3
  /** The id of the rich text editor */
5
4
  id?: string;
@@ -11,8 +10,6 @@ interface Props {
11
10
  maxLength?: number;
12
11
  /** Optional functions */
13
12
  functions?: {
14
- /** An optional function to get a filtered list of members when the user starts typing a mention */
15
- getUsers?: GetUsers;
16
13
  /** An optional event handler, called when the rich text editor is changed */
17
14
  onChange?: (value: string) => void;
18
15
  /** An optional event handler, called when the rich text editor reports an error */
@@ -24,11 +21,6 @@ interface Props {
24
21
  'aria-invalid'?: boolean;
25
22
  /** Optional aria error message */
26
23
  'aria-errormessage'?: string;
27
- /** Optional data for the editor */
28
- data?: {
29
- /** Optional mentions */
30
- mentions?: IMentions;
31
- };
32
24
  }
33
- declare const RichTextEditor: ({ id, value, placeholder, maxLength, functions, autoFocus, data, ...props }: Props) => import("react/jsx-runtime").JSX.Element | null;
25
+ declare const RichTextEditor: ({ id, value, placeholder, maxLength, functions, autoFocus, ...props }: Props) => import("react/jsx-runtime").JSX.Element | null;
34
26
  export default RichTextEditor;
@@ -1,5 +1,4 @@
1
- import { BaseElement, BaseText, Descendant, Range } from 'slate';
2
- import type { MemberDetailsProps } from '../../../user';
1
+ import { BaseElement, BaseText, Descendant } from 'slate';
3
2
  export declare enum Formatting {
4
3
  blockquote = "block_quote",
5
4
  bold = "bold",
@@ -11,7 +10,6 @@ export declare enum Formatting {
11
10
  italic = "italic",
12
11
  li = "list_item",
13
12
  link = "link",
14
- mention = "mention",
15
13
  ol = "ol_list",
16
14
  paragraph = "paragraph",
17
15
  ul = "ul_list",
@@ -28,15 +26,10 @@ export interface BaseProps {
28
26
  className?: string;
29
27
  [key: string]: unknown;
30
28
  }
31
- export type BlockOptionType = Formatting.blockquote | Formatting.link | Formatting.li | Formatting.mention | Formatting.ol | Formatting.ul | Formatting.paragraph | Formatting.span;
29
+ export type BlockOptionType = Formatting.blockquote | Formatting.link | Formatting.li | Formatting.ol | Formatting.ul | Formatting.paragraph | Formatting.span;
32
30
  export interface TypeElement extends BaseElement {
33
31
  type: BlockOptionType;
34
32
  }
35
- export interface MentionElement extends BaseElement {
36
- type: Formatting.mention;
37
- id: string;
38
- name?: string;
39
- }
40
33
  export type MarkOptionType = Formatting.bold | Formatting.italic | Formatting.strikethrough;
41
34
  export interface TypeText extends BaseText {
42
35
  [Formatting.bold]?: boolean;
@@ -53,22 +46,3 @@ export type LinkElement = {
53
46
  children: Descendant[];
54
47
  };
55
48
  export type ReportError = (error: string) => void;
56
- export interface IMention {
57
- id: string;
58
- creator?: boolean;
59
- role?: string;
60
- createdAt?: string;
61
- updatedAt?: string;
62
- userId?: string;
63
- user: MemberDetailsProps;
64
- }
65
- export type GetUsers = ({ id, name, }: {
66
- id?: string;
67
- name?: string;
68
- }) => Promise<IMention[]>;
69
- export interface IMentionPopOver {
70
- show: boolean;
71
- selectedUser: number;
72
- possibleUsers: IMention[];
73
- position: Range | null;
74
- }
@@ -33,6 +33,10 @@ export interface ButtonPropsType {
33
33
  onBlur?: () => void;
34
34
  /** An optional function to call on keydown */
35
35
  onKeyDown?: (e: React.KeyboardEvent<HTMLElement>) => void;
36
+ /** An optional function to call on mouse over */
37
+ onMouseOver?: (e: React.MouseEvent<HTMLElement>) => void;
38
+ /** An optional function to call on mouse out */
39
+ onMouseOut?: (e: React.MouseEvent<HTMLElement>) => void;
36
40
  /** Additional classes to add to the button */
37
41
  className?: string;
38
42
  /** `disabled` is usually true or false, but we will want nuance in some places, for example the ability
@@ -2,7 +2,6 @@ export * from './buttons';
2
2
  export * from './divider';
3
3
  export * from './image-container';
4
4
  export * from './link';
5
- export * from './popover';
6
5
  export * from './portal';
7
6
  export * from './progress-tracker';
8
7
  export * from './responsive-image';
@@ -1,4 +1,3 @@
1
1
  export declare const camelCaseToDashCase: (str: string) => string;
2
2
  export declare const toCamelCase: (str?: string) => string;
3
3
  export declare const toSentenceCase: (str?: string) => string;
4
- export declare const toCapitalisedCase: (str?: string) => string;
@@ -4,7 +4,6 @@ export * from './cases';
4
4
  export * from './inline-styling';
5
5
  export * from './dates';
6
6
  export { default as delay } from './delay';
7
- export * from './discussion';
8
7
  export * from './in-development';
9
8
  export * from './intl';
10
9
  export * from './numbers';
package/helpers/intl.d.ts CHANGED
@@ -40,7 +40,6 @@ export declare const checkIntlPathExists: (path: string, language?: {
40
40
  carousel_pagination_previous: string;
41
41
  carousel_pagination_next: string;
42
42
  carousel_pagination_page: string;
43
- carousel_pagination_aria_live: string;
44
43
  activitySection_notFoundError: string;
45
44
  communityDetails_members: string;
46
45
  communityDetails_viewAll: string;
@@ -147,6 +146,8 @@ export declare const checkIntlPathExists: (path: string, language?: {
147
146
  discussion_responses_empty: string;
148
147
  discussion_responses_empty_answer: string;
149
148
  discussion_responses_placeholder: string;
149
+ discussion_share_copy_link: string;
150
+ discussion_share_copy_link_success: string;
150
151
  discussion_thread_show: string;
151
152
  discussion_thread_hide: string;
152
153
  discussion_thread_loadMore: string;