@sanity/ui 2.4.0 → 2.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/index.js CHANGED
@@ -3982,6 +3982,7 @@ const Root$d = styledComponents.styled.span(switchBaseStyles), Input$2 = styledC
3982
3982
  padding = 3,
3983
3983
  radius = 2,
3984
3984
  weight,
3985
+ __unstable_disableFocusRing,
3985
3986
  ...restProps
3986
3987
  } = props, ref = react.useRef(null), rootTheme = useRootTheme();
3987
3988
  return react.useImperativeHandle(
@@ -4009,6 +4010,7 @@ const Root$d = styledComponents.styled.span(switchBaseStyles), Input$2 = styledC
4009
4010
  Presentation$1,
4010
4011
  {
4011
4012
  $radius: useArrayProp(radius),
4013
+ $unstableDisableFocusRing: __unstable_disableFocusRing,
4012
4014
  $scheme: rootTheme.scheme,
4013
4015
  $tone: rootTheme.tone,
4014
4016
  "data-border": border2 ? "" : void 0,
@@ -4616,6 +4618,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
4616
4618
  onQueryChange,
4617
4619
  onSelect,
4618
4620
  openButton,
4621
+ openOnFocus,
4619
4622
  options: optionsProp,
4620
4623
  padding: paddingProp = 3,
4621
4624
  popover = EMPTY_RECORD,
@@ -4711,11 +4714,16 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
4711
4714
  dispatch({ type: "input/change", query: nextQuery }), onQueryChange && onQueryChange(nextQuery);
4712
4715
  },
4713
4716
  [onQueryChange]
4714
- ), handleInputFocus = react.useCallback(
4717
+ ), dispatchOpen = react.useCallback(() => {
4718
+ dispatch({
4719
+ type: "root/open",
4720
+ query: value ? renderValue(value, currentOption) : ""
4721
+ });
4722
+ }, [currentOption, renderValue, value]), handleInputFocus = react.useCallback(
4715
4723
  (event) => {
4716
- focused || (dispatch({ type: "input/focus" }), onFocus && onFocus(event));
4724
+ focused || (dispatch({ type: "input/focus" }), onFocus && onFocus(event), openOnFocus && dispatchOpen());
4717
4725
  },
4718
- [focused, onFocus]
4726
+ [focused, onFocus, openOnFocus, dispatchOpen]
4719
4727
  ), handlePopoverMouseEnter = react.useCallback(() => {
4720
4728
  popoverMouseWithinRef.current = !0;
4721
4729
  }, []), handlePopoverMouseLeave = react.useCallback(() => {
@@ -4761,15 +4769,12 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
4761
4769
  [openButton]
4762
4770
  ), handleOpenClick = react.useCallback(
4763
4771
  (event) => {
4764
- dispatch({
4765
- type: "root/open",
4766
- query: value ? renderValue(value, currentOption) : ""
4767
- }), openButtonProps.onClick && openButtonProps.onClick(event), _raf(() => {
4772
+ dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event), _raf(() => {
4768
4773
  var _a;
4769
4774
  return (_a = inputElementRef.current) == null ? void 0 : _a.focus();
4770
4775
  });
4771
4776
  },
4772
- [currentOption, openButtonProps, renderValue, value]
4777
+ [openButtonProps, dispatchOpen]
4773
4778
  ), openButtonNode = react.useMemo(
4774
4779
  () => !disabled && !readOnly && openButton ? /* @__PURE__ */ jsxRuntime.jsx(Box, { "aria-hidden": expanded, padding: openButtonBoxPadding, children: /* @__PURE__ */ jsxRuntime.jsx(
4775
4780
  Button,