react-asc 21.0.5 → 21.0.6

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.
@@ -11,7 +11,6 @@ export interface IAutoCompleteProps {
11
11
  placeholder?: string;
12
12
  readOnly?: boolean;
13
13
  debounce?: number;
14
- showNoEntry?: boolean;
15
14
  showClearButton?: boolean;
16
15
  onSelect?: (val: ISelectOption) => void;
17
16
  onChange?: (val: string | undefined) => void;
package/index.es.js CHANGED
@@ -398,11 +398,11 @@ styleInject(css_248z$Q);
398
398
  // multiple
399
399
  // custom template render items
400
400
  const AutoComplete = (props) => {
401
- const { id, name, className, options = [], openOnFocus = true, disabled, readOnly, debounce = 0, placeholder, showNoEntry = true, showClearButton, onChange, onSelect, value } = props;
401
+ const { id, name, className, options = [], openOnFocus = true, disabled, readOnly, debounce = 0, placeholder, showClearButton, onChange, onSelect, value } = props;
402
402
  const [model, setModel] = useState('');
403
403
  const [searchText, setSearchText] = useState('');
404
404
  const [isShow, setIsShow] = useState(false);
405
- const [optionsTemp, setOptionsTemp] = useState([]);
405
+ const [_options, setOptions] = useState([]);
406
406
  const selectConainter = useRef(null);
407
407
  useEffect(() => {
408
408
  if (value !== model) {
@@ -411,12 +411,7 @@ const AutoComplete = (props) => {
411
411
  }
412
412
  }, [value]);
413
413
  useEffect(() => {
414
- if (options.length === 0 && showNoEntry) {
415
- setOptionsTemp([{ value: '', label: '- no entry found -' }]);
416
- }
417
- else {
418
- setOptionsTemp(options);
419
- }
414
+ setOptions(options);
420
415
  }, [options]);
421
416
  useDebounce(() => { onChange && onChange(searchText); }, debounce, [searchText]);
422
417
  useEffect(() => {
@@ -473,7 +468,7 @@ const AutoComplete = (props) => {
473
468
  isShow &&
474
469
  React.createElement(React.Fragment, null,
475
470
  React.createElement("div", { className: styles$Q.selectMenu },
476
- React.createElement(List, null, optionsTemp && optionsTemp.map((option, index) => React.createElement(ListItem, { id: `list-item-${index}`, key: option.value, onClick: () => handleOnClick(option), disabled: !option.value },
471
+ React.createElement(List, null, _options && _options.map((option, index) => React.createElement(ListItem, { id: `list-item-${index}`, key: option.value, onClick: () => handleOnClick(option), disabled: !option.value },
477
472
  React.createElement(ListItemText, { primary: option.label ? option.label : option.value }))))),
478
473
  React.createElement(Backdrop, { isTransparent: true, onClick: () => hide() }))));
479
474
  };
package/index.js CHANGED
@@ -406,11 +406,11 @@ styleInject(css_248z$Q);
406
406
  // multiple
407
407
  // custom template render items
408
408
  const AutoComplete = (props) => {
409
- const { id, name, className, options = [], openOnFocus = true, disabled, readOnly, debounce = 0, placeholder, showNoEntry = true, showClearButton, onChange, onSelect, value } = props;
409
+ const { id, name, className, options = [], openOnFocus = true, disabled, readOnly, debounce = 0, placeholder, showClearButton, onChange, onSelect, value } = props;
410
410
  const [model, setModel] = React.useState('');
411
411
  const [searchText, setSearchText] = React.useState('');
412
412
  const [isShow, setIsShow] = React.useState(false);
413
- const [optionsTemp, setOptionsTemp] = React.useState([]);
413
+ const [_options, setOptions] = React.useState([]);
414
414
  const selectConainter = React.useRef(null);
415
415
  React.useEffect(() => {
416
416
  if (value !== model) {
@@ -419,12 +419,7 @@ const AutoComplete = (props) => {
419
419
  }
420
420
  }, [value]);
421
421
  React.useEffect(() => {
422
- if (options.length === 0 && showNoEntry) {
423
- setOptionsTemp([{ value: '', label: '- no entry found -' }]);
424
- }
425
- else {
426
- setOptionsTemp(options);
427
- }
422
+ setOptions(options);
428
423
  }, [options]);
429
424
  useDebounce(() => { onChange && onChange(searchText); }, debounce, [searchText]);
430
425
  React.useEffect(() => {
@@ -481,7 +476,7 @@ const AutoComplete = (props) => {
481
476
  isShow &&
482
477
  React__default["default"].createElement(React__default["default"].Fragment, null,
483
478
  React__default["default"].createElement("div", { className: styles$Q.selectMenu },
484
- React__default["default"].createElement(List, null, optionsTemp && optionsTemp.map((option, index) => React__default["default"].createElement(ListItem, { id: `list-item-${index}`, key: option.value, onClick: () => handleOnClick(option), disabled: !option.value },
479
+ React__default["default"].createElement(List, null, _options && _options.map((option, index) => React__default["default"].createElement(ListItem, { id: `list-item-${index}`, key: option.value, onClick: () => handleOnClick(option), disabled: !option.value },
485
480
  React__default["default"].createElement(ListItemText, { primary: option.label ? option.label : option.value }))))),
486
481
  React__default["default"].createElement(Backdrop, { isTransparent: true, onClick: () => hide() }))));
487
482
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-asc",
3
- "version": "21.0.5",
3
+ "version": "21.0.6",
4
4
  "description": "handcrafted react components",
5
5
  "main": "index.js",
6
6
  "module": "index.es.js",