@geotab/zenith 3.1.1-beta.6 → 3.2.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 +20 -0
- package/dist/advancedGroupsFilter/advancedGroupsFilter.js +136 -30
- package/dist/advancedGroupsFilter/advancedGroupsFilterForm.js +139 -34
- package/dist/advancedGroupsFilter/advancedGroupsFilterFormSection.js +352 -87
- package/dist/advancedGroupsFilter/advancedGroupsFilterSectionTooltip.d.ts +0 -1
- package/dist/advancedGroupsFilter/advancedGroupsFilterSectionTooltip.js +83 -9
- package/dist/alertRaw/alertRaw.js +175 -54
- package/dist/banner/bannerMultipLine.js +131 -23
- package/dist/banner/bannerSingleLine.js +110 -16
- package/dist/betaPill/betaPill.js +111 -20
- package/dist/bookmark/bookmark.js +95 -28
- package/dist/bulkEditControl/bulkEditControl.js +167 -34
- package/dist/calendar/calendar.js +943 -273
- package/dist/calendar/calendarUtils.js +157 -85
- package/dist/card/card.js +268 -123
- package/dist/chart/accessibleChart/accessibleChartNarrative.js +648 -555
- package/dist/chart/accessibleChart/accessibleChartTable.js +245 -86
- package/dist/chart/chart.js +36 -21
- package/dist/chart/chartAxis/chartAxis.js +85 -7
- package/dist/checkboxListWithAction/checkboxListWithAction.js +224 -69
- package/dist/chip/chip.js +195 -91
- package/dist/columnsSelector/columnsSelector.js +97 -12
- package/dist/columnsSelector/columnsTab/columnsTab.js +59 -15
- package/dist/columnsSelector/columnsTabGroup/columnsTabGroup.js +81 -34
- package/dist/comboboxSelected/comboboxSelected.js +1 -3
- package/dist/dataFeed/feedExpandControl/feedExpandControl.js +25 -10
- package/dist/dataGrid/columns/checkboxColumn/checkboxHeaderCell.js +92 -11
- package/dist/dataGrid/dataGrid.js +227 -117
- package/dist/dataGrid/emptySearchList/emptySearchList.js +56 -9
- package/dist/dataGrid/entitiesListActions/actions/columnsListButton.js +51 -7
- package/dist/dataGrid/entitiesListActions/actions/fullscreenButton.js +64 -18
- package/dist/dataGrid/withFlexibleColumns/components/columnSettings.js +84 -10
- package/dist/dataGrid/withFlexibleColumns/components/columnSettingsSidePanel.js +48 -16
- package/dist/dataGrid/withSelectableRows/components/bulkActions/bulkActions.js +223 -32
- package/dist/dataGrid/withSelectableRows/withSelectableRows.js +286 -213
- package/dist/dataGrid/withSortableColumns/columns/sortableColumnWrapper.js +178 -95
- package/dist/dateInputInner/dateInputInner.js +791 -476
- package/dist/dateInputInner/dateInputInnerControlBlock.js +125 -22
- package/dist/dateInputRaw/dateInputRaw.js +315 -104
- package/dist/dateInputRaw/utils/getLabel.js +38 -7
- package/dist/dateRangeInner/dateRangeInner.js +172 -58
- package/dist/dateRangeRaw/dateRangeRaw.js +601 -239
- package/dist/dateRangeRaw/utils/dateRangeUtils.js +629 -241
- package/dist/dateSelectionWrapper/dateSelectionWrapper.js +152 -14
- package/dist/dialog/dialogContent.js +123 -40
- package/dist/dropdownRaw/dropdownHelper.d.ts +2 -2
- package/dist/dropdownRaw/dropdownHelper.js +9 -9
- package/dist/dropdownRaw/dropdownList.js +447 -78
- package/dist/dropdownRaw/dropdownPopup.js +218 -20
- package/dist/dropdownRaw/dropdownRaw.js +866 -506
- package/dist/dropdownRaw/dropdownSearchableTrigger.js +223 -46
- package/dist/dropdownRaw/stateReducer/stateAction.d.ts +5 -1
- package/dist/dropdownRaw/stateReducer/stateActionType.d.ts +2 -1
- package/dist/dropdownRaw/stateReducer/stateActionType.js +1 -0
- package/dist/dropdownRaw/stateReducer/stateReducer.d.ts +6 -1
- package/dist/dropdownRaw/stateReducer/stateReducer.js +24 -12
- package/dist/dropdownRaw/stateReducer/stateReducerHelper.d.ts +2 -0
- package/dist/dropdownRaw/stateReducer/stateReducerHelper.js +20 -1
- package/dist/dropdownRaw/stateReducer/stateReducerTestData.d.ts +39 -0
- package/dist/dropdownRaw/stateReducer/stateReducerTestData.js +74 -0
- package/dist/dropdownRaw/types.d.ts +1 -0
- package/dist/favoriteButton/favoriteButton.js +59 -10
- package/dist/filters/components/filtersContainer.js +151 -64
- package/dist/filters/components/filtersEmptySelectedList.js +30 -4
- package/dist/filters/components/filtersSaveModal.js +140 -42
- package/dist/filters/components/filtersSavedChipComponent.js +318 -108
- package/dist/filters/components/filtersSearchItemData.js +127 -47
- package/dist/filters/components/filtersSearchList.js +381 -179
- package/dist/filters/components/filtersSelect.js +128 -61
- package/dist/filters/components/filtersSelectListItem.js +125 -13
- package/dist/filters/components/filtersSidePanel.js +510 -178
- package/dist/filters/filters.js +445 -268
- package/dist/filtersBar/components/filtersBarPeriodPicker/getRangeOption.js +729 -272
- package/dist/filtersBar/components/resetComponentButton.js +45 -5
- package/dist/filtersBar/filtersBarActions/filtersBarActions.js +126 -15
- package/dist/filtersBar/filtersBarSidePanel/components/filtersBarSidePanelRange/filtersBarSidePanelRange.js +155 -49
- package/dist/filtersBar/filtersBarSidePanel/filtersBarSidePanel.js +360 -104
- package/dist/filtersBar/filtersContainer/filtersContainer.js +204 -134
- package/dist/formField/components/formFieldWithLabel.d.ts +2 -1
- package/dist/formField/components/formFieldWithLabel.js +3 -2
- package/dist/formField/components/formFieldWithoutLabel.d.ts +2 -1
- package/dist/formField/components/formFieldWithoutLabel.js +3 -3
- package/dist/formField/components/trailingComponent.d.ts +8 -0
- package/dist/formField/components/trailingComponent.js +11 -0
- package/dist/formField/formField.js +12 -11
- package/dist/formField/hooks/useError.js +100 -36
- package/dist/formGroup/components/reviewListToggle/reviewListToggle.js +72 -7
- package/dist/formGroup/hooks/useToggle.js +37 -11
- package/dist/formGroup/utils/getControls.js +8 -7
- package/dist/formLayout/hooks/useError.js +55 -15
- package/dist/formLayout/hooks/useFormButtons.js +128 -27
- package/dist/formSection/components/formSectionModal.js +1 -1
- package/dist/formSection/formSection.js +1 -1
- package/dist/formSection/hooks/useError.js +70 -22
- package/dist/formStepper/components/formStep.js +65 -10
- package/dist/formStepper/formStepper.js +129 -33
- package/dist/formStepperButtons/formStepperButtons.js +184 -38
- package/dist/groupsFilter/groupsHelper.d.ts +1 -1
- package/dist/groupsFilterRaw/groupsFilterAdjustmentState.js +162 -17
- package/dist/groupsFilterRaw/groupsFilterBox.js +137 -32
- package/dist/groupsFilterRaw/groupsFilterCommon.js +75 -8
- package/dist/groupsFilterRaw/groupsFilterCurrentlySelectedState.js +184 -25
- package/dist/groupsFilterRaw/groupsFilterHelper.d.ts +2 -1
- package/dist/groupsFilterRaw/groupsFilterHelper.js +284 -168
- package/dist/groupsFilterRaw/groupsFilterInitialState.js +266 -18
- package/dist/groupsFilterRaw/groupsFilterMenu.js +124 -9
- package/dist/groupsFilterRaw/groupsFilterRaw.d.ts +1 -0
- package/dist/groupsFilterRaw/groupsFilterRaw.js +816 -308
- package/dist/groupsFilterRaw/groupsFilterTestData.d.ts +155 -2
- package/dist/groupsFilterRaw/groupsFilterTestData.js +153 -58
- package/dist/groupsFilterRaw/groupsFilterTrigger.js +139 -35
- package/dist/groupsFilterRaw/groupsHelper.js +739 -208
- package/dist/groupsFilterRaw/stateReducer/stateReducerHelper.js +3 -1
- package/dist/groupsFilterRaw/types.d.ts +1 -0
- package/dist/header/components/collapsedItemsControl/collapsedItemsControl.js +107 -52
- package/dist/header/components/mobileFilterControl/mobileFilterControl.js +62 -9
- package/dist/header/components/mobileSearchControl/mobileSearchControl.js +119 -14
- package/dist/header/headerBack.js +64 -20
- package/dist/index.css +110 -71
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -1
- package/dist/list/itemData/itemDataInternal.js +216 -51
- package/dist/list/listItem/listItem.js +168 -55
- package/dist/menu/components/menuErrorItem.js +33 -5
- package/dist/mobileSheet/mobileSheet.js +195 -69
- package/dist/modal/modal.js +300 -142
- package/dist/nav/nav.js +1 -1
- package/dist/nav/navFooter/navFooter.js +82 -39
- package/dist/nav/navFooter/navFooterAction/navFooterAction.js +52 -13
- package/dist/nav/navHeader/navHeader.js +86 -36
- package/dist/nav/navHeader/navHeaderSearch/navHeaderSearch.js +88 -29
- package/dist/nav/navItem/navItem.d.ts +3 -3
- package/dist/nav/navItem/navItem.js +35 -33
- package/dist/nav/navMobileBar/navMobileBar.js +67 -21
- package/dist/notification/notification.js +124 -21
- package/dist/pagination/paginationArrow.js +81 -11
- package/dist/pagination/paginationText/paginationText.js +45 -11
- package/dist/pill/components/pillNonActionable/pillNonActionable.js +93 -24
- package/dist/pillBox/components/pillBoxItem.js +52 -9
- package/dist/pillBox/pillBox.js +121 -20
- package/dist/pillExpandable/pillExpandable.js +333 -139
- package/dist/rangeRaw/rangeRaw.js +486 -141
- package/dist/rangeRaw/utils/rangeHelper.js +209 -39
- package/dist/searchInputRaw/searchInputRaw.js +180 -65
- package/dist/skeleton/skeleton.js +51 -6
- package/dist/sortControl/sortControl.js +152 -42
- package/dist/stepperRaw/stepperRaw.js +116 -42
- package/dist/summary/summary.js +94 -8
- package/dist/table/actions/actionsMenu.js +171 -78
- package/dist/table/flexible/columnSettings.js +80 -10
- package/dist/table/flexible/columnsList.js +110 -43
- package/dist/table/flexible/columnsPopup.js +77 -20
- package/dist/table/nested/useNestedRows.js +167 -77
- package/dist/table/selectable/selectableHeader.js +180 -41
- package/dist/table/selectable/useSelectableRows.js +270 -191
- package/dist/table/sortable/sortableHeader.js +153 -75
- package/dist/tabs/tabs.js +227 -118
- package/dist/timePickerRaw/timePickerRaw.js +278 -58
- package/dist/toastRaw/toastRaw.js +138 -32
- package/dist/toggleButton/toggleButton.d.ts +0 -1
- package/dist/toggleButtonRaw/toggleButtonRaw.d.ts +1 -0
- package/dist/toggleButtonRaw/toggleButtonRaw.js +146 -40
- package/dist/utils/formatDate.js +1001 -117
- package/{esm/utils/localization/translations/cs-json.js → dist/utils/localization/translations/cs.json} +11 -12
- package/{esm/utils/localization/translations/da-DK-json.js → dist/utils/localization/translations/da-DK.json} +31 -23
- package/{esm/utils/localization/translations/de-json.js → dist/utils/localization/translations/de.json} +12 -13
- package/dist/utils/localization/translations/en.json +308 -0
- package/{esm/utils/localization/translations/es-json.js → dist/utils/localization/translations/es.json} +11 -12
- package/{esm/utils/localization/translations/fi-FI-json.js → dist/utils/localization/translations/fi-FI.json} +31 -23
- package/{esm/utils/localization/translations/fr-FR-json.js → dist/utils/localization/translations/fr-FR.json} +12 -12
- package/{esm/utils/localization/translations/fr-json.js → dist/utils/localization/translations/fr.json} +11 -12
- package/{esm/utils/localization/translations/hu-HU-json.js → dist/utils/localization/translations/hu-HU.json} +31 -23
- package/{esm/utils/localization/translations/id-json.js → dist/utils/localization/translations/id.json} +11 -13
- package/{esm/utils/localization/translations/it-json.js → dist/utils/localization/translations/it.json} +11 -12
- package/{esm/utils/localization/translations/ja-json.js → dist/utils/localization/translations/ja.json} +11 -12
- package/{esm/utils/localization/translations/ko-KR-json.js → dist/utils/localization/translations/ko-KR.json} +24 -23
- package/{esm/utils/localization/translations/ms-json.js → dist/utils/localization/translations/ms.json} +11 -12
- package/{esm/utils/localization/translations/nb-NO-json.js → dist/utils/localization/translations/nb-NO.json} +31 -23
- package/{esm/utils/localization/translations/nl-json.js → dist/utils/localization/translations/nl.json} +11 -12
- package/{esm/utils/localization/translations/pl-json.js → dist/utils/localization/translations/pl.json} +11 -12
- package/{esm/utils/localization/translations/pt-BR-json.js → dist/utils/localization/translations/pt-BR.json} +11 -12
- package/{esm/utils/localization/translations/sk-SK-json.js → dist/utils/localization/translations/sk-SK.json} +31 -23
- package/{esm/utils/localization/translations/sv-json.js → dist/utils/localization/translations/sv.json} +11 -12
- package/{esm/utils/localization/translations/th-json.js → dist/utils/localization/translations/th.json} +11 -12
- package/{esm/utils/localization/translations/tr-json.js → dist/utils/localization/translations/tr.json} +11 -12
- package/{esm/utils/localization/translations/zh-Hans-json.js → dist/utils/localization/translations/zh-Hans.json} +11 -12
- package/{esm/utils/localization/translations/zh-TW-json.js → dist/utils/localization/translations/zh-TW.json} +11 -23
- package/dist/utils/localization/translationsDictionary.d.ts +2 -0
- package/dist/utils/localization/translationsDictionary.js +63 -0
- package/dist/utils/localization/useLanguage.js +2 -74
- package/esm/advancedGroupsFilter/advancedGroupsFilter.js +130 -29
- package/esm/advancedGroupsFilter/advancedGroupsFilterForm.js +133 -33
- package/esm/advancedGroupsFilter/advancedGroupsFilterFormSection.js +317 -65
- package/esm/advancedGroupsFilter/advancedGroupsFilterSectionTooltip.d.ts +0 -1
- package/esm/advancedGroupsFilter/advancedGroupsFilterSectionTooltip.js +77 -8
- package/esm/alertRaw/alertRaw.js +165 -51
- package/esm/banner/bannerMultipLine.js +121 -20
- package/esm/banner/bannerSingleLine.js +100 -13
- package/esm/betaPill/betaPill.js +105 -19
- package/esm/bookmark/bookmark.js +89 -27
- package/esm/bulkEditControl/bulkEditControl.js +161 -33
- package/esm/calendar/calendar.js +937 -272
- package/esm/calendar/calendarUtils.js +151 -84
- package/esm/card/card.js +233 -101
- package/esm/chart/accessibleChart/accessibleChartNarrative.js +642 -554
- package/esm/chart/accessibleChart/accessibleChartTable.js +239 -85
- package/esm/chart/chart.js +30 -20
- package/esm/chart/chartAxis/chartAxis.js +79 -6
- package/esm/checkboxListWithAction/checkboxListWithAction.js +218 -68
- package/esm/chip/chip.js +189 -90
- package/esm/columnsSelector/columnsSelector.js +91 -11
- package/esm/columnsSelector/columnsTab/columnsTab.js +53 -14
- package/esm/columnsSelector/columnsTabGroup/columnsTabGroup.js +75 -33
- package/esm/comboboxSelected/comboboxSelected.js +1 -3
- package/esm/dataFeed/feedExpandControl/feedExpandControl.js +21 -9
- package/esm/dataGrid/columns/checkboxColumn/checkboxHeaderCell.js +86 -10
- package/esm/dataGrid/dataGrid.js +221 -116
- package/esm/dataGrid/emptySearchList/emptySearchList.js +50 -8
- package/esm/dataGrid/entitiesListActions/actions/columnsListButton.js +45 -6
- package/esm/dataGrid/entitiesListActions/actions/fullscreenButton.js +58 -17
- package/esm/dataGrid/withFlexibleColumns/components/columnSettings.js +78 -9
- package/esm/dataGrid/withFlexibleColumns/components/columnSettingsSidePanel.js +44 -15
- package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.js +217 -31
- package/esm/dataGrid/withSelectableRows/withSelectableRows.js +280 -212
- package/esm/dataGrid/withSortableColumns/columns/sortableColumnWrapper.js +172 -94
- package/esm/dateInputInner/dateInputInner.js +785 -475
- package/esm/dateInputInner/dateInputInnerControlBlock.js +119 -21
- package/esm/dateInputRaw/dateInputRaw.js +309 -103
- package/esm/dateInputRaw/utils/getLabel.js +32 -6
- package/esm/dateRangeInner/dateRangeInner.js +166 -57
- package/esm/dateRangeRaw/dateRangeRaw.js +595 -238
- package/esm/dateRangeRaw/utils/dateRangeUtils.js +622 -239
- package/esm/dateSelectionWrapper/dateSelectionWrapper.js +146 -13
- package/esm/dialog/dialogContent.js +117 -39
- package/esm/dropdownRaw/dropdownHelper.d.ts +2 -2
- package/esm/dropdownRaw/dropdownHelper.js +10 -10
- package/esm/dropdownRaw/dropdownList.js +412 -56
- package/esm/dropdownRaw/dropdownPopup.js +212 -19
- package/esm/dropdownRaw/dropdownRaw.js +862 -507
- package/esm/dropdownRaw/dropdownSearchableTrigger.js +217 -45
- package/esm/dropdownRaw/stateReducer/stateAction.d.ts +5 -1
- package/esm/dropdownRaw/stateReducer/stateActionType.d.ts +2 -1
- package/esm/dropdownRaw/stateReducer/stateActionType.js +1 -0
- package/esm/dropdownRaw/stateReducer/stateReducer.d.ts +6 -1
- package/esm/dropdownRaw/stateReducer/stateReducer.js +24 -12
- package/esm/dropdownRaw/stateReducer/stateReducerHelper.d.ts +2 -0
- package/esm/dropdownRaw/stateReducer/stateReducerHelper.js +18 -0
- package/esm/dropdownRaw/stateReducer/stateReducerTestData.d.ts +39 -0
- package/esm/dropdownRaw/stateReducer/stateReducerTestData.js +71 -0
- package/esm/dropdownRaw/types.d.ts +1 -0
- package/esm/favoriteButton/favoriteButton.js +53 -9
- package/esm/filters/components/filtersContainer.js +141 -61
- package/esm/filters/components/filtersEmptySelectedList.js +24 -3
- package/esm/filters/components/filtersSaveModal.js +134 -41
- package/esm/filters/components/filtersSavedChipComponent.js +312 -107
- package/esm/filters/components/filtersSearchItemData.js +121 -46
- package/esm/filters/components/filtersSearchList.js +375 -178
- package/esm/filters/components/filtersSelect.js +122 -60
- package/esm/filters/components/filtersSelectListItem.js +119 -12
- package/esm/filters/components/filtersSidePanel.js +504 -177
- package/esm/filters/filters.js +435 -265
- package/esm/filtersBar/components/filtersBarPeriodPicker/getRangeOption.js +722 -270
- package/esm/filtersBar/components/resetComponentButton.js +39 -4
- package/esm/filtersBar/filtersBarActions/filtersBarActions.js +120 -14
- package/esm/filtersBar/filtersBarSidePanel/components/filtersBarSidePanelRange/filtersBarSidePanelRange.js +149 -48
- package/esm/filtersBar/filtersBarSidePanel/filtersBarSidePanel.js +354 -103
- package/esm/filtersBar/filtersContainer/filtersContainer.js +198 -133
- package/esm/formField/components/formFieldWithLabel.d.ts +2 -1
- package/esm/formField/components/formFieldWithLabel.js +3 -2
- package/esm/formField/components/formFieldWithoutLabel.d.ts +2 -1
- package/esm/formField/components/formFieldWithoutLabel.js +3 -3
- package/esm/formField/components/trailingComponent.d.ts +8 -0
- package/esm/formField/components/trailingComponent.js +7 -0
- package/esm/formField/formField.js +12 -11
- package/esm/formField/hooks/useError.js +94 -35
- package/esm/formGroup/components/reviewListToggle/reviewListToggle.js +66 -6
- package/esm/formGroup/hooks/useToggle.js +31 -10
- package/esm/formGroup/utils/getControls.js +8 -7
- package/esm/formLayout/hooks/useError.js +49 -14
- package/esm/formLayout/hooks/useFormButtons.js +122 -26
- package/esm/formSection/components/formSectionModal.js +1 -1
- package/esm/formSection/formSection.js +1 -1
- package/esm/formSection/hooks/useError.js +64 -21
- package/esm/formStepper/components/formStep.js +59 -9
- package/esm/formStepper/formStepper.js +123 -32
- package/esm/formStepperButtons/formStepperButtons.js +178 -37
- package/esm/groupsFilter/groupsHelper.d.ts +1 -1
- package/esm/groupsFilterRaw/groupsFilterAdjustmentState.js +152 -14
- package/esm/groupsFilterRaw/groupsFilterBox.js +131 -31
- package/esm/groupsFilterRaw/groupsFilterCommon.js +69 -7
- package/esm/groupsFilterRaw/groupsFilterCurrentlySelectedState.js +178 -24
- package/esm/groupsFilterRaw/groupsFilterHelper.d.ts +2 -1
- package/esm/groupsFilterRaw/groupsFilterHelper.js +279 -168
- package/esm/groupsFilterRaw/groupsFilterInitialState.js +260 -17
- package/esm/groupsFilterRaw/groupsFilterMenu.js +118 -8
- package/esm/groupsFilterRaw/groupsFilterRaw.d.ts +1 -0
- package/esm/groupsFilterRaw/groupsFilterRaw.js +811 -308
- package/esm/groupsFilterRaw/groupsFilterTestData.d.ts +155 -2
- package/esm/groupsFilterRaw/groupsFilterTestData.js +152 -57
- package/esm/groupsFilterRaw/groupsFilterTrigger.js +133 -34
- package/esm/groupsFilterRaw/groupsHelper.js +733 -207
- package/esm/groupsFilterRaw/stateReducer/stateReducerHelper.js +3 -1
- package/esm/groupsFilterRaw/types.d.ts +1 -0
- package/esm/header/components/collapsedItemsControl/collapsedItemsControl.js +101 -51
- package/esm/header/components/mobileFilterControl/mobileFilterControl.js +56 -8
- package/esm/header/components/mobileSearchControl/mobileSearchControl.js +113 -13
- package/esm/header/headerBack.js +58 -19
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/list/itemData/itemDataInternal.js +210 -50
- package/esm/list/listItem/listItem.js +162 -54
- package/esm/menu/components/menuErrorItem.js +27 -4
- package/esm/mobileSheet/mobileSheet.js +189 -68
- package/esm/modal/modal.js +265 -120
- package/esm/nav/nav.js +1 -1
- package/esm/nav/navFooter/navFooter.js +76 -38
- package/esm/nav/navFooter/navFooterAction/navFooterAction.js +46 -12
- package/esm/nav/navHeader/navHeader.js +80 -35
- package/esm/nav/navHeader/navHeaderSearch/navHeaderSearch.js +82 -28
- package/esm/nav/navItem/navItem.d.ts +3 -3
- package/esm/nav/navItem/navItem.js +35 -33
- package/esm/nav/navMobileBar/navMobileBar.js +61 -20
- package/esm/notification/notification.js +114 -18
- package/esm/pagination/paginationArrow.js +75 -10
- package/esm/pagination/paginationText/paginationText.js +39 -10
- package/esm/pill/components/pillNonActionable/pillNonActionable.js +87 -23
- package/esm/pillBox/components/pillBoxItem.js +46 -8
- package/esm/pillBox/pillBox.js +115 -19
- package/esm/pillExpandable/pillExpandable.js +327 -138
- package/esm/rangeRaw/rangeRaw.js +480 -140
- package/esm/rangeRaw/utils/rangeHelper.js +203 -38
- package/esm/searchInputRaw/searchInputRaw.js +145 -43
- package/esm/skeleton/skeleton.js +45 -5
- package/esm/sortControl/sortControl.js +146 -41
- package/esm/stepperRaw/stepperRaw.js +112 -41
- package/esm/storybookHelpers/dataGridWithDifferentCellOptions/components/EntitiesListAction.js +178 -19
- package/esm/summary/summary.js +88 -7
- package/esm/table/actions/actionsMenu.js +165 -77
- package/esm/table/flexible/columnSettings.js +74 -9
- package/esm/table/flexible/columnsList.js +104 -42
- package/esm/table/flexible/columnsPopup.js +71 -19
- package/esm/table/nested/useNestedRows.js +161 -76
- package/esm/table/selectable/selectableHeader.js +174 -40
- package/esm/table/selectable/useSelectableRows.js +264 -190
- package/esm/table/sortable/sortableHeader.js +147 -74
- package/esm/tabs/tabs.js +221 -117
- package/esm/timePickerRaw/timePickerRaw.js +272 -57
- package/esm/toastRaw/toastRaw.js +132 -31
- package/esm/toggleButton/toggleButton.d.ts +0 -1
- package/esm/toggleButtonRaw/toggleButtonRaw.d.ts +1 -0
- package/esm/toggleButtonRaw/toggleButtonRaw.js +111 -18
- package/esm/utils/formatDate.js +995 -116
- package/{dist/utils/localization/translations/cs-json.js → esm/utils/localization/translations/cs.json} +11 -15
- package/{dist/utils/localization/translations/da-DK-json.js → esm/utils/localization/translations/da-DK.json} +31 -26
- package/{dist/utils/localization/translations/de-json.js → esm/utils/localization/translations/de.json} +12 -16
- package/esm/utils/localization/translations/en.json +308 -0
- package/{dist/utils/localization/translations/es-json.js → esm/utils/localization/translations/es.json} +11 -15
- package/{dist/utils/localization/translations/fi-FI-json.js → esm/utils/localization/translations/fi-FI.json} +31 -26
- package/{dist/utils/localization/translations/fr-FR-json.js → esm/utils/localization/translations/fr-FR.json} +12 -15
- package/{dist/utils/localization/translations/fr-json.js → esm/utils/localization/translations/fr.json} +11 -15
- package/{dist/utils/localization/translations/hu-HU-json.js → esm/utils/localization/translations/hu-HU.json} +31 -26
- package/{dist/utils/localization/translations/id-json.js → esm/utils/localization/translations/id.json} +11 -16
- package/{dist/utils/localization/translations/it-json.js → esm/utils/localization/translations/it.json} +11 -15
- package/{dist/utils/localization/translations/ja-json.js → esm/utils/localization/translations/ja.json} +11 -15
- package/{dist/utils/localization/translations/ko-KR-json.js → esm/utils/localization/translations/ko-KR.json} +24 -26
- package/{dist/utils/localization/translations/ms-json.js → esm/utils/localization/translations/ms.json} +11 -15
- package/{dist/utils/localization/translations/nb-NO-json.js → esm/utils/localization/translations/nb-NO.json} +31 -26
- package/{dist/utils/localization/translations/nl-json.js → esm/utils/localization/translations/nl.json} +11 -15
- package/{dist/utils/localization/translations/pl-json.js → esm/utils/localization/translations/pl.json} +11 -15
- package/{dist/utils/localization/translations/pt-BR-json.js → esm/utils/localization/translations/pt-BR.json} +11 -15
- package/{dist/utils/localization/translations/sk-SK-json.js → esm/utils/localization/translations/sk-SK.json} +31 -26
- package/{dist/utils/localization/translations/sv-json.js → esm/utils/localization/translations/sv.json} +11 -15
- package/{dist/utils/localization/translations/th-json.js → esm/utils/localization/translations/th.json} +11 -15
- package/{dist/utils/localization/translations/tr-json.js → esm/utils/localization/translations/tr.json} +11 -15
- package/{dist/utils/localization/translations/zh-Hans-json.js → esm/utils/localization/translations/zh-Hans.json} +11 -15
- package/{dist/utils/localization/translations/zh-TW-json.js → esm/utils/localization/translations/zh-TW.json} +11 -26
- package/esm/utils/localization/translationsDictionary.d.ts +2 -0
- package/esm/utils/localization/translationsDictionary.js +59 -0
- package/esm/utils/localization/useLanguage.js +1 -50
- package/package.json +17 -10
- package/dist/utils/localization/translations/cs-json.d.ts +0 -251
- package/dist/utils/localization/translations/da-DK-json.d.ts +0 -252
- package/dist/utils/localization/translations/de-json.d.ts +0 -251
- package/dist/utils/localization/translations/en-json.d.ts +0 -314
- package/dist/utils/localization/translations/en-json.js +0 -317
- package/dist/utils/localization/translations/es-json.d.ts +0 -251
- package/dist/utils/localization/translations/fi-FI-json.d.ts +0 -252
- package/dist/utils/localization/translations/fr-FR-json.d.ts +0 -250
- package/dist/utils/localization/translations/fr-json.d.ts +0 -251
- package/dist/utils/localization/translations/hu-HU-json.d.ts +0 -252
- package/dist/utils/localization/translations/id-json.d.ts +0 -252
- package/dist/utils/localization/translations/it-json.d.ts +0 -251
- package/dist/utils/localization/translations/ja-json.d.ts +0 -251
- package/dist/utils/localization/translations/ko-KR-json.d.ts +0 -258
- package/dist/utils/localization/translations/ms-json.d.ts +0 -251
- package/dist/utils/localization/translations/nb-NO-json.d.ts +0 -252
- package/dist/utils/localization/translations/nl-json.d.ts +0 -251
- package/dist/utils/localization/translations/pl-json.d.ts +0 -251
- package/dist/utils/localization/translations/pt-BR-json.d.ts +0 -251
- package/dist/utils/localization/translations/sk-SK-json.d.ts +0 -251
- package/dist/utils/localization/translations/sv-json.d.ts +0 -251
- package/dist/utils/localization/translations/th-json.d.ts +0 -251
- package/dist/utils/localization/translations/tr-json.d.ts +0 -251
- package/dist/utils/localization/translations/zh-Hans-json.d.ts +0 -251
- package/dist/utils/localization/translations/zh-TW-json.d.ts +0 -271
- package/esm/utils/localization/translations/cs-json.d.ts +0 -251
- package/esm/utils/localization/translations/da-DK-json.d.ts +0 -252
- package/esm/utils/localization/translations/de-json.d.ts +0 -251
- package/esm/utils/localization/translations/en-json.d.ts +0 -314
- package/esm/utils/localization/translations/en-json.js +0 -314
- package/esm/utils/localization/translations/es-json.d.ts +0 -251
- package/esm/utils/localization/translations/fi-FI-json.d.ts +0 -252
- package/esm/utils/localization/translations/fr-FR-json.d.ts +0 -250
- package/esm/utils/localization/translations/fr-json.d.ts +0 -251
- package/esm/utils/localization/translations/hu-HU-json.d.ts +0 -252
- package/esm/utils/localization/translations/id-json.d.ts +0 -252
- package/esm/utils/localization/translations/it-json.d.ts +0 -251
- package/esm/utils/localization/translations/ja-json.d.ts +0 -251
- package/esm/utils/localization/translations/ko-KR-json.d.ts +0 -258
- package/esm/utils/localization/translations/ms-json.d.ts +0 -251
- package/esm/utils/localization/translations/nb-NO-json.d.ts +0 -252
- package/esm/utils/localization/translations/nl-json.d.ts +0 -251
- package/esm/utils/localization/translations/pl-json.d.ts +0 -251
- package/esm/utils/localization/translations/pt-BR-json.d.ts +0 -251
- package/esm/utils/localization/translations/sk-SK-json.d.ts +0 -251
- package/esm/utils/localization/translations/sv-json.d.ts +0 -251
- package/esm/utils/localization/translations/th-json.d.ts +0 -251
- package/esm/utils/localization/translations/tr-json.d.ts +0 -251
- package/esm/utils/localization/translations/zh-Hans-json.d.ts +0 -251
- package/esm/utils/localization/translations/zh-TW-json.d.ts +0 -271
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { injectString } from "../utils/localization/translationsDictionary";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
3
|
import { ButtonIconPosition, TextIconButton } from "../textIconButton/textIconButton";
|
|
3
4
|
import { Button } from "../button/button";
|
|
@@ -27,246 +28,602 @@ import { FOCUSABLE_SELECTOR } from "../utils/focusableSelector";
|
|
|
27
28
|
import { parseLabel } from "./utils/parseLabel";
|
|
28
29
|
import { useFormFieldValues } from "../commonHelpers/hooks/useFormFieldValues/useFormFieldValues";
|
|
29
30
|
// eslint-disable-next-line complexity
|
|
30
|
-
|
|
31
|
+
injectString("cs", "Custom", "Vlastn\xED");
|
|
32
|
+
injectString("da-DK", "Custom", "Brugerdefineret");
|
|
33
|
+
injectString("de", "Custom", "Individuell");
|
|
34
|
+
injectString("en", "Custom", "Custom");
|
|
35
|
+
injectString("es", "Custom", "Personalizado");
|
|
36
|
+
injectString("fi-FI", "Custom", "Mukautettu");
|
|
37
|
+
injectString("fr", "Custom", "Personnalis\xE9e");
|
|
38
|
+
injectString("fr-FR", "Custom", "Personnalis\xE9");
|
|
39
|
+
injectString("hu-HU", "Custom", "Egy\xE9ni");
|
|
40
|
+
injectString("id", "Custom", "Kustom");
|
|
41
|
+
injectString("it", "Custom", "Personalizza");
|
|
42
|
+
injectString("ja", "Custom", "\u671F\u9593\u8A2D\u5B9A\u306E\u5909\u66F4");
|
|
43
|
+
injectString("ko-KR", "Custom", "\uC0AC\uC6A9\uC790 \uC9C0\uC815");
|
|
44
|
+
injectString("ms", "Custom", "Tersuai");
|
|
45
|
+
injectString("nb-NO", "Custom", "Egendefinert");
|
|
46
|
+
injectString("nl", "Custom", "Aangepast");
|
|
47
|
+
injectString("pl", "Custom", "Niestandardowy");
|
|
48
|
+
injectString("pt-BR", "Custom", "Personalizado");
|
|
49
|
+
injectString("sk-SK", "Custom", "Vlastn\xE9");
|
|
50
|
+
injectString("sv", "Custom", "Modifierad");
|
|
51
|
+
injectString("th", "Custom", "\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E40\u0E2D\u0E07");
|
|
52
|
+
injectString("tr", "Custom", "\xD6zel");
|
|
53
|
+
injectString("zh-Hans", "Custom", "\u5B9A\u5236");
|
|
54
|
+
injectString("zh-TW", "Custom", "\u81EA\u8A02");
|
|
55
|
+
injectString("cs", "Date range", "Rozmez\xED dat");
|
|
56
|
+
injectString("da-DK", "Date range", "Datointerval");
|
|
57
|
+
injectString("de", "Date range", "Datumsbereich");
|
|
58
|
+
injectString("en", "Date range", "Date range");
|
|
59
|
+
injectString("es", "Date range", "Intervalo de fechas");
|
|
60
|
+
injectString("fi-FI", "Date range", "P\xE4iv\xE4m\xE4\xE4r\xE4alue");
|
|
61
|
+
injectString("fr", "Date range", "Plage de dates");
|
|
62
|
+
injectString("fr-FR", "Date range", "Plage de dates");
|
|
63
|
+
injectString("hu-HU", "Date range", "Id\u0151tartom\xE1ny");
|
|
64
|
+
injectString("id", "Date range", "Rentang tanggal");
|
|
65
|
+
injectString("it", "Date range", "Intervallo di date");
|
|
66
|
+
injectString("ja", "Date range", "\u65E5\u4ED8\u7BC4\u56F2");
|
|
67
|
+
injectString("ko-KR", "Date range", "\uB0A0\uC9DC \uBC94\uC704");
|
|
68
|
+
injectString("ms", "Date range", "Julat tarikh");
|
|
69
|
+
injectString("nb-NO", "Date range", "Datoomr\xE5de");
|
|
70
|
+
injectString("nl", "Date range", "Datumbereik");
|
|
71
|
+
injectString("pl", "Date range", "Zakres dat");
|
|
72
|
+
injectString("pt-BR", "Date range", "Intervalo de datas");
|
|
73
|
+
injectString("sk-SK", "Date range", "Rozsah d\xE1tumov");
|
|
74
|
+
injectString("sv", "Date range", "Datumintervall");
|
|
75
|
+
injectString("th", "Date range", "\u0E0A\u0E48\u0E27\u0E07\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48");
|
|
76
|
+
injectString("tr", "Date range", "Tarih aral\u0131\u011F\u0131");
|
|
77
|
+
injectString("zh-Hans", "Date range", "\u65E5\u671F\u8303\u56F4");
|
|
78
|
+
injectString("zh-TW", "Date range", "\u65E5\u671F\u7BC4\u570D");
|
|
79
|
+
injectString("en", "Date range filter:", "Date range filter:");
|
|
80
|
+
injectString("cs", "Clear", "Vymazat");
|
|
81
|
+
injectString("da-DK", "Clear", "Ryd");
|
|
82
|
+
injectString("de", "Clear", "L\xF6schen");
|
|
83
|
+
injectString("en", "Clear", "Clear");
|
|
84
|
+
injectString("es", "Clear", "Borrar");
|
|
85
|
+
injectString("fi-FI", "Clear", "Tyhjenn\xE4");
|
|
86
|
+
injectString("fr", "Clear", "Effacer");
|
|
87
|
+
injectString("fr-FR", "Clear", "Effacer");
|
|
88
|
+
injectString("hu-HU", "Clear", "T\xF6r\xF6ld.");
|
|
89
|
+
injectString("id", "Clear", "Hapus");
|
|
90
|
+
injectString("it", "Clear", "Cancella");
|
|
91
|
+
injectString("ja", "Clear", "\u30AF\u30EA\u30A2");
|
|
92
|
+
injectString("ko-KR", "Clear", "\uC9C0\uC6B0\uAE30");
|
|
93
|
+
injectString("ms", "Clear", "Kosongkan");
|
|
94
|
+
injectString("nb-NO", "Clear", "T\xF8m");
|
|
95
|
+
injectString("nl", "Clear", "Wissen");
|
|
96
|
+
injectString("pl", "Clear", "Wyczy\u015B\u0107");
|
|
97
|
+
injectString("pt-BR", "Clear", "Limpar");
|
|
98
|
+
injectString("sk-SK", "Clear", "Vyma\u017E");
|
|
99
|
+
injectString("sv", "Clear", "Rensa");
|
|
100
|
+
injectString("th", "Clear", "\u0E25\u0E49\u0E32\u0E07");
|
|
101
|
+
injectString("tr", "Clear", "Temizle");
|
|
102
|
+
injectString("zh-Hans", "Clear", "\u6E05\u9664");
|
|
103
|
+
injectString("zh-TW", "Clear", "\u6E05\u9664");
|
|
104
|
+
injectString("cs", "Cancel", "Zru\u0161it");
|
|
105
|
+
injectString("da-DK", "Cancel", "Annuller");
|
|
106
|
+
injectString("de", "Cancel", "Abbrechen");
|
|
107
|
+
injectString("en", "Cancel", "Cancel");
|
|
108
|
+
injectString("es", "Cancel", "Cancelar");
|
|
109
|
+
injectString("fi-FI", "Cancel", "Peruuta");
|
|
110
|
+
injectString("fr", "Cancel", "Annuler");
|
|
111
|
+
injectString("fr-FR", "Cancel", "Annuler");
|
|
112
|
+
injectString("hu-HU", "Cancel", "M\xE9gse");
|
|
113
|
+
injectString("id", "Cancel", "Batalkan");
|
|
114
|
+
injectString("it", "Cancel", "Annullare");
|
|
115
|
+
injectString("ja", "Cancel", "\u30AD\u30E3\u30F3\u30BB\u30EB");
|
|
116
|
+
injectString("ko-KR", "Cancel", "\uCDE8\uC18C");
|
|
117
|
+
injectString("ms", "Cancel", "Batal");
|
|
118
|
+
injectString("nb-NO", "Cancel", "Avbryt");
|
|
119
|
+
injectString("nl", "Cancel", "Annuleren");
|
|
120
|
+
injectString("pl", "Cancel", "Anuluj");
|
|
121
|
+
injectString("pt-BR", "Cancel", "Cancelar");
|
|
122
|
+
injectString("sk-SK", "Cancel", "Zru\u0161.");
|
|
123
|
+
injectString("sv", "Cancel", "Avbryt");
|
|
124
|
+
injectString("th", "Cancel", "\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01");
|
|
125
|
+
injectString("tr", "Cancel", "\u0130ptal");
|
|
126
|
+
injectString("zh-Hans", "Cancel", "\u53D6\u6D88");
|
|
127
|
+
injectString("zh-TW", "Cancel", "\u53D6\u6D88");
|
|
128
|
+
injectString("cs", "Apply", "Pou\u017E\xEDt");
|
|
129
|
+
injectString("da-DK", "Apply", "Anvend");
|
|
130
|
+
injectString("de", "Apply", "Anwenden");
|
|
131
|
+
injectString("en", "Apply", "Apply");
|
|
132
|
+
injectString("es", "Apply", "Aplicar");
|
|
133
|
+
injectString("fi-FI", "Apply", "K\xE4yt\xE4");
|
|
134
|
+
injectString("fr", "Apply", "Appliquer");
|
|
135
|
+
injectString("fr-FR", "Apply", "Appliquer");
|
|
136
|
+
injectString("hu-HU", "Apply", "Alkalmazd.");
|
|
137
|
+
injectString("id", "Apply", "Terapkan");
|
|
138
|
+
injectString("it", "Apply", "Applicare");
|
|
139
|
+
injectString("ja", "Apply", "\u9069\u7528");
|
|
140
|
+
injectString("ko-KR", "Apply", "\uC801\uC6A9");
|
|
141
|
+
injectString("ms", "Apply", "Gunakan");
|
|
142
|
+
injectString("nb-NO", "Apply", "Bruk");
|
|
143
|
+
injectString("nl", "Apply", "Toepassen");
|
|
144
|
+
injectString("pl", "Apply", "Zastosuj");
|
|
145
|
+
injectString("pt-BR", "Apply", "Aplicar");
|
|
146
|
+
injectString("sk-SK", "Apply", "Pou\u017Ei");
|
|
147
|
+
injectString("sv", "Apply", "Ans\xF6k");
|
|
148
|
+
injectString("th", "Apply", "\u0E43\u0E0A\u0E49");
|
|
149
|
+
injectString("tr", "Apply", "Uygula");
|
|
150
|
+
injectString("zh-Hans", "Apply", "\u5E94\u7528");
|
|
151
|
+
injectString("zh-TW", "Apply", "\u5957\u7528");
|
|
152
|
+
injectString("cs", "Previous", "P\u0159edchoz\xED");
|
|
153
|
+
injectString("da-DK", "Previous", "Forrige");
|
|
154
|
+
injectString("de", "Previous", "Vorherige");
|
|
155
|
+
injectString("en", "Previous", "Previous");
|
|
156
|
+
injectString("es", "Previous", "Anterior");
|
|
157
|
+
injectString("fi-FI", "Previous", "Edellinen");
|
|
158
|
+
injectString("fr", "Previous", "Pr\xE9c\xE9dent");
|
|
159
|
+
injectString("fr-FR", "Previous", "Pr\xE9c\xE9dent");
|
|
160
|
+
injectString("hu-HU", "Previous", "El\u0151z\u0151");
|
|
161
|
+
injectString("id", "Previous", "Sebelumnya");
|
|
162
|
+
injectString("it", "Previous", "Indietro");
|
|
163
|
+
injectString("ja", "Previous", "\u524D");
|
|
164
|
+
injectString("ko-KR", "Previous", "\uC774\uC804\uC758");
|
|
165
|
+
injectString("ms", "Previous", "Sebelumnya");
|
|
166
|
+
injectString("nb-NO", "Previous", "Tidligere");
|
|
167
|
+
injectString("nl", "Previous", "Vorige");
|
|
168
|
+
injectString("pl", "Previous", "Poprzednie");
|
|
169
|
+
injectString("pt-BR", "Previous", "Anterior");
|
|
170
|
+
injectString("sk-SK", "Previous", "Predch\xE1dzaj\xFAci");
|
|
171
|
+
injectString("sv", "Previous", "F\xF6reg\xE5ende");
|
|
172
|
+
injectString("th", "Previous", "\u0E01\u0E48\u0E2D\u0E19\u0E2B\u0E19\u0E49\u0E32");
|
|
173
|
+
injectString("tr", "Previous", "\xD6nceki");
|
|
174
|
+
injectString("zh-Hans", "Previous", "\u524D\u4E00");
|
|
175
|
+
injectString("zh-TW", "Previous", "\u4E0A\u4E00\u500B");
|
|
176
|
+
injectString("cs", "Next", "Dal\u0161\xED");
|
|
177
|
+
injectString("da-DK", "Next", "N\xE6ste");
|
|
178
|
+
injectString("de", "Next", "N\xE4chstes");
|
|
179
|
+
injectString("en", "Next", "Next");
|
|
180
|
+
injectString("es", "Next", "Siguiente");
|
|
181
|
+
injectString("fi-FI", "Next", "Seuraava");
|
|
182
|
+
injectString("fr", "Next", "Suivant");
|
|
183
|
+
injectString("fr-FR", "Next", "Suivant");
|
|
184
|
+
injectString("hu-HU", "Next", "K\xF6vetkez\u0151");
|
|
185
|
+
injectString("id", "Next", "Berikutnya");
|
|
186
|
+
injectString("it", "Next", "Avanti");
|
|
187
|
+
injectString("ja", "Next", "\u6B21\u306E");
|
|
188
|
+
injectString("ko-KR", "Next", "\uB2E4\uC74C");
|
|
189
|
+
injectString("ms", "Next", "Seterusnya");
|
|
190
|
+
injectString("nb-NO", "Next", "Neste");
|
|
191
|
+
injectString("nl", "Next", "Volgende");
|
|
192
|
+
injectString("pl", "Next", "Nast\u0119pne");
|
|
193
|
+
injectString("pt-BR", "Next", "Avan\xE7ar");
|
|
194
|
+
injectString("sk-SK", "Next", "\u010Eal\u0161\xED");
|
|
195
|
+
injectString("sv", "Next", "N\xE4sta");
|
|
196
|
+
injectString("th", "Next", "\u0E16\u0E31\u0E14\u0E44\u0E1B");
|
|
197
|
+
injectString("tr", "Next", "Sonraki");
|
|
198
|
+
injectString("zh-Hans", "Next", "\u4E0B\u4E00\u4E2A");
|
|
199
|
+
injectString("zh-TW", "Next", "\u4E0B\u4E00\u6B65");
|
|
200
|
+
export const DateRangeRaw = props => {
|
|
201
|
+
var _a;
|
|
202
|
+
const {
|
|
203
|
+
className,
|
|
204
|
+
classNamePopup,
|
|
205
|
+
options: optionsArg,
|
|
206
|
+
type,
|
|
207
|
+
id,
|
|
208
|
+
defaultValue,
|
|
209
|
+
dropDownTitle,
|
|
210
|
+
hasApplyButton,
|
|
211
|
+
disableFutureDates,
|
|
212
|
+
disablePastDates,
|
|
213
|
+
disableDatesBefore,
|
|
214
|
+
triggerLabel,
|
|
215
|
+
disableDatesAfter,
|
|
216
|
+
withCalendar,
|
|
217
|
+
lockStartDate,
|
|
218
|
+
lockEndDate,
|
|
219
|
+
timeSelect,
|
|
220
|
+
allowUnsetValue = false,
|
|
221
|
+
stepper = false,
|
|
222
|
+
classNameWrapper,
|
|
223
|
+
isReadOnly,
|
|
224
|
+
error,
|
|
225
|
+
chip,
|
|
226
|
+
chipId,
|
|
227
|
+
chipName,
|
|
228
|
+
chipIcon
|
|
229
|
+
} = props;
|
|
230
|
+
const {
|
|
231
|
+
value,
|
|
232
|
+
name,
|
|
233
|
+
disabled,
|
|
234
|
+
onChange,
|
|
235
|
+
onBlur
|
|
236
|
+
} = useFormFieldValues(props.controller, props);
|
|
237
|
+
const {
|
|
238
|
+
translate
|
|
239
|
+
} = useLanguage();
|
|
240
|
+
const isMobile = useMobile();
|
|
241
|
+
const isDrive = useDrive();
|
|
242
|
+
const chipStatus = useChipStatus();
|
|
243
|
+
const driveWrapperTriggerClassName = useDriveClassName("zen-date-range-wrapper");
|
|
244
|
+
const drivePopupClassName = useDriveClassName("zen-date-range-popup");
|
|
245
|
+
const driveWrapperPopupClassName = useDriveClassName("zen-date-range-popup-wrapper");
|
|
246
|
+
const [showMobileCalendar, setShowMobileCalendar] = useState(false);
|
|
247
|
+
const {
|
|
248
|
+
dateFormat,
|
|
249
|
+
toLocalDateTime,
|
|
250
|
+
toReverseOffsetDateTime,
|
|
251
|
+
weekStartsOnSunday
|
|
252
|
+
} = useContext(userFormatContext);
|
|
253
|
+
const optionsMap = useMemo(() => getOptionsPeriodMap(optionsArg, translate, toLocalDateTime, weekStartsOnSunday ? "Sunday" : "Monday", toReverseOffsetDateTime), [optionsArg, toLocalDateTime, toReverseOffsetDateTime, translate, weekStartsOnSunday]);
|
|
254
|
+
const previousStepOption = useRef("");
|
|
255
|
+
const [selectedRange, setSelectedRange] = useState(getSelectedRangeFromValue(optionsMap, value));
|
|
256
|
+
const mobileContentRef = useRef(null);
|
|
257
|
+
const isCustomDateOption = (selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label) === CUSTOM_CALENDAR_ID;
|
|
258
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
259
|
+
const prevIsOpenRef = useRef(false);
|
|
260
|
+
const [customDate, setCustomDate] = useState(normalizeDates(value === null || value === void 0 ? void 0 : value.from.toISOString(), value === null || value === void 0 ? void 0 : value.to.toISOString(), disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter));
|
|
261
|
+
const isDefaultState = !defaultValue && !selectedRange || defaultValue && selectedRange && defaultValue.label === selectedRange.label && defaultValue.label !== CUSTOM_CALENDAR_ID || defaultValue && selectedRange && defaultValue.label === selectedRange.label && defaultValue.label === CUSTOM_CALENDAR_ID && customDate.from && customDate.to && new Date(customDate.from).toISOString() === defaultValue.from.toISOString() && new Date(customDate.to).toISOString() === defaultValue.to.toISOString();
|
|
262
|
+
const triggerRef = useRef(null);
|
|
263
|
+
const [prevSelection, setPrevSelection] = useState(getSelectedRangeFromValue(optionsMap, value));
|
|
264
|
+
const componentId = useUniqueId();
|
|
265
|
+
const calendarLabel = translate("Custom");
|
|
266
|
+
const getCustomRange = useCallback(() => ({
|
|
267
|
+
from: (prevSelection === null || prevSelection === void 0 ? void 0 : prevSelection.from) || new Date(),
|
|
268
|
+
to: (prevSelection === null || prevSelection === void 0 ? void 0 : prevSelection.to) || new Date()
|
|
269
|
+
}), [prevSelection]);
|
|
270
|
+
const options = useMemo(() => getRangeOptionsArray(optionsArg, translate, toLocalDateTime, weekStartsOnSunday ? "Sunday" : "Monday", toReverseOffsetDateTime, withCalendar || false, prevSelection && prevSelection.label === CUSTOM_CALENDAR_ID, prevSelection ? getCustomRange : undefined), [optionsArg, translate, toLocalDateTime, weekStartsOnSunday, toReverseOffsetDateTime, withCalendar, prevSelection, getCustomRange]);
|
|
271
|
+
const optionsMapRef = useRef(optionsMap);
|
|
272
|
+
const isEqualMaps = useMemo(() => areMapsEqual(optionsMapRef.current, optionsMap), [optionsMap]);
|
|
273
|
+
if (!isEqualMaps) {
|
|
274
|
+
optionsMapRef.current = optionsMap;
|
|
275
|
+
}
|
|
276
|
+
const hasCustomOption = useMemo(() => options.find(option => option.id === CUSTOM_CALENDAR_ID) !== undefined, [options]);
|
|
277
|
+
const title = useMemo(() => dropDownTitle || translate("Date range"), [dropDownTitle, translate]);
|
|
278
|
+
const toggleVisibility = useCallback(() => setIsOpen(currentIsOpen => !currentIsOpen), []);
|
|
279
|
+
const getButtonLabel = useCallback((rangeValue, titleText) => {
|
|
280
|
+
if (!rangeValue) {
|
|
281
|
+
return translate("Date range");
|
|
282
|
+
}
|
|
283
|
+
const val = rangeValue.label;
|
|
284
|
+
const selection = options.find(option => option.id === val);
|
|
285
|
+
if (selection && val !== CUSTOM_CALENDAR_ID) {
|
|
286
|
+
return titleText ? `${translate("Date range filter:")} ${selection.label}` : selection.label;
|
|
287
|
+
}
|
|
288
|
+
return titleText ? `${translate("Date range filter:")} ${parseLabel(rangeValue, dateFormat, translate, toLocalDateTime)}` : parseLabel(rangeValue, dateFormat, translate, toLocalDateTime);
|
|
289
|
+
}, [dateFormat, options, translate, toLocalDateTime]);
|
|
290
|
+
useEffect(() => {
|
|
291
|
+
const currentValue = getSelectedRangeFromValue(optionsMap, value);
|
|
292
|
+
if ((prevSelection === null || prevSelection === void 0 ? void 0 : prevSelection.label) !== (currentValue === null || currentValue === void 0 ? void 0 : currentValue.label) || (prevSelection === null || prevSelection === void 0 ? void 0 : prevSelection.from.getTime()) !== (currentValue === null || currentValue === void 0 ? void 0 : currentValue.from.getTime()) || (prevSelection === null || prevSelection === void 0 ? void 0 : prevSelection.to.getTime()) !== (currentValue === null || currentValue === void 0 ? void 0 : currentValue.to.getTime())) {
|
|
293
|
+
setSelectedRange(currentValue);
|
|
294
|
+
setPrevSelection(currentValue);
|
|
295
|
+
}
|
|
296
|
+
}, [optionsMap, prevSelection === null || prevSelection === void 0 ? void 0 : prevSelection.from, prevSelection === null || prevSelection === void 0 ? void 0 : prevSelection.label, prevSelection === null || prevSelection === void 0 ? void 0 : prevSelection.to, value]);
|
|
297
|
+
const handleDateRangeSelection = useCallback(newVal => {
|
|
298
|
+
var _a, _b;
|
|
299
|
+
const selection = options.find(option => option.id === newVal);
|
|
300
|
+
newVal === CUSTOM_CALENDAR_ID && setShowMobileCalendar(true);
|
|
301
|
+
if (selection && newVal !== CUSTOM_CALENDAR_ID && selection.getRange) {
|
|
302
|
+
const range = selection.getRange();
|
|
303
|
+
const normalizedDates = normalizeDates(range.from.toISOString(), range.to.toISOString(), disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter);
|
|
304
|
+
const newRange = newVal === CUSTOM_CALENDAR_ID ? {
|
|
305
|
+
from: new Date(normalizedDates.from),
|
|
306
|
+
to: new Date(normalizedDates.to)
|
|
307
|
+
} : range;
|
|
308
|
+
setSelectedRange(Object.assign({
|
|
309
|
+
label: selection.id
|
|
310
|
+
}, newRange));
|
|
311
|
+
!hasApplyButton && setPrevSelection(Object.assign({
|
|
312
|
+
label: selection.id
|
|
313
|
+
}, newRange));
|
|
314
|
+
!hasApplyButton && (onChange === null || onChange === void 0 ? void 0 : onChange(Object.assign({
|
|
315
|
+
label: selection.id
|
|
316
|
+
}, newRange)));
|
|
317
|
+
previousStepOption.current = "";
|
|
318
|
+
} else {
|
|
319
|
+
const startDateForNormalize = ((_a = selection === null || selection === void 0 ? void 0 : selection.getRange) === null || _a === void 0 ? void 0 : _a.call(selection)) && (selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label) !== newVal ? selection.getRange().from.toISOString() : value === null || value === void 0 ? void 0 : value.from.toISOString();
|
|
320
|
+
const endDateForNormalize = ((_b = selection === null || selection === void 0 ? void 0 : selection.getRange) === null || _b === void 0 ? void 0 : _b.call(selection)) && (selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label) !== newVal ? selection.getRange().to.toISOString() : value === null || value === void 0 ? void 0 : value.to.toISOString();
|
|
321
|
+
const normalizedDates = normalizeDates(startDateForNormalize, endDateForNormalize, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter);
|
|
322
|
+
const newRange = newVal === CUSTOM_CALENDAR_ID ? {
|
|
323
|
+
from: new Date(normalizedDates.from),
|
|
324
|
+
to: new Date(normalizedDates.to)
|
|
325
|
+
} : undefined;
|
|
326
|
+
const newValueFrom = (newRange === null || newRange === void 0 ? void 0 : newRange.from) || new Date();
|
|
327
|
+
const newValueTo = (newRange === null || newRange === void 0 ? void 0 : newRange.to) || new Date();
|
|
328
|
+
setSelectedRange({
|
|
329
|
+
label: newVal,
|
|
330
|
+
from: newValueFrom,
|
|
331
|
+
to: newValueTo
|
|
332
|
+
});
|
|
333
|
+
setCustomDate(normalizedDates);
|
|
334
|
+
!hasApplyButton && (onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
335
|
+
label: newVal,
|
|
336
|
+
from: newValueFrom,
|
|
337
|
+
to: newValueTo
|
|
338
|
+
}));
|
|
339
|
+
}
|
|
340
|
+
!hasApplyButton && newVal !== CUSTOM_CALENDAR_ID && setIsOpen(false);
|
|
341
|
+
}, [options, hasApplyButton, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter, onChange, selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label, value === null || value === void 0 ? void 0 : value.from, value === null || value === void 0 ? void 0 : value.to]);
|
|
342
|
+
const handleRangeSelection = useCallback(() => {
|
|
343
|
+
if (selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label) {
|
|
344
|
+
const newState = {
|
|
345
|
+
label: selectedRange.label,
|
|
346
|
+
from: new Date(customDate.from),
|
|
347
|
+
to: new Date(customDate.to)
|
|
348
|
+
};
|
|
349
|
+
setPrevSelection(newState);
|
|
350
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newState);
|
|
351
|
+
setSelectedRange(newState);
|
|
352
|
+
setIsOpen(false);
|
|
353
|
+
}
|
|
354
|
+
}, [selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label, customDate.from, customDate.to, onChange]);
|
|
355
|
+
const handleApplyClick = useCallback(() => {
|
|
356
|
+
setIsOpen(false);
|
|
357
|
+
setShowMobileCalendar(false);
|
|
358
|
+
if (isCustomDateOption) {
|
|
359
|
+
handleRangeSelection();
|
|
360
|
+
previousStepOption.current = "";
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
selectedRange && (onChange === null || onChange === void 0 ? void 0 : onChange(selectedRange));
|
|
364
|
+
selectedRange && setPrevSelection(selectedRange);
|
|
365
|
+
}, [handleRangeSelection, isCustomDateOption, onChange, selectedRange]);
|
|
366
|
+
const handleCancelClick = useCallback(() => {
|
|
367
|
+
hasApplyButton && prevSelection && handleDateRangeSelection(prevSelection.label);
|
|
368
|
+
setCustomDate({
|
|
369
|
+
from: prevSelection === null || prevSelection === void 0 ? void 0 : prevSelection.from.toISOString(),
|
|
370
|
+
to: prevSelection === null || prevSelection === void 0 ? void 0 : prevSelection.to.toISOString()
|
|
371
|
+
});
|
|
372
|
+
setIsOpen(!isOpen);
|
|
373
|
+
setShowMobileCalendar(false);
|
|
374
|
+
}, [handleDateRangeSelection, prevSelection, isOpen, hasApplyButton]);
|
|
375
|
+
const handleClearClick = useCallback(() => {
|
|
376
|
+
//* @ts-expect-error: Let's ignore a compile error. if onChange is triggered, then either a value is passed to the function, or undefined can be passed because the interface is IDateRangeUnsetValue
|
|
377
|
+
!hasApplyButton && (defaultValue || allowUnsetValue) && (onChange === null || onChange === void 0 ? void 0 : onChange(defaultValue));
|
|
378
|
+
!hasApplyButton && setIsOpen(false);
|
|
379
|
+
setSelectedRange(defaultValue);
|
|
380
|
+
previousStepOption.current = "";
|
|
381
|
+
(defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.label) === CUSTOM_CALENDAR_ID && !allowUnsetValue && setCustomDate({
|
|
382
|
+
from: defaultValue.from.toISOString(),
|
|
383
|
+
to: defaultValue.to.toISOString()
|
|
384
|
+
});
|
|
385
|
+
setShowMobileCalendar(false);
|
|
386
|
+
}, [allowUnsetValue, defaultValue, hasApplyButton, onChange]);
|
|
387
|
+
const handleMobileBackClick = useCallback(() => {
|
|
388
|
+
setShowMobileCalendar(false);
|
|
389
|
+
}, []);
|
|
390
|
+
const handleStepperClick = useCallback((currentRange, isIncrease) => {
|
|
391
|
+
let step = previousStepOption.current ? previousStepOption.current : getDateRangeAdjustedStep(translate, currentRange.label);
|
|
392
|
+
if (previousStepOption.current === "") {
|
|
393
|
+
previousStepOption.current = step;
|
|
394
|
+
} else if (previousStepOption.current !== DEFAULT_STEP_OPTION) {
|
|
395
|
+
step = previousStepOption.current;
|
|
396
|
+
}
|
|
397
|
+
const adjustFn = dateRangeAdjustedFn[step];
|
|
398
|
+
const newValue = adjustFn(currentRange, isIncrease, toLocalDateTime, toReverseOffsetDateTime);
|
|
399
|
+
const labeledValue = getSelectedRangeFromValue(optionsMap, newValue);
|
|
400
|
+
labeledValue && (onChange === null || onChange === void 0 ? void 0 : onChange(labeledValue));
|
|
401
|
+
}, [onChange, optionsMap, toLocalDateTime, toReverseOffsetDateTime, translate]);
|
|
402
|
+
useEffect(() => {
|
|
403
|
+
setCustomDate({
|
|
404
|
+
from: value === null || value === void 0 ? void 0 : value.from.toISOString(),
|
|
405
|
+
to: value === null || value === void 0 ? void 0 : value.to.toISOString()
|
|
406
|
+
});
|
|
407
|
+
const currentValue = getSelectedRangeFromValue(optionsMapRef.current, value);
|
|
408
|
+
setPrevSelection(currentValue);
|
|
409
|
+
}, [value, isEqualMaps]);
|
|
410
|
+
const range = useMemo(() => ({
|
|
411
|
+
from: customDate.from,
|
|
412
|
+
to: customDate.to
|
|
413
|
+
}), [customDate.from, customDate.to]);
|
|
414
|
+
const component = useMemo(() => _jsx(DateRangeInner, {
|
|
415
|
+
id: id || componentId,
|
|
416
|
+
options: options,
|
|
417
|
+
onOptionSelect: handleDateRangeSelection,
|
|
418
|
+
onCalendarSelect: hasCustomOption ? val => {
|
|
419
|
+
setCustomDate({
|
|
420
|
+
from: lockStartDate || val.from,
|
|
421
|
+
to: lockEndDate || (lockStartDate ? val.to || val.from : val.to)
|
|
422
|
+
});
|
|
423
|
+
} : undefined,
|
|
424
|
+
selection: selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label,
|
|
425
|
+
range: range,
|
|
426
|
+
timeSelect: timeSelect,
|
|
427
|
+
disableFutureDates: disableFutureDates,
|
|
428
|
+
disablePastDates: disablePastDates,
|
|
429
|
+
disableDatesBefore: disableDatesBefore,
|
|
430
|
+
disableDatesAfter: disableDatesAfter,
|
|
431
|
+
showMobileCalendar: isMobile ? showMobileCalendar : undefined,
|
|
432
|
+
setShowMobileCalendar: isMobile ? setShowMobileCalendar : undefined
|
|
433
|
+
}), [id, componentId, options, handleDateRangeSelection, hasCustomOption, selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label, range, timeSelect, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter, isMobile, showMobileCalendar, lockStartDate, lockEndDate]);
|
|
434
|
+
const memoizedHandleClose = useCallback(() => {
|
|
435
|
+
setIsOpen(false);
|
|
436
|
+
}, [setIsOpen]);
|
|
437
|
+
const onReadyForFocus = useCallback(isCurrentOpen => {
|
|
31
438
|
var _a;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
439
|
+
if (!isMobile) {
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
if (isCurrentOpen) {
|
|
443
|
+
const focusableElement = (_a = mobileContentRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(FOCUSABLE_SELECTOR);
|
|
444
|
+
focusableElement === null || focusableElement === void 0 ? void 0 : focusableElement.focus();
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
prevIsOpenRef.current = isCurrentOpen;
|
|
448
|
+
}, [isMobile, mobileContentRef]);
|
|
449
|
+
const isValueNotChanged = useMemo(() => {
|
|
450
|
+
if (!hasApplyButton) {
|
|
451
|
+
return false;
|
|
452
|
+
}
|
|
453
|
+
if (!isCustomDateOption) {
|
|
454
|
+
return (selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label) === (value === null || value === void 0 ? void 0 : value.label);
|
|
455
|
+
}
|
|
456
|
+
return selectedRange.label === (value === null || value === void 0 ? void 0 : value.label) && customDate.from === value.from.toISOString() && customDate.to === value.to.toISOString();
|
|
457
|
+
}, [customDate.from, customDate.to, hasApplyButton, isCustomDateOption, selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label, value === null || value === void 0 ? void 0 : value.from, value === null || value === void 0 ? void 0 : value.label, value === null || value === void 0 ? void 0 : value.to]);
|
|
458
|
+
const memoizedDesktopView = useMemo(() => _jsx(ControlledPopup, {
|
|
459
|
+
className: classNames(["zen-date-range-popup-wrapper", driveWrapperPopupClassName || ""]),
|
|
460
|
+
ariaLabel: translate("Date range"),
|
|
461
|
+
useTrapFocusWithTrigger: "on",
|
|
462
|
+
role: "dialog",
|
|
463
|
+
triggerRef: triggerRef,
|
|
464
|
+
onOpenChange: setIsOpen,
|
|
465
|
+
shouldHoldScroll: true,
|
|
466
|
+
isOpen: isOpen,
|
|
467
|
+
recalculateOnScroll: true,
|
|
468
|
+
children: _jsxs("div", {
|
|
469
|
+
className: classNames(["zen-date-range-popup", drivePopupClassName || "", classNamePopup !== null && classNamePopup !== void 0 ? classNamePopup : ""]),
|
|
470
|
+
children: [_jsx("div", {
|
|
471
|
+
className: "zen-date-range-popup__header",
|
|
472
|
+
children: title
|
|
473
|
+
}), component, _jsxs("div", {
|
|
474
|
+
className: "zen-date-range-popup__footer",
|
|
475
|
+
children: [_jsx(Button, {
|
|
476
|
+
className: "zen-date-range-popup__button-clear",
|
|
477
|
+
type: ButtonType.Tertiary,
|
|
478
|
+
disabled: !!isDefaultState,
|
|
479
|
+
onClick: handleClearClick,
|
|
480
|
+
children: translate("Clear")
|
|
481
|
+
}), !isCustomDateOption && hasApplyButton && _jsx(Button, {
|
|
482
|
+
className: "zen-date-range-popup__button-reset",
|
|
483
|
+
type: ButtonType.Secondary,
|
|
484
|
+
onClick: handleCancelClick,
|
|
485
|
+
children: translate("Cancel")
|
|
486
|
+
}), (isCustomDateOption || hasApplyButton) && _jsx(Button, {
|
|
487
|
+
className: "zen-date-range-popup__button-apply",
|
|
488
|
+
type: ButtonType.Primary,
|
|
489
|
+
disabled: isCustomDateOption && (!customDate.from || !customDate.to) || isValueNotChanged || !selectedRange,
|
|
490
|
+
onClick: handleApplyClick,
|
|
491
|
+
children: translate("Apply")
|
|
492
|
+
})]
|
|
493
|
+
})]
|
|
494
|
+
})
|
|
495
|
+
}), [classNamePopup, component, customDate.from, customDate.to, drivePopupClassName, driveWrapperPopupClassName, handleApplyClick, handleCancelClick, handleClearClick, hasApplyButton, isCustomDateOption, isDefaultState, isOpen, isValueNotChanged, selectedRange, title, translate]);
|
|
496
|
+
const memoizedMobileFooter = useMemo(() => {
|
|
497
|
+
const clearButton = _jsx(Button, {
|
|
498
|
+
type: ButtonType.Tertiary,
|
|
499
|
+
disabled: !!isDefaultState,
|
|
500
|
+
onClick: handleClearClick,
|
|
501
|
+
children: translate("Clear")
|
|
502
|
+
});
|
|
503
|
+
const cancelButton = hasApplyButton && !showMobileCalendar ? _jsx(Button, {
|
|
504
|
+
type: ButtonType.Secondary,
|
|
505
|
+
onClick: handleCancelClick,
|
|
506
|
+
children: translate("Cancel")
|
|
507
|
+
}) : null;
|
|
508
|
+
const applyButton = showMobileCalendar || hasApplyButton ? _jsx(Button, {
|
|
509
|
+
type: ButtonType.Primary,
|
|
510
|
+
disabled: isCustomDateOption && (!customDate.from || !customDate.to) || isValueNotChanged || !selectedRange,
|
|
511
|
+
onClick: handleApplyClick,
|
|
512
|
+
children: translate("Apply")
|
|
513
|
+
}) : null;
|
|
514
|
+
return _jsxs(FooterButtons, {
|
|
515
|
+
children: [applyButton, cancelButton, clearButton]
|
|
516
|
+
});
|
|
517
|
+
}, [customDate.from, customDate.to, handleApplyClick, handleCancelClick, handleClearClick, hasApplyButton, isCustomDateOption, isDefaultState, isValueNotChanged, selectedRange, showMobileCalendar, translate]);
|
|
518
|
+
const memoizedMobileView = useMemo(() => _jsxs(MobileSheet, {
|
|
519
|
+
className: classNames(["zen-date-range-mobile-sheet", classNamePopup ? `${classNamePopup}--mobile-sheet` : ""]),
|
|
520
|
+
label: translate("Date range"),
|
|
521
|
+
triggerRef: triggerRef,
|
|
522
|
+
isOpen: isOpen,
|
|
523
|
+
onHidePanel: memoizedHandleClose,
|
|
524
|
+
onCloseClick: memoizedHandleClose,
|
|
525
|
+
useTrapFocusWithTrigger: false,
|
|
526
|
+
preventFirstFocus: true,
|
|
527
|
+
isBackVisible: showMobileCalendar,
|
|
528
|
+
onBackClick: handleMobileBackClick,
|
|
529
|
+
onReadyForFocus: onReadyForFocus,
|
|
530
|
+
children: [_jsx(MobileSheet.Title, {
|
|
531
|
+
children: showMobileCalendar ? calendarLabel : title
|
|
532
|
+
}), _jsx(MobileSheet.Content, {
|
|
533
|
+
children: _jsx("div", {
|
|
534
|
+
ref: mobileContentRef,
|
|
535
|
+
children: component
|
|
536
|
+
})
|
|
537
|
+
}), _jsx(MobileSheet.Footer, {
|
|
538
|
+
children: memoizedMobileFooter
|
|
539
|
+
})]
|
|
540
|
+
}), [calendarLabel, classNamePopup, component, handleMobileBackClick, isOpen, memoizedHandleClose, memoizedMobileFooter, onReadyForFocus, showMobileCalendar, title, translate, mobileContentRef]);
|
|
541
|
+
const checkIsRangeDisable = useCallback(isIncrease => {
|
|
542
|
+
if (!selectedRange) {
|
|
543
|
+
return true;
|
|
65
544
|
}
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
setPrevSelection(currentValue);
|
|
85
|
-
}
|
|
86
|
-
}, [optionsMap, prevSelection === null || prevSelection === void 0 ? void 0 : prevSelection.from, prevSelection === null || prevSelection === void 0 ? void 0 : prevSelection.label, prevSelection === null || prevSelection === void 0 ? void 0 : prevSelection.to, value]);
|
|
87
|
-
const handleDateRangeSelection = useCallback((newVal) => {
|
|
88
|
-
var _a, _b;
|
|
89
|
-
const selection = options.find(option => option.id === newVal);
|
|
90
|
-
newVal === CUSTOM_CALENDAR_ID && setShowMobileCalendar(true);
|
|
91
|
-
if (selection && newVal !== CUSTOM_CALENDAR_ID && selection.getRange) {
|
|
92
|
-
const range = selection.getRange();
|
|
93
|
-
const normalizedDates = normalizeDates(range.from.toISOString(), range.to.toISOString(), disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter);
|
|
94
|
-
const newRange = newVal === CUSTOM_CALENDAR_ID ?
|
|
95
|
-
{ from: new Date(normalizedDates.from), to: new Date(normalizedDates.to) }
|
|
96
|
-
: range;
|
|
97
|
-
setSelectedRange(Object.assign({ label: selection.id }, newRange));
|
|
98
|
-
!hasApplyButton && setPrevSelection(Object.assign({ label: selection.id }, newRange));
|
|
99
|
-
!hasApplyButton && (onChange === null || onChange === void 0 ? void 0 : onChange(Object.assign({ label: selection.id }, newRange)));
|
|
100
|
-
previousStepOption.current = "";
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
const startDateForNormalize = ((_a = selection === null || selection === void 0 ? void 0 : selection.getRange) === null || _a === void 0 ? void 0 : _a.call(selection)) && (selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label) !== newVal ? selection.getRange().from.toISOString() : value === null || value === void 0 ? void 0 : value.from.toISOString();
|
|
104
|
-
const endDateForNormalize = ((_b = selection === null || selection === void 0 ? void 0 : selection.getRange) === null || _b === void 0 ? void 0 : _b.call(selection)) && (selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label) !== newVal ? selection.getRange().to.toISOString() : value === null || value === void 0 ? void 0 : value.to.toISOString();
|
|
105
|
-
const normalizedDates = normalizeDates(startDateForNormalize, endDateForNormalize, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter);
|
|
106
|
-
const newRange = newVal === CUSTOM_CALENDAR_ID ?
|
|
107
|
-
{ from: new Date(normalizedDates.from), to: new Date(normalizedDates.to) }
|
|
108
|
-
: undefined;
|
|
109
|
-
const newValueFrom = (newRange === null || newRange === void 0 ? void 0 : newRange.from) || new Date();
|
|
110
|
-
const newValueTo = (newRange === null || newRange === void 0 ? void 0 : newRange.to) || new Date();
|
|
111
|
-
setSelectedRange({ label: newVal, from: newValueFrom, to: newValueTo });
|
|
112
|
-
setCustomDate(normalizedDates);
|
|
113
|
-
!hasApplyButton && (onChange === null || onChange === void 0 ? void 0 : onChange({ label: newVal, from: newValueFrom, to: newValueTo }));
|
|
114
|
-
}
|
|
115
|
-
!hasApplyButton && newVal !== CUSTOM_CALENDAR_ID && setIsOpen(false);
|
|
116
|
-
}, [options, hasApplyButton, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter, onChange, selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label, value === null || value === void 0 ? void 0 : value.from, value === null || value === void 0 ? void 0 : value.to]);
|
|
117
|
-
const handleRangeSelection = useCallback(() => {
|
|
118
|
-
if (selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label) {
|
|
119
|
-
const newState = { label: selectedRange.label, from: new Date(customDate.from), to: new Date(customDate.to) };
|
|
120
|
-
setPrevSelection(newState);
|
|
121
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(newState);
|
|
122
|
-
setSelectedRange(newState);
|
|
123
|
-
setIsOpen(false);
|
|
124
|
-
}
|
|
125
|
-
}, [selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label, customDate.from, customDate.to, onChange]);
|
|
126
|
-
const handleApplyClick = useCallback(() => {
|
|
127
|
-
setIsOpen(false);
|
|
128
|
-
setShowMobileCalendar(false);
|
|
129
|
-
if (isCustomDateOption) {
|
|
130
|
-
handleRangeSelection();
|
|
131
|
-
previousStepOption.current = "";
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
selectedRange && (onChange === null || onChange === void 0 ? void 0 : onChange(selectedRange));
|
|
135
|
-
selectedRange && setPrevSelection(selectedRange);
|
|
136
|
-
}, [handleRangeSelection, isCustomDateOption, onChange, selectedRange]);
|
|
137
|
-
const handleCancelClick = useCallback(() => {
|
|
138
|
-
hasApplyButton && prevSelection && handleDateRangeSelection(prevSelection.label);
|
|
139
|
-
setCustomDate({ from: prevSelection === null || prevSelection === void 0 ? void 0 : prevSelection.from.toISOString(), to: prevSelection === null || prevSelection === void 0 ? void 0 : prevSelection.to.toISOString() });
|
|
140
|
-
setIsOpen(!isOpen);
|
|
141
|
-
setShowMobileCalendar(false);
|
|
142
|
-
}, [handleDateRangeSelection, prevSelection, isOpen, hasApplyButton]);
|
|
143
|
-
const handleClearClick = useCallback(() => {
|
|
144
|
-
//* @ts-expect-error: Let's ignore a compile error. if onChange is triggered, then either a value is passed to the function, or undefined can be passed because the interface is IDateRangeUnsetValue
|
|
145
|
-
!hasApplyButton && (defaultValue || allowUnsetValue) && (onChange === null || onChange === void 0 ? void 0 : onChange(defaultValue));
|
|
146
|
-
!hasApplyButton && setIsOpen(false);
|
|
147
|
-
setSelectedRange(defaultValue);
|
|
148
|
-
previousStepOption.current = "";
|
|
149
|
-
(defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.label) === CUSTOM_CALENDAR_ID && !allowUnsetValue && setCustomDate({ from: defaultValue.from.toISOString(), to: defaultValue.to.toISOString() });
|
|
150
|
-
setShowMobileCalendar(false);
|
|
151
|
-
}, [allowUnsetValue, defaultValue, hasApplyButton, onChange]);
|
|
152
|
-
const handleMobileBackClick = useCallback(() => {
|
|
153
|
-
setShowMobileCalendar(false);
|
|
154
|
-
}, []);
|
|
155
|
-
const handleStepperClick = useCallback((currentRange, isIncrease) => {
|
|
156
|
-
let step = previousStepOption.current ? previousStepOption.current : getDateRangeAdjustedStep(translate, currentRange.label);
|
|
157
|
-
if (previousStepOption.current === "") {
|
|
158
|
-
previousStepOption.current = step;
|
|
159
|
-
}
|
|
160
|
-
else if (previousStepOption.current !== DEFAULT_STEP_OPTION) {
|
|
161
|
-
step = previousStepOption.current;
|
|
162
|
-
}
|
|
163
|
-
const adjustFn = dateRangeAdjustedFn[step];
|
|
164
|
-
const newValue = adjustFn(currentRange, isIncrease, toLocalDateTime, toReverseOffsetDateTime);
|
|
165
|
-
const labeledValue = getSelectedRangeFromValue(optionsMap, newValue);
|
|
166
|
-
labeledValue && (onChange === null || onChange === void 0 ? void 0 : onChange(labeledValue));
|
|
167
|
-
}, [onChange, optionsMap, toLocalDateTime, toReverseOffsetDateTime, translate]);
|
|
168
|
-
useEffect(() => {
|
|
169
|
-
setCustomDate({ from: value === null || value === void 0 ? void 0 : value.from.toISOString(), to: value === null || value === void 0 ? void 0 : value.to.toISOString() });
|
|
170
|
-
const currentValue = getSelectedRangeFromValue(optionsMapRef.current, value);
|
|
171
|
-
setPrevSelection(currentValue);
|
|
172
|
-
}, [value, isEqualMaps]);
|
|
173
|
-
const range = useMemo(() => ({ from: customDate.from, to: customDate.to }), [customDate.from, customDate.to]);
|
|
174
|
-
const component = useMemo(() => _jsx(DateRangeInner, { id: id || componentId, options: options, onOptionSelect: handleDateRangeSelection, onCalendarSelect: hasCustomOption ? (val) => {
|
|
175
|
-
setCustomDate({ from: lockStartDate || val.from, to: lockEndDate || (lockStartDate ? val.to || val.from : val.to) });
|
|
176
|
-
} : undefined, selection: selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label, range: range, timeSelect: timeSelect, disableFutureDates: disableFutureDates, disablePastDates: disablePastDates, disableDatesBefore: disableDatesBefore, disableDatesAfter: disableDatesAfter, showMobileCalendar: isMobile ? showMobileCalendar : undefined, setShowMobileCalendar: isMobile ? setShowMobileCalendar : undefined }), [id, componentId, options, handleDateRangeSelection, hasCustomOption, selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label, range, timeSelect, disableFutureDates, disablePastDates,
|
|
177
|
-
disableDatesBefore, disableDatesAfter, isMobile, showMobileCalendar, lockStartDate, lockEndDate]);
|
|
178
|
-
const memoizedHandleClose = useCallback(() => {
|
|
179
|
-
setIsOpen(false);
|
|
180
|
-
}, [setIsOpen]);
|
|
181
|
-
const onReadyForFocus = useCallback((isCurrentOpen) => {
|
|
545
|
+
const step = previousStepOption.current ? previousStepOption.current : getDateRangeAdjustedStep(translate, selectedRange.label);
|
|
546
|
+
const adjustFn = dateRangeAdjustedFn[step];
|
|
547
|
+
const newValue = adjustFn({
|
|
548
|
+
from: selectedRange.from,
|
|
549
|
+
to: selectedRange.to
|
|
550
|
+
}, isIncrease, toLocalDateTime, toReverseOffsetDateTime);
|
|
551
|
+
const normalizeNewValue = normalizeDates(newValue.from.toISOString(), newValue.to.toISOString(), disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter);
|
|
552
|
+
return newValue.from.getTime() !== new Date(normalizeNewValue.from).getTime() || newValue.to.getTime() !== new Date(normalizeNewValue.to).getTime();
|
|
553
|
+
}, [disableDatesAfter, disableDatesBefore, disableFutureDates, disablePastDates, selectedRange, toLocalDateTime, toReverseOffsetDateTime, translate]);
|
|
554
|
+
const increaseRange = useCallback(() => {
|
|
555
|
+
selectedRange && handleStepperClick(selectedRange, true);
|
|
556
|
+
}, [handleStepperClick, selectedRange]);
|
|
557
|
+
const decreaseRange = useCallback(() => {
|
|
558
|
+
selectedRange && handleStepperClick(selectedRange, false);
|
|
559
|
+
}, [handleStepperClick, selectedRange]);
|
|
560
|
+
useEffect(() => {
|
|
561
|
+
if (!isMobile && !isOpen && prevIsOpenRef.current) {
|
|
562
|
+
setTimeout(() => {
|
|
182
563
|
var _a;
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
if (isCurrentOpen) {
|
|
187
|
-
const focusableElement = (_a = mobileContentRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(FOCUSABLE_SELECTOR);
|
|
188
|
-
focusableElement === null || focusableElement === void 0 ? void 0 : focusableElement.focus();
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
prevIsOpenRef.current = isCurrentOpen;
|
|
192
|
-
}, [isMobile, mobileContentRef]);
|
|
193
|
-
const isValueNotChanged = useMemo(() => {
|
|
194
|
-
if (!hasApplyButton) {
|
|
195
|
-
return false;
|
|
196
|
-
}
|
|
197
|
-
if (!isCustomDateOption) {
|
|
198
|
-
return (selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label) === (value === null || value === void 0 ? void 0 : value.label);
|
|
199
|
-
}
|
|
200
|
-
return selectedRange.label === (value === null || value === void 0 ? void 0 : value.label) && customDate.from === value.from.toISOString() && customDate.to === value.to.toISOString();
|
|
201
|
-
}, [customDate.from, customDate.to, hasApplyButton, isCustomDateOption, selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label, value === null || value === void 0 ? void 0 : value.from, value === null || value === void 0 ? void 0 : value.label, value === null || value === void 0 ? void 0 : value.to]);
|
|
202
|
-
const memoizedDesktopView = useMemo(() => _jsx(ControlledPopup, { className: classNames(["zen-date-range-popup-wrapper", driveWrapperPopupClassName || ""]), ariaLabel: translate("Date range"), useTrapFocusWithTrigger: "on", role: "dialog", triggerRef: triggerRef, onOpenChange: setIsOpen, shouldHoldScroll: true, isOpen: isOpen, recalculateOnScroll: true, children: _jsxs("div", { className: classNames(["zen-date-range-popup", drivePopupClassName || "", classNamePopup !== null && classNamePopup !== void 0 ? classNamePopup : ""]), children: [_jsx("div", { className: "zen-date-range-popup__header", children: title }), component, _jsxs("div", { className: "zen-date-range-popup__footer", children: [_jsx(Button, { className: "zen-date-range-popup__button-clear", type: ButtonType.Tertiary, disabled: !!isDefaultState, onClick: handleClearClick, children: translate("Clear") }), (!isCustomDateOption && hasApplyButton) &&
|
|
203
|
-
_jsx(Button, { className: "zen-date-range-popup__button-reset", type: ButtonType.Secondary, onClick: handleCancelClick, children: translate("Cancel") }), (isCustomDateOption || hasApplyButton) && _jsx(Button, { className: "zen-date-range-popup__button-apply", type: ButtonType.Primary, disabled: (isCustomDateOption && (!customDate.from || !customDate.to)) || isValueNotChanged || !selectedRange, onClick: handleApplyClick, children: translate("Apply") })] })] }) }), [classNamePopup, component, customDate.from, customDate.to, drivePopupClassName, driveWrapperPopupClassName, handleApplyClick, handleCancelClick, handleClearClick, hasApplyButton, isCustomDateOption, isDefaultState, isOpen, isValueNotChanged, selectedRange, title, translate]);
|
|
204
|
-
const memoizedMobileFooter = useMemo(() => {
|
|
205
|
-
const clearButton = _jsx(Button, { type: ButtonType.Tertiary, disabled: !!isDefaultState, onClick: handleClearClick, children: translate("Clear") });
|
|
206
|
-
const cancelButton = hasApplyButton && !showMobileCalendar ? _jsx(Button, { type: ButtonType.Secondary, onClick: handleCancelClick, children: translate("Cancel") }) : null;
|
|
207
|
-
const applyButton = showMobileCalendar || hasApplyButton ?
|
|
208
|
-
_jsx(Button, { type: ButtonType.Primary, disabled: (isCustomDateOption && (!customDate.from || !customDate.to)) || isValueNotChanged || !selectedRange, onClick: handleApplyClick, children: translate("Apply") }) : null;
|
|
209
|
-
return _jsxs(FooterButtons, { children: [applyButton, cancelButton, clearButton] });
|
|
210
|
-
}, [customDate.from, customDate.to, handleApplyClick, handleCancelClick, handleClearClick, hasApplyButton, isCustomDateOption, isDefaultState, isValueNotChanged, selectedRange,
|
|
211
|
-
showMobileCalendar, translate]);
|
|
212
|
-
const memoizedMobileView = useMemo(() => _jsxs(MobileSheet, { className: classNames(["zen-date-range-mobile-sheet", classNamePopup ? `${classNamePopup}--mobile-sheet` : ""]), label: translate("Date range"), triggerRef: triggerRef, isOpen: isOpen, onHidePanel: memoizedHandleClose, onCloseClick: memoizedHandleClose, useTrapFocusWithTrigger: false, preventFirstFocus: true, isBackVisible: showMobileCalendar, onBackClick: handleMobileBackClick, onReadyForFocus: onReadyForFocus, children: [_jsx(MobileSheet.Title, { children: showMobileCalendar ? calendarLabel : title }), _jsx(MobileSheet.Content, { children: _jsx("div", { ref: mobileContentRef, children: component }) }), _jsx(MobileSheet.Footer, { children: memoizedMobileFooter })] }), [calendarLabel, classNamePopup, component, handleMobileBackClick, isOpen, memoizedHandleClose, memoizedMobileFooter,
|
|
213
|
-
onReadyForFocus, showMobileCalendar, title, translate, mobileContentRef]);
|
|
214
|
-
const checkIsRangeDisable = useCallback((isIncrease) => {
|
|
215
|
-
if (!selectedRange) {
|
|
216
|
-
return true;
|
|
217
|
-
}
|
|
218
|
-
const step = previousStepOption.current ? previousStepOption.current : getDateRangeAdjustedStep(translate, selectedRange.label);
|
|
219
|
-
const adjustFn = dateRangeAdjustedFn[step];
|
|
220
|
-
const newValue = adjustFn({ from: selectedRange.from, to: selectedRange.to }, isIncrease, toLocalDateTime, toReverseOffsetDateTime);
|
|
221
|
-
const normalizeNewValue = normalizeDates(newValue.from.toISOString(), newValue.to.toISOString(), disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter);
|
|
222
|
-
return newValue.from.getTime() !== new Date(normalizeNewValue.from).getTime() || newValue.to.getTime() !== new Date(normalizeNewValue.to).getTime();
|
|
223
|
-
}, [disableDatesAfter, disableDatesBefore, disableFutureDates, disablePastDates, selectedRange, toLocalDateTime, toReverseOffsetDateTime, translate]);
|
|
224
|
-
const increaseRange = useCallback(() => {
|
|
225
|
-
selectedRange && handleStepperClick(selectedRange, true);
|
|
226
|
-
}, [handleStepperClick, selectedRange]);
|
|
227
|
-
const decreaseRange = useCallback(() => {
|
|
228
|
-
selectedRange && handleStepperClick(selectedRange, false);
|
|
229
|
-
}, [handleStepperClick, selectedRange]);
|
|
230
|
-
useEffect(() => {
|
|
231
|
-
if (!isMobile && !isOpen && prevIsOpenRef.current) {
|
|
232
|
-
setTimeout(() => {
|
|
233
|
-
var _a;
|
|
234
|
-
(_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
235
|
-
}, 0);
|
|
236
|
-
}
|
|
237
|
-
prevIsOpenRef.current = isOpen;
|
|
238
|
-
}, [isOpen, isMobile]);
|
|
239
|
-
const buttonLabel = useMemo(() => triggerLabel && !stepper ? triggerLabel : getButtonLabel(getSelectedRangeFromValue(optionsMap, value)), [getButtonLabel, optionsMap, value, triggerLabel, stepper]);
|
|
240
|
-
const buttonTitle = useMemo(() => triggerLabel && !stepper ? triggerLabel : getButtonLabel(getSelectedRangeFromValue(optionsMap, value), true), [getButtonLabel, optionsMap, value, triggerLabel, stepper]);
|
|
241
|
-
const currentLabel = (_a = getSelectedRangeFromValue(optionsMap, value)) === null || _a === void 0 ? void 0 : _a.label;
|
|
242
|
-
const cssClass = classNames([
|
|
243
|
-
"zen-date-range",
|
|
244
|
-
error ? "zen-date-range--error" : "",
|
|
245
|
-
className !== null && className !== void 0 ? className : "",
|
|
246
|
-
stepper ? "zen-date-range--with-stepper" : "",
|
|
247
|
-
stepper && currentLabel === CUSTOM_CALENDAR_ID && buttonLabel.length > 20 ? "zen-date-range--with-stepper-custom" : "",
|
|
248
|
-
!defaultValue && !value || (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.label) === currentLabel || type && type !== ButtonType.Secondary ? "" : "zen-date-range--active"
|
|
249
|
-
]);
|
|
250
|
-
const popupTriggerComponent = useMemo(() => _jsx(TextIconButton, { onBlur: onBlur, name: name, htmlType: "button", title: buttonTitle, icon: IconCalendar, iconPosition: ButtonIconPosition.Start, className: cssClass, type: type, disabled: disabled, onClick: toggleVisibility, ref: triggerRef, children: buttonLabel }), [onBlur, name, buttonTitle, cssClass, type, disabled, toggleVisibility, buttonLabel]);
|
|
251
|
-
const chipTriggerComponent = useMemo(() => _jsx(Chip, { status: isDefaultState ? undefined : chipStatus || "active", title: isDefaultState ? chipName : buttonTitle, isOpen: isOpen, disabled: disabled, onClick: toggleVisibility, onClose: isDefaultState ? undefined : handleClearClick, triggerRef: triggerRef, icon: chipIcon || IconCalendar, id: chipId, children: isDefaultState ? chipName : buttonLabel }), [isDefaultState, chipStatus, isOpen, disabled, toggleVisibility, handleClearClick, chipIcon, chipId, chipName, buttonLabel, buttonTitle]);
|
|
252
|
-
if (isReadOnly) {
|
|
253
|
-
return _jsx(ReviewTextControl, { value: buttonLabel });
|
|
564
|
+
(_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
565
|
+
}, 0);
|
|
254
566
|
}
|
|
255
|
-
|
|
567
|
+
prevIsOpenRef.current = isOpen;
|
|
568
|
+
}, [isOpen, isMobile]);
|
|
569
|
+
const buttonLabel = useMemo(() => triggerLabel && !stepper ? triggerLabel : getButtonLabel(getSelectedRangeFromValue(optionsMap, value)), [getButtonLabel, optionsMap, value, triggerLabel, stepper]);
|
|
570
|
+
const buttonTitle = useMemo(() => triggerLabel && !stepper ? triggerLabel : getButtonLabel(getSelectedRangeFromValue(optionsMap, value), true), [getButtonLabel, optionsMap, value, triggerLabel, stepper]);
|
|
571
|
+
const currentLabel = (_a = getSelectedRangeFromValue(optionsMap, value)) === null || _a === void 0 ? void 0 : _a.label;
|
|
572
|
+
const cssClass = classNames(["zen-date-range", error ? "zen-date-range--error" : "", className !== null && className !== void 0 ? className : "", stepper ? "zen-date-range--with-stepper" : "", stepper && currentLabel === CUSTOM_CALENDAR_ID && buttonLabel.length > 20 ? "zen-date-range--with-stepper-custom" : "", !defaultValue && !value || (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.label) === currentLabel || type && type !== ButtonType.Secondary ? "" : "zen-date-range--active"]);
|
|
573
|
+
const popupTriggerComponent = useMemo(() => _jsx(TextIconButton, {
|
|
574
|
+
onBlur: onBlur,
|
|
575
|
+
name: name,
|
|
576
|
+
htmlType: "button",
|
|
577
|
+
title: buttonTitle,
|
|
578
|
+
icon: IconCalendar,
|
|
579
|
+
iconPosition: ButtonIconPosition.Start,
|
|
580
|
+
className: cssClass,
|
|
581
|
+
type: type,
|
|
582
|
+
disabled: disabled,
|
|
583
|
+
onClick: toggleVisibility,
|
|
584
|
+
ref: triggerRef,
|
|
585
|
+
children: buttonLabel
|
|
586
|
+
}), [onBlur, name, buttonTitle, cssClass, type, disabled, toggleVisibility, buttonLabel]);
|
|
587
|
+
const chipTriggerComponent = useMemo(() => _jsx(Chip, {
|
|
588
|
+
status: isDefaultState ? undefined : chipStatus || "active",
|
|
589
|
+
title: isDefaultState ? chipName : buttonTitle,
|
|
590
|
+
isOpen: isOpen,
|
|
591
|
+
disabled: disabled,
|
|
592
|
+
onClick: toggleVisibility,
|
|
593
|
+
onClose: isDefaultState ? undefined : handleClearClick,
|
|
594
|
+
triggerRef: triggerRef,
|
|
595
|
+
icon: chipIcon || IconCalendar,
|
|
596
|
+
id: chipId,
|
|
597
|
+
children: isDefaultState ? chipName : buttonLabel
|
|
598
|
+
}), [isDefaultState, chipStatus, isOpen, disabled, toggleVisibility, handleClearClick, chipIcon, chipId, chipName, buttonLabel, buttonTitle]);
|
|
599
|
+
if (isReadOnly) {
|
|
600
|
+
return _jsx(ReviewTextControl, {
|
|
601
|
+
value: buttonLabel
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
return _jsxs(_Fragment, {
|
|
605
|
+
children: [stepper ? _jsxs("div", {
|
|
606
|
+
className: classNames(["zen-date-range-wrapper", driveWrapperTriggerClassName || "", classNameWrapper || ""]),
|
|
607
|
+
children: [_jsx("button", {
|
|
608
|
+
type: "button",
|
|
609
|
+
disabled: checkIsRangeDisable(false),
|
|
610
|
+
onClick: decreaseRange,
|
|
611
|
+
className: classNames(["zen-date-range__stepper", "zen-date-range__stepper--left"]),
|
|
612
|
+
title: translate("Previous"),
|
|
613
|
+
children: _jsx(IconChevronLeftSmall, {
|
|
614
|
+
size: isDrive ? "huge" : "large"
|
|
615
|
+
})
|
|
616
|
+
}), popupTriggerComponent, _jsx("button", {
|
|
617
|
+
type: "button",
|
|
618
|
+
disabled: checkIsRangeDisable(true),
|
|
619
|
+
onClick: increaseRange,
|
|
620
|
+
className: classNames(["zen-date-range__stepper", "zen-date-range__stepper--right"]),
|
|
621
|
+
title: translate("Next"),
|
|
622
|
+
children: _jsx(IconChevronRightSmall, {
|
|
623
|
+
size: isDrive ? "huge" : "large"
|
|
624
|
+
})
|
|
625
|
+
})]
|
|
626
|
+
}) : chip ? chipTriggerComponent : popupTriggerComponent, isMobile ? memoizedMobileView : memoizedDesktopView]
|
|
627
|
+
});
|
|
256
628
|
};
|
|
257
|
-
export const TRANSLATIONS = [
|
|
258
|
-
"Custom",
|
|
259
|
-
"Date range",
|
|
260
|
-
"Clear",
|
|
261
|
-
"Cancel",
|
|
262
|
-
"Apply",
|
|
263
|
-
"Reset",
|
|
264
|
-
"Today",
|
|
265
|
-
"Next",
|
|
266
|
-
"Previous",
|
|
267
|
-
"Choose dates",
|
|
268
|
-
"Date range not available",
|
|
269
|
-
"Choose your date range",
|
|
270
|
-
"Some of the dates you selected aren’t available. Please try a different range.",
|
|
271
|
-
"Please select the dates you want to view."
|
|
272
|
-
];
|
|
629
|
+
export const TRANSLATIONS = ["Custom", "Date range", "Clear", "Cancel", "Apply", "Reset", "Today", "Next", "Previous", "Choose dates", "Date range not available", "Choose your date range", "Some of the dates you selected aren’t available. Please try a different range.", "Please select the dates you want to view."];
|