@apolitical/component-library 2.2.3 → 2.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 (66) hide show
  1. package/accessibility/visually-hidden/visually-hidden.d.ts +3 -1
  2. package/banners/custom-content-banner/custom-content-banner.d.ts +13 -0
  3. package/banners/custom-content-banner/index.d.ts +1 -0
  4. package/banners/index.d.ts +1 -0
  5. package/cards/card/components/links/links.d.ts +1 -1
  6. package/cards/cards.types.d.ts +3 -1
  7. package/cards/mocks/mocks.helpers.d.ts +16 -0
  8. package/constants/courses.d.ts +5 -0
  9. package/constants/index.d.ts +1 -0
  10. package/courses/course-progression/course-progression.d.ts +7 -0
  11. package/courses/course-progression/course-progression.types.d.ts +28 -0
  12. package/courses/course-progression/index.d.ts +1 -0
  13. package/courses/course-structure/course-structure.d.ts +3 -0
  14. package/courses/course-structure/course-structure.mock.d.ts +122 -0
  15. package/courses/course-structure/course-structure.types.d.ts +55 -0
  16. package/courses/course-structure/index.d.ts +1 -0
  17. package/courses/index.d.ts +5 -0
  18. package/courses/lesson-name/index.d.ts +1 -0
  19. package/courses/lesson-name/lesson-name.d.ts +19 -0
  20. package/courses/lesson-type/index.d.ts +1 -0
  21. package/courses/lesson-type/lesson-type.d.ts +10 -0
  22. package/courses/mark-complete-button/index.d.ts +1 -0
  23. package/courses/mark-complete-button/mark-complete-button.d.ts +7 -0
  24. package/general/index.d.ts +2 -0
  25. package/general/link/link.d.ts +2 -0
  26. package/general/table-of-contents/index.d.ts +1 -0
  27. package/general/table-of-contents/table-of-contents.d.ts +16 -0
  28. package/general/time-to-complete/index.d.ts +1 -0
  29. package/general/time-to-complete/time-to-complete.d.ts +12 -0
  30. package/helpers/cases.d.ts +2 -0
  31. package/helpers/intl.d.ts +376 -1
  32. package/index.d.ts +3 -1
  33. package/index.js +18 -18
  34. package/index.mjs +6053 -5532
  35. package/loaders/progress-bar/progress-bar.d.ts +11 -1
  36. package/modals/invite-modal/invite-modal.d.ts +2 -2
  37. package/navigation/load-more/load-more.d.ts +2 -1
  38. package/package.json +1 -1
  39. package/sections/full-width-section/full-width-section.d.ts +2 -0
  40. package/sections/logo-section/logo-section.d.ts +11 -1
  41. package/style.css +1 -1
  42. package/styles/base/_layout.scss +2 -0
  43. package/styles/base/_lists.scss +29 -1
  44. package/styles/base/_titles.scss +14 -0
  45. package/styles/base/buttons/_button-wrapper.scss +1 -0
  46. package/styles/base/buttons/_icons.scss +9 -0
  47. package/styles/variables/colors/theme/_banners.scss +8 -0
  48. package/styles/variables/colors/theme/_base.scss +2 -0
  49. package/styles/variables/colors/theme/_courses.scss +22 -0
  50. package/styles/variables/colors/theme/_general.scss +2 -0
  51. package/styles/variables/colors/theme/_index.scss +5 -4
  52. package/styles/variables/colors/theme/_layout.scss +1 -0
  53. package/styles/variables/colors/theme/_loaders.scss +4 -0
  54. package/styles/variables/colors/theme/_text.scss +12 -0
  55. package/text/collapsible-section/accordian.d.ts +15 -0
  56. package/text/collapsible-section/collapsible-section.d.ts +4 -4
  57. package/text/content-type-label/content-type-label.d.ts +14 -0
  58. package/{cards/card/card.helpers.d.ts → text/content-type-label/content-type-label.helpers.d.ts} +1 -1
  59. package/text/content-type-label/content-type-label.types.d.ts +1 -0
  60. package/text/content-type-label/index.d.ts +2 -0
  61. package/text/highlighted-text-box/highlighted-text-box.d.ts +9 -2
  62. package/text/icon-bulleted-list/icon-bulleted-list.d.ts +31 -0
  63. package/text/icon-bulleted-list/index.d.ts +1 -0
  64. package/text/index.d.ts +2 -0
  65. package/text/markdown-text/markdown-text.d.ts +5 -1
  66. package/text/pill/pill.d.ts +1 -1
