@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/dist/index.css CHANGED
@@ -3031,6 +3031,10 @@ html:lang(ar) .zen-title-text--drive {
3031
3031
  font-family: var(--arabic-font-family);
3032
3032
  }
3033
3033
  .zen-card-title {
3034
+ margin: 0;
3035
+ padding: 0;
3036
+ font-size: inherit;
3037
+ font-weight: inherit;
3034
3038
  display: flex;
3035
3039
  gap: 8px;
3036
3040
  align-items: center;
@@ -4884,10 +4888,12 @@ html:lang(ar) .zen-checkbox__label-text {
4884
4888
  .zen-checkbox:has(.zen-checkbox__input:disabled) .zen-checkbox__label {
4885
4889
  fill: var(--text-reverse-primary);
4886
4890
  color: var(--text-button-disabled);
4891
+ cursor: default;
4887
4892
  }
4888
4893
  .zen-checkbox:has(.zen-checkbox__input:disabled) .zen-checkbox__box {
4889
4894
  border-color: var(--borders-general);
4890
4895
  background-color: var(--backgrounds-field-disabled);
4896
+ cursor: default;
4891
4897
  }
4892
4898
  .zen-checkbox:has(.zen-checkbox__input:disabled:checked) .zen-checkbox__box,
4893
4899
  .zen-checkbox:has(.zen-checkbox__input:disabled:indeterminate) .zen-checkbox__box {
@@ -7609,6 +7615,11 @@ html:lang(ar) .zen-checkbox-list-with-action__label {
7609
7615
  color: var(--text-hyperlink);
7610
7616
  fill: var(--text-hyperlink);
7611
7617
  }
7618
+ .zen-checkbox-list-with-action__label--action:disabled {
7619
+ cursor: default;
7620
+ color: var(--text-disabled);
7621
+ fill: var(--text-disabled);
7622
+ }
7612
7623
  .zen-checkbox-list-with-action__label-text {
7613
7624
  display: flex;
7614
7625
  flex-grow: 1;
@@ -7824,8 +7835,8 @@ html:lang(ar) .zen-dropdown-list__label {
7824
7835
  .zen-dropdown-list__item--interactive:not(:disabled) {
7825
7836
  cursor: pointer;
7826
7837
  }
7827
- .zen-dropdown-list__item--interactive:not(:disabled):hover,
7828
- .zen-dropdown-list__item--interactive:not(:disabled):focus {
7838
+ .zen-dropdown-list__item--interactive:not(:disabled):hover:not(.zen-dropdown-list__action-button--selected),
7839
+ .zen-dropdown-list__item--interactive:not(:disabled):focus:not(.zen-dropdown-list__action-button--selected) {
7829
7840
  color: var(--text-primary);
7830
7841
  fill: var(--action-secondary--default);
7831
7842
  outline: none;
@@ -7895,6 +7906,27 @@ html:lang(ar) .zen-dropdown-list__action-label {
7895
7906
  .zen-dropdown-list__action-button:disabled svg {
7896
7907
  fill: var(--text-button-disabled);
7897
7908
  }
7909
+ .zen-dropdown-list__action-button--selected {
7910
+ background-color: var(--action-primary--default);
7911
+ }
7912
+ .zen-dropdown-list__action-button--selected.zen-dropdown-list__item--interactive:not(:disabled):hover,
7913
+ .zen-dropdown-list__action-button--selected.zen-dropdown-list__item--interactive:not(:disabled):focus {
7914
+ background-color: var(--action-primary--default);
7915
+ fill: var(--text-reverse-primary);
7916
+ color: var(--text-reverse-primary);
7917
+ }
7918
+ .zen-dropdown-list__action-button--selected.zen-dropdown-list__item--interactive:not(:disabled):focus-visible {
7919
+ border-color: var(--backgrounds-content-1);
7920
+ outline: 1px solid var(--borders-form-field--active);
7921
+ outline-offset: 2px;
7922
+ }
7923
+ .zen-dropdown-list__action-button--selected .zen-dropdown-list__icon {
7924
+ color: var(--text-reverse-primary);
7925
+ fill: var(--text-reverse-primary);
7926
+ }
7927
+ .zen-dropdown-list__action-button--selected .zen-dropdown-list__action-label {
7928
+ color: var(--text-reverse-primary);
7929
+ }
7898
7930
  .zen-dropdown-list__footer {
7899
7931
  display: flex;
7900
7932
  justify-content: flex-start;
package/dist/index.d.ts CHANGED
@@ -20,7 +20,7 @@ export { type ICardButton, CardButton } from "./card/components/cardButton/cardB
20
20
  export { type ICardToggle, CardToggle } from "./card/components/cardToggle/cardToggle";
21
21
  export { type IContent, Content } from "./card/components/content";
22
22
  export { type TCardStatus, Status } from "./card/components/status";
23
- export { Title } from "./card/components/title";
23
+ export { type THeadingTag, Title } from "./card/components/title";
24
24
  export { TitleLink } from "./card/components/titleLink";
25
25
  export { getDefaultFullWidthValue } from "./card/helpers/getDefaultFullWidthValue";
26
26
  export { getIconFromStatus } from "./card/helpers/getIconFromStatus";
@@ -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 {};
@@ -116,13 +116,14 @@ injectString("zh-Hans", "Beta", "\u6D4B\u8BD5\u7248");
116
116
  injectString("zh-TW", "Beta", "\u6E2C\u8A66\u7248");
117
117
  injectString("ro-RO", "Beta", "Beta");
118
118
  injectString("ar-SA", "Beta", "\u062A\u062C\u0631\u064A\u0628\u064A");
119
- export const BetaPill = ({
120
- className,
121
- feedbackAction,
122
- betaOptionAction,
123
- name,
124
- description
125
- }) => {
119
+ export const BetaPill = props => {
120
+ const {
121
+ className,
122
+ feedbackAction,
123
+ betaOptionAction,
124
+ name,
125
+ description
126
+ } = props;
126
127
  const {
127
128
  translate
128
129
  } = 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/esm/card/card.js CHANGED
@@ -82,7 +82,8 @@ props => {
82
82
  fullWidth,
83
83
  scrollableContent = true,
84
84
  autoHeight = false,
85
- fullHeight = false
85
+ fullHeight = false,
86
+ titleAs
86
87
  } = props;
87
88
  const {
88
89
  translate
@@ -242,7 +243,8 @@ props => {
242
243
  isMobile: isMobile,
243
244
  title: title,
244
245
  icon: titleIcon,
245
- iconType: titleIconType
246
+ iconType: titleIconType,
247
+ titleAs: titleAs
246
248
  }), _jsxs("div", {
247
249
  className: "zen-card__header-right",
248
250
  children: [!!headerActions.length && headerActions, date ? _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 {};
@@ -4,12 +4,13 @@ import { classNames } from "../../commonHelpers/classNames/classNames";
4
4
  import { useDriveClassName } from "../../utils/theme/useDriveClassName";
5
5
  import { useDrive } from "../../utils/theme/useDrive";
6
6
  import { IconChevronRightSmall } from "../../icons/iconChevronRightSmall";
7
- export const Title = ({ isMobile, link, target, title, id, icon, iconType, className = "", onClick }) => {
7
+ const VALID_HEADING_TAGS = new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
8
+ export const Title = ({ isMobile, link, target, title, id, icon, iconType, className = "", onClick, titleAs }) => {
8
9
  const driveClassNames = useDriveClassName("zen-card-title");
9
10
  const isDrive = useDrive();
10
11
  const iconClassName = iconType ? `zen-card-title__icon--${iconType}` : "";
11
12
  const iconSize = useMemo(() => (isDrive ? "huge" : "large"), [isDrive]);
12
- const iconElement = useMemo(() => (icon ? _jsx("div", { className: classNames(["zen-card-title__icon", iconClassName]), children: createElement(icon, { size: iconSize }) }) : null), [icon, iconSize, iconClassName]);
13
+ const iconElement = useMemo(() => (icon ? _jsx("span", { className: classNames(["zen-card-title__icon", iconClassName]), children: createElement(icon, { size: iconSize }) }) : null), [icon, iconSize, iconClassName]);
13
14
  const chevron = useMemo(() => (_jsx("span", { className: "zen-card-title__link-chevron", children: _jsx(IconChevronRightSmall, { size: iconSize, className: "zen-card-title__chevron-icon" }) })), [iconSize]);
14
15
  const titleClasses = classNames(["zen-card-title", driveClassNames || "", onClick ? "zen-card-title__clickable" : ""]);
15
16
  if (onClick) {
@@ -18,5 +19,6 @@ export const Title = ({ isMobile, link, target, title, id, icon, iconType, class
18
19
  if (link) {
19
20
  return (_jsxs("a", { id: id, className: titleClasses, href: link, target: target, children: [iconElement, _jsxs("span", { title: title, className: classNames(["zen-card-title__link-text"]), children: [title, chevron] })] }));
20
21
  }
21
- return (_jsxs("div", { className: titleClasses, children: [iconElement, _jsx("span", { title: title, id: id, className: classNames(["zen-card-title__text", isMobile && !isDrive ? "zen-card-title__text--mobile" : "", className]), children: title })] }));
22
+ const tag = titleAs && VALID_HEADING_TAGS.has(titleAs) ? titleAs : "div";
23
+ return createElement(tag, { className: titleClasses }, iconElement, _jsx("span", { title: title, id: id, className: classNames(["zen-card-title__text", isMobile && !isDrive ? "zen-card-title__text--mobile" : "", className]), children: title }, "text"));
22
24
  };
@@ -371,7 +371,8 @@ export const CheckboxListWithAction = ({
371
371
  onClick: handleClick,
372
372
  title: title,
373
373
  className: classN,
374
- tabIndex: -1
374
+ tabIndex: -1,
375
+ disabled: option.blocked
375
376
  }, otherArgs, {
376
377
  children: childEl
377
378
  })) : _jsx("div", {
@@ -20,4 +20,4 @@ export const Dropdown = (_a) => {
20
20
  var props = __rest(_a, []);
21
21
  return _jsx(DropDownFormField, Object.assign({}, props));
22
22
  };
23
- export const TRANSLATIONS = ["Filter by group", "Open filter", "Clear search", "Select all", "Deselect all", "Clear", "Back", "No data"];
23
+ export const 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 {};
@@ -148,33 +148,6 @@ injectString("zh-Hans", "Apply", "\u5E94\u7528");
148
148
  injectString("zh-TW", "Apply", "\u5957\u7528");
149
149
  injectString("ro-RO", "Apply", "Aplica\u021Bi");
150
150
  injectString("ar-SA", "Apply", "\u062A\u0637\u0628\u064A\u0642");
151
- injectString("cs", "Deselect all", "Zru\u0161it v\xFDb\u011Br v\u0161ech");
152
- injectString("da-DK", "Deselect all", "Frav\xE6lg alle");
153
- injectString("de", "Deselect all", "Auswahl f\xFCr alle aufheben");
154
- injectString("en", "Deselect all", "Deselect all");
155
- injectString("es", "Deselect all", "Deseleccionar todo");
156
- injectString("fi-FI", "Deselect all", "Poista kaikki valinnat");
157
- injectString("fr", "Deselect all", "D\xE9s\xE9lectionner tout");
158
- injectString("fr-FR", "Deselect all", "D\xE9s\xE9lectionner tout");
159
- injectString("hu-HU", "Deselect all", "Ne v\xE1lassz ki semmit.");
160
- injectString("id", "Deselect all", "Batalkan pilih semua");
161
- injectString("it", "Deselect all", "Deselezionare tutto");
162
- injectString("ja", "Deselect all", "\u3059\u3079\u3066\u3092\u9078\u629E\u89E3\u9664");
163
- injectString("ko-KR", "Deselect all", "\uBAA8\uB450 \uC120\uD0DD \uCDE8\uC18C");
164
- injectString("ms", "Deselect all", "Nyahpilih semua");
165
- injectString("nb-NO", "Deselect all", "Fjern alle valg");
166
- injectString("nl", "Deselect all", "Alles deselecteren");
167
- injectString("pl", "Deselect all", "Usu\u0144 wyb\xF3r wszystkich");
168
- injectString("pt-BR", "Deselect all", "Desmarcar tudo");
169
- injectString("pt-PT", "Deselect all", "Desmarcar tudo");
170
- injectString("sk-SK", "Deselect all", "Zru\u0161 v\xFDber v\u0161etk\xFDch.");
171
- injectString("sv", "Deselect all", "Avmarkera alla");
172
- 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");
173
- injectString("tr", "Deselect all", "T\xFCm\xFCn\xFCn se\xE7imini iptal et");
174
- injectString("zh-Hans", "Deselect all", "\u53D6\u6D88\u5168\u9009");
175
- injectString("zh-TW", "Deselect all", "\u53D6\u6D88\u5168\u9078");
176
- injectString("ro-RO", "Deselect all", "Deselecta\u021Bi tot");
177
- injectString("ar-SA", "Deselect all", "\u0625\u0644\u063A\u0627\u0621 \u062A\u062D\u062F\u064A\u062F \u0627\u0644\u0643\u0644");
178
151
  injectString("cs", "Select all", "Vybrat v\u0161e");
179
152
  injectString("da-DK", "Select all", "V\xE6lg alle");
180
153
  injectString("de", "Select all", "Alle ausw\xE4hlen");
@@ -319,7 +292,8 @@ export const DropdownList = ({
319
292
  onSelect,
320
293
  onSingleSelect,
321
294
  listData,
322
- isAllSelected,
295
+ isSelectAllActive,
296
+ shouldBlockItems,
323
297
  backButtonName,
324
298
  width,
325
299
  minWidth,
@@ -348,7 +322,7 @@ export const DropdownList = ({
348
322
  const internalListId = useId();
349
323
  const selectListId = listId || internalListId;
350
324
  const handleSelectAllClick = () => {
351
- onSelectAllClick(isAllSelected);
325
+ onSelectAllClick(isSelectAllActive === true);
352
326
  };
353
327
  const handleBackButtonKeyDown = useCallback(event => {
354
328
  if (event.key === "ArrowLeft") {
@@ -376,13 +350,14 @@ export const DropdownList = ({
376
350
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
377
351
  forceSelection ? onSingleSelect(false, newActiveEl || activeValue) : onSingleSelect(false, newActiveEl);
378
352
  }, [activeValue, forceSelection, onSingleSelect]);
379
- const selectButtonLabel = isAllSelected ? translate("Deselect all") : translate("Select all");
380
- const getActionButton = (label, title, icon, isDisabled, clickHandler, size, onKeyDown) => _jsx("button", {
353
+ const selectButtonLabel = translate("Select all");
354
+ const getActionButton = (label, title, icon, isDisabled, clickHandler, size, onKeyDown, isSelected) => _jsx("button", {
381
355
  type: "button",
382
356
  disabled: isDisabled,
383
357
  onClick: clickHandler,
384
358
  onKeyDown: onKeyDown,
385
- className: "zen-dropdown-list__item zen-dropdown-list__item--interactive zen-dropdown-list__action-button zen-dropdown-list__action-button-back",
359
+ "aria-pressed": isSelected,
360
+ className: 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" : ""]),
386
361
  title: title,
387
362
  children: _jsxs(_Fragment, {
388
363
  children: [React.createElement(icon, {
@@ -418,11 +393,15 @@ export const DropdownList = ({
418
393
  });
419
394
  return values;
420
395
  };
396
+ const multiselectOptions = shouldBlockItems ? listData.map(item => Object.assign(Object.assign({}, item), {
397
+ blocked: true,
398
+ checked: false
399
+ })) : listData;
421
400
  return _jsx("div", {
422
401
  className: "zen-dropdown-list__elements",
423
402
  ref: listElementRef,
424
403
  children: isMultiselect ? _jsx(CheckboxListWithAction, {
425
- options: listData,
404
+ options: multiselectOptions,
426
405
  label: "",
427
406
  onChange: handleChange,
428
407
  onClick: handleClick
@@ -438,7 +417,7 @@ export const DropdownList = ({
438
417
  value: createValue(listData, activeValue)
439
418
  })
440
419
  });
441
- }, [listElementRef, isMultiselect, listData, handleChange, handleClick, handleSingleChange, translate, selectListId, forceSelection, activeValue]);
420
+ }, [listElementRef, isMultiselect, shouldBlockItems, listData, handleChange, handleClick, handleSingleChange, translate, selectListId, forceSelection, activeValue]);
442
421
  return _jsxs("div", Object.assign({
443
422
  className: classNames(["zen-dropdown-list", driveComponentClass || ""])
444
423
  }, styleWidth, {
@@ -456,7 +435,7 @@ export const DropdownList = ({
456
435
  }) : null, backButtonName ? _jsx("div", {
457
436
  className: "zen-dropdown-list__item-wrapper",
458
437
  children: getActionButton(backButtonName, translate("Back"), IconBackArrow, false, onBackButtonClick, "large", handleBackButtonKeyDown)
459
- }) : null, hasSelectAllButton ? getActionButton(selectButtonLabel, selectButtonLabel, IconCheckRadio, !!isSelectAllButtonDisable, handleSelectAllClick, isDrive ? "huger" : "huge") : null, listDataComponent, isWithFooter ? _jsxs("div", {
438
+ }) : null, hasSelectAllButton ? getActionButton(selectButtonLabel, selectButtonLabel, IconCheckRadio, !!isSelectAllButtonDisable, handleSelectAllClick, isDrive ? "huger" : "huge", undefined, isSelectAllActive) : null, listDataComponent, isWithFooter ? _jsxs("div", {
460
439
  className: "zen-dropdown-list__footer",
461
440
  children: [_jsx(Button, {
462
441
  onClick: isMultiselect ? onClearClick : handleClearClick,
@@ -484,4 +463,4 @@ export const DropdownList = ({
484
463
  }) : null]
485
464
  }));
486
465
  };
487
- export const TRANSLATIONS = ["Select all", "Deselect all", "Clear", "Back", "No data"];
466
+ export const TRANSLATIONS = ["Select all", "Clear", "Back", "No data"];
@@ -8,7 +8,7 @@ import { getInitialState, stateReducer, ROOT_GROUP_ID } from "./stateReducer/sta
8
8
  import { StateActionType } from "./stateReducer/stateActionType";
9
9
  import { FOCUSABLE_SELECTOR } from "../utils/focusableSelector";
10
10
  import { useEscape } from "../commonHelpers/hooks/useEscape";
11
- import { checkIsDataProblem, compareObjectsArrays, compareStringsArrays, createListDataOptions, getDataForChange, getListDataWithDisabled, getSelectedCount, getStringFromAllSelected, getStringFromSelected, isAllChildrenSelected, isAllItemsHasOneParent, isEveryItemSelected, prepareSelectedIdsToItems, sortDropdownItemArray } from "./dropdownHelper";
11
+ import { checkIsDataProblem, compareObjectsArrays, compareStringsArrays, createListDataOptions, getListDataWithDisabled, getSelectedCount, getStringFromAllSelected, getStringFromSelected, isAllChildrenSelected, isAllItemsHasOneParent, isEveryItemSelected, prepareSelectedIdsToItems, sortDropdownItemArray } from "./dropdownHelper";
12
12
  import { DropdownTrigger } from "./dropdownTrigger";
13
13
  import { isFocusable } from "../dialog/dialogHelpers";
14
14
  import { useLanguage } from "../utils/localization/useLanguage";
@@ -391,23 +391,6 @@ export const DropdownRaw = props => {
391
391
  payload: state.currentId || state.rootId
392
392
  });
393
393
  }, [isFullSelectionMode, state.currentId, state.rootId]);
394
- const handleSelectAllInSearch = useCallback(isAllSelect => {
395
- if (isFullSelectionMode && state.isAllSelected) {
396
- dispatchState({
397
- type: StateActionType.DeselectItemsFromAllSelected,
398
- payload: undefined
399
- });
400
- return;
401
- }
402
- const dataForChange = getDataForChange(getListDataWithDisabled(state.listData, state.isNestedList), state.selectedIds, isAllSelect);
403
- dispatchState({
404
- type: StateActionType.ChangeBulkSelection,
405
- payload: {
406
- itemsIds: dataForChange,
407
- value: !isAllSelect
408
- }
409
- });
410
- }, [isFullSelectionMode, state.isAllSelected, state.listData, state.isNestedList, state.selectedIds]);
411
394
  const handleClearClick = useCallback(() => {
412
395
  var _a, _b;
413
396
  dispatchState({
@@ -854,13 +837,14 @@ export const DropdownRaw = props => {
854
837
  });
855
838
  }
856
839
  if (state.showList) {
857
- const isSearchMode = state.inputValue && !state.currentId;
840
+ const isSearchMode = Boolean(state.inputValue) && !state.currentId;
858
841
  const currentListData = createListDataOptions(state, translate, isSearchMode ? sortDropdownItemArray(state.listData, sortFn).slice(0, listLimit).filter(el => el.id !== state.rootId) :
859
842
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
860
843
  sortDropdownItemArray(((_b = state.groupsMap[state.currentId || state.rootId]) === null || _b === void 0 ? void 0 : _b.children) || [], sortFn).slice(0, listLimit) || [], multiselect, currentAllSelected);
844
+ const selectAllActiveForCurrentLevel = state.selectAllActiveForId === (state.currentId || state.rootId);
861
845
  return _jsx(DropdownList, {
862
846
  onBackButtonClick: handleBackButtonClick,
863
- onSelectAllClick: isSearchMode ? handleSelectAllInSearch : handleSelectAllClick,
847
+ onSelectAllClick: handleSelectAllClick,
864
848
  onClearClick: handleClearClick,
865
849
  onCancelClick: handleCancelClick,
866
850
  onApplyClick: handleApplyClick,
@@ -871,6 +855,8 @@ export const DropdownRaw = props => {
871
855
  backButtonName: state.currentId && state.groupsMap[state.currentId] ? getGroupDescription(state.groupsMap[state.currentId], translate) : undefined,
872
856
  filterName: isMobile ? undefined : filterName,
873
857
  isAllSelected: currentAllSelected ? currentAllSelected : isSearchMode ? isEveryItemSelected(getListDataWithDisabled(state.listData, state.isNestedList), state.selectedIds) : currentAllSelected === undefined ? isAllChildrenSelected(state, state.currentId || state.rootId) : false,
858
+ isSelectAllActive: isFullSelectionMode ? currentAllSelected : selectAllActiveForCurrentLevel,
859
+ shouldBlockItems: !state.inputValue && !isFullSelectionMode && selectAllActiveForCurrentLevel,
874
860
  isMultiselect: multiselect,
875
861
  forceSelection: forceSelection,
876
862
  listData: currentListData,
@@ -879,7 +865,7 @@ export const DropdownRaw = props => {
879
865
  hasSelectAllButton: selectAllButton && multiselect,
880
866
  hasApplyButton: hasApplyButton,
881
867
  isApplyDisabled: memoizedIsApplyButtonDisabled,
882
- isSelectAllButtonDisable: currentListData.length === 0 || isSearchMode !== "" && state.isNestedList && 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)),
868
+ isSelectAllButtonDisable: currentListData.length === 0 || isSearchMode && state.isNestedList && 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)),
883
869
  isClearButtonDisabled: memoizedIsClearButtonDisabled,
884
870
  isWithFooter: memoizedWithFooter && !isMobile,
885
871
  isMobile: isMobile,
@@ -891,7 +877,7 @@ export const DropdownRaw = props => {
891
877
  });
892
878
  }
893
879
  return null;
894
- }, [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]);
880
+ }, [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]);
895
881
  const currentStringFromSelected = isFullSelectionMode && hasApplyButton && state.globalIsAllSelected || isFullSelectionMode && !hasApplyButton && state.isAllSelected ? getStringFromAllSelected(state.groupsMap, translate, state.rootId) : getStringFromSelected(hasApplyButton ? state.globalSelectedIds : state.selectedIds, state.groupsMapSelected, translate, state.rootId);
896
882
  const memoizedCurrentSelection = useMemo(() => showSelection && !state.inputValue ? currentStringFromSelected : "", [showSelection, state.inputValue, currentStringFromSelected]);
897
883
  const parentTriggerWidth = ((_b = comboboxRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect().width) || 420;
@@ -988,4 +974,4 @@ export const DropdownRaw = props => {
988
974
  });
989
975
  };
990
976
  DropdownRaw.displayName = "DropdownRaw";
991
- export const TRANSLATIONS = ["Filter by group", "Open filter", "Clear search", "Select all", "Deselect all", "Clear", "Back", "No data"];
977
+ export const 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;
@@ -1,5 +1,5 @@
1
1
  import { StateActionType } from "./stateActionType";
2
- import { getChildList, updateAllSelectedStateValueBasedOnTotalSelected, getRootId } from "./stateReducerHelper";
2
+ import { getChildList, getRootId, computeIsAllSelected } from "./stateReducerHelper";
3
3
  import { createGroupsMap } from "../../groupsFilterRaw/groupsFilterHelper";
4
4
  export const ROOT_GROUP_ID = "zen_dropdown_root_group_id";
5
5
  export const getInitialState = (isFullSelectionMode, comboItems, selection, listLimit, defaultValue, isAllSelected, defaultValueIsAllSelected, isChecked, defaultValueIsChecked, firstParentNodeIsVisible) => {
@@ -73,10 +73,12 @@ export function stateReducer(state, action) {
73
73
  }
74
74
  const isCurrentListNested = Object.keys(updatedGroupsMap).length > 0 &&
75
75
  (updatedGroupsMap[ROOT_GROUP_ID].children || []).some(el => el.children && el.children.length);
76
- state.groupsMap = updatedGroupsMap;
77
- const additionalStateUpdates = updateAllSelectedStateValueBasedOnTotalSelected(state, state.selectedIds.length - newNamelessIds.size);
76
+ const groupsMapLength = Object.keys(updatedGroupsMap).length - 1;
77
+ const newResultsExceedListLimit = groupsMapLength >= state.listLimit;
78
+ const selectedInNewMap = state.selectedIds.filter(id => id in updatedGroupsMap).length;
79
+ const newIsAllSelected = computeIsAllSelected(state.isAllSelected, state.isFullSelectionMode, newResultsExceedListLimit, groupsMapLength, selectedInNewMap);
78
80
  const rootId = getRootId(updatedGroupsMap, ROOT_GROUP_ID, state.firstParentNodeIsVisible);
79
- return Object.assign(Object.assign(Object.assign({}, state), { rootId: rootId || ROOT_GROUP_ID, namelessIds: newNamelessIds, isNestedList: state.isNestedList ? state.isNestedList : isCurrentListNested, resultsExceedListLimit: Object.keys(updatedGroupsMap).length - 1 >= state.listLimit }), additionalStateUpdates);
81
+ return Object.assign(Object.assign({}, state), { groupsMap: updatedGroupsMap, rootId: rootId || ROOT_GROUP_ID, namelessIds: newNamelessIds, isNestedList: state.isNestedList ? state.isNestedList : isCurrentListNested, resultsExceedListLimit: newResultsExceedListLimit, isAllSelected: newIsAllSelected });
80
82
  }
81
83
  case StateActionType.SetListData: {
82
84
  state.selectedIds.forEach(id => {
@@ -101,9 +103,9 @@ export function stateReducer(state, action) {
101
103
  case StateActionType.SetIsOpenCombo:
102
104
  return Object.assign(Object.assign({}, state), { isOpenCombo: payload });
103
105
  case StateActionType.ResetSelection:
104
- return Object.assign(Object.assign({}, state), { selectedIds: [...state.defaultValue], isAllSelected: state.defaultValueIsAllSelected, isChecked: typeof state.isChecked === "boolean" ? state.defaultValueIsChecked || false : undefined });
106
+ return Object.assign(Object.assign({}, state), { selectedIds: [...state.defaultValue], isAllSelected: state.defaultValueIsAllSelected, isChecked: typeof state.isChecked === "boolean" ? state.defaultValueIsChecked || false : undefined, selectAllActiveForId: undefined });
105
107
  case StateActionType.ResetStateToGlobal:
106
- return Object.assign(Object.assign({}, state), { selectedIds: [...state.globalSelectedIds], isAllSelected: state.globalIsAllSelected, isChecked: state.globalIsChecked });
108
+ return Object.assign(Object.assign({}, state), { selectedIds: [...state.globalSelectedIds], isAllSelected: state.globalIsAllSelected, isChecked: state.globalIsChecked, selectAllActiveForId: undefined });
107
109
  case StateActionType.NothingToShow:
108
110
  return Object.assign(Object.assign({}, state), { showWaiting: false, showEmptyList: false, showList: false });
109
111
  case StateActionType.Show:
@@ -219,8 +221,7 @@ export function stateReducer(state, action) {
219
221
  state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
220
222
  }
221
223
  });
222
- const additionalStateUpdates = updateAllSelectedStateValueBasedOnTotalSelected(state, currentSelectedIds.size);
223
- return Object.assign(Object.assign(Object.assign({}, state), { selectedIds: Array.from(currentSelectedIds) }), additionalStateUpdates);
224
+ return Object.assign(Object.assign({}, state), { selectedIds: Array.from(currentSelectedIds), selectAllActiveForId: undefined, isAllSelected: state.isAllSelected });
224
225
  }
225
226
  case StateActionType.ChangeBulkSelection: {
226
227
  const { itemsIds, value } = payload;
@@ -253,8 +254,7 @@ export function stateReducer(state, action) {
253
254
  state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
254
255
  }
255
256
  });
256
- const additionalStateUpdates = updateAllSelectedStateValueBasedOnTotalSelected(state, currentSelectedIds.size);
257
- return Object.assign(Object.assign(Object.assign({}, state), { selectedIds: Array.from(currentSelectedIds) }), additionalStateUpdates);
257
+ return Object.assign(Object.assign({}, state), { selectedIds: Array.from(currentSelectedIds), selectAllActiveForId: undefined });
258
258
  }
259
259
  case StateActionType.SelectAllChildren: {
260
260
  const currentEl = state.groupsMap[payload];
@@ -291,7 +291,7 @@ export function stateReducer(state, action) {
291
291
  state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
292
292
  }
293
293
  });
294
- return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected) });
294
+ return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected), selectAllActiveForId: payload });
295
295
  }
296
296
  case StateActionType.DeselectItemsFromAllSelected: {
297
297
  const currentEl = state.groupsMap[state.rootId];
@@ -315,7 +315,7 @@ export function stateReducer(state, action) {
315
315
  state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
316
316
  }
317
317
  });
318
- return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected), isAllSelected: state.isFullSelectionMode ? false : undefined });
318
+ return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected), isAllSelected: state.isFullSelectionMode ? false : undefined, selectAllActiveForId: undefined });
319
319
  }
320
320
  case StateActionType.ToggleValueForAllSelected: {
321
321
  const currentEl = state.groupsMap[state.rootId];
@@ -334,8 +334,7 @@ export function stateReducer(state, action) {
334
334
  }
335
335
  });
336
336
  const updatedIsAllSelectedValue = state.isFullSelectionMode ? !state.isAllSelected : undefined;
337
- const additionalStateUpdates = updateAllSelectedStateValueBasedOnTotalSelected(state, newSelected.size);
338
- return Object.assign(Object.assign(Object.assign({}, state), { selectedIds: state.isAllSelected ? Array.from(newSelected) : [], isAllSelected: updatedIsAllSelectedValue }), additionalStateUpdates);
337
+ return Object.assign(Object.assign({}, state), { selectedIds: state.isAllSelected ? Array.from(newSelected) : [], isAllSelected: updatedIsAllSelectedValue });
339
338
  }
340
339
  case StateActionType.DeselectAllChildren: {
341
340
  const childrenForDeselect = [];
@@ -347,7 +346,7 @@ export function stateReducer(state, action) {
347
346
  });
348
347
  const newSelected = new Set(state.selectedIds);
349
348
  childrenForDeselect.forEach(childId => newSelected.delete(childId));
350
- return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected) });
349
+ return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected), selectAllActiveForId: undefined });
351
350
  }
352
351
  case StateActionType.SetFirstParentNodeIsVisible: {
353
352
  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;
@@ -13,16 +13,9 @@ export function getChildList(childArr) {
13
13
  });
14
14
  return list;
15
15
  }
16
- export const updateAllSelectedStateValueBasedOnTotalSelected = (state, totalSelected) => {
17
- const additionalStateUpdates = {};
18
- const groupsMapLength = Object.keys(state.groupsMap).length - 1;
19
- if (!state.resultsExceedListLimit && !state.isAllSelected && state.isFullSelectionMode && groupsMapLength > 0) {
20
- if (totalSelected >= groupsMapLength) {
21
- additionalStateUpdates.isAllSelected = true;
22
- }
23
- }
24
- return additionalStateUpdates;
25
- };
16
+ export const computeIsAllSelected = (currentIsAllSelected, isFullSelectionMode, resultsExceedListLimit, groupsMapLength, selectedCount) => !resultsExceedListLimit && currentIsAllSelected === false && isFullSelectionMode && groupsMapLength > 0 && selectedCount >= groupsMapLength
17
+ ? true
18
+ : currentIsAllSelected;
26
19
  export const getRootId = (groupsMap, rootIdKey, firstParentNodeIsVisible) => {
27
20
  var _a;
28
21
  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[];