@apolitical/component-library 1.18.8 → 2.0.1-4125.5

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 (124) hide show
  1. package/communities/join-button/join-button.d.ts +1 -1
  2. package/context/user/index.d.ts +1 -1
  3. package/discussion/components/likes/likes.d.ts +1 -1
  4. package/discussion/feeds/activities-feed/activities-feed.d.ts +7 -0
  5. package/discussion/feeds/replies-feed/nested-replies-feed/nested-replies-feed.d.ts +6 -0
  6. package/discussion/feeds/replies-feed/replies-feed.d.ts +8 -0
  7. package/form/components/email-helper-text-box/email-helper-text-box.d.ts +1 -1
  8. package/form/components/form/components/field-wrapper/field-wrapper.d.ts +3 -0
  9. package/form/components/form/components/field-wrapper/index.d.ts +1 -0
  10. package/form/components/form/components/fields/checkbox/checkbox.d.ts +31 -0
  11. package/form/components/form/components/fields/checkbox/index.d.ts +1 -0
  12. package/form/components/form/components/fields/dropdown-menu/components/index.d.ts +1 -0
  13. package/form/components/form/components/fields/dropdown-menu/components/rotating-chevron/index.d.ts +1 -0
  14. package/form/components/form/components/fields/dropdown-menu/components/rotating-chevron/rotating-chevron.d.ts +6 -0
  15. package/form/components/form/components/fields/dropdown-menu/dropdown-menu.d.ts +3 -0
  16. package/form/components/form/components/fields/dropdown-menu/index.d.ts +1 -0
  17. package/form/components/form/components/fields/index.d.ts +5 -0
  18. package/form/components/form/components/fields/input/index.d.ts +1 -0
  19. package/form/components/form/components/fields/input/input.d.ts +39 -0
  20. package/form/components/form/components/fields/multiple-options/index.d.ts +1 -0
  21. package/form/components/form/components/fields/multiple-options/multiple-options.d.ts +3 -0
  22. package/form/components/form/components/fields/password/index.d.ts +1 -0
  23. package/form/components/form/components/fields/password/password.d.ts +3 -0
  24. package/form/components/form/components/index.d.ts +2 -0
  25. package/form/components/form/form.d.ts +3 -0
  26. package/form/components/form/form.mocks.d.ts +18 -0
  27. package/form/components/form/form.reducer.d.ts +3 -0
  28. package/form/components/form/form.types.d.ts +189 -0
  29. package/form/components/form/index.d.ts +1 -0
  30. package/form/components/index.d.ts +1 -0
  31. package/form/components/password-rules/password-rules.d.ts +1 -1
  32. package/form/components/rating/rating.d.ts +1 -1
  33. package/form/types/contact-form/contact-form.d.ts +12 -0
  34. package/form/types/contact-form/index.d.ts +1 -0
  35. package/form/types/index.d.ts +3 -1
  36. package/form/types/signup-form/components/index.d.ts +1 -0
  37. package/form/types/signup-form/components/success-message.d.ts +4 -0
  38. package/form/types/signup-form/index.d.ts +1 -0
  39. package/form/types/signup-form/signup-form.d.ts +25 -0
  40. package/form/types/signup-form/signup-form.helpers.d.ts +41 -0
  41. package/form/types/signup-form/signup-form.helpers.get-fields.d.ts +56 -0
  42. package/general/buttons/button/button.d.ts +1 -1
  43. package/helpers/in-development.d.ts +1 -0
  44. package/helpers/index.d.ts +4 -3
  45. package/index.js +34 -15
  46. package/index.mjs +5417 -2940
  47. package/layout/content-layout/contact-footer/contact-footer.d.ts +5 -0
  48. package/layout/content-layout/contact-footer/index.d.ts +1 -0
  49. package/layout/content-layout/index.d.ts +1 -0
  50. package/mappers/index.d.ts +1 -1
  51. package/mappers/{mapGetSteamData.d.ts → map-get-steam-data.d.ts} +1 -1
  52. package/modals/index.d.ts +1 -1
  53. package/navigation/filters/filters.d.ts +1 -1
  54. package/navigation/more-menu/more-menu.d.ts +1 -1
  55. package/package.json +2 -1
  56. package/sections/full-width-section/full-width-section.d.ts +2 -0
  57. package/sections/logo-section/logo-section.d.ts +1 -1
  58. package/style.css +1 -1
  59. package/styles/README.md +28 -0
  60. package/styles/base/_accessibility.scss +21 -11
  61. package/styles/base/_blockquotes.scss +31 -20
  62. package/styles/base/_fonts.scss +10 -6
  63. package/styles/base/_hr.scss +9 -8
  64. package/styles/base/_index.scss +2 -13
  65. package/styles/base/_layout.scss +5 -4
  66. package/styles/base/_links.scss +11 -13
  67. package/styles/base/_lists.scss +26 -13
  68. package/styles/base/_overlays.scss +34 -32
  69. package/styles/base/_table.scss +40 -27
  70. package/styles/base/_text.scss +128 -63
  71. package/styles/base/_titles.scss +192 -114
  72. package/styles/base/buttons/_button-wrapper.scss +23 -18
  73. package/styles/base/buttons/_buttons.scss +246 -169
  74. package/styles/base/buttons/_icons.scss +26 -26
  75. package/styles/base/buttons/_index.scss +1 -2
  76. package/styles/base/buttons/_mixins.scss +9 -3
  77. package/styles/base/buttons/_sizes.scss +47 -8
  78. package/styles/base/form/_fields.scss +50 -41
  79. package/styles/base/form/_form.scss +26 -0
  80. package/styles/base/form/_index.scss +1 -2
  81. package/styles/base/form/_labels.scss +12 -0
  82. package/styles/base/form/_search-button.scss +17 -17
  83. package/styles/functions/_index.scss +1 -1
  84. package/styles/functions/_maps.scss +25 -0
  85. package/styles/functions/_size-conversions.scss +3 -3
  86. package/styles/index.scss +3 -5
  87. package/styles/mixins/_animations.scss +1 -1
  88. package/styles/mixins/_backgrounds.scss +8 -2
  89. package/styles/mixins/_breakpoints.scss +1 -1
  90. package/styles/mixins/_browsers.scss +4 -2
  91. package/styles/mixins/_containers.scss +0 -1
  92. package/styles/mixins/_index.scss +2 -8
  93. package/styles/mixins/_queries.scss +11 -0
  94. package/styles/mixins/_selectors.scss +1 -1
  95. package/styles/mixins/_styles.scss +23 -21
  96. package/styles/mixins/_transitions.scss +19 -15
  97. package/styles/reset/_index.scss +1 -1
  98. package/styles/reset/_reset.scss +104 -20
  99. package/styles/variables/_index.scss +1 -3
  100. package/styles/variables/assets/_assets.scss +0 -1
  101. package/styles/variables/assets/_index.scss +1 -1
  102. package/styles/variables/colors/_colors.scss +53 -53
  103. package/styles/variables/colors/_index.scss +1 -1
  104. package/styles/variables/colors/theme/_banners.scss +26 -0
  105. package/styles/variables/colors/theme/_base.scss +88 -0
  106. package/styles/variables/colors/theme/_cards.scss +24 -0
  107. package/styles/variables/colors/theme/_communities.scss +7 -0
  108. package/styles/variables/colors/theme/_discussion.scss +20 -0
  109. package/styles/variables/colors/theme/_form.scss +25 -0
  110. package/styles/variables/colors/theme/_general.scss +9 -0
  111. package/styles/variables/colors/theme/_index.scss +8 -0
  112. package/styles/variables/colors/theme/_layout.scss +50 -0
  113. package/styles/variables/colors/theme/_loaders.scss +20 -0
  114. package/styles/variables/colors/theme/_modals.scss +14 -0
  115. package/styles/variables/colors/theme/_navigation.scss +41 -0
  116. package/styles/variables/colors/theme/_pages.scss +9 -0
  117. package/styles/variables/colors/theme/_text.scss +47 -0
  118. package/styles/variables/colors/theme/_user.scss +16 -0
  119. package/styles/variables/sizes/_common.scss +1 -1
  120. package/styles/variables/sizes/_index.scss +1 -1
  121. package/text/helper-text-box/helper-text-box.d.ts +1 -1
  122. package/text/hide-show-text-box/hide-show-text-box.d.ts +1 -1
  123. package/types/index.d.ts +1 -0
  124. package/styles/variables/colors/_theme.scss +0 -312
