@corva/ui 3.82.0-0 → 3.82.0-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs-bundle/components/CommentComposer/CommentComposer.js +1 -1
- package/cjs-bundle/components/CommentComposer/CommentComposer.js.map +1 -1
- package/cjs-bundle/components/CommentInputNext/CommentInputNext.scss.js +1 -1
- package/cjs-bundle/componentsV2/ImageViewer/GalleryImageStatus.js +2 -0
- package/cjs-bundle/componentsV2/ImageViewer/GalleryImageStatus.js.map +1 -0
- package/cjs-bundle/componentsV2/ImageViewer/GalleryImageViewer.js +2 -0
- package/cjs-bundle/componentsV2/ImageViewer/GalleryImageViewer.js.map +1 -0
- package/cjs-bundle/componentsV2/ImageViewer/GalleryToolbar.js +2 -0
- package/cjs-bundle/componentsV2/ImageViewer/GalleryToolbar.js.map +1 -0
- package/cjs-bundle/componentsV2/ImageViewer/GalleryViewer.scss.js +2 -0
- package/cjs-bundle/componentsV2/ImageViewer/GalleryViewer.scss.js.map +1 -0
- package/cjs-bundle/componentsV2/ImageViewer/ImageViewer.js +1 -1
- package/cjs-bundle/componentsV2/ImageViewer/ImageViewer.js.map +1 -1
- package/cjs-bundle/componentsV2/ImageViewer/legacyWheel.js +2 -0
- package/cjs-bundle/componentsV2/ImageViewer/legacyWheel.js.map +1 -0
- package/cjs-bundle/componentsV2/ImageViewer/legacyZoom.js +2 -0
- package/cjs-bundle/componentsV2/ImageViewer/legacyZoom.js.map +1 -0
- package/cjs-bundle/componentsV2/ImageViewer/logicalSlides.js +2 -0
- package/cjs-bundle/componentsV2/ImageViewer/logicalSlides.js.map +1 -0
- package/cjs-bundle/componentsV2/ImageViewer/registerLegacyLifecycle.js +2 -0
- package/cjs-bundle/componentsV2/ImageViewer/registerLegacyLifecycle.js.map +1 -0
- package/cjs-bundle/componentsV2/ImageViewer/registerLegacyToolbar.js +2 -0
- package/cjs-bundle/componentsV2/ImageViewer/registerLegacyToolbar.js.map +1 -0
- package/cjs-bundle/componentsV2/ImageViewer/registerLegacyWheel.js +2 -0
- package/cjs-bundle/componentsV2/ImageViewer/registerLegacyWheel.js.map +1 -0
- package/cjs-bundle/componentsV2/ImageViewer/registerSourceToolbar.js +2 -0
- package/cjs-bundle/componentsV2/ImageViewer/registerSourceToolbar.js.map +1 -0
- package/cjs-bundle/componentsV2/ImageViewer/registerViewerWindow.js +2 -0
- package/cjs-bundle/componentsV2/ImageViewer/registerViewerWindow.js.map +1 -0
- package/cjs-bundle/componentsV2/ImageViewer/useImageDimensions.js +2 -0
- package/cjs-bundle/componentsV2/ImageViewer/useImageDimensions.js.map +1 -0
- package/components/CommentComposer/CommentComposer.d.ts +7 -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/__tests__/CommentComposer.trailing.test.d.ts +2 -0
- package/components/CommentComposer/__tests__/CommentComposer.trailing.test.d.ts.map +1 -0
- package/components/CommentInputNext/CommentInputNext.scss.js +1 -1
- package/componentsV2/ImageViewer/GalleryImageStatus.d.ts +8 -0
- package/componentsV2/ImageViewer/GalleryImageStatus.d.ts.map +1 -0
- package/componentsV2/ImageViewer/GalleryImageStatus.js +2 -0
- package/componentsV2/ImageViewer/GalleryImageStatus.js.map +1 -0
- package/componentsV2/ImageViewer/GalleryImageViewer.d.ts +6 -0
- package/componentsV2/ImageViewer/GalleryImageViewer.d.ts.map +1 -0
- package/componentsV2/ImageViewer/GalleryImageViewer.js +2 -0
- package/componentsV2/ImageViewer/GalleryImageViewer.js.map +1 -0
- package/componentsV2/ImageViewer/GalleryToolbar.d.ts +7 -0
- package/componentsV2/ImageViewer/GalleryToolbar.d.ts.map +1 -0
- package/componentsV2/ImageViewer/GalleryToolbar.js +2 -0
- package/componentsV2/ImageViewer/GalleryToolbar.js.map +1 -0
- package/componentsV2/ImageViewer/GalleryViewer.scss.js +2 -0
- package/componentsV2/ImageViewer/GalleryViewer.scss.js.map +1 -0
- package/componentsV2/ImageViewer/ImageViewer.d.ts +3 -9
- package/componentsV2/ImageViewer/ImageViewer.d.ts.map +1 -1
- package/componentsV2/ImageViewer/ImageViewer.js +1 -1
- package/componentsV2/ImageViewer/ImageViewer.js.map +1 -1
- package/componentsV2/ImageViewer/ImageViewer.stories.d.ts +11 -0
- package/componentsV2/ImageViewer/ImageViewer.stories.d.ts.map +1 -0
- package/componentsV2/ImageViewer/__tests__/ImageViewerGallery.test.d.ts +2 -0
- package/componentsV2/ImageViewer/__tests__/ImageViewerGallery.test.d.ts.map +1 -0
- package/componentsV2/ImageViewer/__tests__/ImageViewerIsolation.test.d.ts +2 -0
- package/componentsV2/ImageViewer/__tests__/ImageViewerIsolation.test.d.ts.map +1 -0
- package/componentsV2/ImageViewer/__tests__/ImageViewerLegacy.test.d.ts +2 -0
- package/componentsV2/ImageViewer/__tests__/ImageViewerLegacy.test.d.ts.map +1 -0
- package/componentsV2/ImageViewer/__tests__/ImageViewerLoading.test.d.ts +2 -0
- package/componentsV2/ImageViewer/__tests__/ImageViewerLoading.test.d.ts.map +1 -0
- package/componentsV2/ImageViewer/__tests__/ImageViewerNested.test.d.ts +2 -0
- package/componentsV2/ImageViewer/__tests__/ImageViewerNested.test.d.ts.map +1 -0
- package/componentsV2/ImageViewer/__tests__/fixtures.d.ts +8 -0
- package/componentsV2/ImageViewer/__tests__/fixtures.d.ts.map +1 -0
- package/componentsV2/ImageViewer/legacyWheel.d.ts +22 -0
- package/componentsV2/ImageViewer/legacyWheel.d.ts.map +1 -0
- package/componentsV2/ImageViewer/legacyWheel.js +2 -0
- package/componentsV2/ImageViewer/legacyWheel.js.map +1 -0
- package/componentsV2/ImageViewer/legacyZoom.d.ts +6 -0
- package/componentsV2/ImageViewer/legacyZoom.d.ts.map +1 -0
- package/componentsV2/ImageViewer/legacyZoom.js +2 -0
- package/componentsV2/ImageViewer/legacyZoom.js.map +1 -0
- package/componentsV2/ImageViewer/logicalSlides.d.ts +4 -0
- package/componentsV2/ImageViewer/logicalSlides.d.ts.map +1 -0
- package/componentsV2/ImageViewer/logicalSlides.js +2 -0
- package/componentsV2/ImageViewer/logicalSlides.js.map +1 -0
- package/componentsV2/ImageViewer/registerLegacyLifecycle.d.ts +7 -0
- package/componentsV2/ImageViewer/registerLegacyLifecycle.d.ts.map +1 -0
- package/componentsV2/ImageViewer/registerLegacyLifecycle.js +2 -0
- package/componentsV2/ImageViewer/registerLegacyLifecycle.js.map +1 -0
- package/componentsV2/ImageViewer/registerLegacyToolbar.d.ts +3 -0
- package/componentsV2/ImageViewer/registerLegacyToolbar.d.ts.map +1 -0
- package/componentsV2/ImageViewer/registerLegacyToolbar.js +2 -0
- package/componentsV2/ImageViewer/registerLegacyToolbar.js.map +1 -0
- package/componentsV2/ImageViewer/registerLegacyWheel.d.ts +3 -0
- package/componentsV2/ImageViewer/registerLegacyWheel.d.ts.map +1 -0
- package/componentsV2/ImageViewer/registerLegacyWheel.js +2 -0
- package/componentsV2/ImageViewer/registerLegacyWheel.js.map +1 -0
- package/componentsV2/ImageViewer/registerSourceToolbar.d.ts +3 -0
- package/componentsV2/ImageViewer/registerSourceToolbar.d.ts.map +1 -0
- package/componentsV2/ImageViewer/registerSourceToolbar.js +2 -0
- package/componentsV2/ImageViewer/registerSourceToolbar.js.map +1 -0
- package/componentsV2/ImageViewer/registerViewerWindow.d.ts +4 -0
- package/componentsV2/ImageViewer/registerViewerWindow.d.ts.map +1 -0
- package/componentsV2/ImageViewer/registerViewerWindow.js +2 -0
- package/componentsV2/ImageViewer/registerViewerWindow.js.map +1 -0
- package/componentsV2/ImageViewer/types.d.ts +31 -0
- package/componentsV2/ImageViewer/types.d.ts.map +1 -0
- package/componentsV2/ImageViewer/useImageDimensions.d.ts +6 -0
- package/componentsV2/ImageViewer/useImageDimensions.d.ts.map +1 -0
- package/componentsV2/ImageViewer/useImageDimensions.js +2 -0
- package/componentsV2/ImageViewer/useImageDimensions.js.map +1 -0
- package/mcp-server/server.mjs +8 -3
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),s=require("@babel/runtime/helpers/slicedToArray"),o=require("react"),n=require("@material-ui/core"),i=require("@material-ui/icons/AlternateEmail"),c=require("../../componentsV2/ButtonIcon/ButtonIcon.js"),r=require("../../componentsV2/Tooltip/Tooltip.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/InfoRounded.js"),require("../../icons/customIcons/icons/FlameFilled.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/PinOne.js"),require("../../icons/customIcons/icons/PinOneCrossed.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("../Avatar/index.js"),a=require("../AttachFileButton/AttachFileButton.js"),l=require("../CommentInputNext/CommentInputNext.js"),m=require("../EmojiIconButton.js"),d=require("../FailedFileUploading.js"),j=require("../UserMention/index.js"),p=require("../UserMention/utils/index.js"),q=require("../WellhubFilePicker/WellhubFilePicker.js");require("@babel/runtime/helpers/toConsumableArray"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/regenerator"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment"),require("../../clients/jsonApi/index.js"),require("../../clients/subscriptions/subscriptions-client.factory.js"),require("../../clients/api/apiCore.js"),require("../../clients/constants.js"),require("../../clients/sso/auth0.js"),require("../../clients/sso/oauth2.js"),require("../../clients/api/rateLimiter.js"),require("uuid");var h=require("./useAttachmentUpload.js"),I=require("./CommentMetaLine.js"),b=require("./ShareToChatRow.js"),g=require("./CommentComposer.scss.js"),f=require("react/jsx-runtime");function C(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var v=C(e),F=C(s),x=C(i);function y(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 O(e){for(var s=1;s<arguments.length;s++){var o=null!=arguments[s]?arguments[s]:{};s%2?y(Object(o),!0).forEach((function(s){v.default(e,s,o[s])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):y(Object(o)).forEach((function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(o,s))}))}return e}var A={fontSize:14,lineHeight:"20px",suggestions:{backgroundColor:"var(--palette-background-b-9)",list:{backgroundColor:"var(--palette-background-b-9)"},item:{color:"var(--palette-primary-text-1)","&focused":{backgroundColor:"rgb(from var(--palette-primary-text-1) r g b / 0.08)"}}}},S=function(e){return f.jsxs("div",{className:g.suggestion,children:[f.jsx(u.AvatarComponent,{size:26,alt:e.display,imgSrc:e.photo,displayName:e.display}),f.jsx("span",{children:e.display})]})};exports.CommentComposer=function(e){var s=e.body,i=e.onBodyChange,u=e.onSubmit,C=e.canSubmit,v=e.currentUser,y=e.attachments,P=e.onAttachmentsChange,k=e.maxAttachments,E=void 0===k?h.DEFAULT_MAX_ATTACHMENTS:k,M=e.attachment,w=e.onAttachmentChange,D=e.attachmentError,R=e.onAttachmentError,T=e.maxAttachmentSizeBytes,U=e.wellhubContext,L=e.disabled,B=e.autoFocus,N=e.placeholder,z=void 0===N?"Add a comment...":N,W=e.metaRows,G=e.isMetaSingleLine,_=e.shareToChat,H=e.trailing,K=e.embedded,V=e.className,Q=e.testId,X=!!P,Z=o.useMemo((function(){return X?null!=y?y:[]:[M].filter(Boolean)}),[X,y,M]),$=o.useCallback((function(e){var s;P?P(e):null==w||w(null!==(s=e[0])&&void 0!==s?s:null)}),[P,w]),J=h.useAttachmentUpload({value:Z,onChange:$,onError:R,maxSizeBytes:T,maxFiles:X?E:1}),Y=C&&!J.isUploading,ee=o.useState(!1),se=F.default(ee,2),oe=se[0],ne=se[1],ie=o.useMemo((function(){return Z.map((function(e){return e.name}))}),[Z]),ce=o.useRef(null);return f.jsxs(f.Fragment,{children:[f.jsx(l.CommentInput,{value:s,canSubmit:Y,disabled:L,onSubmit:u,trailing:H,embedded:K,className:V,testId:Q,field:f.jsx(n.Input,{inputComponent:j,inputProps:{onChange:i,currentUser:v,allowEmptyQuery:!0,suggestionsPortalHost:document.querySelector("body"),withLightTheme:!1,mentionProps:{renderSuggestion:S},highlightLinks:!0,style:A},value:s,placeholder:z,inputRef:ce,className:g.mentionField,onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||Y&&!L&&(p.isSuggestionsListOpened()||(e.preventDefault(),u()))},disableUnderline:!0,rows:1,fullWidth:!0,multiline:!0,autoFocus:B}),attachments:J.items,onAttachmentRemove:J.removeAttachment,onAttachmentRetry:J.handleRetry,onAttachmentReorder:X?J.reorderAttachments:void 0,onFilesDrop:J.addFiles,onImageLinkPaste:J.addLinkedImage,dropLabel:1===J.maxFiles?"Drop a file here":"Drop files here",attachmentSlot:D?f.jsx(d,{errorMessage:D}):void 0,toolbar:f.jsxs(f.Fragment,{children:[f.jsx(a.AttachFileButton,{inputRef:J.fileInputRef,onClick:J.openFileDialog,onFileSelect:J.handleFileSelect,onWellhubSelect:U?function(){return ne(!0)}:void 0,multiple:X,disabled:J.isFull,tooltip:J.isFull?"Up to ".concat(J.maxFiles," ").concat(1===J.maxFiles?"file":"files"," can be attached"):"Attach ".concat(X?"files":"file")}),f.jsx(r.Tooltip,{title:"Mention someone",children:f.jsx(c.ButtonIcon,{size:"xs",type:"tertiary",onClick:function(){var e,s=ce.current;if(s){s.focus();var o=!!s.value&&!/\s$/.test(s.value),n="".concat(s.value).concat(o?" @":"@"),i=null===(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(s),"value"))||void 0===e?void 0:e.set;null==i||i.call(s,n),s.setSelectionRange(n.length,n.length),s.dispatchEvent(new Event("input",{bubbles:!0})),s.dispatchEvent(new Event("keyup",{bubbles:!0}))}},children:f.jsx(x.default,{fontSize:"inherit"})})}),f.jsx("span",{className:g.iconSlot,children:f.jsx(m,{icon:f.jsx(t.SmilingFaceIcon,{size:16}),handleSelectEmoji:function(e){return i("".concat(s).concat(e.native))}})})]}),footer:(!(null==W||!W.length)||!!_)&&f.jsxs(f.Fragment,{children:[f.jsx(I.CommentMetaLine,{rows:null!=W?W:[],singleLine:G}),_&&f.jsx(b.ShareToChatRow,O({},_))]})}),U&&f.jsx(q.WellhubFilePicker,O(O({},U),{},{open:oe,maxSelectable:J.maxFiles-J.count,attachedFileNames:ie,onAdd:function(e){ne(!1),J.addStoredFiles(e.map((function(e){return{fileName:e.fileName}})))},onClose:function(){return ne(!1)}}))]})};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),s=require("@babel/runtime/helpers/slicedToArray"),o=require("react"),n=require("@material-ui/core"),i=require("@material-ui/icons/AlternateEmail"),c=require("../../componentsV2/ButtonIcon/ButtonIcon.js"),r=require("../../componentsV2/Tooltip/Tooltip.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/InfoRounded.js"),require("../../icons/customIcons/icons/FlameFilled.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/PinOne.js"),require("../../icons/customIcons/icons/PinOneCrossed.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("../Avatar/index.js"),a=require("../AttachFileButton/AttachFileButton.js"),l=require("../CommentInputNext/CommentInputNext.js"),m=require("../EmojiIconButton.js"),d=require("../FailedFileUploading.js"),j=require("../UserMention/index.js"),p=require("../UserMention/utils/index.js"),q=require("../WellhubFilePicker/WellhubFilePicker.js");require("@babel/runtime/helpers/toConsumableArray"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/regenerator"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment"),require("../../clients/jsonApi/index.js"),require("../../clients/subscriptions/subscriptions-client.factory.js"),require("../../clients/api/apiCore.js"),require("../../clients/constants.js"),require("../../clients/sso/auth0.js"),require("../../clients/sso/oauth2.js"),require("../../clients/api/rateLimiter.js"),require("uuid");var h=require("./useAttachmentUpload.js"),I=require("./CommentMetaLine.js"),b=require("./ShareToChatRow.js"),g=require("./CommentComposer.scss.js"),f=require("react/jsx-runtime");function C(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var v=C(e),F=C(s),x=C(i);function y(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 O(e){for(var s=1;s<arguments.length;s++){var o=null!=arguments[s]?arguments[s]:{};s%2?y(Object(o),!0).forEach((function(s){v.default(e,s,o[s])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):y(Object(o)).forEach((function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(o,s))}))}return e}var A={fontSize:14,lineHeight:"20px",suggestions:{backgroundColor:"var(--palette-background-b-9)",list:{backgroundColor:"var(--palette-background-b-9)"},item:{color:"var(--palette-primary-text-1)","&focused":{backgroundColor:"rgb(from var(--palette-primary-text-1) r g b / 0.08)"}}}},S=function(e){return f.jsxs("div",{className:g.suggestion,children:[f.jsx(u.AvatarComponent,{size:26,alt:e.display,imgSrc:e.photo,displayName:e.display}),f.jsx("span",{children:e.display})]})};exports.CommentComposer=function(e){var s=e.body,i=e.onBodyChange,u=e.onSubmit,C=e.canSubmit,v=e.currentUser,y=e.attachments,P=e.onAttachmentsChange,k=e.maxAttachments,E=void 0===k?h.DEFAULT_MAX_ATTACHMENTS:k,M=e.attachment,w=e.onAttachmentChange,D=e.attachmentError,R=e.onAttachmentError,T=e.maxAttachmentSizeBytes,U=e.wellhubContext,L=e.disabled,B=e.autoFocus,N=e.placeholder,z=void 0===N?"Add a comment...":N,W=e.metaRows,G=e.isMetaSingleLine,_=e.shareToChat,H=e.trailing,K=e.renderTrailing,V=e.embedded,Q=e.className,X=e.testId,Z=!!P,$=o.useMemo((function(){return Z?null!=y?y:[]:[M].filter(Boolean)}),[Z,y,M]),J=o.useCallback((function(e){var s;P?P(e):null==w||w(null!==(s=e[0])&&void 0!==s?s:null)}),[P,w]),Y=h.useAttachmentUpload({value:$,onChange:J,onError:R,maxSizeBytes:T,maxFiles:Z?E:1}),ee=C&&!Y.isUploading,se=function(){ee&&!L&&u()},oe=o.useState(!1),ne=F.default(oe,2),ie=ne[0],ce=ne[1],re=o.useMemo((function(){return $.map((function(e){return e.name}))}),[$]),te=o.useRef(null);return f.jsxs(f.Fragment,{children:[f.jsx(l.CommentInput,{value:s,canSubmit:ee,disabled:L,onSubmit:u,trailing:K?K({canSend:ee&&!L,submit:se}):H,embedded:V,className:Q,testId:X,field:f.jsx(n.Input,{inputComponent:j,inputProps:{onChange:i,currentUser:v,allowEmptyQuery:!0,suggestionsPortalHost:document.querySelector("body"),withLightTheme:!1,mentionProps:{renderSuggestion:S},highlightLinks:!0,style:A},value:s,placeholder:z,inputRef:te,className:g.mentionField,onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||ee&&!L&&(p.isSuggestionsListOpened()||(e.preventDefault(),se()))},disableUnderline:!0,rows:1,fullWidth:!0,multiline:!0,autoFocus:B}),attachments:Y.items,onAttachmentRemove:Y.removeAttachment,onAttachmentRetry:Y.handleRetry,onAttachmentReorder:Z?Y.reorderAttachments:void 0,onFilesDrop:Y.addFiles,onImageLinkPaste:Y.addLinkedImage,dropLabel:1===Y.maxFiles?"Drop a file here":"Drop files here",attachmentSlot:D?f.jsx(d,{errorMessage:D}):void 0,toolbar:f.jsxs(f.Fragment,{children:[f.jsx(a.AttachFileButton,{inputRef:Y.fileInputRef,onClick:Y.openFileDialog,onFileSelect:Y.handleFileSelect,onWellhubSelect:U?function(){return ce(!0)}:void 0,multiple:Z,disabled:Y.isFull,tooltip:Y.isFull?"Up to ".concat(Y.maxFiles," ").concat(1===Y.maxFiles?"file":"files"," can be attached"):"Attach ".concat(Z?"files":"file")}),f.jsx(r.Tooltip,{title:"Mention someone",children:f.jsx(c.ButtonIcon,{size:"xs",type:"tertiary",onClick:function(){var e,s=te.current;if(s){s.focus();var o=!!s.value&&!/\s$/.test(s.value),n="".concat(s.value).concat(o?" @":"@"),i=null===(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(s),"value"))||void 0===e?void 0:e.set;null==i||i.call(s,n),s.setSelectionRange(n.length,n.length),s.dispatchEvent(new Event("input",{bubbles:!0})),s.dispatchEvent(new Event("keyup",{bubbles:!0}))}},children:f.jsx(x.default,{fontSize:"inherit"})})}),f.jsx("span",{className:g.iconSlot,children:f.jsx(m,{icon:f.jsx(t.SmilingFaceIcon,{size:16}),handleSelectEmoji:function(e){return i("".concat(s).concat(e.native))}})})]}),footer:(!(null==W||!W.length)||!!_)&&f.jsxs(f.Fragment,{children:[f.jsx(I.CommentMetaLine,{rows:null!=W?W:[],singleLine:G}),_&&f.jsx(b.ShareToChatRow,O({},_))]})}),U&&f.jsx(q.WellhubFilePicker,O(O({},U),{},{open:ie,maxSelectable:Y.maxFiles-Y.count,attachedFileNames:re,onAdd:function(e){ce(!1),Y.addStoredFiles(e.map((function(e){return{fileName:e.fileName}})))},onClose:function(){return ce(!1)}}))]})};
|
|
2
2
|
//# sourceMappingURL=CommentComposer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommentComposer.js","sources":["../../../../src/components/CommentComposer/CommentComposer.tsx"],"sourcesContent":["import {\n CSSProperties,\n FormEventHandler,\n KeyboardEvent,\n ReactNode,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { Input } from '@material-ui/core';\nimport AlternateEmailIcon from '@material-ui/icons/AlternateEmail';\n\nimport { ButtonIcon } from '../../componentsV2/ButtonIcon';\nimport { Tooltip } from '../../componentsV2/Tooltip';\nimport { SmilingFaceIcon } from '../../icons';\nimport Avatar from '../Avatar';\nimport { AttachFileButton } from '../AttachFileButton';\nimport { CommentInput } from '../CommentInputNext/CommentInputNext';\nimport EmojiIconButton from '../EmojiIconButton';\nimport FailedFileUploading from '../FailedFileUploading';\nimport UserMention from '../UserMention';\nimport { isSuggestionsListOpened } from '../UserMention/utils';\nimport { WellhubFilePicker } from '../WellhubFilePicker';\nimport type { WellhubContext, WellhubFile } from '../WellhubFilePicker';\n\nimport {\n useAttachmentUpload,\n UploadedAttachment,\n DEFAULT_MAX_ATTACHMENTS,\n} from './useAttachmentUpload';\nimport { CommentMetaLine, CommentMetaRow } from './CommentMetaLine';\nimport { ShareToChatRow, ShareToChatRowProps } from './ShareToChatRow';\n\nimport styles from './CommentComposer.scss';\n\n/* eslint-disable camelcase -- mirrors the platform's snake_case user payload. */\nexport type CommentComposerUser = {\n id?: number;\n company_id?: number;\n first_name?: string;\n last_name?: string;\n profile_photo?: string;\n [key: string]: unknown;\n};\n/* eslint-enable camelcase */\n\nexport type CommentComposerProps = {\n body: string;\n onBodyChange: (value: string) => void;\n onSubmit: () => void;\n canSubmit: boolean;\n currentUser: CommentComposerUser;\n\n attachments?: UploadedAttachment[];\n onAttachmentsChange?: (attachments: UploadedAttachment[]) => void;\n maxAttachments?: number;\n /** @deprecated Use `attachments` — kept so single-attachment callers keep working. */\n attachment?: UploadedAttachment | null;\n /** @deprecated Use `onAttachmentsChange`. */\n onAttachmentChange?: (attachment: UploadedAttachment | null) => void;\n attachmentError?: string | null;\n onAttachmentError?: (message: string | null) => void;\n maxAttachmentSizeBytes?: number;\n wellhubContext?: WellhubContext;\n\n disabled?: boolean;\n autoFocus?: boolean;\n placeholder?: string;\n metaRows?: CommentMetaRow[];\n isMetaSingleLine?: boolean;\n shareToChat?: Omit<ShareToChatRowProps, 'testId'>;\n /** Replaces the default send button, e.g. the edit form's Cancel/Save. */\n trailing?: ReactNode;\n /** Render flush inside a host card instead of as its own surface. */\n embedded?: boolean;\n className?: string;\n testId?: string;\n};\n\nconst SUGGESTIONS_BACKGROUND = 'var(--palette-background-b-9)';\n\n// Module-level so react-mentions isn't re-rendered on every keystroke.\nconst MENTION_INPUT_STYLE = {\n fontSize: 14,\n lineHeight: '20px',\n suggestions: {\n backgroundColor: SUGGESTIONS_BACKGROUND,\n list: { backgroundColor: SUGGESTIONS_BACKGROUND },\n item: {\n color: 'var(--palette-primary-text-1)',\n '&focused': { backgroundColor: 'rgb(from var(--palette-primary-text-1) r g b / 0.08)' },\n },\n },\n} as unknown as CSSProperties;\n\nconst renderSuggestion = (entry: { display: string; photo?: string }) => (\n <div className={styles.suggestion}>\n <Avatar size={26} alt={entry.display} imgSrc={entry.photo} displayName={entry.display} />\n <span>{entry.display}</span>\n </div>\n);\n\nexport const CommentComposer = ({\n body,\n onBodyChange,\n onSubmit,\n canSubmit,\n currentUser,\n attachments,\n onAttachmentsChange,\n maxAttachments = DEFAULT_MAX_ATTACHMENTS,\n attachment,\n onAttachmentChange,\n attachmentError,\n onAttachmentError,\n maxAttachmentSizeBytes,\n wellhubContext,\n disabled,\n autoFocus,\n placeholder = 'Add a comment...',\n metaRows,\n isMetaSingleLine,\n shareToChat,\n trailing,\n embedded,\n className,\n testId,\n}: CommentComposerProps) => {\n // Callers still on the singular props get the old one-file behaviour, unchanged.\n const isMulti = !!onAttachmentsChange;\n const value = useMemo(\n () => (isMulti ? attachments ?? [] : ([attachment].filter(Boolean) as UploadedAttachment[])),\n [isMulti, attachments, attachment]\n );\n\n const handleAttachmentsChange = useCallback(\n (next: UploadedAttachment[]) => {\n if (onAttachmentsChange) onAttachmentsChange(next);\n else onAttachmentChange?.(next[0] ?? null);\n },\n [onAttachmentsChange, onAttachmentChange]\n );\n\n const upload = useAttachmentUpload({\n value,\n onChange: handleAttachmentsChange,\n onError: onAttachmentError,\n maxSizeBytes: maxAttachmentSizeBytes,\n maxFiles: isMulti ? maxAttachments : 1,\n });\n\n // An attachment only lands once S3 confirms, so posting mid-upload would drop it.\n const canSend = canSubmit && !upload.isUploading;\n\n const [isWellhubOpen, setIsWellhubOpen] = useState(false);\n const attachedKeys = useMemo(() => value.map(item => item.name), [value]);\n\n const addWellhubFiles = (files: WellhubFile[]) => {\n setIsWellhubOpen(false);\n upload.addStoredFiles(files.map(file => ({ fileName: file.fileName })));\n };\n\n const fieldRef = useRef<HTMLTextAreaElement | null>(null);\n\n // react-mentions opens suggestions from textarea events, so type \"@\" instead of setting state.\n const mentionSomeone = () => {\n const field = fieldRef.current;\n if (!field) return;\n\n field.focus();\n\n const needsSpace = !!field.value && !/\\s$/.test(field.value);\n const nextValue = `${field.value}${needsSpace ? ' @' : '@'}`;\n const setValue = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(field), 'value')?.set;\n\n setValue?.call(field, nextValue);\n field.setSelectionRange(nextValue.length, nextValue.length);\n field.dispatchEvent(new Event('input', { bubbles: true }));\n field.dispatchEvent(new Event('keyup', { bubbles: true }));\n };\n\n const handleEnterKey = (event: KeyboardEvent) => {\n if (event.key !== 'Enter' || event.shiftKey) return;\n if (!canSend || disabled) return;\n if (isSuggestionsListOpened()) return;\n\n event.preventDefault();\n onSubmit();\n };\n\n return (\n <>\n <CommentInput\n value={body}\n canSubmit={canSend}\n disabled={disabled}\n onSubmit={onSubmit}\n trailing={trailing}\n embedded={embedded}\n className={className}\n testId={testId}\n field={\n <Input\n inputComponent={UserMention}\n inputProps={{\n // UserMention calls onChange with the text string, not a DOM event.\n onChange: onBodyChange as unknown as FormEventHandler<HTMLInputElement>,\n currentUser,\n allowEmptyQuery: true,\n suggestionsPortalHost: document.querySelector('body'),\n withLightTheme: false,\n mentionProps: { renderSuggestion },\n highlightLinks: true,\n style: MENTION_INPUT_STYLE,\n }}\n value={body}\n placeholder={placeholder}\n inputRef={fieldRef}\n className={styles.mentionField}\n onKeyDown={handleEnterKey}\n disableUnderline\n rows={1}\n fullWidth\n multiline\n autoFocus={autoFocus}\n />\n }\n attachments={upload.items}\n onAttachmentRemove={upload.removeAttachment}\n onAttachmentRetry={upload.handleRetry}\n onAttachmentReorder={isMulti ? upload.reorderAttachments : undefined}\n onFilesDrop={upload.addFiles}\n onImageLinkPaste={upload.addLinkedImage}\n dropLabel={upload.maxFiles === 1 ? 'Drop a file here' : 'Drop files here'}\n attachmentSlot={\n attachmentError ? <FailedFileUploading errorMessage={attachmentError} /> : undefined\n }\n toolbar={\n <>\n <AttachFileButton\n inputRef={upload.fileInputRef}\n onClick={upload.openFileDialog}\n onFileSelect={upload.handleFileSelect}\n onWellhubSelect={wellhubContext ? () => setIsWellhubOpen(true) : undefined}\n multiple={isMulti}\n disabled={upload.isFull}\n tooltip={\n upload.isFull\n ? `Up to ${upload.maxFiles} ${\n upload.maxFiles === 1 ? 'file' : 'files'\n } can be attached`\n : `Attach ${isMulti ? 'files' : 'file'}`\n }\n />\n <Tooltip title=\"Mention someone\">\n <ButtonIcon size=\"xs\" type=\"tertiary\" onClick={mentionSomeone}>\n <AlternateEmailIcon fontSize=\"inherit\" />\n </ButtonIcon>\n </Tooltip>\n <span className={styles.iconSlot}>\n <EmojiIconButton\n icon={<SmilingFaceIcon size={16} />}\n handleSelectEmoji={(emoji: { native: string }) =>\n onBodyChange(`${body}${emoji.native}`)\n }\n />\n </span>\n </>\n }\n footer={\n (!!metaRows?.length || !!shareToChat) && (\n <>\n <CommentMetaLine rows={metaRows ?? []} singleLine={isMetaSingleLine} />\n {shareToChat && <ShareToChatRow {...shareToChat} />}\n </>\n )\n }\n />\n\n {wellhubContext && (\n <WellhubFilePicker\n {...wellhubContext}\n open={isWellhubOpen}\n maxSelectable={upload.maxFiles - upload.count}\n attachedFileNames={attachedKeys}\n onAdd={addWellhubFiles}\n onClose={() => setIsWellhubOpen(false)}\n />\n )}\n </>\n );\n};\n"],"names":["MENTION_INPUT_STYLE","fontSize","lineHeight","suggestions","backgroundColor","list","item","color","renderSuggestion","entry","_jsxs","className","styles","suggestion","children","_jsx","Avatar","size","alt","display","imgSrc","photo","displayName","jsx","_ref","body","onBodyChange","onSubmit","canSubmit","currentUser","attachments","onAttachmentsChange","_ref$maxAttachments","maxAttachments","DEFAULT_MAX_ATTACHMENTS","attachment","onAttachmentChange","attachmentError","onAttachmentError","maxAttachmentSizeBytes","wellhubContext","disabled","autoFocus","_ref$placeholder","placeholder","metaRows","isMetaSingleLine","shareToChat","trailing","embedded","testId","isMulti","value","useMemo","filter","Boolean","handleAttachmentsChange","useCallback","next","_next$","upload","useAttachmentUpload","onChange","onError","maxSizeBytes","maxFiles","canSend","isUploading","useState","_useState2","_slicedToArray","_useState","isWellhubOpen","setIsWellhubOpen","attachedKeys","map","name","fieldRef","useRef","_Fragment","CommentInput","field","Input","inputComponent","UserMention","inputProps","allowEmptyQuery","suggestionsPortalHost","document","querySelector","withLightTheme","mentionProps","highlightLinks","style","inputRef","mentionField","onKeyDown","event","key","shiftKey","isSuggestionsListOpened","preventDefault","disableUnderline","rows","fullWidth","multiline","items","onAttachmentRemove","removeAttachment","onAttachmentRetry","handleRetry","onAttachmentReorder","reorderAttachments","undefined","onFilesDrop","addFiles","onImageLinkPaste","addLinkedImage","dropLabel","attachmentSlot","FailedFileUploading","errorMessage","toolbar","jsxs","AttachFileButton","fileInputRef","onClick","openFileDialog","onFileSelect","handleFileSelect","onWellhubSelect","multiple","isFull","tooltip","concat","Tooltip","title","ButtonIcon","type","_Object$getOwnPropert","current","focus","needsSpace","test","nextValue","setValue","Object","getOwnPropertyDescriptor","getPrototypeOf","set","call","setSelectionRange","length","dispatchEvent","Event","bubbles","AlternateEmailIcon","iconSlot","EmojiIconButton","icon","SmilingFaceIcon","handleSelectEmoji","emoji","native","footer","CommentMetaLine","singleLine","ShareToChatRow","_objectSpread","WellhubFilePicker","open","maxSelectable","count","attachedFileNames","onAdd","files","addStoredFiles","file","fileName","onClose"],"mappings":"4oMAgFA,IAGMA,EAAsB,CAC1BC,SAAU,GACVC,WAAY,OACZC,YAAa,CACXC,gBAP2B,gCAQ3BC,KAAM,CAAED,gBARmB,iCAS3BE,KAAM,CACJC,MAAO,gCACP,WAAY,CAAEH,gBAAiB,2DAK/BI,EAAmB,SAACC,GAA0C,OAClEC,EAAAA,KAAA,MAAA,CAAKC,UAAWC,EAAOC,WAAWC,SAAA,CAChCC,MAACC,kBAAM,CAACC,KAAM,GAAIC,IAAKT,EAAMU,QAASC,OAAQX,EAAMY,MAAOC,YAAab,EAAMU,UAC9EJ,EAAAQ,IAAA,OAAA,CAAAT,SAAOL,EAAMU,YACT,0BAGuB,SAyBHK,GAAA,IAxB1BC,IAAAA,KACAC,IAAAA,aACAC,IAAAA,SACAC,IAAAA,UACAC,IAAAA,YACAC,IAAAA,YACAC,IAAAA,oBAAmBC,EAAAR,EACnBS,eAAAA,aAAiBC,EAAuBA,wBAAAF,EACxCG,IAAAA,WACAC,IAAAA,mBACAC,IAAAA,gBACAC,IAAAA,kBACAC,IAAAA,uBACAC,IAAAA,eACAC,IAAAA,SACAC,IAAAA,UAASC,EAAAnB,EACToB,YAAAA,aAAc,mBAAkBD,EAChCE,IAAAA,SACAC,IAAAA,iBACAC,IAAAA,YACAC,IAAAA,SACAC,IAAAA,SACAtC,IAAAA,UACAuC,IAAAA,OAGMC,IAAYpB,EACZqB,EAAQC,EAAAA,SACZ,WAAA,OAAOF,EAAUrB,QAAAA,EAAe,GAAM,CAACK,GAAYmB,OAAOC,QAAkC,GAC5F,CAACJ,EAASrB,EAAaK,IAGnBqB,EAA0BC,eAC9B,SAACC,GAA+B,IAAAC,EAC1B5B,EAAqBA,EAAoB2B,GACxCtB,SAAAA,EAA4B,UAAPsB,EAAK,UAAE,IAAA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iJ,SAAS/I,SAC/BC,MAAC+I,EAAe,CACdC,KAAMhJ,MAACiJ,kBAAe,CAAC/I,KAAM,KAC7BgJ,kBAAmB,SAACC,GAAyB,OAC3CxI,EAAgBD,GAAAA,OAAAA,UAAOyI,EAAMC,QAAS,SAMhDC,UACKvH,UAAAA,EAAU2G,WAAYzG,IACvBrC,EAAAA,KAAAqE,EAAAA,SAAA,CAAAjE,SAAA,CACEC,MAACsJ,kBAAe,CAAC9D,KAAM1D,QAAAA,EAAY,GAAIyH,WAAYxH,IAClDC,GAAehC,MAACwJ,EAAAA,eAAcC,EAAA,CAAA,EAAKzH,SAM3CP,GACCzB,EAACQ,IAAAkJ,2BACKjI,GAAc,GAAA,CAClBkI,KAAMlG,GACNmG,cAAe/G,EAAOK,SAAWL,EAAOgH,MACxCC,kBAAmBnG,GACnBoG,MAhIgB,SAACC,GACvBtG,IAAiB,GACjBb,EAAOoH,eAAeD,EAAMpG,KAAI,SAAAsG,GAAI,MAAK,CAAEC,SAAUD,EAAKC,SAAW,MA+H/DC,QAAS,WAAA,OAAM1G,IAAiB,EAAM,OAKhD"}
|
|
1
|
+
{"version":3,"file":"CommentComposer.js","sources":["../../../../src/components/CommentComposer/CommentComposer.tsx"],"sourcesContent":["import {\n CSSProperties,\n FormEventHandler,\n KeyboardEvent,\n ReactNode,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { Input } from '@material-ui/core';\nimport AlternateEmailIcon from '@material-ui/icons/AlternateEmail';\n\nimport { ButtonIcon } from '../../componentsV2/ButtonIcon';\nimport { Tooltip } from '../../componentsV2/Tooltip';\nimport { SmilingFaceIcon } from '../../icons';\nimport Avatar from '../Avatar';\nimport { AttachFileButton } from '../AttachFileButton';\nimport { CommentInput } from '../CommentInputNext/CommentInputNext';\nimport EmojiIconButton from '../EmojiIconButton';\nimport FailedFileUploading from '../FailedFileUploading';\nimport UserMention from '../UserMention';\nimport { isSuggestionsListOpened } from '../UserMention/utils';\nimport { WellhubFilePicker } from '../WellhubFilePicker';\nimport type { WellhubContext, WellhubFile } from '../WellhubFilePicker';\n\nimport {\n useAttachmentUpload,\n UploadedAttachment,\n DEFAULT_MAX_ATTACHMENTS,\n} from './useAttachmentUpload';\nimport { CommentMetaLine, CommentMetaRow } from './CommentMetaLine';\nimport { ShareToChatRow, ShareToChatRowProps } from './ShareToChatRow';\n\nimport styles from './CommentComposer.scss';\n\n/* eslint-disable camelcase -- mirrors the platform's snake_case user payload. */\nexport type CommentComposerUser = {\n id?: number;\n company_id?: number;\n first_name?: string;\n last_name?: string;\n profile_photo?: string;\n [key: string]: unknown;\n};\n/* eslint-enable camelcase */\n\nexport type CommentComposerTrailingState = {\n canSend: boolean;\n submit: () => void;\n};\n\nexport type CommentComposerProps = {\n body: string;\n onBodyChange: (value: string) => void;\n onSubmit: () => void;\n canSubmit: boolean;\n currentUser: CommentComposerUser;\n\n attachments?: UploadedAttachment[];\n onAttachmentsChange?: (attachments: UploadedAttachment[]) => void;\n maxAttachments?: number;\n /** @deprecated Use `attachments` — kept so single-attachment callers keep working. */\n attachment?: UploadedAttachment | null;\n /** @deprecated Use `onAttachmentsChange`. */\n onAttachmentChange?: (attachment: UploadedAttachment | null) => void;\n attachmentError?: string | null;\n onAttachmentError?: (message: string | null) => void;\n maxAttachmentSizeBytes?: number;\n wellhubContext?: WellhubContext;\n\n disabled?: boolean;\n autoFocus?: boolean;\n placeholder?: string;\n metaRows?: CommentMetaRow[];\n isMetaSingleLine?: boolean;\n shareToChat?: Omit<ShareToChatRowProps, 'testId'>;\n /** Replaces the default send button, e.g. the edit form's Cancel/Save. */\n trailing?: ReactNode;\n /** Like `trailing`, but receives the upload-aware send state for a custom Save. */\n renderTrailing?: (state: CommentComposerTrailingState) => ReactNode;\n /** Render flush inside a host card instead of as its own surface. */\n embedded?: boolean;\n className?: string;\n testId?: string;\n};\n\nconst SUGGESTIONS_BACKGROUND = 'var(--palette-background-b-9)';\n\n// Module-level so react-mentions isn't re-rendered on every keystroke.\nconst MENTION_INPUT_STYLE = {\n fontSize: 14,\n lineHeight: '20px',\n suggestions: {\n backgroundColor: SUGGESTIONS_BACKGROUND,\n list: { backgroundColor: SUGGESTIONS_BACKGROUND },\n item: {\n color: 'var(--palette-primary-text-1)',\n '&focused': { backgroundColor: 'rgb(from var(--palette-primary-text-1) r g b / 0.08)' },\n },\n },\n} as unknown as CSSProperties;\n\nconst renderSuggestion = (entry: { display: string; photo?: string }) => (\n <div className={styles.suggestion}>\n <Avatar size={26} alt={entry.display} imgSrc={entry.photo} displayName={entry.display} />\n <span>{entry.display}</span>\n </div>\n);\n\nexport const CommentComposer = ({\n body,\n onBodyChange,\n onSubmit,\n canSubmit,\n currentUser,\n attachments,\n onAttachmentsChange,\n maxAttachments = DEFAULT_MAX_ATTACHMENTS,\n attachment,\n onAttachmentChange,\n attachmentError,\n onAttachmentError,\n maxAttachmentSizeBytes,\n wellhubContext,\n disabled,\n autoFocus,\n placeholder = 'Add a comment...',\n metaRows,\n isMetaSingleLine,\n shareToChat,\n trailing,\n renderTrailing,\n embedded,\n className,\n testId,\n}: CommentComposerProps) => {\n // Callers still on the singular props get the old one-file behaviour, unchanged.\n const isMulti = !!onAttachmentsChange;\n const value = useMemo(\n () => (isMulti ? attachments ?? [] : ([attachment].filter(Boolean) as UploadedAttachment[])),\n [isMulti, attachments, attachment]\n );\n\n const handleAttachmentsChange = useCallback(\n (next: UploadedAttachment[]) => {\n if (onAttachmentsChange) onAttachmentsChange(next);\n else onAttachmentChange?.(next[0] ?? null);\n },\n [onAttachmentsChange, onAttachmentChange]\n );\n\n const upload = useAttachmentUpload({\n value,\n onChange: handleAttachmentsChange,\n onError: onAttachmentError,\n maxSizeBytes: maxAttachmentSizeBytes,\n maxFiles: isMulti ? maxAttachments : 1,\n });\n\n // An attachment only lands once S3 confirms, so posting mid-upload would drop it.\n const canSend = canSubmit && !upload.isUploading;\n\n const submit = () => {\n if (!canSend || disabled) return;\n\n onSubmit();\n };\n\n const [isWellhubOpen, setIsWellhubOpen] = useState(false);\n const attachedKeys = useMemo(() => value.map(item => item.name), [value]);\n\n const addWellhubFiles = (files: WellhubFile[]) => {\n setIsWellhubOpen(false);\n upload.addStoredFiles(files.map(file => ({ fileName: file.fileName })));\n };\n\n const fieldRef = useRef<HTMLTextAreaElement | null>(null);\n\n // react-mentions opens suggestions from textarea events, so type \"@\" instead of setting state.\n const mentionSomeone = () => {\n const field = fieldRef.current;\n if (!field) return;\n\n field.focus();\n\n const needsSpace = !!field.value && !/\\s$/.test(field.value);\n const nextValue = `${field.value}${needsSpace ? ' @' : '@'}`;\n const setValue = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(field), 'value')?.set;\n\n setValue?.call(field, nextValue);\n field.setSelectionRange(nextValue.length, nextValue.length);\n field.dispatchEvent(new Event('input', { bubbles: true }));\n field.dispatchEvent(new Event('keyup', { bubbles: true }));\n };\n\n const handleEnterKey = (event: KeyboardEvent) => {\n if (event.key !== 'Enter' || event.shiftKey) return;\n if (!canSend || disabled) return;\n if (isSuggestionsListOpened()) return;\n\n event.preventDefault();\n submit();\n };\n\n return (\n <>\n <CommentInput\n value={body}\n canSubmit={canSend}\n disabled={disabled}\n onSubmit={onSubmit}\n trailing={\n renderTrailing ? renderTrailing({ canSend: canSend && !disabled, submit }) : trailing\n }\n embedded={embedded}\n className={className}\n testId={testId}\n field={\n <Input\n inputComponent={UserMention}\n inputProps={{\n // UserMention calls onChange with the text string, not a DOM event.\n onChange: onBodyChange as unknown as FormEventHandler<HTMLInputElement>,\n currentUser,\n allowEmptyQuery: true,\n suggestionsPortalHost: document.querySelector('body'),\n withLightTheme: false,\n mentionProps: { renderSuggestion },\n highlightLinks: true,\n style: MENTION_INPUT_STYLE,\n }}\n value={body}\n placeholder={placeholder}\n inputRef={fieldRef}\n className={styles.mentionField}\n onKeyDown={handleEnterKey}\n disableUnderline\n rows={1}\n fullWidth\n multiline\n autoFocus={autoFocus}\n />\n }\n attachments={upload.items}\n onAttachmentRemove={upload.removeAttachment}\n onAttachmentRetry={upload.handleRetry}\n onAttachmentReorder={isMulti ? upload.reorderAttachments : undefined}\n onFilesDrop={upload.addFiles}\n onImageLinkPaste={upload.addLinkedImage}\n dropLabel={upload.maxFiles === 1 ? 'Drop a file here' : 'Drop files here'}\n attachmentSlot={\n attachmentError ? <FailedFileUploading errorMessage={attachmentError} /> : undefined\n }\n toolbar={\n <>\n <AttachFileButton\n inputRef={upload.fileInputRef}\n onClick={upload.openFileDialog}\n onFileSelect={upload.handleFileSelect}\n onWellhubSelect={wellhubContext ? () => setIsWellhubOpen(true) : undefined}\n multiple={isMulti}\n disabled={upload.isFull}\n tooltip={\n upload.isFull\n ? `Up to ${upload.maxFiles} ${\n upload.maxFiles === 1 ? 'file' : 'files'\n } can be attached`\n : `Attach ${isMulti ? 'files' : 'file'}`\n }\n />\n <Tooltip title=\"Mention someone\">\n <ButtonIcon size=\"xs\" type=\"tertiary\" onClick={mentionSomeone}>\n <AlternateEmailIcon fontSize=\"inherit\" />\n </ButtonIcon>\n </Tooltip>\n <span className={styles.iconSlot}>\n <EmojiIconButton\n icon={<SmilingFaceIcon size={16} />}\n handleSelectEmoji={(emoji: { native: string }) =>\n onBodyChange(`${body}${emoji.native}`)\n }\n />\n </span>\n </>\n }\n footer={\n (!!metaRows?.length || !!shareToChat) && (\n <>\n <CommentMetaLine rows={metaRows ?? []} singleLine={isMetaSingleLine} />\n {shareToChat && <ShareToChatRow {...shareToChat} />}\n </>\n )\n }\n />\n\n {wellhubContext && (\n <WellhubFilePicker\n {...wellhubContext}\n open={isWellhubOpen}\n maxSelectable={upload.maxFiles - upload.count}\n attachedFileNames={attachedKeys}\n onAdd={addWellhubFiles}\n onClose={() => setIsWellhubOpen(false)}\n />\n )}\n </>\n );\n};\n"],"names":["MENTION_INPUT_STYLE","fontSize","lineHeight","suggestions","backgroundColor","list","item","color","renderSuggestion","entry","_jsxs","className","styles","suggestion","children","_jsx","Avatar","size","alt","display","imgSrc","photo","displayName","jsx","_ref","body","onBodyChange","onSubmit","canSubmit","currentUser","attachments","onAttachmentsChange","_ref$maxAttachments","maxAttachments","DEFAULT_MAX_ATTACHMENTS","attachment","onAttachmentChange","attachmentError","onAttachmentError","maxAttachmentSizeBytes","wellhubContext","disabled","autoFocus","_ref$placeholder","placeholder","metaRows","isMetaSingleLine","shareToChat","trailing","renderTrailing","embedded","testId","isMulti","value","useMemo","filter","Boolean","handleAttachmentsChange","useCallback","next","_next$","upload","useAttachmentUpload","onChange","onError","maxSizeBytes","maxFiles","canSend","isUploading","submit","useState","_useState2","_slicedToArray","_useState","isWellhubOpen","setIsWellhubOpen","attachedKeys","map","name","fieldRef","useRef","_Fragment","CommentInput","field","Input","inputComponent","UserMention","inputProps","allowEmptyQuery","suggestionsPortalHost","document","querySelector","withLightTheme","mentionProps","highlightLinks","style","inputRef","mentionField","onKeyDown","event","key","shiftKey","isSuggestionsListOpened","preventDefault","disableUnderline","rows","fullWidth","multiline","items","onAttachmentRemove","removeAttachment","onAttachmentRetry","handleRetry","onAttachmentReorder","reorderAttachments","undefined","onFilesDrop","addFiles","onImageLinkPaste","addLinkedImage","dropLabel","attachmentSlot","FailedFileUploading","errorMessage","toolbar","jsxs","AttachFileButton","fileInputRef","onClick","openFileDialog","onFileSelect","handleFileSelect","onWellhubSelect","multiple","isFull","tooltip","concat","Tooltip","title","ButtonIcon","type","_Object$getOwnPropert","current","focus","needsSpace","test","nextValue","setValue","Object","getOwnPropertyDescriptor","getPrototypeOf","set","call","setSelectionRange","length","dispatchEvent","Event","bubbles","AlternateEmailIcon","iconSlot","EmojiIconButton","icon","SmilingFaceIcon","handleSelectEmoji","emoji","native","footer","CommentMetaLine","singleLine","ShareToChatRow","_objectSpread","WellhubFilePicker","open","maxSelectable","count","attachedFileNames","onAdd","files","addStoredFiles","file","fileName","onClose"],"mappings":"4oMAuFA,IAGMA,EAAsB,CAC1BC,SAAU,GACVC,WAAY,OACZC,YAAa,CACXC,gBAP2B,gCAQ3BC,KAAM,CAAED,gBARmB,iCA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,GAAAA,OAAAA,UAAO2I,EAAMC,QAAS,SAMhDC,UACKzH,UAAAA,EAAU6G,WAAY3G,IACvBrC,EAAAA,KAAAuE,EAAAA,SAAA,CAAAnE,SAAA,CACEC,MAACwJ,kBAAe,CAAC9D,KAAM5D,QAAAA,EAAY,GAAI2H,WAAY1H,IAClDC,GAAehC,MAAC0J,EAAAA,eAAcC,EAAA,CAAA,EAAK3H,SAM3CP,GACCzB,EAACQ,IAAAoJ,2BACKnI,GAAc,GAAA,CAClBoI,KAAMlG,GACNmG,cAAehH,EAAOK,SAAWL,EAAOiH,MACxCC,kBAAmBnG,GACnBoG,MAlIgB,SAACC,GACvBtG,IAAiB,GACjBd,EAAOqH,eAAeD,EAAMpG,KAAI,SAAAsG,GAAI,MAAK,CAAEC,SAAUD,EAAKC,SAAW,MAiI/DC,QAAS,WAAA,OAAM1G,IAAiB,EAAM,OAKhD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require('./../../ext-esm/style-inject/dist/style-inject.es.js')(".CommentInputNext_root__5uxKl{overflow-clip-margin:12px;background:var(--palette-background-b-6);border-radius:12px;display:flex;flex-direction:column;overflow:hidden;overflow:clip;position:relative}.CommentInputNext_dropOverlay__E5Riv{align-items:center;background:rgb(from var(--palette-primary-main) r g b/.1);border:1px dashed var(--palette-primary-main);border-radius:inherit;color:var(--palette-primary-main);display:flex;font-size:14px;inset:0;justify-content:center;line-height:20px;pointer-events:none;position:absolute;z-index:5}.CommentInputNext_inputPanel__4KOFc{--attachment-arrow-outset:12px;display:flex;flex-direction:column;gap:8px;padding:12px 12px 8px}.CommentInputNext_rootEmbedded__-LyQl{background:transparent;border-radius:0;overflow:visible}.CommentInputNext_toolbarRow__L8xXu{align-items:center;display:flex;justify-content:space-between;width:100%}.CommentInputNext_divider__LWp-3{background:var(--palette-background-b-4);height:1px}.CommentInputNext_metaShare__yJ8GZ{color:var(--palette-primary-text-6);display:flex;flex-direction:column;gap:8px;padding:8px 12px}.CommentInputNext_rootBare__lxyYY{display:flex;flex-direction:column;gap:8px;position:relative}.CommentInputNext_fieldRow__Rqcbr{align-items:flex-start;display:flex;gap:8px}.CommentInputNext_leading__yDBbV{flex-shrink:0}.CommentInputNext_field__OpnOp{--attachment-arrow-outset:8px;align-items:flex-end;background:rgb(from var(--palette-primary-text-1) r g b/.04);border:1px solid rgb(from var(--palette-primary-text-1) r g b/.04);border-radius:8px;display:flex;flex:1 0 0;gap:8px;max-height:256px;min-height:36px;min-width:0;overflow:hidden;padding:6px 8px}.CommentInputNext_field__OpnOp:focus-within{border-color:var(--palette-primary-main)}.CommentInputNext_fieldExpanded__w1omA{max-height:none;overflow:visible}.CommentInputNext_fieldDisabled__g3aIT{opacity:.6}.CommentInputNext_bareToolbar__nFQP-{align-items:center;color:var(--palette-primary-text-6);display:flex;flex-shrink:0}.CommentInputNext_fieldMain__Rs8-Y{flex:1 0 0;min-width:0}.CommentInputNext_attachment__2EDgL,.CommentInputNext_fieldMain__Rs8-Y{display:flex;flex-direction:column;gap:8px}.CommentInputNext_input__w6b1c{background:transparent;border:none;color:var(--palette-primary-text-1);font:inherit;font-size:14px;line-height:20px;outline:none;resize:none;width:100%}.CommentInputNext_input__w6b1c::placeholder{color:var(--palette-primary-text-9)}.CommentInputNext_input__w6b1c:disabled{cursor:not-allowed}.CommentInputNext_toolbar__Zs2OG{align-items:center;color:var(--palette-primary-text-6);display:flex;gap:4px;margin-left:-4px}.CommentInputNext_send__p248I{flex-shrink:0}"),module.exports={spacing:"8",root:"CommentInputNext_root__5uxKl",dropOverlay:"CommentInputNext_dropOverlay__E5Riv",inputPanel:"CommentInputNext_inputPanel__4KOFc",rootEmbedded:"CommentInputNext_rootEmbedded__-LyQl",toolbarRow:"CommentInputNext_toolbarRow__L8xXu",divider:"CommentInputNext_divider__LWp-3",metaShare:"CommentInputNext_metaShare__yJ8GZ",rootBare:"CommentInputNext_rootBare__lxyYY",fieldRow:"CommentInputNext_fieldRow__Rqcbr",leading:"CommentInputNext_leading__yDBbV",field:"CommentInputNext_field__OpnOp",fieldExpanded:"CommentInputNext_fieldExpanded__w1omA",fieldDisabled:"CommentInputNext_fieldDisabled__g3aIT",bareToolbar:"CommentInputNext_bareToolbar__nFQP-",fieldMain:"CommentInputNext_fieldMain__Rs8-Y",attachment:"CommentInputNext_attachment__2EDgL",input:"CommentInputNext_input__w6b1c",toolbar:"CommentInputNext_toolbar__Zs2OG",send:"CommentInputNext_send__p248I"};
|
|
1
|
+
"use strict";require('./../../ext-esm/style-inject/dist/style-inject.es.js')(".CommentInputNext_root__5uxKl{overflow-clip-margin:12px;background:var(--palette-background-b-6);border-radius:12px;display:flex;flex-direction:column;overflow:hidden;overflow:clip;position:relative}.CommentInputNext_dropOverlay__E5Riv{align-items:center;background:rgb(from var(--palette-primary-main) r g b/.1);border:1px dashed var(--palette-primary-main);border-radius:inherit;color:var(--palette-primary-main);display:flex;font-size:14px;inset:0;justify-content:center;line-height:20px;pointer-events:none;position:absolute;z-index:5}.CommentInputNext_inputPanel__4KOFc{--attachment-arrow-outset:12px;display:flex;flex-direction:column;gap:8px;padding:12px 12px 8px}.CommentInputNext_rootEmbedded__-LyQl{background:transparent;border-radius:0;overflow:visible}.CommentInputNext_toolbarRow__L8xXu{align-items:center;display:flex;justify-content:space-between;width:100%}.CommentInputNext_divider__LWp-3{background:var(--palette-background-b-4);height:1px}.CommentInputNext_metaShare__yJ8GZ{color:var(--palette-primary-text-6);display:flex;flex-direction:column;gap:8px;padding:8px 12px}.CommentInputNext_rootBare__lxyYY{display:flex;flex-direction:column;gap:8px;position:relative}.CommentInputNext_fieldRow__Rqcbr{align-items:flex-start;display:flex;gap:8px}.CommentInputNext_leading__yDBbV{flex-shrink:0}.CommentInputNext_field__OpnOp{--attachment-arrow-outset:8px;align-items:flex-end;background:rgb(from var(--palette-primary-text-1) r g b/.04);border:1px solid rgb(from var(--palette-primary-text-1) r g b/.04);border-radius:8px;display:flex;flex:1 0 0;gap:8px;max-height:256px;min-height:36px;min-width:0;overflow:hidden;padding:6px 8px}.CommentInputNext_field__OpnOp:focus-within{border-color:var(--palette-primary-main)}.CommentInputNext_fieldExpanded__w1omA{max-height:none;overflow:visible}.CommentInputNext_fieldDisabled__g3aIT{opacity:.6}.CommentInputNext_bareToolbar__nFQP-{align-items:center;color:var(--palette-primary-text-6);display:flex;flex-shrink:0}.CommentInputNext_fieldMain__Rs8-Y{align-self:stretch;flex:1 0 0;justify-content:center;min-width:0}.CommentInputNext_attachment__2EDgL,.CommentInputNext_fieldMain__Rs8-Y{display:flex;flex-direction:column;gap:8px}.CommentInputNext_input__w6b1c{background:transparent;border:none;color:var(--palette-primary-text-1);font:inherit;font-size:14px;line-height:20px;outline:none;resize:none;width:100%}.CommentInputNext_input__w6b1c::placeholder{color:var(--palette-primary-text-9)}.CommentInputNext_input__w6b1c:disabled{cursor:not-allowed}.CommentInputNext_toolbar__Zs2OG{align-items:center;color:var(--palette-primary-text-6);display:flex;gap:4px;margin-left:-4px}.CommentInputNext_send__p248I{flex-shrink:0}"),module.exports={spacing:"8",root:"CommentInputNext_root__5uxKl",dropOverlay:"CommentInputNext_dropOverlay__E5Riv",inputPanel:"CommentInputNext_inputPanel__4KOFc",rootEmbedded:"CommentInputNext_rootEmbedded__-LyQl",toolbarRow:"CommentInputNext_toolbarRow__L8xXu",divider:"CommentInputNext_divider__LWp-3",metaShare:"CommentInputNext_metaShare__yJ8GZ",rootBare:"CommentInputNext_rootBare__lxyYY",fieldRow:"CommentInputNext_fieldRow__Rqcbr",leading:"CommentInputNext_leading__yDBbV",field:"CommentInputNext_field__OpnOp",fieldExpanded:"CommentInputNext_fieldExpanded__w1omA",fieldDisabled:"CommentInputNext_fieldDisabled__g3aIT",bareToolbar:"CommentInputNext_bareToolbar__nFQP-",fieldMain:"CommentInputNext_fieldMain__Rs8-Y",attachment:"CommentInputNext_attachment__2EDgL",input:"CommentInputNext_input__w6b1c",toolbar:"CommentInputNext_toolbar__Zs2OG",send:"CommentInputNext_send__p248I"};
|
|
2
2
|
//# sourceMappingURL=CommentInputNext.scss.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react-dom"),r=require("../../components/LoadingIndicator/LoadingIndicator.js"),a=require("./GalleryViewer.scss.js"),t=require("react/jsx-runtime");exports.GalleryImageStatus=function(i){var s=i.target,l=i.status;return"ready"===l?null:e.createPortal(t.jsx("div",{role:"status","aria-live":"polite",className:a.imageStatus,children:"pending"===l?t.jsx("span",{"aria-label":"Loading image",children:t.jsx(r,{fullscreen:!1})}):"This image failed to load"}),s)};
|
|
2
|
+
//# sourceMappingURL=GalleryImageStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GalleryImageStatus.js","sources":["../../../../src/componentsV2/ImageViewer/GalleryImageStatus.tsx"],"sourcesContent":["import { createPortal } from 'react-dom';\nimport LoadingIndicator from '../../components/LoadingIndicator';\nimport styles from './GalleryViewer.scss';\nimport { ResolvedImage } from './useImageDimensions';\n\ntype Props = { target: HTMLElement; status: ResolvedImage['status'] };\nexport const GalleryImageStatus = ({ target, status }: Props) =>\n status === 'ready'\n ? null\n : createPortal(\n <div role=\"status\" aria-live=\"polite\" className={styles.imageStatus}>\n {status === 'pending' ? (\n <span aria-label=\"Loading image\">\n <LoadingIndicator fullscreen={false} />\n </span>\n ) : (\n 'This image failed to load'\n )}\n </div>,\n target\n );\n"],"names":["_ref","target","status","createPortal","_jsx","role","className","styles","imageStatus","children","LoadingIndicator","fullscreen"],"mappings":"iQAMkC,SAAHA,GAAA,IAAMC,IAAAA,OAAQC,IAAAA,OAAM,MACtC,UAAXA,EACI,KACAC,EAAAA,aACEC,EAAAA,IAAA,MAAA,CAAKC,KAAK,SAAS,YAAU,SAASC,UAAWC,EAAOC,YAAYC,SACtD,YAAXP,EACCE,EAAAA,IAAA,OAAA,CAAM,aAAW,gBAAeK,SAC9BL,MAACM,EAAgB,CAACC,YAAY,MAGhC,8BAGJV,EACD"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),o=require("@babel/runtime/helpers/slicedToArray"),s=require("react"),n=require("photoswipe/lightbox"),i=require("photoswipe"),r=require("react-dom/server"),c=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/InfoRounded.js"),require("../../icons/customIcons/icons/FlameFilled.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/PinOne.js"),require("../../icons/customIcons/icons/PinOneCrossed.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 t=require("../../components/DevCenter/DevCenterAppContainer/components/IsInsideIsolatedDcAppProvider.js"),u=require("./registerSourceToolbar.js"),a=require("./registerViewerWindow.js"),l=require("./ImageViewer.scss.js");require("photoswipe/photoswipe.css");var d=require("./useImageDimensions.js"),m=require("./GalleryImageStatus.js"),j=require("./registerLegacyToolbar.js"),I=require("./registerLegacyLifecycle.js"),p=require("./registerLegacyWheel.js"),q=require("./legacyZoom.js"),g=require("./GalleryViewer.scss.js"),h=require("./logicalSlides.js"),f=require("react/jsx-runtime");function v(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var y=v(e),C=v(o),b=v(n),w=v(i);function O(e,o){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);o&&(n=n.filter((function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable}))),s.push.apply(s,n)}return s}var A={chat:10,single:0};exports.GalleryImageViewer=function(e){var o=e.images,n=e.initialIndex,i=void 0===n?0:n,v=e.presentation,x=void 0===v?"chat":v,F=e.onIndexChange,S=e.onOpen,D=e.onClose,P=e.isSourceApi,L=void 0!==P&&P,T=s.useState((function(){return Math.max(0,Math.min(o.length-1,Number.isFinite(i)?Math.trunc(i):0))})),M=C.default(T,1)[0],k=t.useIsInsideIsolatedDcApp(),E=k?window.parent:window,R=L?50:A[x],G=s.useRef(null),W=d.useImageDimensions(o),Z=s.useState(M),z=C.default(Z,2),V=z[0],U=z[1],H=s.useState(null),N=C.default(H,2),B=N[0],K=N[1],_=s.useRef({items:W,onIndexChange:F,onOpen:S,onClose:D}),J=s.useRef(null),Q=s.useRef(W),X=s.useRef();s.useEffect((function(){_.current={items:W,onIndexChange:F,onOpen:S,onClose:D}}),[W,F,S,D]);var Y=W.length,$=!L||"ready"===W[0].status;return s.useEffect((function(){var e,o,s,n,i;if($){var t=!1,d=new b.default(function(e){for(var o=1;o<arguments.length;o++){var s=null!=arguments[o]?arguments[o]:{};o%2?O(Object(s),!0).forEach((function(o){y.default(e,o,s[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):O(Object(s)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(s,o))}))}return e}({pswpModule:w.default,appendToEl:k?E.document.body:null!==(e=null!==(o=null===(s=G.current)||void 0===s?void 0:s.closest(".MuiDialog-container"))&&void 0!==o?o:null===(n=G.current)||void 0===n?void 0:n.closest('[role="dialog"]'))&&void 0!==e?e:E.document.body,getViewportSizeFn:function(){return{x:E.innerWidth,y:E.innerHeight}},returnFocus:!1,preloadFirstSlide:!1,dataSource:_.current.items,loop:!0,counter:!1,clickToCloseNonZoomable:!1,wheelToZoom:!0,initialZoomLevel:"fit",secondaryZoomLevel:function(e){return q.getLegacyScale(e.fit,100)},maxZoomLevel:function(e){return q.getLegacyScale(e.fit,300)},imageClickAction:!1,zoom:!1,close:!1,escKey:!1,showHideAnimationType:"fade",easing:"ease",showAnimationDuration:0,hideAnimationDuration:300,maxWidthToAnimate:1/0,mainClass:g.root,padding:{top:R,bottom:R,left:R,right:R},errorMsg:"This image failed to load"},L?{maxZoomLevel:2,showHideAnimationType:"zoom",showAnimationDuration:333,hideAnimationDuration:333,maxWidthToAnimate:4e3,easing:"cubic-bezier(.4,0,.22,1)",secondaryZoomLevel:void 0,imageClickAction:"zoom",close:!0,mainClass:l.root,closeSVG:r.renderToString(f.jsx(c.ArrowLeftIcon,{}))}:{}));a.registerViewerWindow(d,E);var m=I.registerLegacyLifecycle(d,(function(){var e,o;F(),null===(e=(o=_.current).onClose)||void 0===e||e.call(o)}),E);L&&u.registerSourceToolbar(d);var v,C=L?void 0:j.registerLegacyToolbar(d,x,m.closeImmediately,m.isClosing),A=L?void 0:p.registerLegacyWheel(d,E.document),F=function(){null==C||C(),null==A||A(),J.current===d&&(J.current=null)};d.on("destroy",F),J.current=d,Q.current=_.current.items,d.addFilter("numItems",(function(){return h.physicalCount(Y)})),d.addFilter("itemData",(function(e,o){var s=h.slideAt(_.current.items,o);return{id:s.id,src:s.src,width:s.width,height:s.height,alt:s.alt,type:"image"}})),d.on("contentLoadImage",(function(e){e.content.data.src&&e.content.data.width&&e.content.data.height||e.preventDefault()})),d.on("uiRegister",(function(){var e,o;null===(e=d.pswp)||void 0===e||null===(o=e.ui)||void 0===o||o.registerElement({name:"gallery-image-status",appendTo:"root",onInit:function(e){t||(e.style.pointerEvents="none",K(e))}})})),d.on("initialLayout",(function(){var e,o;t||m.isClosing()||null===(e=(o=_.current).onOpen)||void 0===e||e.call(o)})),d.on("change",(function(){var e,o;if(!t&&!m.isClosing()){var s,n,i=h.logicalIndex(null!==(e=null===(o=d.pswp)||void 0===o?void 0:o.currIndex)&&void 0!==e?e:M,Y);if(U(i),i!==v)v=i,null===(s=(n=_.current).onIndexChange)||void 0===s||s.call(n,i)}})),d.on("close",(function(){J.current===d&&(J.current=null)})),d.init();var S=X.current,D=function(){t||m.isClosing()||d.loadAndOpen(Math.min(M,Y-1))},P=function(){queueMicrotask(D)};return null!=S&&null!==(i=S.element)&&void 0!==i&&i.isConnected?S.on("destroy",P):D(),function(){var e;t=!0,null==S||S.off("destroy",P),X.current=null!==(e=d.pswp)&&void 0!==e?e:S,F(),m.dispose()}}}),[Y,M,R,x,L,$,k,E]),s.useEffect((function(){var e,o=Q.current;Q.current=W;var s=null===(e=J.current)||void 0===e?void 0:e.pswp;if(s)for(var n=0;n<h.physicalCount(Y);n+=1){var i=h.slideAt(o,n),r=h.slideAt(W,n);i.src===r.src&&i.width===r.width&&i.height===r.height&&i.alt===r.alt&&i.id===r.id||s.refreshSlideContent(n)}}),[W,Y]),f.jsxs(f.Fragment,{children:[f.jsx("span",{ref:G,hidden:!0,"aria-hidden":"true"}),B&&f.jsx(m.GalleryImageStatus,{target:B,status:W[h.logicalIndex(V,W.length)].status})]})};
|
|
2
|
+
//# sourceMappingURL=GalleryImageViewer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GalleryImageViewer.js","sources":["../../../../src/componentsV2/ImageViewer/GalleryImageViewer.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport PhotoSwipeLightbox from 'photoswipe/lightbox';\nimport PhotoSwipe from 'photoswipe';\nimport { renderToString } from 'react-dom/server';\nimport { ArrowLeftIcon } from '~/icons';\nimport { useIsInsideIsolatedDcApp } from '../../components/DevCenter/DevCenterAppContainer/components/IsInsideIsolatedDcAppProvider';\nimport { registerSourceToolbar } from './registerSourceToolbar';\nimport { registerViewerWindow } from './registerViewerWindow';\nimport sourceStyles from './ImageViewer.scss';\nimport 'photoswipe/photoswipe.css';\nimport { GalleryImageViewerProps } from './types';\nimport { useImageDimensions } from './useImageDimensions';\nimport { GalleryImageStatus } from './GalleryImageStatus';\nimport { registerLegacyToolbar } from './registerLegacyToolbar';\nimport { registerLegacyLifecycle } from './registerLegacyLifecycle';\nimport { registerLegacyWheel } from './registerLegacyWheel';\nimport { getLegacyScale } from './legacyZoom';\nimport styles from './GalleryViewer.scss';\nimport { physicalCount, slideAt, logicalIndex } from './logicalSlides';\n\nconst presentationPadding = { chat: 10, single: 0 };\n\nexport const GalleryImageViewer = ({\n images: sourceItems,\n initialIndex = 0,\n presentation = 'chat',\n onIndexChange,\n onOpen,\n onClose,\n isSourceApi = false,\n}: GalleryImageViewerProps & { isSourceApi?: boolean }) => {\n const [start] = useState(() =>\n Math.max(\n 0,\n Math.min(sourceItems.length - 1, Number.isFinite(initialIndex) ? Math.trunc(initialIndex) : 0)\n )\n );\n const isIsolated = useIsInsideIsolatedDcApp();\n const targetWindow = isIsolated ? window.parent : window;\n const padding = isSourceApi ? 50 : presentationPadding[presentation];\n const mountAnchor = useRef<HTMLSpanElement>(null);\n const items = useImageDimensions(sourceItems);\n const [activeIndex, setActiveIndex] = useState(start);\n const [statusTarget, setStatusTarget] = useState<HTMLElement | null>(null);\n const latest = useRef({ items, onIndexChange, onOpen, onClose });\n const lightboxRef = useRef<PhotoSwipeLightbox | null>(null);\n const previousItems = useRef(items);\n const previousCore = useRef<PhotoSwipe | undefined>();\n useEffect(() => {\n latest.current = { items, onIndexChange, onOpen, onClose };\n }, [items, onIndexChange, onOpen, onClose]);\n const count = items.length;\n const isReady = !isSourceApi || items[0].status === 'ready';\n useEffect(() => {\n if (!isReady) return undefined;\n let isDisposed = false;\n const lightbox = new PhotoSwipeLightbox({\n pswpModule: PhotoSwipe,\n // Keep both focus traps in the same DOM boundary. Mount outside Dialog's\n // Paper so its overflow/transform cannot clip the fixed viewport overlay.\n appendToEl: isIsolated\n ? targetWindow.document.body\n : mountAnchor.current?.closest<HTMLElement>('.MuiDialog-container') ??\n mountAnchor.current?.closest<HTMLElement>('[role=\"dialog\"]') ??\n targetWindow.document.body,\n getViewportSizeFn: () => ({ x: targetWindow.innerWidth, y: targetWindow.innerHeight }),\n returnFocus: false,\n // Resolve first-slide data when the async core opens, not before source updates.\n preloadFirstSlide: false,\n dataSource: latest.current.items,\n loop: true,\n counter: false,\n clickToCloseNonZoomable: false,\n wheelToZoom: true,\n initialZoomLevel: 'fit',\n secondaryZoomLevel: level => getLegacyScale(level.fit, 100),\n maxZoomLevel: level => getLegacyScale(level.fit, 300),\n imageClickAction: false,\n zoom: false,\n close: false,\n escKey: false,\n showHideAnimationType: 'fade',\n easing: 'ease',\n showAnimationDuration: 0,\n hideAnimationDuration: 300,\n maxWidthToAnimate: Infinity,\n mainClass: styles.root,\n padding: { top: padding, bottom: padding, left: padding, right: padding },\n errorMsg: 'This image failed to load',\n ...(isSourceApi\n ? {\n maxZoomLevel: 2,\n showHideAnimationType: 'zoom' as const,\n showAnimationDuration: 333,\n hideAnimationDuration: 333,\n maxWidthToAnimate: 4000,\n easing: 'cubic-bezier(.4,0,.22,1)',\n secondaryZoomLevel: undefined,\n imageClickAction: 'zoom' as const,\n close: true,\n mainClass: sourceStyles.root,\n closeSVG: renderToString(<ArrowLeftIcon />),\n }\n : {}),\n });\n registerViewerWindow(lightbox, targetWindow);\n const lifecycle = registerLegacyLifecycle(\n lightbox,\n () => {\n // A close before the async core opens has no PhotoSwipe destroy event.\n releaseViewer();\n latest.current.onClose?.();\n },\n targetWindow\n );\n if (isSourceApi) registerSourceToolbar(lightbox);\n const removeToolbarListeners = isSourceApi\n ? undefined\n : registerLegacyToolbar(\n lightbox,\n presentation,\n lifecycle.closeImmediately,\n lifecycle.isClosing\n );\n const removeWheelListeners = isSourceApi\n ? undefined\n : registerLegacyWheel(lightbox, targetWindow.document);\n const releaseViewer = () => {\n removeToolbarListeners?.();\n removeWheelListeners?.();\n if (lightboxRef.current === lightbox) lightboxRef.current = null;\n };\n lightbox.on('destroy', releaseViewer);\n lightboxRef.current = lightbox;\n previousItems.current = latest.current.items;\n lightbox.addFilter('numItems', () => physicalCount(count));\n lightbox.addFilter('itemData', (_data, index) => {\n const { id, src, width, height, alt } = slideAt(latest.current.items, index);\n return { id, src, width, height, alt, type: 'image' };\n });\n // Pending image URLs must not be inferred as HTML or requested as empty URLs.\n lightbox.on('contentLoadImage', event => {\n if (!event.content.data.src || !event.content.data.width || !event.content.data.height)\n event.preventDefault();\n });\n lightbox.on('uiRegister', () => {\n lightbox.pswp?.ui?.registerElement({\n name: 'gallery-image-status',\n appendTo: 'root',\n onInit: element => {\n if (!isDisposed) {\n element.style.pointerEvents = 'none';\n setStatusTarget(element);\n }\n },\n });\n });\n let previousIndex: number | undefined;\n lightbox.on('initialLayout', () => {\n if (!isDisposed && !lifecycle.isClosing()) latest.current.onOpen?.();\n });\n lightbox.on('change', () => {\n if (isDisposed || lifecycle.isClosing()) return;\n const index = logicalIndex(lightbox.pswp?.currIndex ?? start, count);\n setActiveIndex(index);\n if (index !== previousIndex) {\n previousIndex = index;\n latest.current.onIndexChange?.(index);\n }\n });\n lightbox.on('close', () => {\n if (lightboxRef.current === lightbox) lightboxRef.current = null;\n });\n lightbox.init();\n const closingCore = previousCore.current;\n const open = () => {\n if (!isDisposed && !lifecycle.isClosing()) {\n lightbox.loadAndOpen(Math.min(start, count - 1));\n }\n };\n const openAfterDestroy = () => {\n // PhotoSwipe releases its global instance after dispatching destroy.\n queueMicrotask(open);\n };\n if (closingCore?.element?.isConnected) {\n closingCore.on('destroy', openAfterDestroy);\n } else {\n open();\n }\n return () => {\n isDisposed = true;\n closingCore?.off('destroy', openAfterDestroy);\n previousCore.current = lightbox.pswp ?? closingCore;\n releaseViewer();\n lifecycle.dispose();\n };\n }, [count, start, padding, presentation, isSourceApi, isReady, isIsolated, targetWindow]);\n\n useEffect(() => {\n const before = previousItems.current;\n previousItems.current = items;\n const pswp = lightboxRef.current?.pswp;\n if (!pswp) return;\n for (let index = 0; index < physicalCount(count); index += 1) {\n const previous = slideAt(before, index);\n const next = slideAt(items, index);\n if (\n previous.src !== next.src ||\n previous.width !== next.width ||\n previous.height !== next.height ||\n previous.alt !== next.alt ||\n previous.id !== next.id\n ) {\n pswp.refreshSlideContent(index);\n }\n }\n }, [items, count]);\n return (\n <>\n <span ref={mountAnchor} hidden aria-hidden=\"true\" />\n {statusTarget && (\n <GalleryImageStatus\n target={statusTarget}\n status={items[logicalIndex(activeIndex, items.length)].status}\n />\n )}\n </>\n );\n};\n"],"names":["presentationPadding","chat","single","_ref","sourceItems","images","_ref$initialIndex","initialIndex","_ref$presentation","presentation","onIndexChange","onOpen","onClose","_ref$isSourceApi","isSourceApi","_useState","useState","Math","max","min","length","Number","isFinite","trunc","start","_slicedToArray","isIsolated","useIsInsideIsolatedDcApp","targetWindow","window","parent","padding","mountAnchor","useRef","items","useImageDimensions","_useState4","_useState3","activeIndex","setActiveIndex","_useState6","_useState5","statusTarget","setStatusTarget","latest","lightboxRef","previousItems","previousCore","useEffect","current","count","isReady","status","_ref2","_mountAnchor$current$","_mountAnchor$current","_mountAnchor$current2","_closingCore$element","isDisposed","lightbox","PhotoSwipeLightbox","_objectSpread","pswpModule","PhotoSwipe","appendToEl","document","body","closest","getViewportSizeFn","x","innerWidth","y","innerHeight","returnFocus","preloadFirstSlide","dataSource","loop","counter","clickToCloseNonZoomable","wheelToZoom","initialZoomLevel","secondaryZoomLevel","level","getLegacyScale","fit","maxZoomLevel","imageClickAction","zoom","close","escKey","showHideAnimationType","easing","showAnimationDuration","hideAnimationDuration","maxWidthToAnimate","Infinity","mainClass","styles","root","top","bottom","left","right","errorMsg","undefined","sourceStyles","closeSVG","renderToString","_jsx","ArrowLeftIcon","registerViewerWindow","lifecycle","registerLegacyLifecycle","_latest$current$onClo","_latest$current","releaseViewer","call","registerSourceToolbar","previousIndex","removeToolbarListeners","registerLegacyToolbar","closeImmediately","isClosing","removeWheelListeners","registerLegacyWheel","on","addFilter","physicalCount","_data","index","slideAt","id","src","width","height","alt","type","event","content","data","preventDefault","_lightbox$pswp","_lightbox$pswp$ui","pswp","ui","registerElement","name","appendTo","onInit","element","style","pointerEvents","_latest$current$onOpe","_latest$current2","_lightbox$pswp$currIn","_lightbox$pswp2","_latest$current$onInd","_latest$current3","logicalIndex","currIndex","init","closingCore","open","loadAndOpen","openAfterDestroy","queueMicrotask","isConnected","_lightbox$pswp3","off","dispose","_lightboxRef$current","before","previous","next","refreshSlideContent","_jsxs","_Fragment","children","jsx","ref","hidden","GalleryImageStatus","target"],"mappings":"stKAoBA,IAAMA,EAAsB,CAAEC,KAAM,GAAIC,OAAQ,8BAEd,SAQyBC,GAAA,IAPjDC,IAARC,OAAMC,EAAAH,EACNI,aAAAA,aAAe,EAACD,EAAAE,EAAAL,EAChBM,aAAAA,aAAe,OAAMD,EACrBE,IAAAA,cACAC,IAAAA,OACAC,IAAAA,QAAOC,EAAAV,EACPW,YAAAA,cAAmBD,EAEnBE,EAAgBC,EAAAA,UAAS,WAAA,OACvBC,KAAKC,IACH,EACAD,KAAKE,IAAIf,EAAYgB,OAAS,EAAGC,OAAOC,SAASf,GAAgBU,KAAKM,MAAMhB,GAAgB,OAHzFiB,EAKNC,EAAAA,QAAAV,EAAA,GALW,GAMNW,EAAaC,EAAAA,2BACbC,EAAeF,EAAaG,OAAOC,OAASD,OAC5CE,EAAUjB,EAAc,GAAKd,EAAoBS,GACjDuB,EAAcC,SAAwB,MACtCC,EAAQC,qBAAmB/B,GAC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,OAAQlB,EAAM4H,eAAaxH,EAAaJ,EAAMd,SAASgC,WAKjE"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var s=require("@material-ui/icons/ArrowBack"),o=require("@material-ui/icons/SaveAlt"),c=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/InfoRounded.js"),require("../../icons/customIcons/icons/FlameFilled.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/PinOne.js"),require("../../icons/customIcons/icons/PinOneCrossed.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 i=require("./GalleryViewer.scss.js"),e=require("react/jsx-runtime");function n(s){return s&&"object"==typeof s&&"default"in s?s:{default:s}}var r=n(s),u=n(o);exports.GalleryToolbar=function(s){var o=s.presentation,n=s.src;return e.jsxs(e.Fragment,{children:["single"===o&&e.jsx("div",{className:i.back,children:e.jsx("button",{type:"button","aria-label":"Close","data-action":"close",tabIndex:-1,className:i.iconButton,children:e.jsx(r.default,{className:i.toolbarIcon,htmlColor:"#b3b3b3"})})}),e.jsxs("ul",{className:i.toolbarRight,children:[e.jsx("li",{className:i.toolbarItem,children:"single"===o?e.jsx("a",{"aria-label":"Download",className:i.iconButton,href:n||void 0,"data-download":!0,download:"image",target:"_blank",rel:"noopener noreferrer",children:e.jsx(u.default,{className:i.toolbarIcon,htmlColor:"#b3b3b3"})}):e.jsx("button",{type:"button","aria-label":"Close","data-action":"close",className:i.chatClose,children:e.jsx(c.CloseIcon,{})})}),e.jsx("li",{className:i.toolbarItem,children:e.jsx("button",{type:"button","aria-label":"Zoom in",title:"Zoom in","data-action":"zoom-in",className:i.zoomIn})}),e.jsx("li",{className:i.toolbarItem,children:e.jsx("button",{type:"button","aria-label":"Zoom out",title:"Zoom out","data-action":"zoom-out",className:i.zoomOut})})]})]})};
|
|
2
|
+
//# sourceMappingURL=GalleryToolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GalleryToolbar.js","sources":["../../../../src/componentsV2/ImageViewer/GalleryToolbar.tsx"],"sourcesContent":["import BackIcon from '@material-ui/icons/ArrowBack';\nimport DownloadIcon from '@material-ui/icons/SaveAlt';\nimport { CloseIcon } from '../../icons';\nimport styles from './GalleryViewer.scss';\n\ntype Props = { presentation: 'single' | 'chat'; src?: string };\nexport const GalleryToolbar = ({ presentation, src }: Props) => (\n <>\n {presentation === 'single' && (\n <div className={styles.back}>\n <button\n type=\"button\"\n aria-label=\"Close\"\n data-action=\"close\"\n tabIndex={-1}\n className={styles.iconButton}\n >\n <BackIcon className={styles.toolbarIcon} htmlColor=\"#b3b3b3\" />\n </button>\n </div>\n )}\n <ul className={styles.toolbarRight}>\n <li className={styles.toolbarItem}>\n {presentation === 'single' ? (\n <a\n aria-label=\"Download\"\n className={styles.iconButton}\n href={src || undefined}\n data-download\n download=\"image\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n <DownloadIcon className={styles.toolbarIcon} htmlColor=\"#b3b3b3\" />\n </a>\n ) : (\n <button type=\"button\" aria-label=\"Close\" data-action=\"close\" className={styles.chatClose}>\n <CloseIcon />\n </button>\n )}\n </li>\n <li className={styles.toolbarItem}>\n <button\n type=\"button\"\n aria-label=\"Zoom in\"\n title=\"Zoom in\"\n data-action=\"zoom-in\"\n className={styles.zoomIn}\n />\n </li>\n <li className={styles.toolbarItem}>\n <button\n type=\"button\"\n aria-label=\"Zoom out\"\n title=\"Zoom out\"\n data-action=\"zoom-out\"\n className={styles.zoomOut}\n />\n </li>\n </ul>\n </>\n);\n"],"names":["_ref","presentation","src","_jsxs","_Fragment","children","_jsx","className","styles","back","jsx","type","tabIndex","iconButton","BackIcon","toolbarIcon","htmlColor","jsxs","toolbarRight","toolbarItem","href","undefined","download","target","rel","DownloadIcon","chatClose","CloseIcon","title","zoomIn","zoomOut"],"mappings":"g4IAM8B,SAAHA,GAAA,IAAMC,IAAAA,aAAcC,IAAAA,IAAG,OAChDC,EAAAA,KAAAC,EAAAA,SAAA,CAAAC,SACGJ,CAAiB,WAAjBA,GACCK,EAAAA,IAAA,MAAA,CAAKC,UAAWC,EAAOC,KAAKJ,SAC1BC,EAAAI,IAAA,SAAA,CACEC,KAAK,SACL,aAAW,QACX,cAAY,QACZC,UAAW,EACXL,UAAWC,EAAOK,WAAWR,SAE7BC,MAACQ,UAAQ,CAACP,UAAWC,EAAOO,YAAaC,UAAU,gBAIzDb,EAAAc,KAAA,KAAA,CAAIV,UAAWC,EAAOU,aAAab,SACjC,CAAAC,EAAAI,IAAA,KAAA,CAAIH,UAAWC,EAAOW,YAAYd,SACd,WAAjBJ,EACCK,EAAAA,IAAA,IAAA,CACE,aAAW,WACXC,UAAWC,EAAOK,WAClBO,KAAMlB,QAAOmB,EACb,iBAAa,EACbC,SAAS,QACTC,OAAO,SACPC,IAAI,sBAAqBnB,SAEzBC,MAACmB,UAAY,CAAClB,UAAWC,EAAOO,YAAaC,UAAU,cAGzDV,EAAAI,IAAA,SAAA,CAAQC,KAAK,SAAS,aAAW,QAAQ,cAAY,QAAQJ,UAAWC,EAAOkB,UAAUrB,SACvFC,EAAAA,IAACqB,EAASA,UAAA,QAIhBrB,EAAAI,IAAA,KAAA,CAAIH,UAAWC,EAAOW,YAAYd,SAChCC,EAAAI,IAAA,SAAA,CACEC,KAAK,SACL,aAAW,UACXiB,MAAM,UACN,cAAY,UACZrB,UAAWC,EAAOqB,WAGtBvB,EAAAI,IAAA,KAAA,CAAIH,UAAWC,EAAOW,YAAYd,SAChCC,EAAAI,IAAA,SAAA,CACEC,KAAK,SACL,aAAW,WACXiB,MAAM,WACN,cAAY,WACZrB,UAAWC,EAAOsB,iBAIvB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";require('./../../ext-esm/style-inject/dist/style-inject.es.js')('@keyframes GalleryViewer_galleryOpen__LMnDO{0%{opacity:1}to{opacity:0}}.GalleryViewer_root__qlkGN{animation:GalleryViewer_galleryOpen__LMnDO .3s ease reverse}.GalleryViewer_root__qlkGN .pswp__top-bar{background:rgba(0,0,0,.5);display:block;height:50px}.GalleryViewer_root__qlkGN .pswp__preloader{left:50%;margin:0;position:absolute}.GalleryViewer_root__qlkGN .pswp__gallery-toolbar{font-family:Roboto,sans-serif;font-size:16px;height:0;left:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:10}.GalleryViewer_root__qlkGN .pswp__gallery-toolbar>*{pointer-events:auto}.GalleryViewer_root__qlkGN .GalleryViewer_toolbarRight__4WBmA{height:50px;margin:0;padding:0 20px 0 0;position:absolute;right:0;top:0}.GalleryViewer_root__qlkGN .GalleryViewer_toolbarItem__PR-3g{color:#fff;display:inline-block;font-size:120%;line-height:50px;max-width:100%;overflow:hidden;padding:0;text-overflow:ellipsis;white-space:nowrap}.GalleryViewer_root__qlkGN .GalleryViewer_zoomIn__IEiTd,.GalleryViewer_root__qlkGN .GalleryViewer_zoomOut__HX0sI{border:0;cursor:pointer;height:35px;opacity:.7;vertical-align:middle;width:40px}.GalleryViewer_root__qlkGN .GalleryViewer_zoomIn__IEiTd{background:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCI+PGcgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCI+PHBhdGggZD0ibTEgMTkgNi02TTkgOGg2TTEyIDV2NiIvPjwvZz48Y2lyY2xlIGN4PSIxMiIgY3k9IjgiIHI9IjciIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLXdpZHRoPSIyIi8+PC9zdmc+") no-repeat 50%}.GalleryViewer_root__qlkGN .GalleryViewer_zoomOut__HX0sI{background:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCI+PGcgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCI+PHBhdGggZD0ibTEgMTkgNi02TTkgOGg2Ii8+PC9nPjxjaXJjbGUgY3g9IjEyIiBjeT0iOCIgcj0iNyIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjIiLz48L3N2Zz4=") no-repeat 50%}.GalleryViewer_root__qlkGN .GalleryViewer_zoomIn__IEiTd:hover,.GalleryViewer_root__qlkGN .GalleryViewer_zoomOut__HX0sI:hover{opacity:1}.GalleryViewer_root__qlkGN .GalleryViewer_zoomIn__IEiTd:disabled,.GalleryViewer_root__qlkGN .GalleryViewer_zoomOut__HX0sI:disabled{cursor:default;opacity:.5}.GalleryViewer_root__qlkGN .GalleryViewer_iconButton__QT0yW{align-items:center;background:transparent;border:0;cursor:pointer;display:inline-flex;justify-content:center;padding:0;vertical-align:middle}.GalleryViewer_root__qlkGN .GalleryViewer_toolbarIcon__Wwrfu{height:34px;padding:4px 6px;width:42px}.GalleryViewer_root__qlkGN .GalleryViewer_back__AGIVh{left:5px;position:absolute;top:5px}.GalleryViewer_root__qlkGN .GalleryViewer_chatClose__UpVdA{align-items:center;background:none;border:none;color:#fff;cursor:pointer;display:inline-flex;justify-content:center;line-height:50px;opacity:.7;padding:8px;vertical-align:middle}.GalleryViewer_root__qlkGN .GalleryViewer_chatClose__UpVdA:hover{opacity:1}.GalleryViewer_root__qlkGN .pswp__button--arrow{border:none;bottom:0;box-sizing:border-box;height:34px;margin:auto;padding:40px 30px;top:0;width:20px}.GalleryViewer_root__qlkGN .pswp__button--arrow--prev{background:rgba(0,0,0,.2) url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIzNCI+PHBhdGggZD0ibTE5IDMtMi0yTDEgMTdsMTYgMTYgMS0xTDMgMTcgMTggMnoiIGZpbGw9IiNGRkYiLz48L3N2Zz4=") no-repeat 50%;left:0;right:auto}.GalleryViewer_root__qlkGN .pswp__button--arrow--next{background:rgba(0,0,0,.2) url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIzNCI+PHBhdGggZD0ibTEgMyAyLTIgMTYgMTZMMyAzM2wtMS0xIDE1LTE1TDIgMnoiIGZpbGw9IiNGRkYiLz48L3N2Zz4=") no-repeat 50%;left:auto;right:0}.GalleryViewer_root__qlkGN .pswp__button--arrow .pswp__icn{display:none}.GalleryViewer_root__qlkGN.pswp--ui-visible .pswp__button--arrow{opacity:.7}.GalleryViewer_root__qlkGN.pswp--ui-visible .pswp__button--arrow:hover{opacity:1}.GalleryViewer_root__qlkGN.pswp--ui-visible .pswp__button--arrow:active{opacity:.7}.GalleryViewer_imageStatus__XIrsh{align-items:center;color:#fff;display:flex;inset:0;justify-content:center;pointer-events:none;position:absolute}'),module.exports={root:"GalleryViewer_root__qlkGN",galleryOpen:"GalleryViewer_galleryOpen__LMnDO",toolbarRight:"GalleryViewer_toolbarRight__4WBmA",toolbarItem:"GalleryViewer_toolbarItem__PR-3g",zoomIn:"GalleryViewer_zoomIn__IEiTd",zoomOut:"GalleryViewer_zoomOut__HX0sI",iconButton:"GalleryViewer_iconButton__QT0yW",toolbarIcon:"GalleryViewer_toolbarIcon__Wwrfu",back:"GalleryViewer_back__AGIVh",chatClose:"GalleryViewer_chatClose__UpVdA",imageStatus:"GalleryViewer_imageStatus__XIrsh"};
|
|
2
|
+
//# sourceMappingURL=GalleryViewer.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,qBAAqB,sDAAyD;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),r=require("react"),t=require("./GalleryImageViewer.js"),n=require("react/jsx-runtime");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=i(e);function c(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}exports.ImageViewer=function(e){var i=e.src,u=e.width,s=e.height,a=r.useMemo((function(){return[{id:"source",src:i||"",width:u,height:s}]}),[i,u,s]);return void 0!==e.images?e.images.length?n.jsx(t.GalleryImageViewer,function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?c(Object(t),!0).forEach((function(r){o.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):c(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}({},e)):null:i?n.jsx(t.GalleryImageViewer,{images:a,isSourceApi:!0,onOpen:e.onOpen,onClose:e.onClose}):null};
|
|
2
2
|
//# sourceMappingURL=ImageViewer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageViewer.js","sources":["../../../../src/componentsV2/ImageViewer/ImageViewer.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { renderToString } from 'react-dom/server';\nimport PhotoSwipeLightbox from 'photoswipe/lightbox';\nimport PhotoSwipe from 'photoswipe';\n\nimport 'photoswipe/photoswipe.css';\nimport { useIsInsideIsolatedDcApp } from '../../components/DevCenter/DevCenterAppContainer/components/IsInsideIsolatedDcAppProvider';\n\nimport styles from './ImageViewer.scss';\n\nimport { ArrowLeftIcon, DownloadIcon, ZoomInIcon, ZoomOutIcon } from '~/icons';\n\nexport type ImageViewerProps = {\n src?: string;\n width?: number;\n height?: number;\n onClose?: () => void;\n onOpen?: () => void;\n};\n\nconst MaxZoomLevel = 2;\nconst ZoomStep = 0.5;\n\nexport const ImageViewer = ({ src, onClose, onOpen, height, width }: ImageViewerProps) => {\n const isInDcApp = useIsInsideIsolatedDcApp();\n\n const [imageSize, setImageSize] = useState<{ width: number; height: number } | undefined>(() => {\n if (width && height) {\n return { height, width };\n }\n return undefined;\n });\n\n useEffect(() => {\n if (src && !imageSize) {\n const img = new Image();\n img.onload = e => {\n const { naturalWidth, naturalHeight } = e.currentTarget as unknown as HTMLImageElement;\n setImageSize({ width: naturalWidth, height: naturalHeight });\n };\n img.src = src;\n }\n }, [src, imageSize]);\n\n useEffect(() => {\n if (!src || !imageSize) {\n return undefined;\n }\n\n // eslint-disable-next-line no-restricted-globals\n const targetWindowObj = isInDcApp ? parent : window;\n const lightbox = new PhotoSwipeLightbox({\n pswpModule: PhotoSwipe,\n dataSource: [\n {\n src,\n width: imageSize.width,\n height: imageSize.height,\n },\n ],\n clickToCloseNonZoomable: false,\n wheelToZoom: true,\n initialZoomLevel: 'fit',\n padding: { top: 50, bottom: 50, left: 50, right: 50 },\n // eslint-disable-next-line no-restricted-globals\n appendToEl: targetWindowObj.document.body,\n getViewportSizeFn: () => ({\n x: targetWindowObj.innerWidth,\n y: targetWindowObj.innerHeight,\n }),\n maxZoomLevel: MaxZoomLevel,\n mainClass: styles.root,\n closeSVG: renderToString(<ArrowLeftIcon />),\n // zoomSVG: renderToString(\n // <>\n // <ZoomInIcon />\n // <ZoomOutIcon />\n // </>\n // ),\n });\n\n lightbox.on('bindEvents', () => {\n const { pswp } = lightbox;\n\n if (pswp && isInDcApp) {\n // Filtering events and reassigning handlers to parent window\n // For this we get into the guts of photoswipe's event handler manager\n // This is fragile because we access the \"private\" property but there's no other way to re-bind those listeners\n /* eslint-disable no-underscore-dangle */\n // @ts-expect-error accessing \"private\" property of `events`\n const pool = pswp.events._pool.slice();\n /* eslint-enable no-underscore-dangle */\n\n pool.forEach(\n ({\n target,\n type,\n listener,\n passive,\n }: {\n target: Parameters<typeof pswp['events']['add']>[0];\n type: Parameters<typeof pswp['events']['add']>[1];\n listener: Parameters<typeof pswp['events']['add']>[2];\n passive: Parameters<typeof pswp['events']['add']>[3];\n }) => {\n if (target === window) {\n pswp.events.remove(target, type, listener, passive);\n pswp.events.add(targetWindowObj, type, listener, passive);\n }\n\n if (target === document) {\n pswp.events.remove(target, type, listener, passive);\n pswp.events.add(targetWindowObj.document, type, listener, passive);\n }\n }\n );\n }\n });\n\n lightbox.on('uiRegister', () => {\n const ui = lightbox?.pswp?.ui;\n\n ui?.registerElement({\n name: 'download-button',\n order: 7,\n isButton: true,\n tagName: 'a',\n\n html: renderToString(<DownloadIcon className=\"pswp__icn\" />),\n\n onInit: (el, pswp) => {\n el.setAttribute('download', '');\n el.setAttribute('target', '_blank');\n el.setAttribute('rel', 'noopener');\n\n pswp?.on('change', () => {\n // eslint-disable-next-line no-param-reassign\n (el as HTMLAnchorElement).href = pswp?.currSlide?.data.src || '';\n });\n },\n });\n\n ui?.registerElement({\n name: 'zoom-in-button',\n order: 8,\n isButton: true,\n tagName: 'button',\n html: renderToString(<ZoomInIcon className=\"pswp__icn\" />),\n onInit: (el, pswp) => {\n pswp.on('zoomPanUpdate', e => {\n const button = el as HTMLButtonElement;\n const zoomLevel = pswp.currSlide?.currZoomLevel || 1;\n\n if (e.slide === pswp.currSlide) {\n button.disabled = zoomLevel >= MaxZoomLevel;\n }\n });\n },\n onClick: (_e, _el, pswp) => {\n if (!pswp?.currSlide?.currZoomLevel) {\n return;\n }\n\n const rawNewZoom = pswp.currSlide.currZoomLevel + ZoomStep;\n const newZoom = Math.min(Math.floor(rawNewZoom / ZoomStep) * ZoomStep, MaxZoomLevel);\n\n pswp.currSlide.zoomTo(newZoom, undefined);\n },\n });\n\n const initialZoomLevelsMap = new WeakMap<object, number | undefined>();\n ui?.registerElement({\n name: 'zoom-out-button',\n order: 9,\n isButton: true,\n tagName: 'button',\n html: renderToString(<ZoomOutIcon className=\"pswp__icn\" />),\n onInit: (el, pswp) => {\n pswp.on('zoomPanUpdate', e => {\n const button = el as HTMLButtonElement;\n const zoomLevel = pswp.currSlide?.currZoomLevel || 1;\n\n if (e.slide === pswp.currSlide) {\n // First run - save current zoom as minimal\n if (!initialZoomLevelsMap.get(pswp.currSlide)) {\n initialZoomLevelsMap.set(pswp.currSlide, zoomLevel);\n }\n\n button.disabled = zoomLevel <= (initialZoomLevelsMap.get(pswp.currSlide) || 1);\n }\n });\n },\n onClick: (_e, _el, pswp) => {\n if (!pswp?.currSlide?.currZoomLevel || !initialZoomLevelsMap.get(pswp.currSlide)) {\n return;\n }\n\n const rawNewZoom = pswp.currSlide.currZoomLevel - ZoomStep;\n const newZoom = Math.max(\n Math.ceil(rawNewZoom / ZoomStep) * ZoomStep,\n initialZoomLevelsMap.get(pswp.currSlide) || 1\n );\n\n pswp.currSlide.zoomTo(newZoom, undefined);\n },\n });\n });\n\n lightbox.on('close', () => {\n onClose?.();\n });\n\n lightbox.on('destroy', () => {\n onClose?.();\n });\n\n lightbox.on('initialLayout', () => {\n onOpen?.();\n });\n\n lightbox.init();\n lightbox.loadAndOpen(0);\n\n return () => {\n lightbox.destroy();\n };\n }, [src, isInDcApp, onClose, onOpen, imageSize]);\n\n return <></>;\n};\n"],"names":["_ref","src","onClose","onOpen","height","width","isInDcApp","useIsInsideIsolatedDcApp","useState","_useState2","_slicedToArray","_useState","imageSize","setImageSize","useEffect","img","Image","onload","e","currentTarget","naturalWidth","naturalHeight","targetWindowObj","parent","window","lightbox","PhotoSwipeLightbox","pswpModule","PhotoSwipe","dataSource","clickToCloseNonZoomable","wheelToZoom","initialZoomLevel","padding","top","bottom","left","right","appendToEl","document","body","getViewportSizeFn","x","innerWidth","y","innerHeight","maxZoomLevel","mainClass","styles","root","closeSVG","renderToString","_jsx","ArrowLeftIcon","on","pswp","events","_pool","slice","forEach","_ref3","target","type","listener","passive","remove","add","_lightbox$pswp","ui","registerElement","name","order","isButton","tagName","html","jsx","DownloadIcon","className","onInit","el","setAttribute","_pswp$currSlide","href","currSlide","data","ZoomInIcon","_pswp$currSlide2","button","zoomLevel","currZoomLevel","slide","disabled","onClick","_e","_el","_pswp$currSlide3","rawNewZoom","newZoom","Math","min","floor","zoomTo","undefined","initialZoomLevelsMap","WeakMap","ZoomOutIcon","_pswp$currSlide4","get","set","_pswp$currSlide5","max","ceil","init","loadAndOpen","destroy","_Fragment"],"mappings":"+lJAuB2B,SAA+DA,GAAA,IAA5DC,IAAAA,IAAKC,IAAAA,QAASC,IAAAA,OAAQC,IAAAA,OAAQC,IAAAA,MACpDC,EAAYC,EAAAA,2BAEgBC,EAAAA,EAAAA,UAAwD,W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AsB,EAASuF,OACTvF,EAASwF,YAAY,GAEd,WACLxF,EAASyF,UAjLX,CAmLF,GAAG,CAACjH,EAAKK,EAAWJ,EAASC,EAAQS,IAE9BwC,EAAKuB,IAAAwC,WAAA,CAAA,EACd"}
|
|
1
|
+
{"version":3,"file":"ImageViewer.js","sources":["../../../../src/componentsV2/ImageViewer/ImageViewer.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { GalleryImageViewer } from './GalleryImageViewer';\nimport { ImageViewerProps } from './types';\n\nexport type { ImageViewerProps, ImageViewerItem } from './types';\n\nexport const ImageViewer = (props: ImageViewerProps) => {\n const { src, width, height } = props;\n const sourceImages = useMemo(\n () => [{ id: 'source', src: src || '', width, height }],\n [src, width, height]\n );\n if (props.images !== undefined) {\n return !!props.images.length ? <GalleryImageViewer {...props} /> : null;\n }\n return src ? (\n <GalleryImageViewer\n images={sourceImages}\n isSourceApi\n onOpen={props.onOpen}\n onClose={props.onClose}\n />\n ) : null;\n};\n"],"names":["props","src","width","height","sourceImages","useMemo","id","undefined","images","length","_jsx","jsx","GalleryImageViewer","_objectSpread","isSourceApi","onOpen","onClose"],"mappings":"uhBAM2B,SAACA,GAC1B,IAAQC,EAAuBD,EAAvBC,IAAKC,EAAkBF,EAAlBE,MAAOC,EAAWH,EAAXG,OACdC,EAAeC,EAAAA,SACnB,WAAA,MAAM,CAAC,CAAEC,GAAI,SAAUL,IAAKA,GAAO,GAAIC,MAAAA,EAAOC,OAAAA,GAAS,GACvD,CAACF,EAAKC,EAAOC,IAEf,YAAqBI,IAAjBP,EAAMQ,OACCR,EAAMQ,OAAOC,OAASC,EAAAC,IAACC,4XAAkBC,CAAA,CAAA,EAAKb,IAAY,KAE9DC,EACLS,EAAAC,IAACC,qBAAkB,CACjBJ,OAAQJ,EACRU,aAAW,EACXC,OAAQf,EAAMe,OACdC,QAAShB,EAAMgB,UAEf,IACN"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.createLegacyWheel=function(e){var t,i,a=e.zoom,o=e.move,n=e.isAnimating,r=0,s=!1;return{handle:function(e){var u=e.deltaX,c=e.deltaY,l=e.clientX,f=e.clientY,d=e.isOnImage;if(!s){if(d&&Math.abs(c)>=Math.abs(u)){if(Math.abs(c)<1)return;return r=0,void a(-c,{x:l,y:f})}if(clearTimeout(t),t=setTimeout((function(){r=0}),300),void 0===i&&!n()&&Math.abs(c)<Math.abs(u)){var m=(r+=u)>=200||u>=100?1:r<=-200||u<=-100?-1:0;m&&(o(m),r=0,i=setTimeout((function(){i=void 0}),500))}}},dispose:function(){s=!0,clearTimeout(t),clearTimeout(i)}}};
|
|
2
|
+
//# sourceMappingURL=legacyWheel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacyWheel.js","sources":["../../../../src/componentsV2/ImageViewer/legacyWheel.ts"],"sourcesContent":["type Point = { x: number; y: number };\ntype Input = {\n deltaX: number;\n deltaY: number;\n clientX: number;\n clientY: number;\n isOnImage: boolean;\n};\ntype Options = {\n zoom: (delta: number, point: Point) => void;\n move: (direction: number) => void;\n isAnimating: () => boolean;\n};\n\nexport const createLegacyWheel = ({ zoom, move, isAnimating }: Options) => {\n let scrollX = 0;\n let resetTimer: ReturnType<typeof setTimeout> | undefined;\n let actionTimer: ReturnType<typeof setTimeout> | undefined;\n let isDisposed = false;\n return {\n handle: ({ deltaX, deltaY, clientX, clientY, isOnImage }: Input) => {\n if (isDisposed) return;\n if (isOnImage && Math.abs(deltaY) >= Math.abs(deltaX)) {\n if (Math.abs(deltaY) < 1) return;\n scrollX = 0;\n zoom(-deltaY, { x: clientX, y: clientY });\n return;\n }\n clearTimeout(resetTimer);\n resetTimer = setTimeout(() => {\n scrollX = 0;\n }, 300);\n if (actionTimer !== undefined || isAnimating()) return;\n if (Math.abs(deltaY) < Math.abs(deltaX)) {\n scrollX += deltaX;\n const direction =\n scrollX >= 200 || deltaX >= 100 ? 1 : scrollX <= -200 || deltaX <= -100 ? -1 : 0;\n if (direction) {\n move(direction);\n scrollX = 0;\n actionTimer = setTimeout(() => {\n actionTimer = undefined;\n }, 500);\n }\n }\n },\n dispose: () => {\n isDisposed = true;\n clearTimeout(resetTimer);\n clearTimeout(actionTimer);\n },\n };\n};\n"],"names":["_ref","resetTimer","actionTimer","zoom","move","isAnimating","scrollX","isDisposed","handle","_ref2","deltaX","deltaY","clientX","clientY","isOnImage","Math","abs","x","y","clearTimeout","setTimeout","undefined","direction","dispose"],"mappings":"8FAciC,SAA0CA,GAAA,IAErEC,EACAC,EAH8BC,IAAAA,KAAMC,IAAAA,KAAMC,IAAAA,YAC1CC,EAAU,EAGVC,GAAa,EACjB,MAAO,CACLC,OAAQ,SAA4DC,GAAA,IAAzDC,IAAAA,OAAQC,IAAAA,OAAQC,IAAAA,QAASC,IAAAA,QAASC,IAAAA,UAC3C,IAAIP,EAAJ,CACA,GAAIO,GAAaC,KAAKC,IAAIL,IAAWI,KAAKC,IAAIN,GAAS,CACrD,GAAIK,KAAKC,IAAIL,GAAU,EAAG,OAG1B,OAFAL,EAAU,OACVH,GAAMQ,EAAQ,CAAEM,EAAGL,EAASM,EAAGL,GAEjC,CAKA,GAJAM,aAAalB,GACbA,EAAamB,YAAW,WACtBd,EAAU,CACX,GAAE,UACiBe,IAAhBnB,IAA6BG,KAC7BU,KAAKC,IAAIL,GAAUI,KAAKC,IAAIN,GAAS,CAEvC,IAAMY,GADNhB,GAAWI,IAEE,KAAOA,GAAU,IAAM,EAAIJ,IAAY,KAAOI,IAAW,KAAO,EAAI,EAC7EY,IACFlB,EAAKkB,GACLhB,EAAU,EACVJ,EAAckB,YAAW,WACvBlB,OAAcmB,CACf,GAAE,KAEP,CAvBgB,CAwBjB,EACDE,QAAS,WACPhB,GAAa,EACbY,aAAalB,GACbkB,aAAajB,EACf,EAEJ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.LEGACY_MAX_LEVEL=300,exports.LEGACY_STEP=100,exports.getLegacyLevel=function(e,t){var r=Math.log(t/e)/Math.log(1.007);return r<1e-6?0:r>299.999999?300:r},exports.getLegacyScale=function(e,t){return e*Math.pow(1.007,t)},exports.getNextLegacyLevel=function(e,t){return Math.max(0,Math.min(300,e+t))};
|
|
2
|
+
//# sourceMappingURL=legacyZoom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacyZoom.js","sources":["../../../../src/componentsV2/ImageViewer/legacyZoom.ts"],"sourcesContent":["export const LEGACY_MAX_LEVEL = 300;\nexport const LEGACY_STEP = 100;\nexport const getLegacyScale = (fit: number, level: number) => fit * 1.007 ** level;\nexport const getLegacyLevel = (fit: number, scale: number) => {\n const level = Math.log(scale / fit) / Math.log(1.007);\n if (level < 0.000001) return 0;\n if (level > LEGACY_MAX_LEVEL - 0.000001) return LEGACY_MAX_LEVEL;\n return level;\n};\nexport const getNextLegacyLevel = (level: number, delta: number) =>\n Math.max(0, Math.min(LEGACY_MAX_LEVEL, level + delta));\n"],"names":["fit","scale","level","Math","log","LEGACY_MAX_LEVEL","pow","delta","max","min"],"mappings":"6FAAgC,wBACL,2BAEG,SAACA,EAAaC,GAC1C,IAAMC,EAAQC,KAAKC,IAAIH,EAAQD,GAAOG,KAAKC,IAAI,OAC/C,OAAIF,EAAQ,KAAiB,EACzBA,EAAQG,WANkB,IAOvBH,CACT,yBAN8B,SAACF,EAAaE,GAAa,OAAKF,EAAGG,KAAAG,IAAG,MAASJ,EAAK,6BAOhD,SAACA,EAAeK,GAAa,OAC7DJ,KAAKK,IAAI,EAAGL,KAAKM,IAVa,IAUSP,EAAQK,GAAO"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=function(e,t){return(e%t+t)%t};exports.logicalIndex=e,exports.physicalCount=function(e){return 2===e?4:e},exports.slideAt=function(t,r){return t[e(r,t.length)]};
|
|
2
|
+
//# sourceMappingURL=logicalSlides.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logicalSlides.js","sources":["../../../../src/componentsV2/ImageViewer/logicalSlides.ts"],"sourcesContent":["export const physicalCount = (count: number) => (count === 2 ? 4 : count);\nexport const logicalIndex = (index: number, count: number) => ((index % count) + count) % count;\nexport const slideAt = <T>(items: T[], index: number): T =>\n items[logicalIndex(index, items.length)];\n"],"names":["logicalIndex","index","count","items","length"],"mappings":"wEACaA,EAAe,SAACC,EAAeC,GAAa,OAAOD,EAAQC,EAASA,GAASA,CAAK,+CADlE,SAACA,GAAa,OAAgB,IAAVA,EAAc,EAAIA,CAAK,kBAEjD,SAAIC,EAAYF,GAAa,OAClDE,EAAMH,EAAaC,EAAOE,EAAMC,QAAQ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.registerLegacyLifecycle=function(e,t){var n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window,r=o.document,i=document.activeElement instanceof HTMLElement?document.activeElement:null,l=e.pswp,u=!1,a=!1,d=!1,s=!1,y=function(){n&&(n.forEach((function(e){var t=e.property,n=e.value,o=e.priority;r.body.style.setProperty(t,n,o)})),n=void 0)},c=function(){a||d||(d=!0,t())},f=function(){null!=i&&i.isConnected&&i.focus()},v=function(){var e;null!==(e=l)&&void 0!==e&&e.element&&(l.element.style.display="none")},p=function(){u||a||(u=!0,v(),l?l.destroy():(e.destroy(),s=!0,r.removeEventListener("keydown",m,!0),c()),f())},m=function(e){var t;if("Tab"===e.key&&null!==(t=l)&&void 0!==t&&t.element&&!u&&!a){var n,i=l.element,d=Array.from(i.querySelectorAll("button, [href], input, select, textarea, [tabindex]")).filter((function(e){if(e.tabIndex<0||e.matches(':disabled, [aria-disabled="true"]'))return!1;for(var t=e;t;t=t.parentElement){var n=o.getComputedStyle(t);if(t.hidden||t.hasAttribute("inert")||"true"===t.getAttribute("aria-hidden")||"none"===n.display||"hidden"===n.visibility||"collapse"===n.visibility)return!1;if(t===i)break}return!0})),s=d.findIndex((function(e){return e===r.activeElement})),y=e.shiftKey?s<=0?d.length-1:s-1:(s+1)%d.length;return e.preventDefault(),e.stopPropagation(),void(null!==(n=d[y])&&void 0!==n?n:i).focus()}"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),p())};return r.addEventListener("keydown",m,!0),e.on("afterInit",(function(){var t;l=e.pswp,a||u?v():null!==(t=l)&&void 0!==t&&t.element&&(l.element.setAttribute("aria-label","Lightbox"),l.element.setAttribute("aria-modal","true"),"hidden"!==o.getComputedStyle(r.body).overflow&&(n=["overflow","overflow-x","overflow-y"].map((function(e){return{property:e,value:r.body.style.getPropertyValue(e),priority:r.body.style.getPropertyPriority(e)}})),r.body.style.setProperty("overflow","hidden",n[0].priority)),l.element.focus())})),e.on("openingAnimationEnd",(function(){var e;(u||a)&&(null===(e=l)||void 0===e||e.destroy())})),e.on("close",(function(){var e;u=!0,null!==(e=l)&&void 0!==e&&e.element&&(l.element.style.animation="none")})),e.on("destroy",(function(){s=!0,y(),r.removeEventListener("keydown",m,!0),queueMicrotask((function(){f(),u&&c()}))})),{closeImmediately:p,isClosing:function(){return u||a},dispose:function(){a=!0,y(),r.removeEventListener("keydown",m,!0),s||(v(),e.destroy(),f())}}};
|
|
2
|
+
//# sourceMappingURL=registerLegacyLifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerLegacyLifecycle.js","sources":["../../../../src/componentsV2/ImageViewer/registerLegacyLifecycle.ts"],"sourcesContent":["import PhotoSwipeLightbox from 'photoswipe/lightbox';\n\nexport const registerLegacyLifecycle = (\n lightbox: PhotoSwipeLightbox,\n onClose: () => void,\n targetWindow: Window = window\n) => {\n const targetDocument = targetWindow.document;\n const opener = document.activeElement instanceof HTMLElement ? document.activeElement : null;\n let core = lightbox.pswp;\n let isClosing = false;\n let isDisposed = false;\n let isNotified = false;\n let isDestroyed = false;\n let originalOverflow: { property: string; value: string; priority: string }[] | undefined;\n const restoreOverflow = () => {\n if (!originalOverflow) return;\n originalOverflow.forEach(({ property, value, priority }) => {\n targetDocument.body.style.setProperty(property, value, priority);\n });\n originalOverflow = undefined;\n };\n const notify = () => {\n if (isDisposed || isNotified) return;\n isNotified = true;\n onClose();\n };\n const restoreFocus = () => {\n if (opener?.isConnected) opener.focus();\n };\n const hide = () => {\n if (core?.element) core.element.style.display = 'none';\n };\n const closeImmediately = () => {\n if (isClosing || isDisposed) return;\n isClosing = true;\n hide();\n if (core) core.destroy();\n else {\n // No core exists yet, so no destroy event will be dispatched. Cancel the\n // pending module promise and release our listener before notifying callers.\n lightbox.destroy();\n isDestroyed = true;\n targetDocument.removeEventListener('keydown', handleKeyDown, true);\n notify();\n }\n restoreFocus();\n };\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Tab' && core?.element && !isClosing && !isDisposed) {\n const root = core.element;\n const controls = Array.from(\n root.querySelectorAll<HTMLElement>('button, [href], input, select, textarea, [tabindex]')\n ).filter(control => {\n if (control.tabIndex < 0 || control.matches(':disabled, [aria-disabled=\"true\"]'))\n return false;\n for (let element: HTMLElement | null = control; element; element = element.parentElement) {\n const style = targetWindow.getComputedStyle(element);\n if (\n element.hidden ||\n element.hasAttribute('inert') ||\n element.getAttribute('aria-hidden') === 'true' ||\n style.display === 'none' ||\n style.visibility === 'hidden' ||\n style.visibility === 'collapse'\n )\n return false;\n if (element === root) break;\n }\n return true;\n });\n const index = controls.findIndex(control => control === targetDocument.activeElement);\n const nextIndex = event.shiftKey\n ? index <= 0\n ? controls.length - 1\n : index - 1\n : (index + 1) % controls.length;\n event.preventDefault();\n event.stopPropagation();\n (controls[nextIndex] ?? root).focus();\n return;\n }\n if (event.key !== 'Escape') return;\n event.preventDefault();\n event.stopPropagation();\n closeImmediately();\n };\n targetDocument.addEventListener('keydown', handleKeyDown, true);\n lightbox.on('afterInit', () => {\n core = lightbox.pswp;\n if (isDisposed || isClosing) hide();\n else if (core?.element) {\n core.element.setAttribute('aria-label', 'Lightbox');\n core.element.setAttribute('aria-modal', 'true');\n // An enclosing modal owns an existing lock and may release it before our\n // unmount cleanup. Do not restore its old lock after that parent is gone.\n if (targetWindow.getComputedStyle(targetDocument.body).overflow !== 'hidden') {\n // The shorthand overwrites both axes, including separately declared priorities.\n originalOverflow = ['overflow', 'overflow-x', 'overflow-y'].map(property => ({\n property,\n value: targetDocument.body.style.getPropertyValue(property),\n priority: targetDocument.body.style.getPropertyPriority(property),\n }));\n targetDocument.body.style.setProperty('overflow', 'hidden', originalOverflow[0].priority);\n }\n core.element.focus();\n }\n });\n lightbox.on('openingAnimationEnd', () => {\n // PhotoSwipe ignores destroy while opening. Finish an earlier close or unmount\n // once the opener can close, so its DOM and global instance are released.\n if (isClosing || isDisposed) core?.destroy();\n });\n lightbox.on('close', () => {\n isClosing = true;\n if (core?.element) core.element.style.animation = 'none';\n });\n lightbox.on('destroy', () => {\n isDestroyed = true;\n restoreOverflow();\n targetDocument.removeEventListener('keydown', handleKeyDown, true);\n // destroy is dispatched before DOM/content cleanup and native focus restoration.\n queueMicrotask(() => {\n restoreFocus();\n if (isClosing) notify();\n });\n });\n return {\n closeImmediately,\n isClosing: () => isClosing || isDisposed,\n dispose: () => {\n isDisposed = true;\n restoreOverflow();\n targetDocument.removeEventListener('keydown', handleKeyDown, true);\n if (!isDestroyed) {\n hide();\n lightbox.destroy();\n restoreFocus();\n }\n },\n };\n};\n"],"names":["lightbox","onClose","originalOverflow","targetWindow","window","targetDocument","document","opener","activeElement","HTMLElement","core","pswp","isClosing","isDisposed","isNotified","isDestroyed","restoreOverflow","forEach","_ref","property","value","priority","body","style","setProperty","undefined","notify","restoreFocus","isConnected","focus","hide","_core","element","display","closeImmediately","destroy","removeEventListener","handleKeyDown","event","_core2","key","_controls$nextIndex","root","controls","Array","from","querySelectorAll","filter","control","tabIndex","matches","parentElement","getComputedStyle","hidden","hasAttribute","getAttribute","visibility","index","findIndex","nextIndex","shiftKey","length","preventDefault","stopPropagation","addEventListener","on","_core3","setAttribute","overflow","map","getPropertyValue","getPropertyPriority","_core4","_core5","animation","queueMicrotask","dispose"],"mappings":"oGAEuC,SACrCA,EACAC,GAEG,IAQCC,EATJC,yDAAuBC,OAEjBC,EAAiBF,EAAaG,SAC9BC,EAASD,SAASE,yBAAyBC,YAAcH,SAASE,cAAgB,KACpFE,EAAOV,EAASW,KAChBC,GAAY,EACZC,GAAa,EACbC,GAAa,EACbC,GAAc,EAEZC,EAAkB,WACjBd,IACLA,EAAiBe,SAAQ,SAAmCC,GAAA,IAAhCC,IAAAA,SAAUC,IAAAA,MAAOC,IAAAA,SAC3ChB,EAAeiB,KAAKC,MAAMC,YAAYL,EAAUC,EAAOC,EACzD,IACAnB,OAAmBuB,IAEfC,EAAS,WACTb,GAAcC,IAClBA,GAAa,EACbb,MAEI0B,EAAe,WACfpB,SAAAA,EAAQqB,aAAarB,EAAOsB,SAE5BC,EAAO,WAAM,IAAAC,EACT,QAARA,EAAIrB,SAAI,IAAAqB,GAAJA,EAAMC,UAAStB,EAAKsB,QAAQT,MAAMU,QAAU,SAE5CC,EAAmB,WACnBtB,GAAaC,IACjBD,GAAY,EACZkB,IACIpB,EAAMA,EAAKyB,WAIbnC,EAASmC,UACTpB,GAAc,EACdV,EAAe+B,oBAAoB,UAAWC,GAAe,GAC7DX,KAEFC,MAEIU,EAAgB,SAACC,GAAyB,IAAAC,EAC9C,GAAkB,QAAdD,EAAME,KAAqB,UAAJ9B,SAAI,IAAA6B,GAAJA,EAAMP,UAAYpB,IAAcC,EAAY,CAAA,IAAA4B,EAC/DC,EAAOhC,EAAKsB,QACZW,EAAWC,MAAMC,KACrBH,EAAKI,iBAA8B,wDACnCC,QAAO,SAAAC,GACP,GAAIA,EAAQC,SAAW,GAAKD,EAAQE,QAAQ,qCAC1C,OAAO,EACT,IAAK,IAAIlB,EAA8BgB,EAAShB,EAASA,EAAUA,EAAQmB,cAAe,CACxF,IAAM5B,EAAQpB,E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,IACAnC,EAASiE,GAAG,SAAS,WAAM,IAAAQ,EACzB7D,GAAY,EACJ,QAAR6D,EAAI/D,SAAI,IAAA+D,GAAJA,EAAMzC,UAAStB,EAAKsB,QAAQT,MAAMmD,UAAY,OACpD,IACA1E,EAASiE,GAAG,WAAW,WACrBlD,GAAc,EACdC,IACAX,EAAe+B,oBAAoB,UAAWC,GAAe,GAE7DsC,gBAAe,WACbhD,IACIf,GAAWc,GACjB,GACF,IACO,CACLQ,iBAAAA,EACAtB,UAAW,WAAA,OAAMA,GAAaC,CAAU,EACxC+D,QAAS,WACP/D,GAAa,EACbG,IACAX,EAAe+B,oBAAoB,UAAWC,GAAe,GACxDtB,IACHe,IACA9B,EAASmC,UACTR,IAEJ,EAEJ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./registerViewerWindow.js"),o=require("react-dom/server"),i=require("./GalleryToolbar.js"),r=require("./legacyZoom.js"),t=require("react/jsx-runtime");exports.registerLegacyToolbar=function(l,n,a,d){var v,c,u,s=function(){var e,o=null===(e=l.pswp)||void 0===e?void 0:e.currSlide;if(o&&v&&c){var i=r.getLegacyLevel(o.zoomLevels.initial,o.currZoomLevel);v.disabled=i>=r.LEGACY_MAX_LEVEL-1e-6,c.disabled=i<=1e-6}},L=function(e){var o,i,t,n=null===(o=l.pswp)||void 0===o?void 0:o.currSlide;if(n&&!d()){var a=r.getLegacyLevel(n.zoomLevels.initial,n.currZoomLevel),u=a+e,L=r.getNextLegacyLevel(a,e);n.zoomTo(r.getLegacyScale(n.zoomLevels.initial,L),void 0,0),s(),Math.abs(u-r.LEGACY_MAX_LEVEL)<1e-6&&(null===(i=c)||void 0===i||i.focus()),Math.abs(u)<1e-6&&(null===(t=v)||void 0===t||t.focus())}},m=function(o){var i;if(e.isViewerElement(o.target)&&o.target.closest(".pswp__img")){var t=null===(i=l.pswp)||void 0===i?void 0:i.currSlide;if(t&&!d()){o.preventDefault();var n=r.getLegacyLevel(t.zoomLevels.initial,t.currZoomLevel)>1e-6?0:r.LEGACY_STEP;t.zoomTo(r.getLegacyScale(t.zoomLevels.initial,n),{x:o.clientX,y:o.clientY},0)}}};return l.on("bindEvents",(function(){var e,o;null===(o=u=null===(e=l.pswp)||void 0===e?void 0:e.element)||void 0===o||o.addEventListener("dblclick",m)})),l.on("zoomPanUpdate",s),l.on("change",s),l.on("loadComplete",s),l.on("uiRegister",(function(){var u,m,g,p,f;null===(u=l.pswp)||void 0===u||null===(m=u.ui)||void 0===m||m.registerElement({name:"gallery-toolbar",order:20,appendTo:"root",html:o.renderToString(t.jsx(i.GalleryToolbar,{presentation:n,src:null===(g=l.pswp)||void 0===g||null===(p=g.currSlide)||void 0===p||null===(f=p.data)||void 0===f?void 0:f.src})),onInit:function(e,o){v=e.querySelector('[data-action="zoom-in"]')||void 0,c=e.querySelector('[data-action="zoom-out"]')||void 0;var i=e.querySelector("[data-download]");o.on("change",(function(){var e,r=null===(e=o.currSlide)||void 0===e?void 0:e.data.src;r?null==i||i.setAttribute("href",r):null==i||i.removeAttribute("href")})),s()},onClick:function(o){var i=o.target;if(!d()&&e.isViewerElement(i)){var t=i.closest("button[data-action]");t&&!t.disabled&&("zoom-in"===t.dataset.action&&L(r.LEGACY_STEP),"zoom-out"===t.dataset.action&&L(-r.LEGACY_STEP),"close"===t.dataset.action&&a())}}})})),function(){var e;return null===(e=u)||void 0===e?void 0:e.removeEventListener("dblclick",m)}};
|
|
2
|
+
//# sourceMappingURL=registerLegacyToolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerLegacyToolbar.js","sources":["../../../../src/componentsV2/ImageViewer/registerLegacyToolbar.tsx"],"sourcesContent":["import { isViewerElement } from './registerViewerWindow';\nimport { renderToString } from 'react-dom/server';\nimport PhotoSwipeLightbox from 'photoswipe/lightbox';\nimport { GalleryToolbar } from './GalleryToolbar';\nimport {\n getLegacyLevel,\n getLegacyScale,\n getNextLegacyLevel,\n LEGACY_MAX_LEVEL,\n LEGACY_STEP,\n} from './legacyZoom';\n\nexport const registerLegacyToolbar = (\n lightbox: PhotoSwipeLightbox,\n presentation: 'single' | 'chat',\n onClose: () => void,\n isClosing: () => boolean\n) => {\n let zoomIn: HTMLButtonElement | undefined;\n let zoomOut: HTMLButtonElement | undefined;\n const sync = () => {\n const slide = lightbox.pswp?.currSlide;\n if (!slide || !zoomIn || !zoomOut) return;\n const level = getLegacyLevel(slide.zoomLevels.initial, slide.currZoomLevel);\n zoomIn.disabled = level >= LEGACY_MAX_LEVEL - 0.000001;\n zoomOut.disabled = level <= 0.000001;\n };\n const change = (delta: number) => {\n const slide = lightbox.pswp?.currSlide;\n if (!slide || isClosing()) return;\n const currentLevel = getLegacyLevel(slide.zoomLevels.initial, slide.currZoomLevel);\n const rawLevel = currentLevel + delta;\n const level = getNextLegacyLevel(currentLevel, delta);\n slide.zoomTo(getLegacyScale(slide.zoomLevels.initial, level), undefined, 0);\n sync();\n if (Math.abs(rawLevel - LEGACY_MAX_LEVEL) < 0.000001) zoomOut?.focus();\n if (Math.abs(rawLevel) < 0.000001) zoomIn?.focus();\n };\n const doubleClick = (event: MouseEvent) => {\n if (!isViewerElement(event.target) || !event.target.closest('.pswp__img')) return;\n const slide = lightbox.pswp?.currSlide;\n if (!slide || isClosing()) return;\n event.preventDefault();\n const level =\n getLegacyLevel(slide.zoomLevels.initial, slide.currZoomLevel) > 0.000001 ? 0 : LEGACY_STEP;\n slide.zoomTo(\n getLegacyScale(slide.zoomLevels.initial, level),\n { x: event.clientX, y: event.clientY },\n 0\n );\n };\n let element: HTMLElement | undefined;\n lightbox.on('bindEvents', () => {\n element = lightbox.pswp?.element;\n element?.addEventListener('dblclick', doubleClick);\n });\n lightbox.on('zoomPanUpdate', sync);\n lightbox.on('change', sync);\n lightbox.on('loadComplete', sync);\n lightbox.on('uiRegister', () => {\n lightbox.pswp?.ui?.registerElement({\n name: 'gallery-toolbar',\n order: 20,\n appendTo: 'root',\n html: renderToString(\n <GalleryToolbar presentation={presentation} src={lightbox.pswp?.currSlide?.data?.src} />\n ),\n onInit: (el, pswp) => {\n zoomIn = el.querySelector<HTMLButtonElement>('[data-action=\"zoom-in\"]') || undefined;\n zoomOut = el.querySelector<HTMLButtonElement>('[data-action=\"zoom-out\"]') || undefined;\n const download = el.querySelector<HTMLAnchorElement>('[data-download]');\n pswp.on('change', () => {\n const src = pswp.currSlide?.data.src;\n if (src) download?.setAttribute('href', src);\n else download?.removeAttribute('href');\n });\n sync();\n },\n onClick: event => {\n const target = event.target;\n if (isClosing() || !isViewerElement(target)) return;\n const button = target.closest<HTMLButtonElement>('button[data-action]');\n if (!button || button.disabled) return;\n if (button.dataset.action === 'zoom-in') change(LEGACY_STEP);\n if (button.dataset.action === 'zoom-out') change(-LEGACY_STEP);\n if (button.dataset.action === 'close') onClose();\n },\n });\n });\n return () => element?.removeEventListener('dblclick', doubleClick);\n};\n"],"names":["lightbox","presentation","onClose","isClosing","zoomIn","zoomOut","element","sync","_lightbox$pswp","slide","pswp","currSlide","level","getLegacyLevel","zoomLevels","initial","currZoomLevel","disabled","LEGACY_MAX_LEVEL","change","delta","_lightbox$pswp2","_zoomOut","_zoomIn","currentLevel","rawLevel","getNextLegacyLevel","zoomTo","getLegacyScale","undefined","Math","abs","focus","doubleClick","event","_lightbox$pswp3","isViewerElement","target","closest","preventDefault","LEGACY_STEP","x","clientX","y","clientY","on","_lightbox$pswp4","_element","addEventListener","_lightbox$pswp5","_lightbox$pswp5$ui","_lightbox$pswp6","_lightbox$pswp6$currS","_lightbox$pswp6$currS2","ui","registerElement","name","order","appendTo","html","renderToString","_jsx","jsx","GalleryToolbar","src","data","onInit","el","querySelector","download","_pswp$currSlide","setAttribute","removeAttribute","onClick","button","dataset","action","_element2","removeEventListener"],"mappings":"wQAYqC,SACnCA,EACAC,EACAC,EACAC,GAEA,IAAIC,EACAC,EAgCAC,EA/BEC,EAAO,WAAM,IAAAC,EACXC,EAAqB,QAAbT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B,EAAAA,aAClB,aAA1BkC,EAAOC,QAAQC,QAAuBzD,GAAQqB,EAAAA,aACpB,UAA1BkC,EAAOC,QAAQC,QAAoB1E,IALM,CAM/C,GAEJ,IACO,WAAA,IAAA2E,EAAA,eAAMvE,EAAAA,sBAAAuE,EAASC,oBAAoB,WAAY7C,EAAY,CACpE"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./registerViewerWindow.js"),t=require("./legacyWheel.js"),n=require("./legacyZoom.js");exports.registerLegacyWheel=function(o){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document,l=!1,a=0,c=!1,v=function(e){"ArrowLeft"!==e.key&&"ArrowRight"!==e.key||(c=!0,queueMicrotask((function(){c=!1})))},u=t.createLegacyWheel({zoom:function(e,t){var i;if(!l){var r=null===(i=o.pswp)||void 0===i?void 0:i.currSlide;if(r){var a=n.getNextLegacyLevel(n.getLegacyLevel(r.zoomLevels.initial,r.currZoomLevel),e);r.zoomTo(n.getLegacyScale(r.zoomLevels.initial,a),t,0)}}},move:function(e){var t=o.pswp;if(t){var n=t.currSlide;null==n||n.zoomTo(n.zoomLevels.initial,void 0,0),1===e?t.next():t.prev()}},isAnimating:function(){return l||Date.now()<a}});return o.on("change",(function(){var e,t=null===(e=o.pswp)||void 0===e?void 0:e.currIndex;void 0===i||t===i||c||(a=Date.now()+300),i=t,c=!1})),o.on("close",(function(){l=!0})),o.on("wheel",(function(t){t.preventDefault();var n=t.originalEvent;n.preventDefault(),n.stopPropagation(),l||u.handle({deltaX:n.deltaX,deltaY:n.deltaY,clientX:n.clientX,clientY:n.clientY,isOnImage:e.isViewerElement(n.target)&&!!n.target.closest(".pswp__img")})})),r.addEventListener("keydown",v,!0),function(){l=!0,r.removeEventListener("keydown",v,!0),u.dispose()}};
|
|
2
|
+
//# sourceMappingURL=registerLegacyWheel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerLegacyWheel.js","sources":["../../../../src/componentsV2/ImageViewer/registerLegacyWheel.ts"],"sourcesContent":["import { isViewerElement } from './registerViewerWindow';\nimport PhotoSwipeLightbox from 'photoswipe/lightbox';\nimport { createLegacyWheel } from './legacyWheel';\nimport { getLegacyLevel, getLegacyScale, getNextLegacyLevel } from './legacyZoom';\n\nexport const registerLegacyWheel = (\n lightbox: PhotoSwipeLightbox,\n targetDocument: Document = document\n) => {\n let isClosing = false;\n let animationUntil = 0;\n let previousIndex: number | undefined;\n let isArrowKey = false;\n const keyboard = (event: KeyboardEvent) => {\n if (event.key !== 'ArrowLeft' && event.key !== 'ArrowRight') return;\n isArrowKey = true;\n // PhotoSwipe key navigation is synchronous; do not exempt a later action.\n queueMicrotask(() => {\n isArrowKey = false;\n });\n };\n const wheel = createLegacyWheel({\n zoom: (delta, point) => {\n if (isClosing) return;\n const slide = lightbox.pswp?.currSlide;\n if (!slide) return;\n const level = getNextLegacyLevel(\n getLegacyLevel(slide.zoomLevels.initial, slide.currZoomLevel),\n delta\n );\n slide.zoomTo(getLegacyScale(slide.zoomLevels.initial, level), point, 0);\n },\n move: direction => {\n const pswp = lightbox.pswp;\n if (!pswp) return;\n const slide = pswp.currSlide;\n slide?.zoomTo(slide.zoomLevels.initial, undefined, 0);\n if (direction === 1) pswp.next();\n else pswp.prev();\n },\n isAnimating: () => isClosing || Date.now() < animationUntil,\n });\n lightbox.on('change', () => {\n const index = lightbox.pswp?.currIndex;\n if (previousIndex !== undefined && index !== previousIndex && !isArrowKey)\n animationUntil = Date.now() + 300;\n previousIndex = index;\n isArrowKey = false;\n });\n lightbox.on('close', () => {\n isClosing = true;\n });\n lightbox.on('wheel', event => {\n event.preventDefault();\n const original = event.originalEvent;\n original.preventDefault();\n original.stopPropagation();\n if (isClosing) return;\n wheel.handle({\n deltaX: original.deltaX,\n deltaY: original.deltaY,\n clientX: original.clientX,\n clientY: original.clientY,\n isOnImage: isViewerElement(original.target) && !!original.target.closest('.pswp__img'),\n });\n });\n targetDocument.addEventListener('keydown', keyboard, true);\n return () => {\n isClosing = true;\n targetDocument.removeEventListener('keydown', keyboard, true);\n wheel.dispose();\n };\n};\n"],"names":["lightbox","previousIndex","targetDocument","document","isClosing","animationUntil","isArrowKey","keyboard","event","key","queueMicrotask","wheel","createLegacyWheel","zoom","delta","point","_lightbox$pswp","slide","pswp","currSlide","level","getNextLegacyLevel","getLegacyLevel","zoomLevels","initial","currZoomLevel","zoomTo","getLegacyScale","move","direction","undefined","next","prev","isAnimating","Date","now","on","_lightbox$pswp2","index","currIndex","preventDefault","original","originalEvent","stopPropagation","handle","deltaX","deltaY","clientX","clientY","isOnImage","isViewerElement","target","closest","addEventListener","removeEventListener","dispose"],"mappings":"sMAKmC,SACjCA,GAEG,IAGCC,EAJJC,yDAA2BC,SAEvBC,GAAY,EACZC,EAAiB,EAEjBC,GAAa,EACXC,EAAW,SAACC,GACE,cAAdA,EAAMC,KAAqC,eAAdD,EAAMC,MACvCH,GAAa,EAEbI,gBAAe,WACbJ,GAAa,CACf,MAEIK,EAAQC,EAAAA,kBAAkB,CAC9BC,KAAM,SAACC,EAAOC,GAAU,IAAAC,EACtB,IAAIZ,EAAJ,CACA,IAAMa,EAAqB,QAAbjB,EAAAA,EAASkB,YAAI,IAAAF,OAAA,EAAbA,EAAeG,UAC7B,GAAKF,EAAL,CACA,IAAMG,EAAQC,EAAAA,mBACZC,EAAcA,eAACL,EAAMM,WAAWC,QAASP,EAAMQ,eAC/CX,GAEFG,EAAMS,OAAOC,EAAcA,eAACV,EAAMM,WAAWC,QAASJ,GAAQL,EAAO,EALzD,CAFG,CAQhB,EACDa,KAAM,SAAAC,GACJ,IAAMX,EAAOlB,EAASkB,KACtB,GAAKA,EAAL,CACA,IAAMD,EAAQC,EAAKC,UACnBF,SAAAA,EAAOS,OAAOT,EAAMM,WAAWC,aAASM,EAAW,GACjC,IAAdD,EAAiBX,EAAKa,OACrBb,EAAKc,MAJC,CAKZ,EACDC,YAAa,WAAA,OAAM7B,GAAa8B,KAAKC,MAAQ9B,CAAc,IA2B7D,OAzBAL,EAASoC,GAAG,UAAU,WAAM,IAAAC,EACpBC,EAAqB,QAAbtC,EAAAA,EAASkB,YAAI,IAAAmB,OAAA,EAAbA,EAAeE,eACPT,IAAlB7B,GAA+BqC,IAAUrC,GAAkBK,IAC7DD,EAAiB6B,KAAKC,MAAQ,KAChClC,EAAgBqC,EAChBhC,GAAa,CACf,IACAN,EAASoC,GAAG,SAAS,WACnBhC,GAAY,CACd,IACAJ,EAASoC,GAAG,SAAS,SAAA5B,GACnBA,EAAMgC,iBACN,IAAMC,EAAWjC,EAAMkC,cACvBD,EAASD,iBACTC,EAASE,kBACLvC,GACJO,EAAMiC,OAAO,CACXC,OAAQJ,EAASI,OACjBC,OAAQL,EAASK,OACjBC,QAASN,EAASM,QAClBC,QAASP,EAASO,QAClBC,UAAWC,EAAAA,gBAAgBT,EAASU,WAAaV,EAASU,OAAOC,QAAQ,eAE7E,IACAlD,EAAemD,iBAAiB,UAAW9C,GAAU,GAC9C,WACLH,GAAY,EACZF,EAAeoD,oBAAoB,UAAW/C,GAAU,GACxDI,EAAM4C,UAEV"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var s=require("react-dom/server"),o=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/InfoRounded.js"),require("../../icons/customIcons/icons/FlameFilled.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/PinOne.js"),require("../../icons/customIcons/icons/PinOneCrossed.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 c=require("react/jsx-runtime");exports.registerSourceToolbar=function(n){n.on("uiRegister",(function(){var i,e=null==n||null===(i=n.pswp)||void 0===i?void 0:i.ui;null==e||e.registerElement({name:"download-button",order:7,isButton:!0,tagName:"a",html:s.renderToString(c.jsx(o.DownloadIcon,{className:"pswp__icn"})),onInit:function(s,o){s.setAttribute("download",""),s.setAttribute("target","_blank"),s.setAttribute("rel","noopener"),null==o||o.on("change",(function(){var c;s.href=(null==o||null===(c=o.currSlide)||void 0===c?void 0:c.data.src)||""}))}}),null==e||e.registerElement({name:"zoom-in-button",order:8,isButton:!0,tagName:"button",html:s.renderToString(c.jsx(o.ZoomInIcon,{className:"pswp__icn"})),onInit:function(s,o){o.on("zoomPanUpdate",(function(c){var n,i=s,e=(null===(n=o.currSlide)||void 0===n?void 0:n.currZoomLevel)||1;c.slide===o.currSlide&&(i.disabled=e>=2)}))},onClick:function(s,o,c){var n;if(null!=c&&null!==(n=c.currSlide)&&void 0!==n&&n.currZoomLevel){var i=c.currSlide.currZoomLevel+.5,e=Math.min(.5*Math.floor(i/.5),2);c.currSlide.zoomTo(e,void 0)}}});var r=new WeakMap;null==e||e.registerElement({name:"zoom-out-button",order:9,isButton:!0,tagName:"button",html:s.renderToString(c.jsx(o.ZoomOutIcon,{className:"pswp__icn"})),onInit:function(s,o){o.on("zoomPanUpdate",(function(c){var n,i=s,e=(null===(n=o.currSlide)||void 0===n?void 0:n.currZoomLevel)||1;c.slide===o.currSlide&&(r.get(o.currSlide)||r.set(o.currSlide,e),i.disabled=e<=(r.get(o.currSlide)||1))}))},onClick:function(s,o,c){var n;if(null!=c&&null!==(n=c.currSlide)&&void 0!==n&&n.currZoomLevel&&r.get(c.currSlide)){var i=c.currSlide.currZoomLevel-.5,e=Math.max(.5*Math.ceil(i/.5),r.get(c.currSlide)||1);c.currSlide.zoomTo(e,void 0)}}})}))};
|
|
2
|
+
//# sourceMappingURL=registerSourceToolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerSourceToolbar.js","sources":["../../../../src/componentsV2/ImageViewer/registerSourceToolbar.tsx"],"sourcesContent":["import { renderToString } from 'react-dom/server';\nimport PhotoSwipeLightbox from 'photoswipe/lightbox';\nimport { DownloadIcon, ZoomInIcon, ZoomOutIcon } from '~/icons';\n\nconst MaxZoomLevel = 2;\nconst ZoomStep = 0.5;\n\n// Preserve the src API controls while sharing the gallery engine and lifecycle.\nexport const registerSourceToolbar = (lightbox: PhotoSwipeLightbox) => {\n lightbox.on('uiRegister', () => {\n const ui = lightbox?.pswp?.ui;\n\n ui?.registerElement({\n name: 'download-button',\n order: 7,\n isButton: true,\n tagName: 'a',\n\n html: renderToString(<DownloadIcon className=\"pswp__icn\" />),\n\n onInit: (el, pswp) => {\n el.setAttribute('download', '');\n el.setAttribute('target', '_blank');\n el.setAttribute('rel', 'noopener');\n\n pswp?.on('change', () => {\n // eslint-disable-next-line no-param-reassign\n (el as HTMLAnchorElement).href = pswp?.currSlide?.data.src || '';\n });\n },\n });\n\n ui?.registerElement({\n name: 'zoom-in-button',\n order: 8,\n isButton: true,\n tagName: 'button',\n html: renderToString(<ZoomInIcon className=\"pswp__icn\" />),\n onInit: (el, pswp) => {\n pswp.on('zoomPanUpdate', e => {\n const button = el as HTMLButtonElement;\n const zoomLevel = pswp.currSlide?.currZoomLevel || 1;\n\n if (e.slide === pswp.currSlide) {\n button.disabled = zoomLevel >= MaxZoomLevel;\n }\n });\n },\n onClick: (_e, _el, pswp) => {\n if (!pswp?.currSlide?.currZoomLevel) {\n return;\n }\n\n const rawNewZoom = pswp.currSlide.currZoomLevel + ZoomStep;\n const newZoom = Math.min(Math.floor(rawNewZoom / ZoomStep) * ZoomStep, MaxZoomLevel);\n\n pswp.currSlide.zoomTo(newZoom, undefined);\n },\n });\n\n const initialZoomLevelsMap = new WeakMap<object, number | undefined>();\n ui?.registerElement({\n name: 'zoom-out-button',\n order: 9,\n isButton: true,\n tagName: 'button',\n html: renderToString(<ZoomOutIcon className=\"pswp__icn\" />),\n onInit: (el, pswp) => {\n pswp.on('zoomPanUpdate', e => {\n const button = el as HTMLButtonElement;\n const zoomLevel = pswp.currSlide?.currZoomLevel || 1;\n\n if (e.slide === pswp.currSlide) {\n // First run - save current zoom as minimal\n if (!initialZoomLevelsMap.get(pswp.currSlide)) {\n initialZoomLevelsMap.set(pswp.currSlide, zoomLevel);\n }\n\n button.disabled = zoomLevel <= (initialZoomLevelsMap.get(pswp.currSlide) || 1);\n }\n });\n },\n onClick: (_e, _el, pswp) => {\n if (!pswp?.currSlide?.currZoomLevel || !initialZoomLevelsMap.get(pswp.currSlide)) {\n return;\n }\n\n const rawNewZoom = pswp.currSlide.currZoomLevel - ZoomStep;\n const newZoom = Math.max(\n Math.ceil(rawNewZoom / ZoomStep) * ZoomStep,\n initialZoomLevelsMap.get(pswp.currSlide) || 1\n );\n\n pswp.currSlide.zoomTo(newZoom, undefined);\n },\n });\n });\n};\n"],"names":["lightbox","on","_lightbox$pswp","ui","pswp","registerElement","name","order","isButton","tagName","html","renderToString","_jsx","jsx","DownloadIcon","className","onInit","el","setAttribute","_pswp$currSlide","href","currSlide","data","src","ZoomInIcon","e","_pswp$currSlide2","button","zoomLevel","currZoomLevel","slide","disabled","onClick","_e","_el","_pswp$currSlide3","rawNewZoom","newZoom","Math","min","floor","zoomTo","undefined","initialZoomLevelsMap","WeakMap","ZoomOutIcon","_pswp$currSlide4","get","set","_pswp$currSlide5","max","ceil"],"mappings":"otIAQqC,SAACA,GACpCA,EAASC,GAAG,cAAc,WAAM,IAAAC,EACxBC,EAAKH,SAAA,QAAAA,EAAAA,EAAUI,YAAV,IAAAF,OAAAF,EAAAE,EAAgBC,GAE3BA,SAAAA,EAAIE,gBAAgB,CAClBC,KAAM,kBACNC,MAAO,EACPC,UAAU,EACVC,QAAS,IAETC,KAAMC,EAAAA,eAAeC,EAAAC,IAACC,eAAY,CAACC,UAAU,eAE7CC,OAAQ,SAACC,EAAIb,GACXa,EAAGC,aAAa,WAAY,IAC5BD,EAAGC,aAAa,SAAU,UAC1BD,EAAGC,aAAa,MAAO,YAEvBd,SAAAA,EAAMH,GAAG,UAAU,WAAM,IAAAkB,EAEtBF,EAAyBG,MAAOhB,SAAA,QAAIe,EAAJf,EAAMiB,iBAAN,IAAAF,OAAI,EAAJA,EAAiBG,KAAKC,MAAO,EAChE,GACF,IAGFpB,SAAAA,EAAIE,gBAAgB,CAClBC,KAAM,iBACNC,MAAO,EACPC,UAAU,EACVC,QAAS,SACTC,KAAMC,EAAAA,eAAeC,EAAAC,IAACW,aAAU,CAACT,UAAU,eAC3CC,OAAQ,SAACC,EAAIb,GACXA,EAAKH,GAAG,iBAAiB,SAAAwB,GAAK,IAAAC,EACtBC,EAASV,EACTW,GAAY,QAAAF,EAAAtB,EAAKiB,iBAAL,IAAAK,OAAA,EAAAA,EAAgBG,gBAAiB,EAE/CJ,EAAEK,QAAU1B,EAAKiB,YACnBM,EAAOI,SAAWH,GAxCT,EA0Cb,GACD,EACDI,QAAS,SAACC,EAAIC,EAAK9B,GAAS,IAAA+B,EAC1B,GAA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