@apolitical/component-library 1.1.1 → 1.1.4
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/discussion/discussion.mock.d.ts +206 -0
- package/discussion/form/form.d.ts +48 -0
- package/discussion/form/index.d.ts +1 -0
- package/discussion/index.d.ts +2 -0
- package/discussion/likes/index.d.ts +1 -0
- package/discussion/likes/likes.d.ts +19 -0
- package/discussion/likes/likes.helpers.d.ts +9 -0
- package/general/{button → buttons/button}/button.d.ts +6 -0
- package/general/buttons/button-wrapper/button-wrapper.d.ts +12 -0
- package/general/buttons/button-wrapper/index.d.ts +1 -0
- package/general/buttons/index.d.ts +2 -0
- package/general/index.d.ts +1 -1
- package/helpers/dates.d.ts +14 -0
- package/helpers/delay.d.ts +2 -0
- package/helpers/index.d.ts +4 -0
- package/helpers/intl.d.ts +3 -0
- package/helpers/validation.d.ts +1 -0
- package/index.d.ts +1 -0
- package/index.js +84 -84
- package/index.mjs +9129 -8651
- package/loaders/loading-placeholder/loading-placeholder.d.ts +2 -0
- package/package.json +1 -1
- package/style.css +1 -1
- package/styles/base/_text.scss +6 -6
- package/styles/base/buttons/_button-wrapper.scss +35 -0
- package/styles/base/buttons/_index.scss +2 -1
- package/styles/base/form/_fields.scss +4 -0
- package/styles/variables/colors/_theme.scss +17 -0
- package/text/alert/alert.d.ts +22 -0
- package/text/alert/index.d.ts +1 -0
- package/text/index.d.ts +1 -0
- package/user/index.d.ts +1 -0
- package/user/member/index.d.ts +1 -0
- package/user/member/member.d.ts +32 -0
- package/user/member/member.helpers.d.ts +22 -0
- package/user/profile-picture/profile-picture.d.ts +5 -1
- /package/general/{button → buttons/button}/index.d.ts +0 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
export namespace authors {
|
|
2
|
+
namespace me {
|
|
3
|
+
let id: string;
|
|
4
|
+
let name: string;
|
|
5
|
+
namespace image {
|
|
6
|
+
let thumbnail: string;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
namespace otherUser {
|
|
10
|
+
let id_1: string;
|
|
11
|
+
export { id_1 as id };
|
|
12
|
+
let name_1: string;
|
|
13
|
+
export { name_1 as name };
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export namespace reply {
|
|
17
|
+
export namespace me_1 {
|
|
18
|
+
export let slug: string;
|
|
19
|
+
import authorId = id;
|
|
20
|
+
export { authorId };
|
|
21
|
+
export let body: string;
|
|
22
|
+
export let likes: number;
|
|
23
|
+
export let isEdited: boolean;
|
|
24
|
+
export let contentType: string;
|
|
25
|
+
export let createdAt: string;
|
|
26
|
+
export let updatedAt: string;
|
|
27
|
+
import author = authors.me;
|
|
28
|
+
export { author };
|
|
29
|
+
export let userLiked: boolean;
|
|
30
|
+
}
|
|
31
|
+
export { me_1 as me };
|
|
32
|
+
export namespace otherUser_1 {
|
|
33
|
+
let slug_1: string;
|
|
34
|
+
export { slug_1 as slug };
|
|
35
|
+
import authorId_1 = id;
|
|
36
|
+
export { authorId_1 as authorId };
|
|
37
|
+
let body_1: string;
|
|
38
|
+
export { body_1 as body };
|
|
39
|
+
let likes_1: number;
|
|
40
|
+
export { likes_1 as likes };
|
|
41
|
+
let isEdited_1: boolean;
|
|
42
|
+
export { isEdited_1 as isEdited };
|
|
43
|
+
let contentType_1: string;
|
|
44
|
+
export { contentType_1 as contentType };
|
|
45
|
+
let createdAt_1: string;
|
|
46
|
+
export { createdAt_1 as createdAt };
|
|
47
|
+
let updatedAt_1: string;
|
|
48
|
+
export { updatedAt_1 as updatedAt };
|
|
49
|
+
import author_1 = authors.otherUser;
|
|
50
|
+
export { author_1 as author };
|
|
51
|
+
let userLiked_1: boolean;
|
|
52
|
+
export { userLiked_1 as userLiked };
|
|
53
|
+
}
|
|
54
|
+
export { otherUser_1 as otherUser };
|
|
55
|
+
}
|
|
56
|
+
export namespace answer {
|
|
57
|
+
export namespace me_2 {
|
|
58
|
+
let id_2: number;
|
|
59
|
+
export { id_2 as id };
|
|
60
|
+
let slug_2: string;
|
|
61
|
+
export { slug_2 as slug };
|
|
62
|
+
let body_2: string;
|
|
63
|
+
export { body_2 as body };
|
|
64
|
+
import author_2 = authors.me;
|
|
65
|
+
export { author_2 as author };
|
|
66
|
+
import authorId_2 = id;
|
|
67
|
+
export { authorId_2 as authorId };
|
|
68
|
+
let userLiked_2: boolean;
|
|
69
|
+
export { userLiked_2 as userLiked };
|
|
70
|
+
let likes_2: number;
|
|
71
|
+
export { likes_2 as likes };
|
|
72
|
+
export let replies: {
|
|
73
|
+
slug: string;
|
|
74
|
+
authorId: string;
|
|
75
|
+
body: string;
|
|
76
|
+
likes: number;
|
|
77
|
+
isEdited: boolean;
|
|
78
|
+
contentType: string;
|
|
79
|
+
createdAt: string;
|
|
80
|
+
updatedAt: string;
|
|
81
|
+
author: {
|
|
82
|
+
id: string;
|
|
83
|
+
name: string;
|
|
84
|
+
};
|
|
85
|
+
userLiked: boolean;
|
|
86
|
+
}[];
|
|
87
|
+
let createdAt_2: string;
|
|
88
|
+
export { createdAt_2 as createdAt };
|
|
89
|
+
let updatedAt_2: string;
|
|
90
|
+
export { updatedAt_2 as updatedAt };
|
|
91
|
+
}
|
|
92
|
+
export { me_2 as me };
|
|
93
|
+
export namespace otherUser_2 {
|
|
94
|
+
let id_3: number;
|
|
95
|
+
export { id_3 as id };
|
|
96
|
+
let slug_3: string;
|
|
97
|
+
export { slug_3 as slug };
|
|
98
|
+
let body_3: string;
|
|
99
|
+
export { body_3 as body };
|
|
100
|
+
import author_3 = authors.otherUser;
|
|
101
|
+
export { author_3 as author };
|
|
102
|
+
import authorId_3 = id;
|
|
103
|
+
export { authorId_3 as authorId };
|
|
104
|
+
let userLiked_3: boolean;
|
|
105
|
+
export { userLiked_3 as userLiked };
|
|
106
|
+
let likes_3: number;
|
|
107
|
+
export { likes_3 as likes };
|
|
108
|
+
let replies_1: {
|
|
109
|
+
slug: string;
|
|
110
|
+
authorId: string;
|
|
111
|
+
body: string;
|
|
112
|
+
likes: number;
|
|
113
|
+
isEdited: boolean;
|
|
114
|
+
contentType: string;
|
|
115
|
+
createdAt: string;
|
|
116
|
+
updatedAt: string;
|
|
117
|
+
author: {
|
|
118
|
+
id: string;
|
|
119
|
+
name: string;
|
|
120
|
+
};
|
|
121
|
+
userLiked: boolean;
|
|
122
|
+
}[];
|
|
123
|
+
export { replies_1 as replies };
|
|
124
|
+
let createdAt_3: string;
|
|
125
|
+
export { createdAt_3 as createdAt };
|
|
126
|
+
let updatedAt_3: string;
|
|
127
|
+
export { updatedAt_3 as updatedAt };
|
|
128
|
+
}
|
|
129
|
+
export { otherUser_2 as otherUser };
|
|
130
|
+
export namespace otherUserLiked {
|
|
131
|
+
let id_4: number;
|
|
132
|
+
export { id_4 as id };
|
|
133
|
+
let slug_4: string;
|
|
134
|
+
export { slug_4 as slug };
|
|
135
|
+
let body_4: string;
|
|
136
|
+
export { body_4 as body };
|
|
137
|
+
import author_4 = authors.otherUser;
|
|
138
|
+
export { author_4 as author };
|
|
139
|
+
import authorId_4 = id;
|
|
140
|
+
export { authorId_4 as authorId };
|
|
141
|
+
let userLiked_4: boolean;
|
|
142
|
+
export { userLiked_4 as userLiked };
|
|
143
|
+
let likes_4: number;
|
|
144
|
+
export { likes_4 as likes };
|
|
145
|
+
let replies_2: {
|
|
146
|
+
slug: string;
|
|
147
|
+
authorId: string;
|
|
148
|
+
body: string;
|
|
149
|
+
likes: number;
|
|
150
|
+
isEdited: boolean;
|
|
151
|
+
contentType: string;
|
|
152
|
+
createdAt: string;
|
|
153
|
+
updatedAt: string;
|
|
154
|
+
author: {
|
|
155
|
+
id: string;
|
|
156
|
+
name: string;
|
|
157
|
+
};
|
|
158
|
+
userLiked: boolean;
|
|
159
|
+
}[];
|
|
160
|
+
export { replies_2 as replies };
|
|
161
|
+
let createdAt_4: string;
|
|
162
|
+
export { createdAt_4 as createdAt };
|
|
163
|
+
let updatedAt_4: string;
|
|
164
|
+
export { updatedAt_4 as updatedAt };
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
export namespace question {
|
|
168
|
+
export let title: string;
|
|
169
|
+
let slug_5: string;
|
|
170
|
+
export { slug_5 as slug };
|
|
171
|
+
export let answers: {
|
|
172
|
+
id: number;
|
|
173
|
+
slug: string;
|
|
174
|
+
body: string;
|
|
175
|
+
author: {
|
|
176
|
+
id: string;
|
|
177
|
+
name: string;
|
|
178
|
+
};
|
|
179
|
+
authorId: string;
|
|
180
|
+
userLiked: boolean;
|
|
181
|
+
likes: number;
|
|
182
|
+
replies: {
|
|
183
|
+
slug: string;
|
|
184
|
+
authorId: string;
|
|
185
|
+
body: string;
|
|
186
|
+
likes: number;
|
|
187
|
+
isEdited: boolean;
|
|
188
|
+
contentType: string;
|
|
189
|
+
createdAt: string;
|
|
190
|
+
updatedAt: string;
|
|
191
|
+
author: {
|
|
192
|
+
id: string;
|
|
193
|
+
name: string;
|
|
194
|
+
};
|
|
195
|
+
userLiked: boolean;
|
|
196
|
+
}[];
|
|
197
|
+
createdAt: string;
|
|
198
|
+
updatedAt: string;
|
|
199
|
+
}[];
|
|
200
|
+
import authorId_5 = id;
|
|
201
|
+
export { authorId_5 as authorId };
|
|
202
|
+
import author_5 = authors.me;
|
|
203
|
+
export { author_5 as author };
|
|
204
|
+
let createdAt_5: string;
|
|
205
|
+
export { createdAt_5 as createdAt };
|
|
206
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IDiscussionContent } from './../discussion';
|
|
3
|
+
interface Props {
|
|
4
|
+
/** Information about the content being created/edited */
|
|
5
|
+
content: IDiscussionContent;
|
|
6
|
+
/** Information about the form */
|
|
7
|
+
meta?: {
|
|
8
|
+
/** Whether the form data is still loading */
|
|
9
|
+
isLoading?: boolean;
|
|
10
|
+
/** Whether the form is in a wrapper or not - used for styling */
|
|
11
|
+
isInWrapper?: boolean;
|
|
12
|
+
/** Whether we're editing or creating */
|
|
13
|
+
isEditing: false | {
|
|
14
|
+
text?: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
/** The `ref` for the input, if we need to have control over it in the parent */
|
|
18
|
+
inputRef?: React.Ref<HTMLTextAreaElement> | undefined;
|
|
19
|
+
/** The maximum number of characters */
|
|
20
|
+
maxLength?: number;
|
|
21
|
+
/** The minimum number of rows */
|
|
22
|
+
minRows?: number;
|
|
23
|
+
/** Force elements on the form to show, regardless of the form state */
|
|
24
|
+
forceShow?: {
|
|
25
|
+
/** If the cancel button should always show */
|
|
26
|
+
cancel?: boolean;
|
|
27
|
+
/** If an error, created externally, should always show */
|
|
28
|
+
error?: false | string;
|
|
29
|
+
};
|
|
30
|
+
/** The functions that are passed in to handle the functionality */
|
|
31
|
+
functions: {
|
|
32
|
+
create: (args1: void | object, args2?: object) => void;
|
|
33
|
+
handleSaveEdit?: () => void;
|
|
34
|
+
handleCancel?: () => void;
|
|
35
|
+
callback?: (args: void) => void;
|
|
36
|
+
props?: {
|
|
37
|
+
create: {
|
|
38
|
+
projectNames: ['questions-answers'];
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
/** The context for GTM */
|
|
43
|
+
gtmContext?: string;
|
|
44
|
+
/** The language to use for the text */
|
|
45
|
+
locale?: string;
|
|
46
|
+
}
|
|
47
|
+
declare const DiscussionFormWrapper: ({ locale, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
export default DiscussionFormWrapper;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as DiscussionForm } from './form';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as DiscussionLikes } from './likes';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IDiscussionContent } from './../discussion';
|
|
2
|
+
interface Props {
|
|
3
|
+
/** The number of likes the content has had */
|
|
4
|
+
likes?: number;
|
|
5
|
+
/** Whether the user has liked the content */
|
|
6
|
+
userLiked?: boolean;
|
|
7
|
+
/** Information about the content being liked */
|
|
8
|
+
content?: IDiscussionContent;
|
|
9
|
+
/** If the user is able to like the content (e.g. they can't like their own content) */
|
|
10
|
+
canLike?: boolean;
|
|
11
|
+
/** Function to create a like */
|
|
12
|
+
createLike?: (args1: object, args2: object) => void;
|
|
13
|
+
/** Function to delete a like */
|
|
14
|
+
deleteLike?: (args: object) => void;
|
|
15
|
+
/** The language to use for the text */
|
|
16
|
+
locale?: string;
|
|
17
|
+
}
|
|
18
|
+
declare const LikesWrapper: ({ locale, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export default LikesWrapper;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const createSlugsPayload: ({ question, answer, reply, }: {
|
|
2
|
+
question?: string | undefined;
|
|
3
|
+
answer?: string | undefined;
|
|
4
|
+
reply?: string | undefined;
|
|
5
|
+
}) => {
|
|
6
|
+
replySlug?: string | undefined;
|
|
7
|
+
answerSlug?: string | undefined;
|
|
8
|
+
questionSlug?: string | undefined;
|
|
9
|
+
};
|
|
@@ -45,6 +45,12 @@ export interface ButtonPropsType {
|
|
|
45
45
|
children?: false | string | React.ReactNode;
|
|
46
46
|
/** The target, for links */
|
|
47
47
|
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
48
|
+
/** The GTM event type */
|
|
49
|
+
'data-gtm-event-type'?: string;
|
|
50
|
+
/** The GTM event context */
|
|
51
|
+
'data-gtm-event-context'?: string;
|
|
52
|
+
/** The test ID for Jest tests */
|
|
53
|
+
'data-testid'?: string;
|
|
48
54
|
}
|
|
49
55
|
declare const Button: ({ variant, size, styling, icon, href, element, onClick, className, disabled, screenreaderText, children, ...rest }: ButtonPropsType) => React.DOMElement<{
|
|
50
56
|
[key: string]: string | boolean | addClasses.ArgumentArray | ((e: React.MouseEvent<HTMLElement>) => void);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ButtonPropsType } from './../button';
|
|
3
|
+
interface Props {
|
|
4
|
+
/** The props for each button */
|
|
5
|
+
buttons: ButtonPropsType[];
|
|
6
|
+
/** Additional classes */
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const ButtonWrapper: ({ buttons, className, ...props }: Props) => React.DetailedReactHTMLElement<{
|
|
10
|
+
className: string;
|
|
11
|
+
}, HTMLElement>;
|
|
12
|
+
export default ButtonWrapper;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ButtonWrapper } from './button-wrapper';
|
package/general/index.d.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type DateType = Date | string;
|
|
2
|
+
export declare const getMonth: (date: DateType, locale?: string) => string;
|
|
3
|
+
export declare const getNumericDay: (date: DateType, locale?: string) => string;
|
|
4
|
+
export declare const getShortDate: (date: DateType, locale?: string) => string;
|
|
5
|
+
export declare const getDateWithYear: (date: DateType, locale?: string) => string;
|
|
6
|
+
export declare const getLongDate: (date: DateType, locale?: string) => string;
|
|
7
|
+
export declare const getShortDateHowLongAgo: (dateInPast: Date | string) => "" | {
|
|
8
|
+
path: string;
|
|
9
|
+
number?: undefined;
|
|
10
|
+
} | {
|
|
11
|
+
path: string;
|
|
12
|
+
number: number;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
package/helpers/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export { default as basicReducer } from './basic-reducer';
|
|
2
2
|
export * from './breakpoints';
|
|
3
|
+
export * from './dates';
|
|
4
|
+
export { default as delay } from './delay';
|
|
5
|
+
export * from './intl';
|
|
3
6
|
export { default as IntlWrapper } from './intl-wrapper';
|
|
4
7
|
export { default as passPropsToChildren } from './pass-props-to-children';
|
|
5
8
|
export * from './test-utils';
|
|
9
|
+
export * from './validation';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const valueIsNotEmpty: (value: string) => boolean;
|