@jobber/components 7.5.0 → 7.6.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 +6 -5
- package/dist/Autocomplete/index.mjs +3 -2
- package/dist/DataList/components/DataListSearch/index.cjs +1 -0
- package/dist/DataList/components/DataListSearch/index.mjs +1 -0
- package/dist/DataList/index.cjs +1 -0
- package/dist/DataList/index.mjs +1 -0
- package/dist/DataTable/index.cjs +2 -14
- package/dist/DataTable/index.mjs +2 -14
- package/dist/DataTable-cjs.js +3 -3
- package/dist/DataTable-es.js +1 -1
- package/dist/FormField/index.cjs +14 -13
- package/dist/FormField/index.mjs +5 -4
- package/dist/FormField-cjs.js +8 -281
- package/dist/FormField-es.js +3 -263
- package/dist/InputDate/index.cjs +1 -0
- package/dist/InputDate/index.mjs +2 -1
- package/dist/InputEmail/index.cjs +7 -6
- package/dist/InputEmail/index.mjs +4 -3
- package/dist/InputNumber/index.cjs +1 -0
- package/dist/InputNumber/index.mjs +2 -1
- package/dist/InputPassword/index.cjs +1 -0
- package/dist/InputPassword/index.mjs +1 -0
- package/dist/InputPassword-es.js +1 -1
- package/dist/InputPhoneNumber/index.cjs +6 -5
- package/dist/InputPhoneNumber/index.mjs +2 -1
- package/dist/InputText/index.cjs +8 -7
- package/dist/InputText/index.mjs +4 -3
- package/dist/InputTime/index.cjs +5 -4
- package/dist/InputTime/index.mjs +2 -1
- package/dist/RecurringSelect/index.cjs +3 -14
- package/dist/RecurringSelect/index.mjs +3 -14
- package/dist/RecurringSelect-cjs.js +6 -6
- package/dist/RecurringSelect-es.js +1 -1
- package/dist/Select/Select.d.ts +6 -2
- package/dist/Select/Select.types.d.ts +2 -16
- package/dist/Select/index.cjs +11 -103
- package/dist/Select/index.d.ts +2 -9
- package/dist/Select/index.mjs +9 -105
- package/dist/Select-cjs.js +78 -0
- package/dist/Select-es.js +75 -0
- package/dist/docs/Select/Select.md +69 -33
- package/dist/docs/usage-guidelines/usage-guidelines.md +10 -13
- package/dist/index.cjs +14 -13
- package/dist/index.mjs +3 -2
- package/dist/mergeRefs-cjs.js +279 -0
- package/dist/mergeRefs-es.js +265 -0
- package/package.json +2 -2
- package/dist/Select/Select.rebuilt.d.ts +0 -3
package/dist/FormField-es.js
CHANGED
|
@@ -1,242 +1,9 @@
|
|
|
1
|
-
import React__default, {
|
|
2
|
-
import {
|
|
3
|
-
import { AnimatePresence, motion } from 'framer-motion';
|
|
4
|
-
import { tokens } from '@jobber/design';
|
|
1
|
+
import React__default, { useEffect, useImperativeHandle, useId, useRef } from 'react';
|
|
2
|
+
import { h as formFieldStyles, m as mergeRefs, c as FormFieldWrapper, i as FormFieldPostFix, u as useAtlantisFormFieldName } from './mergeRefs-es.js';
|
|
5
3
|
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
4
|
import { _ as __rest } from './tslib.es6-es.js';
|
|
13
5
|
import { useFormContext, useForm, useController } from 'react-hook-form';
|
|
14
6
|
|
|
15
|
-
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-"};
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @internal Reach out to UX Foundations if using this component since it is possible it might change
|
|
19
|
-
*/
|
|
20
|
-
function AffixLabel({ label, variation = "prefix", labelRef, }) {
|
|
21
|
-
const affixLabelClass = classnames(formFieldStyles.affixLabel, {
|
|
22
|
-
[formFieldStyles.suffix]: variation === "suffix",
|
|
23
|
-
});
|
|
24
|
-
if (!label)
|
|
25
|
-
return null;
|
|
26
|
-
return (React__default.createElement("div", { ref: labelRef, className: affixLabelClass }, label));
|
|
27
|
-
}
|
|
28
|
-
function AffixIcon({ icon, onClick, ariaLabel, variation = "prefix", size, }) {
|
|
29
|
-
const affixIconClass = classnames(formFieldStyles.affixIcon, {
|
|
30
|
-
[formFieldStyles.suffix]: variation === "suffix",
|
|
31
|
-
});
|
|
32
|
-
const iconSize = size === "small" ? "small" : "base";
|
|
33
|
-
if (!icon)
|
|
34
|
-
return null;
|
|
35
|
-
return (React__default.createElement("div", { className: affixIconClass }, onClick ? (React__default.createElement(Button
|
|
36
|
-
/**
|
|
37
|
-
* We can cast the ariaLabel here as a `Suffix`
|
|
38
|
-
* requires an ariaLabel if there is an action
|
|
39
|
-
*/
|
|
40
|
-
, {
|
|
41
|
-
/**
|
|
42
|
-
* We can cast the ariaLabel here as a `Suffix`
|
|
43
|
-
* requires an ariaLabel if there is an action
|
|
44
|
-
*/
|
|
45
|
-
ariaLabel: ariaLabel, icon: icon, onClick: onClick, variation: "subtle", type: "tertiary", size: iconSize })) : (React__default.createElement(Icon, { name: icon, size: iconSize, color: "greyBlue" }))));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function FormFieldDescription({ id, description, visible = true, }) {
|
|
49
|
-
if (!visible)
|
|
50
|
-
return null;
|
|
51
|
-
const useStringFormat = !description || typeof description === "string";
|
|
52
|
-
return (React__default.createElement("div", { id: id, className: formFieldStyles.description }, useStringFormat ? (React__default.createElement(Text, { size: "small", variation: "subdued" }, description)) : (description)));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
var styles = {"clearInput":"YmRTd-KeXv4-","spinning":"B25z9B8I3gs-"};
|
|
56
|
-
|
|
57
|
-
function ClearAction({ onClick, visible, }) {
|
|
58
|
-
if (!visible)
|
|
59
|
-
return null;
|
|
60
|
-
return (React__default.createElement("button", { className: styles.clearInput, onClick: onClick, type: "button", "aria-label": "Clear input", "data-testid": "ATL-FormField-clearButton" },
|
|
61
|
-
React__default.createElement(Icon, { name: "remove", size: "small" })));
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function useToolbar(props) {
|
|
65
|
-
const isToolbarVisible = props.toolbar !== undefined &&
|
|
66
|
-
(props.toolbarVisibility === "always" || props.focused);
|
|
67
|
-
const toolbarAnimationEnd = { opacity: 0, height: 0 };
|
|
68
|
-
const toolbarAnimationStart = { opacity: 1, height: "auto" };
|
|
69
|
-
return {
|
|
70
|
-
isToolbarVisible,
|
|
71
|
-
toolbarAnimationEnd,
|
|
72
|
-
toolbarAnimationStart,
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function useIsSafari() {
|
|
77
|
-
return (globalThis === null || globalThis === void 0 ? void 0 : globalThis.navigator)
|
|
78
|
-
? /^((?!chrome|android).)*safari/i.test(navigator.userAgent)
|
|
79
|
-
: false;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Hook for getting the correct styles for the FormField and its children
|
|
84
|
-
*/
|
|
85
|
-
function useFormFieldWrapperStyles({ size, align, placeholder, value, invalid, error, max, prefixRef, suffixRef, maxLength, type, disabled, inline, showMiniLabel = true, }) {
|
|
86
|
-
const isSafari = useIsSafari();
|
|
87
|
-
const wrapperClasses = classnames(formFieldStyles.wrapper, size && formFieldStyles[size], align && formFieldStyles[align], {
|
|
88
|
-
[formFieldStyles.miniLabel]: (showMiniLabel && placeholder && value !== "") ||
|
|
89
|
-
(placeholder && type === "select") ||
|
|
90
|
-
// Naively assume that if the the type is tel, it is the InputPhoneNumber
|
|
91
|
-
(placeholder && type === "tel"),
|
|
92
|
-
[formFieldStyles.text]: type === "textarea" || type === "text",
|
|
93
|
-
[formFieldStyles.textarea]: type === "textarea",
|
|
94
|
-
[formFieldStyles.safari]: isSafari && type === "textarea",
|
|
95
|
-
[formFieldStyles.select]: type === "select",
|
|
96
|
-
[formFieldStyles.invalid]: invalid !== null && invalid !== void 0 ? invalid : error,
|
|
97
|
-
[formFieldStyles.disabled]: disabled,
|
|
98
|
-
[formFieldStyles.maxLength]: maxLength,
|
|
99
|
-
[formFieldStyles.timeInputLabel]: placeholder && type === "time" && placeholder && value === "",
|
|
100
|
-
});
|
|
101
|
-
const containerClasses = classnames(formFieldStyles.container, {
|
|
102
|
-
[formFieldStyles.inline]: inline,
|
|
103
|
-
});
|
|
104
|
-
const wrapperInlineStyle = {
|
|
105
|
-
["--formField-maxLength"]: maxLength || max,
|
|
106
|
-
};
|
|
107
|
-
const [labelStyle, setLabelStyle] = useState({
|
|
108
|
-
paddingLeft: undefined,
|
|
109
|
-
paddingRight: undefined,
|
|
110
|
-
});
|
|
111
|
-
useEffect(() => {
|
|
112
|
-
var _a, _b;
|
|
113
|
-
setLabelStyle(getAffixPaddding({
|
|
114
|
-
value,
|
|
115
|
-
type,
|
|
116
|
-
prefixWidth: ((_a = prefixRef === null || prefixRef === void 0 ? void 0 : prefixRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0,
|
|
117
|
-
suffixWidth: ((_b = suffixRef === null || suffixRef === void 0 ? void 0 : suffixRef.current) === null || _b === void 0 ? void 0 : _b.offsetWidth) || 0,
|
|
118
|
-
}));
|
|
119
|
-
}, [value]);
|
|
120
|
-
return {
|
|
121
|
-
inputStyle: formFieldStyles.input,
|
|
122
|
-
wrapperClasses,
|
|
123
|
-
containerClasses,
|
|
124
|
-
wrapperInlineStyle,
|
|
125
|
-
labelStyle,
|
|
126
|
-
setLabelStyle,
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
function getAffixPaddding({ value, type, prefixWidth, suffixWidth, }) {
|
|
130
|
-
const hasValue = value !== "";
|
|
131
|
-
const newPadding = {
|
|
132
|
-
paddingLeft: undefined,
|
|
133
|
-
paddingRight: undefined,
|
|
134
|
-
};
|
|
135
|
-
// Naively assume that if the the type is tel, it is the InputPhoneNumber
|
|
136
|
-
if (type === "tel")
|
|
137
|
-
return newPadding;
|
|
138
|
-
if (prefixWidth && !hasValue) {
|
|
139
|
-
newPadding.paddingLeft = offset(prefixWidth);
|
|
140
|
-
}
|
|
141
|
-
if (suffixWidth && !hasValue) {
|
|
142
|
-
newPadding.paddingRight = offset(suffixWidth);
|
|
143
|
-
}
|
|
144
|
-
function offset(width) {
|
|
145
|
-
return `calc(${width}px + var(--space-smallest)`;
|
|
146
|
-
}
|
|
147
|
-
return newPadding;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
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, }) {
|
|
151
|
-
const prefixRef = useRef(null);
|
|
152
|
-
const suffixRef = useRef(null);
|
|
153
|
-
const { wrapperClasses, containerClasses, wrapperInlineStyle, labelStyle } = useFormFieldWrapperStyles({
|
|
154
|
-
align,
|
|
155
|
-
max,
|
|
156
|
-
maxLength,
|
|
157
|
-
prefixRef,
|
|
158
|
-
suffixRef,
|
|
159
|
-
placeholder,
|
|
160
|
-
value,
|
|
161
|
-
invalid,
|
|
162
|
-
error,
|
|
163
|
-
type,
|
|
164
|
-
disabled,
|
|
165
|
-
inline,
|
|
166
|
-
size,
|
|
167
|
-
showMiniLabel,
|
|
168
|
-
});
|
|
169
|
-
const { focused } = useFormFieldFocus({ wrapperRef });
|
|
170
|
-
const showClear = useShowClear({
|
|
171
|
-
clearable,
|
|
172
|
-
multiline: type === "textarea",
|
|
173
|
-
focused,
|
|
174
|
-
hasValue: Boolean(value),
|
|
175
|
-
disabled,
|
|
176
|
-
readonly,
|
|
177
|
-
});
|
|
178
|
-
const { isToolbarVisible, toolbarAnimationEnd, toolbarAnimationStart } = useToolbar({
|
|
179
|
-
focused,
|
|
180
|
-
toolbar,
|
|
181
|
-
toolbarVisibility,
|
|
182
|
-
});
|
|
183
|
-
return (React__default.createElement("div", { className: containerClasses },
|
|
184
|
-
React__default.createElement("div", { className: wrapperClasses, style: wrapperInlineStyle, "data-testid": "Form-Field-Wrapper", ref: wrapperRef },
|
|
185
|
-
React__default.createElement(FormFieldInputHorizontalWrapper, null,
|
|
186
|
-
React__default.createElement(AffixIcon, Object.assign({}, prefix, { size: size })),
|
|
187
|
-
React__default.createElement(FormFieldInputWrapperStyles, null,
|
|
188
|
-
(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)
|
|
189
|
-
? labelStyle
|
|
190
|
-
: undefined }, placeholder)),
|
|
191
|
-
React__default.createElement(AffixLabel, Object.assign({}, prefix, { labelRef: prefixRef })),
|
|
192
|
-
React__default.createElement(FormFieldWrapperMain, null, children),
|
|
193
|
-
React__default.createElement(AffixLabel, Object.assign({}, suffix, { labelRef: suffixRef, variation: "suffix" }))),
|
|
194
|
-
React__default.createElement(ClearAction, { onClick: onClear, visible: showClear }),
|
|
195
|
-
React__default.createElement(AffixIcon, Object.assign({}, suffix, { variation: "suffix", size: size }))),
|
|
196
|
-
React__default.createElement(FormFieldWrapperToolbar, { toolbarVisibility: toolbarVisibility, isToolbarVisible: isToolbarVisible, toolbarAnimationEnd: toolbarAnimationEnd, toolbarAnimationStart: toolbarAnimationStart, toolbar: toolbar })),
|
|
197
|
-
React__default.createElement(FormFieldDescription, { visible: !!description && !inline, id: descriptionIdentifier, description: description }),
|
|
198
|
-
React__default.createElement(InputValidation, { message: error, visible: !!error && !inline })));
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* @internal Reach out to UX Foundations if using this component since it is possible it might change
|
|
202
|
-
*/
|
|
203
|
-
function FormFieldInputHorizontalWrapper({ children, }) {
|
|
204
|
-
return React__default.createElement("div", { className: formFieldStyles.horizontalWrapper }, children);
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* @internal Reach out to UX Foundations if using this component since it is possible it might change
|
|
208
|
-
*/
|
|
209
|
-
function FormFieldInputWrapperStyles({ children, }) {
|
|
210
|
-
return React__default.createElement("div", { className: formFieldStyles.inputWrapper }, children);
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* @internal Reach out to UX Foundations if using this component since it is possible it might change
|
|
214
|
-
*/
|
|
215
|
-
function FormFieldWrapperMain({ children, tabIndex = -1, }) {
|
|
216
|
-
return (React__default.createElement("div", { className: formFieldStyles.childrenWrapper, tabIndex: tabIndex }, children));
|
|
217
|
-
}
|
|
218
|
-
function FormFieldLabel({ children, htmlFor, style, external = false, }) {
|
|
219
|
-
if (!children)
|
|
220
|
-
return null;
|
|
221
|
-
return (React__default.createElement("label", { className: external ? formFieldStyles.externalLabel : formFieldStyles.label, htmlFor: htmlFor, style: style }, children));
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* @internal Reach out to UX Foundations if using this component since it is possible it might change
|
|
225
|
-
*/
|
|
226
|
-
function FormFieldWrapperToolbar({ toolbar, isToolbarVisible, toolbarAnimationEnd, toolbarAnimationStart, toolbarVisibility, }) {
|
|
227
|
-
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: {
|
|
228
|
-
duration: tokens["timing-base"] / 1000,
|
|
229
|
-
ease: "easeInOut",
|
|
230
|
-
}, tabIndex: -1 },
|
|
231
|
-
React__default.createElement("div", { className: formFieldStyles.toolbar, "data-testid": "ATL-InputText-Toolbar" }, toolbar)))));
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
function FormFieldPostFix({ variation, visible = true, className, }) {
|
|
235
|
-
if (!visible)
|
|
236
|
-
return null;
|
|
237
|
-
return (React__default.createElement("span", { className: classnames(formFieldStyles.postfix, className) }, variation === "select" ? (React__default.createElement(Icon, { name: "arrowDown" })) : (React__default.createElement(Spinner, { size: "small" }))));
|
|
238
|
-
}
|
|
239
|
-
|
|
240
7
|
/**
|
|
241
8
|
* Combines the actions from the props of the FormField with the actions from react-hook-form. This is used to
|
|
242
9
|
* manage the form state of a field through react-hook-form while providing support for additional callbacks
|
|
@@ -309,33 +76,6 @@ function shouldAddPhoneNumberClass(type, value, pattern) {
|
|
|
309
76
|
return type === "tel" && !value && pattern && pattern[0] === "(";
|
|
310
77
|
}
|
|
311
78
|
|
|
312
|
-
function useAtlantisFormFieldName({ id, nameProp, }) {
|
|
313
|
-
/**
|
|
314
|
-
* Generate a name if one is not supplied, this is the name
|
|
315
|
-
* that will be used for react-hook-form and not neccessarily
|
|
316
|
-
* attached to the DOM
|
|
317
|
-
*/
|
|
318
|
-
const name = nameProp ? nameProp : `generatedName--${id}`;
|
|
319
|
-
return { name };
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* Given an array of refs, merge them into a single ref callback.
|
|
324
|
-
* This is useful for cases where you need to pass a multiple refs to a component.
|
|
325
|
-
*/
|
|
326
|
-
function mergeRefs(refs) {
|
|
327
|
-
return value => {
|
|
328
|
-
refs.forEach(ref => {
|
|
329
|
-
if (typeof ref === "function") {
|
|
330
|
-
ref(value);
|
|
331
|
-
}
|
|
332
|
-
else if (ref != null) {
|
|
333
|
-
ref.current = value;
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
|
|
339
79
|
/**
|
|
340
80
|
* Hook used to manage the form state of a field through react-hook-form
|
|
341
81
|
*/
|
|
@@ -458,4 +198,4 @@ function setAutocomplete(autocompleteSetting) {
|
|
|
458
198
|
return autocompleteSetting;
|
|
459
199
|
}
|
|
460
200
|
|
|
461
|
-
export {
|
|
201
|
+
export { FormField as F, useAtlantisFormFieldActions as a, useAtlantisReactHookForm as b, useAtlantisFormField as u };
|
package/dist/InputDate/index.cjs
CHANGED
|
@@ -23,6 +23,7 @@ require('../keysIn-cjs.js');
|
|
|
23
23
|
require('../_baseAssignValue-cjs.js');
|
|
24
24
|
require('../_baseFlatten-cjs.js');
|
|
25
25
|
require('../_setToString-cjs.js');
|
|
26
|
+
require('../mergeRefs-cjs.js');
|
|
26
27
|
require('../Icon-cjs.js');
|
|
27
28
|
require('../Text-cjs.js');
|
|
28
29
|
require('../Typography-cjs.js');
|
package/dist/InputDate/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React__default, { useRef, useState, useEffect, forwardRef } from 'react';
|
|
2
2
|
import { o as omit } from '../omit-es.js';
|
|
3
|
-
import {
|
|
3
|
+
import { F as FormField } from '../FormField-es.js';
|
|
4
4
|
import 'classnames';
|
|
5
5
|
import '../tslib.es6-es.js';
|
|
6
6
|
import 'react-hook-form';
|
|
@@ -21,6 +21,7 @@ import '../keysIn-es.js';
|
|
|
21
21
|
import '../_baseAssignValue-es.js';
|
|
22
22
|
import '../_baseFlatten-es.js';
|
|
23
23
|
import '../_setToString-es.js';
|
|
24
|
+
import '../mergeRefs-es.js';
|
|
24
25
|
import '../Icon-es.js';
|
|
25
26
|
import '../Text-es.js';
|
|
26
27
|
import '../Typography-es.js';
|
|
@@ -9,14 +9,15 @@ require('@jobber/hooks');
|
|
|
9
9
|
require('framer-motion');
|
|
10
10
|
require('@jobber/design');
|
|
11
11
|
require('../Button-cjs.js');
|
|
12
|
+
var mergeRefs = require('../mergeRefs-cjs.js');
|
|
12
13
|
var filterDataAttributes = require('../filterDataAttributes-cjs.js');
|
|
14
|
+
require('react-router-dom');
|
|
13
15
|
require('../Icon-cjs.js');
|
|
14
|
-
require('../Text-cjs.js');
|
|
15
16
|
require('../Typography-cjs.js');
|
|
17
|
+
require('../Text-cjs.js');
|
|
16
18
|
require('../useFormFieldFocus-cjs.js');
|
|
17
19
|
require('../InputValidation-cjs.js');
|
|
18
20
|
require('../Spinner-cjs.js');
|
|
19
|
-
require('react-router-dom');
|
|
20
21
|
|
|
21
22
|
const validationMessage = "Please enter a valid email";
|
|
22
23
|
|
|
@@ -102,7 +103,7 @@ const InputEmailRebuilt = React.forwardRef(function InputEmailInternal(props, re
|
|
|
102
103
|
const id = props.id || generatedId;
|
|
103
104
|
const inputRef = (_a = ref) !== null && _a !== void 0 ? _a : React.useRef(null);
|
|
104
105
|
const wrapperRef = React.useRef(null);
|
|
105
|
-
const { name } =
|
|
106
|
+
const { name } = mergeRefs.useAtlantisFormFieldName({
|
|
106
107
|
nameProp: props.name,
|
|
107
108
|
id,
|
|
108
109
|
});
|
|
@@ -124,9 +125,9 @@ const InputEmailRebuilt = React.forwardRef(function InputEmailInternal(props, re
|
|
|
124
125
|
const descriptionVisible = props.description && !props.inline;
|
|
125
126
|
const isInvalid = Boolean(props.error || props.invalid);
|
|
126
127
|
const dataAttrs = filterDataAttributes.filterDataAttributes(props);
|
|
127
|
-
return (React.createElement(
|
|
128
|
-
React.createElement("input", Object.assign({ id: id, name: name, type: "email", ref: inputRef, className:
|
|
129
|
-
React.createElement(
|
|
128
|
+
return (React.createElement(mergeRefs.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, readonly: props.readOnly, wrapperRef: wrapperRef, disabled: props.disabled, type: "email", value: props.value, placeholder: props.placeholder, name: name },
|
|
129
|
+
React.createElement("input", Object.assign({ id: id, name: name, type: "email", ref: inputRef, className: mergeRefs.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)),
|
|
130
|
+
React.createElement(mergeRefs.FormFieldPostFix, { variation: "spinner", visible: (_c = props.loading) !== null && _c !== void 0 ? _c : false })));
|
|
130
131
|
});
|
|
131
132
|
|
|
132
133
|
function isNewInputEmailProps(props) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React__default, { forwardRef, useId, useRef } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { F as FormField } from '../FormField-es.js';
|
|
3
3
|
import 'classnames';
|
|
4
4
|
import '../tslib.es6-es.js';
|
|
5
5
|
import 'react-hook-form';
|
|
@@ -7,14 +7,15 @@ import '@jobber/hooks';
|
|
|
7
7
|
import 'framer-motion';
|
|
8
8
|
import '@jobber/design';
|
|
9
9
|
import '../Button-es.js';
|
|
10
|
+
import { u as useAtlantisFormFieldName, c as FormFieldWrapper, h as formFieldStyles, i as FormFieldPostFix } from '../mergeRefs-es.js';
|
|
10
11
|
import { f as filterDataAttributes } from '../filterDataAttributes-es.js';
|
|
12
|
+
import 'react-router-dom';
|
|
11
13
|
import '../Icon-es.js';
|
|
12
|
-
import '../Text-es.js';
|
|
13
14
|
import '../Typography-es.js';
|
|
15
|
+
import '../Text-es.js';
|
|
14
16
|
import '../useFormFieldFocus-es.js';
|
|
15
17
|
import '../InputValidation-es.js';
|
|
16
18
|
import '../Spinner-es.js';
|
|
17
|
-
import 'react-router-dom';
|
|
18
19
|
|
|
19
20
|
const validationMessage = "Please enter a valid email";
|
|
20
21
|
|
|
@@ -15,6 +15,7 @@ require('@jobber/design');
|
|
|
15
15
|
require('../Button-cjs.js');
|
|
16
16
|
require('../clsx-cjs.js');
|
|
17
17
|
require('../Typography-cjs.js');
|
|
18
|
+
require('../mergeRefs-cjs.js');
|
|
18
19
|
require('../useFormFieldFocus-cjs.js');
|
|
19
20
|
require('../InputValidation-cjs.js');
|
|
20
21
|
require('../Spinner-cjs.js');
|
|
@@ -5,7 +5,7 @@ import classnames from 'classnames';
|
|
|
5
5
|
import { I as Icon } from '../Icon-es.js';
|
|
6
6
|
import { T as Text } from '../Text-es.js';
|
|
7
7
|
import { f as filterDataAttributes } from '../filterDataAttributes-es.js';
|
|
8
|
-
import {
|
|
8
|
+
import { F as FormField } from '../FormField-es.js';
|
|
9
9
|
import 'react-hook-form';
|
|
10
10
|
import '@jobber/hooks';
|
|
11
11
|
import 'framer-motion';
|
|
@@ -13,6 +13,7 @@ import '@jobber/design';
|
|
|
13
13
|
import '../Button-es.js';
|
|
14
14
|
import '../clsx-es.js';
|
|
15
15
|
import '../Typography-es.js';
|
|
16
|
+
import '../mergeRefs-es.js';
|
|
16
17
|
import '../useFormFieldFocus-es.js';
|
|
17
18
|
import '../InputValidation-es.js';
|
|
18
19
|
import '../Spinner-es.js';
|
package/dist/InputPassword-es.js
CHANGED
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var tslib_es6 = require('../tslib.es6-cjs.js');
|
|
5
5
|
var classnames = require('classnames');
|
|
6
|
-
var
|
|
6
|
+
var mergeRefs = require('../mergeRefs-cjs.js');
|
|
7
7
|
var reactHookForm = require('react-hook-form');
|
|
8
8
|
require('../Button-cjs.js');
|
|
9
9
|
require('@jobber/design');
|
|
10
10
|
var filterDataAttributes = require('../filterDataAttributes-cjs.js');
|
|
11
|
+
var FormField = require('../FormField-cjs.js');
|
|
11
12
|
require('@jobber/hooks');
|
|
12
13
|
require('framer-motion');
|
|
13
14
|
require('../Icon-cjs.js');
|
|
@@ -176,7 +177,7 @@ const InputPhoneNumberRebuilt = React.forwardRef(function InputPhoneNumberIntern
|
|
|
176
177
|
const wrapperRef = React.useRef(null);
|
|
177
178
|
const generatedId = React.useId();
|
|
178
179
|
const id = props.id || generatedId;
|
|
179
|
-
const { name } =
|
|
180
|
+
const { name } = mergeRefs.useAtlantisFormFieldName({
|
|
180
181
|
nameProp: props.name,
|
|
181
182
|
id: id,
|
|
182
183
|
});
|
|
@@ -202,14 +203,14 @@ const InputPhoneNumberRebuilt = React.forwardRef(function InputPhoneNumberIntern
|
|
|
202
203
|
const descriptionIdentifier = `descriptionUUID--${id}`, descriptionVisible = props.description && !props.inline;
|
|
203
204
|
const isInvalid = Boolean(props.error || props.invalid);
|
|
204
205
|
const dataAttrs = filterDataAttributes.filterDataAttributes(props);
|
|
205
|
-
return (React.createElement(
|
|
206
|
-
React.createElement("input", Object.assign({ id: id, name: name, type: "tel", ref: inputPhoneNumberRef, className: classnames(
|
|
206
|
+
return (React.createElement(mergeRefs.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({ id: id, name: name, type: "tel", ref: inputPhoneNumberRef, className: classnames(mergeRefs.formFieldStyles.input, {
|
|
207
208
|
[styles.emptyValue]: inputValue.length === 0 && pattern[0] === "(",
|
|
208
209
|
}), value: formattedValue, disabled: props.disabled, readOnly: props.readOnly, autoFocus: props.autoFocus, autoComplete: props.autoComplete, inputMode: props.inputMode, tabIndex: props.tabIndex, required: props.required, role: props.role, "aria-label": props["aria-label"], "aria-describedby": descriptionVisible
|
|
209
210
|
? descriptionIdentifier
|
|
210
211
|
: 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, onClick: handleClick, onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, onPointerDown: handlePointerDown, onPointerUp: handlePointerUp }, dataAttrs)),
|
|
211
212
|
React.createElement(MaskElement, { isMasking: isMasking, formattedValue: formattedValue, placeholderMask: placeholderMask }),
|
|
212
|
-
React.createElement(
|
|
213
|
+
React.createElement(mergeRefs.FormFieldPostFix, { variation: "spinner", visible: (_e = props.loading) !== null && _e !== void 0 ? _e : false })));
|
|
213
214
|
});
|
|
214
215
|
|
|
215
216
|
function InputPhoneNumber$1(_a) {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React__default, { useState, useMemo, useCallback, useEffect, cloneElement, forwardRef, useId } from 'react';
|
|
2
2
|
import { _ as __rest } from '../tslib.es6-es.js';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
|
-
import {
|
|
4
|
+
import { u as useAtlantisFormFieldName, c as FormFieldWrapper, h as formFieldStyles, i as FormFieldPostFix } from '../mergeRefs-es.js';
|
|
5
5
|
import { useFormContext, useForm } from 'react-hook-form';
|
|
6
6
|
import '../Button-es.js';
|
|
7
7
|
import '@jobber/design';
|
|
8
8
|
import { f as filterDataAttributes } from '../filterDataAttributes-es.js';
|
|
9
|
+
import { F as FormField } from '../FormField-es.js';
|
|
9
10
|
import '@jobber/hooks';
|
|
10
11
|
import 'framer-motion';
|
|
11
12
|
import '../Icon-es.js';
|
package/dist/InputText/index.cjs
CHANGED
|
@@ -9,14 +9,15 @@ require('react-hook-form');
|
|
|
9
9
|
require('framer-motion');
|
|
10
10
|
require('@jobber/design');
|
|
11
11
|
require('../Button-cjs.js');
|
|
12
|
+
var mergeRefs = require('../mergeRefs-cjs.js');
|
|
12
13
|
var filterDataAttributes = require('../filterDataAttributes-cjs.js');
|
|
14
|
+
require('react-router-dom');
|
|
13
15
|
require('../Icon-cjs.js');
|
|
14
|
-
require('../Text-cjs.js');
|
|
15
16
|
require('../Typography-cjs.js');
|
|
17
|
+
require('../Text-cjs.js');
|
|
16
18
|
require('../useFormFieldFocus-cjs.js');
|
|
17
19
|
require('../InputValidation-cjs.js');
|
|
18
20
|
require('../Spinner-cjs.js');
|
|
19
|
-
require('react-router-dom');
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Hook for resizing a textarea based on its content. The textarea will grow up to the max number of rows specified.
|
|
@@ -220,7 +221,7 @@ const InputTextSPAR = React.forwardRef(function InputTextInternal(props, inputRe
|
|
|
220
221
|
inputRef: inputTextRef,
|
|
221
222
|
wrapperRef: wrapperRef,
|
|
222
223
|
});
|
|
223
|
-
const { name } =
|
|
224
|
+
const { name } = mergeRefs.useAtlantisFormFieldName({
|
|
224
225
|
nameProp: props.name,
|
|
225
226
|
id: id,
|
|
226
227
|
});
|
|
@@ -242,16 +243,16 @@ const InputTextSPAR = React.forwardRef(function InputTextInternal(props, inputRe
|
|
|
242
243
|
const descriptionVisible = props.description && !props.inline;
|
|
243
244
|
const isInvalid = Boolean(props.error || props.invalid);
|
|
244
245
|
const dataAttrs = filterDataAttributes.filterDataAttributes(props);
|
|
245
|
-
const mergedRef = React.useMemo(() =>
|
|
246
|
+
const mergedRef = React.useMemo(() => mergeRefs.mergeRefs([inputRef, inputTextRef]), []);
|
|
246
247
|
// Shared props for both TextArea and TextInput
|
|
247
248
|
const commonInputProps = Object.assign({ id,
|
|
248
|
-
name, className:
|
|
249
|
+
name, className: mergeRefs.formFieldStyles.input, value: props.value, disabled: props.disabled, readOnly: props.readOnly, autoFocus: props.autoFocus, autoComplete: props.autoComplete, inputMode: props.inputMode, tabIndex: props.tabIndex, maxLength: props.maxLength, required: props.required, role: props.role, "aria-label": props["aria-label"], "aria-describedby": descriptionVisible
|
|
249
250
|
? descriptionIdentifier
|
|
250
251
|
: 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, onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onClick: handleClick, ref: mergedRef }, dataAttrs);
|
|
251
|
-
return (React.createElement(
|
|
252
|
+
return (React.createElement(mergeRefs.FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, name: name, wrapperRef: wrapperRef, error: (_a = props.error) !== null && _a !== void 0 ? _a : "", invalid: Boolean(props.error || props.invalid), identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, clearable: (_b = props.clearable) !== null && _b !== void 0 ? _b : "never", onClear: handleClear, type: props.multiline ? "textarea" : "text", placeholder: props.placeholder, value: props.value, prefix: props.prefix, suffix: props.suffix, readonly: props.readOnly, rows: rowRange.min, toolbar: props.toolbar, toolbarVisibility: props.toolbarVisibility, showMiniLabel: props.showMiniLabel },
|
|
252
253
|
React.createElement(React.Fragment, null,
|
|
253
254
|
props.multiline ? (React.createElement(TextArea, Object.assign({}, commonInputProps, { rows: rowRange.min }))) : (React.createElement(TextInput, Object.assign({}, commonInputProps, { pattern: props.pattern }))),
|
|
254
|
-
React.createElement(
|
|
255
|
+
React.createElement(mergeRefs.FormFieldPostFix, { variation: "spinner", visible: (_c = props.loading) !== null && _c !== void 0 ? _c : false }))));
|
|
255
256
|
});
|
|
256
257
|
function useInputTextId(props) {
|
|
257
258
|
const generatedId = React.useId();
|
package/dist/InputText/index.mjs
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import React__default, { forwardRef, useRef, useImperativeHandle, useMemo, useId } from 'react';
|
|
2
2
|
import { useSafeLayoutEffect } from '@jobber/hooks';
|
|
3
|
-
import {
|
|
3
|
+
import { F as FormField } from '../FormField-es.js';
|
|
4
4
|
import 'classnames';
|
|
5
5
|
import '../tslib.es6-es.js';
|
|
6
6
|
import 'react-hook-form';
|
|
7
7
|
import 'framer-motion';
|
|
8
8
|
import '@jobber/design';
|
|
9
9
|
import '../Button-es.js';
|
|
10
|
+
import { u as useAtlantisFormFieldName, m as mergeRefs, h as formFieldStyles, c as FormFieldWrapper, i as FormFieldPostFix } from '../mergeRefs-es.js';
|
|
10
11
|
import { f as filterDataAttributes } from '../filterDataAttributes-es.js';
|
|
12
|
+
import 'react-router-dom';
|
|
11
13
|
import '../Icon-es.js';
|
|
12
|
-
import '../Text-es.js';
|
|
13
14
|
import '../Typography-es.js';
|
|
15
|
+
import '../Text-es.js';
|
|
14
16
|
import '../useFormFieldFocus-es.js';
|
|
15
17
|
import '../InputValidation-es.js';
|
|
16
18
|
import '../Spinner-es.js';
|
|
17
|
-
import 'react-router-dom';
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Hook for resizing a textarea based on its content. The textarea will grow up to the max number of rows specified.
|
package/dist/InputTime/index.cjs
CHANGED
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var tslib_es6 = require('../tslib.es6-cjs.js');
|
|
5
5
|
var debounce = require('../debounce-cjs.js');
|
|
6
|
-
var
|
|
6
|
+
var mergeRefs = require('../mergeRefs-cjs.js');
|
|
7
7
|
require('classnames');
|
|
8
8
|
require('@jobber/design');
|
|
9
9
|
require('react-hook-form');
|
|
10
10
|
require('../Button-cjs.js');
|
|
11
11
|
var filterDataAttributes = require('../filterDataAttributes-cjs.js');
|
|
12
12
|
var omit = require('../omit-cjs.js');
|
|
13
|
+
var FormField = require('../FormField-cjs.js');
|
|
13
14
|
require('@jobber/hooks');
|
|
14
15
|
require('framer-motion');
|
|
15
16
|
require('../_commonjsHelpers-cjs.js');
|
|
@@ -302,12 +303,12 @@ function InputTimeRebuilt(_a) {
|
|
|
302
303
|
const descriptionIdentifier = `descriptionUUID--${id}`;
|
|
303
304
|
const descriptionVisible = props.description && !props.inline;
|
|
304
305
|
const isInvalid = Boolean(props.error || props.invalid);
|
|
305
|
-
return (React.createElement(
|
|
306
|
-
React.createElement("input", Object.assign({ ref: mergedRef, type: "time", name: props.name, className:
|
|
306
|
+
return (React.createElement(mergeRefs.FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, name: props.name, error: props.error || "", identifier: id, descriptionIdentifier: descriptionIdentifier, invalid: props.invalid, description: props.description, clearable: (_b = props.clearable) !== null && _b !== void 0 ? _b : "never", onClear: handleClear, type: "time", readonly: readOnly, placeholder: props.placeholder, value: dateToTimeString(value), wrapperRef: wrapperRef },
|
|
307
|
+
React.createElement("input", Object.assign({ ref: mergedRef, type: "time", name: props.name, className: mergeRefs.formFieldStyles.input, id: id, disabled: props.disabled, readOnly: readOnly, autoComplete: autoComplete, autoFocus: props.autoFocus, required: props.required, max: props.max, min: props.min, value: dateToTimeString(value), onChange: handleChangeEvent, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, onClick: handleClick, onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, "data-testid": "ATL-InputTime-input", "aria-label": props["aria-label"], "aria-describedby": descriptionVisible ? descriptionIdentifier : props["aria-describedby"], "aria-invalid": isInvalid ? true : undefined, "aria-required": props["aria-required"] }, dataAttrs))));
|
|
307
308
|
}
|
|
308
309
|
function useInputTimeRefs(inputRef) {
|
|
309
310
|
const internalRef = React.useRef(null);
|
|
310
|
-
const mergedRef =
|
|
311
|
+
const mergedRef = mergeRefs.mergeRefs([internalRef, inputRef]);
|
|
311
312
|
const wrapperRef = React.useRef(null);
|
|
312
313
|
return { internalRef, mergedRef, wrapperRef };
|
|
313
314
|
}
|
package/dist/InputTime/index.mjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React__default, { useState, useCallback, useEffect, useId, useRef } from 'react';
|
|
2
2
|
import { _ as __rest } from '../tslib.es6-es.js';
|
|
3
3
|
import { a as debounce } from '../debounce-es.js';
|
|
4
|
-
import {
|
|
4
|
+
import { c as FormFieldWrapper, h as formFieldStyles, m as mergeRefs } from '../mergeRefs-es.js';
|
|
5
5
|
import 'classnames';
|
|
6
6
|
import '@jobber/design';
|
|
7
7
|
import 'react-hook-form';
|
|
8
8
|
import '../Button-es.js';
|
|
9
9
|
import { f as filterDataAttributes } from '../filterDataAttributes-es.js';
|
|
10
10
|
import { o as omit } from '../omit-es.js';
|
|
11
|
+
import { F as FormField } from '../FormField-es.js';
|
|
11
12
|
import '@jobber/hooks';
|
|
12
13
|
import 'framer-motion';
|
|
13
14
|
import '../_commonjsHelpers-es.js';
|