@turnit-ou/shared 0.0.0-stage → 2.18.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/@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 +84 -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
package/utils/locales.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { enUS as en, es, fr, it, lt, sv, de, pt, sk } from 'date-fns/locale';
|
|
2
|
+
import capitalize from 'lodash/capitalize';
|
|
3
|
+
const capitalizeTranslations = (locale) => ({
|
|
4
|
+
...locale,
|
|
5
|
+
localize: {
|
|
6
|
+
...locale.localize,
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
day: (...args) => capitalize(locale.localize.day(...args)),
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
month: (...args) => capitalize(locale.localize.month(...args)),
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
export const locales = {
|
|
14
|
+
de: capitalizeTranslations(de),
|
|
15
|
+
en,
|
|
16
|
+
['en-AE']: en,
|
|
17
|
+
es,
|
|
18
|
+
fr,
|
|
19
|
+
it: capitalizeTranslations(it),
|
|
20
|
+
lt,
|
|
21
|
+
pt: capitalizeTranslations(pt),
|
|
22
|
+
sv: capitalizeTranslations(sv),
|
|
23
|
+
sk: capitalizeTranslations(sk),
|
|
24
|
+
};
|
package/utils/noop.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const noop: <T = void>() => T;
|
package/utils/noop.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const noop = () => ({});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const percentageToDecimal: (percentage: number) => number;
|
|
2
|
+
export declare const parseToDecimal: <T>(value: T) => number | "";
|
|
3
|
+
export declare const decimalToPercentage: (decimal: number) => number;
|
|
4
|
+
export declare const formatToPercentage: <T>(value: T) => number | "";
|
|
5
|
+
export declare const countDecimalPlaces: (number: number) => number;
|
|
6
|
+
export declare const renderPercentageError: <TValue>(value: TValue) => string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { renderRangeError } from "../helpers";
|
|
3
|
+
import { TransError } from "../i18n/trans/error";
|
|
4
|
+
import { renderToString } from 'react-dom/server';
|
|
5
|
+
export const percentageToDecimal = (percentage) => {
|
|
6
|
+
const decimal = percentage / 100;
|
|
7
|
+
return Math.round(decimal * 10000) / 10000;
|
|
8
|
+
};
|
|
9
|
+
export const parseToDecimal = (value) => {
|
|
10
|
+
if (isNaN(parseFloat(`${value}`)))
|
|
11
|
+
return '';
|
|
12
|
+
return percentageToDecimal(Number(value));
|
|
13
|
+
};
|
|
14
|
+
export const decimalToPercentage = (decimal) => {
|
|
15
|
+
const percentage = decimal * 100;
|
|
16
|
+
return Math.round(percentage * 10000) / 10000;
|
|
17
|
+
};
|
|
18
|
+
export const formatToPercentage = (value) => {
|
|
19
|
+
if (isNaN(parseFloat(`${value}`)))
|
|
20
|
+
return '';
|
|
21
|
+
return decimalToPercentage(Number(value));
|
|
22
|
+
};
|
|
23
|
+
export const countDecimalPlaces = (number) => {
|
|
24
|
+
const numberString = number.toString();
|
|
25
|
+
const decimalIndex = numberString.indexOf('.');
|
|
26
|
+
if (decimalIndex === -1) {
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
return numberString.length - decimalIndex - 1;
|
|
30
|
+
};
|
|
31
|
+
export const renderPercentageError = (value) => {
|
|
32
|
+
if (!value) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
const parsedValue = Number(value);
|
|
36
|
+
if (isNaN(parsedValue)) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
if (countDecimalPlaces(parsedValue) > 2) {
|
|
40
|
+
return renderToString(_jsx(TransError, { i18nKey: "maxDecimalPlaces", values: { maxValue: 2 } }));
|
|
41
|
+
}
|
|
42
|
+
return renderRangeError(value, 1, 100);
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getRedirectedPath(pathname: string): string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const regex = /(\/edit)?(\/(\d+|[0-9a-fA-F]{8}(\b-[0-9a-fA-F]{4}){3}\b-[0-9a-fA-F]{12})(\/.*)?)?\/?$/;
|
|
2
|
+
const VEHICLES_ROUTES = ['vehicles', 'compositions'];
|
|
3
|
+
export function getRedirectedPath(pathname) {
|
|
4
|
+
const vehicleRoute = VEHICLES_ROUTES.find((route) => pathname.includes(route));
|
|
5
|
+
return vehicleRoute ? `/${vehicleRoute}/all` : pathname.replace(regex, '');
|
|
6
|
+
}
|
package/utils/sort.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HeaderGroup, SortingRule } from 'react-table';
|
|
2
|
+
import { PaginationParams } from "../dto/pagination";
|
|
3
|
+
export interface QueryFilterParams extends PaginationParams {
|
|
4
|
+
sortBy?: SortingRules;
|
|
5
|
+
}
|
|
6
|
+
export interface QueryFilterRequest extends PaginationParams {
|
|
7
|
+
sortBy?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const SORT_PARAMS: readonly ["sortBy"];
|
|
10
|
+
export declare const SORTING_DIRECTION: {
|
|
11
|
+
readonly ASC: "asc";
|
|
12
|
+
readonly DESC: "desc";
|
|
13
|
+
};
|
|
14
|
+
export declare type SortingDirection = (typeof SORTING_DIRECTION)[keyof typeof SORTING_DIRECTION];
|
|
15
|
+
export declare type SortingRules<D = object> = Array<SortingRule<D>>;
|
|
16
|
+
export declare const parseSortArrayToString: <D extends object>(rules: SortingRule<D>[]) => string;
|
|
17
|
+
export declare const parseStringToSortArray: (sortBy?: string) => Array<SortingRule<string>>;
|
|
18
|
+
export declare const getSortArray: <D extends object>({ id, isSortedDesc, }: HeaderGroup<D>) => {
|
|
19
|
+
id: import("react-table").IdType<D>;
|
|
20
|
+
desc: boolean;
|
|
21
|
+
}[];
|
package/utils/sort.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export const SORT_PARAMS = ['sortBy'];
|
|
2
|
+
export const SORTING_DIRECTION = {
|
|
3
|
+
ASC: 'asc',
|
|
4
|
+
DESC: 'desc',
|
|
5
|
+
};
|
|
6
|
+
export const parseSortArrayToString = (rules) => {
|
|
7
|
+
if (!Array.isArray(rules) || !rules.length) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
return rules
|
|
11
|
+
.map(({ id, desc }) => `${id}(${desc ? SORTING_DIRECTION.DESC : SORTING_DIRECTION.ASC})`)
|
|
12
|
+
.join(', ');
|
|
13
|
+
};
|
|
14
|
+
export const parseStringToSortArray = (sortBy) => {
|
|
15
|
+
if (!sortBy) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
const results = [];
|
|
19
|
+
sortBy.split(', ').forEach(rule => {
|
|
20
|
+
const match = rule.match(/^([\w.]+)\((\w+)\)$/);
|
|
21
|
+
if (match) {
|
|
22
|
+
results.push({ id: match[1], desc: match[2] === 'desc' });
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return results;
|
|
26
|
+
};
|
|
27
|
+
export const getSortArray = ({ id, isSortedDesc, }) => {
|
|
28
|
+
if (isSortedDesc) {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
return [{ id, desc: isSortedDesc === false }];
|
|
32
|
+
};
|
package/utils/storage.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { TransKeys } from "../i18n/trans";
|
|
2
|
+
import { TransField } from "../i18n/trans/field";
|
|
3
|
+
export declare enum TimeUnit {
|
|
4
|
+
DAYS = "days",
|
|
5
|
+
HOURS = "hours",
|
|
6
|
+
MINUTES = "minutes",
|
|
7
|
+
SECONDS = "seconds"
|
|
8
|
+
}
|
|
9
|
+
export declare type TimeDuration = Partial<Record<TimeUnit, number>>;
|
|
10
|
+
export interface TimeDurationExcludedUnits {
|
|
11
|
+
excludedUnits?: TimeUnit[];
|
|
12
|
+
}
|
|
13
|
+
export declare const TIME_UNIT_CONFIGURATION: Record<TimeUnit, {
|
|
14
|
+
multiplier: number;
|
|
15
|
+
i18nKey: TransKeys<typeof TransField>;
|
|
16
|
+
validateRange?: {
|
|
17
|
+
min: number;
|
|
18
|
+
max: number;
|
|
19
|
+
};
|
|
20
|
+
}>;
|
|
21
|
+
export declare const getTimeDurationUnits: (excludedUnits: TimeUnit[]) => TimeUnit[];
|
|
22
|
+
export declare const getRecalculatedMultiplier: (unit: TimeUnit, base: TimeUnit) => number;
|
|
23
|
+
export declare const convertNumberToTimeDuration: (value: number | undefined | null, base?: TimeUnit) => Partial<Record<TimeUnit, number>>;
|
|
24
|
+
export declare const convertTimeDurationToNumber: (value: TimeDuration | undefined | null, base?: TimeUnit) => number;
|
|
25
|
+
export declare const convertStringToTimeDuration: (value: string | undefined | null) => Partial<Record<TimeUnit, number>>;
|
|
26
|
+
export declare const convertTimeDurationToString: (value: TimeDuration | undefined | null) => string;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export var TimeUnit;
|
|
2
|
+
(function (TimeUnit) {
|
|
3
|
+
TimeUnit["DAYS"] = "days";
|
|
4
|
+
TimeUnit["HOURS"] = "hours";
|
|
5
|
+
TimeUnit["MINUTES"] = "minutes";
|
|
6
|
+
TimeUnit["SECONDS"] = "seconds";
|
|
7
|
+
})(TimeUnit || (TimeUnit = {}));
|
|
8
|
+
export const TIME_UNIT_CONFIGURATION = {
|
|
9
|
+
[TimeUnit.DAYS]: {
|
|
10
|
+
multiplier: 1 * 60 * 60 * 24,
|
|
11
|
+
i18nKey: 'shortFormDay',
|
|
12
|
+
},
|
|
13
|
+
[TimeUnit.HOURS]: {
|
|
14
|
+
multiplier: 1 * 60 * 60,
|
|
15
|
+
i18nKey: 'shortFormHour',
|
|
16
|
+
validateRange: { min: 0, max: 23 },
|
|
17
|
+
},
|
|
18
|
+
[TimeUnit.MINUTES]: {
|
|
19
|
+
multiplier: 1 * 60,
|
|
20
|
+
i18nKey: 'shortFormMinute',
|
|
21
|
+
validateRange: { min: 0, max: 59 },
|
|
22
|
+
},
|
|
23
|
+
[TimeUnit.SECONDS]: {
|
|
24
|
+
multiplier: 1,
|
|
25
|
+
i18nKey: 'shortFormSecond',
|
|
26
|
+
validateRange: { min: 0, max: 59 },
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
const TIME_DURATION_STRING_FORMAT = {
|
|
30
|
+
regex: /^(\d+\.)?(\d{2}):(\d{2}):(\d{2})$/,
|
|
31
|
+
separator: {
|
|
32
|
+
[TimeUnit.DAYS]: '.',
|
|
33
|
+
[TimeUnit.HOURS]: ':',
|
|
34
|
+
[TimeUnit.MINUTES]: ':',
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
export const getTimeDurationUnits = (excludedUnits) => Object.values(TimeUnit).filter((unit) => !excludedUnits.includes(unit));
|
|
38
|
+
export const getRecalculatedMultiplier = (unit, base) => TIME_UNIT_CONFIGURATION[unit].multiplier /
|
|
39
|
+
TIME_UNIT_CONFIGURATION[base].multiplier;
|
|
40
|
+
export const convertNumberToTimeDuration = (value, base = TimeUnit.MINUTES) => {
|
|
41
|
+
let time = value > 0 ? value : 0;
|
|
42
|
+
return Object.values(TimeUnit).reduce((acc, unit) => {
|
|
43
|
+
const recalculatedMultiplier = getRecalculatedMultiplier(unit, base);
|
|
44
|
+
if (recalculatedMultiplier >= 1) {
|
|
45
|
+
acc[unit] = Math.trunc(time / recalculatedMultiplier);
|
|
46
|
+
time = time - acc[unit] * recalculatedMultiplier;
|
|
47
|
+
}
|
|
48
|
+
return acc;
|
|
49
|
+
}, {});
|
|
50
|
+
};
|
|
51
|
+
export const convertTimeDurationToNumber = (value, base = TimeUnit.MINUTES) => {
|
|
52
|
+
return Object.values(TimeUnit).reduce((acc, unit) => {
|
|
53
|
+
const recalculatedMultiplier = getRecalculatedMultiplier(unit, base);
|
|
54
|
+
return recalculatedMultiplier >= 1
|
|
55
|
+
? acc + (value?.[unit] ?? 0) * recalculatedMultiplier
|
|
56
|
+
: acc;
|
|
57
|
+
}, 0);
|
|
58
|
+
};
|
|
59
|
+
export const convertStringToTimeDuration = (value) => {
|
|
60
|
+
const match = value && value.match(TIME_DURATION_STRING_FORMAT.regex);
|
|
61
|
+
//index + 1 because of the match output. match[0] is the value, the days are match[1] and so on
|
|
62
|
+
return Object.values(TimeUnit).reduce((acc, unit, index) => {
|
|
63
|
+
acc[unit] =
|
|
64
|
+
match && match.length > index + 1
|
|
65
|
+
? parseInt(match[index + 1] ?? '0', 10)
|
|
66
|
+
: 0;
|
|
67
|
+
return acc;
|
|
68
|
+
}, {});
|
|
69
|
+
};
|
|
70
|
+
export const convertTimeDurationToString = (value) => {
|
|
71
|
+
return Object.values(TimeUnit).reduce((acc, unit) => {
|
|
72
|
+
const num = value?.[unit] ?? 0;
|
|
73
|
+
const formattedStr = unit === TimeUnit.DAYS
|
|
74
|
+
? `${num}`
|
|
75
|
+
: String(value?.[unit] ?? 0).padStart(2, '0');
|
|
76
|
+
return (acc + formattedStr + (TIME_DURATION_STRING_FORMAT.separator[unit] ?? ''));
|
|
77
|
+
}, '');
|
|
78
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface WallClockParts {
|
|
2
|
+
year: number;
|
|
3
|
+
month: number;
|
|
4
|
+
day: number;
|
|
5
|
+
hours: number;
|
|
6
|
+
minutes: number;
|
|
7
|
+
seconds: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const stripDateTimeOffset: (value: string) => string;
|
|
10
|
+
export declare const parseWallClockString: (value?: string | null) => WallClockParts | undefined;
|
|
11
|
+
export declare const toWallClockCalendarDate: ({ year, month, day }: WallClockParts) => Date;
|
|
12
|
+
export declare const toWallClockDate: ({ year, month, day, hours, minutes, seconds, }: WallClockParts) => Date;
|
|
13
|
+
export declare const fromWallClockDate: (date?: Date | null) => WallClockParts | undefined;
|
|
14
|
+
export declare const fromCalendarDate: (date: Date, time: Pick<WallClockParts, 'hours' | 'minutes' | 'seconds'>) => WallClockParts;
|
|
15
|
+
export declare const stringifyWallClock: (parts: WallClockParts) => string;
|
|
16
|
+
export declare const formatWallClockDate: (value?: string | null, customFormat?: string) => string;
|
|
17
|
+
export declare const parseWallClockInput: (text: string, customFormat?: string) => WallClockParts | undefined;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { format } from 'date-fns';
|
|
2
|
+
import { currentDateTimeFormat } from "./date";
|
|
3
|
+
import { i18nInstance } from "../i18n";
|
|
4
|
+
import { locales } from "./locales";
|
|
5
|
+
const offsetPattern = /(?:Z|[+-]\d{2}:?\d{2})$/;
|
|
6
|
+
const valuePattern = /^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{1,2}):(\d{2})(?::(\d{2}))?)?/;
|
|
7
|
+
export const stripDateTimeOffset = (value) => value.replace(offsetPattern, '');
|
|
8
|
+
export const parseWallClockString = (value) => {
|
|
9
|
+
const match = value && valuePattern.exec(stripDateTimeOffset(value));
|
|
10
|
+
if (!match) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
const [, year, month, day, hours = '0', minutes = '0', seconds = '0'] = match;
|
|
14
|
+
return {
|
|
15
|
+
year: +year,
|
|
16
|
+
month: +month,
|
|
17
|
+
day: +day,
|
|
18
|
+
hours: +hours,
|
|
19
|
+
minutes: +minutes,
|
|
20
|
+
seconds: +seconds,
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export const toWallClockCalendarDate = ({ year, month, day }) => new Date(year, month - 1, day, 12);
|
|
24
|
+
export const toWallClockDate = ({ year, month, day, hours, minutes, seconds, }) => new Date(Date.UTC(year, month - 1, day, hours, minutes, seconds));
|
|
25
|
+
export const fromWallClockDate = (date) => {
|
|
26
|
+
if (!date || Number.isNaN(date.getTime())) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
year: date.getUTCFullYear(),
|
|
31
|
+
month: date.getUTCMonth() + 1,
|
|
32
|
+
day: date.getUTCDate(),
|
|
33
|
+
hours: date.getUTCHours(),
|
|
34
|
+
minutes: date.getUTCMinutes(),
|
|
35
|
+
seconds: date.getUTCSeconds(),
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export const fromCalendarDate = (date, time) => ({
|
|
39
|
+
year: date.getFullYear(),
|
|
40
|
+
month: date.getMonth() + 1,
|
|
41
|
+
day: date.getDate(),
|
|
42
|
+
...time,
|
|
43
|
+
});
|
|
44
|
+
const pad = (value) => String(value).padStart(2, '0');
|
|
45
|
+
export const stringifyWallClock = (parts) => `${parts.year}-${pad(parts.month)}-${pad(parts.day)}T${pad(parts.hours)}:${pad(parts.minutes)}:${pad(parts.seconds)}`;
|
|
46
|
+
const timeTokenPattern = /^(H{1,2}|h{1,2}|m{1,2}|s{1,2}|a{1,5})/;
|
|
47
|
+
const timeTokenValue = (token, { hours, minutes, seconds }) => {
|
|
48
|
+
switch (token[0]) {
|
|
49
|
+
case 'H':
|
|
50
|
+
return token.length > 1 ? pad(hours) : String(hours);
|
|
51
|
+
case 'h': {
|
|
52
|
+
const hours12 = hours % 12 || 12;
|
|
53
|
+
return token.length > 1 ? pad(hours12) : String(hours12);
|
|
54
|
+
}
|
|
55
|
+
case 'm':
|
|
56
|
+
return token.length > 1 ? pad(minutes) : String(minutes);
|
|
57
|
+
case 's':
|
|
58
|
+
return token.length > 1 ? pad(seconds) : String(seconds);
|
|
59
|
+
default:
|
|
60
|
+
return hours < 12 ? 'AM' : 'PM';
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const toWallClockFormat = (customFormat, parts) => {
|
|
64
|
+
const segments = [];
|
|
65
|
+
const push = (literal, value) => {
|
|
66
|
+
const previous = segments[segments.length - 1];
|
|
67
|
+
if (!value) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (previous?.literal === literal) {
|
|
71
|
+
previous.value += value;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
segments.push({ literal, value });
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
let index = 0;
|
|
78
|
+
while (index < customFormat.length) {
|
|
79
|
+
const char = customFormat[index];
|
|
80
|
+
if (char === "'") {
|
|
81
|
+
const closing = customFormat.indexOf("'", index + 1);
|
|
82
|
+
const end = closing === -1 ? customFormat.length : closing;
|
|
83
|
+
push(true, customFormat.slice(index + 1, end));
|
|
84
|
+
index = end + 1;
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
const token = timeTokenPattern.exec(customFormat.slice(index))?.[1];
|
|
88
|
+
if (token) {
|
|
89
|
+
push(true, timeTokenValue(token, parts));
|
|
90
|
+
index += token.length;
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
push(false, char);
|
|
94
|
+
index += 1;
|
|
95
|
+
}
|
|
96
|
+
return segments
|
|
97
|
+
.map(({ literal, value }) => literal ? `'${value.replace(/'/g, "''")}'` : value)
|
|
98
|
+
.join('');
|
|
99
|
+
};
|
|
100
|
+
export const formatWallClockDate = (value, customFormat = currentDateTimeFormat) => {
|
|
101
|
+
const parts = parseWallClockString(value);
|
|
102
|
+
if (!parts) {
|
|
103
|
+
return '';
|
|
104
|
+
}
|
|
105
|
+
return format(toWallClockCalendarDate(parts), toWallClockFormat(customFormat, parts), { locale: locales[i18nInstance.language] });
|
|
106
|
+
};
|
|
107
|
+
const inputTokens = [
|
|
108
|
+
'yyyy',
|
|
109
|
+
'yy',
|
|
110
|
+
'MM',
|
|
111
|
+
'M',
|
|
112
|
+
'dd',
|
|
113
|
+
'd',
|
|
114
|
+
'HH',
|
|
115
|
+
'H',
|
|
116
|
+
'hh',
|
|
117
|
+
'h',
|
|
118
|
+
'mm',
|
|
119
|
+
'm',
|
|
120
|
+
'ss',
|
|
121
|
+
's',
|
|
122
|
+
];
|
|
123
|
+
const buildInputParser = (customFormat) => {
|
|
124
|
+
const tokens = [];
|
|
125
|
+
let source = '';
|
|
126
|
+
let index = 0;
|
|
127
|
+
let quoted = false;
|
|
128
|
+
while (index < customFormat.length) {
|
|
129
|
+
const char = customFormat[index];
|
|
130
|
+
if (char === "'") {
|
|
131
|
+
quoted = !quoted;
|
|
132
|
+
index += 1;
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
const token = !quoted &&
|
|
136
|
+
inputTokens.find((candidate) => customFormat.startsWith(candidate, index));
|
|
137
|
+
if (token) {
|
|
138
|
+
tokens.push(token);
|
|
139
|
+
source += token === 'yyyy' ? '(\\d{4})' : '(\\d{1,2})';
|
|
140
|
+
index += token.length;
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
if (!quoted && /[A-Za-z]/.test(char)) {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
source += char.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
147
|
+
index += 1;
|
|
148
|
+
}
|
|
149
|
+
return { tokens, pattern: new RegExp(`^\\s*${source}\\s*$`) };
|
|
150
|
+
};
|
|
151
|
+
export const parseWallClockInput = (text, customFormat = currentDateTimeFormat) => {
|
|
152
|
+
const parser = buildInputParser(customFormat);
|
|
153
|
+
const match = parser?.pattern.exec(text);
|
|
154
|
+
if (!parser || !match) {
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
157
|
+
const values = parser.tokens.reduce((acc, token, tokenIndex) => ({ ...acc, [token]: +match[tokenIndex + 1] }), {});
|
|
158
|
+
const year = values.yyyy ?? (values.yy == null ? undefined : 2000 + values.yy);
|
|
159
|
+
const month = values.MM ?? values.M;
|
|
160
|
+
const day = values.dd ?? values.d;
|
|
161
|
+
if (year == null || month == null || day == null) {
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
const parts = {
|
|
165
|
+
year,
|
|
166
|
+
month,
|
|
167
|
+
day,
|
|
168
|
+
hours: values.HH ?? values.H ?? values.hh ?? values.h ?? 0,
|
|
169
|
+
minutes: values.mm ?? values.m ?? 0,
|
|
170
|
+
seconds: values.ss ?? values.s ?? 0,
|
|
171
|
+
};
|
|
172
|
+
const calendarDate = toWallClockCalendarDate(parts);
|
|
173
|
+
const isRealDate = calendarDate.getMonth() === month - 1 && calendarDate.getDate() === day;
|
|
174
|
+
if (!isRealDate || parts.hours > 23 || parts.minutes > 59) {
|
|
175
|
+
return undefined;
|
|
176
|
+
}
|
|
177
|
+
return parts;
|
|
178
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type FC, type ReactNode } from 'react';
|
|
2
|
+
import { AlertManager } from 'react-alert';
|
|
3
|
+
import { AuthContextProps } from 'react-oidc-context';
|
|
4
|
+
interface ApiInitializerProps {
|
|
5
|
+
callback: (alert: AlertManager, auth: AuthContextProps) => Promise<unknown>;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const ApiInitializer: FC<ApiInitializerProps>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Loader } from "../mui/Loader";
|
|
3
|
+
import { useCallback, useEffect, useState, } from 'react';
|
|
4
|
+
import { useAlert } from 'react-alert';
|
|
5
|
+
import { useAuth } from 'react-oidc-context';
|
|
6
|
+
export const ApiInitializer = ({ callback, children, }) => {
|
|
7
|
+
const [loading, setLoading] = useState(true);
|
|
8
|
+
const alert = useAlert();
|
|
9
|
+
const auth = useAuth();
|
|
10
|
+
const handleInitialLoad = useCallback(async () => {
|
|
11
|
+
await callback(alert, auth);
|
|
12
|
+
setLoading(false);
|
|
13
|
+
}, [alert, auth, callback]);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
handleInitialLoad();
|
|
16
|
+
}, [handleInitialLoad]);
|
|
17
|
+
if (loading) {
|
|
18
|
+
return _jsx(Loader, { active: true, size: "fullscreen", disableAutoFocus: true });
|
|
19
|
+
}
|
|
20
|
+
return _jsx(_Fragment, { children: children });
|
|
21
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { hasAuthParams, useAuth } from 'react-oidc-context';
|
|
4
|
+
import { ErrorResponse } from 'oidc-client-ts';
|
|
5
|
+
import { Loader } from "../mui";
|
|
6
|
+
export const AuthWrapper = ({ children, appLoading }) => {
|
|
7
|
+
const auth = useAuth();
|
|
8
|
+
const [loginAttempted, setLoginAttempted] = useState(false);
|
|
9
|
+
// Attempt silent sign-in once if appropriate
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (!hasAuthParams() &&
|
|
12
|
+
!loginAttempted &&
|
|
13
|
+
!auth.isAuthenticated &&
|
|
14
|
+
!auth.activeNavigator &&
|
|
15
|
+
!auth.isLoading &&
|
|
16
|
+
!auth.error) {
|
|
17
|
+
setLoginAttempted(true);
|
|
18
|
+
auth.signinSilent();
|
|
19
|
+
}
|
|
20
|
+
}, [auth, loginAttempted]);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (!auth.error) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (auth.error instanceof ErrorResponse &&
|
|
26
|
+
['login_required'].includes(auth.error.error)) {
|
|
27
|
+
auth.clearStaleState().finally(() => auth.signinRedirect());
|
|
28
|
+
}
|
|
29
|
+
}, [auth.error, auth]);
|
|
30
|
+
const isLoading = auth.isLoading || appLoading;
|
|
31
|
+
if (isLoading) {
|
|
32
|
+
return _jsx(Loader, { active: true, size: "fullscreen" });
|
|
33
|
+
}
|
|
34
|
+
if (!auth.isAuthenticated) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return _jsx(_Fragment, { children: children });
|
|
38
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { useAlert } from 'react-alert';
|
|
4
|
+
import { useAuth } from 'react-oidc-context';
|
|
5
|
+
import { api, getErrHandler } from "../services";
|
|
6
|
+
export const AxiosErrorsInterceptorWrapper = ({ children }) => {
|
|
7
|
+
const auth = useAuth();
|
|
8
|
+
const alert = useAlert();
|
|
9
|
+
const [errInterceptorLoaded, setErrInterceptorLoaded] = useState();
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (auth.isLoading) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const errInterceptorLoaded = api.interceptors.response.use((res) => res, getErrHandler(alert, () => {
|
|
15
|
+
return new Promise(() => {
|
|
16
|
+
sessionStorage.setItem('REDIRECT_URI', window.location.href);
|
|
17
|
+
auth.signinRedirect();
|
|
18
|
+
});
|
|
19
|
+
}));
|
|
20
|
+
setErrInterceptorLoaded(errInterceptorLoaded);
|
|
21
|
+
return () => {
|
|
22
|
+
setErrInterceptorLoaded(undefined);
|
|
23
|
+
api.interceptors.response.eject(errInterceptorLoaded);
|
|
24
|
+
};
|
|
25
|
+
}, [alert, auth]);
|
|
26
|
+
if (!errInterceptorLoaded) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
return _jsx(_Fragment, { children: children });
|
|
30
|
+
};
|
package/README.md
DELETED