@apolitical/component-library 5.2.2-ac.8 → 5.3.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 (34) hide show
  1. package/discussion/components/add-post/add-post.d.ts +0 -3
  2. package/discussion/components/form/form.type.d.ts +0 -5
  3. package/discussion/components/post/post.d.ts +1 -6
  4. package/discussion/feeds/activities-feed/activities-feed.d.ts +0 -5
  5. package/discussion/feeds/activities-feed/cache/hooks/list/list.hook.d.ts +2 -5
  6. package/discussion/feeds/activities-feed/mocks/activities-feed.mock.d.ts +0 -4
  7. package/discussion/sections/activity-section/activity-section.d.ts +0 -4
  8. package/discussion/sections/activity-section/mocks/activity-section.mock.d.ts +0 -1
  9. package/discussion/shared/interfaces/activity.interface.d.ts +0 -1
  10. package/discussion/shared/interfaces/discussion.interface.d.ts +0 -2
  11. package/discussion/shared/interfaces/index.d.ts +0 -1
  12. package/form/components/form/components/fields/checkbox/checkbox.d.ts +2 -2
  13. package/form/components/form/components/fields/input/input.d.ts +0 -5
  14. package/form/components/form/components/fields/multiple-options/multiple-options.d.ts +1 -1
  15. package/form/components/form/form.types.d.ts +0 -8
  16. package/form/components/rich-text-editor/components/context/context.d.ts +5 -0
  17. package/form/components/rich-text-editor/helpers/handle-text/handle-text.d.ts +1 -0
  18. package/form/components/rich-text-editor/helpers/transform/transform.d.ts +1 -1
  19. package/form/components/rich-text-editor/plugins/index.d.ts +1 -0
  20. package/form/components/rich-text-editor/plugins/with-link-removal-listener/index.d.ts +1 -0
  21. package/form/components/rich-text-editor/plugins/with-link-removal-listener/with-link-removal-listener.d.ts +6 -0
  22. package/form/components/rich-text-editor/rich-text-editor.d.ts +2 -42
  23. package/form/components/rich-text-editor/rich-text-editor.types.d.ts +65 -2
  24. package/helpers/intl.d.ts +3 -2
  25. package/index.js +60 -60
  26. package/index.mjs +6091 -6103
  27. package/navigation/enriched-url/enriched-url.d.ts +26 -20
  28. package/navigation/enriched-url/index.d.ts +1 -1
  29. package/navigation/filters/filters.d.ts +1 -5
  30. package/package.json +1 -1
  31. package/style.css +1 -1
  32. package/styles/base/_accessibility.scss +0 -1
  33. package/styles/variables/colors/theme/_navigation.scss +6 -4
  34. package/discussion/shared/interfaces/community.category.interface.d.ts +0 -4
