linear-react-components-ui 1.1.20-beta.8 → 1.1.20-rc.0

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 (176) hide show
  1. package/lib/alerts/BaseAlert.js +1 -1
  2. package/lib/alerts/Message.js +1 -1
  3. package/lib/assets/styles/effects.scss +0 -2
  4. package/lib/assets/styles/input.scss +2 -2
  5. package/lib/assets/styles/popover.scss +3 -0
  6. package/lib/assets/styles/select.scss +2 -1
  7. package/lib/assets/styles/treetable.scss +2 -2
  8. package/lib/assets/styles/treeview.scss +24 -8
  9. package/lib/assets/styles/wizard.scss +127 -0
  10. package/lib/avatar/index.js +9 -8
  11. package/lib/badge/index.js +4 -4
  12. package/lib/buttons/DangerButton.js +1 -1
  13. package/lib/buttons/DefaultButton.js +24 -4
  14. package/lib/buttons/InfoButton.js +1 -1
  15. package/lib/buttons/PrimaryButton.js +1 -1
  16. package/lib/buttons/SuccessButton.js +1 -1
  17. package/lib/buttons/WarningButton.js +1 -1
  18. package/lib/buttons/button_container/index.js +1 -1
  19. package/lib/buttons/split_button/index.js +1 -1
  20. package/lib/calendar/base/Day.js +1 -1
  21. package/lib/calendar/base/Month.js +1 -1
  22. package/lib/calendar/base/helpers.js +2 -2
  23. package/lib/calendar/base/index.js +1 -1
  24. package/lib/checkbox/index.js +46 -19
  25. package/lib/checkbox/types.d.ts +4 -0
  26. package/lib/dialog/Alert.js +6 -2
  27. package/lib/dialog/Custom.js +4 -2
  28. package/lib/dialog/Error.js +6 -2
  29. package/lib/dialog/Information.js +6 -2
  30. package/lib/dialog/Question.js +23 -5
  31. package/lib/dialog/Warning.js +6 -2
  32. package/lib/dialog/base/Content.d.ts +1 -1
  33. package/lib/dialog/base/Content.js +3 -2
  34. package/lib/dialog/base/Header.js +2 -2
  35. package/lib/dialog/base/index.js +12 -9
  36. package/lib/dialog/form/index.js +8 -3
  37. package/lib/dialog/types.d.ts +44 -4
  38. package/lib/dialog/wizard/index.d.ts +13 -0
  39. package/lib/dialog/wizard/index.js +78 -0
  40. package/lib/dialog/wizard/progressbar.d.ts +13 -0
  41. package/lib/dialog/wizard/progressbar.js +36 -0
  42. package/lib/dialog/wizard/step.d.ts +9 -0
  43. package/lib/dialog/wizard/step.js +22 -0
  44. package/lib/dialog/wizard/useWizard.d.ts +9 -0
  45. package/lib/dialog/wizard/useWizard.js +48 -0
  46. package/lib/drawer/Drawer.js +3 -3
  47. package/lib/drawer/Header.js +1 -1
  48. package/lib/dropdown/Popup.js +6 -6
  49. package/lib/dropdown/helper.js +1 -1
  50. package/lib/dropdown/withDropdown.js +2 -2
  51. package/lib/fieldset/index.js +7 -7
  52. package/lib/form/FieldArray.js +1 -1
  53. package/lib/form/FieldNumber.js +7 -10
  54. package/lib/form/FieldPeriod.js +2 -2
  55. package/lib/form/index.js +20 -15
  56. package/lib/form/types.d.ts +14 -1
  57. package/lib/gridlayout/GridCol.js +5 -5
  58. package/lib/gridlayout/GridRow.js +4 -1
  59. package/lib/hint/index.js +7 -1
  60. package/lib/icons/helper.d.ts +20 -0
  61. package/lib/icons/helper.js +20 -0
  62. package/lib/icons/index.js +24 -27
  63. package/lib/inputs/base/InputTextBase.js +39 -15
  64. package/lib/inputs/base/Label.js +1 -1
  65. package/lib/inputs/base/helpers.js +7 -3
  66. package/lib/inputs/base/types.d.ts +3 -0
  67. package/lib/inputs/color/types.d.ts +5 -0
  68. package/lib/inputs/date/helpers.js +4 -1
  69. package/lib/inputs/date/index.js +9 -15
  70. package/lib/inputs/date/types.d.ts +4 -0
  71. package/lib/inputs/errorMessage/index.js +1 -1
  72. package/lib/inputs/file/DefaultFile.js +5 -6
  73. package/lib/inputs/file/DragDropFile.js +17 -18
  74. package/lib/inputs/file/File.js +3 -4
  75. package/lib/inputs/file/types.d.ts +3 -0
  76. package/lib/inputs/mask/BaseMask.js +4 -1
  77. package/lib/inputs/mask/helpers.d.ts +4 -0
  78. package/lib/inputs/mask/types.d.ts +4 -0
  79. package/lib/inputs/multiSelect/Dropdown.js +9 -10
  80. package/lib/inputs/multiSelect/helper.js +1 -2
  81. package/lib/inputs/multiSelect/index.js +7 -9
  82. package/lib/inputs/multiSelect/types.d.ts +4 -0
  83. package/lib/inputs/number/BaseNumber.d.ts +1 -1
  84. package/lib/inputs/number/Currency.d.ts +1 -1
  85. package/lib/inputs/number/Decimal.d.ts +1 -1
  86. package/lib/inputs/number/index.d.ts +1 -1
  87. package/lib/inputs/number/index.js +8 -4
  88. package/lib/inputs/number/types.d.ts +14 -2
  89. package/lib/inputs/period/PeriodList.js +1 -1
  90. package/lib/inputs/period/helper.js +3 -1
  91. package/lib/inputs/period/index.js +40 -18
  92. package/lib/inputs/period/types.d.ts +3 -0
  93. package/lib/inputs/search/index.js +1 -1
  94. package/lib/inputs/select/Dropdown.js +1 -1
  95. package/lib/inputs/select/helper.js +10 -13
  96. package/lib/inputs/select/multiple/Selecteds.js +1 -1
  97. package/lib/inputs/select/multiple/index.js +22 -18
  98. package/lib/inputs/select/simple/index.js +15 -20
  99. package/lib/inputs/select/types.d.ts +7 -0
  100. package/lib/inputs/textarea/index.js +1 -1
  101. package/lib/internals/withTooltip.js +9 -9
  102. package/lib/labelMessages/index.js +4 -3
  103. package/lib/labels/DefaultLabel.js +4 -1
  104. package/lib/labels/label_container/index.js +1 -1
  105. package/lib/list/Header.d.ts +1 -0
  106. package/lib/list/Header.js +1 -1
  107. package/lib/list/Item.d.ts +6 -2
  108. package/lib/list/Item.js +36 -14
  109. package/lib/list/helpers.d.ts +1 -0
  110. package/lib/list/index.d.ts +1 -0
  111. package/lib/list/index.js +3 -2
  112. package/lib/list/types.d.ts +8 -1
  113. package/lib/menus/float/MenuItem.js +2 -2
  114. package/lib/menus/float/SubMenuContainer.js +1 -1
  115. package/lib/menus/float/index.js +1 -1
  116. package/lib/menus/sidenav/ExpandMenu.js +1 -1
  117. package/lib/menus/sidenav/NavMenuGroup.js +1 -1
  118. package/lib/menus/sidenav/NavMenuItem.js +27 -25
  119. package/lib/menus/sidenav/NavSubMenuItem.js +1 -1
  120. package/lib/menus/sidenav/helpers.js +1 -1
  121. package/lib/menus/sidenav/index.js +39 -31
  122. package/lib/menus/sidenav/types.d.ts +1 -0
  123. package/lib/panel/Content.js +5 -7
  124. package/lib/panel/Default.js +2 -2
  125. package/lib/panel/Header.js +3 -3
  126. package/lib/permissionValidations.js +1 -1
  127. package/lib/popover/index.js +4 -6
  128. package/lib/popover/types.d.ts +2 -1
  129. package/lib/progress/Bar.js +6 -6
  130. package/lib/radio/index.d.ts +1 -1
  131. package/lib/radio/index.js +36 -5
  132. package/lib/radio/types.d.ts +8 -1
  133. package/lib/shortcuts/index.js +1 -1
  134. package/lib/skeleton/SkeletonContainer.js +2 -1
  135. package/lib/skeleton/index.js +4 -1
  136. package/lib/spinner/index.js +2 -2
  137. package/lib/split/Split.js +1 -1
  138. package/lib/split/SplitSide.js +3 -3
  139. package/lib/table/Body.js +3 -3
  140. package/lib/table/Header.js +8 -11
  141. package/lib/table/HeaderColumn.js +7 -7
  142. package/lib/table/Row.js +3 -3
  143. package/lib/table/RowColumn.js +1 -1
  144. package/lib/table/index.js +6 -1
  145. package/lib/table/types.d.ts +0 -2
  146. package/lib/tabs/DropdownTabs.js +1 -1
  147. package/lib/tabs/Menu.js +1 -1
  148. package/lib/tabs/MenuTabs.js +2 -2
  149. package/lib/tabs/Panel.js +5 -7
  150. package/lib/tabs/context.js +3 -6
  151. package/lib/textContent/index.d.ts +18 -4
  152. package/lib/textContent/index.js +18 -6
  153. package/lib/toolbar/ButtonBar.js +1 -1
  154. package/lib/toolbar/index.js +1 -1
  155. package/lib/tooltip/index.js +7 -7
  156. package/lib/treetable/Body.js +1 -1
  157. package/lib/treetable/Header.js +2 -2
  158. package/lib/treetable/Row.d.ts +1 -1
  159. package/lib/treetable/Row.js +50 -25
  160. package/lib/treetable/helpers.d.ts +1 -1
  161. package/lib/treetable/index.d.ts +2 -2
  162. package/lib/treeview/Header.js +1 -1
  163. package/lib/treeview/Node.js +5 -5
  164. package/lib/treeview/index.js +4 -4
  165. package/lib/{types.d-73cece43.d.ts → types.d-b477e076.d.ts} +1 -0
  166. package/lib/uitour/index.js +6 -8
  167. package/package.json +2 -2
  168. package/lib/checkbox/Label.d.ts +0 -11
  169. package/lib/checkbox/Label.js +0 -31
  170. package/lib/inputs/mask/imaskHOC.js +0 -203
  171. package/lib/menus/sidenav/popup_menu_help/index.js +0 -85
  172. package/lib/tabs/DropdownItems.js +0 -62
  173. package/lib/tabs/MenuItems.js +0 -70
  174. package/lib/treeview_old/Header.js +0 -29
  175. package/lib/treeview_old/Node.js +0 -68
  176. package/lib/treeview_old/index.js +0 -43
