linear-react-components-ui 1.1.22 → 1.1.24-beta.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 (258) hide show
  1. package/lib/@types/ColorStyles.d.ts +2 -1
  2. package/lib/@types/Position.d.ts +2 -1
  3. package/lib/BaseMask-3d5d581d.d.ts +24 -0
  4. package/lib/BaseNumber-797088d7.d.ts +23 -0
  5. package/lib/Cnpj-1602be21.d.ts +18 -0
  6. package/lib/Cpf-4d6b9079.d.ts +18 -0
  7. package/lib/Currency-b33d3a22.d.ts +18 -0
  8. package/lib/Decimal-55e836d5.d.ts +13 -0
  9. package/lib/Number-9c6aceff.d.ts +20 -0
  10. package/lib/Phone-79e5e3b4.d.ts +18 -0
  11. package/lib/ZipCode-8c2e9d8b.d.ts +13 -0
  12. package/lib/assets/styles/checkbox2.scss +199 -0
  13. package/lib/assets/styles/colorpicker.scss +1 -6
  14. package/lib/assets/styles/colors.scss +48 -12
  15. package/lib/assets/styles/datepicker2.scss +338 -0
  16. package/lib/assets/styles/label.scss +4 -2
  17. package/lib/assets/styles/select.scss +19 -15
  18. package/lib/assets/styles/selectfield.scss +409 -0
  19. package/lib/assets/styles/slot.scss +34 -0
  20. package/lib/assets/styles/textfield.scss +148 -0
  21. package/lib/buttons/ActivateButton.d.ts +1 -0
  22. package/lib/buttons/AddButton.d.ts +1 -0
  23. package/lib/buttons/Button.d.ts +1 -0
  24. package/lib/buttons/CancelButton.d.ts +1 -0
  25. package/lib/buttons/DangerButton.d.ts +1 -0
  26. package/lib/buttons/DefaultButton.d.ts +1 -0
  27. package/lib/buttons/DefaultButton.js +20 -12
  28. package/lib/buttons/DestroyButton.d.ts +1 -0
  29. package/lib/buttons/EditButton.d.ts +1 -0
  30. package/lib/buttons/InactivateButton.d.ts +1 -0
  31. package/lib/buttons/InfoButton.d.ts +1 -0
  32. package/lib/buttons/PrimaryButton.d.ts +1 -0
  33. package/lib/buttons/RestoreButton.d.ts +1 -0
  34. package/lib/buttons/SaveButton.d.ts +1 -0
  35. package/lib/buttons/SuccessButton.d.ts +1 -0
  36. package/lib/buttons/WarningButton.d.ts +1 -0
  37. package/lib/buttons/index.d.ts +1 -0
  38. package/lib/buttons/split_button/index.d.ts +1 -0
  39. package/lib/buttons/types.d.ts +2 -5
  40. package/lib/drawer/Drawer.js +10 -6
  41. package/lib/form/Field.d.ts +1 -1
  42. package/lib/form/FieldArray.d.ts +1 -1
  43. package/lib/form/FieldNumber.d.ts +1 -1
  44. package/lib/form/FieldPeriod.d.ts +1 -1
  45. package/lib/form/helpers.d.ts +1 -1
  46. package/lib/form/index.d.ts +1 -1
  47. package/lib/form/types.d.ts +1 -1
  48. package/lib/form/withFieldHOC.d.ts +1 -1
  49. package/lib/form/withFormSecurity.d.ts +1 -1
  50. package/lib/form2/helpers.d.ts +8 -0
  51. package/lib/form2/helpers.js +41 -0
  52. package/lib/form2/index.d.ts +9 -0
  53. package/lib/form2/index.js +36 -0
  54. package/lib/form2/types.d.ts +125 -0
  55. package/lib/form2/types.js +5 -0
  56. package/lib/form2/useForm/index.d.ts +5 -0
  57. package/lib/form2/useForm/index.js +203 -0
  58. package/lib/icons/helper.d.ts +4 -0
  59. package/lib/icons/helper.js +4 -0
  60. package/lib/icons/index.d.ts +4 -6
  61. package/lib/icons/index.js +14 -9
  62. package/lib/icons/types.d.ts +3 -6
  63. package/lib/index-18a64236.d.ts +23 -0
  64. package/lib/index-368f781f.d.ts +15 -0
  65. package/lib/index-43ad8140.d.ts +41 -0
  66. package/lib/index-772f9f1a.d.ts +44 -0
  67. package/lib/index-8a59cf4b.d.ts +23 -0
  68. package/lib/index-c9247c1f.d.ts +15 -0
  69. package/lib/index.d.ts +1 -0
  70. package/lib/inputs/base/InputTextBase.d.ts +1 -1
  71. package/lib/inputs/base/InputTextBase.js +18 -8
  72. package/lib/inputs/base/helpers.d.ts +1 -1
  73. package/lib/inputs/base/types.d.ts +5 -16
  74. package/lib/inputs/color/index.js +1 -1
  75. package/lib/inputs/color/types.d.ts +1 -1
  76. package/lib/inputs/date/Dialog.d.ts +1 -1
  77. package/lib/inputs/date/Dropdown.d.ts +1 -1
  78. package/lib/inputs/date/index.d.ts +1 -1
  79. package/lib/inputs/date/types.d.ts +2 -2
  80. package/lib/inputs/errorMessage/index.d.ts +1 -1
  81. package/lib/inputs/file/DefaultFile.d.ts +1 -1
  82. package/lib/inputs/file/DefaultFile.js +1 -1
  83. package/lib/inputs/file/DragDropFile.d.ts +1 -1
  84. package/lib/inputs/file/File.d.ts +1 -1
  85. package/lib/inputs/file/FileButtonSettings.d.ts +1 -1
  86. package/lib/inputs/file/helpers.d.ts +1 -1
  87. package/lib/inputs/file/index.d.ts +1 -1
  88. package/lib/inputs/file/types.d.ts +1 -1
  89. package/lib/inputs/inputHOC.d.ts +1 -1
  90. package/lib/inputs/mask/BaseMask.d.ts +1 -1
  91. package/lib/inputs/mask/BaseMask.js +9 -6
  92. package/lib/inputs/mask/Cnpj.d.ts +1 -1
  93. package/lib/inputs/mask/Cpf.d.ts +1 -1
  94. package/lib/inputs/mask/Phone.d.ts +1 -1
  95. package/lib/inputs/mask/ZipCode.d.ts +1 -1
  96. package/lib/inputs/mask/helpers.d.ts +1 -1
  97. package/lib/inputs/mask/helpers.js +1 -1
  98. package/lib/inputs/mask/index.d.ts +1 -1
  99. package/lib/inputs/mask/types.d.ts +2 -2
  100. package/lib/inputs/multiSelect/ActionButtons.d.ts +1 -1
  101. package/lib/inputs/multiSelect/Dropdown.d.ts +1 -1
  102. package/lib/inputs/multiSelect/helper.d.ts +1 -1
  103. package/lib/inputs/multiSelect/index.d.ts +1 -1
  104. package/lib/inputs/multiSelect/types.d.ts +2 -2
  105. package/lib/inputs/number/BaseNumber.d.ts +1 -1
  106. package/lib/inputs/number/BaseNumber.js +3 -2
  107. package/lib/inputs/number/Currency.d.ts +1 -1
  108. package/lib/inputs/number/Decimal.d.ts +1 -1
  109. package/lib/inputs/number/format_number.d.ts +1 -1
  110. package/lib/inputs/number/format_number.js +4 -2
  111. package/lib/inputs/number/index.d.ts +1 -1
  112. package/lib/inputs/number/types.d.ts +4 -4
  113. package/lib/inputs/period/Dialog.d.ts +1 -1
  114. package/lib/inputs/period/Dropdown.d.ts +1 -1
  115. package/lib/inputs/period/PeriodList.d.ts +1 -1
  116. package/lib/inputs/period/helper.d.ts +1 -1
  117. package/lib/inputs/period/index.d.ts +1 -1
  118. package/lib/inputs/period/index.js +8 -10
  119. package/lib/inputs/period/types.d.ts +2 -5
  120. package/lib/inputs/search/index.d.ts +1 -1
  121. package/lib/inputs/select/ActionButtons.d.ts +1 -1
  122. package/lib/inputs/select/Dropdown.d.ts +1 -1
  123. package/lib/inputs/select/helper.d.ts +1 -1
  124. package/lib/inputs/select/index.d.ts +1 -1
  125. package/lib/inputs/select/multiple/Selecteds.d.ts +2 -2
  126. package/lib/inputs/select/multiple/Selecteds.js +3 -1
  127. package/lib/inputs/select/multiple/index.d.ts +1 -1
  128. package/lib/inputs/select/multiple/index.js +3 -2
  129. package/lib/inputs/select/simple/index.d.ts +1 -1
  130. package/lib/inputs/select/simple/index.js +3 -3
  131. package/lib/inputs/select/types.d.ts +2 -1
  132. package/lib/inputs/text/index.d.ts +1 -1
  133. package/lib/inputs/text/types.d.ts +2 -3
  134. package/lib/inputs/textarea/index.d.ts +1 -1
  135. package/lib/inputs/textarea/types.d.ts +1 -1
  136. package/lib/inputs/types.d.ts +2 -2
  137. package/lib/inputs2/checkboxfield/index.d.ts +7 -0
  138. package/lib/inputs2/checkboxfield/index.js +146 -0
  139. package/lib/inputs2/colorfield/index.d.ts +9 -0
  140. package/lib/inputs2/colorfield/index.js +119 -0
  141. package/lib/inputs2/date/base/constants.d.ts +7 -0
  142. package/lib/inputs2/date/base/constants.js +43 -0
  143. package/lib/inputs2/date/base/index.d.ts +12 -0
  144. package/lib/inputs2/date/base/index.js +179 -0
  145. package/lib/inputs2/date/datefield/calendarbox.d.ts +7 -0
  146. package/lib/inputs2/date/datefield/calendarbox.js +115 -0
  147. package/lib/inputs2/date/datefield/context.d.ts +13 -0
  148. package/lib/inputs2/date/datefield/context.js +15 -0
  149. package/lib/inputs2/date/datefield/index.d.ts +9 -0
  150. package/lib/inputs2/date/datefield/index.js +334 -0
  151. package/lib/inputs2/date/datefield/triggers.d.ts +8 -0
  152. package/lib/inputs2/date/datefield/triggers.js +47 -0
  153. package/lib/inputs2/date/datefield/types.d.ts +61 -0
  154. package/lib/inputs2/date/datefield/types.js +5 -0
  155. package/lib/inputs2/date/dateperiodfield/calendarbox.d.ts +7 -0
  156. package/lib/inputs2/date/dateperiodfield/calendarbox.js +136 -0
  157. package/lib/inputs2/date/dateperiodfield/context.d.ts +13 -0
  158. package/lib/inputs2/date/dateperiodfield/context.js +17 -0
  159. package/lib/inputs2/date/dateperiodfield/index.d.ts +9 -0
  160. package/lib/inputs2/date/dateperiodfield/index.js +592 -0
  161. package/lib/inputs2/date/dateperiodfield/triggers.d.ts +6 -0
  162. package/lib/inputs2/date/dateperiodfield/triggers.js +120 -0
  163. package/lib/inputs2/date/dateperiodfield/types.d.ts +99 -0
  164. package/lib/inputs2/date/dateperiodfield/types.js +19 -0
  165. package/lib/inputs2/date/helpers.d.ts +20 -0
  166. package/lib/inputs2/date/helpers.js +62 -0
  167. package/lib/inputs2/date/types.d.ts +59 -0
  168. package/lib/inputs2/date/types.js +19 -0
  169. package/lib/inputs2/index.d.ts +29 -0
  170. package/lib/inputs2/index.js +38 -0
  171. package/lib/inputs2/mask/BaseMask.d.ts +10 -0
  172. package/lib/inputs2/mask/BaseMask.js +95 -0
  173. package/lib/inputs2/mask/Cnpj.d.ts +11 -0
  174. package/lib/inputs2/mask/Cnpj.js +57 -0
  175. package/lib/inputs2/mask/Cpf.d.ts +11 -0
  176. package/lib/inputs2/mask/Cpf.js +53 -0
  177. package/lib/inputs2/mask/Phone.d.ts +11 -0
  178. package/lib/inputs2/mask/Phone.js +26 -0
  179. package/lib/inputs2/mask/ZipCode.d.ts +11 -0
  180. package/lib/inputs2/mask/ZipCode.js +23 -0
  181. package/lib/inputs2/mask/helpers.d.ts +4 -0
  182. package/lib/inputs2/mask/helpers.js +57 -0
  183. package/lib/inputs2/number/BaseNumber.d.ts +10 -0
  184. package/lib/inputs2/number/BaseNumber.js +86 -0
  185. package/lib/inputs2/number/Currency.d.ts +11 -0
  186. package/lib/inputs2/number/Currency.js +47 -0
  187. package/lib/inputs2/number/Decimal.d.ts +11 -0
  188. package/lib/inputs2/number/Decimal.js +36 -0
  189. package/lib/inputs2/number/Number.d.ts +9 -0
  190. package/lib/inputs2/number/Number.js +49 -0
  191. package/lib/inputs2/number/format_number.d.ts +5 -0
  192. package/lib/inputs2/number/format_number.js +29 -0
  193. package/lib/inputs2/selectfield/context.d.ts +38 -0
  194. package/lib/inputs2/selectfield/context.js +15 -0
  195. package/lib/inputs2/selectfield/helpers.d.ts +6 -0
  196. package/lib/inputs2/selectfield/helpers.js +25 -0
  197. package/lib/inputs2/selectfield/index.d.ts +10 -0
  198. package/lib/inputs2/selectfield/index.js +491 -0
  199. package/lib/inputs2/selectfield/item.d.ts +11 -0
  200. package/lib/inputs2/selectfield/item.js +85 -0
  201. package/lib/inputs2/selectfield/listbox.d.ts +7 -0
  202. package/lib/inputs2/selectfield/listbox.js +103 -0
  203. package/lib/inputs2/selectfield/search.d.ts +7 -0
  204. package/lib/inputs2/selectfield/search.js +71 -0
  205. package/lib/inputs2/selectfield/selections.d.ts +10 -0
  206. package/lib/inputs2/selectfield/selections.js +86 -0
  207. package/lib/inputs2/selectfield/triggers.d.ts +8 -0
  208. package/lib/inputs2/selectfield/triggers.js +100 -0
  209. package/lib/inputs2/selectfield/types.d.ts +55 -0
  210. package/lib/inputs2/selectfield/types.js +21 -0
  211. package/lib/inputs2/slot/index.d.ts +14 -0
  212. package/lib/inputs2/slot/index.js +47 -0
  213. package/lib/inputs2/textfield/index.d.ts +8 -0
  214. package/lib/inputs2/textfield/index.js +159 -0
  215. package/lib/internals/types.d.ts +1 -17
  216. package/lib/labels/DangerLabel.d.ts +1 -0
  217. package/lib/labels/DefaultLabel.d.ts +3 -5
  218. package/lib/labels/DefaultLabel.js +15 -7
  219. package/lib/labels/InfoLabel.d.ts +1 -0
  220. package/lib/labels/PrimaryLabel.d.ts +1 -0
  221. package/lib/labels/SuccessLabel.d.ts +1 -0
  222. package/lib/labels/WarningLabel.d.ts +1 -0
  223. package/lib/labels/index.d.ts +3 -2
  224. package/lib/labels/types.d.ts +2 -5
  225. package/lib/list/Header.d.ts +1 -0
  226. package/lib/list/Item.d.ts +3 -5
  227. package/lib/list/Item.js +17 -12
  228. package/lib/list/helpers.d.ts +1 -0
  229. package/lib/list/index.d.ts +1 -0
  230. package/lib/list/types.d.ts +4 -6
  231. package/lib/menus/sidenav/ExpandMenu.d.ts +2 -2
  232. package/lib/menus/sidenav/MenuLink.d.ts +4 -7
  233. package/lib/menus/sidenav/MenuLink.js +20 -11
  234. package/lib/menus/sidenav/NavMenuGroup.d.ts +2 -2
  235. package/lib/menus/sidenav/NavMenuItem.d.ts +4 -7
  236. package/lib/menus/sidenav/NavMenuItem.js +16 -12
  237. package/lib/menus/sidenav/NavSubMenuItem.d.ts +2 -2
  238. package/lib/menus/sidenav/helpers.d.ts +2 -2
  239. package/lib/menus/sidenav/index.d.ts +2 -2
  240. package/lib/menus/sidenav/popup_menu_search/EmptyList.d.ts +2 -2
  241. package/lib/menus/sidenav/popup_menu_search/index.d.ts +2 -2
  242. package/lib/menus/sidenav/types.d.ts +6 -6
  243. package/lib/popover/PopoverText.js +11 -2
  244. package/lib/popover/types.d.ts +1 -0
  245. package/lib/textContent/index.d.ts +6 -11
  246. package/lib/textContent/index.js +20 -11
  247. package/lib/tooltip/TooltipContent.d.ts +7 -0
  248. package/lib/tooltip/TooltipContent.js +65 -0
  249. package/lib/tooltip/index.d.ts +4 -3
  250. package/lib/tooltip/index.js +36 -53
  251. package/lib/tooltip/types.d.ts +25 -3
  252. package/lib/tooltip/useTooltip.d.ts +30 -0
  253. package/lib/tooltip/useTooltip.js +128 -0
  254. package/package.json +4 -3
  255. package/lib/inputs/base/Label.d.ts +0 -14
  256. package/lib/inputs/base/Label.js +0 -35
  257. package/lib/internals/withTooltip.d.ts +0 -12
  258. package/lib/internals/withTooltip.js +0 -172
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
- var _withTooltip = _interopRequireDefault(require("../../internals/withTooltip"));
9
8
  var _icons = _interopRequireDefault(require("../../icons"));
