@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.
- package/accessibility/visually-hidden/visually-hidden.d.ts +0 -2
- package/constants/index.d.ts +0 -2
- package/discussion/components/form/form.d.ts +2 -9
- package/discussion/components/post/components/share-link/index.d.ts +1 -0
- package/discussion/components/post/components/share-link/share-link.d.ts +6 -0
- package/discussion/components/post/post.d.ts +2 -11
- package/discussion/components/post/post.helpers.d.ts +1 -2
- package/discussion/components/post/post.mock.d.ts +0 -3
- package/discussion/feeds/activities-feed/activities-feed.d.ts +0 -3
- package/discussion/feeds/replies-feed/index.d.ts +1 -1
- package/discussion/feeds/replies-feed/nested-replies-feed/nested-replies-feed.d.ts +2 -4
- package/discussion/feeds/replies-feed/replies-feed.d.ts +1 -3
- package/discussion/index.d.ts +0 -1
- package/discussion/sections/activity-section/activity-section.d.ts +1 -2
- package/form/components/rich-text-editor/components/context/context.d.ts +1 -3
- package/form/components/rich-text-editor/components/editor/index.d.ts +0 -1
- package/form/components/rich-text-editor/helpers/ast-types/ast-types.d.ts +1 -4
- package/form/components/rich-text-editor/helpers/index.d.ts +0 -1
- package/form/components/rich-text-editor/helpers/transform/transform.d.ts +3 -3
- package/form/components/rich-text-editor/index.d.ts +0 -1
- package/form/components/rich-text-editor/plugins/index.d.ts +0 -1
- package/form/components/rich-text-editor/rich-text-editor.d.ts +2 -10
- package/form/components/rich-text-editor/rich-text-editor.types.d.ts +2 -28
- package/general/buttons/button/button.d.ts +4 -0
- package/general/index.d.ts +0 -1
- package/helpers/cases.d.ts +0 -1
- package/helpers/index.d.ts +0 -1
- package/helpers/intl.d.ts +2 -1
- package/index.js +60 -60
- package/index.mjs +7492 -7765
- package/package.json +1 -1
- package/style.css +1 -1
- package/styles/base/buttons/_icons.scss +1 -0
- package/styles/variables/colors/theme/_discussion.scss +0 -1
- package/styles/variables/colors/theme/_form.scss +0 -1
- package/styles/variables/colors/theme/_general.scss +0 -3
- package/user/member/member.d.ts +2 -9
- package/constants/discussion.d.ts +0 -1
- package/constants/regex.d.ts +0 -1
- package/form/components/rich-text-editor/components/editor/mention-popover/index.d.ts +0 -1
- package/form/components/rich-text-editor/components/editor/mention-popover/mention-popover.d.ts +0 -2
- package/form/components/rich-text-editor/helpers/mentions/index.d.ts +0 -2
- package/form/components/rich-text-editor/helpers/mentions/insert-mention.d.ts +0 -5
- package/form/components/rich-text-editor/helpers/mentions/should-show-mentions-popover.d.ts +0 -5
- package/form/components/rich-text-editor/plugins/with-mentions/index.d.ts +0 -1
- package/form/components/rich-text-editor/plugins/with-mentions/with-mentions.d.ts +0 -6
- package/form/components/rich-text-editor/rich-text-editor.const.d.ts +0 -11
- package/general/popover/index.d.ts +0 -1
- package/general/popover/popover.d.ts +0 -11
- 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;
|
package/constants/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
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,
|
|
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';
|
|
@@ -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:
|
|
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 },
|
|
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
|
-
|
|
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;
|
|
@@ -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,7 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { IQueryFns
|
|
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:
|
|
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
|
|
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 */
|
package/discussion/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { IRepliesFeedQueryFns
|
|
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
|
|
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 */
|
|
@@ -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.
|
|
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;
|
|
@@ -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 |
|
|
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,4 @@
|
|
|
1
|
-
import
|
|
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,
|
|
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
|
|
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.
|
|
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
|
package/general/index.d.ts
CHANGED
package/helpers/cases.d.ts
CHANGED
package/helpers/index.d.ts
CHANGED
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;
|