@geotab/zenith 3.8.0 → 3.9.0-beta.1
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/card.d.ts +1 -1
- package/dist/card/card.js +1 -1
- package/dist/card/components/cardButton/cardButton.d.ts +2 -1
- package/dist/card/components/cardButton/cardButton.js +5 -3
- package/dist/card/helpers/getIconTypeFromStatus.d.ts +1 -1
- package/dist/chart/barChart/getBarLegendItems.js +3 -5
- package/dist/chart/lineChart/getLineLegendItems.js +7 -7
- package/dist/chart/pieChart/centerTextPlugin.js +13 -5
- package/dist/chart/pieChart/getPieLegendItems.js +8 -12
- package/dist/chart/pieChart.js +13 -11
- package/dist/chart/plugins/legend/interfaces.d.ts +1 -1
- package/dist/commonHelpers/generateId.d.ts +8 -0
- package/dist/commonHelpers/generateId.js +8 -0
- package/dist/commonHelpers/hooks/ssrProvider.d.ts +14 -0
- package/dist/commonHelpers/hooks/ssrProvider.js +12 -0
- package/dist/commonHelpers/hooks/useClientReady.js +3 -1
- package/dist/commonHelpers/hooks/useDeviceType.js +6 -2
- package/dist/commonHelpers/hooks/useIsomorphicLayoutEffect.d.ts +2 -0
- package/dist/commonHelpers/hooks/useIsomorphicLayoutEffect.js +6 -0
- package/dist/commonHelpers/hooks/useMobile.js +4 -3
- package/dist/commonHelpers/hooks/usePortal.js +2 -5
- package/dist/commonHelpers/isDomEnv.js +1 -2
- package/dist/commonHelpers/useUniqueId.d.ts +6 -0
- package/dist/commonHelpers/useUniqueId.js +8 -2
- package/dist/commonHelpers/utils.d.ts +0 -1
- package/dist/commonHelpers/utils.js +1 -3
- package/dist/commonStyles/common.less +13 -1
- 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 +2 -3
- package/dist/commonStyles/pillStyles/pillStyles.less +1 -2
- package/dist/commonStyles/pillStyles/pillTextContent.less +2 -2
- package/dist/commonStyles/typography/typography.less +617 -249
- package/dist/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +5 -3
- package/dist/dataGrid/withSelectableRows/components/bulkActions/bulkActions.js +2 -38
- package/dist/dateInputInner/dateInputInnerControlBlock.js +12 -8
- package/dist/dateRangeRaw/dateRangeRaw.js +5 -1
- package/dist/dialog/dialog.js +4 -3
- package/dist/feedbackContainer/feedbackContainer.js +4 -4
- package/dist/fileUpload/fileUpload.js +21 -12
- package/dist/filters/components/filtersSidePanel.d.ts +1 -1
- package/dist/filters/components/filtersSidePanel.js +123 -116
- package/dist/filters/filters.js +1 -2
- package/dist/filtersBar/filtersBar.d.ts +2 -0
- package/dist/filtersBar/filtersBar.js +5 -3
- package/dist/filtersBar/filtersBarActions/filtersBarActions.js +3 -1
- package/dist/filtersBar/filtersBarSidePanel/components/filtersBarSidePanelRange/filtersBarSidePanelRange.js +3 -0
- package/dist/filtersBar/filtersBarSidePanel/filtersBarSidePanel.d.ts +1 -1
- package/dist/filtersBar/filtersBarSidePanel/filtersBarSidePanel.js +86 -80
- package/dist/formFieldError/formFieldError.d.ts +2 -1
- package/dist/formFieldError/formFieldError.js +2 -2
- package/dist/header/components/collapsedItemsControl/utils/handleCustomMenuWrapper.js +1 -1
- package/dist/index.css +3707 -2151
- package/dist/index.d.ts +3 -5
- package/dist/index.js +24 -29
- package/dist/menu/components/menuItem.js +4 -4
- package/dist/menu/controlledMenu.js +4 -4
- package/dist/nav/nav.js +10 -5
- package/dist/nav/navAddMenu/navAddMenu.js +1 -2
- 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/nav/navItem/navItem.js +1 -2
- package/dist/pageHeader/pageHeaderActions.js +4 -3
- package/dist/rangeRaw/rangeRaw.js +7 -1
- package/dist/selectList/selectList.js +11 -7
- package/dist/selectRaw/selectRaw.js +1 -1
- package/dist/shield/shield.js +5 -3
- package/dist/sidePanel/sidePanel.js +9 -8
- package/dist/table/children/useTableChildren.d.ts +1 -1
- package/dist/table/children/useTableChildren.js +3 -3
- package/dist/table/flexible/useFlexibleColumns.js +39 -1
- package/dist/table/nested/useNestedRows.d.ts +1 -0
- package/dist/table/nested/useNestedRows.js +3 -3
- package/dist/table/selectable/useSelectableRows.d.ts +9 -0
- package/dist/table/selectable/useSelectableRows.js +18 -11
- package/dist/table/table.js +1 -7
- package/dist/{card/components → title}/title.d.ts +1 -1
- package/dist/title/title.js +27 -0
- package/dist/toggleButtonRaw/toggleButtonRaw.js +3 -1
- package/dist/toggleButtonRaw/types.d.ts +1 -0
- package/dist/tooltip/tooltip.d.ts +2 -1
- package/dist/tooltip/tooltip.js +68 -64
- package/dist/utils/localization/directionContext.d.ts +3 -0
- package/dist/utils/localization/directionContext.js +5 -0
- package/dist/utils/localization/getTextDirection.d.ts +2 -0
- package/dist/utils/localization/getTextDirection.js +6 -0
- package/dist/utils/localization/languageProvider.js +15 -1
- package/dist/utils/localization/translations/en-json.d.ts +2 -0
- package/dist/utils/localization/translations/en-json.js +3 -1
- package/dist/utils/localization/translations/en.json +3 -0
- package/dist/utils/localization/useDirection.d.ts +2 -0
- package/dist/utils/localization/useDirection.js +7 -0
- 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/card.d.ts +1 -1
- package/esm/card/card.js +1 -1
- package/esm/card/components/cardButton/cardButton.d.ts +2 -1
- package/esm/card/components/cardButton/cardButton.js +5 -3
- package/esm/card/helpers/getIconTypeFromStatus.d.ts +1 -1
- package/esm/chart/barChart/getBarLegendItems.js +3 -5
- package/esm/chart/lineChart/getLineLegendItems.js +7 -7
- package/esm/chart/pieChart/centerTextPlugin.js +13 -5
- package/esm/chart/pieChart/getPieLegendItems.js +8 -12
- package/esm/chart/pieChart.js +14 -12
- package/esm/chart/plugins/legend/interfaces.d.ts +1 -1
- package/esm/commonHelpers/generateId.d.ts +8 -0
- package/esm/commonHelpers/generateId.js +8 -0
- package/esm/commonHelpers/hooks/ssrProvider.d.ts +14 -0
- package/esm/commonHelpers/hooks/ssrProvider.js +6 -0
- package/esm/commonHelpers/hooks/useClientReady.js +4 -2
- package/esm/commonHelpers/hooks/useDeviceType.js +7 -3
- package/esm/commonHelpers/hooks/useIsomorphicLayoutEffect.d.ts +2 -0
- package/esm/commonHelpers/hooks/useIsomorphicLayoutEffect.js +3 -0
- package/esm/commonHelpers/hooks/useMobile.js +4 -3
- package/esm/commonHelpers/hooks/usePortal.js +2 -5
- package/esm/commonHelpers/isDomEnv.js +1 -2
- package/esm/commonHelpers/useUniqueId.d.ts +6 -0
- package/esm/commonHelpers/useUniqueId.js +7 -1
- package/esm/commonHelpers/utils.d.ts +0 -1
- package/esm/commonHelpers/utils.js +0 -1
- package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +5 -3
- package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.js +2 -38
- package/esm/dateInputInner/dateInputInnerControlBlock.js +13 -9
- package/esm/dateRangeRaw/dateRangeRaw.js +5 -1
- package/esm/dialog/dialog.js +4 -3
- package/esm/feedbackContainer/feedbackContainer.js +4 -4
- package/esm/fileUpload/fileUpload.js +21 -12
- package/esm/filters/components/filtersSidePanel.d.ts +1 -1
- package/esm/filters/components/filtersSidePanel.js +123 -116
- package/esm/filters/filters.js +2 -3
- package/esm/filtersBar/filtersBar.d.ts +2 -0
- package/esm/filtersBar/filtersBar.js +5 -3
- package/esm/filtersBar/filtersBarActions/filtersBarActions.js +3 -1
- package/esm/filtersBar/filtersBarSidePanel/components/filtersBarSidePanelRange/filtersBarSidePanelRange.js +3 -0
- package/esm/filtersBar/filtersBarSidePanel/filtersBarSidePanel.d.ts +1 -1
- package/esm/filtersBar/filtersBarSidePanel/filtersBarSidePanel.js +86 -80
- package/esm/formFieldError/formFieldError.d.ts +2 -1
- package/esm/formFieldError/formFieldError.js +2 -2
- package/esm/header/components/collapsedItemsControl/utils/handleCustomMenuWrapper.js +1 -1
- package/esm/index.d.ts +3 -5
- package/esm/index.js +3 -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/nav/navAddMenu/navAddMenu.js +2 -3
- 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/nav/navItem/navItem.js +2 -3
- package/esm/pageHeader/pageHeaderActions.js +4 -3
- package/esm/rangeRaw/rangeRaw.js +7 -1
- package/esm/selectList/selectList.js +11 -7
- package/esm/selectRaw/selectRaw.js +1 -1
- package/esm/shield/shield.js +5 -3
- package/esm/sidePanel/sidePanel.js +9 -8
- package/esm/table/children/useTableChildren.d.ts +1 -1
- package/esm/table/children/useTableChildren.js +3 -3
- package/esm/table/flexible/useFlexibleColumns.js +39 -1
- package/esm/table/nested/useNestedRows.d.ts +1 -0
- package/esm/table/nested/useNestedRows.js +1 -1
- package/esm/table/selectable/useSelectableRows.d.ts +9 -0
- package/esm/table/selectable/useSelectableRows.js +15 -8
- package/esm/table/table.js +1 -7
- package/esm/{card/components → title}/title.d.ts +1 -1
- package/esm/title/title.js +23 -0
- package/esm/toggleButtonRaw/toggleButtonRaw.js +3 -1
- package/esm/toggleButtonRaw/types.d.ts +1 -0
- package/esm/tooltip/tooltip.d.ts +2 -1
- package/esm/tooltip/tooltip.js +68 -64
- package/esm/utils/localization/directionContext.d.ts +3 -0
- package/esm/utils/localization/directionContext.js +2 -0
- package/esm/utils/localization/getTextDirection.d.ts +2 -0
- package/esm/utils/localization/getTextDirection.js +2 -0
- package/esm/utils/localization/languageProvider.js +15 -1
- package/esm/utils/localization/translations/en-json.d.ts +2 -0
- package/esm/utils/localization/translations/en-json.js +3 -1
- package/esm/utils/localization/translations/en.json +3 -0
- package/esm/utils/localization/useDirection.d.ts +2 -0
- package/esm/utils/localization/useDirection.js +3 -0
- package/package.json +33 -31
- package/dist/card/components/title.js +0 -22
- package/dist/commonHelpers/hooks/deviceProvider.d.ts +0 -7
- package/dist/commonHelpers/hooks/deviceProvider.js +0 -11
- package/esm/card/components/title.js +0 -18
- package/esm/commonHelpers/hooks/deviceProvider.d.ts +0 -7
- package/esm/commonHelpers/hooks/deviceProvider.js +0 -4
package/esm/table/table.js
CHANGED
|
@@ -175,12 +175,6 @@ const TableInner = ({
|
|
|
175
175
|
selected: []
|
|
176
176
|
});
|
|
177
177
|
}, [selectable]);
|
|
178
|
-
const selectAll = useCallback(() => {
|
|
179
|
-
selectable === null || selectable === void 0 ? void 0 : selectable.onSelect({
|
|
180
|
-
all: true,
|
|
181
|
-
selected: []
|
|
182
|
-
});
|
|
183
|
-
}, [selectable]);
|
|
184
178
|
const [activeIdInternal, setActiveInternal] = useState(undefined);
|
|
185
179
|
const activeId = active !== undefined ? active : activeIdInternal;
|
|
186
180
|
const onClickInternal = useCallback(id => setActiveInternal(id === activeIdInternal ? undefined : id), [activeIdInternal, setActiveInternal]);
|
|
@@ -197,7 +191,7 @@ const TableInner = ({
|
|
|
197
191
|
detailPanel,
|
|
198
192
|
footer,
|
|
199
193
|
other
|
|
200
|
-
} = useTableChildren(children, isMobile, selectionQty, ((_c = selectable === null || selectable === void 0 ? void 0 : selectable.selection) === null || _c === void 0 ? void 0 : _c.all) || false, clearSelection,
|
|
194
|
+
} = useTableChildren(children, isMobile, selectionQty, ((_c = selectable === null || selectable === void 0 ? void 0 : selectable.selection) === null || _c === void 0 ? void 0 : _c.all) || false, clearSelection, activeId, gridRef, onCloseDetailPanel);
|
|
201
195
|
const hasDetailPanel = !!detailPanel;
|
|
202
196
|
const shouldEnableRowClick = hasDetailPanel || !!onClick;
|
|
203
197
|
const activeIdForRow = shouldEnableRowClick ? activeId : undefined;
|
|
@@ -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,23 @@
|
|
|
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 { useDrive } from "../utils/theme/useDrive";
|
|
5
|
+
import { useDriveClassName } from "../utils/theme/useDriveClassName";
|
|
6
|
+
import { IconChevronRightSmall } from "../icons/iconChevronRightSmall";
|
|
7
|
+
export const Title = ({ isMobile, link, target, title, id, icon, iconType, className = "", onClick }) => {
|
|
8
|
+
const isDrive = useDrive();
|
|
9
|
+
const driveClassName = useDriveClassName("zen-title");
|
|
10
|
+
const h3ClassName = classNames(["zen-title", driveClassName !== null && driveClassName !== void 0 ? driveClassName : ""]);
|
|
11
|
+
const clickableClass = onClick ? "zen-title__clickable" : "";
|
|
12
|
+
const iconClassName = iconType ? `zen-title__icon--${iconType}` : "";
|
|
13
|
+
const iconSize = useMemo(() => (isDrive ? "huge" : "large"), [isDrive]);
|
|
14
|
+
const iconElement = useMemo(() => (icon ? _jsx("div", { className: classNames(["zen-title__icon", iconClassName]), children: createElement(icon, { size: iconSize }) }) : null), [icon, iconSize, iconClassName]);
|
|
15
|
+
const chevron = useMemo(() => (_jsx("span", { className: "zen-title__link-chevron", children: _jsx(IconChevronRightSmall, { size: iconSize, className: "zen-title__chevron-icon" }) })), [iconSize]);
|
|
16
|
+
if (onClick) {
|
|
17
|
+
return (_jsx("h3", { className: h3ClassName, children: _jsxs("button", { type: "button", className: clickableClass, onClick: onClick, children: [iconElement, _jsxs("span", { title: title, id: id, className: classNames(["zen-title__text", isMobile && !isDrive ? "zen-title__text--mobile" : "", className]), children: [title, chevron] })] }) }));
|
|
18
|
+
}
|
|
19
|
+
if (link) {
|
|
20
|
+
return (_jsx("h3", { className: h3ClassName, children: _jsxs("a", { id: id, className: "zen-title__link", href: link, target: target, children: [iconElement, _jsxs("span", { title: title, className: classNames(["zen-title__link-text"]), children: [title, chevron] })] }) }));
|
|
21
|
+
}
|
|
22
|
+
return (_jsxs("h3", { className: h3ClassName, children: [iconElement, _jsx("span", { title: title, id: id, className: classNames(["zen-title__text", isMobile && !isDrive ? "zen-title__text--mobile" : "", className]), children: title })] }));
|
|
23
|
+
};
|
|
@@ -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.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ interface ITooltip extends IZenComponentProps {
|
|
|
10
10
|
}>;
|
|
11
11
|
alignment?: TAlignment;
|
|
12
12
|
triggerClassName?: string;
|
|
13
|
+
triggerAriaLabel?: string;
|
|
13
14
|
mobileTitle?: string;
|
|
14
15
|
/**
|
|
15
16
|
* @deprecated
|
|
@@ -32,5 +33,5 @@ interface ITooltip extends IZenComponentProps {
|
|
|
32
33
|
*/
|
|
33
34
|
mobileSheetTitle?: ReactElement | string;
|
|
34
35
|
}
|
|
35
|
-
export declare const Tooltip: ({ trigger, triggerClassName, className, alignment, children, mobileSheetTitle, mobileTitle }: ITooltip) => import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export declare const Tooltip: ({ trigger, triggerClassName, triggerAriaLabel, className, alignment, children, mobileSheetTitle, mobileTitle }: ITooltip) => import("react/jsx-runtime").JSX.Element;
|
|
36
37
|
export {};
|
package/esm/tooltip/tooltip.js
CHANGED
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import React, { createElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { useResize } from "../commonHelpers/hooks/useResize";
|
|
5
5
|
import { calculatePosition as calculatePos } from "../utils/positioningUtils/calculatePosition";
|
|
6
|
-
import {
|
|
6
|
+
import { usePortal } from "../commonHelpers/hooks/usePortal";
|
|
7
7
|
import { classNames } from "../commonHelpers/classNames/classNames";
|
|
8
8
|
import { calculateArrowPosition } from "./helpers/calculateArrowPosition";
|
|
9
9
|
import { DeviceType } from "../commonHelpers/hooks/deviceType";
|
|
@@ -99,7 +99,8 @@ const EventWrapper = ({
|
|
|
99
99
|
handleUniversalClick,
|
|
100
100
|
setTooltipVisible,
|
|
101
101
|
timerRef,
|
|
102
|
-
|
|
102
|
+
timerMouseLeaveRef,
|
|
103
|
+
tooltipRef
|
|
103
104
|
}) => {
|
|
104
105
|
const isCurrentDeviceDesktop = deviceType === DeviceType.Desktop;
|
|
105
106
|
const originalOnClick = children.props.onClick;
|
|
@@ -112,10 +113,10 @@ const EventWrapper = ({
|
|
|
112
113
|
handleUniversalClick(e);
|
|
113
114
|
}, [originalOnClick, handleUniversalClick]);
|
|
114
115
|
const desktopEvents = {
|
|
115
|
-
|
|
116
|
+
onMouseEnter: () => {
|
|
116
117
|
var _a;
|
|
117
118
|
setTooltipVisible(true);
|
|
118
|
-
|
|
119
|
+
timerMouseLeaveRef.current && ((_a = zen.clearTimeout) === null || _a === void 0 ? void 0 : _a.call(zen, timerMouseLeaveRef.current));
|
|
119
120
|
},
|
|
120
121
|
onMouseLeave: () => {
|
|
121
122
|
var _a;
|
|
@@ -124,7 +125,13 @@ const EventWrapper = ({
|
|
|
124
125
|
}, TOOLTIP_VISIBILITY_DELAY);
|
|
125
126
|
},
|
|
126
127
|
onFocus: () => setTooltipVisible(true),
|
|
127
|
-
onBlur: () =>
|
|
128
|
+
onBlur: () => {
|
|
129
|
+
// Skip if the tooltip DOM was already detached
|
|
130
|
+
if (tooltipRef.current && !tooltipRef.current.isConnected) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
setTooltipVisible(false);
|
|
134
|
+
},
|
|
128
135
|
onKeyDown: onKeyDownHandler,
|
|
129
136
|
onClick: composedOnClick
|
|
130
137
|
};
|
|
@@ -143,19 +150,22 @@ const EventWrapper = ({
|
|
|
143
150
|
export const Tooltip = ({
|
|
144
151
|
trigger,
|
|
145
152
|
triggerClassName,
|
|
153
|
+
triggerAriaLabel,
|
|
146
154
|
className = "",
|
|
147
155
|
alignment,
|
|
148
156
|
children,
|
|
149
157
|
mobileSheetTitle,
|
|
150
158
|
mobileTitle
|
|
159
|
+
// eslint-disable-next-line complexity
|
|
151
160
|
}) => {
|
|
161
|
+
var _a, _b, _c, _d;
|
|
152
162
|
const GAP = 12;
|
|
153
163
|
const isDrive = useDrive();
|
|
154
|
-
const triggerRefNative = trigger
|
|
164
|
+
const triggerRefNative = trigger ? trigger.props.ref : undefined;
|
|
155
165
|
const triggerLocalRef = useRef(null);
|
|
156
166
|
const triggerRef = triggerRefNative || triggerLocalRef;
|
|
157
167
|
const timerRef = useRef(null);
|
|
158
|
-
const
|
|
168
|
+
const timerMouseLeaveRef = useRef(null);
|
|
159
169
|
const tooltipRef = useRef(null);
|
|
160
170
|
const arrowRef = useRef(null);
|
|
161
171
|
const [isTooltipVisible, setTooltipVisible] = useState(false);
|
|
@@ -212,12 +222,12 @@ export const Tooltip = ({
|
|
|
212
222
|
tabIndex: 0,
|
|
213
223
|
type: "button",
|
|
214
224
|
className: "zen-tooltip__trigger-container",
|
|
215
|
-
"aria-label": translate("Information"),
|
|
225
|
+
"aria-label": triggerAriaLabel !== null && triggerAriaLabel !== void 0 ? triggerAriaLabel : translate("Information"),
|
|
216
226
|
children: createElement(IconInfoCircle, {
|
|
217
227
|
size: isMobile ? "huge" : "large",
|
|
218
228
|
className: classNames([triggerClassName || "", "zen-tooltip__trigger"])
|
|
219
229
|
})
|
|
220
|
-
}), [trigger, isMobile, triggerClassName, translate]);
|
|
230
|
+
}), [trigger, isMobile, triggerClassName, triggerAriaLabel, translate]);
|
|
221
231
|
const triggerClone = _jsx(EventWrapper, {
|
|
222
232
|
deviceType: deviceType,
|
|
223
233
|
isTooltipVisible: isTooltipVisible,
|
|
@@ -225,7 +235,8 @@ export const Tooltip = ({
|
|
|
225
235
|
handleUniversalClick: handleUniversalClick,
|
|
226
236
|
setTooltipVisible: setTooltipVisible,
|
|
227
237
|
timerRef: timerRef,
|
|
228
|
-
|
|
238
|
+
timerMouseLeaveRef: timerMouseLeaveRef,
|
|
239
|
+
tooltipRef: tooltipRef,
|
|
229
240
|
children: React.cloneElement(tooltipTrigger, Object.assign({
|
|
230
241
|
ref: triggerRef
|
|
231
242
|
}, triggerCloneProps))
|
|
@@ -308,61 +319,54 @@ export const Tooltip = ({
|
|
|
308
319
|
}
|
|
309
320
|
return preferredAlignment;
|
|
310
321
|
}, [isMobile, TOOLTIP_ARROW_HEIGHT, triggerRef, checkNaturalFit]);
|
|
311
|
-
|
|
312
|
-
const
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
322
|
+
const container = (_d = (_b = (_a = zen.document) === null || _a === void 0 ? void 0 : _a.fullscreenElement) !== null && _b !== void 0 ? _b : (_c = zen.document) === null || _c === void 0 ? void 0 : _c.body) !== null && _d !== void 0 ? _d : undefined;
|
|
323
|
+
const portal = usePortal(isTooltipVisible ? _jsxs(_Fragment, {
|
|
324
|
+
children: [isMobile && _jsx(Shield, {
|
|
325
|
+
className: "zen-tooltip__shield"
|
|
326
|
+
}), _jsxs("div", {
|
|
327
|
+
id: tooltipId,
|
|
328
|
+
role: "tooltip",
|
|
329
|
+
ref: tooltipRef,
|
|
330
|
+
className: classNames(["zen-tooltip", dark ? "zen-dark" : "", `zen-tooltip--auto`, isMobile ? "zen-tooltip--mobile" : "", isDrive ? "zen-tooltip--drive" : "", className]),
|
|
331
|
+
onMouseEnter: () => {
|
|
332
|
+
var _a, _b;
|
|
333
|
+
timerRef.current && ((_a = zen.clearTimeout) === null || _a === void 0 ? void 0 : _a.call(zen, timerRef.current));
|
|
334
|
+
timerMouseLeaveRef.current && ((_b = zen.clearTimeout) === null || _b === void 0 ? void 0 : _b.call(zen, timerMouseLeaveRef.current));
|
|
335
|
+
},
|
|
336
|
+
onMouseLeave: () => {
|
|
337
|
+
var _a;
|
|
338
|
+
timerMouseLeaveRef.current = (_a = zen.setTimeout) === null || _a === void 0 ? void 0 : _a.call(zen, () => {
|
|
339
|
+
if (!isMobile && !isDrive) {
|
|
340
|
+
setTooltipVisible(false);
|
|
341
|
+
}
|
|
342
|
+
}, TOOLTIP_VISIBILITY_DELAY);
|
|
343
|
+
},
|
|
344
|
+
children: [!isMobile && !isDrive && _jsx("div", {
|
|
345
|
+
className: classNames(["zen-tooltip__arrow", arrowClass]),
|
|
346
|
+
ref: arrowRef
|
|
320
347
|
}), _jsxs("div", {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
348
|
+
className: classNames(["zen-tooltip__body", "zen-tooltip__body--auto", isDrive ? "zen-tooltip__body--drive" : "", isMobile ? "zen-tooltip__body--mobile" : "", deviceType === DeviceType.Desktop && !isDrive ? "zen-tooltip__body--desktop" : ""]),
|
|
349
|
+
children: [(mobileSheetTitle || mobileTitle) && (deviceType === DeviceType.Mobile || isDrive) && _jsx("div", {
|
|
350
|
+
className: "zen-tooltip__title",
|
|
351
|
+
children: mobileSheetTitle || mobileTitle
|
|
352
|
+
}), children]
|
|
353
|
+
}), (deviceType === DeviceType.Mobile || isDrive) && _jsx(Button, {
|
|
354
|
+
className: "zen-tooltip__close-button",
|
|
355
|
+
title: translate("Close"),
|
|
356
|
+
"aria-label": translate("Close"),
|
|
357
|
+
onClick: () => {
|
|
331
358
|
var _a;
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
setTooltipVisible(false);
|
|
335
|
-
}
|
|
336
|
-
}, TOOLTIP_VISIBILITY_DELAY);
|
|
359
|
+
setTooltipVisible(false);
|
|
360
|
+
(_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
337
361
|
},
|
|
338
|
-
children:
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
children: [(mobileSheetTitle || mobileTitle) && (deviceType === DeviceType.Mobile || isDrive) && _jsx("div", {
|
|
344
|
-
className: "zen-tooltip__title",
|
|
345
|
-
children: mobileSheetTitle || mobileTitle
|
|
346
|
-
}), children]
|
|
347
|
-
}), (deviceType === DeviceType.Mobile || isDrive) && _jsx(Button, {
|
|
348
|
-
className: "zen-tooltip__close-button",
|
|
349
|
-
title: translate("Close"),
|
|
350
|
-
"aria-label": translate("Close"),
|
|
351
|
-
onClick: () => {
|
|
352
|
-
var _a;
|
|
353
|
-
setTooltipVisible(false);
|
|
354
|
-
(_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
355
|
-
},
|
|
356
|
-
children: _jsx(IconClose, {
|
|
357
|
-
description: translate("Close"),
|
|
358
|
-
className: "svgIcon",
|
|
359
|
-
size: "huge"
|
|
360
|
-
})
|
|
361
|
-
})]
|
|
362
|
+
children: _jsx(IconClose, {
|
|
363
|
+
description: translate("Close"),
|
|
364
|
+
className: "svgIcon",
|
|
365
|
+
size: "huge"
|
|
366
|
+
})
|
|
362
367
|
})]
|
|
363
|
-
})
|
|
364
|
-
|
|
365
|
-
};
|
|
368
|
+
})]
|
|
369
|
+
}) : null, container, tooltipId);
|
|
366
370
|
const calculatePosition = useCallback(() => {
|
|
367
371
|
const eAlignment = getEffectiveAlignment(tooltipAlignmentRef.current);
|
|
368
372
|
calculatePos(triggerRef, tooltipRef, TOOLTIP_ARROW_HEIGHT + GAP, TOOLTIP_ARROW_HEIGHT + GAP, false, eAlignment, tooltipAlignments, undefined, isMobile);
|
|
@@ -413,11 +417,11 @@ export const Tooltip = ({
|
|
|
413
417
|
if (timerRef.current) {
|
|
414
418
|
(_a = zen.clearTimeout) === null || _a === void 0 ? void 0 : _a.call(zen, timerRef.current);
|
|
415
419
|
}
|
|
416
|
-
if (
|
|
417
|
-
(_b = zen.clearTimeout) === null || _b === void 0 ? void 0 : _b.call(zen,
|
|
420
|
+
if (timerMouseLeaveRef.current) {
|
|
421
|
+
(_b = zen.clearTimeout) === null || _b === void 0 ? void 0 : _b.call(zen, timerMouseLeaveRef.current);
|
|
418
422
|
}
|
|
419
423
|
}, []);
|
|
420
424
|
return _jsxs(_Fragment, {
|
|
421
|
-
children: [
|
|
425
|
+
children: [portal, triggerClone]
|
|
422
426
|
});
|
|
423
427
|
};
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from "react";
|
|
2
3
|
import { languageContext } from "./languageContext";
|
|
3
4
|
import { getSupportedLanguage } from "./getSupportedLanguage";
|
|
4
|
-
|
|
5
|
+
import { directionContext } from "./directionContext";
|
|
6
|
+
import { getTextDirection } from "./getTextDirection";
|
|
7
|
+
import { zen } from "../zen";
|
|
8
|
+
export const LanguageProvider = ({ language, children }) => {
|
|
9
|
+
const validLanguage = getSupportedLanguage(language);
|
|
10
|
+
const direction = getTextDirection(validLanguage);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (zen.document) {
|
|
13
|
+
zen.document.documentElement.dir = direction;
|
|
14
|
+
zen.document.documentElement.lang = validLanguage;
|
|
15
|
+
}
|
|
16
|
+
}, [direction, validLanguage]);
|
|
17
|
+
return (_jsx(languageContext.Provider, { value: validLanguage, children: _jsx(directionContext.Provider, { value: direction, children: children }) }));
|
|
18
|
+
};
|
|
@@ -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
|
};
|
|
@@ -208,6 +208,8 @@
|
|
|
208
208
|
"X-axis": "X-axis",
|
|
209
209
|
"Previous": "Previous",
|
|
210
210
|
"Next": "Next",
|
|
211
|
+
"Previous date period": "Previous date period",
|
|
212
|
+
"Next date period": "Next date period",
|
|
211
213
|
"Choose dates": "Choose dates",
|
|
212
214
|
"Date range not available": "Date range not available",
|
|
213
215
|
"Choose your date range": "Choose your date range",
|
|
@@ -217,6 +219,7 @@
|
|
|
217
219
|
"Favorite": "Favorite",
|
|
218
220
|
"All Filters": "All Filters",
|
|
219
221
|
"Reset All": "Reset all",
|
|
222
|
+
"Active filters: {}": "Active filters: {}",
|
|
220
223
|
"Loading": "Loading",
|
|
221
224
|
"Select option": "Select option",
|
|
222
225
|
"Value": "Value",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geotab/zenith",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0-beta.1",
|
|
4
4
|
"description": "Zenith components library on React",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "esm/index.d.ts",
|
|
@@ -12,35 +12,36 @@
|
|
|
12
12
|
"**/react-chartjs/dateAdapter.js"
|
|
13
13
|
],
|
|
14
14
|
"scripts": {
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"lint": "npx eslint",
|
|
18
|
-
"prettier-fix": "npx prettier --write \"**/*.{ts,tsx,js,jsx,json,md,less,css}\"",
|
|
19
|
-
"prettier": "npx prettier --check \"**/*.{ts,tsx,js,jsx,json,md,less,css}\"",
|
|
20
|
-
"new": "node newComponent.mjs",
|
|
21
|
-
"translations": "node build-utils/translations/translation-integrity.mjs",
|
|
15
|
+
"add-icon": "node addIcon.js",
|
|
16
|
+
"build": "npm run clean && npm run build-index && npm run update-version && npm run build-ts && npm run build-less && npm run build-copy && npm run build-clean && npm run translations",
|
|
22
17
|
"build-ai-mdx": "node collectmdx.js",
|
|
23
|
-
"build-esm": "npx tsc -b tsconfig.esm.json",
|
|
24
18
|
"build-cjs": "npx tsc -b tsconfig.cjs.json",
|
|
25
|
-
"build-ts": "npm run build-esm && npm run build-cjs && node build-utils/translations/inject-translations.js && node less-transformer.js",
|
|
26
|
-
"build-less": "node less-compile.js",
|
|
27
|
-
"build-copy": "node build-copy.js",
|
|
28
19
|
"build-clean": "node build-clean.js",
|
|
20
|
+
"build-copy": "node build-copy.js",
|
|
21
|
+
"build-esm": "npx tsc -b tsconfig.esm.json",
|
|
29
22
|
"build-index": "node buildIndex.js",
|
|
30
|
-
"
|
|
31
|
-
"build": "npm run build-index && npm run update-version && npm run build-ts && npm run build-less && npm run build-copy && npm run build-clean && npm run translations",
|
|
32
|
-
"add-icon": "node addIcon.js",
|
|
33
|
-
"watch": "npx tsc -b tsconfig.build.json -w",
|
|
34
|
-
"watch:inject": "npx nodemon --watch dist --ext js --exec 'node build-utils/translations/inject-translations.js' --delay 500ms",
|
|
35
|
-
"test-build": "npx tsc -b tsconfig.jestTests.json",
|
|
36
|
-
"test-watch": "npm run clean && npm run test-build && node build-utils/translations/inject-translations.js && npx tsc -b tsconfig.jestTests.json -w",
|
|
37
|
-
"test-watch:inject": "npx nodemon --watch dist --ext js --exec 'node build-utils/translations/inject-translations.js' --delay 500ms",
|
|
38
|
-
"test-coverage": "npm run clean && npm run test-build && node build-utils/translations/inject-translations.js && jest --clearCache && jest --collectCoverage=true --coverage --collectCoverageFrom='./dist/**/*.js' --collectCoverageFrom='!./dist/**/*.test.js' --json --outputFile=jest-result.json --coverageReporters=html --coverageReporters=text-summary --coverageReporters=cobertura --maxWorkers=4 --noStackTrace && node testHelpers/cobertura/cobertura.js",
|
|
39
|
-
"coverage": "npm run test-coverage && google-chrome ./jest-coverage/index.html",
|
|
40
|
-
"storybook": "storybook dev -p 6006",
|
|
23
|
+
"build-less": "node less-compile.js",
|
|
41
24
|
"build-storybook": "storybook build && npm run build-ai-mdx",
|
|
25
|
+
"build-ts": "npm run build-esm && npm run build-cjs && npm run inject-translations && node less-transformer.js",
|
|
42
26
|
"clean": "rm -rf ./dist && rm -rf ./esm && rm -rf ./jest-coverage",
|
|
43
|
-
"
|
|
27
|
+
"coverage": "npm run test-coverage && google-chrome ./jest-coverage/index.html",
|
|
28
|
+
"inject-translations": "node build-utils/translations/inject-translations.js",
|
|
29
|
+
"lint": "npx eslint",
|
|
30
|
+
"new": "node newComponent.mjs",
|
|
31
|
+
"prettier": "npx prettier . --config '.prettierrc' --ignore-path '.prettierignore'",
|
|
32
|
+
"prettier-check": "npm run prettier -- --check",
|
|
33
|
+
"prettier-fix": "npm run prettier -- --write",
|
|
34
|
+
"start": "npm run storybook",
|
|
35
|
+
"storybook": "storybook dev -p 6006",
|
|
36
|
+
"test": "npm run clean && npm run test-build && jest",
|
|
37
|
+
"test-build": "npx tsc -b tsconfig.jestTests.json && npm run build-less && npm run inject-translations && jest --clearCache",
|
|
38
|
+
"test-coverage": "npm run clean && npm run test-build && jest --collectCoverage=true --coverage --collectCoverageFrom='./dist/**/*.js' --collectCoverageFrom='!./dist/**/*.test.js' --json --outputFile=jest-result.json --coverageReporters=html --coverageReporters=text-summary --coverageReporters=cobertura --maxWorkers=4 --noStackTrace && node testHelpers/cobertura/cobertura.js",
|
|
39
|
+
"test-storybook": "test-storybook",
|
|
40
|
+
"test-watch": "npm run clean && npm run test-build && npx tsc -b tsconfig.jestTests.json -w",
|
|
41
|
+
"translations": "node build-utils/translations/translation-integrity.mjs",
|
|
42
|
+
"update-version": "node updateVersion.js",
|
|
43
|
+
"watch": "npx tsc -b tsconfig.cjs.json -w",
|
|
44
|
+
"watch:inject-translations": "npx nodemon --watch dist --delay 500ms --ext js --exec 'npm run inject-translations'"
|
|
44
45
|
},
|
|
45
46
|
"author": "",
|
|
46
47
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
@@ -53,11 +54,12 @@
|
|
|
53
54
|
"@babel/preset-typescript": "^7.24.1",
|
|
54
55
|
"@babel/traverse": "^7.28.5",
|
|
55
56
|
"@eslint/js": "^9.18.0",
|
|
56
|
-
"@storybook/addon-
|
|
57
|
-
"@storybook/addon-
|
|
58
|
-
"@storybook/addon-
|
|
59
|
-
"@storybook/
|
|
60
|
-
"@storybook/
|
|
57
|
+
"@storybook/addon-a11y": "^10.3.5",
|
|
58
|
+
"@storybook/addon-docs": "^10.3.5",
|
|
59
|
+
"@storybook/addon-links": "^10.3.5",
|
|
60
|
+
"@storybook/addon-webpack5-compiler-babel": "^4.0.1",
|
|
61
|
+
"@storybook/react-webpack5": "^10.3.5",
|
|
62
|
+
"@storybook/test-runner": "^0.24.3",
|
|
61
63
|
"@tanstack/react-query": "^5.85.5",
|
|
62
64
|
"@testing-library/react": "^16.3.0",
|
|
63
65
|
"@types/jest": "^29.5.12",
|
|
@@ -71,7 +73,7 @@
|
|
|
71
73
|
"eslint-config-prettier": "^10.1.8",
|
|
72
74
|
"eslint-plugin-react": "^7.37.3",
|
|
73
75
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
74
|
-
"eslint-plugin-storybook": "^10.
|
|
76
|
+
"eslint-plugin-storybook": "^10.3.5",
|
|
75
77
|
"globals": "^17.1.0",
|
|
76
78
|
"jest": "^30.2.0",
|
|
77
79
|
"jest-environment-jsdom": "^30.2.0",
|
|
@@ -80,7 +82,7 @@
|
|
|
80
82
|
"less-loader": "^12.2.0",
|
|
81
83
|
"mini-css-extract-plugin": "^2.9.2",
|
|
82
84
|
"prettier": "^3.8.1",
|
|
83
|
-
"storybook": "^10.
|
|
85
|
+
"storybook": "^10.3.5",
|
|
84
86
|
"style-loader": "^4.0.0",
|
|
85
87
|
"typescript": "^5.4.3",
|
|
86
88
|
"typescript-eslint": "^8.20.0",
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Title = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const classNames_1 = require("../../commonHelpers/classNames/classNames");
|
|
7
|
-
const useDriveClassName_1 = require("../../utils/theme/useDriveClassName");
|
|
8
|
-
const useDrive_1 = require("../../utils/theme/useDrive");
|
|
9
|
-
const iconChevronRightSmall_1 = require("../../icons/iconChevronRightSmall");
|
|
10
|
-
const Title = ({ isMobile, link, target, title, id, icon, iconType, className = "", onClick }) => {
|
|
11
|
-
const driveClassNames = (0, useDriveClassName_1.useDriveClassName)("zen-card-title");
|
|
12
|
-
const isDrive = (0, useDrive_1.useDrive)();
|
|
13
|
-
const iconClassName = iconType ? `zen-card-title__icon--${iconType}` : "";
|
|
14
|
-
const iconSize = (0, react_1.useMemo)(() => (isDrive ? "huge" : "large"), [isDrive]);
|
|
15
|
-
const iconElement = (0, react_1.useMemo)(() => (icon ? (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-card-title__icon", iconClassName]), children: (0, react_1.createElement)(icon, { size: iconSize }) }) : null), [icon, iconSize, iconClassName]);
|
|
16
|
-
const chevron = (0, react_1.useMemo)(() => ((0, jsx_runtime_1.jsx)("span", { className: "zen-card-title__link-chevron", children: (0, jsx_runtime_1.jsx)(iconChevronRightSmall_1.IconChevronRightSmall, { size: iconSize, className: "zen-card-title__chevron-icon" }) })), [iconSize]);
|
|
17
|
-
const roleProp = onClick ? "button" : undefined;
|
|
18
|
-
const tabIndexProp = onClick ? 0 : undefined;
|
|
19
|
-
const titleClasses = (0, classNames_1.classNames)(["zen-card-title", driveClassNames || "", onClick ? "zen-card-title__clickable" : ""]);
|
|
20
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: titleClasses, role: roleProp, onClick: onClick, tabIndex: tabIndexProp, children: [iconElement, link && !onClick ? ((0, jsx_runtime_1.jsx)("a", { id: id, className: (0, classNames_1.classNames)(["zen-card-title__link"]), href: link, target: target, children: (0, jsx_runtime_1.jsxs)("span", { title: title, className: (0, classNames_1.classNames)(["zen-card-title__link-text"]), children: [title, chevron] }) })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("span", { title: title, id: id, className: (0, classNames_1.classNames)(["zen-card-title__text", isMobile && !isDrive ? "zen-card-title__text--mobile" : "", className]), children: [title, onClick ? chevron : null] }) }))] }));
|
|
21
|
-
};
|
|
22
|
-
exports.Title = Title;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DeviceProvider = exports.DeviceContext = void 0;
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
exports.DeviceContext = react_1.default.createContext(undefined);
|
|
10
|
-
const DeviceProvider = ({ deviceType, children }) => ((0, jsx_runtime_1.jsx)(exports.DeviceContext.Provider, { value: deviceType, children: children }));
|
|
11
|
-
exports.DeviceProvider = DeviceProvider;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } 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 roleProp = onClick ? "button" : undefined;
|
|
15
|
-
const tabIndexProp = onClick ? 0 : undefined;
|
|
16
|
-
const titleClasses = classNames(["zen-card-title", driveClassNames || "", onClick ? "zen-card-title__clickable" : ""]);
|
|
17
|
-
return (_jsxs("div", { className: titleClasses, role: roleProp, onClick: onClick, tabIndex: tabIndexProp, children: [iconElement, link && !onClick ? (_jsx("a", { id: id, className: classNames(["zen-card-title__link"]), href: link, target: target, children: _jsxs("span", { title: title, className: classNames(["zen-card-title__link-text"]), children: [title, chevron] }) })) : (_jsx(_Fragment, { children: _jsxs("span", { title: title, id: id, className: classNames(["zen-card-title__text", isMobile && !isDrive ? "zen-card-title__text--mobile" : "", className]), children: [title, onClick ? chevron : null] }) }))] }));
|
|
18
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import React from "react";
|
|
3
|
-
export const DeviceContext = React.createContext(undefined);
|
|
4
|
-
export const DeviceProvider = ({ deviceType, children }) => (_jsx(DeviceContext.Provider, { value: deviceType, children: children }));
|