9
+ var _tooltip = require("../../tooltip");
10
10
  var _MenuLink = _interopRequireDefault(require("./MenuLink"));
11
11
  var _helpers = require("./helpers");
12
12
  var _permissionValidations = require("../../permissionValidations");
@@ -26,11 +26,14 @@ const NavMenuItem = props => {
26
26
  maxWidth = '90%',
27
27
  minWidth = 500,
28
28
  columnsQtty,
29
- targetRef,
30
29
  disableDefaultStyle = false,
31
30
  showDropdownOnClick = false,
32
31
  style,
33
- customClassForDropdown
32
+ customClassForDropdown,
33
+ tooltip,
34
+ tooltipPosition,
35
+ tooltipWidth,
36
+ errorMessage
34
37
  } = props;
35
38
  const [showSubMenu, setShowSubMenu] = (0, _react.useState)(false);
36
39
  const [targetDimensions, setTargetDimensions] = (0, _react.useState)({});
@@ -93,10 +96,7 @@ const NavMenuItem = props => {
93
96
  value: contextValues
94
97
  }, /*#__PURE__*/_react.default.createElement("li", {
95
98
  style: style,
96
- ref: r => {
97
- menuItemRef.current = r;
98
- if (targetRef) targetRef(r);
99
- },
99
+ ref: menuItemRef,
100
100
  className: `item ${url && !disabled && '-withlink'} ${customClass} ${disabled && '-disabled'}`,
101
101
  onMouseEnter: onMouseEnter,
102
102
  onMouseLeave: () => {
@@ -110,9 +110,7 @@ const NavMenuItem = props => {
110
110
  }
111
111
  }, /*#__PURE__*/_react.default.createElement(_MenuLink.default, _extends({
112
112
  disabled: disabled
113
- }, props, {
114
- targetRef: null
115
- }), /*#__PURE__*/_react.default.createElement(_react.Fragment, null, iconName && /*#__PURE__*/_react.default.createElement(_icons.default, {
113
+ }, props), /*#__PURE__*/_react.default.createElement(_react.Fragment, null, iconName && /*#__PURE__*/_react.default.createElement(_icons.default, {
116
114
  name: iconName,
117
115
  size: menuSize === 'small' && 16 || menuSize === 'medium' && 24 || menuSize === 'large' && 32 || 16,
118
116
  customClassForContainer: "menuicon-container",
@@ -141,6 +139,12 @@ const NavMenuItem = props => {
141
139
  style: {
142
140
  gridTemplateColumns: `repeat(${columnsQtty}, 1fr)`
143
141
  }
144
- }, children))));
142
+ }, children))), /*#__PURE__*/_react.default.createElement(_tooltip.Tooltip, {
143
+ targetRef: menuItemRef,
144
+ text: tooltip,
145
+ position: tooltipPosition,
146
+ width: tooltipWidth,
147
+ textError: errorMessage
148
+ }));
145
149
  };
