linear-react-components-ui 1.1.2-beta.9 → 1.1.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.
Files changed (183) hide show
  1. package/.eslintcache +1 -0
  2. package/.gitlab-ci.yml +1 -0
  3. package/.vscode/settings.json +10 -1
  4. package/lib/@types/Align.d.ts +1 -1
  5. package/lib/@types/ButtonTypes.d.ts +1 -1
  6. package/lib/@types/ColorStyles.d.ts +1 -1
  7. package/lib/@types/DataCombo.d.ts +1 -1
  8. package/lib/@types/Icon.d.ts +1 -1
  9. package/lib/@types/LabelStyles.d.ts +1 -1
  10. package/lib/@types/Period.d.ts +1 -1
  11. package/lib/@types/PermissionAttr.d.ts +1 -1
  12. package/lib/@types/PointerEvents.d.ts +1 -1
  13. package/lib/@types/Position.d.ts +1 -1
  14. package/lib/@types/PositionAlert.d.ts +1 -1
  15. package/lib/@types/Size.d.ts +1 -1
  16. package/lib/@types/SizePixels.d.ts +2 -2
  17. package/lib/@types/StorageMock.d.ts +1 -1
  18. package/lib/alerts/types.d.ts +1 -1
  19. package/lib/assets/styles/checkbox.scss +45 -38
  20. package/lib/assets/styles/colors.scss +3 -1
  21. package/lib/assets/styles/commons.scss +1 -0
  22. package/lib/assets/styles/dialog.scss +27 -10
  23. package/lib/assets/styles/error.scss +9 -0
  24. package/lib/assets/styles/fieldset.scss +3 -0
  25. package/lib/assets/styles/gridlayout.scss +0 -2
  26. package/lib/assets/styles/hint.scss +21 -0
  27. package/lib/assets/styles/icon.scss +4 -31
  28. package/lib/assets/styles/input.scss +7 -7
  29. package/lib/assets/styles/multiSelect.scss +6 -1
  30. package/lib/assets/styles/radio.scss +37 -35
  31. package/lib/assets/styles/select.scss +13 -7
  32. package/lib/assets/styles/tabs.scss +3 -0
  33. package/lib/avatar/types.d.ts +1 -1
  34. package/lib/badge/types.d.ts +1 -1
  35. package/lib/buttons/types.d.ts +1 -1
  36. package/lib/calendar/types.d.ts +1 -1
  37. package/lib/checkbox/Label.js +13 -4
  38. package/lib/checkbox/index.d.ts +2 -2
  39. package/lib/checkbox/index.js +22 -17
  40. package/lib/checkbox/types.d.ts +3 -2
  41. package/lib/dialog/base/Content.js +1 -0
  42. package/lib/dialog/base/Header.js +4 -4
  43. package/lib/dialog/base/index.js +9 -6
  44. package/lib/dialog/types.d.ts +1 -1
  45. package/lib/drawer/Drawer.js +5 -4
  46. package/lib/drawer/Header.js +1 -1
  47. package/lib/drawer/types.d.ts +1 -1
  48. package/lib/dropdown/Popup.d.ts +1 -1
  49. package/lib/dropdown/Popup.js +5 -2
  50. package/lib/dropdown/types.d.ts +2 -1
  51. package/lib/fieldset/index.js +4 -2
  52. package/lib/fieldset/types.d.ts +3 -1
  53. package/lib/form/Field.d.ts +3 -1
  54. package/lib/form/FieldArray.d.ts +2 -0
  55. package/lib/form/FieldNumber.d.ts +2 -0
  56. package/lib/form/FieldPeriod.d.ts +2 -0
  57. package/lib/form/helpers.d.ts +2 -0
  58. package/lib/form/index.d.ts +2 -0
  59. package/lib/form/types.d.ts +3 -1
  60. package/lib/form/withFieldHOC.d.ts +2 -0
  61. package/lib/form/withFormSecurity.d.ts +2 -0
  62. package/lib/gridlayout/GridRow.js +10 -2
  63. package/lib/gridlayout/types.d.ts +2 -2
  64. package/lib/hint/helpers.d.ts +3 -0
  65. package/lib/hint/helpers.js +21 -0
  66. package/lib/hint/index.d.ts +2 -1
  67. package/lib/hint/index.js +9 -15
  68. package/lib/hint/types.d.ts +4 -1
  69. package/lib/icons/helper.d.ts +4 -0
  70. package/lib/icons/helper.js +5 -1
  71. package/lib/icons/index.d.ts +2 -3
  72. package/lib/icons/index.js +3 -10
  73. package/lib/icons/types.d.ts +9 -22
  74. package/lib/index.d.ts +0 -1
  75. package/lib/inputs/base/InputTextBase.d.ts +2 -0
  76. package/lib/inputs/base/InputTextBase.js +54 -8
  77. package/lib/inputs/base/Label.d.ts +14 -0
  78. package/lib/inputs/base/Label.js +35 -0
  79. package/lib/inputs/base/helpers.d.ts +3 -2
  80. package/lib/inputs/base/helpers.js +1 -8
  81. package/lib/inputs/base/types.d.ts +15 -2
  82. package/lib/inputs/color/types.d.ts +1 -1
  83. package/lib/inputs/date/Dialog.d.ts +2 -0
  84. package/lib/inputs/date/Dropdown.d.ts +2 -0
  85. package/lib/inputs/date/helpers.d.ts +2 -0
  86. package/lib/inputs/date/index.d.ts +2 -0
  87. package/lib/inputs/date/index.js +2 -0
  88. package/lib/inputs/date/types.d.ts +4 -1
  89. package/lib/inputs/errorMessage/index.d.ts +17 -0
  90. package/lib/inputs/errorMessage/index.js +26 -0
  91. package/lib/inputs/file/DefaultFile.d.ts +2 -0
  92. package/lib/inputs/file/DefaultFile.js +4 -2
  93. package/lib/inputs/file/DragDropFile.d.ts +2 -0
  94. package/lib/inputs/file/DragDropFile.js +4 -2
  95. package/lib/inputs/file/File.d.ts +2 -0
  96. package/lib/inputs/file/FileButtonSettings.d.ts +2 -0
  97. package/lib/inputs/file/helpers.d.ts +2 -0
  98. package/lib/inputs/file/index.d.ts +2 -0
  99. package/lib/inputs/file/types.d.ts +3 -1
  100. package/lib/inputs/inputHOC.d.ts +3 -1
  101. package/lib/inputs/mask/BaseMask.d.ts +3 -0
  102. package/lib/inputs/mask/Cnpj.d.ts +3 -0
  103. package/lib/inputs/mask/Cpf.d.ts +3 -0
  104. package/lib/inputs/mask/Phone.d.ts +3 -0
  105. package/lib/inputs/mask/ZipCode.d.ts +3 -0
  106. package/lib/inputs/mask/helpers.d.ts +2 -1
  107. package/lib/inputs/mask/imaskHOC.d.ts +3 -1
  108. package/lib/inputs/mask/index.d.ts +3 -0
  109. package/lib/inputs/mask/types.d.ts +6 -2
  110. package/lib/inputs/multiSelect/ActionButtons.d.ts +2 -0
  111. package/lib/inputs/multiSelect/ActionButtons.js +10 -8
  112. package/lib/inputs/multiSelect/Dropdown.d.ts +2 -0
  113. package/lib/inputs/multiSelect/Dropdown.js +2 -6
  114. package/lib/inputs/multiSelect/helper.d.ts +2 -0
  115. package/lib/inputs/multiSelect/index.d.ts +2 -0
  116. package/lib/inputs/multiSelect/types.d.ts +3 -1
  117. package/lib/inputs/number/BaseNumber.d.ts +3 -1
  118. package/lib/inputs/number/Currency.d.ts +3 -1
  119. package/lib/inputs/number/Decimal.d.ts +3 -1
  120. package/lib/inputs/number/index.d.ts +3 -1
  121. package/lib/inputs/number/types.d.ts +4 -2
  122. package/lib/inputs/period/Dialog.d.ts +2 -0
  123. package/lib/inputs/period/Dropdown.d.ts +2 -0
  124. package/lib/inputs/period/PeriodList.d.ts +2 -0
  125. package/lib/inputs/period/helper.d.ts +2 -0
  126. package/lib/inputs/period/index.d.ts +2 -0
  127. package/lib/inputs/period/index.js +4 -1
  128. package/lib/inputs/period/types.d.ts +3 -1
  129. package/lib/inputs/search/index.d.ts +3 -1
  130. package/lib/inputs/select/ActionButtons.d.ts +3 -1
  131. package/lib/inputs/select/ActionButtons.js +18 -27
  132. package/lib/inputs/select/Dropdown.d.ts +3 -1
  133. package/lib/inputs/select/Dropdown.js +2 -6
  134. package/lib/inputs/select/helper.d.ts +3 -1
  135. package/lib/inputs/select/index.d.ts +2 -0
  136. package/lib/inputs/select/multiple/Selecteds.d.ts +3 -1
  137. package/lib/inputs/select/multiple/Selecteds.js +3 -5
  138. package/lib/inputs/select/multiple/index.d.ts +2 -0
  139. package/lib/inputs/select/multiple/index.js +38 -19
  140. package/lib/inputs/select/simple/index.d.ts +2 -0
  141. package/lib/inputs/select/simple/index.js +60 -31
  142. package/lib/inputs/select/types.d.ts +6 -3
  143. package/lib/inputs/text/types.d.ts +1 -1
  144. package/lib/inputs/textarea/index.d.ts +2 -0
  145. package/lib/inputs/textarea/types.d.ts +3 -1
  146. package/lib/inputs/types.d.ts +12 -5
  147. package/lib/internals/types.d.ts +1 -1
  148. package/lib/internals/withTooltip.js +7 -3
  149. package/lib/labelMessages/types.d.ts +1 -1
  150. package/lib/labels/types.d.ts +1 -1
  151. package/lib/list/types.d.ts +1 -1
  152. package/lib/menus/float/index.d.ts +10 -10
  153. package/lib/menus/float/types.d.ts +2 -2
  154. package/lib/menus/sidenav/popup_menu_search/index.js +4 -3
  155. package/lib/menus/sidenav/types.d.ts +2 -2
  156. package/lib/panel/types.d.ts +1 -1
  157. package/lib/popover/types.d.ts +1 -1
  158. package/lib/progress/types.d.ts +1 -1
  159. package/lib/radio/types.d.ts +1 -1
  160. package/lib/shortcuts/types.d.ts +1 -1
  161. package/lib/skeleton/types.d.ts +1 -1
  162. package/lib/spinner/types.d.ts +1 -1
  163. package/lib/split/helpers.d.ts +1 -1
  164. package/lib/split/types.d.ts +1 -1
  165. package/lib/table/HeaderColumn.d.ts +1 -1
  166. package/lib/table/HeaderColumn.js +5 -1
  167. package/lib/table/types.d.ts +3 -1
  168. package/lib/tabs/context.js +1 -1
  169. package/lib/tabs/types.d.ts +4 -4
  170. package/lib/toolbar/types.d.ts +1 -1
  171. package/lib/tooltip/types.d.ts +1 -1
  172. package/lib/treetable/Row.d.ts +1 -1
  173. package/lib/treetable/helpers.d.ts +1 -1
  174. package/lib/treetable/index.d.ts +2 -2
  175. package/lib/treeview/types.d.ts +1 -1
  176. package/lib/{types.d-DvJcBS8L.d.ts → types.d-73cece43.d.ts} +1 -1
  177. package/lib/uitour/types.d.ts +1 -1
  178. package/package.json +7 -7
  179. package/.tool-versions +0 -1
  180. package/lib/assets/styles/textContent.scss +0 -9
  181. package/lib/menus/sidenav/popup_menu_help/index.js +0 -78
  182. package/lib/textContent/index.d.ts +0 -8
  183. package/lib/textContent/index.js +0 -30
