@jobber/components 6.103.2-JOB-141426-1b49367.0 → 6.103.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Autocomplete/index.cjs +2 -11
- package/dist/Autocomplete/index.mjs +2 -11
- package/dist/Autocomplete/useAutocomplete.d.ts +0 -1
- package/dist/FormField-cjs.js +5 -1
- package/dist/FormField-es.js +5 -1
- package/dist/InputNumber/index.cjs +1 -1
- package/dist/InputNumber/index.mjs +1 -1
- package/package.json +2 -2
|
@@ -225,7 +225,6 @@ function useAutocompleteListNav({ navigableCount, shouldResetActiveIndexOnClose,
|
|
|
225
225
|
// eslint-disable-next-line max-statements
|
|
226
226
|
function useAutocomplete(props) {
|
|
227
227
|
const { menu, emptyActions, getOptionLabel: getOptionLabelProp, isOptionEqualToValue, inputValue, onInputChange, value, onChange, multiple, openOnFocus = true, readOnly = false, debounce: debounceMs = 300, } = props;
|
|
228
|
-
const isClickingWithinRef = React.useRef(false);
|
|
229
228
|
// TODO: Clean up the types in these refs by enhancing the type system in useCallbackRef
|
|
230
229
|
const getOptionLabelPropRef = jobberHooks.useCallbackRef((opt) => getOptionLabelProp === null || getOptionLabelProp === void 0 ? void 0 : getOptionLabelProp(opt));
|
|
231
230
|
const getOptionLabel = React.useCallback((opt) => {
|
|
@@ -521,9 +520,6 @@ function useAutocomplete(props) {
|
|
|
521
520
|
const onInputBlur = React.useCallback(() => {
|
|
522
521
|
var _a, _b;
|
|
523
522
|
setInputFocused(false);
|
|
524
|
-
if (isClickingWithinRef.current) {
|
|
525
|
-
return;
|
|
526
|
-
}
|
|
527
523
|
if (readOnly) {
|
|
528
524
|
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
529
525
|
return;
|
|
@@ -670,7 +666,6 @@ function useAutocomplete(props) {
|
|
|
670
666
|
activeIndex,
|
|
671
667
|
setActiveIndex,
|
|
672
668
|
listRef,
|
|
673
|
-
isClickingWithinRef,
|
|
674
669
|
// actions
|
|
675
670
|
onSelection,
|
|
676
671
|
onAction,
|
|
@@ -909,7 +904,7 @@ const AutocompleteRebuilt = React.forwardRef(AutocompleteRebuiltInternal);
|
|
|
909
904
|
function AutocompleteRebuiltInternal(props, forwardedRef) {
|
|
910
905
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
911
906
|
const { inputValue, placeholder, disabled, error, invalid, description, size: sizeProp, loading = false, } = props;
|
|
912
|
-
const { renderable, optionCount, persistentsHeaders, persistentsFooters, headerInteractiveCount, middleNavigableCount, getOptionLabel, isOptionSelected, refs, floatingStyles, context, getReferenceProps, getFloatingProps, getItemProps, activeIndex, open, listRef,
|
|
907
|
+
const { renderable, optionCount, persistentsHeaders, persistentsFooters, headerInteractiveCount, middleNavigableCount, getOptionLabel, isOptionSelected, refs, floatingStyles, context, getReferenceProps, getFloatingProps, getItemProps, activeIndex, open, listRef, onSelection, onAction, onInputChangeFromUser, onInputBlur, onInputFocus, onInputKeyDown, setReferenceElement, } = useAutocomplete(props);
|
|
913
908
|
const listboxId = React.useId();
|
|
914
909
|
// Provides mount/unmount-aware transition styles for the floating element
|
|
915
910
|
const { isMounted, styles: transitionStyles } = floatingUi_react.useTransitionStyles(context, {
|
|
@@ -967,11 +962,7 @@ function AutocompleteRebuiltInternal(props, forwardedRef) {
|
|
|
967
962
|
style: Object.assign(Object.assign(Object.assign(Object.assign({}, floatingStyles), transitionStyles), (_b = props.UNSAFE_styles) === null || _b === void 0 ? void 0 : _b.menu), (menuWidth
|
|
968
963
|
? { width: menuWidth, maxWidth: menuWidth }
|
|
969
964
|
: {})),
|
|
970
|
-
}),
|
|
971
|
-
isClickingWithinRef.current = true;
|
|
972
|
-
}, onPointerUp: () => {
|
|
973
|
-
isClickingWithinRef.current = false;
|
|
974
|
-
} }),
|
|
965
|
+
})),
|
|
975
966
|
React.createElement(PersistentRegion, { items: persistentsHeaders, position: "header", activeIndex: activeIndex, indexOffset: 0, listboxId: listboxId, getItemProps: getItemProps, listRef: listRef, customRenderHeader: props.customRenderHeader, customRenderFooter: props.customRenderFooter, onAction: onAction, className: classnames(styles$1.persistentHeader, (_c = props.UNSAFE_className) === null || _c === void 0 ? void 0 : _c.header), style: (_d = props.UNSAFE_styles) === null || _d === void 0 ? void 0 : _d.header }),
|
|
976
967
|
React.createElement("div", { className: styles$1.scrollRegion }, loading ? ((_e = props.customRenderLoading) !== null && _e !== void 0 ? _e : React.createElement(LoadingContent, null)) : (React.createElement(React.Fragment, null,
|
|
977
968
|
showEmptyStateMessage && (React.createElement(EmptyStateMessage, { emptyState: props.emptyStateMessage })),
|
|
@@ -223,7 +223,6 @@ function useAutocompleteListNav({ navigableCount, shouldResetActiveIndexOnClose,
|
|
|
223
223
|
// eslint-disable-next-line max-statements
|
|
224
224
|
function useAutocomplete(props) {
|
|
225
225
|
const { menu, emptyActions, getOptionLabel: getOptionLabelProp, isOptionEqualToValue, inputValue, onInputChange, value, onChange, multiple, openOnFocus = true, readOnly = false, debounce: debounceMs = 300, } = props;
|
|
226
|
-
const isClickingWithinRef = useRef(false);
|
|
227
226
|
// TODO: Clean up the types in these refs by enhancing the type system in useCallbackRef
|
|
228
227
|
const getOptionLabelPropRef = useCallbackRef((opt) => getOptionLabelProp === null || getOptionLabelProp === void 0 ? void 0 : getOptionLabelProp(opt));
|
|
229
228
|
const getOptionLabel = useCallback((opt) => {
|
|
@@ -519,9 +518,6 @@ function useAutocomplete(props) {
|
|
|
519
518
|
const onInputBlur = useCallback(() => {
|
|
520
519
|
var _a, _b;
|
|
521
520
|
setInputFocused(false);
|
|
522
|
-
if (isClickingWithinRef.current) {
|
|
523
|
-
return;
|
|
524
|
-
}
|
|
525
521
|
if (readOnly) {
|
|
526
522
|
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
527
523
|
return;
|
|
@@ -668,7 +664,6 @@ function useAutocomplete(props) {
|
|
|
668
664
|
activeIndex,
|
|
669
665
|
setActiveIndex,
|
|
670
666
|
listRef,
|
|
671
|
-
isClickingWithinRef,
|
|
672
667
|
// actions
|
|
673
668
|
onSelection,
|
|
674
669
|
onAction,
|
|
@@ -907,7 +902,7 @@ const AutocompleteRebuilt = forwardRef(AutocompleteRebuiltInternal);
|
|
|
907
902
|
function AutocompleteRebuiltInternal(props, forwardedRef) {
|
|
908
903
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
909
904
|
const { inputValue, placeholder, disabled, error, invalid, description, size: sizeProp, loading = false, } = props;
|
|
910
|
-
const { renderable, optionCount, persistentsHeaders, persistentsFooters, headerInteractiveCount, middleNavigableCount, getOptionLabel, isOptionSelected, refs, floatingStyles, context, getReferenceProps, getFloatingProps, getItemProps, activeIndex, open, listRef,
|
|
905
|
+
const { renderable, optionCount, persistentsHeaders, persistentsFooters, headerInteractiveCount, middleNavigableCount, getOptionLabel, isOptionSelected, refs, floatingStyles, context, getReferenceProps, getFloatingProps, getItemProps, activeIndex, open, listRef, onSelection, onAction, onInputChangeFromUser, onInputBlur, onInputFocus, onInputKeyDown, setReferenceElement, } = useAutocomplete(props);
|
|
911
906
|
const listboxId = React__default.useId();
|
|
912
907
|
// Provides mount/unmount-aware transition styles for the floating element
|
|
913
908
|
const { isMounted, styles: transitionStyles } = useTransitionStyles(context, {
|
|
@@ -965,11 +960,7 @@ function AutocompleteRebuiltInternal(props, forwardedRef) {
|
|
|
965
960
|
style: Object.assign(Object.assign(Object.assign(Object.assign({}, floatingStyles), transitionStyles), (_b = props.UNSAFE_styles) === null || _b === void 0 ? void 0 : _b.menu), (menuWidth
|
|
966
961
|
? { width: menuWidth, maxWidth: menuWidth }
|
|
967
962
|
: {})),
|
|
968
|
-
}),
|
|
969
|
-
isClickingWithinRef.current = true;
|
|
970
|
-
}, onPointerUp: () => {
|
|
971
|
-
isClickingWithinRef.current = false;
|
|
972
|
-
} }),
|
|
963
|
+
})),
|
|
973
964
|
React__default.createElement(PersistentRegion, { items: persistentsHeaders, position: "header", activeIndex: activeIndex, indexOffset: 0, listboxId: listboxId, getItemProps: getItemProps, listRef: listRef, customRenderHeader: props.customRenderHeader, customRenderFooter: props.customRenderFooter, onAction: onAction, className: classnames(styles$1.persistentHeader, (_c = props.UNSAFE_className) === null || _c === void 0 ? void 0 : _c.header), style: (_d = props.UNSAFE_styles) === null || _d === void 0 ? void 0 : _d.header }),
|
|
974
965
|
React__default.createElement("div", { className: styles$1.scrollRegion }, loading ? ((_e = props.customRenderLoading) !== null && _e !== void 0 ? _e : React__default.createElement(LoadingContent, null)) : (React__default.createElement(React__default.Fragment, null,
|
|
975
966
|
showEmptyStateMessage && (React__default.createElement(EmptyStateMessage, { emptyState: props.emptyStateMessage })),
|
|
@@ -56,7 +56,6 @@ export declare function useAutocomplete<Value extends OptionLike, Multiple exten
|
|
|
56
56
|
activeIndex: number | null;
|
|
57
57
|
setActiveIndex: (index: number | null) => void;
|
|
58
58
|
listRef: React.MutableRefObject<(HTMLElement | null)[]>;
|
|
59
|
-
isClickingWithinRef: React.MutableRefObject<boolean>;
|
|
60
59
|
onSelection: (option: Value) => void;
|
|
61
60
|
onAction: (action: ActionConfig) => void;
|
|
62
61
|
onInputChangeFromUser: (val: string) => void;
|
package/dist/FormField-cjs.js
CHANGED
|
@@ -383,6 +383,7 @@ function FormField(props) {
|
|
|
383
383
|
return React.createElement(FormFieldInternal, Object.assign({}, props, { id: id }));
|
|
384
384
|
}
|
|
385
385
|
function FormFieldInternal(props) {
|
|
386
|
+
var _a;
|
|
386
387
|
const { actionsRef, autocomplete = true, children, defaultValue, description, disabled, id, inputRef, inline, keyboard, max, maxLength, min, name: nameProp, pattern, readonly, rows, loading, type = "text", validations, value, onChange, onEnter, onFocus, onBlur, onValidation, onKeyUp, clearable = "never", autofocus, } = props;
|
|
387
388
|
const { name } = useAtlantisFormFieldName({ id, nameProp });
|
|
388
389
|
const { errorMessage, inputRefs, useControllerField, setValue, onControllerBlur, onControllerChange, } = useAtlantisReactHookForm({
|
|
@@ -429,7 +430,10 @@ function FormFieldInternal(props) {
|
|
|
429
430
|
handleValidation,
|
|
430
431
|
handleKeyDown,
|
|
431
432
|
});
|
|
432
|
-
|
|
433
|
+
// Ensure focus tracking works by providing a wrapperRef when none is passed
|
|
434
|
+
const internalWrapperRef = React.useRef(null);
|
|
435
|
+
const wrapperRef = (_a = props.wrapperRef) !== null && _a !== void 0 ? _a : internalWrapperRef;
|
|
436
|
+
return (React.createElement(FormFieldWrapper, Object.assign({}, props, { value: useControllerField.value, error: errorMessage, identifier: id, descriptionIdentifier: descriptionIdentifier, clearable: clearable, onClear: handleClear, wrapperRef: wrapperRef }), renderField()));
|
|
433
437
|
function renderField() {
|
|
434
438
|
switch (type) {
|
|
435
439
|
case "select":
|
package/dist/FormField-es.js
CHANGED
|
@@ -381,6 +381,7 @@ function FormField(props) {
|
|
|
381
381
|
return React__default.createElement(FormFieldInternal, Object.assign({}, props, { id: id }));
|
|
382
382
|
}
|
|
383
383
|
function FormFieldInternal(props) {
|
|
384
|
+
var _a;
|
|
384
385
|
const { actionsRef, autocomplete = true, children, defaultValue, description, disabled, id, inputRef, inline, keyboard, max, maxLength, min, name: nameProp, pattern, readonly, rows, loading, type = "text", validations, value, onChange, onEnter, onFocus, onBlur, onValidation, onKeyUp, clearable = "never", autofocus, } = props;
|
|
385
386
|
const { name } = useAtlantisFormFieldName({ id, nameProp });
|
|
386
387
|
const { errorMessage, inputRefs, useControllerField, setValue, onControllerBlur, onControllerChange, } = useAtlantisReactHookForm({
|
|
@@ -427,7 +428,10 @@ function FormFieldInternal(props) {
|
|
|
427
428
|
handleValidation,
|
|
428
429
|
handleKeyDown,
|
|
429
430
|
});
|
|
430
|
-
|
|
431
|
+
// Ensure focus tracking works by providing a wrapperRef when none is passed
|
|
432
|
+
const internalWrapperRef = useRef(null);
|
|
433
|
+
const wrapperRef = (_a = props.wrapperRef) !== null && _a !== void 0 ? _a : internalWrapperRef;
|
|
434
|
+
return (React__default.createElement(FormFieldWrapper, Object.assign({}, props, { value: useControllerField.value, error: errorMessage, identifier: id, descriptionIdentifier: descriptionIdentifier, clearable: clearable, onClear: handleClear, wrapperRef: wrapperRef }), renderField()));
|
|
431
435
|
function renderField() {
|
|
432
436
|
switch (type) {
|
|
433
437
|
case "select":
|
|
@@ -2773,7 +2773,7 @@ function InputNumberInternal(props, ref) {
|
|
|
2773
2773
|
}
|
|
2774
2774
|
},
|
|
2775
2775
|
}));
|
|
2776
|
-
return (React.createElement(FormField.FormField, Object.assign({}, props, { type: "number", inputRef: inputRef, onChange: handleChange, validations: Object.assign(Object.assign({}, props.validations), { validate: customValidators((_a = props.validations) === null || _a === void 0 ? void 0 : _a.validate) }) })));
|
|
2776
|
+
return (React.createElement(FormField.FormField, Object.assign({}, props, { clearable: "never", type: "number", inputRef: inputRef, onChange: handleChange, validations: Object.assign(Object.assign({}, props.validations), { validate: customValidators((_a = props.validations) === null || _a === void 0 ? void 0 : _a.validate) }) })));
|
|
2777
2777
|
function customValidators(validators) {
|
|
2778
2778
|
if (validators == null) {
|
|
2779
2779
|
return getOverLimitMessage;
|
|
@@ -2771,7 +2771,7 @@ function InputNumberInternal(props, ref) {
|
|
|
2771
2771
|
}
|
|
2772
2772
|
},
|
|
2773
2773
|
}));
|
|
2774
|
-
return (React__default.createElement(FormField, Object.assign({}, props, { type: "number", inputRef: inputRef, onChange: handleChange, validations: Object.assign(Object.assign({}, props.validations), { validate: customValidators((_a = props.validations) === null || _a === void 0 ? void 0 : _a.validate) }) })));
|
|
2774
|
+
return (React__default.createElement(FormField, Object.assign({}, props, { clearable: "never", type: "number", inputRef: inputRef, onChange: handleChange, validations: Object.assign(Object.assign({}, props.validations), { validate: customValidators((_a = props.validations) === null || _a === void 0 ? void 0 : _a.validate) }) })));
|
|
2775
2775
|
function customValidators(validators) {
|
|
2776
2776
|
if (validators == null) {
|
|
2777
2777
|
return getOverLimitMessage;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "6.103.2
|
|
3
|
+
"version": "6.103.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -538,5 +538,5 @@
|
|
|
538
538
|
"> 1%",
|
|
539
539
|
"IE 10"
|
|
540
540
|
],
|
|
541
|
-
"gitHead": "
|
|
541
|
+
"gitHead": "901fec98e7fac64fac23c225d7ac6da63d0739f5"
|
|
542
542
|
}
|