146
- var _default = exports.default = (0, _withTooltip.default)(NavMenuItem);
150
+ var _default = exports.default = NavMenuItem;
@@ -2,10 +2,10 @@ import { INavSubMenuItemProps } from './types.js';
2
2
  import 'react';
3
3
  import '../../@types/PermissionAttr.js';
4
4
  import '../../@types/Size.js';
5
- import '../../internals/types.js';
6
- import '../../@types/Position.js';
7
5
  import '../../@types/Icon.js';
8
6
  import '../../icons/helper.js';
7
+ import '../../tooltip/types.js';
8
+ import '../../@types/Position.js';
9
9
 
10
10
  declare const NavSubMenuItem: ({ title, url, permissionAttr }: INavSubMenuItemProps) => JSX.Element | null;
11
11
 
@@ -2,10 +2,10 @@ import React__default from 'react';
2
2
  import { ISubMenuContext, ISideNavContext } from './types.js';
3
3
  import '../../@types/PermissionAttr.js';
4
4
  import '../../@types/Size.js';
5
- import '../../internals/types.js';
6
- import '../../@types/Position.js';
7
5
  import '../../@types/Icon.js';
8
6
  import '../../icons/helper.js';
7
+ import '../../tooltip/types.js';
8
+ import '../../@types/Position.js';
9
9
 
