@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.
- package/README.md +17 -0
- package/dist/advancedGroupsFilter/advancedGroupsFilterFormSection.js +1 -1
- package/dist/advancedGroupsFilter/advancedGroupsFilterSectionTooltip.js +0 -39
- package/dist/alertRaw/components/alertAnimation.js +8 -4
- package/dist/card/card.d.ts +1 -1
- package/dist/card/card.js +1 -3
- package/dist/card/components/status.js +2 -2
- package/dist/chart/barChart/getBarTooltipItems.js +31 -2
- package/dist/chart/barChart.js +2 -1
- package/dist/chart/utils/getYAxisMeta.d.ts +1 -1
- package/dist/chart/utils/getYAxisMeta.js +44 -1
- package/dist/checkbox/checkbox.js +3 -3
- package/dist/dataGrid/emptySearchList/emptySearchList.d.ts +6 -7
- package/dist/dataGrid/emptySearchList/emptySearchList.js +15 -23
- package/dist/dateInputRaw/dateInputRaw.d.ts +1 -1
- package/dist/dateRangeRaw/dateRangeRaw.d.ts +1 -1
- package/dist/dateRangeRaw/utils/dateRangeUtils.d.ts +1 -0
- package/dist/dateRangeRaw/utils/dateRangeUtils.js +39 -1
- package/dist/dropdownRaw/dropdownRaw.d.ts +1 -1
- package/dist/emptyState/emptyState.d.ts +9 -0
- package/dist/emptyState/emptyState.js +14 -0
- package/dist/emptyState/hooks/useIcon.d.ts +2 -0
- package/dist/emptyState/hooks/useIcon.js +17 -0
- package/dist/filtersBar/components/filtersBarPeriodPicker/getRangeOption.d.ts +1 -0
- package/dist/filtersBar/components/filtersBarPeriodPicker/getRangeOption.js +28 -3
- package/dist/formField/components/formFieldAdditionalInfo.d.ts +12 -0
- package/dist/formField/components/formFieldAdditionalInfo.js +10 -0
- package/dist/formField/components/formFieldAssistiveError.d.ts +10 -0
- package/dist/formField/components/formFieldAssistiveError.js +12 -0
- package/dist/formField/components/formFieldCounter.d.ts +6 -0
- package/dist/formField/components/formFieldCounter.js +7 -0
- package/dist/formField/components/formFieldLoading.d.ts +12 -0
- package/dist/formField/components/formFieldLoading.js +16 -0
- package/dist/formField/components/formFieldWithLabel.d.ts +8 -11
- package/dist/formField/components/formFieldWithLabel.js +21 -3
- package/dist/formField/components/formFieldWithoutLabel.d.ts +8 -9
- package/dist/formField/components/formFieldWithoutLabel.js +6 -1
- package/dist/formField/components/isOldFormFieldComponent.d.ts +2 -0
- package/dist/formField/components/isOldFormFieldComponent.js +12 -0
- package/dist/formField/components/trailingComponent.d.ts +2 -1
- package/dist/formField/components/trailingComponent.js +7 -1
- package/dist/formField/formField.d.ts +17 -35
- package/dist/formField/formField.js +4 -71
- package/dist/formField/hooks/useContainer.d.ts +2 -0
- package/dist/formField/hooks/useContainer.js +47 -0
- package/dist/formField/hooks/useError.d.ts +1 -1
- package/dist/formField/hooks/useFormFieldClasses.d.ts +2 -0
- package/dist/formField/hooks/useFormFieldClasses.js +30 -0
- package/dist/formField/hooks/useFormFieldProps.d.ts +17 -0
- package/dist/formField/hooks/useFormFieldProps.js +37 -0
- package/dist/formField/hooks/useTrailing.d.ts +1 -1
- package/dist/formField/hooks/useTrailing.js +1 -1
- package/dist/formField/hooks/useWidth.d.ts +1 -1
- package/dist/formField/types.d.ts +35 -0
- package/dist/formField/types.js +2 -0
- package/dist/formGroup/components/formGroupList.d.ts +1 -1
- package/dist/formGroup/components/formGroupToggle.d.ts +1 -1
- package/dist/formGroup/formGroup.d.ts +1 -1
- package/dist/formGroup/hooks/useLabelAlign.d.ts +1 -1
- package/dist/formGroup/types.d.ts +1 -1
- package/dist/formGroup/utils/applyCustomControlClasses.d.ts +1 -1
- package/dist/formGroup/utils/applyCustomLabelClasses.d.ts +1 -1
- package/dist/formGroup/utils/getControlClasses/getControlClasses.d.ts +1 -1
- package/dist/formGroup/utils/getControlClasses/getOneLabelOneControlClasses.d.ts +1 -1
- package/dist/formGroup/utils/getControlClasses/getOneLabelTwoControlsClasses.d.ts +1 -1
- package/dist/formGroup/utils/getControlClasses/getTwoLabelsOneControlClasses.d.ts +1 -1
- package/dist/formGroup/utils/getControlClasses/getTwoLabelsTwoControlsClasses.d.ts +1 -1
- package/dist/formGroup/utils/getLabelClasses/getLabelClasses.d.ts +1 -1
- package/dist/formGroup/utils/getLabelClasses/getOneLabelOneControlClasses.d.ts +1 -1
- package/dist/formGroup/utils/getLabelClasses/getOneLabelTwoControlsClasses.d.ts +1 -1
- package/dist/formGroup/utils/getLabelClasses/getTwoLabelsOneControlClasses.d.ts +1 -1
- package/dist/formGroup/utils/getLabelClasses/getTwoLabelsTwoControlsClasses.d.ts +1 -1
- package/dist/formGroup/utils/getListClasses.d.ts +1 -1
- package/dist/formGroup/utils/getToggleClasses.d.ts +1 -1
- package/dist/formGroup/utils/initializeState.d.ts +1 -1
- package/dist/formGroup/utils/isTopAlign.d.ts +1 -1
- package/dist/formLayout/types.d.ts +1 -1
- package/dist/formSection/types.d.ts +1 -1
- package/dist/formSection/utils/formSectionProvider.d.ts +1 -1
- package/dist/groupButtonRaw/groupButtonRaw.d.ts +1 -1
- package/dist/groupsFilterRaw/groupsFilterRaw.d.ts +1 -1
- package/dist/groupsFilterRaw/groupsHelper.js +2 -2
- package/dist/headerTitle/headerTitle.js +1 -1
- package/dist/images/imageAdjustFilter.d.ts +4 -0
- package/dist/images/imageAdjustFilter.js +16 -0
- package/dist/images/imageNoMatchingAssets.d.ts +4 -0
- package/dist/images/imageNoMatchingAssets.js +16 -0
- package/dist/index.css +619 -524
- package/dist/index.d.ts +6 -2
- package/dist/index.js +23 -16
- package/dist/inputAdornments/inputAdornments.d.ts +2 -1
- package/dist/inputAdornments/inputAdornments.js +2 -2
- package/dist/layout/layout.js +11 -7
- package/dist/list/itemData/itemData.d.ts +1 -0
- package/dist/list/itemData/itemDataInternal.d.ts +2 -1
- package/dist/list/itemData/itemDataInternal.js +4 -2
- package/dist/list/itemData/itemDataWaiting.d.ts +2 -1
- package/dist/list/itemData/itemDataWaiting.js +4 -1
- package/dist/list/list.d.ts +13 -4
- package/dist/list/list.js +29 -12
- package/dist/list/utils/getLoadingItems.d.ts +1 -1
- package/dist/list/utils/getLoadingItems.js +4 -4
- package/dist/modal/modal.js +7 -0
- package/dist/pillExpandable/pillExpandable.d.ts +1 -0
- package/dist/pillExpandable/pillExpandable.js +74 -33
- package/dist/radioGroupRaw/radioGroupRaw.d.ts +1 -1
- package/dist/rangeRaw/rangeRaw.d.ts +1 -1
- package/dist/summary/summary.js +0 -1
- package/dist/summaryTile/summaryTile.js +2 -2
- package/dist/table/children/tableEmpty.d.ts +1 -1
- package/dist/table/children/useTableChildren.js +1 -1
- package/dist/timePickerRaw/timePickerRaw.d.ts +1 -1
- package/dist/tooltip/tooltip.d.ts +15 -4
- package/dist/tooltip/tooltip.js +421 -158
- package/dist/utils/localization/translations/cs.json +2 -1
- package/dist/utils/localization/translations/da-DK.json +2 -1
- package/dist/utils/localization/translations/de.json +2 -1
- package/dist/utils/localization/translations/en.json +2 -1
- package/dist/utils/localization/translations/es.json +3 -2
- package/dist/utils/localization/translations/fi-FI.json +2 -1
- package/dist/utils/localization/translations/fr-FR.json +2 -1
- package/dist/utils/localization/translations/fr.json +3 -2
- package/dist/utils/localization/translations/hu-HU.json +2 -1
- package/dist/utils/localization/translations/id.json +2 -1
- package/dist/utils/localization/translations/it.json +2 -1
- package/dist/utils/localization/translations/ja.json +2 -1
- package/dist/utils/localization/translations/ko-KR.json +2 -1
- package/dist/utils/localization/translations/ms.json +2 -1
- package/dist/utils/localization/translations/nb-NO.json +2 -1
- package/dist/utils/localization/translations/nl.json +2 -1
- package/dist/utils/localization/translations/pl.json +2 -1
- package/dist/utils/localization/translations/pt-BR.json +2 -1
- package/dist/utils/localization/translations/sk-SK.json +2 -1
- package/dist/utils/localization/translations/sv.json +2 -1
- package/dist/utils/localization/translations/th.json +2 -1
- package/dist/utils/localization/translations/tr.json +2 -1
- package/dist/utils/localization/translations/zh-Hans.json +2 -1
- package/dist/utils/localization/translations/zh-TW.json +2 -1
- package/dist/utils/positioningUtils/calculatePosition.d.ts +1 -1
- package/dist/utils/positioningUtils/calculatePosition.js +11 -1
- package/esm/advancedGroupsFilter/advancedGroupsFilterFormSection.js +1 -1
- package/esm/advancedGroupsFilter/advancedGroupsFilterSectionTooltip.js +0 -39
- package/esm/alertRaw/components/alertAnimation.js +8 -4
- package/esm/card/card.d.ts +1 -1
- package/esm/card/card.js +1 -3
- package/esm/card/components/status.js +2 -2
- package/esm/chart/barChart/getBarTooltipItems.js +31 -2
- package/esm/chart/barChart.js +2 -1
- package/esm/chart/utils/getYAxisMeta.d.ts +1 -1
- package/esm/chart/utils/getYAxisMeta.js +44 -1
- package/esm/checkbox/checkbox.js +3 -3
- package/esm/dataGrid/emptySearchList/emptySearchList.d.ts +6 -7
- package/esm/dataGrid/emptySearchList/emptySearchList.js +16 -24
- package/esm/dateInputRaw/dateInputRaw.d.ts +1 -1
- package/esm/dateRangeRaw/dateRangeRaw.d.ts +1 -1
- package/esm/dateRangeRaw/utils/dateRangeUtils.d.ts +1 -0
- package/esm/dateRangeRaw/utils/dateRangeUtils.js +37 -0
- package/esm/dropdownRaw/dropdownRaw.d.ts +1 -1
- package/esm/emptyState/emptyState.d.ts +9 -0
- package/esm/emptyState/emptyState.js +10 -0
- package/esm/emptyState/hooks/useIcon.d.ts +2 -0
- package/esm/emptyState/hooks/useIcon.js +10 -0
- package/esm/filtersBar/components/filtersBarPeriodPicker/getRangeOption.d.ts +1 -0
- package/esm/filtersBar/components/filtersBarPeriodPicker/getRangeOption.js +29 -4
- package/esm/formField/components/formFieldAdditionalInfo.d.ts +12 -0
- package/esm/formField/components/formFieldAdditionalInfo.js +6 -0
- package/esm/formField/components/formFieldAssistiveError.d.ts +10 -0
- package/esm/formField/components/formFieldAssistiveError.js +8 -0
- package/esm/formField/components/formFieldCounter.d.ts +6 -0
- package/esm/formField/components/formFieldCounter.js +3 -0
- package/esm/formField/components/formFieldLoading.d.ts +12 -0
- package/esm/formField/components/formFieldLoading.js +12 -0
- package/esm/formField/components/formFieldWithLabel.d.ts +8 -11
- package/esm/formField/components/formFieldWithLabel.js +21 -3
- package/esm/formField/components/formFieldWithoutLabel.d.ts +8 -9
- package/esm/formField/components/formFieldWithoutLabel.js +6 -1
- package/esm/formField/components/isOldFormFieldComponent.d.ts +2 -0
- package/esm/formField/components/isOldFormFieldComponent.js +8 -0
- package/esm/formField/components/trailingComponent.d.ts +2 -1
- package/esm/formField/components/trailingComponent.js +7 -1
- package/esm/formField/formField.d.ts +17 -35
- package/esm/formField/formField.js +5 -72
- package/esm/formField/hooks/useContainer.d.ts +2 -0
- package/esm/formField/hooks/useContainer.js +43 -0
- package/esm/formField/hooks/useError.d.ts +1 -1
- package/esm/formField/hooks/useFormFieldClasses.d.ts +2 -0
- package/esm/formField/hooks/useFormFieldClasses.js +26 -0
- package/esm/formField/hooks/useFormFieldProps.d.ts +17 -0
- package/esm/formField/hooks/useFormFieldProps.js +33 -0
- package/esm/formField/hooks/useTrailing.d.ts +1 -1
- package/esm/formField/hooks/useTrailing.js +1 -1
- package/esm/formField/hooks/useWidth.d.ts +1 -1
- package/esm/formField/types.d.ts +35 -0
- package/esm/formField/types.js +1 -0
- package/esm/formGroup/components/formGroupList.d.ts +1 -1
- package/esm/formGroup/components/formGroupToggle.d.ts +1 -1
- package/esm/formGroup/formGroup.d.ts +1 -1
- package/esm/formGroup/hooks/useLabelAlign.d.ts +1 -1
- package/esm/formGroup/types.d.ts +1 -1
- package/esm/formGroup/utils/applyCustomControlClasses.d.ts +1 -1
- package/esm/formGroup/utils/applyCustomLabelClasses.d.ts +1 -1
- package/esm/formGroup/utils/getControlClasses/getControlClasses.d.ts +1 -1
- package/esm/formGroup/utils/getControlClasses/getOneLabelOneControlClasses.d.ts +1 -1
- package/esm/formGroup/utils/getControlClasses/getOneLabelTwoControlsClasses.d.ts +1 -1
- package/esm/formGroup/utils/getControlClasses/getTwoLabelsOneControlClasses.d.ts +1 -1
- package/esm/formGroup/utils/getControlClasses/getTwoLabelsTwoControlsClasses.d.ts +1 -1
- package/esm/formGroup/utils/getLabelClasses/getLabelClasses.d.ts +1 -1
- package/esm/formGroup/utils/getLabelClasses/getOneLabelOneControlClasses.d.ts +1 -1
- package/esm/formGroup/utils/getLabelClasses/getOneLabelTwoControlsClasses.d.ts +1 -1
- package/esm/formGroup/utils/getLabelClasses/getTwoLabelsOneControlClasses.d.ts +1 -1
- package/esm/formGroup/utils/getLabelClasses/getTwoLabelsTwoControlsClasses.d.ts +1 -1
- package/esm/formGroup/utils/getListClasses.d.ts +1 -1
- package/esm/formGroup/utils/getToggleClasses.d.ts +1 -1
- package/esm/formGroup/utils/initializeState.d.ts +1 -1
- package/esm/formGroup/utils/isTopAlign.d.ts +1 -1
- package/esm/formLayout/types.d.ts +1 -1
- package/esm/formSection/types.d.ts +1 -1
- package/esm/formSection/utils/formSectionProvider.d.ts +1 -1
- package/esm/groupButtonRaw/groupButtonRaw.d.ts +1 -1
- package/esm/groupsFilterRaw/groupsFilterRaw.d.ts +1 -1
- package/esm/groupsFilterRaw/groupsHelper.js +2 -2
- package/esm/headerTitle/headerTitle.js +1 -1
- package/esm/images/imageAdjustFilter.d.ts +4 -0
- package/esm/images/imageAdjustFilter.js +12 -0
- package/esm/images/imageNoMatchingAssets.d.ts +4 -0
- package/esm/images/imageNoMatchingAssets.js +12 -0
- package/esm/index.d.ts +6 -2
- package/esm/index.js +4 -1
- package/esm/inputAdornments/inputAdornments.d.ts +2 -1
- package/esm/inputAdornments/inputAdornments.js +2 -2
- package/esm/layout/layout.js +11 -7
- package/esm/list/itemData/itemData.d.ts +1 -0
- package/esm/list/itemData/itemDataInternal.d.ts +2 -1
- package/esm/list/itemData/itemDataInternal.js +4 -2
- package/esm/list/itemData/itemDataWaiting.d.ts +2 -1
- package/esm/list/itemData/itemDataWaiting.js +4 -1
- package/esm/list/list.d.ts +13 -4
- package/esm/list/list.js +29 -12
- package/esm/list/utils/getLoadingItems.d.ts +1 -1
- package/esm/list/utils/getLoadingItems.js +4 -4
- package/esm/modal/modal.js +7 -0
- package/esm/pillExpandable/pillExpandable.d.ts +1 -0
- package/esm/pillExpandable/pillExpandable.js +74 -33
- package/esm/radioGroupRaw/radioGroupRaw.d.ts +1 -1
- package/esm/rangeRaw/rangeRaw.d.ts +1 -1
- package/esm/summary/summary.js +0 -1
- package/esm/summaryTile/summaryTile.js +2 -2
- package/esm/table/children/tableEmpty.d.ts +1 -1
- package/esm/table/children/useTableChildren.js +1 -1
- package/esm/timePickerRaw/timePickerRaw.d.ts +1 -1
- package/esm/tooltip/tooltip.d.ts +15 -4
- package/esm/tooltip/tooltip.js +388 -138
- package/esm/utils/localization/translations/cs.json +2 -1
- package/esm/utils/localization/translations/da-DK.json +2 -1
- package/esm/utils/localization/translations/de.json +2 -1
- package/esm/utils/localization/translations/en.json +2 -1
- package/esm/utils/localization/translations/es.json +3 -2
- package/esm/utils/localization/translations/fi-FI.json +2 -1
- package/esm/utils/localization/translations/fr-FR.json +2 -1
- package/esm/utils/localization/translations/fr.json +3 -2
- package/esm/utils/localization/translations/hu-HU.json +2 -1
- package/esm/utils/localization/translations/id.json +2 -1
- package/esm/utils/localization/translations/it.json +2 -1
- package/esm/utils/localization/translations/ja.json +2 -1
- package/esm/utils/localization/translations/ko-KR.json +2 -1
- package/esm/utils/localization/translations/ms.json +2 -1
- package/esm/utils/localization/translations/nb-NO.json +2 -1
- package/esm/utils/localization/translations/nl.json +2 -1
- package/esm/utils/localization/translations/pl.json +2 -1
- package/esm/utils/localization/translations/pt-BR.json +2 -1
- package/esm/utils/localization/translations/sk-SK.json +2 -1
- package/esm/utils/localization/translations/sv.json +2 -1
- package/esm/utils/localization/translations/th.json +2 -1
- package/esm/utils/localization/translations/tr.json +2 -1
- package/esm/utils/localization/translations/zh-Hans.json +2 -1
- package/esm/utils/localization/translations/zh-TW.json +2 -1
- package/esm/utils/positioningUtils/calculatePosition.d.ts +1 -1
- package/esm/utils/positioningUtils/calculatePosition.js +11 -1
- package/package.json +1 -1
package/dist/tooltip/tooltip.js
CHANGED
|
@@ -1,30 +1,92 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
injectString
|
|
5
|
+
} = require("../utils/localization/translationsDictionary");
|
|
6
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return m[k];
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
} : function (o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
17
21
|
});
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
value: v
|
|
26
|
+
});
|
|
27
|
+
} : function (o, v) {
|
|
28
|
+
o["default"] = v;
|
|
29
|
+
});
|
|
30
|
+
var __importStar = this && this.__importStar || function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
24
36
|
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", {
|
|
37
|
+
Object.defineProperty(exports, "__esModule", {
|
|
38
|
+
value: true
|
|
39
|
+
});
|
|
26
40
|
exports.Tooltip = void 0;
|
|
27
41
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
42
|
+
injectString("cs", "Information", "Informace");
|
|
43
|
+
injectString("da-DK", "Information", "Information");
|
|
44
|
+
injectString("de", "Information", "Information");
|
|
45
|
+
injectString("en", "Information", "Information");
|
|
46
|
+
injectString("es", "Information", "Informaci\xF3n");
|
|
47
|
+
injectString("fi-FI", "Information", "Tiedot");
|
|
48
|
+
injectString("fr", "Information", "Renseignements");
|
|
49
|
+
injectString("fr-FR", "Information", "Informations");
|
|
50
|
+
injectString("hu-HU", "Information", "Inform\xE1ci\xF3");
|
|
51
|
+
injectString("id", "Information", "Informasi");
|
|
52
|
+
injectString("it", "Information", "Informazioni");
|
|
53
|
+
injectString("ja", "Information", "\u60C5\u5831");
|
|
54
|
+
injectString("ko-KR", "Information", "\uC815\uBCF4");
|
|
55
|
+
injectString("ms", "Information", "Maklumat");
|
|
56
|
+
injectString("nb-NO", "Information", "Informasjon");
|
|
57
|
+
injectString("nl", "Information", "Informatie");
|
|
58
|
+
injectString("pl", "Information", "Informacje");
|
|
59
|
+
injectString("pt-BR", "Information", "Informa\xE7\xF5es");
|
|
60
|
+
injectString("sk-SK", "Information", "Inform\xE1cie");
|
|
61
|
+
injectString("sv", "Information", "Information");
|
|
62
|
+
injectString("th", "Information", "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25");
|
|
63
|
+
injectString("tr", "Information", "Bilgi");
|
|
64
|
+
injectString("zh-Hans", "Information", "\u4FE1\u606F");
|
|
65
|
+
injectString("zh-TW", "Information", "\u8CC7\u8A0A");
|
|
66
|
+
injectString("cs", "Close", "Zav\u0159\xEDt");
|
|
67
|
+
injectString("da-DK", "Close", "Luk");
|
|
68
|
+
injectString("de", "Close", "Schlie\xDFen");
|
|
69
|
+
injectString("en", "Close", "Close");
|
|
70
|
+
injectString("es", "Close", "Cerrar");
|
|
71
|
+
injectString("fi-FI", "Close", "Sulje");
|
|
72
|
+
injectString("fr", "Close", "Fermer");
|
|
73
|
+
injectString("fr-FR", "Close", "Fermer");
|
|
74
|
+
injectString("hu-HU", "Close", "Z\xE1rd be.");
|
|
75
|
+
injectString("id", "Close", "Tutup");
|
|
76
|
+
injectString("it", "Close", "Chiudere");
|
|
77
|
+
injectString("ja", "Close", "\u9589\u3058\u308B");
|
|
78
|
+
injectString("ko-KR", "Close", "\uB2EB\uAE30");
|
|
79
|
+
injectString("ms", "Close", "Tutup");
|
|
80
|
+
injectString("nb-NO", "Close", "Lukk");
|
|
81
|
+
injectString("nl", "Close", "Sluiten");
|
|
82
|
+
injectString("pl", "Close", "Zamknij");
|
|
83
|
+
injectString("pt-BR", "Close", "Fechar");
|
|
84
|
+
injectString("sk-SK", "Close", "Zatvor");
|
|
85
|
+
injectString("sv", "Close", "St\xE4ng");
|
|
86
|
+
injectString("th", "Close", "\u0E1B\u0E34\u0E14");
|
|
87
|
+
injectString("tr", "Close", "Kapat");
|
|
88
|
+
injectString("zh-Hans", "Close", "\u5173\u95ED");
|
|
89
|
+
injectString("zh-TW", "Close", "\u95DC\u9589");
|
|
28
90
|
const react_1 = __importStar(require("react"));
|
|
29
91
|
const useResize_1 = require("../commonHelpers/hooks/useResize");
|
|
30
92
|
const calculatePosition_1 = require("../utils/positioningUtils/calculatePosition");
|
|
@@ -33,149 +95,350 @@ const classNames_1 = require("../commonHelpers/classNames/classNames");
|
|
|
33
95
|
const calculateArrowPosition_1 = require("./helpers/calculateArrowPosition");
|
|
34
96
|
const deviceType_1 = require("../commonHelpers/hooks/deviceType");
|
|
35
97
|
const useDeviceType_1 = require("../commonHelpers/hooks/useDeviceType");
|
|
36
|
-
const mobileSheet_1 = require("../mobileSheet/mobileSheet");
|
|
37
98
|
const themeContext_1 = require("../utils/theme/themeContext");
|
|
38
99
|
const tooltipAlignments_1 = require("../utils/positioningUtils/tooltipAlignments");
|
|
39
|
-
const
|
|
100
|
+
const iconClose_1 = require("../icons/iconClose");
|
|
101
|
+
const button_1 = require("../button/button");
|
|
102
|
+
const useLanguage_1 = require("../utils/localization/useLanguage");
|
|
103
|
+
const iconInfoCircle_1 = require("../icons/iconInfoCircle");
|
|
104
|
+
const useDrive_1 = require("../utils/theme/useDrive");
|
|
105
|
+
const shield_1 = require("../shield/shield");
|
|
40
106
|
const TOOLTIP_VISIBILITY_DELAY = 100;
|
|
41
107
|
const arrowClasses = {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
108
|
+
"top": "zen-tooltip__arrow--top",
|
|
109
|
+
"top-left": "zen-tooltip__arrow--top",
|
|
110
|
+
"top-right": "zen-tooltip__arrow--top",
|
|
111
|
+
"bottom": "zen-tooltip__arrow--bottom",
|
|
112
|
+
"bottom-left": "zen-tooltip__arrow--bottom",
|
|
113
|
+
"bottom-right": "zen-tooltip__arrow--bottom",
|
|
114
|
+
"right": "zen-tooltip__arrow--right",
|
|
115
|
+
"right-top": "zen-tooltip__arrow--right",
|
|
116
|
+
"right-bottom": "zen-tooltip__arrow--right",
|
|
117
|
+
"left": "zen-tooltip__arrow--left",
|
|
118
|
+
"left-top": "zen-tooltip__arrow--left",
|
|
119
|
+
"left-bottom": "zen-tooltip__arrow--left"
|
|
54
120
|
};
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
121
|
+
const getInitialDeviceType = () => {
|
|
122
|
+
if (typeof window !== "undefined") {
|
|
123
|
+
return (0, useDeviceType_1.getDeviceType)(window.innerWidth);
|
|
124
|
+
}
|
|
125
|
+
return deviceType_1.DeviceType.Desktop;
|
|
126
|
+
};
|
|
127
|
+
const EventWrapper = ({
|
|
128
|
+
children,
|
|
129
|
+
deviceType,
|
|
130
|
+
onKeyDownHandler,
|
|
131
|
+
handleUniversalClick,
|
|
132
|
+
setTooltipVisible,
|
|
133
|
+
timerRef,
|
|
134
|
+
timerMouseOutRef
|
|
135
|
+
}) => {
|
|
136
|
+
const isCurrentDeviceDesktop = deviceType === deviceType_1.DeviceType.Desktop;
|
|
137
|
+
const originalOnClick = children.props.onClick;
|
|
138
|
+
const composedOnClick = (0, react_1.useCallback)(e => {
|
|
139
|
+
// Call original onClick first if it exists
|
|
140
|
+
if (originalOnClick) {
|
|
141
|
+
originalOnClick(e);
|
|
142
|
+
}
|
|
143
|
+
// Then call tooltip's click handler
|
|
144
|
+
handleUniversalClick(e);
|
|
145
|
+
}, [originalOnClick, handleUniversalClick]);
|
|
146
|
+
const desktopEvents = {
|
|
147
|
+
onMouseOver: () => {
|
|
148
|
+
setTooltipVisible(true);
|
|
149
|
+
timerMouseOutRef.current && clearTimeout(timerMouseOutRef.current);
|
|
150
|
+
},
|
|
151
|
+
onMouseLeave: () => {
|
|
152
|
+
timerRef.current = setTimeout(() => {
|
|
153
|
+
setTooltipVisible(false);
|
|
154
|
+
}, TOOLTIP_VISIBILITY_DELAY);
|
|
155
|
+
},
|
|
156
|
+
onFocus: () => setTooltipVisible(true),
|
|
157
|
+
onBlur: () => setTooltipVisible(false),
|
|
158
|
+
onKeyDown: onKeyDownHandler,
|
|
159
|
+
onClick: composedOnClick
|
|
160
|
+
};
|
|
161
|
+
const mobileOnKeyDown = (0, react_1.useCallback)(e => {
|
|
162
|
+
if (e.key === "Enter") {
|
|
163
|
+
handleUniversalClick(undefined);
|
|
164
|
+
}
|
|
165
|
+
}, [handleUniversalClick]);
|
|
166
|
+
const mobileEvents = {
|
|
167
|
+
onClick: composedOnClick,
|
|
168
|
+
onKeyDown: mobileOnKeyDown
|
|
169
|
+
};
|
|
170
|
+
const propsToApply = isCurrentDeviceDesktop ? desktopEvents : mobileEvents;
|
|
171
|
+
return react_1.default.cloneElement(children, propsToApply);
|
|
172
|
+
};
|
|
173
|
+
const Tooltip = ({
|
|
174
|
+
trigger,
|
|
175
|
+
triggerClassName,
|
|
176
|
+
className = "",
|
|
177
|
+
alignment,
|
|
178
|
+
children,
|
|
179
|
+
mobileSheetTitle,
|
|
180
|
+
mobileTitle
|
|
181
|
+
}) => {
|
|
182
|
+
const GAP = 12;
|
|
183
|
+
const isDrive = (0, useDrive_1.useDrive)();
|
|
184
|
+
const triggerRefNative = trigger === null || trigger === void 0 ? void 0 : trigger.ref;
|
|
185
|
+
const triggerLocalRef = (0, react_1.useRef)(null);
|
|
186
|
+
const triggerRef = triggerRefNative || triggerLocalRef;
|
|
187
|
+
const timerRef = (0, react_1.useRef)(null);
|
|
188
|
+
const timerMouseOutRef = (0, react_1.useRef)(null);
|
|
189
|
+
const tooltipRef = (0, react_1.useRef)(null);
|
|
190
|
+
const arrowRef = (0, react_1.useRef)(null);
|
|
191
|
+
const [isTooltipVisible, setTooltipVisible] = (0, react_1.useState)(false);
|
|
192
|
+
const [deviceType, setDeviceType] = (0, react_1.useState)(getInitialDeviceType);
|
|
193
|
+
const isMobile = deviceType === deviceType_1.DeviceType.Mobile;
|
|
194
|
+
const tooltipId = (0, react_1.useId)();
|
|
195
|
+
const {
|
|
196
|
+
translate
|
|
197
|
+
} = (0, useLanguage_1.useLanguage)();
|
|
198
|
+
const {
|
|
199
|
+
dark
|
|
200
|
+
} = (0, react_1.useContext)(themeContext_1.themeContext);
|
|
201
|
+
const tooltipAlignment = (0, react_1.useMemo)(() => isMobile ? "bottom" : alignment || "right", [isMobile, alignment]);
|
|
202
|
+
const TOOLTIP_ARROW_HEIGHT = (0, react_1.useMemo)(() => isMobile || isDrive ? 0 : 6, [isMobile, isDrive]);
|
|
203
|
+
const tooltipAlignmentRef = (0, react_1.useRef)(tooltipAlignment);
|
|
204
|
+
tooltipAlignmentRef.current = tooltipAlignment;
|
|
205
|
+
const setDeviceTypeStable = (0, react_1.useCallback)(newType => {
|
|
206
|
+
setDeviceType(currentDeviceType => newType !== currentDeviceType ? newType : currentDeviceType);
|
|
207
|
+
}, []);
|
|
208
|
+
const setDeviceTypeConditional = (0, react_1.useCallback)(newType => {
|
|
209
|
+
setTooltipVisible(currentVisible => {
|
|
210
|
+
if (!currentVisible) {
|
|
211
|
+
setDeviceTypeStable(newType);
|
|
212
|
+
}
|
|
213
|
+
return currentVisible;
|
|
214
|
+
});
|
|
215
|
+
}, [setDeviceTypeStable]);
|
|
216
|
+
(0, useDeviceType_1.useDeviceType)(setDeviceTypeConditional);
|
|
217
|
+
const onKeyDownHandler = e => {
|
|
218
|
+
if (e.code === "Escape") {
|
|
219
|
+
setTooltipVisible(false);
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
const handleUniversalClick = (0, react_1.useCallback)(e => {
|
|
223
|
+
const hasExternalClickHandler = !!(trigger === null || trigger === void 0 ? void 0 : trigger.props.onClick);
|
|
224
|
+
if (deviceType === deviceType_1.DeviceType.Desktop) {
|
|
225
|
+
setTooltipVisible(currentVisible => {
|
|
226
|
+
if (currentVisible) {
|
|
227
|
+
return false;
|
|
138
228
|
}
|
|
139
|
-
return
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
229
|
+
return currentVisible;
|
|
230
|
+
});
|
|
231
|
+
} else {
|
|
232
|
+
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
233
|
+
if (!hasExternalClickHandler) {
|
|
234
|
+
setTooltipVisible(isVisible => !isVisible);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}, [trigger === null || trigger === void 0 ? void 0 : trigger.props, deviceType]);
|
|
238
|
+
const triggerCloneProps = (0, react_1.useMemo)(() => isTooltipVisible ? {
|
|
239
|
+
"aria-describedby": tooltipId
|
|
240
|
+
} : {}, [isTooltipVisible, tooltipId]);
|
|
241
|
+
const tooltipTrigger = (0, react_1.useMemo)(() => trigger ? trigger : (0, jsx_runtime_1.jsx)("button", {
|
|
242
|
+
tabIndex: 0,
|
|
243
|
+
type: "button",
|
|
244
|
+
className: "zen-tooltip__trigger-container",
|
|
245
|
+
"aria-label": translate("Information"),
|
|
246
|
+
children: (0, react_1.createElement)(iconInfoCircle_1.IconInfoCircle, {
|
|
247
|
+
size: isMobile ? "huge" : "large",
|
|
248
|
+
className: (0, classNames_1.classNames)([triggerClassName || "", "zen-tooltip__trigger"])
|
|
249
|
+
})
|
|
250
|
+
}), [trigger, isMobile, triggerClassName, translate]);
|
|
251
|
+
const triggerClone = (0, jsx_runtime_1.jsx)(EventWrapper, {
|
|
252
|
+
deviceType: deviceType,
|
|
253
|
+
isTooltipVisible: isTooltipVisible,
|
|
254
|
+
onKeyDownHandler: onKeyDownHandler,
|
|
255
|
+
handleUniversalClick: handleUniversalClick,
|
|
256
|
+
setTooltipVisible: setTooltipVisible,
|
|
257
|
+
timerRef: timerRef,
|
|
258
|
+
timerMouseOutRef: timerMouseOutRef,
|
|
259
|
+
children: react_1.default.cloneElement(tooltipTrigger, Object.assign({
|
|
260
|
+
ref: triggerRef
|
|
261
|
+
}, triggerCloneProps))
|
|
262
|
+
});
|
|
263
|
+
// Initial arrow class - will be updated by calculatePosition
|
|
264
|
+
const arrowClass = (0, react_1.useMemo)(() => arrowClasses[tooltipAlignment], [tooltipAlignment]);
|
|
265
|
+
const getOppositeAlignment = main => {
|
|
266
|
+
switch (main) {
|
|
267
|
+
case "right":
|
|
268
|
+
return "left";
|
|
269
|
+
case "left":
|
|
270
|
+
return "right";
|
|
271
|
+
case "top":
|
|
272
|
+
return "bottom";
|
|
273
|
+
case "bottom":
|
|
274
|
+
return "top";
|
|
275
|
+
default:
|
|
276
|
+
return main;
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
const checkNaturalFit = (0, react_1.useCallback)((rawPosition, popupRect) => {
|
|
280
|
+
const docWidth = window.innerWidth + window.scrollX;
|
|
281
|
+
const docHeight = window.innerHeight + window.scrollY;
|
|
282
|
+
// Check horizontal fit
|
|
283
|
+
if (rawPosition.left !== undefined) {
|
|
284
|
+
if (rawPosition.left < 0 || rawPosition.left + popupRect.width > docWidth) {
|
|
285
|
+
return false;
|
|
286
|
+
}
|
|
287
|
+
} else if (rawPosition.right !== undefined) {
|
|
288
|
+
if (docWidth - rawPosition.right < popupRect.width) {
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
// Check vertical fit
|
|
293
|
+
if (rawPosition.top !== undefined) {
|
|
294
|
+
if (rawPosition.top < 0 || rawPosition.top + popupRect.height > docHeight) {
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
} else if (rawPosition.bottom !== undefined) {
|
|
298
|
+
if (docHeight - rawPosition.bottom < popupRect.height) {
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
return true;
|
|
303
|
+
}, []);
|
|
304
|
+
const getEffectiveAlignment = (0, react_1.useCallback)(preferredAlignment => {
|
|
305
|
+
if (isMobile) {
|
|
306
|
+
return preferredAlignment;
|
|
307
|
+
}
|
|
308
|
+
const triggerEl = triggerRef.current;
|
|
309
|
+
const popupEl = tooltipRef.current;
|
|
310
|
+
if (!triggerEl || !popupEl) {
|
|
311
|
+
return preferredAlignment;
|
|
312
|
+
}
|
|
313
|
+
const triggerRect = triggerEl.getBoundingClientRect();
|
|
314
|
+
const popupRect = popupEl.getBoundingClientRect();
|
|
315
|
+
const parentRect = {
|
|
316
|
+
top: 0,
|
|
317
|
+
left: 0,
|
|
318
|
+
right: window.innerWidth,
|
|
319
|
+
bottom: window.innerHeight,
|
|
320
|
+
width: window.innerWidth,
|
|
321
|
+
height: window.innerHeight
|
|
145
322
|
};
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
323
|
+
const [mainAlignment, subAlignment] = preferredAlignment.split("-");
|
|
324
|
+
const oppositeMain = getOppositeAlignment(mainAlignment);
|
|
325
|
+
const preferredFn = tooltipAlignments_1.tooltipAlignments[preferredAlignment];
|
|
326
|
+
const rawPreferredPos = preferredFn(triggerRect, popupRect, parentRect, TOOLTIP_ARROW_HEIGHT + GAP, TOOLTIP_ARROW_HEIGHT + GAP);
|
|
327
|
+
if (checkNaturalFit(rawPreferredPos, popupRect)) {
|
|
328
|
+
return preferredAlignment;
|
|
329
|
+
}
|
|
330
|
+
const fallbackAlignment = subAlignment ? `${oppositeMain}-${subAlignment}` : oppositeMain;
|
|
331
|
+
const fallbackFn = tooltipAlignments_1.tooltipAlignments[fallbackAlignment];
|
|
332
|
+
const rawFallbackPos = fallbackFn(triggerRect, popupRect, parentRect, TOOLTIP_ARROW_HEIGHT + GAP, TOOLTIP_ARROW_HEIGHT + GAP);
|
|
333
|
+
if (checkNaturalFit(rawFallbackPos, popupRect)) {
|
|
334
|
+
return fallbackAlignment;
|
|
335
|
+
}
|
|
336
|
+
return preferredAlignment;
|
|
337
|
+
}, [isMobile, TOOLTIP_ARROW_HEIGHT, triggerRef, checkNaturalFit]);
|
|
338
|
+
const renderTooltip = () => {
|
|
339
|
+
if (!isTooltipVisible) {
|
|
340
|
+
return "";
|
|
341
|
+
}
|
|
342
|
+
const content = (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, {
|
|
343
|
+
children: [isMobile && (0, jsx_runtime_1.jsx)(shield_1.Shield, {
|
|
344
|
+
className: "zen-tooltip__shield"
|
|
345
|
+
}), (0, jsx_runtime_1.jsxs)("div", {
|
|
346
|
+
id: tooltipId,
|
|
347
|
+
role: "tooltip",
|
|
348
|
+
ref: tooltipRef,
|
|
349
|
+
className: (0, classNames_1.classNames)(["zen-tooltip", dark ? "zen-dark" : "", `zen-tooltip--auto`, isMobile ? "zen-tooltip--mobile" : "", isDrive ? "zen-tooltip--drive" : "", className]),
|
|
350
|
+
onMouseOver: () => {
|
|
351
|
+
timerRef.current && clearTimeout(timerRef.current);
|
|
352
|
+
timerMouseOutRef.current && clearTimeout(timerMouseOutRef.current);
|
|
353
|
+
},
|
|
354
|
+
onMouseOut: () => {
|
|
355
|
+
timerMouseOutRef.current = setTimeout(() => {
|
|
356
|
+
if (!isMobile && !isDrive) {
|
|
357
|
+
setTooltipVisible(false);
|
|
358
|
+
}
|
|
359
|
+
}, TOOLTIP_VISIBILITY_DELAY);
|
|
360
|
+
},
|
|
361
|
+
children: [!isMobile && !isDrive && (0, jsx_runtime_1.jsx)("div", {
|
|
362
|
+
className: (0, classNames_1.classNames)(["zen-tooltip__arrow", arrowClass]),
|
|
363
|
+
ref: arrowRef
|
|
364
|
+
}), (0, jsx_runtime_1.jsxs)("div", {
|
|
365
|
+
className: (0, classNames_1.classNames)(["zen-tooltip__body", "zen-tooltip__body--auto", isDrive ? "zen-tooltip__body--drive" : "", isMobile ? "zen-tooltip__body--mobile" : "", deviceType === deviceType_1.DeviceType.Desktop && !isDrive ? "zen-tooltip__body--desktop" : ""]),
|
|
366
|
+
children: [(mobileSheetTitle || mobileTitle) && (deviceType === deviceType_1.DeviceType.Mobile || isDrive) && (0, jsx_runtime_1.jsx)("div", {
|
|
367
|
+
className: "zen-tooltip__title",
|
|
368
|
+
children: mobileSheetTitle || mobileTitle
|
|
369
|
+
}), children]
|
|
370
|
+
}), (deviceType === deviceType_1.DeviceType.Mobile || isDrive) && (0, jsx_runtime_1.jsx)(button_1.Button, {
|
|
371
|
+
className: "zen-tooltip__close-button",
|
|
372
|
+
title: translate("Close"),
|
|
373
|
+
"aria-label": translate("Close"),
|
|
374
|
+
onClick: () => {
|
|
375
|
+
var _a;
|
|
153
376
|
setTooltipVisible(false);
|
|
377
|
+
(_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
378
|
+
},
|
|
379
|
+
children: (0, jsx_runtime_1.jsx)(iconClose_1.IconClose, {
|
|
380
|
+
description: translate("Close"),
|
|
381
|
+
className: "svgIcon",
|
|
382
|
+
size: "huge"
|
|
383
|
+
})
|
|
384
|
+
})]
|
|
385
|
+
})]
|
|
386
|
+
});
|
|
387
|
+
return (0, react_dom_1.createPortal)(content, document.fullscreenElement || document.body, tooltipId);
|
|
388
|
+
};
|
|
389
|
+
const calculatePosition = (0, react_1.useCallback)(() => {
|
|
390
|
+
const eAlignment = getEffectiveAlignment(tooltipAlignmentRef.current);
|
|
391
|
+
(0, calculatePosition_1.calculatePosition)(triggerRef, tooltipRef, TOOLTIP_ARROW_HEIGHT + GAP, TOOLTIP_ARROW_HEIGHT + GAP, false, eAlignment, tooltipAlignments_1.tooltipAlignments, undefined, isMobile);
|
|
392
|
+
(0, calculateArrowPosition_1.calculateArrowPosition)(triggerRef, tooltipRef, arrowRef, eAlignment);
|
|
393
|
+
// Update arrow class directly in DOM to avoid triggering re-renders
|
|
394
|
+
if (arrowRef.current) {
|
|
395
|
+
const newArrowClass = arrowClasses[eAlignment];
|
|
396
|
+
arrowRef.current.className = arrowRef.current.className.replace(/zen-tooltip__arrow--\S+/g, "").trim();
|
|
397
|
+
if (newArrowClass) {
|
|
398
|
+
arrowRef.current.classList.add(newArrowClass.replace("zen-tooltip__arrow ", ""));
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}, [TOOLTIP_ARROW_HEIGHT, triggerRef, tooltipRef, arrowRef, getEffectiveAlignment, isMobile]);
|
|
402
|
+
(0, useResize_1.useResize)(calculatePosition, isTooltipVisible);
|
|
403
|
+
(0, react_1.useLayoutEffect)(calculatePosition, [isTooltipVisible, calculatePosition]);
|
|
404
|
+
(0, react_1.useEffect)(() => {
|
|
405
|
+
const finalClickHandler = event => {
|
|
406
|
+
var _a, _b;
|
|
407
|
+
if (!isTooltipVisible) {
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
if (deviceType === deviceType_1.DeviceType.Mobile) {
|
|
411
|
+
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))) {
|
|
412
|
+
setTooltipVisible(false);
|
|
154
413
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
(
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
(
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
const escapeHandler = e => {
|
|
417
|
+
if (!isTooltipVisible) {
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
if (e.code === "Escape") {
|
|
421
|
+
setTooltipVisible(false);
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
document.addEventListener("click", finalClickHandler);
|
|
425
|
+
document.addEventListener("keydown", escapeHandler);
|
|
426
|
+
return () => {
|
|
427
|
+
document.removeEventListener("click", finalClickHandler);
|
|
428
|
+
document.removeEventListener("keydown", escapeHandler);
|
|
429
|
+
};
|
|
430
|
+
}, [isTooltipVisible, deviceType, triggerRef, tooltipRef]);
|
|
431
|
+
// Cleanup timers and event listeners on unmount to prevent memory leaks and test issues
|
|
432
|
+
(0, react_1.useEffect)(() => () => {
|
|
433
|
+
if (timerRef.current) {
|
|
434
|
+
clearTimeout(timerRef.current);
|
|
435
|
+
}
|
|
436
|
+
if (timerMouseOutRef.current) {
|
|
437
|
+
clearTimeout(timerMouseOutRef.current);
|
|
438
|
+
}
|
|
439
|
+
}, []);
|
|
440
|
+
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, {
|
|
441
|
+
children: [isTooltipVisible && renderTooltip(), triggerClone]
|
|
442
|
+
});
|
|
180
443
|
};
|
|
181
|
-
exports.Tooltip = Tooltip;
|
|
444
|
+
exports.Tooltip = Tooltip;
|