@box/blueprint-web 6.13.0 → 6.14.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.
@@ -100,7 +100,14 @@ const RootInner = ({
100
100
  }
101
101
  return getSelectedOptionValues(valueProp);
102
102
  }, [getSelectedOptionValues, valueProp]);
103
+ const focusInput = useCallback(() => {
104
+ inputRef.current?.focus();
105
+ }, []);
103
106
  const setValue = newSelectedValue => {
107
+ // Move focus back to input for single selects
108
+ if (!Array.isArray(newSelectedValue)) {
109
+ focusInput();
110
+ }
104
111
  if (!onValueChange) {
105
112
  return;
106
113
  }
@@ -141,9 +148,6 @@ const RootInner = ({
141
148
  },
142
149
  // eslint-disable-next-line react-hooks/exhaustive-deps
143
150
  [displayAvatar]);
144
- const focusInput = useCallback(() => {
145
- inputRef.current?.focus();
146
- }, []);
147
151
  const renderSelectItemOption = useCallback(option => {
148
152
  const value = getOptionValue(option);
149
153
  return jsxs(OptionWithIndicator, {
@@ -162,10 +166,8 @@ const RootInner = ({
162
166
  setInputValue('');
163
167
  } else if (selectedValueMemoized) {
164
168
  setInputValue(getDisplayValueFromOptionValue(selectedValueMemoized));
165
- // Also focus input for single-select variant
166
- focusInput();
167
169
  }
168
- }, [selectedValueMemoized, getDisplayValueFromOptionValue, setInputValue, focusInput]);
170
+ }, [selectedValueMemoized, getDisplayValueFromOptionValue, setInputValue]);
169
171
  const handleKeyDown = useCallback(event => {
170
172
  // Close menu
171
173
  if (event.key === 'Enter' || event.key === 'Tab') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/blueprint-web",
3
- "version": "6.13.0",
3
+ "version": "6.14.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -57,7 +57,7 @@
57
57
  "devDependencies": {
58
58
  "@box/storybook-utils": "^0.0.3"
59
59
  },
60
- "gitHead": "a18d3250330a28468ca5786cd42eaf51d9281fe0",
60
+ "gitHead": "070975e63431ea3fc2f4f2d0cad78571a0533a5f",
61
61
  "module": "lib-esm/index.js",
62
62
  "main": "lib-esm/index.js",
63
63
  "exports": {