@jobber/components 6.104.0 → 6.104.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Autocomplete/Autocomplete.types.d.ts +9 -51
- package/dist/Autocomplete/index.cjs +10 -20
- package/dist/Autocomplete/index.mjs +10 -20
- package/dist/Autocomplete/tests/Autocomplete.setup.d.ts +1 -1
- package/dist/Autocomplete/useAutocomplete.d.ts +2 -2
- package/dist/Checkbox/Checkbox.rebuilt.d.ts +1 -2
- package/dist/Checkbox/Checkbox.types.d.ts +3 -34
- package/dist/Checkbox/index.cjs +9 -2
- package/dist/Checkbox/index.mjs +9 -2
- 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/DataListHeader/index.cjs +1 -0
- package/dist/DataList/components/DataListHeader/index.mjs +1 -0
- package/dist/DataList/components/DataListItem/index.cjs +1 -0
- package/dist/DataList/components/DataListItem/index.mjs +1 -0
- package/dist/DataList/components/DataListItems/index.cjs +1 -0
- package/dist/DataList/components/DataListItems/index.mjs +1 -0
- package/dist/DataList/components/DataListLayout/index.cjs +1 -0
- package/dist/DataList/components/DataListLayout/index.mjs +1 -0
- package/dist/DataList/components/DataListSearch/index.cjs +2 -12
- package/dist/DataList/components/DataListSearch/index.mjs +2 -12
- package/dist/DataList/index.cjs +1 -8
- package/dist/DataList/index.mjs +1 -8
- package/dist/DataTable/index.cjs +3 -2
- package/dist/DataTable/index.mjs +3 -2
- package/dist/DatePicker/index.cjs +2 -2
- package/dist/DatePicker/index.mjs +2 -2
- package/dist/FormField/FormFieldTypes.d.ts +0 -2
- package/dist/FormField/hooks/useFormFieldWrapperStyles.d.ts +7 -2
- package/dist/FormField-cjs.js +0 -1
- package/dist/FormField-es.js +1 -1
- package/dist/InputDate/InputDate.types.d.ts +12 -7
- package/dist/InputDate/index.cjs +6 -9
- package/dist/InputDate/index.mjs +6 -9
- package/dist/InputDate/useInputDateActivatorActions.d.ts +4 -8
- package/dist/InputEmail/InputEmail.types.d.ts +10 -20
- package/dist/InputEmail/hooks/useInputEmailActions.d.ts +4 -3
- package/dist/InputEmail/index.cjs +18 -49
- package/dist/InputEmail/index.mjs +18 -49
- package/dist/InputNumber/InputNumber.rebuilt.types.d.ts +7 -15
- package/dist/InputNumber/index.cjs +6 -4
- package/dist/InputNumber/index.mjs +6 -4
- package/dist/InputPhoneNumber/InputPhoneNumber.types.d.ts +12 -28
- package/dist/InputPhoneNumber/hooks/useInputPhoneActions.d.ts +1 -1
- package/dist/InputPhoneNumber/index.cjs +20 -34
- package/dist/InputPhoneNumber/index.mjs +20 -34
- package/dist/InputText/InputText.types.d.ts +31 -25
- package/dist/InputText/index.cjs +41 -62
- package/dist/InputText/index.mjs +42 -63
- package/dist/InputText/useInputTextActions.d.ts +4 -3
- package/dist/InputTime/InputTime.rebuilt.d.ts +1 -1
- package/dist/InputTime/InputTime.types.d.ts +13 -4
- package/dist/InputTime/hooks/useInputTimeActions.d.ts +16 -0
- package/dist/InputTime/index.cjs +66 -30
- package/dist/InputTime/index.mjs +69 -33
- package/dist/List/index.cjs +2 -2
- package/dist/List/index.mjs +2 -2
- package/dist/MultiSelect/index.cjs +1 -0
- package/dist/MultiSelect/index.mjs +1 -0
- package/dist/RecurringSelect/index.cjs +3 -2
- package/dist/RecurringSelect/index.mjs +3 -2
- package/dist/Select/Select.types.d.ts +7 -3
- package/dist/Select/hooks/useSelectActions.d.ts +5 -5
- package/dist/Select/index.cjs +27 -41
- package/dist/Select/index.mjs +29 -43
- package/dist/Tabs-es.js +1 -1
- 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/{_baseGet-cjs.js → _getAllKeys-cjs.js} +181 -181
- package/dist/{_baseGet-es.js → _getAllKeys-es.js} +182 -182
- package/dist/debounce-es.js +1 -1
- package/dist/filterDataAttributes-cjs.js +26 -0
- package/dist/filterDataAttributes-es.js +24 -0
- package/dist/index.cjs +3 -2
- package/dist/index.mjs +3 -2
- package/dist/omit-cjs.js +14 -14
- package/dist/omit-es.js +1 -1
- package/dist/sharedHelpers/filterDataAttributes.d.ts +17 -0
- package/dist/sharedHelpers/types.d.ts +205 -0
- package/dist/useScrollToActive-cjs.js +3 -3
- package/dist/useScrollToActive-es.js +2 -2
- package/package.json +2 -2
- package/dist/InputEmail/hooks/useInputEmailFormField.d.ts +0 -32
- package/dist/InputPhoneNumber/hooks/useInputPhoneFormField.d.ts +0 -71
- package/dist/InputText/useInputTextFormField.d.ts +0 -366
- package/dist/Select/hooks/useSelectFormField.d.ts +0 -34
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React__default, { forwardRef, useId, useRef } from 'react';
|
|
2
2
|
import { k as FormField, j as useFormFieldWrapperStyles, b as useAtlantisFormFieldName, f as FormFieldWrapper, l as FormFieldPostFix } from '../FormField-es.js';
|
|
3
3
|
import 'classnames';
|
|
4
|
-
import
|
|
4
|
+
import '../tslib.es6-es.js';
|
|
5
5
|
import 'react-hook-form';
|
|
6
6
|
import '@jobber/hooks';
|
|
7
7
|
import 'framer-motion';
|
|
8
8
|
import '@jobber/design';
|
|
9
9
|
import '../Button-es.js';
|
|
10
|
-
import {
|
|
10
|
+
import { f as filterDataAttributes } from '../filterDataAttributes-es.js';
|
|
11
11
|
import '../Icon-es.js';
|
|
12
12
|
import '../Text-es.js';
|
|
13
13
|
import '../Typography-es.js';
|
|
@@ -15,17 +15,6 @@ import '../useFormFieldFocus-es.js';
|
|
|
15
15
|
import '../InputValidation-es.js';
|
|
16
16
|
import '../Spinner-es.js';
|
|
17
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';
|
|
29
18
|
|
|
30
19
|
const validationMessage = "Please enter a valid email";
|
|
31
20
|
|
|
@@ -44,10 +33,9 @@ function InputEmail$1(props) {
|
|
|
44
33
|
}
|
|
45
34
|
}
|
|
46
35
|
|
|
47
|
-
function useInputEmailActions({ onChange, inputRef, onEnter, onFocus, onBlur, onKeyDown, }) {
|
|
36
|
+
function useInputEmailActions({ onChange, inputRef, onEnter, onFocus, onBlur, onKeyDown, onKeyUp, }) {
|
|
48
37
|
function handleClear() {
|
|
49
38
|
var _a;
|
|
50
|
-
handleBlur();
|
|
51
39
|
onChange === null || onChange === void 0 ? void 0 : onChange("");
|
|
52
40
|
(_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
53
41
|
}
|
|
@@ -72,28 +60,23 @@ function useInputEmailActions({ onChange, inputRef, onEnter, onFocus, onBlur, on
|
|
|
72
60
|
function handleBlur(event) {
|
|
73
61
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
74
62
|
}
|
|
63
|
+
function handleKeyUp(event) {
|
|
64
|
+
onKeyUp === null || onKeyUp === void 0 ? void 0 : onKeyUp(event);
|
|
65
|
+
}
|
|
75
66
|
return {
|
|
76
67
|
handleClear,
|
|
77
68
|
handleChange,
|
|
78
69
|
handleKeyDown,
|
|
70
|
+
handleKeyUp,
|
|
79
71
|
handleFocus,
|
|
80
72
|
handleBlur,
|
|
81
73
|
};
|
|
82
74
|
}
|
|
83
75
|
|
|
84
|
-
function useInputEmailFormField(_a) {
|
|
85
|
-
var { id, name, disabled, autofocus, description, inline, value, handleChange, handleBlur, handleFocus, handleKeyDown, error } = _a, rest = __rest(_a, ["id", "name", "disabled", "autofocus", "description", "inline", "value", "handleChange", "handleBlur", "handleFocus", "handleKeyDown", "error"]);
|
|
86
|
-
const descriptionIdentifier = `descriptionUUID--${id}`;
|
|
87
|
-
const fieldProps = Object.assign(Object.assign(Object.assign({}, rest), { id,
|
|
88
|
-
name,
|
|
89
|
-
disabled, autoFocus: autofocus, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown, value, invalid: error || rest.invalid ? "true" : undefined }), (description &&
|
|
90
|
-
!inline && { "aria-describedby": descriptionIdentifier }));
|
|
91
|
-
return { fieldProps, descriptionIdentifier };
|
|
92
|
-
}
|
|
93
|
-
|
|
94
76
|
const InputEmailRebuilt = forwardRef(function InputEmailInternal(props, ref) {
|
|
95
77
|
var _a, _b, _c;
|
|
96
|
-
const
|
|
78
|
+
const generatedId = useId();
|
|
79
|
+
const id = props.id || generatedId;
|
|
97
80
|
const inputRef = (_a = ref) !== null && _a !== void 0 ? _a : useRef(null);
|
|
98
81
|
const wrapperRef = useRef(null);
|
|
99
82
|
const { inputStyle } = useFormFieldWrapperStyles({
|
|
@@ -104,7 +87,6 @@ const InputEmailRebuilt = forwardRef(function InputEmailInternal(props, ref) {
|
|
|
104
87
|
value: props.value,
|
|
105
88
|
invalid: props.invalid,
|
|
106
89
|
error: props.error,
|
|
107
|
-
maxLength: props.maxLength,
|
|
108
90
|
disabled: props.disabled,
|
|
109
91
|
placeholder: props.placeholder,
|
|
110
92
|
});
|
|
@@ -112,35 +94,22 @@ const InputEmailRebuilt = forwardRef(function InputEmailInternal(props, ref) {
|
|
|
112
94
|
nameProp: props.name,
|
|
113
95
|
id,
|
|
114
96
|
});
|
|
115
|
-
const { handleChange, handleBlur, handleFocus, handleKeyDown, handleClear } = useInputEmailActions({
|
|
97
|
+
const { handleChange, handleBlur, handleFocus, handleKeyDown, handleKeyUp, handleClear, } = useInputEmailActions({
|
|
116
98
|
onChange: props.onChange,
|
|
117
99
|
onBlur: props.onBlur,
|
|
118
100
|
onFocus: props.onFocus,
|
|
119
101
|
onKeyDown: props.onKeyDown,
|
|
102
|
+
onKeyUp: props.onKeyUp,
|
|
120
103
|
onEnter: props.onEnter,
|
|
121
104
|
inputRef,
|
|
122
105
|
});
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
"prefix",
|
|
131
|
-
"suffix",
|
|
132
|
-
"version",
|
|
133
|
-
]);
|
|
134
|
-
const { fieldProps, descriptionIdentifier } = useInputEmailFormField(Object.assign(Object.assign({}, inputProps), { id,
|
|
135
|
-
name,
|
|
136
|
-
handleChange,
|
|
137
|
-
handleBlur,
|
|
138
|
-
handleFocus,
|
|
139
|
-
handleKeyDown }));
|
|
140
|
-
return (React__default.createElement(FormFieldWrapper, { error: props.error || "", invalid: props.invalid, identifier: props.identifier || id, descriptionIdentifier: descriptionIdentifier, size: props.size, inline: props.inline, align: props.align, prefix: props.prefix, suffix: props.suffix, description: props.description, clearable: (_b = props.clearable) !== null && _b !== void 0 ? _b : "never", onClear: handleClear, wrapperRef: wrapperRef, maxLength: props.maxLength, disabled: props.disabled, type: "email", value: props.value, placeholder: props.placeholder, autofocus: props.autoFocus, name: name },
|
|
141
|
-
React__default.createElement("input", Object.assign({}, fieldProps, { ref: inputRef, type: "email", className: inputStyle, value: props.value, "data-testid": "ATL-InputEmail-input" })),
|
|
142
|
-
React__default.createElement(FormFieldPostFix, { variation: "spinner", visible: (_c = props.loading) !== null && _c !== void 0 ? _c : false }),
|
|
143
|
-
props.children));
|
|
106
|
+
const descriptionIdentifier = `descriptionUUID--${id}`;
|
|
107
|
+
const descriptionVisible = props.description && !props.inline;
|
|
108
|
+
const isInvalid = Boolean(props.error || props.invalid);
|
|
109
|
+
const dataAttrs = filterDataAttributes(props);
|
|
110
|
+
return (React__default.createElement(FormFieldWrapper, { error: props.error || "", invalid: props.invalid, identifier: id, descriptionIdentifier: descriptionIdentifier, size: props.size, inline: props.inline, align: props.align, prefix: props.prefix, suffix: props.suffix, description: props.description, clearable: (_b = props.clearable) !== null && _b !== void 0 ? _b : "never", onClear: handleClear, wrapperRef: wrapperRef, disabled: props.disabled, type: "email", value: props.value, placeholder: props.placeholder, name: name },
|
|
111
|
+
React__default.createElement("input", Object.assign({ id: id, name: name, type: "email", ref: inputRef, className: inputStyle, value: props.value, disabled: props.disabled, readOnly: props.readOnly, autoFocus: props.autoFocus, autoComplete: props.autoComplete, pattern: props.pattern, inputMode: props.inputMode, tabIndex: props.tabIndex, role: props.role, "aria-label": props["aria-label"], "aria-describedby": descriptionVisible ? descriptionIdentifier : props["aria-describedby"], "aria-invalid": isInvalid ? true : undefined, "aria-controls": props["aria-controls"], "aria-expanded": props["aria-expanded"], "aria-activedescendant": props["aria-activedescendant"], "aria-autocomplete": props["aria-autocomplete"], "aria-required": props["aria-required"], onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, "data-testid": "ATL-InputEmail-input" }, dataAttrs)),
|
|
112
|
+
React__default.createElement(FormFieldPostFix, { variation: "spinner", visible: (_c = props.loading) !== null && _c !== void 0 ? _c : false })));
|
|
144
113
|
});
|
|
145
114
|
|
|
146
115
|
function isNewInputEmailProps(props) {
|
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
1
|
import type React from "react";
|
|
3
|
-
import type {
|
|
2
|
+
import type { FocusEvents, HTMLInputBaseProps, KeyboardEvents, RebuiltInputCommonProps } from "../sharedHelpers/types";
|
|
4
3
|
export type InputNumberVersion = 1 | 2 | undefined;
|
|
5
|
-
export interface InputNumberRebuiltProps extends
|
|
6
|
-
readonly align?: "center" | "right";
|
|
7
|
-
readonly autocomplete?: boolean;
|
|
8
|
-
readonly autoFocus?: boolean;
|
|
4
|
+
export interface InputNumberRebuiltProps extends HTMLInputBaseProps, FocusEvents<HTMLInputElement>, KeyboardEvents<HTMLInputElement>, Omit<RebuiltInputCommonProps, "clearable" | "suffix" | "prefix"> {
|
|
9
5
|
readonly defaultValue?: number;
|
|
10
|
-
readonly description?: ReactNode;
|
|
11
|
-
readonly error?: string;
|
|
12
6
|
readonly formatOptions?: Intl.NumberFormatOptions;
|
|
13
|
-
readonly identifier?: string;
|
|
14
|
-
readonly inline?: boolean;
|
|
15
|
-
readonly invalid?: boolean;
|
|
16
7
|
readonly maxValue?: number;
|
|
17
8
|
readonly minValue?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Callback for value changes.
|
|
11
|
+
* @param newValue - The new numeric value
|
|
12
|
+
* @param event - Optional change event
|
|
13
|
+
*/
|
|
18
14
|
readonly onChange?: (newValue: number, event?: React.ChangeEvent<HTMLInputElement>) => void;
|
|
19
15
|
readonly showMiniLabel?: boolean;
|
|
20
16
|
readonly value?: number;
|
|
21
|
-
/**
|
|
22
|
-
* Version 2 is highly experimental. Avoid using it unless you have talked with Atlantis first.
|
|
23
|
-
*/
|
|
24
|
-
readonly version: 2;
|
|
25
17
|
}
|
|
26
18
|
export interface InputNumberRebuiltRef {
|
|
27
19
|
focus: () => void;
|
|
@@ -7,6 +7,7 @@ require('react-dom');
|
|
|
7
7
|
var classnames = require('classnames');
|
|
8
8
|
var Icon = require('../Icon-cjs.js');
|
|
9
9
|
var Text = require('../Text-cjs.js');
|
|
10
|
+
var filterDataAttributes = require('../filterDataAttributes-cjs.js');
|
|
10
11
|
var FormField = require('../FormField-cjs.js');
|
|
11
12
|
require('react-hook-form');
|
|
12
13
|
require('@jobber/hooks');
|
|
@@ -2740,14 +2741,15 @@ const InputNumberRebuilt = React.forwardRef((props, ref) => {
|
|
|
2740
2741
|
}
|
|
2741
2742
|
},
|
|
2742
2743
|
}));
|
|
2743
|
-
const { align, description, disabled, error, inline, invalid, placeholder,
|
|
2744
|
+
const { align, description, disabled, error, inline, invalid, placeholder, readOnly, showMiniLabel = true, size, minValue, maxValue } = props, ariaNumberFieldProps = tslib_es6.__rest(props, ["align", "description", "disabled", "error", "inline", "invalid", "placeholder", "readOnly", "showMiniLabel", "size", "minValue", "maxValue"]);
|
|
2745
|
+
const dataAttrs = filterDataAttributes.filterDataAttributes(props);
|
|
2744
2746
|
const stringDescription = typeof description === "string";
|
|
2745
|
-
return (React.createElement($b91743d66a0ed188$export$63c5fa0b2fdccd2e, Object.assign({}, ariaNumberFieldProps, { className: classnames(styles.container, inline && styles.inline), formatOptions: mergedFormatOptions, isDisabled: disabled, isInvalid: invalid, isReadOnly:
|
|
2747
|
+
return (React.createElement($b91743d66a0ed188$export$63c5fa0b2fdccd2e, Object.assign({}, ariaNumberFieldProps, { className: classnames(styles.container, inline && styles.inline), formatOptions: mergedFormatOptions, isDisabled: disabled, isInvalid: invalid, isReadOnly: readOnly, minValue: minValue, maxValue: maxValue, onBlur: e => { var _a; return (_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e); }, onFocus: e => { var _a; return (_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, e); }, onChange: handleChange }),
|
|
2746
2748
|
React.createElement($a049562f99e7db0e$export$eb2fcfdbd7ba97d4, { className: classnames(styles.wrapper, align && styles[align], invalid && styles.invalid, disabled && styles.disabled) },
|
|
2747
2749
|
React.createElement("div", { className: styles.horizontalWrapper },
|
|
2748
2750
|
React.createElement("div", { className: classnames(styles.inputWrapper, disabled && styles.disabled, !showMiniLabel && styles.hideLabel, size && styles[size]) },
|
|
2749
|
-
React.createElement($3985021b0ad6602f$export$f5b8910cec6cf069, { className: styles.input, placeholder: " " // used for CSS minilabel
|
|
2750
|
-
, ref: inputRef }),
|
|
2751
|
+
React.createElement($3985021b0ad6602f$export$f5b8910cec6cf069, Object.assign({ className: styles.input, placeholder: " " // used for CSS minilabel
|
|
2752
|
+
, ref: inputRef }, dataAttrs)),
|
|
2751
2753
|
React.createElement($01b77f81d0f07f68$export$b04be29aa201d4f5, { className: styles.label }, placeholder)))),
|
|
2752
2754
|
description && (React.createElement(Tree.$514c0188e459b4c0$export$5f1af8db9871e1d6, { className: styles.description, elementType: "div", slot: "description" }, stringDescription ? (React.createElement(Text.Text, { size: "small", variation: "subdued" }, description)) : (description))),
|
|
2753
2755
|
error && (React.createElement($ee014567cb39d3f0$export$f551688fc98f2e09, { className: styles.fieldError },
|
|
@@ -5,6 +5,7 @@ import 'react-dom';
|
|
|
5
5
|
import classnames from 'classnames';
|
|
6
6
|
import { I as Icon } from '../Icon-es.js';
|
|
7
7
|
import { T as Text } from '../Text-es.js';
|
|
8
|
+
import { f as filterDataAttributes } from '../filterDataAttributes-es.js';
|
|
8
9
|
import { k as FormField } from '../FormField-es.js';
|
|
9
10
|
import 'react-hook-form';
|
|
10
11
|
import '@jobber/hooks';
|
|
@@ -2738,14 +2739,15 @@ const InputNumberRebuilt = forwardRef((props, ref) => {
|
|
|
2738
2739
|
}
|
|
2739
2740
|
},
|
|
2740
2741
|
}));
|
|
2741
|
-
const { align, description, disabled, error, inline, invalid, placeholder,
|
|
2742
|
+
const { align, description, disabled, error, inline, invalid, placeholder, readOnly, showMiniLabel = true, size, minValue, maxValue } = props, ariaNumberFieldProps = __rest(props, ["align", "description", "disabled", "error", "inline", "invalid", "placeholder", "readOnly", "showMiniLabel", "size", "minValue", "maxValue"]);
|
|
2743
|
+
const dataAttrs = filterDataAttributes(props);
|
|
2742
2744
|
const stringDescription = typeof description === "string";
|
|
2743
|
-
return (React__default.createElement($b91743d66a0ed188$export$63c5fa0b2fdccd2e, Object.assign({}, ariaNumberFieldProps, { className: classnames(styles.container, inline && styles.inline), formatOptions: mergedFormatOptions, isDisabled: disabled, isInvalid: invalid, isReadOnly:
|
|
2745
|
+
return (React__default.createElement($b91743d66a0ed188$export$63c5fa0b2fdccd2e, Object.assign({}, ariaNumberFieldProps, { className: classnames(styles.container, inline && styles.inline), formatOptions: mergedFormatOptions, isDisabled: disabled, isInvalid: invalid, isReadOnly: readOnly, minValue: minValue, maxValue: maxValue, onBlur: e => { var _a; return (_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e); }, onFocus: e => { var _a; return (_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, e); }, onChange: handleChange }),
|
|
2744
2746
|
React__default.createElement($a049562f99e7db0e$export$eb2fcfdbd7ba97d4, { className: classnames(styles.wrapper, align && styles[align], invalid && styles.invalid, disabled && styles.disabled) },
|
|
2745
2747
|
React__default.createElement("div", { className: styles.horizontalWrapper },
|
|
2746
2748
|
React__default.createElement("div", { className: classnames(styles.inputWrapper, disabled && styles.disabled, !showMiniLabel && styles.hideLabel, size && styles[size]) },
|
|
2747
|
-
React__default.createElement($3985021b0ad6602f$export$f5b8910cec6cf069, { className: styles.input, placeholder: " " // used for CSS minilabel
|
|
2748
|
-
, ref: inputRef }),
|
|
2749
|
+
React__default.createElement($3985021b0ad6602f$export$f5b8910cec6cf069, Object.assign({ className: styles.input, placeholder: " " // used for CSS minilabel
|
|
2750
|
+
, ref: inputRef }, dataAttrs)),
|
|
2749
2751
|
React__default.createElement($01b77f81d0f07f68$export$b04be29aa201d4f5, { className: styles.label }, placeholder)))),
|
|
2750
2752
|
description && (React__default.createElement($514c0188e459b4c0$export$5f1af8db9871e1d6, { className: styles.description, elementType: "div", slot: "description" }, stringDescription ? (React__default.createElement(Text, { size: "small", variation: "subdued" }, description)) : (description))),
|
|
2751
2753
|
error && (React__default.createElement($ee014567cb39d3f0$export$f551688fc98f2e09, { className: styles.fieldError },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Clearable } from "@jobber/hooks";
|
|
2
1
|
import type { InputMaskProps } from "./InputMask";
|
|
3
2
|
import type { CommonFormFieldProps, FormFieldProps } from "../FormField";
|
|
3
|
+
import type { FocusEvents, HTMLInputBaseProps, KeyboardEvents, RebuiltInputCommonProps } from "../sharedHelpers/types";
|
|
4
4
|
export interface InputPhoneNumberLegacyProps extends Omit<CommonFormFieldProps, "align">, Pick<FormFieldProps, "autocomplete" | "onEnter" | "onFocus" | "onBlur" | "validations" | "readonly" | "prefix" | "suffix"> {
|
|
5
5
|
readonly value: string;
|
|
6
6
|
readonly onChange: (value: string) => void;
|
|
@@ -16,20 +16,19 @@ export interface InputPhoneNumberLegacyProps extends Omit<CommonFormFieldProps,
|
|
|
16
16
|
*/
|
|
17
17
|
readonly required?: boolean;
|
|
18
18
|
}
|
|
19
|
-
export interface InputPhoneNumberRebuiltProps extends Omit<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
readonly autocomplete?: boolean | string;
|
|
24
|
-
readonly loading?: boolean;
|
|
25
|
-
readonly onKeyUp?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
26
|
-
readonly children?: React.ReactNode;
|
|
27
|
-
readonly clearable?: Clearable;
|
|
19
|
+
export interface InputPhoneNumberRebuiltProps extends Omit<HTMLInputBaseProps, "type" | "maxLength" | "minLength">, FocusEvents<HTMLInputElement>, KeyboardEvents<HTMLInputElement>, RebuiltInputCommonProps {
|
|
20
|
+
/**
|
|
21
|
+
* The current value of the input.
|
|
22
|
+
*/
|
|
28
23
|
readonly value: string;
|
|
24
|
+
/**
|
|
25
|
+
* Custom onChange handler that provides the new value as the first argument.
|
|
26
|
+
*/
|
|
29
27
|
readonly onChange: (value: string, event?: React.ChangeEvent<HTMLInputElement>) => void;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Use `onKeyDown` or `onKeyUp` instead.
|
|
30
|
+
*/
|
|
31
|
+
readonly onEnter?: FormFieldProps["onEnter"];
|
|
33
32
|
/**
|
|
34
33
|
* A pattern to specify the format to display the phone number in.
|
|
35
34
|
* For example if you want to display the format for [Denmark](https://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers#Denmark)
|
|
@@ -37,20 +36,5 @@ export interface InputPhoneNumberRebuiltProps extends Omit<React.InputHTMLAttrib
|
|
|
37
36
|
* @default "(***) ***-****"
|
|
38
37
|
*/
|
|
39
38
|
readonly pattern?: InputMaskProps["pattern"];
|
|
40
|
-
/**
|
|
41
|
-
* Shows a "required" validation message when the component is left empty.
|
|
42
|
-
*/
|
|
43
|
-
readonly required?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Version 2 is highly experimental, avoid using it unless you have talked with Atlantis first.
|
|
46
|
-
*/
|
|
47
|
-
readonly version: 2;
|
|
48
|
-
readonly size?: FormFieldProps["size"];
|
|
49
|
-
readonly inline?: FormFieldProps["inline"];
|
|
50
|
-
readonly align?: FormFieldProps["align"];
|
|
51
|
-
readonly prefix?: FormFieldProps["prefix"];
|
|
52
|
-
readonly suffix?: FormFieldProps["suffix"];
|
|
53
|
-
readonly description?: FormFieldProps["description"];
|
|
54
|
-
readonly readonly?: boolean;
|
|
55
39
|
}
|
|
56
40
|
export declare const DEFAULT_PATTERN = "(***) ***-****";
|
|
@@ -11,6 +11,6 @@ export declare function useInputPhoneActions({ onChange, inputRef, onFocus, onBl
|
|
|
11
11
|
handleClear: () => void;
|
|
12
12
|
handleChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
13
13
|
handleFocus: (event: FocusEvent<HTMLInputElement>) => void;
|
|
14
|
-
handleBlur: (event
|
|
14
|
+
handleBlur: (event: FocusEvent<HTMLInputElement>) => void;
|
|
15
15
|
handleKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
16
16
|
};
|
|
@@ -7,6 +7,7 @@ var FormField = require('../FormField-cjs.js');
|
|
|
7
7
|
var reactHookForm = require('react-hook-form');
|
|
8
8
|
require('../Button-cjs.js');
|
|
9
9
|
require('@jobber/design');
|
|
10
|
+
var filterDataAttributes = require('../filterDataAttributes-cjs.js');
|
|
10
11
|
require('@jobber/hooks');
|
|
11
12
|
require('framer-motion');
|
|
12
13
|
require('../Icon-cjs.js');
|
|
@@ -115,7 +116,6 @@ const DEFAULT_PATTERN = "(***) ***-****";
|
|
|
115
116
|
function useInputPhoneActions({ onChange, inputRef, onFocus, onBlur, onKeyDown, onEnter, }) {
|
|
116
117
|
function handleClear() {
|
|
117
118
|
var _a;
|
|
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,26 +149,22 @@ 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
|
-
|
|
166
152
|
const InputPhoneNumberRebuilt = React.forwardRef(function InputPhoneNumberInternal(_a, ref) {
|
|
167
153
|
var _b, _c, _d, _e;
|
|
168
154
|
var { pattern = DEFAULT_PATTERN } = _a, props = tslib_es6.__rest(_a, ["pattern"]);
|
|
169
155
|
const inputPhoneNumberRef = (_b = ref) !== null && _b !== void 0 ? _b : React.useRef(null);
|
|
170
156
|
const wrapperRef = React.useRef(null);
|
|
171
|
-
const { inputStyle } = FormField.useFormFieldWrapperStyles(
|
|
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
|
+
disabled: props.disabled,
|
|
165
|
+
inline: props.inline,
|
|
166
|
+
type: "tel",
|
|
167
|
+
});
|
|
172
168
|
const generatedId = React.useId();
|
|
173
169
|
const id = props.id || generatedId;
|
|
174
170
|
const { name } = FormField.useAtlantisFormFieldName({
|
|
@@ -188,25 +184,15 @@ const InputPhoneNumberRebuilt = React.forwardRef(function InputPhoneNumberIntern
|
|
|
188
184
|
onEnter: props.onEnter,
|
|
189
185
|
inputRef: inputPhoneNumberRef,
|
|
190
186
|
});
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
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, {
|
|
187
|
+
const descriptionIdentifier = `descriptionUUID--${id}`, descriptionVisible = props.description && !props.inline;
|
|
188
|
+
const isInvalid = Boolean(props.error || props.invalid);
|
|
189
|
+
const dataAttrs = filterDataAttributes.filterDataAttributes(props);
|
|
190
|
+
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 },
|
|
191
|
+
React.createElement("input", Object.assign({ id: id, name: name, type: "tel", ref: inputPhoneNumberRef, className: classnames(inputStyle, {
|
|
208
192
|
[styles.emptyValue]: inputValue.length === 0 && pattern[0] === "(",
|
|
209
|
-
}), value: formattedValue
|
|
193
|
+
}), value: formattedValue, disabled: props.disabled, readOnly: props.readOnly, autoFocus: props.autoFocus, autoComplete: props.autoComplete, inputMode: props.inputMode, tabIndex: props.tabIndex, role: props.role, "aria-label": props["aria-label"], "aria-describedby": descriptionVisible
|
|
194
|
+
? descriptionIdentifier
|
|
195
|
+
: props["aria-describedby"], "aria-invalid": isInvalid ? true : undefined, "aria-controls": props["aria-controls"], "aria-expanded": props["aria-expanded"], "aria-activedescendant": props["aria-activedescendant"], "aria-autocomplete": props["aria-autocomplete"], "aria-required": props["aria-required"], onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown }, dataAttrs)),
|
|
210
196
|
React.createElement(MaskElement, { isMasking: isMasking, formattedValue: formattedValue, placeholderMask: placeholderMask }),
|
|
211
197
|
React.createElement(FormField.FormFieldPostFix, { variation: "spinner", visible: (_e = props.loading) !== null && _e !== void 0 ? _e : false })));
|
|
212
198
|
});
|
|
@@ -5,6 +5,7 @@ import { j as useFormFieldWrapperStyles, b as useAtlantisFormFieldName, f as For
|
|
|
5
5
|
import { useFormContext, useForm } from 'react-hook-form';
|
|
6
6
|
import '../Button-es.js';
|
|
7
7
|
import '@jobber/design';
|
|
8
|
+
import { f as filterDataAttributes } from '../filterDataAttributes-es.js';
|
|
8
9
|
import '@jobber/hooks';
|
|
9
10
|
import 'framer-motion';
|
|
10
11
|
import '../Icon-es.js';
|
|
@@ -113,7 +114,6 @@ const DEFAULT_PATTERN = "(***) ***-****";
|
|
|
113
114
|
function useInputPhoneActions({ onChange, inputRef, onFocus, onBlur, onKeyDown, onEnter, }) {
|
|
114
115
|
function handleClear() {
|
|
115
116
|
var _a;
|
|
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,26 +147,22 @@ 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
|
-
|
|
164
150
|
const InputPhoneNumberRebuilt = forwardRef(function InputPhoneNumberInternal(_a, ref) {
|
|
165
151
|
var _b, _c, _d, _e;
|
|
166
152
|
var { pattern = DEFAULT_PATTERN } = _a, props = __rest(_a, ["pattern"]);
|
|
167
153
|
const inputPhoneNumberRef = (_b = ref) !== null && _b !== void 0 ? _b : React__default.useRef(null);
|
|
168
154
|
const wrapperRef = React__default.useRef(null);
|
|
169
|
-
const { inputStyle } = useFormFieldWrapperStyles(
|
|
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
|
+
disabled: props.disabled,
|
|
163
|
+
inline: props.inline,
|
|
164
|
+
type: "tel",
|
|
165
|
+
});
|
|
170
166
|
const generatedId = useId();
|
|
171
167
|
const id = props.id || generatedId;
|
|
172
168
|
const { name } = useAtlantisFormFieldName({
|
|
@@ -186,25 +182,15 @@ const InputPhoneNumberRebuilt = forwardRef(function InputPhoneNumberInternal(_a,
|
|
|
186
182
|
onEnter: props.onEnter,
|
|
187
183
|
inputRef: inputPhoneNumberRef,
|
|
188
184
|
});
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
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, {
|
|
185
|
+
const descriptionIdentifier = `descriptionUUID--${id}`, descriptionVisible = props.description && !props.inline;
|
|
186
|
+
const isInvalid = Boolean(props.error || props.invalid);
|
|
187
|
+
const dataAttrs = filterDataAttributes(props);
|
|
188
|
+
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 },
|
|
189
|
+
React__default.createElement("input", Object.assign({ id: id, name: name, type: "tel", ref: inputPhoneNumberRef, className: classnames(inputStyle, {
|
|
206
190
|
[styles.emptyValue]: inputValue.length === 0 && pattern[0] === "(",
|
|
207
|
-
}), value: formattedValue
|
|
191
|
+
}), value: formattedValue, disabled: props.disabled, readOnly: props.readOnly, autoFocus: props.autoFocus, autoComplete: props.autoComplete, inputMode: props.inputMode, tabIndex: props.tabIndex, role: props.role, "aria-label": props["aria-label"], "aria-describedby": descriptionVisible
|
|
192
|
+
? descriptionIdentifier
|
|
193
|
+
: props["aria-describedby"], "aria-invalid": isInvalid ? true : undefined, "aria-controls": props["aria-controls"], "aria-expanded": props["aria-expanded"], "aria-activedescendant": props["aria-activedescendant"], "aria-autocomplete": props["aria-autocomplete"], "aria-required": props["aria-required"], onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown }, dataAttrs)),
|
|
208
194
|
React__default.createElement(MaskElement, { isMasking: isMasking, formattedValue: formattedValue, placeholderMask: placeholderMask }),
|
|
209
195
|
React__default.createElement(FormFieldPostFix, { variation: "spinner", visible: (_e = props.loading) !== null && _e !== void 0 ? _e : false })));
|
|
210
196
|
});
|
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
import type { Clearable } from "@jobber/hooks";
|
|
2
1
|
import type { XOR } from "ts-xor";
|
|
3
|
-
import type {
|
|
2
|
+
import type { CommonFormFieldProps, FormFieldProps } from "../FormField";
|
|
3
|
+
import type { FocusEvents, HTMLInputBaseProps, KeyboardEvents, RebuiltInputCommonProps } from "../sharedHelpers/types";
|
|
4
4
|
export interface RowRange {
|
|
5
5
|
min: number;
|
|
6
6
|
max: number;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Character length constraint for inputs.
|
|
10
|
+
* Only extend this for text-based inputs where character limits make sense.
|
|
11
|
+
*/
|
|
12
|
+
interface InputLengthConstraint {
|
|
13
|
+
/**
|
|
14
|
+
* Maximum character length for the input.
|
|
15
|
+
* Note: This affects both HTML validation AND visual width of the component.
|
|
16
|
+
* Future work will separate these concerns.
|
|
17
|
+
*/
|
|
18
|
+
readonly maxLength?: number;
|
|
19
|
+
}
|
|
8
20
|
export type InputTextVersion = 1 | 2 | undefined;
|
|
9
21
|
/**
|
|
10
22
|
* Experimental version 2 of the InputText component.
|
|
11
23
|
* Do not use unless you have talked with Atlantis first.
|
|
12
24
|
*/
|
|
13
|
-
export interface InputTextRebuiltProps extends
|
|
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;
|
|
25
|
+
export interface InputTextRebuiltProps extends HTMLInputBaseProps, FocusEvents<HTMLInputElement | HTMLTextAreaElement>, KeyboardEvents<HTMLInputElement | HTMLTextAreaElement>, RebuiltInputCommonProps, InputLengthConstraint {
|
|
22
26
|
/**
|
|
23
27
|
* Use this when you're expecting a long answer.
|
|
24
28
|
*/
|
|
@@ -30,24 +34,26 @@ export interface InputTextRebuiltProps extends Omit<React.InputHTMLAttributes<HT
|
|
|
30
34
|
* maximum number of visible rows.
|
|
31
35
|
*/
|
|
32
36
|
readonly rows?: number | RowRange;
|
|
33
|
-
readonly type?: FormFieldTypes;
|
|
34
37
|
/**
|
|
35
|
-
*
|
|
38
|
+
* Toolbar to render content below the input.
|
|
36
39
|
*/
|
|
37
|
-
readonly version: 2;
|
|
38
|
-
readonly onChange?: (newValue: string, event?: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
39
|
-
readonly onEnter?: FormFieldProps["onEnter"];
|
|
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
40
|
readonly toolbar?: FormFieldProps["toolbar"];
|
|
41
|
+
/**
|
|
42
|
+
* Determines the visibility of the toolbar.
|
|
43
|
+
*/
|
|
47
44
|
readonly toolbarVisibility?: FormFieldProps["toolbarVisibility"];
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
/**
|
|
46
|
+
* The current value of the input.
|
|
47
|
+
*/
|
|
48
|
+
readonly value: string;
|
|
49
|
+
/**
|
|
50
|
+
* Custom onChange handler that provides the new value as the first argument.
|
|
51
|
+
*/
|
|
52
|
+
readonly onChange?: (newValue: string, event?: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated Use `onKeyDown` or `onKeyUp` instead.
|
|
55
|
+
*/
|
|
56
|
+
readonly onEnter?: FormFieldProps["onEnter"];
|
|
51
57
|
}
|
|
52
58
|
interface BaseProps extends CommonFormFieldProps, Pick<FormFieldProps, "autofocus" | "maxLength" | "readonly" | "autocomplete" | "keyboard" | "onEnter" | "onFocus" | "onBlur" | "onChange" | "inputRef" | "validations" | "defaultValue" | "prefix" | "suffix" | "toolbar" | "toolbarVisibility" | "version"> {
|
|
53
59
|
multiline?: boolean;
|