@councilbox/councilbox-ui 2.0.53 → 2.0.55

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 (311) hide show
  1. package/Accordion.js +3 -0
  2. package/Alert.js +3 -0
  3. package/Avatar.js +3 -0
  4. package/AvatarGroup.js +3 -0
  5. package/Block.js +3 -0
  6. package/Button.js +3 -0
  7. package/ButtonBasic.js +3 -0
  8. package/Checkbox.js +3 -0
  9. package/DatePicker.js +3 -0
  10. package/DateRangePicker.js +3 -0
  11. package/DateTimePicker.js +3 -0
  12. package/DragDrop.js +3 -0
  13. package/DrawerPanel.js +3 -0
  14. package/DropDown.js +3 -0
  15. package/EnhancedTable.js +3 -0
  16. package/FabButton.js +3 -0
  17. package/Grid.js +3 -0
  18. package/Header.js +3 -0
  19. package/IconButton.js +3 -0
  20. package/IconButtonSquare.js +3 -0
  21. package/IconFont.js +3 -0
  22. package/InputAutocomplete.js +3 -0
  23. package/InputPassword.js +3 -0
  24. package/InputText.js +3 -0
  25. package/InputTextArea.js +3 -0
  26. package/LoadingSection.js +3 -0
  27. package/MenuItem.js +3 -0
  28. package/MenuLateralLeft.js +3 -0
  29. package/MenuLateralRight.js +3 -0
  30. package/Modal.js +3 -0
  31. package/Radio.js +3 -0
  32. package/RichTextInput.js +3 -0
  33. package/Scrollbar.js +3 -0
  34. package/ScrollbarNew.js +3 -0
  35. package/SelectInput.js +3 -0
  36. package/Slider.js +3 -0
  37. package/Spacing.js +3 -0
  38. package/Stars.js +3 -0
  39. package/Stepper.js +3 -0
  40. package/Table.js +3 -0
  41. package/TableBody.js +3 -0
  42. package/TableCell.js +3 -0
  43. package/TableContainer.js +3 -0
  44. package/TableHead.js +3 -0
  45. package/TableRow.js +3 -0
  46. package/TableSortLabel.js +3 -0
  47. package/Tabs.js +3 -0
  48. package/Tag.js +3 -0
  49. package/TextInput.js +3 -0
  50. package/ThemeProvider.js +3 -0
  51. package/TimePicker.js +3 -0
  52. package/Timeline.js +3 -0
  53. package/ToastProvider.js +3 -0
  54. package/Toggle.js +3 -0
  55. package/Tooltip.js +3 -0
  56. package/Typography.js +3 -0
  57. package/dist/HOCs/overlayA11yStack.js +47 -0
  58. package/dist/HOCs/useA11yGuard.js +38 -0
  59. package/dist/HOCs/useDynamicStyles.js +41 -60
  60. package/dist/HOCs/useMenuNavigation.js +110 -0
  61. package/dist/HOCs/useOverlay.js +87 -0
  62. package/dist/HOCs/usePopoverPosition.js +228 -0
  63. package/dist/HOCs/useRipple.js +17 -35
  64. package/dist/HOCs/useWindowSize.js +24 -42
  65. package/dist/build-index.js +119 -99
  66. package/dist/components/1.Introduction.stories.mdx +4 -1
  67. package/dist/components/2.Changelog.stories.mdx +54 -0
  68. package/dist/components/3.Guide.stories.mdx +1 -1
  69. package/dist/components/Accordion/Accordion.css +7 -0
  70. package/dist/components/Accordion/Accordion.js +97 -102
  71. package/dist/components/Accordion/Accordion.stories.js +10 -12
  72. package/dist/components/Accordion/DesignAccordion.stories.js +10 -21
  73. package/dist/components/Alert/Alert.js +55 -55
  74. package/dist/components/Alert/Alert.stories.js +10 -11
  75. package/dist/components/Avatar/Avatar.js +82 -74
  76. package/dist/components/Avatar/Avatar.stories.js +19 -23
  77. package/dist/components/Avatar/DesignAvatar.stories.js +18 -26
  78. package/dist/components/Avatar/DesignAvatarText.stories.js +31 -40
  79. package/dist/components/AvatarGroup/AvatarGroup.js +7 -14
  80. package/dist/components/AvatarGroup/AvatarGroup.stories.js +6 -13
  81. package/dist/components/AvatarGroup/DesignAvatarGroup.stories.js +34 -45
  82. package/dist/components/Block/Block.css +3 -3
  83. package/dist/components/Block/Block.js +31 -45
  84. package/dist/components/Block/Block.stories.js +5 -12
  85. package/dist/components/Block/DesignBlock.stories.js +7 -13
  86. package/dist/components/Button/Button.js +44 -66
  87. package/dist/components/Button/Button.stories.js +8 -14
  88. package/dist/components/Button/button.css +1 -1
  89. package/dist/components/ButtonBasic/ButtonBasic.css +6 -1
  90. package/dist/components/ButtonBasic/ButtonBasic.js +96 -118
  91. package/dist/components/ButtonBasic/ButtonBasic.stories.js +14 -15
  92. package/dist/components/Checkbox/Checkbox.css +6 -0
  93. package/dist/components/Checkbox/Checkbox.js +81 -100
  94. package/dist/components/Checkbox/Checkbox.stories.js +10 -11
  95. package/dist/components/DatePicker/Calendar.js +243 -0
  96. package/dist/components/DatePicker/DatePicker.css +197 -0
  97. package/dist/components/DatePicker/DatePicker.js +384 -0
  98. package/dist/components/DatePicker/DatePicker.stories.js +180 -0
  99. package/dist/components/DatePicker/dateUtils.js +478 -0
  100. package/dist/components/DateRangePicker/DateRangePicker.css +41 -0
  101. package/dist/components/DateRangePicker/DateRangePicker.js +435 -0
  102. package/dist/components/DateRangePicker/DateRangePicker.stories.js +147 -0
  103. package/dist/components/DateRangePicker/RangeCalendar.js +188 -0
  104. package/dist/components/DateTimePicker/DateTimePicker.css +4 -0
  105. package/dist/components/DateTimePicker/DateTimePicker.js +481 -0
  106. package/dist/components/DateTimePicker/DateTimePicker.stories.js +144 -0
  107. package/dist/components/DateTimePicker/TimeColumns.css +46 -0
  108. package/dist/components/DateTimePicker/TimeColumns.js +175 -0
  109. package/dist/components/DragDrop/DragDrop.css +20 -9
  110. package/dist/components/DragDrop/DragDrop.js +83 -76
  111. package/dist/components/DragDrop/DragDrop.stories.js +9 -16
  112. package/dist/components/DrawerPanel/DesignDrawerPanel.js +35 -53
  113. package/dist/components/DrawerPanel/DrawerPanel.js +157 -146
  114. package/dist/components/DrawerPanel/DrawerPanel.stories.js +10 -12
  115. package/dist/components/DropDown/DesignDropDown.stories.js +87 -97
  116. package/dist/components/DropDown/DropDown.js +179 -343
  117. package/dist/components/DropDown/DropDown.stories.js +6 -12
  118. package/dist/components/DropDown/PopoverPlayground.js +68 -98
  119. package/dist/components/EnhancedTable/DesignEnhancedTable.stories.js +26 -36
  120. package/dist/components/EnhancedTable/EnhancedMyTable.js +16 -19
  121. package/dist/components/EnhancedTable/EnhancedTable.js +77 -136
  122. package/dist/components/EnhancedTable/EnhancedTable.stories.js +5 -12
  123. package/dist/components/EnhancedTable/EnhancedTableBody.js +11 -14
  124. package/dist/components/EnhancedTable/EnhancedTableCell.js +25 -34
  125. package/dist/components/EnhancedTable/EnhancedTableContainer.js +11 -14
  126. package/dist/components/EnhancedTable/EnhancedTableHead.js +11 -14
  127. package/dist/components/EnhancedTable/EnhancedTableRow.js +15 -18
  128. package/dist/components/EnhancedTable/EnhancedTableSortLabel.js +15 -18
  129. package/dist/components/FabButton/DesignFabButton.stories.js +9 -16
  130. package/dist/components/FabButton/FabButton.js +51 -54
  131. package/dist/components/FabButton/FabButton.stories.js +10 -12
  132. package/dist/components/Grid/DesignGrid.stories.js +7 -14
  133. package/dist/components/Grid/Grid.js +38 -46
  134. package/dist/components/Grid/Grid.stories.js +6 -13
  135. package/dist/components/Grid/GridItem.js +37 -39
  136. package/dist/components/Header/DesignHeader.stories.js +20 -24
  137. package/dist/components/Header/Header.js +227 -246
  138. package/dist/components/Header/Header.stories.js +9 -21
  139. package/dist/components/Header/header.css +10 -5
  140. package/dist/components/IconButton/DesignIconButton.stories.js +31 -36
  141. package/dist/components/IconButton/IconButton.css +6 -1
  142. package/dist/components/IconButton/IconButton.js +135 -140
  143. package/dist/components/IconButton/IconButton.stories.js +12 -13
  144. package/dist/components/IconButtonSquare/DesignIconButtonSquare.stories.js +5 -11
  145. package/dist/components/IconButtonSquare/IconButtonSquare.js +14 -28
  146. package/dist/components/IconButtonSquare/IconButtonSquare.stories.js +7 -13
  147. package/dist/components/IconFont/IconFont.js +27 -48
  148. package/dist/components/IconFont/IconFont.stories.js +5 -11
  149. package/dist/components/InputAutocomplete/InputAutocomplete.css +6 -0
  150. package/dist/components/InputAutocomplete/InputAutocomplete.js +184 -260
  151. package/dist/components/InputAutocomplete/InputAutocomplete.stories.js +5 -11
  152. package/dist/components/InputPassword/InputPassword.css +0 -6
  153. package/dist/components/InputPassword/InputPassword.js +58 -73
  154. package/dist/components/InputPassword/InputPassword.stories.js +5 -11
  155. package/dist/components/InputText/InputText.css +96 -83
  156. package/dist/components/InputText/InputText.js +211 -215
  157. package/dist/components/InputText/InputText.stories.js +11 -11
  158. package/dist/components/InputTextArea/DesignInputTextArea.stories.js +38 -51
  159. package/dist/components/InputTextArea/InputTextArea.js +84 -93
  160. package/dist/components/InputTextArea/InputTextArea.stories.js +5 -12
  161. package/dist/components/LoadingSection/LoadingSection.js +44 -51
  162. package/dist/components/LoadingSection/LoadingSection.stories.js +5 -11
  163. package/dist/components/MenuItem/DesignMenuItem.stories.js +20 -34
  164. package/dist/components/MenuItem/MenuItem.css +7 -2
  165. package/dist/components/MenuItem/MenuItem.js +131 -140
  166. package/dist/components/MenuItem/MenuItem.stories.js +6 -15
  167. package/dist/components/MenuLateralLeft/MenuLateralLeft.css +24 -0
  168. package/dist/components/MenuLateralLeft/MenuLateralLeft.js +120 -157
  169. package/dist/components/MenuLateralLeft/MenuLateralLeft.stories.js +5 -12
  170. package/dist/components/MenuLateralRight/MenuLateralRight.css +2 -2
  171. package/dist/components/MenuLateralRight/MenuLateralRight.js +91 -79
  172. package/dist/components/MenuLateralRight/MenuLateralRight.stories.js +5 -12
  173. package/dist/components/Modal/DesignModal.stories.js +15 -30
  174. package/dist/components/Modal/Modal.css +35 -15
  175. package/dist/components/Modal/Modal.js +156 -145
  176. package/dist/components/Modal/Modal.stories.js +7 -16
  177. package/dist/components/PaginationFooter/DesignPaginationFooter.stories.js +4 -10
  178. package/dist/components/PaginationFooter/PaginationFooter.css +10 -0
  179. package/dist/components/PaginationFooter/PaginationFooter.js +99 -91
  180. package/dist/components/PaginationFooter/PaginationFooter.stories.js +5 -12
  181. package/dist/components/RadioButton/Radio.css +19 -18
  182. package/dist/components/RadioButton/Radio.js +65 -83
  183. package/dist/components/RadioButton/Radio.stories.js +27 -36
  184. package/dist/components/RichTextInput/DesignRichTextInput.stories.js +119 -0
  185. package/dist/components/RichTextInput/RichTextInput.css +309 -0
  186. package/dist/components/RichTextInput/RichTextInput.js +851 -0
  187. package/dist/components/RichTextInput/RichTextInput.stories.js +33 -0
  188. package/dist/components/Ripple/DesignRipple.js +42 -41
  189. package/dist/components/Ripple/Ripple.stories.js +5 -11
  190. package/dist/components/Scrollbar/DesignScrollbar.js +5 -10
  191. package/dist/components/Scrollbar/Scrollbar.js +37 -56
  192. package/dist/components/Scrollbar/Scrollbar.stories.js +5 -12
  193. package/dist/components/ScrollbarNew/DesignScrollbarNew.js +24 -0
  194. package/dist/components/ScrollbarNew/ScrollbarNew.css +79 -0
  195. package/dist/components/ScrollbarNew/ScrollbarNew.js +426 -0
  196. package/dist/components/ScrollbarNew/ScrollbarNew.stories.js +37 -0
  197. package/dist/components/SelectInput/DesignSelectInput.js +22 -45
  198. package/dist/components/SelectInput/SelectInput.js +171 -218
  199. package/dist/components/SelectInput/SelectInput.stories.js +6 -15
  200. package/dist/components/Slider/DesignSlider.js +8 -14
  201. package/dist/components/Slider/Slider.css +57 -37
  202. package/dist/components/Slider/Slider.js +85 -84
  203. package/dist/components/Slider/Slider.stories.js +5 -12
  204. package/dist/components/Spacing/Spacing.js +38 -45
  205. package/dist/components/Spacing/Spacing.stories.js +5 -11
  206. package/dist/components/Stars/DesignStars.js +17 -30
  207. package/dist/components/Stars/Stars.css +55 -104
  208. package/dist/components/Stars/Stars.js +89 -73
  209. package/dist/components/Stars/Stars.stories.js +5 -12
  210. package/dist/components/Stepper/DesignStepper.stories.js +16 -30
  211. package/dist/components/Stepper/Stepper.css +46 -10
  212. package/dist/components/Stepper/Stepper.js +118 -134
  213. package/dist/components/Stepper/Stepper.stories.js +5 -12
  214. package/dist/components/Table/DesignTable.stories.js +200 -211
  215. package/dist/components/Table/Table.css +33 -2
  216. package/dist/components/Table/Table.js +30 -38
  217. package/dist/components/Table/Table.stories.js +5 -12
  218. package/dist/components/Table/TableBody.js +22 -34
  219. package/dist/components/Table/TableCell.js +71 -61
  220. package/dist/components/Table/TableContainer.js +22 -34
  221. package/dist/components/Table/TableHead.js +22 -34
  222. package/dist/components/Table/TableRow.js +33 -37
  223. package/dist/components/Table/TableSortLabel.js +42 -52
  224. package/dist/components/Tabs/DesignTabs.js +14 -28
  225. package/dist/components/Tabs/Tabs.css +30 -11
  226. package/dist/components/Tabs/Tabs.js +151 -138
  227. package/dist/components/Tabs/Tabs.stories.js +5 -12
  228. package/dist/components/Tag/DesignTags.stories.js +24 -39
  229. package/dist/components/Tag/Tag.css +61 -42
  230. package/dist/components/Tag/Tag.js +93 -91
  231. package/dist/components/Tag/Tag.stories.js +5 -12
  232. package/dist/components/TextInput/TextInput.js +38 -54
  233. package/dist/components/TextInput/TextInput.stories.js +5 -11
  234. package/dist/components/ThemeProvider/Colors.js +2 -2
  235. package/dist/components/ThemeProvider/CouncilboxThemeContext.js +7 -10
  236. package/dist/components/ThemeProvider/ThemeProvider.js +34 -52
  237. package/dist/components/TimePicker/TimePicker.css +3 -0
  238. package/dist/components/TimePicker/TimePicker.js +359 -0
  239. package/dist/components/TimePicker/TimePicker.stories.js +132 -0
  240. package/dist/components/Timeline/DesignTimeline.stories.js +4 -10
  241. package/dist/components/Timeline/Timeline.js +66 -46
  242. package/dist/components/Timeline/Timeline.stories.js +5 -12
  243. package/dist/components/Toast/DesignToast.stories.js +174 -0
  244. package/dist/components/Toast/Toast.css +154 -0
  245. package/dist/components/Toast/Toast.js +165 -0
  246. package/dist/components/Toast/Toast.stories.js +33 -0
  247. package/dist/components/Toast/ToastProvider.js +33 -0
  248. package/dist/components/Toast/ToastRoot.js +89 -0
  249. package/dist/components/Toast/toastStore.js +127 -0
  250. package/dist/components/Toast/useToast.js +42 -0
  251. package/dist/components/Toggle/Toggle.css +10 -0
  252. package/dist/components/Toggle/Toggle.js +123 -100
  253. package/dist/components/Toggle/Toggle.stories.js +10 -11
  254. package/dist/components/Tooltip/DesignTooltip.stories.js +10 -16
  255. package/dist/components/Tooltip/Tooltip.css +17 -1
  256. package/dist/components/Tooltip/Tooltip.js +195 -366
  257. package/dist/components/Tooltip/Tooltip.stories.js +5 -12
  258. package/dist/components/Typography/Typography.css +57 -6
  259. package/dist/components/Typography/Typography.js +44 -97
  260. package/dist/components/Typography/Typography.stories.js +5 -11
  261. package/dist/index.js +2 -6
  262. package/dist/reportWebVitals.js +8 -14
  263. package/dist/storybook.test.js +2 -4
  264. package/dist/styles/colorConsts.css +4 -4
  265. package/dist/styles/main.css +16 -0
  266. package/dist/styles/styleFont.css +1 -1
  267. package/dist/styles/stylesheet.js +10 -22
  268. package/dist/styles/zIndexConsts.css +2 -0
  269. package/dist/testing/TestAutocomplete.js +74 -97
  270. package/dist/testing/TestComponents.js +5 -10
  271. package/dist/testing/TestDropdown.js +33 -41
  272. package/dist/utils/autoDetectScroll.js +12 -35
  273. package/dist/utils/index.js +37 -63
  274. package/dist/utils/useFallbackId.js +19 -0
  275. package/package.json +67 -4
  276. package/toast.js +7 -0
  277. package/useCouncilboxTheme.js +7 -0
  278. package/useToast.js +7 -0
  279. package/dist/components/Accordion/AccordionOld.css +0 -16
  280. package/dist/components/Accordion/AccordionOld.js +0 -115
  281. package/dist/components/Avatar/AvatarOld.js +0 -138
  282. package/dist/components/ButtonBasic/ButtonBasicOld.css +0 -41
  283. package/dist/components/ButtonBasic/ButtonBasicOld.js +0 -231
  284. package/dist/components/Checkbox/CheckboxOld.css +0 -31
  285. package/dist/components/Checkbox/CheckboxOld.js +0 -112
  286. package/dist/components/DrawerPanel/DrawerPanelOld.css +0 -56
  287. package/dist/components/DrawerPanel/DrawerPanelOld.js +0 -233
  288. package/dist/components/DropDown/DropDownOld.css +0 -3
  289. package/dist/components/DropDown/DropDownOld.js +0 -186
  290. package/dist/components/Grid/GridItemOld.js +0 -43
  291. package/dist/components/Grid/GridOld.css +0 -0
  292. package/dist/components/Grid/GridOld.js +0 -53
  293. package/dist/components/IconButton/IconButtonOld.css +0 -0
  294. package/dist/components/IconButton/IconButtonOld.js +0 -138
  295. package/dist/components/IconButtonSquare/IconButtonSquareOld.css +0 -43
  296. package/dist/components/IconButtonSquare/IconButtonSquareOld.js +0 -133
  297. package/dist/components/InputAutocomplete/InputAutocompleteOld.css +0 -5
  298. package/dist/components/InputAutocomplete/InputAutocompleteOld.js +0 -178
  299. package/dist/components/InputText/InputTextOld.css +0 -10
  300. package/dist/components/InputText/InputTextOld.js +0 -340
  301. package/dist/components/MenuItem/MenuItemOld.js +0 -139
  302. package/dist/components/Modal/ModalOld.css +0 -3
  303. package/dist/components/Modal/ModalOld.js +0 -230
  304. package/dist/components/RadioButton/RadioOld.css +0 -31
  305. package/dist/components/RadioButton/RadioOld.js +0 -142
  306. package/dist/components/SelectInput/SelectInputOld.css +0 -17
  307. package/dist/components/SelectInput/SelectInputOld.js +0 -325
  308. package/dist/components/Table/TableOld.css +0 -79
  309. package/dist/components/Table/TableOld.js +0 -165
  310. package/dist/components/Tabs/TabsOld.js +0 -92
  311. package/dist/components/Typography/TypographyOld.js +0 -132
