@geotab/zenith 3.8.0 → 3.9.0-beta.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.
Files changed (61) hide show
  1. package/README.md +12 -12
  2. package/dist/button/button.d.ts +2 -1
  3. package/dist/button/button.js +3 -3
  4. package/dist/calendar/calendar.js +200 -3
  5. package/dist/card/components/cardButton/cardButton.d.ts +2 -1
  6. package/dist/card/components/cardButton/cardButton.js +5 -3
  7. package/dist/card/components/title.js +7 -3
  8. package/dist/chart/barChart/getBarLegendItems.js +3 -5
  9. package/dist/chart/lineChart/getLineLegendItems.js +7 -7
  10. package/dist/chart/pieChart/getPieLegendItems.js +8 -12
  11. package/dist/chart/plugins/legend/interfaces.d.ts +1 -1
  12. package/dist/dateInputInner/dateInputInnerControlBlock.js +12 -8
  13. package/dist/dialog/dialog.js +4 -3
  14. package/dist/fileUpload/fileUpload.js +21 -12
  15. package/dist/filtersBar/filtersBarSidePanel/components/filtersBarSidePanelRange/filtersBarSidePanelRange.js +3 -0
  16. package/dist/formFieldError/formFieldError.d.ts +2 -1
  17. package/dist/formFieldError/formFieldError.js +2 -2
  18. package/dist/index.css +5 -0
  19. package/dist/index.d.ts +0 -2
  20. package/dist/index.js +16 -20
  21. package/dist/nav/navEditList/navEditListUtils.d.ts +1 -1
  22. package/dist/nav/navEditList/navEditListUtils.js +2 -1
  23. package/dist/nav/navItem/navActionItem.js +3 -3
  24. package/dist/pageHeader/pageHeaderActions.js +4 -3
  25. package/dist/rangeRaw/rangeRaw.js +7 -1
  26. package/dist/selectList/selectList.js +11 -7
  27. package/dist/toggleButtonRaw/toggleButtonRaw.js +3 -1
  28. package/dist/toggleButtonRaw/types.d.ts +1 -0
  29. package/dist/tooltip/tooltip.js +11 -11
  30. package/dist/utils/localization/translations/en-json.d.ts +2 -0
  31. package/dist/utils/localization/translations/en-json.js +3 -1
  32. package/esm/button/button.d.ts +2 -1
  33. package/esm/button/button.js +3 -3
  34. package/esm/calendar/calendar.js +200 -3
  35. package/esm/card/components/cardButton/cardButton.d.ts +2 -1
  36. package/esm/card/components/cardButton/cardButton.js +5 -3
  37. package/esm/card/components/title.js +8 -4
  38. package/esm/chart/barChart/getBarLegendItems.js +3 -5
  39. package/esm/chart/lineChart/getLineLegendItems.js +7 -7
  40. package/esm/chart/pieChart/getPieLegendItems.js +8 -12
  41. package/esm/chart/plugins/legend/interfaces.d.ts +1 -1
  42. package/esm/dateInputInner/dateInputInnerControlBlock.js +13 -9
  43. package/esm/dialog/dialog.js +4 -3
  44. package/esm/fileUpload/fileUpload.js +21 -12
  45. package/esm/filtersBar/filtersBarSidePanel/components/filtersBarSidePanelRange/filtersBarSidePanelRange.js +3 -0
  46. package/esm/formFieldError/formFieldError.d.ts +2 -1
  47. package/esm/formFieldError/formFieldError.js +2 -2
  48. package/esm/index.d.ts +0 -2
  49. package/esm/index.js +0 -2
  50. package/esm/nav/navEditList/navEditListUtils.d.ts +1 -1
  51. package/esm/nav/navEditList/navEditListUtils.js +2 -1
  52. package/esm/nav/navItem/navActionItem.js +3 -2
  53. package/esm/pageHeader/pageHeaderActions.js +4 -3
  54. package/esm/rangeRaw/rangeRaw.js +7 -1
  55. package/esm/selectList/selectList.js +11 -7
  56. package/esm/toggleButtonRaw/toggleButtonRaw.js +3 -1
  57. package/esm/toggleButtonRaw/types.d.ts +1 -0
  58. package/esm/tooltip/tooltip.js +11 -11
  59. package/esm/utils/localization/translations/en-json.d.ts +2 -0
  60. package/esm/utils/localization/translations/en-json.js +3 -1
  61. package/package.json +5 -5
@@ -4,7 +4,8 @@ import { NavActionItem } from "../navItem/navActionItem";
4
4
  import { IconGrab } from "../../icons/iconGrab";