10
10
  declare const getCssClassMenu: (isExpanded?: boolean, size?: string) => string;
11
11
  declare const SubMenuContext: React__default.Context<ISubMenuContext>;
@@ -6,10 +6,10 @@ import { ISideNavProps } from './types.js';
6
6
  import 'react';
7
7
  import '../../@types/PermissionAttr.js';
8
8
  import '../../@types/Size.js';
9
- import '../../internals/types.js';
10
- import '../../@types/Position.js';
11
9
  import '../../@types/Icon.js';
12
10
  import '../../icons/helper.js';
11
+ import '../../tooltip/types.js';
12
+ import '../../@types/Position.js';
13
13
 
14
14
  declare const SideNav: (props: ISideNavProps) => JSX.Element;
15
15
 
@@ -2,10 +2,10 @@ import { IEmptyListProps } from '../types.js';
2
2
  import 'react';
3
3
  import '../../../@types/PermissionAttr.js';
4
4
  import '../../../@types/Size.js';
5
- import '../../../internals/types.js';
6
- import '../../../@types/Position.js';
7
5
  import '../../../@types/Icon.js';
8
6
  import '../../../icons/helper.js';
7
+ import '../../../tooltip/types.js';
8
+ import '../../../@types/Position.js';
9
9
 
10
10
  declare const EmptyList: ({ info, visible, }: IEmptyListProps) => JSX.Element;
