@apolitical/component-library 1.13.6 → 1.14.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 (46) hide show
  1. package/cards/card/card.d.ts +3 -0
  2. package/cards/card/card.data.d.ts +11 -0
  3. package/cards/card/card.helpers.d.ts +5 -0
  4. package/cards/card/components/details/details.d.ts +9 -0
  5. package/cards/card/components/details/index.d.ts +1 -0
  6. package/cards/card/components/index.d.ts +2 -0
  7. package/cards/card/components/links/index.d.ts +1 -0
  8. package/cards/card/components/links/links.d.ts +13 -0
  9. package/cards/card/index.d.ts +1 -0
  10. package/cards/card-block/card-block.d.ts +15 -0
  11. package/cards/card-block/index.d.ts +1 -0
  12. package/cards/cards.types.d.ts +133 -0
  13. package/cards/carousel/carousel.d.ts +3 -0
  14. package/cards/carousel/components/carousel/carousel.d.ts +8 -0
  15. package/cards/carousel/components/carousel/carousel.helpers.d.ts +1 -0
  16. package/cards/carousel/components/carousel/index.d.ts +1 -0
  17. package/cards/carousel/components/index.d.ts +2 -0
  18. package/cards/carousel/components/title/index.d.ts +1 -0
  19. package/cards/carousel/components/title/title.d.ts +13 -0
  20. package/cards/carousel/index.d.ts +1 -0
  21. package/cards/index.d.ts +3 -0
  22. package/cards/mocks/card.d.ts +235 -0
  23. package/cards/mocks/carousel.d.ts +58 -0
  24. package/cards/mocks/index.d.ts +3 -0
  25. package/cards/mocks/mocks.helpers.d.ts +500 -0
  26. package/helpers/cases.d.ts +1 -0
  27. package/helpers/dates.d.ts +1 -2
  28. package/helpers/index.d.ts +1 -0
  29. package/helpers/intl.d.ts +1 -0
  30. package/hooks/index.d.ts +1 -1
  31. package/hooks/{use-screen-width.d.ts → use-element-width.d.ts} +1 -1
  32. package/index.js +7 -7
  33. package/index.mjs +583 -439
  34. package/layout/content-layout/columns/columns.d.ts +1 -1
  35. package/loaders/loading-state/loading-state.d.ts +8 -2
  36. package/package.json +1 -1
  37. package/style.css +1 -1
  38. package/styles/base/_text.scss +41 -15
  39. package/styles/base/_titles.scss +22 -0
  40. package/styles/mixins/_containers.scss +18 -0
  41. package/styles/mixins/_index.scss +1 -0
  42. package/styles/variables/colors/_theme.scss +33 -1
  43. package/text/empty-state-box/empty-state-box.d.ts +1 -1
  44. package/text/pill/pill.d.ts +6 -4
  45. package/user/contributors/contributors.d.ts +7 -1
  46. package/user/profile-picture/profile-picture.d.ts +2 -0
