@apolitical/component-library 1.1.5 → 1.3.0-beta.1

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 (47) hide show
  1. package/communities/community-details/community-details.d.ts +7 -0
  2. package/communities/community-details/index.d.ts +1 -0
  3. package/communities/index.d.ts +2 -0
  4. package/communities/join-button/index.d.ts +2 -0
  5. package/communities/join-button/join-button.d.ts +15 -0
  6. package/discussion/conversation/conversation.d.ts +13 -0
  7. package/discussion/conversation/index.d.ts +1 -0
  8. package/discussion/discussion.helpers.d.ts +5 -0
  9. package/discussion/form/form.d.ts +3 -3
  10. package/discussion/index.d.ts +2 -0
  11. package/discussion/likes/likes.d.ts +4 -0
  12. package/discussion/post/index.d.ts +1 -0
  13. package/discussion/post/post.d.ts +37 -0
  14. package/general/link/link.d.ts +2 -2
  15. package/index.js +72 -72
  16. package/index.mjs +11207 -10479
  17. package/layout/full-width/full-width.d.ts +8 -0
  18. package/layout/full-width/index.d.ts +1 -0
  19. package/layout/index.d.ts +1 -0
  20. package/package.json +1 -1
  21. package/style.css +1 -1
  22. package/styles/base/_index.scss +1 -0
  23. package/styles/base/_table.scss +71 -0
  24. package/styles/base/buttons/_icons.scss +1 -1
  25. package/styles/variables/colors/_theme.scss +11 -0
  26. package/text/empty-state-box/empty-state-box.d.ts +8 -10
  27. package/text/highlighted-text-box/highlighted-text-box.d.ts +1 -1
  28. package/text/index.d.ts +1 -0
  29. package/text/markdown-text/components/case-study/case-study.d.ts +5 -0
  30. package/text/markdown-text/components/case-study/index.d.ts +1 -0
  31. package/text/markdown-text/components/details/details.d.ts +9 -0
  32. package/text/markdown-text/components/details/index.d.ts +1 -0
  33. package/text/markdown-text/components/div/div.d.ts +6 -0
  34. package/text/markdown-text/components/div/index.d.ts +1 -0
  35. package/text/markdown-text/components/empty-component/empty-component.d.ts +5 -0
  36. package/text/markdown-text/components/empty-component/index.d.ts +1 -0
  37. package/text/markdown-text/components/iframe/iframe.d.ts +8 -0
  38. package/text/markdown-text/components/iframe/index.d.ts +1 -0
  39. package/text/markdown-text/components/index.d.ts +6 -0
  40. package/text/markdown-text/components/link/index.d.ts +1 -0
  41. package/text/markdown-text/components/link/link.d.ts +8 -0
  42. package/text/markdown-text/index.d.ts +1 -0
  43. package/text/markdown-text/markdown-text.d.ts +10 -0
  44. package/user/contributors/contributors.d.ts +26 -0
  45. package/user/contributors/index.d.ts +1 -0
  46. package/user/index.d.ts +1 -0
  47. package/user/member/index.d.ts +2 -0
@@ -8,5 +8,6 @@
8
8
  'links',
9
9
  'lists',
10
10
  'overlays',
11
+ 'table',
11
12
  'text',
12
13
  'titles';