11
11
 
@@ -2,10 +2,10 @@ import React__default from 'react';
2
2
  import { IPopupMenuSearchProps } from '../types.js';
3
3
  import '../../../@types/PermissionAttr.js';
4
4
  import '../../../@types/Size.js';
5
- import '../../../internals/types.js';
6
- import '../../../@types/Position.js';
7
5
  import '../../../@types/Icon.js';
8
6
  import '../../../icons/helper.js';
7
+ import '../../../tooltip/types.js';
8
+ import '../../../@types/Position.js';
9
9
 
10
10
  declare const PopupMenuSearch: (props: IPopupMenuSearchProps) => React__default.ReactPortal;
11
11
 
@@ -1,10 +1,10 @@
1
1
  import { ReactNode, ReactElement, CSSProperties } from 'react';
2
2
  import { PermissionAttr } from '../../@types/PermissionAttr.js';
3
3
  import { Size } from '../../@types/Size.js';
4
- import { WithTooltipProps } from '../../internals/types.js';
5
4
  import { IconNames } from '../../@types/Icon.js';
6
- import '../../@types/Position.js';
5
+ import { ITooltipCommonProps } from '../../tooltip/types.js';
7
6
  import '../../icons/helper.js';
7
+ import '../../@types/Position.js';
8
8
 
