@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, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { useCallback, useContext, useEffect, useMemo, useReducer, useRef, useState } from "react";
|
|
3
4
|
import { Calendar } from "../calendar/calendar";
|
|
@@ -9,482 +10,791 @@ import { DateInputInnerControlBlock } from "./dateInputInnerControlBlock";
|
|
|
9
10
|
import { userFormatContext } from "../utils/userFormat/userFormatContext";
|
|
10
11
|
import { AssistiveText, dateInputInnerReducer, DateInputInnerStateActionType, getInitialDateInputInnerState } from "./dateInputInnerReducer";
|
|
11
12
|
import { useTodayButton } from "../utils/dateInputUtils/useTodayButton";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
13
|
+
injectString("da-DK", "Start date has been adjusted.", "Startdatoen er blevet justeret.");
|
|
14
|
+
injectString("en", "Start date has been adjusted.", "Start date has been adjusted.");
|
|
15
|
+
injectString("fi-FI", "Start date has been adjusted.", "Aloitusp\xE4iv\xE4\xE4 on mukautettu.");
|
|
16
|
+
injectString("hu-HU", "Start date has been adjusted.", "A kezd\u0151 d\xE1tumot m\xF3dos\xEDtottuk.");
|
|
17
|
+
injectString("ko-KR", "Start date has been adjusted.", "\uC2DC\uC791 \uB0A0\uC9DC\uAC00 \uC870\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
|
|
18
|
+
injectString("nb-NO", "Start date has been adjusted.", "Startdatoen er justert.");
|
|
19
|
+
injectString("sk-SK", "Start date has been adjusted.", "D\xE1tum za\u010Diatku bol upraven\xFD.");
|
|
20
|
+
injectString("zh-TW", "Start date has been adjusted.", "\u5DF2\u8ABF\u6574\u958B\u59CB\u65E5\u671F\u3002");
|
|
21
|
+
injectString("da-DK", "End date has been adjusted.", "Slutdatoen er blevet justeret.");
|
|
22
|
+
injectString("en", "End date has been adjusted.", "End date has been adjusted.");
|
|
23
|
+
injectString("fi-FI", "End date has been adjusted.", "Lopetusp\xE4iv\xE4m\xE4\xE4r\xE4 on mukautettu.");
|
|
24
|
+
injectString("hu-HU", "End date has been adjusted.", "A z\xE1r\xF3 d\xE1tumot m\xF3dos\xEDtottuk.");
|
|
25
|
+
injectString("ko-KR", "End date has been adjusted.", "\uC885\uB8CC \uB0A0\uC9DC\uAC00 \uC870\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
|
|
26
|
+
injectString("nb-NO", "End date has been adjusted.", "Endedatoen er justert.");
|
|
27
|
+
injectString("sk-SK", "End date has been adjusted.", "D\xE1tum ukon\u010Denia bol upraven\xFD.");
|
|
28
|
+
injectString("zh-TW", "End date has been adjusted.", "\u5DF2\u8ABF\u6574\u7D50\u675F\u65E5\u671F\u3002");
|
|
29
|
+
injectString("da-DK", "Start time has been adjusted.", "Starttidspunktet er blevet justeret.");
|
|
30
|
+
injectString("en", "Start time has been adjusted.", "Start time has been adjusted.");
|
|
31
|
+
injectString("fi-FI", "Start time has been adjusted.", "Aloitusaika on s\xE4\xE4detty.");
|
|
32
|
+
injectString("hu-HU", "Start time has been adjusted.", "A kezd\u0151 id\u0151pontot m\xF3dos\xEDtottuk.");
|
|
33
|
+
injectString("ko-KR", "Start time has been adjusted.", "\uC2DC\uC791 \uC2DC\uAC04\uC774 \uC870\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
|
|
34
|
+
injectString("nb-NO", "Start time has been adjusted.", "Starttiden er justert.");
|
|
35
|
+
injectString("sk-SK", "Start time has been adjusted.", "\u010Cas za\u010Datia bol upraven\xFD.");
|
|
36
|
+
injectString("zh-TW", "Start time has been adjusted.", "\u5DF2\u8ABF\u6574\u958B\u59CB\u6642\u9593\u3002");
|
|
37
|
+
injectString("da-DK", "End time has been adjusted.", "Sluttidspunktet er blevet justeret.");
|
|
38
|
+
injectString("en", "End time has been adjusted.", "End time has been adjusted.");
|
|
39
|
+
injectString("fi-FI", "End time has been adjusted.", "Loppuaika on s\xE4\xE4detty.");
|
|
40
|
+
injectString("hu-HU", "End time has been adjusted.", "A z\xE1r\xF3 id\u0151pontot m\xF3dos\xEDtottuk.");
|
|
41
|
+
injectString("ko-KR", "End time has been adjusted.", "\uC885\uB8CC \uC2DC\uAC04\uC774 \uC870\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
|
|
42
|
+
injectString("nb-NO", "End time has been adjusted.", "Endetiden er justert.");
|
|
43
|
+
injectString("sk-SK", "End time has been adjusted.", "\u010Cas ukon\u010Denia bol upraven\xFD.");
|
|
44
|
+
injectString("zh-TW", "End time has been adjusted.", "\u5DF2\u8ABF\u6574\u7D50\u675F\u6642\u9593\u3002");
|
|
45
|
+
injectString("cs", "Start date", "Datum za\u010D\xE1tku");
|
|
46
|
+
injectString("da-DK", "Start date", "Startdato");
|
|
47
|
+
injectString("de", "Start date", "Startdatum");
|
|
48
|
+
injectString("en", "Start date", "Start date");
|
|
49
|
+
injectString("es", "Start date", "Fecha de inicio");
|
|
50
|
+
injectString("fi-FI", "Start date", "Aloitusp\xE4iv\xE4m\xE4\xE4r\xE4");
|
|
51
|
+
injectString("fr", "Start date", "Date de d\xE9but");
|
|
52
|
+
injectString("fr-FR", "Start date", "Date de d\xE9but");
|
|
53
|
+
injectString("hu-HU", "Start date", "Kezd\u0151d\xE1tum");
|
|
54
|
+
injectString("id", "Start date", "Tanggal mulai");
|
|
55
|
+
injectString("it", "Start date", "Data di inizio");
|
|
56
|
+
injectString("ja", "Start date", "\u958B\u59CB\u65E5");
|
|
57
|
+
injectString("ko-KR", "Start date", "\uC2DC\uC791 \uB0A0\uC9DC");
|
|
58
|
+
injectString("ms", "Start date", "Tarikh mula");
|
|
59
|
+
injectString("nb-NO", "Start date", "Startdato");
|
|
60
|
+
injectString("nl", "Start date", "Startdatum");
|
|
61
|
+
injectString("pl", "Start date", "Data rozpocz\u0119cia");
|
|
62
|
+
injectString("pt-BR", "Start date", "Data de in\xEDcio");
|
|
63
|
+
injectString("sk-SK", "Start date", "D\xE1tum za\u010Diatku");
|
|
64
|
+
injectString("sv", "Start date", "Startdatum");
|
|
65
|
+
injectString("th", "Start date", "\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19");
|
|
66
|
+
injectString("tr", "Start date", "Ba\u015Flang\u0131\xE7 tarihi");
|
|
67
|
+
injectString("zh-Hans", "Start date", "\u8D77\u59CB\u65E5\u671F");
|
|
68
|
+
injectString("zh-TW", "Start date", "\u958B\u59CB\u65E5\u671F");
|
|
69
|
+
injectString("cs", "Pick a date", "Vyberte datum");
|
|
70
|
+
injectString("da-DK", "Pick a date", "V\xE6lg en dato");
|
|
71
|
+
injectString("de", "Pick a date", "Datum ausw\xE4hlen");
|
|
72
|
+
injectString("en", "Pick a date", "Pick a date");
|
|
73
|
+
injectString("es", "Pick a date", "Elegir una fecha");
|
|
74
|
+
injectString("fi-FI", "Pick a date", "Valitse p\xE4iv\xE4m\xE4\xE4r\xE4");
|
|
75
|
+
injectString("fr", "Pick a date", "Choisir une date");
|
|
76
|
+
injectString("fr-FR", "Pick a date", "S\xE9lectionner une date");
|
|
77
|
+
injectString("hu-HU", "Pick a date", "V\xE1lassz d\xE1tumot");
|
|
78
|
+
injectString("id", "Pick a date", "Pilih tanggal");
|
|
79
|
+
injectString("it", "Pick a date", "Scegliere una data");
|
|
80
|
+
injectString("ja", "Pick a date", "\u65E5\u4ED8\u3092\u9078\u629E");
|
|
81
|
+
injectString("ko-KR", "Pick a date", "\uB0A0\uC9DC \uC120\uD0DD");
|
|
82
|
+
injectString("ms", "Pick a date", "Pilih tarikh");
|
|
83
|
+
injectString("nb-NO", "Pick a date", "Velg en dato");
|
|
84
|
+
injectString("nl", "Pick a date", "Kies een datum");
|
|
85
|
+
injectString("pl", "Pick a date", "Wybierz dat\u0119");
|
|
86
|
+
injectString("pt-BR", "Pick a date", "Escolha uma data");
|
|
87
|
+
injectString("sk-SK", "Pick a date", "Vyber d\xE1tum");
|
|
88
|
+
injectString("sv", "Pick a date", "V\xE4lj ett datum");
|
|
89
|
+
injectString("th", "Pick a date", "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48");
|
|
90
|
+
injectString("tr", "Pick a date", "Bir tarih se\xE7in");
|
|
91
|
+
injectString("zh-Hans", "Pick a date", "\u9009\u62E9\u65E5\u671F");
|
|
92
|
+
injectString("zh-TW", "Pick a date", "\u9078\u64C7\u65E5\u671F");
|
|
93
|
+
injectString("cs", "End date", "Datum konce");
|
|
94
|
+
injectString("da-DK", "End date", "Slutdato");
|
|
95
|
+
injectString("de", "End date", "Enddatum");
|
|
96
|
+
injectString("en", "End date", "End date");
|
|
97
|
+
injectString("es", "End date", "Fecha de desactivaci\xF3n");
|
|
98
|
+
injectString("fi-FI", "End date", "Lopetusp\xE4iv\xE4m\xE4\xE4r\xE4");
|
|
99
|
+
injectString("fr", "End date", "Date de fin");
|
|
100
|
+
injectString("fr-FR", "End date", "Date de fin");
|
|
101
|
+
injectString("hu-HU", "End date", "Z\xE1r\xF3d\xE1tum");
|
|
102
|
+
injectString("id", "End date", "Tanggal akhir");
|
|
103
|
+
injectString("it", "End date", "Data finale");
|
|
104
|
+
injectString("ja", "End date", "\u7D42\u4E86\u65E5");
|
|
105
|
+
injectString("ko-KR", "End date", "\uC885\uB8CC \uB0A0\uC9DC");
|
|
106
|
+
injectString("ms", "End date", "Tarikh tamat");
|
|
107
|
+
injectString("nb-NO", "End date", "Endedato");
|
|
108
|
+
injectString("nl", "End date", "Einddatum");
|
|
109
|
+
injectString("pl", "End date", "Data zako\u0144czenia");
|
|
110
|
+
injectString("pt-BR", "End date", "Data final");
|
|
111
|
+
injectString("sk-SK", "End date", "D\xE1tum ukon\u010Denia");
|
|
112
|
+
injectString("sv", "End date", "Slutdatum");
|
|
113
|
+
injectString("th", "End date", "\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E2A\u0E34\u0E49\u0E19\u0E2A\u0E38\u0E14");
|
|
114
|
+
injectString("tr", "End date", "Biti\u015F tarihi");
|
|
115
|
+
injectString("zh-Hans", "End date", "\u7ED3\u675F\u65E5\u671F");
|
|
116
|
+
injectString("zh-TW", "End date", "\u7D50\u675F\u65E5\u671F");
|
|
117
|
+
export const DateInputInner = ({
|
|
118
|
+
id,
|
|
119
|
+
value,
|
|
120
|
+
dateFormatter,
|
|
121
|
+
dateDeformatter,
|
|
122
|
+
dateFormat,
|
|
123
|
+
onChange,
|
|
124
|
+
dateRangeMode,
|
|
125
|
+
selectTime,
|
|
126
|
+
disableFutureDates,
|
|
127
|
+
disablePastDates,
|
|
128
|
+
disableDatesAfter,
|
|
129
|
+
disableDatesBefore,
|
|
130
|
+
startDayOfWeek,
|
|
131
|
+
yearRange,
|
|
132
|
+
title,
|
|
133
|
+
isMobileView,
|
|
134
|
+
requireSelection = false
|
|
135
|
+
}) => {
|
|
136
|
+
var _a;
|
|
137
|
+
const {
|
|
138
|
+
translate
|
|
139
|
+
} = useLanguage();
|
|
140
|
+
const {
|
|
141
|
+
toLocalDateTime,
|
|
142
|
+
toReverseOffsetDateTime
|
|
143
|
+
} = useContext(userFormatContext);
|
|
144
|
+
const {
|
|
145
|
+
isTodayDisabled,
|
|
146
|
+
todayFrom,
|
|
147
|
+
todayTo
|
|
148
|
+
} = useTodayButton(dateRangeMode, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter);
|
|
149
|
+
const driveClassName = useDriveClassName("zen-date-input-inner");
|
|
150
|
+
const [state, dispatchState] = useReducer(dateInputInnerReducer, getInitialDateInputInnerState(id, value.from ? dateFormatter(value.from) : "", value.to ? dateFormatter(value.to) : "", dateRangeMode));
|
|
151
|
+
const currentDateValuesRef = useRef({
|
|
152
|
+
from: value.from,
|
|
153
|
+
to: value.to
|
|
154
|
+
});
|
|
155
|
+
const currentSelectedFieldRef = useRef(undefined);
|
|
156
|
+
const startInputRef = useRef(null);
|
|
157
|
+
const endInputRef = useRef(null);
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
dispatchState({
|
|
160
|
+
type: DateInputInnerStateActionType.ChangeStartDateText,
|
|
161
|
+
payload: value.from ? dateFormatter(value.from) : ""
|
|
162
|
+
});
|
|
163
|
+
}, [value.from, dateFormatter]);
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
dispatchState({
|
|
166
|
+
type: DateInputInnerStateActionType.ChangeEndDateText,
|
|
167
|
+
payload: value.to ? dateFormatter(value.to) : ""
|
|
168
|
+
});
|
|
169
|
+
}, [value.to, dateFormatter]);
|
|
170
|
+
useEffect(() => {
|
|
171
|
+
var _a, _b;
|
|
172
|
+
if (value.from !== currentDateValuesRef.current.from || value.to !== currentDateValuesRef.current.to) {
|
|
173
|
+
currentDateValuesRef.current = {
|
|
174
|
+
from: value.from,
|
|
175
|
+
to: value.to
|
|
176
|
+
};
|
|
177
|
+
dispatchState({
|
|
178
|
+
type: DateInputInnerStateActionType.ChangeActiveField,
|
|
179
|
+
payload: "start"
|
|
180
|
+
});
|
|
181
|
+
currentSelectedFieldRef.current = undefined;
|
|
182
|
+
(_a = startInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
183
|
+
(_b = startInputRef.current) === null || _b === void 0 ? void 0 : _b.select();
|
|
184
|
+
}
|
|
185
|
+
}, [value.from, value.to, currentDateValuesRef]);
|
|
186
|
+
useEffect(() => {
|
|
187
|
+
dispatchState({
|
|
188
|
+
type: DateInputInnerStateActionType.ChangeDateRangeMode,
|
|
189
|
+
payload: dateRangeMode || false
|
|
190
|
+
});
|
|
191
|
+
}, [dateRangeMode]);
|
|
192
|
+
useEffect(() => {
|
|
193
|
+
if (startInputRef.current) {
|
|
194
|
+
startInputRef.current.focus();
|
|
195
|
+
startInputRef.current.select();
|
|
196
|
+
}
|
|
197
|
+
}, [startInputRef]);
|
|
198
|
+
const getAssistiveText = useCallback((txtKey, isStart) => {
|
|
199
|
+
if (txtKey === AssistiveText.DateAdjusted) {
|
|
200
|
+
return isStart ? translate("Start date has been adjusted.") : translate("End date has been adjusted.");
|
|
201
|
+
}
|
|
202
|
+
if (txtKey === AssistiveText.TimeAdjusted) {
|
|
203
|
+
return isStart ? translate("Start time has been adjusted.") : translate("End time has been adjusted.");
|
|
204
|
+
}
|
|
205
|
+
return undefined;
|
|
206
|
+
}, [translate]);
|
|
207
|
+
const calendarValue = useMemo(() => ({
|
|
208
|
+
from: value.from ? toLocalDateTime(value.from).toISOString() : undefined,
|
|
209
|
+
to: value.to ? toLocalDateTime(value.to).toISOString() : undefined
|
|
210
|
+
}), [toLocalDateTime, value.from, value.to]);
|
|
211
|
+
const disableDatesBeforeValue = useMemo(() => disableDatesBefore ? toLocalDateTime(disableDatesBefore).toISOString() : undefined, [toLocalDateTime, disableDatesBefore]);
|
|
212
|
+
const disableDatesAfterValue = useMemo(() => disableDatesAfter ? toLocalDateTime(disableDatesAfter).toISOString() : undefined, [toLocalDateTime, disableDatesAfter]);
|
|
213
|
+
const timePickerValueFrom = useMemo(() => value.from ? toLocalDateTime(value.from) : undefined, [toLocalDateTime, value.from]);
|
|
214
|
+
const [timePickerValueFromPrev, setTimePickerValueFromPrev] = useState(timePickerValueFrom);
|
|
215
|
+
useEffect(() => {
|
|
216
|
+
if (timePickerValueFrom) {
|
|
217
|
+
setTimePickerValueFromPrev(timePickerValueFrom);
|
|
218
|
+
}
|
|
219
|
+
}, [timePickerValueFrom]);
|
|
220
|
+
const timePickerValueTo = useMemo(() => value.to ? toLocalDateTime(value.to) : undefined, [toLocalDateTime, value.to]);
|
|
221
|
+
const [timePickerValueToPrev, setTimePickerValueToPrev] = useState(timePickerValueTo);
|
|
222
|
+
useEffect(() => {
|
|
223
|
+
if (timePickerValueTo) {
|
|
224
|
+
setTimePickerValueToPrev(timePickerValueTo);
|
|
225
|
+
}
|
|
226
|
+
}, [timePickerValueTo]);
|
|
227
|
+
const resetStartDateChanges = useCallback((resetKeydownBehavior = false) => {
|
|
228
|
+
dispatchState({
|
|
229
|
+
type: DateInputInnerStateActionType.ChangeStartDateText,
|
|
230
|
+
payload: value.from ? dateFormatter(value.from) : ""
|
|
231
|
+
});
|
|
232
|
+
resetKeydownBehavior && dispatchState({
|
|
233
|
+
type: DateInputInnerStateActionType.ChangeInputKeydownBehavior,
|
|
234
|
+
payload: undefined
|
|
235
|
+
});
|
|
236
|
+
}, [dateFormatter, value.from]);
|
|
237
|
+
const adjustTime = useCallback((dDate, dateLike) => {
|
|
238
|
+
if (!dateLike) {
|
|
239
|
+
return dDate;
|
|
240
|
+
}
|
|
241
|
+
// const dateLike = toLocalDateTime(prevVal);
|
|
242
|
+
dDate.setHours(dateLike.getHours());
|
|
243
|
+
dDate.setMinutes(dateLike.getMinutes());
|
|
244
|
+
dDate.setSeconds(dateLike.getSeconds());
|
|
245
|
+
return dDate;
|
|
246
|
+
}, []);
|
|
247
|
+
const startDateChangeHandler = useCallback((e, isBlur = false) => {
|
|
248
|
+
const newValue = e.target.value;
|
|
249
|
+
currentSelectedFieldRef.current = undefined;
|
|
250
|
+
let deformattedDate = dateDeformatter(newValue);
|
|
251
|
+
if (!isValidDate(deformattedDate)) {
|
|
252
|
+
resetStartDateChanges(true);
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
deformattedDate = adjustTime(deformattedDate, value.from ? toLocalDateTime(value.from) : undefined);
|
|
256
|
+
if (isValidationDateError(deformattedDate, toReverseOffsetDateTime, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter)) {
|
|
257
|
+
// if date is invalid, do not update the state
|
|
258
|
+
resetStartDateChanges(true);
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
const newValidDates = getValidDatesForStart(toReverseOffsetDateTime, deformattedDate, value.to ? toLocalDateTime(value.to) : undefined, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter);
|
|
262
|
+
const newStateValue = {
|
|
263
|
+
start: dateFormatter(toReverseOffsetDateTime(newValidDates.start)),
|
|
264
|
+
end: dateRangeMode ? newValidDates.end ? dateFormatter(toReverseOffsetDateTime(newValidDates.end)) : "" : value.to || "",
|
|
265
|
+
startAssistiveText: isBlur && state.currentActiveField === "start" ? AssistiveText.None : undefined,
|
|
266
|
+
endAssistiveText: isBlur && state.currentActiveField === "start" ? value.to && newValidDates.end && newValidDates.end.getTime() !== new Date(toLocalDateTime(value.to)).getTime() ? AssistiveText.DateAdjusted : AssistiveText.None : undefined
|
|
267
|
+
};
|
|
268
|
+
const startDateToPass = toReverseOffsetDateTime(newValidDates.start).toISOString();
|
|
269
|
+
const endDateToPass = dateRangeMode ? newValidDates.end ? toReverseOffsetDateTime(newValidDates.end).toISOString() : undefined : value.to;
|
|
270
|
+
currentDateValuesRef.current = {
|
|
271
|
+
from: startDateToPass,
|
|
272
|
+
to: endDateToPass
|
|
273
|
+
};
|
|
274
|
+
dispatchState({
|
|
275
|
+
type: DateInputInnerStateActionType.ChangePeriod,
|
|
276
|
+
payload: newStateValue
|
|
277
|
+
});
|
|
278
|
+
const isDateChanged = value.from !== startDateToPass || value.to !== endDateToPass;
|
|
279
|
+
isDateChanged && onChange({
|
|
280
|
+
from: startDateToPass,
|
|
281
|
+
to: endDateToPass
|
|
282
|
+
});
|
|
283
|
+
}, [dateDeformatter, adjustTime, value.from, value.to, toReverseOffsetDateTime, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter, toLocalDateTime, dateFormatter, dateRangeMode, state.currentActiveField, onChange, resetStartDateChanges]);
|
|
284
|
+
const startDateChangeOnArrow = useCallback((oldValue, delta) => {
|
|
285
|
+
let deformattedDate = dateDeformatter(oldValue);
|
|
286
|
+
deformattedDate.setDate(deformattedDate.getDate() + delta);
|
|
287
|
+
if (!isValidDate(deformattedDate)) {
|
|
288
|
+
resetStartDateChanges();
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
deformattedDate = adjustTime(deformattedDate, value.from ? toLocalDateTime(value.from) : undefined);
|
|
292
|
+
if (isValidationDateError(deformattedDate, toReverseOffsetDateTime, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter)) {
|
|
293
|
+
// if date is invalid, do not update the state
|
|
294
|
+
resetStartDateChanges();
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
const newValidDates = getValidDatesForStart(toReverseOffsetDateTime, deformattedDate, value.to ? toLocalDateTime(value.to) : undefined, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter);
|
|
298
|
+
const newStateValue = {
|
|
299
|
+
emittedBy: "start",
|
|
300
|
+
start: dateFormatter(toReverseOffsetDateTime(newValidDates.start)),
|
|
301
|
+
end: dateRangeMode ? newValidDates.end ? dateFormatter(toReverseOffsetDateTime(newValidDates.end)) : "" : value.to || "",
|
|
302
|
+
startAssistiveText: AssistiveText.None,
|
|
303
|
+
endAssistiveText: value.to && newValidDates.end && newValidDates.end.getTime() !== new Date(toLocalDateTime(value.to)).getTime() ? AssistiveText.DateAdjusted : AssistiveText.None,
|
|
304
|
+
inputKeyDownBehavior: "start"
|
|
305
|
+
};
|
|
306
|
+
const startDateToPass = toReverseOffsetDateTime(newValidDates.start).toISOString();
|
|
307
|
+
const endDateToPass = dateRangeMode ? newValidDates.end ? toReverseOffsetDateTime(newValidDates.end).toISOString() : undefined : value.to;
|
|
308
|
+
currentDateValuesRef.current = {
|
|
309
|
+
from: startDateToPass,
|
|
310
|
+
to: endDateToPass
|
|
311
|
+
};
|
|
312
|
+
dispatchState({
|
|
313
|
+
type: DateInputInnerStateActionType.ChangePeriod,
|
|
314
|
+
payload: newStateValue
|
|
315
|
+
});
|
|
316
|
+
onChange({
|
|
317
|
+
from: startDateToPass,
|
|
318
|
+
to: endDateToPass
|
|
319
|
+
});
|
|
320
|
+
currentSelectedFieldRef.current = startInputRef.current || undefined;
|
|
321
|
+
}, [dateDeformatter, adjustTime, value.from, value.to, toReverseOffsetDateTime, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter, toLocalDateTime, dateFormatter, dateRangeMode, onChange, resetStartDateChanges]);
|
|
322
|
+
const startTimeChangeHandler = useCallback(time => {
|
|
323
|
+
currentSelectedFieldRef.current = undefined;
|
|
324
|
+
const startDateToCopyTime = time;
|
|
325
|
+
let newValueFrom = value.from ? toLocalDateTime(value.from) : startDateToCopyTime;
|
|
326
|
+
newValueFrom = adjustTime(newValueFrom, startDateToCopyTime);
|
|
327
|
+
if (!isValidDate(newValueFrom)) {
|
|
328
|
+
resetStartDateChanges();
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
if (isValidationDateError(newValueFrom, toReverseOffsetDateTime, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter)) {
|
|
332
|
+
const newValidDate = getValidTime(newValueFrom, value.from, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter);
|
|
333
|
+
if (!newValidDate) {
|
|
334
|
+
resetStartDateChanges();
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
newValueFrom = newValidDate;
|
|
338
|
+
}
|
|
339
|
+
const startEndOrderValid = !dateRangeMode || !value.to ? true : toReverseOffsetDateTime(newValueFrom) <= new Date(value.to);
|
|
340
|
+
const newStateValue = {
|
|
341
|
+
start: dateFormatter(toReverseOffsetDateTime(newValueFrom)),
|
|
342
|
+
end: startEndOrderValid ? dateRangeMode ? value.to ? dateFormatter(value.to) : "" : value.to || "" : dateFormatter(toReverseOffsetDateTime(newValueFrom)),
|
|
343
|
+
startAssistiveText: AssistiveText.None,
|
|
344
|
+
endAssistiveText: startEndOrderValid ? AssistiveText.None : AssistiveText.TimeAdjusted,
|
|
345
|
+
nextActiveField: startEndOrderValid ? undefined : "end"
|
|
346
|
+
};
|
|
347
|
+
const startDateToPass = toReverseOffsetDateTime(newValueFrom).toISOString();
|
|
348
|
+
const endDateToPass = startEndOrderValid ? value.to : toReverseOffsetDateTime(newValueFrom).toISOString();
|
|
349
|
+
currentDateValuesRef.current = {
|
|
350
|
+
from: startDateToPass,
|
|
351
|
+
to: endDateToPass
|
|
352
|
+
};
|
|
353
|
+
dispatchState({
|
|
354
|
+
type: DateInputInnerStateActionType.ChangePeriod,
|
|
355
|
+
payload: newStateValue
|
|
356
|
+
});
|
|
357
|
+
dispatchState({
|
|
358
|
+
type: DateInputInnerStateActionType.ChangeStartAssistiveText,
|
|
359
|
+
payload: AssistiveText.None
|
|
360
|
+
});
|
|
361
|
+
onChange({
|
|
362
|
+
from: startDateToPass,
|
|
363
|
+
to: endDateToPass
|
|
364
|
+
});
|
|
365
|
+
}, [value.from, value.to, toLocalDateTime, adjustTime, toReverseOffsetDateTime, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter, dateRangeMode, dateFormatter, onChange, resetStartDateChanges]);
|
|
366
|
+
const resetEndDateChanges = useCallback((resetKeydownBehavior = false) => {
|
|
367
|
+
dispatchState({
|
|
368
|
+
type: DateInputInnerStateActionType.ChangeEndDateText,
|
|
369
|
+
payload: value.to ? dateFormatter(value.to) : ""
|
|
370
|
+
});
|
|
371
|
+
resetKeydownBehavior && dispatchState({
|
|
372
|
+
type: DateInputInnerStateActionType.ChangeInputKeydownBehavior,
|
|
373
|
+
payload: undefined
|
|
374
|
+
});
|
|
375
|
+
}, [dateFormatter, value.to]);
|
|
376
|
+
const endDateChangeHandler = useCallback((e, isBlur = false) => {
|
|
377
|
+
const newValue = e.target.value;
|
|
378
|
+
currentSelectedFieldRef.current = undefined;
|
|
379
|
+
let deformattedDate = dateDeformatter(newValue);
|
|
380
|
+
if (!isValidDate(deformattedDate)) {
|
|
381
|
+
resetEndDateChanges(true);
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
deformattedDate = adjustTime(deformattedDate, value.to ? toLocalDateTime(value.to) : undefined);
|
|
385
|
+
if (isValidationDateError(deformattedDate, toReverseOffsetDateTime, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter)) {
|
|
386
|
+
// if date is invalid, do not update the state
|
|
387
|
+
resetEndDateChanges(true);
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
const newValidDates = getValidDatesForEnd(toReverseOffsetDateTime, deformattedDate, value.from ? toLocalDateTime(value.from) : undefined, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter);
|
|
391
|
+
const newStateValue = {
|
|
392
|
+
start: newValidDates.start ? dateFormatter(toReverseOffsetDateTime(newValidDates.start)) : "",
|
|
393
|
+
end: dateFormatter(toReverseOffsetDateTime(newValidDates.end)),
|
|
394
|
+
startAssistiveText: isBlur && state.currentActiveField === "end" ? value.from && newValidDates.start && newValidDates.start.getTime() !== new Date(toLocalDateTime(value.from)).getTime() ? AssistiveText.DateAdjusted : AssistiveText.None : undefined,
|
|
395
|
+
endAssistiveText: isBlur && state.currentActiveField === "end" ? AssistiveText.None : undefined
|
|
396
|
+
};
|
|
397
|
+
const startDateToPass = newValidDates.start ? toReverseOffsetDateTime(newValidDates.start).toISOString() : undefined;
|
|
398
|
+
const endDateToPass = toReverseOffsetDateTime(newValidDates.end).toISOString();
|
|
399
|
+
currentDateValuesRef.current = {
|
|
400
|
+
from: startDateToPass,
|
|
401
|
+
to: endDateToPass
|
|
402
|
+
};
|
|
403
|
+
dispatchState({
|
|
404
|
+
type: DateInputInnerStateActionType.ChangePeriod,
|
|
405
|
+
payload: newStateValue
|
|
406
|
+
});
|
|
407
|
+
const isDateChanged = value.from !== startDateToPass || value.to !== endDateToPass;
|
|
408
|
+
isDateChanged && onChange({
|
|
409
|
+
from: startDateToPass,
|
|
410
|
+
to: endDateToPass
|
|
411
|
+
});
|
|
412
|
+
}, [dateDeformatter, adjustTime, value.to, value.from, toReverseOffsetDateTime, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter, toLocalDateTime, dateFormatter, state.currentActiveField, onChange, resetEndDateChanges]);
|
|
413
|
+
const endDateChangeOnArrow = useCallback((oldValue, delta) => {
|
|
414
|
+
let deformattedDate = dateDeformatter(oldValue);
|
|
415
|
+
deformattedDate.setDate(deformattedDate.getDate() + delta);
|
|
416
|
+
if (!isValidDate(deformattedDate)) {
|
|
417
|
+
resetEndDateChanges();
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
deformattedDate = adjustTime(deformattedDate, value.to ? toLocalDateTime(value.to) : undefined);
|
|
421
|
+
if (isValidationDateError(deformattedDate, toReverseOffsetDateTime, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter)) {
|
|
422
|
+
// if date is invalid, do not update the state
|
|
423
|
+
resetEndDateChanges();
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
const newValidDates = getValidDatesForEnd(toReverseOffsetDateTime, deformattedDate, value.from ? toLocalDateTime(value.from) : undefined, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter);
|
|
427
|
+
const newStateValue = {
|
|
428
|
+
emittedBy: "end",
|
|
429
|
+
start: newValidDates.start ? dateFormatter(toReverseOffsetDateTime(newValidDates.start)) : "",
|
|
430
|
+
end: dateFormatter(toReverseOffsetDateTime(newValidDates.end)),
|
|
431
|
+
startAssistiveText: value.from && newValidDates.start && newValidDates.start.getTime() !== new Date(toLocalDateTime(value.from)).getTime() ? AssistiveText.DateAdjusted : AssistiveText.None,
|
|
432
|
+
endAssistiveText: AssistiveText.None,
|
|
433
|
+
inputKeyDownBehavior: "end"
|
|
434
|
+
};
|
|
435
|
+
const startDateToPass = newValidDates.start ? toReverseOffsetDateTime(newValidDates.start).toISOString() : undefined;
|
|
436
|
+
const endDateToPass = toReverseOffsetDateTime(newValidDates.end).toISOString();
|
|
437
|
+
currentDateValuesRef.current = {
|
|
438
|
+
from: startDateToPass,
|
|
439
|
+
to: endDateToPass
|
|
440
|
+
};
|
|
441
|
+
dispatchState({
|
|
442
|
+
type: DateInputInnerStateActionType.ChangePeriod,
|
|
443
|
+
payload: newStateValue
|
|
444
|
+
});
|
|
445
|
+
onChange({
|
|
446
|
+
from: startDateToPass,
|
|
447
|
+
to: endDateToPass
|
|
448
|
+
});
|
|
449
|
+
currentSelectedFieldRef.current = endInputRef.current || undefined;
|
|
450
|
+
}, [dateDeformatter, adjustTime, value.to, value.from, toReverseOffsetDateTime, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter, toLocalDateTime, dateFormatter, onChange, resetEndDateChanges]);
|
|
451
|
+
const endTimeChangeHandler = useCallback(time => {
|
|
452
|
+
const endDateToCopyTime = time;
|
|
453
|
+
currentSelectedFieldRef.current = undefined;
|
|
454
|
+
let newValueTo = value.to ? toLocalDateTime(value.to) : endDateToCopyTime;
|
|
455
|
+
newValueTo = adjustTime(newValueTo, endDateToCopyTime);
|
|
456
|
+
if (!isValidDate(newValueTo)) {
|
|
457
|
+
resetEndDateChanges();
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
if (isValidationDateError(newValueTo, toReverseOffsetDateTime, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter)) {
|
|
461
|
+
const newValidDate = getValidTime(newValueTo, value.to, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter);
|
|
462
|
+
if (!newValidDate) {
|
|
463
|
+
resetEndDateChanges();
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
newValueTo = newValidDate;
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
const startEndOrderValid = !dateRangeMode || !value.from ? true : new Date(value.from) <= toReverseOffsetDateTime(newValueTo);
|
|
470
|
+
const newStateValue = {
|
|
471
|
+
start: startEndOrderValid ? value.from ? dateFormatter(toReverseOffsetDateTime(value.from)) : "" : dateFormatter(toReverseOffsetDateTime(newValueTo)),
|
|
472
|
+
end: dateFormatter(toReverseOffsetDateTime(newValueTo)),
|
|
473
|
+
startAssistiveText: startEndOrderValid ? AssistiveText.None : AssistiveText.TimeAdjusted,
|
|
474
|
+
endAssistiveText: AssistiveText.None,
|
|
475
|
+
nextActiveField: startEndOrderValid ? undefined : "start"
|
|
476
|
+
};
|
|
477
|
+
const startDateToPass = startEndOrderValid ? value.from : toReverseOffsetDateTime(newValueTo).toISOString();
|
|
478
|
+
const endDateToPass = toReverseOffsetDateTime(newValueTo).toISOString();
|
|
479
|
+
currentDateValuesRef.current = {
|
|
480
|
+
from: startDateToPass,
|
|
481
|
+
to: endDateToPass
|
|
482
|
+
};
|
|
483
|
+
dispatchState({
|
|
484
|
+
type: DateInputInnerStateActionType.ChangePeriod,
|
|
485
|
+
payload: newStateValue
|
|
486
|
+
});
|
|
487
|
+
dispatchState({
|
|
488
|
+
type: DateInputInnerStateActionType.ChangeEndAssistiveText,
|
|
489
|
+
payload: AssistiveText.None
|
|
490
|
+
});
|
|
491
|
+
onChange({
|
|
492
|
+
from: startDateToPass,
|
|
493
|
+
to: endDateToPass
|
|
494
|
+
});
|
|
495
|
+
}, [value.to, value.from, toLocalDateTime, adjustTime, toReverseOffsetDateTime, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter, dateRangeMode, dateFormatter, onChange, resetEndDateChanges]);
|
|
496
|
+
const getCurrentActiveField = useCallback(() => state.currentActiveField, [state.currentActiveField]);
|
|
497
|
+
// eslint-disable-next-line complexity
|
|
498
|
+
const calendarChangeHandler = useCallback((range, currentActiveField) => {
|
|
499
|
+
currentSelectedFieldRef.current = dateRangeMode ? undefined : startInputRef.current || undefined;
|
|
500
|
+
let currentStartDate = range.from && new Date(range.from);
|
|
501
|
+
const startDateToCopyTime = value.from ? toLocalDateTime(value.from) : timePickerValueFromPrev || new Date(toDayStart(toLocalDateTime(new Date()).toISOString()));
|
|
502
|
+
let currentEndDate = range.to && new Date(range.to);
|
|
503
|
+
const endDateToCopyTime = value.to ? toLocalDateTime(value.to) : timePickerValueToPrev || new Date(toDayStart(toLocalDateTime(new Date()).toISOString()));
|
|
504
|
+
let rangeFrom = range.from;
|
|
505
|
+
let rangeTo = range.to;
|
|
506
|
+
if (currentStartDate) {
|
|
507
|
+
currentStartDate = adjustTime(currentStartDate, startDateToCopyTime);
|
|
508
|
+
const isValidationError = isValidationDateError(currentStartDate, toReverseOffsetDateTime, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter);
|
|
509
|
+
rangeFrom = toReverseOffsetDateTime(isValidationError ? new Date(range.from) : currentStartDate).toISOString();
|
|
510
|
+
}
|
|
511
|
+
if (currentEndDate) {
|
|
512
|
+
currentEndDate = adjustTime(currentEndDate, endDateToCopyTime);
|
|
513
|
+
const isValidationError = isValidationDateError(currentEndDate, toReverseOffsetDateTime, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter);
|
|
514
|
+
rangeTo = toReverseOffsetDateTime(isValidationError ? new Date(range.to) : currentEndDate).toISOString();
|
|
515
|
+
}
|
|
516
|
+
if (rangeFrom && rangeTo && new Date(rangeFrom) > new Date(rangeTo)) {
|
|
517
|
+
range.from = !currentActiveField || currentActiveField === "start" ? rangeFrom : rangeTo;
|
|
518
|
+
range.to = currentActiveField && currentActiveField === "end" ? rangeTo : rangeFrom;
|
|
519
|
+
} else {
|
|
520
|
+
range.from = rangeFrom || (dateRangeMode ? rangeTo : undefined);
|
|
521
|
+
range.to = rangeTo || (dateRangeMode ? rangeFrom : undefined);
|
|
522
|
+
}
|
|
523
|
+
const newStateValue = {
|
|
524
|
+
start: range.from ? dateFormatter(range.from) : "",
|
|
525
|
+
end: range.to ? dateFormatter(range.to) : "",
|
|
526
|
+
hasAssistiveText: currentActiveField === "start" ? range.to !== value.to : range.from !== value.from
|
|
527
|
+
};
|
|
528
|
+
currentDateValuesRef.current = Object.assign({}, range);
|
|
529
|
+
dispatchState({
|
|
530
|
+
type: DateInputInnerStateActionType.ChangeCalendarValue,
|
|
531
|
+
payload: newStateValue
|
|
532
|
+
});
|
|
533
|
+
onChange(range);
|
|
534
|
+
}, [dateRangeMode, value.from, value.to, toLocalDateTime, timePickerValueFromPrev, timePickerValueToPrev, dateFormatter, onChange, adjustTime, toReverseOffsetDateTime, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter]);
|
|
535
|
+
const handleSetStartDateText = useCallback(e => {
|
|
536
|
+
dispatchState({
|
|
537
|
+
type: DateInputInnerStateActionType.ChangeStartDateText,
|
|
538
|
+
payload: e.target.value
|
|
539
|
+
});
|
|
540
|
+
}, []);
|
|
541
|
+
const handleSetEndDateText = useCallback(e => {
|
|
542
|
+
dispatchState({
|
|
543
|
+
type: DateInputInnerStateActionType.ChangeEndDateText,
|
|
544
|
+
payload: e.target.value
|
|
545
|
+
});
|
|
546
|
+
}, []);
|
|
547
|
+
// eslint-disable-next-line complexity
|
|
548
|
+
const handleOnClick = useCallback(e => {
|
|
549
|
+
if (e.target instanceof HTMLElement && e.target.tagName === "INPUT" && e.target.getAttribute("id") === state.startDateId) {
|
|
550
|
+
state.currentActiveField === "end" && dispatchState({
|
|
551
|
+
type: DateInputInnerStateActionType.ChangeActiveField,
|
|
552
|
+
payload: "start"
|
|
553
|
+
});
|
|
554
|
+
state.currentActiveField === "start" && dispatchState({
|
|
555
|
+
type: DateInputInnerStateActionType.ChangeInputKeydownBehavior,
|
|
556
|
+
payload: undefined
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
if (e.target instanceof HTMLElement && e.target.tagName === "INPUT" && e.target.getAttribute("id") === state.endDateId) {
|
|
560
|
+
state.currentActiveField === "start" && dispatchState({
|
|
561
|
+
type: DateInputInnerStateActionType.ChangeActiveField,
|
|
562
|
+
payload: "end"
|
|
563
|
+
});
|
|
564
|
+
state.currentActiveField === "end" && dispatchState({
|
|
565
|
+
type: DateInputInnerStateActionType.ChangeInputKeydownBehavior,
|
|
566
|
+
payload: undefined
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
let targetEl = e.target === e.currentTarget ? undefined : e.target;
|
|
570
|
+
while (targetEl) {
|
|
571
|
+
if (targetEl instanceof HTMLElement && targetEl.tagName === "BUTTON" && targetEl.getAttribute("data-time") === state.startDateId) {
|
|
572
|
+
targetEl = undefined;
|
|
573
|
+
}
|
|
574
|
+
if (targetEl instanceof HTMLElement && targetEl.tagName === "BUTTON" && targetEl.getAttribute("data-time") === state.endDateId) {
|
|
575
|
+
targetEl = undefined;
|
|
576
|
+
}
|
|
577
|
+
targetEl = !targetEl || targetEl.parentNode === e.currentTarget ? undefined : targetEl.parentNode;
|
|
578
|
+
}
|
|
579
|
+
}, [state.currentActiveField, state.endDateId, state.startDateId]);
|
|
580
|
+
// eslint-disable-next-line complexity
|
|
581
|
+
const handleOnKeyDown = useCallback(e => {
|
|
582
|
+
if (e.key === "Enter") {
|
|
583
|
+
if (e.target instanceof HTMLElement && e.target.tagName === "INPUT" && e.target.getAttribute("id") === state.startDateId) {
|
|
584
|
+
state.currentActiveField === "start" && startDateChangeHandler(e, true);
|
|
585
|
+
dispatchState({
|
|
586
|
+
type: DateInputInnerStateActionType.ToggleActiveField
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
if (e.target instanceof HTMLElement && e.target.tagName === "INPUT" && e.target.getAttribute("id") === state.endDateId) {
|
|
590
|
+
state.currentActiveField === "end" && endDateChangeHandler(e, true);
|
|
591
|
+
dispatchState({
|
|
592
|
+
type: DateInputInnerStateActionType.ToggleActiveField
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
if (e.key === "Tab") {
|
|
597
|
+
if (e.target instanceof HTMLElement && e.target.tagName === "INPUT" && e.target.getAttribute("id") === state.startDateId) {
|
|
90
598
|
currentSelectedFieldRef.current = undefined;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
const newValidDates = getValidDatesForStart(toReverseOffsetDateTime, deformattedDate, value.to ? toLocalDateTime(value.to) : undefined, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter);
|
|
103
|
-
const newStateValue = {
|
|
104
|
-
start: dateFormatter(toReverseOffsetDateTime(newValidDates.start)),
|
|
105
|
-
end: dateRangeMode ? (newValidDates.end ? dateFormatter(toReverseOffsetDateTime(newValidDates.end)) : "") : value.to || "",
|
|
106
|
-
startAssistiveText: isBlur && state.currentActiveField === "start" ? AssistiveText.None : undefined,
|
|
107
|
-
endAssistiveText: isBlur && state.currentActiveField === "start"
|
|
108
|
-
? (value.to && newValidDates.end && (newValidDates.end.getTime() !== new Date(toLocalDateTime(value.to)).getTime()) ? AssistiveText.DateAdjusted : AssistiveText.None)
|
|
109
|
-
: undefined
|
|
110
|
-
};
|
|
111
|
-
const startDateToPass = toReverseOffsetDateTime(newValidDates.start).toISOString();
|
|
112
|
-
const endDateToPass = dateRangeMode ? (newValidDates.end ? toReverseOffsetDateTime(newValidDates.end).toISOString() : undefined) : value.to;
|
|
113
|
-
currentDateValuesRef.current = { from: startDateToPass, to: endDateToPass };
|
|
114
|
-
dispatchState({ type: DateInputInnerStateActionType.ChangePeriod, payload: newStateValue });
|
|
115
|
-
const isDateChanged = value.from !== startDateToPass || value.to !== endDateToPass;
|
|
116
|
-
isDateChanged && onChange({ from: startDateToPass, to: endDateToPass });
|
|
117
|
-
}, [dateDeformatter, adjustTime, value.from, value.to, toReverseOffsetDateTime, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter,
|
|
118
|
-
toLocalDateTime, dateFormatter, dateRangeMode, state.currentActiveField, onChange, resetStartDateChanges]);
|
|
119
|
-
const startDateChangeOnArrow = useCallback((oldValue, delta) => {
|
|
120
|
-
let deformattedDate = dateDeformatter(oldValue);
|
|
121
|
-
deformattedDate.setDate(deformattedDate.getDate() + delta);
|
|
122
|
-
if (!isValidDate(deformattedDate)) {
|
|
123
|
-
resetStartDateChanges();
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
deformattedDate = adjustTime(deformattedDate, value.from ? toLocalDateTime(value.from) : undefined);
|
|
127
|
-
if (isValidationDateError(deformattedDate, toReverseOffsetDateTime, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter)) {
|
|
128
|
-
// if date is invalid, do not update the state
|
|
129
|
-
resetStartDateChanges();
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
const newValidDates = getValidDatesForStart(toReverseOffsetDateTime, deformattedDate, value.to ? toLocalDateTime(value.to) : undefined, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter);
|
|
133
|
-
const newStateValue = {
|
|
134
|
-
emittedBy: "start",
|
|
135
|
-
start: dateFormatter(toReverseOffsetDateTime(newValidDates.start)),
|
|
136
|
-
end: dateRangeMode ? (newValidDates.end ? dateFormatter(toReverseOffsetDateTime(newValidDates.end)) : "") : value.to || "",
|
|
137
|
-
startAssistiveText: AssistiveText.None,
|
|
138
|
-
endAssistiveText: (value.to && newValidDates.end && (newValidDates.end.getTime() !== new Date(toLocalDateTime(value.to)).getTime()) ? AssistiveText.DateAdjusted : AssistiveText.None),
|
|
139
|
-
inputKeyDownBehavior: "start"
|
|
140
|
-
};
|
|
141
|
-
const startDateToPass = toReverseOffsetDateTime(newValidDates.start).toISOString();
|
|
142
|
-
const endDateToPass = dateRangeMode ? (newValidDates.end ? toReverseOffsetDateTime(newValidDates.end).toISOString() : undefined) : value.to;
|
|
143
|
-
currentDateValuesRef.current = { from: startDateToPass, to: endDateToPass };
|
|
144
|
-
dispatchState({ type: DateInputInnerStateActionType.ChangePeriod, payload: newStateValue });
|
|
145
|
-
onChange({ from: startDateToPass, to: endDateToPass });
|
|
146
|
-
currentSelectedFieldRef.current = startInputRef.current || undefined;
|
|
147
|
-
}, [dateDeformatter, adjustTime, value.from, value.to, toReverseOffsetDateTime, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter, toLocalDateTime, dateFormatter,
|
|
148
|
-
dateRangeMode, onChange, resetStartDateChanges]);
|
|
149
|
-
const startTimeChangeHandler = useCallback((time) => {
|
|
599
|
+
state.currentActiveField === "start" && dispatchState({
|
|
600
|
+
type: DateInputInnerStateActionType.ChangeStartAssistiveText,
|
|
601
|
+
payload: AssistiveText.None
|
|
602
|
+
});
|
|
603
|
+
state.currentActiveField === "start" && dispatchState({
|
|
604
|
+
type: DateInputInnerStateActionType.ChangeInputKeydownBehavior,
|
|
605
|
+
payload: undefined
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
if (e.target instanceof HTMLElement && e.target.tagName === "INPUT" && e.target.getAttribute("id") === state.endDateId) {
|
|
150
609
|
currentSelectedFieldRef.current = undefined;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const startEndOrderValid = !dateRangeMode || !value.to ? true : toReverseOffsetDateTime(newValueFrom) <= new Date(value.to);
|
|
167
|
-
const newStateValue = {
|
|
168
|
-
start: dateFormatter(toReverseOffsetDateTime(newValueFrom)),
|
|
169
|
-
end: startEndOrderValid ? (dateRangeMode ? (value.to ? dateFormatter(value.to) : "") : value.to || "") : dateFormatter(toReverseOffsetDateTime(newValueFrom)),
|
|
170
|
-
startAssistiveText: AssistiveText.None,
|
|
171
|
-
endAssistiveText: startEndOrderValid ? AssistiveText.None : AssistiveText.TimeAdjusted,
|
|
172
|
-
nextActiveField: startEndOrderValid ? undefined : "end"
|
|
173
|
-
};
|
|
174
|
-
const startDateToPass = toReverseOffsetDateTime(newValueFrom).toISOString();
|
|
175
|
-
const endDateToPass = startEndOrderValid ? value.to : toReverseOffsetDateTime(newValueFrom).toISOString();
|
|
176
|
-
currentDateValuesRef.current = { from: startDateToPass, to: endDateToPass };
|
|
177
|
-
dispatchState({ type: DateInputInnerStateActionType.ChangePeriod, payload: newStateValue });
|
|
178
|
-
dispatchState({ type: DateInputInnerStateActionType.ChangeStartAssistiveText, payload: AssistiveText.None });
|
|
179
|
-
onChange({ from: startDateToPass, to: endDateToPass });
|
|
180
|
-
}, [value.from, value.to, toLocalDateTime, adjustTime, toReverseOffsetDateTime, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter, dateRangeMode,
|
|
181
|
-
dateFormatter, onChange, resetStartDateChanges]);
|
|
182
|
-
const resetEndDateChanges = useCallback((resetKeydownBehavior = false) => {
|
|
183
|
-
dispatchState({ type: DateInputInnerStateActionType.ChangeEndDateText, payload: value.to ? dateFormatter(value.to) : "" });
|
|
184
|
-
resetKeydownBehavior && dispatchState({ type: DateInputInnerStateActionType.ChangeInputKeydownBehavior, payload: undefined });
|
|
185
|
-
}, [dateFormatter, value.to]);
|
|
186
|
-
const endDateChangeHandler = useCallback((e, isBlur = false) => {
|
|
610
|
+
state.currentActiveField === "end" && dispatchState({
|
|
611
|
+
type: DateInputInnerStateActionType.ChangeEndAssistiveText,
|
|
612
|
+
payload: AssistiveText.None
|
|
613
|
+
});
|
|
614
|
+
state.currentActiveField === "end" && dispatchState({
|
|
615
|
+
type: DateInputInnerStateActionType.ChangeInputKeydownBehavior,
|
|
616
|
+
payload: undefined
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
if (e.key === "Backspace" && e.target instanceof HTMLElement && e.target.tagName === "INPUT") {
|
|
621
|
+
currentSelectedFieldRef.current = undefined;
|
|
622
|
+
}
|
|
623
|
+
if (e.key === "ArrowDown" && state.inputKeyDownBehavior) {
|
|
624
|
+
if (e.target instanceof HTMLElement && e.target.tagName === "INPUT" && e.target.getAttribute("id") === state.startDateId) {
|
|
187
625
|
const newValue = e.target.value;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
currentSelectedFieldRef.current = undefined;
|
|
362
|
-
state.currentActiveField === "start" && dispatchState({ type: DateInputInnerStateActionType.ChangeStartAssistiveText, payload: AssistiveText.None });
|
|
363
|
-
state.currentActiveField === "start" && dispatchState({ type: DateInputInnerStateActionType.ChangeInputKeydownBehavior, payload: undefined });
|
|
364
|
-
}
|
|
365
|
-
if (e.target instanceof HTMLElement && e.target.tagName === "INPUT" && e.target.getAttribute("id") === state.endDateId) {
|
|
366
|
-
currentSelectedFieldRef.current = undefined;
|
|
367
|
-
state.currentActiveField === "end" && dispatchState({ type: DateInputInnerStateActionType.ChangeEndAssistiveText, payload: AssistiveText.None });
|
|
368
|
-
state.currentActiveField === "end" && dispatchState({ type: DateInputInnerStateActionType.ChangeInputKeydownBehavior, payload: undefined });
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
if (e.key === "Backspace" && e.target instanceof HTMLElement && e.target.tagName === "INPUT") {
|
|
372
|
-
currentSelectedFieldRef.current = undefined;
|
|
373
|
-
}
|
|
374
|
-
if (e.key === "ArrowDown" && state.inputKeyDownBehavior) {
|
|
375
|
-
if (e.target instanceof HTMLElement && e.target.tagName === "INPUT" && e.target.getAttribute("id") === state.startDateId) {
|
|
376
|
-
const newValue = e.target.value;
|
|
377
|
-
startDateChangeOnArrow(newValue, 7);
|
|
378
|
-
}
|
|
379
|
-
if (e.target instanceof HTMLElement && e.target.tagName === "INPUT" && e.target.getAttribute("id") === state.endDateId) {
|
|
380
|
-
const newValue = e.target.value;
|
|
381
|
-
endDateChangeOnArrow(newValue, 7);
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
if (e.key === "ArrowUp" && state.inputKeyDownBehavior) {
|
|
385
|
-
if (e.target instanceof HTMLElement && e.target.tagName === "INPUT" && e.target.getAttribute("id") === state.startDateId) {
|
|
386
|
-
const newValue = e.target.value;
|
|
387
|
-
startDateChangeOnArrow(newValue, -7);
|
|
388
|
-
}
|
|
389
|
-
if (e.target instanceof HTMLElement && e.target.tagName === "INPUT" && e.target.getAttribute("id") === state.endDateId) {
|
|
390
|
-
const newValue = e.target.value;
|
|
391
|
-
endDateChangeOnArrow(newValue, -7);
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
if (e.key === "ArrowRight" && state.inputKeyDownBehavior) {
|
|
395
|
-
if (e.target instanceof HTMLElement && e.target.tagName === "INPUT" && e.target.getAttribute("id") === state.startDateId) {
|
|
396
|
-
const newValue = e.target.value;
|
|
397
|
-
startDateChangeOnArrow(newValue, 1);
|
|
398
|
-
}
|
|
399
|
-
if (e.target instanceof HTMLElement && e.target.tagName === "INPUT" && e.target.getAttribute("id") === state.endDateId) {
|
|
400
|
-
const newValue = e.target.value;
|
|
401
|
-
endDateChangeOnArrow(newValue, 1);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
if (e.key === "ArrowLeft" && state.inputKeyDownBehavior) {
|
|
405
|
-
if (e.target instanceof HTMLElement && e.target.tagName === "INPUT" && e.target.getAttribute("id") === state.startDateId) {
|
|
406
|
-
const newValue = e.target.value;
|
|
407
|
-
startDateChangeOnArrow(newValue, -1);
|
|
408
|
-
}
|
|
409
|
-
if (e.target instanceof HTMLElement && e.target.tagName === "INPUT" && e.target.getAttribute("id") === state.endDateId) {
|
|
410
|
-
const newValue = e.target.value;
|
|
411
|
-
endDateChangeOnArrow(newValue, -1);
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
}, [state.startDateId, state.endDateId, state.currentActiveField, state.inputKeyDownBehavior, startDateChangeHandler, endDateChangeHandler, startDateChangeOnArrow, endDateChangeOnArrow]);
|
|
415
|
-
const rangeArgs = useMemo(() => ({
|
|
416
|
-
onClick: handleOnClick,
|
|
417
|
-
onKeyDown: handleOnKeyDown
|
|
418
|
-
}), [handleOnClick, handleOnKeyDown]);
|
|
419
|
-
useEffect(() => {
|
|
420
|
-
var _a, _b, _c, _d;
|
|
421
|
-
if (state.currentActiveField === "start") {
|
|
422
|
-
(_a = startInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
423
|
-
state.inputKeyDownBehavior === "start" && ((_b = startInputRef.current) === null || _b === void 0 ? void 0 : _b.select());
|
|
424
|
-
}
|
|
425
|
-
if (state.currentActiveField === "end") {
|
|
426
|
-
(_c = endInputRef.current) === null || _c === void 0 ? void 0 : _c.focus();
|
|
427
|
-
state.inputKeyDownBehavior === "end" && ((_d = endInputRef.current) === null || _d === void 0 ? void 0 : _d.select());
|
|
428
|
-
}
|
|
429
|
-
}, [state.currentActiveField, state.inputKeyDownBehavior]);
|
|
430
|
-
useEffect(() => {
|
|
431
|
-
var _a, _b;
|
|
432
|
-
if (state.inputKeyDownBehavior === "start") {
|
|
433
|
-
(_a = startInputRef.current) === null || _a === void 0 ? void 0 : _a.select();
|
|
434
|
-
}
|
|
435
|
-
if (state.inputKeyDownBehavior === "end") {
|
|
436
|
-
(_b = endInputRef.current) === null || _b === void 0 ? void 0 : _b.select();
|
|
437
|
-
}
|
|
438
|
-
}, [state.inputKeyDownBehavior]);
|
|
439
|
-
const handleBlurStart = useCallback((e) => {
|
|
440
|
-
currentSelectedFieldRef.current = undefined;
|
|
441
|
-
startDateChangeHandler(e, true);
|
|
442
|
-
}, [startDateChangeHandler]);
|
|
443
|
-
const handleBlurEnd = useCallback((e) => {
|
|
444
|
-
currentSelectedFieldRef.current = undefined;
|
|
445
|
-
endDateChangeHandler(e, true);
|
|
446
|
-
}, [endDateChangeHandler]);
|
|
447
|
-
const handleTodayButtonClick = useCallback((e) => {
|
|
448
|
-
const currentActiveField = getCurrentActiveField();
|
|
449
|
-
let newValidDates;
|
|
450
|
-
if (currentActiveField === "start") {
|
|
451
|
-
const todayFromWithTime = adjustTime(toLocalDateTime(todayFrom), value.from ? toLocalDateTime(value.from) : undefined);
|
|
452
|
-
newValidDates = getValidDatesForStart(toReverseOffsetDateTime, todayFromWithTime, value.to ? toLocalDateTime(value.to) : undefined, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter);
|
|
453
|
-
}
|
|
454
|
-
else {
|
|
455
|
-
const todayToWithTime = adjustTime(toLocalDateTime(todayTo), value.to ? toLocalDateTime(value.to) : undefined);
|
|
456
|
-
newValidDates = getValidDatesForEnd(toReverseOffsetDateTime, todayToWithTime, value.from ? toLocalDateTime(value.from) : undefined, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter);
|
|
457
|
-
}
|
|
458
|
-
const startDateToPass = newValidDates.start ? toReverseOffsetDateTime(newValidDates.start).toISOString() : undefined;
|
|
459
|
-
const endDateToPass = newValidDates.end ? toReverseOffsetDateTime(newValidDates.end).toISOString() : undefined;
|
|
460
|
-
const newStateValue = {
|
|
461
|
-
start: newValidDates.start ? dateFormatter(toReverseOffsetDateTime(newValidDates.start)) : "",
|
|
462
|
-
end: newValidDates.end ? dateFormatter(toReverseOffsetDateTime(newValidDates.end)) : "",
|
|
463
|
-
startAssistiveText: currentActiveField === "end" && startDateToPass !== value.from ? AssistiveText.DateAdjusted : AssistiveText.None,
|
|
464
|
-
endAssistiveText: currentActiveField === "start" && endDateToPass !== value.to ? AssistiveText.DateAdjusted : AssistiveText.None
|
|
465
|
-
};
|
|
466
|
-
currentSelectedFieldRef.current = dateRangeMode ? undefined : startInputRef.current || undefined;
|
|
467
|
-
e.target.blur();
|
|
468
|
-
currentDateValuesRef.current = { from: startDateToPass, to: dateRangeMode ? endDateToPass : value.to };
|
|
469
|
-
dispatchState({ type: DateInputInnerStateActionType.ChangePeriod, payload: newStateValue });
|
|
470
|
-
dispatchState({ type: DateInputInnerStateActionType.ChangeActiveField, payload: currentActiveField === "start" ? "end" : "start" });
|
|
471
|
-
onChange({ from: startDateToPass, to: dateRangeMode ? endDateToPass : value.to });
|
|
472
|
-
}, [adjustTime, dateFormatter, dateRangeMode, disableDatesAfter, disableDatesBefore, disableFutureDates, disablePastDates, getCurrentActiveField, onChange, toLocalDateTime,
|
|
473
|
-
toReverseOffsetDateTime, todayFrom, todayTo, value.from, value.to]);
|
|
474
|
-
const memoizedStartInputComponent = useMemo(() => _jsx(DateInputInnerControlBlock, { className: "zen-date-input-inner__control-start", title: title || title === undefined ? title || translate(dateRangeMode ? "Start date" : "Pick a date") : undefined, id: state.startDateId, ref: startInputRef, dateText: state.startDateText, placeholder: dateFormat, handleSetDateText: handleSetStartDateText, onBlurDateChangeHandler: handleBlurStart, requireSelection: requireSelection, selectTime: selectTime, timePickerValue: timePickerValueFrom || timePickerValueFromPrev, isMobileView: isMobileView, timeChangeHandler: startTimeChangeHandler, isActiveField: dateRangeMode ? state.currentActiveField === "start" : false, assistiveText: dateRangeMode ? getAssistiveText(state.startAssistiveText, true) : undefined, isSelected: state.currentActiveField === "start" && state.inputKeyDownBehavior === "start" }), [title, translate, dateRangeMode, state.startDateId, state.startDateText, state.currentActiveField, state.startAssistiveText, state.inputKeyDownBehavior, dateFormat,
|
|
475
|
-
handleSetStartDateText, handleBlurStart, requireSelection, selectTime, timePickerValueFrom, timePickerValueFromPrev, isMobileView, startTimeChangeHandler, getAssistiveText]);
|
|
476
|
-
const memoizedEndInputComponent = useMemo(() => dateRangeMode
|
|
477
|
-
? _jsxs(_Fragment, { children: [_jsx("div", { className: "zen-date-input-inner__separator" }), _jsx(DateInputInnerControlBlock, { className: "zen-date-input-inner__control-end", title: translate("End date"), id: state.endDateId, ref: endInputRef, dateText: state.endDateText, placeholder: dateFormat, handleSetDateText: handleSetEndDateText, onBlurDateChangeHandler: handleBlurEnd, requireSelection: requireSelection, selectTime: selectTime, timePickerValue: timePickerValueTo || timePickerValueToPrev, isMobileView: isMobileView, timeChangeHandler: endTimeChangeHandler, isActiveField: state.currentActiveField === "end", assistiveText: getAssistiveText(state.endAssistiveText, false), isSelected: state.currentActiveField === "end" && state.inputKeyDownBehavior === "end" })] }) : null, [dateRangeMode, translate, state.endDateId, state.endDateText, state.currentActiveField, state.endAssistiveText, state.inputKeyDownBehavior, dateFormat, handleSetEndDateText, handleBlurEnd,
|
|
478
|
-
requireSelection, selectTime, timePickerValueTo, timePickerValueToPrev, isMobileView, endTimeChangeHandler, getAssistiveText]);
|
|
479
|
-
(_a = currentSelectedFieldRef.current) === null || _a === void 0 ? void 0 : _a.select();
|
|
480
|
-
return _jsxs("div", { className: classNames(["zen-date-input-inner", driveClassName || "", isMobileView ? "zen-date-input-inner--mobile-view" : ""]), children: [_jsxs("div", Object.assign({ className: "zen-date-input-inner__controls-block" }, rangeArgs, { children: [memoizedStartInputComponent, memoizedEndInputComponent] })), _jsx("div", { className: "zen-date-input-inner__calendar", children: _jsx(Calendar, { id: id, value: calendarValue, onChange: calendarChangeHandler, dateRangeMode: dateRangeMode, disableFutureDates: disableFutureDates, disablePastDates: disablePastDates, disableDatesAfter: disableDatesAfterValue, disableDatesBefore: disableDatesBeforeValue, startDayOfWeek: startDayOfWeek, yearRange: yearRange, isMobileView: isMobileView, getCurrentActiveField: dateRangeMode ? getCurrentActiveField : undefined, onTodayButtonClick: isTodayDisabled ? undefined : handleTodayButtonClick }) })] });
|
|
626
|
+
startDateChangeOnArrow(newValue, 7);
|
|
627
|
+
}
|
|
628
|
+
if (e.target instanceof HTMLElement && e.target.tagName === "INPUT" && e.target.getAttribute("id") === state.endDateId) {
|
|
629
|
+
const newValue = e.target.value;
|
|
630
|
+
endDateChangeOnArrow(newValue, 7);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
if (e.key === "ArrowUp" && state.inputKeyDownBehavior) {
|
|
634
|
+
if (e.target instanceof HTMLElement && e.target.tagName === "INPUT" && e.target.getAttribute("id") === state.startDateId) {
|
|
635
|
+
const newValue = e.target.value;
|
|
636
|
+
startDateChangeOnArrow(newValue, -7);
|
|
637
|
+
}
|
|
638
|
+
if (e.target instanceof HTMLElement && e.target.tagName === "INPUT" && e.target.getAttribute("id") === state.endDateId) {
|
|
639
|
+
const newValue = e.target.value;
|
|
640
|
+
endDateChangeOnArrow(newValue, -7);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
if (e.key === "ArrowRight" && state.inputKeyDownBehavior) {
|
|
644
|
+
if (e.target instanceof HTMLElement && e.target.tagName === "INPUT" && e.target.getAttribute("id") === state.startDateId) {
|
|
645
|
+
const newValue = e.target.value;
|
|
646
|
+
startDateChangeOnArrow(newValue, 1);
|
|
647
|
+
}
|
|
648
|
+
if (e.target instanceof HTMLElement && e.target.tagName === "INPUT" && e.target.getAttribute("id") === state.endDateId) {
|
|
649
|
+
const newValue = e.target.value;
|
|
650
|
+
endDateChangeOnArrow(newValue, 1);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
if (e.key === "ArrowLeft" && state.inputKeyDownBehavior) {
|
|
654
|
+
if (e.target instanceof HTMLElement && e.target.tagName === "INPUT" && e.target.getAttribute("id") === state.startDateId) {
|
|
655
|
+
const newValue = e.target.value;
|
|
656
|
+
startDateChangeOnArrow(newValue, -1);
|
|
657
|
+
}
|
|
658
|
+
if (e.target instanceof HTMLElement && e.target.tagName === "INPUT" && e.target.getAttribute("id") === state.endDateId) {
|
|
659
|
+
const newValue = e.target.value;
|
|
660
|
+
endDateChangeOnArrow(newValue, -1);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
}, [state.startDateId, state.endDateId, state.currentActiveField, state.inputKeyDownBehavior, startDateChangeHandler, endDateChangeHandler, startDateChangeOnArrow, endDateChangeOnArrow]);
|
|
664
|
+
const rangeArgs = useMemo(() => ({
|
|
665
|
+
onClick: handleOnClick,
|
|
666
|
+
onKeyDown: handleOnKeyDown
|
|
667
|
+
}), [handleOnClick, handleOnKeyDown]);
|
|
668
|
+
useEffect(() => {
|
|
669
|
+
var _a, _b, _c, _d;
|
|
670
|
+
if (state.currentActiveField === "start") {
|
|
671
|
+
(_a = startInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
672
|
+
state.inputKeyDownBehavior === "start" && ((_b = startInputRef.current) === null || _b === void 0 ? void 0 : _b.select());
|
|
673
|
+
}
|
|
674
|
+
if (state.currentActiveField === "end") {
|
|
675
|
+
(_c = endInputRef.current) === null || _c === void 0 ? void 0 : _c.focus();
|
|
676
|
+
state.inputKeyDownBehavior === "end" && ((_d = endInputRef.current) === null || _d === void 0 ? void 0 : _d.select());
|
|
677
|
+
}
|
|
678
|
+
}, [state.currentActiveField, state.inputKeyDownBehavior]);
|
|
679
|
+
useEffect(() => {
|
|
680
|
+
var _a, _b;
|
|
681
|
+
if (state.inputKeyDownBehavior === "start") {
|
|
682
|
+
(_a = startInputRef.current) === null || _a === void 0 ? void 0 : _a.select();
|
|
683
|
+
}
|
|
684
|
+
if (state.inputKeyDownBehavior === "end") {
|
|
685
|
+
(_b = endInputRef.current) === null || _b === void 0 ? void 0 : _b.select();
|
|
686
|
+
}
|
|
687
|
+
}, [state.inputKeyDownBehavior]);
|
|
688
|
+
const handleBlurStart = useCallback(e => {
|
|
689
|
+
currentSelectedFieldRef.current = undefined;
|
|
690
|
+
startDateChangeHandler(e, true);
|
|
691
|
+
}, [startDateChangeHandler]);
|
|
692
|
+
const handleBlurEnd = useCallback(e => {
|
|
693
|
+
currentSelectedFieldRef.current = undefined;
|
|
694
|
+
endDateChangeHandler(e, true);
|
|
695
|
+
}, [endDateChangeHandler]);
|
|
696
|
+
const handleTodayButtonClick = useCallback(e => {
|
|
697
|
+
const currentActiveField = getCurrentActiveField();
|
|
698
|
+
let newValidDates;
|
|
699
|
+
if (currentActiveField === "start") {
|
|
700
|
+
const todayFromWithTime = adjustTime(toLocalDateTime(todayFrom), value.from ? toLocalDateTime(value.from) : undefined);
|
|
701
|
+
newValidDates = getValidDatesForStart(toReverseOffsetDateTime, todayFromWithTime, value.to ? toLocalDateTime(value.to) : undefined, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter);
|
|
702
|
+
} else {
|
|
703
|
+
const todayToWithTime = adjustTime(toLocalDateTime(todayTo), value.to ? toLocalDateTime(value.to) : undefined);
|
|
704
|
+
newValidDates = getValidDatesForEnd(toReverseOffsetDateTime, todayToWithTime, value.from ? toLocalDateTime(value.from) : undefined, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter);
|
|
705
|
+
}
|
|
706
|
+
const startDateToPass = newValidDates.start ? toReverseOffsetDateTime(newValidDates.start).toISOString() : undefined;
|
|
707
|
+
const endDateToPass = newValidDates.end ? toReverseOffsetDateTime(newValidDates.end).toISOString() : undefined;
|
|
708
|
+
const newStateValue = {
|
|
709
|
+
start: newValidDates.start ? dateFormatter(toReverseOffsetDateTime(newValidDates.start)) : "",
|
|
710
|
+
end: newValidDates.end ? dateFormatter(toReverseOffsetDateTime(newValidDates.end)) : "",
|
|
711
|
+
startAssistiveText: currentActiveField === "end" && startDateToPass !== value.from ? AssistiveText.DateAdjusted : AssistiveText.None,
|
|
712
|
+
endAssistiveText: currentActiveField === "start" && endDateToPass !== value.to ? AssistiveText.DateAdjusted : AssistiveText.None
|
|
713
|
+
};
|
|
714
|
+
currentSelectedFieldRef.current = dateRangeMode ? undefined : startInputRef.current || undefined;
|
|
715
|
+
e.target.blur();
|
|
716
|
+
currentDateValuesRef.current = {
|
|
717
|
+
from: startDateToPass,
|
|
718
|
+
to: dateRangeMode ? endDateToPass : value.to
|
|
719
|
+
};
|
|
720
|
+
dispatchState({
|
|
721
|
+
type: DateInputInnerStateActionType.ChangePeriod,
|
|
722
|
+
payload: newStateValue
|
|
723
|
+
});
|
|
724
|
+
dispatchState({
|
|
725
|
+
type: DateInputInnerStateActionType.ChangeActiveField,
|
|
726
|
+
payload: currentActiveField === "start" ? "end" : "start"
|
|
727
|
+
});
|
|
728
|
+
onChange({
|
|
729
|
+
from: startDateToPass,
|
|
730
|
+
to: dateRangeMode ? endDateToPass : value.to
|
|
731
|
+
});
|
|
732
|
+
}, [adjustTime, dateFormatter, dateRangeMode, disableDatesAfter, disableDatesBefore, disableFutureDates, disablePastDates, getCurrentActiveField, onChange, toLocalDateTime, toReverseOffsetDateTime, todayFrom, todayTo, value.from, value.to]);
|
|
733
|
+
const memoizedStartInputComponent = useMemo(() => _jsx(DateInputInnerControlBlock, {
|
|
734
|
+
className: "zen-date-input-inner__control-start",
|
|
735
|
+
title: title || title === undefined ? title || (dateRangeMode ? translate("Start date") : translate("Pick a date")) : undefined,
|
|
736
|
+
id: state.startDateId,
|
|
737
|
+
ref: startInputRef,
|
|
738
|
+
dateText: state.startDateText,
|
|
739
|
+
placeholder: dateFormat,
|
|
740
|
+
handleSetDateText: handleSetStartDateText,
|
|
741
|
+
onBlurDateChangeHandler: handleBlurStart,
|
|
742
|
+
requireSelection: requireSelection,
|
|
743
|
+
selectTime: selectTime,
|
|
744
|
+
timePickerValue: timePickerValueFrom || timePickerValueFromPrev,
|
|
745
|
+
isMobileView: isMobileView,
|
|
746
|
+
timeChangeHandler: startTimeChangeHandler,
|
|
747
|
+
isActiveField: dateRangeMode ? state.currentActiveField === "start" : false,
|
|
748
|
+
assistiveText: dateRangeMode ? getAssistiveText(state.startAssistiveText, true) : undefined,
|
|
749
|
+
isSelected: state.currentActiveField === "start" && state.inputKeyDownBehavior === "start"
|
|
750
|
+
}), [title, translate, dateRangeMode, state.startDateId, state.startDateText, state.currentActiveField, state.startAssistiveText, state.inputKeyDownBehavior, dateFormat, handleSetStartDateText, handleBlurStart, requireSelection, selectTime, timePickerValueFrom, timePickerValueFromPrev, isMobileView, startTimeChangeHandler, getAssistiveText]);
|
|
751
|
+
const memoizedEndInputComponent = useMemo(() => dateRangeMode ? _jsxs(_Fragment, {
|
|
752
|
+
children: [_jsx("div", {
|
|
753
|
+
className: "zen-date-input-inner__separator"
|
|
754
|
+
}), _jsx(DateInputInnerControlBlock, {
|
|
755
|
+
className: "zen-date-input-inner__control-end",
|
|
756
|
+
title: translate("End date"),
|
|
757
|
+
id: state.endDateId,
|
|
758
|
+
ref: endInputRef,
|
|
759
|
+
dateText: state.endDateText,
|
|
760
|
+
placeholder: dateFormat,
|
|
761
|
+
handleSetDateText: handleSetEndDateText,
|
|
762
|
+
onBlurDateChangeHandler: handleBlurEnd,
|
|
763
|
+
requireSelection: requireSelection,
|
|
764
|
+
selectTime: selectTime,
|
|
765
|
+
timePickerValue: timePickerValueTo || timePickerValueToPrev,
|
|
766
|
+
isMobileView: isMobileView,
|
|
767
|
+
timeChangeHandler: endTimeChangeHandler,
|
|
768
|
+
isActiveField: state.currentActiveField === "end",
|
|
769
|
+
assistiveText: getAssistiveText(state.endAssistiveText, false),
|
|
770
|
+
isSelected: state.currentActiveField === "end" && state.inputKeyDownBehavior === "end"
|
|
771
|
+
})]
|
|
772
|
+
}) : null, [dateRangeMode, translate, state.endDateId, state.endDateText, state.currentActiveField, state.endAssistiveText, state.inputKeyDownBehavior, dateFormat, handleSetEndDateText, handleBlurEnd, requireSelection, selectTime, timePickerValueTo, timePickerValueToPrev, isMobileView, endTimeChangeHandler, getAssistiveText]);
|
|
773
|
+
(_a = currentSelectedFieldRef.current) === null || _a === void 0 ? void 0 : _a.select();
|
|
774
|
+
return _jsxs("div", {
|
|
775
|
+
className: classNames(["zen-date-input-inner", driveClassName || "", isMobileView ? "zen-date-input-inner--mobile-view" : ""]),
|
|
776
|
+
children: [_jsxs("div", Object.assign({
|
|
777
|
+
className: "zen-date-input-inner__controls-block"
|
|
778
|
+
}, rangeArgs, {
|
|
779
|
+
children: [memoizedStartInputComponent, memoizedEndInputComponent]
|
|
780
|
+
})), _jsx("div", {
|
|
781
|
+
className: "zen-date-input-inner__calendar",
|
|
782
|
+
children: _jsx(Calendar, {
|
|
783
|
+
id: id,
|
|
784
|
+
value: calendarValue,
|
|
785
|
+
onChange: calendarChangeHandler,
|
|
786
|
+
dateRangeMode: dateRangeMode,
|
|
787
|
+
disableFutureDates: disableFutureDates,
|
|
788
|
+
disablePastDates: disablePastDates,
|
|
789
|
+
disableDatesAfter: disableDatesAfterValue,
|
|
790
|
+
disableDatesBefore: disableDatesBeforeValue,
|
|
791
|
+
startDayOfWeek: startDayOfWeek,
|
|
792
|
+
yearRange: yearRange,
|
|
793
|
+
isMobileView: isMobileView,
|
|
794
|
+
getCurrentActiveField: dateRangeMode ? getCurrentActiveField : undefined,
|
|
795
|
+
onTodayButtonClick: isTodayDisabled ? undefined : handleTodayButtonClick
|
|
796
|
+
})
|
|
797
|
+
})]
|
|
798
|
+
});
|
|
481
799
|
};
|
|
482
|
-
export const TRANSLATIONS = [
|
|
483
|
-
"Pick a date",
|
|
484
|
-
"Start date",
|
|
485
|
-
"End date",
|
|
486
|
-
"Start date has been adjusted.",
|
|
487
|
-
"End date has been adjusted.",
|
|
488
|
-
"Start time has been adjusted.",
|
|
489
|
-
"End time has been adjusted."
|
|
490
|
-
];
|
|
800
|
+
export const TRANSLATIONS = ["Pick a date", "Start date", "End date", "Start date has been adjusted.", "End date has been adjusted.", "Start time has been adjusted.", "End time has been adjusted."];
|