@@ -11,17 +11,15 @@ const Selecteds = _ref => {
11
11
  currents,
12
12
  descriptionKey,
13
13
  idKey,
14
- handleOnUnselect
14
+ handlerOnUnselect
15
15
  } = _ref;
16
16
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, currents.map(selected => /*#__PURE__*/_react.default.createElement("div", {
17
17
  className: "selecteditem",
18
18
  key: "selected-".concat(selected[idKey])
19
- }, typeof descriptionKey === 'string' ? selected[descriptionKey] : descriptionKey(selected), /*#__PURE__*/_react.default.createElement("span", {
19
+ }, typeof descriptionKey === 'string' ? selected[descriptionKey] : descriptionKey(selected), /*#__PURE__*/_react.default.createElement("button", {
20
20
  className: "close",
21
- role: "button",
22
21
  tabIndex: -1,
23
- onKeyPress: () => {},
24
- onClick: () => handleOnUnselect(selected[idKey])
22
+ onClick: () => handlerOnUnselect(selected[idKey])
25
23
  }))));
26
24
  };
27
25
  var _default = exports.default = Selecteds;
@@ -5,6 +5,8 @@ import '../../../@types/PermissionAttr.js';
5
5
  import '../../base/types.js';
6
6
  import 'react';
7
7
  import '../../../@types/Period.js';
