@geotab/zenith 3.9.0-beta.ssr.1 → 3.9.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 +29 -8
- package/dist/card/card.d.ts +1 -1
- package/dist/card/card.js +1 -1
- package/dist/{title → card/components}/title.d.ts +1 -1
- package/dist/card/components/title.js +26 -0
- package/dist/card/helpers/getIconTypeFromStatus.d.ts +1 -1
- package/dist/chart/pieChart/centerTextPlugin.js +12 -6
- package/dist/chart/pieChart.js +20 -4
- package/dist/commonHelpers/hooks/useDeviceType.js +2 -1
- package/dist/commonHelpers/hooks/useIsomorphicLayoutEffect.d.ts +2 -0
- package/dist/commonHelpers/hooks/useIsomorphicLayoutEffect.js +6 -0
- package/dist/commonHelpers/isDomEnv.js +1 -2
- package/dist/commonHelpers/useUniqueId.js +2 -2
- package/dist/commonHelpers/utils.d.ts +0 -9
- package/dist/commonHelpers/utils.js +1 -11
- package/dist/commonStyles/common.less +2 -0
- package/dist/commonStyles/fonts/notosarabic/LICENSE.txt +93 -0
- package/dist/commonStyles/fonts/notosarabic/NotoSansArabic-Bold.woff +0 -0
- package/dist/commonStyles/fonts/notosarabic/NotoSansArabic-Bold.woff2 +0 -0
- package/dist/commonStyles/fonts/notosarabic/NotoSansArabic-Medium.woff +0 -0
- package/dist/commonStyles/fonts/notosarabic/NotoSansArabic-Medium.woff2 +0 -0
- package/dist/commonStyles/fonts/notosarabic/NotoSansArabic-Regular.woff +0 -0
- package/dist/commonStyles/fonts/notosarabic/NotoSansArabic-Regular.woff2 +0 -0
- package/dist/commonStyles/fonts/notosarabic/NotoSansArabic-SemiBold.woff +0 -0
- package/dist/commonStyles/fonts/notosarabic/NotoSansArabic-SemiBold.woff2 +0 -0
- package/dist/commonStyles/fonts/notosarabic.less +43 -0
- package/dist/commonStyles/pillStyles/pillContent.less +3 -2
- package/dist/commonStyles/pillStyles/pillStyles.less +2 -1
- package/dist/commonStyles/pillStyles/pillTextContent.less +2 -2
- package/dist/commonStyles/typography/typography.less +310 -435
- package/dist/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +3 -5
- package/dist/dataGrid/withSelectableRows/components/bulkActions/bulkActions.js +38 -2
- package/dist/dateInputInner/dateInputInnerControlBlock.js +5 -2
- package/dist/dateRangeRaw/dateRangeRaw.js +5 -1
- package/dist/filtersBar/filtersBarActions/filtersBarActions.js +3 -1
- package/dist/header/components/collapsedItemsControl/utils/handleCustomMenuWrapper.js +1 -1
- package/dist/index.css +3510 -1914
- package/dist/index.d.ts +5 -5
- package/dist/index.js +24 -26
- package/dist/menu/components/menuItem.js +4 -4
- package/dist/menu/controlledMenu.js +4 -4
- package/dist/nav/nav.js +10 -5
- package/dist/selectRaw/selectRaw.js +1 -1
- package/dist/shield/shield.js +5 -3
- package/dist/table/children/useTableChildren.d.ts +1 -1
- package/dist/table/children/useTableChildren.js +3 -3
- package/dist/table/selectable/useSelectableRows.d.ts +0 -8
- package/dist/table/selectable/useSelectableRows.js +7 -14
- package/dist/table/table.js +7 -1
- package/dist/tooltip/tooltip.d.ts +2 -1
- package/dist/tooltip/tooltip.js +51 -55
- package/dist/utils/localization/languageProvider.js +5 -2
- package/dist/utils/localization/translations/ar.json +0 -1
- package/dist/utils/localization/translations/cs.json +0 -1
- package/dist/utils/localization/translations/da-DK.json +0 -1
- package/dist/utils/localization/translations/de.json +0 -1
- package/dist/utils/localization/translations/en.json +3 -1
- package/dist/utils/localization/translations/es.json +0 -1
- package/dist/utils/localization/translations/fi-FI.json +0 -1
- package/dist/utils/localization/translations/fr-FR.json +0 -1
- package/dist/utils/localization/translations/fr.json +0 -1
- package/dist/utils/localization/translations/hu-HU.json +0 -1
- package/dist/utils/localization/translations/id.json +0 -1
- package/dist/utils/localization/translations/it.json +0 -1
- package/dist/utils/localization/translations/ja.json +0 -1
- package/dist/utils/localization/translations/ko-KR.json +0 -1
- package/dist/utils/localization/translations/ms.json +0 -1
- package/dist/utils/localization/translations/nb-NO.json +0 -1
- package/dist/utils/localization/translations/nl.json +0 -1
- package/dist/utils/localization/translations/pl.json +0 -1
- package/dist/utils/localization/translations/pt-BR.json +0 -1
- package/dist/utils/localization/translations/pt-PT.json +0 -1
- package/dist/utils/localization/translations/ro-RO.json +0 -1
- package/dist/utils/localization/translations/sk-SK.json +0 -1
- package/dist/utils/localization/translations/sv.json +0 -1
- package/dist/utils/localization/translations/th.json +0 -1
- package/dist/utils/localization/translations/tr.json +0 -1
- package/dist/utils/localization/translations/zh-Hans.json +0 -1
- package/dist/utils/localization/translations/zh-TW.json +0 -1
- package/esm/card/card.d.ts +1 -1
- package/esm/card/card.js +1 -1
- package/esm/{title → card/components}/title.d.ts +1 -1
- package/esm/card/components/title.js +22 -0
- package/esm/card/helpers/getIconTypeFromStatus.d.ts +1 -1
- package/esm/chart/pieChart/centerTextPlugin.js +12 -6
- package/esm/chart/pieChart.js +21 -5
- package/esm/commonHelpers/hooks/useDeviceType.js +3 -2
- package/esm/commonHelpers/hooks/useIsomorphicLayoutEffect.d.ts +2 -0
- package/esm/commonHelpers/hooks/useIsomorphicLayoutEffect.js +3 -0
- package/esm/commonHelpers/isDomEnv.js +1 -2
- package/esm/commonHelpers/useUniqueId.js +1 -1
- package/esm/commonHelpers/utils.d.ts +0 -9
- package/esm/commonHelpers/utils.js +0 -9
- package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +3 -5
- package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.js +38 -2
- package/esm/dateInputInner/dateInputInnerControlBlock.js +5 -2
- package/esm/dateRangeRaw/dateRangeRaw.js +5 -1
- package/esm/filtersBar/filtersBarActions/filtersBarActions.js +3 -1
- package/esm/header/components/collapsedItemsControl/utils/handleCustomMenuWrapper.js +1 -1
- package/esm/index.d.ts +5 -5
- package/esm/index.js +5 -5
- package/esm/menu/components/menuItem.js +1 -1
- package/esm/menu/controlledMenu.js +1 -1
- package/esm/nav/nav.js +10 -5
- package/esm/selectRaw/selectRaw.js +1 -1
- package/esm/shield/shield.js +5 -3
- package/esm/table/children/useTableChildren.d.ts +1 -1
- package/esm/table/children/useTableChildren.js +3 -3
- package/esm/table/selectable/useSelectableRows.d.ts +0 -8
- package/esm/table/selectable/useSelectableRows.js +7 -14
- package/esm/table/table.js +7 -1
- package/esm/tooltip/tooltip.d.ts +2 -1
- package/esm/tooltip/tooltip.js +51 -55
- package/esm/utils/localization/languageProvider.js +5 -2
- package/esm/utils/localization/translations/ar.json +0 -1
- package/esm/utils/localization/translations/cs.json +0 -1
- package/esm/utils/localization/translations/da-DK.json +0 -1
- package/esm/utils/localization/translations/de.json +0 -1
- package/esm/utils/localization/translations/en.json +3 -1
- package/esm/utils/localization/translations/es.json +0 -1
- package/esm/utils/localization/translations/fi-FI.json +0 -1
- package/esm/utils/localization/translations/fr-FR.json +0 -1
- package/esm/utils/localization/translations/fr.json +0 -1
- package/esm/utils/localization/translations/hu-HU.json +0 -1
- package/esm/utils/localization/translations/id.json +0 -1
- package/esm/utils/localization/translations/it.json +0 -1
- package/esm/utils/localization/translations/ja.json +0 -1
- package/esm/utils/localization/translations/ko-KR.json +0 -1
- package/esm/utils/localization/translations/ms.json +0 -1
- package/esm/utils/localization/translations/nb-NO.json +0 -1
- package/esm/utils/localization/translations/nl.json +0 -1
- package/esm/utils/localization/translations/pl.json +0 -1
- package/esm/utils/localization/translations/pt-BR.json +0 -1
- package/esm/utils/localization/translations/pt-PT.json +0 -1
- package/esm/utils/localization/translations/ro-RO.json +0 -1
- package/esm/utils/localization/translations/sk-SK.json +0 -1
- package/esm/utils/localization/translations/sv.json +0 -1
- package/esm/utils/localization/translations/th.json +0 -1
- package/esm/utils/localization/translations/tr.json +0 -1
- package/esm/utils/localization/translations/zh-Hans.json +0 -1
- package/esm/utils/localization/translations/zh-TW.json +0 -1
- package/package.json +38 -35
- package/dist/title/title.js +0 -27
- package/esm/title/title.js +0 -23
package/dist/tooltip/tooltip.js
CHANGED
|
@@ -96,7 +96,7 @@ injectString("ar-SA", "Close", "\u0625\u063A\u0644\u0627\u0642");
|
|
|
96
96
|
const react_1 = __importStar(require("react"));
|
|
97
97
|
const useResize_1 = require("../commonHelpers/hooks/useResize");
|
|
98
98
|
const calculatePosition_1 = require("../utils/positioningUtils/calculatePosition");
|
|
99
|
-
const
|
|
99
|
+
const usePortal_1 = require("../commonHelpers/hooks/usePortal");
|
|
100
100
|
const classNames_1 = require("../commonHelpers/classNames/classNames");
|
|
101
101
|
const calculateArrowPosition_1 = require("./helpers/calculateArrowPosition");
|
|
102
102
|
const deviceType_1 = require("../commonHelpers/hooks/deviceType");
|
|
@@ -189,12 +189,15 @@ const EventWrapper = ({
|
|
|
189
189
|
const Tooltip = ({
|
|
190
190
|
trigger,
|
|
191
191
|
triggerClassName,
|
|
192
|
+
triggerAriaLabel,
|
|
192
193
|
className = "",
|
|
193
194
|
alignment,
|
|
194
195
|
children,
|
|
195
196
|
mobileSheetTitle,
|
|
196
197
|
mobileTitle
|
|
198
|
+
// eslint-disable-next-line complexity
|
|
197
199
|
}) => {
|
|
200
|
+
var _a, _b, _c, _d;
|
|
198
201
|
const GAP = 12;
|
|
199
202
|
const isDrive = (0, useDrive_1.useDrive)();
|
|
200
203
|
const triggerRefNative = trigger ? trigger.props.ref : undefined;
|
|
@@ -258,12 +261,12 @@ const Tooltip = ({
|
|
|
258
261
|
tabIndex: 0,
|
|
259
262
|
type: "button",
|
|
260
263
|
className: "zen-tooltip__trigger-container",
|
|
261
|
-
"aria-label": translate("Information"),
|
|
264
|
+
"aria-label": triggerAriaLabel !== null && triggerAriaLabel !== void 0 ? triggerAriaLabel : translate("Information"),
|
|
262
265
|
children: (0, react_1.createElement)(iconInfoCircle_1.IconInfoCircle, {
|
|
263
266
|
size: isMobile ? "huge" : "large",
|
|
264
267
|
className: (0, classNames_1.classNames)([triggerClassName || "", "zen-tooltip__trigger"])
|
|
265
268
|
})
|
|
266
|
-
}), [trigger, isMobile, triggerClassName, translate]);
|
|
269
|
+
}), [trigger, isMobile, triggerClassName, triggerAriaLabel, translate]);
|
|
267
270
|
const triggerClone = (0, jsx_runtime_1.jsx)(EventWrapper, {
|
|
268
271
|
deviceType: deviceType,
|
|
269
272
|
isTooltipVisible: isTooltipVisible,
|
|
@@ -355,61 +358,54 @@ const Tooltip = ({
|
|
|
355
358
|
}
|
|
356
359
|
return preferredAlignment;
|
|
357
360
|
}, [isMobile, TOOLTIP_ARROW_HEIGHT, triggerRef, checkNaturalFit]);
|
|
358
|
-
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
361
|
+
const container = (_d = (_b = (_a = zen_1.zen.document) === null || _a === void 0 ? void 0 : _a.fullscreenElement) !== null && _b !== void 0 ? _b : (_c = zen_1.zen.document) === null || _c === void 0 ? void 0 : _c.body) !== null && _d !== void 0 ? _d : undefined;
|
|
362
|
+
const portal = (0, usePortal_1.usePortal)(isTooltipVisible ? (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, {
|
|
363
|
+
children: [isMobile && (0, jsx_runtime_1.jsx)(shield_1.Shield, {
|
|
364
|
+
className: "zen-tooltip__shield"
|
|
365
|
+
}), (0, jsx_runtime_1.jsxs)("div", {
|
|
366
|
+
id: tooltipId,
|
|
367
|
+
role: "tooltip",
|
|
368
|
+
ref: tooltipRef,
|
|
369
|
+
className: (0, classNames_1.classNames)(["zen-tooltip", dark ? "zen-dark" : "", `zen-tooltip--auto`, isMobile ? "zen-tooltip--mobile" : "", isDrive ? "zen-tooltip--drive" : "", className]),
|
|
370
|
+
onMouseEnter: () => {
|
|
371
|
+
var _a, _b;
|
|
372
|
+
timerRef.current && ((_a = zen_1.zen.clearTimeout) === null || _a === void 0 ? void 0 : _a.call(zen_1.zen, timerRef.current));
|
|
373
|
+
timerMouseLeaveRef.current && ((_b = zen_1.zen.clearTimeout) === null || _b === void 0 ? void 0 : _b.call(zen_1.zen, timerMouseLeaveRef.current));
|
|
374
|
+
},
|
|
375
|
+
onMouseLeave: () => {
|
|
376
|
+
var _a;
|
|
377
|
+
timerMouseLeaveRef.current = (_a = zen_1.zen.setTimeout) === null || _a === void 0 ? void 0 : _a.call(zen_1.zen, () => {
|
|
378
|
+
if (!isMobile && !isDrive) {
|
|
379
|
+
setTooltipVisible(false);
|
|
380
|
+
}
|
|
381
|
+
}, TOOLTIP_VISIBILITY_DELAY);
|
|
382
|
+
},
|
|
383
|
+
children: [!isMobile && !isDrive && (0, jsx_runtime_1.jsx)("div", {
|
|
384
|
+
className: (0, classNames_1.classNames)(["zen-tooltip__arrow", arrowClass]),
|
|
385
|
+
ref: arrowRef
|
|
367
386
|
}), (0, jsx_runtime_1.jsxs)("div", {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
387
|
+
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" : ""]),
|
|
388
|
+
children: [(mobileSheetTitle || mobileTitle) && (deviceType === deviceType_1.DeviceType.Mobile || isDrive) && (0, jsx_runtime_1.jsx)("div", {
|
|
389
|
+
className: "zen-tooltip__title",
|
|
390
|
+
children: mobileSheetTitle || mobileTitle
|
|
391
|
+
}), children]
|
|
392
|
+
}), (deviceType === deviceType_1.DeviceType.Mobile || isDrive) && (0, jsx_runtime_1.jsx)(button_1.Button, {
|
|
393
|
+
className: "zen-tooltip__close-button",
|
|
394
|
+
title: translate("Close"),
|
|
395
|
+
"aria-label": translate("Close"),
|
|
396
|
+
onClick: () => {
|
|
378
397
|
var _a;
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
setTooltipVisible(false);
|
|
382
|
-
}
|
|
383
|
-
}, TOOLTIP_VISIBILITY_DELAY);
|
|
398
|
+
setTooltipVisible(false);
|
|
399
|
+
(_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
384
400
|
},
|
|
385
|
-
children:
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
children: [(mobileSheetTitle || mobileTitle) && (deviceType === deviceType_1.DeviceType.Mobile || isDrive) && (0, jsx_runtime_1.jsx)("div", {
|
|
391
|
-
className: "zen-tooltip__title",
|
|
392
|
-
children: mobileSheetTitle || mobileTitle
|
|
393
|
-
}), children]
|
|
394
|
-
}), (deviceType === deviceType_1.DeviceType.Mobile || isDrive) && (0, jsx_runtime_1.jsx)(button_1.Button, {
|
|
395
|
-
className: "zen-tooltip__close-button",
|
|
396
|
-
title: translate("Close"),
|
|
397
|
-
"aria-label": translate("Close"),
|
|
398
|
-
onClick: () => {
|
|
399
|
-
var _a;
|
|
400
|
-
setTooltipVisible(false);
|
|
401
|
-
(_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
402
|
-
},
|
|
403
|
-
children: (0, jsx_runtime_1.jsx)(iconClose_1.IconClose, {
|
|
404
|
-
description: translate("Close"),
|
|
405
|
-
className: "svgIcon",
|
|
406
|
-
size: "huge"
|
|
407
|
-
})
|
|
408
|
-
})]
|
|
401
|
+
children: (0, jsx_runtime_1.jsx)(iconClose_1.IconClose, {
|
|
402
|
+
description: translate("Close"),
|
|
403
|
+
className: "svgIcon",
|
|
404
|
+
size: "huge"
|
|
405
|
+
})
|
|
409
406
|
})]
|
|
410
|
-
})
|
|
411
|
-
|
|
412
|
-
};
|
|
407
|
+
})]
|
|
408
|
+
}) : null, container, tooltipId);
|
|
413
409
|
const calculatePosition = (0, react_1.useCallback)(() => {
|
|
414
410
|
const eAlignment = getEffectiveAlignment(tooltipAlignmentRef.current);
|
|
415
411
|
(0, calculatePosition_1.calculatePosition)(triggerRef, tooltipRef, TOOLTIP_ARROW_HEIGHT + GAP, TOOLTIP_ARROW_HEIGHT + GAP, false, eAlignment, tooltipAlignments_1.tooltipAlignments, undefined, isMobile);
|
|
@@ -465,7 +461,7 @@ const Tooltip = ({
|
|
|
465
461
|
}
|
|
466
462
|
}, []);
|
|
467
463
|
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, {
|
|
468
|
-
children: [
|
|
464
|
+
children: [portal, triggerClone]
|
|
469
465
|
});
|
|
470
466
|
};
|
|
471
467
|
exports.Tooltip = Tooltip;
|
|
@@ -12,8 +12,11 @@ const LanguageProvider = ({ language, children }) => {
|
|
|
12
12
|
const validLanguage = (0, getSupportedLanguage_1.getSupportedLanguage)(language);
|
|
13
13
|
const direction = (0, getTextDirection_1.getTextDirection)(validLanguage);
|
|
14
14
|
(0, react_1.useEffect)(() => {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
if (zen_1.zen.document) {
|
|
16
|
+
zen_1.zen.document.documentElement.dir = direction;
|
|
17
|
+
zen_1.zen.document.documentElement.lang = validLanguage;
|
|
18
|
+
}
|
|
19
|
+
}, [direction, validLanguage]);
|
|
17
20
|
return ((0, jsx_runtime_1.jsx)(languageContext_1.languageContext.Provider, { value: validLanguage, children: (0, jsx_runtime_1.jsx)(directionContext_1.directionContext.Provider, { value: direction, children: children }) }));
|
|
18
21
|
};
|
|
19
22
|
exports.LanguageProvider = LanguageProvider;
|
|
@@ -203,7 +203,6 @@
|
|
|
203
203
|
"This feature is still in testing, and is not fully supported yet. Your feedback is valuable to help guide future enhancements.": "هذه الميزة لا تزال قيد الاختبار وغير مدعومة بالكامل بعد. ملاحظاتك قيمة للمساعدة في توجيه التحسينات المستقبلية.",
|
|
204
204
|
"Send feedback": "إرسال ملاحظات",
|
|
205
205
|
"Manage beta option": "إدارة الخيار التجريبي",
|
|
206
|
-
"Ma": "مايو",
|
|
207
206
|
"Y-axis": "المحور ص",
|
|
208
207
|
"X-axis": "المحور س",
|
|
209
208
|
"Previous": "السابق",
|
|
@@ -201,7 +201,6 @@
|
|
|
201
201
|
"This feature is still in testing, and is not fully supported yet. Your feedback is valuable to help guide future enhancements.": "Funktionen er stadig under test og virker ikke helt endnu. Din feedback er guld værd og hjælper os med fremtidige forbedringer.",
|
|
202
202
|
"Send feedback": "Send feedback",
|
|
203
203
|
"Manage beta option": "Styr beta-indstillingen",
|
|
204
|
-
"Ma": "Maj",
|
|
205
204
|
"Y-axis": "Y-akse",
|
|
206
205
|
"X-axis": "X-akse",
|
|
207
206
|
"Previous": "Forrige",
|
|
@@ -203,11 +203,12 @@
|
|
|
203
203
|
"This feature is still in testing, and is not fully supported yet. Your feedback is valuable to help guide future enhancements.": "This feature is still in testing, and is not fully supported yet. Your feedback is valuable to help guide future enhancements.",
|
|
204
204
|
"Send feedback": "Send feedback",
|
|
205
205
|
"Manage beta option": "Manage beta option",
|
|
206
|
-
"Ma": "May",
|
|
207
206
|
"Y-axis": "Y-axis",
|
|
208
207
|
"X-axis": "X-axis",
|
|
209
208
|
"Previous": "Previous",
|
|
210
209
|
"Next": "Next",
|
|
210
|
+
"Previous date period": "Previous date period",
|
|
211
|
+
"Next date period": "Next date period",
|
|
211
212
|
"Choose dates": "Choose dates",
|
|
212
213
|
"Date range not available": "Date range not available",
|
|
213
214
|
"Choose your date range": "Choose your date range",
|
|
@@ -217,6 +218,7 @@
|
|
|
217
218
|
"Favorite": "Favorite",
|
|
218
219
|
"All Filters": "All Filters",
|
|
219
220
|
"Reset All": "Reset all",
|
|
221
|
+
"Active filters: {}": "Active filters: {}",
|
|
220
222
|
"Loading": "Loading",
|
|
221
223
|
"Select option": "Select option",
|
|
222
224
|
"Value": "Value",
|
|
@@ -201,7 +201,6 @@
|
|
|
201
201
|
"This feature is still in testing, and is not fully supported yet. Your feedback is valuable to help guide future enhancements.": "Tämä ominaisuus on vielä testausvaiheessa eikä ole täysin tuettu. Palautteesi on tärkeää, sillä sen avulla voimme kehittää asioita entistä paremmin.",
|
|
202
202
|
"Send feedback": "Lähetä palautetta",
|
|
203
203
|
"Manage beta option": "Hallitse beta-vaihtoehtoa",
|
|
204
|
-
"Ma": "Tou.",
|
|
205
204
|
"Y-axis": "Y-akseli",
|
|
206
205
|
"X-axis": "X-akseli",
|
|
207
206
|
"Previous": "Edellinen",
|
|
@@ -201,7 +201,6 @@
|
|
|
201
201
|
"This feature is still in testing, and is not fully supported yet. Your feedback is valuable to help guide future enhancements.": "Ez a funkció még tesztelés alatt áll, és még nem támogatott teljes mértékben. A visszajelzésed értékes, segít a jövőbeli fejlesztésekben.",
|
|
202
202
|
"Send feedback": "Küldj visszajelzést.",
|
|
203
203
|
"Manage beta option": "Béta-opció kezelése",
|
|
204
|
-
"Ma": "Május",
|
|
205
204
|
"Y-axis": "Y tengely",
|
|
206
205
|
"X-axis": "X tengely",
|
|
207
206
|
"Previous": "Előző",
|
|
@@ -201,7 +201,6 @@
|
|
|
201
201
|
"This feature is still in testing, and is not fully supported yet. Your feedback is valuable to help guide future enhancements.": "이 기능은 여전히 테스트 중이며 아직 완전히 지원되지 않습니다. 귀하의 피드백은 향후 개선 방향을 제시하는 데 매우 중요합니다.",
|
|
202
202
|
"Send feedback": "피드백 보내기",
|
|
203
203
|
"Manage beta option": "베타 옵션 관리",
|
|
204
|
-
"Ma": "5월",
|
|
205
204
|
"Y-axis": "Y축",
|
|
206
205
|
"X-axis": "X축",
|
|
207
206
|
"Open": "열려 있는",
|
|
@@ -201,7 +201,6 @@
|
|
|
201
201
|
"This feature is still in testing, and is not fully supported yet. Your feedback is valuable to help guide future enhancements.": "Denne funksjonen er fortsatt under testing, og støttes ikke fullt ut ennå. Tilbakemeldingen din er viktig for at vi skal kunne forbedre tjenesten.",
|
|
202
202
|
"Send feedback": "Send tilbakemelding",
|
|
203
203
|
"Manage beta option": "Administrer beta-alternativ",
|
|
204
|
-
"Ma": "Mai",
|
|
205
204
|
"Y-axis": "Y-akse",
|
|
206
205
|
"X-axis": "X-akse",
|
|
207
206
|
"Previous": "Tidligere",
|
|
@@ -203,7 +203,6 @@
|
|
|
203
203
|
"This feature is still in testing, and is not fully supported yet. Your feedback is valuable to help guide future enhancements.": "Esta funcionalidade ainda está em testes e ainda não é totalmente suportada. O seu feedback é valioso para ajudar a orientar melhorias futuras.",
|
|
204
204
|
"Send feedback": "Enviar feedback",
|
|
205
205
|
"Manage beta option": "Gerenciar opção beta",
|
|
206
|
-
"Ma": "Mai",
|
|
207
206
|
"Y-axis": "Eixo Y",
|
|
208
207
|
"X-axis": "Eixo X",
|
|
209
208
|
"Previous": "Anterior",
|
|
@@ -203,7 +203,6 @@
|
|
|
203
203
|
"This feature is still in testing, and is not fully supported yet. Your feedback is valuable to help guide future enhancements.": "Această funcție este în testare și încă nu este complet compatibilă. Feedbackul dvs. este important și ne va ajuta la îmbunătățirile viitoare.",
|
|
204
204
|
"Send feedback": "Trimiteți feedback",
|
|
205
205
|
"Manage beta option": "Administrați opțiunea beta",
|
|
206
|
-
"Ma": "Ma",
|
|
207
206
|
"Y-axis": "Axa Y",
|
|
208
207
|
"X-axis": "Axa X",
|
|
209
208
|
"Previous": "Înapoi",
|
|
@@ -215,7 +215,6 @@
|
|
|
215
215
|
"This feature is still in testing, and is not fully supported yet. Your feedback is valuable to help guide future enhancements.": "此功能仍在測試階段,尚未完全支援。您的意見回饋對我們來說非常重要,能協助我們確認未來改進的方向。",
|
|
216
216
|
"Send feedback": "傳送意見回饋",
|
|
217
217
|
"Manage beta option": "管理測試版選項",
|
|
218
|
-
"Ma": "五月",
|
|
219
218
|
"Next": "下一步",
|
|
220
219
|
"Previous": "上一個",
|
|
221
220
|
"Open": "開啟",
|
package/esm/card/card.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { FC, FunctionComponent, ReactNode } from "react";
|
|
2
2
|
import { IAbsoluteSize, TContainerSize } from "../cardContainer/cardContainer";
|
|
3
3
|
import { TCardStatus } from "./components/status";
|
|
4
|
-
import { TIconType } from "
|
|
4
|
+
import { TIconType } from "./components/title";
|
|
5
5
|
import { IActions } from "./components/actions";
|
|
6
6
|
import { IContent } from "./components/content";
|
|
7
7
|
import "./card.less";
|
package/esm/card/card.js
CHANGED
|
@@ -5,7 +5,7 @@ import { CardContainer } from "../cardContainer/cardContainer";
|
|
|
5
5
|
import { DeviceType } from "../commonHelpers/hooks/deviceType";
|
|
6
6
|
import { useDeviceType } from "../commonHelpers/hooks/useDeviceType";
|
|
7
7
|
import { Status } from "./components/status";
|
|
8
|
-
import { Title } from "
|
|
8
|
+
import { Title } from "./components/title";
|
|
9
9
|
import { Actions } from "./components/actions";
|
|
10
10
|
import { Content } from "./components/content";
|
|
11
11
|
import { useCardSize } from "./hooks/useCardSize";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FunctionComponent } from "react";
|
|
2
2
|
import "./title.less";
|
|
3
|
-
import { IIcon } from "
|
|
3
|
+
import { IIcon } from "../../icons/icon";
|
|
4
4
|
export type TIconType = "info" | "warning" | "error" | "success" | "default";
|
|
5
5
|
interface ITitle {
|
|
6
6
|
isMobile: boolean;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createElement, useMemo } from "react";
|
|
3
|
+
import { classNames } from "../../commonHelpers/classNames/classNames";
|
|
4
|
+
import { useDriveClassName } from "../../utils/theme/useDriveClassName";
|
|
5
|
+
import { useDrive } from "../../utils/theme/useDrive";
|
|
6
|
+
import { IconChevronRightSmall } from "../../icons/iconChevronRightSmall";
|
|
7
|
+
export const Title = ({ isMobile, link, target, title, id, icon, iconType, className = "", onClick }) => {
|
|
8
|
+
const driveClassNames = useDriveClassName("zen-card-title");
|
|
9
|
+
const isDrive = useDrive();
|
|
10
|
+
const iconClassName = iconType ? `zen-card-title__icon--${iconType}` : "";
|
|
11
|
+
const iconSize = useMemo(() => (isDrive ? "huge" : "large"), [isDrive]);
|
|
12
|
+
const iconElement = useMemo(() => (icon ? _jsx("div", { className: classNames(["zen-card-title__icon", iconClassName]), children: createElement(icon, { size: iconSize }) }) : null), [icon, iconSize, iconClassName]);
|
|
13
|
+
const chevron = useMemo(() => (_jsx("span", { className: "zen-card-title__link-chevron", children: _jsx(IconChevronRightSmall, { size: iconSize, className: "zen-card-title__chevron-icon" }) })), [iconSize]);
|
|
14
|
+
const titleClasses = classNames(["zen-card-title", driveClassNames || "", onClick ? "zen-card-title__clickable" : ""]);
|
|
15
|
+
if (onClick) {
|
|
16
|
+
return (_jsxs("button", { type: "button", className: titleClasses, onClick: onClick, children: [iconElement, _jsxs("span", { title: title, id: id, className: classNames(["zen-card-title__text", isMobile && !isDrive ? "zen-card-title__text--mobile" : "", className]), children: [title, chevron] })] }));
|
|
17
|
+
}
|
|
18
|
+
if (link) {
|
|
19
|
+
return (_jsxs("a", { id: id, className: titleClasses, href: link, target: target, children: [iconElement, _jsxs("span", { title: title, className: classNames(["zen-card-title__link-text"]), children: [title, chevron] })] }));
|
|
20
|
+
}
|
|
21
|
+
return (_jsxs("div", { className: titleClasses, children: [iconElement, _jsx("span", { title: title, id: id, className: classNames(["zen-card-title__text", isMobile && !isDrive ? "zen-card-title__text--mobile" : "", className]), children: title })] }));
|
|
22
|
+
};
|
|
@@ -3,7 +3,6 @@ const getCssVar = (el, name) => { var _a, _b; return (_b = (_a = zen.getComputed
|
|
|
3
3
|
export const centerTextPlugin = (centerText) => ({
|
|
4
4
|
id: "zenithPieCenterText",
|
|
5
5
|
afterDraw(chart) {
|
|
6
|
-
var _a;
|
|
7
6
|
if (!centerText || centerText.value === undefined) {
|
|
8
7
|
return;
|
|
9
8
|
}
|
|
@@ -12,18 +11,25 @@ export const centerTextPlugin = (centerText) => ({
|
|
|
12
11
|
const centerX = left + width / 2;
|
|
13
12
|
const centerY = top + height / 2;
|
|
14
13
|
const css = (name) => getCssVar(chart.canvas, name);
|
|
15
|
-
const fontFamily = (
|
|
14
|
+
const fontFamily = css("--main-font");
|
|
16
15
|
const hasLabel = !!centerText.label;
|
|
17
|
-
const
|
|
16
|
+
const meta = chart.getDatasetMeta(0);
|
|
17
|
+
const controllerRadius = meta.controller.innerRadius;
|
|
18
|
+
const innerRadius = typeof controllerRadius === "number" && controllerRadius > 0 ? controllerRadius : Math.min(width, height) * 0.325;
|
|
19
|
+
const maxValueFont = parseFloat(css("--pie-center-value-font-size")) || 28;
|
|
20
|
+
const maxLabelFont = parseFloat(css("--pie-center-label-font-size")) || 14;
|
|
21
|
+
const valueFontSize = Math.max(10, Math.min(maxValueFont, innerRadius * 0.45));
|
|
22
|
+
const labelFontSize = Math.max(8, Math.min(maxLabelFont, innerRadius * 0.22));
|
|
23
|
+
const valueY = hasLabel ? centerY - valueFontSize * 0.5 : centerY;
|
|
18
24
|
ctx.textAlign = "center";
|
|
19
25
|
ctx.textBaseline = "middle";
|
|
20
|
-
ctx.font = `${css("--pie-center-value-font-weight")} ${
|
|
26
|
+
ctx.font = `${css("--pie-center-value-font-weight")} ${valueFontSize}px ${fontFamily}`;
|
|
21
27
|
ctx.fillStyle = css("--text-primary");
|
|
22
28
|
ctx.fillText(String(centerText.value), centerX, valueY);
|
|
23
29
|
if (hasLabel) {
|
|
24
|
-
ctx.font = `${css("--pie-center-label-font-weight")} ${
|
|
30
|
+
ctx.font = `${css("--pie-center-label-font-weight")} ${labelFontSize}px ${fontFamily}`;
|
|
25
31
|
ctx.fillStyle = css("--text-secondary");
|
|
26
|
-
ctx.fillText(String(centerText.label), centerX, centerY +
|
|
32
|
+
ctx.fillText(String(centerText.label), centerX, centerY + labelFontSize * 1.1);
|
|
27
33
|
}
|
|
28
34
|
ctx.restore();
|
|
29
35
|
}
|
package/esm/chart/pieChart.js
CHANGED
|
@@ -10,11 +10,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { useContext, useEffect, useId, useMemo } from "react";
|
|
13
|
+
import { useCallback, useContext, useEffect, useId, useMemo, useRef } from "react";
|
|
14
14
|
import { Pie } from "../react-chartjs/typedCharts";
|
|
15
15
|
import { Chart as ChartJS, PieController, ArcElement } from "chart.js/auto";
|
|
16
16
|
import "../react-chartjs/dateAdapter";
|
|
17
17
|
import { deepMerge } from "../commonHelpers/utils";
|
|
18
|
+
import { zen } from "../utils/zen";
|
|
18
19
|
import { useDrive } from "../utils/theme/useDrive";
|
|
19
20
|
import { useMobile } from "../commonHelpers/hooks/useMobile";
|
|
20
21
|
import { themeContext } from "../utils/theme/themeContext";
|
|
@@ -40,16 +41,31 @@ export const PieChart = (_a) => {
|
|
|
40
41
|
const { dark } = useContext(themeContext);
|
|
41
42
|
const legendId = useId();
|
|
42
43
|
const tooltipId = useId();
|
|
44
|
+
const containerRef = useRef(null);
|
|
43
45
|
useEffect(() => {
|
|
46
|
+
var _a;
|
|
47
|
+
const el = containerRef.current;
|
|
48
|
+
const styles = el ? (_a = zen.getComputedStyle) === null || _a === void 0 ? void 0 : _a.call(zen, el) : undefined;
|
|
49
|
+
const fontFamily = (styles === null || styles === void 0 ? void 0 : styles.getPropertyValue("--main-font").trim()) || "Roboto";
|
|
50
|
+
const color = (styles === null || styles === void 0 ? void 0 : styles.getPropertyValue("--text-primary").trim()) || "";
|
|
44
51
|
ChartJS.defaults.font = {
|
|
45
|
-
family:
|
|
52
|
+
family: fontFamily,
|
|
46
53
|
size: fontSize
|
|
47
54
|
};
|
|
48
|
-
ChartJS.defaults.color =
|
|
55
|
+
ChartJS.defaults.color = color;
|
|
49
56
|
}, [fontSize, dark]);
|
|
50
57
|
const defOptions = useMemo(() => getDefaultOptions(), []);
|
|
51
58
|
const chartOptions = deepMerge(defOptions, options);
|
|
52
|
-
const { isHidden, toggleHidden } = useHidden();
|
|
59
|
+
const { isHidden, toggleHidden: rawToggle } = useHidden();
|
|
60
|
+
const pieData = data.datasets[0].data;
|
|
61
|
+
const toggleHidden = useCallback((index) => {
|
|
62
|
+
if (!isHidden(index)) {
|
|
63
|
+
const visibleCount = pieData.filter((_, i) => !isHidden(i)).length;
|
|
64
|
+
if (visibleCount <= 1)
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
rawToggle(index);
|
|
68
|
+
}, [isHidden, rawToggle, pieData]);
|
|
53
69
|
const chartData = useMemo(() => {
|
|
54
70
|
const chData = Object.assign({}, data);
|
|
55
71
|
chData.datasets = chData.datasets.map(ds => getDefaultDatasetStyle(ds));
|
|
@@ -79,5 +95,5 @@ export const PieChart = (_a) => {
|
|
|
79
95
|
const chartPlugins = useMemo(() => [...(plugins || []), chartLegend, chartTooltip, chartCenterText], [chartLegend, chartTooltip, chartCenterText, plugins]);
|
|
80
96
|
const intSummary = useSummary(summary, chartData);
|
|
81
97
|
const legendRight = isHorizontal;
|
|
82
|
-
return (_jsxs("div", { className: classNames(["zen-chart", legendRight ? "zen-chart--legend-right" : "", className || ""]), children: [insight ? _jsx(ChartInsight, Object.assign({}, insight)) : null, summary ? _jsx(Summary, Object.assign({}, intSummary)) : null, _jsx("div", { className: "zen-chart__chart", children: _jsx(Pie, Object.assign({ options: chartOptions, data: chartData, plugins: chartPlugins }, rest, { "aria-hidden": true })) }), _jsx("div", { className: "zen-chart__legend", id: legendId }), _jsx(AccessibleChart, { type: "pie", data: chartData })] }));
|
|
98
|
+
return (_jsxs("div", { ref: containerRef, className: classNames(["zen-chart", legendRight ? "zen-chart--legend-right" : "", className || ""]), children: [insight ? _jsx(ChartInsight, Object.assign({}, insight)) : null, summary ? _jsx(Summary, Object.assign({}, intSummary)) : null, _jsx("div", { className: "zen-chart__chart", children: _jsx(Pie, Object.assign({ options: chartOptions, data: chartData, plugins: chartPlugins }, rest, { "aria-hidden": true })) }), _jsx("div", { className: "zen-chart__legend", id: legendId }), _jsx(AccessibleChart, { type: "pie", data: chartData })] }));
|
|
83
99
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { useContext,
|
|
1
|
+
import { useContext, useMemo, useState } from "react";
|
|
2
|
+
import { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect";
|
|
2
3
|
import { useResize } from "./useResize";
|
|
3
4
|
import { DeviceType } from "./deviceType";
|
|
4
5
|
import { topWindowContext } from "../../utils/topWindow/topWindowContext";
|
|
@@ -21,7 +22,7 @@ export const useDeviceType = (callback) => {
|
|
|
21
22
|
useResize(() => {
|
|
22
23
|
setDeviceType(getDeviceType(win.innerWidth));
|
|
23
24
|
}, true);
|
|
24
|
-
|
|
25
|
+
useIsomorphicLayoutEffect(() => {
|
|
25
26
|
callback(deviceType);
|
|
26
27
|
}, [deviceType, callback]);
|
|
27
28
|
};
|