@@ -34,7 +34,8 @@ const SimpleSelect = props => {
34
34
  searchOnDropdown = false,
35
35
  allOptions = undefined,
36
36
  showClearButton = false,
37
- searchNotFoundText
37
+ searchNotFoundText,
38
+ rightElements = []
38
39
  } = props;
39
40
  const descriptionKeyIsString = typeof descriptionKey === 'string';
40
41
  const dataSourceWithAllOptions = allOptions ? [{
@@ -50,7 +51,7 @@ const SimpleSelect = props => {
50
51
  const [onDenied, setOnDeniedSelect] = (0, _react.useState)();
51
52
  const [isTyping, setIsTyping] = (0, _react.useState)(false);
52
53
  const dropdownRef = (0, _react.useRef)(null);
53
- const componentId = "select-component-".concat(name, "-").concat(uuid.v1());
54
+ const componentId = `select-component-${name}-${uuid.v1()}`;
54
55
  const componentRef = (0, _react.useRef)(null);
55
56
  const selectWrapper = (0, _react.useRef)();
56
57
  const gridElement = (0, _react.useRef)();
@@ -59,20 +60,18 @@ const SimpleSelect = props => {
59
60
  if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
60
61
  };
61
62
  const onClickOutside = event => {
62
- var _selectWrapper$curren, _dropdownRef$current;
63
63
  const {
64
64
  target
65
65
  } = event;
66
- if (target !== selectWrapper.current && !((_selectWrapper$curren = selectWrapper.current) !== null && _selectWrapper$curren !== void 0 && _selectWrapper$curren.contains(target)) && !((_dropdownRef$current = dropdownRef.current) !== null && _dropdownRef$current !== void 0 && _dropdownRef$current.contains(target))) {
66
+ if (target !== selectWrapper.current && !selectWrapper.current?.contains(target) && !dropdownRef.current?.contains(target)) {
67
67
  setOpened(false);
68
68
  }
69
69
  };
70
70
  const onMouseMove = event => {
71
- var _dropdownRef$current2, _dropdownRef$current3;
72
71
  const target = event.target;
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) || '';
72
+ const idDropdown = dropdownRef.current?.parentElement?.id || '';
74
73
  const dropdownElement = document.getElementById(idDropdown);
75
- const keepDropdownOpen = Boolean(dropdownElement === null || dropdownElement === void 0 ? void 0 : dropdownElement.contains(target));
74
+ const keepDropdownOpen = Boolean(dropdownElement?.contains(target));
76
75
  setInsideComponent(keepDropdownOpen);
77
76
  };
78
77
  const getSelectEvent = selectedEvent => ({
@@ -112,7 +111,6 @@ const SimpleSelect = props => {
112
111
  }
113
112
  };
114
113
  const onSelect = selectedDropdown => {
115
- var _dropdownRef$current4;
116
114
  if (!selectedDropdown) return;
117
115
  setSelected(selectedDropdown);
118
116
  if (descriptionKeyIsString) setInputText(selectedDropdown[descriptionKey]);else setInputText(descriptionKey(selectedDropdown));
@@ -122,7 +120,7 @@ const SimpleSelect = props => {
122
120
  if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
123
121
  setOpened(false);
124
122
  });
125
- (_dropdownRef$current4 = dropdownRef.current) === null || _dropdownRef$current4 === void 0 ? void 0 : _dropdownRef$current4.focus();
123
+ dropdownRef.current?.focus();
126
124
  };
127
125
  const onOpenClose = () => {
128
126
  setOpened(prevState => !prevState);
@@ -158,8 +156,7 @@ const SimpleSelect = props => {
158
156
  const onInputKeyDown = e => {
159
157
  if (e.keyCode) {
160
158
  if (e.keyCode === constants.keyCodes.ENTER && selected && opened) {
161
- var _e$preventDefault;
162
- (_e$preventDefault = e.preventDefault) === null || _e$preventDefault === void 0 ? void 0 : _e$preventDefault.call(e);
159
+ e.preventDefault?.();
163
160
  onSelect(selected);
164
161
  } else if ([constants.keyCodes.ARROW_UP, constants.keyCodes.ARROW_DOWN].includes(e.keyCode)) {
165
162
  if (!opened) setOpened(true);
@@ -167,7 +164,7 @@ const SimpleSelect = props => {
167
164
  if (e.keyCode === constants.keyCodes.ARROW_DOWN) {
168
165
  index = dataCombo && index === dataCombo.length - 1 ? 0 : index + 1;
169
166
  } else {
170
- index = dataCombo && index === 0 ? (dataCombo === null || dataCombo === void 0 ? void 0 : dataCombo.length) - 1 : index - 1;
167
+ index = dataCombo && index === 0 ? dataCombo?.length - 1 : index - 1;
171
168
  }
172
169
  setSelected(dataCombo[index]);
173
170
  if (descriptionKeyIsString) setInputText(dataCombo[index][descriptionKey]);
@@ -204,7 +201,7 @@ const SimpleSelect = props => {
204
201
  }, []);
205
202
  (0, _react.useEffect)(() => {
206
203
  if (gridLayout) {
207
- const gridEl = document.querySelector("#".concat(componentId, ">.-withinput.grid-container"));
204
+ const gridEl = document.querySelector(`#${componentId}>.-withinput.grid-container`);
208
205
  if (gridElement.current !== gridEl && gridEl) gridElement.current = gridEl;
209
206
  }
210
207
  }, [gridLayout]);
@@ -212,10 +209,7 @@ const SimpleSelect = props => {
212
209
  if (dataSourceWithAllOptions.length > 0) {
213
210
  let newCurrent = null;
214
211
  if (value || value === 0) {
215
- newCurrent = dataSourceWithAllOptions.find(i => {
216
- var _i$idKey;
217
- return (value || value === 0) && ((_i$idKey = i[idKey]) === null || _i$idKey === void 0 ? void 0 : _i$idKey.toString().toLowerCase()) === (value === null || value === void 0 ? void 0 : value.toString().toLowerCase());
218
- });
212
+ newCurrent = dataSourceWithAllOptions.find(i => (value || value === 0) && i[idKey]?.toString().toLowerCase() === value?.toString().toLowerCase());
219
213
  } else if (dataSourceWithAllOptions.length > 0 && selectFirstOnEnter) {
220
214
  newCurrent = dataSourceWithAllOptions[0];
221
215
  }
@@ -268,13 +262,14 @@ const SimpleSelect = props => {
268
262
  },
269
263
  onClick: onFocus,
270
264
  onKeyDown: onInputKeyDown,
271
- customClassForWrapper: "selectwrapper ".concat((undigitable || searchOnDropdown || shouldBeReadOnly()) && ' -undigitable'),
265
+ customClassForWrapper: `selectwrapper ${(undigitable || searchOnDropdown || shouldBeReadOnly()) && ' -undigitable'}`,
272
266
  customClassForInputContent: "multiselect",
273
267
  inputBaseRef: r => {
274
268
  selectWrapper.current = r;
275
269
  },
276
270
  handlerSetOnDenied: inputOnDenied => setOnDenied(inputOnDenied),
277
- rightElements: /*#__PURE__*/_react.default.createElement(_ActionButtons.default, {
271
+ rightElements: [...rightElements, /*#__PURE__*/_react.default.createElement(_ActionButtons.default, {
272
+ key: "action-buttons-simpleselect",
278
273
  disabled: shouldDisable() || shouldBeReadOnly(),
279
274
  showClearButton: showClearButton,
280
275
  dropDownOpened: opened,
@@ -283,7 +278,7 @@ const SimpleSelect = props => {
283
278
  return onClearClick();
284
279
  },
285
280
  handlerOpenClose: onOpenClose
286
- })
281
+ })]
287
282
  })), opened && /*#__PURE__*/_react.default.createElement(_Dropdown.default, _extends({}, props, {
288
283
  opened: opened,
289
284
  selected: selected,
@@ -50,6 +50,10 @@ interface ISimpleSelectProps {
50
50
  onFocus?: () => void;
51
51
  allOptions?: AllOptions;
52
52
  inputRef?: MutableRefObject<HTMLInputElement | HTMLTextAreaElement | null> | ((ref: HTMLInputElement | HTMLTextAreaElement | null) => void);
53
+ rightElements?: JSX.Element[];
54
+ hintPosition?: 'below' | 'onLabelRight';
55
+ themePopover?: 'light' | 'dark';
56
+ popoverAlign?: 'right' | 'left';
53
57
  }
54
58
  interface ISelectFieldProps extends Omit<ISimpleSelectProps, 'idKey' | 'value' | 'descriptionKey'> {
55
59
  multiple?: boolean;
@@ -90,6 +94,9 @@ interface IMultipleSelectProps extends Omit<ISimpleSelectProps, 'idKey' | 'value
90
94
  handlerClear?: () => void;
91
95
  disabled?: boolean;
92
96
  gridLayout?: string;
97
+ hintPosition?: 'below' | 'onLabelRight';
98
+ themePopover?: 'light' | 'dark';
99
+ popoverAlign?: 'right' | 'left';
93
100
  }
94
101
  interface ISelectedsMultipleProps {
95
102
  idKey: string;
@@ -19,7 +19,7 @@ const TextArea = props => {
19
19
  rows: rows,
20
20
  type: type,
21
21
  cols: cols,
22
- customClass: "textarea-container ".concat(customClass)
22
+ customClass: `textarea-container ${customClass}`
23
23
  }));
24
24
  };
25
25
  var _default = exports.default = TextArea;
@@ -87,23 +87,23 @@ const withTooltip = WrappedComponent => {
87
87
  const targetDimensions = targetElement.current.getBoundingClientRect();
88
88
  const targetVerticalCenter = (targetDimensions.top + targetDimensions.bottom) / 2;
89
89
  const tooltipClientWidth = tooltipElement.current.clientWidth;
90
- let style = "width: ".concat(typeof width === 'string' ? width : "".concat(width, "px"));
90
+ let style = `width: ${typeof width === 'string' ? width : `${width}px`}`;
91
91
  let left = targetDimensions.left + targetDimensions.width / 2 - tooltipClientWidth / 2;
92
92
  left = Math.min(left, document.body.clientWidth - tooltipClientWidth - space);
93
- style += "; left: ".concat(Math.max(space, left), "px");
93
+ style += `; left: ${Math.max(space, left)}px`;
94
94
  switch (stateTooltipPosition) {
95
95
  case 'top':
96
96
  if (targetDimensions.top < height) {
97
97
  setStateTooltipPosition('bottom');
98
98
  } else {
99
- style += "; top: ".concat(targetDimensions.top + window.scrollY - height - 5, "px");
99
+ style += `; top: ${targetDimensions.top + window.scrollY - height - 5}px`;
100
100
  }
101
101
  break;
102
102
  case 'bottom':
103
103
  if (window.innerHeight - targetDimensions.bottom < height) {
104
104
  setStateTooltipPosition('top');
105
105
  } else {
106
- style += "; top: ".concat(targetDimensions.top + window.scrollY + targetDimensions.height + 5, "px");
106
+ style += `; top: ${targetDimensions.top + window.scrollY + targetDimensions.height + 5}px`;
107
107
  }
108
108
  break;
109
109
  case 'left':
@@ -114,16 +114,16 @@ const withTooltip = WrappedComponent => {
114
114
  setStateTooltipPosition('right');
115
115
  }
116
116
  } else {
117
- style += "; top: ".concat(targetVerticalCenter + window.scrollY - height / 2, "px");
118
- style += "; left: ".concat(targetDimensions.left - tooltipClientWidth - 6, "px");
117
+ style += `; top: ${targetVerticalCenter + window.scrollY - height / 2}px`;
118
+ style += `; left: ${targetDimensions.left - tooltipClientWidth - 6}px`;
119
119
  }
120
120
  break;
121
121
  case 'right':
122
122
  if (window.innerWidth - targetDimensions.right < tooltipClientWidth) {
123
123
  setStateTooltipPosition('left');
124
124
  } else {
125
- style += "; top: ".concat(targetVerticalCenter + window.scrollY - height / 2, "px");
126
- style += "; left: ".concat(targetDimensions.left + targetDimensions.width + 5, "px");
125
+ style += `; top: ${targetVerticalCenter + window.scrollY - height / 2}px`;
126
+ style += `; left: ${targetDimensions.left + targetDimensions.width + 5}px`;
127
127
  }
128
128
  break;
129
129
  default:
@@ -166,7 +166,7 @@ const withTooltip = WrappedComponent => {
166
166
  targetRef: getTarget
167
167
  })), showTooltip && getTooltip());
168
168
  };
169
- EnhancedComponent.displayName = "withTooltip(".concat(getDisplayName(WrappedComponent), ")");
169
+ EnhancedComponent.displayName = `withTooltip(${getDisplayName(WrappedComponent)})`;
170
170
  return EnhancedComponent;
171
171
  };
172
172
  var _default = exports.default = withTooltip;
@@ -25,7 +25,8 @@ const LabelMessages = _ref => {
25
25
  showCloseButton = false
26
26
  } = _ref;
27
27
  const [closed, setClosed] = (0, _react.useState)(false);
28
- const getClass = () => "labelmessages-component -".concat(type, " ").concat(customClass, "\n ").concat(square && '-square', " ").concat(flat && '-flat');
28
+ const getClass = () => `labelmessages-component -${type} ${customClass}
29
+ ${square && '-square'} ${flat && '-flat'}`;
29
30
  const getIcon = () => {
30
31
  if (icon) {
31
32
  return icon;
@@ -34,14 +35,14 @@ const LabelMessages = _ref => {
34
35
  name: iconName,
35
36
  size: 16,
36
37
  color: "#ffffff",
37
- customClass: "-".concat(type, "svg")
38
+ customClass: `-${type}svg`
38
39
  });
39
40
  }
40
41
  return null;
41
42
  };
42
43
  if (closed || !visible) return null;
43
44
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
44
- className: "".concat(getClass(), " ").concat(customClass),
45
+ className: `${getClass()} ${customClass}`,
45
46
  style: style
46
47
  }, /*#__PURE__*/_react.default.createElement("div", {
47
48
  className: "labelmessagesitem text"
@@ -30,7 +30,10 @@ const DefaultLabel = _ref => {
30
30
  } = _ref;
31
31
  const options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible];
32
32
  const [onDenied] = (0, _react.useState)((0, _permissionValidations.actionsOnPermissionDenied)(options, permissionAttr));
33
- const getClass = () => "label-component ".concat(className, " ").concat(customClass, " ").concat(bordered ? '-bordered' : '', " ").concat(disabled ? '-disabled' : '', "\n ").concat(skeletonize ? '-skeletonized' : '', "\n ").concat(size ? "-".concat(size) : '', "\n ").concat(iconAlign ? "icon-".concat(iconAlign) : '');
33
+ const getClass = () => `label-component ${className} ${customClass} ${bordered ? '-bordered' : ''} ${disabled ? '-disabled' : ''}
34
+ ${skeletonize ? '-skeletonized' : ''}
35
+ ${size ? `-${size}` : ''}
36
+ ${iconAlign ? `icon-${iconAlign}` : ''}`;
34
37
  const getIcon = () => {
35
38
  if (icon) {
36
39
  return icon;
@@ -13,7 +13,7 @@ const LabelContainer = _ref => {
13
13
  children
14
14
  } = _ref;
15
15
  return /*#__PURE__*/_react.default.createElement("div", {
16
- className: "lbl-container ".concat(customClass),
16
+ className: `lbl-container ${customClass}`,
17
17
  style: {
18
18
  float: position
19
19
  }
@@ -3,6 +3,7 @@ import 'react';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../@types/Icon.js';
5
5
  import '../icons/helper.js';
6
+ import '../@types/Position.js';
6
7
 
7
8
  declare const Header: ({ title, children, style, customClass }: IListHeaderProps) => JSX.Element;
8
9
 
@@ -14,7 +14,7 @@ const Header = _ref => {
14
14
  customClass
15
15
  } = _ref;
16
16
  return /*#__PURE__*/_react.default.createElement("li", {
17
- className: "list-header ".concat(customClass),
17
+ className: `list-header ${customClass}`,
18
18
  style: style
19
19
  }, /*#__PURE__*/_react.default.createElement("h1", {
20
20
  className: "title"
@@ -3,7 +3,11 @@ import 'react';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../@types/Icon.js';
5
5
  import '../icons/helper.js';
6
+ import '../@types/Position.js';
6
7
 
7
- declare const Item: (props: IListItemProps) => JSX.Element | null;
8
+ declare const _default: {
9
+ (props: IListItemProps): JSX.Element;
10
+ displayName: string;
11
+ };
8
12
 
9
- export { Item as default };
13
+ export { _default as default };
package/lib/list/Item.js CHANGED
@@ -11,6 +11,7 @@ var _checkbox = _interopRequireDefault(require("../checkbox"));
11
11
  var _helpers = require("./helpers");
12
12
  var _withDropdown = require("../dropdown/withDropdown");
13
13
  var constants = _interopRequireWildcard(require("../internals/constants"));
14
+ var _withTooltip = _interopRequireWildcard(require("../internals/withTooltip"));
14
15
  var _permissionValidations = require("../permissionValidations");
15
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
17
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
@@ -38,7 +39,10 @@ const Item = props => {
38
39
  separator = true,
39
40
  visible = true,
40
41
  permissionAttr,
41
- skeletonize
42
+ skeletonize,
43
+ targetRef,
44
+ target,
45
+ onDeniedText = 'Permissão Negada! Consulte o Administrador do sistema.'
42
46
  } = props;
43
47
  const {
44
48
  handleSelectItem,
@@ -48,13 +52,17 @@ const Item = props => {
48
52
  selectOnEnter
49
53
  } = (0, _react.useContext)(_helpers.ListContext);
50
54
  const dropdownContext = (0, _react.useContext)(_withDropdown.WithDropdownContext);
55
+ const {
56
+ handlerSetOnDeniedText
57
+ } = (0, _react.useContext)(_withTooltip.TooltipContext);
51
58
  const options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible];
52
59
  const [onDenied] = (0, _react.useState)((0, _permissionValidations.actionsOnPermissionDenied)(options, permissionAttr));
53
60
  const navigate = (0, _reactRouterDom.useNavigate)();
54
61
  const disabledByPermission = onDenied.disabled;
55
62
  const shouldDisable = () => disabled || onDenied.disabled;
56
63
  const disabledIconColor = 'rgb(193, 193, 193)';
57
- const getClass = () => "item ".concat(customClass, " ").concat(separator && 'list-separator', " ").concat(shouldDisable() && 'disabled', "\n ").concat(displayCheckbox && 'list-checkbox');
64
+ const getClass = () => `item ${customClass} ${separator && 'list-separator'} ${shouldDisable() && 'disabled'}
65
+ ${displayCheckbox && 'list-checkbox'}`;
58
66
  const getIcon = (iconName, icon) => {
59
67
  const noIconDisabledByPermission = !icon && !displayCheckbox && !leftElement && !leftIconName && !leftIcon && onDenied.disabled;
60
68
  if (icon) {
@@ -83,7 +91,13 @@ const Item = props => {
83
91
  if ([constants.keyCodes.ENTER].includes(e.keyCode) && !skeletonize && itemId && selectedItemId === itemId) {
84
92
  e.preventDefault();
85
93
  handleOnSelectItem(e);
86
- if (url) navigate(url);
94
+ if (url) {
95
+ if (target === '_blank') {
96
+ window.open(url, '_blank')?.focus();
97
+ } else {
98
+ navigate(url);
99
+ }
100
+ }
87
101
  }
88
102
  }, [url, selectedItemId, itemId]);
89
103
  const getProps = () => {
@@ -103,6 +117,9 @@ const Item = props => {
103
117
  document.removeEventListener('keydown', onKeyDown);
104
118
  };
105
119
  }, [url, selectedItemId, itemId]);
120
+ (0, _react.useEffect)(() => {
121
+ if (disabledByPermission) handlerSetOnDeniedText(onDeniedText);
122
+ }, [disabledByPermission]);
106
123
  const renderCheckBox = (0, _react.useMemo)(() => {
107
124
  if (!disabledByPermission && displayCheckbox) {
108
125
  return /*#__PURE__*/_react.default.createElement(_checkbox.default, {
@@ -117,24 +134,29 @@ const Item = props => {
117
134
  }, [disabledByPermission && displayCheckbox]);
118
135
  if (!visible || onDenied.unvisible) return null;
119
136
  return /*#__PURE__*/_react.default.createElement("li", _extends({
120
- ref: itemId && selectedItemId === itemId ? selectedItemRef : null,
137
+ ref: ref => {
138
+ if (targetRef) targetRef(ref);
139
+ return itemId && selectedItemId === itemId ? selectedItemRef : null;
140
+ },
121
141
  style: style,
122
- className: "item-container ".concat(hovered && 'hovered', "\n ").concat(itemId && selectedItemId === itemId ? '-activedlist' : '')
142
+ className: `item-container ${hovered && 'hovered'}
143
+ ${itemId && selectedItemId === itemId ? '-activedlist' : ''}`
123
144
  }, getProps(), {
124
145
  key: itemId
125
146
  }), url && !shouldDisable() && /*#__PURE__*/_react.default.createElement(_reactRouterDom.Link, {
126
147
  className: "linkitem",
127
- to: url
148
+ to: url,
149
+ target: target
128
150
  }), (displayCheckbox || leftElement || leftIconName || leftIcon) && /*#__PURE__*/_react.default.createElement("div", {
129
- className: "".concat(getClass(), " -icon-left")
151
+ className: `${getClass()} -icon-left`
130
152
  }, renderCheckBox, leftElement, getIcon(leftIconName, leftIcon)), (text || subText || children) && /*#__PURE__*/_react.default.createElement("div", {
131
- className: "".concat(getClass())
132
- }, /*#__PURE__*/_react.default.createElement("p", {
133
- className: "".concat(text && 'text')
134
- }, text), /*#__PURE__*/_react.default.createElement("p", {
135
- className: "".concat(subText && 'subtext')
153
+ className: `${getClass()}`
154
+ }, text && /*#__PURE__*/_react.default.createElement("p", {
155
+ className: `${text && 'text'}`
156
+ }, text), subText && /*#__PURE__*/_react.default.createElement("p", {
157
+ className: `${subText && 'subtext'}`
136
158
  }, subText), children), (rightIconName || rightIcon || rightElement || disabledByPermission) && /*#__PURE__*/_react.default.createElement("div", {
137
- className: "".concat(getClass(), " -icon-right")
159
+ className: `${getClass()} -icon-right`
138
160
  }, getIcon(rightIconName, rightIcon), rightElement));
139
161
  };
140
- var _default = exports.default = Item;
162
+ var _default = exports.default = (0, _withTooltip.default)(Item);
@@ -3,6 +3,7 @@ import { IListContext } from './types.js';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../@types/Icon.js';
5
5
  import '../icons/helper.js';
6
+ import '../@types/Position.js';
6
7
 
7
8
  declare const ListContext: React__default.Context<IListContext>;
8
9
  declare const LIST_ITEMS_TYPES: {
@@ -6,6 +6,7 @@ import 'react';
6
6
  import '../@types/PermissionAttr.js';
7
7
  import '../@types/Icon.js';
8
8
  import '../icons/helper.js';
9
+ import '../@types/Position.js';
9
10
 
10
11
  declare const List: (props: IListProps) => JSX.Element;
11
12
 
package/lib/list/index.js CHANGED
@@ -36,7 +36,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
36
36
  const List = props => {
37
37
  const {
38
38
  children,
39
- customClass = '',
39
+ customClass,
40
40
  condensed,
41
41
  transparent,
42
42
  style,
@@ -175,7 +175,8 @@ const List = props => {
175
175
  "data-testid": "list-component",
176
176
  style: style,
177
177
  ref: listRef,
178
- className: "list-component ".concat(condensed && '-condensed', " ").concat(!transparent && '-listbackground', " ").concat(customClass)
178
+ className: `list-component ${condensed && '-condensed'}
179
+ ${customClass} ${!transparent && '-listbackground'}`
179
180
  }, newChildren));
180
181
  };
181
182
  var _default = exports.default = List;
@@ -1,6 +1,7 @@
1
- import { ReactNode, ReactElement, CSSProperties, Ref } from 'react';
1
+ import { ReactNode, ReactElement, CSSProperties, ComponentPropsWithoutRef, Ref } from 'react';
2
2
  import { PermissionAttr } from '../@types/PermissionAttr.js';
3
3
  import { IconNames } from '../@types/Icon.js';
4
+ import { Position } from '../@types/Position.js';
4
5
  import '../icons/helper.js';
5
6
 
6
7
  type ItemId = string;
@@ -46,12 +47,18 @@ interface IListItemProps {
46
47
  rightIconName?: IconNames;
47
48
  customClass?: string;
48
49
  url?: string;
50
+ target?: ComponentPropsWithoutRef<'a'>['target'];
49
51
  visible?: boolean;
50
52
  itemId?: string;
51
53
  children?: ReactNode;
52
54
  permissionAttr?: PermissionAttr | PermissionAttr[];
53
55
  selectOnEnter?: boolean;
54
56
  skeletonize?: boolean;
57
+ targetRef?: (ref: HTMLLIElement) => void;
58
+ tooltipPosition?: Exclude<Position, 'center'>;
59
+ tooltipWidth?: string | number;
60
+ tooltip?: string;
61
+ onDeniedText?: string;
55
62
  }
56
63
  interface IListContext {
57
64
  selectable: boolean;
@@ -29,7 +29,7 @@ const MenuItem = _ref => {
29
29
  const dropdownContext = (0, _react.useContext)(_withDropdown.WithDropdownContext);
30
30
  const handleOnClick = () => {
31
31
  if (onClick) {
32
- onClick(dropdownContext === null || dropdownContext === void 0 ? void 0 : dropdownContext.handleDropdownClose);
32
+ onClick(dropdownContext?.handleDropdownClose);
33
33
  return;
34
34
  }
35
35
  if (dropdownContext) dropdownContext.handleDropdownClose();
@@ -37,7 +37,7 @@ const MenuItem = _ref => {
37
37
  return /*#__PURE__*/_react.default.createElement("div", {
38
38
  className: "floatmenuitem"
39
39
  }, /*#__PURE__*/_react.default.createElement("div", {
40
- className: "".concat(customClassMenuItem, " -items")
40
+ className: `${customClassMenuItem} -items`
41
41
  }, !_lodash.default.isEmpty(dropdownMenu) && !onClick && /*#__PURE__*/_react.default.createElement(_buttons.default, {
42
42
  customClass: "floatmenudropdown",
43
43
  iconName: "more1",
@@ -46,7 +46,7 @@ const SubMenuContainer = _ref => {
46
46
  handlerGoBack();
47
47
  }, []);
48
48
  return /*#__PURE__*/_react.default.createElement("div", {
49
- className: "floatsubmenu ".concat(customClass)
49
+ className: `floatsubmenu ${customClass}`
50
50
  }, /*#__PURE__*/_react.default.createElement("div", {
51
51
  className: "submenuheader"
52
52
  }, /*#__PURE__*/_react.default.createElement(_icons.default, {
@@ -47,7 +47,7 @@ const FloatMenu = props => {
47
47
  return /*#__PURE__*/_react.default.createElement(_helpers.default.Provider, {
48
48
  value: contextValues
49
49
  }, /*#__PURE__*/_react.default.createElement("div", {
50
- className: "floatmenu-component ".concat(customClass)
50
+ className: `floatmenu-component ${customClass}`
51
51
  }, /*#__PURE__*/_react.default.createElement(_buttons.default, {
52
52
  transparent: true,
53
53
  key: "button-",
@@ -14,7 +14,7 @@ const ExpandMenu = _ref => {
14
14
  iconName
15
15
  } = _ref;
16
16
  return /*#__PURE__*/_react.default.createElement("div", {
17
- className: "openclosemenu ".concat(expandMenuCustomClass),
17
+ className: `openclosemenu ${expandMenuCustomClass}`,
18
18
  role: "button",
19
19
  tabIndex: 0,
20
20
  onClick: onExpandMenu,
@@ -20,7 +20,7 @@ const NavMenuGroup = _ref => {
20
20
  } = (0, _react.useContext)(_helpers.SideNavContext);
21
21
  return /*#__PURE__*/_react.default.createElement("ul", {
22
22
  style: style,
23
- className: "".concat(scrollable && 'customscroll', " ").concat((0, _helpers.default)(isExpanded, menuSize))
23
+ className: `${scrollable && 'customscroll'} ${(0, _helpers.default)(isExpanded, menuSize)}`
24
24
  }, children);
25
25
  };
26
26
  var _default = exports.default = NavMenuGroup;
@@ -10,28 +10,32 @@ var _icons = _interopRequireDefault(require("../../icons"));
10
10
  var _MenuLink = _interopRequireDefault(require("./MenuLink"));
11
11
  var _helpers = require("./helpers");
12
12
  var _permissionValidations = require("../../permissionValidations");
13
+ const _excluded = ["iconName", "title", "children", "childrenIsSubMenu", "url", "customClass", "permissionAttr", "maxWidth", "minWidth", "columnsQtty", "targetRef", "disableDefaultStyle", "showDropdownOnClick", "style", "customClassForDropdown"];
13
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
15
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
16
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
17
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
18
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
19
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
17
20
  const NavMenuItem = props => {
18
21
  const {
19
- iconName,
20
- title,
21
- children,
22
- childrenIsSubMenu = true,
23
- url,
24
- customClass,
25
- permissionAttr,
26
- maxWidth = '90%',
27
- minWidth = 500,
28
- columnsQtty,
29
- targetRef,
30
- disableDefaultStyle = false,
31
- showDropdownOnClick = false,
32
- style,
33
- customClassForDropdown
34
- } = props;
22
+ iconName,
23
+ title,
24
+ children,
25
+ childrenIsSubMenu = true,
26
+ url,
27
+ customClass,
28
+ permissionAttr,
29
+ maxWidth = '90%',
30
+ minWidth = 500,
31
+ columnsQtty,
32
+ targetRef,
33
+ disableDefaultStyle = false,
34
+ showDropdownOnClick = false,
35
+ style,
36
+ customClassForDropdown
37
+ } = props,
38
+ rest = _objectWithoutProperties(props, _excluded);
35
39
  const [showSubMenu, setShowSubMenu] = (0, _react.useState)(false);
36
40
  const [targetDimensions, setTargetDimensions] = (0, _react.useState)({});
37
41
  const [isOnEndWindow, setIsOnEndWindow] = (0, _react.useState)(false);
@@ -76,19 +80,17 @@ const NavMenuItem = props => {
76
80
  (0, _react.useEffect)(() => {
77
81
  if (showSubMenu && showDropdownOnClick) {
78
82
  document.addEventListener('click', e => {
79
- var _menuItemRef$current;
80
83
  const target = e.target;
81
- const insideMenu = (_menuItemRef$current = menuItemRef.current) === null || _menuItemRef$current === void 0 ? void 0 : _menuItemRef$current.contains(target);
84
+ const insideMenu = menuItemRef.current?.contains(target);
82
85
  if (!insideMenu) setShowSubMenu(false);
83
86
  });
84
87
  }
85
88
  }, [showSubMenu, showDropdownOnClick]);
86
89
  (0, _react.useEffect)(() => {
87
- var _submenuContainerRef$, _submenuContentRef$cu, _submenuContentRef$cu2;
88
- const heigthSubmenuContainer = ((_submenuContainerRef$ = submenuContainerRef.current) === null || _submenuContainerRef$ === void 0 ? void 0 : _submenuContainerRef$.clientHeight) || 0;
89
- const heigthSubmenuContent = ((_submenuContentRef$cu = submenuContentRef.current) === null || _submenuContentRef$cu === void 0 ? void 0 : _submenuContentRef$cu.clientHeight) || 0;
90
+ const heigthSubmenuContainer = submenuContainerRef.current?.clientHeight || 0;
91
+ const heigthSubmenuContent = submenuContentRef.current?.clientHeight || 0;
90
92
  const maxHeigthSubMenu = isOnEndWindow ? '100%' : (window.innerHeight - targetDimensions.top - (heigthSubmenuContainer - heigthSubmenuContent) - 1).toString().concat('px') || '0px';
91
- (_submenuContentRef$cu2 = submenuContentRef.current) === null || _submenuContentRef$cu2 === void 0 ? void 0 : _submenuContentRef$cu2.style.setProperty('max-height', maxHeigthSubMenu);
93
+ submenuContentRef.current?.style.setProperty('max-height', maxHeigthSubMenu);
92
94
  }, [showSubMenu]);
93
95
  if (unvisible) return null;
94
96
  return /*#__PURE__*/_react.default.createElement(_helpers.SubMenuContext.Provider, {
@@ -99,7 +101,7 @@ const NavMenuItem = props => {
99
101
  menuItemRef.current = r;
100
102
  if (targetRef) targetRef(r);
101
103
  },
102
- className: "item ".concat(url && !disabled && '-withlink', " ").concat(customClass, " ").concat(disabled && '-disabled'),
104
+ className: `item ${url && !disabled && '-withlink'} ${customClass} ${disabled && '-disabled'}`,
103
105
  onMouseEnter: onMouseEnter,
104
106
  onMouseLeave: () => {
105
107
  if (showDropdownOnClick) return;
@@ -123,7 +125,7 @@ const NavMenuItem = props => {
123
125
  className: "title"
124
126
  }, title), !childrenIsSubMenu && children)), showSubMenu && children && childrenIsSubMenu && !disabled && !openSearchMenuPopup && /*#__PURE__*/_react.default.createElement("div", {
125
127
  ref: submenuContainerRef,
126
- className: "".concat(customClassForDropdown, " ").concat(disableDefaultStyle ? '' : 'submenu-container'),
128
+ className: `${customClassForDropdown} ${disableDefaultStyle ? '' : 'submenu-container'}`,
127
129
  style: isOnEndWindow ? {
128
130
  marginLeft: targetDimensions.width,
129
131
  bottom: '0',
@@ -141,7 +143,7 @@ const NavMenuItem = props => {
141
143
  ref: submenuContentRef,
142
144
  className: "submenu",
143
145
  style: {
144
- gridTemplateColumns: "repeat(".concat(columnsQtty, ", 1fr)")
146
+ gridTemplateColumns: `repeat(${columnsQtty}, 1fr)`
145
147
  }
146
148
  }, children))));
147
149
  };