@apolitical/component-library 4.5.3 → 4.5.5
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/discussion/components/form/form.type.d.ts +2 -1
- package/discussion/components/post/post.d.ts +3 -1
- package/form/components/rich-text-editor/components/editor/mention-popover/mention-popover.d.ts +4 -1
- package/form/components/rich-text-editor/helpers/mentions/should-show-mentions-popover.d.ts +7 -1
- package/form/components/rich-text-editor/rich-text-editor.d.ts +4 -2
- package/form/components/rich-text-editor/rich-text-editor.types.d.ts +2 -0
- package/helpers/intl.d.ts +1 -0
- package/index.js +32 -32
- package/index.mjs +4128 -4066
- package/package.json +1 -1
- package/style.css +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ListMembers } from '../../../form';
|
|
1
|
+
import { type ListMembers, ClickMentionFallback } from '../../../form';
|
|
2
2
|
import { DiscussionCreateContentFunction, IDiscussionContent, IMentions } from './../../discussion';
|
|
3
3
|
export interface IDiscussionFormMeta {
|
|
4
4
|
/** Whether the form data is still loading */
|
|
@@ -69,6 +69,7 @@ export interface IDiscussionForm {
|
|
|
69
69
|
handleCancel?: () => void;
|
|
70
70
|
callback?: (args: void) => void;
|
|
71
71
|
listMembers?: ListMembers;
|
|
72
|
+
clickMentionFallback?: ClickMentionFallback;
|
|
72
73
|
props?: {
|
|
73
74
|
create: {
|
|
74
75
|
projectNames: ['questions-answers'];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type ListMembers } from '../../../form';
|
|
2
|
+
import { type ListMembers, ClickMentionFallback } from '../../../form';
|
|
3
3
|
import { DiscussionCreateContentFunction, DiscussionCreateLikeFunction, DiscussionDeleteLikeFunction, IForceHide, IFullDiscussionContent } from '../../discussion';
|
|
4
4
|
interface PostContent extends IFullDiscussionContent {
|
|
5
5
|
/** The post body */
|
|
@@ -41,6 +41,8 @@ interface Props {
|
|
|
41
41
|
mentions: {
|
|
42
42
|
/** Get data to hydrate mentions */
|
|
43
43
|
listMembers: ListMembers;
|
|
44
|
+
/** Function to call when clicking mention fallback */
|
|
45
|
+
clickMentionFallback: ClickMentionFallback;
|
|
44
46
|
};
|
|
45
47
|
};
|
|
46
48
|
/** Optional `href`s for the card to link to */
|
package/form/components/rich-text-editor/components/editor/mention-popover/mention-popover.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ClickMentionFallback } from '../../../../../../form';
|
|
2
|
+
declare const MentionPopover: ({ onFallbackClick, }: {
|
|
3
|
+
onFallbackClick?: ClickMentionFallback | undefined;
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
2
5
|
export default MentionPopover;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { Dispatch } from 'react';
|
|
2
2
|
import { BaseEditor } from 'slate';
|
|
3
3
|
import { type ListMembers } from './../../rich-text-editor.types';
|
|
4
|
-
declare const shouldShowMentionsPopover: (editor
|
|
4
|
+
declare const shouldShowMentionsPopover: ({ editor, isShowing, numberOfUsers, listMembers, dispatch, }: {
|
|
5
|
+
editor: BaseEditor;
|
|
6
|
+
isShowing: boolean;
|
|
7
|
+
numberOfUsers: number | null;
|
|
8
|
+
listMembers: ListMembers | undefined;
|
|
9
|
+
dispatch: Dispatch<any>;
|
|
10
|
+
}) => Promise<void>;
|
|
5
11
|
export default shouldShowMentionsPopover;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IMentions } from '../../../discussion/discussion';
|
|
2
|
-
import { ListMembers, ReportError } from './rich-text-editor.types';
|
|
2
|
+
import { ListMembers, ReportError, ClickMentionFallback } from './rich-text-editor.types';
|
|
3
3
|
interface Props {
|
|
4
4
|
/** The id of the rich text editor */
|
|
5
5
|
id?: string;
|
|
@@ -18,6 +18,8 @@ interface Props {
|
|
|
18
18
|
functions?: {
|
|
19
19
|
/** An optional function to get a filtered list of members when the user starts typing a mention */
|
|
20
20
|
listMembers?: ListMembers;
|
|
21
|
+
/** An optional function to call when the user clicks the mention fallback, e.g. to show an invite modal */
|
|
22
|
+
clickMentionFallback?: ClickMentionFallback;
|
|
21
23
|
/** An optional event handler, called when the rich text editor is changed */
|
|
22
24
|
onChange?: (value: string) => void;
|
|
23
25
|
/** An optional event handler, called when the rich text editor reports an error */
|
|
@@ -35,5 +37,5 @@ interface Props {
|
|
|
35
37
|
mentions?: IMentions;
|
|
36
38
|
};
|
|
37
39
|
}
|
|
38
|
-
declare const RichTextEditor: ({ id, value, placeholder, maxLength, meta, functions, autoFocus, data, ...props }: Props) => import("react/jsx-runtime").JSX.Element
|
|
40
|
+
declare const RichTextEditor: ({ id, value, placeholder, maxLength, meta, functions, autoFocus, data, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
39
41
|
export default RichTextEditor;
|
|
@@ -64,9 +64,11 @@ export interface IMention {
|
|
|
64
64
|
user: MemberDetailsProps;
|
|
65
65
|
}
|
|
66
66
|
export type ListMembers = ({ id, name }: IListMemberData) => Promise<IMention[]>;
|
|
67
|
+
export type ClickMentionFallback = () => void;
|
|
67
68
|
export interface IMentionPopOver {
|
|
68
69
|
show: boolean;
|
|
69
70
|
selectedUser: number;
|
|
70
71
|
possibleUsers: IMention[];
|
|
71
72
|
position: Range | null;
|
|
73
|
+
numberOfUsers: number | null;
|
|
72
74
|
}
|
package/helpers/intl.d.ts
CHANGED
|
@@ -252,6 +252,7 @@ export declare const checkIntlPathExists: (path: string, language?: {
|
|
|
252
252
|
richTextEditor_ol_list: string;
|
|
253
253
|
richTextEditor_ul_list: string;
|
|
254
254
|
richTextEditor_block_quote: string;
|
|
255
|
+
richTextEditor_mention_fallback: string;
|
|
255
256
|
search_label: string;
|
|
256
257
|
search_placeholder: string;
|
|
257
258
|
search_clear: string;
|