9
9
  interface ISideNavProps {
10
10
  children: ReactNode;
@@ -30,18 +30,18 @@ interface IMenuItemContent {
30
30
  content: string;
31
31
  url: string;
32
32
  }
33
- interface IMenuLinkProps extends WithTooltipProps {
33
+ interface IMenuLinkProps extends ITooltipCommonProps {
34
34
  children: ReactElement;
35
35
  url?: string;
36
- targetRef?: ((ref: HTMLAnchorElement | null) => void) | null;
37
36
  disabled?: boolean;
37
+ errorMessage?: string;
38
38
  }
39
39
  interface INavMenuGroupProps {
40
40
  children: ReactNode;
41
41
  scrollable?: boolean;
42
42
  style?: CSSProperties;
43
43
  }
44
- interface INavMenuItemProps extends WithTooltipProps {
44
+ interface INavMenuItemProps extends ITooltipCommonProps {
45
45
  children?: ReactNode;
46
46
  title?: string;
47
47
  iconName?: IconNames;
@@ -52,11 +52,11 @@ interface INavMenuItemProps extends WithTooltipProps {
52
52
  minWidth?: string | number;
53
53
  maxWidth?: string | number;
54
54
  columnsQtty?: number;
55
- targetRef?: (ref: HTMLLIElement | null) => void;
56
55
  disableDefaultStyle?: boolean;
57
56
  showDropdownOnClick?: boolean;
58
57
  style?: CSSProperties;
59
58
  customClassForDropdown?: string;
59
+ errorMessage?: string;
60
60
  }
61
61
  interface INavSubMenuItemProps {
62
62
  title: string;
@@ -9,11 +9,20 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
9
9
  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; }
10
10
  const PopoverText = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
11
11
  let {
12
- children
12
+ children,
13
+ text
13
14
  } = _ref;
15
+ const hintRef = (0, _react.useRef)(null);
16
+ (0, _react.useImperativeHandle)(ref, () => hintRef.current, [hintRef.current]);
17
+ (0, _react.useEffect)(() => {
18
+ if (hintRef.current && text !== undefined) {
19
+ hintRef.current.innerHTML = text;
20
+ }
21
+ }, [text, hintRef.current]);
14
22
  return /*#__PURE__*/_react.default.createElement("p", {
15
23
  className: "text",
16
- ref: ref
24
+ ref: hintRef,
25
+ "data-testid": "popover-text"
17
26
  }, children);
18
27
  });
19
28
  PopoverText.displayName = 'PopoverText';
@@ -10,6 +10,7 @@ interface PopoverTitleProps {
10
10
  }
11
11
  interface PopoverTextProps {
12
12
  children?: ReactNode;
13
+ text?: string;
13
14
  }
14
15
  interface IPopoverProps {
15
16
  iconName?: IconNames;
@@ -1,22 +1,17 @@
1
- import React__default, { MutableRefObject } from 'react';
2
- import { WithTooltipProps } from '../internals/types.js';
3
- import '../@types/PermissionAttr.js';
1
+ import React__default from 'react';
2
+ import { ITooltipCommonProps } from '../tooltip/types.js';
4
3
  import '../@types/Position.js';
5
4
 
6
- interface TextContentProps extends React__default.HTMLAttributes<HTMLElement>, WithTooltipProps {
5
+ interface TextContentProps extends React__default.HTMLAttributes<HTMLElement>, ITooltipCommonProps {
7
6
  as?: 'span' | 'strong' | 'p';
8
7
  label?: string | string[];
9
8
  styleForLabel?: object;
10
9
  labelUppercase?: boolean;
11
10
  required?: boolean;
12
11
  disabled?: boolean;
13
- targetRef?: (ref: HTMLSpanElement | null) => void;
14
- labelRef?: MutableRefObject<HTMLSpanElement | null>;
15
12
  onHoverLabel?: (e: React__default.MouseEvent<HTMLSpanElement, MouseEvent>) => void;
13
+ errorMessage?: string;
16
14
  }
17
- declare const _default: {
18
- (props: TextContentProps & React__default.RefAttributes<HTMLElement>): JSX.Element;
19
- displayName: string;
20
- };
15
+ declare const TextContent: React__default.ForwardRefExoticComponent<TextContentProps & React__default.RefAttributes<HTMLElement>>;
21
16
 
22
- export { _default as default };
17
+ export { TextContent as default };
@@ -6,10 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  require("../assets/styles/textContent.scss");
9
- var _withTooltip = _interopRequireDefault(require("../internals/withTooltip"));
10
- var _lodash = _interopRequireDefault(require("lodash"));
11
- const _excluded = ["as", "children", "className", "styleForLabel", "onHoverLabel"];
12
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ var _tooltip = require("../tooltip");
10
+ const _excluded = ["as", "children", "className", "styleForLabel", "onHoverLabel", "tooltip", "tooltipPosition", "tooltipWidth", "errorMessage", "labelUppercase"];
13
11
  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); }
14
12
  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; }
15
13
  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); }
@@ -21,18 +19,29 @@ const TextContent = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
21
19
  children,
22
20
  className,
23
21
  styleForLabel,
24
- onHoverLabel
22
+ onHoverLabel,
23
+ tooltip,
24
+ tooltipPosition,
25
+ tooltipWidth,
26
+ errorMessage,
27
+ labelUppercase: __
25
28
  } = _ref,
26
29
  props = _objectWithoutProperties(_ref, _excluded);
27
- const typedRef = ref;
28
- const restProps = _lodash.default.omit(props, ['tooltipWidth', 'tooltip', 'tooltipPosition', 'labelUppercase']);
29
- return /*#__PURE__*/_react.default.createElement(Comp, _extends({
30
- ref: typedRef,
30
+ const compRef = (0, _react.useRef)(null);
31
+ (0, _react.useImperativeHandle)(ref, () => compRef.current, []);
32
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(Comp, _extends({
33
+ ref: compRef,
31
34
  style: styleForLabel,
32
35
  className: `text-content-component ${className}`,
33
36
  "data-textcontent": Comp,
34
37
  onMouseEnter: onHoverLabel
35
- }, restProps), children);
38
+ }, props), children), /*#__PURE__*/_react.default.createElement(_tooltip.Tooltip, {
39
+ targetRef: compRef,
40
+ text: tooltip,
41
+ position: tooltipPosition,
42
+ width: tooltipWidth,
43
+ textError: errorMessage
44
+ }));
36
45
  });
37
46
  TextContent.displayName = 'TextContent';
