@apolitical/component-library 6.3.4 → 6.4.0-SW.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 (59) hide show
  1. package/discussion/components/conversation/conversation.d.ts +1 -1
  2. package/discussion/components/discussion-form-card/discussion-form-card.d.ts +2 -2
  3. package/discussion/components/form/components/guidelines/guidelines.d.ts +1 -1
  4. package/discussion/components/form/components/label/label.d.ts +1 -1
  5. package/discussion/components/form/form.type.d.ts +1 -2
  6. package/discussion/components/post/components/author-section/author-section.d.ts +14 -0
  7. package/discussion/components/post/components/author-section/index.d.ts +1 -0
  8. package/discussion/components/post/components/categories/categories.d.ts +5 -0
  9. package/discussion/components/post/components/categories/index.d.ts +1 -0
  10. package/discussion/components/post/components/index.d.ts +4 -0
  11. package/discussion/components/post/components/poll-content/index.d.ts +1 -0
  12. package/discussion/components/post/components/poll-content/poll-content.d.ts +11 -0
  13. package/discussion/components/post/components/post-content/index.d.ts +1 -0
  14. package/discussion/components/post/components/post-content/post-content.d.ts +15 -0
  15. package/discussion/components/post/post.d.ts +13 -5
  16. package/discussion/components/post/post.helpers.d.ts +5 -1
  17. package/discussion/feeds/activities-feed/activities-feed.d.ts +6 -2
  18. package/discussion/feeds/activities-feed/cache/hooks/create-vote/create-vote.hook.d.ts +8 -0
  19. package/discussion/feeds/activities-feed/cache/hooks/create-vote/index.d.ts +1 -0
  20. package/discussion/feeds/activities-feed/cache/hooks/index.d.ts +2 -0
  21. package/discussion/feeds/activities-feed/cache/hooks/remove-vote/index.d.ts +1 -0
  22. package/discussion/feeds/activities-feed/cache/hooks/remove-vote/remove-vote.hook.d.ts +8 -0
  23. package/discussion/feeds/replies-feed/components/nested-replies-feed/nested-replies-feed.d.ts +1 -1
  24. package/discussion/feeds/replies-feed/components/reply-item/reply-item.d.ts +1 -1
  25. package/discussion/feeds/replies-feed/replies-feed.d.ts +1 -1
  26. package/discussion/index.d.ts +1 -2
  27. package/discussion/sections/activity-section/activity-section.d.ts +1 -1
  28. package/discussion/shared/constants.d.ts +1 -0
  29. package/discussion/shared/helpers/index.d.ts +2 -1
  30. package/discussion/shared/helpers/poll.helper.d.ts +23 -0
  31. package/discussion/shared/interfaces/activity.interface.d.ts +16 -1
  32. package/discussion/shared/interfaces/discussion.interface.d.ts +15 -4
  33. package/discussion/shared/interfaces/reaction.interface.d.ts +1 -1
  34. package/form/components/character-limit/character-limit.helpers.d.ts +2 -2
  35. package/form/components/form/components/field-wrapper/field-wrapper.d.ts +1 -1
  36. package/form/components/form/components/fields/checkbox/checkbox.d.ts +9 -0
  37. package/form/components/form/components/fields/index.d.ts +1 -0
  38. package/form/components/form/components/fields/input/input.d.ts +10 -2
  39. package/form/components/form/components/fields/multiple-inputs/index.d.ts +1 -0
  40. package/form/components/form/components/fields/multiple-inputs/multiple-inputs.d.ts +3 -0
  41. package/form/components/form/components/fields/multiple-options/multiple-options.d.ts +1 -1
  42. package/form/components/form/form.helpers.d.ts +2 -0
  43. package/form/components/form/form.types.d.ts +32 -7
  44. package/form/components/rich-text-editor/components/context/context.d.ts +1 -1
  45. package/form/components/rich-text-editor/rich-text-editor.types.d.ts +1 -1
  46. package/helpers/intl.d.ts +5 -0
  47. package/helpers/replace-mention-data.d.ts +1 -1
  48. package/index.js +44 -44
  49. package/index.mjs +7605 -7169
  50. package/navigation/action-bar/action-bar.d.ts +1 -1
  51. package/navigation/action-bar/components/likes/likes.d.ts +2 -2
  52. package/package.json +1 -1
  53. package/polls/poll/index.d.ts +1 -1
  54. package/polls/poll/poll.d.ts +8 -9
  55. package/polls/poll/poll.mocks.d.ts +1 -0
  56. package/polls/poll/poll.types.d.ts +9 -0
  57. package/style.css +1 -1
  58. package/styles/base/form/_labels.scss +2 -1
  59. package/styles/variables/colors/theme/_form.scss +1 -0
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { IConversation, IListMemberData } from './../../discussion';
2
+ import type { IConversation, IListMemberData } from '../../../discussion/shared';
3
3
  export declare const ConversationContext: React.Context<{
4
4
  showForm: boolean;
5
5
  prepopulateForm?: string | undefined;
@@ -1,5 +1,5 @@
1
- import { type IDiscussionForm } from './../form';
2
- import { IMentions } from './../../discussion.d';
1
+ import type { IDiscussionForm } from './../form';
2
+ import type { IMentions } from '../../../discussion/shared';
3
3
  export interface CachedText {
4
4
  /** Whether the cached text should show on the form card; this is false by default
5
5
  * to prevent the text changing right away and distracting the user */
@@ -1,4 +1,4 @@
1
- import { IDiscussionContentType } from './../../../../discussion.d';
1
+ import type { IDiscussionContentType } from '../../../../../discussion/shared';
2
2
  interface Props {
3
3
  /** The internationalisation path for the guidelines */
4
4
  intlPath: string;
@@ -1,5 +1,5 @@
1
1
  import { type ILabelProps } from '../../../../../form';
2
- import { IDiscussionContentType } from './../../../../discussion.d';
2
+ import type { IDiscussionContentType } from '../../../../../discussion/shared';
3
3
  interface Props extends ILabelProps {
4
4
  /** The internationalisation path for the label */
5
5
  intlPath: string;
@@ -1,6 +1,5 @@
1
1
  import type { IEnrichedUrlData } from '../../../navigation';
2
- import { IDiscussionContent, IMentions } from './../../discussion';
3
- import { ICategory, IDiscussionFormFunctions } from '../../shared';
2
+ import type { ICategory, IDiscussionContent, IDiscussionFormFunctions, IMentions } from '../../../discussion/shared';
4
3
  export interface IDiscussionFormMeta {
5
4
  /** Whether the form data is still loading */
6
5
  isLoading?: boolean;
@@ -0,0 +1,14 @@
1
+ import type { IFullDiscussionContent } from '../../../../../discussion/shared';
2
+ import type { IDiscussionPostProps } from '../../post';
3
+ export interface IAuthorSectionProps {
4
+ author: IFullDiscussionContent['author'];
5
+ originalAuthorId?: string;
6
+ createdAt: IFullDiscussionContent['createdAt'];
7
+ contentData: {
8
+ didEdit: boolean;
9
+ };
10
+ content: IDiscussionPostProps['content'];
11
+ badges?: IDiscussionPostProps['badges'];
12
+ gtmContext?: string;
13
+ }
14
+ export default function AuthorSection({ author, originalAuthorId, createdAt, contentData, content, gtmContext, badges, }: IAuthorSectionProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export { default as AuthorSection } from './author-section';
@@ -0,0 +1,5 @@
1
+ import type { IDiscussionPostProps } from '../../post';
2
+ export interface ICategoriesProps {
3
+ content: IDiscussionPostProps['content'];
4
+ }
5
+ export default function Categories({ content }: ICategoriesProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export { default as Categories } from './categories';
@@ -1 +1,5 @@
1
+ export * from './author-section';
1
2
  export * from './blockquote';
3
+ export * from './categories';
4
+ export * from './poll-content';
5
+ export * from './post-content';
@@ -0,0 +1 @@
1
+ export { default as PollContent } from './poll-content';
@@ -0,0 +1,11 @@
1
+ import { IPollFns } from '../../../../../polls';
2
+ import { IDiscussionPostProps } from '../../post';
3
+ export interface IPollContentProps {
4
+ content: IDiscussionPostProps['content'];
5
+ contentData: {
6
+ title: string;
7
+ body: string;
8
+ };
9
+ functions: IPollFns;
10
+ }
11
+ export default function PollContent({ content, contentData, functions, }: IPollContentProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export { default as PostContent } from './post-content';
@@ -0,0 +1,15 @@
1
+ import type { IDiscussionPostProps } from '../../post';
2
+ import type { IFullDiscussionContent } from '../../../../../discussion';
3
+ export interface IPostContentProps {
4
+ links: IDiscussionPostProps['links'];
5
+ contentData: {
6
+ title: string;
7
+ isEditing: boolean;
8
+ didEdit: boolean;
9
+ postBody: string;
10
+ data: IFullDiscussionContent['data'];
11
+ };
12
+ postCutOff: number;
13
+ content: IDiscussionPostProps['content'];
14
+ }
15
+ export default function PostContent({ links, contentData, postCutOff, content, }: IPostContentProps): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { IMemberComponentProps } from '../../../user';
3
- import { DiscussionCreateContentFunction, DiscussionCreateLikeFunction, DiscussionDeleteLikeFunction, DiscussionListLikesFunction, IDiscussionFormFns } from '../../discussion';
4
- import type { IForceHide, IFullDiscussionContent } from '../../shared/interfaces';
5
- import { IBadgesOption } from '../../../user/badges';
2
+ import type { IPollFns, IPollProps } from '../../../polls';
3
+ import type { IMemberComponentProps } from '../../../user';
4
+ import type { DiscussionCreateContentFunction, DiscussionCreateLikeFunction, DiscussionDeleteLikeFunction, DiscussionListLikesFunction, IDiscussionFormFns, IForceHide, IFullDiscussionContent } from '../../../discussion/shared';
5
+ import type { IBadgesOption } from '../../../user/badges';
6
6
  export interface IPostContent extends IFullDiscussionContent {
7
7
  /** The post body */
8
8
  postBody?: string;
@@ -10,6 +10,13 @@ export interface IPostContent extends IFullDiscussionContent {
10
10
  /** Custom props to pass through to the Member component */
11
11
  member: IMemberComponentProps;
12
12
  };
13
+ /** The options for the Poll */
14
+ pollOptions?: IPollProps['options'];
15
+ /** The settings for the Poll */
16
+ pollSettings?: IPollProps['settings'];
17
+ }
18
+ export interface IPollFunctions extends IPollFns {
19
+ removePoll: (args?: object) => void;
13
20
  }
14
21
  export interface IDiscussionPostProps {
15
22
  /** The element that will render around the content */
@@ -44,6 +51,7 @@ export interface IDiscussionPostProps {
44
51
  /** List the likes on the post */
45
52
  listLikes: DiscussionListLikesFunction;
46
53
  };
54
+ polls?: IPollFunctions;
47
55
  comments: {
48
56
  /** Open comments on a post */
49
57
  openComments?: () => void;
@@ -89,5 +97,5 @@ export interface IDiscussionPostProps {
89
97
  /** The ID of the parent, used for slugs */
90
98
  parentId: string;
91
99
  }
92
- declare const Post: ({ element, content, userHasPermissions, userHasOwnerPermissions, isLoading, originalAuthorId, forceHide, functions, links, className, gtmContext, children, isTruncated, 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, setFocus, isCommunity, badges, basePath, parentId, locale, }: IDiscussionPostProps) => import("react/jsx-runtime").JSX.Element;
93
101
  export default Post;
@@ -1,5 +1,9 @@
1
- import { IMentions } from './../../discussion';
1
+ import type { IMentions } from '../../../discussion/shared';
2
2
  import { ListMembers } from '../../../form';
3
3
  import { ICategory } from '../../shared';
4
4
  export declare const getPostBody: (body: string, isTruncated: boolean | number, mentions?: IMentions, listMembers?: ListMembers) => Promise<string>;
5
5
  export declare const enrichPostCategories: (postCategories: string[], allCategories: ICategory[]) => (ICategory | undefined)[];
6
+ export declare const allowClickUntilClassNameFound: (event: React.MouseEvent<HTMLElement, MouseEvent>, contentClasses: string[], breakClassName: string) => boolean;
7
+ export declare const getTitleText: (title: string | {
8
+ [key: string]: string;
9
+ } | undefined, locale: string) => string;
@@ -1,8 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { type IProfileFormProps } from '../../../form';
3
- import { ICategory } from '../../../discussion/shared';
3
+ import { type ICategory } from '../../../discussion/shared';
4
4
  import type { ILikesFeedQueryFns } from '../../../discussion/feeds/likes-feed';
5
- import type { IDiscussionFormFns } from '../../../discussion/discussion.d';
5
+ import type { IDiscussionFormFns } from '../../../discussion/shared';
6
6
  import { type IQueryFns } from './cache';
7
7
  interface Props {
8
8
  /** The base path, used for slugs */
@@ -26,9 +26,13 @@ interface Props {
26
26
  /** Function to leave the community */
27
27
  leave: () => Promise<void>;
28
28
  likes: ILikesFeedQueryFns;
29
+ /** Query functions for polls */
30
+ polls: IQueryFns;
29
31
  };
30
32
  /** Props to pass into the profile form */
31
33
  profile: IProfileFormProps;
34
+ /** The locale of the page */
35
+ locale?: string;
32
36
  }
33
37
  declare const ActivitiesFeed: React.FC<Props>;
34
38
  export default ActivitiesFeed;
@@ -0,0 +1,8 @@
1
+ import type { IMutationContext } from '../../../../../../discussion/shared';
2
+ import type { ICache, ICacheSubitem } from '../..';
3
+ interface ICreateVoteVars {
4
+ activityId: string;
5
+ reactionId: string;
6
+ }
7
+ export declare function useCreateVote({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError }, queryClient, queryKey, user, }: IMutationContext<ICacheSubitem, Error, ICreateVoteVars, ICache>): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<import('../../../../../../discussion/shared').IReaction, Error, ICreateVoteVars, ICache>;
8
+ export {};
@@ -0,0 +1 @@
1
+ export * from './create-vote.hook';
@@ -1,9 +1,11 @@
1
1
  export * from './create';
2
+ export * from './create-vote';
2
3
  export * from './edit';
3
4
  export * from './feed';
4
5
  export * from './like';
5
6
  export * from './list';
6
7
  export * from './pin';
7
8
  export * from './remove';
9
+ export * from './remove-vote';
8
10
  export * from './unlike';
9
11
  export * from './unpin';
@@ -0,0 +1 @@
1
+ export * from './remove-vote.hook';
@@ -0,0 +1,8 @@
1
+ import type { IMutationContext } from '../../../../../../discussion/shared';
2
+ import type { ICache } from '../..';
3
+ interface IRemoveVoteVars {
4
+ activityId: string;
5
+ reactionId: string;
6
+ }
7
+ export declare function useRemoveVote({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError }, user, }: IMutationContext<unknown, Error, IRemoveVoteVars, ICache>): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<unknown, Error, IRemoveVoteVars, ICache>;
8
+ export {};
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { IDiscussionFormFns } from '../../../../../discussion/discussion.d';
2
+ import type { IDiscussionFormFns } from '../../../../../discussion/shared';
3
3
  import { ILikesFeedQueryFns } from '../../../../../discussion/feeds/likes-feed';
4
4
  import { type IQueryFns } from '../../cache';
5
5
  interface NestedRepliesFunctions {
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { ILikesFeedQueryFns } from '../../../../../discussion/feeds/likes-feed';
3
- import type { IDiscussionFormFns } from '../../../../discussion';
3
+ import type { IDiscussionFormFns } from '../../../../../discussion/shared';
4
4
  import type { IParsedReplies, IQueryFns } from '../../cache';
5
5
  interface IMutations {
6
6
  edit: (params: {
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { type IProfileFormProps } from '../../../form';
3
+ import { type IDiscussionFormFns } from '../../../discussion/shared';
3
4
  import { ILikesFeedQueryFns } from '../../../discussion/feeds/likes-feed';
4
- import type { IDiscussionFormFns } from '../../discussion';
5
5
  import { type IQueryFns } from './cache';
6
6
  interface RepliesFunctions {
7
7
  /** Functions for the replies query */
@@ -2,5 +2,4 @@ export * from './components';
2
2
  export * from './feeds';
3
3
  export * from './discussion.helpers';
4
4
  export * from './sections';
5
- export type { IActivity, IFullDiscussionContent, IListMemberData, IMentionData, IMentions, IReaction, IUser, } from './shared/interfaces';
6
- export type { IDiscussionFormFns } from './discussion.d';
5
+ export * from './shared/interfaces';
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { type IProfileFormProps } from '../../../form';
3
3
  import { type IRepliesFeedQueryFns, type ILikesFeedQueryFns } from '../../../discussion/feeds';
4
- import type { IDiscussionFormFns } from './../../discussion.d';
4
+ import type { IDiscussionFormFns } from '../../../discussion/shared';
5
5
  import { type IQueryFns } from './cache';
6
6
  import { ICategory } from '../../shared';
7
7
  interface IActivitySectionQueryFns extends IQueryFns {
@@ -1,3 +1,4 @@
1
1
  export declare const ACTIVITY_VERB = "post";
2
2
  export declare const REPLY_KIND = "reply";
3
3
  export declare const TMP_ID = "00000000-0000-0000-0000-000000000000";
4
+ export declare const DEFAULT_LOCALE = "en";
@@ -1,4 +1,5 @@
1
1
  export * from './activity.helper';
2
- export * from './reply.helper';
3
2
  export * from './cache.helper';
3
+ export * from './poll.helper';
4
+ export * from './reply.helper';
4
5
  export { default as triggerDiscussionPostAdded } from './trigger-discussion-post-added';
@@ -0,0 +1,23 @@
1
+ import type { IPollOption } from '../../../polls';
2
+ import { type IActivity } from '../interfaces/activity.interface';
3
+ import type { IUserContext } from '../../../context';
4
+ import { ICache } from './cache.helper';
5
+ import { ICacheItem } from '../../feeds/activities-feed/cache';
6
+ interface IPreparePollVoteArgs {
7
+ activity: IActivity;
8
+ reactionId: string;
9
+ user?: IUserContext;
10
+ }
11
+ interface IEnrichPollVoteArgs extends IPreparePollVoteArgs {
12
+ correctReactionId: string;
13
+ }
14
+ interface IRemovePollVoteArgs {
15
+ cache: ICache<ICacheItem>;
16
+ activityId: string;
17
+ reactionId: string;
18
+ }
19
+ export declare const getActivityPollOptions: (pollOption: ICacheItem, locale?: string) => IPollOption[];
20
+ export declare function preparePollVote({ activity, reactionId, user }: IPreparePollVoteArgs): void;
21
+ export declare function enrichPollVote({ activity, reactionId, correctReactionId, user, }: IEnrichPollVoteArgs): void;
22
+ export declare function removePollVote({ cache, activityId, reactionId }: IRemovePollVoteArgs): ICache<IActivity>;
23
+ export {};
@@ -1,13 +1,28 @@
1
1
  import type { FlatActivityEnriched } from 'getstream';
2
2
  import type { IEnrichedUrlData } from '../../../navigation/enriched-url';
3
+ import { ResultsVisibility } from '../../../polls/poll';
4
+ export declare enum ActivityType {
5
+ Post = "post",
6
+ Poll = "poll"
7
+ }
3
8
  export interface IActivity extends FlatActivityEnriched {
4
9
  content: string;
5
10
  categories?: string[];
6
11
  feed_id?: string;
7
- title: string;
12
+ title: string | {
13
+ [key: string]: string;
14
+ };
8
15
  total_replies?: number;
9
16
  total_likes?: number;
10
17
  additional_data?: {
11
18
  link?: IEnrichedUrlData | false | undefined;
12
19
  };
20
+ settings?: {
21
+ show_remove_vote?: boolean;
22
+ allow_multiple_votes?: boolean;
23
+ deadline_at?: string;
24
+ hide_participants?: boolean;
25
+ number_of_winners?: number;
26
+ results_visibility?: ResultsVisibility;
27
+ };
13
28
  }
@@ -1,9 +1,9 @@
1
- import { MemberProps, MemberDetailsProps } from '../../../user';
1
+ import type { MemberProps, MemberDetailsProps } from '../../../user';
2
2
  import type { ListMembers, ClickMentionFallback } from '../../../form';
3
3
  import type { IEnrichedUrlData } from '../../../navigation';
4
4
  import type { ICategory } from './community.category.interface';
5
- import type { IDiscussionFormFns } from '../../discussion';
6
- export type IDiscussionContentType = 'answer' | 'post' | 'response' | 'reply' | 'question';
5
+ import type { ILikesFeedQueryFns } from '../../../discussion/feeds/likes-feed';
6
+ export type IDiscussionContentType = 'answer' | 'post' | 'response' | 'reply' | 'question' | 'poll';
7
7
  export interface IDiscussionContent {
8
8
  /** The type of content */
9
9
  type: IDiscussionContentType;
@@ -22,7 +22,9 @@ export interface IFullDiscussionContent extends IDiscussionContent {
22
22
  /** The content slug */
23
23
  slug: string;
24
24
  /** The title of the content post */
25
- title?: string;
25
+ title?: string | {
26
+ [key: string]: string;
27
+ };
26
28
  /** The body of the content post */
27
29
  body?: string;
28
30
  /** The author of the post */
@@ -64,6 +66,7 @@ export type IForceHide = {
64
66
  export type DiscussionCreateContentFunction = (args1: void | object, args2?: object) => void;
65
67
  export type DiscussionCreateLikeFunction = (args1: object) => void;
66
68
  export type DiscussionDeleteLikeFunction = (args: object) => void;
69
+ export type DiscussionListLikesFunction = ILikesFeedQueryFns['list'];
67
70
  export interface IMentions {
68
71
  [key: string]: IMentionData;
69
72
  }
@@ -79,6 +82,14 @@ export interface IMentionData {
79
82
  /** An error message, shown if the user was deleted */
80
83
  error?: string;
81
84
  }
85
+ export interface IDiscussionFormFns {
86
+ /** A function to get a filtered list of members when the user starts typing a mention */
87
+ listMembers: ListMembers;
88
+ /** A function to call when the user clicks the mention fallback, e.g. to show an invite modal */
89
+ clickMentionFallback: ClickMentionFallback;
90
+ /** Get metadata about a link, to show an enriched URL */
91
+ getLinkPreview?: (url: string) => Promise<IEnrichedUrlData>;
92
+ }
82
93
  export interface IMentionsFns {
83
94
  listMembers: ListMembers;
84
95
  clickMentionFallback: ClickMentionFallback;
@@ -1,5 +1,5 @@
1
1
  import type { EnrichedReaction } from 'getstream';
2
- import type { IMentions } from './../../discussion.d';
2
+ import type { IMentions } from '../../../discussion/shared';
3
3
  export interface IReaction extends EnrichedReaction {
4
4
  /** Details of users mentioned in the content */
5
5
  mentioned_users?: IMentions;
@@ -1,5 +1,5 @@
1
- import { FieldOnChange, IFieldFunctions } from '../../../form/components/form/form.types';
1
+ import { IFieldFunctions } from '../../../form/components/form/form.types';
2
2
  export declare const getValueLength: (value: string | number | boolean | null | undefined) => number;
3
- export declare const getCharacterLimitProps: (limit: number, onChange?: FieldOnChange | null) => {
3
+ export declare const getCharacterLimitProps: (limit: number, functions: IFieldFunctions) => {
4
4
  [key: string]: number | IFieldFunctions;
5
5
  };
@@ -1,3 +1,3 @@
1
1
  import { IFieldWrapper } from '../../form.types';
2
- declare const FieldWrapper: ({ id, intlPath, className, error, functions, limit, showRequiredLabels, type, validation, value, submitOnEnter, ...props }: IFieldWrapper) => import("react/jsx-runtime").JSX.Element;
2
+ declare const FieldWrapper: (fieldWrapperProps: IFieldWrapper) => import("react/jsx-runtime").JSX.Element;
3
3
  export default FieldWrapper;
@@ -27,6 +27,12 @@ export declare const Checkbox: ({ className, disabled, element, functions: allFu
27
27
  topbar?: boolean | undefined;
28
28
  submitSection?: boolean | undefined;
29
29
  } | undefined;
30
+ multipleInputs?: {
31
+ showCount?: boolean | undefined;
32
+ label?: string | undefined;
33
+ maxInputs: number;
34
+ hasButton?: false | import("../../../../../..").ButtonPropsType | undefined;
35
+ } | undefined;
30
36
  name?: string | undefined;
31
37
  options?: import("../../../form.types").IFieldOption[] | undefined;
32
38
  placeholder?: string | undefined;
@@ -35,6 +41,9 @@ export declare const Checkbox: ({ className, disabled, element, functions: allFu
35
41
  } | undefined;
36
42
  required?: boolean | undefined;
37
43
  submitOnEnter?: boolean | undefined;
44
+ styling?: {
45
+ displayOptionsAsPills?: boolean | undefined;
46
+ } | undefined;
38
47
  validation?: import("../../../form.types").IFieldValidation[] | undefined;
39
48
  onClick: (e: React.MouseEvent<HTMLElement>) => void;
40
49
  className: string;
@@ -2,5 +2,6 @@ export * from './input';
2
2
  export * from './input-autocomplete';
3
3
  export * from './checkbox';
4
4
  export * from './dropdown-menu';
5
+ export * from './multiple-inputs';
5
6
  export * from './multiple-options';
6
7
  export * from './password';
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { IField, InputTypes, InputValues } from '../../../form.types';
3
- export declare const Input: ({ className, element, id, inputRef: ref, functions, name, placeholder, type, value, autoFocus, ...props }: IField) => React.DOMElement<{
3
+ export declare const Input: ({ className, element, id, inputRef: ref, functions, name, placeholder, type, value, autoFocus, label, ...props }: IField) => React.DOMElement<{
4
4
  onChange: (e: React.FormEvent<HTMLInputElement>) => void;
5
5
  onMultiSelectSubmit?: ((arg1: import("../../../form.types").FormValues) => void) | undefined;
6
6
  onBlur?: (() => void) | undefined;
@@ -35,13 +35,18 @@ export declare const Input: ({ className, element, id, inputRef: ref, functions,
35
35
  } | undefined;
36
36
  initialValue?: import("../../../form.types").FormValues;
37
37
  intlPath?: string | false | undefined;
38
- label?: React.ReactNode;
39
38
  limit?: number | undefined;
40
39
  multiSelect?: boolean | undefined;
41
40
  multiSelectOptions?: {
42
41
  topbar?: boolean | undefined;
43
42
  submitSection?: boolean | undefined;
44
43
  } | undefined;
44
+ multipleInputs?: {
45
+ showCount?: boolean | undefined;
46
+ label?: string | undefined;
47
+ maxInputs: number;
48
+ hasButton?: false | import("../../../../../..").ButtonPropsType | undefined;
49
+ } | undefined;
45
50
  options?: import("../../../form.types").IFieldOption[] | undefined;
46
51
  props?: {
47
52
  [key: string]: string | number | boolean | object | React.RefObject<any> | (() => void);
@@ -49,6 +54,9 @@ export declare const Input: ({ className, element, id, inputRef: ref, functions,
49
54
  required?: boolean | undefined;
50
55
  shownValue?: InputValues | undefined;
51
56
  submitOnEnter?: boolean | undefined;
57
+ styling?: {
58
+ displayOptionsAsPills?: boolean | undefined;
59
+ } | undefined;
52
60
  validation?: import("../../../form.types").IFieldValidation[] | undefined;
53
61
  ref: React.RefObject<HTMLInputElement>;
54
62
  }, HTMLInputElement>;
@@ -0,0 +1 @@
1
+ export { default as MultipleInputs } from './multiple-inputs';
@@ -0,0 +1,3 @@
1
+ import type { IFieldWrapper } from '../../../form.types';
2
+ export declare const MultipleInputs: ({ id, label: legend, limit, value, placeholder, functions, error: allFormErrors, multipleInputs, validation, fieldData, type, ...props }: IFieldWrapper) => import("react/jsx-runtime").JSX.Element;
3
+ export default MultipleInputs;
@@ -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, accessibilityOptions, styling: { displayOptionsAsPills }, ...props }: IField) => import("react/jsx-runtime").JSX.Element;
3
3
  export default MultipleOptions;
@@ -0,0 +1,2 @@
1
+ import type { InputValues } from './form.types';
2
+ export declare const showError: (type: string, value: InputValues) => boolean;
@@ -5,10 +5,12 @@ import { IntlShape } from 'react-intl';
5
5
  export type InputValues = string | number | boolean | null;
6
6
  export type MultipleInputValues = InputValues[];
7
7
  export type FormValues = InputValues | MultipleInputValues | undefined;
8
- export type InputTypes = 'text' | 'textarea' | 'email' | 'url' | 'checkbox' | 'select' | 'radio' | 'password' | 'autocomplete' | 'number';
8
+ export type InputTypes = 'text' | 'textarea' | 'email' | 'url' | 'checkbox' | 'checkboxes' | 'select' | 'radio' | 'password' | 'autocomplete' | 'number' | 'multiple-inputs';
9
9
  export interface ILabel {
10
10
  /** The element to be used, defaulting to `label` */
11
11
  element?: string;
12
+ /** Optional class for the label */
13
+ className?: string;
12
14
  /** The ID of the input to be labelled */
13
15
  htmlFor?: string;
14
16
  }
@@ -41,13 +43,14 @@ export interface IFormPayload {
41
43
  /** Function to call when something fails */
42
44
  onFailure?: (arg: IFormValues, arg2?: FormValues) => void;
43
45
  }
46
+ interface IFormErrors {
47
+ [key: string]: (() => void) | FormValues;
48
+ }
44
49
  export interface IFormReducerAction extends IReducerAction<IFormPayload> {
45
50
  }
46
51
  export interface IFormReducerState {
47
52
  'custom-validation'?: string | boolean;
48
- errors?: {
49
- [key: string]: (() => void) | FormValues;
50
- };
53
+ errors?: IFormErrors;
51
54
  formSubmitted: boolean;
52
55
  isSubmitting: boolean;
53
56
  values?: IFormValues;
@@ -132,7 +135,7 @@ export interface IField {
132
135
  /** The internationalisation path for the field */
133
136
  intlPath?: string | false;
134
137
  /** The label for the field */
135
- label?: string | React.ReactNode;
138
+ label?: string | React.ReactNode | false;
136
139
  /** An optional character limit, for textareas */
137
140
  limit?: number;
138
141
  /** Whether the field can have multiple values, for checkboxes */
@@ -144,6 +147,17 @@ export interface IField {
144
147
  /** Whether to display the submit button in the dropdown - this allows the user to submit the dropdown only */
145
148
  submitSection?: boolean;
146
149
  };
150
+ /** Props for the inputs rendered in a `multiple` field */
151
+ multipleInputs?: {
152
+ /** Whether or not to show the number of filled in inputs in the legend */
153
+ showCount?: boolean;
154
+ /** The template text for each label */
155
+ label?: string;
156
+ /** How many inputs can be added in total */
157
+ maxInputs: number;
158
+ /** Whether to add options with a button */
159
+ hasButton?: false | ButtonPropsType;
160
+ };
147
161
  /** The name of the field */
148
162
  name?: string;
149
163
  /** The options for the field, for checkboxes and dropdowns */
@@ -160,8 +174,12 @@ export interface IField {
160
174
  shownValue?: InputValues;
161
175
  /** Whether hitting enter on the field should submit the form */
162
176
  submitOnEnter?: boolean;
177
+ styling?: {
178
+ /** Whether to display options for the multiselect as pills */
179
+ displayOptionsAsPills?: boolean;
180
+ };
163
181
  /** The type of the input */
164
- type?: InputTypes | 'checkboxes';
182
+ type?: InputTypes;
165
183
  /** The validation for the field */
166
184
  validation?: IFieldValidation[];
167
185
  /** The value of the field */
@@ -239,9 +257,16 @@ export interface IFormProps {
239
257
  }
240
258
  export interface IFieldWrapper extends IField {
241
259
  /** The error to show */
242
- error: string;
260
+ error: string | IFormErrors | undefined;
243
261
  /** Whether the field wrapper should show required labels */
244
262
  showRequiredLabels?: boolean;
245
263
  /** The value of the field */
246
264
  value?: FormValues;
265
+ /** The setter to amend the fields to validate; this is needed for multiple inputs, to give each input its own error handling */
266
+ fieldData?: {
267
+ fields: IField[];
268
+ setFields: React.Dispatch<React.SetStateAction<IField[]>>;
269
+ dispatch: React.Dispatch<IFormReducerAction>;
270
+ };
247
271
  }
272
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { Dispatch } from 'react';
2
2
  import { Point } from 'slate';
3
- import { IListMemberData } from '../../../../../discussion';
3
+ import type { IListMemberData } from '../../../../../discussion/shared';
4
4
  import type { IEnrichedUrlData } from '../../../../../navigation';
5
5
  import { ReportError, IMentionPopOver } from './../../rich-text-editor.types';
6
6
  declare const RichTextEditorContext: import("react").Context<{
@@ -1,5 +1,5 @@
1
1
  import { BaseElement, BaseText, Descendant, Point, Range } from 'slate';
2
- import type { IListMemberData, IMentions, IDiscussionFormFns } from '../../../discussion';
2
+ import type { IListMemberData, IMentions, IDiscussionFormFns } from '../../../discussion/shared';
3
3
  import type { MemberDetailsProps } from '../../../user';
4
4
  import type { IEnrichedUrlData } from '../../../navigation';
5
5
  interface IRTEData {