@geotab/zenith 1.15.1 → 1.15.3
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 +8 -1
- package/dist/banner/banner.d.ts +8 -5
- package/dist/banner/banner.js +3 -5
- package/dist/groupsFilter/groupsFilter.d.ts +4 -0
- package/dist/groupsFilter/groupsFilter.js +1 -1
- package/dist/inputAdornments/inputAdornments.d.ts +1 -0
- package/dist/inputAdornments/inputAdornments.js +2 -2
- package/dist/searchInputRaw/searchInputRaw.d.ts +1 -0
- package/dist/searchInputRaw/searchInputRaw.js +2 -2
- package/dist/textInputRaw/textInputRaw.d.ts +1 -0
- package/dist/textInputRaw/textInputRaw.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,10 +36,17 @@ import { Menu, Button, IconSettings3 } from "@geotab/zenith";
|
|
|
36
36
|
Now components are ready for usage.
|
|
37
37
|
|
|
38
38
|
### Available components
|
|
39
|
-
Zenith library provides components defined in Zenith Design System. It includes very basic blocks like colors, icons, font presets, atom components like buttons, checkboxes etc and high order components - header, table, filters bar etc. List of existing components can be found in [https://developers.geotab.com/zenith-storybook/index.html
|
|
39
|
+
Zenith library provides components defined in Zenith Design System. It includes very basic blocks like colors, icons, font presets, atom components like buttons, checkboxes etc and high order components - header, table, filters bar etc. List of existing components can be found in [Storybook](https://developers.geotab.com/zenith-storybook/index.html).
|
|
40
40
|
|
|
41
41
|
## Change log
|
|
42
42
|
|
|
43
|
+
### 1.15.2
|
|
44
|
+
|
|
45
|
+
* Improve banner accessibility
|
|
46
|
+
* Add attribute `autoFocus` to `TextInput` and `SearchInput`
|
|
47
|
+
* Add default placeholder for `GroupsFilter`
|
|
48
|
+
* Fix mode detection in `FeedbackProvider`
|
|
49
|
+
|
|
43
50
|
### 1.15.1
|
|
44
51
|
|
|
45
52
|
* Improve FeedbackProvider in add-ins
|
package/dist/banner/banner.d.ts
CHANGED
|
@@ -20,14 +20,17 @@ export interface IBanner {
|
|
|
20
20
|
/**
|
|
21
21
|
* @deprecated
|
|
22
22
|
* @param translate - will be removed in the next major release
|
|
23
|
-
* @param center - will be removed in the next major release
|
|
24
|
-
* @param close - will be removed in the next major release
|
|
25
|
-
* @param role - will be removed in the next major release
|
|
26
|
-
* @param ariaAtomic - will be removed in the next major release
|
|
27
|
-
* @param ariaLive - will be removed in the next major release
|
|
28
23
|
*/
|
|
29
24
|
translate?: (s: string) => string;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated
|
|
27
|
+
* @param center - will be removed in the next major release
|
|
28
|
+
*/
|
|
30
29
|
center?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated
|
|
32
|
+
* @param close - will be removed in the next major release
|
|
33
|
+
*/
|
|
31
34
|
close?: boolean;
|
|
32
35
|
role?: string;
|
|
33
36
|
ariaAtomic?: "true" | "false";
|
package/dist/banner/banner.js
CHANGED
|
@@ -5,11 +5,9 @@ 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, ariaAtomic = "true", ariaLive = "
|
|
8
|
+
const Banner = ({ children, header, type = "warning", icon, action, size, onClose, multiline, role = "status", ariaAtomic = "true", ariaLive = "polite", className }) => {
|
|
9
9
|
const isMobile = (0, useMobile_1.useMobile)();
|
|
10
10
|
const isMultiline = multiline === undefined ? isMobile : multiline;
|
|
11
|
-
const predefinedRole = type === "error" ? "alert" : "status";
|
|
12
|
-
const bannerRole = role ? role : predefinedRole;
|
|
13
11
|
return isMultiline ? (0, jsx_runtime_1.jsx)(bannerMultipLine_1.BannerMultiline, { children,
|
|
14
12
|
header,
|
|
15
13
|
type,
|
|
@@ -17,7 +15,7 @@ const Banner = ({ children, header, type = "warning", icon, action, size, onClos
|
|
|
17
15
|
size,
|
|
18
16
|
action,
|
|
19
17
|
onClose,
|
|
20
|
-
role
|
|
18
|
+
role,
|
|
21
19
|
ariaAtomic,
|
|
22
20
|
ariaLive,
|
|
23
21
|
className }) : (0, jsx_runtime_1.jsx)(bannerSingleLine_1.BannerSingleLine, { children,
|
|
@@ -27,7 +25,7 @@ const Banner = ({ children, header, type = "warning", icon, action, size, onClos
|
|
|
27
25
|
icon,
|
|
28
26
|
action,
|
|
29
27
|
onClose,
|
|
30
|
-
role
|
|
28
|
+
role,
|
|
31
29
|
ariaAtomic,
|
|
32
30
|
ariaLive,
|
|
33
31
|
className });
|
|
@@ -3,6 +3,10 @@ import { IAdvancedEntitiesNavigatorDialog, IGroupItem, IGroupsFilterTotalState }
|
|
|
3
3
|
import "./groupsFilter.less";
|
|
4
4
|
import { IZenComponentProps } from "../commonHelpers/zenComponent";
|
|
5
5
|
interface IGroupsFilterOptions {
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated
|
|
8
|
+
* @param placeholder - will be removed in the next major release
|
|
9
|
+
*/
|
|
6
10
|
placeholder?: string;
|
|
7
11
|
}
|
|
8
12
|
export interface IGroupsFilter extends IZenComponentProps {
|
|
@@ -216,7 +216,7 @@ const GroupsFilter = ({ fullSize, className, dataLoader, errorHandler, isWithCol
|
|
|
216
216
|
(0, useEscape_1.useEscape)(triggerRef, handleEscape, uiState.isOpen);
|
|
217
217
|
const selectedCount = (0, stateReducerHelper_1.getFrozenCount)(state);
|
|
218
218
|
const isStateHasData = Object.keys(state.groupsMap).length > 0;
|
|
219
|
-
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(groupsFilterTrigger_1.GroupsFilterTrigger, { value: uiState.searchValue, onChange: onSearchChange, isOpenPopup: uiState.isOpen, count: selectedCount, withGlobeIcon: state.frozenSideWideState && selectedCount > 0, inputRef: inputRef, handleClick: handleTriggerClick, ref: triggerRef, fullSize: fullSize, placeholder: options.placeholder }), (0, jsx_runtime_1.jsx)(controlledPopup_1.ControlledPopup, { isOpen: uiState.isOpen, className: (0, classNames_1.classNames)(["zen-groups-filter__popup", uiState.isOpenAdvancedFilter ? "zen-groups-filter__popup--inactive" : "", className ? className : ""]), onOpenChange: onOptionsToggle, useTrapFocusWithTrigger: uiState.isOpenAdvancedFilter ? "off" : "withTrigger", shouldHoldScroll: true, triggerRef: triggerRef, ariaLabel: translate("Organization groups filter"), recalculateOnScroll: true, children: (0, jsx_runtime_1.jsxs)("div", { className: "zen-groups-filter-menu", ref: menuRef, children: [isStateHasData && !uiState.isLoadWithError && (0, jsx_runtime_1.jsxs)(groupsFilterMenu_1.GroupsFilterMenu, { onCancelClick: handleCancel, onApplyClick: handleApply, onResetClick: handleReset, isApplyDisabled: !(0, stateReducerHelper_1.isStateChanged)(state), children: [uiState.step === groupsFilterInterfaces_1.FilterMenuStep.Initial && (0, jsx_runtime_1.jsx)(groupsFilterInitialState_1.GroupsFilterInitialState, { siteWideState: state.sideWideState, onDialogButtonClick: handleAdvancedDialogOpen, count: (0, stateReducerHelper_1.getCurrentlySelectedCount)(state), onSiteWideChange: onSideWideChange, onCurrentlySelectedClick: handleCurrentlySelectedClick, searchResult: uiState.searchValue ? getSearchResult() : "", children: getGroupsBox() }), uiState.step === groupsFilterInterfaces_1.FilterMenuStep.Adjustment && (0, jsx_runtime_1.jsx)(groupsFilterAdjustmentState_1.GroupsFilterAdjustmentState, { onBackButtonClick: handleBackButtonClick, onHomeButtonClick: handleHomeButtonClick, onSelectAllClick: selectAllHandler, backButtonName: (0, groupsFilterStatesHelper_1.getBackButtonName)(state, uiState.currentAdjustmentId), isAllSelected: (0, groupsFilterStatesHelper_1.isAllChildrenSelected)(state, uiState.currentAdjustmentId), children: getGroupsBox() }), uiState.step === groupsFilterInterfaces_1.FilterMenuStep.CurrentlySelected && (0, jsx_runtime_1.jsx)(groupsFilterCurrentlySelectedState_1.GroupsFilterCurrentlySelectedState, { siteWideState: state.sideWideState, relation: state.relation, count: (0, stateReducerHelper_1.getCurrentlySelectedCount)(state), onBackButtonClick: basicHandleBackButtonClick, onSiteWideChange: onSideWideChange, onRelationChange: onRelationChange, children: getGroupsBox() })] }), !uiState.isLoadWithError && !isStateHasData && (0, jsx_runtime_1.jsx)(waiting_1.Waiting, { className: "zen-groups-filter__waiting", isLoading: !Object.keys(state.groupsMap).length, delay: 100 })] }) }), uiState.isOpenAdvancedFilter && getAdvancedDialog] });
|
|
219
|
+
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(groupsFilterTrigger_1.GroupsFilterTrigger, { value: uiState.searchValue, onChange: onSearchChange, isOpenPopup: uiState.isOpen, count: selectedCount, withGlobeIcon: state.frozenSideWideState && selectedCount > 0, inputRef: inputRef, handleClick: handleTriggerClick, ref: triggerRef, fullSize: fullSize, placeholder: options.placeholder || translate("Groups") }), (0, jsx_runtime_1.jsx)(controlledPopup_1.ControlledPopup, { isOpen: uiState.isOpen, className: (0, classNames_1.classNames)(["zen-groups-filter__popup", uiState.isOpenAdvancedFilter ? "zen-groups-filter__popup--inactive" : "", className ? className : ""]), onOpenChange: onOptionsToggle, useTrapFocusWithTrigger: uiState.isOpenAdvancedFilter ? "off" : "withTrigger", shouldHoldScroll: true, triggerRef: triggerRef, ariaLabel: translate("Organization groups filter"), recalculateOnScroll: true, children: (0, jsx_runtime_1.jsxs)("div", { className: "zen-groups-filter-menu", ref: menuRef, children: [isStateHasData && !uiState.isLoadWithError && (0, jsx_runtime_1.jsxs)(groupsFilterMenu_1.GroupsFilterMenu, { onCancelClick: handleCancel, onApplyClick: handleApply, onResetClick: handleReset, isApplyDisabled: !(0, stateReducerHelper_1.isStateChanged)(state), children: [uiState.step === groupsFilterInterfaces_1.FilterMenuStep.Initial && (0, jsx_runtime_1.jsx)(groupsFilterInitialState_1.GroupsFilterInitialState, { siteWideState: state.sideWideState, onDialogButtonClick: handleAdvancedDialogOpen, count: (0, stateReducerHelper_1.getCurrentlySelectedCount)(state), onSiteWideChange: onSideWideChange, onCurrentlySelectedClick: handleCurrentlySelectedClick, searchResult: uiState.searchValue ? getSearchResult() : "", children: getGroupsBox() }), uiState.step === groupsFilterInterfaces_1.FilterMenuStep.Adjustment && (0, jsx_runtime_1.jsx)(groupsFilterAdjustmentState_1.GroupsFilterAdjustmentState, { onBackButtonClick: handleBackButtonClick, onHomeButtonClick: handleHomeButtonClick, onSelectAllClick: selectAllHandler, backButtonName: (0, groupsFilterStatesHelper_1.getBackButtonName)(state, uiState.currentAdjustmentId), isAllSelected: (0, groupsFilterStatesHelper_1.isAllChildrenSelected)(state, uiState.currentAdjustmentId), children: getGroupsBox() }), uiState.step === groupsFilterInterfaces_1.FilterMenuStep.CurrentlySelected && (0, jsx_runtime_1.jsx)(groupsFilterCurrentlySelectedState_1.GroupsFilterCurrentlySelectedState, { siteWideState: state.sideWideState, relation: state.relation, count: (0, stateReducerHelper_1.getCurrentlySelectedCount)(state), onBackButtonClick: basicHandleBackButtonClick, onSiteWideChange: onSideWideChange, onRelationChange: onRelationChange, children: getGroupsBox() })] }), !uiState.isLoadWithError && !isStateHasData && (0, jsx_runtime_1.jsx)(waiting_1.Waiting, { className: "zen-groups-filter__waiting", isLoading: !Object.keys(state.groupsMap).length, delay: 100 })] }) }), uiState.isOpenAdvancedFilter && getAdvancedDialog] });
|
|
220
220
|
};
|
|
221
221
|
exports.GroupsFilter = GroupsFilter;
|
|
222
222
|
exports.TRANSLATIONS = [
|
|
@@ -29,9 +29,9 @@ const React = __importStar(require("react"));
|
|
|
29
29
|
const classNames_1 = require("../commonHelpers/classNames/classNames");
|
|
30
30
|
const textInputRaw_1 = require("../textInputRaw/textInputRaw");
|
|
31
31
|
const useDriveClassName_1 = require("../utils/theme/useDriveClassName");
|
|
32
|
-
exports.InputAdornments = React.forwardRef(({ id, value, className = "", disabled, isError, maxLength, onChange, onKeyDown, startAdornment, endAdornment, placeholder, inputType = "text" }, ref) => {
|
|
32
|
+
exports.InputAdornments = React.forwardRef(({ id, value, className = "", disabled, isError, maxLength, onChange, onKeyDown, startAdornment, endAdornment, placeholder, inputType = "text", autoFocus }, ref) => {
|
|
33
33
|
const disabledClassName = disabled ? "zen-input-adornments--disabled" : "";
|
|
34
34
|
const driveComponentClass = (0, useDriveClassName_1.useDriveClassName)("zen-input-adornments");
|
|
35
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-input-adornments", driveComponentClass || "", className, disabledClassName]), children: [!!startAdornment && ((0, jsx_runtime_1.jsx)("div", { className: "zen-input-adornments__adornment zen-input-adornments__adornment--start", children: startAdornment })), (0, jsx_runtime_1.jsx)("div", { className: "zen-input-adornments__wrapper", children: (0, jsx_runtime_1.jsx)(textInputRaw_1.TextInputRaw, { ref: ref, id: id, value: value, maxLength: maxLength, isError: isError, placeholder: placeholder, onChange: onChange, onKeyDown: onKeyDown, disabled: disabled, type: inputType, className: "zen-input-adornments__input zen-input-adornments__input--border-none" }) }), !!endAdornment && ((0, jsx_runtime_1.jsx)("div", { className: "zen-input-adornments__adornment zen-input-adornments__adornment--end", children: endAdornment }))] }));
|
|
35
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-input-adornments", driveComponentClass || "", className, disabledClassName]), children: [!!startAdornment && ((0, jsx_runtime_1.jsx)("div", { className: "zen-input-adornments__adornment zen-input-adornments__adornment--start", children: startAdornment })), (0, jsx_runtime_1.jsx)("div", { className: "zen-input-adornments__wrapper", children: (0, jsx_runtime_1.jsx)(textInputRaw_1.TextInputRaw, { ref: ref, id: id, value: value, maxLength: maxLength, isError: isError, placeholder: placeholder, onChange: onChange, onKeyDown: onKeyDown, disabled: disabled, type: inputType, autoFocus: autoFocus, className: "zen-input-adornments__input zen-input-adornments__input--border-none" }) }), !!endAdornment && ((0, jsx_runtime_1.jsx)("div", { className: "zen-input-adornments__adornment zen-input-adornments__adornment--end", children: endAdornment }))] }));
|
|
36
36
|
});
|
|
37
37
|
exports.InputAdornments.displayName = "InputAdornments";
|
|
@@ -18,6 +18,7 @@ export interface ISearchInputRaw {
|
|
|
18
18
|
* @param withNewSearchIcon - will be removed in the next major release
|
|
19
19
|
*/
|
|
20
20
|
withNewSearchIcon?: boolean;
|
|
21
|
+
autoFocus?: boolean;
|
|
21
22
|
}
|
|
22
23
|
export declare const SearchInputRaw: React.ForwardRefExoticComponent<ISearchInputRaw & React.RefAttributes<HTMLInputElement>>;
|
|
23
24
|
export declare const TRANSLATIONS: string[];
|
|
@@ -34,7 +34,7 @@ const iconClose_1 = require("../icons/iconClose");
|
|
|
34
34
|
const useLanguage_1 = require("../utils/localization/useLanguage");
|
|
35
35
|
const useDrive_1 = require("../utils/theme/useDrive");
|
|
36
36
|
const useDriveClassName_1 = require("../utils/theme/useDriveClassName");
|
|
37
|
-
exports.SearchInputRaw = React.forwardRef(({ value, className = "", disabled, onChange, onKeyDown, placeholder, ariaLabel, closeButtonTitle, isError, maxLength, withDefaultCloseIcon = false, id }, ref) => {
|
|
37
|
+
exports.SearchInputRaw = React.forwardRef(({ value, className = "", disabled, onChange, onKeyDown, placeholder, ariaLabel, closeButtonTitle, isError, maxLength, withDefaultCloseIcon = false, autoFocus, id }, ref) => {
|
|
38
38
|
const { translate } = (0, useLanguage_1.useLanguage)();
|
|
39
39
|
const placeholderValue = placeholder || translate("Search");
|
|
40
40
|
const closeButtonTitleValue = closeButtonTitle || translate("Clear");
|
|
@@ -68,7 +68,7 @@ exports.SearchInputRaw = React.forwardRef(({ value, className = "", disabled, on
|
|
|
68
68
|
(_b = innerRef.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
69
69
|
}
|
|
70
70
|
}, [ref, innerRef]);
|
|
71
|
-
return ((0, jsx_runtime_1.jsx)("div", { onClick: onClickHandler, role: "search", "aria-label": ariaLabelValue, className: (0, classNames_1.classNames)(["zen-search-input", className]), children: (0, jsx_runtime_1.jsx)(inputAdornments_1.InputAdornments, { id: id, value: value, maxLength: maxLength, isError: isError, startAdornment: searchIcon, className: (0, classNames_1.classNames)(["zen-search-input__input", disabledClassName, isError ? "zen-search-input__input--error" : ""]), disabled: disabled, onChange: handleChange, onKeyDown: onKeyDown, placeholder: placeholderValue, inputType: withDefaultCloseIcon ? "search" : "text", endAdornment: closeButton, ref: ref || innerRef }) }));
|
|
71
|
+
return ((0, jsx_runtime_1.jsx)("div", { onClick: onClickHandler, role: "search", "aria-label": ariaLabelValue, className: (0, classNames_1.classNames)(["zen-search-input", className]), children: (0, jsx_runtime_1.jsx)(inputAdornments_1.InputAdornments, { id: id, value: value, maxLength: maxLength, isError: isError, startAdornment: searchIcon, className: (0, classNames_1.classNames)(["zen-search-input__input", disabledClassName, isError ? "zen-search-input__input--error" : ""]), disabled: disabled, onChange: handleChange, onKeyDown: onKeyDown, placeholder: placeholderValue, inputType: withDefaultCloseIcon ? "search" : "text", endAdornment: closeButton, ref: ref || innerRef, autoFocus: autoFocus }) }));
|
|
72
72
|
});
|
|
73
73
|
exports.SearchInputRaw.displayName = "SearchInputRaw";
|
|
74
74
|
exports.TRANSLATIONS = [
|
|
@@ -17,5 +17,6 @@ export interface ITextInputRaw extends IZenComponentProps {
|
|
|
17
17
|
max?: number;
|
|
18
18
|
ariaLabelledby?: string;
|
|
19
19
|
ariaLabel?: string;
|
|
20
|
+
autoFocus?: boolean;
|
|
20
21
|
}
|
|
21
22
|
export declare const TextInputRaw: React.ForwardRefExoticComponent<ITextInputRaw & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -37,5 +37,5 @@ React.forwardRef(function InnerInput(props, ref) {
|
|
|
37
37
|
driveComponentClass || "",
|
|
38
38
|
props.className || "",
|
|
39
39
|
props.isError ? "zen-text-input--error" : ""
|
|
40
|
-
]), value: props.maxLength ? props.value.substring(0, props.maxLength) : props.value, placeholder: props.placeholder, disabled: props.disabled, onChange: props.onChange, onKeyDown: props.onKeyDown, onBlur: props.onBlur, maxLength: props.maxLength, autoComplete: props.autocomplete, min: props.min, max: props.max, "aria-labelledby": props.ariaLabelledby, "aria-label": props.ariaLabel });
|
|
40
|
+
]), value: props.maxLength ? props.value.substring(0, props.maxLength) : props.value, placeholder: props.placeholder, disabled: props.disabled, onChange: props.onChange, onKeyDown: props.onKeyDown, onBlur: props.onBlur, maxLength: props.maxLength, autoComplete: props.autocomplete, min: props.min, max: props.max, "aria-labelledby": props.ariaLabelledby, "aria-label": props.ariaLabel, autoFocus: props.autoFocus });
|
|
41
41
|
});
|