@sanity/ui 2.4.0 → 2.5.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 +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +11 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +11 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/core/components/autocomplete/autocomplete.tsx +14 -6
package/dist/index.js
CHANGED
|
@@ -4616,6 +4616,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
4616
4616
|
onQueryChange,
|
|
4617
4617
|
onSelect,
|
|
4618
4618
|
openButton,
|
|
4619
|
+
openOnFocus,
|
|
4619
4620
|
options: optionsProp,
|
|
4620
4621
|
padding: paddingProp = 3,
|
|
4621
4622
|
popover = EMPTY_RECORD,
|
|
@@ -4711,11 +4712,16 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
4711
4712
|
dispatch({ type: "input/change", query: nextQuery }), onQueryChange && onQueryChange(nextQuery);
|
|
4712
4713
|
},
|
|
4713
4714
|
[onQueryChange]
|
|
4714
|
-
),
|
|
4715
|
+
), dispatchOpen = react.useCallback(() => {
|
|
4716
|
+
dispatch({
|
|
4717
|
+
type: "root/open",
|
|
4718
|
+
query: value ? renderValue(value, currentOption) : ""
|
|
4719
|
+
});
|
|
4720
|
+
}, [currentOption, renderValue, value]), handleInputFocus = react.useCallback(
|
|
4715
4721
|
(event) => {
|
|
4716
|
-
focused || (dispatch({ type: "input/focus" }), onFocus && onFocus(event));
|
|
4722
|
+
focused || (dispatch({ type: "input/focus" }), onFocus && onFocus(event), openOnFocus && dispatchOpen());
|
|
4717
4723
|
},
|
|
4718
|
-
[focused, onFocus]
|
|
4724
|
+
[focused, onFocus, openOnFocus, dispatchOpen]
|
|
4719
4725
|
), handlePopoverMouseEnter = react.useCallback(() => {
|
|
4720
4726
|
popoverMouseWithinRef.current = !0;
|
|
4721
4727
|
}, []), handlePopoverMouseLeave = react.useCallback(() => {
|
|
@@ -4761,15 +4767,12 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
4761
4767
|
[openButton]
|
|
4762
4768
|
), handleOpenClick = react.useCallback(
|
|
4763
4769
|
(event) => {
|
|
4764
|
-
|
|
4765
|
-
type: "root/open",
|
|
4766
|
-
query: value ? renderValue(value, currentOption) : ""
|
|
4767
|
-
}), openButtonProps.onClick && openButtonProps.onClick(event), _raf(() => {
|
|
4770
|
+
dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event), _raf(() => {
|
|
4768
4771
|
var _a;
|
|
4769
4772
|
return (_a = inputElementRef.current) == null ? void 0 : _a.focus();
|
|
4770
4773
|
});
|
|
4771
4774
|
},
|
|
4772
|
-
[
|
|
4775
|
+
[openButtonProps, dispatchOpen]
|
|
4773
4776
|
), openButtonNode = react.useMemo(
|
|
4774
4777
|
() => !disabled && !readOnly && openButton ? /* @__PURE__ */ jsxRuntime.jsx(Box, { "aria-hidden": expanded, padding: openButtonBoxPadding, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4775
4778
|
Button,
|