@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
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.isViewerElement=function(e){return!!e&&"nodeType"in e&&1===e.nodeType&&"closest"in e},exports.registerViewerWindow=function(e,n){if(n!==window){var t=function(){var t;return null===(t=e.pswp)||void 0===t?void 0:t.setScrollOffset(0,n.pageYOffset)};e.on("initialLayout",t),e.on("viewportSize",t),e.on("bindEvents",(function(){var t=e.pswp;t&&t.events._pool.slice().forEach((function(e){var o=e.target,i=e.type,r=e.listener,s=e.passive,l=o===window?n:o===document?n.document:null;l&&(t.events.remove(o,i,r,s),t.events.add(l,i,o===window&&"scroll"===i?function(){return t.setScrollOffset(0,n.pageYOffset)}:r,s))}))}))}};
|
|
2
|
+
//# sourceMappingURL=registerViewerWindow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerViewerWindow.js","sources":["../../../../src/componentsV2/ImageViewer/registerViewerWindow.ts"],"sourcesContent":["import PhotoSwipeLightbox from 'photoswipe/lightbox';\n\n// Nodes adopted by the parent document may still have the iframe's prototype.\nexport const isViewerElement = (target: EventTarget | null): target is Element =>\n !!target && 'nodeType' in target && target.nodeType === 1 && 'closest' in target;\n\nexport const registerViewerWindow = (lightbox: PhotoSwipeLightbox, targetWindow: Window) => {\n if (targetWindow === window) return;\n const syncScrollOffset = () => lightbox.pswp?.setScrollOffset(0, targetWindow.pageYOffset);\n lightbox.on('initialLayout', syncScrollOffset);\n // updateSize reads the source window's scroll offset before this public event.\n lightbox.on('viewportSize', syncScrollOffset);\n lightbox.on('bindEvents', () => {\n const core = lightbox.pswp;\n if (!core) return;\n // PhotoSwipe 5 exposes appendToEl/viewport but no event-window option.\n // Keep the existing isolation bridge: move its global listeners in the pool\n // so PhotoSwipe's own destroy removes them from the correct document/window.\n /* eslint-disable no-underscore-dangle */\n // @ts-expect-error PhotoSwipe's internal listener pool is not public API.\n const pool = core.events._pool.slice() as {\n target: Parameters<typeof core.events.add>[0];\n type: string;\n listener: Parameters<typeof core.events.add>[2];\n passive?: boolean;\n }[];\n /* eslint-enable no-underscore-dangle */\n pool.forEach(({ target, type, listener, passive }) => {\n const destination =\n target === window ? targetWindow : target === document ? targetWindow.document : null;\n if (!destination) return;\n core.events.remove(target, type, listener, passive);\n core.events.add(\n destination,\n type,\n target === window && type === 'scroll'\n ? () => core.setScrollOffset(0, targetWindow.pageYOffset)\n : listener,\n passive\n );\n });\n });\n};\n"],"names":["target","nodeType","lightbox","targetWindow","window","syncScrollOffset","_lightbox$pswp","pswp","setScrollOffset","pageYOffset","on","core","events","_pool","slice","forEach","_ref","type","listener","passive","destination","document","remove","add"],"mappings":"4FAG+B,SAACA,GAA0B,QACtDA,GAAU,aAAcA,GAA8B,IAApBA,EAAOC,UAAkB,YAAaD,CAAM,+BAE9C,SAACE,EAA8BC,GACjE,GAAIA,IAAiBC,OAArB,CACA,IAAMC,EAAmB,WAAH,IAAAC,EAAA,OAAsB,QAAtBA,EAASJ,EAASK,YAAI,IAAAD,OAAA,EAAbA,EAAeE,gBAAgB,EAAGL,EAAaM,YAAY,EAC1FP,EAASQ,GAAG,gBAAiBL,GAE7BH,EAASQ,GAAG,eAAgBL,GAC5BH,EAASQ,GAAG,cAAc,WACxB,IAAMC,EAAOT,EAASK,KACjBI,GAMQA,EAAKC,OAAOC,MAAMC,QAO1BC,SAAQ,SAAyCC,GAAA,IAAtChB,IAAAA,OAAQiB,IAAAA,KAAMC,IAAAA,SAAUC,IAAAA,QAChCC,EACJpB,IAAWI,OAASD,EAAeH,IAAWqB,SAAWlB,EAAakB,SAAW,KAC9ED,IACLT,EAAKC,OAAOU,OAAOtB,EAAQiB,EAAMC,EAAUC,GAC3CR,EAAKC,OAAOW,IACVH,EACAH,EACAjB,IAAWI,QAAmB,WAATa,EACjB,WAAA,OAAMN,EAAKH,gBAAgB,EAAGL,EAAaM,cAC3CS,EACJC,GAEJ,GACF,GAlC6B,CAmC/B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/slicedToArray"),t=require("react");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=n(e),i=n(r);function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function c(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?o(Object(t),!0).forEach((function(r){u.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}exports.useImageDimensions=function(e){var r=t.useState({}),n=i.default(r,2),o=n[0],a=n[1];return t.useEffect((function(){var r=!1,t=e.filter((function(e){return e.src&&!(e.width&&e.height)})).map((function(e){var t=new Image,n=function(n){r||a((function(r){return c(c({},r),{},u.default({},e.id,{src:e.src,status:n,width:"ready"===n?t.naturalWidth:void 0,height:"ready"===n?t.naturalHeight:void 0}))}))};return t.onload=function(){return n(t.naturalWidth&&t.naturalHeight?"ready":"error")},t.onerror=function(){return n("error")},t.src=e.src,t}));return function(){r=!0,t.forEach((function(e){e.onload=null,e.onerror=null}))}}),[e]),t.useMemo((function(){return e.map((function(e){if(!e.src)return c(c({},e),{},{status:"pending"});if(e.width&&e.height)return c(c({},e),{},{status:"ready"});var r=o[e.id];return(null==r?void 0:r.src)===e.src?c(c({},e),r):c(c({},e),{},{width:void 0,height:void 0,status:"pending"})}))}),[e,o])};
|
|
2
|
+
//# sourceMappingURL=useImageDimensions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useImageDimensions.js","sources":["../../../../src/componentsV2/ImageViewer/useImageDimensions.ts"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\nimport { ImageViewerItem } from './types';\n\nexport type ResolvedImage = ImageViewerItem & { status: 'pending' | 'ready' | 'error' };\ntype Measurement = { src: string; width?: number; height?: number; status: 'ready' | 'error' };\n\nexport const useImageDimensions = (items: ImageViewerItem[]): ResolvedImage[] => {\n const [measurements, setMeasurements] = useState<Record<string, Measurement>>({});\n useEffect(() => {\n let isDisposed = false;\n const probes = items\n .filter(item => item.src && !(item.width && item.height))\n .map(item => {\n const image = new Image();\n const settle = (status: Measurement['status']) => {\n if (isDisposed) return;\n setMeasurements(previous => ({\n ...previous,\n [item.id]: {\n src: item.src,\n status,\n width: status === 'ready' ? image.naturalWidth : undefined,\n height: status === 'ready' ? image.naturalHeight : undefined,\n },\n }));\n };\n image.onload = () => settle(image.naturalWidth && image.naturalHeight ? 'ready' : 'error');\n image.onerror = () => settle('error');\n image.src = item.src;\n return image;\n });\n return () => {\n isDisposed = true;\n probes.forEach(image => {\n image.onload = null;\n image.onerror = null;\n });\n };\n }, [items]);\n\n return useMemo(\n () =>\n items.map(item => {\n if (!item.src) return { ...item, status: 'pending' };\n if (item.width && item.height) return { ...item, status: 'ready' };\n const measured = measurements[item.id];\n if (measured?.src === item.src) return { ...item, ...measured };\n return { ...item, width: undefined, height: undefined, status: 'pending' };\n }),\n [items, measurements]\n );\n};\n"],"names":["items","_useState","useState","_useState2","_slicedToArray","measurements","setMeasurements","useEffect","isDisposed","probes","filter","item","src","width","height","map","image","Image","settle","status","previous","_objectSpread","_defineProperty","id","naturalWidth","undefined","naturalHeight","onload","onerror","forEach","useMemo","measured"],"mappings":"43BAMkC,SAACA,GACjC,IAAAC,EAAwCC,EAAQA,SAA8B,IAAGC,EAAAC,EAAAA,QAAAH,EAAA,GAA1EI,EAAYF,EAAA,GAAEG,EAAeH,EAAA,GAiCpC,OAhCAI,EAAAA,WAAU,WACR,IAAIC,GAAa,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
11
11
|
profile_photo?: string;
|
|
12
12
|
[key: string]: unknown;
|
|
13
13
|
};
|
|
14
|
+
export type CommentComposerTrailingState = {
|
|
15
|
+
canSend: boolean;
|
|
16
|
+
submit: () => void;
|
|
17
|
+
};
|
|
14
18
|
export type CommentComposerProps = {
|
|
15
19
|
body: string;
|
|
16
20
|
onBodyChange: (value: string) => void;
|
|
@@ -36,10 +40,12 @@ export type CommentComposerProps = {
|
|
|
36
40
|
shareToChat?: Omit<ShareToChatRowProps, 'testId'>;
|
|
37
41
|
/** Replaces the default send button, e.g. the edit form's Cancel/Save. */
|
|
38
42
|
trailing?: ReactNode;
|
|
43
|
+
/** Like `trailing`, but receives the upload-aware send state for a custom Save. */
|
|
44
|
+
renderTrailing?: (state: CommentComposerTrailingState) => ReactNode;
|
|
39
45
|
/** Render flush inside a host card instead of as its own surface. */
|
|
40
46
|
embedded?: boolean;
|
|
41
47
|
className?: string;
|
|
42
48
|
testId?: string;
|
|
43
49
|
};
|
|
44
|
-
export declare const CommentComposer: ({ body, onBodyChange, onSubmit, canSubmit, currentUser, attachments, onAttachmentsChange, maxAttachments, attachment, onAttachmentChange, attachmentError, onAttachmentError, maxAttachmentSizeBytes, wellhubContext, disabled, autoFocus, placeholder, metaRows, isMetaSingleLine, shareToChat, trailing, embedded, className, testId, }: CommentComposerProps) => import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
export declare const CommentComposer: ({ body, onBodyChange, onSubmit, canSubmit, currentUser, attachments, onAttachmentsChange, maxAttachments, attachment, onAttachmentChange, attachmentError, onAttachmentError, maxAttachmentSizeBytes, wellhubContext, disabled, autoFocus, placeholder, metaRows, isMetaSingleLine, shareToChat, trailing, renderTrailing, embedded, className, testId, }: CommentComposerProps) => import("react/jsx-runtime").JSX.Element;
|
|
45
51
|
//# sourceMappingURL=CommentComposer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommentComposer.d.ts","sourceRoot":"","sources":["../../../src/components/CommentComposer/C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EAAqE;IACrE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAyBF,eAAO,MAAM,eAAe,8VA0BzB,oBAAoB,4CA4KtB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"@babel/runtime/helpers/defineProperty";import s from"@babel/runtime/helpers/slicedToArray";import{useMemo as n,useCallback as t,useState as i,useRef as c}from"react";import{Input as e}from"@material-ui/core";import r from"@material-ui/icons/AlternateEmail";import{ButtonIcon as m}from"../../componentsV2/ButtonIcon/ButtonIcon.js";import{Tooltip as a}from"../../componentsV2/Tooltip/Tooltip.js";import{SmilingFaceIcon as l}from"../../icons/iconParkIcons.js";import"../../icons/customIcons/icons/AddMessage.js";import"../../icons/customIcons/icons/DragOne.js";import"../../icons/customIcons/icons/Attention.js";import"../../icons/customIcons/icons/Collapse.js";import"../../icons/customIcons/icons/Dashboard.js";import"../../icons/customIcons/icons/Expand.js";import"../../icons/customIcons/icons/FolderClosed.js";import"../../icons/customIcons/icons/FolderClosedFilled.js";import"../../icons/customIcons/icons/FolderOpened.js";import"../../icons/customIcons/icons/GreaterOrEqual.js";import"../../icons/customIcons/icons/LessOrEqual.js";import"../../icons/customIcons/icons/Search.js";import"../../icons/customIcons/icons/SearchOne.js";import"../../icons/customIcons/icons/Wellhub.js";import"../../icons/customIcons/icons/MultiRuler.js";import"../../icons/customIcons/icons/Checkbox.js";import"../../icons/customIcons/icons/CheckboxChecked.js";import"../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../icons/customIcons/icons/Radio.js";import"../../icons/customIcons/icons/RadioChecked.js";import"../../icons/customIcons/icons/SimulFrac.js";import"../../icons/customIcons/icons/ZipperFrac.js";import"../../icons/customIcons/icons/CautionFilled.js";import"../../icons/customIcons/icons/InfoRounded.js";import"../../icons/customIcons/icons/FlameFilled.js";import"../../icons/customIcons/icons/MoreApp.js";import"../../icons/customIcons/icons/Pad.js";import"../../icons/customIcons/icons/DrilloutUnit.js";import"../../icons/customIcons/icons/FracFleet.js";import"../../icons/customIcons/icons/Global.js";import"../../icons/customIcons/icons/Program.js";import"../../icons/customIcons/icons/Rig.js";import"../../icons/customIcons/icons/Well.js";import"../../icons/customIcons/icons/Gap.js";import"../../icons/customIcons/icons/Pin.js";import"../../icons/customIcons/icons/PinOne.js";import"../../icons/customIcons/icons/PinOneCrossed.js";import"../../icons/customIcons/icons/CloseOneFilled.js";import"../../icons/customIcons/icons/AttentionFilled.js";import"../../icons/customIcons/icons/CheckOneFilled.js";import"../../icons/customIcons/icons/Archive.js";import"../../icons/customIcons/icons/ArchiveCancel.js";import"../../icons/customIcons/icons/Unarchive.js";import"../../icons/customIcons/icons/Archived.js";import"../../icons/customIcons/icons/InterventionUnit.js";import"../../icons/customIcons/icons/CloudDelete.js";import"../../icons/customIcons/icons/Lasso.js";import"../../icons/customIcons/icons/Radius.js";import"../../icons/customIcons/icons/ErrorOps.js";import"../../icons/customIcons/icons/DataTypeOps.js";import"../../icons/customIcons/icons/FalsePositiveOps.js";import"../../icons/customIcons/icons/CalibrationOps.js";import"../../icons/customIcons/icons/CriticalOps.js";import"../../icons/customIcons/icons/Company.js";import"../../icons/customIcons/icons/ArchiveOne.js";import"../../icons/customIcons/icons/ParseBotFusion.js";import"../../icons/customIcons/icons/Connect.js";import"../../icons/customIcons/icons/PuzzleOne.js";import"../../icons/customIcons/icons/Feed.js";import"../../icons/customIcons/icons/Prompt.js";import"../../icons/customIcons/icons/Companies.js";import"../../icons/customIcons/icons/ClipboardAi.js";import"../../icons/customIcons/icons/Key.js";import"../../icons/customIcons/icons/AtSignCrossed.js";import"../../icons/customIcons/icons/MappingManual.js";import"../../icons/customIcons/icons/Mapping.js";import"../../icons/customIcons/icons/Metrics.js";import"../../icons/customIcons/icons/Drops.js";import"../../icons/customIcons/icons/ClipboardSearch.js";import"../../icons/customIcons/icons/Template.js";import"../../icons/customIcons/icons/ClipboardMetrics.js";import"../../icons/customIcons/icons/ClipboardBuilder.js";import"../../icons/customIcons/icons/UnitConversion.js";import"../../icons/customIcons/icons/NPT.js";import"../../icons/customIcons/icons/GuidedFrac.js";import{AvatarComponent as p}from"../Avatar/index.js";import{AttachFileButton as u}from"../AttachFileButton/AttachFileButton.js";import{CommentInput as d}from"../CommentInputNext/CommentInputNext.js";import j from"../EmojiIconButton.js";import h from"../FailedFileUploading.js";import I from"../UserMention/index.js";import{isSuggestionsListOpened as b}from"../UserMention/utils/index.js";import{WellhubFilePicker as f}from"../WellhubFilePicker/WellhubFilePicker.js";import"@babel/runtime/helpers/toConsumableArray";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"lodash/set";import"lodash/get";import"lodash/unset";import"moment";import"../../clients/jsonApi/index.js";import"../../clients/subscriptions/subscriptions-client.factory.js";import"../../clients/api/apiCore.js";import"../../clients/constants.js";import"../../clients/sso/auth0.js";import"../../clients/sso/oauth2.js";import"../../clients/api/rateLimiter.js";import"uuid";import{useAttachmentUpload as g,DEFAULT_MAX_ATTACHMENTS as C}from"./useAttachmentUpload.js";import{CommentMetaLine as v}from"./CommentMetaLine.js";import{ShareToChatRow as y}from"./ShareToChatRow.js";import F from"./CommentComposer.scss.js";import{jsxs as O,Fragment as A,jsx as S}from"react/jsx-runtime";function P(o,s){var n=Object.keys(o);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(o);s&&(t=t.filter((function(s){return Object.getOwnPropertyDescriptor(o,s).enumerable}))),n.push.apply(n,t)}return n}function x(s){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?P(Object(t),!0).forEach((function(n){o(s,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):P(Object(t)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(t,o))}))}return s}var k={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)"}}}},E=function(o){return O("div",{className:F.suggestion,children:[S(p,{size:26,alt:o.display,imgSrc:o.photo,displayName:o.display}),S("span",{children:o.display})]})},w=function(o){var p=o.body,P=o.onBodyChange,w=o.onSubmit,D=o.canSubmit,R=o.currentUser,M=o.attachments,U=o.onAttachmentsChange,N=o.maxAttachments,B=void 0===N?C:N,L=o.attachment,T=o.onAttachmentChange,z=o.attachmentError,W=o.onAttachmentError,G=o.maxAttachmentSizeBytes,q=o.wellhubContext,K=o.disabled,H=o.autoFocus,V=o.placeholder,Q=void 0===V?"Add a comment...":V,Z=o.metaRows,$=o.isMetaSingleLine,J=o.shareToChat,X=o.trailing,Y=o.
|
|
1
|
+
import o from"@babel/runtime/helpers/defineProperty";import s from"@babel/runtime/helpers/slicedToArray";import{useMemo as n,useCallback as t,useState as i,useRef as c}from"react";import{Input as e}from"@material-ui/core";import r from"@material-ui/icons/AlternateEmail";import{ButtonIcon as m}from"../../componentsV2/ButtonIcon/ButtonIcon.js";import{Tooltip as a}from"../../componentsV2/Tooltip/Tooltip.js";import{SmilingFaceIcon as l}from"../../icons/iconParkIcons.js";import"../../icons/customIcons/icons/AddMessage.js";import"../../icons/customIcons/icons/DragOne.js";import"../../icons/customIcons/icons/Attention.js";import"../../icons/customIcons/icons/Collapse.js";import"../../icons/customIcons/icons/Dashboard.js";import"../../icons/customIcons/icons/Expand.js";import"../../icons/customIcons/icons/FolderClosed.js";import"../../icons/customIcons/icons/FolderClosedFilled.js";import"../../icons/customIcons/icons/FolderOpened.js";import"../../icons/customIcons/icons/GreaterOrEqual.js";import"../../icons/customIcons/icons/LessOrEqual.js";import"../../icons/customIcons/icons/Search.js";import"../../icons/customIcons/icons/SearchOne.js";import"../../icons/customIcons/icons/Wellhub.js";import"../../icons/customIcons/icons/MultiRuler.js";import"../../icons/customIcons/icons/Checkbox.js";import"../../icons/customIcons/icons/CheckboxChecked.js";import"../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../icons/customIcons/icons/Radio.js";import"../../icons/customIcons/icons/RadioChecked.js";import"../../icons/customIcons/icons/SimulFrac.js";import"../../icons/customIcons/icons/ZipperFrac.js";import"../../icons/customIcons/icons/CautionFilled.js";import"../../icons/customIcons/icons/InfoRounded.js";import"../../icons/customIcons/icons/FlameFilled.js";import"../../icons/customIcons/icons/MoreApp.js";import"../../icons/customIcons/icons/Pad.js";import"../../icons/customIcons/icons/DrilloutUnit.js";import"../../icons/customIcons/icons/FracFleet.js";import"../../icons/customIcons/icons/Global.js";import"../../icons/customIcons/icons/Program.js";import"../../icons/customIcons/icons/Rig.js";import"../../icons/customIcons/icons/Well.js";import"../../icons/customIcons/icons/Gap.js";import"../../icons/customIcons/icons/Pin.js";import"../../icons/customIcons/icons/PinOne.js";import"../../icons/customIcons/icons/PinOneCrossed.js";import"../../icons/customIcons/icons/CloseOneFilled.js";import"../../icons/customIcons/icons/AttentionFilled.js";import"../../icons/customIcons/icons/CheckOneFilled.js";import"../../icons/customIcons/icons/Archive.js";import"../../icons/customIcons/icons/ArchiveCancel.js";import"../../icons/customIcons/icons/Unarchive.js";import"../../icons/customIcons/icons/Archived.js";import"../../icons/customIcons/icons/InterventionUnit.js";import"../../icons/customIcons/icons/CloudDelete.js";import"../../icons/customIcons/icons/Lasso.js";import"../../icons/customIcons/icons/Radius.js";import"../../icons/customIcons/icons/ErrorOps.js";import"../../icons/customIcons/icons/DataTypeOps.js";import"../../icons/customIcons/icons/FalsePositiveOps.js";import"../../icons/customIcons/icons/CalibrationOps.js";import"../../icons/customIcons/icons/CriticalOps.js";import"../../icons/customIcons/icons/Company.js";import"../../icons/customIcons/icons/ArchiveOne.js";import"../../icons/customIcons/icons/ParseBotFusion.js";import"../../icons/customIcons/icons/Connect.js";import"../../icons/customIcons/icons/PuzzleOne.js";import"../../icons/customIcons/icons/Feed.js";import"../../icons/customIcons/icons/Prompt.js";import"../../icons/customIcons/icons/Companies.js";import"../../icons/customIcons/icons/ClipboardAi.js";import"../../icons/customIcons/icons/Key.js";import"../../icons/customIcons/icons/AtSignCrossed.js";import"../../icons/customIcons/icons/MappingManual.js";import"../../icons/customIcons/icons/Mapping.js";import"../../icons/customIcons/icons/Metrics.js";import"../../icons/customIcons/icons/Drops.js";import"../../icons/customIcons/icons/ClipboardSearch.js";import"../../icons/customIcons/icons/Template.js";import"../../icons/customIcons/icons/ClipboardMetrics.js";import"../../icons/customIcons/icons/ClipboardBuilder.js";import"../../icons/customIcons/icons/UnitConversion.js";import"../../icons/customIcons/icons/NPT.js";import"../../icons/customIcons/icons/GuidedFrac.js";import{AvatarComponent as p}from"../Avatar/index.js";import{AttachFileButton as u}from"../AttachFileButton/AttachFileButton.js";import{CommentInput as d}from"../CommentInputNext/CommentInputNext.js";import j from"../EmojiIconButton.js";import h from"../FailedFileUploading.js";import I from"../UserMention/index.js";import{isSuggestionsListOpened as b}from"../UserMention/utils/index.js";import{WellhubFilePicker as f}from"../WellhubFilePicker/WellhubFilePicker.js";import"@babel/runtime/helpers/toConsumableArray";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"lodash/set";import"lodash/get";import"lodash/unset";import"moment";import"../../clients/jsonApi/index.js";import"../../clients/subscriptions/subscriptions-client.factory.js";import"../../clients/api/apiCore.js";import"../../clients/constants.js";import"../../clients/sso/auth0.js";import"../../clients/sso/oauth2.js";import"../../clients/api/rateLimiter.js";import"uuid";import{useAttachmentUpload as g,DEFAULT_MAX_ATTACHMENTS as C}from"./useAttachmentUpload.js";import{CommentMetaLine as v}from"./CommentMetaLine.js";import{ShareToChatRow as y}from"./ShareToChatRow.js";import F from"./CommentComposer.scss.js";import{jsxs as O,Fragment as A,jsx as S}from"react/jsx-runtime";function P(o,s){var n=Object.keys(o);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(o);s&&(t=t.filter((function(s){return Object.getOwnPropertyDescriptor(o,s).enumerable}))),n.push.apply(n,t)}return n}function x(s){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?P(Object(t),!0).forEach((function(n){o(s,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):P(Object(t)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(t,o))}))}return s}var k={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)"}}}},E=function(o){return O("div",{className:F.suggestion,children:[S(p,{size:26,alt:o.display,imgSrc:o.photo,displayName:o.display}),S("span",{children:o.display})]})},w=function(o){var p=o.body,P=o.onBodyChange,w=o.onSubmit,D=o.canSubmit,R=o.currentUser,M=o.attachments,U=o.onAttachmentsChange,N=o.maxAttachments,B=void 0===N?C:N,L=o.attachment,T=o.onAttachmentChange,z=o.attachmentError,W=o.onAttachmentError,G=o.maxAttachmentSizeBytes,q=o.wellhubContext,K=o.disabled,H=o.autoFocus,V=o.placeholder,Q=void 0===V?"Add a comment...":V,Z=o.metaRows,$=o.isMetaSingleLine,J=o.shareToChat,X=o.trailing,Y=o.renderTrailing,_=o.embedded,oo=o.className,so=o.testId,no=!!U,to=n((function(){return no?null!=M?M:[]:[L].filter(Boolean)}),[no,M,L]),io=t((function(o){var s;U?U(o):null==T||T(null!==(s=o[0])&&void 0!==s?s:null)}),[U,T]),co=g({value:to,onChange:io,onError:W,maxSizeBytes:G,maxFiles:no?B:1}),eo=D&&!co.isUploading,ro=function(){eo&&!K&&w()},mo=i(!1),ao=s(mo,2),lo=ao[0],po=ao[1],uo=n((function(){return to.map((function(o){return o.name}))}),[to]),jo=c(null);return O(A,{children:[S(d,{value:p,canSubmit:eo,disabled:K,onSubmit:w,trailing:Y?Y({canSend:eo&&!K,submit:ro}):X,embedded:_,className:oo,testId:so,field:S(e,{inputComponent:I,inputProps:{onChange:P,currentUser:R,allowEmptyQuery:!0,suggestionsPortalHost:document.querySelector("body"),withLightTheme:!1,mentionProps:{renderSuggestion:E},highlightLinks:!0,style:k},value:p,placeholder:Q,inputRef:jo,className:F.mentionField,onKeyDown:function(o){"Enter"!==o.key||o.shiftKey||eo&&!K&&(b()||(o.preventDefault(),ro()))},disableUnderline:!0,rows:1,fullWidth:!0,multiline:!0,autoFocus:H}),attachments:co.items,onAttachmentRemove:co.removeAttachment,onAttachmentRetry:co.handleRetry,onAttachmentReorder:no?co.reorderAttachments:void 0,onFilesDrop:co.addFiles,onImageLinkPaste:co.addLinkedImage,dropLabel:1===co.maxFiles?"Drop a file here":"Drop files here",attachmentSlot:z?S(h,{errorMessage:z}):void 0,toolbar:O(A,{children:[S(u,{inputRef:co.fileInputRef,onClick:co.openFileDialog,onFileSelect:co.handleFileSelect,onWellhubSelect:q?function(){return po(!0)}:void 0,multiple:no,disabled:co.isFull,tooltip:co.isFull?"Up to ".concat(co.maxFiles," ").concat(1===co.maxFiles?"file":"files"," can be attached"):"Attach ".concat(no?"files":"file")}),S(a,{title:"Mention someone",children:S(m,{size:"xs",type:"tertiary",onClick:function(){var o,s=jo.current;if(s){s.focus();var n=!!s.value&&!/\s$/.test(s.value),t="".concat(s.value).concat(n?" @":"@"),i=null===(o=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(s),"value"))||void 0===o?void 0:o.set;null==i||i.call(s,t),s.setSelectionRange(t.length,t.length),s.dispatchEvent(new Event("input",{bubbles:!0})),s.dispatchEvent(new Event("keyup",{bubbles:!0}))}},children:S(r,{fontSize:"inherit"})})}),S("span",{className:F.iconSlot,children:S(j,{icon:S(l,{size:16}),handleSelectEmoji:function(o){return P("".concat(p).concat(o.native))}})})]}),footer:(!(null==Z||!Z.length)||!!J)&&O(A,{children:[S(v,{rows:null!=Z?Z:[],singleLine:$}),J&&S(y,x({},J))]})}),q&&S(f,x(x({},q),{},{open:lo,maxSelectable:co.maxFiles-co.count,attachedFileNames:uo,onAdd:function(o){po(!1),co.addStoredFiles(o.map((function(o){return{fileName:o.fileName}})))},onClose:function(){return po(!1)}}))]})};export{w as CommentComposer};
|
|
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","CommentComposer","_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","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":"yjMAgFA,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,EAAA,MAAA,CAAKC,UAAWC,EAAOC,WAAWC,SAAA,CAChCC,EAACC,EAAM,CAACC,KAAM,GAAIC,IAAKT,EAAMU,QAASC,OAAQX,EAAMY,MAAOC,YAAab,EAAMU,UAC9EJ,EAAA,OAAA,CAAAD,SAAOL,EAAMU,YACT,EAGKI,EAAkB,SAyBHC,GAAA,IAxB1BC,IAAAA,KACAC,IAAAA,aACAC,IAAAA,SACAC,IAAAA,UACAC,IAAAA,YACAC,IAAAA,YACAC,IAAAA,oBAAmBC,EAAAR,EACnBS,eAAAA,aAAiBC,EAAuBF,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,KAAAA,O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AAS,CAAEC,SAAS,KAClDzE,EAAMuE,cAAc,IAAIC,MAAM,QAAS,CAAEC,SAAS,IAXtC,GAwF4D5I,SAC5DC,EAAC4I,EAAkB,CAAC1J,SAAS,gBAGjCc,EAAA,OAAA,CAAMJ,UAAWC,EAAOgJ,SAAS9I,SAC/BC,EAAC8I,EAAe,CACdC,KAAM/I,EAACgJ,EAAe,CAAC9I,KAAM,KAC7B+I,kBAAmB,SAACC,GAAyB,OAC3CvI,EAAgBD,GAAAA,OAAAA,UAAOwI,EAAMC,QAAS,SAMhDC,UACKtH,UAAAA,EAAU0G,WAAYxG,IACvBrC,EAAAqE,EAAA,CAAAjE,SAAA,CACEC,EAACqJ,EAAe,CAAC7D,KAAM1D,QAAAA,EAAY,GAAIwH,WAAYvH,IAClDC,GAAehC,EAACuJ,EAAcC,EAAA,CAAA,EAAKxH,SAM3CP,GACCzB,EAACyJ,SACKhI,GAAc,GAAA,CAClBiI,KAAMjG,GACNkG,cAAe9G,GAAOK,SAAWL,GAAO+G,MACxCC,kBAAmBlG,GACnBmG,MAhIgB,SAACC,GACvBrG,IAAiB,GACjBb,GAAOmH,eAAeD,EAAMnG,KAAI,SAAAqG,GAAI,MAAK,CAAEC,SAAUD,EAAKC,SAAW,MA+H/DC,QAAS,WAAA,OAAMzG,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","CommentComposer","_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","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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GAAyB,OAC3CzI,EAAgBD,GAAAA,OAAAA,UAAO0I,EAAMC,QAAS,SAMhDC,UACKxH,UAAAA,EAAU4G,WAAY1G,IACvBrC,EAAAuE,EAAA,CAAAnE,SAAA,CACEC,EAACuJ,EAAe,CAAC7D,KAAM5D,QAAAA,EAAY,GAAI0H,WAAYzH,IAClDC,GAAehC,EAACyJ,EAAcC,EAAA,CAAA,EAAK1H,SAM3CP,GACCzB,EAAC2J,SACKlI,GAAc,GAAA,CAClBmI,KAAMjG,GACNkG,cAAe/G,GAAOK,SAAWL,GAAOgH,MACxCC,kBAAmBlG,GACnBmG,MAlIgB,SAACC,GACvBrG,IAAiB,GACjBd,GAAOoH,eAAeD,EAAMnG,KAAI,SAAAqG,GAAI,MAAK,CAAEC,SAAUD,EAAKC,SAAW,MAiI/DC,QAAS,WAAA,OAAMzG,IAAiB,EAAM,OAKhD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommentComposer.trailing.test.d.ts","sourceRoot":"","sources":["../../../../src/components/CommentComposer/__tests__/CommentComposer.trailing.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from'./../../ext-esm/style-inject/dist/style-inject.es.js';var t={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"};e(".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}");export{t as default};
|
|
1
|
+
import e from'./../../ext-esm/style-inject/dist/style-inject.es.js';var t={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"};e(".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}");export{t as default};
|
|
2
2
|
//# sourceMappingURL=CommentInputNext.scss.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ResolvedImage } from './useImageDimensions';
|
|
2
|
+
type Props = {
|
|
3
|
+
target: HTMLElement;
|
|
4
|
+
status: ResolvedImage['status'];
|
|
5
|
+
};
|
|
6
|
+
export declare const GalleryImageStatus: ({ target, status }: Props) => import("react").ReactPortal | null;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=GalleryImageStatus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GalleryImageStatus.d.ts","sourceRoot":"","sources":["../../../src/componentsV2/ImageViewer/GalleryImageStatus.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,KAAK,KAAK,GAAG;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAA;CAAE,CAAC;AACtE,eAAO,MAAM,kBAAkB,uBAAwB,KAAK,uCAcrD,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createPortal as a}from"react-dom";import r from"../../components/LoadingIndicator/LoadingIndicator.js";import e from"./GalleryViewer.scss.js";import{jsx as i}from"react/jsx-runtime";var t=function(t){var o=t.target,n=t.status;return"ready"===n?null:a(i("div",{role:"status","aria-live":"polite",className:e.imageStatus,children:"pending"===n?i("span",{"aria-label":"Loading image",children:i(r,{fullscreen:!1})}):"This image failed to load"}),o)};export{t as GalleryImageStatus};
|
|
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":["GalleryImageStatus","_ref","target","status","createPortal","_jsx","role","className","styles","imageStatus","children","LoadingIndicator","fullscreen"],"mappings":"6LAMaA,IAAAA,EAAqB,SAAHC,GAAA,IAAMC,IAAAA,OAAQC,IAAAA,OAAM,MACtC,UAAXA,EACI,KACAC,EACEC,EAAA,MAAA,CAAKC,KAAK,SAAS,YAAU,SAASC,UAAWC,EAAOC,YAAYC,SACtD,YAAXP,EACCE,EAAA,OAAA,CAAM,aAAW,gBAAeK,SAC9BL,EAACM,EAAgB,CAACC,YAAY,MAGhC,8BAGJV,EACD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import 'photoswipe/photoswipe.css';
|
|
2
|
+
import { GalleryImageViewerProps } from './types';
|
|
3
|
+
export declare const GalleryImageViewer: ({ images: sourceItems, initialIndex, presentation, onIndexChange, onOpen, onClose, isSourceApi, }: GalleryImageViewerProps & {
|
|
4
|
+
isSourceApi?: boolean;
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
//# sourceMappingURL=GalleryImageViewer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GalleryImageViewer.d.ts","sourceRoot":"","sources":["../../../src/componentsV2/ImageViewer/GalleryImageViewer.tsx"],"names":[],"mappings":"AASA,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAYlD,eAAO,MAAM,kBAAkB,sGAQ5B,uBAAuB,GAAG;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,4CAsMrD,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import o from"@babel/runtime/helpers/defineProperty";import s from"@babel/runtime/helpers/slicedToArray";import{useState as n,useRef as i,useEffect as c}from"react";import t from"photoswipe/lightbox";import e from"photoswipe";import{renderToString as r}from"react-dom/server";import{ArrowLeftIcon as m}from"../../icons/iconParkIcons.js";import"../../icons/customIcons/icons/AddMessage.js";import"../../icons/customIcons/icons/DragOne.js";import"../../icons/customIcons/icons/Attention.js";import"../../icons/customIcons/icons/Collapse.js";import"../../icons/customIcons/icons/Dashboard.js";import"../../icons/customIcons/icons/Expand.js";import"../../icons/customIcons/icons/FolderClosed.js";import"../../icons/customIcons/icons/FolderClosedFilled.js";import"../../icons/customIcons/icons/FolderOpened.js";import"../../icons/customIcons/icons/GreaterOrEqual.js";import"../../icons/customIcons/icons/LessOrEqual.js";import"../../icons/customIcons/icons/Search.js";import"../../icons/customIcons/icons/SearchOne.js";import"../../icons/customIcons/icons/Wellhub.js";import"../../icons/customIcons/icons/MultiRuler.js";import"../../icons/customIcons/icons/Checkbox.js";import"../../icons/customIcons/icons/CheckboxChecked.js";import"../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../icons/customIcons/icons/Radio.js";import"../../icons/customIcons/icons/RadioChecked.js";import"../../icons/customIcons/icons/SimulFrac.js";import"../../icons/customIcons/icons/ZipperFrac.js";import"../../icons/customIcons/icons/CautionFilled.js";import"../../icons/customIcons/icons/InfoRounded.js";import"../../icons/customIcons/icons/FlameFilled.js";import"../../icons/customIcons/icons/MoreApp.js";import"../../icons/customIcons/icons/Pad.js";import"../../icons/customIcons/icons/DrilloutUnit.js";import"../../icons/customIcons/icons/FracFleet.js";import"../../icons/customIcons/icons/Global.js";import"../../icons/customIcons/icons/Program.js";import"../../icons/customIcons/icons/Rig.js";import"../../icons/customIcons/icons/Well.js";import"../../icons/customIcons/icons/Gap.js";import"../../icons/customIcons/icons/Pin.js";import"../../icons/customIcons/icons/PinOne.js";import"../../icons/customIcons/icons/PinOneCrossed.js";import"../../icons/customIcons/icons/CloseOneFilled.js";import"../../icons/customIcons/icons/AttentionFilled.js";import"../../icons/customIcons/icons/CheckOneFilled.js";import"../../icons/customIcons/icons/Archive.js";import"../../icons/customIcons/icons/ArchiveCancel.js";import"../../icons/customIcons/icons/Unarchive.js";import"../../icons/customIcons/icons/Archived.js";import"../../icons/customIcons/icons/InterventionUnit.js";import"../../icons/customIcons/icons/CloudDelete.js";import"../../icons/customIcons/icons/Lasso.js";import"../../icons/customIcons/icons/Radius.js";import"../../icons/customIcons/icons/ErrorOps.js";import"../../icons/customIcons/icons/DataTypeOps.js";import"../../icons/customIcons/icons/FalsePositiveOps.js";import"../../icons/customIcons/icons/CalibrationOps.js";import"../../icons/customIcons/icons/CriticalOps.js";import"../../icons/customIcons/icons/Company.js";import"../../icons/customIcons/icons/ArchiveOne.js";import"../../icons/customIcons/icons/ParseBotFusion.js";import"../../icons/customIcons/icons/Connect.js";import"../../icons/customIcons/icons/PuzzleOne.js";import"../../icons/customIcons/icons/Feed.js";import"../../icons/customIcons/icons/Prompt.js";import"../../icons/customIcons/icons/Companies.js";import"../../icons/customIcons/icons/ClipboardAi.js";import"../../icons/customIcons/icons/Key.js";import"../../icons/customIcons/icons/AtSignCrossed.js";import"../../icons/customIcons/icons/MappingManual.js";import"../../icons/customIcons/icons/Mapping.js";import"../../icons/customIcons/icons/Metrics.js";import"../../icons/customIcons/icons/Drops.js";import"../../icons/customIcons/icons/ClipboardSearch.js";import"../../icons/customIcons/icons/Template.js";import"../../icons/customIcons/icons/ClipboardMetrics.js";import"../../icons/customIcons/icons/ClipboardBuilder.js";import"../../icons/customIcons/icons/UnitConversion.js";import"../../icons/customIcons/icons/NPT.js";import"../../icons/customIcons/icons/GuidedFrac.js";import{useIsInsideIsolatedDcApp as u}from"../../components/DevCenter/DevCenterAppContainer/components/IsInsideIsolatedDcAppProvider.js";import{registerSourceToolbar as a}from"./registerSourceToolbar.js";import{registerViewerWindow as l}from"./registerViewerWindow.js";import p from"./ImageViewer.scss.js";import"photoswipe/photoswipe.css";import{useImageDimensions as d}from"./useImageDimensions.js";import{GalleryImageStatus as j}from"./GalleryImageStatus.js";import{registerLegacyToolbar as I}from"./registerLegacyToolbar.js";import{registerLegacyLifecycle as h}from"./registerLegacyLifecycle.js";import{registerLegacyWheel as f}from"./registerLegacyWheel.js";import{getLegacyScale as g}from"./legacyZoom.js";import v from"./GalleryViewer.scss.js";import{physicalCount as C,slideAt as y,logicalIndex as b}from"./logicalSlides.js";import{jsx as O,jsxs as w,Fragment as A}from"react/jsx-runtime";function F(o,s){var n=Object.keys(o);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(o);s&&(i=i.filter((function(s){return Object.getOwnPropertyDescriptor(o,s).enumerable}))),n.push.apply(n,i)}return n}var D={chat:10,single:0},P=function(P){var x=P.images,M=P.initialIndex,S=void 0===M?0:M,T=P.presentation,L=void 0===T?"chat":T,k=P.onIndexChange,E=P.onOpen,Z=P.onClose,z=P.isSourceApi,G=void 0!==z&&z,R=n((function(){return Math.max(0,Math.min(x.length-1,Number.isFinite(S)?Math.trunc(S):0))})),W=s(R,1)[0],V=u(),U=V?window.parent:window,q=G?50:D[L],H=i(null),N=d(x),B=n(W),K=s(B,2),J=K[0],Q=K[1],X=n(null),Y=s(X,2),$=Y[0],_=Y[1],oo=i({items:N,onIndexChange:k,onOpen:E,onClose:Z}),so=i(null),no=i(N),io=i();c((function(){oo.current={items:N,onIndexChange:k,onOpen:E,onClose:Z}}),[N,k,E,Z]);var co=N.length,to=!G||"ready"===N[0].status;return c((function(){var s,n,i,c,u;if(to){var d=!1,j=new t(function(s){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?F(Object(i),!0).forEach((function(n){o(s,n,i[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(i)):F(Object(i)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(i,o))}))}return s}({pswpModule:e,appendToEl:V?U.document.body:null!==(s=null!==(n=null===(i=H.current)||void 0===i?void 0:i.closest(".MuiDialog-container"))&&void 0!==n?n:null===(c=H.current)||void 0===c?void 0:c.closest('[role="dialog"]'))&&void 0!==s?s:U.document.body,getViewportSizeFn:function(){return{x:U.innerWidth,y:U.innerHeight}},returnFocus:!1,preloadFirstSlide:!1,dataSource:oo.current.items,loop:!0,counter:!1,clickToCloseNonZoomable:!1,wheelToZoom:!0,initialZoomLevel:"fit",secondaryZoomLevel:function(o){return g(o.fit,100)},maxZoomLevel:function(o){return g(o.fit,300)},imageClickAction:!1,zoom:!1,close:!1,escKey:!1,showHideAnimationType:"fade",easing:"ease",showAnimationDuration:0,hideAnimationDuration:300,maxWidthToAnimate:1/0,mainClass:v.root,padding:{top:q,bottom:q,left:q,right:q},errorMsg:"This image failed to load"},G?{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:p.root,closeSVG:r(O(m,{}))}:{}));l(j,U);var w=h(j,(function(){var o,s;x(),null===(o=(s=oo.current).onClose)||void 0===o||o.call(s)}),U);G&&a(j);var A,D=G?void 0:I(j,L,w.closeImmediately,w.isClosing),P=G?void 0:f(j,U.document),x=function(){null==D||D(),null==P||P(),so.current===j&&(so.current=null)};j.on("destroy",x),so.current=j,no.current=oo.current.items,j.addFilter("numItems",(function(){return C(co)})),j.addFilter("itemData",(function(o,s){var n=y(oo.current.items,s);return{id:n.id,src:n.src,width:n.width,height:n.height,alt:n.alt,type:"image"}})),j.on("contentLoadImage",(function(o){o.content.data.src&&o.content.data.width&&o.content.data.height||o.preventDefault()})),j.on("uiRegister",(function(){var o,s;null===(o=j.pswp)||void 0===o||null===(s=o.ui)||void 0===s||s.registerElement({name:"gallery-image-status",appendTo:"root",onInit:function(o){d||(o.style.pointerEvents="none",_(o))}})})),j.on("initialLayout",(function(){var o,s;d||w.isClosing()||null===(o=(s=oo.current).onOpen)||void 0===o||o.call(s)})),j.on("change",(function(){var o,s;if(!d&&!w.isClosing()){var n,i,c=b(null!==(o=null===(s=j.pswp)||void 0===s?void 0:s.currIndex)&&void 0!==o?o:W,co);if(Q(c),c!==A)A=c,null===(n=(i=oo.current).onIndexChange)||void 0===n||n.call(i,c)}})),j.on("close",(function(){so.current===j&&(so.current=null)})),j.init();var M=io.current,S=function(){d||w.isClosing()||j.loadAndOpen(Math.min(W,co-1))},T=function(){queueMicrotask(S)};return null!=M&&null!==(u=M.element)&&void 0!==u&&u.isConnected?M.on("destroy",T):S(),function(){var o;d=!0,null==M||M.off("destroy",T),io.current=null!==(o=j.pswp)&&void 0!==o?o:M,x(),w.dispose()}}}),[co,W,q,L,G,to,V,U]),c((function(){var o,s=no.current;no.current=N;var n=null===(o=so.current)||void 0===o?void 0:o.pswp;if(n)for(var i=0;i<C(co);i+=1){var c=y(s,i),t=y(N,i);c.src===t.src&&c.width===t.width&&c.height===t.height&&c.alt===t.alt&&c.id===t.id||n.refreshSlideContent(i)}}),[N,co]),w(A,{children:[O("span",{ref:H,hidden:!0,"aria-hidden":"true"}),$&&O(j,{target:$,status:N[b(J,N.length)].status})]})};export{P as GalleryImageViewer};
|
|
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","GalleryImageViewer","_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","ref","hidden","GalleryImageStatus","target"],"mappings":"itKAoBA,IAAMA,EAAsB,CAAEC,KAAM,GAAIC,OAAQ,GAEnCC,EAAqB,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,GAAS,WAAA,OACvBC,KAAKC,IACH,EACAD,KAAKE,IAAIf,EAAYgB,OAAS,EAAGC,OAAOC,SAASf,GAAgBU,KAAKM,MAAMhB,GAAgB,OAHzFiB,EAKNC,EAAAV,EAAA,GALW,GAMNW,EAAaC,IACbC,EAAeF,EAAaG,OAAOC,OAASD,OAC5CE,EAAUjB,EAAc,GAAKf,EAAoBU,GACjDuB,EAAcC,EAAwB,MACtCC,EAAQC,EAAmB/B,GACKY,EAAAA,EAASQ,GAAMY,EAAAX,EAAAY,EAAA,GAA9CC,EAAWF,EAAA,GAAEG,EAAcH,EAAA,GACMpB,EAAAA,EAA6B,MAAKwB,EAAAf,EAAAgB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,eAAO,MAAM,cAAc,0BAA2B,KAAK,4CAuD1D,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import o from"@material-ui/icons/ArrowBack";import s from"@material-ui/icons/SaveAlt";import{CloseIcon as c}from"../../icons/iconParkIcons.js";import"../../icons/customIcons/icons/AddMessage.js";import"../../icons/customIcons/icons/DragOne.js";import"../../icons/customIcons/icons/Attention.js";import"../../icons/customIcons/icons/Collapse.js";import"../../icons/customIcons/icons/Dashboard.js";import"../../icons/customIcons/icons/Expand.js";import"../../icons/customIcons/icons/FolderClosed.js";import"../../icons/customIcons/icons/FolderClosedFilled.js";import"../../icons/customIcons/icons/FolderOpened.js";import"../../icons/customIcons/icons/GreaterOrEqual.js";import"../../icons/customIcons/icons/LessOrEqual.js";import"../../icons/customIcons/icons/Search.js";import"../../icons/customIcons/icons/SearchOne.js";import"../../icons/customIcons/icons/Wellhub.js";import"../../icons/customIcons/icons/MultiRuler.js";import"../../icons/customIcons/icons/Checkbox.js";import"../../icons/customIcons/icons/CheckboxChecked.js";import"../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../icons/customIcons/icons/Radio.js";import"../../icons/customIcons/icons/RadioChecked.js";import"../../icons/customIcons/icons/SimulFrac.js";import"../../icons/customIcons/icons/ZipperFrac.js";import"../../icons/customIcons/icons/CautionFilled.js";import"../../icons/customIcons/icons/InfoRounded.js";import"../../icons/customIcons/icons/FlameFilled.js";import"../../icons/customIcons/icons/MoreApp.js";import"../../icons/customIcons/icons/Pad.js";import"../../icons/customIcons/icons/DrilloutUnit.js";import"../../icons/customIcons/icons/FracFleet.js";import"../../icons/customIcons/icons/Global.js";import"../../icons/customIcons/icons/Program.js";import"../../icons/customIcons/icons/Rig.js";import"../../icons/customIcons/icons/Well.js";import"../../icons/customIcons/icons/Gap.js";import"../../icons/customIcons/icons/Pin.js";import"../../icons/customIcons/icons/PinOne.js";import"../../icons/customIcons/icons/PinOneCrossed.js";import"../../icons/customIcons/icons/CloseOneFilled.js";import"../../icons/customIcons/icons/AttentionFilled.js";import"../../icons/customIcons/icons/CheckOneFilled.js";import"../../icons/customIcons/icons/Archive.js";import"../../icons/customIcons/icons/ArchiveCancel.js";import"../../icons/customIcons/icons/Unarchive.js";import"../../icons/customIcons/icons/Archived.js";import"../../icons/customIcons/icons/InterventionUnit.js";import"../../icons/customIcons/icons/CloudDelete.js";import"../../icons/customIcons/icons/Lasso.js";import"../../icons/customIcons/icons/Radius.js";import"../../icons/customIcons/icons/ErrorOps.js";import"../../icons/customIcons/icons/DataTypeOps.js";import"../../icons/customIcons/icons/FalsePositiveOps.js";import"../../icons/customIcons/icons/CalibrationOps.js";import"../../icons/customIcons/icons/CriticalOps.js";import"../../icons/customIcons/icons/Company.js";import"../../icons/customIcons/icons/ArchiveOne.js";import"../../icons/customIcons/icons/ParseBotFusion.js";import"../../icons/customIcons/icons/Connect.js";import"../../icons/customIcons/icons/PuzzleOne.js";import"../../icons/customIcons/icons/Feed.js";import"../../icons/customIcons/icons/Prompt.js";import"../../icons/customIcons/icons/Companies.js";import"../../icons/customIcons/icons/ClipboardAi.js";import"../../icons/customIcons/icons/Key.js";import"../../icons/customIcons/icons/AtSignCrossed.js";import"../../icons/customIcons/icons/MappingManual.js";import"../../icons/customIcons/icons/Mapping.js";import"../../icons/customIcons/icons/Metrics.js";import"../../icons/customIcons/icons/Drops.js";import"../../icons/customIcons/icons/ClipboardSearch.js";import"../../icons/customIcons/icons/Template.js";import"../../icons/customIcons/icons/ClipboardMetrics.js";import"../../icons/customIcons/icons/ClipboardBuilder.js";import"../../icons/customIcons/icons/UnitConversion.js";import"../../icons/customIcons/icons/NPT.js";import"../../icons/customIcons/icons/GuidedFrac.js";import i from"./GalleryViewer.scss.js";import{jsxs as n,Fragment as t,jsx as m}from"react/jsx-runtime";var r=function(r){var e=r.presentation,a=r.src;return n(t,{children:["single"===e&&m("div",{className:i.back,children:m("button",{type:"button","aria-label":"Close","data-action":"close",tabIndex:-1,className:i.iconButton,children:m(o,{className:i.toolbarIcon,htmlColor:"#b3b3b3"})})}),n("ul",{className:i.toolbarRight,children:[m("li",{className:i.toolbarItem,children:"single"===e?m("a",{"aria-label":"Download",className:i.iconButton,href:a||void 0,"data-download":!0,download:"image",target:"_blank",rel:"noopener noreferrer",children:m(s,{className:i.toolbarIcon,htmlColor:"#b3b3b3"})}):m("button",{type:"button","aria-label":"Close","data-action":"close",className:i.chatClose,children:m(c,{})})}),m("li",{className:i.toolbarItem,children:m("button",{type:"button","aria-label":"Zoom in",title:"Zoom in","data-action":"zoom-in",className:i.zoomIn})}),m("li",{className:i.toolbarItem,children:m("button",{type:"button","aria-label":"Zoom out",title:"Zoom out","data-action":"zoom-out",className:i.zoomOut})})]})]})};export{r as GalleryToolbar};
|
|
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":["GalleryToolbar","_ref","presentation","src","_jsxs","_Fragment","children","_jsx","className","styles","back","type","tabIndex","iconButton","BackIcon","toolbarIcon","htmlColor","toolbarRight","toolbarItem","href","undefined","download","target","rel","DownloadIcon","chatClose","CloseIcon","title","zoomIn","zoomOut"],"mappings":"whIAMaA,IAAAA,EAAiB,SAAHC,GAAA,IAAMC,IAAAA,aAAcC,IAAAA,IAAG,OAChDC,EAAAC,EAAA,CAAAC,SACGJ,CAAiB,WAAjBA,GACCK,EAAA,MAAA,CAAKC,UAAWC,EAAOC,KAAKJ,SAC1BC,EAAA,SAAA,CACEI,KAAK,SACL,aAAW,QACX,cAAY,QACZC,UAAW,EACXJ,UAAWC,EAAOI,WAAWP,SAE7BC,EAACO,EAAQ,CAACN,UAAWC,EAAOM,YAAaC,UAAU,gBAIzDZ,EAAA,KAAA,CAAII,UAAWC,EAAOQ,aAAaX,SACjC,CAAAC,EAAA,KAAA,CAAIC,UAAWC,EAAOS,YAAYZ,SACd,WAAjBJ,EACCK,EAAA,IAAA,CACE,aAAW,WACXC,UAAWC,EAAOI,WAClBM,KAAMhB,QAAOiB,EACb,iBAAa,EACbC,SAAS,QACTC,OAAO,SACPC,IAAI,sBAAqBjB,SAEzBC,EAACiB,EAAY,CAAChB,UAAWC,EAAOM,YAAaC,UAAU,cAGzDT,EAAA,SAAA,CAAQI,KAAK,SAAS,aAAW,QAAQ,cAAY,QAAQH,UAAWC,EAAOgB,UAAUnB,SACvFC,EAACmB,EAAS,QAIhBnB,EAAA,KAAA,CAAIC,UAAWC,EAAOS,YAAYZ,SAChCC,EAAA,SAAA,CACEI,KAAK,SACL,aAAW,UACXgB,MAAM,UACN,cAAY,UACZnB,UAAWC,EAAOmB,WAGtBrB,EAAA,KAAA,CAAIC,UAAWC,EAAOS,YAAYZ,SAChCC,EAAA,SAAA,CACEI,KAAK,SACL,aAAW,WACXgB,MAAM,WACN,cAAY,WACZnB,UAAWC,EAAOoB,iBAIvB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e from'./../../ext-esm/style-inject/dist/style-inject.es.js';var r={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"};e('@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}');export{r as default};
|
|
2
|
+
//# sourceMappingURL=GalleryViewer.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,aAAa,sDAAyD;"}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import '
|
|
2
|
-
export type ImageViewerProps
|
|
3
|
-
|
|
4
|
-
width?: number;
|
|
5
|
-
height?: number;
|
|
6
|
-
onClose?: () => void;
|
|
7
|
-
onOpen?: () => void;
|
|
8
|
-
};
|
|
9
|
-
export declare const ImageViewer: ({ src, onClose, onOpen, height, width }: ImageViewerProps) => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { ImageViewerProps } from './types';
|
|
2
|
+
export type { ImageViewerProps, ImageViewerItem } from './types';
|
|
3
|
+
export declare const ImageViewer: (props: ImageViewerProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
10
4
|
//# sourceMappingURL=ImageViewer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageViewer.d.ts","sourceRoot":"","sources":["../../../src/componentsV2/ImageViewer/ImageViewer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ImageViewer.d.ts","sourceRoot":"","sources":["../../../src/componentsV2/ImageViewer/ImageViewer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAEjE,eAAO,MAAM,WAAW,UAAW,gBAAgB,mDAiBlD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import{useMemo as r}from"react";import{GalleryImageViewer as t}from"./GalleryImageViewer.js";import{jsx as o}from"react/jsx-runtime";function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}var i=function(i){var c=i.src,p=i.width,s=i.height,u=r((function(){return[{id:"source",src:c||"",width:p,height:s}]}),[c,p,s]);return void 0!==i.images?i.images.length?o(t,function(r){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?n(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}({},i)):null:c?o(t,{images:u,isSourceApi:!0,onOpen:i.onOpen,onClose:i.onClose}):null};export{i as ImageViewer};
|
|
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":["ImageViewer","_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","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":"02IAoBA,IAGaA,EAAc,SAA+DC,GAAA,IAA5DC,IAAAA,IAAKC,IAAAA,QAASC,IAAAA,OAAQC,IAAAA,OAAQC,IAAAA,MACpDC,EAAYC,IAEgBC,EAAAA,GAAwD,WACxF,GAAIH,GAASD,EACX,MAAO,CAAEA,OAAAA,EAAQC,MAAAA,EAGrB,IAAEI,EAAAC,EAAAC,EAAA,GALKC,EAASH,EAAA,GAAEI,EAAYJ,EAAA,GA0M9B,OAnMAK,GAAU,WACR,GAAIb,IAAQW,EAAW,CACrB,IAAMG,EAAM,IAAIC,MAChBD,EAAIE,OAAS,SAAAC,GACX,IAAwCA,EAAAA,EAAEC,cAAlCC,IAAAA,aAAcC,IAAAA,cACtBR,EAAa,CAAER,MAAOe,EAAchB,OAAQiB,KAE9CN,EAAId,IAAMA,CACZ,CACF,GAAG,CAACA,EAAKW,IAETE,GAAU,WACR,GAAKb,GAAQW,EAAb,CAKA,IAAMU,EAAkBhB,EAAYiB,OAASC,OACvCC,EAAW,IAAIC,EAAmB,CACtCC,WAAYC,EACZC,WAAY,CACV,CACE5B,IAAAA,EACAI,MAAOO,EAAUP,MACjBD,OAAQQ,EAAUR,SAGtB0B,yBAAyB,EACzBC,aAAa,EACbC,iBAAkB,MAClBC,QAAS,CAAEC,IAAK,GAAIC,OAAQ,GAAIC,KAAM,GAAIC,MAAO,IAEjDC,WAAYhB,EAAgBiB,SAASC,KACrCC,kBAAmB,WAAA,MAAO,CACxBC,EAAGpB,EAAgBqB,WACnBC,EAAGtB,EAAgBuB,YACnB,EACFC,aAlDe,EAmDfC,UAAWC,EA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Y,IAjLd,GAkLLZ,KAAKa,KAAKf,EAlLL,IAmLLO,EAAqBI,IAAInD,EAAK2B,YAAc,GAG9C3B,EAAK2B,UAAUkB,OAAOJ,OAASK,EAR/B,CASF,GAEJ,IAEA5E,EAAS6B,GAAG,SAAS,WACnBpD,SAAAA,GACF,IAEAuB,EAAS6B,GAAG,WAAW,WACrBpD,SAAAA,GACF,IAEAuB,EAAS6B,GAAG,iBAAiB,WAC3BnD,SAAAA,GACF,IAEAsB,EAASsF,OACTtF,EAASuF,YAAY,GAEd,WACLvF,EAASwF,UAjLX,CAmLF,GAAG,CAAChH,EAAKK,EAAWJ,EAASC,EAAQS,IAE9BwC,EAAK8D,EAAA,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":["ImageViewer","props","src","width","height","sourceImages","useMemo","id","undefined","images","length","_jsx","GalleryImageViewer","_objectSpread","isSourceApi","onOpen","onClose"],"mappings":"4ZAMaA,EAAc,SAACC,GAC1B,IAAQC,EAAuBD,EAAvBC,IAAKC,EAAkBF,EAAlBE,MAAOC,EAAWH,EAAXG,OACdC,EAAeC,GACnB,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,EAACC,iWAAkBC,CAAA,CAAA,EAAKZ,IAAY,KAE9DC,EACLS,EAACC,EAAkB,CACjBH,OAAQJ,EACRS,aAAW,EACXC,OAAQd,EAAMc,OACdC,QAASf,EAAMe,UAEf,IACN"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react-vite';
|
|
2
|
+
import { ImageViewer } from './ImageViewer';
|
|
3
|
+
declare const meta: Meta<typeof ImageViewer>;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const OneImage: () => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const TwoImages: () => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const FourImages: () => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const Loading: () => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const FailedImage: () => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const NestedDialog: () => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=ImageViewer.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageViewer.stories.d.ts","sourceRoot":"","sources":["../../../src/componentsV2/ImageViewer/ImageViewer.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAM7C,OAAO,EAAE,WAAW,EAAmB,MAAM,eAAe,CAAC;AAkB7D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,WAAW,CAGlC,CAAC;eAEa,IAAI;AA2BnB,eAAO,MAAM,QAAQ,+CAAsD,CAAC;AAC5E,eAAO,MAAM,SAAS,+CAAuE,CAAC;AAC9F,eAAO,MAAM,UAAU,+CAA2D,CAAC;AAGnF,eAAO,MAAM,OAAO,+CAAgE,CAAC;AACrF,eAAO,MAAM,WAAW,+CAEvB,CAAC;AAEF,eAAO,MAAM,YAAY,+CAexB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageViewerGallery.test.d.ts","sourceRoot":"","sources":["../../../../src/componentsV2/ImageViewer/__tests__/ImageViewerGallery.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageViewerIsolation.test.d.ts","sourceRoot":"","sources":["../../../../src/componentsV2/ImageViewer/__tests__/ImageViewerIsolation.test.tsx"],"names":[],"mappings":""}
|