8
+ import '../../../internals/types.js';
9
+ import '../../../@types/Position.js';
8
10
 
9
11
  declare const MultipleSelect: (props: IMultipleSelectProps) => JSX.Element;
10
12
 
@@ -24,7 +24,8 @@ const MultipleSelect = props => {
24
24
  handlerClear,
25
25
  value = [],
26
26
  remoteSearch = false,
27
- descriptionKey
27
+ descriptionKey,
28
+ showClearButton
28
29
  } = props;
29
30
  const [dataCombo, setDataCombo] = (0, _react.useState)(dataSource);
30
31
  const [currents, setCurrents] = (0, _react.useState)([]);
@@ -40,6 +41,7 @@ const MultipleSelect = props => {
40
41
  const dropdownRef = (0, _react.useRef)(null);
41
42
  const selectWrapper = (0, _react.useRef)();
42
43
  const gridElRef = (0, _react.useRef)();
44
+ const inputTextRef = (0, _react.useRef)(null);
43
45
  const descriptionKeyIsString = typeof descriptionKey === 'string';
44
46
  const onScreenResize = () => {
45
47
  if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
@@ -53,12 +55,12 @@ const MultipleSelect = props => {
53
55
  }
54
56
  };
55
57
  const onMouseMove = event => {
56
- const {
57
- target
58
- } = event;
59
- if (target.className === '') return;
60
- const insideComponents = ['item', 'menubutton', 'filterinput', 'filtercontainer', 'label'].includes(target.className);
61
- setInsideComponent(insideComponents);
58
+ var _dropdownRef$current, _dropdownRef$current$;
59
+ const target = event.target;
60
+ const idDropdown = ((_dropdownRef$current = dropdownRef.current) === null || _dropdownRef$current === void 0 ? void 0 : (_dropdownRef$current$ = _dropdownRef$current.parentElement) === null || _dropdownRef$current$ === void 0 ? void 0 : _dropdownRef$current$.id) || '';
61
+ const dropdownElement = document.getElementById(idDropdown);
62
+ const keepDropdownOpen = Boolean(dropdownElement === null || dropdownElement === void 0 ? void 0 : dropdownElement.contains(target));
63
+ setInsideComponent(keepDropdownOpen);
62
64
  };
63
65
  const onClearClick = () => {
64
66
  setSelected(undefined);
@@ -94,6 +96,7 @@ const MultipleSelect = props => {
94
96
  setCurrents(currentsSelect);
95
97
  setDataCombo(dataSource);
96
98
  setInputValue([]);
99
+ if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
97
100
  setOpened(false);
98
101
  if (props.onSelect) setSelected(props.onSelect(currentsSelect.map(i => i[idKey])));
99
102
  };
@@ -101,11 +104,13 @@ const MultipleSelect = props => {
101
104
  if (currents) {
102
105
  const result = currents.filter(item => item[idKey] !== id);
103
106
  setCurrents(result);
107
+ if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
108
+ setOpened(false);
104
109
  if (props.onSelect) setSelected(props.onSelect(result.map(i => i[idKey])));
105
110
  }
106
111
  };
107
112
  const onOpenClose = () => {
108
- setOpened(!opened);
113
+ setOpened(prevState => !prevState);
109
114
  if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
110
115
  };
111
116
  const onFocus = () => {
@@ -115,11 +120,16 @@ const MultipleSelect = props => {
115
120
  };
116
121
  const onBlur = e => {
117
122
  if (props.onBlur) props.onBlur(e);
118
- if (!insideComponent) setOpened(false);
123
+ if (!insideComponent) {
124
+ setOpened(false);
125
+ setDataCombo(dataSource);
126
+ }
119
127
  };
120
128
  const onInputKeyDown = e => {
121
129
  if (e.keyCode) {
122
130
  if (e.keyCode === constants.keyCodes.ENTER && selected) {
131
+ var _e$preventDefault;
132
+ (_e$preventDefault = e.preventDefault) === null || _e$preventDefault === void 0 ? void 0 : _e$preventDefault.call(e);
123
133
  if (!currents.includes(selected)) onSelect(selected);
124
134
  } else if ([constants.keyCodes.ARROW_UP, constants.keyCodes.ARROW_DOWN].includes(e.keyCode)) {
125
135
  if (!opened) setOpened(true);
@@ -190,6 +200,17 @@ const MultipleSelect = props => {
190
200
  ref: componentRef,
191
201
  className: "select-component"
192
202
  }, /*#__PURE__*/_react.default.createElement(_InputTextBase.default, _extends({}, props, {
203
+ inputRef: ref => {
204
+ if (props.inputRef) {
205
+ if (!_lodash.default.isFunction(props.inputRef)) {
206
+ props.inputRef.current = ref;
207
+ } else {
208
+ props.inputRef(ref);
209
+ }
210
+ }
211
+ inputTextRef.current = ref;
212
+ },
213
+ autoComplete: "off",
193
214
  value: inputValue.toString(),
194
215
  readOnly: shouldBeReadOnly(),
195
216
  onFocus: () => {
@@ -208,21 +229,19 @@ const MultipleSelect = props => {
208
229
  selectWrapper.current = r;
209
230
  },
210
231
  handlerSetOnDenied: setOnDenied,
211
- rightElements: /*#__PURE__*/_react.default.createElement(_ActionButtons.default, _extends({}, props, {
232
+ rightElements: /*#__PURE__*/_react.default.createElement(_ActionButtons.default, {
233
+ showClearButton: showClearButton,
212
234
  disabled: shouldDisable() || shouldBeReadOnly(),
213
235
  dropDownOpened: opened,
214
- handleClear: () => {
236
+ handlerClear: () => {
215
237
  if (shouldDisable()) return null;
216
238
  return onClearClick();
217
239
  },
218
- handleOpenClose: () => {
219
- onOpenClose();
220
- }
221
- }))
222
- }), /*#__PURE__*/_react.default.createElement(_Selecteds.default, _extends({
223
- currents: currents
224
- }, props, {
225
- handleOnUnselect: onUnselect
240
+ handlerOpenClose: onOpenClose
241
+ })
242
+ }), /*#__PURE__*/_react.default.createElement(_Selecteds.default, _extends({}, props, {
243
+ currents: currents,
244
+ handlerOnUnselect: onUnselect
226
245
  }))), opened && /*#__PURE__*/_react.default.createElement(_Dropdown.default, _extends({}, props, {
227
246
  selected: selected,
228
247
  selectFieldRef: componentRef,
@@ -5,6 +5,8 @@ import '../../../@types/PermissionAttr.js';
5
5
  import '../../base/types.js';
6
6
  import 'react';
7
7
  import '../../../@types/Period.js';
8
+ import '../../../internals/types.js';
9
+ import '../../../@types/Position.js';
8
10
 
9
11
  declare const SimpleSelect: (props: ISimpleSelectProps) => JSX.Element;
10
12
 
@@ -19,7 +19,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
19
19
  const SimpleSelect = props => {
20
20
  const {
21
21
  value,
22
- descriptionKey = '',
22
+ descriptionKey,
23
23
  dataSource = [],
24
24
  gridLayout,
25
25
  onSearch,
@@ -32,7 +32,9 @@ const SimpleSelect = props => {
32
32
  name = '',
33
33
  undigitable,
34
34
  searchOnDropdown = false,
35
- allOptions = undefined
35
+ allOptions = undefined,
36
+ showClearButton = false,
37
+ searchNotFoundText
36
38
  } = props;
37
39
  const descriptionKeyIsString = typeof descriptionKey === 'string';
38
40
  const dataSourceWithAllOptions = allOptions ? [{
@@ -48,15 +50,11 @@ const SimpleSelect = props => {
48
50
  const [onDenied, setOnDeniedSelect] = (0, _react.useState)();
49
51
  const [isTyping, setIsTyping] = (0, _react.useState)(false);
50
52
  const dropdownRef = (0, _react.useRef)(null);
51
- const componentId = "select-component".concat(uuid.v1());
53
+ const componentId = "select-component-".concat(name, "-").concat(uuid.v1());
52
54
  const componentRef = (0, _react.useRef)(null);
53
55
  const selectWrapper = (0, _react.useRef)();
54
56
  const gridElement = (0, _react.useRef)();
55
- const clearSelected = () => {
56
- setInputText('');
57
- setSelected(null);
58
- setDataCombo(dataSourceWithAllOptions);
59
- };
57
+ const inputTextRef = (0, _react.useRef)(null);
60
58
  const onScreenResize = () => {
61
59
  if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
62
60
  };
@@ -70,10 +68,12 @@ const SimpleSelect = props => {
70
68
  }
71
69
  };
72
70
  const onMouseMove = event => {
71
+ var _dropdownRef$current2, _dropdownRef$current3;
73
72
  const target = event.target;
74
- if (target.className === '') return;
75
- const insideComponents = ['item', 'menubutton', 'filterinput', 'filtercontainer', 'label'].includes(target.className);
76
- setInsideComponent(insideComponents);
73
+ const idDropdown = ((_dropdownRef$current2 = dropdownRef.current) === null || _dropdownRef$current2 === void 0 ? void 0 : (_dropdownRef$current3 = _dropdownRef$current2.parentElement) === null || _dropdownRef$current3 === void 0 ? void 0 : _dropdownRef$current3.id) || '';
74
+ const dropdownElement = document.getElementById(idDropdown);
75
+ const keepDropdownOpen = Boolean(dropdownElement === null || dropdownElement === void 0 ? void 0 : dropdownElement.contains(target));
76
+ setInsideComponent(keepDropdownOpen);
77
77
  };
78
78
  const getSelectEvent = selectedEvent => ({
79
79
  target: {
@@ -99,12 +99,12 @@ const SimpleSelect = props => {
99
99
  });
100
100
  if (dataComboFilter && dataComboFilter.length > 0) {
101
101
  selectedFilter = dataComboFilter[0];
102
+ setSelected(selectedFilter);
102
103
  }
103
104
  setDataCombo(dataComboFilter);
104
105
  }
105
106
  setOpened(true);
106
107
  setInputText(valueFilter);
107
- setSelected(selectedFilter);
108
108
  if (selectedFilter) {
109
109
  if (descriptionKeyIsString && valueFilter === selectedFilter[descriptionKey] || !descriptionKeyIsString && valueFilter === descriptionKey(selectedFilter)) {
110
110
  onChange(selectedFilter);
@@ -112,18 +112,22 @@ const SimpleSelect = props => {
112
112
  }
113
113
  };
114
114
  const onSelect = selectedDropdown => {
115
- if (selectedDropdown === undefined) return;
116
- setOpened(false);
115
+ if (!selectedDropdown) return;
117
116
  setSelected(selectedDropdown);
118
117
  if (descriptionKeyIsString) setInputText(selectedDropdown[descriptionKey]);else setInputText(descriptionKey(selectedDropdown));
119
- onChange(selectedDropdown);
118
+ new Promise(resolve => {
119
+ resolve(onChange(selectedDropdown));
120
+ }).finally(() => {
121
+ if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
122
+ setOpened(false);
123
+ });
120
124
  };
121
125
  const onOpenClose = () => {
122
- setOpened(!opened);
126
+ setOpened(prevState => !prevState);
123
127
  if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
124
128
  };
125
129
  const onFocus = () => {
126
- setOpened(openDropdownOnFocus);
130
+ if (openDropdownOnFocus) setOpened(true);
127
131
  if (selectWrapper) {
128
132
  const dropdownWidthFocus = selectWrapper.current ? selectWrapper.current.clientWidth : 0;
129
133
  setDropdownWidth(dropdownWidthFocus);
@@ -133,15 +137,20 @@ const SimpleSelect = props => {
133
137
  if (props.onBlur) {
134
138
  const event = getSelectEvent(selected);
135
139
  props.onBlur(event);
136
- if (selected) {
137
- if (descriptionKeyIsString && inputText !== selected[descriptionKey] || !descriptionKeyIsString && inputText !== descriptionKey(selected)) {
138
- clearSelected();
139
- }
140
+ if (selected && descriptionKeyIsString && inputText !== selected[descriptionKey] || !descriptionKeyIsString && inputText !== descriptionKey(selected)) {
141
+ setSelected(null);
142
+ setInputText(inputText);
143
+ new Promise(resolve => {
144
+ resolve(onChange(null));
145
+ }).finally(() => {
146
+ onChange();
147
+ });
140
148
  }
141
149
  }
142
150
  if (!insideComponent) {
143
151
  setOpened(false);
144
152
  setIsTyping(false);
153
+ setDataCombo(dataSourceWithAllOptions);
145
154
  }
146
155
  };
147
156
  const onInputKeyDown = e => {
@@ -159,13 +168,22 @@ const SimpleSelect = props => {
159
168
  index = dataCombo && index === 0 ? (dataCombo === null || dataCombo === void 0 ? void 0 : dataCombo.length) - 1 : index - 1;
160
169
  }
161
170
  setSelected(dataCombo[index]);
171
+ if (descriptionKeyIsString) setInputText(dataCombo[index][descriptionKey]);
172
+ if (!descriptionKeyIsString) setInputText(descriptionKey(dataCombo[index]));
162
173
  }
163
174
  }
164
175
  if (!isTyping) setIsTyping(true);
165
176
  };
166
177
  const onClearClick = () => {
167
- setSelected(undefined);
168
- setInputText('');
178
+ new Promise(resolve => {
179
+ resolve(onChange(null));
180
+ }).finally(() => {
181
+ setSelected(null);
182
+ setInputText('');
183
+ onChange();
184
+ if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
185
+ setOpened(false);
186
+ });
169
187
  };
170
188
  const setOnDenied = onDeniedSelect => {
171
189
  setOnDeniedSelect(onDeniedSelect);
@@ -228,6 +246,17 @@ const SimpleSelect = props => {
228
246
  ref: componentRef,
229
247
  className: "select-component"
230
248
  }, /*#__PURE__*/_react.default.createElement(_InputTextBase.default, _extends({}, props, {
249
+ inputRef: ref => {
250
+ if (props.inputRef) {
251
+ if (!_lodash.default.isFunction(props.inputRef)) {
252
+ props.inputRef.current = ref;
253
+ } else {
254
+ props.inputRef(ref);
255
+ }
256
+ }
257
+ inputTextRef.current = ref;
258
+ },
259
+ autoComplete: "off",
231
260
  readOnly: undigitable || shouldBeReadOnly(),
232
261
  value: inputText,
233
262
  onFocus: onFocus,
@@ -242,18 +271,18 @@ const SimpleSelect = props => {
242
271
  selectWrapper.current = r;
243
272
  },
244
273
  handlerSetOnDenied: inputOnDenied => setOnDenied(inputOnDenied),
245
- rightElements: /*#__PURE__*/_react.default.createElement(_ActionButtons.default, _extends({}, props, {
274
+ rightElements: /*#__PURE__*/_react.default.createElement(_ActionButtons.default, {
246
275
  disabled: shouldDisable() || shouldBeReadOnly(),
276
+ showClearButton: showClearButton,
247
277
  dropDownOpened: opened,
248
- handleClear: () => {
278
+ handlerClear: () => {
249
279
  if (shouldDisable()) return null;
250
280
  return onClearClick();
251
281
  },
252
- handleOpenClose: () => {
253
- onOpenClose();
254
- }
255
- }))
282
+ handlerOpenClose: onOpenClose
283
+ })
256
284
  })), opened && /*#__PURE__*/_react.default.createElement(_Dropdown.default, _extends({}, props, {
285
+ opened: opened,
257
286
  selected: selected,
258
287
  inputValue: inputText,
259
288
  selectFieldRef: componentRef,
@@ -267,9 +296,9 @@ const SimpleSelect = props => {
267
296
  handleOnKeydown: onInputKeyDown,
268
297
  handleOnBlur: () => onBlur,
269
298
  handleOnFocus: onFocus,
270
- opened: opened,
271
299
  dataCombo: dataCombo,
272
- dropdownWidth: dropdownWidth || 0
300
+ dropdownWidth: dropdownWidth || 0,
301
+ searchNotFoundText: searchNotFoundText
273
302
  })));
274
303
  };
275
304
  var _default = exports.default = SimpleSelect;
@@ -2,8 +2,10 @@ import { TextAlign } from '../../@types/Align.js';
2
2
  import { DataCombo } from '../../@types/DataCombo.js';
3
3
  import { PermissionAttr } from '../../@types/PermissionAttr.js';
4
4
  import { CustomInputEvent } from '../base/types.js';
5
- import 'react';
5
+ import { MutableRefObject } from 'react';
6
6
  import '../../@types/Period.js';
7
+ import '../../internals/types.js';
8
+ import '../../@types/Position.js';
7
9
 
8
10
  type AllOptions = {
9
11
  idValue?: number | null;
@@ -47,6 +49,7 @@ interface ISimpleSelectProps {
47
49
  autoFocus?: boolean;
48
50
  onFocus?: () => void;
49
51
  allOptions?: AllOptions;
52
+ inputRef?: MutableRefObject<HTMLInputElement | HTMLTextAreaElement | null> | ((ref: HTMLInputElement | HTMLTextAreaElement | null) => void);
50
53
  }
51
54
  interface ISelectFieldProps extends Omit<ISimpleSelectProps, 'idKey' | 'value' | 'descriptionKey'> {
52
55
  multiple?: boolean;
@@ -92,7 +95,7 @@ interface ISelectedsMultipleProps {
92
95
  idKey: string;
93
96
  descriptionKey: DescriptionKey;
94
97
  currents: DataCombo[];
95
- handleOnUnselect: (id: string) => void;
98
+ handlerOnUnselect: (id: string) => void;
96
99
  }
97
100
  interface GetFilteredParams {
98
101
  dataSource: DataCombo[];
@@ -106,4 +109,4 @@ interface GetMultipleFilteredParams extends GetFilteredParams {
106
109
  inputText: number[] | string[];
107
110
  }
108
111
 
109
- export type { AllOptions, DescriptionKey, GetFilteredParams, GetMultipleFilteredParams, GetSimpleFilteredParams, IMultipleSelectProps, ISelectFieldProps, ISelectedsMultipleProps, ISimpleSelectProps };
112
+ export { AllOptions, DescriptionKey, GetFilteredParams, GetMultipleFilteredParams, GetSimpleFilteredParams, IMultipleSelectProps, ISelectFieldProps, ISelectedsMultipleProps, ISimpleSelectProps };
@@ -22,4 +22,4 @@ interface ITextField extends IBaseProps, CommonProperties {
22
22
  gridLayout?: string;
23
23
  }
24
24
 
25
- export type { ITextField };
25
+ export { ITextField };
@@ -4,6 +4,8 @@ import 'react';
4
4
  import '../../@types/Align.js';
5
5
  import '../../@types/Period.js';
6
6
  import '../../@types/PermissionAttr.js';
7
+ import '../../internals/types.js';
8
+ import '../../@types/Position.js';
7
9
 
8
10
  declare const TextArea: (props: ITextAreaProps) => JSX.Element;
9
11
 
@@ -3,6 +3,8 @@ import 'react';
3
3
  import '../../@types/Align.js';
4
4
  import '../../@types/Period.js';
5
5
  import '../../@types/PermissionAttr.js';
6
+ import '../../internals/types.js';
7
+ import '../../@types/Position.js';
6
8
 
7
9
  interface ITextAreaProps extends IBaseProps {
8
10
  rows?: number;
@@ -11,4 +13,4 @@ interface ITextAreaProps extends IBaseProps {
11
13
  type?: string;
12
14
  }
13
15
 
14
- export type { ITextAreaProps };
16
+ export { ITextAreaProps };
@@ -1,10 +1,12 @@
1
1
  import { ReactNode, MouseEvent, MutableRefObject, CSSProperties, KeyboardEvent, ReactElement } from 'react';
2
+ import IMask from 'imask';
2
3
  import { PermissionAttr, OnDenied } from '../@types/PermissionAttr.js';
3
4
  import { DataCombo } from '../@types/DataCombo.js';
4
5
  import { IBaseProps, CustomInputEvent } from './base/types.js';
5
6
  import { IDrawerProps } from '../drawer/types.js';
6
7
  import { TextAlign } from '../@types/Align.js';
7
8
  import '../@types/Period.js';
9
+ import '../internals/types.js';
8
10
  import '../@types/Position.js';
9
11
  import '../@types/Icon.js';
10
12
  import '../icons/helper.js';
@@ -62,7 +64,7 @@ interface IMaskHOCProps {
62
64
  inputRef?: MutableRefObject<HTMLInputElement | HTMLTextAreaElement | null> | ((ref: HTMLInputElement | HTMLTextAreaElement | null) => void);
63
65
  placeholderChar?: string;
64
66
  lazy?: boolean;
65
- definitions?: object;
67
+ definitions?: IMask.AllMaskedOptions['definitions'];
66
68
  groups?: object;
67
69
  pattern?: string;
68
70
  format?: () => void;
@@ -97,7 +99,7 @@ interface IMaskHOCProps {
97
99
  rounded?: boolean;
98
100
  errorMessages?: string[];
99
101
  skeletonize?: boolean;
100
- mask?: string | NumberConstructor;
102
+ mask?: IMask.AnyMask;
101
103
  isDateField?: boolean;
102
104
  autoCompleteMask?: 'left' | 'right';
103
105
  }
@@ -133,8 +135,8 @@ interface IDropdownSelectProps {
133
135
  align?: 'left' | 'right';
134
136
  }
135
137
  interface IActionButtonsSelectProps {
136
- handleClear: () => void;
137
- handleOpenClose: () => void;
138
+ handlerClear: () => void;
139
+ handlerOpenClose: () => void;
138
140
  dropDownOpened: boolean;
139
141
  showClearButton?: boolean;
140
142
  disabled?: boolean;
@@ -149,5 +151,10 @@ interface IButtonsProps {
149
151
  transparent: boolean;
150
152
  disabled?: boolean;
151
153
  }
154
+ interface ErrorProps {
155
+ customClass?: string;
156
+ style?: React.CSSProperties;
157
+ messages?: string | string[];
158
+ }
152
159
 
153
- export type { IActionButtonsSelectProps, IAdvancedFilterProps, IButtonsProps, IDropdownProps, IDropdownSelectProps, IInputHOCProps, IMaskHOCProps, ISearchProps };
160
+ export { ErrorProps, IActionButtonsSelectProps, IAdvancedFilterProps, IButtonsProps, IDropdownProps, IDropdownSelectProps, IInputHOCProps, IMaskHOCProps, ISearchProps };
@@ -19,4 +19,4 @@ interface HasToolTipParams {
19
19
  tooltip?: string;
20
20
  }
21
21
 
22
- export type { GetDisplayNameParams, HasToolTipParams, WithTooltipProps };
22
+ export { GetDisplayNameParams, HasToolTipParams, WithTooltipProps };
@@ -75,7 +75,7 @@ const withTooltip = WrappedComponent => {
75
75
  }
76
76
  }
77
77
  };
78
- }, [errorMessage]);
78
+ }, [errorMessage, tooltip]);
79
79
  (0, _react.useEffect)(() => {
80
80
  if (targetElement.current && tooltipElement.current) {
81
81
  const {
@@ -106,7 +106,11 @@ const withTooltip = WrappedComponent => {
106
106
  break;
107
107
  case 'left':
108
108
  if (targetDimensions.left < tooltipClientWidth) {
109
- setStateTooltipPosition('right');
109
+ if (window.innerWidth - targetDimensions.right < tooltipClientWidth) {
110
+ setStateTooltipPosition('bottom');
111
+ } else {
112
+ setStateTooltipPosition('right');
113
+ }
110
114
  } else {
111
115
  style += "; top: ".concat(targetVerticalCenter + window.scrollY - height / 2, "px");
112
116
  style += "; left: ".concat(targetDimensions.left - tooltipClientWidth - 6, "px");
@@ -125,7 +129,7 @@ const withTooltip = WrappedComponent => {
125
129
  }
126
130
  setTooltipStyle(style);
127
131
  }
128
- }, [tooltipDimensions, tooltipElement.current, targetElement.current, stateTooltipPosition]);
132
+ }, [tooltipDimensions, stateTooltipPosition]);
129
133
  (0, _react.useEffect)(() => {
130
134
  setStateTooltipPosition(tooltipPosition);
131
135
  }, [window.scrollY, window.scrollX, window.innerWidth]);
@@ -17,4 +17,4 @@ interface ILabelMessagesProps {
17
17
  visible?: boolean;
18
18
  }
19
19
 
20
- export type { ILabelMessagesProps };
20
+ export { ILabelMessagesProps };
@@ -23,4 +23,4 @@ interface ILabelProps extends React.HTMLAttributes<HTMLDivElement> {
23
23
  validationKey?: string;
24
24
  }
25
25
 
26
- export type { ILabelProps };
26
+ export { ILabelProps };
@@ -63,4 +63,4 @@ interface IListContext {
63
63
  handleSelectItem: (itemId: string, onClick?: () => void) => void;
64
64
  }
65
65
 
66
- export type { IListContext, IListHeaderProps, IListItemProps, IListProps, ItemId, KeyboardEvent };
66
+ export { IListContext, IListHeaderProps, IListItemProps, IListProps, ItemId, KeyboardEvent };
@@ -16,21 +16,21 @@ declare function SubMenuContainer({ title, customClass, handlerGoBack, skeletoni
16
16
  }): JSX.Element;
17
17
  declare namespace SubMenuContainer {
18
18
  namespace propTypes {
19
- let children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
20
- let handlerGoBack: PropTypes.Validator<(...args: any[]) => any>;
21
- let title: PropTypes.Requireable<string>;
22
- let customClass: PropTypes.Requireable<string>;
23
- let skeletonize: PropTypes.Requireable<boolean>;
24
- let skeletonQtty: PropTypes.Requireable<number>;
19
+ const children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
20
+ const handlerGoBack: PropTypes.Validator<(...args: any[]) => any>;
21
+ const title: PropTypes.Requireable<string>;
22
+ const customClass: PropTypes.Requireable<string>;
23
+ const skeletonize: PropTypes.Requireable<boolean>;
24
+ const skeletonQtty: PropTypes.Requireable<number>;
25
25
  }
26
26
  namespace defaultProps {
27
- let title_1: undefined;
27
+ const title_1: undefined;
28
28
  export { title_1 as title };
29
- let customClass_1: undefined;
29
+ const customClass_1: undefined;
30
30
  export { customClass_1 as customClass };
31
- let skeletonize_1: boolean;
31
+ const skeletonize_1: boolean;
32
32
  export { skeletonize_1 as skeletonize };
33
- let skeletonQtty_1: number;
33
+ const skeletonQtty_1: number;
34
34
  export { skeletonQtty_1 as skeletonQtty };
35
35
  }
36
36
  }
@@ -19,7 +19,7 @@ interface IFloatMenuItemProps {
19
19
  title?: string;
20
20
  url?: string;
21
21
  urlHref?: string;
22
- iconName: IconNames;
22
+ iconName?: IconNames;
23
23
  iconColor?: string;
24
24
  iconSize?: SizePixels;
25
25
  customClass?: string;
@@ -27,4 +27,4 @@ interface IFloatMenuItemProps {
27
27
  onClick?: (dropdownClose?: () => void) => void;
28
28
  }
29
29
 
30
- export type { IFloatMenuContext, IFloatMenuItemProps, IFloatMenuProps };
30
+ export { IFloatMenuContext, IFloatMenuItemProps, IFloatMenuProps };
@@ -32,17 +32,18 @@ const PopupMenuSearch = props => {
32
32
  style
33
33
  });
34
34
  const closeOnEsc = e => {
35
- if (e.keyCode === 27 || e.key === 'ESC') {
35
+ if (e.key === 'Escape') {
36
36
  handlerClose();
37
+ e.stopPropagation();
37
38
  }
38
39
  };
39
40
  (0, _react.useEffect)(() => {
40
41
  body.appendChild(popupRef.current);
41
42
  if (searchFieldRef && searchFieldRef.current) searchFieldRef.current.focus();
42
- document.body.addEventListener('keyup', closeOnEsc);
43
+ document.body.addEventListener('keydown', closeOnEsc);
43
44
  return () => {
44
45
  body.removeChild(popupRef.current);
45
- document.body.removeEventListener('keyup', closeOnEsc);
46
+ document.body.removeEventListener('keydown', closeOnEsc);
46
47
  };
47
48
  }, []);
48
49
  (0, _react.useEffect)(() => {
@@ -60,7 +60,7 @@ interface INavSubMenuItemProps {
60
60
  interface IExpandMenuProps {
61
61
  expandMenuCustomClass?: string;
62
62
  onExpandMenu?: () => void;
63
- iconName: IconNames;
63
+ iconName?: IconNames;
64
64
  }
65
65
  interface IEmptyListProps {
66
66
  info?: string;
@@ -81,4 +81,4 @@ interface ISideNavContext {
81
81
  }
82
82
  type ITargetDimensions = DOMRect;
83
83
 
84
- export type { IEmptyListProps, IExpandMenuProps, IMenuItemContent, IMenuLinkProps, INavMenuGroupProps, INavMenuItemProps, INavSubMenuItemProps, IPopupMenuSearchProps, ISideNavContext, ISideNavDimensions, ISideNavProps, ISubMenuContext, ITargetDimensions };
84
+ export { IEmptyListProps, IExpandMenuProps, IMenuItemContent, IMenuLinkProps, INavMenuGroupProps, INavMenuItemProps, INavSubMenuItemProps, IPopupMenuSearchProps, ISideNavContext, ISideNavDimensions, ISideNavProps, ISubMenuContext, ITargetDimensions };
@@ -44,4 +44,4 @@ interface IParameterFunction {
44
44
  componentName: string;
45
45
  }
46
46
 
47
- export type { AsyncFunc, ContextProps, Func, IPanelContentProps, IPanelHeaderProps, IPanelProps, IParameterFunction };
47
+ export { AsyncFunc, ContextProps, Func, IPanelContentProps, IPanelHeaderProps, IPanelProps, IParameterFunction };
@@ -20,4 +20,4 @@ interface IPopoverProps {
20
20
  iconSize?: Extract<SizePixels, 10 | 16 | 24 | 32 | 40 | 64>;
21
21
  }
22
22
 
23
- export type { IPopoverProps, PopoverTextProps, PopoverTitleProps };
23
+ export { IPopoverProps, PopoverTextProps, PopoverTitleProps };
@@ -34,4 +34,4 @@ interface ILabelParams {
34
34
  value?: number;
35
35
  }
36
36
 
37
- export type { IBarProps, ILabelParams, IPercentageParams, IProgressBarProps };
37
+ export { IBarProps, ILabelParams, IPercentageParams, IProgressBarProps };
@@ -18,4 +18,4 @@ interface IRadioProps {
18
18
  forwardedRef?: Ref<HTMLInputElement>;
19
19
  }
20
20
 
21
- export type { IRadioProps };
21
+ export { IRadioProps };