@@ -13,5 +13,5 @@ export interface IJoinButtonProps {
13
13
  /** The language to use */
14
14
  locale?: string;
15
15
  }
16
- declare const JoinButton: ({ isMember: userIsMember, isShort, functions: { join, leave } }: IJoinButtonProps) => import("react/jsx-runtime").JSX.Element;
16
+ declare const JoinButton: ({ isMember: userIsMember, isShort, functions: { join, leave }, }: IJoinButtonProps) => import("react/jsx-runtime").JSX.Element;
17
17
  export default JoinButton;
@@ -1,4 +1,4 @@
1
- export type { IUserDetails } from './user.context';
1
+ export type { IUserContext, IUserDetails } from './user.context';
2
2
  export * from './user.context';
3
3
  export * from './user.hook';
4
4
  export * from './user.provider';
@@ -26,7 +26,7 @@ interface Props {
26
26
  /** The language to use for the text */
27
27
  locale?: string;
28
28
  }
29
- declare const Likes: ({ element, likes, peopleWhoLiked, isShort, userLiked, content, canLike, functions: { createLike, deleteLike } }: Props) => React.DetailedReactHTMLElement<{
29
+ declare const Likes: ({ element, likes, peopleWhoLiked, isShort, userLiked, content, canLike, functions: { createLike, deleteLike }, }: Props) => React.DetailedReactHTMLElement<{
30
30
  className: string;
31
31
  onClick: (e: React.MouseEvent<HTMLElement>) => false | undefined;
32
32
  onMouseEnter: () => void;
@@ -1,12 +1,19 @@
1
1
  /// <reference types="react" />
2
2
  import type { IQueryFns } from './cache';
3
3
  interface Props {
4
+ /** The base path, used for slugs */
4
5
  basePath: string;
6
+ /** The ID of the parent, used for slugs */
5
7
  parentId: string;
8
+ /** Whether the user is a member of the community */
6
9
  isMember: boolean;
10
+ /** Functions for the activities query */
7
11
  functions: {
12
+ /** Query functions for the activities */
8
13
  activities: IQueryFns;
14
+ /** Function to join the community */
9
15
  join: () => Promise<void>;
16
+ /** Function to leave the community */
10
17
  leave: () => Promise<void>;
11
18
  };
12
19
  }
@@ -1,11 +1,17 @@
1
1
  /// <reference types="react" />
2
2
  import type { IQueryFns } from './../cache';
3
3
  interface Props {
4
+ /** The base path, used for slugs */
4
5
  basePath: string;
6
+ /** The ID of the parent, used for slugs */
5
7
  parentId: string;
8
+ /** The ID of the activity the replies are for */
6
9
  activityId: string;
10
+ /** The ID of the reply the nested replies are for */
7
11
  replyId: string;
12
+ /** Whether the user is a member of the community */
8
13
  isMember: boolean;
14
+ /** Functions for the replies query */
9
15
  functions: IQueryFns;
10
16
  }
11
17
  declare const NestedRepliesFeed: React.FC<Props>;
@@ -1,13 +1,21 @@
1
1
  /// <reference types="react" />
2
2
  import type { IQueryFns } from './cache';
3
3
  interface Props {
4
+ /** The base path, used for slugs */
4
5
  basePath: string;
6
+ /** The ID of the parent, used for slugs */
5
7
  parentId: string;
8
+ /** The ID of the activity the replies are for */
6
9
  activityId: string;
10
+ /** Whether the user is a member of the community */
7
11
  isMember: boolean;
12
+ /** Functions for the replies query */
8
13
  functions: {
14
+ /** Query functions for the replies */
9
15
  reactions: IQueryFns;
16
+ /** Function to join the community */
10
17
  join: () => Promise<void>;
18
+ /** Function to leave the community */
11
19
  leave: () => Promise<void>;
12
20
  };
13
21
  }
@@ -10,5 +10,5 @@ interface Props {
10
10
  /** The language to use */
11
11
  locale?: string;
12
12
  }
13
- declare const EmailHelperTextBox: ({ type: content, email, redirectPath, resendVerificationCode }: Props) => import("react/jsx-runtime").JSX.Element;
13
+ declare const EmailHelperTextBox: ({ type: content, email, redirectPath, resendVerificationCode, }: Props) => import("react/jsx-runtime").JSX.Element;
14
14
  export default EmailHelperTextBox;
@@ -0,0 +1,3 @@
1
+ import { IFieldWrapper } from '../../form.types';
2
+ declare const FieldWrapper: ({ id, intlPath, className, error, functions, limit, showRequiredLabels, type, validation, value, ...props }: IFieldWrapper) => import("react/jsx-runtime").JSX.Element;
3
+ export default FieldWrapper;
@@ -0,0 +1 @@
1
+ export { default as FieldWrapper } from './field-wrapper';
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { IField } from '../../../form.types';
3
+ export declare const Checkbox: ({ className, disabled, element, functions: allFunctions, id, inputRef: ref, intlPath, label, shownValue: value, type, value: isChecked, ...props }: IField) => React.DOMElement<{
4
+ onBlur?: (() => void) | undefined;
5
+ onFocus?: (() => void) | undefined;
6
+ 'aria-describedby'?: string | undefined;
7
+ 'aria-invalid'?: boolean | undefined;
8
+ 'aria-required'?: boolean | undefined;
9
+ autoComplete?: string | undefined;
10
+ component?: any;
11
+ 'data-character-limit'?: number | undefined;
12
+ 'data-testid'?: string | undefined;
13
+ gtm?: {
14
+ context?: string | undefined;
15
+ event?: string | undefined;
16
+ } | undefined;
17
+ initialValue?: import("../../../form.types").FormValues;
18
+ limit?: number | undefined;
19
+ multiSelect?: boolean | undefined;
20
+ name?: string | undefined;
21
+ options?: import("../../../form.types").IFieldOption[] | undefined;
22
+ placeholder?: string | undefined;
23
+ props?: {
24
+ [key: string]: string | boolean | React.RefObject<any> | (() => void);
25
+ } | undefined;
26
+ required?: boolean | undefined;
27
+ validation?: import("../../../form.types").IFieldValidation[] | undefined;
28
+ onClick: (e: React.MouseEvent<HTMLElement>) => void;
29
+ className: string;
30
+ }, Element>;
31
+ export default Checkbox;
@@ -0,0 +1 @@
1
+ export { default as Checkbox } from './checkbox';
@@ -0,0 +1 @@
1
+ export * from './rotating-chevron';
@@ -0,0 +1 @@
1
+ export { default as RotatingChevron } from './rotating-chevron';
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ interface IRotatingChevronProps {
3
+ direction: 'up' | 'down';
4
+ }
5
+ declare const RotatingChevron: import("react").NamedExoticComponent<IRotatingChevronProps>;
6
+ export default RotatingChevron;
@@ -0,0 +1,3 @@
1
+ import { IField } from '../../../../../../form/components/form/form.types';
2
+ declare const DropdownMenu: ({ className, options, initialValue, value, functions: allFunctions, gtm: { context }, }: IField) => import("react/jsx-runtime").JSX.Element;
3
+ export default DropdownMenu;
@@ -0,0 +1 @@
1
+ export { default as DropdownMenu } from './dropdown-menu';
@@ -0,0 +1,5 @@
1
+ export * from './input';
2
+ export * from './checkbox';
3
+ export * from './dropdown-menu';
4
+ export * from './multiple-options';
5
+ export * from './password';
@@ -0,0 +1 @@
1
+ export { default as Input } from './input';
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import { IField, InputTypes, InputValues } from '../../../form.types';
3
+ export declare const Input: ({ className, element, id, inputRef: ref, functions, name, placeholder, type, value, ...props }: IField) => React.DOMElement<{
4
+ onChange: (e: React.FormEvent<HTMLInputElement>) => void;
5
+ onBlur?: (() => void) | undefined;
6
+ onFocus?: (() => void) | undefined;
7
+ type: InputTypes;
8
+ id: string | undefined;
9
+ name: string | undefined;
10
+ className: string;
11
+ value: InputValues;
12
+ placeholder: string | undefined;
13
+ 'aria-describedby'?: string | undefined;
14
+ 'aria-invalid'?: boolean | undefined;
15
+ 'aria-required'?: boolean | undefined;
16
+ autoComplete?: string | undefined;
17
+ component?: any;
18
+ 'data-character-limit'?: number | undefined;
19
+ 'data-testid'?: string | undefined;
20
+ disabled?: boolean | undefined;
21
+ gtm?: {
22
+ context?: string | undefined;
23
+ event?: string | undefined;
24
+ } | undefined;
25
+ initialValue?: import("../../../form.types").FormValues;
26
+ intlPath?: string | false | undefined;
27
+ label?: React.ReactNode;
28
+ limit?: number | undefined;
29
+ multiSelect?: boolean | undefined;
30
+ options?: import("../../../form.types").IFieldOption[] | undefined;
31
+ props?: {
32
+ [key: string]: string | boolean | React.RefObject<any> | (() => void);
33
+ } | undefined;
34
+ required?: boolean | undefined;
35
+ shownValue?: InputValues | undefined;
36
+ validation?: import("../../../form.types").IFieldValidation[] | undefined;
37
+ ref: React.RefObject<HTMLInputElement>;
38
+ }, HTMLInputElement>;
39
+ export default Input;
@@ -0,0 +1 @@
1
+ export { default as MultipleOptions } from './multiple-options';
@@ -0,0 +1,3 @@
1
+ import { IField } from '../../../form.types';
2
+ export declare const MultipleOptions: ({ className, functions, intlPath, id: groupId, label, multiSelect, name, options, required, type, value, ...props }: IField) => import("react/jsx-runtime").JSX.Element;
3
+ export default MultipleOptions;
@@ -0,0 +1 @@
1
+ export { default as Password } from './password';
@@ -0,0 +1,3 @@
1
+ import { IField } from '../../../form.types';
2
+ export declare const Password: ({ inputRef: ref, type, gtm: { context }, ...props }: IField) => import("react/jsx-runtime").JSX.Element;
3
+ export default Password;
@@ -0,0 +1,2 @@
1
+ export * from './fields';
2
+ export { FieldWrapper } from './field-wrapper';
@@ -0,0 +1,3 @@
1
+ import { IFormProps } from './form.types';
2
+ declare const Form: ({ fields, className, id: formId, formRef: ref, intlPath, button, meta: { shouldReset, showRequiredLabels }, gtm, functions: { onSuccess, onCatch, onFailure }, ...props }: IFormProps) => import("react/jsx-runtime").JSX.Element | null;
3
+ export default Form;
@@ -0,0 +1,18 @@
1
+ import { IField } from './form.types';
2
+ export declare const text: {
3
+ test_checkbox_link: string;
4
+ };
5
+ export declare const intl: import("react-intl").IntlShape;
6
+ export declare const messages: {
7
+ test_checkbox_link: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ };
11
+ };
12
+ export declare const textToLimit = "abcdefghij";
13
+ export declare const customValue = "Ahoy!";
14
+ interface IMockFields {
15
+ [key: string]: IField;
16
+ }
17
+ export declare const fields: IMockFields;
18
+ export default fields;
@@ -0,0 +1,3 @@
1
+ import { IFormReducerAction, IFormReducerState } from './form.types';
2
+ declare const formReducer: (state: IFormReducerState, action: IFormReducerAction) => IFormReducerState;
3
+ export default formReducer;
@@ -0,0 +1,189 @@
1
+ import { ButtonPropsType } from '../../../general';
2
+ import { IReducerAction } from '../../../types';
3
+ import React from 'react';
4
+ import { IntlShape } from 'react-intl';
5
+ export type InputValues = string | number | boolean | null;
6
+ export type MultipleInputValues = InputValues[];
7
+ export type FormValues = InputValues | MultipleInputValues | undefined;
8
+ export type InputTypes = 'text' | 'textarea' | 'email' | 'checkbox' | 'select' | 'radio' | 'password';
9
+ export interface ILabel {
10
+ /** The element to be used, defaulting to `label` */
11
+ element?: string;
12
+ /** The ID of the input to be labelled */
13
+ htmlFor?: string;
14
+ }
15
+ export type FormActionTypes = 'addError' | 'formSubmitted' | 'formSubmittedAndReset' | 'removeError' | 'submitForm' | 'toggleSubmitting' | 'updateValue';
16
+ export type FieldValidationConditions = boolean | 'no-numbers' | 'required' | 'valid-email' | 'valid-url' | 'custom-validation' | ((arg: IFormValues) => boolean);
17
+ export interface IFieldOption {
18
+ /** The ID of the option */
19
+ id: string;
20
+ /** The label text of the option */
21
+ label: string | React.ReactNode;
22
+ /** The value of the option */
23
+ value?: InputValues;
24
+ /** Whether the option is disabled */
25
+ disabled?: boolean;
26
+ }
27
+ export type PayloadValues = InputValues | MultipleInputValues | (() => void) | string | boolean;
28
+ export interface IFormPayload {
29
+ /** The key of the data to update in state */
30
+ key?: string | number;
31
+ /** The value of the data to update in state */
32
+ value?: PayloadValues;
33
+ /** An array describing the fields for the form */
34
+ fields?: IField[];
35
+ /** The dispatch function to update the form state */
36
+ dispatch?: React.Dispatch<IFormReducerAction>;
37
+ /** The internationalisation object */
38
+ intl?: IntlShape;
39
+ /** Function to call when everything succeeds */
40
+ onSuccess?: (arg: IFormValues) => void;
41
+ /** Function to call when something fails */
42
+ onFailure?: (arg: IFormValues) => void;
43
+ }
44
+ export interface IFormReducerAction extends IReducerAction<IFormPayload> {
45
+ }
46
+ export interface IFormReducerState {
47
+ 'custom-validation'?: string | boolean;
48
+ errors?: {
49
+ [key: string]: (() => void) | FormValues;
50
+ };
51
+ formSubmitted: boolean;
52
+ isSubmitting: boolean;
53
+ values?: IFormValues;
54
+ }
55
+ export interface IFormValues {
56
+ [key: string]: FormValues;
57
+ }
58
+ export interface IFieldValidation {
59
+ condition: FieldValidationConditions;
60
+ error?: string;
61
+ }
62
+ export interface IField {
63
+ /** Optional ID of the element which describes this field, for screen readers */
64
+ 'aria-describedby'?: string;
65
+ /** Optional data for screen readers on if the field content is invalid */
66
+ 'aria-invalid'?: boolean;
67
+ /** Optional data for screen readers on if the field is required */
68
+ 'aria-required'?: boolean;
69
+ /** Whether the field can be automatically filled */
70
+ autoComplete?: string;
71
+ /** Additional classes to be added to the field */
72
+ className?: string;
73
+ /** The component to render, instead of rendering a field (e.g. for when we need a component like `EmailHelperTextBox` in the middle of a form). Please specify props when passing in. */
74
+ component?: any;
75
+ /** The data attribute describing the character limit of the field */
76
+ 'data-character-limit'?: number;
77
+ /** The test ID of the field, for Jest */
78
+ 'data-testid'?: string;
79
+ /** Whether the field is disabled */
80
+ disabled?: boolean;
81
+ /** What element to render the field as, defaulting to `input` */
82
+ element?: string;
83
+ /** The functions being passed to the field */
84
+ functions?: {
85
+ /** The function to call when the field changes */
86
+ onChange: (arg1: FormValues, arg2?: ({ type, payload, }: {
87
+ type: string;
88
+ payload?: {
89
+ [key: string]: string | boolean;
90
+ };
91
+ }) => void) => void;
92
+ /** The function to call when the field is blurred */
93
+ onBlur?: () => void;
94
+ /** The function to call when the field is focused */
95
+ onFocus?: () => void;
96
+ };
97
+ /** The Google Tag Manager data to be passed to the field */
98
+ gtm?: {
99
+ /** The context of the event for GTM */
100
+ context?: string;
101
+ /** The event description for GTM */
102
+ event?: string;
103
+ };
104
+ /** The ID of the field */
105
+ id?: string;
106
+ /** The initial value of the field, for dropdown fields */
107
+ initialValue?: FormValues;
108
+ /** An optional `ref` for the field, in case we need to interact with it in another file */
109
+ inputRef?: React.RefObject<HTMLInputElement>;
110
+ /** The internationalisation path for the field */
111
+ intlPath?: string | false;
112
+ /** The label for the field */
113
+ label?: string | React.ReactNode;
114
+ /** An optional character limit, for textareas */
115
+ limit?: number;
116
+ /** Whether the field can have multiple values, for checkboxes */
117
+ multiSelect?: boolean;
118
+ /** The name of the field */
119
+ name?: string;
120
+ /** The options for the field, for checkboxes and dropdowns */
121
+ options?: IFieldOption[];
122
+ /** The placeholder text for the field */
123
+ placeholder?: string;
124
+ /** Additional props to be passed to the field */
125
+ props?: {
126
+ [key: string]: string | boolean | (() => void) | React.RefObject<any>;
127
+ };
128
+ /** Whether the field is required */
129
+ required?: boolean;
130
+ /** The selected value for checkboxes */
131
+ shownValue?: InputValues;
132
+ /** The type of the input */
133
+ type?: InputTypes | 'checkboxes';
134
+ /** The validation for the field */
135
+ validation?: IFieldValidation[];
136
+ /** The value of the field */
137
+ value?: FormValues;
138
+ }
139
+ export interface FormButtonPropsType extends ButtonPropsType {
140
+ /** A custom component to render when the form is submitting */
141
+ customOnSubmit?: React.ReactNode | false;
142
+ /** The text to show on the button */
143
+ text?: string;
144
+ }
145
+ export interface IFormProps {
146
+ /** The button to render at the bottom of the form */
147
+ button?: FormButtonPropsType;
148
+ /** The classes to add to the form */
149
+ className?: string;
150
+ /** The fields to render in the form */
151
+ fields: IField[];
152
+ /** An optional `ref` for the form, in case we need to interact with it in another file */
153
+ formRef?: React.RefObject<HTMLFormElement>;
154
+ /** The functions being passed to the form */
155
+ functions: {
156
+ /** The function to call when onSuccess fails */
157
+ onCatch?: (error?: unknown) => void;
158
+ /** The function to call when the form submission fails */
159
+ onFailure?: (arg: IFormValues) => void;
160
+ /** The function to call when the form is successfully submitted */
161
+ onSuccess?: (arg: IFormValues) => Promise<void>;
162
+ };
163
+ /** The Google Tag Manager data to be passed to the field */
164
+ gtm?: {
165
+ /** The context of the event for GTM */
166
+ context?: string;
167
+ /** The event description for GTM */
168
+ event?: string;
169
+ };
170
+ /** The id of the form */
171
+ id: string;
172
+ /** The internationalisation path for text in the form */
173
+ intlPath?: string | false;
174
+ /** Data about the form */
175
+ meta?: {
176
+ /** Whether the form should reset after submission */
177
+ shouldReset?: boolean;
178
+ /** Whether the form should show required labels */
179
+ showRequiredLabels?: boolean;
180
+ };
181
+ }
182
+ export interface IFieldWrapper extends IField {
183
+ /** The error to show */
184
+ error: string;
185
+ /** Whether the field wrapper should show required labels */
186
+ showRequiredLabels?: boolean;
187
+ /** The value of the field */
188
+ value?: FormValues;
189
+ }
@@ -0,0 +1 @@
1
+ export { default as Form } from './form';
@@ -1,3 +1,4 @@
1
1
  export * from './email-helper-text-box';
2
+ export * from './form';
2
3
  export * from './password-rules';
3
4
  export * from './rating';
@@ -12,5 +12,5 @@ interface Props {
12
12
  /** The language to use for the text */
13
13
  locale?: string;
14
14
  }
15
- declare const _default: React.MemoExoticComponent<({ matchingRules, className }: Props) => import("react/jsx-runtime").JSX.Element>;
15
+ declare const _default: React.MemoExoticComponent<({ matchingRules, className, }: Props) => import("react/jsx-runtime").JSX.Element>;
16
16
  export default _default;
@@ -27,5 +27,5 @@ interface Props {
27
27
  /** The language to use for the text */
28
28
  locale?: string;
29
29
  }
30
- declare const Rating: ({ text: textProp, topRating, functions: { createRating, updateRating, reportError }, className, hasLoaded, }: Props) => import("react/jsx-runtime").JSX.Element;
30
+ declare const Rating: ({ text: textProp, topRating, functions: { createRating, updateRating, reportError, }, className, hasLoaded, }: Props) => import("react/jsx-runtime").JSX.Element;
31
31
  export default Rating;
@@ -0,0 +1,12 @@
1
+ interface IContactFormProps {
2
+ gtm?: {
3
+ context?: string;
4
+ event?: string;
5
+ };
6
+ functions: {
7
+ onSuccess?: () => Promise<void>;
8
+ onFailure?: () => void;
9
+ };
10
+ }
11
+ declare const ContactForm: ({ gtm, functions: { onSuccess, onFailure }, }: IContactFormProps) => import("react/jsx-runtime").JSX.Element;
12
+ export default ContactForm;
@@ -0,0 +1 @@
1
+ export { default as ContactForm } from './contact-form';
@@ -1,2 +1,4 @@
1
- export * from './search-form';
1
+ export * from './contact-form';
2
2
  export * from './invite-form';
3
+ export * from './search-form';
4
+ export * from './signup-form';
@@ -0,0 +1 @@
1
+ export { default as SuccessMessage } from './success-message';
@@ -0,0 +1,4 @@
1
+ declare const SuccessMessageComponent: ({ className }: {
2
+ className?: string | undefined;
3
+ }) => import("react/jsx-runtime").JSX.Element;
4
+ export default SuccessMessageComponent;
@@ -0,0 +1 @@
1
+ export { default as SignupForm } from './signup-form';
@@ -0,0 +1,25 @@
1
+ interface ISignupForm {
2
+ className?: string;
3
+ functions: {
4
+ validateEmail: () => Promise<any>;
5
+ createAccount: (arg: any) => Promise<any>;
6
+ onSuccess?: () => void;
7
+ handleError: (error: string) => void;
8
+ /** Callback function to resend verification code (used when user already signed up but not verified) */
9
+ resendVerificationCode: () => void;
10
+ };
11
+ shouldShow: {
12
+ title?: boolean;
13
+ expectation: boolean;
14
+ url?: boolean;
15
+ logInButton: boolean;
16
+ successMessage?: boolean;
17
+ };
18
+ dataToSubmit: {
19
+ [key: string]: string;
20
+ };
21
+ submitButton: string;
22
+ showSuccessMessage?: boolean;
23
+ }
24
+ declare const SignupForm: ({ className, functions, shouldShow, submitButton, dataToSubmit, ...props }: ISignupForm) => import("react/jsx-runtime").JSX.Element;
25
+ export default SignupForm;
@@ -0,0 +1,41 @@
1
+ /// <reference types="react" />
2
+ import { IFormReducerAction } from '../../../form/components/form/form.types';
3
+ import ReCAPTCHA from 'react-google-recaptcha';
4
+ interface IBlurEmailField {
5
+ ref: React.MutableRefObject<HTMLInputElement>;
6
+ validateEmail: (email: string) => Promise<any>;
7
+ dispatch: (arg: IFormReducerAction[]) => void;
8
+ }
9
+ declare const blurEmailField: ({ ref, validateEmail, dispatch }: IBlurEmailField) => Promise<void>;
10
+ declare const transformFormData: (formData: FormData) => {
11
+ name: FormDataEntryValue;
12
+ email: string;
13
+ jobTitle: FormDataEntryValue;
14
+ organization: FormDataEntryValue;
15
+ bioLink: FormDataEntryValue;
16
+ optIn: boolean;
17
+ expectation: FormDataEntryValue;
18
+ page: string;
19
+ 'g-recaptcha-response': FormDataEntryValue;
20
+ };
21
+ interface IHandleDataProps {
22
+ refs: {
23
+ email: React.MutableRefObject<HTMLInputElement>;
24
+ form?: React.MutableRefObject<HTMLFormElement>;
25
+ hiddenValidation?: React.MutableRefObject<HTMLButtonElement>;
26
+ jobTitle: React.MutableRefObject<HTMLInputElement>;
27
+ name: React.MutableRefObject<HTMLInputElement>;
28
+ organisation: React.MutableRefObject<HTMLInputElement>;
29
+ recaptcha: React.MutableRefObject<ReCAPTCHA>;
30
+ tc: React.MutableRefObject<HTMLInputElement>;
31
+ };
32
+ dataToSubmit: {
33
+ [key: string]: string;
34
+ };
35
+ createAccount: (arg: any) => Promise<any>;
36
+ onSuccess?: (arg: any) => void;
37
+ dispatch: (arg: any) => void;
38
+ state: any;
39
+ }
40
+ declare const handleData: ({ refs, dataToSubmit, createAccount, onSuccess, dispatch, state, }: IHandleDataProps) => Promise<void>;
41
+ export { blurEmailField, transformFormData, handleData };
@@ -0,0 +1,56 @@
1
+ import React from 'react';
2
+ import ReCAPTCHA from 'react-google-recaptcha';
3
+ import { IField } from '../../../form/components/form/form.types';
4
+ interface Props {
5
+ shouldShow: {
6
+ title?: boolean;
7
+ expectation: boolean;
8
+ url?: boolean;
9
+ logInButton: boolean;
10
+ successMessage?: boolean;
11
+ };
12
+ functions: {
13
+ validateEmail: (arg: any) => Promise<any>;
14
+ createAccount: (arg: any) => Promise<any>;
15
+ onSuccess?: (arg: any) => void;
16
+ handleError: (arg: any) => void;
17
+ resendVerificationCode: (arg?: any) => void;
18
+ };
19
+ refs: {
20
+ name: React.MutableRefObject<HTMLInputElement>;
21
+ email: React.MutableRefObject<HTMLInputElement>;
22
+ jobTitle: React.MutableRefObject<HTMLInputElement>;
23
+ organisation: React.MutableRefObject<HTMLInputElement>;
24
+ recaptcha: React.MutableRefObject<ReCAPTCHA>;
25
+ tc: React.MutableRefObject<HTMLInputElement>;
26
+ form?: React.MutableRefObject<HTMLFormElement>;
27
+ };
28
+ state: {
29
+ validFields: {
30
+ name: boolean;
31
+ email: boolean;
32
+ jobTitle: boolean;
33
+ organisation: boolean;
34
+ };
35
+ emailDetails: {
36
+ email: string;
37
+ isEnd2End: boolean;
38
+ boxType: string;
39
+ };
40
+ shouldManuallyApprove: boolean;
41
+ loadRecaptcha: boolean;
42
+ };
43
+ dispatch: React.Dispatch<any>;
44
+ dataToSubmit: {
45
+ [key: string]: string;
46
+ };
47
+ intl: {
48
+ formatMessage: (arg: {
49
+ [key: string]: string;
50
+ }, arg2?: {
51
+ [key: string]: (arg: string) => React.ReactNode;
52
+ }) => string;
53
+ };
54
+ }
55
+ declare const _default: ({ shouldShow, functions: { validateEmail, createAccount, onSuccess, handleError, resendVerificationCode, }, refs, state, dispatch, dataToSubmit, intl, }: Props) => IField[];
56
+ export default _default;