@geotab/zenith 3.8.0 → 3.9.0-beta.no.ssr.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 +11 -12
- package/dist/button/button.d.ts +2 -1
- package/dist/button/button.js +3 -3
- package/dist/calendar/calendar.js +200 -3
- package/dist/card/components/cardButton/cardButton.d.ts +2 -1
- package/dist/card/components/cardButton/cardButton.js +5 -3
- package/dist/card/components/title.js +7 -3
- package/dist/chart/barChart/getBarLegendItems.js +3 -5
- package/dist/chart/lineChart/getLineLegendItems.js +7 -7
- package/dist/chart/pieChart/getPieLegendItems.js +8 -12
- package/dist/chart/plugins/legend/interfaces.d.ts +1 -1
- package/dist/dateInputInner/dateInputInnerControlBlock.js +12 -8
- package/dist/fileUpload/fileUpload.js +21 -12
- package/dist/filtersBar/filtersBarSidePanel/components/filtersBarSidePanelRange/filtersBarSidePanelRange.js +3 -0
- package/dist/formFieldError/formFieldError.d.ts +2 -1
- package/dist/formFieldError/formFieldError.js +2 -2
- package/dist/index.css +5 -0
- package/dist/index.d.ts +0 -2
- package/dist/index.js +16 -20
- package/dist/nav/navEditList/navEditListUtils.d.ts +1 -1
- package/dist/nav/navEditList/navEditListUtils.js +2 -1
- package/dist/nav/navItem/navActionItem.js +3 -3
- package/dist/rangeRaw/rangeRaw.js +7 -1
- package/dist/selectList/selectList.js +11 -7
- package/dist/toggleButtonRaw/toggleButtonRaw.js +3 -1
- package/dist/toggleButtonRaw/types.d.ts +1 -0
- package/dist/tooltip/tooltip.js +11 -11
- package/dist/utils/localization/translations/en-json.d.ts +2 -0
- package/dist/utils/localization/translations/en-json.js +3 -1
- package/esm/button/button.d.ts +2 -1
- package/esm/button/button.js +3 -3
- package/esm/calendar/calendar.js +200 -3
- package/esm/card/components/cardButton/cardButton.d.ts +2 -1
- package/esm/card/components/cardButton/cardButton.js +5 -3
- package/esm/card/components/title.js +8 -4
- package/esm/chart/barChart/getBarLegendItems.js +3 -5
- package/esm/chart/lineChart/getLineLegendItems.js +7 -7
- package/esm/chart/pieChart/getPieLegendItems.js +8 -12
- package/esm/chart/plugins/legend/interfaces.d.ts +1 -1
- package/esm/dateInputInner/dateInputInnerControlBlock.js +13 -9
- package/esm/fileUpload/fileUpload.js +21 -12
- package/esm/filtersBar/filtersBarSidePanel/components/filtersBarSidePanelRange/filtersBarSidePanelRange.js +3 -0
- package/esm/formFieldError/formFieldError.d.ts +2 -1
- package/esm/formFieldError/formFieldError.js +2 -2
- package/esm/index.d.ts +0 -2
- package/esm/index.js +0 -2
- package/esm/nav/navEditList/navEditListUtils.d.ts +1 -1
- package/esm/nav/navEditList/navEditListUtils.js +2 -1
- package/esm/nav/navItem/navActionItem.js +3 -2
- package/esm/rangeRaw/rangeRaw.js +7 -1
- package/esm/selectList/selectList.js +11 -7
- package/esm/toggleButtonRaw/toggleButtonRaw.js +3 -1
- package/esm/toggleButtonRaw/types.d.ts +1 -0
- package/esm/tooltip/tooltip.js +11 -11
- package/esm/utils/localization/translations/en-json.d.ts +2 -0
- package/esm/utils/localization/translations/en-json.js +3 -1
- package/package.json +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { classNames } from "../../commonHelpers/classNames/classNames";
|
|
3
|
-
|
|
3
|
+
const NavActionItemComponent = ({ title, id, icon, className, startNode, endButtonIcon, endButtonTitle, onEndButtonClick, onLeftContentPointerDown }) => {
|
|
4
4
|
const PrimaryIconComponent = typeof icon === "function" ? icon : null;
|
|
5
5
|
const EndButtonIconComponent = typeof endButtonIcon === "function" ? endButtonIcon : null;
|
|
6
6
|
const itemClasses = classNames(["zen-nav-item", className || ""]);
|
|
7
|
-
return (_jsxs("div", { className: itemClasses, id: id, children: [_jsx("div", { className: "zen-nav-item__main", children: _jsxs("div", { className: "zen-nav-item__content-left", children: [startNode ? _jsx("span", { className: "zen-nav-item__icon", children: startNode }) : null, PrimaryIconComponent ? _jsx(PrimaryIconComponent, { size: "huge" }) : null, _jsx("span", { className: "zen-nav-item__title", children: _jsx("span", { className: "zen-nav-item__title-text", children: title }) })] }) }), EndButtonIconComponent && endButtonTitle && onEndButtonClick ? (_jsx("button", { type: "button", className: "zen-nav-item__action", "aria-label": endButtonTitle, title: endButtonTitle, onClick: onEndButtonClick, children: _jsx(EndButtonIconComponent, { size: "huge" }) })) : null] }));
|
|
7
|
+
return (_jsxs("div", { className: itemClasses, id: id, children: [_jsx("div", { className: "zen-nav-item__main", children: _jsxs("div", { className: "zen-nav-item__content-left", onPointerDown: onLeftContentPointerDown, children: [startNode ? _jsx("span", { className: "zen-nav-item__icon", children: startNode }) : null, PrimaryIconComponent ? _jsx(PrimaryIconComponent, { size: "huge" }) : null, _jsx("span", { className: "zen-nav-item__title", children: _jsx("span", { className: "zen-nav-item__title-text", children: title }) })] }) }), EndButtonIconComponent && endButtonTitle && onEndButtonClick ? (_jsx("button", { type: "button", className: "zen-nav-item__action", "aria-label": endButtonTitle, title: endButtonTitle, onClick: onEndButtonClick, children: _jsx(EndButtonIconComponent, { size: "huge" }) })) : null] }));
|
|
8
8
|
};
|
|
9
|
+
export const NavActionItem = NavActionItemComponent;
|
|
9
10
|
NavActionItem.displayName = "NavActionItem";
|
package/esm/rangeRaw/rangeRaw.js
CHANGED
|
@@ -252,6 +252,9 @@ export const RangeRaw = props => {
|
|
|
252
252
|
} else {
|
|
253
253
|
defaultValueInner = defaultValue;
|
|
254
254
|
}
|
|
255
|
+
const generatedId = useId();
|
|
256
|
+
const intId = id || generatedId;
|
|
257
|
+
const rangeErrorId = `${intId}-error`;
|
|
255
258
|
const [isOpen, setIsOpen] = useState(false);
|
|
256
259
|
const [currentValue, setCurrentValue] = useState(value);
|
|
257
260
|
const [errorType, setErrorType] = useState(undefined);
|
|
@@ -400,14 +403,17 @@ export const RangeRaw = props => {
|
|
|
400
403
|
const memoizedContent = useMemo(() => _jsxs("div", {
|
|
401
404
|
className: "zen-range__fields-wrapper",
|
|
402
405
|
children: [_jsxs("div", {
|
|
406
|
+
id: intId,
|
|
403
407
|
ref: setFieldsContainerRef,
|
|
408
|
+
"aria-describedby": errorType !== undefined && directionState === "row" ? rangeErrorId : undefined,
|
|
404
409
|
className: classNames(["zen-range__fields-container", directionState === "row" ? "zen-range__fields-container--row" : "zen-range__fields-container--column"]),
|
|
405
410
|
children: [memoizedMinRangeField, memoizedMaxRangeField]
|
|
406
411
|
}), errorType !== undefined && directionState === "row" ? _jsx(FormFieldError, {
|
|
412
|
+
id: rangeErrorId,
|
|
407
413
|
className: "zen-range__error",
|
|
408
414
|
error: [getErrorString("min", currentValue.min, translate, errorType, min, max) || "", getErrorString("max", currentValue.max, translate, errorType, min, max) || ""]
|
|
409
415
|
}) : null]
|
|
410
|
-
}), [setFieldsContainerRef, directionState, memoizedMinRangeField, memoizedMaxRangeField, errorType, currentValue.min, currentValue.max, translate, min, max]);
|
|
416
|
+
}), [setFieldsContainerRef, directionState, memoizedMinRangeField, memoizedMaxRangeField, errorType, currentValue.min, currentValue.max, translate, min, max, intId, rangeErrorId]);
|
|
411
417
|
const memoizedDesktopView = useMemo(() => _jsx(ControlledPopup, {
|
|
412
418
|
isOpen: isOpen,
|
|
413
419
|
className: classNames(["zen-range-popup zen-shadow-dropdown-default", className ? className : ""]),
|
|
@@ -45,7 +45,7 @@ export const SelectList = (_a) => {
|
|
|
45
45
|
dispatchState({ type: ListAction.Reset, payload: { items, value: new Map(parsedValue), multiselect } });
|
|
46
46
|
}, [innerValue, multiselect, items]);
|
|
47
47
|
useEffect(() => {
|
|
48
|
-
if (!multiselect) {
|
|
48
|
+
if (!multiselect && selectItemOnFocus) {
|
|
49
49
|
dispatchState({ type: ListAction.FocusFirst, payload: { items } });
|
|
50
50
|
}
|
|
51
51
|
dispatchState({ type: ListAction.Focus, payload: { items, multiselect } });
|
|
@@ -56,14 +56,18 @@ export const SelectList = (_a) => {
|
|
|
56
56
|
const onChangeItem = useCallback((updatedId, updatedState) => {
|
|
57
57
|
dispatchState({ type: ListAction.ChangeItemState, payload: { updatedId, updatedState, multiselect } });
|
|
58
58
|
}, [multiselect]);
|
|
59
|
+
const hasScrolledToInitial = useRef(false);
|
|
59
60
|
useEffect(() => {
|
|
60
61
|
var _a;
|
|
61
|
-
if (state.activeIndex >= 0 &&
|
|
62
|
-
((_a = zen.document) === null || _a === void 0 ? void 0 : _a.activeElement) &&
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
if (state.activeIndex >= 0 && listRef.current) {
|
|
63
|
+
const isFocusInList = ((_a = zen.document) === null || _a === void 0 ? void 0 : _a.activeElement) && isChildOf(zen.document.activeElement, listRef.current);
|
|
64
|
+
if (isFocusInList || !hasScrolledToInitial.current) {
|
|
65
|
+
const itemEl = listRef.current.querySelector(`.zen-select-list__item:nth-child(${state.activeIndex + 1})`);
|
|
66
|
+
itemEl === null || itemEl === void 0 ? void 0 : itemEl.scrollIntoView({ block: "nearest" });
|
|
67
|
+
if (itemEl) {
|
|
68
|
+
hasScrolledToInitial.current = true;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
67
71
|
}
|
|
68
72
|
}, [state.activeIndex]);
|
|
69
73
|
useEffect(() => {
|
|
@@ -71,7 +71,8 @@ export const ToggleButtonRaw = props => {
|
|
|
71
71
|
children,
|
|
72
72
|
isReverted,
|
|
73
73
|
isReadOnly,
|
|
74
|
-
value: valueProp
|
|
74
|
+
value: valueProp,
|
|
75
|
+
dataAnalyticsId
|
|
75
76
|
} = props;
|
|
76
77
|
const driveClassesToggler = useDriveClassName("zen-toggler");
|
|
77
78
|
const driveClassesComponent = useDriveClassName("zen-toggler-component");
|
|
@@ -101,6 +102,7 @@ export const ToggleButtonRaw = props => {
|
|
|
101
102
|
}
|
|
102
103
|
return _jsxs("div", {
|
|
103
104
|
className: classNames(["zen-toggler", driveClassesToggler || "", className || ""]),
|
|
105
|
+
"data-analytics-id": dataAnalyticsId,
|
|
104
106
|
children: [_jsx(TriStateCheckbox, {
|
|
105
107
|
name: name,
|
|
106
108
|
className: "zen-toggler__input",
|
|
@@ -6,6 +6,7 @@ interface IToggleButtonBaseRaw extends IZenComponentProps {
|
|
|
6
6
|
title?: string;
|
|
7
7
|
isReverted?: boolean;
|
|
8
8
|
isReadOnly?: boolean;
|
|
9
|
+
dataAnalyticsId?: string;
|
|
9
10
|
}
|
|
10
11
|
export interface IToggleButtonDefaultRaw extends IToggleButtonBaseRaw {
|
|
11
12
|
onChange?: (checked: boolean) => void;
|
package/esm/tooltip/tooltip.js
CHANGED
|
@@ -99,7 +99,7 @@ const EventWrapper = ({
|
|
|
99
99
|
handleUniversalClick,
|
|
100
100
|
setTooltipVisible,
|
|
101
101
|
timerRef,
|
|
102
|
-
|
|
102
|
+
timerMouseLeaveRef
|
|
103
103
|
}) => {
|
|
104
104
|
const isCurrentDeviceDesktop = deviceType === DeviceType.Desktop;
|
|
105
105
|
const originalOnClick = children.props.onClick;
|
|
@@ -112,10 +112,10 @@ const EventWrapper = ({
|
|
|
112
112
|
handleUniversalClick(e);
|
|
113
113
|
}, [originalOnClick, handleUniversalClick]);
|
|
114
114
|
const desktopEvents = {
|
|
115
|
-
|
|
115
|
+
onMouseEnter: () => {
|
|
116
116
|
var _a;
|
|
117
117
|
setTooltipVisible(true);
|
|
118
|
-
|
|
118
|
+
timerMouseLeaveRef.current && ((_a = zen.clearTimeout) === null || _a === void 0 ? void 0 : _a.call(zen, timerMouseLeaveRef.current));
|
|
119
119
|
},
|
|
120
120
|
onMouseLeave: () => {
|
|
121
121
|
var _a;
|
|
@@ -155,7 +155,7 @@ export const Tooltip = ({
|
|
|
155
155
|
const triggerLocalRef = useRef(null);
|
|
156
156
|
const triggerRef = triggerRefNative || triggerLocalRef;
|
|
157
157
|
const timerRef = useRef(null);
|
|
158
|
-
const
|
|
158
|
+
const timerMouseLeaveRef = useRef(null);
|
|
159
159
|
const tooltipRef = useRef(null);
|
|
160
160
|
const arrowRef = useRef(null);
|
|
161
161
|
const [isTooltipVisible, setTooltipVisible] = useState(false);
|
|
@@ -225,7 +225,7 @@ export const Tooltip = ({
|
|
|
225
225
|
handleUniversalClick: handleUniversalClick,
|
|
226
226
|
setTooltipVisible: setTooltipVisible,
|
|
227
227
|
timerRef: timerRef,
|
|
228
|
-
|
|
228
|
+
timerMouseLeaveRef: timerMouseLeaveRef,
|
|
229
229
|
children: React.cloneElement(tooltipTrigger, Object.assign({
|
|
230
230
|
ref: triggerRef
|
|
231
231
|
}, triggerCloneProps))
|
|
@@ -322,14 +322,14 @@ export const Tooltip = ({
|
|
|
322
322
|
role: "tooltip",
|
|
323
323
|
ref: tooltipRef,
|
|
324
324
|
className: classNames(["zen-tooltip", dark ? "zen-dark" : "", `zen-tooltip--auto`, isMobile ? "zen-tooltip--mobile" : "", isDrive ? "zen-tooltip--drive" : "", className]),
|
|
325
|
-
|
|
325
|
+
onMouseEnter: () => {
|
|
326
326
|
var _a, _b;
|
|
327
327
|
timerRef.current && ((_a = zen.clearTimeout) === null || _a === void 0 ? void 0 : _a.call(zen, timerRef.current));
|
|
328
|
-
|
|
328
|
+
timerMouseLeaveRef.current && ((_b = zen.clearTimeout) === null || _b === void 0 ? void 0 : _b.call(zen, timerMouseLeaveRef.current));
|
|
329
329
|
},
|
|
330
|
-
|
|
330
|
+
onMouseLeave: () => {
|
|
331
331
|
var _a;
|
|
332
|
-
|
|
332
|
+
timerMouseLeaveRef.current = (_a = zen.setTimeout) === null || _a === void 0 ? void 0 : _a.call(zen, () => {
|
|
333
333
|
if (!isMobile && !isDrive) {
|
|
334
334
|
setTooltipVisible(false);
|
|
335
335
|
}
|
|
@@ -413,8 +413,8 @@ export const Tooltip = ({
|
|
|
413
413
|
if (timerRef.current) {
|
|
414
414
|
(_a = zen.clearTimeout) === null || _a === void 0 ? void 0 : _a.call(zen, timerRef.current);
|
|
415
415
|
}
|
|
416
|
-
if (
|
|
417
|
-
(_b = zen.clearTimeout) === null || _b === void 0 ? void 0 : _b.call(zen,
|
|
416
|
+
if (timerMouseLeaveRef.current) {
|
|
417
|
+
(_b = zen.clearTimeout) === null || _b === void 0 ? void 0 : _b.call(zen, timerMouseLeaveRef.current);
|
|
418
418
|
}
|
|
419
419
|
}, []);
|
|
420
420
|
return _jsxs(_Fragment, {
|
|
@@ -312,4 +312,6 @@ export declare const translations: {
|
|
|
312
312
|
"Failed to load page": string;
|
|
313
313
|
"Please refresh the page and try again. If the issue persists, contact Support.": string;
|
|
314
314
|
"Failed to load {0}": string;
|
|
315
|
+
"Sort by Ascending": string;
|
|
316
|
+
"Sort by Descending": string;
|
|
315
317
|
};
|
|
@@ -311,5 +311,7 @@ export const translations = {
|
|
|
311
311
|
"Please reload this section to try again. If the issue persists, contact Support.": "Please reload this section to try again. If the issue persists, contact Support.",
|
|
312
312
|
"Failed to load page": "Failed to load page",
|
|
313
313
|
"Please refresh the page and try again. If the issue persists, contact Support.": "Please refresh the page and try again. If the issue persists, contact Support.",
|
|
314
|
-
"Failed to load {0}": "Failed to load {0}"
|
|
314
|
+
"Failed to load {0}": "Failed to load {0}",
|
|
315
|
+
"Sort by Ascending": "Sort by Ascending",
|
|
316
|
+
"Sort by Descending": "Sort by Descending"
|
|
315
317
|
};
|