@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.d.mts CHANGED
@@ -189,6 +189,8 @@ export declare interface AutocompleteProps<
189
189
  onSelect?: (value: string) => void
190
190
  /** @beta */
191
191
  openButton?: boolean | AutocompleteOpenButtonProps
192
+ /** @beta */
193
+ openOnFocus?: boolean
192
194
  /** The options to render. */
193
195
  options?: Option[]
194
196
  padding?: number | number[]
@@ -2121,6 +2123,10 @@ export declare const TextArea: ForwardRefExoticComponent<
2121
2123
  * @public
2122
2124
  */
2123
2125
  export declare interface TextAreaProps extends ResponsiveRadiusProps {
2126
+ /**
2127
+ * @beta
2128
+ */
2129
+ __unstable_disableFocusRing?: boolean
2124
2130
  border?: boolean
2125
2131
  customValidity?: string
2126
2132
  fontSize?: number | number[]
package/dist/index.d.ts CHANGED
@@ -189,6 +189,8 @@ export declare interface AutocompleteProps<
189
189
  onSelect?: (value: string) => void
190
190
  /** @beta */
191
191
  openButton?: boolean | AutocompleteOpenButtonProps
192
+ /** @beta */
193
+ openOnFocus?: boolean
192
194
  /** The options to render. */
193
195
  options?: Option[]
194
196
  padding?: number | number[]
@@ -2121,6 +2123,10 @@ export declare const TextArea: ForwardRefExoticComponent<
2121
2123
  * @public
2122
2124
  */
2123
2125
  export declare interface TextAreaProps extends ResponsiveRadiusProps {
2126
+ /**
2127
+ * @beta
2128
+ */
2129
+ __unstable_disableFocusRing?: boolean
2124
2130
  border?: boolean
2125
2131
  customValidity?: string
2126
2132
  fontSize?: number | number[]
package/dist/index.esm.js CHANGED
@@ -3986,6 +3986,7 @@ const Root$d = styled.span(switchBaseStyles), Input$2 = styled.input(switchInput
3986
3986
  padding = 3,
3987
3987
  radius = 2,
3988
3988
  weight,
3989
+ __unstable_disableFocusRing,
3989
3990
  ...restProps
3990
3991
  } = props, ref = useRef(null), rootTheme = useRootTheme();
3991
3992
  return useImperativeHandle(
@@ -4013,6 +4014,7 @@ const Root$d = styled.span(switchBaseStyles), Input$2 = styled.input(switchInput
4013
4014
  Presentation$1,
4014
4015
  {
4015
4016
  $radius: useArrayProp(radius),
4017
+ $unstableDisableFocusRing: __unstable_disableFocusRing,
4016
4018
  $scheme: rootTheme.scheme,
4017
4019
  $tone: rootTheme.tone,
4018
4020
  "data-border": border2 ? "" : void 0,
@@ -4620,6 +4622,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
4620
4622
  onQueryChange,
4621
4623
  onSelect,
4622
4624
  openButton,
4625
+ openOnFocus,
4623
4626
  options: optionsProp,
4624
4627
  padding: paddingProp = 3,
4625
4628
  popover = EMPTY_RECORD,
@@ -4715,11 +4718,16 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
4715
4718
  dispatch({ type: "input/change", query: nextQuery }), onQueryChange && onQueryChange(nextQuery);
4716
4719
  },
4717
4720
  [onQueryChange]
4718
- ), handleInputFocus = useCallback(
4721
+ ), dispatchOpen = useCallback(() => {
4722
+ dispatch({
4723
+ type: "root/open",
4724
+ query: value ? renderValue(value, currentOption) : ""
4725
+ });
4726
+ }, [currentOption, renderValue, value]), handleInputFocus = useCallback(
4719
4727
  (event) => {
4720
- focused || (dispatch({ type: "input/focus" }), onFocus && onFocus(event));
4728
+ focused || (dispatch({ type: "input/focus" }), onFocus && onFocus(event), openOnFocus && dispatchOpen());
4721
4729
  },
4722
- [focused, onFocus]
4730
+ [focused, onFocus, openOnFocus, dispatchOpen]
4723
4731
  ), handlePopoverMouseEnter = useCallback(() => {
4724
4732
  popoverMouseWithinRef.current = !0;
4725
4733
  }, []), handlePopoverMouseLeave = useCallback(() => {
@@ -4765,15 +4773,12 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
4765
4773
  [openButton]
4766
4774
  ), handleOpenClick = useCallback(
4767
4775
  (event) => {
4768
- dispatch({
4769
- type: "root/open",
4770
- query: value ? renderValue(value, currentOption) : ""
4771
- }), openButtonProps.onClick && openButtonProps.onClick(event), _raf(() => {
4776
+ dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event), _raf(() => {
4772
4777
  var _a;
4773
4778
  return (_a = inputElementRef.current) == null ? void 0 : _a.focus();
4774
4779
  });
4775
4780
  },
4776
- [currentOption, openButtonProps, renderValue, value]
4781
+ [openButtonProps, dispatchOpen]
4777
4782
  ), openButtonNode = useMemo(
4778
4783
  () => !disabled && !readOnly && openButton ? /* @__PURE__ */ jsx(Box, { "aria-hidden": expanded, padding: openButtonBoxPadding, children: /* @__PURE__ */ jsx(
4779
4784
  Button,