@jobber/components 6.103.2-JOB-140609-9051081.26 → 6.103.2
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/Autocomplete.types.d.ts +1 -12
- package/dist/Autocomplete/index.cjs +13 -1
- package/dist/Autocomplete/index.mjs +13 -1
- package/dist/Checkbox/Checkbox.types.d.ts +9 -2
- package/dist/Checkbox/index.cjs +2 -3
- package/dist/Checkbox/index.mjs +2 -3
- package/dist/Chips/InternalChipDismissible/hooks/index.cjs +2 -2
- package/dist/Chips/InternalChipDismissible/hooks/index.mjs +2 -2
- package/dist/Chips/InternalChipDismissible/index.cjs +2 -2
- package/dist/Chips/InternalChipDismissible/index.mjs +2 -2
- package/dist/Chips/index.cjs +2 -2
- package/dist/Chips/index.mjs +2 -2
- package/dist/DataList/components/DataListSearch/index.cjs +12 -1
- package/dist/DataList/components/DataListSearch/index.mjs +12 -1
- package/dist/DataList/index.cjs +8 -0
- package/dist/DataList/index.mjs +8 -0
- package/dist/DataTable/index.cjs +2 -2
- package/dist/DataTable/index.mjs +2 -2
- package/dist/DatePicker/index.cjs +2 -2
- package/dist/DatePicker/index.mjs +2 -2
- package/dist/FormField/FormFieldTypes.d.ts +1 -217
- package/dist/FormField-cjs.js +6 -1
- package/dist/FormField-es.js +6 -2
- package/dist/InputDate/index.cjs +4 -8
- package/dist/InputDate/index.mjs +4 -8
- package/dist/InputDate/useInputDateActivatorActions.d.ts +2 -2
- package/dist/InputEmail/InputEmail.types.d.ts +21 -16
- package/dist/InputEmail/hooks/useInputEmailActions.d.ts +1 -1
- package/dist/InputEmail/hooks/useInputEmailFormField.d.ts +32 -0
- package/dist/InputEmail/index.cjs +45 -10
- package/dist/InputEmail/index.mjs +45 -10
- package/dist/InputNumber/InputNumber.rebuilt.types.d.ts +2 -23
- package/dist/InputNumber/index.cjs +3 -6
- package/dist/InputNumber/index.mjs +3 -6
- package/dist/InputPhoneNumber/InputPhoneNumber.types.d.ts +26 -15
- package/dist/InputPhoneNumber/hooks/useInputPhoneActions.d.ts +1 -1
- package/dist/InputPhoneNumber/hooks/useInputPhoneFormField.d.ts +71 -0
- package/dist/InputPhoneNumber/index.cjs +35 -20
- package/dist/InputPhoneNumber/index.mjs +35 -20
- package/dist/InputText/InputText.d.ts +2 -2
- package/dist/InputText/InputText.types.d.ts +24 -27
- package/dist/InputText/index.cjs +55 -26
- package/dist/InputText/index.mjs +56 -27
- package/dist/InputText/useInputTextActions.d.ts +1 -1
- package/dist/InputText/useInputTextFormField.d.ts +352 -0
- package/dist/InputTime/InputTime.rebuilt.d.ts +1 -1
- package/dist/InputTime/InputTime.types.d.ts +1 -21
- package/dist/InputTime/index.cjs +25 -30
- package/dist/InputTime/index.d.ts +1 -1
- package/dist/InputTime/index.mjs +27 -32
- package/dist/List/index.cjs +2 -2
- package/dist/List/index.mjs +2 -2
- package/dist/RecurringSelect/index.cjs +2 -2
- package/dist/RecurringSelect/index.mjs +2 -2
- package/dist/Select/Select.rebuilt.d.ts +1 -1
- package/dist/Select/Select.types.d.ts +1 -14
- package/dist/Select/hooks/useSelectActions.d.ts +5 -5
- package/dist/Select/hooks/useSelectFormField.d.ts +34 -0
- package/dist/Select/index.cjs +41 -27
- package/dist/Select/index.d.ts +5 -7
- package/dist/Select/index.mjs +43 -29
- package/dist/_baseEach-cjs.js +12 -12
- package/dist/_baseEach-es.js +1 -1
- package/dist/_baseFlatten-cjs.js +2 -2
- package/dist/_baseFlatten-es.js +1 -1
- package/dist/{_getAllKeys-cjs.js → _baseGet-cjs.js} +181 -181
- package/dist/{_getAllKeys-es.js → _baseGet-es.js} +182 -182
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/omit-cjs.js +14 -14
- package/dist/omit-es.js +1 -1
- package/dist/useScrollToActive-cjs.js +3 -3
- package/dist/useScrollToActive-es.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { ChangeEvent, FocusEvent, KeyboardEvent, ReactNode } from "react";
|
|
2
|
+
export interface useInputPhoneFormFieldProps {
|
|
3
|
+
/**
|
|
4
|
+
* The html id for the field
|
|
5
|
+
*/
|
|
6
|
+
readonly id: string;
|
|
7
|
+
/**
|
|
8
|
+
* The auto-generated name for the html input field if a nameProp is not provided
|
|
9
|
+
*/
|
|
10
|
+
readonly name: string;
|
|
11
|
+
/**
|
|
12
|
+
* The error message for the field
|
|
13
|
+
*/
|
|
14
|
+
readonly error?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Adjusts the form field to go inline with a content. This also silences the
|
|
17
|
+
* given `validations` prop. You'd have to used the `onValidate` prop to
|
|
18
|
+
* capture the message and render it somewhere else using the
|
|
19
|
+
* `InputValidation` component.
|
|
20
|
+
*/
|
|
21
|
+
readonly inline?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Further description of the input, can be used for a hint.
|
|
24
|
+
*/
|
|
25
|
+
readonly description?: ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Callback for when the field value changes
|
|
28
|
+
*/
|
|
29
|
+
handleChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Callback for when the field loses focus
|
|
32
|
+
*/
|
|
33
|
+
handleBlur: () => void;
|
|
34
|
+
/**
|
|
35
|
+
* Callback for when the field gains focus
|
|
36
|
+
*/
|
|
37
|
+
handleFocus: (event: FocusEvent<HTMLInputElement>) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Callback for when keydown event is triggered on the field
|
|
40
|
+
*/
|
|
41
|
+
handleKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
42
|
+
readonly invalid?: boolean;
|
|
43
|
+
readonly disabled?: boolean;
|
|
44
|
+
readonly autofocus?: boolean;
|
|
45
|
+
readonly value?: string;
|
|
46
|
+
readonly readonly?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface UseInputPhoneFormFieldReturn {
|
|
49
|
+
fieldProps: React.InputHTMLAttributes<HTMLInputElement>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Provides the props for the html fields rendered by the html input.
|
|
53
|
+
* DO not repeat this pattern. We are doing this as a proof of concept relating to the refactoring of Form inputs to see what can be removed.
|
|
54
|
+
*/
|
|
55
|
+
export declare function useInputPhoneFormField({ id, name, description, inline, handleChange, handleBlur, handleFocus, handleKeyDown, error, disabled, autofocus, value, readonly, ...rest }: useInputPhoneFormFieldProps): {
|
|
56
|
+
fieldProps: {
|
|
57
|
+
readOnly: boolean | undefined;
|
|
58
|
+
"aria-describedby"?: string | undefined;
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
disabled: boolean | undefined;
|
|
62
|
+
autoFocus: boolean | undefined;
|
|
63
|
+
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
64
|
+
onBlur: () => void;
|
|
65
|
+
onFocus: (event: FocusEvent<HTMLInputElement>) => void;
|
|
66
|
+
onKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
67
|
+
value: string | undefined;
|
|
68
|
+
invalid: string | undefined;
|
|
69
|
+
};
|
|
70
|
+
descriptionIdentifier: string;
|
|
71
|
+
};
|
|
@@ -115,7 +115,7 @@ const DEFAULT_PATTERN = "(***) ***-****";
|
|
|
115
115
|
function useInputPhoneActions({ onChange, inputRef, onFocus, onBlur, onKeyDown, onEnter, }) {
|
|
116
116
|
function handleClear() {
|
|
117
117
|
var _a;
|
|
118
|
-
|
|
118
|
+
handleBlur();
|
|
119
119
|
onChange && onChange("");
|
|
120
120
|
(_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
121
121
|
}
|
|
@@ -149,25 +149,28 @@ function useInputPhoneActions({ onChange, inputRef, onFocus, onBlur, onKeyDown,
|
|
|
149
149
|
};
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
/**
|
|
153
|
+
* Provides the props for the html fields rendered by the html input.
|
|
154
|
+
* DO not repeat this pattern. We are doing this as a proof of concept relating to the refactoring of Form inputs to see what can be removed.
|
|
155
|
+
*/
|
|
156
|
+
function useInputPhoneFormField(_a) {
|
|
157
|
+
var { id, name, description, inline, handleChange, handleBlur, handleFocus, handleKeyDown, error, disabled, autofocus, value, readonly } = _a, rest = tslib_es6.__rest(_a, ["id", "name", "description", "inline", "handleChange", "handleBlur", "handleFocus", "handleKeyDown", "error", "disabled", "autofocus", "value", "readonly"]);
|
|
158
|
+
const descriptionIdentifier = `descriptionUUID--${id}`;
|
|
159
|
+
const fieldProps = Object.assign(Object.assign(Object.assign(Object.assign({}, rest), { id,
|
|
160
|
+
name,
|
|
161
|
+
disabled, autoFocus: autofocus, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown, value, invalid: error || rest.invalid ? "true" : undefined }), (description &&
|
|
162
|
+
!inline && { "aria-describedby": descriptionIdentifier })), { readOnly: readonly });
|
|
163
|
+
return { fieldProps, descriptionIdentifier };
|
|
164
|
+
}
|
|
165
|
+
|
|
152
166
|
const InputPhoneNumberRebuilt = React.forwardRef(function InputPhoneNumberInternal(_a, ref) {
|
|
153
167
|
var _b, _c, _d, _e;
|
|
154
168
|
var { pattern = DEFAULT_PATTERN } = _a, props = tslib_es6.__rest(_a, ["pattern"]);
|
|
155
169
|
const inputPhoneNumberRef = (_b = ref) !== null && _b !== void 0 ? _b : React.useRef(null);
|
|
156
170
|
const wrapperRef = React.useRef(null);
|
|
157
|
-
const { inputStyle } = FormField.useFormFieldWrapperStyles({
|
|
158
|
-
size: props.size,
|
|
159
|
-
align: props.align,
|
|
160
|
-
placeholder: props.placeholder,
|
|
161
|
-
value: props.value,
|
|
162
|
-
invalid: props.invalid,
|
|
163
|
-
error: props.error,
|
|
164
|
-
maxLength: undefined, // v2: maxLength not used for width styling
|
|
165
|
-
disabled: props.disabled,
|
|
166
|
-
inline: props.inline,
|
|
167
|
-
type: "tel",
|
|
168
|
-
});
|
|
171
|
+
const { inputStyle } = FormField.useFormFieldWrapperStyles(Object.assign(Object.assign({}, props), { type: "tel" }));
|
|
169
172
|
const generatedId = React.useId();
|
|
170
|
-
const id = props.
|
|
173
|
+
const id = props.id || generatedId;
|
|
171
174
|
const { name } = FormField.useAtlantisFormFieldName({
|
|
172
175
|
nameProp: props.name,
|
|
173
176
|
id: id,
|
|
@@ -185,13 +188,25 @@ const InputPhoneNumberRebuilt = React.forwardRef(function InputPhoneNumberIntern
|
|
|
185
188
|
onEnter: props.onEnter,
|
|
186
189
|
inputRef: inputPhoneNumberRef,
|
|
187
190
|
});
|
|
188
|
-
const descriptionIdentifier =
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
const { fieldProps, descriptionIdentifier } = useInputPhoneFormField({
|
|
192
|
+
id,
|
|
193
|
+
name,
|
|
194
|
+
handleChange,
|
|
195
|
+
handleBlur,
|
|
196
|
+
handleFocus,
|
|
197
|
+
handleKeyDown,
|
|
198
|
+
autofocus: props.autoFocus,
|
|
199
|
+
disabled: props.disabled,
|
|
200
|
+
readonly: props.readonly,
|
|
201
|
+
invalid: props.invalid,
|
|
202
|
+
error: props.error,
|
|
203
|
+
description: props.description,
|
|
204
|
+
inline: props.inline,
|
|
205
|
+
});
|
|
206
|
+
return (React.createElement(FormField.FormFieldWrapper, { disabled: props.disabled, size: props.size, inline: props.inline, wrapperRef: wrapperRef, error: (_c = props.error) !== null && _c !== void 0 ? _c : "", invalid: Boolean(props.error || props.invalid), identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, clearable: (_d = props.clearable) !== null && _d !== void 0 ? _d : "never", onClear: handleClear, type: "tel", placeholder: props.placeholder, value: formattedValue, prefix: props.prefix, suffix: props.suffix, readonly: props.readonly, loading: props.loading },
|
|
207
|
+
React.createElement("input", Object.assign({ type: "tel" }, fieldProps, { ref: inputPhoneNumberRef, className: classnames(inputStyle, {
|
|
193
208
|
[styles.emptyValue]: inputValue.length === 0 && pattern[0] === "(",
|
|
194
|
-
}), value: formattedValue
|
|
209
|
+
}), value: formattedValue })),
|
|
195
210
|
React.createElement(MaskElement, { isMasking: isMasking, formattedValue: formattedValue, placeholderMask: placeholderMask }),
|
|
196
211
|
React.createElement(FormField.FormFieldPostFix, { variation: "spinner", visible: (_e = props.loading) !== null && _e !== void 0 ? _e : false })));
|
|
197
212
|
});
|
|
@@ -113,7 +113,7 @@ const DEFAULT_PATTERN = "(***) ***-****";
|
|
|
113
113
|
function useInputPhoneActions({ onChange, inputRef, onFocus, onBlur, onKeyDown, onEnter, }) {
|
|
114
114
|
function handleClear() {
|
|
115
115
|
var _a;
|
|
116
|
-
|
|
116
|
+
handleBlur();
|
|
117
117
|
onChange && onChange("");
|
|
118
118
|
(_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
119
119
|
}
|
|
@@ -147,25 +147,28 @@ function useInputPhoneActions({ onChange, inputRef, onFocus, onBlur, onKeyDown,
|
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
/**
|
|
151
|
+
* Provides the props for the html fields rendered by the html input.
|
|
152
|
+
* DO not repeat this pattern. We are doing this as a proof of concept relating to the refactoring of Form inputs to see what can be removed.
|
|
153
|
+
*/
|
|
154
|
+
function useInputPhoneFormField(_a) {
|
|
155
|
+
var { id, name, description, inline, handleChange, handleBlur, handleFocus, handleKeyDown, error, disabled, autofocus, value, readonly } = _a, rest = __rest(_a, ["id", "name", "description", "inline", "handleChange", "handleBlur", "handleFocus", "handleKeyDown", "error", "disabled", "autofocus", "value", "readonly"]);
|
|
156
|
+
const descriptionIdentifier = `descriptionUUID--${id}`;
|
|
157
|
+
const fieldProps = Object.assign(Object.assign(Object.assign(Object.assign({}, rest), { id,
|
|
158
|
+
name,
|
|
159
|
+
disabled, autoFocus: autofocus, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown, value, invalid: error || rest.invalid ? "true" : undefined }), (description &&
|
|
160
|
+
!inline && { "aria-describedby": descriptionIdentifier })), { readOnly: readonly });
|
|
161
|
+
return { fieldProps, descriptionIdentifier };
|
|
162
|
+
}
|
|
163
|
+
|
|
150
164
|
const InputPhoneNumberRebuilt = forwardRef(function InputPhoneNumberInternal(_a, ref) {
|
|
151
165
|
var _b, _c, _d, _e;
|
|
152
166
|
var { pattern = DEFAULT_PATTERN } = _a, props = __rest(_a, ["pattern"]);
|
|
153
167
|
const inputPhoneNumberRef = (_b = ref) !== null && _b !== void 0 ? _b : React__default.useRef(null);
|
|
154
168
|
const wrapperRef = React__default.useRef(null);
|
|
155
|
-
const { inputStyle } = useFormFieldWrapperStyles({
|
|
156
|
-
size: props.size,
|
|
157
|
-
align: props.align,
|
|
158
|
-
placeholder: props.placeholder,
|
|
159
|
-
value: props.value,
|
|
160
|
-
invalid: props.invalid,
|
|
161
|
-
error: props.error,
|
|
162
|
-
maxLength: undefined, // v2: maxLength not used for width styling
|
|
163
|
-
disabled: props.disabled,
|
|
164
|
-
inline: props.inline,
|
|
165
|
-
type: "tel",
|
|
166
|
-
});
|
|
169
|
+
const { inputStyle } = useFormFieldWrapperStyles(Object.assign(Object.assign({}, props), { type: "tel" }));
|
|
167
170
|
const generatedId = useId();
|
|
168
|
-
const id = props.
|
|
171
|
+
const id = props.id || generatedId;
|
|
169
172
|
const { name } = useAtlantisFormFieldName({
|
|
170
173
|
nameProp: props.name,
|
|
171
174
|
id: id,
|
|
@@ -183,13 +186,25 @@ const InputPhoneNumberRebuilt = forwardRef(function InputPhoneNumberInternal(_a,
|
|
|
183
186
|
onEnter: props.onEnter,
|
|
184
187
|
inputRef: inputPhoneNumberRef,
|
|
185
188
|
});
|
|
186
|
-
const descriptionIdentifier =
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
const { fieldProps, descriptionIdentifier } = useInputPhoneFormField({
|
|
190
|
+
id,
|
|
191
|
+
name,
|
|
192
|
+
handleChange,
|
|
193
|
+
handleBlur,
|
|
194
|
+
handleFocus,
|
|
195
|
+
handleKeyDown,
|
|
196
|
+
autofocus: props.autoFocus,
|
|
197
|
+
disabled: props.disabled,
|
|
198
|
+
readonly: props.readonly,
|
|
199
|
+
invalid: props.invalid,
|
|
200
|
+
error: props.error,
|
|
201
|
+
description: props.description,
|
|
202
|
+
inline: props.inline,
|
|
203
|
+
});
|
|
204
|
+
return (React__default.createElement(FormFieldWrapper, { disabled: props.disabled, size: props.size, inline: props.inline, wrapperRef: wrapperRef, error: (_c = props.error) !== null && _c !== void 0 ? _c : "", invalid: Boolean(props.error || props.invalid), identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, clearable: (_d = props.clearable) !== null && _d !== void 0 ? _d : "never", onClear: handleClear, type: "tel", placeholder: props.placeholder, value: formattedValue, prefix: props.prefix, suffix: props.suffix, readonly: props.readonly, loading: props.loading },
|
|
205
|
+
React__default.createElement("input", Object.assign({ type: "tel" }, fieldProps, { ref: inputPhoneNumberRef, className: classnames(inputStyle, {
|
|
191
206
|
[styles.emptyValue]: inputValue.length === 0 && pattern[0] === "(",
|
|
192
|
-
}), value: formattedValue
|
|
207
|
+
}), value: formattedValue })),
|
|
193
208
|
React__default.createElement(MaskElement, { isMasking: isMasking, formattedValue: formattedValue, placeholderMask: placeholderMask }),
|
|
194
209
|
React__default.createElement(FormFieldPostFix, { variation: "spinner", visible: (_e = props.loading) !== null && _e !== void 0 ? _e : false })));
|
|
195
210
|
});
|
|
@@ -24,11 +24,11 @@ export declare const InputText: React.ForwardRefExoticComponent<({
|
|
|
24
24
|
readonly toolbar?: React.ReactNode;
|
|
25
25
|
readonly defaultValue?: (string | Date) | undefined;
|
|
26
26
|
readonly prefix?: import("../FormField").Affix | undefined;
|
|
27
|
-
readonly maxLength?: number | undefined;
|
|
28
27
|
readonly autofocus?: boolean | undefined;
|
|
29
28
|
readonly autocomplete?: (boolean | import("../FormField").AutocompleteTypes) | undefined;
|
|
30
29
|
inputRef?: React.RefObject<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement> | undefined;
|
|
31
30
|
readonly keyboard?: ("numeric" | "decimal") | undefined;
|
|
31
|
+
readonly maxLength?: number | undefined;
|
|
32
32
|
readonly suffix?: import("ts-xor").XOR<import("../FormField").Affix, import("../FormField").Suffix> | undefined;
|
|
33
33
|
onEnter?: ((event: React.KeyboardEvent) => void) | undefined;
|
|
34
34
|
readonly readonly?: boolean | undefined;
|
|
@@ -58,11 +58,11 @@ export declare const InputText: React.ForwardRefExoticComponent<({
|
|
|
58
58
|
readonly toolbar?: React.ReactNode;
|
|
59
59
|
readonly defaultValue?: (string | Date) | undefined;
|
|
60
60
|
readonly prefix?: import("../FormField").Affix | undefined;
|
|
61
|
-
readonly maxLength?: number | undefined;
|
|
62
61
|
readonly autofocus?: boolean | undefined;
|
|
63
62
|
readonly autocomplete?: (boolean | import("../FormField").AutocompleteTypes) | undefined;
|
|
64
63
|
inputRef?: React.RefObject<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement> | undefined;
|
|
65
64
|
readonly keyboard?: ("numeric" | "decimal") | undefined;
|
|
65
|
+
readonly maxLength?: number | undefined;
|
|
66
66
|
readonly suffix?: import("ts-xor").XOR<import("../FormField").Affix, import("../FormField").Suffix> | undefined;
|
|
67
67
|
onEnter?: ((event: React.KeyboardEvent) => void) | undefined;
|
|
68
68
|
readonly readonly?: boolean | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { Clearable } from "@jobber/hooks";
|
|
1
2
|
import type { XOR } from "ts-xor";
|
|
2
|
-
import type {
|
|
3
|
+
import type { AutocompleteTypes, CommonFormFieldProps, FormFieldProps, FormFieldTypes } from "../FormField";
|
|
3
4
|
export interface RowRange {
|
|
4
5
|
min: number;
|
|
5
6
|
max: number;
|
|
@@ -9,7 +10,15 @@ export type InputTextVersion = 1 | 2 | undefined;
|
|
|
9
10
|
* Experimental version 2 of the InputText component.
|
|
10
11
|
* Do not use unless you have talked with Atlantis first.
|
|
11
12
|
*/
|
|
12
|
-
export interface InputTextRebuiltProps extends
|
|
13
|
+
export interface InputTextRebuiltProps extends Omit<React.InputHTMLAttributes<HTMLInputElement | HTMLTextAreaElement>, "onChange" | "onBlur" | "maxLength" | "rows" | "size" | "suffix" | "prefix" | "value" | "max" | "min" | "defaultValue"> {
|
|
14
|
+
readonly error?: string;
|
|
15
|
+
readonly invalid?: boolean;
|
|
16
|
+
readonly identifier?: string;
|
|
17
|
+
readonly autocomplete?: boolean | AutocompleteTypes;
|
|
18
|
+
readonly loading?: boolean;
|
|
19
|
+
readonly onKeyUp?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
20
|
+
readonly children?: React.ReactNode;
|
|
21
|
+
readonly clearable?: Clearable;
|
|
13
22
|
/**
|
|
14
23
|
* Use this when you're expecting a long answer.
|
|
15
24
|
*/
|
|
@@ -21,36 +30,24 @@ export interface InputTextRebuiltProps extends HTMLInputBaseProps, FocusEvents<H
|
|
|
21
30
|
* maximum number of visible rows.
|
|
22
31
|
*/
|
|
23
32
|
readonly rows?: number | RowRange;
|
|
24
|
-
/**
|
|
25
|
-
* Determines what kind of form field should the component give you.
|
|
26
|
-
*/
|
|
27
33
|
readonly type?: FormFieldTypes;
|
|
28
34
|
/**
|
|
29
|
-
*
|
|
30
|
-
*/
|
|
31
|
-
readonly toolbar?: React.ReactNode;
|
|
32
|
-
/**
|
|
33
|
-
* Determines the visibility of the toolbar.
|
|
34
|
-
*/
|
|
35
|
-
readonly toolbarVisibility?: "always" | "while-editing";
|
|
36
|
-
/**
|
|
37
|
-
* The current value of the input.
|
|
38
|
-
*/
|
|
39
|
-
readonly value: string;
|
|
40
|
-
/**
|
|
41
|
-
* Custom onChange handler that provides the new value as the first argument.
|
|
35
|
+
* Version 2 is highly experimental. Avoid using it unless you have talked with Atlantis first.
|
|
42
36
|
*/
|
|
37
|
+
readonly version: 2;
|
|
43
38
|
readonly onChange?: (newValue: string, event?: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
44
|
-
/**
|
|
45
|
-
* A callback to handle "Enter" keypress. This will only run
|
|
46
|
-
* if Enter is the only key. Will not run if Shift or Control
|
|
47
|
-
* are being held.
|
|
48
|
-
*/
|
|
49
39
|
readonly onEnter?: FormFieldProps["onEnter"];
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
readonly
|
|
40
|
+
readonly onBlur?: FormFieldProps["onBlur"];
|
|
41
|
+
readonly value: string;
|
|
42
|
+
readonly maxLength?: number;
|
|
43
|
+
readonly size?: FormFieldProps["size"];
|
|
44
|
+
readonly inline?: FormFieldProps["inline"];
|
|
45
|
+
readonly align?: FormFieldProps["align"];
|
|
46
|
+
readonly toolbar?: FormFieldProps["toolbar"];
|
|
47
|
+
readonly toolbarVisibility?: FormFieldProps["toolbarVisibility"];
|
|
48
|
+
readonly prefix?: FormFieldProps["prefix"];
|
|
49
|
+
readonly suffix?: FormFieldProps["suffix"];
|
|
50
|
+
readonly description?: FormFieldProps["description"];
|
|
54
51
|
}
|
|
55
52
|
interface BaseProps extends CommonFormFieldProps, Pick<FormFieldProps, "autofocus" | "maxLength" | "readonly" | "autocomplete" | "keyboard" | "onEnter" | "onFocus" | "onBlur" | "onChange" | "inputRef" | "validations" | "defaultValue" | "prefix" | "suffix" | "toolbar" | "toolbarVisibility" | "version"> {
|
|
56
53
|
multiline?: boolean;
|
package/dist/InputText/index.cjs
CHANGED
|
@@ -4,11 +4,12 @@ var React = require('react');
|
|
|
4
4
|
var jobberHooks = require('@jobber/hooks');
|
|
5
5
|
var FormField = require('../FormField-cjs.js');
|
|
6
6
|
require('classnames');
|
|
7
|
-
require('../tslib.es6-cjs.js');
|
|
7
|
+
var tslib_es6 = require('../tslib.es6-cjs.js');
|
|
8
8
|
require('react-hook-form');
|
|
9
9
|
require('framer-motion');
|
|
10
10
|
require('@jobber/design');
|
|
11
11
|
require('../Button-cjs.js');
|
|
12
|
+
var omit = require('../omit-cjs.js');
|
|
12
13
|
require('../Icon-cjs.js');
|
|
13
14
|
require('../Text-cjs.js');
|
|
14
15
|
require('../Typography-cjs.js');
|
|
@@ -16,6 +17,17 @@ require('../useFormFieldFocus-cjs.js');
|
|
|
16
17
|
require('../InputValidation-cjs.js');
|
|
17
18
|
require('../Spinner-cjs.js');
|
|
18
19
|
require('react-router-dom');
|
|
20
|
+
require('../_commonjsHelpers-cjs.js');
|
|
21
|
+
require('../_baseGet-cjs.js');
|
|
22
|
+
require('../isTypedArray-cjs.js');
|
|
23
|
+
require('../isObjectLike-cjs.js');
|
|
24
|
+
require('../identity-cjs.js');
|
|
25
|
+
require('../_getTag-cjs.js');
|
|
26
|
+
require('../isSymbol-cjs.js');
|
|
27
|
+
require('../keysIn-cjs.js');
|
|
28
|
+
require('../_baseAssignValue-cjs.js');
|
|
29
|
+
require('../_baseFlatten-cjs.js');
|
|
30
|
+
require('../_setToString-cjs.js');
|
|
19
31
|
|
|
20
32
|
/**
|
|
21
33
|
* Hook for resizing a textarea based on its content. The textarea will grow up to the max number of rows specified.
|
|
@@ -150,7 +162,7 @@ function insertAtCursor(input, newText) {
|
|
|
150
162
|
function useInputTextActions({ onChange, inputRef, onEnter, onFocus, onBlur, onKeyDown, }) {
|
|
151
163
|
function handleClear() {
|
|
152
164
|
var _a;
|
|
153
|
-
|
|
165
|
+
handleBlur();
|
|
154
166
|
onChange && onChange("");
|
|
155
167
|
(_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
156
168
|
}
|
|
@@ -184,10 +196,23 @@ function useInputTextActions({ onChange, inputRef, onEnter, onFocus, onBlur, onK
|
|
|
184
196
|
};
|
|
185
197
|
}
|
|
186
198
|
|
|
199
|
+
/**
|
|
200
|
+
* Provides the props for the html fields rendered by the html input.
|
|
201
|
+
* DO not repeat this pattern. We are doing this as a proof of concept relating to the refactoring of Form inputs to see what can be removed.
|
|
202
|
+
*/
|
|
203
|
+
function useInputTextFormField(_a) {
|
|
204
|
+
var { id, name, description, inline, handleChange, handleBlur, handleFocus, handleKeyDown, error } = _a, rest = tslib_es6.__rest(_a, ["id", "name", "description", "inline", "handleChange", "handleBlur", "handleFocus", "handleKeyDown", "error"]);
|
|
205
|
+
const descriptionIdentifier = `descriptionUUID--${id}`;
|
|
206
|
+
const fieldProps = Object.assign(Object.assign(Object.assign(Object.assign({}, rest), { id, className: FormField.styles.input, name, disabled: rest.disabled, inputMode: rest.inputMode, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus }), (description &&
|
|
207
|
+
!inline && { "aria-describedby": descriptionIdentifier })), { "aria-invalid": rest["aria-invalid"] || error || rest.invalid ? true : undefined, autoFocus: rest.autoFocus, invalid: error || rest.invalid ? "true" : undefined, onKeyDown: handleKeyDown });
|
|
208
|
+
return { fieldProps, descriptionIdentifier };
|
|
209
|
+
}
|
|
210
|
+
|
|
187
211
|
const InputTextSPAR = React.forwardRef(function InputTextInternal(props, inputRefs) {
|
|
188
212
|
var _a, _b, _c;
|
|
189
213
|
const inputTextRef = React.useRef(null);
|
|
190
214
|
const wrapperRef = React.useRef(null);
|
|
215
|
+
const legacyPropHelper = Object.assign(Object.assign({}, props), { version: 1 });
|
|
191
216
|
const id = useInputTextId(props);
|
|
192
217
|
const { rowRange } = useTextAreaResize({
|
|
193
218
|
rows: props.rows,
|
|
@@ -195,19 +220,8 @@ const InputTextSPAR = React.forwardRef(function InputTextInternal(props, inputRe
|
|
|
195
220
|
inputRef: inputTextRef,
|
|
196
221
|
wrapperRef: wrapperRef,
|
|
197
222
|
});
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
align: props.align,
|
|
201
|
-
placeholder: props.placeholder,
|
|
202
|
-
value: props.value,
|
|
203
|
-
invalid: props.invalid,
|
|
204
|
-
error: props.error,
|
|
205
|
-
max: typeof props.max === "string" ? parseFloat(props.max) : props.max,
|
|
206
|
-
maxLength: undefined, // v2: maxLength is for HTML validation only, not for width styling
|
|
207
|
-
type: props.multiline ? "textarea" : "text",
|
|
208
|
-
disabled: props.disabled,
|
|
209
|
-
inline: props.inline,
|
|
210
|
-
});
|
|
223
|
+
const type = props.multiline ? "textarea" : "text";
|
|
224
|
+
const { inputStyle } = FormField.useFormFieldWrapperStyles(legacyPropHelper);
|
|
211
225
|
const { name } = FormField.useAtlantisFormFieldName({
|
|
212
226
|
nameProp: props.name,
|
|
213
227
|
id: id,
|
|
@@ -220,25 +234,40 @@ const InputTextSPAR = React.forwardRef(function InputTextInternal(props, inputRe
|
|
|
220
234
|
onEnter: props.onEnter,
|
|
221
235
|
inputRef: inputTextRef,
|
|
222
236
|
});
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
|
|
237
|
+
const inputProps = omit.omit(props, [
|
|
238
|
+
"onChange",
|
|
239
|
+
"onBlur",
|
|
240
|
+
"onFocus",
|
|
241
|
+
"onEnter",
|
|
242
|
+
"size",
|
|
243
|
+
"placeholder",
|
|
244
|
+
"multiline",
|
|
245
|
+
"prefix",
|
|
246
|
+
"suffix",
|
|
247
|
+
"version",
|
|
248
|
+
]);
|
|
249
|
+
const { fieldProps, descriptionIdentifier } = useInputTextFormField(Object.assign(Object.assign({}, inputProps), { id,
|
|
250
|
+
name,
|
|
251
|
+
handleChange,
|
|
252
|
+
handleBlur,
|
|
253
|
+
handleFocus,
|
|
254
|
+
handleKeyDown }));
|
|
226
255
|
return (React.createElement(FormField.FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, autofocus: props.autoFocus, name: name, wrapperRef: wrapperRef, error: (_a = props.error) !== null && _a !== void 0 ? _a : "", invalid: Boolean(props.error || props.invalid), identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, clearable: (_b = props.clearable) !== null && _b !== void 0 ? _b : "never", onClear: handleClear, type: props.multiline ? "textarea" : "text", placeholder: props.placeholder, value: props.value, prefix: props.prefix, suffix: props.suffix, rows: rowRange.min, toolbar: props.toolbar, toolbarVisibility: props.toolbarVisibility },
|
|
227
256
|
React.createElement(React.Fragment, null,
|
|
228
|
-
|
|
257
|
+
type === "textarea" ? (React.createElement(TextArea, { fieldProps: fieldProps, rowRange: rowRange, inputRefs: [inputRefs, inputTextRef], value: props.value, inputStyle: inputStyle })) : (React.createElement(TextInput, { fieldProps: fieldProps, inputRefs: [inputRefs, inputTextRef], value: props.value, inputStyle: inputStyle })),
|
|
229
258
|
React.createElement(FormField.FormFieldPostFix, { variation: "spinner", visible: (_c = props.loading) !== null && _c !== void 0 ? _c : false }),
|
|
230
259
|
props.children)));
|
|
231
260
|
});
|
|
232
261
|
function useInputTextId(props) {
|
|
233
262
|
const generatedId = React.useId();
|
|
234
|
-
return props.
|
|
263
|
+
return props.id || generatedId;
|
|
264
|
+
}
|
|
265
|
+
function TextArea({ fieldProps, rowRange, inputRefs, value, inputStyle, }) {
|
|
266
|
+
return (React.createElement("textarea", Object.assign({}, fieldProps, { rows: rowRange.min, ref: FormField.mergeRefs(inputRefs), className: inputStyle, value: value })));
|
|
267
|
+
}
|
|
268
|
+
function TextInput({ fieldProps, inputRefs, value, inputStyle, }) {
|
|
269
|
+
return (React.createElement("input", Object.assign({}, fieldProps, { ref: FormField.mergeRefs(inputRefs), className: inputStyle, value: value })));
|
|
235
270
|
}
|
|
236
|
-
const TextArea = React.forwardRef(function TextArea(props, ref) {
|
|
237
|
-
return React.createElement("textarea", Object.assign({}, props, { ref: ref }));
|
|
238
|
-
});
|
|
239
|
-
const TextInput = React.forwardRef(function TextInput(props, ref) {
|
|
240
|
-
return React.createElement("input", Object.assign({}, props, { ref: ref }));
|
|
241
|
-
});
|
|
242
271
|
|
|
243
272
|
function isNewInputTextProps(props) {
|
|
244
273
|
return props.version === 2;
|
package/dist/InputText/index.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React__default, { forwardRef, useRef, useImperativeHandle, useId } from 'react';
|
|
2
2
|
import { useSafeLayoutEffect } from '@jobber/hooks';
|
|
3
|
-
import { k as FormField, j as useFormFieldWrapperStyles, b as useAtlantisFormFieldName, f as FormFieldWrapper,
|
|
3
|
+
import { k as FormField, s as styles, j as useFormFieldWrapperStyles, b as useAtlantisFormFieldName, f as FormFieldWrapper, l as FormFieldPostFix, m as mergeRefs } from '../FormField-es.js';
|
|
4
4
|
import 'classnames';
|
|
5
|
-
import '../tslib.es6-es.js';
|
|
5
|
+
import { _ as __rest } from '../tslib.es6-es.js';
|
|
6
6
|
import 'react-hook-form';
|
|
7
7
|
import 'framer-motion';
|
|
8
8
|
import '@jobber/design';
|
|
9
9
|
import '../Button-es.js';
|
|
10
|
+
import { o as omit } from '../omit-es.js';
|
|
10
11
|
import '../Icon-es.js';
|
|
11
12
|
import '../Text-es.js';
|
|
12
13
|
import '../Typography-es.js';
|
|
@@ -14,6 +15,17 @@ import '../useFormFieldFocus-es.js';
|
|
|
14
15
|
import '../InputValidation-es.js';
|
|
15
16
|
import '../Spinner-es.js';
|
|
16
17
|
import 'react-router-dom';
|
|
18
|
+
import '../_commonjsHelpers-es.js';
|
|
19
|
+
import '../_baseGet-es.js';
|
|
20
|
+
import '../isTypedArray-es.js';
|
|
21
|
+
import '../isObjectLike-es.js';
|
|
22
|
+
import '../identity-es.js';
|
|
23
|
+
import '../_getTag-es.js';
|
|
24
|
+
import '../isSymbol-es.js';
|
|
25
|
+
import '../keysIn-es.js';
|
|
26
|
+
import '../_baseAssignValue-es.js';
|
|
27
|
+
import '../_baseFlatten-es.js';
|
|
28
|
+
import '../_setToString-es.js';
|
|
17
29
|
|
|
18
30
|
/**
|
|
19
31
|
* Hook for resizing a textarea based on its content. The textarea will grow up to the max number of rows specified.
|
|
@@ -148,7 +160,7 @@ function insertAtCursor(input, newText) {
|
|
|
148
160
|
function useInputTextActions({ onChange, inputRef, onEnter, onFocus, onBlur, onKeyDown, }) {
|
|
149
161
|
function handleClear() {
|
|
150
162
|
var _a;
|
|
151
|
-
|
|
163
|
+
handleBlur();
|
|
152
164
|
onChange && onChange("");
|
|
153
165
|
(_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
154
166
|
}
|
|
@@ -182,10 +194,23 @@ function useInputTextActions({ onChange, inputRef, onEnter, onFocus, onBlur, onK
|
|
|
182
194
|
};
|
|
183
195
|
}
|
|
184
196
|
|
|
197
|
+
/**
|
|
198
|
+
* Provides the props for the html fields rendered by the html input.
|
|
199
|
+
* DO not repeat this pattern. We are doing this as a proof of concept relating to the refactoring of Form inputs to see what can be removed.
|
|
200
|
+
*/
|
|
201
|
+
function useInputTextFormField(_a) {
|
|
202
|
+
var { id, name, description, inline, handleChange, handleBlur, handleFocus, handleKeyDown, error } = _a, rest = __rest(_a, ["id", "name", "description", "inline", "handleChange", "handleBlur", "handleFocus", "handleKeyDown", "error"]);
|
|
203
|
+
const descriptionIdentifier = `descriptionUUID--${id}`;
|
|
204
|
+
const fieldProps = Object.assign(Object.assign(Object.assign(Object.assign({}, rest), { id, className: styles.input, name, disabled: rest.disabled, inputMode: rest.inputMode, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus }), (description &&
|
|
205
|
+
!inline && { "aria-describedby": descriptionIdentifier })), { "aria-invalid": rest["aria-invalid"] || error || rest.invalid ? true : undefined, autoFocus: rest.autoFocus, invalid: error || rest.invalid ? "true" : undefined, onKeyDown: handleKeyDown });
|
|
206
|
+
return { fieldProps, descriptionIdentifier };
|
|
207
|
+
}
|
|
208
|
+
|
|
185
209
|
const InputTextSPAR = forwardRef(function InputTextInternal(props, inputRefs) {
|
|
186
210
|
var _a, _b, _c;
|
|
187
211
|
const inputTextRef = React__default.useRef(null);
|
|
188
212
|
const wrapperRef = React__default.useRef(null);
|
|
213
|
+
const legacyPropHelper = Object.assign(Object.assign({}, props), { version: 1 });
|
|
189
214
|
const id = useInputTextId(props);
|
|
190
215
|
const { rowRange } = useTextAreaResize({
|
|
191
216
|
rows: props.rows,
|
|
@@ -193,19 +218,8 @@ const InputTextSPAR = forwardRef(function InputTextInternal(props, inputRefs) {
|
|
|
193
218
|
inputRef: inputTextRef,
|
|
194
219
|
wrapperRef: wrapperRef,
|
|
195
220
|
});
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
align: props.align,
|
|
199
|
-
placeholder: props.placeholder,
|
|
200
|
-
value: props.value,
|
|
201
|
-
invalid: props.invalid,
|
|
202
|
-
error: props.error,
|
|
203
|
-
max: typeof props.max === "string" ? parseFloat(props.max) : props.max,
|
|
204
|
-
maxLength: undefined, // v2: maxLength is for HTML validation only, not for width styling
|
|
205
|
-
type: props.multiline ? "textarea" : "text",
|
|
206
|
-
disabled: props.disabled,
|
|
207
|
-
inline: props.inline,
|
|
208
|
-
});
|
|
221
|
+
const type = props.multiline ? "textarea" : "text";
|
|
222
|
+
const { inputStyle } = useFormFieldWrapperStyles(legacyPropHelper);
|
|
209
223
|
const { name } = useAtlantisFormFieldName({
|
|
210
224
|
nameProp: props.name,
|
|
211
225
|
id: id,
|
|
@@ -218,25 +232,40 @@ const InputTextSPAR = forwardRef(function InputTextInternal(props, inputRefs) {
|
|
|
218
232
|
onEnter: props.onEnter,
|
|
219
233
|
inputRef: inputTextRef,
|
|
220
234
|
});
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
|
|
235
|
+
const inputProps = omit(props, [
|
|
236
|
+
"onChange",
|
|
237
|
+
"onBlur",
|
|
238
|
+
"onFocus",
|
|
239
|
+
"onEnter",
|
|
240
|
+
"size",
|
|
241
|
+
"placeholder",
|
|
242
|
+
"multiline",
|
|
243
|
+
"prefix",
|
|
244
|
+
"suffix",
|
|
245
|
+
"version",
|
|
246
|
+
]);
|
|
247
|
+
const { fieldProps, descriptionIdentifier } = useInputTextFormField(Object.assign(Object.assign({}, inputProps), { id,
|
|
248
|
+
name,
|
|
249
|
+
handleChange,
|
|
250
|
+
handleBlur,
|
|
251
|
+
handleFocus,
|
|
252
|
+
handleKeyDown }));
|
|
224
253
|
return (React__default.createElement(FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, autofocus: props.autoFocus, name: name, wrapperRef: wrapperRef, error: (_a = props.error) !== null && _a !== void 0 ? _a : "", invalid: Boolean(props.error || props.invalid), identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, clearable: (_b = props.clearable) !== null && _b !== void 0 ? _b : "never", onClear: handleClear, type: props.multiline ? "textarea" : "text", placeholder: props.placeholder, value: props.value, prefix: props.prefix, suffix: props.suffix, rows: rowRange.min, toolbar: props.toolbar, toolbarVisibility: props.toolbarVisibility },
|
|
225
254
|
React__default.createElement(React__default.Fragment, null,
|
|
226
|
-
|
|
255
|
+
type === "textarea" ? (React__default.createElement(TextArea, { fieldProps: fieldProps, rowRange: rowRange, inputRefs: [inputRefs, inputTextRef], value: props.value, inputStyle: inputStyle })) : (React__default.createElement(TextInput, { fieldProps: fieldProps, inputRefs: [inputRefs, inputTextRef], value: props.value, inputStyle: inputStyle })),
|
|
227
256
|
React__default.createElement(FormFieldPostFix, { variation: "spinner", visible: (_c = props.loading) !== null && _c !== void 0 ? _c : false }),
|
|
228
257
|
props.children)));
|
|
229
258
|
});
|
|
230
259
|
function useInputTextId(props) {
|
|
231
260
|
const generatedId = useId();
|
|
232
|
-
return props.
|
|
261
|
+
return props.id || generatedId;
|
|
262
|
+
}
|
|
263
|
+
function TextArea({ fieldProps, rowRange, inputRefs, value, inputStyle, }) {
|
|
264
|
+
return (React__default.createElement("textarea", Object.assign({}, fieldProps, { rows: rowRange.min, ref: mergeRefs(inputRefs), className: inputStyle, value: value })));
|
|
265
|
+
}
|
|
266
|
+
function TextInput({ fieldProps, inputRefs, value, inputStyle, }) {
|
|
267
|
+
return (React__default.createElement("input", Object.assign({}, fieldProps, { ref: mergeRefs(inputRefs), className: inputStyle, value: value })));
|
|
233
268
|
}
|
|
234
|
-
const TextArea = forwardRef(function TextArea(props, ref) {
|
|
235
|
-
return React__default.createElement("textarea", Object.assign({}, props, { ref: ref }));
|
|
236
|
-
});
|
|
237
|
-
const TextInput = forwardRef(function TextInput(props, ref) {
|
|
238
|
-
return React__default.createElement("input", Object.assign({}, props, { ref: ref }));
|
|
239
|
-
});
|
|
240
269
|
|
|
241
270
|
function isNewInputTextProps(props) {
|
|
242
271
|
return props.version === 2;
|
|
@@ -12,5 +12,5 @@ export declare function useInputTextActions({ onChange, inputRef, onEnter, onFoc
|
|
|
12
12
|
handleChange: (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
13
13
|
handleKeyDown: (event: KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
14
14
|
handleFocus: (event: FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
15
|
-
handleBlur: (event
|
|
15
|
+
handleBlur: (event?: FocusEvent) => void;
|
|
16
16
|
};
|