@gridsuite/commons-ui 0.20.0 → 0.20.3

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.
@@ -5,8 +5,6 @@ exports["default"] = void 0;
5
5
 
6
6
  var _react = _interopRequireWildcard(require("react"));
7
7
 
8
- var _makeStyles = _interopRequireDefault(require("@mui/styles/makeStyles"));
9
-
10
8
  var _material = require("@mui/material");
11
9
 
12
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
@@ -25,24 +23,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
25
23
 
26
24
  var TERM_MIN_SIZE_BEFORE_SEARCH = 3;
27
25
 
28
- var styles = function styles(theme) {
29
- return {
30
- title: {
31
- padding: '0px'
32
- },
33
- content: {
34
- display: 'flex',
35
- alignItems: 'end',
36
- padding: '20px',
37
- paddingRight: '0px'
38
- }
39
- };
40
- };
41
-
42
- var useStyles = (0, _makeStyles["default"])(styles);
43
-
44
26
  var ElementSearchDialog = function ElementSearchDialog(props) {
45
- var classes = useStyles();
46
27
  var intl = (0, _reactIntl.useIntl)();
47
28
  var open = props.open,
48
29
  onClose = props.onClose,
@@ -80,15 +61,18 @@ var ElementSearchDialog = function ElementSearchDialog(props) {
80
61
  }
81
62
  };
82
63
 
64
+ var handleClose = (0, _react.useCallback)(function () {
65
+ setExpanded(false);
66
+ setElements([]);
67
+ onClose();
68
+ }, [onClose]);
83
69
  return /*#__PURE__*/_react["default"].createElement(_material.Dialog, {
84
70
  open: open,
85
71
  onClose: onClose,
86
72
  disableRestoreFocus: true,
87
73
  "aria-labelledby": "dialog-title-search",
88
74
  fullWidth: true
89
- }, /*#__PURE__*/_react["default"].createElement(_material.DialogTitle, {
90
- className: classes.title
91
- }), /*#__PURE__*/_react["default"].createElement(_material.DialogContent, null, /*#__PURE__*/_react["default"].createElement(_material.Autocomplete, {
75
+ }, /*#__PURE__*/_react["default"].createElement(_material.DialogContent, null, /*#__PURE__*/_react["default"].createElement(_material.Autocomplete, {
92
76
  id: "element-search",
93
77
  forcePopupIcon: false,
94
78
  open: expanded,
@@ -99,10 +83,10 @@ var ElementSearchDialog = function ElementSearchDialog(props) {
99
83
  setExpanded(false);
100
84
  },
101
85
  fullWidth: true,
102
- onInputChange: function onInputChange(event, value) {
86
+ onInputChange: function onInputChange(_event, value) {
103
87
  return handleSearchTermChange(value);
104
88
  },
105
- onChange: function onChange(event, newValue) {
89
+ onChange: function onChange(_event, newValue) {
106
90
  return onSelectionChange(newValue);
107
91
  },
108
92
  getOptionLabel: function getOptionLabel(option) {
@@ -117,12 +101,13 @@ var ElementSearchDialog = function ElementSearchDialog(props) {
117
101
  noOptionsText: intl.formatMessage({
118
102
  id: 'element_search/noResult'
119
103
  }),
120
- renderOption: function renderOption(props, element, _ref) {
104
+ renderOption: function renderOption(optionProps, element, _ref) {
121
105
  var inputValue = _ref.inputValue;
122
- return renderElement(_extends({}, props, {
106
+ return renderElement(_extends({}, optionProps, {
123
107
  element: element,
124
108
  inputValue: inputValue,
125
- onClose: onClose
109
+ setExpanded: setExpanded,
110
+ onClose: handleClose
126
111
  }));
127
112
  },
128
113
  renderInput: function renderInput(params) {
@@ -47,7 +47,8 @@ var equipmentStyles = function equipmentStyles(theme) {
47
47
  fontStyle: 'italic'
48
48
  },
49
49
  result: {
50
- width: '100%'
50
+ width: '100%',
51
+ padding: '2px'
51
52
  }
52
53
  };
53
54
  }; // Must be equivalent as the back enum
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridsuite/commons-ui",
3
- "version": "0.20.0",
3
+ "version": "0.20.3",
4
4
  "description": "common react components for gridsuite applications",
5
5
  "main": "lib/index.js",
6
6
  "files": [