@oneblink/apps-react 8.14.0-beta.2 → 9.0.0-beta.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/dist/OneBlinkAutoSaveForm.d.ts +1 -1
- package/dist/OneBlinkAutoSaveForm.js +6 -8
- package/dist/OneBlinkAutoSaveForm.js.map +1 -1
- package/dist/OneBlinkForm.js +3 -2
- package/dist/OneBlinkForm.js.map +1 -1
- package/dist/OneBlinkFormBase.d.ts +1 -1
- package/dist/OneBlinkFormBase.js +49 -146
- package/dist/OneBlinkFormBase.js.map +1 -1
- package/dist/OneBlinkReadOnlyForm.d.ts +1 -1
- package/dist/OneBlinkReadOnlyForm.js +2 -1
- package/dist/OneBlinkReadOnlyForm.js.map +1 -1
- package/dist/PaymentReceipt.d.ts +1 -1
- package/dist/PaymentReceipt.js +9 -30
- package/dist/PaymentReceipt.js.map +1 -1
- package/dist/components/ArcGISWebMap.d.ts +3 -3
- package/dist/components/ArcGISWebMap.js +25 -38
- package/dist/components/ArcGISWebMap.js.map +1 -1
- package/dist/components/Clickable.d.ts +1 -1
- package/dist/components/Clickable.js +2 -1
- package/dist/components/Clickable.js.map +1 -1
- package/dist/components/ConfirmDialog.d.ts +2 -2
- package/dist/components/ConfirmDialog.js +7 -14
- package/dist/components/ConfirmDialog.js.map +1 -1
- package/dist/components/CopyToClipboardIconButton.d.ts +1 -1
- package/dist/components/CopyToClipboardIconButton.js +10 -14
- package/dist/components/CopyToClipboardIconButton.js.map +1 -1
- package/dist/components/CustomAccordion.d.ts +3 -20
- package/dist/components/ErrorSnackbar.d.ts +1 -1
- package/dist/components/ErrorSnackbar.js +6 -7
- package/dist/components/ErrorSnackbar.js.map +1 -1
- package/dist/components/ImageCropper/CropModal.d.ts +1 -1
- package/dist/components/ImageCropper/CropModal.js +2 -8
- package/dist/components/ImageCropper/CropModal.js.map +1 -1
- package/dist/components/ImageCropper/index.d.ts +1 -1
- package/dist/components/ImageCropper/index.js +3 -5
- package/dist/components/ImageCropper/index.js.map +1 -1
- package/dist/components/InputClear.js +2 -3
- package/dist/components/InputClear.js.map +1 -1
- package/dist/components/InputField.d.ts +3 -2
- package/dist/components/InputField.js +5 -2
- package/dist/components/InputField.js.map +1 -1
- package/dist/components/Lists.d.ts +1 -6
- package/dist/components/Lists.js +2 -2
- package/dist/components/Lists.js.map +1 -1
- package/dist/components/LoadingWithMessage.js +2 -6
- package/dist/components/LoadingWithMessage.js.map +1 -1
- package/dist/components/MaterialIcon.d.ts +2 -4
- package/dist/components/MaterialIcon.js +4 -4
- package/dist/components/MaterialIcon.js.map +1 -1
- package/dist/components/NotificationGrid.d.ts +2 -2
- package/dist/components/NotificationGrid.js +4 -7
- package/dist/components/NotificationGrid.js.map +1 -1
- package/dist/components/QuillHTML.d.ts +1 -1
- package/dist/components/QuillHTML.js +2 -1
- package/dist/components/QuillHTML.js.map +1 -1
- package/dist/components/SuccessSnackbar.d.ts +1 -1
- package/dist/components/SuccessSnackbar.js +3 -6
- package/dist/components/SuccessSnackbar.js.map +1 -1
- package/dist/components/ValidationErrorsCard.d.ts +2 -2
- package/dist/components/ValidationErrorsCard.js +32 -49
- package/dist/components/ValidationErrorsCard.js.map +1 -1
- package/dist/components/calendar-bookings/CalendarBookingsCancelForm.d.ts +1 -1
- package/dist/components/calendar-bookings/CalendarBookingsCancelForm.js +5 -6
- package/dist/components/calendar-bookings/CalendarBookingsCancelForm.js.map +1 -1
- package/dist/components/calendar-bookings/CalendarBookingsContainer.d.ts +1 -1
- package/dist/components/calendar-bookings/CalendarBookingsContainer.js +9 -11
- package/dist/components/calendar-bookings/CalendarBookingsContainer.js.map +1 -1
- package/dist/components/calendar-bookings/CalendarBookingsForm.d.ts +1 -1
- package/dist/components/calendar-bookings/CalendarBookingsForm.js +33 -45
- package/dist/components/calendar-bookings/CalendarBookingsForm.js.map +1 -1
- package/dist/components/calendar-bookings/CalendarBookingsProvider.d.ts +1 -1
- package/dist/components/calendar-bookings/CalendarBookingsProvider.js +2 -6
- package/dist/components/calendar-bookings/CalendarBookingsProvider.js.map +1 -1
- package/dist/components/calendar-bookings/CalendarBookingsReschedulingForm.d.ts +1 -1
- package/dist/components/calendar-bookings/CalendarBookingsReschedulingForm.js +5 -6
- package/dist/components/calendar-bookings/CalendarBookingsReschedulingForm.js.map +1 -1
- package/dist/components/calendar-bookings/ErrorModal.js +7 -11
- package/dist/components/calendar-bookings/ErrorModal.js.map +1 -1
- package/dist/components/downloadable-files/LayoutProvider.d.ts +1 -1
- package/dist/components/downloadable-files/LayoutProvider.js +2 -1
- package/dist/components/downloadable-files/LayoutProvider.js.map +1 -1
- package/dist/components/downloadable-files/index.d.ts +1 -1
- package/dist/components/downloadable-files/index.js +3 -5
- package/dist/components/downloadable-files/index.js.map +1 -1
- package/dist/components/downloadable-files/resource-components.d.ts +3 -3
- package/dist/components/downloadable-files/resource-components.js +9 -32
- package/dist/components/downloadable-files/resource-components.js.map +1 -1
- package/dist/components/formStore/FormStoreTableProvider.d.ts +1 -1
- package/dist/components/formStore/FormStoreTableProvider.js +5 -15
- package/dist/components/formStore/FormStoreTableProvider.js.map +1 -1
- package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.d.ts +1 -1
- package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.js +3 -2
- package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.js.map +1 -1
- package/dist/components/formStore/OneBlinkFormStoreColumnsButton.d.ts +1 -1
- package/dist/components/formStore/OneBlinkFormStoreColumnsButton.js +21 -54
- package/dist/components/formStore/OneBlinkFormStoreColumnsButton.js.map +1 -1
- package/dist/components/formStore/OneBlinkFormStoreDownloadButton.d.ts +2 -2
- package/dist/components/formStore/OneBlinkFormStoreDownloadButton.js +7 -26
- package/dist/components/formStore/OneBlinkFormStoreDownloadButton.js.map +1 -1
- package/dist/components/formStore/OneBlinkFormStoreProvider.d.ts +1 -1
- package/dist/components/formStore/OneBlinkFormStoreProvider.js +4 -5
- package/dist/components/formStore/OneBlinkFormStoreProvider.js.map +1 -1
- package/dist/components/formStore/OneBlinkFormStoreRefreshButton.d.ts +1 -1
- package/dist/components/formStore/OneBlinkFormStoreRefreshButton.js +3 -2
- package/dist/components/formStore/OneBlinkFormStoreRefreshButton.js.map +1 -1
- package/dist/components/formStore/OneBlinkFormStoreTable.d.ts +1 -1
- package/dist/components/formStore/OneBlinkFormStoreTable.js +128 -94
- package/dist/components/formStore/OneBlinkFormStoreTable.js.map +1 -1
- package/dist/components/formStore/display/ElementDisplay.d.ts +3 -4
- package/dist/components/formStore/display/ElementDisplay.js +9 -12
- package/dist/components/formStore/display/ElementDisplay.js.map +1 -1
- package/dist/components/formStore/display/FormStoreIcon.d.ts +1 -1
- package/dist/components/formStore/display/FormStoreIcon.js +2 -2
- package/dist/components/formStore/display/FormStoreIcon.js.map +1 -1
- package/dist/components/formStore/table/ActionedByTableCell.d.ts +1 -1
- package/dist/components/formStore/table/ActionedByTableCell.js +6 -7
- package/dist/components/formStore/table/ActionedByTableCell.js.map +1 -1
- package/dist/components/formStore/table/ColumnFilters.d.ts +3 -3
- package/dist/components/formStore/table/ColumnFilters.js +84 -100
- package/dist/components/formStore/table/ColumnFilters.js.map +1 -1
- package/dist/components/formStore/table/FormElementTableCell.d.ts +1 -1
- package/dist/components/formStore/table/FormElementTableCell.js +34 -97
- package/dist/components/formStore/table/FormElementTableCell.js.map +1 -1
- package/dist/components/formStore/table/HeaderCellMoreButton.d.ts +4 -4
- package/dist/components/formStore/table/HeaderCellMoreButton.js +26 -32
- package/dist/components/formStore/table/HeaderCellMoreButton.js.map +1 -1
- package/dist/components/formStore/table/Pickers.d.ts +4 -4
- package/dist/components/formStore/table/Pickers.js +14 -13
- package/dist/components/formStore/table/Pickers.js.map +1 -1
- package/dist/components/formStore/table/RepeatableSetCell.js +16 -21
- package/dist/components/formStore/table/RepeatableSetCell.js.map +1 -1
- package/dist/components/formStore/table/RepeatableSetCellAccordion.js +2 -4
- package/dist/components/formStore/table/RepeatableSetCellAccordion.js.map +1 -1
- package/dist/components/formStore/table/TableCellCopyButton.d.ts +1 -1
- package/dist/components/formStore/table/TableCellCopyButton.js +2 -3
- package/dist/components/formStore/table/TableCellCopyButton.js.map +1 -1
- package/dist/components/formStore/table/generateColumns.d.ts +5 -6
- package/dist/components/formStore/table/generateColumns.js +23 -18
- package/dist/components/formStore/table/generateColumns.js.map +1 -1
- package/dist/components/formStore/table/getVersionedState.d.ts +4 -3
- package/dist/components/formStore/table/getVersionedState.js +23 -6
- package/dist/components/formStore/table/getVersionedState.js.map +1 -1
- package/dist/components/formStore/table/useFormStoreTable.d.ts +146 -37
- package/dist/components/formStore/table/useFormStoreTable.js +266 -199
- package/dist/components/formStore/table/useFormStoreTable.js.map +1 -1
- package/dist/components/formStore/useFormStoreTableContext.d.ts +142 -33
- package/dist/components/messages/ErrorMessage.js +3 -3
- package/dist/components/messages/ErrorMessage.js.map +1 -1
- package/dist/components/messages/LargeIconMessage.js +2 -6
- package/dist/components/messages/LargeIconMessage.js.map +1 -1
- package/dist/components/messages/NoResourcesYet.d.ts +1 -1
- package/dist/components/messages/NoResourcesYet.js +2 -1
- package/dist/components/messages/NoResourcesYet.js.map +1 -1
- package/dist/components/mfa/MfaDialog.d.ts +1 -1
- package/dist/components/mfa/MfaDialog.js +9 -48
- package/dist/components/mfa/MfaDialog.js.map +1 -1
- package/dist/components/mfa/MultiFactorAuthentication.d.ts +2 -5
- package/dist/components/mfa/MultiFactorAuthentication.js +14 -45
- package/dist/components/mfa/MultiFactorAuthentication.js.map +1 -1
- package/dist/components/payments/PaymentForm.d.ts +1 -1
- package/dist/components/payments/PaymentForm.js +4 -9
- package/dist/components/payments/PaymentForm.js.map +1 -1
- package/dist/components/payments/WestpacQuickStreamPaymentForm.d.ts +1 -1
- package/dist/components/payments/WestpacQuickStreamPaymentForm.js +11 -45
- package/dist/components/payments/WestpacQuickStreamPaymentForm.js.map +1 -1
- package/dist/components/receipts/Receipt.d.ts +1 -1
- package/dist/components/receipts/Receipt.js +2 -2
- package/dist/components/receipts/Receipt.js.map +1 -1
- package/dist/components/receipts/ReceiptButton.d.ts +1 -1
- package/dist/components/receipts/ReceiptButton.js +3 -2
- package/dist/components/receipts/ReceiptButton.js.map +1 -1
- package/dist/components/receipts/ReceiptList.d.ts +1 -1
- package/dist/components/receipts/ReceiptList.js +2 -9
- package/dist/components/receipts/ReceiptList.js.map +1 -1
- package/dist/components/receipts/ReceiptListItem.d.ts +1 -1
- package/dist/components/receipts/ReceiptListItem.js +2 -11
- package/dist/components/receipts/ReceiptListItem.js.map +1 -1
- package/dist/components/renderer/AnnotationModal.d.ts +1 -1
- package/dist/components/renderer/AnnotationModal.js +6 -14
- package/dist/components/renderer/AnnotationModal.js.map +1 -1
- package/dist/components/renderer/AutocompleteDropdown.d.ts +1 -1
- package/dist/components/renderer/AutocompleteDropdown.js +15 -34
- package/dist/components/renderer/AutocompleteDropdown.js.map +1 -1
- package/dist/components/renderer/CopyToClipboardButton.d.ts +1 -1
- package/dist/components/renderer/CopyToClipboardButton.js +2 -4
- package/dist/components/renderer/CopyToClipboardButton.js.map +1 -1
- package/dist/components/renderer/CustomisableButtonInner.js +2 -4
- package/dist/components/renderer/CustomisableButtonInner.js.map +1 -1
- package/dist/components/renderer/FormElementLabelContainer.d.ts +3 -3
- package/dist/components/renderer/FormElementLabelContainer.js +7 -14
- package/dist/components/renderer/FormElementLabelContainer.js.map +1 -1
- package/dist/components/renderer/FormElementOptions.d.ts +1 -1
- package/dist/components/renderer/FormElementOptions.js +4 -5
- package/dist/components/renderer/FormElementOptions.js.map +1 -1
- package/dist/components/renderer/FormElementValidationMessage.js +3 -5
- package/dist/components/renderer/FormElementValidationMessage.js.map +1 -1
- package/dist/components/renderer/LookupButton.d.ts +1 -1
- package/dist/components/renderer/LookupButton.js +4 -8
- package/dist/components/renderer/LookupButton.js.map +1 -1
- package/dist/components/renderer/LookupNotification.d.ts +1 -1
- package/dist/components/renderer/LookupNotification.js +14 -36
- package/dist/components/renderer/LookupNotification.js.map +1 -1
- package/dist/components/renderer/Modal.d.ts +3 -3
- package/dist/components/renderer/Modal.js +5 -10
- package/dist/components/renderer/Modal.js.map +1 -1
- package/dist/components/renderer/OnLoading.d.ts +1 -1
- package/dist/components/renderer/OnLoading.js +3 -3
- package/dist/components/renderer/OnLoading.js.map +1 -1
- package/dist/components/renderer/OneBlinkAppsErrorOriginalMessage.d.ts +1 -1
- package/dist/components/renderer/OneBlinkAppsErrorOriginalMessage.js +2 -4
- package/dist/components/renderer/OneBlinkAppsErrorOriginalMessage.js.map +1 -1
- package/dist/components/renderer/OneBlinkFormElements.d.ts +1 -1
- package/dist/components/renderer/OneBlinkFormElements.js +61 -90
- package/dist/components/renderer/OneBlinkFormElements.js.map +1 -1
- package/dist/components/renderer/PageFormElements.d.ts +1 -1
- package/dist/components/renderer/PageFormElements.js +3 -5
- package/dist/components/renderer/PageFormElements.js.map +1 -1
- package/dist/components/renderer/ProgressBar.d.ts +1 -1
- package/dist/components/renderer/ProgressBar.js +2 -1
- package/dist/components/renderer/ProgressBar.js.map +1 -1
- package/dist/components/renderer/ReverseGeocode.d.ts +1 -1
- package/dist/components/renderer/ReverseGeocode.js +2 -1
- package/dist/components/renderer/ReverseGeocode.js.map +1 -1
- package/dist/components/renderer/ToggleAllCheckbox.js +4 -5
- package/dist/components/renderer/ToggleAllCheckbox.js.map +1 -1
- package/dist/components/renderer/Tooltip.d.ts +1 -1
- package/dist/components/renderer/Tooltip.js +3 -1
- package/dist/components/renderer/Tooltip.js.map +1 -1
- package/dist/components/renderer/attachments/AttachmentStatus.d.ts +1 -1
- package/dist/components/renderer/attachments/AttachmentStatus.js +6 -15
- package/dist/components/renderer/attachments/AttachmentStatus.js.map +1 -1
- package/dist/components/renderer/attachments/DropdownMenu.js +30 -42
- package/dist/components/renderer/attachments/DropdownMenu.js.map +1 -1
- package/dist/components/renderer/attachments/FileCard.d.ts +1 -1
- package/dist/components/renderer/attachments/FileCard.js +2 -10
- package/dist/components/renderer/attachments/FileCard.js.map +1 -1
- package/dist/components/renderer/attachments/FileCardContent.d.ts +1 -1
- package/dist/components/renderer/attachments/FileCardContent.js +3 -4
- package/dist/components/renderer/attachments/FileCardContent.js.map +1 -1
- package/dist/components/renderer/attachments/ImagePreviewUnavailable.d.ts +1 -1
- package/dist/components/renderer/attachments/ImagePreviewUnavailable.js +2 -5
- package/dist/components/renderer/attachments/ImagePreviewUnavailable.js.map +1 -1
- package/dist/components/renderer/attachments/ProgressBar.js +2 -4
- package/dist/components/renderer/attachments/ProgressBar.js.map +1 -1
- package/dist/form-elements/ComplianceButton.js +3 -4
- package/dist/form-elements/ComplianceButton.js.map +1 -1
- package/dist/form-elements/FormElementABN.d.ts +1 -1
- package/dist/form-elements/FormElementABN.js +18 -28
- package/dist/form-elements/FormElementABN.js.map +1 -1
- package/dist/form-elements/FormElementAPINSWLiquorLicence.d.ts +2 -2
- package/dist/form-elements/FormElementAPINSWLiquorLicence.js +3 -21
- package/dist/form-elements/FormElementAPINSWLiquorLicence.js.map +1 -1
- package/dist/form-elements/FormElementArcGISWebMap.d.ts +1 -1
- package/dist/form-elements/FormElementArcGISWebMap.js +21 -36
- package/dist/form-elements/FormElementArcGISWebMap.js.map +1 -1
- package/dist/form-elements/FormElementAutocomplete.d.ts +1 -1
- package/dist/form-elements/FormElementAutocomplete.js +5 -9
- package/dist/form-elements/FormElementAutocomplete.js.map +1 -1
- package/dist/form-elements/FormElementBSB.d.ts +1 -1
- package/dist/form-elements/FormElementBSB.js +17 -30
- package/dist/form-elements/FormElementBSB.js.map +1 -1
- package/dist/form-elements/FormElementBarcodeScanner.d.ts +1 -1
- package/dist/form-elements/FormElementBarcodeScanner.js +16 -50
- package/dist/form-elements/FormElementBarcodeScanner.js.map +1 -1
- package/dist/form-elements/FormElementBoolean.d.ts +1 -1
- package/dist/form-elements/FormElementBoolean.js +4 -4
- package/dist/form-elements/FormElementBoolean.js.map +1 -1
- package/dist/form-elements/FormElementCalculation.d.ts +1 -1
- package/dist/form-elements/FormElementCalculation.js +2 -9
- package/dist/form-elements/FormElementCalculation.js.map +1 -1
- package/dist/form-elements/FormElementCamera.d.ts +1 -1
- package/dist/form-elements/FormElementCamera.js +7 -53
- package/dist/form-elements/FormElementCamera.js.map +1 -1
- package/dist/form-elements/FormElementCaptcha.d.ts +1 -1
- package/dist/form-elements/FormElementCaptcha.js +2 -4
- package/dist/form-elements/FormElementCaptcha.js.map +1 -1
- package/dist/form-elements/FormElementCheckBoxes.d.ts +1 -1
- package/dist/form-elements/FormElementCheckBoxes.js +23 -33
- package/dist/form-elements/FormElementCheckBoxes.js.map +1 -1
- package/dist/form-elements/FormElementCivicaNameRecord.d.ts +1 -1
- package/dist/form-elements/FormElementCivicaNameRecord.js +2 -1
- package/dist/form-elements/FormElementCivicaNameRecord.js.map +1 -1
- package/dist/form-elements/FormElementCivicaStreetName.d.ts +1 -1
- package/dist/form-elements/FormElementCivicaStreetName.js +2 -4
- package/dist/form-elements/FormElementCivicaStreetName.js.map +1 -1
- package/dist/form-elements/FormElementCompliance.d.ts +1 -1
- package/dist/form-elements/FormElementCompliance.js +13 -25
- package/dist/form-elements/FormElementCompliance.js.map +1 -1
- package/dist/form-elements/FormElementDate.d.ts +1 -1
- package/dist/form-elements/FormElementDate.js +2 -9
- package/dist/form-elements/FormElementDate.js.map +1 -1
- package/dist/form-elements/FormElementDateTime.d.ts +1 -1
- package/dist/form-elements/FormElementDateTime.js +2 -9
- package/dist/form-elements/FormElementDateTime.js.map +1 -1
- package/dist/form-elements/FormElementEmail.d.ts +1 -1
- package/dist/form-elements/FormElementEmail.js +4 -13
- package/dist/form-elements/FormElementEmail.js.map +1 -1
- package/dist/form-elements/FormElementFile.js +2 -12
- package/dist/form-elements/FormElementFile.js.map +1 -1
- package/dist/form-elements/FormElementFiles.d.ts +1 -1
- package/dist/form-elements/FormElementFiles.js +9 -17
- package/dist/form-elements/FormElementFiles.js.map +1 -1
- package/dist/form-elements/FormElementForm.d.ts +1 -1
- package/dist/form-elements/FormElementForm.js +2 -1
- package/dist/form-elements/FormElementForm.js.map +1 -1
- package/dist/form-elements/FormElementFreshdeskDependentField.d.ts +1 -1
- package/dist/form-elements/FormElementFreshdeskDependentField.js +2 -1
- package/dist/form-elements/FormElementFreshdeskDependentField.js.map +1 -1
- package/dist/form-elements/FormElementGeoscapeAddress.d.ts +1 -1
- package/dist/form-elements/FormElementGeoscapeAddress.js +2 -4
- package/dist/form-elements/FormElementGeoscapeAddress.js.map +1 -1
- package/dist/form-elements/FormElementGoogleAddress.d.ts +1 -1
- package/dist/form-elements/FormElementGoogleAddress.js +2 -7
- package/dist/form-elements/FormElementGoogleAddress.js.map +1 -1
- package/dist/form-elements/FormElementHTML.d.ts +1 -1
- package/dist/form-elements/FormElementHTML.js +2 -3
- package/dist/form-elements/FormElementHTML.js.map +1 -1
- package/dist/form-elements/FormElementHeading.d.ts +1 -1
- package/dist/form-elements/FormElementHeading.js +7 -8
- package/dist/form-elements/FormElementHeading.js.map +1 -1
- package/dist/form-elements/FormElementImage.d.ts +1 -1
- package/dist/form-elements/FormElementImage.js +3 -3
- package/dist/form-elements/FormElementImage.js.map +1 -1
- package/dist/form-elements/FormElementLocation.d.ts +1 -1
- package/dist/form-elements/FormElementLocation.js +16 -47
- package/dist/form-elements/FormElementLocation.js.map +1 -1
- package/dist/form-elements/FormElementLookupButton.d.ts +2 -3
- package/dist/form-elements/FormElementLookupButton.js +4 -7
- package/dist/form-elements/FormElementLookupButton.js.map +1 -1
- package/dist/form-elements/FormElementNumber.d.ts +1 -1
- package/dist/form-elements/FormElementNumber.js +3 -14
- package/dist/form-elements/FormElementNumber.js.map +1 -1
- package/dist/form-elements/FormElementPointAddress.d.ts +2 -2
- package/dist/form-elements/FormElementPointAddress.js +6 -13
- package/dist/form-elements/FormElementPointAddress.js.map +1 -1
- package/dist/form-elements/FormElementPointAddressV3.d.ts +1 -1
- package/dist/form-elements/FormElementPointAddressV3.js +2 -9
- package/dist/form-elements/FormElementPointAddressV3.js.map +1 -1
- package/dist/form-elements/FormElementPointCadastralParcel.d.ts +1 -1
- package/dist/form-elements/FormElementPointCadastralParcel.js +14 -26
- package/dist/form-elements/FormElementPointCadastralParcel.js.map +1 -1
- package/dist/form-elements/FormElementRadio.d.ts +1 -1
- package/dist/form-elements/FormElementRadio.js +24 -30
- package/dist/form-elements/FormElementRadio.js.map +1 -1
- package/dist/form-elements/FormElementRepeatableSet.d.ts +1 -1
- package/dist/form-elements/FormElementRepeatableSet.js +21 -39
- package/dist/form-elements/FormElementRepeatableSet.js.map +1 -1
- package/dist/form-elements/FormElementSection.d.ts +1 -1
- package/dist/form-elements/FormElementSection.js +16 -34
- package/dist/form-elements/FormElementSection.js.map +1 -1
- package/dist/form-elements/FormElementSelect.d.ts +1 -1
- package/dist/form-elements/FormElementSelect.js +12 -23
- package/dist/form-elements/FormElementSelect.js.map +1 -1
- package/dist/form-elements/FormElementSignature.d.ts +1 -1
- package/dist/form-elements/FormElementSignature.js +21 -46
- package/dist/form-elements/FormElementSignature.js.map +1 -1
- package/dist/form-elements/FormElementSummary.d.ts +1 -1
- package/dist/form-elements/FormElementSummary.js +5 -4
- package/dist/form-elements/FormElementSummary.js.map +1 -1
- package/dist/form-elements/FormElementTelephone.d.ts +1 -1
- package/dist/form-elements/FormElementTelephone.js +4 -13
- package/dist/form-elements/FormElementTelephone.js.map +1 -1
- package/dist/form-elements/FormElementText.d.ts +1 -1
- package/dist/form-elements/FormElementText.js +6 -21
- package/dist/form-elements/FormElementText.js.map +1 -1
- package/dist/form-elements/FormElementTextarea.d.ts +1 -1
- package/dist/form-elements/FormElementTextarea.js +6 -20
- package/dist/form-elements/FormElementTextarea.js.map +1 -1
- package/dist/form-elements/FormElementTime.d.ts +1 -1
- package/dist/form-elements/FormElementTime.js +2 -9
- package/dist/form-elements/FormElementTime.js.map +1 -1
- package/dist/form-elements/OptionButton.js +3 -5
- package/dist/form-elements/OptionButton.js.map +1 -1
- package/dist/hooks/attachments/useAttachmentBlobs.d.ts +1 -1
- package/dist/hooks/attachments/useAttachmentBlobs.js +2 -1
- package/dist/hooks/attachments/useAttachmentBlobs.js.map +1 -1
- package/dist/hooks/form-date-picker/useFormDatePickerProps.d.ts +7 -8
- package/dist/hooks/form-date-picker/useFormDatePickerProps.js +8 -10
- package/dist/hooks/form-date-picker/useFormDatePickerProps.js.map +1 -1
- package/dist/hooks/useAuth.d.ts +1 -1
- package/dist/hooks/useAuth.js +2 -1
- package/dist/hooks/useAuth.js.map +1 -1
- package/dist/hooks/useDrafts.d.ts +1 -1
- package/dist/hooks/useDrafts.js +2 -1
- package/dist/hooks/useDrafts.js.map +1 -1
- package/dist/hooks/useDynamicOptionsLoaderState.d.ts +1 -1
- package/dist/hooks/useDynamicOptionsLoaderState.js +4 -13
- package/dist/hooks/useDynamicOptionsLoaderState.js.map +1 -1
- package/dist/hooks/useFormElementLookups.d.ts +1 -1
- package/dist/hooks/useFormElementLookups.js +2 -1
- package/dist/hooks/useFormElementLookups.js.map +1 -1
- package/dist/hooks/useFormSubmissionModelContext.d.ts +1 -1
- package/dist/hooks/useFormSubmissionModelContext.js +2 -1
- package/dist/hooks/useFormSubmissionModelContext.js.map +1 -1
- package/dist/hooks/useFormSubmissionState.d.ts +1 -1
- package/dist/hooks/useFormSubmissionState.js +1 -1
- package/dist/hooks/useFormSubmissionState.js.map +1 -1
- package/dist/hooks/useIsHovering.d.ts +1 -1
- package/dist/hooks/useIsHovering.js +4 -4
- package/dist/hooks/useIsHovering.js.map +1 -1
- package/dist/hooks/useIsOffline.d.ts +1 -1
- package/dist/hooks/useIsOffline.js +2 -1
- package/dist/hooks/useIsOffline.js.map +1 -1
- package/dist/hooks/useIsPageVisible.d.ts +1 -1
- package/dist/hooks/useIsPageVisible.js +2 -1
- package/dist/hooks/useIsPageVisible.js.map +1 -1
- package/dist/hooks/useMfa.d.ts +1 -1
- package/dist/hooks/useMfa.js +2 -1
- package/dist/hooks/useMfa.js.map +1 -1
- package/dist/hooks/usePages.d.ts +1 -1
- package/dist/hooks/usePendingSubmissions.d.ts +1 -1
- package/dist/hooks/usePendingSubmissions.js +2 -1
- package/dist/hooks/usePendingSubmissions.js.map +1 -1
- package/dist/hooks/useReCAPTCHAProps.d.ts +1 -1
- package/dist/hooks/useReCAPTCHAProps.js.map +1 -1
- package/package.json +21 -25
|
@@ -15,7 +15,7 @@ declare function OneBlinkAutoSaveForm({ form, initialSubmission, resumeAtElement
|
|
|
15
15
|
* later, pass `false`.
|
|
16
16
|
*/
|
|
17
17
|
removeAutoSaveDataBeforeSaveDraft?: boolean;
|
|
18
|
-
}):
|
|
18
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
19
19
|
/**
|
|
20
20
|
* This component is a drop in replacement for {@link OneBlinkForm} with the
|
|
21
21
|
* addition of auto save happening periodically to prevent users from losing
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import OnLoading from './components/renderer/OnLoading';
|
|
3
4
|
import Modal from './components/renderer/Modal';
|
|
@@ -19,17 +20,14 @@ function OneBlinkAutoSaveForm({ form, initialSubmission, resumeAtElement, autoSa
|
|
|
19
20
|
resumePreviousElapsedDurationSeconds,
|
|
20
21
|
});
|
|
21
22
|
if (isLoadingAutoSaveSubmission) {
|
|
22
|
-
return (
|
|
23
|
-
React.createElement(OnLoading, { className: "has-text-centered" })));
|
|
23
|
+
return (_jsx("div", { className: "cypress-loading has-text-centered", children: _jsx(OnLoading, { className: "has-text-centered" }) }));
|
|
24
24
|
}
|
|
25
25
|
if (isAutoSaveSubmissionAvailable) {
|
|
26
|
-
return (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} }, "Start Again"),
|
|
30
|
-
React.createElement("button", { type: "button", className: "button ob-button is-primary cypress-continue-auto-save-continue-button", onClick: continueAutoSaveSubmission, autoFocus: true }, "Continue")) }, "We found an in progress submission, would you like to pick up where you left off or start again?"));
|
|
26
|
+
return (_jsx(Modal, { isOpen: true, title: "Continue?", cardClassName: "cypress-continue-auto-save", actions: _jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "button ob-button is-light cypress-continue-auto-save-start-again-button", onClick: () => {
|
|
27
|
+
startNewSubmission();
|
|
28
|
+
}, children: "Start Again" }), _jsx("button", { type: "button", className: "button ob-button is-primary cypress-continue-auto-save-continue-button", onClick: continueAutoSaveSubmission, autoFocus: true, children: "Continue" })] }), children: "We found an in progress submission, would you like to pick up where you left off or start again?" }));
|
|
31
29
|
}
|
|
32
|
-
return (
|
|
30
|
+
return (_jsx(OneBlinkFormBase, { ...props, isReadOnly: false, submission: submission, definition: definition, onCancel: handleCancel, onSubmit: handleSubmit, onSaveDraft: handleSaveDraft, setFormSubmission: setFormSubmission, handleNavigateAway: handleNavigateAway, lastElementUpdated: lastElementUpdated, executedLookups: executedLookups, sectionState: sectionState, getCurrentSubmissionDuration: getCurrentSubmissionDuration }));
|
|
33
31
|
}
|
|
34
32
|
/**
|
|
35
33
|
* This component is a drop in replacement for {@link OneBlinkForm} with the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OneBlinkAutoSaveForm.js","sourceRoot":"","sources":["../src/OneBlinkAutoSaveForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,SAAS,MAAM,iCAAiC,CAAA;AACvD,OAAO,KAAK,MAAM,6BAA6B,CAAA;AAC/C,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AACjD,OAAO,8BAA8B,MAAM,wCAAwC,CAAA;AAGnF,SAAS,oBAAoB,CAAC,EAC5B,IAAI,EACJ,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,8BAA8B,EAC9B,iCAAiC,EACjC,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,kBAAkB,EAClB,oCAAoC,EACpC,GAAG,KAAK,EAgBT;IACC,MAAM,EACJ,UAAU,EACV,UAAU,EACV,2BAA2B,EAC3B,6BAA6B,EAC7B,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,4BAA4B,GAC7B,GAAG,8BAA8B,CAAC;QACjC,IAAI;QACJ,iBAAiB;QACjB,eAAe;QACf,WAAW;QACX,8BAA8B;QAC9B,iCAAiC;QACjC,QAAQ;QACR,QAAQ;QACR,WAAW;QACX,cAAc,EAAE,QAAQ;QACxB,kBAAkB;QAClB,oCAAoC;KACrC,CAAC,CAAA;IAEF,IAAI,2BAA2B,EAAE,CAAC;QAChC,OAAO,CACL,
|
|
1
|
+
{"version":3,"file":"OneBlinkAutoSaveForm.js","sourceRoot":"","sources":["../src/OneBlinkAutoSaveForm.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,SAAS,MAAM,iCAAiC,CAAA;AACvD,OAAO,KAAK,MAAM,6BAA6B,CAAA;AAC/C,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AACjD,OAAO,8BAA8B,MAAM,wCAAwC,CAAA;AAGnF,SAAS,oBAAoB,CAAC,EAC5B,IAAI,EACJ,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,8BAA8B,EAC9B,iCAAiC,EACjC,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,kBAAkB,EAClB,oCAAoC,EACpC,GAAG,KAAK,EAgBT;IACC,MAAM,EACJ,UAAU,EACV,UAAU,EACV,2BAA2B,EAC3B,6BAA6B,EAC7B,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,4BAA4B,GAC7B,GAAG,8BAA8B,CAAC;QACjC,IAAI;QACJ,iBAAiB;QACjB,eAAe;QACf,WAAW;QACX,8BAA8B;QAC9B,iCAAiC;QACjC,QAAQ;QACR,QAAQ;QACR,WAAW;QACX,cAAc,EAAE,QAAQ;QACxB,kBAAkB;QAClB,oCAAoC;KACrC,CAAC,CAAA;IAEF,IAAI,2BAA2B,EAAE,CAAC;QAChC,OAAO,CACL,cAAK,SAAS,EAAC,mCAAmC,YAChD,KAAC,SAAS,IAAC,SAAS,EAAC,mBAAmB,GAAa,GACjD,CACP,CAAA;IACH,CAAC;IAED,IAAI,6BAA6B,EAAE,CAAC;QAClC,OAAO,CACL,KAAC,KAAK,IACJ,MAAM,QACN,KAAK,EAAC,WAAW,EACjB,aAAa,EAAC,4BAA4B,EAC1C,OAAO,EACL,8BACE,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,yEAAyE,EACnF,OAAO,EAAE,GAAG,EAAE;4BACZ,kBAAkB,EAAE,CAAA;wBACtB,CAAC,4BAGM,EACT,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,wEAAwE,EAClF,OAAO,EAAE,0BAA0B,EACnC,SAAS,+BAGF,IACR,iHAKC,CACT,CAAA;IACH,CAAC;IACD,OAAO,CACL,KAAC,gBAAgB,OACX,KAAK,EACT,UAAU,EAAE,KAAK,EACjB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,eAAe,EAC5B,iBAAiB,EAAE,iBAAiB,EACpC,kBAAkB,EAAE,kBAAkB,EACtC,kBAAkB,EAAE,kBAAkB,EACtC,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,EAC1B,4BAA4B,EAAE,4BAA4B,GAC1D,CACH,CAAA;AACH,CAAC;AAED;;;;;;;;;;;GAWG;AACH,eAAe,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport OnLoading from './components/renderer/OnLoading'\nimport Modal from './components/renderer/Modal'\nimport OneBlinkFormBase from './OneBlinkFormBase'\nimport useFormSubmissionAutoSaveState from './hooks/useFormSubmissionAutoSaveState'\nimport { OneBlinkFormUncontrolled } from './OneBlinkForm'\n\nfunction OneBlinkAutoSaveForm({\n form,\n initialSubmission,\n resumeAtElement,\n autoSaveKey,\n removeAutoSaveDataBeforeSubmit,\n removeAutoSaveDataBeforeSaveDraft,\n disabled,\n onCancel,\n onSubmit,\n onSaveDraft,\n resumeSectionState,\n resumePreviousElapsedDurationSeconds,\n ...props\n}: React.ComponentProps<typeof OneBlinkFormUncontrolled> & {\n /** Pass a unique key for this submission e.g. the `externalId` the parameter */\n autoSaveKey: string\n /**\n * By default, auto save data is removed when the user clicks Submit. If you\n * would like auto save data to persist and clean up the auto save data later,\n * pass `false`.\n */\n removeAutoSaveDataBeforeSubmit?: boolean\n /**\n * By default, auto save data is removed when the user clicks Save Draft. If\n * you would like auto save data to persist and clean up the auto save data\n * later, pass `false`.\n */\n removeAutoSaveDataBeforeSaveDraft?: boolean\n}) {\n const {\n definition,\n submission,\n isLoadingAutoSaveSubmission,\n isAutoSaveSubmissionAvailable,\n startNewSubmission,\n continueAutoSaveSubmission,\n handleSubmit,\n handleCancel,\n handleSaveDraft,\n setFormSubmission,\n handleNavigateAway,\n lastElementUpdated,\n executedLookups,\n sectionState,\n getCurrentSubmissionDuration,\n } = useFormSubmissionAutoSaveState({\n form,\n initialSubmission,\n resumeAtElement,\n autoSaveKey,\n removeAutoSaveDataBeforeSubmit,\n removeAutoSaveDataBeforeSaveDraft,\n onCancel,\n onSubmit,\n onSaveDraft,\n formIsDisabled: disabled,\n resumeSectionState,\n resumePreviousElapsedDurationSeconds,\n })\n\n if (isLoadingAutoSaveSubmission) {\n return (\n <div className=\"cypress-loading has-text-centered\">\n <OnLoading className=\"has-text-centered\"></OnLoading>\n </div>\n )\n }\n\n if (isAutoSaveSubmissionAvailable) {\n return (\n <Modal\n isOpen\n title=\"Continue?\"\n cardClassName=\"cypress-continue-auto-save\"\n actions={\n <>\n <button\n type=\"button\"\n className=\"button ob-button is-light cypress-continue-auto-save-start-again-button\"\n onClick={() => {\n startNewSubmission()\n }}\n >\n Start Again\n </button>\n <button\n type=\"button\"\n className=\"button ob-button is-primary cypress-continue-auto-save-continue-button\"\n onClick={continueAutoSaveSubmission}\n autoFocus\n >\n Continue\n </button>\n </>\n }\n >\n We found an in progress submission, would you like to pick up where you\n left off or start again?\n </Modal>\n )\n }\n return (\n <OneBlinkFormBase\n {...props}\n isReadOnly={false}\n submission={submission}\n definition={definition}\n onCancel={handleCancel}\n onSubmit={handleSubmit}\n onSaveDraft={handleSaveDraft}\n setFormSubmission={setFormSubmission}\n handleNavigateAway={handleNavigateAway}\n lastElementUpdated={lastElementUpdated}\n executedLookups={executedLookups}\n sectionState={sectionState}\n getCurrentSubmissionDuration={getCurrentSubmissionDuration}\n />\n )\n}\n\n/**\n * This component is a drop in replacement for {@link OneBlinkForm} with the\n * addition of auto save happening periodically to prevent users from losing\n * submission data.\n *\n * If you need auto saving with a controlled form, see the\n * {@link OneBlinkFormControlled} component for a full example.\n *\n * @param props\n * @returns\n * @group Components\n */\nexport default React.memo(OneBlinkAutoSaveForm)\n"]}
|
package/dist/OneBlinkForm.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import OneBlinkFormBase from './OneBlinkFormBase';
|
|
3
4
|
import useFormSubmissionState from './hooks/useFormSubmissionState';
|
|
@@ -328,7 +329,7 @@ import useFormSubmissionDuration from './hooks/useFormSubmissionDuration';
|
|
|
328
329
|
* @group Components
|
|
329
330
|
*/
|
|
330
331
|
const OneBlinkFormControlled = React.memo(function OneBlinkFormControlled(props) {
|
|
331
|
-
return
|
|
332
|
+
return _jsx(OneBlinkFormBase, { ...props, isReadOnly: false });
|
|
332
333
|
});
|
|
333
334
|
/**
|
|
334
335
|
* Component for rendering a OneBlink Form. This component will render the
|
|
@@ -554,7 +555,7 @@ const OneBlinkFormControlled = React.memo(function OneBlinkFormControlled(props)
|
|
|
554
555
|
const OneBlinkFormUncontrolled = React.memo(function OneBlinkFormUncontrolled({ form, initialSubmission, resumeAtElement, resumeSectionState, resumePreviousElapsedDurationSeconds, ...props }) {
|
|
555
556
|
const [getCurrentSubmissionDuration] = useFormSubmissionDuration(resumePreviousElapsedDurationSeconds);
|
|
556
557
|
const [{ definition, submission, lastElementUpdated, executedLookups, sectionState, }, setFormSubmission,] = useFormSubmissionState(form, initialSubmission, resumeAtElement, resumeSectionState);
|
|
557
|
-
return (
|
|
558
|
+
return (_jsx(OneBlinkFormBase, { ...props, isReadOnly: false, definition: definition, submission: submission, setFormSubmission: setFormSubmission, lastElementUpdated: lastElementUpdated, executedLookups: executedLookups, sectionState: sectionState, getCurrentSubmissionDuration: getCurrentSubmissionDuration }));
|
|
558
559
|
});
|
|
559
560
|
export { OneBlinkFormControlled, OneBlinkFormUncontrolled };
|
|
560
561
|
//# sourceMappingURL=OneBlinkForm.js.map
|
package/dist/OneBlinkForm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OneBlinkForm.js","sourceRoot":"","sources":["../src/OneBlinkForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,gBAIN,MAAM,oBAAoB,CAAA;AAC3B,OAAO,sBAAsB,MAAM,gCAAgC,CAAA;AACnE,OAAO,yBAAyB,MAAM,mCAAmC,CAAA;AAKzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoUG;AACH,MAAM,sBAAsB,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,sBAAsB,CACvE,KAA0D;IAE1D,OAAO,oBAAC,gBAAgB,OAAK,KAAK,EAAE,UAAU,EAAE,KAAK,GAAI,CAAA;AAC3D,CAAC,CAAC,CAAA;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4NG;AACH,MAAM,wBAAwB,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,wBAAwB,CAAC,EAC5E,IAAI,EACJ,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,oCAAoC,EACpC,GAAG,KAAK,EAOP;IACD,MAAM,CAAC,4BAA4B,CAAC,GAAG,yBAAyB,CAC9D,oCAAoC,CACrC,CAAA;IACD,MAAM,CACJ,EACE,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,YAAY,GACb,EACD,iBAAiB,EAClB,GAAG,sBAAsB,CACxB,IAAI,EACJ,iBAAiB,EACjB,eAAe,EACf,kBAAkB,CACnB,CAAA;IACD,OAAO,CACL,oBAAC,gBAAgB,OACX,KAAK,EACT,UAAU,EAAE,KAAK,EACjB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,iBAAiB,EAAE,iBAAiB,EACpC,kBAAkB,EAAE,kBAAkB,EACtC,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,EAC1B,4BAA4B,EAAE,4BAA4B,GAC1D,CACH,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,CAAA","sourcesContent":["import * as React from 'react'\nimport { FormTypes } from '@oneblink/types'\nimport OneBlinkFormBase, {\n OneBlinkFormBaseProps,\n OneBlinkFormControlledProps,\n OneBlinkFormUncontrolledProps,\n} from './OneBlinkFormBase'\nimport useFormSubmissionState from './hooks/useFormSubmissionState'\nimport useFormSubmissionDuration from './hooks/useFormSubmissionDuration'\nimport { SectionState } from './types/form'\n\nexport { OneBlinkFormBaseProps, OneBlinkFormControlledProps }\n\n/**\n * Similar to {@link OneBlinkForm}, however requires props to control the\n * `definition` and `submission` values.\n *\n * #### Example\n *\n * ```tsx\n * import React from 'react'\n * import ReactDOM from 'react-dom'\n * import { FormTypes } from '@oneblink/types'\n * import {\n * OneBlinkAppsError,\n * draftService,\n * submissionService,\n * } from '@oneblink/apps'\n * import {\n * IsOfflineContextProvider,\n * OneBlinkFormControlled,\n * useIsMounted,\n * useFormSubmissionState,\n * } from '@oneblink/apps-react'\n * import '@oneblink/apps-react/dist/styles.css'\n *\n * const captchaSiteKey = 'ENTER_YOUR_SITE_KEY_HERE'\n * const googleMapsApiKey = 'ENTER_YOUR_MAPS_API_KEY_HERE'\n * const formsAppId = 1\n * const form: FormTypes.Form = {\n * id: 1,\n * name: 'Name of Form',\n * description: '',\n * organisationId: 'abc123',\n * formsAppEnvironmentId: 1,\n * formsAppIds: [],\n * elements: [],\n * isAuthenticated: false,\n * isMultiPage: false,\n * isInfoPage: false,\n * publishStartDate: null,\n * publishEndDate: null,\n * postSubmissionAction: 'FORMS_LIBRARY',\n * submissionEvents: [],\n * tags: [],\n * }\n * const initialSubmission: Record<string, unknown> = {\n * data: 1,\n * }\n *\n * function FormContainer() {\n * const isMounted = useIsMounted()\n *\n * const [{ definition, submission }, setFormSubmission] =\n * useFormSubmissionState(form, initialSubmission)\n *\n * const [{ isSavingDraft, saveDraftError }, setSaveDraftState] =\n * React.useState({\n * isSavingDraft: false,\n * saveDraftError: null,\n * })\n *\n * const [\n * { isSubmitting, submitError, formSubmissionResult },\n * setSubmitState,\n * ] = React.useState({\n * formSubmissionResult: null,\n * isSubmitting: false,\n * submitError: null,\n * })\n *\n * const handleSubmit = React.useCallback(\n * async (newFormSubmission: FormTypes.NewFormSubmission) => {\n * const formSubmission: FormSubmission = Object.assign(\n * {},\n * newFormSubmission,\n * {\n * formsAppId,\n * jobId: null,\n * externalId: null,\n * draftId: null,\n * preFillFormDataId: null,\n * },\n * )\n *\n * setSubmitState({\n * formSubmissionResult: null,\n * submitError: null,\n * isSubmitting: true,\n * })\n *\n * try {\n * const newFormSubmissionResult = await submissionService.submit({\n * formSubmission,\n * })\n * if (\n * newFormSubmissionResult.isOffline &&\n * !newFormSubmissionResult.isInPendingQueue\n * ) {\n * throw new OneBlinkAppsError(\n * 'You cannot submit this form while offline, please try again when connectivity is restored.',\n * {\n * isOffline: true,\n * },\n * )\n * }\n *\n * if (isMounted.current) {\n * setSubmitState({\n * formSubmissionResult: newFormSubmissionResult,\n * isSubmitting: false,\n * submitError: null,\n * })\n * }\n * } catch (error) {\n * if (isMounted.current) {\n * setSubmitState({\n * formSubmissionResult: null,\n * isSubmitting: false,\n * submitError: error,\n * })\n * }\n * }\n * },\n * [isMounted],\n * )\n *\n * const handleSaveDraft = React.useCallback(\n * async (newDraftSubmission: FormTypes.NewDraftSubmission) => {\n * const draftSubmission: FormTypes.DraftSubmission = {\n * ...newDraftSubmission,\n * formsAppId,\n * }\n * setSaveDraftState({\n * saveDraftError: null,\n * isSavingDraft: true,\n * })\n *\n * try {\n * await draftService.addDraft(\n * {\n * title: form.name,\n * formId: form.id,\n * externalId: null,\n * jobId: null,\n * },\n * draftSubmission,\n * )\n *\n * if (isMounted.current) {\n * setSaveDraftState({\n * saveDraftError: null,\n * isSavingDraft: false,\n * })\n * }\n * } catch (error) {\n * if (isMounted.current) {\n * setSaveDraftState({\n * saveDraftError: error,\n * isSavingDraft: false,\n * })\n * }\n * }\n * },\n * [isMounted],\n * )\n *\n * const handleCancel = React.useCallback(() => {\n * // handle cancel here...\n * }, [])\n *\n * if (isSubmitting) {\n * // Render submitting animation/loading\n * }\n *\n * if (submitError) {\n * // Render error while submitting\n * }\n *\n * if (isSavingDraft) {\n * // Render saving draft animation/loading\n * }\n *\n * if (saveDraftError) {\n * // Render error while saving draft\n * }\n *\n * if (formSubmissionResult) {\n * // Render submission success\n * }\n *\n * return (\n * <OneBlinkFormControlled\n * captchaSiteKey={captchaSiteKey}\n * googleMapsApiKey={googleMapsApiKey}\n * formsAppId={formsAppId}\n * definition={definition}\n * submission={submission}\n * setFormSubmission={setFormSubmission}\n * onCancel={handleCancel}\n * onSubmit={handleSubmit}\n * onSaveDraft={handleSaveDraft}\n * />\n * )\n * }\n *\n * function App() {\n * return (\n * <IsOfflineContextProvider>\n * <FormContainer />\n * </IsOfflineContextProvider>\n * )\n * }\n *\n * const root = document.getElementById('root')\n * if (root) {\n * ReactDOM.render(<App />, root)\n * }\n * ```\n *\n * #### Implementing Controlled Auto Save\n *\n * The {@link OneBlinkAutoSaveForm} component does not offer props to allow for a\n * controlled form (i.e. having access to `submission` and `definition` values).\n * To implement a controlled version of the `<OneBlinkAutoSaveForm />`\n * component, use the example component below.\n *\n * ```tsx\n * import * as React from 'react'\n * import {\n * OneBlinkAutoSaveForm,\n * OneBlinkFormControlled,\n * useFormSubmissionAutoSaveState,\n * } from '@oneblink/apps-react'\n *\n * function OneBlinkAutoSaveFormControlled({\n * form,\n * initialSubmission,\n * autoSaveKey,\n * onCancel,\n * onSubmit,\n * onSaveDraft,\n * ...props\n * }: React.ComponentProps<typeof OneBlinkAutoSaveForm>) {\n * const {\n * definition,\n * submission,\n * isLoadingAutoSaveSubmission,\n * isAutoSaveSubmissionAvailable,\n * startNewSubmission,\n * continueAutoSaveSubmission,\n * handleSubmit,\n * handleCancel,\n * handleSaveDraft,\n * setFormSubmission,\n * } = useFormSubmissionAutoSaveState({\n * form,\n * initialSubmission,\n * autoSaveKey,\n * onCancel,\n * onSubmit,\n * onSaveDraft,\n * })\n *\n * // This is just an example of how you could intercept\n * // the change event when a user enters/selects a value\n * // on the form.\n * const customSetFormSubmission = React.useCallback(\n * (formSubmission) => {\n * setFormSubmission((currentFormSubmission) => {\n * const newFormSubmission =\n * typeof formSubmission === 'function'\n * ? formSubmission(currentFormSubmission)\n * : formSubmission\n *\n * // This is where you can access the updated\n * // submission data or form definition.\n * // You could even change the form definition\n * // programmatically based on user inputs.\n * console.log(\n * 'A change has occurred to the submission',\n * newFormSubmission.submission,\n * )\n * newFormSubmission.definition.isInfoPage =\n * !newFormSubmission.submission.doesTheUserNeedToSubmit\n *\n * return newFormSubmission\n * })\n * },\n * [setFormSubmission],\n * )\n *\n * if (isLoadingAutoSaveSubmission) {\n * return <p>Checking for auto save data...</p>\n * }\n *\n * if (isAutoSaveSubmissionAvailable) {\n * return (\n * <>\n * <p>Do you want to use the auto save data?</p>\n * <button onClick={startNewSubmission}>No, start again</button>\n * <button onClick={continueAutoSaveSubmission}>\n * Yes, continue\n * </button>\n * </>\n * )\n * }\n *\n * return (\n * <OneBlinkFormControlled\n * {...props}\n * submission={submission}\n * definition={definition}\n * onCancel={handleCancel}\n * onSubmit={handleSubmit}\n * onSaveDraft={handleSaveDraft}\n * setFormSubmission={customSetFormSubmission}\n * />\n * )\n * }\n *\n * export default React.memo(OneBlinkAutoSaveFormControlled)\n * ```\n *\n * @param props\n * @returns\n * @group Components\n */\nconst OneBlinkFormControlled = React.memo(function OneBlinkFormControlled(\n props: OneBlinkFormBaseProps & OneBlinkFormControlledProps,\n) {\n return <OneBlinkFormBase {...props} isReadOnly={false} />\n})\n\n/**\n * Component for rendering a OneBlink Form. This component will render the\n * submit, cancel and save draft buttons but it is up to the developer to\n * implement what happens when those buttons are clicked.\n *\n * It is also recommended to import the `css` from this library as well.\n *\n * ```js\n * import { OneBlinkForm } from '@oneblink/apps-react'\n * import '@oneblink/apps-react/dist/styles.css'\n * ```\n *\n * #### Example\n *\n * ```tsx\n * import React from 'react'\n * import ReactDOM from 'react-dom'\n * import { FormTypes } from '@oneblink/types'\n * import {\n * OneBlinkAppsError,\n * draftService,\n * submissionService,\n * } from '@oneblink/apps'\n * import {\n * IsOfflineContextProvider,\n * OneBlinkForm,\n * useIsMounted,\n * } from '@oneblink/apps-react'\n * import '@oneblink/apps-react/dist/styles.css'\n *\n * const captchaSiteKey = 'ENTER_YOUR_SITE_KEY_HERE'\n * const googleMapsApiKey = 'ENTER_YOUR_MAPS_API_KEY_HERE'\n * const formsAppId = 1\n * const form: FormTypes.Form = {\n * id: 1,\n * name: 'Name of Form',\n * description: '',\n * organisationId: 'abc123',\n * formsAppEnvironmentId: 1,\n * formsAppIds: [],\n * elements: [],\n * isAuthenticated: false,\n * isMultiPage: false,\n * isInfoPage: false,\n * publishStartDate: null,\n * publishEndDate: null,\n * postSubmissionAction: 'FORMS_LIBRARY',\n * submissionEvents: [],\n * tags: [],\n * }\n *\n * function FormContainer() {\n * const isMounted = useIsMounted()\n *\n * const [{ isSavingDraft, saveDraftError }, setSaveDraftState] =\n * React.useState({\n * isSavingDraft: false,\n * saveDraftError: null,\n * })\n *\n * const [\n * { isSubmitting, submitError, formSubmissionResult },\n * setSubmitState,\n * ] = React.useState({\n * formSubmissionResult: null,\n * isSubmitting: false,\n * submitError: null,\n * })\n *\n * const handleSubmit = React.useCallback(\n * async (newFormSubmission: FormTypes.NewFormSubmission) => {\n * const formSubmission: FormSubmission = Object.assign(\n * {},\n * newFormSubmission,\n * {\n * formsAppId,\n * jobId: null,\n * externalId: null,\n * draftId: null,\n * preFillFormDataId: null,\n * },\n * )\n *\n * setSubmitState({\n * formSubmissionResult: null,\n * submitError: null,\n * isSubmitting: true,\n * })\n *\n * try {\n * const newFormSubmissionResult = await submissionService.submit({\n * formSubmission,\n * })\n * if (\n * newFormSubmissionResult.isOffline &&\n * !newFormSubmissionResult.isInPendingQueue\n * ) {\n * throw new OneBlinkAppsError(\n * 'You cannot submit this form while offline, please try again when connectivity is restored.',\n * {\n * isOffline: true,\n * },\n * )\n * }\n *\n * if (isMounted.current) {\n * setSubmitState({\n * formSubmissionResult: newFormSubmissionResult,\n * isSubmitting: false,\n * submitError: null,\n * })\n * }\n * } catch (error) {\n * if (isMounted.current) {\n * setSubmitState({\n * formSubmissionResult: null,\n * isSubmitting: false,\n * submitError: error,\n * })\n * }\n * }\n * },\n * [isMounted],\n * )\n *\n * const handleSaveDraft = React.useCallback(\n * async (newDraftSubmission: FormTypes.NewDraftSubmission) => {\n * const draftSubmission: FormTypes.DraftSubmission = {\n * ...newDraftSubmission,\n * formsAppId,\n * }\n * setSaveDraftState({\n * saveDraftError: null,\n * isSavingDraft: true,\n * })\n *\n * try {\n * await draftService.addDraft(\n * {\n * title: form.name,\n * formId: form.id,\n * externalId: null,\n * jobId: null,\n * },\n * draftSubmission,\n * )\n *\n * if (isMounted.current) {\n * setSaveDraftState({\n * saveDraftError: null,\n * isSavingDraft: false,\n * })\n * }\n * } catch (error) {\n * if (isMounted.current) {\n * setSaveDraftState({\n * saveDraftError: error,\n * isSavingDraft: false,\n * })\n * }\n * }\n * },\n * [isMounted],\n * )\n *\n * const handleCancel = React.useCallback(() => {\n * // handle cancel here...\n * }, [isMounted])\n *\n * if (isSubmitting) {\n * // Render submitting animation/loading\n * }\n *\n * if (submitError) {\n * // Render error while submitting\n * }\n *\n * if (isSavingDraft) {\n * // Render saving draft animation/loading\n * }\n *\n * if (saveDraftError) {\n * // Render error while saving draft\n * }\n *\n * if (formSubmissionResult) {\n * // Render submission success\n * }\n *\n * return (\n * <OneBlinkForm\n * captchaSiteKey={captchaSiteKey}\n * googleMapsApiKey={googleMapsApiKey}\n * formsAppId={formsAppId}\n * form={form}\n * onCancel={handleCancel}\n * onSubmit={handleSubmit}\n * onSaveDraft={handleSaveDraft}\n * attachmentRetentionInDays={1}\n * />\n * )\n * }\n *\n * function App() {\n * return (\n * <IsOfflineContextProvider>\n * <FormContainer />\n * </IsOfflineContextProvider>\n * )\n * }\n *\n * const root = document.getElementById('root')\n * if (root) {\n * ReactDOM.render(<App />, root)\n * }\n * ```\n *\n * @param props\n * @returns\n * @group Components\n */\nconst OneBlinkFormUncontrolled = React.memo(function OneBlinkFormUncontrolled({\n form,\n initialSubmission,\n resumeAtElement,\n resumeSectionState,\n resumePreviousElapsedDurationSeconds,\n ...props\n}: OneBlinkFormBaseProps &\n OneBlinkFormUncontrolledProps & {\n /** The element to resume the form at. */\n resumeAtElement?: FormTypes.FormElement\n resumeSectionState?: SectionState\n resumePreviousElapsedDurationSeconds?: number\n }) {\n const [getCurrentSubmissionDuration] = useFormSubmissionDuration(\n resumePreviousElapsedDurationSeconds,\n )\n const [\n {\n definition,\n submission,\n lastElementUpdated,\n executedLookups,\n sectionState,\n },\n setFormSubmission,\n ] = useFormSubmissionState(\n form,\n initialSubmission,\n resumeAtElement,\n resumeSectionState,\n )\n return (\n <OneBlinkFormBase\n {...props}\n isReadOnly={false}\n definition={definition}\n submission={submission}\n setFormSubmission={setFormSubmission}\n lastElementUpdated={lastElementUpdated}\n executedLookups={executedLookups}\n sectionState={sectionState}\n getCurrentSubmissionDuration={getCurrentSubmissionDuration}\n />\n )\n})\n\nexport { OneBlinkFormControlled, OneBlinkFormUncontrolled }\n"]}
|
|
1
|
+
{"version":3,"file":"OneBlinkForm.js","sourceRoot":"","sources":["../src/OneBlinkForm.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,gBAIN,MAAM,oBAAoB,CAAA;AAC3B,OAAO,sBAAsB,MAAM,gCAAgC,CAAA;AACnE,OAAO,yBAAyB,MAAM,mCAAmC,CAAA;AAKzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoUG;AACH,MAAM,sBAAsB,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,sBAAsB,CACvE,KAA0D;IAE1D,OAAO,KAAC,gBAAgB,OAAK,KAAK,EAAE,UAAU,EAAE,KAAK,GAAI,CAAA;AAC3D,CAAC,CAAC,CAAA;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4NG;AACH,MAAM,wBAAwB,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,wBAAwB,CAAC,EAC5E,IAAI,EACJ,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,oCAAoC,EACpC,GAAG,KAAK,EAOP;IACD,MAAM,CAAC,4BAA4B,CAAC,GAAG,yBAAyB,CAC9D,oCAAoC,CACrC,CAAA;IACD,MAAM,CACJ,EACE,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,YAAY,GACb,EACD,iBAAiB,EAClB,GAAG,sBAAsB,CACxB,IAAI,EACJ,iBAAiB,EACjB,eAAe,EACf,kBAAkB,CACnB,CAAA;IACD,OAAO,CACL,KAAC,gBAAgB,OACX,KAAK,EACT,UAAU,EAAE,KAAK,EACjB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,iBAAiB,EAAE,iBAAiB,EACpC,kBAAkB,EAAE,kBAAkB,EACtC,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,EAC1B,4BAA4B,EAAE,4BAA4B,GAC1D,CACH,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,CAAA","sourcesContent":["import * as React from 'react'\nimport { FormTypes } from '@oneblink/types'\nimport OneBlinkFormBase, {\n OneBlinkFormBaseProps,\n OneBlinkFormControlledProps,\n OneBlinkFormUncontrolledProps,\n} from './OneBlinkFormBase'\nimport useFormSubmissionState from './hooks/useFormSubmissionState'\nimport useFormSubmissionDuration from './hooks/useFormSubmissionDuration'\nimport { SectionState } from './types/form'\n\nexport { OneBlinkFormBaseProps, OneBlinkFormControlledProps }\n\n/**\n * Similar to {@link OneBlinkForm}, however requires props to control the\n * `definition` and `submission` values.\n *\n * #### Example\n *\n * ```tsx\n * import React from 'react'\n * import ReactDOM from 'react-dom'\n * import { FormTypes } from '@oneblink/types'\n * import {\n * OneBlinkAppsError,\n * draftService,\n * submissionService,\n * } from '@oneblink/apps'\n * import {\n * IsOfflineContextProvider,\n * OneBlinkFormControlled,\n * useIsMounted,\n * useFormSubmissionState,\n * } from '@oneblink/apps-react'\n * import '@oneblink/apps-react/dist/styles.css'\n *\n * const captchaSiteKey = 'ENTER_YOUR_SITE_KEY_HERE'\n * const googleMapsApiKey = 'ENTER_YOUR_MAPS_API_KEY_HERE'\n * const formsAppId = 1\n * const form: FormTypes.Form = {\n * id: 1,\n * name: 'Name of Form',\n * description: '',\n * organisationId: 'abc123',\n * formsAppEnvironmentId: 1,\n * formsAppIds: [],\n * elements: [],\n * isAuthenticated: false,\n * isMultiPage: false,\n * isInfoPage: false,\n * publishStartDate: null,\n * publishEndDate: null,\n * postSubmissionAction: 'FORMS_LIBRARY',\n * submissionEvents: [],\n * tags: [],\n * }\n * const initialSubmission: Record<string, unknown> = {\n * data: 1,\n * }\n *\n * function FormContainer() {\n * const isMounted = useIsMounted()\n *\n * const [{ definition, submission }, setFormSubmission] =\n * useFormSubmissionState(form, initialSubmission)\n *\n * const [{ isSavingDraft, saveDraftError }, setSaveDraftState] =\n * React.useState({\n * isSavingDraft: false,\n * saveDraftError: null,\n * })\n *\n * const [\n * { isSubmitting, submitError, formSubmissionResult },\n * setSubmitState,\n * ] = React.useState({\n * formSubmissionResult: null,\n * isSubmitting: false,\n * submitError: null,\n * })\n *\n * const handleSubmit = React.useCallback(\n * async (newFormSubmission: FormTypes.NewFormSubmission) => {\n * const formSubmission: FormSubmission = Object.assign(\n * {},\n * newFormSubmission,\n * {\n * formsAppId,\n * jobId: null,\n * externalId: null,\n * draftId: null,\n * preFillFormDataId: null,\n * },\n * )\n *\n * setSubmitState({\n * formSubmissionResult: null,\n * submitError: null,\n * isSubmitting: true,\n * })\n *\n * try {\n * const newFormSubmissionResult = await submissionService.submit({\n * formSubmission,\n * })\n * if (\n * newFormSubmissionResult.isOffline &&\n * !newFormSubmissionResult.isInPendingQueue\n * ) {\n * throw new OneBlinkAppsError(\n * 'You cannot submit this form while offline, please try again when connectivity is restored.',\n * {\n * isOffline: true,\n * },\n * )\n * }\n *\n * if (isMounted.current) {\n * setSubmitState({\n * formSubmissionResult: newFormSubmissionResult,\n * isSubmitting: false,\n * submitError: null,\n * })\n * }\n * } catch (error) {\n * if (isMounted.current) {\n * setSubmitState({\n * formSubmissionResult: null,\n * isSubmitting: false,\n * submitError: error,\n * })\n * }\n * }\n * },\n * [isMounted],\n * )\n *\n * const handleSaveDraft = React.useCallback(\n * async (newDraftSubmission: FormTypes.NewDraftSubmission) => {\n * const draftSubmission: FormTypes.DraftSubmission = {\n * ...newDraftSubmission,\n * formsAppId,\n * }\n * setSaveDraftState({\n * saveDraftError: null,\n * isSavingDraft: true,\n * })\n *\n * try {\n * await draftService.addDraft(\n * {\n * title: form.name,\n * formId: form.id,\n * externalId: null,\n * jobId: null,\n * },\n * draftSubmission,\n * )\n *\n * if (isMounted.current) {\n * setSaveDraftState({\n * saveDraftError: null,\n * isSavingDraft: false,\n * })\n * }\n * } catch (error) {\n * if (isMounted.current) {\n * setSaveDraftState({\n * saveDraftError: error,\n * isSavingDraft: false,\n * })\n * }\n * }\n * },\n * [isMounted],\n * )\n *\n * const handleCancel = React.useCallback(() => {\n * // handle cancel here...\n * }, [])\n *\n * if (isSubmitting) {\n * // Render submitting animation/loading\n * }\n *\n * if (submitError) {\n * // Render error while submitting\n * }\n *\n * if (isSavingDraft) {\n * // Render saving draft animation/loading\n * }\n *\n * if (saveDraftError) {\n * // Render error while saving draft\n * }\n *\n * if (formSubmissionResult) {\n * // Render submission success\n * }\n *\n * return (\n * <OneBlinkFormControlled\n * captchaSiteKey={captchaSiteKey}\n * googleMapsApiKey={googleMapsApiKey}\n * formsAppId={formsAppId}\n * definition={definition}\n * submission={submission}\n * setFormSubmission={setFormSubmission}\n * onCancel={handleCancel}\n * onSubmit={handleSubmit}\n * onSaveDraft={handleSaveDraft}\n * />\n * )\n * }\n *\n * function App() {\n * return (\n * <IsOfflineContextProvider>\n * <FormContainer />\n * </IsOfflineContextProvider>\n * )\n * }\n *\n * const root = document.getElementById('root')\n * if (root) {\n * ReactDOM.render(<App />, root)\n * }\n * ```\n *\n * #### Implementing Controlled Auto Save\n *\n * The {@link OneBlinkAutoSaveForm} component does not offer props to allow for a\n * controlled form (i.e. having access to `submission` and `definition` values).\n * To implement a controlled version of the `<OneBlinkAutoSaveForm />`\n * component, use the example component below.\n *\n * ```tsx\n * import * as React from 'react'\n * import {\n * OneBlinkAutoSaveForm,\n * OneBlinkFormControlled,\n * useFormSubmissionAutoSaveState,\n * } from '@oneblink/apps-react'\n *\n * function OneBlinkAutoSaveFormControlled({\n * form,\n * initialSubmission,\n * autoSaveKey,\n * onCancel,\n * onSubmit,\n * onSaveDraft,\n * ...props\n * }: React.ComponentProps<typeof OneBlinkAutoSaveForm>) {\n * const {\n * definition,\n * submission,\n * isLoadingAutoSaveSubmission,\n * isAutoSaveSubmissionAvailable,\n * startNewSubmission,\n * continueAutoSaveSubmission,\n * handleSubmit,\n * handleCancel,\n * handleSaveDraft,\n * setFormSubmission,\n * } = useFormSubmissionAutoSaveState({\n * form,\n * initialSubmission,\n * autoSaveKey,\n * onCancel,\n * onSubmit,\n * onSaveDraft,\n * })\n *\n * // This is just an example of how you could intercept\n * // the change event when a user enters/selects a value\n * // on the form.\n * const customSetFormSubmission = React.useCallback(\n * (formSubmission) => {\n * setFormSubmission((currentFormSubmission) => {\n * const newFormSubmission =\n * typeof formSubmission === 'function'\n * ? formSubmission(currentFormSubmission)\n * : formSubmission\n *\n * // This is where you can access the updated\n * // submission data or form definition.\n * // You could even change the form definition\n * // programmatically based on user inputs.\n * console.log(\n * 'A change has occurred to the submission',\n * newFormSubmission.submission,\n * )\n * newFormSubmission.definition.isInfoPage =\n * !newFormSubmission.submission.doesTheUserNeedToSubmit\n *\n * return newFormSubmission\n * })\n * },\n * [setFormSubmission],\n * )\n *\n * if (isLoadingAutoSaveSubmission) {\n * return <p>Checking for auto save data...</p>\n * }\n *\n * if (isAutoSaveSubmissionAvailable) {\n * return (\n * <>\n * <p>Do you want to use the auto save data?</p>\n * <button onClick={startNewSubmission}>No, start again</button>\n * <button onClick={continueAutoSaveSubmission}>\n * Yes, continue\n * </button>\n * </>\n * )\n * }\n *\n * return (\n * <OneBlinkFormControlled\n * {...props}\n * submission={submission}\n * definition={definition}\n * onCancel={handleCancel}\n * onSubmit={handleSubmit}\n * onSaveDraft={handleSaveDraft}\n * setFormSubmission={customSetFormSubmission}\n * />\n * )\n * }\n *\n * export default React.memo(OneBlinkAutoSaveFormControlled)\n * ```\n *\n * @param props\n * @returns\n * @group Components\n */\nconst OneBlinkFormControlled = React.memo(function OneBlinkFormControlled(\n props: OneBlinkFormBaseProps & OneBlinkFormControlledProps,\n) {\n return <OneBlinkFormBase {...props} isReadOnly={false} />\n})\n\n/**\n * Component for rendering a OneBlink Form. This component will render the\n * submit, cancel and save draft buttons but it is up to the developer to\n * implement what happens when those buttons are clicked.\n *\n * It is also recommended to import the `css` from this library as well.\n *\n * ```js\n * import { OneBlinkForm } from '@oneblink/apps-react'\n * import '@oneblink/apps-react/dist/styles.css'\n * ```\n *\n * #### Example\n *\n * ```tsx\n * import React from 'react'\n * import ReactDOM from 'react-dom'\n * import { FormTypes } from '@oneblink/types'\n * import {\n * OneBlinkAppsError,\n * draftService,\n * submissionService,\n * } from '@oneblink/apps'\n * import {\n * IsOfflineContextProvider,\n * OneBlinkForm,\n * useIsMounted,\n * } from '@oneblink/apps-react'\n * import '@oneblink/apps-react/dist/styles.css'\n *\n * const captchaSiteKey = 'ENTER_YOUR_SITE_KEY_HERE'\n * const googleMapsApiKey = 'ENTER_YOUR_MAPS_API_KEY_HERE'\n * const formsAppId = 1\n * const form: FormTypes.Form = {\n * id: 1,\n * name: 'Name of Form',\n * description: '',\n * organisationId: 'abc123',\n * formsAppEnvironmentId: 1,\n * formsAppIds: [],\n * elements: [],\n * isAuthenticated: false,\n * isMultiPage: false,\n * isInfoPage: false,\n * publishStartDate: null,\n * publishEndDate: null,\n * postSubmissionAction: 'FORMS_LIBRARY',\n * submissionEvents: [],\n * tags: [],\n * }\n *\n * function FormContainer() {\n * const isMounted = useIsMounted()\n *\n * const [{ isSavingDraft, saveDraftError }, setSaveDraftState] =\n * React.useState({\n * isSavingDraft: false,\n * saveDraftError: null,\n * })\n *\n * const [\n * { isSubmitting, submitError, formSubmissionResult },\n * setSubmitState,\n * ] = React.useState({\n * formSubmissionResult: null,\n * isSubmitting: false,\n * submitError: null,\n * })\n *\n * const handleSubmit = React.useCallback(\n * async (newFormSubmission: FormTypes.NewFormSubmission) => {\n * const formSubmission: FormSubmission = Object.assign(\n * {},\n * newFormSubmission,\n * {\n * formsAppId,\n * jobId: null,\n * externalId: null,\n * draftId: null,\n * preFillFormDataId: null,\n * },\n * )\n *\n * setSubmitState({\n * formSubmissionResult: null,\n * submitError: null,\n * isSubmitting: true,\n * })\n *\n * try {\n * const newFormSubmissionResult = await submissionService.submit({\n * formSubmission,\n * })\n * if (\n * newFormSubmissionResult.isOffline &&\n * !newFormSubmissionResult.isInPendingQueue\n * ) {\n * throw new OneBlinkAppsError(\n * 'You cannot submit this form while offline, please try again when connectivity is restored.',\n * {\n * isOffline: true,\n * },\n * )\n * }\n *\n * if (isMounted.current) {\n * setSubmitState({\n * formSubmissionResult: newFormSubmissionResult,\n * isSubmitting: false,\n * submitError: null,\n * })\n * }\n * } catch (error) {\n * if (isMounted.current) {\n * setSubmitState({\n * formSubmissionResult: null,\n * isSubmitting: false,\n * submitError: error,\n * })\n * }\n * }\n * },\n * [isMounted],\n * )\n *\n * const handleSaveDraft = React.useCallback(\n * async (newDraftSubmission: FormTypes.NewDraftSubmission) => {\n * const draftSubmission: FormTypes.DraftSubmission = {\n * ...newDraftSubmission,\n * formsAppId,\n * }\n * setSaveDraftState({\n * saveDraftError: null,\n * isSavingDraft: true,\n * })\n *\n * try {\n * await draftService.addDraft(\n * {\n * title: form.name,\n * formId: form.id,\n * externalId: null,\n * jobId: null,\n * },\n * draftSubmission,\n * )\n *\n * if (isMounted.current) {\n * setSaveDraftState({\n * saveDraftError: null,\n * isSavingDraft: false,\n * })\n * }\n * } catch (error) {\n * if (isMounted.current) {\n * setSaveDraftState({\n * saveDraftError: error,\n * isSavingDraft: false,\n * })\n * }\n * }\n * },\n * [isMounted],\n * )\n *\n * const handleCancel = React.useCallback(() => {\n * // handle cancel here...\n * }, [isMounted])\n *\n * if (isSubmitting) {\n * // Render submitting animation/loading\n * }\n *\n * if (submitError) {\n * // Render error while submitting\n * }\n *\n * if (isSavingDraft) {\n * // Render saving draft animation/loading\n * }\n *\n * if (saveDraftError) {\n * // Render error while saving draft\n * }\n *\n * if (formSubmissionResult) {\n * // Render submission success\n * }\n *\n * return (\n * <OneBlinkForm\n * captchaSiteKey={captchaSiteKey}\n * googleMapsApiKey={googleMapsApiKey}\n * formsAppId={formsAppId}\n * form={form}\n * onCancel={handleCancel}\n * onSubmit={handleSubmit}\n * onSaveDraft={handleSaveDraft}\n * attachmentRetentionInDays={1}\n * />\n * )\n * }\n *\n * function App() {\n * return (\n * <IsOfflineContextProvider>\n * <FormContainer />\n * </IsOfflineContextProvider>\n * )\n * }\n *\n * const root = document.getElementById('root')\n * if (root) {\n * ReactDOM.render(<App />, root)\n * }\n * ```\n *\n * @param props\n * @returns\n * @group Components\n */\nconst OneBlinkFormUncontrolled = React.memo(function OneBlinkFormUncontrolled({\n form,\n initialSubmission,\n resumeAtElement,\n resumeSectionState,\n resumePreviousElapsedDurationSeconds,\n ...props\n}: OneBlinkFormBaseProps &\n OneBlinkFormUncontrolledProps & {\n /** The element to resume the form at. */\n resumeAtElement?: FormTypes.FormElement\n resumeSectionState?: SectionState\n resumePreviousElapsedDurationSeconds?: number\n }) {\n const [getCurrentSubmissionDuration] = useFormSubmissionDuration(\n resumePreviousElapsedDurationSeconds,\n )\n const [\n {\n definition,\n submission,\n lastElementUpdated,\n executedLookups,\n sectionState,\n },\n setFormSubmission,\n ] = useFormSubmissionState(\n form,\n initialSubmission,\n resumeAtElement,\n resumeSectionState,\n )\n return (\n <OneBlinkFormBase\n {...props}\n isReadOnly={false}\n definition={definition}\n submission={submission}\n setFormSubmission={setFormSubmission}\n lastElementUpdated={lastElementUpdated}\n executedLookups={executedLookups}\n sectionState={sectionState}\n getCurrentSubmissionDuration={getCurrentSubmissionDuration}\n />\n )\n})\n\nexport { OneBlinkFormControlled, OneBlinkFormUncontrolled }\n"]}
|
|
@@ -155,6 +155,6 @@ export type OneBlinkFormControlledProps = {
|
|
|
155
155
|
type Props = OneBlinkFormBaseProps & OneBlinkFormControlledProps & {
|
|
156
156
|
isReadOnly: boolean;
|
|
157
157
|
};
|
|
158
|
-
declare function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captchaSiteKey, definition, disabled, isPreview, submission, isReadOnly, onCancel, onSubmit, onSaveDraft, setFormSubmission, buttons, validationIcon, primaryColour, attachmentRetentionInDays, isPendingQueueEnabled, handleNavigateAway, isInfoPage: isInfoPageProp, lastElementUpdated, executedLookups, task, taskGroup, taskGroupInstance, onUploadAttachment, captchaType, shouldUseNavigableValidationErrorsNotification, navigableValidationErrorsNotificationSettings, replaceInjectablesOverrides, sectionState, scrollToTopOfPage, getCurrentSubmissionDuration, onBeforeUnload, }: Props):
|
|
158
|
+
declare function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captchaSiteKey, definition, disabled, isPreview, submission, isReadOnly, onCancel, onSubmit, onSaveDraft, setFormSubmission, buttons, validationIcon, primaryColour, attachmentRetentionInDays, isPendingQueueEnabled, handleNavigateAway, isInfoPage: isInfoPageProp, lastElementUpdated, executedLookups, task, taskGroup, taskGroupInstance, onUploadAttachment, captchaType, shouldUseNavigableValidationErrorsNotification, navigableValidationErrorsNotificationSettings, replaceInjectablesOverrides, sectionState, scrollToTopOfPage, getCurrentSubmissionDuration, onBeforeUnload, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
159
159
|
declare const _default: React.MemoExoticComponent<typeof OneBlinkFormBase>;
|
|
160
160
|
export default _default;
|
package/dist/OneBlinkFormBase.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { createTheme as createMuiTheme, ThemeProvider } from '@mui/material';
|
|
3
4
|
import Tooltip from './components/renderer/Tooltip';
|
|
@@ -6,7 +7,7 @@ import clsx from 'clsx';
|
|
|
6
7
|
import * as bulmaToast from 'bulma-toast';
|
|
7
8
|
import { localisationService, attachmentsService, } from '@oneblink/apps';
|
|
8
9
|
import { LocalizationProvider } from '@mui/x-date-pickers';
|
|
9
|
-
import { AdapterDateFns } from '@mui/x-date-pickers/
|
|
10
|
+
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV2';
|
|
10
11
|
import Modal from './components/renderer/Modal';
|
|
11
12
|
import cleanFormSubmissionModel from './services/cleanFormSubmissionModel';
|
|
12
13
|
import PageFormElements from './components/renderer/PageFormElements';
|
|
@@ -729,153 +730,55 @@ function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captc
|
|
|
729
730
|
setFormSubmission,
|
|
730
731
|
]);
|
|
731
732
|
if (conditionalLogicError) {
|
|
732
|
-
return (
|
|
733
|
-
React.createElement("div", { className: "has-text-centered" },
|
|
734
|
-
React.createElement(MaterialIcon, { className: "has-text-warning icon-x-large" }, "error"),
|
|
735
|
-
React.createElement("h3", { className: "title is-3" }, "Bad Form Configuration"),
|
|
736
|
-
React.createElement("p", { className: "cypress-conditional-logic-error-message" }, conditionalLogicError.message),
|
|
737
|
-
React.createElement("p", { className: "has-text-grey" }, localisationService.formatDatetimeLong(new Date())))));
|
|
733
|
+
return (_jsx(_Fragment, { children: _jsxs("div", { className: "has-text-centered", children: [_jsx(MaterialIcon, { className: "has-text-warning icon-x-large", children: "error" }), _jsx("h3", { className: "title is-3", children: "Bad Form Configuration" }), _jsx("p", { className: "cypress-conditional-logic-error-message", children: conditionalLogicError.message }), _jsx("p", { className: "has-text-grey", children: localisationService.formatDatetimeLong(new Date()) })] }) }));
|
|
738
734
|
}
|
|
739
|
-
return (
|
|
740
|
-
React.createElement(LocalizationProvider, { dateAdapter: AdapterDateFns },
|
|
741
|
-
React.createElement(ReplaceInjectablesOverridesContext.Provider, { value: replaceInjectablesOverrides },
|
|
742
|
-
React.createElement(FormDefinitionContext.Provider, { value: definition },
|
|
743
|
-
React.createElement(FormElementOptionsContextProvider, { formIsReadOnly: isReadOnly },
|
|
744
|
-
React.createElement(FormElementLookupsContextProvider, null,
|
|
745
|
-
React.createElement(OneBlinkFormContainerContext.Provider, { value: obFormContainerHTMLElementRef.current },
|
|
746
|
-
React.createElement("div", { className: clsx('ob-form-container', {
|
|
735
|
+
return (_jsx(ThemeProvider, { theme: theme, children: _jsx(LocalizationProvider, { dateAdapter: AdapterDateFns, children: _jsx(ReplaceInjectablesOverridesContext.Provider, { value: replaceInjectablesOverrides, children: _jsx(FormDefinitionContext.Provider, { value: definition, children: _jsx(FormElementOptionsContextProvider, { formIsReadOnly: isReadOnly, children: _jsx(FormElementLookupsContextProvider, { children: _jsx(OneBlinkFormContainerContext.Provider, { value: obFormContainerHTMLElementRef.current, children: _jsxs("div", { className: clsx('ob-form-container', {
|
|
747
736
|
'is-showing-pages': isShowingMultiplePages,
|
|
748
|
-
}), ref: obFormContainerHTMLElementRef },
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
React.createElement("div", { className: clsx('steps-content', {
|
|
794
|
-
'is-single-step': !isShowingMultiplePages,
|
|
795
|
-
}) },
|
|
796
|
-
React.createElement(InjectPagesContext.Provider, { value: handlePagesLookupResult },
|
|
797
|
-
React.createElement(GoogleMapsApiKeyContext.Provider, { value: googleMapsApiKey },
|
|
798
|
-
React.createElement(AbnLookupAuthenticationGuidContext.Provider, { value: abnLookupAuthenticationGuid },
|
|
799
|
-
React.createElement(ValidationIconConfigurationContext.Provider, { value: validationIcon },
|
|
800
|
-
React.createElement(CaptchaContext.Provider, { value: captchaContextValue },
|
|
801
|
-
React.createElement(AttachmentBlobsProvider, null,
|
|
802
|
-
React.createElement(FormIsReadOnlyContext.Provider, { value: isReadOnly },
|
|
803
|
-
React.createElement(TaskContext.Provider, { value: taskContextValue },
|
|
804
|
-
React.createElement(OnUploadAttachmentContext.Provider, { value: onUploadAttachment }, visiblePages.map((pageElement) => (React.createElement(PageFormElements, { key: pageElement.id, isActive: pageElement.id ===
|
|
805
|
-
currentPage.id, formId: definition.id, formElementsConditionallyShown: formElementsConditionallyShown, formElementsValidation: formElementsValidation, displayValidationMessages: hasAttemptedSubmit ||
|
|
806
|
-
isDisplayingCurrentPageError, pageElement: pageElement, onChange: handleChange, model: submission, setFormSubmission: setFormSubmission, sectionState: sectionState }))))))))))))),
|
|
807
|
-
isShowingMultiplePages && (React.createElement("div", { className: "steps-actions" },
|
|
808
|
-
React.createElement("div", { className: "steps-action" },
|
|
809
|
-
React.createElement("button", { type: "button", onClick: goToPreviousPage, disabled: isFirstVisiblePage, className: "button is-light cypress-pages-previous" },
|
|
810
|
-
React.createElement("span", { className: "icon" },
|
|
811
|
-
React.createElement(MaterialIcon, null, "keyboard_arrow_left")),
|
|
812
|
-
React.createElement("span", null, "Back"))),
|
|
813
|
-
React.createElement("div", { className: "step-progress-mobile cypress-steps-mobile" }, visiblePages.map((page, index) => (React.createElement("div", { key: page.id, className: clsx('step-progress-mobile-dot', {
|
|
814
|
-
'is-active': currentPage.id === page.id,
|
|
815
|
-
'is-completed': currentPageIndex > index,
|
|
816
|
-
'has-background-danger': currentPage.id !== page.id &&
|
|
817
|
-
checkDisplayPageError(page),
|
|
818
|
-
}) })))),
|
|
819
|
-
React.createElement("div", { className: "steps-action" },
|
|
820
|
-
React.createElement("button", { type: "button", onClick: goToNextPage, disabled: isLastVisiblePage, className: "button is-light cypress-pages-next" },
|
|
821
|
-
React.createElement("span", null, "Next"),
|
|
822
|
-
React.createElement("span", { className: "icon" },
|
|
823
|
-
React.createElement(MaterialIcon, null, "keyboard_arrow_right"))))))),
|
|
824
|
-
!isReadOnly && (React.createElement("div", { className: "buttons ob-buttons ob-buttons-submit" },
|
|
825
|
-
onSaveDraft && !isInfoPage && (React.createElement("button", { type: "button", className: "button ob-button is-primary ob-button-save-draft cypress-save-draft-form", onClick: () => handleSaveDraft(false), disabled: isPreview || disabled },
|
|
826
|
-
React.createElement(CustomisableButtonInner, { label: ((_a = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _a === void 0 ? void 0 : _a.label) || 'Save Draft', icon: (_b = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _b === void 0 ? void 0 : _b.icon }))),
|
|
827
|
-
React.createElement("span", { className: "ob-buttons-submit__spacer" }),
|
|
828
|
-
!isInfoPage && (React.createElement("button", { type: "button", className: "button ob-button is-light ob-button-submit-cancel cypress-cancel-form", onClick: handleCancel, disabled: isPreview || disabled },
|
|
829
|
-
React.createElement(CustomisableButtonInner, { label: ((_c = buttons === null || buttons === void 0 ? void 0 : buttons.cancel) === null || _c === void 0 ? void 0 : _c.label) || 'Cancel', icon: (_d = buttons === null || buttons === void 0 ? void 0 : buttons.cancel) === null || _d === void 0 ? void 0 : _d.icon }))),
|
|
830
|
-
isLastVisiblePage && (React.createElement(Tooltip, { title: submissionConditionallyEnabled
|
|
831
|
-
? ''
|
|
832
|
-
: 'Submission disabled: Your inputs have not met the criteria for submission' },
|
|
833
|
-
React.createElement("button", { type: "submit", className: clsx('button ob-button is-success ob-button-submit cypress-submit-form-button cypress-submit-form', { 'is-loading': isPreparingToSubmit }, {
|
|
834
|
-
'ob-button-submit-is-disabled': submissionConditionallyEnabled,
|
|
835
|
-
}), disabled: isPreview ||
|
|
836
|
-
disabled ||
|
|
837
|
-
isPreparingToSubmit ||
|
|
838
|
-
!submissionConditionallyEnabled },
|
|
839
|
-
React.createElement(CustomisableButtonInner, { label: isInfoPage
|
|
840
|
-
? 'Done'
|
|
841
|
-
: ((_e = buttons === null || buttons === void 0 ? void 0 : buttons.submit) === null || _e === void 0 ? void 0 : _e.label) || 'Submit', icon: (_f = buttons === null || buttons === void 0 ? void 0 : buttons.submit) === null || _f === void 0 ? void 0 : _f.icon })))))))),
|
|
842
|
-
!isReadOnly && !isPreview && (React.createElement(React.Fragment, null,
|
|
843
|
-
React.createElement(Prompt, { when: isDirty && !isNavigationAllowed, message: handleBlockedNavigation }),
|
|
844
|
-
React.createElement(Modal, { isOpen: hasConfirmedNavigation === false, title: "Unsaved Changes", cardClassName: "cypress-cancel-confirm", titleClassName: "cypress-cancel-confirm-title", bodyClassName: "cypress-cancel-confirm-body", actions: React.createElement(React.Fragment, null,
|
|
845
|
-
onSaveDraft && (React.createElement("button", { type: "button", className: "button ob-button is-success cypress-cancel-confirm-save-draft", onClick: () => handleSaveDraft(false) },
|
|
846
|
-
React.createElement(CustomisableButtonInner, { label: ((_g = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _g === void 0 ? void 0 : _g.label) || 'Save Draft', icon: (_h = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _h === void 0 ? void 0 : _h.icon }))),
|
|
847
|
-
React.createElement("span", { style: { flex: 1 } }),
|
|
848
|
-
React.createElement("button", { type: "button", className: "button ob-button is-light cypress-cancel-confirm-back", onClick: handleKeepGoing },
|
|
849
|
-
React.createElement(CustomisableButtonInner, { label: ((_j = buttons === null || buttons === void 0 ? void 0 : buttons.cancelPromptNo) === null || _j === void 0 ? void 0 : _j.label) || 'Back', icon: (_k = buttons === null || buttons === void 0 ? void 0 : buttons.cancelPromptNo) === null || _k === void 0 ? void 0 : _k.icon })),
|
|
850
|
-
React.createElement("button", { type: "button", className: "button ob-button is-primary cypress-cancel-confirm-discard", onClick: handleDiscardUnsavedChanges, autoFocus: true },
|
|
851
|
-
React.createElement(CustomisableButtonInner, { label: ((_l = buttons === null || buttons === void 0 ? void 0 : buttons.cancelPromptYes) === null || _l === void 0 ? void 0 : _l.label) || 'Discard', icon: (_m = buttons === null || buttons === void 0 ? void 0 : buttons.cancelPromptYes) === null || _m === void 0 ? void 0 : _m.icon }))) },
|
|
852
|
-
React.createElement("p", null, "You have unsaved changes, are you sure you want discard them?")),
|
|
853
|
-
React.createElement(Modal, { isOpen: promptUploadingAttachments === true, title: "Attachment upload in progress", cardClassName: "cypress-attachments-wait-continue", titleClassName: "cypress-attachments-confirm-wait-title", bodyClassName: "cypress-attachments-confirm-wait-body", actions: React.createElement(React.Fragment, null,
|
|
854
|
-
React.createElement("span", { style: { flex: 1 } }),
|
|
855
|
-
React.createElement("button", { type: "button", className: "button ob-button is-light cypress-attachments-confirm-wait", onClick: handleWaitForAttachments }, "Wait"),
|
|
856
|
-
React.createElement("button", { type: "button", className: "button ob-button is-primary cypress-attachments-confirm-continue", onClick: handleContinueWithAttachments, autoFocus: true }, "Continue")) },
|
|
857
|
-
React.createElement("p", null, "Your attachments are still uploading, do you want to wait for the uploads to complete or continue using the app? If you click continue the attachments will upload in the background. Do not close the app until the upload has been completed.")),
|
|
858
|
-
React.createElement(Modal, { isOpen: promptOfflineSubmissionAttempt, title: "It looks like you're Offline", className: "ob-modal__offline-submission-attempt", cardClassName: "cypress-submission-offline has-text-centered", titleClassName: "cypress-offline-title", bodyClassName: "cypress-offline-body", actions: React.createElement(React.Fragment, null,
|
|
859
|
-
onSaveDraft && (React.createElement("button", { type: "button", className: "button ob-button ob-button__offline-submission-attempt-save-draft is-success", onClick: () => handleSaveDraft(false) },
|
|
860
|
-
React.createElement(CustomisableButtonInner, { label: ((_o = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _o === void 0 ? void 0 : _o.label) || 'Save Draft', icon: (_p = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _p === void 0 ? void 0 : _p.icon }))),
|
|
861
|
-
React.createElement("span", { style: { flex: 1 } }),
|
|
862
|
-
React.createElement("button", { className: "button ob-button ob-button__offline-submission-attempt-cancel is-light", onClick: () => setPromptOfflineSubmissionAttempt(false) }, "Cancel"),
|
|
863
|
-
React.createElement("button", { className: "button ob-button ob-button__offline-submission-attempt-try-again is-primary", onClick: (e) => {
|
|
864
|
-
setPromptOfflineSubmissionAttempt(false);
|
|
865
|
-
handleSubmit(e, false);
|
|
866
|
-
}, autoFocus: true }, "Try Again")) },
|
|
867
|
-
React.createElement("p", { className: "ob-modal__offline-submission-attempt-message" },
|
|
868
|
-
"You cannot submit this form while offline, please try again when connectivity is restored.",
|
|
869
|
-
onSaveDraft && (React.createElement("span", { className: "ob-modal__offline-submission-attempt-save-draft-message" },
|
|
870
|
-
' ',
|
|
871
|
-
"Alternatively, click the",
|
|
872
|
-
' ',
|
|
873
|
-
React.createElement("b", null, ((_q = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _q === void 0 ? void 0 : _q.label) || 'Save Draft'),
|
|
874
|
-
' ',
|
|
875
|
-
"button below to come back to this later."))),
|
|
876
|
-
React.createElement(MaterialIcon, { className: "has-text-warning icon-x-large ob-modal__offline-submission-attempt-icon" }, "wifi_off")))),
|
|
877
|
-
shouldUseNavigableValidationErrorsNotification &&
|
|
878
|
-
isShowingValidationErrorsCard && (React.createElement(ValidationErrorsCard, { visiblePages: visiblePages, formElementsValidation: formElementsValidation, setPageId: setPageId, currentPage: currentPage, navigationTopOffset: (_r = navigableValidationErrorsNotificationSettings === null || navigableValidationErrorsNotificationSettings === void 0 ? void 0 : navigableValidationErrorsNotificationSettings.navigationTopOffset) !== null && _r !== void 0 ? _r : 'CALCULATE', scrollableContainerId: navigableValidationErrorsNotificationSettings === null || navigableValidationErrorsNotificationSettings === void 0 ? void 0 : navigableValidationErrorsNotificationSettings.scrollableContainerId, validationErrorToastFocusElementRef: validationErrorToastFocusElementRef })))))))))));
|
|
737
|
+
}), ref: obFormContainerHTMLElementRef, children: [_jsx("form", { name: "obForm", className: `ob-form cypress-ob-form ob-form__page-${currentPageIndex + 1}`, noValidate: true, onSubmit: (e) => handleSubmit(e, false), children: _jsxs("div", { children: [_jsx("div", { ref: scrollToTopOfPageHTMLElementRef }), isShowingMultiplePages && (_jsxs("div", { className: clsx('ob-steps-navigation', {
|
|
738
|
+
'is-active': isStepsHeaderActive,
|
|
739
|
+
}), children: [_jsxs(Clickable, { className: clsx('ob-steps-navigation__header', {
|
|
740
|
+
'is-active': isStepsHeaderActive,
|
|
741
|
+
}), onClick: toggleStepsNavigation, children: [_jsx("span", { className: "icon is-invisible", children: _jsx(MaterialIcon, { children: "keyboard_arrow_down" }) }), _jsxs("div", { className: "steps-header-active-page", children: [isDisplayingCurrentPageError ? (_jsx("span", { className: "icon", children: _jsx(MaterialIcon, { className: "has-text-danger is-size-4", children: "warning" }) })) : (_jsx("span", { className: "steps-header-active-page-icon", children: currentPageNumber })), _jsx("span", { className: "steps-header-active-page-label cypress-tablet-step-title", children: currentPage ? currentPage.label : '' })] }), _jsx("span", { className: "dropdown icon", children: _jsx(MaterialIcon, { children: "keyboard_arrow_down" }) })] }), _jsx("div", { role: "navigation", className: clsx('ob-steps-navigation__steps', {
|
|
742
|
+
'is-active': isStepsHeaderActive,
|
|
743
|
+
}), children: _jsx("div", { className: "steps is-small is-horizontal-tablet cypress-steps", children: visiblePages.map((page, index) => {
|
|
744
|
+
const hasErrors = checkDisplayPageError(page);
|
|
745
|
+
return (_jsxs(Clickable, { id: `steps-navigation-step-${page.id}`, className: clsx('step-item cypress-step-item', {
|
|
746
|
+
'is-active': currentPage.id === page.id,
|
|
747
|
+
'is-completed': currentPageIndex > index,
|
|
748
|
+
'is-error': hasErrors,
|
|
749
|
+
}), onClick: (e) => {
|
|
750
|
+
e.stopPropagation();
|
|
751
|
+
if (page.id !== currentPage.id) {
|
|
752
|
+
setPageId(page.id);
|
|
753
|
+
}
|
|
754
|
+
}, children: [_jsx("div", { className: "step-marker step-marker-error ob-step-marker cypress-step-marker",
|
|
755
|
+
// @ts-expect-error ???
|
|
756
|
+
name: `cypress-page-stepper-${index + 1}`, value: index + 1, children: hasErrors ? (_jsx(Tooltip, { title: "Page has errors", children: _jsx("span", { className: "icon tooltip has-tooltip-top cypress-page-error", children: _jsx(MaterialIcon, { className: "has-text-danger is-size-3", children: "warning" }) }) })) : (_jsx("span", { children: index + 1 })) }), _jsx("div", { className: "step-details ob-step-details", children: _jsx("p", { className: "step-title ob-step-title cypress-desktop-step-title", id: `steps-navigation-step-label-${page.id}`, children: page.label }) })] }, page.id));
|
|
757
|
+
}) }) })] })), _jsx("div", { className: clsx('ob-steps-navigation__background', {
|
|
758
|
+
'is-active': isStepsHeaderActive,
|
|
759
|
+
}), onClick: toggleStepsNavigation }), _jsxs("div", { className: "steps", children: [_jsx("div", { className: clsx('steps-content', {
|
|
760
|
+
'is-single-step': !isShowingMultiplePages,
|
|
761
|
+
}), children: _jsx(InjectPagesContext.Provider, { value: handlePagesLookupResult, children: _jsx(GoogleMapsApiKeyContext.Provider, { value: googleMapsApiKey, children: _jsx(AbnLookupAuthenticationGuidContext.Provider, { value: abnLookupAuthenticationGuid, children: _jsx(ValidationIconConfigurationContext.Provider, { value: validationIcon, children: _jsx(CaptchaContext.Provider, { value: captchaContextValue, children: _jsx(AttachmentBlobsProvider, { children: _jsx(FormIsReadOnlyContext.Provider, { value: isReadOnly, children: _jsx(TaskContext.Provider, { value: taskContextValue, children: _jsx(OnUploadAttachmentContext.Provider, { value: onUploadAttachment, children: visiblePages.map((pageElement) => (_jsx(PageFormElements, { isActive: pageElement.id ===
|
|
762
|
+
currentPage.id, formId: definition.id, formElementsConditionallyShown: formElementsConditionallyShown, formElementsValidation: formElementsValidation, displayValidationMessages: hasAttemptedSubmit ||
|
|
763
|
+
isDisplayingCurrentPageError, pageElement: pageElement, onChange: handleChange, model: submission, setFormSubmission: setFormSubmission, sectionState: sectionState }, pageElement.id))) }) }) }) }) }) }) }) }) }) }), isShowingMultiplePages && (_jsxs("div", { className: "steps-actions", children: [_jsx("div", { className: "steps-action", children: _jsxs("button", { type: "button", onClick: goToPreviousPage, disabled: isFirstVisiblePage, className: "button is-light cypress-pages-previous", children: [_jsx("span", { className: "icon", children: _jsx(MaterialIcon, { children: "keyboard_arrow_left" }) }), _jsx("span", { children: "Back" })] }) }), _jsx("div", { className: "step-progress-mobile cypress-steps-mobile", children: visiblePages.map((page, index) => (_jsx("div", { className: clsx('step-progress-mobile-dot', {
|
|
764
|
+
'is-active': currentPage.id === page.id,
|
|
765
|
+
'is-completed': currentPageIndex > index,
|
|
766
|
+
'has-background-danger': currentPage.id !== page.id &&
|
|
767
|
+
checkDisplayPageError(page),
|
|
768
|
+
}) }, page.id))) }), _jsx("div", { className: "steps-action", children: _jsxs("button", { type: "button", onClick: goToNextPage, disabled: isLastVisiblePage, className: "button is-light cypress-pages-next", children: [_jsx("span", { children: "Next" }), _jsx("span", { className: "icon", children: _jsx(MaterialIcon, { children: "keyboard_arrow_right" }) })] }) })] }))] }), !isReadOnly && (_jsxs("div", { className: "buttons ob-buttons ob-buttons-submit", children: [onSaveDraft && !isInfoPage && (_jsx("button", { type: "button", className: "button ob-button is-primary ob-button-save-draft cypress-save-draft-form", onClick: () => handleSaveDraft(false), disabled: isPreview || disabled, children: _jsx(CustomisableButtonInner, { label: ((_a = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _a === void 0 ? void 0 : _a.label) || 'Save Draft', icon: (_b = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _b === void 0 ? void 0 : _b.icon }) })), _jsx("span", { className: "ob-buttons-submit__spacer" }), !isInfoPage && (_jsx("button", { type: "button", className: "button ob-button is-light ob-button-submit-cancel cypress-cancel-form", onClick: handleCancel, disabled: isPreview || disabled, children: _jsx(CustomisableButtonInner, { label: ((_c = buttons === null || buttons === void 0 ? void 0 : buttons.cancel) === null || _c === void 0 ? void 0 : _c.label) || 'Cancel', icon: (_d = buttons === null || buttons === void 0 ? void 0 : buttons.cancel) === null || _d === void 0 ? void 0 : _d.icon }) })), isLastVisiblePage && (_jsx(Tooltip, { title: submissionConditionallyEnabled
|
|
769
|
+
? ''
|
|
770
|
+
: 'Submission disabled: Your inputs have not met the criteria for submission', children: _jsx("button", { type: "submit", className: clsx('button ob-button is-success ob-button-submit cypress-submit-form-button cypress-submit-form', { 'is-loading': isPreparingToSubmit }, {
|
|
771
|
+
'ob-button-submit-is-disabled': submissionConditionallyEnabled,
|
|
772
|
+
}), disabled: isPreview ||
|
|
773
|
+
disabled ||
|
|
774
|
+
isPreparingToSubmit ||
|
|
775
|
+
!submissionConditionallyEnabled, children: _jsx(CustomisableButtonInner, { label: isInfoPage
|
|
776
|
+
? 'Done'
|
|
777
|
+
: ((_e = buttons === null || buttons === void 0 ? void 0 : buttons.submit) === null || _e === void 0 ? void 0 : _e.label) || 'Submit', icon: (_f = buttons === null || buttons === void 0 ? void 0 : buttons.submit) === null || _f === void 0 ? void 0 : _f.icon }) }) }))] }))] }) }), !isReadOnly && !isPreview && (_jsxs(React.Fragment, { children: [_jsx(Prompt, { when: isDirty && !isNavigationAllowed, message: handleBlockedNavigation }), _jsx(Modal, { isOpen: hasConfirmedNavigation === false, title: "Unsaved Changes", cardClassName: "cypress-cancel-confirm", titleClassName: "cypress-cancel-confirm-title", bodyClassName: "cypress-cancel-confirm-body", actions: _jsxs(_Fragment, { children: [onSaveDraft && (_jsx("button", { type: "button", className: "button ob-button is-success cypress-cancel-confirm-save-draft", onClick: () => handleSaveDraft(false), children: _jsx(CustomisableButtonInner, { label: ((_g = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _g === void 0 ? void 0 : _g.label) || 'Save Draft', icon: (_h = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _h === void 0 ? void 0 : _h.icon }) })), _jsx("span", { style: { flex: 1 } }), _jsx("button", { type: "button", className: "button ob-button is-light cypress-cancel-confirm-back", onClick: handleKeepGoing, children: _jsx(CustomisableButtonInner, { label: ((_j = buttons === null || buttons === void 0 ? void 0 : buttons.cancelPromptNo) === null || _j === void 0 ? void 0 : _j.label) || 'Back', icon: (_k = buttons === null || buttons === void 0 ? void 0 : buttons.cancelPromptNo) === null || _k === void 0 ? void 0 : _k.icon }) }), _jsx("button", { type: "button", className: "button ob-button is-primary cypress-cancel-confirm-discard", onClick: handleDiscardUnsavedChanges, autoFocus: true, children: _jsx(CustomisableButtonInner, { label: ((_l = buttons === null || buttons === void 0 ? void 0 : buttons.cancelPromptYes) === null || _l === void 0 ? void 0 : _l.label) || 'Discard', icon: (_m = buttons === null || buttons === void 0 ? void 0 : buttons.cancelPromptYes) === null || _m === void 0 ? void 0 : _m.icon }) })] }), children: _jsx("p", { children: "You have unsaved changes, are you sure you want discard them?" }) }), _jsx(Modal, { isOpen: promptUploadingAttachments === true, title: "Attachment upload in progress", cardClassName: "cypress-attachments-wait-continue", titleClassName: "cypress-attachments-confirm-wait-title", bodyClassName: "cypress-attachments-confirm-wait-body", actions: _jsxs(_Fragment, { children: [_jsx("span", { style: { flex: 1 } }), _jsx("button", { type: "button", className: "button ob-button is-light cypress-attachments-confirm-wait", onClick: handleWaitForAttachments, children: "Wait" }), _jsx("button", { type: "button", className: "button ob-button is-primary cypress-attachments-confirm-continue", onClick: handleContinueWithAttachments, autoFocus: true, children: "Continue" })] }), children: _jsx("p", { children: "Your attachments are still uploading, do you want to wait for the uploads to complete or continue using the app? If you click continue the attachments will upload in the background. Do not close the app until the upload has been completed." }) }), _jsxs(Modal, { isOpen: promptOfflineSubmissionAttempt, title: "It looks like you're Offline", className: "ob-modal__offline-submission-attempt", cardClassName: "cypress-submission-offline has-text-centered", titleClassName: "cypress-offline-title", bodyClassName: "cypress-offline-body", actions: _jsxs(_Fragment, { children: [onSaveDraft && (_jsx("button", { type: "button", className: "button ob-button ob-button__offline-submission-attempt-save-draft is-success", onClick: () => handleSaveDraft(false), children: _jsx(CustomisableButtonInner, { label: ((_o = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _o === void 0 ? void 0 : _o.label) || 'Save Draft', icon: (_p = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _p === void 0 ? void 0 : _p.icon }) })), _jsx("span", { style: { flex: 1 } }), _jsx("button", { className: "button ob-button ob-button__offline-submission-attempt-cancel is-light", onClick: () => setPromptOfflineSubmissionAttempt(false), children: "Cancel" }), _jsx("button", { className: "button ob-button ob-button__offline-submission-attempt-try-again is-primary", onClick: (e) => {
|
|
778
|
+
setPromptOfflineSubmissionAttempt(false);
|
|
779
|
+
handleSubmit(e, false);
|
|
780
|
+
}, autoFocus: true, children: "Try Again" })] }), children: [_jsxs("p", { className: "ob-modal__offline-submission-attempt-message", children: ["You cannot submit this form while offline, please try again when connectivity is restored.", onSaveDraft && (_jsxs("span", { className: "ob-modal__offline-submission-attempt-save-draft-message", children: [' ', "Alternatively, click the", ' ', _jsx("b", { children: ((_q = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _q === void 0 ? void 0 : _q.label) || 'Save Draft' }), ' ', "button below to come back to this later."] }))] }), _jsx(MaterialIcon, { className: "has-text-warning icon-x-large ob-modal__offline-submission-attempt-icon", children: "wifi_off" })] })] })), shouldUseNavigableValidationErrorsNotification &&
|
|
781
|
+
isShowingValidationErrorsCard && (_jsx(ValidationErrorsCard, { visiblePages: visiblePages, formElementsValidation: formElementsValidation, setPageId: setPageId, currentPage: currentPage, navigationTopOffset: (_r = navigableValidationErrorsNotificationSettings === null || navigableValidationErrorsNotificationSettings === void 0 ? void 0 : navigableValidationErrorsNotificationSettings.navigationTopOffset) !== null && _r !== void 0 ? _r : 'CALCULATE', scrollableContainerId: navigableValidationErrorsNotificationSettings === null || navigableValidationErrorsNotificationSettings === void 0 ? void 0 : navigableValidationErrorsNotificationSettings.scrollableContainerId, validationErrorToastFocusElementRef: validationErrorToastFocusElementRef }))] }) }) }) }) }) }) }) }));
|
|
879
782
|
}
|
|
880
783
|
export default React.memo(OneBlinkFormBase);
|
|
881
784
|
//# sourceMappingURL=OneBlinkFormBase.js.map
|