@oneblink/apps-react 0.6.2 → 1.0.0-beta.3
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.js +2 -2
- package/dist/OneBlinkAutoSaveForm.js.map +1 -1
- package/dist/OneBlinkFormBase.js +4 -4
- package/dist/OneBlinkFormBase.js.map +1 -1
- package/dist/components/CopyToClipboardIconButton.d.ts +10 -0
- package/dist/components/CopyToClipboardIconButton.js +33 -0
- package/dist/components/CopyToClipboardIconButton.js.map +1 -0
- package/dist/components/CustomAccordion.d.ts +27 -0
- package/dist/components/CustomAccordion.js +35 -0
- package/dist/components/CustomAccordion.js.map +1 -0
- package/dist/components/ErrorSnackbar.d.ts +8 -0
- package/dist/components/ErrorSnackbar.js +20 -0
- package/dist/components/ErrorSnackbar.js.map +1 -0
- package/dist/components/Lists.d.ts +25 -0
- package/dist/components/Lists.js +45 -0
- package/dist/components/Lists.js.map +1 -0
- package/dist/components/LoadingWithMessage.d.ts +6 -0
- package/dist/components/LoadingWithMessage.js +12 -0
- package/dist/components/LoadingWithMessage.js.map +1 -0
- package/dist/components/formStore/FormStoreTableProvider.d.ts +6 -0
- package/dist/components/formStore/FormStoreTableProvider.js +86 -0
- package/dist/components/formStore/FormStoreTableProvider.js.map +1 -0
- package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.d.ts +5 -0
- package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.js +16 -0
- package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.js.map +1 -0
- package/dist/components/formStore/OneBlinkFormStoreColumnsButton.d.ts +5 -0
- package/dist/components/formStore/OneBlinkFormStoreColumnsButton.js +33 -0
- package/dist/components/formStore/OneBlinkFormStoreColumnsButton.js.map +1 -0
- package/dist/components/formStore/OneBlinkFormStoreDownloadButton.d.ts +5 -0
- package/dist/components/formStore/OneBlinkFormStoreDownloadButton.js +49 -0
- package/dist/components/formStore/OneBlinkFormStoreDownloadButton.js.map +1 -0
- package/dist/components/formStore/OneBlinkFormStoreProvider.d.ts +8 -0
- package/dist/components/formStore/OneBlinkFormStoreProvider.js +25 -0
- package/dist/components/formStore/OneBlinkFormStoreProvider.js.map +1 -0
- package/dist/components/formStore/OneBlinkFormStoreRefreshButton.d.ts +5 -0
- package/dist/components/formStore/OneBlinkFormStoreRefreshButton.js +12 -0
- package/dist/components/formStore/OneBlinkFormStoreRefreshButton.js.map +1 -0
- package/dist/components/formStore/OneBlinkFormStoreTable.d.ts +4 -0
- package/dist/components/formStore/OneBlinkFormStoreTable.js +184 -0
- package/dist/components/formStore/OneBlinkFormStoreTable.js.map +1 -0
- package/dist/components/formStore/display/ElementDisplay.d.ts +23 -0
- package/dist/components/formStore/display/ElementDisplay.js +78 -0
- package/dist/components/formStore/display/ElementDisplay.js.map +1 -0
- package/dist/components/formStore/display/FormStoreIcon.d.ts +2 -0
- package/dist/components/formStore/display/FormStoreIcon.js +3 -0
- package/dist/components/formStore/display/FormStoreIcon.js.map +1 -0
- package/dist/components/formStore/table/ActionedByTableCell.d.ts +11 -0
- package/dist/components/formStore/table/ActionedByTableCell.js +44 -0
- package/dist/components/formStore/table/ActionedByTableCell.js.map +1 -0
- package/dist/components/formStore/table/ColumnFilters.d.ts +9 -0
- package/dist/components/formStore/table/ColumnFilters.js +180 -0
- package/dist/components/formStore/table/ColumnFilters.js.map +1 -0
- package/dist/components/formStore/table/FormElementTableCell.d.ts +10 -0
- package/dist/components/formStore/table/FormElementTableCell.js +215 -0
- package/dist/components/formStore/table/FormElementTableCell.js.map +1 -0
- package/dist/components/formStore/table/HeaderCellMoreButton.d.ts +9 -0
- package/dist/components/formStore/table/HeaderCellMoreButton.js +49 -0
- package/dist/components/formStore/table/HeaderCellMoreButton.js.map +1 -0
- package/dist/components/formStore/table/RepeatableSetCell.d.ts +8 -0
- package/dist/components/formStore/table/RepeatableSetCell.js +61 -0
- package/dist/components/formStore/table/RepeatableSetCell.js.map +1 -0
- package/dist/components/formStore/table/RepeatableSetCellAccordion.d.ts +9 -0
- package/dist/components/formStore/table/RepeatableSetCellAccordion.js +12 -0
- package/dist/components/formStore/table/RepeatableSetCellAccordion.js.map +1 -0
- package/dist/components/formStore/table/TableCellCopyButton.d.ts +7 -0
- package/dist/components/formStore/table/TableCellCopyButton.js +28 -0
- package/dist/components/formStore/table/TableCellCopyButton.js.map +1 -0
- package/dist/components/formStore/table/generateColumns.d.ts +18 -0
- package/dist/components/formStore/table/generateColumns.js +233 -0
- package/dist/components/formStore/table/generateColumns.js.map +1 -0
- package/dist/components/formStore/table/useFormStoreTable.d.ts +52 -0
- package/dist/components/formStore/table/useFormStoreTable.js +139 -0
- package/dist/components/formStore/table/useFormStoreTable.js.map +1 -0
- package/dist/components/formStore/useFormStoreTableContext.d.ts +44 -0
- package/dist/components/formStore/useFormStoreTableContext.js +10 -0
- package/dist/components/formStore/useFormStoreTableContext.js.map +1 -0
- package/dist/components/messages/ErrorMessage.d.ts +12 -0
- package/dist/components/messages/ErrorMessage.js +13 -0
- package/dist/components/messages/ErrorMessage.js.map +1 -0
- package/dist/components/messages/LargeIconMessage.d.ts +15 -0
- package/dist/components/messages/LargeIconMessage.js +38 -0
- package/dist/components/messages/LargeIconMessage.js.map +1 -0
- package/dist/components/messages/NoResourcesYet.d.ts +11 -0
- package/dist/components/messages/NoResourcesYet.js +7 -0
- package/dist/components/messages/NoResourcesYet.js.map +1 -0
- package/dist/components/pickers/V4CompatibleDatePicker.d.ts +30 -0
- package/dist/components/pickers/V4CompatibleDatePicker.js +58 -0
- package/dist/components/pickers/V4CompatibleDatePicker.js.map +1 -0
- package/dist/components/pickers/V4CompatibleDateTimePicker.d.ts +29 -0
- package/dist/components/pickers/V4CompatibleDateTimePicker.js +58 -0
- package/dist/components/pickers/V4CompatibleDateTimePicker.js.map +1 -0
- package/dist/components/pickers/V4CompatibleTimePicker.d.ts +26 -0
- package/dist/components/pickers/V4CompatibleTimePicker.js +41 -0
- package/dist/components/pickers/V4CompatibleTimePicker.js.map +1 -0
- package/dist/components/{AnnotationModal.d.ts → renderer/AnnotationModal.d.ts} +0 -0
- package/dist/components/{AnnotationModal.js → renderer/AnnotationModal.js} +2 -2
- package/dist/components/renderer/AnnotationModal.js.map +1 -0
- package/dist/components/{AutocompleteDropdown.d.ts → renderer/AutocompleteDropdown.d.ts} +0 -0
- package/dist/components/{AutocompleteDropdown.js → renderer/AutocompleteDropdown.js} +1 -1
- package/dist/components/renderer/AutocompleteDropdown.js.map +1 -0
- package/dist/components/{CopyToClipboardButton.d.ts → renderer/CopyToClipboardButton.d.ts} +0 -0
- package/dist/components/{CopyToClipboardButton.js → renderer/CopyToClipboardButton.js} +1 -1
- package/dist/components/renderer/CopyToClipboardButton.js.map +1 -0
- package/dist/components/{CustomisableButtonInner.d.ts → renderer/CustomisableButtonInner.d.ts} +0 -0
- package/dist/components/{CustomisableButtonInner.js → renderer/CustomisableButtonInner.js} +0 -0
- package/dist/components/renderer/CustomisableButtonInner.js.map +1 -0
- package/dist/components/{FormElementLabelContainer.d.ts → renderer/FormElementLabelContainer.d.ts} +0 -0
- package/dist/components/{FormElementLabelContainer.js → renderer/FormElementLabelContainer.js} +0 -0
- package/dist/components/renderer/FormElementLabelContainer.js.map +1 -0
- package/dist/components/{FormElementOptions.d.ts → renderer/FormElementOptions.d.ts} +0 -0
- package/dist/components/{FormElementOptions.js → renderer/FormElementOptions.js} +0 -0
- package/dist/components/renderer/FormElementOptions.js.map +1 -0
- package/dist/components/{LookupButton.d.ts → renderer/LookupButton.d.ts} +0 -0
- package/dist/components/{LookupButton.js → renderer/LookupButton.js} +3 -3
- package/dist/components/renderer/LookupButton.js.map +1 -0
- package/dist/components/{LookupNotification.d.ts → renderer/LookupNotification.d.ts} +1 -1
- package/dist/components/{LookupNotification.js → renderer/LookupNotification.js} +9 -9
- package/dist/components/renderer/LookupNotification.js.map +1 -0
- package/dist/components/{Modal.d.ts → renderer/Modal.d.ts} +0 -0
- package/dist/components/{Modal.js → renderer/Modal.js} +0 -0
- package/dist/components/renderer/Modal.js.map +1 -0
- package/dist/components/{OnLoading.d.ts → renderer/OnLoading.d.ts} +0 -0
- package/dist/components/{OnLoading.js → renderer/OnLoading.js} +0 -0
- package/dist/components/renderer/OnLoading.js.map +1 -0
- package/dist/components/{OneBlinkAppsErrorOriginalMessage.d.ts → renderer/OneBlinkAppsErrorOriginalMessage.d.ts} +0 -0
- package/dist/components/{OneBlinkAppsErrorOriginalMessage.js → renderer/OneBlinkAppsErrorOriginalMessage.js} +0 -0
- package/dist/components/renderer/OneBlinkAppsErrorOriginalMessage.js.map +1 -0
- package/dist/components/{OneBlinkFormElements.d.ts → renderer/OneBlinkFormElements.d.ts} +1 -1
- package/dist/components/{OneBlinkFormElements.js → renderer/OneBlinkFormElements.js} +36 -36
- package/dist/components/renderer/OneBlinkFormElements.js.map +1 -0
- package/dist/components/{PageFormElements.d.ts → renderer/PageFormElements.d.ts} +1 -1
- package/dist/components/{PageFormElements.js → renderer/PageFormElements.js} +3 -3
- package/dist/components/renderer/PageFormElements.js.map +1 -0
- package/dist/components/{ToggleAllCheckbox.d.ts → renderer/ToggleAllCheckbox.d.ts} +1 -1
- package/dist/components/{ToggleAllCheckbox.js → renderer/ToggleAllCheckbox.js} +0 -0
- package/dist/components/renderer/ToggleAllCheckbox.js.map +1 -0
- package/dist/components/{attachments → renderer/attachments}/AttachmentStatus.d.ts +0 -0
- package/dist/components/{attachments → renderer/attachments}/AttachmentStatus.js +1 -1
- package/dist/components/renderer/attachments/AttachmentStatus.js.map +1 -0
- package/dist/components/{attachments → renderer/attachments}/FileCard.d.ts +0 -0
- package/dist/components/{attachments → renderer/attachments}/FileCard.js +4 -4
- package/dist/components/renderer/attachments/FileCard.js.map +1 -0
- package/dist/components/{attachments → renderer/attachments}/FileCardContent.d.ts +0 -0
- package/dist/components/{attachments → renderer/attachments}/FileCardContent.js +0 -0
- package/dist/components/renderer/attachments/FileCardContent.js.map +1 -0
- package/dist/components/{attachments → renderer/attachments}/Files.d.ts +0 -0
- package/dist/components/{attachments → renderer/attachments}/Files.js +0 -0
- package/dist/components/renderer/attachments/Files.js.map +1 -0
- package/dist/components/{attachments → renderer/attachments}/ImagePreviewUnavailable.d.ts +0 -0
- package/dist/components/{attachments → renderer/attachments}/ImagePreviewUnavailable.js +1 -1
- package/dist/components/renderer/attachments/ImagePreviewUnavailable.js.map +1 -0
- package/dist/components/{attachments → renderer/attachments}/UploadingAttachment.d.ts +0 -0
- package/dist/components/{attachments → renderer/attachments}/UploadingAttachment.js +1 -1
- package/dist/components/renderer/attachments/UploadingAttachment.js.map +1 -0
- package/dist/form-elements/FormElementABN.js +3 -3
- package/dist/form-elements/FormElementABN.js.map +1 -1
- package/dist/form-elements/FormElementAutocomplete.js +3 -3
- package/dist/form-elements/FormElementAutocomplete.js.map +1 -1
- package/dist/form-elements/FormElementBSB.js +3 -3
- package/dist/form-elements/FormElementBSB.js.map +1 -1
- package/dist/form-elements/FormElementBarcodeScanner.js +4 -4
- package/dist/form-elements/FormElementBarcodeScanner.js.map +1 -1
- package/dist/form-elements/FormElementBoolean.js +1 -1
- package/dist/form-elements/FormElementBoolean.js.map +1 -1
- package/dist/form-elements/FormElementCamera.js +6 -6
- package/dist/form-elements/FormElementCamera.js.map +1 -1
- package/dist/form-elements/FormElementCheckBoxes.js +4 -4
- package/dist/form-elements/FormElementCheckBoxes.js.map +1 -1
- package/dist/form-elements/FormElementCivicaStreetName.js +2 -2
- package/dist/form-elements/FormElementCivicaStreetName.js.map +1 -1
- package/dist/form-elements/FormElementCompliance.js +2 -2
- package/dist/form-elements/FormElementCompliance.js.map +1 -1
- package/dist/form-elements/FormElementDate.js +4 -4
- package/dist/form-elements/FormElementDate.js.map +1 -1
- package/dist/form-elements/FormElementDateTime.js +4 -4
- package/dist/form-elements/FormElementDateTime.js.map +1 -1
- package/dist/form-elements/FormElementEmail.js +3 -3
- package/dist/form-elements/FormElementEmail.js.map +1 -1
- package/dist/form-elements/FormElementFiles/FormElementFile.js +1 -1
- package/dist/form-elements/FormElementFiles/FormElementFile.js.map +1 -1
- package/dist/form-elements/FormElementFiles/FormElementFiles.js +1 -1
- package/dist/form-elements/FormElementFiles/FormElementFiles.js.map +1 -1
- package/dist/form-elements/FormElementFiles/legacy/FormElementFiles.js +2 -2
- package/dist/form-elements/FormElementFiles/legacy/FormElementFiles.js.map +1 -1
- package/dist/form-elements/FormElementForm.js +1 -1
- package/dist/form-elements/FormElementForm.js.map +1 -1
- package/dist/form-elements/FormElementGeoscapeAddress.js +2 -2
- package/dist/form-elements/FormElementGeoscapeAddress.js.map +1 -1
- package/dist/form-elements/FormElementLocation.js +2 -2
- package/dist/form-elements/FormElementLocation.js.map +1 -1
- package/dist/form-elements/FormElementNumber.js +3 -3
- package/dist/form-elements/FormElementNumber.js.map +1 -1
- package/dist/form-elements/FormElementPointAddress.js +2 -2
- package/dist/form-elements/FormElementPointAddress.js.map +1 -1
- package/dist/form-elements/FormElementRadio.js +2 -2
- package/dist/form-elements/FormElementRadio.js.map +1 -1
- package/dist/form-elements/FormElementRepeatableSet.js +3 -3
- package/dist/form-elements/FormElementRepeatableSet.js.map +1 -1
- package/dist/form-elements/FormElementSection.d.ts +1 -1
- package/dist/form-elements/FormElementSection.js +1 -1
- package/dist/form-elements/FormElementSection.js.map +1 -1
- package/dist/form-elements/FormElementSelect.js +4 -4
- package/dist/form-elements/FormElementSelect.js.map +1 -1
- package/dist/form-elements/FormElementSignature.js +4 -4
- package/dist/form-elements/FormElementSignature.js.map +1 -1
- package/dist/form-elements/FormElementTelephone.js +3 -3
- package/dist/form-elements/FormElementTelephone.js.map +1 -1
- package/dist/form-elements/FormElementText.js +3 -3
- package/dist/form-elements/FormElementText.js.map +1 -1
- package/dist/form-elements/FormElementTextarea.js +3 -3
- package/dist/form-elements/FormElementTextarea.js.map +1 -1
- package/dist/form-elements/FormElementTime.js +4 -4
- package/dist/form-elements/FormElementTime.js.map +1 -1
- package/dist/hooks/useInfiniteScrollDataLoad.d.ts +28 -0
- package/dist/hooks/useInfiniteScrollDataLoad.js +118 -0
- package/dist/hooks/useInfiniteScrollDataLoad.js.map +1 -0
- package/dist/hooks/useIsHovering.d.ts +5 -0
- package/dist/hooks/useIsHovering.js +13 -0
- package/dist/hooks/useIsHovering.js.map +1 -0
- package/dist/hooks/useQuery.d.ts +2 -0
- package/dist/hooks/useQuery.js +8 -0
- package/dist/hooks/useQuery.js.map +1 -0
- package/dist/hooks/useSubmissionIdIsValid.d.ts +3 -0
- package/dist/hooks/useSubmissionIdIsValid.js +20 -0
- package/dist/hooks/useSubmissionIdIsValid.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/services/defaultCoordinates.js +1 -1
- package/dist/services/defaultCoordinates.js.map +1 -1
- package/dist/services/generate-default-data.js +1 -1
- package/dist/services/generate-default-data.js.map +1 -1
- package/package.json +13 -4
- package/dist/components/AnnotationModal.js.map +0 -1
- package/dist/components/AutocompleteDropdown.js.map +0 -1
- package/dist/components/CopyToClipboardButton.js.map +0 -1
- package/dist/components/CustomisableButtonInner.js.map +0 -1
- package/dist/components/FormElementLabelContainer.js.map +0 -1
- package/dist/components/FormElementOptions.js.map +0 -1
- package/dist/components/LookupButton.js.map +0 -1
- package/dist/components/LookupNotification.js.map +0 -1
- package/dist/components/Modal.js.map +0 -1
- package/dist/components/OnLoading.js.map +0 -1
- package/dist/components/OneBlinkAppsErrorOriginalMessage.js.map +0 -1
- package/dist/components/OneBlinkFormElements.js.map +0 -1
- package/dist/components/PageFormElements.js.map +0 -1
- package/dist/components/ToggleAllCheckbox.js.map +0 -1
- package/dist/components/attachments/AttachmentStatus.js.map +0 -1
- package/dist/components/attachments/FileCard.js.map +0 -1
- package/dist/components/attachments/FileCardContent.js.map +0 -1
- package/dist/components/attachments/Files.js.map +0 -1
- package/dist/components/attachments/ImagePreviewUnavailable.js.map +0 -1
- package/dist/components/attachments/UploadingAttachment.js.map +0 -1
@@ -0,0 +1 @@
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 'react'\nimport { Typography, Grid, Container } from '@mui/material'\nimport { styled } from '@mui/material/styles'\n\ntype Variant = 'primary' | 'success' | 'error' | 'warning'\nexport type Props = {\n IconComponent: React.ComponentType<{ color: Variant }>\n title: string\n variant: Variant\n gutterTop?: boolean\n gutterBottom?: boolean\n children?: React.ReactNode\n action?: React.ReactNode\n}\n\nfunction LargeIconMessage({\n IconComponent,\n title,\n variant,\n gutterTop,\n gutterBottom,\n children,\n action,\n}: Props) {\n const Icon = React.useMemo(() => {\n return styled(IconComponent)(({ theme }) => ({\n fontSize: theme.spacing(16),\n }))\n }, [IconComponent])\n\n return (\n <Container maxWidth=\"sm\">\n <StyledIconContainer gutterTop={gutterTop}>\n <Icon color={variant} />\n </StyledIconContainer>\n <Typography variant=\"h5\" align=\"center\" gutterBottom color={variant}>\n {title}\n </Typography>\n {children ? (\n <StyledTypography\n align=\"center\"\n variant=\"body2\"\n paragraph={!!action}\n gutterBottom={!action && gutterBottom}\n >\n {children}\n </StyledTypography>\n ) : null}\n {action && (\n <StyledGrid\n container\n justifyContent=\"center\"\n gutterBottom={gutterBottom}\n >\n {action}\n </StyledGrid>\n )}\n </Container>\n )\n}\n\nexport default React.memo<Props>(LargeIconMessage)\n\nconst StyledIconContainer = styled('div', {\n shouldForwardProp: (prop) => prop !== 'gutterTop',\n})<{\n gutterTop?: boolean\n}>(({ theme, gutterTop }) => ({\n textAlign: 'center',\n ...(gutterTop\n ? {\n paddingTop: theme.spacing(4),\n }\n : {}),\n}))\n\nconst StyledTypography = styled(Typography, {\n shouldForwardProp: (prop) => prop !== 'gutterBottom',\n})<React.ComponentProps<typeof Typography>>(({ theme, gutterBottom }) => ({\n ...(gutterBottom ? { marginBottom: theme.spacing(4) } : {}),\n}))\n\nconst StyledGrid = styled(Grid, {\n shouldForwardProp: (prop) => prop !== 'gutterBottom',\n})<{ gutterBottom?: boolean }>(({ theme, gutterBottom }) => ({\n ...(gutterBottom ? { marginBottom: theme.spacing(4) } : {}),\n}))\n"]}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { Props as LargeIconMessageProps } from './LargeIconMessage';
|
3
|
+
declare type Props = {
|
4
|
+
IconComponent: LargeIconMessageProps['IconComponent'];
|
5
|
+
title: string;
|
6
|
+
gutterBottom?: boolean;
|
7
|
+
children?: React.ReactNode;
|
8
|
+
};
|
9
|
+
export declare function NoResourcesYet({ title, children, IconComponent, gutterBottom, }: Props): JSX.Element;
|
10
|
+
declare const _default: React.NamedExoticComponent<Props>;
|
11
|
+
export default _default;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import LargeIconMessage from './LargeIconMessage';
|
3
|
+
export function NoResourcesYet({ title, children, IconComponent, gutterBottom, }) {
|
4
|
+
return (React.createElement(LargeIconMessage, { IconComponent: IconComponent, title: title, variant: "primary", gutterBottom: gutterBottom, gutterTop: true }, children));
|
5
|
+
}
|
6
|
+
export default React.memo(NoResourcesYet);
|
7
|
+
//# sourceMappingURL=NoResourcesYet.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"NoResourcesYet.js","sourceRoot":"","sources":["../../../src/components/messages/NoResourcesYet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,gBAEN,MAAM,oBAAoB,CAAA;AAO3B,MAAM,UAAU,cAAc,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,aAAa,EACb,YAAY,GACN;IACN,OAAO,CACL,oBAAC,gBAAgB,IACf,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAC,SAAS,EACjB,YAAY,EAAE,YAAY,EAC1B,SAAS,UAER,QAAQ,CACQ,CACpB,CAAA;AACH,CAAC;AACD,eAAe,KAAK,CAAC,IAAI,CAAQ,cAAc,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport LargeIconMessage, {\n Props as LargeIconMessageProps,\n} from './LargeIconMessage'\ntype Props = {\n IconComponent: LargeIconMessageProps['IconComponent']\n title: string\n gutterBottom?: boolean\n children?: React.ReactNode\n}\nexport function NoResourcesYet({\n title,\n children,\n IconComponent,\n gutterBottom,\n}: Props) {\n return (\n <LargeIconMessage\n IconComponent={IconComponent}\n title={title}\n variant=\"primary\"\n gutterBottom={gutterBottom}\n gutterTop\n >\n {children}\n </LargeIconMessage>\n )\n}\nexport default React.memo<Props>(NoResourcesYet)\n"]}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { MobileDatePickerProps } from '@mui/x-date-pickers';
|
3
|
+
import { TextField, IconButton } from '@mui/material';
|
4
|
+
declare type RemainingPickerProps = Omit<MobileDatePickerProps<Date>, 'onError' | 'renderInput' | 'toolbarFormat' | 'rightArrowIcon' | 'leftArrowIcon' | 'maxDate' | 'minDate' | 'inputFormat'>;
|
5
|
+
declare type TextFieldProps = React.ComponentProps<typeof TextField>;
|
6
|
+
declare type IconButtonProps = React.ComponentProps<typeof IconButton>;
|
7
|
+
declare type Props = RemainingPickerProps & {
|
8
|
+
name?: string;
|
9
|
+
label?: string;
|
10
|
+
maxDate?: string | Date;
|
11
|
+
maxDateMessage?: string;
|
12
|
+
minDate?: string | Date;
|
13
|
+
minDateMessage?: string;
|
14
|
+
margin?: TextFieldProps['margin'];
|
15
|
+
size?: TextFieldProps['size'];
|
16
|
+
placeholder?: string;
|
17
|
+
InputProps?: TextFieldProps['InputProps'];
|
18
|
+
inputVariant?: TextFieldProps['variant'];
|
19
|
+
onBlur?: TextFieldProps['onBlur'];
|
20
|
+
startIconButton?: boolean;
|
21
|
+
endIconButton?: boolean;
|
22
|
+
iconButtonEdge?: IconButtonProps['edge'];
|
23
|
+
iconButtonSize?: IconButtonProps['size'];
|
24
|
+
helperText?: string | React.ReactNode;
|
25
|
+
error?: boolean;
|
26
|
+
required?: boolean;
|
27
|
+
'data-cypress'?: string;
|
28
|
+
};
|
29
|
+
declare const _default: React.NamedExoticComponent<Props>;
|
30
|
+
export default _default;
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { MobileDatePicker } from '@mui/x-date-pickers';
|
3
|
+
import { TextField, InputAdornment, IconButton } from '@mui/material';
|
4
|
+
import { DateRange } from '@mui/icons-material';
|
5
|
+
import useBooleanState from '../../hooks/useBooleanState';
|
6
|
+
import { localisationService } from '@oneblink/apps';
|
7
|
+
const emptyFn = () => {
|
8
|
+
//
|
9
|
+
};
|
10
|
+
const V4CompatibleDatePicker = ({ name, label, maxDate, maxDateMessage, minDate, minDateMessage, margin, size, placeholder, InputProps, onChange, inputVariant, onBlur, disabled, startIconButton, endIconButton, iconButtonEdge, iconButtonSize, helperText: helperTextProp, error, required, 'data-cypress': dataCypress, ...rest }) => {
|
11
|
+
const [isOpen, setIsOpen, setIsClosed] = useBooleanState(false);
|
12
|
+
const [helperText, setHelperText] = React.useState(undefined);
|
13
|
+
const handleError = React.useCallback((error) => {
|
14
|
+
switch (error) {
|
15
|
+
case 'invalidDate': {
|
16
|
+
return setHelperText('Invalid Date Time');
|
17
|
+
}
|
18
|
+
case 'maxDate': {
|
19
|
+
return setHelperText(maxDateMessage);
|
20
|
+
}
|
21
|
+
case 'minDate': {
|
22
|
+
return setHelperText(minDateMessage);
|
23
|
+
}
|
24
|
+
default: {
|
25
|
+
return setHelperText(undefined);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}, [maxDateMessage, minDateMessage]);
|
29
|
+
const convertedMaxDate = React.useMemo(() => {
|
30
|
+
if (typeof maxDate === 'string') {
|
31
|
+
return new Date(maxDate);
|
32
|
+
}
|
33
|
+
}, [maxDate]);
|
34
|
+
const convertedMinDate = React.useMemo(() => {
|
35
|
+
if (typeof minDate === 'string') {
|
36
|
+
return new Date(minDate);
|
37
|
+
}
|
38
|
+
}, [minDate]);
|
39
|
+
const onAccept = React.useCallback((date) => {
|
40
|
+
const currentValue = rest.value instanceof Date ? rest.value.toISOString() : rest.value;
|
41
|
+
if (currentValue !== ((date === null || date === void 0 ? void 0 : date.toISOString()) || null)) {
|
42
|
+
onChange(date);
|
43
|
+
}
|
44
|
+
}, [onChange, rest.value]);
|
45
|
+
return (React.createElement(MobileDatePicker, { open: isOpen, onOpen: setIsOpen, onClose: setIsClosed, renderInput: (props) => (React.createElement(TextField, { ...props, name: name, label: label, required: required, helperText: helperTextProp || helperText, ...(error ? { error } : {}), fullWidth: true, margin: margin, size: size, placeholder: placeholder, variant: inputVariant, onBlur: onBlur, InputProps: {
|
46
|
+
startAdornment: startIconButton ? (React.createElement(InputAdornment, { position: "start" },
|
47
|
+
React.createElement(IconButton, { edge: iconButtonEdge, size: iconButtonSize, onClick: setIsOpen, disabled: disabled },
|
48
|
+
React.createElement(DateRange, null)))) : undefined,
|
49
|
+
endAdornment: endIconButton ? (React.createElement(InputAdornment, { position: "end" },
|
50
|
+
React.createElement(IconButton, { edge: iconButtonEdge, size: iconButtonSize, onClick: setIsOpen, disabled: disabled },
|
51
|
+
React.createElement(DateRange, null)))) : undefined,
|
52
|
+
...(InputProps ? InputProps : {}),
|
53
|
+
}, "data-cypress": dataCypress })), maxDate: convertedMaxDate, minDate: convertedMinDate, onError: handleError,
|
54
|
+
// This triggers everytime a component of the while date changes within the picker
|
55
|
+
onChange: emptyFn, onAccept: onAccept, inputFormat: localisationService.getDateFnsFormats().shortDateTime, disabled: disabled, ...rest }));
|
56
|
+
};
|
57
|
+
export default React.memo(V4CompatibleDatePicker);
|
58
|
+
//# sourceMappingURL=V4CompatibleDatePicker.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"V4CompatibleDatePicker.js","sourceRoot":"","sources":["../../../src/components/pickers/V4CompatibleDatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,gBAAgB,EAAyB,MAAM,qBAAqB,CAAA;AAC7E,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,MAA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SAAS,QACT,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE;gBACV,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC,CAChC,oBAAC,cAAc,IAAC,QAAQ,EAAC,OAAO;oBAC9B,oBAAC,UAAU,IACT,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,SAAS,EAClB,QAAQ,EAAE,QAAQ;wBAElB,oBAAC,SAAS,OAAG,CACF,CACE,CAClB,CAAC,CAAC,CAAC,SAAS;gBACb,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC,CAC5B,oBAAC,cAAc,IAAC,QAAQ,EAAC,KAAK;oBAC5B,oBAAC,UAAU,IACT,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,SAAS,EAClB,QAAQ,EAAE,QAAQ;wBAElB,oBAAC,SAAS,OAAG,CACF,CACE,CAClB,CAAC,CAAC,CAAC,SAAS;gBACb,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;aAClC,kBACa,WAAW,GACzB,CACH,EACD,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,WAAW;QACpB,kFAAkF;QAClF,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,mBAAmB,CAAC,iBAAiB,EAAE,CAAC,aAAa,EAClE,QAAQ,EAAE,QAAQ,KACd,IAAI,GACR,CACH,CAAA;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAC,IAAI,CAAQ,sBAAsB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { MobileDatePicker, MobileDatePickerProps } from '@mui/x-date-pickers'\nimport { TextField, InputAdornment, IconButton } from '@mui/material'\nimport { DateRange } from '@mui/icons-material'\nimport useBooleanState from '../../hooks/useBooleanState'\nimport { localisationService } from '@oneblink/apps'\n\ntype RemainingPickerProps = Omit<\n MobileDatePickerProps<Date>,\n | 'onError'\n | 'renderInput'\n | 'toolbarFormat'\n | 'rightArrowIcon'\n | 'leftArrowIcon'\n | 'maxDate'\n | 'minDate'\n | 'inputFormat'\n>\n\ntype TextFieldProps = React.ComponentProps<typeof TextField>\ntype IconButtonProps = React.ComponentProps<typeof IconButton>\n\ntype Props = RemainingPickerProps & {\n name?: string\n label?: string\n maxDate?: string | Date\n maxDateMessage?: string\n minDate?: string | Date\n minDateMessage?: string\n margin?: TextFieldProps['margin']\n size?: TextFieldProps['size']\n placeholder?: string\n InputProps?: TextFieldProps['InputProps']\n inputVariant?: TextFieldProps['variant']\n onBlur?: TextFieldProps['onBlur']\n startIconButton?: boolean\n endIconButton?: boolean\n iconButtonEdge?: IconButtonProps['edge']\n iconButtonSize?: IconButtonProps['size']\n helperText?: string | React.ReactNode\n error?: boolean\n required?: boolean\n 'data-cypress'?: string\n}\n\nconst emptyFn = () => {\n //\n}\nconst V4CompatibleDatePicker = ({\n name,\n label,\n maxDate,\n maxDateMessage,\n minDate,\n minDateMessage,\n margin,\n size,\n placeholder,\n InputProps,\n onChange,\n inputVariant,\n onBlur,\n disabled,\n startIconButton,\n endIconButton,\n iconButtonEdge,\n iconButtonSize,\n helperText: helperTextProp,\n error,\n required,\n 'data-cypress': dataCypress,\n ...rest\n}: Props) => {\n const [isOpen, setIsOpen, setIsClosed] = useBooleanState(false)\n const [helperText, setHelperText] = React.useState<string | undefined>(\n undefined,\n )\n const handleError = React.useCallback(\n (error: Parameters<Required<MobileDatePickerProps>['onError']>[0]) => {\n switch (error) {\n case 'invalidDate': {\n return setHelperText('Invalid Date Time')\n }\n case 'maxDate': {\n return setHelperText(maxDateMessage)\n }\n case 'minDate': {\n return setHelperText(minDateMessage)\n }\n default: {\n return setHelperText(undefined)\n }\n }\n },\n [maxDateMessage, minDateMessage],\n )\n\n const convertedMaxDate = React.useMemo(() => {\n if (typeof maxDate === 'string') {\n return new Date(maxDate)\n }\n }, [maxDate])\n const convertedMinDate = React.useMemo(() => {\n if (typeof minDate === 'string') {\n return new Date(minDate)\n }\n }, [minDate])\n\n const onAccept = React.useCallback(\n (date: Date | null) => {\n const currentValue =\n rest.value instanceof Date ? rest.value.toISOString() : rest.value\n\n if (currentValue !== (date?.toISOString() || null)) {\n onChange(date)\n }\n },\n [onChange, rest.value],\n )\n\n return (\n <MobileDatePicker\n open={isOpen}\n onOpen={setIsOpen}\n onClose={setIsClosed}\n renderInput={(props) => (\n <TextField\n {...props}\n name={name}\n label={label}\n required={required}\n helperText={helperTextProp || helperText}\n {...(error ? { error } : {})}\n fullWidth\n margin={margin}\n size={size}\n placeholder={placeholder}\n variant={inputVariant}\n onBlur={onBlur}\n InputProps={{\n startAdornment: startIconButton ? (\n <InputAdornment position=\"start\">\n <IconButton\n edge={iconButtonEdge}\n size={iconButtonSize}\n onClick={setIsOpen}\n disabled={disabled}\n >\n <DateRange />\n </IconButton>\n </InputAdornment>\n ) : undefined,\n endAdornment: endIconButton ? (\n <InputAdornment position=\"end\">\n <IconButton\n edge={iconButtonEdge}\n size={iconButtonSize}\n onClick={setIsOpen}\n disabled={disabled}\n >\n <DateRange />\n </IconButton>\n </InputAdornment>\n ) : undefined,\n ...(InputProps ? InputProps : {}),\n }}\n data-cypress={dataCypress}\n />\n )}\n maxDate={convertedMaxDate}\n minDate={convertedMinDate}\n onError={handleError}\n // This triggers everytime a component of the while date changes within the picker\n onChange={emptyFn}\n onAccept={onAccept}\n inputFormat={localisationService.getDateFnsFormats().shortDateTime}\n disabled={disabled}\n {...rest}\n />\n )\n}\n\nexport default React.memo<Props>(V4CompatibleDatePicker)\n"]}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { MobileDateTimePickerProps } from '@mui/x-date-pickers';
|
3
|
+
import { TextField, IconButton } from '@mui/material';
|
4
|
+
declare type RemainingPickerProps = Omit<MobileDateTimePickerProps<Date>, 'onError' | 'renderInput' | 'toolbarFormat' | 'timeIcon' | 'dateRangeIcon' | 'rightArrowIcon' | 'leftArrowIcon' | 'maxDate' | 'minDate' | 'inputFormat'>;
|
5
|
+
declare type TextFieldProps = React.ComponentProps<typeof TextField>;
|
6
|
+
declare type IconButtonProps = React.ComponentProps<typeof IconButton>;
|
7
|
+
declare type Props = RemainingPickerProps & {
|
8
|
+
name?: string;
|
9
|
+
label?: string;
|
10
|
+
maxDate?: string | Date;
|
11
|
+
maxDateMessage?: string;
|
12
|
+
minDate?: string | Date;
|
13
|
+
minDateMessage?: string;
|
14
|
+
margin?: TextFieldProps['margin'];
|
15
|
+
size?: TextFieldProps['size'];
|
16
|
+
placeholder?: string;
|
17
|
+
InputProps?: TextFieldProps['InputProps'];
|
18
|
+
inputVariant?: TextFieldProps['variant'];
|
19
|
+
startIconButton?: boolean;
|
20
|
+
endIconButton?: boolean;
|
21
|
+
iconButtonEdge?: IconButtonProps['edge'];
|
22
|
+
iconButtonSize?: IconButtonProps['size'];
|
23
|
+
helperText?: string;
|
24
|
+
error?: boolean;
|
25
|
+
required?: boolean;
|
26
|
+
'data-cypress'?: string;
|
27
|
+
};
|
28
|
+
declare const _default: React.NamedExoticComponent<Props>;
|
29
|
+
export default _default;
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { MobileDateTimePicker, } from '@mui/x-date-pickers';
|
3
|
+
import { TextField, InputAdornment, IconButton } from '@mui/material';
|
4
|
+
import { AccessTime, DateRange } from '@mui/icons-material';
|
5
|
+
import useBooleanState from '../../hooks/useBooleanState';
|
6
|
+
import { localisationService } from '@oneblink/apps';
|
7
|
+
const emptyFn = () => {
|
8
|
+
//
|
9
|
+
};
|
10
|
+
const V4CompatibleDateTimePicker = ({ name, label, maxDate, maxDateMessage, minDate, minDateMessage, margin, size, placeholder, InputProps, onChange, inputVariant, disabled, startIconButton, endIconButton, iconButtonEdge, iconButtonSize, helperText: helperTextProp, error, required, 'data-cypress': dataCypress, ...rest }) => {
|
11
|
+
const [isOpen, setIsOpen, setIsClosed] = useBooleanState(false);
|
12
|
+
const [helperText, setHelperText] = React.useState(undefined);
|
13
|
+
const handleError = React.useCallback((error) => {
|
14
|
+
switch (error) {
|
15
|
+
case 'invalidDate': {
|
16
|
+
return setHelperText('Invalid Date Time');
|
17
|
+
}
|
18
|
+
case 'maxDate': {
|
19
|
+
return setHelperText(maxDateMessage);
|
20
|
+
}
|
21
|
+
case 'minDate': {
|
22
|
+
return setHelperText(minDateMessage);
|
23
|
+
}
|
24
|
+
default: {
|
25
|
+
return setHelperText(undefined);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}, [maxDateMessage, minDateMessage]);
|
29
|
+
const convertedMaxDate = React.useMemo(() => {
|
30
|
+
if (typeof maxDate === 'string') {
|
31
|
+
return new Date(maxDate);
|
32
|
+
}
|
33
|
+
}, [maxDate]);
|
34
|
+
const convertedMinDate = React.useMemo(() => {
|
35
|
+
if (typeof minDate === 'string') {
|
36
|
+
return new Date(minDate);
|
37
|
+
}
|
38
|
+
}, [minDate]);
|
39
|
+
const onAccept = React.useCallback((date) => {
|
40
|
+
const currentValue = rest.value instanceof Date ? rest.value.toISOString() : rest.value;
|
41
|
+
if (currentValue !== ((date === null || date === void 0 ? void 0 : date.toISOString()) || null)) {
|
42
|
+
onChange(date);
|
43
|
+
}
|
44
|
+
}, [onChange, rest.value]);
|
45
|
+
return (React.createElement(MobileDateTimePicker, { open: isOpen, onOpen: setIsOpen, onClose: setIsClosed, renderInput: (props) => (React.createElement(TextField, { ...props, name: name, label: label, required: required, helperText: helperTextProp || helperText, ...(error ? { error } : {}), fullWidth: true, margin: margin, size: size, placeholder: placeholder, variant: inputVariant, InputProps: {
|
46
|
+
startAdornment: startIconButton ? (React.createElement(InputAdornment, { position: "start" },
|
47
|
+
React.createElement(IconButton, { edge: iconButtonEdge, size: iconButtonSize, onClick: setIsOpen, disabled: disabled },
|
48
|
+
React.createElement(DateRange, null)))) : undefined,
|
49
|
+
endAdornment: endIconButton ? (React.createElement(InputAdornment, { position: "end" },
|
50
|
+
React.createElement(IconButton, { edge: iconButtonEdge, size: iconButtonSize, onClick: setIsOpen, disabled: disabled },
|
51
|
+
React.createElement(DateRange, null)))) : undefined,
|
52
|
+
...(InputProps ? InputProps : {}),
|
53
|
+
}, "data-cypress": dataCypress })), maxDate: convertedMaxDate, minDate: convertedMinDate, onError: handleError, timeIcon: React.createElement(AccessTime, null), dateRangeIcon: React.createElement(DateRange, null),
|
54
|
+
// This triggers everytime a component of the while date changes within the picker
|
55
|
+
onChange: emptyFn, onAccept: onAccept, inputFormat: localisationService.getDateFnsFormats().shortDateTime, disabled: disabled, ...rest }));
|
56
|
+
};
|
57
|
+
export default React.memo(V4CompatibleDateTimePicker);
|
58
|
+
//# sourceMappingURL=V4CompatibleDateTimePicker.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"V4CompatibleDateTimePicker.js","sourceRoot":"","sources":["../../../src/components/pickers/V4CompatibleDateTimePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,oBAAoB,GAErB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AACrE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,eAAe,MAAM,6BAA6B,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAyCpD,MAAM,OAAO,GAAG,GAAG,EAAE;IACnB,EAAE;AACJ,CAAC,CAAA;AACD,MAAM,0BAA0B,GAAG,CAAC,EAClC,IAAI,EACJ,KAAK,EACL,OAAO,EACP,cAAc,EACd,OAAO,EACP,cAAc,EACd,MAAM,EACN,IAAI,EACJ,WAAW,EACX,U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CAAC,SAAS;gBACb,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC,CAC5B,oBAAC,cAAc,IAAC,QAAQ,EAAC,KAAK;oBAC5B,oBAAC,UAAU,IACT,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,SAAS,EAClB,QAAQ,EAAE,QAAQ;wBAElB,oBAAC,SAAS,OAAG,CACF,CACE,CAClB,CAAC,CAAC,CAAC,SAAS;gBACb,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;aAClC,kBACa,WAAW,GACzB,CACH,EACD,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,oBAAC,UAAU,OAAG,EACxB,aAAa,EAAE,oBAAC,SAAS,OAAG;QAC5B,kFAAkF;QAClF,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,mBAAmB,CAAC,iBAAiB,EAAE,CAAC,aAAa,EAClE,QAAQ,EAAE,QAAQ,KACd,IAAI,GACR,CACH,CAAA;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAC,IAAI,CAAQ,0BAA0B,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport {\n MobileDateTimePicker,\n MobileDateTimePickerProps,\n} from '@mui/x-date-pickers'\nimport { TextField, InputAdornment, IconButton } from '@mui/material'\nimport { AccessTime, DateRange } from '@mui/icons-material'\nimport useBooleanState from '../../hooks/useBooleanState'\nimport { localisationService } from '@oneblink/apps'\n\ntype RemainingPickerProps = Omit<\n MobileDateTimePickerProps<Date>,\n | 'onError'\n | 'renderInput'\n | 'toolbarFormat'\n | 'timeIcon'\n | 'dateRangeIcon'\n | 'rightArrowIcon'\n | 'leftArrowIcon'\n | 'maxDate'\n | 'minDate'\n | 'inputFormat'\n>\n\ntype TextFieldProps = React.ComponentProps<typeof TextField>\ntype IconButtonProps = React.ComponentProps<typeof IconButton>\n\ntype Props = RemainingPickerProps & {\n name?: string\n label?: string\n maxDate?: string | Date\n maxDateMessage?: string\n minDate?: string | Date\n minDateMessage?: string\n margin?: TextFieldProps['margin']\n size?: TextFieldProps['size']\n placeholder?: string\n InputProps?: TextFieldProps['InputProps']\n inputVariant?: TextFieldProps['variant']\n startIconButton?: boolean\n endIconButton?: boolean\n iconButtonEdge?: IconButtonProps['edge']\n iconButtonSize?: IconButtonProps['size']\n helperText?: string\n error?: boolean\n required?: boolean\n 'data-cypress'?: string\n}\n\nconst emptyFn = () => {\n //\n}\nconst V4CompatibleDateTimePicker = ({\n name,\n label,\n maxDate,\n maxDateMessage,\n minDate,\n minDateMessage,\n margin,\n size,\n placeholder,\n InputProps,\n onChange,\n inputVariant,\n disabled,\n startIconButton,\n endIconButton,\n iconButtonEdge,\n iconButtonSize,\n helperText: helperTextProp,\n error,\n required,\n 'data-cypress': dataCypress,\n ...rest\n}: Props) => {\n const [isOpen, setIsOpen, setIsClosed] = useBooleanState(false)\n const [helperText, setHelperText] = React.useState<string | undefined>(\n undefined,\n )\n const handleError = React.useCallback(\n (error: Parameters<Required<MobileDateTimePickerProps>['onError']>[0]) => {\n switch (error) {\n case 'invalidDate': {\n return setHelperText('Invalid Date Time')\n }\n case 'maxDate': {\n return setHelperText(maxDateMessage)\n }\n case 'minDate': {\n return setHelperText(minDateMessage)\n }\n default: {\n return setHelperText(undefined)\n }\n }\n },\n [maxDateMessage, minDateMessage],\n )\n\n const convertedMaxDate = React.useMemo(() => {\n if (typeof maxDate === 'string') {\n return new Date(maxDate)\n }\n }, [maxDate])\n const convertedMinDate = React.useMemo(() => {\n if (typeof minDate === 'string') {\n return new Date(minDate)\n }\n }, [minDate])\n\n const onAccept = React.useCallback(\n (date: Date | null) => {\n const currentValue =\n rest.value instanceof Date ? rest.value.toISOString() : rest.value\n if (currentValue !== (date?.toISOString() || null)) {\n onChange(date)\n }\n },\n [onChange, rest.value],\n )\n\n return (\n <MobileDateTimePicker\n open={isOpen}\n onOpen={setIsOpen}\n onClose={setIsClosed}\n renderInput={(props) => (\n <TextField\n {...props}\n name={name}\n label={label}\n required={required}\n helperText={helperTextProp || helperText}\n {...(error ? { error } : {})}\n fullWidth\n margin={margin}\n size={size}\n placeholder={placeholder}\n variant={inputVariant}\n InputProps={{\n startAdornment: startIconButton ? (\n <InputAdornment position=\"start\">\n <IconButton\n edge={iconButtonEdge}\n size={iconButtonSize}\n onClick={setIsOpen}\n disabled={disabled}\n >\n <DateRange />\n </IconButton>\n </InputAdornment>\n ) : undefined,\n endAdornment: endIconButton ? (\n <InputAdornment position=\"end\">\n <IconButton\n edge={iconButtonEdge}\n size={iconButtonSize}\n onClick={setIsOpen}\n disabled={disabled}\n >\n <DateRange />\n </IconButton>\n </InputAdornment>\n ) : undefined,\n ...(InputProps ? InputProps : {}),\n }}\n data-cypress={dataCypress}\n />\n )}\n maxDate={convertedMaxDate}\n minDate={convertedMinDate}\n onError={handleError}\n timeIcon={<AccessTime />}\n dateRangeIcon={<DateRange />}\n // This triggers everytime a component of the while date changes within the picker\n onChange={emptyFn}\n onAccept={onAccept}\n inputFormat={localisationService.getDateFnsFormats().shortDateTime}\n disabled={disabled}\n {...rest}\n />\n )\n}\n\nexport default React.memo<Props>(V4CompatibleDateTimePicker)\n"]}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { MobileTimePickerProps } from '@mui/x-date-pickers';
|
3
|
+
import { TextField, IconButton } from '@mui/material';
|
4
|
+
declare type RemainingPickerProps = Omit<MobileTimePickerProps<Date>, 'onError' | 'renderInput' | 'toolbarFormat' | 'rightArrowIcon' | 'leftArrowIcon' | 'maxDate' | 'minDate' | 'inputFormat'>;
|
5
|
+
declare type TextFieldProps = React.ComponentProps<typeof TextField>;
|
6
|
+
declare type IconButtonProps = React.ComponentProps<typeof IconButton>;
|
7
|
+
declare type Props = RemainingPickerProps & {
|
8
|
+
name?: string;
|
9
|
+
label?: string;
|
10
|
+
margin?: TextFieldProps['margin'];
|
11
|
+
size?: TextFieldProps['size'];
|
12
|
+
placeholder?: string;
|
13
|
+
InputProps?: TextFieldProps['InputProps'];
|
14
|
+
inputVariant?: TextFieldProps['variant'];
|
15
|
+
onBlur?: TextFieldProps['onBlur'];
|
16
|
+
startIconButton?: boolean;
|
17
|
+
endIconButton?: boolean;
|
18
|
+
iconButtonEdge?: IconButtonProps['edge'];
|
19
|
+
iconButtonSize?: IconButtonProps['size'];
|
20
|
+
helperText?: string | React.ReactNode;
|
21
|
+
error?: boolean;
|
22
|
+
required?: boolean;
|
23
|
+
'data-cypress'?: string;
|
24
|
+
};
|
25
|
+
declare const _default: React.NamedExoticComponent<Props>;
|
26
|
+
export default _default;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { MobileTimePicker } from '@mui/x-date-pickers';
|
3
|
+
import { TextField, InputAdornment, IconButton } from '@mui/material';
|
4
|
+
import { AccessTime } from '@mui/icons-material';
|
5
|
+
import useBooleanState from '../../hooks/useBooleanState';
|
6
|
+
const emptyFn = () => {
|
7
|
+
//
|
8
|
+
};
|
9
|
+
const V4CompatibleTimePicker = ({ name, label, margin, size, placeholder, InputProps, onChange, inputVariant, onBlur, disabled, startIconButton, endIconButton, iconButtonEdge, iconButtonSize, helperText: helperTextProp, error, required, 'data-cypress': dataCypress, ...rest }) => {
|
10
|
+
const [isOpen, setIsOpen, setIsClosed] = useBooleanState(false);
|
11
|
+
const [helperText, setHelperText] = React.useState(undefined);
|
12
|
+
const handleError = React.useCallback((error) => {
|
13
|
+
switch (error) {
|
14
|
+
case 'invalidDate': {
|
15
|
+
return setHelperText('Invalid Date Time');
|
16
|
+
}
|
17
|
+
default: {
|
18
|
+
return setHelperText(undefined);
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}, []);
|
22
|
+
const onAccept = React.useCallback((date) => {
|
23
|
+
const currentValue = rest.value instanceof Date ? rest.value.toISOString() : rest.value;
|
24
|
+
if (currentValue !== ((date === null || date === void 0 ? void 0 : date.toISOString()) || null)) {
|
25
|
+
onChange(date);
|
26
|
+
}
|
27
|
+
}, [onChange, rest.value]);
|
28
|
+
return (React.createElement(MobileTimePicker, { open: isOpen, onOpen: setIsOpen, onClose: setIsClosed, renderInput: (props) => (React.createElement(TextField, { ...props, name: name, label: label, required: required, helperText: helperTextProp || helperText, ...(error ? { error } : {}), fullWidth: true, margin: margin, size: size, placeholder: placeholder, variant: inputVariant, onBlur: onBlur, InputProps: {
|
29
|
+
startAdornment: startIconButton ? (React.createElement(InputAdornment, { position: "start" },
|
30
|
+
React.createElement(IconButton, { edge: iconButtonEdge, size: iconButtonSize, onClick: setIsOpen, disabled: disabled },
|
31
|
+
React.createElement(AccessTime, null)))) : undefined,
|
32
|
+
endAdornment: endIconButton ? (React.createElement(InputAdornment, { position: "end" },
|
33
|
+
React.createElement(IconButton, { edge: iconButtonEdge, size: iconButtonSize, onClick: setIsOpen, disabled: disabled },
|
34
|
+
React.createElement(AccessTime, null)))) : undefined,
|
35
|
+
...(InputProps ? InputProps : {}),
|
36
|
+
}, "data-cypress": dataCypress })), onError: handleError,
|
37
|
+
// This triggers everytime a component of the while date changes within the picker
|
38
|
+
onChange: emptyFn, onAccept: onAccept, disabled: disabled, ...rest }));
|
39
|
+
};
|
40
|
+
export default React.memo(V4CompatibleTimePicker);
|
41
|
+
//# sourceMappingURL=V4CompatibleTimePicker.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"V4CompatibleTimePicker.js","sourceRoot":"","sources":["../../../src/components/pickers/V4CompatibleTimePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,gBAAgB,EAAyB,MAAM,qBAAqB,CAAA;AAC7E,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB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AAE,CAAC;aAClC,kBACa,WAAW,GACzB,CACH,EACD,OAAO,EAAE,WAAW;QACpB,kFAAkF;QAClF,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,KACd,IAAI,GACR,CACH,CAAA;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAC,IAAI,CAAQ,sBAAsB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { MobileTimePicker, MobileTimePickerProps } from '@mui/x-date-pickers'\nimport { TextField, InputAdornment, IconButton } from '@mui/material'\nimport { AccessTime } from '@mui/icons-material'\nimport useBooleanState from '../../hooks/useBooleanState'\n\ntype RemainingPickerProps = Omit<\n MobileTimePickerProps<Date>,\n | 'onError'\n | 'renderInput'\n | 'toolbarFormat'\n | 'rightArrowIcon'\n | 'leftArrowIcon'\n | 'maxDate'\n | 'minDate'\n | 'inputFormat'\n>\n\ntype TextFieldProps = React.ComponentProps<typeof TextField>\ntype IconButtonProps = React.ComponentProps<typeof IconButton>\n\ntype Props = RemainingPickerProps & {\n name?: string\n label?: string\n margin?: TextFieldProps['margin']\n size?: TextFieldProps['size']\n placeholder?: string\n InputProps?: TextFieldProps['InputProps']\n inputVariant?: TextFieldProps['variant']\n onBlur?: TextFieldProps['onBlur']\n startIconButton?: boolean\n endIconButton?: boolean\n iconButtonEdge?: IconButtonProps['edge']\n iconButtonSize?: IconButtonProps['size']\n helperText?: string | React.ReactNode\n error?: boolean\n required?: boolean\n 'data-cypress'?: string\n}\n\nconst emptyFn = () => {\n //\n}\nconst V4CompatibleTimePicker = ({\n name,\n label,\n margin,\n size,\n placeholder,\n InputProps,\n onChange,\n inputVariant,\n onBlur,\n disabled,\n startIconButton,\n endIconButton,\n iconButtonEdge,\n iconButtonSize,\n helperText: helperTextProp,\n error,\n required,\n 'data-cypress': dataCypress,\n ...rest\n}: Props) => {\n const [isOpen, setIsOpen, setIsClosed] = useBooleanState(false)\n const [helperText, setHelperText] = React.useState<string | undefined>(\n undefined,\n )\n const handleError = React.useCallback(\n (error: Parameters<Required<MobileTimePickerProps>['onError']>[0]) => {\n switch (error) {\n case 'invalidDate': {\n return setHelperText('Invalid Date Time')\n }\n default: {\n return setHelperText(undefined)\n }\n }\n },\n [],\n )\n\n const onAccept = React.useCallback(\n (date: Date | null) => {\n const currentValue =\n rest.value instanceof Date ? rest.value.toISOString() : rest.value\n\n if (currentValue !== (date?.toISOString() || null)) {\n onChange(date)\n }\n },\n [onChange, rest.value],\n )\n\n return (\n <MobileTimePicker\n open={isOpen}\n onOpen={setIsOpen}\n onClose={setIsClosed}\n renderInput={(props) => (\n <TextField\n {...props}\n name={name}\n label={label}\n required={required}\n helperText={helperTextProp || helperText}\n {...(error ? { error } : {})}\n fullWidth\n margin={margin}\n size={size}\n placeholder={placeholder}\n variant={inputVariant}\n onBlur={onBlur}\n InputProps={{\n startAdornment: startIconButton ? (\n <InputAdornment position=\"start\">\n <IconButton\n edge={iconButtonEdge}\n size={iconButtonSize}\n onClick={setIsOpen}\n disabled={disabled}\n >\n <AccessTime />\n </IconButton>\n </InputAdornment>\n ) : undefined,\n endAdornment: endIconButton ? (\n <InputAdornment position=\"end\">\n <IconButton\n edge={iconButtonEdge}\n size={iconButtonSize}\n onClick={setIsOpen}\n disabled={disabled}\n >\n <AccessTime />\n </IconButton>\n </InputAdornment>\n ) : undefined,\n ...(InputProps ? InputProps : {}),\n }}\n data-cypress={dataCypress}\n />\n )}\n onError={handleError}\n // This triggers everytime a component of the while date changes within the picker\n onChange={emptyFn}\n onAccept={onAccept}\n disabled={disabled}\n {...rest}\n />\n )\n}\n\nexport default React.memo<Props>(V4CompatibleTimePicker)\n"]}
|
File without changes
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import clsx from 'clsx';
|
3
3
|
import SignatureCanvas from 'react-signature-canvas';
|
4
|
-
import useBooleanState from '
|
5
|
-
import scrollingService from '
|
4
|
+
import useBooleanState from '../../hooks/useBooleanState';
|
5
|
+
import scrollingService from '../../services/scrolling-service';
|
6
6
|
const annotationButtonColours = [
|
7
7
|
'#000000',
|
8
8
|
'#ffffff',
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AnnotationModal.js","sourceRoot":"","sources":["../../../src/components/renderer/AnnotationModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,eAAe,MAAM,wBAAwB,CAAA;AAEpD,OAAO,eAAe,MAAM,6BAA6B,CAAA;AACzD,OAAO,gBAAgB,MAAM,kCAAkC,CAAA;AAE/D,MAAM,uBAAuB,GAAG;IAC9B,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;CACV,CAAA;AAED,SAAS,eAAe,CAAC,EACvB,QAAQ,EACR,OAAO,EACP,MAAM,GAKP;IACC,MAAM,2BAA2B,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAA;IACtE,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAA;IAC5D,MAAM,kBAAkB,GAAG,KAAK,CAAC,MAAM,CAAkB,IAAI,CAAC,CAAA;IAE9D,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;IAClD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAA;IAE5E,MAAM,sBAAsB,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACpD,IAAI,kBAAkB,CAAC,OAAO,EAAE;YAC9B,OAAO,CAAC,G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AAS,KAAK,MAAM;qBACpC,CACF,EACD,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,EACnC,KAAK,EAAE,EAAE,eAAe,EAAE,MAAM,EAAE,GAClC,CACH,CAAA;YACH,CAAC,CAAC,CACE;YACN,6BACE,GAAG,EAAE,2BAA2B,EAChC,SAAS,EAAC,wBAAwB;gBAElC,6BACE,GAAG,EAAE,iBAAiB,EACtB,SAAS,EAAC,+DAA+D;oBAEzE,oBAAC,eAAe,IACd,GAAG,EAAE,kBAAkB,EACvB,aAAa,EAAE,KAAK;wBACpB,uBAAuB;wBACvB,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE,SAAS,GACnB,CACE,CACF;YACN,6BAAK,SAAS,EAAC,uDAAuD;gBACpE,gCACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,+GAA+G,EACzH,OAAO,EAAE,sBAAsB,aAGxB;gBACT,gCACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,+GAA+G,EACzH,QAAQ,EAAE,CAAC,OAAO,EAClB,OAAO,EAAE,oBAAoB,WAGtB,CACL,CACF,CACF,CACP,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport clsx from 'clsx'\nimport SignatureCanvas from 'react-signature-canvas'\n\nimport useBooleanState from '../../hooks/useBooleanState'\nimport scrollingService from '../../services/scrolling-service'\n\nconst annotationButtonColours = [\n '#000000',\n '#ffffff',\n '#f44336',\n '#e91e63',\n '#9c27b0',\n '#673ab7',\n '#3f51b5',\n '#2196f3',\n '#03a9f4',\n '#00bcd4',\n '#009688',\n '#4caf50',\n '#8bc34a',\n '#cddc39',\n '#ffee58',\n '#ffca28',\n '#ffa726',\n '#ff5722',\n]\n\nfunction AnnotationModal({\n imageSrc,\n onClose,\n onSave,\n}: {\n imageSrc: string\n onClose: () => void\n onSave: (newValue: string) => void\n}) {\n const annotationContentElementRef = React.useRef<HTMLDivElement>(null)\n const bmSignaturePadRef = React.useRef<HTMLDivElement>(null)\n const signatureCanvasRef = React.useRef<SignatureCanvas>(null)\n\n const [isDirty, setDirty] = useBooleanState(false)\n const [penColour, setPenColour] = React.useState(annotationButtonColours[0])\n\n const handleCancelAnnotation = React.useCallback(() => {\n if (signatureCanvasRef.current) {\n console.log('Clearing annotation...')\n signatureCanvasRef.current.clear()\n }\n onClose()\n }, [onClose])\n\n const handleSaveAnnotation = React.useCallback(() => {\n if (signatureCanvasRef.current) {\n onSave(signatureCanvasRef.current.toDataURL())\n }\n }, [onSave])\n\n // SETTING CANVAS FROM PASSED VALUE\n React.useEffect(() => {\n const annotationContentElement = annotationContentElementRef.current\n const bmSignaturePadElement = bmSignaturePadRef.current\n const signatureCanvas = signatureCanvasRef.current\n if (\n !annotationContentElement ||\n !bmSignaturePadElement ||\n !signatureCanvas ||\n typeof imageSrc !== 'string'\n ) {\n return\n }\n const canvasElement = signatureCanvas.getCanvas()\n\n // Disable scrolling to allow for smooth drawing\n scrollingService.disableScrolling()\n\n const maxWidth = annotationContentElement.clientWidth\n const maxHeight = annotationContentElement.clientHeight\n\n const i = new Image()\n i.onload = function () {\n const imageWidth = i.width\n const imageHeight = i.height\n let canvasWidth = imageWidth\n let canvasHeight = imageHeight\n\n if (imageWidth > maxWidth || imageHeight > maxHeight) {\n const widthRatio = maxWidth / imageWidth\n const heightRatio = maxHeight / imageHeight\n const ratio = Math.min(widthRatio, heightRatio)\n\n canvasWidth = ratio * imageWidth\n canvasHeight = ratio * imageHeight\n }\n\n bmSignaturePadElement.style.width = `${canvasWidth}px`\n bmSignaturePadElement.style.height = `${canvasHeight}px`\n bmSignaturePadElement.style.backgroundSize = 'cover'\n bmSignaturePadElement.style.backgroundImage = `url(${imageSrc})`\n canvasElement.width = canvasWidth\n canvasElement.height = canvasHeight\n }\n console.log('imageSrc', imageSrc)\n i.src = imageSrc\n\n return () => {\n scrollingService.enableScrolling()\n }\n }, [imageSrc])\n\n return (\n <div className=\"modal is-active\">\n <div className=\"modal-background-faded\"></div>\n <div className=\"ob-annotation\">\n <div className=\"ob-annotation__buttons ob-annotation__buttons-colours\">\n {annotationButtonColours.map((colour, index) => {\n return (\n <button\n key={index}\n type=\"button\"\n className={clsx(\n 'button ob-annotation__button ob-annotation__button-colour cypress-annotation-colour-button',\n {\n 'is-selected': penColour === colour,\n },\n )}\n onClick={() => setPenColour(colour)}\n style={{ backgroundColor: colour }}\n />\n )\n })}\n </div>\n <div\n ref={annotationContentElementRef}\n className=\"ob-annotation__content\"\n >\n <div\n ref={bmSignaturePadRef}\n className=\"ob-annotation__signature-pad cypress-annotation-signature-pad\"\n >\n <SignatureCanvas\n ref={signatureCanvasRef}\n clearOnResize={false}\n // @ts-expect-error ???\n onEnd={setDirty}\n penColor={penColour}\n />\n </div>\n </div>\n <div className=\"ob-annotation__buttons ob-annotation__buttons-actions\">\n <button\n type=\"button\"\n className=\"button is-light ob-button ob-annotation__button ob-annotation__button-action cypress-annotation-cancel-button\"\n onClick={handleCancelAnnotation}\n >\n Cancel\n </button>\n <button\n type=\"button\"\n className=\"button is-primary ob-button ob-annotation__button ob-annotation__button-action cypress-annotation-save-button\"\n disabled={!isDirty}\n onClick={handleSaveAnnotation}\n >\n Save\n </button>\n </div>\n </div>\n </div>\n )\n}\n\nexport default React.memo(AnnotationModal)\n"]}
|
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import clsx from 'clsx';
|
3
|
-
import useBooleanState from '
|
3
|
+
import useBooleanState from '../../hooks/useBooleanState';
|
4
4
|
import { Sentry } from '@oneblink/apps';
|
5
5
|
function AutocompleteDropdown({ id, label, value, placeholder, required, disabled, validationMessage, displayValidationMessage, searchDebounceMs, searchMinCharacters, isLoading, hasError, onChangeValue, onChangeLabel, onSearch, }) {
|
6
6
|
const optionsContainerElement = React.useRef(null);
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AutocompleteDropdown.js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,SAAS,EAAE,IAAI,CACb,oFAAoF,KAAK,EAAE,EAC3F;wBACE,WAAW,EAAE,yBAAyB,KAAK,KAAK;qBACjD,CACF,EACD,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,EAAE,MAAM,CAAC,EAChD,uBAAuB,EAAE;wBACvB,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC;qBAC5C,GACD,CACH,CAAC,CACH,CAAC,CAAC,CAAC,CACF,2BAAG,SAAS,EAAC,mFAAmF;oBAC9F,kDAAuB,CACrB,CACL,CACG,CACF,CACF;QAEL,CAAC,OAAO,IAAI,wBAAwB,CAAC;YACpC,CAAC,CAAC,iBAAiB;YACnB,CAAC,gBAAgB,IAAI,CACnB,6BAAK,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,kBAAkB;YAC5C,6BAAK,SAAS,EAAC,2DAA2D,IACvE,iBAAiB,CACd,CACF,CACP,CACF,CACJ,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAgC,CAAA;AAE9E,SAAS,cAAc,CAAC,IAAY,EAAE,MAAc;IAClD,IAAI,MAAM,EAAE;QACV,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,GAAG,MAAM,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,WAAW,CAAC,CAAA;KACvE;IAED,OAAO,IAAI,CAAA;AACb,CAAC","sourcesContent":["import * as React from 'react'\nimport clsx from 'clsx'\n\nimport useBooleanState from '../../hooks/useBooleanState'\nimport { Sentry } from '@oneblink/apps'\n\ntype AutocompleteOption<T> = {\n label: string\n value: string\n data?: T\n}\n\ntype Props<T> = {\n id: string\n label: string\n value: unknown | undefined\n placeholder: string | undefined\n required: boolean | undefined\n disabled: boolean | undefined\n isLoading?: boolean\n hasError?: boolean\n validationMessage: string | undefined\n displayValidationMessage: boolean\n searchDebounceMs: number\n searchMinCharacters: number\n onChangeValue: (\n newValue: string | undefined,\n data?: T,\n ) => Promise<void> | void\n onChangeLabel: (newLabel: string) => void\n onSearch: (\n label: string,\n abortSignal: AbortSignal,\n ) => Promise<AutocompleteOption<T>[]>\n}\n\nfunction AutocompleteDropdown<T>({\n id,\n label,\n value,\n placeholder,\n required,\n disabled,\n validationMessage,\n displayValidationMessage,\n searchDebounceMs,\n searchMinCharacters,\n isLoading,\n hasError,\n onChangeValue,\n onChangeLabel,\n onSearch,\n}: Props<T>) {\n const optionsContainerElement = React.useRef<HTMLDivElement>(null)\n const [isDirty, setIsDirty] = React.useState(false)\n const [currentFocusedOptionIndex, setCurrentFocusedOptionIndex] =\n React.useState(0)\n const [options, setOptions] = React.useState<AutocompleteOption<T>[]>([])\n const [error, setError] = React.useState<Error | null>(null)\n const [isFetchingOptions, setIsFetchingOptions] = React.useState(false)\n const [isOpen, onOpen, onClose] = useBooleanState(false)\n\n const onSelectOption = React.useCallback(\n (option: AutocompleteOption<T>) => {\n onChangeLabel(option.label)\n onChangeValue(option.value, option.data)\n onClose()\n },\n [onChangeLabel, onChangeValue, onClose],\n )\n\n const handleClickOption = React.useCallback(\n (event, option: AutocompleteOption<T>) => {\n console.log('Selected element option in autocomplete', option)\n\n event.preventDefault()\n event.stopPropagation()\n\n onSelectOption(option)\n },\n [onSelectOption],\n )\n\n const onFocus = React.useCallback(() => {\n setCurrentFocusedOptionIndex(0)\n onOpen()\n }, [onOpen])\n\n // When moving away from the input, if this is no value remove\n // the label to show the user they have not selected a value\n const handleBlur = React.useCallback(() => {\n setIsDirty(true)\n setError(null)\n onClose()\n\n if (!value && Array.isArray(options)) {\n // If there is no option currently selected but the typed in label\n // matches an option's label, set that option as the value, otherwise remove label\n if (label) {\n const lowerCase = label.toLowerCase()\n const option = options.find(\n (option) => option.label.toLowerCase() === lowerCase,\n )\n if (option) {\n console.log('Setting value after blurring away from autocomplete')\n onSelectOption(option)\n return\n }\n }\n console.log('Removing label after blurring away from autocomplete')\n onChangeLabel('')\n }\n }, [label, onChangeLabel, onClose, onSelectOption, options, value])\n\n const onKeyDown = React.useCallback(\n (event) => {\n if (!options) {\n return\n }\n const enterPressed = event.keyCode === 13\n const upArrowPressed = event.keyCode === 38\n const downArrowPressed = event.keyCode === 40\n if (!upArrowPressed && !downArrowPressed && !enterPressed) {\n return\n }\n\n event.preventDefault()\n\n const previousFocusedOptionIndex = currentFocusedOptionIndex\n let nextFocusedOptionIndex = currentFocusedOptionIndex\n if (upArrowPressed) {\n nextFocusedOptionIndex = Math.max(0, currentFocusedOptionIndex - 1)\n } else if (downArrowPressed) {\n nextFocusedOptionIndex = Math.min(\n options.length - 1,\n currentFocusedOptionIndex + 1,\n )\n } else if (enterPressed) {\n const option = options[nextFocusedOptionIndex]\n if (option) {\n onSelectOption(option)\n }\n }\n\n // If the index has changed, need to ensure the active option is visible\n if (\n previousFocusedOptionIndex !== nextFocusedOptionIndex &&\n optionsContainerElement.current\n ) {\n const activeStepElement = optionsContainerElement.current.querySelector(\n `.ob-autocomplete__drop-down-item-${nextFocusedOptionIndex}`,\n )\n if (activeStepElement) {\n activeStepElement.scrollIntoView({\n behavior: 'smooth',\n block: 'nearest',\n inline: 'start',\n })\n }\n setCurrentFocusedOptionIndex(nextFocusedOptionIndex)\n }\n },\n [currentFocusedOptionIndex, options, onSelectOption],\n )\n\n const handleChangeLabel = React.useCallback(\n (e) => {\n const newLabel = e.target.value\n onOpen()\n setCurrentFocusedOptionIndex(0)\n\n // Remove value when changing label\n onChangeValue(undefined)\n onChangeLabel(newLabel)\n },\n [onChangeLabel, onChangeValue, onOpen],\n )\n\n React.useEffect(() => {\n setError(null)\n\n if (!isOpen || label.length < searchMinCharacters) {\n setIsFetchingOptions(false)\n return\n }\n\n setIsFetchingOptions(true)\n\n let ignore = false\n const abortController = new AbortController()\n\n const timeoutId = setTimeout(async () => {\n let newOptions: AutocompleteOption<T>[] = []\n let newError = null\n\n try {\n newOptions = await onSearch(label, abortController.signal)\n } catch (error) {\n // Cancelling will throw an error.\n if (!abortController.signal.aborted) {\n console.warn('Error while fetching autocomplete options', error)\n Sentry.captureException(error)\n newError = error as Error\n }\n }\n if (!ignore) {\n setError(newError)\n setOptions(newOptions)\n setIsFetchingOptions(false)\n }\n }, searchDebounceMs)\n\n return () => {\n ignore = true\n clearTimeout(timeoutId)\n abortController.abort()\n }\n }, [isOpen, label, onSearch, searchDebounceMs, searchMinCharacters])\n\n const isShowingLoading = isFetchingOptions || !!isLoading\n const isShowingValid = !isShowingLoading && value !== undefined\n const isShowingError = !isShowingLoading && !!hasError\n\n return (\n <>\n <div\n className={clsx('dropdown', {\n 'is-active': isOpen && Array.isArray(options),\n })}\n >\n <div className=\"field\">\n <div\n className={clsx(\n 'cypress-autocomplete-field-control control is-expanded',\n {\n 'is-loading': isShowingLoading,\n 'has-icons-right': isShowingValid || isShowingError,\n },\n )}\n >\n <input\n type=\"text\"\n placeholder={placeholder}\n id={id}\n autoComplete=\"off\"\n className=\"cypress-autocomplete-control input ob-input\"\n required={required}\n value={label}\n disabled={disabled}\n onFocus={onFocus}\n onBlur={handleBlur}\n onKeyDown={onKeyDown}\n onChange={handleChangeLabel}\n />\n {isShowingValid && (\n <span className=\" ob-input-icon icon is-small is-right\">\n <i className=\"material-icons is-size-5 has-text-success\">\n check\n </i>\n </span>\n )}\n {isShowingError && (\n <span className=\" ob-input-icon icon is-small is-right\">\n <i className=\"material-icons is-size-5 has-text-danger\">\n error\n </i>\n </span>\n )}\n </div>\n </div>\n\n <div className=\"dropdown-menu\">\n <div\n ref={optionsContainerElement}\n className=\"ob-autocomplete__dropdown-content dropdown-content cypress-autocomplete-dropdown-content\"\n >\n {error ? (\n <a className=\"dropdown-item cypress-autocomplete-error ob-autocomplete__drop-down-item-error\">\n <span className=\"has-text-danger\">{error.message}</span>\n </a>\n ) : label.length < searchMinCharacters ? (\n <a className=\"dropdown-item cypress-max-characters ob-autocomplete__drop-down-item-max-characters\">\n <i>\n Enter at least {searchMinCharacters} character(s) to search\n </i>\n </a>\n ) : isShowingLoading ? (\n <a className=\"dropdown-item cypress-searching-options ob-autocomplete__drop-down-item-searching\">\n <i>Searching...</i>\n </a>\n ) : options && options.length ? (\n options.map((option, index) => (\n <a\n key={option.value}\n className={clsx(\n `dropdown-item cypress-autocomplete-dropdown-item ob-autocomplete__drop-down-item-${index}`,\n {\n 'is-active': currentFocusedOptionIndex === index,\n },\n )}\n onMouseDown={(e) => handleClickOption(e, option)}\n dangerouslySetInnerHTML={{\n __html: highlightLabel(option.label, label),\n }}\n />\n ))\n ) : (\n <a className=\"dropdown-item cypress-no-matches-found ob-autocomplete__drop-down-item-no-matches\">\n <i>No matches found</i>\n </a>\n )}\n </div>\n </div>\n </div>\n\n {(isDirty || displayValidationMessage) &&\n !!validationMessage &&\n !isShowingLoading && (\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 </>\n )\n}\n\nexport default React.memo(AutocompleteDropdown) as typeof AutocompleteDropdown\n\nfunction highlightLabel(text: string, phrase: string) {\n if (phrase) {\n text = text.replace(new RegExp('(' + phrase + ')', 'gi'), '<b>$1</b>')\n }\n\n return text\n}\n"]}
|
File without changes
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import utilsService from '
|
2
|
+
import utilsService from '../../services/utils-service';
|
3
3
|
function CopyToClipboardButton({ className, text, isInputButton }) {
|
4
4
|
const copy = React.useCallback(() => {
|
5
5
|
utilsService.copyToClipboard(text);
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"CopyToClipboardButton.js","sourceRoot":"","sources":["../../../src/components/renderer/CopyToClipboardButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,YAAY,MAAM,8BAA8B,CAAA;AAQvD,SAAS,qBAAqB,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAS;IACtE,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QAClC,YAAY,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;IACpC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IACV,OAAO,CACL,gCAAQ,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAC,QAAQ;QACxD,iCAAa;QACb,8BAAM,SAAS,EAAC,MAAM;YACpB,2BAAG,SAAS,EAAC,gBAAgB,gBAAc,CACtC;QACP,8BAAM,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS,iBAExD,CACA,CACV,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\n\nimport utilsService from '../../services/utils-service'\n\ntype Props = {\n text: string\n className?: string\n isInputButton?: boolean\n}\n\nfunction CopyToClipboardButton({ className, text, isInputButton }: Props) {\n const copy = React.useCallback(() => {\n utilsService.copyToClipboard(text)\n }, [text])\n return (\n <button onClick={copy} className={className} type=\"button\">\n <span></span>\n <span className=\"icon\">\n <i className=\"material-icons\">file_copy</i>\n </span>\n <span className={isInputButton ? 'is-hidden-mobile' : undefined}>\n Copy\n </span>\n </button>\n )\n}\n\nexport default React.memo(CopyToClipboardButton)\n"]}
|
package/dist/components/{CustomisableButtonInner.d.ts → renderer/CustomisableButtonInner.d.ts}
RENAMED
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"CustomisableButtonInner.js","sourceRoot":"","sources":["../../../src/components/renderer/CustomisableButtonInner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,MAAM,kBAAkB,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAS,EAAE,EAAE;IACpD,OAAO,CACL;QACE,8BAAM,SAAS,EAAC,8BAA8B;YAC3C,CAAC,CAAC,IAAI,IAAI,2BAAG,SAAS,EAAC,gBAAgB,IAAE,IAAI,CAAK;YACnD,kCAAO,KAAK,CAAQ,CACf,CACN,CACJ,CAAA;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAC,IAAI,CAAQ,kBAAkB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\ntype Props = {\n label: string\n icon?: string\n}\n\nconst CustomisableButton = ({ label, icon }: Props) => {\n return (\n <>\n <span className=\"ob-customisable-button-inner\">\n {!!icon && <i className=\"material-icons\">{icon}</i>}\n <span>{label}</span>\n </span>\n </>\n )\n}\n\nexport default React.memo<Props>(CustomisableButton)\n"]}
|
package/dist/components/{FormElementLabelContainer.d.ts → renderer/FormElementLabelContainer.d.ts}
RENAMED
File without changes
|
package/dist/components/{FormElementLabelContainer.js → renderer/FormElementLabelContainer.js}
RENAMED
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"FormElementLabelContainer.js","sourceRoot":"","sources":["../../../src/components/renderer/FormElementLabelContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,IAAI,MAAM,MAAM,CAAA;AAGvB,SAAS,yBAAyB,CAAC,EACjC,SAAS,EACT,OAAO,EACP,EAAE,EACF,QAAQ,EACR,QAAQ,EACR,OAAO,GAQR;IACC,OAAO,CACL,6BAAK,SAAS,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC;QACjD,6BAAK,SAAS,EAAC,2BAA2B;YACvC,OAAO;YACR,+BACE,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE;oBAC1B,gCAAgC,EAAE,QAAQ;iBAC3C,CAAC,EACF,OAAO,EAAE,EAAE,IAEV,OAAO,CAAC,KAAK,CACR;YACP,OAAO,CAAC,IAAI,IAAI,CACf,oBAAC,OAAO,IACN,KAAK,EAAE,OAAO,CAAC,IAAI,EACnB,KAAK,QACL,eAAe,EAAE,CAAC,EAClB,eAAe,EAAE,KAAK;gBAEtB,2BAAG,SAAS,EAAC,mDAAmD,WAE5D,CACI,CACX,CACG;QACL,QAAQ,CACL,CACP,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { Tooltip } from '@mui/material'\nimport clsx from 'clsx'\nimport { FormTypes } from '@oneblink/types'\n\nfunction FormElementLabelContainer({\n className,\n element,\n id,\n required,\n children,\n leading,\n}: {\n className: string\n element: FormTypes.FormElementBase\n id: string\n required: boolean\n children: React.ReactNode\n leading?: React.ReactNode\n}) {\n return (\n <div className={clsx('ob-form__element', className)}>\n <div className=\"label ob-label__container\">\n {leading}\n <label\n className={clsx('ob-label', {\n 'ob-label__required is-required': required,\n })}\n htmlFor={id}\n >\n {element.label}\n </label>\n {element.hint && (\n <Tooltip\n title={element.hint}\n arrow\n enterTouchDelay={0}\n leaveTouchDelay={10000}\n >\n <i className=\"material-icons has-text-grey-light ob-label__hint\">\n info\n </i>\n </Tooltip>\n )}\n </div>\n {children}\n </div>\n )\n}\n\nexport default React.memo(FormElementLabelContainer)\n"]}
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"FormElementOptions.js","sourceRoot":"","sources":["../../../src/components/renderer/FormElementOptions.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,SAAS,MAAM,aAAa,CAAA;AAOnC,SAAS,kBAAkB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAS;IACtD,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,CACL;YACE,oBAAC,SAAS,IAAC,SAAS,EAAC,mBAAmB,EAAC,KAAK,SAAa,CACvD,CACP,CAAA;KACF;IAED,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QACnB,OAAO,CACL;YACE,6BAAK,SAAS,EAAC,yBAAyB,8EAGlC,CACF,CACP,CAAA;KACF;IAED,OAAO,iCAAM,QAAQ,CAAO,CAAA;AAC9B,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA","sourcesContent":["import { FormTypes } from '@oneblink/types'\nimport * as React from 'react'\n\nimport OnLoading from './OnLoading'\n\ntype Props = {\n options: FormTypes.ChoiceElementOption[] | undefined\n children: React.ReactNode\n}\n\nfunction FormElementOptions({ options, children }: Props) {\n if (!options) {\n return (\n <div>\n <OnLoading className=\"has-text-centered\" small></OnLoading>\n </div>\n )\n }\n\n if (!options.length) {\n return (\n <div>\n <div className=\"has-text-grey is-size-7\">\n We were unable to load your options. Please contact your\n administrator.\n </div>\n </div>\n )\n }\n\n return <div>{children}</div>\n}\n\nexport default React.memo(FormElementOptions)\n"]}
|
File without changes
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import clsx from 'clsx';
|
3
|
-
import useLookupNotification from '
|
4
|
-
import { lookupValidationMessage } from '
|
5
|
-
import useFormIsReadOnly from '
|
3
|
+
import useLookupNotification from '../../hooks/useLookupNotification';
|
4
|
+
import { lookupValidationMessage } from '../../services/form-validation';
|
5
|
+
import useFormIsReadOnly from '../../hooks/useFormIsReadOnly';
|
6
6
|
function LookupButton({ value, validationMessage, hasMarginTop, isInputButton, }) {
|
7
7
|
const { isLookup, onLookup, isDisabled } = useLookupNotification();
|
8
8
|
const formIsReadOnly = useFormIsReadOnly();
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"LookupButton.js","sourceRoot":"","sources":["../../../src/components/renderer/LookupButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,qBAAqB,MAAM,mCAAmC,CAAA;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAA;AACxE,OAAO,iBAAiB,MAAM,+BAA+B,CAAA;AAQ7D,SAAS,YAAY,CAAC,EACpB,KAAK,EACL,iBAAiB,EACjB,YAAY,EACZ,aAAa,GACP;IACN,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,qBAAqB,EAAE,CAAA;IAClE,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAA;IAC1C,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,IAAI,CAAA;KACZ;IAED,MAAM,MAAM,GAAG,CACb,gCACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,IAAI,CACb,2DAA2D,EAC3D;YACE,gBAAgB,EAAE,aAAa;YAC/B,WAAW,EAAE,CAAC,aAAa;YAC3B,kBAAkB,EAAE,YAAY;SACjC,CACF,EACD,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EAC9B,QAAQ,EACN,cAAc;YACd,UAAU;YACV,KAAK,KAAK,SAAS;YACnB,CAAC,CAAC,CAAC,iBAAiB,IAAI,iBAAiB,KAAK,uBAAuB,CAAC;QAGvE,aAAa,IAAI,iCAAa;QAC/B,8BAAM,SAAS,EAAC,MAAM;YACpB,2BAAG,SAAS,EAAC,gBAAgB,aAAW,CACnC;QACP,8BAAM,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS,mBAExD,CACA,CACV,CAAA;IAED,IAAI,aAAa,EAAE;QACjB,OAAO,6BAAK,SAAS,EAAC,SAAS,IAAE,MAAM,CAAO,CAAA;KAC/C;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport clsx from 'clsx'\nimport useLookupNotification from '../../hooks/useLookupNotification'\nimport { lookupValidationMessage } from '../../services/form-validation'\nimport useFormIsReadOnly from '../../hooks/useFormIsReadOnly'\ntype Props = {\n value: unknown | undefined\n validationMessage: string | undefined\n hasMarginTop?: boolean\n isInputButton?: boolean\n}\n\nfunction LookupButton({\n value,\n validationMessage,\n hasMarginTop,\n isInputButton,\n}: Props) {\n const { isLookup, onLookup, isDisabled } = useLookupNotification()\n const formIsReadOnly = useFormIsReadOnly()\n if (!isLookup) {\n return null\n }\n\n const button = (\n <button\n type=\"button\"\n className={clsx(\n 'button is-primary ob-lookup__button cypress-lookup-button',\n {\n 'is-input-addon': isInputButton,\n 'ob-button': !isInputButton,\n 'has-margin-top-8': hasMarginTop,\n },\n )}\n onClick={() => onLookup(value)}\n disabled={\n formIsReadOnly ||\n isDisabled ||\n value === undefined ||\n (!!validationMessage && validationMessage !== lookupValidationMessage)\n }\n >\n {isInputButton && <span></span>}\n <span className=\"icon\">\n <i className=\"material-icons\">search</i>\n </span>\n <span className={isInputButton ? 'is-hidden-mobile' : undefined}>\n Lookup\n </span>\n </button>\n )\n\n if (isInputButton) {\n return <div className=\"control\">{button}</div>\n }\n\n return button\n}\n\nexport default React.memo(LookupButton)\n"]}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { FormTypes } from '@oneblink/types';
|
3
|
-
import { FormElementLookupHandler } from '
|
3
|
+
import { FormElementLookupHandler } from '../../types/form';
|
4
4
|
declare type Props = {
|
5
5
|
autoLookupValue?: unknown;
|
6
6
|
stringifyAutoLookupValue?: (autoLookupValue: unknown) => string;
|
@@ -2,17 +2,17 @@ import * as React from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
3
3
|
import { formService } from '@oneblink/apps';
|
4
4
|
import { generateHeaders } from '@oneblink/apps/dist/services/fetch';
|
5
|
-
import useIsOffline from '
|
5
|
+
import useIsOffline from '../../hooks/useIsOffline';
|
6
6
|
import OnLoading from './OnLoading';
|
7
|
-
import generateDefaultData from '
|
8
|
-
import { LookupNotificationContext } from '
|
9
|
-
import useFormDefinition from '
|
10
|
-
import useInjectPages from '
|
11
|
-
import useFormSubmissionModel from '
|
12
|
-
import useExecutedLookupCallback from '
|
13
|
-
import useFormIsReadOnly from '
|
7
|
+
import generateDefaultData from '../../services/generate-default-data';
|
8
|
+
import { LookupNotificationContext } from '../../hooks/useLookupNotification';
|
9
|
+
import useFormDefinition from '../../hooks/useFormDefinition';
|
10
|
+
import useInjectPages from '../../hooks/useInjectPages';
|
11
|
+
import useFormSubmissionModel from '../../hooks/useFormSubmissionModelContext';
|
12
|
+
import useExecutedLookupCallback from '../../hooks/useExecutedLookupCallback';
|
13
|
+
import useFormIsReadOnly from '../../hooks/useFormIsReadOnly';
|
14
14
|
import { Sentry } from '@oneblink/apps';
|
15
|
-
import useIsMounted from '
|
15
|
+
import useIsMounted from '../../hooks/useIsMounted';
|
16
16
|
function LookupNotificationComponent({ autoLookupValue, stringifyAutoLookupValue, element, onLookup, children, }) {
|
17
17
|
const isMounted = useIsMounted();
|
18
18
|
const isOffline = useIsOffline();
|