@apolitical/component-library 2.0.6 → 2.1.0-4125.4
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.
- package/form/components/form/form.d.ts +1 -1
- package/form/components/form/form.types.d.ts +16 -4
- package/form/types/contact-form/contact-form.d.ts +1 -1
- package/helpers/index.d.ts +1 -0
- package/helpers/inline-styling.d.ts +2 -0
- package/helpers/validation.d.ts +8 -0
- package/index.d.ts +1 -0
- package/index.js +17 -17
- package/index.mjs +2001 -1896
- package/layout/content-layout/contact-footer/contact-footer.d.ts +1 -1
- package/layout/page-layout/page-layout.d.ts +1 -1
- package/package.json +1 -1
- package/sections/edit-section/edit-section.d.ts +33 -0
- package/sections/edit-section/index.d.ts +1 -0
- package/sections/index.d.ts +1 -0
- package/style.css +1 -1
- package/styles/variables/colors/theme/_layout.scss +1 -0
- package/styles/variables/colors/theme/_text.scss +2 -0
- package/text/pill/pill.d.ts +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
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;
|
|
2
|
+
declare const Form: ({ fields, className, id: formId, formRef: ref, intlPath, button, secondaryActionButton, meta: { shouldShowCancelButton, shouldReset, showRequiredLabels, showSuccessMessage }, gtm, functions: { onSuccess, onCancel, onCatch, onFailure }, ...props }: IFormProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
3
3
|
export default Form;
|
|
@@ -39,7 +39,7 @@ export interface IFormPayload {
|
|
|
39
39
|
/** Function to call when everything succeeds */
|
|
40
40
|
onSuccess?: (arg: IFormValues) => void;
|
|
41
41
|
/** Function to call when something fails */
|
|
42
|
-
onFailure?: (arg: IFormValues) => void;
|
|
42
|
+
onFailure?: (arg: IFormValues, arg2?: FormValues) => void;
|
|
43
43
|
}
|
|
44
44
|
export interface IFormReducerAction extends IReducerAction<IFormPayload> {
|
|
45
45
|
}
|
|
@@ -136,6 +136,10 @@ export interface IField {
|
|
|
136
136
|
/** The value of the field */
|
|
137
137
|
value?: FormValues;
|
|
138
138
|
}
|
|
139
|
+
export interface FormCancelButtonPropsType extends ButtonPropsType {
|
|
140
|
+
/** The text to show on the button */
|
|
141
|
+
text?: string;
|
|
142
|
+
}
|
|
139
143
|
export interface FormButtonPropsType extends ButtonPropsType {
|
|
140
144
|
/** A custom component to render when the form is submitting */
|
|
141
145
|
customOnSubmit?: React.ReactNode | false;
|
|
@@ -143,8 +147,10 @@ export interface FormButtonPropsType extends ButtonPropsType {
|
|
|
143
147
|
text?: string;
|
|
144
148
|
}
|
|
145
149
|
export interface IFormProps {
|
|
146
|
-
/** The
|
|
150
|
+
/** The form submit button */
|
|
147
151
|
button?: FormButtonPropsType;
|
|
152
|
+
/** The button to cancel the form (can be used to redirects user to another url or close modal) */
|
|
153
|
+
secondaryActionButton?: FormCancelButtonPropsType;
|
|
148
154
|
/** The classes to add to the form */
|
|
149
155
|
className?: string;
|
|
150
156
|
/** The fields to render in the form */
|
|
@@ -156,9 +162,11 @@ export interface IFormProps {
|
|
|
156
162
|
/** The function to call when onSuccess fails */
|
|
157
163
|
onCatch?: (error?: unknown) => void;
|
|
158
164
|
/** The function to call when the form submission fails */
|
|
159
|
-
onFailure?: (arg: IFormValues) => void;
|
|
165
|
+
onFailure?: (arg: IFormValues, arg2?: FormValues) => void;
|
|
160
166
|
/** The function to call when the form is successfully submitted */
|
|
161
|
-
onSuccess?: (arg: IFormValues) => void
|
|
167
|
+
onSuccess?: (arg: IFormValues) => Promise<void>;
|
|
168
|
+
/** The function to call when the cancel button is clicked */
|
|
169
|
+
onCancel?: () => void;
|
|
162
170
|
};
|
|
163
171
|
/** The Google Tag Manager data to be passed to the field */
|
|
164
172
|
gtm?: {
|
|
@@ -177,6 +185,10 @@ export interface IFormProps {
|
|
|
177
185
|
shouldReset?: boolean;
|
|
178
186
|
/** Whether the form should show required labels */
|
|
179
187
|
showRequiredLabels?: boolean;
|
|
188
|
+
/** Whether the form should show success message*/
|
|
189
|
+
showSuccessMessage?: boolean | string;
|
|
190
|
+
/** Whether the form should show cancel button */
|
|
191
|
+
shouldShowCancelButton?: boolean;
|
|
180
192
|
};
|
|
181
193
|
}
|
|
182
194
|
export interface IFieldWrapper extends IField {
|
package/helpers/index.d.ts
CHANGED
package/helpers/validation.d.ts
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
1
|
export declare const valueIsNotEmpty: (value: string) => boolean;
|
|
2
|
+
export declare const passwordValidator: (password: string) => {
|
|
3
|
+
isValid: boolean;
|
|
4
|
+
matchingRules: {
|
|
5
|
+
isMoreThanEightCharacters: boolean;
|
|
6
|
+
includesNumberAndSymbol: boolean;
|
|
7
|
+
includesLowerAndUppercase: boolean;
|
|
8
|
+
};
|
|
9
|
+
};
|
package/index.d.ts
CHANGED