@jobber/components 7.13.1 → 7.14.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/index.cjs +3 -2
- package/dist/Autocomplete/index.mjs +2 -1
- package/dist/DataList/components/DataListSearch/index.cjs +2 -1
- package/dist/DataList/components/DataListSearch/index.mjs +2 -1
- package/dist/DataList/index.cjs +2 -1
- package/dist/DataList/index.mjs +2 -1
- package/dist/DataTable/index.cjs +2 -1
- package/dist/DataTable/index.mjs +2 -1
- package/dist/FormField/index.cjs +11 -10
- package/dist/FormField/index.mjs +2 -1
- package/dist/FormField-cjs.js +7 -6
- package/dist/FormField-es.js +2 -1
- package/dist/FormFieldPostFix-cjs.js +250 -0
- package/dist/FormFieldPostFix-es.js +238 -0
- package/dist/InputDate/index.cjs +2 -1
- package/dist/InputDate/index.mjs +2 -1
- package/dist/InputEmail/index.cjs +1 -0
- package/dist/InputEmail/index.mjs +1 -0
- package/dist/InputEmail-cjs.js +4 -3
- package/dist/InputEmail-es.js +2 -1
- package/dist/InputNumber/index.cjs +2 -1
- package/dist/InputNumber/index.mjs +2 -1
- package/dist/InputPassword/index.cjs +2 -1
- package/dist/InputPassword/index.mjs +2 -1
- package/dist/InputPhoneNumber/InputPhoneNumber.d.ts +2 -2
- package/dist/InputPhoneNumber/InputPhoneNumber.types.d.ts +2 -20
- package/dist/InputPhoneNumber/hooks/useInputPhoneActions.d.ts +2 -2
- package/dist/InputPhoneNumber/index.cjs +13 -250
- package/dist/InputPhoneNumber/index.d.ts +2 -5
- package/dist/InputPhoneNumber/index.mjs +12 -253
- package/dist/InputPhoneNumber-cjs.js +190 -0
- package/dist/InputPhoneNumber-es.js +188 -0
- package/dist/InputText/index.cjs +5 -4
- package/dist/InputText/index.mjs +2 -1
- package/dist/InputTime/index.cjs +4 -3
- package/dist/InputTime/index.mjs +2 -1
- package/dist/RecurringSelect/index.cjs +2 -1
- package/dist/RecurringSelect/index.mjs +2 -1
- package/dist/Select/index.cjs +2 -1
- package/dist/Select/index.mjs +2 -1
- package/dist/Select-cjs.js +5 -4
- package/dist/Select-es.js +2 -1
- package/dist/docs/InputPhoneNumber/InputPhoneNumber.md +40 -21
- package/dist/docs/usage-guidelines/usage-guidelines.md +7 -8
- package/dist/index.cjs +13 -12
- package/dist/index.mjs +3 -2
- package/dist/mergeRefs-cjs.js +0 -248
- package/dist/mergeRefs-es.js +1 -238
- package/package.json +3 -3
- package/dist/InputPhoneNumber/InputPhoneNumber.rebuilt.d.ts +0 -3
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import React__default, { useState, useEffect, useRef } from 'react';
|
|
2
|
+
import { useShowClear } from '@jobber/hooks';
|
|
3
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
4
|
+
import { tokens } from '@jobber/design';
|
|
5
|
+
import classnames from 'classnames';
|
|
6
|
+
import { B as Button } from './Button-es.js';
|
|
7
|
+
import { I as Icon } from './Icon-es.js';
|
|
8
|
+
import { T as Text } from './Text-es.js';
|
|
9
|
+
import { u as useFormFieldFocus } from './useFormFieldFocus-es.js';
|
|
10
|
+
import { I as InputValidation } from './InputValidation-es.js';
|
|
11
|
+
import { S as Spinner } from './Spinner-es.js';
|
|
12
|
+
|
|
13
|
+
var formFieldStyles = {"container":"YL-mNv-Bl6g-","wrapper":"_8lhbGTQ-hhg-","disabled":"Tz9LK9ABKMk-","horizontalWrapper":"b5mv1x1H7YE-","textarea":"hGr6YW4AeLM-","safari":"QBCWi9GBgMs-","timeInputLabel":"_0pmqVa2zSE4-","miniLabel":"F1t76G6bDKo-","large":"_9tjyT9QUtP8-","text":"QmMiyoAWp-g-","invalid":"XWDSfe6weSY-","small":"Sw5O4I0lMJg-","inline":"SaORbL7SYWY-","center":"ozy2UoT2vsg-","right":"_3TJdT91YD3c-","maxLength":"W6GrMqLy2qk-","inputWrapper":"-LmjnYRU0r0-","childrenWrapper":"yVXYv6hkuOA-","input":"vtSDcuzNr9Q-","emptyPhoneNumber":"MVhuQuzUBUs-","label":"Dgk00tzlODA-","select":"NwQGiWBWIsc-","externalLabel":"Qb8zQ8n-8vc-","postfix":"yTDzs9h1otI-","affixIcon":"m0YpdssD2dY-","suffix":"_-3mMnjSh6ok-","affixLabel":"-Wzcb0pBh5I-","description":"DHX5ijY3xIw-","toolbar":"AL-2brNI7dk-","spinning":"_8Rzv7CcDW80-"};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @internal Reach out to UX Foundations if using this component since it is possible it might change
|
|
17
|
+
*/
|
|
18
|
+
function AffixLabel({ label, variation = "prefix", labelRef, }) {
|
|
19
|
+
const affixLabelClass = classnames(formFieldStyles.affixLabel, {
|
|
20
|
+
[formFieldStyles.suffix]: variation === "suffix",
|
|
21
|
+
});
|
|
22
|
+
if (!label)
|
|
23
|
+
return null;
|
|
24
|
+
return (React__default.createElement("div", { ref: labelRef, className: affixLabelClass }, label));
|
|
25
|
+
}
|
|
26
|
+
function AffixIcon({ icon, onClick, ariaLabel, variation = "prefix", size, }) {
|
|
27
|
+
const affixIconClass = classnames(formFieldStyles.affixIcon, {
|
|
28
|
+
[formFieldStyles.suffix]: variation === "suffix",
|
|
29
|
+
});
|
|
30
|
+
const iconSize = size === "small" ? "small" : "base";
|
|
31
|
+
if (!icon)
|
|
32
|
+
return null;
|
|
33
|
+
return (React__default.createElement("div", { className: affixIconClass }, onClick ? (React__default.createElement(Button
|
|
34
|
+
/**
|
|
35
|
+
* We can cast the ariaLabel here as a `Suffix`
|
|
36
|
+
* requires an ariaLabel if there is an action
|
|
37
|
+
*/
|
|
38
|
+
, {
|
|
39
|
+
/**
|
|
40
|
+
* We can cast the ariaLabel here as a `Suffix`
|
|
41
|
+
* requires an ariaLabel if there is an action
|
|
42
|
+
*/
|
|
43
|
+
ariaLabel: ariaLabel, icon: icon, onClick: onClick, variation: "subtle", type: "tertiary", size: iconSize })) : (React__default.createElement(Icon, { name: icon, size: iconSize, color: "greyBlue" }))));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function FormFieldDescription({ id, description, visible = true, }) {
|
|
47
|
+
if (!visible)
|
|
48
|
+
return null;
|
|
49
|
+
const useStringFormat = !description || typeof description === "string";
|
|
50
|
+
return (React__default.createElement("div", { id: id, className: formFieldStyles.description }, useStringFormat ? (React__default.createElement(Text, { size: "small", variation: "subdued" }, description)) : (description)));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
var styles = {"clearInput":"YmRTd-KeXv4-","spinning":"B25z9B8I3gs-"};
|
|
54
|
+
|
|
55
|
+
function ClearAction({ onClick, visible, }) {
|
|
56
|
+
if (!visible)
|
|
57
|
+
return null;
|
|
58
|
+
return (React__default.createElement("button", { className: styles.clearInput, onClick: onClick, type: "button", "aria-label": "Clear input", "data-testid": "ATL-FormField-clearButton" },
|
|
59
|
+
React__default.createElement(Icon, { name: "remove", size: "small" })));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function useToolbar(props) {
|
|
63
|
+
const isToolbarVisible = props.toolbar !== undefined &&
|
|
64
|
+
(props.toolbarVisibility === "always" || props.focused);
|
|
65
|
+
const toolbarAnimationEnd = { opacity: 0, height: 0 };
|
|
66
|
+
const toolbarAnimationStart = { opacity: 1, height: "auto" };
|
|
67
|
+
return {
|
|
68
|
+
isToolbarVisible,
|
|
69
|
+
toolbarAnimationEnd,
|
|
70
|
+
toolbarAnimationStart,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function useIsSafari() {
|
|
75
|
+
return (globalThis === null || globalThis === void 0 ? void 0 : globalThis.navigator)
|
|
76
|
+
? /^((?!chrome|android).)*safari/i.test(navigator.userAgent)
|
|
77
|
+
: false;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Hook for getting the correct styles for the FormField and its children
|
|
82
|
+
*/
|
|
83
|
+
function useFormFieldWrapperStyles({ size, align, placeholder, value, invalid, error, max, prefixRef, suffixRef, maxLength, type, disabled, inline, showMiniLabel = true, }) {
|
|
84
|
+
const isSafari = useIsSafari();
|
|
85
|
+
const wrapperClasses = classnames(formFieldStyles.wrapper, size && formFieldStyles[size], align && formFieldStyles[align], {
|
|
86
|
+
[formFieldStyles.miniLabel]: (showMiniLabel && placeholder && value !== "") ||
|
|
87
|
+
(placeholder && type === "select") ||
|
|
88
|
+
// Naively assume that if the the type is tel, it is the InputPhoneNumber
|
|
89
|
+
(placeholder && type === "tel"),
|
|
90
|
+
[formFieldStyles.text]: type === "textarea" || type === "text",
|
|
91
|
+
[formFieldStyles.textarea]: type === "textarea",
|
|
92
|
+
[formFieldStyles.safari]: isSafari && type === "textarea",
|
|
93
|
+
[formFieldStyles.select]: type === "select",
|
|
94
|
+
[formFieldStyles.invalid]: invalid !== null && invalid !== void 0 ? invalid : error,
|
|
95
|
+
[formFieldStyles.disabled]: disabled,
|
|
96
|
+
[formFieldStyles.maxLength]: maxLength,
|
|
97
|
+
[formFieldStyles.timeInputLabel]: placeholder && type === "time" && placeholder && value === "",
|
|
98
|
+
});
|
|
99
|
+
const containerClasses = classnames(formFieldStyles.container, {
|
|
100
|
+
[formFieldStyles.inline]: inline,
|
|
101
|
+
});
|
|
102
|
+
const wrapperInlineStyle = {
|
|
103
|
+
["--formField-maxLength"]: maxLength || max,
|
|
104
|
+
};
|
|
105
|
+
const [labelStyle, setLabelStyle] = useState({
|
|
106
|
+
paddingLeft: undefined,
|
|
107
|
+
paddingRight: undefined,
|
|
108
|
+
});
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
var _a, _b;
|
|
111
|
+
setLabelStyle(getAffixPaddding({
|
|
112
|
+
value,
|
|
113
|
+
type,
|
|
114
|
+
prefixWidth: ((_a = prefixRef === null || prefixRef === void 0 ? void 0 : prefixRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0,
|
|
115
|
+
suffixWidth: ((_b = suffixRef === null || suffixRef === void 0 ? void 0 : suffixRef.current) === null || _b === void 0 ? void 0 : _b.offsetWidth) || 0,
|
|
116
|
+
}));
|
|
117
|
+
}, [value]);
|
|
118
|
+
return {
|
|
119
|
+
inputStyle: formFieldStyles.input,
|
|
120
|
+
wrapperClasses,
|
|
121
|
+
containerClasses,
|
|
122
|
+
wrapperInlineStyle,
|
|
123
|
+
labelStyle,
|
|
124
|
+
setLabelStyle,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function getAffixPaddding({ value, type, prefixWidth, suffixWidth, }) {
|
|
128
|
+
const hasValue = value !== "";
|
|
129
|
+
const newPadding = {
|
|
130
|
+
paddingLeft: undefined,
|
|
131
|
+
paddingRight: undefined,
|
|
132
|
+
};
|
|
133
|
+
// Naively assume that if the the type is tel, it is the InputPhoneNumber
|
|
134
|
+
if (type === "tel")
|
|
135
|
+
return newPadding;
|
|
136
|
+
if (prefixWidth && !hasValue) {
|
|
137
|
+
newPadding.paddingLeft = offset(prefixWidth);
|
|
138
|
+
}
|
|
139
|
+
if (suffixWidth && !hasValue) {
|
|
140
|
+
newPadding.paddingRight = offset(suffixWidth);
|
|
141
|
+
}
|
|
142
|
+
function offset(width) {
|
|
143
|
+
return `calc(${width}px + var(--space-smallest)`;
|
|
144
|
+
}
|
|
145
|
+
return newPadding;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function FormFieldWrapper({ align, description, descriptionIdentifier, placeholder, value, children, invalid, error, size, prefix, suffix, max, maxLength, type, disabled, inline, identifier, clearable, onClear, readonly, toolbar, toolbarVisibility = "while-editing", showMiniLabel = true, wrapperRef, }) {
|
|
149
|
+
const prefixRef = useRef(null);
|
|
150
|
+
const suffixRef = useRef(null);
|
|
151
|
+
const { wrapperClasses, containerClasses, wrapperInlineStyle, labelStyle } = useFormFieldWrapperStyles({
|
|
152
|
+
align,
|
|
153
|
+
max,
|
|
154
|
+
maxLength,
|
|
155
|
+
prefixRef,
|
|
156
|
+
suffixRef,
|
|
157
|
+
placeholder,
|
|
158
|
+
value,
|
|
159
|
+
invalid,
|
|
160
|
+
error,
|
|
161
|
+
type,
|
|
162
|
+
disabled,
|
|
163
|
+
inline,
|
|
164
|
+
size,
|
|
165
|
+
showMiniLabel,
|
|
166
|
+
});
|
|
167
|
+
const { focused } = useFormFieldFocus({ wrapperRef });
|
|
168
|
+
const showClear = useShowClear({
|
|
169
|
+
clearable,
|
|
170
|
+
multiline: type === "textarea",
|
|
171
|
+
focused,
|
|
172
|
+
hasValue: Boolean(value),
|
|
173
|
+
disabled,
|
|
174
|
+
readonly,
|
|
175
|
+
});
|
|
176
|
+
const { isToolbarVisible, toolbarAnimationEnd, toolbarAnimationStart } = useToolbar({
|
|
177
|
+
focused,
|
|
178
|
+
toolbar,
|
|
179
|
+
toolbarVisibility,
|
|
180
|
+
});
|
|
181
|
+
return (React__default.createElement("div", { className: containerClasses },
|
|
182
|
+
React__default.createElement("div", { className: wrapperClasses, style: wrapperInlineStyle, "data-testid": "Form-Field-Wrapper", ref: wrapperRef },
|
|
183
|
+
React__default.createElement(FormFieldInputHorizontalWrapper, null,
|
|
184
|
+
React__default.createElement(AffixIcon, Object.assign({}, prefix, { size: size })),
|
|
185
|
+
React__default.createElement(FormFieldInputWrapperStyles, null,
|
|
186
|
+
(showMiniLabel || !value) && (React__default.createElement(FormFieldLabel, { htmlFor: identifier, style: (prefixRef === null || prefixRef === void 0 ? void 0 : prefixRef.current) || (suffixRef === null || suffixRef === void 0 ? void 0 : suffixRef.current)
|
|
187
|
+
? labelStyle
|
|
188
|
+
: undefined }, placeholder)),
|
|
189
|
+
React__default.createElement(AffixLabel, Object.assign({}, prefix, { labelRef: prefixRef })),
|
|
190
|
+
React__default.createElement(FormFieldWrapperMain, null, children),
|
|
191
|
+
React__default.createElement(AffixLabel, Object.assign({}, suffix, { labelRef: suffixRef, variation: "suffix" }))),
|
|
192
|
+
React__default.createElement(ClearAction, { onClick: onClear, visible: showClear }),
|
|
193
|
+
React__default.createElement(AffixIcon, Object.assign({}, suffix, { variation: "suffix", size: size }))),
|
|
194
|
+
React__default.createElement(FormFieldWrapperToolbar, { toolbarVisibility: toolbarVisibility, isToolbarVisible: isToolbarVisible, toolbarAnimationEnd: toolbarAnimationEnd, toolbarAnimationStart: toolbarAnimationStart, toolbar: toolbar })),
|
|
195
|
+
React__default.createElement(FormFieldDescription, { visible: !!description && !inline, id: descriptionIdentifier, description: description }),
|
|
196
|
+
React__default.createElement(InputValidation, { message: error, visible: !!error && !inline })));
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* @internal Reach out to UX Foundations if using this component since it is possible it might change
|
|
200
|
+
*/
|
|
201
|
+
function FormFieldInputHorizontalWrapper({ children, }) {
|
|
202
|
+
return React__default.createElement("div", { className: formFieldStyles.horizontalWrapper }, children);
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* @internal Reach out to UX Foundations if using this component since it is possible it might change
|
|
206
|
+
*/
|
|
207
|
+
function FormFieldInputWrapperStyles({ children, }) {
|
|
208
|
+
return React__default.createElement("div", { className: formFieldStyles.inputWrapper }, children);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* @internal Reach out to UX Foundations if using this component since it is possible it might change
|
|
212
|
+
*/
|
|
213
|
+
function FormFieldWrapperMain({ children, tabIndex = -1, }) {
|
|
214
|
+
return (React__default.createElement("div", { className: formFieldStyles.childrenWrapper, tabIndex: tabIndex }, children));
|
|
215
|
+
}
|
|
216
|
+
function FormFieldLabel({ children, htmlFor, style, external = false, }) {
|
|
217
|
+
if (!children)
|
|
218
|
+
return null;
|
|
219
|
+
return (React__default.createElement("label", { className: external ? formFieldStyles.externalLabel : formFieldStyles.label, htmlFor: htmlFor, style: style }, children));
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* @internal Reach out to UX Foundations if using this component since it is possible it might change
|
|
223
|
+
*/
|
|
224
|
+
function FormFieldWrapperToolbar({ toolbar, isToolbarVisible, toolbarAnimationEnd, toolbarAnimationStart, toolbarVisibility, }) {
|
|
225
|
+
return (React__default.createElement(AnimatePresence, { initial: toolbarVisibility === "always" ? false : true }, isToolbarVisible && (React__default.createElement(motion.div, { key: "toolbar", initial: toolbarAnimationEnd, animate: toolbarAnimationStart, exit: toolbarAnimationEnd, transition: {
|
|
226
|
+
duration: tokens["timing-base"] / 1000,
|
|
227
|
+
ease: "easeInOut",
|
|
228
|
+
}, tabIndex: -1 },
|
|
229
|
+
React__default.createElement("div", { className: formFieldStyles.toolbar, "data-testid": "ATL-InputText-Toolbar" }, toolbar)))));
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function FormFieldPostFix({ variation, visible = true, className, }) {
|
|
233
|
+
if (!visible)
|
|
234
|
+
return null;
|
|
235
|
+
return (React__default.createElement("span", { className: classnames(formFieldStyles.postfix, className) }, variation === "select" ? (React__default.createElement(Icon, { name: "arrowDown" })) : (React__default.createElement(Spinner, { size: "small" }))));
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export { AffixIcon as A, FormFieldInputHorizontalWrapper as F, FormFieldInputWrapperStyles as a, FormFieldLabel as b, FormFieldWrapper as c, FormFieldWrapperMain as d, FormFieldWrapperToolbar as e, AffixLabel as f, formFieldStyles as g, FormFieldPostFix as h, useFormFieldWrapperStyles as u };
|
package/dist/InputDate/index.cjs
CHANGED
|
@@ -33,7 +33,7 @@ require('../_setToString-cjs.js');
|
|
|
33
33
|
require('../AtlantisContext-cjs.js');
|
|
34
34
|
require('../InputText/index.cjs');
|
|
35
35
|
require('../FormField-cjs.js');
|
|
36
|
-
require('../
|
|
36
|
+
require('../FormFieldPostFix-cjs.js');
|
|
37
37
|
require('framer-motion');
|
|
38
38
|
require('../Text-cjs.js');
|
|
39
39
|
require('../useFormFieldFocus-cjs.js');
|
|
@@ -41,6 +41,7 @@ require('../InputValidation-cjs.js');
|
|
|
41
41
|
require('../Spinner-cjs.js');
|
|
42
42
|
require('../useAtlantisFormFieldName-cjs.js');
|
|
43
43
|
require('react-hook-form');
|
|
44
|
+
require('../mergeRefs-cjs.js');
|
|
44
45
|
require('../filterDataAttributes-cjs.js');
|
|
45
46
|
|
|
46
47
|
|
package/dist/InputDate/index.mjs
CHANGED
|
@@ -31,7 +31,7 @@ import '../_setToString-es.js';
|
|
|
31
31
|
import '../AtlantisContext-es.js';
|
|
32
32
|
import '../InputText/index.mjs';
|
|
33
33
|
import '../FormField-es.js';
|
|
34
|
-
import '../
|
|
34
|
+
import '../FormFieldPostFix-es.js';
|
|
35
35
|
import 'framer-motion';
|
|
36
36
|
import '../Text-es.js';
|
|
37
37
|
import '../useFormFieldFocus-es.js';
|
|
@@ -39,4 +39,5 @@ import '../InputValidation-es.js';
|
|
|
39
39
|
import '../Spinner-es.js';
|
|
40
40
|
import '../useAtlantisFormFieldName-es.js';
|
|
41
41
|
import 'react-hook-form';
|
|
42
|
+
import '../mergeRefs-es.js';
|
|
42
43
|
import '../filterDataAttributes-es.js';
|
package/dist/InputEmail-cjs.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var mergeRefs = require('./mergeRefs-cjs.js');
|
|
5
|
+
var FormFieldPostFix = require('./FormFieldPostFix-cjs.js');
|
|
5
6
|
require('classnames');
|
|
6
7
|
require('./tslib.es6-cjs.js');
|
|
7
8
|
require('react-hook-form');
|
|
@@ -99,9 +100,9 @@ const InputEmail = React.forwardRef(function InputEmailInternal(props, ref) {
|
|
|
99
100
|
const descriptionVisible = props.description && !props.inline;
|
|
100
101
|
const isInvalid = Boolean(props.error || props.invalid);
|
|
101
102
|
const dataAttrs = filterDataAttributes.filterDataAttributes(props);
|
|
102
|
-
return (React.createElement(
|
|
103
|
-
React.createElement("input", Object.assign({ id: id, name: props.name, type: "email", ref: mergedRef, className:
|
|
104
|
-
React.createElement(
|
|
103
|
+
return (React.createElement(FormFieldPostFix.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: (_a = props.clearable) !== null && _a !== void 0 ? _a : "never", onClear: handleClear, readonly: props.readOnly, wrapperRef: wrapperRef, disabled: props.disabled, type: "email", value: props.value, placeholder: props.placeholder, name: props.name },
|
|
104
|
+
React.createElement("input", Object.assign({ id: id, name: props.name, type: "email", ref: mergedRef, className: FormFieldPostFix.formFieldStyles.input, value: props.value, disabled: props.disabled, readOnly: props.readOnly, autoFocus: props.autoFocus, autoComplete: props.autoComplete, pattern: props.pattern, inputMode: props.inputMode, tabIndex: props.tabIndex, maxLength: props.maxLength, required: props.required, 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, onClick: handleClick, onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, "data-testid": "ATL-InputEmail-input" }, dataAttrs)),
|
|
105
|
+
React.createElement(FormFieldPostFix.FormFieldPostFix, { variation: "spinner", visible: (_b = props.loading) !== null && _b !== void 0 ? _b : false })));
|
|
105
106
|
});
|
|
106
107
|
|
|
107
108
|
exports.InputEmail = InputEmail;
|
package/dist/InputEmail-es.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React__default, { useRef, forwardRef, useId } from 'react';
|
|
2
|
-
import { m as mergeRefs
|
|
2
|
+
import { m as mergeRefs } from './mergeRefs-es.js';
|
|
3
|
+
import { c as FormFieldWrapper, g as formFieldStyles, h as FormFieldPostFix } from './FormFieldPostFix-es.js';
|
|
3
4
|
import 'classnames';
|
|
4
5
|
import './tslib.es6-es.js';
|
|
5
6
|
import 'react-hook-form';
|
|
@@ -14,11 +14,12 @@ require('framer-motion');
|
|
|
14
14
|
require('@jobber/design');
|
|
15
15
|
require('../Button-cjs.js');
|
|
16
16
|
require('../Typography-cjs.js');
|
|
17
|
-
require('../
|
|
17
|
+
require('../FormFieldPostFix-cjs.js');
|
|
18
18
|
require('../useFormFieldFocus-cjs.js');
|
|
19
19
|
require('../InputValidation-cjs.js');
|
|
20
20
|
require('../Spinner-cjs.js');
|
|
21
21
|
require('../useAtlantisFormFieldName-cjs.js');
|
|
22
|
+
require('../mergeRefs-cjs.js');
|
|
22
23
|
require('react-router-dom');
|
|
23
24
|
|
|
24
25
|
/*
|
|
@@ -12,11 +12,12 @@ import 'framer-motion';
|
|
|
12
12
|
import '@jobber/design';
|
|
13
13
|
import '../Button-es.js';
|
|
14
14
|
import '../Typography-es.js';
|
|
15
|
-
import '../
|
|
15
|
+
import '../FormFieldPostFix-es.js';
|
|
16
16
|
import '../useFormFieldFocus-es.js';
|
|
17
17
|
import '../InputValidation-es.js';
|
|
18
18
|
import '../Spinner-es.js';
|
|
19
19
|
import '../useAtlantisFormFieldName-es.js';
|
|
20
|
+
import '../mergeRefs-es.js';
|
|
20
21
|
import 'react-router-dom';
|
|
21
22
|
|
|
22
23
|
/*
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var InputPassword = require('../InputPassword-cjs.js');
|
|
4
4
|
require('react');
|
|
5
5
|
require('../FormField-cjs.js');
|
|
6
|
-
require('../
|
|
6
|
+
require('../FormFieldPostFix-cjs.js');
|
|
7
7
|
require('@jobber/hooks');
|
|
8
8
|
require('framer-motion');
|
|
9
9
|
require('@jobber/design');
|
|
@@ -19,6 +19,7 @@ require('../InputValidation-cjs.js');
|
|
|
19
19
|
require('../Spinner-cjs.js');
|
|
20
20
|
require('../useAtlantisFormFieldName-cjs.js');
|
|
21
21
|
require('react-hook-form');
|
|
22
|
+
require('../mergeRefs-cjs.js');
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { I as InputPassword } from '../InputPassword-es.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import '../FormField-es.js';
|
|
4
|
-
import '../
|
|
4
|
+
import '../FormFieldPostFix-es.js';
|
|
5
5
|
import '@jobber/hooks';
|
|
6
6
|
import 'framer-motion';
|
|
7
7
|
import '@jobber/design';
|
|
@@ -17,3 +17,4 @@ import '../InputValidation-es.js';
|
|
|
17
17
|
import '../Spinner-es.js';
|
|
18
18
|
import '../useAtlantisFormFieldName-es.js';
|
|
19
19
|
import 'react-hook-form';
|
|
20
|
+
import '../mergeRefs-es.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
export declare
|
|
2
|
+
import type { InputPhoneNumberProps } from "./InputPhoneNumber.types";
|
|
3
|
+
export declare const InputPhoneNumber: React.ForwardRefExoticComponent<InputPhoneNumberProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1,25 +1,7 @@
|
|
|
1
1
|
import type { InputMaskProps } from "./InputMask";
|
|
2
|
-
import type {
|
|
2
|
+
import type { FormFieldProps } from "../FormField";
|
|
3
3
|
import type { FocusEvents, HTMLInputBaseProps, KeyboardEvents, MouseEvents, RebuiltInputCommonProps } from "../sharedHelpers/types";
|
|
4
|
-
|
|
5
|
-
* @deprecated Use the v2 InputPhoneNumber component instead (version={2}).
|
|
6
|
-
*/
|
|
7
|
-
export interface InputPhoneNumberLegacyProps extends Omit<CommonFormFieldProps, "align">, Pick<FormFieldProps, "autocomplete" | "onEnter" | "onFocus" | "onBlur" | "validations" | "readonly" | "prefix" | "suffix"> {
|
|
8
|
-
readonly value: string;
|
|
9
|
-
readonly onChange: (value: string) => void;
|
|
10
|
-
/**
|
|
11
|
-
* A pattern to specify the format to display the phone number in.
|
|
12
|
-
* For example if you want to display the format for [Denmark](https://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers#Denmark)
|
|
13
|
-
* you could set it to `** ** ** **`
|
|
14
|
-
* @default "(***) ***-****"
|
|
15
|
-
*/
|
|
16
|
-
readonly pattern?: InputMaskProps["pattern"];
|
|
17
|
-
/**
|
|
18
|
-
* Shows a "required" validation message when the component is left empty.
|
|
19
|
-
*/
|
|
20
|
-
readonly required?: boolean;
|
|
21
|
-
}
|
|
22
|
-
export interface InputPhoneNumberRebuiltProps extends Omit<HTMLInputBaseProps, "type" | "maxLength" | "minLength">, FocusEvents<HTMLInputElement>, KeyboardEvents<HTMLInputElement>, MouseEvents<HTMLInputElement>, Omit<RebuiltInputCommonProps, "showMiniLabel"> {
|
|
4
|
+
export interface InputPhoneNumberProps extends Omit<HTMLInputBaseProps, "type" | "maxLength" | "minLength">, FocusEvents<HTMLInputElement>, KeyboardEvents<HTMLInputElement>, MouseEvents<HTMLInputElement>, Omit<RebuiltInputCommonProps, "showMiniLabel" | "version"> {
|
|
23
5
|
/**
|
|
24
6
|
* The current value of the input.
|
|
25
7
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChangeEvent, FocusEvent, KeyboardEvent, MouseEvent, PointerEvent } from "react";
|
|
2
|
-
import type {
|
|
3
|
-
export interface useInputPhoneActionsProps extends Pick<
|
|
2
|
+
import type { InputPhoneNumberProps } from "../InputPhoneNumber.types";
|
|
3
|
+
export interface useInputPhoneActionsProps extends Pick<InputPhoneNumberProps, "onChange" | "onEnter" | "onFocus" | "onBlur" | "onKeyDown" | "onClick" | "onMouseDown" | "onMouseUp" | "onPointerDown" | "onPointerUp"> {
|
|
4
4
|
inputRef?: React.RefObject<HTMLInputElement>;
|
|
5
5
|
}
|
|
6
6
|
/**
|