@jobber/components 6.111.1 → 6.111.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.
@@ -197,6 +197,7 @@ function useAutocompleteListNav({ navigableCount, shouldResetActiveIndexOnClose,
197
197
  return prev >= navigableCount ? navigableCount - 1 : prev;
198
198
  });
199
199
  }, [navigableCount, setActiveIndex, listRef]);
200
+ const setReferenceElement = React.useCallback((el) => refs.setReference(el), [refs]);
200
201
  return {
201
202
  refs,
202
203
  floatingStyles,
@@ -209,7 +210,7 @@ function useAutocompleteListNav({ navigableCount, shouldResetActiveIndexOnClose,
209
210
  listRef,
210
211
  open,
211
212
  setOpen,
212
- setReferenceElement: (el) => refs.setReference(el),
213
+ setReferenceElement,
213
214
  };
214
215
  }
215
216
 
@@ -968,7 +969,7 @@ function AutocompleteRebuiltInternal(props, forwardedRef) {
968
969
  disabled, readOnly: props.readOnly, error: error !== null && error !== void 0 ? error : undefined, name: props.name, invalid, autoComplete: "off", autoFocus: props.autoFocus, description, size: sizeProp ? sizeProp : undefined, prefix: props.prefix, suffix: props.suffix }), (props.readOnly ? {} : composedReferenceProps)), { role: "combobox", "aria-autocomplete": "list", "aria-expanded": open ? true : false, "aria-controls": listboxId, "aria-activedescendant": open && activeIndex != null
969
970
  ? `${listboxId}-item-${activeIndex}`
970
971
  : undefined }), dataAttrs);
971
- const referenceInputRef = (node) => {
972
+ const referenceInputRef = React.useCallback((node) => {
972
973
  setReferenceElement(node);
973
974
  // Workaround to get the width of the visual InputText element, which is not the same as
974
975
  // the literal input reference element when props like suffix/prefix/clearable are present.
@@ -977,11 +978,11 @@ function AutocompleteRebuiltInternal(props, forwardedRef) {
977
978
  setMenuWidth(visualInputTextElement.clientWidth);
978
979
  setPositionRefEl(visualInputTextElement);
979
980
  }
980
- };
981
- const mergedInputRef = FormField.mergeRefs([
981
+ }, [setReferenceElement]);
982
+ const mergedInputRef = React.useMemo(() => FormField.mergeRefs([
982
983
  referenceInputRef,
983
984
  forwardedRef,
984
- ]);
985
+ ]), [referenceInputRef, forwardedRef]);
985
986
  React.useEffect(() => {
986
987
  if (!positionRefEl)
987
988
  return;
@@ -195,6 +195,7 @@ function useAutocompleteListNav({ navigableCount, shouldResetActiveIndexOnClose,
195
195
  return prev >= navigableCount ? navigableCount - 1 : prev;
196
196
  });
197
197
  }, [navigableCount, setActiveIndex, listRef]);
198
+ const setReferenceElement = useCallback((el) => refs.setReference(el), [refs]);
198
199
  return {
199
200
  refs,
200
201
  floatingStyles,
@@ -207,7 +208,7 @@ function useAutocompleteListNav({ navigableCount, shouldResetActiveIndexOnClose,
207
208
  listRef,
208
209
  open,
209
210
  setOpen,
210
- setReferenceElement: (el) => refs.setReference(el),
211
+ setReferenceElement,
211
212
  };
212
213
  }
213
214
 
@@ -966,7 +967,7 @@ function AutocompleteRebuiltInternal(props, forwardedRef) {
966
967
  disabled, readOnly: props.readOnly, error: error !== null && error !== void 0 ? error : undefined, name: props.name, invalid, autoComplete: "off", autoFocus: props.autoFocus, description, size: sizeProp ? sizeProp : undefined, prefix: props.prefix, suffix: props.suffix }), (props.readOnly ? {} : composedReferenceProps)), { role: "combobox", "aria-autocomplete": "list", "aria-expanded": open ? true : false, "aria-controls": listboxId, "aria-activedescendant": open && activeIndex != null
967
968
  ? `${listboxId}-item-${activeIndex}`
968
969
  : undefined }), dataAttrs);
969
- const referenceInputRef = (node) => {
970
+ const referenceInputRef = useCallback((node) => {
970
971
  setReferenceElement(node);
971
972
  // Workaround to get the width of the visual InputText element, which is not the same as
972
973
  // the literal input reference element when props like suffix/prefix/clearable are present.
@@ -975,11 +976,11 @@ function AutocompleteRebuiltInternal(props, forwardedRef) {
975
976
  setMenuWidth(visualInputTextElement.clientWidth);
976
977
  setPositionRefEl(visualInputTextElement);
977
978
  }
978
- };
979
- const mergedInputRef = mergeRefs([
979
+ }, [setReferenceElement]);
980
+ const mergedInputRef = useMemo(() => mergeRefs([
980
981
  referenceInputRef,
981
982
  forwardedRef,
982
- ]);
983
+ ]), [referenceInputRef, forwardedRef]);
983
984
  useEffect(() => {
984
985
  if (!positionRefEl)
985
986
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "6.111.1",
3
+ "version": "6.111.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": "c91a8c3de71324d43190997b0c397ccebd868c04"
541
+ "gitHead": "1baaa9f24017f50d12130e779b621a7c971723ef"
542
542
  }