@@ -7,6 +7,7 @@ $default: ('font-size': 16, 'font-size_md': 18, 'line-height': 24, 'line-height_
7
7
  $small: ('font-size': 12, 'font-size_md': 14, 'letter-spacing': 0.16, 'line-height': 16, 'margin-bottom': 16);
8
8
  $medium: ('font-size': 14, 'font-size_md': 16, 'line-height': 16, 'line-height_md': 20, 'margin-bottom': 18);
9
9
  $sup: ('font-size': 10);
10
+ $text-elements: p, li, dt, dd;
10
11
 
11
12
  @layer base {
12
13
  p, li, small {
@@ -16,7 +17,7 @@ $sup: ('font-size': 10);
16
17
  .error &, &.error { color: map.get($theme, 'text_error'); }
17
18
  }
18
19
 
19
- p, li, dt, dd {
20
+ #{$text-elements} {
20
21
  font-size: px-to-rem(map.get($default, 'font-size'));
21
22
  line-height: px-to-rem(map.get($default, 'line-height'));
22
23
 
@@ -30,20 +31,6 @@ $sup: ('font-size': 10);
30
31
  font-size: px-to-rem(map.get($medium, 'font-size'));
31
32
  line-height: px-to-rem(map.get($medium, 'line-height'));
32
33
  }
33
-
34
- @include breakpoint('min-width', 'md') {
35
- font-size: px-to-rem(map.get($default, 'font-size_md'));
36
- line-height: px-to-rem(map.get($default, 'line-height_md'));
37
-
38
- .text-small &, &.text-small {
39
- font-size: px-to-rem(map.get($small, 'font-size_md'));
40
- }
41
-
42
- .text-medium &, &.text-medium {
43
- font-size: px-to-rem(map.get($medium, 'font-size_md'));
44
- line-height: px-to-rem(map.get($medium, 'line-height_md'));
45
- }
46
- }
47
34
  }
48
35
 
49
36
  p {
@@ -81,4 +68,43 @@ $sup: ('font-size': 10);
81
68
 
82
69
  address { font-style: normal; }
83
70
 
71
+ a {
72
+ &.text-small {
73
+ font-size: px-to-rem(map.get($small, 'font-size'));
74
+ line-height: px-to-rem(map.get($small, 'line-height'));
75
+ }
76
+
77
+ &.text-medium {
78
+ font-size: px-to-rem(map.get($medium, 'font-size'));
79
+ line-height: px-to-rem(map.get($medium, 'line-height'));
80
+ }
81
+ }
82
+
83
+ @include breakpoint('min-width', 'md') {
84
+ #{$text-elements} {
85
+ font-size: px-to-rem(map.get($default, 'font-size_md'));
86
+ line-height: px-to-rem(map.get($default, 'line-height_md'));
87
+
88
+ .text-small &, &.text-small {
89
+ font-size: px-to-rem(map.get($small, 'font-size_md'));
90
+ }
91
+
92
+ .text-medium &, &.text-medium {
93
+ font-size: px-to-rem(map.get($medium, 'font-size_md'));
94
+ line-height: px-to-rem(map.get($medium, 'line-height_md'));
95
+ }
96
+ }
97
+
98
+ a {
99
+ &.text-small {
100
+ font-size: px-to-rem(map.get($small, 'font-size_md'));
101
+ }
102
+
103
+ &.text-medium {
104
+ font-size: px-to-rem(map.get($medium, 'font-size_md'));
105
+ line-height: px-to-rem(map.get($medium, 'line-height_md'));
106
+ }
107
+ }
108
+ }
109
+
84
110
  }
@@ -3,6 +3,7 @@
3
3
  './../mixins',
4
4
  './../variables';
5
5
 
6
+ $highlight: ('width': 64, 'height': 4, 'margin-top': 12, 'border-radius': 8);
6
7
  $pre-title: ('font-size': 14, 'font-size_md': 16, 'letter-spacing': 1.28, 'line-height': 16, 'line-height_md': 20, 'margin-bottom': 24);
7
8
  $title: ('font-size': 32, 'font-size_md': 52, 'letter-spacing': -0.16, 'line-height': 40, 'line-height_md': 64, 'margin-bottom': 16, 'margin-bottom_md': 32);
8
9
  $h1: ('font-size': 28, 'font-size_md': 40, 'line-height': 32, 'line-height_md': 48, 'letter-spacing': -0.16, 'margin-bottom': 16);
@@ -14,6 +15,23 @@ $h6: ('font-size': 12, 'font-size_md': 11, 'line-height': 16);
14
15
  $subtitle: ('font-size': 20, 'font-size_md': 24, 'line-height': 28, 'line-height_md': 32, 'margin-bottom': 20);
15
16
  $count-icon: ('width': 15, 'margin-horizontal': 8, 'offset': 1);
16
17
 
