@homecode/ui 4.18.67 → 4.18.69

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.
@@ -254,8 +254,9 @@ class Select extends Component {
254
254
  this.store.isOpen = !this.store.isOpen;
255
255
  };
256
256
  setSearchVal(searchVal) {
257
- this.searchValLower = searchVal.toLowerCase();
258
- this.store.searchVal = searchVal;
257
+ const searchString = String(searchVal);
258
+ this.searchValLower = searchString.toLowerCase();
259
+ this.store.searchVal = searchString;
259
260
  }
260
261
  getItems = () => [...this.props.additionalOptions, ...this.optionsTree];
261
262
  getItem = id => this.ids.items[id];
@@ -376,10 +377,15 @@ class Select extends Component {
376
377
  return null;
377
378
  }
378
379
  getInputVal() {
379
- const { isFocused, selected } = this.store;
380
+ const { value, options } = this.props;
381
+ const { isFocused, selected, isOpen } = this.store;
380
382
  const searchValue = this.props.searchValue ?? this.store.searchVal;
381
- if (isFocused)
382
- return searchValue ?? '';
383
+ if (isFocused) {
384
+ if (isOpen)
385
+ return searchValue ?? '';
386
+ if (value)
387
+ return value;
388
+ }
383
389
  const selectedPlain = Object.entries(selected).reduce((acc, entry) => {
384
390
  const parentId = this.coerceType(entry[0]);
385
391
  const val = entry[1];
@@ -393,9 +399,10 @@ class Select extends Component {
393
399
  }
394
400
  return acc;
395
401
  }, []);
396
- if (selectedPlain.length === 0)
397
- return searchValue;
398
- return selectedPlain.map(id => this.getItem(id)?.label).join(', ');
402
+ if (selectedPlain.length > 0) {
403
+ return selectedPlain.map(id => this.getItem(id)?.label).join(', ');
404
+ }
405
+ return searchValue;
399
406
  }
400
407
  getLabel(id) {
401
408
  const { label, render } = Object(this.getItem(id));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homecode/ui",
3
- "version": "4.18.67",
3
+ "version": "4.18.69",
4
4
  "description": "React UI components library",
5
5
  "scripts": {
6
6
  "test": "jest",