@@ -0,0 +1,71 @@
1
+ @use 'sass:map';
2
+ @import './../functions',
3
+ './../variables';
4
+
5
+ $table: ('margin-top': 64, 'margin-bottom': 32, 'padding-vertical': 12, 'padding-horizontal': 20, 'border': 1, 'border-radius': 8);
6
+
7
+ @layer base {
8
+ table {
9
+ width: 100%;
10
+ margin: px-to-rem(map.get($table, 'margin-top')) auto px-to-rem(map.get($table, 'margin-bottom')) auto;
11
+ border-collapse: separate;
12
+ border-spacing: 0;
13
+
14
+ &, p, li { text-align: left; }
15
+ }
16
+
17
+ th, td {
18
+ border: px-to-rem(map.get($table, 'border')) solid map.get($theme, 'table_border');
19
+ vertical-align: top;
20
+ }
21
+
22
+ th, tbody:first-child tr:first-child td {
23
+ background: map.get($theme, 'table_th_bg');
24
+ padding: px-to-rem(map.get($table, 'padding-horizontal'));
25
+ color: map.get($theme, 'table_th');
26
+ font-weight: 600;
27
+ border-right-width: 0;
28
+
29
+ /* Add border radius to the corners of the table, not each cell */
30
+ &:first-child {
31
+ border-top-left-radius: px-to-rem(map.get($table, 'border-radius'));
32
+ }
33
+
34
+ &:last-child {
35
+ border-top-right-radius: px-to-rem(map.get($table, 'border-radius'));
36
+ border-right-width: px-to-rem(map.get($table, 'border'));
37
+ }
38
+ }
39
+
40
+ td {
41
+ padding: px-to-rem(map.get($table, 'padding-vertical')) px-to-rem(map.get($table, 'padding-horizontal'));
42
+ border-top-width: 0;
43
+ border-right-width: 0;
44
+
45
+ /* Prevent borders with double width due to using border-collapse separate */
46
+ &:last-child {
47
+ border-right-width: px-to-rem(map.get($table, 'border'));
48
+ }
49
+ }
50
+
51
+ tr:last-child {
52
+ td {
53
+ &:first-child {
54
+ border-bottom-left-radius: px-to-rem(map.get($table, 'border-radius'));
55
+ }
56
+
57
+ &:last-child {
58
+ border-bottom-right-radius: px-to-rem(map.get($table, 'border-radius'));
59
+ }
60
+ }
61
+ }
62
+
63
+ // Remove the styling if there's only one row as some old articles use tables
64
+ // to display buttons inline
65
+ tr:first-child:last-child {
66
+ td {
67
+ background: none;
68
+ border: none;
69
+ }
70
+ }
71
+ }
@@ -21,4 +21,4 @@ $icons: ('arrow_left', (d, d, 3, 8), (d, d, 3, 8), (d, d, 4, 7)),
21
21
  ('speech-bubble_square_thick', (22, 22, 0, 10), (18, 18, 1, d), (d, d, 3, 10)),
22
22
  ('star', (16, 16, 0, 0), (d, d, 0, 0), (16, 16, 0, 0)),
23
23
  ('star_empty', (16, 16, 0, 0), (d, d, 0, 0), (16, 16, 0, 0)),
