@jobber/components 6.103.2-JOB-140609-9051081.26 → 6.103.2-JOB-141426-1b49367.0
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 +24 -3
- package/dist/Autocomplete/index.mjs +24 -3
- package/dist/Autocomplete/useAutocomplete.d.ts +1 -0
- 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 +1 -0
- package/dist/FormField-es.js +1 -1
- 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 +2 -5
- package/dist/InputNumber/index.mjs +2 -5
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChangeEvent, ReactNode, RefObject } from "react";
|
|
2
2
|
import type React from "react";
|
|
3
3
|
import type { RegisterOptions } from "react-hook-form";
|
|
4
4
|
import type { XOR } from "ts-xor";
|
|
@@ -7,222 +7,6 @@ import type { IconNames } from "../Icon";
|
|
|
7
7
|
export type FormFieldTypes = "text" | "password" | "number" | "time" | "textarea" | "select" | "tel" | "email";
|
|
8
8
|
export type KeyBoardTypes = "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal";
|
|
9
9
|
export type AutocompleteTypes = "one-time-code" | "address-line1" | "address-line2";
|
|
10
|
-
/**
|
|
11
|
-
* Core ARIA attributes for input elements.
|
|
12
|
-
* Uses camelCase naming for consistency with React props pattern.
|
|
13
|
-
* Based on React's canonical ARIA type definitions.
|
|
14
|
-
*/
|
|
15
|
-
export interface AriaInputProps {
|
|
16
|
-
/**
|
|
17
|
-
* Defines a string value that labels the current element.
|
|
18
|
-
* @see {@link https://www.w3.org/TR/wai-aria-1.2/#aria-label}
|
|
19
|
-
*/
|
|
20
|
-
readonly ariaLabel?: AriaAttributes["aria-label"];
|
|
21
|
-
/**
|
|
22
|
-
* Identifies the element (or elements) that labels the current element.
|
|
23
|
-
* @see {@link https://www.w3.org/TR/wai-aria-1.2/#aria-labelledby}
|
|
24
|
-
*/
|
|
25
|
-
readonly ariaLabelledBy?: AriaAttributes["aria-labelledby"];
|
|
26
|
-
/**
|
|
27
|
-
* Identifies the element (or elements) that describes the object.
|
|
28
|
-
* @see {@link https://www.w3.org/TR/wai-aria-1.2/#aria-describedby}
|
|
29
|
-
*/
|
|
30
|
-
readonly ariaDescribedBy?: AriaAttributes["aria-describedby"];
|
|
31
|
-
/**
|
|
32
|
-
* Identifies the element (or elements) that provide a detailed, extended description.
|
|
33
|
-
* @see {@link https://www.w3.org/TR/wai-aria-1.2/#aria-details}
|
|
34
|
-
*/
|
|
35
|
-
readonly ariaDetails?: AriaAttributes["aria-details"];
|
|
36
|
-
/**
|
|
37
|
-
* ID of the currently active descendant element.
|
|
38
|
-
* Used for composite widgets like combobox or listbox.
|
|
39
|
-
* @see {@link https://www.w3.org/TR/wai-aria-1.2/#aria-activedescendant}
|
|
40
|
-
*/
|
|
41
|
-
readonly ariaActiveDescendant?: AriaAttributes["aria-activedescendant"];
|
|
42
|
-
/**
|
|
43
|
-
* Indicates the entered value does not conform to the format expected.
|
|
44
|
-
* Supports boolean or specific error types: "grammar" | "spelling".
|
|
45
|
-
* @see {@link https://www.w3.org/TR/wai-aria-1.2/#aria-invalid}
|
|
46
|
-
*/
|
|
47
|
-
readonly ariaInvalid?: AriaAttributes["aria-invalid"];
|
|
48
|
-
/**
|
|
49
|
-
* Indicates the element that controls the current element.
|
|
50
|
-
* @see {@link https://www.w3.org/TR/wai-aria-1.2/#aria-controls}
|
|
51
|
-
*/
|
|
52
|
-
readonly ariaControls?: AriaAttributes["aria-controls"];
|
|
53
|
-
/**
|
|
54
|
-
* Indicates whether the element is expanded or collapsed.
|
|
55
|
-
* @see {@link https://www.w3.org/TR/wai-aria-1.2/#aria-expanded}
|
|
56
|
-
*/
|
|
57
|
-
readonly ariaExpanded?: AriaAttributes["aria-expanded"];
|
|
58
|
-
/**
|
|
59
|
-
* Indicates the type of autocomplete interaction.
|
|
60
|
-
* @see {@link https://www.w3.org/TR/wai-aria-1.2/#aria-autocomplete}
|
|
61
|
-
*/
|
|
62
|
-
readonly ariaAutocomplete?: AriaAttributes["aria-autocomplete"];
|
|
63
|
-
/**
|
|
64
|
-
* Indicates that user input is required before form submission.
|
|
65
|
-
* @see {@link https://www.w3.org/TR/wai-aria-1.2/#aria-required}
|
|
66
|
-
*/
|
|
67
|
-
readonly ariaRequired?: AriaAttributes["aria-required"];
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Focus event handlers for input elements.
|
|
71
|
-
* Generic interface that can be specialized for different element types.
|
|
72
|
-
*/
|
|
73
|
-
export interface FocusEvents<Target = HTMLElement> {
|
|
74
|
-
/**
|
|
75
|
-
* Focus event handler.
|
|
76
|
-
*/
|
|
77
|
-
readonly onFocus?: (event: React.FocusEvent<Target>) => void;
|
|
78
|
-
/**
|
|
79
|
-
* Blur event handler.
|
|
80
|
-
*/
|
|
81
|
-
readonly onBlur?: (event: React.FocusEvent<Target>) => void;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Keyboard event handlers for input elements.
|
|
85
|
-
* Generic interface that can be specialized for different element types.
|
|
86
|
-
*/
|
|
87
|
-
export interface KeyboardEvents<Target = HTMLElement> {
|
|
88
|
-
/**
|
|
89
|
-
* Key down event handler.
|
|
90
|
-
*/
|
|
91
|
-
readonly onKeyDown?: (event: React.KeyboardEvent<Target>) => void;
|
|
92
|
-
/**
|
|
93
|
-
* Key up event handler.
|
|
94
|
-
*/
|
|
95
|
-
readonly onKeyUp?: (event: React.KeyboardEvent<Target>) => void;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Curated set of HTML input attributes for rebuilt input components.
|
|
99
|
-
* This provides a whitelist of standard HTML/React props we want to support,
|
|
100
|
-
* avoiding the issues of extending React.InputHTMLAttributes directly.
|
|
101
|
-
* Note: Event handlers and ARIA attributes are separate - use FocusEvents, KeyboardEvents, and AriaInputProps.
|
|
102
|
-
*/
|
|
103
|
-
export interface HTMLInputBaseProps extends AriaInputProps {
|
|
104
|
-
/**
|
|
105
|
-
* The unique identifier for the input element.
|
|
106
|
-
*/
|
|
107
|
-
readonly id?: string;
|
|
108
|
-
/**
|
|
109
|
-
* The name attribute for the input element.
|
|
110
|
-
*/
|
|
111
|
-
readonly name?: string;
|
|
112
|
-
/**
|
|
113
|
-
* Placeholder text that appears when the input is empty.
|
|
114
|
-
*/
|
|
115
|
-
readonly placeholder?: string;
|
|
116
|
-
/**
|
|
117
|
-
* Whether the input is disabled.
|
|
118
|
-
*/
|
|
119
|
-
readonly disabled?: boolean;
|
|
120
|
-
/**
|
|
121
|
-
* Whether the input is required.
|
|
122
|
-
*/
|
|
123
|
-
readonly required?: boolean;
|
|
124
|
-
/**
|
|
125
|
-
* Whether the input is read-only (HTML standard casing).
|
|
126
|
-
*/
|
|
127
|
-
readonly readOnly?: boolean;
|
|
128
|
-
/**
|
|
129
|
-
* Whether the input should be auto-focused (React casing).
|
|
130
|
-
*/
|
|
131
|
-
readonly autoFocus?: boolean;
|
|
132
|
-
/**
|
|
133
|
-
* Autocomplete behavior for the input (React casing, string values only).
|
|
134
|
-
* Use standard HTML autocomplete values or "on"/"off".
|
|
135
|
-
*/
|
|
136
|
-
readonly autoComplete?: string;
|
|
137
|
-
/**
|
|
138
|
-
* Maximum character length for the input (HTML validation only).
|
|
139
|
-
* Note: In v2, this does NOT affect the visual width of the component.
|
|
140
|
-
* Use CSS or the size prop for width control.
|
|
141
|
-
*/
|
|
142
|
-
readonly maxLength?: number;
|
|
143
|
-
/**
|
|
144
|
-
* Minimum character length for the input.
|
|
145
|
-
*/
|
|
146
|
-
readonly minLength?: number;
|
|
147
|
-
/**
|
|
148
|
-
* Maximum numerical value (for number inputs).
|
|
149
|
-
*/
|
|
150
|
-
readonly max?: number | string;
|
|
151
|
-
/**
|
|
152
|
-
* Minimum numerical value (for number inputs).
|
|
153
|
-
*/
|
|
154
|
-
readonly min?: number | string;
|
|
155
|
-
/**
|
|
156
|
-
* Validation pattern (regex) for the input.
|
|
157
|
-
*/
|
|
158
|
-
readonly pattern?: string;
|
|
159
|
-
/**
|
|
160
|
-
* Input mode hint for virtual keyboards.
|
|
161
|
-
*/
|
|
162
|
-
readonly inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search";
|
|
163
|
-
/**
|
|
164
|
-
* Role attribute for accessibility.
|
|
165
|
-
*/
|
|
166
|
-
readonly role?: string;
|
|
167
|
-
/**
|
|
168
|
-
* Tab index for keyboard navigation.
|
|
169
|
-
*/
|
|
170
|
-
readonly tabIndex?: number;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Common props shared across all rebuilt input components.
|
|
174
|
-
* These are Atlantis-specific features not part of standard HTML inputs.
|
|
175
|
-
*/
|
|
176
|
-
export interface RebuiltInputCommonProps {
|
|
177
|
-
/**
|
|
178
|
-
* Error message to display. This also highlights the field red.
|
|
179
|
-
*/
|
|
180
|
-
readonly error?: string;
|
|
181
|
-
/**
|
|
182
|
-
* Highlights the field red to indicate an error.
|
|
183
|
-
*/
|
|
184
|
-
readonly invalid?: boolean;
|
|
185
|
-
/**
|
|
186
|
-
* Show a spinner to indicate loading.
|
|
187
|
-
*/
|
|
188
|
-
readonly loading?: boolean;
|
|
189
|
-
/**
|
|
190
|
-
* Add a clear action on the input that clears the value.
|
|
191
|
-
*/
|
|
192
|
-
readonly clearable?: Clearable;
|
|
193
|
-
/**
|
|
194
|
-
* Adjusts the interface to either have small or large spacing.
|
|
195
|
-
*/
|
|
196
|
-
readonly size?: "small" | "large";
|
|
197
|
-
/**
|
|
198
|
-
* Adjusts the form field to go inline with content.
|
|
199
|
-
*/
|
|
200
|
-
readonly inline?: boolean;
|
|
201
|
-
/**
|
|
202
|
-
* Determines the alignment of the text inside the input.
|
|
203
|
-
*/
|
|
204
|
-
readonly align?: "center" | "right";
|
|
205
|
-
/**
|
|
206
|
-
* Adds a prefix label and icon to the field.
|
|
207
|
-
*/
|
|
208
|
-
readonly prefix?: Affix;
|
|
209
|
-
/**
|
|
210
|
-
* Adds a suffix label and icon with an optional action to the field.
|
|
211
|
-
*/
|
|
212
|
-
readonly suffix?: XOR<Affix, Suffix>;
|
|
213
|
-
/**
|
|
214
|
-
* Further description of the input, can be used for a hint.
|
|
215
|
-
*/
|
|
216
|
-
readonly description?: ReactNode;
|
|
217
|
-
/**
|
|
218
|
-
* Children elements to render inside the component.
|
|
219
|
-
*/
|
|
220
|
-
readonly children?: ReactNode;
|
|
221
|
-
/**
|
|
222
|
-
* Version 2 is highly experimental. Avoid using it unless you have talked with Atlantis first.
|
|
223
|
-
*/
|
|
224
|
-
readonly version: 2;
|
|
225
|
-
}
|
|
226
10
|
export interface FieldActionsRef {
|
|
227
11
|
setValue(value: string | number): void;
|
|
228
12
|
}
|
package/dist/FormField-cjs.js
CHANGED
|
@@ -467,6 +467,7 @@ exports.FormFieldWrapper = FormFieldWrapper;
|
|
|
467
467
|
exports.FormFieldWrapperMain = FormFieldWrapperMain;
|
|
468
468
|
exports.FormFieldWrapperToolbar = FormFieldWrapperToolbar;
|
|
469
469
|
exports.mergeRefs = mergeRefs;
|
|
470
|
+
exports.styles = styles$1;
|
|
470
471
|
exports.useAtlantisFormField = useAtlantisFormField;
|
|
471
472
|
exports.useAtlantisFormFieldActions = useAtlantisFormFieldActions;
|
|
472
473
|
exports.useAtlantisFormFieldName = useAtlantisFormFieldName;
|
package/dist/FormField-es.js
CHANGED
|
@@ -454,4 +454,4 @@ function setAutocomplete(autocompleteSetting) {
|
|
|
454
454
|
return autocompleteSetting;
|
|
455
455
|
}
|
|
456
456
|
|
|
457
|
-
export { AffixIcon as A, FormFieldInputHorizontalWrapper as F, useAtlantisFormFieldActions as a, useAtlantisFormFieldName as b, useAtlantisReactHookForm as c, FormFieldInputWrapperStyles as d, FormFieldLabel as e, FormFieldWrapper as f, FormFieldWrapperMain as g, FormFieldWrapperToolbar as h, AffixLabel as i, useFormFieldWrapperStyles as j, FormField as k, FormFieldPostFix as l, mergeRefs as m, useAtlantisFormField as u };
|
|
457
|
+
export { AffixIcon as A, FormFieldInputHorizontalWrapper as F, useAtlantisFormFieldActions as a, useAtlantisFormFieldName as b, useAtlantisReactHookForm as c, FormFieldInputWrapperStyles as d, FormFieldLabel as e, FormFieldWrapper as f, FormFieldWrapperMain as g, FormFieldWrapperToolbar as h, AffixLabel as i, useFormFieldWrapperStyles as j, FormField as k, FormFieldPostFix as l, mergeRefs as m, styles$1 as s, useAtlantisFormField as u };
|
package/dist/InputDate/index.cjs
CHANGED
|
@@ -13,12 +13,12 @@ require('../Button-cjs.js');
|
|
|
13
13
|
var DatePicker = require('../DatePicker-cjs.js');
|
|
14
14
|
var InputText_index = require('../InputText/index.cjs');
|
|
15
15
|
require('../_commonjsHelpers-cjs.js');
|
|
16
|
-
require('../
|
|
16
|
+
require('../_baseGet-cjs.js');
|
|
17
17
|
require('../isTypedArray-cjs.js');
|
|
18
18
|
require('../isObjectLike-cjs.js');
|
|
19
|
-
require('../isSymbol-cjs.js');
|
|
20
19
|
require('../identity-cjs.js');
|
|
21
20
|
require('../_getTag-cjs.js');
|
|
21
|
+
require('../isSymbol-cjs.js');
|
|
22
22
|
require('../keysIn-cjs.js');
|
|
23
23
|
require('../_baseAssignValue-cjs.js');
|
|
24
24
|
require('../_baseFlatten-cjs.js');
|
|
@@ -89,16 +89,12 @@ function useInputDateActivatorActions({ onChange, onBlur, onFocus, }) {
|
|
|
89
89
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
90
90
|
}
|
|
91
91
|
function handleFocus(event) {
|
|
92
|
-
|
|
93
|
-
onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
|
|
94
|
-
}
|
|
92
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
|
|
95
93
|
setIsFocused(true);
|
|
96
94
|
}
|
|
97
95
|
function handleBlur(event) {
|
|
98
96
|
setIsFocused(false);
|
|
99
|
-
|
|
100
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
101
|
-
}
|
|
97
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
102
98
|
}
|
|
103
99
|
return {
|
|
104
100
|
handleBlur,
|
package/dist/InputDate/index.mjs
CHANGED
|
@@ -11,12 +11,12 @@ import '../Button-es.js';
|
|
|
11
11
|
import { D as DatePicker } from '../DatePicker-es.js';
|
|
12
12
|
import { InputText } from '../InputText/index.mjs';
|
|
13
13
|
import '../_commonjsHelpers-es.js';
|
|
14
|
-
import '../
|
|
14
|
+
import '../_baseGet-es.js';
|
|
15
15
|
import '../isTypedArray-es.js';
|
|
16
16
|
import '../isObjectLike-es.js';
|
|
17
|
-
import '../isSymbol-es.js';
|
|
18
17
|
import '../identity-es.js';
|
|
19
18
|
import '../_getTag-es.js';
|
|
19
|
+
import '../isSymbol-es.js';
|
|
20
20
|
import '../keysIn-es.js';
|
|
21
21
|
import '../_baseAssignValue-es.js';
|
|
22
22
|
import '../_baseFlatten-es.js';
|
|
@@ -87,16 +87,12 @@ function useInputDateActivatorActions({ onChange, onBlur, onFocus, }) {
|
|
|
87
87
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
88
88
|
}
|
|
89
89
|
function handleFocus(event) {
|
|
90
|
-
|
|
91
|
-
onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
|
|
92
|
-
}
|
|
90
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
|
|
93
91
|
setIsFocused(true);
|
|
94
92
|
}
|
|
95
93
|
function handleBlur(event) {
|
|
96
94
|
setIsFocused(false);
|
|
97
|
-
|
|
98
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
99
|
-
}
|
|
95
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
100
96
|
}
|
|
101
97
|
return {
|
|
102
98
|
handleBlur,
|
|
@@ -9,8 +9,8 @@ export interface useInputDateActivatorActionsProps extends Pick<InputDateRebuilt
|
|
|
9
9
|
* 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.
|
|
10
10
|
*/
|
|
11
11
|
export declare function useInputDateActivatorActions({ onChange, onBlur, onFocus, }: useInputDateActivatorActionsProps): {
|
|
12
|
-
handleBlur: (event
|
|
12
|
+
handleBlur: (event: FocusEvent<HTMLInputElement>) => void;
|
|
13
13
|
handleChange: (_: unknown, event?: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
14
|
-
handleFocus: (event
|
|
14
|
+
handleFocus: (event: FocusEvent<HTMLInputElement>) => void;
|
|
15
15
|
isFocused: boolean;
|
|
16
16
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Clearable } from "@jobber/hooks";
|
|
2
|
+
import type { CommonFormFieldProps, FormFieldProps } from "../FormField";
|
|
2
3
|
export type InputEmailLegacyProps = CommonFormFieldProps & Pick<FormFieldProps, "maxLength" | "readonly" | "validations" | "defaultValue">;
|
|
3
4
|
export declare const validationMessage = "Please enter a valid email";
|
|
4
5
|
export type InputEmailVersion = 1 | 2 | undefined;
|
|
@@ -6,23 +7,27 @@ export type InputEmailVersion = 1 | 2 | undefined;
|
|
|
6
7
|
* Experimental version 2 of the InputEmail component.
|
|
7
8
|
* Do not use unless you have talked with Atlantis first.
|
|
8
9
|
*/
|
|
9
|
-
export interface InputEmailRebuiltProps extends
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
readonly
|
|
10
|
+
export interface InputEmailRebuiltProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "onBlur" | "size" | "suffix" | "prefix" | "value" | "max" | "min" | "defaultValue"> {
|
|
11
|
+
readonly error?: string;
|
|
12
|
+
readonly invalid?: boolean;
|
|
13
|
+
readonly identifier?: string;
|
|
14
|
+
readonly autocomplete?: boolean | string;
|
|
15
|
+
readonly loading?: boolean;
|
|
16
|
+
readonly onKeyUp?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
17
|
+
readonly children?: React.ReactNode;
|
|
18
|
+
readonly clearable?: Clearable;
|
|
14
19
|
/**
|
|
15
|
-
*
|
|
20
|
+
* Version 2 is highly experimental. Avoid using it unless you have talked with Atlantis first.
|
|
16
21
|
*/
|
|
22
|
+
readonly version: 2;
|
|
17
23
|
readonly onChange?: (newValue: string, event?: React.ChangeEvent<HTMLInputElement>) => void;
|
|
18
|
-
/**
|
|
19
|
-
* A callback to handle "Enter" keypress. This will only run
|
|
20
|
-
* if Enter is the only key. Will not run if Shift or Control
|
|
21
|
-
* are being held.
|
|
22
|
-
*/
|
|
23
24
|
readonly onEnter?: FormFieldProps["onEnter"];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
readonly
|
|
25
|
+
readonly onBlur?: FormFieldProps["onBlur"];
|
|
26
|
+
readonly value?: string;
|
|
27
|
+
readonly size?: FormFieldProps["size"];
|
|
28
|
+
readonly inline?: FormFieldProps["inline"];
|
|
29
|
+
readonly align?: FormFieldProps["align"];
|
|
30
|
+
readonly prefix?: FormFieldProps["prefix"];
|
|
31
|
+
readonly suffix?: FormFieldProps["suffix"];
|
|
32
|
+
readonly description?: FormFieldProps["description"];
|
|
28
33
|
}
|
|
@@ -8,5 +8,5 @@ export declare function useInputEmailActions({ onChange, inputRef, onEnter, onFo
|
|
|
8
8
|
handleChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
9
9
|
handleKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
10
10
|
handleFocus: (event: FocusEvent<HTMLInputElement>) => void;
|
|
11
|
-
handleBlur: (event
|
|
11
|
+
handleBlur: (event?: FocusEvent) => void;
|
|
12
12
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ChangeEvent, FocusEvent, KeyboardEvent, ReactNode } from "react";
|
|
2
|
+
export interface UseInputEmailFormFieldProps {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly disabled?: boolean;
|
|
6
|
+
readonly autofocus?: boolean;
|
|
7
|
+
readonly error?: string;
|
|
8
|
+
readonly inline?: boolean;
|
|
9
|
+
readonly description?: ReactNode;
|
|
10
|
+
readonly invalid?: boolean;
|
|
11
|
+
readonly value?: string;
|
|
12
|
+
readonly handleChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
13
|
+
readonly handleBlur: (event?: FocusEvent<HTMLInputElement>) => void;
|
|
14
|
+
readonly handleFocus: (event: FocusEvent<HTMLInputElement>) => void;
|
|
15
|
+
readonly handleKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
16
|
+
}
|
|
17
|
+
export interface UseInputEmailFormFieldReturn {
|
|
18
|
+
readonly fieldProps: {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly disabled?: boolean;
|
|
22
|
+
readonly autofocus?: boolean;
|
|
23
|
+
readonly onChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
24
|
+
readonly onBlur: (event?: FocusEvent<HTMLInputElement>) => void;
|
|
25
|
+
readonly onFocus: (event: FocusEvent<HTMLInputElement>) => void;
|
|
26
|
+
readonly onKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
27
|
+
readonly value?: string;
|
|
28
|
+
readonly "aria-describedby"?: string;
|
|
29
|
+
};
|
|
30
|
+
readonly descriptionIdentifier: string;
|
|
31
|
+
}
|
|
32
|
+
export declare function useInputEmailFormField({ id, name, disabled, autofocus, description, inline, value, handleChange, handleBlur, handleFocus, handleKeyDown, error, ...rest }: UseInputEmailFormFieldProps): UseInputEmailFormFieldReturn;
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var FormField = require('../FormField-cjs.js');
|
|
5
5
|
require('classnames');
|
|
6
|
-
require('../tslib.es6-cjs.js');
|
|
6
|
+
var tslib_es6 = require('../tslib.es6-cjs.js');
|
|
7
7
|
require('react-hook-form');
|
|
8
8
|
require('@jobber/hooks');
|
|
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
|
const validationMessage = "Please enter a valid email";
|
|
21
33
|
|
|
@@ -37,7 +49,7 @@ function InputEmail$1(props) {
|
|
|
37
49
|
function useInputEmailActions({ onChange, inputRef, onEnter, onFocus, onBlur, onKeyDown, }) {
|
|
38
50
|
function handleClear() {
|
|
39
51
|
var _a;
|
|
40
|
-
|
|
52
|
+
handleBlur();
|
|
41
53
|
onChange === null || onChange === void 0 ? void 0 : onChange("");
|
|
42
54
|
(_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
43
55
|
}
|
|
@@ -71,10 +83,19 @@ function useInputEmailActions({ onChange, inputRef, onEnter, onFocus, onBlur, on
|
|
|
71
83
|
};
|
|
72
84
|
}
|
|
73
85
|
|
|
86
|
+
function useInputEmailFormField(_a) {
|
|
87
|
+
var { id, name, disabled, autofocus, description, inline, value, handleChange, handleBlur, handleFocus, handleKeyDown, error } = _a, rest = tslib_es6.__rest(_a, ["id", "name", "disabled", "autofocus", "description", "inline", "value", "handleChange", "handleBlur", "handleFocus", "handleKeyDown", "error"]);
|
|
88
|
+
const descriptionIdentifier = `descriptionUUID--${id}`;
|
|
89
|
+
const fieldProps = Object.assign(Object.assign(Object.assign({}, rest), { id,
|
|
90
|
+
name,
|
|
91
|
+
disabled, autoFocus: autofocus, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown, value, invalid: error || rest.invalid ? "true" : undefined }), (description &&
|
|
92
|
+
!inline && { "aria-describedby": descriptionIdentifier }));
|
|
93
|
+
return { fieldProps, descriptionIdentifier };
|
|
94
|
+
}
|
|
95
|
+
|
|
74
96
|
const InputEmailRebuilt = React.forwardRef(function InputEmailInternal(props, ref) {
|
|
75
97
|
var _a, _b, _c;
|
|
76
|
-
const
|
|
77
|
-
const id = props.identifier || props.id || generatedId;
|
|
98
|
+
const id = React.useId();
|
|
78
99
|
const inputRef = (_a = ref) !== null && _a !== void 0 ? _a : React.useRef(null);
|
|
79
100
|
const wrapperRef = React.useRef(null);
|
|
80
101
|
const { inputStyle } = FormField.useFormFieldWrapperStyles({
|
|
@@ -85,7 +106,7 @@ const InputEmailRebuilt = React.forwardRef(function InputEmailInternal(props, re
|
|
|
85
106
|
value: props.value,
|
|
86
107
|
invalid: props.invalid,
|
|
87
108
|
error: props.error,
|
|
88
|
-
maxLength:
|
|
109
|
+
maxLength: props.maxLength,
|
|
89
110
|
disabled: props.disabled,
|
|
90
111
|
placeholder: props.placeholder,
|
|
91
112
|
});
|
|
@@ -101,11 +122,25 @@ const InputEmailRebuilt = React.forwardRef(function InputEmailInternal(props, re
|
|
|
101
122
|
onEnter: props.onEnter,
|
|
102
123
|
inputRef,
|
|
103
124
|
});
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
125
|
+
const inputProps = omit.omit(props, [
|
|
126
|
+
"placeholder",
|
|
127
|
+
"onChange",
|
|
128
|
+
"onBlur",
|
|
129
|
+
"onFocus",
|
|
130
|
+
"onEnter",
|
|
131
|
+
"size",
|
|
132
|
+
"prefix",
|
|
133
|
+
"suffix",
|
|
134
|
+
"version",
|
|
135
|
+
]);
|
|
136
|
+
const { fieldProps, descriptionIdentifier } = useInputEmailFormField(Object.assign(Object.assign({}, inputProps), { id,
|
|
137
|
+
name,
|
|
138
|
+
handleChange,
|
|
139
|
+
handleBlur,
|
|
140
|
+
handleFocus,
|
|
141
|
+
handleKeyDown }));
|
|
142
|
+
return (React.createElement(FormField.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 },
|
|
143
|
+
React.createElement("input", Object.assign({}, fieldProps, { ref: inputRef, type: "email", className: inputStyle, value: props.value, "data-testid": "ATL-InputEmail-input" })),
|
|
109
144
|
React.createElement(FormField.FormFieldPostFix, { variation: "spinner", visible: (_c = props.loading) !== null && _c !== void 0 ? _c : false }),
|
|
110
145
|
props.children));
|
|
111
146
|
});
|
|
@@ -1,12 +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 '../tslib.es6-es.js';
|
|
4
|
+
import { _ as __rest } from '../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 { 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
|
const validationMessage = "Please enter a valid email";
|
|
19
31
|
|
|
@@ -35,7 +47,7 @@ function InputEmail$1(props) {
|
|
|
35
47
|
function useInputEmailActions({ onChange, inputRef, onEnter, onFocus, onBlur, onKeyDown, }) {
|
|
36
48
|
function handleClear() {
|
|
37
49
|
var _a;
|
|
38
|
-
|
|
50
|
+
handleBlur();
|
|
39
51
|
onChange === null || onChange === void 0 ? void 0 : onChange("");
|
|
40
52
|
(_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
41
53
|
}
|
|
@@ -69,10 +81,19 @@ function useInputEmailActions({ onChange, inputRef, onEnter, onFocus, onBlur, on
|
|
|
69
81
|
};
|
|
70
82
|
}
|
|
71
83
|
|
|
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
|
+
|
|
72
94
|
const InputEmailRebuilt = forwardRef(function InputEmailInternal(props, ref) {
|
|
73
95
|
var _a, _b, _c;
|
|
74
|
-
const
|
|
75
|
-
const id = props.identifier || props.id || generatedId;
|
|
96
|
+
const id = useId();
|
|
76
97
|
const inputRef = (_a = ref) !== null && _a !== void 0 ? _a : useRef(null);
|
|
77
98
|
const wrapperRef = useRef(null);
|
|
78
99
|
const { inputStyle } = useFormFieldWrapperStyles({
|
|
@@ -83,7 +104,7 @@ const InputEmailRebuilt = forwardRef(function InputEmailInternal(props, ref) {
|
|
|
83
104
|
value: props.value,
|
|
84
105
|
invalid: props.invalid,
|
|
85
106
|
error: props.error,
|
|
86
|
-
maxLength:
|
|
107
|
+
maxLength: props.maxLength,
|
|
87
108
|
disabled: props.disabled,
|
|
88
109
|
placeholder: props.placeholder,
|
|
89
110
|
});
|
|
@@ -99,11 +120,25 @@ const InputEmailRebuilt = forwardRef(function InputEmailInternal(props, ref) {
|
|
|
99
120
|
onEnter: props.onEnter,
|
|
100
121
|
inputRef,
|
|
101
122
|
});
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
123
|
+
const inputProps = omit(props, [
|
|
124
|
+
"placeholder",
|
|
125
|
+
"onChange",
|
|
126
|
+
"onBlur",
|
|
127
|
+
"onFocus",
|
|
128
|
+
"onEnter",
|
|
129
|
+
"size",
|
|
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" })),
|
|
107
142
|
React__default.createElement(FormFieldPostFix, { variation: "spinner", visible: (_c = props.loading) !== null && _c !== void 0 ? _c : false }),
|
|
108
143
|
props.children));
|
|
109
144
|
});
|