@@ -1,6 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import type { IDiscussionForm } from '../../../discussion/components/form';
3
- import { ICategory } from '../../shared';
4
3
  interface Props {
5
4
  /** Whether the form should be displayed as a card */
6
5
  isCard?: boolean;
@@ -8,8 +7,6 @@ interface Props {
8
7
  parentId?: string;
9
8
  /** Props for the form - this uses everything the `DiscussionForm` component does */
10
9
  form: IDiscussionForm;
11
- /** The categories to show in the form */
12
- categories?: ICategory[];
13
10
  /** Details about what a user needs to have to be able to access the form */
14
11
  membershipRequiredToPost: {
15
12
  /** Whether the user needs to be a member of the community to post */
@@ -1,6 +1,5 @@
1
1
  import { type ListMembers, ClickMentionFallback } from '../../../form';
2
2
  import { DiscussionCreateContentFunction, IDiscussionContent, IListMemberData, IMentions } from './../../discussion';
3
- import { ICategory } from '../../shared';
4
3
  export interface IDiscussionFormMeta {
5
4
  /** Whether the form data is still loading */
6
5
  isLoading?: boolean;
@@ -24,10 +23,6 @@ export interface IDiscussionFormMeta {
24
23
  };
25
24
  /** Whether title text should show above the form */
26
25
  showTitle?: boolean;
27
- /** What category options should be made available for the form */
28
- postCategories?: ICategory[];
29
- /** Whether the post type should show */
30
- showPostType?: boolean;
31
26
  /** Whether the community guidelines text should show beneath the form */
32
27
  showGuidelines?: boolean;
33
28
  /** Whether to show a divider before the buttons */
@@ -87,15 +87,10 @@ export interface IDiscussionPostProps {
87
87
  isCommunity?: boolean;
88
88
  /** Whether to show badges and the scope of the badge */
89
89
  badges?: IBadgesOption;
90
- /** Categories for the community */
91
- categories?: {
92
- name: string;
93
- slug: string;
94
- }[];
95
90
  /** The base path, used for slugs */
96
91
  basePath: string;
97
92
  /** The ID of the parent, used for slugs */
98
93
  parentId: string;
99
94
  }
100
- declare const Post: ({ element, content, userHasPermissions, userHasOwnerPermissions, isLoading, originalAuthorId, forceHide, functions, links, className, gtmContext, children, isTruncated, styling: { showShareLinkButton, showMoreMenuButton }, setFocus, isCommunity, badges, categories, basePath, parentId, }: IDiscussionPostProps) => import("react/jsx-runtime").JSX.Element;
95
+ declare const Post: ({ element, content, userHasPermissions, userHasOwnerPermissions, isLoading, originalAuthorId, forceHide, functions, links, className, gtmContext, children, isTruncated, styling: { showShareLinkButton, showMoreMenuButton }, setFocus, isCommunity, badges, basePath, parentId, }: IDiscussionPostProps) => import("react/jsx-runtime").JSX.Element;
101
96
  export default Post;
@@ -12,11 +12,6 @@ interface Props {
12
12
  isMember: boolean;
13
13
  /** Whether the user is an owner of the community */
14
14
  isOwner: boolean;
15
- /** The categories for the community */
16
- categories: {
17
- name: string;
18
- slug: string;
19
- }[];
20
15
  /** Functions for the activities query */
21
16
  functions: {
22
17
  /** Query functions for the activities */
@@ -3,12 +3,9 @@ import type { ICache, ICachePage } from '../..';
3
3
  export interface IListActivitiesArgs {
4
4
  queryFn: (_: unknown) => Promise<ICachePage>;
5
5
  queryKey: QueryKey;
6
- filterOption?: {
7
- id: string;
8
- type: string;
9
- };
6
+ rankingMethod?: string;
10
7
  }
11
- export declare function useListActivities({ queryFn, queryKey, filterOption, }: IListActivitiesArgs): {
8
+ export declare function useListActivities({ queryFn, queryKey, rankingMethod, }: IListActivitiesArgs): {
12
9
  activities: import('../../../../../../discussion/shared').IActivity[];
13
10
  error: Error | null;
14
11
  isLoading: boolean;
@@ -16,7 +16,6 @@ export declare const activitiesFeedMock: {
16
16
  };
17
17
  };
18
18
  title: string;
19
- categories: string[];
20
19
  content: string;
21
20
  feed_id: string;
22
21
  foreign_id: string;
@@ -125,7 +124,6 @@ export declare const activitiesFeedMock: {
125
124
  };
126
125
  };
127
126
  title: string;
128
- categories: string[];
129
127
  content: string;
130
128
  feed_id: string;
131
129
  foreign_id: string;
@@ -157,7 +155,6 @@ export declare const activitiesFeedMock: {
157
155
  badges?: undefined;
158
156
  };
159
157
  };
160
- categories: string[];
161
158
  content: string;
162
159
  feed_id: string;
163
160
  foreign_id: string;
@@ -232,7 +229,6 @@ export declare const activitiesFeedMock: {
232
229
  target: string;
233
230
  time: string;
234
231
  verb: string;
235
- categories?: undefined;
236
232
  })[];
237
233
  next: string;
238
234
  duration: string;
@@ -22,10 +22,6 @@ export interface IActivitySectionProps {
22
22
  leave: () => Promise<void>;
23
23
  };
24
24
  profile: IProfileFormProps;
25
- categories?: {
26
- name: string;
27
- slug: string;
28
- }[];
29
25
  }
30
26
  declare const ActivitySection: React.FC<IActivitySectionProps>;
31
27
  export default ActivitySection;
@@ -17,7 +17,6 @@ export declare const activitySectionMock: {
17
17
  };
18
18
  };
19
19
  };
20
- categories: string[];
21
20
  content: string;
22
21
  feed_id: string;
23
22
  foreign_id: string;
@@ -1,7 +1,6 @@
1
1
  import type { FlatActivityEnriched } from 'getstream';
2
2
  export interface IActivity extends FlatActivityEnriched {
3
3
  content: string;
4
- categories?: string[];
5
4
  feed_id?: string;
6
5
  title: string;
7
6
  total_replies?: number;
@@ -24,8 +24,6 @@ export interface IFullDiscussionContent extends IDiscussionContent {
24
24
  body?: string;
25
25
  /** The author of the post */
26
26
  author: MemberProps;
27
- /** The post categories */
28
- categories?: string[];
29
27
  createdAt: Date | string;
30
28
  /** The number of likes to display */
31
29
  likes?: number;
@@ -1,5 +1,4 @@
1
1
  export * from './activity.interface';
2
- export * from './community.category.interface';
3
2
  export * from './context.interface';
4
3
  export * from './discussion.interface';
5
4
  export * from './reaction.interface';
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import { IField } from '../../../form.types';
3
- export declare const Checkbox: ({ className, disabled, element, functions: allFunctions, id, inputRef: ref, intlPath, label, shownValue: value, type, value: isChecked, accessibilityOptions: { checkboxes: { navigateWithArrowKeys } }, ...props }: IField) => React.DOMElement<{
3
+ export declare const Checkbox: ({ className, disabled, element, functions: allFunctions, id, inputRef: ref, intlPath, label, shownValue: value, type, value: isChecked, ...props }: IField) => React.DOMElement<{
4
4
  onMultiSelectSubmit?: ((arg1: import("../../../form.types").FormValues) => void) | undefined;
5
5
  onBlur?: (() => void) | undefined;
6
6
  onFocus?: (() => void) | undefined;
7
7
  onKeyInput?: (<T>(arg1: import("../../../form.types").FormValues) => Promise<T>) | undefined;
8
- onKeyDown: ((e: React.KeyboardEvent<HTMLElement>) => void) | undefined;
8
+ onKeyDown?: ((e: React.KeyboardEvent<HTMLElement>) => void) | undefined;
9
9
  submitForm?: ((arg: import("../../../form.types").IFormValues) => void) | undefined;
10
10
  'aria-describedby'?: string | undefined;
11
11
  'aria-errormessage'?: string | undefined;
@@ -15,11 +15,6 @@ export declare const Input: ({ className, element, id, inputRef: ref, functions,
15
15
  value: InputValues;
16
16
  placeholder: string | undefined;
17
17
  autoFocus: boolean | undefined;
18
- accessibilityOptions?: {
19
- checkboxes?: {
20
- navigateWithArrowKeys?: boolean | undefined;
21
- } | undefined;
22
- } | undefined;
23
18
  'aria-describedby'?: string | undefined;
24
19
  'aria-errormessage'?: string | undefined;
25
20
  'aria-invalid'?: boolean | undefined;
@@ -1,3 +1,3 @@
1
1
  import { IField } from '../../../form.types';
2
- export declare const MultipleOptions: ({ className, functions, intlPath, id: groupId, label, multiSelect, name, options, required, type, value, accessibilityOptions, ...props }: IField) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const MultipleOptions: ({ className, functions, intlPath, id: groupId, label, multiSelect, name, options, required, type, value, ...props }: IField) => import("react/jsx-runtime").JSX.Element;
3
3
  export default MultipleOptions;
@@ -82,14 +82,6 @@ export interface IFieldFunctions {
82
82
  submitForm?: (arg: IFormValues) => void;
83
83
  }
84
84
  export interface IField {
85
- /** Additional accessibility configuration */
86
- accessibilityOptions?: {
87
- /** Additional options for checkboxes */
88
- checkboxes?: {
89
- /** Whether the field should be navigable with arrow keys */
90
- navigateWithArrowKeys?: boolean;
91
- };
92
- };
93
85
  /** Optional ID of the element which describes this field, for screen readers */
94
86
  'aria-describedby'?: string;
95
87
  /** Optional ID of the element which provides an error message for this field */
@@ -1,6 +1,7 @@
1
1
  import { Dispatch } from 'react';
2
2
  import { Point } from 'slate';
3
3
  import { IListMemberData } from '../../../../../discussion';
4
+ import type { IEnrichedUrlData } from '../../../../../navigation';
4
5
  import { ReportError, IMentionPopOver } from './../../rich-text-editor.types';
5
6
  declare const RichTextEditorContext: import("react").Context<{
6
7
  /** The id of the editor */
@@ -19,8 +20,12 @@ declare const RichTextEditorContext: import("react").Context<{
19
20
  lastAnchor: Point | null;
20
21
  /** Whether the editor is inside a modal, used to handle portals for focus trap */
21
22
  isInOverlay?: string | false | undefined;
23
+ /** The data for the first link, to be displayed in the EnrichedUrl component. `undefined` is not set, `false` will not show the enriched url. (For cases where the user has manually removed it.) */
24
+ enrichedUrl?: IEnrichedUrlData | false | undefined;
22
25
  /** An optional function to call when a mention is inserted */
23
26
  onMention?: ((value?: IListMemberData) => void) | undefined;
27
+ /** The function to get metadata about a link */
28
+ getLinkPreview?: ((url: string) => Promise<IEnrichedUrlData>) | undefined;
24
29
  /** The function to update the state */
25
30
  dispatch: Dispatch<any>;
26
31
  /** The function to report an error */
@@ -1,3 +1,4 @@
1
1
  import { BaseEditor } from 'slate';
2
2
  export declare const getSelectedText: (editor: BaseEditor) => string | null;
3
3
  export declare const getAllText: (editor: BaseEditor) => string;
4
+ export declare const firstLinkData: (editor: BaseEditor) => string | null;
@@ -12,8 +12,8 @@ export default function transform<T extends InputNodeTypes>(node: MdastNode, opt
12
12
  position?: any;
13
13
  ordered?: boolean | undefined;
14
14
  checked?: any;
15
- depth?: 1 | 2 | 3 | 4 | 5 | 6 | undefined;
16
15
  lang?: string | undefined;
16
+ depth?: 1 | 2 | 3 | 4 | 5 | 6 | undefined;
17
17
  spread?: any;
18
18
  indent?: any;
19
19
  text: string | undefined;
@@ -1,3 +1,4 @@
1
+ export * from './with-link-removal-listener';
1
2
  export * from './with-linlines';
2
3
  export * from './with-mentions';
3
4
  export * from './without-empty-links';
@@ -0,0 +1 @@
1
+ export { default as withLinkRemovalListener } from './with-link-removal-listener';
@@ -0,0 +1,6 @@
1
+ import { BaseEditor } from 'slate';
2
+ import { HistoryEditor } from 'slate-history';
3
+ import { ReactEditor } from 'slate-react';
4
+ import { ReportError } from './../../rich-text-editor.types';
5
+ declare const withLinkRemovalListener: (editor: BaseEditor & ReactEditor & HistoryEditor, reportError: ReportError) => BaseEditor & ReactEditor & HistoryEditor;
6
+ export default withLinkRemovalListener;
@@ -1,43 +1,3 @@
1
- import type { IMentions, IListMemberData } from '../../../discussion/discussion';
2
- import { ListMembers, ReportError, ClickMentionFallback } from './rich-text-editor.types';
3
- interface Props {
4
- /** The id of the rich text editor */
5
- id?: string;
6
- /** The default value of the rich text editor */
7
- value?: string;
8
- /** The placeholder text of the rich text editor */
9
- placeholder?: string;
10
- /** The maximum length of the rich text editor */
11
- maxLength?: number;
12
- /** Information about the rich text editor */
13
- meta?: {
14
- /** Whether the rich text editor is inside a modal */
15
- isInOverlay?: false | 'string';
16
- };
17
- /** Optional functions */
18
- functions?: {
19
- /** An optional function to get a filtered list of members when the user starts typing a mention */
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;
23
- /** An optional event handler, called when the rich text editor is changed */
24
- onChange?: (value: string) => void;
25
- /** An optional function to call when a mention is inserted */
26
- onMention?: (value?: IListMemberData) => void;
27
- /** An optional event handler, called when the rich text editor reports an error */
28
- reportError?: ReportError;
29
- };
30
- /** Optional autoFocus */
31
- autoFocus?: boolean;
32
- /** Optional aria invalid */
33
- 'aria-invalid'?: boolean;
34
- /** Optional aria error message */
35
- 'aria-errormessage'?: string;
36
- /** Optional data for the editor */
37
- data?: {
38
- /** Optional mentions */
39
- mentions?: IMentions;
40
- };
41
- }
42
- declare const RichTextEditor: ({ id, value, placeholder, maxLength, meta, functions, autoFocus, data, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
1
+ import { IRTEProps } from './rich-text-editor.types';
2
+ declare const RichTextEditor: ({ id, value, placeholder, maxLength, meta, functions, autoFocus, data, ...props }: IRTEProps) => import("react/jsx-runtime").JSX.Element;
43
3
  export default RichTextEditor;
@@ -1,6 +1,69 @@
1
- import { BaseElement, BaseText, Descendant, Range } from 'slate';
2
- import type { IListMemberData } from '../../../discussion';
1
+ import { BaseElement, BaseText, Descendant, Point, Range } from 'slate';
2
+ import type { IListMemberData, IMentions } from '../../../discussion';
3
3
  import type { MemberDetailsProps } from '../../../user';
4
+ import type { IEnrichedUrlData } from '../../../navigation';
5
+ export interface IRTEProps {
6
+ /** The id of the rich text editor */
7
+ id?: string;
8
+ /** The default value of the rich text editor */
9
+ value?: string;
10
+ /** The placeholder text of the rich text editor */
11
+ placeholder?: string;
12
+ /** The maximum length of the rich text editor */
13
+ maxLength?: number;
14
+ /** Information about the rich text editor */
15
+ meta?: {
16
+ /** Whether the rich text editor is inside a modal */
17
+ isInOverlay?: false | 'string';
18
+ };
19
+ /** Optional functions */
20
+ functions?: {
21
+ /** An optional function to get a filtered list of members when the user starts typing a mention */
22
+ listMembers?: ListMembers;
23
+ /** An optional function to call when the user clicks the mention fallback, e.g. to show an invite modal */
24
+ clickMentionFallback?: ClickMentionFallback;
25
+ /** An optional function to get a preview of a link */
26
+ getLinkPreview?: (url: string) => Promise<IEnrichedUrlData>;
27
+ /** An optional event handler, called when the rich text editor is changed */
28
+ onChange?: (value: string) => void;
29
+ /** An optional function to call when a mention is inserted */
30
+ onMention?: (value?: IListMemberData) => void;
31
+ /** An optional event handler, called when the rich text editor reports an error */
32
+ reportError?: ReportError;
33
+ };
34
+ /** Optional autoFocus */
35
+ autoFocus?: boolean;
36
+ /** Optional aria invalid */
37
+ 'aria-invalid'?: boolean;
38
+ /** Optional aria error message */
39
+ 'aria-errormessage'?: string;
40
+ /** Optional data for the editor */
41
+ data?: {
42
+ /** Optional mentions */
43
+ mentions?: IMentions;
44
+ /** Optional data about the first link, to be displayed in the EnrichedUrl component */
45
+ link?: IEnrichedUrlData;
46
+ };
47
+ }
48
+ export interface IRTEInitialState {
49
+ editorKey: string | null;
50
+ originalValue: string | null;
51
+ initialValue: Descendant[] | null;
52
+ tabbableOption: string;
53
+ openTooltip: string | null;
54
+ showLinkEditor: boolean;
55
+ mentionPopover: IMentionPopOver;
56
+ lastAnchor: Point | null;
57
+ stringValue: string;
58
+ lastKey: string | null;
59
+ hasInteracted: boolean;
60
+ hasLoaded: boolean;
61
+ enrichedUrl: IEnrichedUrlData | false | undefined;
62
+ }
63
+ export interface IRTEReducer {
64
+ type: keyof IRTEInitialState;
65
+ value: any;
66
+ }
4
67
  export declare enum Formatting {
5
68
  blockquote = "block_quote",
6
69
  bold = "bold",
package/helpers/intl.d.ts CHANGED
@@ -127,8 +127,6 @@ export declare const checkIntlPathExists: (path: string, language?: {
127
127
  discussionFormCard_overlay_text: string;
128
128
  discussionFormCard_overlay_cta_discard: string;
129
129
  discussionFormCard_overlay_cta_continue: string;
130
- discussion_form_postType_label: string;
131
- 'discussion_form__postType_no-category': string;
132
130
  discussion_form_title: string;
133
131
  discussion_form_titleField_label: string;
134
132
  discussion_form_titleField_placeholder: string;
@@ -288,6 +286,9 @@ export declare const checkIntlPathExists: (path: string, language?: {
288
286
  richTextEditor_link_edit: string;
289
287
  richTextEditor_link_remove: string;
290
288
  richTextEditor_link_button: string;
289
+ richTextEditor_link_enrichedUrl_aria: string;
290
+ richTextEditor_link_enrichedUrl_aria_fallback: string;
291
+ richTextEditor_link_enrichedUrl_aria_live: string;
291
292
  richTextEditor_ol_list: string;
292
293
  richTextEditor_ul_list: string;
293
294
  richTextEditor_block_quote: string;