@geotab/zenith 3.5.0 → 3.5.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 +4 -0
- package/dist/index.css +57 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -3
- package/dist/list/hooks/useDragAndDrop.d.ts +19 -1
- package/dist/list/hooks/useDragAndDrop.js +65 -26
- package/dist/list/utils/findElement.d.ts +1 -0
- package/dist/list/utils/findElement.js +13 -0
- package/dist/list/utils/findItemPosition.d.ts +1 -1
- package/dist/list/utils/findItemPosition.js +2 -2
- package/dist/list/utils/isDragNotClick.d.ts +6 -0
- package/dist/list/utils/isDragNotClick.js +9 -0
- package/dist/nav/context/nav.context.d.ts +2 -0
- package/dist/nav/context/nav.context.js +3 -1
- package/dist/nav/nav.js +20 -8
- package/dist/nav/navEditList/navEditList.d.ts +7 -0
- package/dist/nav/navEditList/navEditList.js +22 -0
- package/dist/nav/navEditList/navEditListUtils.d.ts +3 -0
- package/dist/nav/navEditList/navEditListUtils.js +14 -0
- package/dist/nav/navEditSection/navEditSection.d.ts +3 -0
- package/dist/nav/navEditSection/navEditSection.js +7 -0
- package/dist/nav/navFooter/navEditFooter/navEditFooter.d.ts +11 -0
- package/dist/nav/navFooter/navEditFooter/navEditFooter.js +110 -0
- package/dist/nav/navFooter/navFooter.d.ts +2 -7
- package/dist/nav/navFooter/navFooter.js +4 -4
- package/dist/nav/navItem/navActionItem.d.ts +14 -0
- package/dist/nav/navItem/navActionItem.js +15 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/list/hooks/useDragAndDrop.d.ts +19 -1
- package/esm/list/hooks/useDragAndDrop.js +65 -26
- package/esm/list/utils/findElement.d.ts +1 -0
- package/esm/list/utils/findElement.js +9 -0
- package/esm/list/utils/findItemPosition.d.ts +1 -1
- package/esm/list/utils/findItemPosition.js +2 -2
- package/esm/list/utils/isDragNotClick.d.ts +6 -0
- package/esm/list/utils/isDragNotClick.js +5 -0
- package/esm/nav/context/nav.context.d.ts +2 -0
- package/esm/nav/context/nav.context.js +3 -1
- package/esm/nav/nav.js +21 -9
- package/esm/nav/navEditList/navEditList.d.ts +7 -0
- package/esm/nav/navEditList/navEditList.js +18 -0
- package/esm/nav/navEditList/navEditListUtils.d.ts +3 -0
- package/esm/nav/navEditList/navEditListUtils.js +10 -0
- package/esm/nav/navEditSection/navEditSection.d.ts +3 -0
- package/esm/nav/navEditSection/navEditSection.js +3 -0
- package/esm/nav/navFooter/navEditFooter/navEditFooter.d.ts +11 -0
- package/esm/nav/navFooter/navEditFooter/navEditFooter.js +101 -0
- package/esm/nav/navFooter/navFooter.d.ts +2 -7
- package/esm/nav/navFooter/navFooter.js +4 -4
- package/esm/nav/navItem/navActionItem.d.ts +14 -0
- package/esm/nav/navItem/navActionItem.js +11 -0
- package/package.json +4 -4
- package/dist/list/utils/findListElement.d.ts +0 -1
- package/dist/list/utils/findListElement.js +0 -13
- package/esm/list/utils/findListElement.d.ts +0 -1
- package/esm/list/utils/findListElement.js +0 -9
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import "./navEditFooter.less";
|
|
3
|
+
import { IZenComponentProps } from "../../../commonHelpers/zenComponent";
|
|
4
|
+
/**
|
|
5
|
+
* @beta This component is not fully ready yet and may change in future releases.
|
|
6
|
+
*/
|
|
7
|
+
export interface INavEditFooter extends IZenComponentProps {
|
|
8
|
+
handleSaveClick: () => void;
|
|
9
|
+
handleCancelClick: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const NavEditFooter: React.FC<INavEditFooter>;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { injectString } from "../../../utils/localization/translationsDictionary";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from "../../../button/button";
|
|
4
|
+
import { classNames } from "../../../commonHelpers/classNames/classNames";
|
|
5
|
+
import { useLanguage } from "../../../utils/localization/useLanguage";
|
|
6
|
+
import { useNavContext } from "../../context/nav.context";
|
|
7
|
+
import { useCallback } from "react";
|
|
8
|
+
import { useMobile } from "../../../commonHelpers/hooks/useMobile";
|
|
9
|
+
injectString("cs", "Save", "Ulo\u017Eit");
|
|
10
|
+
injectString("da-DK", "Save", "Spare");
|
|
11
|
+
injectString("de", "Save", "Speichern");
|
|
12
|
+
injectString("en", "Save", "Save");
|
|
13
|
+
injectString("es", "Save", "Guardar");
|
|
14
|
+
injectString("fi-FI", "Save", "S\xE4\xE4st\xE4\xE4");
|
|
15
|
+
injectString("fr", "Save", "Enregistrer");
|
|
16
|
+
injectString("fr-FR", "Save", "Enregistrer");
|
|
17
|
+
injectString("hu-HU", "Save", "Ment\xE9s");
|
|
18
|
+
injectString("id", "Save", "Simpan");
|
|
19
|
+
injectString("it", "Save", "Salvare");
|
|
20
|
+
injectString("ja", "Save", "\u4FDD\u5B58");
|
|
21
|
+
injectString("ko-KR", "Save", "\uC800\uC7A5");
|
|
22
|
+
injectString("ms", "Save", "Simpan");
|
|
23
|
+
injectString("nb-NO", "Save", "Lagre");
|
|
24
|
+
injectString("nl", "Save", "Opslaan");
|
|
25
|
+
injectString("pl", "Save", "Zapisz");
|
|
26
|
+
injectString("pt-BR", "Save", "Salvar");
|
|
27
|
+
injectString("pt-PT", "Save", "Guardar");
|
|
28
|
+
injectString("sk-SK", "Save", "Ulo\u017Ei\u0165");
|
|
29
|
+
injectString("sv", "Save", "Spara");
|
|
30
|
+
injectString("th", "Save", "\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01");
|
|
31
|
+
injectString("tr", "Save", "Kaydet");
|
|
32
|
+
injectString("zh-Hans", "Save", "\u4FDD\u5B58");
|
|
33
|
+
injectString("zh-TW", "Save", "\u5132\u5B58");
|
|
34
|
+
injectString("ro-RO", "Save", "Salva\u021Bi");
|
|
35
|
+
injectString("cs", "Cancel", "Zru\u0161it");
|
|
36
|
+
injectString("da-DK", "Cancel", "Annuller");
|
|
37
|
+
injectString("de", "Cancel", "Abbrechen");
|
|
38
|
+
injectString("en", "Cancel", "Cancel");
|
|
39
|
+
injectString("es", "Cancel", "Cancelar");
|
|
40
|
+
injectString("fi-FI", "Cancel", "Peruuta");
|
|
41
|
+
injectString("fr", "Cancel", "Annuler");
|
|
42
|
+
injectString("fr-FR", "Cancel", "Annuler");
|
|
43
|
+
injectString("hu-HU", "Cancel", "M\xE9gse");
|
|
44
|
+
injectString("id", "Cancel", "Batalkan");
|
|
45
|
+
injectString("it", "Cancel", "Annullare");
|
|
46
|
+
injectString("ja", "Cancel", "\u30AD\u30E3\u30F3\u30BB\u30EB");
|
|
47
|
+
injectString("ko-KR", "Cancel", "\uCDE8\uC18C");
|
|
48
|
+
injectString("ms", "Cancel", "Batal");
|
|
49
|
+
injectString("nb-NO", "Cancel", "Avbryt");
|
|
50
|
+
injectString("nl", "Cancel", "Annuleren");
|
|
51
|
+
injectString("pl", "Cancel", "Anuluj");
|
|
52
|
+
injectString("pt-BR", "Cancel", "Cancelar");
|
|
53
|
+
injectString("pt-PT", "Cancel", "Cancelar");
|
|
54
|
+
injectString("sk-SK", "Cancel", "Zru\u0161.");
|
|
55
|
+
injectString("sv", "Cancel", "Avbryt");
|
|
56
|
+
injectString("th", "Cancel", "\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01");
|
|
57
|
+
injectString("tr", "Cancel", "\u0130ptal");
|
|
58
|
+
injectString("zh-Hans", "Cancel", "\u53D6\u6D88");
|
|
59
|
+
injectString("zh-TW", "Cancel", "\u53D6\u6D88");
|
|
60
|
+
injectString("ro-RO", "Cancel", "Anula\u021Bi");
|
|
61
|
+
export const NavEditFooter = ({
|
|
62
|
+
className,
|
|
63
|
+
handleSaveClick,
|
|
64
|
+
handleCancelClick
|
|
65
|
+
}) => {
|
|
66
|
+
const {
|
|
67
|
+
onEditStateToggle
|
|
68
|
+
} = useNavContext();
|
|
69
|
+
const isMobile = useMobile();
|
|
70
|
+
const {
|
|
71
|
+
translate
|
|
72
|
+
} = useLanguage();
|
|
73
|
+
const onSaveClick = useCallback(() => {
|
|
74
|
+
onEditStateToggle === null || onEditStateToggle === void 0 ? void 0 : onEditStateToggle(false);
|
|
75
|
+
handleSaveClick();
|
|
76
|
+
}, [onEditStateToggle, handleSaveClick]);
|
|
77
|
+
const onCancelClick = useCallback(() => {
|
|
78
|
+
onEditStateToggle === null || onEditStateToggle === void 0 ? void 0 : onEditStateToggle(false);
|
|
79
|
+
handleCancelClick();
|
|
80
|
+
}, [onEditStateToggle, handleCancelClick]);
|
|
81
|
+
const navEditFooterClassNames = classNames(["zen-nav-edit-footer", isMobile ? "zen-nav-edit-footer--mobile" : "", className !== null && className !== void 0 ? className : ""]);
|
|
82
|
+
// needed to change buttons order between mobile and desktop modes
|
|
83
|
+
const saveButtonClassNames = classNames(["zen-nav-edit-footer__button", isMobile ? "zen-nav-edit-footer__button--with-margin" : ""]);
|
|
84
|
+
const saveButton = _jsx(Button, {
|
|
85
|
+
onClick: onSaveClick,
|
|
86
|
+
className: saveButtonClassNames,
|
|
87
|
+
type: "primary",
|
|
88
|
+
children: translate("Save")
|
|
89
|
+
});
|
|
90
|
+
const cancelButton = _jsx(Button, {
|
|
91
|
+
onClick: onCancelClick,
|
|
92
|
+
className: "zen-nav-edit-footer__button",
|
|
93
|
+
type: "secondary",
|
|
94
|
+
children: translate("Cancel")
|
|
95
|
+
});
|
|
96
|
+
return _jsxs("div", {
|
|
97
|
+
className: navEditFooterClassNames,
|
|
98
|
+
children: [isMobile ? saveButton : cancelButton, isMobile ? cancelButton : saveButton]
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
NavEditFooter.displayName = "NavEditFooter";
|
|
@@ -3,11 +3,6 @@ import { IZenComponentProps } from "../../commonHelpers/zenComponent";
|
|
|
3
3
|
import { FC } from "react";
|
|
4
4
|
export interface INavFooter extends IZenComponentProps {
|
|
5
5
|
}
|
|
6
|
-
export interface INavFooterBottom extends IZenComponentProps {
|
|
7
|
-
}
|
|
8
|
-
export interface INavFooterEditButton extends IZenComponentProps {
|
|
9
|
-
onClick?: () => void;
|
|
10
|
-
}
|
|
11
6
|
/**
|
|
12
7
|
* @beta This component is not fully ready yet and may change in future releases.
|
|
13
8
|
*/
|
|
@@ -16,6 +11,6 @@ export declare const NavFooter: FC<INavFooter> & {
|
|
|
16
11
|
({ children }: import("./navFooterAction/navFooterAction").INavFooterActionProps): import("react/jsx-runtime").JSX.Element | null;
|
|
17
12
|
displayName: string;
|
|
18
13
|
};
|
|
19
|
-
Bottom: FC<
|
|
20
|
-
EditButton: FC<
|
|
14
|
+
Bottom: FC<IZenComponentProps>;
|
|
15
|
+
EditButton: FC<IZenComponentProps>;
|
|
21
16
|
};
|
|
@@ -65,14 +65,14 @@ const NavFooterBottom = ({
|
|
|
65
65
|
};
|
|
66
66
|
NavFooterBottom.displayName = "NavFooterBottom";
|
|
67
67
|
const NavFooterEditButton = ({
|
|
68
|
-
className
|
|
69
|
-
onClick
|
|
68
|
+
className
|
|
70
69
|
}) => {
|
|
71
70
|
const {
|
|
72
71
|
translate
|
|
73
72
|
} = useLanguage();
|
|
74
73
|
const {
|
|
75
|
-
collapsed
|
|
74
|
+
collapsed,
|
|
75
|
+
onEditStateToggle
|
|
76
76
|
} = useNavContext();
|
|
77
77
|
const isMobile = useMobile();
|
|
78
78
|
return _jsx(NavItem, {
|
|
@@ -80,7 +80,7 @@ const NavFooterEditButton = ({
|
|
|
80
80
|
title: translate("Edit Navigation"),
|
|
81
81
|
collapsed: !isMobile,
|
|
82
82
|
primaryIcon: IconEdit,
|
|
83
|
-
onClick: () =>
|
|
83
|
+
onClick: () => onEditStateToggle === null || onEditStateToggle === void 0 ? void 0 : onEditStateToggle(true),
|
|
84
84
|
menuAlignment: "right-bottom",
|
|
85
85
|
tooltipAlignment: collapsed ? "right" : "top"
|
|
86
86
|
}, "edit-button");
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FC, MouseEvent, ReactNode } from "react";
|
|
2
|
+
import { IZenComponentProps } from "../../commonHelpers/zenComponent";
|
|
3
|
+
import { IIcon } from "../../icons/icon";
|
|
4
|
+
import "./navItem.less";
|
|
5
|
+
export interface INavActionItem extends IZenComponentProps {
|
|
6
|
+
title: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
icon?: FC<IIcon>;
|
|
9
|
+
startNode?: ReactNode;
|
|
10
|
+
endButtonIcon?: FC<IIcon>;
|
|
11
|
+
endButtonTitle?: string;
|
|
12
|
+
onEndButtonClick?: (e: MouseEvent) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const NavActionItem: FC<INavActionItem>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { classNames } from "../../commonHelpers/classNames/classNames";
|
|
3
|
+
export const NavActionItem = ({ title, id, icon, className, startNode, endButtonIcon, endButtonTitle, onEndButtonClick }) => {
|
|
4
|
+
const PrimaryIconComponent = typeof icon === "function" ? icon : null;
|
|
5
|
+
const EndButtonIconComponent = typeof endButtonIcon === "function" ? endButtonIcon : null;
|
|
6
|
+
const itemClasses = classNames(["zen-nav-item", className || ""]);
|
|
7
|
+
return (_jsxs("div", { className: itemClasses, id: id, children: [_jsx("div", { className: "zen-nav-item__main", children: _jsxs("div", { className: "zen-nav-item__content-left", children: [startNode ? _jsx("span", { className: "zen-nav-item__icon", children: startNode }) : null, PrimaryIconComponent ? _jsx(PrimaryIconComponent, { size: "huge" }) : null, _jsx("span", { className: "zen-nav-item__title", children: _jsx("span", { className: "zen-nav-item__title-text", children: title }) })] }) }), EndButtonIconComponent && endButtonTitle && onEndButtonClick
|
|
8
|
+
? _jsx("button", { type: "button", className: "zen-nav-item__action", "aria-label": endButtonTitle, title: endButtonTitle, onClick: onEndButtonClick, children: _jsx(EndButtonIconComponent, { size: "huge" }) })
|
|
9
|
+
: null] }));
|
|
10
|
+
};
|
|
11
|
+
NavActionItem.displayName = "NavActionItem";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geotab/zenith",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.1",
|
|
4
4
|
"description": "Zenith components library on React",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "esm/index.d.ts",
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
"**/react-chartjs/dateAdapter.ts",
|
|
12
12
|
"**/react-chartjs/dateAdapter.js"
|
|
13
13
|
],
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
14
17
|
"scripts": {
|
|
15
18
|
"test": "npm run clean && npm run test-build && node build-utils/translations/inject-translations.js && jest --clearCache && jest",
|
|
16
19
|
"start": "npm run storybook --loglevel verbose",
|
|
@@ -111,8 +114,5 @@
|
|
|
111
114
|
"last 1 firefox version",
|
|
112
115
|
"last 1 safari version"
|
|
113
116
|
]
|
|
114
|
-
},
|
|
115
|
-
"publishConfig": {
|
|
116
|
-
"access": "public"
|
|
117
117
|
}
|
|
118
118
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const findListElement: (element: HTMLElement) => HTMLElement | null;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findListElement = void 0;
|
|
4
|
-
const findListElement = (element) => {
|
|
5
|
-
if (element.classList.contains("zen-list-item")) {
|
|
6
|
-
return element;
|
|
7
|
-
}
|
|
8
|
-
if (element.parentElement) {
|
|
9
|
-
return (0, exports.findListElement)(element.parentElement);
|
|
10
|
-
}
|
|
11
|
-
return null;
|
|
12
|
-
};
|
|
13
|
-
exports.findListElement = findListElement;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const findListElement: (element: HTMLElement) => HTMLElement | null;
|