@jobber/components 6.5.3 → 6.5.4-MIKEpull--7b61b13.30
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/dist/Autocomplete/index.cjs +1 -1
- package/dist/Autocomplete/index.mjs +1 -1
- package/dist/DataList/components/DataListSearch/index.cjs +2 -2
- package/dist/DataList/components/DataListSearch/index.mjs +2 -2
- package/dist/DataTable/index.cjs +1 -1
- package/dist/DataTable/index.mjs +1 -1
- package/dist/FormField/FormFieldAffix.d.ts +2 -2
- package/dist/FormField/FormFieldDescription.d.ts +3 -2
- package/dist/FormField/FormFieldPostFix.d.ts +2 -1
- package/dist/FormField/FormFieldTypes.d.ts +5 -0
- package/dist/FormField/FormFieldWrapper.d.ts +28 -3
- package/dist/FormField/components/ClearAction.d.ts +3 -1
- package/dist/FormField/hooks/useAtlantisFormField.d.ts +91 -0
- package/dist/FormField/hooks/useAtlantisFormFieldActions.d.ts +22 -0
- package/dist/FormField/hooks/useAtlantisFormFieldName.d.ts +6 -0
- package/dist/FormField/hooks/useAtlantisReactHookForm.d.ts +19 -0
- package/dist/FormField/hooks/useFormFieldWrapperStyles.d.ts +29 -0
- package/dist/FormField/index.cjs +9 -3
- package/dist/FormField/index.d.ts +6 -0
- package/dist/FormField/index.mjs +4 -4
- package/dist/FormField-cjs.js +264 -121
- package/dist/FormField-es.js +260 -123
- package/dist/InputDate/index.cjs +2 -2
- package/dist/InputDate/index.mjs +2 -2
- package/dist/InputDate-cjs.js +6 -0
- package/dist/InputDate-es.js +7 -1
- package/dist/InputEmail/index.cjs +3 -3
- package/dist/InputEmail/index.mjs +3 -3
- package/dist/InputEmail-cjs.js +6 -0
- package/dist/InputEmail-es.js +7 -1
- package/dist/InputNumber/index.cjs +3 -3
- package/dist/InputNumber/index.mjs +3 -3
- package/dist/InputNumber-cjs.js +6 -0
- package/dist/InputNumber-es.js +7 -1
- package/dist/InputPassword/index.cjs +3 -3
- package/dist/InputPassword/index.mjs +3 -3
- package/dist/InputPassword-cjs.js +6 -0
- package/dist/InputPassword-es.js +7 -1
- package/dist/InputPhoneNumber/index.cjs +1 -1
- package/dist/InputPhoneNumber/index.mjs +1 -1
- package/dist/InputPhoneNumber-cjs.js +4 -0
- package/dist/InputPhoneNumber-es.js +5 -1
- package/dist/InputText/InputText.d.ts +2 -0
- package/dist/InputText/index.cjs +3 -3
- package/dist/InputText/index.mjs +3 -3
- package/dist/InputText-cjs.js +6 -0
- package/dist/InputText-es.js +7 -1
- package/dist/InputTime/index.cjs +2 -2
- package/dist/InputTime/index.mjs +2 -2
- package/dist/InputTime-cjs.js +5 -0
- package/dist/InputTime-es.js +6 -1
- package/dist/InputValidation/InputValidation.d.ts +2 -1
- package/dist/InputValidation-cjs.js +3 -1
- package/dist/InputValidation-es.js +3 -1
- package/dist/Option-cjs.js +6 -0
- package/dist/Option-es.js +7 -1
- package/dist/RecurringSelect/index.cjs +2 -2
- package/dist/RecurringSelect/index.mjs +2 -2
- package/dist/Select/index.cjs +3 -3
- package/dist/Select/index.mjs +3 -3
- package/dist/index.cjs +6 -0
- package/dist/index.mjs +1 -1
- package/dist/utils/meta/meta.json +1 -0
- package/package.json +2 -2
|
@@ -16,13 +16,13 @@ require('@jobber/design');
|
|
|
16
16
|
require('../Heading-cjs.js');
|
|
17
17
|
require('../InputText-cjs.js');
|
|
18
18
|
require('../FormField-cjs.js');
|
|
19
|
-
require('react-hook-form');
|
|
20
19
|
require('framer-motion');
|
|
21
20
|
require('../Button-cjs.js');
|
|
22
21
|
require('react-router-dom');
|
|
23
22
|
require('../useFormFieldFocus-cjs.js');
|
|
24
23
|
require('../InputValidation-cjs.js');
|
|
25
24
|
require('../Spinner-cjs.js');
|
|
25
|
+
require('react-hook-form');
|
|
26
26
|
require('../debounce-cjs.js');
|
|
27
27
|
require('../_commonjsHelpers-cjs.js');
|
|
28
28
|
require('../isObjectLike-cjs.js');
|
|
@@ -14,13 +14,13 @@ import '@jobber/design';
|
|
|
14
14
|
import '../Heading-es.js';
|
|
15
15
|
import '../InputText-es.js';
|
|
16
16
|
import '../FormField-es.js';
|
|
17
|
-
import 'react-hook-form';
|
|
18
17
|
import 'framer-motion';
|
|
19
18
|
import '../Button-es.js';
|
|
20
19
|
import 'react-router-dom';
|
|
21
20
|
import '../useFormFieldFocus-es.js';
|
|
22
21
|
import '../InputValidation-es.js';
|
|
23
22
|
import '../Spinner-es.js';
|
|
23
|
+
import 'react-hook-form';
|
|
24
24
|
import '../debounce-es.js';
|
|
25
25
|
import '../_commonjsHelpers-es.js';
|
|
26
26
|
import '../isObjectLike-es.js';
|
|
@@ -11,8 +11,6 @@ require('@jobber/design');
|
|
|
11
11
|
require('../../../InputText-cjs.js');
|
|
12
12
|
require('../../../useSafeLayoutEffect-cjs.js');
|
|
13
13
|
require('../../../FormField-cjs.js');
|
|
14
|
-
require('../../../tslib.es6-cjs.js');
|
|
15
|
-
require('react-hook-form');
|
|
16
14
|
require('framer-motion');
|
|
17
15
|
require('../../../Button-cjs.js');
|
|
18
16
|
require('react-router-dom');
|
|
@@ -22,6 +20,8 @@ require('../../../Text-cjs.js');
|
|
|
22
20
|
require('../../../useFormFieldFocus-cjs.js');
|
|
23
21
|
require('../../../InputValidation-cjs.js');
|
|
24
22
|
require('../../../Spinner-cjs.js');
|
|
23
|
+
require('../../../tslib.es6-cjs.js');
|
|
24
|
+
require('react-hook-form');
|
|
25
25
|
require('../../../DataListContext-cjs.js');
|
|
26
26
|
require('../../../noop-cjs.js');
|
|
27
27
|
require('../../../DataList.const-cjs.js');
|
|
@@ -9,8 +9,6 @@ import '@jobber/design';
|
|
|
9
9
|
import '../../../InputText-es.js';
|
|
10
10
|
import '../../../useSafeLayoutEffect-es.js';
|
|
11
11
|
import '../../../FormField-es.js';
|
|
12
|
-
import '../../../tslib.es6-es.js';
|
|
13
|
-
import 'react-hook-form';
|
|
14
12
|
import 'framer-motion';
|
|
15
13
|
import '../../../Button-es.js';
|
|
16
14
|
import 'react-router-dom';
|
|
@@ -20,6 +18,8 @@ import '../../../Text-es.js';
|
|
|
20
18
|
import '../../../useFormFieldFocus-es.js';
|
|
21
19
|
import '../../../InputValidation-es.js';
|
|
22
20
|
import '../../../Spinner-es.js';
|
|
21
|
+
import '../../../tslib.es6-es.js';
|
|
22
|
+
import 'react-hook-form';
|
|
23
23
|
import '../../../DataListContext-es.js';
|
|
24
24
|
import '../../../noop-es.js';
|
|
25
25
|
import '../../../DataList.const-es.js';
|
package/dist/DataTable/index.cjs
CHANGED
|
@@ -16,7 +16,6 @@ require('../tslib.es6-cjs.js');
|
|
|
16
16
|
require('../Content-cjs.js');
|
|
17
17
|
require('../Option-cjs.js');
|
|
18
18
|
require('../FormField-cjs.js');
|
|
19
|
-
require('react-hook-form');
|
|
20
19
|
require('framer-motion');
|
|
21
20
|
require('@jobber/design');
|
|
22
21
|
require('../Button-cjs.js');
|
|
@@ -27,6 +26,7 @@ require('../Text-cjs.js');
|
|
|
27
26
|
require('../useFormFieldFocus-cjs.js');
|
|
28
27
|
require('../InputValidation-cjs.js');
|
|
29
28
|
require('../Spinner-cjs.js');
|
|
29
|
+
require('react-hook-form');
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
package/dist/DataTable/index.mjs
CHANGED
|
@@ -14,7 +14,6 @@ import '../tslib.es6-es.js';
|
|
|
14
14
|
import '../Content-es.js';
|
|
15
15
|
import '../Option-es.js';
|
|
16
16
|
import '../FormField-es.js';
|
|
17
|
-
import 'react-hook-form';
|
|
18
17
|
import 'framer-motion';
|
|
19
18
|
import '@jobber/design';
|
|
20
19
|
import '../Button-es.js';
|
|
@@ -25,3 +24,4 @@ import '../Text-es.js';
|
|
|
25
24
|
import '../useFormFieldFocus-es.js';
|
|
26
25
|
import '../InputValidation-es.js';
|
|
27
26
|
import '../Spinner-es.js';
|
|
27
|
+
import 'react-hook-form';
|
|
@@ -5,9 +5,9 @@ interface AffixLabelProps extends Affix {
|
|
|
5
5
|
readonly labelRef: RefObject<HTMLDivElement>;
|
|
6
6
|
readonly variation?: "prefix" | "suffix";
|
|
7
7
|
}
|
|
8
|
-
export declare function AffixLabel({ label, variation, labelRef, }: AffixLabelProps): JSX.Element;
|
|
8
|
+
export declare function AffixLabel({ label, variation, labelRef, }: AffixLabelProps): JSX.Element | null;
|
|
9
9
|
interface AffixIconProps extends Pick<FormFieldProps, "size"> {
|
|
10
10
|
readonly variation?: "prefix" | "suffix";
|
|
11
11
|
}
|
|
12
|
-
export declare function AffixIcon({ icon, onClick, ariaLabel, variation, size, }: AffixIconProps & XOR<Affix, Suffix>): JSX.Element;
|
|
12
|
+
export declare function AffixIcon({ icon, onClick, ariaLabel, variation, size, }: AffixIconProps & XOR<Affix, Suffix>): JSX.Element | null;
|
|
13
13
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
interface FormFieldDescriptionProps {
|
|
2
2
|
readonly id: string;
|
|
3
|
-
readonly description
|
|
3
|
+
readonly description?: string;
|
|
4
|
+
readonly visible?: boolean;
|
|
4
5
|
}
|
|
5
|
-
export declare function FormFieldDescription({ id, description, }: FormFieldDescriptionProps): JSX.Element;
|
|
6
|
+
export declare function FormFieldDescription({ id, description, visible, }: FormFieldDescriptionProps): JSX.Element | null;
|
|
6
7
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
interface FormFieldPostFixProps {
|
|
2
2
|
readonly variation: "select" | "spinner";
|
|
3
|
+
readonly visible?: boolean;
|
|
3
4
|
}
|
|
4
|
-
export declare function FormFieldPostFix({ variation }: FormFieldPostFixProps): JSX.Element;
|
|
5
|
+
export declare function FormFieldPostFix({ variation, visible, }: FormFieldPostFixProps): JSX.Element | null;
|
|
5
6
|
export {};
|
|
@@ -4,6 +4,7 @@ import { XOR } from "ts-xor";
|
|
|
4
4
|
import { Clearable } from "@jobber/hooks/src/useShowClear";
|
|
5
5
|
import { IconNames } from "../Icon";
|
|
6
6
|
export type FormFieldTypes = "text" | "password" | "number" | "time" | "textarea" | "select" | "tel" | "email";
|
|
7
|
+
export type KeyBoardTypes = "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal";
|
|
7
8
|
export type AutocompleteTypes = "one-time-code" | "address-line1" | "address-line2";
|
|
8
9
|
export interface FieldActionsRef {
|
|
9
10
|
setValue(value: string | number): void;
|
|
@@ -83,6 +84,10 @@ export interface CommonFormFieldProps {
|
|
|
83
84
|
* set it to `always`.
|
|
84
85
|
*/
|
|
85
86
|
readonly clearable?: Clearable;
|
|
87
|
+
/**
|
|
88
|
+
* Which version of the Field to use
|
|
89
|
+
*/
|
|
90
|
+
version?: 1;
|
|
86
91
|
}
|
|
87
92
|
export interface FormFieldProps extends CommonFormFieldProps {
|
|
88
93
|
actionsRef?: RefObject<FieldActionsRef>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PropsWithChildren } from "react";
|
|
1
|
+
import React, { PropsWithChildren, ReactNode } from "react";
|
|
2
2
|
import { Clearable } from "@jobber/hooks/useShowClear";
|
|
3
3
|
import { FormFieldProps } from "./FormFieldTypes";
|
|
4
|
-
interface FormFieldWrapperProps extends FormFieldProps {
|
|
4
|
+
export interface FormFieldWrapperProps extends FormFieldProps {
|
|
5
5
|
readonly error: string;
|
|
6
6
|
readonly identifier: string;
|
|
7
7
|
readonly descriptionIdentifier: string;
|
|
@@ -9,4 +9,29 @@ interface FormFieldWrapperProps extends FormFieldProps {
|
|
|
9
9
|
readonly onClear: () => void;
|
|
10
10
|
}
|
|
11
11
|
export declare function FormFieldWrapper({ align, description, descriptionIdentifier, placeholder, value, children, invalid, error, size, prefix, suffix, max, maxLength, type, disabled, inline, identifier, clearable, onClear, toolbar, toolbarVisibility, wrapperRef, }: PropsWithChildren<FormFieldWrapperProps>): JSX.Element;
|
|
12
|
-
export {};
|
|
12
|
+
export declare function FormFieldInputHorizontalWrapper({ children, }: PropsWithChildren): JSX.Element;
|
|
13
|
+
export declare function FormFieldInputWrapperStyles({ children, }: {
|
|
14
|
+
readonly children: React.ReactNode;
|
|
15
|
+
}): JSX.Element;
|
|
16
|
+
export declare function FormFieldWrapperMain({ children, tabIndex, }: {
|
|
17
|
+
readonly children: React.ReactNode;
|
|
18
|
+
readonly tabIndex?: number;
|
|
19
|
+
}): JSX.Element;
|
|
20
|
+
export declare function FormFieldLabel({ placeholder, identifier, style, }: {
|
|
21
|
+
readonly placeholder?: string;
|
|
22
|
+
readonly identifier?: string;
|
|
23
|
+
readonly style?: React.CSSProperties;
|
|
24
|
+
}): JSX.Element | null;
|
|
25
|
+
export declare function FormFieldWrapperToolbar({ toolbar, isToolbarVisible, toolbarAnimationEnd, toolbarAnimationStart, toolbarVisibility, }: {
|
|
26
|
+
readonly toolbarVisibility: string;
|
|
27
|
+
readonly isToolbarVisible: boolean;
|
|
28
|
+
readonly toolbarAnimationEnd: {
|
|
29
|
+
opacity: number;
|
|
30
|
+
height: number;
|
|
31
|
+
};
|
|
32
|
+
readonly toolbarAnimationStart: {
|
|
33
|
+
opacity: number;
|
|
34
|
+
height: string | number;
|
|
35
|
+
};
|
|
36
|
+
readonly toolbar: ReactNode;
|
|
37
|
+
}): JSX.Element;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
interface ClearActionProps {
|
|
2
3
|
/**
|
|
3
4
|
* Click handler
|
|
4
5
|
*/
|
|
5
6
|
readonly onClick: () => void;
|
|
7
|
+
readonly visible?: boolean;
|
|
6
8
|
}
|
|
7
|
-
export declare function ClearAction({ onClick }: ClearActionProps):
|
|
9
|
+
export declare function ClearAction({ onClick, visible, }: ClearActionProps): React.ReactElement | null;
|
|
8
10
|
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { ChangeEvent, FocusEvent, KeyboardEvent } from "react";
|
|
2
|
+
import { UseControllerReturn } from "react-hook-form";
|
|
3
|
+
import type { FormFieldProps, KeyBoardTypes } from "../FormFieldTypes";
|
|
4
|
+
export interface useAtlantisFormFieldProps extends Pick<FormFieldProps, "description" | "disabled" | "readonly" | "inline" | "autofocus"> {
|
|
5
|
+
/**
|
|
6
|
+
* The html id for the field
|
|
7
|
+
*/
|
|
8
|
+
readonly id: string;
|
|
9
|
+
/**
|
|
10
|
+
* The name for the html input field if one if provided by consumers of the component
|
|
11
|
+
*/
|
|
12
|
+
readonly nameProp?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The auto-generated name for the html input field if a nameProp is not provided
|
|
15
|
+
*/
|
|
16
|
+
readonly name: string;
|
|
17
|
+
/**
|
|
18
|
+
* The ref used to access the FieldActions of the field
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* The field returned from react-hook-form's useController
|
|
22
|
+
*/
|
|
23
|
+
readonly useControllerField: Omit<UseControllerReturn["field"], "ref" | "onChange" | "onBlur">;
|
|
24
|
+
/**
|
|
25
|
+
* The keyboard type for the field. This is used to provide hints to the browser about the type of keyboard to display on mobile devices
|
|
26
|
+
*/
|
|
27
|
+
readonly keyboard?: KeyBoardTypes;
|
|
28
|
+
/**
|
|
29
|
+
* The error message for the field
|
|
30
|
+
*/
|
|
31
|
+
readonly errorMessage: string;
|
|
32
|
+
/**
|
|
33
|
+
* Determines if the field has validations
|
|
34
|
+
*/
|
|
35
|
+
readonly validations: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Callback for when the field value changes
|
|
38
|
+
*/
|
|
39
|
+
handleChange: (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Callback for when the field loses focus
|
|
42
|
+
*/
|
|
43
|
+
handleBlur: () => void;
|
|
44
|
+
/**
|
|
45
|
+
* Callback for when the field gains focus
|
|
46
|
+
*/
|
|
47
|
+
handleFocus: (event: FocusEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Callback for when keydown event is triggered on the field
|
|
50
|
+
*/
|
|
51
|
+
handleKeyDown: (event: KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
52
|
+
/**
|
|
53
|
+
* Callback that exposes the error message when the field is validated
|
|
54
|
+
*/
|
|
55
|
+
handleValidation: (message: string) => void;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Provides the props for the html fields rendered by the FormField component
|
|
59
|
+
*/
|
|
60
|
+
export declare function useAtlantisFormField({ id, nameProp, name, useControllerField: useControllerField, description, disabled, readonly, keyboard, autofocus, handleChange, handleBlur, handleFocus, inline, validations, handleKeyDown, handleValidation, errorMessage, }: useAtlantisFormFieldProps): {
|
|
61
|
+
textFieldProps: {
|
|
62
|
+
autoFocus: boolean | undefined;
|
|
63
|
+
onKeyDown: (event: KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
64
|
+
"aria-describedby"?: string | undefined;
|
|
65
|
+
id: string;
|
|
66
|
+
className: string;
|
|
67
|
+
name: string | undefined;
|
|
68
|
+
disabled: boolean | undefined;
|
|
69
|
+
readOnly: boolean | undefined;
|
|
70
|
+
inputMode: KeyBoardTypes | undefined;
|
|
71
|
+
onChange: (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void;
|
|
72
|
+
onBlur: () => void;
|
|
73
|
+
onFocus: (event: FocusEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void;
|
|
74
|
+
value: any;
|
|
75
|
+
};
|
|
76
|
+
fieldProps: {
|
|
77
|
+
"aria-describedby"?: string | undefined;
|
|
78
|
+
id: string;
|
|
79
|
+
className: string;
|
|
80
|
+
name: string | undefined;
|
|
81
|
+
disabled: boolean | undefined;
|
|
82
|
+
readOnly: boolean | undefined;
|
|
83
|
+
inputMode: KeyBoardTypes | undefined;
|
|
84
|
+
onChange: (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void;
|
|
85
|
+
onBlur: () => void;
|
|
86
|
+
onFocus: (event: FocusEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void;
|
|
87
|
+
autoFocus: boolean | undefined;
|
|
88
|
+
value: any;
|
|
89
|
+
};
|
|
90
|
+
descriptionIdentifier: string;
|
|
91
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ChangeEvent, FocusEvent, KeyboardEvent } from "react";
|
|
2
|
+
import { FieldValues, UseFormSetValue } from "react-hook-form";
|
|
3
|
+
import { FormFieldProps, FormFieldTypes } from "../FormFieldTypes";
|
|
4
|
+
export interface useAtlantisFormFieldActionsProps extends Pick<FormFieldProps, "onChange" | "inputRef" | "onEnter" | "readonly" | "onFocus" | "onBlur" | "onValidation" | "onEnter"> {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly onControllerChange: (...event: unknown[]) => void;
|
|
7
|
+
readonly onControllerBlur: () => void;
|
|
8
|
+
readonly type: FormFieldTypes;
|
|
9
|
+
readonly setValue: UseFormSetValue<FieldValues>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Combines the actions from the props of the FormField with the actions from react-hook-form. This is used to
|
|
13
|
+
* manage the form state of a field through react-hook-form while providing support for additional callbacks
|
|
14
|
+
*/
|
|
15
|
+
export declare function useAtlantisFormFieldActions({ name, onChange, inputRef, onControllerChange, onControllerBlur, onEnter, readonly, type, setValue, onFocus, onBlur, onValidation, }: useAtlantisFormFieldActionsProps): {
|
|
16
|
+
handleClear: () => void;
|
|
17
|
+
handleChange: (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void;
|
|
18
|
+
handleKeyDown: (event: KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
19
|
+
handleFocus: (event: FocusEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void;
|
|
20
|
+
handleBlur: () => void;
|
|
21
|
+
handleValidation: (message: string) => void;
|
|
22
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FormFieldProps } from "../FormFieldTypes";
|
|
2
|
+
interface useAtlantisReactFormProps extends Pick<FormFieldProps, "actionsRef" | "defaultValue" | "value" | "validations" | "inputRef"> {
|
|
3
|
+
name: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Hook used to manage the form state of a field through react-hook-form
|
|
7
|
+
*/
|
|
8
|
+
export declare function useAtlantisReactForm({ actionsRef, name, defaultValue, value, validations, inputRef, }: useAtlantisReactFormProps): {
|
|
9
|
+
inputRefs: import("react").RefCallback<any>;
|
|
10
|
+
useControllerField: {
|
|
11
|
+
value: any;
|
|
12
|
+
name: string;
|
|
13
|
+
};
|
|
14
|
+
setValue: import("react-hook-form").UseFormSetValue<import("react-hook-form").FieldValues>;
|
|
15
|
+
errorMessage: string;
|
|
16
|
+
onControllerChange: (...event: any[]) => void;
|
|
17
|
+
onControllerBlur: import("react-hook-form").Noop;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
import { FormFieldProps } from "../FormFieldTypes";
|
|
3
|
+
export interface useFormFieldWrapperStylesProps extends Pick<FormFieldProps, "size" | "align" | "placeholder" | "value" | "invalid" | "max" | "maxLength" | "type" | "disabled" | "inline"> {
|
|
4
|
+
readonly error: string;
|
|
5
|
+
suffixRef: RefObject<HTMLDivElement>;
|
|
6
|
+
prefixRef: RefObject<HTMLDivElement>;
|
|
7
|
+
}
|
|
8
|
+
export interface LabelPadding {
|
|
9
|
+
paddingLeft: number | string | undefined;
|
|
10
|
+
paddingRight: number | string | undefined;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Hook for getting the correct styles for the FormField and its children
|
|
14
|
+
*/
|
|
15
|
+
export declare function useFormFieldWrapperStyles({ size, align, placeholder, value, invalid, error, max, prefixRef, suffixRef, maxLength, type, disabled, inline, }: useFormFieldWrapperStylesProps): {
|
|
16
|
+
inputStyle: string;
|
|
17
|
+
wrapperClasses: string;
|
|
18
|
+
containerClasses: string;
|
|
19
|
+
wrapperInlineStyle: {
|
|
20
|
+
[x: string]: number | undefined;
|
|
21
|
+
};
|
|
22
|
+
labelStyle: LabelPadding;
|
|
23
|
+
setLabelStyle: import("react").Dispatch<import("react").SetStateAction<LabelPadding>>;
|
|
24
|
+
};
|
|
25
|
+
export interface GetAffixProps extends FormFieldProps {
|
|
26
|
+
prefixWidth: number;
|
|
27
|
+
suffixWidth: number;
|
|
28
|
+
}
|
|
29
|
+
export declare function getAffixPaddding({ value, type, prefixWidth, suffixWidth, }: GetAffixProps): LabelPadding;
|
package/dist/FormField/index.cjs
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var FormField = require('../FormField-cjs.js');
|
|
4
|
-
require('../tslib.es6-cjs.js');
|
|
5
4
|
require('react');
|
|
6
|
-
require('react-hook-form');
|
|
7
|
-
require('classnames');
|
|
8
5
|
require('framer-motion');
|
|
9
6
|
require('@jobber/design');
|
|
7
|
+
require('classnames');
|
|
10
8
|
require('../Button-cjs.js');
|
|
11
9
|
require('react-router-dom');
|
|
12
10
|
require('../Icon-cjs.js');
|
|
@@ -15,7 +13,15 @@ require('../Text-cjs.js');
|
|
|
15
13
|
require('../useFormFieldFocus-cjs.js');
|
|
16
14
|
require('../InputValidation-cjs.js');
|
|
17
15
|
require('../Spinner-cjs.js');
|
|
16
|
+
require('../tslib.es6-cjs.js');
|
|
17
|
+
require('react-hook-form');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
exports.FormField = FormField.FormField;
|
|
22
|
+
exports.FormFieldWrapper = FormField.FormFieldWrapper;
|
|
23
|
+
exports.useAtlantisFormField = FormField.useAtlantisFormField;
|
|
24
|
+
exports.useAtlantisFormFieldActions = FormField.useAtlantisFormFieldActions;
|
|
25
|
+
exports.useAtlantisFormFieldName = FormField.useAtlantisFormFieldName;
|
|
26
|
+
exports.useAtlantisReactForm = FormField.useAtlantisReactForm;
|
|
27
|
+
exports.useFormFieldWrapperStyles = FormField.useFormFieldWrapperStyles;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
export * from "./FormField";
|
|
2
2
|
export * from "./FormFieldTypes";
|
|
3
|
+
export { useAtlantisFormField } from "./hooks/useAtlantisFormField";
|
|
4
|
+
export { useAtlantisFormFieldActions } from "./hooks/useAtlantisFormFieldActions";
|
|
5
|
+
export { useAtlantisFormFieldName } from "./hooks/useAtlantisFormFieldName";
|
|
6
|
+
export { useAtlantisReactForm } from "./hooks/useAtlantisReactHookForm";
|
|
7
|
+
export { FormFieldWrapper } from "./FormFieldWrapper";
|
|
8
|
+
export { useFormFieldWrapperStyles, useFormFieldWrapperStylesProps, } from "./hooks/useFormFieldWrapperStyles";
|
package/dist/FormField/index.mjs
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import '../tslib.es6-es.js';
|
|
1
|
+
export { e as FormField, F as FormFieldWrapper, u as useAtlantisFormField, a as useAtlantisFormFieldActions, b as useAtlantisFormFieldName, c as useAtlantisReactForm, d as useFormFieldWrapperStyles } from '../FormField-es.js';
|
|
3
2
|
import 'react';
|
|
4
|
-
import 'react-hook-form';
|
|
5
|
-
import 'classnames';
|
|
6
3
|
import 'framer-motion';
|
|
7
4
|
import '@jobber/design';
|
|
5
|
+
import 'classnames';
|
|
8
6
|
import '../Button-es.js';
|
|
9
7
|
import 'react-router-dom';
|
|
10
8
|
import '../Icon-es.js';
|
|
@@ -13,3 +11,5 @@ import '../Text-es.js';
|
|
|
13
11
|
import '../useFormFieldFocus-es.js';
|
|
14
12
|
import '../InputValidation-es.js';
|
|
15
13
|
import '../Spinner-es.js';
|
|
14
|
+
import '../tslib.es6-es.js';
|
|
15
|
+
import 'react-hook-form';
|