@apolitical/component-library 5.3.2 → 5.3.4-ac.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 (26) hide show
  1. package/discussion/components/add-post/add-post.d.ts +3 -0
  2. package/discussion/components/form/form.type.d.ts +6 -0
  3. package/discussion/components/post/post.d.ts +6 -1
  4. package/discussion/feeds/activities-feed/activities-feed.d.ts +5 -0
  5. package/discussion/feeds/activities-feed/cache/hooks/list/list.hook.d.ts +5 -2
  6. package/discussion/feeds/activities-feed/mocks/activities-feed.mock.d.ts +4 -0
  7. package/discussion/sections/activity-section/activity-section.d.ts +4 -0
  8. package/discussion/sections/activity-section/mocks/activity-section.mock.d.ts +1 -0
  9. package/discussion/shared/helpers/activity.helper.d.ts +3 -1
  10. package/discussion/shared/interfaces/activity.interface.d.ts +1 -0
  11. package/discussion/shared/interfaces/community.category.interface.d.ts +4 -0
  12. package/discussion/shared/interfaces/discussion.interface.d.ts +2 -0
  13. package/discussion/shared/interfaces/index.d.ts +1 -0
  14. package/form/components/form/components/fields/checkbox/checkbox.d.ts +2 -2
  15. package/form/components/form/components/fields/input/input.d.ts +5 -0
  16. package/form/components/form/components/fields/multiple-options/multiple-options.d.ts +1 -1
  17. package/form/components/form/form.types.d.ts +8 -0
  18. package/helpers/intl.d.ts +2 -0
  19. package/index.js +59 -59
  20. package/index.mjs +6119 -6028
  21. package/navigation/filters/filters.d.ts +5 -1
  22. package/package.json +1 -1
  23. package/style.css +1 -1
  24. package/styles/base/_accessibility.scss +1 -0
  25. package/styles/base/_text.scss +1 -1
  26. package/styles/variables/colors/theme/_navigation.scss +4 -4
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { IDiscussionForm } from '../../../discussion/components/form';
3
+ import { ICategory } from '../../shared';
3
4
  interface Props {
4
5
  /** Whether the form should be displayed as a card */
5
6
  isCard?: boolean;
@@ -7,6 +8,8 @@ interface Props {
7
8
  parentId?: string;
8
9
  /** Props for the form - this uses everything the `DiscussionForm` component does */
9
10
  form: IDiscussionForm;
11
+ /** The categories to show in the form */
12
+ categories?: ICategory[];
10
13
  /** Details about what a user needs to have to be able to access the form */
11
14
  membershipRequiredToPost: {
12
15
  /** Whether the user needs to be a member of the community to post */
@@ -1,5 +1,6 @@
1
1
  import { type ListMembers, ClickMentionFallback } from '../../../form';
2
2
  import { DiscussionCreateContentFunction, IDiscussionContent, IListMemberData, IMentions } from './../../discussion';
3
+ import { ICategory } from '../../shared';
3
4
  export interface IDiscussionFormMeta {
4
5
  /** Whether the form data is still loading */
5
6
  isLoading?: boolean;
@@ -11,6 +12,7 @@ export interface IDiscussionFormMeta {
11
12
  isAutoFocused?: boolean;
12
13
  /** Whether we're editing or creating */
13
14
  isEditing: false | {
15
+ categories?: string[] | string;
14
16
  text?: string;
15
17
  };
16
18
  /** Whether the form has a title field */
@@ -23,6 +25,10 @@ export interface IDiscussionFormMeta {
23
25
  };
24
26
  /** Whether title text should show above the form */
25
27
  showTitle?: boolean;
28
+ /** What category options should be made available for the form */
29
+ postCategories?: ICategory[];
30
+ /** Whether the post type should show */
31
+ showPostType?: boolean;
26
32
  /** Whether the community guidelines text should show beneath the form */
27
33
  showGuidelines?: boolean;
28
34
  /** Whether to show a divider before the buttons */
@@ -87,10 +87,15 @@ 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
+ }[];
90
95
  /** The base path, used for slugs */
91
96
  basePath: string;
92
97
  /** The ID of the parent, used for slugs */
93
98
  parentId: string;
94
99
  }
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;
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;
96
101
  export default Post;
@@ -12,6 +12,11 @@ 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
+ }[];
15
20
  /** Functions for the activities query */
16
21
  functions: {
17
22
  /** Query functions for the activities */
@@ -3,9 +3,12 @@ import type { ICache, ICachePage } from '../..';
3
3
  export interface IListActivitiesArgs {
4
4
  queryFn: (_: unknown) => Promise<ICachePage>;
5
5
  queryKey: QueryKey;
6
- rankingMethod?: string;
6
+ filterOption?: {
7
+ id: string;
8
+ type: string;
9
+ };
7
10
  }
8
- export declare function useListActivities({ queryFn, queryKey, rankingMethod, }: IListActivitiesArgs): {
11
+ export declare function useListActivities({ queryFn, queryKey, filterOption, }: IListActivitiesArgs): {
9
12
  activities: import('../../../../../../discussion/shared').IActivity[];
10
13
  error: Error | null;
11
14
  isLoading: boolean;
@@ -16,6 +16,7 @@ export declare const activitiesFeedMock: {
16
16
  };
17
17
  };
18
18
  title: string;
19
+ categories: string[];
19
20
  content: string;
20
21
  feed_id: string;
21
22
  foreign_id: string;
@@ -124,6 +125,7 @@ export declare const activitiesFeedMock: {
124
125
  };
125
126
  };
126
127
  title: string;
128
+ categories: string[];
127
129
  content: string;
128
130
  feed_id: string;
129
131
  foreign_id: string;
@@ -155,6 +157,7 @@ export declare const activitiesFeedMock: {
155
157
  badges?: undefined;
156
158
  };
157
159
  };
160
+ categories: string[];
158
161
  content: string;
159
162
  feed_id: string;
160
163
  foreign_id: string;
@@ -229,6 +232,7 @@ export declare const activitiesFeedMock: {
229
232
  target: string;
230
233
  time: string;
231
234
  verb: string;
235
+ categories?: undefined;
232
236
  })[];
233
237
  next: string;
234
238
  duration: string;
@@ -22,6 +22,10 @@ export interface IActivitySectionProps {
22
22
  leave: () => Promise<void>;
23
23
  };
24
24
  profile: IProfileFormProps;
25
+ categories?: {
26
+ name: string;
27
+ slug: string;
28
+ }[];
25
29
  }
