@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
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useRef, } from 'react';
|
|
3
|
+
import ContentEditable from 'react-contenteditable';
|
|
4
|
+
import { noop } from "../../utils/noop";
|
|
5
|
+
import sanitizeHtml from 'sanitize-html';
|
|
6
|
+
import { makeStyles } from '@mui/styles';
|
|
7
|
+
const useStyles = makeStyles(() => ({
|
|
8
|
+
root: {
|
|
9
|
+
display: 'inline-block',
|
|
10
|
+
position: 'relative',
|
|
11
|
+
zIndex: '1',
|
|
12
|
+
outline: 'none',
|
|
13
|
+
'&:focus': {
|
|
14
|
+
background: 'white',
|
|
15
|
+
maxHeight: 20,
|
|
16
|
+
},
|
|
17
|
+
'&:not(:focus)': {
|
|
18
|
+
whiteSpace: 'nowrap',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
}), {
|
|
22
|
+
name: 'EditableLabel',
|
|
23
|
+
});
|
|
24
|
+
export const EditableLabel = ({ onBlur = noop, initialValue = '', }) => {
|
|
25
|
+
const text = useRef(initialValue);
|
|
26
|
+
const sanitizeStr = useCallback((str) => {
|
|
27
|
+
return sanitizeHtml(str, { allowedTags: [], allowedAttributes: {} });
|
|
28
|
+
}, []);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (text.current !== initialValue) {
|
|
31
|
+
text.current = initialValue;
|
|
32
|
+
}
|
|
33
|
+
}, [initialValue]);
|
|
34
|
+
const handleChange = useCallback((evt) => {
|
|
35
|
+
text.current = sanitizeStr(evt.currentTarget.textContent);
|
|
36
|
+
}, [sanitizeStr]);
|
|
37
|
+
const handleBlur = useCallback((e) => {
|
|
38
|
+
if (!text.current) {
|
|
39
|
+
// revert to initialValue if empty on blur
|
|
40
|
+
text.current = initialValue;
|
|
41
|
+
e.currentTarget.textContent = initialValue;
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
onBlur(text.current);
|
|
46
|
+
}
|
|
47
|
+
}, [initialValue, onBlur]);
|
|
48
|
+
const updateCaretPosition = useCallback((el, pos) => {
|
|
49
|
+
if (pos >= 0 && pos <= text.current.length) {
|
|
50
|
+
window.getSelection().setPosition(el?.childNodes[0], pos);
|
|
51
|
+
}
|
|
52
|
+
}, []);
|
|
53
|
+
const handlePaste = useCallback((e) => {
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
const { focusOffset, anchorOffset } = window.getSelection();
|
|
56
|
+
const [selectionStart, selectionEnd] = [focusOffset, anchorOffset].sort();
|
|
57
|
+
const { textContent } = e.currentTarget;
|
|
58
|
+
const selection = textContent.substring(selectionStart, selectionEnd);
|
|
59
|
+
const pasteValue = sanitizeStr(e.clipboardData.getData('text'));
|
|
60
|
+
const preparedValue = selection
|
|
61
|
+
? textContent.replace(selection, pasteValue)
|
|
62
|
+
: textContent.substring(0, selectionStart) +
|
|
63
|
+
pasteValue +
|
|
64
|
+
textContent.substring(selectionEnd);
|
|
65
|
+
text.current = preparedValue;
|
|
66
|
+
e.currentTarget.textContent = preparedValue;
|
|
67
|
+
updateCaretPosition(e.currentTarget, selectionStart + pasteValue.length);
|
|
68
|
+
}, [sanitizeStr, updateCaretPosition]);
|
|
69
|
+
const onKeyDown = useCallback((e) => {
|
|
70
|
+
if (e.key === 'Enter') {
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
e.currentTarget.blur();
|
|
73
|
+
}
|
|
74
|
+
else if (['ArrowLeft', 'ArrowRight'].includes(e.key)) {
|
|
75
|
+
const prevOffset = window.getSelection().focusOffset;
|
|
76
|
+
updateCaretPosition(e.currentTarget, prevOffset + (e.key === 'ArrowLeft' ? -1 : 1));
|
|
77
|
+
}
|
|
78
|
+
}, [updateCaretPosition]);
|
|
79
|
+
const classes = useStyles();
|
|
80
|
+
return (_jsx(ContentEditable, { className: classes.root, html: text.current, onPaste: handlePaste, onBlur: handleBlur, onChange: handleChange, onKeyDown: onKeyDown }));
|
|
81
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import _trimEnd from 'lodash/trimEnd';
|
|
4
|
+
import Link from '@mui/material/Link';
|
|
5
|
+
const dmUrlPrefix = _trimEnd(process.env.REACT_APP_DM_BASE_URL || import.meta.env?.VITE_APP_DM_BASE_URL);
|
|
6
|
+
export const ExternalLink = ({ prefix, path, content, ...props }) => {
|
|
7
|
+
const onClick = useCallback((e) => {
|
|
8
|
+
e.stopPropagation();
|
|
9
|
+
}, []);
|
|
10
|
+
return (_jsx(Link, { href: `${prefix ?? dmUrlPrefix}${path}`, color: "primary.main", target: "_blank", rel: "nofollow noopener", onClick: onClick, ...props, children: content }));
|
|
11
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type DropzoneOptions } from 'react-dropzone';
|
|
3
|
+
export declare type FileInputValue = Partial<File & {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
}>;
|
|
7
|
+
export interface FileInputCommonProps<T extends FileInputValue = FileInputValue> extends DropzoneOptions {
|
|
8
|
+
id: string;
|
|
9
|
+
value?: T | Array<T>;
|
|
10
|
+
multiple?: boolean;
|
|
11
|
+
disableAdditionalUploads?: boolean;
|
|
12
|
+
onChange?: (value: T | Array<T>) => void;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
onDownload?: (fileName: string, fileId?: string) => void;
|
|
15
|
+
}
|
|
16
|
+
export interface FileInputSingleProps<T extends FileInputValue> extends FileInputCommonProps<T> {
|
|
17
|
+
multiple?: false;
|
|
18
|
+
value?: T;
|
|
19
|
+
onChange?: (value: T) => void;
|
|
20
|
+
}
|
|
21
|
+
export interface FileInputMultipleProps<T extends FileInputValue> extends FileInputCommonProps<T> {
|
|
22
|
+
multiple: true;
|
|
23
|
+
value?: Array<T>;
|
|
24
|
+
onChange?: (value: Array<T>) => void;
|
|
25
|
+
}
|
|
26
|
+
export declare function FileInput<T extends FileInputValue>(props: FileInputSingleProps<T>): JSX.Element;
|
|
27
|
+
export declare function FileInput<T extends FileInputValue>(props: FileInputMultipleProps<T>): JSX.Element;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { Icon } from "../Icon";
|
|
4
|
+
import { makeStyles } from '@mui/styles';
|
|
5
|
+
import { Button, Link, Stack, Typography } from '@mui/material';
|
|
6
|
+
import { useDropzone } from 'react-dropzone';
|
|
7
|
+
import { TransLabel } from "../../i18n/trans/label";
|
|
8
|
+
import { getAccessabilityValue } from "../../utils";
|
|
9
|
+
import classNames from 'classnames';
|
|
10
|
+
const useStyles = makeStyles((theme) => ({
|
|
11
|
+
uploadControl: {
|
|
12
|
+
display: 'inline-flex',
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
'&:hover': {
|
|
15
|
+
color: theme.palette.action.hoverText,
|
|
16
|
+
},
|
|
17
|
+
'&, & + .Icon-root': {
|
|
18
|
+
cursor: 'pointer',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
input: {
|
|
22
|
+
display: 'none',
|
|
23
|
+
},
|
|
24
|
+
accessibilityUploadControl: {
|
|
25
|
+
textDecoration: 'underline',
|
|
26
|
+
},
|
|
27
|
+
}), {
|
|
28
|
+
name: 'FileInput',
|
|
29
|
+
});
|
|
30
|
+
const getValue = (value) => Array.isArray(value) ? value : Boolean(value) ? [value] : [];
|
|
31
|
+
// Function overloads to accept both prop types MultipleProps & SingleProps
|
|
32
|
+
export function FileInput(props) {
|
|
33
|
+
const { id, value: defaultValue, accept, onChange, multiple = false, disableAdditionalUploads = false, onDownload, } = props;
|
|
34
|
+
const [value, setValue] = useState(getValue(defaultValue));
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
setValue(getValue(defaultValue));
|
|
37
|
+
}, [defaultValue, multiple]);
|
|
38
|
+
const accessibility = useMemo(getAccessabilityValue, []);
|
|
39
|
+
const handleClear = useCallback(() => {
|
|
40
|
+
setValue([]);
|
|
41
|
+
onChange?.(multiple ? [] : undefined);
|
|
42
|
+
}, [multiple, onChange]);
|
|
43
|
+
const onDrop = useCallback((acceptedFiles) => {
|
|
44
|
+
setValue(acceptedFiles);
|
|
45
|
+
if (!onChange)
|
|
46
|
+
return;
|
|
47
|
+
const [file] = acceptedFiles;
|
|
48
|
+
onChange(multiple ? acceptedFiles : file);
|
|
49
|
+
}, [multiple, onChange]);
|
|
50
|
+
const { getRootProps, getInputProps, open } = useDropzone({
|
|
51
|
+
accept,
|
|
52
|
+
multiple,
|
|
53
|
+
onDrop,
|
|
54
|
+
noClick: true,
|
|
55
|
+
});
|
|
56
|
+
const files = useMemo(() => value.map(({ name, id }) => {
|
|
57
|
+
return onDownload ? (_jsx(Button, { component: Link, title: name, variant: "text", sx: { paddingLeft: 0, paddingBottom: 0 }, noWrap: true, onClick: () => onDownload?.(name, id), children: name }, name)) : (_jsx(Typography, { title: name, component: "div", variant: "body2", color: "primary.main", noWrap: true, children: name }, name));
|
|
58
|
+
}), [onDownload, value]);
|
|
59
|
+
const classes = useStyles();
|
|
60
|
+
const hasValue = Boolean(value.length);
|
|
61
|
+
return (_jsxs("div", { ...getRootProps({
|
|
62
|
+
onClick: (e) => e.preventDefault(),
|
|
63
|
+
}), children: [_jsx("input", { className: classes.input, id: id, ...getInputProps() }), hasValue && files, _jsxs(Stack, { direction: "row", sx: { my: 'auto', color: 'primary.main' }, className: classNames({
|
|
64
|
+
[classes.accessibilityUploadControl]: accessibility,
|
|
65
|
+
}), children: [_jsxs(Typography, { component: "label", htmlFor: id, variant: "body2", className: classNames(classes.uploadControl), noWrap: true, onClick: open, children: [(!hasValue || !disableAdditionalUploads) && (_jsx(Icon, { name: "upload", size: 13, sx: { mr: 0.5, ...(hasValue && { color: 'icons.main', mt: 1 }) } })), !hasValue && _jsx(TransLabel, { i18nKey: "uploadFile" })] }), hasValue && (_jsx(Icon, { name: "trash", size: 13, sx: { ...(hasValue && { color: 'icons.main', mt: 1 }) }, onClick: handleClear }))] })] }));
|
|
66
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ElementType, FC, ReactNode } from 'react';
|
|
2
|
+
import { FormControlProps as MuiFormControlProps } from '@mui/material/FormControl';
|
|
3
|
+
export interface FormControlProps extends Omit<MuiFormControlProps, 'error'> {
|
|
4
|
+
component?: ReactNode;
|
|
5
|
+
label?: ReactNode;
|
|
6
|
+
labelPosition?: 'top' | 'left';
|
|
7
|
+
labelComponent?: ElementType;
|
|
8
|
+
error?: ReactNode | boolean;
|
|
9
|
+
helper?: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Field name. Used to derive the validation-error test hook
|
|
12
|
+
* (`<kebab-name>-error`); kept as a general prop so it can also drive
|
|
13
|
+
* label/aria association later.
|
|
14
|
+
*/
|
|
15
|
+
name?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Optional id for the visible label element. When set, the consuming field
|
|
18
|
+
* can reference it from its input via `aria-labelledby` to give the control a
|
|
19
|
+
* programmatic accessible name (purely additive — no change when omitted).
|
|
20
|
+
*/
|
|
21
|
+
labelId?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const FormControl: FC<FormControlProps>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { makeStyles } from '@mui/styles';
|
|
3
|
+
import MuiFormControl from '@mui/material/FormControl';
|
|
4
|
+
import { FormHelperText, InputLabel, Typography } from '@mui/material';
|
|
5
|
+
import { useLanguage } from "../../hooks/useLanguage";
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import _kebabCase from 'lodash/kebabCase';
|
|
8
|
+
const useStyles = makeStyles((theme) => ({
|
|
9
|
+
labelPositionLeft: {
|
|
10
|
+
display: 'flex',
|
|
11
|
+
width: '100%',
|
|
12
|
+
flexDirection: 'row',
|
|
13
|
+
justifyContent: 'space-between',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
'& $label': {
|
|
16
|
+
margin: 'unset',
|
|
17
|
+
whiteSpace: 'nowrap',
|
|
18
|
+
marginRight: theme.spacing(1),
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
label: {
|
|
22
|
+
position: 'relative',
|
|
23
|
+
transform: 'unset',
|
|
24
|
+
color: '#48587F',
|
|
25
|
+
},
|
|
26
|
+
}), {
|
|
27
|
+
name: 'FormControl',
|
|
28
|
+
});
|
|
29
|
+
export const FormControl = (props) => {
|
|
30
|
+
const { labelPosition = 'top', labelComponent = InputLabel, label, children, error, helper, className, margin = 'none', required, name, labelId, ...controlProps } = props;
|
|
31
|
+
const classes = useStyles();
|
|
32
|
+
const lang = useLanguage();
|
|
33
|
+
return (_jsxs(MuiFormControl, { className: classNames(className, {
|
|
34
|
+
[classes.labelPositionLeft]: labelPosition === 'left',
|
|
35
|
+
}), margin: margin, fullWidth: true, error: Boolean(error), ...controlProps, children: [label && (_jsx(Typography, { className: classes.label, component: labelComponent, ...(Boolean(!props.labelComponent) && { shrink: true }), ...(labelId && { id: labelId }), htmlFor: controlProps.id, textAlign: "left", variant: "body2", gutterBottom: true, required: required, children: label })), children, helper && _jsx(FormHelperText, { error: false, children: helper }), error && typeof error !== 'boolean' && (_jsx(FormHelperText, { "data-testid": name ? `${_kebabCase(name)}-error` : undefined, children: error }, lang))] }));
|
|
36
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Typography } from '@mui/material';
|
|
3
|
+
export const FormField = ({ label, controller, controlClassname, }) => {
|
|
4
|
+
return (_jsxs(Box, { sx: {
|
|
5
|
+
display: 'flex',
|
|
6
|
+
alignItems: 'center',
|
|
7
|
+
justifyContent: 'space-between',
|
|
8
|
+
}, children: [_jsx(Typography, { variant: "body1", sx: {
|
|
9
|
+
display: 'inline-flex',
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
}, children: label }), _jsx(Box, { className: controlClassname, children: controller })] }));
|
|
12
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { MouseEvent } from 'react';
|
|
2
|
+
import { BoxProps } from '@mui/material/Box';
|
|
3
|
+
import icons from "../../icons/index.json";
|
|
4
|
+
export declare type IconName = keyof typeof icons;
|
|
5
|
+
export interface IconProps extends Pick<BoxProps, 'sx'> {
|
|
6
|
+
id?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
margin?: boolean;
|
|
9
|
+
name: IconName | string;
|
|
10
|
+
className?: string;
|
|
11
|
+
color?: 'default' | 'primary' | 'secondary' | 'yellow' | 'white' | 'black' | 'success' | 'error' | 'warning';
|
|
12
|
+
size?: number | string;
|
|
13
|
+
fontSize?: number | string;
|
|
14
|
+
width?: number | string;
|
|
15
|
+
height?: number | string;
|
|
16
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
17
|
+
'data-mui-internal-clone-element'?: string;
|
|
18
|
+
'aria-label'?: string;
|
|
19
|
+
role?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const Icon: import("react").ForwardRefExoticComponent<IconProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useMemo } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import Box from '@mui/material/Box';
|
|
5
|
+
import { generateUtilityClass } from '@mui/material';
|
|
6
|
+
export const Icon = forwardRef((props, ref) => {
|
|
7
|
+
const { id, name, className, sx, color, onClick, margin, disabled, size = 16, height, 'aria-label': ariaLabel, role, ...rest } = props;
|
|
8
|
+
const iconSize = rest.fontSize && rest.fontSize === 'medium' ? 24 : (rest.width ?? size);
|
|
9
|
+
const preparedSx = useMemo(() => ({
|
|
10
|
+
...sx,
|
|
11
|
+
...(onClick && { cursor: 'pointer' }),
|
|
12
|
+
...(margin && { margin: '0 0.25rem' }),
|
|
13
|
+
color: (theme) => {
|
|
14
|
+
if (disabled) {
|
|
15
|
+
return theme.palette.action.disabled;
|
|
16
|
+
}
|
|
17
|
+
else if (['black', 'white'].includes(color)) {
|
|
18
|
+
return theme.palette.common[color];
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
return theme.palette[color]?.main;
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
display: 'inline-block',
|
|
25
|
+
verticalAlign: 'middle',
|
|
26
|
+
width: iconSize,
|
|
27
|
+
height: height ?? iconSize,
|
|
28
|
+
'& svg': {
|
|
29
|
+
position: 'relative',
|
|
30
|
+
fill: 'currentColor',
|
|
31
|
+
width: '100%',
|
|
32
|
+
height: '100%',
|
|
33
|
+
verticalAlign: 'top',
|
|
34
|
+
'& use': {
|
|
35
|
+
display: 'inline-block',
|
|
36
|
+
width: '100%',
|
|
37
|
+
height: '100%',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
'&:hover': {
|
|
41
|
+
color: (theme) => !disabled && theme.palette.action.hoverText,
|
|
42
|
+
},
|
|
43
|
+
}), [color, disabled, height, iconSize, margin, onClick, sx]);
|
|
44
|
+
return (_jsx(Box, { id: id, component: "span", ref: ref, sx: preparedSx, className: classNames(className, generateUtilityClass('Icon', 'root')), onClick: onClick, "aria-label": ariaLabel, role: role, ...(rest['data-mui-internal-clone-element'] && {
|
|
45
|
+
'data-mui-internal-clone-element': rest['data-mui-internal-clone-element'],
|
|
46
|
+
}), children: _jsx("svg", { ...rest, ...(ariaLabel && { 'aria-hidden': true }), children: _jsx("use", { xmlnsXlink: "https://www.w3.org/1999/xlink", xlinkHref: `#icon-${name}` }) }) }));
|
|
47
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { FC, ReactNode } from 'react';
|
|
2
|
+
import InputBase, { InputBaseProps } from '@mui/material/InputBase';
|
|
3
|
+
import StandardInput from '@mui/material/Input';
|
|
4
|
+
import OutlinedInput from '@mui/material/OutlinedInput';
|
|
5
|
+
import FilledInput from '@mui/material/FilledInput';
|
|
6
|
+
import { FormControlProps } from "../FormControl";
|
|
7
|
+
export declare type InputVariant = 'base' | 'standard' | 'filled' | 'outlined';
|
|
8
|
+
export declare type InputElement = typeof InputBase | typeof StandardInput | typeof FilledInput | typeof OutlinedInput;
|
|
9
|
+
export interface InputComponentProps extends Omit<InputBaseProps, 'margin'> {
|
|
10
|
+
variant?: InputVariant;
|
|
11
|
+
['data-testid']?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const InputComponent: import("react").ForwardRefExoticComponent<Pick<InputComponentProps, "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<unknown>>;
|
|
14
|
+
export interface InputProps extends Omit<InputComponentProps, 'error'>, Pick<FormControlProps, 'margin' | 'helper'> {
|
|
15
|
+
className?: string;
|
|
16
|
+
label?: ReactNode;
|
|
17
|
+
/** @deprecated use startAdornment/endAdornment instead */
|
|
18
|
+
icon?: string;
|
|
19
|
+
required?: boolean;
|
|
20
|
+
allowedChars?: RegExp;
|
|
21
|
+
resetOnFail?: boolean;
|
|
22
|
+
labelPosition?: 'top' | 'left';
|
|
23
|
+
error?: ReactNode;
|
|
24
|
+
onBlurAsync?: InputComponentProps['onBlur'];
|
|
25
|
+
innerSpin?: boolean;
|
|
26
|
+
['data-testid']?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare const Input: FC<InputProps>;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect, useCallback, forwardRef } from 'react';
|
|
3
|
+
import { noop } from "../../utils/noop";
|
|
4
|
+
import { Icon } from "../Icon";
|
|
5
|
+
import InputBase from '@mui/material/InputBase';
|
|
6
|
+
import StandardInput from '@mui/material/Input';
|
|
7
|
+
import OutlinedInput from '@mui/material/OutlinedInput';
|
|
8
|
+
import FilledInput from '@mui/material/FilledInput';
|
|
9
|
+
import { FormControl } from "../FormControl";
|
|
10
|
+
import useId from '@mui/utils/useId';
|
|
11
|
+
import InputAdornment from '@mui/material/InputAdornment';
|
|
12
|
+
import { trimEnd, trimStart } from "../../utils/input";
|
|
13
|
+
import { makeStyles } from '@mui/styles';
|
|
14
|
+
import classNames from 'classnames';
|
|
15
|
+
import _kebabCase from 'lodash/kebabCase';
|
|
16
|
+
const HEX_REGEX = /^#([A-Fa-f0-9]{6})$/;
|
|
17
|
+
const useStyles = makeStyles((theme) => ({
|
|
18
|
+
input: {
|
|
19
|
+
'& .MuiInputBase-input': {
|
|
20
|
+
'&[type=number]::-webkit-inner-spin-button, &[type=number]::-webkit-outer-spin-button': {
|
|
21
|
+
WebkitAppearance: 'none',
|
|
22
|
+
margin: 0,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
disabled: {
|
|
27
|
+
'& input': {
|
|
28
|
+
cursor: 'not-allowed',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
colorPicker: { color: theme.palette.text.primary },
|
|
32
|
+
}), {
|
|
33
|
+
name: 'Layout',
|
|
34
|
+
});
|
|
35
|
+
const variants = new Map([
|
|
36
|
+
['base', InputBase],
|
|
37
|
+
['standard', StandardInput],
|
|
38
|
+
['filled', FilledInput],
|
|
39
|
+
['outlined', OutlinedInput],
|
|
40
|
+
]);
|
|
41
|
+
export const InputComponent = forwardRef(({ variant = 'filled', ...props }, ref) => {
|
|
42
|
+
const Component = variants.get(variant);
|
|
43
|
+
const inputName = props.id || props.name;
|
|
44
|
+
return (_jsx(Component, { ref: ref, ...props, "data-testid": props['data-testid'] ??
|
|
45
|
+
`form-input-field${inputName ? `-${_kebabCase(inputName)}` : ''}` }));
|
|
46
|
+
});
|
|
47
|
+
const InputDateColor = ({ value: initValue, className, onChange, onBlur, }) => {
|
|
48
|
+
const [value, setValue] = useState(initValue);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
setValue(initValue);
|
|
51
|
+
}, [initValue]);
|
|
52
|
+
const handleBlur = useCallback((event) => {
|
|
53
|
+
let processed = event.target.value.trim();
|
|
54
|
+
if (processed && processed[0] !== '#') {
|
|
55
|
+
processed = '#' + processed;
|
|
56
|
+
}
|
|
57
|
+
event.target.value =
|
|
58
|
+
!processed || HEX_REGEX.test(processed) ? processed : String(initValue);
|
|
59
|
+
onChange(event);
|
|
60
|
+
onBlur(event);
|
|
61
|
+
}, [initValue, onBlur, onChange]);
|
|
62
|
+
return (_jsx(InputAdornment, { position: "start", className: className, children: _jsx(Input, { variant: "base", value: value, onChange: (event) => setValue(event.target.value), onBlur: handleBlur }) }));
|
|
63
|
+
};
|
|
64
|
+
export const Input = ({ className, id: idProp, label, labelPosition, name, type, value: initialValue = '', error, helper, icon, required, allowedChars, onChange = noop, onBlur = noop, onBlurAsync, resetOnFail, margin, fullWidth = true, innerSpin = false, ...props }) => {
|
|
65
|
+
const id = useId(idProp ?? name);
|
|
66
|
+
const [value, setValue] = useState(initialValue);
|
|
67
|
+
const handleChange = useCallback((event) => {
|
|
68
|
+
const value = (event.target.value = trimStart(event.target.value));
|
|
69
|
+
if (!allowedChars || allowedChars.test(value)) {
|
|
70
|
+
setValue(value);
|
|
71
|
+
onChange(event);
|
|
72
|
+
}
|
|
73
|
+
}, [allowedChars, onChange]);
|
|
74
|
+
const handleBlur = useCallback(async (event) => {
|
|
75
|
+
event.target.value = trimEnd(event.target.value) ?? '';
|
|
76
|
+
onBlur(event);
|
|
77
|
+
if (type !== 'color') {
|
|
78
|
+
setValue(event.target.value);
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
await onBlurAsync?.(event);
|
|
82
|
+
}
|
|
83
|
+
catch (e) {
|
|
84
|
+
if (type !== 'color') {
|
|
85
|
+
resetOnFail && setValue(initialValue);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, [onBlur, type, onBlurAsync, resetOnFail, initialValue]);
|
|
89
|
+
const handleKeyDown = useCallback((event) => event.key === 'Enter' && handleBlur(event), [handleBlur]);
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
setValue(initialValue);
|
|
92
|
+
}, [initialValue]);
|
|
93
|
+
const classes = useStyles(props);
|
|
94
|
+
return (_jsx(FormControl, { id: id, label: label, labelPosition: labelPosition, error: error, helper: helper, margin: margin, required: required, fullWidth: fullWidth, name: name, children: _jsx(InputComponent, { id: id, className: classNames({
|
|
95
|
+
[classes.input]: !innerSpin,
|
|
96
|
+
[classes.disabled]: props.disabled,
|
|
97
|
+
}, className), error: Boolean(error), value: value, type: type, onBlur: handleBlur, onChange: handleChange, onKeyDown: handleKeyDown, ...(icon && {
|
|
98
|
+
endAdornment: (_jsx(InputAdornment, { position: "end", children: _jsx(Icon, { name: icon }) })),
|
|
99
|
+
}), ...(type === 'color' && {
|
|
100
|
+
startAdornment: (_jsx(InputDateColor, { value: value, className: classes.colorPicker, onChange: handleChange, onBlur: handleBlur })),
|
|
101
|
+
}), ...props }) }));
|
|
102
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ModalProps } from '@mui/material/Modal';
|
|
3
|
+
export interface LoaderProps extends Omit<ModalProps, 'open' | 'children'> {
|
|
4
|
+
active?: boolean;
|
|
5
|
+
hideSpinner?: boolean;
|
|
6
|
+
hideOverlay?: boolean;
|
|
7
|
+
size: 'xs' | 'container' | 'fullscreen';
|
|
8
|
+
}
|
|
9
|
+
export declare const Loader: FC<LoaderProps>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { makeStyles } from '@mui/styles';
|
|
4
|
+
import Modal from '@mui/material/Modal';
|
|
5
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
|
6
|
+
const useStyles = makeStyles((theme) => ({
|
|
7
|
+
overlay: {
|
|
8
|
+
display: 'flex',
|
|
9
|
+
background: 'rgba(0,0,0,.1)',
|
|
10
|
+
},
|
|
11
|
+
loader: {
|
|
12
|
+
position: 'relative',
|
|
13
|
+
display: ({ hideSpinner }) => (hideSpinner ? 'none' : 'inline-block'),
|
|
14
|
+
margin: 'auto',
|
|
15
|
+
'& .MuiCircularProgress-root': {
|
|
16
|
+
'&:first-of-type': { color: theme.palette.common.white },
|
|
17
|
+
'&:last-of-type': { color: theme.palette.primary.main },
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
spinner: {
|
|
21
|
+
position: 'absolute',
|
|
22
|
+
left: 0,
|
|
23
|
+
top: 0,
|
|
24
|
+
zIndex: 1,
|
|
25
|
+
},
|
|
26
|
+
}), {
|
|
27
|
+
name: 'Loader',
|
|
28
|
+
});
|
|
29
|
+
export const Loader = (props) => {
|
|
30
|
+
const { active, size,
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
32
|
+
hideSpinner = false, hideOverlay = false, ...modalProps } = props;
|
|
33
|
+
const classes = useStyles(props);
|
|
34
|
+
const circularProps = useMemo(() => ({
|
|
35
|
+
size: size === 'xs' ? 16 : 75,
|
|
36
|
+
thickness: size === 'xs' ? 5 : 2,
|
|
37
|
+
}), [size]);
|
|
38
|
+
const loader = useMemo(() => (_jsxs("div", { className: classes.loader, children: [_jsx(CircularProgress, { variant: "determinate", value: 100, ...circularProps }), _jsx(CircularProgress, { className: classes.spinner, ...circularProps, disableShrink: true })] })), [circularProps, classes.loader, classes.spinner]);
|
|
39
|
+
if (!active)
|
|
40
|
+
return null;
|
|
41
|
+
if (size === 'xs')
|
|
42
|
+
return loader;
|
|
43
|
+
const disablePortal = size !== 'fullscreen';
|
|
44
|
+
return (_jsx(Modal, { open: active, className: classes.overlay, disablePortal: disablePortal, ...(disablePortal && {
|
|
45
|
+
sx: { position: 'absolute' },
|
|
46
|
+
}), hideBackdrop: hideOverlay, disableAutoFocus: true, ...modalProps, children: loader }));
|
|
47
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FC, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { DialogProps } from '@mui/material/Dialog';
|
|
3
|
+
import { ButtonProps } from "../Button";
|
|
4
|
+
import { IconButtonProps } from '@mui/material';
|
|
5
|
+
export interface ModalProps extends Omit<DialogProps, 'title'> {
|
|
6
|
+
disableBackdropClick?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
title: ReactNode;
|
|
9
|
+
message?: string;
|
|
10
|
+
['data-testid']?: string;
|
|
11
|
+
onClose?: (event: {}, reason: 'backdropClick' | 'escapeKeyDown' | 'action') => void;
|
|
12
|
+
actionButton?: boolean | ButtonProps | ReactElement;
|
|
13
|
+
cancelButton?: boolean | ButtonProps | ReactElement;
|
|
14
|
+
closeButton?: boolean | IconButtonProps | ReactElement;
|
|
15
|
+
}
|
|
16
|
+
export declare const Modal: FC<ModalProps>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { isValidElement, useCallback, useMemo } from 'react';
|
|
3
|
+
import useId from '@mui/utils/useId';
|
|
4
|
+
import { makeStyles } from '@mui/styles';
|
|
5
|
+
import Dialog from '@mui/material/Dialog';
|
|
6
|
+
import Stack from '@mui/material/Stack';
|
|
7
|
+
import DialogTitle from '@mui/material/DialogTitle';
|
|
8
|
+
import DialogContent from '@mui/material/DialogContent';
|
|
9
|
+
import DialogActions from '@mui/material/DialogActions';
|
|
10
|
+
import IconButton from '@mui/material/IconButton';
|
|
11
|
+
import { Button } from "../Button";
|
|
12
|
+
import { Icon } from "../Icon";
|
|
13
|
+
import classNames from 'classnames';
|
|
14
|
+
import { Typography } from '@mui/material';
|
|
15
|
+
import { TransButton } from "../../i18n/trans/button";
|
|
16
|
+
const useStyles = makeStyles((theme) => ({
|
|
17
|
+
root: {},
|
|
18
|
+
content: {},
|
|
19
|
+
paper: {
|
|
20
|
+
minWidth: theme.spacing(40),
|
|
21
|
+
maxWidth: ({ maxWidth }) => !maxWidth && '90vw',
|
|
22
|
+
},
|
|
23
|
+
}), {
|
|
24
|
+
name: 'Modal',
|
|
25
|
+
});
|
|
26
|
+
export const Modal = (props) => {
|
|
27
|
+
const { className, title, message, children, onClose, actionButton, cancelButton = true, closeButton = true, disableBackdropClick = false, ...dialogProps } = props;
|
|
28
|
+
const classes = useStyles(props);
|
|
29
|
+
// Link the title to the dialog so it has an accessible name
|
|
30
|
+
// (getByRole('dialog', { name }) / screen readers).
|
|
31
|
+
const titleId = useId();
|
|
32
|
+
const handleClose = useCallback((event, reason = 'escapeKeyDown') => {
|
|
33
|
+
if (disableBackdropClick && reason && reason === 'backdropClick') {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
onClose?.(event, reason);
|
|
37
|
+
}, [disableBackdropClick, onClose]);
|
|
38
|
+
const handleButtonClick = useCallback(async (event, button) => {
|
|
39
|
+
if (isValidElement(button))
|
|
40
|
+
return;
|
|
41
|
+
if (button?.onClick)
|
|
42
|
+
await button.onClick(event);
|
|
43
|
+
handleClose(event, 'action');
|
|
44
|
+
}, [handleClose]);
|
|
45
|
+
const renderButton = useCallback((button, fallback) => {
|
|
46
|
+
if (!button)
|
|
47
|
+
return null;
|
|
48
|
+
if (isValidElement(button))
|
|
49
|
+
return button;
|
|
50
|
+
return fallback({
|
|
51
|
+
...button,
|
|
52
|
+
onClick: (event) => handleButtonClick(event, button),
|
|
53
|
+
});
|
|
54
|
+
}, [handleButtonClick]);
|
|
55
|
+
const ModalCloseButton = useMemo(() => renderButton(closeButton, (buttonProps) => (_jsx(IconButton, { "data-testid": "modal-close-button", ...buttonProps, children: _jsx(Icon, { name: "close", size: 24 }) }))), [closeButton, renderButton]);
|
|
56
|
+
const ModalActionButton = useMemo(() => renderButton(actionButton, (buttonProps) => (_jsx(Button, { variant: "contained", label: _jsx(TransButton, { i18nKey: "save" }), "data-testid": "modal-action-button", ...buttonProps }))), [actionButton, renderButton]);
|
|
57
|
+
const ModalCancelButton = useMemo(() => renderButton(cancelButton, (buttonProps) => (_jsx(Button, { variant: "text", label: _jsx(TransButton, { i18nKey: "cancel" }), "data-testid": "modal-cancel-button", ...buttonProps }))), [cancelButton, renderButton]);
|
|
58
|
+
return (_jsxs(Dialog, { classes: {
|
|
59
|
+
root: classNames(classes.root, className),
|
|
60
|
+
paper: classes.paper,
|
|
61
|
+
}, onClose: handleClose, "aria-labelledby": titleId, ...dialogProps, children: [_jsxs(DialogTitle, { component: Stack, flexDirection: "row", alignItems: "center", children: [_jsx(Typography, { id: titleId, variant: "subtitle", sx: { flex: 1 }, children: title }), ModalCloseButton] }), _jsx(DialogContent, { ...(message && { dangerouslySetInnerHTML: { __html: message } }), ...(children && !message && { children }), classes: {
|
|
62
|
+
root: classes.content,
|
|
63
|
+
} }), _jsxs(DialogActions, { children: [ModalCancelButton, ModalActionButton] })] }));
|
|
64
|
+
};
|