@geotab/zenith 3.3.0 → 3.4.0-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 (279) hide show
  1. package/README.md +17 -0
  2. package/dist/advancedGroupsFilter/advancedGroupsFilterFormSection.js +1 -1
  3. package/dist/advancedGroupsFilter/advancedGroupsFilterSectionTooltip.js +0 -39
  4. package/dist/alertRaw/components/alertAnimation.js +8 -4
  5. package/dist/card/card.d.ts +1 -1
  6. package/dist/card/card.js +1 -3
  7. package/dist/card/components/status.js +2 -2
  8. package/dist/chart/barChart/getBarTooltipItems.js +31 -2
  9. package/dist/chart/barChart.js +2 -1
  10. package/dist/chart/utils/getYAxisMeta.d.ts +1 -1
  11. package/dist/chart/utils/getYAxisMeta.js +44 -1
  12. package/dist/checkbox/checkbox.js +3 -3
  13. package/dist/dataGrid/emptySearchList/emptySearchList.d.ts +6 -7
  14. package/dist/dataGrid/emptySearchList/emptySearchList.js +15 -23
  15. package/dist/dateInputRaw/dateInputRaw.d.ts +1 -1
  16. package/dist/dateRangeRaw/dateRangeRaw.d.ts +1 -1
  17. package/dist/dateRangeRaw/utils/dateRangeUtils.d.ts +1 -0
  18. package/dist/dateRangeRaw/utils/dateRangeUtils.js +39 -1
  19. package/dist/dropdownRaw/dropdownRaw.d.ts +1 -1
  20. package/dist/emptyState/emptyState.d.ts +9 -0
  21. package/dist/emptyState/emptyState.js +14 -0
  22. package/dist/emptyState/hooks/useIcon.d.ts +2 -0
  23. package/dist/emptyState/hooks/useIcon.js +17 -0
  24. package/dist/filtersBar/components/filtersBarPeriodPicker/getRangeOption.d.ts +1 -0
  25. package/dist/filtersBar/components/filtersBarPeriodPicker/getRangeOption.js +28 -3
  26. package/dist/formField/components/formFieldAdditionalInfo.d.ts +12 -0
  27. package/dist/formField/components/formFieldAdditionalInfo.js +10 -0
  28. package/dist/formField/components/formFieldAssistiveError.d.ts +10 -0
  29. package/dist/formField/components/formFieldAssistiveError.js +12 -0
  30. package/dist/formField/components/formFieldCounter.d.ts +6 -0
  31. package/dist/formField/components/formFieldCounter.js +7 -0
  32. package/dist/formField/components/formFieldLoading.d.ts +12 -0
  33. package/dist/formField/components/formFieldLoading.js +16 -0
  34. package/dist/formField/components/formFieldWithLabel.d.ts +8 -11
  35. package/dist/formField/components/formFieldWithLabel.js +21 -3
  36. package/dist/formField/components/formFieldWithoutLabel.d.ts +8 -9
  37. package/dist/formField/components/formFieldWithoutLabel.js +6 -1
  38. package/dist/formField/components/isOldFormFieldComponent.d.ts +2 -0
  39. package/dist/formField/components/isOldFormFieldComponent.js +12 -0
  40. package/dist/formField/components/trailingComponent.d.ts +2 -1
  41. package/dist/formField/components/trailingComponent.js +7 -1
  42. package/dist/formField/formField.d.ts +17 -35
  43. package/dist/formField/formField.js +4 -71
  44. package/dist/formField/hooks/useContainer.d.ts +2 -0
  45. package/dist/formField/hooks/useContainer.js +47 -0
  46. package/dist/formField/hooks/useError.d.ts +1 -1
  47. package/dist/formField/hooks/useFormFieldClasses.d.ts +2 -0
  48. package/dist/formField/hooks/useFormFieldClasses.js +30 -0
  49. package/dist/formField/hooks/useFormFieldProps.d.ts +17 -0
  50. package/dist/formField/hooks/useFormFieldProps.js +37 -0
  51. package/dist/formField/hooks/useTrailing.d.ts +1 -1
  52. package/dist/formField/hooks/useTrailing.js +1 -1
  53. package/dist/formField/hooks/useWidth.d.ts +1 -1
  54. package/dist/formField/types.d.ts +35 -0
  55. package/dist/formField/types.js +2 -0
  56. package/dist/formGroup/components/formGroupList.d.ts +1 -1
  57. package/dist/formGroup/components/formGroupToggle.d.ts +1 -1
  58. package/dist/formGroup/formGroup.d.ts +1 -1
  59. package/dist/formGroup/hooks/useLabelAlign.d.ts +1 -1
  60. package/dist/formGroup/types.d.ts +1 -1
  61. package/dist/formGroup/utils/applyCustomControlClasses.d.ts +1 -1
  62. package/dist/formGroup/utils/applyCustomLabelClasses.d.ts +1 -1
  63. package/dist/formGroup/utils/getControlClasses/getControlClasses.d.ts +1 -1
  64. package/dist/formGroup/utils/getControlClasses/getOneLabelOneControlClasses.d.ts +1 -1
  65. package/dist/formGroup/utils/getControlClasses/getOneLabelTwoControlsClasses.d.ts +1 -1
  66. package/dist/formGroup/utils/getControlClasses/getTwoLabelsOneControlClasses.d.ts +1 -1
  67. package/dist/formGroup/utils/getControlClasses/getTwoLabelsTwoControlsClasses.d.ts +1 -1
  68. package/dist/formGroup/utils/getLabelClasses/getLabelClasses.d.ts +1 -1
  69. package/dist/formGroup/utils/getLabelClasses/getOneLabelOneControlClasses.d.ts +1 -1
  70. package/dist/formGroup/utils/getLabelClasses/getOneLabelTwoControlsClasses.d.ts +1 -1
  71. package/dist/formGroup/utils/getLabelClasses/getTwoLabelsOneControlClasses.d.ts +1 -1
  72. package/dist/formGroup/utils/getLabelClasses/getTwoLabelsTwoControlsClasses.d.ts +1 -1
  73. package/dist/formGroup/utils/getListClasses.d.ts +1 -1
  74. package/dist/formGroup/utils/getToggleClasses.d.ts +1 -1
  75. package/dist/formGroup/utils/initializeState.d.ts +1 -1
  76. package/dist/formGroup/utils/isTopAlign.d.ts +1 -1
  77. package/dist/formLayout/types.d.ts +1 -1
  78. package/dist/formSection/types.d.ts +1 -1
  79. package/dist/formSection/utils/formSectionProvider.d.ts +1 -1
  80. package/dist/groupButtonRaw/groupButtonRaw.d.ts +1 -1
  81. package/dist/groupsFilterRaw/groupsFilterRaw.d.ts +1 -1
  82. package/dist/groupsFilterRaw/groupsHelper.js +2 -2
  83. package/dist/headerTitle/headerTitle.js +1 -1
  84. package/dist/images/imageAdjustFilter.d.ts +4 -0
  85. package/dist/images/imageAdjustFilter.js +16 -0
  86. package/dist/images/imageNoMatchingAssets.d.ts +4 -0
  87. package/dist/images/imageNoMatchingAssets.js +16 -0
  88. package/dist/index.css +619 -524
  89. package/dist/index.d.ts +6 -2
  90. package/dist/index.js +23 -16
  91. package/dist/inputAdornments/inputAdornments.d.ts +2 -1
  92. package/dist/inputAdornments/inputAdornments.js +2 -2
  93. package/dist/layout/layout.js +11 -7
  94. package/dist/list/itemData/itemData.d.ts +1 -0
  95. package/dist/list/itemData/itemDataInternal.d.ts +2 -1
  96. package/dist/list/itemData/itemDataInternal.js +4 -2
  97. package/dist/list/itemData/itemDataWaiting.d.ts +2 -1
  98. package/dist/list/itemData/itemDataWaiting.js +4 -1
  99. package/dist/list/list.d.ts +13 -4
  100. package/dist/list/list.js +29 -12
  101. package/dist/list/utils/getLoadingItems.d.ts +1 -1
  102. package/dist/list/utils/getLoadingItems.js +4 -4
  103. package/dist/modal/modal.js +7 -0
  104. package/dist/pillExpandable/pillExpandable.d.ts +1 -0
  105. package/dist/pillExpandable/pillExpandable.js +74 -33
  106. package/dist/radioGroupRaw/radioGroupRaw.d.ts +1 -1
  107. package/dist/rangeRaw/rangeRaw.d.ts +1 -1
  108. package/dist/summary/summary.js +0 -1
  109. package/dist/summaryTile/summaryTile.js +2 -2
  110. package/dist/table/children/tableEmpty.d.ts +1 -1
  111. package/dist/table/children/useTableChildren.js +1 -1
  112. package/dist/timePickerRaw/timePickerRaw.d.ts +1 -1
  113. package/dist/tooltip/tooltip.d.ts +15 -4
  114. package/dist/tooltip/tooltip.js +421 -158
  115. package/dist/utils/localization/translations/cs.json +2 -1
  116. package/dist/utils/localization/translations/da-DK.json +2 -1
  117. package/dist/utils/localization/translations/de.json +2 -1
  118. package/dist/utils/localization/translations/en.json +2 -1
  119. package/dist/utils/localization/translations/es.json +3 -2
  120. package/dist/utils/localization/translations/fi-FI.json +2 -1
  121. package/dist/utils/localization/translations/fr-FR.json +2 -1
  122. package/dist/utils/localization/translations/fr.json +3 -2
  123. package/dist/utils/localization/translations/hu-HU.json +2 -1
  124. package/dist/utils/localization/translations/id.json +2 -1
  125. package/dist/utils/localization/translations/it.json +2 -1
  126. package/dist/utils/localization/translations/ja.json +2 -1
  127. package/dist/utils/localization/translations/ko-KR.json +2 -1
  128. package/dist/utils/localization/translations/ms.json +2 -1
  129. package/dist/utils/localization/translations/nb-NO.json +2 -1
  130. package/dist/utils/localization/translations/nl.json +2 -1
  131. package/dist/utils/localization/translations/pl.json +2 -1
  132. package/dist/utils/localization/translations/pt-BR.json +2 -1
  133. package/dist/utils/localization/translations/sk-SK.json +2 -1
  134. package/dist/utils/localization/translations/sv.json +2 -1
  135. package/dist/utils/localization/translations/th.json +2 -1
  136. package/dist/utils/localization/translations/tr.json +2 -1
  137. package/dist/utils/localization/translations/zh-Hans.json +2 -1
  138. package/dist/utils/localization/translations/zh-TW.json +2 -1
  139. package/dist/utils/positioningUtils/calculatePosition.d.ts +1 -1
  140. package/dist/utils/positioningUtils/calculatePosition.js +11 -1
  141. package/esm/advancedGroupsFilter/advancedGroupsFilterFormSection.js +1 -1
  142. package/esm/advancedGroupsFilter/advancedGroupsFilterSectionTooltip.js +0 -39
  143. package/esm/alertRaw/components/alertAnimation.js +8 -4
  144. package/esm/card/card.d.ts +1 -1
  145. package/esm/card/card.js +1 -3
  146. package/esm/card/components/status.js +2 -2
  147. package/esm/chart/barChart/getBarTooltipItems.js +31 -2
  148. package/esm/chart/barChart.js +2 -1
  149. package/esm/chart/utils/getYAxisMeta.d.ts +1 -1
  150. package/esm/chart/utils/getYAxisMeta.js +44 -1
  151. package/esm/checkbox/checkbox.js +3 -3
  152. package/esm/dataGrid/emptySearchList/emptySearchList.d.ts +6 -7
  153. package/esm/dataGrid/emptySearchList/emptySearchList.js +16 -24
  154. package/esm/dateInputRaw/dateInputRaw.d.ts +1 -1
  155. package/esm/dateRangeRaw/dateRangeRaw.d.ts +1 -1
  156. package/esm/dateRangeRaw/utils/dateRangeUtils.d.ts +1 -0
  157. package/esm/dateRangeRaw/utils/dateRangeUtils.js +37 -0
  158. package/esm/dropdownRaw/dropdownRaw.d.ts +1 -1
  159. package/esm/emptyState/emptyState.d.ts +9 -0
  160. package/esm/emptyState/emptyState.js +10 -0
  161. package/esm/emptyState/hooks/useIcon.d.ts +2 -0
  162. package/esm/emptyState/hooks/useIcon.js +10 -0
  163. package/esm/filtersBar/components/filtersBarPeriodPicker/getRangeOption.d.ts +1 -0
  164. package/esm/filtersBar/components/filtersBarPeriodPicker/getRangeOption.js +29 -4
  165. package/esm/formField/components/formFieldAdditionalInfo.d.ts +12 -0
  166. package/esm/formField/components/formFieldAdditionalInfo.js +6 -0
  167. package/esm/formField/components/formFieldAssistiveError.d.ts +10 -0
  168. package/esm/formField/components/formFieldAssistiveError.js +8 -0
  169. package/esm/formField/components/formFieldCounter.d.ts +6 -0
  170. package/esm/formField/components/formFieldCounter.js +3 -0
  171. package/esm/formField/components/formFieldLoading.d.ts +12 -0
  172. package/esm/formField/components/formFieldLoading.js +12 -0
  173. package/esm/formField/components/formFieldWithLabel.d.ts +8 -11
  174. package/esm/formField/components/formFieldWithLabel.js +21 -3
  175. package/esm/formField/components/formFieldWithoutLabel.d.ts +8 -9
  176. package/esm/formField/components/formFieldWithoutLabel.js +6 -1
  177. package/esm/formField/components/isOldFormFieldComponent.d.ts +2 -0
  178. package/esm/formField/components/isOldFormFieldComponent.js +8 -0
  179. package/esm/formField/components/trailingComponent.d.ts +2 -1
  180. package/esm/formField/components/trailingComponent.js +7 -1
  181. package/esm/formField/formField.d.ts +17 -35
  182. package/esm/formField/formField.js +5 -72
  183. package/esm/formField/hooks/useContainer.d.ts +2 -0
  184. package/esm/formField/hooks/useContainer.js +43 -0
  185. package/esm/formField/hooks/useError.d.ts +1 -1
  186. package/esm/formField/hooks/useFormFieldClasses.d.ts +2 -0
  187. package/esm/formField/hooks/useFormFieldClasses.js +26 -0
  188. package/esm/formField/hooks/useFormFieldProps.d.ts +17 -0
  189. package/esm/formField/hooks/useFormFieldProps.js +33 -0
  190. package/esm/formField/hooks/useTrailing.d.ts +1 -1
  191. package/esm/formField/hooks/useTrailing.js +1 -1
  192. package/esm/formField/hooks/useWidth.d.ts +1 -1
  193. package/esm/formField/types.d.ts +35 -0
  194. package/esm/formField/types.js +1 -0
  195. package/esm/formGroup/components/formGroupList.d.ts +1 -1
  196. package/esm/formGroup/components/formGroupToggle.d.ts +1 -1
  197. package/esm/formGroup/formGroup.d.ts +1 -1
  198. package/esm/formGroup/hooks/useLabelAlign.d.ts +1 -1
  199. package/esm/formGroup/types.d.ts +1 -1
  200. package/esm/formGroup/utils/applyCustomControlClasses.d.ts +1 -1
  201. package/esm/formGroup/utils/applyCustomLabelClasses.d.ts +1 -1
  202. package/esm/formGroup/utils/getControlClasses/getControlClasses.d.ts +1 -1
  203. package/esm/formGroup/utils/getControlClasses/getOneLabelOneControlClasses.d.ts +1 -1
  204. package/esm/formGroup/utils/getControlClasses/getOneLabelTwoControlsClasses.d.ts +1 -1
  205. package/esm/formGroup/utils/getControlClasses/getTwoLabelsOneControlClasses.d.ts +1 -1
  206. package/esm/formGroup/utils/getControlClasses/getTwoLabelsTwoControlsClasses.d.ts +1 -1
  207. package/esm/formGroup/utils/getLabelClasses/getLabelClasses.d.ts +1 -1
  208. package/esm/formGroup/utils/getLabelClasses/getOneLabelOneControlClasses.d.ts +1 -1
  209. package/esm/formGroup/utils/getLabelClasses/getOneLabelTwoControlsClasses.d.ts +1 -1
  210. package/esm/formGroup/utils/getLabelClasses/getTwoLabelsOneControlClasses.d.ts +1 -1
  211. package/esm/formGroup/utils/getLabelClasses/getTwoLabelsTwoControlsClasses.d.ts +1 -1
  212. package/esm/formGroup/utils/getListClasses.d.ts +1 -1
  213. package/esm/formGroup/utils/getToggleClasses.d.ts +1 -1
  214. package/esm/formGroup/utils/initializeState.d.ts +1 -1
  215. package/esm/formGroup/utils/isTopAlign.d.ts +1 -1
  216. package/esm/formLayout/types.d.ts +1 -1
  217. package/esm/formSection/types.d.ts +1 -1
  218. package/esm/formSection/utils/formSectionProvider.d.ts +1 -1
  219. package/esm/groupButtonRaw/groupButtonRaw.d.ts +1 -1
  220. package/esm/groupsFilterRaw/groupsFilterRaw.d.ts +1 -1
  221. package/esm/groupsFilterRaw/groupsHelper.js +2 -2
  222. package/esm/headerTitle/headerTitle.js +1 -1
  223. package/esm/images/imageAdjustFilter.d.ts +4 -0
  224. package/esm/images/imageAdjustFilter.js +12 -0
  225. package/esm/images/imageNoMatchingAssets.d.ts +4 -0
  226. package/esm/images/imageNoMatchingAssets.js +12 -0
  227. package/esm/index.d.ts +6 -2
  228. package/esm/index.js +4 -1
  229. package/esm/inputAdornments/inputAdornments.d.ts +2 -1
  230. package/esm/inputAdornments/inputAdornments.js +2 -2
  231. package/esm/layout/layout.js +11 -7
  232. package/esm/list/itemData/itemData.d.ts +1 -0
  233. package/esm/list/itemData/itemDataInternal.d.ts +2 -1
  234. package/esm/list/itemData/itemDataInternal.js +4 -2
  235. package/esm/list/itemData/itemDataWaiting.d.ts +2 -1
  236. package/esm/list/itemData/itemDataWaiting.js +4 -1
  237. package/esm/list/list.d.ts +13 -4
  238. package/esm/list/list.js +29 -12
  239. package/esm/list/utils/getLoadingItems.d.ts +1 -1
  240. package/esm/list/utils/getLoadingItems.js +4 -4
  241. package/esm/modal/modal.js +7 -0
  242. package/esm/pillExpandable/pillExpandable.d.ts +1 -0
  243. package/esm/pillExpandable/pillExpandable.js +74 -33
  244. package/esm/radioGroupRaw/radioGroupRaw.d.ts +1 -1
  245. package/esm/rangeRaw/rangeRaw.d.ts +1 -1
  246. package/esm/summary/summary.js +0 -1
  247. package/esm/summaryTile/summaryTile.js +2 -2
  248. package/esm/table/children/tableEmpty.d.ts +1 -1
  249. package/esm/table/children/useTableChildren.js +1 -1
  250. package/esm/timePickerRaw/timePickerRaw.d.ts +1 -1
  251. package/esm/tooltip/tooltip.d.ts +15 -4
  252. package/esm/tooltip/tooltip.js +388 -138
  253. package/esm/utils/localization/translations/cs.json +2 -1
  254. package/esm/utils/localization/translations/da-DK.json +2 -1
  255. package/esm/utils/localization/translations/de.json +2 -1
  256. package/esm/utils/localization/translations/en.json +2 -1
  257. package/esm/utils/localization/translations/es.json +3 -2
  258. package/esm/utils/localization/translations/fi-FI.json +2 -1
  259. package/esm/utils/localization/translations/fr-FR.json +2 -1
  260. package/esm/utils/localization/translations/fr.json +3 -2
  261. package/esm/utils/localization/translations/hu-HU.json +2 -1
  262. package/esm/utils/localization/translations/id.json +2 -1
  263. package/esm/utils/localization/translations/it.json +2 -1
  264. package/esm/utils/localization/translations/ja.json +2 -1
  265. package/esm/utils/localization/translations/ko-KR.json +2 -1
  266. package/esm/utils/localization/translations/ms.json +2 -1
  267. package/esm/utils/localization/translations/nb-NO.json +2 -1
  268. package/esm/utils/localization/translations/nl.json +2 -1
  269. package/esm/utils/localization/translations/pl.json +2 -1
  270. package/esm/utils/localization/translations/pt-BR.json +2 -1
  271. package/esm/utils/localization/translations/sk-SK.json +2 -1
  272. package/esm/utils/localization/translations/sv.json +2 -1
  273. package/esm/utils/localization/translations/th.json +2 -1
  274. package/esm/utils/localization/translations/tr.json +2 -1
  275. package/esm/utils/localization/translations/zh-Hans.json +2 -1
  276. package/esm/utils/localization/translations/zh-TW.json +2 -1
  277. package/esm/utils/positioningUtils/calculatePosition.d.ts +1 -1
  278. package/esm/utils/positioningUtils/calculatePosition.js +11 -1
  279. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { IFormFieldComponent } from "../formField/formField";
