@geotab/zenith 3.10.0-beta.1 → 3.10.0-beta.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.
Files changed (39) hide show
  1. package/README.md +9 -6
  2. package/dist/betaPill/betaPill.d.ts +9 -4
  3. package/dist/betaPill/betaPill.js +8 -7
  4. package/dist/card/card.d.ts +2 -1
  5. package/dist/card/card.js +4 -2
  6. package/dist/card/components/title.d.ts +3 -1
  7. package/dist/card/components/title.js +5 -3
  8. package/dist/checkboxListWithAction/checkboxListWithAction.js +2 -1
  9. package/dist/dropdown/dropdown.js +1 -1
  10. package/dist/dropdownRaw/dropdownList.d.ts +4 -2
  11. package/dist/dropdownRaw/dropdownList.js +15 -36
  12. package/dist/dropdownRaw/dropdownRaw.js +8 -22
  13. package/dist/dropdownRaw/stateReducer/stateReducer.d.ts +1 -0
  14. package/dist/dropdownRaw/stateReducer/stateReducer.js +13 -14
  15. package/dist/dropdownRaw/stateReducer/stateReducerHelper.d.ts +1 -2
  16. package/dist/dropdownRaw/stateReducer/stateReducerHelper.js +5 -12
  17. package/dist/headerTitle/headerTitle.d.ts +9 -3
  18. package/dist/headerTitle/headerTitle.js +3 -2
  19. package/dist/index.css +34 -2
  20. package/dist/index.d.ts +1 -1
  21. package/esm/betaPill/betaPill.d.ts +9 -4
  22. package/esm/betaPill/betaPill.js +8 -7
  23. package/esm/card/card.d.ts +2 -1
  24. package/esm/card/card.js +4 -2
  25. package/esm/card/components/title.d.ts +3 -1
  26. package/esm/card/components/title.js +5 -3
  27. package/esm/checkboxListWithAction/checkboxListWithAction.js +2 -1
  28. package/esm/dropdown/dropdown.js +1 -1
  29. package/esm/dropdownRaw/dropdownList.d.ts +4 -2
  30. package/esm/dropdownRaw/dropdownList.js +15 -36
  31. package/esm/dropdownRaw/dropdownRaw.js +9 -23
  32. package/esm/dropdownRaw/stateReducer/stateReducer.d.ts +1 -0
  33. package/esm/dropdownRaw/stateReducer/stateReducer.js +14 -15
  34. package/esm/dropdownRaw/stateReducer/stateReducerHelper.d.ts +1 -2
  35. package/esm/dropdownRaw/stateReducer/stateReducerHelper.js +3 -10
  36. package/esm/headerTitle/headerTitle.d.ts +9 -3
  37. package/esm/headerTitle/headerTitle.js +3 -2
  38. package/esm/index.d.ts +1 -1
  39. package/package.json +1 -1
package/README.md CHANGED
@@ -56,12 +56,15 @@ Zenith library provides components defined in Zenith Design System. It includes
56
56
  - Allow multiple columns to be disabled in `ColumnsList`
57
57
  - Flip icons for Arabic (RTL) language
58
58
  - `Dropdown` search and select-all improvements