24
- ('tick', (14, 11, 8, 10), (12, 9, 7, 8), (9, 7, 6, 6));
24
+ ('tick', (14, 11, 8, 10), (14, 11, 5, 8), (9, 7, 6, 6));
@@ -71,6 +71,10 @@ $theme: (
71
71
  form_input_focus_box-shadow: map.get($c, 'b100'),
72
72
  form_search-button_bg: map.get($c, 'n900'),
73
73
 
74
+ table_border: map.get($c, 'n200'),
75
+ table_th: map.get($c, 'white'),
76
+ table_th_bg: map.get($c, 'n600'),
77
+
74
78
  overlay: rgb(21 25 33 / 25%),
75
79
 
76
80
  // Banners
@@ -104,6 +108,7 @@ $theme: (
104
108
  discussion-form_small: map.get($c, 'n700'),
105
109
 
106
110
  discussion-likes: map.get($c, 'n600'),
111
+ discussion-likes_hover_bg: map.get($c, 'b100'),
107
112
  discussion-likes_liked: map.get($c, 'p500'),
108
113
  discussion-likes_liked_bg: map.get($c, 'p500'),
109
114
 
@@ -230,6 +235,12 @@ $theme: (
230
235
  pill_bg: map.get($c, 'y300'),
231
236
 
232
237
  // User
238
+ contributor: map.get($c, 'n700'),
239
+ contributor_bg: map.get($c, 'white'),
240
+ contributor_border: map.get($c, 'white'),
241
+ contributor_inner-border: map.get($c, 'n200'),
242
+ contributor_label: map.get($c, 'n600'),
243
+
233
244
  member_highlighted_name: map.get($c, 'p500'),
234
245
  member_additional-content: map.get($c, 'n700'),
235
246
  member_small: map.get($c, 'n700')
@@ -1,19 +1,17 @@
1
- import { ButtonVariantType } from '../../general';
1
+ import { ButtonPropsType } from '../../general';
2
+ interface ButtonType extends ButtonPropsType {
3
+ text: string;
4
+ breakpoints?: {
5
+ [key: string]: boolean;
6
+ };
7
+ }
2
8
  interface Props {
3
9
  /** Box styling */
4
10
  variant?: 'empty' | 'error';
5
11
  /** Optional text */
6
12
  text?: false | string;
7
13
  /** Optional button. The button can also show depending on the viewport size */
8
- button?: false | {
9
- url: string;
10
- text: string;
11
- variant?: ButtonVariantType;
12
- gtmContext: string;
13
- breakpoints?: {
14
- [key: string]: boolean;
15
- };
16
- };
14
+ button?: false | ButtonType;
17
15
  /** Additional classes */
18
16
  className?: string;
19
17
  }
@@ -5,7 +5,7 @@ interface Props {
5
5
  /** Additional classes to add to the box */
6
6
  className?: string;
7
7
  /** The content to display */
8
- children: React.ReactNode;
8
+ children: React.ReactNode | JSX.Element;
9
9
  /** Additional props to pass to the box */
10
10
  style?: React.CSSProperties;
11
11
  }
package/text/index.d.ts CHANGED
@@ -4,4 +4,5 @@ export * from './empty-state-box';
4
4
  export * from './helper-text-box';
5
5
  export * from './hide-show-text-box';
6
6
  export * from './highlighted-text-box';
7
+ export * from './markdown-text';
7
8
  export * from './pill';
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ declare const _default: ({ children }: {
3
+ children?: React.ReactNode | string;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ export default _default;
@@ -0,0 +1 @@
1
+ export { default as CaseStudy } from './case-study';
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ /** The content to show */
4
+ children?: React.ReactNode;
5
+ /** The language to use for the text */
6
+ locale?: string;
7
+ }
8
+ declare const DetailsWrapper: ({ locale, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
9
+ export default DetailsWrapper;
@@ -0,0 +1 @@
1
+ export { default as Details } from './details';
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ declare const _default: ({ children, ...props }: {
3
+ children: React.ReactNode | string;
4
+ class?: string | undefined;
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ export default _default;
@@ -0,0 +1 @@
1
+ export { default as Div } from './div';
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ declare const _default: () => React.ExoticComponent<{
3
+ children?: React.ReactNode;
4
+ }>;
5
+ export default _default;
@@ -0,0 +1 @@
1
+ export { default as EmptyComponent } from './empty-component';
@@ -0,0 +1,8 @@
1
+ interface Props {
2
+ /** The iframe `src` */
3
+ src: string;
4
+ /** The language to use for the text */
5
+ locale?: string;
6
+ }
7
+ declare const IFrameWrapper: ({ locale, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
8
+ export default IFrameWrapper;
@@ -0,0 +1 @@
1
+ export { default as IFrame } from './iframe';
@@ -0,0 +1,6 @@
1
+ export { EmptyComponent } from './empty-component';
2
+ export { CaseStudy } from './case-study';
3
+ export { Details } from './details';
4
+ export { Div } from './div';
5
+ export { IFrame } from './iframe';
6
+ export { Link } from './link';
@@ -0,0 +1 @@
1
+ export { default as Link } from './link';
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ declare const _default: ({ children, ...props }: {
3
+ children: React.ReactNode;
4
+ href?: string | undefined;
5
+ target?: "_blank" | "_self" | "_parent" | "_top" | undefined;
6
+ className?: string | undefined;
7
+ }) => import("react/jsx-runtime").JSX.Element;
8
+ export default _default;
@@ -0,0 +1 @@
1
+ export { default as MarkdownText } from './markdown-text';
@@ -0,0 +1,10 @@
1
+ interface Props {
2
+ /** Additional classes */
3
+ className?: string;
4
+ /** The options to pass to the markdown parser */
5
+ options?: any;
6
+ /** The content to be parsed */
7
+ children: string;
8
+ }
9
+ declare const MarkdownText: ({ className, options, children }: Props) => import("react/jsx-runtime").JSX.Element;
10
+ export default MarkdownText;
@@ -0,0 +1,26 @@
1
+ import { MemberProps } from './../member';
2
+ interface Props {
3
+ /** The element that will render around the content */
4
+ element?: 'div' | 'section' | 'aside' | 'li';
5
+ /** Information about the contributors */
6
+ contributors: Array<MemberProps>;
7
+ /** Information on the style of the component */
8
+ styling?: {
9
+ /** The size of the images */
10
+ size?: 'small' | 'medium';
11
+ /** Whether to show a gap between the images */
12
+ showGap?: boolean;
13
+ /** The text to show, defaulting to the contributor's name when there's only one */
14
+ showText?: boolean | string;
15
+ /** Whether to show placeholders */
16
+ showPlaceholders?: boolean;
17
+ };
18
+ /** The number of contributors to show before we switch to showing a number */
19
+ cutoff?: number;
20
+ /** Additional classes */
21
+ className?: string;
22
+ /** The language to use */
23
+ locale?: string;
24
+ }
25
+ declare const ContributorsWrapper: ({ locale, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
26
+ export default ContributorsWrapper;
@@ -0,0 +1 @@
1
+ export { default as Contributors } from './contributors';
package/user/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ export * from './contributors';
1
2
  export * from './member';
2
3
  export * from './profile-picture';
@@ -1 +1,3 @@
1
+ export type { MemberProps } from './member';
1
2
  export { default as Member } from './member';
3
+ export { getMember } from './member.helpers';