@geotab/zenith 1.22.3 → 1.22.4

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 CHANGED
@@ -40,6 +40,18 @@ Zenith library provides components defined in Zenith Design System. It includes
40
40
 
41
41
  ## Change log
42
42
 
43
+ ### 1.22.4
44
+
45
+ * Prevent `ListItem` to follow link on action click
46
+ * Fix long title in `Card`
47
+ * Fix long title in `Banner`
48
+ * Add the property to configure initial focus in `Modal`
49
+
50
+ ### 1.22.3
51
+
52
+ * Update `Card` appearance
53
+ * Trim whitespaces in `Dropdown` search with dataItems
54
+
43
55
  ### 1.22.2
44
56
 
45
57
  * Add component `List`
package/dist/index.css CHANGED
@@ -4927,6 +4927,11 @@
4927
4927
  line-height: 16px;
4928
4928
  text-transform: none;
4929
4929
  padding-right: 8px;
4930
+ display: -webkit-box;
4931
+ -webkit-box-orient: vertical;
4932
+ -webkit-line-clamp: 1;
4933
+ overflow: hidden;
4934
+ text-align: start;
4930
4935
  }
4931
4936
  .zen-banner__header--drive {
4932
4937
  font-family: var(--main-font);
@@ -4994,6 +4999,10 @@
4994
4999
  overflow: unset;
4995
5000
  text-overflow: unset;
4996
5001
  white-space: unset;
5002
+ display: -webkit-box;
5003
+ -webkit-box-orient: vertical;
5004
+ -webkit-line-clamp: 1;
5005
+ overflow: hidden;
4997
5006
  }
4998
5007
  .zen-banner__message--multiline {
4999
5008
  font-family: var(--main-font);
@@ -6067,6 +6076,7 @@
6067
6076
  align-items: center;
6068
6077
  box-sizing: border-box;
6069
6078
  min-height: 24px;
6079
+ min-width: 0;
6070
6080
  }
6071
6081
  .zen-card-title * {
6072
6082
  box-sizing: border-box;
@@ -6123,6 +6133,7 @@
6123
6133
  flex: 1 1 auto;
6124
6134
  gap: 4px;
6125
6135
  text-decoration: none;
6136
+ min-width: 0;
6126
6137
  }
6127
6138
  .zen-card-title__link-text {
6128
6139
  font-family: var(--main-font);
@@ -6137,6 +6148,7 @@
6137
6148
  text-overflow: ellipsis;
6138
6149
  overflow: hidden;
6139
6150
  white-space: nowrap;
6151
+ min-width: 0;
6140
6152
  }
6141
6153
  .zen-card-title__link-chevron {
6142
6154
  width: 16px;
@@ -6195,6 +6207,7 @@
6195
6207
  gap: 4px;
6196
6208
  width: 100%;
6197
6209
  box-sizing: border-box;
6210
+ min-width: 0;
6198
6211
  }
6199
6212
  .zen-card__header-primary {
6200
6213
  display: flex;
@@ -6471,7 +6484,7 @@
6471
6484
  display: initial;
6472
6485
  flex: 0 0 auto;
6473
6486
  }