59
- - Fix system font fallback in Storybook pages
60
- - [MYG-128651](https://geotab.atlassian.net/browse/MYG-128651): Update Zenith beta pill parameters to take optional custom text
61
- - Increase max height of zen popup
62
- - [MYG-128520](https://geotab.atlassian.net/browse/MYG-128520): Fix SidePanel not animating open due to RTL regression
63
- - [MYG-121631](https://geotab.atlassian.net/browse/MYG-121631): Add `closeOnScroll` prop to close `ContextMenu` on scroll
64
- - [MYG-123578](https://geotab.atlassian.net/browse/MYG-123578): Fix checkbox accessibility by moving input inside label wrapper
59
+ - Fix `SidePanel` not animating open due to RTL regression
60
+ - Add `closeOnScroll` prop to close `ContextMenu` on scroll
61
+ - Fix checkbox accessibility by moving input inside label wrapper
62
+ - Fix multi-page selection in `Table` selectable rows
63
+ - Add `titleAs` prop to `Card` title to control heading tag (`h1`–`h6`)
64
+
65
+ ### 3.9.2
66
+
67
+ - Fix `ControlledPopup` max-height
65
68
 
66
69
  ### 3.9.1
67
70
 
@@ -6,21 +6,26 @@ export interface IBetaPillActions {
6
6
  link?: string;
7
7
  linkOptions?: ILinkOptions;
8
8
  }
9
+ /**
10
+ * @internal - temporary escape hatch
11
+ * @deprecated
12
+ */
13
+ export interface IBetaPillBaseInternal {
14
+ name?: string;
15
+ description?: string;
16
+ }
9
17
  interface IBetaPillBase {
10
18
  className?: string;
11
- name?: string;
12
19
  }
13
20
  interface IBetaPillWithActions extends IBetaPillBase {
14
21
  feedbackAction?: IBetaPillActions;
15
22
  betaOptionAction?: IBetaPillActions;
16
- description?: string;
17
23
  }
18
24
  interface IBetaPillWithoutActions extends IBetaPillBase {
19
25
  feedbackAction?: never;
20
26
  betaOptionAction?: never;
21
- description?: never;
22
27
  }
23
28
  export type IBetaPill = IBetaPillWithActions | IBetaPillWithoutActions;
24
- export declare const BetaPill: ({ className, feedbackAction, betaOptionAction, name, description }: IBetaPill) => import("react/jsx-runtime").JSX.Element;
29
+ export declare const BetaPill: (props: IBetaPill) => import("react/jsx-runtime").JSX.Element;
25
30
  export declare const TRANSLATIONS: string[];
26
31
  export {};
@@ -124,13 +124,14 @@ injectString("zh-Hans", "Beta", "\u6D4B\u8BD5\u7248");
124
124
  injectString("zh-TW", "Beta", "\u6E2C\u8A66\u7248");
125
125
  injectString("ro-RO", "Beta", "Beta");
126
126
  injectString("ar-SA", "Beta", "\u062A\u062C\u0631\u064A\u0628\u064A");
127
- const BetaPill = ({
128
- className,
129
- feedbackAction,
130
- betaOptionAction,
131
- name,
132
- description
133
- }) => {
127
+ const BetaPill = props => {
128
+ const {
129
+ className,
130
+ feedbackAction,
131
+ betaOptionAction,
132
+ name,
133
+ description
134
+ } = props;
134
135
  const {
135
136
  translate
136
137
  } = (0, useLanguage_1.useLanguage)();
@@ -1,7 +1,7 @@
1
1
  import React, { FC, FunctionComponent, ReactNode } from "react";
2
2
  import { IAbsoluteSize, TContainerSize } from "../cardContainer/cardContainer";
3
3
  import { TCardStatus } from "./components/status";
4
- import { TIconType } from "./components/title";
4
+ import { THeadingTag, TIconType } from "./components/title";
5
5
  import { IActions } from "./components/actions";
6
6
  import { IContent } from "./components/content";
7
7
  import "./card.less";
@@ -42,6 +42,7 @@ export interface ICard extends IZenComponentProps, IZenGridItem, IZenFormLayoutI
42
42
  scrollableContent?: boolean;
43
43
  autoHeight?: boolean;
44
44
  fullHeight?: boolean;
45
+ titleAs?: THeadingTag;
45
46
  }
46
47
  export declare const Card: FC<ICard> & {
47
48
  Actions: FC<IActions>;
package/dist/card/card.js CHANGED
@@ -121,7 +121,8 @@ props => {
121
121
  fullWidth,
122
122
  scrollableContent = true,
123
123
  autoHeight = false,
124
- fullHeight = false
124
+ fullHeight = false,
125
+ titleAs
125
126
  } = props;
126
127
  const {
127
128
  translate
@@ -281,7 +282,8 @@ props => {
281
282
  isMobile: isMobile,
282
283
  title: title,
283
284
  icon: titleIcon,
284
- iconType: titleIconType
285
+ iconType: titleIconType,
286
+ titleAs: titleAs
285
287
  }), (0, jsx_runtime_1.jsxs)("div", {
286
288
  className: "zen-card__header-right",
287
289
  children: [!!headerActions.length && headerActions, date ? (0, jsx_runtime_1.jsx)("span", {
@@ -2,6 +2,7 @@ import { FunctionComponent } from "react";
2
2
  import "./title.less";
3
3
  import { IIcon } from "../../icons/icon";
4
4
  export type TIconType = "info" | "warning" | "error" | "success" | "default";
5
+ export type THeadingTag = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
5
6
  interface ITitle {
6
7
  isMobile: boolean;
7
8
  title: string;
@@ -12,6 +13,7 @@ interface ITitle {
12
13
  icon?: FunctionComponent<IIcon>;
13
14
  iconType?: TIconType;
14
15
  onClick?: () => void;
16
+ titleAs?: THeadingTag;
15
17
  }
16
- export declare const Title: ({ isMobile, link, target, title, id, icon, iconType, className, onClick }: ITitle) => import("react/jsx-runtime").JSX.Element;
18
+ export declare const Title: ({ isMobile, link, target, title, id, icon, iconType, className, onClick, titleAs }: ITitle) => import("react/jsx-runtime").JSX.Element;
17
19
  export {};
@@ -7,12 +7,13 @@ const classNames_1 = require("../../commonHelpers/classNames/classNames");
7
7
  const useDriveClassName_1 = require("../../utils/theme/useDriveClassName");
8
8
  const useDrive_1 = require("../../utils/theme/useDrive");
9
9
  const iconChevronRightSmall_1 = require("../../icons/iconChevronRightSmall");
10
- const Title = ({ isMobile, link, target, title, id, icon, iconType, className = "", onClick }) => {
10
+ const VALID_HEADING_TAGS = new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
11
+ const Title = ({ isMobile, link, target, title, id, icon, iconType, className = "", onClick, titleAs }) => {
11
12
  const driveClassNames = (0, useDriveClassName_1.useDriveClassName)("zen-card-title");
12
13
  const isDrive = (0, useDrive_1.useDrive)();
13
14
  const iconClassName = iconType ? `zen-card-title__icon--${iconType}` : "";
14
15
  const iconSize = (0, react_1.useMemo)(() => (isDrive ? "huge" : "large"), [isDrive]);
15
- const iconElement = (0, react_1.useMemo)(() => (icon ? (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-card-title__icon", iconClassName]), children: (0, react_1.createElement)(icon, { size: iconSize }) }) : null), [icon, iconSize, iconClassName]);
16
+ const iconElement = (0, react_1.useMemo)(() => (icon ? (0, jsx_runtime_1.jsx)("span", { className: (0, classNames_1.classNames)(["zen-card-title__icon", iconClassName]), children: (0, react_1.createElement)(icon, { size: iconSize }) }) : null), [icon, iconSize, iconClassName]);
16
17
  const chevron = (0, react_1.useMemo)(() => ((0, jsx_runtime_1.jsx)("span", { className: "zen-card-title__link-chevron", children: (0, jsx_runtime_1.jsx)(iconChevronRightSmall_1.IconChevronRightSmall, { size: iconSize, className: "zen-card-title__chevron-icon" }) })), [iconSize]);
17
18
  const titleClasses = (0, classNames_1.classNames)(["zen-card-title", driveClassNames || "", onClick ? "zen-card-title__clickable" : ""]);
18
19
  if (onClick) {
@@ -21,6 +22,7 @@ const Title = ({ isMobile, link, target, title, id, icon, iconType, className =
21
22
  if (link) {
22
23
  return ((0, jsx_runtime_1.jsxs)("a", { id: id, className: titleClasses, href: link, target: target, children: [iconElement, (0, jsx_runtime_1.jsxs)("span", { title: title, className: (0, classNames_1.classNames)(["zen-card-title__link-text"]), children: [title, chevron] })] }));
23
24
  }
24
- return ((0, jsx_runtime_1.jsxs)("div", { className: titleClasses, children: [iconElement, (0, jsx_runtime_1.jsx)("span", { title: title, id: id, className: (0, classNames_1.classNames)(["zen-card-title__text", isMobile && !isDrive ? "zen-card-title__text--mobile" : "", className]), children: title })] }));
25
+ const tag = titleAs && VALID_HEADING_TAGS.has(titleAs) ? titleAs : "div";
26
+ return (0, react_1.createElement)(tag, { className: titleClasses }, iconElement, (0, jsx_runtime_1.jsx)("span", { title: title, id: id, className: (0, classNames_1.classNames)(["zen-card-title__text", isMobile && !isDrive ? "zen-card-title__text--mobile" : "", className]), children: title }, "text"));
25
27
  };
26
28
  exports.Title = Title;
@@ -379,7 +379,8 @@ const CheckboxListWithAction = ({
379
379
  onClick: handleClick,
380
380
  title: title,
381
381
  className: classN,
382
- tabIndex: -1
382
+ tabIndex: -1,
383
+ disabled: option.blocked
383
384
  }, otherArgs, {
384
385
  children: childEl
385
386
  })) : (0, jsx_runtime_1.jsx)("div", {
@@ -24,4 +24,4 @@ const Dropdown = (_a) => {
24
24
  return (0, jsx_runtime_1.jsx)(DropDownFormField, Object.assign({}, props));
25
25
  };
26
26
  exports.Dropdown = Dropdown;
27
- exports.TRANSLATIONS = ["Filter by group", "Open filter", "Clear search", "Select all", "Deselect all", "Clear", "Back", "No data"];
27
+ exports.TRANSLATIONS = ["Filter by group", "Open filter", "Clear search", "Select all", "Clear", "Back", "No data"];
@@ -13,7 +13,9 @@ export interface IDropdownList extends IZenComponentProps {
13
13
  onSelect: (id: string) => void;
14
14
  onSingleSelect: (reset: boolean, selected?: string) => void;
15
15
  backButtonName?: string;
16
- isAllSelected: boolean;
16
+ isAllSelected?: boolean;
17
+ isSelectAllActive?: boolean;
18
+ shouldBlockItems?: boolean;
17
19
  listData: ICheckboxListWithActionOption[] | ISelectListItem[];
18
20
  isWithFooter: boolean;
19
21
  width?: number;
@@ -39,6 +41,6 @@ interface IDropdownEmptyList extends Pick<IDropdownList, "className" | "width" |
39
41
  hasError: boolean;
40
42
  }
41
43
  export declare const EmptyList: ({ className, width, onClearClick, onApplyClick, onCancelClick, hasApplyButton, isApplyDisabled, isClearButtonDisabled, isWithFooter, hasError }: IDropdownEmptyList) => import("react/jsx-runtime").JSX.Element;
42
- export declare const DropdownList: ({ onBackButtonClick, onSelectAllClick, onClearClick, onApplyClick, onCancelClick, onChange, onSelect, onSingleSelect, listData, isAllSelected, backButtonName, width, minWidth, isSelectAllButtonDisable, hasSelectAllButton, filterName, isMultiselect, hasApplyButton, isApplyDisabled, isClearButtonDisabled, activeValue, forceSelection, isWithFooter, isMobile, handleCheckboxChange, checkboxLabel, isChecked, listElementRef, listId }: IDropdownList) => import("react/jsx-runtime").JSX.Element;
44
+ export declare const DropdownList: ({ onBackButtonClick, onSelectAllClick, onClearClick, onApplyClick, onCancelClick, onChange, onSelect, onSingleSelect, listData, isSelectAllActive, shouldBlockItems, backButtonName, width, minWidth, isSelectAllButtonDisable, hasSelectAllButton, filterName, isMultiselect, hasApplyButton, isApplyDisabled, isClearButtonDisabled, activeValue, forceSelection, isWithFooter, isMobile, handleCheckboxChange, checkboxLabel, isChecked, listElementRef, listId }: IDropdownList) => import("react/jsx-runtime").JSX.Element;
43
45
  export declare const TRANSLATIONS: string[];
44
46
  export {};
@@ -174,33 +174,6 @@ injectString("zh-Hans", "Apply", "\u5E94\u7528");
174
174
  injectString("zh-TW", "Apply", "\u5957\u7528");
175
175
  injectString("ro-RO", "Apply", "Aplica\u021Bi");
176
176
  injectString("ar-SA", "Apply", "\u062A\u0637\u0628\u064A\u0642");
177
- injectString("cs", "Deselect all", "Zru\u0161it v\xFDb\u011Br v\u0161ech");
178
- injectString("da-DK", "Deselect all", "Frav\xE6lg alle");
179
- injectString("de", "Deselect all", "Auswahl f\xFCr alle aufheben");
180
- injectString("en", "Deselect all", "Deselect all");
181
- injectString("es", "Deselect all", "Deseleccionar todo");
182
- injectString("fi-FI", "Deselect all", "Poista kaikki valinnat");
183
- injectString("fr", "Deselect all", "D\xE9s\xE9lectionner tout");
184
- injectString("fr-FR", "Deselect all", "D\xE9s\xE9lectionner tout");
185
- injectString("hu-HU", "Deselect all", "Ne v\xE1lassz ki semmit.");
186
- injectString("id", "Deselect all", "Batalkan pilih semua");
187
- injectString("it", "Deselect all", "Deselezionare tutto");
188
- injectString("ja", "Deselect all", "\u3059\u3079\u3066\u3092\u9078\u629E\u89E3\u9664");
189
- injectString("ko-KR", "Deselect all", "\uBAA8\uB450 \uC120\uD0DD \uCDE8\uC18C");
190
- injectString("ms", "Deselect all", "Nyahpilih semua");
191
- injectString("nb-NO", "Deselect all", "Fjern alle valg");
192
- injectString("nl", "Deselect all", "Alles deselecteren");
193
- injectString("pl", "Deselect all", "Usu\u0144 wyb\xF3r wszystkich");
194
- injectString("pt-BR", "Deselect all", "Desmarcar tudo");
195
- injectString("pt-PT", "Deselect all", "Desmarcar tudo");
196
- injectString("sk-SK", "Deselect all", "Zru\u0161 v\xFDber v\u0161etk\xFDch.");
197
- injectString("sv", "Deselect all", "Avmarkera alla");
198
- injectString("th", "Deselect all", "\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01\u0E01\u0E32\u0E23\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14");
199
- injectString("tr", "Deselect all", "T\xFCm\xFCn\xFCn se\xE7imini iptal et");
200
- injectString("zh-Hans", "Deselect all", "\u53D6\u6D88\u5168\u9009");
201
- injectString("zh-TW", "Deselect all", "\u53D6\u6D88\u5168\u9078");
202
- injectString("ro-RO", "Deselect all", "Deselecta\u021Bi tot");
203
- injectString("ar-SA", "Deselect all", "\u0625\u0644\u063A\u0627\u0621 \u062A\u062D\u062F\u064A\u062F \u0627\u0644\u0643\u0644");
204
177
  injectString("cs", "Select all", "Vybrat v\u0161e");
205
178
  injectString("da-DK", "Select all", "V\xE6lg alle");
206
179
  injectString("de", "Select all", "Alle ausw\xE4hlen");
@@ -359,7 +332,8 @@ const DropdownList = ({
359
332
  onSelect,
360
333
  onSingleSelect,
361
334
  listData,
362
- isAllSelected,
335
+ isSelectAllActive,
336
+ shouldBlockItems,
363
337
  backButtonName,
364
338
  width,
365
339
  minWidth,
@@ -388,7 +362,7 @@ const DropdownList = ({
388
362
  const internalListId = (0, react_1.useId)();
389
363
  const selectListId = listId || internalListId;
390
364
  const handleSelectAllClick = () => {
391
- onSelectAllClick(isAllSelected);
365
+ onSelectAllClick(isSelectAllActive === true);
392
366
  };
393
367
  const handleBackButtonKeyDown = (0, react_1.useCallback)(event => {
394
368
  if (event.key === "ArrowLeft") {
@@ -416,13 +390,14 @@ const DropdownList = ({
416
390
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
417
391
  forceSelection ? onSingleSelect(false, newActiveEl || activeValue) : onSingleSelect(false, newActiveEl);
418
392
  }, [activeValue, forceSelection, onSingleSelect]);
419
- const selectButtonLabel = isAllSelected ? translate("Deselect all") : translate("Select all");
420
- const getActionButton = (label, title, icon, isDisabled, clickHandler, size, onKeyDown) => (0, jsx_runtime_1.jsx)("button", {
393
+ const selectButtonLabel = translate("Select all");
394
+ const getActionButton = (label, title, icon, isDisabled, clickHandler, size, onKeyDown, isSelected) => (0, jsx_runtime_1.jsx)("button", {
421
395
  type: "button",
422
396
  disabled: isDisabled,
423
397
  onClick: clickHandler,
424
398
  onKeyDown: onKeyDown,
425
- className: "zen-dropdown-list__item zen-dropdown-list__item--interactive zen-dropdown-list__action-button zen-dropdown-list__action-button-back",
399
+ "aria-pressed": isSelected,
400
+ className: (0, classNames_1.classNames)(["zen-dropdown-list__item zen-dropdown-list__item--interactive zen-dropdown-list__action-button zen-dropdown-list__action-button-back", isSelected ? "zen-dropdown-list__action-button--selected" : ""]),
426
401
  title: title,
427
402
  children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, {
428
403
  children: [react_1.default.createElement(icon, {
@@ -458,11 +433,15 @@ const DropdownList = ({
458
433
  });
459
434
  return values;
460
435
  };
436
+ const multiselectOptions = shouldBlockItems ? listData.map(item => Object.assign(Object.assign({}, item), {
437
+ blocked: true,
438
+ checked: false
439
+ })) : listData;
461
440
  return (0, jsx_runtime_1.jsx)("div", {
462
441
  className: "zen-dropdown-list__elements",
463
442
  ref: listElementRef,
464
443
  children: isMultiselect ? (0, jsx_runtime_1.jsx)(checkboxListWithAction_1.CheckboxListWithAction, {
465
- options: listData,
444
+ options: multiselectOptions,
466
445
  label: "",
467
446
  onChange: handleChange,
468
447
  onClick: handleClick
@@ -478,7 +457,7 @@ const DropdownList = ({
478
457
  value: createValue(listData, activeValue)
479
458
  })
480
459
  });
481
- }, [listElementRef, isMultiselect, listData, handleChange, handleClick, handleSingleChange, translate, selectListId, forceSelection, activeValue]);
460
+ }, [listElementRef, isMultiselect, shouldBlockItems, listData, handleChange, handleClick, handleSingleChange, translate, selectListId, forceSelection, activeValue]);
482
461
  return (0, jsx_runtime_1.jsxs)("div", Object.assign({
483
462
  className: (0, classNames_1.classNames)(["zen-dropdown-list", driveComponentClass || ""])
484
463
  }, styleWidth, {
@@ -496,7 +475,7 @@ const DropdownList = ({
496
475
  }) : null, backButtonName ? (0, jsx_runtime_1.jsx)("div", {
497
476
  className: "zen-dropdown-list__item-wrapper",
498
477
  children: getActionButton(backButtonName, translate("Back"), iconBackArrow_1.IconBackArrow, false, onBackButtonClick, "large", handleBackButtonKeyDown)
499
- }) : null, hasSelectAllButton ? getActionButton(selectButtonLabel, selectButtonLabel, iconCheckRadio_1.IconCheckRadio, !!isSelectAllButtonDisable, handleSelectAllClick, isDrive ? "huger" : "huge") : null, listDataComponent, isWithFooter ? (0, jsx_runtime_1.jsxs)("div", {
478
+ }) : null, hasSelectAllButton ? getActionButton(selectButtonLabel, selectButtonLabel, iconCheckRadio_1.IconCheckRadio, !!isSelectAllButtonDisable, handleSelectAllClick, isDrive ? "huger" : "huge", undefined, isSelectAllActive) : null, listDataComponent, isWithFooter ? (0, jsx_runtime_1.jsxs)("div", {
500
479
  className: "zen-dropdown-list__footer",
501
480
  children: [(0, jsx_runtime_1.jsx)(button_1.Button, {
502
481
  onClick: isMultiselect ? onClearClick : handleClearClick,
@@ -525,4 +504,4 @@ const DropdownList = ({
525
504
  }));
526
505
  };
527
506
  exports.DropdownList = DropdownList;
528
- exports.TRANSLATIONS = ["Select all", "Deselect all", "Clear", "Back", "No data"];
507
+ exports.TRANSLATIONS = ["Select all", "Clear", "Back", "No data"];
@@ -399,23 +399,6 @@ const DropdownRaw = props => {
399
399
  payload: state.currentId || state.rootId
400
400
  });
401
401
  }, [isFullSelectionMode, state.currentId, state.rootId]);
402
- const handleSelectAllInSearch = (0, react_1.useCallback)(isAllSelect => {
403
- if (isFullSelectionMode && state.isAllSelected) {
404
- dispatchState({
405
- type: stateActionType_1.StateActionType.DeselectItemsFromAllSelected,
406
- payload: undefined
407
- });
408
- return;
409
- }
410
- const dataForChange = (0, dropdownHelper_1.getDataForChange)((0, dropdownHelper_1.getListDataWithDisabled)(state.listData, state.isNestedList), state.selectedIds, isAllSelect);
411
- dispatchState({
412
- type: stateActionType_1.StateActionType.ChangeBulkSelection,
413
- payload: {
414
- itemsIds: dataForChange,
415
- value: !isAllSelect
416
- }
417
- });
418
- }, [isFullSelectionMode, state.isAllSelected, state.listData, state.isNestedList, state.selectedIds]);
419
402
  const handleClearClick = (0, react_1.useCallback)(() => {
420
403
  var _a, _b;
421
404
  dispatchState({
@@ -862,13 +845,14 @@ const DropdownRaw = props => {
862
845
  });
863
846
  }
864
847
  if (state.showList) {
865
- const isSearchMode = state.inputValue && !state.currentId;
848
+ const isSearchMode = Boolean(state.inputValue) && !state.currentId;
866
849
  const currentListData = (0, dropdownHelper_1.createListDataOptions)(state, translate, isSearchMode ? (0, dropdownHelper_1.sortDropdownItemArray)(state.listData, sortFn).slice(0, listLimit).filter(el => el.id !== state.rootId) :
867
850
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
868
851
  (0, dropdownHelper_1.sortDropdownItemArray)(((_b = state.groupsMap[state.currentId || state.rootId]) === null || _b === void 0 ? void 0 : _b.children) || [], sortFn).slice(0, listLimit) || [], multiselect, currentAllSelected);
852
+ const selectAllActiveForCurrentLevel = state.selectAllActiveForId === (state.currentId || state.rootId);
869
853
  return (0, jsx_runtime_1.jsx)(dropdownList_1.DropdownList, {
870
854
  onBackButtonClick: handleBackButtonClick,
871
- onSelectAllClick: isSearchMode ? handleSelectAllInSearch : handleSelectAllClick,
855
+ onSelectAllClick: handleSelectAllClick,
872
856
  onClearClick: handleClearClick,
873
857
  onCancelClick: handleCancelClick,
874
858
  onApplyClick: handleApplyClick,
@@ -879,6 +863,8 @@ const DropdownRaw = props => {
879
863
  backButtonName: state.currentId && state.groupsMap[state.currentId] ? (0, groupsHelper_1.getGroupDescription)(state.groupsMap[state.currentId], translate) : undefined,
880
864
  filterName: isMobile ? undefined : filterName,
881
865
  isAllSelected: currentAllSelected ? currentAllSelected : isSearchMode ? (0, dropdownHelper_1.isEveryItemSelected)((0, dropdownHelper_1.getListDataWithDisabled)(state.listData, state.isNestedList), state.selectedIds) : currentAllSelected === undefined ? (0, dropdownHelper_1.isAllChildrenSelected)(state, state.currentId || state.rootId) : false,
866
+ isSelectAllActive: isFullSelectionMode ? currentAllSelected : selectAllActiveForCurrentLevel,
867
+ shouldBlockItems: !state.inputValue && !isFullSelectionMode && selectAllActiveForCurrentLevel,
882
868
  isMultiselect: multiselect,
883
869
  forceSelection: forceSelection,
884
870
  listData: currentListData,
@@ -887,7 +873,7 @@ const DropdownRaw = props => {
887
873
  hasSelectAllButton: selectAllButton && multiselect,
888
874
  hasApplyButton: hasApplyButton,
889
875
  isApplyDisabled: memoizedIsApplyButtonDisabled,
890
- isSelectAllButtonDisable: currentListData.length === 0 || isSearchMode !== "" && state.isNestedList && (0, dropdownHelper_1.isAllItemsHasOneParent)(state.listData.filter(el => el.id !== state.rootId), (((_c = state.groupsMap[state.rootId]) === null || _c === void 0 ? void 0 : _c.children) || []).map(el => el.id)),
876
+ isSelectAllButtonDisable: currentListData.length === 0 || isSearchMode && state.isNestedList && (0, dropdownHelper_1.isAllItemsHasOneParent)(state.listData.filter(el => el.id !== state.rootId), (((_c = state.groupsMap[state.rootId]) === null || _c === void 0 ? void 0 : _c.children) || []).map(el => el.id)),
891
877
  isClearButtonDisabled: memoizedIsClearButtonDisabled,
892
878
  isWithFooter: memoizedWithFooter && !isMobile,
893
879
  isMobile: isMobile,
@@ -899,7 +885,7 @@ const DropdownRaw = props => {
899
885
  });
900
886
  }
901
887
  return null;
902
- }, [state, isLoading, isQueryMode, fetchState === null || fetchState === void 0 ? void 0 : fetchState.isLoading, fetchState === null || fetchState === void 0 ? void 0 : fetchState.error, handleClearClick, handleCancelClick, handleApplyClick, hasApplyButton, memoizedWithFooter, translate, sortFn, listLimit, multiselect, currentAllSelected, handleBackButtonClick, handleSelectAllInSearch, handleSelectAllClick, handleSelect, handleChangeCurrentId, handleSingleSelection, isMobile, filterName, forceSelection, width, selectAllButton, memoizedIsApplyButtonDisabled, memoizedIsClearButtonDisabled, isCheckboxMode, handleCheckboxChange, checkboxLabel, selectListId]);
888
+ }, [state, isLoading, isQueryMode, fetchState === null || fetchState === void 0 ? void 0 : fetchState.isLoading, fetchState === null || fetchState === void 0 ? void 0 : fetchState.error, handleClearClick, handleCancelClick, handleApplyClick, hasApplyButton, memoizedWithFooter, translate, sortFn, listLimit, multiselect, currentAllSelected, handleBackButtonClick, handleSelectAllClick, handleSelect, handleChangeCurrentId, handleSingleSelection, isMobile, filterName, forceSelection, width, selectAllButton, memoizedIsApplyButtonDisabled, memoizedIsClearButtonDisabled, isCheckboxMode, handleCheckboxChange, checkboxLabel, selectListId, isFullSelectionMode]);
903
889
  const currentStringFromSelected = isFullSelectionMode && hasApplyButton && state.globalIsAllSelected || isFullSelectionMode && !hasApplyButton && state.isAllSelected ? (0, dropdownHelper_1.getStringFromAllSelected)(state.groupsMap, translate, state.rootId) : (0, dropdownHelper_1.getStringFromSelected)(hasApplyButton ? state.globalSelectedIds : state.selectedIds, state.groupsMapSelected, translate, state.rootId);
904
890
  const memoizedCurrentSelection = (0, react_1.useMemo)(() => showSelection && !state.inputValue ? currentStringFromSelected : "", [showSelection, state.inputValue, currentStringFromSelected]);
905
891
  const parentTriggerWidth = ((_b = comboboxRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect().width) || 420;
@@ -997,4 +983,4 @@ const DropdownRaw = props => {
997
983
  };
998
984
  exports.DropdownRaw = DropdownRaw;
999
985
  exports.DropdownRaw.displayName = "DropdownRaw";
1000
- exports.TRANSLATIONS = ["Filter by group", "Open filter", "Clear search", "Select all", "Deselect all", "Clear", "Back", "No data"];
986
+ exports.TRANSLATIONS = ["Filter by group", "Open filter", "Clear search", "Select all", "Clear", "Back", "No data"];
@@ -25,6 +25,7 @@ export interface IDropdownState {
25
25
  listLimit: number;
26
26
  resultsExceedListLimit?: boolean;
27
27
  isAllSelected?: boolean;
28
+ selectAllActiveForId?: string;
28
29
  globalIsAllSelected?: boolean;
29
30
  defaultValueIsAllSelected?: boolean;
30
31
  isChecked?: boolean;
@@ -77,10 +77,12 @@ function stateReducer(state, action) {
77
77
  }
78
78
  const isCurrentListNested = Object.keys(updatedGroupsMap).length > 0 &&
79
79
  (updatedGroupsMap[exports.ROOT_GROUP_ID].children || []).some(el => el.children && el.children.length);
80
- state.groupsMap = updatedGroupsMap;
81
- const additionalStateUpdates = (0, stateReducerHelper_1.updateAllSelectedStateValueBasedOnTotalSelected)(state, state.selectedIds.length - newNamelessIds.size);
80
+ const groupsMapLength = Object.keys(updatedGroupsMap).length - 1;
81
+ const newResultsExceedListLimit = groupsMapLength >= state.listLimit;
82
+ const selectedInNewMap = state.selectedIds.filter(id => id in updatedGroupsMap).length;
83
+ const newIsAllSelected = (0, stateReducerHelper_1.computeIsAllSelected)(state.isAllSelected, state.isFullSelectionMode, newResultsExceedListLimit, groupsMapLength, selectedInNewMap);
82
84
  const rootId = (0, stateReducerHelper_1.getRootId)(updatedGroupsMap, exports.ROOT_GROUP_ID, state.firstParentNodeIsVisible);
83
- return Object.assign(Object.assign(Object.assign({}, state), { rootId: rootId || exports.ROOT_GROUP_ID, namelessIds: newNamelessIds, isNestedList: state.isNestedList ? state.isNestedList : isCurrentListNested, resultsExceedListLimit: Object.keys(updatedGroupsMap).length - 1 >= state.listLimit }), additionalStateUpdates);
85
+ return Object.assign(Object.assign({}, state), { groupsMap: updatedGroupsMap, rootId: rootId || exports.ROOT_GROUP_ID, namelessIds: newNamelessIds, isNestedList: state.isNestedList ? state.isNestedList : isCurrentListNested, resultsExceedListLimit: newResultsExceedListLimit, isAllSelected: newIsAllSelected });
84
86
  }
85
87
  case stateActionType_1.StateActionType.SetListData: {
86
88
  state.selectedIds.forEach(id => {
@@ -105,9 +107,9 @@ function stateReducer(state, action) {
105
107
  case stateActionType_1.StateActionType.SetIsOpenCombo:
106
108
  return Object.assign(Object.assign({}, state), { isOpenCombo: payload });
107
109
  case stateActionType_1.StateActionType.ResetSelection:
108
- return Object.assign(Object.assign({}, state), { selectedIds: [...state.defaultValue], isAllSelected: state.defaultValueIsAllSelected, isChecked: typeof state.isChecked === "boolean" ? state.defaultValueIsChecked || false : undefined });
110
+ return Object.assign(Object.assign({}, state), { selectedIds: [...state.defaultValue], isAllSelected: state.defaultValueIsAllSelected, isChecked: typeof state.isChecked === "boolean" ? state.defaultValueIsChecked || false : undefined, selectAllActiveForId: undefined });
109
111
  case stateActionType_1.StateActionType.ResetStateToGlobal:
110
- return Object.assign(Object.assign({}, state), { selectedIds: [...state.globalSelectedIds], isAllSelected: state.globalIsAllSelected, isChecked: state.globalIsChecked });
112
+ return Object.assign(Object.assign({}, state), { selectedIds: [...state.globalSelectedIds], isAllSelected: state.globalIsAllSelected, isChecked: state.globalIsChecked, selectAllActiveForId: undefined });
111
113
  case stateActionType_1.StateActionType.NothingToShow:
112
114
  return Object.assign(Object.assign({}, state), { showWaiting: false, showEmptyList: false, showList: false });
113
115
  case stateActionType_1.StateActionType.Show:
@@ -223,8 +225,7 @@ function stateReducer(state, action) {
223
225
  state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
224
226
  }
225
227
  });
226
- const additionalStateUpdates = (0, stateReducerHelper_1.updateAllSelectedStateValueBasedOnTotalSelected)(state, currentSelectedIds.size);
227
- return Object.assign(Object.assign(Object.assign({}, state), { selectedIds: Array.from(currentSelectedIds) }), additionalStateUpdates);
228
+ return Object.assign(Object.assign({}, state), { selectedIds: Array.from(currentSelectedIds), selectAllActiveForId: undefined, isAllSelected: state.isAllSelected });
228
229
  }
229
230
  case stateActionType_1.StateActionType.ChangeBulkSelection: {
230
231
  const { itemsIds, value } = payload;
@@ -257,8 +258,7 @@ function stateReducer(state, action) {
257
258
  state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
258
259
  }
259
260
  });
260
- const additionalStateUpdates = (0, stateReducerHelper_1.updateAllSelectedStateValueBasedOnTotalSelected)(state, currentSelectedIds.size);
261
- return Object.assign(Object.assign(Object.assign({}, state), { selectedIds: Array.from(currentSelectedIds) }), additionalStateUpdates);
261
+ return Object.assign(Object.assign({}, state), { selectedIds: Array.from(currentSelectedIds), selectAllActiveForId: undefined });
262
262
  }
263
263
  case stateActionType_1.StateActionType.SelectAllChildren: {
264
264
  const currentEl = state.groupsMap[payload];
@@ -295,7 +295,7 @@ function stateReducer(state, action) {
295
295
  state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
296
296
  }
297
297
  });
298
- return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected) });
298
+ return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected), selectAllActiveForId: payload });
299
299
  }
300
300
  case stateActionType_1.StateActionType.DeselectItemsFromAllSelected: {
301
301
  const currentEl = state.groupsMap[state.rootId];
@@ -319,7 +319,7 @@ function stateReducer(state, action) {
319
319
  state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
320
320
  }
321
321
  });
322
- return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected), isAllSelected: state.isFullSelectionMode ? false : undefined });
322
+ return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected), isAllSelected: state.isFullSelectionMode ? false : undefined, selectAllActiveForId: undefined });
323
323
  }
324
324
  case stateActionType_1.StateActionType.ToggleValueForAllSelected: {
325
325
  const currentEl = state.groupsMap[state.rootId];
@@ -338,8 +338,7 @@ function stateReducer(state, action) {
338
338
  }
339
339
  });
340
340
  const updatedIsAllSelectedValue = state.isFullSelectionMode ? !state.isAllSelected : undefined;
341
- const additionalStateUpdates = (0, stateReducerHelper_1.updateAllSelectedStateValueBasedOnTotalSelected)(state, newSelected.size);
342
- return Object.assign(Object.assign(Object.assign({}, state), { selectedIds: state.isAllSelected ? Array.from(newSelected) : [], isAllSelected: updatedIsAllSelectedValue }), additionalStateUpdates);
341
+ return Object.assign(Object.assign({}, state), { selectedIds: state.isAllSelected ? Array.from(newSelected) : [], isAllSelected: updatedIsAllSelectedValue });
343
342
  }
344
343
  case stateActionType_1.StateActionType.DeselectAllChildren: {
345
344
  const childrenForDeselect = [];
@@ -351,7 +350,7 @@ function stateReducer(state, action) {
351
350
  });
352
351
  const newSelected = new Set(state.selectedIds);
353
352
  childrenForDeselect.forEach(childId => newSelected.delete(childId));
354
- return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected) });
353
+ return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected), selectAllActiveForId: undefined });
355
354
  }
356
355
  case stateActionType_1.StateActionType.SetFirstParentNodeIsVisible: {
357
356
  if (state.firstParentNodeIsVisible === payload) {
@@ -1,6 +1,5 @@
1
- import { IDropdownState } from "./stateReducer";
2
1
  import { IDropdownRawItem } from "../types";
3
2
  import { IGroupTree, ITypedHash } from "../../groupsFilterRaw/groupsFilterInterfaces";
4
3
  export declare function getChildList(childArr: IDropdownRawItem[] | undefined): IDropdownRawItem[];
5
- export declare const updateAllSelectedStateValueBasedOnTotalSelected: (state: IDropdownState, totalSelected: number) => Partial<Pick<IDropdownState, "isAllSelected">>;
4
+ export declare const computeIsAllSelected: (currentIsAllSelected: boolean | undefined, isFullSelectionMode: boolean, resultsExceedListLimit: boolean | undefined, groupsMapLength: number, selectedCount: number) => boolean | undefined;
6
5
  export declare const getRootId: (groupsMap: ITypedHash<IGroupTree>, rootIdKey: string, firstParentNodeIsVisible?: boolean) => string | undefined;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRootId = exports.updateAllSelectedStateValueBasedOnTotalSelected = exports.getChildList = void 0;
3
+ exports.getRootId = exports.computeIsAllSelected = exports.getChildList = void 0;
4
4
  const groupsHelper_1 = require("../../groupsFilterRaw/groupsHelper");
5
5
  function getChildList(childArr) {
6
6
  const list = [];
@@ -17,17 +17,10 @@ function getChildList(childArr) {
17
17
  return list;
18
18
  }
19
19
  exports.getChildList = getChildList;
20
- const updateAllSelectedStateValueBasedOnTotalSelected = (state, totalSelected) => {
21
- const additionalStateUpdates = {};
22
- const groupsMapLength = Object.keys(state.groupsMap).length - 1;
23
- if (!state.resultsExceedListLimit && !state.isAllSelected && state.isFullSelectionMode && groupsMapLength > 0) {
24
- if (totalSelected >= groupsMapLength) {
25
- additionalStateUpdates.isAllSelected = true;
26
- }
27
- }
28
- return additionalStateUpdates;
29
- };
30
- exports.updateAllSelectedStateValueBasedOnTotalSelected = updateAllSelectedStateValueBasedOnTotalSelected;
20
+ const computeIsAllSelected = (currentIsAllSelected, isFullSelectionMode, resultsExceedListLimit, groupsMapLength, selectedCount) => !resultsExceedListLimit && currentIsAllSelected === false && isFullSelectionMode && groupsMapLength > 0 && selectedCount >= groupsMapLength
21
+ ? true
22
+ : currentIsAllSelected;
23
+ exports.computeIsAllSelected = computeIsAllSelected;
31
24
  const getRootId = (groupsMap, rootIdKey, firstParentNodeIsVisible) => {
32
25
  var _a;
33
26
  if (Object.keys(groupsMap).length === 0) {
@@ -3,6 +3,14 @@ import "./headerTitle.less";
3
3
  import { IZenComponentProps } from "../commonHelpers/zenComponent";
4
4
  import { IBetaPillActions } from "../betaPill/betaPill";
5
5
  export declare const HeaderTitleDisplayName = "PageHeader";
6
+ /**
7
+ * @internal - temporary escape hatch
8
+ * @deprecated DO NOT USE in external consumers
9
+ */
10
+ export interface IHeaderTitleInternal {
11
+ betaPillName?: string;
12
+ betaPillDescription?: string;
13
+ }
6
14
  export interface IHeaderTitle extends IZenComponentProps {
7
15
  id?: string;
8
16
  pageName: string;
@@ -16,11 +24,9 @@ export interface IHeaderTitle extends IZenComponentProps {
16
24
  allowBookmarkWithBack?: boolean;
17
25
  feedBackAction?: IBetaPillActions;
18
26
  betaOptionAction?: IBetaPillActions;
19
- betaPillName?: string;
20
- betaPillDescription?: string;
21
27
  }
22
28
  export declare const HeaderTitle: {
23
- ({ id, children, className, pageName, subline, isBeta, isMobile: isMobileProp, allowBookmarkWithBack, feedBackAction, betaOptionAction, betaPillName, betaPillDescription }: IHeaderTitle): import("react/jsx-runtime").JSX.Element;
29
+ (props: IHeaderTitle): import("react/jsx-runtime").JSX.Element;
24
30
  displayName: string;
25
31
  };
26
32
  export declare const TRANSLATIONS: string[];
@@ -10,7 +10,8 @@ const useDriveClassName_1 = require("../utils/theme/useDriveClassName");
10
10
  const headerBack_1 = require("../header/headerBack");
11
11
  const bookmark_1 = require("../bookmark/bookmark");
12
12
  exports.HeaderTitleDisplayName = "PageHeader";
13
- const HeaderTitle = ({ id, children, className, pageName, subline, isBeta, isMobile: isMobileProp, allowBookmarkWithBack, feedBackAction, betaOptionAction, betaPillName, betaPillDescription }) => {
13
+ const HeaderTitle = (props) => {
14
+ const { id, children, className, pageName, subline, isBeta, isMobile: isMobileProp, allowBookmarkWithBack, feedBackAction, betaOptionAction, betaPillName, betaPillDescription } = props;
14
15
  const isMobile = (0, useMobile_1.useMobile)();
15
16
  const driveMainLineClassName = (0, useDriveClassName_1.useDriveClassName)("zen-page-header__main-line");
16
17
  const drivePageNameClassName = (0, useDriveClassName_1.useDriveClassName)("zen-page-header__page-name");
@@ -33,7 +34,7 @@ const HeaderTitle = ({ id, children, className, pageName, subline, isBeta, isMob
33
34
  });
34
35
  return [b, b.length && !allowBookmarkWithBack ? o.filter(el => el.type !== bookmark_1.Bookmark) : o];
35
36
  }, [children, allowBookmarkWithBack]);
36
- return ((0, jsx_runtime_1.jsxs)("header", { id: id, className: clsNames, children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-page-header__main-line", driveMainLineClassName || ""]), children: [back.length ? back : null, pageName ? (0, jsx_runtime_1.jsx)("h1", { className: (0, classNames_1.classNames)(["zen-page-header__page-name", drivePageNameClassName || ""]), children: pageName }) : null, isBeta ? ((0, jsx_runtime_1.jsx)(betaPill_1.BetaPill, { feedbackAction: feedBackAction, betaOptionAction: betaOptionAction, name: betaPillName, description: betaPillDescription, className: "zen-page-header__beta" })) : null, other.length ? other : null] }), subline || ""] }));
37
+ return ((0, jsx_runtime_1.jsxs)("header", { id: id, className: clsNames, children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-page-header__main-line", driveMainLineClassName || ""]), children: [back.length ? back : null, pageName ? (0, jsx_runtime_1.jsx)("h1", { className: (0, classNames_1.classNames)(["zen-page-header__page-name", drivePageNameClassName || ""]), children: pageName }) : null, isBeta ? ((0, jsx_runtime_1.jsx)(betaPill_1.BetaPill, Object.assign({ feedbackAction: feedBackAction, betaOptionAction: betaOptionAction, className: "zen-page-header__beta" }, { name: betaPillName, description: betaPillDescription }))) : null, other.length ? other : null] }), subline || ""] }));
37
38
  };
38
39
  exports.HeaderTitle = HeaderTitle;
39
40
  exports.HeaderTitle.displayName = exports.HeaderTitleDisplayName;