@geotab/zenith 1.22.4 → 1.23.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 +13 -0
- package/dist/banner/banner.js +3 -1
- package/dist/banner/bannerMultipLine.d.ts +1 -1
- package/dist/banner/bannerMultipLine.js +2 -2
- package/dist/banner/bannerSingleLine.d.ts +1 -1
- package/dist/banner/bannerSingleLine.js +2 -2
- package/dist/banner/bannerUpsell.d.ts +9 -0
- package/dist/banner/bannerUpsell.js +23 -0
- package/dist/banner/bannerUtils.d.ts +4 -4
- package/dist/banner/bannerUtils.js +9 -9
- package/dist/banner/typeIcon.d.ts +1 -1
- package/dist/banner/typeIcon.js +3 -1
- package/dist/chart/plugins/linePlugin/interfaces.d.ts +1 -0
- package/dist/chart/plugins/linePlugin/linePlugin.js +5 -2
- package/dist/dataGrid/withFlexibleColumns/flexibleColumnsReorder.d.ts +4 -1
- package/dist/dataGrid/withFlexibleColumns/flexibleColumnsReorder.js +34 -2
- package/dist/dataGrid/withFlexibleColumns/withFlexibleColumns.js +1 -1
- package/dist/dateInput/dateInput.js +15 -3
- package/dist/dateRange/dateRange.d.ts +1 -0
- package/dist/dateRange/dateRange.js +19 -5
- package/dist/dropdown/dropdown.js +14 -10
- package/dist/dropdown/dropdownPopup.d.ts +1 -0
- package/dist/dropdown/dropdownPopup.js +2 -6
- package/dist/filtersBar/components/filtersBarDropdown/filtersBarDropdown.js +9 -5
- package/dist/filtersBar/components/filtersBarGroupButton/filtersBarGroupButton.js +1 -1
- package/dist/filtersBar/components/filtersBarGroupsFilter/filtersBarGroupsFilter.js +1 -1
- package/dist/filtersBar/components/filtersBarPeriodPicker/filtersBarPeriodPicker.d.ts +1 -0
- package/dist/filtersBar/components/filtersBarPeriodPicker/filtersBarPeriodPicker.js +1 -1
- package/dist/filtersBar/filtersBar.d.ts +4 -0
- package/dist/filtersBar/filtersBar.js +15 -10
- package/dist/filtersBar/filtersBarProviderTrigger.d.ts +13 -0
- package/dist/filtersBar/filtersBarProviderTrigger.js +15 -0
- package/dist/filtersBar/filtersBarSidePanel/filtersBarSidePanel.d.ts +5 -2
- package/dist/filtersBar/filtersBarSidePanel/filtersBarSidePanel.js +30 -25
- package/dist/gridLayout/utils/convertBannerSizeToState.d.ts +1 -1
- package/dist/gridLayout/utils/convertBannerSizeToState.js +10 -1
- package/dist/gridLayout/utils/getAllowedComponent.js +2 -0
- package/dist/gridLayout/utils/updateGridStateWithDefaultValues.js +2 -1
- package/dist/header/components/mobileFilterControl/mobileFilterControl.d.ts +2 -1
- package/dist/header/components/mobileFilterControl/mobileFilterControl.js +8 -4
- package/dist/header/header.js +50 -10
- package/dist/index.css +89 -26
- package/dist/index.d.ts +3 -1
- package/dist/index.js +22 -16
- package/dist/menu/components/menuSeparator.d.ts +5 -0
- package/dist/menu/components/menuSeparator.js +6 -0
- package/dist/menu/controlledMenu.d.ts +3 -0
- package/dist/menu/controlledMenu.js +23 -1
- package/dist/menu/menu.d.ts +3 -0
- package/dist/menu/menu.js +2 -0
- package/dist/mobileSheet/mobileSheet.d.ts +1 -0
- package/dist/mobileSheet/mobileSheet.js +19 -5
- package/dist/modal/modal.d.ts +1 -0
- package/dist/pagination/pagination.d.ts +1 -0
- package/dist/pagination/pagination.js +3 -3
- package/dist/pagination/paginationArrow.d.ts +1 -1
- package/dist/shield/shield.d.ts +1 -0
- package/dist/shield/shield.js +13 -1
- package/dist/sidePanel/sidePanel.d.ts +1 -0
- package/dist/sidePanel/sidePanel.js +24 -14
- package/dist/sortControl/sortControl.js +4 -2
- package/dist/table/children/tablePagination.d.ts +1 -1
- package/dist/table/children/useTableChildren.js +2 -1
- package/dist/table/flexible/useFlexibleColumns.js +7 -3
- package/dist/table/loading/useLoading.d.ts +1 -0
- package/dist/table/table.d.ts +1 -0
- package/dist/utils/localization/translations/cs-json.d.ts +1 -0
- package/dist/utils/localization/translations/cs-json.js +2 -1
- package/dist/utils/localization/translations/de-json.d.ts +1 -0
- package/dist/utils/localization/translations/de-json.js +2 -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/es-json.d.ts +1 -0
- package/dist/utils/localization/translations/es-json.js +2 -1
- package/dist/utils/localization/translations/fr-FR-json.d.ts +1 -0
- package/dist/utils/localization/translations/fr-FR-json.js +2 -1
- package/dist/utils/localization/translations/fr-json.d.ts +1 -0
- package/dist/utils/localization/translations/fr-json.js +2 -1
- package/dist/utils/localization/translations/id-json.d.ts +1 -0
- package/dist/utils/localization/translations/id-json.js +2 -1
- package/dist/utils/localization/translations/it-json.d.ts +1 -0
- package/dist/utils/localization/translations/it-json.js +2 -1
- package/dist/utils/localization/translations/ja-json.d.ts +1 -0
- package/dist/utils/localization/translations/ja-json.js +2 -1
- package/dist/utils/localization/translations/ko-KR-json.d.ts +1 -0
- package/dist/utils/localization/translations/ko-KR-json.js +2 -1
- package/dist/utils/localization/translations/ms-json.d.ts +1 -0
- package/dist/utils/localization/translations/ms-json.js +2 -1
- package/dist/utils/localization/translations/nl-json.d.ts +1 -0
- package/dist/utils/localization/translations/nl-json.js +2 -1
- package/dist/utils/localization/translations/pl-json.d.ts +1 -0
- package/dist/utils/localization/translations/pl-json.js +2 -1
- package/dist/utils/localization/translations/pt-BR-json.d.ts +1 -0
- package/dist/utils/localization/translations/pt-BR-json.js +2 -1
- package/dist/utils/localization/translations/sv-json.d.ts +1 -0
- package/dist/utils/localization/translations/sv-json.js +2 -1
- package/dist/utils/localization/translations/th-json.d.ts +1 -0
- package/dist/utils/localization/translations/th-json.js +2 -1
- package/dist/utils/localization/translations/tr-json.d.ts +1 -0
- package/dist/utils/localization/translations/tr-json.js +2 -1
- package/dist/utils/localization/translations/zh-Hans-json.d.ts +1 -0
- package/dist/utils/localization/translations/zh-Hans-json.js +2 -1
- package/dist/utils/useFadeComponent.d.ts +8 -0
- package/dist/utils/useFadeComponent.js +38 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -40,6 +40,19 @@ Zenith library provides components defined in Zenith Design System. It includes
|
|
|
40
40
|
|
|
41
41
|
## Change log
|
|
42
42
|
|
|
43
|
+
### 1.23.0
|
|
44
|
+
|
|
45
|
+
* Add the property `target` to `Modal` buttons
|
|
46
|
+
* Add possibility to use separator in `Table` menu
|
|
47
|
+
* Make specific `Table` columns non-draggable
|
|
48
|
+
* Fix long name in Standard list Item
|
|
49
|
+
* Allow tooltip in `LineChart` to appear only on data points
|
|
50
|
+
* Add `BannerUpsell`
|
|
51
|
+
* Audit `SidePanel`
|
|
52
|
+
* Add the property to configure `DateRange` trigger text
|
|
53
|
+
* Add `SortControl` default value translation
|
|
54
|
+
* Add ability to disable `Pagination`
|
|
55
|
+
|
|
43
56
|
### 1.22.4
|
|
44
57
|
|
|
45
58
|
* Prevent `ListItem` to follow link on action click
|
package/dist/banner/banner.js
CHANGED
|
@@ -5,7 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const bannerSingleLine_1 = require("./bannerSingleLine");
|
|
6
6
|
const bannerMultipLine_1 = require("./bannerMultipLine");
|
|
7
7
|
const useMobile_1 = require("../commonHelpers/hooks/useMobile");
|
|
8
|
-
const Banner = ({ children, header, type = "warning", icon, action, size, onClose, multiline, role = "status", ariaAtomic = "true", ariaLive = "polite", className }) => {
|
|
8
|
+
const Banner = ({ children, header, type = "warning", icon, action, size, onClose, multiline, role = "status", ariaAtomic = "true", ariaLive = "polite", primaryAction, className }) => {
|
|
9
9
|
const isMobile = (0, useMobile_1.useMobile)();
|
|
10
10
|
const isMultiline = multiline === undefined ? isMobile : multiline;
|
|
11
11
|
return isMultiline ? (0, jsx_runtime_1.jsx)(bannerMultipLine_1.BannerMultiline, { children,
|
|
@@ -18,6 +18,7 @@ const Banner = ({ children, header, type = "warning", icon, action, size, onClos
|
|
|
18
18
|
role,
|
|
19
19
|
ariaAtomic,
|
|
20
20
|
ariaLive,
|
|
21
|
+
primaryAction,
|
|
21
22
|
className }) : (0, jsx_runtime_1.jsx)(bannerSingleLine_1.BannerSingleLine, { children,
|
|
22
23
|
header,
|
|
23
24
|
type,
|
|
@@ -28,6 +29,7 @@ const Banner = ({ children, header, type = "warning", icon, action, size, onClos
|
|
|
28
29
|
role,
|
|
29
30
|
ariaAtomic,
|
|
30
31
|
ariaLive,
|
|
32
|
+
primaryAction,
|
|
31
33
|
className });
|
|
32
34
|
};
|
|
33
35
|
exports.Banner = Banner;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "./banner.less";
|
|
3
3
|
import { TBannerSize } from "./bannerUtils";
|
|
4
4
|
import { IBannerAction } from "./banner";
|
|
5
|
-
export type BannerType = "error" | "info" | "success" | "warning";
|
|
5
|
+
export type BannerType = "error" | "info" | "success" | "warning" | "upsell";
|
|
6
6
|
export interface IBanner {
|
|
7
7
|
className?: string;
|
|
8
8
|
children: React.ReactNode;
|
|
@@ -15,7 +15,7 @@ const button_1 = require("../button/button");
|
|
|
15
15
|
const useDriveClassName_1 = require("../utils/theme/useDriveClassName");
|
|
16
16
|
const react_1 = require("react");
|
|
17
17
|
const useNodeText_1 = require("../utils/useNodeText");
|
|
18
|
-
const BannerMultiline = ({ children, header, type = "warning", icon, action, onClose, role, ariaAtomic, ariaLive, size = bannerUtils_1.DEFAULT_BANNER_SIZE, className }) => {
|
|
18
|
+
const BannerMultiline = ({ children, header, type = "warning", icon, action, onClose, role, ariaAtomic, ariaLive, size = bannerUtils_1.DEFAULT_BANNER_SIZE, primaryAction, className }) => {
|
|
19
19
|
const bannerOptions = (0, bannerUtils_1.getBannerOptions)(type);
|
|
20
20
|
const { translate } = (0, useLanguage_1.useLanguage)();
|
|
21
21
|
const bannerHeaderClassName = (0, useDriveClassName_1.useDriveClassName)("zen-banner__header");
|
|
@@ -31,6 +31,6 @@ const BannerMultiline = ({ children, header, type = "warning", icon, action, onC
|
|
|
31
31
|
"zen-banner__block--multiline",
|
|
32
32
|
"zen-banner__block--" + size
|
|
33
33
|
]);
|
|
34
|
-
return (0, jsx_runtime_1.jsx)("div", { className: blockClassNames, role: role, "aria-atomic": ariaAtomic, "aria-live": ariaLive, children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-banner__content", "zen-banner__content--multiline", `zen-banner__content--${size}`]), children: [header && (0, jsx_runtime_1.jsxs)("div", { className: "zen-banner__multiline-container", children: [(0, jsx_runtime_1.jsxs)("div", { className: "zen-banner__header-container", children: [icon && header && (0, jsx_runtime_1.jsx)(typeIcon_1.default, { type: type }), header && (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-banner__header", bannerHeaderClassName || ""]), children: header })] }), onClose && (0, jsx_runtime_1.jsx)("button", { type: "button", className: (0, classNames_1.classNames)(["zen-banner__close-button", closeButtonClassName || ""]), onClick: onClose, title: translate("Close"), "aria-label": translate("Close"), children: (0, jsx_runtime_1.jsx)(iconClose_1.IconClose, { size: bannerHeaderClassName ? "huge" : "large" }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "zen-banner__message-container", children: [icon && !header && (0, jsx_runtime_1.jsx)(typeIcon_1.default, { className: "zen-banner__icon-block--top-gap", type: type }), (0, jsx_runtime_1.jsx)("div", { ref: contentRef, title: text, className: (0, classNames_1.classNames)(["zen-banner__message", "zen-banner__message--multiline", bannerMessageClassName || ""]), children: children }), onClose && !header && (0, jsx_runtime_1.jsx)("button", { type: "button", className: "zen-banner__close-button zen-banner__close-button--top-gap", onClick: onClose, title: translate("Close"), "aria-label": translate("Close"), children: (0, jsx_runtime_1.jsx)(iconClose_1.IconClose, { size: bannerHeaderClassName ? "huge" : "large" }) })] }), action && (0, jsx_runtime_1.
|
|
34
|
+
return (0, jsx_runtime_1.jsx)("div", { className: blockClassNames, role: role, "aria-atomic": ariaAtomic, "aria-live": ariaLive, children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-banner__content", "zen-banner__content--multiline", `zen-banner__content--${size}`]), children: [header && (0, jsx_runtime_1.jsxs)("div", { className: "zen-banner__multiline-container", children: [(0, jsx_runtime_1.jsxs)("div", { className: "zen-banner__header-container", children: [icon && header && (0, jsx_runtime_1.jsx)(typeIcon_1.default, { type: type }), header && (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-banner__header", bannerHeaderClassName || ""]), children: header })] }), onClose && (0, jsx_runtime_1.jsx)("button", { type: "button", className: (0, classNames_1.classNames)(["zen-banner__close-button", closeButtonClassName || ""]), onClick: onClose, title: translate("Close"), "aria-label": translate("Close"), children: (0, jsx_runtime_1.jsx)(iconClose_1.IconClose, { size: bannerHeaderClassName ? "huge" : "large" }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "zen-banner__message-container", children: [icon && !header && (0, jsx_runtime_1.jsx)(typeIcon_1.default, { className: "zen-banner__icon-block--top-gap", type: type }), (0, jsx_runtime_1.jsx)("div", { ref: contentRef, title: text, className: (0, classNames_1.classNames)(["zen-banner__message", `zen-banner__message--${size}`, "zen-banner__message--multiline", bannerMessageClassName || ""]), children: children }), onClose && !header && (0, jsx_runtime_1.jsx)("button", { type: "button", className: "zen-banner__close-button zen-banner__close-button--top-gap", onClick: onClose, title: translate("Close"), "aria-label": translate("Close"), children: (0, jsx_runtime_1.jsx)(iconClose_1.IconClose, { size: bannerHeaderClassName ? "huge" : "large" }) })] }), (action || primaryAction) && (0, jsx_runtime_1.jsxs)("div", { className: "zen-banner__action zen-banner__action--multiline", children: [action && (0, jsx_runtime_1.jsx)(button_1.Button, { className: linkClasses, type: buttonType_1.ButtonType.Tertiary, link: action.link, onClick: action.onClick, children: action.text }), primaryAction && (0, jsx_runtime_1.jsx)(button_1.Button, { className: linkClasses, type: buttonType_1.ButtonType.Primary, link: primaryAction.link, onClick: primaryAction.onClick, children: primaryAction.text })] })] }) });
|
|
35
35
|
};
|
|
36
36
|
exports.BannerMultiline = BannerMultiline;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "./banner.less";
|
|
3
3
|
import { TBannerSize } from "./bannerUtils";
|
|
4
4
|
import { IBannerAction } from "./banner";
|
|
5
|
-
export type BannerType = "error" | "info" | "success" | "warning";
|
|
5
|
+
export type BannerType = "error" | "info" | "success" | "warning" | "upsell";
|
|
6
6
|
export interface IBanner {
|
|
7
7
|
className?: string;
|
|
8
8
|
children: React.ReactNode;
|
|
@@ -16,7 +16,7 @@ const useDriveClassName_1 = require("../utils/theme/useDriveClassName");
|
|
|
16
16
|
const useMobile_1 = require("../commonHelpers/hooks/useMobile");
|
|
17
17
|
const react_1 = require("react");
|
|
18
18
|
const useNodeText_1 = require("../utils/useNodeText");
|
|
19
|
-
const BannerSingleLine = ({ children, header, type = "warning", icon, action, onClose, size = bannerUtils_1.DEFAULT_BANNER_SIZE, role, ariaAtomic, ariaLive, className }) => {
|
|
19
|
+
const BannerSingleLine = ({ children, header, type = "warning", icon, action, onClose, size = bannerUtils_1.DEFAULT_BANNER_SIZE, role, ariaAtomic, ariaLive, className, primaryAction }) => {
|
|
20
20
|
const bannerOptions = (0, bannerUtils_1.getBannerOptions)(type);
|
|
21
21
|
const { translate } = (0, useLanguage_1.useLanguage)();
|
|
22
22
|
const bannerHeaderClassName = (0, useDriveClassName_1.useDriveClassName)("zen-banner__header");
|
|
@@ -27,6 +27,6 @@ const BannerSingleLine = ({ children, header, type = "warning", icon, action, on
|
|
|
27
27
|
const text = (0, useNodeText_1.useNodeText)(contentRef);
|
|
28
28
|
const linkClasses = (0, classNames_1.classNames)(["zen-banner__link", "zen-banner__link--" + type]);
|
|
29
29
|
const blockClassNames = (0, classNames_1.classNames)(["zen-banner", "zen-banner__block", bannerOptions.blockClassName, className || "", "zen-banner__block--" + size]);
|
|
30
|
-
return (0, jsx_runtime_1.jsxs)("div", { className: blockClassNames, role: role, "aria-atomic": ariaAtomic, "aria-live": ariaLive, children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-banner__content", `zen-banner__content--${size}`]), children: [icon && (0, jsx_runtime_1.jsx)(typeIcon_1.default, { type: type }), header && (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-banner__header", bannerHeaderClassName || ""]), children: header }), (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-banner__message", bannerMessageClassName || "", isMobile ? "zen-banner__message--mobile" : ""]), ref: contentRef, title: text, children: children }), action && (0, jsx_runtime_1.
|
|
30
|
+
return (0, jsx_runtime_1.jsxs)("div", { className: blockClassNames, role: role, "aria-atomic": ariaAtomic, "aria-live": ariaLive, children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-banner__content", `zen-banner__content--${size}`]), children: [icon && (0, jsx_runtime_1.jsx)(typeIcon_1.default, { type: type }), header && (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-banner__header", bannerHeaderClassName || ""]), children: header }), (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-banner__message", bannerMessageClassName || "", isMobile ? "zen-banner__message--mobile" : ""]), ref: contentRef, title: text, children: children }), (action || primaryAction) && (0, jsx_runtime_1.jsxs)("div", { className: "zen-banner__action", children: [action && (0, jsx_runtime_1.jsx)(button_1.Button, { className: linkClasses, type: buttonType_1.ButtonType.Tertiary, link: action.link, onClick: action.onClick, children: action.text }), primaryAction && (0, jsx_runtime_1.jsx)(button_1.Button, { className: linkClasses, type: buttonType_1.ButtonType.Primary, link: primaryAction.link, onClick: primaryAction.onClick, children: primaryAction.text })] })] }), onClose && (0, jsx_runtime_1.jsx)("button", { type: "button", className: (0, classNames_1.classNames)(["zen-banner__close-button", closeButtonClassName || ""]), onClick: onClose, title: translate("Close"), "aria-label": translate("Close"), children: (0, jsx_runtime_1.jsx)(iconClose_1.IconClose, { size: bannerHeaderClassName ? "huge" : "large" }) })] });
|
|
31
31
|
};
|
|
32
32
|
exports.BannerSingleLine = BannerSingleLine;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { IBanner, IBannerAction } from "./banner";
|
|
3
|
+
import { TBannerSize } from "./bannerUtils";
|
|
4
|
+
interface IBannerUpsell extends Omit<IBanner, "type" | "size" | "translate" | "center" | "close"> {
|
|
5
|
+
primaryAction?: IBannerAction;
|
|
6
|
+
size?: TBannerSize | "XXL";
|
|
7
|
+
}
|
|
8
|
+
export declare const BannerUpsell: FC<IBannerUpsell>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.BannerUpsell = void 0;
|
|
15
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
const banner_1 = require("./banner");
|
|
17
|
+
const BannerUpsell = (_a) => {
|
|
18
|
+
var { icon = true, size = "XXL" } = _a, props = __rest(_a, ["icon", "size"]);
|
|
19
|
+
const type = "upsell";
|
|
20
|
+
const bannerSize = size;
|
|
21
|
+
return (0, jsx_runtime_1.jsx)(banner_1.Banner, Object.assign({}, props, { icon: icon, type: type, size: bannerSize }));
|
|
22
|
+
};
|
|
23
|
+
exports.BannerUpsell = BannerUpsell;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { TIconId } from "../static/icons/icons";
|
|
2
2
|
export type TBannerSize = "XL" | "L" | "M" | "S" | "XS";
|
|
3
3
|
export declare const DEFAULT_BANNER_SIZE: TBannerSize;
|
|
4
|
+
export declare const DEFAULT_BANNER_UPSELL_SIZE: TBannerSize;
|
|
4
5
|
export declare const options: {
|
|
5
6
|
error: {
|
|
6
7
|
blockClassName: string;
|
|
7
|
-
iconId: string;
|
|
8
8
|
};
|
|
9
9
|
info: {
|
|
10
10
|
blockClassName: string;
|
|
11
|
-
iconId: string;
|
|
12
11
|
};
|
|
13
12
|
success: {
|
|
14
13
|
blockClassName: string;
|
|
15
|
-
iconId: string;
|
|
16
14
|
};
|
|
17
15
|
warning: {
|
|
18
16
|
blockClassName: string;
|
|
19
|
-
|
|
17
|
+
};
|
|
18
|
+
upsell: {
|
|
19
|
+
blockClassName: string;
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
export declare const getBannerOptions: (type: string) => {
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBannerOptions = exports.options = exports.DEFAULT_BANNER_SIZE = void 0;
|
|
3
|
+
exports.getBannerOptions = exports.options = exports.DEFAULT_BANNER_UPSELL_SIZE = exports.DEFAULT_BANNER_SIZE = void 0;
|
|
4
4
|
exports.DEFAULT_BANNER_SIZE = "L";
|
|
5
|
+
exports.DEFAULT_BANNER_UPSELL_SIZE = "XXL";
|
|
5
6
|
exports.options = {
|
|
6
7
|
"error": {
|
|
7
|
-
blockClassName: "zen-banner--error"
|
|
8
|
-
iconId: "zen-report-error"
|
|
8
|
+
blockClassName: "zen-banner--error"
|
|
9
9
|
},
|
|
10
10
|
"info": {
|
|
11
|
-
blockClassName: "zen-banner--info"
|
|
12
|
-
iconId: "zen-info-circled"
|
|
11
|
+
blockClassName: "zen-banner--info"
|
|
13
12
|
},
|
|
14
13
|
"success": {
|
|
15
|
-
blockClassName: "zen-banner--success"
|
|
16
|
-
iconId: "zen-checkmark"
|
|
14
|
+
blockClassName: "zen-banner--success"
|
|
17
15
|
},
|
|
18
16
|
"warning": {
|
|
19
|
-
blockClassName: ""
|
|
20
|
-
|
|
17
|
+
blockClassName: ""
|
|
18
|
+
},
|
|
19
|
+
"upsell": {
|
|
20
|
+
blockClassName: "zen-banner--upsell"
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
const getBannerOptions = (type) => exports.options[type] || exports.options.warning;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BannerType } from "./banner";
|
|
2
2
|
import "./banner.less";
|
|
3
3
|
interface ITypeIcon {
|
|
4
|
-
type: BannerType;
|
|
4
|
+
type: BannerType | "upsell";
|
|
5
5
|
className?: string;
|
|
6
6
|
}
|
|
7
7
|
declare const TypeIcon: ({ type, className }: ITypeIcon) => import("react/jsx-runtime").JSX.Element;
|
package/dist/banner/typeIcon.js
CHANGED
|
@@ -8,12 +8,14 @@ const iconWarning_1 = require("../icons/iconWarning");
|
|
|
8
8
|
const iconException_1 = require("../icons/iconException");
|
|
9
9
|
const useDriveClassName_1 = require("../utils/theme/useDriveClassName");
|
|
10
10
|
const classNames_1 = require("../commonHelpers/classNames/classNames");
|
|
11
|
+
const iconGraphPresentation_1 = require("../icons/iconGraphPresentation");
|
|
11
12
|
const TypeIcon = ({ type, className }) => {
|
|
12
13
|
const iconsByType = (0, react_1.useMemo)(() => ({
|
|
13
14
|
"error": iconException_1.IconException,
|
|
14
15
|
"success": iconCheckRadio_1.IconCheckRadio,
|
|
15
16
|
"warning": iconWarning_1.IconWarning,
|
|
16
|
-
"info": iconInfoCircle_1.IconInfoCircle
|
|
17
|
+
"info": iconInfoCircle_1.IconInfoCircle,
|
|
18
|
+
"upsell": iconGraphPresentation_1.IconGraphPresentation
|
|
17
19
|
}), []);
|
|
18
20
|
const bannerDriveClassName = (0, useDriveClassName_1.useDriveClassName)("zen-banner__icon-block");
|
|
19
21
|
return (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-banner__icon-block", className || ""]), children: (0, react_1.createElement)(iconsByType[type], {
|
|
@@ -21,8 +21,11 @@ const LinePlugin = (containerId, options, isDark) => ({
|
|
|
21
21
|
const rect = canvas.getBoundingClientRect();
|
|
22
22
|
const x = event.clientX - rect.left;
|
|
23
23
|
const y = event.clientY - rect.top;
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
// eslint-disable-next-line no-underscore-dangle, @typescript-eslint/no-explicit-any
|
|
25
|
+
const activeElements = (options === null || options === void 0 ? void 0 : options.tooltipOnPoints) ? chart._active : [];
|
|
26
|
+
if (x >= chart.chartArea.left && x <= chart.chartArea.right && (!(options === null || options === void 0 ? void 0 : options.tooltipOnPoints) || activeElements.length > 0)) {
|
|
27
|
+
const sortedPoints = activeElements.sort((a, b) => { var _a, _b; return Math.abs((((_a = a.element) === null || _a === void 0 ? void 0 : _a.x) || 0) - x) - Math.abs((((_b = b.element) === null || _b === void 0 ? void 0 : _b.x) || 0) - x); });
|
|
28
|
+
chart.verticalLine.x = sortedPoints.length > 0 ? sortedPoints[0].element.x : x;
|
|
26
29
|
chart.verticalLine.y = y;
|
|
27
30
|
chart.verticalLine.enabled = true;
|
|
28
31
|
chart.update(); // Trigger redraw
|
|
@@ -10,6 +10,7 @@ export interface IFlexibleColumnReorder {
|
|
|
10
10
|
export declare class FlexibleColumnReorder extends SimpleEventHandler implements IFlexibleColumnReorder {
|
|
11
11
|
private readonly list;
|
|
12
12
|
private readonly resizer;
|
|
13
|
+
private readonly isDraggable;
|
|
13
14
|
private pageX;
|
|
14
15
|
private pageY;
|
|
15
16
|
private offsetLeft;
|
|
@@ -24,6 +25,8 @@ export declare class FlexibleColumnReorder extends SimpleEventHandler implements
|
|
|
24
25
|
private createColumnToDrag;
|
|
25
26
|
private cloneCell;
|
|
26
27
|
private cloneCellContent;
|
|
28
|
+
private getFirstDraggable;
|
|
29
|
+
private getLastDraggable;
|
|
27
30
|
private calculateClosestColumn;
|
|
28
31
|
private readonly preventScroll;
|
|
29
32
|
private readonly stopMoving;
|
|
@@ -31,7 +34,7 @@ export declare class FlexibleColumnReorder extends SimpleEventHandler implements
|
|
|
31
34
|
private readonly endColumn;
|
|
32
35
|
private readonly createDragElement;
|
|
33
36
|
private readonly startColumn;
|
|
34
|
-
constructor(list: HTMLElement, resizer: IFlexibleColumnResizer);
|
|
37
|
+
constructor(list: HTMLElement, resizer: IFlexibleColumnResizer, isDraggable: (index: number) => boolean);
|
|
35
38
|
add(): void;
|
|
36
39
|
remove(): void;
|
|
37
40
|
}
|
|
@@ -35,13 +35,39 @@ class FlexibleColumnReorder extends simpleEventHandler_1.SimpleEventHandler {
|
|
|
35
35
|
p.append(clone);
|
|
36
36
|
parent.append(p);
|
|
37
37
|
}
|
|
38
|
+
getFirstDraggable() {
|
|
39
|
+
for (let i = 0; i < this.columnWidths.length; i++) {
|
|
40
|
+
if (this.isDraggable(i)) {
|
|
41
|
+
return i;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return -1;
|
|
45
|
+
}
|
|
46
|
+
getLastDraggable() {
|
|
47
|
+
for (let i = this.columnWidths.length - 1; i >= 0; --i) {
|
|
48
|
+
if (this.isDraggable(i)) {
|
|
49
|
+
return i;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return -1;
|
|
53
|
+
}
|
|
38
54
|
calculateClosestColumn(e) {
|
|
39
55
|
const shiftX = e.pageX - this.pageX;
|
|
40
56
|
let distanceFromTableStart = this.offsetLeft + shiftX + this.pointerOffset;
|
|
41
|
-
|
|
57
|
+
const firstDraggable = this.getFirstDraggable();
|
|
58
|
+
const lastDraggable = this.getLastDraggable();
|
|
59
|
+
let closest = lastDraggable;
|
|
42
60
|
for (let i = 0; i < this.columnWidths.length; ++i) {
|
|
43
61
|
const w = this.columnWidths[i];
|
|
44
62
|
if (distanceFromTableStart < w) {
|
|
63
|
+
if (i < firstDraggable) {
|
|
64
|
+
closest = firstDraggable;
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
if (i > lastDraggable) {
|
|
68
|
+
closest = lastDraggable + 1;
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
45
71
|
const half = w / 2;
|
|
46
72
|
if (distanceFromTableStart < half) {
|
|
47
73
|
closest = i;
|
|
@@ -55,7 +81,7 @@ class FlexibleColumnReorder extends simpleEventHandler_1.SimpleEventHandler {
|
|
|
55
81
|
}
|
|
56
82
|
return closest;
|
|
57
83
|
}
|
|
58
|
-
constructor(list, resizer) {
|
|
84
|
+
constructor(list, resizer, isDraggable) {
|
|
59
85
|
super();
|
|
60
86
|
Object.defineProperty(this, "list", {
|
|
61
87
|
enumerable: true,
|
|
@@ -69,6 +95,12 @@ class FlexibleColumnReorder extends simpleEventHandler_1.SimpleEventHandler {
|
|
|
69
95
|
writable: true,
|
|
70
96
|
value: resizer
|
|
71
97
|
});
|
|
98
|
+
Object.defineProperty(this, "isDraggable", {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
configurable: true,
|
|
101
|
+
writable: true,
|
|
102
|
+
value: isDraggable
|
|
103
|
+
});
|
|
72
104
|
Object.defineProperty(this, "pageX", {
|
|
73
105
|
enumerable: true,
|
|
74
106
|
configurable: true,
|
|
@@ -123,7 +123,7 @@ function InnerFlColumnsList(props, ref) {
|
|
|
123
123
|
resizerRef.current.add(visibleColumns);
|
|
124
124
|
// reorder
|
|
125
125
|
if (!reordererRef.current) {
|
|
126
|
-
const reorder = new flexibleColumnsReorder_1.FlexibleColumnReorder(gridRef.current, resizerRef.current);
|
|
126
|
+
const reorder = new flexibleColumnsReorder_1.FlexibleColumnReorder(gridRef.current, resizerRef.current, () => true);
|
|
127
127
|
reordererRef.current = reorder;
|
|
128
128
|
}
|
|
129
129
|
reordererRef.current.detach("reorder");
|
|
@@ -30,6 +30,7 @@ const DateInput = ({ className, classNamePopup, defaultValue, value, onChange, i
|
|
|
30
30
|
const dateFormatter = (0, react_1.useCallback)((d) => (0, formatDate_1.formatDate)(toLocalDateTime(d), dateFormat, translate), [dateFormat, toLocalDateTime, translate]);
|
|
31
31
|
const dateDeformatter = (0, react_1.useCallback)((d) => (0, formatDate_1.deformatDate)(d, dateFormat, translate) || new Date(""), [dateFormat, translate]);
|
|
32
32
|
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
33
|
+
const [renderContent, setRenderContent] = (0, react_1.useState)(false);
|
|
33
34
|
const prevIsOpenRef = (0, react_1.useRef)(false);
|
|
34
35
|
const [customDate, setCustomDate] = (0, react_1.useState)(value);
|
|
35
36
|
const triggerRef = (0, react_1.useRef)(null);
|
|
@@ -74,19 +75,30 @@ const DateInput = ({ className, classNamePopup, defaultValue, value, onChange, i
|
|
|
74
75
|
const memoizedHandleClose = (0, react_1.useCallback)(() => {
|
|
75
76
|
setIsOpen(false);
|
|
76
77
|
}, [setIsOpen]);
|
|
78
|
+
const onReadyForFocus = (0, react_1.useCallback)((isCurrentOpen) => {
|
|
79
|
+
if (!isMobile) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (isCurrentOpen) {
|
|
83
|
+
setRenderContent(true);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
setRenderContent(false);
|
|
87
|
+
prevIsOpenRef.current = isCurrentOpen;
|
|
88
|
+
}, [isMobile]);
|
|
77
89
|
const component = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsx)("div", { className: "zen-date-input-inner__calendar-wrapper", children: (0, jsx_runtime_1.jsx)(dateInputInner_1.DateInputInner, { id: id || componentId, value: { from: customDate, to: undefined }, onChange: onCalendarChange, dateFormat: dateFormat, dateFormatter: dateFormatter, dateDeformatter: dateDeformatter, startDayOfWeek: weekStartsOnSunday ? 0 : 1, dateRangeMode: false, selectTime: timeSelect, disableFutureDates: disableFutureDates, disablePastDates: disablePastDates, disableDatesAfter: disableDatesAfter, disableDatesBefore: disableDatesBefore, title: "", isMobileView: isMobile, requireSelection: requireSelection }) }), [componentId, customDate, dateDeformatter, dateFormat, dateFormatter, disableDatesAfter, disableDatesBefore, disableFutureDates, disablePastDates, id, isMobile, onCalendarChange, requireSelection, timeSelect, weekStartsOnSunday]);
|
|
78
90
|
const memoizedDesktopView = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsx)(controlledPopup_1.ControlledPopup, { className: (0, classNames_1.classNames)(["zen-date-input-popup-wrapper", driveWrapperClassName || ""]), ariaLabel: translate("Pick a date"), useTrapFocusWithTrigger: "on", triggerRef: triggerRef, onOpenChange: setIsOpen, shouldHoldScroll: true, isOpen: isOpen, recalculateOnScroll: true, children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-date-input-popup", drivePopupClassName || "", classNamePopup !== null && classNamePopup !== void 0 ? classNamePopup : ""]), children: [(0, jsx_runtime_1.jsx)("div", { className: "zen-date-input-popup__header", children: title }), component, (0, jsx_runtime_1.jsxs)("div", { className: "zen-date-input-popup__footer", children: [(0, jsx_runtime_1.jsx)(button_1.Button, { className: "zen-date-input-popup__button-clear", type: buttonType_1.ButtonType.Tertiary, disabled: isDefaultState, onClick: handleClearClick, children: translate("Clear") }), (0, jsx_runtime_1.jsx)(button_1.Button, { className: "zen-date-input-popup__button-apply", type: buttonType_1.ButtonType.Primary, disabled: isValueState || (requireSelection && !customDate), onClick: handleApplyClick, children: translate("Apply") })] })] }) }), [classNamePopup, component, customDate, drivePopupClassName, driveWrapperClassName, handleApplyClick, handleClearClick, isDefaultState, isOpen, isValueState, requireSelection, title, translate]);
|
|
79
91
|
const memoizedMobileFooter = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsxs)(footerButtons_1.FooterButtons, { children: [(0, jsx_runtime_1.jsx)(button_1.Button, { type: buttonType_1.ButtonType.Primary, disabled: isValueState || (requireSelection && !customDate), onClick: handleApplyClick, children: translate("Apply") }), (0, jsx_runtime_1.jsx)(button_1.Button, { type: buttonType_1.ButtonType.Tertiary, disabled: isDefaultState, onClick: handleClearClick, children: translate("Clear") })] }), [customDate, handleApplyClick, handleClearClick, isDefaultState, isValueState, requireSelection, translate]);
|
|
80
|
-
const memoizedMobileView = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsxs)(mobileSheet_1.MobileSheet, { className: (0, classNames_1.classNames)(["zen-date-input-mobile-sheet", classNamePopup ? `${classNamePopup}--mobile-sheet` : ""]), label: translate("Pick a date"), triggerRef: triggerRef, isOpen: isOpen, onHidePanel: memoizedHandleClose, onCloseClick: memoizedHandleClose, useTrapFocusWithTrigger: true, children: [(0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Title, { children: title }), (0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Content, { children: component }), (0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Footer, { children: memoizedMobileFooter })] }), [classNamePopup, component, isOpen, memoizedHandleClose, memoizedMobileFooter, title, translate]);
|
|
92
|
+
const memoizedMobileView = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsxs)(mobileSheet_1.MobileSheet, { className: (0, classNames_1.classNames)(["zen-date-input-mobile-sheet", classNamePopup ? `${classNamePopup}--mobile-sheet` : ""]), label: translate("Pick a date"), triggerRef: triggerRef, isOpen: isOpen, onHidePanel: memoizedHandleClose, onCloseClick: memoizedHandleClose, useTrapFocusWithTrigger: true, onReadyForFocus: onReadyForFocus, children: [(0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Title, { children: title }), (0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Content, { children: renderContent ? component : null }), (0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Footer, { children: memoizedMobileFooter })] }), [classNamePopup, component, isOpen, memoizedHandleClose, memoizedMobileFooter, onReadyForFocus, renderContent, title, translate]);
|
|
81
93
|
(0, react_1.useEffect)(() => {
|
|
82
|
-
if (!isOpen && prevIsOpenRef.current) {
|
|
94
|
+
if (!isMobile && !isOpen && prevIsOpenRef.current) {
|
|
83
95
|
setTimeout(() => {
|
|
84
96
|
var _a;
|
|
85
97
|
(_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
86
98
|
}, 0);
|
|
87
99
|
}
|
|
88
100
|
prevIsOpenRef.current = isOpen;
|
|
89
|
-
}, [isOpen]);
|
|
101
|
+
}, [isOpen, isMobile]);
|
|
90
102
|
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(textIconButton_1.TextIconButton, { id: id || undefined, htmlType: "button", icon: iconCalendar_1.IconCalendar, iconPosition: textIconButton_1.ButtonIconPosition.Start, className: cssClass, disabled: disabled, onClick: toggleVisibility, ref: triggerRef, children: getButtonLabel() }), isMobile ? memoizedMobileView : memoizedDesktopView, (0, jsx_runtime_1.jsx)(formFieldError_1.FormFieldError, { error: error })] });
|
|
91
103
|
};
|
|
92
104
|
exports.DateInput = DateInput;
|
|
@@ -5,6 +5,7 @@ import { IDateRangeValue, IDateRangeValueOptionalLabel, TDateRangeOption } from
|
|
|
5
5
|
import { TButton } from "../button/buttonType";
|
|
6
6
|
interface IDateRangeBase extends IZenComponentProps {
|
|
7
7
|
options: TDateRangeOption[];
|
|
8
|
+
triggerLabel?: string;
|
|
8
9
|
className?: string;
|
|
9
10
|
classNamePopup?: string;
|
|
10
11
|
classNameWrapper?: string;
|
|
@@ -38,7 +38,7 @@ const parseLabel = (option, dateFormat, translate, toLacalFn) => {
|
|
|
38
38
|
};
|
|
39
39
|
exports.parseLabel = parseLabel;
|
|
40
40
|
// eslint-disable-next-line complexity
|
|
41
|
-
const DateRange = ({ className, classNamePopup, defaultValue, value, onChange, options: optionsArg, type, id, disabled, dropDownTitle, hasApplyButton, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter, withCalendar, lockStartDate, lockEndDate, timeSelect, error, allowUnsetValue = false, stepper = false, classNameWrapper }) => {
|
|
41
|
+
const DateRange = ({ className, classNamePopup, defaultValue, value, onChange, options: optionsArg, type, id, disabled, dropDownTitle, hasApplyButton, disableFutureDates, disablePastDates, disableDatesBefore, triggerLabel, disableDatesAfter, withCalendar, lockStartDate, lockEndDate, timeSelect, error, allowUnsetValue = false, stepper = false, classNameWrapper }) => {
|
|
42
42
|
var _a;
|
|
43
43
|
const { translate } = (0, useLanguage_1.useLanguage)();
|
|
44
44
|
const [alertReason, setAlertReason] = (0, react_1.useState)("");
|
|
@@ -53,6 +53,7 @@ const DateRange = ({ className, classNamePopup, defaultValue, value, onChange, o
|
|
|
53
53
|
const previousStepOption = (0, react_1.useRef)("");
|
|
54
54
|
const [selectedRange, setSelectedRange] = (0, react_1.useState)((0, getRangeOption_1.getSelectedRangeFromValue)(optionsMap, value));
|
|
55
55
|
const isDefaultState = !defaultValue && !selectedRange || (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.label) === (selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label);
|
|
56
|
+
const [renderContent, setRenderContent] = (0, react_1.useState)(false);
|
|
56
57
|
const isCustomDateOption = (selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label) === dateRangeInner_1.CUSTOM_CALENDAR_ID;
|
|
57
58
|
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
58
59
|
const prevIsOpenRef = (0, react_1.useRef)(false);
|
|
@@ -183,6 +184,17 @@ const DateRange = ({ className, classNamePopup, defaultValue, value, onChange, o
|
|
|
183
184
|
const memoizedHandleClose = (0, react_1.useCallback)(() => {
|
|
184
185
|
setIsOpen(false);
|
|
185
186
|
}, [setIsOpen]);
|
|
187
|
+
const onReadyForFocus = (0, react_1.useCallback)((isCurrentOpen) => {
|
|
188
|
+
if (!isMobile) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
if (isCurrentOpen) {
|
|
192
|
+
setRenderContent(true);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
setRenderContent(false);
|
|
196
|
+
prevIsOpenRef.current = isCurrentOpen;
|
|
197
|
+
}, [isMobile]);
|
|
186
198
|
const isValueNotChanged = (0, react_1.useMemo)(() => {
|
|
187
199
|
if (!hasApplyButton) {
|
|
188
200
|
return false;
|
|
@@ -194,6 +206,7 @@ const DateRange = ({ className, classNamePopup, defaultValue, value, onChange, o
|
|
|
194
206
|
}, [customDate.from, customDate.to, hasApplyButton, isCustomDateOption, selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label, value === null || value === void 0 ? void 0 : value.from, value === null || value === void 0 ? void 0 : value.label, value === null || value === void 0 ? void 0 : value.to]);
|
|
195
207
|
const memoizedDesktopView = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsx)(controlledPopup_1.ControlledPopup, { className: (0, classNames_1.classNames)(["zen-date-range-popup-wrapper", driveWrapperPopupClassName || ""]), ariaLabel: translate("Date range"), useTrapFocusWithTrigger: "on", role: "dialog", triggerRef: triggerRef, onOpenChange: setIsOpen, shouldHoldScroll: true, isOpen: isOpen, recalculateOnScroll: true, children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-date-range-popup", drivePopupClassName || "", classNamePopup !== null && classNamePopup !== void 0 ? classNamePopup : ""]), children: [(0, jsx_runtime_1.jsx)("div", { className: "zen-date-range-popup__header", children: title }), component, (0, jsx_runtime_1.jsxs)("div", { className: "zen-date-range-popup__footer", children: [(0, jsx_runtime_1.jsx)(button_1.Button, { className: "zen-date-range-popup__button-clear", type: buttonType_1.ButtonType.Tertiary, disabled: isDefaultState, onClick: handleClearClick, children: translate("Clear") }), (!isCustomDateOption && hasApplyButton) &&
|
|
196
208
|
(0, jsx_runtime_1.jsx)(button_1.Button, { className: "zen-date-range-popup__button-reset", type: buttonType_1.ButtonType.Secondary, onClick: handleCancelClick, children: translate("Cancel") }), (isCustomDateOption || hasApplyButton) && (0, jsx_runtime_1.jsx)(button_1.Button, { className: "zen-date-range-popup__button-apply", type: buttonType_1.ButtonType.Primary, disabled: (isCustomDateOption && (!customDate.from || !customDate.to)) || isValueNotChanged || !selectedRange, onClick: handleApplyClick, children: translate("Apply") })] })] }) }), [classNamePopup, component, customDate.from, customDate.to, drivePopupClassName, driveWrapperPopupClassName, handleApplyClick, handleCancelClick, handleClearClick, hasApplyButton, isCustomDateOption, isDefaultState, isOpen, isValueNotChanged, selectedRange, title, translate]);
|
|
209
|
+
const notFocusedComponent = (0, react_1.useMemo)(() => !range.from && !range.to, [range.from, range.to]);
|
|
197
210
|
const memoizedMobileFooter = (0, react_1.useMemo)(() => {
|
|
198
211
|
const clearButton = (0, jsx_runtime_1.jsx)(button_1.Button, { type: buttonType_1.ButtonType.Tertiary, disabled: isDefaultState, onClick: handleClearClick, children: translate("Clear") });
|
|
199
212
|
const cancelButton = hasApplyButton && !showMobileCalendar ? (0, jsx_runtime_1.jsx)(button_1.Button, { type: buttonType_1.ButtonType.Secondary, onClick: handleCancelClick, children: translate("Cancel") }) : null;
|
|
@@ -202,7 +215,8 @@ const DateRange = ({ className, classNamePopup, defaultValue, value, onChange, o
|
|
|
202
215
|
return (0, jsx_runtime_1.jsxs)(footerButtons_1.FooterButtons, { children: [applyButton, cancelButton, clearButton] });
|
|
203
216
|
}, [customDate.from, customDate.to, handleApplyClick, handleCancelClick, handleClearClick, hasApplyButton, isCustomDateOption, isDefaultState, isValueNotChanged, selectedRange,
|
|
204
217
|
showMobileCalendar, translate]);
|
|
205
|
-
const memoizedMobileView = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsxs)(mobileSheet_1.MobileSheet, { className: (0, classNames_1.classNames)(["zen-date-range-mobile-sheet", classNamePopup ? `${classNamePopup}--mobile-sheet` : ""]), label: translate("Date range"), triggerRef: triggerRef, isOpen: isOpen, onHidePanel: memoizedHandleClose, onCloseClick: memoizedHandleClose, useTrapFocusWithTrigger: true, isBackVisible: showMobileCalendar, onBackClick: handleMobileBackClick, children: [(0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Title, { children: showMobileCalendar ? calendarLabel : title }), (0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Content, { children: component }), (0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Footer, { children: memoizedMobileFooter })] }), [calendarLabel, classNamePopup, component, handleMobileBackClick, isOpen, memoizedHandleClose, memoizedMobileFooter,
|
|
218
|
+
const memoizedMobileView = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsxs)(mobileSheet_1.MobileSheet, { className: (0, classNames_1.classNames)(["zen-date-range-mobile-sheet", classNamePopup ? `${classNamePopup}--mobile-sheet` : ""]), label: translate("Date range"), triggerRef: triggerRef, isOpen: isOpen, onHidePanel: memoizedHandleClose, onCloseClick: memoizedHandleClose, useTrapFocusWithTrigger: notFocusedComponent ? false : true, isBackVisible: showMobileCalendar, onBackClick: handleMobileBackClick, onReadyForFocus: onReadyForFocus, children: [(0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Title, { children: showMobileCalendar ? calendarLabel : title }), (0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Content, { children: renderContent ? component : null }), (0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Footer, { children: memoizedMobileFooter })] }), [calendarLabel, classNamePopup, component, handleMobileBackClick, isOpen, memoizedHandleClose, memoizedMobileFooter, notFocusedComponent,
|
|
219
|
+
onReadyForFocus, renderContent, showMobileCalendar, title, translate]);
|
|
206
220
|
const checkIsRangeDisable = (0, react_1.useCallback)((isIncrease) => {
|
|
207
221
|
if (!selectedRange) {
|
|
208
222
|
return true;
|
|
@@ -237,15 +251,15 @@ const DateRange = ({ className, classNamePopup, defaultValue, value, onChange, o
|
|
|
237
251
|
setIsOpen(true);
|
|
238
252
|
}, []);
|
|
239
253
|
(0, react_1.useEffect)(() => {
|
|
240
|
-
if (!isOpen && prevIsOpenRef.current) {
|
|
254
|
+
if (!isMobile && !isOpen && prevIsOpenRef.current) {
|
|
241
255
|
setTimeout(() => {
|
|
242
256
|
var _a;
|
|
243
257
|
(_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
244
258
|
}, 0);
|
|
245
259
|
}
|
|
246
260
|
prevIsOpenRef.current = isOpen;
|
|
247
|
-
}, [isOpen]);
|
|
248
|
-
const buttonLabel = (0, react_1.useMemo)(() => getButtonLabel((0, getRangeOption_1.getSelectedRangeFromValue)(optionsMap, value)), [getButtonLabel, optionsMap, value]);
|
|
261
|
+
}, [isOpen, isMobile]);
|
|
262
|
+
const buttonLabel = (0, react_1.useMemo)(() => triggerLabel && !stepper ? triggerLabel : getButtonLabel((0, getRangeOption_1.getSelectedRangeFromValue)(optionsMap, value)), [getButtonLabel, optionsMap, value, triggerLabel, stepper]);
|
|
249
263
|
const currentLabel = (_a = (0, getRangeOption_1.getSelectedRangeFromValue)(optionsMap, value)) === null || _a === void 0 ? void 0 : _a.label;
|
|
250
264
|
const cssClass = (0, classNames_1.classNames)([
|
|
251
265
|
"zen-date-range",
|
|
@@ -272,9 +272,12 @@ const Dropdown = ({ className, classNamePopup, getData, errorHandler, dataItems,
|
|
|
272
272
|
newVal && controlData(currentAbort.signal, state.inputValue);
|
|
273
273
|
!newVal && dispatchState({ type: stateActionType_1.StateActionType.SetInputValue, payload: "" });
|
|
274
274
|
}, [controlData, state.inputValue]);
|
|
275
|
-
(0, react_1.
|
|
275
|
+
const handleReadyForFocus = (0, react_1.useCallback)((isCurrentOpen) => {
|
|
276
276
|
var _a;
|
|
277
|
-
if (!state.
|
|
277
|
+
if (!state.showList) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
if (!isCurrentOpen) {
|
|
278
281
|
return;
|
|
279
282
|
}
|
|
280
283
|
const firstFocusable = (_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(focusableSelector_1.FOCUSABLE_SELECTOR);
|
|
@@ -285,20 +288,21 @@ const Dropdown = ({ className, classNamePopup, getData, errorHandler, dataItems,
|
|
|
285
288
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
286
289
|
(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) && inputRef.current.focus();
|
|
287
290
|
}
|
|
288
|
-
}, [
|
|
291
|
+
}, [searchField, state.currentId, state.showList, contentRef]);
|
|
289
292
|
(0, react_1.useEffect)(() => {
|
|
290
293
|
var _a;
|
|
291
|
-
if (!
|
|
294
|
+
if (!state.isOpenCombo || !state.showList) {
|
|
292
295
|
return;
|
|
293
296
|
}
|
|
294
297
|
const firstFocusable = (_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(focusableSelector_1.FOCUSABLE_SELECTOR);
|
|
295
|
-
if (firstFocusable && (state.currentId
|
|
298
|
+
if (firstFocusable && (state.currentId || !searchField)) {
|
|
296
299
|
firstFocusable.focus();
|
|
297
|
-
return;
|
|
298
300
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
301
|
+
else {
|
|
302
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
303
|
+
(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) && inputRef.current.focus();
|
|
304
|
+
}
|
|
305
|
+
}, [state.isOpenCombo, state.currentId, state.showList, searchField]);
|
|
302
306
|
(0, react_1.useEffect)(() => {
|
|
303
307
|
if ((Object.keys(state.groupsMap).length === 0 && Object.keys(state.groupsMapSelected).length === 0) || !getNamedItems || getNamedItemsHasBeenCalled.current) {
|
|
304
308
|
return undefined;
|
|
@@ -385,7 +389,7 @@ const Dropdown = ({ className, classNamePopup, getData, errorHandler, dataItems,
|
|
|
385
389
|
: (0, dropdownHelper_1.getStringFromSelected)(hasApplyButton ? state.globalSelectedIds : state.selectedIds, state.groupsMapSelected, translate);
|
|
386
390
|
const memoizedCurrentSelection = (0, react_1.useMemo)(() => showSelection && !state.inputValue ? currentStringFromSelected : "", [showSelection, state.inputValue, currentStringFromSelected]);
|
|
387
391
|
const parentTriggerWidth = ((_a = comboboxRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width) || 420;
|
|
388
|
-
return (0, jsx_runtime_1.jsxs)("div", { className: containerClassName, ref: comboboxRef, children: [(0, jsx_runtime_1.jsx)(dropdownTrigger_1.DropdownTrigger, { className: (0, classNames_1.classNames)([!width && !fullWidthTriggerButton && parentTriggerWidth < 420 && !searchField ? "zen-dropdown__trigger-button--width-parent" : ""]), currentSelection: memoizedCurrentSelection, isActive: state.isOpenCombo, id: inputId, disabled: disabled, count: showCounterPill ? countSelected : 0, fullWidth: fullWidthTriggerButton, inputValue: state.inputValue, placeholder: placeholder || translate("Filter by group"), searchField: searchField && !isMobile ? searchField : false, onSearchChange: onSearchChange, handleClick: handleTriggerClick, width: width && width > 420 ? 420 : width, title: title, triggerAriaLabel: triggerAriaLabel, triggerRef: triggerRef, inputRef: inputRef, buttonType: buttonType, error: error }), (0, jsx_runtime_1.jsx)(dropdownPopup_1.DropdownPopup, { alignment: alignment, triggerRef: triggerRef, classNamePopup: classNamePopup, isMobile: isMobile, dialogAriaLabel: dialogAriaLabel, disabled: disabled, filterName: filterName, hasApplyButton: hasApplyButton, inputId: inputId, isClearButtonDisabled: memoizedIsClearButtonDisabled, isApplyButtonDisabled: memoizedIsApplyButtonDisabled, isWithFooter: memoizedWithFooter, isOpenCombo: state.isOpenCombo, searchField: searchField, placeholder: placeholder, inputValue: state.inputValue, handleApplyClick: handleApplyClick, handleClearClick: multiselect ? handleClearClick : handleSingleSelection.bind(this, true), handleTriggerClick: handleTriggerClick, onInputChange: onInputChange, inputRef: inputRef, contentRef: contentRef, children: getPopupContent })] });
|
|
392
|
+
return (0, jsx_runtime_1.jsxs)("div", { className: containerClassName, ref: comboboxRef, children: [(0, jsx_runtime_1.jsx)(dropdownTrigger_1.DropdownTrigger, { className: (0, classNames_1.classNames)([!width && !fullWidthTriggerButton && parentTriggerWidth < 420 && !searchField ? "zen-dropdown__trigger-button--width-parent" : ""]), currentSelection: memoizedCurrentSelection, isActive: state.isOpenCombo, id: inputId, disabled: disabled, count: showCounterPill ? countSelected : 0, fullWidth: fullWidthTriggerButton, inputValue: state.inputValue, placeholder: placeholder || translate("Filter by group"), searchField: searchField && !isMobile ? searchField : false, onSearchChange: onSearchChange, handleClick: handleTriggerClick, width: width && width > 420 ? 420 : width, title: title, triggerAriaLabel: triggerAriaLabel, triggerRef: triggerRef, inputRef: inputRef, buttonType: buttonType, error: error }), (0, jsx_runtime_1.jsx)(dropdownPopup_1.DropdownPopup, { alignment: alignment, triggerRef: triggerRef, classNamePopup: classNamePopup, isMobile: isMobile, dialogAriaLabel: dialogAriaLabel, disabled: disabled, filterName: filterName, hasApplyButton: hasApplyButton, inputId: inputId, isClearButtonDisabled: memoizedIsClearButtonDisabled, isApplyButtonDisabled: memoizedIsApplyButtonDisabled, isWithFooter: memoizedWithFooter, isOpenCombo: state.isOpenCombo, searchField: searchField, placeholder: placeholder, inputValue: state.inputValue, handleApplyClick: handleApplyClick, handleClearClick: multiselect ? handleClearClick : handleSingleSelection.bind(this, true), handleTriggerClick: handleTriggerClick, onInputChange: onInputChange, inputRef: inputRef, contentRef: contentRef, onReadyForFocus: handleReadyForFocus, children: getPopupContent })] });
|
|
389
393
|
};
|
|
390
394
|
exports.Dropdown = Dropdown;
|
|
391
395
|
exports.TRANSLATIONS = [
|
|
@@ -24,5 +24,6 @@ export interface IDropdownPopup extends IZenComponentProps {
|
|
|
24
24
|
onInputChange: (newValue?: string) => void;
|
|
25
25
|
inputRef: React.MutableRefObject<HTMLInputElement>;
|
|
26
26
|
contentRef: React.RefObject<HTMLDivElement>;
|
|
27
|
+
onReadyForFocus?: (isCurrentOpen: boolean) => void;
|
|
27
28
|
}
|
|
28
29
|
export declare const DropdownPopup: React.FC<IDropdownPopup>;
|
|
@@ -11,13 +11,9 @@ const classNames_1 = require("../commonHelpers/classNames/classNames");
|
|
|
11
11
|
const searchInput_1 = require("../searchInput/searchInput");
|
|
12
12
|
const useLanguage_1 = require("../utils/localization/useLanguage");
|
|
13
13
|
const footerButtons_1 = require("../footerButtons/footerButtons");
|
|
14
|
-
const DropdownPopup = ({ alignment, triggerRef, classNamePopup, isMobile, inputValue, dialogAriaLabel, disabled, filterName, handleApplyClick, handleClearClick, handleTriggerClick, onInputChange, hasApplyButton, inputId, isClearButtonDisabled, isWithFooter, placeholder, searchField, isApplyButtonDisabled, isOpenCombo, inputRef, contentRef, children }) => {
|
|
14
|
+
const DropdownPopup = ({ alignment, triggerRef, classNamePopup, isMobile, inputValue, dialogAriaLabel, disabled, filterName, handleApplyClick, handleClearClick, handleTriggerClick, onInputChange, hasApplyButton, inputId, isClearButtonDisabled, isWithFooter, placeholder, searchField, isApplyButtonDisabled, isOpenCombo, inputRef, contentRef, children, onReadyForFocus }) => {
|
|
15
15
|
const { translate } = (0, useLanguage_1.useLanguage)();
|
|
16
16
|
const triggerId = (0, react_1.useId)();
|
|
17
|
-
const memoizedHandleClose = (0, react_1.useCallback)(() => {
|
|
18
|
-
onInputChange("");
|
|
19
|
-
handleTriggerClick(false);
|
|
20
|
-
}, [handleTriggerClick, onInputChange]);
|
|
21
17
|
const memoizedHandleHide = (0, react_1.useCallback)(() => {
|
|
22
18
|
handleTriggerClick(false);
|
|
23
19
|
}, [handleTriggerClick]);
|
|
@@ -28,7 +24,7 @@ const DropdownPopup = ({ alignment, triggerRef, classNamePopup, isMobile, inputV
|
|
|
28
24
|
}
|
|
29
25
|
return (0, jsx_runtime_1.jsxs)(footerButtons_1.FooterButtons, { children: [hasApplyButton ? (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: handleApplyClick, type: buttonType_1.ButtonType.Primary, disabled: isApplyButtonDisabled, className: "zen-ellipsis", title: translate("Apply"), children: translate("Apply") }) : null, (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: handleClearClick, disabled: isClearButtonDisabled, className: "zen-ellipsis", type: buttonType_1.ButtonType.Tertiary, title: translate("Clear"), children: translate("Clear") })] });
|
|
30
26
|
}, [handleApplyClick, handleClearClick, hasApplyButton, isApplyButtonDisabled, isClearButtonDisabled, isWithFooter, translate]);
|
|
31
|
-
const memoizedMobileView = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsxs)(mobileSheet_1.MobileSheet, { className: (0, classNames_1.classNames)(["zen-dropdown--mobile", classNamePopup || ""]), label: "label", triggerRef: triggerRef, isOpen: isOpenCombo, onHidePanel: memoizedHandleHide, onCloseClick:
|
|
27
|
+
const memoizedMobileView = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsxs)(mobileSheet_1.MobileSheet, { className: (0, classNames_1.classNames)(["zen-dropdown--mobile", classNamePopup || ""]), label: "label", triggerRef: triggerRef, isOpen: isOpenCombo, onHidePanel: memoizedHandleHide, onCloseClick: memoizedHandleHide, useTrapFocusWithTrigger: true, onReadyForFocus: onReadyForFocus, children: [(0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Title, { className: "zen-dropdown-mobile-sheet__title", children: filterName || placeholder || "" }), (0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Content, { children: memoizedMobileContent }), (0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Footer, { children: memoizedMobileFooter })] }), [classNamePopup, filterName, isOpenCombo, onReadyForFocus, memoizedHandleHide, memoizedMobileContent, memoizedMobileFooter, placeholder, triggerRef]);
|
|
32
28
|
const memoizedDesktopView = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsx)(controlledPopup_1.ControlledPopup, { isOpen: isOpenCombo, className: (0, classNames_1.classNames)(["zen-dropdown-popup zen-shadow-dropdown-default", classNamePopup || ""]), onOpenChange: handleTriggerClick, useTrapFocusWithTrigger: "withTrigger", alignment: alignment, shouldHoldScroll: true, triggerRef: triggerRef, ariaLabel: dialogAriaLabel || placeholder || translate("Filter by group"), recalculateOnScroll: true, children: (0, jsx_runtime_1.jsx)("div", { ref: contentRef, children: children }) }), [alignment, children, classNamePopup, contentRef, dialogAriaLabel, handleTriggerClick, isOpenCombo, placeholder, translate, triggerRef]);
|
|
33
29
|
return isMobile ? memoizedMobileView : memoizedDesktopView;
|
|
34
30
|
};
|