@apolitical/component-library 1.5.0 → 1.6.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 (37) hide show
  1. package/communities/community-details/community-details.d.ts +11 -1
  2. package/communities/index.d.ts +1 -0
  3. package/communities/join-button/join-button.d.ts +3 -1
  4. package/communities/members-list/index.d.ts +1 -0
  5. package/communities/members-list/members-list.d.ts +23 -0
  6. package/discussion/likes/likes.d.ts +16 -6
  7. package/discussion/likes/likes.helpers.d.ts +2 -0
  8. package/discussion/post/post.d.ts +6 -3
  9. package/general/index.d.ts +1 -0
  10. package/general/link/link.d.ts +1 -1
  11. package/general/tooltip/index.d.ts +1 -0
  12. package/general/tooltip/tooltip.d.ts +11 -0
  13. package/helpers/index.d.ts +1 -0
  14. package/helpers/numbers.d.ts +1 -0
  15. package/hooks/index.d.ts +1 -0
  16. package/hooks/use-scroll-to-hash.d.ts +2 -0
  17. package/index.js +48 -48
  18. package/index.mjs +6885 -6734
  19. package/navigation/breadcrumbs/breadcrumbs.d.ts +16 -0
  20. package/navigation/breadcrumbs/index.d.ts +1 -0
  21. package/navigation/index.d.ts +1 -0
  22. package/navigation/load-more/index.d.ts +1 -0
  23. package/navigation/load-more/load-more.d.ts +7 -5
  24. package/package.json +1 -1
  25. package/style.css +1 -1
  26. package/styles/base/_links.scss +4 -1
  27. package/styles/base/_titles.scss +16 -0
  28. package/styles/base/buttons/_buttons.scss +52 -1
  29. package/styles/base/buttons/_icons.scss +1 -0
  30. package/styles/base/buttons/_sizes.scss +1 -0
  31. package/styles/variables/colors/_theme.scss +18 -2
  32. package/text/empty-state-box/empty-state-box.d.ts +3 -1
  33. package/text/pill/pill.d.ts +5 -1
  34. package/user/contributors/contributors.d.ts +5 -2
  35. package/user/contributors/contributors.mock.d.ts +8 -5
  36. package/user/member/index.d.ts +1 -1
  37. package/user/member/member.d.ts +15 -3
@@ -1,8 +1,11 @@
1
1
  @use 'sass:map';
2
- @import './../variables';
2
+ @import './../mixins',
3
+ './../variables';
3
4
 
