@geotab/zenith 1.19.1 → 1.20.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 -0
- package/dist/banner/bannerMultipLine.js +2 -1
- package/dist/banner/bannerSingleLine.js +2 -1
- package/dist/banner/typeIcon.js +1 -1
- package/dist/chart/lineChart.js +1 -1
- package/dist/dataGrid/withSortableColumns/columns/sortableColumnWrapper.js +28 -8
- package/dist/dateRange/dateRange.d.ts +3 -3
- package/dist/dateRange/dateRange.js +15 -10
- package/dist/dateRange/dateRangeUtils.d.ts +3 -0
- package/dist/filtersBar/components/filtersBarPeriodPicker/filtersBarPeriodPicker.d.ts +10 -4
- package/dist/filtersBar/components/filtersBarPeriodPicker/filtersBarPeriodPicker.js +14 -10
- package/dist/filtersBar/components/filtersBarPeriodPicker/getRangeOption.d.ts +7 -1
- package/dist/filtersBar/components/filtersBarPeriodPicker/getRangeOption.js +59 -1
- package/dist/icons/iconAddPeople2.d.ts +4 -0
- package/dist/icons/iconAddPeople2.js +4 -0
- package/dist/icons/iconLaptop.d.ts +4 -0
- package/dist/icons/iconLaptop.js +17 -0
- package/dist/icons/iconRemovePeople.d.ts +4 -0
- package/dist/icons/iconRemovePeople.js +17 -0
- package/dist/index.css +150 -117
- package/dist/index.d.ts +3 -1
- package/dist/index.js +12 -8
- package/dist/lineChart/lineChart.d.ts +3 -0
- package/dist/lineChart/lineChart.js +3 -0
- package/dist/modal/modal.js +3 -2
- package/dist/selectRaw/selectRaw.d.ts +1 -0
- package/dist/selectRaw/selectRaw.js +6 -2
- package/dist/table/selectable/useSelectableRows.js +1 -1
- package/dist/table/sortable/sortableHeader.js +30 -8
- package/package.json +4 -3
|
@@ -128,7 +128,7 @@ const useSelectableRows = (columns, entities, isMobile, selectMode, setSelectMod
|
|
|
128
128
|
}
|
|
129
129
|
const allowed = checkboxVisible(entity);
|
|
130
130
|
const isDisable = checkboxDisabled(entity) || state === interfaces_1.SelectionState.All;
|
|
131
|
-
const cell = (0, jsx_runtime_1.jsx)(checkboxCell_1.CheckboxCell, { id: entity.id, className: allowed ? "zen-selectable-
|
|
131
|
+
const cell = (0, jsx_runtime_1.jsx)(checkboxCell_1.CheckboxCell, { id: entity.id, className: allowed ? "zen-selectable-row" : "zen-selectable-row zen-selectable-column--no-checkbox", checked: state === interfaces_1.SelectionState.All || selections.has(entity.id), indeterminate: false, disabled: isDisable, label: checkboxTitle(entity), onChange: onSelectListener, children: (0, jsx_runtime_1.jsx)(checkboxCell_1.CheckboxCell.Content, { children: value }) });
|
|
132
132
|
return cell;
|
|
133
133
|
},
|
|
134
134
|
renderHeader(title) {
|
|
@@ -33,10 +33,28 @@ const isClickOnSortableParent = (element) => {
|
|
|
33
33
|
};
|
|
34
34
|
const SortableHeaderCell = ({ columnName, isSortedBy, sortDirection, title, tooltip, onSortChange, isMobile = false }) => {
|
|
35
35
|
const { translate } = (0, useLanguage_1.useLanguage)();
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
36
|
+
const [isHovered, setIsHovered] = (0, react_1.useState)(false);
|
|
37
|
+
const [isFocused, setIsFocused] = (0, react_1.useState)(false);
|
|
38
|
+
const isActive = isHovered || isFocused;
|
|
39
|
+
const iconTitle = getSortButtonTitle(isActive
|
|
40
|
+
? sortDirection === interfaces_1.ColumnSortDirection.Ascending
|
|
41
|
+
? interfaces_1.ColumnSortDirection.Descending
|
|
42
|
+
: interfaces_1.ColumnSortDirection.Ascending
|
|
43
|
+
: sortDirection === interfaces_1.ColumnSortDirection.Ascending
|
|
44
|
+
? interfaces_1.ColumnSortDirection.Descending
|
|
45
|
+
: interfaces_1.ColumnSortDirection.Ascending, tooltip, translate);
|
|
46
|
+
const icon = (0, react_1.useMemo)(() => {
|
|
47
|
+
if (isActive) {
|
|
48
|
+
return sortDirection === interfaces_1.ColumnSortDirection.Ascending
|
|
49
|
+
? iconFilter3Desc_1.IconFilter3Desc
|
|
50
|
+
: iconFilter3Asc_1.IconFilter3Asc;
|
|
51
|
+
}
|
|
52
|
+
return sortDirection === interfaces_1.ColumnSortDirection.Ascending
|
|
53
|
+
? iconFilter3Asc_1.IconFilter3Asc
|
|
54
|
+
: iconFilter3Desc_1.IconFilter3Desc;
|
|
55
|
+
}, [sortDirection, isActive]);
|
|
56
|
+
const iconButton = ((0, jsx_runtime_1.jsx)(textIconButton_1.TextIconButton, { className: "zen-sortable-column-button__dir-icon zen-caption__post-icon", icon: icon, iconPosition: isMobile ? textIconButton_1.ButtonIconPosition.Start : textIconButton_1.ButtonIconPosition.End, type: "tertiary-black", title: iconTitle }));
|
|
57
|
+
const onHeaderClick = (0, react_1.useCallback)((e) => {
|
|
40
58
|
const target = e && e.target;
|
|
41
59
|
if (!target) {
|
|
42
60
|
return;
|
|
@@ -44,11 +62,13 @@ const SortableHeaderCell = ({ columnName, isSortedBy, sortDirection, title, tool
|
|
|
44
62
|
if (isClickOnSortableParent(target)) {
|
|
45
63
|
onSortChange({
|
|
46
64
|
sortColumn: columnName,
|
|
47
|
-
sortDirection: sortDirection === interfaces_1.ColumnSortDirection.Ascending
|
|
65
|
+
sortDirection: sortDirection === interfaces_1.ColumnSortDirection.Ascending
|
|
66
|
+
? interfaces_1.ColumnSortDirection.Descending
|
|
67
|
+
: interfaces_1.ColumnSortDirection.Ascending
|
|
48
68
|
});
|
|
49
69
|
}
|
|
50
70
|
}, [columnName, sortDirection, onSortChange]);
|
|
51
|
-
return (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)([
|
|
71
|
+
return ((0, jsx_runtime_1.jsx)("div", { onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), className: (0, classNames_1.classNames)([
|
|
52
72
|
"zen-sortable-column",
|
|
53
73
|
isSortedBy ? `zen-sortable-column--active` : "",
|
|
54
74
|
isMobile ? `zen-sortable-column--mobile` : ""
|
|
@@ -57,7 +77,9 @@ const SortableHeaderCell = ({ columnName, isSortedBy, sortDirection, title, tool
|
|
|
57
77
|
"zen-sortable-column__button",
|
|
58
78
|
"zen-sortable-column-button",
|
|
59
79
|
isSortedBy ? `zen-sortable-column-button--active` : "",
|
|
60
|
-
sortDirection === interfaces_1.ColumnSortDirection.Ascending
|
|
61
|
-
|
|
80
|
+
sortDirection === interfaces_1.ColumnSortDirection.Ascending
|
|
81
|
+
? "zen-sortable-column-button--dir-asc"
|
|
82
|
+
: "zen-sortable-column-button--dir-desc"
|
|
83
|
+
]), title: iconTitle, "aria-label": iconTitle, onClick: onHeaderClick, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isMobile ? iconButton : null, (0, jsx_runtime_1.jsx)("div", { className: "zen-sortable-column-button__content zen-caption__content", children: title }), isMobile ? null : iconButton] }) }) }));
|
|
62
84
|
};
|
|
63
85
|
exports.SortableHeaderCell = SortableHeaderCell;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geotab/zenith",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.0-beta.1",
|
|
4
4
|
"description": "Zenith components library on React",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"start": "npm run storybook --loglevel verbose",
|
|
10
10
|
"lint": "npx eslint -c \".eslintrc.js\" --ext \".ts\" --ext \".tsx\" \"**/*.tsx\" \"**/*.ts\" --ignore-path \".eslintignore\"",
|
|
11
11
|
"new": "node newComponent.mjs",
|
|
12
|
+
"build-ai-mdx": "node collectmdx.js",
|
|
12
13
|
"build-ts": "npx tsc -b tsconfig.build.json && node less-transformer.js",
|
|
13
14
|
"build-less": "node less-compile.js",
|
|
14
15
|
"build-copy": "node build-copy.js",
|
|
@@ -23,7 +24,7 @@
|
|
|
23
24
|
"test-coverage": "npm run clean && npm run test-build && jest --collectCoverage=true --coverage --collectCoverageFrom=./**/*.js --json --outputFile=jest-result.json --coverageReporters=html --coverageReporters=text-summary --coverageReporters=cobertura --noStackTrace && node testHelpers/cobertura/cobertura.js",
|
|
24
25
|
"coverage": "npm run test-coverage && google-chrome ./jest-coverage/index.html",
|
|
25
26
|
"storybook": "storybook dev -p 6006",
|
|
26
|
-
"build-storybook": "storybook build",
|
|
27
|
+
"build-storybook": "storybook build && npm run build-ai-mdx",
|
|
27
28
|
"clean": "rm -rf ./dist && rm -rf ./jest-coverage"
|
|
28
29
|
},
|
|
29
30
|
"author": "",
|
|
@@ -93,5 +94,5 @@
|
|
|
93
94
|
},
|
|
94
95
|
"publishConfig": {
|
|
95
96
|
"access": "public"
|
|
96
|
-
|
|
97
|
+
}
|
|
97
98
|
}
|