2
+ import { IFormFieldComponent } from "../formField/types";
3
3
  import { ITimePickerRawDefault, TTimePickerRaw } from "./types";
4
4
  import "./timePickerRaw.less";
5
5
  export interface ITimePickerRaw extends ITimePickerRawDefault {
@@ -1,13 +1,24 @@
1
- import { FC, PropsWithChildren, ReactElement } from "react";
1
+ import React, { FC, PropsWithChildren, ReactElement } from "react";
2
2
  import { IZenComponentProps } from "../commonHelpers/zenComponent";
3
- import { TAlignment } from "../absolute/absolute";
4
3
  import "./tooltip.less";
4
+ import { TAlignment } from "../absolute/absolute";
5
5
  export type TooltipSize = "large" | "small" | "auto";
6
6
  export type TMobileView = "default" | "mobileSheet";
7
7
  interface ITooltip extends IZenComponentProps {
8
- trigger: ReactElement<PropsWithChildren>;
9
- size?: TooltipSize;
8
+ trigger?: ReactElement<PropsWithChildren & {
9
+ onClick?: (e: React.MouseEvent) => void;
10
+ }>;
10
11
  alignment?: TAlignment;
12
+ triggerClassName?: string;
13
+ mobileTitle?: string;
14
+ /**
15
+ * @deprecated
16
+ * @param mobileSheetTitle - will be removed in the next major release
17
+ * @param mobileView - will be removed in the next major release
18
+ * @param size - will be removed in the next major release
19
+ * @param padding - will be removed in the next major release
20
+ */
21
+ size?: TooltipSize;
11
22
  padding?: number;
12
23
  mobileView?: TMobileView;
13
24
  mobileSheetTitle?: ReactElement | string;
@@ -1,154 +1,404 @@
1
+ import { injectString } from "../utils/localization/translationsDictionary";
1
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import React, { useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
3
+ import React, { createElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
3
4
  import { useResize } from "../commonHelpers/hooks/useResize";
4
5
  import { calculatePosition as calculatePos } from "../utils/positioningUtils/calculatePosition";
5
6
  import { createPortal } from "react-dom";
6
7
  import { classNames } from "../commonHelpers/classNames/classNames";
7
8
  import { calculateArrowPosition } from "./helpers/calculateArrowPosition";
8
9
  import { DeviceType } from "../commonHelpers/hooks/deviceType";
9
- import { useDeviceType } from "../commonHelpers/hooks/useDeviceType";
10
- import { MobileSheet } from "../mobileSheet/mobileSheet";
10
+ import { getDeviceType, useDeviceType } from "../commonHelpers/hooks/useDeviceType";
11
11
  import { themeContext } from "../utils/theme/themeContext";
12
12
  import { tooltipAlignments } from "../utils/positioningUtils/tooltipAlignments";
13
- const TOOLTIP_ARROW_HEIGHT = 6;
13
+ import { IconClose } from "../icons/iconClose";
14
+ import { Button } from "../button/button";
15
+ import { useLanguage } from "../utils/localization/useLanguage";
16
+ import { IconInfoCircle } from "../icons/iconInfoCircle";
17
+ import { useDrive } from "../utils/theme/useDrive";
18
+ import { Shield } from "../shield/shield";
19
+ injectString("cs", "Information", "Informace");
20
+ injectString("da-DK", "Information", "Information");
21
+ injectString("de", "Information", "Information");
22
+ injectString("en", "Information", "Information");
23
+ injectString("es", "Information", "Informaci\xF3n");
24
+ injectString("fi-FI", "Information", "Tiedot");
25
+ injectString("fr", "Information", "Renseignements");
26
+ injectString("fr-FR", "Information", "Informations");
27
+ injectString("hu-HU", "Information", "Inform\xE1ci\xF3");
28
+ injectString("id", "Information", "Informasi");
29
+ injectString("it", "Information", "Informazioni");
30
+ injectString("ja", "Information", "\u60C5\u5831");
31
+ injectString("ko-KR", "Information", "\uC815\uBCF4");
32
+ injectString("ms", "Information", "Maklumat");
33
+ injectString("nb-NO", "Information", "Informasjon");
34
+ injectString("nl", "Information", "Informatie");
35
+ injectString("pl", "Information", "Informacje");
36
+ injectString("pt-BR", "Information", "Informa\xE7\xF5es");
37
+ injectString("sk-SK", "Information", "Inform\xE1cie");
38
+ injectString("sv", "Information", "Information");
39
+ injectString("th", "Information", "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25");
40
+ injectString("tr", "Information", "Bilgi");
41
+ injectString("zh-Hans", "Information", "\u4FE1\u606F");
42
+ injectString("zh-TW", "Information", "\u8CC7\u8A0A");
43
+ injectString("cs", "Close", "Zav\u0159\xEDt");
44
+ injectString("da-DK", "Close", "Luk");
45
+ injectString("de", "Close", "Schlie\xDFen");
46
+ injectString("en", "Close", "Close");
47
+ injectString("es", "Close", "Cerrar");
48
+ injectString("fi-FI", "Close", "Sulje");
49
+ injectString("fr", "Close", "Fermer");
50
+ injectString("fr-FR", "Close", "Fermer");
51
+ injectString("hu-HU", "Close", "Z\xE1rd be.");
52
+ injectString("id", "Close", "Tutup");
53
+ injectString("it", "Close", "Chiudere");
54
+ injectString("ja", "Close", "\u9589\u3058\u308B");
55
+ injectString("ko-KR", "Close", "\uB2EB\uAE30");
56
+ injectString("ms", "Close", "Tutup");
57
+ injectString("nb-NO", "Close", "Lukk");
58
+ injectString("nl", "Close", "Sluiten");
59
+ injectString("pl", "Close", "Zamknij");
60
+ injectString("pt-BR", "Close", "Fechar");
61
+ injectString("sk-SK", "Close", "Zatvor");
62
+ injectString("sv", "Close", "St\xE4ng");
63
+ injectString("th", "Close", "\u0E1B\u0E34\u0E14");
64
+ injectString("tr", "Close", "Kapat");
65
+ injectString("zh-Hans", "Close", "\u5173\u95ED");
66
+ injectString("zh-TW", "Close", "\u95DC\u9589");
14
67
  const TOOLTIP_VISIBILITY_DELAY = 100;
15
68
  const arrowClasses = {
16
- "top": "zen-tooltip__arrow--top",
17
- "top-left": "zen-tooltip__arrow--top",
18
- "top-right": "zen-tooltip__arrow--top",
19
- "bottom": "zen-tooltip__arrow--bottom",
20
- "bottom-left": "zen-tooltip__arrow--bottom",
21
- "bottom-right": "zen-tooltip__arrow--bottom",
22
- "right": "zen-tooltip__arrow--right",
23
- "right-top": "zen-tooltip__arrow--right",
24
- "right-bottom": "zen-tooltip__arrow--right",
25
- "left": "zen-tooltip__arrow--left",
26
- "left-top": "zen-tooltip__arrow--left",
27
- "left-bottom": "zen-tooltip__arrow--left"
69
+ "top": "zen-tooltip__arrow--top",
70
+ "top-left": "zen-tooltip__arrow--top",
71
+ "top-right": "zen-tooltip__arrow--top",
72
+ "bottom": "zen-tooltip__arrow--bottom",
73
+ "bottom-left": "zen-tooltip__arrow--bottom",
74
+ "bottom-right": "zen-tooltip__arrow--bottom",
75
+ "right": "zen-tooltip__arrow--right",
76
+ "right-top": "zen-tooltip__arrow--right",
77
+ "right-bottom": "zen-tooltip__arrow--right",
78
+ "left": "zen-tooltip__arrow--left",
79
+ "left-top": "zen-tooltip__arrow--left",
80
+ "left-bottom": "zen-tooltip__arrow--left"
28
81
  };
29
- export const Tooltip = ({ trigger, className = "", size = "small", alignment = "bottom", padding = 0, children, mobileView = "default", mobileSheetTitle }) => {
30
- const triggerRefNative = trigger.props.ref;
31
- const triggerLocalRef = useRef(null);
32
- const triggerRef = triggerRefNative || triggerLocalRef;
33
- const timerRef = useRef(null);
34
- const timerMouseOutRef = useRef(null);
35
- const tooltipRef = useRef(null);
36
- const arrowRef = useRef(null);
37
- const [isTooltipVisible, setTooltipVisible] = useState(false);
38
- const [deviceType, setDeviceType] = useState(DeviceType.Desktop);
39
- const tooltipId = useId();
40
- const { dark } = useContext(themeContext);
41
- useDeviceType(setDeviceType);
42
- const onKeyDownHandler = useCallback((e) => {
43
- if (e.code === "Escape") {
44
- setTooltipVisible(false);
45
- }
46
- }, []);
47
- const triggerEvents = useMemo(() => {
48
- if (deviceType === DeviceType.Desktop) {
49
- return {
50
- onMouseOver: () => {
51
- setTooltipVisible(true);
52
- timerMouseOutRef.current && clearTimeout(timerMouseOutRef.current);
53
- },
54
- onMouseLeave: () => {
55
- timerRef.current = setTimeout(() => {
56
- setTooltipVisible(false);
57
- }, TOOLTIP_VISIBILITY_DELAY);
58
- },
59
- onFocus: () => setTooltipVisible(true),
60
- onBlur: () => setTooltipVisible(false),
61
- onKeyDown: onKeyDownHandler,
62
- onClick: (...args) => {
63
- const triggerProps = trigger.props;
64
- if (triggerProps.onClick) {
65
- triggerProps.onClick(...args);
66
- }
67
- if (isTooltipVisible) {
68
- setTooltipVisible(false);
69
- }
70
- }
71
- };
72
- }
73
- if (mobileView === "mobileSheet") {
74
- return {
75
- onClick: () => setTooltipVisible(true)
76
- };
77
- }
78
- return {
79
- onClick: (e) => {
80
- e.stopPropagation();
81
- const triggerProps = trigger.props;
82
- if (triggerProps.onClick) {
83
- triggerProps.onClick(e);
84
- }
85
- else {
86
- setTooltipVisible(isVisible => !isVisible);
87
- }
88
- },
89
- onTouchStart: () => setTooltipVisible(true),
90
- onTouchEnd: () => setTooltipVisible(false)
91
- };
92
- }, [deviceType, mobileView, onKeyDownHandler, trigger.props, isTooltipVisible]);
93
- const triggerCloneProps = isTooltipVisible ? {
94
- "aria-describedby": tooltipId
95
- } : {};
96
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
97
- const triggerClone = React.cloneElement(trigger, Object.assign(Object.assign({ ref: triggerRef }, triggerCloneProps), triggerEvents
98
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
99
- ));
100
- const arrowClass = useMemo(() => arrowClasses[alignment] || arrowClasses.bottom, [alignment]);
101
- const renderTooltip = () => {
102
- if (mobileView === "mobileSheet" && deviceType === DeviceType.Mobile) {
103
- return _jsxs(MobileSheet, { onHidePanel: () => {
104
- var _a;
105
- setTooltipVisible(false);
106
- (_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
107
- }, triggerRef: triggerRef, label: "", isOpen: isTooltipVisible, onCloseClick: () => {
108
- var _a;
109
- setTooltipVisible(false);
110
- (_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
111
- }, children: [_jsx(MobileSheet.Content, { className: "zen-tooltip__mobile-sheet-content", children: children }), _jsx(MobileSheet.Title, { children: mobileSheetTitle })] });
82
+ const getInitialDeviceType = () => {
83
+ if (typeof window !== "undefined") {
84
+ return getDeviceType(window.innerWidth);
85
+ }
86
+ return DeviceType.Desktop;
87
+ };
88
+ const EventWrapper = ({
89
+ children,
90
+ deviceType,
91
+ onKeyDownHandler,
92
+ handleUniversalClick,
93
+ setTooltipVisible,
94
+ timerRef,
95
+ timerMouseOutRef
96
+ }) => {
97
+ const isCurrentDeviceDesktop = deviceType === DeviceType.Desktop;
98
+ const originalOnClick = children.props.onClick;
99
+ const composedOnClick = useCallback(e => {
100
+ // Call original onClick first if it exists
101
+ if (originalOnClick) {
102
+ originalOnClick(e);
103
+ }
104
+ // Then call tooltip's click handler
105
+ handleUniversalClick(e);
106
+ }, [originalOnClick, handleUniversalClick]);
107
+ const desktopEvents = {
108
+ onMouseOver: () => {
109
+ setTooltipVisible(true);
110
+ timerMouseOutRef.current && clearTimeout(timerMouseOutRef.current);
111
+ },
112
+ onMouseLeave: () => {
113
+ timerRef.current = setTimeout(() => {
114
+ setTooltipVisible(false);
115
+ }, TOOLTIP_VISIBILITY_DELAY);
116
+ },
117
+ onFocus: () => setTooltipVisible(true),
118
+ onBlur: () => setTooltipVisible(false),
119
+ onKeyDown: onKeyDownHandler,
120
+ onClick: composedOnClick
121
+ };
122
+ const mobileOnKeyDown = useCallback(e => {
123
+ if (e.key === "Enter") {
124
+ handleUniversalClick(undefined);
125
+ }
126
+ }, [handleUniversalClick]);
127
+ const mobileEvents = {
128
+ onClick: composedOnClick,
129
+ onKeyDown: mobileOnKeyDown
130
+ };
131
+ const propsToApply = isCurrentDeviceDesktop ? desktopEvents : mobileEvents;
132
+ return React.cloneElement(children, propsToApply);
133
+ };
134
+ export const Tooltip = ({
135
+ trigger,
136
+ triggerClassName,
137
+ className = "",
138
+ alignment,
139
+ children,
140
+ mobileSheetTitle,
141
+ mobileTitle
142
+ }) => {
143
+ const GAP = 12;
144
+ const isDrive = useDrive();
145
+ const triggerRefNative = trigger === null || trigger === void 0 ? void 0 : trigger.ref;
146
+ const triggerLocalRef = useRef(null);
147
+ const triggerRef = triggerRefNative || triggerLocalRef;
148
+ const timerRef = useRef(null);
149
+ const timerMouseOutRef = useRef(null);
150
+ const tooltipRef = useRef(null);
151
+ const arrowRef = useRef(null);
152
+ const [isTooltipVisible, setTooltipVisible] = useState(false);
153
+ const [deviceType, setDeviceType] = useState(getInitialDeviceType);
154
+ const isMobile = deviceType === DeviceType.Mobile;
155
+ const tooltipId = useId();
156
+ const {
157
+ translate
158
+ } = useLanguage();
159
+ const {
160
+ dark
161
+ } = useContext(themeContext);
162
+ const tooltipAlignment = useMemo(() => isMobile ? "bottom" : alignment || "right", [isMobile, alignment]);
163
+ const TOOLTIP_ARROW_HEIGHT = useMemo(() => isMobile || isDrive ? 0 : 6, [isMobile, isDrive]);
164
+ const tooltipAlignmentRef = useRef(tooltipAlignment);
165
+ tooltipAlignmentRef.current = tooltipAlignment;
166
+ const setDeviceTypeStable = useCallback(newType => {
167
+ setDeviceType(currentDeviceType => newType !== currentDeviceType ? newType : currentDeviceType);
168
+ }, []);
169
+ const setDeviceTypeConditional = useCallback(newType => {
170
+ setTooltipVisible(currentVisible => {
171
+ if (!currentVisible) {
172
+ setDeviceTypeStable(newType);
173
+ }
174
+ return currentVisible;
175
+ });
176
+ }, [setDeviceTypeStable]);
177
+ useDeviceType(setDeviceTypeConditional);
178
+ const onKeyDownHandler = e => {
179
+ if (e.code === "Escape") {
180
+ setTooltipVisible(false);
181
+ }
182
+ };
183
+ const handleUniversalClick = useCallback(e => {
184
+ const hasExternalClickHandler = !!(trigger === null || trigger === void 0 ? void 0 : trigger.props.onClick);
185
+ if (deviceType === DeviceType.Desktop) {
186
+ setTooltipVisible(currentVisible => {
187
+ if (currentVisible) {
188
+ return false;
112
189
  }
113
- return createPortal(_jsxs("div", { id: tooltipId, role: "tooltip", ref: tooltipRef, className: classNames(["zen-tooltip", dark ? "zen-dark" : "", `zen-tooltip--${size}`, className]), onMouseOver: () => {
114
- timerRef.current && clearTimeout(timerRef.current);
115
- timerMouseOutRef.current && clearTimeout(timerMouseOutRef.current);
116
- }, onMouseOut: () => {
117
- timerMouseOutRef.current = setTimeout(() => setTooltipVisible(false), TOOLTIP_VISIBILITY_DELAY);
118
- }, children: [_jsx("div", { className: classNames(["zen-tooltip__arrow", arrowClass]), ref: arrowRef }), _jsx("div", { className: classNames(["zen-tooltip__body", `zen-tooltip__body--${size}`]), children: children })] }), document.fullscreenElement || document.body);
190
+ return currentVisible;
191
+ });
192
+ } else {
193
+ e === null || e === void 0 ? void 0 : e.stopPropagation();
194
+ if (!hasExternalClickHandler) {
195
+ setTooltipVisible(isVisible => !isVisible);
196
+ }
197
+ }
198
+ }, [trigger === null || trigger === void 0 ? void 0 : trigger.props, deviceType]);
199
+ const triggerCloneProps = useMemo(() => isTooltipVisible ? {
200
+ "aria-describedby": tooltipId
201
+ } : {}, [isTooltipVisible, tooltipId]);
202
+ const tooltipTrigger = useMemo(() => trigger ? trigger : _jsx("button", {
203
+ tabIndex: 0,
204
+ type: "button",
205
+ className: "zen-tooltip__trigger-container",
206
+ "aria-label": translate("Information"),
207
+ children: createElement(IconInfoCircle, {
208
+ size: isMobile ? "huge" : "large",
209
+ className: classNames([triggerClassName || "", "zen-tooltip__trigger"])
210
+ })
211
+ }), [trigger, isMobile, triggerClassName, translate]);
212
+ const triggerClone = _jsx(EventWrapper, {
213
+ deviceType: deviceType,
214
+ isTooltipVisible: isTooltipVisible,
215
+ onKeyDownHandler: onKeyDownHandler,
216
+ handleUniversalClick: handleUniversalClick,
217
+ setTooltipVisible: setTooltipVisible,
218
+ timerRef: timerRef,
219
+ timerMouseOutRef: timerMouseOutRef,
220
+ children: React.cloneElement(tooltipTrigger, Object.assign({
221
+ ref: triggerRef
222
+ }, triggerCloneProps))
223
+ });
224
+ // Initial arrow class - will be updated by calculatePosition
225
+ const arrowClass = useMemo(() => arrowClasses[tooltipAlignment], [tooltipAlignment]);
226
+ const getOppositeAlignment = main => {
227
+ switch (main) {
228
+ case "right":
229
+ return "left";
230
+ case "left":
231
+ return "right";
232
+ case "top":
233
+ return "bottom";
234
+ case "bottom":
235
+ return "top";
236
+ default:
237
+ return main;
238
+ }
239
+ };
240
+ const checkNaturalFit = useCallback((rawPosition, popupRect) => {
241
+ const docWidth = window.innerWidth + window.scrollX;
242
+ const docHeight = window.innerHeight + window.scrollY;
243
+ // Check horizontal fit
244
+ if (rawPosition.left !== undefined) {
245
+ if (rawPosition.left < 0 || rawPosition.left + popupRect.width > docWidth) {
246
+ return false;
247
+ }
248
+ } else if (rawPosition.right !== undefined) {
249
+ if (docWidth - rawPosition.right < popupRect.width) {
250
+ return false;
251
+ }
252
+ }
253
+ // Check vertical fit
254
+ if (rawPosition.top !== undefined) {
255
+ if (rawPosition.top < 0 || rawPosition.top + popupRect.height > docHeight) {
256
+ return false;
257
+ }
258
+ } else if (rawPosition.bottom !== undefined) {
259
+ if (docHeight - rawPosition.bottom < popupRect.height) {
260
+ return false;
261
+ }
262
+ }
263
+ return true;
264
+ }, []);
265
+ const getEffectiveAlignment = useCallback(preferredAlignment => {
266
+ if (isMobile) {
267
+ return preferredAlignment;
268
+ }
269
+ const triggerEl = triggerRef.current;
270
+ const popupEl = tooltipRef.current;
271
+ if (!triggerEl || !popupEl) {
272
+ return preferredAlignment;
273
+ }
274
+ const triggerRect = triggerEl.getBoundingClientRect();
275
+ const popupRect = popupEl.getBoundingClientRect();
276
+ const parentRect = {
277
+ top: 0,
278
+ left: 0,
279
+ right: window.innerWidth,
280
+ bottom: window.innerHeight,
281
+ width: window.innerWidth,
282
+ height: window.innerHeight
119
283
  };
120
- const calculatePosition = useCallback(() => {
121
- calculatePos(triggerRef, tooltipRef, TOOLTIP_ARROW_HEIGHT + padding, TOOLTIP_ARROW_HEIGHT + padding, false, alignment, tooltipAlignments);
122
- calculateArrowPosition(triggerRef, tooltipRef, arrowRef, alignment);
123
- }, [alignment, padding, triggerRef]);
124
- const handleClickOutside = useCallback((event) => {
125
- var _a, _b;
126
- if (!((_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target)) && !((_b = tooltipRef.current) === null || _b === void 0 ? void 0 : _b.contains(event.target))) {
284
+ const [mainAlignment, subAlignment] = preferredAlignment.split("-");
285
+ const oppositeMain = getOppositeAlignment(mainAlignment);
286
+ const preferredFn = tooltipAlignments[preferredAlignment];
287
+ const rawPreferredPos = preferredFn(triggerRect, popupRect, parentRect, TOOLTIP_ARROW_HEIGHT + GAP, TOOLTIP_ARROW_HEIGHT + GAP);
288
+ if (checkNaturalFit(rawPreferredPos, popupRect)) {
289
+ return preferredAlignment;
290
+ }
291
+ const fallbackAlignment = subAlignment ? `${oppositeMain}-${subAlignment}` : oppositeMain;
292
+ const fallbackFn = tooltipAlignments[fallbackAlignment];
293
+ const rawFallbackPos = fallbackFn(triggerRect, popupRect, parentRect, TOOLTIP_ARROW_HEIGHT + GAP, TOOLTIP_ARROW_HEIGHT + GAP);
294
+ if (checkNaturalFit(rawFallbackPos, popupRect)) {
295
+ return fallbackAlignment;
296
+ }
297
+ return preferredAlignment;
298
+ }, [isMobile, TOOLTIP_ARROW_HEIGHT, triggerRef, checkNaturalFit]);
299
+ const renderTooltip = () => {
300
+ if (!isTooltipVisible) {
301
+ return "";
302
+ }
303
+ const content = _jsxs(_Fragment, {
304
+ children: [isMobile && _jsx(Shield, {
305
+ className: "zen-tooltip__shield"
306
+ }), _jsxs("div", {
307
+ id: tooltipId,
308
+ role: "tooltip",
309
+ ref: tooltipRef,
310
+ className: classNames(["zen-tooltip", dark ? "zen-dark" : "", `zen-tooltip--auto`, isMobile ? "zen-tooltip--mobile" : "", isDrive ? "zen-tooltip--drive" : "", className]),
311
+ onMouseOver: () => {
312
+ timerRef.current && clearTimeout(timerRef.current);
313
+ timerMouseOutRef.current && clearTimeout(timerMouseOutRef.current);
314
+ },
315
+ onMouseOut: () => {
316
+ timerMouseOutRef.current = setTimeout(() => {
317
+ if (!isMobile && !isDrive) {
318
+ setTooltipVisible(false);
319
+ }
320
+ }, TOOLTIP_VISIBILITY_DELAY);
321
+ },
322
+ children: [!isMobile && !isDrive && _jsx("div", {
323
+ className: classNames(["zen-tooltip__arrow", arrowClass]),
324
+ ref: arrowRef
325
+ }), _jsxs("div", {
326
+ className: classNames(["zen-tooltip__body", "zen-tooltip__body--auto", isDrive ? "zen-tooltip__body--drive" : "", isMobile ? "zen-tooltip__body--mobile" : "", deviceType === DeviceType.Desktop && !isDrive ? "zen-tooltip__body--desktop" : ""]),
327
+ children: [(mobileSheetTitle || mobileTitle) && (deviceType === DeviceType.Mobile || isDrive) && _jsx("div", {
328
+ className: "zen-tooltip__title",
329
+ children: mobileSheetTitle || mobileTitle
330
+ }), children]
331
+ }), (deviceType === DeviceType.Mobile || isDrive) && _jsx(Button, {
332
+ className: "zen-tooltip__close-button",
333
+ title: translate("Close"),
334
+ "aria-label": translate("Close"),
335
+ onClick: () => {
336
+ var _a;
127
337
  setTooltipVisible(false);
338
+ (_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
339
+ },
340
+ children: _jsx(IconClose, {
341
+ description: translate("Close"),
342
+ className: "svgIcon",
343
+ size: "huge"
344
+ })
345
+ })]
346
+ })]
347
+ });
348
+ return createPortal(content, document.fullscreenElement || document.body, tooltipId);
349
+ };
350
+ const calculatePosition = useCallback(() => {
351
+ const eAlignment = getEffectiveAlignment(tooltipAlignmentRef.current);
352
+ calculatePos(triggerRef, tooltipRef, TOOLTIP_ARROW_HEIGHT + GAP, TOOLTIP_ARROW_HEIGHT + GAP, false, eAlignment, tooltipAlignments, undefined, isMobile);
353
+ calculateArrowPosition(triggerRef, tooltipRef, arrowRef, eAlignment);
354
+ // Update arrow class directly in DOM to avoid triggering re-renders
355
+ if (arrowRef.current) {
356
+ const newArrowClass = arrowClasses[eAlignment];
357
+ arrowRef.current.className = arrowRef.current.className.replace(/zen-tooltip__arrow--\S+/g, "").trim();
358
+ if (newArrowClass) {
359
+ arrowRef.current.classList.add(newArrowClass.replace("zen-tooltip__arrow ", ""));
360
+ }
361
+ }
362
+ }, [TOOLTIP_ARROW_HEIGHT, triggerRef, tooltipRef, arrowRef, getEffectiveAlignment, isMobile]);
363
+ useResize(calculatePosition, isTooltipVisible);
364
+ useLayoutEffect(calculatePosition, [isTooltipVisible, calculatePosition]);
365
+ useEffect(() => {
366
+ const finalClickHandler = event => {
367
+ var _a, _b;
368
+ if (!isTooltipVisible) {
369
+ return;
370
+ }
371
+ if (deviceType === DeviceType.Mobile) {
372
+ if (!((_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target)) && !((_b = tooltipRef.current) === null || _b === void 0 ? void 0 : _b.contains(event.target))) {
373
+ setTooltipVisible(false);
128
374
  }
129
- }, [triggerRef]);
130
- useResize(calculatePosition, isTooltipVisible);
131
- useLayoutEffect(calculatePosition, [isTooltipVisible, calculatePosition]);
132
- useEffect(() => {
133
- if (deviceType === DeviceType.Mobile && isTooltipVisible) {
134
- document.addEventListener("click", handleClickOutside);
135
- }
136
- return () => {
137
- document.removeEventListener("click", handleClickOutside);
138
- };
139
- }, [deviceType, isTooltipVisible, handleClickOutside]);
140
- useEffect(() => {
141
- if (deviceType === DeviceType.Mobile && isTooltipVisible) {
142
- document.addEventListener("click", handleClickOutside);
143
- }
144
- return () => {
145
- document.removeEventListener("click", handleClickOutside);
146
- };
147
- }, [deviceType, isTooltipVisible, handleClickOutside]);
148
- useEffect(() => {
149
- const escapeHandler = onKeyDownHandler;
150
- document.addEventListener("keydown", escapeHandler);
151
- return () => document.removeEventListener("keydown", escapeHandler);
152
- }, [onKeyDownHandler]);
153
- return _jsxs(_Fragment, { children: [isTooltipVisible && renderTooltip(), triggerClone] });
154
- };
375
+ }
376
+ };
377
+ const escapeHandler = e => {
378
+ if (!isTooltipVisible) {
379
+ return;
380
+ }
381
+ if (e.code === "Escape") {
382
+ setTooltipVisible(false);
383
+ }
384
+ };
385
+ document.addEventListener("click", finalClickHandler);
386
+ document.addEventListener("keydown", escapeHandler);
387
+ return () => {
388
+ document.removeEventListener("click", finalClickHandler);
389
+ document.removeEventListener("keydown", escapeHandler);
390
+ };
391
+ }, [isTooltipVisible, deviceType, triggerRef, tooltipRef]);
392
+ // Cleanup timers and event listeners on unmount to prevent memory leaks and test issues
393
+ useEffect(() => () => {
394
+ if (timerRef.current) {
395
+ clearTimeout(timerRef.current);
396
+ }
397
+ if (timerMouseOutRef.current) {
398
+ clearTimeout(timerMouseOutRef.current);
399
+ }
400
+ }, []);
401
+ return _jsxs(_Fragment, {
402
+ children: [isTooltipVisible && renderTooltip(), triggerClone]
403
+ });
404
+ };
@@ -248,5 +248,6 @@
248
248
  "Confirm": "Potvrdit",
249
249
  "Clear all": "Vymazat vše",
250
250
  "Reload": "Načíst znovu",
251
- "View details": "Zobrazit podrobnosti"
251
+ "View details": "Zobrazit podrobnosti",
252
+ "Year to date": "Od začátku roku"
252
253
  }
@@ -258,5 +258,6 @@
258
258
  "On": "På",
259
259
  "Off": "Slukket",
260
260
  "Reload": "Genindlæs",
261
- "View details": "Se detaljer"
261
+ "View details": "Se detaljer",
262
+ "Year to date": "År til dato"
262
263
  }
@@ -248,5 +248,6 @@
248
248
  "Confirm": "Bestätigen",
249
249
  "Clear all": "Alle löschen",
250
250
  "Reload": "Neu laden",
251
- "View details": "Details anzeigen"
251
+ "View details": "Details anzeigen",
252
+ "Year to date": "Seit Jahresbeginn"
252
253
  }
@@ -308,5 +308,6 @@
308
308
  "Details": "Details",
309
309
  "View details": "View details",
310
310
  "Selection panel": "Selection panel",
311
- "Bulk select": "Bulk select"
311
+ "Bulk select": "Bulk select",
312
+ "Year to date": "Year to date"
312
313
  }
@@ -93,7 +93,7 @@
93
93
  "Custom": "Personalizado",
94
94
  "GroupTrailerId": "Remolque",
95
95
  "GroupVehicleId": "Vehículo",
96
- "GroupCompanyId": "Grupo Compañía",
96
+ "GroupCompanyId": "Grupo Empresa",
97
97
  "GroupDieselId": "Diésel",
98
98
  "GroupAssetTypeId": "Tipo de activo",
99
99
  "GroupAssetInformationId": "Información del activo",
@@ -248,5 +248,6 @@
248
248
  "Confirm": "Confirmar",
249
249
  "Clear all": "Borrar todo",
250
250
  "Reload": "Volver a cargar",
251
- "View details": "Ver detalles"
251
+ "View details": "Ver detalles",
252
+ "Year to date": "Año a la fecha"
252
253
  }
@@ -258,5 +258,6 @@
258
258
  "On": "Päälle",
259
259
  "Off": "Pois",
260
260
  "Reload": "Ladata uudelleen",
261
- "View details": "Näytä tiedot"
261
+ "View details": "Näytä tiedot",
262
+ "Year to date": "Vuoden alusta"
262
263
  }