@turnit-ou/shared 0.0.0-stage → 2.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/@mui/index.d.ts +125 -0
- package/@types/axios/index.d.ts +7 -0
- package/@types/openapi-client-axios/index.d.ts +5 -0
- package/@types/openapi-typescript/index.d.ts +71 -0
- package/@types/react-final-form-arrays/index.d.ts +75 -0
- package/@types/react-table/index.d.ts +292 -0
- package/components/Alert/AlertTemplate.d.ts +3 -0
- package/components/Alert/AlertTemplate.js +66 -0
- package/components/Alert/index.d.ts +4 -0
- package/components/Alert/index.js +17 -0
- package/components/ConfirmButton.d.ts +15 -0
- package/components/ConfirmButton.js +47 -0
- package/components/Drawer.d.ts +4 -0
- package/components/Drawer.js +24 -0
- package/components/DrawerForm/DrawerFormCardActions.d.ts +5 -0
- package/components/DrawerForm/DrawerFormCardActions.js +21 -0
- package/components/DrawerForm/DrawerFormCloseButton.d.ts +3 -0
- package/components/DrawerForm/DrawerFormCloseButton.js +5 -0
- package/components/DrawerForm/DrawerFormContext.d.ts +7 -0
- package/components/DrawerForm/DrawerFormContext.js +4 -0
- package/components/DrawerForm.d.ts +10 -0
- package/components/DrawerForm.js +89 -0
- package/components/Editor/Editor.d.ts +9 -0
- package/components/Editor/Editor.js +36 -0
- package/components/Editor/Toolbar.d.ts +7 -0
- package/components/Editor/Toolbar.js +31 -0
- package/components/Editor/buttons/FormatLinkButton.d.ts +5 -0
- package/components/Editor/buttons/FormatLinkButton.js +64 -0
- package/components/Editor/buttons/InsertImageButton.d.ts +5 -0
- package/components/Editor/buttons/InsertImageButton.js +59 -0
- package/components/Editor/buttons.d.ts +15 -0
- package/components/Editor/buttons.js +70 -0
- package/components/Editor/createButton.d.ts +28 -0
- package/components/Editor/createButton.js +68 -0
- package/components/Editor/editor.scss +45 -0
- package/components/Ellipsis.d.ts +9 -0
- package/components/Ellipsis.js +22 -0
- package/components/EllipsisText.d.ts +8 -0
- package/components/EllipsisText.js +25 -0
- package/components/EnvironmentBanner.d.ts +8 -0
- package/components/EnvironmentBanner.js +25 -0
- package/components/Header/AccessibilityModal.d.ts +5 -0
- package/components/Header/AccessibilityModal.js +28 -0
- package/components/Header/AllowedBusinessEntityModal.d.ts +9 -0
- package/components/Header/AllowedBusinessEntityModal.js +24 -0
- package/components/Header/LanguageSelect.d.ts +2 -0
- package/components/Header/LanguageSelect.js +80 -0
- package/components/Header/MenuItems.d.ts +9 -0
- package/components/Header/MenuItems.js +55 -0
- package/components/Header/ModuleIcon.d.ts +7 -0
- package/components/Header/ModuleIcon.js +119 -0
- package/components/Header/index.d.ts +44 -0
- package/components/Header/index.js +89 -0
- package/components/Layout/LayoutCol.d.ts +8 -0
- package/components/Layout/LayoutCol.js +26 -0
- package/components/Layout/index.d.ts +32 -0
- package/components/Layout/index.js +56 -0
- package/components/Loadable.d.ts +11 -0
- package/components/Loadable.js +3 -0
- package/components/SearchCard.d.ts +8 -0
- package/components/SearchCard.js +81 -0
- package/components/SearchForm.d.ts +14 -0
- package/components/SearchForm.js +51 -0
- package/components/SearchFormTable.d.ts +8 -0
- package/components/SearchFormTable.js +32 -0
- package/components/SearchResult.d.ts +13 -0
- package/components/SearchResult.js +67 -0
- package/components/Table/TableCaption.d.ts +6 -0
- package/components/Table/TableCaption.js +25 -0
- package/components/Table/TableCell.d.ts +17 -0
- package/components/Table/TableCell.js +45 -0
- package/components/Table/TableCellEditable.d.ts +28 -0
- package/components/Table/TableCellEditable.js +151 -0
- package/components/Table/TableCellEditableAction.d.ts +13 -0
- package/components/Table/TableCellEditableAction.js +70 -0
- package/components/Table/TableCellEditableField.d.ts +17 -0
- package/components/Table/TableCellEditableField.js +1 -0
- package/components/Table/TableCellEditableTimeDuration.d.ts +13 -0
- package/components/Table/TableCellEditableTimeDuration.js +12 -0
- package/components/Table/TableContext.d.ts +11 -0
- package/components/Table/TableContext.js +4 -0
- package/components/Table/TablePagination.d.ts +5 -0
- package/components/Table/TablePagination.js +84 -0
- package/components/Table.d.ts +53 -0
- package/components/Table.js +389 -0
- package/components/Version.d.ts +5 -0
- package/components/Version.js +23 -0
- package/dto/businessEntity.d.ts +15 -0
- package/dto/businessEntity.js +1 -0
- package/dto/classification.d.ts +9 -0
- package/dto/classification.js +1 -0
- package/dto/classifier.d.ts +13 -0
- package/dto/classifier.js +4 -0
- package/dto/common.d.ts +5 -0
- package/dto/common.js +1 -0
- package/dto/fare.d.ts +11 -0
- package/dto/fare.js +1 -0
- package/dto/line-network.d.ts +23 -0
- package/dto/line-network.js +1 -0
- package/dto/option.d.ts +7 -0
- package/dto/option.js +1 -0
- package/dto/pagination.d.ts +10 -0
- package/dto/pagination.js +1 -0
- package/fields/FormCheckbox.d.ts +11 -0
- package/fields/FormCheckbox.js +5 -0
- package/fields/FormCheckboxGroup.d.ts +6 -0
- package/fields/FormCheckboxGroup.js +20 -0
- package/fields/FormController.d.ts +7 -0
- package/fields/FormController.js +16 -0
- package/fields/FormDatepicker.d.ts +8 -0
- package/fields/FormDatepicker.js +7 -0
- package/fields/FormInput.d.ts +8 -0
- package/fields/FormInput.js +4 -0
- package/fields/FormRadioGroup.d.ts +10 -0
- package/fields/FormRadioGroup.js +6 -0
- package/fields/FormSelect.d.ts +11 -0
- package/fields/FormSelect.js +9 -0
- package/fields/FormSwitch.d.ts +11 -0
- package/fields/FormSwitch.js +5 -0
- package/fields/FormTimeZoneSelect.d.ts +4 -0
- package/fields/FormTimeZoneSelect.js +8 -0
- package/fields/index.d.ts +9 -0
- package/fields/index.js +9 -0
- package/form/ArrayField.d.ts +27 -0
- package/form/ArrayField.js +69 -0
- package/form/CheckboxField.d.ts +8 -0
- package/form/CheckboxField.js +14 -0
- package/form/CheckboxGroupField.d.ts +6 -0
- package/form/CheckboxGroupField.js +15 -0
- package/form/ConditionField.d.ts +7 -0
- package/form/ConditionField.js +20 -0
- package/form/ContentField.d.ts +7 -0
- package/form/ContentField.js +15 -0
- package/form/CounterField.d.ts +5 -0
- package/form/CounterField.js +7 -0
- package/form/DateField.d.ts +8 -0
- package/form/DateField.js +52 -0
- package/form/DatesArrayField.d.ts +8 -0
- package/form/DatesArrayField.js +79 -0
- package/form/DependSelectField.d.ts +8 -0
- package/form/DependSelectField.js +12 -0
- package/form/EditorField.d.ts +5 -0
- package/form/EditorField.js +7 -0
- package/form/FileField.d.ts +12 -0
- package/form/FileField.js +9 -0
- package/form/FormField.d.ts +15 -0
- package/form/FormField.js +22 -0
- package/form/ModalFieldArray.d.ts +13 -0
- package/form/ModalFieldArray.js +62 -0
- package/form/PeriodField.d.ts +24 -0
- package/form/PeriodField.js +111 -0
- package/form/RadioGroupField.d.ts +10 -0
- package/form/RadioGroupField.js +21 -0
- package/form/SearchField.d.ts +19 -0
- package/form/SearchField.js +51 -0
- package/form/SelectField.d.ts +8 -0
- package/form/SelectField.js +13 -0
- package/form/SelectOwnerField.d.ts +11 -0
- package/form/SelectOwnerField.js +11 -0
- package/form/StopsSelect/StopSelectWithSearch.d.ts +28 -0
- package/form/StopsSelect/StopSelectWithSearch.js +181 -0
- package/form/StopsSelect/StopsSelect.d.ts +19 -0
- package/form/StopsSelect/StopsSelect.js +65 -0
- package/form/StopsSelect/StopsSelectModal.d.ts +26 -0
- package/form/StopsSelect/StopsSelectModal.js +280 -0
- package/form/StopsSelect/StopsSelectSearchForm.d.ts +22 -0
- package/form/StopsSelect/StopsSelectSearchForm.js +43 -0
- package/form/SwitchField.d.ts +9 -0
- package/form/SwitchField.js +16 -0
- package/form/TextField.d.ts +6 -0
- package/form/TextField.js +21 -0
- package/form/TimeDurationField.d.ts +6 -0
- package/form/TimeDurationField.js +54 -0
- package/form/TimeZoneField.d.ts +6 -0
- package/form/TimeZoneField.js +8 -0
- package/form/ToggleButtonGroupField.d.ts +12 -0
- package/form/ToggleButtonGroupField.js +16 -0
- package/form/hooks/addLazyFieldMetaState.d.ts +3 -0
- package/form/hooks/addLazyFieldMetaState.js +55 -0
- package/form/hooks/getValue.d.ts +3 -0
- package/form/hooks/getValue.js +60 -0
- package/form/hooks/useConstant.d.ts +13 -0
- package/form/hooks/useConstant.js +20 -0
- package/form/hooks/useConstantCallback.d.ts +7 -0
- package/form/hooks/useConstantCallback.js +14 -0
- package/form/hooks/useField.d.ts +3 -0
- package/form/hooks/useField.js +175 -0
- package/form/hooks/useFieldArray.d.ts +6 -0
- package/form/hooks/useFieldArray.js +87 -0
- package/form/hooks/useLatest.d.ts +3 -0
- package/form/hooks/useLatest.js +8 -0
- package/form/hooks/useModalTableSelectedRows.d.ts +12 -0
- package/form/hooks/useModalTableSelectedRows.js +66 -0
- package/form/hooks/useWatch.d.ts +12 -0
- package/form/hooks/useWatch.js +16 -0
- package/form/index.d.ts +45 -0
- package/form/index.js +58 -0
- package/form/mutators/change.d.ts +2 -0
- package/form/mutators/change.js +9 -0
- package/form/validate.d.ts +14 -0
- package/form/validate.js +39 -0
- package/helpers/capitalize.d.ts +1 -0
- package/helpers/capitalize.js +1 -0
- package/helpers/filter.d.ts +4 -0
- package/helpers/filter.js +21 -0
- package/helpers/formSubmit.d.ts +5 -0
- package/helpers/formSubmit.js +21 -0
- package/helpers/index.d.ts +7 -0
- package/helpers/index.js +7 -0
- package/helpers/makeClassificationOptions.d.ts +30 -0
- package/helpers/makeClassificationOptions.js +29 -0
- package/helpers/map.d.ts +1 -0
- package/helpers/map.js +1 -0
- package/helpers/openapi.d.ts +10 -0
- package/helpers/openapi.js +10 -0
- package/helpers/renderRangeError.d.ts +1 -0
- package/helpers/renderRangeError.js +20 -0
- package/helpers/sentry/assertEnvVariable.d.ts +1 -0
- package/helpers/sentry/assertEnvVariable.js +7 -0
- package/helpers/sentry/sentryConfig.d.ts +2 -0
- package/helpers/sentry/sentryConfig.js +18 -0
- package/helpers/serializeErrors.d.ts +2 -0
- package/helpers/serializeErrors.js +13 -0
- package/hooks/index.d.ts +26 -0
- package/hooks/index.js +26 -0
- package/hooks/useAllowedBusinessEntities.d.ts +4 -0
- package/hooks/useAllowedBusinessEntities.js +9 -0
- package/hooks/useBusinessEntitiesByType.d.ts +8 -0
- package/hooks/useBusinessEntitiesByType.js +17 -0
- package/hooks/useChangePassword.d.ts +14 -0
- package/hooks/useChangePassword.js +48 -0
- package/hooks/useClassification.d.ts +9 -0
- package/hooks/useClassification.js +16 -0
- package/hooks/useDraggable.d.ts +5 -0
- package/hooks/useDraggable.js +11 -0
- package/hooks/useEllipsis.d.ts +10 -0
- package/hooks/useEllipsis.js +79 -0
- package/hooks/useFavicon.d.ts +1 -0
- package/hooks/useFavicon.js +13 -0
- package/hooks/useFormTable.d.ts +24 -0
- package/hooks/useFormTable.js +105 -0
- package/hooks/useFormTableControls.d.ts +31 -0
- package/hooks/useFormTableControls.js +34 -0
- package/hooks/useInertBackground.d.ts +20 -0
- package/hooks/useInertBackground.js +57 -0
- package/hooks/useIsMounted.d.ts +2 -0
- package/hooks/useIsMounted.js +11 -0
- package/hooks/useLanguage.d.ts +1 -0
- package/hooks/useLanguage.js +2 -0
- package/hooks/useLoaded.d.ts +1 -0
- package/hooks/useLoaded.js +19 -0
- package/hooks/useLocale.d.ts +1 -0
- package/hooks/useLocale.js +7 -0
- package/hooks/useModal.d.ts +307 -0
- package/hooks/useModal.js +12 -0
- package/hooks/useOptions.d.ts +13 -0
- package/hooks/useOptions.js +24 -0
- package/hooks/usePrevious.d.ts +1 -0
- package/hooks/usePrevious.js +12 -0
- package/hooks/usePrompt.d.ts +8 -0
- package/hooks/usePrompt.js +17 -0
- package/hooks/useRowActive.d.ts +6 -0
- package/hooks/useRowActive.js +104 -0
- package/hooks/useRowEditActions.d.ts +5 -0
- package/hooks/useRowEditActions.js +12 -0
- package/hooks/useRowExpandToggle.d.ts +5 -0
- package/hooks/useRowExpandToggle.js +13 -0
- package/hooks/useRowHidden.d.ts +4 -0
- package/hooks/useRowHidden.js +6 -0
- package/hooks/useRowSelectCheckbox.d.ts +27 -0
- package/hooks/useRowSelectCheckbox.js +48 -0
- package/hooks/useTable.d.ts +4 -0
- package/hooks/useTable.js +38 -0
- package/hooks/useTableRowHighlight.d.ts +4 -0
- package/hooks/useTableRowHighlight.js +16 -0
- package/hooks/useTranslation.d.ts +3 -0
- package/hooks/useTranslation.js +3 -0
- package/hooks/useWeekdayOptions.d.ts +40 -0
- package/hooks/useWeekdayOptions.js +66 -0
- package/i18n/index.d.ts +13 -0
- package/i18n/index.js +82 -0
- package/i18n/resources/de.json +115 -0
- package/i18n/resources/el.json +116 -0
- package/i18n/resources/en-AE.json +115 -0
- package/i18n/resources/en.json +118 -0
- package/i18n/resources/es.json +115 -0
- package/i18n/resources/fr.json +115 -0
- package/i18n/resources/index.d.ts +1295 -0
- package/i18n/resources/index.js +24 -0
- package/i18n/resources/it.json +115 -0
- package/i18n/resources/lt.json +115 -0
- package/i18n/resources/pt.json +115 -0
- package/i18n/resources/sk.json +115 -0
- package/i18n/resources/sv.json +116 -0
- package/i18n/trans/alert.d.ts +8 -0
- package/i18n/trans/alert.js +10 -0
- package/i18n/trans/button.d.ts +24 -0
- package/i18n/trans/button.js +26 -0
- package/i18n/trans/error.d.ts +10 -0
- package/i18n/trans/error.js +12 -0
- package/i18n/trans/field.d.ts +19 -0
- package/i18n/trans/field.js +21 -0
- package/i18n/trans/index.d.ts +13 -0
- package/i18n/trans/index.js +20 -0
- package/i18n/trans/label.d.ts +18 -0
- package/i18n/trans/label.js +20 -0
- package/i18n/trans/option.d.ts +6 -0
- package/i18n/trans/option.js +8 -0
- package/i18n/trans/qty.d.ts +5 -0
- package/i18n/trans/qty.js +7 -0
- package/i18n/trans/table.d.ts +8 -0
- package/i18n/trans/table.js +10 -0
- package/i18n/trans/title.d.ts +6 -0
- package/i18n/trans/title.js +8 -0
- package/i18n/trans/tooltip.d.ts +8 -0
- package/i18n/trans/tooltip.js +10 -0
- package/icons/1-class.svg +4 -0
- package/icons/2-class-calm.svg +5 -0
- package/icons/2-class-crossed.svg +5 -0
- package/icons/2-class.svg +4 -0
- package/icons/3-class.svg +4 -0
- package/icons/4-class.svg +4 -0
- package/icons/ac-crossed.svg +6 -0
- package/icons/ac.svg +9 -0
- package/icons/accessibility.svg +5 -0
- package/icons/add-journey-segment.svg +9 -0
- package/icons/add-person.svg +6 -0
- package/icons/add.svg +4 -0
- package/icons/air-condition.svg +11 -0
- package/icons/airport.svg +4 -0
- package/icons/alert-circle.svg +5 -0
- package/icons/arrow-down.svg +4 -0
- package/icons/arrow-left-circle.svg +5 -0
- package/icons/arrow-left.svg +4 -0
- package/icons/arrow-right.svg +4 -0
- package/icons/arrow-up.svg +4 -0
- package/icons/baby-care.svg +7 -0
- package/icons/bar.svg +6 -0
- package/icons/bed.svg +3 -0
- package/icons/bicycle-crossed.svg +6 -0
- package/icons/bicycle.svg +8 -0
- package/icons/bin.svg +6 -0
- package/icons/break.svg +5 -0
- package/icons/breakfast-1-class.svg +5 -0
- package/icons/breakfast-2-class.svg +5 -0
- package/icons/breakfast.svg +3 -0
- package/icons/bus.svg +7 -0
- package/icons/business-area.svg +6 -0
- package/icons/by-aisle.svg +8 -0
- package/icons/by-window.svg +6 -0
- package/icons/cafe-1-class.svg +5 -0
- package/icons/calendar.svg +6 -0
- package/icons/cancel.svg +5 -0
- package/icons/cargo.svg +4 -0
- package/icons/carriage-bot.svg +6 -0
- package/icons/carriage-mid.svg +4 -0
- package/icons/carriage-top.svg +12 -0
- package/icons/carriage.svg +3 -0
- package/icons/cart.svg +3 -0
- package/icons/cd.svg +4 -0
- package/icons/check-circle.svg +4 -0
- package/icons/check.svg +3 -0
- package/icons/checkbox-checked.svg +4 -0
- package/icons/checkbox-indeterminate.svg +5 -0
- package/icons/checkbox-mark.svg +3 -0
- package/icons/checkbox.svg +3 -0
- package/icons/chevron-down.svg +3 -0
- package/icons/chevron-left.svg +3 -0
- package/icons/chevron-right.svg +3 -0
- package/icons/chevron-up.svg +3 -0
- package/icons/circle.svg +3 -0
- package/icons/clock.svg +5 -0
- package/icons/clone.svg +4 -0
- package/icons/close-bold.svg +4 -0
- package/icons/close.svg +4 -0
- package/icons/coffee-machine-crossed.svg +6 -0
- package/icons/coffee-machine.svg +7 -0
- package/icons/coin.svg +4 -0
- package/icons/comment.svg +3 -0
- package/icons/compartment.svg +6 -0
- package/icons/couchette.svg +6 -0
- package/icons/cube.svg +1 -0
- package/icons/currency.svg +4 -0
- package/icons/deactivate.svg +4 -0
- package/icons/delete.svg +4 -0
- package/icons/dining.svg +7 -0
- package/icons/direction-bottom.svg +4 -0
- package/icons/direction-forward-v.svg +4 -0
- package/icons/direction-forward.svg +4 -0
- package/icons/direction-left.svg +4 -0
- package/icons/direction-reverse-v.svg +4 -0
- package/icons/direction-reverse.svg +4 -0
- package/icons/direction-right.svg +4 -0
- package/icons/direction-top.svg +4 -0
- package/icons/dots.svg +5 -0
- package/icons/download.svg +5 -0
- package/icons/drag-n-drop.svg +3 -0
- package/icons/draggable.svg +5 -0
- package/icons/duplicate.svg +4 -0
- package/icons/dvd.svg +5 -0
- package/icons/edit.svg +3 -0
- package/icons/empty-search.svg +9 -0
- package/icons/empty-state.svg +13 -0
- package/icons/empty.svg +9 -0
- package/icons/empty_search_purple.svg +6 -0
- package/icons/error-circle.svg +4 -0
- package/icons/eu-law.svg +5 -0
- package/icons/external_link.svg +5 -0
- package/icons/family-area.svg +7 -0
- package/icons/file-settings.svg +3 -0
- package/icons/file.svg +11 -0
- package/icons/filter.svg +3 -0
- package/icons/flip.svg +11 -0
- package/icons/food-1-class.svg +5 -0
- package/icons/food-plus.svg +5 -0
- package/icons/food.svg +7 -0
- package/icons/grid-cell.svg +1 -0
- package/icons/grid.svg +6 -0
- package/icons/headphones.svg +5 -0
- package/icons/helping-hand-crossed.svg +12 -0
- package/icons/helping-hand.svg +3 -0
- package/icons/hide.svg +4 -0
- package/icons/home.svg +4 -0
- package/icons/index.json +228 -0
- package/icons/info-circle.svg +5 -0
- package/icons/insurance.svg +6 -0
- package/icons/journey-changeover.svg +5 -0
- package/icons/journey-light.svg +5 -0
- package/icons/journey.svg +5 -0
- package/icons/key.svg +4 -0
- package/icons/language.svg +3 -0
- package/icons/link.svg +4 -0
- package/icons/list.svg +8 -0
- package/icons/locker.svg +8 -0
- package/icons/logout.svg +5 -0
- package/icons/luggage.svg +9 -0
- package/icons/mail.svg +4 -0
- package/icons/meeting-lounge.svg +10 -0
- package/icons/metro.svg +3 -0
- package/icons/middle-seat.svg +7 -0
- package/icons/minus.svg +3 -0
- package/icons/minus24.svg +3 -0
- package/icons/mobile-crossed.svg +7 -0
- package/icons/mobile.svg +6 -0
- package/icons/movingo.svg +3 -0
- package/icons/multimedia.svg +9 -0
- package/icons/near-bicycle.svg +5 -0
- package/icons/near-pet.svg +5 -0
- package/icons/near-wheelchair.svg +8 -0
- package/icons/night-train.svg +4 -0
- package/icons/nonstop.svg +3 -0
- package/icons/occupancy-seat-hover.svg +11 -0
- package/icons/occupancy-seat-selected.svg +11 -0
- package/icons/occupancy-seat.svg +4 -0
- package/icons/oneway.svg +4 -0
- package/icons/pet-crossed.svg +5 -0
- package/icons/pet.svg +7 -0
- package/icons/pic.svg +5 -0
- package/icons/playground.svg +7 -0
- package/icons/plus.svg +4 -0
- package/icons/plus24.svg +4 -0
- package/icons/popup-controls.svg +15 -0
- package/icons/power-socket.svg +6 -0
- package/icons/preview.svg +3 -0
- package/icons/print.svg +5 -0
- package/icons/priority-seat-elderly.svg +6 -0
- package/icons/priority-seat-pregnant.svg +5 -0
- package/icons/profile.svg +4 -0
- package/icons/question.svg +5 -0
- package/icons/radio-filled.svg +4 -0
- package/icons/radio.svg +3 -0
- package/icons/reclining-seat.svg +9 -0
- package/icons/refresh.svg +6 -0
- package/icons/reload.svg +4 -0
- package/icons/remove-circle.svg +3 -0
- package/icons/replace.svg +6 -0
- package/icons/reservation-crossed.svg +4 -0
- package/icons/reservation-mandatory.svg +4 -0
- package/icons/reservation-optional.svg +5 -0
- package/icons/resplus-horizontal.svg +1 -0
- package/icons/resplus.svg +3 -0
- package/icons/restaurant.svg +3 -0
- package/icons/roundtrip.svg +6 -0
- package/icons/save.svg +5 -0
- package/icons/search.svg +4 -0
- package/icons/seat-compartment.svg +8 -0
- package/icons/seat-selected.svg +3 -0
- package/icons/seat.svg +5 -0
- package/icons/sent.svg +34 -0
- package/icons/service-dog.svg +4 -0
- package/icons/settings.svg +4 -0
- package/icons/shift.svg +3 -0
- package/icons/ship.svg +3 -0
- package/icons/show.svg +4 -0
- package/icons/shower.svg +9 -0
- package/icons/silence.svg +6 -0
- package/icons/sink.svg +5 -0
- package/icons/skis.svg +8 -0
- package/icons/sleeper-car-bedding.svg +6 -0
- package/icons/sleeper-car.svg +5 -0
- package/icons/smoking-crossed.svg +6 -0
- package/icons/sort.svg +6 -0
- package/icons/stairs-down.svg +5 -0
- package/icons/stairs-up.svg +5 -0
- package/icons/star-filled.svg +3 -0
- package/icons/star.svg +3 -0
- package/icons/stroller.svg +6 -0
- package/icons/sw-law.svg +5 -0
- package/icons/switch.svg +3 -0
- package/icons/table.svg +6 -0
- package/icons/tag.svg +4 -0
- package/icons/taxi.svg +3 -0
- package/icons/tick.svg +3 -0
- package/icons/ticket-cancel.svg +8 -0
- package/icons/ticket-change.svg +3 -0
- package/icons/ticket-manage.svg +7 -0
- package/icons/ticket-refund.svg +8 -0
- package/icons/ticket-travel-pass.svg +4 -0
- package/icons/ticket.svg +6 -0
- package/icons/tickets.svg +4 -0
- package/icons/train.svg +3 -0
- package/icons/transfer.svg +3 -0
- package/icons/trash.svg +6 -0
- package/icons/triange.svg +17 -0
- package/icons/tv.svg +5 -0
- package/icons/unaccompanied-minor.svg +8 -0
- package/icons/upload.svg +5 -0
- package/icons/usb.svg +9 -0
- package/icons/visibility-off.svg +4 -0
- package/icons/visibility-on.svg +4 -0
- package/icons/voucher.svg +5 -0
- package/icons/wardrobe.svg +4 -0
- package/icons/warning.svg +3 -0
- package/icons/water.svg +5 -0
- package/icons/wc.svg +4 -0
- package/icons/wheelchair-lift-reservation.svg +8 -0
- package/icons/wheelchair-lift.svg +6 -0
- package/icons/wheelchair-ramp.svg +8 -0
- package/icons/wheelchair-space-reservation.svg +13 -0
- package/icons/wheelchair-space.svg +4 -0
- package/icons/wheelchair.svg +5 -0
- package/icons/wifi-crossed.svg +9 -0
- package/icons/wifi.svg +6 -0
- package/index.css +327 -0
- package/index.d.ts +31 -0
- package/index.js +32 -0
- package/mui/Accordion.d.ts +17 -0
- package/mui/Accordion.js +46 -0
- package/mui/Button/index.d.ts +16 -0
- package/mui/Button/index.js +35 -0
- package/mui/Card/CardHeader.d.ts +7 -0
- package/mui/Card/CardHeader.js +43 -0
- package/mui/Card/index.d.ts +4 -0
- package/mui/Card/index.js +4 -0
- package/mui/Checkbox/CheckboxGroup.d.ts +26 -0
- package/mui/Checkbox/CheckboxGroup.js +81 -0
- package/mui/Checkbox/index.d.ts +18 -0
- package/mui/Checkbox/index.js +40 -0
- package/mui/Chip/ChipSecondarySmall.d.ts +10 -0
- package/mui/Chip/ChipSecondarySmall.js +40 -0
- package/mui/CircularProgress/index.d.ts +3 -0
- package/mui/CircularProgress/index.js +36 -0
- package/mui/Collapsible/index.d.ts +9 -0
- package/mui/Collapsible/index.js +66 -0
- package/mui/Counter/index.d.ts +9 -0
- package/mui/Counter/index.js +37 -0
- package/mui/DatePicker/DatePicker.scss +276 -0
- package/mui/DatePicker/DatePickerContext.d.ts +8 -0
- package/mui/DatePicker/DatePickerContext.js +2 -0
- package/mui/DatePicker/DatePickerHeader.d.ts +3 -0
- package/mui/DatePicker/DatePickerHeader.js +63 -0
- package/mui/DatePicker/DatePickerHeaderSelect.d.ts +10 -0
- package/mui/DatePicker/DatePickerHeaderSelect.js +72 -0
- package/mui/DatePicker/DatePickerInput.d.ts +6 -0
- package/mui/DatePicker/DatePickerInput.js +28 -0
- package/mui/DatePicker/TimeInput.d.ts +10 -0
- package/mui/DatePicker/TimeInput.js +63 -0
- package/mui/DatePicker/index.d.ts +52 -0
- package/mui/DatePicker/index.js +187 -0
- package/mui/Dropdown/index.d.ts +22 -0
- package/mui/Dropdown/index.js +90 -0
- package/mui/EditableLabel/index.d.ts +7 -0
- package/mui/EditableLabel/index.js +81 -0
- package/mui/ExternalLink/index.d.ts +8 -0
- package/mui/ExternalLink/index.js +11 -0
- package/mui/FileInput/index.d.ts +27 -0
- package/mui/FileInput/index.js +66 -0
- package/mui/FormControl/index.d.ts +23 -0
- package/mui/FormControl/index.js +36 -0
- package/mui/FormField/index.d.ts +8 -0
- package/mui/FormField/index.js +12 -0
- package/mui/Icon/index.d.ts +21 -0
- package/mui/Icon/index.js +47 -0
- package/mui/Input/index.d.ts +28 -0
- package/mui/Input/index.js +102 -0
- package/mui/Loader/index.d.ts +9 -0
- package/mui/Loader/index.js +47 -0
- package/mui/Modal/index.d.ts +16 -0
- package/mui/Modal/index.js +64 -0
- package/mui/Pagination/index.d.ts +6 -0
- package/mui/Pagination/index.js +23 -0
- package/mui/Paper/index.d.ts +4 -0
- package/mui/Paper/index.js +3 -0
- package/mui/Popper/index.d.ts +13 -0
- package/mui/Popper/index.js +139 -0
- package/mui/RadioGroup/index.d.ts +26 -0
- package/mui/RadioGroup/index.js +41 -0
- package/mui/ReadOnlyField/index.d.ts +8 -0
- package/mui/ReadOnlyField/index.js +35 -0
- package/mui/Select/index.d.ts +47 -0
- package/mui/Select/index.js +164 -0
- package/mui/Stepper/StepIconComponent.d.ts +6 -0
- package/mui/Stepper/StepIconComponent.js +93 -0
- package/mui/Stepper/index.d.ts +6 -0
- package/mui/Stepper/index.js +13 -0
- package/mui/Switch/index.d.ts +3 -0
- package/mui/Switch/index.js +2 -0
- package/mui/Tab/index.d.ts +60 -0
- package/mui/Tab/index.js +12 -0
- package/mui/Tabs/index.d.ts +22 -0
- package/mui/Tabs/index.js +70 -0
- package/mui/TimeDurationLabel/index.d.ts +7 -0
- package/mui/TimeDurationLabel/index.js +13 -0
- package/mui/ToggleButton/index.d.ts +4 -0
- package/mui/ToggleButton/index.js +57 -0
- package/mui/ToggleButtonGroup/index.d.ts +25 -0
- package/mui/ToggleButtonGroup/index.js +61 -0
- package/mui/ToggleList/index.d.ts +11 -0
- package/mui/ToggleList/index.js +54 -0
- package/mui/Tooltip/index.d.ts +11 -0
- package/mui/Tooltip/index.js +36 -0
- package/mui/index.d.ts +36 -0
- package/mui/index.js +36 -0
- package/mui/provider.d.ts +9 -0
- package/mui/provider.js +22 -0
- package/mui/theme.d.ts +17 -0
- package/mui/theme.js +1228 -0
- package/package.json +197 -4
- package/services/api.d.ts +28 -0
- package/services/api.js +141 -0
- package/services/index.d.ts +2 -0
- package/services/index.js +2 -0
- package/services/openapi.d.ts +6 -0
- package/services/openapi.js +112 -0
- package/store/index.d.ts +6 -0
- package/store/index.js +1 -0
- package/store/useClassificationOptions.d.ts +3 -0
- package/store/useClassificationOptions.js +2 -0
- package/types.d.ts +2423 -0
- package/utils/array.d.ts +2 -0
- package/utils/array.js +21 -0
- package/utils/auth.d.ts +2 -0
- package/utils/auth.js +31 -0
- package/utils/color.d.ts +29 -0
- package/utils/color.js +132 -0
- package/utils/date.d.ts +40 -0
- package/utils/date.js +51 -0
- package/utils/filter.d.ts +3 -0
- package/utils/filter.js +11 -0
- package/utils/getScrollbarSize.d.ts +1 -0
- package/utils/getScrollbarSize.js +8 -0
- package/utils/index.d.ts +12 -0
- package/utils/index.js +12 -0
- package/utils/input.d.ts +2 -0
- package/utils/input.js +2 -0
- package/utils/knowledge-owl-script.d.ts +64 -0
- package/utils/knowledge-owl-script.js +226 -0
- package/utils/locales.d.ts +3 -0
- package/utils/locales.js +24 -0
- package/utils/noop.d.ts +1 -0
- package/utils/noop.js +1 -0
- package/utils/percentage.d.ts +6 -0
- package/utils/percentage.js +43 -0
- package/utils/redirect.d.ts +1 -0
- package/utils/redirect.js +6 -0
- package/utils/sort.d.ts +21 -0
- package/utils/sort.js +32 -0
- package/utils/storage.d.ts +2 -0
- package/utils/storage.js +2 -0
- package/utils/timeDuration.d.ts +26 -0
- package/utils/timeDuration.js +78 -0
- package/utils/wallClock.d.ts +17 -0
- package/utils/wallClock.js +178 -0
- package/wrappers/ApiInitializer.d.ts +9 -0
- package/wrappers/ApiInitializer.js +21 -0
- package/wrappers/AuthWrapper.d.ts +6 -0
- package/wrappers/AuthWrapper.js +38 -0
- package/wrappers/AxiosErrorsInterceptorWrapper.d.ts +2 -0
- package/wrappers/AxiosErrorsInterceptorWrapper.js +30 -0
- package/README.md +0 -3
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const addLazyState = (dest, state, keys) => {
|
|
2
|
+
keys.forEach((key) => {
|
|
3
|
+
Object.defineProperty(dest, key, {
|
|
4
|
+
get: () => state[key],
|
|
5
|
+
enumerable: true,
|
|
6
|
+
});
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
export const addLazyFormState = (dest, state) => addLazyState(dest, state, [
|
|
10
|
+
'active',
|
|
11
|
+
'dirty',
|
|
12
|
+
'dirtyFields',
|
|
13
|
+
'dirtySinceLastSubmit',
|
|
14
|
+
'dirtyFieldsSinceLastSubmit',
|
|
15
|
+
'error',
|
|
16
|
+
'errors',
|
|
17
|
+
'hasSubmitErrors',
|
|
18
|
+
'hasValidationErrors',
|
|
19
|
+
'initialValues',
|
|
20
|
+
'invalid',
|
|
21
|
+
'modified',
|
|
22
|
+
'modifiedSinceLastSubmit',
|
|
23
|
+
'pristine',
|
|
24
|
+
'submitError',
|
|
25
|
+
'submitErrors',
|
|
26
|
+
'submitFailed',
|
|
27
|
+
'submitSucceeded',
|
|
28
|
+
'submitting',
|
|
29
|
+
'touched',
|
|
30
|
+
'valid',
|
|
31
|
+
'validating',
|
|
32
|
+
'values',
|
|
33
|
+
'visited',
|
|
34
|
+
]);
|
|
35
|
+
export const addLazyFieldMetaState = (dest, state) => addLazyState(dest, state, [
|
|
36
|
+
'active',
|
|
37
|
+
'data',
|
|
38
|
+
'dirty',
|
|
39
|
+
'dirtySinceLastSubmit',
|
|
40
|
+
'error',
|
|
41
|
+
'initial',
|
|
42
|
+
'invalid',
|
|
43
|
+
'length',
|
|
44
|
+
'modified',
|
|
45
|
+
'modifiedSinceLastSubmit',
|
|
46
|
+
'pristine',
|
|
47
|
+
'submitError',
|
|
48
|
+
'submitFailed',
|
|
49
|
+
'submitSucceeded',
|
|
50
|
+
'submitting',
|
|
51
|
+
'touched',
|
|
52
|
+
'valid',
|
|
53
|
+
'validating',
|
|
54
|
+
'visited',
|
|
55
|
+
]);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const getSelectedValues = (options) => {
|
|
2
|
+
const result = [];
|
|
3
|
+
if (options) {
|
|
4
|
+
for (let index = 0; index < options.length; index++) {
|
|
5
|
+
const option = options[index];
|
|
6
|
+
if (option.selected) {
|
|
7
|
+
result.push(option.value);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return result;
|
|
12
|
+
};
|
|
13
|
+
const getValue = (event, currentValue, valueProp, isReactNative) => {
|
|
14
|
+
if (!isReactNative &&
|
|
15
|
+
event.nativeEvent &&
|
|
16
|
+
event.nativeEvent.text !== undefined) {
|
|
17
|
+
return event.nativeEvent.text;
|
|
18
|
+
}
|
|
19
|
+
if (isReactNative && event.nativeEvent) {
|
|
20
|
+
return event.nativeEvent.text;
|
|
21
|
+
}
|
|
22
|
+
const detypedEvent = event;
|
|
23
|
+
const { target: { type, value, checked }, } = detypedEvent;
|
|
24
|
+
switch (type) {
|
|
25
|
+
case 'checkbox':
|
|
26
|
+
if (valueProp !== undefined) {
|
|
27
|
+
// we are maintaining an array, not just a boolean
|
|
28
|
+
if (checked) {
|
|
29
|
+
// add value to current array value
|
|
30
|
+
return Array.isArray(currentValue)
|
|
31
|
+
? currentValue.concat(valueProp)
|
|
32
|
+
: [valueProp];
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
// remove value from current array value
|
|
36
|
+
if (!Array.isArray(currentValue)) {
|
|
37
|
+
return currentValue;
|
|
38
|
+
}
|
|
39
|
+
const index = currentValue.indexOf(valueProp);
|
|
40
|
+
if (index < 0) {
|
|
41
|
+
return currentValue;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return currentValue
|
|
45
|
+
.slice(0, index)
|
|
46
|
+
.concat(currentValue.slice(index + 1));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
// it's just a boolean
|
|
52
|
+
return !!checked;
|
|
53
|
+
}
|
|
54
|
+
case 'select-multiple':
|
|
55
|
+
return getSelectedValues(event.target.options);
|
|
56
|
+
default:
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
export default getValue;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A simple hook to create a constant value that lives for
|
|
3
|
+
* the lifetime of the component.
|
|
4
|
+
*
|
|
5
|
+
* Plagiarized from https://github.com/Andarist/use-constant
|
|
6
|
+
*
|
|
7
|
+
* Do NOT reuse this code unless you know what you're doing.
|
|
8
|
+
* Use Andarist's hook; it's more fault tolerant to things like
|
|
9
|
+
* falsy values.
|
|
10
|
+
*
|
|
11
|
+
* @param {Function} init - A function to generate the value
|
|
12
|
+
*/
|
|
13
|
+
export default function useConstant<T>(init: () => T): T;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useRef } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A simple hook to create a constant value that lives for
|
|
4
|
+
* the lifetime of the component.
|
|
5
|
+
*
|
|
6
|
+
* Plagiarized from https://github.com/Andarist/use-constant
|
|
7
|
+
*
|
|
8
|
+
* Do NOT reuse this code unless you know what you're doing.
|
|
9
|
+
* Use Andarist's hook; it's more fault tolerant to things like
|
|
10
|
+
* falsy values.
|
|
11
|
+
*
|
|
12
|
+
* @param {Function} init - A function to generate the value
|
|
13
|
+
*/
|
|
14
|
+
export default function useConstant(init) {
|
|
15
|
+
const ref = useRef();
|
|
16
|
+
if (!ref.current) {
|
|
17
|
+
ref.current = init();
|
|
18
|
+
}
|
|
19
|
+
return ref.current;
|
|
20
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a callback, even with closures, that will be
|
|
3
|
+
* instance === for the lifetime of the component, always
|
|
4
|
+
* calling the most recent version of the function and its
|
|
5
|
+
* closures.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useConstantCallback<T extends Function>(callback: T): (...args: any[]) => any;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a callback, even with closures, that will be
|
|
4
|
+
* instance === for the lifetime of the component, always
|
|
5
|
+
* calling the most recent version of the function and its
|
|
6
|
+
* closures.
|
|
7
|
+
*/
|
|
8
|
+
export function useConstantCallback(callback) {
|
|
9
|
+
const ref = React.useRef(callback);
|
|
10
|
+
React.useEffect(() => {
|
|
11
|
+
ref.current = callback;
|
|
12
|
+
});
|
|
13
|
+
return React.useCallback((...args) => ref.current.apply(null, args), []);
|
|
14
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { FormApi } from 'final-form';
|
|
2
|
+
import { FieldRenderProps, RenderableProps, UseFieldConfig } from 'react-final-form';
|
|
3
|
+
export declare const useField: <TName extends string, TValue, FormValues extends { [P in TName]?: TValue; } = {}>(name: TName, form: FormApi<FormValues, Partial<FormValues>>, config: UseFieldConfig<TValue, any> & RenderableProps<TValue>) => FieldRenderProps<TValue, HTMLElement, TValue>;
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { fieldSubscriptionItems } from 'final-form';
|
|
3
|
+
import useLatest from "./useLatest";
|
|
4
|
+
import { addLazyFieldMetaState } from "./addLazyFieldMetaState";
|
|
5
|
+
import { useConstantCallback } from "./useConstantCallback";
|
|
6
|
+
import getValue from "./getValue";
|
|
7
|
+
const fieldSubscriptions = fieldSubscriptionItems;
|
|
8
|
+
const all = fieldSubscriptions.reduce((result, key) => {
|
|
9
|
+
result[key] = true;
|
|
10
|
+
return result;
|
|
11
|
+
}, {});
|
|
12
|
+
const defaultFormat = (value) => value === undefined ? '' : value;
|
|
13
|
+
const defaultParse = (value) => value === '' ? undefined : value;
|
|
14
|
+
const defaultIsEqual = (a, b) => a === b;
|
|
15
|
+
export const useField = (name, form, config) => {
|
|
16
|
+
const configRef = useLatest(config);
|
|
17
|
+
const { afterSubmit, allowNull, component, data, defaultValue, format = defaultFormat, formatOnBlur, initialValue, multiple, parse = defaultParse, subscription = all, type, validateFields, value: _value, } = config;
|
|
18
|
+
const register = (callback, silent) =>
|
|
19
|
+
// avoid using `state` const in any closures created inside `register`
|
|
20
|
+
// because they would refer `state` from current execution context
|
|
21
|
+
// whereas actual `state` would defined in the subsequent `useField` hook
|
|
22
|
+
// execution
|
|
23
|
+
// (that would be caused by `setState` call performed in `register` callback)
|
|
24
|
+
form.registerField(name, callback, subscription, {
|
|
25
|
+
afterSubmit,
|
|
26
|
+
beforeSubmit: () => {
|
|
27
|
+
const { beforeSubmit, formatOnBlur, format = defaultFormat, } = configRef.current;
|
|
28
|
+
if (formatOnBlur) {
|
|
29
|
+
const { value } = form.getFieldState(name);
|
|
30
|
+
const formatted = format(value, name);
|
|
31
|
+
if (formatted !== value) {
|
|
32
|
+
form.change(name, formatted);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (beforeSubmit)
|
|
36
|
+
return beforeSubmit();
|
|
37
|
+
},
|
|
38
|
+
data,
|
|
39
|
+
defaultValue,
|
|
40
|
+
getValidator: () => configRef.current.validate,
|
|
41
|
+
initialValue,
|
|
42
|
+
isEqual: (a, b) => (configRef.current.isEqual || defaultIsEqual)(a, b),
|
|
43
|
+
silent,
|
|
44
|
+
validateFields,
|
|
45
|
+
});
|
|
46
|
+
const firstRender = React.useRef(true);
|
|
47
|
+
// synchronously register and unregister to query field state for our subscription on first render
|
|
48
|
+
const [state, setState] = React.useState(() => {
|
|
49
|
+
let initialState = {};
|
|
50
|
+
// temporarily disable destroyOnUnregister
|
|
51
|
+
const destroyOnUnregister = form.destroyOnUnregister;
|
|
52
|
+
form.destroyOnUnregister = false;
|
|
53
|
+
register((state) => {
|
|
54
|
+
initialState = state;
|
|
55
|
+
}, true)();
|
|
56
|
+
// return destroyOnUnregister to its original value
|
|
57
|
+
form.destroyOnUnregister = destroyOnUnregister;
|
|
58
|
+
return initialState;
|
|
59
|
+
});
|
|
60
|
+
React.useEffect(() => register((state) => {
|
|
61
|
+
if (firstRender.current) {
|
|
62
|
+
firstRender.current = false;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
setState(state);
|
|
66
|
+
}
|
|
67
|
+
}, false),
|
|
68
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
|
+
[
|
|
70
|
+
name,
|
|
71
|
+
data,
|
|
72
|
+
defaultValue,
|
|
73
|
+
// If we want to allow inline fat-arrow field-level validation functions, we
|
|
74
|
+
// cannot reregister field every time validate function !==.
|
|
75
|
+
// validate,
|
|
76
|
+
initialValue,
|
|
77
|
+
// The validateFields array is often passed as validateFields={[]}, creating
|
|
78
|
+
// a !== new array every time. If it needs to be changed, a rerender/reregister
|
|
79
|
+
// can be forced by changing the key prop
|
|
80
|
+
// validateFields
|
|
81
|
+
]);
|
|
82
|
+
const meta = {};
|
|
83
|
+
addLazyFieldMetaState(meta, state);
|
|
84
|
+
const input = {
|
|
85
|
+
name,
|
|
86
|
+
// @ts-ignore
|
|
87
|
+
get value() {
|
|
88
|
+
let value = state.value;
|
|
89
|
+
if (formatOnBlur) {
|
|
90
|
+
if (component === 'input') {
|
|
91
|
+
// @ts-ignore
|
|
92
|
+
value = defaultFormat(value, name);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
value = format(value, name);
|
|
97
|
+
}
|
|
98
|
+
if (value === null && !allowNull) {
|
|
99
|
+
// @ts-ignore
|
|
100
|
+
value = '';
|
|
101
|
+
}
|
|
102
|
+
if (type === 'checkbox' || type === 'radio') {
|
|
103
|
+
return _value;
|
|
104
|
+
}
|
|
105
|
+
else if (component === 'select' && multiple) {
|
|
106
|
+
return value || [];
|
|
107
|
+
}
|
|
108
|
+
return value;
|
|
109
|
+
},
|
|
110
|
+
get checked() {
|
|
111
|
+
let value = state.value;
|
|
112
|
+
if (type === 'checkbox') {
|
|
113
|
+
value = format(value, name);
|
|
114
|
+
if (_value === undefined) {
|
|
115
|
+
return !!value;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
return !!(Array.isArray(value) && ~value.indexOf(_value));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
else if (type === 'radio') {
|
|
122
|
+
return format(value, name) === _value;
|
|
123
|
+
}
|
|
124
|
+
return undefined;
|
|
125
|
+
},
|
|
126
|
+
onBlur: useConstantCallback(() => {
|
|
127
|
+
state.blur();
|
|
128
|
+
if (formatOnBlur) {
|
|
129
|
+
/**
|
|
130
|
+
* Here we must fetch the value directly from Final Form because we cannot
|
|
131
|
+
* trust that our `state` closure has the most recent value. This is a problem
|
|
132
|
+
* if-and-only-if the library consumer has called `onChange()` immediately
|
|
133
|
+
* before calling `onBlur()`, but before the field has had a chance to receive
|
|
134
|
+
* the value update from Final Form.
|
|
135
|
+
*/
|
|
136
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
137
|
+
const fieldState = form.getFieldState(state.name);
|
|
138
|
+
state.change(format(fieldState.value, state.name));
|
|
139
|
+
}
|
|
140
|
+
}),
|
|
141
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
142
|
+
onChange: useConstantCallback((event) => {
|
|
143
|
+
// istanbul ignore next
|
|
144
|
+
if ((process.env.NODE_ENV || import.meta.env.MODE) !== 'production' &&
|
|
145
|
+
event &&
|
|
146
|
+
event.target) {
|
|
147
|
+
const targetType = event.target.type;
|
|
148
|
+
const unknown = ~['checkbox', 'radio', 'select-multiple'].indexOf(targetType) &&
|
|
149
|
+
!type &&
|
|
150
|
+
component !== 'select';
|
|
151
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
152
|
+
const value = targetType === 'select-multiple' ? state.value : _value;
|
|
153
|
+
if (unknown) {
|
|
154
|
+
console.error(`You must pass \`type="${targetType === 'select-multiple' ? 'select' : targetType}"\` prop to your Field(${name}) component.\n` +
|
|
155
|
+
`Without it we don't know how to unpack your \`value\` prop - ${Array.isArray(value) ? `[${value}]` : `"${value}"`}.`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
159
|
+
const value = event && event.target
|
|
160
|
+
? getValue(event, state.value, _value, false)
|
|
161
|
+
: event;
|
|
162
|
+
// @ts-ignore
|
|
163
|
+
state.change(parse(value, name));
|
|
164
|
+
}),
|
|
165
|
+
onFocus: useConstantCallback(state.focus),
|
|
166
|
+
};
|
|
167
|
+
if (multiple) {
|
|
168
|
+
input.multiple = multiple;
|
|
169
|
+
}
|
|
170
|
+
if (type !== undefined) {
|
|
171
|
+
input.type = type;
|
|
172
|
+
}
|
|
173
|
+
const renderProps = { input, meta }; // assign to force Flow check
|
|
174
|
+
return renderProps;
|
|
175
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FormApi } from 'final-form';
|
|
2
|
+
import type { FieldArrayRenderProps, UseFieldArrayConfig } from 'react-final-form-arrays';
|
|
3
|
+
export interface UseFieldArrayProps<FieldValue, FormValues> extends UseFieldArrayConfig<FieldValue> {
|
|
4
|
+
form: FormApi<FormValues>;
|
|
5
|
+
}
|
|
6
|
+
export declare const useFieldArray: <FieldName extends string, FieldValue, FormValues = Record<string, unknown>>(name: FieldName, props: UseFieldArrayProps<FieldValue, FormValues>) => FieldArrayRenderProps<FieldValue, HTMLElement>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
2
|
+
import { useField } from "./useField";
|
|
3
|
+
import { fieldSubscriptionItems, ARRAY_ERROR } from 'final-form';
|
|
4
|
+
import useConstant from "./useConstant";
|
|
5
|
+
const defaultIsEqual = function defaultIsEqual(aArray, bArray) {
|
|
6
|
+
return (aArray === bArray ||
|
|
7
|
+
(Array.isArray(aArray) &&
|
|
8
|
+
Array.isArray(bArray) &&
|
|
9
|
+
aArray.length === bArray.length &&
|
|
10
|
+
!aArray.some(function (a, index) {
|
|
11
|
+
return a !== bArray[index];
|
|
12
|
+
})));
|
|
13
|
+
};
|
|
14
|
+
const all = fieldSubscriptionItems.reduce((result, key) => {
|
|
15
|
+
result[key] = true;
|
|
16
|
+
return result;
|
|
17
|
+
}, {});
|
|
18
|
+
export const useFieldArray = (name, props) => {
|
|
19
|
+
const { form, subscription = all, defaultValue, initialValue: propsInitialValue, isEqual = defaultIsEqual, validate: validateProp, } = props;
|
|
20
|
+
const initialValue = useMemo(() => propsInitialValue ?? [], [propsInitialValue]);
|
|
21
|
+
const formMutators = form.mutators;
|
|
22
|
+
const hasMutators = !!(formMutators && formMutators.push && formMutators.pop);
|
|
23
|
+
if (!hasMutators) {
|
|
24
|
+
throw new Error('Array mutators not found. You need to provide the mutators from final-form-arrays to your form');
|
|
25
|
+
}
|
|
26
|
+
const mutators = useConstant(() =>
|
|
27
|
+
// curry the field name onto all mutator calls
|
|
28
|
+
Object.keys(formMutators).reduce((acc, key) => ({
|
|
29
|
+
...acc,
|
|
30
|
+
[key]: (...args) =>
|
|
31
|
+
// @ts-ignore TS2556: A spread argument must either have a tuple type or be passed to a rest parameter.
|
|
32
|
+
formMutators[key](name, ...args),
|
|
33
|
+
}), {}));
|
|
34
|
+
const validate = useConstant(() => (value, allValues, meta) => {
|
|
35
|
+
if (!validateProp)
|
|
36
|
+
return undefined;
|
|
37
|
+
const error = validateProp(value, allValues, meta);
|
|
38
|
+
if (!error || Array.isArray(error)) {
|
|
39
|
+
return error;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
const arrayError = [];
|
|
43
|
+
// gross, but we have to set a string key on the array
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
|
+
arrayError[ARRAY_ERROR] = error;
|
|
46
|
+
return arrayError;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
const { meta: { length, ...meta }, input, ...fieldState } = useField(name, form, {
|
|
50
|
+
subscription: { ...subscription, length: true },
|
|
51
|
+
defaultValue,
|
|
52
|
+
initialValue,
|
|
53
|
+
isEqual,
|
|
54
|
+
validate,
|
|
55
|
+
});
|
|
56
|
+
const forEach = useCallback((iterator) => {
|
|
57
|
+
// required || for Flow, but results in uncovered line in Jest/Istanbul
|
|
58
|
+
// istanbul ignore next
|
|
59
|
+
const len = length || 0;
|
|
60
|
+
for (let i = 0; i < len; i++) {
|
|
61
|
+
iterator(`${name}[${i}]`, i);
|
|
62
|
+
}
|
|
63
|
+
}, [length, name]);
|
|
64
|
+
const map = useCallback((iterator) => {
|
|
65
|
+
// required || for Flow, but results in uncovered line in Jest/Istanbul
|
|
66
|
+
// istanbul ignore next
|
|
67
|
+
const len = length || 0;
|
|
68
|
+
const results = [];
|
|
69
|
+
for (let i = 0; i < len; i++) {
|
|
70
|
+
results.push(iterator(`${name}[${i}]`, i));
|
|
71
|
+
}
|
|
72
|
+
return results;
|
|
73
|
+
}, [length, name]);
|
|
74
|
+
return useMemo(() => ({
|
|
75
|
+
fields: {
|
|
76
|
+
name,
|
|
77
|
+
forEach,
|
|
78
|
+
length: length || 0,
|
|
79
|
+
map,
|
|
80
|
+
...mutators,
|
|
81
|
+
...fieldState,
|
|
82
|
+
value: input.value,
|
|
83
|
+
},
|
|
84
|
+
meta,
|
|
85
|
+
input,
|
|
86
|
+
}), [fieldState, forEach, input, length, map, meta, mutators, name]);
|
|
87
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const useModalTableSelectedRows: <T extends {
|
|
3
|
+
id: string | number;
|
|
4
|
+
}>({ name, isOpen, }: {
|
|
5
|
+
name: string;
|
|
6
|
+
isOpen: boolean;
|
|
7
|
+
}) => {
|
|
8
|
+
selectedRowIds: Record<string, boolean>;
|
|
9
|
+
stateReducer: (newState: import("react-table").TableState<T>, action: import("react-table").ActionType, previousState: import("react-table").TableState<T>, instance?: import("react-table").TableInstance<T>) => import("react-table").TableState<T>;
|
|
10
|
+
draftSelection: Map<string, T>;
|
|
11
|
+
setDraftSelection: import("react").Dispatch<import("react").SetStateAction<Map<string, T>>>;
|
|
12
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { useFormContext } from "../index";
|
|
3
|
+
import { copy } from "../../helpers/map";
|
|
4
|
+
import _isObject from 'lodash/isObject';
|
|
5
|
+
export const useModalTableSelectedRows = ({ name, isOpen, }) => {
|
|
6
|
+
const form = useFormContext();
|
|
7
|
+
const draftSelectionRef = useRef(new Map());
|
|
8
|
+
const [draftSelection, setDraftSelection] = useState(new Map());
|
|
9
|
+
const selectedRowIds = useMemo(() => Array.from(draftSelection.keys()).reduce((acc, id) => ({ ...acc, [id]: true }), {}), [draftSelection]);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const values = form.getState().values[name];
|
|
12
|
+
const valuesArray = Array.isArray(values)
|
|
13
|
+
? values
|
|
14
|
+
: _isObject(values)
|
|
15
|
+
? Object.values(values)
|
|
16
|
+
: [];
|
|
17
|
+
const currentValuesMap = valuesArray.reduce((acc, item) => {
|
|
18
|
+
if (item && item.id != null) {
|
|
19
|
+
acc.set(String(item.id), item);
|
|
20
|
+
}
|
|
21
|
+
return acc;
|
|
22
|
+
}, new Map());
|
|
23
|
+
const newDraftSelection = isOpen ? currentValuesMap : new Map();
|
|
24
|
+
draftSelectionRef.current = newDraftSelection;
|
|
25
|
+
setDraftSelection(newDraftSelection);
|
|
26
|
+
}, [form, isOpen, name]);
|
|
27
|
+
const stateReducer = useCallback((newState, action, previousState, instance) => {
|
|
28
|
+
if (!instance) {
|
|
29
|
+
return newState;
|
|
30
|
+
}
|
|
31
|
+
const draftCopy = copy(draftSelectionRef.current);
|
|
32
|
+
switch (action.type) {
|
|
33
|
+
case 'toggleRowSelected':
|
|
34
|
+
const selectedRow = instance.flatRows.find(({ id }) => id === action.id);
|
|
35
|
+
if (selectedRow) {
|
|
36
|
+
const rowSelected = action.value;
|
|
37
|
+
if (rowSelected) {
|
|
38
|
+
draftCopy.set(action.id, selectedRow.original);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
draftCopy.delete(action.id);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
draftSelectionRef.current = draftCopy;
|
|
45
|
+
setDraftSelection(draftCopy);
|
|
46
|
+
break;
|
|
47
|
+
case 'toggleAllRowsSelected':
|
|
48
|
+
const allRowsSelected = action.value;
|
|
49
|
+
instance.flatRows.forEach(({ id, original }) => {
|
|
50
|
+
allRowsSelected ? draftCopy.set(id, original) : draftCopy.delete(id);
|
|
51
|
+
});
|
|
52
|
+
draftSelectionRef.current = draftCopy;
|
|
53
|
+
setDraftSelection(draftCopy);
|
|
54
|
+
break;
|
|
55
|
+
default:
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
return newState;
|
|
59
|
+
}, []);
|
|
60
|
+
return {
|
|
61
|
+
selectedRowIds,
|
|
62
|
+
stateReducer,
|
|
63
|
+
draftSelection,
|
|
64
|
+
setDraftSelection,
|
|
65
|
+
};
|
|
66
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FieldPath, FieldPathValue, UnpackNestedValue } from 'react-hook-form';
|
|
2
|
+
import { FieldRenderProps, UseFieldConfig } from 'react-final-form';
|
|
3
|
+
export declare type UseWatchState<T extends object, N extends FieldPath<T> = FieldPath<T>, R extends FieldRenderProps<UnpackNestedValue<FieldPathValue<T, N>>> = FieldRenderProps<UnpackNestedValue<FieldPathValue<T, N>>>> = {
|
|
4
|
+
value: R['input']['value'];
|
|
5
|
+
checked: R['input']['checked'];
|
|
6
|
+
} & R['meta'];
|
|
7
|
+
export declare type UseWatchReturn<T extends object, N extends FieldPath<T> = FieldPath<T>> = Record<N, UseWatchState<T>>;
|
|
8
|
+
interface UseWatchProps<T extends object> extends UseFieldConfig<T> {
|
|
9
|
+
state?: UseWatchReturn<T>;
|
|
10
|
+
}
|
|
11
|
+
export declare const useWatch: <T extends object>(names: Array<string>, config?: UseWatchProps<T>) => UseWatchReturn<T, import("react-hook-form").Path<T>>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useField } from 'react-final-form';
|
|
2
|
+
export const useWatch = (names, config = {}) => {
|
|
3
|
+
const { state = {}, subscription } = config;
|
|
4
|
+
const [name, ...rest] = names;
|
|
5
|
+
const { input: { value, checked }, meta, } = useField(name, { subscription });
|
|
6
|
+
if (names.length === 0)
|
|
7
|
+
return state;
|
|
8
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
9
|
+
return useWatch(rest, {
|
|
10
|
+
state: {
|
|
11
|
+
...state,
|
|
12
|
+
[name]: { ...meta, value, checked },
|
|
13
|
+
},
|
|
14
|
+
subscription,
|
|
15
|
+
});
|
|
16
|
+
};
|
package/form/index.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { PropsWithChildren, ReactElement } from 'react';
|
|
2
|
+
import type { FormApi } from 'final-form';
|
|
3
|
+
import type { FormConfig, FormRenderProps } from 'react-final-form-hooks';
|
|
4
|
+
import { useForm as useFinalForm } from 'react-final-form-hooks';
|
|
5
|
+
import { Field, useForm as useFormContext } from 'react-final-form';
|
|
6
|
+
export { FormConfig, FormRenderProps };
|
|
7
|
+
export { Field };
|
|
8
|
+
import { FieldArray, useFieldArray } from 'react-final-form-arrays';
|
|
9
|
+
export { FieldArray, useFieldArray };
|
|
10
|
+
export * from "./FormField";
|
|
11
|
+
export * from "./CheckboxField";
|
|
12
|
+
export * from "./CheckboxGroupField";
|
|
13
|
+
export * from "./ConditionField";
|
|
14
|
+
export * from "./ContentField";
|
|
15
|
+
export * from "./CounterField";
|
|
16
|
+
export * from "./DateField";
|
|
17
|
+
export * from "./DatesArrayField";
|
|
18
|
+
export * from "./DependSelectField";
|
|
19
|
+
export * from "./EditorField";
|
|
20
|
+
export * from "./RadioGroupField";
|
|
21
|
+
export * from "./ModalFieldArray";
|
|
22
|
+
export * from "./PeriodField";
|
|
23
|
+
export * from "./SelectField";
|
|
24
|
+
export * from "./SwitchField";
|
|
25
|
+
export * from "./TextField";
|
|
26
|
+
export * from "./TimeDurationField";
|
|
27
|
+
export * from "./TimeZoneField";
|
|
28
|
+
export * from "./ToggleButtonGroupField";
|
|
29
|
+
export * from "./FileField";
|
|
30
|
+
import { FormSpy, useField } from 'react-final-form';
|
|
31
|
+
export { FormSpy, useField };
|
|
32
|
+
export * from "./SelectOwnerField";
|
|
33
|
+
export * from "./SearchField";
|
|
34
|
+
export * from "./StopsSelect/StopsSelect";
|
|
35
|
+
export * from "./StopsSelect/StopsSelectSearchForm";
|
|
36
|
+
export * from "./StopsSelect/StopSelectWithSearch";
|
|
37
|
+
export { StopsSelectTableRow } from "./StopsSelect/StopsSelectModal";
|
|
38
|
+
export * from "./ArrayField";
|
|
39
|
+
export declare function useForm<S extends object = any>(config?: Partial<FormConfig<S>>): FormRenderProps<S>;
|
|
40
|
+
export { useFinalForm, useFormContext };
|
|
41
|
+
export declare const TransField: () => JSX.Element;
|
|
42
|
+
export interface FormProviderProps<FormValues, InitialFormValues = Partial<FormValues>> {
|
|
43
|
+
form: FormApi<FormValues, InitialFormValues>;
|
|
44
|
+
}
|
|
45
|
+
export declare const FormProvider: <FormValues, InitialFormValues = Partial<FormValues>>({ children, form, }: PropsWithChildren<FormProviderProps<FormValues, InitialFormValues>>) => ReactElement;
|