18
+ @mixin highlight {
19
+ position: relative;
20
+ padding-bottom: px-to-rem(map.get($highlight, 'height') + map.get($highlight, 'margin-top'));
21
+
22
+ &::after {
23
+ content: '';
24
+ width: px-to-rem(map.get($highlight, 'width'));
25
+ height: px-to-rem(map.get($highlight, 'height'));
26
+ background: map.get($theme, 'highlight_bg');
27
+ position: absolute;
28
+ bottom: 0;
29
+ left: 0;
30
+ border-radius: px-to-rem(map.get($highlight, 'border-radius'));
31
+ display: block;
32
+ }
33
+ }
34
+
17
35
  @mixin pre-title {
18
36
  margin-bottom: px-to-rem(map.get($pre-title, 'margin-bottom'));
19
37
  font-size: px-to-rem(map.get($pre-title, 'font-size'));
@@ -139,6 +157,10 @@ $count-icon: ('width': 15, 'margin-horizontal': 8, 'offset': 1);
139
157
  }
140
158
 
141
159
  @layer base {
160
+ .highlighted-title {
161
+ @include highlight;
162
+ }
163
+
142
164
  .pre-title {
143
165
  @include pre-title;
144
166
  }
@@ -0,0 +1,18 @@
1
+ @use 'sass:map';
2
+ @import './breakpoints';
3
+
4
+ // This mixin is very similar to the `breakpoint` mixin - and uses the same sizing map - but for container queries.
5
+ // We should use container queries when the styling of a parent is more important than the styling of the page,
6
+ // e.g. we use it on carousels to ensure we show different numbers of cards when the carousel is different sizes
7
+ // Find out more: https://blog.logrocket.com/css-container-queries-guide/
8
+
9
+
10
+ @mixin container-query($container, $type, $breakpoint) {
11
+ @if map-has-key($breakpoint-sizes, $breakpoint) {
12
+ $breakpoint: map.get($breakpoint-sizes, $breakpoint);
13
+ }
14
+
15
+ @container #{$container} (#{$type}: #{$breakpoint}px) {
16
+ @content;
17
+ }
18
+ }
@@ -2,6 +2,7 @@
2
2
  'backgrounds',
3
3
  'breakpoints',
4
4
  'browsers',
5
+ 'containers',
5
6
  'selectors',
6
7
  'styles',
7
8
  'transitions';