6474
- .zen-favorite-button__filled {
6487
+ .zen-favorite-button__filled.zen-favorite-button__filled {
6475
6488
  display: none;
6476
6489
  flex: 0 0 auto;
6477
6490
  }
package/dist/index.d.ts CHANGED
@@ -623,7 +623,8 @@ export { isButton } from "./menu/utils/isButton";
623
623
  export { isLink } from "./menu/utils/isLink";
624
624
  export { type IMiniTabElement, MiniTabsSize, type IMiniTabs, MiniTabs } from "./miniTabs/miniTabs";
625
625
  export { type IMobileSheet, MobileSheet } from "./mobileSheet/mobileSheet";
626
- export { type IModal, Modal, type IDialogContent, DialogContentNew } from "./modal/modal";
626
+ export { type TFocusElement, type IModal, Modal, type IDialogContent, DialogContentNew } from "./modal/modal";
627
+ export { getPredefinedFocusableItem } from "./modal/modalHelpers";
627
628
  export { type INotificationProps, Notification } from "./notification/notification";
628
629
  export { type IPageContentLayout, PageContentLayout } from "./pageLayout/pageContentLayout/pageContentLayout";
629
630
  export { PageLayout } from "./pageLayout/pageLayout";
package/dist/index.js CHANGED
@@ -13,9 +13,9 @@ exports.IconMove = exports.IconMouseScrollUp = exports.IconMouseScrollDown = exp
13
13
  exports.IconQuestion = exports.IconPuzzle = exports.IconPullRequest = exports.IconProcessor = exports.IconPrinter = exports.IconPound = exports.IconPlusSquare = exports.IconPlusLines = exports.IconPlusFile = exports.IconPlusCircle = exports.IconPlus = exports.IconPlay = exports.IconPinLocation3 = exports.IconPinLocation2 = exports.IconPinLocation = exports.IconPin2 = exports.IconPin = exports.IconPhoneMobile = exports.IconPhone = exports.IconPerformance = exports.IconPercent = exports.IconPeopleLike = exports.IconPeopleGroup2 = exports.IconPeopleGroup = exports.IconPeople = exports.IconPencil2 = exports.IconPencil = exports.IconPause = exports.IconPassword = exports.IconPaperPlane = exports.IconPackage3 = exports.IconPackage2 = exports.IconPackage = exports.IconPDF = exports.IconOptAlt = exports.IconOpt = exports.IconOpen2 = exports.IconOpen = exports.IconOnDuty = exports.IconNumberedList = exports.IconNotifications = exports.IconNotificationOff = exports.IconNotificationBell = exports.IconNotificationAlarm = exports.IconNote = exports.IconNewspaper = exports.IconNews = exports.IconMyGeotab = exports.IconMyAdmin = exports.IconMove2 = void 0;
14
14
  exports.IconSortVertical = exports.IconSortHorizontal = exports.IconSort2Vertical = exports.IconSort2Horizontal = exports.IconSmiley = exports.IconSign = exports.IconSidebar = exports.IconShield4 = exports.IconShield3 = exports.IconShield2 = exports.IconShield = exports.IconShare3 = exports.IconShare2 = exports.IconShare = exports.IconSettings8 = exports.IconSettings7 = exports.IconSettings6 = exports.IconSettings4 = exports.IconSettings3 = exports.IconSettings2 = exports.IconSettings1 = exports.IconServer3 = exports.IconServer2 = exports.IconServer = exports.IconSend = exports.IconSecuredLines = exports.IconSecured = exports.IconSeatbelt = exports.IconSearchPage = exports.IconSearchLines = exports.IconSearchDocument = exports.IconSearch = exports.IconSdCard = exports.IconRuler = exports.IconRoute = exports.IconRotateRepeat2 = exports.IconRotateRepeat = exports.IconRotateCounterclockwise = exports.IconRotateClockwise = exports.IconResizeSmall = exports.IconResizeBig = exports.IconRepeat2 = exports.IconRepeat = exports.IconRemovePeople = exports.IconRefrigeration = exports.IconRedo2 = exports.IconRedo = exports.IconRecord = exports.IconReceipt = exports.IconRadar = void 0;
15
15
  exports.IconWatch = exports.IconWarning = exports.IconWallet1 = exports.IconWallet = exports.IconVolumeOn = exports.IconVolumeOff = exports.IconVolumeOf = exports.IconVolumeMinimum = exports.IconVolumeHalf = exports.IconVolumeFull = exports.IconVolumeDown = exports.IconVoice = exports.IconVisitPage = exports.IconVideoReplay = exports.IconVideo2 = exports.IconVideo = exports.IconUsbHub = exports.IconUsb = exports.IconUpload = exports.IconUnlocked = exports.IconUndock = exports.IconUndo2 = exports.IconUndo = exports.IconUnderline = exports.IconUmbrella = exports.IconTrailer = exports.IconThumbsUp = exports.IconThumbsDown = exports.IconThermometer = exports.IconThermograph = exports.IconTextSize = exports.IconTelevision2 = exports.IconTelevision = exports.IconTarget3 = exports.IconTarget2 = exports.IconTarget = exports.IconTachographTimeCard = exports.IconTachograph = exports.IconTable = exports.IconSupport = exports.IconSun = exports.IconStrikeThrough = exports.IconStore = exports.IconStorage = exports.IconStopwatch = exports.IconStarFilled = exports.IconStarAi = exports.IconStar = exports.IconSquare = exports.IconSpeaker = void 0;
16
- exports.PillExpandable = exports.Pill = exports.PaginationType = exports.Pagination = exports.PageLayout = exports.PageContentLayout = exports.Notification = exports.DialogContentNew = exports.Modal = exports.MobileSheet = exports.MiniTabs = exports.MiniTabsSize = exports.isLink = exports.isButton = exports.findPrevFocusable = exports.findNextFocusable = exports.findLastFocusable = exports.findFirstFocusable = exports.Menu = exports.ControlledMenu = exports.changeOrder = exports.ListItem = exports.List = exports.ItemData = exports.ItemCompact = exports.LineChartMini = exports.getDefaultDatasetStyle = exports.htmlLegendPlugin = exports.LEGEND_PLUGIN_ID = exports.LineChart = exports.useLayoutSize = exports.LayoutFullScreenProvider = exports.useLayoutFullScreen = exports.LayoutFullScreenElementProvider = exports.useLayoutFullScreenElement = exports.Layout = exports.ImageNothingFound = exports.IconZoom2 = exports.IconZoom = exports.IconZone = exports.IconYen = exports.IconWrite = exports.IconWrench = exports.IconWorld = exports.IconWorkday = exports.IconWifi2 = exports.IconWifi = exports.IconWhisper = exports.IconWebcam = exports.IconWatch2 = void 0;
17
- exports.calculateArrowPosition = exports.ToggleButton = exports.Toast = exports.useToast = exports.TimePicker = exports.TextareaRaw = exports.Textarea = exports.TextInputRaw = exports.TextInput = exports.TextIconButton = exports.ButtonIconPosition = exports.Tabs = exports.TabsDisplayName = exports.ActionLinkColumn = exports.CheckboxColumn = exports.MainColumn = exports.ActionsColumn = exports.getSortableValue = exports.ColumnSortDirection = exports.getEmptySelection = exports.Table = exports.TabBarContent = exports.TabBar = exports.SummaryTileBarDisplayName = exports.SummaryTileBar = exports.getTypeClassName = exports.SummaryTileTrigger = exports.SummaryTile = exports.SummaryTileDisplayName = exports.SummaryTileSize = exports.SummaryTileType = exports.Stepper = exports.SortControl = exports.SortDirections = exports.Skeleton = exports.LazyContent = exports.SidePanel = exports.CUSTOM_POPUP_COMPONENT_CLASSNAME = exports.SidePanelCloseReason = exports.isChildPopup = exports.SelectField = exports.Select = exports.SearchInput = exports.Range = exports.RadioGroup = exports.Radio = exports.ProgressBar = exports.ProgreesBarSize = exports.ProgressBarType = exports.Popup = void 0;
18
- exports.Waiting = exports.UserFormatProvider = exports.useDrive = exports.ThemeProvider = exports.ThemeDrive = exports.ThemeDark = exports.useLanguage = exports.LanguageProvider = exports.AbortablePromise = exports.Tooltip = exports.removeArrowClasses = void 0;
16
+ exports.Pill = exports.PaginationType = exports.Pagination = exports.PageLayout = exports.PageContentLayout = exports.Notification = exports.getPredefinedFocusableItem = exports.DialogContentNew = exports.Modal = exports.MobileSheet = exports.MiniTabs = exports.MiniTabsSize = exports.isLink = exports.isButton = exports.findPrevFocusable = exports.findNextFocusable = exports.findLastFocusable = exports.findFirstFocusable = exports.Menu = exports.ControlledMenu = exports.changeOrder = exports.ListItem = exports.List = exports.ItemData = exports.ItemCompact = exports.LineChartMini = exports.getDefaultDatasetStyle = exports.htmlLegendPlugin = exports.LEGEND_PLUGIN_ID = exports.LineChart = exports.useLayoutSize = exports.LayoutFullScreenProvider = exports.useLayoutFullScreen = exports.LayoutFullScreenElementProvider = exports.useLayoutFullScreenElement = exports.Layout = exports.ImageNothingFound = exports.IconZoom2 = exports.IconZoom = exports.IconZone = exports.IconYen = exports.IconWrite = exports.IconWrench = exports.IconWorld = exports.IconWorkday = exports.IconWifi2 = exports.IconWifi = exports.IconWhisper = exports.IconWebcam = exports.IconWatch2 = void 0;
17
+ exports.ToggleButton = exports.Toast = exports.useToast = exports.TimePicker = exports.TextareaRaw = exports.Textarea = exports.TextInputRaw = exports.TextInput = exports.TextIconButton = exports.ButtonIconPosition = exports.Tabs = exports.TabsDisplayName = exports.ActionLinkColumn = exports.CheckboxColumn = exports.MainColumn = exports.ActionsColumn = exports.getSortableValue = exports.ColumnSortDirection = exports.getEmptySelection = exports.Table = exports.TabBarContent = exports.TabBar = exports.SummaryTileBarDisplayName = exports.SummaryTileBar = exports.getTypeClassName = exports.SummaryTileTrigger = exports.SummaryTile = exports.SummaryTileDisplayName = exports.SummaryTileSize = exports.SummaryTileType = exports.Stepper = exports.SortControl = exports.SortDirections = exports.Skeleton = exports.LazyContent = exports.SidePanel = exports.CUSTOM_POPUP_COMPONENT_CLASSNAME = exports.SidePanelCloseReason = exports.isChildPopup = exports.SelectField = exports.Select = exports.SearchInput = exports.Range = exports.RadioGroup = exports.Radio = exports.ProgressBar = exports.ProgreesBarSize = exports.ProgressBarType = exports.Popup = exports.PillExpandable = void 0;
18
+ exports.Waiting = exports.UserFormatProvider = exports.useDrive = exports.ThemeProvider = exports.ThemeDrive = exports.ThemeDark = exports.useLanguage = exports.LanguageProvider = exports.AbortablePromise = exports.Tooltip = exports.removeArrowClasses = exports.calculateArrowPosition = void 0;
19
19
  /* eslint-disable max-len */
20
20
  var absolute_1 = require("./absolute/absolute");
21
21
  Object.defineProperty(exports, "Absolute", { enumerable: true, get: function () { return absolute_1.Absolute; } });
@@ -1328,6 +1328,8 @@ Object.defineProperty(exports, "MobileSheet", { enumerable: true, get: function
1328
1328
  var modal_1 = require("./modal/modal");
1329
1329
  Object.defineProperty(exports, "Modal", { enumerable: true, get: function () { return modal_1.Modal; } });
1330
1330
  Object.defineProperty(exports, "DialogContentNew", { enumerable: true, get: function () { return modal_1.DialogContentNew; } });
1331
+ var modalHelpers_1 = require("./modal/modalHelpers");
1332
+ Object.defineProperty(exports, "getPredefinedFocusableItem", { enumerable: true, get: function () { return modalHelpers_1.getPredefinedFocusableItem; } });
1331
1333
  var notification_1 = require("./notification/notification");
1332
1334
  Object.defineProperty(exports, "Notification", { enumerable: true, get: function () { return notification_1.Notification; } });
1333
1335
  var pageContentLayout_1 = require("./pageLayout/pageContentLayout/pageContentLayout");
@@ -53,7 +53,7 @@ const ListItem = ({ id, className, image, name, secondary, status, actions, onCl
53
53
  if (!onClick && !link) {
54
54
  return;
55
55
  }
56
- if (e.target instanceof HTMLElement && (0, isActiveElement_1.isActiveElement)(e.target) || isDndElement(e.target)) {
56
+ if ((0, isActiveElement_1.isActiveElement)(e.target) || isDndElement(e.target)) {
57
57
  return;
58
58
  }
59
59
  if (onClick) {
@@ -1 +1 @@
1
- export declare const isActiveElement: (element: HTMLElement, level?: number) => boolean;
1
+ export declare const isActiveElement: (element: EventTarget, level?: number) => boolean;
@@ -2,12 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isActiveElement = void 0;
4
4
  const activeElements = ["A", "BUTTON", "INPUT", "SELECT", "TEXTAREA", "LABEL"];
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+ const isNode = (element) => !!element.nodeName;
5
7
  const isActiveElement = (element, level = 0) => {
6
- if (activeElements.indexOf(element.nodeName) > -1) {
8
+ if (isNode(element) && element.nodeName && activeElements.indexOf(element.nodeName) > -1) {
7
9
  return true;
8
10
  }
9
- if (level < 4 && element.parentElement) {
10
- return (0, exports.isActiveElement)(element.parentElement, level + 1);
11
+ if (level < 4 && isNode(element) && element.parentNode) {
12
+ return (0, exports.isActiveElement)(element.parentNode, level + 1);
11
13
  }
12
14
  return false;
13
15
  };
@@ -15,6 +15,7 @@ interface IPrimaryButtons extends IButtons {
15
15
  interface ITertiaryButtons extends IButtons {
16
16
  type?: "tertiary" | "tertiary-destructive";
17
17
  }
18
+ export type TFocusElement = "tertiary" | "primary" | "secondary" | "close" | "content";
18
19
  export interface IModal {
19
20
  isOpen: boolean;
20
21
  children?: ReactNode;
@@ -24,6 +25,7 @@ export interface IModal {
24
25
  title: ReactNode;
25
26
  type?: "error" | "success" | "warning" | "info";
26
27
  className?: string;
28
+ focus?: TFocusElement;
27
29
  }
28
30
  export declare const Modal: FC<IModal> & {
29
31
  Content: FC<IDialogContent>;
@@ -40,6 +42,7 @@ export interface IDialogContent extends IZenComponentProps {
40
42
  onClose?: (e: any) => void;
41
43
  type?: "error" | "success" | "warning" | "info";
42
44
  labeledId?: string;
45
+ focus?: TFocusElement;
43
46
  }
44
47
  export declare const DialogContentNew: React.FC<IDialogContent>;
45
48
  export {};
@@ -42,8 +42,9 @@ const iconInfoCircle_1 = require("../icons/iconInfoCircle");
42
42
  const react_dom_1 = require("react-dom");
43
43
  const dialogHelpers_1 = require("../dialog/dialogHelpers");
44
44
  const themeContext_1 = require("../utils/theme/themeContext");
45
+ const modalHelpers_1 = require("./modalHelpers");
45
46
  // eslint-disable-next-line @typescript-eslint/naming-convention, react/prop-types
46
- const Modal = ({ isOpen, children, onClose, closeOnClickOutside, maxWidth, title, type, className }) => {
47
+ const Modal = ({ isOpen, children, onClose, closeOnClickOutside, maxWidth, title, type, className, focus }) => {
47
48
  const lastActiveOutsideElement = (0, react_1.useRef)(document.activeElement);
48
49
  const modalRoot = document.fullscreenElement || document.body;
49
50
  const [top, setTop] = (0, react_1.useState)(`${window.pageYOffset}px`);
@@ -89,7 +90,7 @@ const Modal = ({ isOpen, children, onClose, closeOnClickOutside, maxWidth, title
89
90
  });
90
91
  return someContent;
91
92
  }, [children]);
92
- const dialogHTML = (0, react_1.useCallback)((id) => (0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-modal", darkClass]), "aria-labelledby": labeledId, "aria-modal": "true", role: "dialog", style: { top: top }, children: [(0, jsx_runtime_1.jsx)(exports.Modal.Content, { onClose: onClose, maxWidth: maxWidth, title: title, className: className, type: type, labeledId: id, children: modalContent.length > 0 && modalContent.map((el) => el) }), (0, jsx_runtime_1.jsx)("div", { className: "zen-modal__shield", onClick: onOutSideClick })] }), [darkClass, labeledId, title, className, maxWidth, onClose, onOutSideClick, modalContent, type, top]);
93
+ const dialogHTML = (0, react_1.useCallback)((id) => (0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-modal", darkClass]), "aria-labelledby": labeledId, "aria-modal": "true", role: "dialog", style: { top: top }, children: [(0, jsx_runtime_1.jsx)(exports.Modal.Content, { onClose: onClose, maxWidth: maxWidth, title: title, className: className, type: type, labeledId: id, focus: focus, children: modalContent.length > 0 && modalContent.map((el) => el) }), (0, jsx_runtime_1.jsx)("div", { className: "zen-modal__shield", onClick: onOutSideClick })] }), [darkClass, labeledId, title, className, maxWidth, onClose, onOutSideClick, modalContent, type, top, focus]);
93
94
  if (!isOpen) {
94
95
  return null;
95
96
  }
@@ -97,7 +98,7 @@ const Modal = ({ isOpen, children, onClose, closeOnClickOutside, maxWidth, title
97
98
  };
98
99
  exports.Modal = Modal;
99
100
  const dummyOnClose = () => { };
100
- const DialogContentNew = ({ onClose, className, title, type, maxWidth = "600px", labeledId, children }) => {
101
+ const DialogContentNew = ({ onClose, className, title, type, maxWidth = "600px", labeledId, focus, children }) => {
101
102
  const { translate } = (0, useLanguage_1.useLanguage)();
102
103
  const isMobile = (0, useMobile_1.useMobile)();
103
104
  const contentRef = (0, react_1.useRef)(null);
@@ -115,9 +116,14 @@ const DialogContentNew = ({ onClose, className, title, type, maxWidth = "600px",
115
116
  if (contentRef.current === null) {
116
117
  return;
117
118
  }
119
+ const firstFocusableElement = (0, modalHelpers_1.getPredefinedFocusableItem)(contentRef.current, focus);
120
+ if (firstFocusableElement) {
121
+ firstFocusableElement.focus();
122
+ return;
123
+ }
118
124
  const focusable = contentRef.current.querySelectorAll(focusableSelector_1.FOCUSABLE_SELECTOR);
119
125
  focusable.length && focusable[focusable.length - 1].focus();
120
- }, [contentRef]);
126
+ }, [contentRef, focus]);
121
127
  const bodyContent = (0, react_1.useMemo)(() => {
122
128
  const modalContent = [];
123
129
  let tertiaryButton;
@@ -150,13 +156,13 @@ const DialogContentNew = ({ onClose, className, title, type, maxWidth = "600px",
150
156
  // TODO implement sizing for modal and get rid of style
151
157
  style: { maxWidth: maxWidth }, ref: contentRef, children: [(0, jsx_runtime_1.jsxs)("div", { className: "zen-modal-content__header", children: [(0, jsx_runtime_1.jsxs)("div", { className: "zen-modal-content__header-title heading-04 zen-ellipsis", id: labeledId, children: [type && (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-modal-content__icon", `${("zen-modal-content__icon--" + type)}`]), children: (0, react_1.createElement)(iconsByType[type], {
152
158
  size: iconDriveClassName ? "huge" : "large"
153
- }) }), title] }), onClose && (0, jsx_runtime_1.jsx)(button_1.Button, { type: "tertiary", className: "zen-modal-content__header-close-button", title: translate("Close"), "aria-label": translate("Close"), onClick: onClose, children: (0, jsx_runtime_1.jsx)(iconClose_1.IconClose, { description: translate("Close"), className: "svgIcon", size: iconDriveClassName ? "huge" : "large" }) })] }), bodyContent.modalContent.length > 0 && (0, jsx_runtime_1.jsx)("div", { className: modalContentClasses, children: bodyContent.modalContent.map((el, index) => (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: el }, index)) }), isFooterVisible &&
159
+ }) }), title] }), onClose && (0, jsx_runtime_1.jsx)(button_1.Button, { type: "tertiary", "data-focusable": "close", className: "zen-modal-content__header-close-button", title: translate("Close"), "aria-label": translate("Close"), onClick: onClose, children: (0, jsx_runtime_1.jsx)(iconClose_1.IconClose, { description: translate("Close"), className: "svgIcon", size: iconDriveClassName ? "huge" : "large" }) })] }), bodyContent.modalContent.length > 0 && (0, jsx_runtime_1.jsx)("div", { className: modalContentClasses, children: bodyContent.modalContent.map((el, index) => (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: el }, index)) }), isFooterVisible &&
154
160
  (0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-modal-content__footer", isMobile ? "zen-modal-content__footer--mobile" : ""]), children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-modal-content__footer-left", isMobile ? "zen-modal-content__footer-left--mobile" : ""]), children: bodyContent.tertiaryButton }), (bodyContent.secondaryButton || bodyContent.primaryButton) && (0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-modal-content__footer-right", isMobile ? "zen-modal-content__footer-right--mobile" : ""]), children: [bodyContent.secondaryButton, bodyContent.primaryButton] })] })] });
155
161
  };
156
162
  exports.DialogContentNew = DialogContentNew;
157
- const SecondaryButton = (secondaryButton) => (0, jsx_runtime_1.jsx)(button_1.Button, Object.assign({}, secondaryButton, { children: secondaryButton.children }));
158
- const PrimaryButton = (primaryButton) => (0, jsx_runtime_1.jsx)(button_1.Button, Object.assign({}, primaryButton, { type: primaryButton.type || "primary", children: primaryButton.children }));
159
- const TertiaryButton = (tertiaryButton) => (0, jsx_runtime_1.jsx)(button_1.Button, Object.assign({}, tertiaryButton, { className: "zen-modal-content__left-button", type: tertiaryButton.type || "tertiary", children: tertiaryButton.children }));
163
+ const SecondaryButton = (secondaryButton) => (0, jsx_runtime_1.jsx)(button_1.Button, Object.assign({}, secondaryButton, { "data-focusable": "secondary", children: secondaryButton.children }));
164
+ const PrimaryButton = (primaryButton) => (0, jsx_runtime_1.jsx)(button_1.Button, Object.assign({}, primaryButton, { "data-focusable": "primary", type: primaryButton.type || "primary", children: primaryButton.children }));
165
+ const TertiaryButton = (tertiaryButton) => (0, jsx_runtime_1.jsx)(button_1.Button, Object.assign({}, tertiaryButton, { "data-focusable": "tertiary", className: "zen-modal-content__left-button", type: tertiaryButton.type || "tertiary", children: tertiaryButton.children }));
160
166
  exports.Modal.Content = exports.DialogContentNew;
161
167
  exports.Modal.SecondaryButton = SecondaryButton;
162
168
  exports.Modal.PrimaryButton = PrimaryButton;
@@ -0,0 +1,2 @@
1
+ import { TFocusElement } from "./modal";
2
+ export declare const getPredefinedFocusableItem: (container: HTMLElement, focusable?: TFocusElement) => HTMLElement | null;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPredefinedFocusableItem = void 0;
4
+ const dialogHelpers_1 = require("../dialog/dialogHelpers");
5
+ const focusableSelector_1 = require("../utils/focusableSelector");
6
+ const getPredefinedFocusableItem = (container, focusable) => {
7
+ const focusableSelector = {
8
+ primary: "[data-focusable='primary']",
9
+ secondary: "[data-focusable='secondary']",
10
+ tertiary: "[data-focusable='tertiary']",
11
+ close: "[data-focusable='close']"
12
+ };
13
+ if (!focusable || focusable !== "content" && !focusableSelector[focusable]) {
14
+ return null;
15
+ }
16
+ if (focusable === "content") {
17
+ const contentElements = container.querySelectorAll(focusableSelector_1.FOCUSABLE_SELECTOR);
18
+ const contentElement = Array.from(contentElements).find((el) => {
19
+ const dataFocus = el.getAttribute("data-focusable");
20
+ return (dataFocus !== "primary" && dataFocus !== "secondary" && dataFocus !== "tertiary" && dataFocus !== "close") && (0, dialogHelpers_1.isFocusable)(el);
21
+ });
22
+ return contentElement ? contentElement : null;
23
+ }
24
+ const focusableElement = container.querySelector(focusableSelector[focusable]);
25
+ if (focusableElement && (0, dialogHelpers_1.isFocusable)(focusableElement)) {
26
+ return focusableElement;
27
+ }
28
+ return null;
29
+ };
30
+ exports.getPredefinedFocusableItem = getPredefinedFocusableItem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geotab/zenith",
3
- "version": "1.22.3",
3
+ "version": "1.22.4",
4
4
  "description": "Zenith components library on React",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",