@turnit-ou/shared 0.0.0-stage → 2.18.1
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/@types/@mui/index.d.ts +125 -0
- package/@types/axios/index.d.ts +7 -0
- package/@types/openapi-client-axios/index.d.ts +5 -0
- package/@types/openapi-typescript/index.d.ts +71 -0
- package/@types/react-final-form-arrays/index.d.ts +75 -0
- package/@types/react-table/index.d.ts +292 -0
- package/components/Alert/AlertTemplate.d.ts +3 -0
- package/components/Alert/AlertTemplate.js +66 -0
- package/components/Alert/index.d.ts +4 -0
- package/components/Alert/index.js +17 -0
- package/components/ConfirmButton.d.ts +15 -0
- package/components/ConfirmButton.js +47 -0
- package/components/Drawer.d.ts +4 -0
- package/components/Drawer.js +24 -0
- package/components/DrawerForm/DrawerFormCardActions.d.ts +5 -0
- package/components/DrawerForm/DrawerFormCardActions.js +21 -0
- package/components/DrawerForm/DrawerFormCloseButton.d.ts +3 -0
- package/components/DrawerForm/DrawerFormCloseButton.js +5 -0
- package/components/DrawerForm/DrawerFormContext.d.ts +7 -0
- package/components/DrawerForm/DrawerFormContext.js +4 -0
- package/components/DrawerForm.d.ts +10 -0
- package/components/DrawerForm.js +89 -0
- package/components/Editor/Editor.d.ts +9 -0
- package/components/Editor/Editor.js +36 -0
- package/components/Editor/Toolbar.d.ts +7 -0
- package/components/Editor/Toolbar.js +31 -0
- package/components/Editor/buttons/FormatLinkButton.d.ts +5 -0
- package/components/Editor/buttons/FormatLinkButton.js +64 -0
- package/components/Editor/buttons/InsertImageButton.d.ts +5 -0
- package/components/Editor/buttons/InsertImageButton.js +59 -0
- package/components/Editor/buttons.d.ts +15 -0
- package/components/Editor/buttons.js +70 -0
- package/components/Editor/createButton.d.ts +28 -0
- package/components/Editor/createButton.js +68 -0
- package/components/Editor/editor.scss +45 -0
- package/components/Ellipsis.d.ts +9 -0
- package/components/Ellipsis.js +22 -0
- package/components/EllipsisText.d.ts +8 -0
- package/components/EllipsisText.js +25 -0
- package/components/EnvironmentBanner.d.ts +8 -0
- package/components/EnvironmentBanner.js +25 -0
- package/components/Header/AccessibilityModal.d.ts +5 -0
- package/components/Header/AccessibilityModal.js +28 -0
- package/components/Header/AllowedBusinessEntityModal.d.ts +9 -0
- package/components/Header/AllowedBusinessEntityModal.js +24 -0
- package/components/Header/LanguageSelect.d.ts +2 -0
- package/components/Header/LanguageSelect.js +80 -0
- package/components/Header/MenuItems.d.ts +9 -0
- package/components/Header/MenuItems.js +55 -0
- package/components/Header/ModuleIcon.d.ts +7 -0
- package/components/Header/ModuleIcon.js +119 -0
- package/components/Header/index.d.ts +44 -0
- package/components/Header/index.js +89 -0
- package/components/Layout/LayoutCol.d.ts +8 -0
- package/components/Layout/LayoutCol.js +26 -0
- package/components/Layout/index.d.ts +32 -0
- package/components/Layout/index.js +56 -0
- package/components/Loadable.d.ts +11 -0
- package/components/Loadable.js +3 -0
- package/components/SearchCard.d.ts +8 -0
- package/components/SearchCard.js +81 -0
- package/components/SearchForm.d.ts +14 -0
- package/components/SearchForm.js +51 -0
- package/components/SearchFormTable.d.ts +8 -0
- package/components/SearchFormTable.js +32 -0
- package/components/SearchResult.d.ts +13 -0
- package/components/SearchResult.js +67 -0
- package/components/Table/TableCaption.d.ts +6 -0
- package/components/Table/TableCaption.js +25 -0
- package/components/Table/TableCell.d.ts +17 -0
- package/components/Table/TableCell.js +45 -0
- package/components/Table/TableCellEditable.d.ts +28 -0
- package/components/Table/TableCellEditable.js +151 -0
- package/components/Table/TableCellEditableAction.d.ts +13 -0
- package/components/Table/TableCellEditableAction.js +70 -0
- package/components/Table/TableCellEditableField.d.ts +17 -0
- package/components/Table/TableCellEditableField.js +1 -0
- package/components/Table/TableCellEditableTimeDuration.d.ts +13 -0
- package/components/Table/TableCellEditableTimeDuration.js +12 -0
- package/components/Table/TableContext.d.ts +11 -0
- package/components/Table/TableContext.js +4 -0
- package/components/Table/TablePagination.d.ts +5 -0
- package/components/Table/TablePagination.js +84 -0
- package/components/Table.d.ts +53 -0
- package/components/Table.js +389 -0
- package/components/Version.d.ts +5 -0
- package/components/Version.js +23 -0
- package/dto/businessEntity.d.ts +15 -0
- package/dto/businessEntity.js +1 -0
- package/dto/classification.d.ts +9 -0
- package/dto/classification.js +1 -0
- package/dto/classifier.d.ts +13 -0
- package/dto/classifier.js +4 -0
- package/dto/common.d.ts +5 -0
- package/dto/common.js +1 -0
- package/dto/fare.d.ts +11 -0
- package/dto/fare.js +1 -0
- package/dto/line-network.d.ts +23 -0
- package/dto/line-network.js +1 -0
- package/dto/option.d.ts +7 -0
- package/dto/option.js +1 -0
- package/dto/pagination.d.ts +10 -0
- package/dto/pagination.js +1 -0
- package/fields/FormCheckbox.d.ts +11 -0
- package/fields/FormCheckbox.js +5 -0
- package/fields/FormCheckboxGroup.d.ts +6 -0
- package/fields/FormCheckboxGroup.js +20 -0
- package/fields/FormController.d.ts +7 -0
- package/fields/FormController.js +16 -0
- package/fields/FormDatepicker.d.ts +8 -0
- package/fields/FormDatepicker.js +7 -0
- package/fields/FormInput.d.ts +8 -0
- package/fields/FormInput.js +4 -0
- package/fields/FormRadioGroup.d.ts +10 -0
- package/fields/FormRadioGroup.js +6 -0
- package/fields/FormSelect.d.ts +11 -0
- package/fields/FormSelect.js +9 -0
- package/fields/FormSwitch.d.ts +11 -0
- package/fields/FormSwitch.js +5 -0
- package/fields/FormTimeZoneSelect.d.ts +4 -0
- package/fields/FormTimeZoneSelect.js +8 -0
- package/fields/index.d.ts +9 -0
- package/fields/index.js +9 -0
- package/form/ArrayField.d.ts +27 -0
- package/form/ArrayField.js +69 -0
- package/form/CheckboxField.d.ts +8 -0
- package/form/CheckboxField.js +14 -0
- package/form/CheckboxGroupField.d.ts +6 -0
- package/form/CheckboxGroupField.js +15 -0
- package/form/ConditionField.d.ts +7 -0
- package/form/ConditionField.js +20 -0
- package/form/ContentField.d.ts +7 -0
- package/form/ContentField.js +15 -0
- package/form/CounterField.d.ts +5 -0
- package/form/CounterField.js +7 -0
- package/form/DateField.d.ts +8 -0
- package/form/DateField.js +52 -0
- package/form/DatesArrayField.d.ts +8 -0
- package/form/DatesArrayField.js +79 -0
- package/form/DependSelectField.d.ts +8 -0
- package/form/DependSelectField.js +12 -0
- package/form/EditorField.d.ts +5 -0
- package/form/EditorField.js +7 -0
- package/form/FileField.d.ts +12 -0
- package/form/FileField.js +9 -0
- package/form/FormField.d.ts +15 -0
- package/form/FormField.js +22 -0
- package/form/ModalFieldArray.d.ts +13 -0
- package/form/ModalFieldArray.js +62 -0
- package/form/PeriodField.d.ts +24 -0
- package/form/PeriodField.js +111 -0
- package/form/RadioGroupField.d.ts +10 -0
- package/form/RadioGroupField.js +21 -0
- package/form/SearchField.d.ts +19 -0
- package/form/SearchField.js +51 -0
- package/form/SelectField.d.ts +8 -0
- package/form/SelectField.js +13 -0
- package/form/SelectOwnerField.d.ts +11 -0
- package/form/SelectOwnerField.js +11 -0
- package/form/StopsSelect/StopSelectWithSearch.d.ts +28 -0
- package/form/StopsSelect/StopSelectWithSearch.js +181 -0
- package/form/StopsSelect/StopsSelect.d.ts +19 -0
- package/form/StopsSelect/StopsSelect.js +65 -0
- package/form/StopsSelect/StopsSelectModal.d.ts +26 -0
- package/form/StopsSelect/StopsSelectModal.js +280 -0
- package/form/StopsSelect/StopsSelectSearchForm.d.ts +22 -0
- package/form/StopsSelect/StopsSelectSearchForm.js +43 -0
- package/form/SwitchField.d.ts +9 -0
- package/form/SwitchField.js +16 -0
- package/form/TextField.d.ts +6 -0
- package/form/TextField.js +21 -0
- package/form/TimeDurationField.d.ts +6 -0
- package/form/TimeDurationField.js +54 -0
- package/form/TimeZoneField.d.ts +6 -0
- package/form/TimeZoneField.js +8 -0
- package/form/ToggleButtonGroupField.d.ts +12 -0
- package/form/ToggleButtonGroupField.js +16 -0
- package/form/hooks/addLazyFieldMetaState.d.ts +3 -0
- package/form/hooks/addLazyFieldMetaState.js +55 -0
- package/form/hooks/getValue.d.ts +3 -0
- package/form/hooks/getValue.js +60 -0
- package/form/hooks/useConstant.d.ts +13 -0
- package/form/hooks/useConstant.js +20 -0
- package/form/hooks/useConstantCallback.d.ts +7 -0
- package/form/hooks/useConstantCallback.js +14 -0
- package/form/hooks/useField.d.ts +3 -0
- package/form/hooks/useField.js +175 -0
- package/form/hooks/useFieldArray.d.ts +6 -0
- package/form/hooks/useFieldArray.js +87 -0
- package/form/hooks/useLatest.d.ts +3 -0
- package/form/hooks/useLatest.js +8 -0
- package/form/hooks/useModalTableSelectedRows.d.ts +12 -0
- package/form/hooks/useModalTableSelectedRows.js +66 -0
- package/form/hooks/useWatch.d.ts +12 -0
- package/form/hooks/useWatch.js +16 -0
- package/form/index.d.ts +45 -0
- package/form/index.js +58 -0
- package/form/mutators/change.d.ts +2 -0
- package/form/mutators/change.js +9 -0
- package/form/validate.d.ts +14 -0
- package/form/validate.js +39 -0
- package/helpers/capitalize.d.ts +1 -0
- package/helpers/capitalize.js +1 -0
- package/helpers/filter.d.ts +4 -0
- package/helpers/filter.js +21 -0
- package/helpers/formSubmit.d.ts +5 -0
- package/helpers/formSubmit.js +21 -0
- package/helpers/index.d.ts +7 -0
- package/helpers/index.js +7 -0
- package/helpers/makeClassificationOptions.d.ts +30 -0
- package/helpers/makeClassificationOptions.js +29 -0
- package/helpers/map.d.ts +1 -0
- package/helpers/map.js +1 -0
- package/helpers/openapi.d.ts +10 -0
- package/helpers/openapi.js +10 -0
- package/helpers/renderRangeError.d.ts +1 -0
- package/helpers/renderRangeError.js +20 -0
- package/helpers/sentry/assertEnvVariable.d.ts +1 -0
- package/helpers/sentry/assertEnvVariable.js +7 -0
- package/helpers/sentry/sentryConfig.d.ts +2 -0
- package/helpers/sentry/sentryConfig.js +18 -0
- package/helpers/serializeErrors.d.ts +2 -0
- package/helpers/serializeErrors.js +13 -0
- package/hooks/index.d.ts +26 -0
- package/hooks/index.js +26 -0
- package/hooks/useAllowedBusinessEntities.d.ts +4 -0
- package/hooks/useAllowedBusinessEntities.js +9 -0
- package/hooks/useBusinessEntitiesByType.d.ts +8 -0
- package/hooks/useBusinessEntitiesByType.js +17 -0
- package/hooks/useChangePassword.d.ts +14 -0
- package/hooks/useChangePassword.js +48 -0
- package/hooks/useClassification.d.ts +9 -0
- package/hooks/useClassification.js +16 -0
- package/hooks/useDraggable.d.ts +5 -0
- package/hooks/useDraggable.js +11 -0
- package/hooks/useEllipsis.d.ts +10 -0
- package/hooks/useEllipsis.js +79 -0
- package/hooks/useFavicon.d.ts +1 -0
- package/hooks/useFavicon.js +13 -0
- package/hooks/useFormTable.d.ts +24 -0
- package/hooks/useFormTable.js +105 -0
- package/hooks/useFormTableControls.d.ts +31 -0
- package/hooks/useFormTableControls.js +34 -0
- package/hooks/useInertBackground.d.ts +20 -0
- package/hooks/useInertBackground.js +57 -0
- package/hooks/useIsMounted.d.ts +2 -0
- package/hooks/useIsMounted.js +11 -0
- package/hooks/useLanguage.d.ts +1 -0
- package/hooks/useLanguage.js +2 -0
- package/hooks/useLoaded.d.ts +1 -0
- package/hooks/useLoaded.js +19 -0
- package/hooks/useLocale.d.ts +1 -0
- package/hooks/useLocale.js +7 -0
- package/hooks/useModal.d.ts +307 -0
- package/hooks/useModal.js +12 -0
- package/hooks/useOptions.d.ts +13 -0
- package/hooks/useOptions.js +24 -0
- package/hooks/usePrevious.d.ts +1 -0
- package/hooks/usePrevious.js +12 -0
- package/hooks/usePrompt.d.ts +8 -0
- package/hooks/usePrompt.js +17 -0
- package/hooks/useRowActive.d.ts +6 -0
- package/hooks/useRowActive.js +104 -0
- package/hooks/useRowEditActions.d.ts +5 -0
- package/hooks/useRowEditActions.js +12 -0
- package/hooks/useRowExpandToggle.d.ts +5 -0
- package/hooks/useRowExpandToggle.js +13 -0
- package/hooks/useRowHidden.d.ts +4 -0
- package/hooks/useRowHidden.js +6 -0
- package/hooks/useRowSelectCheckbox.d.ts +27 -0
- package/hooks/useRowSelectCheckbox.js +48 -0
- package/hooks/useTable.d.ts +4 -0
- package/hooks/useTable.js +38 -0
- package/hooks/useTableRowHighlight.d.ts +4 -0
- package/hooks/useTableRowHighlight.js +16 -0
- package/hooks/useTranslation.d.ts +3 -0
- package/hooks/useTranslation.js +3 -0
- package/hooks/useWeekdayOptions.d.ts +40 -0
- package/hooks/useWeekdayOptions.js +66 -0
- package/i18n/index.d.ts +13 -0
- package/i18n/index.js +82 -0
- package/i18n/resources/de.json +115 -0
- package/i18n/resources/el.json +116 -0
- package/i18n/resources/en-AE.json +115 -0
- package/i18n/resources/en.json +118 -0
- package/i18n/resources/es.json +115 -0
- package/i18n/resources/fr.json +115 -0
- package/i18n/resources/index.d.ts +1295 -0
- package/i18n/resources/index.js +24 -0
- package/i18n/resources/it.json +115 -0
- package/i18n/resources/lt.json +115 -0
- package/i18n/resources/pt.json +115 -0
- package/i18n/resources/sk.json +115 -0
- package/i18n/resources/sv.json +116 -0
- package/i18n/trans/alert.d.ts +8 -0
- package/i18n/trans/alert.js +10 -0
- package/i18n/trans/button.d.ts +24 -0
- package/i18n/trans/button.js +26 -0
- package/i18n/trans/error.d.ts +10 -0
- package/i18n/trans/error.js +12 -0
- package/i18n/trans/field.d.ts +19 -0
- package/i18n/trans/field.js +21 -0
- package/i18n/trans/index.d.ts +13 -0
- package/i18n/trans/index.js +20 -0
- package/i18n/trans/label.d.ts +18 -0
- package/i18n/trans/label.js +20 -0
- package/i18n/trans/option.d.ts +6 -0
- package/i18n/trans/option.js +8 -0
- package/i18n/trans/qty.d.ts +5 -0
- package/i18n/trans/qty.js +7 -0
- package/i18n/trans/table.d.ts +8 -0
- package/i18n/trans/table.js +10 -0
- package/i18n/trans/title.d.ts +6 -0
- package/i18n/trans/title.js +8 -0
- package/i18n/trans/tooltip.d.ts +8 -0
- package/i18n/trans/tooltip.js +10 -0
- package/icons/1-class.svg +4 -0
- package/icons/2-class-calm.svg +5 -0
- package/icons/2-class-crossed.svg +5 -0
- package/icons/2-class.svg +4 -0
- package/icons/3-class.svg +4 -0
- package/icons/4-class.svg +4 -0
- package/icons/ac-crossed.svg +6 -0
- package/icons/ac.svg +9 -0
- package/icons/accessibility.svg +5 -0
- package/icons/add-journey-segment.svg +9 -0
- package/icons/add-person.svg +6 -0
- package/icons/add.svg +4 -0
- package/icons/air-condition.svg +11 -0
- package/icons/airport.svg +4 -0
- package/icons/alert-circle.svg +5 -0
- package/icons/arrow-down.svg +4 -0
- package/icons/arrow-left-circle.svg +5 -0
- package/icons/arrow-left.svg +4 -0
- package/icons/arrow-right.svg +4 -0
- package/icons/arrow-up.svg +4 -0
- package/icons/baby-care.svg +7 -0
- package/icons/bar.svg +6 -0
- package/icons/bed.svg +3 -0
- package/icons/bicycle-crossed.svg +6 -0
- package/icons/bicycle.svg +8 -0
- package/icons/bin.svg +6 -0
- package/icons/break.svg +5 -0
- package/icons/breakfast-1-class.svg +5 -0
- package/icons/breakfast-2-class.svg +5 -0
- package/icons/breakfast.svg +3 -0
- package/icons/bus.svg +7 -0
- package/icons/business-area.svg +6 -0
- package/icons/by-aisle.svg +8 -0
- package/icons/by-window.svg +6 -0
- package/icons/cafe-1-class.svg +5 -0
- package/icons/calendar.svg +6 -0
- package/icons/cancel.svg +5 -0
- package/icons/cargo.svg +4 -0
- package/icons/carriage-bot.svg +6 -0
- package/icons/carriage-mid.svg +4 -0
- package/icons/carriage-top.svg +12 -0
- package/icons/carriage.svg +3 -0
- package/icons/cart.svg +3 -0
- package/icons/cd.svg +4 -0
- package/icons/check-circle.svg +4 -0
- package/icons/check.svg +3 -0
- package/icons/checkbox-checked.svg +4 -0
- package/icons/checkbox-indeterminate.svg +5 -0
- package/icons/checkbox-mark.svg +3 -0
- package/icons/checkbox.svg +3 -0
- package/icons/chevron-down.svg +3 -0
- package/icons/chevron-left.svg +3 -0
- package/icons/chevron-right.svg +3 -0
- package/icons/chevron-up.svg +3 -0
- package/icons/circle.svg +3 -0
- package/icons/clock.svg +5 -0
- package/icons/clone.svg +4 -0
- package/icons/close-bold.svg +4 -0
- package/icons/close.svg +4 -0
- package/icons/coffee-machine-crossed.svg +6 -0
- package/icons/coffee-machine.svg +7 -0
- package/icons/coin.svg +4 -0
- package/icons/comment.svg +3 -0
- package/icons/compartment.svg +6 -0
- package/icons/couchette.svg +6 -0
- package/icons/cube.svg +1 -0
- package/icons/currency.svg +4 -0
- package/icons/deactivate.svg +4 -0
- package/icons/delete.svg +4 -0
- package/icons/dining.svg +7 -0
- package/icons/direction-bottom.svg +4 -0
- package/icons/direction-forward-v.svg +4 -0
- package/icons/direction-forward.svg +4 -0
- package/icons/direction-left.svg +4 -0
- package/icons/direction-reverse-v.svg +4 -0
- package/icons/direction-reverse.svg +4 -0
- package/icons/direction-right.svg +4 -0
- package/icons/direction-top.svg +4 -0
- package/icons/dots.svg +5 -0
- package/icons/download.svg +5 -0
- package/icons/drag-n-drop.svg +3 -0
- package/icons/draggable.svg +5 -0
- package/icons/duplicate.svg +4 -0
- package/icons/dvd.svg +5 -0
- package/icons/edit.svg +3 -0
- package/icons/empty-search.svg +9 -0
- package/icons/empty-state.svg +13 -0
- package/icons/empty.svg +9 -0
- package/icons/empty_search_purple.svg +6 -0
- package/icons/error-circle.svg +4 -0
- package/icons/eu-law.svg +5 -0
- package/icons/external_link.svg +5 -0
- package/icons/family-area.svg +7 -0
- package/icons/file-settings.svg +3 -0
- package/icons/file.svg +11 -0
- package/icons/filter.svg +3 -0
- package/icons/flip.svg +11 -0
- package/icons/food-1-class.svg +5 -0
- package/icons/food-plus.svg +5 -0
- package/icons/food.svg +7 -0
- package/icons/grid-cell.svg +1 -0
- package/icons/grid.svg +6 -0
- package/icons/headphones.svg +5 -0
- package/icons/helping-hand-crossed.svg +12 -0
- package/icons/helping-hand.svg +3 -0
- package/icons/hide.svg +4 -0
- package/icons/home.svg +4 -0
- package/icons/index.json +228 -0
- package/icons/info-circle.svg +5 -0
- package/icons/insurance.svg +6 -0
- package/icons/journey-changeover.svg +5 -0
- package/icons/journey-light.svg +5 -0
- package/icons/journey.svg +5 -0
- package/icons/key.svg +4 -0
- package/icons/language.svg +3 -0
- package/icons/link.svg +4 -0
- package/icons/list.svg +8 -0
- package/icons/locker.svg +8 -0
- package/icons/logout.svg +5 -0
- package/icons/luggage.svg +9 -0
- package/icons/mail.svg +4 -0
- package/icons/meeting-lounge.svg +10 -0
- package/icons/metro.svg +3 -0
- package/icons/middle-seat.svg +7 -0
- package/icons/minus.svg +3 -0
- package/icons/minus24.svg +3 -0
- package/icons/mobile-crossed.svg +7 -0
- package/icons/mobile.svg +6 -0
- package/icons/movingo.svg +3 -0
- package/icons/multimedia.svg +9 -0
- package/icons/near-bicycle.svg +5 -0
- package/icons/near-pet.svg +5 -0
- package/icons/near-wheelchair.svg +8 -0
- package/icons/night-train.svg +4 -0
- package/icons/nonstop.svg +3 -0
- package/icons/occupancy-seat-hover.svg +11 -0
- package/icons/occupancy-seat-selected.svg +11 -0
- package/icons/occupancy-seat.svg +4 -0
- package/icons/oneway.svg +4 -0
- package/icons/pet-crossed.svg +5 -0
- package/icons/pet.svg +7 -0
- package/icons/pic.svg +5 -0
- package/icons/playground.svg +7 -0
- package/icons/plus.svg +4 -0
- package/icons/plus24.svg +4 -0
- package/icons/popup-controls.svg +15 -0
- package/icons/power-socket.svg +6 -0
- package/icons/preview.svg +3 -0
- package/icons/print.svg +5 -0
- package/icons/priority-seat-elderly.svg +6 -0
- package/icons/priority-seat-pregnant.svg +5 -0
- package/icons/profile.svg +4 -0
- package/icons/question.svg +5 -0
- package/icons/radio-filled.svg +4 -0
- package/icons/radio.svg +3 -0
- package/icons/reclining-seat.svg +9 -0
- package/icons/refresh.svg +6 -0
- package/icons/reload.svg +4 -0
- package/icons/remove-circle.svg +3 -0
- package/icons/replace.svg +6 -0
- package/icons/reservation-crossed.svg +4 -0
- package/icons/reservation-mandatory.svg +4 -0
- package/icons/reservation-optional.svg +5 -0
- package/icons/resplus-horizontal.svg +1 -0
- package/icons/resplus.svg +3 -0
- package/icons/restaurant.svg +3 -0
- package/icons/roundtrip.svg +6 -0
- package/icons/save.svg +5 -0
- package/icons/search.svg +4 -0
- package/icons/seat-compartment.svg +8 -0
- package/icons/seat-selected.svg +3 -0
- package/icons/seat.svg +5 -0
- package/icons/sent.svg +34 -0
- package/icons/service-dog.svg +4 -0
- package/icons/settings.svg +4 -0
- package/icons/shift.svg +3 -0
- package/icons/ship.svg +3 -0
- package/icons/show.svg +4 -0
- package/icons/shower.svg +9 -0
- package/icons/silence.svg +6 -0
- package/icons/sink.svg +5 -0
- package/icons/skis.svg +8 -0
- package/icons/sleeper-car-bedding.svg +6 -0
- package/icons/sleeper-car.svg +5 -0
- package/icons/smoking-crossed.svg +6 -0
- package/icons/sort.svg +6 -0
- package/icons/stairs-down.svg +5 -0
- package/icons/stairs-up.svg +5 -0
- package/icons/star-filled.svg +3 -0
- package/icons/star.svg +3 -0
- package/icons/stroller.svg +6 -0
- package/icons/sw-law.svg +5 -0
- package/icons/switch.svg +3 -0
- package/icons/table.svg +6 -0
- package/icons/tag.svg +4 -0
- package/icons/taxi.svg +3 -0
- package/icons/tick.svg +3 -0
- package/icons/ticket-cancel.svg +8 -0
- package/icons/ticket-change.svg +3 -0
- package/icons/ticket-manage.svg +7 -0
- package/icons/ticket-refund.svg +8 -0
- package/icons/ticket-travel-pass.svg +4 -0
- package/icons/ticket.svg +6 -0
- package/icons/tickets.svg +4 -0
- package/icons/train.svg +3 -0
- package/icons/transfer.svg +3 -0
- package/icons/trash.svg +6 -0
- package/icons/triange.svg +17 -0
- package/icons/tv.svg +5 -0
- package/icons/unaccompanied-minor.svg +8 -0
- package/icons/upload.svg +5 -0
- package/icons/usb.svg +9 -0
- package/icons/visibility-off.svg +4 -0
- package/icons/visibility-on.svg +4 -0
- package/icons/voucher.svg +5 -0
- package/icons/wardrobe.svg +4 -0
- package/icons/warning.svg +3 -0
- package/icons/water.svg +5 -0
- package/icons/wc.svg +4 -0
- package/icons/wheelchair-lift-reservation.svg +8 -0
- package/icons/wheelchair-lift.svg +6 -0
- package/icons/wheelchair-ramp.svg +8 -0
- package/icons/wheelchair-space-reservation.svg +13 -0
- package/icons/wheelchair-space.svg +4 -0
- package/icons/wheelchair.svg +5 -0
- package/icons/wifi-crossed.svg +9 -0
- package/icons/wifi.svg +6 -0
- package/index.css +327 -0
- package/index.d.ts +31 -0
- package/index.js +32 -0
- package/mui/Accordion.d.ts +17 -0
- package/mui/Accordion.js +46 -0
- package/mui/Button/index.d.ts +16 -0
- package/mui/Button/index.js +35 -0
- package/mui/Card/CardHeader.d.ts +7 -0
- package/mui/Card/CardHeader.js +43 -0
- package/mui/Card/index.d.ts +4 -0
- package/mui/Card/index.js +4 -0
- package/mui/Checkbox/CheckboxGroup.d.ts +26 -0
- package/mui/Checkbox/CheckboxGroup.js +81 -0
- package/mui/Checkbox/index.d.ts +18 -0
- package/mui/Checkbox/index.js +40 -0
- package/mui/Chip/ChipSecondarySmall.d.ts +10 -0
- package/mui/Chip/ChipSecondarySmall.js +40 -0
- package/mui/CircularProgress/index.d.ts +3 -0
- package/mui/CircularProgress/index.js +36 -0
- package/mui/Collapsible/index.d.ts +9 -0
- package/mui/Collapsible/index.js +66 -0
- package/mui/Counter/index.d.ts +9 -0
- package/mui/Counter/index.js +37 -0
- package/mui/DatePicker/DatePicker.scss +276 -0
- package/mui/DatePicker/DatePickerContext.d.ts +8 -0
- package/mui/DatePicker/DatePickerContext.js +2 -0
- package/mui/DatePicker/DatePickerHeader.d.ts +3 -0
- package/mui/DatePicker/DatePickerHeader.js +63 -0
- package/mui/DatePicker/DatePickerHeaderSelect.d.ts +10 -0
- package/mui/DatePicker/DatePickerHeaderSelect.js +72 -0
- package/mui/DatePicker/DatePickerInput.d.ts +6 -0
- package/mui/DatePicker/DatePickerInput.js +28 -0
- package/mui/DatePicker/TimeInput.d.ts +10 -0
- package/mui/DatePicker/TimeInput.js +63 -0
- package/mui/DatePicker/index.d.ts +52 -0
- package/mui/DatePicker/index.js +187 -0
- package/mui/Dropdown/index.d.ts +22 -0
- package/mui/Dropdown/index.js +90 -0
- package/mui/EditableLabel/index.d.ts +7 -0
- package/mui/EditableLabel/index.js +81 -0
- package/mui/ExternalLink/index.d.ts +8 -0
- package/mui/ExternalLink/index.js +11 -0
- package/mui/FileInput/index.d.ts +27 -0
- package/mui/FileInput/index.js +66 -0
- package/mui/FormControl/index.d.ts +23 -0
- package/mui/FormControl/index.js +36 -0
- package/mui/FormField/index.d.ts +8 -0
- package/mui/FormField/index.js +12 -0
- package/mui/Icon/index.d.ts +21 -0
- package/mui/Icon/index.js +47 -0
- package/mui/Input/index.d.ts +28 -0
- package/mui/Input/index.js +102 -0
- package/mui/Loader/index.d.ts +9 -0
- package/mui/Loader/index.js +47 -0
- package/mui/Modal/index.d.ts +16 -0
- package/mui/Modal/index.js +64 -0
- package/mui/Pagination/index.d.ts +6 -0
- package/mui/Pagination/index.js +23 -0
- package/mui/Paper/index.d.ts +4 -0
- package/mui/Paper/index.js +3 -0
- package/mui/Popper/index.d.ts +13 -0
- package/mui/Popper/index.js +139 -0
- package/mui/RadioGroup/index.d.ts +26 -0
- package/mui/RadioGroup/index.js +41 -0
- package/mui/ReadOnlyField/index.d.ts +8 -0
- package/mui/ReadOnlyField/index.js +35 -0
- package/mui/Select/index.d.ts +47 -0
- package/mui/Select/index.js +164 -0
- package/mui/Stepper/StepIconComponent.d.ts +6 -0
- package/mui/Stepper/StepIconComponent.js +93 -0
- package/mui/Stepper/index.d.ts +6 -0
- package/mui/Stepper/index.js +13 -0
- package/mui/Switch/index.d.ts +3 -0
- package/mui/Switch/index.js +2 -0
- package/mui/Tab/index.d.ts +60 -0
- package/mui/Tab/index.js +12 -0
- package/mui/Tabs/index.d.ts +22 -0
- package/mui/Tabs/index.js +70 -0
- package/mui/TimeDurationLabel/index.d.ts +7 -0
- package/mui/TimeDurationLabel/index.js +13 -0
- package/mui/ToggleButton/index.d.ts +4 -0
- package/mui/ToggleButton/index.js +57 -0
- package/mui/ToggleButtonGroup/index.d.ts +25 -0
- package/mui/ToggleButtonGroup/index.js +61 -0
- package/mui/ToggleList/index.d.ts +11 -0
- package/mui/ToggleList/index.js +54 -0
- package/mui/Tooltip/index.d.ts +11 -0
- package/mui/Tooltip/index.js +36 -0
- package/mui/index.d.ts +36 -0
- package/mui/index.js +36 -0
- package/mui/provider.d.ts +9 -0
- package/mui/provider.js +22 -0
- package/mui/theme.d.ts +17 -0
- package/mui/theme.js +1228 -0
- package/package.json +197 -4
- package/services/api.d.ts +28 -0
- package/services/api.js +141 -0
- package/services/index.d.ts +2 -0
- package/services/index.js +2 -0
- package/services/openapi.d.ts +6 -0
- package/services/openapi.js +112 -0
- package/store/index.d.ts +6 -0
- package/store/index.js +1 -0
- package/store/useClassificationOptions.d.ts +3 -0
- package/store/useClassificationOptions.js +2 -0
- package/types.d.ts +2423 -0
- package/utils/array.d.ts +2 -0
- package/utils/array.js +21 -0
- package/utils/auth.d.ts +2 -0
- package/utils/auth.js +31 -0
- package/utils/color.d.ts +29 -0
- package/utils/color.js +132 -0
- package/utils/date.d.ts +40 -0
- package/utils/date.js +51 -0
- package/utils/filter.d.ts +3 -0
- package/utils/filter.js +11 -0
- package/utils/getScrollbarSize.d.ts +1 -0
- package/utils/getScrollbarSize.js +8 -0
- package/utils/index.d.ts +12 -0
- package/utils/index.js +12 -0
- package/utils/input.d.ts +2 -0
- package/utils/input.js +2 -0
- package/utils/knowledge-owl-script.d.ts +64 -0
- package/utils/knowledge-owl-script.js +226 -0
- package/utils/locales.d.ts +3 -0
- package/utils/locales.js +24 -0
- package/utils/noop.d.ts +1 -0
- package/utils/noop.js +1 -0
- package/utils/percentage.d.ts +6 -0
- package/utils/percentage.js +43 -0
- package/utils/redirect.d.ts +1 -0
- package/utils/redirect.js +6 -0
- package/utils/sort.d.ts +21 -0
- package/utils/sort.js +32 -0
- package/utils/storage.d.ts +2 -0
- package/utils/storage.js +2 -0
- package/utils/timeDuration.d.ts +26 -0
- package/utils/timeDuration.js +78 -0
- package/utils/wallClock.d.ts +17 -0
- package/utils/wallClock.js +178 -0
- package/wrappers/ApiInitializer.d.ts +9 -0
- package/wrappers/ApiInitializer.js +21 -0
- package/wrappers/AuthWrapper.d.ts +6 -0
- package/wrappers/AuthWrapper.js +38 -0
- package/wrappers/AxiosErrorsInterceptorWrapper.d.ts +2 -0
- package/wrappers/AxiosErrorsInterceptorWrapper.js +30 -0
- package/README.md +0 -3
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import { useContext, useMemo } from 'react';
|
|
4
|
+
import { makeStyles } from '@mui/styles';
|
|
5
|
+
import Stack from '@mui/material/Stack';
|
|
6
|
+
import Divider from '@mui/material/Divider';
|
|
7
|
+
import IconButton from '@mui/material/IconButton';
|
|
8
|
+
import { Icon } from "../Icon";
|
|
9
|
+
import * as dateFns from 'date-fns';
|
|
10
|
+
import { useLocale } from "../../hooks";
|
|
11
|
+
import { DatePickerHeaderSelect } from "./DatePickerHeaderSelect";
|
|
12
|
+
import range from 'lodash/range';
|
|
13
|
+
import { DatePickerContext } from "./DatePickerContext";
|
|
14
|
+
const useStyles = makeStyles(() => ({
|
|
15
|
+
root: {
|
|
16
|
+
marginLeft: '1rem',
|
|
17
|
+
fontWeight: 700,
|
|
18
|
+
},
|
|
19
|
+
selectWrap: {
|
|
20
|
+
flex: 1,
|
|
21
|
+
justifyContent: 'center',
|
|
22
|
+
'& > button': {
|
|
23
|
+
width: '45%',
|
|
24
|
+
fontWeight: 700,
|
|
25
|
+
},
|
|
26
|
+
'& > hr': {
|
|
27
|
+
width: '1px',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
}), {
|
|
31
|
+
name: 'DatePickerHeader',
|
|
32
|
+
});
|
|
33
|
+
export const DatePickerHeader = (props) => {
|
|
34
|
+
const { decreaseMonth, prevMonthButtonDisabled, increaseMonth, nextMonthButtonDisabled, date, changeMonth, changeYear, customHeaderCount, } = props;
|
|
35
|
+
const currentDate = useMemo(() => {
|
|
36
|
+
const currentDate = new Date(date);
|
|
37
|
+
currentDate.setMonth(currentDate.getMonth() + customHeaderCount);
|
|
38
|
+
return currentDate;
|
|
39
|
+
}, [customHeaderCount, date]);
|
|
40
|
+
const locale = useLocale();
|
|
41
|
+
const { minDate, maxDate, monthsShown = 1, dropdownDisablePortal, } = useContext(DatePickerContext);
|
|
42
|
+
const months = useMemo(() => range(minDate && dateFns.getYear(minDate) === dateFns.getYear(date)
|
|
43
|
+
? dateFns.getMonth(minDate)
|
|
44
|
+
: 0, maxDate && dateFns.getYear(maxDate) === dateFns.getYear(date)
|
|
45
|
+
? dateFns.getMonth(maxDate) + 1
|
|
46
|
+
: 12).map((value) => ({
|
|
47
|
+
value,
|
|
48
|
+
label: locale.localize.month(value),
|
|
49
|
+
})), [date, locale.localize, maxDate, minDate]);
|
|
50
|
+
const years = useMemo(() => range(minDate ? dateFns.getYear(minDate) : 1900, maxDate ? dateFns.getYear(maxDate) + 1 : 2100).map((value) => ({
|
|
51
|
+
value,
|
|
52
|
+
label: value,
|
|
53
|
+
})), [maxDate, minDate]);
|
|
54
|
+
const changeMonthButtonStyles = useCallback(({ hidden }) => ({
|
|
55
|
+
visibility: (hidden ? 'hidden' : 'visible'),
|
|
56
|
+
}), []);
|
|
57
|
+
const classes = useStyles();
|
|
58
|
+
return (_jsxs(Stack, { className: classes.root, direction: "row", justifyContent: "space-between", alignItems: "center", children: [_jsx(IconButton, { onClick: decreaseMonth, disabled: prevMonthButtonDisabled, "aria-label": "Previous month", style: changeMonthButtonStyles({
|
|
59
|
+
hidden: monthsShown > 1 && customHeaderCount > 0,
|
|
60
|
+
}), children: _jsx(Icon, { name: "chevron-left", ...(!prevMonthButtonDisabled && { color: 'black' }) }) }), _jsxs(Stack, { direction: "row", alignItems: "center", className: classes.selectWrap, children: [_jsx(DatePickerHeaderSelect, { options: months, value: currentDate.getMonth(), onChange: changeMonth, disablePortal: dropdownDisablePortal, children: dateFns.format(currentDate, 'LLLL', { locale }) }), _jsx(Divider, { orientation: "vertical", variant: "middle", flexItem: true }), _jsx(DatePickerHeaderSelect, { options: years, value: currentDate.getFullYear(), onChange: changeYear, disablePortal: dropdownDisablePortal, children: currentDate.getFullYear() })] }), _jsx(IconButton, { onClick: increaseMonth, disabled: nextMonthButtonDisabled, "aria-label": "Next month", style: changeMonthButtonStyles({
|
|
61
|
+
hidden: monthsShown > 1 && customHeaderCount < monthsShown - 1,
|
|
62
|
+
}), children: _jsx(Icon, { name: "chevron-right", ...(!prevMonthButtonDisabled && { color: 'black' }) }) })] }));
|
|
63
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
import { Option } from "../../dto/option";
|
|
3
|
+
interface DatePickerHeaderSelectProps<T> {
|
|
4
|
+
options: Array<Option<T>>;
|
|
5
|
+
value: T;
|
|
6
|
+
onChange: (value: T) => void;
|
|
7
|
+
disablePortal?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function DatePickerHeaderSelect<T>({ children, options, value, onChange, disablePortal, }: PropsWithChildren<DatePickerHeaderSelectProps<T>>): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useState } from 'react';
|
|
3
|
+
import { makeStyles } from '@mui/styles';
|
|
4
|
+
import { Icon } from "../Icon";
|
|
5
|
+
import Button from '@mui/material/Button';
|
|
6
|
+
import Popper from '@mui/material/Popper';
|
|
7
|
+
import Paper from '@mui/material/Paper';
|
|
8
|
+
import Tabs from '@mui/material/Tabs';
|
|
9
|
+
import Tab from '@mui/material/Tab';
|
|
10
|
+
import ClickAwayListener from '@mui/material/ClickAwayListener';
|
|
11
|
+
const useStyles = makeStyles((theme) => ({
|
|
12
|
+
root: { '&.MuiButton-root.MuiButton-text': { color: 'inherit' } },
|
|
13
|
+
popper: {
|
|
14
|
+
maxHeight: 288,
|
|
15
|
+
// Inline (disablePortal) rendering inherits the stacking context of
|
|
16
|
+
// whatever elevated ancestor (e.g. a popover) it's nested in, so a low
|
|
17
|
+
// z-index is enough. Once portaled to document.body it becomes a
|
|
18
|
+
// top-level sibling instead, competing in the global stacking order,
|
|
19
|
+
// so it needs to clear the elevation of overlays like that popover.
|
|
20
|
+
zIndex: ({ disablePortal }) => disablePortal ? 1 : theme.zIndex.modal,
|
|
21
|
+
},
|
|
22
|
+
tabs: {
|
|
23
|
+
width: 128,
|
|
24
|
+
height: '100%',
|
|
25
|
+
maxHeight: 'inherit',
|
|
26
|
+
border: `1px solid ${theme.palette.divider}`,
|
|
27
|
+
},
|
|
28
|
+
tab: {
|
|
29
|
+
minHeight: 28,
|
|
30
|
+
borderRadius: 0,
|
|
31
|
+
padding: '0 8px',
|
|
32
|
+
fontWeight: 400,
|
|
33
|
+
color: theme.palette.secondary.main,
|
|
34
|
+
'&.Mui-selected': {
|
|
35
|
+
background: theme.palette.secondary.main,
|
|
36
|
+
color: theme.palette.common.white,
|
|
37
|
+
boxShadow: 'unset',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
}), {
|
|
41
|
+
name: 'DatePickerHeaderSelect',
|
|
42
|
+
});
|
|
43
|
+
export function DatePickerHeaderSelect({ children, options, value, onChange, disablePortal = true, }) {
|
|
44
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
45
|
+
const open = Boolean(anchorEl);
|
|
46
|
+
const handleClick = useCallback((event) => {
|
|
47
|
+
event.stopPropagation(); // without this, useExpanded hook on table will break this component
|
|
48
|
+
const { currentTarget } = event;
|
|
49
|
+
setAnchorEl((prev) => (prev ? null : currentTarget));
|
|
50
|
+
}, []);
|
|
51
|
+
const handleClose = useCallback(() => setAnchorEl(null), []);
|
|
52
|
+
const handleChange = useCallback((_, value) => {
|
|
53
|
+
onChange(value);
|
|
54
|
+
setAnchorEl(null);
|
|
55
|
+
}, [onChange]);
|
|
56
|
+
const classes = useStyles({ disablePortal });
|
|
57
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { className: classes.root, variant: "text", endIcon: _jsx(Icon, { name: "chevron-down" }), onClick: handleClick, children: children }), _jsx(Popper
|
|
58
|
+
// react-datepicker closes the whole calendar on any click it deems
|
|
59
|
+
// "outside" (via react-onclickoutside, configured with this ignore
|
|
60
|
+
// class instead of the library's default). When this dropdown
|
|
61
|
+
// portals to document.body it leaves the calendar's DOM subtree, so
|
|
62
|
+
// it must carry this class for react-datepicker to recognize the
|
|
63
|
+
// click as internal instead of closing the calendar.
|
|
64
|
+
, {
|
|
65
|
+
// react-datepicker closes the whole calendar on any click it deems
|
|
66
|
+
// "outside" (via react-onclickoutside, configured with this ignore
|
|
67
|
+
// class instead of the library's default). When this dropdown
|
|
68
|
+
// portals to document.body it leaves the calendar's DOM subtree, so
|
|
69
|
+
// it must carry this class for react-datepicker to recognize the
|
|
70
|
+
// click as internal instead of closing the calendar.
|
|
71
|
+
className: `${classes.popper} react-datepicker-ignore-onclickoutside`, anchorEl: anchorEl, open: open, disablePortal: disablePortal, children: _jsx(ClickAwayListener, { onClickAway: handleClose, children: _jsx(Tabs, { className: classes.tabs, component: Paper, elevation: 24, orientation: "vertical", variant: "scrollable", value: value, onChange: handleChange, scrollButtons: false, children: options.map(({ value, label }) => (_jsx(Tab, { className: classes.tab, value: value, label: label }, `${value}`))) }) }) })] }));
|
|
72
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { InputComponentProps } from "../Input";
|
|
3
|
+
interface DatePickerInputProps extends InputComponentProps {
|
|
4
|
+
}
|
|
5
|
+
export declare const DatePickerInput: import("react").ForwardRefExoticComponent<Pick<DatePickerInputProps, "type" | "value" | "autoComplete" | "autoFocus" | "disabled" | "name" | "placeholder" | "readOnly" | "required" | "rows" | "size" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "components" | "error" | "classes" | "sx" | "variant" | "multiline" | "fullWidth" | "endAdornment" | "data-testid" | "componentsProps" | "disableInjectingGlobalStyles" | "inputComponent" | "inputProps" | "inputRef" | "renderSuffix" | "maxRows" | "minRows" | "startAdornment"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { makeStyles } from '@mui/styles';
|
|
4
|
+
import { InputComponent } from "../Input";
|
|
5
|
+
import InputAdornment from '@mui/material/InputAdornment';
|
|
6
|
+
import IconButton from '@mui/material/IconButton';
|
|
7
|
+
import { Icon } from "../Icon";
|
|
8
|
+
const useStyles = makeStyles((theme) => ({
|
|
9
|
+
root: {
|
|
10
|
+
'&.Mui-focused, &:hover:not(.Mui-disabled)': {
|
|
11
|
+
'& $button': {
|
|
12
|
+
boxShadow: `inset 1px 0 0 ${theme.palette.primary.main}`,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
button: {
|
|
17
|
+
borderRadius: 0,
|
|
18
|
+
boxShadow: `inset 1px 0 0 ${theme.palette.divider}`,
|
|
19
|
+
'&:hover': { background: 'unset' },
|
|
20
|
+
},
|
|
21
|
+
}), {
|
|
22
|
+
name: 'DatePickerInput',
|
|
23
|
+
});
|
|
24
|
+
export const DatePickerInput = forwardRef((props, ref) => {
|
|
25
|
+
const { disabled } = props;
|
|
26
|
+
const classes = useStyles(props);
|
|
27
|
+
return (_jsx(InputComponent, { inputRef: ref, classes: { root: classes.root }, endAdornment: _jsx(InputAdornment, { position: "end", children: _jsx(IconButton, { className: classes.button, disabled: disabled, edge: "end", "aria-label": "Open calendar", children: _jsx(Icon, { name: "calendar", color: "secondary", disabled: disabled }) }) }), ...props }));
|
|
28
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
export declare const RangeTimeInput: () => JSX.Element;
|
|
3
|
+
interface TimeInputProps {
|
|
4
|
+
value?: string;
|
|
5
|
+
onChange?: (arg: string) => void;
|
|
6
|
+
label?: ReactNode;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const TimeInput: FC<TimeInputProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, FormControl, Stack, Typography } from '@mui/material';
|
|
3
|
+
import { TransLabel } from "../../i18n/trans/label";
|
|
4
|
+
import isNumber from 'lodash/isNumber';
|
|
5
|
+
import { DatePickerContext } from "./DatePickerContext";
|
|
6
|
+
import { InputComponent } from "../Input";
|
|
7
|
+
import { useCallback, useContext, useEffect, useMemo, useState, } from 'react';
|
|
8
|
+
import MaskedInput from 'react-input-mask';
|
|
9
|
+
import { formatDate, isoDateTimeFormat } from "../../utils/date";
|
|
10
|
+
export const RangeTimeInput = () => {
|
|
11
|
+
const { startDate, endDate, onChange } = useContext(DatePickerContext);
|
|
12
|
+
const [start, end] = [startDate, endDate].map((date) => date ? formatDate(date, isoDateTimeFormat).split('T') : []);
|
|
13
|
+
const getTimeChangeHandler = useCallback((type) => (timeStr) => {
|
|
14
|
+
const [hours, minutes] = timeStr.split(':').map(Number);
|
|
15
|
+
(type === 'from' ? startDate : endDate)?.setHours(hours, minutes, 0);
|
|
16
|
+
onChange({ from: startDate, to: endDate }, undefined);
|
|
17
|
+
}, [endDate, onChange, startDate]);
|
|
18
|
+
return (_jsxs(Stack, { spacing: 1, children: [_jsx(TimeInput, { label: _jsxs(_Fragment, { children: [_jsx(Typography, { variant: "body2", children: _jsx(TransLabel, { i18nKey: "timeFrom" }) }), _jsx(Typography, { variant: "body1", fontWeight: "bold", children: formatDate(start[0]) })] }), onChange: getTimeChangeHandler('from'), disabled: !startDate, value: start[1] }), endDate && (_jsx(TimeInput, { label: _jsxs(_Fragment, { children: [_jsx(Typography, { variant: "body2", children: _jsx(TransLabel, { i18nKey: "timeTo" }) }), _jsx(Typography, { variant: "body1", fontWeight: "bold", children: formatDate(end[0]) })] }), onChange: getTimeChangeHandler('to'), value: end[1] }))] }));
|
|
19
|
+
};
|
|
20
|
+
export const TimeInput = ({ disabled, value: propsValue, onChange: propsOnChange, label, }) => {
|
|
21
|
+
const { wallClockTime, onWallClockTimeChange } = useContext(DatePickerContext);
|
|
22
|
+
const value = wallClockTime ?? propsValue;
|
|
23
|
+
const onChange = onWallClockTimeChange ?? propsOnChange;
|
|
24
|
+
const timesValue = value?.split(':').map((value) => value ?? '00');
|
|
25
|
+
// make sure the array is in [HH,mm,ss] format
|
|
26
|
+
const timesValueWithSeconds = useMemo(() => (timesValue?.length === 2 ? [...timesValue, '00'] : timesValue), [timesValue]);
|
|
27
|
+
const onTimeChange = useCallback((e) => {
|
|
28
|
+
const { id, value } = e.currentTarget;
|
|
29
|
+
const [prevH, prevM, prevS] = timesValueWithSeconds;
|
|
30
|
+
const nextTimes = id === 'hours' ? [value, prevM, prevS] : [prevH, value, prevS];
|
|
31
|
+
if (nextTimes.every((v) => !v?.includes('-') && isNumber(+v))) {
|
|
32
|
+
onChange(nextTimes.join(':'));
|
|
33
|
+
}
|
|
34
|
+
}, [onChange, timesValueWithSeconds]);
|
|
35
|
+
return (_jsxs(Stack, { gap: 0.5, children: [label ?? (_jsx(Typography, { variant: "body1", fontWeight: "bold", children: _jsx(TransLabel, { i18nKey: "time" }) })), _jsxs(Stack, { direction: "row", mt: 0.5, alignItems: "center", divider: _jsx(Box, { px: 1, children: ":" }), children: [_jsx(PartialTimeInput, { id: "hours", onChange: onTimeChange, value: timesValueWithSeconds?.[0], disabled: disabled }), _jsx(PartialTimeInput, { id: "minutes", onChange: onTimeChange, value: timesValueWithSeconds?.[1], disabled: disabled })] })] }));
|
|
36
|
+
};
|
|
37
|
+
const PartialTimeInput = ({ id, value = '', onChange, disabled, ...props }) => {
|
|
38
|
+
const [inputValue, setInputValue] = useState(value);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
setInputValue(value);
|
|
41
|
+
}, [value]);
|
|
42
|
+
const inputMask = useMemo(() => {
|
|
43
|
+
if (id === 'hours') {
|
|
44
|
+
return [
|
|
45
|
+
/[0-2]/,
|
|
46
|
+
inputValue.length > 0 && inputValue[0] === '2' ? /[0-3]/ : /\d/,
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
return [/[0-5]/, /\d/];
|
|
50
|
+
}, [id, inputValue]);
|
|
51
|
+
const handleChange = useCallback((e) => {
|
|
52
|
+
const newValue = e.target.value;
|
|
53
|
+
setInputValue(newValue);
|
|
54
|
+
if (id === 'hours' && newValue.length >= 2) {
|
|
55
|
+
if (newValue[0] === '2' && !/[0-3]/.test(newValue[1])) {
|
|
56
|
+
setInputValue(newValue.slice(0, 1));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
onChange(e);
|
|
61
|
+
}, [id, onChange]);
|
|
62
|
+
return (_jsx(FormControl, { sx: { width: 40 }, disabled: disabled, children: _jsx(MaskedInput, { alwaysShowMask: true, id: id, mask: inputMask, maskPlaceholder: "-", value: inputValue, onChange: handleChange, ...props, children: _jsx(InputComponent, {}) }) }));
|
|
63
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import "./DatePicker.scss";
|
|
2
|
+
import { DatePickerHeader } from "./DatePickerHeader";
|
|
3
|
+
import { FormControlProps } from "../FormControl";
|
|
4
|
+
import type { ReactNode, SyntheticEvent } from 'react';
|
|
5
|
+
import type { ReactDatePickerProps } from 'react-datepicker';
|
|
6
|
+
export declare type DatePickerSingleValue<T> = T;
|
|
7
|
+
export declare type DatePickerRangeValue<T> = {
|
|
8
|
+
from: T;
|
|
9
|
+
to: T;
|
|
10
|
+
};
|
|
11
|
+
export declare type DatePickerValue<Range extends boolean, T extends string | Date = string> = Range extends true ? Range extends true ? DatePickerRangeValue<T> : DatePickerSingleValue<T> : never;
|
|
12
|
+
export declare function isRangeValue<Range extends boolean>(range: Range): range is Range;
|
|
13
|
+
export interface DatePickerProps<WithRange extends boolean = false> extends Omit<Partial<ReactDatePickerProps<never, WithRange>>, 'value' | 'onChange'>, Pick<FormControlProps, 'margin' | 'helper'> {
|
|
14
|
+
className?: string;
|
|
15
|
+
label?: ReactNode;
|
|
16
|
+
value?: DatePickerValue<WithRange>;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
onChange?: <WithRange extends boolean>(date: DatePickerValue<WithRange, Date>, event: SyntheticEvent | undefined) => void;
|
|
19
|
+
minDate?: Date;
|
|
20
|
+
maxDate?: Date;
|
|
21
|
+
error?: ReactNode;
|
|
22
|
+
dateType?: 'start' | 'end';
|
|
23
|
+
defaultTimeValues?: Partial<{
|
|
24
|
+
hours: number;
|
|
25
|
+
minutes: number;
|
|
26
|
+
seconds: number;
|
|
27
|
+
milliseconds: number;
|
|
28
|
+
}>;
|
|
29
|
+
disablePast?: boolean;
|
|
30
|
+
disableFuture?: boolean;
|
|
31
|
+
disclaimer?: ReactNode;
|
|
32
|
+
loading?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Treat the value as a timetable wall clock instead of an instant: the clock
|
|
35
|
+
* time is read and written verbatim and never converted to the browser
|
|
36
|
+
* timezone. Required for schedule times, which a browser-local `Date` cannot
|
|
37
|
+
* even represent when they fall into the viewer's DST gap. Single value only.
|
|
38
|
+
*/
|
|
39
|
+
wallClock?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the month/year header dropdowns render inline instead of
|
|
42
|
+
* portaling to `document.body` (default `true`). Inline positioning is
|
|
43
|
+
* computed relative to the dropdown's DOM ancestors, so if the calendar
|
|
44
|
+
* itself is nested inside another portaled/transformed container (e.g. a
|
|
45
|
+
* Tooltip-based popover), the transformed ancestor becomes the containing
|
|
46
|
+
* block and the dropdown can render in the wrong spot. Set to `false` in
|
|
47
|
+
* that case so the dropdown escapes to the body and positions correctly.
|
|
48
|
+
*/
|
|
49
|
+
dropdownDisablePortal?: boolean;
|
|
50
|
+
}
|
|
51
|
+
declare function DatePicker<WithRange extends boolean>(props: DatePickerProps<WithRange>): JSX.Element;
|
|
52
|
+
export { DatePicker, DatePickerHeader };
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "./DatePicker.scss";
|
|
3
|
+
import { Stack } from '@mui/material';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { currentLocaleConfiguration, i18nInstance } from "../../i18n";
|
|
6
|
+
import { TransLabel } from "../../i18n/trans/label";
|
|
7
|
+
import { DatePickerContext } from "./DatePickerContext";
|
|
8
|
+
import { DatePickerHeader } from "./DatePickerHeader";
|
|
9
|
+
import { DatePickerInput } from "./DatePickerInput";
|
|
10
|
+
import { RangeTimeInput, TimeInput } from "./TimeInput";
|
|
11
|
+
import { FormControl } from "../FormControl";
|
|
12
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
13
|
+
import ReactDatePicker, { registerLocale } from 'react-datepicker';
|
|
14
|
+
import { renderToString } from 'react-dom/server';
|
|
15
|
+
import { getAccessabilityValue } from "../../utils";
|
|
16
|
+
import { currentDateTimeFormat, getDateFormatHint, getEndOfDate, getStartOfDate, } from "../../utils/date";
|
|
17
|
+
import { formatWallClockDate, fromCalendarDate, parseWallClockInput, parseWallClockString, toWallClockCalendarDate, toWallClockDate, } from "../../utils/wallClock";
|
|
18
|
+
import { locales } from "../../utils/locales";
|
|
19
|
+
import { Loader } from "../Loader";
|
|
20
|
+
Object.keys(locales).map((key) => registerLocale(key, locales[key]));
|
|
21
|
+
export function isRangeValue(range) {
|
|
22
|
+
return range === true;
|
|
23
|
+
}
|
|
24
|
+
const toDate = (value) => value
|
|
25
|
+
? value instanceof Date
|
|
26
|
+
? value
|
|
27
|
+
: new Date(value)
|
|
28
|
+
: undefined;
|
|
29
|
+
const defaultRenderCustomHeader = (props) => _jsx(DatePickerHeader, { ...props });
|
|
30
|
+
function DatePicker(props) {
|
|
31
|
+
const { className, dateType, value, onChange, label, disabled, error, helper, margin, required, selectsRange, dateFormat, minDate: propsMinDate, maxDate: propsMaxDate, disablePast, disableFuture, defaultTimeValues, monthsShown, disclaimer, loading, wallClock, dropdownDisablePortal, placeholderText, renderCustomHeader = defaultRenderCustomHeader, ...rest } = props;
|
|
32
|
+
const { onBlur, onCalendarClose, onChangeRaw } = rest;
|
|
33
|
+
const accessibility = useMemo(getAccessabilityValue, []);
|
|
34
|
+
const inputBasedFormat = props.showTimeInput
|
|
35
|
+
? currentDateTimeFormat
|
|
36
|
+
: currentLocaleConfiguration.dateFormat;
|
|
37
|
+
const preparedDateFormat = (Array.isArray(dateFormat) ? dateFormat[0] : dateFormat) ||
|
|
38
|
+
inputBasedFormat;
|
|
39
|
+
// Without a hint the user cannot tell which order the input expects, so fall
|
|
40
|
+
// back to the active format itself as the placeholder.
|
|
41
|
+
const preparedPlaceholderText = useMemo(() => {
|
|
42
|
+
if (placeholderText !== undefined)
|
|
43
|
+
return placeholderText;
|
|
44
|
+
const hint = getDateFormatHint(preparedDateFormat);
|
|
45
|
+
return isRangeValue(selectsRange) ? `${hint} - ${hint}` : hint;
|
|
46
|
+
}, [placeholderText, preparedDateFormat, selectsRange]);
|
|
47
|
+
const isWallClock = Boolean(wallClock) && !isRangeValue(selectsRange);
|
|
48
|
+
const wallClockParts = useMemo(() => (isWallClock ? parseWallClockString(value) : undefined), [isWallClock, value]);
|
|
49
|
+
const [startDate, endDate] = useMemo(() => isWallClock
|
|
50
|
+
? [wallClockParts && toWallClockCalendarDate(wallClockParts), undefined]
|
|
51
|
+
: (() => {
|
|
52
|
+
if (isRangeValue(selectsRange)) {
|
|
53
|
+
const { from, to } = value ?? {};
|
|
54
|
+
return [from, to];
|
|
55
|
+
}
|
|
56
|
+
else
|
|
57
|
+
return [value];
|
|
58
|
+
})().map(toDate), [isWallClock, selectsRange, value, wallClockParts]);
|
|
59
|
+
const selected = useMemo(() => startDate, [startDate]);
|
|
60
|
+
const { minDate, maxDate } = useMemo(() => {
|
|
61
|
+
const today = new Date();
|
|
62
|
+
return {
|
|
63
|
+
minDate: propsMinDate,
|
|
64
|
+
maxDate: propsMaxDate,
|
|
65
|
+
...(disablePast && { minDate: getStartOfDate(today) }),
|
|
66
|
+
...(disableFuture && {
|
|
67
|
+
maxDate: getEndOfDate(today),
|
|
68
|
+
}),
|
|
69
|
+
};
|
|
70
|
+
}, [disableFuture, disablePast, propsMaxDate, propsMinDate]);
|
|
71
|
+
const [inputText, setInputText] = useState();
|
|
72
|
+
const emitWallClock = useCallback((parts, event) => {
|
|
73
|
+
onChange?.((parts ? toWallClockDate(parts) : undefined), event);
|
|
74
|
+
}, [onChange]);
|
|
75
|
+
const onWallClockDateChange = useCallback((date, event = undefined) => {
|
|
76
|
+
setInputText(undefined);
|
|
77
|
+
if (!date) {
|
|
78
|
+
emitWallClock(undefined, event);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if ((minDate && date < minDate) || (maxDate && date > maxDate)) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const time = { hours: 0, minutes: 0, seconds: 0, ...wallClockParts };
|
|
85
|
+
if (event?.type === 'click') {
|
|
86
|
+
if (defaultTimeValues) {
|
|
87
|
+
Object.assign(time, { hours: 0, minutes: 0, seconds: 0 }, defaultTimeValues);
|
|
88
|
+
}
|
|
89
|
+
if (dateType === 'start') {
|
|
90
|
+
Object.assign(time, { hours: 0, minutes: 0, seconds: 0 });
|
|
91
|
+
}
|
|
92
|
+
if (dateType === 'end') {
|
|
93
|
+
Object.assign(time, { hours: 23, minutes: 59, seconds: 59 });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
emitWallClock(fromCalendarDate(date, time), event);
|
|
97
|
+
}, [
|
|
98
|
+
dateType,
|
|
99
|
+
defaultTimeValues,
|
|
100
|
+
emitWallClock,
|
|
101
|
+
maxDate,
|
|
102
|
+
minDate,
|
|
103
|
+
wallClockParts,
|
|
104
|
+
]);
|
|
105
|
+
const onWallClockTimeChange = useCallback((time) => {
|
|
106
|
+
const [hours, minutes, seconds] = time.split(':').map(Number);
|
|
107
|
+
const date = wallClockParts ??
|
|
108
|
+
fromCalendarDate(new Date(), { hours: 0, minutes: 0, seconds: 0 });
|
|
109
|
+
setInputText(undefined);
|
|
110
|
+
emitWallClock({ ...date, hours, minutes, seconds: seconds || 0 }, undefined);
|
|
111
|
+
}, [emitWallClock, wallClockParts]);
|
|
112
|
+
const onWallClockInputChange = useCallback((event) => {
|
|
113
|
+
event.preventDefault();
|
|
114
|
+
const text = event.target.value;
|
|
115
|
+
const parts = parseWallClockInput(text, preparedDateFormat);
|
|
116
|
+
setInputText(text);
|
|
117
|
+
if (parts) {
|
|
118
|
+
emitWallClock(parts, event);
|
|
119
|
+
}
|
|
120
|
+
}, [emitWallClock, preparedDateFormat]);
|
|
121
|
+
const onSingleDateChange = useCallback((date, event = undefined) => {
|
|
122
|
+
const isChangeByCalendarClick = event?.type === 'click';
|
|
123
|
+
if (date && ((minDate && date < minDate) || (maxDate && date > maxDate)))
|
|
124
|
+
return;
|
|
125
|
+
let getDate = toDate;
|
|
126
|
+
if (isChangeByCalendarClick) {
|
|
127
|
+
if (defaultTimeValues)
|
|
128
|
+
getDate = (date) => getStartOfDate(date, defaultTimeValues);
|
|
129
|
+
if (dateType === 'start')
|
|
130
|
+
getDate = getStartOfDate;
|
|
131
|
+
if (dateType === 'end')
|
|
132
|
+
getDate = getEndOfDate;
|
|
133
|
+
}
|
|
134
|
+
onChange?.(getDate(date), event);
|
|
135
|
+
}, [minDate, maxDate, onChange, defaultTimeValues, dateType]);
|
|
136
|
+
const handleChange = useCallback((date, event) => {
|
|
137
|
+
if (Array.isArray(date)) {
|
|
138
|
+
const { 0: from, 1: to } = date;
|
|
139
|
+
onChange({ from, to: to && getEndOfDate(to) }, event);
|
|
140
|
+
}
|
|
141
|
+
else if (isWallClock) {
|
|
142
|
+
onWallClockDateChange(date, event);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
onSingleDateChange(date, event);
|
|
146
|
+
}
|
|
147
|
+
}, [isWallClock, onChange, onSingleDateChange, onWallClockDateChange]);
|
|
148
|
+
const handleChangeRaw = useCallback((event) => {
|
|
149
|
+
if (isWallClock && event?.type === 'change') {
|
|
150
|
+
onWallClockInputChange(event);
|
|
151
|
+
}
|
|
152
|
+
onChangeRaw?.(event);
|
|
153
|
+
}, [isWallClock, onChangeRaw, onWallClockInputChange]);
|
|
154
|
+
const handleWallClockBlur = useCallback((event) => {
|
|
155
|
+
setInputText(undefined);
|
|
156
|
+
onBlur?.(event);
|
|
157
|
+
}, [onBlur]);
|
|
158
|
+
const handleWallClockCalendarClose = useCallback(() => {
|
|
159
|
+
setInputText(undefined);
|
|
160
|
+
onCalendarClose?.();
|
|
161
|
+
}, [onCalendarClose]);
|
|
162
|
+
const wallClockProps = isWallClock
|
|
163
|
+
? {
|
|
164
|
+
value: inputText ?? formatWallClockDate(value, preparedDateFormat),
|
|
165
|
+
onChangeRaw: handleChangeRaw,
|
|
166
|
+
onBlur: handleWallClockBlur,
|
|
167
|
+
onCalendarClose: handleWallClockCalendarClose,
|
|
168
|
+
}
|
|
169
|
+
: {};
|
|
170
|
+
return (_jsx(FormControl, { label: label, className: classNames('datepicker-wrapper', className, {
|
|
171
|
+
disabled,
|
|
172
|
+
'datepicker-accessibility-wrapper': accessibility,
|
|
173
|
+
}), error: error, helper: helper, margin: margin, required: required, name: props.name, children: _jsx(DatePickerContext.Provider, { value: {
|
|
174
|
+
minDate,
|
|
175
|
+
maxDate,
|
|
176
|
+
startDate,
|
|
177
|
+
endDate,
|
|
178
|
+
onChange,
|
|
179
|
+
monthsShown,
|
|
180
|
+
dropdownDisablePortal,
|
|
181
|
+
...(isWallClock && {
|
|
182
|
+
wallClockTime: formatWallClockDate(value, currentLocaleConfiguration.timeFormat),
|
|
183
|
+
onWallClockTimeChange,
|
|
184
|
+
}),
|
|
185
|
+
}, children: _jsx(ReactDatePicker, { locale: i18nInstance.language, dateFormat: dateFormat || inputBasedFormat, placeholderText: preparedPlaceholderText, showPopperArrow: false, renderCustomHeader: renderCustomHeader, customTimeInput: selectsRange ? _jsx(RangeTimeInput, {}) : _jsx(TimeInput, {}), selected: selected, calendarContainer: ({ className, children }) => (_jsxs("div", { className: className, children: [_jsx(Loader, { size: "container", active: loading }), _jsx(Stack, { direction: "row", children: children }), disclaimer && _jsx("div", { className: "disclaimer", children: disclaimer })] })), startDate: startDate, endDate: endDate, onChange: handleChange, showWeekNumbers: true, weekLabel: renderToString(_jsx(TransLabel, { i18nKey: "week" })), disabled: disabled, calendarStartDay: 1, showYearDropdown: true, yearDropdownItemNumber: 10, customInput: _jsx(DatePickerInput, {}), scrollableYearDropdown: true, shouldCloseOnSelect: !props.showTimeInput, popperProps: { strategy: 'fixed' }, selectsRange: selectsRange, timeInputLabel: "", disabledKeyboardNavigation: true, minDate: minDate, maxDate: maxDate, monthsShown: monthsShown, ...rest, ...wallClockProps }) }) }));
|
|
186
|
+
}
|
|
187
|
+
export { DatePicker, DatePickerHeader };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import { ButtonProps } from '@mui/material';
|
|
3
|
+
import { type Option } from "../../dto/option";
|
|
4
|
+
export interface DropdownProps {
|
|
5
|
+
label: ReactNode;
|
|
6
|
+
options: DropdownOptions;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
onLabelChange?: (label: string) => void;
|
|
10
|
+
active?: boolean;
|
|
11
|
+
color?: Required<ButtonProps>['color'];
|
|
12
|
+
listClassName?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare type DropdownOptions = Array<DropdownOption>;
|
|
15
|
+
export interface DropdownOption<TValue = string> extends Partial<Option<TValue>> {
|
|
16
|
+
selected?: boolean;
|
|
17
|
+
onClick?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
18
|
+
content?: ReactNode;
|
|
19
|
+
options?: Exclude<DropdownOptions, 'options'>;
|
|
20
|
+
active?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare function Dropdown(props: DropdownProps): JSX.Element;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, useCallback, useEffect, useState } from 'react';
|
|
3
|
+
import { Popper } from "../Popper";
|
|
4
|
+
import { Button, List, ListItem, ListItemButton, ListItemText, } from '@mui/material';
|
|
5
|
+
import { Icon } from "../Icon";
|
|
6
|
+
import { makeStyles } from '@mui/styles';
|
|
7
|
+
import { EditableLabel } from "../EditableLabel";
|
|
8
|
+
import classNames from 'classnames';
|
|
9
|
+
const useStyles = makeStyles((theme) => ({
|
|
10
|
+
toggle: {
|
|
11
|
+
display: 'flex',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
cursor: 'pointer',
|
|
14
|
+
},
|
|
15
|
+
disabled: {
|
|
16
|
+
'& $button': {
|
|
17
|
+
cursor: 'not-allowed',
|
|
18
|
+
'& .MuiButton-endIcon': {
|
|
19
|
+
pointerEvents: 'none',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
button: ({ color }) => ({
|
|
24
|
+
textDecoration: 'none',
|
|
25
|
+
'&:before': {
|
|
26
|
+
display: 'none',
|
|
27
|
+
},
|
|
28
|
+
...(!color && {
|
|
29
|
+
color: theme.palette.text.primary,
|
|
30
|
+
'&:hover': {
|
|
31
|
+
color: theme.palette.text.primary,
|
|
32
|
+
},
|
|
33
|
+
}),
|
|
34
|
+
padding: '4px 16px',
|
|
35
|
+
}),
|
|
36
|
+
divider: {
|
|
37
|
+
color: theme.palette.text.secondary,
|
|
38
|
+
pointerEvents: 'none',
|
|
39
|
+
fontSize: 12,
|
|
40
|
+
},
|
|
41
|
+
selected: {
|
|
42
|
+
background: theme.palette.secondary.main,
|
|
43
|
+
color: theme.palette.common.white,
|
|
44
|
+
'&:hover': {
|
|
45
|
+
color: theme.palette.text.primary,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
active: {
|
|
49
|
+
'&&': {
|
|
50
|
+
color: theme.palette.primary.main,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
}), {
|
|
54
|
+
name: 'Dropdown',
|
|
55
|
+
});
|
|
56
|
+
export function Dropdown(props) {
|
|
57
|
+
const { disabled, onLabelChange, label, options, className, listClassName, active, color, } = props;
|
|
58
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
59
|
+
const [minWidth, setMinWidth] = useState(0);
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
setMinWidth(anchorEl?.clientWidth ?? 0);
|
|
62
|
+
}, [anchorEl?.clientWidth]);
|
|
63
|
+
const open = Boolean(anchorEl);
|
|
64
|
+
const handleOpen = useCallback((event) => {
|
|
65
|
+
!disabled && setAnchorEl(event.currentTarget);
|
|
66
|
+
}, [disabled]);
|
|
67
|
+
const handleOpenOnIconClick = useCallback((event) => {
|
|
68
|
+
!disabled && setAnchorEl(event.currentTarget.parentElement);
|
|
69
|
+
}, [disabled]);
|
|
70
|
+
const handleClose = useCallback(() => {
|
|
71
|
+
setAnchorEl(null);
|
|
72
|
+
}, []);
|
|
73
|
+
const handleOptionClick = useCallback(({ onClick }) => (event) => {
|
|
74
|
+
onClick && onClick(event);
|
|
75
|
+
handleClose();
|
|
76
|
+
}, [handleClose]);
|
|
77
|
+
const classes = useStyles(props);
|
|
78
|
+
const renderIcon = useCallback((props) => (_jsx(Icon, { name: "chevron-down", width: 10, height: 10, margin: true, ...props })), []);
|
|
79
|
+
const renderOptions = useCallback((options) => options.map((option, index) => (_jsx(Fragment, { children: option.options ? (_jsxs(_Fragment, { children: [_jsx(ListItem, { className: classes.divider, children: _jsx(ListItemText, { primary: option.label }) }), renderOptions(option.options)] })) : (_jsx(ListItem, { disablePadding: true, secondaryAction: option.content, children: _jsx(ListItemButton, { className: classNames({
|
|
80
|
+
[classes.selected]: option.selected,
|
|
81
|
+
[classes.active]: option.active,
|
|
82
|
+
}), onClick: handleOptionClick(option), children: _jsx(ListItemText, { primary: option.label, disableTypography: true }) }) })) }, index))), [classes.divider, classes.selected, classes.active, handleOptionClick]);
|
|
83
|
+
return (_jsxs(Fragment, { children: [_jsx("div", { className: classNames('dropdown', classes.toggle, className, {
|
|
84
|
+
[classes.disabled]: disabled,
|
|
85
|
+
}), children: onLabelChange ? (_jsxs(_Fragment, { children: [_jsx(EditableLabel, { onBlur: onLabelChange, initialValue: label }), renderIcon({ onClick: handleOpenOnIconClick })] })) : (_jsx(Button, { className: classNames(classes.button, {
|
|
86
|
+
[classes.active]: active,
|
|
87
|
+
}), variant: "text", endIcon: renderIcon({
|
|
88
|
+
...(color === 'yellow' && { color }),
|
|
89
|
+
}), onClick: handleOpen, disabled: disabled, color: color, children: label })) }), _jsx(Popper, { open: open, reference: anchorEl, onClickOutside: handleClose, children: _jsx(List, { dense: true, style: { minWidth }, className: listClassName, children: renderOptions(options) }) })] }));
|
|
90
|
+
}
|