@homecode/ui 4.18.61 → 4.18.63

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.
@@ -45,6 +45,7 @@ var ICONS = {
45
45
  undo: () => import('./undo.svg.js'),
46
46
  requiredStar: () => import('./requiredStar.svg.js'),
47
47
  rewind: () => import('./rewind.svg.js'),
48
+ route: () => import('./route.svg.js'),
48
49
  save: () => import('./save.svg.js'),
49
50
  search: () => import('./search.svg.js'),
50
51
  send: () => import('./send.svg.js'),
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+
3
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+ var SvgRoute = function SvgRoute(props) {
5
+ return /*#__PURE__*/React.createElement("svg", _extends({
6
+ xmlns: "http://www.w3.org/2000/svg",
7
+ fill: "currentColor",
8
+ viewBox: "0 0 24 24"
9
+ }, props), /*#__PURE__*/React.createElement("path", {
10
+ d: "M8.13 23.706q-2.144 0-3.67-1.526-1.528-1.526-1.528-3.67V7.895q-1.137-.422-1.867-1.412-.731-.99-.731-2.257 0-1.623 1.137-2.76T4.23.33t2.762 1.136 1.137 2.76q0 1.266-.731 2.257-.731.99-1.868 1.412V18.51q0 1.071.763 1.834.764.763 1.836.763t1.835-.763q.763-.763.763-1.834V5.524q0-2.143 1.527-3.669t3.67-1.526q2.145 0 3.672 1.526 1.526 1.526 1.526 3.669V16.14q1.137.422 1.868 1.412t.731 2.257q0 1.623-1.137 2.76t-2.761 1.136-2.761-1.137-1.137-2.76q0-1.266.73-2.272.732-1.007 1.869-1.396V5.524q0-1.072-.764-1.835-.763-.763-1.835-.763t-1.835.763q-.764.763-.764 1.835V18.51q0 2.143-1.527 3.669t-3.67 1.526M4.232 5.524q.552 0 .926-.374.373-.373.373-.925T5.158 3.3t-.926-.374-.926.374-.374.925.374.925.926.374m15.592 15.584q.552 0 .926-.373.373-.374.373-.925 0-.552-.373-.926-.374-.373-.926-.373t-.926.373-.373.926.373.925.926.373m0-1.298",
11
+ style: {
12
+ strokeWidth: 0.0324755
13
+ }
14
+ }));
15
+ };
16
+
17
+ export { SvgRoute as default };
@@ -61,10 +61,13 @@ class Select extends Component {
61
61
  });
62
62
  }
63
63
  componentDidUpdate(prevProps) {
64
- const { options, value } = this.props;
64
+ const { options, value, searchValue } = this.props;
65
65
  if (!compare(value, prevProps.value)) {
66
66
  this.store.selected = this.getDefaultSelected();
67
67
  }
68
+ if (!compare(searchValue, prevProps.searchValue)) {
69
+ this.setSearchVal(searchValue);
70
+ }
68
71
  if (!compare(options, prevProps.options)) {
69
72
  this.onOptionsChange();
70
73
  }
@@ -193,7 +196,6 @@ class Select extends Component {
193
196
  unDocumentClick = () => document.removeEventListener('click', this.onDocumentClick);
194
197
  onFocus = e => {
195
198
  const { onFocus } = this.props;
196
- this.setSearchVal('');
197
199
  this.store.isFocused = true;
198
200
  onFocus?.(e);
199
201
  };
@@ -374,9 +376,10 @@ class Select extends Component {
374
376
  return null;
375
377
  }
376
378
  getInputVal() {
377
- const { isFocused, searchVal, selected } = this.store;
378
- if (isFocused && searchVal)
379
- return searchVal;
379
+ const { isFocused, selected } = this.store;
380
+ const searchValue = this.props.searchValue ?? this.store.searchVal;
381
+ if (isFocused && searchValue)
382
+ return searchValue;
380
383
  const selectedPlain = Object.entries(selected).reduce((acc, entry) => {
381
384
  const parentId = this.coerceType(entry[0]);
382
385
  const val = entry[1];
@@ -390,6 +393,8 @@ class Select extends Component {
390
393
  }
391
394
  return acc;
392
395
  }, []);
396
+ if (selectedPlain.length === 0)
397
+ return searchValue;
393
398
  return selectedPlain.map(id => this.getItem(id)?.label).join(', ');
394
399
  }
395
400
  getLabel(id) {
@@ -46,6 +46,7 @@ export declare const icons: {
46
46
  undo: () => Promise<any>;
47
47
  requiredStar: () => Promise<any>;
48
48
  rewind: () => Promise<any>;
49
+ route: () => Promise<any>;
49
50
  save: () => Promise<any>;
50
51
  search: () => Promise<any>;
51
52
  send: () => Promise<any>;
@@ -45,6 +45,7 @@ declare const _default: {
45
45
  undo: () => Promise<any>;
46
46
  requiredStar: () => Promise<any>;
47
47
  rewind: () => Promise<any>;
48
+ route: () => Promise<any>;
48
49
  save: () => Promise<any>;
49
50
  search: () => Promise<any>;
50
51
  send: () => Promise<any>;
@@ -44,6 +44,7 @@ export type Props = FormControl<Value> & InheritedInputProps & {
44
44
  clearButton?: boolean;
45
45
  selectAllButton?: boolean;
46
46
  value?: Value;
47
+ searchValue?: string;
47
48
  expandSelected?: boolean;
48
49
  onChange: (value: Value) => void;
49
50
  onSeachChange?: (value: string) => void;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homecode/ui",
3
- "version": "4.18.61",
3
+ "version": "4.18.63",
4
4
  "description": "React UI components library",
5
5
  "scripts": {
6
6
  "test": "jest",
package/test_output.log DELETED
@@ -1,16 +0,0 @@
1
- ! Corepack is about to download https://registry.yarnpkg.com/yarn/-/yarn-1.22.22.tgz
2
- yarn run v1.22.22
3
- $ jest
4
- ts-jest[ts-jest-transformer] (WARN) Define `ts-jest` config under `globals` is deprecated. Please do
5
- transform: {
6
- <transform_regex>: ['ts-jest', { /* ts-jest config goes here in Jest */ }],
7
- },
8
- See more at https://kulshekhar.github.io/ts-jest/docs/getting-started/presets#advanced
9
- ts-jest[ts-jest-transformer] (WARN) Define `ts-jest` config under `globals` is deprecated. Please do
10
- transform: {
11
- <transform_regex>: ['ts-jest', { /* ts-jest config goes here in Jest */ }],
12
- },
13
- See more at https://kulshekhar.github.io/ts-jest/docs/getting-started/presets#advanced
14
- Terminated
15
- error Command failed with exit code 143.
16
- info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.