38
- var _default = exports.default = (0, _withTooltip.default)(TextContent);
47
+ var _default = exports.default = TextContent;
@@ -0,0 +1,7 @@
1
+ import React__default from 'react';
2
+ import { ITooltipContentProps } from './types.js';
3
+ import '../@types/Position.js';
4
+
5
+ declare const TooltipContent: ({ text, textError, tooltipRef, style, styleForContent, tooltipDimensions, position, handlerSetDimensions, }: ITooltipContentProps) => React__default.ReactPortal;
6
+
7
+ export { TooltipContent as default };
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactDom = _interopRequireDefault(require("react-dom"));
9
+ var uuid = _interopRequireWildcard(require("uuid"));
10
+ require("../assets/styles/tooltip.scss");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ 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); }
13
+ 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; }
14
+ const TooltipContent = _ref => {
15
+ let {
16
+ text,
17
+ textError,
18
+ tooltipRef,
19
+ style = '',
20
+ styleForContent,
21
+ tooltipDimensions,
22
+ position = 'bottom',
23
+ handlerSetDimensions = () => {}
24
+ } = _ref;
25
+ const tooltipComponent = (0, _react.useRef)(document.createElement('div'));
26
+ (0, _react.useEffect)(() => {
27
+ tooltipComponent.current.id = `tooltip-${uuid.v1()}`;
28
+ tooltipComponent.current.className = `tooltip-component ${position} `;
29
+ tooltipComponent.current.dataset.testid = 'tooltip-component';
30
+ tooltipComponent.current.style.cssText = style;
31
+ document.body.appendChild(tooltipComponent.current);
32
+ const tooltipEl = document.querySelector(`div#${tooltipComponent.current.id}`);
33
+ let widthDimension = tooltipEl?.offsetWidth;
34
+ const heightDimension = tooltipEl?.offsetHeight;
35
+ if (tooltipDimensions && tooltipDimensions.width) {
36
+ widthDimension = tooltipDimensions.width;
37
+ }
38
+ handlerSetDimensions({
39
+ width: widthDimension,
40
+ height: Number(heightDimension)
41
+ });
42
+ // eslint-disable-next-line no-param-reassign
43
+ if (tooltipRef) {
44
+ tooltipRef.current = tooltipEl;
45
+ }
46
+ return () => {
47
+ document.body.removeChild(tooltipComponent.current);
48
+ };
49
+ }, []);
50
+ (0, _react.useEffect)(() => {
51
+ tooltipComponent.current.className = `tooltip-component ${position} `;
52
+ }, [position]);
53
+ (0, _react.useEffect)(() => {
54
+ tooltipComponent.current.style.cssText = style;
55
+ }, [style]);
56
+ (0, _react.useEffect)(() => {
57
+ tooltipComponent.current.className = textError ? `tooltip-error tooltip-component ${position}` : `tooltip-component ${position}`;
58
+ }, [textError]);
59
+ const getTooltipContent = () => /*#__PURE__*/_react.default.createElement("div", {
60
+ className: "tooltipcontent",
61
+ style: styleForContent
62
+ }, textError || text);
63
+ return /*#__PURE__*/_reactDom.default.createPortal(getTooltipContent(), tooltipComponent.current);
64
+ };
65
+ var _default = exports.default = TooltipContent;
@@ -1,6 +1,7 @@
1
- import React__default from 'react';
2
1
  import { ITooltipProps } from './types.js';
2
+ import 'react';
3
+ import '../@types/Position.js';
3
4
 
4
- declare const Tooltip: ({ text, textError, tooltipRef, style, tooltipDimensions, className, handlerSetDimensions, }: ITooltipProps) => React__default.ReactPortal;
5
+ declare function Tooltip({ text, textError, targetRef, style, width, space, className, position, onDeniedText, }: ITooltipProps): JSX.Element | null;
5
6
 