26
30
  declare const ActivitySection: React.FC<IActivitySectionProps>;
27
31
  export default ActivitySection;
@@ -17,6 +17,7 @@ export declare const activitySectionMock: {
17
17
  };
18
18
  };
19
19
  };
20
+ categories: string[];
20
21
  content: string;
21
22
  feed_id: string;
22
23
  foreign_id: string;
@@ -3,6 +3,7 @@ import type { IActivity, IReaction } from '..';
3
3
  interface IPrepareActivityArgs {
4
4
  title?: string;
5
5
  content?: string;
6
+ categories?: string;
6
7
  }
7
8
  interface IEnrichActivityArgs {
8
9
  activity: IActivity | Partial<IActivity>;
@@ -17,9 +18,10 @@ interface IDecrementActivityLikesArgs {
17
18
  activity: IActivity;
18
19
  user?: IUserContext;
19
20
  }
20
- export declare function prepareActivity({ title, content }: IPrepareActivityArgs): {
21
+ export declare function prepareActivity({ title, content, categories }: IPrepareActivityArgs): {
21
22
  title: string | undefined;
22
23
  content: string | undefined;
24
+ categories: string[];
23
25
  id: string;
24
26
  time: string;
25
27
  verb: string;
@@ -1,6 +1,7 @@
1
1
  import type { FlatActivityEnriched } from 'getstream';
2
2
  export interface IActivity extends FlatActivityEnriched {
3
3
  content: string;
4
+ categories?: string[];
4
5
  feed_id?: string;
5
6
  title: string;
6
7
  total_replies?: number;
@@ -0,0 +1,4 @@
1
+ export interface ICategory {
2
+ name: string;
3
+ slug: string;
4
+ }
@@ -24,6 +24,8 @@ 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[];
27
29
  createdAt: Date | string;
28
30
  /** The number of likes to display */
29
31
  likes?: number;
@@ -1,4 +1,5 @@
1
1
  export * from './activity.interface';
2
+ export * from './community.category.interface';
2
3
  export * from './context.interface';
3
4
  export * from './discussion.interface';
4
5
  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, ...props }: IField) => React.DOMElement<{
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<{
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,6 +15,11 @@ 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;
18
23
  'aria-describedby'?: string | undefined;
19
24
  'aria-errormessage'?: string | undefined;
20
25
  '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, ...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, accessibilityOptions, ...props }: IField) => import("react/jsx-runtime").JSX.Element;
3
3
  export default MultipleOptions;
@@ -82,6 +82,14 @@ 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
+ };
85
93
  /** Optional ID of the element which describes this field, for screen readers */
86
94
  'aria-describedby'?: string;
87
95
  /** Optional ID of the element which provides an error message for this field */
package/helpers/intl.d.ts CHANGED
@@ -127,6 +127,8 @@ 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;
130
132
  discussion_form_title: string;
131
133
  discussion_form_titleField_label: string;
132
134
  discussion_form_titleField_placeholder: string;