@@ -1,431 +1,263 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.default = void 0;
7
-
7
+ exports["default"] = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
-
10
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
10
  var _reactDom = require("react-dom");
13
-
14
11
  require("../../styles/main.css");
15
-
16
12
  require("./Tooltip.css");
17
-
18
13
  var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
19
-
14
+ var _usePopoverPosition2 = _interopRequireDefault(require("../../HOCs/usePopoverPosition"));
15
+ var _useFallbackId = _interopRequireDefault(require("../../utils/useFallbackId"));
20
16
  var _excluded = ["id", "open", "anchorOrigin", "transformOrigin", "placement", "forceClose", "sx", "style", "styles", "prefixClass", "setOpen", "className", "children", "title"];
21
-
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
25
-
26
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
27
-
28
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
29
-
30
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
31
-
32
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
33
-
17
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
18
+ 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); }
19
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
20
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
21
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
22
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
23
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
24
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
34
25
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
35
-
36
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
37
-
38
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
39
-
40
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
41
-
42
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
43
-
44
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
45
-
46
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
47
-
26
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
27
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) { n[e] = r[e]; } return n; }
28
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) { ; } } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
29
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
30
+ 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; }
31
+ 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; }
48
32
  var OUT_MARGIN = 4;
49
33
  var ANIMATION_DURATION = 100;
