@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
package/styles/base/_text.scss
CHANGED
|
@@ -20,13 +20,13 @@ $sup: ('font-size': 10);
|
|
|
20
20
|
font-size: px-to-rem(map.get($default, 'font-size'));
|
|
21
21
|
line-height: px-to-rem(map.get($default, 'line-height'));
|
|
22
22
|
|
|
23
|
-
.text-small
|
|
23
|
+
.text-small &, &.text-small {
|
|
24
24
|
font-size: px-to-rem(map.get($small, 'font-size'));
|
|
25
25
|
line-height: px-to-rem(map.get($small, 'line-height'));
|
|
26
26
|
letter-spacing: px-to-rem(map.get($small, 'letter-spacing'));
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
.text-medium
|
|
29
|
+
.text-medium &, &.text-medium {
|
|
30
30
|
font-size: px-to-rem(map.get($medium, 'font-size'));
|
|
31
31
|
line-height: px-to-rem(map.get($medium, 'line-height'));
|
|
32
32
|
}
|
|
@@ -35,11 +35,11 @@ $sup: ('font-size': 10);
|
|
|
35
35
|
font-size: px-to-rem(map.get($default, 'font-size_md'));
|
|
36
36
|
line-height: px-to-rem(map.get($default, 'line-height_md'));
|
|
37
37
|
|
|
38
|
-
.text-small
|
|
38
|
+
.text-small &, &.text-small {
|
|
39
39
|
font-size: px-to-rem(map.get($small, 'font-size_md'));
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
.text-medium
|
|
42
|
+
.text-medium &, &.text-medium {
|
|
43
43
|
font-size: px-to-rem(map.get($medium, 'font-size_md'));
|
|
44
44
|
line-height: px-to-rem(map.get($medium, 'line-height_md'));
|
|
45
45
|
}
|
|
@@ -49,9 +49,9 @@ $sup: ('font-size': 10);
|
|
|
49
49
|
p {
|
|
50
50
|
margin-bottom: px-to-rem(map.get($default, 'margin-bottom'));
|
|
51
51
|
|
|
52
|
-
.text-small
|
|
52
|
+
.text-small &, &.text-small { margin-bottom: px-to-rem(map.get($small, 'margin-bottom')); }
|
|
53
53
|
|
|
54
|
-
.text-medium
|
|
54
|
+
.text-medium &, &.text-medium { margin-bottom: px-to-rem(map.get($medium, 'margin-bottom')); }
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
small {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@import './../../functions',
|
|
3
|
+
'./../../mixins',
|
|
4
|
+
'./../../variables';
|
|
5
|
+
|
|
6
|
+
$button-wrapper-button: ('margin': 12);
|
|
7
|
+
|
|
8
|
+
@layer base {
|
|
9
|
+
.button-wrapper {
|
|
10
|
+
list-style: none;
|
|
11
|
+
margin: 0 auto;
|
|
12
|
+
padding: 0;
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-flow: row wrap;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
align-content: center;
|
|
17
|
+
|
|
18
|
+
li, > button, > .button {
|
|
19
|
+
margin: 0 px-to-rem(map.get($button-wrapper-button, 'margin')) px-to-rem(map.get($button-wrapper-button, 'margin')) px-to-rem(map.get($button-wrapper-button, 'margin'));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
li {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-content: center;
|
|
25
|
+
|
|
26
|
+
&:last-child { margin-bottom: px-to-rem(map.get($button-wrapper-button, 'margin')); }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
button, .button {
|
|
30
|
+
margin-top: auto;
|
|
31
|
+
margin-bottom: auto;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
@import 'buttons'
|
|
1
|
+
@import 'buttons',
|
|
2
|
+
'button-wrapper';
|
|
@@ -98,6 +98,15 @@ $theme: (
|
|
|
98
98
|
marketing-block_secondary_bg_2: map.get($c, 'g100'),
|
|
99
99
|
marketing-block_tertiary_bg_2: map.get($c, 'p600'),
|
|
100
100
|
|
|
101
|
+
// Discussion
|
|
102
|
+
discussion-form_bg: map.get($c, 'b50'),
|
|
103
|
+
discussion-form_placeholder: map.get($c, 'n500'),
|
|
104
|
+
discussion-form_small: map.get($c, 'n700'),
|
|
105
|
+
|
|
106
|
+
discussion-likes: map.get($c, 'n600'),
|
|
107
|
+
discussion-likes_liked: map.get($c, 'p500'),
|
|
108
|
+
discussion-likes_liked_bg: map.get($c, 'p500'),
|
|
109
|
+
|
|
101
110
|
// Form
|
|
102
111
|
password-rules: map.get($c, 'error600'),
|
|
103
112
|
password-rules_matches: map.get($c, 'success500'),
|
|
@@ -189,6 +198,9 @@ $theme: (
|
|
|
189
198
|
|
|
190
199
|
|
|
191
200
|
// Text
|
|
201
|
+
alert_success: map.get($c, 'success600'),
|
|
202
|
+
alert_error: map.get($c, 'error600'),
|
|
203
|
+
|
|
192
204
|
collapsible-section_bg: map.get($c, 'white'),
|
|
193
205
|
collapsible-section_border: map.get($c, 'n500'),
|
|
194
206
|
collapsible-section_icon: map.get($c, 'n900'),
|
|
@@ -216,5 +228,10 @@ $theme: (
|
|
|
216
228
|
|
|
217
229
|
pill: map.get($c, 'n700'),
|
|
218
230
|
pill_bg: map.get($c, 'y300'),
|
|
231
|
+
|
|
232
|
+
// User
|
|
233
|
+
member_highlighted_name: map.get($c, 'p500'),
|
|
234
|
+
member_additional-content: map.get($c, 'n700'),
|
|
235
|
+
member_small: map.get($c, 'n700')
|
|
219
236
|
);
|
|
220
237
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
/** The element that will render around the content */
|
|
4
|
+
element?: 'span' | 'small' | 'strong' | 'em' | 'p' | 'li';
|
|
5
|
+
/** The content to be hidden from screen readers */
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
/** Optional ID, for errors */
|
|
8
|
+
id?: string;
|
|
9
|
+
/** Additional classes */
|
|
10
|
+
className?: string;
|
|
11
|
+
/** Test ID for Jest tests */
|
|
12
|
+
'data-testid'?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const Alert: ({ element, children, className, ...props }: Props) => React.DetailedReactHTMLElement<{
|
|
15
|
+
className: string;
|
|
16
|
+
'aria-live': "assertive";
|
|
17
|
+
/** Optional ID, for errors */
|
|
18
|
+
id?: string | undefined;
|
|
19
|
+
/** Test ID for Jest tests */
|
|
20
|
+
'data-testid'?: string | undefined;
|
|
21
|
+
}, HTMLElement>;
|
|
22
|
+
export default Alert;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Alert } from './alert';
|
package/text/index.d.ts
CHANGED
package/user/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Member } from './member';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type MemberProps = 'apolitical' | 'community' | {
|
|
2
|
+
id?: string;
|
|
3
|
+
slug?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
jobTitle?: string;
|
|
6
|
+
organization?: string;
|
|
7
|
+
location?: {
|
|
8
|
+
country?: string;
|
|
9
|
+
};
|
|
10
|
+
image?: {
|
|
11
|
+
thumbnail?: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
interface Props {
|
|
15
|
+
/** Details about the Apolitical member */
|
|
16
|
+
member?: MemberProps;
|
|
17
|
+
/** Additional content to show with the member details */
|
|
18
|
+
additionalContent?: false | {
|
|
19
|
+
createdAt?: Date | string;
|
|
20
|
+
didEdit?: boolean;
|
|
21
|
+
};
|
|
22
|
+
/** The GTM context to use */
|
|
23
|
+
gtmContext?: string;
|
|
24
|
+
/** The GTM event to use */
|
|
25
|
+
gtmType?: string;
|
|
26
|
+
/** Additional classes */
|
|
27
|
+
className?: string;
|
|
28
|
+
/** The language to use for the text */
|
|
29
|
+
locale?: string;
|
|
30
|
+
}
|
|
31
|
+
declare const MemberWrapper: ({ locale, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export default MemberWrapper;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { MemberProps } from './member';
|
|
2
|
+
export declare const getMember: (member: MemberProps) => {
|
|
3
|
+
image: string;
|
|
4
|
+
name?: undefined;
|
|
5
|
+
role?: undefined;
|
|
6
|
+
organisation?: undefined;
|
|
7
|
+
country?: undefined;
|
|
8
|
+
url?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
name: string | undefined;
|
|
11
|
+
role: string;
|
|
12
|
+
organisation: string;
|
|
13
|
+
country: string;
|
|
14
|
+
url: string;
|
|
15
|
+
image: string | undefined;
|
|
16
|
+
};
|
|
17
|
+
export declare const getJob: ({ role, organisation, country, maximumCharacters, }: {
|
|
18
|
+
role?: string | undefined;
|
|
19
|
+
organisation?: string | undefined;
|
|
20
|
+
country?: string | undefined;
|
|
21
|
+
maximumCharacters?: number | undefined;
|
|
22
|
+
}) => string;
|
|
@@ -5,8 +5,12 @@ interface Props {
|
|
|
5
5
|
src?: string;
|
|
6
6
|
/** Alternative text for the image */
|
|
7
7
|
alt?: string | undefined;
|
|
8
|
+
/** Width of the image */
|
|
9
|
+
width?: number;
|
|
10
|
+
/** Height of the image */
|
|
11
|
+
height?: number;
|
|
8
12
|
/** Additional classes */
|
|
9
13
|
className?: string;
|
|
10
14
|
}
|
|
11
|
-
declare const ProfilePicture: ({ className, src, name, alt, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
declare const ProfilePicture: ({ className, src, name, alt, width, height, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
12
16
|
export default ProfilePicture;
|
|
File without changes
|