@apolitical/component-library 4.5.6-beta.0 → 4.5.7-beta.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.
@@ -1,4 +1,18 @@
1
1
  import { type IDiscussionForm } from './../form';
2
+ import { IMentions } from './../../discussion.d';
3
+ export interface CachedText {
4
+ /** Whether the cached text should show on the form card; this is false by default
5
+ * to prevent the text changing right away and distracting the user */
6
+ showCachedText: boolean;
7
+ /** The cached title text */
8
+ title?: string;
9
+ /** The cached body text */
10
+ body?: string;
11
+ /** The cached mention data */
12
+ mentions?: IMentions;
13
+ /** Pretty version of the text, for use as launch text */
14
+ prettifiedText?: string;
15
+ }
2
16
  interface Props {
3
17
  /** Force elements to show */
4
18
  forceShow?: {
@@ -1 +1,2 @@
1
1
  export { default as DiscussionFormCard } from './discussion-form-card';
2
+ export type { CachedText } from './discussion-form-card';
@@ -1,5 +1,5 @@
1
1
  import { type ListMembers, ClickMentionFallback } from '../../../form';
2
- import { DiscussionCreateContentFunction, IDiscussionContent, IMentions } from './../../discussion';
2
+ import { DiscussionCreateContentFunction, IDiscussionContent, IListMemberData, IMentions } from './../../discussion';
3
3
  export interface IDiscussionFormMeta {
4
4
  /** Whether the form data is still loading */
5
5
  isLoading?: boolean;
@@ -61,6 +61,9 @@ export interface IDiscussionForm {
61
61
  };
62
62
  /** The functions that are passed in to handle the functionality */
63
63
  functions: {
64
+ onChange?: (args: {
65
+ [key: string]: string | boolean;
66
+ }) => void;
64
67
  create: DiscussionCreateContentFunction;
65
68
  handleSaveEdit?: (({ title, body }: {
66
69
  title: string;
@@ -68,6 +71,7 @@ export interface IDiscussionForm {
68
71
  }) => Promise<void>) | (() => void);
69
72
  handleCancel?: () => void;
70
73
  callback?: (args: void) => void;
74
+ onMention?: (value?: IListMemberData) => void;
71
75
  listMembers?: ListMembers;
72
76
  clickMentionFallback?: ClickMentionFallback;
73
77
  props?: {
@@ -1 +1,2 @@
1
1
  export { default as DiscussionPost } from './post';
2
+ export { getPostBody } from './post.helpers';
@@ -1,3 +1,3 @@
1
1
  import { IMentions } from './../../discussion';
2
2
  import { ListMembers } from '../../../form';
3
- export declare const getPostBody: (body: string, isTruncated: boolean, mentions?: IMentions, listMembers?: ListMembers) => Promise<string>;
3
+ export declare const getPostBody: (body: string, isTruncated: boolean | number, mentions?: IMentions, listMembers?: ListMembers) => Promise<string>;
@@ -1,5 +1,6 @@
1
1
  import { Dispatch } from 'react';
2
2
  import { Point } from 'slate';
3
+ import { IListMemberData } from '../../../../../discussion';
3
4
  import { ReportError, IMentionPopOver } from './../../rich-text-editor.types';
4
5
  declare const RichTextEditorContext: import("react").Context<{
5
6
  /** The id of the editor */
@@ -18,6 +19,8 @@ declare const RichTextEditorContext: import("react").Context<{
18
19
  lastAnchor: Point | null;
19
20
  /** Whether the editor is inside a modal, used to handle portals for focus trap */
20
21
  isInOverlay?: string | false | undefined;
22
+ /** An optional function to call when a mention is inserted */
23
+ onMention?: ((value?: IListMemberData) => void) | undefined;
21
24
  /** The function to update the state */
22
25
  dispatch: Dispatch<any>;
23
26
  /** The function to report an error */
@@ -1,4 +1,4 @@
1
- import type { IMentions } from '../../../discussion/discussion';
1
+ import type { IMentions, IListMemberData } from '../../../discussion/discussion';
2
2
  import { ListMembers, ReportError, ClickMentionFallback } from './rich-text-editor.types';
3
3
  interface Props {
4
4
  /** The id of the rich text editor */
@@ -22,6 +22,8 @@ interface Props {
22
22
  clickMentionFallback?: ClickMentionFallback;
23
23
  /** An optional event handler, called when the rich text editor is changed */
24
24
  onChange?: (value: string) => void;
25
+ /** An optional function to call when a mention is inserted */
26
+ onMention?: (value?: IListMemberData) => void;
25
27
  /** An optional event handler, called when the rich text editor reports an error */
26
28
  reportError?: ReportError;
27
29
  };