6
- export { Tooltip as default };
7
+ export { Tooltip, Tooltip as default };
@@ -3,61 +3,44 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _reactDom = _interopRequireDefault(require("react-dom"));
9
- var uuid = _interopRequireWildcard(require("uuid"));
10
- require("../assets/styles/tooltip.scss");
6
+ exports.Tooltip = exports.default = Tooltip;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _TooltipContent = _interopRequireDefault(require("./TooltipContent"));
9
+ var _useTooltip2 = require("./useTooltip");
10
+ const _excluded = ["showTooltip"];
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- 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); }
13
- 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; }
14
- const Tooltip = _ref => {
12
+ 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); }
13
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
14
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
15
+ function Tooltip(_ref) {
15
16
  let {
16
17
  text,
17
18
  textError,
18
- tooltipRef,
19
- style = '',
20
- tooltipDimensions,
21
- className = 'bottom',
22
- handlerSetDimensions = () => {}
19
+ targetRef,
20
+ style,
21
+ width,
22
+ space,
23
+ className,
24
+ position = 'bottom',
25
+ onDeniedText
23
26
  } = _ref;
24
- const tooltipComponent = (0, _react.useRef)(document.createElement('div'));
25
- (0, _react.useEffect)(() => {
26
- tooltipComponent.current.id = `tooltip-${uuid.v1()}`;
27
- tooltipComponent.current.className = `tooltip-component ${className} `;
28
- tooltipComponent.current.dataset.testid = 'tooltip-component';
29
- tooltipComponent.current.style.cssText = style;
30
- document.body.appendChild(tooltipComponent.current);
31
- const tooltipEl = document.querySelector(`div#${tooltipComponent.current.id}`);
32
- let widthDimension = tooltipEl?.offsetWidth;
33
- const heightDimension = tooltipEl?.offsetHeight;
34
- if (tooltipDimensions && tooltipDimensions.width) {
35
- widthDimension = tooltipDimensions.width;
36
- }
37
- handlerSetDimensions({
38
- width: widthDimension,
39
- height: Number(heightDimension)
40
- });
41
- // eslint-disable-next-line no-param-reassign
42
- if (tooltipRef) {
43
- tooltipRef.current = tooltipEl;
44
- }
45
- return () => {
46
- document.body.removeChild(tooltipComponent.current);
47
- };
48
- }, []);
49
- (0, _react.useEffect)(() => {
50
- tooltipComponent.current.className = `tooltip-component ${className} `;
51
- }, [className]);
52
- (0, _react.useEffect)(() => {
53
- tooltipComponent.current.style.cssText = style;
54
- }, [style]);
55
- (0, _react.useEffect)(() => {
56
- tooltipComponent.current.className = textError ? `tooltip-error tooltip-component ${className}` : `tooltip-component ${className}`;
57
- }, [textError]);
58
- const getTooltipContent = () => /*#__PURE__*/_react.default.createElement("div", {
59
- className: "tooltipcontent"
60
- }, textError || text);
61
- return /*#__PURE__*/_reactDom.default.createPortal(getTooltipContent(), tooltipComponent.current);
62
- };
63
- var _default = exports.default = Tooltip;
27
+ const _useTooltip = (0, _useTooltip2.useTooltip)({
28
+ targetRef,
29
+ errorMessage: textError,
30
+ position,
31
+ width,
32
+ text,
33
+ space,
34
+ onDeniedText
35
+ }),
36
+ {
37
+ showTooltip
38
+ } = _useTooltip,
39
+ tooltipContentProps = _objectWithoutProperties(_useTooltip, _excluded);
40
+ if (!showTooltip) return null;
41
+ return /*#__PURE__*/_react.default.createElement(_TooltipContent.default, _extends({
42
+ styleForContent: style,
43
+ classNameForContent: className,
44
+ position: position
45
+ }, tooltipContentProps));
46
+ }
@@ -1,17 +1,39 @@
1
- import { MutableRefObject } from 'react';
1
+ import { RefObject, CSSProperties, MutableRefObject } from 'react';
2
+ import { Position } from '../@types/Position.js';
2
3
 
3
4
  type Dimensions = {
4
5
  width: number | string;
5
6
  height: number;
6
7
  };
7
8
  interface ITooltipProps {
9
+ targetRef: RefObject<HTMLElement>;
8
10
  text?: string;
9
- style?: string;
11
+ textError?: string;
12
+ style?: CSSProperties;
10
13
  className?: string;
14
+ width?: string | number;
15
+ space?: number;
16
+ position?: Exclude<Position, 'center'>;
17
+ onDeniedText?: string;
18
+ }
19
+ interface ITooltipContentProps {
11
20
  tooltipRef?: MutableRefObject<HTMLElement | null>;
21
+ text?: string;
22
+ style?: string;
23
+ styleForContent?: CSSProperties;
24
+ classNameForContent?: string;
25
+ width?: string | number;
26
+ space?: number;
27
+ tooltip?: string;
28
+ position?: Exclude<Position, 'center'>;
12
29
  handlerSetDimensions?: ({ width, height }: Dimensions) => void;
13
30
  tooltipDimensions?: Dimensions;
14
31
  textError?: string;
15
32
  }
33
+ interface ITooltipCommonProps {
34
+ tooltip?: string;
35
+ tooltipWidth?: string | number;
36
+ tooltipPosition?: Exclude<Position, 'center'>;
37
+ }
16
38
 
17
- export { ITooltipProps };
39
+ export { ITooltipCommonProps, ITooltipContentProps, ITooltipProps };
@@ -0,0 +1,30 @@
1
+ import * as React from 'react';
2
+ import { RefObject } from 'react';
3
+ import { Position } from '../@types/Position.js';
4
+
5
+ interface UseTooltipProps {
6
+ text?: string;
7
+ width?: number | string;
8
+ space?: number;
9
+ position?: Exclude<Position, 'center'>;
10
+ errorMessage?: string;
11
+ targetRef: RefObject<HTMLElement>;
12
+ onDeniedText?: string;
13
+ }
14
+ declare function useTooltip({ targetRef, text, width: widthProp, space, position: positionProp, errorMessage, onDeniedText, }: UseTooltipProps): {
15
+ text: string | undefined;
16
+ tooltipRef: React.MutableRefObject<HTMLElement | null>;
17
+ style: string;
18
+ className: "left" | "right" | "top" | "bottom";
19
+ handlerSetDimensions: React.Dispatch<React.SetStateAction<{
20
+ width: string | number;
21
+ height: number;
22
+ }>>;
23
+ tooltipDimensions: {
24
+ width: string | number;
25
+ height: number;
26
+ };
27
+ showTooltip: boolean;
28
+ };
29
+
30
+ export { useTooltip };