@oneblink/apps-react 2.2.0 → 2.3.0-beta.2
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 +10 -10
- package/dist/OneBlinkAutoSaveForm.js +28 -28
- package/dist/OneBlinkForm.d.ts +11 -11
- package/dist/OneBlinkForm.js +11 -11
- package/dist/OneBlinkFormBase.d.ts +28 -28
- package/dist/OneBlinkFormBase.js +472 -472
- package/dist/OneBlinkFormStoreView.d.ts +8 -0
- package/dist/OneBlinkFormStoreView.js +55 -0
- package/dist/OneBlinkFormStoreView.js.map +1 -0
- package/dist/OneBlinkReadOnlyForm.d.ts +11 -11
- package/dist/OneBlinkReadOnlyForm.js +48 -48
- package/dist/components/AnnotationModal.d.ts +8 -0
- package/dist/components/AnnotationModal.js +104 -0
- package/dist/components/AnnotationModal.js.map +1 -0
- package/dist/components/AutocompleteDropdown.d.ts +26 -0
- package/dist/components/AutocompleteDropdown.js +174 -0
- package/dist/components/AutocompleteDropdown.js.map +1 -0
- package/dist/components/CopyToClipboardButton.d.ts +9 -0
- package/dist/components/CopyToClipboardButton.js +14 -0
- package/dist/components/CopyToClipboardButton.js.map +1 -0
- package/dist/components/CopyToClipboardIconButton.d.ts +10 -10
- package/dist/components/CopyToClipboardIconButton.js +32 -32
- package/dist/components/CustomAccordion.d.ts +27 -27
- package/dist/components/CustomAccordion.js +37 -37
- package/dist/components/CustomisableButtonInner.d.ts +7 -0
- package/dist/components/CustomisableButtonInner.js +9 -0
- package/dist/components/CustomisableButtonInner.js.map +1 -0
- package/dist/components/ErrorMessage.d.ts +13 -0
- package/dist/components/ErrorMessage.js +13 -0
- package/dist/components/ErrorMessage.js.map +1 -0
- package/dist/components/ErrorSnackbar.d.ts +8 -8
- package/dist/components/ErrorSnackbar.js +25 -25
- package/dist/components/FormElementLabelContainer.d.ts +12 -0
- package/dist/components/FormElementLabelContainer.js +16 -0
- package/dist/components/FormElementLabelContainer.js.map +1 -0
- package/dist/components/FormElementOptions.d.ts +9 -0
- package/dist/components/FormElementOptions.js +15 -0
- package/dist/components/FormElementOptions.js.map +1 -0
- package/dist/components/Lists.d.ts +25 -25
- package/dist/components/Lists.js +44 -44
- package/dist/components/LoadingWithMessage.d.ts +6 -6
- package/dist/components/LoadingWithMessage.js +11 -11
- package/dist/components/LookupButton.d.ts +10 -0
- package/dist/components/LookupButton.js +30 -0
- package/dist/components/LookupButton.js.map +1 -0
- package/dist/components/LookupNotification.d.ts +12 -0
- package/dist/components/LookupNotification.js +231 -0
- package/dist/components/LookupNotification.js.map +1 -0
- package/dist/components/Modal.d.ts +14 -0
- package/dist/components/Modal.js +15 -0
- package/dist/components/Modal.js.map +1 -0
- package/dist/components/NoResourcesYet.d.ts +12 -0
- package/dist/components/NoResourcesYet.js +7 -0
- package/dist/components/NoResourcesYet.js.map +1 -0
- package/dist/components/OnLoading.d.ts +10 -0
- package/dist/components/OnLoading.js +12 -0
- package/dist/components/OnLoading.js.map +1 -0
- package/dist/components/OneBlinkAppsErrorOriginalMessage.d.ts +7 -0
- package/dist/components/OneBlinkAppsErrorOriginalMessage.js +13 -0
- package/dist/components/OneBlinkAppsErrorOriginalMessage.js.map +1 -0
- package/dist/components/OneBlinkFormElements.d.ts +19 -0
- package/dist/components/OneBlinkFormElements.js +196 -0
- package/dist/components/OneBlinkFormElements.js.map +1 -0
- package/dist/components/PageFormElements.d.ts +17 -0
- package/dist/components/PageFormElements.js +49 -0
- package/dist/components/PageFormElements.js.map +1 -0
- package/dist/components/ToggleAllCheckbox.d.ts +13 -0
- package/dist/components/ToggleAllCheckbox.js +27 -0
- package/dist/components/ToggleAllCheckbox.js.map +1 -0
- package/dist/components/attachments/AttachmentStatus.d.ts +12 -0
- package/dist/components/attachments/AttachmentStatus.js +35 -0
- package/dist/components/attachments/AttachmentStatus.js.map +1 -0
- package/dist/components/attachments/FileCard.d.ts +18 -0
- package/dist/components/attachments/FileCard.js +58 -0
- package/dist/components/attachments/FileCard.js.map +1 -0
- package/dist/components/attachments/FileCardContent.d.ts +5 -0
- package/dist/components/attachments/FileCardContent.js +11 -0
- package/dist/components/attachments/FileCardContent.js.map +1 -0
- package/dist/components/attachments/Files.d.ts +14 -0
- package/dist/components/attachments/Files.js +27 -0
- package/dist/components/attachments/Files.js.map +1 -0
- package/dist/components/attachments/ImagePreviewUnavailable.d.ts +4 -0
- package/dist/components/attachments/ImagePreviewUnavailable.js +12 -0
- package/dist/components/attachments/ImagePreviewUnavailable.js.map +1 -0
- package/dist/components/attachments/UploadingAttachment.d.ts +4 -0
- package/dist/components/attachments/UploadingAttachment.js +13 -0
- package/dist/components/attachments/UploadingAttachment.js.map +1 -0
- package/dist/components/formStore/ColumnsConfigurationButton.d.ts +10 -0
- package/dist/components/formStore/ColumnsConfigurationButton.js +29 -0
- package/dist/components/formStore/ColumnsConfigurationButton.js.map +1 -0
- package/dist/components/formStore/DownloadSubmissionDataButton.d.ts +13 -0
- package/dist/components/formStore/DownloadSubmissionDataButton.js +45 -0
- package/dist/components/formStore/DownloadSubmissionDataButton.js.map +1 -0
- package/dist/components/formStore/FormStore.d.ts +9 -0
- package/dist/components/formStore/FormStore.js +103 -0
- package/dist/components/formStore/FormStore.js.map +1 -0
- package/dist/components/formStore/FormStoreTableProvider.d.ts +6 -6
- package/dist/components/formStore/FormStoreTableProvider.js +90 -90
- package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.d.ts +5 -5
- package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.js +19 -19
- package/dist/components/formStore/OneBlinkFormStoreColumnsButton.d.ts +5 -5
- package/dist/components/formStore/OneBlinkFormStoreColumnsButton.js +66 -66
- package/dist/components/formStore/OneBlinkFormStoreDownloadButton.d.ts +5 -5
- package/dist/components/formStore/OneBlinkFormStoreDownloadButton.js +86 -86
- package/dist/components/formStore/OneBlinkFormStoreProvider.d.ts +8 -8
- package/dist/components/formStore/OneBlinkFormStoreProvider.js +24 -24
- package/dist/components/formStore/OneBlinkFormStoreRefreshButton.d.ts +5 -5
- package/dist/components/formStore/OneBlinkFormStoreRefreshButton.js +11 -11
- package/dist/components/formStore/OneBlinkFormStoreTable.d.ts +4 -4
- package/dist/components/formStore/OneBlinkFormStoreTable.js +194 -194
- package/dist/components/formStore/display/ElementDisplay.d.ts +23 -23
- package/dist/components/formStore/display/ElementDisplay.js +77 -77
- package/dist/components/formStore/display/FormStoreIcon.d.ts +2 -2
- package/dist/components/formStore/display/FormStoreIcon.js +2 -2
- package/dist/components/formStore/table/ActionedByTableCell.d.ts +11 -11
- package/dist/components/formStore/table/ActionedByTableCell.js +43 -43
- package/dist/components/formStore/table/ColumnFilters.d.ts +9 -9
- package/dist/components/formStore/table/ColumnFilters.js +179 -179
- package/dist/components/formStore/table/FormElementTableCell.d.ts +10 -10
- package/dist/components/formStore/table/FormElementTableCell.js +228 -228
- package/dist/components/formStore/table/HeaderCellMoreButton.d.ts +9 -9
- package/dist/components/formStore/table/HeaderCellMoreButton.js +48 -48
- package/dist/components/formStore/table/RepeatableSetCell.d.ts +8 -8
- package/dist/components/formStore/table/RepeatableSetCell.js +62 -62
- package/dist/components/formStore/table/RepeatableSetCellAccordion.d.ts +9 -9
- package/dist/components/formStore/table/RepeatableSetCellAccordion.js +11 -11
- package/dist/components/formStore/table/TableCellCopyButton.d.ts +7 -7
- package/dist/components/formStore/table/TableCellCopyButton.js +27 -27
- package/dist/components/formStore/table/generateColumns.d.ts +24 -24
- package/dist/components/formStore/table/generateColumns.js +290 -290
- package/dist/components/formStore/table/index.d.ts +17 -0
- package/dist/components/formStore/table/index.js +194 -0
- package/dist/components/formStore/table/index.js.map +1 -0
- package/dist/components/formStore/table/useFormStoreTable.d.ts +52 -52
- package/dist/components/formStore/table/useFormStoreTable.js +157 -157
- package/dist/components/formStore/useFormStoreTableContext.d.ts +44 -44
- package/dist/components/formStore/useFormStoreTableContext.js +9 -9
- package/dist/components/messages/ErrorMessage.d.ts +12 -12
- package/dist/components/messages/ErrorMessage.js +12 -12
- package/dist/components/messages/LargeIconMessage.d.ts +18 -18
- package/dist/components/messages/LargeIconMessage.js +33 -33
- package/dist/components/messages/NoResourcesYet.d.ts +11 -11
- package/dist/components/messages/NoResourcesYet.js +6 -6
- package/dist/components/pickers/V4CompatibleDatePicker.d.ts +32 -32
- package/dist/components/pickers/V4CompatibleDatePicker.js +70 -70
- package/dist/components/pickers/V4CompatibleDateTimePicker.d.ts +32 -32
- package/dist/components/pickers/V4CompatibleDateTimePicker.js +70 -70
- package/dist/components/pickers/V4CompatibleTimePicker.d.ts +28 -28
- package/dist/components/pickers/V4CompatibleTimePicker.js +53 -53
- package/dist/components/renderer/AnnotationModal.d.ts +8 -8
- package/dist/components/renderer/AnnotationModal.js +101 -101
- package/dist/components/renderer/AutocompleteDropdown.d.ts +26 -26
- package/dist/components/renderer/AutocompleteDropdown.js +175 -175
- package/dist/components/renderer/CopyToClipboardButton.d.ts +8 -8
- package/dist/components/renderer/CopyToClipboardButton.js +13 -13
- package/dist/components/renderer/CustomisableButtonInner.d.ts +7 -7
- package/dist/components/renderer/CustomisableButtonInner.js +8 -8
- package/dist/components/renderer/FormElementLabelContainer.d.ts +12 -12
- package/dist/components/renderer/FormElementLabelContainer.js +15 -15
- package/dist/components/renderer/FormElementOptions.d.ts +9 -9
- package/dist/components/renderer/FormElementOptions.js +14 -14
- package/dist/components/renderer/LookupButton.d.ts +10 -10
- package/dist/components/renderer/LookupButton.js +29 -29
- package/dist/components/renderer/LookupNotification.d.ts +12 -12
- package/dist/components/renderer/LookupNotification.js +230 -230
- package/dist/components/renderer/Modal.d.ts +14 -14
- package/dist/components/renderer/Modal.js +14 -14
- package/dist/components/renderer/OnLoading.d.ts +10 -10
- package/dist/components/renderer/OnLoading.js +11 -11
- package/dist/components/renderer/OneBlinkAppsErrorOriginalMessage.d.ts +7 -7
- package/dist/components/renderer/OneBlinkAppsErrorOriginalMessage.js +12 -12
- package/dist/components/renderer/OneBlinkFormElements.d.ts +19 -19
- package/dist/components/renderer/OneBlinkFormElements.js +202 -202
- package/dist/components/renderer/PageFormElements.d.ts +17 -17
- package/dist/components/renderer/PageFormElements.js +48 -48
- package/dist/components/renderer/ProgressBar.d.ts +7 -0
- package/dist/components/renderer/ProgressBar.js +7 -0
- package/dist/components/renderer/ProgressBar.js.map +1 -0
- package/dist/components/renderer/ToggleAllCheckbox.d.ts +13 -13
- package/dist/components/renderer/ToggleAllCheckbox.js +26 -26
- package/dist/components/renderer/attachments/AttachmentStatus.d.ts +10 -10
- package/dist/components/renderer/attachments/AttachmentStatus.js +36 -30
- package/dist/components/renderer/attachments/AttachmentStatus.js.map +1 -1
- package/dist/components/renderer/attachments/FileCard.d.ts +19 -18
- package/dist/components/renderer/attachments/FileCard.js +60 -57
- package/dist/components/renderer/attachments/FileCard.js.map +1 -1
- package/dist/components/renderer/attachments/FileCardContent.d.ts +5 -5
- package/dist/components/renderer/attachments/FileCardContent.js +10 -10
- package/dist/components/renderer/attachments/Files.d.ts +14 -0
- package/dist/components/renderer/attachments/Files.js +27 -0
- package/dist/components/renderer/attachments/Files.js.map +1 -0
- package/dist/components/renderer/attachments/ImagePreviewUnavailable.d.ts +4 -4
- package/dist/components/renderer/attachments/ImagePreviewUnavailable.js +11 -11
- package/dist/components/renderer/attachments/ProgressBar.d.ts +8 -0
- package/dist/components/renderer/attachments/ProgressBar.js +34 -0
- package/dist/components/renderer/attachments/ProgressBar.js.map +1 -0
- package/dist/components/renderer/attachments/UploadingAttachment.d.ts +4 -4
- package/dist/components/renderer/attachments/UploadingAttachment.js +12 -12
- package/dist/form-elements/ComplianceButton.d.ts +10 -10
- package/dist/form-elements/ComplianceButton.js +11 -11
- package/dist/form-elements/FormElementABN.d.ts +14 -14
- package/dist/form-elements/FormElementABN.js +155 -155
- package/dist/form-elements/FormElementAutocomplete.d.ts +19 -19
- package/dist/form-elements/FormElementAutocomplete.js +81 -81
- package/dist/form-elements/FormElementBSB.d.ts +18 -18
- package/dist/form-elements/FormElementBSB.js +100 -100
- package/dist/form-elements/FormElementBarcodeScanner.d.ts +14 -14
- package/dist/form-elements/FormElementBarcodeScanner.js +306 -306
- package/dist/form-elements/FormElementBoolean.d.ts +14 -14
- package/dist/form-elements/FormElementBoolean.js +16 -16
- package/dist/form-elements/FormElementCalculation.d.ts +11 -11
- package/dist/form-elements/FormElementCalculation.js +179 -179
- package/dist/form-elements/FormElementCamera.d.ts +15 -15
- package/dist/form-elements/FormElementCamera.js +227 -220
- package/dist/form-elements/FormElementCamera.js.map +1 -1
- package/dist/form-elements/FormElementCaptcha.d.ts +12 -12
- package/dist/form-elements/FormElementCaptcha.js +14 -14
- package/dist/form-elements/FormElementCheckBoxes.d.ts +15 -15
- package/dist/form-elements/FormElementCheckBoxes.js +64 -64
- package/dist/form-elements/FormElementCivicaNameRecord.d.ts +8 -8
- package/dist/form-elements/FormElementCivicaNameRecord.js +51 -51
- package/dist/form-elements/FormElementCivicaStreetName.d.ts +15 -15
- package/dist/form-elements/FormElementCivicaStreetName.js +38 -38
- package/dist/form-elements/FormElementCompliance.d.ts +22 -22
- package/dist/form-elements/FormElementCompliance.js +129 -129
- package/dist/form-elements/FormElementDate.d.ts +14 -14
- package/dist/form-elements/FormElementDate.js +74 -74
- package/dist/form-elements/FormElementDateTime.d.ts +14 -14
- package/dist/form-elements/FormElementDateTime.js +67 -67
- package/dist/form-elements/FormElementEmail.d.ts +14 -14
- package/dist/form-elements/FormElementEmail.js +22 -22
- package/dist/form-elements/FormElementFile.d.ts +13 -13
- package/dist/form-elements/FormElementFile.js +31 -31
- package/dist/form-elements/FormElementFile.js.map +1 -1
- package/dist/form-elements/FormElementFiles/FormElementFile.d.ts +13 -0
- package/dist/form-elements/FormElementFiles/FormElementFile.js +32 -0
- package/dist/form-elements/FormElementFiles/FormElementFile.js.map +1 -0
- package/dist/form-elements/FormElementFiles/FormElementFileDisplay.d.ts +10 -0
- package/dist/form-elements/FormElementFiles/FormElementFileDisplay.js +11 -0
- package/dist/form-elements/FormElementFiles/FormElementFileDisplay.js.map +1 -0
- package/dist/form-elements/FormElementFiles/FormElementFiles.d.ts +15 -0
- package/dist/form-elements/FormElementFiles/FormElementFiles.js +17 -0
- package/dist/form-elements/FormElementFiles/FormElementFiles.js.map +1 -0
- package/dist/form-elements/FormElementFiles/FormElementFilesInvalidAttachment.d.ts +7 -0
- package/dist/form-elements/FormElementFiles/FormElementFilesInvalidAttachment.js +11 -0
- package/dist/form-elements/FormElementFiles/FormElementFilesInvalidAttachment.js.map +1 -0
- package/dist/form-elements/FormElementFiles/index.d.ts +17 -0
- package/dist/form-elements/FormElementFiles/index.js +18 -0
- package/dist/form-elements/FormElementFiles/index.js.map +1 -0
- package/dist/form-elements/FormElementFiles/legacy/FormElementFiles.d.ts +18 -0
- package/dist/form-elements/FormElementFiles/legacy/FormElementFiles.js +61 -0
- package/dist/form-elements/FormElementFiles/legacy/FormElementFiles.js.map +1 -0
- package/dist/form-elements/FormElementFiles.d.ts +15 -15
- package/dist/form-elements/FormElementFiles.js +42 -42
- package/dist/form-elements/FormElementForm.d.ts +17 -17
- package/dist/form-elements/FormElementForm.js +63 -63
- package/dist/form-elements/FormElementFreshdeskDependentField.d.ts +8 -8
- package/dist/form-elements/FormElementFreshdeskDependentField.js +15 -15
- package/dist/form-elements/FormElementGeoscapeAddress.d.ts +15 -15
- package/dist/form-elements/FormElementGeoscapeAddress.js +62 -62
- package/dist/form-elements/FormElementHTML.d.ts +8 -8
- package/dist/form-elements/FormElementHTML.js +15 -15
- package/dist/form-elements/FormElementHeading.d.ts +8 -8
- package/dist/form-elements/FormElementHeading.js +23 -23
- package/dist/form-elements/FormElementImage.d.ts +8 -8
- package/dist/form-elements/FormElementImage.js +6 -6
- package/dist/form-elements/FormElementLocation.d.ts +20 -20
- package/dist/form-elements/FormElementLocation.js +204 -204
- package/dist/form-elements/FormElementNumber.d.ts +14 -14
- package/dist/form-elements/FormElementNumber.js +72 -72
- package/dist/form-elements/FormElementPointAddress.d.ts +15 -15
- package/dist/form-elements/FormElementPointAddress.js +69 -69
- package/dist/form-elements/FormElementRadio.d.ts +15 -15
- package/dist/form-elements/FormElementRadio.js +41 -41
- package/dist/form-elements/FormElementRepeatableSet.d.ts +19 -19
- package/dist/form-elements/FormElementRepeatableSet.js +126 -126
- package/dist/form-elements/FormElementSection.d.ts +8 -8
- package/dist/form-elements/FormElementSection.js +69 -69
- package/dist/form-elements/FormElementSelect.d.ts +15 -15
- package/dist/form-elements/FormElementSelect.js +44 -44
- package/dist/form-elements/FormElementSignature.d.ts +15 -15
- package/dist/form-elements/FormElementSignature.js +138 -135
- package/dist/form-elements/FormElementSignature.js.map +1 -1
- package/dist/form-elements/FormElementSummary.d.ts +11 -11
- package/dist/form-elements/FormElementSummary.js +159 -159
- package/dist/form-elements/FormElementTelephone.d.ts +14 -14
- package/dist/form-elements/FormElementTelephone.js +22 -22
- package/dist/form-elements/FormElementText.d.ts +14 -14
- package/dist/form-elements/FormElementText.js +29 -29
- package/dist/form-elements/FormElementTextarea.d.ts +14 -14
- package/dist/form-elements/FormElementTextarea.js +30 -30
- package/dist/form-elements/FormElementTime.d.ts +14 -14
- package/dist/form-elements/FormElementTime.js +53 -53
- package/dist/form-elements/OptionButton.d.ts +11 -11
- package/dist/form-elements/OptionButton.js +9 -9
- package/dist/hooks/attachments/useAttachment.d.ts +12 -11
- package/dist/hooks/attachments/useAttachment.js +242 -235
- package/dist/hooks/attachments/useAttachment.js.map +1 -1
- package/dist/hooks/attachments/useAttachmentBlobs.d.ts +19 -19
- package/dist/hooks/attachments/useAttachmentBlobs.js +23 -23
- package/dist/hooks/attachments/useAttachmentObjectURLs.d.ts +24 -0
- package/dist/hooks/attachments/useAttachmentObjectURLs.js +37 -0
- package/dist/hooks/attachments/useAttachmentObjectURLs.js.map +1 -0
- package/dist/hooks/attachments/useAttachments.d.ts +10 -10
- package/dist/hooks/attachments/useAttachments.js +69 -69
- package/dist/hooks/attachments/useLocalAttachmentBlobs.d.ts +24 -0
- package/dist/hooks/attachments/useLocalAttachmentBlobs.js +40 -0
- package/dist/hooks/attachments/useLocalAttachmentBlobs.js.map +1 -0
- package/dist/hooks/useAbnLookupAuthenticationGuid.d.ts +3 -3
- package/dist/hooks/useAbnLookupAuthenticationGuid.js +5 -5
- package/dist/hooks/useAuth.d.ts +15 -15
- package/dist/hooks/useAuth.js +42 -42
- package/dist/hooks/useBooleanState.d.ts +5 -5
- package/dist/hooks/useBooleanState.js +8 -8
- package/dist/hooks/useButtonsConfiguration.d.ts +45 -0
- package/dist/hooks/useButtonsConfiguration.js +6 -0
- package/dist/hooks/useButtonsConfiguration.js.map +1 -0
- package/dist/hooks/useCaptchaSiteKey.d.ts +3 -3
- package/dist/hooks/useCaptchaSiteKey.js +5 -5
- package/dist/hooks/useChangeEffect.d.ts +1 -0
- package/dist/hooks/useChangeEffect.js +14 -0
- package/dist/hooks/useChangeEffect.js.map +1 -0
- package/dist/hooks/useClickOutsideElement.d.ts +3 -3
- package/dist/hooks/useClickOutsideElement.js +14 -14
- package/dist/hooks/useConditionalLogic.d.ts +6 -6
- package/dist/hooks/useConditionalLogic.js +22 -22
- package/dist/hooks/useConditionallyShowOptionCallback.d.ts +5 -0
- package/dist/hooks/useConditionallyShowOptionCallback.js +20 -0
- package/dist/hooks/useConditionallyShowOptionCallback.js.map +1 -0
- package/dist/hooks/useContrastColor.d.ts +2 -2
- package/dist/hooks/useContrastColor.js +12 -12
- package/dist/hooks/useCustomValidation.d.ts +1 -0
- package/dist/hooks/useCustomValidation.js +9 -0
- package/dist/hooks/useCustomValidation.js.map +1 -0
- package/dist/hooks/useDynamicOptionsLoaderEffect.d.ts +7 -0
- package/dist/hooks/useDynamicOptionsLoaderEffect.js +45 -0
- package/dist/hooks/useDynamicOptionsLoaderEffect.js.map +1 -0
- package/dist/hooks/useDynamicOptionsLoaderState.d.ts +7 -7
- package/dist/hooks/useDynamicOptionsLoaderState.js +44 -44
- package/dist/hooks/useExecutedLookupCallback.d.ts +12 -12
- package/dist/hooks/useExecutedLookupCallback.js +15 -15
- package/dist/hooks/useFlatpickr.d.ts +10 -10
- package/dist/hooks/useFlatpickr.js +73 -73
- package/dist/hooks/useFlatpickrGuid.d.ts +7 -7
- package/dist/hooks/useFlatpickrGuid.js +11 -11
- package/dist/hooks/useFlattenElementsContext.d.ts +2 -2
- package/dist/hooks/useFlattenElementsContext.js +7 -7
- package/dist/hooks/useFormDefinition.d.ts +4 -4
- package/dist/hooks/useFormDefinition.js +9 -9
- package/dist/hooks/useFormElementOptions.d.ts +9 -9
- package/dist/hooks/useFormElementOptions.js +35 -35
- package/dist/hooks/useFormIsReadOnly.d.ts +3 -3
- package/dist/hooks/useFormIsReadOnly.js +5 -5
- package/dist/hooks/useFormSubmissionAutoSaveState.d.ts +24 -24
- package/dist/hooks/useFormSubmissionAutoSaveState.js +145 -145
- package/dist/hooks/useFormSubmissionModelContext.d.ts +15 -15
- package/dist/hooks/useFormSubmissionModelContext.js +32 -32
- package/dist/hooks/useFormSubmissionState.d.ts +10 -10
- package/dist/hooks/useFormSubmissionState.js +13 -13
- package/dist/hooks/useFormValidation.d.ts +7 -7
- package/dist/hooks/useFormValidation.js +29 -29
- package/dist/hooks/useGoogleMapsApiKey.d.ts +3 -3
- package/dist/hooks/useGoogleMapsApiKey.js +5 -5
- package/dist/hooks/useInfiniteScrollDataLoad.d.ts +30 -30
- package/dist/hooks/useInfiniteScrollDataLoad.js +124 -124
- package/dist/hooks/useInjectPages.d.ts +7 -7
- package/dist/hooks/useInjectPages.js +5 -5
- package/dist/hooks/useIsHovering.d.ts +5 -5
- package/dist/hooks/useIsHovering.js +12 -12
- package/dist/hooks/useIsMounted.d.ts +3 -3
- package/dist/hooks/useIsMounted.js +11 -11
- package/dist/hooks/useIsOffline.d.ts +6 -6
- package/dist/hooks/useIsOffline.js +26 -26
- package/dist/hooks/useIsPageVisible.d.ts +9 -9
- package/dist/hooks/useIsPageVisible.js +8 -8
- package/dist/hooks/useLegacyElements.d.ts +16 -0
- package/dist/hooks/useLegacyElements.js +55 -0
- package/dist/hooks/useLegacyElements.js.map +1 -0
- package/dist/hooks/useLoadDataState.d.ts +15 -15
- package/dist/hooks/useLoadDataState.js +54 -54
- package/dist/hooks/useLogin.d.ts +46 -46
- package/dist/hooks/useLogin.js +295 -295
- package/dist/hooks/useLookupNotification.d.ts +9 -9
- package/dist/hooks/useLookupNotification.js +10 -10
- package/dist/hooks/useLookups.d.ts +5 -5
- package/dist/hooks/useLookups.js +62 -62
- package/dist/hooks/useNullableState.d.ts +2 -2
- package/dist/hooks/useNullableState.js +6 -6
- package/dist/hooks/usePages.d.ts +24 -24
- package/dist/hooks/usePages.js +141 -141
- package/dist/hooks/useQuery.d.ts +2 -2
- package/dist/hooks/useQuery.js +7 -7
- package/dist/hooks/useSubmissionIdIsValid.d.ts +3 -3
- package/dist/hooks/useSubmissionIdIsValid.js +19 -19
- package/dist/hooks/useToggleAll.d.ts +6 -0
- package/dist/hooks/useToggleAll.js +24 -0
- package/dist/hooks/useToggleAll.js.map +1 -0
- package/dist/hooks/useToggleComplianceChildren.d.ts +3 -3
- package/dist/hooks/useToggleComplianceChildren.js +13 -13
- package/dist/index.d.ts +23 -22
- package/dist/index.js +23 -22
- package/dist/index.js.map +1 -1
- package/dist/services/attachments.d.ts +10 -10
- package/dist/services/attachments.js +72 -72
- package/dist/services/barcode-readers/quagger.d.ts +1 -1
- package/dist/services/barcode-readers/quagger.js +34 -34
- package/dist/services/blob-utils.d.ts +5 -5
- package/dist/services/blob-utils.js +73 -73
- package/dist/services/checkBsbsAreInvalid.d.ts +3 -3
- package/dist/services/checkBsbsAreInvalid.js +40 -40
- package/dist/services/checkIfAttachmentsAreUploading.d.ts +3 -3
- package/dist/services/checkIfAttachmentsAreUploading.js +57 -57
- package/dist/services/checkIfAttachmentsExist.d.ts +5 -5
- package/dist/services/checkIfAttachmentsExist.js +144 -144
- package/dist/services/checkIfBsbsAreValidating.d.ts +3 -3
- package/dist/services/checkIfBsbsAreValidating.js +40 -40
- package/dist/services/clean-form-elements-ctrl-model.d.ts +4 -0
- package/dist/services/clean-form-elements-ctrl-model.js +166 -0
- package/dist/services/clean-form-elements-ctrl-model.js.map +1 -0
- package/dist/services/cleanFormSubmissionModel.d.ts +6 -6
- package/dist/services/cleanFormSubmissionModel.js +203 -203
- package/dist/services/conditionally-show-element.d.ts +11 -0
- package/dist/services/conditionally-show-element.js +92 -0
- package/dist/services/conditionally-show-element.js.map +1 -0
- package/dist/services/conditionally-show-option.d.ts +3 -0
- package/dist/services/conditionally-show-option.js +135 -0
- package/dist/services/conditionally-show-option.js.map +1 -0
- package/dist/services/defaultCoordinates.d.ts +5 -5
- package/dist/services/defaultCoordinates.js +8 -8
- package/dist/services/download-file.d.ts +3 -3
- package/dist/services/download-file.js +90 -90
- package/dist/services/drawTimestampOnCanvas.d.ts +1 -1
- package/dist/services/drawTimestampOnCanvas.js +22 -22
- package/dist/services/flattenFormElements.d.ts +2 -0
- package/dist/services/flattenFormElements.js +13 -0
- package/dist/services/flattenFormElements.js.map +1 -0
- package/dist/services/form-validation.d.ts +10 -10
- package/dist/services/form-validation.js +561 -561
- package/dist/services/generate-default-data.d.ts +13 -13
- package/dist/services/generate-default-data.js +494 -494
- package/dist/services/generateCivicaNameRecordElements.d.ts +2 -2
- package/dist/services/generateCivicaNameRecordElements.js +140 -140
- package/dist/services/generateFreshdeskDependentFieldElements.d.ts +2 -2
- package/dist/services/generateFreshdeskDependentFieldElements.js +69 -69
- package/dist/services/getCorrectDateFromDateOnlyString.d.ts +2 -0
- package/dist/services/getCorrectDateFromDateOnlyString.js +4 -0
- package/dist/services/getCorrectDateFromDateOnlyString.js.map +1 -0
- package/dist/services/sanitize-html.d.ts +2 -2
- package/dist/services/sanitize-html.js +20 -20
- package/dist/services/scrolling-service.d.ts +7 -7
- package/dist/services/scrolling-service.js +38 -38
- package/dist/services/utils-service.d.ts +5 -5
- package/dist/services/utils-service.js +16 -16
- package/dist/styles/boolean.scss +12 -0
- package/dist/styles/ob-file.scss +63 -0
- package/dist/styles/progress.scss +8 -0
- package/dist/styles.css +7 -0
- package/dist/styles.css.map +1 -1
- package/dist/styles.scss +1 -0
- package/dist/types/attachments.d.ts +19 -19
- package/dist/types/attachments.js +1 -1
- package/dist/types/form.d.ts +40 -40
- package/dist/types/form.js +2 -2
- package/package.json +2 -2
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FormElementSignature.js","sourceRoot":"","sources":["../../src/form-elements/FormElementSignature.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,eAAe,MAAM,wBAAwB,CAAA;AAGpD,OAAO,gBAAgB,MAAM,+BAA+B,CAAA;AAC5D,OAAO,yBAAyB,MAAM,kDAAkD,CAAA;AACxF,OAAO,SAAS,MAAM,kCAAkC,CAAA;AACxD,OAAO,aAAa,MAAM,oCAAoC,CAAA;AAE9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,gBAAgB,MAAM,qDAAqD,CAAA;AAClF,OAAO,eAAe,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,uBAAuB,MAAM,4DAA4D,CAAA;AAEhG,OAAO,gBAAgB,MAAM,2BAA2B,CAAA;AAWxD,SAAS,oBAAoB,CAAC,EAC5B,EAAE,EACF,OAAO,EACP,KAAK,EACL,QAAQ,EACR,iBAAiB,EACjB,wBAAwB,GAClB;IACN,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;IACpD,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAA;IAExC,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CACpC,CAAC,WAAW,EAAE,QAAQ,EAAE,EAAE;QACxB,UAAU,EAAE,CAAA;QACZ,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAA;IACjC,CAAC,EACD,CAAC,QAAQ,EAAE,UAAU,CAA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jC,CACJ,CAAA;KACF;IAED,IAAI,iBAAiB,EAAE;QACrB,OAAO,oBAAC,SAAS,IAAC,KAAK,QAAC,SAAS,EAAC,iCAAiC,GAAG,CAAA;KACvE;IAED,IAAI,QAAQ,EAAE;QACZ,OAAO,CACL;YACE,8BAAM,SAAS,EAAC,mBAAmB;gBACjC,oBAAC,gBAAgB,IACf,iBAAiB,EAAE,iBAAiB,EACpC,iBAAiB,EAAE,iBAAiB,EACpC,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,GAClB,CACG;YACP,6BACE,GAAG,EAAE,QAAQ,EACb,SAAS,EAAC,2CAA2C,GACrD,CACD,CACJ,CAAA;KACF;IAED,OAAO,oBAAC,uBAAuB,OAAG,CAAA;AACpC,CAAC,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport SignatureCanvas from 'react-signature-canvas'\nimport { FormTypes } from '@oneblink/types'\n\nimport scrollingService from '../services/scrolling-service'\nimport FormElementLabelContainer from '../components/renderer/FormElementLabelContainer'\nimport OnLoading from '../components/renderer/OnLoading'\nimport useAttachment from '../hooks/attachments/useAttachment'\nimport { FormElementBinaryStorageValue } from '../types/attachments'\nimport { prepareNewAttachment } from '../services/attachments'\nimport AttachmentStatus from '../components/renderer/attachments/AttachmentStatus'\nimport useBooleanState from '../hooks/useBooleanState'\nimport { canvasToBlob } from '../services/blob-utils'\nimport ImagePreviewUnavailable from '../components/renderer/attachments/ImagePreviewUnavailable'\nimport { FormElementValueChangeHandler } from '../types/form'\nimport useIsPageVisible from '../hooks/useIsPageVisible'\n\ntype Props = {\n id: string\n element: FormTypes.DrawElement\n value: FormElementBinaryStorageValue\n onChange: FormElementValueChangeHandler<FormElementBinaryStorageValue>\n displayValidationMessage: boolean\n validationMessage: string | undefined\n}\n\nfunction FormElementSignature({\n id,\n element,\n value,\n onChange,\n validationMessage,\n displayValidationMessage,\n}: Props) {\n const [isDirty, setIsDirty] = useBooleanState(false)\n const isPageVisible = useIsPageVisible()\n\n const handleChange = React.useCallback(\n (formElement, newValue) => {\n setIsDirty()\n onChange(formElement, newValue)\n },\n [onChange, setIsDirty],\n )\n\n return (\n <div className=\"cypress-signature-element\">\n <FormElementLabelContainer\n className=\"ob-signature\"\n id={id}\n element={element}\n required={element.required}\n >\n <div className=\"control\">\n {value ? (\n <SignatureDisplay\n element={element}\n value={value}\n onChange={handleChange}\n />\n ) : isPageVisible ? (\n <SignatureDrawing element={element} onChange={handleChange} />\n ) : null}\n </div>\n\n {(isDirty || displayValidationMessage) && !!validationMessage && (\n <div role=\"alert\" className=\"has-margin-top-8\">\n <div className=\"has-text-danger ob-error__text cypress-validation-message\">\n {validationMessage}\n </div>\n </div>\n )}\n </FormElementLabelContainer>\n </div>\n )\n}\n\nexport default React.memo(FormElementSignature)\n\nconst SignatureDrawing = React.memo(function SignatureDrawing({\n element,\n onChange,\n}: {\n element: Props['element']\n onChange: Props['onChange']\n}) {\n const canvasRef = React.useRef<SignatureCanvas>(null)\n\n const [isEmpty, setIsEmpty] = React.useState(true)\n const [canvasDimensions, setCanvasDimensions] = React.useState({})\n\n const handleClear = React.useCallback(() => {\n if (canvasRef.current) {\n console.log('Clearing signature...')\n canvasRef.current.clear()\n }\n setIsEmpty(true)\n }, [])\n\n const handleDone = React.useCallback(async () => {\n if (!canvasRef.current) return\n const trimmedCanvas = canvasRef.current.getTrimmedCanvas()\n\n // Convert base64 data uri to blob and send it on its way\n const blob = await canvasToBlob(trimmedCanvas)\n onChange(element, prepareNewAttachment(blob, 'signature.png', element))\n }, [element, onChange])\n\n // HANDLING CANVAS CHANGE\n const handleEndDraw = React.useCallback(() => {\n if (window.cordova) {\n scrollingService.enableScrolling()\n }\n if (isEmpty) {\n setIsEmpty(false)\n }\n }, [isEmpty])\n\n // HANDLE RESIZE\n React.useEffect(() => {\n const signatureCanvas = canvasRef.current\n if (!signatureCanvas) return\n const resize = () => {\n const parentDiv = signatureCanvas.getCanvas().parentNode\n if (parentDiv) {\n setCanvasDimensions({\n // @ts-expect-error ???\n width: parentDiv.clientWidth,\n // @ts-expect-error ???\n height: parentDiv.clientHeight,\n })\n }\n }\n window.addEventListener('resize', resize)\n resize()\n\n return () => {\n window.removeEventListener('resize', resize)\n }\n }, [canvasRef])\n\n // REACTIVE DISABLING OF CANVAS\n React.useEffect(() => {\n if (!canvasRef.current) return\n if (element.readOnly) {\n canvasRef.current.off()\n } else {\n canvasRef.current.on()\n }\n }, [canvasRef, element.readOnly])\n\n return (\n <>\n <div>\n <SignatureCanvas\n ref={canvasRef}\n canvasProps={{\n ...canvasDimensions,\n className:\n 'input ob-signature__control cypress-signature-control signature-pad',\n // @ts-expect-error ???\n disabled: element.readOnly,\n }}\n onEnd={handleEndDraw}\n onBegin={\n window.cordova ? scrollingService.disableScrolling : undefined\n }\n />\n </div>\n\n <div className=\"buttons ob-buttons\">\n <button\n type=\"button\"\n className=\"button ob-button is-light ob-button__clear cypress-clear-signature\"\n onClick={handleClear}\n disabled={element.readOnly || isEmpty}\n >\n Clear\n </button>\n <button\n type=\"button\"\n className=\"button ob-button ob-button__done is-primary cypress-done-signature-button\"\n onClick={handleDone}\n disabled={element.readOnly || isEmpty}\n >\n Done\n </button>\n </div>\n </>\n )\n})\n\nconst SignatureDisplay = React.memo(function SignatureDisplay({\n element,\n value,\n onChange,\n}: {\n element: Props['element']\n value: Props['value']\n onChange: Props['onChange']\n}) {\n const result = useAttachment(\n value,\n element,\n React.useCallback(\n (id, attachment) => {\n onChange(element, attachment)\n },\n [element, onChange],\n ),\n )\n\n return (\n <>\n <figure className=\"ob-figure\">\n <div className=\"figure-content\">\n <DisplayImage {...result} />\n </div>\n </figure>\n\n <div className=\"buttons ob-buttons\">\n <button\n type=\"button\"\n className=\"button ob-button is-light ob-button__clear cypress-clear-signature\"\n onClick={() => onChange(element, undefined)}\n disabled={element.readOnly}\n >\n Clear\n </button>\n </div>\n </>\n )\n})\n\nconst DisplayImage = React.memo(function DisplayImage({\n uploadErrorMessage,\n isUploading,\n isLoadingImageUrl,\n imageUrl,\n loadImageUrlError,\n}: ReturnType<typeof useAttachment>) {\n if (uploadErrorMessage) {\n return (\n <>\n <h3 className=\"title is-3\">Upload Failed</h3>\n <p>\n Your signature failed to upload, please press the <b>Clear</b> button\n and try again.\n </p>\n </>\n )\n }\n\n if (loadImageUrlError) {\n return (\n <>\n <h3 className=\"title is-3\">Preview Failed</h3>\n <p>{loadImageUrlError.message}</p>\n </>\n )\n }\n\n if (isLoadingImageUrl) {\n return <OnLoading small className=\"cypress-signature-loading-image\" />\n }\n\n if (imageUrl) {\n return (\n <>\n <span className=\"ob-figure__status\">\n <AttachmentStatus\n isLoadingImageUrl={isLoadingImageUrl}\n loadImageUrlError={loadImageUrlError}\n isUploading={isUploading}\n imageUrl={imageUrl}\n />\n </span>\n <img\n src={imageUrl}\n className=\"cypress-signature-image ob-signature__img\"\n />\n </>\n )\n }\n\n return <ImagePreviewUnavailable />\n})\n"]}
|
1
|
+
{"version":3,"file":"FormElementSignature.js","sourceRoot":"","sources":["../../src/form-elements/FormElementSignature.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,eAAe,MAAM,wBAAwB,CAAA;AAGpD,OAAO,gBAAgB,MAAM,+BAA+B,CAAA;AAC5D,OAAO,yBAAyB,MAAM,kDAAkD,CAAA;AACxF,OAAO,SAAS,MAAM,kCAAkC,CAAA;AACxD,OAAO,aAAa,MAAM,oCAAoC,CAAA;AAE9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,gBAAgB,MAAM,qDAAqD,CAAA;AAClF,OAAO,eAAe,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,uBAAuB,MAAM,4DAA4D,CAAA;AAEhG,OAAO,gBAAgB,MAAM,2BAA2B,CAAA;AACxD,OAAO,WAAW,MAAM,gDAAgD,CAAA;AAWxE,SAAS,oBAAoB,CAA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anvas from 'react-signature-canvas'\nimport { FormTypes } from '@oneblink/types'\n\nimport scrollingService from '../services/scrolling-service'\nimport FormElementLabelContainer from '../components/renderer/FormElementLabelContainer'\nimport OnLoading from '../components/renderer/OnLoading'\nimport useAttachment from '../hooks/attachments/useAttachment'\nimport { FormElementBinaryStorageValue } from '../types/attachments'\nimport { prepareNewAttachment } from '../services/attachments'\nimport AttachmentStatus from '../components/renderer/attachments/AttachmentStatus'\nimport useBooleanState from '../hooks/useBooleanState'\nimport { canvasToBlob } from '../services/blob-utils'\nimport ImagePreviewUnavailable from '../components/renderer/attachments/ImagePreviewUnavailable'\nimport { FormElementValueChangeHandler } from '../types/form'\nimport useIsPageVisible from '../hooks/useIsPageVisible'\nimport ProgressBar from '../components/renderer/attachments/ProgressBar'\n\ntype Props = {\n id: string\n element: FormTypes.DrawElement\n value: FormElementBinaryStorageValue\n onChange: FormElementValueChangeHandler<FormElementBinaryStorageValue>\n displayValidationMessage: boolean\n validationMessage: string | undefined\n}\n\nfunction FormElementSignature({\n id,\n element,\n value,\n onChange,\n validationMessage,\n displayValidationMessage,\n}: Props) {\n const [isDirty, setIsDirty] = useBooleanState(false)\n const isPageVisible = useIsPageVisible()\n\n const handleChange = React.useCallback(\n (formElement, newValue) => {\n setIsDirty()\n onChange(formElement, newValue)\n },\n [onChange, setIsDirty],\n )\n\n return (\n <div className=\"cypress-signature-element\">\n <FormElementLabelContainer\n className=\"ob-signature\"\n id={id}\n element={element}\n required={element.required}\n >\n <div className=\"control\">\n {value ? (\n <SignatureDisplay\n element={element}\n value={value}\n onChange={handleChange}\n />\n ) : isPageVisible ? (\n <SignatureDrawing element={element} onChange={handleChange} />\n ) : null}\n </div>\n\n {(isDirty || displayValidationMessage) && !!validationMessage && (\n <div role=\"alert\" className=\"has-margin-top-8\">\n <div className=\"has-text-danger ob-error__text cypress-validation-message\">\n {validationMessage}\n </div>\n </div>\n )}\n </FormElementLabelContainer>\n </div>\n )\n}\n\nexport default React.memo(FormElementSignature)\n\nconst SignatureDrawing = React.memo(function SignatureDrawing({\n element,\n onChange,\n}: {\n element: Props['element']\n onChange: Props['onChange']\n}) {\n const canvasRef = React.useRef<SignatureCanvas>(null)\n\n const [isEmpty, setIsEmpty] = React.useState(true)\n const [canvasDimensions, setCanvasDimensions] = React.useState({})\n\n const handleClear = React.useCallback(() => {\n if (canvasRef.current) {\n console.log('Clearing signature...')\n canvasRef.current.clear()\n }\n setIsEmpty(true)\n }, [])\n\n const handleDone = React.useCallback(async () => {\n if (!canvasRef.current) return\n const trimmedCanvas = canvasRef.current.getTrimmedCanvas()\n\n // Convert base64 data uri to blob and send it on its way\n const blob = await canvasToBlob(trimmedCanvas)\n onChange(element, prepareNewAttachment(blob, 'signature.png', element))\n }, [element, onChange])\n\n // HANDLING CANVAS CHANGE\n const handleEndDraw = React.useCallback(() => {\n if (window.cordova) {\n scrollingService.enableScrolling()\n }\n if (isEmpty) {\n setIsEmpty(false)\n }\n }, [isEmpty])\n\n // HANDLE RESIZE\n React.useEffect(() => {\n const signatureCanvas = canvasRef.current\n if (!signatureCanvas) return\n const resize = () => {\n const parentDiv = signatureCanvas.getCanvas().parentNode\n if (parentDiv) {\n setCanvasDimensions({\n // @ts-expect-error ???\n width: parentDiv.clientWidth,\n // @ts-expect-error ???\n height: parentDiv.clientHeight,\n })\n }\n }\n window.addEventListener('resize', resize)\n resize()\n\n return () => {\n window.removeEventListener('resize', resize)\n }\n }, [canvasRef])\n\n // REACTIVE DISABLING OF CANVAS\n React.useEffect(() => {\n if (!canvasRef.current) return\n if (element.readOnly) {\n canvasRef.current.off()\n } else {\n canvasRef.current.on()\n }\n }, [canvasRef, element.readOnly])\n\n return (\n <>\n <div>\n <SignatureCanvas\n ref={canvasRef}\n canvasProps={{\n ...canvasDimensions,\n className:\n 'input ob-signature__control cypress-signature-control signature-pad',\n // @ts-expect-error ???\n disabled: element.readOnly,\n }}\n onEnd={handleEndDraw}\n onBegin={\n window.cordova ? scrollingService.disableScrolling : undefined\n }\n />\n </div>\n\n <div className=\"buttons ob-buttons\">\n <button\n type=\"button\"\n className=\"button ob-button is-light ob-button__clear cypress-clear-signature\"\n onClick={handleClear}\n disabled={element.readOnly || isEmpty}\n >\n Clear\n </button>\n <button\n type=\"button\"\n className=\"button ob-button ob-button__done is-primary cypress-done-signature-button\"\n onClick={handleDone}\n disabled={element.readOnly || isEmpty}\n >\n Done\n </button>\n </div>\n </>\n )\n})\n\nconst SignatureDisplay = React.memo(function SignatureDisplay({\n element,\n value,\n onChange,\n}: {\n element: Props['element']\n value: Props['value']\n onChange: Props['onChange']\n}) {\n const result = useAttachment(\n value,\n element,\n React.useCallback(\n (id, attachment) => {\n onChange(element, attachment)\n },\n [element, onChange],\n ),\n )\n\n const progressTooltipRef = React.useRef<HTMLDivElement>(null)\n\n return (\n <>\n <figure className=\"ob-figure\" ref={progressTooltipRef}>\n <div className=\"figure-content\">\n <DisplayImage {...result} progressTooltipRef={progressTooltipRef} />\n </div>\n </figure>\n\n <div className=\"buttons ob-buttons\">\n <button\n type=\"button\"\n className=\"button ob-button is-light ob-button__clear cypress-clear-signature\"\n onClick={() => onChange(element, undefined)}\n disabled={element.readOnly}\n >\n Clear\n </button>\n </div>\n </>\n )\n})\n\nconst DisplayImage = React.memo(function DisplayImage({\n uploadErrorMessage,\n isUploading,\n isLoadingImageUrl,\n imageUrl,\n loadImageUrlError,\n progress,\n progressTooltipRef,\n}: ReturnType<typeof useAttachment> & {\n progressTooltipRef: React.RefObject<HTMLDivElement>\n}) {\n if (uploadErrorMessage) {\n return (\n <>\n <h3 className=\"title is-3\">Upload Failed</h3>\n <p>\n Your signature failed to upload, please press the <b>Clear</b> button\n and try again.\n </p>\n </>\n )\n }\n\n if (loadImageUrlError) {\n return (\n <>\n <h3 className=\"title is-3\">Preview Failed</h3>\n <p>{loadImageUrlError.message}</p>\n </>\n )\n }\n\n if (isLoadingImageUrl) {\n return <OnLoading small className=\"cypress-signature-loading-image\" />\n }\n\n if (imageUrl) {\n return (\n <>\n <span className=\"ob-figure__status\">\n <AttachmentStatus\n isLoadingImageUrl={isLoadingImageUrl}\n loadImageUrlError={loadImageUrlError}\n isUploading={isUploading}\n imageUrl={imageUrl}\n />\n </span>\n <img\n src={imageUrl}\n className=\"cypress-signature-image ob-signature__img\"\n />\n {progressTooltipRef.current && (\n <ProgressBar\n progress={progress}\n isShowing={isUploading}\n tooltipAnchorEl={progressTooltipRef.current}\n />\n )}\n </>\n )\n }\n\n return <ImagePreviewUnavailable />\n})\n"]}
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { FormTypes } from '@oneblink/types';
|
3
|
-
import { FormElementValueChangeHandler } from '../types/form';
|
4
|
-
declare type Props = {
|
5
|
-
element: FormTypes.SummaryElement;
|
6
|
-
onChange: FormElementValueChangeHandler;
|
7
|
-
value: unknown;
|
8
|
-
};
|
9
|
-
declare function FormElementSummary({ element, onChange, value }: Props): JSX.Element;
|
10
|
-
declare const _default: React.MemoExoticComponent<typeof FormElementSummary>;
|
11
|
-
export default _default;
|
1
|
+
import * as React from 'react';
|
2
|
+
import { FormTypes } from '@oneblink/types';
|
3
|
+
import { FormElementValueChangeHandler } from '../types/form';
|
4
|
+
declare type Props = {
|
5
|
+
element: FormTypes.SummaryElement;
|
6
|
+
onChange: FormElementValueChangeHandler;
|
7
|
+
value: unknown;
|
8
|
+
};
|
9
|
+
declare function FormElementSummary({ element, onChange, value }: Props): JSX.Element;
|
10
|
+
declare const _default: React.MemoExoticComponent<typeof FormElementSummary>;
|
11
|
+
export default _default;
|
@@ -1,160 +1,160 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { localisationService } from '@oneblink/apps';
|
3
|
-
import { useFormSubmissionModelParent } from '../hooks/useFormSubmissionModelContext';
|
4
|
-
import useFlattenElements from '../hooks/useFlattenElementsContext';
|
5
|
-
import { generateDate } from '../services/generate-default-data';
|
6
|
-
const arraysAreEqual = (a, b) => {
|
7
|
-
if (!Array.isArray(a) || !Array.isArray(b)) {
|
8
|
-
if (a !== b)
|
9
|
-
return false;
|
10
|
-
return true;
|
11
|
-
}
|
12
|
-
if (a.length !== b.length)
|
13
|
-
return false;
|
14
|
-
for (let i = 0; i < a.length; i++) {
|
15
|
-
if (Array.isArray(a[i]) && Array.isArray(b[i])) {
|
16
|
-
const areEqual = arraysAreEqual(a[i], b[i]);
|
17
|
-
if (!areEqual)
|
18
|
-
return false;
|
19
|
-
continue;
|
20
|
-
}
|
21
|
-
if (a[i] !== b[i])
|
22
|
-
return false;
|
23
|
-
}
|
24
|
-
return true;
|
25
|
-
};
|
26
|
-
function FormElementSummary({ element, onChange, value }) {
|
27
|
-
const { formSubmissionModel } = useFormSubmissionModelParent();
|
28
|
-
const flattenedElements = useFlattenElements();
|
29
|
-
const reducer = React.useCallback((partialSummary, formElement, submission) => {
|
30
|
-
if (formElement.type === 'page')
|
31
|
-
return partialSummary;
|
32
|
-
if (formElement.type !== 'repeatableSet' &&
|
33
|
-
formElement.type !== 'form' &&
|
34
|
-
!element.elementIds.some((elementId) => elementId === formElement.id)) {
|
35
|
-
return partialSummary;
|
36
|
-
}
|
37
|
-
const formElementValue = submission[formElement.name];
|
38
|
-
if (!formElementValue && formElementValue !== 0) {
|
39
|
-
return partialSummary;
|
40
|
-
}
|
41
|
-
switch (formElement.type) {
|
42
|
-
case 'repeatableSet': {
|
43
|
-
if (!Array.isArray(formElementValue))
|
44
|
-
return partialSummary;
|
45
|
-
// If we found a repeatable set, look through child elements
|
46
|
-
// to find the summary elements. Need to start a new array for
|
47
|
-
// this structure and look at each entry in the repeatable set
|
48
|
-
for (const entry of formElementValue) {
|
49
|
-
const repeatableSetSummaryValues = formElement.elements.reduce((partialSummary, formElement) => reducer(partialSummary, formElement,
|
50
|
-
// Pleasing TypeScript
|
51
|
-
entry instanceof Object ? entry : {}), []);
|
52
|
-
if (repeatableSetSummaryValues.length) {
|
53
|
-
partialSummary.push(repeatableSetSummaryValues);
|
54
|
-
}
|
55
|
-
}
|
56
|
-
break;
|
57
|
-
}
|
58
|
-
case 'form': {
|
59
|
-
const formSummaryValues = (formElement.elements || []).reduce((partialSummary, formElement) => reducer(partialSummary, formElement,
|
60
|
-
// Pleasing TypeScript
|
61
|
-
formElementValue instanceof Object ? formElementValue : {}), []);
|
62
|
-
if (formSummaryValues.length) {
|
63
|
-
partialSummary.push(formSummaryValues);
|
64
|
-
}
|
65
|
-
break;
|
66
|
-
}
|
67
|
-
case 'select':
|
68
|
-
case 'autocomplete':
|
69
|
-
case 'radio':
|
70
|
-
case 'checkboxes': {
|
71
|
-
const optionValues = [];
|
72
|
-
if (Array.isArray(formElementValue)) {
|
73
|
-
optionValues.push(...formElementValue);
|
74
|
-
}
|
75
|
-
else {
|
76
|
-
optionValues.push(formElementValue);
|
77
|
-
}
|
78
|
-
if (Array.isArray(formElement.options)) {
|
79
|
-
partialSummary.push(...optionValues.reduce((optionLabels, optionValue) => {
|
80
|
-
const option = formElement.options.find(({ value }) => optionValue === value);
|
81
|
-
if (option) {
|
82
|
-
optionLabels.push(option.label);
|
83
|
-
}
|
84
|
-
return optionLabels;
|
85
|
-
}, []));
|
86
|
-
}
|
87
|
-
break;
|
88
|
-
}
|
89
|
-
case 'date': {
|
90
|
-
const date = generateDate({
|
91
|
-
daysOffset: undefined,
|
92
|
-
value: formElementValue,
|
93
|
-
dateOnly: true,
|
94
|
-
});
|
95
|
-
if (date) {
|
96
|
-
partialSummary.push(localisationService.formatDate(date));
|
97
|
-
}
|
98
|
-
break;
|
99
|
-
}
|
100
|
-
case 'datetime': {
|
101
|
-
if (typeof formElementValue !== 'string')
|
102
|
-
return partialSummary;
|
103
|
-
partialSummary.push(localisationService.formatDatetime(new Date(formElementValue)));
|
104
|
-
break;
|
105
|
-
}
|
106
|
-
case 'time': {
|
107
|
-
if (typeof formElementValue !== 'string')
|
108
|
-
return partialSummary;
|
109
|
-
partialSummary.push(localisationService.formatTime(new Date(formElementValue)));
|
110
|
-
break;
|
111
|
-
}
|
112
|
-
default: {
|
113
|
-
// Pleasing TypeScript WHILE COVERING ALL BASES
|
114
|
-
if (typeof formElementValue !== 'string' &&
|
115
|
-
typeof formElementValue !== 'object' &&
|
116
|
-
typeof formElementValue !== 'number' &&
|
117
|
-
typeof formElementValue !== 'function' &&
|
118
|
-
typeof formElementValue !== 'boolean') {
|
119
|
-
return partialSummary;
|
120
|
-
}
|
121
|
-
partialSummary.push(formElementValue.toString());
|
122
|
-
}
|
123
|
-
}
|
124
|
-
return partialSummary;
|
125
|
-
}, [element.elementIds]);
|
126
|
-
// MODEL LISTENER
|
127
|
-
React.useEffect(() => {
|
128
|
-
const summary = flattenedElements.reduce((partialSummary, formElement) => {
|
129
|
-
return reducer(partialSummary, formElement, formSubmissionModel);
|
130
|
-
}, []);
|
131
|
-
if (value === undefined) {
|
132
|
-
if (!summary.length)
|
133
|
-
return;
|
134
|
-
}
|
135
|
-
if (arraysAreEqual(value, summary)) {
|
136
|
-
return;
|
137
|
-
}
|
138
|
-
if (summary.length) {
|
139
|
-
onChange(element, summary);
|
140
|
-
}
|
141
|
-
else {
|
142
|
-
onChange(element, undefined);
|
143
|
-
}
|
144
|
-
}, [
|
145
|
-
element,
|
146
|
-
flattenedElements,
|
147
|
-
formSubmissionModel,
|
148
|
-
onChange,
|
149
|
-
reducer,
|
150
|
-
value,
|
151
|
-
]);
|
152
|
-
return (React.createElement("div", { className: "ob-form__element ob-summary cypress-summary-result " }, !!value && Array.isArray(value) && (React.createElement(SummaryResult, { results: value }))));
|
153
|
-
}
|
154
|
-
const SummaryResult = React.memo(function SummaryResult({ results }) {
|
155
|
-
return (React.createElement(React.Fragment, null, results.map((result, i) => {
|
156
|
-
return (React.createElement("div", { key: `${result.toString()}-${i}`, className: "ob-summary__result-container" }, typeof result === 'string' ? (React.createElement("p", { className: "ob-summary__result has-line-breaks cypress-summary-result-text" }, result)) : (React.createElement(SummaryResult, { results: result }))));
|
157
|
-
})));
|
158
|
-
});
|
159
|
-
export default React.memo(FormElementSummary);
|
1
|
+
import * as React from 'react';
|
2
|
+
import { localisationService } from '@oneblink/apps';
|
3
|
+
import { useFormSubmissionModelParent } from '../hooks/useFormSubmissionModelContext';
|
4
|
+
import useFlattenElements from '../hooks/useFlattenElementsContext';
|
5
|
+
import { generateDate } from '../services/generate-default-data';
|
6
|
+
const arraysAreEqual = (a, b) => {
|
7
|
+
if (!Array.isArray(a) || !Array.isArray(b)) {
|
8
|
+
if (a !== b)
|
9
|
+
return false;
|
10
|
+
return true;
|
11
|
+
}
|
12
|
+
if (a.length !== b.length)
|
13
|
+
return false;
|
14
|
+
for (let i = 0; i < a.length; i++) {
|
15
|
+
if (Array.isArray(a[i]) && Array.isArray(b[i])) {
|
16
|
+
const areEqual = arraysAreEqual(a[i], b[i]);
|
17
|
+
if (!areEqual)
|
18
|
+
return false;
|
19
|
+
continue;
|
20
|
+
}
|
21
|
+
if (a[i] !== b[i])
|
22
|
+
return false;
|
23
|
+
}
|
24
|
+
return true;
|
25
|
+
};
|
26
|
+
function FormElementSummary({ element, onChange, value }) {
|
27
|
+
const { formSubmissionModel } = useFormSubmissionModelParent();
|
28
|
+
const flattenedElements = useFlattenElements();
|
29
|
+
const reducer = React.useCallback((partialSummary, formElement, submission) => {
|
30
|
+
if (formElement.type === 'page')
|
31
|
+
return partialSummary;
|
32
|
+
if (formElement.type !== 'repeatableSet' &&
|
33
|
+
formElement.type !== 'form' &&
|
34
|
+
!element.elementIds.some((elementId) => elementId === formElement.id)) {
|
35
|
+
return partialSummary;
|
36
|
+
}
|
37
|
+
const formElementValue = submission[formElement.name];
|
38
|
+
if (!formElementValue && formElementValue !== 0) {
|
39
|
+
return partialSummary;
|
40
|
+
}
|
41
|
+
switch (formElement.type) {
|
42
|
+
case 'repeatableSet': {
|
43
|
+
if (!Array.isArray(formElementValue))
|
44
|
+
return partialSummary;
|
45
|
+
// If we found a repeatable set, look through child elements
|
46
|
+
// to find the summary elements. Need to start a new array for
|
47
|
+
// this structure and look at each entry in the repeatable set
|
48
|
+
for (const entry of formElementValue) {
|
49
|
+
const repeatableSetSummaryValues = formElement.elements.reduce((partialSummary, formElement) => reducer(partialSummary, formElement,
|
50
|
+
// Pleasing TypeScript
|
51
|
+
entry instanceof Object ? entry : {}), []);
|
52
|
+
if (repeatableSetSummaryValues.length) {
|
53
|
+
partialSummary.push(repeatableSetSummaryValues);
|
54
|
+
}
|
55
|
+
}
|
56
|
+
break;
|
57
|
+
}
|
58
|
+
case 'form': {
|
59
|
+
const formSummaryValues = (formElement.elements || []).reduce((partialSummary, formElement) => reducer(partialSummary, formElement,
|
60
|
+
// Pleasing TypeScript
|
61
|
+
formElementValue instanceof Object ? formElementValue : {}), []);
|
62
|
+
if (formSummaryValues.length) {
|
63
|
+
partialSummary.push(formSummaryValues);
|
64
|
+
}
|
65
|
+
break;
|
66
|
+
}
|
67
|
+
case 'select':
|
68
|
+
case 'autocomplete':
|
69
|
+
case 'radio':
|
70
|
+
case 'checkboxes': {
|
71
|
+
const optionValues = [];
|
72
|
+
if (Array.isArray(formElementValue)) {
|
73
|
+
optionValues.push(...formElementValue);
|
74
|
+
}
|
75
|
+
else {
|
76
|
+
optionValues.push(formElementValue);
|
77
|
+
}
|
78
|
+
if (Array.isArray(formElement.options)) {
|
79
|
+
partialSummary.push(...optionValues.reduce((optionLabels, optionValue) => {
|
80
|
+
const option = formElement.options.find(({ value }) => optionValue === value);
|
81
|
+
if (option) {
|
82
|
+
optionLabels.push(option.label);
|
83
|
+
}
|
84
|
+
return optionLabels;
|
85
|
+
}, []));
|
86
|
+
}
|
87
|
+
break;
|
88
|
+
}
|
89
|
+
case 'date': {
|
90
|
+
const date = generateDate({
|
91
|
+
daysOffset: undefined,
|
92
|
+
value: formElementValue,
|
93
|
+
dateOnly: true,
|
94
|
+
});
|
95
|
+
if (date) {
|
96
|
+
partialSummary.push(localisationService.formatDate(date));
|
97
|
+
}
|
98
|
+
break;
|
99
|
+
}
|
100
|
+
case 'datetime': {
|
101
|
+
if (typeof formElementValue !== 'string')
|
102
|
+
return partialSummary;
|
103
|
+
partialSummary.push(localisationService.formatDatetime(new Date(formElementValue)));
|
104
|
+
break;
|
105
|
+
}
|
106
|
+
case 'time': {
|
107
|
+
if (typeof formElementValue !== 'string')
|
108
|
+
return partialSummary;
|
109
|
+
partialSummary.push(localisationService.formatTime(new Date(formElementValue)));
|
110
|
+
break;
|
111
|
+
}
|
112
|
+
default: {
|
113
|
+
// Pleasing TypeScript WHILE COVERING ALL BASES
|
114
|
+
if (typeof formElementValue !== 'string' &&
|
115
|
+
typeof formElementValue !== 'object' &&
|
116
|
+
typeof formElementValue !== 'number' &&
|
117
|
+
typeof formElementValue !== 'function' &&
|
118
|
+
typeof formElementValue !== 'boolean') {
|
119
|
+
return partialSummary;
|
120
|
+
}
|
121
|
+
partialSummary.push(formElementValue.toString());
|
122
|
+
}
|
123
|
+
}
|
124
|
+
return partialSummary;
|
125
|
+
}, [element.elementIds]);
|
126
|
+
// MODEL LISTENER
|
127
|
+
React.useEffect(() => {
|
128
|
+
const summary = flattenedElements.reduce((partialSummary, formElement) => {
|
129
|
+
return reducer(partialSummary, formElement, formSubmissionModel);
|
130
|
+
}, []);
|
131
|
+
if (value === undefined) {
|
132
|
+
if (!summary.length)
|
133
|
+
return;
|
134
|
+
}
|
135
|
+
if (arraysAreEqual(value, summary)) {
|
136
|
+
return;
|
137
|
+
}
|
138
|
+
if (summary.length) {
|
139
|
+
onChange(element, summary);
|
140
|
+
}
|
141
|
+
else {
|
142
|
+
onChange(element, undefined);
|
143
|
+
}
|
144
|
+
}, [
|
145
|
+
element,
|
146
|
+
flattenedElements,
|
147
|
+
formSubmissionModel,
|
148
|
+
onChange,
|
149
|
+
reducer,
|
150
|
+
value,
|
151
|
+
]);
|
152
|
+
return (React.createElement("div", { className: "ob-form__element ob-summary cypress-summary-result " }, !!value && Array.isArray(value) && (React.createElement(SummaryResult, { results: value }))));
|
153
|
+
}
|
154
|
+
const SummaryResult = React.memo(function SummaryResult({ results }) {
|
155
|
+
return (React.createElement(React.Fragment, null, results.map((result, i) => {
|
156
|
+
return (React.createElement("div", { key: `${result.toString()}-${i}`, className: "ob-summary__result-container" }, typeof result === 'string' ? (React.createElement("p", { className: "ob-summary__result has-line-breaks cypress-summary-result-text" }, result)) : (React.createElement(SummaryResult, { results: result }))));
|
157
|
+
})));
|
158
|
+
});
|
159
|
+
export default React.memo(FormElementSummary);
|
160
160
|
//# sourceMappingURL=FormElementSummary.js.map
|
@@ -1,14 +1,14 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { FormTypes } from '@oneblink/types';
|
3
|
-
import { FormElementValueChangeHandler } from '../types/form';
|
4
|
-
declare type Props = {
|
5
|
-
id: string;
|
6
|
-
element: FormTypes.TelephoneElement;
|
7
|
-
value: unknown;
|
8
|
-
onChange: FormElementValueChangeHandler<string>;
|
9
|
-
displayValidationMessage: boolean;
|
10
|
-
validationMessage: string | undefined;
|
11
|
-
};
|
12
|
-
declare function FormElementTelephone({ id, element, value, onChange, validationMessage, displayValidationMessage, }: Props): JSX.Element;
|
13
|
-
declare const _default: React.MemoExoticComponent<typeof FormElementTelephone>;
|
14
|
-
export default _default;
|
1
|
+
import * as React from 'react';
|
2
|
+
import { FormTypes } from '@oneblink/types';
|
3
|
+
import { FormElementValueChangeHandler } from '../types/form';
|
4
|
+
declare type Props = {
|
5
|
+
id: string;
|
6
|
+
element: FormTypes.TelephoneElement;
|
7
|
+
value: unknown;
|
8
|
+
onChange: FormElementValueChangeHandler<string>;
|
9
|
+
displayValidationMessage: boolean;
|
10
|
+
validationMessage: string | undefined;
|
11
|
+
};
|
12
|
+
declare function FormElementTelephone({ id, element, value, onChange, validationMessage, displayValidationMessage, }: Props): JSX.Element;
|
13
|
+
declare const _default: React.MemoExoticComponent<typeof FormElementTelephone>;
|
14
|
+
export default _default;
|
@@ -1,23 +1,23 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import CopyToClipboardButton from '../components/renderer/CopyToClipboardButton';
|
3
|
-
import useBooleanState from '../hooks/useBooleanState';
|
4
|
-
import LookupButton from '../components/renderer/LookupButton';
|
5
|
-
import FormElementLabelContainer from '../components/renderer/FormElementLabelContainer';
|
6
|
-
function FormElementTelephone({ id, element, value, onChange, validationMessage, displayValidationMessage, }) {
|
7
|
-
const [isDirty, setIsDirty] = useBooleanState(false);
|
8
|
-
const text = typeof value === 'string' ? value : '';
|
9
|
-
return (React.createElement("div", { className: "cypress-telephone-element" },
|
10
|
-
React.createElement(FormElementLabelContainer, { className: "ob-telephone", id: id, element: element, required: element.required },
|
11
|
-
React.createElement("div", { className: "field has-addons" },
|
12
|
-
React.createElement("div", { className: "control is-expanded has-icons-right" },
|
13
|
-
React.createElement("input", { type: "tel", placeholder: element.placeholderValue, id: id, name: element.name, className: "input ob-input cypress-telephone-control", value: text, onChange: (e) => onChange(element, e.target.value || undefined), required: element.required, disabled: element.readOnly, onBlur: setIsDirty }),
|
14
|
-
React.createElement("span", { className: "ob-input-icon icon is-small is-right" },
|
15
|
-
React.createElement("i", { className: "material-icons is-size-5" }, "phone"))),
|
16
|
-
!!element.readOnly && !!value && (React.createElement("div", { className: "control" },
|
17
|
-
React.createElement(CopyToClipboardButton, { className: "button is-input-addon copy-button cypress-copy-to-clipboard-button", text: text }))),
|
18
|
-
React.createElement(LookupButton, { isInputButton: true, value: value, validationMessage: validationMessage })),
|
19
|
-
(isDirty || displayValidationMessage) && !!validationMessage && (React.createElement("div", { role: "alert", className: "has-margin-top-8" },
|
20
|
-
React.createElement("div", { className: "has-text-danger ob-error__text cypress-validation-message" }, validationMessage))))));
|
21
|
-
}
|
22
|
-
export default React.memo(FormElementTelephone);
|
1
|
+
import * as React from 'react';
|
2
|
+
import CopyToClipboardButton from '../components/renderer/CopyToClipboardButton';
|
3
|
+
import useBooleanState from '../hooks/useBooleanState';
|
4
|
+
import LookupButton from '../components/renderer/LookupButton';
|
5
|
+
import FormElementLabelContainer from '../components/renderer/FormElementLabelContainer';
|
6
|
+
function FormElementTelephone({ id, element, value, onChange, validationMessage, displayValidationMessage, }) {
|
7
|
+
const [isDirty, setIsDirty] = useBooleanState(false);
|
8
|
+
const text = typeof value === 'string' ? value : '';
|
9
|
+
return (React.createElement("div", { className: "cypress-telephone-element" },
|
10
|
+
React.createElement(FormElementLabelContainer, { className: "ob-telephone", id: id, element: element, required: element.required },
|
11
|
+
React.createElement("div", { className: "field has-addons" },
|
12
|
+
React.createElement("div", { className: "control is-expanded has-icons-right" },
|
13
|
+
React.createElement("input", { type: "tel", placeholder: element.placeholderValue, id: id, name: element.name, className: "input ob-input cypress-telephone-control", value: text, onChange: (e) => onChange(element, e.target.value || undefined), required: element.required, disabled: element.readOnly, onBlur: setIsDirty }),
|
14
|
+
React.createElement("span", { className: "ob-input-icon icon is-small is-right" },
|
15
|
+
React.createElement("i", { className: "material-icons is-size-5" }, "phone"))),
|
16
|
+
!!element.readOnly && !!value && (React.createElement("div", { className: "control" },
|
17
|
+
React.createElement(CopyToClipboardButton, { className: "button is-input-addon copy-button cypress-copy-to-clipboard-button", text: text }))),
|
18
|
+
React.createElement(LookupButton, { isInputButton: true, value: value, validationMessage: validationMessage })),
|
19
|
+
(isDirty || displayValidationMessage) && !!validationMessage && (React.createElement("div", { role: "alert", className: "has-margin-top-8" },
|
20
|
+
React.createElement("div", { className: "has-text-danger ob-error__text cypress-validation-message" }, validationMessage))))));
|
21
|
+
}
|
22
|
+
export default React.memo(FormElementTelephone);
|
23
23
|
//# sourceMappingURL=FormElementTelephone.js.map
|
@@ -1,14 +1,14 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { FormTypes } from '@oneblink/types';
|
3
|
-
import { FormElementValueChangeHandler } from '../types/form';
|
4
|
-
declare type Props = {
|
5
|
-
id: string;
|
6
|
-
element: FormTypes.TextElement;
|
7
|
-
value: unknown;
|
8
|
-
onChange: FormElementValueChangeHandler<string>;
|
9
|
-
displayValidationMessage: boolean;
|
10
|
-
validationMessage: string | undefined;
|
11
|
-
};
|
12
|
-
declare function FormElementText({ id, element, value, onChange, validationMessage, displayValidationMessage, }: Props): JSX.Element;
|
13
|
-
declare const _default: React.MemoExoticComponent<typeof FormElementText>;
|
14
|
-
export default _default;
|
1
|
+
import * as React from 'react';
|
2
|
+
import { FormTypes } from '@oneblink/types';
|
3
|
+
import { FormElementValueChangeHandler } from '../types/form';
|
4
|
+
declare type Props = {
|
5
|
+
id: string;
|
6
|
+
element: FormTypes.TextElement;
|
7
|
+
value: unknown;
|
8
|
+
onChange: FormElementValueChangeHandler<string>;
|
9
|
+
displayValidationMessage: boolean;
|
10
|
+
validationMessage: string | undefined;
|
11
|
+
};
|
12
|
+
declare function FormElementText({ id, element, value, onChange, validationMessage, displayValidationMessage, }: Props): JSX.Element;
|
13
|
+
declare const _default: React.MemoExoticComponent<typeof FormElementText>;
|
14
|
+
export default _default;
|
@@ -1,30 +1,30 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import clsx from 'clsx';
|
3
|
-
import CopyToClipboardButton from '../components/renderer/CopyToClipboardButton';
|
4
|
-
import useBooleanState from '../hooks/useBooleanState';
|
5
|
-
import LookupButton from '../components/renderer/LookupButton';
|
6
|
-
import FormElementLabelContainer from '../components/renderer/FormElementLabelContainer';
|
7
|
-
function FormElementText({ id, element, value, onChange, validationMessage, displayValidationMessage, }) {
|
8
|
-
const [isDirty, setIsDirty] = useBooleanState(false);
|
9
|
-
const text = typeof value === 'string' ? value : '';
|
10
|
-
const isDisplayingValidationMessage = (isDirty || displayValidationMessage) && !!validationMessage;
|
11
|
-
return (React.createElement("div", { className: "cypress-text-element" },
|
12
|
-
React.createElement(FormElementLabelContainer, { className: "ob-text", id: id, element: element, required: element.required },
|
13
|
-
React.createElement("div", { className: "field has-addons" },
|
14
|
-
React.createElement("div", { className: "control is-expanded" },
|
15
|
-
React.createElement("input", { type: "text", placeholder: element.placeholderValue, id: id, name: element.name, className: "input ob-input cypress-text-control", value: text, onChange: (e) => onChange(element, e.target.value || undefined), required: element.required, disabled: element.readOnly, onBlur: setIsDirty })),
|
16
|
-
!!element.readOnly && !!value && (React.createElement("div", { className: "control" },
|
17
|
-
React.createElement(CopyToClipboardButton, { className: "button is-input-addon copy-button cypress-copy-to-clipboard-button", text: text }))),
|
18
|
-
React.createElement(LookupButton, { isInputButton: true, value: value, validationMessage: validationMessage })),
|
19
|
-
(isDisplayingValidationMessage || !!element.maxLength) && (React.createElement("div", { role: "alert", className: "has-margin-top-8" },
|
20
|
-
React.createElement("div", { className: "is-flex is-justify-content-space-between" },
|
21
|
-
isDisplayingValidationMessage ? (React.createElement("div", { className: "has-text-danger ob-error__text cypress-validation-message" }, validationMessage)) : (React.createElement("div", null)),
|
22
|
-
!!element.maxLength && (React.createElement("div", { className: clsx('ob-max-length__text cypress-max-length-message', {
|
23
|
-
'has-text-danger': text.length > element.maxLength,
|
24
|
-
}) },
|
25
|
-
text.length,
|
26
|
-
" / ",
|
27
|
-
element.maxLength))))))));
|
28
|
-
}
|
29
|
-
export default React.memo(FormElementText);
|
1
|
+
import * as React from 'react';
|
2
|
+
import clsx from 'clsx';
|
3
|
+
import CopyToClipboardButton from '../components/renderer/CopyToClipboardButton';
|
4
|
+
import useBooleanState from '../hooks/useBooleanState';
|
5
|
+
import LookupButton from '../components/renderer/LookupButton';
|
6
|
+
import FormElementLabelContainer from '../components/renderer/FormElementLabelContainer';
|
7
|
+
function FormElementText({ id, element, value, onChange, validationMessage, displayValidationMessage, }) {
|
8
|
+
const [isDirty, setIsDirty] = useBooleanState(false);
|
9
|
+
const text = typeof value === 'string' ? value : '';
|
10
|
+
const isDisplayingValidationMessage = (isDirty || displayValidationMessage) && !!validationMessage;
|
11
|
+
return (React.createElement("div", { className: "cypress-text-element" },
|
12
|
+
React.createElement(FormElementLabelContainer, { className: "ob-text", id: id, element: element, required: element.required },
|
13
|
+
React.createElement("div", { className: "field has-addons" },
|
14
|
+
React.createElement("div", { className: "control is-expanded" },
|
15
|
+
React.createElement("input", { type: "text", placeholder: element.placeholderValue, id: id, name: element.name, className: "input ob-input cypress-text-control", value: text, onChange: (e) => onChange(element, e.target.value || undefined), required: element.required, disabled: element.readOnly, onBlur: setIsDirty })),
|
16
|
+
!!element.readOnly && !!value && (React.createElement("div", { className: "control" },
|
17
|
+
React.createElement(CopyToClipboardButton, { className: "button is-input-addon copy-button cypress-copy-to-clipboard-button", text: text }))),
|
18
|
+
React.createElement(LookupButton, { isInputButton: true, value: value, validationMessage: validationMessage })),
|
19
|
+
(isDisplayingValidationMessage || !!element.maxLength) && (React.createElement("div", { role: "alert", className: "has-margin-top-8" },
|
20
|
+
React.createElement("div", { className: "is-flex is-justify-content-space-between" },
|
21
|
+
isDisplayingValidationMessage ? (React.createElement("div", { className: "has-text-danger ob-error__text cypress-validation-message" }, validationMessage)) : (React.createElement("div", null)),
|
22
|
+
!!element.maxLength && (React.createElement("div", { className: clsx('ob-max-length__text cypress-max-length-message', {
|
23
|
+
'has-text-danger': text.length > element.maxLength,
|
24
|
+
}) },
|
25
|
+
text.length,
|
26
|
+
" / ",
|
27
|
+
element.maxLength))))))));
|
28
|
+
}
|
29
|
+
export default React.memo(FormElementText);
|
30
30
|
//# sourceMappingURL=FormElementText.js.map
|
@@ -1,14 +1,14 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { FormTypes } from '@oneblink/types';
|
3
|
-
import { FormElementValueChangeHandler } from '../types/form';
|
4
|
-
declare type Props = {
|
5
|
-
id: string;
|
6
|
-
element: FormTypes.TextareaElement;
|
7
|
-
value: unknown;
|
8
|
-
onChange: FormElementValueChangeHandler<string>;
|
9
|
-
displayValidationMessage: boolean;
|
10
|
-
validationMessage: string | undefined;
|
11
|
-
};
|
12
|
-
declare function FormElementTextarea({ id, element, value, onChange, validationMessage, displayValidationMessage, }: Props): JSX.Element;
|
13
|
-
declare const _default: React.MemoExoticComponent<typeof FormElementTextarea>;
|
14
|
-
export default _default;
|
1
|
+
import * as React from 'react';
|
2
|
+
import { FormTypes } from '@oneblink/types';
|
3
|
+
import { FormElementValueChangeHandler } from '../types/form';
|
4
|
+
declare type Props = {
|
5
|
+
id: string;
|
6
|
+
element: FormTypes.TextareaElement;
|
7
|
+
value: unknown;
|
8
|
+
onChange: FormElementValueChangeHandler<string>;
|
9
|
+
displayValidationMessage: boolean;
|
10
|
+
validationMessage: string | undefined;
|
11
|
+
};
|
12
|
+
declare function FormElementTextarea({ id, element, value, onChange, validationMessage, displayValidationMessage, }: Props): JSX.Element;
|
13
|
+
declare const _default: React.MemoExoticComponent<typeof FormElementTextarea>;
|
14
|
+
export default _default;
|