5
5
  export const attachDndHandler = (item, onPointerDown) => {
6
6
  if (item.type === NavActionItem) {
7
- return cloneElement(item, Object.assign(Object.assign({}, item.props), { startNode: (_jsx("div", { className: "zen-nav-item__dnd", onPointerDown: onPointerDown, children: _jsx(IconGrab, { size: "large" }) })) }));
7
+ const navActionItem = item;
8
+ return cloneElement(navActionItem, Object.assign(Object.assign({}, navActionItem.props), { onLeftContentPointerDown: onPointerDown, startNode: (_jsx("div", { className: "zen-nav-item__dnd", children: _jsx(IconGrab, { size: "large" }) })) }));
8
9
  }
9
10
  return item;
10
11
  };
@@ -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
- export const NavActionItem = ({ title, id, icon, className, startNode, endButtonIcon, endButtonTitle, onEndButtonClick }) => {
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";
@@ -8,7 +8,7 @@ import { PageToolbarCollapsedItemsControl } from "../header/components/collapsed
8
8
  import { PageHeaderButtonDisplayName } from "./pageHeaderButton";
9
9
  import { PageHeaderMenuDisplayName } from "./pageHeaderMenu";
10
10
  import { getItemsFromFragments } from "./pageHeaderHelpers";
11
- import { createPortal } from "react-dom";
11
+ import { usePortal } from "../commonHelpers/hooks/usePortal";
12
12
  import { zen } from "../utils/zen";
13
13
  export const PageHeaderActions = ({ className = "", children }) => {
14
14
  var _a, _b;
@@ -32,10 +32,11 @@ export const PageHeaderActions = ({ className = "", children }) => {
32
32
  isMobile ? "zen-page-header-component__actions--mobile-portal" : "",
33
33
  className
34
34
  ]), children: [nonFittingElements.length > 0 ? moreButton : null, fittingElements] })) : null;
35
+ const modalRoot = ((_a = zen.document) === null || _a === void 0 ? void 0 : _a.fullscreenElement) || ((_b = zen.document) === null || _b === void 0 ? void 0 : _b.body);
36
+ const portal = usePortal(actionsContent, modalRoot);
35
37
  // For mobile, render actions in a portal at the bottom center of viewport
36
38
  if (isMobile && actionsContent) {
37
- const modalRoot = ((_a = zen.document) === null || _a === void 0 ? void 0 : _a.fullscreenElement) || ((_b = zen.document) === null || _b === void 0 ? void 0 : _b.body);
38
- return createPortal(actionsContent, modalRoot);
39
+ return portal;
39
40
  }
40
41
  return actionsContent;
41
42
  };
@@ -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
- listRef.current &&
64
- isChildOf(zen.document.activeElement, listRef.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" });
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;
@@ -99,7 +99,7 @@ const EventWrapper = ({
99
99
  handleUniversalClick,
100
100
  setTooltipVisible,
101
101
  timerRef,
102
- timerMouseOutRef
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
- onMouseOver: () => {
115
+ onMouseEnter: () => {
116
116
  var _a;
117
117
  setTooltipVisible(true);
118
- timerMouseOutRef.current && ((_a = zen.clearTimeout) === null || _a === void 0 ? void 0 : _a.call(zen, timerMouseOutRef.current));
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 timerMouseOutRef = useRef(null);
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
- timerMouseOutRef: timerMouseOutRef,
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
- onMouseOver: () => {
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
- timerMouseOutRef.current && ((_b = zen.clearTimeout) === null || _b === void 0 ? void 0 : _b.call(zen, timerMouseOutRef.current));
328
+ timerMouseLeaveRef.current && ((_b = zen.clearTimeout) === null || _b === void 0 ? void 0 : _b.call(zen, timerMouseLeaveRef.current));
329
329
  },
330
- onMouseOut: () => {
330
+ onMouseLeave: () => {
331
331
  var _a;
332
- timerMouseOutRef.current = (_a = zen.setTimeout) === null || _a === void 0 ? void 0 : _a.call(zen, () => {
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 (timerMouseOutRef.current) {
417
- (_b = zen.clearTimeout) === null || _b === void 0 ? void 0 : _b.call(zen, timerMouseOutRef.current);
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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geotab/zenith",
3
- "version": "3.8.0",
3
+ "version": "3.9.0-beta.ssr.0",
4
4
  "description": "Zenith components library on React",
5
5
  "main": "dist/index.js",
6
6
  "types": "esm/index.d.ts",
@@ -89,14 +89,14 @@
89
89
  },
90
90
  "dependencies": {
91
91
  "chart.js": "^4.4.6",
92
- "react": "^19.2.0",
93
- "react-dom": "^19.2.0",
92
+ "react": "^19.2.5",
93
+ "react-dom": "^19.2.5",
94
94
  "react-hook-form": "^7.60.0"
95
95
  },
96
96
  "peerDependencies": {
97
97
  "chart.js": "^4.4.6",
98
- "react": "^19.2.0",
99
- "react-dom": "^19.2.0"
98
+ "react": "^19.2.5",
99
+ "react-dom": "^19.2.5"
100
100
  },
101
101
  "files": [
102
102
  "./dist/",