@geotab/zenith 3.10.0 → 3.11.0-beta.0
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 +29 -0
- package/dist/calendar/calendar.js +7 -4
- package/dist/card/components/title.js +4 -1
- package/dist/card/components/titleLink.js +5 -2
- package/dist/chart/barChart/getDefaultOptions.d.ts +2 -1
- package/dist/chart/barChart/getDefaultOptions.js +5 -2
- package/dist/chart/barChart.js +6 -4
- package/dist/chart/lineChart/getDefaultOptions.d.ts +2 -1
- package/dist/chart/lineChart/getDefaultOptions.js +5 -2
- package/dist/chart/lineChart.js +4 -2
- package/dist/checkboxListWithAction/checkboxListWithAction.js +4 -1
- package/dist/commonHelpers/arrowNavigation/components/arrowButton/arrowButton.js +4 -1
- package/dist/commonStyles/pillStyles/pillContent.less +13 -14
- package/dist/commonStyles/pillStyles/pillStyles.less +4 -5
- package/dist/commonStyles/pillStyles/pillTextContent.less +2 -2
- package/dist/commonStyles/typography/typography.less +579 -19
- package/dist/controlledPopup/controlledPopup.d.ts +1 -0
- package/dist/controlledPopup/controlledPopup.js +3 -1
- package/dist/dataGrid/cell/cell.d.ts +2 -1
- package/dist/dataGrid/cell/cell.js +2 -2
- package/dist/dataGrid/dataGrid.js +7 -4
- package/dist/dataGrid/listColumn.d.ts +2 -0
- package/dist/dataGrid/row/row.d.ts +2 -1
- package/dist/dataGrid/row/row.js +13 -9
- package/dist/dataGrid/withFlexibleColumns/components/columnSettingsList.js +2 -1
- package/dist/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +4 -0
- package/dist/dateRangeInner/dateRangeInner.js +5 -2
- package/dist/dateRangeRaw/dateRangeRaw.js +5 -2
- package/dist/dateRangeRaw/utils/parseLabel.js +1 -1
- package/dist/dropdownRaw/dropdownRaw.js +12 -6
- package/dist/fileUpload/components/dropZoneContent.js +100 -100
- package/dist/fileUpload/fileUpload.js +100 -100
- package/dist/filters/components/filtersSearchList.js +4 -1
- package/dist/filtersBar/filtersContainer/filtersContainer.js +62 -61
- package/dist/formStepperButtons/formStepperButtons.js +4 -1
- package/dist/groupsFilterRaw/groupsFilterAdjustmentState.js +4 -1
- package/dist/groupsFilterRaw/groupsFilterInitialState.js +4 -1
- package/dist/header/headerBack.js +4 -1
- package/dist/icons/iconAlignLeft.js +1 -3
- package/dist/icons/iconAlignmentLeft.js +1 -3
- package/dist/icons/iconAlignmentRight.js +1 -3
- package/dist/icons/iconArrowBottomLeft.js +1 -3
- package/dist/icons/iconArrowBottomRight.js +1 -3
- package/dist/icons/iconArrowLeftPath.js +1 -3
- package/dist/icons/iconArrowRight.js +1 -3
- package/dist/icons/iconArrowRightCircle.js +1 -3
- package/dist/icons/iconArrowRightPath.js +1 -3
- package/dist/icons/iconArrowTopLeft.js +1 -3
- package/dist/icons/iconArrowTopRight.js +1 -3
- package/dist/icons/iconChevronDoubleRight.js +1 -3
- package/dist/icons/iconChevronRight.js +1 -3
- package/dist/icons/iconChevronRightSmall.js +1 -3
- package/dist/icons/iconCornerDownLeft.js +1 -3
- package/dist/icons/iconCornerDownRight.js +1 -3
- package/dist/icons/iconCornerLeftDown.js +1 -3
- package/dist/icons/iconCornerLeftUp.js +1 -3
- package/dist/icons/iconCornerRightDown.js +1 -3
- package/dist/icons/iconCornerRightUp.js +1 -3
- package/dist/icons/iconCornerUpLeft.js +1 -3
- package/dist/icons/iconCornerUpRight.js +1 -3
- package/dist/index.css +3254 -2922
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/lineChartMini/lineChartMini.js +15 -3
- package/dist/list/itemData/itemDataInternal.js +4 -1
- package/dist/list/listItem/listItem.js +4 -1
- package/dist/menu/components/controlledMenuList/controlledMenuList.d.ts +27 -0
- package/dist/menu/components/controlledMenuList/controlledMenuList.js +126 -0
- package/dist/menu/components/createControlledMenuList.d.ts +37 -0
- package/dist/menu/components/createControlledMenuList.js +55 -0
- package/dist/menu/components/createMenuItem.d.ts +67 -0
- package/dist/menu/components/createMenuItem.js +97 -0
- package/dist/menu/components/menuButton.js +12 -3
- package/dist/menu/components/menuItem.d.ts +1 -2
- package/dist/menu/components/menuItem.js +20 -74
- package/dist/menu/contexts/usePathContext.d.ts +2 -0
- package/dist/menu/contexts/usePathContext.js +9 -0
- package/dist/menu/controlledMenu.js +8 -175
- package/dist/menu/utils/buildMenuContent.d.ts +2 -0
- package/dist/menu/utils/buildMenuContent.js +38 -0
- package/dist/menu/utils/findContent.d.ts +2 -2
- package/dist/menu/utils/findContent.js +4 -3
- package/dist/menu/utils/getItemLabel.d.ts +2 -0
- package/dist/menu/utils/getItemLabel.js +8 -0
- package/dist/menu/utils/getSafeRel.d.ts +1 -0
- package/dist/menu/utils/getSafeRel.js +14 -0
- package/dist/menu/utils/isMenuItem.d.ts +2 -0
- package/dist/menu/utils/isMenuItem.js +13 -0
- package/dist/menu/utils/isSafeHref.d.ts +1 -0
- package/dist/menu/utils/isSafeHref.js +10 -0
- package/dist/menu/utils/normalizeSeparators.d.ts +2 -0
- package/dist/menu/utils/normalizeSeparators.js +23 -0
- package/dist/menu/utils/resolveKeys.d.ts +12 -0
- package/dist/menu/utils/resolveKeys.js +22 -0
- package/dist/menu/utils/useLastValidSheet.d.ts +7 -0
- package/dist/menu/utils/useLastValidSheet.js +30 -0
- package/dist/menu/utils/useMenuItemCore.d.ts +31 -0
- package/dist/menu/utils/useMenuItemCore.js +54 -0
- package/dist/menu/utils/useMenuItemKeyboardNav.d.ts +2 -0
- package/dist/menu/utils/useMenuItemKeyboardNav.js +15 -0
- package/dist/menu/utils/useMenuListKeyboardNav.d.ts +12 -0
- package/dist/menu/utils/useMenuListKeyboardNav.js +77 -0
- package/dist/menu/utils/useMenuPath.d.ts +6 -0
- package/dist/menu/utils/useMenuPath.js +35 -0
- package/dist/nav/navItem/navItem.js +10 -5
- package/dist/nav/navSection/navSection.js +7 -5
- package/dist/pagination/paginationArrow.js +10 -3
- package/dist/radioGroupRaw/radioGroupRaw.js +2 -1
- package/dist/rangeRaw/rangeRaw.js +0 -1
- package/dist/selectList/selectList.helpers.d.ts +1 -1
- package/dist/selectList/selectList.helpers.js +29 -4
- package/dist/selectList/selectList.js +3 -1
- package/dist/selectList/selectList.reducer.js +1 -2
- package/dist/selectList/selectListItem.js +4 -1
- package/dist/sortControl/sortControl.js +59 -4
- package/dist/table/children/useTableChildren.d.ts +1 -1
- package/dist/table/children/useTableChildren.js +3 -3
- package/dist/table/flexible/columnsList.js +4 -2
- package/dist/table/selectable/useSelectableRows.d.ts +8 -0
- package/dist/table/selectable/useSelectableRows.js +14 -6
- package/dist/table/table.js +1 -7
- package/dist/tabs/tabs.js +60 -58
- package/dist/tabs/tabsTestHelper.js +2 -2
- package/dist/timePickerRaw/timePickerRaw.js +1 -1
- package/dist/toggleButtonRaw/toggleButtonRaw.js +5 -2
- package/dist/utils/localization/translations/ar.json +3 -1
- package/dist/utils/localization/translations/cs.json +9 -5
- package/dist/utils/localization/translations/da-DK.json +9 -5
- package/dist/utils/localization/translations/de.json +9 -5
- package/dist/utils/localization/translations/en.json +5 -1
- package/dist/utils/localization/translations/es.json +9 -5
- package/dist/utils/localization/translations/fi-FI.json +9 -5
- package/dist/utils/localization/translations/fr-FR.json +9 -5
- package/dist/utils/localization/translations/fr.json +9 -5
- package/dist/utils/localization/translations/hu-HU.json +9 -5
- package/dist/utils/localization/translations/id.json +9 -5
- package/dist/utils/localization/translations/it.json +9 -5
- package/dist/utils/localization/translations/ja.json +9 -5
- package/dist/utils/localization/translations/ko-KR.json +9 -5
- package/dist/utils/localization/translations/ms.json +9 -5
- package/dist/utils/localization/translations/nb-NO.json +9 -5
- package/dist/utils/localization/translations/nl.json +9 -5
- package/dist/utils/localization/translations/pl.json +9 -5
- package/dist/utils/localization/translations/pt-BR.json +9 -5
- package/dist/utils/localization/translations/pt-PT.json +9 -5
- package/dist/utils/localization/translations/ro-RO.json +9 -5
- package/dist/utils/localization/translations/sk-SK.json +9 -5
- package/dist/utils/localization/translations/sv.json +9 -5
- package/dist/utils/localization/translations/th.json +9 -5
- package/dist/utils/localization/translations/tr.json +9 -5
- package/dist/utils/localization/translations/zh-Hans.json +9 -5
- package/dist/utils/localization/translations/zh-TW.json +9 -5
- package/dist/utils/localization/useDirectionalIcon.d.ts +3 -0
- package/dist/utils/localization/useDirectionalIcon.js +9 -0
- package/dist/utils/positioningUtils/alignments.d.ts +2 -2
- package/dist/utils/positioningUtils/alignments.js +2 -2
- package/dist/utils/positioningUtils/calculatePosition.js +4 -6
- package/esm/calendar/calendar.js +7 -4
- package/esm/card/components/title.js +4 -1
- package/esm/card/components/titleLink.js +5 -2
- package/esm/chart/barChart/getDefaultOptions.d.ts +2 -1
- package/esm/chart/barChart/getDefaultOptions.js +5 -2
- package/esm/chart/barChart.js +6 -4
- package/esm/chart/lineChart/getDefaultOptions.d.ts +2 -1
- package/esm/chart/lineChart/getDefaultOptions.js +5 -2
- package/esm/chart/lineChart.js +4 -2
- package/esm/checkboxListWithAction/checkboxListWithAction.js +4 -1
- package/esm/commonHelpers/arrowNavigation/components/arrowButton/arrowButton.js +4 -1
- package/esm/controlledPopup/controlledPopup.d.ts +1 -0
- package/esm/controlledPopup/controlledPopup.js +3 -1
- package/esm/dataGrid/cell/cell.d.ts +2 -1
- package/esm/dataGrid/cell/cell.js +2 -2
- package/esm/dataGrid/dataGrid.js +7 -4
- package/esm/dataGrid/listColumn.d.ts +2 -0
- package/esm/dataGrid/row/row.d.ts +2 -1
- package/esm/dataGrid/row/row.js +13 -9
- package/esm/dataGrid/withFlexibleColumns/components/columnSettingsList.js +2 -1
- package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +4 -0
- package/esm/dateRangeInner/dateRangeInner.js +5 -2
- package/esm/dateRangeRaw/dateRangeRaw.js +5 -2
- package/esm/dateRangeRaw/utils/parseLabel.js +1 -1
- package/esm/dropdownRaw/dropdownRaw.js +12 -6
- package/esm/fileUpload/components/dropZoneContent.js +100 -100
- package/esm/fileUpload/fileUpload.js +100 -100
- package/esm/filters/components/filtersSearchList.js +4 -1
- package/esm/filtersBar/filtersContainer/filtersContainer.js +62 -61
- package/esm/formStepperButtons/formStepperButtons.js +4 -1
- package/esm/groupsFilterRaw/groupsFilterAdjustmentState.js +4 -1
- package/esm/groupsFilterRaw/groupsFilterInitialState.js +4 -1
- package/esm/header/headerBack.js +4 -1
- package/esm/icons/iconAlignLeft.js +1 -3
- package/esm/icons/iconAlignmentLeft.js +1 -3
- package/esm/icons/iconAlignmentRight.js +1 -3
- package/esm/icons/iconArrowBottomLeft.js +1 -3
- package/esm/icons/iconArrowBottomRight.js +1 -3
- package/esm/icons/iconArrowLeftPath.js +1 -3
- package/esm/icons/iconArrowRight.js +1 -3
- package/esm/icons/iconArrowRightCircle.js +1 -3
- package/esm/icons/iconArrowRightPath.js +1 -3
- package/esm/icons/iconArrowTopLeft.js +1 -3
- package/esm/icons/iconArrowTopRight.js +1 -3
- package/esm/icons/iconChevronDoubleRight.js +1 -3
- package/esm/icons/iconChevronRight.js +1 -3
- package/esm/icons/iconChevronRightSmall.js +1 -3
- package/esm/icons/iconCornerDownLeft.js +1 -3
- package/esm/icons/iconCornerDownRight.js +1 -3
- package/esm/icons/iconCornerLeftDown.js +1 -3
- package/esm/icons/iconCornerLeftUp.js +1 -3
- package/esm/icons/iconCornerRightDown.js +1 -3
- package/esm/icons/iconCornerRightUp.js +1 -3
- package/esm/icons/iconCornerUpLeft.js +1 -3
- package/esm/icons/iconCornerUpRight.js +1 -3
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/lineChartMini/lineChartMini.js +15 -3
- package/esm/list/itemData/itemDataInternal.js +4 -1
- package/esm/list/listItem/listItem.js +4 -1
- package/esm/menu/components/controlledMenuList/controlledMenuList.d.ts +27 -0
- package/esm/menu/components/controlledMenuList/controlledMenuList.js +123 -0
- package/esm/menu/components/createControlledMenuList.d.ts +37 -0
- package/esm/menu/components/createControlledMenuList.js +51 -0
- package/esm/menu/components/createMenuItem.d.ts +67 -0
- package/esm/menu/components/createMenuItem.js +93 -0
- package/esm/menu/components/menuButton.js +12 -3
- package/esm/menu/components/menuItem.d.ts +1 -2
- package/esm/menu/components/menuItem.js +20 -74
- package/esm/menu/contexts/usePathContext.d.ts +2 -0
- package/esm/menu/contexts/usePathContext.js +5 -0
- package/esm/menu/controlledMenu.js +10 -177
- package/esm/menu/utils/buildMenuContent.d.ts +2 -0
- package/esm/menu/utils/buildMenuContent.js +34 -0
- package/esm/menu/utils/findContent.d.ts +2 -2
- package/esm/menu/utils/findContent.js +4 -3
- package/esm/menu/utils/getItemLabel.d.ts +2 -0
- package/esm/menu/utils/getItemLabel.js +4 -0
- package/esm/menu/utils/getSafeRel.d.ts +1 -0
- package/esm/menu/utils/getSafeRel.js +10 -0
- package/esm/menu/utils/isMenuItem.d.ts +2 -0
- package/esm/menu/utils/isMenuItem.js +9 -0
- package/esm/menu/utils/isSafeHref.d.ts +1 -0
- package/esm/menu/utils/isSafeHref.js +6 -0
- package/esm/menu/utils/normalizeSeparators.d.ts +2 -0
- package/esm/menu/utils/normalizeSeparators.js +19 -0
- package/esm/menu/utils/resolveKeys.d.ts +12 -0
- package/esm/menu/utils/resolveKeys.js +18 -0
- package/esm/menu/utils/useLastValidSheet.d.ts +7 -0
- package/esm/menu/utils/useLastValidSheet.js +26 -0
- package/esm/menu/utils/useMenuItemCore.d.ts +31 -0
- package/esm/menu/utils/useMenuItemCore.js +50 -0
- package/esm/menu/utils/useMenuItemKeyboardNav.d.ts +2 -0
- package/esm/menu/utils/useMenuItemKeyboardNav.js +11 -0
- package/esm/menu/utils/useMenuListKeyboardNav.d.ts +12 -0
- package/esm/menu/utils/useMenuListKeyboardNav.js +73 -0
- package/esm/menu/utils/useMenuPath.d.ts +6 -0
- package/esm/menu/utils/useMenuPath.js +31 -0
- package/esm/nav/navItem/navItem.js +10 -5
- package/esm/nav/navSection/navSection.js +7 -5
- package/esm/pagination/paginationArrow.js +10 -3
- package/esm/radioGroupRaw/radioGroupRaw.js +2 -1
- package/esm/rangeRaw/rangeRaw.js +0 -1
- package/esm/selectList/selectList.helpers.d.ts +1 -1
- package/esm/selectList/selectList.helpers.js +29 -4
- package/esm/selectList/selectList.js +3 -1
- package/esm/selectList/selectList.reducer.js +1 -2
- package/esm/selectList/selectListItem.js +4 -1
- package/esm/sortControl/sortControl.js +59 -4
- package/esm/table/children/useTableChildren.d.ts +1 -1
- package/esm/table/children/useTableChildren.js +3 -3
- package/esm/table/flexible/columnsList.js +4 -2
- package/esm/table/selectable/useSelectableRows.d.ts +8 -0
- package/esm/table/selectable/useSelectableRows.js +14 -6
- package/esm/table/table.js +1 -7
- package/esm/tabs/tabs.js +60 -58
- package/esm/tabs/tabsTestHelper.js +2 -2
- package/esm/testHelpers/mockAbsoluteAlignment.d.ts +1 -0
- package/esm/testHelpers/mockAbsoluteAlignment.js +10 -0
- package/esm/timePickerRaw/timePickerRaw.js +1 -1
- package/esm/toggleButtonRaw/toggleButtonRaw.js +5 -2
- package/esm/utils/localization/translations/ar.json +3 -1
- package/esm/utils/localization/translations/cs.json +9 -5
- package/esm/utils/localization/translations/da-DK.json +9 -5
- package/esm/utils/localization/translations/de.json +9 -5
- package/esm/utils/localization/translations/en.json +5 -1
- package/esm/utils/localization/translations/es.json +9 -5
- package/esm/utils/localization/translations/fi-FI.json +9 -5
- package/esm/utils/localization/translations/fr-FR.json +9 -5
- package/esm/utils/localization/translations/fr.json +9 -5
- package/esm/utils/localization/translations/hu-HU.json +9 -5
- package/esm/utils/localization/translations/id.json +9 -5
- package/esm/utils/localization/translations/it.json +9 -5
- package/esm/utils/localization/translations/ja.json +9 -5
- package/esm/utils/localization/translations/ko-KR.json +9 -5
- package/esm/utils/localization/translations/ms.json +9 -5
- package/esm/utils/localization/translations/nb-NO.json +9 -5
- package/esm/utils/localization/translations/nl.json +9 -5
- package/esm/utils/localization/translations/pl.json +9 -5
- package/esm/utils/localization/translations/pt-BR.json +9 -5
- package/esm/utils/localization/translations/pt-PT.json +9 -5
- package/esm/utils/localization/translations/ro-RO.json +9 -5
- package/esm/utils/localization/translations/sk-SK.json +9 -5
- package/esm/utils/localization/translations/sv.json +9 -5
- package/esm/utils/localization/translations/th.json +9 -5
- package/esm/utils/localization/translations/tr.json +9 -5
- package/esm/utils/localization/translations/zh-Hans.json +9 -5
- package/esm/utils/localization/translations/zh-TW.json +9 -5
- package/esm/utils/localization/useDirectionalIcon.d.ts +3 -0
- package/esm/utils/localization/useDirectionalIcon.js +5 -0
- package/esm/utils/positioningUtils/alignments.d.ts +2 -2
- package/esm/utils/positioningUtils/alignments.js +2 -2
- package/esm/utils/positioningUtils/calculatePosition.js +4 -6
- package/package.json +123 -122
package/dist/index.d.ts
CHANGED
|
@@ -775,6 +775,7 @@ export { getNewFocusableItem, getFirstFocusableItem } from "./utils/keyboardHelp
|
|
|
775
775
|
export { LanguageProvider } from "./utils/localization/languageProvider";
|
|
776
776
|
export { dictionaries, injectString } from "./utils/localization/translationsDictionary";
|
|
777
777
|
export { useDirection } from "./utils/localization/useDirection";
|
|
778
|
+
export { useDirectionalIcon } from "./utils/localization/useDirectionalIcon";
|
|
778
779
|
export { useLanguage } from "./utils/localization/useLanguage";
|
|
779
780
|
export { ThemeDark } from "./utils/theme/themeDark";
|
|
780
781
|
export { ThemeDrive } from "./utils/theme/themeDrive";
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ exports.IconShield3 = exports.IconShield2 = exports.IconShield = exports.IconSha
|
|
|
17
17
|
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 = exports.IconSortVertical = exports.IconSortHorizontal = exports.IconSort2Vertical = exports.IconSort2Horizontal = exports.IconSmiley = exports.IconSign = exports.IconSidebar = exports.IconShield4 = void 0;
|
|
18
18
|
exports.isButton = exports.findPrevFocusable = exports.findNextFocusable = exports.findLastFocusable = exports.findFirstFocusable = exports.Menu = exports.ControlledMenu = exports.isDragNotClick = 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.ImageTapToUpload = exports.ImageNothingFound = exports.ImageNoMatchingAssets = exports.ImageLooking = exports.ImageCloudUpload = exports.ImageAdjustFilter = 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 = exports.IconWatch = exports.IconWarning = exports.IconWallet1 = exports.IconWallet = exports.IconVolumeOn = exports.IconVolumeOff = exports.IconVolumeMinimum = void 0;
|
|
19
19
|
exports.SummaryTileBarDisplayName = exports.SummaryTileBar = exports.getTypeClassName = exports.SummaryTileTrigger = exports.SummaryTile = exports.SummaryTileDisplayName = exports.SummaryTileSize = exports.SummaryTileType = exports.Summary = exports.Summaries = 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.PrimaryIcon = exports.Popup = exports.PillExpandable = exports.Pill = exports.PaginationType = exports.Pagination = exports.PageLayout = exports.PageContentLayout = exports.PageHeaderMenu = exports.PageHeaderMenuDisplayName = exports.PageHeaderButton = exports.PageHeaderButtonDisplayName = exports.PageHeader = exports.PageHeaderDisplayName = exports.Notification = exports.getPredefinedFocusableItem = exports.DialogContentNew = exports.Modal = exports.MobileSheet = exports.MiniTabs = exports.MiniTabsSize = exports.isLink = void 0;
|
|
20
|
-
exports.Waiting = exports.UserFormatProvider = exports.useDrive = exports.ThemeProvider = exports.ThemeDrive = exports.ThemeDark = exports.useLanguage = exports.useDirection = exports.injectString = exports.dictionaries = exports.LanguageProvider = exports.getFirstFocusableItem = exports.getNewFocusableItem = exports.HeaderButtonsProvider = exports.AbortablePromise = exports.Tooltip = exports.removeArrowClasses = exports.calculateArrowPosition = exports.ToggleButtonRaw = 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.useNestedRows = exports.NestedData = exports.TabBarContent = exports.TabBar = void 0;
|
|
20
|
+
exports.Waiting = exports.UserFormatProvider = exports.useDrive = exports.ThemeProvider = exports.ThemeDrive = exports.ThemeDark = exports.useLanguage = exports.useDirectionalIcon = exports.useDirection = exports.injectString = exports.dictionaries = exports.LanguageProvider = exports.getFirstFocusableItem = exports.getNewFocusableItem = exports.HeaderButtonsProvider = exports.AbortablePromise = exports.Tooltip = exports.removeArrowClasses = exports.calculateArrowPosition = exports.ToggleButtonRaw = 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.useNestedRows = exports.NestedData = exports.TabBarContent = exports.TabBar = void 0;
|
|
21
21
|
/* eslint-disable max-len */
|
|
22
22
|
var absolute_1 = require("./absolute/absolute");
|
|
23
23
|
Object.defineProperty(exports, "Absolute", { enumerable: true, get: function () { return absolute_1.Absolute; } });
|
|
@@ -1665,6 +1665,8 @@ Object.defineProperty(exports, "dictionaries", { enumerable: true, get: function
|
|
|
1665
1665
|
Object.defineProperty(exports, "injectString", { enumerable: true, get: function () { return translationsDictionary_1.injectString; } });
|
|
1666
1666
|
var useDirection_1 = require("./utils/localization/useDirection");
|
|
1667
1667
|
Object.defineProperty(exports, "useDirection", { enumerable: true, get: function () { return useDirection_1.useDirection; } });
|
|
1668
|
+
var useDirectionalIcon_1 = require("./utils/localization/useDirectionalIcon");
|
|
1669
|
+
Object.defineProperty(exports, "useDirectionalIcon", { enumerable: true, get: function () { return useDirectionalIcon_1.useDirectionalIcon; } });
|
|
1668
1670
|
var useLanguage_1 = require("./utils/localization/useLanguage");
|
|
1669
1671
|
Object.defineProperty(exports, "useLanguage", { enumerable: true, get: function () { return useLanguage_1.useLanguage; } });
|
|
1670
1672
|
var themeDark_1 = require("./utils/theme/themeDark");
|
|
@@ -21,6 +21,7 @@ const utils_2 = require("../lineChart/utils");
|
|
|
21
21
|
const useDrive_1 = require("../utils/theme/useDrive");
|
|
22
22
|
const useMobile_1 = require("../commonHelpers/hooks/useMobile");
|
|
23
23
|
const themeContext_1 = require("../utils/theme/themeContext");
|
|
24
|
+
const useIsRTL_1 = require("../utils/localization/useIsRTL");
|
|
24
25
|
const accessibleChart_1 = require("../chart/accessibleChart/accessibleChart");
|
|
25
26
|
auto_1.Chart.defaults.font = {
|
|
26
27
|
family: "Roboto",
|
|
@@ -33,17 +34,26 @@ const defaultGridStyle = {
|
|
|
33
34
|
const defaultGridBorderStyle = {
|
|
34
35
|
display: false
|
|
35
36
|
};
|
|
36
|
-
const
|
|
37
|
+
const getDefaultOptions = (isRtl) => ({
|
|
37
38
|
responsive: true,
|
|
38
39
|
maintainAspectRatio: false,
|
|
40
|
+
layout: {
|
|
41
|
+
padding: {
|
|
42
|
+
left: isRtl ? 16 : 0,
|
|
43
|
+
right: isRtl ? 0 : 16
|
|
44
|
+
}
|
|
45
|
+
},
|
|
39
46
|
scales: {
|
|
40
47
|
x: {
|
|
41
48
|
grid: defaultGridStyle,
|
|
42
|
-
border: defaultGridBorderStyle
|
|
49
|
+
border: defaultGridBorderStyle,
|
|
50
|
+
reverse: isRtl,
|
|
51
|
+
offset: false
|
|
43
52
|
},
|
|
44
53
|
y: {
|
|
45
54
|
grid: defaultGridStyle,
|
|
46
55
|
border: defaultGridBorderStyle,
|
|
56
|
+
position: isRtl ? "right" : "left",
|
|
47
57
|
ticks: {
|
|
48
58
|
display: false
|
|
49
59
|
}
|
|
@@ -57,7 +67,7 @@ const defaultOptions = {
|
|
|
57
67
|
enabled: false
|
|
58
68
|
}
|
|
59
69
|
}
|
|
60
|
-
};
|
|
70
|
+
});
|
|
61
71
|
const LineChartMini = (_a) => {
|
|
62
72
|
var _b, _c;
|
|
63
73
|
var { data, options = {} } = _a, rest = __rest(_a, ["data", "options"]);
|
|
@@ -65,6 +75,7 @@ const LineChartMini = (_a) => {
|
|
|
65
75
|
const isMobile = (0, useMobile_1.useMobile)();
|
|
66
76
|
const memoizedFontSize = (0, react_1.useMemo)(() => (isDrive ? (isMobile ? 14 : 16) : 12), [isDrive, isMobile]);
|
|
67
77
|
const { dark } = (0, react_1.useContext)(themeContext_1.themeContext);
|
|
78
|
+
const isRtl = (0, useIsRTL_1.useIsRTL)();
|
|
68
79
|
(0, react_1.useEffect)(() => {
|
|
69
80
|
auto_1.Chart.defaults.font = {
|
|
70
81
|
family: "Roboto",
|
|
@@ -73,6 +84,7 @@ const LineChartMini = (_a) => {
|
|
|
73
84
|
auto_1.Chart.defaults.color = dark ? "#FFFFFF" : "#1F2833";
|
|
74
85
|
}, [memoizedFontSize, dark]);
|
|
75
86
|
const adaptedData = Object.assign({}, data);
|
|
87
|
+
const defaultOptions = (0, react_1.useMemo)(() => getDefaultOptions(isRtl), [isRtl]);
|
|
76
88
|
const adaptedOptions = (0, utils_1.deepMerge)(defaultOptions, options);
|
|
77
89
|
if (((_b = adaptedData.labels) === null || _b === void 0 ? void 0 : _b.length) === 2) {
|
|
78
90
|
const maxLabelsCount = Math.max(...data.datasets.map(ds => ds.data.length));
|
|
@@ -14,6 +14,8 @@ const useLanguage_1 = require("../../utils/localization/useLanguage");
|
|
|
14
14
|
const button_1 = require("../../button/button");
|
|
15
15
|
const classNames_1 = require("../../commonHelpers/classNames/classNames");
|
|
16
16
|
const iconChevronRight_1 = require("../../icons/iconChevronRight");
|
|
17
|
+
const iconChevronLeft_1 = require("../../icons/iconChevronLeft");
|
|
18
|
+
const useDirectionalIcon_1 = require("../../utils/localization/useDirectionalIcon");
|
|
17
19
|
const iconDotVertical_1 = require("../../icons/iconDotVertical");
|
|
18
20
|
const menu_1 = require("../../menu/menu");
|
|
19
21
|
const isActiveElement_1 = require("../utils/isActiveElement");
|
|
@@ -95,6 +97,7 @@ const ItemDataInternalInner = ({
|
|
|
95
97
|
const {
|
|
96
98
|
translate
|
|
97
99
|
} = (0, useLanguage_1.useLanguage)();
|
|
100
|
+
const ChevronIcon = (0, useDirectionalIcon_1.useDirectionalIcon)(iconChevronRight_1.IconChevronRight, iconChevronLeft_1.IconChevronLeft);
|
|
98
101
|
const driveClassName = (0, react_1.useMemo)(() => isDrive ? isMobile ? "zen-item-data-drive" : "zen-item-data-drive-tablet" : "", [isDrive, isMobile]);
|
|
99
102
|
const mobileClassName = (0, useMobileClassName_1.useMobileClassName)("zen-item-data");
|
|
100
103
|
const aceClassName = (0, react_1.useMemo)(() => isTall ? "zen-item-data--tall" : "", [isTall]);
|
|
@@ -202,7 +205,7 @@ const ItemDataInternalInner = ({
|
|
|
202
205
|
onClick: onClick,
|
|
203
206
|
title: translate("Open"),
|
|
204
207
|
"aria-label": translate("Open"),
|
|
205
|
-
children: (0, jsx_runtime_1.jsx)(
|
|
208
|
+
children: (0, jsx_runtime_1.jsx)(ChevronIcon, {
|
|
206
209
|
size: "large",
|
|
207
210
|
className: "zen-item-data__click-icon"
|
|
208
211
|
})
|
|
@@ -74,6 +74,8 @@ const useDriveClassName_1 = require("../../utils/theme/useDriveClassName");
|
|
|
74
74
|
const classNames_1 = require("../../commonHelpers/classNames/classNames");
|
|
75
75
|
const useIconSize_1 = require("../../utils/theme/useIconSize");
|
|
76
76
|
const iconChevronRight_1 = require("../../icons/iconChevronRight");
|
|
77
|
+
const iconChevronLeft_1 = require("../../icons/iconChevronLeft");
|
|
78
|
+
const useDirectionalIcon_1 = require("../../utils/localization/useDirectionalIcon");
|
|
77
79
|
const isActiveElement_1 = require("../utils/isActiveElement");
|
|
78
80
|
const useMobileClassName_1 = require("../../utils/theme/useMobileClassName");
|
|
79
81
|
const ListItem = ({
|
|
@@ -97,6 +99,7 @@ const ListItem = ({
|
|
|
97
99
|
translate
|
|
98
100
|
} = (0, useLanguage_1.useLanguage)();
|
|
99
101
|
const itemRef = (0, react_1.useRef)(null);
|
|
102
|
+
const ChevronIcon = (0, useDirectionalIcon_1.useDirectionalIcon)(iconChevronRight_1.IconChevronRight, iconChevronLeft_1.IconChevronLeft);
|
|
100
103
|
const renderActions = (0, react_1.useCallback)(() => {
|
|
101
104
|
if (!actions || actions.length === 0) {
|
|
102
105
|
return null;
|
|
@@ -209,7 +212,7 @@ const ListItem = ({
|
|
|
209
212
|
link: link,
|
|
210
213
|
target: target,
|
|
211
214
|
title: translate("View details"),
|
|
212
|
-
children: (0, jsx_runtime_1.jsx)(
|
|
215
|
+
children: (0, jsx_runtime_1.jsx)(ChevronIcon, {
|
|
213
216
|
size: isMobile ? "huge" : "large",
|
|
214
217
|
className: "zen-list-item__click-icon"
|
|
215
218
|
})
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FC, ForwardRefExoticComponent, RefAttributes, ReactNode } from "react";
|
|
2
|
+
import { IMenuControlledItem } from "../menuItem";
|
|
3
|
+
import { IZenComponentProps } from "../../../commonHelpers/zenComponent";
|
|
4
|
+
import { IMenuSeparator } from "../menuSeparator";
|
|
5
|
+
import { TAlignment } from "../../../absolute/absolute";
|
|
6
|
+
export type TMenuListDirection = "vertical" | "horizontal";
|
|
7
|
+
export interface IControlledMenuList extends IZenComponentProps {
|
|
8
|
+
listClassName?: string;
|
|
9
|
+
ariaLabel?: string;
|
|
10
|
+
/** Default tooltip alignment injected into MenuItem children that don't specify their own. */
|
|
11
|
+
defaultTooltipAlignment?: TAlignment;
|
|
12
|
+
/** Default submenu alignment injected into MenuItem children that don't specify their own. */
|
|
13
|
+
defaultAlignment?: TAlignment;
|
|
14
|
+
/** Layout direction of the menu list. Defaults to "vertical". */
|
|
15
|
+
direction?: TMenuListDirection;
|
|
16
|
+
}
|
|
17
|
+
/** Internal props injected by ControlledMenu — not part of the public API. */
|
|
18
|
+
export interface IControlledMenuListInternal extends IControlledMenuList {
|
|
19
|
+
isOpen?: boolean;
|
|
20
|
+
setIsOpen?: (v: boolean) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const ControlledMenuList: ForwardRefExoticComponent<IControlledMenuList & {
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
} & RefAttributes<HTMLDivElement>> & {
|
|
25
|
+
Item: FC<IMenuControlledItem>;
|
|
26
|
+
Separator: FC<IMenuSeparator>;
|
|
27
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ControlledMenuList = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const menuItem_1 = require("../menuItem");
|
|
8
|
+
const classNames_1 = require("../../../commonHelpers/classNames/classNames");
|
|
9
|
+
const findContent_1 = require("../../utils/findContent");
|
|
10
|
+
const getItemLabel_1 = require("../../utils/getItemLabel");
|
|
11
|
+
const normalizeSeparators_1 = require("../../utils/normalizeSeparators");
|
|
12
|
+
const useMenuPath_1 = require("../../utils/useMenuPath");
|
|
13
|
+
const useLastValidSheet_1 = require("../../utils/useLastValidSheet");
|
|
14
|
+
const useMenuListKeyboardNav_1 = require("../../utils/useMenuListKeyboardNav");
|
|
15
|
+
const menuButton_1 = require("../menuButton");
|
|
16
|
+
const iconArrowLeft_1 = require("../../../icons/iconArrowLeft");
|
|
17
|
+
const deviceType_1 = require("../../../commonHelpers/hooks/deviceType");
|
|
18
|
+
const useDeviceType_1 = require("../../../commonHelpers/hooks/useDeviceType");
|
|
19
|
+
const generateId_1 = require("../../../commonHelpers/generateId");
|
|
20
|
+
const pathProvider_1 = require("../../contexts/pathProvider");
|
|
21
|
+
const mobileSheet_1 = require("../../../mobileSheet/mobileSheet");
|
|
22
|
+
const menuSeparator_1 = require("../menuSeparator");
|
|
23
|
+
const iconArrowRight_1 = require("../../../icons/iconArrowRight");
|
|
24
|
+
const useDirectionalIcon_1 = require("../../../utils/localization/useDirectionalIcon");
|
|
25
|
+
const ControlledMenuListBase = (0, react_1.forwardRef)(({ children, setIsOpen, isOpen, className = "", listClassName = "", ariaLabel, defaultTooltipAlignment, defaultAlignment, direction = "vertical" }, ref) => {
|
|
26
|
+
const [deviceType, setDeviceType] = (0, react_1.useState)(deviceType_1.DeviceType.Desktop);
|
|
27
|
+
const isMobile = deviceType === deviceType_1.DeviceType.Mobile;
|
|
28
|
+
const BackArrowIcon = (0, useDirectionalIcon_1.useDirectionalIcon)(iconArrowLeft_1.IconArrowLeft, iconArrowRight_1.IconArrowRight);
|
|
29
|
+
(0, useDeviceType_1.useDeviceType)(setDeviceType);
|
|
30
|
+
// True when mounted inside ControlledMenu, which injects setIsOpen and isOpen.
|
|
31
|
+
// Standalone usage leaves both undefined.
|
|
32
|
+
const isEmbedded = setIsOpen !== undefined;
|
|
33
|
+
const { path, onOpenBranch, closeBranch, closeAll } = (0, useMenuPath_1.useMenuPath)(isOpen);
|
|
34
|
+
const navigatedViaKeyboardRef = (0, react_1.useRef)(false);
|
|
35
|
+
const keyboardActiveRef = (0, react_1.useRef)(false);
|
|
36
|
+
const internalRef = (0, react_1.useRef)(null);
|
|
37
|
+
const divRefCallback = (0, react_1.useCallback)((node) => {
|
|
38
|
+
internalRef.current = node;
|
|
39
|
+
if (typeof ref === "function") {
|
|
40
|
+
ref(node);
|
|
41
|
+
}
|
|
42
|
+
else if (ref) {
|
|
43
|
+
ref.current = node;
|
|
44
|
+
}
|
|
45
|
+
}, [ref]);
|
|
46
|
+
const effectiveSetIsOpen = (0, react_1.useCallback)((v) => {
|
|
47
|
+
setIsOpen === null || setIsOpen === void 0 ? void 0 : setIsOpen(v);
|
|
48
|
+
if (!v && !isEmbedded) {
|
|
49
|
+
closeAll();
|
|
50
|
+
}
|
|
51
|
+
}, [setIsOpen, closeAll, isEmbedded]);
|
|
52
|
+
const buildListItems = (0, react_1.useCallback)((childrenToProcess) => {
|
|
53
|
+
var _a;
|
|
54
|
+
const cont = [];
|
|
55
|
+
// If children is a Fragment, extract its children
|
|
56
|
+
let actualChildren = childrenToProcess;
|
|
57
|
+
if ((0, react_1.isValidElement)(childrenToProcess) && childrenToProcess.type === react_1.Fragment) {
|
|
58
|
+
actualChildren = (_a = childrenToProcess.props.children) !== null && _a !== void 0 ? _a : [];
|
|
59
|
+
}
|
|
60
|
+
react_1.Children.map(actualChildren, (child) => {
|
|
61
|
+
var _a, _b;
|
|
62
|
+
if (!child)
|
|
63
|
+
return;
|
|
64
|
+
if (typeof child === "string") {
|
|
65
|
+
cont.push((0, jsx_runtime_1.jsx)("li", { role: "presentation", className: (0, classNames_1.classNames)(["zen-menu-item__content"]), children: child }, (0, generateId_1.generateId)()));
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if ((0, react_1.isValidElement)(child) && (0, menuSeparator_1.isSeparator)(child)) {
|
|
69
|
+
cont.push((0, react_1.cloneElement)(child, { key: (_a = child.key) !== null && _a !== void 0 ? _a : (0, generateId_1.generateId)() }));
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if ((0, react_1.isValidElement)(child) && (0, menuItem_1.isMenuItem)(child)) {
|
|
73
|
+
const childProps = child.props;
|
|
74
|
+
cont.push((0, react_1.cloneElement)(child, {
|
|
75
|
+
isMobile,
|
|
76
|
+
key: (_b = childProps.id) !== null && _b !== void 0 ? _b : (0, generateId_1.generateId)(),
|
|
77
|
+
setIsOpen: effectiveSetIsOpen,
|
|
78
|
+
onClick: childProps.onClick,
|
|
79
|
+
tooltipAlignment: childProps.tooltipAlignment || defaultTooltipAlignment || undefined,
|
|
80
|
+
alignment: childProps.alignment || defaultAlignment || undefined
|
|
81
|
+
}));
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const childProps = child.props;
|
|
85
|
+
cont.push((0, jsx_runtime_1.jsx)("li", { className: (0, classNames_1.classNames)(["zen-menu-item__content"]), role: "presentation", children: child }, childProps.id || childProps["data-id"] || (0, generateId_1.generateId)()));
|
|
86
|
+
});
|
|
87
|
+
return (0, normalizeSeparators_1.normalizeSeparators)(cont);
|
|
88
|
+
}, [isMobile, effectiveSetIsOpen, defaultTooltipAlignment, defaultAlignment]);
|
|
89
|
+
// Embedded (ControlledMenu): switch content based on path so the outer MobileSheet
|
|
90
|
+
// shows nested items with the back button as a list row.
|
|
91
|
+
// Standalone: always show top-level content; nested navigation uses its own MobileSheet.
|
|
92
|
+
const [content, parent] = (0, react_1.useMemo)(() => {
|
|
93
|
+
if (isEmbedded && isMobile && path.length > 0) {
|
|
94
|
+
const el = (0, findContent_1.findContent)(children, menuItem_1.isMenuItem, path[path.length - 1]);
|
|
95
|
+
if (el && (0, react_1.isValidElement)(el)) {
|
|
96
|
+
return [buildListItems(el.props.children), el];
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return [buildListItems(children), null];
|
|
100
|
+
}, [children, isMobile, path, isEmbedded, buildListItems]);
|
|
101
|
+
// Standalone mobile only: compute nested content for the inline MobileSheet.
|
|
102
|
+
const [nestedContent, nestedParent] = (0, react_1.useMemo)(() => {
|
|
103
|
+
if (isEmbedded || !isMobile || path.length === 0) {
|
|
104
|
+
return [null, null];
|
|
105
|
+
}
|
|
106
|
+
const el = (0, findContent_1.findContent)(children, menuItem_1.isMenuItem, path[path.length - 1]);
|
|
107
|
+
if (!el || !(0, react_1.isValidElement)(el)) {
|
|
108
|
+
return [null, null];
|
|
109
|
+
}
|
|
110
|
+
return [buildListItems(el.props.children), el];
|
|
111
|
+
}, [children, isMobile, path, isEmbedded, buildListItems]);
|
|
112
|
+
const isHorizontal = direction === "horizontal";
|
|
113
|
+
const { onKeyDown, onKeyDownVertical, onMouseDown } = (0, useMenuListKeyboardNav_1.useMenuListKeyboardNav)(keyboardActiveRef, navigatedViaKeyboardRef, isHorizontal);
|
|
114
|
+
const renderList = (listContent, backParent, listRef, applyDirection = true, keyDownHandler = onKeyDown) => ((0, jsx_runtime_1.jsx)("div", { ref: listRef, tabIndex: -1, onKeyDown: keyDownHandler, onMouseDown: onMouseDown, className: (0, classNames_1.classNames)(["zen-action-list", className]), children: (0, jsx_runtime_1.jsxs)("ul", { role: "menu", "aria-label": ariaLabel, className: (0, classNames_1.classNames)([
|
|
115
|
+
"zen-menu-item",
|
|
116
|
+
className,
|
|
117
|
+
listClassName,
|
|
118
|
+
applyDirection && direction === "horizontal" ? "zen-menu-item--horizontal" : ""
|
|
119
|
+
]), children: [backParent ? ((0, jsx_runtime_1.jsx)(menuButton_1.MenuButton, { id: "root", name: (0, getItemLabel_1.getItemLabel)(backParent), icon: BackArrowIcon, onClick: closeBranch, hasChildren: false, disabled: false }, "root")) : null, listContent] }) }));
|
|
120
|
+
const { sheetContent, sheetParent, sheetPathLength, sheetParentName } = (0, useLastValidSheet_1.useLastValidSheet)(nestedContent, nestedParent, path, children);
|
|
121
|
+
return ((0, jsx_runtime_1.jsxs)(pathProvider_1.PathProvider, { path: path, onOpenBranch: onOpenBranch, closeBranch: closeBranch, navigatedViaKeyboardRef: navigatedViaKeyboardRef, keyboardActiveRef: keyboardActiveRef, children: [renderList(content, parent, divRefCallback), !isEmbedded && isMobile && ((0, jsx_runtime_1.jsxs)(mobileSheet_1.MobileSheet, { label: sheetParentName, isOpen: path.length > 0, triggerRef: internalRef, onHidePanel: closeAll, onCloseClick: closeAll, children: [(0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Title, { children: sheetParentName }), (0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Content, { children: renderList(sheetContent, sheetPathLength > 1 ? sheetParent : null, undefined, false, onKeyDownVertical) })] }))] }));
|
|
122
|
+
});
|
|
123
|
+
ControlledMenuListBase.displayName = "ControlledMenuList";
|
|
124
|
+
exports.ControlledMenuList = ControlledMenuListBase;
|
|
125
|
+
exports.ControlledMenuList.Item = menuItem_1.MenuItem;
|
|
126
|
+
exports.ControlledMenuList.Separator = menuSeparator_1.MenuSeparator;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
import { IControlledMenuListInternal } from "./controlledMenuList/controlledMenuList";
|
|
3
|
+
import { IMenuControlledItem } from "./menuItem";
|
|
4
|
+
import { IMenuSeparator } from "./menuSeparator";
|
|
5
|
+
export interface ICreateControlledMenuListRenderProps {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
type CreatedListComponent<T> = FC<T & IControlledMenuListInternal & {
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}> & {
|
|
11
|
+
Item: FC<IMenuControlledItem>;
|
|
12
|
+
Separator: FC<IMenuSeparator>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Factory that creates a typed ControlledMenuList component with custom props.
|
|
16
|
+
*
|
|
17
|
+
* The `renderContent` function receives all consumer props plus `children` (the built ControlledMenuList element),
|
|
18
|
+
* allowing the consumer to wrap the list with custom markup.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* interface INavSection { sectionTitle: string }
|
|
22
|
+
*
|
|
23
|
+
* const NavSection = createControlledMenuList<INavSection>(({ sectionTitle, children }) => (
|
|
24
|
+
* <div>
|
|
25
|
+
* <div className="section-header">{sectionTitle}</div>
|
|
26
|
+
* {children}
|
|
27
|
+
* </div>
|
|
28
|
+
* ));
|
|
29
|
+
*
|
|
30
|
+
* // Usage — accepts INavSection + IControlledMenuList props:
|
|
31
|
+
* <NavSection sectionTitle="Reports" setIsOpen={setIsOpen} isOpen={isOpen}>
|
|
32
|
+
* <NavSection.Item id="daily" name="Daily Reports" />
|
|
33
|
+
* <NavSection.Item id="weekly" name="Weekly Reports" />
|
|
34
|
+
* </NavSection>
|
|
35
|
+
*/
|
|
36
|
+
export declare function createControlledMenuList<T extends object>(renderContent: (props: T & ICreateControlledMenuListRenderProps) => ReactNode): CreatedListComponent<T>;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.createControlledMenuList = void 0;
|
|
15
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
const controlledMenuList_1 = require("./controlledMenuList/controlledMenuList");
|
|
17
|
+
const menuItem_1 = require("./menuItem");
|
|
18
|
+
const menuSeparator_1 = require("./menuSeparator");
|
|
19
|
+
/**
|
|
20
|
+
* Factory that creates a typed ControlledMenuList component with custom props.
|
|
21
|
+
*
|
|
22
|
+
* The `renderContent` function receives all consumer props plus `children` (the built ControlledMenuList element),
|
|
23
|
+
* allowing the consumer to wrap the list with custom markup.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* interface INavSection { sectionTitle: string }
|
|
27
|
+
*
|
|
28
|
+
* const NavSection = createControlledMenuList<INavSection>(({ sectionTitle, children }) => (
|
|
29
|
+
* <div>
|
|
30
|
+
* <div className="section-header">{sectionTitle}</div>
|
|
31
|
+
* {children}
|
|
32
|
+
* </div>
|
|
33
|
+
* ));
|
|
34
|
+
*
|
|
35
|
+
* // Usage — accepts INavSection + IControlledMenuList props:
|
|
36
|
+
* <NavSection sectionTitle="Reports" setIsOpen={setIsOpen} isOpen={isOpen}>
|
|
37
|
+
* <NavSection.Item id="daily" name="Daily Reports" />
|
|
38
|
+
* <NavSection.Item id="weekly" name="Weekly Reports" />
|
|
39
|
+
* </NavSection>
|
|
40
|
+
*/
|
|
41
|
+
function createControlledMenuList(renderContent) {
|
|
42
|
+
const CreatedList = allProps => {
|
|
43
|
+
const { setIsOpen, listClassName, isOpen, defaultTooltipAlignment, defaultAlignment, direction, className, children } = allProps, rest = __rest(allProps, ["setIsOpen", "listClassName", "isOpen", "defaultTooltipAlignment", "defaultAlignment", "direction", "className", "children"]);
|
|
44
|
+
// Cast required to pass internal props (isOpen, setIsOpen) not in the public interface.
|
|
45
|
+
const InternalList = controlledMenuList_1.ControlledMenuList;
|
|
46
|
+
const list = ((0, jsx_runtime_1.jsx)(InternalList, { setIsOpen: setIsOpen, listClassName: listClassName, isOpen: isOpen, defaultTooltipAlignment: defaultTooltipAlignment, defaultAlignment: defaultAlignment, direction: direction, className: className, children: children }));
|
|
47
|
+
return renderContent(Object.assign(Object.assign({}, rest), { children: list }));
|
|
48
|
+
};
|
|
49
|
+
CreatedList.displayName = "ControlledMenuList";
|
|
50
|
+
const result = CreatedList;
|
|
51
|
+
result.Item = menuItem_1.MenuItem;
|
|
52
|
+
result.Separator = menuSeparator_1.MenuSeparator;
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
exports.createControlledMenuList = createControlledMenuList;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ReactNode, ForwardRefExoticComponent, RefAttributes, ForwardedRef } from "react";
|
|
2
|
+
import { TAlignment } from "../../absolute/absolute";
|
|
3
|
+
import { IMenuItem } from "./menuItem";
|
|
4
|
+
import "./menuButton.less";
|
|
5
|
+
export interface ICreateMenuItemRenderProps {
|
|
6
|
+
hasChildren: boolean;
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
isMobile: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ICreateMenuItemWrapperProps {
|
|
11
|
+
role: "presentation";
|
|
12
|
+
className: string;
|
|
13
|
+
tabIndex?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Factory that creates a typed Menu item component with full MenuItem functionality
|
|
17
|
+
* (nested submenus, keyboard navigation, mobile sheet support), but with a
|
|
18
|
+
* consumer-defined typed interface instead of the fixed MenuItem props.
|
|
19
|
+
*
|
|
20
|
+
* The `renderTrigger` function receives all consumer props plus `hasChildren` and
|
|
21
|
+
* `isOpen` so the trigger content can reflect submenu state.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* interface INavItem { label: string; count?: number }
|
|
25
|
+
*
|
|
26
|
+
* const NavMenuItem = createMenuItem<INavItem>(({ label, count, hasChildren, isOpen }) => (
|
|
27
|
+
* <>
|
|
28
|
+
* <span>{label}</span>
|
|
29
|
+
* {count !== undefined && <Badge>{count}</Badge>}
|
|
30
|
+
* {hasChildren && <ChevronRight rotated={isOpen} />}
|
|
31
|
+
* </>
|
|
32
|
+
* ));
|
|
33
|
+
*
|
|
34
|
+
* // Usage — supports nesting exactly like Menu.Item:
|
|
35
|
+
* <Menu title="Nav">
|
|
36
|
+
* <NavMenuItem id="reports" label="Reports" count={3}>
|
|
37
|
+
* <Menu.Item id="charts" name="Charts" />
|
|
38
|
+
* <Menu.Item id="tables" name="Tables" />
|
|
39
|
+
* </NavMenuItem>
|
|
40
|
+
* </Menu>
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* // renderWrapper: replace the default <li> with a custom host element
|
|
44
|
+
* <NavMenuItem
|
|
45
|
+
* id="settings"
|
|
46
|
+
* label="Settings"
|
|
47
|
+
* renderWrapper={(children, ref, defaultProps) => (
|
|
48
|
+
* <li ref={ref} {...defaultProps} data-testid="nav-settings">
|
|
49
|
+
* {children}
|
|
50
|
+
* </li>
|
|
51
|
+
* )}
|
|
52
|
+
* />
|
|
53
|
+
*/
|
|
54
|
+
type PublicMenuItemProps<T> = T & Pick<IMenuItem, "id" | "children" | "className" | "alignment" | "disabled" | "onClick" | "link" | "target" | "rel"> & {
|
|
55
|
+
ariaLabel?: string;
|
|
56
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
57
|
+
renderWrapper?: (children: ReactNode, ref: ForwardedRef<HTMLLIElement>, defaultProps: ICreateMenuItemWrapperProps) => ReactNode;
|
|
58
|
+
tabIndex?: number;
|
|
59
|
+
tooltip?: ReactNode;
|
|
60
|
+
tooltipAlignment?: TAlignment;
|
|
61
|
+
};
|
|
62
|
+
export interface ICreateMenuItemOptions<T> {
|
|
63
|
+
/** Hook-compatible function called during render to derive a default tooltip from item props. Can call useContext. */
|
|
64
|
+
renderTooltip?: (props: T) => ReactNode | undefined;
|
|
65
|
+
}
|
|
66
|
+
export declare function createMenuItem<T extends object>(renderTrigger: (props: T & ICreateMenuItemRenderProps) => ReactNode, options?: ICreateMenuItemOptions<T>): ForwardRefExoticComponent<PublicMenuItemProps<T> & RefAttributes<HTMLLIElement>>;
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.createMenuItem = void 0;
|
|
15
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
const react_1 = require("react");
|
|
17
|
+
const controlledPopup_1 = require("../../controlledPopup/controlledPopup");
|
|
18
|
+
const classNames_1 = require("../../commonHelpers/classNames/classNames");
|
|
19
|
+
const useMenuItemCore_1 = require("../utils/useMenuItemCore");
|
|
20
|
+
const tooltip_1 = require("../../tooltip/tooltip");
|
|
21
|
+
const isSafeHref_1 = require("../utils/isSafeHref");
|
|
22
|
+
const getSafeRel_1 = require("../utils/getSafeRel");
|
|
23
|
+
const useDriveClassName_1 = require("../../utils/theme/useDriveClassName");
|
|
24
|
+
function createMenuItem(renderTrigger, options) {
|
|
25
|
+
var _a;
|
|
26
|
+
// Defined at factory level so it is always the same function reference —
|
|
27
|
+
// safe to call unconditionally inside the component (rules of hooks).
|
|
28
|
+
const resolveDefaultTooltip = (_a = options === null || options === void 0 ? void 0 : options.renderTooltip) !== null && _a !== void 0 ? _a : (() => undefined);
|
|
29
|
+
const CreatedItem = (0, react_1.forwardRef)((allProps, containerRef) => {
|
|
30
|
+
const { id, children, className, alignment, disabled, isMobile = false, setIsOpen, ariaLabel, onClick, onOpenChange, link, target, rel, renderWrapper, tabIndex, tooltip, tooltipAlignment } = allProps, rest = __rest(allProps, ["id", "children", "className", "alignment", "disabled", "isMobile", "setIsOpen", "ariaLabel", "onClick", "onOpenChange", "link", "target", "rel", "renderWrapper", "tabIndex", "tooltip", "tooltipAlignment"]);
|
|
31
|
+
const linkEvents = (0, react_1.useMemo)(() => ({
|
|
32
|
+
onKeyDown: (e) => {
|
|
33
|
+
if (e.key === " ") {
|
|
34
|
+
e.preventDefault();
|
|
35
|
+
const linkEl = e.currentTarget;
|
|
36
|
+
linkEl.dataset.spaceDown = "1";
|
|
37
|
+
linkEl.classList.add("zen-menu-button__action--active");
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
onKeyUp: (e) => {
|
|
41
|
+
if (e.key === " ") {
|
|
42
|
+
e.preventDefault();
|
|
43
|
+
const linkEl = e.currentTarget;
|
|
44
|
+
linkEl.classList.remove("zen-menu-button__action--active");
|
|
45
|
+
if (linkEl.dataset.spaceDown) {
|
|
46
|
+
delete linkEl.dataset.spaceDown;
|
|
47
|
+
linkEl.click();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}), []);
|
|
52
|
+
const { ref, isOpen, hasChildren, content, openedViaKeyboard, contentAlignment, path, handleDesktopActionClick, handleTriggerClick, handleOpenChange } = (0, useMenuItemCore_1.useMenuItemCore)({ id, children, className, alignment, isMobile, setIsOpen, onClick, onOpenChange });
|
|
53
|
+
const driveClass = (0, useDriveClassName_1.useDriveClassName)("zen-menu-button__action");
|
|
54
|
+
const liDefaultProps = Object.assign({ role: "presentation", className: (0, classNames_1.classNames)(["zen-menu-button", className !== null && className !== void 0 ? className : ""]) }, (tabIndex !== undefined && { tabIndex }));
|
|
55
|
+
// Resolved at component top level so renderTooltip can safely call hooks (e.g. useContext).
|
|
56
|
+
const defaultTooltip = resolveDefaultTooltip(Object.assign(Object.assign({}, rest), { isMobile }));
|
|
57
|
+
const effectiveTooltip = tooltip !== null && tooltip !== void 0 ? tooltip : defaultTooltip;
|
|
58
|
+
const effectiveTooltipAlignment = tooltipAlignment;
|
|
59
|
+
const wrapButton = (button) => {
|
|
60
|
+
// On mobile, tooltip wraps the <li> instead of the button so Tooltip doesn't
|
|
61
|
+
// intercept the button's onClick and shows on tap instead.
|
|
62
|
+
// Items with children are excluded — wrapping <li> would fire both the tooltip and
|
|
63
|
+
// the submenu drill-in on the same tap.
|
|
64
|
+
const isMobileTooltip = isMobile && !!effectiveTooltip && !hasChildren;
|
|
65
|
+
const wrappedButton = effectiveTooltip && !isMobileTooltip ? ((0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { trigger: button, alignment: effectiveTooltipAlignment, children: effectiveTooltip })) : (button);
|
|
66
|
+
const liElement = renderWrapper ? (renderWrapper(wrappedButton, containerRef, liDefaultProps)) : ((0, jsx_runtime_1.jsx)("li", Object.assign({ ref: containerRef }, liDefaultProps, { tabIndex: tabIndex, children: wrappedButton })));
|
|
67
|
+
// Wrap li with Tooltip on mobile
|
|
68
|
+
return isMobileTooltip ? ((0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { trigger: liElement, alignment: effectiveTooltipAlignment, children: effectiveTooltip })) : (liElement);
|
|
69
|
+
};
|
|
70
|
+
// Leaf node — no submenu
|
|
71
|
+
if (!hasChildren) {
|
|
72
|
+
const triggerContent = renderTrigger(Object.assign(Object.assign({}, rest), { hasChildren: false, isOpen: false, isMobile }));
|
|
73
|
+
return wrapButton(link ? ((0, jsx_runtime_1.jsx)("a", Object.assign({ role: "menuitem", "aria-label": ariaLabel, "aria-disabled": disabled, href: disabled || !(0, isSafeHref_1.isSafeHref)(link) ? undefined : link, target: target, rel: (0, getSafeRel_1.getSafeRel)(rel, target), className: (0, classNames_1.classNames)(["zen-menu-button__action", "zen-caption", driveClass !== null && driveClass !== void 0 ? driveClass : ""]), onClick: handleDesktopActionClick }, linkEvents, { children: triggerContent }))) : ((0, jsx_runtime_1.jsx)("button", { ref: ref, type: "button", role: "menuitem", "aria-label": ariaLabel, disabled: !!disabled, className: (0, classNames_1.classNames)(["zen-menu-button__action", "zen-button", "zen-caption", driveClass !== null && driveClass !== void 0 ? driveClass : ""]), onClick: handleDesktopActionClick, children: triggerContent })));
|
|
74
|
+
}
|
|
75
|
+
// Mobile — button drills into sub-level via PathContext
|
|
76
|
+
if (isMobile) {
|
|
77
|
+
return wrapButton((0, jsx_runtime_1.jsx)("button", { ref: ref, type: "button", role: "menuitem", "aria-label": ariaLabel, disabled: !!disabled, className: (0, classNames_1.classNames)([
|
|
78
|
+
"zen-menu-button__action",
|
|
79
|
+
"zen-button",
|
|
80
|
+
"zen-caption",
|
|
81
|
+
"zen-menu-button__action--has-children",
|
|
82
|
+
driveClass !== null && driveClass !== void 0 ? driveClass : ""
|
|
83
|
+
]), onClick: handleTriggerClick, children: renderTrigger(Object.assign(Object.assign({}, rest), { hasChildren: true, isOpen, isMobile })) }));
|
|
84
|
+
}
|
|
85
|
+
// Desktop with submenu
|
|
86
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [wrapButton((0, jsx_runtime_1.jsx)("button", { ref: ref, type: "button", role: "menuitem", "aria-label": ariaLabel, disabled: !!disabled, "aria-haspopup": "menu", "aria-expanded": isOpen, className: (0, classNames_1.classNames)([
|
|
87
|
+
"zen-menu-button__action",
|
|
88
|
+
"zen-button",
|
|
89
|
+
"zen-caption",
|
|
90
|
+
"zen-menu-button__action--has-children",
|
|
91
|
+
driveClass !== null && driveClass !== void 0 ? driveClass : ""
|
|
92
|
+
]), onClick: handleTriggerClick, children: renderTrigger(Object.assign(Object.assign({}, rest), { hasChildren: true, isOpen, isMobile: false })) })), (0, jsx_runtime_1.jsx)(controlledPopup_1.ControlledPopup, { className: (0, classNames_1.classNames)([`zen-controlled-menu-submenu--${path.length}`]), useTrapFocusWithTrigger: openedViaKeyboard ? "on" : "withTrigger", alignment: contentAlignment, triggerRef: ref, isOpen: isOpen, onOpenChange: handleOpenChange, ariaLabel: ariaLabel, recalculateOnScroll: true, children: (0, jsx_runtime_1.jsx)("ul", { role: "menu", className: "zen-menu-item", children: content }) })] }));
|
|
93
|
+
});
|
|
94
|
+
CreatedItem.displayName = "MenuItem";
|
|
95
|
+
return CreatedItem;
|
|
96
|
+
}
|
|
97
|
+
exports.createMenuItem = createMenuItem;
|
|
@@ -5,18 +5,24 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const classNames_1 = require("../../commonHelpers/classNames/classNames");
|
|
7
7
|
const iconChevronRight_1 = require("../../icons/iconChevronRight");
|
|
8
|
+
const iconChevronLeft_1 = require("../../icons/iconChevronLeft");
|
|
9
|
+
const useDirectionalIcon_1 = require("../../utils/localization/useDirectionalIcon");
|
|
8
10
|
const useDriveClassName_1 = require("../../utils/theme/useDriveClassName");
|
|
9
11
|
const useDrive_1 = require("../../utils/theme/useDrive");
|
|
10
12
|
const getMenuButtonState_1 = require("../utils/getMenuButtonState");
|
|
13
|
+
const isSafeHref_1 = require("../utils/isSafeHref");
|
|
14
|
+
const getSafeRel_1 = require("../utils/getSafeRel");
|
|
11
15
|
const MenuButton = ({ id, onClick, hasChildren, disabled, icon, name, link, target, rel, className = "", active = null, ref }) => {
|
|
12
16
|
const { hasState, isActive } = (0, getMenuButtonState_1.getMenuButtonState)(active, disabled);
|
|
13
17
|
const driveMenuButtonActionClasses = (0, useDriveClassName_1.useDriveClassName)("zen-menu-button__action");
|
|
14
18
|
const isDrive = (0, useDrive_1.useDrive)();
|
|
19
|
+
const ChevronIcon = (0, useDirectionalIcon_1.useDirectionalIcon)(iconChevronRight_1.IconChevronRight, iconChevronLeft_1.IconChevronLeft);
|
|
15
20
|
const linkEvents = (0, react_1.useMemo)(() => ({
|
|
16
21
|
onKeyDown: e => {
|
|
17
22
|
if (e.key === " ") {
|
|
18
23
|
e.preventDefault();
|
|
19
24
|
const linkEl = e.target;
|
|
25
|
+
linkEl.dataset.spaceDown = "1";
|
|
20
26
|
linkEl.classList.add("zen-menu-button__action--active");
|
|
21
27
|
}
|
|
22
28
|
},
|
|
@@ -25,7 +31,10 @@ const MenuButton = ({ id, onClick, hasChildren, disabled, icon, name, link, targ
|
|
|
25
31
|
e.preventDefault();
|
|
26
32
|
const linkEl = e.target;
|
|
27
33
|
linkEl.classList.remove("zen-menu-button__action--active");
|
|
28
|
-
linkEl.
|
|
34
|
+
if (linkEl.dataset.spaceDown) {
|
|
35
|
+
delete linkEl.dataset.spaceDown;
|
|
36
|
+
linkEl.click();
|
|
37
|
+
}
|
|
29
38
|
}
|
|
30
39
|
}
|
|
31
40
|
}), []);
|
|
@@ -43,13 +52,13 @@ const MenuButton = ({ id, onClick, hasChildren, disabled, icon, name, link, targ
|
|
|
43
52
|
(0, react_1.createElement)(icon, {
|
|
44
53
|
size: isDrive ? "huge" : "large",
|
|
45
54
|
className: (0, classNames_1.classNames)(["zen-caption__pre-content", "zen-menu-button__icon"])
|
|
46
|
-
}), (0, jsx_runtime_1.jsx)("span", { className: "zen-menu-button__action-text", children: name }), !!hasChildren && ((0, jsx_runtime_1.jsx)(
|
|
55
|
+
}), (0, jsx_runtime_1.jsx)("span", { className: "zen-menu-button__action-text", children: name }), !!hasChildren && ((0, jsx_runtime_1.jsx)(ChevronIcon, { size: isDrive ? "huge" : "large", className: (0, classNames_1.classNames)(["zen-caption__pre-content", "zen-menu-button__more-icon"]) }))] }));
|
|
47
56
|
const linkTemplate = ((0, jsx_runtime_1.jsxs)("a", Object.assign({ "data-id": id, role: "menuitem", className: (0, classNames_1.classNames)([
|
|
48
57
|
"zen-menu-button__action",
|
|
49
58
|
"zen-caption",
|
|
50
59
|
disabled ? "zen-menu-button__action--disabled" : "",
|
|
51
60
|
driveMenuButtonActionClasses || ""
|
|
52
|
-
]), href: disabled ? undefined : link, "aria-disabled": disabled, onClick: onClickHandler, target: target, rel: rel }, linkEvents, { children: [!!icon &&
|
|
61
|
+
]), href: disabled || !(0, isSafeHref_1.isSafeHref)(link) ? undefined : link, "aria-disabled": disabled, onClick: onClickHandler, target: target, rel: (0, getSafeRel_1.getSafeRel)(rel, target) }, linkEvents, { children: [!!icon &&
|
|
53
62
|
(0, react_1.createElement)(icon, {
|
|
54
63
|
size: isDrive ? "huge" : "large",
|
|
55
64
|
className: "zen-caption__pre-content"
|
|
@@ -2,6 +2,7 @@ import { FC, ReactElement } from "react";
|
|
|
2
2
|
import { IMenuButton } from "./menuButton";
|
|
3
3
|
import "./menuItem.less";
|
|
4
4
|
import { TAlignment } from "../../absolute/absolute";
|
|
5
|
+
export { isMenuItem } from "../utils/isMenuItem";
|
|
5
6
|
interface IMenuItemInternal {
|
|
6
7
|
isMobile?: boolean;
|
|
7
8
|
setIsOpen?: (v: boolean) => void;
|
|
@@ -12,6 +13,4 @@ export interface IMenuControlledItem extends IMenuItem {
|
|
|
12
13
|
export interface IMenuItem extends IMenuButton {
|
|
13
14
|
alignment?: TAlignment;
|
|
14
15
|
}
|
|
15
|
-
export declare const isMenuItem: (element: ReactElement | undefined) => boolean;
|
|
16
16
|
export declare const MenuItem: FC<Omit<IMenuItem & IMenuControlledItem & IMenuItemInternal, "hasChildren">>;
|
|
17
|
-
export {};
|