@apolitical/component-library 5.3.2 → 5.3.4-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.
- package/cards/cards.types.d.ts +19 -0
- package/cards/index.d.ts +1 -0
- package/cards/mocks/index.d.ts +1 -0
- package/cards/mocks/narrow-card.d.ts +30 -0
- package/cards/narrow-card/index.d.ts +1 -0
- package/cards/narrow-card/narrow-card.d.ts +3 -0
- package/discussion/components/add-post/add-post.d.ts +3 -0
- package/discussion/components/form/form.type.d.ts +5 -0
- package/discussion/components/post/post.d.ts +6 -1
- package/discussion/feeds/activities-feed/activities-feed.d.ts +5 -0
- package/discussion/feeds/activities-feed/cache/hooks/list/list.hook.d.ts +5 -2
- package/discussion/feeds/activities-feed/mocks/activities-feed.mock.d.ts +4 -0
- package/discussion/sections/activity-section/activity-section.d.ts +4 -0
- package/discussion/sections/activity-section/mocks/activity-section.mock.d.ts +1 -0
- package/discussion/shared/helpers/activity.helper.d.ts +3 -1
- package/discussion/shared/interfaces/activity.interface.d.ts +1 -0
- package/discussion/shared/interfaces/community.category.interface.d.ts +4 -0
- package/discussion/shared/interfaces/discussion.interface.d.ts +2 -0
- package/discussion/shared/interfaces/index.d.ts +1 -0
- package/form/components/form/components/fields/checkbox/checkbox.d.ts +2 -2
- package/form/components/form/components/fields/input/input.d.ts +5 -0
- package/form/components/form/components/fields/multiple-options/multiple-options.d.ts +1 -1
- package/form/components/form/form.types.d.ts +8 -0
- package/helpers/intl.d.ts +2 -0
- package/index.js +59 -59
- package/index.mjs +6344 -6211
- package/navigation/filters/filters.d.ts +5 -1
- package/package.json +1 -1
- package/style.css +1 -1
- package/styles/base/_accessibility.scss +1 -0
- package/styles/base/_text.scss +1 -1
- package/styles/variables/colors/theme/_cards.scss +4 -0
- package/styles/variables/colors/theme/_navigation.scss +4 -4
package/cards/cards.types.d.ts
CHANGED
|
@@ -148,3 +148,22 @@ export interface IndividualCarouselProps extends BaseCarouselProps {
|
|
|
148
148
|
/** The types for each card, from Contentful */
|
|
149
149
|
cardTypes: CardContentType[];
|
|
150
150
|
}
|
|
151
|
+
export interface NarrowCardType {
|
|
152
|
+
/** The image to use */
|
|
153
|
+
banner?: ResponsiveImageType;
|
|
154
|
+
/** The title of the narrow card */
|
|
155
|
+
title?: string;
|
|
156
|
+
/** The primary text */
|
|
157
|
+
text?: string;
|
|
158
|
+
/** Is the content private */
|
|
159
|
+
isPrivate?: boolean;
|
|
160
|
+
}
|
|
161
|
+
export interface NarrowCardProps {
|
|
162
|
+
/** The card data, from Contentful */
|
|
163
|
+
card: NarrowCardType;
|
|
164
|
+
functions?: {
|
|
165
|
+
onClick?: () => void;
|
|
166
|
+
};
|
|
167
|
+
/** Additional classes */
|
|
168
|
+
className?: string;
|
|
169
|
+
}
|
package/cards/index.d.ts
CHANGED
package/cards/mocks/index.d.ts
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export namespace openCommunityMember {
|
|
2
|
+
namespace banner {
|
|
3
|
+
let description: string;
|
|
4
|
+
let height: number;
|
|
5
|
+
let type: string;
|
|
6
|
+
let url: string;
|
|
7
|
+
let width: number;
|
|
8
|
+
let aspect: string;
|
|
9
|
+
let query: string;
|
|
10
|
+
}
|
|
11
|
+
let title: string;
|
|
12
|
+
let text: string;
|
|
13
|
+
let isPrivate: boolean;
|
|
14
|
+
}
|
|
15
|
+
export namespace openCommunityMemberNoImage {
|
|
16
|
+
let title_1: string;
|
|
17
|
+
export { title_1 as title };
|
|
18
|
+
let text_1: string;
|
|
19
|
+
export { text_1 as text };
|
|
20
|
+
let isPrivate_1: boolean;
|
|
21
|
+
export { isPrivate_1 as isPrivate };
|
|
22
|
+
}
|
|
23
|
+
export namespace closedCommunityMember {
|
|
24
|
+
let isPrivate_2: boolean;
|
|
25
|
+
export { isPrivate_2 as isPrivate };
|
|
26
|
+
}
|
|
27
|
+
export namespace closedCommunityMemberNoImage {
|
|
28
|
+
let isPrivate_3: boolean;
|
|
29
|
+
export { isPrivate_3 as isPrivate };
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as NarrowCard } from './narrow-card';
|
|
@@ -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;
|
|
@@ -23,6 +24,10 @@ export interface IDiscussionFormMeta {
|
|
|
23
24
|
};
|
|
24
25
|
/** Whether title text should show above the form */
|
|
25
26
|
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;
|
|
26
31
|
/** Whether the community guidelines text should show beneath the form */
|
|
27
32
|
showGuidelines?: boolean;
|
|
28
33
|
/** 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
|
-
|
|
6
|
+
filterOption?: {
|
|
7
|
+
id: string;
|
|
8
|
+
type: string;
|
|
9
|
+
};
|
|
7
10
|
}
|
|
8
|
-
export declare function useListActivities({ queryFn, queryKey,
|
|
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;
|
|
@@ -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;
|
|
@@ -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,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
|
|
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;
|