50
-
51
- var getDefaultCoordinates = function getDefaultCoordinates(_ref) {
52
- var transformOrigin = _ref.transformOrigin,
53
- anchorOrigin = _ref.anchorOrigin,
54
- tooltipRect = _ref.tooltipRect,
55
- anchorRect = _ref.anchorRect,
56
- viewportHeight = _ref.viewportHeight,
57
- viewportWidth = _ref.viewportWidth;
58
- var anchorVertical = anchorRect[anchorOrigin.vertical !== 'center' ? anchorOrigin.vertical : 'top'];
59
- var anchorHorizontal = anchorRect[anchorOrigin.horizontal !== 'center' ? anchorOrigin.horizontal : 'left'];
60
-
61
- if (anchorOrigin.vertical === 'center') {
62
- anchorVertical += anchorRect.height / 2;
63
- }
64
-
65
- if (anchorOrigin.horizontal === 'center') {
66
- anchorHorizontal += anchorRect.width / 2;
67
- }
68
-
69
- var transformVertical = 0;
70
- var transformHorizontal = 0;
71
-
72
- if (transformOrigin.vertical === 'center') {
73
- transformVertical = tooltipRect.height / 2;
74
- }
75
-
76
- if (transformOrigin.horizontal === 'center') {
77
- transformHorizontal = tooltipRect.width / 2;
78
- }
79
-
80
- var top = null;
81
- var left = null;
82
- var right = null;
83
- var bottom = null;
84
-
85
- if (transformOrigin.vertical === 'top') {
86
- top = anchorVertical - transformVertical;
87
-
88
- if (top + tooltipRect.height > viewportHeight) {
89
- top = null;
90
- bottom = OUT_MARGIN;
91
- }
92
-
93
- if (top < 0) {
94
- top = OUT_MARGIN;
95
- }
96
- }
97
-
98
- if (transformOrigin.vertical === 'center') {
99
- top = anchorVertical - transformVertical;
100
-
101
- if (top + tooltipRect.height > viewportHeight) {
102
- bottom = OUT_MARGIN;
103
- }
104
-
105
- if (top < 0) {
106
- top = OUT_MARGIN;
107
- }
108
- }
109
-
110
- if (transformOrigin.horizontal === 'left') {
111
- left = anchorHorizontal - transformHorizontal;
112
- }
113
-
114
- if (transformOrigin.horizontal === 'right') {
115
- if (anchorOrigin.horizontal === 'center') {
116
- right = anchorHorizontal - transformHorizontal;
117
- } else {
118
- right = viewportWidth - anchorRect[anchorOrigin.horizontal];
119
- }
120
-
121
- if (right + tooltipRect.width > viewportWidth) {
122
- left = OUT_MARGIN;
123
- right = null;
124
- }
34
+ var getTooltipPlacements = function getTooltipPlacements(placementTooltip) {
35
+ switch (placementTooltip) {
36
+ case 'top':
37
+ return {
38
+ computedAnchorOrigin: {
39
+ vertical: 'top',
40
+ horizontal: 'center'
41
+ },
42
+ computedTransformOrigin: {
43
+ vertical: 'bottom',
44
+ horizontal: 'center'
45
+ }
46
+ };
47
+ case 'right':
48
+ return {
49
+ computedAnchorOrigin: {
50
+ vertical: 'center',
51
+ horizontal: 'right'
52
+ },
53
+ computedTransformOrigin: {
54
+ vertical: 'center',
55
+ horizontal: 'left'
56
+ }
57
+ };
58
+ case 'bottom':
59
+ return {
60
+ computedAnchorOrigin: {
61
+ vertical: 'bottom',
62
+ horizontal: 'center'
63
+ },
64
+ computedTransformOrigin: {
65
+ vertical: 'top',
66
+ horizontal: 'center'
67
+ }
68
+ };
69
+ case 'left':
70
+ return {
71
+ computedAnchorOrigin: {
72
+ vertical: 'center',
73
+ horizontal: 'left'
74
+ },
75
+ computedTransformOrigin: {
76
+ vertical: 'center',
77
+ horizontal: 'right'
78
+ }
79
+ };
80
+ default:
81
+ return {
82
+ computedAnchorOrigin: {
83
+ vertical: 'center',
84
+ horizontal: 'right'
85
+ },
86
+ computedTransformOrigin: {
87
+ vertical: 'center',
88
+ horizontal: 'left'
89
+ }
90
+ };
125
91
  }
126
-
127
- if (transformOrigin.horizontal === 'center') {
128
- left = anchorHorizontal - transformHorizontal;
129
-
130
- if (left + tooltipRect.width > viewportWidth) {
131
- right = OUT_MARGIN;
132
- }
133
-
134
- if (left < 0) {
135
- left = OUT_MARGIN;
136
- }
137
- }
138
-
139
- if (left + tooltipRect.width > viewportWidth) {
140
- right = OUT_MARGIN;
141
- }
142
-
143
- if (left < 0) {
144
- left = OUT_MARGIN;
145
- }
146
-
147
- if (transformOrigin.vertical === 'bottom') {
148
- if (anchorOrigin.vertical === 'center') {
149
- bottom = viewportHeight - anchorVertical;
150
- } else {
151
- bottom = viewportHeight - anchorRect[anchorOrigin.vertical];
152
- }
153
-
154
- if (bottom + tooltipRect.height > viewportHeight) {
155
- top = OUT_MARGIN;
156
- bottom = null;
157
- }
158
- }
159
-
160
- return {
161
- top: top,
162
- left: left,
163
- right: right,
164
- bottom: bottom
165
- };
166
92
  };
167
-
168
- var Tooltip = function Tooltip(_ref2) {
169
- var id = _ref2.id,
170
- open = _ref2.open,
171
- _ref2$anchorOrigin = _ref2.anchorOrigin,
172
- anchorOrigin = _ref2$anchorOrigin === void 0 ? {
173
- vertical: 'center',
174
- horizontal: 'right'
175
- } : _ref2$anchorOrigin,
176
- _ref2$transformOrigin = _ref2.transformOrigin,
177
- transformOrigin = _ref2$transformOrigin === void 0 ? {
178
- vertical: 'center',
179
- horizontal: 'left'
180
- } : _ref2$transformOrigin,
181
- placement = _ref2.placement,
182
- forceClose = _ref2.forceClose,
183
- sx = _ref2.sx,
184
- style = _ref2.style,
185
- styles = _ref2.styles,
186
- propPrefixClass = _ref2.prefixClass,
187
- setOpen = _ref2.setOpen,
188
- className = _ref2.className,
189
- children = _ref2.children,
190
- title = _ref2.title,
191
- props = _objectWithoutProperties(_ref2, _excluded);
192
-
193
- var memoizedSx = _react.default.useMemo(function () {
93
+ var Tooltip = function Tooltip(_ref) {
94
+ var id = _ref.id,
95
+ open = _ref.open,
96
+ _ref$anchorOrigin = _ref.anchorOrigin,
97
+ anchorOrigin = _ref$anchorOrigin === void 0 ? {
98
+ vertical: 'center',
99
+ horizontal: 'right'
100
+ } : _ref$anchorOrigin,
101
+ _ref$transformOrigin = _ref.transformOrigin,
102
+ transformOrigin = _ref$transformOrigin === void 0 ? {
103
+ vertical: 'center',
104
+ horizontal: 'left'
105
+ } : _ref$transformOrigin,
106
+ placement = _ref.placement,
107
+ forceClose = _ref.forceClose,
108
+ sx = _ref.sx,
109
+ style = _ref.style,
110
+ styles = _ref.styles,
111
+ propPrefixClass = _ref.prefixClass,
112
+ setOpen = _ref.setOpen,
113
+ className = _ref.className,
114
+ children = _ref.children,
115
+ title = _ref.title,
116
+ props = _objectWithoutProperties(_ref, _excluded);
117
+ var memoizedSx = _react["default"].useMemo(function () {
194
118
  return sx;
195
119
  }, []);
196
-
197
- var _useDynamicStyles = (0, _useDynamicStyles2.default)(memoizedSx),
198
- stylesInLine = _useDynamicStyles.stylesInLine,
199
- dynamicPrefixClass = _useDynamicStyles.prefixClass;
200
-
120
+ var _useDynamicStyles = (0, _useDynamicStyles2["default"])(memoizedSx),
121
+ stylesInLine = _useDynamicStyles.stylesInLine,
122
+ dynamicPrefixClass = _useDynamicStyles.prefixClass;
201
123
  var prefixClass = propPrefixClass || dynamicPrefixClass;
202
-
203
- var containerTooltipRef = _react.default.useRef(null);
204
-
205
- var tooltipRef = _react.default.useRef(null);
206
-
207
- var timeoutRef = _react.default.useRef(null);
208
-
209
- var childElement = /*#__PURE__*/_react.default.isValidElement(children) && !Array.isArray(children) ? _react.default.Children.only(children) : /*#__PURE__*/_react.default.createElement("span", null, children);
210
-
211
- var _React$useState = _react.default.useState(open || false),
212
- _React$useState2 = _slicedToArray(_React$useState, 2),
213
- isOpen = _React$useState2[0],
214
- setIsOpenState = _React$useState2[1];
215
-
216
- var _React$useState3 = _react.default.useState(false),
217
- _React$useState4 = _slicedToArray(_React$useState3, 2),
218
- isVisible = _React$useState4[0],
219
- setIsVisible = _React$useState4[1];
220
-
221
- var _React$useState5 = _react.default.useState(null),
222
- _React$useState6 = _slicedToArray(_React$useState5, 2),
223
- popoverStyles = _React$useState6[0],
224
- setPopoverStyles = _React$useState6[1];
225
-
226
- var _React$useState7 = _react.default.useState(open || false),
227
- _React$useState8 = _slicedToArray(_React$useState7, 2),
228
- shouldRender = _React$useState8[0],
229
- setShouldRender = _React$useState8[1];
230
-
124
+ var containerTooltipRef = _react["default"].useRef(null);
125
+ var tooltipRef = _react["default"].useRef(null);
126
+ var timeoutRef = _react["default"].useRef(null);
127
+ var childElement = /*#__PURE__*/_react["default"].isValidElement(children) && !Array.isArray(children) ? _react["default"].Children.only(children)
128
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
129
+ : /*#__PURE__*/_react["default"].createElement("span", {
130
+ tabIndex: 0
131
+ }, children);
132
+ var generatedId = (0, _useFallbackId["default"])('cbx-tooltip');
133
+ var tooltipId = id || generatedId;
134
+ var _React$useState = _react["default"].useState(open || false),
135
+ _React$useState2 = _slicedToArray(_React$useState, 2),
136
+ isOpen = _React$useState2[0],
137
+ setIsOpenState = _React$useState2[1];
138
+ var _React$useState3 = _react["default"].useState(false),
139
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
140
+ isVisible = _React$useState4[0],
141
+ setIsVisible = _React$useState4[1];
142
+ var _React$useState5 = _react["default"].useState(open || false),
143
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
144
+ shouldRender = _React$useState6[0],
145
+ setShouldRender = _React$useState6[1];
146
+ var _React$useMemo = _react["default"].useMemo(function () {
147
+ return getTooltipPlacements(placement);
148
+ }, [placement]),
149
+ computedAnchorOrigin = _React$useMemo.computedAnchorOrigin,
150
+ computedTransformOrigin = _React$useMemo.computedTransformOrigin;
151
+ var _usePopoverPosition = (0, _usePopoverPosition2["default"])({
152
+ anchorRef: containerTooltipRef,
153
+ popoverRef: tooltipRef,
154
+ isOpen: isOpen,
155
+ anchorOrigin: placement ? computedAnchorOrigin : anchorOrigin,
156
+ transformOrigin: placement ? computedTransformOrigin : transformOrigin,
157
+ outMargin: OUT_MARGIN,
158
+ baseStyles: {
159
+ height: 'fit-content'
160
+ }
161
+ }),
162
+ popoverStyles = _usePopoverPosition.popoverStyles,
163
+ adjustPosition = _usePopoverPosition.adjustPosition;
231
164
  var setIsOpen = function setIsOpen(value) {
232
165
  setIsOpenState(value);
233
-
234
166
  if (setOpen) {
235
167
  setOpen(value);
236
168
  }
237
169
  };
238
-
239
- var openTooltip = _react.default.useCallback(function () {
170
+ var openTooltip = _react["default"].useCallback(function () {
240
171
  if (timeoutRef.current) {
241
172
  clearTimeout(timeoutRef.current);
242
173
  timeoutRef.current = null;
243
174
  }
244
-
245
175
  setShouldRender(true);
246
176
  setIsOpen(true);
247
177
  }, []);
248
-
249
- var closeTooltip = _react.default.useCallback(function () {
178
+ var closeTooltip = _react["default"].useCallback(function () {
250
179
  setIsOpen(false);
251
-
252
180
  if (forceClose) {
253
181
  forceClose(false);
254
182
  }
255
-
256
183
  timeoutRef.current = setTimeout(function () {
257
184
  setShouldRender(false);
258
185
  }, ANIMATION_DURATION);
259
186
  }, [forceClose]);
260
-
261
- var getTooltipPlacements = function getTooltipPlacements(placementTooltip) {
262
- switch (placementTooltip) {
263
- case 'top':
264
- return {
265
- computedAnchorOrigin: {
266
- vertical: 'top',
267
- horizontal: 'center'
268
- },
269
- computedTransformOrigin: {
270
- vertical: 'bottom',
271
- horizontal: 'center'
272
- }
273
- };
274
-
275
- case 'right':
276
- return {
277
- computedAnchorOrigin: {
278
- vertical: 'center',
279
- horizontal: 'right'
280
- },
281
- computedTransformOrigin: {
282
- vertical: 'center',
283
- horizontal: 'left'
284
- }
285
- };
286
-
287
- case 'bottom':
288
- return {
289
- computedAnchorOrigin: {
290
- vertical: 'bottom',
291
- horizontal: 'center'
292
- },
293
- computedTransformOrigin: {
294
- vertical: 'top',
295
- horizontal: 'center'
296
- }
297
- };
298
-
299
- case 'left':
300
- return {
301
- computedAnchorOrigin: {
302
- vertical: 'center',
303
- horizontal: 'left'
304
- },
305
- computedTransformOrigin: {
306
- vertical: 'center',
307
- horizontal: 'right'
308
- }
309
- };
310
-
311
- default:
312
- return {
313
- computedAnchorOrigin: {
314
- vertical: 'center',
315
- horizontal: 'right'
316
- },
317
- computedTransformOrigin: {
318
- vertical: 'center',
319
- horizontal: 'left'
320
- }
321
- };
322
- }
323
- };
324
-
325
- var adjustPopoverPosition = _react.default.useCallback(function () {
326
- if (!containerTooltipRef.current || !tooltipRef.current) return;
327
- var anchorRect = containerTooltipRef.current.getBoundingClientRect();
328
- var tooltipRect = tooltipRef.current.getBoundingClientRect();
329
- var viewportWidth = window.innerWidth;
330
- var viewportHeight = window.innerHeight;
331
-
332
- var _getTooltipPlacements = getTooltipPlacements(placement),
333
- computedAnchorOrigin = _getTooltipPlacements.computedAnchorOrigin,
334
- computedTransformOrigin = _getTooltipPlacements.computedTransformOrigin;
335
-
336
- var anchorOriginPopover = anchorOrigin;
337
- var transformOriginPopover = transformOrigin;
338
-
339
- if (placement) {
340
- anchorOriginPopover = computedAnchorOrigin;
341
- transformOriginPopover = computedTransformOrigin;
342
- }
343
-
344
- var _getDefaultCoordinate = getDefaultCoordinates({
345
- transformOrigin: transformOriginPopover,
346
- anchorOrigin: anchorOriginPopover,
347
- tooltipRect: tooltipRect,
348
- viewportWidth: viewportWidth,
349
- viewportHeight: viewportHeight,
350
- anchorRect: anchorRect,
351
- printLogs: id === 'centro'
352
- }),
353
- top = _getDefaultCoordinate.top,
354
- left = _getDefaultCoordinate.left,
355
- right = _getDefaultCoordinate.right,
356
- bottom = _getDefaultCoordinate.bottom;
357
-
358
- setPopoverStyles(_objectSpread(_objectSpread({
359
- position: 'absolute',
360
- height: 'fit-content'
361
- }, bottom ? {
362
- bottom: "".concat(bottom, "px")
363
- } : {
364
- top: "".concat(top, "px")
365
- }), right ? {
366
- right: "".concat(right, "px")
367
- } : {
368
- left: "".concat(left, "px")
369
- }));
370
- }, [setPopoverStyles, containerTooltipRef.current]);
371
-
372
- _react.default.useLayoutEffect(function () {
373
- if (isOpen) {
374
- setIsVisible(true);
375
- adjustPopoverPosition();
376
- window.addEventListener('resize', adjustPopoverPosition);
377
- } else {
378
- setIsVisible(false);
379
- }
380
-
187
+ _react["default"].useLayoutEffect(function () {
188
+ setIsVisible(isOpen);
381
189
  return function () {
382
- window.removeEventListener('resize', adjustPopoverPosition);
383
-
384
190
  if (timeoutRef.current) {
385
191
  clearTimeout(timeoutRef.current);
386
192
  }
387
193
  };
388
- }, [isOpen, adjustPopoverPosition]);
389
-
194
+ }, [isOpen]);
195
+ _react["default"].useEffect(function () {
196
+ if (!isOpen) return undefined;
197
+ var handleKeyDown = function handleKeyDown(event) {
198
+ if (event.key === 'Escape' || event.key === 'Esc') {
199
+ closeTooltip();
200
+ }
201
+ };
202
+ document.addEventListener('keydown', handleKeyDown);
203
+ return function () {
204
+ return document.removeEventListener('keydown', handleKeyDown);
205
+ };
206
+ }, [isOpen, closeTooltip]);
390
207
  var handleMouseEnter = function handleMouseEnter(event) {
391
208
  if (childElement.props.onMouseEnter) {
392
209
  childElement.props.onMouseEnter(event);
393
210
  }
394
-
395
211
  openTooltip();
396
212
  };
397
-
398
213
  var handleMouseLeave = function handleMouseLeave(event) {
399
214
  if (childElement.props.onMouseLeave) {
400
215
  childElement.props.onMouseLeave(event);
401
216
  }
402
-
403
217
  timeoutRef.current = setTimeout(function () {
404
218
  closeTooltip();
405
219
  }, ANIMATION_DURATION);
406
220
  };
407
-
221
+ var handleFocus = function handleFocus(event) {
222
+ if (childElement.props.onFocus) {
223
+ childElement.props.onFocus(event);
224
+ }
225
+ openTooltip();
226
+ };
227
+ var handleBlur = function handleBlur(event) {
228
+ if (childElement.props.onBlur) {
229
+ childElement.props.onBlur(event);
230
+ }
231
+ closeTooltip();
232
+ };
408
233
  var handleTooltipMouseEnter = function handleTooltipMouseEnter() {
409
234
  if (timeoutRef.current) {
410
235
  clearTimeout(timeoutRef.current);
411
236
  timeoutRef.current = null;
412
237
  }
413
238
  };
414
-
415
239
  var handleTooltipMouseLeave = function handleTooltipMouseLeave() {
416
240
  timeoutRef.current = setTimeout(function () {
417
241
  closeTooltip();
418
242
  }, ANIMATION_DURATION);
419
243
  };
420
-
421
- var clonedChild = /*#__PURE__*/_react.default.cloneElement(childElement, {
244
+ var existingDescribedBy = childElement.props['aria-describedby'];
245
+ var clonedChild = /*#__PURE__*/_react["default"].cloneElement(childElement, {
422
246
  onMouseEnter: handleMouseEnter,
423
247
  onMouseLeave: handleMouseLeave,
424
- ref: containerTooltipRef
248
+ onFocus: handleFocus,
249
+ onBlur: handleBlur,
250
+ ref: containerTooltipRef,
251
+ 'aria-describedby': title && shouldRender ? [existingDescribedBy, tooltipId].filter(Boolean).join(' ') : existingDescribedBy
425
252
  });
426
-
427
253
  var getTooltip = function getTooltip() {
428
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, clonedChild, shouldRender && /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/_react.default.createElement("div", _extends({
254
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, clonedChild, shouldRender && /*#__PURE__*/(0, _reactDom.createPortal)(
255
+ /*#__PURE__*/
256
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
257
+ _react["default"].createElement("div", _extends({
258
+ id: tooltipId,
259
+ role: "tooltip",
260
+ "aria-hidden": !isOpen,
429
261
  className: prefixClass("cbx-tooltip-options-container ".concat(isVisible && popoverStyles ? 'cbx-tooltip-options-container-opened' : 'cbx-tooltip-options-container-closed', " ").concat(className || '')),
430
262
  ref: tooltipRef,
431
263
  style: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, styles), style), stylesInLine), popoverStyles),
@@ -437,28 +269,25 @@ var Tooltip = function Tooltip(_ref2) {
437
269
  }
438
270
  }, props), title), document.body));
439
271
  };
440
-
441
- _react.default.useEffect(function () {
272
+ _react["default"].useEffect(function () {
442
273
  if (!tooltipRef.current) return;
443
274
  var observer = new ResizeObserver(function () {
444
- adjustPopoverPosition();
275
+ adjustPosition();
445
276
  });
446
277
  observer.observe(tooltipRef.current);
447
278
  return function () {
448
279
  observer.disconnect();
449
280
  };
450
- }, [tooltipRef.current, adjustPopoverPosition]);
451
-
281
+ }, [tooltipRef.current, adjustPosition]);
452
282
  return title === '' ? children : getTooltip();
453
283
  };
454
-
455
284
  Tooltip.propTypes = {
456
- id: _propTypes.default.string,
457
- anchorOrigin: _propTypes.default.object,
458
- transformOrigin: _propTypes.default.object,
459
- placement: _propTypes.default.string,
460
- className: _propTypes.default.string,
461
- title: _propTypes.default.node
285
+ id: _propTypes["default"].string,
286
+ anchorOrigin: _propTypes["default"].object,
287
+ transformOrigin: _propTypes["default"].object,
288
+ placement: _propTypes["default"].string,
289
+ className: _propTypes["default"].string,
290
+ title: _propTypes["default"].node
462
291
  };
463
292
  Tooltip.defaultProps = {
464
293
  id: '',
@@ -475,4 +304,4 @@ Tooltip.defaultProps = {
475
304
  title: ''
476
305
  };
477
306
  var _default = Tooltip;
478
- exports.default = _default;
307
+ exports["default"] = _default;