@@ -10,8 +10,10 @@ interface Props {
10
10
  href?: string;
11
11
  /** `for`, for labels */
12
12
  htmlFor?: string;
13
+ /** Additional classes */
14
+ className?: string;
13
15
  }
14
- declare const _default: React.MemoExoticComponent<({ element, showOnFocus, children, ...props }: Props) => React.DetailedReactHTMLElement<{
16
+ declare const _default: React.MemoExoticComponent<({ element, showOnFocus, children, className, ...props }: Props) => React.DetailedReactHTMLElement<{
15
17
  className: string;
16
18
  children: React.ReactNode | JSX.Element;
17
19
  /** An `href`, for links */
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ /** The image to show on the banner */
4
+ image?: string;
5
+ /** The color variant of the list */
6
+ variant?: 'default' | 'dark';
7
+ /** The content to show */
8
+ children: React.ReactNode;
9
+ /** Additional classes */
10
+ className?: string;
11
+ }
12
+ declare const CustomContentBanner: ({ image, variant, children, className, }: Props) => import("react/jsx-runtime").JSX.Element;
13
+ export default CustomContentBanner;
@@ -0,0 +1 @@
1
+ export { default as CustomContentBanner } from './custom-content-banner';
@@ -1,4 +1,5 @@
1
1
  export * from './banner';
2
2
  export * from './banner-section';
3
+ export * from './custom-content-banner';
3
4
  export * from './highlight-section';
4
5
  export * from './marketing-block';
@@ -9,5 +9,5 @@ interface Props {
9
9
  /** Context for the Google Tag Manager event */
10
10
  gtmContext?: string;
11
11
  }
12
- declare const Links: ({ data, cta, link, gtmContext }: Props) => import("react/jsx-runtime").JSX.Element | null;
12
+ declare const Links: ({ data, cta, link, gtmContext }: Props) => import("react/jsx-runtime").JSX.Element | null | undefined;
13
13
  export default Links;
@@ -1,7 +1,7 @@
1
1
  import { ResponsiveImageType } from '../general';
2
+ import { CustomIconType } from '../text';
2
3
  import { MemberProps } from '../user';
3
4
  export type CardContentType = 'customCard' | 'event' | 'learningHub' | 'listPage' | 'microcourse' | 'people' | 'qaQuestion' | 'solutionArticle';
4
- export type CustomIconType = 'calendar' | 'cube' | 'document' | 'download' | 'globe' | 'graduationCap' | 'link' | 'person' | 'star' | 'speech';
5
5
  export interface CardCTAType {
6
6
  /** The text to show on the CTA button - different content types have different fallbacks */
7
7
  text?: string;
@@ -46,6 +46,8 @@ export interface CardType {
46
46
  customIcon?: CustomIconType;
47
47
  /** The label to use */
48
48
  customLabel?: string;
49
+ /** The link to use */
50
+ customLinkText?: string;
49
51
  /** Event cards */
50
52
  /** The date the event starts */
51
53
  startDate?: string;
@@ -95,6 +95,7 @@ export declare const cardMapper: {
95
95
  shortQuestion?: undefined;
96
96
  longQuestion?: undefined;
97
97
  people?: undefined;
98
+ customLink?: undefined;
98
99
  learningHub?: undefined;
99
100
  custom?: undefined;
100
101
  } | {
@@ -179,6 +180,7 @@ export declare const cardMapper: {
179
180
  shortQuestion?: undefined;
180
181
  longQuestion?: undefined;
181
182
  people?: undefined;
183
+ customLink?: undefined;
182
184
  learningHub?: undefined;
183
185
  custom?: undefined;
184
186
  } | {
@@ -296,6 +298,7 @@ export declare const cardMapper: {
296
298
  shortQuestion?: undefined;
297
299
  longQuestion?: undefined;
298
300
  people?: undefined;
301
+ customLink?: undefined;
299
302
  learningHub?: undefined;
300
303
  custom?: undefined;
301
304
  } | {
@@ -330,6 +333,7 @@ export declare const cardMapper: {
330
333
  shortQuestion?: undefined;
331
334
  longQuestion?: undefined;
332
335
  people?: undefined;
336
+ customLink?: undefined;
333
337
  learningHub?: undefined;
334
338
  custom?: undefined;
335
339
  } | {
@@ -401,6 +405,7 @@ export declare const cardMapper: {
401
405
  multipleSpeakers?: undefined;
402
406
  list?: undefined;
403
407
  people?: undefined;
408
+ customLink?: undefined;
404
409
  learningHub?: undefined;
405
410
  custom?: undefined;
406
411
  } | {
@@ -412,6 +417,15 @@ export declare const cardMapper: {
412
417
  profile: string;
413
418
  slug: string;
414
419
  };
420
+ customLink: {
421
+ slug: string;
422
+ customLinkText: string;
423
+ contentType: string;
424
+ title: string;
425
+ text: string;
426
+ secondaryText: string;
427
+ profile: string;
428
+ };
415
429
  oneAuthor?: undefined;
416
430
  twoAuthors?: undefined;
417
431
  multipleAuthors?: undefined;
@@ -459,6 +473,7 @@ export declare const cardMapper: {
459
473
  shortQuestion?: undefined;
460
474
  longQuestion?: undefined;
461
475
  people?: undefined;
476
+ customLink?: undefined;
462
477
  custom?: undefined;
463
478
  } | {
464
479
  custom: {
@@ -493,6 +508,7 @@ export declare const cardMapper: {
493
508
  shortQuestion?: undefined;
494
509
  longQuestion?: undefined;
495
510
  people?: undefined;
511
+ customLink?: undefined;
496
512
  learningHub?: undefined;
497
513
  };
498
514
  };
@@ -0,0 +1,5 @@
1
+ export declare const COURSE_CONTENT_TYPES: {
2
+ ARTICLE: string;
3
+ DISCUSSION: string;
4
+ QUIZ: string;
5
+ };
@@ -1,3 +1,4 @@
1
1
  export * from './assets';
2
2
  export * from './contact-details';
3
+ export * from './courses';
3
4
  export * from './number-of-users';
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { ICourseProgressionTypes } from './course-progression.types';
3
+ declare const CourseProgression: ({ element, data: { timeLeftToFinish, percentageCompleted: { inTime, inLessons }, shouldShowTimes, }, graph, styling, className, }: ICourseProgressionTypes) => React.DetailedReactHTMLElement<{
4
+ className: string;
5
+ children: import("react/jsx-runtime").JSX.Element;
6
+ }, HTMLElement>;
7
+ export default CourseProgression;
@@ -0,0 +1,28 @@
1
+ export interface ICourseProgressionData {
2
+ /** The amount of time the remaining, completeable lessons will take to finish, in minutes */
3
+ timeLeftToFinish: number;
4
+ /** The percentage of the course that has been completed */
5
+ percentageCompleted: {
6
+ /** The percentage of timed lessons complete - this is used when the course shows the time for lessons */
7
+ inTime?: number;
8
+ /** The percentage of total, completeable lessons complete - this is used when the course hides the time for lessons */
9
+ inLessons?: number;
10
+ };
11
+ /** Whether the course shows the time for lessons */
12
+ shouldShowTimes?: boolean;
13
+ }
14
+ export interface ICourseProgressionTypes {
15
+ /** The element to wrap the course progression in */
16
+ element?: 'p' | 'aside' | 'div';
17
+ /** The data to display */
18
+ data: ICourseProgressionData;
19
+ /** The type of graph to display */
20
+ graph?: 'bar' | 'circle' | false;
21
+ /** Styling options */
22
+ styling?: {
23
+ /** Whether to highlight the percentage text */
24
+ highlightPercentage?: boolean;
25
+ };
26
+ /** Additional classes */
27
+ className?: string;
28
+ }
@@ -0,0 +1 @@
1
+ export { default as CourseProgression } from './course-progression';
@@ -0,0 +1,3 @@
1
+ import { ICourseStructure } from './course-structure.types';
2
+ declare const CourseStructure: ({ course: { articles, canAccessCourse, description, hideTimes, isEnrolled, sectionId, sectionTime, slug: microcourseSlug, timeLeft, title, }, quizScores, }: ICourseStructure) => import("react/jsx-runtime").JSX.Element;
3
+ export default CourseStructure;
@@ -0,0 +1,122 @@
1
+ export default data;
2
+ declare namespace data {
3
+ namespace course {
4
+ let articles: ({
5
+ title: string;
6
+ slug: string;
7
+ subsectionId: number;
8
+ humanTranslation: boolean;
9
+ completionTime: number;
10
+ type: string;
11
+ icon: string;
12
+ content: {
13
+ sys: {
14
+ type: string;
15
+ linkType: string;
16
+ id: string;
17
+ };
18
+ };
19
+ optional: boolean;
20
+ contentType: string;
21
+ createdAt: string;
22
+ updatedAt: string;
23
+ image: null;
24
+ isIntroduction: boolean;
25
+ completed: boolean;
26
+ sectionId: number;
27
+ description?: undefined;
28
+ questions?: undefined;
29
+ question?: undefined;
30
+ } | {
31
+ title: string;
32
+ slug: string;
33
+ subsectionId: number;
34
+ humanTranslation: boolean;
35
+ completionTime: number;
36
+ type: string;
37
+ icon: string;
38
+ content: {
39
+ sys: {
40
+ type: string;
41
+ linkType: string;
42
+ id: string;
43
+ };
44
+ };
45
+ optional: boolean;
46
+ contentType: string;
47
+ createdAt: string;
48
+ updatedAt: string;
49
+ image: string;
50
+ isIntroduction: boolean;
51
+ completed: boolean;
52
+ sectionId: number;
53
+ description?: undefined;
54
+ questions?: undefined;
55
+ question?: undefined;
56
+ } | {
57
+ title: string;
58
+ slug: string;
59
+ subsectionId: number;
60
+ description: string;
61
+ questions: {
62
+ sys: {
63
+ type: string;
64
+ linkType: string;
65
+ id: string;
66
+ };
67
+ }[];
68
+ optional: boolean;
69
+ contentType: string;
70
+ createdAt: string;
71
+ updatedAt: string;
72
+ icon: string;
73
+ type: string;
74
+ completed: boolean;
75
+ sectionId: number;
76
+ humanTranslation?: undefined;
77
+ completionTime?: undefined;
78
+ content?: undefined;
79
+ image?: undefined;
80
+ isIntroduction?: undefined;
81
+ question?: undefined;
82
+ } | {
83
+ title: string;
84
+ slug: string;
85
+ subsectionId: number;
86
+ description: string;
87
+ question: {
88
+ sys: {
89
+ type: string;
90
+ linkType: string;
91
+ id: string;
92
+ };
93
+ };
94
+ optional: boolean;
95
+ contentType: string;
96
+ createdAt: string;
97
+ updatedAt: string;
98
+ icon: string;
99
+ type: string;
100
+ completed: boolean;
101
+ sectionId: number;
102
+ humanTranslation?: undefined;
103
+ completionTime?: undefined;
104
+ content?: undefined;
105
+ image?: undefined;
106
+ isIntroduction?: undefined;
107
+ questions?: undefined;
108
+ })[];
109
+ let canAccessCourse: boolean;
110
+ let description: string;
111
+ let hideTimes: boolean;
112
+ let isEnrolled: boolean;
113
+ let sectionId: number;
114
+ let sectionTime: number;
115
+ let slug: string;
116
+ let timeLeft: number;
117
+ let title: string;
118
+ }
119
+ let quizScores: {
120
+ 'check-what-youve-learned-vaw-data-1': number;
121
+ };
122
+ }
@@ -0,0 +1,55 @@
1
+ export interface ILessonType {
2
+ /** The time it takes to complete the article */
3
+ completionTime: number;
4
+ /** The article's icon */
5
+ icon: string;
6
+ /** Whether the article is optional */
7
+ optional: boolean;
8
+ /** The article's type */
9
+ type: string;
10
+ }
11
+ export interface ICourseStructureArticles extends ILessonType {
12
+ /** The article's content type */
13
+ contentType: string;
14
+ /** Whether the use has completed the article */
15
+ completed: boolean;
16
+ /** The article's image */
17
+ image?: string;
18
+ /** Whether the article is an introduction, which is visible whether the user is enrolled or not */
19
+ isIntroduction: boolean;
20
+ /** The article's slug */
21
+ slug: string;
22
+ /** The subsection ID */
23
+ subsectionId: number;
24
+ /** The article's title */
25
+ title: string;
26
+ }
27
+ export interface ICourseStructureCourse {
28
+ /** Articles in the course */
29
+ articles: ICourseStructureArticles[];
30
+ /** Whether the user can access the course */
31
+ canAccessCourse: boolean;
32
+ /** Description of the course */
33
+ description: string;
34
+ /** Whether to hide the times */
35
+ hideTimes: boolean;
36
+ /** Whether the user is enrolled in the course */
37
+ isEnrolled: boolean;
38
+ /** The section ID */
39
+ sectionId: number;
40
+ /** The time it takes to complete the course */
41
+ sectionTime: number;
42
+ /** The course slug */
43
+ slug: string;
44
+ /** The time left to complete the course */
45
+ timeLeft: number;
46
+ /** The course title */
47
+ title: string;
48
+ }
49
+ export interface ICourseStructure {
50
+ /** Details about the course */
51
+ course: ICourseStructureCourse;
52
+ quizScores?: {
53
+ [key: string]: number;
54
+ };
55
+ }
@@ -0,0 +1 @@
1
+ export { default as CourseStructure } from './course-structure';
@@ -0,0 +1,5 @@
1
+ export * from './course-progression';
2
+ export * from './course-structure';
3
+ export * from './lesson-name';
4
+ export * from './lesson-type';
5
+ export * from './mark-complete-button';
@@ -0,0 +1 @@
1
+ export { default as LessonName } from './lesson-name';
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ /** The element to use for the lesson name */
4
+ element?: 'h1' | 'span';
5
+ /** The ID of the lesson section */
6
+ sectionId: number;
7
+ /** The ID of the section article */
8
+ subsectionId: number;
9
+ /** The title of the lesson */
10
+ title: string;
11
+ /** Additional classes */
12
+ className?: string;
13
+ }
14
+ declare const LessonName: ({ element, sectionId, subsectionId, title, className, }: Props) => React.DetailedReactHTMLElement<{
15
+ className: string;
16
+ 'data-number': string;
17
+ children: string;
18
+ }, HTMLElement>;
19
+ export default LessonName;
@@ -0,0 +1 @@
1
+ export { default as LessonType } from './lesson-type';
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { ILessonType } from './../course-structure/course-structure.types';
3
+ interface LessonTypeProps extends ILessonType {
4
+ /** The size of the component */
5
+ size?: 'default' | 'large';
6
+ /** Optional children */
7
+ children?: React.ReactNode;
8
+ }
9
+ declare const LessonType: ({ size, completionTime, icon, optional, type, children, }: LessonTypeProps) => import("react/jsx-runtime").JSX.Element;
10
+ export default LessonType;
@@ -0,0 +1 @@
1
+ export { default as MarkCompleteButton } from './mark-complete-button';
@@ -0,0 +1,7 @@
1
+ import { ButtonPropsType } from '../../general';
2
+ interface MarkCompleteButtonProps extends ButtonPropsType {
3
+ /** Whether the lesson is complete */
4
+ isComplete?: boolean;
5
+ }
6
+ declare const MarkCompleteButton: ({ isComplete, onClick, ...props }: MarkCompleteButtonProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default MarkCompleteButton;
@@ -4,4 +4,6 @@ export * from './image-container';
4
4
  export * from './link';
5
5
  export * from './responsive-image';
6
6
  export * from './return-to-nav-button';
7
+ export * from './table-of-contents';
8
+ export * from './time-to-complete';
7
9
  export * from './tooltip';
@@ -22,6 +22,8 @@ interface Props {
22
22
  ariaLabel?: string;
23
23
  /** Test id for link */
24
24
  'data-testid'?: string;
25
+ /** Data attributes for the link */
26
+ 'data-before'?: string;
25
27
  }
26
28
  declare const Link: ({ href, children, fallbackElement, className, onClick, gtmContext, gtmType, ...props }: Props) => string | JSX.Element | JSX.Element[];
27
29
  export default Link;
@@ -0,0 +1 @@
1
+ export { default as TableOfContents } from './table-of-contents';
@@ -0,0 +1,16 @@
1
+ interface TableOfContentsItem {
2
+ /** The id of the element to link to */
3
+ id: string;
4
+ /** The text to show in the link */
5
+ text: string;
6
+ }
7
+ interface Props {
8
+ /** The items to show. This will default to all h1-h6s inside the `selector`. */
9
+ items?: TableOfContentsItem[];
10
+ /** A parent selector for all h1-h6s, to use if no items have been passed in. */
11
+ selector?: string;
12
+ /** Additional classes */
13
+ className?: string;
14
+ }
15
+ declare const TableOfContents: ({ items: originalItems, selector, className, }: Props) => false | import("react/jsx-runtime").JSX.Element;
16
+ export default TableOfContents;
@@ -0,0 +1 @@
1
+ export { default as TimeToComplete } from './time-to-complete';
@@ -0,0 +1,12 @@
1
+ interface Props {
2
+ /** The time to display, in minutes */
3
+ time: number;
4
+ /** Text to show before the time */
5
+ prependedText?: string;
6
+ /** Text to show after the time */
7
+ appendedText?: string;
8
+ /** Additional classes */
9
+ className?: string;
10
+ }
11
+ declare const TimeToComplete: ({ time, prependedText, appendedText, className }: Props) => import("react/jsx-runtime").JSX.Element | null;
12
+ export default TimeToComplete;
@@ -1 +1,3 @@
1
1
  export declare const camelCaseToDashCase: (str: string) => string;
2
+ export declare const toCamelCase: (str?: string) => string;
3
+ export declare const toSentenceCase: (str?: string) => string;