@homebound/beam 2.377.1 → 2.377.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.
@@ -62,7 +62,6 @@ export type DateFilter = NonNullable<FilterDefs<ProjectFilter>["date"]>;
62
62
  export type DateRangeFilter = NonNullable<FilterDefs<ProjectFilter>["dateRange"]>;
63
63
  export declare const stageFilter: StageFilter;
64
64
  export declare const stageFilterDisabledOptions: StageFilter;
65
- export declare const stageOnSearch: StageFilter;
66
65
  export declare const stageSingleFilter: StageSingleFilter;
67
66
  export declare const stageFilterWithNothingSelectedText: StageSingleFilter;
68
67
  export declare const taskDueFilter: DateFilter;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ScheduleTypes = exports.TaskStatus = exports.taskCompleteFilter = exports.taskDueFilter = exports.stageFilterWithNothingSelectedText = exports.stageSingleFilter = exports.stageOnSearch = exports.stageFilterDisabledOptions = exports.stageFilter = exports.Stage = void 0;
3
+ exports.ScheduleTypes = exports.TaskStatus = exports.taskCompleteFilter = exports.taskDueFilter = exports.stageFilterWithNothingSelectedText = exports.stageSingleFilter = exports.stageFilterDisabledOptions = exports.stageFilter = exports.Stage = void 0;
4
4
  const DateFilter_1 = require("./DateFilter");
5
5
  const DateRangeFilter_1 = require("./DateRangeFilter");
6
6
  const MultiFilter_1 = require("./MultiFilter");
@@ -25,12 +25,6 @@ exports.stageFilterDisabledOptions = (0, MultiFilter_1.multiFilter)({
25
25
  getOptionLabel: (s) => s.name,
26
26
  disabledOptions: [{ value: Stage.StageOne, reason: "I have a reason to be disabled." }, Stage.StageTwo],
27
27
  });
28
- exports.stageOnSearch = (0, MultiFilter_1.multiFilter)({
29
- options: stageOptions,
30
- getOptionValue: (s) => s.code,
31
- getOptionLabel: (s) => s.name,
32
- onSearch: () => { },
33
- });
34
28
  exports.stageSingleFilter = (0, SingleFilter_1.singleFilter)({
35
29
  options: stageOptions,
36
30
  getOptionValue: (s) => s.code,
@@ -191,11 +191,18 @@ function ComboBoxBase(props) {
191
191
  const [debouncedSearch] = (0, use_debounce_1.useDebounce)(searchValue, 300);
192
192
  // Reset inputValue when closed or selected changes
193
193
  (0, react_1.useEffect)(() => {
194
- // if we are using the onSearch functionality with debounceSearch, we don't want to reset the input value
195
- if (onSearch && debouncedSearch)
196
- return;
197
- if (state.isOpen && multiselect) {
198
- // While the multiselect is open, let the user keep typing
194
+ if (state.isOpen && multiselect && !debouncedSearch) {
195
+ // When a single-select is open, with "inputValue=Blue", when "Blue" is actually
196
+ // selected (our value changes), the box will close immediately, so the inputValue
197
+ // will get reset in the `!isOpen` case.
198
+ //
199
+ // When a multi-select is open, with "inputValue=Blue", when "Blue" is actually
200
+ // selected (our value changes), we leave the box open, and we want to reset
201
+ // the "inputValue=(empty) so the user can now type "inputType=Green".
202
+ //
203
+ // ...unless the multi-select is using onSearch, in which case we want to let them
204
+ // only explicitly trigger a new `onSearch` by changing the existing inputValue,
205
+ // i.e. they might want to keep typing "Blueish".
199
206
  setFieldState((prevState) => ({
200
207
  ...prevState,
201
208
  inputValue: "",
@@ -209,16 +216,7 @@ function ComboBoxBase(props) {
209
216
  inputValue: getInputValue(selectedOptions, getOptionLabel, multiselect, nothingSelectedText, isReadOnly),
210
217
  }));
211
218
  }
212
- }, [
213
- state.isOpen,
214
- selectedOptions,
215
- getOptionLabel,
216
- multiselect,
217
- nothingSelectedText,
218
- isReadOnly,
219
- onSearch,
220
- debouncedSearch,
221
- ]);
219
+ }, [state.isOpen, selectedOptions, getOptionLabel, multiselect, nothingSelectedText, isReadOnly, debouncedSearch]);
222
220
  // Call on search callback when the user types in the input field
223
221
  (0, react_1.useEffect)(() => {
224
222
  onSearch === null || onSearch === void 0 ? void 0 : onSearch(debouncedSearch !== null && debouncedSearch !== void 0 ? debouncedSearch : "");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.377.1",
3
+ "version": "2.377.2",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",