4
5
  @layer base {
5
6
  a {
7
+ @include transition(color);
8
+
6
9
  color: map.get($theme, 'link');
7
10
  text-decoration: underline;
8
11
  font-weight: 900;
@@ -12,6 +12,7 @@ $h4: ('font-size': 18, 'font-size_md': 20, 'line-height': 24, 'line-height_md':
12
12
  $h5: ('font-size': 12, 'font-size_md': 14, 'line-height': 16, 'margin-top': 16, 'margin-bottom': 16);
13
13
  $h6: ('font-size': 12, 'font-size_md': 11, 'line-height': 16);
14
14
  $subtitle: ('font-size': 20, 'font-size_md': 24, 'line-height': 28, 'line-height_md': 32, 'margin-bottom': 20);
15
+ $count-icon: ('width': 15, 'margin-horizontal': 8, 'offset': 1);
15
16
 
16
17
  @mixin pre-title {
17
18
  margin-bottom: px-to-rem(map.get($pre-title, 'margin-bottom'));
@@ -173,4 +174,19 @@ $subtitle: ('font-size': 20, 'font-size_md': 24, 'line-height': 28, 'line-height
173
174
  .subtitle {
174
175
  @include subtitle;
175
176
  }
177
+
178
+ .count {
179
+ &::before {
180
+ @include image('icons/middot.svg', true);
181
+
182
+ content: '';
183
+ width: px-to-rem(map.get($count-icon, 'width'));
184
+ height: px-to-rem(map.get($count-icon, 'width'));
185
+ background: currentcolor;
186
+ position: relative;
187
+ top: px-to-rem(map.get($count-icon, 'offset'));
188
+ margin: 0 px-to-rem(map.get($count-icon, 'margin-horizontal'));
189
+ display: inline-block;
190
+ }
191
+ }
176
192
  }
@@ -27,7 +27,7 @@
27
27
  background: map.get($theme, 'button_primary_bg_hover');
28
28
  }
29
29
 
30
- &:active {
30
+ &:active, &.active {
31
31
  background: map.get($theme, 'button_primary_bg_active');
32
32
  }
33
33
 
@@ -71,6 +71,8 @@
71
71
  }
72
72
 
73
73
  &.secondary {
74
+ @include transition(background color border-color);
75
+
74
76
  background: map.get($theme, 'button_secondary_bg');
75
77
  border: px-to-rem(map.get($secondary, 'border')) solid map.get($theme, 'button_secondary_border');
76
78
 
@@ -108,6 +110,14 @@
108
110
  }
109
111
  }
110
112
 
113
+ &.destructive {
114
+ &, &:hover, &:active, &:focus, &:focus-visible {
115
+ background: map.get($theme, 'button_secondary_bg_destructive');
116
+ color: map.get($theme, 'button_secondary_destructive');
117
+ border-color: map.get($theme, 'button_secondary_border_destructive');
118
+ }
119
+ }
120
+
111
121
  &.disabled {
112
122
  &, &:hover, &:active, &:focus, &:focus-visible {
113
123
  background: map.get($theme, 'button_secondary_bg_disabled');
@@ -247,6 +257,47 @@
247
257
  opacity: 0.3;
248
258
  }
249
259
 
260
+ &[data-hover-text] {
261
+ position: relative;
262
+
263
+ &::before, .text {
264
+ @include transition(opacity);
265
+
266
+ opacity: 1;
267
+ }
268
+
269
+ &::after {
270
+ @include transition(width height opacity right, 0s 0s 0.2s 0.2s, ease-in-out, 0s 0s 0.1s 0.1s);
271
+
272
+ content: '';
273
+ width: 0;
274
+ height: 0;
275
+ position: absolute;
276
+ top: px-to-rem(map.get($secondary-destruction, 'offset'));
277
+ right: map.get($secondary-destruction, 'right');
278
+ display: flex;
279
+ align-items: center;
280
+ justify-content: center;
281
+ opacity: 0;
282
+ }
283
+
284
+ &:hover, &:focus {
285
+ &::before, .text {
286
+ opacity: 0;
287
+ }
288
+
289
+ &::after {
290
+ content: attr(data-hover-text);
291
+ width: 100%;
292
+ height: 100%;
293
+ right: 0;
294
+ opacity: 1;
295
+ }
296
+
297
+ }
298
+
299
+ }
300
+
250
301
  }
251
302
  }
252
303
 
@@ -22,6 +22,7 @@ $icons: ('arrow_left', (d, d, 3, 8), (d, d, 3, 8), (d, d, 4, 7)),
22
22
  ('navigation_arrow', (d, d, 4, 10), (d, d, d, d), (14, 14, d, 10)),
23
23
  ('pencil', (d, d, d, d), (d, d, d, 11), (d, d, 3, 9)),
24
24
  ('pencil-paper', (22, 22, 0, 10), (18, 18, 1, d), (d, d, 3, 10)),
25
+ ('plus', (d, d, 4, d), (d, d, 2, d), (11, 11, 3, d)),
25
26
  ('share', (22, 22, 0, 10), (18, 18, 1, d), (d, d, 3, 10)),
26
27
  ('speech-bubble_square_thick', (22, 22, 0, 10), (18, 18, 1, d), (d, d, 3, 10)),
27
28
  ('star', (16, 16, 0, 0), (d, d, 0, 0), (16, 16, 0, 0)),
@@ -4,6 +4,7 @@ $medium: ('font-size': 16, 'padding-top': 10, 'padding-horizontal': 24, 'padding
4
4
  $small: ('font-size': 14, 'padding-top': 8, 'padding-horizontal': 16, 'padding-bottom': 10, 'icon-width': 12, 'icon-offset': 2, 'icon-gutter': 8);
5
5
  $sizes: ('large', $large), ('small', $small);
6
6
  $secondary: ('border': 1);
7
+ $secondary-destruction: ('right': -5%, 'offset': -1);
7
8
 
8
9
  // The tertiary styling has its own padding; regardless of size, we add a tiny amount of padding to accommodate
9
10
  // the focus outline and to ensure any icons are centered
@@ -34,6 +34,7 @@ $theme: (
34
34
  button_secondary_focus: map.get($c, 'white'),
35
35
  button_secondary_muted: map.get($c, 'n600'),
36
36
  button_secondary_muted_hover: map.get($c, 'n700'),
37
+ button_secondary_destructive: map.get($c, 'error600'),
37
38
  button_secondary_disabled: map.get($c, 'b700'),
38
39
  button_secondary_bg: map.get($c, 'white'),
39
40
  button_secondary_bg_hover: map.get($c, 'b200'),
@@ -42,11 +43,13 @@ $theme: (
42
43
  button_secondary_bg_muted: map.get($c, 'white'),
43
44
  button_secondary_bg_muted_hover: map.get($c, 'n200'),
44
45
  button_secondary_bg_disabled: map.get($c, 'white'),
46
+ button_secondary_bg_destructive: map.get($c, 'error50'),
45
47
  button_secondary_border: map.get($c, 'b700'),
46
48
  button_secondary_border_focus: transparent,
47
49
  button_secondary_border_muted: map.get($c, 'n200'),
48
50
  button_secondary_border_muted_hover: map.get($c, 'n500'),
49
51
  button_secondary_border_disabled: map.get($c, 'b700'),
52
+ button_secondary_border_destructive: map.get($c, 'error600'),
50
53
 
51
54
  button_tertiary: map.get($c, 'b700'),
52
55
  button_tertiary_hover: map.get($c, 'b500'),
@@ -104,6 +107,9 @@ $theme: (
104
107
  marketing-block_secondary_bg_2: map.get($c, 'g100'),
105
108
  marketing-block_tertiary_bg_2: map.get($c, 'p600'),
106
109
 
110
+ // Communities
111
+ community-details_link_hover: map.get($c, 'b500'),
112
+
107
113
  // Discussion
108
114
  discussion-actions: map.get($c, 'n600'),
109
115
  discussion-actions_hover_bg: map.get($c, 'b100'),
@@ -136,6 +142,10 @@ $theme: (
136
142
  search_search-button_bg: map.get($c, 'n600'),
137
143
  search_search-button_active_bg: map.get($c, 'white'),
138
144
 
145
+ // General
146
+ tooltip: map.get($c, 'white'),
147
+ tooltip_bg: rgb(21 25 33 / 90%),
148
+
139
149
  // Layout
140
150
  cookie-banner_bg: map.get($c, 'n50'),
141
151
  cookie-banner_shadow: rgb(107 91 82 / 40%),
@@ -199,6 +209,9 @@ $theme: (
199
209
  modal_close_hover_bg: map.get($c, 'b100'),
200
210
 
201
211
  // Navigation
212
+ breadcrumbs: map.get($c, 'n600'),
213
+ breadcrumbs_hover: map.get($c, 'b500'),
214
+
202
215
  filters: map.get($c, 'n700'),
203
216
  filters_selected: map.get($c, 'g700'),
204
217
  filters_active: map.get($c, 'n700'),
@@ -244,8 +257,10 @@ $theme: (
244
257
 
245
258
  highlighted-text-box_subtle_border: map.get($c, 'n100'),
246
259
 
247
- pill: map.get($c, 'n700'),
248
- pill_bg: map.get($c, 'y300'),
260
+ pill: map.get($c, 'n900'),
261
+ pill_highlighted: map.get($c, 'n700'),
262
+ pill_bg: map.get($c, 'n200'),
263
+ pill_highlighted_bg: map.get($c, 'y300'),
249
264
 
250
265
  status-banner_bg: map.get($c, 'y50'),
251
266
  status-banner_success_bg: map.get($c, 'success50'),
@@ -256,6 +271,7 @@ $theme: (
256
271
  // User
257
272
  contributor: map.get($c, 'n700'),
258
273
  contributor_bg: map.get($c, 'white'),
274
+ contributor_medium_bg: map.get($c, 'n200'),
259
275
  contributor_border: map.get($c, 'white'),
260
276
  contributor_inner-border: map.get($c, 'n200'),
261
277
  contributor_label: map.get($c, 'n600'),
@@ -1,9 +1,11 @@
1
+ import React from 'react';
1
2
  import { ButtonPropsType } from '../../general';
2
3
  interface ButtonType extends ButtonPropsType {
3
- text: string;
4
+ text?: string;
4
5
  breakpoints?: {
5
6
  [key: string]: boolean;
6
7
  };
8
+ component?: React.ReactNode;
7
9
  }
8
10
  interface Props {
9
11
  /** Box styling */
@@ -1,9 +1,13 @@
1
1
  import React from 'react';
2
2
  interface Props {
3
+ /** The size of the pill */
4
+ size?: 'medium' | 'large';
5
+ /** The style of the pill */
6
+ variant?: 'default' | 'highlighted';
3
7
  /** Additional classes to add to the pill */
4
8
  className?: 'margin-left' | 'margin-right' | '';
5
9
  /** The pill text */
6
10
  children: React.ReactNode;
7
11
  }
8
- declare const Pill: ({ className, children }: Props) => import("react/jsx-runtime").JSX.Element;
12
+ declare const Pill: ({ size, variant, className, children }: Props) => import("react/jsx-runtime").JSX.Element;
9
13
  export default Pill;
@@ -4,7 +4,10 @@ interface Props {
4
4
  /** The element that will render around the content */
5
5
  element?: 'div' | 'section' | 'aside' | 'li';
6
6
  /** Information about the contributors */
7
- contributors: Array<MemberProps>;
7
+ contributors: {
8
+ total?: number;
9
+ data: Array<MemberProps>;
10
+ };
8
11
  /** Information on the style of the component */
9
12
  styling?: {
10
13
  /** The size of the images */
@@ -23,7 +26,7 @@ interface Props {
23
26
  /** The language to use */
24
27
  locale?: string;
25
28
  }
26
- declare const Contributors: ({ element, contributors, styling: { showText, size, showGap, showPlaceholders }, cutoff, className }: Props) => React.DetailedReactHTMLElement<{
29
+ declare const Contributors: ({ element, contributors: { total, data: contributors }, styling: { showText, size, showGap, showPlaceholders }, cutoff, className }: Props) => React.DetailedReactHTMLElement<{
27
30
  className: string;
28
31
  children: import("react/jsx-runtime").JSX.Element;
29
32
  }, HTMLElement> | null;
@@ -1,11 +1,14 @@
1
1
  declare const _default: {
2
2
  element: string;
3
3
  contributors: {
4
- name: string;
5
- image: {
6
- thumbnail: string;
7
- };
8
- }[];
4
+ total: number;
5
+ data: {
6
+ name: string;
7
+ image: {
8
+ thumbnail: string;
9
+ };
10
+ }[];
11
+ };
9
12
  styling: {
10
13
  showText: string;
11
14
  };
@@ -1,3 +1,3 @@
1
- export type { MemberProps } from './member';
1
+ export type { MemberProps, MemberDetailsProps } from './member';
2
2
  export { default as Member } from './member';
3
3
  export { getMember } from './member.helpers';
@@ -1,17 +1,26 @@
1
- export type MemberProps = 'apolitical' | 'community' | {
1
+ import React from 'react';
2
+ export type MemberDetailsProps = {
3
+ /** The user's unique ID */
2
4
  id?: string;
3
- slug?: string;
5
+ /** The user's name */
4
6
  name?: string;
7
+ /** The user's job title */
5
8
  jobTitle?: string;
9
+ /** The organisation the user works for */
6
10
  organization?: string;
11
+ /** The user's location */
7
12
  location?: {
8
13
  country?: string;
9
14
  };
15
+ /** The user's profile picture */
10
16
  image?: {
11
17
  thumbnail?: string;
12
18
  };
13
19
  };
20
+ export type MemberProps = 'apolitical' | 'community' | MemberDetailsProps;
14
21
  interface Props {
22
+ /** The element to render around the content */
23
+ element?: 'li' | 'div';
15
24
  /** Details about the Apolitical member */
16
25
  member?: MemberProps;
17
26
  /** Additional content to show with the member details */
@@ -28,5 +37,8 @@ interface Props {
28
37
  /** The language to use for the text */
29
38
  locale?: string;
30
39
  }
31
- declare const Member: ({ member: memberDetails, additionalContent, gtmContext, gtmType, className, }: Props) => import("react/jsx-runtime").JSX.Element;
40
+ declare const Member: ({ element, member: memberDetails, additionalContent, gtmContext, gtmType, className, }: Props) => React.DetailedReactHTMLElement<{
41
+ className: string;
42
+ children: import("react/jsx-runtime").JSX.Element;
43
+ }, HTMLElement>;
32
44
  export default Member;