@@ -6,6 +6,9 @@ $theme: (
6
6
  // Base styles
7
7
  default_focus: map.get($c, 'b100'),
8
8
  background: map.get($c, 'white'),
9
+
10
+ highlight_bg: map.get($c, 'g300'),
11
+
9
12
  title: map.get($c, 'n900'),
10
13
  subtitle: map.get($c, 'n800'),
11
14
  text: map.get($c, 'n900'),
@@ -91,6 +94,28 @@ $theme: (
91
94
  marketing-block_primary_bg_2: map.get($c, 'y300'),
92
95
  marketing-block_secondary_bg_2: map.get($c, 'g100'),
93
96
  marketing-block_tertiary_bg_2: map.get($c, 'p600'),
97
+
98
+ // Cards
99
+ card: map.get($c, 'n600'),
100
+ card_bg: map.get($c, 'sand'),
101
+ card_hover_bg: map.get($c, 'n50'),
102
+ card_label: map.get($c, 'n700'),
103
+ card_img_bg: map.get($c, 'b50'),
104
+
105
+ carousel_arrow: map.get($c, 'n600'),
106
+ carousel_arrow_disabled: map.get($c, 'n200'),
107
+ carousel_arrow_bg: map.get($c, 'white'),
108
+ carousel_arrow_hover_bg: map.get($c, 'b100'),
109
+ carousel_arrow_active_bg: map.get($c, 'b300'),
110
+ carousel_arrow_disabled_bg: map.get($c, 'n50'),
111
+ carousel_arrow_border: map.get($c, 'n100'),
112
+ carousel_arrow_hover_border: map.get($c, 'b300'),
113
+ carousel_arrow_active_border: map.get($c, 'b500'),
114
+ carousel_arrow_disabled_border: map.get($c, 'b100'),
115
+ carousel_pagination_bg: map.get($c, 'n100'),
116
+ carousel_pagination_hover_bg: map.get($c, 'b200'),
117
+ carousel_pagination_selected_bg: map.get($c, 'b500'),
118
+
94
119
  // Communities
95
120
  community-details_link_hover: map.get($c, 'b500'),
96
121
  // Discussion
@@ -230,8 +255,13 @@ $theme: (
230
255
  highlighted-text-box_subtle_border: map.get($c, 'n100'),
231
256
  pill: map.get($c, 'n900'),
232
257
  pill_highlighted: map.get($c, 'n700'),
258
+ pill_registered: map.get($c, 'g700'),
233
259
  pill_bg: map.get($c, 'n200'),
260
+ pill_subtle_bg: map.get($c, 'white'),
234
261
  pill_highlighted_bg: map.get($c, 'y300'),
262
+ pill_information_bg: map.get($c, 'g100'),
263
+ pill_registered_bg: map.get($c, 'g50'),
264
+ pill_subtle_border: map.get($c, 'n200'),
235
265
  status-banner_bg: map.get($c, 'y50'),
236
266
  status-banner_success_bg: map.get($c, 'success50'),
237
267
  status-banner_success_icon: map.get($c, 'success600'),
@@ -246,5 +276,7 @@ $theme: (
246
276
  contributor_label: map.get($c, 'n600'),
247
277
  member_highlighted_name: map.get($c, 'p500'),
248
278
  member_additional-content: map.get($c, 'n700'),
249
- member_small: map.get($c, 'n700')
279
+ member_small: map.get($c, 'n700'),
280
+
281
+ profile-picture_img_bg: map.get($c, 'b50'),
250
282
  );
@@ -17,5 +17,5 @@ interface Props {
17
17
  /** Additional classes */
18
18
  className?: string;
19
19
  }
20
- declare const EmptyStateBox: ({ variant, text, button, className }: Props) => import("react/jsx-runtime").JSX.Element;
20
+ declare const EmptyStateBox: ({ variant, text, button, className, }: Props) => import("react/jsx-runtime").JSX.Element;
21
21
  export default EmptyStateBox;
@@ -1,13 +1,15 @@
1
1
  import React from 'react';
2
2
  interface Props {
3
3
  /** The size of the pill */
4
- size?: 'medium' | 'large';
4
+ size?: 'small' | 'medium' | 'large';
5
5
  /** The style of the pill */
6
- variant?: 'default' | 'highlighted';
6
+ variant?: 'default' | 'subtle' | 'highlighted' | 'information' | 'registered';
7
7
  /** Additional classes to add to the pill */
8
- className?: 'margin-left' | 'margin-right' | '';
8
+ className?: string;
9
9
  /** The pill text */
10
10
  children: React.ReactNode;
11
+ /** Optional test ID */
12
+ 'data-testid'?: string;
11
13
  }
12
- declare const Pill: ({ size, variant, className, children }: Props) => import("react/jsx-runtime").JSX.Element;
14
+ declare const Pill: ({ size, variant, className, children, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
13
15
  export default Pill;
@@ -25,9 +25,15 @@ interface Props {
25
25
  className?: string;
26
26
  /** The language to use */
27
27
  locale?: string;
28
+ /** Optional test ID */
29
+ 'data-testid'?: string;
28
30
  }
29
- declare const Contributors: ({ element, contributors: { total, data: contributors }, styling: { showText, size, showGap, showPlaceholders }, cutoff, className }: Props) => React.DetailedReactHTMLElement<{
31
+ declare const Contributors: ({ element, contributors: { total, data: contributors }, styling: { showText, size, showGap, showPlaceholders }, cutoff, className, ...props }: Props) => React.DetailedReactHTMLElement<{
30
32
  className: string;
31
33
  children: import("react/jsx-runtime").JSX.Element;
34
+ /** The language to use */
35
+ locale?: string | undefined;
36
+ /** Optional test ID */
37
+ 'data-testid'?: string | undefined;
32
38
  }, HTMLElement> | null;
33
39
  export default Contributors;
@@ -11,6 +11,8 @@ interface Props {
11
11
  height?: number;
12
12
  /** Additional classes */
13
13
  className?: string;
14
+ /** Optional test ID */
15
+ 'data-testid'?: string;
14
16
  }
15
17
  declare const ProfilePicture: ({ className, src, name, alt, width, height, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
16
18
  export default ProfilePicture;