@corva/ui 3.74.0-1 → 3.74.0-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/cjs-bundle/components/AddComment/Popover.js +1 -1
- package/cjs-bundle/components/AddComment/Popover.js.map +1 -1
- package/cjs-bundle/components/AddComment/components/Content.js +1 -1
- package/cjs-bundle/components/AddComment/components/Content.js.map +1 -1
- package/cjs-bundle/components/AttachmentLightbox/AttachmentDocument.js +2 -0
- package/cjs-bundle/components/AttachmentLightbox/AttachmentDocument.js.map +1 -0
- package/cjs-bundle/components/AttachmentLightbox/AttachmentLightbox.js +1 -1
- package/cjs-bundle/components/AttachmentLightbox/AttachmentLightbox.js.map +1 -1
- package/cjs-bundle/components/AttachmentLightbox/AttachmentLightbox.scss.js +1 -1
- package/cjs-bundle/components/AttachmentLightbox/AttachmentPreviewPane.js +2 -0
- package/cjs-bundle/components/AttachmentLightbox/AttachmentPreviewPane.js.map +1 -0
- package/cjs-bundle/components/AttachmentLightbox/copyImageToClipboard.js +2 -0
- package/cjs-bundle/components/AttachmentLightbox/copyImageToClipboard.js.map +1 -0
- package/cjs-bundle/components/AttachmentLightbox/downloadAttachment.js +2 -0
- package/cjs-bundle/components/AttachmentLightbox/downloadAttachment.js.map +1 -0
- package/cjs-bundle/components/AttachmentLightbox/useAttachmentLightbox.js +1 -1
- package/cjs-bundle/components/AttachmentLightbox/useAttachmentLightbox.js.map +1 -1
- package/cjs-bundle/components/AttachmentLightbox/useZoomPan.js +2 -0
- package/cjs-bundle/components/AttachmentLightbox/useZoomPan.js.map +1 -0
- package/cjs-bundle/components/AttachmentPreview/AttachmentActionsMenu.js +2 -0
- package/cjs-bundle/components/AttachmentPreview/AttachmentActionsMenu.js.map +1 -0
- package/cjs-bundle/components/AttachmentPreview/AttachmentDownloadLink.js +2 -0
- package/cjs-bundle/components/AttachmentPreview/AttachmentDownloadLink.js.map +1 -0
- package/cjs-bundle/components/AttachmentPreview/AttachmentImage.js +2 -0
- package/cjs-bundle/components/AttachmentPreview/AttachmentImage.js.map +1 -0
- package/cjs-bundle/components/AttachmentPreview/AttachmentPreview.js +1 -1
- package/cjs-bundle/components/AttachmentPreview/AttachmentPreview.js.map +1 -1
- package/cjs-bundle/components/AttachmentPreview/AttachmentPreview.scss.js +1 -1
- package/cjs-bundle/components/AttachmentPreview/AttachmentRow.js +1 -1
- package/cjs-bundle/components/AttachmentPreview/AttachmentRow.js.map +1 -1
- package/cjs-bundle/components/AttachmentPreview/AttachmentTile.js +1 -1
- package/cjs-bundle/components/AttachmentPreview/AttachmentTile.js.map +1 -1
- package/cjs-bundle/components/AttachmentPreview/useStoredAttachment.js +2 -0
- package/cjs-bundle/components/AttachmentPreview/useStoredAttachment.js.map +1 -0
- package/cjs-bundle/components/AttachmentPreview/useStoredAttachments.js +1 -1
- package/cjs-bundle/components/AttachmentPreview/useStoredAttachments.js.map +1 -1
- package/cjs-bundle/components/BICOffsetPickerDialog/index.js +1 -1
- package/cjs-bundle/components/BICOffsetPickerDialog/index.js.map +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/CasingJoints/Editor.js +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/CasingJoints/Editor.js.map +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/Component.js +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/Component.js.map +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/DrillPipe/Editor.js +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/DrillPipe/Editor.js.map +1 -1
- package/cjs-bundle/components/CommentCard/CommentCard.js +1 -1
- package/cjs-bundle/components/CommentCard/CommentCard.js.map +1 -1
- package/cjs-bundle/components/CommentCard/CommentMenu.js +1 -1
- package/cjs-bundle/components/CommentCard/CommentMenu.js.map +1 -1
- package/cjs-bundle/components/CommentComposer/CommentComposer.js +1 -1
- package/cjs-bundle/components/CommentComposer/CommentComposer.js.map +1 -1
- package/cjs-bundle/components/CommentComposer/CommentReplyInput.js +1 -1
- package/cjs-bundle/components/CommentComposer/CommentReplyInput.js.map +1 -1
- package/cjs-bundle/components/CommentComposer/useAttachmentUpload.js +1 -1
- package/cjs-bundle/components/CommentComposer/useAttachmentUpload.js.map +1 -1
- package/cjs-bundle/components/CommentInputNext/CommentInputNext.js +1 -1
- package/cjs-bundle/components/CommentInputNext/CommentInputNext.js.map +1 -1
- package/cjs-bundle/components/CommentInputNext/useFilePaste.js +2 -0
- package/cjs-bundle/components/CommentInputNext/useFilePaste.js.map +1 -0
- package/cjs-bundle/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.js +1 -1
- package/cjs-bundle/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.js.map +1 -1
- package/cjs-bundle/components/DocumentViewer/DocumentViewer.js +1 -1
- package/cjs-bundle/components/DocumentViewer/DocumentViewer.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Component.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Component.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js.map +1 -1
- package/cjs-bundle/components/LinkedText/LinkedText.js +2 -0
- package/cjs-bundle/components/LinkedText/LinkedText.js.map +1 -0
- package/cjs-bundle/components/LinkedText/LinkedText.scss.js +2 -0
- package/cjs-bundle/components/LinkedText/LinkedText.scss.js.map +1 -0
- package/cjs-bundle/components/NewDocumentViewer/utils.js +1 -1
- package/cjs-bundle/components/NewDocumentViewer/utils.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/index.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/index.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/index.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/index.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/WellHubView/index.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/WellHubView/index.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/Filter/components/CustomDateFields/CustomDateFields.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/Filter/components/CustomDateFields/CustomDateFields.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellPickerContent/OffsetWellPickerContent.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellPickerContent/OffsetWellPickerContent.js.map +1 -1
- package/cjs-bundle/components/PadOffsetsPicker/StagesSelector.js +1 -1
- package/cjs-bundle/components/PadOffsetsPicker/StagesSelector.js.map +1 -1
- package/cjs-bundle/components/PadOffsetsPickerV2/PadOffsetsPickerV2.js +1 -1
- package/cjs-bundle/components/PadOffsetsPickerV2/PadOffsetsPickerV2.js.map +1 -1
- package/cjs-bundle/components/UserMention/constants.js +1 -1
- package/cjs-bundle/components/UserMention/constants.js.map +1 -1
- package/cjs-bundle/components/UserMention/index.js +1 -1
- package/cjs-bundle/components/UserMention/index.js.map +1 -1
- package/cjs-bundle/components/index.js +1 -1
- package/cjs-bundle/componentsV2/ButtonIcon/ButtonIcon.js +1 -1
- package/cjs-bundle/componentsV2/ButtonIcon/ButtonIcon.js.map +1 -1
- package/cjs-bundle/componentsV2/ButtonIcon/ButtonIcon.scss.js +1 -1
- package/cjs-bundle/componentsV2/Modal/Modal.js +1 -1
- package/cjs-bundle/componentsV2/Modal/Modal.js.map +1 -1
- package/cjs-bundle/componentsV2/Modal/constants.js +2 -0
- package/cjs-bundle/componentsV2/Modal/constants.js.map +1 -0
- package/cjs-bundle/effects/useOutsideClick.js +1 -1
- package/cjs-bundle/effects/useOutsideClick.js.map +1 -1
- package/cjs-bundle/utils/fetchAttachment.js +2 -0
- package/cjs-bundle/utils/fetchAttachment.js.map +1 -0
- package/cjs-bundle/utils/links.js +2 -0
- package/cjs-bundle/utils/links.js.map +1 -0
- package/components/AddComment/Popover.js +1 -1
- package/components/AddComment/Popover.js.map +1 -1
- package/components/AddComment/components/Content.js +1 -1
- package/components/AddComment/components/Content.js.map +1 -1
- package/components/AttachmentLightbox/AttachmentDocument.d.ts +6 -0
- package/components/AttachmentLightbox/AttachmentDocument.d.ts.map +1 -0
- package/components/AttachmentLightbox/AttachmentDocument.js +2 -0
- package/components/AttachmentLightbox/AttachmentDocument.js.map +1 -0
- package/components/AttachmentLightbox/AttachmentLightbox.d.ts +9 -8
- package/components/AttachmentLightbox/AttachmentLightbox.d.ts.map +1 -1
- package/components/AttachmentLightbox/AttachmentLightbox.js +1 -1
- package/components/AttachmentLightbox/AttachmentLightbox.js.map +1 -1
- package/components/AttachmentLightbox/AttachmentLightbox.scss.js +1 -1
- package/components/AttachmentLightbox/AttachmentPreviewPane.d.ts +9 -0
- package/components/AttachmentLightbox/AttachmentPreviewPane.d.ts.map +1 -0
- package/components/AttachmentLightbox/AttachmentPreviewPane.js +2 -0
- package/components/AttachmentLightbox/AttachmentPreviewPane.js.map +1 -0
- package/components/AttachmentLightbox/__tests__/AttachmentDocument.test.d.ts +2 -0
- package/components/AttachmentLightbox/__tests__/AttachmentDocument.test.d.ts.map +1 -0
- package/components/AttachmentLightbox/__tests__/AttachmentLightbox.test.d.ts +2 -0
- package/components/AttachmentLightbox/__tests__/AttachmentLightbox.test.d.ts.map +1 -0
- package/components/AttachmentLightbox/__tests__/copyImageToClipboard.test.d.ts +2 -0
- package/components/AttachmentLightbox/__tests__/copyImageToClipboard.test.d.ts.map +1 -0
- package/components/AttachmentLightbox/__tests__/downloadAttachment.test.d.ts +2 -0
- package/components/AttachmentLightbox/__tests__/downloadAttachment.test.d.ts.map +1 -0
- package/components/AttachmentLightbox/__tests__/useZoomPan.test.d.ts +2 -0
- package/components/AttachmentLightbox/__tests__/useZoomPan.test.d.ts.map +1 -0
- package/components/AttachmentLightbox/copyImageToClipboard.d.ts +4 -0
- package/components/AttachmentLightbox/copyImageToClipboard.d.ts.map +1 -0
- package/components/AttachmentLightbox/copyImageToClipboard.js +2 -0
- package/components/AttachmentLightbox/copyImageToClipboard.js.map +1 -0
- package/components/AttachmentLightbox/downloadAttachment.d.ts +10 -0
- package/components/AttachmentLightbox/downloadAttachment.d.ts.map +1 -0
- package/components/AttachmentLightbox/downloadAttachment.js +2 -0
- package/components/AttachmentLightbox/downloadAttachment.js.map +1 -0
- package/components/AttachmentLightbox/useAttachmentLightbox.d.ts +6 -2
- package/components/AttachmentLightbox/useAttachmentLightbox.d.ts.map +1 -1
- package/components/AttachmentLightbox/useAttachmentLightbox.js +1 -1
- package/components/AttachmentLightbox/useAttachmentLightbox.js.map +1 -1
- package/components/AttachmentLightbox/useZoomPan.d.ts +29 -0
- package/components/AttachmentLightbox/useZoomPan.d.ts.map +1 -0
- package/components/AttachmentLightbox/useZoomPan.js +2 -0
- package/components/AttachmentLightbox/useZoomPan.js.map +1 -0
- package/components/AttachmentPreview/AttachmentActionsMenu.d.ts +16 -0
- package/components/AttachmentPreview/AttachmentActionsMenu.d.ts.map +1 -0
- package/components/AttachmentPreview/AttachmentActionsMenu.js +2 -0
- package/components/AttachmentPreview/AttachmentActionsMenu.js.map +1 -0
- package/components/AttachmentPreview/AttachmentDownloadLink.d.ts +11 -0
- package/components/AttachmentPreview/AttachmentDownloadLink.d.ts.map +1 -0
- package/components/AttachmentPreview/AttachmentDownloadLink.js +2 -0
- package/components/AttachmentPreview/AttachmentDownloadLink.js.map +1 -0
- package/components/AttachmentPreview/AttachmentImage.d.ts +12 -0
- package/components/AttachmentPreview/AttachmentImage.d.ts.map +1 -0
- package/components/AttachmentPreview/AttachmentImage.js +2 -0
- package/components/AttachmentPreview/AttachmentImage.js.map +1 -0
- package/components/AttachmentPreview/AttachmentPreview.d.ts.map +1 -1
- package/components/AttachmentPreview/AttachmentPreview.js +1 -1
- package/components/AttachmentPreview/AttachmentPreview.js.map +1 -1
- package/components/AttachmentPreview/AttachmentPreview.scss.js +1 -1
- package/components/AttachmentPreview/AttachmentPreview.types.d.ts +7 -0
- package/components/AttachmentPreview/AttachmentPreview.types.d.ts.map +1 -1
- package/components/AttachmentPreview/AttachmentRow.d.ts +7 -3
- package/components/AttachmentPreview/AttachmentRow.d.ts.map +1 -1
- package/components/AttachmentPreview/AttachmentRow.js +1 -1
- package/components/AttachmentPreview/AttachmentRow.js.map +1 -1
- package/components/AttachmentPreview/AttachmentTile.d.ts +5 -1
- package/components/AttachmentPreview/AttachmentTile.d.ts.map +1 -1
- package/components/AttachmentPreview/AttachmentTile.js +1 -1
- package/components/AttachmentPreview/AttachmentTile.js.map +1 -1
- package/components/AttachmentPreview/__tests__/AttachmentActionsMenu.test.d.ts +2 -0
- package/components/AttachmentPreview/__tests__/AttachmentActionsMenu.test.d.ts.map +1 -0
- package/components/AttachmentPreview/__tests__/AttachmentDownloadLink.test.d.ts +2 -0
- package/components/AttachmentPreview/__tests__/AttachmentDownloadLink.test.d.ts.map +1 -0
- package/components/AttachmentPreview/__tests__/AttachmentImage.test.d.ts +2 -0
- package/components/AttachmentPreview/__tests__/AttachmentImage.test.d.ts.map +1 -0
- package/components/AttachmentPreview/__tests__/AttachmentTile.test.d.ts +2 -0
- package/components/AttachmentPreview/__tests__/AttachmentTile.test.d.ts.map +1 -0
- package/components/AttachmentPreview/__tests__/useStoredAttachments.test.d.ts +2 -0
- package/components/AttachmentPreview/__tests__/useStoredAttachments.test.d.ts.map +1 -0
- package/components/AttachmentPreview/useStoredAttachment.d.ts +8 -0
- package/components/AttachmentPreview/useStoredAttachment.d.ts.map +1 -1
- package/components/AttachmentPreview/useStoredAttachment.js +2 -0
- package/components/AttachmentPreview/useStoredAttachment.js.map +1 -0
- package/components/AttachmentPreview/useStoredAttachments.d.ts +1 -1
- package/components/AttachmentPreview/useStoredAttachments.d.ts.map +1 -1
- package/components/AttachmentPreview/useStoredAttachments.js +1 -1
- package/components/AttachmentPreview/useStoredAttachments.js.map +1 -1
- package/components/BICOffsetPickerDialog/index.js +1 -1
- package/components/BICOffsetPickerDialog/index.js.map +1 -1
- package/components/Casing/CasingTableV2/components/CasingJoints/Editor.js +1 -1
- package/components/Casing/CasingTableV2/components/CasingJoints/Editor.js.map +1 -1
- package/components/Casing/CasingTableV2/components/Component.js +1 -1
- package/components/Casing/CasingTableV2/components/Component.js.map +1 -1
- package/components/Casing/CasingTableV2/components/DrillPipe/Editor.js +1 -1
- package/components/Casing/CasingTableV2/components/DrillPipe/Editor.js.map +1 -1
- package/components/CommentCard/CommentCard.d.ts.map +1 -1
- package/components/CommentCard/CommentCard.js +1 -1
- package/components/CommentCard/CommentCard.js.map +1 -1
- package/components/CommentCard/CommentCard.types.d.ts +2 -0
- package/components/CommentCard/CommentCard.types.d.ts.map +1 -1
- package/components/CommentCard/CommentMenu.d.ts.map +1 -1
- package/components/CommentCard/CommentMenu.js +1 -1
- package/components/CommentCard/CommentMenu.js.map +1 -1
- package/components/CommentComposer/CommentComposer.d.ts.map +1 -1
- package/components/CommentComposer/CommentComposer.js +1 -1
- package/components/CommentComposer/CommentComposer.js.map +1 -1
- package/components/CommentComposer/CommentReplyInput.d.ts.map +1 -1
- package/components/CommentComposer/CommentReplyInput.js +1 -1
- package/components/CommentComposer/CommentReplyInput.js.map +1 -1
- package/components/CommentComposer/__tests__/useAttachmentUpload.linked.test.d.ts +2 -0
- package/components/CommentComposer/__tests__/useAttachmentUpload.linked.test.d.ts.map +1 -0
- package/components/CommentComposer/useAttachmentUpload.d.ts +1 -0
- package/components/CommentComposer/useAttachmentUpload.d.ts.map +1 -1
- package/components/CommentComposer/useAttachmentUpload.js +1 -1
- package/components/CommentComposer/useAttachmentUpload.js.map +1 -1
- package/components/CommentInputNext/CommentInputNext.d.ts +2 -0
- package/components/CommentInputNext/CommentInputNext.d.ts.map +1 -1
- package/components/CommentInputNext/CommentInputNext.js +1 -1
- package/components/CommentInputNext/CommentInputNext.js.map +1 -1
- package/components/CommentInputNext/__tests__/useFilePaste.test.d.ts +2 -0
- package/components/CommentInputNext/__tests__/useFilePaste.test.d.ts.map +1 -0
- package/components/CommentInputNext/useFilePaste.d.ts +17 -0
- package/components/CommentInputNext/useFilePaste.d.ts.map +1 -0
- package/components/CommentInputNext/useFilePaste.js +2 -0
- package/components/CommentInputNext/useFilePaste.js.map +1 -0
- package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.d.ts +2 -1
- package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.d.ts.map +1 -1
- package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.js +1 -1
- package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.js.map +1 -1
- package/components/DevCenter/DevCenterAppContainer/__tests__/DevCenterAppContainer.registerAITools.test.d.ts +2 -0
- package/components/DevCenter/DevCenterAppContainer/__tests__/DevCenterAppContainer.registerAITools.test.d.ts.map +1 -0
- package/components/DocumentViewer/DocumentViewer.js +1 -1
- package/components/DocumentViewer/DocumentViewer.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Component.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Component.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js.map +1 -1
- package/components/LinkedText/LinkedText.d.ts +17 -0
- package/components/LinkedText/LinkedText.d.ts.map +1 -0
- package/components/LinkedText/LinkedText.js +2 -0
- package/components/LinkedText/LinkedText.js.map +1 -0
- package/components/LinkedText/LinkedText.scss.js +2 -0
- package/components/LinkedText/LinkedText.scss.js.map +1 -0
- package/components/LinkedText/__tests__/LinkedText.test.d.ts +2 -0
- package/components/LinkedText/__tests__/LinkedText.test.d.ts.map +1 -0
- package/components/LinkedText/index.d.ts +2 -0
- package/components/LinkedText/index.d.ts.map +1 -0
- package/components/NewDocumentViewer/utils.d.ts.map +1 -1
- package/components/NewDocumentViewer/utils.js +1 -1
- package/components/NewDocumentViewer/utils.js.map +1 -1
- package/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js +1 -1
- package/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js.map +1 -1
- package/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js +1 -1
- package/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js.map +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js.map +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/index.js +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/index.js.map +1 -1
- package/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js +1 -1
- package/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js.map +1 -1
- package/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js +1 -1
- package/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js.map +1 -1
- package/components/OffsetWellPickerV3/components/TabSelection/index.js +1 -1
- package/components/OffsetWellPickerV3/components/TabSelection/index.js.map +1 -1
- package/components/OffsetWellPickerV3/components/WellHubView/index.js +1 -1
- package/components/OffsetWellPickerV3/components/WellHubView/index.js.map +1 -1
- package/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js +1 -1
- package/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js.map +1 -1
- package/components/OffsetWellPickerV5/components/Filter/components/CustomDateFields/CustomDateFields.js +1 -1
- package/components/OffsetWellPickerV5/components/Filter/components/CustomDateFields/CustomDateFields.js.map +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellPickerContent/OffsetWellPickerContent.js +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellPickerContent/OffsetWellPickerContent.js.map +1 -1
- package/components/PadOffsetsPicker/StagesSelector.js +1 -1
- package/components/PadOffsetsPicker/StagesSelector.js.map +1 -1
- package/components/PadOffsetsPickerV2/PadOffsetsPickerV2.js +1 -1
- package/components/PadOffsetsPickerV2/PadOffsetsPickerV2.js.map +1 -1
- package/components/UserMention/__tests__/highlightLinks.test.d.ts +2 -0
- package/components/UserMention/__tests__/highlightLinks.test.d.ts.map +1 -0
- package/components/UserMention/constants.d.ts +1 -0
- package/components/UserMention/constants.d.ts.map +1 -1
- package/components/UserMention/constants.js +1 -1
- package/components/UserMention/constants.js.map +1 -1
- package/components/UserMention/index.js +1 -1
- package/components/UserMention/index.js.map +1 -1
- package/components/index.d.ts +2 -0
- package/components/index.d.ts.map +1 -1
- package/components/index.js +1 -1
- package/componentsV2/ButtonIcon/ButtonIcon.d.ts +2 -0
- package/componentsV2/ButtonIcon/ButtonIcon.d.ts.map +1 -1
- package/componentsV2/ButtonIcon/ButtonIcon.js +1 -1
- package/componentsV2/ButtonIcon/ButtonIcon.js.map +1 -1
- package/componentsV2/ButtonIcon/ButtonIcon.scss.js +1 -1
- package/componentsV2/ButtonIcon/ButtonIcon.stories.d.ts +1 -0
- package/componentsV2/ButtonIcon/ButtonIcon.stories.d.ts.map +1 -1
- package/componentsV2/Modal/Modal.d.ts.map +1 -1
- package/componentsV2/Modal/Modal.js +1 -1
- package/componentsV2/Modal/Modal.js.map +1 -1
- package/componentsV2/Modal/constants.d.ts +3 -0
- package/componentsV2/Modal/constants.d.ts.map +1 -0
- package/componentsV2/Modal/constants.js +2 -0
- package/componentsV2/Modal/constants.js.map +1 -0
- package/effects/__tests__/useOutsideClick.test.d.ts.map +1 -1
- package/effects/useOutsideClick.d.ts.map +1 -1
- package/effects/useOutsideClick.js +1 -1
- package/effects/useOutsideClick.js.map +1 -1
- package/mcp-server/server.mjs +38 -12
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/utils/__tests__/fetchAttachment.test.d.ts +2 -0
- package/utils/__tests__/fetchAttachment.test.d.ts.map +1 -0
- package/utils/__tests__/links.test.d.ts +2 -0
- package/utils/__tests__/links.test.d.ts.map +1 -0
- package/utils/fetchAttachment.d.ts +3 -0
- package/utils/fetchAttachment.d.ts.map +1 -0
- package/utils/fetchAttachment.js +2 -0
- package/utils/fetchAttachment.js.map +1 -0
- package/utils/links.d.ts +14 -0
- package/utils/links.d.ts.map +1 -0
- package/utils/links.js +2 -0
- package/utils/links.js.map +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentLightbox.js","sources":["../../../../src/components/AttachmentLightbox/AttachmentLightbox.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"AttachmentLightbox.js","sources":["../../../../src/components/AttachmentLightbox/AttachmentLightbox.tsx"],"sourcesContent":["import { ReactNode, useCallback, useEffect } from 'react';\n\nimport { Modal } from '../../componentsV2/Modal';\nimport { ButtonIcon } from '../../componentsV2/ButtonIcon';\nimport { AttachmentRow } from '../AttachmentPreview/AttachmentRow';\nimport type { AttachmentPreviewItem } from '../AttachmentPreview/AttachmentPreview.types';\n\nimport { AttachmentPreviewPane } from './AttachmentPreviewPane';\n\nimport styles from './AttachmentLightbox.scss';\n\nimport { LeftIcon, RightIcon } from '~/icons';\n\nexport type AttachmentLightboxProps = {\n items: AttachmentPreviewItem[];\n /** `null` keeps the lightbox closed. */\n activeId: AttachmentPreviewItem['id'] | null;\n onActiveIdChange: (id: AttachmentPreviewItem['id']) => void;\n onClose: () => void;\n /** Adds \"Share file\" to the overflow menu. */\n onShare?: (item: AttachmentPreviewItem) => void;\n title?: ReactNode;\n testId?: string;\n};\n\nexport const AttachmentLightbox = ({\n items,\n activeId,\n onActiveIdChange,\n onClose,\n onShare,\n title = 'Files',\n testId,\n}: AttachmentLightboxProps) => {\n const activeIndex = items.findIndex(item => item.id === activeId);\n const active = activeIndex === -1 ? undefined : items[activeIndex];\n\n const step = useCallback(\n (delta: number) => {\n const next = items[activeIndex + delta];\n\n if (next) onActiveIdChange(next.id);\n },\n [items, activeIndex, onActiveIdChange]\n );\n\n useEffect(() => {\n if (!active) return undefined;\n\n const handleKeyDown = (event: KeyboardEvent) => {\n // A focused <video> seeks with the arrows; only steer when nothing nearer claims the key.\n if (event.defaultPrevented) return;\n\n // With nothing focused the target is the document, which has no `closest`.\n const target = event.target as Element | null;\n\n if (\n typeof target?.closest === 'function' &&\n target.closest('video, audio, input, textarea, [role=\"menu\"]')\n ) {\n return;\n }\n\n if (event.key === 'ArrowLeft') step(-1);\n if (event.key === 'ArrowRight') step(1);\n };\n\n document.addEventListener('keydown', handleKeyDown);\n\n return () => document.removeEventListener('keydown', handleKeyDown);\n }, [active, step]);\n\n const strip =\n items.length > 1 ? (\n <div className={styles.strip}>\n <ButtonIcon\n size=\"large\"\n ariaLabel=\"Previous attachment\"\n disabled={activeIndex <= 0}\n onClick={() => step(-1)}\n testId=\"attachment-lightbox-prev\"\n >\n <LeftIcon />\n </ButtonIcon>\n\n <AttachmentRow\n items={items}\n selectedId={activeId ?? undefined}\n hideActions\n onItemClick={item => onActiveIdChange(item.id)}\n className={styles.stripRow}\n testId=\"attachment-lightbox-strip\"\n />\n\n <ButtonIcon\n size=\"large\"\n ariaLabel=\"Next attachment\"\n disabled={activeIndex === -1 || activeIndex >= items.length - 1}\n onClick={() => step(1)}\n testId=\"attachment-lightbox-next\"\n >\n <RightIcon />\n </ButtonIcon>\n </div>\n ) : undefined;\n\n return (\n <Modal\n open={!!active}\n size=\"fullscreen\"\n title={title}\n onClose={onClose}\n actions={strip}\n testId={testId}\n >\n {!!active && <AttachmentPreviewPane item={active} onShare={onShare} />}\n </Modal>\n );\n};\n"],"names":["_ref","items","activeId","onActiveIdChange","onClose","onShare","_ref$title","title","testId","activeIndex","findIndex","item","id","active","undefined","step","useCallback","delta","next","useEffect","handleKeyDown","event","defaultPrevented","target","closest","key","document","addEventListener","removeEventListener","strip","length","_jsxs","className","styles","children","_jsx","ButtonIcon","size","ariaLabel","disabled","onClick","LeftIcon","AttachmentRow","selectedId","hideActions","onItemClick","stripRow","RightIcon","Modal","open","actions","AttachmentPreviewPane"],"mappings":"stIAyBkC,SAQHA,GAAA,IAP7BC,IAAAA,MACAC,IAAAA,SACAC,IAAAA,iBACAC,IAAAA,QACAC,IAAAA,QAAOC,EAAAN,EACPO,MAAAA,aAAQ,QAAOD,EACfE,IAAAA,OAEMC,EAAcR,EAAMS,WAAU,SAAAC,GAAI,OAAIA,EAAKC,KAAOV,KAClDW,GAA0B,IAAjBJ,OAAqBK,EAAYb,EAAMQ,GAEhDM,EAAOC,eACX,SAACC,GACC,IAAMC,EAAOjB,EAAMQ,EAAcQ,GAE7BC,GAAMf,EAAiBe,EAAKN,GACjC,GACD,CAACX,EAAOQ,EAAaN,IAGvBgB,EAAAA,WAAU,WACR,GAAKN,EAAL,CAEA,IAAMO,EAAgB,SAACC,GAErB,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ject.es.js')(".
|
|
1
|
+
"use strict";require('./../../ext-esm/style-inject/dist/style-inject.es.js')(".AttachmentLightbox_strip__6Ahrc{align-items:center;display:flex;flex:1;gap:8px;justify-content:center;min-width:0}.AttachmentLightbox_stripRow__uue68.AttachmentLightbox_stripRow__uue68{flex:0 1 auto;gap:8px;justify-content:flex-start}.AttachmentLightbox_pane__KzcgJ{background:rgb(from var(--palette-primary-text-1) r g b/.02);border-radius:8px;display:flex;flex-direction:column;height:100%;padding:8px 16px 16px;position:relative}.AttachmentLightbox_paneHeader__Z6qqZ{align-items:center;display:flex;gap:16px;justify-content:space-between;padding:4px 0}.AttachmentLightbox_paneName__wHaha{display:flex;flex-direction:column;justify-content:center;min-width:0}.AttachmentLightbox_paneFileName__Ans-0{color:var(--palette-primary-text-1);font-size:16px;font-weight:500;line-height:22px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.AttachmentLightbox_paneFileSize__kHpFZ{color:var(--palette-primary-text-6);font-size:12px;line-height:16px}.AttachmentLightbox_paneActions__HYZPg{align-items:center;display:flex;flex-shrink:0;gap:8px}.AttachmentLightbox_paneActionLink__ij8qw{color:inherit;display:inline-flex;text-decoration:none}.AttachmentLightbox_paneViewport__eNxCs{display:flex;flex:1;margin-top:8px;min-height:0;overflow:auto}.AttachmentLightbox_paneViewportPannable__aioSN{cursor:grab}.AttachmentLightbox_paneViewportPanning__ZN5R3{cursor:grabbing;user-select:none}.AttachmentLightbox_paneZoomBox__Z1Ccd{display:flex;flex:none;height:calc(100%*var(--attachment-zoom, 1));width:calc(100%*var(--attachment-zoom, 1))}.AttachmentLightbox_paneMedia__nXjJ0{-webkit-user-drag:none;border-radius:8px;height:100%;object-fit:contain;user-select:none;width:100%}.AttachmentLightbox_paneZoomControls__y7ImM{bottom:8px;display:flex;flex-direction:column;gap:8px;position:absolute;right:8px;z-index:2}.AttachmentLightbox_paneZoomButton__kndeG{display:inline-flex}.AttachmentLightbox_documentFrame__-AP36,.AttachmentLightbox_documentTable__vMkX5,.AttachmentLightbox_documentText__Tn8b7{border-radius:8px;height:100%;overflow:auto;position:relative;width:100%}.AttachmentLightbox_documentText__Tn8b7{color:var(--palette-primary-text-1);font-size:14px;line-height:20px;padding:16px}.AttachmentLightbox_documentText__Tn8b7 pre{font-family:inherit;margin:0;white-space:pre-wrap;word-break:break-word}.AttachmentLightbox_documentTable__vMkX5{color:var(--palette-primary-text-1)}.AttachmentLightbox_documentState__h-iDd{align-items:center;display:flex;flex-direction:column;gap:8px;justify-content:center;margin:auto;padding:24px;text-align:center}.AttachmentLightbox_fallbackName__JO0HH{color:var(--palette-primary-text-1);font-size:16px;line-height:22px;margin-top:8px;word-break:break-word}.AttachmentLightbox_fallbackHint__tPWNV{color:var(--palette-primary-text-6);font-size:14px;line-height:20px;margin-bottom:8px}.AttachmentLightbox_fallbackDownload__Noq5-{text-decoration:none}"),module.exports={spacing:"8",strip:"AttachmentLightbox_strip__6Ahrc",stripRow:"AttachmentLightbox_stripRow__uue68",pane:"AttachmentLightbox_pane__KzcgJ",paneHeader:"AttachmentLightbox_paneHeader__Z6qqZ",paneName:"AttachmentLightbox_paneName__wHaha",paneFileName:"AttachmentLightbox_paneFileName__Ans-0",paneFileSize:"AttachmentLightbox_paneFileSize__kHpFZ",paneActions:"AttachmentLightbox_paneActions__HYZPg",paneActionLink:"AttachmentLightbox_paneActionLink__ij8qw",paneViewport:"AttachmentLightbox_paneViewport__eNxCs",paneViewportPannable:"AttachmentLightbox_paneViewportPannable__aioSN",paneViewportPanning:"AttachmentLightbox_paneViewportPanning__ZN5R3",paneZoomBox:"AttachmentLightbox_paneZoomBox__Z1Ccd",paneMedia:"AttachmentLightbox_paneMedia__nXjJ0",paneZoomControls:"AttachmentLightbox_paneZoomControls__y7ImM",paneZoomButton:"AttachmentLightbox_paneZoomButton__kndeG",documentFrame:"AttachmentLightbox_documentFrame__-AP36",documentTable:"AttachmentLightbox_documentTable__vMkX5",documentText:"AttachmentLightbox_documentText__Tn8b7",documentState:"AttachmentLightbox_documentState__h-iDd",fallbackName:"AttachmentLightbox_fallbackName__JO0HH",fallbackHint:"AttachmentLightbox_fallbackHint__tPWNV",fallbackDownload:"AttachmentLightbox_fallbackDownload__Noq5-"};
|
|
2
2
|
//# sourceMappingURL=AttachmentLightbox.scss.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var s=require("@babel/runtime/helpers/defineProperty"),e=require("react"),o=require("classnames"),c=require("../../componentsV2/ButtonIcon/ButtonIcon.js"),n=require("../../componentsV2/Tooltip/Tooltip.js"),i=require("../AttachmentPreview/AttachmentActionsMenu.js"),r=require("../AttachmentPreview/AttachmentImage.js"),t=require("../AttachmentPreview/AttachmentDownloadLink.js"),u=require("./AttachmentDocument.js"),a=require("./useZoomPan.js"),m=require("./AttachmentLightbox.scss.js"),l=require("../../icons/iconParkIcons.js");require("../../icons/customIcons/icons/AddMessage.js"),require("../../icons/customIcons/icons/DragOne.js"),require("../../icons/customIcons/icons/Attention.js"),require("../../icons/customIcons/icons/Collapse.js"),require("../../icons/customIcons/icons/Dashboard.js"),require("../../icons/customIcons/icons/Expand.js"),require("../../icons/customIcons/icons/FolderClosed.js"),require("../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../icons/customIcons/icons/FolderOpened.js"),require("../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../icons/customIcons/icons/LessOrEqual.js"),require("../../icons/customIcons/icons/Search.js"),require("../../icons/customIcons/icons/SearchOne.js"),require("../../icons/customIcons/icons/Wellhub.js"),require("../../icons/customIcons/icons/MultiRuler.js"),require("../../icons/customIcons/icons/Checkbox.js"),require("../../icons/customIcons/icons/CheckboxChecked.js"),require("../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../icons/customIcons/icons/Radio.js"),require("../../icons/customIcons/icons/RadioChecked.js"),require("../../icons/customIcons/icons/SimulFrac.js"),require("../../icons/customIcons/icons/ZipperFrac.js"),require("../../icons/customIcons/icons/CautionFilled.js"),require("../../icons/customIcons/icons/MoreApp.js"),require("../../icons/customIcons/icons/Pad.js"),require("../../icons/customIcons/icons/DrilloutUnit.js"),require("../../icons/customIcons/icons/FracFleet.js"),require("../../icons/customIcons/icons/Global.js"),require("../../icons/customIcons/icons/Program.js"),require("../../icons/customIcons/icons/Rig.js"),require("../../icons/customIcons/icons/Well.js"),require("../../icons/customIcons/icons/Gap.js"),require("../../icons/customIcons/icons/Pin.js"),require("../../icons/customIcons/icons/CloseOneFilled.js"),require("../../icons/customIcons/icons/AttentionFilled.js"),require("../../icons/customIcons/icons/CheckOneFilled.js"),require("../../icons/customIcons/icons/Archive.js"),require("../../icons/customIcons/icons/ArchiveCancel.js"),require("../../icons/customIcons/icons/Unarchive.js"),require("../../icons/customIcons/icons/Archived.js"),require("../../icons/customIcons/icons/InterventionUnit.js"),require("../../icons/customIcons/icons/CloudDelete.js"),require("../../icons/customIcons/icons/Lasso.js"),require("../../icons/customIcons/icons/Radius.js"),require("../../icons/customIcons/icons/ErrorOps.js"),require("../../icons/customIcons/icons/DataTypeOps.js"),require("../../icons/customIcons/icons/FalsePositiveOps.js"),require("../../icons/customIcons/icons/CalibrationOps.js"),require("../../icons/customIcons/icons/CriticalOps.js"),require("../../icons/customIcons/icons/Company.js"),require("../../icons/customIcons/icons/ArchiveOne.js"),require("../../icons/customIcons/icons/ParseBotFusion.js"),require("../../icons/customIcons/icons/Connect.js"),require("../../icons/customIcons/icons/PuzzleOne.js"),require("../../icons/customIcons/icons/Feed.js"),require("../../icons/customIcons/icons/Prompt.js"),require("../../icons/customIcons/icons/Companies.js"),require("../../icons/customIcons/icons/ClipboardAi.js"),require("../../icons/customIcons/icons/Key.js"),require("../../icons/customIcons/icons/AtSignCrossed.js"),require("../../icons/customIcons/icons/MappingManual.js"),require("../../icons/customIcons/icons/Mapping.js"),require("../../icons/customIcons/icons/Metrics.js"),require("../../icons/customIcons/icons/Drops.js"),require("../../icons/customIcons/icons/ClipboardSearch.js"),require("../../icons/customIcons/icons/Template.js"),require("../../icons/customIcons/icons/ClipboardMetrics.js"),require("../../icons/customIcons/icons/ClipboardBuilder.js"),require("../../icons/customIcons/icons/UnitConversion.js"),require("../../icons/customIcons/icons/NPT.js"),require("../../icons/customIcons/icons/GuidedFrac.js");var j=require("../../utils/formatFileSize.js"),d=require("../../utils/main.js"),p=require("react/jsx-runtime");function q(s){return s&&"object"==typeof s&&"default"in s?s:{default:s}}var I=q(s),h=q(o);function v(s,e){var o=Object.keys(s);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(s);e&&(c=c.filter((function(e){return Object.getOwnPropertyDescriptor(s,e).enumerable}))),o.push.apply(o,c)}return o}function b(s){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?v(Object(o),!0).forEach((function(e){I.default(s,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(o)):v(Object(o)).forEach((function(e){Object.defineProperty(s,e,Object.getOwnPropertyDescriptor(o,e))}))}return s}exports.AttachmentPreviewPane=function(s){var o,q=s.item,I=s.onShare,v=e.useRef(null),f=null!==(o=q.kind)&&void 0!==o?o:"file",O="image"===f||"video"===f,P=a.useZoomPan({canZoom:O,canPan:"image"===f,resetKey:q.id}),x=P.viewportRef,g=P.zoom,A=P.zoomIn,C=P.zoomOut,y=P.canZoomIn,w=P.canZoomOut,F=P.isPannable,N=P.isPanning,z=P.panHandlers,k=d.default.getFileNameWithExtensionFromPath(q.name),D=q.downloadUrl||q.src;return p.jsxs("div",{className:m.pane,"data-testid":"attachment-preview-pane",children:[p.jsxs("div",{className:m.paneHeader,children:[p.jsxs("div",{className:m.paneName,children:[p.jsx("div",{className:m.paneFileName,title:k,children:k}),void 0!==q.size&&p.jsx("div",{className:m.paneFileSize,children:j.formatFileSize(q.size)})]}),p.jsxs("div",{className:m.paneActions,children:[!!D&&p.jsx(t.AttachmentDownloadLink,{url:D,fileName:k,className:m.paneActionLink,testId:"attachment-preview-download"}),p.jsx(i.AttachmentActionsMenu,{item:q,onShare:I,imageRef:v})]})]}),p.jsx("div",b(b({className:h.default(m.paneViewport,F&&m.paneViewportPannable,N&&m.paneViewportPanning),ref:x},z),{},{children:p.jsxs("div",{className:m.paneZoomBox,style:{"--attachment-zoom":g},"data-testid":"attachment-preview-zoom-box",children:["image"===f&&p.jsx(r.AttachmentImage,{ref:v,src:q.src,alt:k,className:m.paneMedia,draggable:!1}),"video"===f&&p.jsx("video",{src:q.src,className:m.paneMedia,controls:!0,autoPlay:!0,playsInline:!0}),"file"===f&&p.jsx(u.AttachmentDocument,{item:q},q.id)]})})),O&&p.jsxs("div",{className:m.paneZoomControls,children:[p.jsx(n.Tooltip,{title:"Zoom in",placement:"left",children:p.jsx("span",{className:m.paneZoomButton,children:p.jsx(c.ButtonIcon,{size:"small",type:"tertiaryBg",ariaLabel:"Zoom in",disabled:!y,onClick:A,testId:"attachment-preview-zoom-in",children:p.jsx(l.PlusIcon,{})})})}),p.jsx(n.Tooltip,{title:"Zoom out",placement:"left",children:p.jsx("span",{className:m.paneZoomButton,children:p.jsx(c.ButtonIcon,{size:"small",type:"tertiaryBg",ariaLabel:"Zoom out",disabled:!w,onClick:C,testId:"attachment-preview-zoom-out",children:p.jsx(l.MinusIcon,{})})})})]})]})};
|
|
2
|
+
//# sourceMappingURL=AttachmentPreviewPane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentPreviewPane.js","sources":["../../../../src/components/AttachmentLightbox/AttachmentPreviewPane.tsx"],"sourcesContent":["import { CSSProperties, useRef } from 'react';\nimport classNames from 'classnames';\n\nimport { ButtonIcon } from '../../componentsV2/ButtonIcon';\nimport { Tooltip } from '../../componentsV2/Tooltip';\nimport { AttachmentActionsMenu } from '../AttachmentPreview/AttachmentActionsMenu';\nimport { AttachmentImage } from '../AttachmentPreview/AttachmentImage';\nimport { AttachmentDownloadLink } from '../AttachmentPreview/AttachmentDownloadLink';\nimport type { AttachmentPreviewItem } from '../AttachmentPreview/AttachmentPreview.types';\n\nimport { AttachmentDocument } from './AttachmentDocument';\nimport { useZoomPan } from './useZoomPan';\n\nimport styles from './AttachmentLightbox.scss';\n\nimport { MinusIcon, PlusIcon } from '~/icons';\nimport { formatFileSize } from '~/utils/formatFileSize';\nimport utils from '~/utils/main';\n\nexport type AttachmentPreviewPaneProps = {\n item: AttachmentPreviewItem;\n /** Adds \"Share file\" to the overflow menu. */\n onShare?: (item: AttachmentPreviewItem) => void;\n};\n\n/** Zoom is media-only — document viewers scroll and zoom on their own. */\nexport const AttachmentPreviewPane = ({ item, onShare }: AttachmentPreviewPaneProps) => {\n const imageRef = useRef<HTMLImageElement>(null);\n const kind = item.kind ?? 'file';\n const isMedia = kind === 'image' || kind === 'video';\n\n const {\n viewportRef,\n zoom,\n zoomIn,\n zoomOut,\n canZoomIn,\n canZoomOut,\n isPannable,\n isPanning,\n panHandlers,\n // Panning a zoomed <video> would swallow its own controls, so only images get the drag.\n } = useZoomPan({ canZoom: isMedia, canPan: kind === 'image', resetKey: item.id });\n\n const fileName = utils.getFileNameWithExtensionFromPath(item.name);\n const downloadUrl = item.downloadUrl || item.src;\n\n return (\n <div className={styles.pane} data-testid=\"attachment-preview-pane\">\n <div className={styles.paneHeader}>\n <div className={styles.paneName}>\n <div className={styles.paneFileName} title={fileName}>\n {fileName}\n </div>\n {item.size !== undefined && (\n <div className={styles.paneFileSize}>{formatFileSize(item.size)}</div>\n )}\n </div>\n\n <div className={styles.paneActions}>\n {!!downloadUrl && (\n <AttachmentDownloadLink\n url={downloadUrl}\n fileName={fileName}\n className={styles.paneActionLink}\n testId=\"attachment-preview-download\"\n />\n )}\n\n <AttachmentActionsMenu item={item} onShare={onShare} imageRef={imageRef} />\n </div>\n </div>\n\n <div\n className={classNames(\n styles.paneViewport,\n isPannable && styles.paneViewportPannable,\n isPanning && styles.paneViewportPanning\n )}\n ref={viewportRef}\n {...panHandlers}\n >\n <div\n className={styles.paneZoomBox}\n style={{ '--attachment-zoom': zoom } as CSSProperties}\n data-testid=\"attachment-preview-zoom-box\"\n >\n {kind === 'image' && (\n <AttachmentImage\n ref={imageRef}\n src={item.src}\n alt={fileName}\n className={styles.paneMedia}\n draggable={false}\n />\n )}\n\n {kind === 'video' && (\n // eslint-disable-next-line jsx-a11y/media-has-caption\n <video src={item.src} className={styles.paneMedia} controls autoPlay playsInline />\n )}\n\n {/* Keyed: a kept-alive instance would pair the previous file's data with the new\n renderer for one render. */}\n {kind === 'file' && <AttachmentDocument key={item.id} item={item} />}\n </div>\n </div>\n\n {isMedia && (\n <div className={styles.paneZoomControls}>\n {/* A disabled button fires no events, so the tooltip listens on a wrapper instead. */}\n <Tooltip title=\"Zoom in\" placement=\"left\">\n <span className={styles.paneZoomButton}>\n <ButtonIcon\n size=\"small\"\n type=\"tertiaryBg\"\n ariaLabel=\"Zoom in\"\n disabled={!canZoomIn}\n onClick={zoomIn}\n testId=\"attachment-preview-zoom-in\"\n >\n <PlusIcon />\n </ButtonIcon>\n </span>\n </Tooltip>\n\n <Tooltip title=\"Zoom out\" placement=\"left\">\n <span className={styles.paneZoomButton}>\n <ButtonIcon\n size=\"small\"\n type=\"tertiaryBg\"\n ariaLabel=\"Zoom out\"\n disabled={!canZoomOut}\n onClick={zoomOut}\n testId=\"attachment-preview-zoom-out\"\n >\n <MinusIcon />\n </ButtonIcon>\n </span>\n </Tooltip>\n </div>\n )}\n </div>\n );\n};\n"],"names":["_ref","_item$kind","item","onShare","imageRef","useRef","kind","isMedia","_useZoomPan","useZoomPan","canZoom","canPan","resetKey","id","viewportRef","zoom","zoomIn","zoomOut","canZoomIn","canZoomOut","isPannable","isPanning","panHandlers","fileName","utils","getFileNameWithExtensionFromPath","name","downloadUrl","src","_jsxs","className","styles","pane","children","jsxs","paneHeader","paneName","_jsx","jsx","paneFileName","title","undefined","size","paneFileSize","formatFileSize","paneActions","AttachmentDownloadLink","url","paneActionLink","testId","AttachmentActionsMenu","_objectSpread","classNames","paneViewport","paneViewportPannable","paneViewportPanning","ref","paneZoomBox","style","AttachmentImage","alt","paneMedia","draggable","controls","autoPlay","playsInline","AttachmentDocument","paneZoomControls","Tooltip","placement","paneZoomButton","ButtonIcon","type","ariaLabel","disabled","onClick","PlusIcon","MinusIcon"],"mappings":"wqKA0BqC,SAAmDA,GAAA,IAAAC,EAAhDC,IAAAA,KAAMC,IAAAA,QACtCC,EAAWC,SAAyB,MACpCC,UAAOJ,EAAAA,EAAKI,oBAAQ,OACpBC,EAAmB,UAATD,GAA6B,UAATA,EAEpCE,EAWIC,EAAAA,WAAW,CAAEC,QAASH,EAASI,OAAiB,UAATL,EAAkBM,SAAUV,EAAKW,KAV1EC,IAAAA,YACAC,IAAAA,KACAC,IAAAA,OACAC,IAAAA,QACAC,IAAAA,UACAC,IAAAA,WACAC,IAAAA,WACAC,IAAAA,UACAC,IAAAA,YAIIC,EAAWC,EAAK,QAACC,iCAAiCvB,EAAKwB,MACvDC,EAAczB,EAAKyB,aAAezB,EAAK0B,IAE7C,OACEC,EAAAA,KAAA,MAAA,CAAKC,UAAWC,EAAOC,KAAM,cAAY,0BAAyBC,SAChE,CAAAJ,EAAAK,KAAA,MAAA,CAAKJ,UAAWC,EAAOI,WAAWF,SAChC,CAAAJ,EAAAK,KAAA,MAAA,CAAKJ,UAAWC,EAAOK,SAASH,SAC9B,CAAAI,EAAAC,IAAA,MAAA,CAAKR,UAAWC,EAAOQ,aAAcC,MAAOjB,EAASU,SAClDV,SAEYkB,IAAdvC,EAAKwC,MACJL,EAAAA,IAAA,MAAA,CAAKP,UAAWC,EAAOY,aAAaV,SAAEW,EAAAA,eAAe1C,EAAKwC,WAI9Db,EAAAK,KAAA,MAAA,CAAKJ,UAAWC,EAAOc,YAAYZ,SAAA,GAC9BN,GACDU,EAAAA,IAACS,EAAAA,uBAAsB,CACrBC,IAAKpB,EACLJ,SAAUA,EACVO,UAAWC,EAAOiB,eAClBC,OAAO,gCAIXZ,MAACa,wBAAqB,CAAChD,KAAMA,EA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SAEpCI,EAAAA,IAACwC,EAASA,UAAA,eAQ1B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/regenerator"),r=require("../../utils/fetchAttachment.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=n(e),u=n(t),o=function(e,t,r){var n=document.createElement("canvas");n.width=t,n.height=r;var a=n.getContext("2d");if(!a)throw new Error("Could not get a 2d canvas context");return a.drawImage(e,0,0),new Promise((function(e,t){n.toBlob((function(r){return r?e(r):t(new Error("Could not encode the image"))}),"image/png")}))},c=function(){var e=a.default(u.default.mark((function e(t){var r;return u.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,createImageBitmap(t);case 2:return r=e.sent,e.abrupt("return",o(r,r.width,r.height));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),i=function(){var e=a.default(u.default.mark((function e(t){return u.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",o(t,t.naturalWidth,t.naturalHeight));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),s=function(){var e=a.default(u.default.mark((function e(t){var n,a;return u.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.fetchAttachment(t);case 2:if((n=e.sent).ok){e.next=5;break}throw new Error("Could not read the image (".concat(n.status,")"));case 5:return e.next=7,n.blob();case 7:return a=e.sent,e.abrupt("return","image/png"===a.type?a:c(a));case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),p=function(){var e;return"undefined"!=typeof ClipboardItem&&!(null===(e=navigator.clipboard)||void 0===e||!e.write)},f=function(e){return navigator.clipboard.write([new ClipboardItem({"image/png":e})])},l=function(e){return!(null==e||!e.complete||!e.naturalWidth)},d=function(){var e=a.default(u.default.mark((function e(t,r){return u.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(p()){e.next=2;break}return e.abrupt("return",!1);case 2:if(!l(r)){e.next=11;break}return e.prev=3,e.next=6,f(i(r));case 6:return e.abrupt("return",!0);case 9:e.prev=9,e.t0=e.catch(3);case 11:if(t){e.next=13;break}return e.abrupt("return",!1);case 13:return e.prev=13,e.next=16,f(s(t));case 16:return e.abrupt("return",!0);case 19:return e.prev=19,e.t1=e.catch(13),console.error('Failed to copy attachment "'.concat(t,'" to the clipboard'),e.t1),e.abrupt("return",!1);case 23:case"end":return e.stop()}}),e,null,[[3,9],[13,19]])})));return function(t,r){return e.apply(this,arguments)}}();exports.copyImageToClipboard=d,exports.getCanCopyImages=p;
|
|
2
|
+
//# sourceMappingURL=copyImageToClipboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copyImageToClipboard.js","sources":["../../../../src/components/AttachmentLightbox/copyImageToClipboard.ts"],"sourcesContent":["import { fetchAttachment } from '~/utils/fetchAttachment';\n\nconst toPng = (source: CanvasImageSource, width: number, height: number): Promise<Blob> => {\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n\n const context = canvas.getContext('2d');\n\n if (!context) throw new Error('Could not get a 2d canvas context');\n\n context.drawImage(source, 0, 0);\n\n return new Promise((resolve, reject) => {\n // Throws for an image the page was not allowed to read, which is the tainted-canvas signal.\n canvas.toBlob(\n encoded => (encoded ? resolve(encoded) : reject(new Error('Could not encode the image'))),\n 'image/png'\n );\n });\n};\n\nconst encodeAsPng = async (blob: Blob): Promise<Blob> => {\n const bitmap = await createImageBitmap(blob);\n\n return toPng(bitmap, bitmap.width, bitmap.height);\n};\n\nconst pngFromElement = async (image: HTMLImageElement): Promise<Blob> =>\n toPng(image, image.naturalWidth, image.naturalHeight);\n\n// Chrome only accepts PNG on the clipboard, so anything else is re-encoded.\nconst fetchAsPng = async (src: string): Promise<Blob> => {\n const response = await fetchAttachment(src);\n\n if (!response.ok) throw new Error(`Could not read the image (${response.status})`);\n\n const blob = await response.blob();\n\n return blob.type === 'image/png' ? blob : encodeAsPng(blob);\n};\n\nexport const getCanCopyImages = () =>\n typeof ClipboardItem !== 'undefined' && !!navigator.clipboard?.write;\n\nconst write = (png: Promise<Blob>) =>\n // A promise, not an awaited blob: Safari requires the write inside the user gesture.\n navigator.clipboard.write([new ClipboardItem({ 'image/png': png })]);\n\nconst isReady = (image?: HTMLImageElement | null) => !!image?.complete && !!image.naturalWidth;\n\n/** Copies the pixels already on screen when the page may read them, else fetches the bytes. */\nexport const copyImageToClipboard = async (\n src: string,\n image?: HTMLImageElement | null\n): Promise<boolean> => {\n if (!getCanCopyImages()) return false;\n\n if (isReady(image)) {\n try {\n await write(pngFromElement(image as HTMLImageElement));\n\n return true;\n } catch {}\n }\n\n if (!src) return false;\n\n try {\n await write(fetchAsPng(src));\n\n return true;\n } catch (error) {\n console.error(`Failed to copy attachment \"${src}\" to the clipboard`, error);\n\n return false;\n }\n};\n"],"names":["toPng","source","width","height","canvas","document","createElement","context","getContext","Error","drawImage","Promise","resolve","reject","toBlob","encoded","encodeAsPng","_ref","_asyncToGenerator","_regeneratorRuntime","mark","blob","bitmap","wrap","_context","prev","next","createImageBitmap","sent","stop","_callee","_x","apply","this","arguments","pngFromElement","_ref2","image","_context2","naturalWidth","naturalHeight","_callee2","_x2","fetchAsPng","_ref3","src","response","_context3","fetchAttachment","ok","concat","status","type","_callee3","_x3","getCanCopyImages","_navigator$clipboard","ClipboardItem","navigator","clipboard","write","png","isReady","complete","copyImageToClipboard","_ref4","_callee4","_context4","abrupt","t0","t1","console","error","_x4","_x5"],"mappings":"2SAEMA,EAAQ,SAACC,EAA2BC,EAAeC,GACvD,IAAMC,EAASC,SAASC,cAAc,UACtCF,EAAOF,MAAQA,EACfE,EAAOD,OAASA,EAEhB,IAAMI,EAAUH,EAAOI,WAAW,MAElC,IAAKD,EAAS,MAAM,IAAIE,MAAM,qCAI9B,OAFAF,EAAQG,UAAUT,EAAQ,EAAG,GAEtB,IAA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KAAA,EAAA0C,EAAAE,GAAAF,EAAA,MAAA,GAAA,KAAA,GAAA,GAIVtB,EAAG,CAAAsB,EAAAzC,KAAA,GAAA,KAAA,CAAA,OAAAyC,EAAAC,OAAA,UAAS,GAAK,KAAA,GAAA,OAAAD,EAAA1C,KAAA,GAAA0C,EAAAzC,KAAA,GAGdkC,EAAMjB,EAAWE,IAAK,KAAA,GAAA,OAAAsB,EAAAC,OAAA,UAErB,GAAI,KAAA,GAEiE,OAFjED,EAAA1C,KAAA,GAAA0C,EAAAG,GAAAH,EAAA,MAAA,IAEXI,QAAQC,MAAoC3B,8BAAAA,OAAAA,EAA+B,sBAAAsB,EAAAG,IAACH,EAAAC,OAAA,UAErE,GAAK,KAAA,GAAA,IAAA,MAAA,OAAAD,EAAAtC,OAAA,GAAAqC,EAAA,KAAA,CAAA,CAAA,EAAA,GAAA,CAAA,GAAA,KAEf,KAAA,OAAA,SAzBgCO,EAAAC,GAAA,OAAAT,EAAAjC,MAAAC,KAAAC,UAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/regenerator"),r=require("../../utils/fetchAttachment.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=n(e),o=n(t),c=function(){var e=a.default(o.default.mark((function e(t,n){var a,c,u;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",!1);case 2:return e.prev=2,e.next=5,r.fetchAttachment(t);case 5:if((a=e.sent).ok){e.next=8;break}throw new Error("Could not read the file (".concat(a.status,")"));case 8:return e.t0=URL,e.next=11,a.blob();case 11:return e.t1=e.sent,c=e.t0.createObjectURL.call(e.t0,e.t1),(u=document.createElement("a")).href=c,u.download=n,document.body.appendChild(u),u.click(),u.remove(),URL.revokeObjectURL(c),e.abrupt("return",!0);case 23:return e.prev=23,e.t2=e.catch(2),console.error('Failed to download "'.concat(t,'"'),e.t2),e.abrupt("return",!1);case 27:case"end":return e.stop()}}),e,null,[[2,23]])})));return function(t,r){return e.apply(this,arguments)}}(),u=["http:","https:","blob:"],s=function(e){if(e)try{var t=new URL(e,window.location.href).protocol;if(!u.includes(t))throw new Error("Refusing to open a ".concat(t," url"));window.open(e,"_blank","noopener")}catch(t){console.error('Failed to open "'.concat(e,'"'),t)}},l=function(){var e=a.default(o.default.mark((function e(t,r){return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c(t,r);case 2:if(e.sent){e.next=4;break}s(t);case 4:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}();exports.downloadAttachment=c,exports.openAttachmentInNewTab=s,exports.saveAttachment=l;
|
|
2
|
+
//# sourceMappingURL=downloadAttachment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"downloadAttachment.js","sources":["../../../../src/components/AttachmentLightbox/downloadAttachment.ts"],"sourcesContent":["import { fetchAttachment } from '~/utils/fetchAttachment';\n\n/**\n * `download` is ignored cross-origin, where a plain link navigates the app away instead. Fetching\n * the bytes and handing the browser a blob url saves under the right name wherever the file lives.\n */\nexport const downloadAttachment = async (url: string, fileName: string): Promise<boolean> => {\n if (!url) return false;\n\n try {\n const response = await fetchAttachment(url);\n\n if (!response.ok) throw new Error(`Could not read the file (${response.status})`);\n\n const blobUrl = URL.createObjectURL(await response.blob());\n const link = document.createElement('a');\n\n link.href = blobUrl;\n link.download = fileName;\n document.body.appendChild(link);\n link.click();\n link.remove();\n URL.revokeObjectURL(blobUrl);\n\n return true;\n } catch (error) {\n console.error(`Failed to download \"${url}\"`, error);\n\n return false;\n }\n};\n\nconst SAFE_SCHEMES = ['http:', 'https:', 'blob:'];\n\n/** Stored data, not a literal: an unchecked `javascript:` url would run on open. */\nexport const openAttachmentInNewTab = (url: string): void => {\n // An empty one resolves to the page itself, passes the check below, and opens a blank tab.\n if (!url) return;\n\n try {\n const { protocol } = new URL(url, window.location.href);\n\n if (!SAFE_SCHEMES.includes(protocol)) throw new Error(`Refusing to open a ${protocol} url`);\n\n window.open(url, '_blank', 'noopener');\n } catch (error) {\n console.error(`Failed to open \"${url}\"`, error);\n }\n};\n\n/** Saves the file, falling back to a tab when the bytes cannot be read. */\nexport const saveAttachment = async (url: string, fileName: string): Promise<void> => {\n if (!(await downloadAttachment(url, fileName))) openAttachmentInNewTab(url);\n};\n"],"names":["downloadAttachment","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","url","fileName","response","blobUrl","link","wrap","_context","prev","next","abrupt","fetchAttachment","sent","ok","Error","concat","status","t0","URL","blob","t1","createObjectURL","call","document","createElement","href","download","body","appendChild","click","remove","revokeObjectURL","t2","console","error","stop","_x","_x2","apply","this","arguments","SAFE_SCHEMES","openAttachmentInNewTab","protocol","window","location","includes","open","saveAttachment","_ref2","_callee2","_context2","_x3","_x4"],"mappings":"2SAMaA,EAAkB,WAAA,IAAGC,EAAAC,EAAAA,QAAAC,EAAA,QAAAC,MAAA,SAAAC,EAAOC,EAAaC,GAAgB,IAAAC,EAAAC,EAAAC,EAAA,OAAAP,UAAAQ,MAAA,SAAAC,GAAA,OAAA,OAAAA,EAAAC,KAAAD,EAAAE,MAAA,KAAA,EAAA,GAC/DR,EAAG,CAAAM,EAAAE,KAAA,EAAA,KAAA,CAAA,OAAAF,EAAAG,OAAA,UAAS,GAAK,KAAA,EAAA,OAAAH,EAAAC,KAAA,EAAAD,EAAAE,KAAA,EAGGE,EAAAA,gBAAgBV,GAAI,KAAA,EAA7B,IAARE,EAAQI,EAAAK,MAEAC,GAAE,CAAAN,EAAAE,KAAA,EAAA,KAAA,CAAA,MAAQ,IAAIK,MAAK,4BAAAC,OAA6BZ,EAASa,OAAU,MAAA,KAAA,EAE9D,OAF8DT,EAAAU,GAEjEC,IAAGX,EAAAE,KAAA,GAAuBN,EAASgB,OAAM,KAAA,GAQ5B,OAR4BZ,EAAAa,GAA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C,KAAA,EAAA,KAAA,CAAGiC,EAAuBzC,GAAK,KAAA,EAAA,IAAA,MAAA,OAAAkD,EAAAhB,OAAA,GAAAe,EAC7E,KAAA,OAAA,SAF0BE,EAAAC,GAAA,OAAAJ,EAAAX,MAAAC,KAAAC,UAAA,CAAA,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),r=require("./AttachmentLightbox.js"),n=require("react/jsx-runtime");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),r=require("./AttachmentLightbox.js"),n=require("react/jsx-runtime");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=i(e);exports.useAttachmentLightbox=function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=i.onShare,a=t.useState(null),c=o.default(a,2),l=c[0],s=c[1],h=function(e){e.isUploading||e.error||s(e.id)};return{openAttachment:h,lightbox:n.jsx(r.AttachmentLightbox,{items:e,activeId:l,onActiveIdChange:s,onClose:function(){return s(null)},onShare:u})}};
|
|
2
2
|
//# sourceMappingURL=useAttachmentLightbox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAttachmentLightbox.js","sources":["../../../../src/components/AttachmentLightbox/useAttachmentLightbox.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport type { AttachmentPreviewItem } from '../AttachmentPreview/AttachmentPreview.types';\n\nimport { AttachmentLightbox
|
|
1
|
+
{"version":3,"file":"useAttachmentLightbox.js","sources":["../../../../src/components/AttachmentLightbox/useAttachmentLightbox.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport type { AttachmentPreviewItem } from '../AttachmentPreview/AttachmentPreview.types';\n\nimport { AttachmentLightbox } from './AttachmentLightbox';\n\nexport type UseAttachmentLightboxOptions = {\n /** Adds \"Share file\" to the overflow menu. */\n onShare?: (item: AttachmentPreviewItem) => void;\n};\n\n/** Wires attachments to the preview modal; a kind with no renderer shows a download card. */\nexport const useAttachmentLightbox = (\n items: AttachmentPreviewItem[],\n { onShare }: UseAttachmentLightboxOptions = {}\n) => {\n const [activeId, setActiveId] = useState<AttachmentPreviewItem['id'] | null>(null);\n\n const openAttachment = (item: AttachmentPreviewItem) => {\n if (!item.isUploading && !item.error) setActiveId(item.id);\n };\n\n return {\n openAttachment,\n lightbox: (\n <AttachmentLightbox\n items={items}\n activeId={activeId}\n onActiveIdChange={setActiveId}\n onClose={() => setActiveId(null)}\n onShare={onShare}\n />\n ),\n };\n};\n"],"names":["items","_ref","arguments","length","undefined","onShare","useState","_useState2","_slicedToArray","_useState","activeId","setActiveId","openAttachment","item","isUploading","error","id","lightbox","_jsx","AttachmentLightbox","onActiveIdChange","onClose"],"mappings":"kUAYqC,SACnCA,GAEG,IAAAC,EAAAC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GADyC,CAAE,EAA5CG,IAAAA,QAE8BC,EAAAA,EAAQA,SAAqC,MAAKC,EAAAC,EAAAA,QAAAC,EAAA,GAA3EC,EAAQH,EAAA,GAAEI,EAAWJ,EAAA,GAEtBK,EAAiB,SAACC,GACjBA,EAAKC,aAAgBD,EAAKE,OAAOJ,EAAYE,EAAKG,KAGzD,MAAO,CACLJ,eAAAA,EACAK,SACEC,MAACC,qBAAkB,CACjBnB,MAAOA,EACPU,SAAUA,EACVU,iBAAkBT,EAClBU,QAAS,WAAA,OAAMV,EAAY,KAAM,EACjCN,QAASA,IAIjB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),t=require("react");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(e),l=function(e){return Math.min(Math.max(e,1),3)};exports.MAX_ZOOM=3,exports.MIN_ZOOM=1,exports.ZOOM_STEP=.5,exports.useZoomPan=function(e){var r=e.canZoom,o=e.canPan,c=e.resetKey,u=t.useRef(null),i=t.useState(1),a=n.default(i,2),s=a[0],f=a[1],p=t.useState(!1),v=n.default(p,2),d=v[0],h=v[1],b=t.useRef(s),P=t.useRef(null),m=t.useRef(null);t.useEffect((function(){b.current=s}),[s]),t.useEffect((function(){f(1),P.current=null}),[c]),t.useEffect((function(){var e=u.current;if(e){var t=P.current;P.current=null,t?(e.scrollLeft=t.ratioX*e.scrollWidth-t.offsetX,e.scrollTop=t.ratioY*e.scrollHeight-t.offsetY):(e.scrollLeft=(e.scrollWidth-e.clientWidth)/2,e.scrollTop=(e.scrollHeight-e.clientHeight)/2)}}),[s,c]);var C=t.useCallback((function(e,t){var r=l(b.current+e);r!==b.current&&(t&&(P.current=t),f(r))}),[]),X=t.useCallback((function(){return C(.5)}),[C]),Y=t.useCallback((function(){return C(-.5)}),[C]);t.useEffect((function(){var e=u.current;if(e&&r){var t=function(t){var r=.004*-t.deltaY;if(l(b.current+r)!==b.current){t.preventDefault();var n=e.getBoundingClientRect(),o=t.clientX-n.left,c=t.clientY-n.top;C(r,{ratioX:e.scrollWidth?(e.scrollLeft+o)/e.scrollWidth:.5,ratioY:e.scrollHeight?(e.scrollTop+c)/e.scrollHeight:.5,offsetX:o,offsetY:c})}};return e.addEventListener("wheel",t,{passive:!1}),function(){return e.removeEventListener("wheel",t)}}}),[r,C]);var L=o&&s>1,M=t.useCallback((function(e){var t,r=u.current;!L||e.button>0||!r||(m.current={pointerX:e.clientX,pointerY:e.clientY,scrollLeft:r.scrollLeft,scrollTop:r.scrollTop},null===(t=r.setPointerCapture)||void 0===t||t.call(r,e.pointerId),h(!0))}),[L]),O=t.useCallback((function(e){var t=m.current,r=u.current;t&&r&&(r.scrollLeft=t.scrollLeft-(e.clientX-t.pointerX),r.scrollTop=t.scrollTop-(e.clientY-t.pointerY))}),[]),T=t.useCallback((function(e){var t,r;m.current&&(m.current=null,null===(t=u.current)||void 0===t||null===(r=t.releasePointerCapture)||void 0===r||r.call(t,e.pointerId),h(!1))}),[]);return{viewportRef:u,zoom:s,zoomIn:X,zoomOut:Y,canZoomIn:s<3,canZoomOut:s>1,isPannable:L,isPanning:d,panHandlers:{onPointerDown:M,onPointerMove:O,onPointerUp:T,onPointerCancel:T}}};
|
|
2
|
+
//# sourceMappingURL=useZoomPan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useZoomPan.js","sources":["../../../../src/components/AttachmentLightbox/useZoomPan.ts"],"sourcesContent":["import { PointerEvent as ReactPointerEvent, useCallback, useEffect, useRef, useState } from 'react';\n\nexport const MIN_ZOOM = 1;\nexport const MAX_ZOOM = 3;\nexport const ZOOM_STEP = 0.5;\n\n// A trackpad pinch arrives as a wheel event; this turns its delta into a comfortable travel.\nconst WHEEL_SENSITIVITY = 0.004;\n\nconst clampZoom = (zoom: number) => Math.min(Math.max(zoom, MIN_ZOOM), MAX_ZOOM);\n\n/** Where the pointer sat in the content, so the same point stays put across a zoom. */\ntype Anchor = { ratioX: number; ratioY: number; offsetX: number; offsetY: number };\n\ntype Drag = { pointerX: number; pointerY: number; scrollLeft: number; scrollTop: number };\n\n/**\n * The scroll box does the panning, so a zoom only resizes the content and puts the scroll offset\n * back where the viewer was looking.\n */\nexport const useZoomPan = ({\n canZoom,\n canPan,\n resetKey,\n}: {\n canZoom: boolean;\n canPan: boolean;\n resetKey: unknown;\n}) => {\n const viewportRef = useRef<HTMLDivElement>(null);\n const [zoom, setZoom] = useState(MIN_ZOOM);\n const [isPanning, setIsPanning] = useState(false);\n\n const zoomRef = useRef(zoom);\n const anchorRef = useRef<Anchor | null>(null);\n const dragRef = useRef<Drag | null>(null);\n\n useEffect(() => {\n zoomRef.current = zoom;\n }, [zoom]);\n\n useEffect(() => {\n setZoom(MIN_ZOOM);\n anchorRef.current = null;\n }, [resetKey]);\n\n // Runs after the box has resized, so scrollWidth/Height are the new ones.\n useEffect(() => {\n const viewport = viewportRef.current;\n\n if (!viewport) return;\n\n const anchor = anchorRef.current;\n anchorRef.current = null;\n\n if (anchor) {\n viewport.scrollLeft = anchor.ratioX * viewport.scrollWidth - anchor.offsetX;\n viewport.scrollTop = anchor.ratioY * viewport.scrollHeight - anchor.offsetY;\n } else {\n viewport.scrollLeft = (viewport.scrollWidth - viewport.clientWidth) / 2;\n viewport.scrollTop = (viewport.scrollHeight - viewport.clientHeight) / 2;\n }\n }, [zoom, resetKey]);\n\n const zoomBy = useCallback((delta: number, anchor?: Anchor) => {\n const next = clampZoom(zoomRef.current + delta);\n\n if (next === zoomRef.current) return;\n if (anchor) anchorRef.current = anchor;\n\n setZoom(next);\n }, []);\n\n const zoomIn = useCallback(() => zoomBy(ZOOM_STEP), [zoomBy]);\n const zoomOut = useCallback(() => zoomBy(-ZOOM_STEP), [zoomBy]);\n\n // Native listener: React's onWheel is passive, so it could not block the page from scrolling.\n useEffect(() => {\n const viewport = viewportRef.current;\n\n if (!viewport || !canZoom) return undefined;\n\n const handleWheel = (event: WheelEvent) => {\n const delta = -event.deltaY * WHEEL_SENSITIVITY;\n\n // Already as big or small as it goes: let the wheel scroll whatever is behind the preview.\n if (clampZoom(zoomRef.current + delta) === zoomRef.current) return;\n\n event.preventDefault();\n\n const rect = viewport.getBoundingClientRect();\n const offsetX = event.clientX - rect.left;\n const offsetY = event.clientY - rect.top;\n\n zoomBy(delta, {\n ratioX: viewport.scrollWidth ? (viewport.scrollLeft + offsetX) / viewport.scrollWidth : 0.5,\n ratioY: viewport.scrollHeight\n ? (viewport.scrollTop + offsetY) / viewport.scrollHeight\n : 0.5,\n offsetX,\n offsetY,\n });\n };\n\n viewport.addEventListener('wheel', handleWheel, { passive: false });\n\n return () => viewport.removeEventListener('wheel', handleWheel);\n }, [canZoom, zoomBy]);\n\n const isPannable = canPan && zoom > MIN_ZOOM;\n\n const onPointerDown = useCallback(\n (event: ReactPointerEvent<HTMLDivElement>) => {\n const viewport = viewportRef.current;\n\n // `> 0` rather than `!== 0`: only a reported secondary/middle button should bail.\n if (!isPannable || event.button > 0 || !viewport) return;\n\n dragRef.current = {\n pointerX: event.clientX,\n pointerY: event.clientY,\n scrollLeft: viewport.scrollLeft,\n scrollTop: viewport.scrollTop,\n };\n viewport.setPointerCapture?.(event.pointerId);\n setIsPanning(true);\n },\n [isPannable]\n );\n\n const onPointerMove = useCallback((event: ReactPointerEvent<HTMLDivElement>) => {\n const drag = dragRef.current;\n const viewport = viewportRef.current;\n\n if (!drag || !viewport) return;\n\n viewport.scrollLeft = drag.scrollLeft - (event.clientX - drag.pointerX);\n viewport.scrollTop = drag.scrollTop - (event.clientY - drag.pointerY);\n }, []);\n\n const onPointerUp = useCallback((event: ReactPointerEvent<HTMLDivElement>) => {\n if (!dragRef.current) return;\n\n dragRef.current = null;\n viewportRef.current?.releasePointerCapture?.(event.pointerId);\n setIsPanning(false);\n }, []);\n\n return {\n viewportRef,\n zoom,\n zoomIn,\n zoomOut,\n canZoomIn: zoom < MAX_ZOOM,\n canZoomOut: zoom > MIN_ZOOM,\n isPannable,\n isPanning,\n panHandlers: { onPointerDown, onPointerMove, onPointerUp, onPointerCancel: onPointerUp },\n };\n};\n"],"names":["clampZoom","zoom","Math","min","max","_ref","canZoom","canPan","resetKey","viewportRef","useRef","useState","_useState2","_slicedToArray","_useState","setZoom","_useState4","_useState3","isPanning","setIsPanning","zoomRef","anchorRef","dragRef","useEffect","current","viewport","anchor","scrollLeft","ratioX","scrollWidth","offsetX","scrollTop","ratioY","scrollHeight","offsetY","clientWidth","clientHeight","zoomBy","useCallback","delta","next","zoomIn","zoomOut","handleWheel","event","deltaY","preventDefault","rect","getBoundingClientRect","clientX","left","clientY","top","addEventListener","passive","removeEventListener","isPannable","onPointerDown","_viewport$setPointerC","button","pointerX","pointerY","setPointerCapture","call","pointerId","onPointerMove","drag","onPointerUp","_viewportRef$current","_viewportRef$current$","releasePointerCapture","canZoomIn","canZoomOut","panHandlers","on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AASM,UAAYmC,EAAKnC,WAAaa,EAAMO,QAAUe,EAAKL,UAC7D,GAAE,IAEGM,EAAc7B,eAAY,SAACM,GAA6C,IAAAwB,EAAAC,EACvE/C,EAAQE,UAEbF,EAAQE,QAAU,KAClB,QAAAf,EAAAA,EAAYe,eAAZ,IAAA4C,GAA0C,QAA1CC,EAAAD,EAAqBE,6BAAqB,IAAAD,GAA1CA,EAA6CzB,KAAAA,EAAAA,EAAMoB,WACnD7C,GAAa,GACd,GAAE,IAEH,MAAO,CACLV,YAAAA,EACAR,KAAAA,EACAwC,OAAAA,EACAC,QAAAA,EACA6B,UAAWtE,EAtJS,EAuJpBuE,WAAYvE,EAxJQ,EAyJpBuD,WAAAA,EACAtC,UAAAA,EACAuD,YAAa,CAAEhB,cAAAA,EAAeQ,cAAAA,EAAeE,YAAAA,EAAaO,gBAAiBP,GAE/E"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var s=require("@babel/runtime/helpers/slicedToArray"),o=require("react"),c=require("../../componentsV2/ButtonIcon/ButtonIcon.js"),i=require("../../componentsV2/Tooltip/Tooltip.js"),n=require("../../componentsV2/Menu/Menu.js"),e=require("../AttachmentLightbox/copyImageToClipboard.js"),r=require("../../icons/iconParkIcons.js");require("../../icons/customIcons/icons/AddMessage.js"),require("../../icons/customIcons/icons/DragOne.js"),require("../../icons/customIcons/icons/Attention.js"),require("../../icons/customIcons/icons/Collapse.js"),require("../../icons/customIcons/icons/Dashboard.js"),require("../../icons/customIcons/icons/Expand.js"),require("../../icons/customIcons/icons/FolderClosed.js"),require("../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../icons/customIcons/icons/FolderOpened.js"),require("../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../icons/customIcons/icons/LessOrEqual.js"),require("../../icons/customIcons/icons/Search.js"),require("../../icons/customIcons/icons/SearchOne.js"),require("../../icons/customIcons/icons/Wellhub.js"),require("../../icons/customIcons/icons/MultiRuler.js"),require("../../icons/customIcons/icons/Checkbox.js"),require("../../icons/customIcons/icons/CheckboxChecked.js"),require("../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../icons/customIcons/icons/Radio.js"),require("../../icons/customIcons/icons/RadioChecked.js"),require("../../icons/customIcons/icons/SimulFrac.js"),require("../../icons/customIcons/icons/ZipperFrac.js"),require("../../icons/customIcons/icons/CautionFilled.js"),require("../../icons/customIcons/icons/MoreApp.js"),require("../../icons/customIcons/icons/Pad.js"),require("../../icons/customIcons/icons/DrilloutUnit.js"),require("../../icons/customIcons/icons/FracFleet.js"),require("../../icons/customIcons/icons/Global.js"),require("../../icons/customIcons/icons/Program.js"),require("../../icons/customIcons/icons/Rig.js"),require("../../icons/customIcons/icons/Well.js"),require("../../icons/customIcons/icons/Gap.js"),require("../../icons/customIcons/icons/Pin.js"),require("../../icons/customIcons/icons/CloseOneFilled.js"),require("../../icons/customIcons/icons/AttentionFilled.js"),require("../../icons/customIcons/icons/CheckOneFilled.js"),require("../../icons/customIcons/icons/Archive.js"),require("../../icons/customIcons/icons/ArchiveCancel.js"),require("../../icons/customIcons/icons/Unarchive.js"),require("../../icons/customIcons/icons/Archived.js"),require("../../icons/customIcons/icons/InterventionUnit.js"),require("../../icons/customIcons/icons/CloudDelete.js"),require("../../icons/customIcons/icons/Lasso.js"),require("../../icons/customIcons/icons/Radius.js"),require("../../icons/customIcons/icons/ErrorOps.js"),require("../../icons/customIcons/icons/DataTypeOps.js"),require("../../icons/customIcons/icons/FalsePositiveOps.js"),require("../../icons/customIcons/icons/CalibrationOps.js"),require("../../icons/customIcons/icons/CriticalOps.js"),require("../../icons/customIcons/icons/Company.js"),require("../../icons/customIcons/icons/ArchiveOne.js"),require("../../icons/customIcons/icons/ParseBotFusion.js"),require("../../icons/customIcons/icons/Connect.js"),require("../../icons/customIcons/icons/PuzzleOne.js"),require("../../icons/customIcons/icons/Feed.js"),require("../../icons/customIcons/icons/Prompt.js"),require("../../icons/customIcons/icons/Companies.js"),require("../../icons/customIcons/icons/ClipboardAi.js"),require("../../icons/customIcons/icons/Key.js"),require("../../icons/customIcons/icons/AtSignCrossed.js"),require("../../icons/customIcons/icons/MappingManual.js"),require("../../icons/customIcons/icons/Mapping.js"),require("../../icons/customIcons/icons/Metrics.js"),require("../../icons/customIcons/icons/Drops.js"),require("../../icons/customIcons/icons/ClipboardSearch.js"),require("../../icons/customIcons/icons/Template.js"),require("../../icons/customIcons/icons/ClipboardMetrics.js"),require("../../icons/customIcons/icons/ClipboardBuilder.js"),require("../../icons/customIcons/icons/UnitConversion.js"),require("../../icons/customIcons/icons/NPT.js"),require("../../icons/customIcons/icons/GuidedFrac.js");var u=require("../../utils/notificationToasts.js"),t=require("../../utils/main.js"),a=require("react/jsx-runtime");function m(s){return s&&"object"==typeof s&&"default"in s?s:{default:s}}var l=m(s);exports.AttachmentActionsMenu=function(s){var m,I=s.item,j=s.onShare,q=s.size,d=void 0===q?"small":q,p=s.testIdPrefix,h=void 0===p?"attachment-preview":p,C=s.tooltip,f=void 0===C?"More":C,b=s.imageRef,g=s.className,x=o.useState(null),v=l.default(x,2),M=v[0],y=v[1];o.useEffect((function(){y(null)}),[I.id]);var F=I.src||I.downloadUrl,O="image"===(null!==(m=I.kind)&&void 0!==m?m:"file")&&!!I.src&&e.getCanCopyImages(),k=function(s){return function(o){o.stopPropagation(),s(),y(null)}};return a.jsxs(a.Fragment,{children:[a.jsx(i.Tooltip,{title:f,children:a.jsx(c.ButtonIcon,{size:d,type:"tertiaryBg",ariaLabel:"More actions",isActive:!!M,className:g,onClick:function(s){s.stopPropagation(),y(s.currentTarget)},testId:"".concat(h,"-more"),children:a.jsx(r.MoreOneIcon,{})})}),!!M&&a.jsxs(n.Menu,{open:!0,anchorEl:M,placement:"bottom-end",onClose:function(){return y(null)},children:[!!j&&a.jsx(n.Menu.Item,{prefix:a.jsx(r.ShareTwoIcon,{}),onClick:k((function(){return j(I)})),testId:"".concat(h,"-share"),children:"Share file"}),a.jsx(n.Menu.Item,{prefix:a.jsx(r.LinkOneIcon,{}),disabled:!F,onClick:k((function(){F&&(t.default.copyToClipboard(F),u.showSuccessNotification("Link copied to clipboard"))})),testId:"".concat(h,"-copy-link"),children:"Copy link"}),O&&a.jsx(n.Menu.Item,{prefix:a.jsx(r.PictureIcon,{}),onClick:k((function(){e.copyImageToClipboard(I.src,null==b?void 0:b.current).then((function(s){s?u.showSuccessNotification("Image copied to clipboard"):u.showErrorNotification("Could not copy the image")}))})),testId:"".concat(h,"-copy-image"),children:"Copy image"})]})]})};
|
|
2
|
+
//# sourceMappingURL=AttachmentActionsMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentActionsMenu.js","sources":["../../../../src/components/AttachmentPreview/AttachmentActionsMenu.tsx"],"sourcesContent":["import { MouseEvent, RefObject, useEffect, useState } from 'react';\n\nimport { ButtonIcon } from '../../componentsV2/ButtonIcon';\nimport { Tooltip } from '../../componentsV2/Tooltip';\nimport { Menu } from '../../componentsV2/Menu';\nimport { copyImageToClipboard, getCanCopyImages } from '../AttachmentLightbox/copyImageToClipboard';\n\nimport { AttachmentPreviewItem } from './AttachmentPreview.types';\n\nimport { LinkOneIcon, MoreOneIcon, PictureIcon, ShareTwoIcon } from '~/icons';\nimport { showErrorNotification, showSuccessNotification } from '~/utils/notificationToasts';\nimport utils from '~/utils/main';\n\nexport type AttachmentActionsMenuProps = {\n item: AttachmentPreviewItem;\n /** Adds \"Share file\" to the menu. */\n onShare?: (item: AttachmentPreviewItem) => void;\n /** `xs` sits on a tile, `small` in the preview modal's header. */\n size?: 'xs' | 'small';\n /** Test ids read `<prefix>-more`, `<prefix>-share`, and so on. */\n testIdPrefix?: string;\n tooltip?: string;\n imageRef?: RefObject<HTMLImageElement>;\n className?: string;\n};\n\nexport const AttachmentActionsMenu = ({\n item,\n onShare,\n size = 'small',\n testIdPrefix = 'attachment-preview',\n tooltip = 'More',\n imageRef,\n className,\n}: AttachmentActionsMenuProps) => {\n const [menuAnchor, setMenuAnchor] = useState<HTMLElement | null>(null);\n\n useEffect(() => {\n setMenuAnchor(null);\n }, [item.id]);\n\n const shareableUrl = item.src || item.downloadUrl;\n const canCopyImage = (item.kind ?? 'file') === 'image' && !!item.src && getCanCopyImages();\n\n const copyImage = () => {\n copyImageToClipboard(item.src as string, imageRef?.current).then(copied => {\n if (copied) showSuccessNotification('Image copied to clipboard');\n else showErrorNotification('Could not copy the image');\n });\n };\n\n // A portalled menu still bubbles its clicks up the React tree, where the tile would take\n // them as its own and open the preview over whatever the action just started.\n const runAndClose = (action: () => void) => (event: MouseEvent) => {\n event.stopPropagation();\n action();\n setMenuAnchor(null);\n };\n\n return (\n <>\n <Tooltip title={tooltip}>\n <ButtonIcon\n size={size}\n type=\"tertiaryBg\"\n ariaLabel=\"More actions\"\n isActive={!!menuAnchor}\n className={className}\n onClick={event => {\n event.stopPropagation();\n setMenuAnchor(event.currentTarget);\n }}\n testId={`${testIdPrefix}-more`}\n >\n <MoreOneIcon />\n </ButtonIcon>\n </Tooltip>\n\n {!!menuAnchor && (\n <Menu open anchorEl={menuAnchor} placement=\"bottom-end\" onClose={() => setMenuAnchor(null)}>\n {!!onShare && (\n <Menu.Item\n prefix={<ShareTwoIcon />}\n onClick={runAndClose(() => onShare(item))}\n testId={`${testIdPrefix}-share`}\n >\n Share file\n </Menu.Item>\n )}\n\n <Menu.Item\n prefix={<LinkOneIcon />}\n disabled={!shareableUrl}\n onClick={runAndClose(() => {\n if (!shareableUrl) return;\n utils.copyToClipboard(shareableUrl);\n showSuccessNotification('Link copied to clipboard');\n })}\n testId={`${testIdPrefix}-copy-link`}\n >\n Copy link\n </Menu.Item>\n\n {/* Only images: no browser lets a page put a video or a document on the clipboard. */}\n {canCopyImage && (\n <Menu.Item\n prefix={<PictureIcon />}\n onClick={runAndClose(copyImage)}\n testId={`${testIdPrefix}-copy-image`}\n >\n Copy image\n </Menu.Item>\n )}\n </Menu>\n )}\n </>\n );\n};\n"],"names":["_ref","_item$kind","item","onShare","_ref$size","size","_ref$testIdPrefix","testIdPrefix","_ref$tooltip","tooltip","imageRef","className","useState","_useState2","_slicedToArray","_useState","menuAnchor","setMenuAnchor","useEffect","id","shareableUrl","src","downloadUrl","canCopyImage","kind","getCanCopyImages","runAndClose","action","event","stopPropagation","_jsxs","_Fragment","children","_jsx","Tooltip","title","ButtonIcon","type","ariaLabel","isActive","onClick","currentTarget","testId","concat","MoreOneIcon","Menu","open","anchorEl","placement","onClose","Item","prefix","ShareTwoIcon","LinkOneIcon","disabled","utils","copyToClipboard","showSuccessNotification","PictureIcon","copyImageToClipboard","current","then","copied","showErrorNotification"],"mappings":"q5IA0BqC,SAQHA,GAAA,IAAAC,EAPhCC,IAAAA,KACAC,IAAAA,QAAOC,EAAAJ,EACPK,KAAAA,aAAO,QAAOD,EAAAE,EAAAN,EACdO,aAAAA,aAAe,qBAAoBD,EAAAE,EAAAR,EACnCS,QAAAA,aAAU,OAAMD,EAChBE,IAAAA,SACAC,IAAAA,UAEoCC,EAAAA,EAAQA,SAAqB,MAAKC,EAAAC,EAAAA,QAAAC,EAAA,GAA/DC,EAAUH,EAAA,GAAEI,EAAaJ,EAAA,GAEhCK,EAAAA,WAAU,WACRD,EAAc,KAChB,GAAG,CAACf,EAAKiB,KAET,IAAMC,EAAelB,EAAKmB,KAAOnB,EAAKoB,YAChCC,EAAyC,mBAA1BtB,EAACC,EAAKsB,oBAAQ,WAAyBtB,EAAKmB,KAAOI,EAAAA,mBAWlEC,EAAc,SAACC,GAAkB,OAAK,SAACC,GAC3CA,EAAMC,kBACNF,IACAV,EAAc,MACf,EAED,OACEa,EAAAA,KAAAC,EAAAA,SAAA,CAAAC,SAAA,CACEC,MAACC,UAAO,CAACC,MAAO1B,EAAQuB,SACtBC,MAACG,aAAU,CACT/B,KAAMA,EACNgC,KAAK,aACLC,UAAU,eACVC,WAAYvB,EACZL,UAAWA,EACX6B,QAAS,SAAAZ,GACPA,EAAMC,kBACNZ,EAAcW,EAAMa,cACpB,EACFC,OAAM,GAAAC,OAAKpC,EAAoB,SAAAyB,SAE/BC,EAAAA,IAACW,EAAWA,YAAA,UAIb5B,GACDc,EAAAA,KAACe,EAAAA,KAAI,CAACC,MAAI,EAACC,SAAU/B,EAAYgC,UAAU,aAAaC,QAAS,WAAA,OAAMhC,EAAc,KAAM,EAAAe,SAAA,GACtF7B,GACD8B,EAAAA,IAACY,EAAAA,KAAKK,KAAI,CACRC,OAAQlB,EAAAA,IAACmB,EAAYA,aAAI,IACzBZ,QAASd,GAAY,WAAA,OAAMvB,EAAQD,MACnCwC,OAAM,GAAAC,OAAKpC,EAAqB,UAAAyB,SAAA,eAMpCC,EAAAA,IAACY,EAAIA,KAACK,KAAI,CACRC,OAAQlB,EAAAA,IAACoB,EAAWA,YAAI,IACxBC,UAAWlC,EACXoB,QAASd,GAAY,WACdN,IACLmC,UAAMC,gBAAgBpC,GACtBqC,EAAuBA,wBAAC,4BAC1B,IACAf,OAAM,GAAAC,OAAKpC,EAAyB,cAAAyB,SAAA,cAMrCT,GACCU,MAACY,EAAAA,KAAKK,KAAI,CACRC,OAAQlB,EAAAA,IAACyB,EAAWA,YAAI,IACxBlB,QAASd,GA/DH,WAChBiC,EAAAA,qBAAqBzD,EAAKmB,IAAeX,aAAQ,EAARA,EAAUkD,SAASC,MAAK,SAAAC,GAC3DA,EAAQL,EAAAA,wBAAwB,6BAC/BM,EAAAA,sBAAsB,2BAC7B,OA4DUrB,OAAM,GAAAC,OAAKpC,EAA0B,eAAAyB,SAAA,oBASnD"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var s=require("../../componentsV2/ButtonIcon/ButtonIcon.js"),o=require("../../componentsV2/Tooltip/Tooltip.js"),c=require("../AttachmentLightbox/downloadAttachment.js"),i=require("../../icons/iconParkIcons.js");require("../../icons/customIcons/icons/AddMessage.js"),require("../../icons/customIcons/icons/DragOne.js"),require("../../icons/customIcons/icons/Attention.js"),require("../../icons/customIcons/icons/Collapse.js"),require("../../icons/customIcons/icons/Dashboard.js"),require("../../icons/customIcons/icons/Expand.js"),require("../../icons/customIcons/icons/FolderClosed.js"),require("../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../icons/customIcons/icons/FolderOpened.js"),require("../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../icons/customIcons/icons/LessOrEqual.js"),require("../../icons/customIcons/icons/Search.js"),require("../../icons/customIcons/icons/SearchOne.js"),require("../../icons/customIcons/icons/Wellhub.js"),require("../../icons/customIcons/icons/MultiRuler.js"),require("../../icons/customIcons/icons/Checkbox.js"),require("../../icons/customIcons/icons/CheckboxChecked.js"),require("../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../icons/customIcons/icons/Radio.js"),require("../../icons/customIcons/icons/RadioChecked.js"),require("../../icons/customIcons/icons/SimulFrac.js"),require("../../icons/customIcons/icons/ZipperFrac.js"),require("../../icons/customIcons/icons/CautionFilled.js"),require("../../icons/customIcons/icons/MoreApp.js"),require("../../icons/customIcons/icons/Pad.js"),require("../../icons/customIcons/icons/DrilloutUnit.js"),require("../../icons/customIcons/icons/FracFleet.js"),require("../../icons/customIcons/icons/Global.js"),require("../../icons/customIcons/icons/Program.js"),require("../../icons/customIcons/icons/Rig.js"),require("../../icons/customIcons/icons/Well.js"),require("../../icons/customIcons/icons/Gap.js"),require("../../icons/customIcons/icons/Pin.js"),require("../../icons/customIcons/icons/CloseOneFilled.js"),require("../../icons/customIcons/icons/AttentionFilled.js"),require("../../icons/customIcons/icons/CheckOneFilled.js"),require("../../icons/customIcons/icons/Archive.js"),require("../../icons/customIcons/icons/ArchiveCancel.js"),require("../../icons/customIcons/icons/Unarchive.js"),require("../../icons/customIcons/icons/Archived.js"),require("../../icons/customIcons/icons/InterventionUnit.js"),require("../../icons/customIcons/icons/CloudDelete.js"),require("../../icons/customIcons/icons/Lasso.js"),require("../../icons/customIcons/icons/Radius.js"),require("../../icons/customIcons/icons/ErrorOps.js"),require("../../icons/customIcons/icons/DataTypeOps.js"),require("../../icons/customIcons/icons/FalsePositiveOps.js"),require("../../icons/customIcons/icons/CalibrationOps.js"),require("../../icons/customIcons/icons/CriticalOps.js"),require("../../icons/customIcons/icons/Company.js"),require("../../icons/customIcons/icons/ArchiveOne.js"),require("../../icons/customIcons/icons/ParseBotFusion.js"),require("../../icons/customIcons/icons/Connect.js"),require("../../icons/customIcons/icons/PuzzleOne.js"),require("../../icons/customIcons/icons/Feed.js"),require("../../icons/customIcons/icons/Prompt.js"),require("../../icons/customIcons/icons/Companies.js"),require("../../icons/customIcons/icons/ClipboardAi.js"),require("../../icons/customIcons/icons/Key.js"),require("../../icons/customIcons/icons/AtSignCrossed.js"),require("../../icons/customIcons/icons/MappingManual.js"),require("../../icons/customIcons/icons/Mapping.js"),require("../../icons/customIcons/icons/Metrics.js"),require("../../icons/customIcons/icons/Drops.js"),require("../../icons/customIcons/icons/ClipboardSearch.js"),require("../../icons/customIcons/icons/Template.js"),require("../../icons/customIcons/icons/ClipboardMetrics.js"),require("../../icons/customIcons/icons/ClipboardBuilder.js"),require("../../icons/customIcons/icons/UnitConversion.js"),require("../../icons/customIcons/icons/NPT.js"),require("../../icons/customIcons/icons/GuidedFrac.js");var n=require("react/jsx-runtime");exports.AttachmentDownloadLink=function(e){var r=e.url,u=e.fileName,t=e.size,m=void 0===t?"small":t,a=e.className,j=e.testId,I=void 0===j?"attachment-download":j;return n.jsx(o.Tooltip,{title:"Download",children:n.jsx("a",{href:r,download:u,target:"_blank",rel:"noopener noreferrer",className:a,"data-testid":I,onClick:function(s){s.preventDefault(),s.stopPropagation(),c.saveAttachment(r,u)},children:n.jsx(s.ButtonIcon,{size:m,type:"tertiaryBg",ariaLabel:"Download",children:n.jsx(i.DownloadIcon,{size:"xs"===m?"small":void 0})})})})};
|
|
2
|
+
//# sourceMappingURL=AttachmentDownloadLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentDownloadLink.js","sources":["../../../../src/components/AttachmentPreview/AttachmentDownloadLink.tsx"],"sourcesContent":["import { MouseEvent } from 'react';\n\nimport { ButtonIcon } from '../../componentsV2/ButtonIcon';\nimport { Tooltip } from '../../componentsV2/Tooltip';\nimport { saveAttachment } from '../AttachmentLightbox/downloadAttachment';\n\nimport { DownloadIcon } from '~/icons';\n\nexport type AttachmentDownloadLinkProps = {\n url: string;\n fileName: string;\n /** `xs` sits on a tile, `small` in the preview modal's header. */\n size?: 'xs' | 'small';\n className?: string;\n testId?: string;\n};\n\n/** Keeps the link semantics but fetches the bytes, since `download` is ignored cross-origin. */\nexport const AttachmentDownloadLink = ({\n url,\n fileName,\n size = 'small',\n className,\n testId = 'attachment-download',\n}: AttachmentDownloadLinkProps) => {\n const handleClick = (event: MouseEvent) => {\n event.preventDefault();\n event.stopPropagation();\n saveAttachment(url, fileName);\n };\n\n return (\n <Tooltip title=\"Download\">\n <a\n href={url}\n download={fileName}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={className}\n data-testid={testId}\n onClick={handleClick}\n >\n <ButtonIcon size={size} type=\"tertiaryBg\" ariaLabel=\"Download\">\n <DownloadIcon size={size === 'xs' ? 'small' : undefined} />\n </ButtonIcon>\n </a>\n </Tooltip>\n );\n};\n"],"names":["_ref","url","fileName","_ref$size","size","className","_ref$testId","testId","_jsx","Tooltip","title","children","jsx","href","download","target","rel","onClick","event","preventDefault","stopPropagation","saveAttachment","ButtonIcon","type","ariaLabel","DownloadIcon","undefined"],"mappings":"+nIAkBsC,SAMHA,GAAA,IALjCC,IAAAA,IACAC,IAAAA,SAAQC,EAAAH,EACRI,KAAAA,aAAO,QAAOD,EACdE,IAAAA,UAASC,EAAAN,EACTO,OAAAA,aAAS,sBAAqBD,EAQ9B,OACEE,EAAAA,IAACC,EAAAA,QAAO,CAACC,MAAM,WAAUC,SACvBH,EAAAI,IAAA,IAAA,CACEC,KAAMZ,EACNa,SAAUZ,EACVa,OAAO,SACPC,IAAI,sBACJX,UAAWA,EACX,cAAaE,EACbU,QAfc,SAACC,GACnBA,EAAMC,iBACND,EAAME,kBACNC,iBAAepB,EAAKC,IAYKS,SAErBH,MAACc,aAAU,CAAClB,KAAMA,EAAMmB,KAAK,aAAaC,UAAU,WAAUb,SAC5DH,MAACiB,eAAY,CAACrB,KAAe,OAATA,EAAgB,aAAUsB,SAKxD"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),r=require("react"),t=require("react/jsx-runtime");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=a(e),n=r.forwardRef((function(e,a){var n=e.src,u=e.alt,o=e.className,i=e.draggable,c=r.useState(!0),l=s.default(c,2),f=l[0],d=l[1];return t.jsx("img",{ref:a,src:n,alt:u,className:o,draggable:i,crossOrigin:f?"anonymous":void 0,onError:function(){return d(!1)}},f?"cors":"plain")}));exports.AttachmentImage=n;
|
|
2
|
+
//# sourceMappingURL=AttachmentImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentImage.js","sources":["../../../../src/components/AttachmentPreview/AttachmentImage.tsx"],"sourcesContent":["import { forwardRef, useState } from 'react';\n\nexport type AttachmentImageProps = {\n src?: string;\n alt: string;\n className?: string;\n draggable?: boolean;\n};\n\n/**\n * Asks with CORS so the page may read the pixels, which is what lets Copy image work off the\n * screen. A host that answers without the header refuses outright, so a failed load retries plain.\n */\nexport const AttachmentImage = forwardRef<HTMLImageElement, AttachmentImageProps>(\n ({ src, alt, className, draggable }, ref) => {\n const [readable, setReadable] = useState(true);\n\n return (\n <img\n // Keyed so the browser re-requests rather than reusing the refused response.\n key={readable ? 'cors' : 'plain'}\n ref={ref}\n src={src}\n alt={alt}\n className={className}\n draggable={draggable}\n crossOrigin={readable ? 'anonymous' : undefined}\n onError={() => setReadable(false)}\n />\n );\n }\n);\n"],"names":["AttachmentImage","forwardRef","_ref","ref","src","alt","className","draggable","useState","_useState2","_slicedToArray","_useState","readable","setReadable","_jsx","crossOrigin","undefined","onError"],"mappings":"+PAaaA,EAAkBC,EAAUA,YACvC,SAAAC,EAAqCC,GAAQ,IAA1CC,IAAAA,IAAKC,IAAAA,IAAKC,IAAAA,UAAWC,IAAAA,UACUC,EAAAA,EAAQA,UAAC,GAAKC,EAAAC,EAAAA,QAAAC,EAAA,GAAvCC,EAAQH,EAAA,GAAEI,EAAWJ,EAAA,GAE5B,OACEK,EAAAA,IAAA,MAAA,CAGEX,IAAKA,EACLC,IAAKA,EACLC,IAAKA,EACLC,UAAWA,EACXC,UAAWA,EACXQ,YAAaH,EAAW,iBAAcI,EACtCC,QAAS,WAAA,OAAMJ,GAAY,EAAM,GAP5BD,EAAW,OAAS,QAU/B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/objectWithoutProperties"),r=require("react"),n=require("../AttachmentLightbox/useAttachmentLightbox.js"),o=require("./AttachmentRow.js"),i=require("./SortableAttachments.js"),c=require("react/jsx-runtime");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/objectWithoutProperties"),r=require("react"),n=require("../AttachmentLightbox/useAttachmentLightbox.js"),o=require("./AttachmentRow.js"),i=require("./SortableAttachments.js"),c=require("react/jsx-runtime");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=a(e),l=a(t),s=["onReorder","onItemClick","onShare"];function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?b(Object(r),!0).forEach((function(t){u.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var f=r.forwardRef((function(e,t){var r=e.onReorder,a=e.onItemClick,u=e.onShare,b=l.default(e,s),f=n.useAttachmentLightbox(b.items,{onShare:u}),p=f.openAttachment,m=f.lightbox;if(!b.items.length)return null;var j=!!r&&b.items.length>1?c.jsx(i.SortableAttachments,h(h({},b),{},{ref:t,onReorder:r,onItemClick:null!=a?a:p})):c.jsx(o.AttachmentRow,h(h({},b),{},{ref:t,onShare:u,onItemClick:null!=a?a:p}));return c.jsxs(c.Fragment,{children:[j,!a&&m]})}));exports.AttachmentPreview=f;
|
|
2
2
|
//# sourceMappingURL=AttachmentPreview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentPreview.js","sources":["../../../../src/components/AttachmentPreview/AttachmentPreview.tsx"],"sourcesContent":["import { forwardRef } from 'react';\n\nimport { useAttachmentLightbox } from '../AttachmentLightbox/useAttachmentLightbox';\n\nimport { AttachmentRow } from './AttachmentRow';\nimport { SortableAttachments } from './SortableAttachments';\nimport { AttachmentPreviewProps } from './AttachmentPreview.types';\n\n/**\n * Picks the strip that fits — reorderable or plain — and gives it a lightbox. Rendering lives in\n * `AttachmentRow`, drag-and-drop in `SortableAttachments`, the modal in `useAttachmentLightbox`.\n */\nexport const AttachmentPreview = forwardRef<HTMLDivElement, AttachmentPreviewProps>(\n ({ onReorder, onItemClick, ...props }, ref) => {\n
|
|
1
|
+
{"version":3,"file":"AttachmentPreview.js","sources":["../../../../src/components/AttachmentPreview/AttachmentPreview.tsx"],"sourcesContent":["import { forwardRef } from 'react';\n\nimport { useAttachmentLightbox } from '../AttachmentLightbox/useAttachmentLightbox';\n\nimport { AttachmentRow } from './AttachmentRow';\nimport { SortableAttachments } from './SortableAttachments';\nimport { AttachmentPreviewProps } from './AttachmentPreview.types';\n\n/**\n * Picks the strip that fits — reorderable or plain — and gives it a lightbox. Rendering lives in\n * `AttachmentRow`, drag-and-drop in `SortableAttachments`, the modal in `useAttachmentLightbox`.\n */\nexport const AttachmentPreview = forwardRef<HTMLDivElement, AttachmentPreviewProps>(\n ({ onReorder, onItemClick, onShare, ...props }, ref) => {\n const { openAttachment, lightbox } = useAttachmentLightbox(props.items, { onShare });\n\n if (!props.items.length) return null;\n\n const isSortable = !!onReorder && props.items.length > 1;\n const strip = isSortable ? (\n <SortableAttachments\n {...props}\n ref={ref}\n onReorder={onReorder}\n onItemClick={onItemClick ?? openAttachment}\n />\n ) : (\n <AttachmentRow\n {...props}\n ref={ref}\n onShare={onShare}\n onItemClick={onItemClick ?? openAttachment}\n />\n );\n\n return (\n <>\n {strip}\n {!onItemClick && lightbox}\n </>\n );\n }\n);\n"],"names":["AttachmentPreview","forwardRef","_ref","ref","onReorder","onItemClick","onShare","props","_objectWithoutProperties","_excluded","_useAttachmentLightbo","useAttachmentLightbox","items","openAttachment","lightbox","length","strip","_jsx","SortableAttachments","jsx","AttachmentRow","_objectSpread","_jsxs","_Fragment","children"],"mappings":"wjCAYaA,EAAoBC,EAAUA,YACzC,SAAAC,EAAgDC,GAAQ,IAArDC,IAAAA,UAAWC,IAAAA,YAAaC,IAAAA,QAAYC,EAAKC,EAAA,QAAAN,EAAAO,GAC1CC,EAAqCC,EAAAA,sBAAsBJ,EAAMK,MAAO,CAAEN,QAAAA,IAAlEO,IAAAA,eAAgBC,IAAAA,SAExB,IAAKP,EAAMK,MAAMG,OAAQ,OAAO,KAEhC,IACMC,IADeZ,GAAaG,EAAMK,MAAMG,OAAS,EAErDE,EAAAA,IAACC,EAAmBA,2BACdX,GAAK,GAAA,CACTJ,IAAKA,EACLC,UAAWA,EACXC,YAAaA,QAAAA,EAAeQ,KAG9BI,EAAAE,IAACC,gBAAaC,EAAAA,EAAA,CAAA,EACRd,GAAK,GAAA,CACTJ,IAAKA,EACLG,QAASA,EACTD,YAAaA,QAAAA,EAAeQ,KAIhC,OACES,EAAAA,KAAAC,EAAAA,SAAA,CAAAC,SAAA,CACGR,GACCX,GAAeS,IAGvB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require('./../../ext-esm/style-inject/dist/style-inject.es.js')('.AttachmentPreview_scroller__ZqYC8{-ms-overflow-style:none;align-items:flex-start;display:flex;gap:12px;margin-left:-8px;overflow-x:auto;overflow-y:visible;padding-left:8px;padding-right:8px;padding-top:6px;scroll-behavior:smooth;scrollbar-width:none}.AttachmentPreview_scroller__ZqYC8::-webkit-scrollbar{display:none}.AttachmentPreview_slot__ewKLo{border-radius:8px;cursor:grab;flex-shrink:0;position:relative;touch-action:none}.AttachmentPreview_slot__ewKLo:focus-visible{outline:none}.AttachmentPreview_slot__ewKLo:focus-visible:before{border:2px solid var(--palette-primary-main);border-radius:8px;content:"";inset:0;pointer-events:none;position:absolute;z-index:5}.AttachmentPreview_slotDragging__hrfJX{cursor:grabbing}.AttachmentPreview_slotDragging__hrfJX .AttachmentPreview_slotContent__GNuSu{visibility:hidden}.AttachmentPreview_slotDragging__hrfJX:focus-visible:before{display:none}.AttachmentPreview_slotDragging__hrfJX:after{background:rgb(from var(--palette-primary-text-1) r g b/.04);border:1px dashed var(--palette-primary-text-6);border-radius:8px;content:"";inset:0;position:absolute}.AttachmentPreview_insertion__iFqlp{background:var(--palette-primary-main);border-radius:2px;bottom:0;box-shadow:0 0 6px rgb(from var(--palette-primary-main) r g b/.6);position:absolute;top:0;width:2px;z-index:4}.AttachmentPreview_insertionBefore__jyWQM,.AttachmentPreview_insertionEdge__Bjk1t{left:-7px}.AttachmentPreview_insertionAfter__4NvhP{right:-7px}.AttachmentPreview_dragGhost__4aSzE{background:var(--palette-background-b-6);border-radius:8px;box-shadow:0 10px 20px rgb(from var(--palette-background-b-1) r g b/.45);cursor:grabbing;opacity:.9;position:relative;transform:rotate(4deg)}.AttachmentPreview_dragGhostHandle__Gu2CP{align-items:center;display:flex;inset:0;justify-content:center;pointer-events:none;position:absolute;z-index:2}.AttachmentPreview_dragGhostHandle__Gu2CP button{backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.16)!important;color:var(--palette-primary-text-1)!important}.AttachmentPreview_dragGhostHandle__Gu2CP svg{color:var(--palette-primary-text-1)}.AttachmentPreview_thumbnail__ytI2L{border-radius:8px;flex-shrink:0;height:64px;overflow:visible;position:relative;width:64px}.AttachmentPreview_clickable__BEXzK{cursor:pointer}.AttachmentPreview_clickable__BEXzK:hover{opacity:.9}.AttachmentPreview_thumbnailInner__9Ex4-{border-radius:8px;inset:0;overflow:hidden;pointer-events:none;position:absolute}.AttachmentPreview_thumbnailImage__RQ4fL{height:100%;left:50%;max-width:none;min-width:100%;object-fit:cover;pointer-events:none;position:absolute;top:0;transform:translateX(-50%);width:auto}.AttachmentPreview_videoOverlay__5Lgi1{align-items:center;background:rgb(from var(--palette-background-b-1) r g b/.5);border-radius:8px;display:flex;inset:0;justify-content:center;pointer-events:none;position:absolute}.AttachmentPreview_playIcon__OOnql{color:var(--palette-primary-text-1);font-size:32px}.AttachmentPreview_fileCard__oxDbD{align-items:flex-start;border:1px solid rgb(from var(--palette-primary-text-1) r g b/.08);border-radius:8px;display:flex;flex-direction:column;flex-shrink:0;height:64px;justify-content:center;padding:8px 16px;position:relative;width:142px}.AttachmentPreview_fileCardLink__TDpvh{color:inherit;cursor:pointer;text-decoration:none}.AttachmentPreview_fileCardLink__TDpvh:hover{border-color:rgb(from var(--palette-primary-text-1) r g b/.16)}.AttachmentPreview_fileCardContent__c-99Q{align-items:center;display:flex;gap:8px;width:100%}.AttachmentPreview_fileInfo__eqJ-B{align-items:flex-start;display:flex;flex:1 0 0;flex-direction:column;justify-content:center;min-width:0}.AttachmentPreview_fileName__1Ccg0{color:var(--palette-primary-text-1)}.AttachmentPreview_fileName__1Ccg0,.AttachmentPreview_fileType__0v6E4{font-size:14px;line-height:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}.AttachmentPreview_fileType__0v6E4{color:var(--palette-primary-text-6);text-transform:uppercase}.
|
|
1
|
+
"use strict";require('./../../ext-esm/style-inject/dist/style-inject.es.js')('.AttachmentPreview_scroller__ZqYC8{-ms-overflow-style:none;align-items:flex-start;display:flex;gap:12px;margin-left:-8px;overflow-x:auto;overflow-y:visible;padding-left:8px;padding-right:8px;padding-top:6px;scroll-behavior:smooth;scrollbar-width:none}.AttachmentPreview_scroller__ZqYC8::-webkit-scrollbar{display:none}.AttachmentPreview_slot__ewKLo{border-radius:8px;cursor:grab;flex-shrink:0;position:relative;touch-action:none}.AttachmentPreview_slot__ewKLo:focus-visible{outline:none}.AttachmentPreview_slot__ewKLo:focus-visible:before{border:2px solid var(--palette-primary-main);border-radius:8px;content:"";inset:0;pointer-events:none;position:absolute;z-index:5}.AttachmentPreview_slotDragging__hrfJX{cursor:grabbing}.AttachmentPreview_slotDragging__hrfJX .AttachmentPreview_slotContent__GNuSu{visibility:hidden}.AttachmentPreview_slotDragging__hrfJX:focus-visible:before{display:none}.AttachmentPreview_slotDragging__hrfJX:after{background:rgb(from var(--palette-primary-text-1) r g b/.04);border:1px dashed var(--palette-primary-text-6);border-radius:8px;content:"";inset:0;position:absolute}.AttachmentPreview_insertion__iFqlp{background:var(--palette-primary-main);border-radius:2px;bottom:0;box-shadow:0 0 6px rgb(from var(--palette-primary-main) r g b/.6);position:absolute;top:0;width:2px;z-index:4}.AttachmentPreview_insertionBefore__jyWQM,.AttachmentPreview_insertionEdge__Bjk1t{left:-7px}.AttachmentPreview_insertionAfter__4NvhP{right:-7px}.AttachmentPreview_dragGhost__4aSzE{background:var(--palette-background-b-6);border-radius:8px;box-shadow:0 10px 20px rgb(from var(--palette-background-b-1) r g b/.45);cursor:grabbing;opacity:.9;position:relative;transform:rotate(4deg)}.AttachmentPreview_dragGhostHandle__Gu2CP{align-items:center;display:flex;inset:0;justify-content:center;pointer-events:none;position:absolute;z-index:2}.AttachmentPreview_dragGhostHandle__Gu2CP button{backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.16)!important;color:var(--palette-primary-text-1)!important}.AttachmentPreview_dragGhostHandle__Gu2CP svg{color:var(--palette-primary-text-1)}.AttachmentPreview_thumbnail__ytI2L{border-radius:8px;flex-shrink:0;height:64px;overflow:visible;position:relative;width:64px}.AttachmentPreview_clickable__BEXzK{cursor:pointer}.AttachmentPreview_clickable__BEXzK:hover{opacity:.9}.AttachmentPreview_selected__JRuMO:after{border:1px solid var(--palette-primary-main);border-radius:8px;content:"";inset:0;pointer-events:none;position:absolute;z-index:4}.AttachmentPreview_thumbnailInner__9Ex4-{border-radius:8px;inset:0;overflow:hidden;pointer-events:none;position:absolute}.AttachmentPreview_thumbnailImage__RQ4fL{height:100%;left:50%;max-width:none;min-width:100%;object-fit:cover;pointer-events:none;position:absolute;top:0;transform:translateX(-50%);width:auto}.AttachmentPreview_videoOverlay__5Lgi1{align-items:center;background:rgb(from var(--palette-background-b-1) r g b/.5);border-radius:8px;display:flex;inset:0;justify-content:center;pointer-events:none;position:absolute}.AttachmentPreview_playIcon__OOnql{color:var(--palette-primary-text-1);font-size:32px}.AttachmentPreview_fileCard__oxDbD{align-items:flex-start;border:1px solid rgb(from var(--palette-primary-text-1) r g b/.08);border-radius:8px;display:flex;flex-direction:column;flex-shrink:0;height:64px;justify-content:center;padding:8px 16px;position:relative;width:142px}.AttachmentPreview_fileCardLink__TDpvh{color:inherit;cursor:pointer;text-decoration:none}.AttachmentPreview_fileCardLink__TDpvh:hover{border-color:rgb(from var(--palette-primary-text-1) r g b/.16)}.AttachmentPreview_fileCardContent__c-99Q{align-items:center;display:flex;gap:8px;width:100%}.AttachmentPreview_fileInfo__eqJ-B{align-items:flex-start;display:flex;flex:1 0 0;flex-direction:column;justify-content:center;min-width:0}.AttachmentPreview_fileName__1Ccg0{color:var(--palette-primary-text-1)}.AttachmentPreview_fileName__1Ccg0,.AttachmentPreview_fileType__0v6E4{font-size:14px;line-height:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}.AttachmentPreview_fileType__0v6E4{color:var(--palette-primary-text-6);text-transform:uppercase}.AttachmentPreview_tileActions__2nLlw{display:flex;gap:4px;opacity:0;position:absolute;right:-6px;top:-6px;transition:opacity .2s;z-index:3}.AttachmentPreview_tileActions__2nLlw button{backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.08)!important}.AttachmentPreview_tileActions__2nLlw button:hover{background-color:rgb(from var(--palette-primary-text-1) r g b/.15)!important}.AttachmentPreview_fileCard__oxDbD .AttachmentPreview_tileActions__2nLlw:focus-within,.AttachmentPreview_fileCard__oxDbD:hover .AttachmentPreview_tileActions__2nLlw,.AttachmentPreview_thumbnail__ytI2L .AttachmentPreview_tileActions__2nLlw:focus-within,.AttachmentPreview_thumbnail__ytI2L:hover .AttachmentPreview_tileActions__2nLlw{opacity:1}.AttachmentPreview_tileActionLink__aMyS4{display:inline-flex}.AttachmentPreview_removeButton__aX-qu{opacity:0;position:absolute;right:-6px;top:-6px;transition:opacity .2s;z-index:3}.AttachmentPreview_removeButton__aX-qu button{backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.08)!important}.AttachmentPreview_removeButton__aX-qu button:hover{background-color:rgb(from var(--palette-primary-text-1) r g b/.15)!important}.AttachmentPreview_fileCard__oxDbD:hover .AttachmentPreview_removeButton__aX-qu,.AttachmentPreview_removeButtonVisible__BVjYB,.AttachmentPreview_thumbnail__ytI2L:hover .AttachmentPreview_removeButton__aX-qu{opacity:1}.AttachmentPreview_thumbnailError__yyH08{border:1px solid rgb(from var(--palette-error-main) r g b/.4)}.AttachmentPreview_uploadingOverlay__leV1D{background:rgb(from var(--palette-background-b-1) r g b/.5);border-radius:8px;inset:0;pointer-events:none;position:absolute}.AttachmentPreview_uploadingSpinner__u-t7d{align-items:center;backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.08);border-radius:6px;display:flex;height:24px;justify-content:center;position:absolute;right:-6px;top:-6px;width:24px;z-index:2}.AttachmentPreview_loader__HK5bZ{color:var(--palette-primary-text-6)!important;height:14px!important;width:14px!important}.AttachmentPreview_errorOverlay__8sM1d{background:rgb(from var(--palette-error-main) r g b/.08);border-radius:8px;inset:0;pointer-events:none;position:absolute}.AttachmentPreview_retryButton__tKVV0{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:2}.AttachmentPreview_retryButton__tKVV0 button{backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.08)!important}.AttachmentPreview_retryButton__tKVV0 button:hover{background-color:rgb(from var(--palette-primary-text-1) r g b/.15)!important}'),module.exports={spacing:"8",scroller:"AttachmentPreview_scroller__ZqYC8",slot:"AttachmentPreview_slot__ewKLo",slotDragging:"AttachmentPreview_slotDragging__hrfJX",slotContent:"AttachmentPreview_slotContent__GNuSu",insertion:"AttachmentPreview_insertion__iFqlp",insertionBefore:"AttachmentPreview_insertionBefore__jyWQM",insertionEdge:"AttachmentPreview_insertionEdge__Bjk1t",insertionAfter:"AttachmentPreview_insertionAfter__4NvhP",dragGhost:"AttachmentPreview_dragGhost__4aSzE",dragGhostHandle:"AttachmentPreview_dragGhostHandle__Gu2CP",thumbnail:"AttachmentPreview_thumbnail__ytI2L",clickable:"AttachmentPreview_clickable__BEXzK",selected:"AttachmentPreview_selected__JRuMO",thumbnailInner:"AttachmentPreview_thumbnailInner__9Ex4-",thumbnailImage:"AttachmentPreview_thumbnailImage__RQ4fL",videoOverlay:"AttachmentPreview_videoOverlay__5Lgi1",playIcon:"AttachmentPreview_playIcon__OOnql",fileCard:"AttachmentPreview_fileCard__oxDbD",fileCardLink:"AttachmentPreview_fileCardLink__TDpvh",fileCardContent:"AttachmentPreview_fileCardContent__c-99Q",fileInfo:"AttachmentPreview_fileInfo__eqJ-B",fileName:"AttachmentPreview_fileName__1Ccg0",fileType:"AttachmentPreview_fileType__0v6E4",tileActions:"AttachmentPreview_tileActions__2nLlw",tileActionLink:"AttachmentPreview_tileActionLink__aMyS4",removeButton:"AttachmentPreview_removeButton__aX-qu",removeButtonVisible:"AttachmentPreview_removeButtonVisible__BVjYB",thumbnailError:"AttachmentPreview_thumbnailError__yyH08",uploadingOverlay:"AttachmentPreview_uploadingOverlay__leV1D",uploadingSpinner:"AttachmentPreview_uploadingSpinner__u-t7d",loader:"AttachmentPreview_loader__HK5bZ",errorOverlay:"AttachmentPreview_errorOverlay__8sM1d",retryButton:"AttachmentPreview_retryButton__tKVV0"};
|
|
2
2
|
//# sourceMappingURL=AttachmentPreview.scss.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("classnames"),r=require("./AttachmentTile.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("classnames"),r=require("./AttachmentTile.js"),i=require("./AttachmentPreview.scss.js"),n=require("react/jsx-runtime");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=s(t),o=e.forwardRef((function(e,t){var s=e.items,o=e.onRemove,c=e.onRetry,d=e.onItemClick,u=e.onShare,l=e.selectedId,m=e.hideActions,f=e.className,h=e.testId;return n.jsx("div",{ref:t,"data-testid":h,className:a.default(i.scroller,f),children:s.map((function(e){return n.jsx(r.AttachmentTile,{item:e,onRemove:o,onRetry:c,onItemClick:d,onShare:u,isSelected:void 0!==l&&e.id===l,hideActions:m},e.id)}))})}));exports.AttachmentRow=o;
|
|
2
2
|
//# sourceMappingURL=AttachmentRow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentRow.js","sources":["../../../../src/components/AttachmentPreview/AttachmentRow.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport classNames from 'classnames';\n\nimport { AttachmentTile } from './AttachmentTile';\nimport { AttachmentPreviewProps } from './AttachmentPreview.types';\n\nimport styles from './AttachmentPreview.scss';\n\nexport type AttachmentRowProps = Omit<AttachmentPreviewProps, 'onReorder'
|
|
1
|
+
{"version":3,"file":"AttachmentRow.js","sources":["../../../../src/components/AttachmentPreview/AttachmentRow.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport classNames from 'classnames';\n\nimport { AttachmentTile } from './AttachmentTile';\nimport { AttachmentPreviewItem, AttachmentPreviewProps } from './AttachmentPreview.types';\n\nimport styles from './AttachmentPreview.scss';\n\nexport type AttachmentRowProps = Omit<AttachmentPreviewProps, 'onReorder'> & {\n selectedId?: AttachmentPreviewItem['id'];\n};\n\n/** The plain, non-reorderable strip. `SortableAttachments` is its drag-and-drop counterpart. */\nexport const AttachmentRow = forwardRef<HTMLDivElement, AttachmentRowProps>(\n (\n { items, onRemove, onRetry, onItemClick, onShare, selectedId, hideActions, className, testId },\n ref\n ) => (\n <div ref={ref} data-testid={testId} className={classNames(styles.scroller, className)}>\n {items.map(item => (\n <AttachmentTile\n key={item.id}\n item={item}\n onRemove={onRemove}\n onRetry={onRetry}\n onItemClick={onItemClick}\n onShare={onShare}\n isSelected={selectedId !== undefined && item.id === selectedId}\n hideActions={hideActions}\n />\n ))}\n </div>\n )\n);\n"],"names":["AttachmentRow","forwardRef","ref","items","onRemove","onRetry","onItemClick","onShare","selectedId","hideActions","className","testId","_jsx","classNames","styles","scroller","children","map","item","AttachmentTile","isSelected","undefined","id"],"mappings":"+SAaaA,EAAgBC,EAAUA,YACrC,WAEEC,GAAG,IADDC,IAAAA,MAAOC,IAAAA,SAAUC,IAAAA,QAASC,IAAAA,YAAaC,IAAAA,QAASC,IAAAA,WAAYC,IAAAA,YAAaC,IAAAA,UAAWC,IAAAA,OAAM,OAG5FC,EAAAA,IAAA,MAAA,CAAKV,IAAKA,EAAK,cAAaS,EAAQD,UAAWG,EAAU,QAACC,EAAOC,SAAUL,GAAWM,SACnFb,EAAMc,KAAI,SAAAC,GAAI,OACbN,EAAAA,IAACO,EAAAA,eAAc,CAEbD,KAAMA,EACNd,SAAUA,EACVC,QAASA,EACTC,YAAaA,EACbC,QAASA,EACTa,gBAA2BC,IAAfb,GAA4BU,EAAKI,KAAOd,EACpDC,YAAaA,GAPRS,EAAKI,QAUV"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var s=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),s=require("react"),o=require("classnames"),n=require("../../componentsV2/FileIcon/FileIcon.js"),i=require("../../componentsV2/ButtonIcon/ButtonIcon.js"),c=require("../../componentsV2/Tooltip/Tooltip.js"),r=require("../../componentsV2/LoaderCircular/LoaderCircular.js"),t=require("../../icons/iconParkIcons.js");require("../../icons/customIcons/icons/AddMessage.js"),require("../../icons/customIcons/icons/DragOne.js"),require("../../icons/customIcons/icons/Attention.js"),require("../../icons/customIcons/icons/Collapse.js"),require("../../icons/customIcons/icons/Dashboard.js"),require("../../icons/customIcons/icons/Expand.js"),require("../../icons/customIcons/icons/FolderClosed.js"),require("../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../icons/customIcons/icons/FolderOpened.js"),require("../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../icons/customIcons/icons/LessOrEqual.js"),require("../../icons/customIcons/icons/Search.js"),require("../../icons/customIcons/icons/SearchOne.js"),require("../../icons/customIcons/icons/Wellhub.js"),require("../../icons/customIcons/icons/MultiRuler.js"),require("../../icons/customIcons/icons/Checkbox.js"),require("../../icons/customIcons/icons/CheckboxChecked.js"),require("../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../icons/customIcons/icons/Radio.js"),require("../../icons/customIcons/icons/RadioChecked.js"),require("../../icons/customIcons/icons/SimulFrac.js"),require("../../icons/customIcons/icons/ZipperFrac.js"),require("../../icons/customIcons/icons/CautionFilled.js"),require("../../icons/customIcons/icons/MoreApp.js"),require("../../icons/customIcons/icons/Pad.js"),require("../../icons/customIcons/icons/DrilloutUnit.js"),require("../../icons/customIcons/icons/FracFleet.js"),require("../../icons/customIcons/icons/Global.js"),require("../../icons/customIcons/icons/Program.js"),require("../../icons/customIcons/icons/Rig.js"),require("../../icons/customIcons/icons/Well.js"),require("../../icons/customIcons/icons/Gap.js"),require("../../icons/customIcons/icons/Pin.js"),require("../../icons/customIcons/icons/CloseOneFilled.js"),require("../../icons/customIcons/icons/AttentionFilled.js"),require("../../icons/customIcons/icons/CheckOneFilled.js"),require("../../icons/customIcons/icons/Archive.js"),require("../../icons/customIcons/icons/ArchiveCancel.js"),require("../../icons/customIcons/icons/Unarchive.js"),require("../../icons/customIcons/icons/Archived.js"),require("../../icons/customIcons/icons/InterventionUnit.js"),require("../../icons/customIcons/icons/CloudDelete.js"),require("../../icons/customIcons/icons/Lasso.js"),require("../../icons/customIcons/icons/Radius.js"),require("../../icons/customIcons/icons/ErrorOps.js"),require("../../icons/customIcons/icons/DataTypeOps.js"),require("../../icons/customIcons/icons/FalsePositiveOps.js"),require("../../icons/customIcons/icons/CalibrationOps.js"),require("../../icons/customIcons/icons/CriticalOps.js"),require("../../icons/customIcons/icons/Company.js"),require("../../icons/customIcons/icons/ArchiveOne.js"),require("../../icons/customIcons/icons/ParseBotFusion.js"),require("../../icons/customIcons/icons/Connect.js"),require("../../icons/customIcons/icons/PuzzleOne.js"),require("../../icons/customIcons/icons/Feed.js"),require("../../icons/customIcons/icons/Prompt.js"),require("../../icons/customIcons/icons/Companies.js"),require("../../icons/customIcons/icons/ClipboardAi.js"),require("../../icons/customIcons/icons/Key.js"),require("../../icons/customIcons/icons/AtSignCrossed.js"),require("../../icons/customIcons/icons/MappingManual.js"),require("../../icons/customIcons/icons/Mapping.js"),require("../../icons/customIcons/icons/Metrics.js"),require("../../icons/customIcons/icons/Drops.js"),require("../../icons/customIcons/icons/ClipboardSearch.js"),require("../../icons/customIcons/icons/Template.js"),require("../../icons/customIcons/icons/ClipboardMetrics.js"),require("../../icons/customIcons/icons/ClipboardBuilder.js"),require("../../icons/customIcons/icons/UnitConversion.js"),require("../../icons/customIcons/icons/NPT.js"),require("../../icons/customIcons/icons/GuidedFrac.js");var u=require("./AttachmentActionsMenu.js"),a=require("./AttachmentImage.js"),l=require("./AttachmentDownloadLink.js"),m=require("./AttachmentPreview.scss.js"),j=require("../../utils/main.js"),d=require("react/jsx-runtime");function I(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var q=I(e),p=I(o);function h(e,s){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);s&&(n=n.filter((function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable}))),o.push.apply(o,n)}return o}function v(e){for(var s=1;s<arguments.length;s++){var o=null!=arguments[s]?arguments[s]:{};s%2?h(Object(o),!0).forEach((function(s){q.default(e,s,o[s])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):h(Object(o)).forEach((function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(o,s))}))}return e}var f=function(e){var s,o=e.split(".");return o.length>1?(null!==(s=o.pop())&&void 0!==s?s:"").toUpperCase():""},x=function(e){var s=e.item,o=e.onShare,n=e.imageRef,i=j.default.getFileNameWithExtensionFromPath(s.name),c=s.downloadUrl||s.src;return d.jsxs("div",{className:m.tileActions,"data-testid":"attachment-tile-actions",children:[!!c&&d.jsx(l.AttachmentDownloadLink,{url:c,fileName:i,size:"xs",className:m.tileActionLink}),d.jsx(u.AttachmentActionsMenu,{item:s,onShare:o,size:"xs",testIdPrefix:"attachment-tile",tooltip:"More actions",imageRef:n})]})},g=function(e){return function(s){s.stopPropagation(),e()}},b=function(e){var s=e.item,o=e.onRemove,n=e.onRetry;return d.jsxs(d.Fragment,{children:[s.isUploading&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:m.uploadingOverlay}),d.jsx("div",{className:m.uploadingSpinner,children:d.jsx(r.LoaderCircular,{size:"xs",className:m.loader})})]}),!!s.error&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:m.errorOverlay}),n&&d.jsx(c.Tooltip,{title:"Retry upload",children:d.jsx("div",{className:m.retryButton,children:d.jsx(i.ButtonIcon,{size:"xs",type:"tertiaryBg",onClick:g((function(){return n(s.id)})),testId:"attachment-retry",children:d.jsx(t.UndoIcon,{size:"small"})})})})]}),o&&!s.isUploading&&d.jsx(c.Tooltip,{title:"Remove",children:d.jsx("div",{className:p.default(m.removeButton,!!s.error&&m.removeButtonVisible),children:d.jsx(i.ButtonIcon,{size:"xs",type:"tertiaryBg",onClick:g((function(){return o(s.id)})),testId:"attachment-remove",children:d.jsx(t.CloseSmallIcon,{size:"small"})})})})]})};exports.AttachmentTile=function(e){var o,i,r=e.item,u=e.onRemove,l=e.onRetry,I=e.onItemClick,q=e.isSelected,h=e.hideActions,g=e.onShare,C=s.useRef(null),y=null!==(o=r.kind)&&void 0!==o?o:"file",O=d.jsx(b,{item:r,onRemove:u,onRetry:l}),F=j.default.getFileNameWithExtensionFromPath(r.name),P=!r.isUploading&&!r.error,N=!!I&&P,A=!h&&!u&&P;if("image"===y||"video"===y)return d.jsxs("div",{className:p.default(m.thumbnail,N&&m.clickable,q&&m.selected,!!r.error&&m.thumbnailError),onClick:N?function(){return null==I?void 0:I(r)}:void 0,children:[d.jsx("div",{className:m.thumbnailInner,children:"image"===y?d.jsx(a.AttachmentImage,{ref:C,src:r.src,alt:F,className:m.thumbnailImage}):d.jsx("video",{src:(i=r.src,i&&!i.includes("#t=")?"".concat(i,"#t=0.1"):i),className:m.thumbnailImage,preload:"metadata",playsInline:!0,muted:!0})}),"video"===y&&d.jsx("div",{className:m.videoOverlay,children:d.jsx(t.PlayOneIcon,{theme:"filled",className:m.playIcon})}),A&&d.jsx(x,{item:r,onShare:g,imageRef:C}),O]});var k,R=d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:m.fileCardContent,children:[d.jsx(n.FileIcon,{name:F}),d.jsxs("div",{className:m.fileInfo,children:[d.jsx(c.Tooltip,{title:F,children:d.jsx("div",{className:m.fileName,children:(k=F,k.replace(/\.[^/.]+$/,""))})}),d.jsx("div",{className:m.fileType,children:f(F)})]})]}),A&&d.jsx(x,{item:r,onShare:g}),O]}),S=N?{role:"button",tabIndex:0,onClick:function(){return null==I?void 0:I(r)},onKeyDown:function(e){e.target===e.currentTarget&&("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),null==I||I(r)))}}:{};return d.jsx("div",v(v({className:p.default(m.fileCard,N&&m.fileCardLink,q&&m.selected,!!r.error&&m.thumbnailError)},S),{},{children:R}))};
|
|
2
2
|
//# sourceMappingURL=AttachmentTile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentTile.js","sources":["../../../../src/components/AttachmentPreview/AttachmentTile.tsx"],"sourcesContent":["import { MouseEvent } from 'react';\nimport classNames from 'classnames';\n\nimport { FileIcon } from '../../componentsV2/FileIcon';\nimport { ButtonIcon } from '../../componentsV2/ButtonIcon';\nimport { Tooltip } from '../../componentsV2/Tooltip';\nimport { LoaderCircular } from '../../componentsV2/LoaderCircular';\nimport { PlayOneIcon, CloseSmallIcon, UndoIcon } from '../../icons';\n\nimport { AttachmentPreviewItem, AttachmentPreviewProps } from './AttachmentPreview.types';\n\nimport styles from './AttachmentPreview.scss';\n\nimport { DownloadIcon } from '~/icons';\nimport utils from '~/utils/main';\n\nconst getExtension = (name: string) => {\n const parts = name.split('.');\n return parts.length > 1 ? (parts.pop() ?? '').toUpperCase() : '';\n};\n\nconst dropExtension = (name: string) => name.replace(/\\.[^/.]+$/, '');\n\n// A bare <video> paints nothing until a frame is decoded; the media fragment forces one.\nconst withFirstFrame = (src?: string) => (src && !src.includes('#t=') ? `${src}#t=0.1` : src);\n\nexport type AttachmentTileProps = {\n item: AttachmentPreviewItem;\n onRemove?: AttachmentPreviewProps['onRemove'];\n onRetry?: AttachmentPreviewProps['onRetry'];\n onItemClick?: AttachmentPreviewProps['onItemClick'];\n};\n\nconst stopAndRun = (action: () => void) => (event: MouseEvent) => {\n event.stopPropagation();\n action();\n};\n\nconst TileOverlays = ({ item, onRemove, onRetry }: Omit<AttachmentTileProps, 'onItemClick'>) => (\n <>\n {item.isUploading && (\n <>\n <div className={styles.uploadingOverlay} />\n <div className={styles.uploadingSpinner}>\n <LoaderCircular size=\"xs\" className={styles.loader} />\n </div>\n </>\n )}\n\n {!!item.error && (\n <>\n <div className={styles.errorOverlay} />\n {onRetry && (\n <Tooltip title=\"Retry upload\">\n <div className={styles.retryButton}>\n <ButtonIcon\n size=\"xs\"\n type=\"tertiaryBg\"\n onClick={stopAndRun(() => onRetry(item.id))}\n testId=\"attachment-retry\"\n >\n <UndoIcon size=\"small\" />\n </ButtonIcon>\n </div>\n </Tooltip>\n )}\n </>\n )}\n\n {onRemove && !item.isUploading && (\n <Tooltip title=\"Remove\">\n <div\n className={classNames(styles.removeButton, !!item.error && styles.removeButtonVisible)}\n >\n <ButtonIcon\n size=\"xs\"\n type=\"tertiaryBg\"\n onClick={stopAndRun(() => onRemove(item.id))}\n testId=\"attachment-remove\"\n >\n <CloseSmallIcon size=\"small\" />\n </ButtonIcon>\n </div>\n </Tooltip>\n )}\n </>\n);\n\nexport const AttachmentTile = ({ item, onRemove, onRetry, onItemClick }: AttachmentTileProps) => {\n const kind = item.kind ?? 'file';\n const overlays = <TileOverlays item={item} onRemove={onRemove} onRetry={onRetry} />;\n const fileName = utils.getFileNameWithExtensionFromPath(item.name);\n\n if (kind === 'image' || kind === 'video') {\n const clickable = !!onItemClick && !item.isUploading && !item.error;\n return (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events\n <div\n className={classNames(\n styles.thumbnail,\n clickable && styles.clickable,\n !!item.error && styles.thumbnailError\n )}\n onClick={clickable ? () => onItemClick?.(item) : undefined}\n >\n <div className={styles.thumbnailInner}>\n {kind === 'image' ? (\n <img src={item.src} alt={fileName} className={styles.thumbnailImage} />\n ) : (\n <video\n src={withFirstFrame(item.src)}\n className={styles.thumbnailImage}\n preload=\"metadata\"\n playsInline\n muted\n />\n )}\n </div>\n {kind === 'video' && (\n <div className={styles.videoOverlay}>\n <PlayOneIcon theme=\"filled\" className={styles.playIcon} />\n </div>\n )}\n {overlays}\n </div>\n );\n }\n\n // Download and remove share the tile's top-right corner, so an editable tile keeps only Remove.\n const isDownloadable = !!item.downloadUrl && !onRemove && !item.isUploading && !item.error;\n\n const fileCardContent = (\n <>\n <div className={styles.fileCardContent}>\n <FileIcon name={fileName} />\n <div className={styles.fileInfo}>\n <Tooltip title={fileName}>\n <div className={styles.fileName}>{dropExtension(fileName)}</div>\n </Tooltip>\n <div className={styles.fileType}>{getExtension(fileName)}</div>\n </div>\n </div>\n {isDownloadable && (\n <Tooltip title=\"Download\">\n <div className={styles.downloadButton}>\n <ButtonIcon size=\"xs\" type=\"tertiaryBg\" testId=\"attachment-download-button\">\n <DownloadIcon size=\"small\" />\n </ButtonIcon>\n </div>\n </Tooltip>\n )}\n {overlays}\n </>\n );\n\n if (isDownloadable) {\n return (\n <a\n href={item.downloadUrl}\n download={fileName}\n className={classNames(styles.fileCard, styles.fileCardLink)}\n data-testid=\"attachment-download\"\n >\n {fileCardContent}\n </a>\n );\n }\n\n return (\n <div className={classNames(styles.fileCard, !!item.error && styles.thumbnailError)}>\n {fileCardContent}\n </div>\n );\n};\n"],"names":["getExtension","name","_parts$pop","parts","split","length","pop","toUpperCase","stopAndRun","action","event","stopPropagation","TileOverlays","_ref","item","onRemove","onRetry","_jsxs","_Fragment","children","isUploading","_jsx","jsx","className","styles","uploadingOverlay","uploadingSpinner","LoaderCircular","size","loader","error","errorOverlay","Tooltip","title","retryButton","ButtonIcon","type","onClick","id","testId","UndoIcon","classNames","removeButton","removeButtonVisible","CloseSmallIcon","_ref2","_item$kind","src","onItemClick","kind","overlays","fileName","utils","getFileNameWithExtensionFromPath","clickable","thumbnail","thumbnailError","undefined","thumbnailInner","alt","thumbnailImage","includes","concat","preload","playsInline","muted","videoOverlay","PlayOneIcon","theme","playIcon","isDownloadable","downloadUrl","fileCardContent","jsxs","FileIcon","fileInfo","replace","fileType","downloadButton","DownloadIcon","href","download","fileCard","fileCardLink"],"mappings":"k1IAgBMA,EAAe,SAACC,GAAiB,IAAAC,EAC/BC,EAAQF,EAAKG,MAAM,KACzB,OAAOD,EAAME,OAAS,GAAoB,QAAfF,EAAAA,EAAMG,aAAS,IAAAJ,EAAAA,EAAA,IAAIK,cAAgB,EAChE,EAcMC,EAAa,SAACC,GAAkB,OAAK,SAACC,GAC1CA,EAAMC,kBACNF,IACD,EAEKG,EAAe,SAAHC,GAAA,IAAMC,IAAAA,KAAMC,IAAAA,SAAUC,IAAAA,QAAO,OAC7CC,EAAAA,KAAAC,EAAAA,SAAA,CAAAC,SACGL,CAAAA,EAAKM,aACJH,EAAAA,KAAAC,EAAAA,SAAA,CAAAC,SACE,CAAAE,EAAAC,IAAA,MAAA,CAAKC,UAAWC,EAAOC,mBACvBJ,EAAAC,IAAA,MAAA,CAAKC,UAAWC,EAAOE,iBAAiBP,SACtCE,MAACM,iBAAc,CAACC,KAAK,KAAKL,UAAWC,EAAOK,gBAK/Cf,EAAKgB,OACNb,EAAAA,KAAAC,EAAAA,SAAA,CAAAC,SACE,CAAAE,EAAAC,IAAA,MAAA,CAAKC,UAAWC,EAAOO,eACtBf,GACCK,EAAAC,IAACU,UAAO,CAACC,MAAM,eAAcd,SAC3BE,EAAAC,IAAA,MAAA,CAAKC,UAAWC,EAAOU,YAAYf,SACjCE,MAACc,aAAU,CACTP,KAAK,KACLQ,KAAK,aACLC,QAAS7B,GAAW,WAAA,OAAMQ,EAAQF,EAAKwB,OACvCC,OAAO,mBAAkBpB,SAEzBE,MAACmB,WAAQ,CAACZ,KAAK,mBAQ1Bb,IAAaD,EAAKM,aACjBC,EAAAA,IAACW,EAAAA,QAAO,CAACC,MAAM,SAAQd,SACrBE,EAAAC,IAAA,MAAA,CACEC,UAAWkB,EAAAA,QAAWjB,EAAOkB,eAAgB5B,EAAKgB,OAASN,EAAOmB,qBAAqBxB,SAEvFE,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4GfqE,KAAmBxD,EAAKyD,aAAgBxD,GAAaD,EAAKM,aAAgBN,EAAKgB,OAE/E0C,EACJvD,EAAAwD,KAAAvD,WAAA,CAAAC,SACE,CAAAF,EAAAwD,KAAA,MAAA,CAAKlD,UAAWC,EAAOgD,gBAAgBrD,SAAA,CACrCE,MAACqD,WAAQ,CAACzE,KAAMkD,IAChBlC,EAAAwD,KAAA,MAAA,CAAKlD,UAAWC,EAAOmD,SAASxD,SAAA,CAC9BE,MAACW,UAAO,CAACC,MAAOkB,EAAShC,SACvBE,EAAAC,IAAA,MAAA,CAAKC,UAAWC,EAAO2B,SAAShC,UApHrBlB,EAoHqCkD,EApHpBlD,EAAK2E,QAAQ,YAAa,SAsHxDvD,EAAAC,IAAA,MAAA,CAAKC,UAAWC,EAAOqD,SAAS1D,SAAEnB,EAAamD,WAGlDmB,GACCjD,EAAAC,IAACU,UAAO,CAACC,MAAM,WAAUd,SACvBE,EAAAC,IAAA,MAAA,CAAKC,UAAWC,EAAOsD,eAAe3D,SACpCE,MAACc,aAAU,CAACP,KAAK,KAAKQ,KAAK,aAAaG,OAAO,6BAA4BpB,SACzEE,MAAC0D,eAAY,CAACnD,KAAK,gBAK1BsB,KAIL,OAAIoB,EAEAjD,EAAAA,IAAA,IAAA,CACE2D,KAAMlE,EAAKyD,YACXU,SAAU9B,EACV5B,UAAWkB,EAAAA,QAAWjB,EAAO0D,SAAU1D,EAAO2D,cAC9C,cAAY,sBAAqBhE,SAEhCqD,IAMLnD,EAAAA,IAAA,MAAA,CAAKE,UAAWkB,EAAAA,QAAWjB,EAAO0D,WAAYpE,EAAKgB,OAASN,EAAOgC,gBAAgBrC,SAChFqD,GAGP"}
|
|
1
|
+
{"version":3,"file":"AttachmentTile.js","sources":["../../../../src/components/AttachmentPreview/AttachmentTile.tsx"],"sourcesContent":["import { KeyboardEvent, MouseEvent, RefObject, useRef } from 'react';\nimport classNames from 'classnames';\n\nimport { FileIcon } from '../../componentsV2/FileIcon';\nimport { ButtonIcon } from '../../componentsV2/ButtonIcon';\nimport { Tooltip } from '../../componentsV2/Tooltip';\nimport { LoaderCircular } from '../../componentsV2/LoaderCircular';\nimport { PlayOneIcon, CloseSmallIcon, UndoIcon } from '../../icons';\n\nimport { AttachmentActionsMenu } from './AttachmentActionsMenu';\nimport { AttachmentImage } from './AttachmentImage';\nimport { AttachmentDownloadLink } from './AttachmentDownloadLink';\nimport { AttachmentPreviewItem, AttachmentPreviewProps } from './AttachmentPreview.types';\n\nimport styles from './AttachmentPreview.scss';\n\nimport utils from '~/utils/main';\n\nconst getExtension = (name: string) => {\n const parts = name.split('.');\n return parts.length > 1 ? (parts.pop() ?? '').toUpperCase() : '';\n};\n\nconst dropExtension = (name: string) => name.replace(/\\.[^/.]+$/, '');\n\n// A bare <video> paints nothing until a frame is decoded; the media fragment forces one.\nconst withFirstFrame = (src?: string) => (src && !src.includes('#t=') ? `${src}#t=0.1` : src);\n\nexport type AttachmentTileProps = {\n item: AttachmentPreviewItem;\n onRemove?: AttachmentPreviewProps['onRemove'];\n onRetry?: AttachmentPreviewProps['onRetry'];\n onItemClick?: AttachmentPreviewProps['onItemClick'];\n isSelected?: boolean;\n hideActions?: boolean;\n /** Adds \"Share file\" to the tile's hover menu. */\n onShare?: (item: AttachmentPreviewItem) => void;\n};\n\nconst TileActions = ({\n item,\n onShare,\n imageRef,\n}: Pick<AttachmentTileProps, 'item' | 'onShare'> & {\n imageRef?: RefObject<HTMLImageElement>;\n}) => {\n const fileName = utils.getFileNameWithExtensionFromPath(item.name);\n const downloadUrl = item.downloadUrl || item.src;\n\n return (\n <div className={styles.tileActions} data-testid=\"attachment-tile-actions\">\n {!!downloadUrl && (\n <AttachmentDownloadLink\n url={downloadUrl}\n fileName={fileName}\n size=\"xs\"\n className={styles.tileActionLink}\n />\n )}\n\n <AttachmentActionsMenu\n item={item}\n onShare={onShare}\n size=\"xs\"\n testIdPrefix=\"attachment-tile\"\n tooltip=\"More actions\"\n imageRef={imageRef}\n />\n </div>\n );\n};\n\nconst stopAndRun = (action: () => void) => (event: MouseEvent) => {\n event.stopPropagation();\n action();\n};\n\nconst TileOverlays = ({ item, onRemove, onRetry }: Omit<AttachmentTileProps, 'onItemClick'>) => (\n <>\n {item.isUploading && (\n <>\n <div className={styles.uploadingOverlay} />\n <div className={styles.uploadingSpinner}>\n <LoaderCircular size=\"xs\" className={styles.loader} />\n </div>\n </>\n )}\n\n {!!item.error && (\n <>\n <div className={styles.errorOverlay} />\n {onRetry && (\n <Tooltip title=\"Retry upload\">\n <div className={styles.retryButton}>\n <ButtonIcon\n size=\"xs\"\n type=\"tertiaryBg\"\n onClick={stopAndRun(() => onRetry(item.id))}\n testId=\"attachment-retry\"\n >\n <UndoIcon size=\"small\" />\n </ButtonIcon>\n </div>\n </Tooltip>\n )}\n </>\n )}\n\n {onRemove && !item.isUploading && (\n <Tooltip title=\"Remove\">\n <div\n className={classNames(styles.removeButton, !!item.error && styles.removeButtonVisible)}\n >\n <ButtonIcon\n size=\"xs\"\n type=\"tertiaryBg\"\n onClick={stopAndRun(() => onRemove(item.id))}\n testId=\"attachment-remove\"\n >\n <CloseSmallIcon size=\"small\" />\n </ButtonIcon>\n </div>\n </Tooltip>\n )}\n </>\n);\n\nexport const AttachmentTile = ({\n item,\n onRemove,\n onRetry,\n onItemClick,\n isSelected,\n hideActions,\n onShare,\n}: AttachmentTileProps) => {\n const imageRef = useRef<HTMLImageElement>(null);\n const kind = item.kind ?? 'file';\n const overlays = <TileOverlays item={item} onRemove={onRemove} onRetry={onRetry} />;\n const fileName = utils.getFileNameWithExtensionFromPath(item.name);\n const isReady = !item.isUploading && !item.error;\n const clickable = !!onItemClick && isReady;\n // A tile being composed shows Remove in the same corner, and has nothing to link to.\n const showActions = !hideActions && !onRemove && isReady;\n\n if (kind === 'image' || kind === 'video') {\n return (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events\n <div\n className={classNames(\n styles.thumbnail,\n clickable && styles.clickable,\n isSelected && styles.selected,\n !!item.error && styles.thumbnailError\n )}\n onClick={clickable ? () => onItemClick?.(item) : undefined}\n >\n <div className={styles.thumbnailInner}>\n {kind === 'image' ? (\n <AttachmentImage\n ref={imageRef}\n src={item.src}\n alt={fileName}\n className={styles.thumbnailImage}\n />\n ) : (\n <video\n src={withFirstFrame(item.src)}\n className={styles.thumbnailImage}\n preload=\"metadata\"\n playsInline\n muted\n />\n )}\n </div>\n {kind === 'video' && (\n <div className={styles.videoOverlay}>\n <PlayOneIcon theme=\"filled\" className={styles.playIcon} />\n </div>\n )}\n {showActions && <TileActions item={item} onShare={onShare} imageRef={imageRef} />}\n {overlays}\n </div>\n );\n }\n\n const fileCardContent = (\n <>\n <div className={styles.fileCardContent}>\n <FileIcon name={fileName} />\n <div className={styles.fileInfo}>\n <Tooltip title={fileName}>\n <div className={styles.fileName}>{dropExtension(fileName)}</div>\n </Tooltip>\n <div className={styles.fileType}>{getExtension(fileName)}</div>\n </div>\n </div>\n {showActions && <TileActions item={item} onShare={onShare} />}\n {overlays}\n </>\n );\n\n const cardInteraction = clickable\n ? {\n role: 'button',\n tabIndex: 0,\n onClick: () => onItemClick?.(item),\n onKeyDown: (event: KeyboardEvent) => {\n // Keys bubbling from the nested download link must reach it, not open the preview.\n if (event.target !== event.currentTarget) return;\n if (event.key !== 'Enter' && event.key !== ' ') return;\n\n // Space would otherwise scroll the surrounding feed.\n event.preventDefault();\n onItemClick?.(item);\n },\n }\n : {};\n\n return (\n <div\n className={classNames(\n styles.fileCard,\n clickable && styles.fileCardLink,\n isSelected && styles.selected,\n !!item.error && styles.thumbnailError\n )}\n {...cardInteraction}\n >\n {fileCardContent}\n </div>\n );\n};\n"],"names":["getExtension","name","_parts$pop","parts","split","length","pop","toUpperCase","TileActions","_ref","item","onShare","imageRef","fileName","utils","getFileNameWithExtensionFromPath","downloadUrl","src","_jsxs","className","styles","tileActions","children","_jsx","AttachmentDownloadLink","url","size","tileActionLink","AttachmentActionsMenu","testIdPrefix","tooltip","stopAndRun","action","event","stopPropagation","TileOverlays","_ref2","onRemove","onRetry","_Fragment","isUploading","jsx","uploadingOverlay","uploadingSpinner","LoaderCircular","loader","error","errorOverlay","Tooltip","title","retryButton","ButtonIcon","type","onClick","id","testId","UndoIcon","classNames","removeButton","removeButtonVisible","CloseSmallIcon","_ref3","_item$kind","onItemClick","isSelected","hideActions","useRef","kind","overlays","isReady","clickable","showActions","thumbnail","selected","thumbnailError","undefined","thumbnailInner","AttachmentImage","ref","alt","thumbnailImage","includes","concat","preload","playsInline","muted","videoOverlay","PlayOneIcon","theme","playIcon","fileCardContent","jsxs","FileIcon","fileInfo","replace","fileType","cardInteraction","role","tabIndex","onKeyDown","target","currentTarget","key","preventDefault","_objectSpread","fileCard","fileCardLink"],"mappings":"ylKAkBA,IAAMA,EAAe,SAACC,GAAiB,IAAAC,EAC/BC,EAAQF,EAAKG,MAAM,KACzB,OAAOD,EAAME,OAAS,GAAoB,QAAfF,EAAAA,EAAMG,aAAS,IAAAJ,EAAAA,EAAA,IAAIK,cAAgB,EAChE,EAkBMC,EAAc,SAMdC,GAAA,IALJC,IAAAA,KACAC,IAAAA,QACAC,IAAAA,SAIMC,EAAWC,EAAK,QAACC,iCAAiCL,EAAKT,MACvDe,EAAcN,EAAKM,aAAeN,EAAKO,IAE7C,OACEC,EAAAA,KAAA,MAAA,CAAKC,UAAWC,EAAOC,YAAa,cAAY,0BAAyBC,SAAA,GACpEN,GACDO,EAAAA,IAACC,EAAAA,uBAAsB,CACrBC,IAAKT,EACLH,SAAUA,EACVa,KAAK,KACLP,UAAWC,EAAOO,iBAItBJ,MAACK,wBAAqB,CACpBlB,KAAMA,EACNC,QAASA,EACTe,KAAK,KACLG,aAAa,kBACbC,QAAQ,eACRlB,SAAUA,MAIlB,EAEMmB,EAAa,SAACC,GAAkB,OAAK,SAACC,GAC1CA,EAAMC,kBACNF,IACD,EAEKG,EAAe,SAAHC,GAAA,IAAM1B,IAAAA,KAAM2B,IAAAA,SAAUC,IAAAA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AgBpE,SAAA,CACrCC,MAACqE,WAAQ,CAAC3F,KAAMY,IAChBK,EAAAyE,KAAA,MAAA,CAAKxE,UAAWC,EAAOyE,SAASvE,SAAA,CAC9BC,MAACyB,UAAO,CAACC,MAAOpC,EAASS,SACvBC,EAAAkB,IAAA,MAAA,CAAKtB,UAAWC,EAAOP,SAASS,UAzKrBrB,EAyKqCY,EAzKpBZ,EAAK6F,QAAQ,YAAa,SA2KxDvE,EAAAkB,IAAA,MAAA,CAAKtB,UAAWC,EAAO2E,SAASzE,SAAEtB,EAAaa,WAGlD0D,GAAehD,EAAAkB,IAACjC,EAAW,CAACE,KAAMA,EAAMC,QAASA,IACjDyD,KAIC4B,EAAkB1B,EACpB,CACE2B,KAAM,SACNC,SAAU,EACV7C,QAAS,WAAA,OAAMU,eAAAA,EAAcrD,EAAK,EAClCyF,UAAW,SAAClE,GAENA,EAAMmE,SAAWnE,EAAMoE,gBACT,UAAdpE,EAAMqE,KAAiC,MAAdrE,EAAMqE,MAGnCrE,EAAMsE,iBACNxC,SAAAA,EAAcrD,IAChB,GAEF,GAEJ,OACEa,MAAA,MAAAiF,EAAAA,EAAA,CACErF,UAAWsC,EAAU,QACnBrC,EAAOqF,SACPnC,GAAalD,EAAOsF,aACpB1C,GAAc5C,EAAOqD,WACnB/D,EAAKoC,OAAS1B,EAAOsD,iBAErBsB,GAAe,GAAA,CAAA1E,SAElBoE,IAGP"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("@babel/runtime/helpers/slicedToArray"),require("react"),require("../../clients/jsonApi/index.js"),require("file-extension"),require("image-extensions"),require("video-extensions");exports.getIsStoredKey=function(e){return e.includes("/")};
|
|
2
|
+
//# sourceMappingURL=useStoredAttachment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStoredAttachment.js","sources":["../../../../src/components/AttachmentPreview/useStoredAttachment.ts"],"sourcesContent":["import useSignedURL from '../../effects/useSignedURL';\n\nimport type { AttachmentPreviewItem } from './AttachmentPreview.types';\nimport { getAttachmentKind } from './getAttachmentKind';\n\nexport type StoredAttachment = {\n name: string;\n url: string;\n /** Bytes, as recorded at upload time. */\n size?: number;\n};\n\n/**\n * One of ours is stored under an S3 key, which is a path. An attachment that was linked rather\n * than uploaded keeps a bare file name and a url that already works, so signing it would only\n * produce a link to an object that was never there.\n */\nexport const getIsStoredKey = (name: string): boolean => name.includes('/');\n\nexport const useStoredAttachment = (\n attachment?: StoredAttachment | null\n): AttachmentPreviewItem | null => {\n const kind = attachment ? getAttachmentKind(attachment) : undefined;\n const key = attachment && getIsStoredKey(attachment.name) ? attachment.name : '';\n const signed = useSignedURL(key, 'inline');\n // `download` is ignored cross-origin, so only an attachment-disposition link saves.\n const downloadUrl = useSignedURL(key, 'attachment');\n const src = key ? signed : attachment?.url;\n\n if (!attachment || !src) return null;\n\n return {\n id: attachment.url,\n name: attachment.name,\n src,\n kind,\n size: attachment.size,\n downloadUrl: downloadUrl || undefined,\n };\n};\n"],"names":["name","includes"],"mappings":"wRAiB8B,SAACA,GAAY,OAAcA,EAAKC,SAAS,IAAI"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/slicedToArray"),t=require("@babel/runtime/helpers/asyncToGenerator"),n=require("@babel/runtime/regenerator"),u=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/slicedToArray"),t=require("@babel/runtime/helpers/asyncToGenerator"),n=require("@babel/runtime/regenerator"),u=require("react"),c=require("./getAttachmentKind.js"),a=require("./useStoredAttachment.js"),i=require("../../clients/jsonApi/index.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=o(e),f=o(r),l=o(t),p=o(n);function d(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function b(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?d(Object(t),!0).forEach((function(r){s.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):d(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var m=function(){var e=l.default(p.default.mark((function e(r,t){var n,u;return p.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,i.getS3DownloadLink(r,t);case 3:return n=e.sent,u=n.url,e.abrupt("return",u);case 8:return e.prev=8,e.t0=e.catch(0),console.error('Failed to sign attachment "'.concat(r,'"'),e.t0),e.abrupt("return","");case 12:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(r,t){return e.apply(this,arguments)}}();exports.useStoredAttachments=function(e){var r=u.useState({}),t=f.default(r,2),n=t[0],i=t[1],o=u.useRef(n);o.current=n;var l=u.useMemo((function(){return null!=e?e:[]}),[e]),p=l.map((function(e){return e.name})).join("|");return u.useEffect((function(){var e=l.filter((function(e){return!(e.name in o.current)}));if(e.length){var r=!0,t=function(e,r){return i((function(t){return b(b({},t),{},s.default({},e,b(b({},t[e]),r)))}))};return i((function(r){var t=b({},r);return e.forEach((function(e){var r;t[e.name]=null!==(r=t[e.name])&&void 0!==r?r:{}})),t})),e.forEach((function(e){a.getIsStoredKey(e.name)?m(e.name,"inline").then((function(n){r&&n&&t(e.name,{src:n})})):t(e.name,{src:e.url})})),function(){r=!1}}}),[p]),l.reduce((function(e,r){var t=n[r.name];return null!=t&&t.src?(e.push({id:r.url,name:r.name,src:t.src,kind:c.getAttachmentKind(r),size:r.size}),e):e}),[])};
|
|
2
2
|
//# sourceMappingURL=useStoredAttachments.js.map
|